Commit 3431bdcc authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_web: Replace textarea by a gadget field

This will enable edition of parameter using a JS editor.
parent d380dd32
<?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 encoding="cdata"><![CDATA[
import json\n
import base64\n
\n
request = context.REQUEST\n
\n
option_dict = {\n
\'parameter\' : {\n
\'json_url\': "%s.json" % context.getUrlString(),\n
\'parameter_hash\': base64.b64encode(\'<?xml version="1.0" encoding="utf-8" ?><instance></instance>\')\n
},\n
}\n
\n
if request.get("software_type", None) is not None:\n
option_dict[\'parameter\'][\'softwaretype\'] = request.get("software_type", None)\n
\n
if request.get("parameter_hash", None) is not None:\n
option_dict[\'parameter\'][\'parameter_hash\'] = request.get("parameter_hash", None)\n
\n
if context.getPortalType() == "Hosting Subscription":\n
option_dict[\'parameter\'][\'softwaretype\'] = context.getSourceReference()\n
if context.getTextContent() is not None:\n
option_dict[\'parameter\'][\'parameter_hash\'] = base64.b64encode(context.getTextContent())\n
\n
return json.dumps(option_dict)\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getRequestGadgetOptionDictAsJSON</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -35,7 +35,7 @@
</item>
<item>
<key> <string>action</string> </key>
<value> <string></string> </value>
<value> <string>HostingSubscription_editWebMode</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -104,13 +104,12 @@
<string>your_ad</string>
<string>my_url_string</string>
<string>my_source_reference</string>
<string>last_event_listbox</string>
<string>info</string>
<string>your_status</string>
<string>your_instance_xml</string>
<string>my_update_button</string>
<string>my_start_button</string>
<string>my_stop_button</string>
<string>info</string>
<string>your_connection_listbox</string>
<string>your_monitoring_status</string>
</list>
......
......@@ -55,7 +55,21 @@
portal = context.getPortalObject()\n
\n
if not service_title:\n
service_title = "Vifib KVM %i" % portal.portal_ids.generateNewId(id_group=("vifib", "kvm"), default=1),\n
raise ValueError("Service Title is mandatory!")\n
\n
keep_item_dict = {}\n
\n
if software_type is not None:\n
keep_item_dict[\'software_type\'] = software_type\n
\n
if software_type is not None:\n
keep_item_dict[\'parameter_hash\'] = parameter_hash\n
\n
if instance_xml == "ERROR":\n
keep_item_dict.update({\'portal_status_message\':context.Base_translateString(\n
"Your parameters are contains errors, please update it.")})\n
return context.Base_redirect(dialog_id,\n
keep_items=keep_item_dict)\n
\n
hosting_subscription = portal.portal_catalog.getResultValue(\n
portal_type=\'Hosting Subscription\',\n
......@@ -74,6 +88,9 @@ url = context.getUrlString()\n
\n
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
\n
if person is None:\n
raise ValueError("You cannot request without been logged in as a user.")\n
\n
request_kw = {}\n
request_kw.update(\n
software_release=url,\n
......@@ -120,7 +137,7 @@ return context.REQUEST.get(\'request_hosting_subscription\').Base_redirect(keep_
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>dialog_id, service_title, instance_xml, computer_guid=\'\', cpu_core=\'\', cpu_frequency=\'\', cpu_type=\'\', local_area_network_type=\'\', memory_size=\'\', memory_type=\'\', storage_capacity=\'\', storage_interface=\'\', storage_redundancy=\'\', group=\'\', region=\'\', **kw</string> </value>
<value> <string>dialog_id, service_title, instance_xml, parameter_hash=None, software_type=None, computer_guid=\'\', cpu_core=\'\', cpu_frequency=\'\', cpu_type=\'\', local_area_network_type=\'\', memory_size=\'\', memory_type=\'\', storage_capacity=\'\', storage_interface=\'\', storage_redundancy=\'\', group=\'\', region=\'\', **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
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