Project

General

Profile

« Previous | Next » 

Revision 63d5030d

Added by Andreas Kohlbecker almost 7 years ago

fix #6818 display of media representations in the media page now optional \n also deleting useless media gallery settings ref #6822

View differences:

modules/cdm_dataportal/settings.php
374 374
define('CDM_DATAPORTAL_GALLERY_SETTINGS', serialize($gallery_settings));
375 375
define('CDM_DATAPORTAL_SPECIMEN_GALLERY_NAME', 'specimen_gallery');
376 376
define('CDM_DATAPORTAL_DESCRIPTION_GALLERY_NAME', "description_gallery");
377
define('CDM_DATAPORTAL_MEDIA_GALLERY_NAME', "media_gallery");
378 377
define('CDM_DATAPORTAL_TAXON_MEDIA_GALLERY_NAME_TAB', "taxon_tab_media_gallery");
379 378
define('CDM_DATAPORTAL_SEARCH_GALLERY_NAME', "search_gallery");
380 379
define('CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS', 'cdm_dataportal_display_taxon_relationships');
......
383 382
define('CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS_DEFAULT', 1);
384 383
define('CDM_DATAPORTAL_DISPLAY_NAME_RELATIONSHIPS_DEFAULT', 1);
385 384

  
385
define('CDM_STANDARD_IMAGE_VIEWER', "cdm_standard_image_viewer");
386
define('CDM_STANDARD_IMAGE_VIEWER_DEFAULT', serialize(array(
387
  'media_representation_details_enabled' => 0
388
)));
389

  
386 390
/**
387 391
 * The drupal variable key for the array containing the uuids of the taxon relationship types to display in
388 392
 * the snonymy.
......
1832 1836
    '#description' => t('Select the size of each individual thumbnail.'),
1833 1837
  );
1834 1838

  
1835
  if ($form_name != CDM_DATAPORTAL_MEDIA_GALLERY_NAME) {
1836
    $form[$form_name]['cdm_dataportal_media_cols'] = array(
1837
      '#type' => 'textfield',
1838
      '#title' => t('Number of columns') . ':',
1839
      '#default_value' => $gallery_settings['cdm_dataportal_media_cols'],
1840
      '#description' => t('Group the thumbnails in columns: select how many
1841
        columns the gallery should display.'),
1842
    );
1843
  }
1839
  $form[$form_name]['cdm_dataportal_media_cols'] = array(
1840
    '#type' => 'textfield',
1841
    '#title' => t('Number of columns') . ':',
1842
    '#default_value' => $gallery_settings['cdm_dataportal_media_cols'],
1843
    '#description' => t('Group the thumbnails in columns: select how many
1844
      columns the gallery should display.'),
1845
  );
1844 1846

  
1845 1847
  if ($form_name == CDM_DATAPORTAL_SEARCH_GALLERY_NAME) {
1846 1848
    $form[$form_name]['cdm_dataportal_media_maxRows'] = array(
......
2736 2738
    ),
2737 2739
  );
2738 2740

  
2739
  // --- MEDIA GALLERY ---- //
2740
  $form_name = CDM_DATAPORTAL_MEDIA_GALLERY_NAME;
2741
  $form_title = 'Standard viewer';
2742
  $form_description = '<p>Configure the standard image viewer.</p><p><strong>Note:</strong> the image viewer should selected otherwise settings are not taking into account.</p>';
2743
  // $form[] = cdm_dataportal_create_gallery_settings_form($form_name, $form_title, $collapsed);
2744
  $form['media_settings'][] = cdm_dataportal_create_gallery_settings_form($form_name, $form_title, FALSE, $form_description);
2741
  // --- STANDARD_IMAGE_VIEWER ---- //
2742
  if(variable_get('image_gallery_viewer', 'default') == 'default') {
2743
    $form['media_settings'][CDM_STANDARD_IMAGE_VIEWER] = array(
2744
      '#type' => 'fieldset',
2745
      '#tree' => true,
2746
      '#title' => t('Standard image viewer settings'),
2747
      '#collapsible' => FALSE,
2748
      '#collapsed' => FALSE,
2749
      );
2750

  
2751
    $cdm_standard_image_viewer_settings = get_array_variable_merged(CDM_STANDARD_IMAGE_VIEWER, CDM_STANDARD_IMAGE_VIEWER_DEFAULT);
2752
    $form['media_settings'][CDM_STANDARD_IMAGE_VIEWER]['media_representation_details_enabled'] = array (
2753
      '#type' => 'checkbox',
2754
      '#title' => 'Show media representations',
2755
      '#default_value' => $cdm_standard_image_viewer_settings['media_representation_details_enabled']
2756

  
2757
    );
2758
  }
2759

  
2745 2760

  
2746 2761
  // @WA: D7 form api does not support reset buttons,
2747 2762
  // so to mimic the D5 reset button we add one like this.
modules/cdm_dataportal/theme/cdm_dataportal.page.theme
634 634
  $metadataToPrint = theme('cdm_media_caption', array('media' => $media, 'sources_as_content' => true));
635 635
  $out .= $metadataToPrint;
636 636

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

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

  
675 677

  
676 678
  $out .= '</div>';
677 679
  return $out;

Also available in: Unified diff