Ejemplo n.º 1
0
 public function show()
 {
     $username = UserStatus::getUsername();
     $currentTerm = Term::getCurrentTerm();
     $student = StudentFactory::getStudentByUsername($username, $currentTerm);
     $applicationTerm = $student->getApplicationTerm();
     $tpl = array();
     $tpl['TITLE'] = 'Contact Form';
     $form = new PHPWS_Form();
     $form->addText('name');
     $form->setLabel('name', 'Name');
     $form->addText('email');
     $form->setLabel('email', 'Email Address');
     $form->addText('phone');
     $form->setLabel('phone', 'Phone number');
     $form->addDropBox('stype', array('F' => 'New Freshmen', 'T' => 'Transfer', 'C' => 'Returning'));
     $form->setLabel('stype', 'Classification');
     $form->addTextArea('comments');
     $form->setLabel('comments', 'Question, Comments, or Description of the Problem');
     $form->addSubmit('Submit');
     $form->mergeTemplate($tpl);
     $cmd = CommandFactory::getCommand('SubmitContactForm');
     $cmd->setUsername($username);
     $cmd->setApplicationTerm($applicationTerm);
     $cmd->setStudentType($student->getType());
     $cmd->initForm($form);
     $tpl = $form->getTemplate();
     //var_dump($tpl);exit;
     return PHPWS_Template::process($tpl, 'hms', 'student/contact_page.tpl');
 }
Ejemplo n.º 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');
 }
 public function show()
 {
     $form = new PHPWS_Form('waiver');
     $form->addTextArea('usernames');
     $form->setLabel('usernames', 'ASU User names (one per line):');
     $form->setExtra('usernames', 'autofocus');
     $form->addSubmit('submit_btn', 'Create');
     $cmd = CommandFactory::getCommand('CreateWaiver');
     $cmd->initForm($form);
     $tpl = array();
     $form->mergeTemplate($tpl);
     Layout::addPageTitle("Lottery Eligibility Waiver");
     return PHPWS_Template::process($form->getTemplate(), 'hms', 'admin/eligibility_waiver.tpl');
 }
Ejemplo n.º 4
0
 function editSettings()
 {
     $form = new PHPWS_Form('whatsnew_settings');
     $form->addHidden('module', 'whatsnew');
     $form->addHidden('aop', 'post_settings');
     $form->addCheckbox('enable', 1);
     $form->setMatch('enable', PHPWS_Settings::get('whatsnew', 'enable'));
     $form->setLabel('enable', dgettext('whatsnew', 'Enable whatsnew'));
     $form->addCheckbox('homeonly', 1);
     $form->setMatch('homeonly', PHPWS_Settings::get('whatsnew', 'homeonly'));
     $form->setLabel('homeonly', dgettext('whatsnew', 'Show whatsnew sidebox on home page only'));
     $form->addTextField('title', PHPWS_Settings::get('whatsnew', 'title'));
     $form->setLabel('title', dgettext('whatsnew', 'Sidebox title'));
     $form->setSize('title', 30);
     $form->addTextArea('text', PHPWS_Settings::get('whatsnew', 'text'));
     $form->setRows('text', '4');
     $form->setCols('text', '40');
     $form->setLabel('text', dgettext('whatsnew', 'Sidebox text'));
     $form->addTextField('cache_timeout', PHPWS_Settings::get('whatsnew', 'cache_timeout'));
     $form->setLabel('cache_timeout', dgettext('whatsnew', 'Cache duration for whatsnew list (in seconds, 0-7200)'));
     $form->setSize('cache_timeout', 4, 4);
     $form->addTextField('qty_items', PHPWS_Settings::get('whatsnew', 'qty_items'));
     $form->setLabel('qty_items', dgettext('whatsnew', 'Number of recent items to display (0-50)'));
     $form->setSize('qty_items', 4, 4);
     $form->addCheckbox('show_summaries', 1);
     $form->setMatch('show_summaries', PHPWS_Settings::get('whatsnew', 'show_summaries'));
     $form->setLabel('show_summaries', dgettext('whatsnew', 'Show item summaries'));
     $form->addCheckbox('show_dates', 1);
     $form->setMatch('show_dates', PHPWS_Settings::get('whatsnew', 'show_dates'));
     $form->setLabel('show_dates', dgettext('whatsnew', 'Show item update dates'));
     $form->addCheckbox('show_source_modules', 1);
     $form->setMatch('show_source_modules', PHPWS_Settings::get('whatsnew', 'show_source_modules'));
     $form->setLabel('show_source_modules', dgettext('whatsnew', 'Show item source module names'));
     $form->addSubmit('save', dgettext('whatsnew', 'Save settings'));
     $tpl = $form->getTemplate();
     $tpl['SETTINGS_LABEL'] = dgettext('whatsnew', 'General Settings');
     $tpl['FLUSH_LINK'] = PHPWS_Text::secureLink(dgettext('whatsnew', 'Flush cache'), 'whatsnew', array('aop' => 'flush_cache'));
     $tpl['EXCLUDE'] = $this->whatsnew->getKeyMods(unserialize(PHPWS_Settings::get('whatsnew', 'exclude')), 'exclude');
     $tpl['EXCLUDE_LABEL'] = dgettext('whatsnew', 'Select any modules you wish to exclude from your whatsnew box.');
     $this->whatsnew->title = dgettext('whatsnew', 'Settings');
     $this->whatsnew->content = PHPWS_Template::process($tpl, 'whatsnew', 'edit_settings.tpl');
 }
