コード例 #1
0
ファイル: SettingsView.php プロジェクト: HaldunA/phpwebsite
 public function show()
 {
     // Setup form
     $form = new \PHPWS_Form('addthis_settings');
     $form->setMethod('POST');
     // Hidden fields for directing this request after submission
     $form->addHidden('module', 'addthis');
     $form->addHidden('action', 'SaveSettings');
     // List of checkboxes and their labels for settings
     $settingList = array('enabled', 'fb_like_enabled', 'google_plus_enabled', 'share_bar_enabled');
     $settingLabels = array('Enabled', 'Facebook Like Enabled', 'Google+ Enabled', 'Share Bar Enabled');
     // Add checkboxes, set labels
     $form->addCheck('enabled_check', $settingList);
     $form->setLabel('enabled_check', $settingLabels);
     // If a setting is enabled, then check its box
     $toCheck = array();
     foreach ($this->settings->getAll() as $key => $value) {
         if ($value == 1) {
             $toCheck[] = $key;
         }
     }
     // NB: Have to set the checked elements all at once
     $form->setMatch('enabled_check', $toCheck);
     $form->addSubmit('submit', 'Submit');
     $tpl = $form->getTemplate();
     return \PHPWS_Template::process($tpl, 'addthis', 'settings.tpl');
 }
コード例 #2
0
 public function show()
 {
     $form = new PHPWS_Form('room_change_request');
     /* Cell phone */
     $form->addText('cell_num');
     $form->setLabel('cell_num', 'Cell phone Number');
     $form->addCssClass('cell_num', 'form-control');
     $form->addCheck('cell_opt_out');
     /* Preferences */
     $halls = array(0 => 'Choose from below...');
     $halls = $halls + HMS_Residence_Hall::get_halls_array(Term::getSelectedTerm());
     $form->addRadioAssoc('type', array('switch' => 'I want to change to an open bed.', 'swap' => 'I want to swap beds with someone I know.'));
     /* Swap */
     $form->addText('swap_with');
     $form->setLabel('swap_with', 'ASU Email Address');
     $form->addCssClass('swap_with', 'form-control');
     /* Switch */
     $form->addDropBox('first_choice', $halls);
     $form->setLabel('first_choice', 'First Choice');
     $form->addCssClass('first_choice', 'form-control');
     $form->addDropBox('second_choice', $halls);
     $form->setLabel('second_choice', 'Second Choice');
     $form->addCssClass('second_choice', 'form-control');
     /* Reason */
     $form->addTextArea('reason');
     $form->setLabel('reason', 'Reason');
     $form->addCssClass('reason', 'form-control');
     $form->setRows('reason', 5);
     /* POST location */
     $cmd = CommandFactory::getCommand('SubmitRoomChangeRequest');
     $cmd->initForm($form);
     $tpl = $form->getTemplate();
     return PHPWS_Template::process($tpl, 'hms', 'student/roomChangeRequestForm.tpl');
 }
コード例 #3
0
 public function display()
 {
     // permissions...
     if (!\Current_User::isDeity()) {
         \NQ::simple('intern', NotifyUI::ERROR, 'You cannot edit administrators.');
         return false;
     }
     // set up some stuff for the page template
     $tpl = array();
     // create the list of admins
     $adminList = Admin::getAdminPager();
     // get the list of departments
     $depts = Department::getDepartmentsAssoc();
     // make the form for adding a new admin
     $form = new \PHPWS_Form('add_admin');
     $form->addSelect('department_id', $depts);
     $form->setLabel('department_id', 'Department');
     $form->addText('username');
     $form->setLabel('username', 'Username');
     $form->addCheck('all');
     $form->setLabel('all', 'All Departments');
     $form->addSubmit('submit', 'Create Admin');
     $form->setAction('index.php?module=intern&action=edit_admins');
     $form->addHidden('add', 1);
     // TODO: Add Javascript autocomplete for usernames.
     javascript('jquery');
     javascript('jquery_ui');
     javascriptMod('intern', 'admin');
     $tpl['PAGER'] = $adminList;
     $form->mergeTemplate($tpl);
     return \PHPWS_Template::process($form->getTemplate(), 'intern', 'edit_admin.tpl');
 }
コード例 #4
0
ファイル: SettingsView.php プロジェクト: HaldunA/phpwebsite
 public function show()
 {
     // Setup form
     $form = new PHPWS_Form('likebox_settings');
     $form->setMethod('POST');
     // Hidden fields for directing this request after submission
     $form->addHidden('module', 'likebox');
     $form->addHidden('action', 'SaveSettings');
     // Enabled Checkbox
     $form->addCheck('enabled', 'enabled');
     $form->setLabel('enabled', 'Enabled');
     // URL
     $form->addText('fb_url', $this->settings->get('fb_url'));
     $form->setLabel('fb_url', 'Facebook Page URL:');
     // Width
     $form->addText('width', $this->settings->get('width'));
     $form->setLabel('width', 'Width');
     // Height
     $form->addText('height', $this->settings->get('height'));
     $form->setLabel('height', 'Height');
     // Show header bar i.e. "Find us on Facebook"
     $form->addCheck('small_header', 'small_header');
     $form->setLabel('small_header', 'Use Small header');
     // Show border
     $form->addCheck('hide_cover', 'hide_cover');
     $form->setLabel('hide_cover', 'Hide Cover Photo');
     // Show stream
     $form->addCheck('show_posts', 'show_posts');
     $form->setLabel('show_posts', 'Show Page Posts');
     // Show faces
     $form->addCheck('show_faces', 'show_faces');
     $form->setLabel('show_faces', 'Show Friend\'s faces');
     // Submit button
     $form->addSubmit('submit', 'Submit');
     $checkBoxes = array('enabled', 'small_header', 'hide_cover', 'show_posts', 'show_faces');
     foreach ($checkBoxes as $key) {
         $value = $this->settings->get($key);
         if (isset($value) && $value == 1) {
             $form->setMatch($key, $key);
         }
     }
     $tpl = $form->getTemplate();
     return PHPWS_Template::process($tpl, 'likebox', 'settings.tpl');
 }
コード例 #5
0
 public function addForm(PHPWS_Form &$form)
 {
     $form->addText('owa_url', $this->getOwaUrl());
     $form->setLabel('owa_url', dgettext('analytics', 'Base URL of Open Web Analytics (DO specify protocol (http:// or https://)'));
     $form->setRequired('owa_url');
     $form->addText('owa_site_id', $this->getOwaSiteId());
     $form->setLabel('owa_site_id', dgettext('analytics', 'Open Web Analytics Site ID'));
     $form->setRequired('owa_site_id');
     $form->addCheck('owa_track_page_view', 1);
     $form->setMatch('owa_track_page_view', $this->getTrackPageView());
     $form->setLabel('owa_track_page_view', dgettext('analytics', 'Track Page Views (see OWA documentation)'));
     $form->addCheck('owa_track_clicks', 1);
     $form->setMatch('owa_track_clicks', $this->getTrackClicks());
     $form->setLabel('owa_track_clicks', dgettext('analytics', 'Track Clicks (see OWA documentation)'));
     $form->addCheck('owa_track_domstream', 1);
     $form->setMatch('owa_track_domstream', $this->getTrackDomStream());
     $form->setLabel('owa_track_domstream', dgettext('analytics', 'Track DOM Stream (see OWA documentation)'));
 }
