Commit 36ae4d1c by Roque

erp5_web_project_ui: display project home page

1 parent b518055d
......@@ -7,4 +7,18 @@ Return parameters to correctly display the RenderJS gadget
# ------------------------------------------------------------------------------
# context_url: relative url of the context calling this script
return [('project_title', context.getTitle()), ('jio_key', context.getRelativeUrl())]
from Products.ERP5Type.Log import log
portal = context.getPortalObject()
portal_catalog = portal.portal_catalog
reference = context.getReference() + "-Home.Page"
home_page = portal_catalog.getResultValue(
portal_type = 'Web Page',
reference = reference)
if home_page:
content = home_page.getTextContent()
else:
content = ""
return [('project_title', context.getTitle()), ('jio_key', context.getRelativeUrl()), ('home_page_content', content)]
project_title = context.getTitle()
portal_type='Task'
state_list = ['planned', 'ordered', 'confirmed']
state_list = ['confirmed']
from DateTime import DateTime
now = DateTime()
now_minus_7 = now - 7
#catalog_kw = {'creation_date': {'query': (now_minus_7, now), 'range': 'minmax'}}
task_list = [x for x in context.portal_catalog(portal_type=portal_type,
source_project_title=project_title,
simulation_state=state_list)]
'''
print task_list
for x in task_list:
print x.getTitle()
print x.getSourceTitle()
return printed
'''
if not task_list:
return "0"
......
......@@ -30,7 +30,7 @@
<div class="ui-field-contain" style="top:150px;">
<p>
<a id="task_link" class="first-line-buttons ui-disabled" data-i18n="[value]Tasks" disabled >Tasks:</a>
<span id="task_count">...</span><span> opened / </span>
<span id="task_count">...</span><span> confirmed / </span>
<span id="unassigned_task_count">...</span><span style="margin-right:50px;"> unassigend </span>
</p>
</div>
......@@ -53,10 +53,13 @@
<div class="ui-field-contain" style="top:300px;">
<p>
<a id="test_result_link" class="first-line-buttons ui-disabled" data-i18n="[value]Last test result" disabled >Last test result:</a>
<span id="last_test_result" style="margin-right:50px;">...</span>
<span id="last_test_result" style="margin-right:10px;">...</span>
<a id="test_suite_link" class="first-line-buttons ui-disabled" data-i18n="[value]Test suite" disabled >Test suite</a>
</p>
</div>
<div class="ui-field-contain" style="top:350px;">
<div id="home_page_content"></div>
</div>
<!--
<div class="ui-field-contain">
......
......@@ -58,7 +58,8 @@ lockGadgetInQueue, unlockGadgetInQueue, unlockGadgetInFailedQueue*/
//HACK
forum_link: options.forum_link || "https://www.erp5.com/group_section/forum",
description_link: options.description_link || "https://www.erp5.com/project_section/nexedi-erp5",
project_title: options.project_title
project_title: options.project_title,
home_page_content: options.home_page_content
};
return this.changeState(state_dict);
})
......@@ -68,6 +69,7 @@ lockGadgetInQueue, unlockGadgetInQueue, unlockGadgetInFailedQueue*/
base_site = window.location.origin + window.location.pathname,
project_url = base_site + modification_dict.jio_key;
document.getElementById("home_page_content").innerHTML = modification_dict.home_page_content;
return gadget.jio_getAttachment(modification_dict.jio_key, "links")
.push(function (erp5_document) {
var view_list = ensureArray(erp5_document._links.view),
......@@ -91,20 +93,21 @@ lockGadgetInQueue, unlockGadgetInQueue, unlockGadgetInFailedQueue*/
'page': 'form',
'view': 'view',
'field_listbox_sort_list:json': [["delivery.start_date", "descending"]],
//TODO use a domain for state
'extended_search': ('destination_project_title: "' + modification_dict.project_title + '" AND translated_simulation_state_title: "Submitted"')
'extended_search': ('destination_project_title: "' + modification_dict.project_title + '" AND selection_domain_state_support_domain: "validated"')
//'extended_search': ('destination_project_title: "' + modification_dict.project_title + '" AND translated_simulation_state_title: "Submitted"')
});
var bug_options = {
'jio_key': 'bug_module', 'page': 'form', 'view': bug_view,
'field_listbox_sort_list:json': [["start_date", "descending"]],
'field_listbox_column_list:json': ["title", "description", "start_date"],
//'extended_search': ('source_project_title: "' + modification_dict.project_title + '" AND selection_domain_state_bug_domain: "started"')
'extended_search': ('source_project_title: "' + modification_dict.project_title + '" AND translated_simulation_state_title: "Open"')
'jio_key': 'bug_module', 'page': 'form', 'view': 'view',//bug_view,
'field_listbox_sort_list:json': [["delivery.start_date", "descending"]],
'field_listbox_column_list:json': ["title", "description", "delivery.start_date"],
'extended_search': ('source_project_title: "' + modification_dict.project_title + '" AND selection_domain_state_bug_domain: "started"')
//'extended_search': ('source_project_title: "' + modification_dict.project_title + '" AND translated_simulation_state_title: "Open"')
}, closed_bug_options = {};
generateLink(gadget, document.getElementById("bug_link"), 'display', bug_options);
Object.assign(closed_bug_options, bug_options);
closed_bug_options.extended_search = ('source_project_title: "' + modification_dict.project_title + '" AND translated_simulation_state_title: "Resolved"');
//closed_bug_options.extended_search = ('source_project_title: "' + modification_dict.project_title + '" AND translated_simulation_state_title: "Resolved"');
closed_bug_options.extended_search = ('source_project_title: "' + modification_dict.project_title + '" AND selection_domain_state_bug_domain: "closed"');
generateLink(gadget, document.getElementById("closed_bug_link"), 'display', closed_bug_options);
generateInfo(gadget, document.getElementById("bug_count"), project_url + "/Project_bugs");
generateInfo(gadget, document.getElementById("closed_bug_count"), project_url + "/Project_bugs?closed=1");
......@@ -114,7 +117,7 @@ lockGadgetInQueue, unlockGadgetInQueue, unlockGadgetInFailedQueue*/
'field_listbox_sort_list:json': [["delivery.start_date", "descending"]],
'field_listbox_column_list:json': ["title", "delivery.start_date", "delivery.stop_date", "destination_decision_title",
"source_title", "destination_title", "total_quantity", "task_line_quantity_unit_title"],
'extended_search': ('source_project_title: "' + modification_dict.project_title + '" AND selection_domain_state_task_domain: "started"')
'extended_search': ('source_project_title: "' + modification_dict.project_title + '" AND selection_domain_state_task_domain: "confirmed"')
});
generateInfo(gadget, document.getElementById("task_count"), project_url + "/Project_tasks");
generateInfo(gadget, document.getElementById("unassigned_task_count"), project_url + "/Project_tasksToAssigne");
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!