aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2013-10-15 19:25:31 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2013-10-15 19:25:31 +0000
commitaf80b967213a02fc9cd39dbddbdb2ac582b00200 (patch)
tree3f54abef1eca38b1ac129029f443d77651bdeef3 /h-source/Application
parenta93461b231fb94f3a6a9df09a30557732201ddcc (diff)
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
Diffstat (limited to 'h-source/Application')
-rw-r--r--h-source/Application/Controllers/ManagerController.php72
-rw-r--r--h-source/Application/Include/distributions.php2
-rw-r--r--h-source/Application/Include/languages.php3
-rw-r--r--h-source/Application/Models/DistrosModel.php2
-rw-r--r--h-source/Application/Views/Desktop/Manager/distros.php35
5 files changed, 113 insertions, 1 deletions
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 @@
+<?php
+
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This file is part of h-source
+//
+// h-source is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// h-source is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with h-source. If not, see <http://www.gnu.org/licenses/>.
+
+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 @@
+<?php if (!defined('EG')) die('Direct access not allowed!'); ?>
+
+<?php
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This file is part of h-source
+//
+// h-source is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// h-source is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with h-source. If not, see <http://www.gnu.org/licenses/>.
+?>
+
+ <div id="left">
+
+ <div class="position_tree_box">
+ <a href="<?php echo $this->baseUrl."/home/index/$lang";?>">Home</a> &raquo; <?php echo gtext('List of allowed fully free distributions');?>
+ </div>
+
+ <div class="contrib_explain_box">
+ <?php echo gtext('List of allowed fully free distributions');?>
+ </div>
+
+ <?php echo $scaffold;?>
+
+ </div>