コード例 #1
0
ファイル: Whatsnew_Forms.php プロジェクト: HaldunA/phpwebsite
 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');
 }
コード例 #2
0
ファイル: Form.php プロジェクト: HaldunA/phpwebsite
 /**
  * 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;
 }
コード例 #3
0
ファイル: Forms.php プロジェクト: HaldunA/phpwebsite
 public function editFolder($folder, $js = false)
 {
     $form = new PHPWS_Form('file-form');
     $form->addHidden('module', 'filecabinet');
     $form->addHidden('aop', 'post_folder');
     $form->addHidden('ftype', $folder->ftype);
     if ($js) {
         $form->addHidden('js', 1);
     }
     if ($folder->id) {
         $form->addHidden('folder_id', $folder->id);
     }
     $form->addTextField('title', $folder->title);
     $form->setLabel('title', dgettext('filecabinet', 'Title'));
     $form->setClass('title', 'form-control');
     if ($folder->ftype == DOCUMENT_FOLDER) {
         $form->addRadio('public_folder', array(0, 1));
         $form->setLabel('public_folder', array(dgettext('filecabinet', 'Indirect links'), dgettext('filecabinet', 'Direct links')));
     }
     $form->setMatch('public_folder', $folder->public_folder);
     if ($folder->ftype == IMAGE_FOLDER) {
         $resizes = Cabinet::getResizes(0, true);
         $form->addSelect('max_image_dimension', $resizes);
         $form->setLabel('max_image_dimension', dgettext('filecabinet', 'Maximum image upload dimension'));
         $form->setMatch('max_image_dimension', $folder->max_image_dimension);
         $form->setClass('max_image_dimension', 'form-control');
     }
     $form->addSubmit('submit', 'Save folder');
     $form->setClass('submit', 'btn btn-primary');
     $tpl = $form->getTemplate();
     return PHPWS_Template::process($tpl, 'filecabinet', 'Forms/edit_folder.tpl');
 }
コード例 #4
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');
 }