Ejemplo n.º 5
0
 /**
  * Form for meta tags. Used for site mata tags and individual key
  * meta tags.
  */
 public static function metaForm($key_id = 0)
 {
     $meta_description = $meta_keywords = $page_title = null;
     $meta_robots = '11';
     if (!$key_id) {
         $vars = $_SESSION['Layout_Settings']->getMetaTags();
     } else {
         $vars = $_SESSION['Layout_Settings']->getPageMetaTags($key_id);
         if (empty($vars)) {
             $vars = $_SESSION['Layout_Settings']->getMetaTags();
             $key = new Key($key_id);
             $vars['page_title'] = $key->title;
         }
     }
     if (is_array($vars)) {
         extract($vars);
     }
     $index = substr($meta_robots, 0, 1);
     $follow = substr($meta_robots, 1, 1);
     $form = new PHPWS_Form('metatags');
     if ($key_id) {
         $form->addHidden('key_id', $key_id);
         $form->addSubmit('reset', dgettext('layout', 'Restore to default'));
     }
     $form->addHidden('module', 'layout');
     $form->addHidden('action', 'admin');
     $form->addHidden('command', 'postMeta');
     $form->addText('page_title', $page_title);
     $form->setClass('page_title', 'form-control');
     $form->setLabel('page_title', dgettext('layout', 'Site Name'));
     $form->addTextArea('meta_keywords', $meta_keywords);
     $form->setLabel('meta_keywords', dgettext('layout', 'Keywords'));
     $form->setClass('meta_keywords', 'form-control');
     $form->addTextArea('meta_description', $meta_description);
     $form->setLabel('meta_description', dgettext('layout', 'Description'));
     $form->setClass('meta_description', 'form-control');
     $form->addCheckBox('index', 1);
     $form->setMatch('index', $index);
     $form->setLabel('index', dgettext('layout', 'Allow indexing'));
     $form->addCheckBox('follow', 1);
     $form->setMatch('follow', $follow);
     $form->setLabel('follow', dgettext('layout', 'Allow link following'));
     $form->addCheckBox('use_key_summaries', 1);
     $form->setMatch('use_key_summaries', PHPWS_Settings::get('layout', 'use_key_summaries'));
     $form->setLabel('use_key_summaries', dgettext('layout', 'Use Key summaries for meta description'));
     $form->addSubmit('submit', dgettext('layout', 'Update'));
     $template = $form->getTemplate();
     $template['ROBOT_LABEL'] = dgettext('layout', 'Default Robot Settings');
     return PHPWS_Template::process($template, 'layout', 'metatags.tpl');
 }
