From 38af719fad9bf7906620f65a5d1b0ae0e1bb2dcf Mon Sep 17 00:00:00 2001 From: Kevin Deldycke <kevin@nexedi.com> Date: Tue, 12 Sep 2006 14:49:17 +0000 Subject: [PATCH] Rewrite default group generation using macro and WebSite_getGroupList script. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9834 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../erp5_web/erp5_web_form.css.xml | 16 ++- .../portal_skins/erp5_web/erp5_web_macros.xml | 134 ++++++++++++++++++ .../erp5_web_default_template.xml | 71 ++-------- .../erp5_web_default_theme.css.xml | 2 +- bt5/erp5_web/bt/change_log | 3 + bt5/erp5_web/bt/revision | 2 +- bt5/erp5_web/bt/version | 2 +- 7 files changed, 165 insertions(+), 65 deletions(-) create mode 100644 bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/erp5_web_macros.xml diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/erp5_web_form.css.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/erp5_web_form.css.xml index 70f3949264..cc7419362f 100644 --- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/erp5_web_form.css.xml +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/erp5_web_form.css.xml @@ -142,15 +142,15 @@ span.cancelled {color: #ccc}\n \n /* Default layout for form web widgets */\n \n -form#main_form > div > div.field {\n +form#main_form div.wrapper div.field {\n background: #fff url(erp5-website-field.png) top repeat-x;\n border: 1px solid #ccc;\n color: #666;\n -/* margin: .3em;\n - padding: .5em; XXX break new layout technic */\n + margin: .3em;\n + padding: .5em;\n }\n \n -form#main_form > div > div.field label {\n +form#main_form div.wrapper div.field label {\n font-weight: bold;\n }\n \n @@ -158,13 +158,13 @@ form#main_form > div > div.field label {\n \n /* Special layout for logo group */\n \n -form#main_form div.field.logo {\n +form#main_form div.wrapper div.field.logo {\n padding: 2em 0 0;\n border: 0;\n background: transparent;\n }\n \n -div.field.logo label {\n +div.wrapper div.field.logo label {\n display: none;\n }\n \n @@ -213,6 +213,10 @@ blockquote {\n \n \n /* General form styling\n + Form style based on Aleksandar Vaci\xc4\x87\'s work,\n + ditributed under Creative Commons Paternity Licence:\n + * http://creativecommons.org/licenses/by/2.0/\n + * http://www.aplus.co.yu/css/forms/?css=1\n ----------------------------------------------- */\n \n input, textarea {\n diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/erp5_web_macros.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/erp5_web_macros.xml new file mode 100644 index 0000000000..5732eabb56 --- /dev/null +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/erp5_web_macros.xml @@ -0,0 +1,134 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <tuple> + <string>Products.PageTemplates.ZopePageTemplate</string> + <string>ZopePageTemplate</string> + </tuple> + <none/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>__ac_local_roles__</string> </key> + <value> + <none/> + </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_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_owner</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_text</string> </key> + <value> <string encoding="cdata"><![CDATA[ + +<!-- ============================================================== -->\n +<!--\n +Description:\n + This macro render an aggregate of groups (like the ones returned\n + by WebSite_getGroupList() method).\n +\n +Note:\n + A \'aggregate\' variable must be defined just before the macro call.\n +\n +Example of macro use (similar to \'erp5_web_default_template\' use):\n + <tal:block\n + tal:define="TOP python: \'top\';\n + SIDEBAR python: \'sidebar\';\n + agg_list python: dict(layout_form.WebSite_getGroupList([TOP, SIDEBAR]))">\n +\n + <tal:block tal:define="aggregate python: (TOP, agg_list[TOP])">\n + <tal:block metal:use-macro="here/erp5_web_macros/macros/render_aggregate"/>\n + </tal:block>\n +\n + <div>\n + <tal:block tal:define="aggregate python: (SIDEBAR, agg_list[SIDEBAR])">\n + <tal:block metal:use-macro="here/erp5_web_macros/macros/render_aggregate"/>\n + </tal:block>\n + </div>\n +\n + </tal:block>\n +-->\n +\n +<tal:block metal:define-macro="render_aggregate">\n + <!-- Each aggregate of groups is a <div> wrapper -->\n + <div tal:define="aggregate_name python: aggregate[0];\n + aggregate_groups python: aggregate[1];"\n + tal:condition="python: len(aggregate_groups)"\n + tal:attributes="class python: \'wrapper %s\' % aggregate_name;\n + id python: \'wrapper_%s\' % aggregate_name;">\n +\n + <tal:block tal:repeat="group_details aggregate_groups">\n + <!-- Layout group rendering -->\n + <div tal:define="group_css_classes python: group_details[0]"\n + tal:attributes="class python: group_css_classes;\n + id python: group_css_classes.replace(\' \', \'_\');\n + title python: group_details[1];">\n +\n + <!-- Render each field in its group -->\n + <tal:block tal:repeat="field python: layout_form.get_fields_in_group(group_details[2])">\n + <tal:block metal:use-macro="here/field_render/macros/field_render"/>\n + </tal:block>\n +\n + </div>\n + </tal:block>\n +\n + </div>\n +</tal:block>\n +\n +<!-- ============================================================== --> + +]]></string> </value> + </item> + <item> + <key> <string>content_type</string> </key> + <value> <string>text/html</string> </value> + </item> + <item> + <key> <string>expand</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>erp5_web_macros</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_default_theme/erp5_web_default_template.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_default_theme/erp5_web_default_template.xml index b7ce3b7e5d..26df544edb 100644 --- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_default_theme/erp5_web_default_template.xml +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_default_theme/erp5_web_default_template.xml @@ -64,25 +64,28 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n \n <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n - <head tal:define="dummy python:request.RESPONSE.setHeader(\'Content-Type\', \'text/html;; charset=utf-8\')">\n + <head tal:define="dummy python: request.RESPONSE.setHeader(\'Content-Type\', \'text/html;; charset=utf-8\')">\n <meta name="generator" content="ERP5"/>\n <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>\n <title tal:content="python: \'%s | %s\' % (here.getTitleOrId(), here.getPortalObject().getTitle() or here.getPortalObject().getId())"/>\n \n + <!-- erp5_web_form.css is a constant among erp5 web themes -->\n <link rel="stylesheet" type="text/css" media="screen" href="erp5_web_form.css"/>\n + <!-- TODO: erp5_web_default_theme.css should be registered via generic mechanism -->\n <link rel="stylesheet" type="text/css" media="screen" href="erp5_web_default_theme.css"/>\n <tal:block tal:repeat="css css_list">\n <link tal:attributes="href css" type="text/css" rel="stylesheet"/>\n </tal:block>\n -\n - <tal:block metal:use-macro="here/global_definitions/macros/planning_box_definitions"/>\n \n <tal:block tal:repeat="js js_list">\n <script tal:attributes="src js" type="text/javascript"></script>\n </tal:block>\n +\n + <tal:block metal:use-macro="here/global_definitions/macros/planning_box_definitions"/>\n </head>\n \n <body>\n + <!-- Global form is used to save data of other fields when we edit one another (generally make sense in listbox and/or relation string field) -->\n <form id="main_form"\n tal:attributes="enctype form/enctype | nothing;\n action url;\n @@ -90,75 +93,31 @@ \n <tal:block metal:use-macro="here/global_definitions/macros/http_definitions"/>\n \n + <!-- Main content rendering -->\n <div id="main_content" class="column">\n <tal:block tal:condition="here/REQUEST/portal_status_message | nothing">\n - <!-- XXX Why no portal message displayed here ?\n + <!-- XXX Why no portal message displayed there ?\n Normally a message should be displayed when saving an object through web interface... -->\n <div tal:content="structure here/REQUEST/portal_status_message | nothing" id="transition_message"/>\n </tal:block>\n <tal:block metal:define-slot="main"/>\n </div>\n \n + <!-- Layout form rendering -->\n <tal:block tal:condition="python: layout_form is not None"\n tal:define="field_errors python: request.get(\'field_errors\', {});\n - dummy python: request.set(\'editable_mode\', 1);\n - groups python: layout_form.get_groups(include_empty=0)">\n + dummy python: request.set(\'editable_mode\', 1)">\n +\n <tal:block tal:define="template python: here.developper_shortcut_render">\n <tal:block metal:use-macro="template/macros/form"/>\n </tal:block>\n - <tal:block tal:repeat="group groups">\n - <div tal:condition="python: group.find(\'hidden\') < 0"\n - tal:define="group_details python: here.ERP5XhtmlStyle_getFormGroupTitleAndId(group);\n - group_css_classes python: group_details[0]"\n - tal:attributes="class python: group_css_classes;\n - id python: group_css_classes.replace(\' \', \'_\');\n - title python: group_details[1];\n - ">\n - <tal:block tal:repeat="field python: layout_form.get_fields_in_group(group)">\n - <tal:block metal:use-macro="here/field_render/macros/field_render"/>\n - </tal:block>\n - </div>\n - </tal:block>\n - </tal:block>\n -\n -\n -<!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXX NEXT VERSION ?? XXXXXXXXXXXXXXXXXXXXXXXXXXXX -->\n \n -<!--tal:block tal:condition="python: layout_form is not None"\n - tal:define="field_errors python: request.get(\'field_errors\', {});\n - dummy python: request.set(\'editable_mode\', 1);\n - aggregate_list python: layout_form.WebSite_getGroupList()">\n -\n - <tal:block tal:define="template python: here.developper_shortcut_render">\n - <tal:block metal:use-macro="template/macros/form"/>\n - </tal:block-->\n -\n - <!-- Each aggregate of groups is a <div> wrapper -->\n - <!--tal:block tal:repeat="aggregate aggregate_list">\n - <div tal:define="aggregate_name python: aggregate[0];\n - aggregate_groups python: aggregate[1];"\n - tal:condition="python: len(aggregate_groups)"\n - tal:attributes="class python: \'wrapper %s\' % aggregate_name;\n - id python: \'wrapper_%s\' % aggregate_name;">\n -\n - <tal:block tal:repeat="group_details aggregate_groups">\n - <div tal:define="group_css_classes python: group_details[0]"\n - tal:attributes="class python: group_css_classes;\n - id python: group_css_classes.replace(\' \', \'_\');\n - title python: group_details[1];">\n -\n - <tal:block tal:repeat="field python: layout_form.get_fields_in_group(group_details[2])">\n - <tal:block metal:use-macro="here/field_render/macros/field_render"/>\n + <tal:block tal:define="agg_list python: layout_form.WebSite_getGroupList([\'header\', \'left\', \'right\', \'footer\'])">\n + <tal:block tal:repeat="aggregate agg_list">\n + <tal:block metal:use-macro="here/erp5_web_macros/macros/render_aggregate"/>\n </tal:block>\n -\n - </div>\n + </tal:block>\n </tal:block>\n -\n - </div>\n - </tal:block>\n -\n -</tal:block-->\n -<!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -->\n \n </form>\n </body>\n diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_default_theme/erp5_web_default_theme.css.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_default_theme/erp5_web_default_theme.css.xml index 8c09e86db1..78c6bff20a 100644 --- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_default_theme/erp5_web_default_theme.css.xml +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_default_theme/erp5_web_default_theme.css.xml @@ -57,7 +57,7 @@ \n \n html {\n -/* XXX width: 85%; work with current layout technic but, background should be changed */\n + /* XXX width: 85%; work with current layout technic but, background should be changed */\n margin-right: auto;\n margin-left: auto;\n }\n diff --git a/bt5/erp5_web/bt/change_log b/bt5/erp5_web/bt/change_log index abe08fe8c2..a8ae2a91a1 100644 --- a/bt5/erp5_web/bt/change_log +++ b/bt5/erp5_web/bt/change_log @@ -1,3 +1,6 @@ +2006-09-12 Kevin +* Rewrite default group generation using macro and WebSite_getGroupList script. + 2006-09-11 Kevin * Split css in two parts: the generic classes for web forms and the specific classes for the theme. * Add the alpha code (still not used) that auto-aggregate some form groups in 1-pass for easy custom template creation (see big documentation in the script itself). diff --git a/bt5/erp5_web/bt/revision b/bt5/erp5_web/bt/revision index cadbe928f8..c4c828bd4e 100644 --- a/bt5/erp5_web/bt/revision +++ b/bt5/erp5_web/bt/revision @@ -1 +1 @@ -378 \ No newline at end of file +386 \ No newline at end of file diff --git a/bt5/erp5_web/bt/version b/bt5/erp5_web/bt/version index e8a28037c2..bdebe2b406 100644 --- a/bt5/erp5_web/bt/version +++ b/bt5/erp5_web/bt/version @@ -1 +1 @@ -0.3.31 \ No newline at end of file +0.3.32 \ No newline at end of file -- 2.30.9