common_settings.py 2.79 KB
Newer Older
1 2 3 4 5
# -*- coding: utf-8 -*-
""" Common settings

"""
import filters
6
import harvest_tools
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
import locale
import plugin_dbui as dbui

from callbacks import (INHIBIT_CASCADE_DELETE,
                       INHIBIT_DUPLICATE_PUBLICATION,
                       INHIBIT_PUBLICATION_DELETE_ON_OK,
                       INHIBIT_PUBLICATION_UPDATE_ON_OK)

from datetime import datetime
from gluon.tools import PluginManager

#-------------------------------------------------------------------------------
#
# PLUGIN DBUI
#
#-------------------------------------------------------------------------------
plugins = PluginManager()
plugins.dbui.app_css = 'static/my.css'
#plugins.dbui.app_js_dir = None
#plugins.dbui.app_libmin = None
27 28
plugins.dbui.app_script = 'static/app.js'
#plugins.dbui.app_script_dir = None
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64

#-------------------------------------------------------------------------------
#
# LANGUAGE
#
#-------------------------------------------------------------------------------
T.set_current_languages('en', 'en-gb', 'en-us')     # mother tongue
T.force('fr-fr')                                    # user language
T.lazy = False                                      # immediate translation

locale.setlocale(locale.LC_ALL, "fr_FR.UTF-8")

#-------------------------------------------------------------------------------
#
# CONSTANTS
#
#-------------------------------------------------------------------------------
undef = T(dbui.UNDEF)
undef_id = dbui.UNDEF_ID
year = datetime.now().year

DIRS = ['ASC', 'DESC']
AXES = ['', 'categories', 'projects', 'teams', 'time']
AXES_2 = ['categories', 'projects', 'publishers', 'teams', 'time']

ONE_HOUR = 3600000

MODE_DRY_RUN = T(harvest_tools.DRY_RUN)
MODE_CHANGE_STATUS = T('change status')
MODE_LOAD_IN_DB = T('load in the database')

#-------------------------------------------------------------------------------
#
# COMMON CONFIGURATION FOR FORMS AND GRIDS
#
#-------------------------------------------------------------------------------
65 66
tables = ['application',
          'auth_group',
67 68 69
          'auth_membership',
          'auth_user',
          'authors_roles',
70 71 72 73 74 75 76 77 78
          'axes',
          'categories',
          'collaborations',
          'controllers',
          'countries',
          'cppm_authors',
          'harvesters',
          'lists',
          'metrics',
79
          'organisation',
80 81 82 83 84 85 86 87 88
          'projects',
          'publications',
          'publishers',
          'renderers',
          'reports',
          'sections',
          'status',
          'teams']

89
dbui.configure_forms(tables, plugins=['pFormToolTip'], width=350)
90 91 92 93 94

dbui.configure_grids(tables, plugins=['pGridRowEditorConfirmDelete',
                                      'pGridRowEditorContextMenu',
                                      'pGridRowEditorDblClick',
                                      'pGridToolbar'])