コード例 #6
0
ファイル: Admin.php プロジェクト: par-orillonsoft/phpwebsite
 private function settingsForm()
 {
     \Layout::addStyle('properties', 'forms.css');
     $form = new \PHPWS_Form();
     $form->addHidden('module', 'properties');
     $form->addHidden('aop', 'post_settings');
     $form->addText('login_link', \PHPWS_Settings::get('properties', 'login_link'));
     $form->setLabel('login_link', 'Alternate authentication link');
     $form->setSize('login_link', 30);
     $form->addText('email', \PHPWS_Settings::get('properties', 'email'));
     $form->setLabel('email', 'Site email');
     $form->setSize('email', 30);
     $form->addCheck('roommate_only');
     $form->setMatch('roommate_only', \PHPWS_Settings::get('properties', 'roommate_only'));
     $form->setLabel('roommate_only', 'Only use the roommate functionality');
     $form->addSubmit('Save settings');
     $tpl = $form->getTemplate();
     if (!empty($this->errors)) {
         foreach ($this->errors as $key => $message) {
             $new_key = strtoupper($key) . '_ERROR';
             $tpl[$new_key] = $message;
         }
     }
     $this->title = 'Settings';
     $this->content = \PHPWS_Template::process($tpl, 'properties', 'settings.tpl');
 }
コード例 #7
0
ファイル: Dropbox.php プロジェクト: HaldunA/phpwebsite
 /**
  * Edit a new or existing PHAT_Dropbox element
  *
  * The edit function provides the HTML form to edit a new or existing
  * PHAT_Dropbox element.
  * g
  * return string The HTML form to edit a PHAT_Dropbox
  */
 function edit()
 {
     $numOptions = sizeof($this->getOptionText());
     if (!$numOptions || $this->getOptionSet()) {
         $numOptions = '';
     }
     $form = new PHPWS_Form();
     $form->addHidden('module', 'phatform');
     $form->addHidden('PHAT_EL_OP', 'SaveElement');
     if (!$this->getLabel()) {
         $num = $_SESSION['PHAT_FormManager']->form->numElements();
         $this->setLabel('Element' . ($num + 1));
     }
     $form->addTextArea('PHAT_ElementBlurb', $this->getBlurb());
     $form->setRows('PHAT_ElementBlurb', PHAT_DEFAULT_ROWS);
     $form->setCols('PHAT_ElementBlurb', PHAT_DEFAULT_COLS);
     $form->setLabel('PHAT_ElementBlurb', dgettext('phatform', 'Associated Text'));
     $form->addText('PHAT_ElementName', $this->getLabel());
     $form->setSize('PHAT_ElementName', PHAT_DEFAULT_SIZE, PHAT_DEFAULT_MAXSIZE);
     $form->setLabel('PHAT_ElementName', dgettext('phatform', 'Name'));
     $form->addText('PHAT_ElementNumOptions', $numOptions);
     $form->setSize('PHAT_ElementNumOptions', 5, 3);
     $form->setLabel('PHAT_ElementNumOptions', dgettext('phatform', 'Number of Options'));
     $options = $this->getOptionSets();
     if (is_array($options)) {
         $editTags['OPTION_SET_LABEL'] = dgettext('phatform', 'Predefined Option Set');
         $form->addSelect('PHAT_OptionSet', $options);
         $form->setMatch('PHAT_OptionSet', $this->getOptionSet());
     }
     $form->addCheck('PHAT_ElementRequired', 1);
     $form->setMatch('PHAT_ElementRequired', $this->isRequired());
     $form->setLabel('PHAT_ElementRequired', dgettext('phatform', 'Required'));
     $form->addSubmit('PHAT_ElementBack', dgettext('phatform', 'Back'));
     $form->addSubmit('NEXT_BUTTON', dgettext('phatform', 'Next'));
     $template = $form->getTemplate();
     return PHPWS_Template::processTemplate($template, 'phatform', 'dropbox/edit.tpl');
 }
コード例 #8
0
ファイル: User.php プロジェクト: HaldunA/phpwebsite
 public static function searchPost()
 {
     if (isset($_GET['search'])) {
         $search_phrase = $_GET['search'];
     } else {
         $search_phrase = '';
     }
     $search_phrase = str_replace('+', ' ', $search_phrase);
     $search_phrase = Search::filterWords($search_phrase);
     if (isset($_GET['alternate']) && $_GET['alternate'] != 'local') {
         Search_User::sendToAlternate($_GET['alternate'], $search_phrase);
         exit;
     }
     // hi + keep search terms for further use (like hilite for js)
     $_SESSION['search']['search_phrase'] = $search_phrase;
     // hi /
     $form = new PHPWS_Form('search_for');
     $form->setMethod('get');
     $form->addHidden('module', 'search');
     $form->addHidden('user', 'search');
     $form->addSubmit(dgettext('search', 'Search'));
     $form->addText('search', $search_phrase);
     $form->setSize('search', 40);
     $form->setLabel('search', dgettext('search', 'Search for:'));
     $form->addCheck('exact_only', 1);
     $form->setLabel('exact_only', dgettext('search', 'Exact matches only'));
     if (isset($_GET['exact_only'])) {
         $exact_match = TRUE;
         $form->setMatch('exact_only', 1);
     } else {
         $exact_match = FALSE;
     }
     $mod_list = Search_User::getModList();
     $form->addSelect('mod_title', $mod_list);
     $form->setLabel('mod_title', dgettext('search', 'Module list'));
     if (isset($_GET['mod_title'])) {
         $form->setMatch('mod_title', $_GET['mod_title']);
     }
     Search_User::addAlternates($form);
     $template = $form->getTemplate();
     if (isset($_GET['mod_title']) && $_GET['mod_title'] != 'all') {
         $module = preg_replace('/\\W/', '', $_GET['mod_title']);
     } else {
         $module = NULL;
     }
     $template['SEARCH_LOCATION'] = dgettext('search', 'Search location');
     $template['ADVANCED_LABEL'] = dgettext('search', 'Advanced Search');
     $result = Search_User::getResults($search_phrase, $module, $exact_match);
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
         $template['SEARCH_RESULTS'] = dgettext('search', 'A problem occurred during your search.');
     } elseif (empty($result)) {
         $template['SEARCH_RESULTS'] = dgettext('search', 'No results found.');
     } else {
         $template['SEARCH_RESULTS'] = $result;
     }
     $template['SEARCH_RESULTS_LABEL'] = dgettext('search', 'Search Results');
     $content = PHPWS_Template::process($template, 'search', 'search_page.tpl');
     Layout::add($content);
 }
