use new meta HTML classes

This commit is contained in:
Roland Gruber 2010-09-15 18:31:56 +00:00
parent f95b3a3d70
commit bb5619dc54
2 changed files with 69 additions and 58 deletions

View File

@ -327,7 +327,9 @@ class asteriskExtension extends baseModule {
$return->addElement(new htmlSubTitle(_("Extension owners")), true); $return->addElement(new htmlSubTitle(_("Extension owners")), true);
$return->addElement($ownerContent, true); $return->addElement($ownerContent, true);
// back button // back button
$return->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'back', _('Ok'))); $backButton = new htmlAccountPageButton(get_class($this), 'attributes', 'back', _('Ok'));
$backButton->colspan = 3;
$return->addElement($backButton);
return $return; return $return;
} }

View File

@ -112,20 +112,11 @@ class asteriskVoicemail extends baseModule implements passwordService {
), ),
); );
// profile options // profile options
$return['profile_options'] = array( $profileContainer = new htmlTable();
array( $profileContainer->addElement(new htmlTableExtendedInputField(_('Options'), 'asteriskVoicemail_AstVoicemailOptions', null, 'AstVoicemailOptions'), true);
array('kind' => 'text', 'text' => _('Options') . ":"), $profileContainer->addElement(new htmlTableExtendedInputField(_('Voicemail context'), 'asteriskVoicemail_AstVoicemailContext', null, 'AstVoicemailContext'), true);
array('kind' => 'input', 'name' => 'asteriskVoicemail_AstVoicemailOptions', 'type' => 'text', 'size' => '30'), $profileContainer->addElement(new htmlTableExtendedInputField(_('Account context'), 'asteriskVoicemail_AstContext', null, 'AstContext'), true);
array('kind' => 'help', 'value' => 'AstVoicemailOptions')), $return['profile_options'] = $profileContainer;
array(
array('kind' => 'text', 'text' => _('Voicemail context') . ":"),
array('kind' => 'input', 'name' => 'asteriskVoicemail_AstVoicemailContext', 'type' => 'text', 'size' => '30'),
array('kind' => 'help', 'value' => 'AstContext')),
array(
array('kind' => 'text', 'text' => _('Account context') . ":"),
array('kind' => 'input', 'name' => 'asteriskVoicemail_AstContext', 'type' => 'text', 'size' => '30'),
array('kind' => 'help', 'value' => 'AstContext'))
);
// profile mappings // profile mappings
$return['profile_mappings'] = array( $return['profile_mappings'] = array(
'asteriskVoicemail_AstContext' => 'AstContext', 'asteriskVoicemail_AstContext' => 'AstContext',
@ -228,53 +219,71 @@ class asteriskVoicemail extends baseModule implements passwordService {
* 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.
*/ */
function display_html_attributes() { function display_html_attributes() {
$return = array(); $return = new htmlTable();
if (in_array('AsteriskVoiceMail', $this->attributes['objectClass'])) { if (in_array('AsteriskVoiceMail', $this->attributes['objectClass'])) {
if (!isset($this->attributes['AstVoicemailPassword'])) { if (!isset($this->attributes['AstVoicemailPassword'])) {
call_user_func_array('StatusMessage', $this->messages['AstVoicemailPassword'][0]); $message = new htmlStatusMessage($this->messages['AstVoicemailPassword'][0][0], $this->messages['AstVoicemailPassword'][0][1]);
$return[] = array(array('kind' => 'text', 'td' => array('colspan' => 3))); $message->colspan = 3;
$return->addElement($message, true);
} }
$return[] = array( // mailbox
array('kind' => 'text', 'text' => _("Mailbox").'*'), $mailbox = '';
array('kind' => 'input', 'name' => 'AstVoicemailMailbox', 'type' => 'text', 'size' => '30', 'value' => $this->attributes['AstVoicemailMailbox'][0]), if (isset($this->attributes['AstVoicemailMailbox'][0])) {
array('kind' => 'help', 'value' => 'AstVoicemailMailbox')); $mailbox = $this->attributes['AstVoicemailMailbox'][0];
$return[] = array( }
array('kind' => 'text', 'text' => _("Account context").'*'), $mailboxInput = new htmlTableExtendedInputField(_("Mailbox"), 'AstVoicemailMailbox', $mailbox, 'AstVoicemailMailbox');
array('kind' => 'input', 'name' => 'AstContext', 'type' => 'text', 'size' => '30', 'value' => $this->attributes['AstContext'][0]), $mailboxInput->setRequired(true);
array('kind' => 'help', 'value' => 'AstContext')); $return->addElement($mailboxInput, true);
// account context
$acctContext = '';
if (isset($this->attributes['AstContext'][0])) {
$acctContext = $this->attributes['AstContext'][0];
}
$acctContextInput = new htmlTableExtendedInputField(_("Account context"), 'AstContext', $acctContext, 'AstContext');
$acctContextInput->setRequired(true);
$return->addElement($acctContextInput, true);
$return[] = array(array('kind' => 'text', 'td' => array('colspan' => 3))); $return->addElement(new htmlSpacer(null, '10px'), true);
$return[] = array( // full name
array('kind' => 'text', 'text' => _("Full name")), $name = '';
array('kind' => 'input', 'name' => 'AstVoicemailFullname', 'type' => 'text', 'size' => '30', 'value' => $this->attributes['AstVoicemailFullname'][0]), if (isset($this->attributes['AstVoicemailFullname'][0])) {
array('kind' => 'help', 'value' => 'AstVoicemailFullname')); $name = $this->attributes['AstVoicemailFullname'][0];
$return[] = array( }
array('kind' => 'text', 'text' => _("Email address")), $return->addElement(new htmlTableExtendedInputField(_("Full name"), 'AstVoicemailFullname', $name, 'AstVoicemailFullname'), true);
array('kind' => 'input', 'name' => 'AstVoicemailEmail', 'type' => 'text', 'size' => '30', 'value' => $this->attributes['AstVoicemailEmail'][0]), // email
array('kind' => 'help', 'value' => 'AstVoicemailEmail')); $email = '';
$return[] = array( if (isset($this->attributes['AstVoicemailEmail'][0])) {
array('kind' => 'text', 'text' => _("Pager")), $email = $this->attributes['AstVoicemailEmail'][0];
array('kind' => 'input', 'name' => 'AstVoicemailPager', 'type' => 'text', 'size' => '30', 'value' => $this->attributes['AstVoicemailPager'][0]), }
array('kind' => 'help', 'value' => 'AstVoicemailPager')); $return->addElement(new htmlTableExtendedInputField(_("Email address"), 'AstVoicemailEmail', $email, 'AstVoicemailEmail'), true);
$return[] = array( // pager
array('kind' => 'text', 'text' => _("Options")), $pager = '';
array('kind' => 'input', 'name' => 'AstVoicemailOptions', 'type' => 'text', 'size' => '30', 'value' => $this->attributes['AstVoicemailOptions'][0]), if (isset($this->attributes['AstVoicemailPager'][0])) {
array('kind' => 'help', 'value' => 'AstVoicemailOptions')); $pager = $this->attributes['AstVoicemailPager'][0];
$return[] = array( }
array('kind' => 'text', 'text' => _("Voicemail context")), $return->addElement(new htmlTableExtendedInputField(_("Pager"), 'AstVoicemailPager', $pager, 'AstVoicemailPager'), true);
array('kind' => 'input', 'name' => 'AstVoicemailContext', 'type' => 'text', 'size' => '30', 'value' => $this->attributes['AstVoicemailContext'][0]), // options
array('kind' => 'help', 'value' => 'AstVoicemailContext')); $options = '';
$return[] = array( if (isset($this->attributes['AstVoicemailOptions'][0])) {
array('kind' => 'text', 'text' => ' '), $options = $this->attributes['AstVoicemailOptions'][0];
array('kind' => 'input', 'type' => 'submit', 'name' => 'form_subpage_' . get_class($this) . '_attributes_remVoicemailObjectClass', 'value' => _('Remove Asterisk voicemail extension')) }
); $return->addElement(new htmlTableExtendedInputField(_("Options"), 'AstVoicemailOptions', $options, 'AstVoicemailOptions'), true);
// voicemail context
$voiceContext = '';
if (isset($this->attributes['AstVoicemailContext'][0])) {
$voiceContext = $this->attributes['AstVoicemailContext'][0];
}
$return->addElement(new htmlTableExtendedInputField(_("Voicemail context"), 'AstVoicemailContext', $voiceContext, 'AstVoicemailContext'), true);
// remove button
$return->addElement(new htmlSpacer(null, '10px'), true);
$remButton = new htmlButton('remVoicemailObjectClass', _('Remove Asterisk voicemail extension'));
$remButton->colspan = 2;
$return->addElement($remButton);
} }
else { else {
$return[] = array( // add button
array('kind' => 'text', 'text' => ' '), $return->addElement(new htmlButton('addVoicemailObjectClass', _('Add Asterisk voicemail extension')));
array('kind' => 'input', 'type' => 'submit', 'name' => 'form_subpage_' . get_class($this) . '_attributes_addVoicemailObjectClass', 'value' => _('Add Asterisk voicemail extension'))
);
} }
return $return; return $return;
} }
@ -283,12 +292,12 @@ class asteriskVoicemail extends baseModule implements passwordService {
* Write variables into object and do some regex checks * Write variables into object and do some regex checks
*/ */
function process_attributes() { function process_attributes() {
if (isset($_POST['form_subpage_' . get_class($this) . '_attributes_addVoicemailObjectClass'])) { if (isset($_POST['addVoicemailObjectClass'])) {
$this->attributes['objectClass'][] = 'AsteriskVoiceMail'; $this->attributes['objectClass'][] = 'AsteriskVoiceMail';
return array(); return array();
} }
// remove extension // remove extension
elseif (isset($_POST['form_subpage_' . get_class($this) . '_attributes_remVoicemailObjectClass'])) { elseif (isset($_POST['remVoicemailObjectClass'])) {
$this->attributes['objectClass'] = array_delete(array('AsteriskVoiceMail'), $this->attributes['objectClass']); $this->attributes['objectClass'] = array_delete(array('AsteriskVoiceMail'), $this->attributes['objectClass']);
$attrKeys = array_keys($this->attributes); $attrKeys = array_keys($this->attributes);
for ($k = 0; $k < sizeof($attrKeys); $k++) { for ($k = 0; $k < sizeof($attrKeys); $k++) {