Commit 995934c2 authored by Ayush Tiwari's avatar Ayush Tiwari

bt5_config: Remove useless files from erp5_xhtml_style folder

parent 0b4cdd11
"""This script fix dialog actions to add an empty dialog for object_print
actions that does not provide one.
"""
from Products.PythonScripts.standard import url_quote
if dialog_category == 'object_report':
return sorted(actions.get('object_report', []) + actions.get('object_report_jio', []), key=lambda x: x["priority"])
elif dialog_category == 'object_exchange':
return sorted(actions.get('object_exchange', []) + actions.get('object_exchange_jio', []), key=lambda x: x["priority"])
if dialog_category != 'object_print':
return actions.get(dialog_category, [])
def addDialogIfNeeded(url):
'''If the action url is not a dialog, we add a generic print dialog.
'''
parts = url.split('/')
absolute_url = '/'.join(parts[:-1])
action = parts[-1]
action_list = action.split('?')
action_id = action_list[0]
form = getattr(context, action_id, None)
# try to get format parameter if exists
parameter_kw = {}
format = ''
if len(action_list) > 1:
parameter_list = action.split('?')[1]
parameter_tuple_list = [tuple(tuple_parameter.split('=')) for tuple_parameter in parameter_list.split('&')]
parameter_kw = dict(parameter_tuple_list)
meta_type = getattr(form, 'meta_type', None)
if meta_type in ('ERP5 Form Printout', 'ERP5 OOo Template',):
# The target is a Form Printout or OOoTemplate so use dedicated form_dialog to enable
# conversion and/or deferred reporting
if meta_type == 'ERP5 Form Printout':
base_content_type = getattr(form, form.template).getProperty('content_type')
else:
base_content_type = form.getProperty('content_type')
if parameter_kw.has_key('format'):
# if format is passed in action url: remove it
format = parameter_kw.pop('format')
action = '%s?%s' % (action_id, '&'.join(['='.join(tuple_parameter) for tuple_parameter in parameter_kw.items()]))
url = '%s/Base_viewOOoPrintDialog?dialog_action_url=%s&base_content_type=%s&field_your_format=%s' % (
context.absolute_url(),
url_quote('%s/%s' % (absolute_url, action)),
url_quote(base_content_type),
url_quote(format))
elif not (hasattr(form, 'pt') and form.pt == 'form_dialog'):
url = '%s/Base_viewIntermediatePrintDialog?dialog_action_url=%s' % (
context.absolute_url(), url_quote('%s/%s' % (absolute_url, action)))
return url
print_action_list = actions['object_print']
new_print_action_list = []
for ai in print_action_list:
ai_copy = ai.copy()
# this is quite low level. It may require to be done from file system code in
# the future.
ai_copy.update(dict(
original_url=ai_copy['url'],
url=addDialogIfNeeded(ai_copy['url'])))
new_print_action_list.append( ai_copy )
return new_print_action_list
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<tal:block metal:define-macro="master">
<span id="jump" class="jump" metal:define-macro="jump">
<select name="select_jump"
onchange="submitAction(this.form,'Base_doJump')">
<option selected="selected" value=""
i18n:translate="" i18n:domain="ui">Jump...</option>
<tal:block tal:repeat="jump actions/object_jump | nothing">
<option tal:attributes="value jump/url"
tal:content="jump/name" i18n:translate="" i18n:domain="ui" />
</tal:block>
<tal:block tal:condition="preferred_html_style_developper_mode">
<tal:block tal:condition="python: type_info is not None and type_info.Base_getSourceVisibility()"
tal:define="type_info python: portal.portal_types.getTypeInfo(here)">
<option value="1" disabled="disabled" i18n:translate="" i18n:domain="ui">-- Developer Mode --</option>
<option tal:attributes="value type_info/absolute_url_path"
i18n:translate="" i18n:domain="ui">Edit Portal Type '<tal:block tal:content="here/getPortalTypeName"
i18n:name="portal_type" i18n:translate="" i18n:domain="ui" />'</option>
</tal:block>
<tal:block tal:condition="portal/portal_workflow/Base_getSourceVisibility">
<option value="1" disabled="disabled" i18n:translate="" i18n:domain="ui">-- Workflows --</option>
<tal:block tal:repeat="workflow python: portal.portal_workflow.getWorkflowsFor(here)">
<option tal:attributes="value string:${workflow/absolute_url}/manage_properties" tal:content="workflow/title" />
</tal:block>
</tal:block>
</tal:block>
</select>
<button type="submit" name="Base_doJump:method" title="Jump"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description"
i18n:translate="" i18n:domain="ui">Jump</span>
</button>
</span>
<span class="separator"><!--separator--></span>
<span id="action" class="action" metal:define-macro="action">
<select name="select_action"
onchange="submitAction(this.form,'Base_doAction')">
<option selected="selected" value=""
i18n:translate="" i18n:domain="ui">Action...</option>
<tal:block tal:repeat="content_id here/getVisibleAllowedContentTypeList | nothing">
<option tal:attributes="value string:add $content_id"
i18n:translate="" i18n:domain="ui">Add <tal:block tal:content="content_id"
i18n:name="portal_type" i18n:translate="" i18n:domain="ui" /></option>
</tal:block>
<tal:block tal:define="document_template_list here/getDocumentTemplateList | nothing"
tal:condition="document_template_list">
<option disabled="disabled">-- <tal:block i18n:translate="" i18n:domain="ui">Templates</tal:block> --</option>
<tal:block tal:repeat="document_template document_template_list">
<option tal:attributes="value string:template ${document_template/getRelativeUrl}"
i18n:translate="" i18n:domain="ui">Add <tal:block tal:content="document_template/getTitle"
i18n:name="document_template" /></option>
</tal:block>
</tal:block>
<option disabled="disabled">-- <tal:block i18n:translate="" i18n:domain="ui">Workflows</tal:block> --</option>
<tal:block tal:repeat="action actions/workflow">
<option tal:content="action/name"
tal:attributes="value string:workflow ${action/url}"
i18n:translate="" i18n:domain="ui" />
</tal:block>
<option disabled="disabled">-- <tal:block i18n:translate="" i18n:domain="ui">Object</tal:block> --</option>
<tal:block tal:repeat="action actions/object_action | nothing">
<option tal:content="action/name"
tal:attributes="value string:object ${action/url}"
i18n:translate="" i18n:domain="ui" />
</tal:block>
<tal:block tal:define="object_view_list actions/object_view|nothing;
module_view_list python:[i for i in object_view_list if i['id']=='module_view']"
tal:condition="module_view_list">
<tal:block tal:repeat="action module_view_list">
<option tal:content="action/name"
tal:attributes="value string:object ${action/url}"
i18n:translate="" i18n:domain="ui" />
</tal:block>
</tal:block>
<tal:block tal:replace='nothing'>
<!-- XXX folder actions is inherited from CMF, but not used in ERP5 (for now) -->
<option disabled="disabled">-- <tal:block i18n:translate="" i18n:domain="ui">Folder</tal:block> --</option>
<tal:block tal:repeat="action actions/folder">
<option tal:content="action/name"
tal:attributes="value string:folder ${action/url}"
i18n:translate="" i18n:domain="ui" />
</tal:block>
</tal:block>
</select>
<button type="submit" name="Base_doAction:method" title="Action"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description">Action</span>
</button>
</span>
<span class="tool_buttons" metal:define-macro="tool_buttons">
<!-- XXX: exchange_actions seems to be bad condition -->
<span class="first"
tal:define="search_actions actions/object_search | nothing;
exchange_actions actions/object_exchange | nothing;
exchange_jio_actions actions/object_exchange_jio | nothing;
report_actions actions/object_report | nothing;
report_jio_actions actions/object_report_jio | nothing;
button_actions actions/object_button | nothing;
fast_input_actions actions/object_fast_input | nothing;
fast_input_jio_actions actions/object_fast_input_jio | nothing;
sort_actions actions/object_sort | nothing;
ui_actions actions/object_ui | nothing;
print_actions actions/object_print | nothing;
list_mode list_mode | nothing;
can_modify_portal_content python: portal.portal_membership.checkPermission('Modify portal content', here)">
<span class="separator"><!--separator--></span>
<tal:block tal:condition="list_mode">
<button class="cut" type="submit" name="Folder_cut:method" title="Cut"
i18n:attributes="title" i18n:domain="ui"
tal:condition="can_modify_portal_content">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">Cut</span>
</button>
<button class="copy" type="submit" name="Folder_copy:method" title="Copy"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">Copy</span>
</button>
<button class="paste" type="submit" name="Folder_paste:method" title="Paste"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">Paste</span>
</button>
<span class="separator"><!--separator--></span>
</tal:block>
<button tal:condition="print_actions" class="print" type="submit" name="Folder_print:method" title="Print"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">Print</span>
</button>
<button class="new" type="submit" title="New"
tal:attributes="name python: list_mode and 'Folder_create:method' or 'Base_createNewDocument:method'"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">New</span>
</button>
<button class="clone" type="submit" title="Clone"
name="Base_createCloneDocument:method"
tal:condition="not: list_mode"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">Clone</span>
</button>
<button tal:condition="list_mode" class="delete" type="submit" name="Folder_deleteObjectList:method" title="Delete"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">Delete</span>
</button>
<tal:block tal:condition="not: list_mode">
<tal:block tal:condition="request/selection_index | nothing">
<span class="separator"><!--separator--></span>
<a class="jump_first" title="First"
tal:attributes="href string:portal_selections/viewFirst?$http_parameters"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">First</span>
</a>
<a class="jump_previous" title="Previous"
tal:attributes="href string:portal_selections/viewPrevious?$http_parameters"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">Previous</span>
</a>
<a class="list_mode" title="List Mode" tal:attributes="href python: here.portal_selections.getSelectionListUrlFor(request.get('selection_name', None))"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">List Mode</span>
</a>
<a class="jump_next" title="Next"
tal:attributes="href string:portal_selections/viewNext?$http_parameters"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">Next</span>
</a>
<a class="jump_last" title="Last"
tal:attributes="href string:portal_selections/viewLast?$http_parameters"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">Last</span>
</a>
</tal:block>
</tal:block>
<tal:block tal:condition="list_mode">
<span class="separator"><!--separator--></span>
<a tal:condition="search_actions" class="find" title="Find"
tal:attributes="href python: portal.ERP5Site_renderCustomLink(search_actions[0]['url'], http_parameter_list, dialog_category='object_search')"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">Find</span>
</a>
<button class="show_all" type="submit" name="Folder_show:method" title="Show All"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">Show All</span>
</button>
<button type="submit" name="Folder_filter:method" title="Filter"
tal:attributes="class python: here.portal_selections.getSelectionInvertModeFor(request.get('selection_name', None)) and 'filter_on' or 'filter';"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">Filter</span>
</button>
<a tal:condition="sort_actions" class="sort" title="Sort"
tal:attributes="href python: portal.ERP5Site_renderCustomLink(sort_actions[0]['url'], http_parameter_list, dialog_category='object_sort')"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">Sort</span>
</a>
</tal:block>
<span tal:condition="python: exchange_actions or exchange_jio_actions or report_actions"
class="separator"><!--separator--></span>
<button tal:condition="python: exchange_actions or exchange_jio_actions" class="import_export"
type="submit" name="Base_doExchange:method" title="Import / Export"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">Import / Export</span>
</button>
<button tal:condition="python: report_actions or report_jio_actions" class="report" type="submit" name="Base_doReport:method" title="Report"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">Report</span>
</button>
<a tal:condition="python: fast_input_actions or fast_input_jio_actions" class="fast_input" title="Fast Input"
tal:attributes="href python: portal.ERP5Site_renderCustomLink((fast_input_actions or fast_input_jio_actions)[0]['url'], http_parameter_list, dialog_category='object_fast_input')"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">Fast Input</span>
</a>
<tal:block tal:condition="button_actions">
<span class="separator"><!--separator--></span>
<tal:block tal:repeat="button_action button_actions">
<a tal:attributes="href python: '%s%s%s' % (button_action['url'], '?' in button_action['url'] and '&amp;' or '?', http_parameters)">
<img i18n:attributes="title" i18n:domain="ui"
tal:attributes="src button_action/icon;
title button_action/name;
alt button_action/name" />
</a>
</tal:block>
</tal:block>
<tal:block tal:condition="list_mode">
<tal:block tal:condition="ui_actions">
<span class="separator"><!--separator--></span>
<a class="configure" title="Configure"
tal:attributes="href python: portal.ERP5Site_renderCustomLink(ui_actions[0]['url'], http_parameter_list, dialog_category='object_ui')"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">Configure</span>
</a>
</tal:block>
</tal:block>
</span>
<span class="second">
<a tal:condition="preferred_html_style_contextual_help"
class="jump_help" title="Help"
tal:attributes="href python: portal.ERP5Site_getHelpUrl(current_action=current_action, current_form_id=current_form_id, workflow_action=request.get('workflow_action'))"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">Help</span>
</a>
<a tal:condition="preferred_html_style_developper_mode"
class="inspect_object" title="Inspect object" href="Base_viewInspectionReport"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">Inspect Object</span>
</a>
<a tal:condition="here/hasActivity | nothing" class="activity_pending"
title="Activity Pending"
tal:attributes="href python: portal.portal_membership.checkPermission('View management screens', portal.portal_activities) and '%s/portal_activities/manageActivities' % (portal.portal_url()) or '#'"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description" i18n:translate="" i18n:domain="ui">Activity Pending</span>
</a>
</span>
</span>
<p class="clear"></p>
</tal:block>
</tal:block>
\ 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