diff --git a/gen/__init__.py b/gen/__init__.py index 9414774..021aef7 100644 --- a/gen/__init__.py +++ b/gen/__init__.py @@ -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: diff --git a/gen/mixins/ToolMixin.py b/gen/mixins/ToolMixin.py index 8f90f90..57b92c6 100644 --- a/gen/mixins/ToolMixin.py +++ b/gen/mixins/ToolMixin.py @@ -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")?''' diff --git a/gen/tr/Appy.pot b/gen/tr/Appy.pot index 2dc8ebe..eca9569 100644 --- a/gen/tr/Appy.pot +++ b/gen/tr/Appy.pot @@ -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 "" diff --git a/gen/tr/ar.po b/gen/tr/ar.po index b35ea55..7d37d11 100644 --- a/gen/tr/ar.po +++ b/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 "" diff --git a/gen/tr/de.po b/gen/tr/de.po index dad9024..5b66b47 100644 --- a/gen/tr/de.po +++ b/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" diff --git a/gen/tr/en.po b/gen/tr/en.po index f11df9a..5b4efeb 100644 --- a/gen/tr/en.po +++ b/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" diff --git a/gen/tr/es.po b/gen/tr/es.po index 50552d7..77ec0f5 100644 --- a/gen/tr/es.po +++ b/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" diff --git a/gen/tr/fr.po b/gen/tr/fr.po index 07d1c68..6d7371b 100644 --- a/gen/tr/fr.po +++ b/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" diff --git a/gen/tr/it.po b/gen/tr/it.po index e5bcc8f..ae52f23 100644 --- a/gen/tr/it.po +++ b/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" diff --git a/gen/tr/nl.po b/gen/tr/nl.po index 65a0f2e..96c04dc 100644 --- a/gen/tr/nl.po +++ b/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" diff --git a/gen/ui/appy.js b/gen/ui/appy.js index 2101644..6731d38 100644 --- a/gen/ui/appy.js +++ b/gen/ui/appy.js @@ -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. diff --git a/gen/ui/buttonImport.png b/gen/ui/buttonImport.png deleted file mode 100644 index ce45d2a..0000000 Binary files a/gen/ui/buttonImport.png and /dev/null differ diff --git a/gen/ui/eye.png b/gen/ui/eye.png deleted file mode 100644 index a6c393b..0000000 Binary files a/gen/ui/eye.png and /dev/null differ diff --git a/gen/ui/select_elems.png b/gen/ui/select_elems.png deleted file mode 100644 index e0e3c64..0000000 Binary files a/gen/ui/select_elems.png and /dev/null differ diff --git a/gen/wrappers/ToolWrapper.py b/gen/wrappers/ToolWrapper.py index b303330..3b3e269 100644 --- a/gen/wrappers/ToolWrapper.py +++ b/gen/wrappers/ToolWrapper.py @@ -187,7 +187,6 @@ class ToolWrapper(AbstractWrapper): - - - - - @@ -534,109 +525,6 @@ class ToolWrapper(AbstractWrapper): ''', template=AbstractWrapper.pxTemplate, hook='content') - pxImport = Px(''' - - :tool.pxPagePrologue - - - -
- - - -
- -

:_('import_title')


- - - - - - - - - - - - - -
- - :columnHeader -
:elem - - :_('import_already') - - -
:_('query_no_result')
- - -


- -

-
''', 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'