Commit bd43f063 authored by Vivek's avatar Vivek

gadget_interface_validator: implemented form interface.

parent 50f1c236
...@@ -126,7 +126,8 @@ gadget_interface_validator_page_report.html\n ...@@ -126,7 +126,8 @@ gadget_interface_validator_page_report.html\n
gadget_interface_validator_page_report.js\n gadget_interface_validator_page_report.js\n
gadget_interface_validator_panel.html\n gadget_interface_validator_panel.html\n
gadget_interface_validator_panel.js\n gadget_interface_validator_panel.js\n
gadget_interface_validator_reportpage_interface.html\n gadget_interface_validator_interface_report.html\n
gadget_interface_validator_interface_form.html\n
gadget_interface_validator_router.html\n gadget_interface_validator_router.html\n
gadget_interface_validator_router.js\n gadget_interface_validator_router.js\n
NETWORK:\n NETWORK:\n
...@@ -265,7 +266,7 @@ NETWORK:\n ...@@ -265,7 +266,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>946.46348.9104.1143</string> </value> <value> <string>946.50480.64807.43622</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -283,8 +284,8 @@ NETWORK:\n ...@@ -283,8 +284,8 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1446024817.39</float> <float>1447779918.05</float>
<string>UTC</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
</item> </item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>gadget_interface_validator_reportpage_interface.html</string> </value> <value> <string>gadget_interface_validator_interface_form.html</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>gadget_interface_validator_reportpage_interface_html</string> </value> <value> <string>gadget_interface_validator_interface_form_html</string> </value>
</item> </item>
<item> <item>
<key> <string>language</string> </key> <key> <string>language</string> </key>
...@@ -108,17 +108,23 @@ ...@@ -108,17 +108,23 @@
<!DOCTYPE html>\n <!DOCTYPE html>\n
<html>\n <html>\n
<head>\n <head>\n
<title>Gadget Interface Validator Reportpage Interface</title>\n <title>Gadget Interface Validator Form Interface</title>\n
</head>\n </head>\n
<body>\n <body>\n
<h1>Gadget Interface Validator Reportpage Interface</h1>\n <h1>Gadget Interface Validator Form Interface</h1>\n
<h3>Interface to display the interface validation report of an application.</h3>\n <h3>Interface for the form page of an interface validator application.</h3>\n
<dl>\n <dl>\n
<dt>reportPageDummyMethod1</dt>\n <dt>initiateForm</dt>\n
<dd>Defining the prototype for a report page dummy method</dd>\n <dd>A method to initiate the form with required fields and messages as per the options provided.</dd>\n
<dl>\n <dl>\n
<dt data-parameter-required="required" data-parameter-type="int">param1</dt>\n <dt data-parameter-required="required">options</dt>\n
<dd>An integer parameter</dd>\n <dd>An object containing the display message and other parameters.</dd>\n
</dl>\n
<dt>submitForm</dt>\n
<dd>A method to call after submitting the form. It should fetch and process the form data, and render the next page accordingly.</dd>\n
<dl>\n
<dt data-parameter-required="required">options</dt>\n
<dd>An object containing the submitted form data.</dd>\n
</dl>\n </dl>\n
</dl>\n </dl>\n
</body>\n </body>\n
...@@ -128,7 +134,7 @@ ...@@ -128,7 +134,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Gadget Interface Validator Reportpage Interface</string> </value> <value> <string>Gadget Interface Validator Form Interface</string> </value>
</item> </item>
<item> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
...@@ -214,8 +220,8 @@ ...@@ -214,8 +220,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1445963728.87</float> <float>1447742425.98</float>
<string>UTC</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
</object> </object>
...@@ -259,7 +265,7 @@ ...@@ -259,7 +265,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>946.46338.32164.16076</string> </value> <value> <string>947.10448.28405.21606</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -277,8 +283,8 @@ ...@@ -277,8 +283,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1445963711.98</float> <float>1447781423.58</float>
<string>UTC</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
</object> </object>
...@@ -334,8 +340,8 @@ ...@@ -334,8 +340,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1445963404.93</float> <float>1447740382.86</float>
<string>UTC</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
...@@ -112,6 +112,8 @@ ...@@ -112,6 +112,8 @@
<meta name="viewport" content="width=device-width, user-scalable=no" />\n <meta name="viewport" content="width=device-width, user-scalable=no" />\n
<title>Gadget Interface Validator Formpage</title>\n <title>Gadget Interface Validator Formpage</title>\n
\n \n
<link rel="http://www.renderjs.org/rel/interface" href="gadget_interface_validator_interface_form.html" />\n
\n
<!-- renderjs -->\n <!-- renderjs -->\n
<script src="rsvp.js" type="text/javascript"></script>\n <script src="rsvp.js" type="text/javascript"></script>\n
<script src="renderjs.js" type="text/javascript"></script>\n <script src="renderjs.js" type="text/javascript"></script>\n
...@@ -284,7 +286,7 @@ ...@@ -284,7 +286,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>946.46342.43288.26299</string> </value> <value> <string>947.10814.41583.22579</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -302,8 +304,8 @@ ...@@ -302,8 +304,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1445964472.82</float> <float>1447779998.07</float>
<string>UTC</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
...@@ -157,6 +157,10 @@ ...@@ -157,6 +157,10 @@
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
\n \n
.declareMethod("render", function (options) {\n .declareMethod("render", function (options) {\n
return this.initiateForm(options);\n
})\n
\n
.declareMethod("initiateForm", function(options) {\n
var gadget = this;\n var gadget = this;\n
return new RSVP.Queue()\n return new RSVP.Queue()\n
.push(function() {\n .push(function() {\n
...@@ -174,7 +178,59 @@ ...@@ -174,7 +178,59 @@
gadget.props.content_element.querySelector("input[type=text]")\n gadget.props.content_element.querySelector("input[type=text]")\n
.focus();\n .focus();\n
});\n });\n
})\n
\n \n
.declareMethod("submitForm", function(options) {\n
var gadget = this,\n
interface_gadget,\n
appcache_url,\n
required_interface,\n
page_type,\n
gadget_source_url = \'gadget_interface_validator.appcache\';\n
return new RSVP.Queue()\n
.push(function () {\n
gadget.props.content_element.querySelector("input[type=submit]")\n
.disabled = true;\n
return options.target[0].value;\n
})\n
.push(function(submit_url) {\n
appcache_url = submit_url;\n
return gadget.getDeclaredGadget(INTERFACE_GADGET_SCOPE);\n
})\n
.push(function(i_gadget) {\n
required_interface = \'gadget_interface_validator_interface_report.html\';\n
interface_gadget = i_gadget;\n
return interface_gadget.getGadgetListImplementingInterface(required_interface, gadget_source_url);\n
})\n
.push(function(gadget_list) {\n
if(gadget_list.length > 0) {\n
page_type = fetchPageType(gadget_list[0]);\n
return gadget.redirect({\n
page: page_type,\n
appcache_url: appcache_url\n
});\n
} else {\n
required_interface = \'gadget_interface_validator_interface_form.html\';\n
return new RSVP.Queue()\n
.push(function() {\n
return interface_gadget.getGadgetListImplementingInterface(required_interface, gadget_source_url);\n
})\n
.push(function(gadget_list) {\n
console.log("gadget_list");\n
if(gadget_list.length > 0) {\n
page_type = fetchPageType(gadget_list[0]);\n
return gadget.redirect({\n
page: page_type,\n
found: false\n
});\n
} else {\n
return gadget.redirect({\n
found: false\n
});\n
}\n
});\n
}\n
});\n
})\n })\n
\n \n
.declareService(function () {\n .declareService(function () {\n
...@@ -183,37 +239,7 @@ ...@@ -183,37 +239,7 @@
////////////////////////////////////\n ////////////////////////////////////\n
var gadget = this;\n var gadget = this;\n
function formSubmit(submit_event) {\n function formSubmit(submit_event) {\n
var interface_gadget,\n return gadget.submitForm(submit_event);\n
appcache_url;\n
return new RSVP.Queue()\n
.push(function () {\n
gadget.props.content_element.querySelector("input[type=submit]")\n
.disabled = true;\n
return submit_event.target[0].value;\n
})\n
.push(function(submit_url) {\n
appcache_url = submit_url;\n
return gadget.getDeclaredGadget(INTERFACE_GADGET_SCOPE);\n
})\n
.push(function(i_gadget) {\n
var required_interface = \'gadget_interface_validator_reportpage_interface.html\',\n
gadget_source_url = \'gadget_interface_validator.appcache\';\n
interface_gadget = i_gadget;\n
return interface_gadget.getGadgetListImplementingInterface(required_interface, gadget_source_url);\n
})\n
.push(function(gadget_list) {\n
if(gadget_list.length > 0) {\n
var page_type = fetchPageType(gadget_list[0]);\n
return gadget.redirect({\n
page: page_type,\n
appcache_url: appcache_url\n
});\n
} else {\n
return gadget.redirect({\n
found: false\n
});\n
}\n
});\n
}\n }\n
// Listen to form submit\n // Listen to form submit\n
return loopEventListener(\n return loopEventListener(\n
...@@ -361,7 +387,7 @@ ...@@ -361,7 +387,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>946.54877.22908.40635</string> </value> <value> <string>947.11076.45303.33126</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -379,8 +405,8 @@ ...@@ -379,8 +405,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1446717901.46</float> <float>1447781632.75</float>
<string>UTC</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment