diff --git a/gosa-plugins/systems/admin/systems/class_systemManagement.inc b/gosa-plugins/systems/admin/systems/class_systemManagement.inc
index 4db6240098d6528c55a4e4968f6ae2bd7d940bdd..844e9f629ef24a9ed2fa44844db9291c63700453 100644 (file)
********************/
if ($s_action=="gen_cd"){
$this->dn= $this->terminals[$s_entry]['dn'];
- session::set('objectinfo',$this->dn);
- return ($smarty->fetch(get_template_path('gencd.tpl', TRUE)));
+ set_object_info($this->dn);
+ return ($smarty->fetch(get_template_path('goto/gencd.tpl', TRUE)));
}
/* Start CD-Creation */
if ((isset($_POST["cd_create"])) && !empty($this->dn)){
$smarty->assign("src", "?plug=".$_GET['plug']."&PerformIsoCreation");
- return ($smarty->fetch(get_template_path('gencd_frame.tpl', TRUE)));
+ return ($smarty->fetch(get_template_path('goto/gencd_frame.tpl', TRUE)));
}
If no object group was selected, then we keep the "edit" dialog of
the target system opened to allow to edit the objects attributes.
*/
-
+
+ if($this->systab instanceOf ArpNewDeviceTabs &&
+ isset($_POST['edit_finish']) &&
+ isset($_POST['gotoIntegration'])){
+
+ $this->systab->save_object();
+
+ if($this->systab->by_object['ArpNewDevice']->gotoIntegration){
+
+ /* Check tabs, will feed message array */
+ $message = $this->systab->check();
+ if(count($message)){
+ msg_dialog::displayChecks($message);
+ }else{
+ $s_action = "SelectedSystemType";
+ $this->systab->save();
+ $this->systab = null;
+ unset($_POST['edit_finish']);
+ }
+ }
+ }
+
if($s_action == "SelectedSystemType"){
/* Possible destination system types
/* Remember dialog selection.
*/
- $selected_group = $_POST['ObjectGroup'];
+
+ $selected_group = "none";
+ if(isset($_POST['ObjectGroup'])){
+ $selected_group = $_POST['ObjectGroup'];
+ }
$selected_system = $_POST['SystemType'];
$this->systab = NULL;
/* We are allowed to create the requested system type */
if(preg_match("/c/",$tabacl)){
- $this->systab= new $tabclass($this->config, $this->config->data['TABS'][$class], $this->dn,$selected_system);
+ $this->systab= new $tabclass($this->config, $this->config->data['TABS'][$class], $this->dn, $selected_system);
$this->systab->set_acl_base($this->DivListSystem->selectedBase);
- $this->systab->by_object[$tabname]->base = $this->DivListSystem->selectedBase;
- $this->systab->base = $this->DivListSystem->selectedBase;
+ if($selected_group != "none"){
+ $this->systab->base = preg_replace("/^[^,]+,".get_ou('ogroupRDN')."/", "", $selected_group);
+ $this->systab->by_object[$tabname]->base = $this->systab->base;
+ } else {
+ $this->systab->by_object[$tabname]->base = $this->DivListSystem->selectedBase;
+ $this->systab->base = $this->DivListSystem->selectedBase;
+ }
/* This will be used when the object is saved, to set FAIstate to 'install'
and to preset maybe other attributes.
*/
$this->systab->was_activated = TRUE;
+ /* Assign some default values for opsi hosts
+ */
+ if($this->systab instanceOf opsi_tabs){
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cat($dn);
+ $source_attrs = $ldap->fetch();
+ foreach(array("macAddress" => "mac" ,"cn" => "hostId","description" => "description") as $src => $attr){
+ if(isset($source_attrs[$src][0])){
+ $this->systab->by_object['opsiGeneric']->$attr = $source_attrs[$src][0];
+ }
+ }
+ }
+
if($selected_group != "none"){
/*******
/* Check locking, save current plugin in 'back_plugin', so
the dialog knows where to return. */
if (($user= get_lock($this->dn)) != ""){
- return(gen_locked_message ($user, $this->dn));
+ return(gen_locked_message ($user, $this->dn,TRUE));
}
/* Find out more about the object type */
if(!class_available("ArpNewDeviceTabs")){
msg_dialog::display(_("Error"), msgPool::class_not_found("ArpNewDevice"), ERROR_DIALOG);
}else{
+ add_lock ($this->dn, $this->ui->dn);
+ $this->system_activation_object= array($this->dn);
$this->systab = new ArpNewDeviceTabs($this->config,$this->config->data['TABS']['ARPNEWDEVICETABS'],$this->dn);
}
}elseif($type == "NewDevice"){
if(!class_available("SelectDeviceType")){
msg_dialog::display(_("Error"), msgPool::class_not_found("SelectDeviceType"), ERROR_DIALOG);
}else{
+ add_lock ($this->dn, $this->ui->dn);
$this->system_activation_object= array($this->dn);
$this->systab = new SelectDeviceType($this->config,$this->dn) ;
if(!class_available($tabclass)){
msg_dialog::display(_("Error"), msgPool::class_not_found($tabclass), ERROR_DIALOG);
}else{
+ add_lock ($this->dn, $this->ui->dn);
$this->systab= new $tabclass($this->config, $this->config->data['TABS'][$class], $this->dn,$acl_cat);
$this->systab->set_acl_base($this->dn);
- session::set('objectinfo',$this->dn);
- add_lock ($this->dn, $this->ui->dn);
+ set_object_info($this->dn);
}
}else{
msg_dialog::display(_("Error"), _("Editing this type of object is not supported yet!"), ERROR_DIALOG);
$tabacl = $ui->get_permissions($dn,$acl,"userPassword");
if(preg_match("/w/",$tabacl)){
$this->dn= $this->terminals[$s_entry]['dn'];
- session::set('objectinfo',$this->dn);
+ set_object_info($this->dn);
return ($smarty->fetch(get_template_path('password.tpl', TRUE)));
}else{
msg_dialog::display(_("Permission error"), _("You have no permission to change this password!"), ERROR_DIALOG);
if(!empty($type) && in_array($type,$allow_for)){
/* Get infos */
- $plug = $tabs[$type]["PLUG"];
- $class = $tabs[$type]["CLASS"];
+ $plug = $tabs[$type]["TABNAME"];
$acl = $tabs[$type]["ACL"];
$tabclass = $tabs[$type]["TABCLASS"];
-
+
/* Get acls */
$ui = get_userinfo();
$tabacl = $ui->get_permissions($this->dn,$acl,"userPassword");
if (!$ldap->success()){
msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, $type));
}else{
- if(class_available($plug)){
+ if(class_available($plug)){
$p = new $plug($this->config,$this->dn);
$p->handle_post_events("modify");
}
}else{
msg_dialog::display(_("Error"), _("Cannot determine object to change password!"), ERROR_DIALOG);
}
- session::un_set('objectinfo');
+ set_object_info();
}
/* Delete terminal canceled? */
if (isset($_POST['delete_cancel']) || isset($_POST['password_cancel'])){
$this->remove_lock();
- session::un_set('objectinfo');
+ set_object_info();
}
$dns_names = array();
foreach($this->dns as $dn){
add_lock ($dn, $this->ui->dn);
- $dns_names[] = @LDAP::fix($dn);
+ $dns_names[] = LDAP::fix($dn);
}
/* Lock the current entry, so nobody will edit it during deletion */
$this->systab->save();
/* Post handling for activated systems
+ target opsi -> Remove source.
+ target gosa -> Activate system.
*/
- if($this->systab->was_activated){
+ if($this->systab instanceOf opsi_tabs){
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->rmdir ($this->systab->dn);
+ @DEBUG(DEBUG_LDAP,__LINE__, __FUNCTION__, __FILE__,"Source removed: ".$this->systab->dn,"Opsi host activated.");
+
+ $hostId = $this->systab->by_object['opsiGeneric']->hostId;
+ $mac = $this->systab->by_object['opsiGeneric']->mac;
+ $this->opsi->job_opsi_activate_client($hostId,$mac);
+
+ }elseif(isset($this->systab->was_activated) && $this->systab->was_activated){
$this->activate_new_device($this->systab->dn);
}
unset ($this->systab);
$this->systab= NULL;
- session::un_set('objectinfo');
+ set_object_info();
}else{
/* Reinitialize tab */
unset ($this->systab);
}
$this->systab= NULL;
- session::un_set('objectinfo');
+ set_object_info();
}
/********************
/* Show tab dialog if object is present */
if (isset($this->systab->config)){
+
+ if($this->systab instanceOf plugin && !($this->systab instanceOf tabs)){
+ $this->systab->save_object();
+ }
+
$display= $this->systab->execute();
/* Don't show buttons if tab dialog requests this */
$dialog = FALSE;
$hide_apply = $this->dn == "new";
- $hide_apply = ($this->dn == "new") || (preg_match("/".normalizePreg(get_ou("systemIncomingRDN"))."/",$this->dn));
+ $hide_apply = ($this->dn == "new") || (preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/",$this->dn));
if(is_object($this->systab) && !isset($this->systab->by_object)){
$dialog = TRUE;
$hide_apply = TRUE;
$dialog = TRUE;
}
- if (!$dialog){
+ if(($this->systab instanceOf tabs || $this->systab instanceOf plugin) && $this->systab->read_only == TRUE){
+ $display.= "<p style=\"text-align:right\">
+ <input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">
+ </p>";
+ }elseif (!$dialog){
$display.= "<p style=\"text-align:right\">\n";
$display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\"".msgPool::okButton()."\">\n";
$display.= " \n";
/* Attributes to fetch */
$sys_attrs = array("cn", "description", "macAddress", "objectClass", "sambaDomainName","gotoMode","FAIclass");
- $sys_categories = array("terminal", "workstation", "server", "phone" ,"printer","incoming","winworkstation");
+ $sys_categories = array("terminal", "workstation", "server", "phone" ,"printer","incoming","winworkstation","component");
/* Add FAIstate to attributes if FAI is activated */
$tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
$res = array_merge($res,get_list($filter,$sys_categories, get_ou('systemIncomingRDN').$base,$sys_attrs, GL_SIZELIMIT));
/* Append opsi systems, the opsi extension have to installed.
- (Only, if we are allowed to view opsi hosts)
+ (Only, if we are allowed to view opsi hosts and if we're on the ldap root)
*/
- if($this->opsi instanceof opsi && $this->opsi->enabled() && $this->DivListSystem->ShowOpsiHosts){
+ if($this->DivListSystem->selectedBase == $this->config->current['BASE'] &&
+ $this->opsi instanceof opsi &&
+ $this->opsi->enabled() &&
+ $this->DivListSystem->ShowOpsiHosts){
$o_acl = $this->ui->get_permissions($base,"opsi/opsiGeneric","");
if(preg_match("/r/",$o_acl)){
$opsi_clients = $this->opsi->get_hosts_for_system_management();
}
/* Create a string containing the last part of the department. */
- $dn_name = preg_replace("#^([^/]+/)*#","",convert_department_dn(@LDAP::fix($tmp)));
+ $dn_name = preg_replace("#^([^/]+/)*#","",convert_department_dn(LDAP::fix($tmp)));
if(empty($dn_name)){
$dn_name = "/";
}
If there is a samba host, then merge it with the opsi host,
to avoid duplicate entries.
*/
+ $oRex = preg_replace("/\*/",".*",$this->DivListSystem->Regex);
foreach($opsi_clients as $entry){
- if(isset($opsi_map[$entry['cn'][0]])){
+ if(isset($opsi_map[$entry['cn'][0]]) || !preg_match("/".($oRex)."/", $entry['cn'][0])){
continue;
}
$terminal = $entry;
function remove_lock()
{
- if (isset($this->systab->dn)){
- del_lock ($this->systab->dn);
- }
+
if(isset($this->dn) && !empty($this->dn) && $this->dn != "new"){
del_lock($this->dn);
+ }elseif (isset($this->systab->dn)){
+ del_lock ($this->systab->dn);
}
if(isset($this->dns) && is_array($this->dns) && count($this->dns)){
del_lock($this->dns);
"C" => array("plugins/systems/images/select_component.png",_("Network device")),
"P" => array("plugins/systems/images/select_printer.png",_("Printer")),
- "W" => array("plugins/systems/images/select_winstation.png",_("Win workstation")),
+ "W" => array("plugins/systems/images/select_winstation.png",_("Windows workstation")),
"L" => array("plugins/systems/images/select_workstation.png",_("Workstation")),
"S" => array("plugins/systems/images/select_server.png",_("Server")),