Commit f74f420e authored by Sven Franck's avatar Sven Franck

erp5_officejs_afs_directory: rewrite custom storages and automate openhub data retrieval via proxy

parent 2c05c656
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>
...@@ -103,40 +103,97 @@ ...@@ -103,40 +103,97 @@
</item> </item>
<item> <item>
<key> <string>text_content</string> </key> <key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string>CACHE MANIFEST\n
# 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_global.js\n gadget_erp5_jio.html\n
gadget_erp5_label_field.html\n gadget_erp5_jio.js\n
gadget_erp5_label_field.js\n gadget_erp5_page_action.html\n
gadget_erp5_notification.html\n gadget_erp5_page_action.js\n
gadget_erp5_notification.js\n gadget_erp5_page_form.html\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
...@@ -144,8 +201,7 @@ gadget_erp5_searchfield.js\n ...@@ -144,8 +201,7 @@ 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_html5_input.html\n gadget_erp5_global.js\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
...@@ -157,35 +213,34 @@ renderjs.js\n ...@@ -157,35 +213,34 @@ 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_success_case.js\n
gadget_erp5_page_afs_publisher.html\n
gadget_erp5_page_afs_publisher.js\n gadget_erp5_page_afs_publisher.js\n
gadget_erp5_page_afs_publisher.html\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_publisher_list.html\n gadget_erp5_page_afs_software_list.html\n
gadget_erp5_page_afs_publisher_list.js\n gadget_erp5_page_afs_software_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_storage.js\n gadget_erp5_afs_publisher_storage.js\n
gadget_erp5_page_afs_software_list.html\n gadget_erp5_afs_converter_storage.js\n
gadget_erp5_page_afs_software_list.js\n gadget_erp5_page_afs_software.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>
...@@ -306,7 +361,7 @@ NETWORK:\n ...@@ -306,7 +361,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>3</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -320,7 +375,7 @@ NETWORK:\n ...@@ -320,7 +375,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>959.46970.48446.4744</string> </value> <value> <string>960.20037.12063.10137</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -338,7 +393,7 @@ NETWORK:\n ...@@ -338,7 +393,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1496169745.29</float> <float>1498657850.06</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));
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<global name="Image" module="erp5.portal_type"/> <global name="Web Script" module="erp5.portal_type"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
...@@ -63,53 +63,23 @@ ...@@ -63,53 +63,23 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>_count</string> </key>
<value>
<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>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>content_md5</string> </key> <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>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_afs_camera.png</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <value>
<none/> <none/>
</value> </value>
</item> </item>
<item> <item>
<key> <string>filename</string> </key> <key> <string>default_reference</string> </key>
<value> <string>afs_camera.png</string> </value> <value> <string>gadget_erp5_afs_converter_storage.js</string> </value>
</item> </item>
<item> <item>
<key> <string>height</string> </key> <key> <string>description</string> </key>
<value> <int>150</int> </value> <value> <string>Custom AFS converter storage</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>gadget_erp5_afs_camera_png</string> </value> <value> <string>gadget_erp5_afs_converter_storage_js</string> </value>
</item> </item>
<item> <item>
<key> <string>language</string> </key> <key> <string>language</string> </key>
...@@ -117,7 +87,7 @@ ...@@ -117,7 +87,7 @@
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <string>Image</string> </value> <value> <string>Web Script</string> </value>
</item> </item>
<item> <item>
<key> <string>short_title</string> </key> <key> <string>short_title</string> </key>
...@@ -127,48 +97,22 @@ ...@@ -127,48 +97,22 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>AFS Camera</string> </value> <value> <string>Gadget AFS Converter Storage</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">AAAAAAAAAAU=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</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>
...@@ -181,13 +125,19 @@ ...@@ -181,13 +125,19 @@
<item> <item>
<key> <string>document_publication_workflow</string> </key> <key> <string>document_publication_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</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">AAAAAAAAAAc=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</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>
...@@ -196,7 +146,7 @@ ...@@ -196,7 +146,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="6" aka="AAAAAAAAAAY="> <record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle> </pickle>
...@@ -211,7 +161,7 @@ ...@@ -211,7 +161,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>3</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -233,7 +183,7 @@ ...@@ -233,7 +183,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1496061557.92</float> <float>1498657793.17</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
...@@ -249,7 +199,7 @@ ...@@ -249,7 +199,7 @@
</tuple> </tuple>
</pickle> </pickle>
</record> </record>
<record id="7" aka="AAAAAAAAAAc="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle> </pickle>
...@@ -264,7 +214,7 @@ ...@@ -264,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>3</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -278,7 +228,7 @@ ...@@ -278,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>959.45174.56579.19421</string> </value> <value> <string>960.25923.56736.46438</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -296,7 +246,64 @@ ...@@ -296,7 +246,64 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1496061545.81</float> <float>1498838738.54</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>
......
...@@ -273,6 +273,34 @@ ...@@ -273,6 +273,34 @@
} }
} }
/*
-------------------------------------------------------------------------
------------------------- 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 ------------------------------
...@@ -294,7 +322,7 @@ ...@@ -294,7 +322,7 @@
.ui-banner-section img { .ui-banner-section img {
/* max-height: 100%; */ /* max-height: 100%; */
max-width: 100%; max-width: 100%;
width: auto; width: 100%;
height: auto; height: auto;
position: absolute; position: absolute;
top: 0; top: 0;
...@@ -308,13 +336,13 @@ ...@@ -308,13 +336,13 @@
.ui-banner-section span { .ui-banner-section span {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
right: 0; right: 2em;
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: rgb(153, 153, 153); color: #fff;
} }
.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>959.36825.37639.35106</string> </value> <value> <string>960.20124.44127.50739</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>1495561064.3</float> <float>1498491332.93</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -5,15 +5,13 @@ ...@@ -5,15 +5,13 @@
<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>
<!-- renderjs --> <script src="rsvp.js"></script>
<script src="rsvp.js" type="text/javascript"></script> <script src="renderjs.js"></script>
<script src="renderjs.js" type="text/javascript"></script> <script src="jiodev.js"></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>959.35277.2835.34423</string> </value> <value> <string>960.24363.10114.40618</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>1495467687.67</float> <float>1498744996.96</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*global window, rJS, RSVP, /*global window, rJS */
jIO, DOMParser */ /*jslint indent: 2, nomen: true, maxlen: 80*/
/*jslint indent: 2, maxerr: 3, nomen: true */ (function (window, rJS) {
(function (window, rJS, RSVP) {
"use strict"; "use strict";
var DIRTY_OLOH_LOOKUP_UNTIL_API_WORKS = { /////////////////////////////////////////////////////////////////
"https://www.openhub.net/p/alfresco/analyses/latest/languages_summary": 62894263, // some methods
"https://www.openhub.net/p/swift-lang/analyses/latest/languages_summary": 755449, /////////////////////////////////////////////////////////////////
"https://www.openhub.net/p/bluemind/analyses/latest/languages_summary": 857795,
"https://www.openhub.net/p/drupalcommerce/analyses/latest/languages_summary": 49743,
"https://www.openhub.net/p/obm/analyses/latest/languages_summary": 363914,
"https://www.openhub.net/p/linshare/analyses/latest/languages_summary": 185407,
"https://www.openhub.net/p/linid-directory-manager/analyses/latest/languages_summary": 725443,
"https://www.openhub.net/p/openpaas/analyses/latest/languages_summary": 228875,
"https://www.openhub.net/p/magento/analyses/latest/languages_summary": 13507099,
"https://www.openhub.net/p/mariadb/analyses/latest/languages_summary": 3163137,
"https://www.openhub.net/p/vscode/analyses/latest/languages_summary": 106972,
"https://www.openhub.net/p/mongodb/analyses/latest/languages_summary": 1734408,
"https://www.openhub.net/p/erp5/analyses/latest/languages_summary": 11685522,
"https://www.openhub.net/p/SlapOS/analyses/latest/languages_summary": 583328,
"https://www.openhub.net/p/wendelin/analyses/latest/languages_summary": 123904,
"https://www.openhub.net/p/renderjs/analyses/latest/languages_summary": 52261,
"https://www.openhub.net/p/odoo/analyses/latest/languages_summary": 2492373,
"https://www.openhub.net/p/mondrian/analyses/latest/languages_summary": 1319124,
"https://www.openhub.net/p/PrestaShop/analyses/latest/languages_summary": 539680,
"https://www.openhub.net/p/symfony/analyses/latest/languages_summary": 1480506,
"https://www.openhub.net/p/php-twig/analyses/latest/languages_summary": 22572,
"https://www.openhub.net/p/fabpots_Silex/analyses/latest/languages_summary": 11586,
"https://www.openhub.net/p/talend-studio/analyses/latest/languages_summary": 287512,
"https://www.openhub.net/p/xwiki/analyses/latest/languages_summary": 7909332
};
// XXX... lord have mercy // XXX: the two methods below should be inside jiodev
function mockupQueryParam(param, select_list) { function mockupQueryParam(param, select_list) {
var wild_param = param.replace(/[()]/g, "%").replace(/ /g, ''), var wild_param = param.replace(/[()]/g, "%").replace(/ /g, '');
return_list = [], return ' (' + select_list.map(function (key) {
len, return key + ':"' + wild_param + '"';
i; }).join(' OR ') + ')';
for (i = 0, len = select_list.length; i < len; i += 1) {
return_list.push(select_list[i] + ':"' + wild_param + '"');
}
return ' (' + return_list.join(' OR ') + ')';
} }
// XXX... lord, I need more mercy function pimpQuery(option_dict) {
function updateQuery(query, select_list) { var query_param_list = option_dict.query.split("AND"),
var query_param_list = query.split("AND"), query = option_dict.query,
key_list = option_dict.select_list || [],
param, param,
len, len,
i; i;
for (i = 0, len = query_param_list.length; i < len; i += 1) { for (i = 0, len = query_param_list.length; i < len; i += 1) {
param = query_param_list[i]; param = query_param_list[i];
// search // search
if (param.split(":").length !== 2) { if (param.split(":").length !== 2) {
return query.replace(param, mockupQueryParam(param, select_list)); return query.replace(param, mockupQueryParam(param, key_list));
} }
// hide rows // hide rows
...@@ -65,275 +39,73 @@ ...@@ -65,275 +39,73 @@
return query; return query;
} }
function createDataSheets(gadget) { rJS(window)
gadget.jio_allDocs = gadget.state_parameter_dict.jio_storage.allDocs;
gadget.jio_get = gadget.state_parameter_dict.jio_storage.get;
gadget.jio_put = gadget.state_parameter_dict.jio_storage.put;
return gadget.jio_allDocs()
/////////////////////////////////////////////////////////////////
// Make Publisher datasheets
/////////////////////////////////////////////////////////////////
.push(function (data) {
var uid = 0,
publisher_id_list,
promise_list;
/*
function isReplicate(el) {
return (el.id.indexOf("_replicate_") < 0);
}
*/
function setPortalTypeOnPublisher(el) {
return gadget.jio_get(el.id)
.push(function (publisher_object) {
publisher_object.portal_type = "publisher";
//publisher_object.url = publisher_object.website;
uid += 1;
publisher_object.uid = uid.toString();
return gadget.jio_put(publisher_object.uid, publisher_object);
});
}
publisher_id_list = data.data.rows;
promise_list = publisher_id_list.map(setPortalTypeOnPublisher);
return RSVP.all(promise_list);
})
.push(function () {
return gadget.jio_allDocs({
select_list: ['title', 'free_software_list', 'website', 'lines'],
query: 'portal_type: "publisher"'
});
})
/////////////////////////////////////////////////////////////////
// Create Statistic Sheets
/////////////////////////////////////////////////////////////////
.push(function (result_list) {
var publisher_list = result_list.data.rows,
statistic_list = [],
i_len = publisher_list.length,
i;
// OPENHUB LOOKUP?
// curl https://www.openhub.net/projects/{project_id}/analyses/latest.xml
function createStatisticSheet(my_publisher_row) {
var software_list = my_publisher_row.value.free_software_list,
j_len = software_list.length,
profile_url,
software_analysis,
software_analysis_list = [],
j;
for (j = 0; j < j_len; j += 1) {
profile_url = software_list[j].source_code_profile;
if (profile_url && profile_url !== "") {
// more yuck
software_analysis = DIRTY_OLOH_LOOKUP_UNTIL_API_WORKS[profile_url];
delete DIRTY_OLOH_LOOKUP_UNTIL_API_WORKS[profile_url];
//software_analysis = jIO.util.ajax({
// type: "GET",
// "url": profile_url.replace("/languages_summary", ".xml")
//});
// prevent multiple entries into calculation
}
software_analysis_list.push(software_analysis || 0);
}
return new RSVP.Queue()
.push(function () {
return RSVP.all(software_analysis_list);
})
.push(function (my_stat_list) {
var line_total = 0,
k_len = my_stat_list.length,
k;
for (k = 0; k < k_len; k += 1) {
if (my_stat_list[k]) {
// xml = parser.parseFromString(my_stat_list[k],"text/xml");
//line_total += xml.getElementsByTagName("total_code_lines")[0]
// .childNodes[0].nodeValue;
line_total += my_stat_list[k];
}
}
// actually we need to store this...
return new RSVP.Queue()
.push(function () {
return gadget.jio_get(my_publisher_row.id);
})
.push(function (my_publisher) {
my_publisher.lines = line_total;
// my_publisher_row.value.lines = line_total.toString();
return gadget.jio_put(my_publisher.uid, my_publisher);
});
});
}
for (i = 0; i < i_len; i += 1) {
statistic_list.push(createStatisticSheet(publisher_list[i]));
}
return new RSVP.Queue()
.push(function () {
return RSVP.all(statistic_list);
})
.push(function () {
return result_list;
});
})
/////////////////////////////////////////////////////////////////
// Make Software datasheets
/////////////////////////////////////////////////////////////////
.push(function (publisher_list) {
var uid = 2000,
save_software_promise_list,
publishers,
promise_list;
function saveSoftwareListFromPublisher(j) {
var publisher = j.value.title,
software_list = j.value.free_software_list,
website = j.value.website;
function saveSoftwareDocument(software) {
software.portal_type = "software";
software.publisher = publisher;
software.publisher_website = website;
uid += 1;
software.uid = uid.toString();
return gadget.jio_put(software.uid, software);
}
save_software_promise_list = software_list.map(saveSoftwareDocument);
return RSVP.all(save_software_promise_list);
}
publishers = publisher_list.data.rows;
promise_list = publishers.map(saveSoftwareListFromPublisher);
return RSVP.all(promise_list);
})
.push(function () {
return gadget.jio_allDocs({
select_list: [
'title',
'website',
'success_case_list',
'publisher',
'category_list'
],
query: 'portal_type: "software"'
});
})
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Make Success Case datasheets // ready
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.push(function (software_list) {
var uid = 3000,
softwares,
promise_list;
function saveSuccessCaseListFromSoftware(softwareObject) {
var software = softwareObject.value,
publisher = softwareObject.value.publisher,
website = softwareObject.value.website,
success_case_list = softwareObject.value.success_case_list,
save_success_case_promise_list;
function isValid(success_case) {
return (success_case !== "N/A" &&
success_case.title !== "" &&
success_case.title !== "N/A");
}
function addProperties(success_case) {
success_case.portal_type = "success_case";
success_case.software = software.title;
success_case.software_website = software.website;
success_case.publisher = publisher;
success_case.publisher_website = website;
success_case.category_list = software.category_list;
uid += 1;
success_case.uid = uid.toString();
return gadget.jio_put(success_case.uid, success_case);
}
save_success_case_promise_list =
success_case_list.filter(isValid)
.map(addProperties);
return RSVP.all(save_success_case_promise_list);
}
softwares = software_list.data.rows.filter(function (sw) {
return (sw.value.success_case_list !== "N/A");
});
promise_list = softwares.map(saveSuccessCaseListFromSoftware);
return RSVP.all(promise_list);
/*
})
.push(undefined, function (error) {
console.log(error);
*/
});
}
rJS(window)
.ready(function (gadget) { .ready(function (gadget) {
// not so nice...
return gadget.getDeclaredGadget('jio') return gadget.getDeclaredGadget('jio')
.push(function (jio_gadget) { .push(function (jio_gadget) {
// Initialize the gadget local parameters gadget.state_parameter_dict = {"jio_storage": jio_gadget};
gadget.state_parameter_dict = {jio_storage: jio_gadget};
}); });
}) })
/////////////////////////////////////////////////////////////////
// acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod('getSetting', 'getSetting') .declareAcquiredMethod('getSetting', 'getSetting')
.declareAcquiredMethod('redirect', 'redirect') .declareAcquiredMethod('redirect', 'redirect')
.declareAcquiredMethod('getUrlFor', 'getUrlFor') .declareAcquiredMethod('getUrlFor', 'getUrlFor')
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod('createJio', function () { .declareMethod('createJio', function () {
var gadget = this; var gadget = this;
return new RSVP.Queue()
.push(function () { gadget.state_parameter_dict.jio_storage.createJio({
return gadget.state_parameter_dict.jio_storage.createJio({ "type": "replicate",
check_local_modification: false, "check_local_modification": false,
check_local_creation: false, "check_local_creation": false,
check_local_deletion: false, "check_local_deletion": false,
parallel_operation_amount: 100, "local_sub_storage": {
type: "replicate", "type": "query",
local_sub_storage : { "sub_storage": {type: "memory"}
type: "query",
sub_storage: {
type: "memory"
}
}, },
remote_sub_storage : { "remote_sub_storage": {
type: "query", "type": "query",
sub_storage: { "sub_storage": {
"type": "converter_storage",
"sub_storage": {
"type": "replicate",
"check_local_modification": false,
"check_local_creation": false,
"check_local_deletion": false,
"local_sub_storage": {
"type": "query",
"sub_storage": {type: "memory"}
},
"remote_sub_storage": {
"type": "query",
"sub_storage": {
type: "publisher_storage", type: "publisher_storage",
url: "/" url: "/"
} }
} }
}) }
.push(function () { }
return gadget.state_parameter_dict.jio_storage.repair(); }
})
.push(function () {
return createDataSheets(gadget);
});
}); });
return gadget.state_parameter_dict.jio_storage.repair();
}) })
.declareMethod('allDocs', function (option_dict) { .declareMethod('allDocs', function (option_dict) {
option_dict.query = updateQuery(option_dict.query, option_dict.select_list); if (option_dict && option_dict.query) {
option_dict.query = pimpQuery(option_dict);
}
return this.state_parameter_dict.jio_storage.allDocs(option_dict); return this.state_parameter_dict.jio_storage.allDocs(option_dict);
}) })
.declareMethod('getAttachment', function (id, view) { .declareMethod('getAttachment', function (id, view) {
...@@ -348,4 +120,5 @@ ...@@ -348,4 +120,5 @@
.declareMethod('repair', function () { .declareMethod('repair', function () {
return this.state_parameter_dict.jio_storage.repair(); return this.state_parameter_dict.jio_storage.repair();
}); });
}(window, rJS, RSVP));
\ No newline at end of file }(window, rJS));
...@@ -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 Storage JS</string> </value> <value> <string>Gadget AFS JIO 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>zope</string> </value> <value> <string>3</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>959.45138.58632.4420</string> </value> <value> <string>960.24361.33104.43502</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>1496066128.63</float> <float>1498810373.32</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -5,11 +5,12 @@ ...@@ -5,11 +5,12 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Panel</title> <title>Panel</title>
<!-- renderjs --> <script src="rsvp.js"></script>
<script src="rsvp.js" type="text/javascript"></script> <script src="renderjs.js"></script>
<script src="renderjs.js" type="text/javascript"></script> <script src="handlebars.js"></script>
<script src="handlebars.js" type="text/javascript"></script> <script src="gadget_global.js"></script>
<script src="gadget_global.js" type="text/javascript"></script>
<script src="gadget_erp5_afs_panel.js" type="text/javascript"></script>
<script id="panel-template-header" type="text/x-handlebars-template"> <script id="panel-template-header" type="text/x-handlebars-template">
<div data-role="header" class="ui-bar-inherit"> <div data-role="header" class="ui-bar-inherit">
...@@ -19,7 +20,7 @@ ...@@ -19,7 +20,7 @@
</div> </div>
</div> </div>
<div class="panel_img"> <div class="panel_img">
<img class="ui-title" alt="AFS" src="gadget_erp5_afs_logo.png?format=png" /> <img class="ui-title" alt="AFS" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAACWCAYAAABkW7XSAAAZbElEQVR4Xu1de/h21Zi+7xJDJYzOR2lSSCpCxUwoQ0mlIhqdjHOpTDUlRcVIOVQMmhw6Mo6FDiiXKTklIZKkA8ZxGqKMMuN23bW+5vvq977vXmvv/e693/d5rqurP77nWevZ91q/+917redAhAQCgUAgMBAEOBA/w81AIBAIBBCEFZsgEAgEBoNAENZgliocDQQCgSCs2AOBQCAwGASCsAazVOFoIBAIBGHFHggEAoHBIBCENZilCkcDgUAgCCv2QCAQCAwGgSCswSxVOBoIBAJBWLEHAoFAYDAIBGENZqnC0UAgEAjCij0QCAQCg0EgCGswSxWOBgKBQBBW7IFAIBAYDAJBWINZqnA0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zPaTwIfYm6XI8lSQIazxMkrYEcAqAR1YCtDslx3QdYl9JuvTxzEqfCOvKGsFynyBZJ3u9NwssyRUmXlTo0MUkXcm0kgRhTYYp/Yg44ty316Xni5MnKtNwArxT0F5H0pkhMy+9IKyaN2ReJB8wuuTG4EWSz+E+UfggfwawJkl/Wk+UIKyJEN2tkNLF/EPiLwEfyHcpTvVxJsjRJH/YpSPTnrsvhPUuANlxRAmsP6TPwcEmdC6+6JJcrNA1slwwrkQOJlkpzScIqwTeO6tcbJXegncE4OT1acnVAN4P4LRZiFovAa0vhOW2VY4qLpEbc85tSiaYto2kfWp8flxXtf14KrNbUhv+mqEn0Taxpulz8SkAtkn5f67iuUwTY6cxfDblDIYL/N+8vU0thGMvCKvBBY6hAoHOEEhllH1A/6h0UL+2A3rTf2424rdm34K7v6bjBn1Z5P+7NI3PoPzfjwF8D4DPdH8064fouYsVhJWLWOgHAoFAZwgEYXUGfUwcCAQCuQgEYeUiFvqBQCDQGQJBWJ1BHxMHAoFALgJBWLmIhX4gEAh0hkAQVmfQx8SBQCCQi0AQVi5ioR8IBAKdIRCE1Rn0MXEgEAjkIhCElYtY6AcCgUBnCARhdQZ9TBwIBAK5CARh5SIW+oFAINAZAkFYnUEfEwcCgUAuAkFYuYiFfiAQCHSGQBBWZ9DHxIFAIJCLQBBWLmKhHwgEAp0hEITVGfQxcSAQCOQiEISVi1joBwKBQGcIBGF1Bn1MHAgEArkIBGHlIhb6gUAg0BkCQVidQR8TBwKBQC4CfwF3/pAPM93hZgAAAABJRU5ErkJggg==" />
</div> </div>
<!--div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-right"> <!--div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-right">
<div class="ui-controlgroup-controls"> <div class="ui-controlgroup-controls">
...@@ -33,7 +34,10 @@ ...@@ -33,7 +34,10 @@
<div class="ui-content"> <div class="ui-content">
<ul data-role="listview" class="ui-listview" data-enhanced="true"> <ul data-role="listview" class="ui-listview" data-enhanced="true">
<li class="ui-first-child"><a href="{{directory_href}}" class="ui-btn ui-btn-icon-left ui-icon-table" data-i18n="Directory" accesskey="d">Directory</a></li> <li class="ui-first-child"><a href="{{directory_href}}" class="ui-btn ui-btn-icon-left ui-icon-table" data-i18n="Directory" accesskey="d">Directory</a></li>
<li><a href="{{publisher_statistic_href}}" class="ui.btn ui-btn-icon-left ui-icon-trophy" data-i18n="Statistics" accesskey="t">Statistics</a></li> <li>
<a href="{{publisher_statistic_href}}" class="ui.btn ui-btn-icon-left ui-icon-trophy" data-i18n="Statistics" accesskey="t">Statistics</a>
<a href ="https://www.openhub.net"><img src="https://www.openhub.net/images/badges/mini.gif" /></a>
</li>
<li><a href="{{publisher_href}}" class="ui-btn ui-btn-icon-left ui-icon-university" data-i18n="Publishers" accesskey="a">Publishers</a></li> <li><a href="{{publisher_href}}" class="ui-btn ui-btn-icon-left ui-icon-university" data-i18n="Publishers" accesskey="a">Publishers</a></li>
<li><a href="{{software_href}}" class="ui-btn ui-btn-icon-left ui-icon-cube" data-i18n="Software Products" accesskey="p">Software Products</a></li> <li><a href="{{software_href}}" class="ui-btn ui-btn-icon-left ui-icon-cube" data-i18n="Software Products" accesskey="p">Software Products</a></li>
<li class="ui-last-child"><a href="{{success_case_href}}" class="ui-btn ui-btn-icon-left ui-icon-book" data-i18n="Success Cases" accesskey="s">Success Cases</a></li> <li class="ui-last-child"><a href="{{success_case_href}}" class="ui-btn ui-btn-icon-left ui-icon-book" data-i18n="Success Cases" accesskey="s">Success Cases</a></li>
...@@ -66,10 +70,6 @@ ...@@ -66,10 +70,6 @@
</ul> </ul>
</div> </div>
</script> </script>
<!-- custom script -->
<script src="gadget_erp5_afs_panel.js" type="text/javascript"></script>
</head> </head>
<body> <body>
......
...@@ -218,7 +218,7 @@ ...@@ -218,7 +218,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>3</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>959.46970.48446.4744</string> </value> <value> <string>960.20109.14881.10990</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>1496169827.24</float> <float>1498657650.64</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*jslint nomen: true, indent: 2, maxerr: 3 */ /*jslint indent: 2, nomen: true, maxlen: 80*/
/*global document, window, rJS, Handlebars, RSVP, loopEventListener, Node */ /*global window, Node, rJS, Handlebars, RSVP, loopEventListener */
(function (document, window, rJS, Handlebars, RSVP, loopEventListener, Node) { (function (window, Node, rJS, Handlebars, RSVP, loopEventListener) {
"use strict"; "use strict";
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// temlates // some variables
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// 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") .getElementById("panel-template-header").innerHTML,
.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") .getElementById("panel-template-body").innerHTML,
.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 method // acquired methods
////////////////////////////////////////////// //////////////////////////////////////////////
.declareAcquiredMethod("translateHtml", "translateHtml")
.declareAcquiredMethod("getUrlFor", "getUrlFor") .declareAcquiredMethod("getUrlFor", "getUrlFor")
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
...@@ -37,6 +60,7 @@ ...@@ -37,6 +60,7 @@
visible: !this.state.visible visible: !this.state.visible
}); });
}) })
.declareMethod('close', function () { .declareMethod('close', function () {
return this.changeState({ return this.changeState({
visible: false visible: false
...@@ -44,82 +68,69 @@ ...@@ -44,82 +68,69 @@
}) })
.declareMethod('render', function () { .declareMethod('render', function () {
var g = this; var gadget = this;
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return RSVP.all([ return RSVP.all([
g.getUrlFor({command: 'display', options: {page: "afs_directory"}}), gadget.getUrlFor(getUrlDict("afs_directory")),
g.getUrlFor({command: 'display', options: {page: "afs_publisher_statistic"}}), gadget.getUrlFor(getUrlDict("afs_publisher_statistic")),
g.getUrlFor({command: 'display', options: {page: "afs_publisher_list"}}), gadget.getUrlFor(getUrlDict("afs_publisher_list")),
g.getUrlFor({command: 'display', options: {page: "afs_software_list"}}), gadget.getUrlFor(getUrlDict("afs_software_list")),
g.getUrlFor({command: 'display', options: {page: "afs_success_case_list"}}) gadget.getUrlFor(getUrlDict("afs_success_case_list"))
]); ]);
}) })
.push(function (all_result) { .push(function (result_list) {
var content = panel_template_header();
// XXX: Customize panel header!
var tmp = panel_template_header() + content += panel_template_body({
panel_template_body({ "directory_href": result_list[0],
"directory_href": all_result[0], "publisher_statistic_href": result_list[1],
"publisher_statistic_href": all_result[1], "publisher_href": result_list[2],
"publisher_href": all_result[2], "software_href": result_list[3],
"software_href": all_result[3], "success_case_href": result_list[4]
"success_case_href": all_result[4]
}); });
g.element.querySelector("div").innerHTML = tmp;
});
})
.onStateChange(function (modification_dict) { gadget.element.querySelector("div").innerHTML = content;
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 services // declared jobs
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.onEvent('click', function (evt) {
if ((evt.target.nodeType === Node.ELEMENT_NODE) &&
(evt.target.tagName === 'BUTTON')) {
return this.toggle();
}
}, false, false)
.declareJob('listenResize', function () { .declareJob('listenResize', function () {
// resize should be only trigger after the render method
// as displaying 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({ return context.changeState({desktop: true});
desktop: true
});
} }
return context.changeState({ return context.changeState({desktop: false});
desktop: false
});
} }
result = loopEventListener(window, 'resize', false, result = loopEventListener(window, 'resize', false,
extractSizeAndDispatch); extractSizeAndDispatch);
event = document.createEvent("Event"); event = window.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
...@@ -128,9 +139,4 @@ ...@@ -128,9 +139,4 @@
} }
}, true, false); }, true, false);
}(document, window, rJS, Handlebars, RSVP, loopEventListener, Node)); }(window, Node, rJS, Handlebars, RSVP, loopEventListener));
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>3</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>959.45262.19816.34594</string> </value> <value> <string>960.22813.18734.54818</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>1496066838.57</float> <float>1498652069.39</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*jslint indent: 2, nomen: true, maxlen: 120*/ /*jslint indent: 2, nomen: true, maxlen: 80*/
/*global jIO, RSVP, JSON */ /*global jIO, RSVP, JSON */
(function (jIO, RSVP, JSON) { (function (jIO, RSVP, JSON) {
"use strict"; "use strict";
function PublisherStorage(spec) { var HREF = 'https://api.github.com/repos/',
USER = 'Nexedi',
// NOTE: requires Website Layout Configuration CSP modification REPO = 'awesome-free-software',
// => connect-src 'self' https://raw.githubusercontent.com https://api.github.com data:; BRANCH = '/contents/?ref=master';
//https://api.github.com/repos/Nexedi/awesome-free-software function fetchUrl(option_dict) {
//https://api.github.com/repos/Nexedi/awesome-free-software/contents/?ref=master return new RSVP.Queue()
//https://api.github.com/repos/Nexedi/awesome-free-software/contents/alfresco.json .push(function () {
//https://raw.githubusercontent.com/Nexedi/awesome-free-software/master/alfresco.json return jIO.util.ajax(option_dict);
})
.push(function (data) {
return JSON.parse(data.target.response || data.target.responseText);
});
}
this._href = spec.href || 'https://api.github.com/repos/'; function PublisherStorage(spec) {
this._user = spec.user || 'Nexedi'; this._href = spec.href || HREF;
this._repo = spec.repo || 'awesome-free-software'; this._user = spec.user || USER;
this._repo = spec.repo || REPO;
this._branch = spec.branch || BRANCH;
this._url = this._href + this._user + '/' + this._repo + this._branch;
} }
PublisherStorage.prototype.get = function (id) { PublisherStorage.prototype.get = function (id) {
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return jIO.util.ajax({type: "GET", url: id, dataType: "text"}); return fetchUrl({type: "GET", url: id, dataType: "text"});
}) })
.push( .push(undefined, function (error) {
function (response) { if ((error.target !== undefined) && (error.target.status === 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 new jIO.util.jIOError("Cannot find document", 404);
} }
throw error; throw error;
} });
);
}; };
PublisherStorage.prototype.hasCapacity = function (name) { PublisherStorage.prototype.hasCapacity = function (name) {
...@@ -42,20 +44,18 @@ ...@@ -42,20 +44,18 @@
}; };
PublisherStorage.prototype.buildQuery = function () { PublisherStorage.prototype.buildQuery = function () {
var url = this._href + this._user + '/' + this._repo + '/contents/?ref=master'; var url = this._url;
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return jIO.util.ajax({"type": "GET", "url": url}); return fetchUrl({"type": "GET", "url": url});
}) })
.push(function (data) { .push(function (data_list) {
var data_list = JSON.parse(data.target.response || data.target.responseText), var result_list = [],
result_list = [], len = data_list.length,
data_entry, data_entry,
len,
i; i;
for (i = 0, len = data_list.length; i < len; i += 1) { for (i = 0; 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({
......
...@@ -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_storage.js</string> </value> <value> <string>gadget_erp5_afs_publisher_storage.js</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>Custom AFS storage</string> </value> <value> <string>Custom AFS publisher storage</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>gadget_erp5_afs_storage_js</string> </value> <value> <string>gadget_erp5_afs_publisher_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 Storage</string> </value> <value> <string>Gadget AFS Publisher 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>zope</string> </value> <value> <string>3</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>959.45095.9318.10888</string> </value> <value> <string>960.24382.2075.20667</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>1496056764.06</float> <float>1498746700.08</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
<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>953.59501.33025.63675</string> </value> <value> <string>959.35277.15921.2798</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>1495467674.51</float> <float>1498657663.98</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*jslint nomen: true, indent: 2, maxerr: 3 */ /*jslint indent: 2, nomen: true, maxlen: 80*/
/*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
......
...@@ -220,7 +220,7 @@ ...@@ -220,7 +220,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>3</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>959.45017.10197.48298</string> </value> <value> <string>960.22683.21993.61064</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>1496066978.7</float> <float>1498644239.26</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -7,17 +7,12 @@ ...@@ -7,17 +7,12 @@
<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">
...@@ -33,8 +28,8 @@ ...@@ -33,8 +28,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 softwares}} {{#each software_list}}
<li><a href="{{value.href}}">{{value.title}}</a></li> <li><a href="{{href}}">{{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>zope</string> </value> <value> <string>3</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>959.46970.48446.4744</string> </value> <value> <string>960.20029.51205.49066</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>1496169875.85</float> <float>1498657596.37</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*global window, rJS, RSVP, Handlebars, URI, console, jIO, document */ /*global window, rJS, RSVP, Handlebars, jIO, document */
/*jslint nomen: true, indent: 2, maxerr: 3 */ /*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, rJS, RSVP, Handlebars, document) {
(function (window, rJS, RSVP, Handlebars, URI, document) {
"use strict"; "use strict";
var gadget_klass = rJS(window), /////////////////////////////////////////////////////////////////
// some varables
/////////////////////////////////////////////////////////////////
var VIEW = "?page=afs_software&view=view",
gadget_klass = rJS(window),
templater = gadget_klass.__template_element, templater = gadget_klass.__template_element,
source = templater.getElementById("frontpage-template") source = templater.getElementById("frontpage-template").innerHTML,
.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")
...@@ -23,9 +31,7 @@ ...@@ -23,9 +31,7 @@
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.declareMethod("render", function () { .declareMethod("render", function () {
var gadget = this, var gadget = this,
masonry_container = gadget.element.querySelector( grid = gadget.element.querySelector('.ui-masonry-container');
'.ui-masonry-container'
);
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
...@@ -36,67 +42,64 @@ ...@@ -36,67 +42,64 @@
}) })
]); ]);
}) })
.push(function (my_response_list) { .push(function (result_list) {
return RSVP.all([ return result_list[0].render();
gadget.jio_allDocs({
select_list: ['category_list'],
query: 'portal_type:"software"'
}),
my_response_list[0].render()
]);
}) })
.push(function (my_response_list) { .push(function (html_content) {
var softwares = my_response_list[0].data.rows, var banner = document.createRange()
obj, .createContextualFragment(html_content || "");
// get categories and flatten array of category arrays gadget.element.insertBefore(banner, grid);
categories = softwares
.map((obj) => obj.value.category_list)
.reduce((cur, prev) => cur.concat(prev)),
// remove duplicates (case sensitive!)
unique_categories = Array.from(new Set(categories)),
// kudos: https://davidwalsh.name/convert-html-stings-dom-nodes
banner = document.createRange()
.createContextualFragment(my_response_list[1] || "");
gadget.element.insertBefore(banner, masonry_container);
return RSVP.all(unique_categories);
})
.push(function (categories) {
var softwares_by_category = categories.map(function (category) {
return gadget.jio_allDocs({ return gadget.jio_allDocs({
select_list: [ select_list: ['category_list', 'title', 'publisher'],
'title', query: 'portal_type:"software"'
'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
};
}); });
})
.push(function (result_list) {
var software_list = result_list.data.rows,
global_category_list = [],
config;
// list of unique list of categories
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;
}, []);
}
return RSVP.all(softwares_by_category); // populate list with software
}) config = global_category_list.reduce(function (result, category) {
.push(function (result) { var category_entry = {"category": category, "software_list": []},
var content; len = software_list.length,
match_list,
software,
i;
// reverse sort categories by number of softwares for (i = 0; i < len; i += 1) {
result.sort( (a, b) => b.softwares.length - a.softwares.length ); software = software_list[i].value;
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;
}, []);
content = template(result); grid.innerHTML = template(config);
masonry_container.innerHTML = content;
}); });
}); });
}(window, rJS, RSVP, Handlebars, URI, document)); }(window, rJS, RSVP, Handlebars, 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>zope</string> </value> <value> <string>3</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>959.46981.52420.64187</string> </value> <value> <string>960.25451.60616.27306</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>1496170069.03</float> <float>1498812651.17</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -4,12 +4,13 @@ ...@@ -4,12 +4,13 @@
<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>Publisher</title> <title>Publisher</title>
<link rel="stylesheet" type="text/css" 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="handlebars.js"></script> <script src="handlebars.js"></script>
<link rel="stylesheet" type="text/css" href="gadget_erp5_afs.css" />
<script src="gadget_erp5_page_afs_publisher.js"></script> <script src="gadget_erp5_page_afs_publisher.js"></script>
<script id="display-template" type="text/x-handlebars-template"> <script id="display-template" type="text/x-handlebars-template">
......
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>954.58644.17552.59852</string> </value> <value> <string>959.35276.32069.1399</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>1495467629.29</float> <float>1498657508.03</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*globals window, RSVP, rJS, Handlebars, jIO*/ /*globals window, RSVP, rJS, Handlebars, jIO*/
/*jslint indent: 2, nomen: true, maxlen: 100*/ /*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, RSVP, rJS, Handlebars, jIO) { (function (window, RSVP, rJS, Handlebars, jIO) {
"use strict"; "use strict";
var gadget_klass = rJS(window), /////////////////////////////////////////////////////////////////
// some parameters
/////////////////////////////////////////////////////////////////
var PLACEHOLDER = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAACWCA" +
"YAAACb3McZAAANRUlEQVR4Xu2dB1cbOReGBaGEEloCGEglYVPI7v7/37GFEBJS6SmUUG3Cnn" +
"cSnU+fMuMyHln3jl+d42MHezTSe/XkSiPpqufq6urKMFEBKpCqQA8BYcugAtkKEBC2DipQRw" +
"ECwuZBBQgI2wAVyKcAPUg+3XhVlyhAQLrE0KxmPgUISD7deFWXKEBAusTQrGY+BQhIPt14VZ" +
"coQEC6xNCsZj4FCEg+3XhVlyhAQLrE0KxmPgUISD7deFWXKEBASmroz5+/mLOzs+C1m5ycMM" +
"PDw8HvE+sGBCSW8oHv++bNO3NwcBj4LsbcvXvbTE1NBr9PrBsQkFjKB74vASlGYAJSjI7ici" +
"EgxZiEgBSjo7hcCEgxJiEgxegoLhcCUoxJCEgxOorLhYAUYxICUoyO4nIhIMWYhIAUo6O4XA" +
"hIMSYhIMXoKC4XAlKMSQhIMTqKy4WAFGOSUgNyeX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l2BQiIdg" +
"uy/EEV+A9Em3PVuGWDlwAAAABJRU5ErkJggg==",
// https://en.wikipedia.org/api/rest_v1 - only works in for english
WIKIPEDIA_URL = 'https://en.wikipedia.org/api/rest_v1/page/summary/',
NEXEDI_CONTACT_URL = 'https://www.nexedi.com/contact',
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
); );
/////////////////////////////////////////////////////////////////
// some methods
/////////////////////////////////////////////////////////////////
function clean(case_list) { function clean(case_list) {
var i, var i,
len, len,
entry; entry;
for (i = 0, len = case_list.length; i < len; i += 1) { for (i = 0, len = case_list.length; i < len; i += 1) {
entry = case_list[i]; entry = case_list[i];
if (entry.image === "N/A" || entry.image === "") { if (entry.image === NA || entry.image === STR) {
entry.image = 'gadget_erp5_afs_camera.png?format=png'; entry.image = PLACEHOLDER;
entry.image_class = "custom-placeholder"; entry.image_class = "custom-placeholder";
} }
} }
return case_list; return case_list;
} }
function isNoValidSuccessCaseList(case_list) {
return (case_list.length === 0 || case_list === NA ||
case_list[0].title === NA || case_list[0].title === STR);
}
function fetchWikiProfile(url) {
return new RSVP.Queue()
.push(function () {
return jIO.util.ajax({
type: "GET",
headers: {"api-user-agent": NEXEDI_CONTACT_URL},
url: WIKIPEDIA_URL + url.split("/").pop()
});
})
.push(function (data) {
var response = data.target.response || data.target.responseText;
return JSON.parse(response).extract;
})
.push(undefined, function () {
return undefined;
});
}
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;
...@@ -35,46 +143,26 @@ ...@@ -35,46 +143,26 @@
return gadget.jio_get(options.jio_key); return gadget.jio_get(options.jio_key);
}) })
.push(function (publisher) { .push(function (publisher) {
// https://en.wikipedia.org/api/rest_v1/ var wiki_list = [];
// only works in for english
var wikipedia_api_url =
'https://en.wikipedia.org/api/rest_v1/page/summary/',
wiki_list = [];
publisher.free_software_list.map(function (software) { publisher.free_software_list.map(function (software) {
if (software.commercial_support === "N/A") {
// cleanup and retrive wikipedia data
if (software.commercial_support === NA) {
delete software.commercial_support; delete software.commercial_support;
} }
if (software.logo === "N/A" || software.logo === "") { if (software.logo === NA || software.logo === STR) {
software.logo = 'gadget_erp5_afs_camera.png?format=png'; software.logo = PLACEHOLDER;
} }
if (software.success_case_list.length === 0 || if (isNoValidSuccessCaseList(software.success_case_list)) {
software.success_case_list === "N/A" ||
software.success_case_list[0].title === "N/A" ||
software.success_case_list[0].title === "") {
delete software.success_case_list; delete software.success_case_list;
} else { } else {
software.success_case_list = clean(software.success_case_list); software.success_case_list = clean(software.success_case_list);
} }
if (software.wikipedia_url === "N/A") { if (software.wikipedia_url === NA) {
delete software.wikipedia_url; delete software.wikipedia_url;
} else { } else {
wiki_list.push( wiki_list.push(fetchWikiProfile(software.wikipedia_url));
new RSVP.Queue()
.push(function () {
return jIO.util.ajax({
type: "GET",
headers: {"api-user-agent": "https://www.nexedi.com/contact"},
url: wikipedia_api_url + software.wikipedia_url.split("/").pop()
});
})
.push(function (my_content) {
var response = my_content.target.response || my_content.target.responseText;
return JSON.parse(response).extract;
}, function () {
return undefined;
})
);
} }
}); });
...@@ -82,23 +170,26 @@ ...@@ -82,23 +170,26 @@
.push(function () { .push(function () {
return RSVP.all(wiki_list); return RSVP.all(wiki_list);
}) })
.push(function (my_wiki_list) { .push(function (data_list) {
var i, len; var len = publisher.free_software_list.length,
if (my_wiki_list && my_wiki_list.length > 0) { i;
for (i = 0, len = publisher.free_software_list.length; i < len; i += 1) {
if (data_list && data_list.length > 0) {
for (i = 0; i < len; i += 1) {
if (publisher.free_software_list[i].wikipedia_url) { if (publisher.free_software_list[i].wikipedia_url) {
publisher.free_software_list[i].wikipedia_description = my_wiki_list[i]; publisher.free_software_list[i].wikipedia_description =
data_list[i];
} }
} }
} }
return publisher; return publisher;
}); });
}) })
.push(function (my_publisher) { .push(function (publisher) {
gadget.element.querySelector(".display-widget") gadget.element.querySelector(".display-widget")
.innerHTML = display_widget_table(my_publisher); .innerHTML = display_widget_table(publisher);
return gadget.updateHeader({page_title: my_publisher.title}); return gadget.updateHeader({page_title: publisher.title});
}); });
}); });
}(window, RSVP, rJS, Handlebars, jIO)); }(window, RSVP, rJS, Handlebars, jIO));
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>3</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>959.45186.37882.22272</string> </value> <value> <string>960.22633.10127.42069</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>1496067089.61</float> <float>1498641220.3</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -11,9 +11,6 @@ ...@@ -11,9 +11,6 @@
<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.35275.11438.17476</string> </value> <value> <string>959.35277.24112.56320</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>1495467682.0</float> <float>1498657681.41</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) && if ((result === undefined) && (argument_list[0] === SORT)) {
(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 gadget.updateHeader({ return RSVP.all([
page_title: "Publisher List" gadget.updateHeader({page_title: "Publisher List"}),
}); gadget.getDeclaredGadget("form_list")
}) ]);
.push(function () {
return gadget.getDeclaredGadget("form_list");
}) })
.push(function (form_gadget) { .push(function (result_list) {
var column_list = [ return result_list[1].render({
//['logo', 'Logo'], erp5_document: {
['title', 'Title'], "_embedded": {
['country', 'Country'], "_view": {
['founded_year', 'Founded'],
['presence', 'Presence']
];
return form_gadget.render({
erp5_document: {"_embedded": {"_view": {
"listbox": { "listbox": {
"column_list": column_list, "column_list": COLUMN_LIST,
"show_anchor": 0, "show_anchor": 0,
"default_params": {}, "default_params": {},
"editable": 0, "editable": 0,
"key": "field_listbox", "key": "field_listbox",
"lines": 20, "lines": 20,
"list_method": "portal_catalog", "list_method": "portal_catalog",
"query": 'urn:jio:allDocs?query=' + 'portal_type:' + "query": QUERY,
'"publisher"',
"portal_type": [], "portal_type": [],
"search_column_list": column_list, "search_column_list": COLUMN_LIST,
"sort_column_list": column_list, "sort_column_list": COLUMN_LIST,
"sort_on": ["title", "ascending"], "sort_on": ["title", "ascending"],
"title": "Documents", "title": "Documents",
"type": "ListBox" "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));
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>3</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>959.45151.41449.24985</string> </value> <value> <string>960.22649.27783.51</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>1496067110.92</float> <float>1498642539.62</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -4,15 +4,12 @@ ...@@ -4,15 +4,12 @@
<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>959.36392.63010.46540</string> </value> <value> <string>960.22902.49514.45755</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>1496073513.05</float> <float>1498657408.74</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -3,23 +3,32 @@ ...@@ -3,23 +3,32 @@
(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") /////////////////////////////////////////////////////////////////
.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;
}) })
...@@ -27,60 +36,50 @@ ...@@ -27,60 +36,50 @@
.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_STRING)) { if ((result === undefined) && (argument_list[0] === SORT)) {
return [['lines', 'descending']]; 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 gadget.updateHeader({ return RSVP.all([
page_title: "Statistics" gadget.updateHeader({page_title: "Statistics"}),
}); gadget.getDeclaredGadget("form_list")
}) ]);
.push(function () {
return gadget.getDeclaredGadget("form_list");
}) })
.push(function (form_gadget) { .push(function (result_list) {
var column_list = [ return result_list[1].render({
['title', 'Title'], erp5_document: {
['country', 'Country'], "_embedded": {
['lines', 'Total Lines of Code'] "_view": {
],
sort_column_list = [
['lines', 'Total Lines of Code']
];
return form_gadget.render({
erp5_document: {"_embedded": {"_view": {
"listbox": { "listbox": {
"column_list": column_list, "column_list": COLUMN_LIST,
"show_anchor": 0, "show_anchor": 0,
"default_params": {}, "default_params": {},
"editable": 0, "editable": 0,
"key": "field_listbox", "key": "field_listbox",
"lines": 20, "lines": 20,
"list_method": "portal_catalog", "list_method": "portal_catalog",
"query": 'urn:jio:allDocs?query=' + 'portal_type:"publisher"', "query": QUERY,
"portal_type": [], "portal_type": [],
"search_column_list": column_list, "search_column_list": COLUMN_LIST,
"sort_column_list": sort_column_list, "sort_column_list": SORT_LIST,
"sort_on": ["lines", "descending"], "sort_on": ["total_lines", "descending"],
"title": "Documents", "title": "Documents",
"type": "ListBox" "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"]]],
...@@ -90,4 +89,5 @@ ...@@ -90,4 +89,5 @@
}); });
}); });
}); });
}(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>959.45388.59712.6178</string> </value> <value> <string>960.20090.53630.24883</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>1496074387.69</float> <float>1498643289.79</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>955.20609.15320.31283</string> </value> <value> <string>959.35276.53022.61934</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>1495467648.49</float> <float>1498657572.87</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*globals window, RSVP, rJS, Handlebars, jIO*/ /*globals window, RSVP, rJS, Handlebars, jIO*/
/*jslint indent: 2, nomen: true, maxlen: 100*/ /*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, RSVP, rJS, Handlebars, jIO) { (function (window, RSVP, rJS, Handlebars, jIO) {
"use strict"; "use strict";
var gadget_klass = rJS(window), /////////////////////////////////////////////////////////////////
// some parameters
/////////////////////////////////////////////////////////////////
var PLACEHOLDER = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAACWCA" +
"YAAACb3McZAAANRUlEQVR4Xu2dB1cbOReGBaGEEloCGEglYVPI7v7/37GFEBJS6SmUUG3Cnn" +
"cSnU+fMuMyHln3jl+d42MHezTSe/XkSiPpqufq6urKMFEBKpCqQA8BYcugAtkKEBC2DipQRw" +
"ECwuZBBQgI2wAVyKcAPUg+3XhVlyhAQLrE0KxmPgUISD7deFWX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mGKCLEhcOFyPkQUH50IKbd+5M8sah6Qtbc9a8u4/Ls5dmDYvjDoGsWX3B9k+AD4c/v" +
"ilTQ14eUAFXC+C2/hPptKgkQJHUt4rIf/tpj2JSgPFhcP/HNDOzDqnAvW8SRowkuAQBUiWN8" +
"nyFkK4ztlsuu+yLFAsJK4isRYmpllFjAdxC+c3/kb/7r7mprPGfsNv9G8JtRQJSD1Ymv1Ogr" +
"gsw/8UyPIKkryFGg9Sr2Gxa6UbO+lA+OqK9yC6mwNLr10BAqLdgix/UAUISFB5mbl2BQiIdg" +
"uy/EEV+A9Em3PVuGWDlwAAAABJRU5ErkJggg==",
// https://en.wikipedia.org/api/rest_v1 - only works in for english
WIKIPEDIA_URL = 'https://en.wikipedia.org/api/rest_v1/page/summary/',
NEXEDI_CONTACT_URL = 'https://www.nexedi.com/contact',
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
); );
function clean(case_list, software_website, software_title, publisher_website, publisher_title) { /////////////////////////////////////////////////////////////////
var emptry_string = "", // some methods
i, /////////////////////////////////////////////////////////////////
len, function clean(software) {
entry; var case_list = software.success_case_list,
for (i = 0, len = case_list.length; i < len; i += 1) { len = case_list.length,
entry = case_list[i]; success_case,
if (entry.image === "N/A" || entry.image === "") { i;
entry.image = 'gadget_erp5_afs_camera.png?format=png';
entry.image_class = "custom-placeholder"; for (i = 0; i < len; i += 1) {
success_case = case_list[i];
if (success_case.image === NA || success_case.image === STR) {
success_case.image = PLACEHOLDER;
success_case.image_class = "custom-placeholder";
} }
entry.software_website = software_website || emptry_string; success_case.software_website = software.website || STR;
entry.software = software_title || emptry_string; success_case.software = software.title || STR;
entry.publisher_website = publisher_website || emptry_string; success_case.publisher_website = software.publisher_website || STR;
entry.publisher = publisher_title || emptry_string; success_case.publisher = software.publisher || STR;
} }
return case_list; return case_list;
} }
function isNoValidSuccessCaseList(case_list) {
return (case_list.length === 0 || case_list === NA ||
case_list[0].title === NA || case_list[0].title === STR);
}
function fetchWikiProfile(url) {
return new RSVP.Queue()
.push(function () {
return jIO.util.ajax({
type: "GET",
headers: {"api-user-agent": NEXEDI_CONTACT_URL},
url: WIKIPEDIA_URL + url.split("/").pop()
});
})
.push(function (data) {
var response = data.target.response || data.target.responseText;
return JSON.parse(response).extract;
})
.push(undefined, function () {
return undefined;
});
}
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;
...@@ -40,61 +149,37 @@ ...@@ -40,61 +149,37 @@
return gadget.jio_get(options.jio_key); return gadget.jio_get(options.jio_key);
}) })
.push(function (software) { .push(function (software) {
var queue = new RSVP.Queue();
// https://en.wikipedia.org/api/rest_v1/ // cleanup and retrieve wikipedia data
// only works in for english if (software.logo === NA || software.logo === STR) {
var wikipedia_api_url = 'https://en.wikipedia.org/api/rest_v1/page/summary/'; software.logo = PLACEHOLDER;
if (software.logo === "N/A" || software.logo === "") {
software.logo = 'gadget_erp5_afs_camera.png?format=png';
} }
if (software.commercial_support === "N/A") { if (software.commercial_support === NA) {
delete software.commercial_support; delete software.commercial_support;
} }
if (software.success_case_list.length === 0 || if (isNoValidSuccessCaseList(software.success_case_list)) {
software.success_case_list === "N/A" ||
software.success_case_list[0].title === "N/A" ||
software.success_case_list[0].title === "") {
delete software.success_case_list; delete software.success_case_list;
} else { } else {
software.success_case_list = clean( software.success_case_list = clean(software);
software.success_case_list,
software.website,
software.title,
software.publisher_website,
software.publisher
);
} }
if (software.wikipedia_url === "N/A") { if (software.wikipedia_url === NA) {
delete software.wikipedia_url; delete software.wikipedia_url;
return software; } else {
queue.push(fetchWikiProfile(software.wikipedia_url));
} }
return new RSVP.Queue() return queue
.push(function () { .push(function (wikipedia_content) {
return jIO.util.ajax({ if (wikipedia_content) {
type: "GET", software.wikipedia_description = wikipedia_content;
headers: {"api-user-agent": "https://www.nexedi.com/contact"}, }
url: wikipedia_api_url + software.wikipedia_url.split("/").pop()
});
})
.push(function (my_content) {
var response = my_content.target.response || my_content.target.responseText;
software.wikipedia_description = JSON.parse(response).extract;
return software;
}, function () {
// console.log(my_error)
// 404 or not allowed, swallow
return software;
});
})
.push(function (my_software) {
gadget.element.querySelector(".display-widget") gadget.element.querySelector(".display-widget")
.innerHTML = display_widget_table(my_software); .innerHTML = display_widget_table(software);
return gadget.updateHeader({page_title: my_software.title}); return gadget.updateHeader({page_title: software.title});
});
}); });
}); });
}(window, RSVP, rJS, Handlebars, jIO));
}(window, RSVP, rJS, Handlebars, jIO));
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>3</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>959.45186.59501.25241</string> </value> <value> <string>960.22629.43878.37017</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>1496067144.61</float> <float>1498641074.59</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -11,9 +11,6 @@ ...@@ -11,9 +11,6 @@
<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.35275.22570.50176</string> </value> <value> <string>959.35276.45558.8891</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>1495467641.69</float> <float>1498657545.3</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) && if ((result === undefined) && (argument_list[0] === SORT)) {
(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 gadget.updateHeader({ return RSVP.all([
page_title: "Software List" gadget.updateHeader({page_title: "Software List"}),
}); gadget.getDeclaredGadget("form_list")
]);
}) })
.push(function () { .push(function (result_list) {
return gadget.getDeclaredGadget("form_list"); return result_list[1].render({
}) erp5_document: {
.push(function (form_gadget) { "_embedded": {
var column_list = [ "_view": {
//['logo', 'Logo'],
['title', 'Title'],
['publisher', 'Publisher'],
['category_list', 'Category']
];
return form_gadget.render({
erp5_document: {"_embedded": {"_view": {
"listbox": { "listbox": {
"column_list": column_list, "column_list": COLUMN_LIST,
"show_anchor": 0, "show_anchor": 0,
"default_params": {}, "default_params": {},
"editable": 0, "editable": 0,
"key": "field_listbox", "key": "field_listbox",
"lines": 20, "lines": 20,
"list_method": "portal_catalog", "list_method": "portal_catalog",
"query": 'urn:jio:allDocs?query=' + 'portal_type:' + "query": QUERY,
'"software"',
"portal_type": [], "portal_type": [],
"search_column_list": column_list, "search_column_list": COLUMN_LIST,
"sort_column_list": column_list, "sort_column_list": COLUMN_LIST,
"title": "Documents", "title": "Documents",
"type": "ListBox" "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));
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>3</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>959.45114.42947.5734</string> </value> <value> <string>960.22662.39286.38860</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>1496067168.05</float> <float>1498643008.6</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
<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="rsvp.js"></script>
<script src="renderjs.js"></script> <script src="renderjs.js"></script>
<script src="handlebars.js"></script> <script src="handlebars.js"></script>
<link type="text/css" rel="stylesheet" href="gadget_erp5_afs.css" />
<script src="gadget_erp5_page_afs_success_case.js"></script> <script src="gadget_erp5_page_afs_success_case.js"></script>
<script id="display-template" type="text/x-handlebars-template"> <script id="display-template" type="text/x-handlebars-template">
......
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>954.58847.53110.31982</string> </value> <value> <string>959.35276.22741.45209</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>1495467620.79</float> <float>1498657466.07</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -3,31 +3,114 @@ ...@@ -3,31 +3,114 @@
(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" +
"YAAACb3McZAAANRUlEQVR4Xu2dB1cbOReGBaGEEloCGEglYVPI7v7/37GFEBJS6SmUUG3Cnn" +
"cSnU+fMuMyHln3jl+d42MHezTSe/XkSiPpqufq6urKMFEBKpCqQA8BYcugAtkKEBC2DipQRw" +
"ECwuZBBQgI2wAVyKcAPUg+3XhVlyhAQLrE0KxmPgUISD7deFWXKEBAusTQrGY+BQhIPt14VZ" +
"coQEC6xNCsZj4FCEg+3XhVlyhAQLrE0KxmPgUISD7deFWXKEBASmroz5+/mLOzs+C1m5ycMM" +
"PDw8HvE+sGBCSW8oHv++bNO3NwcBj4LsbcvXvbTE1NBr9PrBsQkFjKB74vASlGYAJSjI7ici" +
"EgxZiEgBSjo7hcCEgxJiEgxegoLhcCUoxJCEgxOorLhYAUYxICUoyO4nIhIMWYhIAUo6O4XA" +
"hIMSYhIMXoKC4XAlKMSQhIMTqKy4WAFGOSUgNyeXlpqtWq6cbQeBsbm+bbt+NiWkmdXDiTHl" +
"zi4m4AGPb3D5LX6emZ+f79e3GZM6dUBW7cGDXz83NmaOh6KRUqhQcBGFtbO+bLl6+lNJKGSo" +
"2N3TCzs9NmZGREQ3GbLqN6QLBqdWNji96iaZO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atRABiG7sLg/sZ+859UPwuF7" +
"1IzGb06719MGzDd8HAZ//le5TYkEQFJM17AAT7smDYd/c7AiILCL80aYBYOLDhyoJhP9t3XO" +
"d2vQjIzzFEmscAGP7Ljkns77O6WrKbT/lLV69rBRhcMNx/W3DSPEkM1aJ7ENcToNG7XgMBGX" +
"xA0rwIxx4xmk79e6YB4noNC4V9xxmN+N71JO5TrVhPtKIB4nev/K6VhaMeJGnzI/KaSneWqB" +
"lAAAVePiS+F4nZzRIHiOsxAIcPStY4hIN0WSC6//v7Yw8XCAuICwoBceYurBdwB+YWkixA8L" +
"0di3AMIgsMf5LPHXTbLhQBacJmrXSx3G5WvSdZHIs0IXzgn/gz6O7jXX8MkuY93CdcXT0GsY" +
"05a5DuQoHPdgDvzonwUW/g1p4z+3pzIGlexB2wu/MiBOTnIkS/m+XC4I5JfO9hl6D4a7ly2p" +
"WXFaBA2hos281yG7//FMv1HGlLUAooWq4sog3S3e6QCwg+uxODWZOFjRYv5lKDFxWiQDPdLP" +
"eRrg8HJwp/mqHeOizXW6R5DgJSSFsOkkkWIGmehEtNGpigESTu0yp39pxzIEHadqGZZo1FXF" +
"D8z1ysmGKCLEhcOFyPkQUH50IKbd+5M8sah6Qtbc9a8u4/Ls5dmDYvjDoGsWX3B9k+AD4c/v" +
"ilTQ14eUAFXC+C2/hPptKgkQJHUt4rIf/tpj2JSgPFhcP/HNDOzDqnAvW8SRowkuAQBUiWN8" +
"nyFkK4ztlsuu+yLFAsJK4isRYmpllFjAdxC+c3/kb/7r7mprPGfsNv9G8JtRQJSD1Ymv1Ogr" +
"gsw/8UyPIKkryFGg9Sr2Gxa6UbO+lA+OqK9yC6mwNLr10BAqLdgix/UAUISFB5mbl2BQiIdg" +
"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 === "") {
story.image = 'gadget_erp5_afs_camera.png?format=png'; if (story.image === NA || story.image === STR) {
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));
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>3</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>959.45187.8875.24320</string> </value> <value> <string>955.20616.5429.32785</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>1496067187.24</float> <float>1498641401.93</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1495467635.2</float> <float>1498657524.31</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -2,55 +2,68 @@ ...@@ -2,55 +2,68 @@
/*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) && if ((result === undefined) && (argument_list[0] === SORT)) {
(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 gadget.updateHeader({ return RSVP.all([
page_title: "Success Story List" gadget.updateHeader({page_title: "Success Story List"}),
}); gadget.getDeclaredGadget("form_list")
}) ]);
.push(function () {
return gadget.getDeclaredGadget("form_list");
}) })
.push(function (form_gadget) { .push(function (result_list) {
var column_list = [ return result_list[1].render({
['title', 'Title'], erp5_document: {
['software', 'Software'], "_embedded": {
['publisher', 'Publisher'], "_view": {
['industry', 'Industry'],
['category_list', 'Software Categories'],
['customer', 'Customer'],
['country', 'Country'],
['language', 'Language']
];
return form_gadget.render({
erp5_document: {"_embedded": {"_view": {
"listbox": { "listbox": {
"column_list": column_list, "column_list": COLUMN_LIST,
"show_anchor": 0, "show_anchor": 0,
"default_params": {}, "default_params": {},
"editable": 1, "editable": 1,
...@@ -58,27 +71,22 @@ ...@@ -58,27 +71,22 @@
"key": "field_listbox", "key": "field_listbox",
"lines": 20, "lines": 20,
"list_method": "portal_catalog", "list_method": "portal_catalog",
"query": 'urn:jio:allDocs?query=portal_type:"success_case"', "query": QUERY,
"portal_type": [], "portal_type": [],
"search_column_list": column_list, "search_column_list": COLUMN_LIST,
"sort_column_list": column_list, "sort_column_list": COLUMN_LIST,
"title": "", "title": "",
"type": "ListBox" "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", ["bottom", [["listbox"]]],
[["listbox"]] ["hidden", ["listbox_modification_date"]]
], ]
["hidden", ["listbox_modification_date"]]]
} }
}); });
}); });
......
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>3</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>959.45122.5485.9130</string> </value> <value> <string>960.25491.21351.54101</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>1496067205.22</float> <float>1498812721.65</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.full + UTM, "src": image_dict.urls.regular + 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>959.45391.58217.49288</string> </value> <value> <string>960.19800.9537.42137</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>1496074563.45</float> <float>1498491243.08</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://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://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>
</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.30886.17996.5358</string> </value> <value> <string>959.31263.27499.6263</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>1495226845.13</float> <float>1497023079.42</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Section" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>__before_publishing_traverse__</string> </key>
<value>
<object>
<klass>
<global name="MultiHook" module="ZPublisher.BeforeTraverse"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_defined_in_class</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>_hookname</string> </key>
<value> <string>__before_publishing_traverse__</string> </value>
</item>
<item>
<key> <string>_list</string> </key>
<value>
<list>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</list>
</value>
</item>
<item>
<key> <string>_prior</string> </key>
<value>
<none/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>__before_traverse__</string> </key>
<value>
<dictionary>
<item>
<key>
<tuple>
<int>99</int>
<string>ERP5 Web Section/hateoas</string>
</tuple>
</key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>__translation_dict</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>default_view_action_reference</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>view_action_category</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_login</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_logout</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAc=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>caching_policy/hateoas</string>
</tuple>
</value>
</item>
<item>
<key> <string>configuration_login</string> </key>
<value> <string>connection/login_form{?came_from}</string> </value>
</item>
<item>
<key> <string>configuration_logout</string> </key>
<value> <string>connection/WebSite_logout{?came_from}</string> </value>
</item>
<item>
<key> <string>container_layout</string> </key>
<value> <string>ERP5Document_getHateoas</string> </value>
</item>
<item>
<key> <string>content_layout</string> </key>
<value> <string>ERP5Document_getHateoas</string> </value>
</item>
<item>
<key> <string>custom_render_method_id</string> </key>
<value> <string>ERP5Document_getHateoas</string> </value>
</item>
<item>
<key> <string>default_view_action_reference</string> </key>
<value> <string>view</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>empty_criterion_valid</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>hateoas</string> </value>
</item>
<item>
<key> <string>layout_configuration_form_id</string> </key>
<value> <string>WebSection_viewHateoasPreference</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Section</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>skin_selection_name</string> </key>
<value> <string>HalRestricted</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Restricted Hateoas</string> </value>
</item>
<item>
<key> <string>view_action_category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAg=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="WebSectionTraversalHook" module="Products.ERP5.Document.WebSection"/>
</pickle>
<pickle>
<dictionary/>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<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="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="6" aka="AAAAAAAAAAY=">
<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="7" aka="AAAAAAAAAAc=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="8" aka="AAAAAAAAAAg=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>category_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAk=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAo=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="9" aka="AAAAAAAAAAk=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</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>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1472632323.86</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>embedded</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="10" aka="AAAAAAAAAAo=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>953.39264.4304.36881</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</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>1473844454.31</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
...@@ -2,36 +2,30 @@ ...@@ -2,36 +2,30 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<global name="Image" module="erp5.portal_type"/> <global name="Web Section" module="erp5.portal_type"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>_Access_contents_information_Permission</string> </key> <key> <string>_Add_portal_content_Permission</string> </key>
<value> <value>
<tuple> <tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string> <string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string> <string>Manager</string>
<string>Owner</string>
</tuple> </tuple>
</value> </value>
</item> </item>
<item> <item>
<key> <string>_Add_portal_content_Permission</string> </key> <key> <string>_Add_portal_folders_Permission</string> </key>
<value> <value>
<tuple> <tuple>
<string>Assignee</string>
<string>Assignor</string> <string>Assignor</string>
<string>Manager</string> <string>Manager</string>
</tuple> </tuple>
</value> </value>
</item> </item>
<item> <item>
<key> <string>_Change_local_roles_Permission</string> </key> <key> <string>_Copy_or_Move_Permission</string> </key>
<value> <value>
<tuple> <tuple>
<string>Assignor</string> <string>Assignor</string>
...@@ -40,58 +34,111 @@ ...@@ -40,58 +34,111 @@
</value> </value>
</item> </item>
<item> <item>
<key> <string>_Modify_portal_content_Permission</string> </key> <key> <string>_Delete_objects_Permission</string> </key>
<value> <value>
<tuple> <tuple>
<string>Assignee</string>
<string>Assignor</string> <string>Assignor</string>
<string>Manager</string> <string>Manager</string>
</tuple> </tuple>
</value> </value>
</item> </item>
<item> <item>
<key> <string>_View_Permission</string> </key> <key> <string>_Modify_portal_content_Permission</string> </key>
<value> <value>
<tuple> <tuple>
<string>Anonymous</string>
<string>Assignee</string> <string>Assignee</string>
<string>Assignor</string> <string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string> <string>Manager</string>
<string>Owner</string> <string>Owner</string>
</tuple> </tuple>
</value> </value>
</item> </item>
<item> <item>
<key> <string>_count</string> </key> <key> <string>__before_publishing_traverse__</string> </key>
<value>
<object>
<klass>
<global name="MultiHook" module="ZPublisher.BeforeTraverse"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_defined_in_class</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>_hookname</string> </key>
<value> <string>__before_publishing_traverse__</string> </value>
</item>
<item>
<key> <string>_list</string> </key>
<value>
<list>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</list>
</value>
</item>
<item>
<key> <string>_prior</string> </key>
<value>
<none/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>__before_traverse__</string> </key>
<value>
<dictionary>
<item>
<key>
<tuple>
<int>99</int>
<string>ERP5 Web Section/connection</string>
</tuple>
</key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
</dictionary>
</value>
</item>
<item> <item>
<key> <string>_mt_index</string> </key> <key> <string>_identity_criterion</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
<key> <string>_tree</string> </key> <key> <string>_range_criterion</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
<key> <string>content_md5</string> </key> <key> <string>categories</string> </key>
<value> <string>85b2e0cef64f374f3540fca9e446fb3e</string> </value> <value>
<tuple>
<string>caching_policy/no-cache</string>
</tuple>
</value>
</item>
<item>
<key> <string>container_layout</string> </key>
<value> <string>WebSection_renderDefaultPageAsGadget</string> </value>
</item> </item>
<item> <item>
<key> <string>content_type</string> </key> <key> <string>content_layout</string> </key>
<value> <string>image/png</string> </value> <value> <string>WebSection_renderDefaultPageAsGadget</string> </value>
</item> </item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>custom_render_method_id</string> </key>
<value> <string>gadget_erp5_afs_logo.png</string> </value> <value> <string>WebSection_renderDefaultPageAsGadget</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -100,24 +147,20 @@ ...@@ -100,24 +147,20 @@
</value> </value>
</item> </item>
<item> <item>
<key> <string>filename</string> </key> <key> <string>empty_criterion_valid</string> </key>
<value> <string>afs_logo.png</string> </value> <value> <int>0</int> </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_logo_png</string> </value> <value> <string>connection</string> </value>
</item> </item>
<item> <item>
<key> <string>language</string> </key> <key> <string>layout_configuration_form_id</string> </key>
<value> <string>en</string> </value> <value> <string>WebSection_viewRenderJSPreference</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <string>Image</string> </value> <value> <string>Web Section</string> </value>
</item> </item>
<item> <item>
<key> <string>short_title</string> </key> <key> <string>short_title</string> </key>
...@@ -126,16 +169,16 @@ ...@@ -126,16 +169,16 @@
</value> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>skin_selection_name</string> </key>
<value> <string>AFS Logo</string> </value> <value> <string>RJS</string> </value>
</item> </item>
<item> <item>
<key> <string>version</string> </key> <key> <string>title</string> </key>
<value> <string>001</string> </value> <value> <string>Connection</string> </value>
</item> </item>
<item> <item>
<key> <string>width</string> </key> <key> <string>visible</string> </key>
<value> <int>300</int> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
...@@ -148,24 +191,40 @@ ...@@ -148,24 +191,40 @@
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle> <pickle>
<global name="Length" module="BTrees.Length"/> <global name="WebSectionTraversalHook" module="Products.ERP5.Document.WebSection"/>
</pickle>
<pickle>
<dictionary/>
</pickle> </pickle>
<pickle> <int>0</int> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="OOBTree" module="BTrees.OOBTree"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
<pickle> <pickle>
<none/> <dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
<record id="4" aka="AAAAAAAAAAQ="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="OOBTree" module="BTrees.OOBTree"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
<pickle> <pickle>
<none/> <dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
<record id="5" aka="AAAAAAAAAAU="> <record id="5" aka="AAAAAAAAAAU=">
...@@ -179,7 +238,7 @@ ...@@ -179,7 +238,7 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>document_publication_workflow</string> </key> <key> <string>category_publication_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
</value> </value>
...@@ -207,7 +266,9 @@ ...@@ -207,7 +266,9 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>action</string> </key> <key> <string>action</string> </key>
<value> <string>publish_alive</string> </value> <value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
...@@ -233,7 +294,7 @@ ...@@ -233,7 +294,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1496062819.91</float> <float>1472632323.87</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
...@@ -242,7 +303,7 @@ ...@@ -242,7 +303,7 @@
</item> </item>
<item> <item>
<key> <string>validation_state</string> </key> <key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value> <value> <string>embedded</string> </value>
</item> </item>
</dictionary> </dictionary>
</list> </list>
...@@ -269,7 +330,7 @@ ...@@ -269,7 +330,7 @@
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
<value> <value>
<none/> <persistent> <string encoding="base64">AAAAAAAAAAg=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
...@@ -278,7 +339,7 @@ ...@@ -278,7 +339,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>959.45196.21805.13124</string> </value> <value> <string>0.0.0.0</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -296,7 +357,7 @@ ...@@ -296,7 +357,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1496062840.28</float> <float>1472632323.88</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
...@@ -308,4 +369,36 @@ ...@@ -308,4 +369,36 @@
</tuple> </tuple>
</pickle> </pickle>
</record> </record>
<record id="8" aka="AAAAAAAAAAg=">
<pickle>
<global name="Message" module="Products.ERP5Type.Message"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string>Object copied from ${source_item}</string> </value>
</item>
<item>
<key> <string>domain</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
<item>
<key> <string>mapping</string> </key>
<value>
<dictionary>
<item>
<key> <string>source_item</string> </key>
<value> <string>/erp5/web_site_module/renderjs_runner</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>message</string> </key>
<value> <string>Object copied from ${source_item}</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
<?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.")
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()
<?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_getAndStoreAnalysisList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>fetchOpenHubProfileListAsXml</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>AfsOpenHub</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Software_getAndStoreOpenHubLatestAnalysisList</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>getLatestAnalysesAsXml</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>AfsOpenHub</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Software_getOpenHubLatestAnalysis</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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
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
......
erp5_officejs_afs
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment