Commit 8fb47e6f authored by Rafael Monnerat's avatar Rafael Monnerat

Added a generic clone feature at form view.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18455 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 32fb75f2
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</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>"""\n
Create new Document by cloning an existing document\n
or by creating a new document.\n
\n
Pretty messages are provided to the user.\n
"""\n
\n
translateString = context.Base_translateString\n
form_data = context.REQUEST.form\n
\n
# First make sure that no document already exists with the\n
# same portal_type, reference, language and version.\n
if clone:\n
portal_type = context.getPortalType()\n
else:\n
portal_type = form_data[\'clone_portal_type\']\n
\n
# prepare query params\n
kw = {\'portal_type\' : portal_type}\n
\n
# Standard cloning method\n
if clone:\n
# We copy contents in place if possible\n
directory = getattr(context, \'original_container\', None) or context.getParentValue()\n
# Copy and paste the object\n
original_id = getattr(context, \'original_id\', None) or context.getId()\n
# This is required for objects acquired in Web Section\n
clipboard = directory.manage_copyObjects(ids=[original_id])\n
paste_result = directory.manage_pasteObjects(cb_copy_data=clipboard)\n
new_object = directory[paste_result[0][\'new_id\']]\n
message_kind = \'clone\'\n
\n
if not editable_mode: \n
form_id = \'view\'\n
msg = translateString("Created %s ${portal_type}." % message_kind, mapping = kw)\n
return new_object.Base_redirect(form_id, \n
editable_mode=1,\n
keep_items={\'portal_status_message\': msg})\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>_params</string> </key>
<value> <string>clone=1, form_id, editable_mode=0</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>3</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>clone</string>
<string>form_id</string>
<string>editable_mode</string>
<string>_getattr_</string>
<string>context</string>
<string>translateString</string>
<string>form_data</string>
<string>portal_type</string>
<string>_getitem_</string>
<string>kw</string>
<string>getattr</string>
<string>None</string>
<string>directory</string>
<string>original_id</string>
<string>clipboard</string>
<string>paste_result</string>
<string>new_object</string>
<string>message_kind</string>
<string>msg</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<int>1</int>
<none/>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_createCloneDocument</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -204,6 +204,13 @@
<span class="image"></span>\n
<span class="description" i18n:translate="" i18n:domain="ui">New</span>\n
</button>\n
<button class="clone" type="submit" title="Clone"\n
tal:condition="python: not list_mode"\n
tal:attributes="name python: \'Base_createCloneDocument:method\'"\n
i18n:attributes="title" i18n:domain="ui">\n
<span class="image"></span>\n
<span class="description" i18n:translate="" i18n:domain="ui">Clone</span>\n
</button>\n
<button tal:condition="list_mode" class="delete" type="submit" name="Folder_deleteObjectList:method" title="Delete"\n
i18n:attributes="title" i18n:domain="ui">\n
<span class="image"></span>\n
......
......@@ -804,6 +804,10 @@ fieldset.bottom .field .input {\n
background-image: url(\'<dtml-var expr="portal_url()">/images/filenew.png\');\n
}\n
\n
#context_bar .tool_buttons .clone .image {\n
background-image: url(\'<dtml-var expr="portal_url()">/images/fileclone.png\');\n
}\n
\n
#context_bar .tool_buttons .jump_first .image {\n
background-image: url(\'<dtml-var expr="portal_url()">/images/2leftarrowb.png\');\n
}\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="Image" module="OFS.Image"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>style_cache</string> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>fileclone.png</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>image/png</string> </value>
</item>
<item>
<key> <string>data</string> </key>
<value> <string encoding="base64">iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABmJLR0QA/wD/AP+gvaeTAAAACXBI
WXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH1AcZDRMXMK5nmgAAAYhJREFUeNqllcFKw0AQhv+ZbPFB
PJYKBc8ePfsAvl17tw8iBGx7EPQNRKSaxrCb+T3ExMZu0kQHlhyG/fef2W8nQhLb7TPRE2m6xu3t
jWBMkMRm88TD8L5knnu+vLzx9XXHzeaJi8UdSWLo0thhSSJIEoHqT/ry8gLL5YpDDWtXQkSQJEnT
ivv7BwAYLO56T1VFWZa4vr7CbveB9/cM2+0j/ixcua2+qoosy5HnRas1/3IsQpgZ9vtPqCpUFfP5
7IiiGDVR4RAMIRiyLEdReADAdHoeyWffVcywXK54KK4x/MwMRVGAJCaT5E/UHAmXJRuXzrmGjLHU
uN9uvfcQkWb1XVgfNS1hs0r8VAyhpmXH+7K1+RReNTXel3BO4ZyLU2EWQApIay5xCDVnZxOQDiHY
sXDdAhFCRDpb0kUNWe1rCafpGmm67ix5Pp91UlNXFYIdC5+atfVL66LGzBpCTk63WHRRUx2AluNR
wmOoGem4poYtamJV6Jhf2CE1v1sxamwejsU+amLxBcwsVQMFoSFoAAAAAElFTkSuQmCC</string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <int>22</int> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <int>507</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>22</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
475
\ No newline at end of file
476
\ 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