[gen] Removed obsolete function to create objects via an import form.
This commit is contained in:
parent
b98da33d47
commit
f629f2b323
|
@ -40,43 +40,17 @@ from appy.fields.workflow import *
|
|||
from appy.gen.layout import Table
|
||||
from appy.gen.utils import No
|
||||
|
||||
# Make the following classes available here: people may need to monkey-patch
|
||||
# some PXs on thoses classes.
|
||||
# Make the following classes available here: people may need to override some
|
||||
# of their PXs (defined as static attributes).
|
||||
from appy.gen.wrappers import AbstractWrapper as BaseObject
|
||||
from appy.gen.wrappers.ToolWrapper import ToolWrapper as BaseTool
|
||||
|
||||
class Import:
|
||||
'''Used for describing the place where to find the data to use for creating
|
||||
an object.'''
|
||||
def __init__(self, path, onElement=None, headers=(), sort=None):
|
||||
self.id = 'import'
|
||||
self.path = path
|
||||
# p_onElement hereafter must be a function (or a static method) that
|
||||
# will be called every time an element to import is found. It takes a
|
||||
# single arg that is the absolute filen name of the file to import,
|
||||
# within p_path. It must return a list of info about the element, or
|
||||
# None if the element must be ignored. The list will be used to display
|
||||
# information about the element in a tabular form.
|
||||
self.onElement = onElement
|
||||
# The following attribute must contain the names of the column headers
|
||||
# of the table that will display elements to import (retrieved from
|
||||
# calls to self.onElement). Every not-None element retrieved from
|
||||
# self.onElement must have the same length as self.headers.
|
||||
self.headers = headers
|
||||
# The following attribute must store a function or static method that
|
||||
# will be used to sort elements to import. It will be called with a
|
||||
# single param containing the list of all not-None elements as retrieved
|
||||
# by calls to self.onElement (but with one additional first element in
|
||||
# every list, which is the absolute file name of the element to import)
|
||||
# and must return a similar, sorted, list.
|
||||
self.sort = sort
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
class Model: pass
|
||||
class Tool(Model):
|
||||
'''If you want to extend or modify the Tool class, subclass me.'''
|
||||
'''Subclass me to extend or modify the Tool class.'''
|
||||
class User(Model):
|
||||
'''If you want to extend or modify the User class, subclass me.'''
|
||||
'''Subclass me to extend or modify the User class.'''
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
class LdapConfig:
|
||||
|
|
|
@ -260,28 +260,6 @@ class ToolMixin(BaseMixin):
|
|||
klass = self.getAppyClass(className)
|
||||
return getattr(klass, 'resultMode', 'list')
|
||||
|
||||
def getImportElements(self, className):
|
||||
'''Returns the list of elements that can be imported from p_path for
|
||||
p_className.'''
|
||||
appyClass = self.getAppyClass(className)
|
||||
importParams = self.getCreateMeans(appyClass)['import']
|
||||
onElement = importParams.onElement.__get__('')
|
||||
sortMethod = importParams.sort
|
||||
if sortMethod: sortMethod = sortMethod.__get__('')
|
||||
elems = []
|
||||
importType = self.getAppyType('importPathFor%s' % className)
|
||||
importPath = importType.getValue(self)
|
||||
for elem in os.listdir(importPath):
|
||||
elemFullPath = os.path.join(importPath, elem)
|
||||
elemInfo = onElement(elemFullPath)
|
||||
if elemInfo:
|
||||
elemInfo.insert(0, elemFullPath) # To the result, I add the full
|
||||
# path of the elem, which will not be shown.
|
||||
elems.append(elemInfo)
|
||||
if sortMethod:
|
||||
elems = sortMethod(elems)
|
||||
return [importParams.headers, elems]
|
||||
|
||||
def showPortlet(self, obj, layoutType):
|
||||
'''When must the portlet be shown? p_obj and p_layoutType can be None
|
||||
if we are not browing any objet (ie, we are on the home page).'''
|
||||
|
@ -484,26 +462,16 @@ class ToolMixin(BaseMixin):
|
|||
return self.getProductConfig().allClassNames + [self.__class__.__name__]
|
||||
|
||||
def getCreateMeans(self, klass):
|
||||
'''Gets the different ways objects of p_klass can be created (via a web
|
||||
form, by importing external data, etc). Result is a dict whose keys
|
||||
are strings (ie "form", "import"...) and whose values are additional
|
||||
data about the particular mean.'''
|
||||
res = {}
|
||||
'''Gets the different ways objects of p_klass can be created (currently:
|
||||
via a web form or programmatically only). Result is a list.'''
|
||||
res = []
|
||||
if not klass.__dict__.has_key('create'):
|
||||
res['form'] = None
|
||||
# No additional data for this means, which is the default one.
|
||||
return ['form']
|
||||
else:
|
||||
means = pythonClass.create
|
||||
if means:
|
||||
if isinstance(means, basestring): res[means] = None
|
||||
elif isinstance(means, list) or isinstance(means, tuple):
|
||||
for mean in means:
|
||||
if isinstance(mean, basestring):
|
||||
res[mean] = None
|
||||
else:
|
||||
res[mean.id] = mean
|
||||
else:
|
||||
res[means.id] = means
|
||||
if isinstance(means, basestring): res = [means]
|
||||
else: res = means
|
||||
return res
|
||||
|
||||
def userMaySearch(self, klass):
|
||||
|
@ -541,28 +509,6 @@ class ToolMixin(BaseMixin):
|
|||
if role in creators:
|
||||
return True
|
||||
|
||||
def onImportObjects(self):
|
||||
'''This method is called when the user wants to create objects from
|
||||
external data.'''
|
||||
rq = self.REQUEST
|
||||
appyClass = self.getAppyClass(rq.get('className'))
|
||||
importPaths = rq.get('importPath').split('|')
|
||||
appFolder = self.getPath('/data')
|
||||
for importPath in importPaths:
|
||||
if not importPath: continue
|
||||
objectId = os.path.basename(importPath)
|
||||
self.appy().create(appyClass, id=objectId, _data=importPath)
|
||||
self.say(self.translate('import_done'))
|
||||
return self.goto(rq['HTTP_REFERER'])
|
||||
|
||||
def isAlreadyImported(self, contentType, importPath):
|
||||
data = self.getPath('/data')
|
||||
objectId = os.path.basename(importPath)
|
||||
if hasattr(data.aq_base, objectId):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def isSortable(self, name, className, usage):
|
||||
'''Is field p_name defined on p_className sortable for p_usage purposes
|
||||
(p_usage can be "ref" or "search")?'''
|
||||
|
|
|
@ -103,10 +103,6 @@ msgstr ""
|
|||
msgid "query_create"
|
||||
msgstr ""
|
||||
|
||||
#. Default: "import"
|
||||
msgid "query_import"
|
||||
msgstr ""
|
||||
|
||||
#. Default: "Nothing to see for the moment."
|
||||
msgid "query_no_result"
|
||||
msgstr ""
|
||||
|
@ -115,26 +111,6 @@ msgstr ""
|
|||
msgid "query_consult_all"
|
||||
msgstr ""
|
||||
|
||||
#. Default: "Importing data into your application"
|
||||
msgid "import_title"
|
||||
msgstr ""
|
||||
|
||||
#. Default: "Show / hide alreadly imported elements."
|
||||
msgid "import_show_hide"
|
||||
msgstr ""
|
||||
|
||||
#. Default: "Already imported."
|
||||
msgid "import_already"
|
||||
msgstr ""
|
||||
|
||||
#. Default: "Import selected elements"
|
||||
msgid "import_many"
|
||||
msgstr ""
|
||||
|
||||
#. Default: "Import terminated successfully."
|
||||
msgid "import_done"
|
||||
msgstr ""
|
||||
|
||||
#. Default: "Advanced search"
|
||||
msgid "search_title"
|
||||
msgstr ""
|
||||
|
|
24
gen/tr/ar.po
24
gen/tr/ar.po
|
@ -103,10 +103,6 @@ msgstr ""
|
|||
msgid "query_create"
|
||||
msgstr ""
|
||||
|
||||
#. Default: "import"
|
||||
msgid "query_import"
|
||||
msgstr ""
|
||||
|
||||
#. Default: "Nothing to see for the moment."
|
||||
msgid "query_no_result"
|
||||
msgstr ""
|
||||
|
@ -115,26 +111,6 @@ msgstr ""
|
|||
msgid "query_consult_all"
|
||||
msgstr ""
|
||||
|
||||
#. Default: "Importing data into your application"
|
||||
msgid "import_title"
|
||||
msgstr ""
|
||||
|
||||
#. Default: "Show / hide alreadly imported elements."
|
||||
msgid "import_show_hide"
|
||||
msgstr ""
|
||||
|
||||
#. Default: "Already imported."
|
||||
msgid "import_already"
|
||||
msgstr ""
|
||||
|
||||
#. Default: "Import selected elements"
|
||||
msgid "import_many"
|
||||
msgstr ""
|
||||
|
||||
#. Default: "Import terminated successfully."
|
||||
msgid "import_done"
|
||||
msgstr ""
|
||||
|
||||
#. Default: "Advanced search"
|
||||
msgid "search_title"
|
||||
msgstr ""
|
||||
|
|
24
gen/tr/de.po
24
gen/tr/de.po
|
@ -103,10 +103,6 @@ msgstr "Nach unten verschieben"
|
|||
msgid "query_create"
|
||||
msgstr "Anfertigen"
|
||||
|
||||
#. Default: "import"
|
||||
msgid "query_import"
|
||||
msgstr "Importieren"
|
||||
|
||||
#. Default: "Nothing to see for the moment."
|
||||
msgid "query_no_result"
|
||||
msgstr "Kein Resultat"
|
||||
|
@ -115,26 +111,6 @@ msgstr "Kein Resultat"
|
|||
msgid "query_consult_all"
|
||||
msgstr "Alles untersuchen"
|
||||
|
||||
#. Default: "Importing data into your application"
|
||||
msgid "import_title"
|
||||
msgstr "Angaben importieren"
|
||||
|
||||
#. Default: "Show / hide alreadly imported elements."
|
||||
msgid "import_show_hide"
|
||||
msgstr "Zeigen / verbergen von bereits importierten Elementen."
|
||||
|
||||
#. Default: "Already imported."
|
||||
msgid "import_already"
|
||||
msgstr "Bereits importiert."
|
||||
|
||||
#. Default: "Import selected elements"
|
||||
msgid "import_many"
|
||||
msgstr "Ausgewählte Elemente importieren."
|
||||
|
||||
#. Default: "Import terminated successfully."
|
||||
msgid "import_done"
|
||||
msgstr "Das Importieren ist erfolgt."
|
||||
|
||||
#. Default: "Advanced search"
|
||||
msgid "search_title"
|
||||
msgstr "Fortgeschrittene Suche"
|
||||
|
|
24
gen/tr/en.po
24
gen/tr/en.po
|
@ -104,10 +104,6 @@ msgstr "Move down"
|
|||
msgid "query_create"
|
||||
msgstr "create"
|
||||
|
||||
#. Default: "import"
|
||||
msgid "query_import"
|
||||
msgstr "import"
|
||||
|
||||
#. Default: "Nothing to see for the moment."
|
||||
msgid "query_no_result"
|
||||
msgstr "Nothing to see for the moment."
|
||||
|
@ -116,26 +112,6 @@ msgstr "Nothing to see for the moment."
|
|||
msgid "query_consult_all"
|
||||
msgstr "consult all"
|
||||
|
||||
#. Default: "Importing data into your application"
|
||||
msgid "import_title"
|
||||
msgstr "Importing data into your application"
|
||||
|
||||
#. Default: "Show / hide alreadly imported elements."
|
||||
msgid "import_show_hide"
|
||||
msgstr "Show / hide alreadly imported elements."
|
||||
|
||||
#. Default: "Already imported."
|
||||
msgid "import_already"
|
||||
msgstr "Already imported."
|
||||
|
||||
#. Default: "Import selected elements"
|
||||
msgid "import_many"
|
||||
msgstr "Import selected elements"
|
||||
|
||||
#. Default: "Import terminated successfully."
|
||||
msgid "import_done"
|
||||
msgstr "Import terminated successfully."
|
||||
|
||||
#. Default: "Advanced search"
|
||||
msgid "search_title"
|
||||
msgstr "Advanced search"
|
||||
|
|
24
gen/tr/es.po
24
gen/tr/es.po
|
@ -103,10 +103,6 @@ msgstr "Mueva hacia abajo"
|
|||
msgid "query_create"
|
||||
msgstr "Crear"
|
||||
|
||||
#. Default: "import"
|
||||
msgid "query_import"
|
||||
msgstr "Importar"
|
||||
|
||||
#. Default: "Nothing to see for the moment."
|
||||
msgid "query_no_result"
|
||||
msgstr "No hay resultados."
|
||||
|
@ -115,26 +111,6 @@ msgstr "No hay resultados."
|
|||
msgid "query_consult_all"
|
||||
msgstr "Consultar todo"
|
||||
|
||||
#. Default: "Importing data into your application"
|
||||
msgid "import_title"
|
||||
msgstr "Importar datos"
|
||||
|
||||
#. Default: "Show / hide alreadly imported elements."
|
||||
msgid "import_show_hide"
|
||||
msgstr "Mostrar / ocultar los elementos ya importados."
|
||||
|
||||
#. Default: "Already imported."
|
||||
msgid "import_already"
|
||||
msgstr "Ya importado."
|
||||
|
||||
#. Default: "Import selected elements"
|
||||
msgid "import_many"
|
||||
msgstr "Importar los elementos seleccionados."
|
||||
|
||||
#. Default: "Import terminated successfully."
|
||||
msgid "import_done"
|
||||
msgstr "La importación se ha desarrollado con éxito"
|
||||
|
||||
#. Default: "Advanced search"
|
||||
msgid "search_title"
|
||||
msgstr "Búsqueda avanzada"
|
||||
|
|
24
gen/tr/fr.po
24
gen/tr/fr.po
|
@ -104,10 +104,6 @@ msgstr "Déplacer vers le bas"
|
|||
msgid "query_create"
|
||||
msgstr "Créer"
|
||||
|
||||
#. Default: "import"
|
||||
msgid "query_import"
|
||||
msgstr "Importer"
|
||||
|
||||
#. Default: "Nothing to see for the moment."
|
||||
msgid "query_no_result"
|
||||
msgstr "Pas de résultat."
|
||||
|
@ -116,26 +112,6 @@ msgstr "Pas de résultat."
|
|||
msgid "query_consult_all"
|
||||
msgstr "Tout consulter"
|
||||
|
||||
#. Default: "Importing data into your application"
|
||||
msgid "import_title"
|
||||
msgstr "Importer des données"
|
||||
|
||||
#. Default: "Show / hide alreadly imported elements."
|
||||
msgid "import_show_hide"
|
||||
msgstr "Montrer / cacher les éléments déjà importés."
|
||||
|
||||
#. Default: "Already imported."
|
||||
msgid "import_already"
|
||||
msgstr "Déjà importé."
|
||||
|
||||
#. Default: "Import selected elements"
|
||||
msgid "import_many"
|
||||
msgstr "Importer les éléments sélectionnés."
|
||||
|
||||
#. Default: "Import terminated successfully."
|
||||
msgid "import_done"
|
||||
msgstr "L'importation s'est déroulée avec succès"
|
||||
|
||||
#. Default: "Advanced search"
|
||||
msgid "search_title"
|
||||
msgstr "Recherche avancée"
|
||||
|
|
24
gen/tr/it.po
24
gen/tr/it.po
|
@ -103,10 +103,6 @@ msgstr "Giù"
|
|||
msgid "query_create"
|
||||
msgstr "Creazione in corso"
|
||||
|
||||
#. Default: "import"
|
||||
msgid "query_import"
|
||||
msgstr "Import"
|
||||
|
||||
#. Default: "Nothing to see for the moment."
|
||||
msgid "query_no_result"
|
||||
msgstr "Nessun risultato"
|
||||
|
@ -115,26 +111,6 @@ msgstr "Nessun risultato"
|
|||
msgid "query_consult_all"
|
||||
msgstr "Consultare tutto"
|
||||
|
||||
#. Default: "Importing data into your application"
|
||||
msgid "import_title"
|
||||
msgstr "Importare i dati"
|
||||
|
||||
#. Default: "Show / hide alreadly imported elements."
|
||||
msgid "import_show_hide"
|
||||
msgstr "Evidenzia / nascondi gli elementi già importati."
|
||||
|
||||
#. Default: "Already imported."
|
||||
msgid "import_already"
|
||||
msgstr "Già importati"
|
||||
|
||||
#. Default: "Import selected elements"
|
||||
msgid "import_many"
|
||||
msgstr "Importare gli elementi selezionati."
|
||||
|
||||
#. Default: "Import terminated successfully."
|
||||
msgid "import_done"
|
||||
msgstr "Import è terminato con successo"
|
||||
|
||||
#. Default: "Advanced search"
|
||||
msgid "search_title"
|
||||
msgstr "Ricerca avanzata"
|
||||
|
|
24
gen/tr/nl.po
24
gen/tr/nl.po
|
@ -103,10 +103,6 @@ msgstr "Verplaats naar beneden"
|
|||
msgid "query_create"
|
||||
msgstr "Aanmaken"
|
||||
|
||||
#. Default: "import"
|
||||
msgid "query_import"
|
||||
msgstr "Importeren"
|
||||
|
||||
#. Default: "Nothing to see for the moment."
|
||||
msgid "query_no_result"
|
||||
msgstr "Geen resultaat"
|
||||
|
@ -115,26 +111,6 @@ msgstr "Geen resultaat"
|
|||
msgid "query_consult_all"
|
||||
msgstr "Alles raadplegen"
|
||||
|
||||
#. Default: "Importing data into your application"
|
||||
msgid "import_title"
|
||||
msgstr "Gegevens importeren"
|
||||
|
||||
#. Default: "Show / hide alreadly imported elements."
|
||||
msgid "import_show_hide"
|
||||
msgstr "Tonen / verbergen van reeds geïmporteerde elementen."
|
||||
|
||||
#. Default: "Already imported."
|
||||
msgid "import_already"
|
||||
msgstr "Reeds geïmporteerd."
|
||||
|
||||
#. Default: "Import selected elements"
|
||||
msgid "import_many"
|
||||
msgstr "Geselecteerde elementen importeren."
|
||||
|
||||
#. Default: "Import terminated successfully."
|
||||
msgid "import_done"
|
||||
msgstr "Het importeren is met succes afgelopen."
|
||||
|
||||
#. Default: "Advanced search"
|
||||
msgid "search_title"
|
||||
msgstr "Gevorderde opzoeking"
|
||||
|
|
|
@ -238,11 +238,6 @@ function askRefField(hookId, objectUrl, fieldName, innerRef, startNumber,
|
|||
askAjaxChunk(hookId, 'GET', objectUrl, fieldName+':pxView', params);
|
||||
}
|
||||
|
||||
function askComputedField(hookId, objectUrl, fieldName) {
|
||||
// Sends an Ajax request for getting the content of a computed field
|
||||
askAjaxChunk(hookId, 'GET', objectUrl, fieldName+':pxViewContent');
|
||||
}
|
||||
|
||||
function askField(hookId, objectUrl, layoutType, showChanges, masterValues,
|
||||
requestValue, error, className){
|
||||
// Sends an Ajax request for getting the content of any field.
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 766 B |
BIN
gen/ui/eye.png
BIN
gen/ui/eye.png
Binary file not shown.
Before Width: | Height: | Size: 372 B |
Binary file not shown.
Before Width: | Height: | Size: 235 B |
|
@ -187,7 +187,6 @@ class ToolWrapper(AbstractWrapper):
|
|||
<!-- Actions -->
|
||||
<x var="mayCreate=ztool.userMayCreate(rootClass);
|
||||
createMeans=ztool.getCreateMeans(rootClass)">
|
||||
|
||||
<!-- Create a new object from a web form. -->
|
||||
<input type="button" class="button"
|
||||
if="mayCreate and ('form' in createMeans)"
|
||||
|
@ -195,15 +194,7 @@ class ToolWrapper(AbstractWrapper):
|
|||
onclick=":'goto(%s)' % \
|
||||
q('%s/do?action=Create&className=%s' % \
|
||||
(toolUrl, className))"/>
|
||||
|
||||
<!-- Create object(s) by importing data -->
|
||||
<input type="button" class="button"
|
||||
if="mayCreate and ('import' in createMeans)"
|
||||
style=":url('buttonImport', bg=True)" value=":_('query_import')"
|
||||
onclick=":'goto(%s)' % \
|
||||
q('%s/import?className=%s' % (toolUrl, className))"/>
|
||||
</x>
|
||||
|
||||
<!-- Searches -->
|
||||
<x if="ztool.advancedSearchEnabledFor(rootClass)">
|
||||
|
||||
|
@ -534,109 +525,6 @@ class ToolWrapper(AbstractWrapper):
|
|||
</form>
|
||||
</x>''', template=AbstractWrapper.pxTemplate, hook='content')
|
||||
|
||||
pxImport = Px('''
|
||||
<x var="className=req['className'];
|
||||
importElems=ztool.getImportElements(className);
|
||||
allAreImported=True">
|
||||
<x>:tool.pxPagePrologue</x>
|
||||
<script type="text/javascript"><![CDATA[
|
||||
var importedElemsShown = false;
|
||||
function toggleViewableElements() {
|
||||
var rows = document.getElementsByName('importedElem');
|
||||
var newDisplay = 'table-row';
|
||||
if (isIe) newDisplay = 'block';
|
||||
if (importedElemsShown) newDisplay = 'none';
|
||||
for (var i=0; i<rows.length; i++) {
|
||||
rows[i].style.display = newDisplay;
|
||||
}
|
||||
importedElemsShown = !importedElemsShown;
|
||||
}
|
||||
var checkBoxesChecked = true;
|
||||
function toggleCheckboxes() {
|
||||
var checkBoxes = document.getElementsByName('cbElem');
|
||||
var newCheckValue = true;
|
||||
if (checkBoxesChecked) newCheckValue = false;
|
||||
for (var i=0; i<checkBoxes.length; i++) {
|
||||
checkBoxes[i].checked = newCheckValue;
|
||||
}
|
||||
checkBoxesChecked = newCheckValue;
|
||||
}
|
||||
function importSingleElement(importPath) {
|
||||
var f = document.forms['importElements'];
|
||||
f.importPath.value = importPath;
|
||||
f.submit();
|
||||
}
|
||||
function importManyElements() {
|
||||
var f = document.forms['importElements'];
|
||||
var importPaths = '';
|
||||
// Get the values of the checkboxes
|
||||
var checkBoxes = document.getElementsByName('cbElem');
|
||||
for (var i=0; i<checkBoxes.length; i++) {
|
||||
if (checkBoxes[i].checked) {
|
||||
importPaths += checkBoxes[i].value + '|';
|
||||
}
|
||||
}
|
||||
if (! importPaths) alert(no_elem_selected);
|
||||
else {
|
||||
f.importPath.value = importPaths;
|
||||
f.submit();
|
||||
}
|
||||
}]]>
|
||||
</script>
|
||||
|
||||
<!-- Form for importing several elements at once. -->
|
||||
<form name="importElements"
|
||||
action=":ztool.absolute_url()+'/do'" method="post">
|
||||
<input type="hidden" name="action" value="ImportObjects"/>
|
||||
<input type="hidden" name="className" value=":className"/>
|
||||
<input type="hidden" name="importPath" value=""/>
|
||||
</form>
|
||||
|
||||
<h1>:_('import_title')</h1><br/>
|
||||
<table class="list" width="100%">
|
||||
<tr>
|
||||
<th for="columnHeader in importElems[0]">
|
||||
<img if="loop.columnHeader.nb == 0" src=":url('eye')"
|
||||
title="_('import_show_hide')" class="clickable"
|
||||
onClick="toggleViewableElements()" align=":dleft" />
|
||||
<x>:columnHeader</x>
|
||||
</th>
|
||||
<th></th>
|
||||
<th width="20px"><img src=":url('select_elems')" class="clickable"
|
||||
title=":_('select_delesect')" onClick="toggleCheckboxes()"/></th>
|
||||
</tr>
|
||||
<tr for="row in importElems[1]"
|
||||
var2="alreadyImported=ztool.isAlreadyImported(className, row[0]);
|
||||
allAreImported=allAreImported and alreadyImported;
|
||||
odd=loop.row.odd"
|
||||
id=":alreadyImported and 'importedElem' or 'notImportedElem'"
|
||||
name=":alreadyImported and 'importedElem' or 'notImportedElem'"
|
||||
style=":alreadyImported and 'display:none' or 'display:table-row'"
|
||||
class=":odd and 'even' or 'odd'">
|
||||
<td for="elem in row[1:]">:elem</td>
|
||||
<td>
|
||||
<input type="button" if="not alreadyImported"
|
||||
onClick=":'importSingleElement(%s)' % q(row[0])"
|
||||
value=":_('query_import')"/>
|
||||
<x if="alreadyImported">:_('import_already')</x>
|
||||
</td>
|
||||
<td align="center">
|
||||
<input if="not alreadyImported" type="checkbox" checked="checked"
|
||||
id="cbElem" name="cbElem" value="row[0]"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr if="not importElems[1] or allAreImported">
|
||||
<td colspan="15">:_('query_no_result')</td></tr>
|
||||
</table>
|
||||
|
||||
<!-- Button for importing several elements at once. -->
|
||||
<p align=":dright"><br/>
|
||||
<input if="importElems[1] and not allAreImported"
|
||||
type="button" onClick="importManyElements()"
|
||||
value=":_('import_many')"/>
|
||||
</p>
|
||||
</x>''', template=AbstractWrapper.pxTemplate, hook='content')
|
||||
|
||||
def isManager(self):
|
||||
'''Some pages on the tool can only be accessed by managers.'''
|
||||
if self.user.has_role('Manager'): return 'view'
|
||||
|
|
Loading…
Reference in a new issue