[Erp5-report] r13484 - /erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widg...

nobody at svn.erp5.org nobody at svn.erp5.org
Sun Mar 18 20:08:21 CET 2007


Author: jp
Date: Sun Mar 18 20:08:18 2007
New Revision: 13484

URL: http://svn.erp5.org?rev=13484&view=rev
Log:
Improved contribution page

Added:
    erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_linkContent.xml
Modified:
    erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_contributeContent.xml
    erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_viewContributeRenderer.xml
    erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/au_macros.xml

Modified: erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_contributeContent.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_contributeContent.xml?rev=13484&r1=13483&r2=13484&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_contributeContent.xml (original)
+++ erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_contributeContent.xml Sun Mar 18 20:08:18 2007
@@ -70,22 +70,37 @@
             <key> <string>_body</string> </key>
             <value> <string>"""\n
   A method invoked with parameters provided by the \n
-  contribute widget\n
+  contribute widget.\n
+\n
+  **kw -- remaining params passed to the constructor\n
 """\n
-try:\n
-  res = context.portal_contributions.newContent(**kw)\n
-  after_method_id = kw.get(\'after_method_id\')\n
-  if after_method_id:\n
-    after_method = getattr(res, after_method_id)\n
-    after_method() # if not found will raise exception, as it should\n
+# Do some processing of parameters cause we do not use ERP5 Form here\n
+if contribute_classification:\n
+  kw[\'classification\'] = contribute_classification\n
+\n
+if contribute_source_project:\n
+  kw[\'source_project\'] = contribute_source_project\n
+\n
+if contribute_portal_type:\n
+  kw[\'portal_type\'] = contribute_portal_type\n
+\n
+if contribute_file is not None:\n
+  kw[\'file\'] = contribute_file\n
+\n
+#try:\n
+if 1:\n
+  new_content = context.portal_contributions.newContent(**kw)\n
   msg = context.Base_translateString(\'Document successfully created\')\n
-  target = res\n
-except Exception, e:\n
+  target = new_content\n
+  editable_mode = 1\n
+else:\n
+#except Exception, e:\n
   msg = \'There was a problem: ${exception}\'\n
   msg = context.Base_translateString(msg, mapping=dict(exception=str(e)))\n
   target = context\n
+  editable_mode = 0\n
 \n
-return target.Base_redirect(\'view\', keep_items=dict(portal_status_message=msg))\n
+return target.Base_redirect(\'view\', keep_items=dict(portal_status_message=msg, editable_mode=editable_mode))\n
 </string> </value>
         </item>
         <item>
@@ -102,7 +117,7 @@
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>*a, **kw</string> </value>
+            <value> <string>contribute_file=None, contribute_classification=None, contribute_source_project=None, contribute_portal_type=None, **kw</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -122,27 +137,29 @@
                   <dictionary>
                     <item>
                         <key> <string>co_argcount</string> </key>
-                        <value> <int>0</int> </value>
+                        <value> <int>4</int> </value>
                     </item>
                     <item>
                         <key> <string>co_varnames</string> </key>
                         <value>
                           <tuple>
-                            <string>a</string>
+                            <string>contribute_file</string>
+                            <string>contribute_classification</string>
+                            <string>contribute_source_project</string>
+                            <string>contribute_portal_type</string>
                             <string>kw</string>
+                            <string>_write_</string>
+                            <string>None</string>
                             <string>_apply_</string>
                             <string>_getattr_</string>
                             <string>context</string>
-                            <string>res</string>
-                            <string>after_method_id</string>
-                            <string>getattr</string>
-                            <string>after_method</string>
+                            <string>new_content</string>
                             <string>msg</string>
                             <string>target</string>
-                            <string>Exception</string>
-                            <string>e</string>
+                            <string>editable_mode</string>
                             <string>dict</string>
                             <string>str</string>
+                            <string>e</string>
                           </tuple>
                         </value>
                     </item>
@@ -154,7 +171,12 @@
         <item>
             <key> <string>func_defaults</string> </key>
             <value>
-              <none/>
+              <tuple>
+                <none/>
+                <none/>
+                <none/>
+                <none/>
+              </tuple>
             </value>
         </item>
         <item>

Added: erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_linkContent.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_linkContent.xml?rev=13484&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_linkContent.xml (added)
+++ erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_linkContent.xml Sun Mar 18 20:08:18 2007
@@ -1,0 +1,199 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.PythonScripts.PythonScript</string>
+          <string>PythonScript</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Python_magic</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <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_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># Do some processing of parameters cause we do not use ERP5 Form here\n
+if link_classification:\n
+  kw[\'classification\'] = link_classification\n
+\n
+if link_source_project:\n
+  kw[\'source_project\'] = link_source_project\n
+\n
+if link_portal_type:\n
+  kw[\'portal_type\'] = link_portal_type\n
+\n
+if link_description:\n
+  kw[\'description\'] = link_description\n
+\n
+if link_url:\n
+  kw[\'url\'] = link_url\n
+\n
+#try:\n
+if 1:\n
+  new_content = context.portal_contributions.newContent(**kw)\n
+  msg = context.Base_translateString(\'Document successfully created\')\n
+  target = new_content\n
+  editable_mode = 1\n
+else:\n
+#except Exception, e:\n
+  msg = \'There was a problem: ${exception}\'\n
+  msg = context.Base_translateString(msg, mapping=dict(exception=str(e)))\n
+  target = context\n
+  editable_mode = 0\n
+\n
+return target.Base_redirect(\'view\', keep_items=dict(portal_status_message=msg, editable_mode=editable_mode))\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_filepath</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_owner</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>link_url=None, link_description=None, link_classification=None, link_source_project=None, link_portal_type=None, **kw</string> </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>5</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>link_url</string>
+                            <string>link_description</string>
+                            <string>link_classification</string>
+                            <string>link_source_project</string>
+                            <string>link_portal_type</string>
+                            <string>kw</string>
+                            <string>_write_</string>
+                            <string>_apply_</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>new_content</string>
+                            <string>msg</string>
+                            <string>target</string>
+                            <string>editable_mode</string>
+                            <string>dict</string>
+                            <string>str</string>
+                            <string>e</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <tuple>
+                <none/>
+                <none/>
+                <none/>
+                <none/>
+                <none/>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>WebSite_linkContent</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Modified: erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_viewContributeRenderer.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_viewContributeRenderer.xml?rev=13484&r1=13483&r2=13484&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_viewContributeRenderer.xml (original)
+++ erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_viewContributeRenderer.xml Sun Mar 18 20:08:18 2007
@@ -45,6 +45,12 @@
             </value>
         </item>
         <item>
+            <key> <string>_owner</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
             <key> <string>_text</string> </key>
             <value> <string encoding="cdata"><![CDATA[
 
@@ -60,8 +66,8 @@
     <h2>Contribute</h2>\n
     <div class="fieldset">\n
       <div>\n
-        <label for="doctype" i18n:translate="" i18n:domain="ui">Type</label>\n
-        <select size="1" name="doctype" id="doctype" onchange="toggleMakeTemplateButton(this);">\n
+        <label for="contribute_portal_type" i18n:translate="" i18n:domain="ui">Type</label>\n
+        <select size="1" name="contribute_portal_type" id="portal_type" onchange="toggleMakeTemplateButton(this);">\n
           <option value="" i18n:translate="" i18n:domain="ui">-- Select Document Type --</option>\n
           <tal:block tal:repeat="ptype here/getPortalTemplateDocumentTypeList">\n
             <option \n
@@ -70,15 +76,16 @@
           </tal:block>\n
           <option value="" i18n:translate="" i18n:domain="ui">-- Any other Documents Type --</option>\n
         </select>\n
-        <input type="file" name="datafile" size="30" />\n
+        <input type="file" name="contribute_file" size="30" />\n
       </div>\n
       <!--<a onclick="setMailString();" id="mail_contribute_button" href="mailto:dms at dms.nexedi.com?subject=Contribution&body=">\n
         <img src="au_icons/kmail.png" align="right" alt="contribute by mail" title="contribute by mail"/>\n
       </a>-->\n
-      <div style="float:left">\n
-      <div metal:use-macro="here/au_macros/macros/contribute_properties">\n
-        Theme\n
-      </div>\n
+      <div style="float:left"\n
+           tal:define="contribute_prefix string:contribute_">\n
+        <div metal:use-macro="here/au_macros/macros/contribute_properties">\n
+          Theme\n
+        </div>\n
       </div>\n
       \n
       <div style="float:right; margin-top:10px;">\n
@@ -104,11 +111,17 @@
     <div class="fieldset">\n
       <div>\n
         <label for="url" value="" i18n:translate="" i18n:domain="ui">Url</label>\n
-        <input type="text" name="url" id="url" size="80" value="http://" />\n
+        <input type="text" name="link_url" id="url" size="80" value="http://" />\n
         <a href="" target="_blank" onclick="return setLink(this)" value="" i18n:translate="" i18n:domain="ui">preview</a>\n
       </div>\n
-      <div metal:use-macro="here/au_macros/macros/contribute_properties">\n
-        Theme\n
+      <tal:block tal:define="contribute_prefix string:link_">\n
+        <div metal:use-macro="here/au_macros/macros/contribute_properties">\n
+          Theme\n
+        </div>\n
+      </tal:block>\n
+      <div>\n
+        <label for="link_description" value="" i18n:translate="" i18n:domain="ui">Description</label>\n
+        <textarea cols="80" rows="2" name="link_description"></textarea>\n
       </div>\n
     </div>\n
     <input style="float:right" type="submit" name="WebSite_linkContent:method" value="Contribute"/>\n
@@ -159,9 +172,9 @@
           </ul>\n
         </ul>\n
       </div>\n
-      \n
+\n
     </tal:block>\n
-       \n
+\n
     <div class="clear"></div>\n
   </div>\n
 </div>\n

Modified: erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/au_macros.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/au_macros.xml?rev=13484&r1=13483&r2=13484&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/au_macros.xml (original)
+++ erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/au_macros.xml Sun Mar 18 20:08:18 2007
@@ -59,10 +59,12 @@
 <tal:block replace="nothing">\n
   This is used in main panel to fill properties for contributing document or external resource\n
 </tal:block>\n
-<div metal:define-macro="contribute_properties">\n
+<div metal:define-macro="contribute_properties"\n
+     tal:define="contribute_prefix contribute_prefix | string:">\n
   <div>\n
     <label for="classification" value="" i18n:translate="" i18n:domain="ui">Classification</label>\n
-    <select size="1" name="classification" id="classification">\n
+    <select size="1" name="classification" id="classification"\n
+                     tal:attributes="name string:${contribute_prefix}classification">\n
       <option value="" value="" i18n:translate="" i18n:domain="ui">-- Select Classification --</option>\n
       <option tal:repeat="item python:[c for c in here.portal_categories.classification.getCategoryChildLogicalPathItemList()[1:] if len(c[1].split(\'/\'))>1]" tal:content="python:item[0]" tal:attributes="value python:item[1]">\n
         Agricultural Development\n
@@ -70,8 +72,9 @@
     </select>\n
   </div>\n
   <div>\n
-    <label for="project" value="" i18n:translate="" i18n:domain="ui">Programme</label>\n
-    <select size="1" id="project" name="project">\n
+    <label for="source_project" value="" i18n:translate="" i18n:domain="ui">Programme</label>\n
+    <select size="1" id="source_project" name="source_project"\n
+                     tal:attributes="name string:${contribute_prefix}source_project">\n
       <option value="" value="" i18n:translate="" i18n:domain="ui">-- Select Programme --</option>\n
       <option tal:repeat="item python:[(o.getTitle(),o.getRelativeUrl()) for o in here.project_module.searchFolder()]" tal:content="python:item[0]" tal:attributes="value python:item[1]">\n
         Agricultural Development\n




More information about the Erp5-report mailing list