use new meta HTML classes

This commit is contained in:
Roland Gruber 2010-09-14 18:25:36 +00:00
parent bf8ec949f5
commit f2b13006fc
1 changed files with 40 additions and 47 deletions

View File

@ -100,33 +100,19 @@ class asteriskAccount extends baseModule implements passwordService {
"Text" => _("Authentication realm for Asterisk server (default: asterisk). This value set in sip.conf (option: \"realm\").") "Text" => _("Authentication realm for Asterisk server (default: asterisk). This value set in sip.conf (option: \"realm\").")
), ),
); );
// config options // config options
$return['config_options']['user'] = array( $configContainer = new htmlTable();
array( $configContainer->addElement(new htmlTableExtendedInputField(_('Asterisk realm'), 'asteriskAccount_AsteriskRealm', null, 'AsteriskRealm'));
array('kind' => 'text', 'text' => _('Asterisk realm')), $return['config_options']['user'] = $configContainer;
array('kind' => 'input', 'name' => 'asteriskAccount_AsteriskRealm', 'type' => 'text', 'size' => '30', 'maxlength' => '255'),
array('kind' => 'help', 'value' => 'AsteriskRealm')
)
);
// self service options // self service options
$return['selfServiceSettings'] = array( $selfServiceContainer = new htmlTable();
array( $selfServiceContainer->addElement(new htmlTableExtendedInputField(_('Asterisk realm'), 'asteriskAccount_AsteriskRealm', null, 'AsteriskRealm'));
array('kind' => 'text', 'text' => _('Asterisk realm')), $return['selfServiceSettings'] = $selfServiceContainer;
array('kind' => 'input', 'name' => 'asteriskAccount_AsteriskRealm', 'type' => 'text', 'size' => '30', 'maxlength' => '255'),
array('kind' => 'help', 'value' => 'AsteriskRealm')
)
);
// profile options // profile options
$return['profile_options'] = array( $profileContainer = new htmlTable();
array( $profileContainer->addElement(new htmlTableExtendedInputField(_('Host'), 'asteriskAccount_AstAccountHost', null, 'AstAccountHost'), true);
array('kind' => 'text', 'text' => _('Host') . ":"), $profileContainer->addElement(new htmlTableExtendedInputField(_('Account context'), 'asteriskAccount_AstAccountContext', null, 'AstAccountContext'), true);
array('kind' => 'input', 'name' => 'asteriskAccount_AstAccountHost', 'type' => 'text', 'size' => '30'), $return['profile_options'] = $profileContainer;
array('kind' => 'help', 'value' => 'AstAccountHost')),
array(
array('kind' => 'text', 'text' => _('Account context') . ":"),
array('kind' => 'input', 'name' => 'asteriskAccount_AstAccountContext', 'type' => 'text', 'size' => '30'),
array('kind' => 'help', 'value' => 'AstAccountContext'))
);
// profile mappings // profile mappings
$return['profile_mappings'] = array( $return['profile_mappings'] = array(
'asteriskAccount_AstAccountHost' => 'AstAccountHost', 'asteriskAccount_AstAccountHost' => 'AstAccountHost',
@ -193,32 +179,39 @@ class asteriskAccount 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() {
if (isset($_POST['form_subpage_' . get_class($this) . '_attributes_addObjectClass'])) { if (isset($_POST['addObjectClass'])) {
$this->attributes['objectClass'][] = 'AsteriskSIPUser'; $this->attributes['objectClass'][] = 'AsteriskSIPUser';
} }
$return = array(); $return = new htmlTable();
if (in_array('AsteriskSIPUser', $this->attributes['objectClass'])) { if (in_array('AsteriskSIPUser', $this->attributes['objectClass'])) {
$return[] = array( // caller ID
array('kind' => 'text', 'text' => _("Caller ID").'*'), $callerId = '';
array('kind' => 'input', 'name' => 'AstAccountCallerID', 'type' => 'text', 'size' => '30', 'value' => $this->attributes['AstAccountCallerID'][0]), if (isset($this->attributes['AstAccountCallerID'][0])) {
array('kind' => 'help', 'value' => 'AstAccountCallerID')); $callerId = $this->attributes['AstAccountCallerID'][0];
$return[] = array( }
array('kind' => 'text', 'text' => _("Host").'*'), $callerIdInput = new htmlTableExtendedInputField(_("Caller ID"), 'AstAccountCallerID', $callerId, 'AstAccountCallerID');
array('kind' => 'input', 'name' => 'AstAccountHost', 'type' => 'text', 'size' => '30', 'value' => $this->attributes['AstAccountHost'][0]), $callerIdInput->setRequired(true);
array('kind' => 'help', 'value' => 'AstAccountHost')); $return->addElement($callerIdInput, true);
// host
$return[] = array(array('kind' => 'text', 'td' => array('colspan' => 3))); $host = '';
if (isset($this->attributes['AstAccountHost'][0])) {
$return[] = array( $host = $this->attributes['AstAccountHost'][0];
array('kind' => 'text', 'text' => _("Account context").'*'), }
array('kind' => 'input', 'name' => 'AstAccountContext', 'type' => 'text', 'size' => '30', 'value' => $this->attributes['AstAccountContext'][0]), $hostInput = new htmlTableExtendedInputField(_("Host"), 'AstAccountHost', $host, 'AstAccountHost');
array('kind' => 'help', 'value' => 'AstAccountContext')); $hostInput->setRequired(true);
}else { $return->addElement($hostInput, true);
$return[] = array( // context
array('kind' => 'text', 'text' => ' '), $context = '';
array('kind' => 'input', 'type' => 'submit', 'name' => 'form_subpage_' . get_class($this) . '_attributes_addObjectClass', 'value' => _('Add Asterisk account')) if (isset($this->attributes['AstAccountContext'][0])) {
); $context = $this->attributes['AstAccountContext'][0];
}
$contextInput = new htmlTableExtendedInputField(_("Account context"), 'AstAccountContext', $context, 'AstAccountContext');
$contextInput->setRequired(true);
$return->addElement($contextInput, true);
}
else {
$return->addElement(new htmlButton('addObjectClass', _('Add Asterisk account')));
} }
return $return; return $return;
} }