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>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="TextAreaField" module="Products.Formulator.StandardFields"/>
<global name="GadgetField" module="Products.ERP5Form.GadgetField"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,28 +13,7 @@
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>line_too_long</string> </key>
<value> <string>A line was too long.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>too_long</string> </key>
<value> <string>You entered too many characters.</string> </value>
</item>
<item>
<key> <string>too_many_lines</string> </key>
<value> <string>You entered too many lines.</string> </value>
</item>
</dictionary>
<dictionary/>
</value>
</item>
<item>
......@@ -58,59 +37,55 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<key> <string>gadget_cache_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<key> <string>gadget_cached</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<key> <string>gadget_connection</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<key> <string>gadget_html</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<key> <string>gadget_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<key> <string>gadget_property</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
......@@ -138,6 +113,14 @@
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
......@@ -155,43 +138,49 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<key> <string>gadget_cache_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<key> <string>gadget_cached</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<key> <string>gadget_connection</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<key> <string>gadget_html</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<key> <string>gadget_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<key> <string>gadget_property</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<key> <string>gadget_url</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<key> <string>js_sandbox</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
......@@ -217,6 +206,14 @@
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <int>20</int> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
......@@ -234,44 +231,48 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <int>10</int> </value>
<key> <string>gadget_cache_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<key> <string>gadget_cached</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<key> <string>gadget_connection</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<key> <string>gadget_html</string> </key>
<value> <string>gadget_slapos_request_form.html</string> </value>
</item>
<item>
<key> <string>gadget_id</string> </key>
<value> <string>request-parameter-form</string> </value>
</item>
<item>
<key> <string>gadget_property</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<key> <string>gadget_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Instance XML</string> </value>
<key> <string>js_sandbox</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>80</int> </value>
<key> <string>title</string> </key>
<value> <string>Instance XML</string> </value>
</item>
</dictionary>
</value>
......@@ -287,7 +288,20 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: context.getTextContent()</string> </value>
<value> <string>python: here.Base_getRequestGadgetOptionDictAsJSON()</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.getWebSiteValue().renderjs.absolute_url() + \'/gadget_slapos_request_form.html\'</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -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>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="TextAreaField" module="Products.Formulator.StandardFields"/>
<global name="GadgetField" module="Products.ERP5Form.GadgetField"/>
</pickle>
<pickle>
<dictionary>
......@@ -13,28 +13,7 @@
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>line_too_long</string> </key>
<value> <string>A line was too long.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>too_long</string> </key>
<value> <string>You entered too many characters.</string> </value>
</item>
<item>
<key> <string>too_many_lines</string> </key>
<value> <string>You entered too many lines.</string> </value>
</item>
</dictionary>
<dictionary/>
</value>
</item>
<item>
......@@ -58,59 +37,55 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<key> <string>gadget_cache_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<key> <string>gadget_cached</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<key> <string>gadget_connection</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<key> <string>gadget_html</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<key> <string>gadget_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<key> <string>gadget_property</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
......@@ -130,12 +105,22 @@
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
......@@ -153,43 +138,49 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<key> <string>gadget_cache_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<key> <string>gadget_cached</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<key> <string>gadget_connection</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<key> <string>gadget_html</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<key> <string>gadget_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<key> <string>gadget_property</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<key> <string>gadget_url</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<key> <string>js_sandbox</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
......@@ -209,18 +200,20 @@
</item>
<item>
<key> <string>default</string> </key>
<value> <string encoding="cdata"><![CDATA[
<?xml version="1.0" encoding="utf-8"?>\n
<instance>\n
</instance>
]]></string> </value>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <int>20</int> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
......@@ -238,44 +231,48 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <int>10</int> </value>
<key> <string>gadget_cache_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<key> <string>gadget_cached</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<key> <string>gadget_connection</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<key> <string>gadget_html</string> </key>
<value> <string>gadget_slapos_request_form.html</string> </value>
</item>
<item>
<key> <string>gadget_id</string> </key>
<value> <string>request-parameter-form</string> </value>
</item>
<item>
<key> <string>gadget_property</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<key> <string>gadget_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Parameter XML</string> </value>
<key> <string>js_sandbox</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>80</int> </value>
<key> <string>title</string> </key>
<value> <string>Parameters</string> </value>
</item>
</dictionary>
</value>
......@@ -283,4 +280,30 @@
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.Base_getRequestGadgetOptionDictAsJSON()</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.getWebSiteValue().renderjs.absolute_url() + \'/gadget_slapos_request_form.html\'</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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