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() {
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.
*
* @param array $_POST HTTP-POST values
* @return htmlElement HTML meta data
*/
function display_html_attributes() {
$return = new htmlTable();
@ -270,7 +270,7 @@ class asteriskExtension extends baseModule {
/**
* 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() {
$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() {
$return = new htmlTable();

View File

@ -326,7 +326,7 @@ class ddns extends baseModule {
/**
* 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() {
$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.
*
* @return array HTML meta data
* @return htmlElement HTML meta data
*/
public function display_html_attributes() {
// 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.
*
* @return array HTML meta data
* @return htmlElement HTML meta data
*/
function display_html_attributes() {
$return = new htmlTable();

View File

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

View File

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

View File

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