Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lu Xu
slapos.core
Commits
19965ffb
Commit
19965ffb
authored
Feb 04, 2014
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add webservice links custom to slapos.org website.
This is just a proof of concept without genericity.
parent
72b31104
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
1203 additions
and
18 deletions
+1203
-18
master/bt5/slapos_jio/ExtensionTemplateItem/HalStyle.py
master/bt5/slapos_jio/ExtensionTemplateItem/HalStyle.py
+10
-0
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_redirect.xml
...teItem/portal_skins/erp5_hal_json_style/Base_redirect.xml
+1
-1
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/Computer_requestInstallationFromJio.xml
...p5_hal_json_style/Computer_requestInstallationFromJio.xml
+74
-0
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/Computer_requestNewComputerCertificateFromJio.xml
...n_style/Computer_requestNewComputerCertificateFromJio.xml
+84
-0
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/Computer_revokeComputerCertificateFromJio.xml
..._json_style/Computer_revokeComputerCertificateFromJio.xml
+77
-0
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/Computer_updateAllocationScopeFromJio.xml
..._hal_json_style/Computer_updateAllocationScopeFromJio.xml
+106
-0
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
...tal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
+252
-16
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/HostingSubscription_changeRequestedStateFromJio.xml
...style/HostingSubscription_changeRequestedStateFromJio.xml
+85
-0
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/Person_requestComputerFromJio.xml
...ins/erp5_hal_json_style/Person_requestComputerFromJio.xml
+74
-0
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/Person_requestComputerNetworkFromJio.xml
...5_hal_json_style/Person_requestComputerNetworkFromJio.xml
+88
-0
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/Person_requestInstanceFromJio.xml
...ins/erp5_hal_json_style/Person_requestInstanceFromJio.xml
+82
-0
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/Person_requestTicketFromJio.xml
...skins/erp5_hal_json_style/Person_requestTicketFromJio.xml
+102
-0
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/SoftwareInstallation_destroyFromJio.xml
...p5_hal_json_style/SoftwareInstallation_destroyFromJio.xml
+73
-0
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/Ticket_updateFromJio.xml
...portal_skins/erp5_hal_json_style/Ticket_updateFromJio.xml
+93
-0
master/bt5/slapos_jio/bt/revision
master/bt5/slapos_jio/bt/revision
+1
-1
master/bt5/slapos_jio/bt/template_extension_id_list
master/bt5/slapos_jio/bt/template_extension_id_list
+1
-0
No files found.
master/bt5/slapos_jio/ExtensionTemplateItem/HalStyle.py
0 → 100644
View file @
19965ffb
def
Listbox_getListMethodName
(
self
,
field
):
""" XXXX"""
list_method
=
field
.
get_value
(
'list_method'
)
try
:
list_method_name
=
getattr
(
list_method
,
'method_name'
)
except
AttributeError
:
list_method_name
=
list_method
return
list_method_name
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_redirect.xml
View file @
19965ffb
...
@@ -67,7 +67,7 @@ request_form = context.ERP5Site_filterParameterList(request_form)\n
...
@@ -67,7 +67,7 @@ request_form = context.ERP5Site_filterParameterList(request_form)\n
request_form.update(keep_items)\n
request_form.update(keep_items)\n
\n
\n
if form_id == \'view\':\n
if form_id == \'view\':\n
redirect_url = context.absolute_url()\n
redirect_url =
"%s/ERP5Document_getHateoas" %
context.absolute_url()\n
else:\n
else:\n
redirect_url = \'%s/%s\' % (context.absolute_url(), form_id)\n
redirect_url = \'%s/%s\' % (context.absolute_url(), form_id)\n
\n
\n
...
...
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/Computer_requestInstallationFromJio.xml
0 → 100644
View file @
19965ffb
<?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>
_body
</string>
</key>
<value>
<string>
if REQUEST.other[\'method\'] != "POST":\n
response.setStatus(405)\n
return ""\n
\n
computer = context\n
computer.requestSoftwareRelease(software_release_url=software_release, state=\'available\')\n
\n
return context.REQUEST.get(\'software_installation_url\').Base_redirect()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
software_release, REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Computer_requestInstallationFromJio
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/Computer_requestNewComputerCertificateFromJio.xml
0 → 100644
View file @
19965ffb
<?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>
_body
</string>
</key>
<value>
<string>
if REQUEST.other[\'method\'] != "POST":\n
response.setStatus(405)\n
return ""\n
\n
import json\n
\n
computer = context\n
request = context.REQUEST\n
response = REQUEST.RESPONSE\n
\n
context.Base_prepareCorsResponse(RESPONSE=response)\n
\n
computer.generateCertificate()\n
\n
return json.dumps({\n
\'certificate\': request.get(\'computer_certificate\'),\n
\'key\': request.get(\'computer_key\')\n
}, indent=2)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Computer_requestNewComputerCertificateFromJio
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/Computer_revokeComputerCertificateFromJio.xml
0 → 100644
View file @
19965ffb
<?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>
_body
</string>
</key>
<value>
<string>
if REQUEST.other[\'method\'] != "POST":\n
response.setStatus(405)\n
return ""\n
\n
computer = context\n
response = REQUEST.RESPONSE\n
context.Base_prepareCorsResponse(RESPONSE=response)\n
\n
computer.revokeCertificate()\n
\n
return ""\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Computer_revokeComputerCertificateFromJio
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/Computer_updateAllocationScopeFromJio.xml
0 → 100644
View file @
19965ffb
<?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>
_body
</string>
</key>
<value>
<string>
if REQUEST.other[\'method\'] != "POST":\n
response.setStatus(405)\n
return ""\n
\n
portal = context.getPortalObject()\n
computer = context\n
\n
if allocation_scope == \'open/public\':\n
# Public computer capacity is handle by an alarm\n
capacity_scope = \'close\'\n
elif allocation_scope.startswith(\'open\'):\n
# Capacity is not handled for \'private\' computers\n
capacity_scope = \'open\'\n
else:\n
capacity_scope = \'close\'\n
\n
edit_kw = {\n
\'allocation_scope\': allocation_scope,\n
\'capacity_scope\': capacity_scope,\n
}\n
\n
self_person = computer.getSourceAdministrationValue(portal_type="Person")\n
self_email = self_person.getDefaultEmailCoordinateText()\n
if allocation_scope == \'open/public\':\n
# reset friends and update in place\n
edit_kw[\'subject_list\'] = [\'\']\n
edit_kw[\'destination_section\'] = None\n
elif allocation_scope == \'open/personal\':\n
# reset friends to self and update in place\n
edit_kw[\'subject_list\'] = [self_email]\n
edit_kw[\'destination_section_value\'] = self_person\n
else:\n
if self_email not in subject_list:\n
# add self as friend\n
subject_list.append(self_email)\n
edit_kw[\'subject_list\'] = subject_list\n
\n
computer.edit(**edit_kw)\n
\n
return ""\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
allocation_scope, subject_list, REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Computer_updateAllocationScopeFromJio
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
View file @
19965ffb
...
@@ -54,6 +54,8 @@
...
@@ -54,6 +54,8 @@
from zExceptions import Unauthorized\n
from zExceptions import Unauthorized\n
from AccessControl import getSecurityManager\n
from AccessControl import getSecurityManager\n
from ZTUtils import make_query\n
from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery\n
import json\n
import json\n
if REQUEST is None:\n
if REQUEST is None:\n
REQUEST = context.REQUEST\n
REQUEST = context.REQUEST\n
...
@@ -204,19 +206,19 @@ def renderForm(form, response_dict):\n
...
@@ -204,19 +206,19 @@ def renderForm(form, response_dict):\n
# context.log(field_property)\n
# context.log(field_property)\n
\n
\n
# group_list.append((group[\'gid\'], field_list))\n
# group_list.append((group[\'gid\'], field_list))\n
#
\n
\n
# group_list[-1][1].append(("form_id",
{\n
response_dict["form_id"] =
{\n
#
"type": "StringField",\n
"type": "StringField",\n
#
"key": "form_id",\n
"key": "form_id",\n
#
"default": form.id,\n
"default": form.id,\n
#
"editable": 0,\n
"editable": 0,\n
#
"css_class": "",\n
"css_class": "",\n
#
"hidden": 1,\n
"hidden": 1,\n
#
"description": "",\n
"description": "",\n
#
"title": "form_id",\n
"title": "form_id",\n
#
"required": 1,\n
"required": 1,\n
# }))
\n
}
\n
#
\n
\n
# response_dict["group_list"] = group_list\n
# response_dict["group_list"] = group_list\n
# rendered_response_dict["_embedded"] = {\n
# rendered_response_dict["_embedded"] = {\n
# "form": raw_response_dict\n
# "form": raw_response_dict\n
...
@@ -227,6 +229,7 @@ context.Base_prepareCorsResponse(RESPONSE=response)\n
...
@@ -227,6 +229,7 @@ context.Base_prepareCorsResponse(RESPONSE=response)\n
\n
\n
mime_type = \'application/hal+json\'\n
mime_type = \'application/hal+json\'\n
portal = context.getPortalObject()\n
portal = context.getPortalObject()\n
sql_catalog = context.portal_catalog.getSQLCatalog()\n
\n
\n
# Calculate the site root to prevent unexpected browsing\n
# Calculate the site root to prevent unexpected browsing\n
is_web_mode = (context.REQUEST.get(\'current_web_section\', None) is not None) or context.isWebMode()\n
is_web_mode = (context.REQUEST.get(\'current_web_section\', None) is not None) or context.isWebMode()\n
...
@@ -341,7 +344,7 @@ elif mode == \'document\':\n
...
@@ -341,7 +344,7 @@ elif mode == \'document\':\n
renderer_form = context.restrictedTraverse(form_id, None)\n
renderer_form = context.restrictedTraverse(form_id, None)\n
# XXX Proxy field are not correctly handled in context of web site\n
# XXX Proxy field are not correctly handled in context of web site\n
renderer_form = getattr(context, form_id)\n
renderer_form = getattr(context, form_id)\n
context.log(form_id)\n
#
context.log(form_id)\n
if (renderer_form is not None):\n
if (renderer_form is not None):\n
embedded_dict = {\n
embedded_dict = {\n
\'_links\': {\n
\'_links\': {\n
...
@@ -361,16 +364,19 @@ elif mode == \'document\':\n
...
@@ -361,16 +364,19 @@ elif mode == \'document\':\n
for group in renderer_form.Form_getGroupTitleAndId():\n
for group in renderer_form.Form_getGroupTitleAndId():\n
for field in renderer_form.get_fields_in_group(group[\'goid\']):\n
for field in renderer_form.get_fields_in_group(group[\'goid\']):\n
field_id = field.id\n
field_id = field.id\n
context.log(field_id)\n
#
context.log(field_id)\n
if field_id.startswith(\'my_\'):\n
if field_id.startswith(\'my_\'):\n
property_name = field_id[len(\'my_\'):]\n
property_name = field_id[len(\'my_\'):]\n
context.log(property_name)\n
#
context.log(property_name)\n
property_value = context.getProperty(property_name, d=None)\n
property_value = context.getProperty(property_name, d=None)\n
if (property_value is not None):\n
if (property_value is not None):\n
if not same_type(property_value, DateTime()):\n
if not same_type(property_value, DateTime()):\n
# XXX Serialize DateTime\n
# XXX Serialize DateTime\n
result_dict[property_name] = property_value \n
result_dict[property_name] = property_value \n
\n
\n
##############\n
# XXX Custom slapos code\n
##############\n
if is_site_root:\n
if is_site_root:\n
# Global action users for the jIO plugin\n
# Global action users for the jIO plugin\n
# XXX Would be better to not hardcode them but put them as portal type\n
# XXX Would be better to not hardcode them but put them as portal type\n
...
@@ -401,6 +407,233 @@ elif mode == \'document\':\n
...
@@ -401,6 +407,233 @@ elif mode == \'document\':\n
if person is not None:\n
if person is not None:\n
result_dict[\'_links\'][\'me\'] = {\n
result_dict[\'_links\'][\'me\'] = {\n
\'href\': \'%s/%s\' % (person.absolute_url(), script.id),\n
\'href\': \'%s/%s\' % (person.absolute_url(), script.id),\n
\'_relative_url\': person.getRelativeUrl()\n
}\n
\n
query = sql_catalog.buildQuery({\n
"portal_type": "Software Product",\n
"validation_state": \'published\'\n
}).asSearchTextExpression(sql_catalog)\n
http_query = make_query({\n
"mode": "search",\n
"query": query\n
})\n
result_dict[\'_links\'][\'slapos_jump\'] = {\n
"href": "%s/%s?%s" % (site_root.absolute_url(), script.id, http_query),\n
\'_query\': query,\n
\'name\': \'public_software_product\'\n
}\n
\n
else:\n
context_portal_type = context.getPortalType()\n
if context_portal_type == "Person":\n
query = sql_catalog.buildQuery({\n
"portal_type": "Hosting Subscription",\n
"default_destination_section_uid": context.getUid(),\n
"validation_state": \'validated\'\n
}).asSearchTextExpression(sql_catalog)\n
http_query = make_query({\n
"mode": "search",\n
"query": query\n
})\n
result_dict[\'_links\'][\'slapos_jump\'] = [{\n
"href": "%s/%s?%s" % (site_root.absolute_url(), script.id, http_query),\n
\'name\': \'current_hosting_subscription\',\n
\'_query\': query\n
}]\n
\n
# List of validated computers\n
query = sql_catalog.buildQuery({\n
"portal_type": "Computer",\n
"local_roles": "Assignee",\n
"default_strict_allocation_scope_uid": "!=%s" % context.getPortalObject().portal_categories.allocation_scope.close.forever.getUid(),\n
"validation_state": \'validated\'\n
}).asSearchTextExpression(sql_catalog)\n
http_query = make_query({\n
"mode": "search",\n
"query": query\n
})\n
result_dict[\'_links\'][\'slapos_jump\'].append({\n
"href": "%s/%s?%s" % (site_root.absolute_url(), script.id, http_query),\n
\'name\': \'current_computer\',\n
\'_query\': query\n
})\n
\n
# List of networks\n
query = sql_catalog.buildQuery({\n
"portal_type": "Computer Network",\n
"local_roles": "Assignee"\n
}).asSearchTextExpression(sql_catalog)\n
http_query = make_query({\n
"mode": "search",\n
"query": query\n
})\n
result_dict[\'_links\'][\'slapos_jump\'].append({\n
"href": "%s/%s?%s" % (site_root.absolute_url(), script.id, http_query),\n
\'name\': \'current_network\',\n
\'_query\': query\n
})\n
\n
# List of invoices\n
query = sql_catalog.buildQuery({\n
"portal_type": "Sale Invoice Transaction",\n
"default_destination_section_uid": context.getUid(),\n
"query": NegatedQuery(Query(title="Reversal Transaction for %")),\n
}).asSearchTextExpression(sql_catalog)\n
http_query = make_query({\n
"mode": "search",\n
"query": query\n
})\n
result_dict[\'_links\'][\'slapos_jump\'].append({\n
"href": "%s/%s?%s" % (site_root.absolute_url(), script.id, http_query),\n
\'name\': \'current_invoice\',\n
\'_query\': query\n
})\n
\n
# List of tickets\n
query = sql_catalog.buildQuery({\n
"portal_type": ["Support Request", "Regularisation Request"],\n
"default_destination_decision_uid": context.getUid(),\n
}).asSearchTextExpression(sql_catalog)\n
http_query = make_query({\n
"mode": "search",\n
"query": query\n
})\n
result_dict[\'_links\'][\'slapos_jump\'].append({\n
"href": "%s/%s?%s" % (site_root.absolute_url(), script.id, http_query),\n
\'name\': \'current_ticket\',\n
\'_query\': query\n
})\n
\n
action_dict[\'request\'] = {\n
\'href\': "%s/Person_requestInstanceFromJio" % context.absolute_url(),\n
\'method\': \'POST\'\n
}\n
action_dict[\'request_computer\'] = {\n
\'href\': "%s/Person_requestComputerFromJio" % context.absolute_url(),\n
\'method\': \'POST\'\n
}\n
action_dict[\'request_computer_network\'] = {\n
\'href\': "%s/Person_requestComputerNetworkFromJio" % context.absolute_url(),\n
\'method\': \'POST\'\n
}\n
action_dict[\'request_ticket\'] = {\n
\'href\': "%s/Person_requestTicketFromJio" % context.absolute_url(),\n
\'method\': \'POST\'\n
}\n
\n
elif context_portal_type == "Hosting Subscription":\n
# Link to all ongoing Hosting Subscriptions\n
query = sql_catalog.buildQuery({\n
"portal_type": ["Software Instance", "Slave Instance"],\n
"default_specialise_uid": context.getUid(),\n
"validation_state": \'validated\'\n
}).asSearchTextExpression(sql_catalog)\n
http_query = make_query({\n
"mode": "search",\n
"query": query\n
})\n
result_dict[\'_links\'][\'slapos_jump\'] = {\n
"href": "%s/%s?%s" % (site_root.absolute_url(), script.id, http_query),\n
\'name\': \'related_instance\',\n
\'_query\': query\n
}\n
\n
# Actions to modify the hosting subscription\n
action_dict[\'start\'] = {\n
\'href\': "%s/HostingSubscription_changeRequestedStateFromJio?action=started" % context.absolute_url(),\n
\'method\': \'POST\'\n
}\n
action_dict[\'stop\'] = {\n
\'href\': "%s/HostingSubscription_changeRequestedStateFromJio?action=stopped" % context.absolute_url(),\n
\'method\': \'POST\'\n
}\n
action_dict[\'destroy\'] = {\n
\'href\': "%s/HostingSubscription_changeRequestedStateFromJio?action=destroyed" % context.absolute_url(),\n
\'method\': \'POST\'\n
}\n
\n
elif context_portal_type == "Software Installation":\n
action_dict[\'destroy\'] = {\n
\'href\': "%s/SoftwareInstallation_destroyFromJio" % context.absolute_url(),\n
\'method\': \'POST\'\n
}\n
\n
elif context_portal_type == "Software Product":\n
# Link to all Software Releases\n
query = sql_catalog.buildQuery({\n
"portal_type": "Software Release",\n
"default_aggregate_uid": context.getUid(),\n
"validation_state": ["shared", "shared_alive", "released", "released_alive", "published", "published_alive"]\n
}).asSearchTextExpression(sql_catalog)\n
http_query = make_query({\n
"mode": "search",\n
"query": query\n
})\n
result_dict[\'_links\'][\'slapos_jump\'] = {\n
"href": "%s/%s?%s" % (site_root.absolute_url(), script.id, http_query),\n
\'name\': \'related_software_release\',\n
\'_query\': query\n
}\n
\n
elif context_portal_type == "Computer":\n
# Link to related Software Installation\n
query = sql_catalog.buildQuery({\n
"portal_type": "Software Installation",\n
"default_aggregate_uid": context.getUid(),\n
"validation_state": "validated"\n
}).asSearchTextExpression(sql_catalog)\n
http_query = make_query({\n
"mode": "search",\n
"query": query\n
})\n
result_dict[\'_links\'][\'slapos_jump\'] = {\n
"href": "%s/%s?%s" % (site_root.absolute_url(), script.id, http_query),\n
\'name\': \'related_software_installation\',\n
\'_query\': query\n
}\n
\n
action_dict[\'update_allocation_scope\'] = {\n
\'href\': "%s/Computer_updateAllocationScopeFromJio" % context.absolute_url(),\n
\'method\': \'POST\'\n
}\n
action_dict[\'generate_certificate\'] = {\n
\'href\': "%s/Computer_requestNewComputerCertificateFromJio" % context.absolute_url(),\n
\'method\': \'POST\'\n
}\n
action_dict[\'revoke_certificate\'] = {\n
\'href\': "%s/Computer_revokeComputerCertificateFromJio" % context.absolute_url(),\n
\'method\': \'POST\'\n
}\n
action_dict[\'request_installation\'] = {\n
\'href\': "%s/Person_requestInstallationFromJio" % context.absolute_url(),\n
\'method\': \'POST\'\n
}\n
\n
elif context_portal_type == "Sale Invoice Transaction":\n
result_dict[\'_links\'][\'slapos_jump\'] = {\n
"href": "%s/SaleInvoiceTransaction_viewSlapOSPrintout" % context.absolute_url(),\n
\'name\': \'current_printout\',\n
}\n
\n
elif context_portal_type in ["Support Request", "Regularisation Request"]:\n
# Link to all Events\n
query = sql_catalog.buildQuery({\n
"default_follow_up_uid": context.getUid(),\n
}).asSearchTextExpression(sql_catalog)\n
http_query = make_query({\n
"mode": "search",\n
"query": query\n
})\n
result_dict[\'_links\'][\'slapos_jump\'] = {\n
"href": "%s/%s?%s" % (site_root.absolute_url(), script.id, http_query),\n
\'name\': \'related_event\',\n
\'_query\': query\n
}\n
\n
action_dict[\'update\'] = {\n
\'href\': "%s/Ticket_updateFromJio" % context.absolute_url(),\n
\'method\': \'POST\'\n
}\n
}\n
\n
\n
# Define document action\n
# Define document action\n
...
@@ -442,6 +675,9 @@ elif mode == \'search\':\n
...
@@ -442,6 +675,9 @@ elif mode == \'search\':\n
document_result[select] = document.getProperty(select, d=None)\n
document_result[select] = document.getProperty(select, d=None)\n
result_list.append(document_result)\n
result_list.append(document_result)\n
result_dict[\'_embedded\'] = {"contents": result_list}\n
result_dict[\'_embedded\'] = {"contents": result_list}\n
result_dict[\'_query\'] = query\n
result_dict[\'_limit\'] = limit\n
result_dict[\'_select_list\'] = select_list\n
\n
\n
\n
\n
elif mode == \'newContent\':\n
elif mode == \'newContent\':\n
...
...
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/HostingSubscription_changeRequestedStateFromJio.xml
0 → 100644
View file @
19965ffb
<?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>
_body
</string>
</key>
<value>
<string>
if REQUEST.other[\'method\'] != "POST":\n
response.setStatus(405)\n
return ""\n
\n
if action not in ("started", "stopped", "destroyed"):\n
raise NotImplementedError, "Unknown action %s" % action\n
\n
person = context.getDestinationSectionValue()\n
person.requestSoftwareInstance(\n
state=action,\n
software_release=context.getUrlString(),\n
software_title=context.getTitle(),\n
software_type=context.getSourceReference(),\n
instance_xml=context.getTextContent(),\n
sla_xml=context.getSlaXml(),\n
shared=context.isRootSlave()\n
)\n
\n
context.Base_redirect()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
action, REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
HostingSubscription_changeRequestedStateFromJio
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/Person_requestComputerFromJio.xml
0 → 100644
View file @
19965ffb
<?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>
_body
</string>
</key>
<value>
<string>
if REQUEST.other[\'method\'] != "POST":\n
response.setStatus(405)\n
return ""\n
\n
person = context\n
\n
person.requestComputer(computer_title=computer_title)\n
return context.getPortalObject().restrictedTraverse(context.REQUEST.get(\'computer\')).Base_redirect()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
computer_title, REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Person_requestComputerFromJio
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/Person_requestComputerNetworkFromJio.xml
0 → 100644
View file @
19965ffb
<?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>
_body
</string>
</key>
<value>
<string>
if REQUEST.other[\'method\'] != "POST":\n
response.setStatus(405)\n
return ""\n
\n
portal = context.getPortalObject()\n
\n
network_portal_type = "Computer Network"\n
\n
reference = "NET-%s" % portal.portal_ids.generateNewId(\n
id_group=\'slap_network_reference\',\n
id_generator=\'uid\')\n
\n
module = portal.getDefaultModule(portal_type=network_portal_type)\n
network = module.newContent(\n
portal_type=network_portal_type,\n
title=network_title,\n
reference=reference,\n
source_administration=context.getRelativeUrl()\n
)\n
network.validate()\n
\n
return network.Base_redirect()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
network_title, REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Person_requestComputerNetworkFromJio
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/Person_requestInstanceFromJio.xml
0 → 100644
View file @
19965ffb
<?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>
_body
</string>
</key>
<value>
<string>
if REQUEST.other[\'method\'] != "POST":\n
response.setStatus(405)\n
return ""\n
\n
person = context\n
person.requestSoftwareInstance(\n
state=state,\n
software_release=software_release,\n
software_title=software_title,\n
software_type=software_type,\n
instance_xml=instance_xml,\n
sla_xml=sla_xml,\n
shared=int(shared)\n
)\n
\n
return context.REQUEST.get(\'request_hosting_subscription\').Base_redirect()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state, software_release, software_title, software_type, instance_xml, sla_xml, shared, REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Person_requestInstanceFromJio
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/Person_requestTicketFromJio.xml
0 → 100644
View file @
19965ffb
<?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>
_body
</string>
</key>
<value>
<string>
if REQUEST.other[\'method\'] != "POST":\n
response.setStatus(405)\n
return ""\n
\n
person = context\n
portal = person.getPortalObject()\n
\n
support_request_template = portal.restrictedTraverse(\n
portal.portal_preferences.getPreferredSupportRequestTemplate())\n
support_request = support_request_template.Base_createCloneDocument(batch_mode=1)\n
\n
support_request.edit(\n
title=title,\n
destination_decision_value=person,\n
resource=resource,\n
start_date=DateTime(),\n
)\n
support_request.validate(comment="Submitted from the web site contact form")\n
\n
web_message_template = portal.restrictedTraverse(\n
portal.portal_preferences.getPreferredWebMessageTemplate())\n
web_message = web_message_template.Base_createCloneDocument(batch_mode=1)\n
# XXX init script is not called when cloning?\n
web_message.Event_init()\n
web_message.edit(\n
title=title,\n
content_type="text/plain",\n
text_content=description,\n
source_value=person,\n
resource=resource,\n
start_date=DateTime(),\n
follow_up_value=support_request,\n
)\n
web_message.stop(comment="Submitted from the web site contact form")\n
\n
return support_request.Base_redirect()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
title, resource, description, REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Person_requestTicketFromJio
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/SoftwareInstallation_destroyFromJio.xml
0 → 100644
View file @
19965ffb
<?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>
_body
</string>
</key>
<value>
<string>
if REQUEST.other[\'method\'] != "POST":\n
response.setStatus(405)\n
return ""\n
\n
context.getAggregateValue(portal_type=\'Computer\').requestSoftwareRelease(software_release_url=context.getUrlString(), state=\'destroyed\')\n
\n
return ""\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
SoftwareInstallation_destroyFromJio
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/erp5_hal_json_style/Ticket_updateFromJio.xml
0 → 100644
View file @
19965ffb
<?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>
_body
</string>
</key>
<value>
<string>
if REQUEST.other[\'method\'] != "POST":\n
response.setStatus(405)\n
return ""\n
\n
ticket = context\n
portal = ticket.getPortalObject()\n
person = ticket.getDestinationDecisionValue()\n
\n
web_message_template = portal.restrictedTraverse(\n
portal.portal_preferences.getPreferredWebMessageTemplate())\n
web_message = web_message_template.Base_createCloneDocument(batch_mode=1)\n
# XXX init script is not called when cloning?\n
web_message.Event_init()\n
web_message.edit(\n
title="Re: %s" % context.getTitle(),\n
content_type="text/plain",\n
text_content=description,\n
source_value=person,\n
resource=ticket.getResource(),\n
start_date=DateTime(),\n
follow_up_value=ticket,\n
)\n
web_message.stop(comment="Submitted from the web site contact form")\n
if portal.portal_workflow.isTransitionPossible(context, "validate"):\n
context.validate(comment="See %s" % web_message.getRelativeUrl())\n
\n
return ""\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
description, REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Ticket_updateFromJio
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio/bt/revision
View file @
19965ffb
1
2
\ No newline at end of file
\ No newline at end of file
master/bt5/slapos_jio/bt/template_extension_id_list
0 → 100644
View file @
19965ffb
HalStyle
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment