Project

General

Profile

Download (21 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/**
3
 * @file
4
 * Page theming functions.
5
 *
6
 * @copyright
7
 *   (C) 2007-2012 EDIT
8
 *   European Distributed Institute of Taxonomy
9
 *   http://www.e-taxonomy.eu
10
 *
11
 *   The contents of this module are subject to the Mozilla
12
 *   Public License Version 1.1.
13
 * @see http://www.mozilla.org/MPL/MPL-1.1.html
14
 */
15

    
16
/**
17
 * Returns HTML for the default title of a taxon page.
18
 *  * The returned title is a formatted taxon name.
19
 *
20
 * @param array $variables
21
 *   An associative array containing:
22
 *   - taxon: The taxon name being formatted for the title.
23
 *   - uuid: UUID for the taxon.
24
 *
25
 * @ingroup themeable
26
 */
27
function theme_cdm_taxon_page_title($variables) {
28
  $taxon = $variables['taxon'];
29
  RenderHints::pushToRenderStack('taxon_page_title');
30
  $referenceUri = '';
31
  $out = '';
32
  if (isset($taxon->name->nomenclaturalReference)) {
33
    $referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
34
  }
35

    
36
  $out .= render_taxon_or_name($taxon, NULL, $referenceUri, FALSE);
37
  RenderHints::popFromRenderStack();
38

    
39
  return '<span class="' . $taxon->class . '">' . $out . '</span>';
40
}
41

    
42
/**
43
 * Returns HTML for the default title of a specimen page.
44
 *  * The returned title is a the identifier of the specimen.
45
 *
46
 * @param array $variables
47
 *   An associative array containing:
48
 *   - specimen: The specimen being formatted for the title.
49
 *
50
 * @ingroup themeable
51
 */
52
function theme_cdm_specimen_page_title($variables) {
53
    $specimen = $variables['specimen'];
54
    RenderHints::pushToRenderStack('specimen_page_title');
55
    $referenceUri = '';
56
    $out = '';
57

    
58

    
59
    if($specimen->collection->code){
60
      $collection = $specimen->collection->code;
61
    }
62
    elseif($specimen->collection->name){
63
      $collection = $specimen->collection->name;
64
    }
65
    if($specimen->accessionNumber){
66
        $specimenID = $specimen->accessionNumber;
67
    }
68
    elseif($specimen->barcode){
69
      $specimenID = $specimen->barcode;
70
    }
71
    elseif($specimen->catalogNumber) {
72
      $specimenID = $specimen->catalogNumber;
73
    }
74
    if(!isset($specimenID) and !isset($collection)){
75
      $specimenID = $specimen->uuid;
76
    }
77

    
78

    
79
  $out .= "Specimen ";
80
  if($collection){
81
    $out .= $collection." ";
82
  }
83
  $out .= $specimenID;
84

    
85
  RenderHints::popFromRenderStack();
86

    
87
  return '<span class="' . $specimen->class . '">' . $out . '</span>';
88
}
89

    
90
/**
91
 * Returns HTML for the default title for a name page.
92
 *
93
 * The returned title is a formatted name.
94
 *
95
 * @param array $variables
96
 *   An associative array containing:
97
 *   - taxon_name: The taxon name object.
98
 *
99
 * @ingroup themeable
100
 */
101
function theme_cdm_name_page_title($variables) {
102
  $taxon_name = $variables['taxon_name'];
103
  RenderHints::pushToRenderStack('taxon_page_title');
104

    
105
  $referenceUri = NULL;
106
  if (isset($taxon_name->nomenclaturalReference)) {
107
    $referenceUri = url(path_to_reference($taxon_name->nomenclaturalReference->uuid));
108
  }
109

    
110
  $out = '<span class="' . $taxon_name->class . '">'
111
    . render_taxon_or_name($taxon_name, NULL, $referenceUri, FALSE)
112
    . '</span>';
113
  RenderHints::popFromRenderStack();
114
  return $out;
115
}
116

    
117

    
118

    
119

    
120

    
121
/**
122
 * Returns HTML containing the synonymy for the accepted taxon.
123
 *
124
 * Shows the whole synonymy for the accepted taxon.
125
 * The synonymy list is headed by the complete scientific name
126
 * of the accepted taxon with nomenclatural reference.
127
 *
128
 * @param array $variables
129
 *   An associative array containing:
130
 *   - taxon
131
 *   - addAcceptedTaxon
132
 *
133
 * @ingroup themeable
134
 */
135
function theme_cdm_taxon_page_synonymy($variables) {
136
  $taxon = $variables['taxon'];
137
  $addAcceptedTaxon = $variables['addAcceptedTaxon'];
138

    
139
  RenderHints::pushToRenderStack('taxon_page_synonymy');
140

    
141
  // footnote key for the homotypic group and accepted taxon,
142
  // both should have the same footnote key
143
  RenderHints::setFootnoteListKey(RenderHints::getRenderPath());
144

    
145
  $synomymie = cdm_ws_get(CDM_WS_PORTAL_TAXON_SYNONYMY, array($taxon->uuid));
146

    
147
  $out = '';
148

    
149
  // Render accepted taxon.
150
  //
151
  // foonotes of the accepted taxon will be rendered in the homotypic group section
152
  // even if there are not synonyms in the homotypic group
153
  // homotypic group and accepted taxon should have the same footnote key
154
  $referenceUri = '';
155
  if ($addAcceptedTaxon) {
156
    // remember the last part of the render path
157
    $synonymy_render_path = RenderHints::getRenderPath();
158
    // set new render path for the accepted taxon so
159
    // it can be styled differently via the name render part definitions
160
    RenderHints::pushToRenderStack('accepted_taxon');
161
    if (isset($taxon->name->nomenclaturalReference)) {
162
      $referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
163
    }
164

    
165
    $accepted_name = '<div class="accepted-name">';
166
    $accepted_name .= render_taxon_or_name($taxon, NULL, $referenceUri);
167

    
168
    $name_relationships = cdm_name_relationships_of($taxon);
169
    // Render relationships of accepted name.
170
    if($name_relationships){
171

    
172
      $accepted_name .= ' <span class="name_relationships">' . $name_relationships . '</span>';
173
    }
174

    
175
      // handle annotations of the name and taxon
176
    $special_annotations_array = array();
177
    $special_annotations_array[] = $taxon->name;
178
    $special_annotations_array[] = $taxon;
179
    $accepted_name .= theme('cdm_annotations_as_footnotekeys', array(
180
        'cdmBase_list' => $special_annotations_array,
181
        'footnote_list_key' => $synonymy_render_path . '-annotations')
182
      );
183
    $accepted_name .= '</div>';
184
    RenderHints::popFromRenderStack();
185
  }
186

    
187
  // --- Render homotypic synonymy group
188
  if (!empty($accepted_name)) {
189
    $out .= $accepted_name;
190
  }
191

    
192
  // Render the homotypicSynonymyGroup including the type information.
193
  $out .= theme(
194
      'cdm_homotypicSynonymyGroup',
195
      array(
196
          'synonymList' => $synomymie->homotypicSynonymsByHomotypicGroup,
197
          'accepted_taxon_name_uuid' => $taxon->name->uuid
198
      )
199
    );
200

    
201

    
202
  // Render accepted taxon heterotypic synonymy groups.
203
  if ($synomymie->heterotypicSynonymyGroups) {
204
    foreach ($synomymie->heterotypicSynonymyGroups as $homotypicalGroup) {
205
      $out .= theme('cdm_heterotypicSynonymyGroup', array('homotypicalGroup' => $homotypicalGroup));
206
    }
207
  }
208
  // Render taxon relationships.
209
  if (variable_get(CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS, CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS_DEFAULT)) {
210
    $taxonRelationships = cdm_ws_get(CDM_WS_PORTAL_TAXON_RELATIONS, $taxon->uuid);
211
    $out .= cdm_taxonRelationships($taxonRelationships, $taxon);
212
  }
213

    
214
  RenderHints::popFromRenderStack();
215

    
216
  return $out;
217
}
218

    
219

    
220
/**
221
 * Returns HTML for the given result page including a pager.
222
 *
223
 * @param array $variables
224
 *   An associative array containing:
225
 *   - pager: The cdmlib pager object containing the result set of cdm base
226
 *     objects (currently this function can only handle taxon instances =>
227
 *     TODO)
228
 *   - path: The target path for the pager links, this will usually point to
229
 *     'cdm_dataportal/search/results/taxon'
230
 *
231
 * @ingroup themeable
232
 */
233
function theme_cdm_search_results($variables)
234
{
235
  $pager = $variables['pager'];
236
  $path = $variables['path'];
237

    
238
  $freetextSearchResults = array();
239

    
240
  // If the pager contains records of SearchResults, extract the taxa and use
241
  // them as records instead.
242
  if (isset($pager->records[0]) && $pager->records[0]->class == "SearchResult") {
243
    $freetextSearchResults = $pager->records;
244
    $taxa = array();
245
    // $highlightedFragments = array();
246
    foreach ($pager->records as $searchResult) {
247
      $taxa[] = &$searchResult->entity;
248
      /*
249
       if(!isset($searchResult->fieldHighlightMap)){
250
      $searchResult->fieldHighlightMap = NULL;
251
      }
252
      $fragmentHighlighting[] = $searchResult->fieldHighlightMap;
253
      */
254
    }
255
    $pager->records = $taxa;
256
  }
257

    
258

    
259
  // Add thumbnails checkbox and refine search link.
260
  $out = '<div class="page_options">';
261
  if (isset($_REQUEST['ws'])) {
262
    if (cdm_dataportal_search_form_path_for_ws($_REQUEST['ws'])) {
263
      $out .= '<div id="backButton">' . l(t('Modify search'), cdm_dataportal_search_form_path_for_ws($_REQUEST['ws'])) . '</div>';
264
    }
265
  }
266
  if (variable_get(SEARCH_RESULTS_SHOW_THUMBNAIL_CHECKBOX, SEARCH_RESULTS_SHOW_THUMBNAIL_CHECKBOX_DEFAULT)) {
267
    $out .= '<form name="pageoptions"><div id="showThumbnails"><input class="showThumbnails" type="checkbox" name="showThumbnails" ' . (do_showThumbnails() == 1 ? 'checked="checked"' : '') . '> ' . t('Display image thumbnails') . '</div></form>';
268
  }
269
  $out .= '</div>';
270

    
271
  $classification = cdm_dataportal_searched_in_classification();
272

    
273

    
274
  if (  count(cdm_ws_fetch_all(CDM_WS_PORTAL_TAXONOMY)) > 1 ) { // FIXME use a count REST method for this!!!
275
    $out .= '<div id="search-summary">' . t('results for') . ' ';
276
    if ($classification != NULL) {
277
      $out .=  $classification->titleCache ;
278
    } else {
279
     $out .= t('any classification');
280
    }
281
    $out .= ':</div>';
282
  }
283

    
284
  // List results.
285
  if (isset($pager->records) && count($pager->records) > 0) {
286
    $out .= '<div id="search_results">';
287
    $list_of_taxa = compose_list_of_taxa($pager->records, $freetextSearchResults, $classification === NULL);
288
    $out .= drupal_render($list_of_taxa);
289
    $out .= '</div>';
290
    $out .= theme('cdm_pager', array(
291
        'pager' => $pager,
292
        'path' => $path,
293
        'parameters' => $_REQUEST,
294
    ));
295
  } else {
296
    $out .= '<h4 class="error">' . t('Sorry, no matching entries found.') . '</h4>';
297
  }
298
  return $out;
299
}
300

    
301

    
302
/**
303
 * TODO Implementation of Hook taxon_image_gallery()
304
 *
305
 * @param unknown_type $taxon
306
 * @param unknown_type $media
307
 *
308
 * @return unknown_type
309
 */
310
function taxon_image_gallery_default($taxon, $media) {
311
  $hasImages = isset($media[0]);
312

    
313
  if ($hasImages) {
314

    
315
    $maxExtend = 150;
316
    $cols = 3;
317
    $maxRows = FALSE;
318
    $alternativeMediaUri = NULL;
319
    /* Comment @WA: was in D5:
320
    $captionElements = array(
321
      'title',
322
      'rights',
323
      '#uri' => t('Open Image'),
324
    );
325
    */
326
    $captionElements = array(
327
      'title',
328
      'description',
329
      'artist',
330
      'location',
331
      'rights',
332
      '#uri' => t('Open image'),
333
    );
334
    $gallery_name = $taxon->uuid;
335
    $mediaLinkType = 'LIGHTBOX';
336

    
337
    // $gallery_settings = getGallerySettings(CDM_DATAPORTAL_MEDIA_GALLERY_NAME);
338

    
339
    $gallery_settings = getGallerySettings(CDM_DATAPORTAL_TAXON_MEDIA_GALLERY_NAME_TAB);
340

    
341
    $out = '<div class="image-gallerie">';
342
    $out .= compose_cdm_media_gallerie(array(
343
      'mediaList' => $media,
344
      'galleryName' => $gallery_name,
345
      'maxExtend' => $gallery_settings['cdm_dataportal_media_maxextend'],
346
      'cols' => $gallery_settings['cdm_dataportal_media_cols'],
347
      'maxRows' => 0, // Ignore maxrows settings.
348
      'captionElements' => $captionElements,
349
      'mediaLinkType' => $mediaLinkType,
350
      'alternativeMediaUri' => NULL,
351
      'galleryLinkUri' => NULL,
352
      'showCaption' => $gallery_settings['cdm_dataportal_show_thumbnail_captions'],
353
    ));
354
    $out .= '</div>';
355
  }
356
  else {
357
    $out = 'No images available.';
358
  }
359
  return $out;
360
}
361

    
362
/**
363
 * TODO Implementation of Hook taxon_image_gallery()
364
 *
365
 * @param unknown_type $taxon
366
 * @param unknown_type $media
367
 *
368
 * @return unknown_type
369
 */
370
function taxon_image_gallery_fsi($taxon, $media) {
371
  $flashLink = isset($media[0]);
372

    
373
  if ($flashLink) {
374

    
375
    if (module_exists("fsi_gallery")) {
376
      $out = theme("fsi_gallery", array('taxon' => $taxon, 'media' => $media));
377
    }
378
    else {
379
      $message = t('In order to use the FSI gallery you must enable the according ') . l(t("module"), "admin/modules");
380
      drupal_set_message($message, "error");
381
      $out = '<h3>' . $message . '</h3>';
382
    }
383
  }
384
  else {
385
    $out = 'No images available.';
386
  }
387
  return $out;
388
}
389

    
390
/**
391
 * Returns HTML for a single reference page.
392
 *
393
 * Renders a page with all data on a single reference.
394
 *
395
 * @param array $variables
396
 *   An associative array containing:
397
 *   - reference: Object.
398
 *
399
 * @ingroup themeable
400
 */
401
function theme_cdm_reference_page($variables) {
402
  $reference = $variables['reference'];
403

    
404
  $out = '';
405

    
406
  if (isset($reference->titleCache)) {
407
    drupal_set_title($reference->titleCache, PASS_THROUGH);
408
  }
409

    
410
  $field_order = array(
411
    "title",
412
    "abbrevTitle",
413
    // "titleCache" abbrevTitleCache
414
    // "citation",
415
    "authorship",
416
    "editor",
417
    "publisher",
418
    "placePublished",
419
    "datePublished",
420
    "year",
421
    "edition",// Class Book.
422
    "volume",// Class Article.
423
    "seriesPart",
424
    "inReference",
425
    "nomRefBase", // Class BookSection, Book, Article.
426
    "pages",// Class Article.
427
    "series",// Class Article, PrintSeries.
428
    "school",// Class Thesis.
429
    "institution",// Class Report.
430
    "organization",// Class Proceedings.
431
    "nextVersion",
432
    "previousVersion",
433
    "isbn",// Class Book.
434
    "issn",// Class Journal.
435
    "doi",
436
    "uri"
437
  );
438

    
439
  $table_rows = array();
440

    
441
  if (!isset($reference->authorship)) {
442
    $authorship = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $reference->uuid);
443
    $reference->authorship = isset($authorship->titleCache) ? $authorship->titleCache : '';
444
  }
445

    
446
  if (!isset($reference->inReference)) {
447
    $reference->inReference = cdm_ws_get(CDM_WS_REFERENCE, array(
448
      $reference->uuid,
449
      "inReference",
450
    ));
451
  }
452

    
453
  foreach ($field_order as $fieldname) {
454

    
455
    if (isset($reference->$fieldname)) {
456

    
457
      if ($fieldname == "datePublished") {
458
        $period = $reference->$fieldname;
459
        $datePublished = timePeriodToString($period);
460
        if (isset($datePublished) && $datePublished != '') {
461
          $table_rows[] = array(
462
            t("Date published"),
463
            $datePublished,
464
          );
465
        }
466
        // $datePublished = array(t(ucfirst(strtolower($fieldname))),
467
        // $datePublished);
468
      }
469
      elseif ($fieldname == "doi" && is_object($reference->doi)) {
470
        $table_rows[] = array(
471
          t('@fieldname', array('@fieldname' => ucfirst(strtolower($fieldname)))),
472
          cdm_doi($reference->doi, false)
473
        );
474
      }
475
      elseif ($fieldname == "uri" && isset($reference->uri) && $reference->uri) {
476
        $table_rows[] = array(
477
          t('@fieldname', array('@fieldname' => ucfirst(strtolower($fieldname)))),
478
          cdm_external_uri($reference->uri, false)
479
        );
480
      }
481
      elseif (is_object($reference->$fieldname)) {
482
        if ($fieldname == "authorship") {
483
          $dump = $reference->$fieldname;
484
          $teammembers = "teamMembers";
485
          $team = $dump->$teammembers;
486
          $nameArray = array();
487

    
488
          foreach ($team as $member) {
489
            if (strlen($member->lastname) > 0) {
490
              $nname = $member->lastname;
491
              $name = $nname;
492
              if (strlen($member->firstname) > 0) {
493
                $vname = $member->firstname;
494
                $name = $vname . " " . $nname;
495
              }
496
              $nameArray[] = $name;
497
            }
498
            else {
499
              if (strlen($member->titleCache) > 0) {
500
                $nameArray[] = $member->titleCache;
501
              }
502
            }
503
          }
504
          $value = join($nameArray, ", ");
505
        }
506
        elseif ($fieldname == "inReference") {
507
          $type = $reference->$fieldname->type;
508
          $value = l($reference->$fieldname->titleCache, path_to_reference($reference->$fieldname->uuid));
509
          switch ($type) {
510
            case "Book":
511
              $fieldname = "in book";
512
              break;
513
            case "Journal":
514
              $fieldname = "in journal";
515
              break;
516
            case "Proceedings":
517
              $fieldname = "in proceedings";
518
              break;
519
          }
520
        }
521
        else {
522
          $value = $reference->$fieldname->titleCache;
523
        }
524

    
525

    
526
        if (isset($value) && $value != '') {
527
          $table_rows[] = array(
528
            t('@fieldname', array('@fieldname' => ucfirst(strtolower($fieldname)))),
529
            $value,
530
          );
531
        }
532

    
533
      }
534
      else {
535
        if (isset($reference->$fieldname) && $reference->$fieldname != '') {
536
          $table_rows[] = array(
537
            t('@fieldname', array('@fieldname' => ucfirst(strtolower($fieldname)))),
538
            $reference->$fieldname,
539
          );
540
        }
541
      }
542
    }
543
  }
544

    
545
  $out = theme_table(array(
546
      'header' => array(),
547
      'rows' => $table_rows,
548
      'attributes' => array(
549
        'class' => html_class_attribute_ref($reference)
550
      ),
551
      'caption' => NULL,
552
      'colgroups' => NULL,
553
      'sticky' => NULL,
554
      'empty' => NULL,
555
  ));
556

    
557
  if($reference->referenceAbstract){
558
    $out .= '<h2 class="block-title">Abstract</h2><div class="abstract">' . $reference->referenceAbstract . '</div>';
559
  }
560

    
561
  // Annotations below the table.
562
  $annotations = cdm_ws_getAnnotationsFor($reference);
563
  $out .= theme("cdm_annotations", array('annotations' => $annotations));
564

    
565
  return $out;
566
}
567

    
568
/**
569
 * @todo Please document this function.
570
 * @see http://drupal.org/node/1354
571
 */
