Commit 4282b34c authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Redesign the lists and metrics interfaces (backward compatibily is broken).

Fix order
parent d8ae5338
......@@ -33,15 +33,13 @@ def index():
# database fields corresponding to the axes
fields, orderby = [], []
for axis in (metric.axis_columns, metric.axis_rows):
for el in ('column', 'row'):
granularity = metric["axis_granularity_%s" % axis]
direction = metric["axis_direction_%s" % axis]
axis = metric["axis_%s" % el]
granularity = metric["granularity_%s" % el]
direction = metric["direction_%s" % el]
if axis == 'time':
field = db.publications[granularity]
else:
field = db[axis][granularity]
field = db[axis][granularity]
fields.append(field)
if direction == 'DESC':
......
......@@ -13,6 +13,7 @@
'A report already exists with the same title': 'Un rapport existe deja avec le même titre',
'A talk/proceeding already exists with the same:': 'Un acte ou une présentation existe déja avec le même:',
'Abbreviation': 'Abréviation',
'abbreviation': 'abréviation',
'about': 'à propos',
'ACL': 'ACL',
'ACLN': 'ACLN',
......@@ -25,6 +26,7 @@
'administrators, librairians,...': 'administrateurs, documentalistes,...',
'Affiliation': 'Affiliation',
'Agencies': 'Agences',
'agencies': 'agences',
'agency': 'agence',
'All': 'Tous',
'All fields of the form have to be defined !!!': 'Tous les champs doivent ếtre définis !!!',
......@@ -54,6 +56,7 @@
'axes': 'axes',
'Axes': 'Axes',
'Axes granularity': 'Axes granularity',
'axis': 'axe',
'Axis': 'Axis',
'Axis Direction Categories': 'Axis Direction Categories',
'Axis Direction Projects': 'Axis Direction Projects',
......@@ -111,6 +114,7 @@
'Collection': 'Collection',
'Collections': 'Collections',
'Colonnes': 'Colonnes',
'Column': 'Colonne',
'Columns': 'Colonnes',
'COM': 'COM',
'Compare publications %s and %s': 'Compare les publications %s et %s',
......@@ -167,6 +171,12 @@
'diplomas': 'diplomes',
'Direct access to the table: ': 'Accès direct à la table : ',
'Direction': 'Direction',
'Direction Column': 'Direction Column',
'Direction Level 1': 'Direction Level 1',
'Direction Level 2': 'Direction Level 2',
'Direction Level 3': 'Direction Level 3',
'Direction Level 4': 'Direction Level 4',
'Direction Row': 'Direction Row',
'Directors': 'Directeurs',
'Documentation for developers': 'Documentation développeurs',
'documentations': 'documentations',
......@@ -186,6 +196,7 @@
'enter a number between %(min)g and %(max)g': 'enter a number between %(min)g and %(max)g',
'Enter a number between %(min)g and %(max)g': 'Enter a number between %(min)g and %(max)g',
'enter a valid URL': 'Entrer un URL valide',
'Enter a value': 'Enter a value',
'Enter an integer between %(min)g and %(max)g': 'Enter an integer between %(min)g and %(max)g',
'enter an integer between %(min)g and %(max)g': 'entrez un entier entre %(min)g et %(max)g',
'enter an integer greater than or equal to %(min)g': 'entrez un entier plus grand ou égual à %(min)g',
......@@ -228,7 +239,14 @@
'from %s to %s': 'de %s à %s',
'Function disabled': 'Fonction desactivée',
'General': 'Général',
'granularity': 'granularité',
'Granularity': 'Granularité',
'Granularity Column': 'Granularity Column',
'Granularity Level 1': 'Granularity Level 1',
'Granularity Level 2': 'Granularity Level 2',
'Granularity Level 3': 'Granularity Level 3',
'Granularity Level 4': 'Granularity Level 4',
'Granularity Row': 'Granularity Row',
'Grids': 'Tables',
'Group': 'Groupe',
'Group %(group_id)s created': 'Group %(group_id)s created',
......@@ -322,6 +340,7 @@
'Name': 'Nom',
'Name of a function located in the modules list_postprocessing. Can be a list of name separated by comma.': 'Nom de la fonction localisées dans le module list_postprocessing, ou liste de nom séparé par une virgule.',
'Name of the database table containing the publications shown in this section.': 'Nom de la table qui contient les publications qui seront présentées dans cette section.',
'Name of the list.': 'Nom de la liste.',
'Name of the section.': 'Nom de la section.',
'New password': 'New password',
'Niveau 1': 'Niveau 1',
......@@ -392,6 +411,7 @@
'Process': 'Analyser',
'Process as': 'Analyser comme',
'Profile': 'Profile',
'project': 'projet',
'Project': 'Projet',
'projects': 'projets',
'Projects': 'Projets',
......@@ -403,6 +423,7 @@
'publications': 'publications',
'Publications': 'Publications',
'Publisher': 'Revue',
'publisher': 'revue',
'Publishers': 'Revues',
'publishers': 'revues',
'Publishers is not defined': "La revue n'est pas définie",
......@@ -477,6 +498,7 @@
'Revue': 'Revue',
'Revues': 'Revues',
'Role': 'Rôle',
'Row': 'Ligne',
'Rows': 'Lignes',
'Rows in table': 'Rows in table',
'run a free harvester': 'exécuter un moissoneur « libre »',
......@@ -499,6 +521,8 @@
'Select a controller.': 'Selectionner un controlleur.',
'Select an "harvester" !!!': 'Sélectionner un "moissonneur" !!!',
'Select an harvester.': 'Selectionner un moissonneur.',
'Select axis...': 'Sélect. axe...',
'Select granularity...': 'Sélect. granularité...',
'select...': 'sélectionner...',
'selected': 'sélectionnez',
'Service': 'Service',
......@@ -572,6 +596,10 @@
'Tools': 'Outils',
'total': 'total',
'Town': 'Ville',
'Tr Axis': 'Tr Axis',
'Tr Granularity': 'Tr Granularity',
'Tr_Axis': 'Tr_Axis',
'Tr_Granularity': 'Tr_Granularity',
'Transform the preprint into an article': 'Transforme le preprint en article',
'Transform the talk into a proceeding': 'Transforme la présentation orale en actes de conférence',
'Type': 'Type',
......@@ -597,6 +625,7 @@
'users': 'utilisateurs',
'Users can login when the value is equal to yes or true.': 'Les utilisateurs peuvent se logger quand cette valuer est égale à yes ou true.',
'Usual': 'Usuel',
'usual': 'usuel',
'Validate': 'Valider',
'Validated': 'Validé',
'Value': 'Valeur',
......
......@@ -9,4 +9,6 @@
db.define_table("axes",
Field("axis", "string", length=255, notnull=True),
Field("granularity", "string", length=255, notnull=True),
Field("tr_axis", "string", length=255, notnull=True),
Field("tr_granularity", "string", length=255, notnull=True),
migrate="axes.table")
\ No newline at end of file
# -*- coding: utf-8 -*-
""" lists
The table axes, lists, sections and renderers are used by the lists tool.
"""
tp_axis_label = \
T("Axis values are used to defined the title of each level in section. "
"This field allow to replace some values by another ones. "
'Rule: label1: "value1", label2: "value2",....')
tp_list = T("Name of the list.")
tp_sections = \
T("List of sections separated by a comma: Articles, Proceedings.")
db.define_table("lists",
Field("list", "string", length=255, notnull=True),
Field("list", "string", comment=tp_list, length=255, notnull=True),
Field("definition", "text", default=""),
Field("sections", "text", comment=tp_sections, notnull=True),
Field("section_level_1", "string", length=255, default="", label=T("Level 1")),
Field("section_level_2", "string", length=255, default="", label=T("Level 2")),
Field("section_level_3", "string", length=255, default="", label=T("Level 3")),
Field("section_level_4", "string", length=255, default="", label=T("Level 4")),
Field("axis_granularity_categories", "string", length=255, default="usual", label=T("Categories")),
Field("axis_granularity_projects", "string", length=255, default="project", label=T("Projects")),
Field("axis_granularity_teams", "string", length=255, default="team", label=T("Teams")),
Field("axis_granularity_time", "string", length=255, default="year", label=T("Time")),
Field("axis_direction_categories", "string", length=255, default="ASC"),
Field("axis_direction_projects", "string", length=255, default="ASC"),
Field("axis_direction_teams", "string", length=255, default="ASC"),
Field("axis_direction_time", "string", length=255, default="ASC"),
Field("axis_level_1", "string", length=255, default="", label=T("Level 1")),
Field("axis_level_2", "string", length=255, default="", label=T("Level 2")),
Field("axis_level_3", "string", length=255, default="", label=T("Level 3")),
Field("axis_level_4", "string", length=255, default="", label=T("Level 4")),
Field("granularity_level_1", "string", length=255),
Field("granularity_level_2", "string", length=255),
Field("granularity_level_3", "string", length=255),
Field("granularity_level_4", "string", length=255),
Field("direction_level_1", "string", length=255, default="ASC"),
Field("direction_level_2", "string", length=255, default="ASC"),
Field("direction_level_3", "string", length=255, default="ASC"),
Field("direction_level_4", "string", length=255, default="ASC"),
Field("axis_label_converters", "text", comment=tp_axis_label, default="", label="Converters"),
Field("header_flag", "boolean", default=True, label="Header"),
Field("footer_flag", "boolean", default=True, label="Footer"),
......@@ -36,23 +36,7 @@ db.define_table("lists",
db.lists.list.filter_in = dbui.CLEAN_SPACES
db.lists.sections.filter_in = dbui.CLEAN_SPACES
db.lists.axis_direction_categories.requires = IS_IN_SET(DIRS)
db.lists.axis_direction_projects.requires = IS_IN_SET(DIRS)
db.lists.axis_direction_teams.requires = IS_IN_SET(DIRS)
db.lists.axis_direction_time.requires = IS_IN_SET(DIRS)
se = set(db.categories.fields).difference(['id', 'definition'])
db.lists.axis_granularity_categories.requires = IS_IN_SET(se)
se = set(db.projects.fields).difference(['id', 'definition'])
db.lists.axis_granularity_projects.requires = IS_IN_SET(se)
se = set(db.teams.fields).difference(['id', 'definition'])
db.lists.axis_granularity_teams.requires = IS_IN_SET(se)
db.lists.axis_granularity_time.requires = IS_IN_SET(['year'])
db.lists.section_level_1.requires = IS_IN_SET(AXES)
db.lists.section_level_2.requires = IS_IN_SET(AXES)
db.lists.section_level_3.requires = IS_IN_SET(AXES)
db.lists.section_level_4.requires = IS_IN_SET(AXES)
\ No newline at end of file
db.lists.direction_level_1.requires = IS_IN_SET(DIRS)
db.lists.direction_level_2.requires = IS_IN_SET(DIRS)
db.lists.direction_level_3.requires = IS_IN_SET(DIRS)
db.lists.direction_level_4.requires = IS_IN_SET(DIRS)
......@@ -14,18 +14,12 @@ T("can be applied on any field of the table using the SQL WHERE syntax. "
db.define_table("metrics",
Field("metric", "string", length=255, notnull=True),
Field("definition", "text", default=""),
Field("axis_columns", "string", length=255, label=T('Columns'), notnull=True),
Field("axis_rows", "string", length=255, label=T('Rows'), notnull=True),
Field("axis_granularity_categories", "string", length=255, default="usual", label=T("Categories")),
Field("axis_granularity_projects", "string", length=255, default="project", label=T("Projects")),
Field("axis_granularity_publishers", "string", length=255, default="publisher", label=T("Publishers")),
Field("axis_granularity_teams", "string", length=255, default="team", label=T("Teams")),
Field("axis_granularity_time", "string", length=255, default="year", label=T("Time")),
Field("axis_direction_categories", "string", length=255, default="ASC"),
Field("axis_direction_projects", "string", length=255, default="ASC"),
Field("axis_direction_publishers", "string", length=255, default="ASC"),
Field("axis_direction_teams", "string", length=255, default="ASC"),
Field("axis_direction_time", "string", length=255, default="ASC"),
Field("axis_column", "string", default="", length=255, label=T('Columns')),
Field("axis_row", "string", default="", length=255, label=T('Rows')),
Field("granularity_column", "string", length=255),
Field("granularity_row", "string", length=255),
Field("direction_column", "string", length=255, default="ASC"),
Field("direction_row", "string", length=255, default="ASC"),
Field("axis_label_converters", "text", comment=tp_axis_label, default="", label="Converters"),
Field("conditions", "text", comment=tp_conditions, default=""),
Field("header_flag", "boolean", default=True, label="Header"),
......@@ -34,26 +28,5 @@ db.define_table("metrics",
db.metrics.metric.filter_in = dbui.CLEAN_SPACES
db.metrics.axis_columns.requires = IS_IN_SET(AXES_2)
db.metrics.axis_direction_categories.requires = IS_IN_SET(DIRS)
db.metrics.axis_direction_projects.requires = IS_IN_SET(DIRS)
db.metrics.axis_direction_publishers.requires = IS_IN_SET(DIRS)
db.metrics.axis_direction_teams.requires = IS_IN_SET(DIRS)
db.metrics.axis_direction_time.requires = IS_IN_SET(DIRS)
se = set(db.categories.fields).difference(['id', 'definition'])
db.metrics.axis_granularity_categories.requires = IS_IN_SET(se)
se = set(db.projects.fields).difference(['id', 'definition'])
db.metrics.axis_granularity_projects.requires = IS_IN_SET(se)
se = set(db.publishers.fields).difference(['id', 'definition'])
db.metrics.axis_granularity_publishers.requires = IS_IN_SET(se)
se = set(db.teams.fields).difference(['id', 'definition'])
db.metrics.axis_granularity_teams.requires = IS_IN_SET(se)
db.metrics.axis_granularity_time.requires = IS_IN_SET(['year'])
db.metrics.axis_rows.requires = IS_IN_SET(AXES_2)
\ No newline at end of file
db.metrics.direction_column.requires = IS_IN_SET(DIRS)
db.metrics.direction_row.requires = IS_IN_SET(DIRS)
\ No newline at end of file
......@@ -22,8 +22,6 @@
# GRID CONFIGURATiON
#
#-------------------------------------------------------------------------------
gridModifier = dbui.GridModifier('axes')
gridModifier.configure_column('axis', width=15)
#-------------------------------------------------------------------------------
#
......@@ -31,4 +29,4 @@ gridModifier.configure_column('axis', width=15)
#
#-------------------------------------------------------------------------------
storeModifier = dbui.StoreModifier('axes')
storeModifier.orderby(db.axes.axis)
storeModifier.orderby(db.axes.tr_axis, db.axes.tr_granularity)
# -*- coding: utf-8 -*-
""" lists
The table axes, lists, sections and renderers are used by the lists tool.
"""
#-------------------------------------------------------------------------------
#
......@@ -15,29 +13,32 @@ fieldsModifier.configure_field('axis_label_converters', height=260)
fieldsModifier.configure_field('definition', height=233)
fieldsModifier.configure_field('sections', height=260)
fieldsModifier.configure_field('axis_granularity_categories', flex=3)
fieldsModifier.configure_field('axis_direction_categories', flex=1)
fieldsModifier.merge_fields('axis_granularity_categories',
'axis_direction_categories',
fieldLabel=T('Categories'))
fieldsModifier.configure_field('axis_granularity_projects', flex=3)
fieldsModifier.configure_field('axis_direction_projects', flex=1)
fieldsModifier.merge_fields('axis_granularity_projects',
'axis_direction_projects',
fieldLabel=T('Projects'))
fieldsModifier.configure_field('axis_granularity_teams', flex=3)
fieldsModifier.configure_field('axis_direction_teams', flex=1)
fieldsModifier.merge_fields('axis_granularity_teams',
'axis_direction_teams',
fieldLabel=T('Teams'))
fieldsModifier.configure_field('axis_granularity_time', flex=3)
fieldsModifier.configure_field('axis_direction_time', flex=1)
fieldsModifier.merge_fields('axis_granularity_time',
'axis_direction_time',
fieldLabel=T('Time'))
for level in ('level_1', 'level_2', 'level_3', 'level_4'):
fieldsModifier.configure_field('axis_%s' % level,
itemId='axis_%s' % level,
displayField='AxesTr_axis',
valueField='AxesAxis',
refStore=dbui.get_store_id('axes'),
emptyText=T('Select axis...'),
userReset=True,
xtype='xcomboboxmaster')
fieldsModifier.configure_field('granularity_%s' % level,
masterItemId='axis_%s' % level,
masterValueField='AxesAxis',
displayField='AxesTr_granularity',
valueField='AxesGranularity',
refStore=dbui.get_store_id('axes'),
emptyText=T('Select granularity...'),
xtype='xcomboboxslave')
fieldsModifier.configure_field('direction_%s' % level, flex=0.5)
fieldsModifier.merge_fields('axis_%s' % level,
'granularity_%s' % level,
'direction_%s' % level,
fieldLabel=T(level.replace('_', ' ').title()))
#-------------------------------------------------------------------------------
#
......@@ -45,6 +46,7 @@ fieldsModifier.merge_fields('axis_granularity_time',
#
#-------------------------------------------------------------------------------
formModifier = dbui.FormModifier('lists')
formModifier.merge_fields('list',
'definition',
title=T('General'))
......@@ -52,18 +54,12 @@ formModifier.merge_fields('list',
formModifier.merge_fields('sections',
title=T('Sections'))
formModifier.merge_fields('section_level_1',
'section_level_2',
'section_level_3',
'section_level_4',
formModifier.merge_fields('axis_level_1',
'axis_level_2',
'axis_level_3',
'axis_level_4',
title=T('Sort by'))
formModifier.merge_fields('axis_granularity_categories',
'axis_granularity_projects',
'axis_granularity_teams',
'axis_granularity_time',
title=T('Axes'))
formModifier.merge_fields('axis_label_converters',
title=T('Substitute'))
......@@ -86,18 +82,18 @@ formModifier.configure(buttonAlign='right',
#-------------------------------------------------------------------------------
gridModifier = dbui.GridModifier('lists')
gridModifier.configure_column('list', width=60)
gridModifier.hide_columns('section_level_1',
'section_level_2',
'section_level_3',
'section_level_4',
'axis_granularity_categories',
'axis_granularity_projects',
'axis_granularity_teams',
'axis_granularity_time',
'axis_direction_categories',
'axis_direction_projects',
'axis_direction_teams',
'axis_direction_time',
gridModifier.hide_columns('axis_level_1',
'axis_level_2',
'axis_level_3',
'axis_level_4',
'granularity_level_1',
'granularity_level_2',
'granularity_level_3',
'granularity_level_4',
'direction_level_1',
'direction_level_2',
'direction_level_3',
'direction_level_4',
'axis_label_converters',
'header_flag',
'footer_flag')
......
......@@ -12,35 +12,33 @@ fieldsModifier = dbui.FieldsModifier('metrics')
fieldsModifier.configure_field('axis_label_converters', height=260)
fieldsModifier.configure_field('definition', height=233)
fieldsModifier.configure_field('axis_granularity_categories', flex=3)
fieldsModifier.configure_field('axis_direction_categories', flex=1)
fieldsModifier.merge_fields('axis_granularity_categories',
'axis_direction_categories',
fieldLabel=T('Categories'))
fieldsModifier.configure_field('axis_granularity_projects', flex=3)
fieldsModifier.configure_field('axis_direction_projects', flex=1)
fieldsModifier.merge_fields('axis_granularity_projects',
'axis_direction_projects',
fieldLabel=T('Projects'))
fieldsModifier.configure_field('axis_granularity_publishers', flex=3)
fieldsModifier.configure_field('axis_direction_publishers', flex=1)
fieldsModifier.merge_fields('axis_granularity_publishers',
'axis_direction_publishers',
fieldLabel=T('Publishers'))
fieldsModifier.configure_field('axis_granularity_teams', flex=3)
fieldsModifier.configure_field('axis_direction_teams', flex=1)
fieldsModifier.merge_fields('axis_granularity_teams',
'axis_direction_teams',
fieldLabel=T('Teams'))
fieldsModifier.configure_field('axis_granularity_time', flex=3)
fieldsModifier.configure_field('axis_direction_time', flex=1)
fieldsModifier.merge_fields('axis_granularity_time',
'axis_direction_time',
fieldLabel=T('Time'))
for el in ('column', 'row'):
fieldsModifier.configure_field('axis_%s' % el,
itemId='axis_%s' % el,
displayField='AxesTr_axis',
valueField='AxesAxis',
refStore=dbui.get_store_id('axes'),
emptyText=T('Select axis...'),
userReset=True,
xtype='xcomboboxmaster')
fieldsModifier.configure_field('granularity_%s' % el,
masterItemId='axis_%s' % el,
masterValueField='AxesAxis',
displayField='AxesTr_granularity',
valueField='AxesGranularity',
refStore=dbui.get_store_id('axes'),
emptyText=T('Select granularity...'),
xtype='xcomboboxslave')
fieldsModifier.configure_field('direction_%s' % el, flex=0.5)
fieldsModifier.merge_fields('axis_%s' % el,
'granularity_%s' % el,
'direction_%s' % el,
fieldLabel=T(el.title()))
#-------------------------------------------------------------------------------
#
......@@ -52,18 +50,11 @@ formModifier.merge_fields('metric',
'definition',
title=T('General'))
formModifier.merge_fields('axis_columns',
'axis_rows',
formModifier.merge_fields('axis_column',
'axis_row',
'conditions',
title=T('Count by'))
formModifier.merge_fields('axis_granularity_categories',
'axis_granularity_projects',
'axis_granularity_publishers',
'axis_granularity_teams',
'axis_granularity_time',
title=T('Axes'))
formModifier.merge_fields('axis_label_converters',
title=T('Substitute'))
......@@ -87,16 +78,12 @@ formModifier.configure(buttonAlign='right',
gridModifier = dbui.GridModifier('metrics')
gridModifier.configure_column('metric', width=90)
gridModifier.configure_column('definition', width=250)
gridModifier.hide_columns('axis_granularity_categories',
'axis_granularity_projects',
'axis_granularity_publishers',
'axis_granularity_teams',
'axis_granularity_time',
'axis_direction_categories',
'axis_direction_projects',
'axis_direction_publishers',
'axis_direction_teams',
'axis_direction_time',
gridModifier.hide_columns('axis_column',
'axis_row',
'granularity_column',
'granularity_row',
'direction_column',
'direction_row',
'axis_label_converters',
'conditions',
'header_flag',
......
......@@ -3,15 +3,23 @@
Fill axes table.
It is used by the lists tool, defining the relation between
axis and granularity. This table contains static data which
can not be modified by the user.
It is used by the lists user interface.
The table defines the relation between axis and their granularity.
This table contains static data which can not be modified by the user.
"""
if db(db.axes).count() == 0:
db.axes.insert(axis='projects', granularity='project')
db.axes.insert(axis='projects', granularity='agency')
db.axes.insert(axis='teams', granularity='team')
db.axes.insert(axis='teams', granularity='domain')
db.axes.insert(axis='time', granularity='year')
for axe in ('categories', 'projects', 'publishers', 'teams'):
granularities = set(db[axe].fields).difference(['id', 'definition'])
for value in granularities:
db.axes.insert(axis=axe,
granularity=value,
tr_axis=T(axe),
tr_granularity=T(value))
db.axes.insert(axis='publications',
granularity='year',
tr_axis=T('time'),
tr_granularity=T('year'))
......@@ -156,25 +156,25 @@ if db(db.lists).count() == 0:
db.lists.insert(id=2,
list=T('cat. usual / team / year'),
sections=', '.join(sections),
section_level_1='categories',
section_level_2='teams',
section_level_3='time',
axis_granularity_categories='usual',
axis_granularity_teams='team',
axis_granularity_time='year',
axis_direction_time='DESC',
axis_level_1='categories',
axis_level_2='teams',
axis_level_3='publications',
granularity_level_1='usual',
granularity_level_2='team',
granularity_level_3='year',
direction_level_3='DESC',
definition=T('List shorted by usual category, by team and by year'))
db.lists.insert(id=3,
list=T('cat. AERES / project / year'),
sections=', '.join(sections),
section_level_1='categories',
section_level_2='projects',
section_level_3='time',
axis_granularity_categories='code',
axis_granularity_projects='project',
axis_granularity_time='year',
axis_direction_time='DESC',
axis_level_1='categories',
axis_level_2='teams',
axis_level_3='publications',
granularity_level_1='code',
granularity_level_2='team',
granularity_level_3='year',
direction_level_3='DESC',
definition=T('List shorted by AERES category, by project and by year'))
#------------------------------------------------------------------------------
......@@ -186,16 +186,16 @@ if db(db.metrics).count() == 0:
db.metrics.insert(id=2,
metric=T('cat. usual / year'),
axis_columns='categories',
axis_rows='time',
axis_granularity_categories='usual',