appy.gen: various bugfixes and minor improvements.

This commit is contained in:
Gaetan Delannay 2011-10-06 16:27:58 +02:00
parent 4b44f8d565
commit f13b7ea307
5 changed files with 31 additions and 18 deletions

View file

@ -1179,7 +1179,7 @@ class String(Type):
'''Returns the default layouts for this type. Default layouts can vary '''Returns the default layouts for this type. Default layouts can vary
acccording to format or multiplicity.''' acccording to format or multiplicity.'''
if self.format in (String.TEXT, String.XHTML): if self.format in (String.TEXT, String.XHTML):
return {'view': 'l-d-f', 'edit': 'lrv-d-f'} return {'view': 'l-f', 'edit': 'lrv-d-f'}
elif self.isMultiValued(): elif self.isMultiValued():
return {'view': 'l-f', 'edit': 'lrv-f'} return {'view': 'l-f', 'edit': 'lrv-f'}
@ -2237,7 +2237,7 @@ class Role:
# Authenticated roles, automatically attributed to a user. # Authenticated roles, automatically attributed to a user.
class State: class State:
def __init__(self, permissions, initial=False, phase='main', show=True): def __init__(self, permissions, initial=False, phase=None, show=True):
self.usedRoles = {} self.usedRoles = {}
# The following dict ~{s_permissionName:[s_roleName|Role_role]}~ # The following dict ~{s_permissionName:[s_roleName|Role_role]}~
# gives, for every permission managed by a workflow, the list of roles # gives, for every permission managed by a workflow, the list of roles
@ -2648,7 +2648,7 @@ class Config:
# People having one of these roles will be able to create instances # People having one of these roles will be able to create instances
# of classes defined in your application. # of classes defined in your application.
self.defaultCreators = ['Manager', 'Owner'] self.defaultCreators = ['Manager', 'Owner']
# If you want to replace the Plone front page with a page coming from # If you want to replace the default front page with a page coming from
# your application, use the following parameter. Setting # your application, use the following parameter. Setting
# frontPage = True will replace the Plone front page with a page # frontPage = True will replace the Plone front page with a page
# whose content will come fron i18n label "front_page_text". # whose content will come fron i18n label "front_page_text".

View file

@ -64,14 +64,15 @@ class BaseMixin:
fieldName = splitted[2].split(':')[0] fieldName = splitted[2].split(':')[0]
initiator.appy().link(fieldName, obj) initiator.appy().link(fieldName, obj)
# Manage "add" permissions and reindex the object
obj._appy_managePermissions()
# Call the custom "onEdit" if available # Call the custom "onEdit" if available
msg = None # The message to display to the user. It can be set by onEdit msg = None # The message to display to the user. It can be set by onEdit
if obj.wrapperClass: if obj.wrapperClass:
appyObject = obj.appy() appyObject = obj.appy()
if hasattr(appyObject, 'onEdit'): if hasattr(appyObject, 'onEdit'):
msg = appyObject.onEdit(created) msg = appyObject.onEdit(created)
# Manage "add" permissions and reindex the object
obj._appy_managePermissions()
obj.reindexObject() obj.reindexObject()
return obj, msg return obj, msg

View file

