Commit f2e88876 authored by Romain Courteaud's avatar Romain Courteaud

slapos_jio_before_deletion: drop organisation/site pages

parent 0d758a48
<!doctype html>
<html>
<!--
data-i18n=Site is Deleted.
data-i18n=Organisation to be removed:
data-i18n=Warning
data-i18n=You cannot delete this object because you have associated Compute Nodes and/or services.
data-i18n=Parent Relative Url
data-i18n=Delete Site:
-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Delete Project</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_erp5_page_slap_delete_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 */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP) {
"use strict";
rJS(window)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("updatePanel", "updatePanel")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("jio_post", "jio_post")
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.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 form_gadget.getContent();
})
.push(function (doc) {
return gadget.getSetting("hateoas_url")
.push(function (url) {
return gadget.jio_putAttachment(doc.relative_url,
url + doc.relative_url + "/Organisation_closeRelatedAssignment", {});
});
})
.push(function () {
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: "/", "page": "slap_site_list"}});
});
});
})
.declareMethod("triggerSubmit", function () {
return this.element.querySelector('button[type="submit"]').click();
})
.declareMethod("render", function (options) {
var gadget = this,
page_title_translation,
translation_list = [
"Site is Deleted.",
"Organisation to be removed:",
"Warning",
"You cannot delete this object because you have associated Compute Nodes and/or services.",
"Parent Relative Url",
"Delete Site:"
];
return new RSVP.Queue()
.push(function () {
return gadget.getSetting("hateoas_url")
.push(function (url) {
return RSVP.all([
gadget.getDeclaredGadget('form_view'),
gadget.jio_get(options.jio_key),
gadget.jio_getAttachment(options.jio_key,
url + options.jio_key + "/Organisation_hasItem"),
gadget.getTranslationList(translation_list)
]);
});
})
.push(function (result) {
options.doc = result[1];
options.can_delete = result[2] ? 0 : 1;
gadget.message_translation = result[3][0];
page_title_translation = result[3][5];
return result[0].render({
erp5_document: {
"_embedded": {"_view": {
"my_title": {
"description": "",
"title": result[3][1],
"default": options.doc.title,
"css_class": "",
"required": 1,
"editable": 0,
"key": "title_label",
"hidden": 0,
"type": "StringField"
},
"message": {
"description": "",
"title": result[3][2],
"default": result[3][3],
"css_class": "",
"required": 1,
"editable": 0,
"key": "title_label",
"hidden": options.can_delete,
"type": "StringField"
},
"my_relative_url": {
"description": "",
"title": result[3][4],
"default": options.jio_key,
"css_class": "",
"required": 1,
"editable": 1,
"key": "relative_url",
"hidden": 1,
"type": "StringField"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
}
}
},
form_definition: {
group_list: [[
"left",
[["my_title"], ["my_relative_url"]]
], [
"bottom",
[["message"]]
]]
}
});
})
.push(function () {
return gadget.updatePanel({
jio_key: "organisation_module"
});
})
.push(function () {
return RSVP.all([
gadget.getUrlFor({command: "change", options: {editable: true}}),
gadget.getUrlFor({command: 'history_previous'})
]);
})
.push(function (result) {
var header_dict = {
selection_url: result[1],
page_title: page_title_translation + " " + options.doc.title
};
if (options.can_delete) {
header_dict.submit_action = true;
}
return gadget.updateHeader(header_dict);
});
});
}(window, rJS, RSVP));
\ No newline at end of file
<!doctype html>
<html>
<!--
data-i18n=New Invitation link generated.
data-i18n=Parent Relative Url
data-i18n=Your Invitation Link
data-i18n=Generate New Invitation Link
-->
<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_organisation_get_invitation_link.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("updatePanel", "updatePanel")
.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')
.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 form_gadget.getContent();
})
.push(function (doc) {
return gadget.getSetting("hateoas_url")
.push(function (url) {
return gadget.jio_getAttachment(doc.relative_url,
url + doc.relative_url + "/Base_getInvitationLink");
})
.push(function (result) {
return gadget.notifySubmitted({message: gadget.message_translation, status: 'success'})
.push(function () {
// Workaround, find a way to open document without break gadget.
result.jio_key = doc.relative_url;
return gadget.render(result);
});
});
});
})
.declareMethod("triggerSubmit", function () {
return this.element.querySelector('button[type="submit"]').click();
})
.declareMethod("render", function (options) {
var gadget = this,
page_title_translation,
translation_list = [
"New Invitation link generated.",
"Parent Relative Url",
"Your Invitation Link",
"Generate New Invitation Link"
];
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][3];
return result[0].render({
erp5_document: {
"_embedded": {"_view": {
"my_relative_url": {
"description": "",
"title": result[1][1],
"default": options.jio_key,
"css_class": "",
"required": 1,
"editable": 1,
"key": "relative_url",
"hidden": 1,
"type": "StringField"
},
"my_invitation_link": {
"description": "",
"title": result[1][2],
"default": options.invitation_link,
"css_class": "",
"required": 1,
"editable": 0,
"key": "invitation_link",
"hidden": (options.invitation_link === undefined) ? 1 : 0,
"type": "StringField"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
}
}
},
form_definition: {
group_list: [[
"center",
[["my_invitation_link"], ["my_relative_url"]]
]]
}
});
})
.push(function () {
return gadget.updatePanel({
jio_key: "organisation_module"
});
})
.push(function () {
return RSVP.all([
gadget.getUrlFor({command: 'history_previous'})
]);
})
.push(function (url_list) {
var header_dict = {
page_title: page_title_translation,
submit_action: true,
selection_url: url_list[0]
};
return gadget.updateHeader(header_dict);
});
});
}(window, rJS, RSVP));
\ No newline at end of file
<!DOCTYPE html>
<html>
<!--
data-i18n=Data updated
data-i18n=Title
data-i18n=Email
data-i18n=Organisation
-->
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>Site List</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_erp5_page_slap_organisation_view.js" type="text/javascript"></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("updatePanel", "updatePanel")
.declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("updateDocument", "updateDocument")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("translate", "translate")
.declareAcquiredMethod("getTranslationList", "getTranslationList")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function (options) {
return this.changeState({
jio_key: options.jio_key,
doc: options.doc,
editable: 1
});
})
.allowPublicAcquisition("jio_allDocs", function (param_list) {
var gadget = this;
return gadget.jio_allDocs(param_list[0])
.push(function (result) {
var i, value, len = result.data.total_rows;
for (i = 0; i < len; i += 1) {
if (1 || (result.data.rows[i].value.hasOwnProperty("title"))) {
value = result.data.rows[i].value.title;
result.data.rows[i].value.title = {
field_gadget_param : {
css_class: "",
"default": value,
key: "title",
editable: 1,
url: "gadget_slapos_label_listbox_field.html",
title: "Title",
type: "GadgetField"
}
};
value = result.data.rows[i].value.default_email_text;
result.data.rows[i].value.default_email_text = {
field_gadget_param : {
css_class: "",
"default": value,
key: "default_email_text",
editable: 1,
url: "gadget_slapos_label_listbox_field.html",
title: "Status",
type: "GadgetField"
}
};
result.data.rows[i].value["listbox_uid:list"] = {
key: "listbox_uid:list",
value: 2713
};
}
}
return result;
});
})
.onEvent('submit', function () {
var gadget = this;
return gadget.notifySubmitting()
.push(function () {
return gadget.getDeclaredGadget('form_view');
})
.push(function (form_gadget) {
return form_gadget.getContent();
})
.push(function (content) {
return gadget.updateDocument(content);
})
.push(function () {
return gadget.notifySubmitted({message: gadget.message_translation, status: 'success'});
});
})
.declareMethod("triggerSubmit", function () {
return this.element.querySelector('button[type="submit"]').click();
})
.onStateChange(function () {
var gadget = this,
organisation_translation,
translation_list = [
"Title",
"Email",
"Reference",
"Associated Persons",
"Organisation",
"Data updated."
];
return new RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.getDeclaredGadget('form_view'),
gadget.getSetting("hateoas_url"),
gadget.getTranslationList(translation_list)
]);
})
.push(function (result) {
gadget.message_translation = result[2][5];
var column_list = [
['title', result[2][0]],
['default_email_text', result[2][1]]
],
editable = gadget.state.editable;
organisation_translation = result[2][4];
return result[0].render({
erp5_document: {
"_embedded": {"_view": {
"my_title": {
"description": "",
"title": result[2][0],
"default": gadget.state.doc.title,
"css_class": "",
"required": 1,
"editable": editable,
"key": "title",
"hidden": 0,
"type": "StringField"
},
"my_reference": {
"description": "",
"title": result[2][2],
"default": gadget.state.doc.reference,
"css_class": "",
"required": 1,
"editable": 0,
"key": "reference",
"hidden": 0,
"type": "StringField"
},
"listbox": {
"column_list": column_list,
"show_anchor": 0,
"default_params": {},
"editable": 1,
"editable_column_list": [],
"key": "slap_organisation_compute_node_listbox",
"lines": 10,
"list_method": "Organisation_getAssociatedPersonList",
"list_method_template": result[1] + "ERP5Document_getHateoas?mode=search&" +
"list_method=Organisation_getAssociatedPersonList&relative_url=" +
gadget.state.jio_key + "&default_param_json=eyJpZ25vcmVfdW5rbm93bl9jb2x1bW5zIjogdHJ1ZX0={&query,select_list*,limit*,sort_on*,local_roles*}",
"query": "urn:jio:allDocs?query=",
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
"sort": [["title", "ascending"]],
"title": result[2][3],
"type": "ListBox"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
}
}
},
form_definition: {
group_list: [[
"left",
[["my_title"], ["my_reference"]]
], [
"bottom",
[["listbox"]]
]]
}
});
})
.push(function () {
return gadget.updatePanel({
jio_key: "organisation_module"
});
})
.push(function () {
return RSVP.all([
gadget.getUrlFor({command: "change", options: {editable: true}}),
gadget.getUrlFor({command: "change", options: {page: "slap_person_view"}}),
gadget.getUrlFor({command: "change", options: {page: "slap_delete_organisation"}}),
gadget.getUrlFor({command: "change", options: {page: "slap_organisation_get_invitation_link"}})
]);
})
.push(function (url_list) {
var header_dict = {
selection_url: url_list[1],
page_title: organisation_translation + " : " + gadget.state.doc.title,
delete_url: url_list[2],
invitation_url: url_list[3],
save_action: true
};
if (!gadget.state.editable) {
header_dict.edit_content = url_list[0];
}
return gadget.updateHeader(header_dict);
});
});
}(window, rJS, RSVP));
\ No newline at end of file
<!DOCTYPE html>
<html>
<!--
data-i18n=Title
data-i18n=Reference
data-i18n=Region
data-i18n=Status
data-i18n=Sites
-->
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>Site List</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_slapos_utils.js" type="text/javascript"></script>
<script src="gadget_erp5_page_slap_site_list.js" type="text/javascript"></script>
</head>
<body>
<div data-gadget-url="gadget_erp5_pt_form_list.html" data-gadget-scope="form_list"></div>
</body>
</html>
/*global window, rJS, RSVP, JSON */
/*jslint nomen: true, indent: 2, maxerr: 3*/
(function (window, rJS, RSVP, JSON) {
'use strict';
rJS(window)
.declareAcquiredMethod('updateHeader', 'updateHeader')
.declareAcquiredMethod('updatePanel', 'updatePanel')
.declareAcquiredMethod('redirect', 'redirect')
.declareAcquiredMethod('reload', 'reload')
.declareAcquiredMethod('getSetting', 'getSetting')
.declareAcquiredMethod('jio_get', 'jio_get')
.declareAcquiredMethod('getUrlFor', 'getUrlFor')
.declareAcquiredMethod('jio_allDocs', 'jio_allDocs')
.declareAcquiredMethod('jio_getAttachment', 'jio_getAttachment')
.declareAcquiredMethod('translate', 'translate')
.declareAcquiredMethod("getTranslationList", "getTranslationList")
.allowPublicAcquisition('jio_allDocs', function (param_list) {
var gadget = this;
return gadget.jio_allDocs(param_list[0]).push(function (result) {
var i,
value,
value_jio_key,
len = result.data.total_rows;
for (i = 0; i < len; i += 1) {
if (result.data.rows[i].value.hasOwnProperty('Organisation_getNewsDict')) {
value_jio_key = result.data.rows[i].id;
value = result.data.rows[i].value.Organisation_getNewsDict;
result.data.rows[i].value.Organisation_getNewsDict = {
field_gadget_param: {
css_class: '',
description: 'The Status',
hidden: 0,
default: "",
renderjs_extra: JSON.stringify({
jio_key: value_jio_key,
result: value
}),
key: 'status',
url: 'gadget_slapos_status.html',
title: 'Status',
type: 'GadgetField'
}
};
result.data.rows[i].value['listbox_uid:list'] = {
key: 'listbox_uid:list',
value: 2713
};
}
}
return result;
});
})
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod('triggerSubmit', function () {
var argument_list = arguments;
return this.getDeclaredGadget('form_list').push(function (gadget) {
return gadget.triggerSubmit.apply(gadget, argument_list);
});
})
.declareMethod('render', function () {
var gadget = this,
lines_limit,
sites_translation,
translation_list = [
"Title",
"Reference",
"Region",
"Status",
"Sites"
];
return new RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.getSetting('listbox_lines_limit', 20),
window.getSettingMe(gadget)
]);
})
.push(function (settings) {
lines_limit = settings[0];
return RSVP.all([
gadget.getDeclaredGadget('form_list'),
gadget.jio_get(settings[1]),
gadget.getTranslationList(translation_list)
]);
})
.push(function (result) {
var i,
destination_list,
column_list = [
['title', result[2][0]],
['reference', result[2][1]],
['Organisation_getNewsDict', result[2][3]]
];
destination_list = '%22NULL%22%2C';
sites_translation = result[2][4];
for (i in result[1].assignment_destination_list) {
if (result[1].assignment_destination_list.hasOwnProperty(i)) {
destination_list +=
'%22' + result[1].assignment_destination_list[i] + '%22%2C';
}
}
return result[0].render({
erp5_document: {
_embedded: {
_view: {
listbox: {
column_list: column_list,
show_anchor: 0,
default_params: {},
editable: 0,
editable_column_list: [],
key: 'slap_site_listbox',
lines: lines_limit,
list_method: 'portal_catalog',
query:
'urn:jio:allDocs?query=portal_type%3A%22' +
'Organisation' +
'%22%20AND%20role_title%3A%22Host%22%20AND%20' +
'relative_url%3A(' +
destination_list +
')',
portal_type: [],
search_column_list: column_list,
sort_column_list: column_list,
sort: [['title', 'ascending']],
title: sites_translation,
type: 'ListBox'
}
}
},
_links: {
type: {
// form_list display portal_type in header
name: ''
}
}
},
form_definition: {
group_list: [['bottom', [['listbox']]]]
}
});
})
.push(function () {
return gadget.getSetting('frontpage_gadget');
})
.push(function (frontpage_gadget) {
return RSVP.all([
gadget.getUrlFor({ command: 'change', options: { page: frontpage_gadget}}),
gadget.updatePanel({jio_key: 'organisation_module'})
]);
})
.push(function (result) {
return gadget.updateHeader({
page_title: sites_translation,
selection_url: result[0],
filter_action: true
});
});
});
}(window, rJS, RSVP, JSON));
<!DOCTYPE html>
<html>
<!--
data-i18n=Title
data-i18n=Reference
data-i18n=Latitude
data-i18n=Longitude
data-i18n=Monitoring
data-i18n=Map
data-i18n=Associated Servers
data-i18n=Site:
data-i18n=Site
data-i18n=The Status
data-i18n=Status
data-i18n=Data updated.
-->
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>Site List</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_erp5_page_slap_site_view.js" type="text/javascript"></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>
from zExceptions import Unauthorized
portal = context.getPortalObject()
person = portal.portal_membership.getAuthenticatedMember().getUserValue()
if person is None:
message_str = "Please login before access the invitation link."
return context.REQUEST.RESPONSE.redirect(
context.getWebSectionValue().absolute_url() + \
"/join_form?portal_status_message=" + \
context.Base_translateString(message_str))
def redirect(message, message_type):
return context.REQUEST.RESPONSE.redirect(
context.getWebSiteValue().absolute_url() + \
"/#/?page=slap_notify_and_redirect&message_type=%s" % message_type + \
"&portal_status_message=%s" % context.Base_translateString(message))
if invitation_token is None:
message_str = "The Invitation Token is not present on the URL, please review the URL."
return redirect(message_str, "error")
if context.getPortalType() != "Organisation":
raise Unauthorized("Context is not an Organisation")
try:
invitation_token = portal.invitation_token_module[invitation_token]
except KeyError:
message_str = "The Invitation Token can't be found, please review the URL."
return redirect(message_str, "error")
if invitation_token.getPortalType() != "Invitation Token":
message_str = "The Invitation Token can't be found, please review the URL."
return redirect(message_str, "error")
if invitation_token.getValidationState() != "validated":
message_str = "The Invitation Token was already used and it cannot be reused, please ask a new one."
return redirect(message_str, "error")
if invitation_token.getSourceValue() == person:
message_str = "Invitation Token cannot be used by the same user that generated the token!"
return redirect(message_str, "error")
for assignment in person.objectValues(portal_type="Assignment"):
if assignment.getSubordination() == context.getRelativeUrl():
invitation_token.invalidate(comment="User already has assignment to the Person")
message_str = "You sucessfully join a new organisation: %s." % context.getTitle()
return redirect(message_str, "success")
person.newContent(
title="Assigment for Organisation %s" % context.getTitle(),
portal_type="Assignment",
destination_value=context).open()
invitation_token.invalidate()
message_str = "You sucessfully join a new organisation: %s." % context.getTitle()
return redirect(message_str, "success")
<?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>invitation_token=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Organisation_acceptInvitation</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Organisation_closeRelatedAssignment</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from Products.ERP5Type.Document import newTempBase
temp_object_list = []
for assignment in context.getDestinationRelatedValueList(portal_type="Assignment"):
person = assignment.getParentValue()
temp_object_list.append(
newTempBase(
context, str(person.getId()),
title=person.getTitle(),
default_email_text=person.getDefaultEmailText()
)
)
return temp_object_list
<?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>**kw</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Organisation_getAssociatedPersonList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
import json
return json.dumps(len(context.Organisation_getComputeNodeTrackingList()))
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