summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5a7bb38)
raw | patch | inline | side by side (parent: 5a7bb38)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 10 Apr 2008 09:15:45 +0000 (09:15 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 10 Apr 2008 09:15:45 +0000 (09:15 +0000) |
-Allow saving of multiple IP addresses
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10313 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10313 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/systems/admin/systems/class_termDNS.inc | patch | blob | history | |
gosa-plugins/systems/admin/systems/network.tpl | patch | blob | history |
diff --git a/gosa-plugins/systems/admin/systems/class_termDNS.inc b/gosa-plugins/systems/admin/systems/class_termDNS.inc
index f40e6d5d2f9892c5536b9442d4d641e33d3cbaf0..8a9d47998eb06fc38bf15739273483a5ccee8539 100644 (file)
$this->cn = preg_replace("/\\\$\$/","",$this->attrs['cn'][0]);
}
-
+ /* Create list of additional ipHostNumber.
+ */
$this->additionalHostNumbers = array();
if(isset($this->attrs['ipHostNumber']) && $this->attrs['ipHostNumber']['count'] > 1){
for($i = 1 ; $i < $this->attrs['ipHostNumber']['count']; $i ++){
$display= "";
+ /**********
+ * Additional ipHostNumber handling
+ **********/
+
+ /* Add a new one */
+ if(isset($_POST['additionalHostNumbers_add'])){
+ if(!is_array($this->additionalHostNumbers)){
+ $this->additionalHostNumbers=array();
+ }
+ $this->additionalHostNumbers[] = "";
+ }
+
+ /* Delete given entry */
+ foreach($this->additionalHostNumbers as $id => $value){
+ if(isset($_POST['additionalHostNumbers_del_'.$id])){
+ unset($this->additionalHostNumbers[$id]);
+ $this->additionalHostNumbers = array_values($this->additionalHostNumbers);
+ }
+ }
+
$smarty->assign("additionalHostNumbers",$this->additionalHostNumbers);
$smarty->assign("staticAddress", "");
+ /**********
+ * Autonet completion
+ **********/
+
/* Check for autonet button */
if (isset($_POST['autonet'])){
- $d= new gosaSupportDaemon(TRUE, 0.5);
- $res= $d->_send("<xml><header>gosa_network_completition</header><source>GOSA</source><target>GOSA</target><hostname>".$this->cn."</hostname></xml>", TRUE);
- if (isset($res['XML']['IP'])){
- $this->ipHostNumber= $res['XML']['IP'];
- }
- if (isset($res['XML']['MAC'])){
- $this->macAddress= $res['XML']['MAC'];
- }
+ $d= new gosaSupportDaemon(TRUE, 0.5);
+ $res= $d->_send("<xml><header>gosa_network_completition</header><source>GOSA</source><target>GOSA</target><hostname>".$this->cn."</hostname></xml>", TRUE);
+ if (isset($res['XML']['IP'])){
+ $this->ipHostNumber= $res['XML']['IP'];
+ }
+ if (isset($res['XML']['MAC'])){
+ $this->macAddress= $res['XML']['MAC'];
+ }
}
-
+
/**********
* DHCP Handling
/* Save all posted vars */
plugin::save_object();
- /* Handle DHCP Posts*/
+ /******
+ Additional IP Host Numbers
+ ******/
+
+ /* Get posts for all additionally added ipHostNumbers */
+ foreach($this->additionalHostNumbers as $id => $value){
+ if(isset($_POST['additionalHostNumbers_'.$id])){
+ $this->additionalHostNumbers[$id] = get_post('additionalHostNumbers_'.$id);
+ }
+ }
+
+
+ /******
+ DHCP posts
+ ******/
+
if($this->dhcpEnabled && isset($_POST['network_tpl_posted'])){
foreach($this->dhcpAttributes as $attr){
if(isset($_POST[$attr])){
}
}
+
+ /******
+ DNS posts
+ ******/
+
/* Check if DNS should be enabled / disabled */
if($this->DNS_is_account && $this->acl_is_removeable() && !isset($_POST['DNS_is_account'])){
$this->DNS_is_account = false;
/* Call common method to give check the hook */
$message= plugin::check();
+ /******
+ check additional IP Host Numbers
+ ******/
+
+ foreach($this->additionalHostNumbers as $id => $value){
+ if(!tests::is_ip($value)){
+ $message[]= msgPool::invalid(sprintf(_("IP address #%s"),($id +2)), "", "", "192.168.1.10");
+ }
+ }
+
+
/* Check if mac and ip are already used */
if(!empty($this->ipHostNumber) && $this->DNS_is_account &&
$this->ipHostNumber != $this->orig_ipHostNumber &&
/* Save DNS setting & ip/Mac*/
plugin::save();
+ /* Add all additional ipHostNumbers now
+ */
+ $this->attrs['ipHostNumber'] = array($this->ipHostNumber);
+ foreach($this->additionalHostNumbers as $value){
+ $this->attrs['ipHostNumber'][] = $value;
+ }
+
/* Write back to ldap */
$ldap->cd($this->dn);
$this->cleanup();
diff --git a/gosa-plugins/systems/admin/systems/network.tpl b/gosa-plugins/systems/admin/systems/network.tpl
index 6132c8a8f1fa746faca96700bdcf64b6eca29c50..f1f309dc076921399e4e201fa472462d032cbe6d 100644 (file)
<td style="width:50%; vertical-align: top;">
<table summary="">
<tr>
- <td><LABEL for="ipHostNumber">{t}IP-address{/t}{if $IPisMust}{$staticAddress}{/if}</LABEL></td>
+ <td style='vertical-align:top;'><LABEL for="ipHostNumber">{t}IP-address{/t}{if $IPisMust}{$staticAddress}{/if}</LABEL></td>
<td>
{render acl=$ipHostNumberACL}
<input id="ipHostNumber" name="ipHostNumber" size=25 maxlength=80 value="{$ipHostNumber}">
{/render}
-
{foreach from=$additionalHostNumbers item=item key=key}
- <br>{$item}
+ <br>
+ <input size=25 maxlength=80 type='text' name='additionalHostNumbers_{$key}' value='{$item}'>
+ <input type='submit' name='additionalHostNumbers_del_{$key}' value='{msgPool type=delButton}'>
{/foreach}
+ <input type='submit' name='additionalHostNumbers_add' value='{msgPool type=addButton}'>
{render acl=$ipHostNumberACL}
{if $DNS_is_account == true}