From 51e98c2621291fd2ac45112063a9a7a8111df55f Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Fri, 29 Sep 2006 16:26:44 +0000
Subject: [PATCH] Call only once in a page rendering the functions used to
 decide wether to render or not developer mode & translator mode buttons.
 Remove "view rendered" developper mode button. Define the a new css property
 to define the group border color. Fix "no space between fields" bug (#491).
 Fix "no space between left-right group and bottom group when there is no
 center group" (#490). Fix "font size of breadcrumb, tab, listbox title text
 is not smaller than content font" (#489). Fix "no space between breadcrumb
 and listbox in list mode" (#489). Fix padding of group fields. Fix left group
 with no border when right group is not present. Fix bottom border of context
 bar color. Fix border color of field groups. Cleanup redundancy in CSS and
 explain margin values. Fix french variable name in javascript. Fix tabs used
 in javascript. Move hardcoded style values from javascript to css. Update
 quad_form_view to follow form_view changes (use fieldsets).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10433 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../developper_shortcut_render.xml            | 33 +++----
 .../erp5_xhtml_style/erp5.css.xml             | 95 +++++++++++--------
 .../portal_skins/erp5_xhtml_style/erp5.js.xml | 30 +++---
 .../erp5_xhtml_style/field_render.xml         |  1 +
 .../erp5_xhtml_style/global_definitions.xml   |  2 +
 .../erp5_xhtml_style/quad_form_view.xml       | 34 +++----
 .../bootstrap/erp5_xhtml_style/bt/revision    |  2 +-
 7 files changed, 104 insertions(+), 93 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/developper_shortcut_render.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/developper_shortcut_render.xml
index e80ccd56d0..978266122e 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/developper_shortcut_render.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/developper_shortcut_render.xml
@@ -75,18 +75,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\n
 \n
 \n
 <tal:block metal:define-macro="edit_link">\n
-  <a tal:condition="python: hasattr(object, \'meta_type\') and context.Base_getSourceVisibility(object)"\n
+  <a tal:condition="python: preferred_html_style_developper_mode and hasattr(object, \'meta_type\')"\n
      tal:attributes="href python: \'%s/%s\' % (\'/\'.join(object.getPhysicalPath()[len(object.getPortalObject().getPhysicalPath()):]), manage) # XXX: quick hack to get path;\n
                      title info;"><img tal:attributes="src python: \'images/%s\' % (image, );\n
                                                        alt info;"/></a>\n
 </tal:block>\n
 \n
 \n
-<tal:block metal:define-macro="translate_link" tal:define="image image | python: \'translate.png\'">\n
-  <a tal:condition="python: here.Base_getTranslationVisibility()"\n
-     tal:attributes="href python: \'%s/manage_messages?regex=^%s%%24&amp;lang=%s\' % (\'/\'.join(here.Localizer.erp5_ui.getPhysicalPath()[len(here.Localizer.erp5_ui.getPortalObject().getPhysicalPath()):]), message, here.Localizer.get_selected_language());\n
-                     title info;"><img tal:attributes="src python: \'images/%s\' % (image, );\n
-                                                       alt info;"/></a>\n
+<tal:block metal:define-macro="translate_link">\n
+  <tal:block tal:condition="preferred_html_style_translator_mode">\n
+    <a tal:define="image image | python: \'translate.png\'"\n
+       tal:attributes="href python: \'%s/manage_messages?regex=^%s%%24&amp;lang=%s\' % (\'/\'.join(here.Localizer.erp5_ui.getPhysicalPath()[len(here.Localizer.erp5_ui.getPortalObject().getPhysicalPath()):]), message, here.Localizer.get_selected_language());\n
+                       title info;"><img tal:attributes="src python: \'images/%s\' % (image, );\n
+                                                         alt info;"/></a>\n
+  </tal:block>\n
 </tal:block>\n
 \n
 \n
@@ -97,12 +99,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\n
                          manage python: \'manage\'">\n
     <tal:block metal:use-macro="template/macros/edit_link"/>\n
   </tal:block>\n
-  <tal:block tal:define="image  python: \'editformrenderer.png\';\n
-                         info   python: \'Edit this form\\\'s renderer\';\n
-                         object python: getattr(here, form.pt, None);\n
-                         manage python: \'manage_main\'">\n
-    <tal:block metal:use-macro="template/macros/edit_link"/>\n
-  </tal:block>\n
   <tal:block tal:define="image python: \'editformaction.png\';\n
                          info python: \'Edit this form\\\'s action\';\n
                          object python: getattr(here, form.action, None);\n
@@ -124,14 +120,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\n
                          image python: \'translate.png\'">\n
     <tal:block metal:use-macro="template/macros/translate_link"/>\n
   </tal:block>\n
-  <tal:block tal:define="desc python: here.Base_getFieldDescription(field)">\n
-    <tal:block tal:condition="python: desc not in (None, \'\')">\n
-      <tal:block tal:define="info python: \'Translate this field description\';\n
-                             message desc;\n
-                             image python: \'translate_tooltip.png\'">\n
-        <tal:block metal:use-macro="template/macros/translate_link"/>\n
-      </tal:block>\n
-    </tal:block>\n
+  <tal:block tal:define="message python: here.Base_getFieldDescription(field);\n
+                         info python: \'Translate this field description\';\n
+                         image python: \'translate_tooltip.png\'"\n
+             tal:condition="python: message not in (None, \'\')">\n
+    <tal:block metal:use-macro="template/macros/translate_link"/>\n
   </tal:block>\n
 </tal:block>
 
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/erp5.css.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/erp5.css.xml
index 1ccbbc6681..f1470db3f7 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/erp5.css.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/erp5.css.xml
@@ -256,6 +256,16 @@
                       <value> <string>string</string> </value>
                   </item>
                 </dictionary>
+                <dictionary>
+                  <item>
+                      <key> <string>id</string> </key>
+                      <value> <string>group_border_color</string> </value>
+                  </item>
+                  <item>
+                      <key> <string>type</string> </key>
+                      <value> <string>string</string> </value>
+                  </item>
+                </dictionary>
               </tuple>
             </value>
         </item>
@@ -315,6 +325,10 @@
               <dictionary/>
             </value>
         </item>
+        <item>
+            <key> <string>group_border_color</string> </key>
+            <value> <string>#7EC1C1</string> </value>
+        </item>
         <item>
             <key> <string>link_color</string> </key>
             <value> <string>#002e3f</string> </value>
@@ -345,7 +359,7 @@
         </item>
         <item>
             <key> <string>main_border_color</string> </key>
-            <value> <string>#7EC1C1</string> </value>
+            <value> <string>#97B0C1</string> </value>
         </item>
         <item>
             <key> <string>navigation_bar_background_color</string> </key>
@@ -548,55 +562,50 @@ div.index_html table {\n
   display: none;\n
 }\n
 \n
-div.left,\n
+div.top_group,\n
+fieldset.left,\n
+fieldset.right,\n
+fieldset.center,\n
+fieldset.bottom {\n
+  margin-bottom: 5px;\n
+}\n
+\n
+div.top_group,\n
+fieldset.left,\n
+fieldset.right,\n
+fieldset.center {\n
+  border-style: solid;\n
+  border-width: 1px;\n
+  border-color: <dtml-var group_border_color>;\n
+  padding-top: 5px;\n
+  padding-left: 5px;\n
+  padding-right: 5px;\n
+}\n
+\n
 fieldset.left {\n
   width: 50%;\n
-  clear: left;\n
   float: left;\n
-  border: 0;\n
-  height: 100%;\n
-  border-style: solid;\n
-  border-width: 0;\n
-  border-color: <dtml-var document_border_color>;\n
-  padding-top: 5px;\n
-  padding-bottom: 2px;\n
-  padding-left: 8px;\n
-  margin-right: -9px;\n
+  margin-right: -11px; /* 5px margin *2 + 1px for left border width */\n
 }\n
 \n
-div.right,\n
 fieldset.right {\n
-  float: left;\n
   width: 50%;\n
-  border: 0;\n
-  margin-left: -1px;\n
-  height: 100%;\n
-  border-style: solid;\n
-  border-width: 0;\n
-  border-color: <dtml-var document_border_color>;\n
-  padding-top: 5px;\n
-  padding-bottom: 2px;\n
+  float: left;\n
+  margin-left: -11px; /* 5px margin *2 + 1px for right border width */\n
 }\n
 \n
-div.center,\n
-fieldset.center {\n
-  margin-top: 5px;\n
-  margin-bottom: 5px;\n
-  padding-bottom: 5px;\n
-  padding-top: 5px;\n
-  border-style: solid;\n
-  border-color: <dtml-var document_border_color>;\n
-  border-width: 1px;\n
+div.top_group fieldset.left,\n
+div.top_group fieldset.right {\n
+  border-width: 0;\n
+  padding: 0;\n
+  width: 50%;\n
 }\n
 \n
-.document .content .top_group {\n
- border-width: 1px;\n
- border-style: solid;\n
- padding: 5px;\n
- margin-bottom: 5px;\n
+fieldset.center,\n
+fieldset.bottom {\n
+  clear: both;\n
 }\n
 \n
-\n
 fieldset.bottom {\n
   border-width: 0;\n
 }\n
@@ -606,7 +615,7 @@ fieldset.bottom .field label {\n
 }\n
 \n
 .content .field {\n
-  padding-bottom: 0.2em;\n
+  padding-bottom: 5px;\n
 }\n
 \n
 .content .field label {\n
@@ -813,6 +822,8 @@ fieldset.bottom .field label {\n
 \n
 #breadcrumb {\n
   float: left;\n
+  font-size: 90%;\n
+  margin-bottom: 5px;\n
 }\n
 \n
 #breadcrumb a {\n
@@ -821,10 +832,12 @@ fieldset.bottom .field label {\n
 \n
 #logged_in_as {\n
   float: right;\n
+  font-size: 90%;\n
 }\n
 \n
 #logged_in_as .logged_txt{\n
   color: <dtml-var link_color>;\n
+  font-size: 90%;\n
 }\n
 \n
 #transition_message {\n
@@ -903,6 +916,7 @@ fieldset.bottom .field label {\n
   color: inherit;\n
   background-color: inherit;\n
   background: url(\'<dtml-var expr="portal_url.getPortalPath()">/images/tab_right.png\') top right no-repeat;\n
+  font-size: 90%;\n
 }\n
 \n
 .document .actions li.selected a {\n
@@ -937,6 +951,10 @@ fieldset.bottom .field label {\n
   padding-left: 10px;\n
 }\n
 \n
+.ListSummary * {\n
+  font-size: 90%;\n
+}\n
+\n
 .ListSummary table {\n
   width: 100%;\n
   border-color: <dtml-var document_border_color>;\n
@@ -978,6 +996,7 @@ fieldset.bottom .field label {\n
 .ListContent #listbox_label_line {\n
   color: <dtml-var font_color>;\n
   background-color: <dtml-var listbox_label_background_color>;\n
+  font-size: 90%;\n
 }\n
 \n
 .ListContent #listbox_stat_line {\n
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/erp5.js.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/erp5.js.xml
index 841c83b436..ee6d66b645 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/erp5.js.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/erp5.js.xml
@@ -65,20 +65,20 @@ function fixLeftRightHeight(){\n
   var lfieldset;\n
   var rh = 0;\n
   var rfieldset;\n
-  var liste=document.getElementsByTagName(\'fieldset\');\n
-  for(i=0; i<liste.length; i=i+1){\n
-    list_parts = liste[i].id.split(\'_\');\n
+  var list=document.getElementsByTagName(\'fieldset\');\n
+  for(i=0; i<list.length; i=i+1){\n
+    list_parts = list[i].id.split(\'_\');\n
     for(j=1; j<list_parts.length; j=j+1){\n
       if(list_parts[j] == "left"){\n
-        lfieldset = liste[i];\n
-      \tlh = lfieldset.offsetHeight;\n
+        lfieldset = list[i];\n
+        lh = lfieldset.offsetHeight;\n
         break;\n
       }else{\n
-      \tif(list_parts[j] == "right"){\n
-\t  rfieldset = liste[i];\n
-\t  rh = rfieldset.offsetHeight;\n
+        if(list_parts[j] == "right"){\n
+          rfieldset = list[i];\n
+          rh = rfieldset.offsetHeight;\n
           break;\n
-\t}\n
+        }\n
       }\n
     }\n
     if(lh && rh){\n
@@ -86,14 +86,10 @@ function fixLeftRightHeight(){\n
     }\n
   }\n
   if(lh && rh){\n
-    lfieldset.style.height=(lh>rh)? lh+"px" : rh+"px";\n
-    rfieldset.style.height=(lh>rh)? lh+"px" : rh+"px";\n
-    lfieldset.style.borderTop = \'1px solid #3D7474\';\n
-    lfieldset.style.borderLeft = \'1px solid #3D7474\';\n
-    lfieldset.style.borderBottom = \'1px solid #3D7474\';\n
-    rfieldset.style.borderTop = \'1px solid #3D7474\';\n
-    rfieldset.style.borderRight = \'1px solid #3D7474\';\n
-    rfieldset.style.borderBottom = \'1px solid #3D7474\';\n
+    lfieldset.style.height = (lh>rh)? lh+"px" : rh+"px";\n
+    rfieldset.style.height = (lh>rh)? lh+"px" : rh+"px";\n
+    lfieldset.style.borderRightWidth = 0;\n
+    rfieldset.style.borderLeftWidth = 0;\n
   }\n
 }\n
 
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/field_render.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/field_render.xml
index 4a53d5d0b2..7a070e0fae 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/field_render.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/field_render.xml
@@ -92,6 +92,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\n
             class="error"\n
             tal:content="python: field_errors[field.id].error_text"\n
             i18n:translate="" i18n:domain="ui"/>\n
+      <p class="clear"></p>\n
     </div>\n
   </tal:block>\n
 </tal:block>
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/global_definitions.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/global_definitions.xml
index 42cca6b685..49027a1451 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/global_definitions.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/global_definitions.xml
@@ -72,6 +72,8 @@
            dummy                python: http_parameter_list.update(local_parameter_list);\n
     global http_parameters      python: here.ERP5XhtmlStyle_renderHTTPParameterList(http_parameter_list);\n
     global form                 nocall:form | nothing;\n
+    global preferred_html_style_developper_mode   here/portal_preferences/getPreferredHtmlStyleDevelopperMode;\n
+    global preferred_html_style_translator_mode   here/portal_preferences/getPreferredHtmlStyleTranslatorMode;\n
   "/>\n
 </tal:block>\n
 \n
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/quad_form_view.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/quad_form_view.xml
index 3f86f6094d..ea543630b4 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/quad_form_view.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/quad_form_view.xml
@@ -85,44 +85,44 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\n
         <tal:block metal:use-macro="template/macros/form" />\n
       </tal:block>\n
       <div tal:condition="python: len(left_group) > 0 or len(right_group) > 0"\n
-          class="top_group">\n
-        <div tal:condition="python: len(left_group) > 0"\n
-            class="left">\n
+           class="top_group">\n
+        <fieldset tal:condition="python: len(left_group) > 0"\n
+                  class="left">\n
           <tal:block tal:repeat="field left_group">\n
             <tal:block metal:use-macro="here/field_render/macros/field_render" />\n
           </tal:block>\n
-        </div>\n
-        <div tal:condition="python: len(right_group) > 0"\n
-            class="right">\n
+        </fieldset>\n
+        <fieldset tal:condition="python: len(right_group) > 0"\n
+                  class="right">\n
           <tal:block tal:repeat="field right_group">\n
             <tal:block metal:use-macro="here/field_render/macros/field_render" />\n
           </tal:block>\n
-        </div>\n
+        </fieldset>\n
         <p class="clear"></p>\n
       </div>\n
       <div tal:condition="python: len(center_left_group) > 0 or len(center_right_group) > 0"\n
-          class="top_group">\n
-        <div tal:condition="python: len(center_left_group) > 0"\n
-            class="left">\n
+           class="top_group">\n
+        <fieldset tal:condition="python: len(center_left_group) > 0"\n
+             class="left">\n
           <tal:block tal:repeat="field center_left_group">\n
             <tal:block metal:use-macro="here/field_render/macros/field_render" />\n
           </tal:block>\n
-        </div>\n
-        <div tal:condition="python: len(center_right_group) > 0"\n
-            class="right">\n
+        </fieldset>\n
+        <fieldset tal:condition="python: len(center_right_group) > 0"\n
+             class="right">\n
           <tal:block tal:repeat="field center_right_group">\n
             <tal:block metal:use-macro="here/field_render/macros/field_render" />\n
           </tal:block>\n
-        </div>\n
+        </fieldset>\n
         <p class="clear"></p>\n
       </div>\n
-      <div tal:condition="python: len(bottom_group) > 0"\n
-          class="bottom">\n
+      <fieldset tal:condition="python: len(bottom_group) > 0"\n
+                class="center">\n
         <tal:block tal:repeat="field python: form.get_fields_in_group(\'bottom\')">\n
             <tal:block metal:use-macro="here/field_render/macros/field_render" />\n
         </tal:block>\n
         <p class="clear"></p>\n
-      </div>\n
+      </fieldset>\n
     </tal:block>\n
   </tal:block>\n
 </tal:block>
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
index 6dd90d24d3..c72784c8c5 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
@@ -1 +1 @@
-222
\ No newline at end of file
+235
\ No newline at end of file
-- 
2.30.9