/** * Returns the display HTML for this widget. The optional * parameter determines whether or not to automatically display the widget * nicely, or whether to simply return the widget (for use in a template). * * @access public * @param boolean $generate_html * @return string * */ function display($generate_html = 0) { global $intl, $simple; if (!isset($this->data_value)) { $this->data_value = $this->default_value; } $attrstr = $this->getAttrs(); if (empty($this->data_value)) { $this->data_value = session_team(); } if (empty($this->owner)) { $this->owner = $this->getOwner($this->owner); } if (session_role() == 'master') { // allow all $this->value = assocify(session_get_teams()); } elseif (session_username() == $this->owner) { // allow specific ones $this->value = assocify(session_allowed_teams_list(true)); } else { // show info instead loader_import('saf.MailForm.Widget.Info'); $info = new MF_Widget_info($this->name); $info->extra = $this->extra; $info->setValue($this->data_value); return $info->display($generate_html); } asort($this->value); $adv = $this->advanced ? ' class="advanced"' : ''; if ($generate_html) { $data = "\t" . '<tr' . $adv . '>' . "\n\t\t" . '<td class="label"><label for="' . $this->name . '" id="' . $this->name . '-label"' . $this->invalid() . '>' . $simple->fill($this->label_template, $this, '', true) . '</label></td>' . "\n\t\t" . '<td class="field"><select ' . $attrstr . ' ' . $this->extra . ' >' . "\n"; foreach ($this->value as $value => $display) { $display = str_replace('_', ' ', ucwords($display)); if ($value == $this->data_value) { $selected = ' selected="selected"'; } else { $selected = ''; } $data .= "\t" . '<option value="' . $value . '"' . $selected . '>' . $display . '</option>' . "\n"; } return $data . '</select></td>' . "\n\t" . '</tr>' . "\n"; } else { $data = '<select ' . $attrstr . ' ' . $this->extra . ' >' . "\n"; foreach ($this->value as $value => $display) { $display = str_replace('_', ' ', ucwords($display)); if ($value == $this->data_value) { $selected = ' selected="selected"'; } else { $selected = ''; } $data .= "\t" . '<option value="' . htmlentities_compat($value, ENT_COMPAT, $intl->charset) . '"' . $selected . '>' . $display . '</option>' . "\n"; } return $data . '</select>'; } }
/** * Generate a form for editing items in this list. * * @return object saf.MailForm object */ function &getEditForm($item) { loader_import('saf.MailForm'); $form = new MailForm(); $form->action = site_prefix() . '/index/usradm-edit-user-action'; $form->error_mode = 'all'; loader_import('ext.phpsniff'); $sniffer = new phpSniff(); $form->_browser = $sniffer->property('browser'); $user = session_user_get($item); $form->addWidget('hidden', '_list'); page_add_script(' formhelp_prepend = \'<table border="0" cellpadding="0"><tr><td width="12" valign="top"><img src="' . site_prefix() . '/inc/app/cms/pix/arrow-10px.gif" alt="" border="0" /></td><td valign="top">\'; formhelp_append = \'</td></tr></table>\'; '); $w =& $form->addWidget('tab', 'tab1'); $w->title = intl_get('Account'); $w =& $form->addWidget('info', '_key'); $w->alt = intl_get('Username'); $w->extra = 'maxlength="48"'; $w =& $form->addWidget('password', 'passwd'); $w->alt = intl_get('Password'); $w =& $form->addWidget('password', 'password_verify'); $w->alt = intl_get('Verify Password'); $w->addRule('equals "passwd"', intl_get('Passwords do not match.')); $w->ignoreEmpty = false; $w =& $form->addWidget('text', 'firstname'); $w->alt = intl_get('First Name'); //$w->addRule ('not empty', intl_get ('First name must not be empty.')); $w->setValue($user->firstname); $w->extra = 'maxlength="32"'; $w =& $form->addWidget('text', 'lastname'); $w->alt = intl_get('Last Name'); //$w->addRule ('not empty', intl_get ('Last name must not be empty.')); $w->setValue($user->lastname); $w->extra = 'maxlength="32"'; $w =& $form->addWidget('text', 'email'); $w->alt = intl_get('Email'); //$w->addRule ('not empty', intl_get ('Email must not be empty.')); //$w->addRule ('contains "@"', intl_get ('Email does not appear to be valid.')); $w->setValue($user->email); $w->extra = 'maxlength="42"'; $snm =& session_get_manager(); $list = assocify(array_keys($snm->role->getList())); unset($list['anonymous']); unset($list['']); $w =& $form->addWidget('select', 'role'); $w->alt = intl_get('Role'); $w->setValues($list); $w->setValue($user->role); $w->extra = 'id="role"'; $w =& $form->addWidget('select', 'team'); $w->alt = intl_get('Team'); $w->setValues(assocify(array_keys($snm->team->getList()))); $w->setValue($user->team); $w->extra = 'id="team"'; $w =& $form->addWidget('select', 'disabled'); $w->alt = intl_get('Disabled'); $w->setValues(array('yes' => 'Yes', 'no' => 'No')); $w->setValue($user->disabled); $w->extra = 'id="disabled"'; $w =& $form->addWidget('select', 'public'); $w->alt = intl_get('Public'); $w->setValues(array('yes' => 'Yes', 'no' => 'No')); $w->setValue($user->public); $w->extra = 'id="public"'; $w =& $form->addWidget('textarea', 'profile'); $w->alt = intl_get('Profile'); $w->setValue($user->profile); $w->labelPosition = 'left'; $w->rows = 5; $w->extra = 'id="profile"'; $w =& $form->addWidget('textarea', 'sig'); $w->alt = intl_get('Signature (for comments)'); $w->setValue($user->sig); $w->labelPosition = 'left'; $w->rows = 3; $w->extra = 'id="sig"'; $w =& $form->addWidget('info', 'registered'); $w->alt = intl_get('Date Registered'); $w->setValue(loader_call('saf.Date', 'Date::timestamp', $user->registered, 'F jS, Y - g:i A')); $w =& $form->addWidget('info', 'modified'); $w->alt = intl_get('Date Last Modified'); $w->setValue(loader_call('saf.Date', 'Date::timestamp', $user->modified, 'F jS, Y - g:i A')); $w =& $form->addWidget('tab', 'tab2'); $w->title = intl_get('Contact'); $w =& $form->addWidget('text', 'company'); $w->alt = intl_get('Company'); $w->setValue($user->company); $w->extra = 'maxlength="48"'; $w =& $form->addWidget('text', 'position'); $w->alt = intl_get('Position'); $w->setValue($user->position); $w->extra = 'maxlength="48"'; $w =& $form->addWidget('text', 'website'); $w->alt = intl_get('Web Site'); if (!empty($user->website)) { $w->setValue($user->website); } else { $w->setValue('http://'); } $w->extra = 'maxlength="72"'; $w =& $form->addWidget('text', 'phone'); $w->alt = intl_get('Phone #'); $w->setValue($user->phone); $w->extra = 'maxlength="24"'; $w =& $form->addWidget('text', 'cell'); $w->alt = intl_get('Cell #'); $w->setValue($user->cell); $w->extra = 'maxlength="24"'; $w =& $form->addWidget('text', 'fax'); $w->alt = intl_get('Fax #'); $w->setValue($user->fax); $w->extra = 'maxlength="24"'; $w =& $form->addWidget('text', 'sms_address'); $w->alt = intl_get('SMS #'); $w->setValue($user->sms_address); $w->extra = 'maxlength="72"'; $w =& $form->addWidget('text', 'jabber_id'); $w->alt = intl_get('Jabber ID'); $w->setValue($user->jabber_id); $w->extra = 'maxlength="48"'; $w =& $form->addWidget('text', 'address1'); $w->alt = intl_get('Address'); $w->setValue($user->address1); $w->extra = 'maxlength="72"'; $w =& $form->addWidget('text', 'address2'); $w->alt = intl_get('Address Line 2'); $w->setValue($user->address2); $w->extra = 'maxlength="72"'; $w =& $form->addWidget('text', 'city'); $w->alt = intl_get('City'); $w->setValue($user->city); $w->extra = 'maxlength="48"'; $w =& $form->addWidget('text', 'province'); $w->alt = intl_get('Province/State'); $w->setValue($user->province); $w->extra = 'maxlength="48"'; $w =& $form->addWidget('text', 'postal_code'); $w->alt = intl_get('Postal/Zip Code'); $w->setValue($user->postal_code); $w->extra = 'maxlength="16"'; $w =& $form->addWidget('text', 'country'); $w->alt = intl_get('Country'); $w->setValue($user->country); $w->extra = 'maxlength="48"'; $w =& $form->addWidget('tab', 'tab3'); $w->title = intl_get('Access'); $w =& $form->addWidget('usradm.Widget.Allowedbox', 'teams'); $w->alt = 'Allowed Teams'; $w->headers[] = ' '; $w->headers[] = intl_get('Read'); $w->headers[] = intl_get('Write'); $b =& $w->addButton('all', array('r' => '', 'w' => '')); $b->alt = '<strong>All</strong>'; $teams = unserialize($user->teams); if (isset($teams['all'])) { $b->setValue(assocify(preg_split('//', $teams['all'], -1, PREG_SPLIT_NO_EMPTY))); } foreach (session_get_teams() as $value) { $b =& $w->addButton($value, array('r' => '', 'w' => '')); $b->alt = ucwords(str_replace('_', ' ', $value)); $b->setValue(assocify(preg_split('//', $teams[$value], -1, PREG_SPLIT_NO_EMPTY))); } $w =& $form->addWidget('tab', 'tab-end'); $w =& $form->addWidget('msubmit', 'submit_button'); $b =& $w->getButton(); $b->setValues(intl_get('Save')); $b =& $w->addButton('cancel_button'); $b->setValues(intl_get('Cancel')); $b->extra = 'onclick="window.location.href = \'' . site_prefix() . '/index/usradm-browse-action?list=users\'; return false"'; return $form; }
// webfiles_error (500, 'Locks not supported on directories'); //} // it's someone else's lock $lock = webfiles_lock($path); if ($lock && $lock->owner != session_username()) { webfiles_error(409, 'Conflict'); } //if (lock_exists ('sitellite_filesystem', ltrim ($path, '/'))) { // webfiles_error (409, 'Conflict'); //} if (!lock_remove('sitellite_filesystem', trim($path, '/'))) { webfiles_error(500, 'Internal server error'); } webfiles_response(true); break; case 'statuses': webfiles_response(session_get_statuses()); break; case 'access-levels': webfiles_response(session_get_access_levels()); break; case 'teams': $teams = session_allowed_teams_list(); if (in_array('all', $teams)) { $teams = session_get_teams(); } sort($teams); webfiles_response($teams); break; } exit;