use new meta HTML classes

This commit is contained in:
Roland Gruber 2010-09-26 12:09:58 +00:00
parent daad8f506e
commit b435abacdd
1 changed files with 27 additions and 31 deletions

View File

@ -386,11 +386,12 @@ class range extends baseModule {
/** /**
* Returns the HTML meta data for the main account page. * Returns the HTML meta data for the main account page.
* *
* @return array HTML meta data * @return htmlElement HTML meta data
*/ */
public function display_html_attributes() { public function display_html_attributes() {
$return = new htmlTable();
if ($this->getAccountContainer()->getAccountModule('dhcp_settings')->attributes['cn'][0]=="") { if ($this->getAccountContainer()->getAccountModule('dhcp_settings')->attributes['cn'][0]=="") {
echo "<b>" . _("Please fill out the DHCP settings first.") . "</b>"; $return->addElement(new htmlStatusMessage('INFO', _("Please fill out the DHCP settings first.")));
} }
else { else {
@ -404,51 +405,46 @@ class range extends baseModule {
// Range start // Range start
if ($this->processed && !check_ip($this->ranges[$id]['range_start'])) { if ($this->processed && !check_ip($this->ranges[$id]['range_start'])) {
$error = "&laquo;&laquo; " . _("The IP address is invalid."); $error = _("The IP address is invalid.");
} elseif($this->processed && !$this->check_range($this->ranges[$id]['range_start'],$this->ranges[$id]['range_end'])) { } elseif($this->processed && !$this->check_range($this->ranges[$id]['range_start'],$this->ranges[$id]['range_end'])) {
$error = "&laquo;&laquo; " . _("The range end needs to be greater than the range start."); $error = _("The range end needs to be greater than the range start.");
} elseif ($this->processed && !range::check_subnet_range($this->ranges[$id]['range_start'],$this->getAccountContainer()->getAccountModule('dhcp_settings')->attributes['cn'][0], $mask)) { } elseif ($this->processed && !range::check_subnet_range($this->ranges[$id]['range_start'],$this->getAccountContainer()->getAccountModule('dhcp_settings')->attributes['cn'][0], $mask)) {
$error = "&laquo;&laquo; " . _("The IP does not match the subnet."); $error = _("The IP does not match the subnet.");
} elseif ($this->processed && !$this->overlaped_range($this->ranges[$id]['range_start'],$this->ranges[$id]['range_end']) ) { } elseif ($this->processed && !$this->overlaped_range($this->ranges[$id]['range_start'],$this->ranges[$id]['range_end']) ) {
$error = "&laquo;&laquo; " . _("The range conflicts with another range."); $error = _("The range conflicts with another range.");
} else { } else {
$error = ""; $error = "";
} }
$return[] = array( $fromInput = new htmlTableExtendedInputField(_('Range from'), 'range_start_'.$id, $this->ranges[$id]['range_start'], 'range_from');
array('kind' => 'text', 'text' => _('Range from') . ":* "), $fromInput->setRequired(true);
array('kind' => 'input', 'name' => 'range_start_'.$id.'', 'value' => $this->ranges[$id]['range_start']), $return->addElement($fromInput);
array('kind' => 'help', 'value' => 'range_from', 'scope' => 'user'), $return->addElement(new htmlOutputText($error), true);
array('kind' => 'text', 'text'=>$error));
// Range end // Range end
if ($this->processed && !check_ip($this->ranges[$id]['range_end'])) { if ($this->processed && !check_ip($this->ranges[$id]['range_end'])) {
$error = "&laquo;&laquo; " . _("The IP address is invalid."); $error = _("The IP address is invalid.");
} elseif ($this->processed && !range::check_subnet_range($this->ranges[$id]['range_end'],$this->getAccountContainer()->getAccountModule('dhcp_settings')->attributes['cn'][0], $mask)) { } elseif ($this->processed && !range::check_subnet_range($this->ranges[$id]['range_end'],$this->getAccountContainer()->getAccountModule('dhcp_settings')->attributes['cn'][0], $mask)) {
$error = "&laquo;&laquo; " . _("The IP does not match the subnet."); $error = _("The IP does not match the subnet.");
} else { } else {
$error = ""; $error = "";
} }
$return[] = array( $toInput = new htmlTableExtendedInputField(_('Range to'), 'range_end_'.$id, $this->ranges[$id]['range_end'], 'range_to');
array('kind' => 'text', 'text' => _('Range to') . ":* "), $toInput->setRequired(true);
array('kind' => 'input', 'name' => 'range_end_'.$id.'', 'value' => $this->ranges[$id]['range_end']), $return->addElement($toInput);
array('kind' => 'help', 'value' => 'range_to', 'scope' => 'user'), $return->addElement(new htmlOutputText($error), true);
array('kind' => 'text', 'text'=>$error));
// Drop range: // Drop range:
$return[] = array( $dropButton = new htmlButton('drop_range_'.$id, _('Delete range'));
array('kind' => 'text', 'text' => _('Delete range') . ':'), $dropButton->colspan = 2;
array('kind' => 'input', 'name' => 'drop_range_'.$id, 'type' => 'submit', 'value' => _('Delete range')), $return->addElement($dropButton);
array('kind' => 'help', 'value' => 'drop_range')); $return->addElement(new htmlHelpLink('drop_range'), true);
// Space Line $return->addElement(new htmlSpacer(null, '10px'), true);
$return[] = array(0 => array('kind' => 'text', 'text' => '<br />'));
} }
// Range hinzufügen: // add new range
$return[] = array( $addButton = new htmlButton('add_range', _('New range'));
array('kind' => 'text', 'text' => _('New range') . ':'), $addButton->colspan = 2;
array('kind' => 'input', 'name' => 'add_range', 'type' => 'submit', 'value' => _('New range')), $return->addElement($addButton);
array('kind' => 'help', 'value' => 'add_range')); $return->addElement(new htmlHelpLink('add_range'));
} }
return $return; return $return;