diff --git a/controllers/app.py b/controllers/app.py deleted file mode 100644 index bb3b2283decacc71fc939d001512b4dbd4e26ea0..0000000000000000000000000000000000000000 --- a/controllers/app.py +++ /dev/null @@ -1,33 +0,0 @@ -""" $Id$ """ -import os - -def index(): - """Controller loading javascript librairies and launching the application. - - """ - - # application path - base = os.path.join(os.path.sep, request.application) - - # css files - csslibs = [os.path.join(base, 'static', 'extjs', 'resources', 'css', 'ext-all.css'), - os.path.join(base, 'static', 'dbjs', 'icons.css')] - - # javascript librairies - jslibs = [os.path.join(base, 'static', 'extjs', 'ext-base.js'), - os.path.join(base, 'static', 'extjs', 'ext-all.js'), - os.path.join(base, 'static', 'dbjs', 'base.js'), - os.path.join(base, 'static', 'dbjs', 'action.js'), - os.path.join(base, 'static', 'dbjs', 'jsonstore.js'), - os.path.join(base, 'static', 'dbjs', 'combobox.js'), - os.path.join(base, 'static', 'dbjs', 'entryform.js'), - os.path.join(base, 'static', 'dbjs', 'vieweditgrid.js')] - - # application librairies - applibs = [os.path.join(base, 'static', 'appjs', 'core.js'), - os.path.join(base, 'static', 'appjs', 'main.js')] - - # page view - response.view = "app.html" - - return dict(clibs=csslibs, jlibs=jslibs, alibs= applibs) \ No newline at end of file diff --git a/controllers/default.py b/controllers/default.py index 7fd628c28f92ecd060ea7136b02e015106e1adfe..52aadb2c4525430527214e21cae3b60f82b2d5ad 100644 --- a/controllers/default.py +++ b/controllers/default.py @@ -1,13 +1,40 @@ - - -# # sample index page with internationalization (T) -def index(): - response.flash = T('Welcome to mdvPostInstall') - return dict() - +""" $Id$ """ +import os # # uncomment the following if you have defined "auth" and "crud" in models # def user(): return dict(form=auth()) # def data(): return dict(form=crud()) # def download(): return response.download(request,db) # # tip: use @auth.requires_login, requires_membership, requires_permission + + +def index(): + """Controller loading javascript librairies and launching the application. + + """ + + # application path + base = os.path.join(os.path.sep, request.application) + + # css files + csslibs = [os.path.join(base, 'static', 'extjs', 'resources', 'css', 'ext-all.css'), + os.path.join(base, 'static', 'dbjs', 'icons.css')] + + # javascript librairies + jslibs = [os.path.join(base, 'static', 'extjs', 'ext-base.js'), + os.path.join(base, 'static', 'extjs', 'ext-all.js'), + os.path.join(base, 'static', 'dbjs', 'base.js'), + os.path.join(base, 'static', 'dbjs', 'action.js'), + os.path.join(base, 'static', 'dbjs', 'jsonstore.js'), + os.path.join(base, 'static', 'dbjs', 'combobox.js'), + os.path.join(base, 'static', 'dbjs', 'entryform.js'), + os.path.join(base, 'static', 'dbjs', 'vieweditgrid.js')] + + # application librairies + applibs = [os.path.join(base, 'static', 'appjs', 'core.js'), + os.path.join(base, 'static', 'appjs', 'main.js')] + + # page view + response.view = "app.html" + + return dict(clibs=csslibs, jlibs=jslibs, alibs= applibs) \ No newline at end of file diff --git a/controllers/forms.py b/controllers/forms.py deleted file mode 100644 index 35c5aa2a916ecb80bd03c06e5a20dfd808167f60..0000000000000000000000000000000000000000 --- a/controllers/forms.py +++ /dev/null @@ -1,17 +0,0 @@ -""" forms.py - - A set of controllers to handle basic forms - - $Id$ -""" - -def index(): - """Instanciate the form/index.html page - - Decode the request form in the url: /application/forms?name=xxx - Return the path of the javascript associate to it. - - """ - response.view = "forms.html" - table = request.get_vars.table - return dict(js=table) diff --git a/controllers/viewedit.py b/controllers/viewedit.py deleted file mode 100644 index c896d432dd3b9140bcf68d7aa66a8ee8e0c25e2c..0000000000000000000000000000000000000000 --- a/controllers/viewedit.py +++ /dev/null @@ -1,16 +0,0 @@ -""" viewedit.py - - A controller to view and edit table contents - - $Id$ -""" - -def index(): - """Instanciate the viewedit/index.html page - - Decode the request form in the url: /application/viewedit?table=xxx - Return the path of the javascript associate to it. - """ - response.view = "viewedit.html" - table = request.get_vars.table - return dict(js=table) \ No newline at end of file diff --git a/static/appjs/formdistributions.js b/static/appjs/formdistributions.js deleted file mode 100644 index 081c19e5396186f04bd3eed7226efac8ba892001..0000000000000000000000000000000000000000 --- a/static/appjs/formdistributions.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * formdistributions.js - * - * Form associated to the distributions table - * common configurations and actions are defined in appbase.js - * - * $Id$ - * - */ - -Ext.onReady(function(){ - - Ext.QuickTips.init(); - - // turn on validation errors beside the field globally - Ext.form.Field.prototype.msgTarget = 'side'; - - // Create the form - var form1 = new Db.EntryForm({ - title: 'Distribution', - table: 'distributions', - items: [{ - fieldLabel: 'Version', - name: 'version', - allowBlank:false - }, { - xtype: 'datefield', - fieldLabel: 'Date', - name: 'date', - format:'Y-m-d' - }, { - xtype: 'textarea', - fieldLabel: 'Note', - name: 'note', - grow: true - }] - }); - - form1.render(document.body); -}); - diff --git a/static/appjs/formrpmCategories.js b/static/appjs/formrpmCategories.js deleted file mode 100644 index 731e33f9f6dd5c48106c25f89908427fa53ad80e..0000000000000000000000000000000000000000 --- a/static/appjs/formrpmCategories.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * formrpmCategories.js - * - * Form associated to the rpmCategories table - * common configurations and actions are defined in appbase.js - * - * $id$ - * - */ - -Ext.onReady(function(){ - - Ext.QuickTips.init(); - - // turn on validation errors beside the field globally - Ext.form.Field.prototype.msgTarget = 'side'; - - // create the form - var form1 = new Db.EntryForm({ - title: 'Rpm Category', - table: 'rpmCategories', - items: [{ - fieldLabel: 'Name', - name: 'category', - allowBlank:false - }, { - xtype: 'textarea', - fieldLabel: 'Note', - name: 'note', - grow: true - }] - }); - - form1.render(document.body); - -}); - diff --git a/static/appjs/formrpms.js b/static/appjs/formrpms.js deleted file mode 100644 index b072ae01511072b2058a63f6db3ec735b7492962..0000000000000000000000000000000000000000 --- a/static/appjs/formrpms.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - * formrpms.js - * - * Form associated to the rpms table - * common configurations and actions are defined in appbase.js - * - * $Id$ - * - */ - -Ext.onReady(function(){ - - Ext.QuickTips.init(); - - // turn on validation errors beside the field globally - Ext.form.Field.prototype.msgTarget = 'side'; - - // create the form - var form1 = new Db.EntryForm({ - title: 'Rpm', - table: 'rpms', - items: [ - { - fieldLabel: 'Name', - name: 'rpm', - allowBlank: false - }, { - xtype: 'httpdbcombobox', - displayField: 'category', - fieldLabel: 'Category', - hiddenName: 'idcategory', - table: 'rpmCategories', - valueField: 'id' - }, { - xtype: 'httpdbcombobox', - displayField: 'version', - fieldLabel: 'Distribution', - hiddenName: 'iddistribution', - table: 'distributions', - valueField: 'id' - }, { - xtype: 'radiogroup', - fieldLabel: 'List', - columns: 1, - items: [ - {boxLabel: 'add', name: 'list', inputValue: 'add', checked: true}, - {boxLabel: 'remove', name: 'list', inputValue: 'remove'} - ] - }] - }); - - form1.render(document.body); - -}); - diff --git a/static/appjs/formsystems.js b/static/appjs/formsystems.js deleted file mode 100644 index cac135b81f0bb9b54e9f43a4d98eb5b25b8e0cf8..0000000000000000000000000000000000000000 --- a/static/appjs/formsystems.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * formsystems.js - * - * Form associated to the systems table - * common configurations and actions are defined in appbase.js - * - * $Id$ - * - */ - -Ext.onReady(function(){ - - Ext.QuickTips.init(); - - // turn on validation errors beside the field globally - Ext.form.Field.prototype.msgTarget = 'side'; - - // Create the form - var form1 = new Db.EntryForm({ - title: 'System', - table: 'systems', - items: [ - { - fieldLabel: 'Name', - name: 'system', - allowBlank:false - }, { - xtype: 'textarea', - fieldLabel: 'Note', - name: 'note', - grow: true - }] - }); - - // render the form - form1.render(document.body); - -}); - diff --git a/static/appjs/vieweditdistributions.js b/static/appjs/vieweditdistributions.js deleted file mode 100644 index 23cbb2f2bf76215cfd5590d8f5ea4f622bfa7ac3..0000000000000000000000000000000000000000 --- a/static/appjs/vieweditdistributions.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * vieweditdistributions.js - * - * GridEdit associated to the distributions table - * - * $Id$ - * - */ - - -Ext.onReady(function(){ - - Ext.QuickTips.init(); - - var mystore = new Db.JsonStore({ - table: 'distributions', - tableFields: ['id', 'version', 'note', 'date'], - }); - - // define the columns model for the grid - var mymodel = new Ext.grid.ColumnModel([ - new Ext.grid.RowNumberer(), - {header: "Id", width: 10, sortable: true, dataIndex: 'id', hidden: true}, - {header: "Version", width: 15, sortable: true, dataIndex: 'version'}, - {header: "Note", width: 70, sortable: true, dataIndex: 'note'}, - {header: "Date", width: 20, sortable: true, dataIndex: 'date'} - ]); - - // define the column model for the add form - var formItems = [{ - fieldLabel: 'Version', - name: 'version', - allowBlank:false - }, { - xtype: 'datefield', - fieldLabel: 'Date', - name: 'date', - format:'Y-m-d' - }, { - xtype: 'textarea', - fieldLabel: 'Note', - name: 'note', - grow: true - }]; - - // create the grid - var grid1 = new Db.ViewEditGrid({ - colModel: mymodel, - formModel: formItems, - store: mystore, - table: 'distributions', - title: 'Distributions', -// bbar: new Ext.PagingToolbar({ -// displayInfo: true, -// pageSize: 5, -// store: mystore -// }) - }); - - // render the grid - grid1.render(document.body); - -// mystore.load({params:{start:0, limit:5}}); - mystore.load(); - -}); diff --git a/static/appjs/vieweditrpms.js b/static/appjs/vieweditrpms.js deleted file mode 100644 index b9dc35b4900f3e9887cdd9116537f353cdb3e337..0000000000000000000000000000000000000000 --- a/static/appjs/vieweditrpms.js +++ /dev/null @@ -1,80 +0,0 @@ -/** - * vieweditrpms.js - * - * GridEdit associated to the rpms table - * - * $Id$ - * - */ - - -Ext.onReady(function(){ - - Ext.QuickTips.init(); - - var mystore = new Db.JsonStore({ - table: 'rpms', - tableFields: ['id', 'rpm', 'idcategory', 'iddistribution', 'list'], - foreignFields: [ - ['iddistribution', 'distributions', 'version'], - ['idcategory', 'rpmCategories', 'category'] - ] - }); - - // define the columns model for the grid - var mymodel = new Ext.grid.ColumnModel([ - new Ext.grid.RowNumberer(), - //{header: "Id", width: 10, sortable: true, dataIndex: 'id', hidden: true}, - {header: "Rpm", width: 50, sortable: true, dataIndex: 'rpm'}, - //{header: "idCategory", width: 30, sortable: true, dataIndex: 'idcategory'}, - //{header: "idDistribution", width: 20, sortable: true, dataIndex: 'iddistribution'}, - {header: "Distribution", width: 20, sortable: true, dataIndex: 'version'}, - {header: "Category", width: 20, sortable: true, dataIndex: 'category'}, - {header: "List", width: 20, sortable: true, dataIndex: 'list'} - ]); - - // define the column model for the add form - var formItems = [ - { - fieldLabel: 'Name', - name: 'rpm', - allowBlank: false - }, { - xtype: 'httpdbcombobox', - displayField: 'category', - fieldLabel: 'Category', - hiddenName: 'idcategory', - table: 'rpmCategories', - valueField: 'id' - }, { - xtype: 'httpdbcombobox', - displayField: 'version', - fieldLabel: 'Distribution', - hiddenName: 'iddistribution', - table: 'distributions', - valueField: 'id' - }, { - xtype: 'radiogroup', - fieldLabel: 'List', - columns: 1, - items: [ - {boxLabel: 'add', name: 'list', inputValue: 'add', checked: true}, - {boxLabel: 'remove', name: 'list', inputValue: 'remove'} - ] - }]; - - - // create the grid - var grid1 = new Db.ViewEditGrid({ - colModel: mymodel, - formModel: formItems, - store: mystore, - table: 'rpms', - title: 'Rpms', - }); - - // render the grid - grid1.render(document.body); - mystore.load(); - -}); diff --git a/views/app.html b/views/app.html deleted file mode 100644 index 680a3326d1ce283bf1e695cc8b026a69619f0f84..0000000000000000000000000000000000000000 --- a/views/app.html +++ /dev/null @@ -1,36 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> - <!-- $Id$ --> - <head> - <meta http-equiv="content-type" content="text/html; charset=utf-8" /> - <meta name="author" lang="en" content="{{=response.author}}" /> - <meta name="keywords" content="{{=response.keywords}}" /> - <meta name="description" content="{{=response.description}}" /> - <title>{{=response.title or URL(r=request)}}</title> - - <!-- css class --> - {{for el in clibs:}} - <link rel="stylesheet" type="text/css" href="{{=el}}"/>{{pass}} - - </head> - <body> - <!-- the loading indicator --> - <!-- javascript librairies --> - {{for el in jlibs:}} - <script type="text/javascript" src="{{=el}}"></script>{{pass}} - - <!-- Namespace and global variables for the application --> - <script type="text/javascript"> - Ext.namespace('App'); - App.name = '{{=request.application}}'; - </script> - - <!-- application scripts --> - {{for el in alibs:}} - <script type="text/javascript" src="{{=el}}"></script>{{pass}} - - </body> -</html> - - - diff --git a/views/applayout.html b/views/applayout.html index dd5c975dd88e152cc3478c856ee8658a040c7b2c..b90e5727c125bb73f3ee49ba6b773064571af5cf 100644 --- a/views/applayout.html +++ b/views/applayout.html @@ -1,24 +1,33 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <!-- $Id$ --> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="author" lang="en" content="{{=response.author}}" /> <meta name="keywords" content="{{=response.keywords}}" /> <meta name="description" content="{{=response.description}}" /> <title>{{=response.title or URL(r=request)}}</title> - <link rel="stylesheet" type="text/css" href="{{=URL(r=request,c='static/extjs/resources/css',f='ext-all.css')}}"/> - <script type="text/javascript" src="{{=URL(r=request,c='static/extjs',f='ext-base.js')}}"></script> - <script type="text/javascript" src="{{=URL(r=request,c='static/extjs',f='ext-all.js')}}"></script> - <script type="text/javascript" src="{{=URL(r=request,c='static/dbjs',f='base.js')}}"></script> - <script type="text/javascript" src="{{=URL(r=request,c='static/dbjs',f='action.js')}}"></script> - <script type="text/javascript" src="{{=URL(r=request,c='static/dbjs',f='jsonstore.js')}}"></script> - <script type="text/javascript" src="{{=URL(r=request,c='static/dbjs',f='combobox.js')}}"></script> - <script type="text/javascript" src="{{=URL(r=request,c='static/dbjs',f='entryform.js')}}"></script> - <script type="text/javascript" src="{{=URL(r=request,c='static/dbjs',f='vieweditgrid.js')}}"></script> - <link rel="stylesheet" type="text/css" href="{{=URL(r=request,c='static/dbjs',f='icons.css')}}"/> + + <!-- css class --> + {{for el in clibs:}} + <link rel="stylesheet" type="text/css" href="{{=el}}"/>{{pass}} + </head> <body> - <div id="header"></div> - {{include}} + <!-- the loading indicator --> + <!-- javascript librairies --> + {{for el in jlibs:}} + <script type="text/javascript" src="{{=el}}"></script>{{pass}} + + <!-- Namespace and global variables for the application --> + <script type="text/javascript"> + Ext.namespace('App'); + App.name = '{{=request.application}}'; + </script> + + <!-- application scripts --> + {{for el in alibs:}} + <script type="text/javascript" src="{{=el}}"></script>{{pass}} + </body> </html> diff --git a/views/default/index.html b/views/default/index.html deleted file mode 100644 index e0386796b88d4d2dcda156c5a755a159350d5d0b..0000000000000000000000000000000000000000 --- a/views/default/index.html +++ /dev/null @@ -1,19 +0,0 @@ -{{extend 'layout.html'}} - -<h2>New entries</h2> -<ul> -<li><a href='/mdvPostInstall/forms?table=distributions'>Distribution</a></li> -<li><a href='/mdvPostInstall/forms?table=rpmCategories'>Rpm category</a></li> -<li><a href='/mdvPostInstall/forms?table=rpms'>Rpm</a></li> -<li><a href='/mdvPostInstall/forms?table=systems'>System</a></li> -</ul> - -<h2>View and Edit</h2> -<ul> -<li><a href='/mdvPostInstall/viewedit?table=distributions'>Distribution</a></li> -<li><a href='/mdvPostInstall/viewedit?table=rpmCategories'>Rpm category</a></li> -<li><a href='/mdvPostInstall/viewedit?table=rpms'>Rpm</a></li> -<li><a href='/mdvPostInstall/viewedit?table=systems'>System</a></li> -</ul> - -<button onclick="document.location='{{=URL("admin","default","design",args=request.application)}}'">admin</button> diff --git a/views/forms.html b/views/forms.html deleted file mode 100644 index e856a44001aa12d790c5e2eec3d1c6ceb3f53e1a..0000000000000000000000000000000000000000 --- a/views/forms.html +++ /dev/null @@ -1,2 +0,0 @@ -{{extend 'applayout.html'}} -<script type="text/javascript" src="{{=URL(r=request,c='static/appjs' ,f='form%s.js' % js)}}"></script> diff --git a/views/viewedit.html b/views/viewedit.html deleted file mode 100644 index 6dbd9436c691ce3245063e0c88357fbbb1049ac3..0000000000000000000000000000000000000000 --- a/views/viewedit.html +++ /dev/null @@ -1,2 +0,0 @@ -{{extend 'applayout.html'}} -<script type="text/javascript" src="{{=URL(r=request,c='static/appjs' ,f='viewedit%s.js' % js)}}"></script>