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 @@
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
CACHE MANIFEST\n
# generated on Mon, 30 May 2017 10:00:00 GMT\n
<value> <string>CACHE MANIFEST\n
# generated on Wed, 28 Jun 2017 15:50:00 GMT .\n
# images/ajax-loader.gif\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
erp5_launcher_nojqm.js\n
gadget_erp5_nojqm.css\n
gadget_erp5_editor_panel.html\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.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.js\n
gadget_erp5_header.html\n
gadget_erp5_header.js\n
gadget_erp5_global.js\n
gadget_erp5_label_field.html\n
gadget_erp5_label_field.js\n
gadget_erp5_notification.html\n
gadget_erp5_notification.js\n
gadget_erp5_jio.html\n
gadget_erp5_jio.js\n
gadget_erp5_page_action.html\n
gadget_erp5_page_action.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.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.js\n
gadget_erp5_relation_input.html\n
gadget_erp5_relation_input.js\n
gadget_erp5_search_editor.html\n
gadget_erp5_search_editor.js\n
gadget_erp5_searchfield.html\n
......@@ -144,8 +201,7 @@ gadget_erp5_searchfield.js\n
gadget_erp5_sort_editor.html\n
gadget_erp5_sort_editor.js\n
gadget_global.js\n
gadget_html5_input.html\n
gadget_html5_input.js\n
gadget_erp5_global.js\n
gadget_jio.html\n
gadget_jio.js\n
gadget_translation.html\n
......@@ -157,35 +213,34 @@ renderjs.js\n
rsvp.js\n
# CUSTOM AFS files\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.html\n
gadget_erp5_page_afs_success_case_list.html\n
gadget_erp5_page_afs_success_case_list.js\n
gadget_erp5_page_afs_publisher_list.html\n
gadget_erp5_page_afs_publisher_list.js\n
gadget_erp5_page_afs_publisher_statistic.html\n
gadget_erp5_page_afs_publisher_statistic.js\n
gadget_erp5_page_afs_unsplash.html\n
gadget_erp5_page_afs_unsplash.js\n
gadget_erp5_page_afs_software_list.html\n
gadget_erp5_page_afs_software_list.js\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.js\n
gadget_erp5_afs_jio.html\n
gadget_erp5_afs_jio.js\n
gadget_erp5_afs_panel.html\n
gadget_erp5_afs_panel.js\n
gadget_erp5_afs_router.html\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_storage.js\n
gadget_erp5_page_afs_software_list.html\n
gadget_erp5_page_afs_software_list.js\n
gadget_erp5_afs_publisher_storage.js\n
gadget_erp5_afs_converter_storage.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
*
]]></string> </value>
*</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......@@ -306,7 +361,7 @@ NETWORK:\n
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -320,7 +375,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.46970.48446.4744</string> </value>
<value> <string>960.20037.12063.10137</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -338,7 +393,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1496169745.29</float>
<float>1498657850.06</float>
<string>UTC</string>
</tuple>
</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 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Image" module="erp5.portal_type"/>
<global name="Web Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -63,53 +63,23 @@
</tuple>
</value>
</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>
<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>
<none/>
</value>
</item>
<item>
<key> <string>filename</string> </key>
<value> <string>afs_camera.png</string> </value>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_afs_converter_storage.js</string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <int>150</int> </value>
<key> <string>description</string> </key>
<value> <string>Custom AFS converter storage</string> </value>
</item>
<item>
<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>
<key> <string>language</string> </key>
......@@ -117,7 +87,7 @@
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Image</string> </value>
<value> <string>Web Script</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
......@@ -127,48 +97,22 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>AFS Camera</string> </value>
<value> <string>Gadget AFS Converter Storage</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>200</int> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<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>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -181,13 +125,19 @@
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<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>
</item>
</dictionary>
......@@ -196,7 +146,7 @@
</dictionary>
</pickle>
</record>
<record id="6" aka="AAAAAAAAAAY=">
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
......@@ -211,7 +161,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -233,7 +183,7 @@
</tuple>
<state>
<tuple>
<float>1496061557.92</float>
<float>1498657793.17</float>
<string>UTC</string>
</tuple>
</state>
......@@ -249,7 +199,7 @@
</tuple>
</pickle>
</record>
<record id="7" aka="AAAAAAAAAAc=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
......@@ -264,7 +214,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -278,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.45174.56579.19421</string> </value>
<value> <string>960.25923.56736.46438</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -296,7 +246,64 @@
</tuple>
<state>
<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>
</tuple>
</state>
......
......@@ -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 ------------------------------
......@@ -294,7 +322,7 @@
.ui-banner-section img {
/* max-height: 100%; */
max-width: 100%;
width: auto;
width: 100%;
height: auto;
position: absolute;
top: 0;
......@@ -308,13 +336,13 @@
.ui-banner-section span {
position: absolute;
bottom: 0;
right: 0;
right: 2em;
color: white;
font-size: small;
padding: 0 .5em .25em 0;
}
.ui-banner-section span a {
color: rgb(153, 153, 153);
color: #fff;
}
.ui-banner-section h1 {
position: absolute;
......
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.36825.37639.35106</string> </value>
<value> <string>960.20124.44127.50739</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1495561064.3</float>
<float>1498491332.93</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -5,15 +5,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Jio Gadget</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="jiodev.js" type="text/javascript"></script>
<script src="gadget_erp5_afs_storage.js" type="text/javascript"></script>
<script src="gadget_erp5_afs_jio.js" type="text/javascript"></script>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="jiodev.js"></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>
<body>
<div data-gadget-url='gadget_jio.html' data-gadget-scope='jio'></div>
......
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.35277.2835.34423</string> </value>
<value> <string>960.24363.10114.40618</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1495467687.67</float>
<float>1498744996.96</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -97,7 +97,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Gadget AFS Storage JS</string> </value>
<value> <string>Gadget AFS JIO JS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
......@@ -214,7 +214,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.45138.58632.4420</string> </value>
<value> <string>960.24361.33104.43502</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1496066128.63</float>
<float>1498810373.32</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -218,7 +218,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.46970.48446.4744</string> </value>
<value> <string>960.20109.14881.10990</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1496169827.24</float>
<float>1498657650.64</float>
<string>UTC</string>
</tuple>
</state>
......
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*global document, window, rJS, Handlebars, RSVP, loopEventListener, Node */
(function (document, window, rJS, Handlebars, RSVP, loopEventListener, Node) {
/*jslint indent: 2, nomen: true, maxlen: 80*/
/*global window, Node, rJS, Handlebars, RSVP, loopEventListener */
(function (window, Node, rJS, Handlebars, RSVP, loopEventListener) {
"use strict";
/////////////////////////////////////////////////////////////////
// temlates
// some variables
/////////////////////////////////////////////////////////////////
// Precompile templates while loading the first gadget instance
var gadget_klass = rJS(window),
source_header = gadget_klass.__template_element
.getElementById("panel-template-header")
.innerHTML,
.getElementById("panel-template-header").innerHTML,
panel_template_header = Handlebars.compile(source_header),
source_body = gadget_klass.__template_element
.getElementById("panel-template-body")
.innerHTML,
.getElementById("panel-template-body").innerHTML,
panel_template_body = Handlebars.compile(source_body);
/////////////////////////////////////////////////////////////////
// some methods
/////////////////////////////////////////////////////////////////
function getUrlDict(param) {
return {command: 'display', options: {page: param}};
}
gadget_klass
/////////////////////////////////////////////////////////////////
// state
/////////////////////////////////////////////////////////////////
.setState({
visible: 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")
/////////////////////////////////////////////////////////////////
......@@ -37,6 +60,7 @@
visible: !this.state.visible
});
})
.declareMethod('close', function () {
return this.changeState({
visible: false
......@@ -44,82 +68,69 @@
})
.declareMethod('render', function () {
var g = this;
var gadget = this;
return new RSVP.Queue()
.push(function () {
return RSVP.all([
g.getUrlFor({command: 'display', options: {page: "afs_directory"}}),
g.getUrlFor({command: 'display', options: {page: "afs_publisher_statistic"}}),
g.getUrlFor({command: 'display', options: {page: "afs_publisher_list"}}),
g.getUrlFor({command: 'display', options: {page: "afs_software_list"}}),
g.getUrlFor({command: 'display', options: {page: "afs_success_case_list"}})
gadget.getUrlFor(getUrlDict("afs_directory")),
gadget.getUrlFor(getUrlDict("afs_publisher_statistic")),
gadget.getUrlFor(getUrlDict("afs_publisher_list")),
gadget.getUrlFor(getUrlDict("afs_software_list")),
gadget.getUrlFor(getUrlDict("afs_success_case_list"))
]);
})
.push(function (all_result) {
// XXX: Customize panel header!
var tmp = panel_template_header() +
panel_template_body({
"directory_href": all_result[0],
"publisher_statistic_href": all_result[1],
"publisher_href": all_result[2],
"software_href": all_result[3],
"success_case_href": all_result[4]
.push(function (result_list) {
var content = panel_template_header();
content += panel_template_body({
"directory_href": result_list[0],
"publisher_statistic_href": result_list[1],
"publisher_href": result_list[2],
"software_href": result_list[3],
"success_case_href": result_list[4]
});
g.element.querySelector("div").innerHTML = tmp;
});
})
.onStateChange(function (modification_dict) {
if (modification_dict.hasOwnProperty("visible")) {
if (this.state.visible) {
if (!this.element.classList.contains('visible')) {
this.element.classList.toggle('visible');
}
} else {
if (this.element.classList.contains('visible')) {
this.element.classList.remove('visible');
}
}
}
gadget.element.querySelector("div").innerHTML = content;
});
})
/////////////////////////////////////////////////////////////////
// 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 () {
// 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,
event,
context = this;
function extractSizeAndDispatch() {
if (window.matchMedia("(min-width: 85em)").matches) {
return context.changeState({
desktop: true
});
return context.changeState({desktop: true});
}
return context.changeState({
desktop: false
});
return context.changeState({desktop: false});
}
result = loopEventListener(window, 'resize', false,
extractSizeAndDispatch);
event = document.createEvent("Event");
event = window.document.createEvent("Event");
event.initEvent('resize', true, true);
window.dispatchEvent(event);
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) {
// XXX Horrible hack to clear the search when focus is lost
// This does not follow renderJS design, as a gadget should not touch
// another gadget content
......@@ -128,9 +139,4 @@
}
}, true, false);
}(document, window, rJS, Handlebars, RSVP, loopEventListener, Node));
}(window, Node, rJS, Handlebars, RSVP, loopEventListener));
......@@ -214,7 +214,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.45262.19816.34594</string> </value>
<value> <string>960.22813.18734.54818</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1496066838.57</float>
<float>1498652069.39</float>
<string>UTC</string>
</tuple>
</state>
......
/*jslint indent: 2, nomen: true, maxlen: 120*/
/*jslint indent: 2, nomen: true, maxlen: 80*/
/*global jIO, RSVP, JSON */
(function (jIO, RSVP, JSON) {
"use strict";
function PublisherStorage(spec) {
// NOTE: requires Website Layout Configuration CSP modification
// => connect-src 'self' https://raw.githubusercontent.com https://api.github.com data:;
var HREF = 'https://api.github.com/repos/',
USER = 'Nexedi',
REPO = 'awesome-free-software',
BRANCH = '/contents/?ref=master';
//https://api.github.com/repos/Nexedi/awesome-free-software
//https://api.github.com/repos/Nexedi/awesome-free-software/contents/?ref=master
//https://api.github.com/repos/Nexedi/awesome-free-software/contents/alfresco.json
//https://raw.githubusercontent.com/Nexedi/awesome-free-software/master/alfresco.json
function fetchUrl(option_dict) {
return new RSVP.Queue()
.push(function () {
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/';
this._user = spec.user || 'Nexedi';
this._repo = spec.repo || 'awesome-free-software';
function PublisherStorage(spec) {
this._href = spec.href || HREF;
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) {
return new RSVP.Queue()
.push(function () {
return jIO.util.ajax({type: "GET", url: id, dataType: "text"});
return fetchUrl({type: "GET", url: id, dataType: "text"});
})
.push(
function (response) {
return JSON.parse(response.target.response || response.target.responseText);
},
function (error) {
if ((error.target !== undefined) &&
(error.target.status === 404)) {
.push(undefined, function (error) {
if ((error.target !== undefined) && (error.target.status === 404)) {
throw new jIO.util.jIOError("Cannot find document", 404);
}
throw error;
}
);
});
};
PublisherStorage.prototype.hasCapacity = function (name) {
......@@ -42,20 +44,18 @@
};
PublisherStorage.prototype.buildQuery = function () {
var url = this._href + this._user + '/' + this._repo + '/contents/?ref=master';
var url = this._url;
return new RSVP.Queue()
.push(function () {
return jIO.util.ajax({"type": "GET", "url": url});
return fetchUrl({"type": "GET", "url": url});
})
.push(function (data) {
var data_list = JSON.parse(data.target.response || data.target.responseText),
result_list = [],
.push(function (data_list) {
var result_list = [],
len = data_list.length,
data_entry,
len,
i;
for (i = 0, len = data_list.length; i < len; i += 1) {
for (i = 0; i < len; i += 1) {
data_entry = data_list[i];
if (data_entry.path.indexOf(".json") > -1) {
result_list.push({
......
......@@ -71,15 +71,15 @@
</item>
<item>
<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>
<key> <string>description</string> </key>
<value> <string>Custom AFS storage</string> </value>
<value> <string>Custom AFS publisher storage</string> </value>
</item>
<item>
<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>
<key> <string>language</string> </key>
......@@ -97,7 +97,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Gadget AFS Storage</string> </value>
<value> <string>Gadget AFS Publisher Storage</string> </value>
</item>
<item>
<key> <string>version</string> </key>
......@@ -214,7 +214,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.45095.9318.10888</string> </value>
<value> <string>960.24382.2075.20667</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1496056764.06</float>
<float>1498746700.08</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -5,7 +5,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Router Gadget</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
......
......@@ -238,7 +238,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>953.59501.33025.63675</string> </value>
<value> <string>959.35277.15921.2798</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -256,7 +256,7 @@
</tuple>
<state>
<tuple>
<float>1495467674.51</float>
<float>1498657663.98</float>
<string>UTC</string>
</tuple>
</state>
......
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*jslint indent: 2, nomen: true, maxlen: 80*/
/*global window, rJS */
(function (window, rJS) {
"use strict";
rJS(window)
/*
.ready(function (g) {
return g.getDeclaredGadget("router")
.push(function (my_default_router) {
return my_default_router.start();
});
})
*/
/////////////////////////////////////////////////////////////////
// declared methods
......
......@@ -220,7 +220,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.45017.10197.48298</string> </value>
<value> <string>960.22683.21993.61064</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1496066978.7</float>
<float>1498644239.26</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -7,17 +7,12 @@
<link rel="stylesheet" href="gadget_erp5_afs.css" type="text/css" />
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.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>
<!-- templates -->
<script id="frontpage-template" type="text/x-handlebars-template">
<ul class="grid-items">
......@@ -33,8 +28,8 @@
<section class="ui-content-section ui-body-c">
<h1>{{category}}</h1>
<ul>
{{#each softwares}}
<li><a href="{{value.href}}">{{value.title}}</a></li>
{{#each software_list}}
<li><a href="{{href}}">{{title}}</a></li>
{{/each}}
</ul>
</section>
......
......@@ -218,7 +218,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.46970.48446.4744</string> </value>
<value> <string>960.20029.51205.49066</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1496169875.85</float>
<float>1498657596.37</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, RSVP, Handlebars, URI, console, jIO, document */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, Handlebars, URI, document) {
/*global window, rJS, RSVP, Handlebars, jIO, document */
/*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, rJS, RSVP, Handlebars, document) {
"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,
source = templater.getElementById("frontpage-template")
.innerHTML,
source = templater.getElementById("frontpage-template").innerHTML,
template = Handlebars.compile(source);
Handlebars.registerPartial(
"list-partial",
templater.getElementById("list-partial").innerHTML
);
gadget_klass
/////////////////////////////////////////////////////////////////
// acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
......@@ -23,9 +31,7 @@
/////////////////////////////////////////////////////////////////
.declareMethod("render", function () {
var gadget = this,
masonry_container = gadget.element.querySelector(
'.ui-masonry-container'
);
grid = gadget.element.querySelector('.ui-masonry-container');
return new RSVP.Queue()
.push(function () {
......@@ -36,67 +42,64 @@
})
]);
})
.push(function (my_response_list) {
return RSVP.all([
gadget.jio_allDocs({
select_list: ['category_list'],
query: 'portal_type:"software"'
}),
my_response_list[0].render()
]);
.push(function (result_list) {
return result_list[0].render();
})
.push(function (my_response_list) {
var softwares = my_response_list[0].data.rows,
obj,
.push(function (html_content) {
var banner = document.createRange()
.createContextualFragment(html_content || "");
// get categories and flatten array of category arrays
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) {
gadget.element.insertBefore(banner, grid);
return gadget.jio_allDocs({
select_list: [
'title',
'publisher',
'logo'
],
query: 'category_list:"%' + category + '%" AND portal_type:"software"'
})
.push(function (softwares) {
softwares.data.rows.map(function (sw) {
// XXX hardcoded page and view
sw.value.href = "#/" + sw.id + "?page=afs_software&view=view";
});
return {
category: category,
softwares: softwares.data.rows
};
select_list: ['category_list', 'title', 'publisher'],
query: 'portal_type:"software"'
});
})
.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);
})
.push(function (result) {
var content;
// populate list with software
config = global_category_list.reduce(function (result, category) {
var category_entry = {"category": category, "software_list": []},
len = software_list.length,
match_list,
software,
i;
// reverse sort categories by number of softwares
result.sort( (a, b) => b.softwares.length - a.softwares.length );
for (i = 0; i < len; i += 1) {
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);
masonry_container.innerHTML = content;
grid.innerHTML = template(config);
});
});
}(window, rJS, RSVP, Handlebars, URI, document));
}(window, rJS, RSVP, Handlebars, document));
......@@ -214,7 +214,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.46981.52420.64187</string> </value>
<value> <string>960.25451.60616.27306</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1496170069.03</float>
<float>1498812651.17</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -4,12 +4,13 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Publisher</title>
<link rel="stylesheet" type="text/css" href="gadget_erp5_afs.css" />
<script src="rsvp.js"></script>
<script src="renderjs.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 id="display-template" type="text/x-handlebars-template">
......
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.58644.17552.59852</string> </value>
<value> <string>959.35276.32069.1399</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1495467629.29</float>
<float>1498657508.03</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -214,7 +214,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.45186.37882.22272</string> </value>
<value> <string>960.22633.10127.42069</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1496067089.61</float>
<float>1498641220.3</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -11,9 +11,6 @@
<script src="renderjs.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>
</head>
......
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.35275.11438.17476</string> </value>
<value> <string>959.35277.24112.56320</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1495467682.0</float>
<float>1498657681.41</float>
<string>UTC</string>
</tuple>
</state>
......
/*globals window, RSVP, rJS*/
/*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, RSVP, rJS) {
"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)
.declareAcquiredMethod("translate", "translate")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
/////////////////////////////////////////////////////////////////
// acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
/////////////////////////////////////////////////////////////////
// published methods
/////////////////////////////////////////////////////////////////
.allowPublicAcquisition('updateHeader', function () {
return;
})
.allowPublicAcquisition('getUrlParameter', function (argument_list) {
return this.getUrlParameter(argument_list)
.push(function (result) {
if ((result === undefined) &&
(argument_list[0] === 'field_listbox_sort_list:json')) {
if ((result === undefined) && (argument_list[0] === SORT)) {
return [['title', 'ascending']];
}
return result;
});
})
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function () {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.updateHeader({
page_title: "Publisher List"
});
})
.push(function () {
return gadget.getDeclaredGadget("form_list");
return RSVP.all([
gadget.updateHeader({page_title: "Publisher List"}),
gadget.getDeclaredGadget("form_list")
]);
})
.push(function (form_gadget) {
var column_list = [
//['logo', 'Logo'],
['title', 'Title'],
['country', 'Country'],
['founded_year', 'Founded'],
['presence', 'Presence']
];
return form_gadget.render({
erp5_document: {"_embedded": {"_view": {
.push(function (result_list) {
return result_list[1].render({
erp5_document: {
"_embedded": {
"_view": {
"listbox": {
"column_list": column_list,
"column_list": COLUMN_LIST,
"show_anchor": 0,
"default_params": {},
"editable": 0,
"key": "field_listbox",
"lines": 20,
"list_method": "portal_catalog",
"query": 'urn:jio:allDocs?query=' + 'portal_type:' +
'"publisher"',
"query": QUERY,
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
"search_column_list": COLUMN_LIST,
"sort_column_list": COLUMN_LIST,
"sort_on": ["title", "ascending"],
"title": "Documents",
"type": "ListBox"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
}
}
},
"_links": {"type": {name: STR}}
},
form_definition: {
group_list: [
[
"bottom",
[["listbox"]]
],
[
"hidden",
["listbox_modification_date"]
]
["bottom", [["listbox"]]],
["hidden", ["listbox_modification_date"]]
]
}
});
});
});
}(window, RSVP, rJS));
......@@ -214,7 +214,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.45151.41449.24985</string> </value>
<value> <string>960.22649.27783.51</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1496067110.92</float>
<float>1498642539.62</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -4,15 +4,12 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Free Software Publisher Statistics</title>
<link rel="stylesheet" href="gadget_erp5_afs.css" />
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_global.js"></script>
<script src="gadget_erp5_page_afs_publisher_statistic.js"></script>
</head>
<body>
<div data-gadget-url="gadget_erp5_pt_form_list.html"
......
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.36392.63010.46540</string> </value>
<value> <string>960.22902.49514.45755</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1496073513.05</float>
<float>1498657408.74</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -3,23 +3,32 @@
(function (window, RSVP, rJS) {
"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)
.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("updateHeader", "updateHeader")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
/////////////////////////////////////////////////////////////////
// published methods
/////////////////////////////////////////////////////////////////
.allowPublicAcquisition('updateHeader', function () {
return;
})
......@@ -27,60 +36,50 @@
.allowPublicAcquisition('getUrlParameter', function (argument_list) {
return this.getUrlParameter(argument_list)
.push(function (result) {
if ((result === undefined) && (argument_list[0] === SORT_STRING)) {
return [['lines', 'descending']];
if ((result === undefined) && (argument_list[0] === SORT)) {
return [['title', 'ascending']];
}
return result;
});
})
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function () {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.updateHeader({
page_title: "Statistics"
});
})
.push(function () {
return gadget.getDeclaredGadget("form_list");
return RSVP.all([
gadget.updateHeader({page_title: "Statistics"}),
gadget.getDeclaredGadget("form_list")
]);
})
.push(function (form_gadget) {
var column_list = [
['title', 'Title'],
['country', 'Country'],
['lines', 'Total Lines of Code']
],
sort_column_list = [
['lines', 'Total Lines of Code']
];
return form_gadget.render({
erp5_document: {"_embedded": {"_view": {
.push(function (result_list) {
return result_list[1].render({
erp5_document: {
"_embedded": {
"_view": {
"listbox": {
"column_list": column_list,
"column_list": COLUMN_LIST,
"show_anchor": 0,
"default_params": {},
"editable": 0,
"key": "field_listbox",
"lines": 20,
"list_method": "portal_catalog",
"query": 'urn:jio:allDocs?query=' + 'portal_type:"publisher"',
"query": QUERY,
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": sort_column_list,
"sort_on": ["lines", "descending"],
"search_column_list": COLUMN_LIST,
"sort_column_list": SORT_LIST,
"sort_on": ["total_lines", "descending"],
"title": "Documents",
"type": "ListBox"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
}
}
},
"_links": {"type": {name: STR}}
},
form_definition: {
group_list: [
["bottom", [["listbox"]]],
......@@ -90,4 +89,5 @@
});
});
});
}(window, RSVP, rJS));
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.45388.59712.6178</string> </value>
<value> <string>960.20090.53630.24883</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1496074387.69</float>
<float>1498643289.79</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>955.20609.15320.31283</string> </value>
<value> <string>959.35276.53022.61934</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1495467648.49</float>
<float>1498657572.87</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -214,7 +214,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.45186.59501.25241</string> </value>
<value> <string>960.22629.43878.37017</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1496067144.61</float>
<float>1498641074.59</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -11,9 +11,6 @@
<script src="renderjs.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>
</head>
......
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.35275.22570.50176</string> </value>
<value> <string>959.35276.45558.8891</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1495467641.69</float>
<float>1498657545.3</float>
<string>UTC</string>
</tuple>
</state>
......
/*globals window, RSVP, rJS*/
/*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, RSVP, rJS) {
"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)
.declareAcquiredMethod("translate", "translate")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
/////////////////////////////////////////////////////////////////
// acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
/////////////////////////////////////////////////////////////////
// published methods
/////////////////////////////////////////////////////////////////
.allowPublicAcquisition('updateHeader', function () {
return;
})
.allowPublicAcquisition('getUrlParameter', function (argument_list) {
return this.getUrlParameter(argument_list)
.push(function (result) {
if ((result === undefined) &&
(argument_list[0] === 'field_listbox_sort_list:json')) {
if ((result === undefined) && (argument_list[0] === SORT)) {
return [['title', 'ascending']];
}
return result;
});
})
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function () {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.updateHeader({
page_title: "Software List"
});
return RSVP.all([
gadget.updateHeader({page_title: "Software List"}),
gadget.getDeclaredGadget("form_list")
]);
})
.push(function () {
return gadget.getDeclaredGadget("form_list");
})
.push(function (form_gadget) {
var column_list = [
//['logo', 'Logo'],
['title', 'Title'],
['publisher', 'Publisher'],
['category_list', 'Category']
];
return form_gadget.render({
erp5_document: {"_embedded": {"_view": {
.push(function (result_list) {
return result_list[1].render({
erp5_document: {
"_embedded": {
"_view": {
"listbox": {
"column_list": column_list,
"column_list": COLUMN_LIST,
"show_anchor": 0,
"default_params": {},
"editable": 0,
"key": "field_listbox",
"lines": 20,
"list_method": "portal_catalog",
"query": 'urn:jio:allDocs?query=' + 'portal_type:' +
'"software"',
"query": QUERY,
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
"search_column_list": COLUMN_LIST,
"sort_column_list": COLUMN_LIST,
"title": "Documents",
"type": "ListBox"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
}
}
},
"_links": {"type": {name: STR}}
},
form_definition: {
group_list: [
[
"bottom",
[["listbox"]]
],
[
"hidden",
["listbox_modification_date"]
]
["bottom", [["listbox"]]],
["hidden", ["listbox_modification_date"]]
]
}
});
});
});
}(window, RSVP, rJS));
......@@ -214,7 +214,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.45114.42947.5734</string> </value>
<value> <string>960.22662.39286.38860</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1496067168.05</float>
<float>1498643008.6</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -5,12 +5,12 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Success Story</title>
<link type="text/css" rel="stylesheet" href="gadget_erp5_afs.css" />
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="handlebars.js"></script>
<link type="text/css" rel="stylesheet" href="gadget_erp5_afs.css" />
<script src="gadget_erp5_page_afs_success_case.js"></script>
<script id="display-template" type="text/x-handlebars-template">
......
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.58847.53110.31982</string> </value>
<value> <string>959.35276.22741.45209</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1495467620.79</float>
<float>1498657466.07</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -3,31 +3,114 @@
(function (window, RSVP, rJS, Handlebars) {
"use strict";
var gadget_klass = rJS(window),
/////////////////////////////////////////////////////////////////
// some parameters
/////////////////////////////////////////////////////////////////
var PLACEHOLDER = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAACWCA" +
"YAAACb3McZAAANRUlEQVR4Xu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I5JfO9hl6D4a7ly2p" +
"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,
display_widget_table = Handlebars.compile(
templater.getElementById("display-template").innerHTML
);
rJS(window)
/////////////////////////////////////////////////////////////////
// acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod('updateHeader', 'updateHeader')
.declareAcquiredMethod('jio_get', 'jio_get')
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod('render', function (options) {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.jio_get(options.jio_key);
})
.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";
}
gadget.element.querySelector(".display-widget")
.innerHTML = display_widget_table(story);
return gadget.updateHeader({page_title: story.title});
});
});
}(window, RSVP, rJS, Handlebars));
......@@ -214,7 +214,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.45187.8875.24320</string> </value>
<value> <string>955.20616.5429.32785</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1496067187.24</float>
<float>1498641401.93</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1495467635.2</float>
<float>1498657524.31</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -2,55 +2,68 @@
/*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, RSVP, rJS) {
"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)
.declareAcquiredMethod("translate", "translate")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
/////////////////////////////////////////////////////////////////
// acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
/////////////////////////////////////////////////////////////////
// published methods
/////////////////////////////////////////////////////////////////
.allowPublicAcquisition('updateHeader', function () {
return;
})
.allowPublicAcquisition('getUrlParameter', function (argument_list) {
return this.getUrlParameter(argument_list)
.push(function (result) {
if ((result === undefined) &&
(argument_list[0] === 'field_listbox_sort_list:json')) {
if ((result === undefined) && (argument_list[0] === SORT)) {
return [['title', 'ascending']];
}
return result;
});
})
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function () {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.updateHeader({
page_title: "Success Story List"
});
})
.push(function () {
return gadget.getDeclaredGadget("form_list");
return RSVP.all([
gadget.updateHeader({page_title: "Success Story List"}),
gadget.getDeclaredGadget("form_list")
]);
})
.push(function (form_gadget) {
var column_list = [
['title', 'Title'],
['software', 'Software'],
['publisher', 'Publisher'],
['industry', 'Industry'],
['category_list', 'Software Categories'],
['customer', 'Customer'],
['country', 'Country'],
['language', 'Language']
];
return form_gadget.render({
erp5_document: {"_embedded": {"_view": {
.push(function (result_list) {
return result_list[1].render({
erp5_document: {
"_embedded": {
"_view": {
"listbox": {
"column_list": column_list,
"column_list": COLUMN_LIST,
"show_anchor": 0,
"default_params": {},
"editable": 1,
......@@ -58,27 +71,22 @@
"key": "field_listbox",
"lines": 20,
"list_method": "portal_catalog",
"query": 'urn:jio:allDocs?query=portal_type:"success_case"',
"query": QUERY,
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
"search_column_list": COLUMN_LIST,
"sort_column_list": COLUMN_LIST,
"title": "",
"type": "ListBox"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
}
}
},
"_links": {"type": {name: STR}}
},
form_definition: {
group_list: [[
"bottom",
[["listbox"]]
],
["hidden", ["listbox_modification_date"]]]
group_list: [
["bottom", [["listbox"]]],
["hidden", ["listbox_modification_date"]]
]
}
});
});
......
......@@ -214,7 +214,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.45122.5485.9130</string> </value>
<value> <string>960.25491.21351.54101</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1496067205.22</float>
<float>1498812721.65</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -52,11 +52,11 @@
if (is_response) {
image_dict = JSON.parse(is_response);
// I don't need the gadget hooray, just the container, so look away
//gadget.element.innerHTML =
// I don't need the gadget hooray, just the container, so sorry.
return template({
"message": "What can Free Software do for you?",
"src": image_dict.urls.full + UTM,
"src": image_dict.urls.regular + UTM,
"alt": "Free Software",
"source_url": image_dict.user.links.html + UTM,
"source_title": image_dict.user.name,
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.45391.58217.49288</string> </value>
<value> <string>960.19800.9537.42137</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1496074563.45</float>
<float>1498491243.08</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -337,7 +337,7 @@
</item>
<item>
<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>
<key> <string>configuration_default_view_action_reference</string> </key>
......@@ -614,7 +614,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.30886.17996.5358</string> </value>
<value> <string>959.31263.27499.6263</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -632,7 +632,7 @@
</tuple>
<state>
<tuple>
<float>1495226845.13</float>
<float>1497023079.42</float>
<string>UTC</string>
</tuple>
</state>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>erp5_officejs_afs</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from Products.ERP5Type.Cache import CachingMethod
if url == None:
raise Exception("No url parameter provided.")
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_page_afs*
image_module/gadget_erp5_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_page_afs*
image_module/gadget_erp5_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_page_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