summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/controllers/SessionController.php36
-rw-r--r--application/forms/Session.php20
-rw-r--r--application/models/Session.php20
-rw-r--r--application/models/SessionMapper.php9
-rw-r--r--application/views/scripts/session/index.phtml2
-rw-r--r--pbs-newdata.sql14
-rw-r--r--pbs.sql3
-rw-r--r--resources/bootos/12/initramfs/initbin0 -> 6020724 bytes
-rw-r--r--resources/bootos/13/initramfs/ubuntu-initbin0 -> 6020724 bytes
-rw-r--r--resources/bootos/13/kernel/ubuntu-kernelbin0 -> 4167200 bytes
10 files changed, 88 insertions, 16 deletions
diff --git a/application/controllers/SessionController.php b/application/controllers/SessionController.php
index 6d0a873..f21335d 100644
--- a/application/controllers/SessionController.php
+++ b/application/controllers/SessionController.php
@@ -12,7 +12,14 @@ class SessionController extends Zend_Controller_Action
{
$mapper = new Application_Model_SessionMapper();
$this->view->sessions = $mapper->fetchAll();
+ print_a($_SESSION);
}
+ private function getUniqueCode($length = "")
+ {
+ $code = md5(uniqid(rand(), true));
+ if ($length != "") return substr($code, 0, $length);
+ else return $code;
+ }
public function createsessionAction()
{
@@ -25,17 +32,32 @@ class SessionController extends Zend_Controller_Action
$bi = new Application_Model_BootIsoMapper();
$bootisos = $bi->fetchAll();
+ $bmem = new Application_Model_SessionMapper();
+ $bootmenuentries = $bmem->fetchAll();
+
+
if (!isset($_POST["add"])){
- $createsession = new Application_Form_Session(array('buttontext' => 'Create Session','clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos));
+ $createsession = new Application_Form_Session(array('buttontext' => 'Create Session','bootmenuentries'=>$bootmenuentries,'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('buttontext' => 'Create Session','clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos),$_POST);
+ $createsession = new Application_Form_Session(array('buttontext' => 'Create Session','bootmenuentries'=>$bootmenuentries,'clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos),$_POST);
print_a($_POST);
if ($createsession->isValid($_POST)) {
try{
+ $uniqid = $this->getUniqueCode(10);
+ $sm = new Application_Model_SessionMapper();
+ while(count($sm->findBy('alphasessionID',$uniqid))>0){
+ $uniqid = $this->getUniqueCode(16);
+ }
+
$session = new Application_Model_Session($_POST);
$session->setTime(strtotime($_POST['time']));
+ $session->setAlphasessionID($uniqid);
+
+ // UNIQUE ID IN SESSION SPEICHERN:
+ $_SESSION['alphasessionID'] = $uniqid;
+
if($session->getClientID() == ''){
$session->setClientID(null);
}
@@ -65,6 +87,10 @@ class SessionController extends Zend_Controller_Action
$bi = new Application_Model_BootIsoMapper();
$bootisos = $bi->fetchAll();
+
+ $bmem = new Application_Model_SessionMapper();
+ $bootmenuentries = $bmem->fetchAll();
+
if (!isset($_POST["add"])){
// TODO: ACL implementieren ob er editieren darf
$sessionID = $this->_request->getParam('sessionID');
@@ -76,7 +102,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('buttontext' => 'Edit Session','clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos));
+ $editsession = new Application_Form_Session(array('buttontext' => 'Edit Session','bootmenuentries'=>$bootmenuentries,'clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos));
$editsession->populate($session2);
$this->view->editsession = $editsession;
@@ -84,11 +110,11 @@ class SessionController extends Zend_Controller_Action
try{
$sessionID = $this->_request->getParam('sessionID');
- $editsession = new Application_Form_Session(array('buttontext' => 'Edit Session','clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos),$_POST);
+ $editsession = new Application_Form_Session(array('buttontext' => 'Edit Session','bootmenuentries'=>$bootmenuentries,'clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos),$_POST);
if ($editsession->isValid($_POST)) {
$session = new Application_Model_Session($_POST);
- $session->setID($this->_request->getParam('sessionID'));
+ $session->setID($this->_request->getParam('sessionID'));
$session->setTime(strtotime($_POST['time']));
if($session->getClientID() == ''){
$session->setClientID(null);
diff --git a/application/forms/Session.php b/application/forms/Session.php
index f2175a7..0a7c3ae 100644
--- a/application/forms/Session.php
+++ b/application/forms/Session.php
@@ -11,6 +11,15 @@ class Application_Form_Session extends Zend_Form
{
$this->setName("session");
$this->setMethod('post');
+
+ $this->addElement('text', 'aphasessionID', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 16)),
+ ),
+ 'required' => false,
+ 'label' => 'alphasessionID:',
+ ));
$clientfield = $this->createElement('select','clientID');
$clientfield ->setLabel('Client:');
@@ -23,6 +32,17 @@ class Application_Form_Session extends Zend_Form
$clientfield->setRegisterInArrayValidator(false);
$this->addElement($clientfield);
+ $bootmenuentrieyfield = $this->createElement('select','bootmenuentryID');
+ $bootmenuentrieyfield->setLabel('BootmenuentryID:');
+ $bootmenuentrieyfield->addMultiOption('','');
+ if(count($this->bootmenuentries)>0){
+ foreach($this->bootmenuentries as $id => $g){
+ $bootmenuentrieyfield->addMultiOption($g->getID(), $g->getTitle());
+ }
+ }
+ $bootmenuentrieyfield->setRegisterInArrayValidator(false);
+ $this->addElement($bootmenuentrieyfield);
+
$bootosfield = $this->createElement('select','bootosID');
$bootosfield ->setLabel('BootOs:');
diff --git a/application/models/Session.php b/application/models/Session.php
index ca07ccb..7ae7fe8 100644
--- a/application/models/Session.php
+++ b/application/models/Session.php
@@ -3,7 +3,9 @@
class Application_Model_Session
{
protected $_sessionID;
+ protected $_alphasessionID;
protected $_clientID;
+ protected $_bootmenuentryID;
protected $_bootosID;
protected $_bootisoID;
protected $_time;
@@ -57,6 +59,15 @@ class Application_Model_Session
$this->_sessionID = $_sessionID;
return $this;
}
+ public function getAlphasessionID()
+ {
+ return $this->_alphasessionID;
+ }
+ public function setAlphasessionID($_alphasessionID)
+ {
+ $this->_alphasessionID = $_alphasessionID;
+ return $this;
+ }
public function getClientID()
{
return $this->_clientID;
@@ -66,6 +77,15 @@ class Application_Model_Session
$this->_clientID = $_clientID;
return $this;
}
+ public function getBootmenuentryID()
+ {
+ return $this->_bootmenuentryID;
+ }
+ public function setBootmenuentryID($_bootmenuentryID)
+ {
+ $this->_bootmenuentryID = $_bootmenuentryID;
+ return $this;
+ }
public function getBootosID()
{
return $this->_bootosID;
diff --git a/application/models/SessionMapper.php b/application/models/SessionMapper.php
index f836643..04496a2 100644
--- a/application/models/SessionMapper.php
+++ b/application/models/SessionMapper.php
@@ -48,13 +48,14 @@ class Application_Model_SessionMapper
{
$data = array( 'sessionID'=> $session->getID() ,
+ 'alphasessionID'=> $session->getAlphasessionID(),
'clientID'=> $session->getClientID() ,
+ 'bootmenuentryID'=> $session->getBootmenuentryID(),
'bootosID'=> $session->getBootosID() ,
'bootisoID'=> $session->getBootisoID() ,
'time'=> $session->getTime() ,
'ip'=> $session->getIp() ,
- 'ip6'=> $session->getIp6() );
- print_a($data);
+ 'ip6'=> $session->getIp6() );
if (null === ($id = $session->getID()) ) {
unset($data['sessionID']);
$this->getDbTable()->insert($data);
@@ -81,7 +82,7 @@ class Application_Model_SessionMapper
$row = $result->current();
- $sesion->setID($row->sessionID)->setClientID($row->clientID)->setBootosID($row->bootosID)->setBootisoID($row->bootisoID)->setTime($row->time)->setIp($row->ip)->setIp6($row->ip6);
+ $sesion->setID($row->sessionID)->setAlphasessionID($row->alphasessionID)->setClientID($row->clientID)->setBootmenuentryID($row->bootmenuentryID)->setBootosID($row->bootosID)->setBootisoID($row->bootisoID)->setTime($row->time)->setIp($row->ip)->setIp6($row->ip6);
}
public function fetchAll()
@@ -91,7 +92,7 @@ class Application_Model_SessionMapper
foreach ($resultSet as $row) {
$entry = new Application_Model_Session();
- $entry->setID($row->sessionID)->setClientID($row->clientID)->setBootosID($row->bootosID)->setBootisoID($row->bootisoID)->setTime($row->time)->setIp($row->ip)->setIp6($row->ip6);
+ $entry->setID($row->sessionID)->setAlphasessionID($row->alphasessionID)->setClientID($row->clientID)->setBootmenuentryID($row->bootmenuentryID)->setBootosID($row->bootosID)->setBootisoID($row->bootisoID)->setTime($row->time)->setIp($row->ip)->setIp6($row->ip6);
$entries[] = $entry;
}
diff --git a/application/views/scripts/session/index.phtml b/application/views/scripts/session/index.phtml
index 6e87acf..8d50dd2 100644
--- a/application/views/scripts/session/index.phtml
+++ b/application/views/scripts/session/index.phtml
@@ -16,7 +16,9 @@
<?php foreach ($this->sessions as $session): ?>
<tr class=entry>
<td><?php echo $this->escape($session->getID()) ?></td>
+ <td><?php echo $this->escape($session->getalphasessionID()) ?></td>
<td><?php echo $this->escape($session->getClientID()) ?></td>
+ <td><?php echo $this->escape($session->getBootmenuentryID()) ?></td>
<td><?php echo $this->escape($session->getBootosID()) ?></td>
<td><?php echo $this->escape($session->getBootisoID()) ?></td>
<td><?php echo date('d.m.Y H:i',$this->escape($session->getTime())) ?></td>
diff --git a/pbs-newdata.sql b/pbs-newdata.sql
index 48a1dc6..3d1447c 100644
--- a/pbs-newdata.sql
+++ b/pbs-newdata.sql
@@ -102,13 +102,13 @@ INSERT INTO `pbs_bootmenu` (`bootmenuID`, `membershipID`, `groupID`, `title`, `c
(5, 1, 1, 'Bootmenu 5', '1299694461');
-- Adding Sessions
-INSERT INTO `pbs_session` (`sessionID`, `clientID`, `bootosID`, `bootisoID`, `time`, `ip`, `ip6`) VALUES
-(1, 1, NULL, 1, '1299684000', '132.230.5.6', ''),
-(2, 9, NULL, 2, '1299684000', '132.230.10.2', ''),
-(3, 10, NULL, 1, '1299648000', '132.20.20.2', ''),
-(4, 7, NULL, 3, '1299676800', '84.23.56.86', ''),
-(5, 4, NULL, 3, '1299674340', '70.81.94.222', ''),
-(6, 5, NULL, 3, '1299683100', '210.84.65.2', '');
+INSERT INTO `pbs_session` (`sessionID`, `alphasessionID`,`clientID`, `bootmenuentryID`,`bootosID`, `bootisoID`, `time`, `ip`, `ip6`) VALUES
+(1, 'a', 1, NULL, NULL, 1, '1299684000', '132.230.5.6', ''),
+(2, 'b', 9, NULL, NULL, 2, '1299684000', '132.230.10.2', ''),
+(3, 'c', 10, NULL, NULL, 1, '1299648000', '132.20.20.2', ''),
+(4, 'd', 7, NULL, NULL, 3, '1299676800', '84.23.56.86', ''),
+(5, 'e', 4, NULL, NULL, 3, '1299674340', '70.81.94.222', ''),
+(6, 'f', 5, NULL, NULL, 3, '1299683100', '210.84.65.2', '');
-- Adding Filter
INSERT INTO `pbs_filter` (`filterID`, `membershipID`, `groupID`, `bootmenuID`, `title`, `description`, `created`, `priority`) VALUES
diff --git a/pbs.sql b/pbs.sql
index f220008..15d8fe3 100644
--- a/pbs.sql
+++ b/pbs.sql
@@ -216,6 +216,9 @@ CREATE TABLE IF NOT EXISTS `pbs_session` (
KEY `bootosID` (`bootosID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
ALTER TABLE `pbs_session` ADD `bootisoID` INT NOT NULL AFTER `bootosID`;
+ALTER TABLE `pbs_session` ADD `alphasessionID` VARCHAR( 16 ) NOT NULL AFTER `sessionID` ,
+ADD UNIQUE (`alphasessionID`) ;
+ALTER TABLE `pbs_session` ADD `bootmenuentryID` INT AFTER `clientID` ;
ALTER TABLE `pbs_session`
ADD CONSTRAINT `pbs_session_ibfk_1` FOREIGN KEY (`clientID`) REFERENCES `pbs_client` (`clientID`),
diff --git a/resources/bootos/12/initramfs/init b/resources/bootos/12/initramfs/init
new file mode 100644
index 0000000..e7bfa9e
--- /dev/null
+++ b/resources/bootos/12/initramfs/init
Binary files differ
diff --git a/resources/bootos/13/initramfs/ubuntu-init b/resources/bootos/13/initramfs/ubuntu-init
new file mode 100644
index 0000000..e7bfa9e
--- /dev/null
+++ b/resources/bootos/13/initramfs/ubuntu-init
Binary files differ
diff --git a/resources/bootos/13/kernel/ubuntu-kernel b/resources/bootos/13/kernel/ubuntu-kernel
new file mode 100644
index 0000000..960d26a
--- /dev/null
+++ b/resources/bootos/13/kernel/ubuntu-kernel
Binary files differ