use new meta HTML classes

This commit is contained in:
Roland Gruber 2010-09-18 11:37:22 +00:00
parent 8cd21ed067
commit a03e8da20a
9 changed files with 87 additions and 95 deletions

View File

@ -176,7 +176,9 @@ class asteriskAccount extends baseModule implements passwordService {
} }
/** /**
* This function will create the meta HTML code to show a page with all attributes. * Returns the HTML meta data for the main account page.
*
* @return htmlElement HTML meta data
*/ */
function display_html_attributes() { function display_html_attributes() {
if (isset($_POST['addObjectClass'])) { if (isset($_POST['addObjectClass'])) {

View File

@ -201,7 +201,7 @@ class asteriskExtension extends baseModule {
/** /**
* This function will create the meta HTML code to show a page with all attributes. * This function will create the meta HTML code to show a page with all attributes.
* *
* @param array $_POST HTTP-POST values * @return htmlElement HTML meta data
*/ */
function display_html_attributes() { function display_html_attributes() {
$return = new htmlTable(); $return = new htmlTable();
@ -270,7 +270,7 @@ class asteriskExtension extends baseModule {
/** /**
* Displays a list of possible owners of this extension. * Displays a list of possible owners of this extension.
* *
* @return array list of info/error messages * @return htmlElement HTML meta data
*/ */
function display_html_user() { function display_html_user() {
$return = new htmlTable(); $return = new htmlTable();

View File

@ -216,7 +216,9 @@ class asteriskVoicemail extends baseModule implements passwordService {
} }
/** /**
* This function will create the meta HTML code to show a page with all attributes. * Returns the HTML meta data for the main account page.
*
* @return htmlElement HTML meta data
*/ */
function display_html_attributes() { function display_html_attributes() {
$return = new htmlTable(); $return = new htmlTable();

View File

@ -326,7 +326,7 @@ class ddns 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(); $return = new htmlTable();

View File

@ -494,7 +494,7 @@ By default, the nodes are configured as H-Nodes which fits for small networks. I
/** /**
* 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() {
// check if DHCP main settings and valid DHCP entry // check if DHCP main settings and valid DHCP entry

View File

@ -226,7 +226,7 @@ class eduPerson 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
*/ */
function display_html_attributes() { function display_html_attributes() {
$return = new htmlTable(); $return = new htmlTable();

View File

@ -250,9 +250,6 @@ class fixed_ip extends baseModule {
if ($invalid) { if ($invalid) {
$error = true; $error = true;
} }
else {
$this->attributes['dhcpHWAddress'][0] = "ethernet ". $_POST['mac'];
}
$this->fixed_ip[$id]['mac'] = $_POST['mac_'.$id]; $this->fixed_ip[$id]['mac'] = $_POST['mac_'.$id];
// Ip address // Ip address
@ -319,29 +316,28 @@ class fixed_ip 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('ERROR', _("Please fill out the DHCP settings first.")), true);
return $return;
} }
else { else {
// caption // caption
$return[] = array( $pcContainer = new htmlTable();
array('kind' => 'table', 'value' => array(array( $pcContainer->addElement(new htmlOutputText(_('PC name') . "*"));
array('kind' => 'text', 'text' => _('PC name') . "*"), $pcContainer->addElement(new htmlHelpLink('pc'));
array('kind' => 'help', 'value' => 'pc'), $return->addElement($pcContainer);
))), $macContainer = new htmlTable();
array('kind' => 'table', 'value' => array(array( $macContainer->addElement(new htmlOutputText(_('MAC address') . "*"));
array('kind' => 'text', 'text' => _('MAC address') . "*"), $macContainer->addElement(new htmlHelpLink('mac'));
array('kind' => 'help', 'value' => 'mac'), $return->addElement($macContainer);
))), $ipContainer = new htmlTable();
array('kind' => 'table', 'value' => array(array( $ipContainer->addElement(new htmlOutputText(_('IP address')));
array('kind' => 'text', 'text' => _('IP address')), $ipContainer->addElement(new htmlHelpLink('ip'));
array('kind' => 'help', 'value' => 'ip'), $return->addElement($ipContainer, true);
))),
array('kind' => 'text', 'text' => ''),
);
// Reset oberlaped ips // Reset oberlaped ips
$this->reset_overlapd_ip(); $this->reset_overlapd_ip();
@ -365,7 +361,7 @@ class fixed_ip extends baseModule {
elseif (in_array($this->fixed_ip[$id]['cn'], $pcs) ) { elseif (in_array($this->fixed_ip[$id]['cn'], $pcs) ) {
$pcError = _("This PC name already exists."); $pcError = _("This PC name already exists.");
} }
elseif (!preg_match("/^[A-Za-z0-9\._-]*$/",$_POST['pc_'.$id])) { elseif (isset($_POST['pc_'.$id]) && !preg_match("/^[A-Za-z0-9\._-]*$/", $_POST['pc_'.$id])) {
$pcError = _("The PC name may only contain A-Z, a-z and 0-9."); $pcError = _("The PC name may only contain A-Z, a-z and 0-9.");
} }
$pcs[] = $this->fixed_ip[$id]['cn']; $pcs[] = $this->fixed_ip[$id]['cn'];
@ -405,29 +401,19 @@ class fixed_ip extends baseModule {
if ($ipError != '') { if ($ipError != '') {
$error .= ' ' . $ipError; $error .= ' ' . $ipError;
} }
if ($error != '') { $return->addElement(new htmlInputField('pc_'.$id, $this->fixed_ip[$id]['cn']));
$error = '&nbsp;&laquo; ' . $error; $return->addElement(new htmlInputField('mac_'.$id, $this->fixed_ip[$id]['mac']));
} $return->addElement(new htmlInputField('ip_'.$id, $this->fixed_ip[$id]['ip']));
$return[] = array( $return->addElement(new htmlButton('drop_ip_'.$id, 'del.png', true));
array('kind' => 'input', 'name' => 'pc_'.$id, 'value' => $this->fixed_ip[$id]['cn']), $return->addElement(new htmlOutputText($error), true);
array('kind' => 'input', 'name' => 'mac_'.$id, 'value' => $this->fixed_ip[$id]['mac']),
array('kind' => 'input', 'name' => 'ip_'.$id, 'value' => $this->fixed_ip[$id]['ip']),
array('kind' => 'input', 'name' => 'drop_ip_'.$id, 'type' => 'submit', 'value' => ' ', 'image' => 'del.png'),
array('kind' => 'text', 'text'=>$error),
);
} }
$return[] = array( $return->addElement(new htmlSpacer(null, '10px'), true);
array('kind' => 'text', 'text' => ''),
);
// add fixed ip: // add fixed ip:
$return[] = array( $return->addElement(new htmlInputField('pc_add', ''));
array('kind' => 'input', 'name' => 'pc_add', 'value' => ''), $return->addElement(new htmlInputField('mac_add', ''));
array('kind' => 'input', 'name' => 'mac_add', 'value' => ''), $return->addElement(new htmlInputField('ip_add', ''));
array('kind' => 'input', 'name' => 'ip_add', 'value' => ''), $return->addElement(new htmlButton('add_ip', 'add.png', true));
array('kind' => 'input', 'name' => 'add_ip', 'type' => 'submit', 'value' => ' ', 'image' => 'add.png'),
);
} }
return $return; return $return;
} }

View File

@ -90,12 +90,9 @@ class hostObject extends baseModule {
$return['PDF_fields'] = array( $return['PDF_fields'] = array(
'hosts' => _('Host list') 'hosts' => _('Host list')
); );
$return['profile_options'] = array( $profileContainer = new htmlTable();
array( $profileContainer->addElement(new htmlTableExtendedInputCheckbox('hostObject_addExt', false, _('Automatically add this extension'), 'autoAdd'));
array('kind' => 'text', 'text' => _('Automatically add this extension') . ":"), $return['profile_options'] = $profileContainer;
array('kind' => 'input', 'name' => 'hostObject_addExt', 'type' => 'checkbox'),
array('kind' => 'help', 'value' => 'autoAdd')),
);
return $return; return $return;
} }
@ -129,42 +126,39 @@ class hostObject 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
*/ */
function display_html_attributes() { function display_html_attributes() {
if (isset($_POST['form_subpage_hostObject_attributes_addObjectClass'])) { if (isset($_POST['addObjectClass'])) {
$this->attributes['objectClass'][] = 'hostObject'; $this->attributes['objectClass'][] = 'hostObject';
} }
$return = array(); $return = new htmlTable();
if (in_array('hostObject', $this->attributes['objectClass'])) { if (in_array('hostObject', $this->attributes['objectClass'])) {
$hostCount = 0;
// list current hosts // list current hosts
for ($i = 0; $i < sizeof($this->attributes['host']); $i++) { if (isset($this->attributes['host'])) {
$return[] = array( $hostCount = sizeof($this->attributes['host']);
array('kind' => 'text', 'text' => _('Host')), for ($i = 0; $i < sizeof($this->attributes['host']); $i++) {
array('kind' => 'input', 'name' => 'host' . $i, 'type' => 'text', 'size' => '20', 'value' => $this->attributes['host'][$i]), $return->addElement(new htmlOutputText(_('Host')));
array('kind' => 'input', 'type' => 'submit', 'name' => 'delHost' . $i, 'title' => _("Remove"), 'value' => ' ', 'image' => 'del.png'), $return->addElement(new htmlInputField('host' . $i, $this->attributes['host'][$i]));
array('kind' => 'help', 'value' => 'host')); $return->addElement(new htmlButton('delHost' . $i, 'del.png', true));
$return->addElement(new htmlHelpLink('host'), true);
}
} }
// input box for new host // input box for new host
$return[] = array( $return->addElement(new htmlOutputText(_('New host')));
array('kind' => 'text', 'text' => _('New host')), $return->addElement(new htmlInputField('host', ''));
array('kind' => 'input', 'name' => 'host', 'type' => 'text', 'size' => '20', 'value' => ''), $return->addElement(new htmlButton('addHost', 'add.png', true));
array('kind' => 'input', 'type' => 'submit', 'name' => 'addHost', 'title' => _("Add"), 'value' => ' ', 'image' => 'add.png'), $return->addElement(new htmlHelpLink('host'));
array('kind' => 'help', 'value' => 'host'), $return->addElement(new htmlHiddenInput('host_number', $hostCount), true);
array('kind' => 'input', 'type' => 'hidden', 'value' => sizeof($this->attributes['host']), 'name' => 'host_number'));
$return[] = array( $return->addElement(new htmlSpacer(null, '10px'), true);
array('kind' => 'text', 'text' => '&nbsp;') $remButton = new htmlButton('remObjectClass', _('Remove host extension'));
); $remButton->colspan = 4;
$return[] = array( $return->addElement($remButton);
array('kind' => 'input', 'type' => 'submit', 'name' => 'form_subpage_hostObject_attributes_remObjectClass',
'value' => _('Remove host extension'), 'td' => array('colspan' => '4'))
);
} }
else { else {
$return[] = array( $return->addElement(new htmlButton('addObjectClass', _('Add host extension')));
array('kind' => 'text', 'text' => '&nbsp;'),
array('kind' => 'input', 'type' => 'submit', 'name' => 'form_subpage_hostObject_attributes_addObjectClass', 'value' => _('Add host extension'))
);
} }
return $return; return $return;
} }
@ -176,7 +170,7 @@ class hostObject extends baseModule {
* @return array list of info/error messages * @return array list of info/error messages
*/ */
function process_attributes() { function process_attributes() {
if (isset($_POST['form_subpage_hostObject_attributes_remObjectClass'])) { if (isset($_POST['remObjectClass'])) {
$this->attributes['objectClass'] = array_delete(array('hostObject'), $this->attributes['objectClass']); $this->attributes['objectClass'] = array_delete(array('hostObject'), $this->attributes['objectClass']);
if (isset($this->attributes['host'])) unset($this->attributes['host']); if (isset($this->attributes['host'])) unset($this->attributes['host']);
return array(); return array();

View File

@ -92,25 +92,33 @@ class ieee802Device 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
*/ */
function display_html_attributes() { function display_html_attributes() {
$return = array(); $return = new htmlTable();
$macCount = 0;
// list current MACs // list current MACs
for ($i = 0; $i < sizeof($this->attributes['macAddress']); $i++) { if (isset($this->attributes['macAddress'])) {
$return[] = array( $macCount = sizeof($this->attributes['macAddress']);
array('kind' => 'text', 'text' => _('MAC address')), for ($i = 0; $i < sizeof($this->attributes['macAddress']); $i++) {
array('kind' => 'input', 'name' => 'macAddress' . $i, 'type' => 'text', 'size' => '17', 'maxlength' => '17', 'value' => $this->attributes['macAddress'][$i]), $return->addElement(new htmlOutputText(_('MAC address')));
array('kind' => 'input', 'type' => 'submit', 'name' => 'delMAC' . $i, 'value' => ' ', 'title' => _("Remove"), 'image' => 'del.png'), $macInput = new htmlInputField('macAddress' . $i, $this->attributes['macAddress'][$i]);
array('kind' => 'help', 'value' => 'mac')); $macInput->setFieldSize(17);
$macInput->setFieldMaxLength(17);
$return->addElement($macInput);
$return->addElement(new htmlButton('delMAC' . $i, 'del.png', true));
$return->addElement(new htmlHelpLink('mac'), true);
}
} }
// input box for new MAC // input box for new MAC
$return[] = array( $return->addElement(new htmlOutputText(_('New MAC address')));
array('kind' => 'text', 'text' => _('New MAC address')), $newMacInput = new htmlInputField('macAddress', '');
array('kind' => 'input', 'name' => 'macAddress', 'type' => 'text', 'size' => '17', 'maxlength' => '17', 'value' => ''), $newMacInput->setFieldSize(17);
array('kind' => 'input', 'type' => 'submit', 'name' => 'addMAC', 'title' => _("Add"), 'value' => ' ', 'image' => 'add.png'), $newMacInput->setFieldMaxLength(17);
array('kind' => 'help', 'value' => 'mac'), $return->addElement($newMacInput);
array('kind' => 'input', 'type' => 'hidden', 'value' => sizeof($this->attributes['macAddress']), 'name' => 'mac_number')); $return->addElement(new htmlButton('addMAC', 'add.png', true));
$return->addElement(new htmlHelpLink('mac'));
$return->addElement(new htmlHiddenInput('mac_number', $macCount));
return $return; return $return;
} }