Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5-Boxiang
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hamza
erp5-Boxiang
Commits
88b82752
Commit
88b82752
authored
Feb 28, 2013
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update to recent RednerJs.
parent
0cc0f3c9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
10 deletions
+12
-10
bt5/erp5_jquery_plugin_renderjs/PathTemplateItem/portal_skins/erp5_jquery/jquery/plugin/renderjs/renderjs.js.xml
..._skins/erp5_jquery/jquery/plugin/renderjs/renderjs.js.xml
+8
-6
bt5/erp5_jquery_plugin_renderjs/PathTemplateItem/portal_skins/erp5_jquery/jquery/plugin/renderjs/renderjs.min.js.xml
...ns/erp5_jquery/jquery/plugin/renderjs/renderjs.min.js.xml
+3
-3
bt5/erp5_jquery_plugin_renderjs/bt/revision
bt5/erp5_jquery_plugin_renderjs/bt/revision
+1
-1
No files found.
bt5/erp5_jquery_plugin_renderjs/PathTemplateItem/portal_skins/erp5_jquery/jquery/plugin/renderjs/renderjs.js.xml
View file @
88b82752
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<value>
<string>
ts620
57361.38
</string>
</value>
<value>
<string>
ts620
60037.0
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
__name__
</string>
</key>
<key>
<string>
__name__
</string>
</key>
...
@@ -338,7 +338,7 @@ var RenderJs = (function () {\n
...
@@ -338,7 +338,7 @@ var RenderJs = (function () {\n
},\n
},\n
\n
\n
addGadget: function (dom_id, gadget_id, gadget, gadget_data_handler,\n
addGadget: function (dom_id, gadget_id, gadget, gadget_data_handler,\n
gadget_data_source) {\n
gadget_data_source
, bootstrap
) {\n
/*\n
/*\n
* add new gadget and render it\n
* add new gadget and render it\n
*/\n
*/\n
...
@@ -356,7 +356,9 @@ var RenderJs = (function () {\n
...
@@ -356,7 +356,9 @@ var RenderJs = (function () {\n
tab_gadget = tab_container.find(\'#\' + gadget_id);\n
tab_gadget = tab_container.find(\'#\' + gadget_id);\n
\n
\n
// render new gadget\n
// render new gadget\n
if (bootstrap !== false) {\n
RenderJs.bootstrap(tab_container);\n
RenderJs.bootstrap(tab_container);\n
}\n
\n
\n
return tab_gadget;\n
return tab_gadget;\n
},\n
},\n
...
@@ -521,13 +523,13 @@ var RenderJs = (function () {\n
...
@@ -521,13 +523,13 @@ var RenderJs = (function () {\n
},\n
},\n
\n
\n
addNewTabGadget: function (dom_id, gadget_id, gadget, gadget_data_handler,\n
addNewTabGadget: function (dom_id, gadget_id, gadget, gadget_data_handler,\n
gadget_data_source) {\n
gadget_data_source
, bootstrap
) {\n
/*\n
/*\n
* add new gadget and render it\n
* add new gadget and render it\n
*/\n
*/\n
var tab_gadget;\n
var tab_gadget;\n
tab_gadget = RenderJs.addGadget(\n
tab_gadget = RenderJs.addGadget(\n
dom_id, gadget_id, gadget, gadget_data_handler, gadget_data_source\n
dom_id, gadget_id, gadget, gadget_data_handler, gadget_data_source
, bootstrap
\n
);\n
);\n
\n
\n
// we should unregister all gadgets part of this TabbularGadget\n
// we should unregister all gadgets part of this TabbularGadget\n
...
@@ -932,7 +934,7 @@ var RenderJs = (function () {\n
...
@@ -932,7 +934,7 @@ var RenderJs = (function () {\n
</item>
</item>
<item>
<item>
<key>
<string>
size
</string>
</key>
<key>
<string>
size
</string>
</key>
<value>
<int>
36
763
</int>
</value>
<value>
<int>
36
851
</int>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
...
...
bt5/erp5_jquery_plugin_renderjs/PathTemplateItem/portal_skins/erp5_jquery/jquery/plugin/renderjs/renderjs.min.js.xml
View file @
88b82752
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<value>
<string>
ts620
57392.7
</string>
</value>
<value>
<string>
ts620
60997.82
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
__name__
</string>
</key>
<key>
<string>
__name__
</string>
</key>
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
<key>
<string>
data
</string>
</key>
<key>
<string>
data
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
<value>
<string
encoding=
"cdata"
>
<![CDATA[
"use strict";var RENDERJS_ENABLE_IMPLICIT_GADGET_RENDERING=true;var RENDERJS_ENABLE_IMPLICIT_INTERACTION_BIND=true;var RENDERJS_ENABLE_IMPLICIT_ROUTE_CREATE=true;if(console===undefined||console.log===undefined){var console={};console.log=function(){}}var RenderJs=function(){var is_ready=false,current_gadget;function setSelfGadget(gadget){current_gadget=gadget}return{init:function(){if(RENDERJS_ENABLE_IMPLICIT_GADGET_RENDERING){RenderJs.bootstrap($("body"))}var root_gadget=RenderJs.GadgetIndex.getRootGadget();if(RENDERJS_ENABLE_IMPLICIT_INTERACTION_BIND||RENDERJS_ENABLE_IMPLICIT_ROUTE_CREATE){if(root_gadget!==undefined){RenderJs.bindReady(function(){if(RENDERJS_ENABLE_IMPLICIT_INTERACTION_BIND){RenderJs.InteractionGadget.init()}if(RENDERJS_ENABLE_IMPLICIT_ROUTE_CREATE){RenderJs.RouteGadget.init()}})}}},bootstrap:function(root){var gadget_id,is_gadget;gadget_id=root.attr("id");is_gadget=root.attr("data-gadget")!==undefined;RenderJs.setReady(false);if(is_gadget&&gadget_id!==undefined){RenderJs.loadGadget(root)}RenderJs.loadRecursiveGadget(root)},loadRecursiveGadget:function(root){var gadget_list,gadget,gadget_id,gadget_js;gadget_list=root.find("[data-gadget]");gadget_list.each(function(){gadget=$(this);gadget_id=gadget.attr("id");gadget_js=new RenderJs.Gadget(gadget_id,gadget);RenderJs.GadgetIndex.registerGadget(gadget_js)});gadget_list.each(function(){RenderJs.loadGadget($(this))})},setGadgetAndRecurse:function(gadget,data){setSelfGadget(RenderJs.GadgetIndex.getGadgetById(gadget.attr("id")));gadget.append(data);setSelfGadget(undefined);RenderJs.loadRecursiveGadget(gadget)},getSelfGadget:function(){return current_gadget},loadGadget:function(gadget){var url,gadget_id,gadget_property,cacheable,cache_id,i,gadget_index,gadget_index_id,app_cache,data,gadget_js,is_update_gadget_data_running;url=gadget.attr("data-gadget");gadget_id=gadget.attr("id");gadget_js=RenderJs.GadgetIndex.getGadgetById(gadget_id);gadget_index=RenderJs.GadgetIndex.getGadgetList();if(gadget_js===undefined){gadget_js=new RenderJs.Gadget(gadget_id,gadget);RenderJs.GadgetIndex.registerGadget(gadget_js)}if(gadget_js.isReady()){return}gadget_property=gadget.attr("data-gadget-property");if(gadget_property!==undefined){gadget_property=$.parseJSON(gadget_property);$.each(gadget_property,function(key,value){gadget_js[key]=value})}if(url!==undefined&&url!==""){cacheable=gadget.attr("data-gadget-cacheable");cache_id=gadget.attr("data-gadget-cache-id");if(cacheable!==undefined&&cache_id!==undefined){cacheable=Boolean(parseInt(cacheable,10))}if(cacheable){app_cache=RenderJs.Cache.get(cache_id,undefined);if(app_cache===undefined||app_cache===null){$.ajax({url:url,yourCustomData:{gadget_id:gadget_id,cache_id:cache_id},success:function(data){cache_id=this.yourCustomData.cache_id;gadget_id=this.yourCustomData.gadget_id;RenderJs.Cache.set(cache_id,data);RenderJs.GadgetIndex.getGadgetById(gadget_id).setReady();RenderJs.setGadgetAndRecurse(gadget,data);RenderJs.checkAndTriggerReady();RenderJs.updateGadgetData(gadget)}})}else{data=app_cache;gadget_js.setReady();this.setGadgetAndRecurse(gadget,data);this.checkAndTriggerReady();RenderJs.updateGadgetData(gadget)}}else{$.ajax({url:url,yourCustomData:{gadget_id:gadget_id},success:function(data){gadget_id=this.yourCustomData.gadget_id;RenderJs.GadgetIndex.getGadgetById(gadget_id).setReady();RenderJs.setGadgetAndRecurse(gadget,data);RenderJs.checkAndTriggerReady();RenderJs.updateGadgetData(gadget)}})}}else{is_update_gadget_data_running=RenderJs.updateGadgetData(gadget);if(!is_update_gadget_data_running){gadget_js.setReady()}RenderJs.checkAndTriggerReady()}},isReady:function(){return is_ready},setReady:function(value){is_ready=value},bindReady:function(ready_function){$("body").one("ready",ready_function)},checkAndTriggerReady:function(){var is_gadget_list_loaded;is_gadget_list_loaded=RenderJs.GadgetIndex.isGadgetListLoaded();if(is_gadget_list_loaded){if(!RenderJs.isReady()){RenderJs.GadgetIndex.getRootGadget().getDom().trigger("ready");$("body").trigger("ready");RenderJs.setReady(true)}}return is_gadget_list_loaded},updateGadgetData:function(gadget){var data_source,data_handler;data_source=gadget.attr("data-gadget-source");data_handler=gadget.attr("data-gadget-handler");if(data_source!==undefined&&data_source!==""){$.ajax({url:data_source,dataType:"json",yourCustomData:{data_handler:data_handler,gadget_id:gadget.attr("id")},success:function(result){var data_handler,gadget_id;data_handler=this.yourCustomData.data_handler;gadget_id=this.yourCustomData.gadget_id;if(data_handler!==undefined){eval(data_handler+"(result)");gadget=RenderJs.GadgetIndex.getGadgetById(gadget_id);gadget.setReady();RenderJs.checkAndTriggerReady()}}});return true}return false},addGadget:function(dom_id,gadget_id,gadget,gadget_data_handler,gadget_data_source
){var html_string,tab_container,tab_gadget;tab_container=$("#"+dom_id);tab_container.empty();html_string=[\'<div id="\'+gadget_id+\'"\',\'data-gadget="\'+gadget+\'"\',\'data-gadget-handler="\'+gadget_data_handler+\'" \',\'data-gadget-source="\'+gadget_data_source+\'">
</div>
\'].join("\\n");tab_container.append(html_string);tab_gadget=tab_container.find("#"+gadget_id);RenderJs.bootstrap(tab_container);return tab_gadget},Cache:function(){return{ROOT_CACHE_ID:"APP_CACHE",getCacheId:function(cache_id){return this.ROOT_CACHE_ID+cache_id},hasLocalStorage:function(){var mod;mod="localstorage_test_12345678";try{localStorage.setItem(mod,mod);localStorage.removeItem(mod);return true}catch(e){return false}},get:function(cache_id,default_value){cache_id=this.getCacheId(cache_id);if(this.hasLocalStorage()){return this.LocalStorageCachePlugin.get(cache_id,default_value)}return this.NameSpaceStorageCachePlugin.get(cache_id,default_value)},set:function(cache_id,data){cache_id=this.getCacheId(cache_id);if(this.hasLocalStorage()){this.LocalStorageCachePlugin.set(cache_id,data)}else{this.NameSpaceStorageCachePlugin.set(cache_id,data)}},LocalStorageCachePlugin:function(){return{get:function(cache_id,default_value){if(localStorage.getItem(cache_id)!==null){return JSON.parse(localStorage.getItem(cache_id))}return default_value},set:function(cache_id,data){localStorage.setItem(cache_id,JSON.stringify(data))}}}(),NameSpaceStorageCachePlugin:function(){var namespace={};return{get:function(cache_id,default_value){return namespace[cache_id]},set:function(cache_id,data){namespace[cache_id]=data}}}()}}(),Gadget:function(gadget_id,dom){this.id=gadget_id;this.dom=dom;this.is_ready=false;this.getId=function(){return this.id};this.getDom=function(){return this.dom};this.isReady=function(){return this.is_ready};this.setReady=function(){this.is_ready=true};this.remove=function(){var gadget;RenderJs.GadgetIndex.unregisterGadget(this);this.getDom().find("[data-gadget]").each(function(){gadget=RenderJs.GadgetIndex.getGadgetById($(this).attr("id"));RenderJs.GadgetIndex.unregisterGadget(gadget)});$(this.getDom()).remove()}},TabbularGadget:function(){var gadget_list=[];return{toggleVisibility:function(visible_dom){$(".selected").addClass("not_selected");$(".selected").removeClass("selected");visible_dom.addClass("selected");visible_dom.removeClass("not_selected")},addNewTabGadget:function(dom_id,gadget_id,gadget,gadget_data_handler,gadget_data_source){var tab_gadget;tab_gadget=RenderJs.addGadget(dom_id,gadget_id,gadget,gadget_data_handler,gadget_data_source
);$.each(gadget_list,function(index,gadget_id){var gadget=RenderJs.GadgetIndex.getGadgetById(gadget_id);gadget.remove();gadget_list.splice($.inArray(gadget_id,gadget_list),1)});gadget_list.push(tab_gadget.attr("id"))}}}(),GadgetIndex:function(){var gadget_list=[];return{getGadgetIdListFromDom:function(dom){var gadget_id_list=[];$.each(dom.find("[data-gadget]"),function(index,value){gadget_id_list.push($(value).attr("id"))});return gadget_id_list},setGadgetList:function(gadget_list_value){gadget_list=gadget_list_value},getGadgetList:function(){return gadget_list},registerGadget:function(gadget){if(RenderJs.GadgetIndex.getGadgetById(gadget.id)===undefined){gadget_list.push(gadget)}},unregisterGadget:function(gadget){var index=$.inArray(gadget,gadget_list);if(index!==-1){gadget_list.splice(index,1)}},getGadgetById:function(gadget_id){var gadget;gadget=undefined;$(RenderJs.GadgetIndex.getGadgetList()).each(function(index,value){if(value.getId()===gadget_id){gadget=value}});return gadget},getRootGadget:function(){return this.getGadgetList()[0]},isGadgetListLoaded:function(){var result;result=true;$(this.getGadgetList()).each(function(index,value){if(value.isReady()===false){result=false}});return result}}}(),GadgetCatalog:function(){var cache_id="setGadgetIndexUrlList";function updateGadgetIndexFromURL(url){var url_list=url.split("/"),document_url=url_list[url_list.length-1],d=url_list.splice($.inArray(document_url,url_list),1),base_url=url_list.join("/"),web_dav=jIO.newJio({type:"dav",username:"",password:"",url:base_url});web_dav.get(document_url,function(err,response){RenderJs.Cache.set(url,response)})}return{updateGadgetIndex:function(){$.each(RenderJs.GadgetCatalog.getGadgetIndexUrlList(),function(index,value){updateGadgetIndexFromURL(value)})},setGadgetIndexUrlList:function(url_list){RenderJs.Cache.set(cache_id,url_list)},getGadgetIndexUrlList:function(){return RenderJs.Cache.get(cache_id,undefined)},getGadgetListThatProvide:function(service){var gadget_list=[];$.each(RenderJs.GadgetCatalog.getGadgetIndexUrlList(),function(index,url){var cached_repo=RenderJs.Cache.get(url);$.each(cached_repo.gadget_list,function(index,gadget){if($.inArray(service,gadget.service_list)>-1){gadget_list.push(gadget)}})});return gadget_list},registerServiceList:function(gadget,service_list){}}}(),InteractionGadget:function(){return{init:function(force){var dom_list,gadget_id;if(force===1){dom_list=$("div[data-gadget-connection]")}else{dom_list=$("div[data-gadget-connection]").filter(function(){return $(this).data("bound")!==true}).data("bound",true)}dom_list.each(function(index,element){RenderJs.InteractionGadget.bind($(element))})},bind:function(gadget_dom){var gadget_id,gadget_connection_list,createMethodInteraction=function(original_source_method_id,source_gadget_id,source_method_id,destination_gadget_id,destination_method_id){var interaction=function(){RenderJs.GadgetIndex.getGadgetById(source_gadget_id)[original_source_method_id].apply(null,arguments);RenderJs.GadgetIndex.getGadgetById(destination_gadget_id).dom.trigger(source_method_id)};return interaction},createTriggerInteraction=function(destination_gadget_id,destination_method_id){var interaction=function(){RenderJs.GadgetIndex.getGadgetById(destination_gadget_id)[destination_method_id].apply(null,arguments)};return interaction};gadget_id=gadget_dom.attr("id");gadget_connection_list=gadget_dom.attr("data-gadget-connection");gadget_connection_list=$.parseJSON(gadget_connection_list);$.each(gadget_connection_list,function(key,value){var source,source_gadget_id,source_method_id,source_gadget,destination,destination_gadget_id,destination_method_id,destination_gadget,original_source_method_id;source=value.source.split(".");source_gadget_id=source[0];source_method_id=source[1];source_gadget=RenderJs.GadgetIndex.getGadgetById(source_gadget_id);destination=value.destination.split(".");destination_gadget_id=destination[0];destination_method_id=destination[1];destination_gadget=RenderJs.GadgetIndex.getGadgetById(destination_gadget_id);if(source_gadget.hasOwnProperty(source_method_id)){original_source_method_id="original_"+source_method_id;source_gadget[original_source_method_id]=source_gadget[source_method_id];source_gadget[source_method_id]=createMethodInteraction(original_source_method_id,source_gadget_id,source_method_id,destination_gadget_id,destination_method_id);destination_gadget.dom.bind(source_method_id,createTriggerInteraction(destination_gadget_id,destination_method_id))}else{source_gadget.dom.bind(source_method_id,createTriggerInteraction(destination_gadget_id,destination_method_id))}})}}}(),RouteGadget:function(){var route_list=[];return{init:function(){$("div[data-gadget-route]").each(function(index,element){RenderJs.RouteGadget.route($(element))})},route:function(gadget_dom){var body=$("body"),handler_func,priority,gadget_route_list=gadget_dom.attr("data-gadget-route");gadget_route_list=$.parseJSON(gadget_route_list);$.each(gadget_route_list,function(key,gadget_route){handler_func=function(){var gadget_id=gadget_route.destination.split(".")[0],method_id=gadget_route.destination.split(".")[1],gadget=RenderJs.GadgetIndex.getGadgetById(gadget_id);setSelfGadget(gadget);gadget[method_id].apply(null,arguments);setSelfGadget(undefined)};priority=gadget_route.priority;if(priority===undefined){priority=1}RenderJs.RouteGadget.add(gadget_route.source,handler_func,priority)})},add:function(path,handler_func,priority){var body=$("body");body.route("add",path,1).done(handler_func);route_list.push({path:path,handler_func:handler_func,priority:priority})},go:function(path,handler_func,priority){var body=$("body");body.route("go",path,priority).fail(handler_func)},remove:function(path){},getRouteList:function(){return route_list}}}()}}();
"use strict";var RENDERJS_ENABLE_IMPLICIT_GADGET_RENDERING=true;var RENDERJS_ENABLE_IMPLICIT_INTERACTION_BIND=true;var RENDERJS_ENABLE_IMPLICIT_ROUTE_CREATE=true;if(console===undefined||console.log===undefined){var console={};console.log=function(){}}var RenderJs=function(){var is_ready=false,current_gadget;function setSelfGadget(gadget){current_gadget=gadget}return{init:function(){if(RENDERJS_ENABLE_IMPLICIT_GADGET_RENDERING){RenderJs.bootstrap($("body"))}var root_gadget=RenderJs.GadgetIndex.getRootGadget();if(RENDERJS_ENABLE_IMPLICIT_INTERACTION_BIND||RENDERJS_ENABLE_IMPLICIT_ROUTE_CREATE){if(root_gadget!==undefined){RenderJs.bindReady(function(){if(RENDERJS_ENABLE_IMPLICIT_INTERACTION_BIND){RenderJs.InteractionGadget.init()}if(RENDERJS_ENABLE_IMPLICIT_ROUTE_CREATE){RenderJs.RouteGadget.init()}})}}},bootstrap:function(root){var gadget_id,is_gadget;gadget_id=root.attr("id");is_gadget=root.attr("data-gadget")!==undefined;RenderJs.setReady(false);if(is_gadget&&gadget_id!==undefined){RenderJs.loadGadget(root)}RenderJs.loadRecursiveGadget(root)},loadRecursiveGadget:function(root){var gadget_list,gadget,gadget_id,gadget_js;gadget_list=root.find("[data-gadget]");gadget_list.each(function(){gadget=$(this);gadget_id=gadget.attr("id");gadget_js=new RenderJs.Gadget(gadget_id,gadget);RenderJs.GadgetIndex.registerGadget(gadget_js)});gadget_list.each(function(){RenderJs.loadGadget($(this))})},setGadgetAndRecurse:function(gadget,data){setSelfGadget(RenderJs.GadgetIndex.getGadgetById(gadget.attr("id")));gadget.append(data);setSelfGadget(undefined);RenderJs.loadRecursiveGadget(gadget)},getSelfGadget:function(){return current_gadget},loadGadget:function(gadget){var url,gadget_id,gadget_property,cacheable,cache_id,i,gadget_index,gadget_index_id,app_cache,data,gadget_js,is_update_gadget_data_running;url=gadget.attr("data-gadget");gadget_id=gadget.attr("id");gadget_js=RenderJs.GadgetIndex.getGadgetById(gadget_id);gadget_index=RenderJs.GadgetIndex.getGadgetList();if(gadget_js===undefined){gadget_js=new RenderJs.Gadget(gadget_id,gadget);RenderJs.GadgetIndex.registerGadget(gadget_js)}if(gadget_js.isReady()){return}gadget_property=gadget.attr("data-gadget-property");if(gadget_property!==undefined){gadget_property=$.parseJSON(gadget_property);$.each(gadget_property,function(key,value){gadget_js[key]=value})}if(url!==undefined&&url!==""){cacheable=gadget.attr("data-gadget-cacheable");cache_id=gadget.attr("data-gadget-cache-id");if(cacheable!==undefined&&cache_id!==undefined){cacheable=Boolean(parseInt(cacheable,10))}if(cacheable){app_cache=RenderJs.Cache.get(cache_id,undefined);if(app_cache===undefined||app_cache===null){$.ajax({url:url,yourCustomData:{gadget_id:gadget_id,cache_id:cache_id},success:function(data){cache_id=this.yourCustomData.cache_id;gadget_id=this.yourCustomData.gadget_id;RenderJs.Cache.set(cache_id,data);RenderJs.GadgetIndex.getGadgetById(gadget_id).setReady();RenderJs.setGadgetAndRecurse(gadget,data);RenderJs.checkAndTriggerReady();RenderJs.updateGadgetData(gadget)}})}else{data=app_cache;gadget_js.setReady();this.setGadgetAndRecurse(gadget,data);this.checkAndTriggerReady();RenderJs.updateGadgetData(gadget)}}else{$.ajax({url:url,yourCustomData:{gadget_id:gadget_id},success:function(data){gadget_id=this.yourCustomData.gadget_id;RenderJs.GadgetIndex.getGadgetById(gadget_id).setReady();RenderJs.setGadgetAndRecurse(gadget,data);RenderJs.checkAndTriggerReady();RenderJs.updateGadgetData(gadget)}})}}else{is_update_gadget_data_running=RenderJs.updateGadgetData(gadget);if(!is_update_gadget_data_running){gadget_js.setReady()}RenderJs.checkAndTriggerReady()}},isReady:function(){return is_ready},setReady:function(value){is_ready=value},bindReady:function(ready_function){$("body").one("ready",ready_function)},checkAndTriggerReady:function(){var is_gadget_list_loaded;is_gadget_list_loaded=RenderJs.GadgetIndex.isGadgetListLoaded();if(is_gadget_list_loaded){if(!RenderJs.isReady()){RenderJs.GadgetIndex.getRootGadget().getDom().trigger("ready");$("body").trigger("ready");RenderJs.setReady(true)}}return is_gadget_list_loaded},updateGadgetData:function(gadget){var data_source,data_handler;data_source=gadget.attr("data-gadget-source");data_handler=gadget.attr("data-gadget-handler");if(data_source!==undefined&&data_source!==""){$.ajax({url:data_source,dataType:"json",yourCustomData:{data_handler:data_handler,gadget_id:gadget.attr("id")},success:function(result){var data_handler,gadget_id;data_handler=this.yourCustomData.data_handler;gadget_id=this.yourCustomData.gadget_id;if(data_handler!==undefined){eval(data_handler+"(result)");gadget=RenderJs.GadgetIndex.getGadgetById(gadget_id);gadget.setReady();RenderJs.checkAndTriggerReady()}}});return true}return false},addGadget:function(dom_id,gadget_id,gadget,gadget_data_handler,gadget_data_source
,bootstrap){var html_string,tab_container,tab_gadget;tab_container=$("#"+dom_id);tab_container.empty();html_string=[\'<div id="\'+gadget_id+\'"\',\'data-gadget="\'+gadget+\'"\',\'data-gadget-handler="\'+gadget_data_handler+\'" \',\'data-gadget-source="\'+gadget_data_source+\'">
</div>
\'].join("\\n");tab_container.append(html_string);tab_gadget=tab_container.find("#"+gadget_id);if(bootstrap!==false){RenderJs.bootstrap(tab_container)}return tab_gadget},Cache:function(){return{ROOT_CACHE_ID:"APP_CACHE",getCacheId:function(cache_id){return this.ROOT_CACHE_ID+cache_id},hasLocalStorage:function(){var mod;mod="localstorage_test_12345678";try{localStorage.setItem(mod,mod);localStorage.removeItem(mod);return true}catch(e){return false}},get:function(cache_id,default_value){cache_id=this.getCacheId(cache_id);if(this.hasLocalStorage()){return this.LocalStorageCachePlugin.get(cache_id,default_value)}return this.NameSpaceStorageCachePlugin.get(cache_id,default_value)},set:function(cache_id,data){cache_id=this.getCacheId(cache_id);if(this.hasLocalStorage()){this.LocalStorageCachePlugin.set(cache_id,data)}else{this.NameSpaceStorageCachePlugin.set(cache_id,data)}},LocalStorageCachePlugin:function(){return{get:function(cache_id,default_value){if(localStorage.getItem(cache_id)!==null){return JSON.parse(localStorage.getItem(cache_id))}return default_value},set:function(cache_id,data){localStorage.setItem(cache_id,JSON.stringify(data))}}}(),NameSpaceStorageCachePlugin:function(){var namespace={};return{get:function(cache_id,default_value){return namespace[cache_id]},set:function(cache_id,data){namespace[cache_id]=data}}}()}}(),Gadget:function(gadget_id,dom){this.id=gadget_id;this.dom=dom;this.is_ready=false;this.getId=function(){return this.id};this.getDom=function(){return this.dom};this.isReady=function(){return this.is_ready};this.setReady=function(){this.is_ready=true};this.remove=function(){var gadget;RenderJs.GadgetIndex.unregisterGadget(this);this.getDom().find("[data-gadget]").each(function(){gadget=RenderJs.GadgetIndex.getGadgetById($(this).attr("id"));RenderJs.GadgetIndex.unregisterGadget(gadget)});$(this.getDom()).remove()}},TabbularGadget:function(){var gadget_list=[];return{toggleVisibility:function(visible_dom){$(".selected").addClass("not_selected");$(".selected").removeClass("selected");visible_dom.addClass("selected");visible_dom.removeClass("not_selected")},addNewTabGadget:function(dom_id,gadget_id,gadget,gadget_data_handler,gadget_data_source,bootstrap){var tab_gadget;tab_gadget=RenderJs.addGadget(dom_id,gadget_id,gadget,gadget_data_handler,gadget_data_source,bootstrap
);$.each(gadget_list,function(index,gadget_id){var gadget=RenderJs.GadgetIndex.getGadgetById(gadget_id);gadget.remove();gadget_list.splice($.inArray(gadget_id,gadget_list),1)});gadget_list.push(tab_gadget.attr("id"))}}}(),GadgetIndex:function(){var gadget_list=[];return{getGadgetIdListFromDom:function(dom){var gadget_id_list=[];$.each(dom.find("[data-gadget]"),function(index,value){gadget_id_list.push($(value).attr("id"))});return gadget_id_list},setGadgetList:function(gadget_list_value){gadget_list=gadget_list_value},getGadgetList:function(){return gadget_list},registerGadget:function(gadget){if(RenderJs.GadgetIndex.getGadgetById(gadget.id)===undefined){gadget_list.push(gadget)}},unregisterGadget:function(gadget){var index=$.inArray(gadget,gadget_list);if(index!==-1){gadget_list.splice(index,1)}},getGadgetById:function(gadget_id){var gadget;gadget=undefined;$(RenderJs.GadgetIndex.getGadgetList()).each(function(index,value){if(value.getId()===gadget_id){gadget=value}});return gadget},getRootGadget:function(){return this.getGadgetList()[0]},isGadgetListLoaded:function(){var result;result=true;$(this.getGadgetList()).each(function(index,value){if(value.isReady()===false){result=false}});return result}}}(),GadgetCatalog:function(){var cache_id="setGadgetIndexUrlList";function updateGadgetIndexFromURL(url){var url_list=url.split("/"),document_url=url_list[url_list.length-1],d=url_list.splice($.inArray(document_url,url_list),1),base_url=url_list.join("/"),web_dav=jIO.newJio({type:"dav",username:"",password:"",url:base_url});web_dav.get(document_url,function(err,response){RenderJs.Cache.set(url,response)})}return{updateGadgetIndex:function(){$.each(RenderJs.GadgetCatalog.getGadgetIndexUrlList(),function(index,value){updateGadgetIndexFromURL(value)})},setGadgetIndexUrlList:function(url_list){RenderJs.Cache.set(cache_id,url_list)},getGadgetIndexUrlList:function(){return RenderJs.Cache.get(cache_id,undefined)},getGadgetListThatProvide:function(service){var gadget_list=[];$.each(RenderJs.GadgetCatalog.getGadgetIndexUrlList(),function(index,url){var cached_repo=RenderJs.Cache.get(url);$.each(cached_repo.gadget_list,function(index,gadget){if($.inArray(service,gadget.service_list)>-1){gadget_list.push(gadget)}})});return gadget_list},registerServiceList:function(gadget,service_list){}}}(),InteractionGadget:function(){return{init:function(force){var dom_list,gadget_id;if(force===1){dom_list=$("div[data-gadget-connection]")}else{dom_list=$("div[data-gadget-connection]").filter(function(){return $(this).data("bound")!==true}).data("bound",true)}dom_list.each(function(index,element){RenderJs.InteractionGadget.bind($(element))})},bind:function(gadget_dom){var gadget_id,gadget_connection_list,createMethodInteraction=function(original_source_method_id,source_gadget_id,source_method_id,destination_gadget_id,destination_method_id){var interaction=function(){RenderJs.GadgetIndex.getGadgetById(source_gadget_id)[original_source_method_id].apply(null,arguments);RenderJs.GadgetIndex.getGadgetById(destination_gadget_id).dom.trigger(source_method_id)};return interaction},createTriggerInteraction=function(destination_gadget_id,destination_method_id){var interaction=function(){RenderJs.GadgetIndex.getGadgetById(destination_gadget_id)[destination_method_id].apply(null,arguments)};return interaction};gadget_id=gadget_dom.attr("id");gadget_connection_list=gadget_dom.attr("data-gadget-connection");gadget_connection_list=$.parseJSON(gadget_connection_list);$.each(gadget_connection_list,function(key,value){var source,source_gadget_id,source_method_id,source_gadget,destination,destination_gadget_id,destination_method_id,destination_gadget,original_source_method_id;source=value.source.split(".");source_gadget_id=source[0];source_method_id=source[1];source_gadget=RenderJs.GadgetIndex.getGadgetById(source_gadget_id);destination=value.destination.split(".");destination_gadget_id=destination[0];destination_method_id=destination[1];destination_gadget=RenderJs.GadgetIndex.getGadgetById(destination_gadget_id);if(source_gadget.hasOwnProperty(source_method_id)){original_source_method_id="original_"+source_method_id;source_gadget[original_source_method_id]=source_gadget[source_method_id];source_gadget[source_method_id]=createMethodInteraction(original_source_method_id,source_gadget_id,source_method_id,destination_gadget_id,destination_method_id);destination_gadget.dom.bind(source_method_id,createTriggerInteraction(destination_gadget_id,destination_method_id))}else{source_gadget.dom.bind(source_method_id,createTriggerInteraction(destination_gadget_id,destination_method_id))}})}}}(),RouteGadget:function(){var route_list=[];return{init:function(){$("div[data-gadget-route]").each(function(index,element){RenderJs.RouteGadget.route($(element))})},route:function(gadget_dom){var body=$("body"),handler_func,priority,gadget_route_list=gadget_dom.attr("data-gadget-route");gadget_route_list=$.parseJSON(gadget_route_list);$.each(gadget_route_list,function(key,gadget_route){handler_func=function(){var gadget_id=gadget_route.destination.split(".")[0],method_id=gadget_route.destination.split(".")[1],gadget=RenderJs.GadgetIndex.getGadgetById(gadget_id);setSelfGadget(gadget);gadget[method_id].apply(null,arguments);setSelfGadget(undefined)};priority=gadget_route.priority;if(priority===undefined){priority=1}RenderJs.RouteGadget.add(gadget_route.source,handler_func,priority)})},add:function(path,handler_func,priority){var body=$("body");body.route("add",path,1).done(handler_func);route_list.push({path:path,handler_func:handler_func,priority:priority})},go:function(path,handler_func,priority){var body=$("body");body.route("go",path,priority).fail(handler_func)},remove:function(path){},getRouteList:function(){return route_list}}}()}}();
]]>
</string>
</value>
]]>
</string>
</value>
</item>
</item>
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
size
</string>
</key>
<key>
<string>
size
</string>
</key>
<value>
<int>
131
21
</int>
</value>
<value>
<int>
131
73
</int>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
...
...
bt5/erp5_jquery_plugin_renderjs/bt/revision
View file @
88b82752
23
24
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment