[gen] Replaced, in PXs, function 'img' by function 'url', that returns the URL of an external resource to be included in the XHTML, like an image, a Javascript file or a CSS file.

This commit is contained in:
Gaetan Delannay 2013-07-20 19:56:17 +02:00
parent f2b19e4141
commit efd918f175
11 changed files with 83 additions and 85 deletions

View file

@ -36,12 +36,12 @@ class Action(Field):
<input if="field.confirm" type="button" class="button" <input if="field.confirm" type="button" class="button"
var="labelConfirm=_(field.labelId + '_confirm')" var="labelConfirm=_(field.labelId + '_confirm')"
value=":ztool.truncateValue(label)" title=":label" value=":ztool.truncateValue(label)" title=":label"
style=":img('buttonAction', bg=True)" style=":url('buttonAction', bg=True)"
onclick=":'askConfirm(%s,%s,%s)' % (q('form'), q(formId), \ onclick=":'askConfirm(%s,%s,%s)' % (q('form'), q(formId), \
q(labelConfirm))"/> q(labelConfirm))"/>
<input if="not field.confirm" type="submit" class="button" name="do" <input if="not field.confirm" type="submit" class="button" name="do"
value=":ztool.truncateValue(label)" title=":label" value=":ztool.truncateValue(label)" title=":label"
style=":img('buttonAction', bg=True)"/> style=":url('buttonAction', bg=True)"/>
</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

@ -47,7 +47,7 @@ class Calendar(Field):
goForward=not endDate or (endDate.strftime(fmt) &gt; \ goForward=not endDate or (endDate.strftime(fmt) &gt; \
grid[-1][-1].strftime(fmt))"> grid[-1][-1].strftime(fmt))">
<!-- Go to the previous month --> <!-- Go to the previous month -->
<img class="clickable" if="goBack" src=":img('arrowLeftSimple')" <img class="clickable" if="goBack" src=":url('arrowLeftSimple')"
onclick=":'askMonthView(%s,%s,%s,%s)' % \ onclick=":'askMonthView(%s,%s,%s,%s)' % \
(q(ajaxHookId),q(objUrl),q(field.name),q(previousMonth))"/> (q(ajaxHookId),q(objUrl),q(field.name),q(previousMonth))"/>
<!-- Go back to the default date --> <!-- Go back to the default date -->
@ -60,7 +60,7 @@ class Calendar(Field):
q(objUrl), q(field.name), q(defaultDateMonth))" q(objUrl), q(field.name), q(defaultDateMonth))"
disabled=":defaultDate.strftime(fmt)==monthDayOne.strftime(fmt)"/> disabled=":defaultDate.strftime(fmt)==monthDayOne.strftime(fmt)"/>
<!-- Go to the next month --> <!-- Go to the next month -->
<img class="clickable" if="goForward" src=":img('arrowRightSimple')" <img class="clickable" if="goForward" src=":url('arrowRightSimple')"
onclick=":'askMonthView(%s, %s, %s, %s)' % (q(ajaxHookId), \ onclick=":'askMonthView(%s, %s, %s, %s)' % (q(ajaxHookId), \
q(objUrl), q(field.name), q(nextMonth))"/> q(objUrl), q(field.name), q(nextMonth))"/>
<span>:_('month_%s' % monthDayOne.aMonth())</span> <span>:_('month_%s' % monthDayOne.aMonth())</span>
@ -107,14 +107,14 @@ class Calendar(Field):
<img class="clickable" style="visibility:hidden" <img class="clickable" style="visibility:hidden"
var="info=field.getApplicableEventsTypesAt(contextObj, date, \ var="info=field.getApplicableEventsTypesAt(contextObj, date, \
allEventTypes, preComputed, True)" allEventTypes, preComputed, True)"
if="info['eventTypes']" src=":img('plus')" if="info['eventTypes']" src=":url('plus')"
onclick=":'openEventPopup(%s, %s, %s, null, %s, %s)' % \ onclick=":'openEventPopup(%s, %s, %s, null, %s, %s)' % \
(q('new'), q(field.name), q(dayString), q(info['eventTypes']),\ (q('new'), q(field.name), q(dayString), q(info['eventTypes']),\
q(info['message']))"/> q(info['message']))"/>
</x> </x>
<!-- Icon for deleting an event --> <!-- Icon for deleting an event -->
<img if="mayDelete" class="clickable" style="visibility:hidden" <img if="mayDelete" class="clickable" style="visibility:hidden"
src=":img('delete')" src=":url('delete')"
onclick=":'openEventPopup(%s, %s, %s, %s, null, null)' % \ onclick=":'openEventPopup(%s, %s, %s, %s, null, null)' % \
(q('del'), q(field.name), q(dayString), q(str(spansDays)))"/> (q('del'), q(field.name), q(dayString), q(str(spansDays)))"/>
<!-- A single event is allowed for the moment --> <!-- A single event is allowed for the moment -->

View file

@ -56,7 +56,7 @@ class Date(Field):
<!-- The icon for displaying the calendar popup --> <!-- The icon for displaying the calendar popup -->
<x if="field.calendar"> <x if="field.calendar">
<input type="hidden" id=":name" name=":name"/> <input type="hidden" id=":name" name=":name"/>
<img id=":'%s_img' % name" src=":img('calendar.gif')"/> <img id=":'%s_img' % name" src=":url('calendar.gif')"/>
<script type="text/javascript">:field.getJsInit(name, years)</script> <script type="text/javascript">:field.getJsInit(name, years)</script>
</x> </x>
@ -111,7 +111,7 @@ class Date(Field):
<!-- The icon for displaying the calendar popup --> <!-- The icon for displaying the calendar popup -->
<x if="field.calendar"> <x if="field.calendar">
<input type="hidden" id=":fromName" name=":fromName"/> <input type="hidden" id=":fromName" name=":fromName"/>
<img id=":'%s_img' % fromName" src=":img('calendar.gif')"/> <img id=":'%s_img' % fromName" src=":url('calendar.gif')"/>
<script type="text/javascript">:field.getJsInit(fromName, years) <script type="text/javascript">:field.getJsInit(fromName, years)
</script> </script>
</x> </x>
@ -144,7 +144,7 @@ class Date(Field):
<!-- The icon for displaying the calendar popup --> <!-- The icon for displaying the calendar popup -->
<x if="widget.calendar"> <x if="widget.calendar">
<input type="hidden" id=":toName" name=":toName"/> <input type="hidden" id=":toName" name=":toName"/>
<img id=":'%s_img' % toName" src=":img('calendar.gif')"/> <img id=":'%s_img' % toName" src=":url('calendar.gif')"/>
<script type="text/javascript">:field.getJsInit(toName, years)"> <script type="text/javascript">:field.getJsInit(toName, years)">
</script> </script>
</x> </x>

View file

@ -33,7 +33,7 @@ class List(Field):
widgetName='%s*%d' % (field.name, rowIndex)">:field.pxView</td> widgetName='%s*%d' % (field.name, rowIndex)">:field.pxView</td>
<!-- Icon for removing the row --> <!-- Icon for removing the row -->
<td if="layoutType=='edit'" align=":dright"> <td if="layoutType=='edit'" align=":dright">
<img class="clickable" src=":img(delete')" title=":_('object_delete')" <img class="clickable" src=":url(delete')" title=":_('object_delete')"
onclick=":'deleteRow(%s, this)' % q('list_%s' % name)"/> onclick=":'deleteRow(%s, this)' % q('list_%s' % name)"/>
</td> </td>
</tr>''') </tr>''')
@ -47,7 +47,7 @@ class List(Field):
<th for="info in field.fields">::_(info[1].labelId)</th> <th for="info in field.fields">::_(info[1].labelId)</th>
<!-- Icon for adding a new row. --> <!-- Icon for adding a new row. -->
<th if="isEdit"> <th if="isEdit">
<img class="clickable" src=":img('plus')" title=":_('add_ref')" <img class="clickable" src=":url('plus')" title=":_('add_ref')"
onclick=":'insertRow(%s)' % q('list_%s' % name)"/> onclick=":'insertRow(%s)' % q('list_%s' % name)"/>
</th> </th>
</tr> </tr>

View file

@ -38,7 +38,7 @@ class Ogone(Field):
<input type="hidden" for="item in value.items()" if="item[0] != 'env'" <input type="hidden" for="item in value.items()" if="item[0] != 'env'"
id=":item[0]" name=":item[0]" value=":item[1]"/> id=":item[0]" name=":item[0]" value=":item[1]"/>
<!-- Submit image --> <!-- Submit image -->
<input type="image" id="submit2" name="submit2" src=":img('ogone.gif')" <input type="image" id="submit2" name="submit2" src=":url('ogone.gif')"
title=":_('custom_pay')"/> title=":_('custom_pay')"/>
</form> </form>
</x>''') </x>''')

View file

@ -43,7 +43,7 @@ class Pod(Field):
<input type="checkbox" name=":doLabel" id=":chekboxId"/> <input type="checkbox" name=":doLabel" id=":chekboxId"/>
<label lfor=":chekboxId" class="discreet">:_(doLabel)"></label> <label lfor=":chekboxId" class="discreet">:_(doLabel)"></label>
</x> </x>
<img for="fmt in field.getToolInfo(contextObj.appy())[1]" src=":img(fmt)" <img for="fmt in field.getToolInfo(contextObj.appy())[1]" src=":url(fmt)"
onclick=":'generatePodDocument(%s, %s, %s, %s)' % \ onclick=":'generatePodDocument(%s, %s, %s, %s)' % \
(q(contextObj.UID()), q(name), q(fmt), q(ztool.getQueryInfo()))" (q(contextObj.UID()), q(name), q(fmt), q(ztool.getQueryInfo()))"
title=":fmt.capitalize()" class="clickable"/> title=":fmt.capitalize()" class="clickable"/>

View file

@ -61,11 +61,11 @@ class Ref(Field):
ajaxBaseCall=navBaseCall.replace('**v**','%s,%s,{%s:%s,%s:%s}'%\ ajaxBaseCall=navBaseCall.replace('**v**','%s,%s,{%s:%s,%s:%s}'%\
(q(startNumber), q('ChangeRefOrder'), q('refObjectUid'), (q(startNumber), q('ChangeRefOrder'), q('refObjectUid'),
q(obj.UID()), q('move'), q('**v**')))"> q(obj.UID()), q('move'), q('**v**')))">
<img if="objectIndex &gt; 0" class="clickable" src=":img('arrowUp')" <img if="objectIndex &gt; 0" class="clickable" src=":url('arrowUp')"
title=":_('move_up')" title=":_('move_up')"
onclick=":ajaxBaseCall.replace('**v**', 'up')"/> onclick=":ajaxBaseCall.replace('**v**', 'up')"/>
<img if="objectIndex &lt; (totalNumber-1)" class="clickable" <img if="objectIndex &lt; (totalNumber-1)" class="clickable"
src=":img('arrowDown')" title=":_('move_down')" src=":url('arrowDown')" title=":_('move_down')"
onclick=":ajaxBaseCall.replace('**v**', 'down')"/> onclick=":ajaxBaseCall.replace('**v**', 'down')"/>
</td> </td>
<!-- Workflow transitions --> <!-- Workflow transitions -->
@ -76,16 +76,16 @@ class Ref(Field):
<a var="navInfo='ref.%s.%s:%s.%d.%d' % (contextObj.UID(), field.name, \ <a var="navInfo='ref.%s.%s:%s.%d.%d' % (contextObj.UID(), field.name, \
field.pageName, loop.obj.nb + startNumber, totalNumber)" field.pageName, loop.obj.nb + startNumber, totalNumber)"
href=":obj.getUrl(mode='edit', page='main', nav=navInfo)"> href=":obj.getUrl(mode='edit', page='main', nav=navInfo)">
<img src=":img('edit')" title=":_('object_edit')"/></a> <img src=":url('edit')" title=":_('object_edit')"/></a>
</td> </td>
<!-- Delete --> <!-- Delete -->
<td if="not isBack and field.delete and canWrite and obj.mayDelete()"> <td if="not isBack and field.delete and canWrite and obj.mayDelete()">
<img class="clickable" title=":_('object_delete')" <img class="clickable" title=":_('object_delete')"
src=":img('delete')" onclick=":'onDeleteObject(%s)'%q(obj.UID())"/> src=":url('delete')" onclick=":'onDeleteObject(%s)'%q(obj.UID())"/>
</td> </td>
<!-- Unlink --> <!-- Unlink -->
<td if="not isBack and field.unlink and canWrite"> <td if="not isBack and field.unlink and canWrite">
<img class="clickable" title=":_('object_unlink')" src=":img('unlink')" <img class="clickable" title=":_('object_unlink')" src=":url('unlink')"
onclick=":'onUnlinkObject(%s,%s,%s)' % (q(contextObj.UID()), \ onclick=":'onUnlinkObject(%s,%s,%s)' % (q(contextObj.UID()), \
q(field.name), q(obj.UID()))"/> q(field.name), q(obj.UID()))"/>
</td> </td>
@ -109,7 +109,7 @@ class Ref(Field):
noFormCall=not field.addConfirm and noFormCall or \ noFormCall=not field.addConfirm and noFormCall or \
'askConfirm(%s, %s, %s)' % (q('script'), q(noFormCall), \ 'askConfirm(%s, %s, %s)' % (q('script'), q(noFormCall), \
q(addConfirmMsg))" q(addConfirmMsg))"
style=":img('buttonAdd', bg=True)" value=":_('add_ref')" style=":url('buttonAdd', bg=True)" value=":_('add_ref')"
onclick=":field.noForm and noFormCall or formCall"/>''') onclick=":field.noForm and noFormCall or formCall"/>''')
# 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
@ -120,9 +120,9 @@ class Ref(Field):
var2="ajaxBaseCall=navBaseCall.replace('**v**', '%s,%s,{%s:%s,%s:%s}'% \ var2="ajaxBaseCall=navBaseCall.replace('**v**', '%s,%s,{%s:%s,%s:%s}'% \
(q(startNumber), q('SortReference'), q('sortKey'), \ (q(startNumber), q('SortReference'), q('sortKey'), \
q(field.name), q('reverse'), q('**v**')))"> q(field.name), q('reverse'), q('**v**')))">
<img class="clickable" src=":img('sortAsc')" <img class="clickable" src=":url('sortAsc')"
onclick=":ajaxBaseCall.replace('**v**', 'False')"/> onclick=":ajaxBaseCall.replace('**v**', 'False')"/>
<img class="clickable" src=":img('sortDesc')" <img class="clickable" src=":url('sortDesc')"
onclick=":ajaxBaseCall.replace('**v**', 'True')"/> onclick=":ajaxBaseCall.replace('**v**', 'True')"/>
</x>''') </x>''')
@ -180,7 +180,7 @@ class Ref(Field):
<x>:field.pxAdd</x> <x>:field.pxAdd</x>
<!-- The search button if field is queryable --> <!-- The search button if field is queryable -->
<input if="objs and field.queryable" type="button" class="button" <input if="objs and field.queryable" type="button" class="button"
style=":img('buttonSearch', bg=True)" value=":_('search_title')" style=":url('buttonSearch', bg=True)" value=":_('search_title')"
onclick=":'window.location=%s' % \ onclick=":'window.location=%s' % \
q('%s/ui/search?className=%s&amp;ref=%s:%s' % \ q('%s/ui/search?className=%s&amp;ref=%s:%s' % \
(ztool.absolute_url(), linkedPortalType, contextObj.UID(), \ (ztool.absolute_url(), linkedPortalType, contextObj.UID(), \

View file

@ -105,12 +105,12 @@ class ToolMixin(BaseMixin):
podField = self.getAppyType(name, className=obj.meta_type) podField = self.getAppyType(name, className=obj.meta_type)
return podField.getToolInfo(obj.appy()) return podField.getToolInfo(obj.appy())
def getImageUrl(self, name, bg=False): def getIncludeUrl(self, name, bg=False):
'''Gets the full URL of an image named p_name. If p_bg is False, the URL '''Gets the full URL of an external resource, like an image, a
is meant to be used as content for an img's "src" attribute. If p_bg Javascript or a CSS file, named p_name. If p_bg is True, p_name is
is True, the URL is meant to be used in a "style" attribute for an image that is meant to be used in a "style" attribute for defining
defining the background image of the current tag.''' the background image of some XHTML tag.'''
# If not extension is found in the image p_name, suppose it is a png. # If no extension is found in p_name, we suppose it is a png image.
if '.' not in name: name += '.png' if '.' not in name: name += '.png'
url = '%s/ui/%s' % (self.getPhysicalRoot(),absolute_url(), name) url = '%s/ui/%s' % (self.getPhysicalRoot(),absolute_url(), name)
if not bg: return url if not bg: return url

View file

@ -73,7 +73,7 @@ class GroupDescr(Descr):
<div class="portletGroup"> <div class="portletGroup">
<img class="clickable" style="margin-right: 3px" align=":dleft" <img class="clickable" style="margin-right: 3px" align=":dleft"
id=":'%s_img' % field.labelId" id=":'%s_img' % field.labelId"
src=":expanded and img('collapse.gif') or img('expand.gif')" src=":expanded and url('collapse.gif') or url('expand.gif')"
onclick=":'toggleCookie(%s)' % q(field.labelId)"/> onclick=":'toggleCookie(%s)' % q(field.labelId)"/>
<x if="not field.translated">:_(field.labelId)</x> <x if="not field.translated">:_(field.labelId)</x>
<x if="field.translated">:field.translated</x> <x if="field.translated">:field.translated</x>
@ -174,16 +174,16 @@ class PhaseDescr(Descr):
editable=mayEdit and phase['pagesInfo'][aPage]['showOnEdit']"> editable=mayEdit and phase['pagesInfo'][aPage]['showOnEdit']">
<a if="editable and not locked" <a if="editable and not locked"
href="contextObj.getUrl(mode='edit', page=aPage)"> href="contextObj.getUrl(mode='edit', page=aPage)">
<img src=":img('edit')" title=":_('object_edit')"/></a> <img src=":url('edit')" title=":_('object_edit')"/></a>
<a if="editable and locked"> <a if="editable and locked">
<img style="cursor: help" <img style="cursor: help"
var="lockDate=tool.formatDate(locked[1]); var="lockDate=tool.formatDate(locked[1]);
lockMap={'user':ztool.getUserName(locked[0]), \ lockMap={'user':ztool.getUserName(locked[0]), \
'date':lockDate}; 'date':lockDate};
lockMsg=_('page_locked', mapping=lockMap)" lockMsg=_('page_locked', mapping=lockMap)"
src=":img('locked')" title=":lockMsg"/></a> src=":url('locked')" title=":lockMsg"/></a>
<a if="editable and locked and user.has_role('Manager')"> <a if="editable and locked and user.has_role('Manager')">
<img class="clickable" title=":_('page_unlock')" src=":img('unlock')" <img class="clickable" title=":_('page_unlock')" src=":url('unlock')"
onclick=":'onUnlockPage(%s,%s)' % \ onclick=":'onUnlockPage(%s,%s)' % \
(q(contextObj.UID()), q(aPage))"/></a> (q(contextObj.UID()), q(aPage))"/></a>
</x> </x>

View file

@ -49,8 +49,8 @@ class ToolWrapper(AbstractWrapper):
(className, searchName, loop.obj.nb+1+startNumber, totalNumber)" (className, searchName, loop.obj.nb+1+startNumber, totalNumber)"
href=":obj.getUrl(mode='edit', page=obj.getDefaultEditPage(), \ href=":obj.getUrl(mode='edit', page=obj.getDefaultEditPage(), \
nav=navInfo)"> nav=navInfo)">
<img src=":img('edit')" title=":_('object_edit')"/></a> <img src=":url('edit')" title=":_('object_edit')"/></a>
<img if="obj.mayDelete()" class="clickable" src=":img('delete')" <img if="obj.mayDelete()" class="clickable" src=":url('delete')"
title=":_('object_delete')" title=":_('object_delete')"
onClick="'onDeleteObject(%s)' % q(obj.UID())"/> onClick="'onDeleteObject(%s)' % q(obj.UID())"/>
</div> </div>
@ -206,9 +206,9 @@ class ToolWrapper(AbstractWrapper):
<!-- Include type-specific CSS and JS. --> <!-- Include type-specific CSS and JS. -->
<link for="cssFile in cssJs['css']" rel="stylesheet" type="text/css" <link for="cssFile in cssJs['css']" rel="stylesheet" type="text/css"
href=":'%s/ui/%s' % (appUrl, cssFile)"/> href=":url(cssFile)"/>
<script for="jsFile in cssJs['js']" type="text/javascript" <script for="jsFile in cssJs['js']" type="text/javascript"
src=":'%s/ui/%s' % (appUrl, jsFile)"></script> src=":url(jsFile)"></script>
<!-- Search title --> <!-- Search title -->
<h1><x>:_('%s_plural'%className)</x> &ndash; <h1><x>:_('%s_plural'%className)</x> &ndash;
@ -238,7 +238,7 @@ class ToolWrapper(AbstractWrapper):
<!-- Submit button --> <!-- Submit button -->
<p align=":dright"><br/> <p align=":dright"><br/>
<input type="submit" class="button" value=":_('search_button')" <input type="submit" class="button" value=":_('search_button')"
style=":img('buttonSearch', bg=True)"/> style=":url('buttonSearch', bg=True)"/>
</p> </p>
</form> </form>
</x>''', template=AbstractWrapper.pxTemplate, hook='content') </x>''', template=AbstractWrapper.pxTemplate, hook='content')
@ -305,13 +305,13 @@ class ToolWrapper(AbstractWrapper):
<table class="list" width="100%"> <table class="list" width="100%">
<tr> <tr>
<th for="columnHeader in importElems[0]"> <th for="columnHeader in importElems[0]">
<img if="loop.columnHeader.nb == 0" src=":img('eye')" <img if="loop.columnHeader.nb == 0" src=":url('eye')"
title="_('import_show_hide')" class="clickable" title="_('import_show_hide')" class="clickable"
onClick="toggleViewableElements()" align=":dleft" /> onClick="toggleViewableElements()" align=":dleft" />
<x>:columnHeader</x> <x>:columnHeader</x>
</th> </th>
<th></th> <th></th>
<th width="20px"><img src=":img('select_elems')" class="clickable" <th width="20px"><img src=":url('select_elems')" class="clickable"
title=":_('select_delesect')" onClick="toggleCheckboxes()"/></th> title=":_('select_delesect')" onClick="toggleCheckboxes()"/></th>
</tr> </tr>
<tr for="row in importElems[1]" <tr for="row in importElems[1]"

View file

@ -33,7 +33,7 @@ class AbstractWrapper(object):
# Icon for hiding/showing details below the title. # Icon for hiding/showing details below the title.
pxShowDetails = Px(''' pxShowDetails = Px('''
<img if="ztool.subTitleIsUsed(className) and (field.name == 'title')" <img if="ztool.subTitleIsUsed(className) and (field.name == 'title')"
class="clickable" src=":img('toggleDetails')" class="clickable" src=":url('toggleDetails')"
onclick="toggleSubTitles()"/>''') onclick="toggleSubTitles()"/>''')
# Displays up/down arrows in a table header column for sorting a given # Displays up/down arrows in a table header column for sorting a given
@ -43,18 +43,18 @@ class AbstractWrapper(object):
<img if="(sortKey != field.name) or (sortOrder == 'desc')" <img if="(sortKey != field.name) or (sortOrder == 'desc')"
onclick=":navBaseCall.replace('**v**', '0,%s,%s,%s' % \ onclick=":navBaseCall.replace('**v**', '0,%s,%s,%s' % \
(q(field.name), q('asc'), q(filterKey)))" (q(field.name), q('asc'), q(filterKey)))"
src=":img('sortDown.gif')" class="clickable"/> src=":url('sortDown.gif')" class="clickable"/>
<img if="(sortKey != field.name) or (sortOrder == 'asc')" <img if="(sortKey != field.name) or (sortOrder == 'asc')"
onclick=":navBaseCall.replace('**v**', '0,%s,%s,%s' % \ onclick=":navBaseCall.replace('**v**', '0,%s,%s,%s' % \
(q(field.name), q('desc'), q(filterKey)))" (q(field.name), q('desc'), q(filterKey)))"
src=":img('sortUp.gif')" class="clickable"/> src=":url('sortUp.gif')" class="clickable"/>
</x> </x>
<x if="filterable"> <x if="filterable">
<input type="text" size="7" id=":'%s_%s' % (ajaxHookId, field.name)" <input type="text" size="7" id=":'%s_%s' % (ajaxHookId, field.name)"
value=":filterKey == field.name and filterValue or ''"/> value=":filterKey == field.name and filterValue or ''"/>
<img onclick=":navBaseCall.replace('**v**', '0, %s,%s,%s' % \ <img onclick=":navBaseCall.replace('**v**', '0, %s,%s,%s' % \
(q(sortKey), q(sortOrder), q(field.name)))" (q(sortKey), q(sortOrder), q(field.name)))"
src=":img('funnel')" class="clickable"/> src=":url('funnel')" class="clickable"/>
</x></x>''') </x></x>''')
# Buttons for navigating among a list of elements: next,back,first,last... # Buttons for navigating among a list of elements: next,back,first,last...
@ -67,27 +67,27 @@ class AbstractWrapper(object):
<tr valign="middle"> <tr valign="middle">
<!-- Go to the first page --> <!-- Go to the first page -->
<td if="(startNumber != 0) and (startNumber != batchSize)"><img <td if="(startNumber != 0) and (startNumber != batchSize)"><img
class="clickable" src=":img('arrowLeftDouble')" class="clickable" src=":url('arrowLeftDouble')"
title=":_('goto_first')" title=":_('goto_first')"
onClick=":navBaseCall.replace('**v**', '0'+sortAndFilter)"/></td> onClick=":navBaseCall.replace('**v**', '0'+sortAndFilter)"/></td>
<!-- Go to the previous page --> <!-- Go to the previous page -->
<td var="sNumber=startNumber - batchSize" if="startNumber != 0"><img <td var="sNumber=startNumber - batchSize" if="startNumber != 0"><img
class="clickable" src=":img('arrowLeftSimple')" class="clickable" src=":url('arrowLeftSimple')"
title=":_('goto_previous')" title=":_('goto_previous')"
onClick="navBaseCall.replace('**v**', \ onClick="navBaseCall.replace('**v**', \
str(sNumber)+sortAndFilter)"/></td> str(sNumber)+sortAndFilter)"/></td>
<!-- Explain which elements are currently shown --> <!-- Explain which elements are currently shown -->
<td class="discreet">&nbsp; <td class="discreet">&nbsp;
<x>:startNumber + 1</x><img src=":img('to')"/> <x>:startNumber + 1</x><img src=":url('to')"/>
<x>:startNumber + len(objs)</x>&nbsp;<b>//</b> <x>:startNumber + len(objs)</x>&nbsp;<b>//</b>
<x>:totalNumber</x>&nbsp;&nbsp;</td> <x>:totalNumber</x>&nbsp;&nbsp;</td>
<!-- Go to the next page --> <!-- Go to the next page -->
<td var="sNumber=startNumber + batchSize" <td var="sNumber=startNumber + batchSize"
if="sNumber &lt; totalNumber"><img class="clickable" if="sNumber &lt; totalNumber"><img class="clickable"
src=":img('arrowRightSimple')" title=":_('goto_next')" src=":url('arrowRightSimple')" title=":_('goto_next')"
onClick=":navBaseCall.replace('**v**', \ onClick=":navBaseCall.replace('**v**', \
str(sNumber)+sortAndFilter)"/></td> str(sNumber)+sortAndFilter)"/></td>
@ -99,7 +99,7 @@ class AbstractWrapper(object):
sNumber= nbOfCountedPages * batchSize" sNumber= nbOfCountedPages * batchSize"
if="(startNumber != sNumber) and \ if="(startNumber != sNumber) and \
(startNumber != sNumber-batchSize)"><img class="clickable" (startNumber != sNumber-batchSize)"><img class="clickable"
src=":img('arrowRightDouble')" title=":_('goto_last')" src=":url('arrowRightDouble')" title=":_('goto_last')"
onClick="navBaseCall.replace('**v**', \ onClick="navBaseCall.replace('**v**', \
str(sNumber)+sortAndFilter)"/></td> str(sNumber)+sortAndFilter)"/></td>
</tr> </tr>
@ -125,15 +125,15 @@ class AbstractWrapper(object):
var="gotoSource=_('goto_source'); var="gotoSource=_('goto_source');
goBack=backText and ('%s - %s' % (backText, gotoSource)) \ goBack=backText and ('%s - %s' % (backText, gotoSource)) \
or gotoSource" or gotoSource"
src=":img('gotoSource')" title=":goBack"/></a> src=":url('gotoSource')" title=":goBack"/></a>
<!-- Go to the first page --> <!-- Go to the first page -->
<a if="firstUrl" href=":firstUrl"><img title=":_('goto_first')" <a if="firstUrl" href=":firstUrl"><img title=":_('goto_first')"
src=":img('arrowLeftDouble')"/></a> src=":url('arrowLeftDouble')"/></a>
<!-- Go to the previous page --> <!-- Go to the previous page -->
<a if="previousUrl" href=":previousUrl"><img title=":_('goto_previous')" <a if="previousUrl" href=":previousUrl"><img title=":_('goto_previous')"
src=":img('arrowLeftSimple')"/></a> src=":url('arrowLeftSimple')"/></a>
<!-- Explain which element is currently shown --> <!-- Explain which element is currently shown -->
<span class="discreet">&nbsp; <span class="discreet">&nbsp;
@ -143,11 +143,11 @@ class AbstractWrapper(object):
<!-- Go to the next page --> <!-- Go to the next page -->
<a if="nextUrl" href=":nextUrl"><img title=":_('goto_next')" <a if="nextUrl" href=":nextUrl"><img title=":_('goto_next')"
src=":img('arrowRightSimple')"/></a> src=":url('arrowRightSimple')"/></a>
<!-- Go to the last page --> <!-- Go to the last page -->
<a if="lastUrl" href=":lastUrl"><img title=":_('goto_last')" <a if="lastUrl" href=":lastUrl"><img title=":_('goto_last')"
src=":img('arrowRightDouble')"/></a> src=":url('arrowRightDouble')"/></a>
</div>''') </div>''')
pxNavigationStrip = Px(''' pxNavigationStrip = Px('''
@ -156,7 +156,7 @@ class AbstractWrapper(object):
<!-- Breadcrumb --> <!-- Breadcrumb -->
<td var="breadcrumb=contextObj.getBreadCrumb()" class="breadcrumb"> <td var="breadcrumb=contextObj.getBreadCrumb()" class="breadcrumb">
<x for="bc in breadcrumb" var2="nb=loop.bc.nb"> <x for="bc in breadcrumb" var2="nb=loop.bc.nb">
<img if="nb != 0" src=":img('to')"/> <img if="nb != 0" src=":url('to')"/>
<!-- Display only the title of the current object --> <!-- Display only the title of the current object -->
<span if="nb == len(breadcrumb)-1">:bc['title']</span> <span if="nb == len(breadcrumb)-1">:bc['title']</span>
<!-- Display a link for parent objects --> <!-- Display a link for parent objects -->
@ -176,9 +176,9 @@ class AbstractWrapper(object):
<!-- Include type-specific CSS and JS. --> <!-- Include type-specific CSS and JS. -->
<x if="cssJs"> <x if="cssJs">
<link for="cssFile in cssJs['css']" rel="stylesheet" type="text/css" <link for="cssFile in cssJs['css']" rel="stylesheet" type="text/css"
href=":'%s/ui/%s' % (appUrl, cssFile)"/> href=":url(cssFile)"/>
<script for="jsFile in cssJs['js']" type="text/javascript" <script for="jsFile in cssJs['js']" type="text/javascript"
src=":'%s/ui/%s' % (appUrl, jsFile)"></script></x> src=":url(jsFile)"></script></x>
<!-- Javascript messages --> <!-- Javascript messages -->
<script type="text/javascript">:ztool.getJavascriptMessages()</script> <script type="text/javascript">:ztool.getJavascriptMessages()</script>
@ -268,7 +268,7 @@ class AbstractWrapper(object):
<!-- Create a new object from a web form --> <!-- Create a new object from a web form -->
<input type="button" class="button" <input type="button" class="button"
if="userMayAdd and ('form' in createMeans)" if="userMayAdd and ('form' in createMeans)"
style=":img('buttonAdd', bg=True)" value=":_('query_create')" style=":url('buttonAdd', bg=True)" value=":_('query_create')"
onclick=":'window.location=%s' % \ onclick=":'window.location=%s' % \
q('%s/do?action=Create&amp;className=%s' % \ q('%s/do?action=Create&amp;className=%s' % \
(toolUrl, rootClass))"/> (toolUrl, rootClass))"/>
@ -276,7 +276,7 @@ class AbstractWrapper(object):
<!-- Create object(s) by importing data --> <!-- Create object(s) by importing data -->
<input type="button" class="button" <input type="button" class="button"
if="userMayAdd and ('import' in createMeans)" if="userMayAdd and ('import' in createMeans)"
style=":img('buttonImport', bg=True)" value=":_('query_import')" style=":url('buttonImport', bg=True)" value=":_('query_import')"
onclick=":'window.location=%s' % \ onclick=":'window.location=%s' % \
q('%s/ui/import?className=%s' % (toolUrl, rootClass))"/> q('%s/ui/import?className=%s' % (toolUrl, rootClass))"/>
</x> </x>
@ -285,7 +285,7 @@ class AbstractWrapper(object):
<x if="ztool.advancedSearchEnabledFor(rootClass)"> <x if="ztool.advancedSearchEnabledFor(rootClass)">
<!-- Live search --> <!-- Live search -->
<form action=":'%s/config/do' % appUrl"> <form action=":'%s/do' % toolUrl">
<input type="hidden" name="action" value="SearchObjects"/> <input type="hidden" name="action" value="SearchObjects"/>
<input type="hidden" name="className" value=":rootClass"/> <input type="hidden" name="className" value=":rootClass"/>
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
@ -293,7 +293,7 @@ class AbstractWrapper(object):
<td><input type="text" size="14" name="w_SearchableText" <td><input type="text" size="14" name="w_SearchableText"
class="inputSearch"/></td> class="inputSearch"/></td>
<td> <td>
<input type="image" class="clickable" src=":img('search.gif')" <input type="image" class="clickable" src=":url('search.gif')"
title=":_('search_button')"/></td> title=":_('search_button')"/></td>
</tr> </tr>
</table> </table>
@ -324,7 +324,7 @@ class AbstractWrapper(object):
pxMessage = Px(''' pxMessage = Px('''
<div var="messages=ztool.consumeMessages()" if="messages" class="message"> <div var="messages=ztool.consumeMessages()" if="messages" class="message">
<!-- The icon for closing the message --> <!-- The icon for closing the message -->
<img src=":img('close')" align=":dright" class="clickable" <img src=":url('close')" align=":dright" class="clickable"
onclick="this.parentNode.style.display='none'"/> onclick="this.parentNode.style.display='none'"/>
<!-- The message content --> <!-- The message content -->
<x>::messages</x> <x>::messages</x>
@ -350,11 +350,10 @@ class AbstractWrapper(object):
pxTemplate = Px(''' pxTemplate = Px('''
<html var="tool=self.tool; ztool=tool.o; user=tool.user; <html var="tool=self.tool; ztool=tool.o; user=tool.user;
isAnon=ztool.userIsAnon(); app=ztool.getApp(); isAnon=ztool.userIsAnon(); app=ztool.getApp();
appUrl=app.absolute_url(); appFolder=app.data; appFolder=app.data; url = ztool.getIncludeUrl;
appName=ztool.getAppName(); _=ztool.translate; appName=ztool.getAppName(); _=ztool.translate;
req=ztool.REQUEST; resp=req.RESPONSE; req=ztool.REQUEST; resp=req.RESPONSE;
lang=ztool.getUserLanguage(); q=ztool.quote; lang=ztool.getUserLanguage(); q=ztool.quote;
img = ztool.getImageUrl;
layoutType=ztool.getLayoutType(); layoutType=ztool.getLayoutType();
contextObj=ztool.getPublishedObject(layoutType) or \ contextObj=ztool.getPublishedObject(layoutType) or \
ztool.getHomeObject(); ztool.getHomeObject();
@ -373,10 +372,9 @@ class AbstractWrapper(object):
<x for="name in ztool.getGlobalCssJs()"> <x for="name in ztool.getGlobalCssJs()">
<link if="name.endswith('.css') and \ <link if="name.endswith('.css') and \
not ((dir == 'ltr') and (name == 'appyrtl.css'))" not ((dir == 'ltr') and (name == 'appyrtl.css'))"
rel="stylesheet" type="text/css" rel="stylesheet" type="text/css" href=":url(name)"/>
href=":'%s/ui/%s' % (appUrl, name)"/>
<script if="name.endswith('.js')" type="text/javascript" <script if="name.endswith('.js')" type="text/javascript"
src=":'%s/ui/%s' % (appUrl, name)"></script> src=":url(name)"></script>
</x> </x>
</head> </head>
<body> <body>
@ -427,13 +425,13 @@ class AbstractWrapper(object):
<tr class="top"> <tr class="top">
<!-- Top banner --> <!-- Top banner -->
<td var="bannerName=(dir == 'ltr') and 'banner' or 'bannerrtl'" <td var="bannerName=(dir == 'ltr') and 'banner' or 'bannerrtl'"
style=":img('%s.jpg' % bannerName, bg=True)"> style=":url('%s.jpg' % bannerName, bg=True)">
<!-- Top links --> <!-- Top links -->
<div style="margin-top: 4px" align=":dright"> <div style="margin-top: 4px" align=":dright">
<!-- Icon "home" --> <!-- Icon "home" -->
<a class="pageLink" href=":appUrl" title=": _('app_home')"> <a class="pageLink" href="/" title=": _('app_home')">
<img src=":img('home.gif')" style="margin-right: 3px"/> <img src=":url('home.gif')" style="margin-right: 3px"/>
</a> </a>
<!-- Additional links --> <!-- Additional links -->
@ -508,18 +506,18 @@ class AbstractWrapper(object):
<!-- Config --> <!-- Config -->
<a if="user.has_role('Manager')" href=":tool.url" <a if="user.has_role('Manager')" href=":tool.url"
title=":_('%sTool' % appName)"> title=":_('%sTool' % appName)">
<img src=":img('appyConfig.gif')"/></a> <img src=":url('appyConfig.gif')"/></a>
<!-- Additional icons --> <!-- Additional icons -->
<x>:self.pxIcons</x> <x>:self.pxIcons</x>
<!-- Log out --> <!-- Log out -->
<a href=":tool.url + '/performLogout'" title=":_('app_logout')"> <a href=":tool.url + '/performLogout'" title=":_('app_logout')">
<img src=":img('logout.gif')"/></a> <img src=":url('logout.gif')"/></a>
</td> </td>
<td class="userStripText" var="userInfo=ztool.getUserLine()" <td class="userStripText" var="userInfo=ztool.getUserLine()"
align=":dright"> align=":dright">
<span>:userInfo[0]</span> <span>:userInfo[0]</span>
<a if="userInfo[1]" <a if="userInfo[1]"
href=":userInfo[1]"><img src=":img('edit')"/></a> href=":userInfo[1]"><img src=":url('edit')"/></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -588,7 +586,7 @@ class AbstractWrapper(object):
<td if="isDataChange"> <td if="isDataChange">
<x>:_('data_change')</x> <x>:_('data_change')</x>
<img if="user.has_role('Manager')" class="clickable" <img if="user.has_role('Manager')" class="clickable"
src=":img('delete')" src=":url('delete')"
onclick=":'onDeleteEvent(%s,%s)' % \ onclick=":'onDeleteEvent(%s,%s)' % \
(q(contextObj.UID()), q(event['time']))"/> (q(contextObj.UID()), q(event['time']))"/>
</td> </td>
@ -637,7 +635,7 @@ class AbstractWrapper(object):
<td align=":dright" for="transition in transitions"> <td align=":dright" for="transition in transitions">
<!-- Real button --> <!-- Real button -->
<input type="button" class="button" if="transition['may_trigger']" <input type="button" class="button" if="transition['may_trigger']"
style=":img('buttonTransition', bg=True)" style=":url('buttonTransition', bg=True)"
title=":transition['title']" title=":transition['title']"
value=":ztool.truncateValue(transition['title'])" value=":ztool.truncateValue(transition['title'])"
onclick=":'triggerTransition(%s,%s,%s)' % (q(formId), \ onclick=":'triggerTransition(%s,%s,%s)' % (q(formId), \
@ -645,7 +643,7 @@ class AbstractWrapper(object):
<!-- Fake button, explaining why the transition can't be triggered --> <!-- Fake button, explaining why the transition can't be triggered -->
<input type="button" class="button" if="not transition['may_trigger']" <input type="button" class="button" if="not transition['may_trigger']"
style=":img('buttonFake', bg=True) + ';cursor: help'" style=":url('buttonFake', bg=True) + ';cursor: help'"
value=":ztool.truncateValue(transition['title'])" value=":ztool.truncateValue(transition['title'])"
title=":'%s: %s' % (transition['title'], \ title=":'%s: %s' % (transition['title'], \
transition['reason'])"/> transition['reason'])"/>
@ -668,7 +666,7 @@ class AbstractWrapper(object):
<!-- Plus/minus icon for accessing history --> <!-- Plus/minus icon for accessing history -->
<x if="hasHistory"> <x if="hasHistory">
<img class="clickable" onclick="toggleCookie('appyHistory')" <img class="clickable" onclick="toggleCookie('appyHistory')"
src="historyExpanded and img('collapse.gif') or img('expand.gif')" src="historyExpanded and url('collapse.gif') or url('expand.gif')"
align=":dleft" id="appyHistory_img"/> align=":dleft" id="appyHistory_img"/>
<x>:_('object_history')</x> || <x>:_('object_history')</x> ||
</x> </x>
@ -725,13 +723,13 @@ class AbstractWrapper(object):
<x if="isEdit"> <x if="isEdit">
<input type="button" class="button" value=":_('page_previous')" <input type="button" class="button" value=":_('page_previous')"
onClick="submitAppyForm('previous')" onClick="submitAppyForm('previous')"
style=":img('buttonPrevious', bg=True)"/> style=":url('buttonPrevious', 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" <input if="not isEdit" type="button" class="button"
value=":_('page_previous')" value=":_('page_previous')"
style=":img('buttonPrevious', bg=True)" style=":url('buttonPrevious', bg=True)"
onclick=":'window.location=%s' % \ onclick=":'window.location=%s' % \
q(contextObj.getUrl(page=previousPage))"/> q(contextObj.getUrl(page=previousPage))"/>
</td> </td>
@ -739,13 +737,13 @@ class AbstractWrapper(object):
<!-- Save --> <!-- Save -->
<td if="isEdit and pageInfo['showSave']"> <td if="isEdit and pageInfo['showSave']">
<input type="button" class="button" onClick="submitAppyForm('save')" <input type="button" class="button" onClick="submitAppyForm('save')"
style=":img(buttonSave', bg=True)" value=":_('object_save')"/> style=":url(buttonSave', bg=True)" value=":_('object_save')"/>
</td> </td>
<!-- Cancel --> <!-- Cancel -->
<td if="isEdit and pageInfo['showCancel']"> <td if="isEdit and pageInfo['showCancel']">
<input type="button" class="button" onClick="submitAppyForm('cancel')" <input type="button" class="button" onClick="submitAppyForm('cancel')"
style=":img('buttonCancel', bg=True)" value=":_('object_cancel')"/> style=":url('buttonCancel', bg=True)" value=":_('object_cancel')"/>
</td> </td>
<td if="not isEdit" <td if="not isEdit"
@ -754,7 +752,7 @@ class AbstractWrapper(object):
<!-- Edit --> <!-- Edit -->
<input type="button" class="button" if="editable and not locked" <input type="button" class="button" if="editable and not locked"
style=":img('buttonEdit', bg=True)" value=":_('object_edit')" style=":url('buttonEdit', bg=True)" value=":_('object_edit')"
onclick=":'window.location=%s' % \ onclick=":'window.location=%s' % \
q(contextObj.getUrl(mode='edit', page=page))"/> q(contextObj.getUrl(mode='edit', page=page))"/>
@ -764,7 +762,7 @@ class AbstractWrapper(object):
var="lockDate=tool.formatDate(locked[1]); var="lockDate=tool.formatDate(locked[1]);
lockMap={'user':tool.getUserName(locked[0]),'date':lockDate}; lockMap={'user':tool.getUserName(locked[0]),'date':lockDate};
lockMsg=_('page_locked', mapping=lockMap)" lockMsg=_('page_locked', mapping=lockMap)"
src=":img('lockedBig')" title=":lockMsg"/></a> src=":url('lockedBig')" title=":lockMsg"/></a>
</td> </td>
<!-- Next --> <!-- Next -->
@ -772,12 +770,12 @@ class AbstractWrapper(object):
<!-- 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="button" onClick="submitAppyForm('next')"
style=":img('buttonNext', bg=True)" value=":_('page_next')"/> style=":url('buttonNext', bg=True)" value=":_('page_next')"/>
<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" <input if="not isEdit" type="button" class="button"
style=":img('buttonNext', bg=True)" value=":_('page_next')" style=":url('buttonNext', bg=True)" value=":_('page_next')"
onclick=":'window.location=%s' % \ onclick=":'window.location=%s' % \
q(contextObj.getUrl(page=nextPage))"/> q(contextObj.getUrl(page=nextPage))"/>
</td> </td>
@ -789,7 +787,7 @@ class AbstractWrapper(object):
<!-- Refresh --> <!-- Refresh -->
<td if="contextObj.isDebug()"> <td if="contextObj.isDebug()">
<a href="contextObj.getUrl(mode=layoutType, page=page, refresh='yes')"> <a href="contextObj.getUrl(mode=layoutType, page=page, refresh='yes')">
<img title="Refresh" style="vertical-align:top" src=":img('refresh')"/> <img title="Refresh" style="vertical-align:top" src=":url('refresh')"/>
</a> </a>
</td> </td>
</tr> </tr>