[gen] Possibility to define, programmatically, for a given class, the default view and edit pages, by defining, respectively, methods getDefaultViewPage and getDefaultEditPage; various bugfixes.

This commit is contained in:
Gaetan Delannay 2012-06-02 17:39:05 +02:00
parent f843d5b7d6
commit 77331cd216
4 changed files with 30 additions and 14 deletions

View file

@ -6,12 +6,12 @@
errors request/errors | python:{};
layoutType python:'edit';
layout python: contextObj.getPageLayout(layoutType);
page request/page|python:'main';
cssJs python: {};
groupedWidgets python: contextObj.getGroupedAppyTypes(layoutType, page, cssJs=cssJs);
phaseInfo python: contextObj.getAppyPhases(currentOnly=True, layoutType=layoutType);
phase phaseInfo/name;
confirmMsg request/confirmMsg | nothing;"
page request/page|python:contextObj.getDefaultEditPage();
confirmMsg request/confirmMsg | nothing;
groupedWidgets python: contextObj.getGroupedAppyTypes(layoutType, page, cssJs=cssJs);"
tal:on-error="structure python: tool.manageError(error)">
<tal:comment replace="nothing">Include type-specific CSS and JS.</tal:comment>
@ -19,7 +19,6 @@
tal:attributes="href string:$appUrl/ui/$cssFile"/>
<script tal:repeat="jsFile cssJs/js" type="text/javascript"
tal:attributes="src string:$appUrl/ui/$jsFile"></script>
<metal:prologue use-macro="context/ui/page/macros/prologue"/>
<form id="appyEditForm" name="appyEditForm" method="post" enctype="multipart/form-data"
tal:attributes="action python: contextObj.absolute_url()+'/do';

View file

@ -91,7 +91,7 @@
<td id="field_title"
tal:condition="python: widget['name'] == 'title'">
<a tal:define="navInfo python:'search.%s.%s.%d.%d' % (className, searchName, repeat['obj'].number()+startNumber, totalNumber);"
tal:content="obj/Title" tal:attributes="href python: obj.getUrl(nav=navInfo, page='main')"></a>
tal:content="obj/Title" tal:attributes="href python: obj.getUrl(nav=navInfo, page=obj.getDefaultViewPage())"></a>
</td>
<tal:comment replace="nothing">Workflow state</tal:comment>
@ -123,7 +123,7 @@
<tal:comment replace="nothing">Edit the element</tal:comment>
<td>
<a tal:define="navInfo python:'search.%s.%s.%d.%d' % (className, searchName, repeat['obj'].number()+startNumber, totalNumber);"
tal:attributes="href python: obj.getUrl(mode='edit', page='main', nav=navInfo)"
tal:attributes="href python: obj.getUrl(mode='edit', page=obj.getDefaultEditPage(), nav=navInfo)"
tal:condition="obj/mayEdit">
<img title="Edit" tal:attributes="src string: $appUrl/ui/edit.gif"/>
</a></td>

View file

@ -3,13 +3,12 @@
<metal:fill fill-slot="content"
tal:define="contextObj python: context.getParentNode();
dummy python: contextObj.allows('View', raiseError=True);
portal_type python: context.portal_type.lower().replace(' ', '_');
errors python: req.get('errors', {});
layoutType python:'view';
layout python: contextObj.getPageLayout(layoutType);
phaseInfo python: contextObj.getAppyPhases(currentOnly=True, layoutType='view');
page req/page|python:'main';
phase phaseInfo/name;
page req/page|python:contextObj.getDefaultViewPage();
groupedWidgets python: contextObj.getGroupedAppyTypes(layoutType, page);"
tal:on-error="structure python: tool.manageError(error)">
<metal:prologue use-macro="context/ui/page/macros/prologue"/>