@ -11,6 +11,8 @@ acronym {cursor: help;}
input[type=image] { border: 0; background: none; } input[type=image] { border: 0; background: none; }
input[type=checkbox] { border: 0; background: none; cursor: pointer;} input[type=checkbox] { border: 0; background: none; cursor: pointer;}
input[type=radio] { border: 0; background: none; cursor: pointer;} input[type=radio] { border: 0; background: none; cursor: pointer;}
input[type=file] { border: 0px solid #cccccc; background-color: #f8f8f8;
cursor: pointer;}
input[type=button] { border: 1px solid #cccccc; background-color: #f8f8f8; input[type=button] { border: 1px solid #cccccc; background-color: #f8f8f8;
cursor: pointer;} cursor: pointer;}
input[type=submit] { border: 1px solid #cccccc; background-color: #f8f8f8; input[type=submit] { border: 1px solid #cccccc; background-color: #f8f8f8;
@ -44,10 +46,14 @@ img {border: 0;}
.discreet { font-size: 90%; } .discreet { font-size: 90%; }
.portlet { width: 150px; padding: 12px 9px 9px 9px; .portlet { width: 150px; padding: 12px 9px 9px 9px;
border-right: 1px solid #9b0000;} border-right: 1px solid #9b0000;}
.portletTitle { font-weight: bold; font-size: 110%; margin-bottom: 4px;}
.portletCurrent { font-weight: bold; } .portletCurrent { font-weight: bold; }
.portletSep { border-top: 1px solid grey; margin-top: 9px; padding-top: 9px;} .portletSep { border-top: 1px solid grey; margin-top: 9px; padding-top: 9px;}
.portletPage { font-style: italic; } .portletPage { font-style: italic; }
.phase { border-style: dashed; border-width: thin; padding: 0 0.6em 0 1em; } .portletGroup { font-variant: small-caps; font-weight: bold; font-style: normal;
margin: 0.4em 0 0.2em 0; }
.phase { border-style: dashed; border-width: thin; padding: 0 0.6em 5px 1em;}
.phaseSelected { background-color: #EDEDED; }
.content { padding: 14px 3px 9px 15px;} .content { padding: 14px 3px 9px 15px;}
.grey { display: none; position: absolute; left: 0px; top: 0px; .grey { display: none; position: absolute; left: 0px; top: 0px;
background:grey; opacity:0.5; -moz-opacity:0.5; -khtml-opacity:0.5; background:grey; opacity:0.5; -moz-opacity:0.5; -khtml-opacity:0.5;
@ -66,7 +72,7 @@ img {border: 0;}
.section1 { font-size: 120%; margin: 0.45em 0em 0.1em 0; .section1 { font-size: 120%; margin: 0.45em 0em 0.1em 0;
padding: 0.3em 0em 0.2em 0.1em; background-color: #eef3f5; padding: 0.3em 0em 0.2em 0.1em; background-color: #eef3f5;
border-top: 1px solid #8CACBB;border-bottom: 1px solid #8CACBB; } border-top: 1px solid #8CACBB;border-bottom: 1px solid #8CACBB; }
.section2 { font-size: 110%; font-style: italic; margin: 0.45em 0em 0.1em 0; .section2 { font-size: 110%; font-style: italic; margin: 0.45em 0em 0.2em 0;
border-bottom: 2px solid grey; } border-bottom: 2px solid grey; }
.section3 { font-size: 100%; font-style: italic; margin: 0.45em 0em 0.1em 0; .section3 { font-size: 100%; font-style: italic; margin: 0.45em 0em 0.1em 0;
background-color: #efeae8; text-align: center; color: grey; } background-color: #efeae8; text-align: center; color: grey; }
@ -80,8 +86,10 @@ img {border: 0;}
background-color: #f8f8f8;} background-color: #f8f8f8;}
.underTitle { background-color: #ededed;} .underTitle { background-color: #ededed;}
.objectNavigate { margin-top: 3px;} .objectNavigate { margin-top: 3px;}
.underline {border-bottom: 1px dotted grey;} .underline { border-bottom: 1px dotted grey;}
.state {font-weight: bold; border-bottom: 1px dashed grey;} .state { font-weight: bold; border-bottom: 1px dashed grey;}
.historyLabel { font-variant: small-caps; font-weight: bold;} .historyLabel { font-variant: small-caps; font-weight: bold;}
.history td {border-top: 1px solid grey;} .history td { border-top: 1px solid grey;}
.history th {font-style: italic; text-align; left;} .history th { font-style: italic; text-align; left;}
.topSpace { margin-top: 15px;}
.discreet { color: grey}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 211 B

View file

@ -10,7 +10,7 @@
rootClasses tool/getRootClasses"> rootClasses tool/getRootClasses">
<tal:publishedObject condition="python: contextObj and contextObj.mayNavigate()"> <tal:publishedObject condition="python: contextObj and contextObj.mayNavigate()">
<b tal:content="contextObj/Title"></b> <div class="portletTitle" tal:content="contextObj/Title"></div>
<span><metal:phases use-macro="here/skyn/portlet/macros/phases"/></span> <span><metal:phases use-macro="here/skyn/portlet/macros/phases"/></span>
</tal:publishedObject> </tal:publishedObject>
@ -95,16 +95,21 @@
</tal:comment> </tal:comment>
<metal:phases define-macro="phases"> <metal:phases define-macro="phases">
<table tal:define="phases contextObj/getAppyPhases|nothing; <table tal:define="phases contextObj/getAppyPhases|nothing;
singlePhase python: len(phases) == 1;
page python: req.get('page', 'main')" page python: req.get('page', 'main')"
tal:condition="python: phases and not ((len(phases)==1) and len(phases[0]['pages'])==1)" tal:condition="python: phases and not (singlePhase and len(phases[0]['pages'])==1)"
width="100%"> width="100%">
<tal:phase repeat="phase phases"> <tal:phase repeat="phase phases">
<tal:comment replace="nothing">The box containing phase-related information</tal:comment> <tal:comment replace="nothing">The box containing phase-related information</tal:comment>
<tr> <tr>
<td tal:define="label python:'%s_phase_%s' % (contextObj.meta_type, phase['name']); <td tal:define="label python:'%s_phase_%s' % (contextObj.meta_type, phase['name']);
displayLink python: (phase['phaseStatus'] != 'Future') and ('/portal_factory' not in contextObj.absolute_url()) and (len(phase['pages']) == 1)" singlePage python: len(phase['pages']) == 1;
tal:attributes="class python: (len(phases) &gt; 1) and 'phase' or ''"> status phase/phaseStatus;
<div class="portletGroup" tal:condition="python: len(phases) &gt; 1"> phaseCss python: (status == 'Current') and ' phaseSelected' or '';
underCreation python: '/portal_factory' in context.absolute_url();
displayLink python: (status != 'Future') and not underCreation and singlePage"
tal:attributes="class python: not singlePhase and 'phase%s' % phaseCss or ''">
<div class="portletGroup" tal:condition="not: singlePhase">
<tal:comment replace="nothing">A single page in the phase</tal:comment> <tal:comment replace="nothing">A single page in the phase</tal:comment>
<table tal:condition="displayLink" width="100%"> <table tal:condition="displayLink" width="100%">
@ -124,8 +129,7 @@
<span tal:condition="not: displayLink" tal:replace="structure python: _(label)"/> <span tal:condition="not: displayLink" tal:replace="structure python: _(label)"/>
</div> </div>
<div class="portletMenu"> <div class="portletMenu">
<table cellpadding="0" cellspacing="0" width="100%" <table width="100%" cellpadding="0" tal:condition="python: len(phase['pages']) &gt; 1">
tal:condition="python: len(phase['pages']) &gt; 1">
<tr tal:repeat="aPage phase/pages" valign="top"> <tr tal:repeat="aPage phase/pages" valign="top">
<td tal:attributes="class python: test(aPage == page, 'portletCurrent portletPage', 'portletPage')"> <td tal:attributes="class python: test(aPage == page, 'portletCurrent portletPage', 'portletPage')">
<a tal:attributes="href python: contextObj.getUrl(page=aPage)" <a tal:attributes="href python: contextObj.getUrl(page=aPage)"