[gen] Buttons can now be stretched to fit the size of the inner label.
|
@ -28,20 +28,20 @@ class Action(Field):
|
|||
# PX for viewing the Action button.
|
||||
pxView = pxCell = Px('''
|
||||
<form var="formId='%s_%s_form' % (zobj.id, name);
|
||||
label=_(field.labelId)"
|
||||
label=_(field.labelId);
|
||||
buttonWidth=ztool.getButtonWidth(label)"
|
||||
id=":formId" action=":ztool.absolute_url() + '/do'">
|
||||
<input type="hidden" name="action" value="ExecuteAction"/>
|
||||
<input type="hidden" name="objectUid" value=":zobj.id"/>
|
||||
<input type="hidden" name="fieldName" value=":name"/>
|
||||
<input if="field.confirm" type="button" class="button"
|
||||
var="labelConfirm=_(field.labelId + '_confirm')"
|
||||
value=":ztool.truncateValue(label)" title=":label"
|
||||
style=":url('buttonAction', bg=True)"
|
||||
var="labelConfirm=_(field.labelId + '_confirm')" value=":label"
|
||||
style=":'%s; %s' % (url('action', bg=True), buttonWidth)"
|
||||
onclick=":'askConfirm(%s,%s,%s)' % (q('form'), q(formId), \
|
||||
q(labelConfirm))"/>
|
||||
<input if="not field.confirm" type="submit" class="button" name="do"
|
||||
value=":ztool.truncateValue(label)" title=":label"
|
||||
style=":url('buttonAction', bg=True)"/>
|
||||
value=":label"
|
||||
style=":'%s; %s' % (url('action', bg=True), buttonWidth)"/>
|
||||
</form>''')
|
||||
|
||||
# It is not possible to edit an action, not to search it.
|
||||
|
|
|
@ -56,23 +56,26 @@ class Ref(Field):
|
|||
# objects (delete many, unlink many,...)
|
||||
pxGlobalActions = Px('''
|
||||
<!-- Insert several objects (if in pick list) -->
|
||||
<input if="inPickList" var2="action='link'" type="button" class="button"
|
||||
value=":_('object_link_many')"
|
||||
<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=":url('linkMany', bg=True)"/>
|
||||
style=":'%s; %s' % (url('linkMany', bg=True), \
|
||||
ztool.getButtonWidth(label))"/>
|
||||
<!-- Unlink several objects -->
|
||||
<input if="not isBack and field.unlink and canWrite and not inPickList"
|
||||
var2="imgName=linkList and 'unlinkManyUp' or 'unlinkMany';
|
||||
action='unlink'"
|
||||
type="button" class="button" value=":_('object_unlink_many')"
|
||||
action='unlink'; label=_('object_unlink_many')"
|
||||
type="button" class="button" value=":label"
|
||||
onclick=":'onLinkMany(%s,%s)' % (q(action), q(ajaxHookId))"
|
||||
style=":url(imgName, bg=True)"/>
|
||||
style=":'%s; %s' % (url(imgName, bg=True), \
|
||||
ztool.getButtonWidth(label))"/>
|
||||
<!-- Delete several objects -->
|
||||
<input if="not isBack and field.delete and canWrite"
|
||||
var2="action='delete'"
|
||||
type="button" class="button" value=":_('object_delete_many')"
|
||||
var2="action='delete'; label=_('object_delete_many')"
|
||||
type="button" class="button" value=":label"
|
||||
onclick=":'onLinkMany(%s,%s)' % (q(action), q(ajaxHookId))"
|
||||
style=":url('deleteMany', bg=True)"/>
|
||||
style=":'%s; %s' % (url('deleteMany', bg=True), \
|
||||
ztool.getButtonWidth(label))"/>
|
||||
''')
|
||||
|
||||
# This PX displays icons for triggering actions on a given referenced object
|
||||
|
@ -152,9 +155,10 @@ class Ref(Field):
|
|||
'%d,%s' % (startNumber, q('CreateWithoutForm')));
|
||||
noFormCall=not field.addConfirm and noFormCall or \
|
||||
'askConfirm(%s, %s, %s)' % (q('script'), q(noFormCall), \
|
||||
q(addConfirmMsg))"
|
||||
style=":url('buttonAdd', bg=True)" value=":_('add_ref')"
|
||||
onclick=":field.noForm and noFormCall or formCall"/>''')
|
||||
q(addConfirmMsg));
|
||||
label=_('add_ref')"
|
||||
style=":'%s; %s' % (url('add', bg=True), ztool.getButtonWidth(label))"
|
||||
value=":label" onclick=":field.noForm and noFormCall or formCall"/>''')
|
||||
|
||||
# This PX displays, in a cell header from a ref table, icons for sorting the
|
||||
# ref field according to the field that corresponds to this column.
|
||||
|
@ -215,7 +219,9 @@ class Ref(Field):
|
|||
<x>:field.pxAdd</x>
|
||||
<!-- The search button if field is queryable -->
|
||||
<input if="objects and field.queryable" type="button" class="button"
|
||||
style=":url('buttonSearch', bg=True)" value=":_('search_title')"
|
||||
var2="label=_('search_title')" value=":label"
|
||||
style=":'%s; %s' % (url('search', bg=True), \
|
||||
ztool.getButtonWidth(label))"
|
||||
onclick=":'goto(%s)' % \
|
||||
q('%s/search?className=%s&ref=%s:%s' % \
|
||||
(ztool.absolute_url(), tiedClassName, zobj.id, field.name))"/>
|
||||
|
@ -235,7 +241,7 @@ class Ref(Field):
|
|||
<tr if="field.showHeaders">
|
||||
<th if="not inPickList and numbered" width=":numbered"></th>
|
||||
<th for="column in columns" width=":column.width"
|
||||
align="column.align" var2="refField=column.field">
|
||||
align=":column.align" var2="refField=column.field">
|
||||
<span>:_(refField.labelId)</span>
|
||||
<x>:field.pxSortIcons</x>
|
||||
<x var="className=tiedClassName;
|
||||
|
|
|
@ -310,8 +310,8 @@ class Transition:
|
|||
if user.has_role(condition, obj):
|
||||
hasRole = True
|
||||
else: # It is a method
|
||||
if not condition(wf, obj.appy()):
|
||||
return False
|
||||
res = condition(wf, obj.appy())
|
||||
if not res: return res # False or a No instance.
|
||||
if hasRole != False:
|
||||
return True
|
||||
|
||||
|
@ -387,18 +387,20 @@ class UiTransition:
|
|||
|
||||
pxView = Px('''<x>
|
||||
<!-- Real button -->
|
||||
<input if="transition.mayTrigger"
|
||||
type="button" class="button" title=":transition.title"
|
||||
style=":url('buttonTransition', bg=True)"
|
||||
value=":ztool.truncateValue(transition.title)"
|
||||
<input if="transition.mayTrigger" type="button" class="button"
|
||||
var2="label=transition.title"
|
||||
style=":'%s; %s' % (url('transition', bg=True), \
|
||||
ztool.getButtonWidth(label))"
|
||||
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 type="button" class="button" if="not transition.mayTrigger"
|
||||
style=":url('buttonFake', bg=True) + ';cursor: help'"
|
||||
value=":ztool.truncateValue(transition.title)"
|
||||
title=":'%s: %s' % (transition.title, transition.reason)"/>
|
||||
<input if="not transition.mayTrigger" type="button"
|
||||
class="fakeButton button" var2="label=transition.title"
|
||||
style=":'%s; %s' % (url('fake', bg=True),
|
||||
ztool.getButtonWidth(label))"
|
||||
value=":label" title=":'%s: %s' % (label, transition.reason)"/>
|
||||
</x>''')
|
||||
|
||||
def __init__(self, name, transition, obj, mayTrigger, ):
|
||||
|
|
|
@ -211,15 +211,10 @@ class Table:
|
|||
# Some base layouts to use, for fields and pages -------------------------------
|
||||
# The default layouts for pages.
|
||||
defaultPageLayouts = {
|
||||
'view': Table('w|-b|', align="center"),
|
||||
'edit': Table('w|-b|', width=None)}
|
||||
'view': Table('w-b'), 'edit': Table('w-b', width=None)}
|
||||
# A layout for pages, containing the page summary.
|
||||
summaryPageLayouts = {'view': Table('s-w|-b|', align="center"),
|
||||
'edit': Table('w|-b|', width=None)}
|
||||
widePageLayouts = {
|
||||
'view': Table('w|-b|', align="center"),
|
||||
'edit': Table('w|-b|')
|
||||
}
|
||||
summaryPageLayouts = {'view': Table('s-w-b'), 'edit': Table('w-b', width=None)}
|
||||
widePageLayouts = {'view': Table('w-b'), 'edit': Table('w-b')}
|
||||
centeredPageLayouts = {
|
||||
'view': Table('w|-b|', align="center"),
|
||||
'edit': Table('w|-b|', width=None, align='center')
|
||||
|
|
|
@ -1352,4 +1352,15 @@ class ToolMixin(BaseMixin):
|
|||
"s.parentNode.insertBefore(ga, s);\n" \
|
||||
"})();\n" % gaId
|
||||
return code
|
||||
|
||||
def getButtonWidth(self, label):
|
||||
'''Determine button width, in pixels, corresponding to the button
|
||||
p_label.'''
|
||||
l = len(label)
|
||||
if l < 10:
|
||||
width = '130px'
|
||||
else:
|
||||
# Consider 1 char = 6 pixels wide.
|
||||
width = '%dpx' % (130 + ((l-10)*4))
|
||||
return 'width:%s' % width
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
|
@ -855,7 +855,7 @@ class BaseMixin:
|
|||
can't trigger, but for which he needs to know for what reason he
|
||||
can't trigger it;
|
||||
* if p_includeNotShowable is True, it includes transitions for which
|
||||
show=False. Indeed, because "showability" is only a GUI concern,
|
||||
show=False. Indeed, because "showability" is only a UI concern,
|
||||
and not a security concern, in some cases it has sense to set
|
||||
includeNotShowable=True, because those transitions are triggerable
|
||||
from a security point of view.
|
||||
|
|
BIN
gen/ui/action.png
Normal file
After Width: | Height: | Size: 566 B |
BIN
gen/ui/add.png
Normal file
After Width: | Height: | Size: 240 B |
|
@ -66,9 +66,11 @@ img { border: 0; vertical-align: middle }
|
|||
background-color: #dbdde1; font-weight: bold }
|
||||
.navigate td { padding: 4px 9px }
|
||||
.login { margin: 3px; color: black }
|
||||
input.button { border-width: 0 !important; color: #666666; height: 24px;
|
||||
width: 150px; cursor:pointer; font-size: 90%; padding: 1px 0 0 10px;
|
||||
background-color: transparent !important }
|
||||
input.button { color: #666666; height: 20px; width: 130px;
|
||||
cursor:pointer; font-size: 90%; padding-left: 10px;
|
||||
background-color: white; background-repeat: no-repeat;
|
||||
background-position: 5% 25%; box-shadow: 2px 2px 2px #888888}
|
||||
.fakeButton { background-color: #e6e6e6 !important ; cursor:help !important }
|
||||
.buttons { margin-left: 4px }
|
||||
.message { position: absolute; top: -40px; left: 50%; font-size: 90%;
|
||||
width: 600px; border: 1px #F0C36D solid; padding: 6px;
|
||||
|
|
Before Width: | Height: | Size: 669 B |
Before Width: | Height: | Size: 312 B |
Before Width: | Height: | Size: 877 B |
Before Width: | Height: | Size: 374 B |
Before Width: | Height: | Size: 773 B |
Before Width: | Height: | Size: 315 B |
Before Width: | Height: | Size: 325 B |
Before Width: | Height: | Size: 637 B |
Before Width: | Height: | Size: 478 B |
Before Width: | Height: | Size: 691 B |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 747 B |
Before Width: | Height: | Size: 360 B After Width: | Height: | Size: 259 B |
BIN
gen/ui/fake.png
Normal file
After Width: | Height: | Size: 657 B |
Before Width: | Height: | Size: 327 B After Width: | Height: | Size: 288 B |
BIN
gen/ui/next.png
Normal file
After Width: | Height: | Size: 229 B |
BIN
gen/ui/previous.png
Normal file
After Width: | Height: | Size: 225 B |
BIN
gen/ui/save.png
Normal file
After Width: | Height: | Size: 513 B |
Before Width: | Height: | Size: 191 B |
BIN
gen/ui/transition.png
Normal file
After Width: | Height: | Size: 653 B |
Before Width: | Height: | Size: 359 B After Width: | Height: | Size: 256 B |
Before Width: | Height: | Size: 316 B After Width: | Height: | Size: 243 B |
|
@ -192,7 +192,9 @@ class ToolWrapper(AbstractWrapper):
|
|||
<!-- Create a new object from a web form. -->
|
||||
<input type="button" class="button"
|
||||
if="mayCreate and ('form' in createMeans)"
|
||||
style=":url('buttonAdd', bg=True)" value=":_('query_create')"
|
||||
var2="label=_('query_create')" value=":label"
|
||||
style=":'%s; %s' % (url('add', bg=True), \
|
||||
ztool.getButtonWidth(label))"
|
||||
onclick=":'goto(%s)' % \
|
||||
q('%s/do?action=Create&className=%s' % \
|
||||
(toolUrl, className))"/>
|
||||
|
@ -209,7 +211,7 @@ class ToolWrapper(AbstractWrapper):
|
|||
<td><input type="text" size="14" name="w_SearchableText"
|
||||
class="inputSearch"/></td>
|
||||
<td>
|
||||
<input type="image" class="clickable" src=":url('search.gif')"
|
||||
<input type="image" class="clickable" src=":url('search')"
|
||||
title=":_('search_button')"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -521,8 +523,10 @@ class ToolWrapper(AbstractWrapper):
|
|||
|
||||
<!-- Submit button -->
|
||||
<p align=":dright"><br/>
|
||||
<input type="submit" class="button" value=":_('search_button')"
|
||||
style=":url('buttonSearch', bg=True)"/>
|
||||
<input type="submit" class="button" var="label=_('search_button')"
|
||||
value=":label"
|
||||
style=":'%s; %s' % (url('search', bg=True), \
|
||||
ztool.getButtonWidth(label))"/>
|
||||
</p>
|
||||
</form>
|
||||
</x>''', template=AbstractWrapper.pxTemplate, hook='content')
|
||||
|
|
|
@ -370,7 +370,7 @@ class AbstractWrapper(object):
|
|||
<!-- Input field for storing the comment coming from the popup -->
|
||||
<textarea id="comment" name="comment" cols="30" rows="3"
|
||||
style="display:none"></textarea>
|
||||
<table>
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
<tr valign="middle">
|
||||
<td align=":dright" for="transition in transitions">
|
||||
<!-- Render a transition or a group of transitions. -->
|
||||
|
@ -448,31 +448,36 @@ class AbstractWrapper(object):
|
|||
pageInfo=phaseObj.pagesInfo[page]">
|
||||
<tr valign="top">
|
||||
<!-- Previous -->
|
||||
<td if="previousPage and pageInfo.showPrevious">
|
||||
<td if="previousPage and pageInfo.showPrevious"
|
||||
var2="label=_('page_previous');
|
||||
buttonWidth=ztool.getButtonWidth(label)">
|
||||
<!-- Button on the edit page -->
|
||||
<x if="isEdit">
|
||||
<input type="button" class="button" value=":_('page_previous')"
|
||||
<input type="button" class="button" value=":label"
|
||||
onClick="submitAppyForm('previous')"
|
||||
style=":url('buttonPrevious', bg=True)"/>
|
||||
style=":'%s; %s' % (url('previous', bg=True), buttonWidth)"/>
|
||||
<input type="hidden" name="previousPage" value=":previousPage"/>
|
||||
</x>
|
||||
<!-- Button on the view page -->
|
||||
<input if="not isEdit" type="button" class="button"
|
||||
value=":_('page_previous')"
|
||||
style=":url('buttonPrevious', bg=True)"
|
||||
<input if="not isEdit" type="button" class="button" value=":label"
|
||||
style=":'%s; %s' % (url('previous', bg=True), buttonWidth)"
|
||||
onclick=":'goto(%s)' % q(zobj.getUrl(page=previousPage))"/>
|
||||
</td>
|
||||
|
||||
<!-- Save -->
|
||||
<td if="isEdit and pageInfo.showSave">
|
||||
<input type="button" class="button" onClick="submitAppyForm('save')"
|
||||
style=":url('buttonSave', bg=True)" value=":_('object_save')"/>
|
||||
var="label=_('object_save')" value=":label"
|
||||
style=":'%s; %s' % (url('save', bg=True), \
|
||||
ztool.getButtonWidth(label))" />
|
||||
</td>
|
||||
|
||||
<!-- Cancel -->
|
||||
<td if="isEdit and pageInfo.showCancel">
|
||||
<input type="button" class="button" onClick="submitAppyForm('cancel')"
|
||||
style=":url('buttonCancel', bg=True)" value=":_('object_cancel')"/>
|
||||
var="label=_('object_cancel')" value=":label"
|
||||
style=":'%s; %s' % (url('cancel', bg=True), \
|
||||
ztool.getButtonWidth(label))"/>
|
||||
</td>
|
||||
|
||||
<td if="not isEdit"
|
||||
|
@ -482,7 +487,9 @@ class AbstractWrapper(object):
|
|||
|
||||
<!-- Edit -->
|
||||
<input type="button" class="button" if="editable and not locked"
|
||||
style=":url('buttonEdit', bg=True)" value=":_('object_edit')"
|
||||
var="label=_('object_edit')" value=":label"
|
||||
style=":'%s; %s' % (url('edit', bg=True), \
|
||||
ztool.getButtonWidth(label))"
|
||||
onclick=":'goto(%s)' % q(zobj.getUrl(mode='edit', page=page))"/>
|
||||
|
||||
<!-- Locked -->
|
||||
|
@ -496,20 +503,23 @@ class AbstractWrapper(object):
|
|||
<a if="editable and locked and user.has_role('Manager')">
|
||||
<img class="clickable" title=":_('page_unlock')"
|
||||
src=":url('unlockBig')"
|
||||
onclick=":'onUnlockPage(%s,%s)' % (q(zobj.UID()), q(page))"/></a>
|
||||
onclick=":'onUnlockPage(%s,%s)' % (q(zobj.id), q(page))"/></a>
|
||||
</td>
|
||||
|
||||
<!-- Next -->
|
||||
<td if="nextPage and pageInfo.showNext">
|
||||
<td if="nextPage and pageInfo.showNext"
|
||||
var2="label=_('page_next');
|
||||
buttonWidth=ztool.getButtonWidth(label)">
|
||||
<!-- Button on the edit page -->
|
||||
<x if="isEdit">
|
||||
<input type="button" class="button" onClick="submitAppyForm('next')"
|
||||
style=":url('buttonNext', bg=True)" value=":_('page_next')"/>
|
||||
style=":'%s; %s' % (url('next', bg=True), buttonWidth)"
|
||||
value=":label"/>
|
||||
<input type="hidden" name="nextPage" value=":nextPage"/>
|
||||
</x>
|
||||
<!-- Button on the view page -->
|
||||
<input if="not isEdit" type="button" class="button"
|
||||
style=":url('buttonNext', bg=True)" value=":_('page_next')"
|
||||
<input if="not isEdit" type="button" class="button" value=":label"
|
||||
style=":'%s; %s' % (url('next', bg=True), buttonWidth)"
|
||||
onclick=":'goto(%s)' % q(zobj.getUrl(page=nextPage))"/>
|
||||
</td>
|
||||
|
||||
|
|