Commit 6b80473e authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Replace the database table application by preferences and used the widget preferences.

parent 42f7f437
......@@ -7,25 +7,24 @@ def index():
# login procedure is active
if session.auth:
roles = session.auth.user_groups.values()
roles = session.auth.user_groups.values()
if roles:
session.role = roles[0]
# inhibit USER login from the application properties
if session.role == USER:
authorize_login = current.app.authorize_user_login
if authorize_login.lower() not in ('true', 'yes'):
if not current.app.authorize_user_login:
session.role = None
else:
return 'The user role is not defined'
# no login procedure
# no login procedure
else:
session.role = ADMIN
if 'debug' in request.vars:
return LOAD('plugin_dbui', 'debug', vars=request.vars)
return LOAD('plugin_dbui', 'index', vars=request.vars)
......@@ -159,8 +159,8 @@
'Data publications': 'Les données des publications',
'database': 'database',
'database %s select': 'database %s select',
'Database schema': 'Schéma de la base de données',
'database schema': 'schéma de la base de données',
'Database schema': 'Schéma de la base de données',
'Date': 'Date',
'Date of defense: 13 Dec 2011': 'Date de la soutenance: 13 Dec 2011',
'Date of submission to a publisher: 2011-12-13 or 2011-12': 'Date de soumission à un éditeur : 2011-12-13 ou 2011-12',
......@@ -276,7 +276,7 @@
'Harvester took %s seconds': 'La moisson à durée %s secondes',
'Harvester(s)': 'Moissonneur(s)',
'harvesters': 'moissonneurs',
'Harvesters are ran automatically when the value is equal to yes or true.': 'Les moissonneurs sont éxécuté automatiquement quand cette valuer est égale à yes ou true.',
'Harvesters are ran automatically when the value is equal to true.': 'Les moissonneurs sont éxécuté automatiquement quand cette valuer est égale à vraie.',
'Header': 'En tête',
'Header / Footer': 'Header / Footer',
'Header/Footer': 'Header/Footer',
......@@ -425,6 +425,8 @@
'poster': 'affiche',
'Posters': 'Affiches',
'Postprocessing': 'Postprocessing',
'Preferences': 'Préférences',
'preferences': 'préférences',
'Preprint': 'Preprint',
'preprint': 'preprint',
'Preprint identifier separated by comma: arXiv:0906.1516': 'Numéro(s) du preprint séparé par des virgules: arXiv:0906.1516',
......@@ -466,7 +468,7 @@
'Registration is pending approval': 'Registration is pending approval',
'Registration key': 'Registration key',
'Registration successful': 'Registration successful',
'Regular expression defining the name of our institute. ': 'Expression régulière definissant le nom de votre laboratoire.',
'Regular expression defining the name of our institute.': 'Expression régulière definissant le nom de votre laboratoire.',
'Reject': 'Rejeter',
'Reject article is not published': "Rejeté l'article n'est pas publié",
'Reject collaboration is not well formed': 'Rejeté la collaboration est mal formatté',
......@@ -664,7 +666,7 @@
'User guides': 'Guides utilisateurs',
'User ID': 'User ID',
'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.',
'Users can login when the value is equal to true.': 'Les utilisateurs peuvent se logger quand cette valuer est égale à vraie.',
'usual': 'usuel',
'Usual': 'Usuel',
'Validate': 'Valider',
......@@ -676,8 +678,8 @@
'Verify Password': 'Verify Password',
'versions': 'versions',
'Vertical': 'Vertical',
'volume': 'volume',
'Volume': 'Volume',
'volume': 'volume',
'Volume / pages': 'Volume / pages',
'Volume number is not defined': "Le numéro du volume n'est pas défini",
'Welcome': 'Welcome',
......
# -*- coding: utf-8 -*-
""" application
""" preferences
"""
from gluon import current
from gluon.storage import Storage
db.define_table("application",
db.define_table("preferences",
Field("property", "string", length=255, notnull=True, unique=True),
Field("value", "string", length=255),
Field("value", "json", length=255),
Field("definition", "text", notnull=True),
migrate="application.table")
migrate="preferences.table")
db.preferences.value.requires = None
#-------------------------------------------------------------------------------
#
# APPLICATION PROPERTIES
# APPLICATION PREFERENCES
#
#-------------------------------------------------------------------------------
app = Storage()
for row in db(db.application).select():
for row in db(db.preferences).select():
app[row.property] = row.value
current.app = app
\ No newline at end of file
current.app = app
# -*- coding: utf-8 -*-
""" application
Contains variables to configure the applications
""" preferences
"""
#-------------------------------------------------------------------------------
......@@ -21,14 +19,32 @@
# GRID CONFIGURATiON
#
#-------------------------------------------------------------------------------
gridModifier = dbui.GridModifier('application')
gridModifier.configure_column('property', width=30)
gridModifier.configure_column('value', width=20)
#-------------------------------------------------------------------------------
#
# PREFERENCES CONFIGURATiON
#
#-------------------------------------------------------------------------------
cfgPreferences = dict(dbtable='preferences',
height=200,
nameColumnWidth=150,
source={
'authorize_harvester_scan': False,
'authorize_user_login': False,
'harvester_start_year': year,
'reg_institute': None},
sourceConfig={
'authorize_harvester_scan': {'type': 'boolean'},
'authorize_user_login': {'type': 'boolean'},
'harvester_start_year': {'type': 'number'},
'reg_institute': {'type': 'string'}},
width=250,
xtype='xpreferences')
#-------------------------------------------------------------------------------
#
# STORE CONFIGURATiON
#
#-------------------------------------------------------------------------------
storeModifier = dbui.StoreModifier('application')
storeModifier.orderby(db.application.property)
storeModifier = dbui.StoreModifier('preferences')
storeModifier.orderby(db.preferences.property)
# -*- coding: utf-8 -*-
""" application
""" preferences
Define the application properties
"""
if db(db.application).count() != 3:
if db(db.preferences).count() != 3:
if not db(db.application.property=="authorize_harvester_scan").select():
db.application.insert(property='authorize_harvester_scan',
if not db(db.preferences.property == "authorize_harvester_scan").select():
db.preferences.insert(property='authorize_harvester_scan',
definition=T("Harvesters are ran automatically "
"when the value is equal to yes "
"or true."))
if not db(db.application.property=="authorize_user_login").select():
db.application.insert(property="authorize_user_login",
"when the value is equal to true."))
if not db(db.preferences.property == "authorize_user_login").select():
db.preferences.insert(property="authorize_user_login",
definition=T("Users can login when the value is "
"equal to yes or true."))
if not db(db.application.property=="harvester_start_year").select():
db.application.insert(property="harvester_start_year",
"equal to true."))
if not db(db.preferences.property == "harvester_start_year").select():
db.preferences.insert(property="harvester_start_year",
definition=T("Define the range of years in which "
"the harvesters can be ran. "
"It starts with the given value and "
"ends with the current year."))
if not db(db.application.property=="reg_institute").select():
db.application.insert(property="reg_institute",
if not db(db.preferences.property == "reg_institute").select():
db.preferences.insert(property="reg_institute",
definition=T("Regular expression defining the "
"name of our institute. "))
\ No newline at end of file
"name of our institute."))
......@@ -9,6 +9,7 @@ to_grid = lambda tablename: dbui.to_gridPanel(db[tablename])
Node = dbui.Node
Panel = dbui.Panel
PanelWithUrlSelector = dbui.to_panelWithUrlSelector
Window = dbui.Window
#-------------------------------------------------------------------------------
#
......@@ -33,7 +34,14 @@ confAppNode = None
if session.role == ADMIN:
confAppNode = Node(T('Configure the application'))
confAppNode.add_child(T('properties'), to_grid('application'))
prefLeaf = Window(closable=True,
items=[cfgPreferences],
layout='fit',
modal=True,
title=T('Preferences'))
confAppNode.add_child(T('preferences'), prefLeaf)
#-------------------------------------------------------------------------------
#
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment