From 462a60d5439b3265fdab9dc3fbf75f2dd590820f Mon Sep 17 00:00:00 2001 From: Fabien Morin <fabien@nexedi.com> Date: Mon, 8 Sep 2008 07:56:11 +0000 Subject: [PATCH] * add a script getPrintFormUrl to get print url from portal_types actions * change print link in header to correspond to the portal_type object displayed git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23474 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../erp5_egov/getPrintFormUrl.xml | 152 ++++++++++++++++++ .../WebSite_viewDGIDHeaderFormRenderer.xml | 11 +- .../WebSite_viewHeaderFormRenderer.xml | 11 +- bt5/erp5_egov/bt/revision | 2 +- 4 files changed, 173 insertions(+), 3 deletions(-) create mode 100644 bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/getPrintFormUrl.xml diff --git a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/getPrintFormUrl.xml b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/getPrintFormUrl.xml new file mode 100644 index 0000000000..705b7b0dbf --- /dev/null +++ b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/getPrintFormUrl.xml @@ -0,0 +1,152 @@ +<?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>if not context.portal_actions.listFilteredActionsFor(context).has_key(\'object_print\'):\n + return None\n +\n +new_print_action_list = context.Base_fixDialogActions(\n + context.Base_filterDuplicateActions(\n + context.portal_actions.listFilteredActionsFor(context)), \'object_print\')\n +if new_print_action_list:\n + return new_print_action_list[0][\'original_url\']\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></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>0</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>_getattr_</string> + <string>context</string> + <string>None</string> + <string>new_print_action_list</string> + <string>_getitem_</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>getPrintFormUrl</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_widget_library/WebSite_viewDGIDHeaderFormRenderer.xml b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_widget_library/WebSite_viewDGIDHeaderFormRenderer.xml index 22e30ebdd3..21f83a0727 100644 --- a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_widget_library/WebSite_viewDGIDHeaderFormRenderer.xml +++ b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_widget_library/WebSite_viewDGIDHeaderFormRenderer.xml @@ -62,7 +62,10 @@ <span class="onright">\n <a class="home" tal:attributes="href python:context.getWebSiteValue().absolute_url()" href="./home" \n i18n:translate="" i18n:domain="ui">Home</a>\n - <a class="print" href="DeclarationTVA_viewDeclarationTVAAsPdf" i18n:translate="" i18n:domain="ui">Print</a>\n + <tal:block tal:condition="python: context.getPrintFormUrl() is not None">\n + <a class="print" href="DeclarationTVA_viewDeclarationTVAAsPdf"\n + tal:attributes="href python: context.getPrintFormUrl()" i18n:translate="" i18n:domain="ui">Print</a>\n + </tal:block> \n <a class="help" href="./help" i18n:translate="" i18n:domain="ui">Help</a>\n </span>\n <div class="clear">\n @@ -89,6 +92,12 @@ <key> <string>title</string> </key> <value> <string></string> </value> </item> + <item> + <key> <string>uid</string> </key> + <value> + <none/> + </value> + </item> </dictionary> </pickle> </record> diff --git a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_widget_library/WebSite_viewHeaderFormRenderer.xml b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_widget_library/WebSite_viewHeaderFormRenderer.xml index 340df90580..675dda9753 100644 --- a/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_widget_library/WebSite_viewHeaderFormRenderer.xml +++ b/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov_widget_library/WebSite_viewHeaderFormRenderer.xml @@ -62,7 +62,10 @@ <span class="onright">\n <a class="home" tal:attributes="href python:context.getWebSiteValue().absolute_url()" href="./home" \n i18n:translate="" i18n:domain="ui">Home</a>\n - <a class="print" href="DeclarationTVA_viewDeclarationTVAAsPdf" i18n:translate="" i18n:domain="ui">Print</a>\n + <tal:block tal:condition="python: context.getPrintFormUrl() is not None">\n + <a class="print" href="DeclarationTVA_viewDeclarationTVAAsPdf"\n + tal:attributes="href python: context.getPrintFormUrl()" i18n:translate="" i18n:domain="ui">Print</a>\n + </tal:block>\n <!--<a class="help" href="EGov_helpWithContext" tal:attributes="href python:\'help/\' + here.EGov_helpWithContext()" i18n:translate="" i18n:domain="ui">Help</a>-->\n <a class="help" href="EGov_helpWithContext" tal:attributes="href python:\'help/\' + here.EGov_helpWithContext()" onclick="window.open(this.href, \'safi_help\',\'width=800,height=500,menubar=yes,toolbar=yes,scrollbars=yes,resizable=yes\'); return false;" i18n:translate="" i18n:domain="ui">Help</a>\n </span>\n @@ -90,6 +93,12 @@ <key> <string>title</string> </key> <value> <string></string> </value> </item> + <item> + <key> <string>uid</string> </key> + <value> + <none/> + </value> + </item> </dictionary> </pickle> </record> diff --git a/bt5/erp5_egov/bt/revision b/bt5/erp5_egov/bt/revision index 44dfb1d0bc..4acc65d012 100644 --- a/bt5/erp5_egov/bt/revision +++ b/bt5/erp5_egov/bt/revision @@ -1 +1 @@ -264 \ No newline at end of file +266 \ No newline at end of file -- 2.30.9