diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/Base_checkCloneConsistency.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/Base_checkCloneConsistency.xml new file mode 100644 index 0000000000000000000000000000000000000000..ed093bb329c1cb7cb0d62481931187db486cee1e --- /dev/null +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/Base_checkCloneConsistency.xml @@ -0,0 +1,181 @@ +<?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 + Currently it is not possible to change it to checkConsistency.\n + If it added similar constraints at Documents will break archive \n + behaviour. \n +"""\n +form_data = context.REQUEST.form\n +translateString = context.Base_translateString\n +\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 +if form_data.get(\'clone_reference\'): \n + kw[\'reference\'] = form_data[\'clone_reference\']\n +if form_data.get(\'clone_version\'): \n + kw[\'version\'] = form_data[\'clone_version\']\n +if form_data.get(\'clone_language\'): \n + kw[\'language\'] = form_data[\'clone_language\']\n +\n +# Count documents of same reference and prepare kw\n +count = int(context.portal_catalog.countResults(**kw)[0][0])\n +\n +if count:\n + return translateString("Sorry, a ${portal_type} with reference \'${reference}\' and version \'${version} [${language}]\' already exists. Please select another reference or version.", mapping = kw)\n +\n +return None\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, **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>1</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>clone</string> + <string>kw</string> + <string>_getattr_</string> + <string>context</string> + <string>form_data</string> + <string>translateString</string> + <string>portal_type</string> + <string>_getitem_</string> + <string>_write_</string> + <string>int</string> + <string>_apply_</string> + <string>count</string> + <string>None</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <tuple> + <int>1</int> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Base_checkCloneConsistency</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/Base_cloneContent.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/Base_cloneContent.xml index 804cf45024f0150cda31d1bd720933c0e645a272..cd9f680ba6f287ecc6563b480c89d1484e041f80 100644 --- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/Base_cloneContent.xml +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/Base_cloneContent.xml @@ -75,82 +75,10 @@ with same reference, version, language. Pretty messages\n are provided to the user.\n """\n -\n -translateString = context.Base_translateString\n -form_data = context.REQUEST.form\n -\n -# Define a list of field name to take into account in the cloning process\n -ACCEPTABLE_FORM_ID_LIST = [ \\\n - \'clone_reference\'\n - , \'clone_language\'\n - , \'clone_version\'\n - , \'clone_revision\'\n - , \'clone_title\'\n - , \'clone_short_title\'\n -]\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 -if form_data.get(\'clone_reference\'): \n - kw[\'reference\'] = form_data[\'clone_reference\']\n -if form_data.get(\'clone_version\'): \n - kw[\'version\'] = form_data[\'clone_version\']\n -if form_data.get(\'clone_language\'): \n - kw[\'language\'] = form_data[\'clone_language\']\n -\n -# Count documents of same reference and prepare kw\n -count = int(context.portal_catalog.countResults(**kw)[0][0])\n -kw[\'reference\'] = kw.get(\'reference\', \'undefined\')\n -kw[\'language\'] = kw.get(\'language\', \'any\')\n -kw[\'version\'] = kw.get(\'version\', \'undefined\')\n -\n -# if count results not 0, warn user\n -if count:\n - msg = translateString("Sorry, a ${portal_type} with reference \'${reference}\' and version \'${version} [${language}]\' already exists. Please select another reference or version.", mapping = kw)\n - return context.Base_redirect(form_id, \n - editable_mode=editable_mode,\n - keep_items={\'portal_status_message\': msg})\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 -else:\n - # Guess the new document module\n - portal = context.getPortalObject()\n - module = portal.getDefaultModule(portal_type=portal_type)\n - new_object = module.newContent(portal_type = portal_type)\n - form_id = \'view\'\n - message_kind = \'new\'\n -\n -# Set properties to the new object\n -edit_kw = {}\n -property_id_list = new_object.propertyIds()\n -for (key, val) in form_data.items():\n - if key in ACCEPTABLE_FORM_ID_LIST and key[len(\'clone_\'):] in property_id_list:\n - edit_kw[key[len(\'clone_\'):]] = val\n -new_object.edit(**edit_kw)\n -\n -if not editable_mode: \n - form_id = \'view\'\n -msg = translateString("Created %s ${portal_type} with reference \'${reference}\' and version \'${version} [${language}]\'." % message_kind, mapping = kw)\n -return new_object.Base_redirect(form_id, \n - editable_mode=1,\n - keep_items={\'portal_status_message\': msg})\n +context.Base_createCloneDocument(web_mode=1, \n + clone=clone, \n + form_id=form_id, \n + editable_mode=editable_mode)\n </string> </value> </item> <item> @@ -206,33 +134,6 @@ return new_object.Base_redirect(form_id, \n <string>editable_mode</string> <string>_getattr_</string> <string>context</string> - <string>translateString</string> - <string>form_data</string> - <string>ACCEPTABLE_FORM_ID_LIST</string> - <string>portal_type</string> - <string>_getitem_</string> - <string>kw</string> - <string>_write_</string> - <string>int</string> - <string>_apply_</string> - <string>count</string> - <string>msg</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>portal</string> - <string>module</string> - <string>edit_kw</string> - <string>property_id_list</string> - <string>_getiter_</string> - <string>key</string> - <string>val</string> - <string>len</string> </tuple> </value> </item> diff --git a/bt5/erp5_web/bt/revision b/bt5/erp5_web/bt/revision index 01b67236d1db8c71f501afae086d7dcf09b0f193..a3d3658d4368a8857b932e02b560338eae532268 100644 --- a/bt5/erp5_web/bt/revision +++ b/bt5/erp5_web/bt/revision @@ -1 +1 @@ -688 \ No newline at end of file +690 \ No newline at end of file