[gen] On Page instances, one may now define a method for conditionnally showing the 'edit' button on 'view' layout. [gen] An app may now, on its Config class, define a method getHomeObject that must return an object that will be the home object for a given (class of) user(s). This object's menu will appear when the user is consulting a page with no tied menu (like a search for example). [gen] More ZPT->PX work.

This commit is contained in:
Gaetan Delannay 2013-06-28 15:00:02 +02:00
parent 7fcd2f44d3
commit 2b5d286668
7 changed files with 217 additions and 25 deletions

View file

@ -300,13 +300,13 @@
editable python: pageInfo['showOnEdit'] and contextObj.mayEdit()">
<tal:comment replace="nothing">Edit</tal:comment>
<input type="button" class="button" tal:condition="python: editable and not locked"
<input type="button" class="button" tal:condition="python: editable and not locked and pageInfo['showEdit']"
tal:attributes="style string: background-image: url($appUrl/ui/buttonEdit.png);
value python: _('object_edit');
onclick python: 'window.location=\'%s\'' % contextObj.getUrl(mode='edit', page=page)">
<tal:comment replace="nothing">Locked</tal:comment>
<a tal:condition="python: editable and locked">
<a tal:condition="python: editable and locked and pageInfo['showEdit']">
<img style="cursor: help"
tal:define="lockDate python: tool.formatDate(locked[1]);
lockMsg python: _('page_locked', mapping={'user':tool.getUserName(locked[0]), 'date': lockDate})"

View file

@ -134,7 +134,7 @@
</tal:comment>
<table metal:define-macro="phases" class="portletContent"
tal:define="singlePhase python: phases and (len(phases) == 1);
page python: req.get('page', 'main');
page python: req.get('page', '');
mayEdit contextObj/mayEdit">
<tal:phase repeat="phase phases">
<tal:comment replace="nothing">The box containing phase-related information</tal:comment>

View file

@ -13,7 +13,8 @@
resp req/RESPONSE;
lang tool/getUserLanguage;
layoutType tool/getLayoutType;
contextObj python: tool.getPublishedObject(layoutType);
contextObj python: tool.getPublishedObject(layoutType) or tool.getHomeObject();
showPortlet python: tool.showPortlet(context, layoutType);
dir python: tool.getLanguageDirection(lang);
discreetLogin python: tool.getAttr('discreetLogin', source='config');
dleft python: (dir == 'ltr') and 'left' or 'right';
@ -185,7 +186,7 @@
</td>
</tr>
<tal:comment replace="nothing">The navigation strip</tal:comment>
<tr tal:condition="python: contextObj and (layoutType == 'view')">
<tr tal:condition="python: contextObj and showPortlet and (layoutType != 'edit')">
<td><metal:navigate use-macro="app/ui/navigate/macros/navigationStrip"/></td>
</tr>
<tr>
@ -193,7 +194,7 @@
<table width="100%" cellpadding="0" cellspacing="0">
<tr valign="top">
<tal:comment replace="nothing">Portlet</tal:comment>
<td tal:condition="python: tool.showPortlet(context, layoutType)" class="portlet">
<td tal:condition="showPortlet" class="portlet">
<metal:portlet use-macro="app/ui/portlet/macros/portlet"/>
</td>
<tal:comment replace="nothing">Page content</tal:comment>