Commit 2fe75b55 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Improved contribution page

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13484 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 05d8e391
...@@ -70,22 +70,37 @@ ...@@ -70,22 +70,37 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>"""\n <value> <string>"""\n
A method invoked with parameters provided by the \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 """\n
try:\n # Do some processing of parameters cause we do not use ERP5 Form here\n
res = context.portal_contributions.newContent(**kw)\n if contribute_classification:\n
after_method_id = kw.get(\'after_method_id\')\n kw[\'classification\'] = contribute_classification\n
if after_method_id:\n \n
after_method = getattr(res, after_method_id)\n if contribute_source_project:\n
after_method() # if not found will raise exception, as it should\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 msg = context.Base_translateString(\'Document successfully created\')\n
target = res\n target = new_content\n
except Exception, e:\n editable_mode = 1\n
else:\n
#except Exception, e:\n
msg = \'There was a problem: ${exception}\'\n msg = \'There was a problem: ${exception}\'\n
msg = context.Base_translateString(msg, mapping=dict(exception=str(e)))\n msg = context.Base_translateString(msg, mapping=dict(exception=str(e)))\n
target = context\n target = context\n
editable_mode = 0\n
\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> </string> </value>
</item> </item>
<item> <item>
...@@ -102,7 +117,7 @@ return target.Base_redirect(\'view\', keep_items=dict(portal_status_message=msg) ...@@ -102,7 +117,7 @@ return target.Base_redirect(\'view\', keep_items=dict(portal_status_message=msg)
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <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>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -122,27 +137,29 @@ return target.Base_redirect(\'view\', keep_items=dict(portal_status_message=msg) ...@@ -122,27 +137,29 @@ return target.Base_redirect(\'view\', keep_items=dict(portal_status_message=msg)
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>0</int> </value> <value> <int>4</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <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>kw</string>
<string>_write_</string>
<string>None</string>
<string>_apply_</string> <string>_apply_</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>res</string> <string>new_content</string>
<string>after_method_id</string>
<string>getattr</string>
<string>after_method</string>
<string>msg</string> <string>msg</string>
<string>target</string> <string>target</string>
<string>Exception</string> <string>editable_mode</string>
<string>e</string>
<string>dict</string> <string>dict</string>
<string>str</string> <string>str</string>
<string>e</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -154,7 +171,12 @@ return target.Base_redirect(\'view\', keep_items=dict(portal_status_message=msg) ...@@ -154,7 +171,12 @@ return target.Base_redirect(\'view\', keep_items=dict(portal_status_message=msg)
<item> <item>
<key> <string>func_defaults</string> </key> <key> <string>func_defaults</string> </key>
<value> <value>
<tuple>
<none/>
<none/> <none/>
<none/>
<none/>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
<?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>
...@@ -44,6 +44,12 @@ ...@@ -44,6 +44,12 @@
</object> </object>
</value> </value>
</item> </item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
...@@ -60,8 +66,8 @@ ...@@ -60,8 +66,8 @@
<h2>Contribute</h2>\n <h2>Contribute</h2>\n
<div class="fieldset">\n <div class="fieldset">\n
<div>\n <div>\n
<label for="doctype" i18n:translate="" i18n:domain="ui">Type</label>\n <label for="contribute_portal_type" i18n:translate="" i18n:domain="ui">Type</label>\n
<select size="1" name="doctype" id="doctype" onchange="toggleMakeTemplateButton(this);">\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 <option value="" i18n:translate="" i18n:domain="ui">-- Select Document Type --</option>\n
<tal:block tal:repeat="ptype here/getPortalTemplateDocumentTypeList">\n <tal:block tal:repeat="ptype here/getPortalTemplateDocumentTypeList">\n
<option \n <option \n
...@@ -70,12 +76,13 @@ ...@@ -70,12 +76,13 @@
</tal:block>\n </tal:block>\n
<option value="" i18n:translate="" i18n:domain="ui">-- Any other Documents Type --</option>\n <option value="" i18n:translate="" i18n:domain="ui">-- Any other Documents Type --</option>\n
</select>\n </select>\n
<input type="file" name="datafile" size="30" />\n <input type="file" name="contribute_file" size="30" />\n
</div>\n </div>\n
<!--<a onclick="setMailString();" id="mail_contribute_button" href="mailto:dms@dms.nexedi.com?subject=Contribution&body=">\n <!--<a onclick="setMailString();" id="mail_contribute_button" href="mailto:dms@dms.nexedi.com?subject=Contribution&body=">\n
<img src="au_icons/kmail.png" align="right" alt="contribute by mail" title="contribute by mail"/>\n <img src="au_icons/kmail.png" align="right" alt="contribute by mail" title="contribute by mail"/>\n
</a>-->\n </a>-->\n
<div style="float:left">\n <div style="float:left"\n
tal:define="contribute_prefix string:contribute_">\n
<div metal:use-macro="here/au_macros/macros/contribute_properties">\n <div metal:use-macro="here/au_macros/macros/contribute_properties">\n
Theme\n Theme\n
</div>\n </div>\n
...@@ -104,12 +111,18 @@ ...@@ -104,12 +111,18 @@
<div class="fieldset">\n <div class="fieldset">\n
<div>\n <div>\n
<label for="url" value="" i18n:translate="" i18n:domain="ui">Url</label>\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 <a href="" target="_blank" onclick="return setLink(this)" value="" i18n:translate="" i18n:domain="ui">preview</a>\n
</div>\n </div>\n
<tal:block tal:define="contribute_prefix string:link_">\n
<div metal:use-macro="here/au_macros/macros/contribute_properties">\n <div metal:use-macro="here/au_macros/macros/contribute_properties">\n
Theme\n Theme\n
</div>\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 </div>\n
<input style="float:right" type="submit" name="WebSite_linkContent:method" value="Contribute"/>\n <input style="float:right" type="submit" name="WebSite_linkContent:method" value="Contribute"/>\n
<div class="clear"></div>\n <div class="clear"></div>\n
...@@ -159,9 +172,9 @@ ...@@ -159,9 +172,9 @@
</ul>\n </ul>\n
</ul>\n </ul>\n
</div>\n </div>\n
\n \n
</tal:block>\n </tal:block>\n
\n \n
<div class="clear"></div>\n <div class="clear"></div>\n
</div>\n </div>\n
</div>\n </div>\n
......
...@@ -59,10 +59,12 @@ ...@@ -59,10 +59,12 @@
<tal:block replace="nothing">\n <tal:block replace="nothing">\n
This is used in main panel to fill properties for contributing document or external resource\n This is used in main panel to fill properties for contributing document or external resource\n
</tal:block>\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 <div>\n
<label for="classification" value="" i18n:translate="" i18n:domain="ui">Classification</label>\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 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 <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 Agricultural Development\n
...@@ -70,8 +72,9 @@ ...@@ -70,8 +72,9 @@
</select>\n </select>\n
</div>\n </div>\n
<div>\n <div>\n
<label for="project" value="" i18n:translate="" i18n:domain="ui">Programme</label>\n <label for="source_project" value="" i18n:translate="" i18n:domain="ui">Programme</label>\n
<select size="1" id="project" name="project">\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 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 <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 Agricultural Development\n
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment