/[drupal]/contributions/modules/gallery/gallery_settings.inc
ViewVC logotype

Contents of /contributions/modules/gallery/gallery_settings.inc

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


Revision 1.12 - (show annotations) (download) (as text)
Fri Nov 23 11:20:33 2007 UTC (2 years ago) by profix898
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-6--1
Changes since 1.11: +162 -179 lines
File MIME type: text/x-php
- very early D6 version (Oct-01, 2007)
1 <?php
2 // $Id: gallery_settings.inc,v 1.10.2.28 2007/09/10 18:04:08 profix898 Exp $
3
4 /**
5 * gallery.module : gallery_settings.inc
6 * Settings functions
7 */
8
9 /**
10 * Function _gallery_settings_general().
11 */
12 function _gallery_settings_general() {
13 // Short Status
14 gallery_version();
15 gallery_plugin_set_status(array('imageblock', 'imageframe', 'search'));
16 $status = gallery_get_status();
17
18 $form['status'] = array(
19 '#type' => 'fieldset',
20 '#title' => t('Status'),
21 '#description' => gallery_format_status($status, ''),
22 '#collapsible' => FALSE,
23 '#collapsed' => FALSE,
24 );
25
26 // Theme Settings
27 $form['theme'] = array(
28 '#type' => 'fieldset',
29 '#title' => t('Theme settings'),
30 '#description' => '',
31 '#collapsible' => TRUE,
32 '#collapsed' => TRUE,
33 );
34 $themes = system_theme_data();
35 ksort($themes);
36 $options = array('default' => t('System default'));
37 foreach ($themes as $theme) {
38 $options[$theme->name] = $theme->info['name'];
39 }
40 $form['theme']['gallery_page_theme'] = array(
41 '#type' => 'select',
42 '#title' => t('Gallery page theme'),
43 '#default_value' => variable_get('gallery_page_theme', 'default'),
44 '#options' => $options,
45 '#description' => t('Drupal theme to be used for all gallery pages (gallery/*).'),
46 );
47
48 // Gallery Block Settings
49 $form['blocks'] = array(
50 '#type' => 'fieldset',
51 '#title' => t('Gallery block settings'),
52 '#collapsible' => TRUE,
53 '#collapsed' => TRUE,
54 '#description' => t('You can now have multiple image blocks and grid blocks. Use these settings to determine
55 the number of available blocks.<br /><strong>Warning: If you decrease the number of blocks,
56 always the last block (with the highest ID) will be removed.</strong>'),
57 );
58 $form['blocks']['gallery_block_image_num'] = array(
59 '#type' => 'textfield',
60 '#title' => t('Number of image blocks'),
61 '#default_value' => variable_get('gallery_block_image_num', 1),
62 '#size' => 10,
63 '#maxlength' => 10,
64 '#description' => t('Select how many image blocks should be available.'),
65 );
66 $form['blocks']['gallery_block_grid_num'] = array(
67 '#type' => 'textfield',
68 '#title' => t('Number of grid image blocks'),
69 '#default_value' => variable_get('gallery_block_grid_num', 1),
70 '#size' => 10,
71 '#maxlength' => 10,
72 '#description' => t('Select how many grid image blocks should be available.'),
73 );
74
75 // Gallery2 Sidebar Settings
76 $form['sidebar'] = array(
77 '#type' => 'fieldset',
78 '#title' => t('Sidebar settings'),
79 '#description' => '',
80 '#collapsible' => TRUE,
81 '#collapsed' => TRUE,
82 );
83 $form['sidebar']['gallery_move_sidebar_to_block'] = array(
84 '#type' => 'checkbox',
85 '#title' => t('Move Gallery2 sidebar to Drupal Gallery Navigation block'),
86 '#default_value' => variable_get('gallery_move_sidebar_to_block', 1),
87 '#description' => t('When selected, the Gallery2 sidebar will be moved into
88 the Drupal "Gallery Navigation" block. This typically allows
89 for a much cleaner embedded gallery and is generally
90 recommended. Note that you will need to enable the Gallery
91 Navigation block.'),
92 );
93 $form['sidebar']['gallery_move_admin_sidebar_to_block'] = array(
94 '#type' => 'checkbox',
95 '#title' => t('Move Gallery2 Admin sidebar to Drupal Gallery Navigation block'),
96 '#default_value' => variable_get('gallery_move_admin_sidebar_to_block', 0),
97 '#description' => t('When selected, the Gallery2 Admin sidebar will be moved into
98 the Drupal "Gallery Navigation" block. This is not normally
99 recommended since the Admin Sitebar is very long and the
100 formatting does not always fit with the rest of the block
101 (but cannot be changed in the current Gallery2 versions).'),
102 '#disabled' => !variable_get('gallery_move_sidebar_to_block', 1),
103 );
104
105 // Gallery2 Google Sitemap Settings
106 $gallery2_sitemap_status = gallery_single_plugin_status('sitemap');
107 $gallery2_sitemap_status_str = theme('gallery_plugin_status_message', $gallery2_sitemap_status);
108 $gsitemap_status = module_exists('gsitemap');
109 $gsitemap_status_str = theme('gallery_module_status_message', $gsitemap_status);
110
111 $desc = t('Allows the Gallery2 Google (XML) sitemap to be merged
112 with the Drupal one so that only one URL
113 needs to be supplied to Google (or other search site). Requires the
114 Drupal gsitemap module (!gsitemap_status) and the Gallery2 sitemap module
115 (!gallery2_sitemap_status) to be installed/activated.',
116 array(
117 '!gsitemap_status' => $gsitemap_status_str,
118 '!gallery2_sitemap_status' => $gallery2_sitemap_status_str,
119 )
120 );
121
122 $form['sitemap'] = array(
123 '#type' => 'fieldset',
124 '#title' => t('Google (XML) sitemap settings'),
125 '#description' => '',
126 '#collapsible' => TRUE,
127 '#collapsed' => TRUE,
128 '#description' => $desc,
129 );
130 $form['sitemap']['gallery_enable_sitemap'] = array(
131 '#type' => 'checkbox',
132 '#title' => t('Enable merge of Gallery2 sitemap with Drupal sitemap'),
133 '#default_value' => variable_get('gallery_enable_sitemap', 1),
134 '#disabled' => !($gsitemap_status && ($gallery2_sitemap_status == GALLERY_PLUGIN_ENABLED)),
135 );
136
137 // Error logging / Debug Settings
138 $form['error'] = array(
139 '#type' => 'fieldset',
140 '#title' => t('Error logging / Debug settings'),
141 '#description' => '',
142 '#collapsible' => TRUE,
143 '#collapsed' => TRUE,
144 );
145 $form['error']['gallery_error_mode'] = array(
146 '#type' => 'checkboxes',
147 '#title' => t('Error logging'),
148 '#default_value' => variable_get('gallery_error_mode', array(GALLERY_ERROR_WATCHDOG)),
149 '#options' => array(GALLERY_ERROR_WATCHDOG => t('Watchdog'),
150 GALLERY_ERROR_BROWSER => t('Output to the browser'),
151 GALLERY_ERROR_VERBOSE => t('Verbose error messages')),
152 '#description' => t('Choose where errors are displayed and how detailed they are.'),
153 );
154 $form['error']['gallery_report'] = array(
155 '#type' => 'checkbox',
156 '#title' => t('Enable bug report assistant'),
157 '#default_value' => variable_get('gallery_report', 1),
158 '#description' => t('In case of errors the module can automatically assemble useful data (system info and debug
159 traces) to help you with detailed bug reports. Only available to users with \'administer
160 site configuration\' permission.')
161 );
162 $search_status = module_exists('search') && (gallery_single_plugin_status('search') == GALLERY_PLUGIN_ENABLED);
163 $form['error']['gallery_error_redirect'] = array(
164 '#type' => 'checkbox',
165 '#title' => t('Redirect to Gallery search form for invalid paths'),
166 '#default_value' => $search_status ? variable_get('gallery_error_redirect', 0) : 0,
167 '#description' => t('Instead of showing a message that the requested Gallery URL does not exist the user is redirected to the search form.'),
168 '#disabled' => !$search_status,
169 );
170 $form['error']['gallery_debug'] = array(
171 '#type' => 'checkbox',
172 '#title' => t('Enable debug mode'),
173 '#default_value' => variable_get('gallery_debug', 0),
174 '#description' => t('Print out debug variables and verbose error messages. Only visible to users with \'administer site configuration\' permission.')
175 );
176
177 // Relevant links
178 $form['links'] = array(
179 '#type' => 'fieldset',
180 '#title' => t('Links to the most relevant Drupal & Gallery2 pages'),
181 '#collapsible' => TRUE,
182 '#collapsed' => TRUE,
183 );
184 // Drupal links
185 $desc = '<ul>';
186 $desc .= '<li><a href="@gallery-users">Gallery users</a> : Gallery2 user integration and synchronization.</li>';
187 $desc .= '<li><a href="@gallery-report">Report Generator</a> : Collect information about your installation. Useful especially for bug reports.</li>';
188 $desc .= '</ul>';
189 $form['links']['drupal'] = array(
190 '#type' => 'fieldset',
191 '#title' => t('Links to Drupal paths'),
192 '#description' => t($desc, array(
193 '@gallery-users' => url('admin/user/gallery'),
194 '@gallery-report' => url('admin/settings/gallery/report/download'))),
195 '#collapsible' => FALSE,
196 '#collapsed' => FALSE,
197 );
198 // Gallery2 links
199 $desc = '<ul>';
200 $desc .= '<li><a href="@g2-modules">Plugins</a> : To install, activate or configure the required and optional plugins relating to gallery.module (Image Block, Image Frame, URL Rewrite, Sitemap, Search).</li>';
201 $desc .= '<li><a href="@g2-themes">Themes</a> : To add/remove blocks in the sidebar.</li>';
202 $desc .= '<li><a href="@g2-rewrite">Embedded URL Rewrite settings</a> : To define the rewrite rules.</li>';
203 $desc .= '<li><a href="@g2-cookie">Cookie Settings</a> : Only needed for a small number of site configurations, such as the use of different subdomains for Gallery2 and Drupal.</li>';
204 $desc .= '</ul>';
205 $g2_uri = variable_get('gallery_embed_uri', '?q=gallery');
206 $form['links']['gallery'] = array(
207 '#type' => 'fieldset',
208 '#title' => t('Links to Gallery2 Site Admin sections'),
209 '#description' => t($desc, array(
210 '@g2-modules' => $g2_uri .'&g2_view=core.SiteAdmin&g2_subView=core.AdminModules',
211 '@g2-themes' => $g2_uri .'&g2_view=core.SiteAdmin&g2_subView=core.AdminThemes&g2_mode=defaults',
212 '@g2-rewrite' => $g2_uri .'&g2_view=core.SiteAdmin&g2_subView=rewrite.AdminRewrite&g2_mode=setup',
213 '@g2-cookie' => $g2_uri .'&g2_view=core.SiteAdmin&g2_subView=core.AdminCore')),
214 '#collapsible' => FALSE,
215 '#collapsed' => FALSE,
216 );
217
218 $form = system_settings_form($form);
219 $form['#validate'] = array('_gallery_settings_general_validate');
220 $form['#submit'] = array('_gallery_settings_general_submit', 'system_settings_form_submit');
221 return $form;
222 }
223
224 /**
225 * Function _gallery_settings_general_validate().
226 */
227 function _gallery_settings_general_validate($form, &$form_state) {
228 if (!is_numeric($form_state['values']['gallery_block_image_num']) || $form_state['values']['gallery_block_image_num'] < 1) {
229 form_set_error('gallery_block_image_num', t('Number of image blocks must be a positiv integer greater zero.'));
230 }
231 if (!is_numeric($form_state['values']['gallery_block_grid_num']) || $form_state['values']['gallery_block_grid_num'] < 1) {
232 form_set_error('gallery_block_grid_num', t('Number of grid blocks must be a positiv integer greater zero.'));
233 }
234 }
235
236 /**
237 * Function _gallery_settings_general_submit().
238 */
239 function _gallery_settings_general_submit($form, &$form_state) {
240 if ($form_state['values']['gallery_enable_sitemap'] != variable_get('gallery_enable_sitemap', 0)) {
241 drupal_set_message('The Google (XML) sitemap setting has been updated, but the new sitemap may not be generated immediately (controlled by gsitemap).');
242 }
243 }
244
245 /**
246 * Function _gallery_settings_block_image().
247 */
248 function _gallery_settings_block_image($delta) {
249 $plugin_status = gallery_plugin_status(array('imageblock', 'imageframe'));
250
251 $imageblock_desc = t('The Gallery Image Block requires the Gallery2
252 Image Block plugin (!imageblock_status) and optionally the Gallery2 Image Frame
253 plugin (!imageframe_status).', array(
254 '!imageblock_status' => theme('gallery_plugin_status_message', $plugin_status['imageblock']),
255 '!imageframe_status' => theme('gallery_plugin_status_message', $plugin_status['imageframe']),
256 )
257 );
258 if ($plugin_status['imageblock'] != GALLERY_PLUGIN_ENABLED) {
259 $g2_uri = variable_get('gallery_embed_uri', '?q=gallery');
260 $g2_plugins_page = (variable_get('gallery_valid', 0)) ?
261 t('<a href= "@g2_plugins">Gallery2 Plugins</a>',
262 array('@g2_plugins' => $g2_uri .'&g2_view=core.SiteAdmin&g2_subView=core.AdminModules'))
263 : t('Gallery2 Site Admin -> Plugins');
264 $g2_imageblock_desc = t(' However the Image Block plugin is unavailable, so this block is
265 not available and the settings are disabled. To use this block please go to
266 the !g2_plugins page and install/activate the Image Block plugin.', array(
267 '!g2_plugins' => $g2_plugins_page));
268 $imageblock_desc .= $g2_imageblock_desc;
269 }
270
271 $form['#description'] = $imageblock_desc;
272
273 $imageframe_desc = ($plugin_status['imageframe'] != GALLERY_PLUGIN_ENABLED) ?
274 t('Requires the Gallery2 Image Frame plugin (!imageframe_status).',
275 array('!imageframe_status' => theme('gallery_plugin_status_message', $plugin_status['imageframe']))) : '';
276
277 $image_frames = gallery_get_image_frames();
278 _gallery_block_options($type_map, $param_map);
279
280 if (variable_get('gallery_block_image_num', 1) > 1) {
281 $form['gallery_block_image_'. $delta .'_blockid'] = array(
282 '#type' => 'textfield',
283 '#title' => t('Block Identifier [Block @id]', array('@id' => $delta+1)),
284 '#default_value' => variable_get('gallery_block_image_'. $delta .'_blockid', ''),
285 '#size' => 25,
286 '#maxlength' => 30,
287 '#description' => t('A short identifier to distinguish blocks of the same type. (Blocks are numbered by default)'),
288 );
289 }
290
291 if ($plugin_status['imageblock'] == GALLERY_PLUGIN_ENABLED) {
292 $numimages = variable_get('gallery_block_image_'. $delta .'_num_images', 3);
293
294 $form['gallery_block_image_'. $delta .'_num_images'] = array(
295 '#type' => 'select',
296 '#title' => t('Number of images in block'),
297 '#default_value' => $numimages,
298 '#options' => _gallery_range_array(1, 20),
299 '#description' => t('Choose the number of images to appear. You will need to submit the form if you have increased the number in order to choose the image types.'),
300 );
301
302 $gallery_block_block = variable_get('gallery_block_image_'. $delta .'_block_block', array('randomImage'));
303
304 $form['gallery_block_image_'. $delta .'_block_block'] = array(
305 '#type' => 'fieldset',
306 '#title' => t('Image types'),
307 '#collapsible' => FALSE,
308 '#collapsed' => FALSE,
309 '#tree' => TRUE,
310 '#description' => t('Pick the type of images you would like to see. You can select the same type more than once.'),
311 );
312 for ($i=0; $i<$numimages; $i++) {
313 $form['gallery_block_image_'. $delta .'_block_block'][$i] = array(
314 '#type' => 'select',
315 '#title' => '',
316 '#default_value' => isset($gallery_block_block[$i]) ? $gallery_block_block[$i] : '',
317 '#options' => array_merge(array('none' => t('None')), $type_map),
318 );
319 }
320
321 $form['gallery_block_image_'. $delta .'_item_id'] = array(
322 '#type' => 'textfield',
323 '#title' => t('Album or Item ID'),
324 '#default_value' => variable_get('gallery_block_image_'. $delta .'_item_id', ''),
325 '#size' => 20,
326 '#maxlength' => 20,
327 '#description' => t('Enter the Gallery image or album ID (or blank). If an album or item ID is specified, random
328 images will only be selected from that album and its sub-albums. If %user is specified,
329 items will be taken from the visitor\'s useralbum (if possible).')
330 );
331
332 $form['gallery_block_image_'. $delta .'_block_show'] = array(
333 '#type' => 'checkboxes',
334 '#title' => t('Image data'),
335 '#default_value' => variable_get('gallery_block_image_'. $delta .'_block_show', array('title', 'heading')),
336 '#options' => $param_map,
337 '#description' => t('Choose the item metadata you would like to display.'),
338 );
339
340 $form['gallery_block_image_'. $delta .'_size_method'] = array(
341 '#type' => 'select',
342 '#title' => t('Image size method'),
343 '#default_value' => variable_get('gallery_block_image_'. $delta .'_size_method', GALLERY_IMAGEBLOCK_SIZE_METHOD_DEFAULT),
344 '#options' => array(
345 'maxsize' => t('Max Size'),
346 'exactsize' => t('Exact Size'),
347 ),
348 '#description' => t('\'Max Size\' gives faster image downloading, but the image size
349 may be smaller than the size defined below. <br />\'Exact Size\' may be slower
350 (as a larger image is downloaded and then scaled by the browser) but the image
351 will be guaranteed to be the size defined below. Only supported for G2.2+.'),
352 );
353
354 $form['gallery_block_image_'. $delta .'_size'] = array(
355 '#type' => 'textfield',
356 '#title' => t('Image size'),
357 '#default_value' => variable_get('gallery_block_image_'. $delta .'_size', GALLERY_IMAGEBLOCK_SIZE_DEFAULT),
358 '#size' => 10,
359 '#maxlength' => 10,
360 '#description' => t('Sets the size (in pixels) of the longest side of the image according to the method defined above.'),
361 );
362
363 $form['gallery_block_image_'. $delta .'_album_frame'] = array(
364 '#type' => 'select',
365 '#title' => t('Album frame'),
366 '#default_value' => variable_get('gallery_block_image_'. $delta .'_album_frame', 'none'),
367 '#options' => $image_frames,
368 '#description' => $imageframe_desc,
369 );
370
371 $form['gallery_block_image_'. $delta .'_item_frame'] = array(
372 '#type' => 'select',
373 '#title' => t('Item frame'),
374 '#default_value' => variable_get('gallery_block_image_'. $delta .'_item_frame', 'none'),
375 '#options' => $image_frames,
376 '#description' => $imageframe_desc,
377 );
378
379 $form['gallery_block_image_'. $delta .'_link_target'] = array(
380 '#type' => 'textfield',
381 '#title' => t('Link target'),
382 '#default_value' => variable_get('gallery_block_image_'. $delta .'_link_target', ''),
383 '#size' => 20,
384 '#maxlength' => 20,
385 '#description' => t('Enter a link target (e.g. \'_blank\' to open in a new window).'),
386 );
387
388 $form['gallery_block_image_'. $delta .'_link'] = array(
389 '#type' => 'textfield',
390 '#title' => t('Image Link'),
391 '#default_value' => variable_get('gallery_block_image_'. $delta .'_link', ''),
392 '#size' => 60,
393 '#maxlength' => 255,
394 '#description' => t('By default the image has a link to the item in the Gallery. This
395 can be overridden here (or leave empty for the default). Use \'none\' for no link, or a URL
396 to link somewhere else instead.'),
397 );
398 }
399
400 return $form;
401 }
402
403 /**
404 * Function _gallery_settings_block_grid().
405 */
406 function _gallery_settings_block_grid($delta) {
407 $plugin_status = gallery_plugin_status(array('imageblock', 'imageframe'));
408
409 $gridblock_desc = t('The Gallery Grid Block requires the Gallery2
410 Image Block plugin (!imageblock_status) and optionally the Gallery2 Image Frame
411 plugin (!imageframe_status).', array(
412 '!imageblock_status' => theme('gallery_plugin_status_message', $plugin_status['imageblock']),
413 '!imageframe_status' => theme('gallery_plugin_status_message', $plugin_status['imageframe']),
414 ));
415 if ($plugin_status['imageblock'] != GALLERY_PLUGIN_ENABLED) {
416 $g2_uri = variable_get('gallery_embed_uri', '?q=gallery');
417 $g2_plugins_page = (variable_get('gallery_valid', 0)) ?
418 t('<a href= "@g2_plugins">Gallery2 Plugins</a>',
419 array('@g2_plugins' => $g2_uri .'&g2_view=core.SiteAdmin&g2_subView=core.AdminModules'))
420 : t('Gallery2 Site Admin -> Plugins');
421 $g2_imageblock_desc = t(' However the Image Block plugin is unavailable, so this block is
422 not available and the settings are disabled. To use this block please go to
423 the !g2_plugins page and install/activate the Image Block plugin.',
424 array('!g2_plugins' => $g2_plugins_page));
425 $gridblock_desc .= $g2_imageblock_desc;
426 }
427
428 $form['#description'] = $gridblock_desc;
429
430 $imageframe_desc = ($plugin_status['imageframe'] != GALLERY_PLUGIN_ENABLED) ?
431 t('Requires the Gallery2 Image Frame plugin (!imageframe_status).',
432 array('!imageframe_status' => theme('gallery_plugin_status_message', $plugin_status['imageframe']))) : '';
433
434 $image_frames = gallery_get_image_frames();
435 _gallery_block_options($type_map, $param_map);
436
437 if (variable_get('gallery_block_grid_num', 1) > 1) {
438 $form['gallery_block_grid_'. $delta .'_blockid'] = array(
439 '#type' => 'textfield',
440 '#title' => t('Block Identifier [Block @id]', array('@id' => $delta+1)),
441 '#default_value' => variable_get('gallery_block_grid_'. $delta .'_blockid', ''),
442 '#size' => 25,
443 '#maxlength' => 30,
444 '#description' => t('A short identifier to distinguish blocks of the same type. (Blocks are numbered by default)'),
445 );
446 }
447
448 if ($plugin_status['imageblock'] == GALLERY_PLUGIN_ENABLED) {
449 $form['gallery_block_grid_'. $delta .'_num_cols'] = array(
450 '#type' => 'select',
451 '#title' => t('Number of columns'),
452 '#default_value' => variable_get('gallery_block_grid_'. $delta .'_num_cols', 2),
453 '#options' => _gallery_range_array(1, 5),
454 '#description' => t('Enter the number of columns in the grid.'),
455 );
456
457 $form['gallery_block_grid_'. $delta .'_num_rows'] = array(
458 '#type' => 'select',
459 '#title' => t('Number of rows'),
460 '#default_value' => variable_get('gallery_block_grid_'. $delta .'_num_rows', 2),
461 '#options' => _gallery_range_array(1, 5),
462 '#description' => t('Enter the number of rows in the grid.'),
463 );
464
465 $form['gallery_block_grid_'. $delta .'_block_block'] = array(
466 '#type' => 'select',
467 '#title' => 'Image types',
468 '#default_value' => variable_get('gallery_block_grid_'. $delta .'_block_block', 'randomImage'),
469 '#options' => $type_map,
470 '#description' => 'Pick the type of images you would like to see in the grid.',
471 );
472
473 $form['gallery_block_grid_'. $delta .'_item_id'] = array(
474 '#type' => 'textfield',
475 '#title' => t('Album or Item ID'),
476 '#default_value' => variable_get('gallery_block_grid_'. $delta .'_item_id', ''),
477 '#size' => 20,
478 '#maxlength' => 20,
479 '#description' => t('Enter the Gallery image or album ID (or blank). If an album or item ID is specified, random
480 images will only be selected from that album and its sub-albums. If %user is specified,
481 items will be taken from the visitor\'s useralbum (if possible).')
482 );
483
484 $form['gallery_block_grid_'. $delta .'_block_show'] = array(
485 '#type' => 'checkboxes',
486 '#title' => t('Image data'),
487 '#default_value' => variable_get('gallery_block_grid_'. $delta .'_block_show', array()),
488 '#options' => $param_map,
489 '#description' => t('Choose the item metadata you would like to display.'),
490 );
491
492 $form['gallery_block_grid_'. $delta .'_size_method'] = array(
493 '#type' => 'select',
494 '#title' => t('Image size method'),
495 '#default_value' => variable_get('gallery_block_grid_'. $delta .'_size_method', GALLERY_GRID_SIZE_METHOD_DEFAULT),
496 '#options' => array(
497 'maxsize' => t('Max Size'),
498 'exactsize' => t('Exact Size'),
499 ),
500 '#description' => t('\'Max Size\' gives faster image downloading, but the image size
501 may be smaller than the size defined below. <br />\'Exact Size\' may be slower
502 (as a larger image is downloaded and then scaled by the browser) but the image
503 will be guaranteed to be the size defined below. Only supported for G2.2+.'),
504 );
505
506 $form['gallery_block_grid_'. $delta .'_size'] = array(
507 '#type' => 'textfield',
508 '#title' => t('Image size'),
509 '#default_value' => variable_get('gallery_block_grid_'. $delta .'_size', GALLERY_GRID_SIZE_DEFAULT),
510 '#size' => 10,
511 '#maxlength' => 10,
512 '#description' => t('Sets the size (in pixels) of the longest side of the image according
513 to the method defined above.'),
514 );
515
516 $form['gallery_block_grid_'. $delta .'_album_frame'] = array(
517 '#type' => 'select',
518 '#title' => t('Album frame'),
519 '#default_value' => variable_get('gallery_block_grid_'. $delta .'_album_frame', 'none'),
520 '#options' => $image_frames,
521 '#description' => $imageframe_desc,
522 );
523
524 $form['gallery_block_grid_'. $delta .'_item_frame'] = array(
525 '#type' => 'select',
526 '#title' => t('Item frame'),
527 '#default_value' => variable_get('gallery_block_grid_'. $delta .'_item_frame', 'none'),
528 '#options' => $image_frames,
529 '#description' => $imageframe_desc,
530 );
531
532 $form['gallery_block_grid_'. $delta .'_link_target'] = array(
533 '#type' => 'textfield',
534 '#title' => t('Link target'),
535 '#default_value' => variable_get('gallery_block_grid_'. $delta .'_link_target', ''),
536 '#size' => 20,
537 '#maxlength' => 20,
538 '#description' => t('Enter a link target (e.g. \'_blank\' to open in a new window).'),
539 );
540
541 $form['gallery_block_grid_'. $delta .'_link'] = array(
542 '#type' => 'textfield',
543 '#title' => t('Image Link'),
544 '#default_value' => variable_get('gallery_block_grid_'. $delta .'_link', ''),
545 '#size' => 60,
546 '#maxlength' => 255,
547 '#description' => t('By default the image has a link to the item in the Gallery. This
548 can be overridden here (or leave empty for the default). Use \'none\' for no link, or a URL
549 to link somewhere else instead.'),
550 );
551 }
552
553 return $form;
554 }
555
556 /**
557 * Function _gallery_settings_block_save().
558 */
559 function _gallery_settings_block_save($delta, $values) {
560 // Validate variable values
561 if (isset($values['gallery_block_image_'.$delta.'_size'])) {
562 if (!is_numeric($values['gallery_block_image_'.$delta.'_size']) || $values['gallery_block_image_'.$delta.'_size'] < 10) {
563 $values['gallery_block_image_'.$delta.'_size'] = 10;
564 drupal_set_message(t('Image size must be a number greater than ten pixels. (The value has been updated to \'10\' for your convenience.)'), 'error');
565 }
566 }
567 if (isset($values['gallery_block_grid_'.$delta.'_size'])) {
568 if (!is_numeric($values['gallery_block_grid_'.$delta.'_size']) || $values['gallery_block_grid_'.$delta.'_size'] < 10) {
569 $values['gallery_block_grid_'.$delta.'_size'] = 10;
570 drupal_set_message(t('Image size must be a number greater than ten pixels. (The value has been updated to \'10\' for your convenience.)'), 'error');
571 }
572 }
573 // Save variables
574 foreach ($values as $key => $value) {
575 if (strpos($key, 'gallery_block_') == 0) {
576 if (is_array($value) && isset($values['array_filter'])) {
577 $value = array_keys(array_filter($value));
578 }
579 variable_set($key, $value);
580 }
581 }
582 }
583
584 /**
585 * Function _gallery_settings_filter().
586 */
587 function _gallery_settings_filter() {
588 require_once(drupal_get_path('module', 'gallery') .'/gallery_block.inc');
589 $plugin_status = gallery_plugin_status(array('imageblock', 'imageframe'));
590
591 $desc = t('Note that changing the defaults here will change the all the gallery filter images
592 on the site, not just new images. ');
593 $desc .= t('The Gallery Filter requires the Gallery2 Image Block plugin (!imageblock_status) and
594 optionally the Gallery2 Image Frame plugin (!imageframe_status).',
595 array(
596 '!imageblock_status' => theme('gallery_plugin_status_message', $plugin_status['imageblock']),
597 '!imageframe_status' => theme('gallery_plugin_status_message', $plugin_status['imageframe']),
598 ));
599 if ($plugin_status['imageblock'] != GALLERY_PLUGIN_ENABLED) {
600 $g2_uri = variable_get('gallery_embed_uri', '?q=gallery');
601 $g2_plugins_page = (variable_get('gallery_valid', 0)) ?
602 t('<a href= "@g2_plugins">Gallery2 Plugins</a>',
603 array('@g2_plugins' => $g2_uri .'&g2_view=core.SiteAdmin&g2_subView=core.AdminModules'))
604 : t('Gallery2 Site Admin -> Plugins');
605 $desc .= t(' However the Image Block plugin is unavailable, so the Gallery Filter is
606 not available and the settings are disabled. To use the filter please go to
607 the !g2_plugins page and install/activate the Image Block plugin.',
608 array('!g2_plugins' => $g2_plugins_page));
609 }
610
611 $imageframe_desc = ($plugin_status['imageframe'] != GALLERY_PLUGIN_ENABLED) ?
612 t('Requires the Gallery2 Image Frame plugin (!imageframe_status).',
613 array('!imageframe_status' => theme('gallery_plugin_status_message', $plugin_status['imageframe']))) : '';
614
615 $form['filter'] = array(
616 '#type' => 'fieldset',
617 '#title' => t('Gallery Filter settings'),
618 '#collapsible' => FALSE,
619 '#collapsed' => FALSE,
620 '#description' => $desc,
621 );
622
623 $image_frames = gallery_get_image_frames();
624 _gallery_block_options($type_map, $param_map);
625
626 if ($plugin_status['imageblock'] == GALLERY_PLUGIN_ENABLED) {
627 $form['filter']['gallery_filter_prefix'] = array(
628 '#type' => 'textfield',
629 '#title' => t('Filter prefix'),
630 '#default_value' => variable_get('gallery_filter_prefix', 'G2'),
631 '#size' => 10,
632 '#maxlength' => 10,
633 '#description' => t('Prefix to use with filter. Example: \'G2\' means you use [G2: 999].
634 Be careful when changing this as any pages using the previous prefix will not be changed
635 and so will not be filtered correctly.'),
636 );
637
638 $form['filter']['gallery_filter_default_block_type'] = array(
639 '#type' => 'select',
640 '#title' => t('Default image type'),
641 '#default_value' => variable_get('gallery_filter_default_block_type', 'viewedImage'),
642 '#options' => $type_map,
643 '#description' => t('Pick the default type of image you would like to use.'),
644 );
645
646 $form['filter']['gallery_filter_can_cache'] = array(
647 '#type' => 'checkbox',
648 '#title' => t('Cache gallery filter pages'),
649 '#default_value' => variable_get('gallery_filter_can_cache', 1),
650 '#description' => t('By default the gallery filter output is cached by Drupal to speed up page loading.
651 However, it will not cache the css class info for the frames. The best approach is the
652 make sure that the sidebar image block and the gallery filter images use the same frames.
653 If you are unable to do this you will have to deselect this option to force Drupal not to
654 cache the pages, or else your frames will not appear. If you change this option you will
655 need to go to <a href="@link">admin/settings/filters</a> and re-save the image formats
656 that use gallery filter.', array('@link' => url('admin/settings/filters'))),
657 );
658
659 $form['filter']['gallery_filter_n_images'] = array(
660 '#type' => 'textfield',
661 '#title' => t('Default number of images'),
662 '#default_value' => variable_get('gallery_filter_n_images', 1),
663 '#size' => 3,
664 '#maxlength' => 3,
665 '#description' => t('How many images you want the default block to show. Best to keep at 1 and use the n parameter.'),
666 );
667
668 $form['filter']['gallery_filter_default_show'] = array(
669 '#type' => 'checkboxes',
670 '#title' => t('Default image data'),
671 '#default_value' => variable_get('gallery_filter_default_show', array('none')),
672 '#options' => $param_map,
673 '#description' => t('Choose the item metadata you would like to display by default. This will change all instances where show parameter was not specified.'),
674 );
675
676 // Parse gallery_filter.css and extract classes
677 $css = implode('', file(drupal_get_path('module', 'gallery') .'/gallery_filter.css'));
678 preg_match_all('/div.giImageBlock.(\w+) {/', $css, $matches);
679 if (count($matches[1])) {
680 $classes = array();
681 foreach ($matches[1] as $class) {
682 $classes[$class] = $class;
683 }
684 $form['filter']['gallery_filter_default_div_class'] = array(
685 '#type' => 'select',
686 '#title' => t('Default class'),
687 '#default_value' => variable_get('gallery_filter_default_div_class', 'nowrap'),
688 '#options' => $classes,
689 );
690 }
691 else {
692 $form['filter']['gallery_filter_default_div_class'] = array(
693 '#type' => 'textfield',
694 '#title' => t('Default class'),
695 '#default_value' => variable_get('gallery_filter_default_div_class', 'nowrap'),
696 '#size' => 20,
697 '#maxlength' => 20,
698 '#description' => t('left, right, or nowrap. (See gallery_filter.css to add more or modify these.)'),
699 );
700 }
701
702 $form['filter']['gallery_filter_default_maxsize'] = array(
703 '#type' => 'textfield',
704 '#title' => t('Default \'Max Size\' thumbnail size'),
705 '#default_value' => variable_get('gallery_filter_default_maxsize', GALLERY_FILTER_MAXSIZE_DEFAULT),
706 '#size' => 10,
707 '#maxlength' => 10,
708 );
709
710 $form['filter']['gallery_filter_default_exactsize'] = array(
711 '#type' => 'textfield',
712 '#title' => t('Default \'Exact Size\' thumbnail size'),
713 '#default_value' => variable_get('gallery_filter_default_exactsize', GALLERY_FILTER_EXACTSIZE_DEFAULT),
714 '#size' => 10,
715 '#maxlength' => 10,
716 '#description' => t('If no size is specified when calling the filter, one of
717 these sizes (and implied method) will be used. <br />\'Max Size\' gives faster
718 image downloading, but the image size
719 may be smaller than the size defined. <br />\'Exact Size\' may be slower
720 (as a larger image is downloaded and then scaled by the browser) but the image
721 will be guaranteed to be the size defined. Only supported for G2.2+.
722 Only fill in one size box (not both) to set the default method.'),
723 );
724
725 $form['filter']['gallery_filter_default_album_frame'] = array(
726 '#type' => 'select',
727 '#title' => t('Default album frame'),
728 '#default_value' => variable_get('gallery_filter_default_album_frame', 'none'),
729 '#options' => $image_frames,
730 '#description' => $imageframe_desc,
731 );
732
733 $form['filter']['gallery_filter_default_item_frame'] = array(
734 '#type' => 'select',
735 '#title' => t('Default item frame'),
736 '#default_value' => variable_get('gallery_filter_default_item_frame', 'none'),
737 '#options' => $image_frames,
738 '#description' => $imageframe_desc,
739 );
740
741 $form['filter']['gallery_filter_default_link_target'] = array(
742 '#type' => 'textfield',
743 '#title' => t('Default link target'),
744 '#default_value' => variable_get('gallery_filter_default_link_target', ''),
745 '#size' => 20,
746 '#maxlength' => 20,
747 '#description' => t('Enter a link target (e.g. "_blank", "_new").'),
748 );
749
750 $form['filter']['gallery_filter_default_link'] = array(
751 '#type' => 'textfield',
752 '#title' => t('Default Image Link'),
753 '#default_value' => variable_get('gallery_filter_default_link', ''),
754 '#size' => 20,
755 '#maxlength' => 20,
756 '#description' => t('By default the image has a link to the item in the Gallery. This
757 can be overridden here (or leave empty for the default). Use \'none\' for no link, or a URL
758 to link somewhere else instead.'),
759 );
760 }
761
762 $form = system_settings_form($form);
763 $form['#validate'] = array('_gallery_settings_filter_validate');
764 $form['#submit'] = array('_gallery_settings_filter_submit', 'system_settings_form_submit');
765 return $form;
766 }
767
768 /**
769 * Function _gallery_settings_filter_validate().
770 */
771 function _gallery_settings_filter_validate($form, &$form_state) {
772 // Only validate if a setting was returned
773 if (isset($form_state['values']['gallery_filter_default_maxsize'])) {
774 if ((strlen($form_state['values']['gallery_filter_default_maxsize']) > 0) &&
775 (strlen($form_state['values']['gallery_filter_default_exactsize']) > 0)) {
776 form_set_error('gallery_filter_default_maxsize',
777 t('You must set either the Max Size or the Exact Size, not both.'));
778 }
779 elseif ((strlen($form_state['values']['gallery_filter_default_maxsize']) == 0) &&
780 (strlen($form_state['values']['gallery_filter_default_exactsize']) == 0)) {
781 form_set_error('gallery_filter_default_maxsize',
782 t('You must set either the Max Size or the Exact Size.'));
783 }
784 if ((strlen($form_state['values']['gallery_filter_default_maxsize']) > 0) &&
785 (!is_numeric($form_state['values']['gallery_filter_default_maxsize']) ||
786 $form_state['values']['gallery_filter_default_maxsize'] < 1)) {
787 form_set_error('gallery_filter_default_maxsize',
788 t('Max Size must be a number greater than zero.'));
789 }
790 if ((strlen($form_state['values']['gallery_filter_default_exactsize']) > 0) &&
791 (!is_numeric($form_state['values']['gallery_filter_default_exactsize']) ||
792 $form_state['values']['gallery_filter_default_exactsize'] < 1)) {
793 form_set_error('gallery_filter_default_exactsize',
794 t('Exact Size must be a number greater than zero.'));
795 }
796 if ((strlen($form_state['values']['gallery_filter_n_images']) > 0) &&
797 (!is_numeric($form_state['values']['gallery_filter_n_images']) ||
798 $form_state['values']['gallery_filter_n_images'] < 1)) {
799 form_set_error('gallery_filter_n_images',
800 t('Number of images must be a number greater than zero.'));
801 }
802 }
803 }
804
805 /**
806 * Function _gallery_settings_filter_submit().
807 */
808 function _gallery_settings_filter_submit($form, &$form_state) {
809 // The default values have changed, so the pages containing the gallery filter need
810 // to be updated (or else it would only occur on an edit), so empty the filter cache.
811
812 // Find out which formats are using the gallery filter
813 $result = db_query("SELECT format FROM {filters} WHERE module = 'gallery'");
814 while ($format = db_fetch_object($result)) {
815 cache_clear_all($format->format .':', 'cache_filter', TRUE);
816 }
817
818 drupal_set_message('The gallery filter cache has been cleared so that the new defaults apply.');
819 }
820
821 /**
822 * Function _gallery_settings_g2image().
823 */
824 function _gallery_settings_g2image() {
825 $plugin_status = gallery_plugin_status(array('imageblock'));
826
827 $desc = t('G2Image requires the Gallery2 Image Block plugin (!imageblock_status) and
828 the g2image application to be installed.',
829 array('!imageblock_status' => theme('gallery_plugin_status_message', $plugin_status['imageblock'])));
830 if ($plugin_status['imageblock'] != GALLERY_PLUGIN_ENABLED) {
831 $g2_uri = variable_get('gallery_embed_uri', '?q=gallery');
832 $g2_plugins_page = (variable_get('gallery_valid', 0)) ?
833 t('<a href= "@g2_plugins">Gallery2 Plugins</a>',
834 array('@g2_plugins' => $g2_uri .'&g2_view=core.SiteAdmin&g2_subView=core.AdminModules'))
835 : t('Gallery2 Site Admin -> Plugins');
836 $desc .= t(' However the Image Block plugin is unavailable, so G2Image is
837 not available and the settings are disabled. To use G2Image please go to
838 the !g2_plugins page and install/activate the Image Block plugin.', array(
839 '!g2_plugins' => $g2_plugins_page));
840 }
841
842 $form['g2image'] = array(
843 '#type' => 'fieldset',
844 '#title' => t('Gallery Image Assist (G2Image) settings'),
845 '#collapsible' => FALSE,
846 '#collapsed' => FALSE,
847 '#description' => $desc,
848 );
849
850 if ($plugin_status['imageblock'] == GALLERY_PLUGIN_ENABLED) {
851 $form['g2image']['gallery_g2image_mode'] = array(
852 '#type' => 'select',
853 '#title' => t('Mode'),
854 '#default_value' => variable_get('gallery_g2image_mode', 'disabled'),
855 '#options' => array(
856 'disabled' => t('Disabled'),
857 'standalone' => t('Standalone'),
858 'tinymce' => t('TinyMCE'),
859 ),
860 '#description' => t('Determines the mode of operation. For anything other than \'Disabled\' the g2image
861 application has to be installed. See the INSTALL.txt instructions. In \'Standalone\'
862 mode a button will be visible under textfields to launch the g2image window. In
863 \'TinyMCE\' mode the g2image button can be used in the TinyMCE toolbar. Note that the
864 TinyMCE version will NOT work wih Safari - use the standalone version instead.'),
865 );
866
867 $form['g2image']['gallery_g2image_only_listed_pages'] = array(
868 '#type' => 'radios',
869 '#title' => t('Show g2image link on specific pages (Standalone mode only)'),
870 '#default_value' => variable_get('gallery_g2image_only_listed_pages', 1),
871 '#options' => array(
872 t('Show on every page except the listed pages.'),
873 t('Show on only the listed pages.')
874 )
875 );
876
877 require_once(drupal_get_path('module', 'gallery') .'/gallery_help.inc');
878 $form['g2image']['gallery_g2image_std_pages'] = array(
879 '#type' => 'textarea',
880 '#title' => t('Pages (Standalone mode only)'),
881 '#default_value' => variable_get('gallery_g2image_std_pages', gallery_help('admin/settings/gallery_g2image#pages')),
882 '#description' => t('Enter one page per line as Drupal paths. The \'*\' character is a wildcard. Example paths are
883 \'%blog\' for the blog page and %blog-wildcard for every personal blog. %front is the front page.',
884 array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>'))
885 );
886
887 $form['g2image']['gallery_g2image_sortby'] = array(
888 '#type' => 'select',
889 '#title' => t('Default Sort Order'),
890 '#default_value' => variable_get('gallery_g2image_sortby', 'title_asc'),
891 '#options' => array(
892 'title_asc' => t('Gallery2 Title (A-z)'),
893 'title_desc' => t('Gallery2 Title (z-A)'),
894 'name_asc' => t('Filename (A-z)'),
895 'name_desc' => t('Filename (z-A)'),
896 'mtime_desc' => t('Last Modification (newest first)'),
897 'mtime_asc' => t('Last Modification (oldest first)'),
898 ),
899 '#description' => t('Determines the default sorting order.'),
900 );
901
902 $form['g2image']['gallery_g2image_images_per_page'] = array(
903 '#type' => 'select',
904 '#title' => t('Default Number of images per page'),
905 '#default_value' => variable_get('gallery_g2image_images_per_page', 20),
906 '#options' => _gallery_range_array(10, 60, 10),
907 '#description' => t('Choose the default number of images per page.'),
908 );
909
910 $form['g2image']['gallery_g2image_display_filenames'] = array(
911 '#type' => 'select',
912 '#title' => t('Default Display Options'),
913 '#default_value' => variable_get('gallery_g2image_display_filenames', 'thumbnails'),
914 '#options' => array(
915 'thumbnails' => t('Thumbnails only'),
916 'filenames' => t('Thumbnails with title and filename'),
917 ),
918 '#description' => t('Choose the default display option for images.'),
919 );
920
921 $form['g2image']['gallery_g2image_default_action'] = array(
922 '#type' => 'select',
923 '#title' => t('Default Action'),
924 '#default_value' => variable_get('gallery_g2image_default_action', 'drupal_g2_filter'),
925 '#options' => array(
926 'drupal_g2_filter' => t('Gallery Filter ID'),
927 'thumbnail_image' => t('Thumbnail with link to image'),
928 'thumbnail_album' => t('Thumbnail with link to parent album'),
929 'thumbnail_custom_url' => t('Thumbnail with link to custom URL'),
930 'thumbnail_only' => t('Thumbnail only'),
931 'link_image' => t('Text link to image'),
932 'link_parent' => t('Text link to parent album'),
933 ),
934 '#description' => t('Choose the default method of inserting the image info.'),
935 );
936
937 $form['g2image']['gallery_g2image_custom_url'] = array(
938 '#type' => 'textfield',
939 '#title' => t('Default custom url'),
940 '#default_value' => variable_get('gallery_g2image_custom_url', 'http://'),
941 '#size' => 50,
942 '#maxlength' => 50,
943 '#description' => t('The default custom url. Used with \'Thumbnail with link to custom URL\' action setting'),
944 );
945
946 $css_options = array(
947 'none' => t('None'),
948 'g2image_normal' => t('Normal'),
949 'g2image_float_left' => t('Float Left'),
950 'g2image_float_right' => t('Float Right'),
951 'g2image_centered' => t('Centered'),
952 );
953
954 // Merge in custom class options
955 $gallery_g2image_custom_class = array_filter(variable_get('gallery_g2image_custom_class', array()));
956 $css_options = array_merge($css_options, drupal_map_assoc($gallery_g2image_custom_class));
957
958 $form['g2image']['gallery_g2image_default_alignment'] = array(
959 '#type' => 'select',
960 '#title' => t('Default Alignment'),
961 '#default_value' => variable_get('gallery_g2image_default_alignment', 'none'),
962 '#options' => $css_options,
963 '#description' => t('Choose the default alignment of images.'),
964 );
965
966 $form['g2image']['gallery_g2image_custom_class'] = array('#tree' => TRUE);
967 for ($i=1; $i<=4; $i++) {
968 $form['g2image']['gallery_g2image_custom_class'][$i] = array(
969 '#type' => 'textfield',
970 '#title' => t('Custom Class @index', array('@index' => $i)),
971 '#default_value' => isset($gallery_g2image_custom_class[$i]) ? $gallery_g2image_custom_class[$i] : '',
972 '#size' => 20,
973 '#maxlength' => 50,
974 );
975 }
976 $form['g2image']['gallery_g2image_custom_class'][$i-1]['#description'] = t('Additional css classes to be available for selection (must be defined in .css file).');
977
978 $form['g2image']['gallery_g2image_class_mode'] = array(
979 '#type' => 'select',
980 '#title' => t('Alignment Class Insertion Point'),
981 '#default_value' => variable_get('gallery_g2image_class_mode', 'img'),
982 '#options' => array(
983 'img' => t('<img class=...>'),
984 'div' => t('<div class=...><img ...>'),
985 ),
986 '#description' => t('Determines where the alignment class will be inserted. If you choose \'&lt;div
987 class=...&gt;&lt;img ...&gt;\', you will have to manually delete any &lt;div&gt; tags
988 manually after deleting images from the TinyMCE window.'),
989 );
990 }
991
992 $form['#validate'] = array('_gallery_g2image_settings_validate');
993 return system_settings_form($form);
994 }
995
996 /**
997 * Function _gallery_g2image_settings_validate().
998 * (saves the G2Image config file)
999 */
1000 function _gallery_g2image_settings_validate($form, &$form_state) {
1001 switch ($form_state['values']['gallery_g2image_mode']) {
1002 case 'tinymce':
1003 $mode = t('TinyMCE');
1004 $path = drupal_get_path('module', 'tinymce');
1005 $path .= '/tinymce/jscripts/tiny_mce/plugins/g2image';
1006 break;
1007 case 'standalone':
1008 $mode = t('Standalone');
1009 $path = drupal_get_path('module', 'gallery');
1010 $path .= '/g2image';
1011 break;
1012 default:
1013 return;
1014 }
1015
1016 // Note that file_check_directory uses &$path and will strip the trailing '/'
1017 $filename = $path .'/config.php';
1018 if (is_writable($filename) == FALSE && !file_check_directory($path)) {
1019 form_set_error('', t('G2Image does not seem to be installed for @mode mode in the required directory (@dir), or the
1020 directory is not writable. Please see the INSTALL.txt for instructions.',
1021 array('@mode' => $mode, '@dir' => '<drupal_path>/'. $path)));
1022 return;
1023 }
1024
1025 $cr = "\n";
1026 $g2ic_gallery2_path = str_replace('\\', '/', variable_get('gallery_dir', './gallery2/'));
1027 $g2ic_use_full_path = (substr($g2ic_gallery2_path, 0, 1) == '/' || substr($g2ic_gallery2_path, $_SERVER['DOCUMENT_ROOT']) !== FALSE) ?
1028 'TRUE' : 'FALSE';
1029 $form_state['values']['gallery_g2image_custom_url'] = check_url($form_state['values']['gallery_g2image_custom_url']);
1030 $g2ic_display_filenames = ($form_state['values']['gallery_g2image_display_filenames']