Commit 05d53937 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Migrate to plugin_dbui 0.6.0.18 and Ext JS 4.2.1.

parent f93ae68f
......@@ -6,6 +6,8 @@ cache/
cron/
databases
databases*/
*jsduck*
*epydoc*
errors/
private/
*plugin_ace*
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
NAME
buildVersion -- helper script to build and tag a track_lhcbfrance version
SYNOPSIS
buildVersion [options] version
DESCRIPTION
Helper script to build a version of the track_lhcbfrance.
The version identifier should contains alphanumeric characters
including ".", "-" and "_".
Push version identifier in the javascript library.
Push version number in the CHANGELOG.
Build debug and minified version of the javascript library.
Commit the new version in git and tag it
Build the web2py plugin file
EXAMPLES
> buildVersion -h
> buildVersion -g
> buildVersion -g 0.8.2
> buildVersion -a 0.8.3
AUTHOR
R. Le Gac, renaud.legac@free.fr
Copyright (c) 2012-2014 R. Le Gac
"""
import datetime
import optparse
import os
import re
import subprocess
import sys
import tempfile
import urllib
# constants
APP = os.path.basename(os.getcwd())
CHANGELOG = 'static/CHANGELOG'
JSLIBDEBUG = 'static/track-lhcbfrance-debug.js'
JSLIBMIN = 'static/track-lhcbfrance-min.js'
JSLIBSRC = 'static/src'
HTMLDOC = 'static/docs/epydoc'
NOW = datetime.datetime.now()
# basic commands
GIT = '/usr/bin/git'
YUICOMPRESSOR = os.path.expandvars("$HOME/lib/yuicompressor-2.4.7/build/yuicompressor-2.4.7.jar")
def clean():
"""Clean the previous build.
"""
for el in (JSLIBDEBUG, JSLIBMIN):
if os.path.exists(el):
os.remove(el)
print 'file', el, 'is removed.'
def epydoc():
"""Generate the epydoc documentation
The HTML files are located in static/docs/epydoc/
"""
# create the directory
if not os.path.exists(HTMLDOC):
os.makedirs(HTMLDOC)
# inhibit the __init__.py files
# to avoid long modules path in the documentation
os.rename("__init__.py", "__init__.py.ref")
os.rename("modules/__init__.py", "modules/__init__.py.ref")
# clean the directory
for el in os.listdir(HTMLDOC):
os.remove(os.path.join(HTMLDOC, el))
cmd = ["epydoc", "--docformat", "epytext",
"--html",
"--name", "plugin_dbui",
"-o", HTMLDOC,
"--parse-only",
"-v",
"modules/*.py"]
subprocess.call(cmd)
# restore the __init__.py files
os.rename("__init__.py.ref", "__init__.py")
os.rename("modules/__init__.py.ref", "modules/__init__.py")
print "HTML documentation in", HTMLDOC
def get_version():
"""Return the identifier of the current version.
"""
fi = tempfile.TemporaryFile()
subprocess.call(["git", "describe", "--tags"], stdout=fi)
fi.seek(0)
return fi.read()
def git():
"""Commit and tag the current release.
"""
# check tag in git
fi = tempfile.TemporaryFile()
subprocess.call(["git", "tag"], stdout=fi)
fi.seek(0)
if opt.git in fi.read():
print "\n\ttag %s already exit in git" % opt.git
sys.exit(1)
# modify the CHANGELOG
set_version(opt.git)
# release message
m = "Release version %s" % opt.git
# Commit the new release in git an tag it
print 'git add', CHANGELOG
cmd = ["git", "add", CHANGELOG]
subprocess.call(cmd)
print 'git commit'
cmd = ["git", "commit", "-m", m]
subprocess.call(cmd)
# annotated tag
print 'git tag', opt.git
cmd = ["git", "tag", "-a", opt.git, "-m", m]
subprocess.call(cmd)
def set_version(version):
"""Set version identifier in CHANGELOG
"""
# look for a pattern HEAD in the CHANGELOG
# split the the string in 2 parts (pre HEAD, post HEAD)
print 'Set version in', CHANGELOG
s = open(CHANGELOG, 'rb').read()
m = re.match("(.+HEAD\n)(.*)", s, re.DOTALL)
if m == None:
print '\n\tNo HEAD tag in the CHANGELOG!\n'
rep = raw_input('\tDo you want to continue [n]?')
if rep not in ('y', 'yes'):
sys.exit(1)
# update the version and edit the CHANGELOG
s = '%s\n%s (%s)\n%s' % (m.group(1), version, NOW.strftime('%b %Y'), m.group(2))
fi = open(CHANGELOG, 'wb')
fi.write(s)
fi.close()
subprocess.call(["vim", CHANGELOG])
# cleaning
os.remove("%s~" % CHANGELOG )
def yuicompressor():
"""Compresssed and minified the javascript library.
"""
# debug version of the javascript library
print 'Debug version of the javascript library', JSLIBDEBUG
subprocess.call('cat %s/*.js > %s' % (JSLIBSRC, JSLIBDEBUG), shell=True)
# Minified version of the javascript library
print 'Minified version of the javascript library', JSLIBMIN
cmd = ["java", "-jar", YUICOMPRESSOR, "-o", JSLIBMIN, JSLIBDEBUG]
subprocess.call(cmd)
if __name__ == '__main__':
# check that basic commands are there
for cmd in (GIT, YUICOMPRESSOR):
if not os.path.exists(cmd):
print '\n\t%s application is missing !' % cmd
sys.exit(1)
# define script options
ops = optparse.OptionParser()
ops.add_option("-a", "--all",
action="store_true",
dest= "all",
help= "run all steps.")
ops.add_option("-c", "--clean",
action="store_true",
dest= "clean",
help= "clean build files and exit.")
ops.add_option("-e", "--epydoc",
action="store_true",
dest= "epydoc",
help= "generate the epydoc documentation.")
ops.add_option("-g", "--git",
dest= "git",
help= "commit and tag the current release.")
ops.add_option("-r", "--release",
action="store_true",
dest= "get",
help= "get the tag of the current release and exit.")
ops.add_option("-y", "--yuicompressor",
action="store_true",
dest= "yuicompressor",
help= "compressed and minified the javascript libraries.")
ops.set_defaults(all=False,
clean=False,
epydoc=False,
get=False,
git=None,
yuicompressor=False)
(opt, args) = ops.parse_args()
# the version of the current release
if opt.get:
version = get_version()
print "\nThe version of the current release is %s\n" % version
sys.exit(0)
# run all steps
if opt.all:
opt.clean = True
opt.epydoc = True
opt.git = True
opt.yuicompressor = True
# process
print '\nStart buildVersion'
if opt.clean:
clean()
sys.exit(0)
if opt.epydoc:
epydoc()
if opt.yuicompressor:
yuicompressor()
if opt.git:
git()
print 'Exit buidVersion\n'
sys.exit(0)
\ No newline at end of file
......@@ -16,12 +16,14 @@ def documentations():
di["epydoc_dbui"] = URL('static', 'plugin_dbui/docs/epydoc/index.html')
di["epydoc_application"] = URL('static', 'docs/epydoc/index.html')
di["js_mathjax"] = URL('static', 'plugin_mathjax/docs/html/index.html')
di["jsduck_dbui"] = URL('static', 'plugin_dbui/docs/jsduck/index.html')
di["png_db"] = URL('static', 'docs/database.png')
return di
@auth.requires_login()
# @auth.requires_login()
def index():
"""Main Controller to run the application launching the plugin dbui.
......@@ -40,6 +42,9 @@ def index():
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)
......
......@@ -15,10 +15,6 @@ def hardware():
# instantiate the selector
selector = MySelector(virtdb.hardware_selector)
iframe = selector.download()
if iframe:
return iframe
# add constraint to select only hardware item
selector.append_query(db.events.category == 'hardware')
......@@ -47,10 +43,6 @@ def list():
'period_end',
'year'))
iframe = selector.download()
if iframe:
return iframe
# handle the category constraint
if selector.category:
selector.append_query(db.people_categories.category == selector.category)
......@@ -80,10 +72,6 @@ def people():
'period_end',
'year'))
iframe = selector.download()
if iframe:
return iframe
# add constraints to select category of people
if selector.category:
selector.append_query(db.people_categories.category == selector.category)
......@@ -112,10 +100,6 @@ def responsibilities():
# instantiate the selector
selector = MySelector(virtdb.responsibilities_selector)
iframe = selector.download()
if iframe:
return iframe
# add constraint to select only hardware item
selector.append_query(db.events.category == 'responsabilité')
......@@ -140,10 +124,6 @@ def trainee():
# instantiate the selector
selector = MySelector(virtdb.trainee_selector)
iframe = selector.download()
if iframe:
return iframe
# add constraint to select only trainee item
selector.append_query(db.people_categories.category == 'stagiaire')
......
......@@ -17,10 +17,6 @@ def people_per_category():
'period_end',
'year'))
iframe = selector.download()
if iframe:
return iframe
field = db.people_categories.category
count = CountPeople(field)
rows = count(selector)
......@@ -43,10 +39,6 @@ def people_per_quality():
'period_end',
'year'))
iframe = selector.download()
if iframe:
return iframe
field = db.people_categories.code
count = CountPeople(field)
rows = count(selector)
......@@ -69,10 +61,6 @@ def people_per_team():
'period_end',
'year'))
iframe = selector.download()
if iframe:
return iframe
field = db.teams.team
count = CountPeople(field)
rows = count(selector)
......
......@@ -21,14 +21,10 @@ def index():
selector_name = plugins.report.selector_name
selector = MySelector(virtdb[selector_name])
iframe = selector.download()
if iframe:
return iframe
# the configuration of the table can be chosen via the URL
if request.vars.id_report_objects:
selector.id_report_objects = request.vars.id_report_objects
# instantiate the report and link it to a selector
report = Report(selector)
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
NAME
cpAdmin -- copy the web2py admin file in the current application
SYNOPSIS
cpAdmin [options]
DESCRIPTION
Copy or remove the web2py admin file in the current application.
Usefull to fix some problem with the database
EXAMPLES
> cpAdmin -h
> cpAdmin
> cpAdmin --clean
AUTHOR
R. Le Gac, renaud.legac@free.fr
Copyright (c) 2012 R. Le Gac
"""
import os
import shutil
import sys
DIRS = ['static/css',
'static/images',
'static/js']
FILES = ['controllers/appadmin.py',
'static/css/calendar.css',
'static/css/skeleton.css',
'static/css/superfish.css',
'static/css/web2py.css',
'static/images/arrows-ffffff.png',
'static/images/css3buttons_backgrounds.png',
'static/images/css3buttons_icons.png',
'static/images/poweredby.png',
'static/images/shadow.png',
'static/images/ui-icons_222222_256x240.png',
'static/js/calendar.js',
'static/js/dd_belatedpng.js',
'static/js/jquery.js',
'static/js/modernizr.custom.js',
'static/js/superfish.js',
'static/js/web2py.js',
'static/favicon.ico',
'static/favicon.png',
'views/appadmin.html',
'views/generic.html',
'views/generic.json',
'views/generic.jsonp',
'views/generic.load',
'views/generic.pdf',
'views/generic.rss',
'views/generic.xml',
'views/layout.html',
'views/web2py_ajax.html',]
def check():
"""check that the reference application is there.
"""
path = os.path.join(opt.web2py, opt.refapp)
if not os.path.exists(path):
print "\n\tThe reference web2py application foo is missing"
print "\tUse the option -w to specified another ones.\n"
sys.exit(0)
def clean():
"""clean admin files.
"""
# remove individual files
for path in FILES:
if os.path.exists(path):
print "\removing", path
os.remove(path)
# remove empty directories
for path in DIRS:
try:
print"\tremoving", path
os.rmdir(path)
except:
pass
def copy():
"""copy admin files in the current applications
"""
# create directories
for path in DIRS:
if not os.path.exists(path):
print "\tcreating", path
os.mkdir(path)
# copy files from reference applications
for dest in FILES:
if not os.path.exists(dest):
src = os.path.join(opt.web2py, opt.refapp, dest)
print "\tcopying", dest
shutil.copy(src, dest)
if __name__ == '__main__':
import optparse
# define script options
ops = optparse.OptionParser()
ops.add_option("-c", "--clean",
action="store_true",
dest= "clean",
help= "remove admin files and exit.")
ops.add_option("-r", "--reference-application",
dest= "refapp",
help= "name of the reference applications [%default].")
ops.add_option("-w", "--web2py",
dest= "web2py",
help= "path to the web2py applications [%default].")
ops.set_defaults(clean=False,
refapp='foo',
web2py=os.path.expanduser('~/myweb/web2py/applications'))
(opt, args) = ops.parse_args()
# clean the admin file and exit
if opt.clean:
print "removing admin files..."
clean()
print "removing is successful !"
sys.exit(0)
# check that reference application exists
# copy admin files from the reference application and exit
check()
print "adding admin files..."
copy()
print "adding is successful !"
sys.exit(0)
\ No newline at end of file
......@@ -14,6 +14,7 @@
'Agencies': 'Agences',
'agencies': 'agences',
'Agency': 'Agence',
'Alignments': 'Alignments',
'Are you sure you want to delete this object?': 'Are you sure you want to delete this object?',
'auth_cas': 'auth_cas',
'auth_event': 'auth_event',
......@@ -23,6 +24,7 @@
'auth_user': 'auth_user',
'Birth Date': 'Né le',
'budgets': 'budgets',
'Can be applied on any field of the table using the SQL WHERE syntax. Be aware that foreign key are not resolved (more information in the smart_query in the web2py documentation).': 'Can be applied on any field of the table using the SQL WHERE syntax. Be aware that foreign key are not resolved (more information in the smart_query in the web2py documentation).',
'can be applied on any field of the table using the SQL WHERE syntax. Be aware that foreign key are not resolved (see smart_query in the web2py)': 'can be applied on any field of the table using the SQL WHERE syntax. Be aware that foreign key are not resolved (see smart_query in the web2py)',
"Can't delete this record since several transactions refer to it.": 'Cet enregistrement ne peut pas être détruit car il est utilisé dans la table historique.',
'Cannot be empty': 'Cannot be empty',
......@@ -41,6 +43,10 @@
'Columns': 'Colonnes',
'Conditions': 'Conditions',
'Configuration': 'Configuration',
'Configure lists': 'Configurer les listes',
'Configure people': 'Configurer les personnels',
'Configure responsibilities': 'Configurer les responsabilités',
'Configure teams': 'Configurer les équipes',
'contains': 'contiens',
'Contract': 'Contrat',
'Controller': 'Controller',
......@@ -48,16 +54,24 @@
'Cost': 'Coût',
'Count people': 'Nombre de personne',
'Coverage': 'Coverage',
'Coverage 2': 'Coverage 2',
'Coût': 'Coût',
'Created By': 'Created By',
'Created On': 'Created On',
'Data people': 'Les données des personnes',
'database schema': 'schéma de la base de données',
'Defined a year or a time period !!!': 'Defined a year or a time period !!!',
'Definition': 'Définition',
'Demanded': 'Demandé',
'Description': 'Description',
'Dictionary associating a column and its alignment (left, center, right). The key is a column name encoded as tablename.columnname ': 'Dictionary associating a column and its alignment (left, center, right). The key is a column name encoded as tablename.columnname ',
'Dictionary associating a column and its alignment (left, center, right). The key is a column name encoded as tablename.fieldname ': 'Dictionary associating a column and its alignment (left, center, right). The key is a column name encoded as tablename.fieldname ',
'Dictionary associating the column and the function used to represent the field. The key is a column name encoded as tablename.columnname while the value is a name of the function defined in the table report_functions.': 'Dictionary associating the column and the function used to represent the field. The key is a column name encoded as tablename.columnname while the value is a name of the function defined in the table report_functions.',
'Dictionary associating the column and the function used to represent the field. The key is a column name encoded as tablename.fieldname or operator(tablename.fieldname) .The value is a name of the function defined in the table report_functions.': 'Dictionary associating the column and the function used to represent the field. The key is a column name encoded as tablename.fieldname or operator(tablename.fieldname) .The value is a name of the function defined in the table report_functions.',
'Dictionary associating the column name and the column label. The dictionary is encoded as {tablename.columnname: label, ...}': 'Dictionaire associant un champ et son étiquette. The dictionaire est encodé {tablename.columnname: étiquette, ...}',
'Dictionary associating the column name and the function used to represent the field. The dictionary is encoded as {tablename.columnname: function, ...}': 'Dictionaire associant un champ et la function pour le représenté. Le dictionaire est encodé {tablename.columnname: fonction, ...}',
'Dictionary associating the column name with the column label. The key is a column name encoded as tablename.columnname while the value is a string.': 'Dictionary associating the column name with the column label. The key is a column name encoded as tablename.columnname while the value is a string.',
'Dictionary associating the column name with the column label. The key is a column name encoded as tablename.fieldname. The value is a string.': 'Dictionary associating the column name with the column label. The key is a column name encoded as tablename.fieldname. The value is a string.',
'documentations': 'documentations',
'Domain': 'Domaine',
'Domaine': 'Domaine',
......@@ -67,6 +81,7 @@
'end': 'fin',
'End Date': 'Date de fin',
'enter a number between %(min)g and %(max)g': 'enter a number between %(min)g and %(max)g',
'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 date as %(format)s': 'enter date as %(format)s',
'Event': 'Evènement',
......@@ -74,6 +89,7 @@
'events': 'évènements',
'Evènement': 'Evènement',
'Executed': 'Executé',
'Feature not yet implemented ...': 'Feature not yet implemented ...',
'Field': 'Champ',
'Filter agencies': 'Filtrer les agences',
'Filter budgets': 'Filtrer les budgets',
......@@ -93,7 +109,10 @@
'Format': 'Format',
'Formats': 'Formats',
'Forms': 'Formulaire',