diff --git a/plugins/admin/systems/class_systemManagement.inc b/plugins/admin/systems/class_systemManagement.inc
index 911fbe0318fbc0d6d6df52fec068dbb53e9dea0a..b19b57cb3dac446345303acab36a502602351dbe 100644 (file)
var $ui= NULL;
var $acl= "";
var $DivListSystem;
var $ui= NULL;
var $acl= "";
var $DivListSystem;
+ var $image_creation_log ="";
function systems ($config, $ui)
{
function systems ($config, $ui)
{
}elseif(preg_match("/user_setpwd_.*/i",$key)){
$s_action="change_pw";
$s_entry = preg_replace("/user_setpwd_/i","",$key);
}elseif(preg_match("/user_setpwd_.*/i",$key)){
$s_action="change_pw";
$s_entry = preg_replace("/user_setpwd_/i","",$key);
+ }elseif(preg_match("/gen_cd_.*/i",$key)){
+ $s_action="gen_cd";
+ $s_entry = preg_replace("/gen_cd_/i","",$key);
}elseif(preg_match("/newsystem_.*/i",$key)){
$s_action="newsystem";
$s_entry = preg_replace("/newsystem_/i","",$key);
}elseif(preg_match("/newsystem_.*/i",$key)){
$s_action="newsystem";
$s_entry = preg_replace("/newsystem_/i","",$key);
}
}
}
}
+ /********************
+ Create FAI CD ...
+ ********************/
+ if ($s_action=="gen_cd"){
+ $this->dn= $this->terminals[$s_entry]['dn'];
+ $_SESSION['objectinfo']= $this->dn;
+ return ($smarty->fetch(get_template_path('gencd.tpl', TRUE)));
+ }
+
+ /* Start CD-Creation */
+ if (isset($_POST["cd_create"])){
+ $smarty->assign("src", "?plug=".$_GET['plug']."&PerformIsoCreation");
+ return ($smarty->fetch(get_template_path('gencd_frame.tpl', TRUE)));
+ }
+
+ if ($this->dn != "" && isset($_GET['PerformIsoCreation'])){
+
+ /* Initialize some attributes */
+ $this->image_creation_log = "";
+ $download_button = "<a href='?plug=".$_GET['plug']."&download_image_log'><image='images/zip.png'>"._("Download")."</a>";
+ $return_button = "<a href='?plug=".$_GET['plug']."' target='parent'><image='images/list_reload.png'>"._("Back to work")."</a>";
+ $dsc = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"));
+
+ /* Get and check command */
+ $command= search_config($this->config->data['TABS'], "workgeneric", "ISOCMD");
+ $command = "/bin/sh /home/hickert/gen_stuff.sh";
+ if (check_command($command)){
+ @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute");
+
+ /* Print out html introduction */
+ echo "<html><head>";
+ echo "<script language=\"javascript\" src=\"include/focus.js\" type=\"text/javascript\"></script>";
+ echo "</head>";
+ echo "<body>
+ <script language=\"javascript\" type=\"text/javascript\">
+ document.body.scrollTop = document.body.scrollHeight - document.body.clientHeight;
+ </script>
+ <pre>";
+
+ /* Open process handle and check if it is a valid process */
+ $process= proc_open($command, $dsc, $pipes, '/tmp');
+ 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);
+ $this->image_creation_log .= $cur_dat;
+ echo $cur_dat;
+ echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
+ flush();
+ }
+ }
+
+ /* Get error string && close streams */
+ $buffer= stream_get_contents($pipes[2]);
+ fclose($pipes[1]);
+ fclose($pipes[2]);
+ echo "</pre>";
+
+ /* Check return code */
+ $ret= proc_close($process);
+ if ($ret == 0){
+
+ /* No error */
+ $this->image_creation_log.="\n\nSuccessfull finished image creation.\n\n";
+ } else {
+
+ /* Error */
+ echo "<h1 style='color:red'>"._("Creating the image failed. Please see the report below.")."</h1>";
+ echo "<pre style='color:red'>$buffer</pre>";
+
+ $this->image_creation_log.="\n\nImage creation failed. Please see report below : \n\n";
+ $this->image_creation_log.=$buffer."\n\n";
+ }
+
+ echo $return_button.$download_button;
+
+ } else {
+ $tmp= "<h1 style='color:red'>".sprintf(_("Command '%s', specified for ISO creation doesn't seem to exist."), $command)."</h1>";
+ echo $tmp;
+ }
+
+ /* Scroll down completly */
+ echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
+ echo "</body></html>";
+ flush();
+ exit;
+ }
+
+
+ /******************
+ FAI Image creation logfile requested
+ ******************/
+ if(isset($_GET['download_image_log'])){
+
+ /* force download dialog */
+ header("Content-type: application/tiff\n");
+ if (preg_match('/MSIE 5.5/', $HTTP_USER_AGENT) ||
+ preg_match('/MSIE 6.0/', $HTTP_USER_AGENT)) {
+ header('Content-Disposition: filename="image.log"');
+ } else {
+ header('Content-Disposition: attachment; filename="image.log"');
+ }
+ header("Content-transfer-encoding: binary\n");
+ header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+ header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
+ header("Cache-Control: no-cache");
+ header("Pragma: no-cache");
+ header("Cache-Control: post-check=0, pre-check=0");
+
+ echo $this->image_creation_log;
+
+ exit();
+ }
+
+
/********************
Change password ...
/********************
Change password ...
if (count($message) == 0){
/* Save terminal data to ldap */
if (count($message) == 0){
/* Save terminal data to ldap */
- if(isset($_SESSION['SelectedSystemType']['ogroup'])){
+ if(isset($_SESSION['SelectedSystemType']['ogroup']) && $_SESSION['SelectedSystemType']['ogroup'] != 'none'){
foreach (array("workservice", "termservice") as $cls){
if (isset($this->systab->by_object[$cls])){
$this->systab->by_object[$cls]->gotoXMouseport= "";
foreach (array("workservice", "termservice") as $cls){
if (isset($this->systab->by_object[$cls])){
$this->systab->by_object[$cls]->gotoXMouseport= "";
}
}
}
}
+ /* Create a string containing the last part of the department. */
+ $dn_name = preg_replace("#^([^/]+/)*#","",convert_department_dn(@LDAP::fix($tmp)));
+ if(empty($dn_name)){
+ $dn_name = "/";
+ }
+
/* Detect type of object and create an entry for $this->terminals */
$terminal = array();
if ((in_array ($tmp, $responsible)) || ($add != "")){
/* Detect type of object and create an entry for $this->terminals */
$terminal = array();
if ((in_array ($tmp, $responsible)) || ($add != "")){
} else {
$terminal = $value;
$terminal['type'] = "D";
} else {
$terminal = $value;
$terminal['type'] = "D";
- $terminal['message'] = _("Terminal template for");
+ $terminal['message'] = _("Terminal template for")." '".$dn_name."' ";
$terminal['location'] = array_search($tmp, $this->config->departments);
}
} elseif (in_array_ics('gotoWorkstation', $value["objectClass"])){
$terminal['location'] = array_search($tmp, $this->config->departments);
}
} elseif (in_array_ics('gotoWorkstation', $value["objectClass"])){
$terminal = $value;
$terminal['type'] = "D";
$terminal['location'] = array_search($tmp, $this->config->departments);
$terminal = $value;
$terminal['type'] = "D";
$terminal['location'] = array_search($tmp, $this->config->departments);
- $terminal['message'] = _("Workstation template for");
+ $terminal['message'] = _("Workstation template for")." '".$dn_name."' ";
}
if (isset($value["FAIstate"][0])){
$terminal['type']= $this->getState($terminal['type'], $value["FAIstate"][0]);
}
if (isset($value["FAIstate"][0])){
$terminal['type']= $this->getState($terminal['type'], $value["FAIstate"][0]);