use new meta HTML classes

This commit is contained in:
Roland Gruber 2010-09-17 18:27:20 +00:00
parent eee262e0e7
commit 7a258a47fb
1 changed files with 99 additions and 124 deletions

View File

@ -128,12 +128,9 @@ class eduPerson extends baseModule {
"Text" => _("This will enable the extension automatically if this profile is loaded.") "Text" => _("This will enable the extension automatically if this profile is loaded.")
)); ));
// profile options // profile options
$return['profile_options'] = array( $profileContainer = new htmlTable();
array( $profileContainer->addElement(new htmlTableExtendedInputCheckbox('eduPerson_addExt', false, _('Automatically add this extension'), 'autoAdd'));
array('kind' => 'text', 'text' => _('Automatically add this extension') . ":"), $return['profile_options'] = $profileContainer;
array('kind' => 'input', 'name' => 'eduPerson_addExt', 'type' => 'checkbox'),
array('kind' => 'help', 'value' => 'autoAdd')),
);
// upload fields // upload fields
$return['upload_columns'] = array( $return['upload_columns'] = array(
array( array(
@ -232,28 +229,20 @@ class eduPerson extends baseModule {
* @return array HTML meta data * @return array HTML meta data
*/ */
function display_html_attributes() { function display_html_attributes() {
$return = array(); $return = new htmlTable();
if (in_array('eduPerson', $this->attributes['objectClass'])) { if (in_array('eduPerson', $this->attributes['objectClass'])) {
// principal name // principal name
$principal = ''; $principal = '';
if (isset($this->attributes['eduPersonPrincipalName'][0])) { if (isset($this->attributes['eduPersonPrincipalName'][0])) {
$principal = $this->attributes['eduPersonPrincipalName'][0]; $principal = $this->attributes['eduPersonPrincipalName'][0];
} }
$return[] = array( $return->addElement(new htmlTableExtendedInputField(_('Principal name'), 'principalName', $principal, 'principalName'), true);
array('kind' => 'text', 'text' => _('Principal name')),
array('kind' => 'input', 'type' => 'text', 'name' => 'principalName', 'value' => $principal),
array('kind' => 'help', 'value' => 'principalName')
);
// primary affiliation // primary affiliation
$primaryAffiliation = array(); $primaryAffiliation = array();
if (isset($this->attributes['eduPersonPrimaryAffiliation'][0])) { if (isset($this->attributes['eduPersonPrimaryAffiliation'][0])) {
$primaryAffiliation = array($this->attributes['eduPersonPrimaryAffiliation'][0]); $primaryAffiliation = array($this->attributes['eduPersonPrimaryAffiliation'][0]);
} }
$return[] = array( $return->addElement(new htmlTableExtendedSelect('primaryAffiliation', $this->affiliationTypes, $primaryAffiliation, _('Primary affiliation'), 'primaryAffiliation'), true);
array('kind' => 'text', 'text' => _('Primary affiliation')),
array('kind' => 'select', 'name' => 'primaryAffiliation', 'options' => $this->affiliationTypes, 'options_selected' => $primaryAffiliation),
array('kind' => 'help', 'value' => 'primaryAffiliation')
);
// scoped affiliation // scoped affiliation
$scopedAffiliation = ''; $scopedAffiliation = '';
$scopedAffiliationPrefix = array(); $scopedAffiliationPrefix = array();
@ -262,151 +251,137 @@ class eduPerson extends baseModule {
$scopedAffiliationPrefix = array($parts[0]); $scopedAffiliationPrefix = array($parts[0]);
$scopedAffiliation = substr($this->attributes['eduPersonScopedAffiliation'][0], strlen($parts[0]) + 1); $scopedAffiliation = substr($this->attributes['eduPersonScopedAffiliation'][0], strlen($parts[0]) + 1);
} }
$return[] = array( $return->addElement(new htmlOutputText(_('Scoped affiliation')));
array('kind' => 'text', 'text' => _('Scoped affiliation')), $scopedAffiliationContainer = new htmlTable();
array('kind' => 'table', 'value' => array(array( $scopedAffiliationContainer->addElement(new htmlSelect('scopedAffiliationPrefix', $this->affiliationTypes, $scopedAffiliationPrefix));
array('kind' => 'select', 'name' => 'scopedAffiliationPrefix', 'options' => $this->affiliationTypes, 'options_selected' => $scopedAffiliationPrefix), $scopedAffiliationContainer->addElement(new htmlOutputText('@'));
array('kind' => 'text', 'text' => '@'), $scopedAffiliationContainer->addElement(new htmlInputField('scopedAffiliation', $scopedAffiliation));
array('kind' => 'input', 'type' => 'text', 'name' => 'scopedAffiliation', 'value' => $scopedAffiliation) $return->addElement($scopedAffiliationContainer);
))), $return->addElement(new htmlHelpLink('scopedAffiliation'), true);
array('kind' => 'help', 'value' => 'scopedAffiliation')
);
// affiliations // affiliations
$affiliations = array(); $affiliations = new htmlTable();
if (isset($this->attributes['eduPersonAffiliation'][0])) { if (isset($this->attributes['eduPersonAffiliation'][0])) {
for ($i = 0; $i < sizeof($this->attributes['eduPersonAffiliation']); $i++) { for ($i = 0; $i < sizeof($this->attributes['eduPersonAffiliation']); $i++) {
$affiliations[] = array( $affiliations->addElement(new htmlSelect('affiliation' . $i, $this->affiliationTypes, array($this->attributes['eduPersonAffiliation'][$i])));
array('kind' => 'select', 'name' => 'affiliation' . $i, 'options' => $this->affiliationTypes, 'options_selected' => array($this->attributes['eduPersonAffiliation'][$i])), $affiliationButton = new htmlButton('delAffiliation' . $i, 'del.png', true);
array('kind' => 'input', 'type' => 'submit', 'name' => 'delAffiliation' . $i, 'image' => 'del.png', 'value' => ' ', 'title' => _('Delete')) $affiliations->addElement($affiliationButton, true);
);
} }
} }
else { else {
$affiliations = array(array(array('kind' => 'text', 'text' => '-'))); $affiliations->addElement(new htmlOutputText('-'), true);
} }
$return[] = array( $affiliationLabel = new htmlOutputText(_('Affiliations'));
array('kind' => 'text', 'text' => _('Affiliations'), 'td' => array('valign' => 'top')), $affiliationLabel->alignment = htmlElement::ALIGN_TOP;
array('kind' => 'table', 'value' => $affiliations), $return->addElement($affiliationLabel);
array('kind' => 'help', 'value' => 'affiliation', 'td' => array('valign' => 'top')) $return->addElement($affiliations);
); $affiliationHelp = new htmlHelpLink('affiliation');
$return[] = array( $affiliationHelp->alignment = htmlElement::ALIGN_TOP;
array('kind' => 'text', 'text' => ' '), $return->addElement($affiliationHelp, true);
array('kind' => 'table', 'value' => array(array( $return->addElement(new htmlOutputText(''));
array('kind' => 'select', 'name' => 'affiliation', 'options' => $this->affiliationTypes), $newAffiliationContainer = new htmlTable();
array('kind' => 'input', 'type' => 'submit', 'name' => 'newAffiliation', 'image' => 'add.png', 'value' => ' ', 'title' => _('Add')) $newAffiliationContainer->addElement(new htmlSelect('affiliation', $this->affiliationTypes));
))), $newAffiliationContainer->addElement(new htmlButton('newAffiliation', 'add.png', true));
array('kind' => 'text', 'text' => ' ')); $return->addElement($newAffiliationContainer);
$return->addElement(new htmlOutputText(''), true);
// nick names // nick names
$nicks = array(); $nicks = new htmlTable();
if (isset($this->attributes['eduPersonNickname'][0])) { if (isset($this->attributes['eduPersonNickname'][0])) {
for ($i = 0; $i < sizeof($this->attributes['eduPersonNickname']); $i++) { for ($i = 0; $i < sizeof($this->attributes['eduPersonNickname']); $i++) {
$nicks[] = array( $nicks->addElement(new htmlInputField('nickName' . $i, $this->attributes['eduPersonNickname'][$i]));
array('kind' => 'input', 'name' => 'nickName' . $i, 'type' => 'text', 'value' => $this->attributes['eduPersonNickname'][$i]), $nicks->addElement(new htmlButton('delNickName' . $i, 'del.png', true), true);
array('kind' => 'input', 'type' => 'submit', 'name' => 'delNickName' . $i, 'image' => 'del.png', 'value' => ' ', 'title' => _('Delete'))
);
} }
} }
else { else {
$nicks = array(array(array('kind' => 'text', 'text' => '-'))); $nicks->addElement(new htmlOutputText('-'), true);
} }
$return[] = array( $nickLabel = new htmlOutputText(_('Nick names'));
array('kind' => 'text', 'text' => _('Nick names'), 'td' => array('valign' => 'top')), $nickLabel->alignment = htmlElement::ALIGN_TOP;
array('kind' => 'table', 'value' => $nicks), $return->addElement($nickLabel);
array('kind' => 'help', 'value' => 'nickName', 'td' => array('valign' => 'top')) $return->addElement($nicks);
); $nickHelp = new htmlHelpLink('nickName');
$return[] = array( $nickHelp->alignment = htmlElement::ALIGN_TOP;
array('kind' => 'text', 'text' => ' '), $return->addElement($nickHelp, true);
array('kind' => 'table', 'value' => array(array( $return->addElement(new htmlOutputText(''));
array('kind' => 'input', 'name' => 'nickName', 'type' => 'text', 'value' => ''), $newNickContainer = new htmlTable();
array('kind' => 'input', 'type' => 'submit', 'name' => 'newNickName', 'image' => 'add.png', 'value' => ' ', 'title' => _('Add')) $newNickContainer->addElement(new htmlInputField('nickName', ''));
))), $newNickContainer->addElement(new htmlButton('newNickName', 'add.png', true));
array('kind' => 'text', 'text' => ' ') $return->addElement($newNickContainer);
); $return->addElement(new htmlOutputText(''), true);
// entitlements // entitlements
$entitlements = array(); $entitlements = new htmlTable();
if (isset($this->attributes['eduPersonEntitlement'][0])) { if (isset($this->attributes['eduPersonEntitlement'][0])) {
for ($i = 0; $i < sizeof($this->attributes['eduPersonEntitlement']); $i++) { for ($i = 0; $i < sizeof($this->attributes['eduPersonEntitlement']); $i++) {
$entitlements[] = array( $entitlements->addElement(new htmlInputField('entitlement' . $i, $this->attributes['eduPersonEntitlement'][$i]));
array('kind' => 'input', 'name' => 'entitlement' . $i, 'type' => 'text', 'value' => $this->attributes['eduPersonEntitlement'][$i]), $entitlements->addElement(new htmlButton('delEntitlement' . $i, 'del.png', true), true);
array('kind' => 'input', 'type' => 'submit', 'name' => 'delEntitlement' . $i, 'image' => 'del.png', 'value' => ' ', 'title' => _('Delete'))
);
} }
} }
else { else {
$entitlements = array(array(array('kind' => 'text', 'text' => '-'))); $entitlements->addElement(new htmlOutputText('-'));
} }
$return[] = array( $entitlementLabel = new htmlOutputText(_('Entitlements'));
array('kind' => 'text', 'text' => _('Entitlements'), 'td' => array('valign' => 'top')), $entitlementLabel->alignment = htmlElement::ALIGN_TOP;
array('kind' => 'table', 'value' => $entitlements), $return->addElement($entitlementLabel);
array('kind' => 'help', 'value' => 'entitlement', 'td' => array('valign' => 'top')) $return->addElement($entitlements);
); $entitlementHelp = new htmlHelpLink('entitlement');
$return[] = array( $entitlementHelp->alignment = htmlElement::ALIGN_TOP;
array('kind' => 'text', 'text' => ' '), $return->addElement($entitlementHelp, true);
array('kind' => 'table', 'value' => array(array( $return->addElement(new htmlOutputText(''));
array('kind' => 'input', 'name' => 'entitlement', 'type' => 'text', 'value' => ''), $newEntitlementContainer = new htmlTable();
array('kind' => 'input', 'type' => 'submit', 'name' => 'newEntitlement', 'image' => 'add.png', 'value' => ' ', 'title' => _('Add')) $newEntitlementContainer->addElement(new htmlInputField('entitlement', ''));
))), $newEntitlementContainer->addElement(new htmlButton('newEntitlement', 'add.png', true));
array('kind' => 'text', 'text' => ' ') $return->addElement($newEntitlementContainer);
); $return->addElement(new htmlOutputText(''), true);
// org DN // org DN
$orgDN = ''; $orgDN = '';
if (isset($this->attributes['eduPersonOrgDN'][0])) { if (isset($this->attributes['eduPersonOrgDN'][0])) {
$orgDN = $this->attributes['eduPersonOrgDN'][0]; $orgDN = $this->attributes['eduPersonOrgDN'][0];
} }
$return[] = array( $orgDNInput = new htmlTableExtendedInputField(_('Organization'), 'orgDN', $orgDN, 'orgDN');
array('kind' => 'text', 'text' => _('Organization')), $orgDNInput->setFieldSize(40);
array('kind' => 'input', 'type' => 'text', 'size' => '40', 'name' => 'orgDN', 'value' => $orgDN), $return->addElement($orgDNInput, true);
array('kind' => 'help', 'value' => 'orgDN')
);
// primare OU DN // primare OU DN
$primaryOrgUnitDN = ''; $primaryOrgUnitDN = '';
if (isset($this->attributes['eduPersonPrimaryOrgUnitDN'][0])) { if (isset($this->attributes['eduPersonPrimaryOrgUnitDN'][0])) {
$primaryOrgUnitDN = $this->attributes['eduPersonPrimaryOrgUnitDN'][0]; $primaryOrgUnitDN = $this->attributes['eduPersonPrimaryOrgUnitDN'][0];
} }
$return[] = array( $primaryOUInput = new htmlTableExtendedInputField(_('Primary organizational unit'), 'primaryOrgUnitDN', $primaryOrgUnitDN, 'primaryOrgUnitDN');
array('kind' => 'text', 'text' => _('Primary organizational unit')), $primaryOUInput->setFieldSize(40);
array('kind' => 'input', 'type' => 'text', 'size' => '40', 'name' => 'primaryOrgUnitDN', 'value' => $primaryOrgUnitDN), $return->addElement($primaryOUInput, true);
array('kind' => 'help', 'value' => 'primaryOrgUnitDN')
);
// OUs // OUs
$orgUnitDN = array(); $orgUnitDN = new htmlTable();
if (isset($this->attributes['eduPersonOrgUnitDN'][0])) { if (isset($this->attributes['eduPersonOrgUnitDN'][0])) {
for ($i = 0; $i < sizeof($this->attributes['eduPersonOrgUnitDN']); $i++) { for ($i = 0; $i < sizeof($this->attributes['eduPersonOrgUnitDN']); $i++) {
$orgUnitDN[] = array( $orgUnitDNInput = new htmlInputField('orgUnitDN' . $i, $this->attributes['eduPersonOrgUnitDN'][$i]);
array('kind' => 'input', 'name' => 'orgUnitDN' . $i, 'type' => 'text', 'value' => $this->attributes['eduPersonOrgUnitDN'][$i], 'size' => '40'), $orgUnitDNInput->setFieldSize(40);
array('kind' => 'input', 'type' => 'submit', 'name' => 'delOrgUnitDN' . $i, 'image' => 'del.png', 'value' => ' ', 'title' => _('Delete')) $orgUnitDN->addElement($orgUnitDNInput);
); $orgUnitDN->addElement(new htmlButton('delOrgUnitDN' . $i, 'del.png', true), true);
} }
} }
else { else {
$orgUnitDN = array(array(array('kind' => 'text', 'text' => '-'))); $orgUnitDN->addElement(new htmlOutputText('-'));
} }
$return[] = array( $orgUnitDNLabel = new htmlOutputText(_('Organizational units'));
array('kind' => 'text', 'text' => _('Organizational units'), 'td' => array('valign' => 'top')), $orgUnitDNLabel->alignment = htmlElement::ALIGN_TOP;
array('kind' => 'table', 'value' => $orgUnitDN), $return->addElement($orgUnitDNLabel);
array('kind' => 'help', 'value' => 'orgUnitDN', 'td' => array('valign' => 'top')) $return->addElement($orgUnitDN);
); $orgUnitDNHelp = new htmlHelpLink('orgUnitDN');
$return[] = array( $orgUnitDNHelp->alignment = htmlElement::ALIGN_TOP;
array('kind' => 'text', 'text' => ' '), $return->addElement($orgUnitDNHelp, true);
array('kind' => 'table', 'value' => array(array( $return->addElement(new htmlOutputText(''));
array('kind' => 'input', 'name' => 'orgUnitDN', 'type' => 'text', 'value' => '', 'size' => '40'), $newOrgUnitDN = new htmlTable();
array('kind' => 'input', 'type' => 'submit', 'name' => 'newOrgUnitDN', 'image' => 'add.png', 'value' => ' ', 'title' => _('Add')) $newOrgUnitDNInput = new htmlInputField('orgUnitDN', '');
))), $newOrgUnitDNInput->setFieldSize(40);
array('kind' => 'text', 'text' => ' ') $newOrgUnitDN->addElement($newOrgUnitDNInput);
); $newOrgUnitDN->addElement(new htmlButton('newOrgUnitDN', 'add.png', true));
$return[] = array( $return->addElement($newOrgUnitDN);
array('kind' => 'text', 'text' => '&nbsp;') $return->addElement(new htmlOutputText(''), true);
); $return->addElement(new htmlSpacer(null, '10px'), true);
$return[] = array( $addButton = new htmlButton('remObjectClass', _('Remove EDU person extension'));
array('kind' => 'input', 'type' => 'submit', 'name' => 'form_subpage_eduPerson_attributes_remObjectClass', $addButton->colspan = 3;
'value' => _('Remove EDU person extension'), 'td' => array('colspan' => '3')) $return->addElement($addButton);
);
} }
else { else {
$return[] = array( $return->addElement(new htmlButton('addObjectClass', _('Add EDU person extension')));
array('kind' => 'text', 'text' => '&nbsp;'),
array('kind' => 'input', 'type' => 'submit', 'name' => 'form_subpage_eduPerson_attributes_addObjectClass', 'value' => _('Add EDU person extension'))
);
} }
return $return; return $return;
} }
@ -418,11 +393,11 @@ class eduPerson 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_eduPerson_attributes_addObjectClass'])) { if (isset($_POST['addObjectClass'])) {
$this->attributes['objectClass'][] = 'eduPerson'; $this->attributes['objectClass'][] = 'eduPerson';
return array(); return array();
} }
elseif (isset($_POST['form_subpage_eduPerson_attributes_remObjectClass'])) { elseif (isset($_POST['remObjectClass'])) {
$this->attributes['objectClass'] = array_delete(array('eduPerson'), $this->attributes['objectClass']); $this->attributes['objectClass'] = array_delete(array('eduPerson'), $this->attributes['objectClass']);
for ($i = 0; $i < sizeof($this->meta['attributes']); $i++) { for ($i = 0; $i < sizeof($this->meta['attributes']); $i++) {
if (isset($this->attributes[$this->meta['attributes'][$i]])) { if (isset($this->attributes[$this->meta['attributes'][$i]])) {