Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
tev
plugin_event
Commits
a8f4db16
Commit
a8f4db16
authored
Mar 06, 2014
by
LE GAC Renaud
Browse files
Migrate to dbui 0.6.0.14 and Ext JS 4.2.1
parent
da308dbd
Changes
49
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
506 additions
and
331 deletions
+506
-331
.gitignore
.gitignore
+2
-0
buildVersion.py
buildVersion.py
+271
-0
controllers/default.py
controllers/default.py
+2
-0
controllers/list.py
controllers/list.py
+0
-20
controllers/metric.py
controllers/metric.py
+0
-12
cpAdmin
cpAdmin
+0
-151
languages/fr-fr.py
languages/fr-fr.py
+12
-0
models/access.py
models/access.py
+21
-6
models/auth.py
models/auth.py
+2
-2
models/common_settings.py
models/common_settings.py
+72
-0
models/db.py
models/db.py
+0
-140
models/db_events.py
models/db_events.py
+11
-0
models/db_fundings.py
models/db_fundings.py
+10
-0
models/db_history.py
models/db_history.py
+29
-0
models/db_organization_levels.py
models/db_organization_levels.py
+10
-0
models/db_organizations.py
models/db_organizations.py
+10
-0
models/db_people.py
models/db_people.py
+13
-0
models/db_people_categories.py
models/db_people_categories.py
+22
-0
models/db_projects.py
models/db_projects.py
+9
-0
models/db_teams.py
models/db_teams.py
+10
-0
No files found.
.gitignore
View file @
a8f4db16
...
...
@@ -8,8 +8,10 @@ databases
databases*/
errors/
private/
*plugin_ace*
*plugin_dbui*
*plugin_extjs*
*plugin_mathjax*
sessions/
static/docs/epydoc
uploads/
buildVersion.py
0 → 100755
View file @
a8f4db16
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
NAME
buildVersion -- helper script to build and tag a track_teams version
SYNOPSIS
buildVersion [options] version
DESCRIPTION
Helper script to build a version of the track_teams.
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-teams-debug.js'
JSLIBMIN
=
'static/track-teams-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\t
tag %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\t
No HEAD tag in the CHANGELOG!
\n
'
rep
=
raw_input
(
'
\t
Do 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
"
\n
The 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
'
\n
Start 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
controllers/default.py
View file @
a8f4db16
...
...
@@ -16,6 +16,8 @@ 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
...
...
controllers/list.py
View file @
a8f4db16
...
...
@@ -14,10 +14,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'
)
...
...
@@ -46,10 +42,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
)
...
...
@@ -79,10 +71,6 @@ def people():
'period_start'
,
'period_end'
))
iframe
=
selector
.
download
()
if
iframe
:
return
iframe
# add constraint to avoid event (diploma, distinction,...)
selector
.
append_query
(
db
.
history
.
id_events
==
undef_id
)
...
...
@@ -114,10 +102,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é'
)
...
...
@@ -142,10 +126,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'
)
...
...
controllers/metric.py
View file @
a8f4db16
...
...
@@ -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
)
...
...
cpAdmin
deleted
100755 → 0
View file @
da308dbd
#!/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\t
The reference web2py application foo is missing"
print
"
\t
Use 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
"
\r
emoving"
,
path
os
.
remove
(
path
)
# remove empty directories
for
path
in
DIRS
:
try
:
print
"
\t
removing"
,
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
"
\t
creating"
,
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
"
\t
copying"
,
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
languages/fr-fr.py
View file @
a8f4db16
...
...
@@ -37,6 +37,9 @@
'Client IP'
:
'Client IP'
,
'Code'
:
'Code'
,
'Collections'
:
'Collections'
,
'Configure people'
:
'Configurer les personnes'
,
'Configure responsibilities'
:
'Configurer les responsabilités'
,
'Configure teams'
:
'Configurer les équipes'
,
'contains'
:
'contiens'
,
'Contract'
:
'Contrat'
,
'Controller'
:
'Controller'
,
...
...
@@ -47,6 +50,7 @@
'Coût'
:
'Coût'
,
'Created By'
:
'Created By'
,
'Created On'
:
'Created On'
,
'Data people'
:
'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'
,
...
...
@@ -94,6 +98,7 @@
'Group'
:
'Group'
,
'Group ID'
:
'Group ID'
,
'Group uniquely assigned to user %(id)s'
:
'Group uniquely assigned to user %(id)s'
,
'groups'
:
'groupes'
,
'hardware'
:
'matériel'
,
'Hardware'
:
'Matériel'
,
'Hardware Cost'
:
'Hardware Cost'
,
...
...
@@ -145,6 +150,7 @@
'Notified'
:
'Notifié'
,
'Object or table name'
:
'Object or table name'
,
'Organization'
:
'Organisation'
,
'organization_level'
:
"Niveau de l'organisation"
,
'organization_levels'
:
"niveau de l'organisation"
,
'organizations'
:
'organisations'
,
'Origin'
:
'Origin'
,
...
...
@@ -152,7 +158,11 @@
"Password fields don't match"
:
"Password fields don't match"
,
'people'
:
'personnes'
,
'People'
:
'Personnes'
,
'People per category'
:
'Personne par catégories'
,
'People per quality'
:
'People per quality'
,
'People per team'
:
'People per team'
,
'people_categories'
:
'catégories de personnel'
,
'Perc.'
:
'Perc.'
,
'Percentage'
:
'Pourcentage'
,
'Period'
:
'Période'
,
'Period End'
:
'Period End'
,
...
...
@@ -179,6 +189,7 @@
'Registration identifier'
:
'Registration identifier'
,
'Registration key'
:
'Registration key'
,
'Registration successful'
:
'Registration successful'
,
'relation user / groups'
:
'relation utlisateur / groupes'
,
'Reports'
:
'Rapports'
,
'Reset Password key'
:
'Reset Password key'
,
'responsibilities'
:
'responsabilités'
,
...
...
@@ -215,6 +226,7 @@
'User %(id)s Logged-in'
:
'User %(id)s Logged-in'
,
'User %(id)s Registered'
:
'User %(id)s Registered'
,
'User ID'
:
'User ID'
,
'users'
:
'utilisateurs'
,
'Usual'
:
'Habituel'
,
'value already in database or empty'
:
'value already in database or empty'
,
'Verify Password'
:
'Verify Password'
,
...
...
models/access.py
View file @
a8f4db16
# -*- coding: utf-8 -*-
""" access
setup the connection to the databases
setup the connection to the databases.
Define constants for the different role
"""
DB_MYSQL
=
'mysql://GesProd:Prod_CPPM@maretude.in2p3.fr/TrackTeams'
MIGRATE
=
False
# constant defining the different roles
ID_ADMIN
,
ADMIN
,
DEF_ADMIN
=
1
,
'admin'
,
'administrators, team leader,...'
ID_USER
,
USER
,
DEF_USER
=
2
,
'user'
,
'project leader,...'
# database migration flag
MIGRATE
=
False
#-------------------------------------------------------------------------------
#
# MYSQL database
#
#-------------------------------------------------------------------------------
# connection to the database
try
:
db
=
DAL
(
DB_MYSQL
,
migrate_enabled
=
MIGRATE
,
pool_size
=
10
)
except
:
raise
HTTP
(
500
,
T
(
"Can't access the MySQL database !!!"
))
# db = DAL('sqlite://storage.sqlite', migrate_enabled=MIGRATE)
\ No newline at end of file
#-------------------------------------------------------------------------------
#
# SQLITE database (test)
#
#-------------------------------------------------------------------------------
# db = DAL('sqlite://storage.sqlite', migrate_enabled=MIGRATE)
#-------------------------------------------------------------------------------
#
# virtual database
#
#-------------------------------------------------------------------------------
virtdb
=
DAL
(
None
)