summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.zfproject.xml7
-rw-r--r--application/models/GroupMapper.php1
-rw-r--r--application/models/PreBootMapper.php12
-rw-r--r--application/modules/user/controllers/FilterController.php4
-rw-r--r--application/modules/user/controllers/IndexController.php1
-rw-r--r--application/modules/user/controllers/PrebootController.php369
-rw-r--r--application/modules/user/forms/Preboot.php56
-rw-r--r--application/modules/user/layouts/user.phtml1
-rw-r--r--application/modules/user/views/scripts/preboot/createpreboot.phtml4
-rw-r--r--application/modules/user/views/scripts/preboot/editpreboot.phtml4
-rw-r--r--application/modules/user/views/scripts/preboot/index.phtml61
-rw-r--r--library/Pbs/Notifier.php23
-rw-r--r--pbs.sql8
13 files changed, 542 insertions, 9 deletions
diff --git a/.zfproject.xml b/.zfproject.xml
index 3845e14..7ad37ee 100644
--- a/.zfproject.xml
+++ b/.zfproject.xml
@@ -168,6 +168,9 @@
<actionMethod actionName="linkclient"/>
<actionMethod actionName="unlinkclient"/>
</controllerFile>
+ <controllerFile controllerName="Preboot">
+ <actionMethod actionName="index"/>
+ </controllerFile>
</controllersDirectory>
<formsDirectory>
<formFile formName="Login"/>
@@ -299,6 +302,9 @@
<viewControllerScriptsDirectory forControllerName="Role">
<viewScriptFile forActionName="linkright"/>
</viewControllerScriptsDirectory>
+ <viewControllerScriptsDirectory forControllerName="Preboot">
+ <viewScriptFile forActionName="index"/>
+ </viewControllerScriptsDirectory>
</viewScriptsDirectory>
<viewHelpersDirectory/>
<viewFiltersDirectory/>
@@ -781,6 +787,7 @@
<testApplicationControllerFile filesystemName="AuthControllerTest.php"/>
<testApplicationControllerFile filesystemName="AuthControllerTest.php"/>
<testApplicationControllerFile filesystemName="StatsControllerTest.php"/>
+ <testApplicationControllerFile filesystemName="PrebootControllerTest.php"/>
</testApplicationControllerDirectory>
</testApplicationDirectory>
<testLibraryDirectory>
diff --git a/application/models/GroupMapper.php b/application/models/GroupMapper.php
index 331a61c..fa458d1 100644
--- a/application/models/GroupMapper.php
+++ b/application/models/GroupMapper.php
@@ -68,6 +68,7 @@ class Application_Model_GroupMapper
public function find($id,Application_Model_Group $group = null)
{
+ $return = false;
if($group == null){
$return = true;
}
diff --git a/application/models/PreBootMapper.php b/application/models/PreBootMapper.php
index db6d99f..6053b19 100644
--- a/application/models/PreBootMapper.php
+++ b/application/models/PreBootMapper.php
@@ -14,11 +14,21 @@ class Application_Model_PreBootMapper
->where($criteria . ' = ?', $value);
$stmt = $select->query();
$result = $stmt->fetchAll();
- return $result;
+
+ $entries = array();
+ foreach ($result as $row) {
+
+ $entry = new Application_Model_PreBoot($row);
+ $entry->setID($row['prebootID']);
+ $entries[] = $entry;
+ }
+
+ return $entries;
}catch (Zend_Exception $e) {
echo "Error message 2: " . $e->getMessage() . "\n";
}
}
+
public function setDbTable($dbTable)
{
diff --git a/application/modules/user/controllers/FilterController.php b/application/modules/user/controllers/FilterController.php
index 70aa60b..d49e68f 100644
--- a/application/modules/user/controllers/FilterController.php
+++ b/application/modules/user/controllers/FilterController.php
@@ -316,11 +316,11 @@ class User_FilterController extends Zend_Controller_Action
$this->view->editfilterform = $editfilterform;
}
else{
- $this->_redirect('/user/filter/index/moodifyresult/forbidden');
+ $this->_redirect('/user/filter/index/modifyresult/forbidden');
}
}catch (Zend_Exception $e) {
echo "Error message 2: " . $e->getMessage() . "\n";
- $this->_redirect('/user/filter/index/moodifyresult/error');
+ $this->_redirect('/user/filter/index/modifyresult/error');
}
} else{
try{
diff --git a/application/modules/user/controllers/IndexController.php b/application/modules/user/controllers/IndexController.php
index f795b16..f786eb7 100644
--- a/application/modules/user/controllers/IndexController.php
+++ b/application/modules/user/controllers/IndexController.php
@@ -9,6 +9,7 @@ class User_IndexController extends Zend_Controller_Action
public function indexAction()
{
+
if (!Zend_Auth::getInstance()->hasIdentity()) {
$this->view->text = 'Your not logged in, please log in first <a href="/user/auth/">here</a>.';
}
diff --git a/application/modules/user/controllers/PrebootController.php b/application/modules/user/controllers/PrebootController.php
new file mode 100644
index 0000000..e1e67a5
--- /dev/null
+++ b/application/modules/user/controllers/PrebootController.php
@@ -0,0 +1,369 @@
+<?php
+
+class User_PrebootController extends Zend_Controller_Action
+{
+
+ protected $prebootMapper;
+ protected $membershipMapper;
+ protected $membership;
+
+ public function init()
+ {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ if($userIDsNamespace['membershipID'] ==''){
+ $pbsNotifier = new Pbs_Notifier();
+ echo $pbsNotifier->notify('No membershipID set','forbidden');
+ }
+
+ $this->prebootMapper = new Application_Model_PreBootMapper();
+
+ $this->membershipMapper = new Application_Model_MembershipMapper();
+ $this->membership = new Application_Model_Membership();
+ $this->membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
+
+ $this->db = Zend_Db_Table::getDefaultAdapter();
+ } else {
+ $this->_helper->redirector('login', 'auth');
+ }
+ }
+
+
+ public function indexAction()
+ {
+ $result = $this->_request->getParam('addresult');
+ if($result != ""){
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('create',$result);
+ }
+ $result = $this->_request->getParam('deleteresult');
+ if($result != ""){
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('delete',$result);
+ }
+ $result = $this->_request->getParam('modifyresult');
+ if($result != ""){
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('modify',$result);
+ }
+ $result = $this->_request->getParam('updateresult');
+ if($result != ""){
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('update',$result);
+ }
+
+ $groupMapper = new Application_Model_GroupMapper();
+ $personMapper = new Application_Model_PersonMapper();
+
+ $groupID = $this->membership->getGroupID();
+
+ //TODO ACL Darf er PrebootMenu sehen?
+ if(false)
+ $this->_redirect('/user/index');
+
+ $this->view->prebootlist = $this->prebootMapper->findBy("groupID", $groupID);
+
+ $this->view->update = array();
+
+ $update = $this->_request->getParam('checkupdate');
+
+ foreach ($this->view->prebootlist as $preboot){
+ $this->view->update[$preboot->getID()] = $update && $this->checkupdateAction($preboot);
+ $preboot->setGroupID("[".$preboot->getGroupID()."] ".$groupMapper->find($preboot->getGroupID())->getTitle());
+ $preboot->setMembershipID("[".$preboot->getMembershipID()."] ".$personMapper->find($this->membershipMapper->find($preboot->getMembershipID())->getPersonID())->getFirstname());
+ }
+ }
+
+ public function createprebootAction()
+ {
+
+ //TODO ACL Is he allowed to create Preboots?
+ if(false)
+ $this->_redirect('/user/preboot/index/addresult/forbidden');
+
+ if (!isset($_POST["createpreboot"])){
+ $prebootForm = new user_Form_Preboot(array('action' => 'createpreboot'));
+ } else {
+
+ $prebootForm = new user_Form_Preboot(array('action' => 'createpreboot'),$_POST);
+
+ if ($prebootForm->isValid($_POST)) {
+
+ $preboot = new Application_Model_PreBoot($_POST);
+ $preboot->setMembershipID($this->membership->getID());
+ $preboot->setGroupID($this->membership->getGroupID());
+
+ try {
+
+ $path_tmp = "../resources/bootmedium/";
+ mkdir($path_tmp ,0777, true);
+
+ $hash = md5(microtime(1));
+ exec("wget -O '".$path_tmp."preboot.zip".$hash."' ".escapeshellcmd($preboot->getPath_preboot())." 2>&1 | grep 'saved'", $status);
+
+ if(!array_pop($status)){
+ $this->view->prebootForm = $prebootForm;
+ $pbsNotifier = new Pbs_Notifier();
+ echo $pbsNotifier->notify('The Resource was not found on the specified path','error');
+
+ return;
+ }
+
+ $prebootID = $this->prebootMapper->save($preboot);
+
+ $path_preboot = "../resources/bootmedium/$prebootID/";
+ mkdir($path_preboot ,0777, true);
+
+ exec("mv ../resources/bootmedium/preboot.zip$hash ../resources/bootmedium/$prebootID/preboot.zip");
+
+ }catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/preboot/index/addresult/error');
+ //TODO Delete folder + preboot
+
+ }
+ $this->_redirect('/user/preboot/index/addresult/ok');
+ }
+ }
+
+ $this->view->prebootForm = $prebootForm;
+ }
+
+ public function checkupdateAction($preboot)
+ {
+
+ //TODO ACL Is he allowed to update Preboots?
+ if(false)
+ $this->_redirect('/user/preboot/index/updateresult/forbidden');
+
+ $prebootID = $preboot->getID();
+ exec("wget --server-response --spider ".escapeshellcmd($preboot->getPath_preboot())." 2>&1 | grep 'Last-Modified:'", $prebootdate);
+
+ //print_a($prebootdate);
+
+ $prebootdate = strtotime(trim(str_replace('Last-Modified:', '', array_pop($prebootdate))));
+
+ if(is_file("../resources/bootmedium/$prebootID/preboot.zip"))
+ $prebootolddate = filemtime("../resources/bootmedium/".$prebootID."/preboot.zip");
+ else
+ $prebootolddate = false;
+
+ //print_a($prebootname,$prebootdate,$prebootolddate);
+
+ $pbsNotifier = new Pbs_Notifier();
+
+ if($prebootdate > $prebootolddate){
+ $this->view->notification = $pbsNotifier->notify('There are updates available','ok');
+ return true;
+ }
+ else
+ return false;
+
+ }
+
+ public function updateprebootAction()
+ {
+ //TODO ACL Is he allowed to update Preboots?
+ if(false)
+ $this->_redirect('/user/preboot/index/updateresult/forbidden');
+
+ $prebootID = $this->_request->getParam('prebootID');
+ if (!is_numeric($prebootID))
+ $this->_redirect('/user/preboot/index/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');
+
+
+ $path_preboot = "../resources/bootmedium/$prebootID/";
+
+ 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/modifyresult/404');
+ }
+
+ try{
+ $filelist = array();
+ $filelist = scandir($path_preboot);
+
+ $bootisoMapper = new Application_Model_BootIsoMapper();
+
+ //TODO Lock preboot
+
+ foreach($filelist as $file){
+ if($file == preg_match('![0-9]+\.zip!')){
+ $bootisoID = str_replace('.zip', '', $file);
+ $serialnumber = $bootisoMapper->find($bootisoID)->getSerialnumber();
+
+ copy("../resources/bootmedium/$prebootID/preboot.zip", "../resources/bootmedium/$prebootID/$bootisoID".".zip");
+ $zip = new ZipArchive();
+ $res = $zip->open("../resources/bootmedium/$prebootID/$bootisoID".".zip");
+ if($res === true){
+ $rootdir = $zip->getNameIndex(0);
+ $zip->addFromString($rootdir."build/rootfs/serial", $serialnumber);
+ $zip->close();
+ }
+ }
+ }
+ }catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/preboot/index/modifyresult/error');
+ //TODO Delete Folder + Preboot
+ }
+
+ $this->_redirect('/user/preboot/index/modifyresult/ok');
+ }
+
+ public function editprebootAction()
+ {
+ //TODO ACL Is he allowed to edit Preboots?
+ if(false)
+ $this->_redirect('/user/preboot/index/modifyresult/forbidden');
+
+ $prebootID = $this->_request->getParam('prebootID');
+
+ if (!is_numeric($prebootID))
+ $this->_redirect('/user/preboot/index/modifyresult/forbidden');
+
+ if (!isset($_POST["editpreboot"])){
+
+ $preboot = new Application_Model_PreBoot();
+ $this->prebootMapper->find($prebootID, $preboot);
+
+ if($this->membership->getGroupID() != $preboot->getGroupID())
+ $this->_redirect('/user/preboot/index/modifyresult/forbidden');
+
+ $prebootForm = new user_Form_Preboot(array('action' => 'editpreboot'));
+ $prebootForm->populate($preboot->toArray());
+
+ }else{
+
+ //TODO ACL Is he allowed to edit Preboots?
+ if(false)
+ $this->_redirect('/user/preboot/index/modifyresult/forbidden');
+
+ $prebootForm = new user_Form_Preboot(array('action' => 'editpreboot'),$_POST);
+
+ if ($prebootForm->isValid($_POST)) {
+
+ $prebootold = new Application_Model_PreBoot();
+ $this->prebootMapper->find($prebootID, $prebootold);
+
+ $preboot = new Application_Model_PreBoot($_POST);
+ $preboot->setMembershipID($this->membership->getID());
+ $preboot->setGroupID($this->membership->getGroupID());
+
+ if($this->membership->getGroupID() != $preboot->getGroupID())
+ $this->_redirect('/user/preboot/index/modifyresult/forbidden');
+
+ $preboot->setMembershipID($this->membership->getID());
+ $preboot->setGroupID($this->membership->getGroupID());
+ $preboot->setID($prebootID);
+
+ $path_preboot = "../resources/bootmedium/$prebootID/";
+
+ if($preboot->getPath_preboot() != $prebootold->getPath_preboot()){
+
+ //TODO ACL Is he allowed to edit the Preboot Path?
+ if(false)
+ $this->_redirect('/user/preboot/index/modifyresult/forbidden');
+
+ exec("wget -O '".$path_preboot."preboot.zip' ".escapeshellcmd($preboot->getPath_preboot()) ." 2>&1 | grep 'saved'" , $status);
+ if(!array_pop($status)){
+ $this->view->prebootForm = $prebootForm;
+ $pbsNotifier = new Pbs_Notifier();
+ echo $pbsNotifier->notify('The Resource was not found on the specified path','error');
+
+ return;
+ }
+
+ try{
+ $filelist = array();
+ $filelist = scandir($path_preboot);
+
+ $bootisoMapper = new Application_Model_BootIsoMapper();
+
+ //TODO Lock preboot
+
+ foreach($filelist as $file){
+ if(preg_match('![0-9]+\.zip!',$file)){
+ $bootisoID = str_replace('.zip', '', $file);
+ $serialnumber = $bootisoMapper->find($bootisoID)->getSerialnumber();
+
+ copy("../resources/bootmedium/$prebootID/preboot.zip", "../resources/bootmedium/$prebootID/$bootisoID".".zip");
+ $zip = new ZipArchive();
+ $res = $zip->open("../resources/bootmedium/$prebootID/$bootisoID".".zip");
+ if($res === true){
+ $rootdir = $zip->getNameIndex(0);
+ $zip->addFromString($rootdir."build/rootfs/serial", $serialnumber);
+ $zip->close();
+ }
+ }
+ }
+ }catch(Zend_Exception $e){
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/preboot/index/modifyresult/error');
+ }
+ }
+
+ try {
+
+ $this->prebootMapper->save($preboot);
+
+ }catch(Zend_Exception $e){
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/preboot/index/modifyresult/error');
+ //TODO Delete Folder + Preboot
+ }
+
+ $this->_redirect('/user/preboot/index/modifyresult/ok');
+ }
+ }
+
+ $this->view->prebootForm = $prebootForm;
+ }
+
+ public function deleteprebootAction()
+ {
+
+ //TODO ACL Is he allowed to delete Preboots?
+ if(false)
+ $this->_redirect('/user/preboot/index/deleteresult/forbidden');
+
+ try{
+ $prebootID = $this->_request->getParam('prebootID');
+ if (!is_numeric($prebootID))
+ $this->_redirect('/user/preboot/index/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->prebootMapper->delete($preboot);
+ exec("rm -r ../resources/bootmedium/".$prebootID);
+ }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/deleteresult/ok');
+ }
+
+
+}
+
+
+
diff --git a/application/modules/user/forms/Preboot.php b/application/modules/user/forms/Preboot.php
new file mode 100644
index 0000000..d46ae9c
--- /dev/null
+++ b/application/modules/user/forms/Preboot.php
@@ -0,0 +1,56 @@
+<?php
+
+class user_Form_Preboot extends Zend_Form
+{
+
+ private $action;
+
+ public function setAction($action){
+ $this->action = $action;
+
+ }
+
+ public function init()
+ {
+ $this->setName($this->action);
+ $this->setMethod('post');
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+
+ $this->addElement('text', 'path_preboot', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 240)),
+ ),
+ 'required' => true,
+ 'size' => 50,
+ 'label' => 'Path to Preboot:',
+ ));
+
+ if($this->action == "createpreboot")
+ $label = "Create Preboot";
+ else
+ $label = "Edit Preboot";
+
+ $this->addElement('submit', $this->action, array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => $label,
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/user/preboot"'
+ ));
+
+ }
+
+
+}
+
diff --git a/application/modules/user/layouts/user.phtml b/application/modules/user/layouts/user.phtml
index c7f54dc..83b1c49 100644
--- a/application/modules/user/layouts/user.phtml
+++ b/application/modules/user/layouts/user.phtml
@@ -30,6 +30,7 @@ echo $this->headScript()."\n";
<li class='navTreeItem'><a href='/user/group'>Group</a></li>
<li class='navTreeItem'><a href='/user/role'>Role</a></li>
<li class='navTreeItem'><a href='/user/bootiso'>BootIso</a></li>
+ <li class='navTreeItem'><a href='/user/preboot'>PreBoot</a></li>
<li class='navTreeItem'><a href='/user/bootmenu'>BootMenu</a></li>
<li class='navTreeItem'><a href='/user/config'>Config</a></li>
<li class='navTreeItem'><a href='/user/bootos'>BootOs</a></li>
diff --git a/application/modules/user/views/scripts/preboot/createpreboot.phtml b/application/modules/user/views/scripts/preboot/createpreboot.phtml
new file mode 100644
index 0000000..3690cfb
--- /dev/null
+++ b/application/modules/user/views/scripts/preboot/createpreboot.phtml
@@ -0,0 +1,4 @@
+<?php
+$this->prebootForm;
+echo $this->prebootForm;
+?>
diff --git a/application/modules/user/views/scripts/preboot/editpreboot.phtml b/application/modules/user/views/scripts/preboot/editpreboot.phtml
new file mode 100644
index 0000000..3690cfb
--- /dev/null
+++ b/application/modules/user/views/scripts/preboot/editpreboot.phtml
@@ -0,0 +1,4 @@
+<?php
+$this->prebootForm;
+echo $this->prebootForm;
+?>
diff --git a/application/modules/user/views/scripts/preboot/index.phtml b/application/modules/user/views/scripts/preboot/index.phtml
new file mode 100644
index 0000000..21ff310
--- /dev/null
+++ b/application/modules/user/views/scripts/preboot/index.phtml
@@ -0,0 +1,61 @@
+<h1>Preboot</h1>
+<?php if($this->notification != ''){echo $this->notification;} ?>
+<?php echo $this->formButton('checkupdate', 'Check for Updates', array(
+ 'onclick' => 'self.location="/user/preboot/index/checkupdate/true"',
+ 'class' => 'updatebutton',
+ ))?>
+<?php echo $this->formButton('createpreboot', 'Create PreBoot', array(
+ 'onclick' => 'self.location="/user/preboot/createpreboot"',
+ 'class' => 'addbutton'))?>
+<table>
+ <tr>
+ <th>ID</th>
+ <th>Title</th>
+ <th>GroupID</th>
+ <th>MembershipID</th>
+ <th>Preboot Path</th>
+ <th colspan=3>Actions</th>
+ </tr>
+ <?php if(count($this->prebootlist)==0)
+ echo "</table> There are no Preboot entries to display." ?>
+ <?php foreach ($this->prebootlist as $preboot): ?>
+ <tr class=entry>
+ <td><?php echo $this->escape($preboot->getID()); ?></td>
+ <td><?php echo $this->escape($preboot->getTitle()); ?></td>
+ <td><?php echo $this->escape($preboot->getGroupID()); ?></td>
+ <td><?php echo $this->escape($preboot->getMembershipID()); ?></td>
+ <td><?php echo $this->escape($preboot->getPath_preboot()); ?></td>
+ <?php if($this->update[$preboot->getID()]==true): ?>
+ <td class='action'><a href="<?php echo $this->url(
+ array(
+ 'module' => 'user',
+ 'controller' => 'preboot',
+ 'action' => 'updatepreboot',
+ 'prebootID' => $preboot->getID()
+ ),
+ 'default',
+ true, false) ?>"><img src='/media/img/update.png' alt='Updates available' /></a></td>
+ <?php else: ?>
+ <td class='action'><img src='/media/img/update_grey.png' alt='No updates available' /></td>
+ <?php endif; ?>
+ <td class='action'><a href="<?php echo $this->url(
+ array(
+ 'module' => 'user',
+ 'controller' => 'preboot',
+ 'action' => 'editpreboot',
+ 'prebootID' => $preboot->getID()
+ ),
+ 'default',
+ true, false) ?>"><img src='/media/img/edit.png' alt='Edit Preboot' /></a></td>
+ <td class='action'><a href="<?php echo $this->url(
+ array(
+ 'module' => 'user',
+ 'controller' => 'preboot',
+ 'action' => 'deletepreboot',
+ 'prebootID' => $preboot->getID()
+ ),
+ 'default',
+ true) ?>"><img src='/media/img/delete.png' alt='Delete Preboot'/></a></td>
+ </tr>
+ <?php endforeach; ?>
+</table> \ No newline at end of file
diff --git a/library/Pbs/Notifier.php b/library/Pbs/Notifier.php
index 1c7dfca..e3270e7 100644
--- a/library/Pbs/Notifier.php
+++ b/library/Pbs/Notifier.php
@@ -33,6 +33,13 @@ class Pbs_Notifier{
break;
}
break;
+ case "view":
+ switch($result){
+ case "forbidden":
+ $result = "<div class='errorbox'>Not allowed to see this</div>";
+ break;
+ }
+ break;
case "modify":
switch($result){
case "forbidden":
@@ -59,6 +66,22 @@ class Pbs_Notifier{
break;
}
break;
+ case "update":
+ switch($result){
+ case "forbidden":
+ $result = "<div class='errorbox'>Not allowed to update this</div>";
+ break;
+ case "404":
+ $result = "<div class='errorbox'>The Resource was not found on the specified path</div>";
+ break;
+ case "ok":
+ $result = "<div class='okbox'>Update sucessful</div>";
+ break;
+ case "error":
+ $result = "<div class='warningbox'>Update failed</div>";
+ break;
+ }
+ break;
case "link":
switch($result){
case "forbidden":
diff --git a/pbs.sql b/pbs.sql
index 9d5d57d..c88ad27 100644
--- a/pbs.sql
+++ b/pbs.sql
@@ -129,7 +129,7 @@ CREATE TABLE IF NOT EXISTS `pbs_bootos` (
`description` varchar(140),
`path_init` varchar(140) NOT NULL,
`path_kernel` varchar(140) NOT NULL,
- `defaultkcl` varchar(255) NOT NULL,
+ `defaultkcl` varchar(255),
`created` VARCHAR(14) NOT NULL,
`expires` VARCHAR(14),
`public` int(11) NOT NULL,
@@ -137,7 +137,6 @@ CREATE TABLE IF NOT EXISTS `pbs_bootos` (
KEY `configID` (`configID`),
KEY `groupID` (`groupID`),
KEY `membershipID` (`membershipID`),
- KEY `defaultkcl` (`defaultkcl`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
ALTER TABLE `pbs_bootos`
@@ -157,7 +156,7 @@ CREATE TABLE IF NOT EXISTS `pbs_bootmenu` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
ALTER TABLE `pbs_bootmenu`
- ADD CONSTRAINT `pbs_bootmenu_ibfk_1` FOREIGN KEY (`membershipID`) REFERENCES `pbs_membership` (`membershipID`) ON DELETE CASCADE,
+ ADD CONSTRAINT `pbs_bootmenu_ibfk_1` FOREIGN KEY (`membershipID`) REFERENCES `pbs_membership` (`membershipID`) ON DELETE SET NULL,
ADD CONSTRAINT `pbs_bootmenu_ibfk_2` FOREIGN KEY (`groupID`) REFERENCES `pbs_group` (`groupID`) ON DELETE CASCADE;
CREATE TABLE IF NOT EXISTS `pbs_bootmenuentries` (
@@ -172,7 +171,6 @@ CREATE TABLE IF NOT EXISTS `pbs_bootmenuentries` (
PRIMARY KEY (`bootmenuentriesID`),
KEY `bootosID` (`bootosID`),
KEY `bootmenuID` (`bootmenuID`),
- KEY `kcl` (`kcl`),
KEY `configID` (`configID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
@@ -180,8 +178,6 @@ ALTER TABLE `pbs_bootmenuentries`
ADD CONSTRAINT `pbs_bootmenuentries_ibfk_1` FOREIGN KEY (`bootmenuID`) REFERENCES `pbs_bootmenu` (`bootmenuID`) ON DELETE CASCADE,
ADD CONSTRAINT `pbs_bootmenuentries_ibfk_2` FOREIGN KEY (`bootosID`) REFERENCES `pbs_bootos` (`bootosID`) ON DELETE CASCADE,
ADD CONSTRAINT `pbs_bootmenuentries_ibfk_3` FOREIGN KEY (`configID`) REFERENCES `pbs_config` (`configID`) ON DELETE SET NULL,
- ADD CONSTRAINT `pbs_bootmenuentries_ibfk_4` FOREIGN KEY (`kcl`) REFERENCES `pbs_bootos` (`defaultkcl`) ON DELETE CASCADE,
- ADD CONSTRAINT `pbs_bootmenuentries_ibfk_5` FOREIGN KEY (`kcl`) REFERENCES `pbs_bootos` (`defaultkcl`) ON UPDATE CASCADE;
CREATE TABLE IF NOT EXISTS `pbs_preboot` (
`prebootID` int(11) NOT NULL AUTO_INCREMENT,