summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/models/BootMenuMapper.php2
-rw-r--r--application/models/MembershipMapper.php2
-rw-r--r--application/modules/fbgui/controllers/IndexController.php16
-rw-r--r--application/modules/fbgui/views/scripts/index/index.phtml2
-rw-r--r--application/modules/user/controllers/BootmenuController.php4
-rw-r--r--application/modules/user/controllers/ConfigController.php1
-rw-r--r--application/modules/user/controllers/GroupController.php7
-rw-r--r--application/modules/user/controllers/PersonController.php15
-rw-r--r--application/modules/user/layouts/user.phtml6
-rw-r--r--application/modules/user/views/scripts/person/index.phtml5
-rw-r--r--library/Pbs/Filter.php1
-rw-r--r--library/Pbs/NewMember.php63
-rw-r--r--library/Pbs/Search.php13
-rw-r--r--pbs.sql6
-rw-r--r--send-post.html2
15 files changed, 116 insertions, 29 deletions
diff --git a/application/models/BootMenuMapper.php b/application/models/BootMenuMapper.php
index 1730181..1717cf6 100644
--- a/application/models/BootMenuMapper.php
+++ b/application/models/BootMenuMapper.php
@@ -78,7 +78,7 @@ class Application_Model_BootMenuMapper
if (null === ($id = $botmenu->getID()) ) {
unset($data['bootmenuID']);
- $this->getDbTable()->insert($data);
+ return $this->getDbTable()->insert($data);
} else {
$this->getDbTable()->update($data, array('bootmenuID = ?' => $id));
}
diff --git a/application/models/MembershipMapper.php b/application/models/MembershipMapper.php
index 67b4985..94f5236 100644
--- a/application/models/MembershipMapper.php
+++ b/application/models/MembershipMapper.php
@@ -78,7 +78,7 @@ class Application_Model_MembershipMapper
if (null === ($id = $membership->getID()) ) {
unset($data['membershipID']);
- $this->getDbTable()->insert($data);
+ return $this->getDbTable()->insert($data);
} else {
$this->getDbTable()->update($data, array('membershipID = ?' => $id));
}
diff --git a/application/modules/fbgui/controllers/IndexController.php b/application/modules/fbgui/controllers/IndexController.php
index bfd2bec..3567f70 100644
--- a/application/modules/fbgui/controllers/IndexController.php
+++ b/application/modules/fbgui/controllers/IndexController.php
@@ -55,23 +55,27 @@ class Fbgui_IndexController extends Zend_Controller_Action
$pbsFilter = new Pbs_Filter();
$bootmenuID = $pbsFilter->evaluate();
if($bootmenuID != null){
- print_a('Debug Output',
- 'Session is now set',
- 'Your sessionID is '.$session->getID(),
- 'Your alphasessionID is '.$session->getAlphasessionID(),
- 'Your client is '.$session->getClientID(),
- 'goto bootmenu '.$bootmenuID);
+ /*
+ print_a('Debug Output',
+ 'Session is now set',
+ 'Your sessionID is '.$session->getID(),
+ 'Your alphasessionID is '.$session->getAlphasessionID(),
+ 'Your client is '.$session->getClientID(),
+ 'goto bootmenu '.$bootmenuID);
+ */
$bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
$res = $bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID),false);
$this->view->entries = $res;
}
else{
+ /*
print_a('Debug Output',
'Session is now set',
'Your sessionID is '.$session->getID(),
'Your alphasessionID is '.$session->getAlphasessionID(),
'Your client is '.$session->getClientID(),
'there is no bootmenu for you');
+ */
echo "<a href='/fbgui/auth/login/'>Goto Login to get a Bootmenu</a>";
}
}
diff --git a/application/modules/fbgui/views/scripts/index/index.phtml b/application/modules/fbgui/views/scripts/index/index.phtml
index 1fe02d4..6917643 100644
--- a/application/modules/fbgui/views/scripts/index/index.phtml
+++ b/application/modules/fbgui/views/scripts/index/index.phtml
@@ -33,9 +33,7 @@
<input type="hidden" class="id" value="<?php echo $entry->getID();?>"/>
</div>
<?php endforeach; ?>
-
<input style="display:none;" type='text' id="selectedBootOs" />
-
<button style='cursor:pointer;float:right;margin-top:10px;' onClick="start();"><img id='startball' src='/media/img/button-red.png'> <span style='font-size:14px;'>Start System</span></button>
<div class='clear'></div>
<?php endif;?>
diff --git a/application/modules/user/controllers/BootmenuController.php b/application/modules/user/controllers/BootmenuController.php
index ed2239b..754c45d 100644
--- a/application/modules/user/controllers/BootmenuController.php
+++ b/application/modules/user/controllers/BootmenuController.php
@@ -8,6 +8,7 @@ class user_BootmenuController extends Zend_Controller_Action
protected $membershipMapper;
protected $membership;
protected $page;
+ protected $type;
public function init()
{
@@ -109,7 +110,8 @@ class user_BootmenuController extends Zend_Controller_Action
// Search
$search = $this->_request->getParam('search');
$mySearch = new Pbs_Search();
- $mySearch->setSearchTerm($search);
+ $mySearch->setSearchTerm($search);
+ $mySearch->setType($this->type);
$mySearch->setModule('bootmenu');
if($search != ''){
$this->view->search = $mySearch->getSearchTerm();
diff --git a/application/modules/user/controllers/ConfigController.php b/application/modules/user/controllers/ConfigController.php
index 6f5497a..a38af00 100644
--- a/application/modules/user/controllers/ConfigController.php
+++ b/application/modules/user/controllers/ConfigController.php
@@ -74,6 +74,7 @@ class user_ConfigController extends Zend_Controller_Action
$search = $this->_request->getParam('search');
$mySearch = new Pbs_Search();
$mySearch->setSearchTerm($search);
+ $mySearch->setType($this->type);
$mySearch->setModule('config');
if($search != ''){
$this->view->search = $mySearch->getSearchTerm();
diff --git a/application/modules/user/controllers/GroupController.php b/application/modules/user/controllers/GroupController.php
index a17c571..a853a75 100644
--- a/application/modules/user/controllers/GroupController.php
+++ b/application/modules/user/controllers/GroupController.php
@@ -261,7 +261,12 @@ class User_GroupController extends Zend_Controller_Action
$membership->setPersonID($groupRequest->getPersonID());
$membership->setRoleID($_POST['roleID']);
try {
- $this->membershipMapper->save($membership);
+ $id = $this->membershipMapper->save($membership);
+
+ $membership->setID($id);
+
+ $newMember = new Pbs_NewMember();
+ $newMember->createDefaults($membership);
} catch(Zend_Exception $e)
{
echo "Caught exception: " . get_class($e) . "<br/>";
diff --git a/application/modules/user/controllers/PersonController.php b/application/modules/user/controllers/PersonController.php
index 9cdf258..ad8f596 100644
--- a/application/modules/user/controllers/PersonController.php
+++ b/application/modules/user/controllers/PersonController.php
@@ -46,9 +46,9 @@ class user_PersonController extends Zend_Controller_Action
public function indexAction()
{
- if(!Pbs_Acl::checkRight('psod')) {
- $this->_redirect('/user');
- }
+ #if(!Pbs_Acl::checkRight('psod')) {
+ # $this->_redirect('/user');
+ #}
$this->view->person = $this->person;
// Pagination
$pagination = new Pbs_Pagination();
@@ -60,7 +60,8 @@ class user_PersonController extends Zend_Controller_Action
$this->view->groups = $pagination->getElements();
$this->view->pagination = $pagination->pagination($pageurl);
$this->view->page = $pagination->getRequestPage();
- $this->view->groupRequestRight = Pbs_Acl::checkRight('grm');
+ // This should be activated in case the person has no membership and no rights.
+ $this->view->groupRequestRight = true;
$this->view->editRight = Pbs_Acl::checkRight('peoa');
$this->view->leaveRight = Pbs_Acl::checkRight('gl');
$this->view->userIDsNamespace = Zend_Session::namespaceGet('userIDs');
@@ -129,9 +130,9 @@ class user_PersonController extends Zend_Controller_Action
public function requestAction()
{
- if(!Pbs_Acl::checkRight('grm')) {
- $this->_redirect('/user');
- }
+ #if(!Pbs_Acl::checkRight('grm')) {
+ # $this->_redirect('/user');
+ #}
$this->view->person = $this->person;
$allgroups = $this->groupMapper->fetchAll();
$groupRequests = $this->groupRequestMapper->findBy(array('personID' => $this->person->getID()),true);
diff --git a/application/modules/user/layouts/user.phtml b/application/modules/user/layouts/user.phtml
index b27b747..32569c9 100644
--- a/application/modules/user/layouts/user.phtml
+++ b/application/modules/user/layouts/user.phtml
@@ -29,10 +29,12 @@ echo $this->headScript()."\n";
<li class='navTreeItem'><a href='/user/'>user</a></li>
<li>
<ul class='navTreeLevel1'>
+ <?php if(Zend_Auth::getInstance()->hasIdentity()) {
+ echo "<li class='navTreeItem'><a href='/user/person'>Own Details</a></li>";
+ }
+ ?>
<?php if (Zend_Auth::getInstance()->hasIdentity() && count(Zend_Session::namespaceGet('userIDs')) > 0) {
# This should be splitted
- if(Pbs_Acl::checkRight('psod'))
- echo "<li class='navTreeItem'><a href='/user/person'>Own Details</a></li>";
if(Pbs_Acl::checkRight('pso'))
echo "<li class='navTreeItem'><a href='/user/person/showall'>Personlist</a></li>";
if(Pbs_Acl::checkRight('gsdo'))
diff --git a/application/modules/user/views/scripts/person/index.phtml b/application/modules/user/views/scripts/person/index.phtml
index 7c6fc8d..c285ece 100644
--- a/application/modules/user/views/scripts/person/index.phtml
+++ b/application/modules/user/views/scripts/person/index.phtml
@@ -47,11 +47,12 @@ $class= 'highlight checked';
</div>
<?php endforeach ?></div>
<?php echo $this->pagination;
- if($this->groupRequestRight === true) echo $this->formButton('addtogroup', 'Add to additional
+
+}
+if($this->groupRequestRight === true) echo $this->formButton('addtogroup', 'Add to additional
Groups', array(
'onclick' => 'self.location="/user/person/request/"',
'class' => 'addbutton'));
-}
?>
<br />
<br />
diff --git a/library/Pbs/Filter.php b/library/Pbs/Filter.php
index 5a83a40..5231e59 100644
--- a/library/Pbs/Filter.php
+++ b/library/Pbs/Filter.php
@@ -420,7 +420,6 @@ class Pbs_Filter{
return $bootmenuID;
}
else{
- echo "<h1>No Result :-(</h1>";
return null;
}
diff --git a/library/Pbs/NewMember.php b/library/Pbs/NewMember.php
new file mode 100644
index 0000000..2825834
--- /dev/null
+++ b/library/Pbs/NewMember.php
@@ -0,0 +1,63 @@
+<?php
+
+class Pbs_NewMember{
+
+ public function createDefaults(Application_Model_Membership $membership){
+ $personMapper = new Application_Model_PersonMapper();
+ $bootmenuMapper = new Application_Model_BootMenuMapper();
+ $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
+ $filterMapper = new Application_Model_FilterMapper();
+ $filterentriesMapper = new Application_Model_FilterEntriesMapper();
+
+ // First we copy the default bootmenu with all the entries
+ $groupID = $membership->getGroupID();
+ $person = $personMapper->find($membership->getPersonID());
+ $personname = $person->getFirstName(). " " . $person->getName();
+
+ $defaultBootmenu = $bootmenuMapper->findBy(array('groupID'=>$groupID, 'defaultbootmenu'=>'1'));
+ $defaultBootmenu = $defaultBootmenu[0];
+
+ $userBootmenu = new Application_Model_BootMenu();
+ $userBootmenu->setID(null);
+ $userBootmenu->setGroupID(null);
+ $userBootmenu->setMembershipID($membership->getID());
+ $userBootmenu->setTitle("Private BootMenu of ".$personname);
+ $userBootmenu->setCreated(time());
+ $userBootmenu->setDefaultbootmenu(0);
+ $userBootmenuID = $bootmenuMapper->save($userBootmenu);
+ $userBootmenu->setID($userBootmenuID);
+
+ # print_a('userbootmenu',$userBootmenu);
+
+ $bootmenuentries = $bootmenuentriesMapper->findBy(array('bootmenuID'=>$defaultBootmenu->getID()));
+ foreach($bootmenuentries as $bme){
+ $bme->setID(null);
+ $bme->setBootmenuID($userBootmenuID);
+ $bootmenuentriesMapper->save($bme);
+ #print_a('bootmenuentry',$bme);
+ }
+
+ // Second we create a filter
+ $filter = new Application_Model_Filter();
+ $filter->setTitle("Private Filter of ".$personname);
+ $filter->setDescription("This filter was automatically created to forward the user to his own bootmenu");
+ $filter->setMembershipID($membership->getID());
+ $filter->setGroupID($membership->getGroupID());
+ $filter->setBootmenuID($userBootmenuID);
+ $filter->setCreated(time());
+ $filter->setPriority(50);
+ $filterID = $filterMapper->save($filter);
+ # print_a('filter',$filter);
+
+ $filterentry = new Application_Model_FilterEntries();
+ $filterentry->setFilterID($filterID);
+ $filterentry->setFiltertypeID(5);
+ $filterentry->setFiltervalue($membership->getID());
+ $filterentriesMapper->save($filterentry);
+ # print_a('filterentry',$filterentry);
+
+
+ }
+}
+
+?>
diff --git a/library/Pbs/Search.php b/library/Pbs/Search.php
index 9f25d03..a148b08 100644
--- a/library/Pbs/Search.php
+++ b/library/Pbs/Search.php
@@ -8,9 +8,17 @@ class Pbs_Search{
private $module;
private $countall;
private $countresult;
+ private $type;
public function searchForm(){
- $str = "<form style='float:left;' action='/user/".$this->module."/search'>
+ $str = "<form style='float:left;' action='";
+ if($this->type == ''){
+ $str .= "/user/".$this->module."/search";
+ }
+ else{
+ $str .= "/user/".$this->module."/search/type/".$this->type;
+ }
+ $str .= "'>
<input type='text' id='search' name='search' ".(($this->searchTerm != '')?'value="'.htmlentities($this->searchTerm, ENT_QUOTES).'"':'').">
<button type='submit' class='searchbutton' value='search'> Search</button>";
@@ -67,6 +75,9 @@ class Pbs_Search{
public function setModule($m){
$this->module = $m;
}
+ public function setType($t){
+ $this->type = $t;
+ }
public function setSearchTerm($search){
$this->searchTerm = trim($search);
diff --git a/pbs.sql b/pbs.sql
index 0d0c6f3..a052bb7 100644
--- a/pbs.sql
+++ b/pbs.sql
@@ -19,7 +19,7 @@ CREATE TABLE IF NOT EXISTS `pbs_right` (
`rightID` int(11) NOT NULL AUTO_INCREMENT,
`rightcategoryID` int(11) NOT NULL,
`shortcut` varchar(10) COLLATE utf8_unicode_ci NOT NULL UNIQUE,
- `title` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
+ `title` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`description` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`rightID`),
KEY `rightcategoryID` (`rightcategoryID`)
@@ -159,7 +159,7 @@ CREATE TABLE IF NOT EXISTS `pbs_bootmenu` (
`bootmenuID` int(11) NOT NULL AUTO_INCREMENT,
`membershipID` int(11),
`groupID` int(11),
- `title` varchar(30) NOT NULL,
+ `title` varchar(50) NOT NULL,
`created` varchar(14) NOT NULL,
`defaultbootmenu` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`bootmenuID`),
@@ -286,7 +286,7 @@ ALTER TABLE `pbs_poolentries`
CREATE TABLE IF NOT EXISTS `pbs_filter` (
`filterID` int(11) NOT NULL AUTO_INCREMENT,
`membershipID` int(11),
- `groupID` int(11) NOT NULL,
+ `groupID` int(11),
`bootmenuID` int(11) NOT NULL,
`title` varchar(30) NOT NULL,
`description` varchar(140),
diff --git a/send-post.html b/send-post.html
index f3ae995..6cad8c8 100644
--- a/send-post.html
+++ b/send-post.html
@@ -22,7 +22,7 @@
<legend>http://pbs2.local/</legend>
<form action='http://pbs2.local/' method='post'>
<label>serialnumber</label>
- <input type='text' name='serialnumber' value='123456789'></br>
+ <input type='text' name='serialnumber' value='10-20-30-40-50'></br>
<label>Mac</label>
<input type='text' name='mac' value='00:0c:29:01:63:88'></br>
<label>Hardwarehash</label>