summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 48e3ea5)
raw | patch | inline | side by side (parent: 48e3ea5)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 9 Feb 2006 08:15:32 +0000 (08:15 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 9 Feb 2006 08:15:32 +0000 (08:15 +0000) |
DNS remove_from_parent fixed
Object removement fixed, wrong tab initialisation
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2643 594d385d-05f5-0310-b6e9-bd551577e9d8
Object removement fixed, wrong tab initialisation
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2643 594d385d-05f5-0310-b6e9-bd551577e9d8
14 files changed:
diff --git a/plugins/admin/systems/SelectDeviceType.tpl b/plugins/admin/systems/SelectDeviceType.tpl
--- /dev/null
@@ -0,0 +1,46 @@
+<br>
+<p class="seperator">
+{t}This is a new system which currently has no system type defined. Please choose a system type for this entry, the depending dialog will be shown if you press 'save'. If this system should be added to an objectGroup, specify the objectgroup name and this system will be added automatically.{/t}
+<br>
+<br>
+</p>
+<p class="seperator">
+<br>
+<b>{t}Please select a system type and if prefered select a object group too.{/t}</b>
+<br>
+<br>
+</p>
+<br>
+<table summary="" style='width:100%'>
+ <tr>
+ <td style='width:49%'>
+ <table summary="">
+ <tr>
+ <td>
+ {t}System type{/t}
+ <select name="SystemType" title="{t}Choose a system type{/t}" style="width:120px;">
+ {html_options values=$SystemTypeKeys output=$SystemTypes selected=$SystemType}
+ </select>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table summary="">
+ <tr>
+ <td>
+ {t}Membership in following objectGroups{/t}
+ <select name="ObjectGroup" title="{t}Choose a object group{/t}" style="width:120px;">
+ {html_options values=$ObjectGroupKeys output=$ObjectGroups selected=$ObjectGroup}
+ </select>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+<p class="seperator"> </p>
+<div style="align: right;" align="right"><p>
+ <input type="submit" name="SystemTypeChoosen" value="{t}Use{/t}">
+ <input type="submit" name="SystemTypeAborted" value="{t}Cancel{/t}">
+</p></div>
diff --git a/plugins/admin/systems/class_SelectDeviceType.inc b/plugins/admin/systems/class_SelectDeviceType.inc
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+
+class SelectDeviceType extends plugin
+{
+ /* CLI vars */
+ var $cli_summary= "Manage server basic objects";
+ var $cli_description= "Some longer text\nfor help";
+ var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+ /* attribute list for save action */
+ var $ignore_account= TRUE;
+ var $attributes= array("ObjectGroup","SystemType");
+ var $objectclasses= array("whatever");
+
+ var $ObjectGroups = array();
+ var $SystemTypes = array();
+
+ var $ObjectGroup = "";
+ var $SystemType = "";
+
+ function SelectDeviceType ($config, $dn= NULL)
+ {
+ plugin::plugin ($config, $dn);
+
+ /* Get object groups */
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd ($this->config->current['BASE']);
+ $ldap->search("(&(objectClass=gosaGroupOfNames)(cn=*))",array("cn"));
+ $this->ObjectGroups['none']=_("none");
+ while($attrs = $ldap->fetch()){
+ $this->ObjectGroups[$attrs['dn']]= $attrs['cn'][0];
+ }
+
+ $this->SystemTypes =array("server"=>_("Server"),"workstation"=>_("Workstation"),"terminal"=>_("Terminal"));
+ }
+
+ function execute()
+ {
+ /* Call parent execute */
+ plugin::execute();
+
+ /* Fill templating stuff */
+ $smarty= get_smarty();
+ $display= "";
+
+ $smarty->assign("ObjectGroups" ,$this->ObjectGroups);
+ $smarty->assign("ObjectGroupKeys" ,array_flip($this->ObjectGroups));
+ $smarty->assign("SystemTypes" ,$this->SystemTypes);
+ $smarty->assign("SystemTypeKeys" ,array_flip($this->SystemTypes));
+
+ $smarty->assign("ObjectGroup",$this->ObjectGroup);
+ $smarty->assign("SystemType",$this->SystemType);
+
+ $display.= $smarty->fetch(get_template_path('SelectDeviceType.tpl', TRUE));
+ return($display);
+ }
+
+ /* Save data to object */
+ function save_object()
+ {
+ plugin::save_object();
+ foreach($this->attributes as $attr){
+ if(isset($_POST[$attr])){
+ $this->$attr = $_POST[$attr];
+ }
+ }
+ }
+
+ /* Check supplied data */
+ function check()
+ {
+ $message= array();
+
+ return ($message);
+ }
+
+ /* Save to LDAP */
+ function save()
+ {
+ }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/class_componentGeneric.inc b/plugins/admin/systems/class_componentGeneric.inc
index 164b4aa7cd10683407f23e14d2560549414090db..9650956cb2935318d9481d2b1b1203a6ebe2f80f 100644 (file)
function remove_from_parent()
{
$ldap= $this->config->get_ldap_link();
+ $this->netConfigDNS->remove_from_parent();
$ldap->rmdir($this->dn);
show_ldap_error($ldap->get_error());
$this->handle_post_events("remove");
unset($og->member[$this->dn]);
$og->save ();
}
- $this->netConfigDNS->remove_from_parent();
}
$this->handle_post_events("modify");
}
+ $this->netConfigDNS->cn = $this->cn;
$this->netConfigDNS->save($this->dn);
show_ldap_error($ldap->get_error());
diff --git a/plugins/admin/systems/class_phoneGeneric.inc b/plugins/admin/systems/class_phoneGeneric.inc
index 97325ea6709d5f071d8cbde8dea27c19b85f8467..86696b0b9b12c020d4006746fb4dc3b668cfcd5f 100644 (file)
return;
}
+ $this->netConfigDNS->remove_from_parent();
$ldap->rmdir($this->dn);
show_ldap_error($ldap->get_error());
$this->handle_post_events("remove");
unset($og->member[$this->dn]);
$og->save ();
}
- $this->netConfigDNS->remove_from_parent();
}
}
$this->handle_post_events("modify");
}
-
+ $this->netConfigDNS->cn = $this->cn;
$this->netConfigDNS->save($this->dn);
show_ldap_error($ldap->get_error());
diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc
index c5717286fdf41c59e55c08d9920e93ebdc680061..9fe83499302db8fa79e847d05b3242de7c9958ba 100644 (file)
$ldap->cat($this->dn);
if(count($ldap->fetch()) ){
+ $this->netConfigDNS->remove_from_parent();
$ldap->rmdir($this->dn);
show_ldap_error($ldap->get_error());
$this->handle_post_events("remove");
unset($og->member[$this->dn]);
$og->save ();
}
-
- $this->netConfigDNS->remove_from_parent();
}
}
}
}
show_ldap_error($ldap->get_error());
+ $this->netConfigDNS->cn = $this->cn;
$this->netConfigDNS->save($this->dn);
/* Optionally execute a command after we're done */
index 6039a29bb9557f9090b251e64208bb1cd5ee833e..086dc952417c7e2199649122130cb4c9dc569f50 100644 (file)
var $dialog = NULL;
var $usedDNS = array();
+
+ var $orig_dn = "";
+
+ var $DNSinitially_was_account;
+
+
function servdns ($config, $dn= NULL)
{
plugin::plugin ($config, $dn);
+ $this->orig_dn = $dn;
+
/* All types with required attrs */
$this->RecordTypes['aRecord'] = "aRecord"; // ok
$this->RecordTypes['mDRecord'] = "mDRecord"; // ok
$this->RecordTypes['rRSIGRecord'] = "rRSIGRecord"; // ok
$this->RecordTypes['nSECRecord'] = "nSECRecord"; // ok
- $this->cn = $this->attrs['cn'][0];
$types = array();
/* Get all records */
$ldap->search("(&(objectClass=dNSZone)(relativeDomainName=@))",array("*"));
while($attrs = $ldap->fetch()){
- /* If relative domainname == cn
+ /* If relative domainname
* Try to read dnsclass / TTl / zone
*/
$this->usedDNS[$attrs['dn']] = $attrs['dn'];
/* Remove dns service */
function remove_from_parent()
{
+ if(!$this->DNSinitially_was_account){
+ return;
+ }
+
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
foreach($this->usedDNS as $dn){
$ldap->cd($dn);
$ldap->rmdir_recursive($dn);
}
+
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->orig_dn);
+ $ldap->search("(&(objectClass=dNSZone)(zoneName=*)(relativeDomainName=@))",array("relativeDomainName","zoneName"));
+ while($attr = $ldap->fetch()){
+ $ldap->cd($attr['dn']);
+ $ldap->rmDir($attr['dn']);
+ }
+
+
show_ldap_error($ldap->get_error());
}
diff --git a/plugins/admin/systems/class_servGeneric.inc b/plugins/admin/systems/class_servGeneric.inc
index 0c7c0d99e1ab6dc1619639032ec911d159a57ac6..883c3989ded756b89a570b92eb9f9f944c5d65ac 100644 (file)
function remove_from_parent()
{
+ $this->netConfigDNS->remove_from_parent();
$ldap= $this->config->get_ldap_link();
$ldap->rmdir($this->dn);
show_ldap_error($ldap->get_error());
unset($og->member[$this->dn]);
$og->save ();
}
- $this->netConfigDNS->remove_from_parent();
$this->handle_post_events("remove");
}
if ($ldap->count() != 0){
while ($attrs= $ldap->fetch()){
if ($attrs['dn'] != $this->orig_dn){
+ if(!preg_match("/,ou=incoming,/",$attrs['dn'])){
$message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
break;
+ }
}
}
}
$ldap->modify($this->attrs);
$mode= "modify";
}
+ $this->netConfigDNS->cn = $this->cn;
$this->netConfigDNS->save($this->dn);
show_ldap_error($ldap->get_error());
index 434ffa93f67ec5d9c0cfb13c768667921142b4b0..f3bd4ef46e876abd7f0458484dc8c174282ecf63 100644 (file)
/* Only modify kolabHost */
$hosts= array();
foreach ($this->kolabHost as $host){
- if ($host != $this->cn){
+
+ if (isset($this->cn)&&($host != $this->cn)){
$hosts[]= $host;
}
}
diff --git a/plugins/admin/systems/class_systemManagement.inc b/plugins/admin/systems/class_systemManagement.inc
index dd5a89608449e52a3d650058de7d515987908b3f..7471c95d70ddd2d437154ac01cbf249ec43d9e91 100644 (file)
/* Get global filter config */
if (!is_global("terminalfilter")){
- $ui= get_userinfo();
- $base= get_base_from_people($ui->dn);
+ $ui = get_userinfo();
+ $base = get_base_from_people($ui->dn);
$terminalfilter= array("workstations" => "checked",
"thins" => "checked",
"winstations" => "checked",
function execute()
{
- /* Call parent execute */
- plugin::execute();
+ /* Call parent execute */
+ plugin::execute();
- /* Save data */
+ /********************
+ Filter handling, check posted filter options and store them in our Session obejct
+ ********************/
+
+ /* Save posted filter data */
$terminalfilter= get_global("terminalfilter");
foreach( array("depselect", "user", "regex") as $type){
if (isset($_POST[$type])){
$terminalfilter[$type]= $_POST[$type];
}
}
+
+ /* Check if filter checkboxes are selected */
if (isset($_POST['depselect'])){
foreach( array("workstations", "thins", "winstations", "printers", "phones", "servers", "netdev") as $type){
-
if (isset($_POST[$type])) {
$terminalfilter[$type]= "checked";
} else {
}
}
}
+
+ /* Check for search post */
if (isset($_GET['search'])){
$s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
if ($s == "**"){
$terminalfilter['regex']= $s;
}
+
+ /********************
+ Check for functional posts, edit|delete|add|... system devices
+ ********************/
$s_action = ""; // Contains the action to proceed
$s_entry = ""; // The value for s_action
$base_back = ""; // The Link for Backbutton
$smarty = get_smarty();
- /* Start for New List Managment */
+ /* check if base was changed */
if(isset($_GET['act'])&&($_GET['act']=="dep_open")){
$s_action="open";
$s_entry = base64_decode($_GET['dep_id']);
}
}
- if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
- $s_action ="edit";
- $s_entry = $_GET['id'];
+ /* 09.02.2006 : New incoming handling ; hickert
+ * If someone made a systemtype and ogroup selection
+ * Display the new requested entry type ... servtab in case of server and so on.
+ */
+ if(isset($_POST['SystemTypeChoosen'])){
+ $s_action = "SelectedSystemType";
+ $s_entry = $_POST['SystemType'];
+ $this->systab = NULL;
}
+ /* remove image tags from posted entry (posts looks like this 'name_x')*/
$s_entry = preg_replace("/_.$/","",$s_entry);
+ /* Edit was requested by pressing the name(link) of an item */
+ if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+ $s_action ="edit";
+ $s_entry = $_GET['id'];
+ }
+
/* Department changed? */
if(isset($_POST['depselect']) && $_POST['depselect']){
$terminalfilter['depselect']= $_POST['depselect'];
$terminalfilter['depselect']=(preg_replace("/^[^,]+,/","",$terminalfilter['depselect']));
}
+ /* back to the roots ^^ */
if($s_action=="root"){
$terminalfilter['depselect']=($this->config->current['BASE']);
}
-
/* If Backbutton is Posted */
if($s_action=="back"){
$base_back = preg_replace("/^[^,]+,/","",$terminalfilter['depselect']);
}
}
+ /* Save Termfilter .... */
register_global("terminalfilter", $terminalfilter);
$this->reload();
-
+
/* Check for exeeded sizelimit */
if (($message= check_sizelimit()) != ""){
return($message);
return ($smarty->fetch(get_template_path('chooser.tpl', TRUE)));
}
- /* Create new default terminal */
- if (isset($_POST['create_system'])||$s_action=="newsystem") {
- $this->dn= "new";
- $this->acl= array(":all");
-
- if(isset($_POST['system'])){
- $sw = $_POST['system'];
+ /********************
+ Create new system ...
+ ********************/
+ /* Create new default terminal
+ *
+ * 09.02.2006 ; New incoming handling ; hickert
+ * Or create specified object of selected system type, from given incoming object
+ */
+ if (isset($_POST['create_system'])||$s_action=="newsystem"||$s_action == "SelectedSystemType") {
+
+ /* If the current entry is an incoming object
+ * $sw = System type as posted in new incoming handling dialog
+ */
+ if($s_action == "SelectedSystemType") {
+ $sw = $s_entry;
+ $dn_backup = $this->dn;
}else{
- $sw = $s_entry;
+ if(isset($_POST['system'])){
+ $sw = $_POST['system'];
+ }else{
+ $sw = $s_entry;
+ }
}
+ $this->dn= "new";
+ $this->acl= array(":all");
+
switch ($sw){
case 'terminal':
$this->systab= new termtabs($this->config,
$this->systab->by_object['componentgeneric']->base = $_SESSION['terminalfilter']['depselect'];
break;
}
-
+
+ /* 09.02.2006 ; New incoming handling ; hickert.
+ * We must create a NEW object of given system type (Posted from SelectDeviceType).
+ * But we have to use the same attributes as used in incoming object, thats
+ * what we do here.
+ */
+ if($s_action == "SelectedSystemType"){
+
+ /* Store some informations, to be able to add this object to
+ * To specified objectgroup and delete incoming object
+ */
+ $_SESSION['SelectedSystemType']['dn'] = $this->dn;
+ $_SESSION['SelectedSystemType']['server'] = $s_entry;
+ $_SESSION['SelectedSystemType']['ogroup'] = $_POST['ObjectGroup'];
+
+ /* restore dn */
+ $this->dn = $dn_backup;
+
+ /* Get properties from incoming object */
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->dn);
+ $ldap->cat($this->dn);
+ $res = $ldap->fetch();
+
+ /* Unset not needed attributes */
+ unset($res['dn']);
+ unset($res['objectClass']);
+
+ /* Walk through all tabs and set attributes if available */
+ foreach($this->systab->by_object as $name => $value){
+ foreach($this->systab->by_object[$name]->attributes as $atr){
+ if((isset($value))&&(isset($res[$atr]))){
+ $this->systab->by_object[$name]->$atr = $res[$atr][0];
+ }
+ }
+ }
+ }
+
+ /* set base ... of current divlist position */
$this->systab->base = $_SESSION['terminalfilter']['depselect'];
}
+ /********************
+ Edit system ...
+ ********************/
+
/* User wants to edit data? */
if ($s_action == "edit"){
- /* Get 'dn' from posted 'cn', must be unique */
$this->dn= $this->terminals[$s_entry]['dn'];
/* Check locking, save current plugin in 'back_plugin', so
/* Lock the current entry, so everyone will get the
above dialog */
- add_lock ($this->dn, $this->ui->dn);
switch ($type){
+ case "NewDevice" :
+ $this->systab = new SelectDeviceType($this->config,$this->dn) ;
+ break;
case "terminal":
/* Register systab to trigger edit dialog */
$this->systab= new termtabs($this->config,
$this->config->data['TABS']['TERMTABS'], $this->dn);
- $this->systab->set_acl($acl);
- $_SESSION['objectinfo']= $this->dn;
- break;
+ $this->systab->set_acl($acl);
+ $_SESSION['objectinfo']= $this->dn;
+ add_lock ($this->dn, $this->ui->dn);
+ break;
case "server":
+
/* Register systab to trigger edit dialog */
- $this->systab= new servtabs($this->config,
- $this->config->data['TABS']['SERVTABS'], $this->dn);
- $this->systab->set_acl($acl);
- $_SESSION['objectinfo']= $this->dn;
- break;
+ $this->systab= new servtabs($this->config,$this->config->data['TABS']['SERVTABS'], $this->dn);
+ $this->systab->set_acl($acl);
+ $_SESSION['objectinfo']= $this->dn;
+ add_lock ($this->dn, $this->ui->dn);
+ break;
case "workstation":
/* Register systab to trigger edit dialog */
$this->systab= new worktabs($this->config,
$this->config->data['TABS']['WORKTABS'], $this->dn);
- $this->systab->set_acl($acl);
- $_SESSION['objectinfo']= $this->dn;
- break;
+ $this->systab->set_acl($acl);
+ $_SESSION['objectinfo']= $this->dn;
+ add_lock ($this->dn, $this->ui->dn);
+ break;
case "printer":
/* Register systab to trigger edit dialog */
$this->systab= new printtabs($this->config,
$this->config->data['TABS']['PRINTTABS'], $this->dn);
- $this->systab->set_acl($acl);
- $_SESSION['objectinfo']= $this->dn;
- break;
+ $this->systab->set_acl($acl);
+ $_SESSION['objectinfo']= $this->dn;
+ add_lock ($this->dn, $this->ui->dn);
+ break;
case "phone":
/* Register systab to trigger edit dialog */
$this->systab= new phonetabs($this->config,
$this->config->data['TABS']['PHONETABS'], $this->dn);
- $this->systab->set_acl($acl);
- $_SESSION['objectinfo']= $this->dn;
- break;
+ $this->systab->set_acl($acl);
+ $_SESSION['objectinfo']= $this->dn;
+ add_lock ($this->dn, $this->ui->dn);
+ break;
case "component":
/* Register systab to trigger edit dialog */
$this->systab= new componenttabs($this->config,
$this->config->data['TABS']['COMPONENTTABS'], $this->dn);
- $this->systab->set_acl($acl);
- $_SESSION['objectinfo']= $this->dn;
- break;
-
+ $this->systab->set_acl($acl);
+ $_SESSION['objectinfo']= $this->dn;
+ add_lock ($this->dn, $this->ui->dn);
+ break;
+
case "winstation":
/* Register systab to trigger edit dialog */
$this->systab= new wintabs($this->config,
$this->config->data['TABS']['WINTABS'], $this->dn);
- $this->systab->set_acl($acl);
- $_SESSION['objectinfo']= $this->dn;
- break;
+ $this->systab->set_acl($acl);
+ $_SESSION['objectinfo']= $this->dn;
+ add_lock ($this->dn, $this->ui->dn);
+ break;
default:
- print_red (_("You can't edit this object type yet!"));
- del_lock($this->dn);
- break;
+ print_red (_("You can't edit this object type yet!"));
+ del_lock($this->dn);
+ break;
}
}
+
+
+ /********************
+ Change password ...
+ ********************/
/* Set terminals root password */
if ($s_action=="change_pw"){
return ($smarty->fetch(get_template_path('password.tpl', TRUE)));
}
+
+ /********************
+ Password cahnge finish, but check if entered data is ok
+ ********************/
+
/* Correctly specified? */
if (isset($_POST['password_finish'])){
if ($_POST['new_password'] != $_POST['repeated_password']){
}
}
+ /********************
+ Password change finish
+ ********************/
+
/* Change terminal password */
if (isset($_POST['password_finish']) &&
$_POST['new_password'] == $_POST['repeated_password']){
unset($_SESSION['objectinfo']);
}
+
+ /********************
+ Delete system cancel
+ ********************/
+
/* Delete terminal canceled? */
if (isset($_POST['delete_cancel']) || isset($_POST['password_cancel'])){
del_lock ($this->dn);
unset($_SESSION['objectinfo']);
}
+
+ /********************
+ Delete system, confirm dialog
+ ********************/
+
/* Remove terminal was requested */
if ($s_action=="del"){
}
}
+
+ /********************
+ Delete system, confirmed
+ ********************/
/* Confirmation for deletion has been passed. Terminal should be deleted. */
if (isset($_POST['delete_terminal_confirm'])){
switch ($type){
case "terminal":
- $tabtype= "termtabs";
+ $tabtype = "termtabs";
+ $tabobj = "TERMTABS";
break;
case "workstation":
- $tabtype= "worktabs";
+ $tabtype = "worktabs";
+ $tabobj = "WORKTABS";
break;
-
+
case "phone":
- $tabtype= "phonetabs";
+ $tabtype = "phonetabs";
+ $tabobj = "PHONETABS";
break;
case "server":
- $tabtype= "servtabs";
+ $tabtype = "servtabs";
+ $tabobj = "SERVTABS";
break;
default:
-#print_red (_("You can't remove this object type yet!"));
-#del_lock($this->dn);
-#return;
- $tabtype= "termtabs";
+ $tabtype = "termtabs";
+ $tabobj = "TERMTABS";
break;
}
/* Delete request is permitted, perform LDAP action */
if($tabtype=="phonetabs"){
$this->systab= new $tabtype($this->config,
- $this->config->data['TABS']['PHONETABS'], $this->dn);
+ $this->config->data['TABS'][$tabobj], $this->dn);
$this->systab->set_acl(array($this->acl));
$this->systab->by_object['phonegeneric']->remove_from_parent ();
}else{
$this->systab= new $tabtype($this->config,
- $this->config->data['TABS']['TERMTABS'], $this->dn);
+ $this->config->data['TABS'][$tabobj], $this->dn);
$this->systab->set_acl(array($this->acl));
$this->systab->delete();
#$this->systab->by_object['termgeneric']->remove_from_parent ();
del_lock ($this->dn);
}
+
+ /********************
+ Edit system type finished, check if everything went ok
+ ********************/
/* Finish user edit is triggered by the tabulator dialog, so
the user wants to save edited data. Check and save at this
point. */
/* Terminal has been saved successfully, remove lock from
LDAP. */
+
+ /* 09.02.2006 Hickert
+ * New System incoming behavior; you can select a system type and an ogroup membership.
+ * If this object is an Incoming object, $_SESSION['SelectedSystemType'] isset.
+ * Check if we must add the new object to an object group.
+ * !! Don't forget to unset the $_SESSION['SelectedSystemType']... else all edited objects
+ * !! will be added to the object group.
+ *
+ * If this is done, delete the old incoming entry... it is still there, because this is a new
+ * entry and not an edited one.
+ */
+ if(isset($_SESSION['SelectedSystemType'])){
+ $SelectedSystemType= $_SESSION['SelectedSystemType'];
+ unset($_SESSION['SelectedSystemType']);
+ if($SelectedSystemType['ogroup'] != "none"){
+ $og = new ogroup($this->config,$SelectedSystemType['ogroup']);
+ if($og){
+ $og->AddDelMembership($this->systab->dn);
+ }
+ $og->save();
+ }
+ if(!isset($ldap)){
+ $ldap = $this->config->get_ldap_link();
+ }
+ $ldap->cd ($this->dn);
+ $ldap->cat($this->dn);
+ if(count($ldap->fetch())){
+ $ldap->cd($this->dn);
+ $ldap->rmDir($this->dn);
+ }
+ $ldap->cd($this->config->current['BASE']);
+ }
+
if ($this->dn != "new"){
del_lock ($this->dn);
}
}
+
+ /********************
+ Edit system was canceled
+ ********************/
/* Cancel dialogs */
- if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
+ if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel']) || isset($_POST['SystemTypeAborted'])){
if (isset($this->systab)){
del_lock ($this->systab->dn);
unset ($this->systab);
}
$this->systab= NULL;
unset($_SESSION['objectinfo']);
+
+ /* 09.02.2006 ; New incoming handling ; hickert
+ * remove session object which stores our ogroup selection
+ * for the new incoming handling
+ */
+ if(isset($_SESSION['SelectedSystemType'])){
+ unset($_SESSION['SelectedSystemType']);
+ }
}
+
+ /********************
+ Display edit dialog, or some other
+ ********************/
+
/* Show tab dialog if object is present */
if ($this->systab){
$display= $this->systab->execute();
+
/* Don't show buttons if tab dialog requests this */
- if (!$this->systab->by_object[$this->systab->current]->dialog){
+ if ((isset($this->systab->by_object))&&(!$this->systab->by_object[$this->systab->current]->dialog)){
$display.= "<p style=\"text-align:right\">\n";
$display.= "<input type=\"submit\" name=\"edit_finish\" value=\""._("Finish")."\">\n";
$display.= " \n";
}
-
-
-
-
- /* Prepare departments */
+ /********************
+ Entry handling finished (edit delete ... )
+ Now the list generation is the next part of this script.
+ ********************/
+
+ /* Prepare departments,
+ which are shown in the listbox on top of the listbox
+ */
$options= "";
foreach ($this->config->idepartments as $key => $value){
- if ($terminalfilter['depselect'] == $key){
- $options.= "<option selected='selected' value='$key'>$value</option>";
- } else {
- $options.= "<option value='$key'>$value</option>";
- }
+ if ($terminalfilter['depselect'] == $key){
+ $options.= "<option selected='selected' value='$key'>$value</option>";
+ } else {
+ $options.= "<option value='$key'>$value</option>";
+ }
}
- /* NEW LIST MANAGMENT */
+ /* NEW LIST MANAGMENT */
+
+ /* Create list header
+ */
$listhead = "<div style='background:#F0F0F9;padding:5px;'>".
- " <input class='center' type='image' align='middle' src='images/list_back.png' title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ".
- " <input class='center' type='image' src='images/list_root.png' align='middle' title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'> ".
- " <input class='center' type='image' align='middle' src='images/list_home.png' title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'> ".
+ " <input class='center' type='image' align='middle' src='images/list_back.png'
+ title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ".
+ " <input class='center' type='image' src='images/list_root.png' align='middle'
+ title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'> ".
+ " <input class='center' type='image' align='middle' src='images/list_home.png'
+ title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'> ".
" <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
- " <input class='center' type='image' align='middle' src='images/select_new_terminal.png' name='newsystem_terminal' alt='"._("New Terminal template")."' title='"._("New Terminal")."'>".
- " <input class='center' type='image' align='middle' src='images/select_new_workstation.png' name='newsystem_workstation' alt='"._("New Workstation template")."' title='"._("New Workstation")."'>".
- " <input class='center' type='image' align='middle' src='images/select_new_server.png' name='newsystem_server' alt='"._("New Server")."' title='"._("New Server")."'>".
- " <input class='center' type='image' align='middle' src='images/select_new_printer.png' name='newsystem_printer' alt='"._("New Printer")."' title='"._("New Printer")."'>".
- " <input class='center' type='image' align='middle' src='images/select_new_phone.png' name='newsystem_phone' alt='"._("New Phone")."' title='"._("New Phone")."'>".
- " <input class='center' type='image' align='middle' src='images/select_new_component.png' name='newsystem_component' alt='"._("New Component")."' title='"._("New Component")."'>".
- " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
- _("Base")." <select name='depselect' onChange='mainform.submit()' class='center'>$options</select>".
- " <input class='center' type='image' src='images/list_submit.png' align='middle' title='"._("Submit department")."' name='submit_department' alt='". _("Submit")."'> ".
+ " <input class='center' type='image' align='middle' src='images/select_new_terminal.png'
+ name='newsystem_terminal' alt='"._("New Terminal template")."' title='"._("New Terminal")."'>".
+ " <input class='center' type='image' align='middle' src='images/select_new_workstation.png'
+ name='newsystem_workstation' alt='"._("New Workstation template")."' title='"._("New Workstation")."'>".
+ " <input class='center' type='image' align='middle' src='images/select_new_server.png' name='newsystem_server' alt='"._("New Server")."'
+ title='"._("New Server")."'>".
+ " <input class='center' type='image' align='middle' src='images/select_new_printer.png' name='newsystem_printer' alt='"._("New Printer")."'
+ title='"._("New Printer")."'>".
+ " <input class='center' type='image' align='middle' src='images/select_new_phone.png' name='newsystem_phone' alt='"._("New Phone")."'
+ title='"._("New Phone")."'>".
+ " <input class='center' type='image' align='middle' src='images/select_new_component.png' name='newsystem_component' alt='"._("New Component")."'
+ title='"._("New Component")."'>".
+ " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> "._("Base")." ".
+ " <select name='depselect' onChange='mainform.submit()' class='center'>$options</select>".
+ " <input class='center' type='image' src='images/list_submit.png' align='middle'
+ title='"._("Submit department")."' name='submit_department' alt='". _("Submit")."'> ".
"</div>";
+
+ /* Edit delete link for system types
+ */
$action= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."' name='user_edit_%KEY%' title='"._("Edit system")."'>";
$action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' name='user_del_%KEY%' title='"._("Delete system")."'>";
+ $linkopen = "<a href='?plug=".$_GET['plug']."&act=dep_open&dep_id=%s'>%s</a>";
+ /* Create new divlist, and add the header elements
+ */
$divlist = new divlist("systemstab");
+ $divlist->SetSummary(_("This table displays all systems, in the selected tree."));
+ $divlist->SetEntriesPerPage(0);
$divlist->SetHeader(array(
array("string" => " ", "attach" => "style='text-align:center;width:20px;'"),
array("string" => _("System")." / "._("Department"), "attach" => "style=''"),
array("string" => _("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'" )));
- $divlist->SetSummary(_("This table displays all systems, in the selected tree."));
- $divlist->SetEntriesPerPage(0);
-
- // Defining Links
- $linkopen = "<a href='?plug=".$_GET['plug']."&act=dep_open&dep_id=%s'>%s</a>";
+ /* Add departments, to be able to switch into them
+ */
foreach($this->departments as $key=> $val){
-
+
+ /* Add missing entries ... */
if(!isset($this->config->departments[trim($key)])){
$this->config->departments[trim($key)]="";
}
+ /* check if this department contains sub-departments
+ Display different image in this case
+ */
$non_empty="";
$keys= str_replace("/","\/",$key);
foreach($this->config->departments as $keyd=>$vald ){
}
}
+ /* Add to divlist */
$field1 = array("string" => "<img src='images/".$non_empty."folder.png' alt='department'>", "attach" => "style='text-align:center;width:20px;'");
$field2 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "style=''");
$field3 = array("string" => " ", "attach" => "style='width:60px;border-right:0px;text-align:right;'");
$divlist->AddEntry(array($field1,$field2,$field3));
}
- // Space
+ // Iamge spacer
$empty =" ";
// User and Template Images
// Test Every Entry and generate divlist Array
foreach($this->terminals as $key => $val){
// Specify Pics for Extensions
+ if(in_array("goLdapServer" ,$val['objectClass'])){
+
+ }
+
+ /* 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("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 = "";
{
$temp= "";
$conv= array(
+ "NQ" => array("select_newsystem.png",_("New System from incoming")),
"D" => array("select_default.png",_("Template")),
"T" => array("select_terminal.png",_("Terminal")),
"L" => array("select_workstation.png",_("Workstation")),
"F" => array("select_phone.png",_("Phone")),
"S" => array("select_server.png",_("Server")),
- "NT"=> array("select_new_terminal.png",_("New Terminal")),
- "NL"=> array("select_new_workstation.png",_("New Workstation")),
"W" => array("select_winstation.png",_("Winstation")),
"C" => array("select_component.png",_("Network Device")),
"P" => array("select_printer.png",_("Printer")));
/* Get list of terminals to be shown */
if ($terminalfilter['thins'] == "checked"){
- $termfilter= "(&(objectClass=gotoTerminal)(cn=$regex))";
+ $termfilter= "(&(objectClass=goHard)(cn=$regex))";
} else {
$termfilter= "";
}
get_list($this->ui->subtreeACL, "(|$workfilter)", FALSE, "ou=workstations,ou=systems,".$base,
array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), FALSE));
- $res= array_merge($res,
- get_list($this->ui->subtreeACL, "(|$workfilter)", FALSE, "ou=incoming,".$base,
- array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), FALSE));
-
$res= array_merge($res,
get_list($this->ui->subtreeACL, "(|$winfilter)", FALSE, "ou=winstations,ou=systems,".$base,
array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), FALSE));
$tmp= $value["dn"];
}
if (preg_match ("/,ou=incoming,/i", $tmp)){
- if (in_array('gotoTerminal', $value['objectClass'])){
- $add= "- "._("New terminal");
- }
- if (in_array('gotoWorkstation', $value['objectClass'])){
- $add= "- "._("New workstation");
+ if (in_array('GOhard', $value['objectClass'])){
+ $add= "- "._("New Device");
}
} else {
$add= "";
$terminal['location'] = array_search($tmp, $this->config->departments);
$terminal['message'] = _("Workstation template for");
}
+ }elseif (in_array("GOhard",$value['objectClass'])){
+ $terminal = $value;
+ $terminal['type'] = "Q";
+ $terminal['is_new'] = $add;
} elseif (in_array('gotoPrinter', $value["objectClass"])){
$terminal = $value;
$terminal['type'] = "P";
if (in_array('ieee802Device', $classes)){
$type= "component";
- }
+ }else
if (in_array('gotoTerminal', $classes)){
$type= "terminal";
- }
+ }else
if (in_array('gotoWorkstation', $classes)){
$type= "workstation";
- }
+ }else
if (in_array('gotoPrinter', $classes)){
$type= "printer";
- }
+ }else
if (in_array('goFonHardware', $classes)){
$type= "phone";
- }
+ }else
if (in_array('goServer', $classes)){
$type= "server";
- }
+ }else
+ if (in_array('GOhard', $classes)){
+ $type= "NewDevice";
+ }else
if (in_array('sambaAccount', $classes) ||
in_array('sambaSamAccount', $classes)){
$type= "winstation";
index 2a2e7df25ab17411edc8fb7b042878c0edeeec46..1a3b8b506079bcc1ee7cd82e48e27437e4491a02 100644 (file)
var $types = array();
var $DNSinitially_was_account = false;
- function termDNS ($config, $dn,$objectClasses)
+ var $orig_dn ="";
+
+ var $IPisMust = false;
+ var $MACisMust= false;
+
+ function termDNS ($config, $dn,$objectClasses,$IPisMust = false)
{
/* We need to know which objectClasses are used, to store the ip/mac*/
$this->objectclasses= $objectClasses;
plugin::plugin ($config, $dn);
+ $this->orig_dn= $dn;
+
+ $this->IPisMust = $IPisMust;
+
/* All types with required attrs */
$this->RecordTypes['aRecord'] = "aRecord"; // ok
$this->RecordTypes['mDRecord'] = "mDRecord"; // ok
$this->RecordTypes['rRSIGRecord'] = "rRSIGRecord"; // ok
$this->RecordTypes['nSECRecord'] = "nSECRecord"; // ok
- /* Get all available zones */
- $this->cn = $this->attrs['cn'][0];
+ echo $this->cn;
+ /* Get all available zones */
+ if(empty($this->cn)&&(isset($this->attrs['cn'][0]))){
+ $this->cn = $this->attrs['cn'][0];
+ }
$this->Zones = $this->get_Zones();
$types = array();
$smarty->assign("DNSAccount",$this->DNS_is_account);
$smarty->assign("Zones",$this->Zones);
$smarty->assign("ZoneKeys",($this->Zones));
+ $smarty->assign("IPisMust",(($this->IPisMust)||($this->DNS_is_account)));
$changeStateForRecords ="";
$smarty->assign("records",$this->generateRecordsList(&$changeStateForRecords));
$smarty->assign("changeStateForRecords",$changeStateForRecords);
function remove_from_parent()
{
- /* This cannot be removed... */
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->orig_dn);
+ $ldap->search("(&(objectClass=dNSZone)(zoneName=*)(!(relativeDomainName=@)))",array("relativeDomainName","zoneName"));
+ while($attr = $ldap->fetch()){
+ $ldap->cd($attr['dn']);
+ $ldap->rmDir($attr['dn']);
+ }
}
/* Save data to object */
{
$message= array();
- /* Check if mac is empty */
- if ($this->macAddress == "" && chkacl ($this->acl, "macAddress") == ""){
- $message[]= _("The required field 'MAC-address' is not set.");
- }
+
+ if(($this->IPisMust)||($this->DNS_is_account)){
+ /* Check if ip is empty */
+ if ($this->ipHostNumber == "" && chkacl ($this->acl, "ipHostNumber") == ""){
+ $message[]= _("The required field 'IP-address' is not set.");
+ }
- /* Check if ip is empty */
- if ($this->ipHostNumber == "" && chkacl ($this->acl, "ipHostNumber") == ""){
- $message[]= _("The required field 'IP-address' is not set.");
+ /* check if given ip is valid ip*/
+ $num="(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";
+ if (!preg_match("/^$num\\.$num\\.$num\\.$num$/", $this->ipHostNumber)){
+ $message[]= _("Wrong IP format in field IP-address.");
+ }
}
- /* check if given ip is valid ip*/
- $num="(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";
- if (!preg_match("/^$num\\.$num\\.$num\\.$num$/", $this->ipHostNumber)){
- $message[]= _("Wrong IP format in field IP-address.");
+ /* Check if mac is empty */
+ if ($this->macAddress == "" && chkacl ($this->acl, "macAddress") == ""){
+ $message[]= _("The required field 'MAC-address' is not set.");
}
/* Check if given mac is valid mac */
diff --git a/plugins/admin/systems/class_terminalGeneric.inc b/plugins/admin/systems/class_terminalGeneric.inc
index e6a949ab3e8b677588bb39666b7cc24f348e99e4..bfa881a31a4e46c06fe8eed0a923e2cde896faed 100644 (file)
$ldap->cd($this->dn);
$ldap->cat($this->dn);
if($ldap->count()){
-
- $ldap->rmdir($this->dn);
+ $this->netConfigDNS->remove_from_parent();
+ $ldap->rmDir($this->dn);
show_ldap_error($ldap->get_error());
/* Optionally execute a command after we're done */
unset($og->member[$this->dn]);
$og->save ();
}
- $this->netConfigDNS->remove_from_parent();
}
}
$ldap->modify($this->attrs);
$this->handle_post_events("modify");
}
+ $this->netConfigDNS->cn = $this->cn;
$this->netConfigDNS->save($this->dn);
show_ldap_error($ldap->get_error());
diff --git a/plugins/admin/systems/class_winGeneric.inc b/plugins/admin/systems/class_winGeneric.inc
index 4fc4ab92e44123b194729f50189e631c33096344..b2002b79e4b089946054f4984192c6c80102fa47 100644 (file)
function remove_from_parent()
{
+ $this->netConfigDNS->remove_from_parent();
$ldap= $this->config->get_ldap_link();
$ldap->rmdir($this->dn);
show_ldap_error($ldap->get_error());
unset($og->member[$this->dn]);
$og->save ();
}
- $this->netConfigDNS->remove_from_parent();
}
$ldap->modify($this->attrs);
$this->handle_post_events("modify");
}
+
+ $this->netConfigDNS->cn = $this->cn;
$this->netConfigDNS->save($this->dn);
show_ldap_error($ldap->get_error());
diff --git a/plugins/admin/systems/class_workstationGeneric.inc b/plugins/admin/systems/class_workstationGeneric.inc
index 88abf046654cc65fea107de49e8fdad174eaba4b..1c81a6c1ffb47df3221d2bf850999fc636a6dbf6 100644 (file)
function remove_from_parent()
{
+ $this->netConfigDNS->remove_from_parent();
$ldap= $this->config->get_ldap_link();
$ldap->rmdir($this->dn);
show_ldap_error($ldap->get_error());
unset($og->member[$this->dn]);
$og->save ();
}
- $this->netConfigDNS->remove_from_parent();
}
$this->handle_post_events("modify");
}
}
+ $this->netConfigDNS->cn = $this->cn;
$this->netConfigDNS->save($this->dn);
show_ldap_error($ldap->get_error());
}
index 8a9c503429f0b0ac2dbedbedd7c4731436ae229e..467a074889e9c179aac44b8e4f17cbfe63193967 100644 (file)
<td style="border-right:1px solid #b0b0b0; width:50%; vertical-align: top;">
<table summary="">
<tr>
- <td><LABEL for="ipHostNumber">{t}IP-address{/t}{$staticAddress}</LABEL></td>
+ <td><LABEL for="ipHostNumber">{t}IP-address{/t}{if $IPisMust}{$staticAddress}{/if}</LABEL></td>
<td><input id="ipHostNumber" name="ipHostNumber" size=25 maxlength=80 value="{$ipHostNumber}"></td>
</tr>
</table>