summaryrefslogtreecommitdiffstats
path: root/application/modules/user
diff options
context:
space:
mode:
authormichael pereira2011-04-21 14:03:56 +0200
committermichael pereira2011-04-21 14:03:56 +0200
commit583ccfa017f2a57776d70cf1b80a7dbb1228124c (patch)
treec58419423f503e31ec06b547e6c2ec4fbe554109 /application/modules/user
parentmerges (diff)
downloadpbs2-583ccfa017f2a57776d70cf1b80a7dbb1228124c.tar.gz
pbs2-583ccfa017f2a57776d70cf1b80a7dbb1228124c.tar.xz
pbs2-583ccfa017f2a57776d70cf1b80a7dbb1228124c.zip
updates raus
Diffstat (limited to 'application/modules/user')
-rw-r--r--application/modules/user/controllers/BootmenuController.php2
-rw-r--r--application/modules/user/controllers/PrebootController.php51
-rw-r--r--application/modules/user/forms/Bootiso.php13
-rw-r--r--application/modules/user/forms/Preboot.php14
4 files changed, 53 insertions, 27 deletions
diff --git a/application/modules/user/controllers/BootmenuController.php b/application/modules/user/controllers/BootmenuController.php
index f901568..38b278c 100644
--- a/application/modules/user/controllers/BootmenuController.php
+++ b/application/modules/user/controllers/BootmenuController.php
@@ -95,7 +95,7 @@ class user_BootmenuController extends Zend_Controller_Action
if($bootmenuentry->getKclappend() == null)
$bootmenuentry->setKclappend("none (edit Bootmenuentry to set KCL-Append)");
$bootmenuentry->setBootosID("[".$bootmenuentry->getBootosID()."] ".$bootosMapper->find($bootmenuentry->getBootosID())->getTitle());
- $bootmenuentry->setConfigID("[".$bootmenuentry->getConfigID()."] ".$configMapper->find($bootmenuentry->getConfigID())->gettitle());
+ $bootmenuentry->setConfigID("[".$bootmenuentry->getConfigID()."] ".$configMapper->find($bootmenuentry->getConfigID())->getTitle());
}
}
}else{
diff --git a/application/modules/user/controllers/PrebootController.php b/application/modules/user/controllers/PrebootController.php
index 2b2955d..730debb 100644
--- a/application/modules/user/controllers/PrebootController.php
+++ b/application/modules/user/controllers/PrebootController.php
@@ -117,41 +117,46 @@ class User_PrebootController extends Zend_Controller_Action
if ($prebootForm->isValid($_POST)) {
- $preboot = new Application_Model_PreBoot($_POST);
- $preboot->setGroupID($this->membership->getGroupID());
-
+ $groupID = $this->membership->getGroupID();
+ $source = $_SERVER['REMOTE_ADDR'];
+
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;
+ if($_FILES['preboot']['size'] == 0 && $_FILES['preboot']['name'] != ''){
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/file');
+ }
+
+ list($preboot) = $this->prebootMapper->findBy(array('groupid' => $groupID, 'title' => $_POST['title']));
+ if($preboot != null){
+ header('HTTP/1.0 400 Preboot already exists');
+ die();
}
-
+
+
+ $preboot = new Application_Model_PreBoot($_POST);
+
+ $preboot->setGroupID($groupID);
+ $preboot->setSource($source);
+ $preboot->setCreated(time());
+
$prebootID = $this->prebootMapper->save($preboot);
+
+ $prebootpath = "../resources/bootmedium/".$prebootID."/";
+ mkdir($prebootpath ,0777, true);
+
+ if(isset($_FILES['preboot'])){
+ move_uploaded_file($_FILES['preboot']['tmp_name'], $prebootpath."preboot.zip");
+ }
- $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/page/'.$this->page.'/addresult/error');
+ //$this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/error');
//TODO Delete folder + preboot in DB
}
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/ok');
+ //$this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/ok');
}
}
diff --git a/application/modules/user/forms/Bootiso.php b/application/modules/user/forms/Bootiso.php
index 6ec9eb7..af474b5 100644
--- a/application/modules/user/forms/Bootiso.php
+++ b/application/modules/user/forms/Bootiso.php
@@ -50,6 +50,17 @@ class user_Form_Bootiso extends Zend_Form
'label' => 'Title:',
));
+ $this->addElement('textarea', 'description', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'rows' => 5,
+ 'cols' => 50,
+ 'label' => 'Description:',
+ ));
+
$prebootfield = $this->createElement('select','prebootID');
$prebootfield->setLabel('Preboot:');
$prebootfield->setAttrib('readOnly', $meta);
@@ -77,7 +88,7 @@ class user_Form_Bootiso extends Zend_Form
'readOnly' => $meta,
'value' => $serial
));
-
+
$date = new DateTime();
$date->add(new DateInterval('P1Y'));
$this->addElement('text', 'expires', array(
diff --git a/application/modules/user/forms/Preboot.php b/application/modules/user/forms/Preboot.php
index 0b69c12..634b2b7 100644
--- a/application/modules/user/forms/Preboot.php
+++ b/application/modules/user/forms/Preboot.php
@@ -41,14 +41,24 @@ class user_Form_Preboot extends Zend_Form
'required' => true,
'label' => 'Title:',
));
+
+ $this->addElement('textarea', 'description', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'rows' => 5,
+ 'cols' => 50,
+ 'label' => 'Description:',
+ ));
- $this->addElement('file', 'prebootfile', array(
+ $this->addElement('file', 'preboot', array(
'required' => true,
'readOnly' => $meta,
'label' => 'Preboot:',
));
-
if($this->action == "createpreboot")
$label = "Create Preboot";
else