summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon2011-04-20 13:08:33 +0200
committerSimon2011-04-20 13:08:33 +0200
commit624cbcae5c9b5bcedf03c77460b07eb20fbb2366 (patch)
tree8a768c4f55d982384982f3c541b1d4b8d319ca96
parentTicket #229 - Hilfetexte wurde bei den Bereichen, zu denen Benutzer zugriff h... (diff)
downloadpbs2-624cbcae5c9b5bcedf03c77460b07eb20fbb2366.tar.gz
pbs2-624cbcae5c9b5bcedf03c77460b07eb20fbb2366.tar.xz
pbs2-624cbcae5c9b5bcedf03c77460b07eb20fbb2366.zip
Automatischer Start nach x Sekunden hinzugefügt
-rw-r--r--application/controllers/ErrorController.php4
-rw-r--r--application/models/BootMenu.php10
-rw-r--r--application/models/BootMenuMapper.php26
-rw-r--r--application/modules/fbgui/controllers/IndexController.php1
-rw-r--r--application/modules/fbgui/views/scripts/index/index.phtml55
-rw-r--r--application/modules/user/controllers/BootmenuController.php2
-rw-r--r--application/modules/user/forms/Bootmenu.php8
-rw-r--r--application/modules/user/views/scripts/bootmenu/index.phtml3
-rw-r--r--setup/pbs.sql2
9 files changed, 101 insertions, 10 deletions
diff --git a/application/controllers/ErrorController.php b/application/controllers/ErrorController.php
index efee141..abf3ec1 100644
--- a/application/controllers/ErrorController.php
+++ b/application/controllers/ErrorController.php
@@ -26,13 +26,13 @@ class ErrorController extends Zend_Controller_Action
$this->getResponse()->setHttpResponseCode(404);
$this->view->message = 'Page not found';
$this->_redirect('/user/');
- #print_a($errors);
+ # print_a($errors);
break;
default:
// application error
$this->getResponse()->setHttpResponseCode(500);
$this->view->message = 'Application error - Please contact the admin';
- #print_a($errors);
+ # print_a($errors);
break;
}
diff --git a/application/models/BootMenu.php b/application/models/BootMenu.php
index 82e771a..dae3776 100644
--- a/application/models/BootMenu.php
+++ b/application/models/BootMenu.php
@@ -16,6 +16,7 @@ class Application_Model_BootMenu
protected $_membershipID;
protected $_groupID;
protected $_title;
+ protected $_startcounter;
protected $_created;
protected $_defaultbootmenu;
@@ -96,6 +97,15 @@ class Application_Model_BootMenu
{
return $this->_created;
}
+ public function setStartcounter($_startcounter)
+ {
+ $this->_startcounter = $_startcounter;
+ return $this;
+ }
+ public function getStartcounter()
+ {
+ return $this->_startcounter;
+ }
public function setCreated($_created)
{
$this->_created = $_created;
diff --git a/application/models/BootMenuMapper.php b/application/models/BootMenuMapper.php
index 8b39a5a..6ba72bd 100644
--- a/application/models/BootMenuMapper.php
+++ b/application/models/BootMenuMapper.php
@@ -84,7 +84,13 @@ class Application_Model_BootMenuMapper
public function save(Application_Model_BootMenu $botmenu)
{
- $data = array('bootmenuID'=> $botmenu->getID() ,'membershipID'=> $botmenu->getMembershipID(), 'groupID'=> $botmenu->getGroupID() ,'title'=> $botmenu->getTitle() ,'created'=> $botmenu->getCreated(), 'defaultbootmenu' => $botmenu->getDefaultbootmenu());
+ $data = array('bootmenuID'=> $botmenu->getID() ,
+ 'membershipID'=> $botmenu->getMembershipID(),
+ 'groupID'=> $botmenu->getGroupID() ,
+ 'title'=> $botmenu->getTitle() ,
+ 'startcounter'=> $botmenu->getStartcounter() ,
+ 'created'=> $botmenu->getCreated(),
+ 'defaultbootmenu' => $botmenu->getDefaultbootmenu());
if (null === ($id = $botmenu->getID()) ) {
unset($data['bootmenuID']);
@@ -113,10 +119,22 @@ class Application_Model_BootMenuMapper
if($botmenu == null){
$botmenu = new Application_Model_BootMenu();
- $botmenu->setID($row->bootmenuID)->setMembershipID($row->membershipID)->setGroupID($row->groupID)->setTitle($row->title)->setCreated($row->created)->setDefaultbootmenu($row->defaultbootmenu);
+ $botmenu->setID($row->bootmenuID)
+ ->setMembershipID($row->membershipID)
+ ->setGroupID($row->groupID)
+ ->setTitle($row->title)
+ ->setStartcounter($row->startcounter)
+ ->setCreated($row->created)
+ ->setDefaultbootmenu($row->defaultbootmenu);
return $botmenu;
}else{
- $botmenu->setID($row->bootmenuID)->setMembershipID($row->membershipID)->setGroupID($row->groupID)->setTitle($row->title)->setCreated($row->created)->setDefaultbootmenu($row->defaultbootmenu);
+ $botmenu->setID($row->bootmenuID)
+ ->setMembershipID($row->membershipID)
+ ->setGroupID($row->groupID)
+ ->setTitle($row->title)
+ ->setStartcounter($row->startcounter)
+ ->setCreated($row->created)
+ ->setDefaultbootmenu($row->defaultbootmenu);
}
@@ -129,7 +147,7 @@ class Application_Model_BootMenuMapper
foreach ($resultSet as $row) {
$entry = new Application_Model_BootMenu();
- $entry->setID($row->bootmenuID)->setMembershipID($row->membershipID)->setGroupID($row->groupID)->setTitle($row->title)->setCreated($row->created)->setDefault($row->default);
+ $entry->setID($row->bootmenuID)->setMembershipID($row->membershipID)->setGroupID($row->groupID)->setTitle($row->title)->setStartcounter($row->startcounter)->setCreated($row->created)->setDefault($row->default);
$entries[] = $entry;
}
diff --git a/application/modules/fbgui/controllers/IndexController.php b/application/modules/fbgui/controllers/IndexController.php
index 17d9337..150f1c5 100644
--- a/application/modules/fbgui/controllers/IndexController.php
+++ b/application/modules/fbgui/controllers/IndexController.php
@@ -117,6 +117,7 @@ class Fbgui_IndexController extends Zend_Controller_Action
$bootmenuMapper = new Application_Model_BootMenuMapper();
$bm = $bootmenuMapper->find($bootmenuID);
$this->view->title = $bm->getTitle();
+ $this->view->startcounter = $bm->getStartcounter();
$bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
$res = $bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID),false);
diff --git a/application/modules/fbgui/views/scripts/index/index.phtml b/application/modules/fbgui/views/scripts/index/index.phtml
index 2454d45..8a5f0e6 100644
--- a/application/modules/fbgui/views/scripts/index/index.phtml
+++ b/application/modules/fbgui/views/scripts/index/index.phtml
@@ -26,6 +26,9 @@
});
$(function() {
+ $(document).click(function(){
+ abortStartcount = true;
+ })
$(document).keyup(function (event) {
if (event.keyCode == 38) {
// up
@@ -41,9 +44,29 @@
// Down
$('#startbutton').click();
}
+ abortStartcount = true;
});
});
+ decreaseDown();
});
+ function decreaseDown(){
+ var act = parseInt($('.startcounter').html());
+ if(act == 0){
+ start();
+ return;
+ }
+ var next = act-1;
+ $('.startcounter').html(next);
+ if(next == 0){
+ start();
+ }
+ if(next > 0 && abortStartcount == false){
+ setTimeout('decreaseDown()',1000);
+ }
+ if(abortStartcount == true){
+ $('.startcounter').parent().fadeOut();
+ }
+ }
function start(){
if($('#selectedBootOs').val() != ''){
if($('#selectedBootOs').val() == 'login'){
@@ -79,6 +102,7 @@
<?php endif;?>
<script type="text/javascript">
var activeElement = 0;
+ var abortStartcount = false;
$(document).ready(function(){
$('.selectswitch').click(function(){
$('.selectswitch').removeClass('selected');
@@ -97,6 +121,9 @@
});
$(function() {
+ $(document).click(function(){
+ abortStartcount = true;
+ })
$(document).keyup(function (event) {
if (event.keyCode == 38) {
// up
@@ -112,10 +139,31 @@
// Down
$('#startbutton').click();
}
+ abortStartcount = true;
});
});
-
+ <?php if(count($this->entries) > 0): ?>
+ decreaseDown()
+ <?php endif; ?>
});
+ function decreaseDown(){
+ var act = parseInt($('.startcounter').html());
+ if(act == 0){
+ start();
+ return;
+ }
+ var next = act-1;
+ $('.startcounter').html(next);
+ if(next == 0){
+ start();
+ }
+ if(next > 0 && abortStartcount == false){
+ setTimeout('decreaseDown()',1000);
+ }
+ if(abortStartcount == true){
+ $('.startcounter').parent().fadeOut();
+ }
+ }
function start(){
if($('#selectedBootOs').val() != ''){
if($('#selectedBootOs').val() == 'login'){
@@ -132,6 +180,9 @@
}
</script>
<h1><?php echo $this->title;?></h1>
+ <?php if(count($this->entries) > 0): ?>
+ <div style='padding:5px;float:right;'>Starting in <span class='startcounter'><?php echo $this->startcounter; ?></span> seconds</div>
+ <?php endif; ?>
<div class='bootmenu'>
<?php $first = true;
?>
@@ -149,7 +200,7 @@
<input type="hidden" class="id" value="<?php echo $entry->getID();?>"/>
</div>
<?php endforeach; ?>
- </div>
+ </div>
<input style="display:none;" type='text' id="selectedBootOs" />
<button onClick="start();" id='startbutton' class="fbguistart" style='font-size:16px;font-weight:bold;margin-bottom:5px;'>
Start System
diff --git a/application/modules/user/controllers/BootmenuController.php b/application/modules/user/controllers/BootmenuController.php
index 1eeb19b..f901568 100644
--- a/application/modules/user/controllers/BootmenuController.php
+++ b/application/modules/user/controllers/BootmenuController.php
@@ -219,7 +219,7 @@ class user_BootmenuController extends Zend_Controller_Action
$bootmenu->setCreated(time());
$bootmenu->setID($bootmenuID);
$bootmenu->setDefaultbootmenu($bootmenuold->getDefaultbootmenu());
-
+ print_a($bootmenu);
try {
$this->bootmenuMapper->save($bootmenu);
}catch(Zend_Exception $e)
diff --git a/application/modules/user/forms/Bootmenu.php b/application/modules/user/forms/Bootmenu.php
index 77b8f3c..0a827d9 100644
--- a/application/modules/user/forms/Bootmenu.php
+++ b/application/modules/user/forms/Bootmenu.php
@@ -50,6 +50,14 @@ class user_Form_Bootmenu extends Zend_Form
'required' => true,
'label' => 'Title:',
));
+ $this->addElement('text', 'startcounter', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('Int'),
+ ),
+ 'required' => true,
+ 'label' => 'Startcounter:',
+ ));
if($this->action == "createbootmenu")
$label = "Create Bootmenu";
diff --git a/application/modules/user/views/scripts/bootmenu/index.phtml b/application/modules/user/views/scripts/bootmenu/index.phtml
index e9a6958..cf23e1d 100644
--- a/application/modules/user/views/scripts/bootmenu/index.phtml
+++ b/application/modules/user/views/scripts/bootmenu/index.phtml
@@ -108,7 +108,8 @@
<?php endif; ?>
</div>
<div class='title'><?php echo $this->escape($bootmenu->getTitle()); ?></div>
- <div class='subtitle'><?php echo count($this->bootmenuentrylist[$bootmenu->getID()]);?> Entrys - <?php echo $this->escape($bootmenu->getCreated()); ?></div>
+ <div class='subtitle'><?php echo count($this->bootmenuentrylist[$bootmenu->getID()]);?> Entrys -
+ Startcounter: <?php echo $this->escape($bootmenu->getStartcounter()); ?> - <?php echo $this->escape($bootmenu->getCreated()); ?></div>
<?php
$class='';
if($this->type != 'own')
diff --git a/setup/pbs.sql b/setup/pbs.sql
index ebcdbef..9eee1ab 100644
--- a/setup/pbs.sql
+++ b/setup/pbs.sql
@@ -192,6 +192,8 @@ CREATE TABLE IF NOT EXISTS `pbs_bootmenu` (
KEY `groupID` (`groupID`),
KEY `membershipID` (`membershipID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
+ALTER TABLE `pbs_bootmenu` ADD `startcounter` INT NOT NULL AFTER `title`;
+ALTER TABLE `pbs_bootmenu` CHANGE `startcounter` `startcounter` INT( 11 ) NOT NULL DEFAULT '300'
ALTER TABLE `pbs_bootmenu`
ADD CONSTRAINT `pbs_bootmenu_ibfk_1` FOREIGN KEY (`membershipID`) REFERENCES `pbs_membership` (`membershipID`) ON DELETE SET NULL,