summaryrefslogtreecommitdiffstats
path: root/application/modules
diff options
context:
space:
mode:
authorSimon2011-04-01 16:34:13 +0200
committerSimon2011-04-01 16:34:13 +0200
commitcd230aefd78797219cb3814cda29fc8178520a22 (patch)
tree9e460a6493323e35a98fd9921be680c70a3c541d /application/modules
parentMerge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2 (diff)
downloadpbs2-cd230aefd78797219cb3814cda29fc8178520a22.tar.gz
pbs2-cd230aefd78797219cb3814cda29fc8178520a22.tar.xz
pbs2-cd230aefd78797219cb3814cda29fc8178520a22.zip
Pagination in ettlichen Controllern + aufgeräumt
Diffstat (limited to 'application/modules')
-rw-r--r--application/modules/user/controllers/BootisoController.php83
-rw-r--r--application/modules/user/controllers/BootosController.php78
-rw-r--r--application/modules/user/controllers/ClientController.php36
-rw-r--r--application/modules/user/controllers/FilterController.php126
-rw-r--r--application/modules/user/controllers/PoolController.php68
-rw-r--r--application/modules/user/controllers/PrebootController.php82
-rw-r--r--application/modules/user/forms/Bootiso.php17
-rw-r--r--application/modules/user/forms/Bootos.php6
-rw-r--r--application/modules/user/forms/Client.php25
-rw-r--r--application/modules/user/forms/FilterEntry.php43
-rw-r--r--application/modules/user/forms/Pool.php26
-rw-r--r--application/modules/user/forms/PoolClient.php27
-rw-r--r--application/modules/user/forms/Preboot.php11
-rw-r--r--application/modules/user/views/scripts/bootiso/index.phtml2
-rw-r--r--application/modules/user/views/scripts/bootos/index.phtml2
-rw-r--r--application/modules/user/views/scripts/client/index.phtml2
-rw-r--r--application/modules/user/views/scripts/filter/index.phtml6
-rw-r--r--application/modules/user/views/scripts/pool/index.phtml80
-rw-r--r--application/modules/user/views/scripts/preboot/index.phtml14
19 files changed, 444 insertions, 290 deletions
diff --git a/application/modules/user/controllers/BootisoController.php b/application/modules/user/controllers/BootisoController.php
index ba2ef91..ad3244a 100644
--- a/application/modules/user/controllers/BootisoController.php
+++ b/application/modules/user/controllers/BootisoController.php
@@ -5,11 +5,11 @@ class user_BootisoController extends Zend_Controller_Action
protected $bootisoMapper;
protected $membershipMapper;
- protected $membership;
+ protected $membership;
+ protected $page;
public function init()
- {
- error_reporting(E_ALL);
+ {
if (Zend_Auth::getInstance()->hasIdentity()) {
$userIDsNamespace = Zend_Session::namespaceGet('userIDs');
if($userIDsNamespace['membershipID'] ==''){
@@ -26,6 +26,7 @@ class user_BootisoController extends Zend_Controller_Action
} else {
$this->_helper->redirector('login', 'auth');
}
+ $this->page = $this->_request->getParam('page');
}
public function indexAction()
@@ -79,7 +80,7 @@ class user_BootisoController extends Zend_Controller_Action
$this->view->bootisolist = array_reverse($this->view->bootisolist);
// Pagination
- $perpage = 10;
+ $perpage = 2;
$req_page = $this->_request->getParam('page');
$all = count($this->view->bootisolist);
$numpages = ceil($all/$perpage);
@@ -108,24 +109,23 @@ class user_BootisoController extends Zend_Controller_Action
public function downloadbootisoAction()
{
- $page = $this->_request->getParam('page');
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
- $page = $this->_request->getParam('page');
+
//TODO ACL Darf er BootISOs downloaden?
if(false)
- $this->_redirect('/user/bootiso/index/page/'.$page.'/downloadresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/forbidden');
$prebootID = $this->_request->getParam('prebootID');
$bootisoID = $this->_request->getParam('bootisoID');
if(!is_dir("../resources/bootmedium/$prebootID/"))
- $this->_redirect('/user/bootiso/index/page/'.$page.'/downloadresult/404');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/404');
if(!is_numeric($prebootID) || !is_numeric($bootisoID))
- $this->_redirect('/user/bootiso/index/page/'.$page.'/downloadresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/forbidden');
chdir("../resources/bootmedium/$prebootID/");
@@ -147,10 +147,9 @@ class user_BootisoController extends Zend_Controller_Action
public function createbootisoAction()
{
- $page = $this->_request->getParam('page');
//TODO ACL Darf er BootISOs erstellen?
if(false)
- $this->_redirect('/user/bootiso/index/page/'.$page.'/addresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/addresult/forbidden');
$groupgroupsMapper = new Application_Model_GroupGroupsMapper();
$groupID = $this->membership->getGroupID();
@@ -160,12 +159,21 @@ class user_BootisoController extends Zend_Controller_Action
$prebootMapper = new Application_Model_PreBootMapper();
$prebootlist = $prebootMapper->findBy("groupID", $groupID);
-
if (!isset($_POST["createbootiso"])){
- $bootisoForm = new user_Form_Bootiso(array('action' => 'createbootiso','prebootlist' => $prebootlist, 'groupdepth' => $childgroups, 'rights' => null));
+ $bootisoForm = new user_Form_Bootiso(array(
+ 'action' => 'createbootiso',
+ 'prebootlist' => $prebootlist,
+ 'groupdepth' => $childgroups,
+ 'rights' => null,
+ 'page'=>$this->page));
} else {
- $bootisoForm = new user_Form_Bootiso(array('action' => 'createbootiso','prebootlist' => $prebootlist, 'groupdepth' => $childgroups, 'rights' => null),$_POST);
+ $bootisoForm = new user_Form_Bootiso(array(
+ 'action' => 'createbootiso',
+ 'prebootlist' => $prebootlist,
+ 'groupdepth' => $childgroups,
+ 'rights' => null,
+ 'page'=>$this->page),$_POST);
if ($bootisoForm->isValid($_POST)) {
@@ -194,11 +202,11 @@ class user_BootisoController extends Zend_Controller_Action
{
echo "Caught exception: " . get_class($e) . "<br/>";
echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootiso/index/page/'.$page.'/addresult/error');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/addresult/error');
//TODO Delete File & delete bootiso from DB
- }
- $this->_redirect('/user/bootiso/index/page/'.$page.'/addresult/ok');
+ }
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/addresult/ok');
}
}
@@ -207,14 +215,13 @@ class user_BootisoController extends Zend_Controller_Action
public function editbootisoAction()
{
- $page = $this->_request->getParam('page');
//TODO ACL Darf er BootISOs editieren?
if(false)
- $this->_redirect('/user/bootiso/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden');
$bootisoID = $this->_request->getParam('bootisoID');
if (!is_numeric($bootisoID))
- $this->_redirect('/user/bootiso/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden');
$groupID = $this->membership->getGroupID();
@@ -230,13 +237,23 @@ class user_BootisoController extends Zend_Controller_Action
$this->bootisoMapper->find($bootisoID, $bootiso);
if($this->membership->getGroupID() != $bootiso->getGroupID())
- $this->_redirect('/user/bootiso/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden');
- $bootisoForm = new user_Form_Bootiso(array('action' => 'editbootiso','prebootlist' => $prebootlist, 'groupdepth' => $childgroups, 'rights' => 'meta'));
+ $bootisoForm = new user_Form_Bootiso(array(
+ 'action' => 'editbootiso',
+ 'prebootlist' => $prebootlist,
+ 'groupdepth' => $childgroups,
+ 'rights' => 'meta',
+ 'page' => $this->page));
$bootisoForm->populate($bootiso->toArray());
}else{
- $bootisoForm = new user_Form_Bootiso(array('action' => 'editbootiso','prebootlist' => $prebootlist, 'groupdepth' => $childgroups, 'rights' => 'meta'),$_POST);
+ $bootisoForm = new user_Form_Bootiso(array(
+ 'action' => 'editbootiso',
+ 'prebootlist' => $prebootlist,
+ 'groupdepth' => $childgroups,
+ 'rights' => 'meta',
+ 'page' => $this->page),$_POST);
if ($bootisoForm->isValid($_POST)) {
@@ -256,7 +273,7 @@ class user_BootisoController extends Zend_Controller_Action
$bootiso->getSerialnumber() != $bootisoold->getSerialnumber()){
//TODO ACL Is he allowed to edit other than Metadata?
if(false)
- $this->_redirect('/user/bootiso/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden');
}
@@ -275,11 +292,11 @@ class user_BootisoController extends Zend_Controller_Action
{
echo "Caught exception: " . get_class($e) . "<br/>";
echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootiso/index/page/'.$page.'/modifyresult/error');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/error');
//TODO Redo Serial in Files...
}
- $this->_redirect('/user/bootiso/index/page/'.$page.'/modifyresult/ok');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/ok');
}
}
@@ -288,33 +305,31 @@ class user_BootisoController extends Zend_Controller_Action
}
public function deletebootisoAction()
- {
- $page = $this->_request->getParam('page');
-
+ {
//TODO ACL Darf er BootISOs löschen?
if(false)
- $this->_redirect('/user/bootiso/index/page/'.$page.'/deleteresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/forbidden');
try{
$bootisoID = $this->_request->getParam('bootisoID');
if (!is_numeric($bootisoID))
- $this->_redirect('/user/bootiso/index/page/'.$page.'/deleteresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/forbidden');
$bootiso = new Application_Model_BootIso();
$this->bootisoMapper->find($bootisoID,$bootiso);
if($this->membership->getGroupID() != $bootiso->getGroupID())
- $this->_redirect('/user/bootiso/index/page/'.$page.'/deleteresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/forbidden');
$this->bootisoMapper->delete($bootiso);
}catch(Zend_Exception $e){
echo "Caught exception: " . get_class($e) . "<br/>";
echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootiso/index/page/'.$page.'/deleteresult/error');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/error');
}
- $this->_redirect('/user/bootiso/index/page/'.$page.'/deleteresult/ok');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/ok');
}
}
diff --git a/application/modules/user/controllers/BootosController.php b/application/modules/user/controllers/BootosController.php
index eae0dcf..5757d16 100644
--- a/application/modules/user/controllers/BootosController.php
+++ b/application/modules/user/controllers/BootosController.php
@@ -6,6 +6,7 @@ class user_BootosController extends Zend_Controller_Action
protected $bootosMapper;
protected $membershipMapper;
protected $membership;
+ protected $page;
public function init()
{
@@ -25,6 +26,7 @@ class user_BootosController extends Zend_Controller_Action
} else {
$this->_helper->redirector('login', 'auth');
}
+ $this->page = $this->_request->getParam('page');
}
public function indexAction()
@@ -98,11 +100,10 @@ class user_BootosController extends Zend_Controller_Action
public function createbootosAction()
{
- $page = $this->_request->getParam('page');
//TODO ACL Darf er BootISOs erstellen?
if(false)
- $this->_redirect('/user/bootos/index/page/'.$page.'/addresult/forbidden');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/addresult/forbidden');
$groupID = $this->membership->getGroupID();
@@ -114,10 +115,20 @@ class user_BootosController extends Zend_Controller_Action
$configlist = $configMapper->findBy("groupID", $groupID);
if (!isset($_POST["createbootos"])){
- $bootosForm = new user_Form_Bootos(array('action' => 'createbootos', 'groupdepth' => $childgroups, 'configlist'=>$configlist, 'rights' => 'all'));
+ $bootosForm = new user_Form_Bootos(array(
+ 'action' => 'createbootos',
+ 'groupdepth' => $childgroups,
+ 'configlist'=>$configlist,
+ 'rights' => 'all',
+ 'page' => $this->page));
} else {
- $bootosForm = new user_Form_Bootos(array('action' => 'createbootos', 'groupdepth' => $childgroups, 'configlist'=>$configlist, 'rights' => 'all'),$_POST);
+ $bootosForm = new user_Form_Bootos(array(
+ 'action' => 'createbootos',
+ 'groupdepth' => $childgroups,
+ 'configlist'=>$configlist,
+ 'rights' => 'all',
+ 'page' => $this->page),$_POST);
if ($bootosForm->isValid($_POST)) {
@@ -159,12 +170,12 @@ class user_BootosController extends Zend_Controller_Action
{
echo "Caught exception: " . get_class($e) . "<br/>";
echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootos/index/page/'.$page.'/addresult/error');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/addresult/error');
//TODO Delete File & delete bootiso from DB
}
- $this->_redirect('/user/bootos/index/page/'.$page.'/addresult/ok');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/addresult/ok');
}
}
@@ -173,11 +184,10 @@ class user_BootosController extends Zend_Controller_Action
public function checkupdateAction($bootos)
{
- $page = $this->_request->getParam('page');
//TODO ACL Is he allowed to update Preboots?
if(false)
- $this->_redirect('/user/preboot/index/page/'.$page.'/updateresult/forbidden');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/updateresult/forbidden');
$bootosID = $bootos->getID();
@@ -211,20 +221,19 @@ class user_BootosController extends Zend_Controller_Action
public function updatebootosAction()
{
- $page = $this->_request->getParam('page');
//TODO ACL Is he allowed to update Preboots?
if(false)
- $this->_redirect('/user/bootiso/index/page/'.$page.'/updateresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/updateresult/forbidden');
$bootosID = $this->_request->getParam('bootosID');
if (!is_numeric($bootosID))
- $this->_redirect('/user/bootos/index/page/'.$page.'/updateresult/forbidden');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/updateresult/forbidden');
$bootos = $this->bootosMapper->find($bootosID);
if($this->membership->getGroupID() != $bootos->getGroupID())
- $this->_redirect('/user/bootos/index/page/'.$page.'/updateresult/forbidden');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/updateresult/forbidden');
$initpath = "../resources/bootos/".$bootosID."/initramfs/";
$kernelpath = "../resources/bootos/".$bootosID."/kernel/";
@@ -235,27 +244,26 @@ class user_BootosController extends Zend_Controller_Action
exec("wget -O '".$path_tmp."initramfs".$hash."' ".escapeshellcmd($bootos->getPath_init())." 2>&1 | grep 'saved'", $status2);
if(!array_pop($status) || !array_pop($status2)){
- $this->_redirect('/user/bootos/index/page/'.$page.'/updateresult/404');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/updateresult/404');
//TODO Delete Files in tmp
}
exec("mv ../resources/bootos/kernel$hash $kernelpath"."kernel");
exec("mv ../resources/bootos/initramfs$hash $initpath"."initramfs");
- $this->_redirect('/user/bootos/index/page/'.$page.'/updateresult/ok');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/updateresult/ok');
}
public function editbootosAction()
{
- $page = $this->_request->getParam('page');
//TODO ACL Is he allowed to edit Preboots?
if(false)
- $this->_redirect('/user/bootos/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden');
$bootosID = $this->_request->getParam('bootosID');
if (!is_numeric($bootosID))
- $this->_redirect('/user/bootos/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden');
$groupID = $this->membership->getGroupID();
@@ -271,13 +279,23 @@ class user_BootosController extends Zend_Controller_Action
$bootos = $this->bootosMapper->find($bootosID);
if($this->membership->getGroupID() != $bootos->getGroupID())
- $this->_redirect('/user/bootos/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden');
- $bootosForm = new user_Form_Bootos(array('action' => 'editbootos', 'groupdepth' => $childgroups, 'configlist'=>$configlist, 'rights' => 'meta'));
+ $bootosForm = new user_Form_Bootos(array(
+ 'action' => 'editbootos',
+ 'groupdepth' => $childgroups,
+ 'configlist'=>$configlist,
+ 'rights' => 'meta',
+ 'page' => $this->page));
$bootosForm->populate($bootos->toArray());
}else{
- $bootosForm = new user_Form_Bootos(array('action' => 'editbootos', 'groupdepth' => $childgroups, 'configlist'=>$configlist, 'rights' => 'meta'),$_POST);
+ $bootosForm = new user_Form_Bootos(array(
+ 'action' => 'editbootos',
+ 'groupdepth' => $childgroups,
+ 'configlist'=>$configlist,
+ 'rights' => 'meta',
+ 'page' => $this->page),$_POST);
if ($bootosForm->isValid($_POST)) {
@@ -298,13 +316,13 @@ class user_BootosController extends Zend_Controller_Action
$bootos->getPublic() != $bootosold->getPublic() ){
//TODO ACL Is he allowed to edit this?
if(false)
- $this->_redirect('/user/bootos/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden');
}
if($bootos->getPath_kernel() != $bootosold->getPath_kernel() || $bootos->getPath_init() != $bootosold->getPath_init()){
//TODO ACL Is he allowed to edit the Kernel/Init Path?
if(false)
- $this->_redirect('/user/bootos/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden');
$path_tmp = "../resources/bootos/";
@@ -338,11 +356,11 @@ class user_BootosController extends Zend_Controller_Action
{
echo "Caught exception: " . get_class($e) . "<br/>";
echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootos/index/page/'.$page.'/modifyresult/error');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/error');
//TODO Delete Folder + Preboot
}
- $this->_redirect('/user/bootos/index/page/'.$page.'/modifyresult/ok');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/ok');
}
}
@@ -353,22 +371,20 @@ class user_BootosController extends Zend_Controller_Action
public function deletebootosAction()
{
- $page = $this->_request->getParam('page');
-
//TODO ACL Is he allowed to delete Bootos?
if(false)
- $this->_redirect('/user/bootos/index/page/'.$page.'/deleteresult/forbidden');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/forbidden');
try{
$bootosID = $this->_request->getParam('bootosID');
if (!is_numeric($bootosID))
- $this->_redirect('/user/bootos/index/page/'.$page.'/deleteresult/forbidden');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/forbidden');
$bootos = new Application_Model_BootOs();
$this->bootosMapper->find($bootosID, $bootos);
if($this->membership->getGroupID() != $bootos->getGroupID())
- $this->_redirect('/user/bootos/index/page/'.$page.'/deleteresult/forbidden');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/forbidden');
$this->bootosMapper->delete($bootos);
exec("rm -r ../resources/bootos/".$bootosID);
@@ -376,9 +392,9 @@ class user_BootosController extends Zend_Controller_Action
}catch(Zend_Exception $e){
echo "Caught exception: " . get_class($e) . "<br/>";
echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootos/index/page/'.$page.'/deleteresult/error');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/error');
}
- $this->_redirect('/user/bootos/index/page/'.$page.'/deleteresult/ok');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/ok');
}
diff --git a/application/modules/user/controllers/ClientController.php b/application/modules/user/controllers/ClientController.php
index c9bfd84..5827d03 100644
--- a/application/modules/user/controllers/ClientController.php
+++ b/application/modules/user/controllers/ClientController.php
@@ -3,6 +3,7 @@
class User_ClientController extends Zend_Controller_Action
{
private $membership;
+ protected $page;
public function init()
{
@@ -19,6 +20,7 @@ class User_ClientController extends Zend_Controller_Action
} else {
$this->_helper->redirector('login', 'auth');
}
+ $this->page = $this->_request->getParam('page');
}
public function indexAction()
@@ -75,11 +77,15 @@ class User_ClientController extends Zend_Controller_Action
$this->_redirect('/user');
if (!isset($_POST["add"])){
- $addclient = new user_Form_Client(array('buttontext' => 'Create Client'));
+ $addclient = new user_Form_Client(array(
+ 'buttontext' => 'Create Client',
+ 'page' => $this->page));
$this->view->addclient = $addclient;
}
else{
- $addclient = new user_Form_Client(array('buttontext' => 'Create Client'),$_POST);
+ $addclient = new user_Form_Client(array(
+ 'buttontext' => 'Create Client',
+ 'page' => $this->page),$_POST);
if ($addclient->isValid($_POST) || ($mac != '' && $hh != '') ) {
$client = new Application_Model_Client($_POST);
$mac = ($mac!='')?$mac:$_POST['macadress'];
@@ -98,7 +104,6 @@ class User_ClientController extends Zend_Controller_Action
public function removeclientAction()
{
$clientID = $this->_request->getParam('clientID');
- $page = $this->_request->getParam('page');
// ACL: is he authorized to delete clients?
if(!Pbs_Acl::checkRight('cld'))
@@ -111,13 +116,13 @@ class User_ClientController extends Zend_Controller_Action
if($client->getGroupID() == $this->membership->getGroupID()){
$clientMapper = new Application_Model_ClientMapper();
$clientMapper->delete($client);
- $this->_redirect('/user/client/index/page/'.$page.'/deleteresult/ok');
+ $this->_redirect('/user/client/index/page/'.$this->page.'/deleteresult/ok');
}
else{
- $this->_redirect('/user/client/index/page/'.$page.'/deleteresult/forbidden');
+ $this->_redirect('/user/client/index/page/'.$this->page.'/deleteresult/forbidden');
}
}
- $this->_redirect('/user/client/index/page/'.$page.'/deleteresult/error');
+ $this->_redirect('/user/client/index/page/'.$this->page.'/deleteresult/error');
}
public function editclientAction(){
@@ -127,27 +132,28 @@ class User_ClientController extends Zend_Controller_Action
if (!isset($_POST["add"])){
$clientID = $this->_request->getParam('clientID');
- $page = $this->_request->getParam('page');
$client = new Application_Model_Client();
$mapper = new Application_Model_ClientMapper();
$mapper->find($clientID,$client);
if($client->getGroupID() == $this->membership->getGroupID()){
- $editclient = new user_Form_Client(array('buttontext' => 'Edit Client'));
+ $editclient = new user_Form_Client(array(
+ 'buttontext' => 'Edit Client',
+ 'page' => $this->page));
$editclient->populate($client->toArray());
- $editclient->setPage($page);
$this->view->editclient = $editclient;
}
else{
- $this->_redirect('/user/client/index/page/'.$page.'/modifyresult/error');
+ $this->_redirect('/user/client/index/page/'.$this->page.'/modifyresult/error');
}
}
else{
- $editclient = new user_Form_Client(array('buttontext' => 'Edit Client'),$_POST);
+ $editclient = new user_Form_Client(array(
+ 'buttontext' => 'Edit Client',
+ 'page' => $this->page),$_POST);
if ($editclient->isValid($_POST) || ($mac != '' && $hh != '') ) {
$client = new Application_Model_Client($_POST);
- $client->setID($this->_request->getParam('clientID'));
- $page = $this->_request->getParam('page');
+ $client->setID($this->_request->getParam('clientID'));
$dbclient = new Application_Model_Client();
$clientMapper = new Application_Model_ClientMapper();
@@ -157,10 +163,10 @@ class User_ClientController extends Zend_Controller_Action
$client->setGroupID($this->membership->getGroupID());
$clientmapper = new Application_Model_ClientMapper();
$clientmapper->save($client);
- $this->_redirect('/user/client/index/page/'.$page.'/modifyresult/ok');
+ $this->_redirect('/user/client/index/page/'.$this->page.'/modifyresult/ok');
}
else{
- $this->_redirect('/user/client/index/page/'.$page.'/modifyresult/error');
+ $this->_redirect('/user/client/index/page/'.$this->page.'/modifyresult/error');
}
}
$this->view->editclient = $editclient;
diff --git a/application/modules/user/controllers/FilterController.php b/application/modules/user/controllers/FilterController.php
index eaeaba1..b1bc84f 100644
--- a/application/modules/user/controllers/FilterController.php
+++ b/application/modules/user/controllers/FilterController.php
@@ -4,6 +4,7 @@ class User_FilterController extends Zend_Controller_Action
{
protected $filterMapper;
protected $membershipMapper;
+ protected $page;
public function init()
{
if (Zend_Auth::getInstance()->hasIdentity()) {
@@ -22,6 +23,7 @@ class User_FilterController extends Zend_Controller_Action
} else {
$this->_helper->redirector('login', 'auth');
}
+ $this->page = $this->_request->getParam('page');
}
public function indexAction()
@@ -77,25 +79,29 @@ class User_FilterController extends Zend_Controller_Action
$this->_redirect('/user');
$bmmapper = new Application_Model_BootMenuMapper();
- $result = $bmmapper->findBy('groupID',$this->membership->getGroupID());
- $page = $this->_request->getParam('page');
+ $result = $bmmapper->findBy('groupID',$this->membership->getGroupID(),true);
+ print_a($result);
foreach($result as $rr){
$bm = new Application_Model_BootMenu();
$bm->setOptions($rr);
$bm->setID($rr['bootmenuID']);
$bootmenus[] = $bm;
- }
+ }
$this->view->bootmenus = $bootmenus;
if (!isset($_POST["add"])){
- $addfilterform = new user_Form_Filter(array('buttontext' => 'Create Filter','bootmenus'=>$bootmenus));
- $addfilterform->setPage($page);
+ $addfilterform = new user_Form_Filter(array(
+ 'buttontext' => 'Create Filter',
+ 'bootmenus'=>$bootmenus,
+ 'page' => $this->page));
$this->view->addfilterform = $addfilterform;
}else {
- $addfilterform = new user_Form_Filter(array('buttontext' => 'Create Filter','bootmenus'=>$bootmenus),$_POST);
- $addfilterform->setPage($page);
+ $addfilterform = new user_Form_Filter(array(
+ 'buttontext' => 'Create Filter',
+ 'bootmenus'=>$bootmenus,
+ 'page' => $this->page),$_POST);
if ($addfilterform->isValid($_POST)) {
try{
$newfilter = new Application_Model_Filter($_POST);
@@ -112,10 +118,10 @@ class User_FilterController extends Zend_Controller_Action
$filterentry->setFiltervalue($this->membership->getGroupID());
$filterentriesMapper->save($filterentry);
- $this->_redirect('/user/filter/index/page/'.$page.'/addresult/ok');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/addresult/ok');
}catch (Zend_Exception $e) {
echo "Error message 2: " . $e->getMessage() . "\n";
- $this->_redirect('/user/filter/index/page/'.$page.'/addresult/error');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/addresult/error');
}
}
$this->view->addfilterform = $addfilterform;
@@ -125,7 +131,6 @@ class User_FilterController extends Zend_Controller_Action
public function removefilterAction()
{
$filterID = $this->_request->getParam('filterID');
- $page = $this->_request->getParam('page');
$filtermapper = new Application_Model_FilterMapper();
// ACL: Is he allowed to remove the filter
@@ -139,28 +144,28 @@ class User_FilterController extends Zend_Controller_Action
$deletefilter = new Application_Model_Filter();
$deletefilter->setID($filterID);
$filtermapper->delete($deletefilter);
- $this->_redirect('/user/filter/index/page/'.$page.'/deleteresult/ok');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/ok');
}
else{
- $this->_redirect('/user/filter/index/page/'.$page.'/deleteresult/forbidden');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/forbidden');
}
}
else{
- $this->_redirect('/user/filter/index/page/'.$page.'/deleteresult/error');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/error');
}
}
public function editfilterAction()
{
$bmmapper = new Application_Model_BootMenuMapper();
- $result = $bmmapper->findBy('groupID',$this->membership->getGroupID());
- $page = $this->_request->getParam('page');
+ $result = $bmmapper->findBy('groupID',$this->membership->getGroupID(),true);
foreach($result as $rr){
$bm = new Application_Model_BootMenu();
$bm->setOptions($rr);
$bm->setID($rr['bootmenuID']);
$bootmenus[] = $bm;
}
+
// ACL: Is he allowed to edit the filter or the filterpriority?
if(!Pbs_Acl::checkRight('fe') && !Pbs_Acl::checkRight('fefp'))
$this->_redirect('/user');
@@ -173,13 +178,15 @@ class User_FilterController extends Zend_Controller_Action
$filtermapper->find($filterID,$filter);
if($filter->getGroupID() == $this->membership->getGroupID()){
$filter2 = $filter->toArray();
- $editfilterform = new user_Form_Filter(array('buttontext' => 'Edit Filter','bootmenus'=>$bootmenus));
+ $editfilterform = new user_Form_Filter(array(
+ 'buttontext' => 'Edit Filter',
+ 'bootmenus'=>$bootmenus,
+ 'page' => $this->page));
$editfilterform->populate($filter2);
- $editfilterform->setPage($page);
$this->view->editfilterform = $editfilterform;
}
else{
- $this->_redirect('/user/filter/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/forbidden');
}
} else{
try{
@@ -188,8 +195,10 @@ class User_FilterController extends Zend_Controller_Action
$filtermapper = new Application_Model_FilterMapper();
$filtermapper->find($filterID,$filter);
if($filter->getGroupID() == $this->membership->getGroupID()){
- $editfilterform = new user_Form_Filter(array('buttontext' => 'Edit Filter','bootmenus'=>$bootmenus),$_POST);
- $editfilterform->setPage($page);
+ $editfilterform = new user_Form_Filter(array(
+ 'buttontext' => 'Edit Filter',
+ 'bootmenus'=>$bootmenus,
+ 'page' => $this->page),$_POST);
if ($editfilterform->isValid($_POST)) {
$filtermapper = new Application_Model_FilterMapper();
@@ -206,26 +215,26 @@ class User_FilterController extends Zend_Controller_Action
$compareresult = $filtermapper->compare($newfilterentry,$DBfilterentry);
if(isset($compareresult['priority']) && count($compareresult) == 1){
$filtermapper->save($newfilterentry);
- $this->_redirect('/user/filter/index/page/'.$page.'/modifyresult/ok');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/ok');
}
else{
- $this->_redirect('/user/filter/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/forbidden');
}
}
// ACL: he is allowed to edit the filter
elseif(Pbs_Acl::checkRight('fe')){
$filtermapper->save($newfilterentry);
- $this->_redirect('/user/filter/index/page/'.$page.'/modifyresult/ok');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/ok');
}
}
$this->view->editfilterform = $editfilterform;
}
else{
- $this->_redirect('/user/filter/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/forbidden');
}
}catch (Zend_Exception $e) {
echo "Error message 2: " . $e->getMessage() . "\n";
- $this->_redirect('/user/filter/index/page/'.$page.'/modifyresult/error');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/error');
}
}
}
@@ -235,7 +244,7 @@ class User_FilterController extends Zend_Controller_Action
$pools = $poolMapper->findBY('groupID',$this->membership->getGroupID());
$bootisoMapper = new Application_Model_BootIsoMapper();
- $bootisos = $bootisoMapper->findBY('groupID',$this->membership->getGroupID());
+ $bootisos = $bootisoMapper->findBY('groupID',$this->membership->getGroupID(),true);
$membershipMapper = new Application_Model_MembershipMapper();
$memberships = $membershipMapper->findBY('groupID',$this->membership->getGroupID());
@@ -264,7 +273,6 @@ class User_FilterController extends Zend_Controller_Action
$this->_redirect('/user');
$filterID = $this->_request->getParam('filterID');
- $page = $this->_request->getParam('page');
$filterMapper = new Application_Model_FilterMapper();
$filter = new Application_Model_Filter();
$filterMapper->find($filterID,$filter);
@@ -274,24 +282,24 @@ class User_FilterController extends Zend_Controller_Action
if($filter->getGroupID() == $this->membership->getGroupID()){
if (!isset($_POST["add"])){
try{
- $addform = new user_Form_FilterEntry(array( 'buttontext' => 'Add Filterentry',
- 'filterID' => $filterID,
- 'selectData' => $selectData,
- 'data' => $_POST
- ));
+ $addform = new user_Form_FilterEntry(array(
+ 'buttontext' => 'Add Filterentry',
+ 'filterID' => $filterID,
+ 'selectData' => $selectData,
+ 'data' => $_POST,
+ 'page' => $this->page));
$addform->populate($_POST);
- $addform->setPage($page);
$this->view->addform = $addform;
}catch (Zend_Exception $e) {
echo "Error message 2: " . $e->getMessage() . "\n";
- $this->_redirect('/user/filter/index/page/'.$page.'/addresult/error');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/addresult/error');
}
} else{
- $addform = new user_Form_FilterEntry(array('buttontext' => 'Add Filterentry',
- 'selectData' => $selectData,
- 'data'=>$_POST
- ));
- $addform->setPage($page);
+ $addform = new user_Form_FilterEntry(array(
+ 'buttontext' => 'Add Filterentry',
+ 'selectData' => $selectData,
+ 'data' => $_POST,
+ 'page' => $this->page));
if ($addform->isValid($_POST)) {
print_a('valid');
$newfilterenty = new Application_Model_FilterEntries();
@@ -315,13 +323,13 @@ class User_FilterController extends Zend_Controller_Action
$newfilter2 = new Application_Model_FilterEntriesMapper();
$newfilter2->save($newfilterenty);
- $this->_redirect('/user/filter/index/page/'.$page.'/addresult/ok');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/addresult/ok');
}
$this->view->addform = $addform;
}
}
else{
- $this->_redirect('/user/filter/index/page/'.$page.'/addresult/forbidden');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/addresult/forbidden');
}
}
@@ -330,7 +338,6 @@ class User_FilterController extends Zend_Controller_Action
//ACL: is he allowed to edit filterentrys ?
if(!Pbs_Acl::checkRight('ffe'))
$this->_redirect('/user');
- $page = $this->_request->getParam('page');
$selectData = $this->prepareFormData();
if (!isset($_POST["add"])){
try{
@@ -348,30 +355,30 @@ class User_FilterController extends Zend_Controller_Action
$filterentry->setFiltertypeID($_POST['filtertypeID']) ;
}
$data = $filterentry->toArray();
- $editfilterform = new user_Form_FilterEntry(array('buttontext' => 'Edit Filterentry',
+ $editfilterform = new user_Form_FilterEntry(array(
+ 'buttontext' => 'Edit Filterentry',
'selectData' => $selectData,
- 'data' => $data
- ));
- $editfilterform->setPage($page);
+ 'data' => $data,
+ 'page' => $this->page));
$editfilterform->populate($filterentry->toArray());
$this->view->editfilterform = $editfilterform;
}
else{
- $this->_redirect('/user/filter/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/forbidden');
}
}catch (Zend_Exception $e) {
echo "Error message 2: " . $e->getMessage() . "\n";
- $this->_redirect('/user/filter/index/page/'.$page.'/modifyresult/error');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/error');
}
} else{
try{
$filterentriesID = $this->_request->getParam('filterentriesID');
- $editfilterform = new user_Form_FilterEntry(array('buttontext' => 'Edit Filterentry',
+ $editfilterform = new user_Form_FilterEntry(array(
+ 'buttontext' => 'Edit Filterentry',
'selectData' => $selectData,
- 'data' => $_POST
- ));
- $editfilterform->setPage($page);
+ 'data' => $_POST,
+ 'page' => $this->page));
if ($editfilterform->isValid($_POST)) {
$filterentry = new Application_Model_FilterEntries();
$filterentriesmapper = new Application_Model_FilterEntriesMapper();
@@ -402,17 +409,17 @@ class User_FilterController extends Zend_Controller_Action
$newfilter2 = new Application_Model_FilterEntriesMapper();
$newfilter2->save($newfilterenty);
- $this->_redirect('/user/filter/index/page/'.$page.'/modifyresult/ok');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/ok');
}
else{
- $this->_redirect('/user/filter/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/forbidden');
}
}
$this->view->editfilterform = $editfilterform;
}catch (Zend_Exception $e) {
echo "Error message 2: " . $e->getMessage() . "\n";
- $this->_redirect('/user/filter/index/page/'.$page.'/modifyresult/error');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/error');
}
}
}
@@ -424,7 +431,6 @@ class User_FilterController extends Zend_Controller_Action
$this->_redirect('/user');
$filterentriesID = $this->_request->getParam('filterentriesID');
- $page = $this->_request->getParam('page');
if(is_numeric($filterentriesID)){
$filterentriesmapper = new Application_Model_FilterEntriesMapper();
$filterentry = new Application_Model_FilterEntries();
@@ -442,19 +448,19 @@ class User_FilterController extends Zend_Controller_Action
$filterentriesmapper = new Application_Model_FilterEntriesMapper();
$filterentriesmapper->delete($deletefilterentry);
- $this->_redirect('/user/filter/index/page/'.$page.'/deleteresult/ok');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/ok');
}catch (Zend_Exception $e) {
echo "Error message 2: " . $e->getMessage() . "\n";
- $this->_redirect('/user/filter/index/page/'.$page.'/deleteresult/error');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/error');
}
}
else{
- $this->_redirect('/user/filter/index/page/'.$page.'/deleteresult/forbidden');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/forbidden');
}
}
else{
- $this->_redirect('/user/filter/index/page/'.$page.'/deleteresult/error');
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/error');
}
}
private function fillup($string, $length, $seperator=':',$sign='0'){
diff --git a/application/modules/user/controllers/PoolController.php b/application/modules/user/controllers/PoolController.php
index 5584b85..bdf23b3 100644
--- a/application/modules/user/controllers/PoolController.php
+++ b/application/modules/user/controllers/PoolController.php
@@ -3,6 +3,8 @@
class User_PoolController extends Zend_Controller_Action
{
private $membership;
+ protected $page;
+
public function init()
{
if (Zend_Auth::getInstance()->hasIdentity()) {
@@ -15,10 +17,10 @@ class User_PoolController extends Zend_Controller_Action
$membershipMapper = new Application_Model_MembershipMapper();
$this->membership = new Application_Model_Membership();
$membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
- ;
} else {
$this->_helper->redirector('login', 'auth');
}
+ $this->page = $this->_request->getParam('page');
}
public function indexAction()
@@ -101,15 +103,15 @@ class User_PoolController extends Zend_Controller_Action
if(!Pbs_Acl::checkRight('poc'))
$this->_redirect('/user');
- $page = $this->_request->getParam('page');
-
if (!isset($_POST["add"])){
- $addfilterform = new user_Form_Pool(array('buttontext' => 'Create Pool'));
- $addfilterform->setPage($page);
+ $addfilterform = new user_Form_Pool(array(
+ 'buttontext' => 'Create Pool',
+ 'page' => $this->page));
$this->view->addpool = $addfilterform;
}else {
- $addpoolform = new user_Form_Pool(array('buttontext' => 'Create Pool'),$_POST);
- $addpoolform->setPage($page);
+ $addpoolform = new user_Form_Pool(array(
+ 'buttontext' => 'Create Pool'
+ 'page' => $this->page),$_POST);
if ($addpoolform->isValid($_POST)) {
try{
$pool = new Application_Model_Pool($_POST);
@@ -129,7 +131,6 @@ class User_PoolController extends Zend_Controller_Action
public function deletepoolAction()
{
$poolID = $this->_request->getParam('poolID');
- $page = $this->_request->getParam('page');
// ACL: is he allowed to delete a pool?
if(!Pbs_Acl::checkRight('pod'))
@@ -143,13 +144,13 @@ class User_PoolController extends Zend_Controller_Action
$deletepool = new Application_Model_Pool();
$deletepool->setID($poolID);
$poolmapper->delete($deletepool);
- $this->_redirect('/user/pool/index/page/'.$page.'/deleteresult/ok');
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/deleteresult/ok');
}
else{
- $this->_redirect('/user/pool/index/page/'.$page.'/deleteresult/forbidden');
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/deleteresult/forbidden');
}
}
- $this->_redirect('/user/pool/index/page/'.$page.'/deleteresult/error');
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/deleteresult/error');
}
public function editpoolAction()
@@ -158,7 +159,6 @@ class User_PoolController extends Zend_Controller_Action
if(!Pbs_Acl::checkRight('poe'))
$this->_redirect('/user');
- $page = $this->_request->getParam('page');
if (!isset($_POST["add"])){
$poolID = $this->_request->getParam('poolID');
$pool = new Application_Model_Pool();
@@ -166,22 +166,23 @@ class User_PoolController extends Zend_Controller_Action
$poolmapper->find($poolID,$pool);
if($pool->getGroupID() == $this->membership->getGroupID()){
$poolArray = $pool->toArray();
- $editpool = new user_Form_Pool(array('buttontext' => 'Edit Pool'));
- $editpool->setPage($page);
+ $editpool = new user_Form_Pool(array(
+ 'buttontext' => 'Edit Pool'
+ 'page' => $this->page));
$editpool->populate($poolArray);
$this->view->editpool = $editpool;
}
else{
- $this->_redirect('/user/pool/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/modifyresult/forbidden');
}
}else {
- $editpoolform = new user_Form_Pool(array('buttontext' => 'Edit Pool'),$_POST);
- $editpoolform->setPage($page);
+ $editpoolform = new user_Form_Pool(array(
+ 'buttontext' => 'Edit Pool'
+ 'page' => $this->page),$_POST);
if ($editpoolform->isValid($_POST)) {
try{
$poolmapper = new Application_Model_PoolMapper();
$poolID = $this->_request->getParam('poolID');
- $page = $this->_request->getParam('page');
$pooldb = new Application_Model_Pool();
$poolmapper->find($poolID,$pooldb);
print_a($pooldb->getGroupID(), $this->membership->getGroupID());
@@ -190,14 +191,14 @@ class User_PoolController extends Zend_Controller_Action
$pool->setID($poolID);
$pool->setGroupID($this->membership->getGroupID());
$poolmapper->save($pool);
- $this->_redirect('/user/pool/index/page/'.$page.'/modifyresult/ok');
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/modifyresult/ok');
}
else{
- $this->_redirect('/user/pool/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/modifyresult/forbidden');
}
}catch (Zend_Exception $e) {
echo "Error message 2: " . $e->getMessage() . "\n";
- $this->_redirect('/user/pool/index/page/'.$page.'/modifyresult/error');
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/modifyresult/error');
}
}
$this->view->editpool = $editpoolform;
@@ -208,7 +209,6 @@ class User_PoolController extends Zend_Controller_Action
{
$clientID = $this->_request->getParam('clientID');
$poolID = $this->_request->getParam('poolID');
- $page = $this->_request->getParam('page');
// ACL: Is he allowed to link clients to pools?
if(!Pbs_Acl::checkRight('polc'))
@@ -224,12 +224,15 @@ class User_PoolController extends Zend_Controller_Action
}
$freeclients = $this->arrayDiff($clients,$assignedclientsArray);
- $poolclient = new user_Form_PoolClient(array('buttontext' => 'Link Client','clients'=> $freeclients));
- $poolclient->setPage($page);
+ $poolclient = new user_Form_PoolClient(array(
+ 'buttontext' => 'Link Client',
+ 'clients'=> $freeclients,
+ 'page' => $this->page));
$this->view->poolclient = $poolclient;
}else {
- $poolclient = new user_Form_PoolClient(array('buttontext' => 'Link Client'),$_POST);
- $poolclient->setPage($page);
+ $poolclient = new user_Form_PoolClient(array(
+ 'buttontext' => 'Link Client',
+ 'page' => $this->page),$_POST);
try{
$poolID = $this->_request->getParam('poolID');
$poolmapper = new Application_Model_PoolMapper();
@@ -247,14 +250,14 @@ class User_PoolController extends Zend_Controller_Action
$poolentry->setClientID($clientID);
}
$poolentriesmapper->save($poolentry);
- $this->_redirect('/user/pool/index/page/'.$page.'/linkresult/ok');
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/linkresult/ok');
}
else{
- $this->_redirect('/user/pool/index/page/'.$page.'/linkresult/forbidden');
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/linkresult/forbidden');
}
}catch (Zend_Exception $e) {
echo "Error message 2: " . $e->getMessage() . "\n";
- $this->_redirect('/user/pool/index/page/'.$page.'/linkresult/error');
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/linkresult/error');
}
$this->view->poolclient = $poolclient;
}
@@ -263,7 +266,6 @@ class User_PoolController extends Zend_Controller_Action
public function unlinkclientAction()
{
$poolentriesID = $this->_request->getParam('poolentriesID');
- $page = $this->_request->getParam('page');
// ACL: Is he allowed to unlink clients from pools?
if(!Pbs_Acl::checkRight('pouc'))
@@ -288,14 +290,14 @@ class User_PoolController extends Zend_Controller_Action
$deletepoolentries->setID($poolentriesID);
$deletepoolentriesmapper = new Application_Model_PoolEntriesMapper();
$deletepoolentriesmapper->delete($deletepoolentries);
- $this->_redirect('/user/pool/index/page/'.$page.'/unlinkresult/ok');
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/unlinkresult/ok');
}
else{
- $this->_redirect('/user/pool/index/page/'.$page.'/unlinkresult/forbidden');
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/unlinkresult/forbidden');
}
}
else{
- $this->_redirect('/user/pool/index/page/'.$page.'/unlinkresult/error');
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/unlinkresult/error');
}
}
diff --git a/application/modules/user/controllers/PrebootController.php b/application/modules/user/controllers/PrebootController.php
index 4a0a95a..f8c8ba7 100644
--- a/application/modules/user/controllers/PrebootController.php
+++ b/application/modules/user/controllers/PrebootController.php
@@ -6,6 +6,7 @@ class User_PrebootController extends Zend_Controller_Action
protected $prebootMapper;
protected $membershipMapper;
protected $membership;
+ protected $page;
public function init()
{
@@ -25,6 +26,7 @@ class User_PrebootController extends Zend_Controller_Action
} else {
$this->_helper->redirector('login', 'auth');
}
+ $this->page = $this->_request->getParam('page');
}
@@ -62,6 +64,24 @@ class User_PrebootController extends Zend_Controller_Action
$this->view->prebootlist = $this->prebootMapper->findBy("groupID", $groupID);
+ // Pagination
+ $perpage = 2;
+ $req_page = $this->_request->getParam('page');
+ $all = count($this->view->prebootlist);
+ $numpages = ceil($all/$perpage);
+ if($req_page < 0 || !is_numeric($req_page) )
+ $req_page = 0;
+ if($req_page >= $numpages)
+ $req_page = $numpages-1;
+ $startitem = $req_page * $perpage;
+
+ $pagination = new Pbs_Pagination();
+ $this->view->pagination = $pagination->pagination('/user/preboot/index',$req_page,$numpages);
+ $this->view->page = $req_page;
+ $this->view->prebootlist = array_slice($this->view->prebootlist,$startitem,$perpage);
+
+
+
$this->view->update = array();
$update = $this->_request->getParam('checkupdate');
@@ -78,13 +98,17 @@ class User_PrebootController extends Zend_Controller_Action
//TODO ACL Is he allowed to create Preboots?
if(false)
- $this->_redirect('/user/preboot/index/addresult/forbidden');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/forbidden');
if (!isset($_POST["createpreboot"])){
- $prebootForm = new user_Form_Preboot(array('action' => 'createpreboot'));
+ $prebootForm = new user_Form_Preboot(array(
+ 'action' => 'createpreboot',
+ 'page' => $this->page));
} else {
- $prebootForm = new user_Form_Preboot(array('action' => 'createpreboot'),$_POST);
+ $prebootForm = new user_Form_Preboot(array(
+ 'action' => 'createpreboot',
+ 'page' => $this->page),$_POST);
if ($prebootForm->isValid($_POST)) {
@@ -119,11 +143,11 @@ class User_PrebootController extends Zend_Controller_Action
{
echo "Caught exception: " . get_class($e) . "<br/>";
echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/preboot/index/addresult/error');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/error');
//TODO Delete folder + preboot in DB
}
- $this->_redirect('/user/preboot/index/addresult/ok');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/ok');
}
}
@@ -135,7 +159,7 @@ class User_PrebootController extends Zend_Controller_Action
//TODO ACL Is he allowed to update Preboots?
if(false)
- $this->_redirect('/user/preboot/index/updateresult/forbidden');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/updateresult/forbidden');
$prebootID = $preboot->getID();
exec("wget --server-response --spider ".escapeshellcmd($preboot->getPath_preboot())." 2>&1 | grep 'Last-Modified:'", $prebootdate);
@@ -166,17 +190,17 @@ class User_PrebootController extends Zend_Controller_Action
{
//TODO ACL Is he allowed to update Preboots?
if(false)
- $this->_redirect('/user/preboot/index/updateresult/forbidden');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/updateresult/forbidden');
$prebootID = $this->_request->getParam('prebootID');
if (!is_numeric($prebootID))
- $this->_redirect('/user/preboot/index/updateresult/forbidden');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/updateresult/forbidden');
$preboot = new Application_Model_PreBoot();
$this->prebootMapper->find($prebootID,$preboot);
if($this->membership->getGroupID() != $preboot->getGroupID())
- $this->_redirect('/user/preboot/index/updateresult/forbidden');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/updateresult/forbidden');
$path_preboot = "../resources/bootmedium/$prebootID/";
@@ -184,7 +208,7 @@ class User_PrebootController extends Zend_Controller_Action
exec("wget -O '".$path_preboot."preboot.zip' ".escapeshellcmd($preboot->getPath_preboot())." 2>&1 | grep 'saved'", $status);
if(!array_pop($status)){
- $this->_redirect('/user/preboot/index/updateresult/404');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/updateresult/404');
}
try{
@@ -214,23 +238,23 @@ class User_PrebootController extends Zend_Controller_Action
{
echo "Caught exception: " . get_class($e) . "<br/>";
echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/preboot/index/modifyresult/error');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/error');
//TODO Delete Folder + Preboot
}
- $this->_redirect('/user/preboot/index/modifyresult/ok');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/ok');
}
public function editprebootAction()
{
//TODO ACL Is he allowed to edit Preboots?
if(false)
- $this->_redirect('/user/preboot/index/modifyresult/forbidden');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden');
$prebootID = $this->_request->getParam('prebootID');
if (!is_numeric($prebootID))
- $this->_redirect('/user/preboot/index/modifyresult/forbidden');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden');
if (!isset($_POST["editpreboot"])){
@@ -238,14 +262,20 @@ class User_PrebootController extends Zend_Controller_Action
$this->prebootMapper->find($prebootID, $preboot);
if($this->membership->getGroupID() != $preboot->getGroupID())
- $this->_redirect('/user/preboot/index/modifyresult/forbidden');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden');
- $prebootForm = new user_Form_Preboot(array('action' => 'editpreboot', 'rights' => 'meta'));
+ $prebootForm = new user_Form_Preboot(array(
+ 'action' => 'editpreboot',
+ 'rights' => 'meta',
+ 'page' => $this->page));
$prebootForm->populate($preboot->toArray());
}else{
- $prebootForm = new user_Form_Preboot(array('action' => 'editpreboot', 'rights' => 'meta'),$_POST);
+ $prebootForm = new user_Form_Preboot(array(
+ 'action' => 'editpreboot',
+ 'rights' => 'meta',
+ 'page' => $this->page),$_POST);
if ($prebootForm->isValid($_POST)) {
@@ -263,7 +293,7 @@ class User_PrebootController extends Zend_Controller_Action
//TODO ACL Is he allowed to edit the Preboot Path?
if(false)
- $this->_redirect('/user/preboot/index/modifyresult/forbidden');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden');
exec("wget -O '".$path_preboot."preboot.zip' ".escapeshellcmd($preboot->getPath_preboot()) ." 2>&1 | grep 'saved'" , $status);
if(!array_pop($status)){
@@ -300,7 +330,7 @@ class User_PrebootController extends Zend_Controller_Action
}catch(Zend_Exception $e){
echo "Caught exception: " . get_class($e) . "<br/>";
echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/preboot/index/modifyresult/error');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/error');
}
}
@@ -310,11 +340,11 @@ class User_PrebootController extends Zend_Controller_Action
}catch(Zend_Exception $e){
echo "Caught exception: " . get_class($e) . "<br/>";
echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/preboot/index/modifyresult/error');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/error');
//TODO Delete Folder + Preboot
}
- $this->_redirect('/user/preboot/index/modifyresult/ok');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/ok');
}
}
@@ -326,18 +356,18 @@ class User_PrebootController extends Zend_Controller_Action
//TODO ACL Is he allowed to delete Preboots?
if(false)
- $this->_redirect('/user/preboot/index/deleteresult/forbidden');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/forbidden');
try{
$prebootID = $this->_request->getParam('prebootID');
if (!is_numeric($prebootID))
- $this->_redirect('/user/preboot/index/deleteresult/forbidden');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/forbidden');
$preboot = new Application_Model_PreBoot();
$this->prebootMapper->find($prebootID, $preboot);
if($this->membership->getGroupID() != $preboot->getGroupID())
- $this->_redirect('/user/preboot/index/deleteresult/forbidden');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/forbidden');
$this->prebootMapper->delete($preboot);
exec("rm -r ../resources/bootmedium/".$prebootID);
@@ -345,9 +375,9 @@ class User_PrebootController extends Zend_Controller_Action
}catch(Zend_Exception $e){
echo "Caught exception: " . get_class($e) . "<br/>";
echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/preboot/index/deleteresult/error');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/error');
}
- $this->_redirect('/user/preboot/index/deleteresult/ok');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/ok');
}
diff --git a/application/modules/user/forms/Bootiso.php b/application/modules/user/forms/Bootiso.php
index d080ac2..1facf94 100644
--- a/application/modules/user/forms/Bootiso.php
+++ b/application/modules/user/forms/Bootiso.php
@@ -7,7 +7,7 @@ class user_Form_Bootiso extends Zend_Form
private $groupdepth;
private $action;
private $rights;
- private $page;
+ private $page;
public function setRights($rights){
$this->rights = $rights;
@@ -21,10 +21,9 @@ class user_Form_Bootiso extends Zend_Form
public function setGroupdepth($groupdepth){
$this->groupdepth = $groupdepth;
}
- public function setPage($page){
- $this->page = $page;
- }
-
+ public function setPage($p){
+ $this->page = $p;
+ }
public function init()
{
@@ -112,12 +111,8 @@ class user_Form_Bootiso extends Zend_Form
));
$this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/user/bootiso/page/'.$this->page.'"'
- ));
-
- $this->addElement('hidden','page', array(
- 'value' => $this->page
- ));
+ 'onclick' => 'self.location="/user/bootiso/index/page/'.$this->page.'"'
+ ));
?>
<script>
diff --git a/application/modules/user/forms/Bootos.php b/application/modules/user/forms/Bootos.php
index 3e45f05..867cfc1 100644
--- a/application/modules/user/forms/Bootos.php
+++ b/application/modules/user/forms/Bootos.php
@@ -142,9 +142,9 @@ class user_Form_Bootos extends Zend_Form
'label' => $label,
));
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/user/bootos/page/'.$this->page.'"'
- ));
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/user/bootos/index/page/'.$this->page.'"'
+ ));
?>
diff --git a/application/modules/user/forms/Client.php b/application/modules/user/forms/Client.php
index aa8d478..9814583 100644
--- a/application/modules/user/forms/Client.php
+++ b/application/modules/user/forms/Client.php
@@ -3,6 +3,17 @@
class user_Form_Client extends Zend_Form
{
+ private $buttontext = 'Save';
+ private $groups;
+ private $page;
+
+ public function setButtontext($v){
+ $this->buttontext = $v;
+ }
+ public function setPage($page){
+ $this->page = $page;
+ }
+
public function init()
{
$this->setName("pool");
@@ -48,20 +59,6 @@ class user_Form_Client extends Zend_Form
'onclick' => 'self.location="/user/client/index/page/'.$this->page.'"'
));
- $this->addElement('hidden','page', array(
- 'value' => $this->page
- ));
}
- private $buttontext = 'Save';
- private $groups;
- function setButtontext($v){
- $this->buttontext = $v;
- }
- private $page;
- function setPage($page){
- $this->page = $page;
- }
-
-
}
diff --git a/application/modules/user/forms/FilterEntry.php b/application/modules/user/forms/FilterEntry.php
index 33453d7..3fe1aa7 100644
--- a/application/modules/user/forms/FilterEntry.php
+++ b/application/modules/user/forms/FilterEntry.php
@@ -3,7 +3,27 @@
class user_Form_FilterEntry extends Zend_Form
{
- private $filterID = 0;
+ private $filterID = 0;
+ private $data ;
+ private $buttontext = 'Save';
+ private $selectData;
+ private $page;
+
+ public function setButtontext($v){
+ $this->buttontext = $v;
+ }
+ public function setData($v){
+ $this->data = $v;
+ }
+ public function setFilterID($v){
+ $this->filterID = $v;
+ }
+ public function setSelectData($v){
+ $this->selectData = $v;
+ }
+ public function setPage($page){
+ $this->page = $page;
+ }
public function init()
{
@@ -151,6 +171,7 @@ class user_Form_FilterEntry extends Zend_Form
}
}
$filtervalue1->setRegisterInArrayValidator(false);
+
break;
case "5":
$desc = "Select a Membership";
@@ -339,26 +360,6 @@ class user_Form_FilterEntry extends Zend_Form
}
-
- private $buttontext = 'Save';
- function setButtontext($v){
- $this->buttontext = $v;
- }
- private $data ;
- function setData($v){
- $this->data = $v;
- }
- function setFilterID($v){
- $this->filterID = $v;
- }
- private $selectData;
- function setSelectData($v){
- $this->selectData = $v;
- }
- private $page;
- function setPage($page){
- $this->page = $page;
- }
}
?>
diff --git a/application/modules/user/forms/Pool.php b/application/modules/user/forms/Pool.php
index 055d0a7..be2f6c6 100644
--- a/application/modules/user/forms/Pool.php
+++ b/application/modules/user/forms/Pool.php
@@ -2,6 +2,15 @@
class user_Form_Pool extends Zend_Form
{
+ private $buttontext = 'Save';
+ private $page;
+
+ public function setButtontext($v){
+ $this->buttontext = $v;
+ }
+ public function setPage($page){
+ $this->page = $page;
+ }
public function init()
{
@@ -24,9 +33,8 @@ class user_Form_Pool extends Zend_Form
'required' => false,
'label' => 'Description:',
));
- // TODO: Add target of Filter
- $this->addElement('text', 'location', array(
+ $this->addElement('text', 'location', array(
'filters' => array('StringTrim'),
'validators' => array(
array('StringLength', false, array(0, 30)),
@@ -43,20 +51,8 @@ class user_Form_Pool extends Zend_Form
$this->addElement('button', 'Cancel', array(
'onclick' => 'self.location="/user/pool/index/page/'.$this->page.'"'
- ));
-
- $this->addElement('hidden','page', array(
- 'value' => $this->page
- ));
+ ));
}
- private $buttontext = 'Save';
- function setButtontext($v){
- $this->buttontext = $v;
- }
- private $page;
- function setPage($page){
- $this->page = $page;
- }
}
diff --git a/application/modules/user/forms/PoolClient.php b/application/modules/user/forms/PoolClient.php
index c4c6e7f..d259723 100644
--- a/application/modules/user/forms/PoolClient.php
+++ b/application/modules/user/forms/PoolClient.php
@@ -3,7 +3,20 @@
class user_Form_PoolClient extends Zend_Form
{
private $clients;
-
+ private $page;
+ private $buttontext = 'Save';
+
+ function setButtontext($v){
+ $this->buttontext = $v;
+ }
+ public function setClients($clients){
+ $this->clients = $clients;
+ return $this;
+ }
+ public function setPage($page){
+ $this->page = $page;
+ }
+
public function init()
{
$this->setName("addClientToPool");
@@ -21,14 +34,10 @@ class user_Form_PoolClient extends Zend_Form
'ignore' => true,
'label' => 'Save',
));
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/user/filter/index/page/'.$this->page.'"'
+ ));
}
- public function setClients($clients){
- $this->clients = $clients;
- return $this;
- }
- private $buttontext = 'Save';
- function setButtontext($v){
- $this->buttontext = $v;
- }
+
}
diff --git a/application/modules/user/forms/Preboot.php b/application/modules/user/forms/Preboot.php
index cc437c5..2b8ccff 100644
--- a/application/modules/user/forms/Preboot.php
+++ b/application/modules/user/forms/Preboot.php
@@ -5,14 +5,17 @@ class user_Form_Preboot extends Zend_Form
private $action;
private $rights;
+ private $page;
public function setRights($rights){
$this->rights = $rights;
}
public function setAction($action){
- $this->action = $action;
-
+ $this->action = $action;
}
+ public function setPage($p){
+ $this->page = $p;
+ }
public function init()
{
@@ -53,8 +56,8 @@ class user_Form_Preboot extends Zend_Form
'label' => $label,
));
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/user/preboot"'
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/user/preboot/index/page/'.$this->page.'"'
));
}
diff --git a/application/modules/user/views/scripts/bootiso/index.phtml b/application/modules/user/views/scripts/bootiso/index.phtml
index c41d8d2..f43949d 100644
--- a/application/modules/user/views/scripts/bootiso/index.phtml
+++ b/application/modules/user/views/scripts/bootiso/index.phtml
@@ -1,7 +1,7 @@
<h1>BootMedien</h1>
<?php if($this->notification != ''){echo $this->notification;} ?>
<?php echo $this->formButton('createbootiso', 'Create BootISO', array(
- 'onclick' => 'self.location="/user/bootiso/createbootiso"',
+ 'onclick' => 'self.location="/user/bootiso/createbootiso/page/'.$this->page.'"',
'class' => 'addbutton'))?>
<table>
<tr>
diff --git a/application/modules/user/views/scripts/bootos/index.phtml b/application/modules/user/views/scripts/bootos/index.phtml
index 92e6bbb..8982fb2 100644
--- a/application/modules/user/views/scripts/bootos/index.phtml
+++ b/application/modules/user/views/scripts/bootos/index.phtml
@@ -5,7 +5,7 @@
'class' => 'updatebutton',
))?>
<?php echo $this->formButton('createbootos', 'Create BootOS', array(
- 'onclick' => 'self.location="/user/bootos/createbootos"',
+ 'onclick' => 'self.location="/user/bootos/createbootos/page/'.$this->page.'"',
'class' => 'addbutton'))?>
<table>
diff --git a/application/modules/user/views/scripts/client/index.phtml b/application/modules/user/views/scripts/client/index.phtml
index 1e3345e..62c698c 100644
--- a/application/modules/user/views/scripts/client/index.phtml
+++ b/application/modules/user/views/scripts/client/index.phtml
@@ -1,7 +1,7 @@
<h1>Clients</h1>
<?php if($this->notification != ''){echo $this->notification;} ?>
<?php echo $this->formButton('createbootos', 'Create Client', array(
- 'onclick' => 'self.location="/user/client/addclient"',
+ 'onclick' => 'self.location="/user/client/addclient/page/'.$this->page.'"',
'class' => 'addbutton'))?>
<?php if ($this->clients): ?>
diff --git a/application/modules/user/views/scripts/filter/index.phtml b/application/modules/user/views/scripts/filter/index.phtml
index bb7f11a..1716a95 100644
--- a/application/modules/user/views/scripts/filter/index.phtml
+++ b/application/modules/user/views/scripts/filter/index.phtml
@@ -1,7 +1,7 @@
<h1>Filters</h1>
<?php if($this->notification != ''){echo $this->notification;} ?>
<?php echo $this->formButton('createconfig', 'Create Filter', array(
- 'onclick' => 'self.location="/user/filter/addfilter"',
+ 'onclick' => 'self.location="/user/filter/addfilter/page/'.$this->page.'"',
'class' => 'addbutton'))?>
<?php if ($this->filters): ?>
@@ -93,7 +93,7 @@
'controller' => 'filter',
'action' => 'editfilterentry',
'filterentriesID' => $filterentry['filterentriesID'],
- 'page' => $this->page
+ 'page' => $this->page
),
'default',
true) ?>"><img src='/media/img/edit.png' alt='Edit Filterentry'/></a>
@@ -103,7 +103,7 @@
'controller' => 'filter',
'action' => 'removefilterentry',
'filterentriesID' => $filterentry['filterentriesID'],
- 'page' => $this->page
+ 'page' => $this->page
),
'default',
true) ?>"><img src='/media/img/delete.png' alt='Delete Filterentry'/></a>
diff --git a/application/modules/user/views/scripts/pool/index.phtml b/application/modules/user/views/scripts/pool/index.phtml
index 36934f6..4d224a1 100644
--- a/application/modules/user/views/scripts/pool/index.phtml
+++ b/application/modules/user/views/scripts/pool/index.phtml
@@ -1,7 +1,7 @@
<h1>Pools</h1>
<?php if($this->notification != ''){echo $this->notification;} ?>
<?php echo $this->formButton('createconfig', 'Create Pool', array(
- 'onclick' => 'self.location="/user/pool/createpool"',
+ 'onclick' => 'self.location="/user/pool/createpool/page/'.$this->page.'"',
'class' => 'addbutton'))?>
<?php if ($this->pools): ?>
@@ -97,8 +97,14 @@
<?php echo $this->pagination; ?>
<?php if (isset($this->freeclients) && count($this->freeclients)>0): ?>
-<h2>Free clients</h2>
-<table >
+ <h2 style='margin-top:20px;'>Free clients</h2>
+ <p style="text-align:right;">
+ <span style="font-weight:bold;">Search:</span> <input type="text" id="txtSearch" name="txtSearch" maxlength="50" />&nbsp;
+ <img id="imgSearch" src="/media/img/delete.png" alt="Cancel Search" title="Cancel Search" style="width:150px;width:14px;height:14px;" />
+ </p>
+
+<div style="height: 200px; overflow: scroll; overflow-x: hidden; ">
+<table id='tblSearch'>
<tr>
<th>ClientID</th>
<th>MacAdress</th>
@@ -132,6 +138,74 @@ foreach ($this->freeclients as $client): ?>
</tr>
<?php endforeach ?>
</table>
+</div>
+<script>
+jQuery.expr[":"].containsNoCase = function(el, i, m) {
+ var search = m[3];
+ if (!search) return false;
+ return eval("/" + search + "/i").test($(el).text());
+};
+
+ jQuery(document).ready(function() {
+ // used for the first example in the blog post
+ jQuery('li:contains(\'DotNetNuke\')').css('color', '#0000ff').css('font-weight', 'bold');
+
+ // hide the cancel search image
+ jQuery('#imgSearch').hide();
+
+ // reset the search when the cancel image is clicked
+ jQuery('#imgSearch').click(function() {
+ resetSearch();
+ });
+
+ // cancel the search if the user presses the ESC key
+ jQuery('#txtSearch').keyup(function(event) {
+ if (event.keyCode == 27) {
+ resetSearch();
+ }
+ });
+
+ // execute the search
+ jQuery('#txtSearch').keyup(function() {
+ // only search when there are 3 or more characters in the textbox
+ if (jQuery('#txtSearch').val().length > 2) {
+ // hide all rows
+ jQuery('#tblSearch tr').hide();
+ // show the header row
+ jQuery('#tblSearch tr:first').show();
+ // show the matching rows (using the containsNoCase from Rick Strahl)
+ jQuery('#tblSearch tr td:containsNoCase(\'' + jQuery('#txtSearch').val() + '\')').parent().show();
+ // show the cancel search image
+ jQuery('#imgSearch').show();
+ }
+ else if (jQuery('#txtSearch').val().length == 0) {
+ // if the user removed all of the text, reset the search
+ resetSearch();
+ }
+
+ // if there were no matching rows, tell the user
+ if (jQuery('#tblSearch tr:visible').length == 1) {
+ // remove the norecords row if it already exists
+ jQuery('.norecords').remove();
+ // add the norecords row
+ jQuery('#tblSearch').append('<tr class="norecords"><td colspan="5" class="Normal">No records were found</td></tr>');
+ }
+ });
+});
+
+function resetSearch() {
+ // clear the textbox
+ jQuery('#txtSearch').val('');
+ // show all table rows
+ jQuery('#tblSearch tr').show();
+ // remove any no records rows
+ jQuery('.norecords').remove();
+ // remove the cancel search image
+ jQuery('#imgSearch').hide();
+ // make sure we re-focus on the textbox for usability
+ jQuery('#txtSearch').focus();
+}
+</script>
<?php endif;?>
<?php else: ?>
diff --git a/application/modules/user/views/scripts/preboot/index.phtml b/application/modules/user/views/scripts/preboot/index.phtml
index 21ff310..9e73de1 100644
--- a/application/modules/user/views/scripts/preboot/index.phtml
+++ b/application/modules/user/views/scripts/preboot/index.phtml
@@ -5,7 +5,7 @@
'class' => 'updatebutton',
))?>
<?php echo $this->formButton('createpreboot', 'Create PreBoot', array(
- 'onclick' => 'self.location="/user/preboot/createpreboot"',
+ 'onclick' => 'self.location="/user/preboot/createpreboot/page/'.$this->page.'"',
'class' => 'addbutton'))?>
<table>
<tr>
@@ -31,7 +31,8 @@
'module' => 'user',
'controller' => 'preboot',
'action' => 'updatepreboot',
- 'prebootID' => $preboot->getID()
+ 'prebootID' => $preboot->getID(),
+ 'page' => $this->page
),
'default',
true, false) ?>"><img src='/media/img/update.png' alt='Updates available' /></a></td>
@@ -43,7 +44,8 @@
'module' => 'user',
'controller' => 'preboot',
'action' => 'editpreboot',
- 'prebootID' => $preboot->getID()
+ 'prebootID' => $preboot->getID(),
+ 'page' => $this->page
),
'default',
true, false) ?>"><img src='/media/img/edit.png' alt='Edit Preboot' /></a></td>
@@ -52,10 +54,12 @@
'module' => 'user',
'controller' => 'preboot',
'action' => 'deletepreboot',
- 'prebootID' => $preboot->getID()
+ 'prebootID' => $preboot->getID(),
+ 'page' => $this->page
),
'default',
true) ?>"><img src='/media/img/delete.png' alt='Delete Preboot'/></a></td>
</tr>
<?php endforeach; ?>
-</table> \ No newline at end of file
+</table>
+<?php echo $this->pagination; ?>