コード例 #9
0
ファイル: Notification.php プロジェクト: jlbooker/homestead
 public function show_edit_email($error = null, $subject = null, $body = null)
 {
     $tpl = array();
     if (!is_null($error)) {
         $tpl['ERROR'] = $error;
     }
     $tpl['HEADER'] = 'Email';
     $form = new PHPWS_Form('email_content');
     if (Current_User::allow('hms', 'anonymous_notifications')) {
         $form->addCheck('anonymous');
         $form->setMatch('anonymous', isset($_REQUEST['anonymous']) ? true : false);
         $form->setLabel('anonymous', 'Send Anonymously: ');
     }
     $form->addText('subject', !is_null($subject) ? $subject : '');
     $form->setLabel('subject', 'Subject:');
     $form->setSize('subject', 35);
     $form->addTextarea('body', !is_null($body) ? $body : '');
     $form->setLabel('body', 'Message:');
     $form->addHidden('type', 'notification');
     $form->addHidden('op', 'review');
     if (isset($_REQUEST['hall'])) {
         $form->addHidden('hall', $_REQUEST['hall']);
     }
     $form->addSubmit('Submit');
     $tpl['EMAIL'] = preg_replace('/<br \\/>/', '', implode('<br />', $form->getTemplate()), 2);
     return PHPWS_Template::process($tpl, 'hms', 'admin/hall_notification_email_page.tpl');
 }
コード例 #10
0
 public function form()
 {
     javascript('jquery');
     javascriptMod('properties', 'generate');
     \Layout::addStyle('properties', 'forms.css');
     $form = new \PHPWS_Form('contact');
     $form->addHidden('module', 'properties');
     if (!empty($this->id)) {
         $form->addHidden('cid', $this->id);
         $form->addSubmit('Update contact');
     } else {
         $form->addSubmit('Add contact');
     }
     if (isset($_SESSION['Contact_User']) && !\Current_User::allow('properties')) {
         $form->addHidden('cop', 'save_contact');
         $form->addHidden('k', $_SESSION['Contact_User']->getKey());
     } else {
         $form->addHidden('aop', 'save_contact');
         $form->addText('username', $this->username);
         $form->setClass('username', 'form-control');
         $form->setLabel('username', 'User name');
         $form->setSize('username', '20', '20');
         $form->setRequired('username');
         $form->addButton('make_password', 'Create');
         $form->setId('make_password', 'make-password');
         $form->setClass('make_password', 'btn btn-default');
         $form->addCheck('contact_contact', 1);
         $form->setLabel('contact_contact', 'Send contact email');
         if (!$this->id) {
             $form->setMatch('contact_contact', 1);
         }
     }
     $form->addPassword('password');
     $form->setLabel('password', 'Password');
     $form->setClass('password', 'form-control');
     $form->addPassword('pw_check');
     $form->setLabel('pw_check', 'Retype password below');
     $form->setClass('pw_check', 'form-control');
     $form->addText('first_name', $this->first_name);
     $form->setLabel('first_name', 'Contact first name');
     $form->setRequired('first_name');
     $form->setClass('first_name', 'form-control');
     $form->addText('last_name', $this->last_name);
     $form->setLabel('last_name', 'Contact last name');
     $form->setRequired('last_name');
     $form->setClass('last_name', 'form-control');
     $form->addText('phone', $this->getPhone());
     $form->setLabel('phone', 'Phone number');
     $form->setRequired('phone');
     $form->setClass('phone', 'form-control');
     $form->addText('email_address', $this->email_address);
     $form->setLabel('email_address', 'Email address');
     $form->setRequired('email_address');
     $form->setSize('email_address', 40);
     $form->setClass('email_address', 'form-control');
     $form->addText('company_name', $this->company_name);
     $form->setLabel('company_name', 'Company name');
     $form->setRequired('company_name');
     $form->setSize('company_name', 40);
     $form->setClass('company_name', 'form-control');
     $form->addText('company_url', $this->company_url);
     $form->setLabel('company_url', 'Company url');
     $form->setSize('company_url', 40);
     $form->setClass('company_url', 'form-control');
     $form->addText('company_address', $this->company_address);
     $form->setLabel('company_address', 'Company (or renter) address');
     $form->setClass('company_address', 'form-control');
     $form->addTextArea('times_available', $this->times_available);
     $form->setLabel('times_available', 'Days and hours available for contact');
     $form->setRows('times_available', 4);
     $form->setCols('times_available', 20);
     $form->setClass('times_available', 'form-control');
     $tpl = $form->getTemplate();
     if (!empty($this->errors)) {
         foreach ($this->errors as $key => $message) {
             $new_key = strtoupper($key) . '_ERROR';
             $tpl[$new_key] = $message;
         }
     }
     return \PHPWS_Template::process($tpl, 'properties', 'edit_contact.tpl');
 }
コード例 #11
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');
 }
コード例 #12
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');
 }
