/[drupal]/contributions/modules/xbview/xbview_admin.inc
ViewVC logotype

Contents of /contributions/modules/xbview/xbview_admin.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Wed Nov 14 22:47:33 2007 UTC (2 years ago) by profix898
Branch: MAIN
CVS Tags: DRUPAL-6--1-0, HEAD
Branch point for: DRUPAL-6--1
Changes since 1.1: +102 -0 lines
File MIME type: text/x-php
- Initial version for Drupal 6
1 <?php
2 // $Id: xbview_admin.inc,v 1.1.2.4 2007/05/02 21:33:41 profix898 Exp $
3
4 function _xbview_admin_form() {
5 $form['xbview'] = array(
6 '#type' => 'fieldset',
7 '#title' => t('XBView Settings'),
8 '#collapsible' => FALSE,
9 '#collapsed' => FALSE,
10 );
11 $form['xbview']['xbview_disclaimer'] = array(
12 '#type' => 'textarea',
13 '#title' => t('Disclaimer'),
14 '#rows' => 3,
15 '#default_value' => variable_get('xbview_disclaimer', ''),
16 '#description' => t('Leave empty to disable/hide disclaimer.'),
17 );
18
19 $form['xbview']['display'] = array(
20 '#type' => 'fieldset',
21 '#title' => t('Display Settings'),
22 '#collapsible' => TRUE,
23 '#collapsed' => FALSE,
24 );
25 $sort_options = array(
26 XBVIEW_SORT_ABC => t('Alphabetically'),
27 XBVIEW_SORT_ABC_FOLDER => t('Alphabetically (folders first)'),
28 XBVIEW_SORT_XBEL => t('Original XBEL order'),
29 XBVIEW_SORT_XBEL_FOLDER => t('Original XBEL order (folders first)'),
30 );
31 $form['xbview']['display']['xbview_sort'] = array(
32 '#type' => 'select',
33 '#title' => t('Sort order'),
34 '#default_value' => variable_get('xbview_sort', XBVIEW_SORT_ABC_FOLDER),
35 '#options' => $sort_options,
36 '#description' => t('Select how the bookmarks/folders should be sorted.'),
37 );
38 $form['xbview']['display']['xbview_icons'] = array(
39 '#type' => 'checkbox',
40 '#title' => t('Display bookmark icons'),
41 '#default_value' => variable_get('xbview_icons', 1),
42 '#description' => t('Read icon urls from file and display icons for bookmarks.'),
43 );
44 $form['xbview']['display']['xbview_hide_toplevel'] = array(
45 '#type' => 'checkbox',
46 '#title' => t('Hide toplevel bookmarks'),
47 '#default_value' => variable_get('xbview_hide_toplevel', 0),
48 '#description' => t('Show bookmarks in (sub)folders only.'),
49 );
50 $form['xbview']['display']['xbview_javascript'] = array(
51 '#type' => 'checkbox',
52 '#title' => t('Enable Javascript navigation'),
53 '#default_value' => variable_get('xbview_javascript', 1),
54 );
55 $form['xbview']['display']['xbview_link_target'] = array(
56 '#type' => 'textfield',
57 '#title' => t('Link target'),
58 '#default_value' => variable_get('xbview_link_target', '_blank'),
59 '#size' => 20,
60 '#maxlength' => 20,
61 '#description' => t('Enter a link target (e.g. "_blank", "_new").'),
62 );
63
64 $form['xbview']['parse'] = array(
65 '#type' => 'fieldset',
66 '#title' => t('XBEL Parse Options'),
67 '#collapsible' => TRUE,
68 '#collapsed' => FALSE,
69 '#description' => t('Click on the following link to parse the XBEL file: <a href="@xbel-parse">Update now</a>', array('@xbel-parse' => url('admin/settings/xbview/parse'))),
70 );
71 $form['xbview']['parse']['xbview_bookmark_path'] = array(
72 '#type' => 'textfield',
73 '#title' => t('Path to XBEL bookmark file'),
74 '#default_value' => variable_get('xbview_bookmark_path', 'files/bookmarks.xml'),
75 '#size' => 70,
76 '#maxlength' => 255,
77 '#description' => t('Relative path from document root, e.g. \'files/bookmarks.xml\', or absolute URL starting with \'http://...\'')
78 );
79 $period = drupal_map_assoc(array(0, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200), 'format_interval');
80 $period[0] = t('Manually');
81 $form['xbview']['parse']['xbview_cron_interval'] = array(
82 '#type' => 'select',
83 '#title' => t('Update interval'),
84 '#default_value' => variable_get('xbview_cron_interval', 0),
85 '#options' => $period,
86 '#description' => t('Select interval bookmarks are updated from the XBEL file. Choose \'Manually\' to disable cron updates.'),
87 );
88 $lastrun = format_date(variable_get('xbview_cron_lastrun', 0));
89 $form['xbview']['parse']['lastrun'] = array('#value' => t('Last update: @lastrun', array('@lastrun' => $lastrun)));
90
91 $form['#validate'][] = '_xbview_admin_validate';
92
93 return system_settings_form($form);
94 }
95
96 function _xbview_admin_validate($form, &$form_state) {
97 if (!empty($form_state['values']['xbview_bookmark_path'])) {
98 if (!_xbview_xmlpath($form_state['values']['xbview_bookmark_path'])) {
99 form_set_error('xbview_bookmark_path');
100 }
101 }
102 }

  ViewVC Help
Powered by ViewVC 1.1.2