Ejemplo n.º 6
0
 /**
  * Creates the user interface for editing this form's settings
  *
  * @return string $content The templated string containing the html to display
  *                         a user interface for editing this form's settings.
  * @access public
  */
 function editSettings()
 {
     unset($this->report);
     if ($this->getId()) {
         /* If not a new form get the templated form info */
         $formTags['FORM_INFORMATION'] = $this->getFormInfo();
     }
     $form = new PHPWS_Form('edit_settings');
     /* Setup all editable values and their labels */
     $form->addTextField('PHAT_FormName', $this->getLabel());
     $form->setSize('PHAT_FormName', PHAT_DEFAULT_SIZE);
     $form->setMaxSize('PHAT_FormName', PHAT_DEFAULT_MAXSIZE);
     $form->setLabel('PHAT_FormName', dgettext('phatform', 'Name'));
     $form->addTextField('PHAT_FormPageLimit', $this->_pageLimit);
     $form->setSize('PHAT_FormPageLimit', 3, 3);
     $form->setLabel('PHAT_FormPageLimit', dgettext('phatform', 'Item limit per page'));
     $form->addTextArea('PHAT_FormBlurb0', $this->_blurb0);
     $form->setCols('PHAT_FormBlurb0', PHAT_DEFAULT_COLS);
     $form->setRows('PHAT_FormBlurb0', PHAT_DEFAULT_ROWS);
     $form->setLabel('PHAT_FormBlurb0', dgettext('phatform', 'Instructions'));
     $form->addTextArea('PHAT_FormBlurb1', $this->_blurb1);
     $form->setCols('PHAT_FormBlurb1', PHAT_DEFAULT_COLS);
     $form->setRows('PHAT_FormBlurb1', PHAT_DEFAULT_ROWS);
     $form->setLabel('PHAT_FormBlurb1', dgettext('phatform', 'Submission Message'));
     /* RBW Added a section to hold the post processing code 1/3/04 */
     $form->addTextArea('PHAT_PostProcess', $this->getPostProcessCode());
     $form->setCols('PHAT_FormBlurb1', PHAT_DEFAULT_COLS);
     $form->setRows('PHAT_FormBlurb1', PHAT_DEFAULT_ROWS);
     $form->setLabel('PHAT_PostProcess', dgettext('phatform', 'Post Process Code'));
     //$formTags['POSTPROCESS_HELP']  = PHPWS_Help::show_link('phatform', 'post_process_code');
     $form->addTextArea('PHAT_FormEmails', $this->getAdminEmails());
     $form->setCols('PHAT_FormBlurb1', PHAT_DEFAULT_COLS);
     $form->setRows('PHAT_FormBlurb1', PHAT_DEFAULT_ROWS);
     $form->setLabel('PHAT_FormEmails', dgettext('phatform', 'Admin Email (comma delimited)'));
     $form->addCheckbox('PHAT_FormMultiSubmit', 1);
     $form->setMatch('PHAT_FormMultiSubmit', $this->_multiSubmit);
     $form->setLabel('PHAT_FormMultiSubmit', dgettext('phatform', 'Allow multiple submissions'));
     $form->addCheckbox('PHAT_FormAnonymous', 1);
     $form->setMatch('PHAT_FormAnonymous', $this->_anonymous);
     $form->setLabel('PHAT_FormAnonymous', dgettext('phatform', 'Allow anonymous submissions'));
     $form->addCheckBox('PHAT_FormEditData', 1);
     $form->setMatch('PHAT_FormEditData', $this->_editData);
     $form->setLabel('PHAT_FormEditData', dgettext('phatform', 'Allow users to edit their form data'));
     $form->addCheckBox('PHAT_FormShowElementNumbers', 1);
     $form->setMatch('PHAT_FormShowElementNumbers', $this->_showElementNumbers);
     $form->setLabel('PHAT_FormShowElementNumbers', dgettext('phatform', 'Show numbers for form elements (eg: 1, 2, 3)'));
     $form->addCheckBox('PHAT_FormShowPageNumbers', 1);
     $form->setMatch('PHAT_FormShowPageNumbers', $this->_showPageNumbers);
     $form->setLabel('PHAT_FormShowPageNumbers', dgettext('phatform', 'Show form page numbers (eg: page 1 of 6)'));
     $form->addCheckBox('PHAT_FormHidden', 1);
     $form->setMatch('PHAT_FormHidden', $this->isHidden());
     $form->setLabel('PHAT_FormHidden', dgettext('phatform', 'Hide this form'));
     /* Can't forget the save button */
     $form->addSubmit('PHAT_SaveSettings', dgettext('phatform', 'Save Settings'));
     if ($this->getId()) {
         $form->addSubmit('PHAT_EditElements', dgettext('phatform', 'Edit Elements'));
         $GLOBALS['CNT_phatform']['title'] = $this->getLabel();
     } else {
         $GLOBALS['CNT_phatform']['title'] = PHAT_TITLE;
     }
     /* Add needed hiddens */
     $form->addHidden('module', 'phatform');
     $form->addHidden('PHAT_FORM_OP', 'SaveFormSettings');
     $form->addHidden('PHAT_FormId', $this->getId());
     $template = $form->getTemplate();
     $content = PHPWS_Template::process($template, 'phatform', 'form/settings.tpl');
     return $content;
 }