コード例 #13
0
ファイル: Forms.php プロジェクト: HaldunA/phpwebsite
 public static function denyAllowForm()
 {
     if (!Current_User::allow('access', 'admin_options')) {
         Current_User::disallow();
         return;
     }
     PHPWS_Core::initModClass('access', 'Allow_Deny.php');
     $form = new PHPWS_Form('allow_deny');
     $form->addHidden('module', 'access');
     $form->addHidden('command', 'post_deny_allow');
     $form->addCheck('allow_deny_enabled', 1);
     $form->setMatch('allow_deny_enabled', PHPWS_Settings::get('access', 'allow_deny_enabled'));
     $form->setLabel('allow_deny_enabled', dgettext('access', 'Allow/Deny enabled'));
     $form->addSubmit('go', dgettext('access', 'Go'));
     $result = Access::getAllowDeny();
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
     }
     $form->addText('allow_address');
     $form->addText('deny_address');
     $form->addSubmit('add_allow_address', dgettext('access', 'Add allowed IP'));
     $form->addSubmit('add_deny_address', dgettext('access', 'Add denied IP'));
     $db = new PHPWS_DB('access_allow_deny');
     $result = $db->getObjects('Access_Allow_Deny');
     $options['none'] = dgettext('access', '-- Choose option --');
     $options['active'] = dgettext('access', 'Activate');
     $options['deactive'] = dgettext('access', 'Deactivate');
     $options['delete'] = dgettext('access', 'Delete');
     if (PHPWS_Settings::get('access', 'allow_all')) {
         $allow_all = TRUE;
         $options['allow_all'] = dgettext('access', 'Do not allow all');
     } else {
         $allow_all = FALSE;
         $options['allow_all'] = dgettext('access', 'Allow all');
     }
     $form->addSelect('allow_action', $options);
     unset($options['allow_all']);
     if (PHPWS_Settings::get('access', 'deny_all')) {
         $deny_all = TRUE;
         $options['deny_all'] = dgettext('access', 'Do not deny all');
     } else {
         $deny_all = FALSE;
         $options['deny_all'] = dgettext('access', 'Deny all');
     }
     $form->addSelect('deny_action', $options);
     $template = $form->getTemplate();
     if ($allow_all) {
         $template['ALLOW_ALL_MESSAGE'] = dgettext('access', 'You have "Allow all" enabled. All rows below will be ignored.');
     }
     if ($deny_all) {
         $template['DENY_ALL_MESSAGE'] = dgettext('access', 'You have "Deny all" enabled. All rows below will be ignored.');
     }
     $js_vars['value'] = dgettext('access', 'Go');
     $js_vars['action_match'] = 'delete';
     $js_vars['message'] = dgettext('access', 'Are you sure you want to delete the checked ips?');
     $js_vars['select_id'] = 'allow_deny_allow_action';
     $template['ALLOW_ACTION_SUBMIT'] = javascript('select_confirm', $js_vars);
     $js_vars['select_id'] = 'allow_deny_deny_action';
     $template['DENY_ACTION_SUBMIT'] = javascript('select_confirm', $js_vars);
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
         return dgettext('access', 'An error occurred when trying to access the allowed and denied ip records. Please check your logs.');
     } elseif (empty($result)) {
         $template['DENY_MESSAGE'] = dgettext('access', 'No denied ip addresses found.');
         $template['ALLOW_MESSAGE'] = dgettext('access', 'No allowed ip addresses found.');
     } else {
         foreach ($result as $allow_deny) {
             $action = PHPWS_Text::secureLink(dgettext('access', 'Delete'), 'access', array('ad_id' => $allow_deny->id, 'command' => 'delete_allow_deny'));
             if ($allow_deny->active) {
                 $active = dgettext('access', 'Yes');
             } else {
                 $active = dgettext('access', 'No');
             }
             if ($allow_deny->allow_or_deny) {
                 $check = sprintf('<input type="checkbox" name="allows[]" value="%s" />', $allow_deny->id);
                 $template['allow_rows'][] = array('ALLOW_CHECK' => $check, 'ALLOW_IP_ADDRESS' => $allow_deny->ip_address, 'ALLOW_ACTIVE' => $active, 'ALLOW_ACTION' => $action);
             } else {
                 $check = sprintf('<input type="checkbox" name="denys[]" value="%s" />', $allow_deny->id);
                 $template['deny_rows'][] = array('DENY_CHECK' => $check, 'DENY_IP_ADDRESS' => $allow_deny->ip_address, 'DENY_ACTIVE' => $active, 'DENY_ACTION' => $action);
             }
         }
         if (empty($template['allow_rows'])) {
             $template['ALLOW_MESSAGE'] = dgettext('access', 'No allowed ip addresses found.');
         }
         if (empty($template['deny_rows'])) {
             $template['DENY_MESSAGE'] = dgettext('access', 'No denied ip addresses found.');
         }
     }
     $template['CHECK_ALL_ALLOW'] = javascript('check_all', array('checkbox_name' => 'allows'));
     $template['CHECK_ALL_DENY'] = javascript('check_all', array('checkbox_name' => 'denys'));
     $template['ACTIVE_LABEL'] = dgettext('access', 'Active?');
     $template['ALLOW_TITLE'] = dgettext('access', 'Allowed IPs');
     $template['DENY_TITLE'] = dgettext('access', 'Denied IPs');
     $template['ACTION_LABEL'] = dgettext('access', 'Action');
     $template['IP_ADDRESS_LABEL'] = dgettext('access', 'IP Address');
     $template['WARNING'] = dgettext('access', 'Remember to "Update" your access file when finished changing IP rules.');
     return PHPWS_Template::process($template, 'access', 'forms/allow_deny.tpl');
 }
コード例 #14
0
ファイル: Blog_Form.php プロジェクト: HaldunA/phpwebsite
 public static function settings()
 {
     $form = new PHPWS_Form();
     $form->addHidden('module', 'blog');
     $form->addHidden('action', 'admin');
     $form->addHidden('command', 'post_settings');
     $form->addText('blog_limit', PHPWS_Settings::get('blog', 'blog_limit'));
     $form->setSize('blog_limit', 2, 2);
     $form->setLabel('blog_limit', dgettext('blog', 'Entries shown per page'));
     $form->addCssClass('blog_limit', 'form-control');
     $form->addText('past_entries', PHPWS_Settings::get('blog', 'past_entries'));
     $form->setLabel('past_entries', dgettext('blog', 'Previous entries shown'));
     $form->setSize('past_entries', 2, 2);
     $form->addCssClass('past_entries', 'form-control');
     // Show/hide posted on date
     $form->addCheck('show_posted_date', 1);
     $form->setLabel('show_posted_date', dgettext('blog', 'Show the date the post was made'));
     $form->setMatch('show_posted_date', PHPWS_Settings::get('blog', 'show_posted_date'));
     // Show/hide posted by user full name
     $form->addCheck('show_posted_by', 1);
     $form->setLabel('show_posted_by', dgettext('blog', 'Show the author\'s name'));
     $form->setMatch('show_posted_by', PHPWS_Settings::get('blog', 'show_posted_by'));
     $form->addCheck('simple_image', 1);
     $form->setLabel('simple_image', dgettext('blog', 'Use Image Manager'));
     $form->setMatch('simple_image', PHPWS_Settings::get('blog', 'simple_image'));
     $form->addCheck('mod_folders_only', 1);
     $form->setLabel('mod_folders_only', dgettext('blog', 'Hide general image folders'));
     $form->setMatch('mod_folders_only', PHPWS_Settings::get('blog', 'mod_folders_only'));
     $form->addCheck('home_page_display', 1);
     $form->setLabel('home_page_display', dgettext('blog', 'Show blog on home page'));
     $form->setMatch('home_page_display', PHPWS_Settings::get('blog', 'home_page_display'));
     $form->addCheck('logged_users_only', 1);
     $form->setLabel('logged_users_only', dgettext('blog', 'Logged user view only'));
     $form->setMatch('logged_users_only', PHPWS_Settings::get('blog', 'logged_users_only'));
     PHPWS_Core::initModClass('users', 'Action.php');
     $groups = User_Action::getGroups('group');
     if (!empty($groups)) {
         $group_match = array();
         $group_match_str = PHPWS_Settings::get('blog', 'view_only');
         if (!empty($group_match_str)) {
             $group_match = explode(':', $group_match_str);
         }
         $form->addMultiple('view_only', $groups);
         $form->setLabel('view_only', dgettext('blog', 'Limit blog to specific groups'));
         $form->setMatch('view_only', $group_match);
         $form->addCssClass('view_only', 'form-control');
     }
     $show[0] = dgettext('blog', 'Do not show');
     $show[1] = dgettext('blog', 'Only on home page');
     $show[2] = dgettext('blog', 'Always');
     $form->addSelect('show_recent', $show);
     $form->setLabel('show_recent', dgettext('blog', 'Show recent entries'));
     $form->setMatch('show_recent', PHPWS_Settings::get('blog', 'show_recent'));
     $form->addCssClass('show_recent', 'form-control');
     $form->addTextField('max_width', PHPWS_Settings::get('blog', 'max_width'));
     $form->setLabel('max_width', dgettext('blog', 'Maximum image width (50-2048)'));
     $form->setSize('max_width', 4, 4);
     $form->addCssClass('max_width', 'form-control');
     $form->addTextField('max_height', PHPWS_Settings::get('blog', 'max_height'));
     $form->setLabel('max_height', dgettext('blog', 'Maximum image height (50-2048)'));
     $form->setSize('max_height', 4, 4);
     $form->addCssClass('max_height', 'form-control');
     $form->addTextArea('comment_script', PHPWS_Settings::get('blog', 'comment_script'));
     $form->setLabel('comment_script', dgettext('blog', 'Paste in your comment code here (e.g. Disqus, Livefyre, Facebook, etc.)'));
     $form->addCssClass('comment_script', 'form-control');
     $form->addSubmit(dgettext('blog', 'Save settings'));
     if (Current_User::isDeity()) {
         $date_script = javascript('datetimepicker', array('format' => 'Y/m/d', 'timepicker' => false, 'id' => 'phpws_form_purge_date'), false, true, true);
         $form->addText('purge_date', date('Y/m/d', time() - 31536000));
         $form->setLabel('purge_date', dgettext('blog', 'Purge all entries before this date'));
         $form->addCssClass('purge_date', 'form-control datetimepicker');
         $form->addSubmit('purge_confirm', dgettext('blog', 'Confirm purge'));
         $form->setClass('purge_confirm', 'btn btn-danger');
     } else {
         $date_script = null;
     }
     $template = $form->getTemplate();
     $template['date_script'] = $date_script;
     if (PHPWS_Settings::get('blog', 'allow_anonymous_submits')) {
         $template['MENU_LINK'] = PHPWS_Text::secureLink(dgettext('blog', 'Clip for menu'), 'blog', array('action' => 'admin', 'command' => 'menu_submit_link'));
     }
     $template['VIEW_LABEL'] = dgettext('blog', 'View');
     $template['SUBMISSION_LABEL'] = dgettext('blog', 'Submission');
     $template['PAST_NOTE'] = dgettext('blog', 'Set to zero to prevent display');
     $template['COMMENTS_LABEL'] = dgettext('blog', 'Commenting');
     return PHPWS_Template::process($template, 'blog', 'settings.tpl');
 }
