From db6ea7b25a0c71cd176d52701a1f31ec684cb61b Mon Sep 17 00:00:00 2001
From: Gabriel Monnerat <gabriel@tiolive.com>
Date: Tue, 25 Jan 2011 21:09:28 +0000
Subject: [PATCH] - Added script to load all events in erp5 (Initial script). -
 remove dependency because this bt5 was added in erp5_web_ung_core - add box
 to display the calendar that will be used to select the date

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42670 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../Base_getEventListSerialized.xml           |  93 ++++++
 .../WebSection_viewCalendarWidget.xml         |   6 -
 .../erp5_web_ung_calendar_layout.xml          |   1 +
 .../date_selector_box.xml                     | 301 ++++++++++++++++++
 .../ung_css/ung_calendar.css.xml              |   5 +-
 .../ung_js/ung_calendar.js.xml                |  15 +-
 bt5/erp5_web_ung_theme/bt/dependency_list     |   1 -
 bt5/erp5_web_ung_theme/bt/revision            |   2 +-
 8 files changed, 407 insertions(+), 17 deletions(-)
 create mode 100644 bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/Base_getEventListSerialized.xml
 create mode 100644 bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/erp5_web_ung_calendar_layout/date_selector_box.xml

diff --git a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/Base_getEventListSerialized.xml b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/Base_getEventListSerialized.xml
new file mode 100644
index 0000000000..cbff96d13c
--- /dev/null
+++ b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/Base_getEventListSerialized.xml
@@ -0,0 +1,93 @@
+<?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>"""\n
+  Script to load all events and organize all data to be loaded on calendar.\n
+  XXX - Initial Script to serialize all events\n
+"""\n
+from Products.ERP5Type.JSONEncoder import encodeInJson as dumps\n
+import random\n
+\n
+event_list = context.getPortalObject().event_module.searchFolder()\n
+\n
+now = DateTime()\n
+event_dict = {}\n
+event_dict["events"] = []\n
+event_dict["issort"] = True\n
+event_dict["start"] = (now-30).toZone(\'UTC\').ISO()\n
+event_dict["end"] = (now+30).toZone(\'UTC\').ISO()\n
+event_dict["error"] = None\n
+for event in event_list:\n
+  start = event.getStartDate().strftime("%m/%d/%Y %H:%M")\n
+  end = event.getStartDate().strftime("%m/%d/%Y %H:%M")\n
+  event_dict["events"].append([random.randrange(10000, 99999),\n
+                               event.getTitle(),\n
+                               start,\n
+                               end,\n
+                               random.randrange(0,1),1,0,\n
+                               random.randrange(-1,13),1,\'\',\'\',])\n
+\n
+return dumps(event_dict)\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>request_type</string> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>Base_getEventListSerialized</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebSection_viewCalendarWidget.xml b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebSection_viewCalendarWidget.xml
index bee56d870c..e9fa6d8329 100644
--- a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebSection_viewCalendarWidget.xml
+++ b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/WebSection_viewCalendarWidget.xml
@@ -112,12 +112,6 @@
         <div id="sfnextbtn" title="Next" class="fbutton">\n
           <span class="fnext"></span>\n
         </div>\n
-        <div class="fshowdatep fbutton">\n
-          <div>\n
-            <input type="hidden" name="txtshow" id="hdtxtshow" />\n
-            <span id="txtdatetimeshow">Loading</span>\n
-          </div>\n
-        </div>\n
         <div class="clear"></div>\n
         </div>\n
       </div>\n
diff --git a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/erp5_web_ung_calendar_layout.xml b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/erp5_web_ung_calendar_layout.xml
index 74282788eb..b4491f7ef9 100644
--- a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/erp5_web_ung_calendar_layout.xml
+++ b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/erp5_web_ung_calendar_layout.xml
@@ -84,6 +84,7 @@
                     <value>
                       <list>
                         <string>calendar_box</string>
+                        <string>date_selector_box</string>
                       </list>
                     </value>
                 </item>
diff --git a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/erp5_web_ung_calendar_layout/date_selector_box.xml b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/erp5_web_ung_calendar_layout/date_selector_box.xml
new file mode 100644
index 0000000000..7d01d39479
--- /dev/null
+++ b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/erp5_web_ung_calendar_layout/date_selector_box.xml
@@ -0,0 +1,301 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="EditorField" module="Products.ERP5Form.EditorField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>date_selector_box</string> </value>
+        </item>
+        <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>
+            </value>
+        </item>
+        <item>
+            <key> <string>overrides</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>alternate_name</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>css_class</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>default</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>description</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>editable</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>enabled</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>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>height</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>hidden</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>max_length</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>max_linelength</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>max_lines</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>required</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>text_editor</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>unicode</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>whitespace_preserve</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>width</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>tales</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>alternate_name</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>css_class</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>default</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>description</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>editable</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>enabled</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>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>height</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>hidden</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>max_length</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>max_linelength</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>max_lines</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>required</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>text_editor</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>unicode</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>whitespace_preserve</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>width</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>alternate_name</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>css_class</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>default</string> </key>
+                    <value> <string encoding="cdata"><![CDATA[
+
+<div class="fshowdatep fbutton">\n
+<div>\n
+<input type="hidden" name="txtshow" id="hdtxtshow" />\n
+<span id="txtdatetimeshow">Loading</span>\n
+</div>\n
+</div>
+
+]]></string> </value>
+                </item>
+                <item>
+                    <key> <string>description</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>editable</string> </key>
+                    <value> <int>1</int> </value>
+                </item>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value> <int>1</int> </value>
+                </item>
+                <item>
+                    <key> <string>external_validator</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>extra</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>height</string> </key>
+                    <value> <int>5</int> </value>
+                </item>
+                <item>
+                    <key> <string>hidden</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>max_length</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>max_linelength</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>max_lines</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>required</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>text_editor</string> </key>
+                    <value> <string>text_area</string> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string>calendar_test_box</string> </value>
+                </item>
+                <item>
+                    <key> <string>unicode</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>whitespace_preserve</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>width</string> </key>
+                    <value> <int>40</int> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/ung_css/ung_calendar.css.xml b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/ung_css/ung_calendar.css.xml
index 7686efee8c..a93677c186 100644
--- a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/ung_css/ung_calendar.css.xml
+++ b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/ung_css/ung_calendar.css.xml
@@ -30,13 +30,15 @@
             <key> <string>raw</string> </key>
             <value> <string>div.main-right {\n
   border-left: 0px !important;\n
-  width: 87% !important;\n
+  width: 85.6% !important;\n
 }\n
+\n
 div.main-left {\n
   width: 13.3% !important;\n
   margin-top: -3.7px !important;\n
   background-color: #FFFFFF !important;\n
 }\n
+\n
 div.main-right fieldset.widget {\n
   margin-left: 0px;\n
 }\n
@@ -60,6 +62,7 @@ div.cHead div.ptogtitle {\n
   right: 20px !important;\n
   top: 58px !important;\n
 }\n
+\n
 a#BBIT_DP_CONTAINER {\n
   left: 0px !important;\n
    \n
diff --git a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/ung_js/ung_calendar.js.xml b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/ung_js/ung_calendar.js.xml
index d848c45476..d8dd985510 100644
--- a/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/ung_js/ung_calendar.js.xml
+++ b/bt5/erp5_web_ung_theme/SkinTemplateItem/portal_skins/erp5_web_ung_theme/ung_js/ung_calendar.js.xml
@@ -27,24 +27,23 @@
             <value> <string encoding="cdata"><![CDATA[
 
 $(document).ready(function() {     \n
-  var view="day";          \n
-  var DATA_FEED_URL = "Base_getEventList";\n
+  var DATA_FEED_URL = "Base_getEventListSerialized";\n
   var op = {\n
-    view: view,\n
-    theme:3,\n
+    view: "day",\n
     showday: new Date(),\n
     EditCmdhandler:Edit,\n
     DeleteCmdhandler:Delete,\n
+    weekstartday: 0,\n
     ViewCmdhandler:View,    \n
     onWeekOrMonthToDay:wtd,\n
     onBeforeRequestData: cal_beforerequest,\n
     onAfterRequestData: cal_afterrequest,\n
     onRequestDataError: cal_onerror, \n
     autoload:true,\n
-    url: DATA_FEED_URL + "?method=list",  \n
-    quickAddUrl: DATA_FEED_URL + "?method=add", \n
-    quickUpdateUrl: DATA_FEED_URL + "?method=update",\n
-    quickDeleteUrl: DATA_FEED_URL + "?method=remove"        \n
+    url: DATA_FEED_URL + "?request_type=list",  \n
+    quickAddUrl: DATA_FEED_URL + "?request_type=add", \n
+    quickUpdateUrl: DATA_FEED_URL + "?request_type=update",\n
+    quickDeleteUrl: DATA_FEED_URL + "?requet_type=remove"        \n
   };\n
   var $dv = $("#calhead");\n
   var _MH = document.documentElement.clientHeight;\n
diff --git a/bt5/erp5_web_ung_theme/bt/dependency_list b/bt5/erp5_web_ung_theme/bt/dependency_list
index 289aced2c5..5e398dc652 100644
--- a/bt5/erp5_web_ung_theme/bt/dependency_list
+++ b/bt5/erp5_web_ung_theme/bt/dependency_list
@@ -1,2 +1 @@
-erp5_ingestion_mysql_innodb_catalog
 erp5_web_ung_core
\ No newline at end of file
diff --git a/bt5/erp5_web_ung_theme/bt/revision b/bt5/erp5_web_ung_theme/bt/revision
index cd004727f2..3021b562c4 100644
--- a/bt5/erp5_web_ung_theme/bt/revision
+++ b/bt5/erp5_web_ung_theme/bt/revision
@@ -1 +1 @@
-182
\ No newline at end of file
+184
\ No newline at end of file
-- 
2.30.9