From 6bce0dc8f948c024b42fba62f83826d1cce37ece Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 11 Jan 2010 09:44:17 +0000 Subject: [PATCH] Readded iso creation git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15135 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/class_systemManagement.inc | 91 +++++++++++++++++++ .../systems/admin/systems/system-list.xml | 9 ++ 2 files changed, 100 insertions(+) diff --git a/gosa-plugins/systems/admin/systems/class_systemManagement.inc b/gosa-plugins/systems/admin/systems/class_systemManagement.inc index aecf4289d..240d811d5 100644 --- a/gosa-plugins/systems/admin/systems/class_systemManagement.inc +++ b/gosa-plugins/systems/admin/systems/class_systemManagement.inc @@ -75,6 +75,9 @@ class systemManagement extends management $this->registerAction("DaemonEvent_activate","handleEvent"); } $this->registerAction("saveEvent","saveEventDialog"); + $this->registerAction("createISO","createISO"); + $this->registerAction("initiateISOcreation","initiateISOcreation"); + $this->registerAction("performIsoCreation","performIsoCreation"); // Add copy&paste and snapshot handler. if ($this->config->boolValueIsTrue("main", "copyPaste")){ @@ -100,6 +103,92 @@ class systemManagement extends management } + function createISO($action,$target) + { + if(count($target) == 1){ + $smarty = get_smarty(); + $this->dn= array_pop($target); + set_object_info($this->dn); + return ($smarty->fetch(get_template_path('goto/gencd.tpl', TRUE))); + + } + } + + function initiateISOcreation() + { + $smarty = get_smarty(); + $smarty->assign("src", "?plug=".$_GET['plug']."&PerformIsoCreation"); + return ($smarty->fetch(get_template_path('goto/gencd_frame.tpl', TRUE))); + } + + + function performIsoCreation() + { + $return_button = "
+ + +
"; + + $dsc = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w")); + + /* Get and check command */ + $command= $this->config->search("workgeneric", "SYSTEMISOHOOK",array('tabs')); + if (check_command($command)){ + @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute"); + + /* Print out html introduction */ + echo ' + + + + + + + +
';
+
+      /* Open process handle and check if it is a valid process */
+      $process= proc_open($command." '".$this->dn."'", $dsc, $pipes);
+      if (is_resource($process)) {
+        fclose($pipes[0]);
+
+        /* Print out returned lines && write JS to scroll down each line */
+        while (!feof($pipes[1])){
+          $cur_dat = fgets($pipes[1], 1024);
+          echo $cur_dat;
+          echo '' ;
+          flush();
+        }
+      }
+
+      /* Get error string && close streams */
+      $buffer= stream_get_contents($pipes[2]);
+
+      fclose($pipes[1]);
+      fclose($pipes[2]);
+      echo "
"; + + /* Check return code */ + $ret= proc_close($process); + if ($ret != 0){ + echo "

"._("Creating the image failed. Please see the report below.")."

"; + echo "
$buffer
"; + } + echo $return_button."
"; + } else { + $tmp= "

".sprintf(_("Command '%s', specified for ISO creation doesn't seem to exist."), $command)."

"; + echo $tmp; + echo $return_button."
"; + } + + /* Scroll down completly */ + echo '' ; + echo ''; + flush(); + exit; + } + + /*! \brief Handle GOsa-si events * All events are handled here. */ @@ -353,6 +442,8 @@ class systemManagement extends management $action= management::detectPostActions(); if(isset($_POST['abort_event_dialog'])) $action['action'] = "cancel"; if(isset($_POST['save_event_dialog'])) $action['action'] = "saveEvent"; + if(isset($_POST['cd_create'])) $action['action'] = "initiateISOcreation"; + if(isset($_GET['PerformIsoCreation'])) $action['action'] = "performIsoCreation"; return($action); } diff --git a/gosa-plugins/systems/admin/systems/system-list.xml b/gosa-plugins/systems/admin/systems/system-list.xml index 20044b55e..31405ca09 100644 --- a/gosa-plugins/systems/admin/systems/system-list.xml +++ b/gosa-plugins/systems/admin/systems/system-list.xml @@ -425,6 +425,15 @@ + + createISO + entry + gotoWorkstation + plugins/systems/images/cdrom.png + workstation/workgeneric[createFAICD:w] + + + cp copypaste -- 2.30.2