コード例 #15
0
ファイル: Checkin_Admin.php プロジェクト: HaldunA/phpwebsite
 public function settings()
 {
     $this->title = dgettext('checkin', 'Settings');
     javascript('jquery');
     $form = new PHPWS_Form('settings');
     $form->addHidden('module', 'checkin');
     $form->addHidden('aop', 'post_settings');
     $form->addCheck('front_page', 1);
     $form->setMatch('front_page', PHPWS_Settings::get('checkin', 'front_page'));
     $form->setLabel('front_page', dgettext('checkin', 'Show public sign-in on front page'));
     $form->addCheck('staff_see_reports', 1);
     $form->setMatch('staff_see_reports', PHPWS_Settings::get('checkin', 'staff_see_reports'));
     $form->setLabel('staff_see_reports', dgettext('checkin', 'Staff can see reports'));
     $form->addText('assign_refresh', PHPWS_Settings::get('checkin', 'assign_refresh'));
     $form->setSize('assign_refresh', '3');
     $form->setLabel('assign_refresh', dgettext('checkin', 'Assignment page refresh rate (in seconds)'));
     $form->addText('waiting_refresh', PHPWS_Settings::get('checkin', 'waiting_refresh'));
     $form->setSize('waiting_refresh', '3');
     $form->setLabel('waiting_refresh', dgettext('checkin', 'Waiting page refresh rate (in seconds)'));
     $form->addCheck('collapse_signin', 1);
     $form->setLabel('collapse_signin', dgettext('checkin', 'Hide sidebar for visitors'));
     $form->setMatch('collapse_signin', PHPWS_Settings::get('checkin', 'collapse_signin'));
     $form->addCheck('unassigned_seen', 1);
     $form->setLabel('unassigned_seen', dgettext('checkin', 'Staff see unassigned visitors'));
     $form->setMatch('unassigned_seen', PHPWS_Settings::get('checkin', 'unassigned_seen'));
     $form->addCheck('sendback', 1);
     $form->setLabel('sendback', dgettext('checkin', 'Use send back button'));
     $form->setMatch('sendback', PHPWS_Settings::get('checkin', 'sendback'));
     $form->addCheck('email', 1);
     $form->setLabel('email', dgettext('checkin', 'Request email address'));
     $form->setMatch('email', PHPWS_Settings::get('checkin', 'email'));
     // Checkbox for requesting gender when checking in
     $form->addCheck('gender', 1);
     $form->setLabel('gender', dgettext('checkin', 'Request gender'));
     $form->setMatch('gender', PHPWS_Settings::get('checkin', 'gender'));
     // Checkbox for requesting birthdate when checking in
     $form->addCheck('birthdate', 1);
     $form->setLabel('birthdate', dgettext('checkin', 'Request date of birth'));
     $form->setMatch('birthdate', PHPWS_Settings::get('checkin', 'birthdate'));
     $form->addSubmit(dgettext('checkin', 'Save settings'));
     $tpl = $form->getTemplate();
     $this->content = PHPWS_Template::process($tpl, 'checkin', 'setting.tpl');
 }
コード例 #16
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');
 }
コード例 #17
0
ファイル: Admin.php プロジェクト: par-orillonsoft/phpwebsite
 public function settings()
 {
     $form = new PHPWS_Form('calendar_settings');
     $form->addHidden('module', 'calendar');
     $form->addHidden('aop', 'post_settings');
     $form->addCheckbox('allow_submissions', 1);
     $form->setMatch('allow_submissions', PHPWS_Settings::get('calendar', 'allow_submissions'));
     $form->setLabel('allow_submissions', dgettext('calendar', 'Allow public event submissions'));
     $form->addCheckbox('mini_event_link', 1);
     $form->setMatch('mini_event_link', PHPWS_Settings::get('calendar', 'mini_event_link'));
     $form->setLabel('mini_event_link', dgettext('calendar', 'Only link days with events in mini calendar'));
     $form->addCheckbox('anon_ical', 1);
     $form->setMatch('anon_ical', PHPWS_Settings::get('calendar', 'anon_ical'));
     $form->setLabel('anon_ical', dgettext('calendar', 'Allow anonymous iCal exports of public schedules'));
     $form->addCheckbox('no_follow', 1);
     $form->setMatch('no_follow', PHPWS_Settings::get('calendar', 'no_follow'));
     $form->setLabel('no_follow', dgettext('calendar', 'No follow directives added to navigation links'));
     $start_days = array(0, 1);
     $start_days_label[0] = strftime('%A', mktime(0, 0, 0, 1, 4, 1970));
     $start_days_label[1] = strftime('%A', mktime(0, 0, 0, 1, 5, 1970));
     $form->addRadio('starting_day', $start_days);
     $form->setLabel('starting_day', $start_days_label);
     $form->setMatch('starting_day', PHPWS_Settings::get('calendar', 'starting_day'));
     $form->addRadio('brief_grid', array(0, 1));
     $form->setMatch('brief_grid', PHPWS_Settings::get('calendar', 'brief_grid'));
     $form->setLabel('brief_grid', array(0 => dgettext('calendar', 'Show event titles'), 1 => dgettext('calendar', 'Show number of events')));
     $form->addCheck('personal_schedules', 1);
     $form->setLabel('personal_schedules', dgettext('calendar', 'Allow personal schedules'));
     $form->setMatch('personal_schedules', PHPWS_Settings::get('calendar', 'personal_schedules'));
     $form->addCheck('cache_month_views', 1);
     $form->setLabel('cache_month_views', dgettext('calendar', 'Cache month views (public only)'));
     $form->setMatch('cache_month_views', PHPWS_Settings::get('calendar', 'cache_month_views'));
     $form->addCheck('mini_grid', 1);
     $form->setLabel('mini_grid', dgettext('calendar', 'Show mini grid'));
     $form->setMatch('mini_grid', PHPWS_Settings::get('calendar', 'mini_grid'));
     $form->addRadio('display_mini', array(0, 1, 2));
     $form->setLabel('display_mini', array(dgettext('calendar', 'Don\'t show'), dgettext('calendar', 'Only on front page'), dgettext('calendar', 'On all pages')));
     $form->setMatch('display_mini', PHPWS_Settings::get('calendar', 'display_mini'));
     $views['grid'] = dgettext('calendar', 'Month grid');
     $views['list'] = dgettext('calendar', 'Month list');
     $views['day'] = dgettext('calendar', 'Day view');
     $views['week'] = dgettext('calendar', 'Week view');
     $form->addSelect('default_view', $views);
     $form->setLabel('default_view', dgettext('calendar', 'Default view'));
     $form->setMatch('default_view', PHPWS_Settings::get('calendar', 'default_view'));
     $form->addSubmit(dgettext('calendar', 'Save settings'));
     $tpl = $form->getTemplate();
     $tpl['BRIEF_GRID_LABEL'] = dgettext('calendar', 'Grid event display');
     $tpl['MINI_CALENDAR'] = dgettext('calendar', 'Display mini calendar');
     $tpl['START_LABEL'] = dgettext('calendar', 'Week start day');
     $this->content = PHPWS_Template::process($tpl, 'calendar', 'admin/settings.tpl');
     $this->title = dgettext('calendar', 'Calendar settings');
 }