572
function theme_cdm_media_page($variables) {
573

    
574
  $media = $variables['media'];
575
  $mediarepresentation_uuid = $variables['mediarepresentation_uuid'];
576
  $partId = $variables['partId'];
577
  $out = '';
578

    
579
  // Determine which representation and which part to show
580
  $active_representation_index = 0;
581

    
582
  if (!$mediarepresentation_uuid) {
583
    // no representation requested by the method parameters, find the best one
584
    $representations = cdm_preferred_media_representations($media, array('image/png', 'image/jpeg', 'image/gif'), null, null);
585
    if($representations  && count($representations) > 0){
586
      $preferred_representation = array_shift($representations);
587
      $mediarepresentation_uuid = $preferred_representation->uuid;
588
    }
589
  }
590

    
591
  if($mediarepresentation_uuid){
592
    foreach ($media->representations as $representation) {
593
      if ($representation->uuid == $mediarepresentation_uuid) {
594
        break;
595
      }
596
      $active_representation_index++;
597
    }
598
  }
599

    
600

    
601
  $active_part_index = 0;
602
  if (is_uuid($partId)) {
603
    foreach ($media->representations[$active_representation_index]->parts as $part) {
604
      if ($part->uuid == $partId) {
605
        break;
606
      }
607
      $active_part_index++;
608
    }
609
  }
610
  else if(is_numeric($partId)){
611
    $active_part_index = $partId;
612
  }
613

    
614
  $media_metadata = read_media_metadata($media);
615
  // $title = $media->titleCache;
616
  $title = $media_metadata['title'];
617

    
618
  $imageMaxExtend = variable_get('image-page-maxextend', 400);
619

    
620
  if (!$title) {
621
    $title = 'Media ' . $media->uuid . '';
622
  }
623

    
624
  drupal_set_title($title, PASS_THROUGH);
625

    
626
  $out .= '<div class="media cdm_media_viewer_image">';
627

    
628
  if(preg_match('/cdm_dataportal\/taxon\//', $_SERVER['HTTP_REFERER']) ){
629
    $out .= '<div id="backToGalleryButton">' . l(t('Back to Images'), $_SESSION['cdm']['last_gallery']) . '</div>';
630
  }
631
  $out .= '<div class="viewer">';
632
  $out .= cdm_openlayers_image($media->representations[$active_representation_index]->parts[$active_part_index], $imageMaxExtend);
633
  $out .= '</div>';
634

    
635
  // General media metadata.
636
  $metadataToPrint = theme('cdm_media_caption', array('media' => $media, 'sources_as_content' => true));
637
  $out .= $metadataToPrint;
638

    
639
  $cdm_standard_image_viewer_settings = get_array_variable_merged(CDM_STANDARD_IMAGE_VIEWER, CDM_STANDARD_IMAGE_VIEWER_DEFAULT);
640
  if ($cdm_standard_image_viewer_settings['media_representation_details_enabled'] == 1){
641
    // Tabs for the different representations.
642
    // Representation(-part) specific metadata.
643
    $thumbnailMaxExtend = 100;
644
    $out .= '<h3>' .t('Media representations') .'</h3><ul id="media-representations">';
645
    $r_i = 0;
646
    foreach ($media->representations as $representation) {
647
      $out .= '<li><strong>'. t('Representation') . ' ' . $r_i . "</strong> ($representation->mimeType)" ;
648
      // parts
649
      $active_part_index = 0;
650
      $table_class_attribute = '';
651
      if($partIdx == $active_part_index && $active_representation_index == $r_i ){
652
        $table_class_attribute = 'class="active"';
653
      }
654
      $out .= "<table $table_class_attribute>";
655
      foreach ($representation->parts as $part) {
656
        $out .= '<tr><th>' . t('Part') . ' ' . ($active_part_index + 1) . '</th></tr><tr><td>';
657
        switch ($part->class) {
658
          case 'ImageFile':
659
            $out .= $part->width . 'x' . $part->height . ' px - ' . $part->size . ' kB';
660
            break;
661
          case 'AudioFile':
662
          case 'MovieFile':
663
            $out .= t('Duration') . ': ' . $part->duration . 's - ' . $part->size . ' kB';
664
            break;
665
          default:
666
            $out .= $part->size . 'k';
667
        }
668

    
669
        $out .= '</td><td><a href="' . url(path_to_media($media->uuid, $representation->uuid, $active_part_index)) . '">'
670
          . cdm_media_gallerie_image($part, $thumbnailMaxExtend, TRUE);
671
        $active_part_index++;
672
      }
673
      $out .= '</table>';
674
      $out .=  '</li>';
675
      $r_i++;
676
    }
677
    $out .= '</ul>';
678
  }
679

    
680
  $out .= '</div>';
681
  return $out;
682
}
683

    
684
/**
685
 * @todo Please document this function.
686
 * @see http://drupal.org/node/1354
687
 */
688
function theme_cdm_polytomousKey_page($variables) {
689
  $polytomousKey = $variables['polytomousKey'];
690
  drupal_set_title($polytomousKey->titleCache, PASS_THROUGH);
691

    
692
  $out = theme("cdm_IdentificationKey", array(
693
    'identificationKey' => $polytomousKey,
694
    'doLinkToKeyPage' => FALSE,
695
    'showIdentificationKeyTitle' => FALSE,
696
    ));
697

    
698
  // Key nodes in linked style.
699
  $out .= theme('cdm_polytomousKey', array('polytomousKey' => $polytomousKey));
700
  /*
701
   * FIXME implement node type for keys !!!
702
   * (wrapping the content in the cdm_dataportal.node becomes obsolete then).
703
   */
704
  return '<div id="identificationKey">' . $out . '</div>';
705
}
(6-6/9)