[gen] Improvements in the rendering of buttons throughout the web UI. [gen] Ref field and Search: added param 'showActions' allowing to show or not the range of icons and buttons below or besides every tied or queried object.

This commit is contained in:
Gaetan Delannay 2015-01-19 15:44:09 +01:00
parent a905aaa139
commit 34cafcdbc1
10 changed files with 171 additions and 163 deletions

View file

@ -121,21 +121,19 @@ class Field:
pxChanges = Px(''' pxChanges = Px('''
<x if="zobj.hasHistory(name)"> <x if="zobj.hasHistory(name)">
<!-- Button for showing the field version containing changes --> <!-- Button for showing the field version containing changes -->
<input type="button" class="button" if="not showChanges" <input if="not showChanges"
var="label=_('changes_show')" value=":label" var2="label=_('changes_show');
style=":'%s; %s' % (url('changes', bg=True), \ css=ztool.getButtonCss(label)" type="button" class=":css"
ztool.getButtonWidth(label))" value=":label" style=":url('changes', bg=True)"
onclick=":'askField(%s,%s,%s,null,%s)' % \ onclick=":'askField(%s,%s,%s,null,%s)' % \
(q(tagId), q(obj.url), q('view'), q('True'))"/> (q(tagId), q(obj.url), q('view'), q('True'))"/>
<!-- Button for showing the field version without changes --> <!-- Button for showing the field version without changes -->
<input type="button" class="button" if="showChanges" <input if="showChanges"
var="label=_('changes_hide')" value=":label" var2="label=_('changes_hide');
style=":'%s; %s' % (url('changesNo', bg=True), \ css=ztool.getButtonCss(label)" type="button" class=":css"
ztool.getButtonWidth(label))" value=":label" style=":url('changesNo', bg=True)"
onclick=":'askField(%s,%s,%s,null,%s)' % \ onclick=":'askField(%s,%s,%s,null,%s)' % \
(q(tagId), q(obj.url), q('view'), q('False'))"/> (q(tagId), q(obj.url), q('view'), q('False'))"/></x>''')
</x>''')
def __init__(self, validator, multiplicity, default, show, page, group, def __init__(self, validator, multiplicity, default, show, page, group,
layouts, move, indexed, mustIndex, searchable, layouts, move, indexed, mustIndex, searchable,

View file

@ -30,9 +30,8 @@ class Action(Field):
<form var="formId='%s_%s_form' % (zobj.id, name); <form var="formId='%s_%s_form' % (zobj.id, name);
label=_(field.labelId); label=_(field.labelId);
descr=field.hasDescr and _(field.descrId) or None; descr=field.hasDescr and _(field.descrId) or None;
buttonWidth=ztool.getButtonWidth(label);
smallButtons=smallButtons|False; smallButtons=smallButtons|False;
css=smallButtons and 'buttonSmall button' or 'button'" css=ztool.getButtonCss(label, smallButtons)"
id=":formId" action=":zobj.absolute_url() + '/onExecuteAction'" id=":formId" action=":zobj.absolute_url() + '/onExecuteAction'"
style="display:inline"> style="display:inline">
<input type="hidden" name="fieldName" value=":name"/> <input type="hidden" name="fieldName" value=":name"/>
@ -40,13 +39,11 @@ class Action(Field):
<input if="field.confirm" type="button" class=":css" title=":descr" <input if="field.confirm" type="button" class=":css" title=":descr"
var="labelConfirm=_(field.labelId + '_confirm'); var="labelConfirm=_(field.labelId + '_confirm');
commentParam=(field.confirm == 'text') and 'true' or 'false'" commentParam=(field.confirm == 'text') and 'true' or 'false'"
value=":label" value=":label" style=":url(field.icon, bg=True)"
style=":'%s; %s' % (url(field.icon, bg=True), buttonWidth)"
onclick=":'askConfirm(%s,%s,%s,%s)' % (q('form'), q(formId), \ onclick=":'askConfirm(%s,%s,%s,%s)' % (q('form'), q(formId), \
q(labelConfirm), commentParam)"/> q(labelConfirm), commentParam)"/>
<input if="not field.confirm" type="submit" class=":css" name="do" <input if="not field.confirm" type="submit" class=":css" name="do"
value=":label" title=":descr" value=":label" title=":descr" style=":url(field.icon, bg=True)"/>
style=":'%s; %s' % (url(field.icon, bg=True), buttonWidth)"/>
</form>''') </form>''')
# It is not possible to edit an action, not to search it # It is not possible to edit an action, not to search it

View file

@ -51,33 +51,36 @@ class Ref(Field):
# This PX displays buttons for triggering global actions on several linked # This PX displays buttons for triggering global actions on several linked
# objects (delete many, unlink many,...) # objects (delete many, unlink many,...)
pxGlobalActions = Px(''' pxGlobalActions = Px('''
<div class="globalActions">
<!-- Insert several objects (if in pick list) --> <!-- Insert several objects (if in pick list) -->
<input if="inPickList" type="button" class="button" <input if="inPickList"
var2="action='link'; label=_('object_link_many')" value=":label" var2="action='link'; label=_('object_link_many');
css=ztool.getButtonCss(label)"
type="button" class=":css" value=":label"
onclick=":'onLinkMany(%s,%s)' % (q(action), q(ajaxHookId))" onclick=":'onLinkMany(%s,%s)' % (q(action), q(ajaxHookId))"
style=":'%s; %s' % (url('linkMany', bg=True), \ style=":url('linkMany', bg=True)"/>
ztool.getButtonWidth(label))"/>
<!-- Unlink several objects --> <!-- Unlink several objects -->
<input if="mayUnlink" <input if="mayUnlink"
var2="imgName=linkList and 'unlinkManyUp' or 'unlinkMany'; var2="imgName=linkList and 'unlinkManyUp' or 'unlinkMany';
action='unlink'; label=_('object_unlink_many')" action='unlink'; label=_('object_unlink_many');
type="button" class="button" value=":label" css=ztool.getButtonCss(label)"
type="button" class=":css" value=":label"
onclick=":'onLinkMany(%s,%s)' % (q(action), q(ajaxHookId))" onclick=":'onLinkMany(%s,%s)' % (q(action), q(ajaxHookId))"
style=":'%s; %s' % (url(imgName, bg=True), \ style=":url(imgName, bg=True)"/>
ztool.getButtonWidth(label))"/>
<!-- Delete several objects --> <!-- Delete several objects -->
<input if="mayEdit and field.delete" <input if="mayEdit and field.delete"
var2="action='delete'; label=_('object_delete_many')" var2="action='delete'; label=_('object_delete_many');
type="button" class="button" value=":label" css=ztool.getButtonCss(label)"
type="button" class=":css" value=":label"
onclick=":'onLinkMany(%s,%s)' % (q(action), q(ajaxHookId))" onclick=":'onLinkMany(%s,%s)' % (q(action), q(ajaxHookId))"
style=":'%s; %s' % (url('deleteMany', bg=True), \ style=":url('deleteMany', bg=True)"/>
ztool.getButtonWidth(label))"/> </div>''')
''')
# This PX displays icons for triggering actions on a given referenced object # This PX displays icons for triggering actions on a given referenced object
# (edit, delete, etc). # (edit, delete, etc).
pxObjectActions = Px(''' pxObjectActions = Px('''
<div> <div if="field.showActions"
style=":'display:%s; margin-bottom:2px' % field.showActions">
<!-- Arrows for moving objects up or down --> <!-- Arrows for moving objects up or down -->
<x if="(totalNumber &gt;1) and changeOrder and not inPickList \ <x if="(totalNumber &gt;1) and changeOrder and not inPickList \
and not inMenu" and not inMenu"
@ -156,10 +159,8 @@ class Ref(Field):
value=":(inPopup or (target.target != '_self')) and '1' or '0'"/> value=":(inPopup or (target.target != '_self')) and '1' or '0'"/>
<input <input
type=":(field.addConfirm or field.noForm) and 'button' or 'submit'" type=":(field.addConfirm or field.noForm) and 'button' or 'submit'"
class="buttonSmall button" var="label=_('add_ref'); css=ztool.getButtonCss(label)" class=":css"
var="label=_('add_ref')" value=":label" value=":label" style=":url('add', bg=True)"
style=":'%s; %s' % (url('add', bg=True), \
ztool.getButtonWidth(label))"
onclick=":field.getOnAdd(q, formName, addConfirmMsg, target, \ onclick=":field.getOnAdd(q, formName, addConfirmMsg, target, \
navBaseCall, startNumber)"/> navBaseCall, startNumber)"/>
</form>''') </form>''')
@ -173,12 +174,13 @@ class Ref(Field):
href=":'%s/query?className=%s&amp;search=%s:%s:%s&amp;popup=1' % \ href=":'%s/query?className=%s&amp;search=%s:%s:%s&amp;popup=1' % \
(ztool.absolute_url(), tiedClassName, obj.uid, field.name, \ (ztool.absolute_url(), tiedClassName, obj.uid, field.name, \
popupMode)"> popupMode)">
<input type="button" class="buttonSmall button" <input type="button"
var="labelId= (popupMode=='repl') and 'search_button' or 'add_ref'; var="labelId= (popupMode=='repl') and 'search_button' or 'add_ref';
icon= (popupMode=='repl') and 'search' or 'add'; icon= (popupMode=='repl') and 'search' or 'add';
label=_(labelId)" value=":label" label=_(labelId);
style=":'%s;%s' % (url(icon,bg=True), ztool.getButtonWidth(label))" css=ztool.getButtonCss(label)"
onclick="openPopup('iframePopup')"/> value=":label" class=":css"
style=":url(icon, bg=True)" onclick="openPopup('iframePopup')"/>
</a>''') </a>''')
# This PX displays, in a cell header from a ref table, icons for sorting the # This PX displays, in a cell header from a ref table, icons for sorting the
@ -233,10 +235,8 @@ class Ref(Field):
var2="popupMode='add'">:field.pxLink</x> var2="popupMode='add'">:field.pxLink</x>
<!-- The search button if field is queryable --> <!-- The search button if field is queryable -->
<input if="objects and field.queryable" type="button" <input if="objects and field.queryable" type="button"
class="buttonSmall button" var2="label=_('search_button'); css=ztool.getButtonCss(label)"
var2="label=_('search_button')" value=":label" value=":label" class=":css" style=":url('search', bg=True)"
style=":'%s; %s' % (url('search', bg=True), \
ztool.getButtonWidth(label))"
onclick=":'goto(%s)' % \ onclick=":'goto(%s)' % \
q('%s/search?className=%s&amp;ref=%s:%s' % \ q('%s/search?className=%s&amp;ref=%s:%s' % \
(ztool.absolute_url(), tiedClassName, zobj.id, field.name))"/> (ztool.absolute_url(), tiedClassName, zobj.id, field.name))"/>
@ -286,7 +286,7 @@ class Ref(Field):
<x if="refField.name == 'title'"> <x if="refField.name == 'title'">
<x if="mayView"> <x if="mayView">
<x>:field.pxObjectTitle</x> <x>:field.pxObjectTitle</x>
<div if="tied.o.mayAct()">:field.pxObjectActions</div> <x if="tied.o.mayAct()">:field.pxObjectActions</x>
</x> </x>
<div if="not mayView"> <div if="not mayView">
<img src=":url('fake')" style="margin-right: 5px"/> <img src=":url('fake')" style="margin-right: 5px"/>
@ -303,7 +303,7 @@ class Ref(Field):
</table> </table>
<!-- Global actions --> <!-- Global actions -->
<div if="mayEdit and checkboxes">:field.pxGlobalActions</div> <x if="mayEdit and checkboxes">:field.pxGlobalActions</x>
<!-- (Bottom) navigation --> <!-- (Bottom) navigation -->
<x>:tool.pxNavigate</x> <x>:tool.pxNavigate</x>
@ -392,7 +392,7 @@ class Ref(Field):
href=":field.getMenuUrl(zobj, tied)">:tied.title</a> href=":field.getMenuUrl(zobj, tied)">:tied.title</a>
<!-- Show standard pxObjectTitle else --> <!-- Show standard pxObjectTitle else -->
<x if="not field.menuUrlMethod">:field.pxObjectTitle</x> <x if="not field.menuUrlMethod">:field.pxObjectTitle</x>
<div if="tied.o.mayAct()">:field.pxObjectActions</div> <x if="tied.o.mayAct()">:field.pxObjectActions</x>
</div> </div>
</div> </div>
</div> </div>
@ -531,7 +531,8 @@ class Ref(Field):
checkboxes=True, checkboxesDefault=None, sdefault='', checkboxes=True, checkboxesDefault=None, sdefault='',
scolspan=1, swidth=None, sheight=None, sselect=None, scolspan=1, swidth=None, sheight=None, sselect=None,
persist=True, render='list', menuIdMethod=None, persist=True, render='list', menuIdMethod=None,
menuInfoMethod=None, menuUrlMethod=None, view=None, xml=None): menuInfoMethod=None, menuUrlMethod=None, view=None, xml=None,
showActions=True):
self.klass = klass self.klass = klass
self.attribute = attribute self.attribute = attribute
# May the user add new objects through this ref ? "add" may also contain # May the user add new objects through this ref ? "add" may also contain
@ -712,6 +713,13 @@ class Ref(Field):
# "menuUrlMethod" is an optional method that allows to compute an # "menuUrlMethod" is an optional method that allows to compute an
# alternative URL for the tied object that is shown within the menu. # alternative URL for the tied object that is shown within the menu.
self.menuUrlMethod = menuUrlMethod self.menuUrlMethod = menuUrlMethod
# "showActions" determines if we must show or not actions on every tied
# object. Values can be: True, False or "inline". If True, actions will
# appear in a "div" tag, below the object title; if "inline", they will
# appear besides it, producing a more compact list of results.
self.showActions = showActions
if showActions == True: self.showActions = 'block'
# Call the base constructor
Field.__init__(self, validator, multiplicity, default, show, page, Field.__init__(self, validator, multiplicity, default, show, page,
group, layouts, move, indexed, mustIndex, searchable, group, layouts, move, indexed, mustIndex, searchable,
specificReadPermission, specificWritePermission, width, specificReadPermission, specificWritePermission, width,

View file

@ -26,8 +26,8 @@ class Search:
'''Used for specifying a search for a given class.''' '''Used for specifying a search for a given class.'''
def __init__(self, name=None, group=None, sortBy='', sortOrder='asc', def __init__(self, name=None, group=None, sortBy='', sortOrder='asc',
maxPerPage=30, default=False, colspan=1, translated=None, maxPerPage=30, default=False, colspan=1, translated=None,
show=True, translatedDescr=None, checkboxes=False, show=True, showActions=True, translatedDescr=None,
checkboxesDefault=True, **fields): checkboxes=False, checkboxesDefault=True, **fields):
# "name" is mandatory, excepted in some special cases (ie, when used as # "name" is mandatory, excepted in some special cases (ie, when used as
# "select" param for a Ref field). # "select" param for a Ref field).
self.name = name self.name = name
@ -46,6 +46,11 @@ class Search:
self.translatedDescr = translatedDescr self.translatedDescr = translatedDescr
# Condition for showing or not this search # Condition for showing or not this search
self.show = show self.show = show
# Condition for showing or not actions on every result of this search.
# Can be: True, False or "inline". If True, actions will appear in a
# "div" tag, below the object title; if "inline", they will appear
# besides it, producing a more compact list of results.
self.showActions = showActions
# In the dict below, keys are indexed field names or names of standard # In the dict below, keys are indexed field names or names of standard
# indexes, and values are search values. # indexes, and values are search values.
self.fields = fields self.fields = fields
@ -175,6 +180,10 @@ class UiSearch:
self.name = search.name self.name = search.name
self.type = 'search' self.type = 'search'
self.colspan = search.colspan self.colspan = search.colspan
# Property "display" of the div tag containing actions for every search
# result.
self.showActions = search.showActions
if search.showActions == True: self.showActions = 'block'
if search.translated: if search.translated:
self.translated = search.translated self.translated = search.translated
self.translatedDescr = search.translatedDescr self.translatedDescr = search.translatedDescr

View file

@ -463,22 +463,18 @@ class Transition:
class UiTransition: class UiTransition:
'''Represents a widget that displays a transition.''' '''Represents a widget that displays a transition.'''
pxView = Px('''<x var="buttonCss = (buttonsMode == 'small') and \ pxView = Px('''
'buttonSmall button' or 'button'"> <x var="label=transition.title;
css=ztool.getButtonCss(label, buttonsMode == 'small')">
<!-- Real button --> <!-- Real button -->
<input if="transition.mayTrigger" type="button" class=":buttonCss" <input if="transition.mayTrigger" type="button" class=":css"
var2="label=transition.title" style=":url(transition.icon, bg=True)" value=":label"
style=":'%s; %s' % (url(transition.icon, bg=True), \
ztool.getButtonWidth(label))"
value=":label"
onclick=":'triggerTransition(%s,%s,%s)' % (q(formId), \ onclick=":'triggerTransition(%s,%s,%s)' % (q(formId), \
q(transition.name), q(transition.confirm))"/> q(transition.name), q(transition.confirm))"/>
<!-- Fake button, explaining why the transition can't be triggered --> <!-- Fake button, explaining why the transition can't be triggered -->
<input if="not transition.mayTrigger" type="button" <input if="not transition.mayTrigger" type="button"
class=":'fake ' + buttonCss" var2="label=transition.title" class=":'fake %s' % css" style=":url('fake', bg=True)"
style=":'%s; %s' % (url('fake', bg=True),
ztool.getButtonWidth(label))"
value=":label" title=":transition.reason"/></x>''') value=":label" title=":transition.reason"/></x>''')
def __init__(self, name, transition, obj, mayTrigger, ): def __init__(self, name, transition, obj, mayTrigger, ):

