Commit dcfa6be0 authored by Kristopher Ruzic's avatar Kristopher Ruzic

add new page to browser, view module list and jump to module's actions

also fixes bt5 configuration by removing officejs from file includes
parent 965c9809
......@@ -120,18 +120,28 @@
<script src="handlebars.js"></script>\n
<script src="gadget_global.js"></script>\n
\n
\n
<!-- custom script -->\n
<script src="gadget_hateoasbrowser_page_front.js" type="text/javascript"></script>\n
\n
<script id="random-widget-thing" type="text/x-handlebars-template">\n
<div class="ui-grid-b ui-responsive">\n
<div class="ui-block-a"></div>\n
<div class="ui-block-b">\n
<div class="ui-block-a">\n
<ul class="ui-listview ui-listview-inset ui-corner-all ui-shadow" data-role="listview" id="modulelist-widget">\n
{{#each mod_link}}\n
<li class="ui-btn ui-btn-icon-right ui-icon-carat-r">\n
\t\t\t\t\t<a href={{href}}><h2>{{mod_name}}</h2></a>\n
\t\t\t</li>\n
\t\t\t{{/each}}\n
\t\t</ul>\n
\t</div>\n
<div class="ui-block-b"></div>\n
<div class="ui-block-c">\n
<ul class="ui-listview ui-listview-inset ui-corner-all ui-shadow" data-role="listview" id="listview-widget">\n
{{#each link}}\n
<li class="ui-btn ui-btn-icon-right ui-icon-carat-r" >\n
\t\t\t\t\t<h2>{{site_name}}</h2>\n
\t\t\t\t\t<p>{{href}}</p>\n
<li class="ui-btn ui-btn-icon-right ui-icon-carat-r">\n
\t\t\t\t\t<a href={{href}}><h2>{{site_name}}</h2>\n
\t\t\t\t\t<p>{{href}}</p></a>\n
\t\t\t</li>\n
\t\t\t{{/each}}\n
\t\t</ul>\n
......@@ -141,7 +151,8 @@
\n
</head>\n
<body>\n
<div role="main" class="ui-content gadget-content"></div>\n
<div role="main" class="ui-content gadget-content">\n
</div>\n
</body>\n
</html>
......@@ -280,7 +291,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.25923.25019.28450</string> </value>
<value> <string>946.34722.13667.16025</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -298,7 +309,7 @@
</tuple>
<state>
<tuple>
<float>1444739121.15</float>
<float>1445266695.2</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -108,6 +108,8 @@
(function (window, rJS, RSVP, Handlebars, loopEventListener) {\n
"use strict";\n
\n
var PAGE_MODINFO = "module_info";\n
\n
function ajax(url) {\n
var xhr;\n
function resolver(resolve, reject) {\n
......@@ -174,9 +176,7 @@
return gadget.getElement()\n
.push(function (element) {\n
gadget.props.element = element;\n
console.log("testing before");\n
gadget.props.content_element = element.querySelector(\'.gadget-content\');\n
console.log("testing after");\n
//gadget.property_dict.element = element;\n
});\n
})\n
......@@ -197,47 +197,123 @@
// declared methods\n
/////////////////////////////////////////////////////////////////\n
\n
.declareMethod(\'render\', function () {\n
.declareMethod(\'render\', function (options) {\n
var res,\n
gadget = this,\n
parameters = {link: []};\n
\n
return new RSVP.Queue()\n
.push(function () {\n
return ajax(window.location.href + "hateoas/");\n
parameters = {link: [], mod_link: []};\n
gadget.props.options = options;\n
return gadget.jio_allDocs({\n
"query": \'meta_type:"ERP5 Folder" AND id:"%_module"\',\n
"select_list": ["title", "business_application_title"],\n
"limit": 1000,\n
})\n
.push(function (result) {\n
var result_list = [],\n
i;\n
for (i = 0; i < result.data.rows.length; i += 1) {\n
result_list.push(RSVP.all([\n
gadget.getUrlFor({jio_key: result.data.rows[i].id}),\n
result.data.rows[i].value.title || result.data.rows[i].id,\n
result.data.rows[i].value.business_application_title\n
]));\n
}\n
return RSVP.all(result_list);\n
})\n
.push(undefined, function (err) {\n
// console.log(err.status);\n
res = JSON.parse(err.responseText);\n
if (err.status === 200) {\n
for (var linkname in res._links) {\n
console.log(res._links[linkname]);\n
if (res._links[linkname] === "self") \n
continue;\n
if (res._links[linkname].href !== undefined) {\n
var rel = res._links[linkname].href.split("hateoas/");\n
parameters.link.push({\n
href: "./" + rel[rel.length-1],\n
site_name: res._links[linkname].name\n
});\n
} else {\n
for (var i = 0; i < res._links[linkname].length; i++) {\n
var rel2 = res._links[linkname][i].href.split("hateoas/");\n
parameters.link.push({\n
href: "./" + rel2[rel2.length-1],\n
site_name: res._links[linkname][i].name\n
});\n
}\n
}\n
}\n
.push(function (document_list) {\n
var i,\n
business_application_dict = {},\n
business_application_list = [],\n
business_application,\n
module_info,\n
// result_html = \'<div data-role="collapsible-set" data-theme="c">\',\n
doc;\n
for (i = 0; i < document_list.length; i += 1) {\n
doc = document_list[i];\n
if (doc[2] === undefined) {\n
doc[2] = "Other";\n
}\n
module_info = {\n
link: doc[0],\n
title: doc[1]\n
};\n
if (business_application_dict[doc[2]] === undefined) {\n
business_application_dict[doc[2]] = [module_info];\n
business_application_list.push(doc[2]);\n
} else {\n
business_application_dict[doc[2]].push(module_info);\n
}\n
}\n
business_application_list.sort(function (a, b) {\n
// Push the "Other" value at the end\n
var result = 0;\n
if (a === "Other") {\n
result = 1;\n
} else if (b === "Other") {\n
result = -1;\n
} else if (a < b) {\n
result = -1;\n
} else if (a > b) {\n
result = 1;\n
}\n
return result;\n
});\n
\n
function sort_module(a, b) {\n
var result = 0;\n
if (a.title < b.title) {\n
result = -1;\n
} else if (a.title > b.title) {\n
result = 1;\n
}\n
return result;\n
}\n
\n
for (i = 0; i < business_application_list.length; i += 1) {\n
business_application = business_application_list[i];\n
business_application_dict[business_application].sort(sort_module);\n
}\n
for (i = 0; i < business_application_dict[business_application].length; i += 1) {\n
parameters.mod_link.push({\n
href: "#page=modinfo&" + business_application_dict[business_application][i].link.split("#")[1],\n
mod_name: business_application_dict[business_application][i].title\n
});\n
}\n
// })\n
// .push(function () {\n
// return ajax(window.location.href + "hateoas/");\n
// })\n
// .push(undefined, function (err) {\n
// // console.log(err.status);\n
// res = JSON.parse(err.responseText);\n
// if (err.status === 200) {\n
// for (var linkname in res._links) { \n
// if (res._links[linkname] === "self") \n
// continue;\n
// if (res._links[linkname].href !== undefined) {\n
// // console.log(res._links[linkname].href);\n
// var rel = res._links[linkname].href.split("hateoas_browser/");\n
// parameters.link.push({\n
// href: "./" + rel[rel.length-1],\n
// site_name: res._links[linkname].name\n
// });\n
// } else {\n
// for (var i = 0; i < res._links[linkname].length; i++) {\n
// var rel2 = res._links[linkname][i].href.split("hateoas_browser/");\n
// parameters.link.push({\n
// href: "./" + rel2[rel2.length-1],\n
// site_name: res._links[linkname][i].name\n
// });\n
// }\n
// }\n
// }\n
gadget.props.element.innerHTML =\n
listview_template(parameters);\n
\n
$(gadget.props.element).trigger("create");\n
} else {\n
console.log("ERRR");\n
throw err;\n
}\n
// } else {\n
// console.log("ERRR");\n
// throw err;\n
// }\n
});\n
});\n
\n
......@@ -384,7 +460,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.25918.63869.31283</string> </value>
<value> <string>946.37190.59423.8345</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -402,7 +478,7 @@
</tuple>
<state>
<tuple>
<float>1444738515.65</float>
<float>1445415752.25</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -110,7 +110,7 @@
<head>\n
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />\n
<meta name="viewport" content="width=device-width, user-scalable=no" />\n
<title>OfficeJS Router Gadget</title>\n
<title>Hateoas Browser Router Gadget</title>\n
\n
<!-- renderjs -->\n
<script src="rsvp.js" type="text/javascript"></script>\n
......@@ -259,7 +259,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.15852.21666.49783</string> </value>
<value> <string>946.25946.58074.51114</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -277,7 +277,7 @@
</tuple>
<state>
<tuple>
<float>1444134507.45</float>
<float>1445264109.51</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -99,9 +99,7 @@
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
/*global window, rJS */\n
<value> <string>/*global window, rJS */\n
/*jslint nomen: true, indent: 2, maxerr: 3*/\n
(function (window, rJS) {\n
"use strict";\n
......@@ -112,51 +110,23 @@
\n
gadget_klass\n
.declareAcquiredMethod(\'pleaseRedirectMyHash\', \'pleaseRedirectMyHash\')\n
.declareAcquiredMethod(\'jio_get\', \'jio_get\')\n
\n
.ready(function (gadget) {\n
gadget.props = {};\n
})\n
.declareMethod(\'route\', function (options) {\n
var gadget = this;\n
gadget.options = options;\n
if (options.jio_key === undefined || options.jio_key === \'\') {\n
if (options.page === undefined || options.page === \'\' || options.page === "document_list") {\n
options.page = DEFAULT_PAGE;\n
}\n
return {\n
url: MAIN_PAGE_PREFIX + "page_" + options.page + ".html",\n
options: options\n
};\n
console.log(options.page);\n
if (options.page === undefined) {\n
options.page = DEFAULT_PAGE;\n
}\n
return gadget.jio_get(options.jio_key)\n
.push(function (doc) {\n
var sub_options = {},\n
base_portal_type = doc.portal_type.toLowerCase().replace(/\\s/g, "_");\n
sub_options = {\n
doc: doc,\n
jio_key: options.jio_key,\n
search: options.search\n
};\n
if (base_portal_type.search(/_temp$/) >= 0) {\n
//Remove "_temp"\n
base_portal_type = base_portal_type.substr(\n
0,\n
base_portal_type.length - 5\n
);\n
}\n
return {\n
url: MAIN_PAGE_PREFIX + "jio_"\n
+ base_portal_type\n
+ "_" + options.page + ".html",\n
options: sub_options\n
};\n
});\n
return {\n
url: MAIN_PAGE_PREFIX + "page_" + options.page + ".html",\n
options: options\n
};\n
});\n
\n
}(window, rJS));
]]></string> </value>
}(window, rJS));</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......@@ -291,7 +261,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.15850.42154.58214</string> </value>
<value> <string>946.36068.59535.14574</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -309,7 +279,7 @@
</tuple>
<state>
<tuple>
<float>1444655655.45</float>
<float>1445354162.96</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -288,7 +288,7 @@
</item>
<item>
<key> <string>configuration_jio_gadget_url</string> </key>
<value> <string>gadget_officejs_jio.html</string> </value>
<value> <string>gadget_erp5_jio.html</string> </value>
</item>
<item>
<key> <string>configuration_manifest_url</string> </key>
......@@ -517,7 +517,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.24629.44404.60620</string> </value>
<value> <string>946.34708.40372.22050</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -535,7 +535,7 @@
</tuple>
<state>
<tuple>
<float>1444739877.61</float>
<float>1445265885.86</float>
<string>UTC</string>
</tuple>
</state>
......
web_page_module/gadget_hateoasbrowser_*
web_page_module/gadget_officejs_header*
web_page_module/gadget_officejs_jio*
web_page_module/gadget_officejs_text_editor_application_panel*
web_page_module/gadget_officejs_translation*
web_site_module/hateoas_browser
web_site_module/hateoas_browser/**
\ No newline at end of file
web_page_module/gadget_hateoasbrowser_*
web_page_module/gadget_officejs_header*
web_page_module/gadget_officejs_jio*
web_page_module/gadget_officejs_text_editor_application_panel*
web_page_module/gadget_officejs_translation*
web_site_module/hateoas_browser
web_site_module/hateoas_browser/**
\ No newline at end of file
web_page_module/gadget_hateoasbrowser_*
web_page_module/gadget_officejs_header*
web_page_module/gadget_officejs_jio*
web_page_module/gadget_officejs_text_editor_application_panel*
web_page_module/gadget_officejs_translation*
web_site_module/hateoas_browser
web_site_module/hateoas_browser/**
\ No newline at end of file
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