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
gadget_interface_validator_page_report.js\n
gadget_interface_validator_panel.html\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.js\n
NETWORK:\n
......@@ -265,7 +266,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.46348.9104.1143</string> </value>
<value> <string>946.50480.64807.43622</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -283,8 +284,8 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1446024817.39</float>
<string>UTC</string>
<float>1447779918.05</float>
<string>GMT</string>
</tuple>
</state>
</object>
......
......@@ -75,7 +75,7 @@
</item>
<item>
<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>
<key> <string>description</string> </key>
......@@ -85,7 +85,7 @@
</item>
<item>
<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>
<key> <string>language</string> </key>
......@@ -108,17 +108,23 @@
<!DOCTYPE html>\n
<html>\n
<head>\n
<title>Gadget Interface Validator Reportpage Interface</title>\n
<title>Gadget Interface Validator Form Interface</title>\n
</head>\n
<body>\n
<h1>Gadget Interface Validator Reportpage Interface</h1>\n
<h3>Interface to display the interface validation report of an application.</h3>\n
<h1>Gadget Interface Validator Form Interface</h1>\n
<h3>Interface for the form page of an interface validator application.</h3>\n
<dl>\n
<dt>reportPageDummyMethod1</dt>\n
<dd>Defining the prototype for a report page dummy method</dd>\n
<dt>initiateForm</dt>\n
<dd>A method to initiate the form with required fields and messages as per the options provided.</dd>\n
<dl>\n
<dt data-parameter-required="required" data-parameter-type="int">param1</dt>\n
<dd>An integer parameter</dd>\n
<dt data-parameter-required="required">options</dt>\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
</body>\n
......@@ -128,7 +134,7 @@
</item>
<item>
<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>
<key> <string>version</string> </key>
......@@ -214,8 +220,8 @@
</tuple>
<state>
<tuple>
<float>1445963728.87</float>
<string>UTC</string>
<float>1447742425.98</float>
<string>GMT</string>
</tuple>
</state>
</object>
......@@ -259,7 +265,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.46338.32164.16076</string> </value>
<value> <string>947.10448.28405.21606</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -277,8 +283,8 @@
</tuple>
<state>
<tuple>
<float>1445963711.98</float>
<string>UTC</string>
<float>1447781423.58</float>
<string>GMT</string>
</tuple>
</state>
</object>
......@@ -334,8 +340,8 @@
</tuple>
<state>
<tuple>
<float>1445963404.93</float>
<string>UTC</string>
<float>1447740382.86</float>
<string>GMT</string>
</tuple>
</state>
</object>
......
......@@ -112,6 +112,8 @@
<meta name="viewport" content="width=device-width, user-scalable=no" />\n
<title>Gadget Interface Validator Formpage</title>\n
\n
<link rel="http://www.renderjs.org/rel/interface" href="gadget_interface_validator_interface_form.html" />\n
\n
<!-- renderjs -->\n
<script src="rsvp.js" type="text/javascript"></script>\n
<script src="renderjs.js" type="text/javascript"></script>\n
......@@ -284,7 +286,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.46342.43288.26299</string> </value>
<value> <string>947.10814.41583.22579</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -302,8 +304,8 @@
</tuple>
<state>
<tuple>
<float>1445964472.82</float>
<string>UTC</string>
<float>1447779998.07</float>
<string>GMT</string>
</tuple>
</state>
</object>
......
......@@ -157,6 +157,10 @@
/////////////////////////////////////////////////////////////////\n
\n
.declareMethod("render", function (options) {\n
return this.initiateForm(options);\n
})\n
\n
.declareMethod("initiateForm", function(options) {\n
var gadget = this;\n
return new RSVP.Queue()\n
.push(function() {\n
......@@ -174,7 +178,59 @@
gadget.props.content_element.querySelector("input[type=text]")\n
.focus();\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
.declareService(function () {\n
......@@ -183,37 +239,7 @@
////////////////////////////////////\n
var gadget = this;\n
function formSubmit(submit_event) {\n
var interface_gadget,\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
return gadget.submitForm(submit_event);\n
}\n
// Listen to form submit\n
return loopEventListener(\n
......@@ -361,7 +387,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.54877.22908.40635</string> </value>
<value> <string>947.11076.45303.33126</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -379,8 +405,8 @@
</tuple>
<state>
<tuple>
<float>1446717901.46</float>
<string>UTC</string>
<float>1447781632.75</float>
<string>GMT</string>
</tuple>
</state>
</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