コード例 #18
0
ファイル: Room_Base.php プロジェクト: HaldunA/phpwebsite
 public function getForm($name = null)
 {
     javascript('datepicker');
     \Layout::addStyle('properties', 'forms.css');
     $form = new \PHPWS_Form($name);
     $form->addHidden('module', 'properties');
     $form->addCheck('appalcart', 1);
     $form->setLabel('appalcart', 'On Appalcart route');
     $form->setMatch('appalcart', $this->appalcart);
     $form->addSelect('campus_distance', array(0 => '0 to 5', 5 => '5 to 10', 10 => '10 to 25', 25 => 'More than 25'));
     $form->setLabel('campus_distance', 'Miles from campus');
     $form->setMatch('campus_distance', $this->campus_distance);
     $form->addCheck('clubhouse', 1);
     $form->setLabel('clubhouse', 'Clubhouse');
     $form->setMatch('clubhouse', $this->clubhouse);
     \PHPWS_Core::initModClass('properties', 'User.php');
     $contracts = User::getContracts();
     $form->addSelect('contract_length', $contracts);
     $form->setLabel('contract_length', 'Contract length');
     $form->setMatch('contract_length', $this->contract_length);
     $form->addTextarea('description', $this->description);
     $form->setLabel('description', 'Other property information');
     $form->addCheck('airconditioning', 1);
     $form->setLabel('airconditioning', 'Air Conditioning');
     $form->setMatch('airconditioning', $this->airconditioning);
     $form->addCheck('dishwasher', 1);
     $form->setLabel('dishwasher', 'Dishwasher');
     $form->setMatch('dishwasher', $this->dishwasher);
     $itypes[NET_DIALUP] = 'Dial Up';
     $itypes[NET_CABLE] = 'Cable';
     $itypes[NET_DSL] = 'DSL';
     $itypes[NET_WIRELESS] = 'Wireless';
     $itypes[NET_SATELLITE] = 'Satellite';
     $itypes[NET_FIBER] = 'Fiber';
     $itypes[NET_BOTH] = 'DSL/Cable';
     $form->addSelect('internet_type', $itypes);
     $form->setLabel('internet_type', 'Internet');
     $form->setMatch('internet_type', $this->internet_type);
     $form->addSelect('laundry_type', array(LAUNDRY_NONE => 'No laundry', LAUNDRY_ON_PREMISES => 'Laundry room on premises', LAUNDRY_HOOKUP => 'Washer/Dryer hook ups in unit', LAUNDRY_IN_UNIT => 'Washer/Dryer in unit'));
     $form->setLabel('laundry_type', 'Laundry');
     $form->setMatch('laundry_type', $this->laundry_type);
     $form->addText('monthly_rent', $this->getMonthlyRent());
     $form->setLabel('monthly_rent', 'Monthly rent');
     $form->setSize('monthly_rent', 8, 8);
     $form->setRequired('monthly_rent');
     $form->addText('move_in_date', $this->getMoveInDate());
     $form->setLabel('move_in_date', 'Move-in date');
     $form->setExtra('move_in_date', 'class="datepicker"');
     $form->addText('name', $this->name);
     $form->setLabel('name', 'Name of property');
     $form->setRequired('name');
     $form->setSize('name', 50);
     $form->addCheck('pets_allowed', 1);
     $form->setLabel('pets_allowed', 'Pets allowed');
     $form->setMatch('pets_allowed', $this->pets_allowed);
     $form->addCheck('sublease', 1);
     $form->setMatch('sublease', $this->sublease);
     $form->setLabel('sublease', 'Sublease');
     $toptions[TV_NONE] = 'Antenna';
     $toptions[TV_CABLE] = 'Cable';
     $toptions[TV_SATELLITE] = 'Satellite';
     $toptions[TV_FIBER] = 'Fiber';
     $form->addSelect('tv_type', $toptions);
     $form->setLabel('tv_type', 'Television');
     $form->setMatch('tv_type', $this->tv_type);
     $form->addSelect('trash_type', array(TRASH_ON_YOUR_OWN => 'Trash and recycling receptacles not provided', TRASH_ON_PREMISES_NO_RECYCLE => 'Trash receptacles on site.  Recycling not provided', TRASH_ON_PREMISES_WITH_RECYCLE => 'Trash and recycling receptacles provided on site', TRASH_PICKUP => 'Curbside pickup for trash and recycling'));
     $form->setMatch('trash_type', $this->trash_type);
     $form->setLabel('trash_type', 'Trash removal');
     $form->addCheck('workout_room', 1);
     $form->setMatch('workout_room', $this->workout_room);
     $form->setLabel('workout_room', 'Workout room');
     return $form;
 }