View file

@ -1227,12 +1227,17 @@ class ToolMixin(BaseMixin):
"})();\n" % gaId "})();\n" % gaId
return code return code
def getButtonWidth(self, label): def getButtonCss(self, label, small=True):
'''Determine button width, in pixels, corresponding to the button '''Gets the CSS class(es) to set on a button, given it l_label and its
p_label.''' size (p_small or not).'''
# Set a minimum width for small labels. # CSS for a small button. No minimum width applies: small button are
if len(label) < 15: return 'width:130px' # meant to be small.
return 'padding-left: 26px; padding-right: 8px' if small: return 'buttonSmall button'
# CSS for a normal button. A minimum width (via buttonFixed) is defined
# when the label is small: it produces ranges of buttons of the same
# width (excepted when labels are too large), which is more beautiful.
if len(label) < 15: return 'buttonFixed button'
return 'button'
def getLinksTargetInfo(self, klass): def getLinksTargetInfo(self, klass):
'''Appy allows to open links to view or edit instances of p_klass '''Appy allows to open links to view or edit instances of p_klass

View file

@ -211,7 +211,8 @@ class Group(ModelClass):
back=gen.Ref(attribute='groups', show=User.showRoles, back=gen.Ref(attribute='groups', show=User.showRoles,
multiplicity=(0,None)), multiplicity=(0,None)),
select=getSelectableUsers, height=15, select=getSelectableUsers, height=15,
showHeaders=True, shownInfo=('title', 'login')) showHeaders=True, shownInfo=('title', 'login'),
showActions='inline')
# The Translation class -------------------------------------------------------- # The Translation class --------------------------------------------------------
class Translation(ModelClass): class Translation(ModelClass):
@ -274,7 +275,7 @@ class Tool(ModelClass):
users = gen.Ref(User, multiplicity=(0,None), add=True, link=False, users = gen.Ref(User, multiplicity=(0,None), add=True, link=False,
back=gen.Ref(attribute='toTool', show=False), page=userPage, back=gen.Ref(attribute='toTool', show=False), page=userPage,
queryable=True, queryFields=('title', 'login'), queryable=True, queryFields=('title', 'login'),
show=isManager, showHeaders=True, show=isManager, showHeaders=True, showActions='inline',
shownInfo=('title', 'login*120px', 'roles*120px')) shownInfo=('title', 'login*120px', 'roles*120px'))
def computeConnectedUsers(self): pass def computeConnectedUsers(self): pass
@ -289,7 +290,7 @@ class Tool(ModelClass):
back=gen.Ref(attribute='toTool2', show=False), back=gen.Ref(attribute='toTool2', show=False),
page=gen.Page('groups', show=isManager), show=isManager, page=gen.Page('groups', show=isManager), show=isManager,
queryable=True, queryFields=('title', 'login'), queryable=True, queryFields=('title', 'login'),
showHeaders=True, showHeaders=True, showActions='inline',
shownInfo=('title', 'login*120px', 'roles*120px')) shownInfo=('title', 'login*120px', 'roles*120px'))
pt = gen.Page('translations', show=isManager) pt = gen.Page('translations', show=isManager)
translations = gen.Ref(Translation, multiplicity=(0,None), add=False, translations = gen.Ref(Translation, multiplicity=(0,None), add=False,
@ -299,7 +300,7 @@ class Tool(ModelClass):
layouts='f') layouts='f')
pages = gen.Ref(Page, multiplicity=(0,None), add=True, link=False, pages = gen.Ref(Page, multiplicity=(0,None), add=True, link=False,
show='view', back=gen.Ref(attribute='toTool3', show=False), show='view', back=gen.Ref(attribute='toTool3', show=False),
page=gen.Page('pages', show=isManager)) showActions='inline', page=gen.Page('pages',show=isManager))
@classmethod @classmethod
def _appy_clean(klass): def _appy_clean(klass):

