/[drupal]/contributions/modules/dav/dav.admin.inc
ViewVC logotype

Contents of /contributions/modules/dav/dav.admin.inc

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


Revision 1.7 - (show annotations) (download) (as text)
Mon Nov 17 16:22:31 2008 UTC (12 months, 1 week ago) by arto
Branch: MAIN
CVS Tags: DRUPAL-6--1-0-ALPHA4, HEAD
Changes since 1.6: +17 -1 lines
File MIME type: text/x-php
Merged latest changes from http://github.com/incanus/drupal-dav (3859c2a) by Justin Miller.

Changelog (DAV API):
- Fix issue with DAV root module patch (improper variable cast).
- Added custom setting for character encoding:
  * default PEAR library encodes <space>, &, <, >
  * we now give an admin option and add | as well.
- Added MIME type icons to web listing (i.e., HTTP GET) of DAV resources.
- Fix fatal bug by replacing db_next_id(), which doesn't exist on Drupal 6.x, with db_last_insert_id().
1 <?php
2 // $Id$
3
4 /**
5 * @file
6 * DAV API admin page callbacks.
7 */
8
9 //////////////////////////////////////////////////////////////////////////////
10 // DAV API settings form
11
12 function dav_admin_settings() {
13 $form = array();
14
15 // DAV server settings
16 $form['server'] = array('#type' => 'fieldset', '#title' => t('DAV server settings'), '#collapsible' => TRUE, '#collapsed' => TRUE);
17 $form['server']['dav_server'] = array(
18 '#type' => 'radios',
19 '#title' => t('DAV server'),
20 '#default_value' => (int)DAV_SERVER,
21 '#options' => array(FALSE => t('Disabled'), TRUE => t('Enabled')),
22 '#description' => t('Whether to enable the DAV server functionality provided by this module. Note that this requires the <a href="!url" target="_blank">PEAR HTTP_WebDAV_Server</a> library to be available.', array('!url' => DAV_PEAR_SERVER)),
23 );
24 $form['server']['dav_root_url'] = array(
25 '#type' => 'textfield',
26 '#title' => t('DAV URL'),
27 '#default_value' => url(DAV_ROOT .'/', array('absolute' => TRUE)),
28 '#size' => 60,
29 '#maxlength' => 255,
30 '#description' => t('This is the absolute URL to the DAV root collection provided by this module, if the DAV server functionality has been enabled above. Use this path in your DAV client program to access the DAV resources exported by this Drupal site. Note that, at present, this path can\'t be aliased or changed.'),
31 '#attributes' => array('disabled' => 'disabled'),
32 );
33 $form['server']['dav_dot_files'] = array(
34 '#type' => 'radios',
35 '#title' => t('Allow hidden file/collection creation'),
36 '#default_value' => (int)DAV_DOT_FILES,
37 '#options' => array(FALSE => t('Disabled'), TRUE => t('Enabled')),
38 '#description' => t('Whether to allow files and collections with a name beginning with a dot character (.) to be created. Files named this way are interpreted as hidden files on Unix systems. While this is enabled by default to provide maximum compatibility with various operating systems and clients, you should consider disabling it if you are sure that no useful information will be stored in hidden files. See also the Windows and Mac OS X compatibility sections, below.'),
39 );
40 $form['server']['dav_trace'] = array(
41 '#type' => 'radios',
42 '#title' => t('Enable DAV method tracing'),
43 '#default_value' => (int)DAV_TRACE,
44 '#options' => array(FALSE => t('Disabled'), TRUE => t('Enabled')),
45 '#description' => t('Whether to log debug/troubleshooting information on all DAV HTTP methods. Note that enabling this will have a negative impact on performance and you should never use this except for troubleshooting purposes. <em>Requires trace.module.</em>'),
46 );
47 $form['server']['dav_icons'] = array(
48 '#type' => 'radios',
49 '#title' => t('Enable web listing icons'),
50 '#default_value' => module_exists('file') ? (int)DAV_ICONS : FALSE,
51 '#options' => array(FALSE => t('Disabled'), TRUE => t('Enabled')),
52 '#description' => t('Whether to show MIME type icons next to files and directories when browsing the DAV listing in a web browser (i.e., using HTTP GET). <em>Requires FileFramework.</em>'),
53 '#attributes' => !module_exists('file') ? array('disabled' => 'disabled') : array(),
54 );
55 $form['server']['dav_encode'] = array(
56 '#type' => 'textfield',
57 '#title' => t('Characters to encode'),
58 '#default_value' => DAV_ENCODE,
59 '#size' => 60,
60 '#maxlength' => 255,
61 '#description' => t('Characters to encode in path and file names per !rfc. Unless you know what you are doing and grok what this is all about, it is recommended that you leave this setting unchanged.', array('!rfc' => l('RFC 1738', 'http://www.ietf.org/rfc/rfc1738.txt'))),
62 );
63
64 if (DAV_SERVER && !_dav_load_server()) {
65 drupal_set_message(t('Warning: unable to load the <a href="!url" target="_blank">PEAR HTTP_WebDAV_Server</a> library.', array('!url' => DAV_PEAR_SERVER)), 'error');
66 }
67
68 // DAV server modules
69 $form['modules'] = array('#type' => 'fieldset', '#title' => t('DAV server modules'), '#collapsible' => TRUE, '#collapsed' => TRUE);
70 if (count(dav_get_modules()) > 0) {
71 $header = array(t('Name'), t('Description'));
72 $rows = array();
73 foreach (dav_get_modules('info') as $name => $info) {
74 $rows[] = array($info->name, $info->description);
75 }
76 $modules = theme('table', $header, $rows);
77 }
78 else {
79 $modules = '<div>'. t('No DAV modules currently installed; DAV server disabled.') .'</div>';
80 }
81 $form['modules']['dav_modules'] = array('#type' => 'markup', '#value' => $modules);
82 if (count(dav_get_modules()) > 0) {
83 $form['modules']['dav_root_module'] = array(
84 '#type' => 'select',
85 '#title' => t('Root collection owner'),
86 '#default_value' => DAV_ROOT_MODULE,
87 '#options' => dav_get_modules('titles'),
88 '#description' => t('Select which module should have ownership of the file/collection creation process in the DAV root collection. While all DAV server modules may publish items in the root collection, to prevent ambiguity only one module can respond to top-level PUT/MKCOL requests.'),
89 );
90 }
91
92 // DAV client settings
93 $form['client'] = array('#type' => 'fieldset', '#title' => t('DAV client settings'), '#collapsible' => TRUE, '#collapsed' => TRUE);
94 $form['client']['dav_client'] = array(
95 '#type' => 'radios',
96 '#title' => t('DAV client'),
97 '#default_value' => (int)DAV_CLIENT,
98 '#options' => array(FALSE => t('Disabled'), TRUE => t('Enabled')),
99 '#description' => t('Whether to attempt loading the <a href="!url" target="_blank">PEAR HTTP_WebDAV_Client</a> library on Drupal initialization in order to provide <tt>webdav://</tt> and <tt>webdavs://</tt> stream wrappers for PHP, allowing the use of remote DAV resources using the regular file system functions in PHP. Disabled by default, enable it if you need it.', array('!url' => DAV_PEAR_CLIENT)),
100 );
101
102 if (DAV_CLIENT && !_dav_load_client()) {
103 drupal_set_message(t('Warning: unable to load the <a href="!url" target="_blank">PEAR HTTP_WebDAV_Client</a> library.', array('!url' => DAV_PEAR_CLIENT)), 'error');
104 }
105
106 // Windows compatibility
107 $form['windows'] = array('#type' => 'fieldset', '#title' => t('Windows compatibility'), '#collapsible' => TRUE, '#collapsed' => TRUE);
108 $form['windows']['dav_windows_server_discovery'] = array(
109 '#type' => 'radios',
110 '#title' => t('Expect broken server discovery'),
111 '#default_value' => (int)DAV_WINDOWS_SERVER_DISCOVERY,
112 '#options' => array(FALSE => t('Disabled'), TRUE => t('Enabled')),
113 '#description' => t('This is a workaround for the Windows XP and Windows Vista WebDAV redirector bug <a target="_blank" href="http://support.microsoft.com/?kbid=831805">KB831805</a>. A <a target="_blank" href="http://www.greenbytes.de/tech/webdav/webfolder-client-list.html#issue-options-req-against-root">similar bug</a> also exists in most versions of the Microsoft Web Folder Client. Leave this enabled if you need to serve any Windows clients.'),
114 );
115 $form['windows']['dav_windows_basic_auth'] = array(
116 '#type' => 'radios',
117 '#title' => t('Expect invalid FQDN user names'),
118 '#default_value' => (int)DAV_WINDOWS_BASIC_AUTH,
119 '#options' => array(FALSE => t('Disabled'), TRUE => t('Enabled')),
120 '#description' => t('This is a workaround for the Windows XP WebDAV redirector bug <a target="_blank" href="http://support.microsoft.com/?kbid=315621">KB315621</a>. Leave this enabled if you need to serve Windows XP clients.'),
121 );
122 $form['windows']['dav_windows_no_thumbs_db'] = array(
123 '#type' => 'radios',
124 '#title' => t('Prevent thumbnail cache (Thumbs.db) creation'),
125 '#default_value' => (int)DAV_WINDOWS_NO_THUMBS_DB,
126 '#options' => array(FALSE => t('Disabled'), TRUE => t('Enabled')),
127 '#description' => t('Disallows the creation of spurious <a target="_blank" href="http://en.wikipedia.org/wiki/Thumbs.db">Thumbs.db</a> files by Windows clients. Leaving this enabled is highly recommended, but a yet better option in some cases may be to <a target="_blank" href="http://en.wikipedia.org/wiki/Thumbs.db#External_links">disable Thumbs.db creation</a> on the client side altogether.'),
128 );
129
130 // Mac OS X compatibility
131 $form['macosx'] = array('#type' => 'fieldset', '#title' => t('Mac OS X compatibility'), '#collapsible' => TRUE, '#collapsed' => TRUE);
132 $form['macosx']['dav_macosx_no_ds_store'] = array(
133 '#type' => 'radios',
134 '#title' => t('Prevent .DS_Store file creation'),
135 '#default_value' => (int)DAV_MACOSX_NO_DS_STORE,
136 '#options' => array(FALSE => t('Disabled'), TRUE => t('Enabled')),
137 '#description' => t('Disallows the creation of spurious <a target="_blank" href="http://en.wikipedia.org/wiki/.DS_Store">.DS_Store</a> files by Mac OS X clients. Leaving this enabled is highly recommended, but a yet better option is to <a target="_blank" href="http://docs.info.apple.com/article.html?artnum=301711">disable .DS_Store creation over network connections</a> on the client side altogether.'),
138 );
139 $form['macosx']['dav_macosx_no_forks'] = array(
140 '#type' => 'radios',
141 '#title' => t('Prevent resource fork creation'),
142 '#default_value' => (int)DAV_MACOSX_NO_FORKS,
143 '#options' => array(FALSE => t('Disabled'), TRUE => t('Enabled')),
144 '#description' => t('Disallows the creation of resouce forks, also known as dot-underscore files because their names start with "._". Unless you know what you are doing and grok what this is all about, it is recommended that you leave this setting enabled.'),
145 );
146
147 return system_settings_form($form);
148 }

  ViewVC Help
Powered by ViewVC 1.1.2