コード例 #19
0
ファイル: Block_Admin.php プロジェクト: HaldunA/phpwebsite
 public static function edit(Block_Item $block, $js = FALSE)
 {
     javascript('jquery');
     javascript('ckeditor');
     $form = new PHPWS_Form('block-form');
     $form->addHidden('module', 'block');
     $form->addCheck('hide_title', 1);
     $form->setMatch('hide_title', $block->hide_title);
     $form->setLabel('hide_title', dgettext('block', 'Hide title'));
     $form->addCheck('hide_narrow', 1);
     $form->setMatch('hide_narrow', $block->hide_narrow);
     $form->setLabel('hide_narrow', dgettext('block', 'Hide when width &lt; 768px'));
     $form->addTextArea('block_content', $block->getContent(false));
     $form->setRows('block_content', '10');
     $form->setWidth('block_content', '80%');
     $form->setLabel('block_content', dgettext('block', 'Entry'));
     if ($js) {
         if (isset($_REQUEST['key_id']) && is_numeric($_REQUEST['key_id'])) {
             $key_id = (int) $_REQUEST['key_id'];
         } else {
             $key_id = 0;
         }
         $form->addHidden('key_id', $key_id);
         $form->addHidden('action', 'postJSBlock');
         $pdb = Database::newDB();
         $pdb->addTable('block_pinned');
         $all_pinned = $pdb->select();
         if (!empty($all_pinned)) {
             $pinned = new \Variable\Arr($all_pinned);
             $pinned->indexByColumn('block_id', true, 'key_id');
             $pinned_keys = $pinned->get();
         } else {
             $pinned_keys = null;
         }
         $db = Database::newDB();
         $blocks = $db->addTable('block');
         $blocks->addField('id');
         $blocks->addOrderBy($blocks->addField('title'));
         $db->loadSelectStatement();
         while ($b = $db->fetch()) {
             /**
              * Checking here to see if this block is already set for the current
              * key OR is this block is set to show everywhere. If either,
              * then don't add to select list.
              */
             if (!empty($pinned_keys)) {
                 if (isset($pinned_keys[$b['id']])) {
                     if (in_array($key_id, $pinned_keys[$b['id']]) || in_array('-1', $pinned_keys[$b['id']])) {
                         continue;
                     }
                 }
             }
             $block_options[$b['id']] = $b['title'];
         }
         if (!empty($block_options)) {
             $form->addSelect('block_list', $block_options);
             $form->addSubmit('pick_block', 'Add this block to the page');
         }
     } else {
         $form->useEditor('block_content');
         $form->addHidden('action', 'postBlock');
         if (empty($block->id)) {
             $form->addSubmit('submit', dgettext('block', 'Save New Block'));
         } else {
             $form->addHidden('block_id', $block->getId());
             $form->addSubmit('submit', dgettext('block', 'Update Current Block'));
         }
     }
     $form->addText('title', $block->getTitle());
     $form->setLabel('title', dgettext('block', 'Title'));
     $form->setSize('title', 50);
     $template = $form->getTemplate();
     if ($js) {
         if (!empty($block_options)) {
             $template['ALTERNATIVE'] = t('or create new block below');
         }
         $content = PHPWS_Template::process($template, 'block', 'js_edit.tpl');
     } else {
         $content = PHPWS_Template::process($template, 'block', 'edit.tpl');
     }
     return $content;
 }
コード例 #20
0
ファイル: HMS_Room.php プロジェクト: jlbooker/homestead
 /**
  * DBPager row method for the floor edit pager.
  *
  * @return Array
  */
 public function get_row_edit()
 {
     javascript('jquery');
     $tpl = array();
     $tpl['ID'] = $this->id;
     $tpl['ROOM_NUMBER'] = PHPWS_Text::secureLink($this->room_number, 'hms', array('action' => 'EditRoomView', 'room' => $this->id));
     if (Current_User::allow('hms', 'room_structure') && $this->get_number_of_assignees() == 0) {
         $deleteRoomCmd = CommandFactory::getCommand('DeleteRoom');
         $deleteRoomCmd->setRoomId($this->id);
         $deleteRoomCmd->setFloorId($this->floor_id);
         $confirm = array();
         $confirm['QUESTION'] = 'Are you sure want to delete room ' . $this->room_number . '?';
         $confirm['ADDRESS'] = $deleteRoomCmd->getURI();
         $confirm['LINK'] = 'Delete';
         $tpl['DELETE'] = Layout::getJavascript('confirm', $confirm);
     }
     $form = new PHPWS_Form($this->id);
     $form->addSelect('gender_type', array(FEMALE => FEMALE_DESC, MALE => MALE_DESC, COED => COED_DESC, AUTO => AUTO_DESC));
     $form->setMatch('gender_type', $this->gender_type);
     $form->setExtra('gender_type', 'onChange="submit_form(this, true)"');
     $form->addSelect('default_gender', array(FEMALE => FEMALE_DESC, MALE => MALE_DESC, AUTO => AUTO_DESC));
     $form->setMatch('default_gender', $this->default_gender);
     $form->setExtra('default_gender', 'onChange="submit_form(this, true)"');
     $form->addSelect('rlc_reserved', array('-1' => 'Select RLC') + RlcFactory::getRlcList($this->term));
     $form->setMatch('rlc_reserved', $this->getReservedRlcId());
     $form->setExtra('rlc_reserved', 'onChange="submit_form(this, true)"');
     $form->addCheck('offline', 'yes');
     $form->setMatch('offline', $this->offline == 1 ? 'yes' : 0);
     $form->setExtra('offline', 'onChange="submit_form(this, false)"');
     $form->addCheck('reserved', 'yes');
     $form->setMatch('reserved', $this->reserved == 1 ? 'yes' : 0);
     $form->setExtra('reserved', 'onChange="submit_form(this, false)"');
     $form->addCheck('ra', 'yes');
     $form->setMatch('ra', $this->ra == 1 ? 'yes' : 0);
     $form->setExtra('ra', 'onChange="submit_form(this, false)"');
     $form->addCheck('private', 'yes');
     $form->setMatch('private', $this->private == 1 ? 'yes' : 0);
     $form->setExtra('private', 'onChange="submit_form(this, false)"');
     $form->addCheck('overflow', 'yes');
     $form->setMatch('overflow', $this->overflow == 1 ? 'yes' : 0);
     $form->setExtra('overflow', 'onChange="submit_form(this, false)"');
     $form->addCheck('ada', 'yes');
     $form->setMatch('ada', $this->isAda() ? 'yes' : 0);
     $form->setExtra('ada', 'onChange="submit_form(this, false)"');
     $form->addHidden('action', 'UpdateRoomField');
     $form->addHidden('room', $this->id);
     $form->mergeTemplate($tpl);
     //test($form->getTemplate(),1);
     return $form->getTemplate();
 }
コード例 #21
0
ファイル: Analytics.php プロジェクト: HaldunA/phpwebsite
 public static function showEditForm(Tracker $tracker)
 {
     $tpl = array();
     $tpl['TRACKER_TYPE'] = $tracker->trackerType();
     $form = new PHPWS_Form('tracker');
     $form->addHidden('module', 'analytics');
     $form->addHidden('command', 'save_tracker');
     $form->addSubmit('submit', dgettext('analytics', 'Save Tracker'));
     if (isset($_REQUEST['tracker'])) {
         $form->addHidden('tracker', $_REQUEST['tracker']);
     }
     if ($tracker->getId() > 0) {
         $form->addHidden('tracker_id', $tracker->getId());
     }
     $form->addText('name', $tracker->getName());
     $form->setLabel('name', dgettext('analytics', 'Friendly Name'));
     $form->setRequired('name');
     $form->addCheck('active', 1);
     $form->setMatch('active', $tracker->isActive());
     $form->setLabel('active', dgettext('analytics', 'Currently Active'));
     $form->addCheck('disable_if_logged', 1);
     $form->setMatch('disable_if_logged', $tracker->getDisableIfLogged());
     $form->setLabel('disable_if_logged', dgettext('analytics', 'Disable Analytics if a user is logged in'));
     $tracker->addForm($form);
     $tpl = array_merge($tpl, $form->getTemplate());
     $tpl['TRACKER_FORM'] = PHPWS_Template::process($tpl, 'analytics', $tracker->getFormTemplate());
     return PHPWS_Template::process($tpl, 'analytics', 'edit.tpl');
 }
