Commit 1bc16fb4 authored by Fabien Morin's avatar Fabien Morin

2009-03-24 fabien

* move some scripts from km to here. This scripts are usefull to display listbox search style.
* some method need to be renamed after been moved so change the name everywhere

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26144 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8192aa44
<?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>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>"""\n
Returns a list of dictionaries with information about the owners of\n
the document in the form:\n
\n
{\n
\'url\': person_url,\n
\'title\': person_title,\n
\'email\': person_email,\n
}\n
"""\n
\n
info_list = []\n
\n
person_list = context.Base_getOwnerValueList()\n
\n
for person_object in person_list:\n
person_title = person_object.getTitle() or person_object.getReference(\'\')\n
person_url = \'%s/view\' % person_object.absolute_url()\n
person_email = person_object.getDefaultEmailText(\'\')\n
\n
info_list.append(dict(title=person_title, email=person_email, url=person_url))\n
\n
return info_list\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<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>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>info_list</string>
<string>_getattr_</string>
<string>context</string>
<string>person_list</string>
<string>_getiter_</string>
<string>person_object</string>
<string>person_title</string>
<string>person_url</string>
<string>person_email</string>
<string>dict</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>Base_getOwnerInfoList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>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>"""\n
Returns the list of owners of the given context. Owners\n
are normally Person objects in ERP5. However, this behaviour\n
could be extended in the future or for specific projects.\n
\n
NOTE: we usually asume that there is only a single owner\n
or that, at least, only the first owner matters for\n
the "My Documents" list.\n
\n
TODO:\n
- how can we make sure that is is consistent with \n
ERP5Site_getAuthenticatedMemberPersonValue \n
in erp5_base ?\n
"""\n
from zExceptions import Unauthorized\n
owner_value_list = []\n
try:\n
owner_id_list = [i[0] for i in context.get_local_roles() if \'Owner\' in i[1]]\n
except Unauthorized:\n
owner_id_list = []\n
\n
if len(owner_id_list):\n
return context.portal_catalog(portal_type=\'Person\', reference=owner_id_list)\n
else:\n
return []\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<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>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>zExceptions</string>
<string>Unauthorized</string>
<string>owner_value_list</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>_getattr_</string>
<string>context</string>
<string>i</string>
<string>_getitem_</string>
<string>owner_id_list</string>
<string>len</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>Base_getOwnerValueList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>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>""" \n
Generate current document\'s information structure needed to be rendered \n
by web widget Document_viewPopupTemplate.\n
"""\n
from zExceptions import Unauthorized\n
\n
translateString = context.Base_translateString\n
doc_info = {}\n
owner_list = context.Base_getOwnerInfoList()\n
doc_info[\'owner\'] = \'; \'.join([owner[\'title\'] for owner in owner_list])\n
\n
if context.getModificationDate() is not None:\n
doc_info[\'modification_date\'] = context.WebSite_getFancyRelativeDate(context.getModificationDate())\n
\n
publication_date = context.Document_getLastWorkflowStateEntryDate(state=(\'public,\'),\n
state_name=\'validation_state\')\n
if publication_date is not None:\n
doc_info[\'publication_date\'] = context.WebSite_getFancyRelativeDate(publication_date)\n
\n
release_date = context.Document_getLastWorkflowStateEntryDate(state=(\'released,\'),\n
state_name=\'validation_state\')\n
if release_date is not None:\n
doc_info[\'release_date\'] = context.WebSite_getFancyRelativeDate(release_date)\n
\n
try:\n
doc_info[\'status\'] = context.getTranslatedValidationStateTitle() or \'\'\n
except AttributeError:\n
doc_info[\'status\'] = \'\'\n
\n
try:\n
doc_info[\'group\'] = context.getGroupTitle() or \'\'\n
except AttributeError:\n
doc_info[\'group\'] = \'\'\n
\n
try:\n
doc_info[\'project\'] = context.getFollowUpTitle(checked_permission=\'View\') or \'\'\n
except (AttributeError, Unauthorized):\n
doc_info[\'project\'] = \'\'\n
\n
try:\n
doc_info[\'language\'] = context.getLanguage() or \'\'\n
except AttributeError:\n
pass\n
\n
# add web sections document belongs too\n
if website is None:\n
website = context.getWebSiteValue() \n
sections = []\n
for websection in website.getWebSectionValueList(context):\n
sections.append({\'title\': websection.getCompactTranslatedTitle(),\n
\'url\': websection.absolute_url()})\n
doc_info[\'sections\'] = sections\n
\n
return context.Document_viewPopupTemplate(**doc_info)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>website=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<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>website</string>
<string>zExceptions</string>
<string>Unauthorized</string>
<string>_getattr_</string>
<string>context</string>
<string>translateString</string>
<string>doc_info</string>
<string>owner_list</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>owner</string>
<string>_getitem_</string>
<string>_write_</string>
<string>None</string>
<string>publication_date</string>
<string>release_date</string>
<string>AttributeError</string>
<string>sections</string>
<string>websection</string>
<string>_apply_</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Document_getPopupInfo</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -75,7 +75,8 @@ Description:\n
i18n:translate="" i18n:domain="ui">Standard Type</option>\n
</tal:block>\n
</select>\n
<input i18n:domain="ui" i18n:attributes="value" type="submit" name="search_area/WebSite_viewQuickSearchResultList:method" value="Search"/>\n
<input i18n:domain="ui" i18n:attributes="value" type="submit"\n
name="search_area/ERP5Site_viewQuickSearchResultList:method" value="Search"/>\n
</div>\n
<div class="searchOptions">\n
<a tal:attributes="href string: search_area/Base_viewAdvancedSearchDialog" i18n:translate="" i18n:domain="ui">Advanced Search</a> | <a href="javascript:void 0" onclick="javascript:openTips();" value="" i18n:translate="" i18n:domain="ui">Search Tips</a>\n
......
2009-03-24 fabien
* move some scripts from km to here. This scripts are usefull to display listbox search style.
* some method need to be renamed after been moved so change the name everywhere
2009-01-25 jps
* Renamed erp5_web_default_theme to clarify the fact that there is no default theme in erp5_web and that erp5_web is a framework to build Web sites based on ERP5.
......
759
\ No newline at end of file
767
\ 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