Commit a3aff077 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_cloud: Make it compatible with the ERP5 UI

parent d5274e84
import base64
text_content = context.getTextContent()
if context.getTextContent() is None:
text_content = '<?xml version="1.0" encoding="utf-8" ?><instance></instance>'
parameter_dict = {
'parameter' : {
'json_url': ".".join([context.getUrlString(), "json"]),
'softwaretype': context.getSourceReference(),
'shared': context.getRootSlave(),
'parameter_hash': base64.b64encode(text_content)
}
}
import json
return json.dumps(parameter_dict)
<?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>id</string> </key>
<value> <string>Base_getParameterEditorDict</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<script src="URI.js" type="text/javascript"></script> <script src="URI.js" type="text/javascript"></script>
<script src="ref-parser.min.js" type="text/javascript"></script> <script src="ref-parser.min.js" type="text/javascript"></script>
<script src="cfworker-jsonschema-validator.js" type="text/javascript"></script> <script src="cfworker-jsonschema-validator.js" type="text/javascript"></script>
<script src="jiodev.js" type="text/javascript"></script> <script src="jio.js" type="text/javascript"></script>
<script src="gadget_erp5_page_slap_load_schema.js" type="text/javascript"></script> <script src="gadget_erp5_page_slap_load_schema.js" type="text/javascript"></script>
</head> </head>
<body> <body>
......
#software-type {padding: 10px 0 0;} #software-type {
padding: 10px 0 0;
border: 0px;
}
#software-type .field[title='serialisation_type'] .input { padding-top: 0; } #software-type .field[title='serialisation_type'] .input { padding-top: 0; }
.subfield, #software-type .input{ .subfield, #software-type .input{
padding-top: 10px; padding-top: 10px;
...@@ -25,6 +28,11 @@ textarea.slapos-parameter { ...@@ -25,6 +28,11 @@ textarea.slapos-parameter {
height: 100px; height: 100px;
} }
div.parameter-editor fieldset {
border: 0px;
}
.field input ~ span { .field input ~ span {
position: relative; position: relative;
top: -27px; top: -27px;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<link href="gadget_erp5_page_slap_parameter_form.css" rel="stylesheet" type="text/css"/> <link href="gadget_erp5_page_slap_parameter_form.css" rel="stylesheet" type="text/css"/>
</head> </head>
<body> <body>
<div> <div class="parameter-editor">
<fieldset id="software-type"> <fieldset id="software-type">
<div class="field" title="software_type"> <div class="field" title="software_type">
<label i18n:translate="" i18n:domain="ui"> Software Type </label> <label i18n:translate="" i18n:domain="ui"> Software Type </label>
......
...@@ -504,24 +504,35 @@ ...@@ -504,24 +504,35 @@
.declareMethod('render', function (options) { .declareMethod('render', function (options) {
var restricted_softwaretype = false, var restricted_softwaretype = false,
software_type_list = [], software_type_list = [],
parameter_hash = options.value.parameter.parameter_hash, parameter_dict,
// XXX Do we directly get parameter_xml parameter? parameter_hash,
parameter_xml = options.value.parameter.parameter_xml; parameter_xml;
if ((options.value !== undefined) && (typeof options.value === "string")) {
parameter_dict = JSON.parse(options.value).parameter
} else {
parameter_dict = options.value.parameter;
}
parameter_hash = parameter_dict.parameter_hash,
// XXX Do we directly get parameter_xml parameter?
parameter_xml = parameter_dict.parameter_xml;
if (parameter_hash !== undefined) { if (parameter_hash !== undefined) {
// A JSON where provided via gadgetfield // A JSON where provided via gadgetfield
parameter_xml = atob(parameter_hash); parameter_xml = atob(parameter_hash);
} }
if (options.value.parameter.software_type_list !== undefined) { if (parameter_dict.software_type_list !== undefined) {
software_type_list = options.value.parameter.software_type_list; software_type_list = parameter_dict.software_type_list;
} }
if (options.value.parameter.softwaretype !== undefined) { if (parameter_dict.softwaretype !== undefined) {
restricted_softwaretype = true; restricted_softwaretype = true;
// exceptional situation where the default item must be in // exceptional situation where the default item must be in
// the list. // the list.
software_type_list.push(options.value.parameter.softwaretype); software_type_list.push(parameter_dict.softwaretype);
} }
return this.changeState({ return this.changeState({
...@@ -529,13 +540,13 @@ ...@@ -529,13 +540,13 @@
// hidden: options.hidden, // hidden: options.hidden,
// key: options.key, // key: options.key,
serialisation: options.serialisation, serialisation: options.serialisation,
json_url: options.value.parameter.json_url, json_url: parameter_dict.json_url,
parameter_xml: parameter_xml, parameter_xml: parameter_xml,
restricted_softwaretype: restricted_softwaretype, restricted_softwaretype: restricted_softwaretype,
shared: options.value.parameter.shared, shared: parameter_dict.shared,
softwaretype: options.value.parameter.softwaretype, softwaretype: parameter_dict.softwaretype,
software_type_list: software_type_list, software_type_list: software_type_list,
softwareindex: options.value.parameter.softwareindex, softwareindex: parameter_dict.softwareindex,
editable: options.editable, editable: options.editable,
// Force refresh in any case // Force refresh in any case
render_timestamp: new Date().getTime() render_timestamp: new Date().getTime()
......
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