コード例 #22
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');
    }
コード例 #23
0
 public function show()
 {
     require PHPWS_SOURCE_DIR . 'mod/hms/inc/profile_options.php';
     $majors = hms\MajorFactory::getMajorsList();
     $tpl = array();
     $profile_form = new PHPWS_Form('profile_form');
     $profile_form->useRowRepeat();
     $none_given = '<span style="color:#CCC;">none given</span>';
     /***** Contact Info *****/
     $tpl['TITLE'] = $this->student->getName() . '\'s Profile';
     $tpl['EMAIL_ADDRESS'] = "<a href=\"mailto:{$this->student->getUsername()}@appstate.edu\">{$this->student->getUsername()}@appstate.edu</a>";
     $tpl['ALTERNATE_EMAIL_LABEL'] = 'Alternate email: ';
     $alt_email = $this->profile->get_text('alternate_email');
     if (!empty($alt_email)) {
         $tpl['ALTERNATE_EMAIL'] = "<a href=\"mailto:{$alt_email}\">{$alt_email}</a>";
     } else {
         $tpl['ALTERNATE_EMAIL'] = $none_given;
     }
     $tpl['FB_LINK_LABEL'] = 'Facebook link: ';
     $fb_link = $this->profile->get_text('fb_link');
     if (!empty($fb_link)) {
         $tpl['FB_LINK'] = $fb_link;
     } else {
         $tpl['FB_LINK'] = $none_given;
     }
     $tpl['INSTAGRAM_SN_LABEL'] = 'Instagram username: '******'instagram_sn');
     if (!empty($instagram_sn)) {
         $tpl['INSTAGRAM_SN'] = $instagram_sn;
     } else {
         $tpl['INSTAGRAM_SN'] = $none_given;
     }
     $tpl['TWITTER_SN_LABEL'] = 'Twitter username: '******'twitter_sn');
     if (!empty($twitter_sn)) {
         $tpl['TWITTER_SN'] = $twitter_sn;
     } else {
         $tpl['TWITTER_SN'] = $none_given;
     }
     $tpl['TUMBLR_SN_LABEL'] = 'Tumblr username: '******'tumblr_sn');
     if (!empty($tumblr_sn)) {
         $tpl['TUMBLR_SN'] = $tumblr_sn;
     } else {
         $tpl['TUMBLR_SN'] = $none_given;
     }
     $tpl['KIK_SN_LABEL'] = 'Kik username: '******'kik_sn');
     if (!empty($kik_sn)) {
         $tpl['KIK_SN'] = $kik_sn;
     } else {
         $tpl['KIK_SN'] = $none_given;
     }
     $tpl['ABOUT_ME_LABEL'] = 'Additional information: ';
     $about_me = $this->profile->get_text('about_me');
     if (!empty($about_me)) {
         $tpl['ABOUT_ME'] = $about_me;
     } else {
         $tpl['ABOUT_ME'] = $none_given;
     }
     /***** About Me *****/
     $profile_form->addCheck('hobbies_checkbox', $hobbies);
     $profile_form->setLabel('hobbies_checkbox', $hobbies_labels);
     $profile_form->setDisabled('hobbies_checkbox');
     $tpl['HOBBIES_CHECKBOX_QUESTION'] = 'My Hobbies and Interests: ';
     # set matches on hobby check boxes
     $hobbies_matches = RoommateProfileFactory::get_hobbies_matches($this->profile);
     $profile_form->setMatch('hobbies_checkbox', $hobbies_matches);
     $profile_form->addCheck('music_checkbox', $music);
     $profile_form->setLabel('music_checkbox', $music_labels);
     $profile_form->setDisabled('music_checkbox');
     $tpl['MUSIC_CHECKBOX_QUESTION'] = 'My Music Preferences: ';
     # set matches on music check boxes
     $music_matches = RoommateProfileFactory::get_music_matches($this->profile);
     $profile_form->setMatch('music_checkbox', $music_matches);
     $profile_form->addCheck('language_checkbox', $language);
     $profile_form->setLabel('language_checkbox', $language_labels);
     $profile_form->setDisabled('language_checkbox');
     $tpl['LANGUAGE_CHECKBOX_QUESTION'] = 'Languages I speak: ';
     # set matches on language check boxes
     $language_matches = RoommateProfileFactory::get_language_matches($this->profile);
     $profile_form->setMatch('language_checkbox', $language_matches);
     $tpl['POLITICAL_VIEWS_LABEL'] = 'Political views: ';
     $tpl['POLITICAL_VIEWS'] = $political_views[$this->profile->get_text('political_views')];
     /***** College Life *****/
     $tpl['MAJOR_LABEL'] = 'Intended major: ';
     $tpl['MAJOR'] = $majors[$this->profile->get_text('major')];
     $tpl['EXPERIENCE_LABEL'] = 'I feel the most important part of my college experience is: ';
     $tpl['EXPERIENCE'] = $experiences[$this->profile->get_text('experience')];
     /***** Daily Life *****/
     $tpl['SLEEP_TIME_LABEL'] = 'I generally go to sleep: ';
     $tpl['SLEEP_TIME'] = $sleep_times[$this->profile->get_text('sleep_time')];
     $tpl['WAKEUP_TIME_LABEL'] = 'I generally wake up: ';
     $tpl['WAKEUP_TIME'] = $wakeup_times[$this->profile->get_text('wakeup_time')];
     $tpl['OVERNIGHT_GUESTS_LABEL'] = 'I plan on hosting overnight guests: ';
     $tpl['OVERNIGHT_GUESTS'] = $overnight_guests[$this->profile->get_text('overnight_guests')];
     $tpl['LOUDNESS_LABEL'] = 'In my daily activities: ';
     $tpl['LOUDNESS'] = $loudness[$this->profile->get_text('loudness')];
     $tpl['CLEANLINESS_LABEL'] = 'I would describe myself as: ';
     $tpl['CLEANLINESS'] = $cleanliness[$this->profile->get_text('cleanliness')];
     $tpl['FREE_TIME_LABEL'] = 'If I have free time I would rather: ';
     $tpl['FREE_TIME'] = $free_time[$this->profile->get_text('free_time')];
     $profile_form->addCheck('study_times', $study_times);
     $profile_form->setLabel('study_times', $study_times_labels);
     $profile_form->setDisabled('study_times');
     $tpl['STUDY_TIMES_QUESTION'] = 'I prefer to study: ';
     # set matches on study times check boxes here, set disabled
     $study_matches = RoommateProfileFactory::get_study_matches($this->profile);
     $profile_form->setMatch('study_times', $study_matches);
     $profile_form->mergeTemplate($tpl);
     $tpl = $profile_form->getTemplate();
     Layout::addPageTitle("Roommate Profile");
     return PHPWS_Template::process($tpl, 'hms', 'student/profile_form.tpl');
 }
コード例 #24
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);
 }