From e1f4878a3328b41b1ff62df2c0e6bc0115617a7a Mon Sep 17 00:00:00 2001
From: Rafael Monnerat <rafael@nexedi.com>
Date: Fri, 26 Oct 2012 01:10:14 -0200
Subject: [PATCH] Include new service shortcut section for request slapos
 master.

---
 .../hosting/service-shortcut/slaposmaster.xml | 141 +++++++++++++++
 master/bt5/vifib_data_web/bt/revision         |   2 +-
 .../WebSection_orderVifibSlapOSMaster.xml     | 164 ++++++++++++++++++
 master/bt5/vifib_web/bt/revision              |   2 +-
 4 files changed, 307 insertions(+), 2 deletions(-)
 create mode 100644 master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/service-shortcut/slaposmaster.xml
 create mode 100644 master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_orderVifibSlapOSMaster.xml

diff --git a/master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/service-shortcut/slaposmaster.xml b/master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/service-shortcut/slaposmaster.xml
new file mode 100644
index 000000000..4e3a3d407
--- /dev/null
+++ b/master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/service-shortcut/slaposmaster.xml
@@ -0,0 +1,141 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="Web Section" module="erp5.portal_type"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_Add_portal_content_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Add_portal_folders_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Copy_or_Move_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Delete_objects_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Modify_portal_content_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignee</string>
+                <string>Assignor</string>
+                <string>Manager</string>
+                <string>Owner</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_identity_criterion</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_range_criterion</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>authorization_forced</string> </key>
+            <value> <int>1</int> </value>
+        </item>
+        <item>
+            <key> <string>custom_render_method_id</string> </key>
+            <value> <string>WebSection_orderVifibSlapOSMaster</string> </value>
+        </item>
+        <item>
+            <key> <string>default_page_displayed</string> </key>
+            <value> <int>0</int> </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>slaposmaster</string> </value>
+        </item>
+        <item>
+            <key> <string>portal_type</string> </key>
+            <value> <string>Web Section</string> </value>
+        </item>
+        <item>
+            <key> <string>short_title</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string>1</string> </value>
+        </item>
+        <item>
+            <key> <string>visible</string> </key>
+            <value> <int>0</int> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <global name="PersistentMapping" module="Persistence.mapping"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>data</string> </key>
+            <value>
+              <dictionary/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="3" aka="AAAAAAAAAAM=">
+    <pickle>
+      <global name="PersistentMapping" module="Persistence.mapping"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>data</string> </key>
+            <value>
+              <dictionary/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/master/bt5/vifib_data_web/bt/revision b/master/bt5/vifib_data_web/bt/revision
index d25720879..95c8a676e 100644
--- a/master/bt5/vifib_data_web/bt/revision
+++ b/master/bt5/vifib_data_web/bt/revision
@@ -1 +1 @@
-112
\ No newline at end of file
+113
\ No newline at end of file
diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_orderVifibSlapOSMaster.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_orderVifibSlapOSMaster.xml
new file mode 100644
index 000000000..18c80825f
--- /dev/null
+++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_orderVifibSlapOSMaster.xml
@@ -0,0 +1,164 @@
+<?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
+portal = context.getPortalObject()\n
+\n
+instance_xml = """<?xml version="1.0" encoding="utf-8"?>\n
+<instance>\n
+ <parameter id="json">%s</parameter>\n
+</instance>\n
+""" % (json.dumps({\n
+        "timezone": "Europe/Paris",\n
+        "site-id": "erp5",\n
+        "erp5-ca": {\n
+          "country-code": "FR",\n
+          "email": "admin@vifib.org",\n
+          "state": "Nord-Pas-de-Calais",\n
+          "city": "Lille",\n
+          "company": "ViFiB SARL"\n
+        },\n
+        "backend": {\n
+          "login": {\n
+            "zopecount": 1,\n
+            "access-control-string": "all",\n
+            "scheme": ["https"],\n
+            "maxconn": 1,\n
+            "thread-amount": 1},\n
+          "erp5": {\n
+            "zopecount": 1,\n
+            "access-control-string": "all",\n
+            "scheme": ["https"],\n
+            "maxconn": 1,\n
+            "thread-amount": 1},\n
+          "service": {\n
+            "no-timeout": True,\n
+            "http-cache": True,\n
+            "zopecount": 2,\n
+            "access-control-string": "all",\n
+            "scheme": ["https"],\n
+            "maxconn": 1,\n
+            "ssl-authentication": True,\n
+            "backend-path": "/%(site-id)s/portal_slap",\n
+            "thread-amount": 1},\n
+         "shacacheupload": {\n
+            "no-timeout": True,\n
+            "zopecount": 1,\n
+            "access-control-string": "all",\n
+            "scheme": ["https"],\n
+            "maxconn": 1,\n
+            "ssl-authentication": True,\n
+            "backend-path": "/%(site-id)s/web_site_module",\n
+            "thread-amount": 1},\n
+         "shacachedownload": {\n
+            "no-timeout": True,\n
+            "http-cache": True,\n
+            "zopecount": 1,\n
+            "access-control-string": "all",\n
+            "scheme": ["http"],\n
+            "maxconn": 1,\n
+            "backend-path": "/%(site-id)s/web_site_module",\n
+            "thread-amount": 1}\n
+        },\n
+        "zeo": {\n
+           "Zeo-Server-1": [{\n
+             "zodb-name": "main",\n
+             "serialize-path": "/%(site-id)s/account_module/",\n
+             "mount-point": "/",\n
+             "zope-cache-size": "2000",\n
+             "storage-name": "main",\n
+             "zeo-cache-size": "400MB"}]\n
+        },\n
+        "activity": {\n
+          "zopecount": 1,\n
+          "timerservice": True\n
+        }\n
+      }))\n
+\n
+url = "http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/erp5-vifib:/software/erp5/software.cfg"\n
+software_type = "production"\n
+\n
+person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
+\n
+request_kw = {}\n
+request_kw.update(\n
+  software_release=url,\n
+  software_title="SlapOS Master Instance 00-%i" % portal.portal_ids.generateNewId(id_group=("vifib", "kvm"), default=1),\n
+  software_type=software_type,\n
+  instance_xml=instance_xml,\n
+  sla_xml="",\n
+  shared=False,\n
+  state="started",\n
+)\n
+\n
+person.requestSoftwareInstance(**request_kw)\n
+\n
+message = context.Base_translateString("Your instance is under creation. Please wait few minutes for partitions to appear.")\n
+return context.REQUEST.get(\'request_hosting_subscription\').Base_redirect(keep_items={\'portal_status_message\': message})\n
+
+
+]]></string> </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>WebSection_orderVifibSlapOSMaster</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/master/bt5/vifib_web/bt/revision b/master/bt5/vifib_web/bt/revision
index 1e27e32d4..941d0e591 100644
--- a/master/bt5/vifib_web/bt/revision
+++ b/master/bt5/vifib_web/bt/revision
@@ -1 +1 @@
-478
\ No newline at end of file
+479
\ No newline at end of file
-- 
2.30.9