Ejemplo n.º 7
0
 /**
  * Creates the edit form for an event
  */
 public static function event_form(Calendar_Event $event, $suggest = false)
 {
     Layout::addStyle('calendar');
     javascript('datetimepicker');
     // the form id is linked to the check_date javascript
     $form = new PHPWS_Form('event_form');
     if (isset($_REQUEST['js'])) {
         $form->addHidden('js', 1);
     }
     $form->addHidden('module', 'calendar');
     if ($suggest) {
         $form->addHidden('uop', 'post_suggestion');
     } else {
         $form->addHidden('aop', 'post_event');
     }
     $form->addHidden('event_id', $event->id);
     $form->addHidden('sch_id', $event->_schedule->id);
     $form->addText('summary', $event->summary);
     $form->setLabel('summary', dgettext('calendar', 'Summary'));
     $form->setSize('summary', 60);
     $form->addText('location', $event->location);
     $form->setLabel('location', dgettext('calendar', 'Location'));
     $form->setSize('location', 60);
     $form->addText('loc_link', $event->loc_link);
     $form->setLabel('loc_link', dgettext('calendar', 'Location link'));
     $form->setSize('loc_link', 60);
     $form->addTextArea('description', $event->description);
     if ($suggest) {
         $form->setRows('description', 8);
         $form->setCols('description', 55);
     } else {
         $form->useEditor('description');
     }
     $form->setLabel('description', dgettext('calendar', 'Description'));
     $form->addText('start_date', $event->getStartTime('%Y/%m/%d'));
     $form->setLabel('start_date', dgettext('calendar', 'Start time'));
     $form->setExtra('start_date', 'onblur="check_start_date()"');
     $form->addText('end_date', $event->getEndTime('%Y/%m/%d'));
     $form->setLabel('end_date', dgettext('calendar', 'End time'));
     $form->setExtra('end_date', 'onblur="check_end_date()" onfocus="check_start_date()"');
     $event->timeForm('start_time', $event->start_time, $form);
     $event->timeForm('end_time', $event->end_time, $form);
     $form->setExtra('start_time_hour', 'onchange="check_start_date()"');
     $form->setExtra('end_time_hour', 'onchange="check_end_date()"');
     $form->addCheck('all_day', 1);
     $form->setMatch('all_day', $event->all_day);
     $form->setLabel('all_day', dgettext('calendar', 'All day event'));
     $form->setExtra('all_day', 'onchange="alter_date(this)"');
     if (!$suggest) {
         $form->addCheck('show_busy', 1);
         $form->setMatch('show_busy', $event->show_busy);
         $form->setLabel('show_busy', dgettext('calendar', 'Show busy'));
     }
     if ($suggest) {
         $form->addSubmit('save', dgettext('calendar', 'Suggest event'));
     } else {
         // Suggested events are not allowed repeats
         /**
          * Repeat form elements
          */
         $form->addCheck('repeat_event', 1);
         $form->setLabel('repeat_event', dgettext('calendar', 'Make a repeating event'));
         $form->addText('end_repeat_date', $event->getEndRepeat('%Y/%m/%d'));
         $form->setLabel('end_repeat_date', dgettext('calendar', 'Repeat event until:'));
         $modes = array('daily', 'weekly', 'monthly', 'yearly', 'every');
         $modes_label = array(dgettext('calendar', 'Daily'), dgettext('calendar', 'Weekly'), dgettext('calendar', 'Monthly'), dgettext('calendar', 'Yearly'), dgettext('calendar', 'Every'));
         $form->addRadio('repeat_mode', $modes);
         $form->setLabel('repeat_mode', $modes_label);
         $weekdays = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7);
         $weekday_labels = array(1 => strftime('%A', mktime(0, 0, 0, 1, 5, 1970)), 2 => strftime('%A', mktime(0, 0, 0, 1, 6, 1970)), 3 => strftime('%A', mktime(0, 0, 0, 1, 7, 1970)), 4 => strftime('%A', mktime(0, 0, 0, 1, 8, 1970)), 5 => strftime('%A', mktime(0, 0, 0, 1, 9, 1970)), 6 => strftime('%A', mktime(0, 0, 0, 1, 10, 1970)), 7 => strftime('%A', mktime(0, 0, 0, 1, 11, 1970)));
         $form->addCheck('weekday_repeat', $weekdays);
         $form->setLabel('weekday_repeat', $weekday_labels);
         $monthly = array('begin' => dgettext('calendar', 'Beginning of each month'), 'end' => dgettext('calendar', 'End of each month'), 'start' => dgettext('calendar', 'Every month on start date'));
         $form->addSelect('monthly_repeat', $monthly);
         $every_repeat_week = array(1 => dgettext('calendar', '1st'), 2 => dgettext('calendar', '2nd'), 3 => dgettext('calendar', '3rd'), 4 => dgettext('calendar', '4th'), 5 => dgettext('calendar', 'Last'));
         $frequency = array('every_month' => dgettext('calendar', 'Every month'), 1 => strftime('%B', mktime(0, 0, 0, 1, 1, 1970)), 2 => strftime('%B', mktime(0, 0, 0, 2, 1, 1970)), 3 => strftime('%B', mktime(0, 0, 0, 3, 1, 1970)), 4 => strftime('%B', mktime(0, 0, 0, 4, 1, 1970)), 5 => strftime('%B', mktime(0, 0, 0, 5, 1, 1970)), 6 => strftime('%B', mktime(0, 0, 0, 6, 1, 1970)), 7 => strftime('%B', mktime(0, 0, 0, 7, 1, 1970)), 8 => strftime('%B', mktime(0, 0, 0, 8, 1, 1970)), 9 => strftime('%B', mktime(0, 0, 0, 9, 1, 1970)), 10 => strftime('%B', mktime(0, 0, 0, 10, 1, 1970)), 11 => strftime('%B', mktime(0, 0, 0, 11, 1, 1970)), 12 => strftime('%B', mktime(0, 0, 0, 12, 1, 1970)));
         $form->addSelect('every_repeat_number', $every_repeat_week);
         $form->addSelect('every_repeat_weekday', $weekday_labels);
         $form->addSelect('every_repeat_frequency', $frequency);
         /* set repeat form matches */
         if (!empty($event->repeat_type)) {
             $repeat_info = explode(':', $event->repeat_type);
             $repeat_mode_match = $repeat_info[0];
             if (isset($repeat_info[1])) {
                 $repeat_vars = explode(';', $repeat_info[1]);
             } else {
                 $repeat_vars = null;
             }
             $form->setMatch('repeat_mode', $repeat_mode_match);
             switch ($repeat_mode_match) {
                 case 'weekly':
                     $form->setMatch('weekday_repeat', $repeat_vars);
                     break;
                 case 'monthly':
                     $form->setMatch('monthly_repeat', $repeat_vars[0]);
                     break;
                 case 'every':
                     $form->setMatch('every_repeat_number', $repeat_vars[0]);
                     $form->setMatch('every_repeat_weekday', $repeat_vars[1]);
                     $form->setMatch('every_repeat_frequency', $repeat_vars[2]);
                     break;
             }
             $form->setMatch('repeat_event', 1);
         }
         if ($event->pid) {
             $form->addHidden('pid', $event->pid);
             // This is a repeat copy, if saved it removes it from the copy list
             $form->addSubmit('save', dgettext('calendar', 'Save and remove repeat'));
             $form->setExtra('save', sprintf('onclick="return confirm(\'%s\')"', dgettext('calendar', 'Remove event from repeat list?')));
         } elseif ($event->id && $event->repeat_type) {
             // This is event is a source repeating event
             // Save this
             // Not sure if coding this portion. commenting for now
             // $form->addSubmit('save_source', dgettext('calendar', 'Save this event only'));
             $form->addSubmit('save_copy', dgettext('calendar', 'Save and apply to repeats'));
             $form->setExtra('save_copy', sprintf('onclick="return confirm(\'%s\')"', dgettext('calendar', 'Apply changes to repeats?')));
         } else {
             // this is a non-repeating event
             $form->addSubmit('save', dgettext('calendar', 'Save event'));
         }
     }
     $tpl = $form->getTemplate();
     if (!$suggest) {
         $tpl['EVENT_TAB'] = dgettext('calendar', 'Event');
         $tpl['REPEAT_TAB'] = dgettext('calendar', 'Repeat');
     }
     if (isset($event->_error)) {
         $tpl['ERROR'] = implode('<br />', $event->_error);
     }
     if ($event->pid) {
         $linkvar['aop'] = 'edit_event';
         $linkvar['sch_id'] = $event->_schedule->id;
         $linkvar['event_id'] = $event->pid;
         if (javascriptEnabled()) {
             $linkvar['js'] = 1;
         }
         $source_link = PHPWS_Text::moduleLink(dgettext('calendar', 'Click here if you would prefer to edit the source event.'), 'calendar', $linkvar);
         $tpl['REPEAT_WARNING'] = dgettext('calendar', 'This is a repeat of another event.') . '<br />' . $source_link;
     }
     $tpl['SYNC'] = sprintf('<input type="button" style="display : none" id="sync-dates" onclick="sync_dates(); return false;" name="sync-dates" value="%s" />', dgettext('calendar', 'Sync dates'));
     if (javascriptEnabled()) {
         Layout::addJSHeader('<script src="' . PHPWS_SOURCE_HTTP . 'mod/calendar/javascript/edit_event/head.js"></script>');
         Layout::addJSHeader('<script src="' . PHPWS_SOURCE_HTTP . 'mod/calendar/javascript/check_date/head.js"></script>');
     }
     return PHPWS_Template::process($tpl, 'calendar', 'admin/forms/edit_event.tpl');
 }
