Commit f82a2b18 authored by legac's avatar legac
Browse files

Migrate to web2py_plugin_dbui 0.4.7.1

parent 112a37f7
*~
.project
.pydevproject
.settings/
......@@ -6,7 +7,8 @@ cron/
databases/
errors/
private/
*plugin_dbui*
*plugin_extjs*
*plugin_mathjax*
sessions/
static/plugin_dbui/
static/plugin_mathjax/
uploads/
......@@ -33,24 +33,22 @@ DIRS = ['static/css',
'static/js']
FILES = ['controllers/appadmin.py',
'static/css/anytime.css',
'static/css/base.css',
'static/css/handheld.css',
'static/css/superfish-navbar.css',
'static/css/superfish-vertical.css',
'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/anytime.js',
'static/js/calendar.js',
'static/js/dd_belatedpng.js',
'static/js/jquery.js',
'static/js/modernizr-1.7.min.js',
'static/js/modernizr.custom.js',
'static/js/superfish.js',
'static/js/web2py_ajax.js',
'static/js/web2py.js',
'static/favicon.ico',
'static/favicon.png',
'views/appadmin.html',
......
# coding: utf8
# French translation
{
'Category': 'Category',
'Code': 'Code',
'Collections': 'Collections',
'Controller': 'Controller',
'Definition': 'Definition',
'Forms': 'Forms',
'Host': 'Host',
'Id': 'Id',
'Max Records': 'Max Records',
'Ratio': 'Ratio',
'Select': 'Select',
'Store': 'Store',
'Tables': 'Tables',
'Team': 'Team',
'Tools': 'Tools',
'Year': 'Year',
'Year End': 'Year End',
'Year Start': 'Year Start',
'categories': 'categories',
'enter a number between %(min)g and %(max)g': 'enter a number between %(min)g and %(max)g',
'enter an integer between %(min)g and %(max)g': 'enter an integer between %(min)g and %(max)g',
'harvesters': 'harvesters',
'teams': 'teams',
'undefined': 'undefined',
}
# -*- coding: utf-8 -*-
""" db
Defined the database tables for your applications.
Initialized the dbui plugins
Defined the database tables for the applications.
"""
import locale
from datetime import datetime
from gluon.tools import PluginManager
dbui = local_import('plugin_dbui')
undef = T(dbui.UNDEF)
undef_id = dbui.UNDEF_ID
year = datetime.now().year
#-------------------------------------------------------------------------------
#
# web2py-dbui plugin parameters
# plugin configuration parameters
#
#-------------------------------------------------------------------------------
#plugins = PluginManager()
#plugins.dbui.script_path = 'static/scripts'
#plugins.dbui.page_view = 'plugin_dbui.html'
plugins = PluginManager()
plugins.dbui.app_css = 'static/my.css'
#plugins.dbui.app_js_dir = None
#plugins.dbui.app_libmin = None
#plugins.dbui.app_script = None
plugins.dbui.app_script_dir = 'static/scripts'
#-------------------------------------------------------------------------------
#
# set the languages for the application
# The language has also to be defined in the internationalization service,
# locale, since it is use latter on to order list in alphabetic order.
#
#-------------------------------------------------------------------------------
T.set_current_languages('en', 'en-gb', 'en-us') # mother tongue
......
# -*- coding: utf-8 -*-
""" db_insert
""" defaults
Insert defaults values in the tables
"""
if not db(db.categories.id).count():
db.categories.insert(id=1, code= T('undefined'), definition=T('undefined'))
db.categories.insert(id=undef_id, code=undef, definition=undef)
if not db(db.teams.id).count():
db.teams.insert(id=1, team=T('undefined'))
\ No newline at end of file
db.teams.insert(id=undef_id, team=undef)
\ No newline at end of file
# -*- coding: utf-8 -*-
""" dummy
""" virtdb
Defined tables in a dummy database.
Defined tables in a virtual database.
They are used to build forms in order to generate url, ....
taking benefit of the web2py validators
......@@ -9,20 +9,20 @@
"""
dummy = DAL(None)
virtdb = DAL(None)
# harvester selector
dummy.define_table('harvester_selector',
virtdb.define_table('harvester_selector',
Field('year_start', 'integer', default=year),
Field('year_end', 'integer'),
Field('id_teams', db.teams, default=2, label='Team'),
Field('store', 'string', default='articles'))
dummy.harvester_selector.id_teams.requires = IS_IN_DB(db,
virtdb.harvester_selector.id_teams.requires = IS_IN_DB(db,
'teams.id',
'teams.team')
dummy.harvester_selector.store.requires = IS_IN_SET(['articles',
virtdb.harvester_selector.store.requires = IS_IN_SET(['articles',
'proceedings',
'reports',
'talks'])
......@@ -5,13 +5,15 @@
"""
#
# add plugin to all grids
# add plugins to all forms and grids
#
dbui.configure_grids(db, plugins=['pGridRowEditor',
dbui.configure_grids(db, plugins=['pGridRowEditorConfirmDelete',
'pGridRowEditorContextMenu',
'pGridPaging',
'pGridMathJax'])
dbui.configure_forms(db, plugins=['pFormToolTip'])
#
# merge fields in the harvest_selector forms
#
......@@ -21,24 +23,38 @@ fieldsModifier.configure_field('year_end', flex=1)
fieldsModifier.merge_fields('year_start', 'year_end', fieldLabel=T('Year'))
#
# The navigation tree
# The form node of the navigation tree
#
formNode = dbui.Node(T('Forms'))
configurator = lambda tablename: cvtSvc.to_form_panel(db[tablename])
configurator = lambda tablename: dbui.to_formPanel(db[tablename])
formNode.add_children(db.tables, func=configurator)
#
# The grid node of the navigation tree
#
gridNode = dbui.Node(T('Tables'))
configurator = lambda tablename: cvtSvc.to_grid_panel(db[tablename])
configurator = lambda tablename: dbui.to_gridPanel(db[tablename])
gridNode.add_children(db.tables, func=configurator)
#
# The tool node of the navigation tree
#
fields = dbui.to_fields(virtdb.harvester_selector)
selector = dbui.FieldSet(items=fields, plugins=['pFormToolTip'],
title=T('Select'))
harvesterNode = dbui.PanelWithUrlSelector(baseUrl='/'+request.application+'/harvest',
ctrlField='Harvester_selectorStore',
isMathJax=False,
panelCfg=dbui.Panel(),
selectorCfg=selector,
selectorCollapsible=False,
timeout=3600)
toolNode = dbui.Node(T('Tools'))
form_items = cvtSvc.to_form_items(dummy.harvester_selector)
cfg = dbui.to_panelWithUrlSelector(form_items,
controller='harvest',
title='Select',
ctrlField='Harvester_selectorStore')
toolNode.add_child(T('harvesters'), cfg)
toolNode.add_child(T('harvesters'), harvesterNode)
toolNode.sort_children()
#
# The viewport with its navigation tree
#
viewportModifier = dbui.ViewportModifier()
viewportModifier.add_node(formNode, gridNode, toolNode)
/*
* CSS Class definition for application reporting
*/
.my-h2
.my-li,
.my-ol,
.my-p,
.my-table,
.my-td,
.my-th,
.my-tr,
.my-ul,
.my-ul-none {font-family: Liberation Sherif, Sherif;
font-size: 11px;}
/*
* Body
*/
.my-h2 {font-family: Liberation Sans, Sans;
margin-bottom: 2ex;
margin-left: 3%;
margin-top: 3ex;}
.my-p {margin-left: 3%;
text-align: justify;}
/*
* Font
*/
.my-large {font-size: 90%;}
/*
* List
*/
.my-li {margin-bottom: 1ex;
margin-left: 9%;
margin-right: 9%;
text-align: justify;}
.my-ol {list-style-type: decimal;}
.my-ul {list-style-type: disc;}
.my-ul-none {list-style-type: none;}
/*
* Table
*/
.my-td,
.my-th,
.my-tr {outline-style: solid;
outline-width: 1px;
outline-color: LightGray;
padding-left: 5px;
padding-right: 5px;}
/*
* Text
*/
.my-left {text-align: left;}
.my-right {text-align: right;}
.my-small-cap {font-variant: small-caps;}
\ No newline at end of file
/**
* combo_1.js
*
* To test and debug combo widget with a local store.
* $Id$
*
*/
Ext.onReady(function(){
Ext.QuickTips.init();
var store = new Ext.data.JsonStore({
fields: ['id', 'idcategory', 'category'],
data: [
{id: 1, idcategory: 10, category: 'database'},
{id: 2, idcategory: 11, category: 'development'},
{id: 3, idcategory: 12, category: 'emulator'},
{id: 4, idcategory: 13, category: 'system'}
]
});
var combo = new Ext.form.ComboBox({
selectOnFocus: true,
triggerAction: 'all',
typeAhead: true,
displayField: "category",
fieldLabel: "Category",
valueField: "id",
hiddenName: "idcategory",
emptyText: "Select a category... ",
mode: 'local',
store: store,
});
combo.on("select", function(){
console.log(this.getValue());
});
combo.on('render', function(c){
new Ext.ToolTip({
target: c.getEl(),
anchor: 'right',
trackMouse: true,
html: 'Tracking while you move the mouse'
});
});
var panel = new Ext.Panel({
renderTo: "appmain",
bodyStyle: 'padding:5px 5px 0',
height: 50,
width: 350,
frame: true,
labelWidth: 75,
items: [combo],
});
// // select a value
// combo.setValue(2);
});
\ No newline at end of file
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