diff options
| author | Simon | 2011-04-05 12:50:50 +0200 |
|---|---|---|
| committer | Simon | 2011-04-05 12:50:50 +0200 |
| commit | cbd4bc81de03189d3c774e71223478cf5d0ce401 (patch) | |
| tree | 79cc6c8ade24d69cebf642c0a7fdb0b8e2ec93c7 | |
| parent | Suche in Bootmenu & Bootiso (diff) | |
| download | pbs2-cbd4bc81de03189d3c774e71223478cf5d0ce401.tar.gz pbs2-cbd4bc81de03189d3c774e71223478cf5d0ce401.tar.xz pbs2-cbd4bc81de03189d3c774e71223478cf5d0ce401.zip | |
suche in Config, Filter, Pool und Preboot
10 files changed, 99 insertions, 35 deletions
diff --git a/application/modules/user/controllers/ConfigController.php b/application/modules/user/controllers/ConfigController.php index 83ff804..4bc2526 100644 --- a/application/modules/user/controllers/ConfigController.php +++ b/application/modules/user/controllers/ConfigController.php @@ -66,6 +66,17 @@ class user_ConfigController extends Zend_Controller_Action $config->setGroupID("[".$config->getGroupID()."] ".$groupMapper->find($config->getGroupID())->getTitle()); } + // Search + $search = $this->_request->getParam('search'); + $mySearch = new Pbs_Search(); + $mySearch->setSearchTerm($search); + $mySearch->setModule('config'); + $this->view->searchform = $mySearch->searchForm(); + if($search != ''){ + $this->view->search = $mySearch->getSearchTerm(); + $this->view->configlist = $mySearch->search($this->view->configlist); + } + // Pagination $pagination = new Pbs_Pagination(); $pagination->setPerPage(2); @@ -79,6 +90,10 @@ class user_ConfigController extends Zend_Controller_Action $this->view->configlist = $this->view->configlist; } + + public function searchAction(){ + $this->_redirect('/user/config/index/search/'.($_GET['search'])); + } public function createconfigAction() { diff --git a/application/modules/user/controllers/FilterController.php b/application/modules/user/controllers/FilterController.php index 4ab3ad6..f84f501 100644 --- a/application/modules/user/controllers/FilterController.php +++ b/application/modules/user/controllers/FilterController.php @@ -55,6 +55,17 @@ class User_FilterController extends Zend_Controller_Action $ff->setID($filter['filterID']); $allFilter[] = $ff; } + + // Search + $search = $this->_request->getParam('search'); + $mySearch = new Pbs_Search(); + $mySearch->setSearchTerm($search); + $mySearch->setModule('filter'); + $this->view->searchform = $mySearch->searchForm(); + if($search != ''){ + $this->view->search = $mySearch->getSearchTerm(); + $allFilter = $mySearch->search($allFilter); + } // Pagination $pagination = new Pbs_Pagination(); @@ -69,6 +80,10 @@ class User_FilterController extends Zend_Controller_Action $this->view->filters = $allFilter; } + + public function searchAction(){ + $this->_redirect('/user/filter/index/search/'.($_GET['search'])); + } public function addfilterAction() { diff --git a/application/modules/user/controllers/PoolController.php b/application/modules/user/controllers/PoolController.php index e5fea8c..7800c7a 100644 --- a/application/modules/user/controllers/PoolController.php +++ b/application/modules/user/controllers/PoolController.php @@ -64,6 +64,17 @@ class User_PoolController extends Zend_Controller_Action $ff->setID($pool['poolID']); $yourpools[] = $ff; } + + // Search + $search = $this->_request->getParam('search'); + $mySearch = new Pbs_Search(); + $mySearch->setSearchTerm($search); + $mySearch->setModule('pool'); + $this->view->searchform = $mySearch->searchForm(); + if($search != ''){ + $this->view->search = $mySearch->getSearchTerm(); + $yourpools = $mySearch->search($yourpools); + } // Pagination $pagination = new Pbs_Pagination(); @@ -95,6 +106,10 @@ class User_PoolController extends Zend_Controller_Action if(Pbs_Acl::checkRight('posuc')) $this->view->freeclients = $freeclients; } + + public function searchAction(){ + $this->_redirect('/user/pool/index/search/'.($_GET['search'])); + } public function createpoolAction() { diff --git a/application/modules/user/controllers/PrebootController.php b/application/modules/user/controllers/PrebootController.php index 6944e27..43cbf8a 100644 --- a/application/modules/user/controllers/PrebootController.php +++ b/application/modules/user/controllers/PrebootController.php @@ -64,6 +64,17 @@ class User_PrebootController extends Zend_Controller_Action $this->view->prebootlist = $this->prebootMapper->findBy(array("groupID" => $groupID)); + // Search + $search = $this->_request->getParam('search'); + $mySearch = new Pbs_Search(); + $mySearch->setSearchTerm($search); + $mySearch->setModule('preboot'); + $this->view->searchform = $mySearch->searchForm(); + if($search != ''){ + $this->view->search = $mySearch->getSearchTerm(); + $this->view->prebootlist = $mySearch->search($this->view->prebootlist); + } + // Pagination $pagination = new Pbs_Pagination(); $pagination->setPerPage(2); @@ -89,6 +100,10 @@ class User_PrebootController extends Zend_Controller_Action } } + public function searchAction(){ + $this->_redirect('/user/preboot/index/search/'.($_GET['search'])); + } + public function createprebootAction() { diff --git a/application/modules/user/views/scripts/bootmenu/index.phtml b/application/modules/user/views/scripts/bootmenu/index.phtml index cd82bb7..b580237 100644 --- a/application/modules/user/views/scripts/bootmenu/index.phtml +++ b/application/modules/user/views/scripts/bootmenu/index.phtml @@ -9,7 +9,7 @@ <tr> <th>ID <span class='code'>bootmenuID</span></th> <th>Title <span class='code'>title</span></th> - <th>Changed <span class='code'>changed</span></th> + <th>Changed <span class='code'>created</span></th> <th colspan=3>Actions</th> </tr> <?php if(count($this->bootmenulist)==0) diff --git a/application/modules/user/views/scripts/config/index.phtml b/application/modules/user/views/scripts/config/index.phtml index 478a12d..91177f4 100644 --- a/application/modules/user/views/scripts/config/index.phtml +++ b/application/modules/user/views/scripts/config/index.phtml @@ -1,16 +1,17 @@ <h1>Config</h1> <?php if($this->notification != ''){echo $this->notification;} ?> +<?php echo $this->searchform; ?> <?php echo $this->formButton('createconfig', 'Create Config', array( 'onclick' => 'self.location="/user/config/createconfig/page/'.$this->page.'"', 'class' => 'addbutton'))?> <table> <tr> - <th>ID</th> - <th>Title</th> - <th>GroupID</th> - <th>Shellscript</th> - <th>Changed</th> + <th>ID <span class='code'>configID</span></th> + <th>Title <span class='code'>title</span></th> + <th>GroupID <span class='code'>groupID</span></th> + <th>Shellscript <span class='code'>shellscript</span></th> + <th>Changed <span class='code'>created</span></th> <th colspan=2>Actions</th> </tr> <?php if(count($this->configlist)==0) diff --git a/application/modules/user/views/scripts/filter/index.phtml b/application/modules/user/views/scripts/filter/index.phtml index 9800d42..7f8bad8 100644 --- a/application/modules/user/views/scripts/filter/index.phtml +++ b/application/modules/user/views/scripts/filter/index.phtml @@ -1,5 +1,6 @@ <h1>Filters</h1> <?php if($this->notification != ''){echo $this->notification;} ?> +<?php echo $this->searchform; ?> <?php echo $this->formButton('createconfig', 'Create Filter', array( 'onclick' => 'self.location="/user/filter/addfilter/page/'.$this->page.'"', 'class' => 'addbutton'))?> @@ -7,11 +8,11 @@ <?php if ($this->filters): ?> <table> <tr> - <th>ID</th> - <th>Title</th> - <th>Description</th> - <th>Priority</th> - <th>TargetBootMenu</th> + <th>ID <span class='code'>filterID</span></th> + <th>Title <span class='code'>title</span></th> + <th>Description <span class='code'>description</span></th> + <th>Priority <span class='code'>priority</span></th> + <th>TargetBootMenu <span class='code'>bootmenuID</span></th> <th colspan=3>Actions</th> </tr> <?php foreach ($this->filters as $filter): ?> diff --git a/application/modules/user/views/scripts/pool/index.phtml b/application/modules/user/views/scripts/pool/index.phtml index 80053f2..f7d04e2 100644 --- a/application/modules/user/views/scripts/pool/index.phtml +++ b/application/modules/user/views/scripts/pool/index.phtml @@ -1,5 +1,6 @@ <h1>Pools</h1> <?php if($this->notification != ''){echo $this->notification;} ?> +<?php echo $this->searchform; ?> <?php echo $this->formButton('createconfig', 'Create Pool', array( 'onclick' => 'self.location="/user/pool/createpool/page/'.$this->page.'"', 'class' => 'addbutton'))?> @@ -7,10 +8,10 @@ <?php if ($this->pools): ?> <table > <tr> - <!--<th>ID</th>--> - <th>Title</th> - <th>Description</th> - <th>Location</th> + <!--<th>ID <span class='code'>poolID</span></th>--> + <th>Title <span class='code'>title</span></th> + <th>Description <span class='code'>description</span></th> + <th>Location <span class='code'>location</span></th> <th colspan=3>Actions</th> </tr> <?php foreach ($this->pools as $pool): ?> diff --git a/application/modules/user/views/scripts/preboot/index.phtml b/application/modules/user/views/scripts/preboot/index.phtml index 9e73de1..295f1ca 100644 --- a/application/modules/user/views/scripts/preboot/index.phtml +++ b/application/modules/user/views/scripts/preboot/index.phtml @@ -1,5 +1,6 @@ <h1>Preboot</h1> <?php if($this->notification != ''){echo $this->notification;} ?> +<?php echo $this->searchform; ?> <?php echo $this->formButton('checkupdate', 'Check for Updates', array( 'onclick' => 'self.location="/user/preboot/index/checkupdate/true"', 'class' => 'updatebutton', @@ -9,11 +10,11 @@ 'class' => 'addbutton'))?> <table> <tr> - <th>ID</th> - <th>Title</th> - <th>GroupID</th> - <th>MembershipID</th> - <th>Preboot Path</th> + <th>ID <span class='code'>prebootID</span></th> + <th>Title <span class='code'>title</span></th> + <th>GroupID <span class='code'>groupID</span></th> + <th>MembershipID <span class='code'>membershipID</span></th> + <th>Preboot Path <span class='code'>path_preboot</span></th> <th colspan=3>Actions</th> </tr> <?php if(count($this->prebootlist)==0) diff --git a/library/Pbs/Search.php b/library/Pbs/Search.php index 709651a..b041c3b 100644 --- a/library/Pbs/Search.php +++ b/library/Pbs/Search.php @@ -13,7 +13,7 @@ class Pbs_Search{ <button type='submit' class='searchbutton' value='search'> Search</button>"; $highlight = array(); if($this->searchTerm != ''){ - $str .= "<a href='/user/client/'><img src='/media/img/delete.png' alt='Delete Client'/></a> + $str .= "<a href='/user/".$this->module."/'><img src='/media/img/delete.png' alt='Delete Client'/></a> <script type='text/javascript' src='/media/js/jquery.highlight-3.js'></script>"; foreach($this->getSearchTerms() as $term){ $highlight[] = "$('table').highlight('".$term."');"; @@ -24,14 +24,14 @@ class Pbs_Search{ $(document).ready(function(){"; $str .= implode("\n",$highlight); $str .= "$('#search') - .focus(function() { - $('table th .code').show(); - }).focusout(function() { - $('table th .code').hide(); - }); - $('table th').click(function(){ - $('#search').val($('#search').val()+' '+$(this).find('.code').text()+':'); - });"; + .focus(function() { + $('table th .code').show(); + }).focusout(function() { + $('table th .code').hide(); + }); + $('table th').click(function(){ + $('#search').val($('#search').val()+' '+$(this).find('.code').text()+':'); + });"; $str .= "}); </script>"; $str .= "</form>"; @@ -44,10 +44,10 @@ class Pbs_Search{ $this->searchTerm = trim($search); $parts = explode(" ",$this->searchTerm); - foreach($parts as $this->searchTerm){ - if(stristr($this->searchTerm,":") && ctype_alpha(substr($this->searchTerm,0,strpos($this->searchTerm,":")))){ - $key = substr($this->searchTerm,0,strpos($this->searchTerm,":")); - $value = substr($this->searchTerm,strpos($this->searchTerm,":")+1); + foreach($parts as $search){ + if(stristr($search,":") && ctype_alpha(substr($search,0,strpos($search,":")))){ + $key = substr($search,0,strpos($search,":")); + $value = substr($search,strpos($search,":")+1); $searcha[$key] = $value; } else{ @@ -64,7 +64,7 @@ class Pbs_Search{ $beta = $this->searcha; foreach($this->searchb as $b) $beta[] = $b; - return $beta; + return $beta; } public function search($array){ @@ -102,7 +102,7 @@ class Pbs_Search{ } if (count($this->searcha) > 0 && count($this->searchb) > 0){ $data = array_intersect($com1,$com2); - } + } $data = array_unique($data); foreach( $data as $c) $ges[] = $array[$c]; |
