Commit 12f12b2d authored by Vivek's avatar Vivek

updated subgadget rendering, removed dummy gadgets

parent 4314f44f
...@@ -10,11 +10,8 @@ ...@@ -10,11 +10,8 @@
<key> <string>_Access_contents_information_Permission</string> </key> <key> <string>_Access_contents_information_Permission</string> </key>
<value> <value>
<tuple> <tuple>
<string>Anonymous</string>
<string>Assignee</string> <string>Assignee</string>
<string>Assignor</string> <string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string> <string>Manager</string>
<string>Owner</string> <string>Owner</string>
</tuple> </tuple>
...@@ -27,6 +24,7 @@ ...@@ -27,6 +24,7 @@
<string>Assignee</string> <string>Assignee</string>
<string>Assignor</string> <string>Assignor</string>
<string>Manager</string> <string>Manager</string>
<string>Owner</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -46,6 +44,7 @@ ...@@ -46,6 +44,7 @@
<string>Assignee</string> <string>Assignee</string>
<string>Assignor</string> <string>Assignor</string>
<string>Manager</string> <string>Manager</string>
<string>Owner</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -53,11 +52,8 @@ ...@@ -53,11 +52,8 @@
<key> <string>_View_Permission</string> </key> <key> <string>_View_Permission</string> </key>
<value> <value>
<tuple> <tuple>
<string>Anonymous</string>
<string>Assignee</string> <string>Assignee</string>
<string>Assignor</string> <string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string> <string>Manager</string>
<string>Owner</string> <string>Owner</string>
</tuple> </tuple>
...@@ -122,13 +118,25 @@ ...@@ -122,13 +118,25 @@
<dt data-parameter-required="required" data-parameter-type="string">content</dt>\n <dt data-parameter-required="required" data-parameter-type="string">content</dt>\n
<dd>the content to be set in the text editor</dd>\n <dd>the content to be set in the text editor</dd>\n
</dl>\n </dl>\n
</dd>\n
<dt>clearContent</dt>\n <dt>clearContent</dt>\n
<dd>to clear the contect of the text editor</dd>\n <dd>to clear the contect of the text editor</dd>\n
<dl></dl>\n <dl></dl>\n
<dt>initSubGadget</dt>\n
<dd>to initiate the current gadget</dd>\n
<dl></dl>\n
<dt>initStateTransfer</dt>\n
<dd>to initiate state transfer before gadget switch</dd>\n
<dl></dl>\n
<dt>finishStateTransfer</dt>\n
<dd>to finish state transfer after gadget switch</dd>\n
<dl>\n
<dt data-parameter-required="required" data-parameter-type="string">current_state</dt>\n
<dd>the current state to be transfer to next gadget</dd>\n
</dl>\n
</dl>\n </dl>\n
</body>\n </body>\n
</html> </html>\n
]]></string> </value> ]]></string> </value>
</item> </item>
...@@ -194,11 +202,13 @@ ...@@ -194,11 +202,13 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>action</string> </key> <key> <string>action</string> </key>
<value> <string>publish_alive</string> </value> <value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope1</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -220,7 +230,7 @@ ...@@ -220,7 +230,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1438594082.15</float> <float>1441284333.1</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
...@@ -229,7 +239,7 @@ ...@@ -229,7 +239,7 @@
</item> </item>
<item> <item>
<key> <string>validation_state</string> </key> <key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value> <value> <string>draft</string> </value>
</item> </item>
</dictionary> </dictionary>
</list> </list>
...@@ -265,7 +275,7 @@ ...@@ -265,7 +275,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>944.53144.2367.52957</string> </value> <value> <string>945.32448.54149.26265</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -283,7 +293,7 @@ ...@@ -283,7 +293,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1439192630.9</float> <float>1441284657.06</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
...@@ -342,7 +352,7 @@ ...@@ -342,7 +352,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1438344898.3</float> <float>1441284333.1</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -120,9 +120,10 @@ ...@@ -120,9 +120,10 @@
<script type="text/javascript" src="jquery.js"></script>\n <script type="text/javascript" src="jquery.js"></script>\n
<script type="text/javascript" src="rsvp.js"></script>\n <script type="text/javascript" src="rsvp.js"></script>\n
<script type="text/javascript" src="renderjs.js"></script>\n <script type="text/javascript" src="renderjs.js"></script>\n
<script src="gadget_global.js" ></script>\n <script type="text/javascript" src="gadget_global.js" ></script>\n
<script type="text/javascript" src="jquerymobile.js"></script>\n <script type="text/javascript" src="jquerymobile.js"></script>\n
<script type="text/javascript" src="i18next.js"></script>\n <script type="text/javascript" src="i18next.js"></script>\n
<script type="text/javascript" src="gadget_interfaces.js"></script>\n
\n \n
<!-- specific script -->\n <!-- specific script -->\n
<script type="text/javascript" src="editor_test_gadget.js"></script>\n <script type="text/javascript" src="editor_test_gadget.js"></script>\n
...@@ -139,9 +140,6 @@ ...@@ -139,9 +140,6 @@
<div data-role="fieldcontain">\n <div data-role="fieldcontain">\n
<label for="main_gadget_selector" >Main Gadget</label>\n <label for="main_gadget_selector" >Main Gadget</label>\n
<select name="main_gadget_selector" class="select">\n <select name="main_gadget_selector" class="select">\n
<option value="./bootstrap3-wysiwyg.html">Text Editor 2</option>\n
<option value="./interface_test_correct_implemented_gadget.html">Dummy Gadget 1</option>\n
<option value="./interface_test_multiple_interface_correct_gadget.html">Dummy Gadget 2</option>\n
</select>\n </select>\n
</div>\n </div>\n
<input data-inline="true" type="submit" value="Submit" data-theme="b">\n <input data-inline="true" type="submit" value="Submit" data-theme="b">\n
...@@ -296,7 +294,7 @@ ...@@ -296,7 +294,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.2226.34067.16605</string> </value> <value> <string>945.32437.8689.36215</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -314,7 +312,7 @@ ...@@ -314,7 +312,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1439471929.19</float> <float>1441290155.01</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -106,15 +106,8 @@ ...@@ -106,15 +106,8 @@
(function (window, document, rJS, promiseEventListener) {\n (function (window, document, rJS, promiseEventListener) {\n
"use strict";\n "use strict";\n
\n \n
var DEFAULT_GADGET_URL = "./bootstrap3-wysiwyg.html",\n var DEFAULT_GADGET_URL = "interface_bootstrap3_wysiwyg.html";\n
INTERFACE_GADGET_URL = "./gadget_interfaces.html";\n
\n \n
function declareInterfaceGadget(gadget) {\n
return gadget.declareGadget(INTERFACE_GADGET_URL, {\n
element: gadget.__element,\n
scope: "interface"\n
});\n
}\n
function declareSubGadget(gadget, sub_gadget_url) {\n function declareSubGadget(gadget, sub_gadget_url) {\n
return gadget.declareGadget(sub_gadget_url, {\n return gadget.declareGadget(sub_gadget_url, {\n
sandbox: \'iframe\',\n sandbox: \'iframe\',\n
...@@ -130,35 +123,31 @@ ...@@ -130,35 +123,31 @@
for(i = 0; i < gadget_option_list.length; i += 1) {\n for(i = 0; i < gadget_option_list.length; i += 1) {\n
gadget_list.push({\n gadget_list.push({\n
url: gadget_option_list[i].value,\n url: gadget_option_list[i].value,\n
display_name: gadget_option_list[i].innerText\n display_name: gadget_option_list[i].innerHTML\n
});\n });\n
}\n }\n
return gadget_list;\n return gadget_list;\n
}\n }\n
function filterSimilarSubGadgetList(gadget, sub_gadget_url) {\n function filterSimilarSubGadgetList(gadget, sub_gadget_url) {\n
var interface_gadget,\n var available_subgadget_list,\n
available_subgadget_list;\n interface_url_list;\n
return RSVP.Queue()\n return RSVP.Queue()\n
.push(function() {\n .push(function() {\n
return gadget.getDeclaredGadget("interface");\n return gadget.getVerifyGadget(sub_gadget_url);\n
})\n
.push(function(i_gadget) {\n
interface_gadget = i_gadget;\n
return interface_gadget.getVerifyGadget(sub_gadget_url);\n
})\n })\n
.push(function(sub_gadget) {\n .push(function(sub_gadget) {\n
return RSVP.all([\n return RSVP.all([\n
interface_gadget.getDeclaredGadgetInterfaceList(sub_gadget),\n gadget.getDeclaredGadgetInterfaceList(sub_gadget),\n
getAvailableSubGadgetList(gadget)\n getAvailableSubGadgetList(gadget)\n
]);\n ]);\n
})\n })\n
.push(function(result_data) {\n .push(function(result_data) {\n
var interface_url_list = result_data[0],\n var item,\n
item,\n
status_list = [];\n status_list = [];\n
interface_url_list = result_data[0],\n
available_subgadget_list = result_data[1];\n available_subgadget_list = result_data[1];\n
for(item in available_subgadget_list) {\n for(item in available_subgadget_list) {\n
status_list.push(interface_gadget.verifyGadgetInterfaceListImplementation(available_subgadget_list[item].url, interface_url_list));\n status_list.push(gadget.verifyGadgetInterfaceImplementation(available_subgadget_list[item].url, interface_url_list));\n
}\n }\n
return RSVP.all(status_list);\n return RSVP.all(status_list);\n
})\n })\n
...@@ -172,9 +161,9 @@ ...@@ -172,9 +161,9 @@
return filterSimilarSubGadgetList(gadget, sub_gadget_url);\n return filterSimilarSubGadgetList(gadget, sub_gadget_url);\n
})\n })\n
.push(function(filtered_list) {\n .push(function(filtered_list) {\n
var select = gadget.props.content_element.querySelector(\'form.similar-gadget-select-form\').similar_gadget_selector;\n var select = gadget.props.content_element.querySelector(\'form.similar-gadget-select-form\').similar_gadget_selector,\n
i;\n
select.innerHTML = "";\n select.innerHTML = "";\n
var i;\n
for(i = 0; i < filtered_list[1].length; i += 1) {\n for(i = 0; i < filtered_list[1].length; i += 1) {\n
if(filtered_list[1][i]) {\n if(filtered_list[1][i]) {\n
var option = document.createElement("option");\n var option = document.createElement("option");\n
...@@ -183,10 +172,14 @@ ...@@ -183,10 +172,14 @@
select.appendChild(option);\n select.appendChild(option);\n
}\n }\n
}\n }\n
select.value = filtered_list[0][0].url;\n
return;\n return;\n
});\n });\n
}\n }\n
function gadgetSwitchHandler(gadget) {\n function gadgetSwitchHandler(gadget) {\n
var current_state = "",\n
selected_gadget,\n
submit_source;\n
return new RSVP.Queue()\n return new RSVP.Queue()\n
.push(function() {\n .push(function() {\n
return RSVP.any([\n return RSVP.any([\n
...@@ -203,21 +196,32 @@ ...@@ -203,21 +196,32 @@
]);\n ]);\n
})\n })\n
.push(function(submit_event) {\n .push(function(submit_event) {\n
var submit_source = submit_event.target.className;\n submit_source = submit_event.target.className;\n
selected_gadget = submit_event.target[0].value;\n
gadget.props.content_element.querySelector("input[type=submit]")\n gadget.props.content_element.querySelector("input[type=submit]")\n
.disabled = true;\n .disabled = true;\n
gadget.props.content_element.querySelector("div.ui-content").innerHTML = "";\n
if(submit_source === \'main-gadget-select-form\') {\n if(submit_source === \'main-gadget-select-form\') {\n
return RSVP.all([\n return updateSimilarGadgetOptionList(gadget, selected_gadget);\n
declareSubGadget(gadget,submit_event.target[0].value),\n
updateSimilarGadgetOptionList(gadget, submit_event.target[0].value)\n
]);\n
} else {\n } else {\n
return declareSubGadget(gadget,submit_event.target[0].value);\n return gadget.subgadget_initStateTransfer();\n
}\n }\n
})\n })\n
.push(function(form_data) {\n
gadget.props.content_element.querySelector("div.ui-content").innerHTML = "";\n
if(submit_source === \'similar-gadget-select-form\') {\n
current_state = form_data;\n
} \n
return declareSubGadget(gadget, selected_gadget);\n
})\n
.push(function() {\n
return gadget.subgadget_initSubGadget();\n
})\n
.push(function() {\n .push(function() {\n
return gadget.editor_setEditor();\n if(submit_source === \'similar-gadget-select-form\') {\n
return gadget.subgadget_finishStateTransfer([current_state]);\n
} else {\n
return;\n
} \n
})\n })\n
.push(function(){\n .push(function(){\n
gadget.props.content_element.querySelector("input[type=submit]")\n gadget.props.content_element.querySelector("input[type=submit]")\n
...@@ -226,68 +230,82 @@ ...@@ -226,68 +230,82 @@
});\n });\n
}\n }\n
\n \n
// block JQM auto-start\n
$(document)\n
.on("mobileinit", function () {\n
$.mobile.autoInitializePage = false;\n
});\n
\n
rJS(window)\n rJS(window)\n
\n \n
.ready(function (g) {\n .ready(function (g) {\n
console.log("test gadget ready");\n
g.props = {};\n g.props = {};\n
return g.getElement()\n return g.getElement()\n
.push(function (element) {\n .push(function (element) {\n
$(element).trigger("create");\n $(element).trigger("create");\n
g.props.element = element;\n g.props.element = element;\n
g.props.content_element = element.querySelector(\'.gadget-content\');\n g.props.content_element = element.querySelector(\'.gadget-content\');\n
$.getJSON("gadget_info.json", function(data) {\n
var select = g.props.content_element.querySelector(\'form.main-gadget-select-form\').main_gadget_selector,\n
key;\n
select.innerHTML = "";\n
for(key in data) {\n
var option = document.createElement("option");\n
option.text = key;\n
option.value = data[key];\n
select.appendChild(option);\n
}\n
});\n
});\n });\n
})\n })\n
.declareMethod(\'render\', function () {\n .declareMethod(\'render\', function () {\n
var gadget = this;\n var gadget = this;\n
return new RSVP.Queue()\n return new RSVP.Queue()\n
.push(function() {\n
return declareInterfaceGadget(gadget, DEFAULT_GADGET_URL);\n
})\n
.push(function() {\n .push(function() {\n
return declareSubGadget(gadget, DEFAULT_GADGET_URL);\n return declareSubGadget(gadget, DEFAULT_GADGET_URL);\n
})\n })\n
.push(function() {\n .push(function() {\n
return gadget.editor_setEditor();\n return gadget.subgadget_initSubGadget();\n
})\n })\n
.push(function(){\n .push(function() {\n
return gadgetSwitchHandler(gadget);\n return gadgetSwitchHandler(gadget);\n
});\n });\n
})\n })\n
\n \n
/* ============================ EDITOR =============================== */\n /* ============================ SUBGADGET =============================== */\n
.declareMethod("editor_getContent", function (param_list) {\n .declareMethod("subgadget_getContent", function (param_list) {\n
return this.getDeclaredGadget("sub_gadget")\n return this.getDeclaredGadget("sub_gadget")\n
.then(function (editor) {\n .then(function (sub_gadget) {\n
return editor.getContent.apply(editor, param_list);\n return sub_gadget.getContent.apply(sub_gadget, param_list);\n
});\n });\n
})\n })\n
.declareMethod("editor_setContent", function (param_list) {\n .declareMethod("subgadget_setContent", function (param_list) {\n
return this.getDeclaredGadget("sub_gadget")\n return this.getDeclaredGadget("sub_gadget")\n
.then(function (editor) {\n .then(function (sub_gadget) {\n
return editor.setContent.apply(editor, param_list);\n return sub_gadget.setContent.apply(sub_gadget, param_list);\n
});\n });\n
})\n })\n
.declareMethod("editor_clearContent", function (param_list) {\n .declareMethod("subgadget_clearContent", function (param_list) {\n
return this.getDeclaredGadget("sub_gadget")\n return this.getDeclaredGadget("sub_gadget")\n
.then(function (editor) {\n .then(function (sub_gadget) {\n
return editor.clearContent.apply(editor, param_list);\n return sub_gadget.clearContent.apply(sub_gadget, param_list);\n
});\n });\n
})\n })\n
.declareMethod("editor_setEditor", function (param_list) {\n .declareMethod("subgadget_initStateTransfer", function (param_list) {\n
return this.getDeclaredGadget("sub_gadget")\n return this.getDeclaredGadget("sub_gadget")\n
.then(function (editor) {\n .then(function (sub_gadget) {\n
return editor.setEditor.apply(editor, param_list);\n return sub_gadget.initStateTransfer.apply(sub_gadget, param_list);\n
});\n
})\n
.declareMethod("subgadget_finishStateTransfer", function (param_list) {\n
return this.getDeclaredGadget("sub_gadget")\n
.then(function (sub_gadget) {\n
return sub_gadget.finishStateTransfer.apply(sub_gadget, param_list);\n
});\n
})\n
.declareMethod("subgadget_initSubGadget", function (param_list) {\n
return this.getDeclaredGadget("sub_gadget")\n
.then(function (sub_gadget) {\n
return sub_gadget.initSubGadget.apply(sub_gadget, param_list);\n
});\n });\n
});\n });\n
\n \n
}(window, document, rJS, promiseEventListener)); }(window, document, rJS, promiseEventListener));\n
]]></string> </value> ]]></string> </value>
</item> </item>
...@@ -424,7 +442,7 @@ ...@@ -424,7 +442,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.2225.65299.39441</string> </value> <value> <string>945.2278.56594.14933</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -442,7 +460,7 @@ ...@@ -442,7 +460,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1439471855.78</float> <float>1441290071.66</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>erp5_rjs_interface_gadgets</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>erp5_rjs_interface_gadgets</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
web_page_module/editor* web_page_module/editor*
web_page_module/interface_gadget_interfaces* web_page_module/interface_gadget*
web_page_module/interface_test_correct_implemented_gadget*
web_page_module/interface_test_multiple_interface_correct_gadget*
web_site_module/editor_demo web_site_module/editor_demo
web_site_module/editor_demo/** web_site_module/editor_demo/**
\ No newline at end of file
web_page_module/editor* web_page_module/editor*
web_page_module/interface_gadget_interfaces* web_page_module/interface_gadget*
web_page_module/interface_test_correct_implemented_gadget*
web_page_module/interface_test_multiple_interface_correct_gadget*
web_site_module/editor_demo web_site_module/editor_demo
web_site_module/editor_demo/** web_site_module/editor_demo/**
\ No newline at end of file
web_page_module/editor* web_page_module/editor*
web_page_module/interface_gadget_interfaces* web_page_module/interface_gadget*
web_page_module/interface_test_correct_implemented_gadget*
web_page_module/interface_test_multiple_interface_correct_gadget*
web_site_module/editor_demo web_site_module/editor_demo
web_site_module/editor_demo/** web_site_module/editor_demo/**
\ No newline at end of file
erp5_rjs_interface_gadgets
\ 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