From af80b967213a02fc9cd39dbddbdb2ac582b00200 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Tue, 15 Oct 2013 19:25:31 +0000 Subject: added the ManagerController and the manager users group. Now the users in the manager group can modify the list of allowed distros by means of the main panel --- .../Application/Controllers/ManagerController.php | 72 +++++++++++++++++++++ h-source/Application/Include/distributions.php | 2 +- h-source/Application/Include/languages.php | 3 + h-source/Application/Models/DistrosModel.php | 2 + .../Application/Views/Desktop/Manager/distros.php | 35 +++++++++++ h-source/Config/Route.php | 1 + h-source/Public/Css/main.css | 73 ++++++++++++++++++++++ h-source/README.txt | 6 ++ h-source/tables.sql | 46 ++++++++------ 9 files changed, 219 insertions(+), 21 deletions(-) create mode 100644 h-source/Application/Controllers/ManagerController.php create mode 100644 h-source/Application/Views/Desktop/Manager/distros.php (limited to 'h-source') diff --git a/h-source/Application/Controllers/ManagerController.php b/h-source/Application/Controllers/ManagerController.php new file mode 100644 index 0000000..b178ea6 --- /dev/null +++ b/h-source/Application/Controllers/ManagerController.php @@ -0,0 +1,72 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +//this controller is used to carry out the actions of the superadmin +class ManagerController extends BaseController +{ + + public function __construct($model, $controller, $queryString) + { + parent::__construct($model, $controller, $queryString); + + $this->model('DistrosModel'); + $this->modelName = 'DistrosModel'; + + $data['title'] = 'Manager - '.Website::$generalName; + $this->append($data); + + $this->setArgKeys(array('page:forceInt'=>1)); + + $this->s['registered']->check('manager'); + } + + public function distros($lang = 'en') { //view all the users + + $this->shift(1); + + $this->loadScaffold('main',array('popup'=>true,'popupType'=>'inclusive','recordPerPage'=>30, 'mainAction'=>'distros/'.$this->lang, "mainMenu" => "add")); + + $this->scaffold->loadMain('distros.full_name,distros.clean_name','distros.id_distro','moveup,movedown,ledit,del'); + $this->scaffold->setHead(gtext('TITLE').','.gtext('DISTRO-CODE')); + + $this->scaffold->mainMenu->links['add']['url'] = 'form/insert/0'; + $this->scaffold->mainMenu->links['add']['title'] = gtext('Insert a new distro'); + + $this->scaffold->update('del'); + + $this->scaffold->model->clear(); + + $this->scaffold->model->orderBy("id_order"); + + $this->scaffold->update('moveup,movedown'); + + $data['scaffold'] = $this->scaffold->render(); +// echo $this->scaffold->model->getQuery(); + + $data['notice'] = $this->scaffold->model->notice; + + $this->append($data); + $this->cleverLoad('distros'); + $this->right($this->lang); + } + +} \ No newline at end of file diff --git a/h-source/Application/Include/distributions.php b/h-source/Application/Include/distributions.php index 0572802..14d59d5 100644 --- a/h-source/Application/Include/distributions.php +++ b/h-source/Application/Include/distributions.php @@ -35,7 +35,7 @@ class Distributions { $distros = new DistrosModel(); - self::$allowed = $distros->clear()->toList("clean_name","full_name")->send(); + self::$allowed = $distros->clear()->toList("clean_name","full_name")->orderBy("id_order")->send(); } public static function getName($distList = '') diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php index 0527dcf..a5cb2eb 100644 --- a/h-source/Application/Include/languages.php +++ b/h-source/Application/Include/languages.php @@ -419,6 +419,9 @@ class Lang /*0358*/"Thanks for helping the h-node project and the free software movement!" => "Grazie per aver aiutato il progetto h-node e il movimento del software libero!", /*0359*/"You have just inserted a new notebook into the database. Can you please insert its devices separately too? Thanks!" => "Hai appena inserito un nuovo portatile. Potresti gentilmente inserire separatamente anche i suoi dispositivi?", /*0360*/"insert" => "inserisci", + /*0361*/"List of allowed fully free distributions" => "Lista delle distribuzioni completamente libere ammesse", + /*0362*/"Insert a new distro" => "Inserisci una nuova distribuzione", + /*0362*/"DISTRO-CODE" => "CODICE DISTRIBUZIONE", ), 'es' => array ( diff --git a/h-source/Application/Models/DistrosModel.php b/h-source/Application/Models/DistrosModel.php index 41e0c6a..58cd435 100644 --- a/h-source/Application/Models/DistrosModel.php +++ b/h-source/Application/Models/DistrosModel.php @@ -26,6 +26,8 @@ class DistrosModel extends Model_Tree { $this->_tables = 'distros'; $this->_idFields = 'id_distro'; + $this->_idOrder = 'id_order'; + parent::__construct(); } diff --git a/h-source/Application/Views/Desktop/Manager/distros.php b/h-source/Application/Views/Desktop/Manager/distros.php new file mode 100644 index 0000000..79d60ea --- /dev/null +++ b/h-source/Application/Views/Desktop/Manager/distros.php @@ -0,0 +1,35 @@ + + +. +?> + +
+ +
+ ">Home » +
+ +
+ +
+ + + +
diff --git a/h-source/Config/Route.php b/h-source/Config/Route.php index 9086b08..2aa6720 100644 --- a/h-source/Config/Route.php +++ b/h-source/Config/Route.php @@ -267,6 +267,7 @@ class Route 'hostcontrollers,differences', 'hostcontrollers,climb', 'hostcontrollers,talk', + 'manager,distros', ); //it can be 'yes' or 'no' diff --git a/h-source/Public/Css/main.css b/h-source/Public/Css/main.css index 2314940..267cfd5 100644 --- a/h-source/Public/Css/main.css +++ b/h-source/Public/Css/main.css @@ -2128,6 +2128,79 @@ div#description_tabs_content font-size:12px; } +/*page division*/ +.pageList { + text-align:left; + font:normal 14px/1 Verdana,arial; + padding:10px; +} + +div.pageList a { + padding:0 5px; + padding:0 10px; + border-left:1px solid #708090; + color: #686868; + text-decoration:none; +/* background:#4169E1; */ +} + +.page_list_legend +{ + padding-right:10px; +} + + +.mainMenu { + height:35px; + padding-top:6px; + margin-bottom:10px; +} + +.scaffold_header +{ + background:#ffa524; + padding:6px; + font:bold 14px/1.5 Verdana,arial; + color:#ffffff; + position:relative; + z-index:1; + height:22px; +} + +.mainMenuItem, .mainMenuItemLarge { + float:left; + width:105px; + height:25px; + margin:10px; + text-align:left; +} +.mainMenuItemLarge +{ + width:185px; +} +.mainMenuItem img, .mainMenuItemLarge img +{ + vertical-align:middle; +} + +.mainMenuItem a, .mainMenuItemLarge a { + vertical-align:-2px; + color: #686868; + font:bold 16px/1 Verdana,arial; + font-size:14px; +} + + +td.editForm, td.delForm, td.associateForm, td.moveupForm, td.movedownForm,td.Form, td.ledit { + width:3%; +} + + +td.simpleLink +{ + width:3%; +} + /*.version_div a { display:block; diff --git a/h-source/README.txt b/h-source/README.txt index fd7a4a9..e0e016b 100644 --- a/h-source/README.txt +++ b/h-source/README.txt @@ -39,6 +39,12 @@ where username and password have to be changed with the real username and passwo Now you have created the database named +This will also create the default user having the following credentials: + +username: admin +password: admin + +You will be able to login using the admin user and change the website preferences and the admin password. Open the Config/Config.php file diff --git a/h-source/tables.sql b/h-source/tables.sql index a695600..f9ef911 100644 --- a/h-source/tables.sql +++ b/h-source/tables.sql @@ -33,7 +33,7 @@ CREATE TABLE IF NOT EXISTS `accesses` ( `ora` char(8) NOT NULL, `username` varchar(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=650 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -46,7 +46,7 @@ CREATE TABLE IF NOT EXISTS `admingroups` ( `name` varchar(30) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id_group`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -78,7 +78,7 @@ CREATE TABLE IF NOT EXISTS `adminusers` ( PRIMARY KEY (`id_user`), UNIQUE KEY `username` (`username`), KEY `username_2` (`username`,`password`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -106,7 +106,7 @@ CREATE TABLE IF NOT EXISTS `boxes` ( `title` varchar(150) NOT NULL, `message` text NOT NULL, PRIMARY KEY (`id_box`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -123,7 +123,7 @@ CREATE TABLE IF NOT EXISTS `deletion` ( `id_hard` int(10) unsigned NOT NULL, `id_duplicate` int(10) unsigned NOT NULL, PRIMARY KEY (`id_del`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=11 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -171,7 +171,7 @@ CREATE TABLE IF NOT EXISTS `hardware` ( `it_tracks_users` varchar(30) NOT NULL DEFAULT 'not-specified', `prevent_wifi` char(20) NOT NULL DEFAULT 'not-specified', PRIMARY KEY (`id_hard`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=503 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -203,7 +203,7 @@ CREATE TABLE IF NOT EXISTS `history` ( `message` text NOT NULL, `gr` char(15) NOT NULL, PRIMARY KEY (`id_history`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1367 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; -- -------------------------------------------------------- @@ -224,7 +224,7 @@ CREATE TABLE IF NOT EXISTS `issues` ( `notice` text NOT NULL, `deleted` char(4) NOT NULL DEFAULT 'no', PRIMARY KEY (`id_issue`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=106 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -241,7 +241,7 @@ CREATE TABLE IF NOT EXISTS `messages` ( `deleted` char(4) NOT NULL DEFAULT 'no', `has_read` char(4) NOT NULL DEFAULT 'no', PRIMARY KEY (`id_mes`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=342 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -255,7 +255,7 @@ CREATE TABLE IF NOT EXISTS `news` ( `title` varchar(150) NOT NULL, `message` text NOT NULL, PRIMARY KEY (`id_news`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=12 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -268,7 +268,7 @@ CREATE TABLE IF NOT EXISTS `params` ( `updating` char(4) NOT NULL DEFAULT 'no', `boxes_xml` text NOT NULL, PRIMARY KEY (`id_par`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; -- -------------------------------------------------------- @@ -291,7 +291,7 @@ CREATE TABLE IF NOT EXISTS `profile` ( `website` varchar(100) NOT NULL, `send_notification` char(4) NOT NULL DEFAULT 'yes', PRIMARY KEY (`id_prof`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=330 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -306,7 +306,7 @@ CREATE TABLE IF NOT EXISTS `regaccesses` ( `ora` char(8) NOT NULL, `username` varchar(30) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3529 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; -- -------------------------------------------------------- @@ -319,7 +319,7 @@ CREATE TABLE IF NOT EXISTS `reggroups` ( `name` varchar(30) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id_group`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; -- -------------------------------------------------------- @@ -360,7 +360,7 @@ CREATE TABLE IF NOT EXISTS `regusers` ( PRIMARY KEY (`id_user`), UNIQUE KEY `username` (`username`), KEY `username_2` (`username`,`password`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=463 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; -- -------------------------------------------------------- @@ -421,7 +421,7 @@ CREATE TABLE IF NOT EXISTS `revisions` ( `it_tracks_users` varchar(30) NOT NULL DEFAULT 'not-specified', `prevent_wifi` char(20) NOT NULL DEFAULT 'not-specified', PRIMARY KEY (`id_rev`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=627 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -438,7 +438,7 @@ CREATE TABLE IF NOT EXISTS `talk` ( `id_hard` int(10) unsigned NOT NULL, `deleted` char(4) NOT NULL DEFAULT 'no', PRIMARY KEY (`id_talk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=259 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -458,7 +458,7 @@ CREATE TABLE IF NOT EXISTS `wiki` ( `blocked` char(3) NOT NULL DEFAULT 'no', `is_main` char(3) NOT NULL DEFAULT 'no', PRIMARY KEY (`id_wiki`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=30 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -476,7 +476,7 @@ CREATE TABLE IF NOT EXISTS `wiki_revisions` ( `page` text NOT NULL, `id_wiki` int(10) unsigned NOT NULL, PRIMARY KEY (`id_rev`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=252 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -493,7 +493,7 @@ CREATE TABLE IF NOT EXISTS `wiki_talk` ( `id_wiki` int(10) unsigned NOT NULL, `deleted` char(4) NOT NULL DEFAULT 'no', PRIMARY KEY (`id_talk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -587,3 +587,9 @@ insert into distros (clean_name, full_name, id_order) values ('ututo_xs_2012_04' insert into distros (clean_name, full_name, id_order) values ('venenux_0_8', 'VENENUX 0.8', 23); insert into distros (clean_name, full_name, id_order) values ('venenux_0_8_2', 'VENENUX-EC 0.8.2', 24); insert into distros (clean_name, full_name, id_order) values ('venenux_0_9', 'VENENUX 0.9', 25); + +insert into reggroups (name) values ('manager'); + +insert into regusers (username,password) values ('admin',sha1('admin')); + +insert into regusers_groups (id_user, id_group) values (1,1); \ No newline at end of file -- cgit v1.2.3