Commit 88245214 authored by Gabriel Monnerat's avatar Gabriel Monnerat

2010-12-22 gabriel

* Implemented code to allow which the user edit the document using the reference of the document shared. If is a Anonymous User, one user is created to him.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41659 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d390555c
...@@ -50,8 +50,30 @@ ...@@ -50,8 +50,30 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>if context.REQUEST.form.has_key("key"):\n <value> <string>"""\n
webpage = context.portal_catalog.getResultValue(reference=context.REQUEST.form.get("key"))\n Redirect connected user to UNG Web Site or to document using the key \n
"""\n
portal = context.getPortalObject()\n
\n
if portal.portal_membership.isAnonymousUser() and context.REQUEST.form.has_key("key"):\n
kw = {}\n
module = portal.getDefaultModule(\'Person\')\n
reference = str(DateTime().millis())\n
person = module.newContent(portal_type=\'Person\',\n
description=context.REQUEST.get(\'HTTP_X_FORWARDED_FOR\',\'Found no ip\'),\n
reference=reference,\n
)\n
assignment = person.newContent(portal_type="Assignment")\n
assignment.open()\n
person.validate()\n
uf = getattr(portal, \'acl_users\', None)\n
plugin = getattr(uf, \'ung_key_auth\',None)\n
kw["__ac_key"] = plugin.encrypt(reference)\n
kw["key"] = context.REQUEST.form.get("key")\n
return context.Base_redirect("/", keep_items=dict(**kw)) \n
\n
if context.REQUEST.form.has_key("key"):\n
webpage = context.WebSection_userFollowUpWebPage(reference=context.REQUEST.form.get("key"))\n
webpage_id = webpage.getId()\n webpage_id = webpage.getId()\n
editor_name = context.Base_getEditorViewName(webpage.getPortalType())\n editor_name = context.Base_getEditorViewName(webpage.getPortalType())\n
return context.Base_redirect("/web_page_module/%s/%s" % (webpage_id, editor_name),\n return context.Base_redirect("/web_page_module/%s/%s" % (webpage_id, editor_name),\n
...@@ -75,6 +97,16 @@ else:\n ...@@ -75,6 +97,16 @@ else:\n
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
<value> <value>
...@@ -101,10 +133,24 @@ else:\n ...@@ -101,10 +133,24 @@ else:\n
<tuple> <tuple>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>portal</string>
<string>kw</string>
<string>module</string>
<string>str</string>
<string>DateTime</string>
<string>reference</string>
<string>person</string>
<string>assignment</string>
<string>getattr</string>
<string>None</string>
<string>uf</string>
<string>plugin</string>
<string>_write_</string>
<string>_apply_</string>
<string>dict</string>
<string>webpage</string> <string>webpage</string>
<string>webpage_id</string> <string>webpage_id</string>
<string>editor_name</string> <string>editor_name</string>
<string>dict</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>if context.getReference().startswith("default-"):\n <value> <string>if context.getReference().startswith("default-"):\n
context.setReference(DateTime().millis())\n context.setReference(DateTime().millis())\n
context.share()\n
return "%s/?key=%s" % (context.REQUEST.get("URL3"), context.getReference())\n return "%s/?key=%s" % (context.REQUEST.get("URL3"), context.getReference())\n
</string> </value> </string> </value>
</item> </item>
......
...@@ -50,14 +50,14 @@ ...@@ -50,14 +50,14 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>portal_type_dict = {"Web Page": "Text",\n <value> <string>portal_type_dict = {"Web Page": ["Text", "web_page_template"],\n
"Web Table": "Spreadsheet",\n "Web Table": ["Spreadsheet", "web_table_template"],\n
"Web Illustration": "Drawing"}\n "Web Illustration": ["Drawing", "web_illustration_template"]}\n
\n \n
portal_type = context.REQUEST.form.get("portal_type")\n portal_type = context.REQUEST.form.get("portal_type")\n
document = context.Base_contribute(file=file, \n document = context.Base_contribute(file=file, \n
url=None, \n url=None, \n
portal_type=portal_type_dict.get(portal_type), \n portal_type=portal_type_dict.get(portal_type)[0], \n
synchronous_metadata_discovery=None, \n synchronous_metadata_discovery=None, \n
redirect_to_document=False, \n redirect_to_document=False, \n
attach_document_to_context=False, \n attach_document_to_context=False, \n
...@@ -70,19 +70,91 @@ document = context.Base_contribute(file=file, \n ...@@ -70,19 +70,91 @@ document = context.Base_contribute(file=file, \n
follow_up_list=None, \n follow_up_list=None, \n
)\n )\n
\n \n
return context.ERP5Site_createNewWebDocument(selection_action=portal_type,\n return context.ERP5Site_createNewWebDocument(template=portal_type_dict.get(portal_type)[1],\n
selection_action=portal_type,\n
document_path=document.getPath(),\n document_path=document.getPath(),\n
upload_document=1)\n upload_document=1)\n
</string> </value> </string> </value>
</item> </item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>file, **kw</string> </value> <value> <string>file, **kw</string> </value>
</item> </item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</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>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>file</string>
<string>kw</string>
<string>portal_type_dict</string>
<string>_getattr_</string>
<string>context</string>
<string>portal_type</string>
<string>None</string>
<string>_getitem_</string>
<string>False</string>
<string>document</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>WebSection_uploadDocument</string> </value> <value> <string>WebSection_uploadDocument</string> </value>
</item> </item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
......
<?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>portal = context.getPortalObject()\n
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
\n
webpage = portal.portal_catalog.getResultValue(reference=reference)\n
if person.getRelativeUrl() not in webpage.getFollowUpList():\n
value_list = webpage.getFollowUpValueList()\n
value_list.append(person)\n
webpage.setFollowUpValueList(value_list)\n
\n
return webpage\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>reference</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</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>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>reference</string>
<string>_getattr_</string>
<string>context</string>
<string>portal</string>
<string>person</string>
<string>webpage</string>
<string>value_list</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSection_userFollowUpWebPage</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
2010-12-22 gabriel 2010-12-22 gabriel
* Implemented code to allow which the user edit the document using the reference of the document shared. If is a Anonymous User, one user is created to him.
* Clean up the script to generate the UNG Domains and remove not used scripts. * Clean up the script to generate the UNG Domains and remove not used scripts.
2010-12-20 gabriel 2010-12-20 gabriel
......
136 137
\ No newline at end of file \ No newline at end of file
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