Ejemplo n.º 1
0
 /**
  * Standard modular permission chooser.
  *
  * @param  ?ID_TEXT		The category ID the permissions are being chosen for (NULL: new category)
  * @param  ?tempcode		Extra help to show in interface (NULL: none)
  * @param  boolean		Whether this is a new category (don't load permissions, default to on)
  * @param  ?tempcode		Label for view permissions (NULL: default)
  * @return tempcode		The permission fields
  */
 function get_permission_fields($category_id, $help = NULL, $new_category = false, $pinterface_view = NULL)
 {
     return get_category_permissions_for_environment($this->permission_module, $category_id, $this->permission_page, $help, $new_category, $pinterface_view);
 }
Ejemplo n.º 2
0
 /**
  * Get standard form input fields for inputting a theme.
  *
  * @param  string			The name of the theme
  * @param  string			The theme title
  * @param  string			The theme description
  * @param  ?string		The theme author (NULL: current member)
  * @param  string			Comma-separated list mobile-supporting pages (blank: all do)
  * @param  BINARY			Whether the theme supports 'wide' screens
  * @param  boolean		Whether to use this theme on all zones
  * @return tempcode		The fields
  */
 function get_theme_fields($name = '', $title = '', $description = '', $author = NULL, $mobile_pages = '', $supports_wide = 1, $use_on_all_zones = false)
 {
     if (is_null($author)) {
         $author = $GLOBALS['FORUM_DRIVER']->get_username(get_member());
     }
     require_code('form_templates');
     require_code('permissions2');
     $fields = new ocp_tempcode();
     $site_default_theme = preg_replace('#[^\\w\\-\\.\\d]#', '_', get_site_name());
     if ($name != 'default') {
         $fields->attach(form_input_codename(do_lang_tempcode('CODENAME'), do_lang_tempcode(file_exists(get_custom_file_base() . '/themes/' . $site_default_theme) ? 'DESCRIPTION_CODENAME_THEME' : 'DESCRIPTION_CODENAME_THEME_HELPER', escape_html($site_default_theme)), 'theme', $name, true));
     }
     $fields->attach(form_input_line(do_lang_tempcode('TITLE'), do_lang_tempcode('DESCRIPTION_TITLE'), 'title', $title, true));
     $fields->attach(form_input_line(do_lang_tempcode('DESCRIPTION'), do_lang_tempcode('DESCRIPTION_DESCRIPTION'), 'description', $description, false));
     $fields->attach(form_input_line(do_lang_tempcode('AUTHOR'), do_lang_tempcode('DESCRIPTION_AUTHOR_THEME'), 'author', $author, true));
     $fields->attach(form_input_tick(do_lang_tempcode('SUPPORTS_WIDE'), do_lang_tempcode('DESCRIPTION_SUPPORTS_WIDE'), 'supports_wide', $supports_wide == 1));
     $fields->attach(form_input_line(do_lang_tempcode('MOBILE_PAGES'), do_lang_tempcode('DESCRIPTION_MOBILE_PAGES'), 'mobile_pages', $mobile_pages, false));
     if ($name != 'default') {
         $fields->attach(get_category_permissions_for_environment('theme', $name, NULL, NULL, $name == ''));
     }
     $fields->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('TITLE' => do_lang_tempcode('ACTIONS'))));
     $fields->attach(form_input_tick(do_lang_tempcode('USE_ON_ZONES'), do_lang_tempcode('DESCRIPTION_USE_ON_ZONES'), 'use_on_all', $use_on_all_zones));
     // Mapping
     if (method_exists($GLOBALS['FORUM_DRIVER'], 'get_skin_list')) {
         $map = file_exists(get_file_base() . '/themes/map.ini') ? better_parse_ini_file(get_file_base() . '/themes/map.ini') : array();
         $default_selection = array();
         $mapping = new ocp_tempcode();
         $all_skins = $GLOBALS['FORUM_DRIVER']->get_skin_list();
         foreach ($map as $key => $val) {
             if ($val == $name) {
                 $default_selection[] = $key;
             }
         }
         foreach ($all_skins as $key) {
             $mapping->attach(form_input_list_entry($key, in_array($key, $default_selection)));
         }
         $fields->attach(form_input_multi_list(do_lang_tempcode('THEME_MAPPING'), do_lang_tempcode('DESCRIPTION_THEME_MAPPING'), 'mapping', $mapping));
     }
     return $fields;
 }
