Commit 0a56979d authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_officejs_support_request_ui: New gadget to generate RSS Link and remove it from dashboard

Having a big "Generate RSS" button on the front page is strange, because the front page button are for common use cases that users are supposed to execute a lot.

For example, makes sense to have a "Submit new Support Request" button, because users are using this app to submit support requests, but generating RSS is very exceptional action, so we wanted to remove it from the front page.
parent 57410fd9
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_jio_action</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jio_action</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>generate_rss_link</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>3.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Generate RSS</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/SupportRequestModule_viewGenerateRSSLinkDialog</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
<div class="ui-field-contain"> <div class="ui-field-contain">
<div class="bottom"> <div class="bottom">
<a><input type="submit" class="first-line-buttons ui-disabled" data-i18n="[value]Submit New Support Request" value="Submit New Support Request" disabled /></a> <a><input type="submit" class="first-line-buttons ui-disabled" data-i18n="[value]Submit New Support Request" value="Submit New Support Request" disabled /></a>
<a target="_blank"><input class="first-line-buttons ui-disabled" type="submit" data-i18n="[value]Generate RSS" value="Generate RSS" disabled /></a>
</div> </div>
</div> </div>
......
...@@ -208,58 +208,62 @@ ...@@ -208,58 +208,62 @@
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<list> <key> <string>_log</string> </key>
<dictionary> <value>
<item> <list>
<key> <string>action</string> </key> <dictionary>
<value> <string>edit</string> </value> <item>
</item> <key> <string>action</string> </key>
<item> <value> <string>edit</string> </value>
<key> <string>actor</string> </key> </item>
<value> <string>zope</string> </value> <item>
</item> <key> <string>actor</string> </key>
<item> <value> <string>zope</string> </value>
<key> <string>comment</string> </key> </item>
<value> <item>
<none/> <key> <string>comment</string> </key>
</value> <value>
</item> <none/>
<item> </value>
<key> <string>error_message</string> </key> </item>
<value> <string></string> </value> <item>
</item> <key> <string>error_message</string> </key>
<item> <value> <string></string> </value>
<key> <string>serial</string> </key> </item>
<value> <string>962.17075.21280.35942</string> </value> <item>
</item> <key> <string>serial</string> </key>
<item> <value> <string>983.3535.62274.35669</string> </value>
<key> <string>state</string> </key> </item>
<value> <string>current</string> </value> <item>
</item> <key> <string>state</string> </key>
<item> <value> <string>current</string> </value>
<key> <string>time</string> </key> </item>
<value> <item>
<object> <key> <string>time</string> </key>
<klass> <value>
<global name="DateTime" module="DateTime.DateTime"/> <object>
</klass> <klass>
<tuple> <global name="DateTime" module="DateTime.DateTime"/>
<none/> </klass>
</tuple> <tuple>
<state> <none/>
<tuple> </tuple>
<float>1537518325.21</float> <state>
<string>GMT+9</string> <tuple>
</tuple> <float>1592854185.8</float>
</state> <string>UTC</string>
</object> </tuple>
</value> </state>
</item> </object>
</dictionary> </value>
</list> </item>
</tuple> </dictionary>
</list>
</value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
</ZopeData> </ZopeData>
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
throw error; throw error;
}) })
.push(function () { .push(function () {
var restore_filter_input = gadget.element.querySelectorAll("input")[2]; var restore_filter_input = gadget.element.querySelectorAll("input")[1];
restore_filter_input.disabled = false; restore_filter_input.disabled = false;
restore_filter_input.classList.remove("ui-disabled"); restore_filter_input.classList.remove("ui-disabled");
}); });
...@@ -268,7 +268,7 @@ ...@@ -268,7 +268,7 @@
}) })
.declareService(function () { .declareService(function () {
var gadget = this, var gadget = this,
restore_filter_input = gadget.element.querySelectorAll("input")[2]; restore_filter_input = gadget.element.querySelectorAll("input")[1];
return gadget.getUrlParameter('extended_search') return gadget.getUrlParameter('extended_search')
.push(function (result) { .push(function (result) {
if (result !== undefined) { if (result !== undefined) {
...@@ -281,29 +281,8 @@ ...@@ -281,29 +281,8 @@
var gadget = this; var gadget = this;
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
var generate_rss_input = gadget.element.querySelectorAll("input")[1], var restore_filter_input = gadget.element.querySelectorAll("input")[1],
restore_filter_input = gadget.element.querySelectorAll("input")[2], one = loopEventListener(restore_filter_input, "click", false, function () {
one = new RSVP.Queue().push(function () {
return promiseEventListener(generate_rss_input, "click", false);
}).push(function () {
generate_rss_input.disabled = true;
generate_rss_input.classList.add("ui-disabled");
return gadget.getSetting("hateoas_url")
.push(function (hateoas_url) {
return gadget.jio_getAttachment(
'support_request_module',
hateoas_url + 'support_request_module'
+ "/SupportRequestModule_generateRSSLinkAsJson"
);
})
.push(function (result) {
generate_rss_input.parentNode.href = result.restricted_access_url;
generate_rss_input.value = "RSS Link";
generate_rss_input.disabled = false;
generate_rss_input.classList.remove("ui-disabled");
});
}),
two = loopEventListener(restore_filter_input, "click", false, function () {
restore_filter_input.disabled = true; restore_filter_input.disabled = true;
restore_filter_input.classList.add("ui-disabled"); restore_filter_input.classList.add("ui-disabled");
return gadget.redirect({ return gadget.redirect({
...@@ -315,9 +294,7 @@ ...@@ -315,9 +294,7 @@
}); });
}, true); }, true);
generate_rss_input.disabled = false; return one;
generate_rss_input.classList.remove("ui-disabled");
return RSVP.all([one, two]);
}); });
}) })
.onStateChange(function () { .onStateChange(function () {
......
...@@ -214,58 +214,62 @@ ...@@ -214,58 +214,62 @@
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<list> <key> <string>_log</string> </key>
<dictionary> <value>
<item> <list>
<key> <string>action</string> </key> <dictionary>
<value> <string>edit</string> </value> <item>
</item> <key> <string>action</string> </key>
<item> <value> <string>edit</string> </value>
<key> <string>actor</string> </key> </item>
<value> <string>zope</string> </value> <item>
</item> <key> <string>actor</string> </key>
<item> <value> <string>zope</string> </value>
<key> <string>comment</string> </key> </item>
<value> <item>
<none/> <key> <string>comment</string> </key>
</value> <value>
</item> <none/>
<item> </value>
<key> <string>error_message</string> </key> </item>
<value> <string></string> </value> <item>
</item> <key> <string>error_message</string> </key>
<item> <value> <string></string> </value>
<key> <string>serial</string> </key> </item>
<value> <string>962.25743.31377.26094</string> </value> <item>
</item> <key> <string>serial</string> </key>
<item> <value> <string>984.48957.14599.64153</string> </value>
<key> <string>state</string> </key> </item>
<value> <string>current</string> </value> <item>
</item> <key> <string>state</string> </key>
<item> <value> <string>current</string> </value>
<key> <string>time</string> </key> </item>
<value> <item>
<object> <key> <string>time</string> </key>
<klass> <value>
<global name="DateTime" module="DateTime.DateTime"/> <object>
</klass> <klass>
<tuple> <global name="DateTime" module="DateTime.DateTime"/>
<none/> </klass>
</tuple> <tuple>
<state> <none/>
<tuple> </tuple>
<float>1542008780.46</float> <state>
<string>GMT+9</string> <tuple>
</tuple> <float>1592917663.81</float>
</state> <string>UTC</string>
</object> </tuple>
</value> </state>
</item> </object>
</dictionary> </value>
</list> </item>
</tuple> </dictionary>
</list>
</value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
<record id="5" aka="AAAAAAAAAAU="> <record id="5" aka="AAAAAAAAAAU=">
......
...@@ -208,58 +208,62 @@ ...@@ -208,58 +208,62 @@
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<list> <key> <string>_log</string> </key>
<dictionary> <value>
<item> <list>
<key> <string>action</string> </key> <dictionary>
<value> <string>edit</string> </value> <item>
</item> <key> <string>action</string> </key>
<item> <value> <string>edit</string> </value>
<key> <string>actor</string> </key> </item>
<value> <string>zope</string> </value> <item>
</item> <key> <string>actor</string> </key>
<item> <value> <string>zope</string> </value>
<key> <string>comment</string> </key> </item>
<value> <item>
<none/> <key> <string>comment</string> </key>
</value> <value>
</item> <none/>
<item> </value>
<key> <string>error_message</string> </key> </item>
<value> <string></string> </value> <item>
</item> <key> <string>error_message</string> </key>
<item> <value> <string></string> </value>
<key> <string>serial</string> </key> </item>
<value> <string>958.54506.59269.33126</string> </value> <item>
</item> <key> <string>serial</string> </key>
<item> <value> <string>984.51645.41378.19729</string> </value>
<key> <string>state</string> </key> </item>
<value> <string>current</string> </value> <item>
</item> <key> <string>state</string> </key>
<item> <value> <string>current</string> </value>
<key> <string>time</string> </key> </item>
<value> <item>
<object> <key> <string>time</string> </key>
<klass> <value>
<global name="DateTime" module="DateTime.DateTime"/> <object>
</klass> <klass>
<tuple> <global name="DateTime" module="DateTime.DateTime"/>
<none/> </klass>
</tuple> <tuple>
<state> <none/>
<tuple> </tuple>
<float>1493058339.45</float> <state>
<string>UTC</string> <tuple>
</tuple> <float>1593352275.81</float>
</state> <string>UTC</string>
</object> </tuple>
</value> </state>
</item> </object>
</dictionary> </value>
</list> </item>
</tuple> </dictionary>
</list>
</value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
<record id="5" aka="AAAAAAAAAAU="> <record id="5" aka="AAAAAAAAAAU=">
......
...@@ -27,8 +27,10 @@ ...@@ -27,8 +27,10 @@
////////////////////////////////////////////// //////////////////////////////////////////////
// acquired method // acquired method
////////////////////////////////////////////// //////////////////////////////////////////////
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("getUrlFor", "getUrlFor") .declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("translateHtml", "translateHtml") .declareAcquiredMethod("translateHtml", "translateHtml")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("redirect", "redirect") .declareAcquiredMethod("redirect", "redirect")
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
...@@ -260,7 +262,12 @@ ...@@ -260,7 +262,12 @@
}); });
}, false, true) }, false, true)
.onEvent('click', function (evt) {
if ((evt.target.nodeType === Node.ELEMENT_NODE) &&
(evt.target.tagName === 'BUTTON')) {
return this.toggle();
}
}, false, false)
.onEvent('blur', function (evt) { .onEvent('blur', function (evt) {
// XXX Horrible hack to clear the search when focus is lost // XXX Horrible hack to clear the search when focus is lost
// This does not follow renderJS design, as a gadget should not touch // This does not follow renderJS design, as a gadget should not touch
......
...@@ -208,58 +208,62 @@ ...@@ -208,58 +208,62 @@
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<list> <key> <string>_log</string> </key>
<dictionary> <value>
<item> <list>
<key> <string>action</string> </key> <dictionary>
<value> <string>edit</string> </value> <item>
</item> <key> <string>action</string> </key>
<item> <value> <string>edit</string> </value>
<key> <string>actor</string> </key> </item>
<value> <string>zope</string> </value> <item>
</item> <key> <string>actor</string> </key>
<item> <value> <string>zope</string> </value>
<key> <string>comment</string> </key> </item>
<value> <item>
<none/> <key> <string>comment</string> </key>
</value> <value>
</item> <none/>
<item> </value>
<key> <string>error_message</string> </key> </item>
<value> <string></string> </value> <item>
</item> <key> <string>error_message</string> </key>
<item> <value> <string></string> </value>
<key> <string>serial</string> </key> </item>
<value> <string>976.15074.42522.46830</string> </value> <item>
</item> <key> <string>serial</string> </key>
<item> <value> <string>984.51645.41378.19729</string> </value>
<key> <string>state</string> </key> </item>
<value> <string>current</string> </value> <item>
</item> <key> <string>state</string> </key>
<item> <value> <string>current</string> </value>
<key> <string>time</string> </key> </item>
<value> <item>
<object> <key> <string>time</string> </key>
<klass> <value>
<global name="DateTime" module="DateTime.DateTime"/> <object>
</klass> <klass>
<tuple> <global name="DateTime" module="DateTime.DateTime"/>
<none/> </klass>
</tuple> <tuple>
<state> <none/>
<tuple> </tuple>
<float>1559893029.52</float> <state>
<string>UTC</string> <tuple>
</tuple> <float>1593352467.41</float>
</state> <string>UTC</string>
</object> </tuple>
</value> </state>
</item> </object>
</dictionary> </value>
</list> </item>
</tuple> </dictionary>
</list>
</value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
<record id="5" aka="AAAAAAAAAAU="> <record id="5" aka="AAAAAAAAAAU=">
......
from zExceptions import Unauthorized
import json
absolute_url = context.absolute_url() absolute_url = context.absolute_url()
request_url = "%s/SupportRequestModule_viewLastSupportRequestListAsRss" % (absolute_url,) request_url = "%s/SupportRequestModule_viewLastSupportRequestListAsRss" % (absolute_url,)
portal = context.getPortalObject() portal = context.getPortalObject()
person = portal.portal_membership.getAuthenticatedMember().getUserValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
if person is None: if person is None:
return json.dumps({'restricted_access_url': request_url}) return request_url
access_token = None access_token = None
...@@ -36,4 +33,4 @@ url = "%s?access_token=%s&access_token_secret=%s" % ( ...@@ -36,4 +33,4 @@ url = "%s?access_token=%s&access_token_secret=%s" % (
access_token.getId(), access_token.getId(),
reference) reference)
return json.dumps({'restricted_access_url': url}) return url
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>SupportRequestModule_generateRSSLinkAsJson</string> </value> <value> <string>SupportRequestModule_generateRSSLinkUrl</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
<?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>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>SupportRequestModule_viewGenerateRSSDialog</string> </value>
</item>
<item>
<key> <string>action_title</string> </key>
<value> <string>Refresh page</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>left</string>
<string>right</string>
<string>center</string>
<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/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>generate_rss_link_gadget</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SupportRequestModule_viewGenerateRSSLinkDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>GET</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>SupportRequestModule_generateRSSLink</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>report_view</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>Click the link bellow to obtain it</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>
div[data-gadget-url$="gadget_generate_rss_link.html"] button {
padding: 6pt;
background-color: #FF6600;
color: #FFFFFF;
border-radius: 0.325em;
border-width: 1px;
border-style: solid;
border-color: #FF6600;
min-width: 8em;
}
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>gadget_generate_rss_link.css</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/css</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></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="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</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>
<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>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_generate_rss_link.html</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<!DOCTYPE html>
<html>
<head>
<!--
data-i18n=Copied
-->
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<link rel="stylesheet" href="gadget_generate_rss_link.css">
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="gadget_generate_rss_link.js" type="text/javascript"></script>
</head>
<body>
<button type="button" class="ui-btn ui-icon-copy ui-btn-icon-notext ui-btn-right" data-i18n="[value]Copy to Clipboard">
Copy to Clipboard
</button>
</body>
</html>
\ No newline at end of file
/*global rJS, window, navigator, RSVP*/
/*jslint nomen: true, maxlen:80, indent:2*/
(function (rJS, window, navigator, RSVP) {
'use strict';
rJS(window)
.declareAcquiredMethod("getTranslationList", "getTranslationList")
.declareMethod('render', function (options) {
return this.changeState({
rss_url: options.rss_url
});
})
.onEvent(
'click',
function (evt) {
var gadget = this,
root = this.element,
button = evt.target,
button_text;
evt.preventDefault();
return gadget.getTranslationList(["Copied"])
.push(function (result) {
button_text = result[0];
button.classList.remove("ui-icon-copy");
return navigator.clipboard.writeText(gadget.state.rss_url);
})
.push(function () {
button.classList.add("ui-icon-check");
button.textContent = " " + button_text;
});
},
false,
false
);
}(rJS, window, navigator, RSVP));
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>must_revalidate_http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>gadget_generate_rss_link.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Support Request Module | fast_input Support Request Module | fast_input
Support Request Module | generate_rss_link
Support Request Module | officejs_support_request_view Support Request Module | officejs_support_request_view
Support Request Module | view_last_support_request Support Request Module | view_last_support_request
Support Request | officejs_support_request_view Support Request | officejs_support_request_view
\ No newline at end of file
...@@ -461,15 +461,14 @@ class TestSupportRequestRSSSOneEvent(SupportRequestRSSTestCase, DefaultTestRSSMi ...@@ -461,15 +461,14 @@ class TestSupportRequestRSSSOneEvent(SupportRequestRSSTestCase, DefaultTestRSSMi
self._checkRSS(response) self._checkRSS(response)
def test_RSS_with_token(self): def test_RSS_with_token(self):
response = self.publish( self.login(self.user.getUserId())
"%s/support_request_module/SupportRequestModule_generateRSSLinkAsJson" % self.getWebSite().getPath(), # get rss link url
basic='%s:%s' % (self.user.erp5_login.getReference(), self.user_password)) self.portal.support_request_module.SupportRequestModule_generateRSSLinkUrl()
restricted_access_url = json.loads(response.getBody())['restricted_access_url'] restricted_access_url = self.portal.REQUEST.form["your_rss_url"]
# make it relative url
parsed_url = urlparse.urlparse(restricted_access_url) parsed_url = urlparse.urlparse(restricted_access_url)
restricted_access_url = restricted_access_url.replace( restricted_access_url = restricted_access_url.replace(
'%s://%s' % (parsed_url.scheme, parsed_url.netloc), '', 1) '%s://%s' % (parsed_url.scheme, parsed_url.netloc), '', 1)
# and check it (this time the request is not basic-authenticated) # and check it
self._checkRSS(self.publish(restricted_access_url)) self._checkRSS(self.publish(restricted_access_url))
......
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