Ejemplo n.º 8
0
 public function editReason()
 {
     $reason =& $this->reason;
     $form = new PHPWS_Form('edit-reason');
     $form->addHidden('module', 'checkin');
     $form->addHidden('aop', 'post_reason');
     $form->addHidden('reason_id', $reason->id);
     $form->addText('summary', $reason->summary);
     $form->setSize('summary', 40);
     $form->setLabel('summary', dgettext('checkin', 'Summary'));
     $form->setRequired('summary');
     $form->addTextArea('message', $reason->message);
     $form->setRequired('message');
     $form->setLabel('message', dgettext('checkin', 'Completion message'));
     if ($reason->id) {
         $this->title = dgettext('checkin', 'Update reason');
         $form->addSubmit('go', dgettext('checkin', 'Update'));
     } else {
         $this->title = dgettext('checkin', 'Add new reason');
         $form->addSubmit('go', dgettext('checkin', 'Add'));
     }
     $template = $form->getTemplate();
     $this->content = PHPWS_Template::process($template, 'checkin', 'edit_reason.tpl');
 }
Ejemplo n.º 9
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');
 }
Ejemplo n.º 10
0
 /**
  * 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');
 }
Ejemplo n.º 11
0
 public function contactRenter($id)
 {
     $form = new \PHPWS_Form('contact-renter');
     $form->addHidden('module', 'properties');
     $form->addHidden('rop', 'send_message');
     $form->addHidden('id', $id);
     $form->addTextArea('message');
     $form->setWidth('message', '100%');
     $form->setRows('message', '13');
     $form->setLabel('message', 'Enter your message below. Your message will not reveal your identity. Only give contact information with those you feel comfortable. Improper messages may be reported and acted upon.');
     $form->addSubmit('Send message');
     $tpl = $form->getTemplate();
     echo \PHPWS_Template::process($tpl, 'properties', 'contact_form.tpl');
 }
Ejemplo n.º 12
0
 function edit($preview = FALSE)
 {
     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 edit.'));
         return;
     }
     $form = new PHPWS_Form();
     $form->addHidden('module', 'wiki');
     $form->addHidden('page_op', 'save');
     $form->addHidden('page', $this->getTitle(FALSE));
     $form->addTextArea('pagetext', $this->getPagetext(FALSE));
     $form->setRows('pagetext', 25);
     $form->setWidth('pagetext', '99%');
     $form->setLabel('pagetext', dgettext('wiki', 'Page Text'));
     $form->addText('comment');
     $form->setSize('comment', 50, 200);
     $form->setLabel('comment', dgettext('wiki', 'Optional comment about this edit'));
     // Needed for preview case
     if (isset($_POST['comment'])) {
         $form->setValue('comment', stripslashes($_POST['comment']));
     }
     $form->addSubmit('save', dgettext('wiki', 'Save'));
     $form->addSubmit('preview', dgettext('wiki', 'Preview'));
     $form->addSubmit('cancel', dgettext('wiki', 'Cancel'));
     if ($preview) {
         $form->addTplTag('PREVIEW_PAGE', $this->view());
     }
     return PHPWS_Template::process($form->getTemplate(), 'wiki', 'edit.tpl');
 }
Ejemplo n.º 13
0
 /**
  * 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');
 }
Ejemplo n.º 14
0
 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');
 }
Ejemplo n.º 15
0
 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;
 }
Ejemplo n.º 16
0
 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');
 }
Ejemplo n.º 17
0
 public static function editChannel(RSS_Channel $channel)
 {
     $form = new PHPWS_Form();
     $form->addHidden('module', 'rss');
     $form->addHidden('command', 'post_channel');
     $form->addSubmit(dgettext('rss', 'Save Channel'));
     if ($channel->id) {
         $form->addHidden('channel_id', $channel->id);
     }
     $form->addText('title', $channel->title);
     $form->setLabel('title', dgettext('rss', 'Title'));
     $form->addTextArea('description', $channel->description);
     $form->setLabel('description', dgettext('rss', 'Description'));
     $formtpl = $form->getTemplate();
     $tpl['CONTENT'] = PHPWS_Template::processTemplate($formtpl, 'rss', 'channel_form.tpl');
     $tpl['TITLE'] = dgettext('rss', 'Edit channel');
     return $tpl;
 }
Ejemplo n.º 18
0
 public static function settings()
 {
     $content = array();
     $form = new PHPWS_Form('user_settings');
     $form->addHidden('module', 'users');
     $form->addHidden('action', 'admin');
     $form->addHidden('command', 'update_settings');
     $form->addSubmit('submit', dgettext('users', 'Update Settings'));
     $form->addText('site_contact', PHPWS_User::getUserSetting('site_contact'));
     $form->setLabel('site_contact', dgettext('users', 'Site contact email'));
     $form->setSize('site_contact', 40);
     if (Current_User::isDeity()) {
         $signup_modes = array(0, AUTO_SIGNUP, CONFIRM_SIGNUP);
         $signup_labels = array(dgettext('users', 'Not allowed'), dgettext('users', 'Immediate'), dgettext('users', 'Email Verification'));
         $form->addRadio('user_signup', $signup_modes);
         $form->setLabel('user_signup', $signup_labels);
         $form->addTplTag('USER_SIGNUP_LABEL', dgettext('users', 'User Signup Mode'));
         $form->setMatch('user_signup', PHPWS_User::getUserSetting('new_user_method'));
         if (extension_loaded('gd')) {
             $form->addCheckbox('graphic_confirm');
             $form->setLabel('graphic_confirm', dgettext('users', 'New user CAPTCHA confirmation'));
             $form->setMatch('graphic_confirm', PHPWS_User::getUserSetting('graphic_confirm'));
         }
         $included_usermenu = PHPWS_File::readDirectory(PHPWS_SOURCE_DIR . 'mod/users/templates/usermenus/', FALSE, TRUE, FALSE, array('tpl'));
         $theme_usermenu = PHPWS_File::readDirectory(PHPWS_SOURCE_DIR . Layout::getThemeDir() . 'templates/users/usermenus/', FALSE, TRUE, FALSE, array('tpl'));
         if ($theme_usermenu) {
             $options = array_unique(array_merge($included_usermenu, $theme_usermenu));
         } else {
             $options = $included_usermenu;
         }
         $menu_options = array_combine($options, $options);
         // Replace below with a directory read
         $menu_options['none'] = dgettext('users', 'None');
         $menu_options['css.tpl'] = 'css.tpl';
         $menu_options['Default.tpl'] = 'Default.tpl';
         $menu_options['top.tpl'] = 'top.tpl';
         $form->addSelect('user_menu', $menu_options);
         $form->setMatch('user_menu', PHPWS_User::getUserSetting('user_menu'));
         $form->setLabel('user_menu', dgettext('users', 'User Menu'));
         $form->addCheckBox('show_login', 1);
         $form->setMatch('show_login', PHPWS_Settings::get('users', 'show_login'));
         $form->setLabel('show_login', dgettext('users', 'Show login box'));
         $form->addTplTag('AFFIRM', dgettext('users', 'Yes'));
         $form->addCheckBox('allow_remember', 1);
         $form->setMatch('allow_remember', PHPWS_Settings::get('users', 'allow_remember'));
         $form->setLabel('allow_remember', dgettext('users', 'Allow Remember Me'));
         $form->addRadioAssoc('allow_new_users', array(1 => 'Yes', 0 => 'No'));
         $form->setMatch('allow_new_users', PHPWS_Settings::get('users', 'allow_new_users'));
         $form->addTplTag('ALLOW_NEW_USERS_LABEL', dgettext('users', 'Allow new user creation?'));
     }
     $form->addTextArea('forbidden_usernames', PHPWS_Settings::get('users', 'forbidden_usernames'));
     $form->setLabel('forbidden_usernames', dgettext('users', 'Forbidden usernames (one per line)'));
     $form->addCheckbox('session_warning', 1);
     $form->setMatch('session_warning', PHPWS_Settings::get('users', 'session_warning'));
     $form->setlabel('session_warning', 'Show session warning');
     $template = $form->getTemplate();
     if (Current_User::isDeity()) {
         $vars['action'] = 'admin';
         $vars['command'] = 'check_permission_tables';
         $template['VERIFY_PERMISSIONS'] = PHPWS_Text::secureLink(dgettext('users', 'Register user permissions'), 'users', $vars);
         $template['VERIFY_EXPLAIN'] = dgettext('users', 'Users module will re-register each module\'s permissions.');
     }
     return PHPWS_Template::process($template, 'users', 'forms/settings.tpl');
 }
Ejemplo n.º 19
0
 public static function editFeed($feed = null, $add_submit = false)
 {
     if (empty($feed)) {
         $feed = new RSS_Feed();
     }
     $form = new PHPWS_Form();
     $form->addHidden('feed_id', $feed->id);
     $form->addHidden('module', 'rss');
     $form->addHidden('command', 'save_feed');
     $form->addTextArea('address', $feed->address);
     $form->setClass('address', 'form-control');
     $form->setLabel('address', dgettext('rss', 'Address'));
     $form->addText('title', $feed->title);
     $form->setClass('title', 'form-control');
     $form->setLabel('title', dgettext('rss', 'Title'));
     $form->addText('item_limit', $feed->item_limit);
     $form->setClass('item_limit', 'form-control');
     $form->setSize('item_limit', 2);
     $form->setLabel('item_limit', dgettext('rss', 'Item limit'));
     $form->addText('refresh_time', $feed->refresh_time);
     $form->setClass('refresh_time', 'form-control');
     $form->setSize('refresh_time', 5);
     $form->setLabel('refresh_time', dgettext('rss', 'Refresh time'));
     if ($add_submit) {
         $form->addSubmit('submit', dgettext('rss', 'Save'));
         $form->setClass('submit', 'btn btn-primary');
     }
     $template = $form->getTemplate();
     $template['TITLE_WARNING'] = dgettext('rss', 'Feed title will be used if left empty');
     $template['REFRESH_WARNING'] = dgettext('rss', 'In seconds');
     $content = PHPWS_Template::process($template, 'rss', 'add_feed.tpl');
     return $content;
 }
Ejemplo n.º 20
0
 /**
  * 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);
 }