View file

@ -11,8 +11,8 @@ h4 { font-size: 11pt; margin:4px 0 4px 0 }
h5 { font-size: 10pt; margin:0; font-style: italic; font-weight: normal; h5 { font-size: 10pt; margin:0; font-style: italic; font-weight: normal;
background-color: #d7dee4 } background-color: #d7dee4 }
h6 { font-size: 9pt; margin:0; font-weight: bold } h6 { font-size: 9pt; margin:0; font-weight: bold }
a { text-decoration: none; color: #436976 } a { text-decoration: none; color: #114353 }
a:visited { color: #436976 } a:visited { color: #114353 }
table { font-size: 100%; border-spacing: 0px; border-collapse:collapse } table { font-size: 100%; border-spacing: 0px; border-collapse:collapse }
form { margin: 0; padding: 0 } form { margin: 0; padding: 0 }
p { margin: 0 0 5px 0 } p { margin: 0 0 5px 0 }
@ -57,12 +57,12 @@ img { border: 0; vertical-align: middle }
.changePassword { color: #494949 !important; font-style:italic; font-size: 90% } .changePassword { color: #494949 !important; font-style:italic; font-size: 90% }
.breadcrumb { font-size: 11pt; padding-bottom: 6px } .breadcrumb { font-size: 11pt; padding-bottom: 6px }
.login { margin: 3px; color: black } .login { margin: 3px; color: black }
input.button { color: #666666; height: 20px; margin-bottom: 5px; margin-top:2px; input.button { color: #666666; height: 20px; cursor:pointer; font-size: 90%;
cursor:pointer; font-size: 90%; padding-left: 10px; padding-left: 26px; padding-right: 12px; background-color: white;
background-color: white; background-repeat: no-repeat; background-repeat: no-repeat; background-position: 8px 25%;
background-position: 8px 25%; box-shadow: 2px 2px 2px #888888} box-shadow: 2px 2px 2px #888888}
input.buttonSmall { width: 100px !important; font-size: 85%; height: 18px; input.buttonSmall { font-size: 85%; height: 18px }
margin-bottom: 5px } input.buttonFixed { width:110px; padding: 0 0 0 10px }
.fake { background-color: #e6e6e6 !important ; cursor:help !important } .fake { background-color: #e6e6e6 !important ; cursor:help !important }
.xhtml { background-color: white; padding: 4px; font-size: 95% } .xhtml { background-color: white; padding: 4px; font-size: 95% }
.xhtml img { margin-right: 5px } .xhtml img { margin-right: 5px }
@ -83,7 +83,7 @@ input.buttonSmall { width: 100px !important; font-size: 85%; height: 18px;
box-shadow: 0 2px 4px #A9A9A9 } box-shadow: 0 2px 4px #A9A9A9 }
.focus td { padding: 4px 0px 4px 4px } .focus td { padding: 4px 0px 4px 4px }
.discreet { font-size: 90%; color: grey } .discreet { font-size: 90%; color: grey }
.title { color: #BA9440 } .title {}
.lostPassword { font-size: 90%; color: white; padding-left: 1em } .lostPassword { font-size: 90%; color: white; padding-left: 1em }
.current { font-weight: bold } .current { font-weight: bold }
.portlet { width: 150px; border-right: 3px solid #e4e4e4; .portlet { width: 150px; border-right: 3px solid #e4e4e4;
@ -184,3 +184,4 @@ td.search { padding-top: 8px }
.language {color: grey; font-size: 7pt; border: grey 1px solid; padding: 2px; .language {color: grey; font-size: 7pt; border: grey 1px solid; padding: 2px;
margin: 0 2px 0 4px; font-family: monospace } margin: 0 2px 0 4px; font-family: monospace }
.highlight { background-color: yellow } .highlight { background-color: yellow }
.globalActions { margin-bottom: 4px }

View file

@ -228,8 +228,6 @@ class ToolWrapper(AbstractWrapper):
class=":(not currentSearch and (currentClass==className) and \ class=":(not currentSearch and (currentClass==className) and \
(currentPage=='query')) and \ (currentPage=='query')) and \
'current' or ''">::_(className + '_plural')</a> 'current' or ''">::_(className + '_plural')</a>
</div>
<!-- Create instances of this class --> <!-- Create instances of this class -->
<form if="ztool.userMayCreate(rootClass) and \ <form if="ztool.userMayCreate(rootClass) and \
('form' in ztool.getCreateMeans(rootClass))" class="addForm" ('form' in ztool.getCreateMeans(rootClass))" class="addForm"
@ -239,13 +237,12 @@ class ToolWrapper(AbstractWrapper):
<input type="hidden" name="className" value=":className"/> <input type="hidden" name="className" value=":className"/>
<input type="hidden" name="popup" <input type="hidden" name="popup"
value=":(inPopup or (target.target != '_self')) and '1' or '0'"/> value=":(inPopup or (target.target != '_self')) and '1' or '0'"/>
<input type="submit" class="buttonSmall button" <input var="label=_('query_create');
var="label=_('query_create')" value=":label" css=ztool.getButtonCss(label)" type="submit" class=":css"
onclick=":target.openPopup" value=":label" onclick=":target.openPopup"
style=":'%s; %s' % (url('add', bg=True), \ style=":url('add', bg=True)"/>
ztool.getButtonWidth(label))"/>
</form> </form>
</div>
<!-- Searches --> <!-- Searches -->
<x if="ztool.advancedSearchEnabledFor(rootClass)"> <x if="ztool.advancedSearchEnabledFor(rootClass)">
<!-- Live search --> <!-- Live search -->
@ -365,7 +362,8 @@ class ToolWrapper(AbstractWrapper):
if="sub">::zobj.highlight(sub)</span> if="sub">::zobj.highlight(sub)</span>
<!-- Actions --> <!-- Actions -->
<div if="not inPopup and zobj.mayAct()"> <div if="not inPopup and uiSearch.showActions and zobj.mayAct()"
style=":'display:%s; margin-bottom:2px' % uiSearch.showActions">
<!-- Edit --> <!-- Edit -->
<a if="zobj.mayEdit()" <a if="zobj.mayEdit()"
var2="navInfo='search.%s.%s.%d.%d' % \ var2="navInfo='search.%s.%s.%d.%d' % \
@ -453,15 +451,13 @@ class ToolWrapper(AbstractWrapper):
</table> </table>
<!-- The button for selecting objects and closing the popup. --> <!-- The button for selecting objects and closing the popup. -->
<div if="inPopup and cbShown" align=":dleft"> <div if="inPopup and cbShown" align=":dleft">
<input type="button" class="button" <input type="button"
var="label=_('object_link_many')" var="label=_('object_link_many'); css=ztool.getButtonCss(label)"
value=":label" value=":label" class=":css" style=":url('linkMany', bg=True)"
onclick=":'onSelectObjects(%s,%s,%s,%s,%s,%s,%s)' % \ onclick=":'onSelectObjects(%s,%s,%s,%s,%s,%s,%s)' % \
(q(rootHookId), q(uiSearch.initiator.url), \ (q(rootHookId), q(uiSearch.initiator.url), \
q(uiSearch.initiatorMode), q(sortKey), q(sortOrder), \ q(uiSearch.initiatorMode), q(sortKey), q(sortOrder), \
q(filterKey), q(filterValue))" q(filterKey), q(filterValue))"/>
style=":'%s; %s' % (url('linkMany', bg=True), \
ztool.getButtonWidth(label))"/>
</div> </div>
<!-- Init checkboxes if present. --> <!-- Init checkboxes if present. -->
<script if="checkboxes">:'initCbs(%s)' % q(checkboxesId)</script> <script if="checkboxes">:'initCbs(%s)' % q(checkboxesId)</script>
@ -622,10 +618,9 @@ class ToolWrapper(AbstractWrapper):
<!-- Submit button --> <!-- Submit button -->
<p align=":dright"><br/> <p align=":dright"><br/>
<input type="submit" class="button" var="label=_('search_button')" <input var="label=_('search_button');
value=":label" css=ztool.getButtonCss(label, small=False)" type="submit"
style=":'%s; %s' % (url('search', bg=True), \ class=":css" value=":label" style=":url('search', bg=True)"/>
ztool.getButtonWidth(label))"/>
</p> </p>
</form> </form>
</x>''', template=AbstractWrapper.pxTemplate, hook='content') </x>''', template=AbstractWrapper.pxTemplate, hook='content')

View file

@ -465,46 +465,46 @@ class AbstractWrapper(object):
<!-- Previous --> <!-- Previous -->
<x if="previousPage and pageInfo.showPrevious" <x if="previousPage and pageInfo.showPrevious"
var2="label=_('page_previous'); var2="label=_('page_previous');
buttonWidth=ztool.getButtonWidth(label)"> css=ztool.getButtonCss(label, small=False)">
<!-- Button on the edit page --> <!-- Button on the edit page -->
<x if="isEdit"> <x if="isEdit">
<input type="button" class="button" value=":label" <input type="button" class=":css" value=":label"
onclick="submitAppyForm('previous')" onclick="submitAppyForm('previous')"
style=":'%s; %s' % (url('previous', bg=True), buttonWidth)"/> style=":url('previous', bg=True)"/>
<input type="hidden" name="previousPage" value=":previousPage"/> <input type="hidden" name="previousPage" value=":previousPage"/>
</x> </x>
<!-- Button on the view page --> <!-- Button on the view page -->
<input if="not isEdit" type="button" class="button" value=":label" <input if="not isEdit" type="button" class=":css" value=":label"
style=":'%s; %s' % (url('previous', bg=True), buttonWidth)" style=":url('previous', bg=True)"
onclick=":'goto(%s)' % q(zobj.getUrl(page=previousPage, \ onclick=":'goto(%s)' % q(zobj.getUrl(page=previousPage, \
inPopup=inPopup))"/> inPopup=inPopup))"/>
</x> </x>
<!-- Save --> <!-- Save -->
<input if="isEdit and pageInfo.showSave" <input if="isEdit and pageInfo.showSave" type="button"
type="button" class="button" onclick="submitAppyForm('save')" var2="label=_('object_save');
var2="label=_('object_save')" value=":label" css=ztool.getButtonCss(label, small=False)"
style=":'%s; %s' % (url('save', bg=True), \ class=":css" onclick="submitAppyForm('save')"
ztool.getButtonWidth(label))" /> value=":label" style=":url('save', bg=True)" />
<!-- Cancel --> <!-- Cancel -->
<input if="isEdit and pageInfo.showCancel" <input if="isEdit and pageInfo.showCancel" type="button"
type="button" class="button" onclick="submitAppyForm('cancel')" var2="label=_('object_cancel');
var2="label=_('object_cancel')" value=":label" css=ztool.getButtonCss(label, small=False)"
style=":'%s; %s' % (url('cancel', bg=True), \ class=":css" onclick="submitAppyForm('cancel')" value=":label"
ztool.getButtonWidth(label))"/> style=":url('cancel', bg=True)"/>
<x if="not isEdit" <x if="not isEdit"
var2="locked=zobj.isLocked(user, page); var2="locked=zobj.isLocked(user, page);
editable=pageInfo.showOnEdit and pageInfo.showEdit and \ editable=pageInfo.showOnEdit and pageInfo.showEdit and \
mayAct and zobj.mayEdit()"> mayAct and zobj.mayEdit()">
<!-- Edit --> <!-- Edit -->
<input type="button" class="button" if="editable and not locked" <input if="editable and not locked" type="button"
var="label=_('object_edit')" value=":label" var="label=_('object_edit');
style=":'%s; %s' % (url('edit', bg=True), \ css=ztool.getButtonCss(label, small=False)"
ztool.getButtonWidth(label))" value=":label" class=":css" style=":url('edit', bg=True)"
onclick=":'goto(%s)' % q(zobj.getUrl(mode='edit', page=page, \ onclick=":'goto(%s)' % q(zobj.getUrl(mode='edit', page=page, \
inPopup=inPopup))"/> inPopup=inPopup))"/>
<!-- Locked --> <!-- Locked -->
<a if="editable and locked"> <a if="editable and locked">
<img style="cursor: help" <img class="help"
var="lockDate=ztool.formatDate(locked[1]); var="lockDate=ztool.formatDate(locked[1]);
lockMap={'user':ztool.getUserName(locked[0]), \ lockMap={'user':ztool.getUserName(locked[0]), \
'date':lockDate}; 'date':lockDate};
@ -516,26 +516,24 @@ class AbstractWrapper(object):
onclick=":'onUnlockPage(%s,%s)' % (q(zobj.id), q(page))"/></a> onclick=":'onUnlockPage(%s,%s)' % (q(zobj.id), q(page))"/></a>
</x> </x>
<!-- Delete --> <!-- Delete -->
<input if="not isEdit and not inPopup and zobj.mayDelete()" <input if="not isEdit and not inPopup and zobj.mayDelete()" type="button"
type="button" class="button" var2="label=_('object_delete');
onclick=":'onDeleteObject(%s)' % q(zobj.id)" css=ztool.getButtonCss(label, small=False)"
var2="label=_('object_delete')" value=":label" value=":label" class=":css" style=":url('delete', bg=True)"
style=":'%s; %s' % (url('delete', bg=True), \ onclick=":'onDeleteObject(%s)' % q(zobj.id)"/>
ztool.getButtonWidth(label))"/>
<!-- Next --> <!-- Next -->
<x if="nextPage and pageInfo.showNext" <x if="nextPage and pageInfo.showNext"
var2="label=_('page_next'); var2="label=_('page_next');
buttonWidth=ztool.getButtonWidth(label)"> css=ztool.getButtonCss(label, small=False)">
<!-- Button on the edit page --> <!-- Button on the edit page -->
<x if="isEdit"> <x if="isEdit">
<input type="button" class="button" onclick="submitAppyForm('next')" <input type="button" class=":css" onclick="submitAppyForm('next')"
style=":'%s; %s' % (url('next', bg=True), buttonWidth)" style=":url('next', bg=True)" value=":label"/>
value=":label"/>
<input type="hidden" name="nextPage" value=":nextPage"/> <input type="hidden" name="nextPage" value=":nextPage"/>
</x> </x>
<!-- Button on the view page --> <!-- Button on the view page -->
<input if="not isEdit" type="button" class="button" value=":label" <input if="not isEdit" type="button" class=":css" value=":label"
style=":'%s; %s' % (url('next', bg=True), buttonWidth)" style=":url('next', bg=True)"
onclick=":'goto(%s)' % q(zobj.getUrl(page=nextPage, \ onclick=":'goto(%s)' % q(zobj.getUrl(page=nextPage, \
inPopup=inPopup))"/> inPopup=inPopup))"/>
</x> </x>