Commit a9222712 by Rafael Monnerat

slapos_[jio,crm,rss_style]: Include RSS for Critical Tickets.

This will allow the user use this dedicated feed for build some push notification or something similar.
1 parent 632ab39b
Showing 21 changed files with 1033 additions and 17 deletions
portal = context.getPortalObject()
kw['portal_type'] = ["Support Request", "Regularisation Request", "Upgrade Decision"]
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()
if person:
kw['default_destination_decision_uid'] = person.getUid()
kw['simulation_state'] = "NOT cancelled"
kw['sort_on'] = (('modification_date', 'DESC'),)
kw['limit'] = 50
return portal.portal_catalog(**kw)
else:
return []
<?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>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSection_getUserCriticalTicketList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>OfficeJS Add Text Document</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_erp5_page_slap_rss_critical_ticket.js"></script>
</head>
<body>
<form class="save_form ui-body-c" novalidate>
<button type="submit" class="ui-btn ui-btn-b ui-btn-inline
ui-icon-edit ui-btn-icon-right ui-screen-hidden"></button>
<div data-gadget-url="gadget_erp5_form.html"
data-gadget-scope="form_view"
data-gadget-sandbox="public">
</div>
</form>
</body>
</html>
/*global window, rJS, RSVP */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP) {
"use strict";
rJS(window)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("jio_post", "jio_post")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.allowPublicAcquisition('notifySubmit', function () {
return this.triggerSubmit();
})
.declareMethod("triggerSubmit", function () {
return this.element.querySelector('button[type="submit"]').click();
})
.declareMethod("render", function (options) {
var gadget = this;
if (options.jio_key === undefined) {
options.jio_key = "/";
}
return RSVP.Queue()
.push(function () {
return gadget.getSetting("hateoas_url");
})
.push(function (url) {
return RSVP.all([
gadget.getDeclaredGadget('form_view'),
gadget.jio_getAttachment(options.jio_key,
url + options.jio_key + "/Base_getCriticalFeedUrl")
]);
})
.push(function (result) {
return result[0].render({
erp5_document: {
"_embedded": {"_view": {
"my_relative_url": {
"description": "",
"title": "Parent Relative Url",
"default": options.jio_key,
"css_class": "",
"required": 1,
"editable": 1,
"key": "relative_url",
"hidden": 1,
"type": "StringField"
},
"my_rss_link": {
"description": "",
"title": "Your RSS URL",
// I hope romain don't see this, please replace by a LinkField
"default": "<a target=_blank href=" + result[1].restricted_access_url + "> Link </a>",
"css_class": "",
"required": 1,
"editable": 0,
"key": "certificate",
"hidden": 0,
"type": "EditorField"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
}
}
},
form_definition: {
group_list: [[
"center",
[["my_rss_link"], ["my_relative_url"]]
]]
}
});
})
.push(function () {
return RSVP.all([
gadget.getUrlFor({command: 'change', options: {page: "slap_ticket_list"}})
]);
})
.push(function (url_list) {
var header_dict = {
page_title: "Your Critical RSS Feed Link",
selection_url: url_list[0]
};
return gadget.updateHeader(header_dict);
});
});
}(window, rJS, RSVP));
\ No newline at end of file
......@@ -88,7 +88,8 @@
return RSVP.all([
gadget.getUrlFor({command: "change", options: {"page": "slap_add_ticket"}}),
gadget.getUrlFor({command: "change", options: {"page": "slap_rss_ticket"}}),
gadget.getUrlFor({command: "change", options: {"page": "slapos"}})
gadget.getUrlFor({command: "change", options: {"page": "slapos"}}),
gadget.getUrlFor({command: "change", options: {"page": "slap_rss_critical_ticket"}})
]);
})
.push(function (result) {
......@@ -97,7 +98,8 @@
filter_action: true,
selection_url: result[2],
add_url: result[0],
rss_url: result[1]
rss_url: result[1],
critical_url: result[3]
});
});
});
......
......@@ -108,7 +108,7 @@
<value> <string encoding="cdata"><![CDATA[
CACHE MANIFEST\n
# generated on Mon, 23 Fev 2017 12:00:00 GMT+0200\n
# generated on Wed, 4 Apr 2018 12:00:00 GMT+0200\n
CACHE:\n
favicon.ico\n
font-awesome/font-awesome-webfont.eot?v=4.6.3\n
......@@ -321,6 +321,10 @@ gadget_erp5_page_slap_project_view.html\n
gadget_erp5_page_slap_project_view.js\n
gadget_erp5_page_slap_regularisation_request_view.html\n
gadget_erp5_page_slap_regularisation_request_view.js\n
gadget_erp5_page_slap_request_trial.html\n
gadget_erp5_page_slap_request_trial.js\n
gadget_erp5_page_slap_rss_critical_ticket.html\n
gadget_erp5_page_slap_rss_critical_ticket.js\n
gadget_erp5_page_slap_rss_ticket.html\n
gadget_erp5_page_slap_rss_ticket.js\n
gadget_erp5_page_slap_sale_invoice_transaction_view.html\n
......@@ -348,12 +352,17 @@ gadget_erp5_page_slap_ticket_list.js\n
gadget_erp5_page_slap_ticket_view.js\n
gadget_erp5_page_slap_transfer_computer.html\n
gadget_erp5_page_slap_transfer_computer.js\n
gadget_erp5_page_slap_trial_request_message.html\n
gadget_erp5_page_slap_trial_request_message.js\n
gadget_erp5_page_slap_upgrade_decision_view.html\n
gadget_erp5_page_slap_upgrade_decision_view.js\n
gadget_erp5_page_slapos.css\n
gadget_erp5_page_slapos.html\n
gadget_erp5_page_slapos.js\n
gadget_erp5_page_slapos_request_form.html\n
gadget_erp5_page_trial.css\n
gadget_erp5_page_trial.html\n
gadget_erp5_page_trial.js\n
gadget_erp5_panel_shortcut.html\n
gadget_erp5_panel_shortcut.js\n
gadget_erp5_pt_form_slapos_index.html\n
......@@ -384,7 +393,7 @@ gadget_slapos_network_status.html\n
gadget_slapos_network_status.js\n
gadget_slapos_panel.html\n
gadget_slapos_panel.js\n
gadget_slapos_panel.png?format=png\n
gadget_slapos_panel.png?format=\n
gadget_slapos_payment_result.js\n
gadget_slapos_project_status.html\n
gadget_slapos_project_status.js\n
......@@ -392,6 +401,8 @@ gadget_slapos_site_status.html\n
gadget_slapos_site_status.js\n
gadget_slapos_software_release_info.html\n
gadget_slapos_software_release_info.js\n
gadget_trial_panel.html\n
gadget_trial_panel.js\n
leaflet.css\n
leaflet.js\n
tv4.min.js\n
......@@ -534,7 +545,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>966.2885.21812.19797</string> </value>
<value> <string>966.41530.11723.48674</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -552,7 +563,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1520544707.03</float>
<float>1522849619.08</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -65,6 +65,7 @@
['request_certificate_url', 'Request Certificate', 'certificate'],
['revoke_certificate_url', 'Revoke Certificate', 'ban'],
['rss_url', 'RSS', 'rss'],
['critical_url', 'Critical RSS', 'exclamation-triangle'],
['start_url', 'Start', 'play'],
['stop_url', 'Stop', 'stop'],
['destroy_url', 'Destroy', 'times'],
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.18638.36260.48281</string> </value>
<value> <string>964.5728.60924.22476</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1513096375.73</float>
<float>1522857600.68</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -115,18 +115,36 @@
</value>
</item>
<item>
<key> <string>_identity_criterion</string> </key>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</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>custom_render_method_id</string> </key>
<value> <string>WebSection_viewTicketListAsRSS</string> </value>
</item>
......@@ -165,7 +183,7 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAg=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -181,6 +199,12 @@
</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>
......@@ -194,7 +218,15 @@
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<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>
......@@ -209,7 +241,15 @@
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<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>
......@@ -222,13 +262,13 @@
<item>
<key> <string>category_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAk=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAc=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAo=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -237,7 +277,7 @@
</dictionary>
</pickle>
</record>
<record id="6" aka="AAAAAAAAAAY=">
<record id="9" aka="AAAAAAAAAAk=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
......@@ -292,7 +332,7 @@
</tuple>
</pickle>
</record>
<record id="7" aka="AAAAAAAAAAc=">
<record id="10" aka="AAAAAAAAAAo=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
......
import json
portal = context.getPortalObject()
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()
if person is None:
raise ValueError("User Not Found")
web_site = context.getWebSiteValue()
request_url = "%s/feed/critical" % (web_site.absolute_url())
# XXX - Cannot search in catalog with parameter url_string
access_token = None
for token_item in portal.portal_catalog(
portal_type="Restricted Access Token",
default_agent_uid=person.getUid(),
validation_state='validated'
):
if token_item.getUrlString() == request_url:
access_token = token_item
reference = access_token.getReference()
break
if access_token is None:
access_token = portal.access_token_module.newContent(
portal_type="Restricted Access Token",
url_string=request_url,
url_method="GET",
)
access_token.setAgentValue(person)
reference = access_token.getReference()
access_token.validate()
url = "%s?access_token=%s&access_token_secret=%s" % (
request_url,
access_token.getId(),
reference)
request = context.REQUEST
response = request.RESPONSE
response.setHeader('Content-Type', "application/json")
return json.dumps({'restricted_access_url': 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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getCriticalFeedUrl</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -154,6 +154,8 @@ web_page_module/rjs_gadget_slapos_site_status_html
web_page_module/rjs_gadget_slapos_site_status_js
web_page_module/rjs_gadget_slapos_software_release_info_html
web_page_module/rjs_gadget_slapos_software_release_info_js
web_page_module/rjs_gadget_erp5_page_slap_rss_critical_ticket_html
web_page_module/rjs_gadget_erp5_page_slap_rss_critical_ticket_js
web_page_module/rjs_gadget_trial_panel_html
web_page_module/rjs_gadget_trial_panel_js
web_page_module/rjs_leaflet_css
......
......@@ -76,6 +76,8 @@ web_page_module/rjs_gadget_erp5_page_slap_regularisation_request_view_html
web_page_module/rjs_gadget_erp5_page_slap_regularisation_request_view_js
web_page_module/rjs_gadget_erp5_page_slap_request_trial_html
web_page_module/rjs_gadget_erp5_page_slap_request_trial_js
web_page_module/rjs_gadget_erp5_page_slap_rss_critical_ticket_html
web_page_module/rjs_gadget_erp5_page_slap_rss_critical_ticket_js
web_page_module/rjs_gadget_erp5_page_slap_rss_ticket_html
web_page_module/rjs_gadget_erp5_page_slap_rss_ticket_js
web_page_module/rjs_gadget_erp5_page_slap_sale_invoice_transaction_view_html
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>listbox</string>
</list>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list>
<string>listbox_modification_date</string>
<string>listbox_title</string>
<string>listbox_description</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSection_viewCriticalTicketListAsRSS</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>WebSection_viewRssFeedRender</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_list</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>View user rss feed list</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_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="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>columns</string>
<string>count_method</string>
<string>default_params</string>
<string>editable_columns</string>
<string>hide_rows_on_no_search_criterion</string>
<string>lines</string>
<string>list_method</string>
<string>selection_name</string>
<string>sort</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>columns</string> </key>
<value> <string></string> </value>