Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
erp5
Commits
c21768a8
Commit
c21768a8
authored
May 10, 2012
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use this *if possible). Extend API. Clean up unused code.
parent
434d958d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
60 deletions
+57
-60
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
+56
-59
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 @
c21768a8
...
@@ -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>
ts3665
3640.49
</string>
</value>
<value>
<string>
ts3665
9323.6
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
__name__
</string>
</key>
<key>
<string>
__name__
</string>
</key>
...
@@ -43,12 +43,12 @@ var NameSpaceStorageCachePlugin = {\n
...
@@ -43,12 +43,12 @@ var NameSpaceStorageCachePlugin = {\n
\n
\n
get: function (cache_id, default_value) {\n
get: function (cache_id, default_value) {\n
/* Get cache key value */\n
/* Get cache key value */\n
return
NameSpaceStorageCachePlugin
.namespace[cache_id];\n
return
this
.namespace[cache_id];\n
},\n
},\n
\n
\n
set: function (cache_id, data) {\n
set: function (cache_id, data) {\n
/* Set cache key value */\n
/* Set cache key value */\n
NameSpaceStorageCachePlugin
.namespace[cache_id] = data;\n
this
.namespace[cache_id] = data;\n
}\n
}\n
\n
\n
};\n
};\n
...
@@ -79,7 +79,7 @@ var Cache = {\n
...
@@ -79,7 +79,7 @@ var Cache = {\n
/* We should have a way to \'purge\' localStorage by setting a ROOT_CACHE_ID in all browser\n
/* We should have a way to \'purge\' localStorage by setting a ROOT_CACHE_ID in all browser\n
* instances\n
* instances\n
*/\n
*/\n
return
Cache
.ROOT_CACHE_ID + cache_id;\n
return
this
.ROOT_CACHE_ID + cache_id;\n
},\n
},\n
\n
\n
hasLocalStorage: function() {\n
hasLocalStorage: function() {\n
...
@@ -100,19 +100,18 @@ var Cache = {\n
...
@@ -100,19 +100,18 @@ var Cache = {\n
\n
\n
get: function (cache_id, default_value) {\n
get: function (cache_id, default_value) {\n
/* Get cache key value */\n
/* Get cache key value */\n
cache_id =
Cache
.getCacheId(cache_id);\n
cache_id =
this
.getCacheId(cache_id);\n
if (
Cache
.hasLocalStorage()) {\n
if (
this
.hasLocalStorage()) {\n
return LocalStorageCachePlugin.get(cache_id, default_value);\n
return LocalStorageCachePlugin.get(cache_id, default_value);\n
}\n
}\n
else {
\n
//fallback to javscript namespace cache
\n
return NameSpaceStorageCachePlugin.get(cache_id, default_value);\n
return NameSpaceStorageCachePlugin.get(cache_id, default_value);\n
}\n
},\n
},\n
\n
\n
set: function (cache_id, data) {\n
set: function (cache_id, data) {\n
/* Set cache key value */\n
/* Set cache key value */\n
cache_id =
Cache
.getCacheId(cache_id);\n
cache_id =
this
.getCacheId(cache_id);\n
if (
Cache
.hasLocalStorage()){\n
if (
this
.hasLocalStorage()){\n
LocalStorageCachePlugin.set(cache_id, data);}\n
LocalStorageCachePlugin.set(cache_id, data);}\n
else{\n
else{\n
NameSpaceStorageCachePlugin.set(cache_id, data);}\n
NameSpaceStorageCachePlugin.set(cache_id, data);}\n
...
@@ -170,15 +169,14 @@ var Form = {\n
...
@@ -170,15 +169,14 @@ var Form = {\n
\n
\n
getCurrentFormId: function () {\n
getCurrentFormId: function () {\n
/* Get current form ID (return hard coded one for now) */\n
/* Get current form ID (return hard coded one for now) */\n
return
Form
.CURRENT_FORM_ID;\n
return
this
.CURRENT_FORM_ID;\n
},\n
},\n
\n
\n
setCurrentFormId: function (form_id) {\n
setCurrentFormId: function (form_id) {\n
/* Set current form ID (return hard coded one for now) */\n
/* Set current form ID (return hard coded one for now) */\n
Form
.CURRENT_FORM_ID = form_id;\n
this
.CURRENT_FORM_ID = form_id;\n
},\n
},\n
\n
\n
\n
getFieldId: function(field_id) {\n
getFieldId: function(field_id) {\n
/* Generate local form field id */\n
/* Generate local form field id */\n
return "field_" + field_id;\n
return "field_" + field_id;\n
...
@@ -213,8 +211,8 @@ var Form = {\n
...
@@ -213,8 +211,8 @@ var Form = {\n
BaseInputField: function (field_id, field_dict) {\n
BaseInputField: function (field_id, field_dict) {\n
/* HTML based input field */\n
/* HTML based input field */\n
var dom, display_width;\n
var dom, display_width;\n
dom = $("[name=" +
Form
.getFieldId(field_id) + "]");\n
dom = $("[name=" +
this
.getFieldId(field_id) + "]");\n
Form
.updateField(dom, field_dict);\n
this
.updateField(dom, field_dict);\n
display_width = field_dict.display_width;\n
display_width = field_dict.display_width;\n
if (display_width){\n
if (display_width){\n
dom.attr("size", display_width);}\n
dom.attr("size", display_width);}\n
...
@@ -224,8 +222,8 @@ var Form = {\n
...
@@ -224,8 +222,8 @@ var Form = {\n
EditorField: function (field_id, field_dict) {\n
EditorField: function (field_id, field_dict) {\n
/* HTML based input field */\n
/* HTML based input field */\n
var dom;\n
var dom;\n
dom = $("#" +
Form
.getFieldId(field_id));\n
dom = $("#" +
this
.getFieldId(field_id));\n
Form
.updateField(dom, field_dict);\n
this
.updateField(dom, field_dict);\n
return dom;\n
return dom;\n
},\n
},\n
\n
\n
...
@@ -233,8 +231,8 @@ var Form = {\n
...
@@ -233,8 +231,8 @@ var Form = {\n
/* Select field */\n
/* Select field */\n
var field_value, select_dom;\n
var field_value, select_dom;\n
field_value = field_dict.value;\n
field_value = field_dict.value;\n
select_dom = $("select[name=" +
Form
.getFieldId(field_id) + "]");\n
select_dom = $("select[name=" +
this
.getFieldId(field_id) + "]");\n
Form
.addOptionTagList(select_dom, field_dict.items, field_value);\n
this
.addOptionTagList(select_dom, field_dict.items, field_value);\n
return select_dom; \n
return select_dom; \n
},\n
},\n
\n
\n
...
@@ -244,7 +242,7 @@ var Form = {\n
...
@@ -244,7 +242,7 @@ var Form = {\n
// XXX: we render only first value but it can be many how to get them ?\n
// XXX: we render only first value but it can be many how to get them ?\n
field_value = field_dict.value[0];\n
field_value = field_dict.value[0];\n
select_dom = $("select[name=subfield_field_" + field_id + "]");\n
select_dom = $("select[name=subfield_field_" + field_id + "]");\n
Form
.addOptionTagList(select_dom, field_dict.items, field_value);\n
this
.addOptionTagList(select_dom, field_dict.items, field_value);\n
return select_dom;\n
return select_dom;\n
},\n
},\n
\n
\n
...
@@ -252,7 +250,7 @@ var Form = {\n
...
@@ -252,7 +250,7 @@ var Form = {\n
/* CheckBoxField field */\n
/* CheckBoxField field */\n
var checked, checkbox_dom;\n
var checked, checkbox_dom;\n
checked = Boolean(field_dict.value);\n
checked = Boolean(field_dict.value);\n
checkbox_dom = $("input[name=" +
Form
.getFieldId(field_id) + "]");\n
checkbox_dom = $("input[name=" +
this
.getFieldId(field_id) + "]");\n
if (checked) {\n
if (checked) {\n
checkbox_dom.attr(\'checked\', true);\n
checkbox_dom.attr(\'checked\', true);\n
}\n
}\n
...
@@ -261,28 +259,28 @@ var Form = {\n
...
@@ -261,28 +259,28 @@ var Form = {\n
\n
\n
TextAreaField: function (field_id, field_dict) {\n
TextAreaField: function (field_id, field_dict) {\n
/* TextArea field */\n
/* TextArea field */\n
return
Form
.BaseInputField(field_id, field_dict);\n
return
this
.BaseInputField(field_id, field_dict);\n
},\n
},\n
\n
\n
StringField: function (field_id, field_dict) {\n
StringField: function (field_id, field_dict) {\n
/* String field */\n
/* String field */\n
return
Form
.BaseInputField(field_id, field_dict);\n
return
this
.BaseInputField(field_id, field_dict);\n
},\n
},\n
\n
\n
IntegerField: function (field_id, field_dict) {\n
IntegerField: function (field_id, field_dict) {\n
/* Int field */\n
/* Int field */\n
return
Form
.BaseInputField(field_id, field_dict);\n
return
this
.BaseInputField(field_id, field_dict);\n
},\n
},\n
\n
\n
PasswordField: function (field_id, field_dict) {\n
PasswordField: function (field_id, field_dict) {\n
/* PasswordField field */\n
/* PasswordField field */\n
return
Form
.BaseInputField(field_id, field_dict);\n
return
this
.BaseInputField(field_id, field_dict);\n
},\n
},\n
\n
\n
DateTimeField: function (field_id, field_dict) {\n
DateTimeField: function (field_id, field_dict) {\n
/* DateTimeField field */\n
/* DateTimeField field */\n
var date, dom;\n
var date, dom;\n
dom = $("[name=" +
Form
.getFieldId(field_id) + "]");\n
dom = $("[name=" +
this
.getFieldId(field_id) + "]");\n
date = field_dict.value;\n
date = field_dict.value;\n
date = new Date(date);\n
date = new Date(date);\n
dom.datepicker({ dateFormat: \'dd/mm/yy\' }); // XXX: get format from server!\n
dom.datepicker({ dateFormat: \'dd/mm/yy\' }); // XXX: get format from server!\n
...
@@ -292,23 +290,23 @@ var Form = {\n
...
@@ -292,23 +290,23 @@ var Form = {\n
\n
\n
EmailField: function (field_id, field_dict) {\n
EmailField: function (field_id, field_dict) {\n
/* Email field */\n
/* Email field */\n
return
Form
.BaseInputField(field_id, field_dict);\n
return
this
.BaseInputField(field_id, field_dict);\n
},\n
},\n
\n
\n
FormBox: function (field_id, field_dict) {\n
FormBox: function (field_id, field_dict) {\n
/* Email field */\n
/* Email field */\n
return
Form
.BaseInputField(field_id, field_dict);\n
return
this
.BaseInputField(field_id, field_dict);\n
},\n
},\n
\n
\n
RelationStringField: function (field_id, field_dict) {\n
RelationStringField: function (field_id, field_dict) {\n
/* Relation field */\n
/* Relation field */\n
return
Form
.BaseInputField(field_id, field_dict);\n
return
this
.BaseInputField(field_id, field_dict);\n
},\n
},\n
\n
\n
ImageField: function (field_id, field_dict) {\n
ImageField: function (field_id, field_dict) {\n
/* Image field */\n
/* Image field */\n
var dom;\n
var dom;\n
dom = $("img[name=" +
Form
.getFieldId(field_id) + "]");\n
dom = $("img[name=" +
this
.getFieldId(field_id) + "]");\n
// XXX: image field should return details like quality, etc ...\n
// XXX: image field should return details like quality, etc ...\n
dom.attr("src", field_dict.value + "?quality=75.0
&display=thumbnail&format=png");
\n
dom.attr("src", field_dict.value + "?quality=75.0
&display=thumbnail&format=png");
\n
},\n
},\n
...
@@ -319,7 +317,7 @@ var Form = {\n
...
@@ -319,7 +317,7 @@ var Form = {\n
listbox_id = "field_" + field_id;\n
listbox_id = "field_" + field_id;\n
navigation_id = listbox_id + "_pager"; \n
navigation_id = listbox_id + "_pager"; \n
listbox_table = $("#"+listbox_id);\n
listbox_table = $("#"+listbox_id);\n
current_form_id =
Form
.getCurrentFormId();\n
current_form_id =
this
.getCurrentFormId();\n
\n
\n
listbox_dict = field_dict.listbox;\n
listbox_dict = field_dict.listbox;\n
listbox_data_url = listbox_dict.listbox_data_url;\n
listbox_data_url = listbox_dict.listbox_data_url;\n
...
@@ -456,15 +454,24 @@ var FormUpdater = {\n
...
@@ -456,15 +454,24 @@ var FormUpdater = {\n
}\n
}\n
};\n
};\n
\n
\n
\n
/*\n
/*\n
* Javascript Gadget representation\n
* Javascript Gadget representation\n
*/\n
*/\n
\n
function Gadget(id, dom) {\n
function Gadget(id, dom) {\n
this.id = id;\n
this.id = id;\n
this.dom = dom;\n
this.dom = dom;\n
}\n
}\n
\n
\n
Gadget.prototype.getId = function() {\n
return this.id;\n
}\n
\n
Gadget.prototype.getDom = function() {\n
return this.dom;\n
}\n
\n
\n
/*\n
/*\n
* Generic gadget index placeholder\n
* Generic gadget index placeholder\n
*/\n
*/\n
...
@@ -472,6 +479,13 @@ var GadgetIndex = {\n
...
@@ -472,6 +479,13 @@ var GadgetIndex = {\n
\n
\n
gadget_list: [],\n
gadget_list: [],\n
\n
\n
getGadgetList: function(gadget) {\n
/*\n
* Return list of registered gadgets\n
*/\n
return this.gadget_list;\n
},\n
\n
registerGadget: function(gadget) {\n
registerGadget: function(gadget) {\n
/* Register gadget */\n
/* Register gadget */\n
this.gadget_list.push(gadget);\n
this.gadget_list.push(gadget);\n
...
@@ -488,7 +502,7 @@ var GadgetIndex = {\n
...
@@ -488,7 +502,7 @@ var GadgetIndex = {\n
*/\n
*/\n
var gadget;\n
var gadget;\n
gadget = undefined;\n
gadget = undefined;\n
$(
GadgetIndex.gadget_list
).each(\n
$(
this.getGadgetList()
).each(\n
function (index, value) {\n
function (index, value) {\n
if (value.id===gadget_id) {\n
if (value.id===gadget_id) {\n
gadget = value;\n
gadget = value;\n
...
@@ -503,7 +517,6 @@ var GadgetIndex = {\n
...
@@ -503,7 +517,6 @@ var GadgetIndex = {\n
*/\n
*/\n
\n
\n
var RenderJs = {\n
var RenderJs = {\n
\n
\n
\n
bootstrap: function (root){\n
bootstrap: function (root){\n
/* initial load application gadget */\n
/* initial load application gadget */\n
...
@@ -516,14 +529,15 @@ var RenderJs = {\n
...
@@ -516,14 +529,15 @@ var RenderJs = {\n
var gadget_list;\n
var gadget_list;\n
gadget_list = root.find("[gadget]");\n
gadget_list = root.find("[gadget]");\n
// Load chilren\n
// Load chilren\n
gadget_list.each(function(i,v){RenderJs.loadGadgetFromUrl($(this));});\n
gadget_list.each(function(i,v) {\n
RenderJs.loadGadgetFromUrl($(this)); });\n
},\n
},\n
\n
\n
updateAndRecurse: function(gadget, data){\n
updateAndRecurse: function(gadget, data){\n
/* Update current gadget and recurse down */\n
/* Update current gadget and recurse down */\n
gadget.append(data);\n
gadget.append(data);\n
// a gadget may contain sub gadgets\n
// a gadget may contain sub gadgets\n
RenderJ
s.load(gadget);\n
thi
s.load(gadget);\n
},\n
},\n
\n
\n
loadGadgetFromUrl: function(gadget) {\n
loadGadgetFromUrl: function(gadget) {\n
...
@@ -531,7 +545,7 @@ var RenderJs = {\n
...
@@ -531,7 +545,7 @@ var RenderJs = {\n
var url, gadget_id, gadget_property, cacheable, cache_id, app_cache, data;\n
var url, gadget_id, gadget_property, cacheable, cache_id, app_cache, data;\n
url = gadget.attr("gadget");\n
url = gadget.attr("gadget");\n
gadget_id = gadget.attr("id");\n
gadget_id = gadget.attr("id");\n
\n
\n
// XXX: How to know how long a form should be cached locally\n
// XXX: How to know how long a form should be cached locally\n
// i.e. what happens if it changes at server side ?\n
// i.e. what happens if it changes at server side ?\n
\n
\n
...
@@ -570,7 +584,7 @@ var RenderJs = {\n
...
@@ -570,7 +584,7 @@ var RenderJs = {\n
else{\n
else{\n
// get from cache\n
// get from cache\n
data = app_cache;\n
data = app_cache;\n
RenderJ
s.updateAndRecurse(gadget, data);}\n
thi
s.updateAndRecurse(gadget, data);}\n
}\n
}\n
else{\n
else{\n
// not to be cached\n
// not to be cached\n
...
@@ -587,22 +601,6 @@ var RenderJs = {\n
...
@@ -587,22 +601,6 @@ var RenderJs = {\n
root.find("[gadget]").each(function(i,v){RenderJs.updateGadgetData($(this));});\n
root.find("[gadget]").each(function(i,v){RenderJs.updateGadgetData($(this));});\n
},\n
},\n
\n
\n
traverse: function (method_name){\n
// not working with ie7\n
var method, parent;\n
method = undefined;\n
parent = window;\n
$.each(method_name.split(\'.\'),\n
function(index,value){\n
method = parent[value];\n
//console.log(value + obj);\n
if (method!==undefined){\n
parent=method;}\n
else{\n
return undefined;}});\n
return method;\n
},\n
\n
updateGadgetWithDataHandler: function (result) {\n
updateGadgetWithDataHandler: function (result) {\n
var data_handler;\n
var data_handler;\n
data_handler = this.yourCustomData.data_handler;\n
data_handler = this.yourCustomData.data_handler;\n
...
@@ -624,8 +622,7 @@ var RenderJs = {\n
...
@@ -624,8 +622,7 @@ var RenderJs = {\n
success: RenderJs.updateGadgetWithDataHandler});}\n
success: RenderJs.updateGadgetWithDataHandler});}\n
}\n
}\n
\n
\n
};\n
};
]]>
</string>
</value>
]]>
</string>
</value>
</item>
</item>
...
@@ -635,7 +632,7 @@ var RenderJs = {\n
...
@@ -635,7 +632,7 @@ var RenderJs = {\n
</item>
</item>
<item>
<item>
<key>
<string>
size
</string>
</key>
<key>
<string>
size
</string>
</key>
<value>
<int>
21
530
</int>
</value>
<value>
<int>
21
131
</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 @
c21768a8
8
9
\ 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