Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
officejs
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
officejs
Commits
7b2f48f5
Commit
7b2f48f5
authored
May 09, 2012
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial commit of gadget's interaction POC.
parent
98bbca72
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
2431 additions
and
0 deletions
+2431
-0
poc/erp5_gadget_interaction/SkinTemplateItem/portal_skins/erp5_gadget_interaction.xml
...SkinTemplateItem/portal_skins/erp5_gadget_interaction.xml
+26
-0
poc/erp5_gadget_interaction/SkinTemplateItem/portal_skins/erp5_gadget_interaction/adsafe.js.xml
...teItem/portal_skins/erp5_gadget_interaction/adsafe.js.xml
+1954
-0
poc/erp5_gadget_interaction/SkinTemplateItem/portal_skins/erp5_gadget_interaction/interactions.xml
...tem/portal_skins/erp5_gadget_interaction/interactions.xml
+92
-0
poc/erp5_gadget_interaction/SkinTemplateItem/portal_skins/erp5_gadget_interaction/interactor.js.xml
...em/portal_skins/erp5_gadget_interaction/interactor.js.xml
+81
-0
poc/erp5_gadget_interaction/SkinTemplateItem/portal_skins/erp5_gadget_interaction/test_gadgets.xml
...tem/portal_skins/erp5_gadget_interaction/test_gadgets.xml
+26
-0
poc/erp5_gadget_interaction/SkinTemplateItem/portal_skins/erp5_gadget_interaction/test_gadgets/A.xml
...m/portal_skins/erp5_gadget_interaction/test_gadgets/A.xml
+94
-0
poc/erp5_gadget_interaction/SkinTemplateItem/portal_skins/erp5_gadget_interaction/test_gadgets/B.xml
...m/portal_skins/erp5_gadget_interaction/test_gadgets/B.xml
+77
-0
poc/erp5_gadget_interaction/SkinTemplateItem/portal_skins/erp5_gadget_interaction/test_gadgets/C.xml
...m/portal_skins/erp5_gadget_interaction/test_gadgets/C.xml
+77
-0
poc/erp5_gadget_interaction/bt/revision
poc/erp5_gadget_interaction/bt/revision
+1
-0
poc/erp5_gadget_interaction/bt/template_format_version
poc/erp5_gadget_interaction/bt/template_format_version
+1
-0
poc/erp5_gadget_interaction/bt/template_skin_id_list
poc/erp5_gadget_interaction/bt/template_skin_id_list
+1
-0
poc/erp5_gadget_interaction/bt/title
poc/erp5_gadget_interaction/bt/title
+1
-0
No files found.
poc/erp5_gadget_interaction/SkinTemplateItem/portal_skins/erp5_gadget_interaction.xml
0 → 100644
View file @
7b2f48f5
<?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_gadget_interaction
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
poc/erp5_gadget_interaction/SkinTemplateItem/portal_skins/erp5_gadget_interaction/adsafe.js.xml
0 → 100644
View file @
7b2f48f5
This diff is collapsed.
Click to expand it.
poc/erp5_gadget_interaction/SkinTemplateItem/portal_skins/erp5_gadget_interaction/interactions.xml
0 → 100644
View file @
7b2f48f5
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ZopePageTemplate"
module=
"Products.PageTemplates.ZopePageTemplate"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<unicode>
\074!DOCTYPE html\076\n
\074html\076\n
\n
\074head\076\n
\074!-- \074script src="adsafe.js"\076\074/script\076 --\076\n
\074script src="jquery/core/jquery.js"\076\074/script\076\n
\074script src="jquery/plugin/renderjs/renderjs.js"\076\074/script\076\n
\074script src="interactor.js"\076\074/script\076\n
\n
\074/head\076\n
\n
\074body\076\n
\n
\074h1\076test\074/h1\076\n
\n
\074div id="content" gadget="test_gadgets/A"\076\074/div\076\n
\n
\074script type="text/javascript" language="javascript"\076\n
//\074![CDATA[\n
// init all when DOM is ready\n
$(document).ready(function() {\n
RenderJs.bootstrap($("#content"));\n
// XXX: we use timeouts as we do not know if gadget structure is yet ready, how to do that in a generic way?\n
window.setTimeout(\'RenderJs.update($("#content"));\', DEFAULT_GADGET_DOM_READY_TIMEOUT);\n
});\n
//]]\076\n
\074/script\076\n
\n
\n
\074/body\076\n
\074/html\076
</unicode>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
expand
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
interactions
</string>
</value>
</item>
<item>
<key>
<string>
output_encoding
</string>
</key>
<value>
<string>
iso-8859-15
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<unicode></unicode>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
poc/erp5_gadget_interaction/SkinTemplateItem/portal_skins/erp5_gadget_interaction/interactor.js.xml
0 → 100644
View file @
7b2f48f5
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"File"
module=
"OFS.Image"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<value>
<string>
ts36565830.87
</string>
</value>
</item>
<item>
<key>
<string>
__name__
</string>
</key>
<value>
<string>
interactor.js
</string>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
application/javascript
</string>
</value>
</item>
<item>
<key>
<string>
data
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
// Basic gadget interaction library\n
var InteractionGadget = {\n
\n
bind: function (dom){\n
/*\n
* Bind event between gadgets.\n
*/\n
dom.find("connect").each(function (key, value){\n
source = $(value).attr("source").split(".");\n
source_gadget_id = source[0];\n
source_method_id = source[1];\n
source_gadget = GadgetIndex.getGadgetById(source_gadget_id);\n
\n
destination = $(value).attr("destination").split(".");\n
destination_gadget_id = destination[0];\n
destination_method_id = destination[1];\n
destination_gadget = GadgetIndex.getGadgetById(destination_gadget_id);\n
\n
if (source_gadget.hasOwnProperty(source_method_id)){\n
// direct javascript use case\n
func_body = \'GadgetIndex.getGadgetById("\' + source_gadget_id + \'")["original_\' + source_method_id + \'"]();\';\n
func_body = func_body + \'\\nGadgetIndex.getGadgetById("\' + destination_gadget_id + \'")["\' + destination_method_id + \'"]();\';\n
func = new Function(func_body);\n
source_gadget["original_" + source_method_id] = source_gadget[source_method_id];\n
source_gadget[source_method_id] = func;\n
}\n
else{\n
// this is a custom event attached to HTML gadget representation\n
func_body = \'GadgetIndex.getGadgetById("\' + destination_gadget_id + \'")["\' + destination_method_id + \'"]();\';\n
func = new Function(func_body);\n
source_gadget.dom.bind(source_method_id, func);\n
}\n
console.log(source_gadget_id, \'.\', source_method_id, \'-->
\', destination_gadget_id, \'.\', destination_method_id);\n
}\n
);\n
}\n
\n
}
]]>
</string>
</value>
</item>
<item>
<key>
<string>
precondition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
size
</string>
</key>
<value>
<int>
1590
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
poc/erp5_gadget_interaction/SkinTemplateItem/portal_skins/erp5_gadget_interaction/test_gadgets.xml
0 → 100644
View file @
7b2f48f5
<?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>
test_gadgets
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
poc/erp5_gadget_interaction/SkinTemplateItem/portal_skins/erp5_gadget_interaction/test_gadgets/A.xml
0 → 100644
View file @
7b2f48f5
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ZopePageTemplate"
module=
"Products.PageTemplates.ZopePageTemplate"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<unicode>
\074div gadget="" id="main-interactor"\076\n
\074connect source="B.jsCall1" destination="C.jsCall1"\076\074/connect\076\n
\074connect source="B.htmlEvent1" destination="C.htmlEvent1"\076\074/connect\076\n
\074connect source="B.htmlEvent2" destination="C.htmlEvent2"\076\074/connect\076\n
\074connect source="C.jsCall2" destination="B.jsCall2"\076\074/connect\076\n
\074/div\076\n
\n
\074div gadget="test_gadgets/B" id="B"\076\074/div\076\n
\074div gadget="test_gadgets/C" id="C"\076\074/div\076\n
\n
\074script type="text/javascript" language="javascript"\076\n
//\074![CDATA[\n
$(document).ready(function() {\n
window.setTimeout(\'InteractionGadget.bind($("#main-interactor"));\', DEFAULT_GADGET_DOM_READY_TIMEOUT); \n
});\n
//]]\076\n
\074/script\076\n
\n
\074!-- Adsafe test --\076\n
\074!--\074div id="WIDGETNAME_"\076\n
Adsafe\n
\074script type="text/javascript" language="javascript"\076\n
ADSAFE.go("WIDGETNAME_", function (dom) {\n
"use strict";\n
\n
// This is where the code for the widget is placed. It can access\n
// the document through the dom parameter, allowing it indirect\n
// access to html elements, allowing it to change content, styling,\n
// and behavior.\n
\n
});\n
\074/script\076\n
\074/div\076--\076
</unicode>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
expand
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
A
</string>
</value>
</item>
<item>
<key>
<string>
output_encoding
</string>
</key>
<value>
<string>
iso-8859-15
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<unicode></unicode>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
poc/erp5_gadget_interaction/SkinTemplateItem/portal_skins/erp5_gadget_interaction/test_gadgets/B.xml
0 → 100644
View file @
7b2f48f5
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ZopePageTemplate"
module=
"Products.PageTemplates.ZopePageTemplate"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<unicode>
\074div\076\n
B (gadget)\n
\074button onclick="GadgetIndex.getGadgetById(\'B\').jsCall1()"\076B.jsCall1 -\076 C.jsCall1\074/button\076\n
\074button onclick="$(\'#B\').trigger(\'htmlEvent1\')"\076HTML event 1\074/button\076\n
\074button onclick="$(\'#B\').trigger(\'htmlEvent2\')"\076HTML event 2\074/button\076\n
\074/div\076\n
\n
\074script type="text/javascript" language="javascript"\076\n
//\074![CDATA[\n
$(document).ready(function() {\n
gadget = GadgetIndex.getGadgetById("B");\n
gadget.jsCall1 = function (){alert("B.jscall1");};\n
gadget.jsCall2 = function (){alert("B.jscall2");};\n
});\n
//]]\076\n
\074/script\076
</unicode>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
expand
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
B
</string>
</value>
</item>
<item>
<key>
<string>
output_encoding
</string>
</key>
<value>
<string>
iso-8859-15
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<unicode></unicode>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
poc/erp5_gadget_interaction/SkinTemplateItem/portal_skins/erp5_gadget_interaction/test_gadgets/C.xml
0 → 100644
View file @
7b2f48f5
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ZopePageTemplate"
module=
"Products.PageTemplates.ZopePageTemplate"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<unicode>
\074div\076\n
C (gadget)\n
\074button onclick="GadgetIndex.getGadgetById(\'C\').jsCall2();"\076C.jsCall2 -\076 B.jsCall2\074/button\076\n
\074/div\076\n
\n
\074script type="text/javascript" language="javascript"\076\n
//\074![CDATA[\n
$(document).ready(function() {\n
gadget = GadgetIndex.getGadgetById("C");\n
gadget.jsCall1 = function (){alert("C.jscall1");};\n
gadget.jsCall2 = function (){alert("C.jscall2");};\n
gadget.htmlEvent1 = function (){alert("C.htmlEvent1");};\n
gadget.htmlEvent2 = function (){alert("C.htmlEvent2");};\n
});\n
//]]\076\n
\074/script\076
</unicode>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
expand
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
C
</string>
</value>
</item>
<item>
<key>
<string>
output_encoding
</string>
</key>
<value>
<string>
iso-8859-15
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<unicode></unicode>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
poc/erp5_gadget_interaction/bt/revision
0 → 100644
View file @
7b2f48f5
1
\ No newline at end of file
poc/erp5_gadget_interaction/bt/template_format_version
0 → 100644
View file @
7b2f48f5
1
\ No newline at end of file
poc/erp5_gadget_interaction/bt/template_skin_id_list
0 → 100644
View file @
7b2f48f5
erp5_gadget_interaction
\ No newline at end of file
poc/erp5_gadget_interaction/bt/title
0 → 100644
View file @
7b2f48f5
erp5_gadget_interaction
\ 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