Commit aba7137a authored by Sven Franck's avatar Sven Franck Committed by Eteri

Revert recent afs changes

Revert "erp5_officejs_afs_directory: add missing allow cross domain header"
This reverts commit 2674afaa.

Revert "erp5_officejs_afs_directory: rewrite custom storages and automate openhub data retrieval via proxy"
This reverts commit f74f420e.
parent d2db31d6
import urllib2
import json
github_list_url = "https://api.github.com/repos/Nexedi/awesome-free-software/contents/?ref=master"
openhub_key = "1afe873fd46de2cd79292e00728883e727926a513fbf15f86c62821ba296139b"
def getLatestAnalysesAsXml(url):
if url == None:
raise Exception("No url parameter provided.")
url = url.replace("/languages_summary", ".xml").replace("/p/", "/projects/").replace(" ", "")
response = urllib2.urlopen(url + "?api_key=" + openhub_key)
return response.read()
def isValidProfileUrl(url):
return url is not None and url is not "" and "hub" in url
def getOpenHubUrlList():
item_list = urllib2.urlopen(github_list_url)
json_list = json.loads(item_list.read())
request_list = []
for element in json_list:
if ".json" in element.title:
publisher_profile_request = urllib2.urlopen(element.download_url)
publisher_profile = json.loads(publisher_profile_request.read())
publisher_software_list = publisher_profile.free_software_list
if len(publisher_software_list):
for software in publisher_software_list:
software_profile_url = software.source_code_profile
if isValidProfileUrl(software_profile_url):
if software_profile_url not in request_list:
request_list.append(software_profile_url)
return request_list
def fetchOpenHubProfileListAsXml():
request_list = getOpenHubUrlList()
return request_list
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Extension Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>AfsOpenHub</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>methods for retrieving software profiles on openhub</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>extension.erp5.AfsOpenHub</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Extension Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<global name="Web Script" module="erp5.portal_type"/> <global name="Image" module="erp5.portal_type"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
...@@ -64,22 +64,52 @@ ...@@ -64,22 +64,52 @@
</value> </value>
</item> </item>
<item> <item>
<key> <string>content_md5</string> </key> <key> <string>_count</string> </key>
<value> <value>
<none/> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value> <string>bd1ecafea5249017c0e36104ec9aa556</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>image/png</string> </value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_afs_converter_storage.js</string> </value> <value> <string>gadget_erp5_afs_camera.png</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>Custom AFS converter storage</string> </value> <value>
<none/>
</value>
</item>
<item>
<key> <string>filename</string> </key>
<value> <string>afs_camera.png</string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <int>150</int> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>gadget_erp5_afs_converter_storage_js</string> </value> <value> <string>gadget_erp5_afs_camera_png</string> </value>
</item> </item>
<item> <item>
<key> <string>language</string> </key> <key> <string>language</string> </key>
...@@ -87,7 +117,7 @@ ...@@ -87,7 +117,7 @@
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value> <value> <string>Image</string> </value>
</item> </item>
<item> <item>
<key> <string>short_title</string> </key> <key> <string>short_title</string> </key>
...@@ -97,22 +127,48 @@ ...@@ -97,22 +127,48 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Gadget AFS Converter Storage</string> </value> <value> <string>AFS Camera</string> </value>
</item> </item>
<item> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
<value> <string>001</string> </value> <value> <string>001</string> </value>
</item> </item>
<item>
<key> <string>width</string> </key>
<value> <int>200</int> </value>
</item>
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -125,19 +181,13 @@ ...@@ -125,19 +181,13 @@
<item> <item>
<key> <string>document_publication_workflow</string> </key> <key> <string>document_publication_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
<key> <string>edit_workflow</string> </key> <key> <string>edit_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAc=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -146,7 +196,7 @@ ...@@ -146,7 +196,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="6" aka="AAAAAAAAAAY=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle> </pickle>
...@@ -161,7 +211,7 @@ ...@@ -161,7 +211,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>3</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -183,7 +233,7 @@ ...@@ -183,7 +233,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498657793.17</float> <float>1496061557.92</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
...@@ -199,7 +249,7 @@ ...@@ -199,7 +249,7 @@
</tuple> </tuple>
</pickle> </pickle>
</record> </record>
<record id="4" aka="AAAAAAAAAAQ="> <record id="7" aka="AAAAAAAAAAc=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle> </pickle>
...@@ -214,7 +264,7 @@ ...@@ -214,7 +264,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>3</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -228,7 +278,7 @@ ...@@ -228,7 +278,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.25923.56736.46438</string> </value> <value> <string>959.45174.56579.19421</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,64 +296,7 @@ ...@@ -246,64 +296,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498838738.54</float> <float>1496061545.81</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>converted</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1498657059.06</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -103,97 +103,40 @@ ...@@ -103,97 +103,40 @@
</item> </item>
<item> <item>
<key> <string>text_content</string> </key> <key> <string>text_content</string> </key>
<value> <string>CACHE MANIFEST\n <value> <string encoding="cdata"><![CDATA[
# generated on Wed, 28 Jun 2017 15:50:00 GMT .\n
CACHE MANIFEST\n
# generated on Mon, 30 May 2017 10:00:00 GMT\n
# images/ajax-loader.gif\n # images/ajax-loader.gif\n
CACHE:\n CACHE:\n
font-awesome/font-awesome-webfont.eot?v=4.6.3\n
font-awesome/font-awesome-webfont.eot?#iefix&v=4.6.3\n
font-awesome/font-awesome-webfont.woff?v=4.6.3\n
font-awesome/font-awesome-webfont.ttf?v=4.6.3\n
font-awesome/font-awesome-webfont.svg?v=4.6.3#fontawesomeregular\n
favicon.ico\n
gadget_erp5_afs_camera.png?format=png\n
gadget_erp5_afs_logo.png?format=png\n
URI.js\n URI.js\n
erp5_launcher_nojqm.js\n erp5_launcher_nojqm.js\n
gadget_erp5_nojqm.css\n gadget_erp5_nojqm.css\n
gadget_erp5_editor_panel.html\n gadget_erp5_editor_panel.html\n
gadget_erp5_editor_panel.js\n gadget_erp5_editor_panel.js\n
gadget_erp5_field_checkbox.html\n
gadget_erp5_field_checkbox.js\n
gadget_erp5_field_datetime.html\n
gadget_erp5_field_datetime.js\n
gadget_erp5_field_email.html\n
gadget_erp5_field_email.js\n
gadget_erp5_field_file.html\n
gadget_erp5_field_file.js\n
gadget_erp5_field_float.html\n
gadget_erp5_field_float.js\n
gadget_erp5_field_gadget.html\n
gadget_erp5_field_gadget.js\n
gadget_erp5_field_image.html\n
gadget_erp5_field_image.js\n
gadget_erp5_field_integer.html\n
gadget_erp5_field_integer.js\n
gadget_erp5_field_list.html\n
gadget_erp5_field_list.js\n
gadget_erp5_field_listbox.html\n gadget_erp5_field_listbox.html\n
gadget_erp5_field_listbox.js\n gadget_erp5_field_listbox.js\n
gadget_erp5_field_multicheckbox.html\n
gadget_erp5_field_multicheckbox.js\n
gadget_erp5_field_multilist.html\n
gadget_erp5_field_multilist.js\n
gadget_erp5_field_multirelationstring.html\n
gadget_erp5_field_multirelationstring.js\n
gadget_erp5_field_radio.html\n
gadget_erp5_field_radio.js\n
gadget_erp5_field_readonly.html\n
gadget_erp5_field_readonly.js\n
gadget_erp5_field_relationstring.html\n
gadget_erp5_field_relationstring.js\n
gadget_erp5_field_string.html\n
gadget_erp5_field_string.js\n
gadget_erp5_field_password.html\n
gadget_erp5_field_password.js\n
gadget_erp5_field_textarea.html\n
gadget_erp5_field_textarea.js\n
gadget_erp5_form.html\n gadget_erp5_form.html\n
gadget_erp5_form.js\n gadget_erp5_form.js\n
gadget_erp5_header.html\n gadget_erp5_header.html\n
gadget_erp5_header.js\n gadget_erp5_header.js\n
gadget_erp5_jio.html\n gadget_erp5_global.js\n
gadget_erp5_jio.js\n gadget_erp5_label_field.html\n
gadget_erp5_page_action.html\n gadget_erp5_label_field.js\n
gadget_erp5_page_action.js\n gadget_erp5_notification.html\n
gadget_erp5_page_form.html\n gadget_erp5_notification.js\n
gadget_erp5_page_form.js\n
gadget_erp5_page_front.html\n
gadget_erp5_page_front.js\n
gadget_erp5_page_history.html\n
gadget_erp5_page_history.js\n
gadget_erp5_page_jump.html\n
gadget_erp5_page_jump.js\n
gadget_erp5_page_logout.html\n
gadget_erp5_page_logout.js\n
gadget_erp5_page_preference.html\n
gadget_erp5_page_preference.js\n
gadget_erp5_page_relation_search.html\n
gadget_erp5_page_relation_search.js\n
gadget_erp5_page_search.html\n
gadget_erp5_page_search.js\n
gadget_erp5_page_tab.html\n
gadget_erp5_page_tab.js\n
gadget_erp5_page_worklist.html\n
gadget_erp5_page_worklist.js\n
gadget_erp5_panel.html\n
gadget_erp5_panel.js\n
gadget_erp5_pt_form_dialog.html\n
gadget_erp5_pt_form_dialog.js\n
gadget_erp5_pt_form_list.html\n gadget_erp5_pt_form_list.html\n
gadget_erp5_pt_form_list.js\n gadget_erp5_pt_form_list.js\n
gadget_erp5_pt_form_view.html\n
gadget_erp5_pt_form_view.js\n
gadget_erp5_pt_form_view_editable.html\n
gadget_erp5_pt_form_view_editable.js\n
gadget_erp5_pt_report_view.html\n
gadget_erp5_pt_report_view.js\n
gadget_erp5_router.html\n gadget_erp5_router.html\n
gadget_erp5_router.js\n gadget_erp5_router.js\n
gadget_erp5_relation_input.html\n
gadget_erp5_relation_input.js\n
gadget_erp5_search_editor.html\n gadget_erp5_search_editor.html\n
gadget_erp5_search_editor.js\n gadget_erp5_search_editor.js\n
gadget_erp5_searchfield.html\n gadget_erp5_searchfield.html\n
...@@ -201,7 +144,8 @@ gadget_erp5_searchfield.js\n ...@@ -201,7 +144,8 @@ gadget_erp5_searchfield.js\n
gadget_erp5_sort_editor.html\n gadget_erp5_sort_editor.html\n
gadget_erp5_sort_editor.js\n gadget_erp5_sort_editor.js\n
gadget_global.js\n gadget_global.js\n
gadget_erp5_global.js\n gadget_html5_input.html\n
gadget_html5_input.js\n
gadget_jio.html\n gadget_jio.html\n
gadget_jio.js\n gadget_jio.js\n
gadget_translation.html\n gadget_translation.html\n
...@@ -213,34 +157,35 @@ renderjs.js\n ...@@ -213,34 +157,35 @@ renderjs.js\n
rsvp.js\n rsvp.js\n
# CUSTOM AFS files\n # CUSTOM AFS files\n
gadget_erp5_page_afs_success_case.html\n gadget_erp5_page_afs_success_case.html\n
gadget_erp5_page_afs_publisher.js\n gadget_erp5_page_afs_success_case.js\n
gadget_erp5_page_afs_publisher.html\n gadget_erp5_page_afs_publisher.html\n
gadget_erp5_page_afs_publisher.js\n
gadget_erp5_page_afs_success_case_list.html\n gadget_erp5_page_afs_success_case_list.html\n
gadget_erp5_page_afs_success_case_list.js\n gadget_erp5_page_afs_success_case_list.js\n
gadget_erp5_page_afs_software_list.html\n gadget_erp5_page_afs_publisher_list.html\n
gadget_erp5_page_afs_software_list.js\n gadget_erp5_page_afs_publisher_list.js\n
gadget_erp5_page_afs_publisher_statistic.html\n
gadget_erp5_page_afs_publisher_statistic.js\n
gadget_erp5_page_afs_unsplash.html\n
gadget_erp5_page_afs_unsplash.js\n
gadget_erp5_page_afs_software.html\n gadget_erp5_page_afs_software.html\n
gadget_erp5_page_afs_software.js\n
gadget_erp5_page_afs_directory.html\n gadget_erp5_page_afs_directory.html\n
gadget_erp5_page_afs_directory.js\n gadget_erp5_page_afs_directory.js\n
gadget_erp5_afs_jio.html\n gadget_erp5_afs_jio.html\n
gadget_erp5_afs_jio.js\n
gadget_erp5_afs_panel.html\n gadget_erp5_afs_panel.html\n
gadget_erp5_afs_panel.js\n gadget_erp5_afs_panel.js\n
gadget_erp5_afs_router.html\n gadget_erp5_afs_router.html\n
gadget_erp5_afs_router.js\n gadget_erp5_afs_router.js\n
gadget_erp5_afs_jio.js\n
gadget_erp5_page_afs_success_case.js\n
gadget_erp5_page_afs_publisher_list.html\n
gadget_erp5_page_afs_publisher_list.js\n
gadget_erp5_afs.css\n gadget_erp5_afs.css\n
gadget_erp5_afs_publisher_storage.js\n gadget_erp5_afs_storage.js\n
gadget_erp5_afs_converter_storage.js\n gadget_erp5_page_afs_software_list.html\n
gadget_erp5_page_afs_software.js\n gadget_erp5_page_afs_software_list.js\n
gadget_erp5_page_afs_unsplash.js\n
gadget_erp5_page_afs_unsplash.html\n
gadget_erp5_page_afs_publisher_statistic.js\n
gadget_erp5_page_afs_publisher_statistic.html\n
NETWORK:\n NETWORK:\n
*</string> </value> *
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
...@@ -361,7 +306,7 @@ NETWORK:\n ...@@ -361,7 +306,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>3</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -375,7 +320,7 @@ NETWORK:\n ...@@ -375,7 +320,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.20037.12063.10137</string> </value> <value> <string>959.46970.48446.4744</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -393,7 +338,7 @@ NETWORK:\n ...@@ -393,7 +338,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498657850.06</float> <float>1496169745.29</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*jslint indent: 2, nomen: true, maxlen: 80*/
/*global window, jIO, RSVP, DOMParser, Object */
(function (window, jIO, RSVP, DOMParser, Object) {
"use strict";
// XXX Bad proxy!
var LOC = 'https://softinst56769.host.vifib.net/erp5/web_site_module/afs/',
ID_LOC = "https://raw.githubusercontent.com/",
ID_PATH = "Nexedi/awesome-free-software/master/",
FETCH = "Software_getAnalysis?url=",
PARSER = new DOMParser();
function garble(str) {
return window.encodeURIComponent(str.replace(/ /g, "-"));
}
function isArray(value) {
return Object.prototype.toString.call(value) === '[object Array]';
}
function isValidCase(success_case) {
return (
success_case !== "N/A" &&
success_case.title !== "" &&
success_case.title !== "N/A"
);
}
// only called on repair, convert publisher storage content into records
// of publishers, software and success cases
function convertDataSet(storage, result_list) {
var response = [];
if (result_list.length === 0) {
return response;
}
return new RSVP.Queue()
.push(function () {
return RSVP.all(result_list.map(function (item) {
return storage.get(item.id);
}));
})
.push(function (publisher_list) {
var publisher,
software_list,
software,
success_case_list,
success_case,
i,
j,
k;
for (i = 0; i < publisher_list.length; i += 1) {
publisher = publisher_list[i];
// XXX parallel promises? title is too unreliable as id
publisher.item_id = result_list[i].id.split("/").pop().split(".")[0];
// add publisher id
response.push({
"id": garble(publisher.item_id),
"value": {}
});
software_list = publisher.free_software_list;
if (isArray(software_list)) {
for (j = 0; j < software_list.length; j += 1) {
software = software_list[j];
// add software id
response.push({
id: garble(publisher.item_id) + "/" + garble(software.title),
value: {}
});
success_case_list = software.success_case_list;
if (isArray(success_case_list)) {
for (k = 0; k < success_case_list.length; k += 1) {
success_case = success_case_list[k];
if (isValidCase(success_case)) {
// add case id
response.push({
id: garble(publisher.item_id) + "/" +
garble(software.title) + "/" +
garble(success_case.title),
value: {}
});
}
}
}
}
}
}
return response;
});
}
function retrieveOpenHubAnalysisTotalLines(software) {
return new RSVP.Queue()
.push(function () {
return jIO.util.ajax({
type: "GET",
url: LOC + FETCH + software.source_code_profile,
dataType: "text"
});
})
.push(function (data) {
var response = data.target.response || data.target.responseText;
return PARSER.parseFromString(response, "text/xml")
.getElementsByTagName("total_code_lines")[0].childNodes[0].nodeValue;
});
}
function isValidProfileUrl(url) {
return url && url !== "" && url.indexOf("hub") > -1;
}
function isInt(value) {
return !isNaN(value) && (function (x) {
if ((x | 0) === x) {
return x;
}
return 0;
})(parseFloat(value));
}
function totalLines(arr) {
return arr.reduce(function (running_total, line) {
return running_total += isInt(line);
}, 0);
}
function retrieveTotalLinesFromPublisher(publisher) {
var unique_software_list = [];
return new RSVP.Queue()
.push(function () {
return RSVP.all(publisher.free_software_list.map(function (software) {
var profile_url = software.source_code_profile;
if (isValidProfileUrl(profile_url)) {
if (unique_software_list.indexOf(profile_url) === -1) {
unique_software_list.push(profile_url);
return retrieveOpenHubAnalysisTotalLines(software);
}
}
}).filter(Boolean));
})
.push(function (line_list) {
return totalLines(line_list);
});
}
function retrieveSuccessCaseFromSoftware(publisher, path_list) {
return publisher.free_software_list.reduce(function (response, software) {
var software_title = garble(software.title);
if (software_title === path_list[1]) {
if (isArray(software.success_case_list)) {
return software.success_case_list.reduce(function (response, item) {
var case_title = garble(item.title);
if (case_title === path_list[2]) {
item.portal_type = "success_case";
item.software = software.title;
item.software_website = software.website;
item.publisher = software.publisher;
item.publisher_website = software.website;
item.category_list = software.category_list;
item.uid = case_title;
return item;
}
return response;
});
}
}
return response;
}, undefined);
}
function retrieveSoftwareFromPublisher(publisher, path_list) {
return publisher.free_software_list.reduce(function (response, software) {
var software_title = garble(software.title);
if (software_title === path_list[1]) {
software.portal_type = "software";
software.publisher = publisher.title;
software.publisher_website = publisher.website;
software.uid = garble(publisher.title) + "/" + software_title;
return software;
}
return response;
}, undefined);
}
// find and assemble single object from publisher entries
function convertDataItem(storage, id) {
var path_list = id.split("/"),
path_len = path_list.length,
publisher;
return new RSVP.Queue()
.push(function () {
return new RSVP.Queue()
.push(function () {
return storage.get(ID_LOC + ID_PATH + path_list[0] + ".json");
})
.push(function (result) {
if (path_len === 1) {
return RSVP.all([
result,
retrieveTotalLinesFromPublisher(result)
]);
}
return [result];
});
})
.push(function (result_list) {
var response;
publisher = result_list[0];
publisher.portal_type = "publisher";
publisher.uid = garble(publisher.title);
publisher.total_lines = result_list[1] || 0;
if (path_len === 1) {
response = publisher;
} else if (path_len === 2) {
response = retrieveSoftwareFromPublisher(publisher, path_list);
} else if (path_len === 3) {
response = retrieveSuccessCaseFromSoftware(publisher, path_list);
}
return response;
})
.push(null, function (error) {
console.log(error);
throw error;
});
}
function ConverterStorage(spec) {
this._sub_storage = jIO.createJIO(spec.sub_storage);
}
ConverterStorage.prototype.get = function (id) {
return convertDataItem(this._sub_storage, id);
};
ConverterStorage.prototype.repair = function () {
return this._sub_storage.repair.apply(this._sub_storage, arguments);
};
ConverterStorage.prototype.hasCapacity = function (name) {
return (name === "list");
};
ConverterStorage.prototype.buildQuery = function () {
var storage = this._sub_storage,
argument_list = arguments;
return new RSVP.Queue()
.push(function () {
return storage.buildQuery.apply(storage, argument_list);
})
.push(function (result) {
return convertDataSet(storage, result);
});
};
jIO.addStorage('converter_storage', ConverterStorage);
}(window, jIO, RSVP, DOMParser, Object));
...@@ -273,34 +273,6 @@ ...@@ -273,34 +273,6 @@
} }
} }
/*
-------------------------------------------------------------------------
------------------------- OPENHUB ATTRIBUTION ---------------------------
-------------------------------------------------------------------------
*/
div[data-gadget-scope='panel'] ul li a:first-child:nth-last-child(2) {
display: inline-block;
width: 62%;
vertical-align: middle;
}
div[data-gadget-scope='panel'] ul li a:first-child:nth-last-child(2) ~ a {
display: inline-block;
width: 33%;
vertical-align: middle;
margin: 0;
padding: 0;
}
div[data-gadget-scope='panel'] ul li a:first-child:nth-last-child(2) ~ a img {
height: 100%;
width: 80px;
margin: 0;
padding: 0;
}
div[data-gadget-scope='panel'] ul li a:first-child:nth-last-child(2) ~ a:hover,
div[data-gadget-scope='panel'] ul li a:first-child:nth-last-child(2) ~ a:active {
background-color: inherit;
}
/* /*
------------------------------------------------------------------------- -------------------------------------------------------------------------
-------------------------- UNSPLASH BANNER ------------------------------ -------------------------- UNSPLASH BANNER ------------------------------
...@@ -322,7 +294,7 @@ div[data-gadget-scope='panel'] ul li a:first-child:nth-last-child(2) ~ a:active ...@@ -322,7 +294,7 @@ div[data-gadget-scope='panel'] ul li a:first-child:nth-last-child(2) ~ a:active
.ui-banner-section img { .ui-banner-section img {
/* max-height: 100%; */ /* max-height: 100%; */
max-width: 100%; max-width: 100%;
width: 100%; width: auto;
height: auto; height: auto;
position: absolute; position: absolute;
top: 0; top: 0;
...@@ -336,13 +308,13 @@ div[data-gadget-scope='panel'] ul li a:first-child:nth-last-child(2) ~ a:active ...@@ -336,13 +308,13 @@ div[data-gadget-scope='panel'] ul li a:first-child:nth-last-child(2) ~ a:active
.ui-banner-section span { .ui-banner-section span {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
right: 2em; right: 0;
color: white; color: white;
font-size: small; font-size: small;
padding: 0 .5em .25em 0; padding: 0 .5em .25em 0;
} }
.ui-banner-section span a { .ui-banner-section span a {
color: #fff; color: rgb(153, 153, 153);
} }
.ui-banner-section h1 { .ui-banner-section h1 {
position: absolute; position: absolute;
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.20124.44127.50739</string> </value> <value> <string>959.36825.37639.35106</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498491332.93</float> <float>1495561064.3</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<!Doctype html> <!Doctype html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Jio Gadget</title> <title>Jio Gadget</title>
<script src="rsvp.js"></script> <!-- renderjs -->
<script src="renderjs.js"></script> <script src="rsvp.js" type="text/javascript"></script>
<script src="jiodev.js"></script> <script src="renderjs.js" type="text/javascript"></script>
<script src="jiodev.js" type="text/javascript"></script>
<script src="gadget_erp5_afs_storage.js" type="text/javascript"></script>
<script src="gadget_erp5_afs_jio.js" type="text/javascript"></script>
<script src="gadget_erp5_afs_publisher_storage.js"></script>
<script src="gadget_erp5_afs_converter_storage.js"></script>
<script src="gadget_erp5_afs_jio.js"></script>
</head> </head>
<body> <body>
<div data-gadget-url='gadget_jio.html' data-gadget-scope='jio'></div> <div data-gadget-url='gadget_jio.html' data-gadget-scope='jio'></div>
......
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.24363.10114.40618</string> </value> <value> <string>959.35277.2835.34423</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498744996.96</float> <float>1495467687.67</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Gadget AFS JIO JS</string> </value> <value> <string>Gadget AFS Storage JS</string> </value>
</item> </item>
<item> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>3</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.24361.33104.43502</string> </value> <value> <string>959.45138.58632.4420</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498810373.32</float> <float>1496066128.63</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -218,7 +218,7 @@ ...@@ -218,7 +218,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>3</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.20109.14881.10990</string> </value> <value> <string>959.46970.48446.4744</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498657650.64</float> <float>1496169827.24</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*jslint indent: 2, nomen: true, maxlen: 80*/ /*jslint nomen: true, indent: 2, maxerr: 3 */
/*global window, Node, rJS, Handlebars, RSVP, loopEventListener */ /*global document, window, rJS, Handlebars, RSVP, loopEventListener, Node */
(function (window, Node, rJS, Handlebars, RSVP, loopEventListener) { (function (document, window, rJS, Handlebars, RSVP, loopEventListener, Node) {
"use strict"; "use strict";
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// some variables // temlates
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Precompile templates while loading the first gadget instance
var gadget_klass = rJS(window), var gadget_klass = rJS(window),
source_header = gadget_klass.__template_element source_header = gadget_klass.__template_element
.getElementById("panel-template-header").innerHTML, .getElementById("panel-template-header")
.innerHTML,
panel_template_header = Handlebars.compile(source_header), panel_template_header = Handlebars.compile(source_header),
source_body = gadget_klass.__template_element source_body = gadget_klass.__template_element
.getElementById("panel-template-body").innerHTML, .getElementById("panel-template-body")
.innerHTML,
panel_template_body = Handlebars.compile(source_body); panel_template_body = Handlebars.compile(source_body);
/////////////////////////////////////////////////////////////////
// some methods
/////////////////////////////////////////////////////////////////
function getUrlDict(param) {
return {command: 'display', options: {page: param}};
}
gadget_klass gadget_klass
/////////////////////////////////////////////////////////////////
// state
/////////////////////////////////////////////////////////////////
.setState({ .setState({
visible: false, visible: false,
desktop: false desktop: false
}) })
.onStateChange(function (modification_dict) {
var gadget = this;
if (modification_dict.hasOwnProperty("visible")) {
if (gadget.state.visible) {
if (!gadget.element.classList.contains('visible')) {
gadget.element.classList.toggle('visible');
}
} else {
if (gadget.element.classList.contains('visible')) {
gadget.element.classList.remove('visible');
}
}
}
})
////////////////////////////////////////////// //////////////////////////////////////////////
// acquired methods // acquired method
////////////////////////////////////////////// //////////////////////////////////////////////
.declareAcquiredMethod("translateHtml", "translateHtml")
.declareAcquiredMethod("getUrlFor", "getUrlFor") .declareAcquiredMethod("getUrlFor", "getUrlFor")
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
...@@ -60,7 +37,6 @@ ...@@ -60,7 +37,6 @@
visible: !this.state.visible visible: !this.state.visible
}); });
}) })
.declareMethod('close', function () { .declareMethod('close', function () {
return this.changeState({ return this.changeState({
visible: false visible: false
...@@ -68,69 +44,82 @@ ...@@ -68,69 +44,82 @@
}) })
.declareMethod('render', function () { .declareMethod('render', function () {
var gadget = this; var g = this;
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return RSVP.all([ return RSVP.all([
gadget.getUrlFor(getUrlDict("afs_directory")), g.getUrlFor({command: 'display', options: {page: "afs_directory"}}),
gadget.getUrlFor(getUrlDict("afs_publisher_statistic")), g.getUrlFor({command: 'display', options: {page: "afs_publisher_statistic"}}),
gadget.getUrlFor(getUrlDict("afs_publisher_list")), g.getUrlFor({command: 'display', options: {page: "afs_publisher_list"}}),
gadget.getUrlFor(getUrlDict("afs_software_list")), g.getUrlFor({command: 'display', options: {page: "afs_software_list"}}),
gadget.getUrlFor(getUrlDict("afs_success_case_list")) g.getUrlFor({command: 'display', options: {page: "afs_success_case_list"}})
]); ]);
}) })
.push(function (result_list) { .push(function (all_result) {
var content = panel_template_header();
// XXX: Customize panel header!
content += panel_template_body({ var tmp = panel_template_header() +
"directory_href": result_list[0], panel_template_body({
"publisher_statistic_href": result_list[1], "directory_href": all_result[0],
"publisher_href": result_list[2], "publisher_statistic_href": all_result[1],
"software_href": result_list[3], "publisher_href": all_result[2],
"success_case_href": result_list[4] "software_href": all_result[3],
}); "success_case_href": all_result[4]
});
gadget.element.querySelector("div").innerHTML = content; g.element.querySelector("div").innerHTML = tmp;
}); });
}) })
.onStateChange(function (modification_dict) {
if (modification_dict.hasOwnProperty("visible")) {
if (this.state.visible) {
if (!this.element.classList.contains('visible')) {
this.element.classList.toggle('visible');
}
} else {
if (this.element.classList.contains('visible')) {
this.element.classList.remove('visible');
}
}
}
})
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// declared jobs // declared services
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.declareJob('listenResize', function () { .onEvent('click', function (evt) {
if ((evt.target.nodeType === Node.ELEMENT_NODE) &&
(evt.target.tagName === 'BUTTON')) {
return this.toggle();
}
}, false, false)
// resize should be only trigger after the render method as displaying .declareJob('listenResize', function () {
// the panel rely on external gadget (for translation for example) // resize should be only trigger after the render method
// as displaying the panel rely on external gadget (for translation for example)
var result, var result,
event, event,
context = this; context = this;
function extractSizeAndDispatch() { function extractSizeAndDispatch() {
if (window.matchMedia("(min-width: 85em)").matches) { if (window.matchMedia("(min-width: 85em)").matches) {
return context.changeState({desktop: true}); return context.changeState({
desktop: true
});
} }
return context.changeState({desktop: false}); return context.changeState({
desktop: false
});
} }
result = loopEventListener(window, 'resize', false, result = loopEventListener(window, 'resize', false,
extractSizeAndDispatch); extractSizeAndDispatch);
event = window.document.createEvent("Event"); event = document.createEvent("Event");
event.initEvent('resize', true, true); event.initEvent('resize', true, true);
window.dispatchEvent(event); window.dispatchEvent(event);
return result; return result;
}) })
/////////////////////////////////////////////////////////////////
// event handlers
/////////////////////////////////////////////////////////////////
.onEvent('click', function (evt) {
if ((evt.target.nodeType === Node.ELEMENT_NODE) &&
(evt.target.tagName === 'BUTTON')) {
return this.toggle();
}
}, false, false)
.onEvent('blur', function (evt) { .onEvent('blur', function (evt) {
// XXX Horrible hack to clear the search when focus is lost // XXX Horrible hack to clear the search when focus is lost
// This does not follow renderJS design, as a gadget should not touch // This does not follow renderJS design, as a gadget should not touch
// another gadget content // another gadget content
...@@ -139,4 +128,9 @@ ...@@ -139,4 +128,9 @@
} }
}, true, false); }, true, false);
}(window, Node, rJS, Handlebars, RSVP, loopEventListener)); }(document, window, rJS, Handlebars, RSVP, loopEventListener, Node));
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>3</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.22813.18734.54818</string> </value> <value> <string>959.45262.19816.34594</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498652069.39</float> <float>1496066838.57</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<!Doctype html> <!Doctype html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Router Gadget</title> <title>Router Gadget</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script> <script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script> <script src="renderjs.js" type="text/javascript"></script>
......
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>959.35277.15921.2798</string> </value> <value> <string>953.59501.33025.63675</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498657663.98</float> <float>1495467674.51</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*jslint indent: 2, nomen: true, maxlen: 80*/ /*jslint nomen: true, indent: 2, maxerr: 3 */
/*global window, rJS */ /*global window, rJS */
(function (window, rJS) { (function (window, rJS) {
"use strict"; "use strict";
rJS(window) rJS(window)
/*
.ready(function (g) {
return g.getDeclaredGadget("router")
.push(function (my_default_router) {
return my_default_router.start();
});
})
*/
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// declared methods // declared methods
...@@ -54,4 +62,4 @@ ...@@ -54,4 +62,4 @@
}); });
}); });
}(window, rJS)); }(window, rJS));
\ No newline at end of file
...@@ -220,7 +220,7 @@ ...@@ -220,7 +220,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>3</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.22683.21993.61064</string> </value> <value> <string>959.45017.10197.48298</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498644239.26</float> <float>1496066978.7</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*jslint indent: 2, nomen: true, maxlen: 80*/ /*jslint indent: 2, nomen: true, maxlen: 120*/
/*global jIO, RSVP, JSON */ /*global jIO, RSVP, JSON */
(function (jIO, RSVP, JSON) { (function (jIO, RSVP, JSON) {
"use strict"; "use strict";
var HREF = 'https://api.github.com/repos/', function PublisherStorage(spec) {
USER = 'Nexedi',
REPO = 'awesome-free-software',
BRANCH = '/contents/?ref=master';
function fetchUrl(option_dict) { // NOTE: requires Website Layout Configuration CSP modification
return new RSVP.Queue() // => connect-src 'self' https://raw.githubusercontent.com https://api.github.com data:;
.push(function () {
return jIO.util.ajax(option_dict);
})
.push(function (data) {
return JSON.parse(data.target.response || data.target.responseText);
});
}
function PublisherStorage(spec) { //https://api.github.com/repos/Nexedi/awesome-free-software
this._href = spec.href || HREF; //https://api.github.com/repos/Nexedi/awesome-free-software/contents/?ref=master
this._user = spec.user || USER; //https://api.github.com/repos/Nexedi/awesome-free-software/contents/alfresco.json
this._repo = spec.repo || REPO; //https://raw.githubusercontent.com/Nexedi/awesome-free-software/master/alfresco.json
this._branch = spec.branch || BRANCH;
this._url = this._href + this._user + '/' + this._repo + this._branch; this._href = spec.href || 'https://api.github.com/repos/';
this._user = spec.user || 'Nexedi';
this._repo = spec.repo || 'awesome-free-software';
} }
PublisherStorage.prototype.get = function (id) { PublisherStorage.prototype.get = function (id) {
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return fetchUrl({type: "GET", url: id, dataType: "text"}); return jIO.util.ajax({type: "GET", url: id, dataType: "text"});
}) })
.push(undefined, function (error) { .push(
if ((error.target !== undefined) && (error.target.status === 404)) { function (response) {
throw new jIO.util.jIOError("Cannot find document", 404); return JSON.parse(response.target.response || response.target.responseText);
},
function (error) {
if ((error.target !== undefined) &&
(error.target.status === 404)) {
throw new jIO.util.jIOError("Cannot find document", 404);
}
throw error;
} }
throw error; );
});
}; };
PublisherStorage.prototype.hasCapacity = function (name) { PublisherStorage.prototype.hasCapacity = function (name) {
...@@ -44,18 +42,20 @@ ...@@ -44,18 +42,20 @@
}; };
PublisherStorage.prototype.buildQuery = function () { PublisherStorage.prototype.buildQuery = function () {
var url = this._url; var url = this._href + this._user + '/' + this._repo + '/contents/?ref=master';
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return fetchUrl({"type": "GET", "url": url}); return jIO.util.ajax({"type": "GET", "url": url});
}) })
.push(function (data_list) { .push(function (data) {
var result_list = [], var data_list = JSON.parse(data.target.response || data.target.responseText),
len = data_list.length, result_list = [],
data_entry, data_entry,
len,
i; i;
for (i = 0; i < len; i += 1) { for (i = 0, len = data_list.length; i < len; i += 1) {
data_entry = data_list[i]; data_entry = data_list[i];
if (data_entry.path.indexOf(".json") > -1) { if (data_entry.path.indexOf(".json") > -1) {
result_list.push({ result_list.push({
...@@ -70,4 +70,4 @@ ...@@ -70,4 +70,4 @@
jIO.addStorage('publisher_storage', PublisherStorage); jIO.addStorage('publisher_storage', PublisherStorage);
}(jIO, RSVP, JSON)); }(jIO, RSVP, JSON));
\ No newline at end of file
...@@ -71,15 +71,15 @@ ...@@ -71,15 +71,15 @@
</item> </item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_afs_publisher_storage.js</string> </value> <value> <string>gadget_erp5_afs_storage.js</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>Custom AFS publisher storage</string> </value> <value> <string>Custom AFS storage</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>gadget_erp5_afs_publisher_storage_js</string> </value> <value> <string>gadget_erp5_afs_storage_js</string> </value>
</item> </item>
<item> <item>
<key> <string>language</string> </key> <key> <string>language</string> </key>
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Gadget AFS Publisher Storage</string> </value> <value> <string>Gadget AFS Storage</string> </value>
</item> </item>
<item> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>3</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.24382.2075.20667</string> </value> <value> <string>959.45095.9318.10888</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498746700.08</float> <float>1496056764.06</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<!Doctype html> <!Doctype html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Free Software Publisher Directory</title> <title>Free Software Publisher Directory</title>
<link rel="stylesheet" href="gadget_erp5_afs.css" type="text/css" /> <link rel="stylesheet" href="gadget_erp5_afs.css" type="text/css" />
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script> <script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script> <script src="renderjs.js" type="text/javascript"></script>
<script src="handlebars.js" type="text/javascript"></script> <script src="handlebars.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_global.js" type="text/javascript"></script>
<script src="gadget_erp5_page_afs_directory.js" type="text/javascript"></script> <script src="gadget_erp5_page_afs_directory.js" type="text/javascript"></script>
<!-- templates --> <!-- templates -->
<script id="frontpage-template" type="text/x-handlebars-template"> <script id="frontpage-template" type="text/x-handlebars-template">
<ul class="grid-items"> <ul class="grid-items">
...@@ -28,8 +33,8 @@ ...@@ -28,8 +33,8 @@
<section class="ui-content-section ui-body-c"> <section class="ui-content-section ui-body-c">
<h1>{{category}}</h1> <h1>{{category}}</h1>
<ul> <ul>
{{#each software_list}} {{#each softwares}}
<li><a href="{{href}}">{{title}}</a></li> <li><a href="{{value.href}}">{{value.title}}</a></li>
{{/each}} {{/each}}
</ul> </ul>
</section> </section>
......
...@@ -218,7 +218,7 @@ ...@@ -218,7 +218,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>3</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.20029.51205.49066</string> </value> <value> <string>959.46970.48446.4744</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498657596.37</float> <float>1496169875.85</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*global window, rJS, RSVP, Handlebars, jIO, document */ /*global window, rJS, RSVP, Handlebars, URI, console, jIO, document */
/*jslint indent: 2, nomen: true, maxlen: 80*/ /*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, Handlebars, document) {
"use strict";
///////////////////////////////////////////////////////////////// (function (window, rJS, RSVP, Handlebars, URI, document) {
// some varables "use strict";
/////////////////////////////////////////////////////////////////
var VIEW = "?page=afs_software&view=view",
gadget_klass = rJS(window), var gadget_klass = rJS(window),
templater = gadget_klass.__template_element, templater = gadget_klass.__template_element,
source = templater.getElementById("frontpage-template").innerHTML, source = templater.getElementById("frontpage-template")
.innerHTML,
template = Handlebars.compile(source); template = Handlebars.compile(source);
Handlebars.registerPartial( Handlebars.registerPartial(
"list-partial", "list-partial",
templater.getElementById("list-partial").innerHTML templater.getElementById("list-partial").innerHTML
); );
gadget_klass gadget_klass
/////////////////////////////////////////////////////////////////
// acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("updateHeader", "updateHeader") .declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs") .declareAcquiredMethod("jio_allDocs", "jio_allDocs")
...@@ -31,7 +23,9 @@ ...@@ -31,7 +23,9 @@
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.declareMethod("render", function () { .declareMethod("render", function () {
var gadget = this, var gadget = this,
grid = gadget.element.querySelector('.ui-masonry-container'); masonry_container = gadget.element.querySelector(
'.ui-masonry-container'
);
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
...@@ -42,64 +36,67 @@ ...@@ -42,64 +36,67 @@
}) })
]); ]);
}) })
.push(function (result_list) { .push(function (my_response_list) {
return result_list[0].render(); return RSVP.all([
gadget.jio_allDocs({
select_list: ['category_list'],
query: 'portal_type:"software"'
}),
my_response_list[0].render()
]);
}) })
.push(function (html_content) { .push(function (my_response_list) {
var banner = document.createRange() var softwares = my_response_list[0].data.rows,
.createContextualFragment(html_content || ""); obj,
gadget.element.insertBefore(banner, grid); // get categories and flatten array of category arrays
return gadget.jio_allDocs({ categories = softwares
select_list: ['category_list', 'title', 'publisher'], .map((obj) => obj.value.category_list)
query: 'portal_type:"software"' .reduce((cur, prev) => cur.concat(prev)),
});
}) // remove duplicates (case sensitive!)
.push(function (result_list) { unique_categories = Array.from(new Set(categories)),
var software_list = result_list.data.rows,
global_category_list = [], // kudos: https://davidwalsh.name/convert-html-stings-dom-nodes
config; banner = document.createRange()
.createContextualFragment(my_response_list[1] || "");
// list of unique list of categories gadget.element.insertBefore(banner, masonry_container);
if (software_list.length > 0) {
global_category_list = software_list.reduce(function (list, dict) {
var software = dict.value;
if (software.category_list.length > 0) {
software.category_list.map(function (category) {
if (list.indexOf(category) === -1) {
list.push(category);
}
});
}
return list;
}, []);
}
// populate list with software return RSVP.all(unique_categories);
config = global_category_list.reduce(function (result, category) { })
var category_entry = {"category": category, "software_list": []}, .push(function (categories) {
len = software_list.length, var softwares_by_category = categories.map(function (category) {
match_list, return gadget.jio_allDocs({
software, select_list: [
i; 'title',
'publisher',
'logo'
],
query: 'category_list:"%' + category + '%" AND portal_type:"software"'
})
.push(function (softwares) {
softwares.data.rows.map(function (sw) {
// XXX hardcoded page and view
sw.value.href = "#/" + sw.id + "?page=afs_software&view=view";
});
return {
category: category,
softwares: softwares.data.rows
};
});
});
return RSVP.all(softwares_by_category);
})
.push(function (result) {
var content;
for (i = 0; i < len; i += 1) { // reverse sort categories by number of softwares
software = software_list[i].value; result.sort( (a, b) => b.softwares.length - a.softwares.length );
match_list = software.category_list;
if (match_list && match_list.length > 0) {
if (match_list.indexOf(category) > -1) {
category_entry.software_list.push({
"title": software.title,
"href": "#/" + software_list[i].id + VIEW
});
}
}
}
result.push(category_entry);
return result;
}, []);
grid.innerHTML = template(config); content = template(result);
masonry_container.innerHTML = content;
}); });
}); });
}(window, rJS, RSVP, Handlebars, document)); }(window, rJS, RSVP, Handlebars, URI, document));
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>3</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.25451.60616.27306</string> </value> <value> <string>959.46981.52420.64187</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498812651.17</float> <float>1496170069.03</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>959.35276.32069.1399</string> </value> <value> <string>954.58644.17552.59852</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498657508.03</float> <float>1495467629.29</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>3</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.22633.10127.42069</string> </value> <value> <string>959.45186.37882.22272</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498641220.3</float> <float>1496067089.61</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<!Doctype html> <!Doctype html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Success Stories</title> <title>Success Stories</title>
<link rel="stylesheet" href="gadget_erp5_afs.css" /> <link rel="stylesheet" href="gadget_erp5_afs.css" />
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
<script src="renderjs.js" type="text/javascript"></script> <script src="renderjs.js" type="text/javascript"></script>
<script src="handlebars.js" type="text/javascript"></script> <script src="handlebars.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_global.js" type="text/javascript"></script>
<script src="gadget_erp5_page_afs_publisher_list.js" type="text/javascript"></script> <script src="gadget_erp5_page_afs_publisher_list.js" type="text/javascript"></script>
</head> </head>
......
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>959.35277.24112.56320</string> </value> <value> <string>959.35275.11438.17476</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498657681.41</float> <float>1495467682.0</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*globals window, RSVP, rJS*/ /*globals window, RSVP, rJS*/
/*jslint indent: 2, nomen: true, maxlen: 80*/ /*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, RSVP, rJS) { (function (window, RSVP, rJS) {
"use strict"; "use strict";
/////////////////////////////////////////////////////////////////
// some parameters
/////////////////////////////////////////////////////////////////
var STR = "",
QUERY = 'urn:jio:allDocs?query=' + 'portal_type:' + '"publisher"',
SORT = 'field_listbox_sort_list:json',
COLUMN_LIST = [
['title', 'Title'],
['country', 'Country'],
['founded_year', 'Founded'],
['presence', 'Presence']
];
rJS(window) rJS(window)
.declareAcquiredMethod("translate", "translate")
///////////////////////////////////////////////////////////////// .declareAcquiredMethod("getUrlFor", "getUrlFor")
// acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("getUrlParameter", "getUrlParameter") .declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("updateHeader", "updateHeader") .declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
/////////////////////////////////////////////////////////////////
// published methods
/////////////////////////////////////////////////////////////////
.allowPublicAcquisition('updateHeader', function () { .allowPublicAcquisition('updateHeader', function () {
return; return;
}) })
.allowPublicAcquisition('getUrlParameter', function (argument_list) { .allowPublicAcquisition('getUrlParameter', function (argument_list) {
return this.getUrlParameter(argument_list) return this.getUrlParameter(argument_list)
.push(function (result) { .push(function (result) {
if ((result === undefined) && (argument_list[0] === SORT)) { if ((result === undefined) &&
(argument_list[0] === 'field_listbox_sort_list:json')) {
return [['title', 'ascending']]; return [['title', 'ascending']];
} }
return result; return result;
}); });
}) })
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function () { .declareMethod("render", function () {
var gadget = this; var gadget = this;
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return RSVP.all([ return gadget.updateHeader({
gadget.updateHeader({page_title: "Publisher List"}), page_title: "Publisher List"
gadget.getDeclaredGadget("form_list") });
]); })
.push(function () {
return gadget.getDeclaredGadget("form_list");
}) })
.push(function (result_list) { .push(function (form_gadget) {
return result_list[1].render({ var column_list = [
erp5_document: { //['logo', 'Logo'],
"_embedded": { ['title', 'Title'],
"_view": { ['country', 'Country'],
"listbox": { ['founded_year', 'Founded'],
"column_list": COLUMN_LIST, ['presence', 'Presence']
"show_anchor": 0, ];
"default_params": {},
"editable": 0, return form_gadget.render({
"key": "field_listbox", erp5_document: {"_embedded": {"_view": {
"lines": 20, "listbox": {
"list_method": "portal_catalog", "column_list": column_list,
"query": QUERY, "show_anchor": 0,
"portal_type": [], "default_params": {},
"search_column_list": COLUMN_LIST, "editable": 0,
"sort_column_list": COLUMN_LIST, "key": "field_listbox",
"sort_on": ["title", "ascending"], "lines": 20,
"title": "Documents", "list_method": "portal_catalog",
"type": "ListBox" "query": 'urn:jio:allDocs?query=' + 'portal_type:' +
} '"publisher"',
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
"sort_on": ["title", "ascending"],
"title": "Documents",
"type": "ListBox"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
} }
}
}, },
"_links": {"type": {name: STR}}
},
form_definition: { form_definition: {
group_list: [ group_list: [
["bottom", [["listbox"]]], [
["hidden", ["listbox_modification_date"]] "bottom",
[["listbox"]]
],
[
"hidden",
["listbox_modification_date"]
]
] ]
} }
}); });
}); });
}); });
}(window, RSVP, rJS));
}(window, RSVP, rJS)); \ No newline at end of file
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>3</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.22649.27783.51</string> </value> <value> <string>959.45151.41449.24985</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498642539.62</float> <float>1496067110.92</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -4,12 +4,15 @@ ...@@ -4,12 +4,15 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Free Software Publisher Statistics</title> <title>Free Software Publisher Statistics</title>
<link rel="stylesheet" href="gadget_erp5_afs.css" /> <link rel="stylesheet" href="gadget_erp5_afs.css" />
<script src="rsvp.js"></script> <script src="rsvp.js"></script>
<script src="renderjs.js"></script> <script src="renderjs.js"></script>
<script src="gadget_global.js"></script>
<script src="gadget_erp5_page_afs_publisher_statistic.js"></script> <script src="gadget_erp5_page_afs_publisher_statistic.js"></script>
</head> </head>
<body> <body>
<div data-gadget-url="gadget_erp5_pt_form_list.html" <div data-gadget-url="gadget_erp5_pt_form_list.html"
......
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.22902.49514.45755</string> </value> <value> <string>959.36392.63010.46540</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498657408.74</float> <float>1496073513.05</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -3,32 +3,23 @@ ...@@ -3,32 +3,23 @@
(function (window, RSVP, rJS) { (function (window, RSVP, rJS) {
"use strict"; "use strict";
///////////////////////////////////////////////////////////////// var SORT_STRING = 'field_listbox_sort_list:json';
// some parameters
/////////////////////////////////////////////////////////////////
var STR = "",
QUERY = 'urn:jio:allDocs?query=' + 'portal_type:"publisher"',
SORT = 'field_listbox_sort_list:json',
COLUMN_LIST = [
['title', 'Title'],
['country', 'Country'],
['total_lines', 'Total Lines of Code']
],
SORT_LIST = [
['total_lines', 'Total Lines of Code']
];
rJS(window) rJS(window)
.ready(function (g) {
g.props = {};
return g.getElement()
.push(function (element) {
g.props.element = element;
});
})
///////////////////////////////////////////////////////////////// .declareAcquiredMethod("translate", "translate")
// acquired methods .declareAcquiredMethod("getUrlFor", "getUrlFor")
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("getUrlParameter", "getUrlParameter") .declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("updateHeader", "updateHeader") .declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
/////////////////////////////////////////////////////////////////
// published methods
/////////////////////////////////////////////////////////////////
.allowPublicAcquisition('updateHeader', function () { .allowPublicAcquisition('updateHeader', function () {
return; return;
}) })
...@@ -36,50 +27,60 @@ ...@@ -36,50 +27,60 @@
.allowPublicAcquisition('getUrlParameter', function (argument_list) { .allowPublicAcquisition('getUrlParameter', function (argument_list) {
return this.getUrlParameter(argument_list) return this.getUrlParameter(argument_list)
.push(function (result) { .push(function (result) {
if ((result === undefined) && (argument_list[0] === SORT)) { if ((result === undefined) && (argument_list[0] === SORT_STRING)) {
return [['title', 'ascending']]; return [['lines', 'descending']];
} }
return result; return result;
}); });
}) })
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function () { .declareMethod("render", function () {
var gadget = this; var gadget = this;
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return RSVP.all([ return gadget.updateHeader({
gadget.updateHeader({page_title: "Statistics"}), page_title: "Statistics"
gadget.getDeclaredGadget("form_list") });
]);
}) })
.push(function (result_list) { .push(function () {
return result_list[1].render({ return gadget.getDeclaredGadget("form_list");
erp5_document: { })
"_embedded": { .push(function (form_gadget) {
"_view": { var column_list = [
"listbox": { ['title', 'Title'],
"column_list": COLUMN_LIST, ['country', 'Country'],
"show_anchor": 0, ['lines', 'Total Lines of Code']
"default_params": {}, ],
"editable": 0, sort_column_list = [
"key": "field_listbox", ['lines', 'Total Lines of Code']
"lines": 20, ];
"list_method": "portal_catalog",
"query": QUERY, return form_gadget.render({
"portal_type": [], erp5_document: {"_embedded": {"_view": {
"search_column_list": COLUMN_LIST, "listbox": {
"sort_column_list": SORT_LIST, "column_list": column_list,
"sort_on": ["total_lines", "descending"], "show_anchor": 0,
"title": "Documents", "default_params": {},
"type": "ListBox" "editable": 0,
} "key": "field_listbox",
"lines": 20,
"list_method": "portal_catalog",
"query": 'urn:jio:allDocs?query=' + 'portal_type:"publisher"',
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": sort_column_list,
"sort_on": ["lines", "descending"],
"title": "Documents",
"type": "ListBox"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
} }
}
}, },
"_links": {"type": {name: STR}}
},
form_definition: { form_definition: {
group_list: [ group_list: [
["bottom", [["listbox"]]], ["bottom", [["listbox"]]],
...@@ -89,5 +90,4 @@ ...@@ -89,5 +90,4 @@
}); });
}); });
}); });
}(window, RSVP, rJS)); }(window, RSVP, rJS));
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.20090.53630.24883</string> </value> <value> <string>959.45388.59712.6178</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498643289.79</float> <float>1496074387.69</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<!Doctype html> <!Doctype html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Success Story List</title> <title>Success Story List</title>
<link type="text/css" rel="stylesheet" href="gadget_erp5_afs.css" />
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="handlebars.js"></script>
<script src="gadget_erp5_page_afs_software.js"></script> <link type="text/css" rel="stylesheet" href="gadget_erp5_afs.css" />
<script id="display-template" type="text/x-handlebars-template"> <script src="rsvp.js"></script>
<section class="ui-grid-container ui-responsive"> <script src="renderjs.js"></script>
<ul class="grid-elements custom-software-profile"> <script src="handlebars.js"></script>
<li>
{{#if logo}} <script src="gadget_erp5_page_afs_software.js"></script>
<div class="custom-software-profile-image-wrapper"><a href="{{website}}"><img src="{{logo}}"></a></div>
{{/if}} <script id="display-template" type="text/x-handlebars-template">
</li> <section class="ui-grid-container ui-responsive">
<li> <ul class="grid-elements custom-software-profile">
<h1>{{title}}</h1> <li>
{{#if wikipedia_description}} {{#if logo}}
<p>{{wikipedia_description}}</p> <div class="custom-software-profile-image-wrapper"><a href="{{website}}"><img src="{{logo}}"></a></div>
<br/> {{/if}}
{{/if}} </li>
{{#if wikipedia_url}} <li>
<p><a href="{{wikipedia_url}}" class="">Read more on Wikipedia</a></p> <h1>{{title}}</h1>
{{/if}} {{#if wikipedia_description}}
</li> <p>{{wikipedia_description}}</p>
</ul> <br/>
{{/if}}
{{#if wikipedia_url}}
<p><a href="{{wikipedia_url}}" class="">Read more on Wikipedia</a></p>
{{/if}}
</li>
</ul>
<section class="ui-content-header-plain ui-bar-c">
<h3>Software Spec</h3>
</section>
<table class="custom-link-table">
<tbody>
<tr>
<td>Publisher Site</td>
<td><a href="{{publisher_website}}">{{publisher}}</a></td>
</tr>
<tr>
<td>Product Site</td>
<td><a href="{{website}}">{{title}}</a></td>
</tr>
<tr>
<td>Source Code</td>
<td>
{{#if source_code_download}}
<a href="{{source_code_download}}">Download</a>
{{else}}
<a class="ui-disabled" href="">Download</a>
{{/if}}
/
{{#if source_code_profile}}
<a href="{{source_code_profile}}">Profile</a>
{{else}}
<a class="ui-disabled" href="">Profile</a>
{{/if}}
</td>
</tr>
<tr>
<td>Free Software Commercial Support</td>
<td>
{{#if commercial_support}}
<a href="{{commercial_support}}"> Yes</a>
{{#if commercial_support_description}}
<abbr title="{{commercial_support_description}}">(?)</abbr>
{{/if}}
{{else}}
No
{{/if}}
</td>
</tr>
</tbody>
</table>
{{#if success_case_list}}
<section class="ui-content-header-plain ui-bar-c"> <section class="ui-content-header-plain ui-bar-c">
<h3>Software Spec</h3> <h3>Success Stories</h3>
</section> </section>
<table class="custom-link-table"> <ul class="grid-items custom-success-story-list">
<tbody> {{#each success_case_list}}
<tr> <li>
<td>Publisher Site</td> {{#if image}}
<td><a href="{{publisher_website}}">{{publisher}}</a></td> <div class="custom-success-story-image-wrapper {{image_class}}"><a href="{{url}}"><img src="{{image}}" alt></a></div>
</tr> {{else}}
<tr> <div>&nbsp;</div>
<td>Product Site</td> {{/if}}
<td><a href="{{website}}">{{title}}</a></td> <p class="custom-success-story-title">{{title}}</a></p>
</tr> <p class="custom-success-story-description">{{description}} <a href="{{url}}">Read more</a></p>
<tr> <table class="custom-link-table">
<td>Source Code</td> <tbody>
<td> <tr>
{{#if source_code_download}} <td>Categories</td>
<a href="{{source_code_download}}">Download</a> <td>
{{else}} <ul class="custom-success-story-category-list">
<a class="ui-disabled" href="">Download</a> {{#each ../category_list}}
{{/if}} <li>{{this}}</li>
/ {{/each}}
{{#if source_code_profile}} </ul>
<a href="{{source_code_profile}}">Profile</a> </td>
{{else}} </tr>
<a class="ui-disabled" href="">Profile</a> <tr>
{{/if}} <td class="custom-success-story-client">Customer</td>
</td> <td><b>{{customer}}</b></td>
</tr> </tr>
<tr> <tr>
<td>Free Software Commercial Support</td> <td>Industry</td>
<td> <td>{{industry}}</td>
{{#if commercial_support}} </tr>
<a href="{{commercial_support}}"> Yes</a> <tr>
{{#if commercial_support_description}} <td>Country</td>
<abbr title="{{commercial_support_description}}">(?)</abbr> <td>{{country}}</td>
{{/if}} </tr>
{{else}} <tr>
No <td>Language</td>
{{/if}} <td>{{language}}</td>
</td> </tr>
</tr> <tr>
</tbody> <td>Product Site</td>
</table> <td><a href="{{software_website}}">{{software}}</a></td>
</tr>
{{#if success_case_list}} <tr>
<section class="ui-content-header-plain ui-bar-c"> <td>Publisher Site</td>
<h3>Success Stories</h3> <td><a href="{{publisher_website}}">{{publisher}}</a></td>
</section> </tr>
<ul class="grid-items custom-success-story-list"> </tbody>
{{#each success_case_list}} </table>
<li> </li>
{{#if image}} {{/each}}
<div class="custom-success-story-image-wrapper {{image_class}}"><a href="{{url}}"><img src="{{image}}" alt></a></div> </ul>
{{else}} {{/if}}
<div>&nbsp;</div> </section>
{{/if}}
<p class="custom-success-story-title">{{title}}</a></p> </script>
<p class="custom-success-story-description">{{description}} <a href="{{url}}">Read more</a></p>
<table class="custom-link-table">
<tbody>
<tr>
<td>Categories</td>
<td>
<ul class="custom-success-story-category-list">
{{#each ../category_list}}
<li>{{this}}</li>
{{/each}}
</ul>
</td>
</tr>
<tr>
<td class="custom-success-story-client">Customer</td>
<td><b>{{customer}}</b></td>
</tr>
<tr>
<td>Industry</td>
<td>{{industry}}</td>
</tr>
<tr>
<td>Country</td>
<td>{{country}}</td>
</tr>
<tr>
<td>Language</td>
<td>{{language}}</td>
</tr>
<tr>
<td>Product Site</td>
<td><a href="{{software_website}}">{{software}}</a></td>
</tr>
<tr>
<td>Publisher Site</td>
<td><a href="{{publisher_website}}">{{publisher}}</a></td>
</tr>
</tbody>
</table>
</li>
{{/each}}
</ul>
{{/if}}
</section>
</script>
</head> </head>
<body> <body>
<div class="display-widget"></div> <div class="display-widget"></div>
......
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>959.35276.53022.61934</string> </value> <value> <string>955.20609.15320.31283</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498657572.87</float> <float>1495467648.49</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>3</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.22629.43878.37017</string> </value> <value> <string>959.45186.59501.25241</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498641074.59</float> <float>1496067144.61</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<!Doctype html> <!Doctype html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Software</title> <title>Software</title>
<link rel="stylesheet" href="gadget_erp5_afs.css" /> <link rel="stylesheet" href="gadget_erp5_afs.css" />
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
<script src="renderjs.js" type="text/javascript"></script> <script src="renderjs.js" type="text/javascript"></script>
<script src="handlebars.js" type="text/javascript"></script> <script src="handlebars.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_global.js" type="text/javascript"></script>
<script src="gadget_erp5_page_afs_software_list.js" type="text/javascript"></script> <script src="gadget_erp5_page_afs_software_list.js" type="text/javascript"></script>
</head> </head>
......
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>959.35276.45558.8891</string> </value> <value> <string>959.35275.22570.50176</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498657545.3</float> <float>1495467641.69</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*globals window, RSVP, rJS*/ /*globals window, RSVP, rJS*/
/*jslint indent: 2, nomen: true, maxlen: 80*/ /*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, RSVP, rJS) { (function (window, RSVP, rJS) {
"use strict"; "use strict";
/////////////////////////////////////////////////////////////////
// some parameters
/////////////////////////////////////////////////////////////////
var STR = "",
QUERY = 'urn:jio:allDocs?query=portal_type:"software"',
SORT = 'field_listbox_sort_list:json',
COLUMN_LIST = [
['title', 'Title'],
['publisher', 'Publisher'],
['category_list', 'Category']
];
rJS(window) rJS(window)
.declareAcquiredMethod("translate", "translate")
///////////////////////////////////////////////////////////////// .declareAcquiredMethod("getUrlFor", "getUrlFor")
// acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("getUrlParameter", "getUrlParameter") .declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("updateHeader", "updateHeader") .declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
/////////////////////////////////////////////////////////////////
// published methods
/////////////////////////////////////////////////////////////////
.allowPublicAcquisition('updateHeader', function () { .allowPublicAcquisition('updateHeader', function () {
return; return;
}) })
.allowPublicAcquisition('getUrlParameter', function (argument_list) { .allowPublicAcquisition('getUrlParameter', function (argument_list) {
return this.getUrlParameter(argument_list) return this.getUrlParameter(argument_list)
.push(function (result) { .push(function (result) {
if ((result === undefined) && (argument_list[0] === SORT)) { if ((result === undefined) &&
(argument_list[0] === 'field_listbox_sort_list:json')) {
return [['title', 'ascending']]; return [['title', 'ascending']];
} }
return result; return result;
}); });
}) })
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function () { .declareMethod("render", function () {
var gadget = this; var gadget = this;
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return RSVP.all([ return gadget.updateHeader({
gadget.updateHeader({page_title: "Software List"}), page_title: "Software List"
gadget.getDeclaredGadget("form_list") });
]); })
.push(function () {
return gadget.getDeclaredGadget("form_list");
}) })
.push(function (result_list) { .push(function (form_gadget) {
return result_list[1].render({ var column_list = [
erp5_document: { //['logo', 'Logo'],
"_embedded": { ['title', 'Title'],
"_view": { ['publisher', 'Publisher'],
"listbox": { ['category_list', 'Category']
"column_list": COLUMN_LIST, ];
"show_anchor": 0,
"default_params": {}, return form_gadget.render({
"editable": 0, erp5_document: {"_embedded": {"_view": {
"key": "field_listbox", "listbox": {
"lines": 20, "column_list": column_list,
"list_method": "portal_catalog", "show_anchor": 0,
"query": QUERY, "default_params": {},
"portal_type": [], "editable": 0,
"search_column_list": COLUMN_LIST, "key": "field_listbox",
"sort_column_list": COLUMN_LIST, "lines": 20,
"title": "Documents", "list_method": "portal_catalog",
"type": "ListBox" "query": 'urn:jio:allDocs?query=' + 'portal_type:' +
} '"software"',
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
"title": "Documents",
"type": "ListBox"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
} }
}
}, },
"_links": {"type": {name: STR}}
},
form_definition: { form_definition: {
group_list: [ group_list: [
["bottom", [["listbox"]]], [
["hidden", ["listbox_modification_date"]] "bottom",
[["listbox"]]
],
[
"hidden",
["listbox_modification_date"]
]
] ]
} }
}); });
}); });
}); });
}(window, RSVP, rJS)); }(window, RSVP, rJS));
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>3</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.22662.39286.38860</string> </value> <value> <string>959.45114.42947.5734</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498643008.6</float> <float>1496067168.05</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<!Doctype html> <!Doctype html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Success Story</title> <title>Success Story</title>
<link type="text/css" rel="stylesheet" href="gadget_erp5_afs.css" />
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="handlebars.js"></script>
<script src="gadget_erp5_page_afs_success_case.js"></script>
<script id="display-template" type="text/x-handlebars-template"> <script src="rsvp.js"></script>
<section class="ui-grid-container ui-responsive"> <script src="renderjs.js"></script>
<h1>{{title}}</h1> <script src="handlebars.js"></script>
{{#if image}}
<div class="custom-success-story-image-wrapper {{image_class}}"><a href="{{url}}"><img src="{{image}}" alt></a></div>
{{else}}
<div>&nbsp;</div>
{{/if}}
<p class="custom-success-story-description">{{description}} <a href="{{url}}">Read More</a></p>
<table class="custom-link-table"> <link type="text/css" rel="stylesheet" href="gadget_erp5_afs.css" />
<tbody>
<tr>
<td>Categories</td>
<td>
<ul class="custom-success-story-category-list">
{{#each category_list}}
<li>{{this}}</li>
{{/each}}
</ul>
</td>
</tr>
<tr>
<td class="custom-success-story-client">Customer</td>
<td><b>{{customer}}</b></td>
</tr>
<tr>
<td>Industry</td>
<td>{{industry}}</td>
</tr>
<tr>
<td>Country</td>
<td>{{country}}</td>
</tr>
<tr>
<td>Language</td>
<td>{{language}}</td>
</tr>
<tr>
<td>Product Site</td>
<td><a href="{{software_website}}">{{software}}</a></td>
</tr>
<tr>
<td>Publisher Site</td>
<td><a href="{{publisher_website}}">{{publisher}}</a></td>
</tr>
</tbody>
</table>
</section> <script src="gadget_erp5_page_afs_success_case.js"></script>
</script>
<script id="display-template" type="text/x-handlebars-template">
<section class="ui-grid-container ui-responsive">
<h1>{{title}}</h1>
{{#if image}}
<div class="custom-success-story-image-wrapper {{image_class}}"><a href="{{url}}"><img src="{{image}}" alt></a></div>
{{else}}
<div>&nbsp;</div>
{{/if}}
<p class="custom-success-story-description">{{description}} <a href="{{url}}">Read More</a></p>
<table class="custom-link-table">
<tbody>
<tr>
<td>Categories</td>
<td>
<ul class="custom-success-story-category-list">
{{#each category_list}}
<li>{{this}}</li>
{{/each}}
</ul>
</td>
</tr>
<tr>
<td class="custom-success-story-client">Customer</td>
<td><b>{{customer}}</b></td>
</tr>
<tr>
<td>Industry</td>
<td>{{industry}}</td>
</tr>
<tr>
<td>Country</td>
<td>{{country}}</td>
</tr>
<tr>
<td>Language</td>
<td>{{language}}</td>
</tr>
<tr>
<td>Product Site</td>
<td><a href="{{software_website}}">{{software}}</a></td>
</tr>
<tr>
<td>Publisher Site</td>
<td><a href="{{publisher_website}}">{{publisher}}</a></td>
</tr>
</tbody>
</table>
</section>
</script>
</head> </head>
<body> <body>
<div class="display-widget"></div> <div class="display-widget"></div>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>959.35276.22741.45209</string> </value> <value> <string>954.58847.53110.31982</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498657466.07</float> <float>1495467620.79</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -3,114 +3,31 @@ ...@@ -3,114 +3,31 @@
(function (window, RSVP, rJS, Handlebars) { (function (window, RSVP, rJS, Handlebars) {
"use strict"; "use strict";
///////////////////////////////////////////////////////////////// var gadget_klass = rJS(window),
// some parameters
/////////////////////////////////////////////////////////////////
var PLACEHOLDER = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAACWCA" +
"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" +
"uy/EEV+A9Em3PVuGWDlwAAAABJRU5ErkJggg==",
STR = "",
NA = "N/A",
gadget_klass = rJS(window),
templater = gadget_klass.__template_element, templater = gadget_klass.__template_element,
display_widget_table = Handlebars.compile( display_widget_table = Handlebars.compile(
templater.getElementById("display-template").innerHTML templater.getElementById("display-template").innerHTML
); );
rJS(window) rJS(window)
/////////////////////////////////////////////////////////////////
// acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod('updateHeader', 'updateHeader') .declareAcquiredMethod('updateHeader', 'updateHeader')
.declareAcquiredMethod('jio_get', 'jio_get') .declareAcquiredMethod('jio_get', 'jio_get')
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod('render', function (options) { .declareMethod('render', function (options) {
var gadget = this; var gadget = this;
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return gadget.jio_get(options.jio_key); return gadget.jio_get(options.jio_key);
}) })
.push(function (story) { .push(function (story) {
if (story.image === "N/A" || story.image === "") {
if (story.image === NA || story.image === STR) { story.image = 'gadget_erp5_afs_camera.png?format=png';
story.image = PLACEHOLDER;
story.image_class = "custom-placeholder"; story.image_class = "custom-placeholder";
} }
gadget.element.querySelector(".display-widget") gadget.element.querySelector(".display-widget")
.innerHTML = display_widget_table(story); .innerHTML = display_widget_table(story);
return gadget.updateHeader({page_title: story.title}); return gadget.updateHeader({page_title: story.title});
}); });
}); });
}(window, RSVP, rJS, Handlebars));
}(window, RSVP, rJS, Handlebars)); \ No newline at end of file
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>3</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.20616.5429.32785</string> </value> <value> <string>959.45187.8875.24320</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498641401.93</float> <float>1496067187.24</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<!Doctype html> <!Doctype html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Success Case List</title> <title>Success Case List</title>
<link rel="stylesheet" href="gadget_erp5_afs.css" />
<link rel="stylesheet" href="gadget_erp5_afs.css" /> <script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="rsvp.js"></script> <script src="gadget_global.js" ></script>
<script src="renderjs.js"></script> <script src="gadget_erp5_page_afs_success_case_list.js"></script>
<script src="gadget_global.js" ></script>
<script src="gadget_erp5_page_afs_success_case_list.js"></script>
</head> </head>
<body> <body>
......
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498657524.31</float> <float>1495467635.2</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -2,93 +2,85 @@ ...@@ -2,93 +2,85 @@
/*jslint indent: 2, nomen: true, maxlen: 80*/ /*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, RSVP, rJS) { (function (window, RSVP, rJS) {
"use strict"; "use strict";
/////////////////////////////////////////////////////////////////
// some parameters
/////////////////////////////////////////////////////////////////
var STR = "",
QUERY = 'urn:jio:allDocs?query=portal_type:"success_case"',
SORT = 'field_listbox_sort_list:json',
COLUMN_LIST = [
['title', 'Title'],
['software', 'Software'],
['publisher', 'Publisher'],
['industry', 'Industry'],
['category_list', 'Software Categories'],
['customer', 'Customer'],
['country', 'Country'],
['language', 'Language']
];
rJS(window) rJS(window)
.declareAcquiredMethod("translate", "translate")
///////////////////////////////////////////////////////////////// .declareAcquiredMethod("getUrlFor", "getUrlFor")
// acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("getUrlParameter", "getUrlParameter") .declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("updateHeader", "updateHeader") .declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
/////////////////////////////////////////////////////////////////
// published methods
/////////////////////////////////////////////////////////////////
.allowPublicAcquisition('updateHeader', function () { .allowPublicAcquisition('updateHeader', function () {
return; return;
}) })
.allowPublicAcquisition('getUrlParameter', function (argument_list) { .allowPublicAcquisition('getUrlParameter', function (argument_list) {
return this.getUrlParameter(argument_list) return this.getUrlParameter(argument_list)
.push(function (result) { .push(function (result) {
if ((result === undefined) && (argument_list[0] === SORT)) { if ((result === undefined) &&
(argument_list[0] === 'field_listbox_sort_list:json')) {
return [['title', 'ascending']]; return [['title', 'ascending']];
} }
return result; return result;
}); });
}) })
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function () { .declareMethod("render", function () {
var gadget = this; var gadget = this;
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return RSVP.all([ return gadget.updateHeader({
gadget.updateHeader({page_title: "Success Story List"}), page_title: "Success Story List"
gadget.getDeclaredGadget("form_list") });
]);
}) })
.push(function (result_list) { .push(function () {
return result_list[1].render({ return gadget.getDeclaredGadget("form_list");
erp5_document: { })
"_embedded": { .push(function (form_gadget) {
"_view": { var column_list = [
"listbox": { ['title', 'Title'],
"column_list": COLUMN_LIST, ['software', 'Software'],
"show_anchor": 0, ['publisher', 'Publisher'],
"default_params": {}, ['industry', 'Industry'],
"editable": 1, ['category_list', 'Software Categories'],
"editable_column_list": [], ['customer', 'Customer'],
"key": "field_listbox", ['country', 'Country'],
"lines": 20, ['language', 'Language']
"list_method": "portal_catalog", ];
"query": QUERY,
"portal_type": [], return form_gadget.render({
"search_column_list": COLUMN_LIST, erp5_document: {"_embedded": {"_view": {
"sort_column_list": COLUMN_LIST, "listbox": {
"title": "", "column_list": column_list,
"type": "ListBox" "show_anchor": 0,
} "default_params": {},
"editable": 1,
"editable_column_list": [],
"key": "field_listbox",
"lines": 20,
"list_method": "portal_catalog",
"query": 'urn:jio:allDocs?query=portal_type:"success_case"',
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
"title": "",
"type": "ListBox"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
} }
}
}, },
"_links": {"type": {name: STR}}
},
form_definition: { form_definition: {
group_list: [ group_list: [[
["bottom", [["listbox"]]], "bottom",
["hidden", ["listbox_modification_date"]] [["listbox"]]
] ],
["hidden", ["listbox_modification_date"]]]
} }
}); });
}); });
}); });
}(window, RSVP, rJS)); }(window, RSVP, rJS));
\ No newline at end of file
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>3</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.25491.21351.54101</string> </value> <value> <string>959.45122.5485.9130</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498812721.65</float> <float>1496067205.22</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -52,11 +52,11 @@ ...@@ -52,11 +52,11 @@
if (is_response) { if (is_response) {
image_dict = JSON.parse(is_response); image_dict = JSON.parse(is_response);
// I don't need the gadget hooray, just the container, so look away
//gadget.element.innerHTML = //gadget.element.innerHTML =
// I don't need the gadget hooray, just the container, so sorry.
return template({ return template({
"message": "What can Free Software do for you?", "message": "What can Free Software do for you?",
"src": image_dict.urls.regular + UTM, "src": image_dict.urls.full + UTM,
"alt": "Free Software", "alt": "Free Software",
"source_url": image_dict.user.links.html + UTM, "source_url": image_dict.user.links.html + UTM,
"source_title": image_dict.user.name, "source_title": image_dict.user.name,
......
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.19800.9537.42137</string> </value> <value> <string>959.45391.58217.49288</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1498491243.08</float> <float>1496074563.45</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -337,7 +337,7 @@ ...@@ -337,7 +337,7 @@
</item> </item>
<item> <item>
<key> <string>configuration_content_security_policy</string> </key> <key> <string>configuration_content_security_policy</string> </key>
<value> <string>default-src \'self\'; img-src \'self\' https://images.unsplash.com * data:; media-src \'self\' blob:; connect-src \'self\' https://api.unsplash.com https://www.openhub.net https://en.wikipedia.org https://fr.wikipedia.org https://raw.githubusercontent.com https://api.github.com data:; script-src \'self\' \'unsafe-eval\'; font-src \'self\'; style-src \'self\' data:; frame-src \'self\' data:</string> </value> <value> <string>default-src \'self\'; img-src \'self\' https://images.unsplash.com * data:; media-src \'self\' blob:; connect-src \'self\' https://api.unsplash.com https://en.wikipedia.org https://fr.wikipedia.org https://raw.githubusercontent.com https://api.github.com data:; script-src \'self\' \'unsafe-eval\'; font-src \'self\'; style-src \'self\' data:; frame-src \'self\' data:</string> </value>
</item> </item>
<item> <item>
<key> <string>configuration_default_view_action_reference</string> </key> <key> <string>configuration_default_view_action_reference</string> </key>
...@@ -614,7 +614,7 @@ ...@@ -614,7 +614,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>959.31263.27499.6263</string> </value> <value> <string>959.30886.17996.5358</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -632,7 +632,7 @@ ...@@ -632,7 +632,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1497023079.42</float> <float>1495226845.13</float>
<string>UTC</string> <string>UTC</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>_local_properties</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>erp5_officejs_afs</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from Products.ERP5Type.Cache import CachingMethod
if url == None:
raise Exception("No url parameter provided.")
# XXX will only work for instances without authentication
context.REQUEST.response.setHeader("Access-Control-Allow-Origin", "*")
def retrieveOpenhubAnalysis(url):
return context.Software_getOpenHubLatestAnalysis(url)
retrieveOpenhubAnalysis = CachingMethod(
retrieveOpenhubAnalysis,
id="retrieveOpenhubAnalysis",
cache_factory="erp5_content_long"
)
return retrieveOpenhubAnalysis(url)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_params</string> </key>
<value> <string>url=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Software_getAnalysis</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from Products.ERP5Type.Cache import CachingMethod
def retrieveOpenhubAnalysis(url):
return context.Software_getOpenHubLatestAnalysis(url)
retrieveOpenhubAnalysis = CachingMethod(
retrieveOpenhubAnalysis,
id="retrieveOpenhubAnalysis",
cache_factory="erp5_content_long"
)
def retrieveAndStoreOpenHubAnalysisXml():
profile_url_list = context.Software_getAndStoreOpenHubLatestAnalysisList()
for profile_url in profile_url_list:
xml_content = retrieveOpenhubAnalysis(profile_url)
#context.document.newContent(
# portal_type='Embedded File',
# id=profile_url + '.xml',
# file=xml_content,
# filename=profile_url + '.xml'
# language='en'
#)
#context.document.publishAlive()
retrieveAndStoreOpenHubAnalysisXml = CachingMethod(
retrieveAndStoreOpenHubAnalysisXml,
id="retrieveAndStoreOpenHubAnalysisXml",
cache_factory="erp5_content_long"
)
return retrieveAndStoreOpenHubAnalysisXml()
extension.erp5.AfsOpenHub
\ No newline at end of file
web_page_module/gadget_erp5_afs* web_page_module/gadget_erp5_afs*
web_page_module/gadget_erp5_page_afs* web_page_module/gadget_erp5_page_afs*
image_module/gadget_erp5_afs*
web_site_module/afs web_site_module/afs
web_site_module/afs/** web_site_module/afs/**
\ No newline at end of file
image_module/gadget_erp5_afs*
web_page_module/gadget_erp5_afs* web_page_module/gadget_erp5_afs*
web_page_module/gadget_erp5_page_afs* web_page_module/gadget_erp5_page_afs*
web_site_module/afs web_site_module/afs
......
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