summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichael pereira2011-03-11 10:02:41 +0100
committermichael pereira2011-03-11 10:02:41 +0100
commita83dfa457afb43a661074bdc1676c1a1d7653625 (patch)
treefebf55c855326b3d6ba79fb663f17fad88f02403
parentbootos getressources (diff)
parentAddClientToPool über Formular gefixxt, Buttonbeschriftungen anhand der Actio... (diff)
downloadpbs2-a83dfa457afb43a661074bdc1676c1a1d7653625.tar.gz
pbs2-a83dfa457afb43a661074bdc1676c1a1d7653625.tar.xz
pbs2-a83dfa457afb43a661074bdc1676c1a1d7653625.zip
Merge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2
-rw-r--r--application/controllers/ClientController.php8
-rw-r--r--application/controllers/FilterController.php30
-rw-r--r--application/controllers/PoolController.php19
-rw-r--r--application/controllers/ResourceController.php5
-rw-r--r--application/controllers/SessionController.php12
-rw-r--r--application/forms/Client.php10
-rw-r--r--application/forms/FilterAdd.php10
-rw-r--r--application/forms/FilterEntriesAdd.php18
-rw-r--r--application/forms/FilterEvaluate.php2
-rw-r--r--application/forms/Pool.php10
-rw-r--r--application/forms/PoolClient.php1
-rw-r--r--application/forms/Session.php10
-rw-r--r--application/models/FilterEntriesMapper.php10
-rw-r--r--application/models/FilterMapper.php2
-rw-r--r--public/.htaccess3
-rw-r--r--public/media/css/style.css1
16 files changed, 97 insertions, 54 deletions
diff --git a/application/controllers/ClientController.php b/application/controllers/ClientController.php
index 580eb6e..affa780 100644
--- a/application/controllers/ClientController.php
+++ b/application/controllers/ClientController.php
@@ -20,11 +20,11 @@ class ClientController extends Zend_Controller_Action
$hh = $this->_request->getParam('hh');
if (!isset($_POST["add"])){
- $addclient = new Application_Form_Client();
+ $addclient = new Application_Form_Client(array('buttontext' => 'Create Client'));
$this->view->addclient = $addclient;
}
else{
- $addfilterform = new Application_Form_Client($_POST);
+ $addfilterform = new Application_Form_Client(array('buttontext' => 'Create Client'),$_POST);
if ($addfilterform->isValid($_POST) || ($mac != '' && $hh != '') ) {
$client = new Application_Model_Client();
$mac = ($mac!='')?$mac:$_POST['macadress'];
@@ -61,12 +61,12 @@ class ClientController extends Zend_Controller_Action
$mapper = new Application_Model_ClientMapper();
$mapper->find($clientID,$data);
- $editclient = new Application_Form_Client();
+ $editclient = new Application_Form_Client(array('buttontext' => 'Edit Client'));
$editclient->populate($data->toArray());
$this->view->editclient = $editclient;
}
else{
- $editclient = new Application_Form_Client($_POST);
+ $editclient = new Application_Form_Client(array('buttontext' => 'Edit Client'),$_POST);
if ($editclient->isValid($_POST) || ($mac != '' && $hh != '') ) {
$client = new Application_Model_Client($_POST);
$client->setID($this->_request->getParam('clientID'));
diff --git a/application/controllers/FilterController.php b/application/controllers/FilterController.php
index 9141e10..7b05b0e 100644
--- a/application/controllers/FilterController.php
+++ b/application/controllers/FilterController.php
@@ -34,10 +34,10 @@ class FilterController extends Zend_Controller_Action
//TODO get bootmenu by group
$bootmenus = $bmmapper->fetchAll();
if (!isset($_POST["add"])){
- $addfilterform = new Application_Form_FilterAdd(array('bootmenus'=>$bootmenus));
+ $addfilterform = new Application_Form_FilterAdd(array('buttontext' => 'Create Filter','bootmenus'=>$bootmenus));
$this->view->addfilterform = $addfilterform;
}else {
- $addfilterform = new Application_Form_FilterAdd(array('bootmenus'=>$bootmenus),$_POST);
+ $addfilterform = new Application_Form_FilterAdd(array('buttontext' => 'Create Filter','bootmenus'=>$bootmenus),$_POST);
if ($addfilterform->isValid($_POST)) {
try{
$newfilter = new Application_Model_Filter($_POST);
@@ -88,7 +88,7 @@ class FilterController extends Zend_Controller_Action
$filtermapper->find($filterID,$filter);
$filter2 = $filter->toArray();
- $editfilterform = new Application_Form_FilterAdd(array('bootmenus'=>$bootmenus));
+ $editfilterform = new Application_Form_FilterAdd(array('buttontext' => 'Edit Filter','bootmenus'=>$bootmenus));
$editfilterform->populate($filter2);
$this->view->editfilterform = $editfilterform;
@@ -96,7 +96,7 @@ class FilterController extends Zend_Controller_Action
try{
$filterID = $this->_request->getParam('filterID');
- $editfilterform = new Application_Form_FilterAdd(array('bootmenus'=>$bootmenus),$_POST);
+ $editfilterform = new Application_Form_FilterAdd(array('buttontext' => 'Edit Filter','bootmenus'=>$bootmenus),$_POST);
//TODO: ACL integrieren
$_POST['groupID'] = 1;
$_POST['membershipID'] = 1;
@@ -122,13 +122,13 @@ class FilterController extends Zend_Controller_Action
// TODO: ACL implementieren ob er editieren darf
if (!isset($_POST["add"])){
try{
- $editfilterform = new Application_Form_FilterEntriesAdd(array('filterID' => $this->_request->getParam('filterID')));
+ $editfilterform = new Application_Form_FilterEntriesAdd(array('buttontext' => 'Add Filterentry','filterID' => $this->_request->getParam('filterID')));
$this->view->editfilterform = $editfilterform;
}catch (Zend_Exception $e) {
echo "Error message 2: " . $e->getMessage() . "\n";
}
} else{
- $editfilterform = new Application_Form_FilterEntriesAdd($_POST);
+ $editfilterform = new Application_Form_FilterEntriesAdd(array('buttontext' => 'Add Filterentry'),$_POST);
if ($editfilterform->isValid($_POST)) {
$newfilterenty = new Application_Model_FilterEntries();
$newfilterenty->setFilterID($_POST['filterID']);
@@ -154,7 +154,6 @@ class FilterController extends Zend_Controller_Action
public function editfilterentryAction()
{
if (!isset($_POST["add"])){
- echo "case1";
try{
$filterentriesID = $this->_request->getParam('filterentriesID');
@@ -165,7 +164,7 @@ class FilterController extends Zend_Controller_Action
$filterentriesmapper->find($filterentriesID,$filterentry);
- $editfilterform = new Application_Form_FilterEntriesAdd();
+ $editfilterform = new Application_Form_FilterEntriesAdd(array('buttontext' => 'Edit Filterentry'));
$editfilterform->populate($filterentry->toArray());
$editfilterform->setFilterID($filterID);
$this->view->editfilterform = $editfilterform;
@@ -176,7 +175,7 @@ class FilterController extends Zend_Controller_Action
} else{
try{
$filterentriesID = $this->_request->getParam('filterentriesID');
- $editfilterform = new Application_Form_FilterEntriesAdd($_POST);
+ $editfilterform = new Application_Form_FilterEntriesAdd(array('buttontext' => 'Edit Filterentry'),$_POST);
if ($editfilterform->isValid($_POST)) {
$newfilterenty = new Application_Model_FilterEntries($_POST);
$newfilterenty->setID($filterentriesID);
@@ -317,11 +316,11 @@ class FilterController extends Zend_Controller_Action
$macAdress = $client->getMacadress();
}
try{
- $macAdress = str_replace(":","",$this->fillMac($ipAdress));
+ $macAdress = $this->fillMac($macAdress);
$stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
filtertypeID = ".$filtertypID." AND
- CONV(HEX('filtervalue'),16,10) <= CONV(HEX('".$macAdress."'),16,10) AND
- CONV(HEX('".$macAdress."'),16,10) <= CONV(HEX('filtervalue2'),16,10)");
+ filtervalue <= '".$macAdress."' AND
+ '".$macAdress."' <= filtervalue2");
$result = $stmt->fetchAll();
foreach($result as $r){
$set[$filtertypID][] = $r['filterID'];
@@ -530,7 +529,7 @@ class FilterController extends Zend_Controller_Action
$bm = new Application_Model_BootMenu();
$bmmapper = new Application_Model_BootMenuMapper();
$bmmapper->find($bootmenuID,$bm);
- echo "<h1><a href='/bootmenu/index/bootmenuID/".$bootmenuID."'>Goto BootmenuID: ".$bootmenuID."</a></h1>";
+ echo "<h1><a href='/bootmenu/index/bootmenuid/".$bootmenuID."'>Goto BootmenuID: ".$bootmenuID."</a></h1>";
}
else{
echo "<h1>No Result :-(</h1>";
@@ -567,6 +566,11 @@ class FilterController extends Zend_Controller_Action
'clients' => $clients,
));
+ $filterevaluate->populate(array(
+ 'ip' => '132.230.5.6',
+ 'mac' => '08:00:20:ae:fd:7e',
+ 'time'=>date('d.m.Y H:i'))
+ );
$this->view->filterevaluate = $filterevaluate;
}
diff --git a/application/controllers/PoolController.php b/application/controllers/PoolController.php
index 7c5092e..f27ee45 100644
--- a/application/controllers/PoolController.php
+++ b/application/controllers/PoolController.php
@@ -33,10 +33,10 @@ class PoolController extends Zend_Controller_Action
public function createpoolAction()
{
if (!isset($_POST["add"])){
- $addfilterform = new Application_Form_Pool();
+ $addfilterform = new Application_Form_Pool(array('buttontext' => 'Create Pool'));
$this->view->addpool = $addfilterform;
}else {
- $addpoolform = new Application_Form_Pool($_POST);
+ $addpoolform = new Application_Form_Pool(array('buttontext' => 'Create Pool'),$_POST);
if ($addpoolform->isValid($_POST)) {
try{
$pool = new Application_Model_Pool($_POST);
@@ -75,12 +75,12 @@ class PoolController extends Zend_Controller_Action
$poolmapper->find($poolID,$pool);
$poolArray = $pool->toArray();
- $editpool = new Application_Form_Pool();
+ $editpool = new Application_Form_Pool(array('buttontext' => 'Edit Pool'));
$editpool->populate($poolArray);
$this->view->editpoolform = $editpool;
}else {
- $editpoolform = new Application_Form_Pool($_POST);
+ $editpoolform = new Application_Form_Pool(array('buttontext' => 'Edit Pool'),$_POST);
if ($editpoolform->isValid($_POST)) {
try{
$pool = new Application_Model_Pool($_POST);
@@ -100,24 +100,23 @@ class PoolController extends Zend_Controller_Action
{
$clientID = $this->_request->getParam('clientID');
$poolID = $this->_request->getParam('poolID');
-
- if(!isset($_POST['clientID']) && ($clientID == '' && $poolID == '')){
+ if(!isset($_POST['clientID']) && ($clientID == '')){
$clientmapper = new Application_Model_ClientMapper();
$clients = $clientmapper->fetchAll();
foreach($clients as $c){
$clientsArray[] = $c->toArray();
- }
+ }
$assignedclientmapper = new Application_Model_PoolEntriesMapper();
$assignedclients = $assignedclientmapper->fetchAll();
foreach($assignedclients as $c){
$assignedclientsArray[] = $c->toArray();
}
$freeclients = $this->arrayDiff($clientsArray,$assignedclientsArray);
-
- $poolclient = new Application_Form_PoolClient(array('clients'=> $freeclients));
+
+ $poolclient = new Application_Form_PoolClient(array('buttontext' => 'Link Client','clients'=> $freeclients));
$this->view->poolclient = $poolclient;
}else {
- $poolclient = new Application_Form_PoolClient($_POST);
+ $poolclient = new Application_Form_PoolClient(array('buttontext' => 'Link Client'),$_POST);
try{
$pool = new Application_Model_PoolEntries($_POST);
$pool->setPoolID($this->_request->getParam('poolID'));
diff --git a/application/controllers/ResourceController.php b/application/controllers/ResourceController.php
index b70c589..92be437 100644
--- a/application/controllers/ResourceController.php
+++ b/application/controllers/ResourceController.php
@@ -102,6 +102,11 @@ class ResourceController extends Zend_Controller_Action
$bmemapper->find($bmeID,$bme);
if($bme->getKcl() != null){
+ header('Content-Type: text/html');
+ $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $HTTP_USER_AGENT) == 'IE') ? 'inline' : 'attachment';
+ header('Content-Disposition: ' . $content_disp . '; filename="kcl.txt"');
+ header('Pragma: no-cache');
+ header('Expires: 0');
echo $bme->getKcl();
}
diff --git a/application/controllers/SessionController.php b/application/controllers/SessionController.php
index 09eadc9..6d0a873 100644
--- a/application/controllers/SessionController.php
+++ b/application/controllers/SessionController.php
@@ -26,11 +26,11 @@ class SessionController extends Zend_Controller_Action
$bootisos = $bi->fetchAll();
if (!isset($_POST["add"])){
- $createsession = new Application_Form_Session(array('clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos));
+ $createsession = new Application_Form_Session(array('buttontext' => 'Create Session','clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos));
$this->view->createsession = $createsession;
}else {
// TODO extend with normal function not only with post
- $createsession = new Application_Form_Session(array('clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos),$_POST);
+ $createsession = new Application_Form_Session(array('buttontext' => 'Create Session','clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos),$_POST);
print_a($_POST);
if ($createsession->isValid($_POST)) {
try{
@@ -49,9 +49,7 @@ class SessionController extends Zend_Controller_Action
}catch (Zend_Exception $e) {
echo "Error message 2: " . $e->getMessage() . "\n";
- }
- print_a('saved');
- #$this->_redirect('/session');
+ }
}
$this->view->createsession = $createsession;
}
@@ -78,7 +76,7 @@ class SessionController extends Zend_Controller_Action
$session->setTime(date('d.m.Y H:i',$session->getTime()));
$session2 = $session->toArray();
- $editsession = new Application_Form_Session(array('clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos));
+ $editsession = new Application_Form_Session(array('buttontext' => 'Edit Session','clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos));
$editsession->populate($session2);
$this->view->editsession = $editsession;
@@ -86,7 +84,7 @@ class SessionController extends Zend_Controller_Action
try{
$sessionID = $this->_request->getParam('sessionID');
- $editsession = new Application_Form_Session(array('clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos),$_POST);
+ $editsession = new Application_Form_Session(array('buttontext' => 'Edit Session','clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos),$_POST);
if ($editsession->isValid($_POST)) {
$session = new Application_Model_Session($_POST);
diff --git a/application/forms/Client.php b/application/forms/Client.php
index 1378349..83df97e 100644
--- a/application/forms/Client.php
+++ b/application/forms/Client.php
@@ -28,9 +28,17 @@ class Application_Form_Client extends Zend_Form
$this->addElement('submit', 'add', array(
'required' => false,
'ignore' => true,
- 'label' => 'Save',
+ 'label' => $this->buttontext,
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/client"'
));
}
+ private $buttontext = 'Save';
+ function setButtontext($v){
+ $this->buttontext = $v;
+ }
}
diff --git a/application/forms/FilterAdd.php b/application/forms/FilterAdd.php
index 091eb37..b720089 100644
--- a/application/forms/FilterAdd.php
+++ b/application/forms/FilterAdd.php
@@ -45,13 +45,21 @@ class Application_Form_FilterAdd extends Zend_Form
$this->addElement('submit', 'add', array(
'required' => false,
'ignore' => true,
- 'label' => 'Save',
+ 'label' => $this->buttontext,
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/filter"'
));
}
function setBootmenus($val){
$this->bootmenus = $val;
return;
}
+ private $buttontext = 'Save';
+ function setButtontext($v){
+ $this->buttontext = $v;
+ }
}
diff --git a/application/forms/FilterEntriesAdd.php b/application/forms/FilterEntriesAdd.php
index 7b3f52b..3b051f5 100644
--- a/application/forms/FilterEntriesAdd.php
+++ b/application/forms/FilterEntriesAdd.php
@@ -31,21 +31,29 @@ class Application_Form_FilterEntriesAdd extends Zend_Form
$this->addElement('text', 'filtervalue2', array(
'label' => 'Value2:'
));
-
- $this->addElement('hidden', 'filterID', array(
- 'value' => $this->filterID
- ));
$this->addElement('submit', 'add', array(
'required' => false,
'ignore' => true,
- 'label' => 'Save',
+ 'label' => $this->buttontext,
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/filter"'
));
+
+ $this->addElement('hidden', 'filterID', array(
+ 'value' => $this->filterID
+ ));
}
public function setFilterID($id)
{
$this->filterID = $id;
}
+ private $buttontext = 'Save';
+ function setButtontext($v){
+ $this->buttontext = $v;
+ }
}
diff --git a/application/forms/FilterEvaluate.php b/application/forms/FilterEvaluate.php
index 2c93aef..28dd848 100644
--- a/application/forms/FilterEvaluate.php
+++ b/application/forms/FilterEvaluate.php
@@ -90,7 +90,7 @@ class Application_Form_FilterEvaluate extends Zend_Form
$clientfield->addMultiOption('','');
if(count($this->clients)>0){
foreach($this->clients as $id => $g){
- $clientfield->addMultiOption($g->getID(), $g->getMacadress());
+ $clientfield->addMultiOption($g->getID(), $g->getID() . " - " . $g->getMacadress());
}
}
$clientfield->setRegisterInArrayValidator(false);
diff --git a/application/forms/Pool.php b/application/forms/Pool.php
index 0cef533..be30444 100644
--- a/application/forms/Pool.php
+++ b/application/forms/Pool.php
@@ -35,9 +35,17 @@ class Application_Form_Pool extends Zend_Form
$this->addElement('submit', 'add', array(
'required' => false,
'ignore' => true,
- 'label' => 'Save',
+ 'label' => $this->buttontext,
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/pool"'
));
}
+ private $buttontext = 'Save';
+ function setButtontext($v){
+ $this->buttontext = $v;
+ }
}
diff --git a/application/forms/PoolClient.php b/application/forms/PoolClient.php
index 7bacae0..0c4ef6a 100644
--- a/application/forms/PoolClient.php
+++ b/application/forms/PoolClient.php
@@ -11,6 +11,7 @@ class Application_Form_PoolClient extends Zend_Form
$clientfield = $this->createElement('select','clientID');
$clientfield ->setLabel('Client:');
+ print_a($this->clients);
foreach($this->clients as $c){
$clientfield->addMultiOption($c['clientID'],$c['macadress']." - ".$c['hardwarehash']);
}
diff --git a/application/forms/Session.php b/application/forms/Session.php
index 30aefda..f2175a7 100644
--- a/application/forms/Session.php
+++ b/application/forms/Session.php
@@ -73,7 +73,11 @@ $this->addElement('text', 'ip6', array(
$this->addElement('submit', 'add', array(
'required' => false,
'ignore' => true,
- 'label' => 'Save',
+ 'label' => $this->buttontext,
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/session"'
));
}
function setClients($v){
@@ -85,6 +89,10 @@ $this->addElement('text', 'ip6', array(
function setBootisos($v){
$this->bootisos = $v;
}
+ private $buttontext = 'Save';
+ function setButtontext($v){
+ $this->buttontext = $v;
+ }
}
diff --git a/application/models/FilterEntriesMapper.php b/application/models/FilterEntriesMapper.php
index bf57dbd..0f070ee 100644
--- a/application/models/FilterEntriesMapper.php
+++ b/application/models/FilterEntriesMapper.php
@@ -60,10 +60,8 @@ class Application_Model_FilterEntriesMapper
if (0 == count($result) && null == $id1) {
$this->getDbTable()->insert($data);
- echo 'inserted';
} else {
- print_r($this->getDbTable()->update($data, array('filterentriesID = ?' => $id1)));
- echo 'updated';
+ $this->getDbTable()->update($data, array('filterentriesID = ?' => $id1));
}
}catch (Zend_Exception $e) {
@@ -78,11 +76,9 @@ class Application_Model_FilterEntriesMapper
if ((null == $id1)) {
- echo 'case1';
return;
} else {
$this->getDbTable()->delete(array('filterentriesID = ?' => $id1));
- echo 'case2';
}
}catch (Zend_Exception $e) {
@@ -93,11 +89,9 @@ class Application_Model_FilterEntriesMapper
public function find($filterentriesID, Application_Model_FilterEntries $filterentries)
{
$result = $this->getDbTable()->find($filterentriesID);
- echo 'dump1';
if (0 == count($result)) {
return;
- }
- echo 'dump2';
+ }
$row = $result->current();
$filterentries->setID($row->filterentriesID)
diff --git a/application/models/FilterMapper.php b/application/models/FilterMapper.php
index eba9b71..1e83da6 100644
--- a/application/models/FilterMapper.php
+++ b/application/models/FilterMapper.php
@@ -55,10 +55,8 @@ class Application_Model_FilterMapper
if (null === ($id = $filter->getID()) ) {
unset($data['filterID']);
$this->getDbTable()->insert($data);
- echo 'case1';
} else {
$this->getDbTable()->update($data, array('filterID = ?' => $id));
- echo 'case2';
}
}
diff --git a/public/.htaccess b/public/.htaccess
index 1a7fb83..c1ef5e5 100644
--- a/public/.htaccess
+++ b/public/.htaccess
@@ -1,3 +1,6 @@
+Deny from all
+Allow from 132.230.0.0/255.255.0.0
+
RewriteEngine On
RewriteRule ^(media) - [L]
diff --git a/public/media/css/style.css b/public/media/css/style.css
index c681674..5ad7c1d 100644
--- a/public/media/css/style.css
+++ b/public/media/css/style.css
@@ -44,6 +44,7 @@ padding:5px 10px;
#nav ul {
margin:2px;
+padding:8px;
}
#nav li {