コード例 #1
0
ファイル: Checkin_User.php プロジェクト: HaldunA/phpwebsite
 public function checkinForm()
 {
     $form = new PHPWS_Form('checkin');
     $form->turnOffAutoComplete();
     $form->setProtected(false);
     $form->addHidden('module', 'checkin');
     $form->addHidden('uop', 'post_checkin');
     $form->addText('first_name', isset($_POST['first_name']) ? trim($_POST['first_name']) : null);
     $form->setLabel('first_name', dgettext('checkin', 'First name'));
     $form->setRequired('first_name');
     $form->addText('last_name', isset($_POST['last_name']) ? trim($_POST['last_name']) : null);
     $form->setLabel('last_name', dgettext('checkin', 'Last name'));
     $form->setRequired('last_name');
     if (PHPWS_Settings::get('checkin', 'email')) {
         $form->addText('email', isset($_POST['email']) ? trim($_POST['email']) : null);
         $form->setLabel('email', dgettext('checkin', 'Email address'));
         $form->setRequired('email');
     }
     // If gender is requested
     if (PHPWS_Settings::get('checkin', 'gender')) {
         $sex = array('male' => 'Male', 'female' => 'Female');
         $form->addRadioAssoc('gender', $sex);
         $form->addTplTag('GENDER_LABEL', dgettext('checkin', 'Gender'));
     }
     // If birthdate is requested
     if (PHPWS_Settings::get('checkin', 'birthdate')) {
         /*
          * Minimum representable date is 12-13-1901, and instead of doing 
          * lots of math to ensure that all selected dates in 1901 are after
          * 12-13-1901, just make the minimum year always be 1902
          */
         $yearsPrior = date('Y', time()) - 1902;
         // current year - minimum full year (1902)
         $form->dateSelect('birthdate', 0, '%B', $yearsPrior, 0);
         $form->addTplTag('BIRTHDATE_LABEL', dgettext('checkin', 'Date of birth'));
     }
     $reasons = $this->getReasons();
     if (!empty($reasons)) {
         $reasons = array_reverse($reasons, true);
         $reasons[0] = dgettext('checkin', '-- Please choose a reason from the list below --');
         $reasons = array_reverse($reasons, true);
         $form->addSelect('reason_id', $reasons);
         $form->setLabel('reason_id', dgettext('checkin', 'Reason for visit'));
     }
     $form->addSubmit(dgettext('checkin', 'Check in'));
     $tpl = $form->getTemplate();
     $this->title = dgettext('checkin', 'Please check in using the form below');
     $this->content = PHPWS_Template::process($tpl, 'checkin', 'signin.tpl');
     if (!Current_User::isLogged() && PHPWS_Settings::get('checkin', 'collapse_signin')) {
         Layout::collapse();
     }
 }
コード例 #2
0
ファイル: my_page.php プロジェクト: HaldunA/phpwebsite
 public static function userForm(PHPWS_User $user, $message = NULL)
 {
     require_once PHPWS_SOURCE_DIR . 'core/class/Time.php';
     javascript('jquery');
     $form = new PHPWS_Form();
     $form->addHidden('module', 'users');
     $form->addHidden('action', 'user');
     $form->addHidden('command', 'my_page');
     $form->addHidden('subcommand', 'postUser');
     if (Current_User::allow('users') || $user->display_name == $user->username) {
         $form->addText('display_name', $user->display_name);
         $form->setClass('display_name', 'form-control');
         $form->setLabel('display_name', dgettext('users', 'Display Name'));
     } else {
         $form->addTplTag('DISPLAY_NAME_LABEL', dgettext('users', 'Display Name'));
         $tpl['DISPLAY_NAME'] = javascript('slider', array('link' => $user->display_name, 'id' => 'name-info', 'message' => dgettext('users', 'Once you change your display name, you may not change it again until reset by the site administrator.')));
     }
     if ($user->canChangePassword()) {
         $form->addPassword('password1');
         $form->setAutoComplete('password1');
         $form->setClass('password1', 'form-control');
         $form->addPassword('password2');
         $form->setAutoComplete('password2');
         $form->setClass('password2', 'form-control');
         $form->setTitle('password2', dgettext('users', 'Password confirm'));
         $form->setLabel('password1', dgettext('users', 'Password'));
     } else {
         $tpl['PASSWORD1_LABEL'] = dgettext('users', 'Password');
         $tpl['PASSWORD1'] = javascript('slider', array('link' => dgettext('users', 'Why can\'t I change my password?'), 'id' => 'pw-info', 'message' => dgettext('users', 'Your account is authorized external to this site. You will need to update it at the source.')));
     }
     $form->addText('email', $user->getEmail());
     $form->setSize('email', 40);
     $form->setLabel('email', dgettext('users', 'Email Address'));
     $form->setClass('email', 'form-control');
     if (isset($tpl)) {
         $form->mergeTemplate($tpl);
     }
     $tz_list = PHPWS_Time::getTZList();
     $timezones['server'] = dgettext('users', '-- Use server\'s time zone --');
     foreach ($tz_list as $tz) {
         if (!empty($tz['codes'])) {
             $timezones[$tz['id']] = sprintf('%s : %s', $tz['id'], $tz['codes'][0]);
         } elseif (!empty($tz['city'])) {
             $timezones[$tz['id']] = sprintf('%s : %s', $tz['id'], $tz['city'][0]);
         } else {
             $timezones[$tz['id']] = $tz['id'];
         }
     }
     if (isset($_REQUEST['timezone'])) {
         $user_tz = $_REQUEST['timezone'];
     } else {
         $user_tz = PHPWS_Cookie::read('user_tz');
     }
     $form->addSelect('timezone', $timezones);
     $form->setLabel('timezone', dgettext('users', 'Time Zone'));
     $form->setMatch('timezone', $user_tz);
     $form->setClass('timezone', 'form-control');
     if (isset($_REQUEST['dst']) && $_REQUEST['timezone'] != 'server') {
         $dst = $_REQUEST['dst'];
     } else {
         $dst = PHPWS_Cookie::read('user_dst');
     }
     $form->addCheckbox('dst', 1);
     $form->setMatch('dst', $dst);
     $form->setLabel('dst', dgettext('users', 'Use Daylight Savings Time'));
     if (isset($_POST['cp'])) {
         $cp = (int) $_POST['cp'];
     } else {
         $cp = (int) PHPWS_Cookie::read('user_cp');
     }
     if (Current_User::allowRememberMe()) {
         // User must authorize locally
         if ($_SESSION['User']->authorize == 1) {
             $form->addCheckbox('remember_me', 1);
             if (PHPWS_Cookie::read('remember_me')) {
                 $form->setMatch('remember_me', 1);
             }
             $form->setLabel('remember_me', dgettext('users', 'Remember me'));
         }
     }
     $form->addHidden('userId', $user->getId());
     $form->addSubmit('submit', dgettext('users', 'Update my information'));
     $form->setClass('submit', 'btn btn-primary');
     if (!DISABLE_TRANSLATION && !FORCE_DEFAULT_LANGUAGE) {
         $language_file = PHPWS_Core::getConfigFile('users', 'languages.php');
         if ($language_file) {
             include $language_file;
             $form->addSelect('language', $languages);
             $form->setClass('language', 'form-control');
             $form->setLabel('language', dgettext('users', 'Language preference'));
             if (isset($_COOKIE['phpws_default_language'])) {
                 $language = preg_replace('/\\W/', '', $_COOKIE['phpws_default_language']);
                 $form->setMatch('language', $language);
             }
         }
     }
     $template = $form->getTemplate();
     if (isset($message)) {
         foreach ($message as $tag => $error) {
             $template[$tag] = $error;
         }
     }
     $template['ACCT_INFO'] = dgettext('users', 'Account Information');
     $template['LOCAL_INFO'] = dgettext('users', 'Localization');
     $template['PREF'] = dgettext('users', 'Preferences');
     return PHPWS_Template::process($template, 'users', 'my_page/user_setting.tpl');
 }
コード例 #3
0
ファイル: Branch_Admin.php プロジェクト: HaldunA/phpwebsite
 /**
  * Form to create or edit a branch
  */
 public function edit_db($force = false)
 {
     $this->title = dgettext('branch', 'Setup branch database');
     $form = new PHPWS_Form('branch-form');
     $form->addHidden('module', 'branch');
     $form->addHidden('command', 'post_db');
     $form->addHidden('force', (int) $force);
     $form->addCheck('createdb', $this->createdb);
     $form->setLabel('createdb', dgettext('branch', 'Create new database'));
     $form->addSelect('dbtype', $this->db_list);
     $form->setMatch('dbtype', $this->dbtype);
     $form->setLabel('dbtype', dgettext('branch', 'Database syntax'));
     $form->addText('dbname', $this->dbname);
     $form->setLabel('dbname', dgettext('branch', 'Database name'));
     $form->addText('dbuser', $this->dbuser);
     $form->setLabel('dbuser', dgettext('branch', 'Permission user'));
     $form->addPassword('dbpass', $this->dbpass);
     $form->allowValue('dbpass');
     $form->setLabel('dbpass', dgettext('branch', 'User password'));
     $form->addText('dbprefix', $this->dbprefix);
     $form->setLabel('dbprefix', dgettext('branch', 'Table prefix'));
     $form->setSize('dbprefix', 5, 5);
     $form->addText('dbhost', $this->dbhost);
     $form->setLabel('dbhost', dgettext('branch', 'Database Host'));
     $form->setSize('dbhost', 40);
     $form->addText('dbport', $this->dbport);
     $form->setLabel('dbport', dgettext('branch', 'Connection Port'));
     $form->addTplTag('DB_LEGEND', dgettext('branch', 'Database information'));
     $form->addSubmit('plug', dgettext('branch', 'Use hub values'));
     $form->addSubmit('submit', dgettext('branch', 'Continue...'));
     $template = $form->getTemplate();
     $this->content = PHPWS_Template::process($template, 'branch', 'edit_db.tpl');
 }
コード例 #4
0
 public static function forgotForm()
 {
     PHPWS_Core::initCoreClass('Captcha.php');
     $form = new PHPWS_Form('forgot-password');
     $form->addHidden('module', 'users');
     $form->addHidden('action', 'user');
     $form->addHidden('command', 'post_forgot');
     $form->addText('fg_username');
     $form->setLabel('fg_username', dgettext('users', 'Enter your user name.'));
     $form->addText('fg_email');
     $form->setSize('fg_email', 40);
     $form->setLabel('fg_email', dgettext('users', 'Forgotten your user name? Enter your email address instead.'));
     if (ALLOW_CAPTCHA) {
         $form->addTplTag('CAPTCHA_IMAGE', Captcha::get());
     }
     $form->addSubmit(dgettext('users', 'Send reminder'));
     $tpl = $form->getTemplate();
     return PHPWS_Template::process($tpl, 'users', 'forms/forgot.tpl');
 }
コード例 #5
0
ファイル: Forms.php プロジェクト: HaldunA/phpwebsite
 public function editSheet()
 {
     $form = new PHPWS_Form('signup_sheet');
     $sheet =& $this->signup->sheet;
     $form->addHidden('module', 'signup');
     $form->addHidden('aop', 'post_sheet');
     if ($sheet->id) {
         $form->addHidden('sheet_id', $sheet->id);
         $form->addSubmit(dgettext('signup', 'Update'));
         $this->signup->title = dgettext('signup', 'Update signup sheet');
         $form->addTplTag('EDIT_SLOT', $this->signup->sheet->editSlotLink());
     } else {
         $form->addSubmit(dgettext('signup', 'Create'));
         $this->signup->title = dgettext('signup', 'Create signup sheet');
     }
     $form->addText('title', $sheet->title);
     $form->setLabel('title', dgettext('signup', 'Title'));
     $form->addTextArea('description', $sheet->description);
     $form->setLabel('description', dgettext('signup', 'Description'));
     $form->addText('contact_email', $sheet->contact_email);
     $form->setLabel('contact_email', dgettext('signup', 'Contact email'));
     $form->addCheck('multiple', 1);
     $form->setMatch('multiple', $sheet->multiple);
     $form->setLabel('multiple', dgettext('signup', 'Allow multiple signups'));
     // Functionality not finished. Hide for now.
     /*
     $form->addText('start_time', $sheet->getStartTime());
     $form->setLabel('start_time', dgettext('signup', 'Start signup'));
     */
     $form->addText('extra1', $sheet->extra1);
     $form->setSize('extra1', 40);
     $form->setLabel('extra1', dgettext('signup', 'Extra information 1'));
     $form->addText('extra2', $sheet->extra2);
     $form->setSize('extra2', 40);
     $form->setLabel('extra2', dgettext('signup', 'Extra information 2'));
     $form->addText('extra3', $sheet->extra3);
     $form->setSize('extra3', 40);
     $form->setLabel('extra3', dgettext('signup', 'Extra information 3'));
     $form->addText('end_time', $sheet->getEndTime());
     $form->setClass('end_time', 'datepicker');
     $form->setLabel('end_time', dgettext('signup', 'Close signup'));
     $js_vars['type'] = 'text_clock';
     $js_vars['form_name'] = 'signup_sheet';
     $js_vars['date_name'] = 'start_time';
     $form->addTplTag('ST_JS', javascript('js_calendar', $js_vars));
     $js_vars['date_name'] = 'end_time';
     $form->addTplTag('ET_JS', javascript('js_calendar', $js_vars));
     $tpl = $form->getTemplate();
     $tpl['EXTRA_NOTE'] = dgettext('signup', 'Blank extra fields will not appear on signup.');
     // Explain the purpose of the 'extra' fields to the user.
     $tpl['FIELDSET_NOTE'] = dgettext('signup', 'The signup form already asks for the user\'s first and last name, email address, and phone number. <br>If there is any other information you want to ask for, specify it here. These fields are not required.');
     $this->signup->content = PHPWS_Template::process($tpl, 'signup', 'edit_sheet.tpl');
 }
コード例 #6
0
ファイル: Faxmaster.php プロジェクト: sinkdb/faxserv
 /**
  * Allows users with sufficient privileges to change the settings associated
  * with the faxmaster module.
  */
 private function changeSettings()
 {
     // Check user's permissions
     if (!Current_User::allow('faxmaster', 'settings')) {
         PHPWS_Core::initModClass('faxmaster', 'exception/PermissionException.php');
         throw new PermissionException('Permission denied');
     }
     $content = array();
     $form = new PHPWS_Form('faxmaster_settings');
     // If $_REQUEST data has been given, set the paths
     if (isset($_REQUEST['fax_path']) && !is_null($_REQUEST['fax_path']) && isset($_REQUEST['archive_path']) && !is_null($_REQUEST['archive_path'])) {
         clearstatcache(true);
         // is_readable and is_writable cache results, so you need to clear the cache
         $faxRead = is_readable($_REQUEST['fax_path']);
         $faxWrite = is_writable($_REQUEST['fax_path']);
         $archiveRead = is_readable($_REQUEST['archive_path']);
         $archiveWrite = is_writable($_REQUEST['archive_path']);
         if (!$faxRead || !$faxWrite || !$archiveRead || !$archiveWrite) {
             // Show warnings for invalid paths
             PHPWS_Core::initModClass('faxmaster', 'FaxmasterNotificationView.php');
             if (!$faxRead) {
                 NQ::simple('faxmaster', FAX_NOTIFICATION_ERROR, "The fax directory you specified is not readable or does not exist.");
             }
             if (!$faxWrite) {
                 NQ::simple('faxmaster', FAX_NOTIFICATION_ERROR, "The fax directory you specified is not writable or does not exist.");
             }
             if (!$archiveRead) {
                 NQ::simple('faxmaster', FAX_NOTIFICATION_ERROR, "The archive directory you specified is not readable or does not exist.");
             }
             if (!$archiveWrite) {
                 NQ::simple('faxmaster', FAX_NOTIFICATION_ERROR, "The archive directory you specified is not writable or does not exist.");
             }
             $nv = new FaxmasterNotificationView();
             $nv->popNotifications();
             Layout::add($nv->show());
             // Show supplied paths
             $form->setAction('index.php?module=faxmaster&op=settings');
             $form->addTplTag('FAX_PATH', $_REQUEST['fax_path']);
             $form->addTplTag('ARCHIVE_PATH', $_REQUEST['archive_path']);
             $form->addSubmit('Try Again');
             $tpl = $form->getTemplate();
             Layout::add(PHPWS_Template::process($tpl, 'faxmaster', 'settings.tpl'));
         } else {
             // new paths were valid, so update settings
             PHPWS_Settings::set('faxmaster', 'fax_path', $_REQUEST['fax_path']);
             PHPWS_Settings::set('faxmaster', 'archive_path', $_REQUEST['archive_path']);
             PHPWS_Settings::save('faxmaster');
             // Show new paths
             $form->setAction('index.php?module=faxmaster&op=go_home');
             $form->addTplTag('SAVED', 'New Settings Saved!');
             $form->addTplTag('FAX_PATH', PHPWS_Settings::get('faxmaster', 'fax_path'));
             $form->addTplTag('ARCHIVE_PATH', PHPWS_Settings::get('faxmaster', 'archive_path'));
             $form->addSubmit('Return to Fax List');
             $tpl = $form->getTemplate();
             Layout::add(PHPWS_Template::process($tpl, 'faxmaster', 'settings.tpl'));
         }
     } else {
         // Show initial form to change paths
         $form->setAction('index.php?module=faxmaster&op=settings');
         $form->addTplTag('WARNING', '<strong>WARNING: </strong> Changing paths does not move files. Files must be moved manually.<br /><br \\>');
         $form->addText('fax_path', PHPWS_Settings::get('faxmaster', 'fax_path'));
         $form->setSize('fax_path', 45);
         $form->addText('archive_path', PHPWS_Settings::get('faxmaster', 'archive_path'));
         $form->setSize('archive_path', 45);
         $form->addSubmit('Save Settings');
         $tpl = $form->getTemplate();
         Layout::add(PHPWS_Template::process($tpl, 'faxmaster', 'settings.tpl'));
     }
     $this->addNavLinks();
 }
コード例 #7
0
ファイル: WikiPage.php プロジェクト: Jopperi/wiki
 function move()
 {
     if (!Current_User::authorized('wiki', 'edit_page') && !(PHPWS_Settings::get('wiki', 'allow_page_edit') && Current_User::isLogged()) || !$this->allow_edit) {
         Current_User::disallow(dgettext('wiki', 'User attempted access to wiki page move.'));
         return;
     }
     $form = new PHPWS_Form();
     $form->addHidden('module', 'wiki');
     $form->addHidden('page_op', 'do_move');
     $form->addHidden('page', $this->getTitle(FALSE));
     $form->addText('newpage');
     $form->setSize('newpage', 40, 100);
     $form->setLabel('newpage', dgettext('wiki', 'New title'));
     $form->addSubmit('move', dgettext('wiki', 'Move'));
     $form->addTplTag('BACK_PAGE', PHPWS_Text::moduleLink(dgettext('wiki', 'Back to Page'), 'wiki', array('page' => $this->getTitle(FALSE))));
     $form->addTplTag('MESSAGE', WikiManager::getMessage());
     $form->addTplTag('INSTRUCTIONS', dgettext('wiki', 'Using the form below will rename a page, moving all of its history
                      to the new name. The old title will become a redirect page to the new title. Links to the old page
                      title will not be changed. You are responsible for making sure that links continue to point where they
                      are supposed to go. Note that the page will not be moved if there is already a page at the new title.'));
     return PHPWS_Template::process($form->getTemplate(), 'wiki', 'move.tpl');
 }
コード例 #8
0
ファイル: Forms.php プロジェクト: HaldunA/phpwebsite
    public function settings()
    {
        $sizes = Cabinet::getMaxSizes();
        $form = new PHPWS_Form('settings');
        $form->addHidden('module', 'filecabinet');
        $form->addHidden('aop', 'save_settings');
        $form->addTplTag('DOCUMENT_SETTINGS', dgettext('filecabinet', 'Document settings'));
        $form->addTplTag('IMAGE_SETTINGS', dgettext('filecabinet', 'Image settings'));
        $form->addTplTag('MULTIMEDIA_SETTINGS', dgettext('filecabinet', 'Multimedia settings'));
        $form->addText('base_doc_directory', PHPWS_Settings::get('filecabinet', 'base_doc_directory'));
        $form->setSize('base_doc_directory', '50');
        $form->setLabel('base_doc_directory', dgettext('filecabinet', 'Base document directory'));
        $form->addCheckBox('autofloat', 1);
        $form->setMatch('autofloat', PHPWS_Settings::get('filecabinet', 'autofloat'));
        $form->setLabel('autofloat', dgettext('filecabinet', 'Float new images under 300px to the right of content'));
        $form->addText('max_image_dimension', PHPWS_Settings::get('filecabinet', 'max_image_dimension'));
        $form->setLabel('max_image_dimension', dgettext('filecabinet', 'Maximum image pixel dimension'));
        $form->setSize('max_image_dimension', 4, 4);
        $form->addText('max_image_size', $sizes['image']);
        $form->setLabel('max_image_size', dgettext('filecabinet', 'Maximum image file size (in bytes)'));
        $form->setSize('max_image_size', 10, 10);
        $form->addText('max_document_size', $sizes['document']);
        $form->setLabel('max_document_size', dgettext('filecabinet', 'Maximum document file size (in bytes)'));
        $form->setSize('max_document_size', 10, 10);
        $form->addText('max_multimedia_size', $sizes['multimedia']);
        $form->setLabel('max_multimedia_size', dgettext('filecabinet', 'Maximum multimedia file size (in bytes)'));
        $form->setSize('max_multimedia_size', 10, 10);
        $form->addText('max_pinned_images', PHPWS_Settings::get('filecabinet', 'max_pinned_images'));
        $form->setLabel('max_pinned_images', dgettext('filecabinet', 'Maximum pinned images shown (0 for all)'));
        $form->setSize('max_pinned_images', 3, 3);
        $form->addText('max_pinned_documents', PHPWS_Settings::get('filecabinet', 'max_pinned_documents'));
        $form->setLabel('max_pinned_documents', dgettext('filecabinet', 'Maximum pinned documents shown (0 for all)'));
        $form->setSize('max_pinned_documents', 3, 3);
        $form->addText('crop_threshold', PHPWS_Settings::get('filecabinet', 'crop_threshold'));
        $form->setLabel('crop_threshold', dgettext('filecabinet', 'Crop pixel threshold'));
        $form->setSize('crop_threshold', 4, 4);
        $form->addCheck('use_ffmpeg', 1);
        $form->setMatch('use_ffmpeg', PHPWS_Settings::get('filecabinet', 'use_ffmpeg'));
        $form->addCheck('caption_images', 1);
        $form->setMatch('caption_images', PHPWS_Settings::get('filecabinet', 'caption_images'));
        $form->setLabel('caption_images', dgettext('filecabinet', 'Caption images'));
        $form->addCheck('allow_direct_links', 1);
        $form->setMatch('allow_direct_links', PHPWS_Settings::get('filecabinet', 'allow_direct_links'));
        $form->setLabel('allow_direct_links', dgettext('filecabinet', 'Allow direct links to documents'));
        $form->addCheck('force_thumbnail_dimensions', 1);
        $form->setMatch('force_thumbnail_dimensions', PHPWS_Settings::get('filecabinet', 'force_thumbnail_dimensions'));
        $form->setLabel('force_thumbnail_dimensions', dgettext('filecabinet', 'Force thumbnail dimensions on display'));
        $form->addCheck('popup_image_navigation', 1);
        $form->setMatch('popup_image_navigation', PHPWS_Settings::get('filecabinet', 'popup_image_navigation'));
        $form->setLabel('popup_image_navigation', dgettext('filecabinet', 'Popup images allow folder navigation'));
        $form->addText('max_thumbnail_size', PHPWS_Settings::get('filecabinet', 'max_thumbnail_size'));
        $form->setLabel('max_thumbnail_size', dgettext('filecabinet', 'Maximum thumbnail pixel dimension'));
        $form->setSize('max_thumbnail_size', 3, 3);
        $ffmpeg_directory = PHPWS_Settings::get('filecabinet', 'ffmpeg_directory');
        if (empty($ffmpeg_directory) || !is_file($ffmpeg_directory . 'ffmpeg')) {
            $form->setDisabled('use_ffmpeg');
            $form->setLabel('use_ffmpeg', dgettext('filecabinet', 'Enable FFMpeg thumbnails (enabled on ffmpeg confirmation)'));
        } else {
            $form->setLabel('use_ffmpeg', dgettext('filecabinet', 'Enable FFMpeg thumbnails'));
        }
        $form->addTplTag('CLASSIFY_SETTINGS', dgettext('filecabinet', 'Classify settings'));
        $form->addText('ffmpeg_directory', $ffmpeg_directory);
        $form->setLabel('ffmpeg_directory', dgettext('filecabinet', 'FFMpeg directory'));
        $form->setSize('ffmpeg_directory', 40);
        if (FC_ALLOW_CLASSIFY_DIR_SETTING) {
            $form->addText('classify_directory', PHPWS_Settings::get('filecabinet', 'classify_directory'));
            $form->setLabel('classify_directory', dgettext('filecabinet', 'Incoming classify directory'));
            $form->setSize('classify_directory', 50, 255);
        }
        $form->addRadioAssoc('jcaro_type', array(0 => dgettext('filecabinet', 'Horizontal'), 1 => dgettext('filecabinet', 'Vertical')));
        $form->setMatch('jcaro_type', (int) PHPWS_Settings::get('filecabinet', 'vertical_folder'));
        $num = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8);
        $form->addSelect('number_visible', $num);
        $form->setMatch('number_visible', PHPWS_Settings::get('filecabinet', 'number_visible'));
        $form->setLabel('number_visible', dgettext('filecabinet', 'Number of thumbnails visible'));
        $form->addSubmit(dgettext('filecabinet', 'Save settings'));
        $tpl = $form->getTemplate();
        $tpl['CAROUSEL'] = dgettext('filecabinet', 'Carousel defaults');
        $tpl['SYSTEM_SIZE'] = dgettext('filecabinet', 'System upload limits');
        $tpl['SYSTEM_LABEL'] = dgettext('filecabinet', 'Server upload limit');
        $tpl['FORM_LABEL'] = dgettext('filecabinet', 'Form upload limit');
        $tpl['ABSOLUTE_LABEL'] = dgettext('filecabinet', 'Absolute upload limit');
        $tpl['MAX_SYSTEM_SIZE'] = File_Common::humanReadable($sizes['system']);
        $tpl['MAX_FORM_SIZE'] = File_Common::humanReadable($sizes['form']);
        $tpl['ABSOLUTE_SIZE'] = File_Common::humanReadable($sizes['absolute']);
        if (Current_User::isDeity()) {
            $link = new PHPWS_Link(null, 'filecabinet', array('aop' => 'fix_document_dir'), true);
            $js = array('question' => dgettext('filecabinet', 'This process will update all of your document files with the current base directory.
Do not run this process unless you are sure it will fix download problems.
If you are sure, type Y-E-S below.'), 'address' => $link->getAddress(), 'value_name' => 'confirm', 'link' => dgettext('filecabinet', 'Reindex document directories'));
            $tpl['FIX_DIRECTORIES'] = javascript('prompt', $js);
        }
        return PHPWS_Template::process($tpl, 'filecabinet', 'Forms/settings.tpl');
    }
コード例 #9
0
ファイル: Schedule.php プロジェクト: HaldunA/phpwebsite
 /**
  * Edit form for a schedule
  */
 public function form()
 {
     $key = $this->getKey();
     $form = new PHPWS_Form('schedule_form');
     if (isset($_REQUEST['js'])) {
         $form->addHidden('js', 1);
     }
     $form->addHidden('module', 'calendar');
     $form->addHidden('aop', 'post_schedule');
     $form->addHidden('sch_id', $this->id);
     $form->addText('title', $this->title);
     $form->setLabel('title', dgettext('calendar', 'Title'));
     $form->setSize('title', 40);
     $form->addTextArea('summary', $this->summary);
     $form->setLabel('summary', dgettext('calendar', 'Summary'));
     $form->useEditor('summary');
     if (PHPWS_Settings::get('calendar', 'personal_schedules')) {
         if (Current_User::allow('calendar', 'edit_public')) {
             $form->addRadio('public', array(0, 1));
             $form->setLabel('public', array(dgettext('calendar', 'Private'), dgettext('calendar', 'Public')));
             $form->setMatch('public', (int) $this->public);
         } else {
             $form->addTplTag('PUBLIC', dgettext('calendar', 'Private'));
             $form->addHidden('public', 0);
         }
     } else {
         $form->addTplTag('PUBLIC', dgettext('calendar', 'Public'));
         $form->addHidden('public', 1);
     }
     $upcoming[0] = dgettext('calendar', 'Do not show upcoming events');
     $upcoming[1] = dgettext('calendar', 'Show upcoming week');
     $upcoming[2] = dgettext('calendar', 'Show next two weeks');
     $upcoming[3] = dgettext('calendar', 'Show upcoming month');
     $form->addSelect('show_upcoming', $upcoming);
     $form->setLabel('show_upcoming', dgettext('calendar', 'Show upcoming events'));
     $form->setMatch('show_upcoming', $this->show_upcoming);
     $form->addSubmit(dgettext('calendar', 'Save'));
     $template = $form->getTemplate();
     if (isset($_REQUEST['js'])) {
         $template['CLOSE'] = javascript('close_window', array('value' => dgettext('calendar', 'Cancel')));
     }
     $template['PUBLIC_LABEL'] = dgettext('calendar', 'Availability');
     return PHPWS_Template::process($template, 'calendar', 'admin/forms/edit_schedule.tpl');
 }
コード例 #10
0
 public function settings()
 {
     $form = new PHPWS_Form('ps-settings');
     $form->addHidden('module', 'pagesmith');
     $form->addHidden('aop', 'post_settings');
     $form->addSubmit(dgettext('pagesmith', 'Save'));
     $form->addCheck('auto_link', 1);
     $form->setMatch('auto_link', PHPWS_Settings::get('pagesmith', 'auto_link'));
     $form->setLabel('auto_link', dgettext('pagesmith', 'Add menu link for new pages.'));
     $form->addCheck('back_to_top', 1);
     $form->setMatch('back_to_top', PHPWS_Settings::get('pagesmith', 'back_to_top'));
     $form->setLabel('back_to_top', dgettext('pagesmith', 'Add "Back to top" links at page bottom.'));
     $form->addCheck('create_shortcuts', 1);
     $form->setMatch('create_shortcuts', PHPWS_Settings::get('pagesmith', 'create_shortcuts'));
     $form->setLabel('create_shortcuts', dgettext('pagesmith', 'Create Access shortcuts automatically'));
     $form->addTplTag('LENGTH_EXAMPLE', 'pagesmith/2 => index.php?module=pagesmith&uop=view_page&id=2');
     $this->ps->title = dgettext('pagesmith', 'PageSmith Settings');
     $tpl['SHORTEN_MENU_LINKS'] = PHPWS_Text::secureLink(dgettext('pagesmith', 'Shorten all menu links'), 'pagesmith', array('aop' => 'shorten_links'));
     $tpl['SHORTEN_MENU_LINKS_URI'] = PHPWS_Text::linkAddress('pagesmith', array('aop' => 'shorten_links'), true);
     $tpl['LENGTHEN_MENU_LINKS'] = PHPWS_Text::secureLink(dgettext('pagesmith', 'Lengthen all menu links'), 'pagesmith', array('aop' => 'lengthen_links'));
     $tpl['LENGTHEN_MENU_LINKS_URI'] = PHPWS_Text::linkAddress('pagesmith', array('aop' => 'lengthen_links'), true);
     $form->mergeTemplate($tpl);
     $this->ps->content = PHPWS_Template::process($form->getTemplate(), 'pagesmith', 'settings.tpl');
 }
コード例 #11
0
ファイル: Checkin_Admin.php プロジェクト: HaldunA/phpwebsite
 public function report2()
 {
     $today = mktime(0, 0, 0);
     $tomorrow = $today + 86400;
     $form = new PHPWS_Form('report-date');
     $form->setMethod('get');
     $form->addHidden('module', 'checkin');
     $form->addHidden('aop', 'report');
     // Single day report
     $form->addTplTag('DAY_LABEL', dgettext('checkin', 'All visits on'));
     $form->addText('day_date', strftime('%m/%d/%Y', $today));
     $form->setExtra('day_date', 'class="datepicker"');
     $form->setSize('day_date', 10);
     $form->addSubmit('day_submit', dgettext('checkin', 'View Report'));
     // Timespan report
     $form->addTplTag('TIMESPAN_LABEL', dgettext('checkin', 'All visits between'));
     $form->addText('timespan_start', strftime('%m/%d/%Y', $today));
     $form->setExtra('timespan_start', 'class="datepicker"');
     $form->setSize('timespan_start', 10);
     $form->addText('timespan_end', strftime('%m/%d/%Y', $tomorrow));
     $form->setExtra('timespan_end', 'class="datepicker"');
     $form->setSize('timespan_end', 10);
     $form->addSubmit('timespan_submit', dgettext('checkin', 'View Report'));
     // Single visitor report
     $form->addTplTag('VISITOR_LABEL', dgettext('checkin', 'All visits by'));
     $form->addText('visitor_name');
     $form->addSubmit('visitor_submit', dgettext('checkin', 'View Report'));
     // All visitor report
     $form->addTplTag('ALL_VISITORS_LABEL', dgettext('checkin', 'All visits by all visitors'));
     $form->addSubmit('all_visitors_submit', dgettext('checkin', 'View Report'));
     // Reason report
     $reasons = $this->getReasons();
     if (!empty($reasons)) {
         $reasons = array_reverse($reasons, true);
         $reasons[0] = dgettext('checkin', '-- Choose a reason --');
         $reasons = array_reverse($reasons, true);
         $form->addSelect('reason_select', $reasons);
         $form->addTplTag('REASON_LABEL', dgettext('checkin', 'All visits for'));
     }
     $form->addSubmit('reason_submit', dgettext('checkin', 'View Report'));
     $tpl = $form->getTemplate();
     javascript('datepicker');
     //$this->content = PHPWS_Template::process($tpl, 'checkin', 'report.tpl');
     $this->content = PHPWS_Template::process($tpl, 'checkin', 'report_new.tpl');
 }
コード例 #12
0
ファイル: WikiSettings.php プロジェクト: Jopperi/wiki
 /**
  * Settings Administration
  *
  * @author Greg Meiste <*****@*****.**>
  */
 function admin()
 {
     if (!Current_User::authorized('wiki', 'edit_settings')) {
         Current_User::disallow(dgettext('wiki', 'User attempted access to Wiki Settings administration.'));
         return;
     }
     javascript('jquery');
     PHPWS_Core::initModClass('wiki', 'WikiPage.php');
     PHPWS_Core::initCoreClass('DBPager.php');
     if (isset($_POST['op']) && $_POST['op'] == 'savesettings') {
         WikiManager::sendMessage(WikiSettings::save(), 'admin');
     }
     $tabs = 1;
     $form = new PHPWS_Form();
     $msg = dgettext('wiki', 'Enabling this setting will show the default wiki page on the home page of the web site.');
     $form->addCheck('show_on_home');
     $form->setMatch('show_on_home', PHPWS_Settings::get('wiki', 'show_on_home'));
     $form->addTplTag('SHOW_ON_HOME_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Show on home page'), 'id' => 'show_on_home_info', 'message' => $msg)));
     $form->setTab('show_on_home', $tabs++);
     $msg = dgettext('wiki', 'Enabling this setting will allow all visitors to view the wiki.
                              When disabled, only registered users can view the wiki.');
     $form->addCheck('allow_anon_view');
     $form->setMatch('allow_anon_view', PHPWS_Settings::get('wiki', 'allow_anon_view'));
     $form->addTplTag('ALLOW_ANON_VIEW_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Allow anonymous viewing'), 'id' => 'allow_anon_view_info', 'message' => $msg)));
     $form->setTab('allow_anon_view', $tabs++);
     $msg = dgettext('wiki', 'Enabling this setting will allow all registered users to edit pages.  When disabled, only
                              registered users with admin privileges can edit pages. Anonymous visitors can never edit pages.');
     $form->addCheck('allow_page_edit');
     $form->setMatch('allow_page_edit', PHPWS_Settings::get('wiki', 'allow_page_edit'));
     $form->addTplTag('ALLOW_PAGE_EDIT_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Allow all registered users to edit pages'), 'id' => 'allow_page_edit_info', 'message' => $msg)));
     $form->setTab('allow_page_edit', $tabs++);
     $msg = dgettext('wiki', 'Enabling this setting will allow all registered users to upload images.  When disabled, only
                              registered users with admin privileges can upload images.  Anonymous visitors can never upload images.');
     $form->addCheck('allow_image_upload');
     $form->setMatch('allow_image_upload', PHPWS_Settings::get('wiki', 'allow_image_upload'));
     $form->addTplTag('ALLOW_IMAGE_UPLOAD_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Allow all registered users to upload images'), 'id' => 'allow_image_upload_info', 'message' => $msg)));
     $form->setTab('allow_image_upload', $tabs++);
     $msg = dgettext('wiki', 'When enabled, the page text will also be parsed by the BBCode parser instead of just the Text_Wiki
                              parser. Keep in mind that everything you can do with BBCode can be done with wikitax.');
     $form->addCheck('allow_bbcode');
     $form->setMatch('allow_bbcode', PHPWS_Settings::get('wiki', 'allow_bbcode'));
     $form->addTplTag('ALLOW_BBCODE_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Enable BBCode parser'), 'id' => 'allow_bbcode_info', 'message' => $msg)));
     $form->setTab('allow_bbcode', $tabs++);
     $msg = dgettext('wiki', 'When enabled, the extended character set will be supported for wiki page names.  For example,
                              German umlauts would be allowed in a wiki page name.');
     $form->addCheck('ext_chars_support');
     $form->setMatch('ext_chars_support', PHPWS_Settings::get('wiki', 'ext_chars_support'));
     $form->addTplTag('EXT_CHARS_SUPPORT_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Enable extended character set'), 'id' => 'ext_chars_support_info', 'message' => $msg)));
     $form->setTab('ext_chars_support', $tabs++);
     $msg = dgettext('wiki', 'Enabling this setting will add the current wiki page title to the site title which appears in the
                              browser title bar.  The site title is sometimes used in themes meaning this setting would add the
                              wiki page title to the theme as well.');
     $form->addCheck('add_to_title');
     $form->setMatch('add_to_title', PHPWS_Settings::get('wiki', 'add_to_title'));
     $form->addTplTag('ADD_TO_TITLE_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Add wiki page title to site title'), 'id' => 'add_to_title_info', 'message' => $msg)));
     $form->setTab('add_to_title', $tabs++);
     $msg = dgettext('wiki', 'Enabling this setting will format the current wiki page title before being displayed anywhere
                              (excluding the wiki page text) by the module.  The page title in the page text will have to be formatted
                              manually if you do not like the standard WordsSmashedTogether default. The automatic formatting by the
                              module will add spaces to the WikiPageTitle, making it Wiki Page Title.<br /><br />Remember, you will
                              still have to refer to the page as WikiPageTitle in the page text, but you can change its appearance by
                              using [WikiPageTitle Your Formatted Title Here].<br /><br />If this is confusing to you or others, it is
                              recommended to not use this feature.');
     $form->addCheck('format_title');
     $form->setMatch('format_title', PHPWS_Settings::get('wiki', 'format_title'));
     $form->addTplTag('FORMAT_TITLE_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Format the wiki page title before displaying'), 'id' => 'format_title_info', 'message' => $msg)));
     $form->setTab('format_title', $tabs++);
     $msg = dgettext('wiki', 'Enabling this setting will show the <b>Last modified by</b> information on each wiki page. However,
                              if UPDATED_INFO tag is not in the view template, the information will never show up, regardless of how
                              this option is set.');
     $form->addCheck('show_modified_info');
     $form->setMatch('show_modified_info', PHPWS_Settings::get('wiki', 'show_modified_info'));
     $form->addTplTag('SHOW_MODIFIED_INFO_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Show page modified information'), 'id' => 'show_modified_info_info', 'message' => $msg)));
     $form->setTab('show_modified_info', $tabs++);
     $msg = dgettext('wiki', 'By default, when comparing two page revisions, the changes will be presented in a two column format.
                              On fixed width layouts this could cause excessive horizontal scrolling.  Setting this option will change
                              the comparison to a single column format.');
     $form->addCheck('diff_type');
     $form->setMatch('diff_type', PHPWS_Settings::get('wiki', 'diff_type') == 'one_col');
     $form->addTplTag('DIFF_TYPE_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Use single column diff'), 'id' => 'diff_type_info', 'message' => $msg)));
     $form->setTab('diff_type', $tabs++);
     $msg = dgettext('wiki', 'Enabling this setting will email a notification to the Wiki Administrator email address on every page edit.');
     $form->addCheck('monitor_edits');
     $form->setMatch('monitor_edits', PHPWS_Settings::get('wiki', 'monitor_edits'));
     $form->addTplTag('MONITOR_EDITS_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Monitor Edits'), 'id' => 'monitor_edits_info', 'message' => $msg)));
     $form->setTab('monitor_edits', $tabs++);
     $msg = dgettext('wiki', 'Enter in the email address of the Wiki administrator.  If this field is left blank or has an invalid email
                              address, then the change will be ignored.');
     $form->addText('admin_email', PHPWS_Settings::get('wiki', 'admin_email'));
     $form->setSize('admin_email', 25);
     $form->addTplTag('ADMIN_EMAIL_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Wiki Admin Email'), 'id' => 'admin_email_info', 'message' => $msg)));
     $form->setTab('admin_email', $tabs++);
     $msg = dgettext('wiki', 'This is the body text of the email sent when wiki pages are edited.  HTML will be stripped out as the email
                              will be sent as Plain Text.  You can use variables [page] and [url] to represent the name of the wiki page
                              and the url to view the page, respectively.');
     $form->addTextArea('email_text', PHPWS_Settings::get('wiki', 'email_text'));
     $form->setWidth('email_text', '80%');
     $form->setRows('email_text', 5);
     $form->addTplTag('EMAIL_TEXT_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Email Notification Text'), 'id' => 'email_text_info', 'message' => $msg)));
     $form->setTab('email_text', $tabs++);
     $msg = dgettext('wiki', 'The default page to display when no instructions are passed to the Wiki module.');
     $form->addText('default_page', PHPWS_Settings::get('wiki', 'default_page'));
     $form->setSize('default_page', 25, 100);
     $form->addTplTag('DEFAULT_PAGE_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Default page'), 'id' => 'default_page_info', 'message' => $msg)));
     $form->setTab('default_page', $tabs++);
     $msg = dgettext('wiki', 'This controls where external pages will appear. _blank opens the new page in a new window. _parent is
                              used in the situation where a frameset file is nested inside another frameset file. A link in one of
                              the inner frameset documents which uses _parent will load the new page where the inner frameset file had
                              been. If the current page\'s frameset file does not have any parent, then _parent works exactly like
                              _top - the new document is loaded in the full window. _self puts the new page in the same window and
                              frame as the current page.');
     $options = array('_blank' => '_blank', '_parent' => '_parent', '_self' => '_self', '_top' => '_top');
     $form->addSelect('ext_page_target', $options);
     $form->setMatch('ext_page_target', PHPWS_Settings::get('wiki', 'ext_page_target'));
     $form->addTplTag('EXT_PAGE_TARGET_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Target for external links'), 'id' => 'ext_page_target_info', 'message' => $msg)));
     $form->setTab('ext_page_target', $tabs++);
     $form->addCheck('immutable_page');
     $form->setMatch('immutable_page', PHPWS_Settings::get('wiki', 'immutable_page'));
     $form->setLabel('immutable_page', dgettext('wiki', 'Show immutable page text (if applicable)'));
     $form->setTab('immutable_page', $tabs++);
     $form->addCheck('raw_text');
     $form->setMatch('raw_text', PHPWS_Settings::get('wiki', 'raw_text'));
     $form->setLabel('raw_text', dgettext('wiki', 'Show raw text link'));
     $form->setTab('raw_text', $tabs++);
     $form->addCheck('print_view');
     $form->setMatch('print_view', PHPWS_Settings::get('wiki', 'print_view'));
     $form->setLabel('print_view', dgettext('wiki', 'Show print view link'));
     $form->setTab('print_view', $tabs++);
     $form->addCheck('what_links_here');
     $form->setMatch('what_links_here', PHPWS_Settings::get('wiki', 'what_links_here'));
     $form->setLabel('what_links_here', dgettext('wiki', 'Show what links here link'));
     $form->setTab('what_links_here', $tabs++);
     $form->addCheck('recent_changes');
     $form->setMatch('recent_changes', PHPWS_Settings::get('wiki', 'recent_changes'));
     $form->setLabel('recent_changes', dgettext('wiki', 'Show recent changes link'));
     $form->setTab('recent_changes', $tabs++);
     $form->addCheck('random_page');
     $form->setMatch('random_page', PHPWS_Settings::get('wiki', 'random_page'));
     $form->setLabel('random_page', dgettext('wiki', 'Show random page link'));
     $form->setTab('random_page', $tabs++);
     $form->addCheck('discussion');
     $form->setMatch('discussion', PHPWS_Settings::get('wiki', 'discussion'));
     $form->setLabel('discussion', dgettext('wiki', 'Enable discussion for registered users'));
     $form->setTab('discussion', $tabs++);
     $form->addCheck('discussion_anon');
     $form->setMatch('discussion_anon', PHPWS_Settings::get('wiki', 'discussion_anon'));
     $form->setLabel('discussion_anon', dgettext('wiki', 'Allow anonymous discussion'));
     $form->setTab('discussion_anon', $tabs++);
     $form->addSubmit('save', dgettext('wiki', 'Save Settings'));
     $form->setTab('save', $tabs);
     $form->addHidden('module', 'wiki');
     $form->addHidden('op', 'savesettings');
     $tags = $form->getTemplate();
     $tags['BACK'] = PHPWS_Text::moduleLink(dgettext('wiki', 'Back to Wiki'), 'wiki');
     $tags['MESSAGE'] = WikiManager::getMessage();
     $tags['MENU_ITEMS_LABEL'] = dgettext('wiki', 'Menu Items');
     $tags['DISCUSSION_SECTION_LABEL'] = dgettext('wiki', 'Discussion');
     $tags['SETTINGS_LABEL'] = dgettext('wiki', 'Settings');
     $tags['PAGES_LABEL'] = dgettext('wiki', 'Wiki Pages');
     $tags['TITLE'] = dgettext('wiki', 'Page Name');
     $tags['UPDATED'] = dgettext('wiki', 'Updated');
     $tags['VERSION'] = dgettext('wiki', 'Version');
     $tags['HITS'] = dgettext('wiki', 'Hits');
     $tags['ORPHANED'] = dgettext('wiki', 'Orphaned');
     $tags['ACTIONS'] = dgettext('wiki', 'Actions');
     $pager = new DBPager('wiki_pages', 'WikiPage');
     $pager->setModule('wiki');
     $pager->setTemplate('admin.tpl');
     $pager->addToggle(PHPWS_LIST_TOGGLE_CLASS);
     $pager->addPageTags($tags);
     $pager->addRowTags('getTpl');
     $pager->setSearch('title', 'pagetext');
     $pager->setDefaultOrder('title', 'asc');
     $pager->cacheQueries();
     $template['TITLE'] = dgettext('wiki', 'Wiki Administration');
     $template['CONTENT'] = $pager->get();
     Layout::add(PHPWS_Template::process($template, 'wiki', 'box.tpl'), 'wiki', 'wiki_mod', TRUE);
 }