From 242b9fe2085c58289d981fca86d13b6889bc6941 Mon Sep 17 00:00:00 2001
From: Renaud Le Gac <renaud.legac@free.fr>
Date: Sat, 16 May 2009 15:05:21 +0000
Subject: [PATCH] Master cleaning. Keep ionly the "final" structure and files

---
 controllers/app.py                    | 33 -----------
 controllers/default.py                | 41 +++++++++++---
 controllers/forms.py                  | 17 ------
 controllers/viewedit.py               | 16 ------
 static/appjs/formdistributions.js     | 41 --------------
 static/appjs/formrpmCategories.js     | 37 -------------
 static/appjs/formrpms.js              | 55 ------------------
 static/appjs/formsystems.js           | 39 -------------
 static/appjs/vieweditdistributions.js | 66 ----------------------
 static/appjs/vieweditrpms.js          | 80 ---------------------------
 views/app.html                        | 36 ------------
 views/applayout.html                  | 33 +++++++----
 views/default/index.html              | 19 -------
 views/forms.html                      |  2 -
 views/viewedit.html                   |  2 -
 15 files changed, 55 insertions(+), 462 deletions(-)
 delete mode 100644 controllers/app.py
 delete mode 100644 controllers/forms.py
 delete mode 100644 controllers/viewedit.py
 delete mode 100644 static/appjs/formdistributions.js
 delete mode 100644 static/appjs/formrpmCategories.js
 delete mode 100644 static/appjs/formrpms.js
 delete mode 100644 static/appjs/formsystems.js
 delete mode 100644 static/appjs/vieweditdistributions.js
 delete mode 100644 static/appjs/vieweditrpms.js
 delete mode 100644 views/app.html
 delete mode 100644 views/default/index.html
 delete mode 100644 views/forms.html
 delete mode 100644 views/viewedit.html

diff --git a/controllers/app.py b/controllers/app.py
deleted file mode 100644
index bb3b2283..00000000
--- 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 7fd628c2..52aadb2c 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 35c5aa2a..00000000
--- 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 c896d432..00000000
--- 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 081c19e5..00000000
--- 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 731e33f9..00000000
--- 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 b072ae01..00000000
--- 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 cac135b8..00000000
--- 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 23cbb2f2..00000000
--- 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 b9dc35b4..00000000
--- 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 680a3326..00000000
--- 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 dd5c975d..b90e5727 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 e0386796..00000000
--- 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 e856a440..00000000
--- 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 6dbd9436..00000000
--- 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>
-- 
GitLab