[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:
parent
a905aaa139
commit
34cafcdbc1
|
@ -121,21 +121,19 @@ class Field:
|
|||
pxChanges = Px('''
|
||||
<x if="zobj.hasHistory(name)">
|
||||
<!-- Button for showing the field version containing changes -->
|
||||
<input type="button" class="button" if="not showChanges"
|
||||
var="label=_('changes_show')" value=":label"
|
||||
style=":'%s; %s' % (url('changes', bg=True), \
|
||||
ztool.getButtonWidth(label))"
|
||||
<input if="not showChanges"
|
||||
var2="label=_('changes_show');
|
||||
css=ztool.getButtonCss(label)" type="button" class=":css"
|
||||
value=":label" style=":url('changes', bg=True)"
|
||||
onclick=":'askField(%s,%s,%s,null,%s)' % \
|
||||
(q(tagId), q(obj.url), q('view'), q('True'))"/>
|
||||
|
||||
<!-- Button for showing the field version without changes -->
|
||||
<input type="button" class="button" if="showChanges"
|
||||
var="label=_('changes_hide')" value=":label"
|
||||
style=":'%s; %s' % (url('changesNo', bg=True), \
|
||||
ztool.getButtonWidth(label))"
|
||||
<input if="showChanges"
|
||||
var2="label=_('changes_hide');
|
||||
css=ztool.getButtonCss(label)" type="button" class=":css"
|
||||
value=":label" style=":url('changesNo', bg=True)"
|
||||
onclick=":'askField(%s,%s,%s,null,%s)' % \
|
||||
(q(tagId), q(obj.url), q('view'), q('False'))"/>
|
||||
</x>''')
|
||||
(q(tagId), q(obj.url), q('view'), q('False'))"/></x>''')
|
||||
|
||||
def __init__(self, validator, multiplicity, default, show, page, group,
|
||||
layouts, move, indexed, mustIndex, searchable,
|
||||
|
|
|
@ -30,9 +30,8 @@ class Action(Field):
|
|||
<form var="formId='%s_%s_form' % (zobj.id, name);
|
||||
label=_(field.labelId);
|
||||
descr=field.hasDescr and _(field.descrId) or None;
|
||||
buttonWidth=ztool.getButtonWidth(label);
|
||||
smallButtons=smallButtons|False;
|
||||
css=smallButtons and 'buttonSmall button' or 'button'"
|
||||
css=ztool.getButtonCss(label, smallButtons)"
|
||||
id=":formId" action=":zobj.absolute_url() + '/onExecuteAction'"
|
||||
style="display:inline">
|
||||
<input type="hidden" name="fieldName" value=":name"/>
|
||||
|
@ -40,13 +39,11 @@ class Action(Field):
|
|||
<input if="field.confirm" type="button" class=":css" title=":descr"
|
||||
var="labelConfirm=_(field.labelId + '_confirm');
|
||||
commentParam=(field.confirm == 'text') and 'true' or 'false'"
|
||||
value=":label"
|
||||
style=":'%s; %s' % (url(field.icon, bg=True), buttonWidth)"
|
||||
value=":label" style=":url(field.icon, bg=True)"
|
||||
onclick=":'askConfirm(%s,%s,%s,%s)' % (q('form'), q(formId), \
|
||||
q(labelConfirm), commentParam)"/>
|
||||
<input if="not field.confirm" type="submit" class=":css" name="do"
|
||||
value=":label" title=":descr"
|
||||
style=":'%s; %s' % (url(field.icon, bg=True), buttonWidth)"/>
|
||||
value=":label" title=":descr" style=":url(field.icon, bg=True)"/>
|
||||
</form>''')
|
||||
|
||||
# It is not possible to edit an action, not to search it
|
||||
|
|
118
fields/ref.py
118
fields/ref.py
|
@ -51,33 +51,36 @@ class Ref(Field):
|
|||
# This PX displays buttons for triggering global actions on several linked
|
||||
# objects (delete many, unlink many,...)
|
||||
pxGlobalActions = Px('''
|
||||
<!-- Insert several objects (if in pick list) -->
|
||||
<input if="inPickList" type="button" class="button"
|
||||
var2="action='link'; label=_('object_link_many')" value=":label"
|
||||
onclick=":'onLinkMany(%s,%s)' % (q(action), q(ajaxHookId))"
|
||||
style=":'%s; %s' % (url('linkMany', bg=True), \
|
||||
ztool.getButtonWidth(label))"/>
|
||||
<!-- Unlink several objects -->
|
||||
<input if="mayUnlink"
|
||||
var2="imgName=linkList and 'unlinkManyUp' or 'unlinkMany';
|
||||
action='unlink'; label=_('object_unlink_many')"
|
||||
type="button" class="button" value=":label"
|
||||
onclick=":'onLinkMany(%s,%s)' % (q(action), q(ajaxHookId))"
|
||||
style=":'%s; %s' % (url(imgName, bg=True), \
|
||||
ztool.getButtonWidth(label))"/>
|
||||
<!-- Delete several objects -->
|
||||
<input if="mayEdit and field.delete"
|
||||
var2="action='delete'; label=_('object_delete_many')"
|
||||
type="button" class="button" value=":label"
|
||||
onclick=":'onLinkMany(%s,%s)' % (q(action), q(ajaxHookId))"
|
||||
style=":'%s; %s' % (url('deleteMany', bg=True), \
|
||||
ztool.getButtonWidth(label))"/>
|
||||
''')
|
||||
<div class="globalActions">
|
||||
<!-- Insert several objects (if in pick list) -->
|
||||
<input if="inPickList"
|
||||
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))"
|
||||
style=":url('linkMany', bg=True)"/>
|
||||
<!-- Unlink several objects -->
|
||||
<input if="mayUnlink"
|
||||
var2="imgName=linkList and 'unlinkManyUp' or 'unlinkMany';
|
||||
action='unlink'; label=_('object_unlink_many');
|
||||
css=ztool.getButtonCss(label)"
|
||||
type="button" class=":css" value=":label"
|
||||
onclick=":'onLinkMany(%s,%s)' % (q(action), q(ajaxHookId))"
|
||||
style=":url(imgName, bg=True)"/>
|
||||
<!-- Delete several objects -->
|
||||
<input if="mayEdit and field.delete"
|
||||
var2="action='delete'; label=_('object_delete_many');
|
||||
css=ztool.getButtonCss(label)"
|
||||
type="button" class=":css" value=":label"
|
||||
onclick=":'onLinkMany(%s,%s)' % (q(action), q(ajaxHookId))"
|
||||
style=":url('deleteMany', bg=True)"/>
|
||||
</div>''')
|
||||
|
||||
# This PX displays icons for triggering actions on a given referenced object
|
||||
# (edit, delete, etc).
|
||||
pxObjectActions = Px('''
|
||||
<div>
|
||||
<div if="field.showActions"
|
||||
style=":'display:%s; margin-bottom:2px' % field.showActions">
|
||||
<!-- Arrows for moving objects up or down -->
|
||||
<x if="(totalNumber >1) and changeOrder and not inPickList \
|
||||
and not inMenu"
|
||||
|
@ -143,26 +146,24 @@ class Ref(Field):
|
|||
# Displays the button allowing to add a new object through a Ref field, if
|
||||
# it has been declared as addable and if multiplicities allow it.
|
||||
pxAdd = Px('''
|
||||
<form if="mayAdd and not inPickList"
|
||||
class=":inMenu and 'addFormMenu' or 'addForm'"
|
||||
var2="formName='%s_%s_add' % (zobj.id, field.name)"
|
||||
name=":formName" id=":formName" target=":target.target"
|
||||
action=":'%s/do' % folder.absolute_url()">
|
||||
<input type="hidden" name="action" value="Create"/>
|
||||
<input type="hidden" name="className" value=":tiedClassName"/>
|
||||
<input type="hidden" name="nav"
|
||||
value=":field.getNavInfo(zobj, 0, totalNumber)"/>
|
||||
<input type="hidden" name="popup"
|
||||
value=":(inPopup or (target.target != '_self')) and '1' or '0'"/>
|
||||
<input
|
||||
type=":(field.addConfirm or field.noForm) and 'button' or 'submit'"
|
||||
class="buttonSmall button"
|
||||
var="label=_('add_ref')" value=":label"
|
||||
style=":'%s; %s' % (url('add', bg=True), \
|
||||
ztool.getButtonWidth(label))"
|
||||
onclick=":field.getOnAdd(q, formName, addConfirmMsg, target, \
|
||||
navBaseCall, startNumber)"/>
|
||||
</form>''')
|
||||
<form if="mayAdd and not inPickList"
|
||||
class=":inMenu and 'addFormMenu' or 'addForm'"
|
||||
var2="formName='%s_%s_add' % (zobj.id, field.name)"
|
||||
name=":formName" id=":formName" target=":target.target"
|
||||
action=":'%s/do' % folder.absolute_url()">
|
||||
<input type="hidden" name="action" value="Create"/>
|
||||
<input type="hidden" name="className" value=":tiedClassName"/>
|
||||
<input type="hidden" name="nav"
|
||||
value=":field.getNavInfo(zobj, 0, totalNumber)"/>
|
||||
<input type="hidden" name="popup"
|
||||
value=":(inPopup or (target.target != '_self')) and '1' or '0'"/>
|
||||
<input
|
||||
type=":(field.addConfirm or field.noForm) and 'button' or 'submit'"
|
||||
var="label=_('add_ref'); css=ztool.getButtonCss(label)" class=":css"
|
||||
value=":label" style=":url('add', bg=True)"
|
||||
onclick=":field.getOnAdd(q, formName, addConfirmMsg, target, \
|
||||
navBaseCall, startNumber)"/>
|
||||
</form>''')
|
||||
|
||||
# Displays the button allowing to select from a popup objects to be linked
|
||||
# via the Ref field.
|
||||
|
@ -173,12 +174,13 @@ class Ref(Field):
|
|||
href=":'%s/query?className=%s&search=%s:%s:%s&popup=1' % \
|
||||
(ztool.absolute_url(), tiedClassName, obj.uid, field.name, \
|
||||
popupMode)">
|
||||
<input type="button" class="buttonSmall button"
|
||||
<input type="button"
|
||||
var="labelId= (popupMode=='repl') and 'search_button' or 'add_ref';
|
||||
icon= (popupMode=='repl') and 'search' or 'add';
|
||||
label=_(labelId)" value=":label"
|
||||
style=":'%s;%s' % (url(icon,bg=True), ztool.getButtonWidth(label))"
|
||||
onclick="openPopup('iframePopup')"/>
|
||||
label=_(labelId);
|
||||
css=ztool.getButtonCss(label)"
|
||||
value=":label" class=":css"
|
||||
style=":url(icon, bg=True)" onclick="openPopup('iframePopup')"/>
|
||||
</a>''')
|
||||
|
||||
# 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>
|
||||
<!-- The search button if field is queryable -->
|
||||
<input if="objects and field.queryable" type="button"
|
||||
class="buttonSmall button"
|
||||
var2="label=_('search_button')" value=":label"
|
||||
style=":'%s; %s' % (url('search', bg=True), \
|
||||
ztool.getButtonWidth(label))"
|
||||
var2="label=_('search_button'); css=ztool.getButtonCss(label)"
|
||||
value=":label" class=":css" style=":url('search', bg=True)"
|
||||
onclick=":'goto(%s)' % \
|
||||
q('%s/search?className=%s&ref=%s:%s' % \
|
||||
(ztool.absolute_url(), tiedClassName, zobj.id, field.name))"/>
|
||||
|
@ -286,7 +286,7 @@ class Ref(Field):
|
|||
<x if="refField.name == 'title'">
|
||||
<x if="mayView">
|
||||
<x>:field.pxObjectTitle</x>
|
||||
<div if="tied.o.mayAct()">:field.pxObjectActions</div>
|
||||
<x if="tied.o.mayAct()">:field.pxObjectActions</x>
|
||||
</x>
|
||||
<div if="not mayView">
|
||||
<img src=":url('fake')" style="margin-right: 5px"/>
|
||||
|
@ -303,7 +303,7 @@ class Ref(Field):
|
|||
</table>
|
||||
|
||||
<!-- Global actions -->
|
||||
<div if="mayEdit and checkboxes">:field.pxGlobalActions</div>
|
||||
<x if="mayEdit and checkboxes">:field.pxGlobalActions</x>
|
||||
|
||||
<!-- (Bottom) navigation -->
|
||||
<x>:tool.pxNavigate</x>
|
||||
|
@ -392,7 +392,7 @@ class Ref(Field):
|
|||
href=":field.getMenuUrl(zobj, tied)">:tied.title</a>
|
||||
<!-- Show standard pxObjectTitle else -->
|
||||
<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>
|
||||
|
@ -531,7 +531,8 @@ class Ref(Field):
|
|||
checkboxes=True, checkboxesDefault=None, sdefault='',
|
||||
scolspan=1, swidth=None, sheight=None, sselect=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.attribute = attribute
|
||||
# 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
|
||||
# alternative URL for the tied object that is shown within the menu.
|
||||
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,
|
||||
group, layouts, move, indexed, mustIndex, searchable,
|
||||
specificReadPermission, specificWritePermission, width,
|
||||
|
|
|
@ -26,8 +26,8 @@ class Search:
|
|||
'''Used for specifying a search for a given class.'''
|
||||
def __init__(self, name=None, group=None, sortBy='', sortOrder='asc',
|
||||
maxPerPage=30, default=False, colspan=1, translated=None,
|
||||
show=True, translatedDescr=None, checkboxes=False,
|
||||
checkboxesDefault=True, **fields):
|
||||
show=True, showActions=True, translatedDescr=None,
|
||||
checkboxes=False, checkboxesDefault=True, **fields):
|
||||
# "name" is mandatory, excepted in some special cases (ie, when used as
|
||||
# "select" param for a Ref field).
|
||||
self.name = name
|
||||
|
@ -46,6 +46,11 @@ class Search:
|
|||
self.translatedDescr = translatedDescr
|
||||
# Condition for showing or not this search
|
||||
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
|
||||
# indexes, and values are search values.
|
||||
self.fields = fields
|
||||
|
@ -175,6 +180,10 @@ class UiSearch:
|
|||
self.name = search.name
|
||||
self.type = 'search'
|
||||
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:
|
||||
self.translated = search.translated
|
||||
self.translatedDescr = search.translatedDescr
|
||||
|
|
|
@ -463,22 +463,18 @@ class Transition:
|
|||
|
||||
class UiTransition:
|
||||
'''Represents a widget that displays a transition.'''
|
||||
pxView = Px('''<x var="buttonCss = (buttonsMode == 'small') and \
|
||||
'buttonSmall button' or 'button'">
|
||||
pxView = Px('''
|
||||
<x var="label=transition.title;
|
||||
css=ztool.getButtonCss(label, buttonsMode == 'small')">
|
||||
<!-- Real button -->
|
||||
<input if="transition.mayTrigger" type="button" class=":buttonCss"
|
||||
var2="label=transition.title"
|
||||
style=":'%s; %s' % (url(transition.icon, bg=True), \
|
||||
ztool.getButtonWidth(label))"
|
||||
value=":label"
|
||||
<input if="transition.mayTrigger" type="button" class=":css"
|
||||
style=":url(transition.icon, bg=True)" value=":label"
|
||||
onclick=":'triggerTransition(%s,%s,%s)' % (q(formId), \
|
||||
q(transition.name), q(transition.confirm))"/>
|
||||
|
||||
<!-- Fake button, explaining why the transition can't be triggered -->
|
||||
<input if="not transition.mayTrigger" type="button"
|
||||
class=":'fake ' + buttonCss" var2="label=transition.title"
|
||||
style=":'%s; %s' % (url('fake', bg=True),
|
||||
ztool.getButtonWidth(label))"
|
||||
class=":'fake %s' % css" style=":url('fake', bg=True)"
|
||||
value=":label" title=":transition.reason"/></x>''')
|
||||
|
||||
def __init__(self, name, transition, obj, mayTrigger, ):
|
||||
|
|
|
@ -1227,12 +1227,17 @@ class ToolMixin(BaseMixin):
|
|||
"})();\n" % gaId
|
||||
return code
|
||||
|
||||
def getButtonWidth(self, label):
|
||||
'''Determine button width, in pixels, corresponding to the button
|
||||
p_label.'''
|
||||
# Set a minimum width for small labels.
|
||||
if len(label) < 15: return 'width:130px'
|
||||
return 'padding-left: 26px; padding-right: 8px'
|
||||
def getButtonCss(self, label, small=True):
|
||||
'''Gets the CSS class(es) to set on a button, given it l_label and its
|
||||
size (p_small or not).'''
|
||||
# CSS for a small button. No minimum width applies: small button are
|
||||
# meant to be small.
|
||||
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):
|
||||
'''Appy allows to open links to view or edit instances of p_klass
|
||||
|
|
|
@ -211,7 +211,8 @@ class Group(ModelClass):
|
|||
back=gen.Ref(attribute='groups', show=User.showRoles,
|
||||
multiplicity=(0,None)),
|
||||
select=getSelectableUsers, height=15,
|
||||
showHeaders=True, shownInfo=('title', 'login'))
|
||||
showHeaders=True, shownInfo=('title', 'login'),
|
||||
showActions='inline')
|
||||
|
||||
# The Translation class --------------------------------------------------------
|
||||
class Translation(ModelClass):
|
||||
|
@ -274,7 +275,7 @@ class Tool(ModelClass):
|
|||
users = gen.Ref(User, multiplicity=(0,None), add=True, link=False,
|
||||
back=gen.Ref(attribute='toTool', show=False), page=userPage,
|
||||
queryable=True, queryFields=('title', 'login'),
|
||||
show=isManager, showHeaders=True,
|
||||
show=isManager, showHeaders=True, showActions='inline',
|
||||
shownInfo=('title', 'login*120px', 'roles*120px'))
|
||||
|
||||
def computeConnectedUsers(self): pass
|
||||
|
@ -289,7 +290,7 @@ class Tool(ModelClass):
|
|||
back=gen.Ref(attribute='toTool2', show=False),
|
||||
page=gen.Page('groups', show=isManager), show=isManager,
|
||||
queryable=True, queryFields=('title', 'login'),
|
||||
showHeaders=True,
|
||||
showHeaders=True, showActions='inline',
|
||||
shownInfo=('title', 'login*120px', 'roles*120px'))
|
||||
pt = gen.Page('translations', show=isManager)
|
||||
translations = gen.Ref(Translation, multiplicity=(0,None), add=False,
|
||||
|
@ -299,7 +300,7 @@ class Tool(ModelClass):
|
|||
layouts='f')
|
||||
pages = gen.Ref(Page, multiplicity=(0,None), add=True, link=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
|
||||
def _appy_clean(klass):
|
||||
|
|
|
@ -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;
|
||||
background-color: #d7dee4 }
|
||||
h6 { font-size: 9pt; margin:0; font-weight: bold }
|
||||
a { text-decoration: none; color: #436976 }
|
||||
a:visited { color: #436976 }
|
||||
a { text-decoration: none; color: #114353 }
|
||||
a:visited { color: #114353 }
|
||||
table { font-size: 100%; border-spacing: 0px; border-collapse:collapse }
|
||||
form { margin: 0; padding: 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% }
|
||||
.breadcrumb { font-size: 11pt; padding-bottom: 6px }
|
||||
.login { margin: 3px; color: black }
|
||||
input.button { color: #666666; height: 20px; margin-bottom: 5px; margin-top:2px;
|
||||
cursor:pointer; font-size: 90%; padding-left: 10px;
|
||||
background-color: white; background-repeat: no-repeat;
|
||||
background-position: 8px 25%; box-shadow: 2px 2px 2px #888888}
|
||||
input.buttonSmall { width: 100px !important; font-size: 85%; height: 18px;
|
||||
margin-bottom: 5px }
|
||||
input.button { color: #666666; height: 20px; cursor:pointer; font-size: 90%;
|
||||
padding-left: 26px; padding-right: 12px; background-color: white;
|
||||
background-repeat: no-repeat; background-position: 8px 25%;
|
||||
box-shadow: 2px 2px 2px #888888}
|
||||
input.buttonSmall { font-size: 85%; height: 18px }
|
||||
input.buttonFixed { width:110px; padding: 0 0 0 10px }
|
||||
.fake { background-color: #e6e6e6 !important ; cursor:help !important }
|
||||
.xhtml { background-color: white; padding: 4px; font-size: 95% }
|
||||
.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 }
|
||||
.focus td { padding: 4px 0px 4px 4px }
|
||||
.discreet { font-size: 90%; color: grey }
|
||||
.title { color: #BA9440 }
|
||||
.title {}
|
||||
.lostPassword { font-size: 90%; color: white; padding-left: 1em }
|
||||
.current { font-weight: bold }
|
||||
.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;
|
||||
margin: 0 2px 0 4px; font-family: monospace }
|
||||
.highlight { background-color: yellow }
|
||||
.globalActions { margin-bottom: 4px }
|
||||
|
|
|
@ -228,24 +228,21 @@ class ToolWrapper(AbstractWrapper):
|
|||
class=":(not currentSearch and (currentClass==className) and \
|
||||
(currentPage=='query')) and \
|
||||
'current' or ''">::_(className + '_plural')</a>
|
||||
</div>
|
||||
|
||||
<!-- Create instances of this class -->
|
||||
<form if="ztool.userMayCreate(rootClass) and \
|
||||
('form' in ztool.getCreateMeans(rootClass))" class="addForm"
|
||||
var2="target=ztool.getLinksTargetInfo(rootClass)"
|
||||
action=":'%s/do' % toolUrl" target=":target.target">
|
||||
<input type="hidden" name="action" value="Create"/>
|
||||
<input type="hidden" name="className" value=":className"/>
|
||||
<input type="hidden" name="popup"
|
||||
value=":(inPopup or (target.target != '_self')) and '1' or '0'"/>
|
||||
<input type="submit" class="buttonSmall button"
|
||||
var="label=_('query_create')" value=":label"
|
||||
onclick=":target.openPopup"
|
||||
style=":'%s; %s' % (url('add', bg=True), \
|
||||
ztool.getButtonWidth(label))"/>
|
||||
</form>
|
||||
|
||||
<form if="ztool.userMayCreate(rootClass) and \
|
||||
('form' in ztool.getCreateMeans(rootClass))" class="addForm"
|
||||
var2="target=ztool.getLinksTargetInfo(rootClass)"
|
||||
action=":'%s/do' % toolUrl" target=":target.target">
|
||||
<input type="hidden" name="action" value="Create"/>
|
||||
<input type="hidden" name="className" value=":className"/>
|
||||
<input type="hidden" name="popup"
|
||||
value=":(inPopup or (target.target != '_self')) and '1' or '0'"/>
|
||||
<input var="label=_('query_create');
|
||||
css=ztool.getButtonCss(label)" type="submit" class=":css"
|
||||
value=":label" onclick=":target.openPopup"
|
||||
style=":url('add', bg=True)"/>
|
||||
</form>
|
||||
</div>
|
||||
<!-- Searches -->
|
||||
<x if="ztool.advancedSearchEnabledFor(rootClass)">
|
||||
<!-- Live search -->
|
||||
|
@ -365,7 +362,8 @@ class ToolWrapper(AbstractWrapper):
|
|||
if="sub">::zobj.highlight(sub)</span>
|
||||
|
||||
<!-- 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 -->
|
||||
<a if="zobj.mayEdit()"
|
||||
var2="navInfo='search.%s.%s.%d.%d' % \
|
||||
|
@ -453,15 +451,13 @@ class ToolWrapper(AbstractWrapper):
|
|||
</table>
|
||||
<!-- The button for selecting objects and closing the popup. -->
|
||||
<div if="inPopup and cbShown" align=":dleft">
|
||||
<input type="button" class="button"
|
||||
var="label=_('object_link_many')"
|
||||
value=":label"
|
||||
<input type="button"
|
||||
var="label=_('object_link_many'); css=ztool.getButtonCss(label)"
|
||||
value=":label" class=":css" style=":url('linkMany', bg=True)"
|
||||
onclick=":'onSelectObjects(%s,%s,%s,%s,%s,%s,%s)' % \
|
||||
(q(rootHookId), q(uiSearch.initiator.url), \
|
||||
q(uiSearch.initiatorMode), q(sortKey), q(sortOrder), \
|
||||
q(filterKey), q(filterValue))"
|
||||
style=":'%s; %s' % (url('linkMany', bg=True), \
|
||||
ztool.getButtonWidth(label))"/>
|
||||
q(filterKey), q(filterValue))"/>
|
||||
</div>
|
||||
<!-- Init checkboxes if present. -->
|
||||
<script if="checkboxes">:'initCbs(%s)' % q(checkboxesId)</script>
|
||||
|
@ -622,10 +618,9 @@ class ToolWrapper(AbstractWrapper):
|
|||
|
||||
<!-- Submit button -->
|
||||
<p align=":dright"><br/>
|
||||
<input type="submit" class="button" var="label=_('search_button')"
|
||||
value=":label"
|
||||
style=":'%s; %s' % (url('search', bg=True), \
|
||||
ztool.getButtonWidth(label))"/>
|
||||
<input var="label=_('search_button');
|
||||
css=ztool.getButtonCss(label, small=False)" type="submit"
|
||||
class=":css" value=":label" style=":url('search', bg=True)"/>
|
||||
</p>
|
||||
</form>
|
||||
</x>''', template=AbstractWrapper.pxTemplate, hook='content')
|
||||
|
|
|
@ -465,46 +465,46 @@ class AbstractWrapper(object):
|
|||
<!-- Previous -->
|
||||
<x if="previousPage and pageInfo.showPrevious"
|
||||
var2="label=_('page_previous');
|
||||
buttonWidth=ztool.getButtonWidth(label)">
|
||||
css=ztool.getButtonCss(label, small=False)">
|
||||
<!-- Button on the edit page -->
|
||||
<x if="isEdit">
|
||||
<input type="button" class="button" value=":label"
|
||||
<input type="button" class=":css" value=":label"
|
||||
onclick="submitAppyForm('previous')"
|
||||
style=":'%s; %s' % (url('previous', bg=True), buttonWidth)"/>
|
||||
style=":url('previous', bg=True)"/>
|
||||
<input type="hidden" name="previousPage" value=":previousPage"/>
|
||||
</x>
|
||||
<!-- Button on the view page -->
|
||||
<input if="not isEdit" type="button" class="button" value=":label"
|
||||
style=":'%s; %s' % (url('previous', bg=True), buttonWidth)"
|
||||
<input if="not isEdit" type="button" class=":css" value=":label"
|
||||
style=":url('previous', bg=True)"
|
||||
onclick=":'goto(%s)' % q(zobj.getUrl(page=previousPage, \
|
||||
inPopup=inPopup))"/>
|
||||
</x>
|
||||
<!-- Save -->
|
||||
<input if="isEdit and pageInfo.showSave"
|
||||
type="button" class="button" onclick="submitAppyForm('save')"
|
||||
var2="label=_('object_save')" value=":label"
|
||||
style=":'%s; %s' % (url('save', bg=True), \
|
||||
ztool.getButtonWidth(label))" />
|
||||
<input if="isEdit and pageInfo.showSave" type="button"
|
||||
var2="label=_('object_save');
|
||||
css=ztool.getButtonCss(label, small=False)"
|
||||
class=":css" onclick="submitAppyForm('save')"
|
||||
value=":label" style=":url('save', bg=True)" />
|
||||
<!-- Cancel -->
|
||||
<input if="isEdit and pageInfo.showCancel"
|
||||
type="button" class="button" onclick="submitAppyForm('cancel')"
|
||||
var2="label=_('object_cancel')" value=":label"
|
||||
style=":'%s; %s' % (url('cancel', bg=True), \
|
||||
ztool.getButtonWidth(label))"/>
|
||||
<input if="isEdit and pageInfo.showCancel" type="button"
|
||||
var2="label=_('object_cancel');
|
||||
css=ztool.getButtonCss(label, small=False)"
|
||||
class=":css" onclick="submitAppyForm('cancel')" value=":label"
|
||||
style=":url('cancel', bg=True)"/>
|
||||
<x if="not isEdit"
|
||||
var2="locked=zobj.isLocked(user, page);
|
||||
editable=pageInfo.showOnEdit and pageInfo.showEdit and \
|
||||
mayAct and zobj.mayEdit()">
|
||||
<!-- Edit -->
|
||||
<input type="button" class="button" if="editable and not locked"
|
||||
var="label=_('object_edit')" value=":label"
|
||||
style=":'%s; %s' % (url('edit', bg=True), \
|
||||
ztool.getButtonWidth(label))"
|
||||
<input if="editable and not locked" type="button"
|
||||
var="label=_('object_edit');
|
||||
css=ztool.getButtonCss(label, small=False)"
|
||||
value=":label" class=":css" style=":url('edit', bg=True)"
|
||||
onclick=":'goto(%s)' % q(zobj.getUrl(mode='edit', page=page, \
|
||||
inPopup=inPopup))"/>
|
||||
<!-- Locked -->
|
||||
<a if="editable and locked">
|
||||
<img style="cursor: help"
|
||||
<img class="help"
|
||||
var="lockDate=ztool.formatDate(locked[1]);
|
||||
lockMap={'user':ztool.getUserName(locked[0]), \
|
||||
'date':lockDate};
|
||||
|
@ -516,26 +516,24 @@ class AbstractWrapper(object):
|
|||
onclick=":'onUnlockPage(%s,%s)' % (q(zobj.id), q(page))"/></a>
|
||||
</x>
|
||||
<!-- Delete -->
|
||||
<input if="not isEdit and not inPopup and zobj.mayDelete()"
|
||||
type="button" class="button"
|
||||
onclick=":'onDeleteObject(%s)' % q(zobj.id)"
|
||||
var2="label=_('object_delete')" value=":label"
|
||||
style=":'%s; %s' % (url('delete', bg=True), \
|
||||
ztool.getButtonWidth(label))"/>
|
||||
<input if="not isEdit and not inPopup and zobj.mayDelete()" type="button"
|
||||
var2="label=_('object_delete');
|
||||
css=ztool.getButtonCss(label, small=False)"
|
||||
value=":label" class=":css" style=":url('delete', bg=True)"
|
||||
onclick=":'onDeleteObject(%s)' % q(zobj.id)"/>
|
||||
<!-- Next -->
|
||||
<x if="nextPage and pageInfo.showNext"
|
||||
var2="label=_('page_next');
|
||||
buttonWidth=ztool.getButtonWidth(label)">
|
||||
css=ztool.getButtonCss(label, small=False)">
|
||||
<!-- Button on the edit page -->
|
||||
<x if="isEdit">
|
||||
<input type="button" class="button" onclick="submitAppyForm('next')"
|
||||
style=":'%s; %s' % (url('next', bg=True), buttonWidth)"
|
||||
value=":label"/>
|
||||
<input type="button" class=":css" onclick="submitAppyForm('next')"
|
||||
style=":url('next', bg=True)" value=":label"/>
|
||||
<input type="hidden" name="nextPage" value=":nextPage"/>
|
||||
</x>
|
||||
<!-- Button on the view page -->
|
||||
<input if="not isEdit" type="button" class="button" value=":label"
|
||||
style=":'%s; %s' % (url('next', bg=True), buttonWidth)"
|
||||
<input if="not isEdit" type="button" class=":css" value=":label"
|
||||
style=":url('next', bg=True)"
|
||||
onclick=":'goto(%s)' % q(zobj.getUrl(page=nextPage, \
|
||||
inPopup=inPopup))"/>
|
||||
</x>
|
||||
|
|
Loading…
Reference in a new issue