Commit f6f7d751 authored by Romain Courteaud's avatar Romain Courteaud

slapos_jio: drop add_organisation page

parent 500724b0
<!doctype html>
<html>
<!--
data-i18n=New Site created.
data-i18n=The name of a document in ERP5
data-i18n=Title
data-i18n=Role Definition
data-i18n=Role
data-i18n=Portal Type
data-i18n=Organisation
data-i18n=Parent Relative Url
data-i18n=New Site
-->
<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_add_organisation.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, jIO */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, jIO) {
"use strict";
rJS(window)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("updatePanel", "updatePanel")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("getSettingList", "getSettingList")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
.declareAcquiredMethod("getTranslationList", "getTranslationList")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.allowPublicAcquisition('notifySubmit', function () {
return this.triggerSubmit();
})
.onEvent('submit', function () {
var gadget = this;
return gadget.notifySubmitting()
.push(function () {
return gadget.getDeclaredGadget('form_view');
})
.push(function (form_gadget) {
return RSVP.all([form_gadget.getContent(),
gadget.getSettingList(['me', 'hateoas_url'])]);
})
.push(function (result) {
var doc = result[0],
me = result[1][0],
url = result[1][1];
return gadget.jio_putAttachment(me,
url + me + "/Person_requestSite", {title: doc.title});
})
.push(function (attachment) {
return jIO.util.readBlobAsText(attachment.target.response);
})
.push(function (response) {
return JSON.parse(response.target.result);
})
.push(function (result) {
return gadget.notifySubmitted({message: gadget.message_translation, status: 'success'})
.push(function () {
// Workaround, find a way to open document without break gadget.
return gadget.redirect({"command": "change",
"options": {"jio_key": result.relative_url, "page": "slap_controller"}});
});
});
})
.declareMethod("triggerSubmit", function () {
return this.element.querySelector('button[type="submit"]').click();
})
.declareMethod("render", function () {
var gadget = this,
page_title_translation,
translation_list = [
"New Site created.",
"The name of a document in ERP5",
"Title",
"Role Definition",
"Role",
"Portal Type",
"Organisation",
"Parent Relative Url",
"New Site"
];
return new RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.getDeclaredGadget('form_view'),
gadget.getTranslationList(translation_list)
]);
})
.push(function (result) {
gadget.message_translation = result[1][0];
page_title_translation = result[1][8];
return result[0].render({
erp5_document: {
"_embedded": {"_view": {
"my_title": {
"description": result[1][1],
"title": result[1][2],
"default": "",
"css_class": "",
"required": 0,
"editable": 1,
"key": "title",
"hidden": 0,
"type": "StringField"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
}
}
},
form_definition: {
group_list: [[
"left",
[["my_title"]]
]]
}
});
})
.push(function () {
return gadget.updatePanel({
jio_key: "organisation_module"
});
})
.push(function () {
return RSVP.all([
gadget.getUrlFor({command: 'change', options: {page: "slap_site_list"}})
]);
})
.push(function (url_list) {
return gadget.updateHeader({
page_title: page_title_translation,
selection_url: url_list[0],
submit_action: true
});
});
});
}(window, rJS, RSVP, jIO));
\ No newline at end of file
......@@ -318,7 +318,6 @@
gadget.getUrlFor({command: "change", options: {jio_key: setting_list[0], page: "slap_person_request_certificate"}}),
gadget.getUrlFor({command: "change", options: {jio_key: setting_list[0], page: "slap_person_get_token"}}),
gadget.getUrlFor({command: "change", options: {jio_key: setting_list[0], page: "slap_person_add_erp5_login"}}),
gadget.getUrlFor({command: "change", options: {jio_key: setting_list[0], page: "slap_person_add_organisation"}}),
gadget.getUrlFor({command: "change", options: {page: setting_list[1]}}),
gadget.getUrlFor({command: "change", options: {jio_key: gadget.state.doc.contract_relative_url, page: "slap_controller"}}),
gadget.updatePanel({jio_key: "person_module"})
......
......@@ -247,7 +247,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1010.19461.30907.1177</string> </value>
<value> <string>1002.12197.26478.31573</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -267,7 +267,7 @@
</tuple>
<state>
<tuple>
<float>1692236428.78</float>
<float>1675077405.26</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -151,10 +151,6 @@
})
.push(function (frontpage_gadget) {
return RSVP.all([
gadget.getUrlFor({
command: 'change',
options: { page: 'slap_add_organisation' }
}),
gadget.getUrlFor({ command: 'change', options: { page: frontpage_gadget}}),
gadget.updatePanel({jio_key: 'organisation_module'})
]);
......@@ -162,9 +158,8 @@
.push(function (result) {
return gadget.updateHeader({
page_title: sites_translation,
selection_url: result[1],
filter_action: true,
add_url: result[0]
selection_url: result[0],
filter_action: true
});
});
});
......
......@@ -238,7 +238,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1010.39714.20170.25019</string> </value>
<value> <string>1002.12197.26478.31573</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -258,7 +258,7 @@
</tuple>
<state>
<tuple>
<float>1692645285.36</float>
<float>1675077353.2</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -41,7 +41,6 @@
// Include SlapOS specific items
['ticket_url', 'Add Ticket', 'ticket'],
['add_login_url', 'Add Login', 'plus'],
['add_organisation_url', 'Add Organisation', 'plus'],
['token_url', 'Token', 'key'],
['invitation_url', 'Invite User', 'key'],
['request_certificate_url', 'Request Certificate', 'certificate'],
......
......@@ -238,7 +238,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1006.58340.40727.23620</string> </value>
<value> <string>1004.63745.58194.23398</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -258,7 +258,7 @@
</tuple>
<state>
<tuple>
<float>1683730643.56</float>
<float>1675077311.89</float>
<string>UTC</string>
</tuple>
</state>
......
import json
portal = context.getPortalObject()
person = portal.portal_membership.getAuthenticatedMember().getUserValue()
request = context.REQUEST
response = request.RESPONSE
if person is None:
response.setStatus(403)
else:
request_kw = dict(organisation_title=title)
person.requestSite(**request_kw)
organisation_relative_url = request.get('organisation_relative_url')
organisation_reference = request.get('organisation_reference')
response.setHeader('Content-Type', "application/json")
return json.dumps({
"reference": organisation_reference,
"relative_url": organisation_relative_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>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</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>title</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Person_requestSite</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -16,8 +16,6 @@ web_page_module/rjs_gadget_erp5_page_slap_accept_upgrade_decision_html
web_page_module/rjs_gadget_erp5_page_slap_accept_upgrade_decision_js
web_page_module/rjs_gadget_erp5_page_slap_access_denied_view_html
web_page_module/rjs_gadget_erp5_page_slap_access_denied_view_js
web_page_module/rjs_gadget_erp5_page_slap_add_organisation_html
web_page_module/rjs_gadget_erp5_page_slap_add_organisation_js
web_page_module/rjs_gadget_erp5_page_slap_add_project_html
web_page_module/rjs_gadget_erp5_page_slap_add_project_js
web_page_module/rjs_gadget_erp5_page_slap_all_invoice_list_html
......
......@@ -16,8 +16,6 @@ web_page_module/rjs_gadget_erp5_page_slap_accept_upgrade_decision_html
web_page_module/rjs_gadget_erp5_page_slap_accept_upgrade_decision_js
web_page_module/rjs_gadget_erp5_page_slap_access_denied_view_html
web_page_module/rjs_gadget_erp5_page_slap_access_denied_view_js
web_page_module/rjs_gadget_erp5_page_slap_add_organisation_html
web_page_module/rjs_gadget_erp5_page_slap_add_organisation_js
web_page_module/rjs_gadget_erp5_page_slap_add_project_html
web_page_module/rjs_gadget_erp5_page_slap_add_project_js
web_page_module/rjs_gadget_erp5_page_slap_all_invoice_list_html
......
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