Project

General

Profile

« Previous | Next » 

Revision 467218eb

Added by Andreas Kohlbecker over 13 years ago

reorganizing the admin sections

View differences:

modules/cdm_dataportal/cdm_dataportal.css
9 9
  overflow: auto;
10 10
}
11 11

  
12
h6.debug {
12
body .messages{
13
	clear: both;
14
	margin-top: 25px;
15
}
16

  
17
body h6.debug {
13 18
	color: #FFFFFF;
14 19
	padding: 0 1em;
20
  margin-top: 10px;
15 21
	margin-bottom: -0.75em;
16
	border:1px solid #B8D3E5;
22
	border:1px solid #B8D3E5; 
23
	clear: both;
17 24
}
18 25

  
19 26
div.debug a.valid {
modules/cdm_dataportal/cdm_dataportal.module
165 165
function cdm_dataportal_menu($may_cache) {
166 166
	$items = array();
167 167

  
168
	if ($may_cache) {
169

  
170
		$items[] = array(
171
      'path' => 'admin/settings/cdm_dataportal',
172
      'title' => t('CDM Dataportal'),
173
      'description' => t('Setting for the CDM DataPortal'),
174
      'access' => user_access('administer cdm_dataportal'),
175
      'callback' => 'drupal_get_form',
176
      'callback arguments' => 'cdm_dataportal_settings',
177
      'type' => MENU_NORMAL_ITEM,
178
		);
179

  
180
		$items[] = array(
181
      'path' => 'admin/settings/cdm_dataportal/general',
182
      'title' => t('General'),
183
      'description' => t('Setting for the CDM DataPortal'),
184
      'access' => user_access('administer cdm_dataportal'),
185
      'callback' => 'drupal_get_form',
186
      'callback arguments' => 'cdm_dataportal_settings',
187
	  'weight' => 0,
188
      'type' => MENU_LOCAL_TASK,
189
		);
190

  
191
		$items[] = array(
192
      'path' => 'admin/settings/cdm_dataportal/geo',
193
      'title' => t('Geo & Map'),
194
      'description' => t('Geo & Map'),
195
      'access' => user_access('administer cdm_dataportal'),
196
      'callback' => 'drupal_get_form',
197
      'callback arguments' => 'cdm_dataportal_settings_geo',
198
	    'weight' => 1,
199
      'type' => MENU_LOCAL_TASK,
200
		);
168
	cdm_dataportal_menu_admin($may_cache, $items);
201 169

  
202
		$items[] = array(
203
      'path' => 'admin/settings/cdm_dataportal/layout',
204
      'title' => t('Layout'),
205
      'description' => t('Configure and adjust the layout of your DataPortal '),
206
      'access' => user_access('administer cdm_dataportal'),
207
      'callback' => 'drupal_get_form',
208
      'callback arguments' => 'cdm_dataportal_settings_layout',
209
      'weight' => 2,
210
      'type' => MENU_LOCAL_TASK,
211
		);
212

  
213
		$items[] = array(
214
      'path' => 'admin/settings/cdm_dataportal/cachesite',
215
      'title' => t('Cache'),
216
      'description' => t('Cache the whole CDM DataPortal site'),
217
      'access' => user_access('administer cdm_dataportal'),
218
      'callback' => 'cdm_dataportal_view_cache_site',
219
      'weight' => 10,
220
      'type' => MENU_LOCAL_TASK,
221
		);
222

  
223
		/*$items[] = array(
224
		 'path' => 'admin/settings/cdm_dataportal/ws',
225
		 'title' => t('Web Service'),
226
		 'description' => t('Setting for the CDM DataPortal'),
227
		 'access' => user_access('administer cdm_dataportal'),
228
		 'callback' => 'drupal_get_form',
229
		 'callback arguments' => 'cdm_dataportal_settings',
230
		 'weight' => 1,
231
		 'type' => MENU_DEFAULT_LOCAL_TASK,
232
		 );*/
170
	if ($may_cache) {
233 171

  
234
		$items[] = array(
172
	 $items[] = array(
235 173
	    'path' => 'cdm_dataportal/names',
236 174
	    'callback' => 'cdm_dataportal_view_names',
237 175
	    'access' => true,
modules/cdm_dataportal/settings.php
40 40
  return variable_get($gallery_config_form_name, $default_values);
41 41
}
42 42

  
43
/**
44
 * Generate main administration form.
45
 *
46
 * @return
47
 *   An array containing form items to place on the module settings page.
48
 */
49
function cdm_dataportal_settings(){
50 43

  
51
  return cdm_dataportal_settings_general();
44
function cdm_dataportal_menu_admin($may_cache, &$items){
45

  
46
	if (!$may_cache) {
47

  
48
		$items[] = array(
49
      'path' => 'admin/settings/cdm_dataportal',
50
      'title' => t('CDM Dataportal'),
51
      'description' => t('Setting for the CDM DataPortal'),
52
      'access' => user_access('administer cdm_dataportal'),
53
      'callback' => 'drupal_get_form',
54
      'callback arguments' => 'cdm_settings_general',
55
      'type' => MENU_NORMAL_ITEM,
56
    );
57

  
58
    $items[] = array(
59
      'path' => 'admin/settings/cdm_dataportal/general',
60
      'title' => t('General'),
61
      'description' => t('Setting for the CDM DataPortal'),
62
      'access' => user_access('administer cdm_dataportal'),
63
      'callback' => 'drupal_get_form',
64
      'callback arguments' => 'cdm_settings_general',
65
    'weight' => 0,
66
      'type' => MENU_LOCAL_TASK,
67
    );
68

  
69
    $items[] = array(
70
      'path' => 'admin/settings/cdm_dataportal/cachesite',
71
      'title' => t('Cache'),
72
      'description' => t('Cache the whole CDM DataPortal site'),
73
      'access' => user_access('administer cdm_dataportal'),
74
      'callback' => 'cdm_view_cache_site',
75
      'weight' => 10,
76
      'type' => MENU_LOCAL_TASK,
77
    );
78

  
79
    $items[] = array(
80
      'path' => 'admin/settings/cdm_dataportal/geo',
81
      'title' => t('Geo & Map'),
82
      'description' => t('Geo & Map'),
83
      'access' => user_access('administer cdm_dataportal'),
84
      'callback' => 'drupal_get_form',
85
      'callback arguments' => 'cdm_settings_geo',
86
      'weight' => 1,
87
      'type' => MENU_LOCAL_TASK,
88
    );
89

  
90
    $items[] = array(
91
      'path' => 'admin/settings/cdm_dataportal/layout',
92
      'title' => t('Layout'),
93
      'description' => t('Configure and adjust the layout of your DataPortal '),
94
      'access' => user_access('administer cdm_dataportal'),
95
      'callback' => 'drupal_get_form',
96
      'callback arguments' => 'cdm_settings_layout',
97
      'weight' => 2,
98
      'type' => MENU_LOCAL_TASK,
99
    );
100

  
101
    $items[] = array(
102
      'path' => 'admin/settings/cdm_dataportal/layout/taxon',
103
      'title' => t('Taxon'),
104
      'description' => t('Configure and adjust the layout of your DataPortal '),
105
      'access' => user_access('administer cdm_dataportal'),
106
      'callback' => 'drupal_get_form',
107
      'callback arguments' => 'cdm_settings_layout_taxon',
108
      'weight' => 1,
109
      'type' => MENU_LOCAL_TASK,
110
    );
111

  
112
    $items[] = array(
113
      'path' => 'admin/settings/cdm_dataportal/layout/search',
114
      'title' => t('Search'),
115
      'description' => t('Configure and adjust the layout of your DataPortal '),
116
      'access' => user_access('administer cdm_dataportal'),
117
      'callback' => 'drupal_get_form',
118
      'callback arguments' => 'cdm_settings_layout_search',
119
      'weight' => 2,
120
      'type' => MENU_LOCAL_TASK,
121
    );
122

  
123
     $items[] = array(
124
      'path' => 'admin/settings/cdm_dataportal/layout/media',
125
      'title' => t('Media'),
126
      'description' => t('Configure and adjust the layout of your DataPortal '),
127
      'access' => user_access('administer cdm_dataportal'),
128
      'callback' => 'drupal_get_form',
129
      'callback arguments' => 'cdm_settings_layout_media',
130
      'weight' => 3,
131
      'type' => MENU_LOCAL_TASK,
132
    );
133

  
134
	}
135

  
136

  
52 137
}
53 138

  
139

  
54 140
/**
55 141
 * Configures the settings form for the CDM-API module.
56 142
 *
57 143
 * @return Array Drupal settings form
58 144
 */
59
function cdm_dataportal_settings_general(){
145
function cdm_settings_general(){
60 146

  
61 147
  $form['cdm_webservice'] = array(
62 148
      '#type' => 'fieldset',
......
154 240
 * LAYOUT settings
155 241
 * @return unknown_type
156 242
 */
157
function cdm_dataportal_settings_layout(){
243
function cdm_settings_layout(){
158 244

  
159 245
  $form = array();
160
  /*
161
   $form['cdm_taxonname_type'] = array(
162
   '#type' => 'select',
163
   '#title'         => t('Taxon name type'),
164
   '#default_value' => variable_get('cdm_taxonname_type', 'BotanicalName'),
165
   '#options' => array( 'BotanicalName'=>t('BotanicalName'), 'ZoologicalName'=>t('ZoologicalName')),
166
   '#description'   => t('')
167
   );
168
   */
169 246

  
170
  $form['cdm_dataportal_taxonpage_tabs'] = array(
171
    '#type' => 'checkbox',
172
    '#title' => t('Tabbed taxon page'),
173
    '#default_value' => variable_get('cdm_dataportal_taxonpage_tabs', 1),
174
    '#description' => t('Split the taxon page into individual tabs for description, images, synonymy')
175
  );
176 247

  
177 248
  //---- footnotes ---//
178 249
  $form['footnotes'] = array(
179 250
      '#type' => 'fieldset',
180 251
      '#title' => t('Footnotes'),
181
      '#collapsible' => TRUE,
182
      '#collapsed' => TRUE,
252
      '#collapsible' => FALSE,
253
      '#collapsed' => FALSE,
183 254
  );
184 255

  
185 256
  $form['footnotes']['cdm_dataportal_all_footnotes'] = array(
......
196 267
      '#description' => t('Check this if you do not want to show annotation footnotes')
197 268
  );
198 269

  
270
  return system_settings_form($form);
271
}
272

  
273
function cdm_settings_layout_taxon(){
274

  
275
	$form = array();
276

  
277
  $form['cdm_dataportal_taxonpage_tabs'] = array(
278
    '#type' => 'checkbox',
279
    '#title' => t('Tabbed taxon page'),
280
    '#default_value' => variable_get('cdm_dataportal_taxonpage_tabs', 1),
281
    '#description' => t('Split the taxon page into individual tabs for description, images, synonymy')
282
  );
283

  
284
   //---- IMAGES ----//
285
  $form['images'] = array(
286
      '#type' => 'fieldset',
287
      '#title' => t('Images'),
288
      '#collapsible' => FALSE,
289
      '#collapsed' => FALSE,
290
  );
291
  $options = cdm_rankVocabulary_as_option();
292
  array_unshift($options, '-- DISABLED --');
293
  $form['images']['image_hide_rank'] =  array(
294
      '#type'          => 'select',
295
      '#title'         => t('Hide Images for Taxa above'),
296
      '#default_value' => variable_get('image_hide_rank', '0'),
297
      '#options'       => $options,
298
      '#description'   => t(''),
299
  );
300
  //show media
301
  $selectShowMedia = array(0 => "Show only taxon media",
302
  1 => "Show taxon and child taxon media");
303
  $form['images']['cdm_dataportal_show_media'] = array(
304
      '#type' => 'select',
305
      '#title' => t('Available media files'),
306
      '#default_value' => variable_get('cdm_dataportal_show_media', false),
307
      '#options' => $selectShowMedia,
308
      '#description'   => t('Select if a taxon should show only his media or also child media.')
309
  );
310
  $selectShowMedia = array(0 => "Show only taxon media",
311
  1 => "Show taxon and child taxon media");
312
  $form['images']['cdm_dataportal_show_default_image'] = array(
313
      '#type' => 'checkbox',
314
      '#title' => t('Show default image'),
315
      '#default_value' => variable_get('cdm_dataportal_show_default_image', false),
316
      '#description'   => t('Select if the taxon profile page should display the default image if no image is available for the chosen taxon.')
317
  );
318

  
319
  /* ===  TAXON_PROFILE === */
320
   $form['taxon_profile'] = array(
321
      '#type' => 'fieldset',
322
      '#title' => t('Taxon profile'),
323
      '#description'   => t('This section covers setting related to the taxon profile tab, also known as the <strong>"General"</strong> tab.'),
324
      '#collapsible' => TRUE,
325
      '#collapsed' => FALSE,
326
  );
327

  
328
  $form['taxon_profile'][CDM_DATAPORTAL_DEFAULT_FEATURETREE_UUID] = array(
329
      '#type' => 'radios',
330
      '#title'         => t('Taxon profile sections'),
331
      '#default_value' => variable_get(CDM_DATAPORTAL_DEFAULT_FEATURETREE_UUID, UUID_DEFAULT_FEATURETREE),
332
      '#options' => cdm_get_featureTrees_as_options(TRUE),
333
      '#description'   => t('Select a FeatureTree to specify the kins and order of sections to be displayd in the taxon profile.'
334
  )
335
  );
336

  
337
  $form['taxon_profile'][CDM_DATAPORTAL_STRUCTURED_DESCRIPTION_FEATURETREE_UUID] = array(
338
      '#type' => 'radios',
339
      '#title'         => t('Natural language representation of structured descriptions'),
340
      '#default_value' => variable_get(CDM_DATAPORTAL_STRUCTURED_DESCRIPTION_FEATURETREE_UUID, null),
341
      '#options' => cdm_get_featureTrees_as_options(),
342
      '#description'   => t('Taxon descriptions can be stored in a highly structured form.'.
343
        ' The feature tree selected here will be used to generate textual representation in natural language.'
344
        //.' If there is no applicable FeatureTree you can create a new one using the <a href="">FeatureTreeManager</a>'
345
  )
346
  );
347

  
348
  $form_name = CDM_DATAPORTAL_DESCRIPTION_GALLERY_NAME;
349
  $form_tittle = 'Images';
350
  $form['taxon_profile'][] = cdm_dataportal_create_gallery_settings_form($form_name, $form_tittle, $collapsed);
351

  
352
  //-- DISTRIBUTION LAYOUT --//
353
  $form['taxon_profile']['distribution_layout'] = array(
354
        '#title' => t('Distribution layout'),
355
        '#collapsible' => TRUE,
356
        '#collapsed' => FALSE,
357
        '#type' => 'fieldset',
358
  );
359

  
360
  $form['taxon_profile']['distribution_layout']['distribution_sort'] =  array(
361
    '#type'          => 'radios',
362
    '#title'         => t('Sort'),
363
    '#default_value' => variable_get('distribution_sort', 'NO_SORT'),
364
    '#options' => array(
365
        'NO_SORT' => t('Standard (No sort)'),
366
        'HIDE_TDWG2' => t('Sorted without TDWG Level 2'),
367
  ));
199 368

  
200 369
  //---- SYNONYMY ----//
201 370
  $form['synonymy'] = array(
202 371
      '#type' => 'fieldset',
203 372
      '#title' => t('Synonymy'),
204 373
      '#collapsible' => TRUE,
205
      '#collapsed' => TRUE,
374
      '#collapsed' => FALSE,
206 375
  );
207 376

  
208 377
  $form['synonymy']['cdm_dataportal_nomref_in_title'] = array(
......
271 440
   .' Check this box to allow displaying all descriptions separately.')
272 441
   );
273 442
   */
274
  //------------------ FEATURE TREE --------------------//
275 443

  
276
  $form['cdm_dataportal']['taxon_profile'] = array(
444
   // --- SPECIMENs --- //
445
    $form['specimens'] = array(
277 446
      '#type' => 'fieldset',
278
      '#title' => t('Taxon profile'),
279
      '#description'   => t('This section covers setting related to the taxon profile tab, also known as the <strong>"General"</strong> tab.'),
447
      '#title' => t('Specimens'),
280 448
      '#collapsible' => TRUE,
281
      '#collapsed' => TRUE,
282
  );
283

  
284
  $form['cdm_dataportal']['taxon_profile'][CDM_DATAPORTAL_DEFAULT_FEATURETREE_UUID] = array(
285
      '#type' => 'radios',
286
      '#title'         => t('Taxon profile elements'),
287
      '#default_value' => variable_get(CDM_DATAPORTAL_DEFAULT_FEATURETREE_UUID, UUID_DEFAULT_FEATURETREE),
288
      '#options' => cdm_get_featureTrees_as_options(TRUE),
289
      '#description'   => t('Select a FeatureTree to specify the elements to be displayd in the taxon profile.'
290
      //.' If there is no applicable FeatureTree you can create a new one using the <a href="">FeatureTreeManager</a>'
291
  )
449
      '#collapsed' => FALSE,
292 450
  );
451
  $form_name = CDM_DATAPORTAL_SPECIMEN_GALLERY_NAME;
452
  $form_tittle = 'Specimen media gallery';
453
  $form['specimens'] = cdm_dataportal_create_gallery_settings_form($form_name, $form_tittle, $collapsed);
293 454

  
294
  $form['cdm_dataportal']['taxon_profile'][CDM_DATAPORTAL_STRUCTURED_DESCRIPTION_FEATURETREE_UUID] = array(
295
      '#type' => 'radios',
296
      '#title'         => t('Natural language representation of structured descriptions'),
297
      '#default_value' => variable_get(CDM_DATAPORTAL_STRUCTURED_DESCRIPTION_FEATURETREE_UUID, null),
298
      '#options' => cdm_get_featureTrees_as_options(),
299
      '#description'   => t('Taxon descriptions can be stored in a highly structured form.'.
300
        ' The feature tree selected here will be used to generate textual representation in natural language.'
301
        //.' If there is no applicable FeatureTree you can create a new one using the <a href="">FeatureTreeManager</a>'
302
  )
303
  );
455
	return system_settings_form($form);
456
}
304 457

  
305
  //---- IMAGES ----//
306
  $form['images'] = array(
307
      '#type' => 'fieldset',
308
      '#title' => t('Images'),
309
      '#collapsible' => TRUE,
310
      '#collapsed' => TRUE,
311
  );
312
  $options = cdm_rankVocabulary_as_option();
313
  array_unshift($options, '-- DISABLED --');
314
  $form['images']['image_hide_rank'] =  array(
315
      '#type'          => 'select',
316
      '#title'         => t('Hide Images for Taxa above'),
317
      '#default_value' => variable_get('image_hide_rank', '0'),
318
      '#options'       => $options,
319
      '#description'   => t(''),
320
  );
321
  //show media
322
  $selectShowMedia = array(0 => "Show only taxon media",
323
  1 => "Show taxon and child taxon media");
324
  $form['images']['cdm_dataportal_show_media'] = array(
325
      '#type' => 'select',
326
      '#title' => t('Available media files'),
327
      '#default_value' => variable_get('cdm_dataportal_show_media', false),
328
      '#options' => $selectShowMedia,
329
      '#description'   => t('Select if a taxon should show only his media or also child media.')
330
  );
331
  $selectShowMedia = array(0 => "Show only taxon media",
332
  1 => "Show taxon and child taxon media");
333
  $form['images']['cdm_dataportal_show_default_image'] = array(
334
      '#type' => 'checkbox',
335
      '#title' => t('Show default image'),
336
      '#default_value' => variable_get('cdm_dataportal_show_default_image', false),
337
      '#description'   => t('Select if the taxon profile page should display the default image if no image is available for the chosen taxon.')
338
  );
458
function cdm_settings_layout_search(){
459
  $form = array();
339 460

  
340
  //------------------ SEARCH --------------------//
341
  $form['search'] = array(
342
      '#type' => 'fieldset',
343
      '#title' => t('Search'),
344
      '#collapsible' => TRUE,
345
      '#collapsed' => TRUE,
346
  );
347
  $form['search']['cdm_dataportal_search_items_on_page'] = array(
461
  $form['cdm_dataportal_search_items_on_page'] = array(
348 462
    '#type' => 'textfield',
349 463
    '#title' => t('Search Page Size'),
350 464
    '#default_value' => variable_get('cdm_dataportal_search_items_on_page', CDM_DATAPORTAL_SEARCH_ITEMS_ON_PAGE),
......
353 467

  
354 468
  // --- SEARCH TAXA GALLERY ---- //
355 469
  $items = variable_get('cdm_dataportal_search_items_on_page', CDM_DATAPORTAL_SEARCH_ITEMS_ON_PAGE);
356
  $collapsed = TRUE;
470
  $collapsed = FALSE;
357 471
  $form_name = CDM_DATAPORTAL_SEARCH_GALLERY_NAME;
358
  $form_tittle = 'Search Taxa';
359
  $form[] = cdm_dataportal_create_gallery_settings_form($form_name, $form_tittle, $collapsed);
360

  
361
  // --- FEATURE DESCRIPTION GALLERY ---- //
362
  $form_name = CDM_DATAPORTAL_DESCRIPTION_GALLERY_NAME;
363
  $form_tittle = 'Description elements gallery';
364
  $form[] = cdm_dataportal_create_gallery_settings_form($form_name, $form_tittle, $collapsed);
365

  
366
  // --- CDM_DATAPORTAL_SPECIMEN_GALLERY --- //
367
  $form_name = CDM_DATAPORTAL_SPECIMEN_GALLERY_NAME;
368
  $form_tittle = 'Speciment media gallery';
472
  $form_tittle = 'Media Thumbnails';
369 473
  $form[] = cdm_dataportal_create_gallery_settings_form($form_name, $form_tittle, $collapsed);
370 474

  
475
  return system_settings_form($form);
476
}
371 477

  
372
  // --- MEDIA GALLERY ---- //
373
  $form_name = CDM_DATAPORTAL_MEDIA_GALLERY_NAME;
374
  $form_tittle = 'Media gallery';
375
  $form[] = cdm_dataportal_create_gallery_settings_form($form_name, $form_tittle, $collapsed);
478
function cdm_settings_layout_media(){
479
  $form = array();
376 480

  
377 481
  $form['image_gallery_viewer'] =  array(
378 482
    '#type'          => 'select',
......
382 486
        'default' => t('Standart image gallery'),
383 487
        'fsi' => t('FSI viewer (requires FSI server!)'),
384 488
  ));
385
  // variable_get("imageviewer", "default")
386 489

  
387
  //-- DISTRIBUTION LAYOUT --//
388
  $form['distribution_layout'] = array(
389
        '#title' => t('Distribution layout'),
390
        '#collapsible' => TRUE,
391
        '#collapsed' => TRUE,
392
        '#type' => 'fieldset',
393
  );
490
  // --- MEDIA GALLERY ---- //
491
  $form_name = CDM_DATAPORTAL_MEDIA_GALLERY_NAME;
492
  $form_tittle = 'Media gallery';
493
  $form[] = cdm_dataportal_create_gallery_settings_form($form_name, $form_tittle, $collapsed);
394 494

  
395
  $form['distribution_layout']['distribution_sort'] =  array(
396
    '#type'          => 'radios',
397
    '#title'         => t('Sort'),
398
    '#default_value' => variable_get('distribution_sort', 'NO_SORT'),
399
    '#options' => array(
400
        'NO_SORT' => t('Standard (No sort)'),
401
        'HIDE_TDWG2' => t('Sorted without TDWG Level 2'),
402
  ));
403 495

  
404 496
  return system_settings_form($form);
405 497
}
......
409 501
 * GEOSERVICE and Map settings
410 502
 * @return unknown_type
411 503
 */
412
function cdm_dataportal_settings_geo(){
504
function cdm_settings_geo(){
413 505

  
414 506
  $form = array();
415 507

  
......
590 682
/**
591 683
 * @return walk and cache all taxon pages
592 684
 */
593
function cdm_dataportal_view_cache_site(){
685
function cdm_view_cache_site(){
594 686

  
595 687
  _add_js_progressbar();
596 688

  
......
636 728
 *
637 729
 * @param $element
638 730
 */
639
function cdm_dataportal_settings_validate($form_id, $form_values){
731
function cdm_settings_validate($form_id, $form_values){
640 732

  
641 733
  if (!str_endsWith($form_values['cdm_webservice_url'], '/')) {
642 734
    //form_set_error('cdm_webservice_url', t("The URL to the CDM Web Service must end with a slash: '/'."));

Also available in: Unified diff