diff --git a/plugins/admin/systems/class_servDNSeditZoneEntries.inc b/plugins/admin/systems/class_servDNSeditZoneEntries.inc
index 7a2e57a45d817e6106ec421c3c040efad07d80a3..50812871960c60f872fcc874222198b83a7f53d2 100644 (file)
class servDNSeditZoneEntries 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();
+ var $attributes = array("cn");
var $objectclasses = array("whatever");
var $Devices = array();
var $RecordTypes = array(); // Possible record type.
var $disableDialog = false; // Dialog will be disabled, if this zone is new
+ var $cn;
function servDNSeditZoneEntries ($config,$dn, $zoneObject)
{
/* Initialise class
*/
$this->RecordTypes = getDnsRecordTypes();
- $this->dn = "zoneName=".$zoneObject['InitialzoneName'].",".$dn;
+ $this->dn = "zoneName=".getNameFromMix($zoneObject['InitialzoneName']).",".$dn;
$this->zoneName = $zoneObject['InitialzoneName'];
$this->reverseName = $zoneObject['InitialReverseZone'];
$this->Devices[$attrs['relativeDomainName'][0]]['OrigCn'] = $attrs['relativeDomainName'][0];
}
- if(!count($this->Devices)){
- $this->disableDialog = true;
+ $ldap->cat($this->dn,array("objectClass"));
+
+ $this->disableDialog = true;
+ if(count($this->Devices)|| $ldap->count()){
+ $this->disableDialog = false;
}
}
/* Add new host entry
*/
- if((preg_match("/^UserRecord_/",$name)) && ($once)){
+ if((preg_match("/^UserRecord_?/",$name)) && ($once)){
$once = false;
$entry = getDNSHostEntries($this->config,"",true);
$entry['exists'] = true;
$entry['zoneName'] = $this->zoneName;
$entry['RECORDS'][] = array("type" => "aRecord" , "value"=>"");
- $this->Devices['New Entry'] = $entry;
+ $this->Devices[_("New entry")] = $entry;
}
if(count($tmp2) != 2) continue;
*/
function check()
{
- $message= array();
+ /* Call common method to give check the hook */
+ $message= plugin::check();
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
$names = array();
+
foreach($this->Devices as $DevName => $device){
+ /* skip checking empty attributes */
+ if(count($this->Devices[$DevName]['RECORDS']) == 0){
+ return;
+ }
+
/* Checking entry name
*/
if((!is_uid($DevName)) | (empty($DevName))){
/* Renaming check for existing devices
*/
if(isset($device['OrigCn']) && ($DevName != $device['OrigCn'] )){
- $ldap->cd($this->config->current['BASE']);
+ $ldap->cd($this->dn);
$ldap->search("(relativeDomainName=".$DevName.")",array("relativeDomainName"));
if($ldap->count()){
$message[] = sprintf(_("Can not rename '%s' to '%s',the destination name already exists."),$device['OrigCn'],$DevName);
}
}elseif(!isset($device['OrigCn'])){
- $ldap->cd($this->config->current['BASE']);
+ $ldap->cd($this->dn);
$ldap->search("(relativeDomainName=".$DevName.")",array("relativeDomainName"));
if($ldap->count()){
$message[] = sprintf(_("Can not create '%s',the destination name already exists."),$DevName);
/* Names should be written in lowercase
*/
+
+
if(strtolower($DevName) != $DevName){
$message[] = sprintf(_("The host name '%s' should be written in lowercase."), $DevName);
}
$todo = array();
+
/* Create todolist
*/
foreach($this->Devices as $name => $dev){
*/
foreach($tmp['add'] as $dn => $attrs){
$ldap->cd($dn);
- $ldap->cat($dn);
+ $ldap->cat($dn, array('dn'));
if(count($ldap->fetch())){
$ldap->cd($dn);
$ldap->modify ($attrs);
/* Set title
*/
- $str = "<h3>".sprintf(_("Settings for '%s'"),$objKey)." : </h3>";
+ $str= "<br>";
$hostNameOnce = true;
*/
$name = base64_encode($objKey)."|".$id;
- $str .= "<tr><td style='width:80px;'>\n";
+ $str .= "<tr><td style='width:170px;'>\n";
/* Only first host entry name should be editable
*/
if($hostNameOnce){
$hostNameOnce = false;
$str .="<input type='text' name='RenameHost_".$name."' value='".$objectName."'>\n";
- }else{
- $str .=$objectName;
- }
+ }
/* Create rest. Selectbox, icons ...
*/
$str .="
</td>
- <td style='width:80px;'>
+ <td style='width:90px;'>
".$this->createRecordTypeSelection($record['type'],$name)."
</td>
<td>
<input type='text' value='".$record['value']."' name='ValueSelection_".$name."' style='width:250px;'>
</td>
<td style='width:50px;text-align:right;'>
- <input type='image' name='AddRecord_".$name."' src='images/crossref.png' alt='"._("Add")."' title='"._("Add")."'>
+ <input type='image' name='AddRecord_".$name."' src='images/list_new.png' alt='"._("Add")."' title='"._("Add")."'>
<input type='image' name='RemoveRecord_".$name."' src='images/edittrash.png' alt='"._("Remove")."' title='"._("Remove")."'>
</td>
</tr>";