Ejemplo n.º 3
0
 /**
  * The UI to edit a ticket.
  *
  * @return tempcode		The UI
  */
 function edit_ticket_type()
 {
     $title = get_page_title('EDIT_TICKET_TYPE');
     require_code('form_templates');
     require_code('permissions2');
     $ticket_type = get_param_integer('ticket_type');
     $details = get_ticket_type($ticket_type);
     $type_text = get_translated_text($ticket_type);
     $post_url = build_url(array('page' => '_SELF', 'type' => '_edit', 'ticket_type' => $ticket_type), '_SELF');
     $submit_name = do_lang_tempcode('SAVE');
     $fields = new ocp_tempcode();
     $fields->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('TITLE' => do_lang_tempcode('SETTINGS'))));
     $fields->attach(form_input_line(do_lang_tempcode('TYPE'), do_lang_tempcode('DESCRIPTION_TICKET_TYPE'), 'new_type', $type_text, false));
     $fields->attach(form_input_tick(do_lang_tempcode('TICKET_GUEST_EMAILS_MANDATORY'), do_lang_tempcode('DESCRIPTION_TICKET_GUEST_EMAILS_MANDATORY'), 'guest_emails_mandatory', $details['guest_emails_mandatory']));
     $fields->attach(form_input_tick(do_lang_tempcode('TICKET_SEARCH_FAQ'), do_lang_tempcode('DESCRIPTION_TICKET_SEARCH_FAQ'), 'search_faq', $details['search_faq']));
     $fields->attach(get_category_permissions_for_environment('tickets', $type_text));
     $fields->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('TITLE' => do_lang_tempcode('ACTIONS'))));
     $fields->attach(form_input_tick(do_lang_tempcode('DELETE'), do_lang_tempcode('DESCRIPTION_DELETE'), 'delete', false));
     return do_template('FORM_SCREEN', array('_GUID' => '0a505a779c1639fd2d3ee10c24a7905a', 'SKIP_VALIDATION' => true, 'TITLE' => $title, 'HIDDEN' => '', 'TEXT' => '', 'FIELDS' => $fields, 'SUBMIT_NAME' => $submit_name, 'URL' => $post_url));
 }
Ejemplo n.º 4
0
 /**
  * Get the fields for adding/editing a CEDI page.
  *
  * @param  SHORT_TEXT	The page title
  * @param  LONG_TEXT		Hidden notes pertaining to the page
  * @param  BINARY			Whether to hide the posts on the page by default
  * @param  AUTO_LINK		The ID of the page (-1 implies we're adding)
  * @return array			The fields, the extra fields, the hidden fields.
  */
 function get_page_fields($title, $notes = '', $hide_posts = 0, $page_id = -1)
 {
     $fields = new ocp_tempcode();
     $fields2 = new ocp_tempcode();
     $hidden = new ocp_tempcode();
     require_code('form_templates');
     $fields->attach(form_input_line(do_lang_tempcode('SCREEN_TITLE'), do_lang_tempcode('SCREEN_TITLE_DESC'), 'title', $title, true));
     $fields2->attach(form_input_tick(do_lang_tempcode('HIDE_POSTS'), do_lang_tempcode('DESCRIPTION_HIDE_POSTS'), 'hide_posts', $hide_posts == 1));
     $fields2->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('SECTION_HIDDEN' => $notes == '', 'TITLE' => do_lang_tempcode('ADVANCED'))));
     if (get_value('disable_staff_notes') !== '1') {
         $fields2->attach(form_input_text(do_lang_tempcode('NOTES'), do_lang_tempcode('DESCRIPTION_NOTES'), 'notes', $notes, false));
     }
     require_code('fields');
     if (has_tied_catalogue('seedy_page')) {
         append_form_custom_fields('seedy_page', $page_id == -1 ? NULL : strval($page_id), $fields, $hidden);
     }
     require_code('permissions2');
     $fields2->attach(get_category_permissions_for_environment('seedy_page', strval($page_id), 'cms_cedi', NULL, $page_id == -1));
     return array($fields, $fields2, $hidden);
 }