コード例 #1
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');
 }
コード例 #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 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');
    }
コード例 #4
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');
 }
コード例 #5
0
ファイル: Admin.php プロジェクト: HaldunA/phpwebsite
 public static function settings()
 {
     $main['TITLE'] = dgettext('search', 'Search Settings');
     $form = new PHPWS_Form('settings');
     $form->addHidden('module', 'search');
     $form->addHidden('command', 'save_settings');
     $form->addCheckBox('show_alternates');
     $form->setLabel('show_alternates', dgettext('search', 'Show alternate options'));
     $form->setMatch('show_alternates', PHPWS_Settings::get('search', 'show_alternates'));
     $form->addSubmit(dgettext('search', 'Save settings'));
     $tpl = $form->getTemplate();
     $main['CONTENT'] = PHPWS_Template::process($tpl, 'search', 'settings.tpl');
     return $main;
 }