Commit ba03ea2c authored by Vivek's avatar Vivek Committed by Kazuhiko Shiozaki

erp5_gadget_interface_validator: (fixup) used simpler router logic.

parent acb5ca18
......@@ -140,7 +140,7 @@
<script id="panel-template-body" type="text/x-handlebars-template">\n
<div class="ui-content">\n
<ul data-role="listview" class="ui-listview">\n
<li><a href="#/?page=form" data-i18n="Interface Validation Form">Interface Validation Form</a></li>\n
<li><a href="#page=form" data-i18n="Interface Validation Form">Interface Validation Form</a></li>\n
</ul>\n
</div>\n
</script>\n
......@@ -289,7 +289,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.44825.62507.52206</string> </value>
<value> <string>946.54879.52570.13994</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -307,7 +307,7 @@
</tuple>
<state>
<tuple>
<float>1446476148.07</float>
<float>1446805712.99</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -111,38 +111,29 @@
REDIRECT_TIMEOUT = 5000;\n
\n
function listenHashChange(gadget) {\n
// Handle hash in this format: #$path1/path2?a=b&c=d\n
function extractHashAndDispatch(evt) {\n
var hash = (evt.newURL || window.location.toString()).split(\'#\')[1],\n
split,\n
command = "",\n
query = "",\n
subhashes,\n
subhash,\n
keyvalue,\n
index,\n
args = {};\n
if (hash !== undefined) {\n
split = hash.split(\'?\');\n
command = split[0] || "";\n
query = split[1] || "";\n
}\n
subhashes = query.split(\'&\');\n
for (index in subhashes) {\n
if (subhashes.hasOwnProperty(index)) {\n
subhash = subhashes[index];\n
if (subhash !== \'\') {\n
keyvalue = subhash.split(\'=\');\n
if (keyvalue.length === 2) {\n
args[decodeURIComponent(keyvalue[0])] = decodeURIComponent(keyvalue[1]);\n
subhashes = hash.split(\'&\');\n
for (index in subhashes) {\n
if (subhashes.hasOwnProperty(index)) {\n
subhash = subhashes[index];\n
if (subhash !== \'\') {\n
keyvalue = subhash.split(\'=\');\n
if (keyvalue.length === 2) {\n
args[decodeURIComponent(keyvalue[0])] = decodeURIComponent(keyvalue[1]);\n
}\n
}\n
}\n
}\n
}\n
\n
return gadget.renderApplication({\n
method: command[0],\n
path: command.substr(1),\n
args: args\n
});\n
\n
......@@ -165,7 +156,7 @@
})\n
\n
.declareMethod("getCommandUrlFor", function(options) {\n
var prefix = \'?\',\n
var prefix = \'\',\n
result,\n
key;\n
result = "#";\n
......@@ -354,7 +345,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.54883.25521.16366</string> </value>
<value> <string>946.58912.52724.48776</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -372,7 +363,7 @@
</tuple>
<state>
<tuple>
<float>1446718128.25</float>
<float>1446805302.57</float>
<string>UTC</string>
</tuple>
</state>
......
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