Exemple #1
0
 /**
  * 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-role-action';
     $form->error_mode = 'all';
     $form->addWidget('hidden', '_list');
     $form->addWidget('hidden', '_key');
     $w =& $form->addWidget('tab', 'tab1');
     $w->title = intl_get('Edit');
     $w =& $form->addWidget('text', 'name');
     $w->alt = intl_get('Name');
     $w->addRule('not empty', intl_get('Role name must not be empty.'));
     $w->setValue($item);
     $w->extra = 'maxlength="48"';
     $w =& $form->addWidget('select', 'admin');
     $w->alt = intl_get('Is admin?');
     $w->setValues(array('yes' => 'Yes', 'no' => 'No'));
     if ($this->data[$item]['role']['admin']) {
         $w->setValue('yes');
     } else {
         $w->setValue('no');
     }
     $w->extra = 'id="admin"';
     $w =& $form->addWidget('select', 'disabled');
     $w->alt = intl_get('Disabled');
     $w->setValues(array('yes' => 'Yes', 'no' => 'No'));
     $w->setValue('no');
     if ($this->data[$item]['role']['disabled']) {
         $w->setValue('yes');
     } else {
         $w->setValue('no');
     }
     $w->extra = 'id="disabled"';
     $w =& $form->addWidget('tab', 'tab2');
     $w->title = intl_get('Resources');
     $w =& $form->addWidget('usradm.Widget.Allowedbox', 'resources');
     $w->alt = 'Allowed Resources';
     $w->headers[] = ' ';
     $w->headers[] = intl_get('Read');
     $w->headers[] = intl_get('Write');
     $b =& $w->addButton('all', array('r' => '', 'w' => ''));
     $b->alt = '<strong>All</strong>';
     $b->setValue(assocify(preg_split('//', $this->data[$item]['allow:resources']['all'], -1, PREG_SPLIT_NO_EMPTY)));
     loader_import('usradm.Functions');
     $resources = array();
     foreach (session_get_resources() as $value) {
         $resources[$value] = usradm_resource_name($value);
     }
     asort($resources);
     foreach ($resources as $key => $value) {
         $b =& $w->addButton($key, array('r' => '', 'w' => ''));
         $b->alt = $value;
         $b->setValue(assocify(preg_split('//', $this->data[$item]['allow:resources'][$key], -1, PREG_SPLIT_NO_EMPTY)));
     }
     //foreach (session_get_resources () as $value) {
     //	$b =& $w->addButton ($value, array ('r' => '', 'w' => ''));
     //	$b->alt = ucwords (str_replace ('_', ' ', $value));
     //	$b->setValue (assocify (preg_split ('//', $this->data[$item]['allow:resources'][$value], -1, PREG_SPLIT_NO_EMPTY)));
     //}
     $w =& $form->addWidget('tab', 'tab3');
     $w->title = intl_get('Access Levels');
     $w =& $form->addWidget('usradm.Widget.Allowedbox', 'accesslevels');
     $w->alt = 'Allowed Access Levels';
     $w->headers[] = '&nbsp;';
     $w->headers[] = intl_get('Read');
     $w->headers[] = intl_get('Write');
     $b =& $w->addButton('all', array('r' => '', 'w' => ''));
     $b->alt = '<strong>All</strong>';
     $b->setValue(assocify(preg_split('//', $this->data[$item]['allow:access']['all'], -1, PREG_SPLIT_NO_EMPTY)));
     foreach (session_get_access_levels() as $value) {
         $b =& $w->addButton($value, array('r' => '', 'w' => ''));
         $b->alt = ucwords(str_replace('_', ' ', $value));
         $b->setValue(assocify(preg_split('//', $this->data[$item]['allow:access'][$value], -1, PREG_SPLIT_NO_EMPTY)));
     }
     $w =& $form->addWidget('tab', 'tab4');
     $w->title = intl_get('Statuses');
     $w =& $form->addWidget('usradm.Widget.Allowedbox', 'statuses');
     $w->alt = 'Allowed Statuses';
     $w->headers[] = '&nbsp;';
     $w->headers[] = intl_get('Read');
     $w->headers[] = intl_get('Write');
     $b =& $w->addButton('all', array('r' => '', 'w' => ''));
     $b->alt = '<strong>All</strong>';
     $b->setValue(assocify(preg_split('//', $this->data[$item]['allow:status']['all'], -1, PREG_SPLIT_NO_EMPTY)));
     foreach (session_get_statuses() as $value) {
         $b =& $w->addButton($value, array('r' => '', 'w' => ''));
         $b->alt = ucwords(str_replace('_', ' ', $value));
         $b->setValue(assocify(preg_split('//', $this->data[$item]['allow:status'][$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=roles\'; return false"';
     return $form;
 }
Exemple #2
0
        //	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;