From: hickert Date: Thu, 27 Apr 2006 05:47:41 +0000 (+0000) Subject: Added div list class for systemManagement. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c490550eadfb5812b87f69097dce272f4d98bae3;p=gosa.git Added div list class for systemManagement. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3133 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/systems/class_divListSystem.inc b/plugins/admin/systems/class_divListSystem.inc new file mode 100644 index 000000000..5f4bbd950 --- /dev/null +++ b/plugins/admin/systems/class_divListSystem.inc @@ -0,0 +1,247 @@ +parent = $parent; + $this->ui = get_userinfo(); + + /* Set default base */ + if(!isset($_SESSION['CurrentMainBase'])){ + $_SESSION['CurrentMainBase'] = $this->config->current['BASE']; + } + $this->selectedBase = $_SESSION['CurrentMainBase']; + + /* Set list strings */ + $this->SetTitle(_("List of systems")); + $this->SetSummary(_("List of systems")); + + /* Result page will look like a headpage */ + $this->SetHeadpageMode(); + $this->SetInformation(_("This menu allows you to add, remove and change the properties of specific systems. You can only add systems which have already been started once.")); + + $this->EnableAplhabet (true); + + /* Disable buttonsm */ + $this->EnableCloseButton(false); + $this->EnableSaveButton (false); + + /* set Page header */ + $this->AddHeader(array("string"=>" ","attach"=>"style='width:20px;'")); + $this->AddHeader(array("string"=>_("System / Department"))); + $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:60px;border-right:0px;'")); + + /* Text ,Value ,Name ,Is selected */ + $this->AddCheckBox("ShowServers", _("Select to see servers"), _("Show servers"), true); + $this->AddCheckBox("ShowTerminals", _("Select to see Linux terminals"), _("Show terminals") , true); + $this->AddCheckBox("ShowWorkstations", _("Select to see Linux workstations"), _("Show workstations"), true); + $this->AddCheckBox("ShowWinWorkstations", _("Select to see MicroSoft Windows based workstations"), _("Show windows based workstations"),true); + $this->AddCheckBox("ShowPrinters", _("Select to see network printers"), _("Show network printers") ,true); + $this->AddCheckBox("ShowPhones", _("Select to see VOIP phones"), _("Show phones") , true); + $this->AddCheckBox("ShowDevices", _("Select to see network devices"), _("Show network devices"), true); + + /* Name ,Text ,Default , Connect with alphabet */ + $this->AddRegex ("Regex", _("Display systems matching"),"*" , true); + $this->AddRegex ("UserRegex", _("Display systems of user"), "*" , false); + } + + function GenHeader() + { + /* Prepare departments, + which are shown in the listbox on top of the listbox + */ + $options= ""; + foreach ($this->config->idepartments as $key => $value){ + if ($this->selectedBase == $key){ + $options.= ""; + } else { + $options.= ""; + } + } + $listhead = "
". + "  ". + "  ". + "  ". + "  ". + "  ". + " ". + " ". + " ". + " ". + " ". + " ". + "  "._("Base")." ". + " ". + "  ". + "
"; + $this->SetListHeader($listhead); + } + + function execute() + { + $this->ClearElementsList(); + $this->GenHeader(); + $this->AddDepartments($this->selectedBase); + } + + function setEntries($terminals) + { + $img1 = "C"; + $img2 = "L"; + $img3 = "L"; + $img4 = "M"; + $img5 = "I"; + $img6 = "F"; + $img7 = "K"; + $img8 = "A"; + $img9 = "F"; + $img10 = "L"; + + $empty =" "; + $action= ""; + $action.= ""; + + // User and Template Images + $editlink = "%s"; + + // Test Every Entry and generate divlist Array + foreach($terminals as $key => $val){ + + /* Generate picture list, which is currently disabled */ + if(in_array("goCupsServer" ,$val['objectClass'])) $cups = $img1; else $cups =$empty; + if(in_array("goLogDBServer" ,$val['objectClass'])) $logdb = $img2; else $logdb =$empty; + if(in_array("goSyslogServer" ,$val['objectClass'])) $syslog = $img3; else $syslog=$empty; + if(in_array("goImapServer" ,$val['objectClass'])) $imap = $img4; else $imap =$empty; + if(in_array("sambaSamAccount" ,$val['objectClass'])) $samba = $img5; else $samba =$empty; + if(in_array("goShareServer" ,$val['objectClass'])) $nfs = $img6; else $nfs =$empty; + if(in_array("goKrbServer" ,$val['objectClass'])) $krb = $img7; else $krb =$empty; + if(in_array("goFonServer" ,$val['objectClass'])) $fon = $img8; else $fon =$empty; + if(in_array("goFaxServer" ,$val['objectClass'])) $fax = $img9; else $fax =$empty; + if(in_array("goLdapServer" ,$val['objectClass'])) $ldap = $img10; else $ldap =$empty; + + $pics = $cups.$logdb.$syslog.$imap.$samba.$nfs.$krb.$fon.$fax.$ldap; + $pics = ""; // Pictures currently hidden + + $val['cn'][0]= preg_replace('/\$$/', '', $val['cn'][0]); + + // Generate Array to Add + if((isset($val['is_new']))&&(!empty($val['is_new']))){ + $display= "".$val["cn"][0]." ".$val['is_new']; + }else{ + $display= "".$val["cn"][0].""; + } + + if((in_array("gotoTerminal",$val['objectClass']))||(in_array("gotoWorkstation",$val['objectClass']))){ + $action2 = ""; + }else{ + $action2 = ""; + } + + if(isset($val['message'])){ + $display.= " (".$val['message']." '".$this->config->idepartments[$_SESSION['CurrentMainBase']]."' )"; + } + + $img = $this->parent->convert_list($val); + $field1 = array("string" => sprintf($img['img'],$val['dn']), "attach" => "style='text-align:center;width:20px;'"); + $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".@LDAP::fix($val['dn'])."'"); + $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action2.$action), "attach" => "style='width:60px;border-right:0px;text-align:right;'"); + $this->AddElement( array($field1,$field2,$field3)); + } + + } + + function Save() + { + MultiSelectWindow :: Save(); + } + + function save_object() + { + /* Save automatic created POSTs like regex, checkboxes */ + MultiSelectWindow::save_object(); + + $s_action =""; + foreach($_POST as $key => $value){ + if(preg_match("/^dep_back.*/i",$key)){ + $s_action="back"; + }elseif(preg_match("/^dep_root.*/",$key)){ + $s_action="root"; + }elseif(preg_match("/^dep_home.*/i",$key)){ + $s_action="home"; + } + } + + /* Save base selection from headpage selectbox*/ + if(isset($_POST['CurrentMainBase'])){ + $this->selectedBase = $_POST['CurrentMainBase']; + } + + /* Homebutton is posted */ + if($s_action=="home"){ + $ui= get_userinfo(); + $this->selectedBase=(preg_replace("/^[^,]+,/","",$ui->dn)); + $this->selectedBase=(preg_replace("/^[^,]+,/","",$this->selectedBase)); + } + + /* Open selected department + this is posted by the parent class MultiSelectWindow */ + if(isset($_GET['act'])&& ($_GET['act'] == "dep_open")){ + $s_entry = base64_decode($_GET['dep_id']); + $this->selectedBase = $this->config->departments[trim($s_entry)]; + } + + /* back to the roots ^^ */ + if($s_action=="root"){ + $this->selectedBase=($this->config->current['BASE']); + } + + /* If Backbutton is Posted */ + if($s_action=="back"){ + $base_back = preg_replace("/^[^,]+,/","",$this->selectedBase); + $base_back = convert_department_dn($base_back); + if(isset($this->config->departments[trim($base_back)])){ + $this->selectedBase= $this->config->departments[trim($base_back)]; + }else{ + $this->selectedBase= $this->config->departments["/"]; + } + } + + $_SESSION['CurrentMainBase'] = $this->selectedBase; + } +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?>