diff options
Diffstat (limited to 'application')
6 files changed, 226 insertions, 62 deletions
diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php index 2972e9e..f3e5256 100644 --- a/application/controllers/IndexController.php +++ b/application/controllers/IndexController.php @@ -10,9 +10,12 @@ class IndexController extends Zend_Controller_Action public function indexAction() { - if(stristr($_SERVER['HTTP_USER_AGENT'],'prebootGUI')){ - $this->_forward('index','Index','fbgui'); + if(stristr($_SERVER['HTTP_USER_AGENT'],'prebootGUI')){ + $_SESSION['postdata'] = $_POST; + $this->_redirect('/fbgui/index/index') ; } + + // action body } diff --git a/application/modules/fbgui/controllers/IndexController.php b/application/modules/fbgui/controllers/IndexController.php index f5f8cdf..6c4a542 100644 --- a/application/modules/fbgui/controllers/IndexController.php +++ b/application/modules/fbgui/controllers/IndexController.php @@ -10,7 +10,10 @@ class Fbgui_IndexController extends Zend_Controller_Action public function indexAction() { - + if(isset($_SESSION['postdata'])){ + $_POST = ($_SESSION['postdata']); + unset($_SESSION['postdata']); + } $keys = $this->_request->getParam('keys'); $post = $this->_request->getParam('post'); if($post != '' && $keys != ''){ @@ -25,8 +28,17 @@ class Fbgui_IndexController extends Zend_Controller_Action $bootisomapper = new Application_Model_BootIsoMapper(); $bootiso = new Application_Model_BootIso(); - $bootisomapper->find($_POST['bootisoID'],$bootiso); - $groupID = $bootiso->getGroupID(); + if(isset($_POST['bootisoID'])){ + $bootisomapper->find($_POST['bootisoID'],$bootiso); + $groupID = $bootiso->getGroupID(); + } + elseif(isset($_POST['serialnumber'])){ + $results = $bootisomapper->findBy('serialnumber',$_POST['serialnumber']); + $bootiso->setOptions($results[0]); + $bootiso->setID($result[0]['bootisoID']); + $groupID = $bootiso->getGroupID(); + + } $client = new Application_Model_Client(); $client->setMacadress($_POST['mac']); @@ -51,10 +63,11 @@ class Fbgui_IndexController extends Zend_Controller_Action // Request Bootmenu $pbsFilter = new Pbs_Filter(); $bootmenuID = $pbsFilter->evaluate(); - print_a('bootmenuID is ',$bootmenuID); if($bootmenuID != null){ - print_a('goto bootmenu'); - #$this->_redirect('/dev/bootmenu/index/bootmenuid/'.$bootmenuID); + print_a('goto bootmenu '.$bootmenuID); + $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper(); + $res = $bootmenuentriesMapper->findBy('bootmenuID',$bootmenuID); + $this->view->entries = $res; } else{ print_a('no filter is valid, goto login'); @@ -64,10 +77,33 @@ class Fbgui_IndexController extends Zend_Controller_Action else{ echo "<h1>Not Welcome</h1>"; print_a($_POST); - } - die(); + } + } - + public function startAction(){ + $bootmenuntryID = $this->_request->getParam('bme'); + $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper(); + $bootmenuentry = new Application_Model_BootMenuEntries(); + $bootmenuentriesMapper->find($bootmenuntryID,$bootmenuentry); + + $sessionMapper = new Application_Model_SessionMapper(); + $session_k = $sessionMapper->findBy('alphasessionID',$_SESSION['alphasessionID']); + + $session = new Application_Model_Session(); + $session->setOptions($session_k[0]); + $session->setID($session_k[0]['sessionID']); +# print_a($bootmenuentry);die(); + $session->setBootmenuentryID($bootmenuntryID); + $session->setBootosID($bootmenuentry->getBootosID()); + echo "<h1>Downloading</h1>"; + echo "<script>\n"; + echo "fbgui.startDownload('http://132.230.2.27/dev/resource/getkernel/".$_SESSION['alphasessionID']."/file/kernel');\n"; + echo "fbgui.startDownload('http://132.230.2.27/dev/resource/getkernel/".$_SESSION['alphasessionID']."/file/initramfs');\n"; + echo "fbgui.startDownload('http://132.230.2.27/dev/resource/getkernel/".$_SESSION['alphasessionID']."/file/kcl');\n"; + echo "fbgui.getSession('".$_SESSION['alphasessionID']."');\n"; + echo "</script>"; + + } } diff --git a/application/modules/fbgui/views/scripts/index/index.phtml b/application/modules/fbgui/views/scripts/index/index.phtml index 4b38f0a..b2b813d 100644 --- a/application/modules/fbgui/views/scripts/index/index.phtml +++ b/application/modules/fbgui/views/scripts/index/index.phtml @@ -1,43 +1,9 @@ -<style> - a:link, - a:visited - { - color: #0398CA; - } - - span#zf-name - { - color: #91BE3F; - } - - div#welcome - { - color: #FFFFFF; - background-image: url(http://framework.zend.com/images/bkg_header.jpg); - width: 600px; - height: 400px; - border: 2px solid #444444; - overflow: hidden; - text-align: center; - } - - div#more-information - { - background-image: url(http://framework.zend.com/images/bkg_body-bottom.gif); - height: 100%; - } -</style> -<div id="welcome"> - <h1>Welcome to the <span id="zf-name">Zend Framework!</span></h1> - - <h3>This is your project's main page</h3> - - <div id="more-information"> - <p><img src="http://framework.zend.com/images/PoweredBy_ZF_4LightBG.png" /></p> - <p> - Helpful Links: <br /> - <a href="http://framework.zend.com/">Zend Framework Website</a> | - <a href="http://framework.zend.com/manual/en/">Zend Framework Manual</a> - </p> - </div> -</div>
\ No newline at end of file +<table> +<?php foreach($this->entries as $entry):?> +<tr> + <td><?php echo $entry->getID();?></td> + <td><?php echo $entry->getTitle();?></td> + <td><a href='/fbgui/index/start/bme/<?php echo $entry->getID();?>'>take this</td> +</tr> +<?php endforeach; ?> +</table> diff --git a/application/modules/fbgui/views/scripts/index/start.phtml b/application/modules/fbgui/views/scripts/index/start.phtml new file mode 100644 index 0000000..a8f91fe --- /dev/null +++ b/application/modules/fbgui/views/scripts/index/start.phtml @@ -0,0 +1,100 @@ +<style> +/* position the bars and balls correctly (rotate them and translate them outward)*/ +.bar1 { + -moz-transform:rotate(0deg) translate(0, -40px); + -webkit-transform:rotate(0deg) translate(0, -40px);opacity:0.12; +} +.bar2 { + -moz-transform:rotate(45deg) translate(0, -40px); + -webkit-transform:rotate(45deg) translate(0, -40px);opacity:0.25; +} +.bar3 { + -moz-transform:rotate(90deg) translate(0, -40px); + -webkit-transform:rotate(90deg) translate(0, -40px);opacity:0.37; +} +.bar4 { + -moz-transform:rotate(135deg) translate(0, -40px); + -webkit-transform:rotate(135deg) translate(0, -40px);opacity:0.50; +} +.bar5 { + -moz-transform:rotate(180deg) translate(0, -40px); + -webkit-transform:rotate(180deg) translate(0, -40px);opacity:0.62; +} +.bar6 { + -moz-transform:rotate(225deg) translate(0, -40px); + -webkit-transform:rotate(225deg) translate(0, -40px);opacity:0.75; +} +.bar7 { + -moz-transform:rotate(270deg) translate(0, -40px); + -webkit-transform:rotate(270deg) translate(0, -40px);opacity:0.87; +} +.bar8 { + -moz-transform:rotate(315deg) translate(0, -40px); + -webkit-transform:rotate(315deg) translate(0, -40px);opacity:1; +} +#div4 { + position:relative; + + width:100px; + height:100px; + -moz-border-radius:100px; + -webkit-border-radius:100px; + margin:25px auto; + -moz-transform:scale(0.5); + -webkit-transform:scale(0.5); + + -webkit-animation-name: rotateThis; + -webkit-animation-duration:2s; + -webkit-animation-iteration-count:infinite; + -webkit-animation-timing-function:linear; +} +#div4 div { + width:20px; + height:20px; + background:#000; + -moz-border-radius:40px; + -webkit-border-radius:40px; + position:absolute; + left:40px; + top:40px; +} +/* add a shadow to the first */ +#div4 div { + -moz-box-shadow:black 0 0 4px; + -webkit-box-shadow:black 0 0 4px; +} +/* uncomment this to use css animation in webkit browsers */ +/* @-webkit-keyframes rotateThis { + from {-webkit-transform:scale(0.5) rotate(0deg);} + to {-webkit-transform:scale(0.5) rotate(360deg);} +} */ +</style> +<script> + + //simple script to rotate all spinners 45 degrees on each tick + //this works differently from the css transforms, which is smooth + + var count = 0; + function rotate() { + var elem4 = document.getElementById('div4'); + + elem4.style.MozTransform = 'scale(0.5) rotate('+count+'deg)'; + elem4.style.WebkitTransform = 'scale(0.5) rotate('+count+'deg)'; + if (count==360) { count = 0 } + count+=45; + window.setTimeout(rotate, 100); + } + window.setTimeout(rotate, 100); +</script> + + +<div id="div4"> + <div class="bar1"></div> + <div class="bar2"></div> + <div class="bar3"></div> + <div class="bar4"></div> + <div class="bar5"></div> + <div class="bar6"></div> + <div class="bar7"></div> + <div class="bar8"></div> +</div> diff --git a/application/modules/user/controllers/FilterController.php b/application/modules/user/controllers/FilterController.php index 444a33a..307c40d 100644 --- a/application/modules/user/controllers/FilterController.php +++ b/application/modules/user/controllers/FilterController.php @@ -206,13 +206,16 @@ class User_FilterController extends Zend_Controller_Action // TODO: get all child groups $grouppMapper = new Application_Model_GroupMapper(); - $groups = $grouppMapper->findBY('groupID',$this->membership->getGroupID()); + $group = new Application_Model_Group(); + $grouppMapper->find($this->membership->getGroupID(),$group); + $groups[] = $group->toArray(); $clientMapper = new Application_Model_ClientMapper(); $clients = $clientMapper->findBY('groupID',$this->membership->getGroupID()); return array ( 'clients' => $clients, 'memberships' => $memberships, + 'groups' => $groups, 'bootisos' => $bootisos, 'pools' => $pools); @@ -246,7 +249,7 @@ class User_FilterController extends Zend_Controller_Action $addform = new user_Form_FilterEntry(array('buttontext' => 'Add Filterentry', 'selectData' => $selectData, 'data'=>$_POST - )); + )); if ($addform->isValid($_POST)) { print_a('valid'); $newfilterenty = new Application_Model_FilterEntries(); diff --git a/application/modules/user/forms/FilterEntry.php b/application/modules/user/forms/FilterEntry.php index 55941c0..c2581c2 100644 --- a/application/modules/user/forms/FilterEntry.php +++ b/application/modules/user/forms/FilterEntry.php @@ -11,7 +11,7 @@ class user_Form_FilterEntry extends Zend_Form $this->setMethod('post'); $this->setAttrib('id','filterentryform'); #print_a($this->data); - print_a($this->selectData); + #print_a($this->selectData); try{ $filtertypemapper = new Application_Model_FilterTypeMapper(); $filtertype = $filtertypemapper->fetchAll(); @@ -189,11 +189,37 @@ class user_Form_FilterEntry extends Zend_Form $filtervalue1 = $this->createElement('text', 'filtervalue', array( 'label' => $label1, + 'validators' => array( + array( + 'regex', + false, + array( + '/^([0-1][0-9]|[2][0-3]):([0-5][0-9])$/i', + 'messages' => array( + Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Time-Format, It must be HH:MM", + Zend_Validate_Regex::INVALID => 'Time contains invalid characters.' + ) + ) + ) + ), 'required' => true, 'id' => 'val1' )); $filtervalue2 = $this->createElement('text', 'filtervalue2', array( 'label' => $label2, + 'validators' => array( + array( + 'regex', + false, + array( + '/^([0-1][0-9]|[2][0-3]):([0-5][0-9])$/i', + 'messages' => array( + Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Time-Format, It must be HH:MM", + Zend_Validate_Regex::INVALID => 'Time contains invalid characters.' + ) + ) + ) + ), 'required' => true, 'id' => 'val2' )); @@ -231,11 +257,37 @@ class user_Form_FilterEntry extends Zend_Form $filtervalue1 = $this->createElement('text', 'filtervalue', array( 'label' => $label1, + 'validators' => array( + array( + 'regex', + false, + array( + '/^([1-7])$/i', + 'messages' => array( + Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Day-Format, It must be betweeen 1 and 7", + Zend_Validate_Regex::INVALID => 'Day contains invalid characters.' + ) + ) + ) + ), 'required' => true, 'id' => 'val1' )); $filtervalue2 = $this->createElement('text', 'filtervalue2', array( 'label' => $label2, + 'validators' => array( + array( + 'regex', + false, + array( + '/^([1-7])$/i', + 'messages' => array( + Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Day-Format, It must be betweeen 1 and 7", + Zend_Validate_Regex::INVALID => 'Day contains invalid characters.' + ) + ) + ) + ), 'required' => true, 'id' => 'val2' )); @@ -246,15 +298,19 @@ class user_Form_FilterEntry extends Zend_Form $label2 = 'End Date:'; $filtervalue1 = $this->createElement('text', 'filtervalue', array( - 'label' => $label1, + 'label' => $label1, 'required' => true, 'id' => 'val1' - )); + )); + $filtervalue1->addValidator('Date',false, array('format'=>'dd.MM.yyyy')); + $filtervalue2 = $this->createElement('text', 'filtervalue2', array( - 'label' => $label2, - 'required' => true, + 'label' => $label2, + 'required' => true, 'id' => 'val2' - )); + )); + $filtervalue2->addValidator('Date',false, array('format'=>'dd.MM.yyyy')); + break; } $filtertypes->setDescription($desc); |