Commit 474cb152 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Include support to "delete" Sites, Projects and Computers Network

By "delete" is done by close Assigments or Invalidating Documents.
parent 996f521d
...@@ -173,13 +173,16 @@ ...@@ -173,13 +173,16 @@
.push(function () { .push(function () {
return RSVP.all([ return RSVP.all([
gadget.getUrlFor({command: "change", options: {editable: true}}), gadget.getUrlFor({command: "change", options: {editable: true}}),
gadget.getUrlFor({command: 'history_previous'}) gadget.getUrlFor({command: 'history_previous'}),
gadget.getUrlFor({command: "change", options: {page: "slap_delete_network"}})
]); ]);
}) })
.push(function (url_list) { .push(function (url_list) {
var header_dict = { var header_dict = {
selection_url: url_list[1], selection_url: url_list[1],
page_title: gadget.state.doc.title, page_title: "Computer Network :" + gadget.state.doc.title,
delete_url: url_list[2],
save_action: true save_action: true
}; };
if (!gadget.state.editable) { if (!gadget.state.editable) {
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>964.25688.27741.426</string> </value> <value> <string>965.52589.54650.15155</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1519840189.99</float> <float>1520446070.82</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<!doctype html>
<html>
<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_network.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_get", "jio_get")
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
/////////////////////////////////////////////////////////////////
// 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 + "/ComputerNetwork_invalidate", {});
});
})
.push(function () {
return gadget.notifySubmitted({message: 'Network is Deleted.', status: 'success'})
.push(function () {
// Workaround, find a way to open document without break gadget.
return gadget.redirect({"command": "change",
"options": {jio_key: "/", "page": "slap_network_list"}});
});
});
})
.declareMethod("triggerSubmit", function () {
return this.element.querySelector('button[type="submit"]').click();
})
.declareMethod("render", function (options) {
var gadget = this;
return 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 + "/ComputerNetwork_hasComputer")
]);
});
})
.push(function (result) {
options.doc = result[1];
options.can_delete = result[2] ? 0: 1;
return result[0].render({
erp5_document: {
"_embedded": {"_view": {
"my_title": {
"description": "",
"title": "Organisation to be removed: ",
"default": options.doc.title,
"css_class": "",
"required": 1,
"editable": 0,
"key": "title_label",
"hidden": 0,
"type": "StringField"
},
"message": {
"description": "",
"title": "Warning",
"default": "You cannot delete this object because you have associated Computers and/or services.",
"css_class": "",
"required": 1,
"editable": 0,
"key": "title_label",
"hidden": options.can_delete,
"type": "StringField"
},
"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"
}
}},
"_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 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: "Delete Network: " + 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>
<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("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')
/////////////////////////////////////////////////////////////////
// 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: 'Site is Deleted.', 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;
return 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")
]);
});
})
.push(function (result) {
options.doc = result[1];
options.can_delete = result[2] ? 0: 1;
return result[0].render({
erp5_document: {
"_embedded": {"_view": {
"my_title": {
"description": "",
"title": "Organisation to be removed: ",
"default": options.doc.title,
"css_class": "",
"required": 1,
"editable": 0,
"key": "title_label",
"hidden": 0,
"type": "StringField"
},
"message": {
"description": "",
"title": "Warning",
"default": "You cannot delete this object because you have associated Computers and/or services.",
"css_class": "",
"required": 1,
"editable": 0,
"key": "title_label",
"hidden": options.can_delete,
"type": "StringField"
},
"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"
}
}},
"_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 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: "Delete Site: " + 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>
<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_project.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_get", "jio_get")
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
/////////////////////////////////////////////////////////////////
// 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 + "/Project_closeRelatedAssignment", {});
});
})
.push(function () {
return gadget.notifySubmitted({message: 'Project is Deleted.', status: 'success'})
.push(function () {
// Workaround, find a way to open document without break gadget.
return gadget.redirect({"command": "change",
"options": {jio_key: "/", "page": "slap_project_list"}});
});
});
})
.declareMethod("triggerSubmit", function () {
return this.element.querySelector('button[type="submit"]').click();
})
.declareMethod("render", function (options) {
var gadget = this;
return 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 + "/Project_hasItem")
]);
});
})
.push(function (result) {
options.doc = result[1];
options.can_delete = result[2] ? 0: 1;
return result[0].render({
erp5_document: {
"_embedded": {"_view": {
"my_title": {
"description": "",
"title": "Project to be removed: ",
"default": options.doc.title,
"css_class": "",
"required": 1,
"editable": 0,
"key": "title_label",
"hidden": 0,
"type": "StringField"
},
"message": {
"description": "",
"title": "Warning",
"default": "You cannot delete this object because you have associated Computers and/or services.",
"css_class": "",
"required": 1,
"editable": 0,
"key": "title_label",
"hidden": options.can_delete,
"type": "StringField"
},
"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"
}
}},
"_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 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: "Delete Project: " + 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
...@@ -224,13 +224,15 @@ ...@@ -224,13 +224,15 @@
.push(function () { .push(function () {
return RSVP.all([ return RSVP.all([
gadget.getUrlFor({command: "change", options: {editable: true}}), gadget.getUrlFor({command: "change", options: {editable: true}}),
gadget.getUrlFor({command: 'history_previous'}) gadget.getUrlFor({command: 'history_previous'}),
gadget.getUrlFor({command: "change", options: {page: "slap_delete_organisation"}})
]); ]);
}) })
.push(function (url_list) { .push(function (url_list) {
var header_dict = { var header_dict = {
selection_url: url_list[1], selection_url: url_list[1],
page_title: "Site : " + gadget.state.doc.title, page_title: "Site : " + gadget.state.doc.title,
delete_url: url_list[2],
save_action: true save_action: true
}; };
if (!gadget.state.editable) { if (!gadget.state.editable) {
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>965.22310.48800.7492</string> </value> <value> <string>965.52584.49861.44168</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1519839885.6</float> <float>1520446173.3</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -186,13 +186,15 @@ ...@@ -186,13 +186,15 @@
.push(function () { .push(function () {
return RSVP.all([ return RSVP.all([
gadget.getUrlFor({command: "change", options: {editable: true}}), gadget.getUrlFor({command: "change", options: {editable: true}}),
gadget.getUrlFor({command: 'history_previous'}) gadget.getUrlFor({command: 'history_previous'}),
gadget.getUrlFor({command: "change", options: {page: "slap_delete_project"}})
]); ]);
}) })
.push(function (url_list) { .push(function (url_list) {
var header_dict = { var header_dict = {
selection_url: url_list[1], selection_url: url_list[1],
page_title: gadget.state.doc.title, page_title: gadget.state.doc.title,
delete_url: url_list[2],
save_action: true save_action: true
}; };
if (!gadget.state.editable) { if (!gadget.state.editable) {
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>964.25686.34120.2013</string> </value> <value> <string>966.1465.5891.38400</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1519840228.63</float> <float>1520445845.37</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -281,6 +281,12 @@ gadget_erp5_page_slap_computer_view.html\n ...@@ -281,6 +281,12 @@ gadget_erp5_page_slap_computer_view.html\n
gadget_erp5_page_slap_computer_view.js\n gadget_erp5_page_slap_computer_view.js\n
gadget_erp5_page_slap_controller.html\n gadget_erp5_page_slap_controller.html\n
gadget_erp5_page_slap_controller.js\n gadget_erp5_page_slap_controller.js\n
gadget_erp5_page_slap_delete_network.html\n
gadget_erp5_page_slap_delete_network.js\n
gadget_erp5_page_slap_delete_organisation.html\n
gadget_erp5_page_slap_delete_organisation.js\n
gadget_erp5_page_slap_delete_project.html\n
gadget_erp5_page_slap_delete_project.js\n
gadget_erp5_page_slap_destroy_hosting_subscription.html\n gadget_erp5_page_slap_destroy_hosting_subscription.html\n
gadget_erp5_page_slap_destroy_hosting_subscription.js\n gadget_erp5_page_slap_destroy_hosting_subscription.js\n
gadget_erp5_page_slap_destroy_software_installation.html\n gadget_erp5_page_slap_destroy_software_installation.html\n
...@@ -528,7 +534,7 @@ NETWORK:\n ...@@ -528,7 +534,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>965.45297.23136.9335</string> </value> <value> <string>966.2885.21812.19797</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -546,7 +552,7 @@ NETWORK:\n ...@@ -546,7 +552,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1520530879.9</float> <float>1520544707.03</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
import json
return json.dumps(len(context.getSubordinationRelatedList(portal_type="Computer")))
<?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>ComputerNetwork_hasComputer</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>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>ComputerNetwork_invalidate</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
person = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
for assignment in person.objectValues(portal_type="Assignment"):
if assignment.getDestination() == context.getRelativeUrl():
assignment.close()
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></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>
import json
kw = {"node_uid": context.getUid(),
"at_date": DateTime(),
"limit": 1}
return json.dumps(len(context.portal_simulation.getCurrentTrackingList(**kw)))
<?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>Organisation_hasItem</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
person = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
for assignment in person.objectValues(portal_type="Assignment"):
if assignment.getDestinationProject() == context.getRelativeUrl():
assignment.close()
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></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>Project_closeRelatedAssignment</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
# This script might not be efficient to a large quantities of
# Computers
from DateTime import DateTime
import json
kw = {"project_uid": context.getUid(),
"at_date": DateTime(),
"limit": 1}
return json.dumps(len(context.portal_simulation.getCurrentTrackingList(**kw)))
<?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>Project_hasItem</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
web_page_module/rjs_gadget_erp5_page_map_css web_page_module/rjs_gadget_erp5_page_map_css
web_page_module/rjs_gadget_erp5_panel_shortcut_html
web_page_module/rjs_gadget_erp5_panel_shortcut_js
web_page_module/rjs_gadget_erp5_page_slap_parameter_form_css web_page_module/rjs_gadget_erp5_page_slap_parameter_form_css
web_page_module/rjs_gadget_erp5_page_slap_transfer_computer_js web_page_module/rjs_gadget_erp5_page_slap_transfer_computer_js
web_page_module/rjs_gadget_erp5_page_slap_transfer_computer_html web_page_module/rjs_gadget_erp5_page_slap_transfer_computer_html
...@@ -142,5 +144,11 @@ web_page_module/rjs_gadget_erp5_page_slap_sale_invoice_transaction_view_js ...@@ -142,5 +144,11 @@ web_page_module/rjs_gadget_erp5_page_slap_sale_invoice_transaction_view_js
web_page_module/rjs_gadget_erp5_page_slap_sale_invoice_transaction_view_html web_page_module/rjs_gadget_erp5_page_slap_sale_invoice_transaction_view_html
web_page_module/rjs_gadget_slapos_payment_result_js web_page_module/rjs_gadget_slapos_payment_result_js
web_page_module/rjs_gadget_erp5_page_slap_payment_result_html web_page_module/rjs_gadget_erp5_page_slap_payment_result_html
web_page_module/rjs_gadget_erp5_page_slap_delete_network_js
web_page_module/rjs_gadget_erp5_page_slap_delete_network_html
web_page_module/rjs_gadget_erp5_page_slap_delete_organisation_js
web_page_module/rjs_gadget_erp5_page_slap_delete_project_js
web_page_module/rjs_gadget_erp5_page_slap_delete_organisation_html
web_page_module/rjs_gadget_erp5_page_slap_delete_project_html
web_site_module/hostingjs web_site_module/hostingjs
web_site_module/hostingjs/** web_site_module/hostingjs/**
\ No newline at end of file
...@@ -34,6 +34,12 @@ web_page_module/rjs_gadget_erp5_page_slap_computer_view_html ...@@ -34,6 +34,12 @@ web_page_module/rjs_gadget_erp5_page_slap_computer_view_html
web_page_module/rjs_gadget_erp5_page_slap_computer_view_js web_page_module/rjs_gadget_erp5_page_slap_computer_view_js
web_page_module/rjs_gadget_erp5_page_slap_controller_html web_page_module/rjs_gadget_erp5_page_slap_controller_html
web_page_module/rjs_gadget_erp5_page_slap_controller_js web_page_module/rjs_gadget_erp5_page_slap_controller_js
web_page_module/rjs_gadget_erp5_page_slap_delete_network_html
web_page_module/rjs_gadget_erp5_page_slap_delete_network_js
web_page_module/rjs_gadget_erp5_page_slap_delete_organisation_html
web_page_module/rjs_gadget_erp5_page_slap_delete_organisation_js
web_page_module/rjs_gadget_erp5_page_slap_delete_project_html
web_page_module/rjs_gadget_erp5_page_slap_delete_project_js
web_page_module/rjs_gadget_erp5_page_slap_destroy_hosting_subscription_html web_page_module/rjs_gadget_erp5_page_slap_destroy_hosting_subscription_html
web_page_module/rjs_gadget_erp5_page_slap_destroy_hosting_subscription_js web_page_module/rjs_gadget_erp5_page_slap_destroy_hosting_subscription_js
web_page_module/rjs_gadget_erp5_page_slap_destroy_software_installation_html web_page_module/rjs_gadget_erp5_page_slap_destroy_software_installation_html
...@@ -102,6 +108,8 @@ web_page_module/rjs_gadget_erp5_page_slapos_html ...@@ -102,6 +108,8 @@ web_page_module/rjs_gadget_erp5_page_slapos_html
web_page_module/rjs_gadget_erp5_page_slapos_html web_page_module/rjs_gadget_erp5_page_slapos_html
web_page_module/rjs_gadget_erp5_page_slapos_js web_page_module/rjs_gadget_erp5_page_slapos_js
web_page_module/rjs_gadget_erp5_page_slapos_request_form_html web_page_module/rjs_gadget_erp5_page_slapos_request_form_html
web_page_module/rjs_gadget_erp5_panel_shortcut_html
web_page_module/rjs_gadget_erp5_panel_shortcut_js
web_page_module/rjs_gadget_erp5_pt_form_slapos_index_html web_page_module/rjs_gadget_erp5_pt_form_slapos_index_html
web_page_module/rjs_gadget_erp5_pt_form_slapos_index_js web_page_module/rjs_gadget_erp5_pt_form_slapos_index_js
web_page_module/rjs_gadget_slapos_appcache web_page_module/rjs_gadget_slapos_appcache
......
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