summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 87e861b)
raw | patch | inline | side by side (parent: 87e861b)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 10 Aug 2007 09:02:33 +0000 (09:02 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 10 Aug 2007 09:02:33 +0000 (09:02 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7036 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/plugins/admin/systems/class_componentGeneric.inc b/plugins/admin/systems/class_componentGeneric.inc
index 2463ca1173fd6aa6d51cc818c293de483c675bdb..5b100d469a608e837e4aaf2e53a5eda3c38f31b1 100644 (file)
}
$smarty->assign("base_select", $this->base);
$smarty->assign("baseACL", chkacl($this->acl,"base"));
-
- /* Show main page */
$this->netConfigDNS->cn= $this->cn;
$smarty->assign("netconfig", $this->netConfigDNS->execute());
+
+ /* Display sub dialog from network settings */
+ if($this->netConfigDNS->dialog){
+ $this->dialog = TRUE;
+ return($this->netConfigDNS->execute());
+ }else{
+ $this->dialog = FALSE;
+ }
+
+ /* Show main page */
return($smarty->fetch (get_template_path('component.tpl', TRUE)));
}
diff --git a/plugins/admin/systems/class_phoneGeneric.inc b/plugins/admin/systems/class_phoneGeneric.inc
index d0811490260f28bcbdbdef69cdfc9340df824a85..2c0eaaf879b18ad208f0159187cf8cb7425ee5a7 100644 (file)
$smarty->assign("baseACL", chkacl($this->acl,"base"));
$smarty->assign("goFonDefaultIPs",array("dynamic"=>_("dynamic"),"network"=>_("Networksettings")));
-
- /* Show main page */
$this->netConfigDNS->cn= $this->cn;
$smarty->assign("netconfig", $this->netConfigDNS->execute());
+
+ /* Display sub dialog from network settings */
+ if($this->netConfigDNS->dialog){
+ $this->dialog = TRUE;
+ return($this->netConfigDNS->execute());
+ }else{
+ $this->dialog = FALSE;
+ }
+
+ /* Show main page */
$smarty->assign("phonesettings", dirname(__FILE__)."/phonesettings.tpl");
return($smarty->fetch (get_template_path('phone.tpl', TRUE)));
}
diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc
index bb9d23c8da70a5c366516f2947370d9d299f0190..12c043c258e51362bbe1a64735f2ee43bd5f22ab 100644 (file)
if($this->BelongsTo == "Printer"){
$this->netConfigDNS->cn= $this->cn;
$smarty->assign("netconfig", $this->netConfigDNS->execute());
+
+ /* Display sub dialog from network settings */
+ if($this->netConfigDNS->dialog){
+ $this->dialog = TRUE;
+ return($this->netConfigDNS->execute());
+ }else{
+ $this->dialog = FALSE;
+ }
} else {
$smarty->assign("netconfig", "");
}
+
return($display.$smarty->fetch (get_template_path('printer.tpl', TRUE)));
}
diff --git a/plugins/admin/systems/class_servGeneric.inc b/plugins/admin/systems/class_servGeneric.inc
index 941ec08c7151c0098de6e6ae18de5b9c6687c406..060da024fb8ec4ae8e517681162814167f270bbb 100644 (file)
/* Show main page */
$this->netConfigDNS->cn= $this->cn;
$smarty->assign("netconfig", $this->netConfigDNS->execute());
+
+ if($this->netConfigDNS->dialog){
+ $this->dialog = TRUE;
+ return($this->netConfigDNS->execute());
+ }else{
+ $this->dialog = FALSE;
+ }
$smarty->assign("fai_activated",$this->fai_activated);
$smarty->assign("modes", $this->modes);
index 5bf0157a36e89fe11a990ead09e093c39fcd58ad..a587f6cb76803cd68027270aa9363d24e285c809 100644 (file)
var $OrigCn = ""; // Initial cn
var $IPisMust = false;
var $MACisMust = false;
+ var $dialog;
+
+ /* DCHP Attributes
+ */
+ var $dhcpAttributes = array("dhcpParentNode");
+ var $dhcpEnabled = FALSE;
+ var $dhcp_is_Account = FALSE;
+ var $dhcpParentNodes = array();
+ var $dhcpParentNode = "";
+ var $dhcpHostEntry = array();
+ var $initial_dhcpParentNode = "";
+ var $initial_dhcpHostEntry = array();
+
/* DNS attributes
*/
$this->OrigCn = preg_replace("/\\\$\$/","",$this->attrs['cn'][0]);
$this->cn = preg_replace("/\\\$\$/","",$this->attrs['cn'][0]);
}
-
+
+
+ /************
+ * DHCP
+ ************/
+
+ /* Hide all dhcp specific code, if dhcp plugin is not present in config */
+ $dhcpEnabled = FALSE;
+ foreach($this->config->data['TABS']['SERVTABS'] as $tab){
+ if(preg_match("/^servdhcp$/",$tab['CLASS'])){
+ $this->dhcpEnabled = TRUE;
+ }
+ }
+ if($this->dhcpEnabled){
+ $this->dhcpParentNodes = $this->get_dhcp_parent_nodes();
+ $this->dhcpParentNode = $this->get_dhcp_parent_node();
+ if($this->dhcpParentNode){
+ $this->dhcp_is_Account = TRUE;
+ $this->dhcpHostEntry = $this->get_dhcp_host_entry();
+ }
+ $this->initial_dhcpHostEntry = $this->dhcpHostEntry;
+ $this->initial_dhcpParentNode= $this->dhcpParentNode;
+ }
+
+
+ /************
+ * Autonetwork hook
+ ************/
+
/* Do we have autonet support? */
if (isset($this->config->data['MAIN']['AUTO_NETWORK_HOOK'])){
$this->autonet= true;
}
+
+ /************
+ * DNS
+ ************/
+
/* Hide all dns specific code, if dns is not available
*/
$DNSenabled = false;
}
}
+
+
+ /**********
+ * DHCP Handling
+ **********/
+
+ if(isset($_POST['dhcpEditOptions'])){
+ $this->dialog = new dhcpHost($this->dhcpHostEntry);
+ }
+
+ if(isset($_POST['cancel_dhcp'])){
+ $this->dialog = FALSE;
+ }
+
+ if(isset($_POST['save_dhcp'])){
+ $this->dialog = FALSE;
+ }
+
+ if(isset($this->dialog) && $this->dialog != FALSE){
+ return($this->dialog->execute());
+ }
+
+ $smarty->assign("dhcpEnabled", $this->dhcpEnabled);
+ $smarty->assign("dhcp_is_Account",$this->dhcp_is_Account);
+ $smarty->assign("dhcpParentNode", $this->dhcpParentNode);
+ $smarty->assign("dhcpParentNodes",$this->dhcpParentNodes);
+
+
+
+
+
+
/* There is no dns available
*/
if($this->DNSenabled == false){
$smarty->assign("staticAddress","<font class=\"must\">*</font>");
$display.= $smarty->fetch(get_template_path('network.tpl', TRUE));
- return($display);
}else{
$smarty->assign("DNS_is_account",true);
- }
-
- /* Add new empty array to our record list */
- if(isset($_POST['AddNewRecord'])){
- $this->dnsEntry['RECORDS'][] =array("type"=>"aRecord","value"=>"");
- }
-
- /* Handle all posts */
- $only_once =true;
- foreach($_POST as $name => $value){
-
- /* Check if we have to delete a record entry */
- if((preg_match("/RemoveRecord_/",$name))&&($only_once)) {
-
- /* Avoid performing this once again */
- $only_once = false;
-
- /* Extract id for specified entry */
- $id = preg_replace("/RemoveRecord_/","",$name);
- $id = preg_replace("/_.*$/","",$id);
-
- /* Delete this record, mark edited entries to be able to delete them */
- if(isset($this->dnsEntry['RECORDS'][$id])){
- unset($this->dnsEntry['RECORDS'][$id]);
- }
+
+ /* Add new empty array to our record list */
+ if(isset($_POST['AddNewRecord'])){
+ $this->dnsEntry['RECORDS'][] =array("type"=>"aRecord","value"=>"");
}
- }
- /* Assign smarty all non DNs attributes */
- foreach($this->attributes as $attr){
- $smarty->assign($attr,$this->$attr);
- $smarty->assign($attr."ACL",chkacl($this->acl,$attr));
- }
+ /* Handle all posts */
+ $only_once =true;
+ foreach($_POST as $name => $value){
- /* Assign smarty all DNS attributes */
- foreach($this->DNSattributes as $attr){
- $smarty->assign($attr,$this->dnsEntry[$attr]);
- $smarty->assign($attr."ACL",chkacl($this->acl,$attr));
- }
-
- /* Assign all needed vars */
- $smarty->assign("DNSaccountACL",chkacl($this->acl,"termDNS"));
+ /* Check if we have to delete a record entry */
+ if((preg_match("/RemoveRecord_/",$name))&&($only_once)) {
- $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)));
-
- /* Create zone array */
- $idZones = array();
- foreach($this->Zones as $id => $zone){
- if($this->netmaskIsCoherent($id)) {
- $idZones[$id] = $zone;
- }else{
- $idZones[$id] = $zone." ("._("Not matching").")";
+ /* Avoid performing this once again */
+ $only_once = false;
+
+ /* Extract id for specified entry */
+ $id = preg_replace("/RemoveRecord_/","",$name);
+ $id = preg_replace("/_.*$/","",$id);
+
+ /* Delete this record, mark edited entries to be able to delete them */
+ if(isset($this->dnsEntry['RECORDS'][$id])){
+ unset($this->dnsEntry['RECORDS'][$id]);
+ }
+ }
}
- }
- $smarty->assign("Zones",$idZones);
- $smarty->assign("ZoneKeys", $this->Zones);
- $tmp = $this->generateRecordsList();
-
- $changeStateForRecords = $tmp['changeStateForRecords'];
+ /* Assign smarty all non DNs attributes */
+ foreach($this->attributes as $attr){
+ $smarty->assign($attr,$this->$attr);
+ $smarty->assign($attr."ACL",chkacl($this->acl,$attr));
+ }
+
+ /* Assign smarty all DNS attributes */
+ foreach($this->DNSattributes as $attr){
+ $smarty->assign($attr,$this->dnsEntry[$attr]);
+ $smarty->assign($attr."ACL",chkacl($this->acl,$attr));
+ }
- $smarty->assign("records",$tmp['str']);
- $smarty->assign("changeStateForRecords",$changeStateForRecords);
- $smarty->assign("staticAddress","<font class=\"must\">*</font>");
+ /* Assign all needed vars */
+ $smarty->assign("DNSaccountACL",chkacl($this->acl,"termDNS"));
- $display.= $smarty->fetch(get_template_path('network.tpl', TRUE));
+ $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)));
+
+ /* Create zone array */
+ $idZones = array();
+ foreach($this->Zones as $id => $zone){
+ if($this->netmaskIsCoherent($id)) {
+ $idZones[$id] = $zone;
+ }else{
+ $idZones[$id] = $zone." ("._("Not matching").")";
+ }
+ }
+ $smarty->assign("Zones",$idZones);
+ $smarty->assign("ZoneKeys", $this->Zones);
+
+ $tmp = $this->generateRecordsList();
+
+ $changeStateForRecords = $tmp['changeStateForRecords'];
+
+ $smarty->assign("records",$tmp['str']);
+ $smarty->assign("changeStateForRecords",$changeStateForRecords);
+ $smarty->assign("staticAddress","<font class=\"must\">*</font>");
+
+ $display.= $smarty->fetch(get_template_path('network.tpl', TRUE));
+ }
return($display);
}
{
/* Save all posted vars */
plugin::save_object();
-
+
+
+ /* Handle DHCP Posts*/
+ if($this->dhcpEnabled && isset($_POST['network_tpl_posted'])){
+ if(isset($_POST['dhcp_is_Account'])){
+ $this->dhcp_is_Account = TRUE;
+ }else{
+ $this->dhcp_is_Account = FALSE;
+ }
+ foreach($this->dhcpAttributes as $attr){
+ if(isset($_POST[$attr])){
+ $this->$attr = $_POST[$attr];
+ }
+ }
+ }
+
+
/* Get dns attributes */
if(($this->DNSenabled) && (isset($_POST['network_tpl_posted'])) && chkacl($this->acl,"termDNS") == ""){
$str.="</select>";
return($str);
}
+
+
+ function get_dhcp_host_entry()
+ {
+ $attrs = array();
+ $dn = $this->get_dhcp_host_entry_dn();
+ if($dn){
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->cat($dn,array("*"));
+ if($ldap->count()){
+ $attrs = $ldap->fetch();
+ foreach($attrs as $key => $value){
+ if(is_numeric($key) || ($key == "count")){
+ unset($attrs[$key]);
+ }
+ if(is_array($value) && isset($value['count'])){
+ unset($attrs[$key]['count']);
+ }
+ }
+ }
+ }
+ return($attrs);
+ }
+
+
+ function get_dhcp_host_entry_dn()
+ {
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->search ("(&(objectClass=dhcpHost)(cn=".$this->cn."))",array("cn","dn"));
+
+ if($ldap->count()){
+ $attr = $ldap->fetch();
+ return($attr['dn']);
+ }else{
+ return("");
+ }
+ }
+
+
+ function get_dhcp_parent_node()
+ {
+ return(preg_replace("/^cn=".normalizePreg($this->cn).",/","",$this->get_dhcp_host_entry_dn()));
+ }
+
+
+ function get_dhcp_parent_nodes()
+ {
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->search("(objectClass=dhcpService)",array("dhcpPrimaryDN"));
+
+ $dhcp_dns = array();
+ while($attr = $ldap->fetch()){
+ $dhcp_dns[$attr['dn']] = $attr['dhcpPrimaryDN'][0];
+ }
+
+ foreach($dhcp_dns as $key => $pri_dns){
+ $ldap->cat($pri_dns,array("cn"));
+ $tmp = $ldap->fetch();
+ $dhcp_dns[$key] = $tmp['cn'][0];
+ }
+
+ foreach($dhcp_dns as $dn => $cn){
+ $ldap->cd($dn);
+ $ldap->search("(|(objectClass=dhcpService)(objectClass=dhcpGroup)".
+ "(objectClass=dhcpSubnet)(objectClass=dhcpSharedNetwork))",array("cn"));
+ $tmp = array();
+ while($attr = $ldap->fetch()){
+ $tmp[$attr['dn']] = $attr['cn'][0];
+ }
+ $tmp2 = $this->create_tree($tmp,preg_replace("/^[^,]+,/i","",$dn),"(".$cn.") ");
+ }
+ return($tmp2);
+ }
+
+
+ function create_tree($arr,$base,$current = "")
+ {
+ $ret = array();
+ foreach($arr as $r => $name){
+ $base_part = str_replace($base,"",$r);
+ if(preg_match("/^[a-z]*=".normalizePreg($name)."(|,)$/i",$base_part)){
+ $ret[$r] = $current.$name;
+ $tmp = $this->create_tree($arr,$r,$current.". ");
+ foreach($tmp as $sub_key => $sub_name){
+ $ret[$sub_key] = $sub_name;
+ }
+ }
+ }
+ return($ret);
+ }
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
diff --git a/plugins/admin/systems/class_terminalGeneric.inc b/plugins/admin/systems/class_terminalGeneric.inc
index 66500df3464b8721d69cf4b2b7e56a95d7551b39..e415287910f20279559941968cab06bf6c8692a7 100644 (file)
$smarty->assign("fai_activated",$this->fai_activated);
$smarty->assign("actionACL", chkacl($this->acl, 'action'));
+ /* Display sub dialog from network settings */
+ if($this->netConfigDNS->dialog){
+ $this->dialog = TRUE;
+ return($this->netConfigDNS->execute());
+ }else{
+ $this->dialog = FALSE;
+ }
+
$smarty->assign("member_of_ogroup",$this->member_of_ogroup);
return($smarty->fetch (get_template_path('terminal.tpl', TRUE)));
diff --git a/plugins/admin/systems/class_winGeneric.inc b/plugins/admin/systems/class_winGeneric.inc
index 3c19a48a9657bcbb04823b430d96d0b2fb54ea23..6fe4b7608bbe27932f06707093a355c0f6be2a33 100644 (file)
}
$smarty->assign("base_select", $this->base);
-
- /* Show main page */
$this->netConfigDNS->cn= $this->cn;
$smarty->assign("netconfig", $this->netConfigDNS->execute());
+
+ /* Display sub dialog from network settings */
+ if($this->netConfigDNS->dialog){
+ $this->dialog = TRUE;
+ return($this->netConfigDNS->execute());
+ }else{
+ $this->dialog = FALSE;
+ }
+
+ /* Show main page */
return($smarty->fetch (get_template_path('wingeneric.tpl', TRUE)));
}
diff --git a/plugins/admin/systems/class_workstationGeneric.inc b/plugins/admin/systems/class_workstationGeneric.inc
index e4c26a1809e12dcd6404c6965f7830762edb270c..c2553d2e57507999e43d03cca4542a0799bcd37c 100644 (file)
$smarty->assign("netconfig", $this->netConfigDNS->execute());
$smarty->assign("fai_activated",$this->fai_activated);
+ /* Display sub dialog from network settings */
+ if($this->netConfigDNS->dialog){
+ $this->dialog = TRUE;
+ return($this->netConfigDNS->execute());
+ }else{
+ $this->dialog = FALSE;
+ }
+
$smarty->assign("member_of_ogroup",$this->member_of_ogroup);
return($smarty->fetch (get_template_path('workstation.tpl', TRUE)));
index f3b68830ce6063e1b3774d68558de663e0d6e985..ef8e9d1746ae90fff2d41e5f006bc9503738ceaa 100644 (file)
</tr>
<tr>
<td><LABEL for="macAddress">{t}MAC-address{/t}</LABEL>{$staticAddress}</td>
- <td><input name="macAddress" id="macAddress" size=25 maxlength=80 value="{$macAddress}" {$macAddressACL}></td>
- </tr>
- {if $autonet==true}
- <tr>
- <td> </td>
- <td><input type="submit" name="autonet" value="{t}Autodetect{/t}"
- {if ($ipHostNumberACL !="" || $macAddressACL!= "")} disabled {/if}></td>
+ <td>
+ <input name="macAddress" id="macAddress" size=25 maxlength=80 value="{$macAddress}" {$macAddressACL}>
+ {if $autonet==true}
+ <input type="submit" name="autonet" value="{t}-><-{/t}"
+ {if ($ipHostNumberACL !="" || $macAddressACL!= "")} disabled {/if}>
+ {/if}
+ </td>
</tr>
+ {if $dhcpEnabled}
+ <tr>
+ <td colspan=2>
+
+ <table>
+ <tr>
+ <td>
+ <input {if $dhcp_is_Account} checked {/if} type='checkbox' name='dhcp_is_Account' class='center'>
+ {t}Enable DHCP for this device{/t}
+ </td>
+ </tr>
+ {if $dhcp_is_Account}
+ <tr>
+ <td>
+ {t}Parent node{/t}
+ <select name='dhcpParentNode'>
+ {html_options options=$dhcpParentNodes selected=$dhcpParentNode}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input type='submit' name='dhcpEditOptions' value='{t}Edit settings{/t}'>
+ </td>
+ </tr>
+ {/if}
+ </table>
+ </td>
+ </tr>
{/if}
</table>
</td>