use new meta HTML classes

This commit is contained in:
Roland Gruber 2010-09-21 18:32:51 +00:00
parent 0306d3d929
commit ab1194e7fe
2 changed files with 66 additions and 72 deletions

View File

@ -92,19 +92,15 @@ class phpGroupwareGroup 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 = array(); $return = new htmlTable();
if (isset($this->attributes['objectClass']) && in_array('phpgwGroup', $this->attributes['objectClass'])) { if (isset($this->attributes['objectClass']) && in_array('phpgwGroup', $this->attributes['objectClass'])) {
$return[] = array( $return->addElement(new htmlButton('remObjectClass', _('Remove phpGroupWare extension')));
array('kind' => 'input', 'type' => 'submit', 'name' => 'form_subpage_phpGroupwareGroup_attributes_remObjectClass', 'value' => _('Remove phpGroupWare extension'))
);
} }
else { else {
$return[] = array( $return->addElement(new htmlButton('addObjectClass', _('Add phpGroupWare extension')));
array('kind' => 'input', 'type' => 'submit', 'name' => 'form_subpage_phpGroupwareGroup_attributes_addObjectClass', 'value' => _('Add phpGroupWare extension'))
);
} }
return $return; return $return;
} }
@ -116,10 +112,10 @@ class phpGroupwareGroup extends baseModule {
* @return array list of info/error messages * @return array list of info/error messages
*/ */
public function process_attributes() { public function process_attributes() {
if (isset($_POST['form_subpage_phpGroupwareGroup_attributes_addObjectClass'])) { if (isset($_POST['addObjectClass'])) {
$this->attributes['objectClass'][] = 'phpgwGroup'; $this->attributes['objectClass'][] = 'phpgwGroup';
} }
elseif (isset($_POST['form_subpage_phpGroupwareGroup_attributes_remObjectClass'])) { elseif (isset($_POST['remObjectClass'])) {
$this->attributes['objectClass'] = array_delete(array('phpgwGroup'), $this->attributes['objectClass']); $this->attributes['objectClass'] = array_delete(array('phpgwGroup'), $this->attributes['objectClass']);
if (isset($this->attributes['phpgwGroupID'])) unset($this->attributes['phpgwGroupID']); if (isset($this->attributes['phpgwGroupID'])) unset($this->attributes['phpgwGroupID']);
} }

View File

@ -88,12 +88,9 @@ class phpGroupwareUser extends baseModule implements passwordService {
) )
); );
// profile options // profile options
$return['profile_options'] = array( $profileContainer = new htmlTable();
array( $profileContainer->addElement(new htmlTableExtendedInputCheckbox('phpGroupwareUser_addExt', false, _('Automatically add this extension'), 'autoAdd'));
array('kind' => 'text', 'text' => _('Automatically add this extension') . ":"), $return['profile_options'] = $profileContainer;
array('kind' => 'input', 'name' => 'phpGroupwareUser_addExt', 'type' => 'checkbox'),
array('kind' => 'help', 'value' => 'autoAdd')),
);
// available PDF fields // available PDF fields
$return['PDF_fields'] = array( $return['PDF_fields'] = array(
'phpgwAccountStatus' => _('Account status'), 'phpgwAccountStatus' => _('Account status'),
@ -141,60 +138,57 @@ class phpGroupwareUser extends baseModule implements passwordService {
/** /**
* 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 = array(); $return = new htmlTable();
if (isset($this->attributes['objectClass']) && in_array('phpgwAccount', $this->attributes['objectClass'])) { if (isset($this->attributes['objectClass']) && in_array('phpgwAccount', $this->attributes['objectClass'])) {
$phpgwAccountExpires = ''; // expiration date
$phpgwAccountExpires = '-';
if (isset($this->attributes['phpgwAccountExpires'][0]) && ($this->attributes['phpgwAccountExpires'][0] != "-1")) { if (isset($this->attributes['phpgwAccountExpires'][0]) && ($this->attributes['phpgwAccountExpires'][0] != "-1")) {
$date = getdate($this->attributes['phpgwAccountExpires'][0]); $date = getdate($this->attributes['phpgwAccountExpires'][0]);
$phpgwAccountExpires = $date['mday'] . '.' . $date['mon'] . '.' . $date['year']; $phpgwAccountExpires = $date['mday'] . '.' . $date['mon'] . '.' . $date['year'];
} }
$return[] = array( $return->addElement(new htmlOutputText(_('Account expiration date')));
array('kind' => 'text', 'text' => _('Account expiration date')), $return->addElement(new htmlOutputText($phpgwAccountExpires));
array('kind' => 'table', 'value' => array(array( $return->addElement(new htmlAccountPageButton(get_class($this), 'time', 'phpgwAccountExpires', _('Change')));
array('kind' => 'text', 'text' => $phpgwAccountExpires), $return->addElement(new htmlHelpLink('phpgwAccountExpires'), true);
array('kind' => 'input', 'type' => 'submit', 'name' => 'form_subpage_phpGroupwareUser_time_phpgwAccountExpires', 'value' => _('Change')) // account status
))) $accountStatus = 'A';
); if (isset($this->attributes['phpgwAccountStatus'][0])) {
$return[] = array( $accountStatus = $this->attributes['phpgwAccountStatus'][0];
array('kind' => 'text', 'text' => _('Account status')), }
array('kind' => 'select', 'submit', 'name' => 'phpgwAccountStatus', $return->addElement(new htmlOutputText(_('Account status')));
'options' => array(array('A', _('active')), array('I', _('inactive'))), $statusOptions = array(_('active') => 'A', _('inactive') => 'I');
'options_selected' => array($this->attributes['phpgwAccountStatus'][0]), 'descriptiveOptions' => true) $statusSelect = new htmlSelect('phpgwAccountStatus', $statusOptions, array($accountStatus));
); $statusSelect->setHasDescriptiveElements(true);
$phpgwLastLogin = ''; $return->addElement($statusSelect);
$return->addElement(new htmlOutputText(''));
$return->addElement(new htmlHelpLink('phpgwAccountStatus'), true);
// last login
$phpgwLastLogin = '-';
if (isset($this->attributes['phpgwLastLogin'][0])) { if (isset($this->attributes['phpgwLastLogin'][0])) {
$date = getdate($this->attributes['phpgwLastLogin'][0]); $date = getdate($this->attributes['phpgwLastLogin'][0]);
$phpgwLastLogin = $date['mday'] . '.' . $date['mon'] . '.' . $date['year']; $phpgwLastLogin = $date['mday'] . '.' . $date['mon'] . '.' . $date['year'];
} }
$return[] = array( $return->addElement(new htmlOutputText(_('Last login')));
array('kind' => 'text', 'text' => _('Last login')), $return->addElement(new htmlOutputText($phpgwLastLogin), true);
array('kind' => 'text', 'text' => $phpgwLastLogin) // last login from
); $phpgwLastLoginFrom = '-';
$phpgwLastLoginFrom = '';
if (isset($this->attributes['phpgwLastLoginFrom'][0])) { if (isset($this->attributes['phpgwLastLoginFrom'][0])) {
$phpgwLastLoginFrom = $this->attributes['phpgwLastLoginFrom'][0]; $phpgwLastLoginFrom = $this->attributes['phpgwLastLoginFrom'][0];
} }
$return[] = array( $return->addElement(new htmlOutputText(_('Last login from')));
array('kind' => 'text', 'text' => _('Last login from')), $return->addElement(new htmlOutputText($phpgwLastLoginFrom), true);
array('kind' => 'text', 'text' => $phpgwLastLoginFrom)
); $return->addElement(new htmlSpacer(null, '10px'), true);
$return[] = array(
array('kind' => 'text', 'text' => '') $remButton = new htmlButton('remObjectClass', _('Remove phpGroupWare extension'));
); $remButton->colspan = 4;
$return[] = array( $return->addElement($remButton);
array('kind' => 'text', 'text' => '')
);
$return[] = array(
array('kind' => 'input', 'type' => 'submit', 'name' => 'form_subpage_phpGroupwareUser_attributes_remObjectClass', 'value' => _('Remove phpGroupWare extension'))
);
} }
else { else {
$return[] = array( $return->addElement(new htmlButton('addObjectClass', _('Add phpGroupWare extension')));
array('kind' => 'input', 'type' => 'submit', 'name' => 'form_subpage_phpGroupwareUser_attributes_addObjectClass', 'value' => _('Add phpGroupWare extension'))
);
} }
return $return; return $return;
} }
@ -209,12 +203,12 @@ class phpGroupwareUser extends baseModule implements passwordService {
if (isset($this->attributes['objectClass']) && in_array('phpgwAccount', $this->attributes['objectClass'])) { if (isset($this->attributes['objectClass']) && in_array('phpgwAccount', $this->attributes['objectClass'])) {
$this->attributes['phpgwAccountStatus'][0] = $_POST['phpgwAccountStatus']; $this->attributes['phpgwAccountStatus'][0] = $_POST['phpgwAccountStatus'];
} }
if (isset($_POST['form_subpage_phpGroupwareUser_attributes_addObjectClass'])) { if (isset($_POST['addObjectClass'])) {
$this->attributes['objectClass'][] = 'phpgwAccount'; $this->attributes['objectClass'][] = 'phpgwAccount';
$this->attributes['phpgwAccountExpires'][0] = "-1"; $this->attributes['phpgwAccountExpires'][0] = "-1";
$this->attributes['phpgwLastPasswordChange'][0] = time(); $this->attributes['phpgwLastPasswordChange'][0] = time();
} }
elseif (isset($_POST['form_subpage_phpGroupwareUser_attributes_remObjectClass'])) { elseif (isset($_POST['remObjectClass'])) {
$this->attributes['objectClass'] = array_delete(array('phpgwAccount'), $this->attributes['objectClass']); $this->attributes['objectClass'] = array_delete(array('phpgwAccount'), $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]])) {
@ -229,10 +223,10 @@ class phpGroupwareUser extends baseModule implements passwordService {
/** /**
* This function will create the meta HTML code to show a page to change time values. * This function will create the meta HTML code to show a page to change time values.
* *
* @return array meta HTML code * @return htmlElement meta HTML code
*/ */
function display_html_time() { function display_html_time() {
$return = array(); $return = new htmlTable();
// determine attribute // determine attribute
if (isset($_POST['form_subpage_phpGroupwareUser_time_phpgwAccountExpires'])) { if (isset($_POST['form_subpage_phpGroupwareUser_time_phpgwAccountExpires'])) {
$attr = 'phpgwAccountExpires'; $attr = 'phpgwAccountExpires';
@ -247,23 +241,27 @@ class phpGroupwareUser extends baseModule implements passwordService {
for ( $i=1; $i<=31; $i++ ) $mday[] = $i; for ( $i=1; $i<=31; $i++ ) $mday[] = $i;
for ( $i=1; $i<=12; $i++ ) $mon[] = $i; for ( $i=1; $i<=12; $i++ ) $mon[] = $i;
for ( $i=2003; $i<=2030; $i++ ) $year[] = $i; for ( $i=2003; $i<=2030; $i++ ) $year[] = $i;
$return[] = array( $return->addElement(new htmlOutputText($text));
array('kind' => 'text', 'text' => $text), $dateContainer = new htmlTable();
array('kind' => 'table', 'value' => array(array( $dateContainer->addElement(new htmlSelect('expire_day', $mday, array($date['mday'])));
array('kind' => 'select', 'name' => 'expire_day', 'options' => $mday, 'options_selected' => $date['mday']), $dateContainer->addElement(new htmlSelect('expire_mon', $mon, array($date['mon'])));
array('kind' => 'select', 'name' => 'expire_mon', 'options' => $mon, 'options_selected' => $date['mon']), $dateContainer->addElement(new htmlSelect('expire_yea', $year, array($date['year'])));
array('kind' => 'select', 'name' => 'expire_yea', 'options' => $year, 'options_selected' => $date['year'])))), $return->addElement($dateContainer);
array('kind' => 'help', 'value' => $help)); $return->addElement(new htmlHelpLink($help), true);
$return->addElement(new htmlSpacer(null, '10px'), true);
// buttons
$buttonContainer = new htmlTable();
$buttonContainer->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'change' . $attr, _('Change')));
$buttons = array(); $buttons = array();
$buttons[] = array('kind' => 'input', 'name' => 'form_subpage_phpGroupwareUser_attributes_change' . $attr, 'type' => 'submit', 'value' => _('Change'));
if (isset($this->attributes[$attr][0])) { if (isset($this->attributes[$attr][0])) {
$buttons[] = array('kind' => 'input', 'name' => 'form_subpage_phpGroupwareUser_attributes_del' . $attr, 'type' => 'submit', 'value' => _('Remove')); $buttonContainer->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'del' . $attr, _('Remove')));
} }
$buttons[] = array('kind' => 'input', 'name' => 'form_subpage_phpGroupwareUser_attributes_back' . $attr, 'type' => 'submit', 'value' => _('Cancel')); $buttonContainer->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'back' . $attr, _('Cancel')));
$return[] = array( $buttonContainer->colspan = 3;
array('kind' => 'table', 'td' => array('colspan' => 3), 'value' => array($buttons)) $return->addElement($buttonContainer);
); return $return;
return $return;
} }
/** /**