Project

General

Profile

« Previous | Next » 

Revision afc363df

Added by Andreas Kohlbecker over 11 years ago

fixing #2519 (Make DescriptionElement Media visible in Data Portal)

View differences:

modules/cdm_dataportal/cdm_api/cdm_api.module
1020 1020
            $treeRepresentation = $featureTree->titleCache;
1021 1021

  
1022 1022
            if(is_array($featureTree->root->children) && count($featureTree->root->children) > 0){
1023

  
1024
              // render the hierarchic tree structure
1023 1025
              $treeDetails = '<div class="featuretree_structure">'
1024 1026
                //._featureTree_elements_toString($featureTree->root)
1025 1027
                .theme('featureTree_hierarchy', $featureTree->uuid)
1026 1028
                .'</div>';
1029

  
1027 1030
              $form = array();
1028 1031
              $form['featureTree-'.$featureTree->uuid] = array(
1029 1032
                  '#type' => 'fieldset',
modules/cdm_dataportal/cdm_dataportal.module
1435 1435
		foreach($descriptionElements as $descriptionElement){
1436 1436
			if(is_array($descriptionElement->media)){
1437 1437
				foreach($descriptionElement->media as $media){
1438
					if(isset($media)){
1438
					if(is_object($media)){
1439 1439
						$outArrayOfMedia[] = $media;
1440 1440
					}
1441 1441
				}
modules/cdm_dataportal/theme/cdm_dataportal.descriptions.theme
93 93
  RenderHints::pushToRenderStack('feature_nodes');
94 94
  $gallery_settings = getGallerySettings(CDM_DATAPORTAL_DESCRIPTION_GALLERY_NAME);
95 95

  
96
  foreach($mergedFeatureNodes as $node){
96
  $media_list = array();
97 97

  
98
      var_dump($node->feature->representation_L10n);
98
  foreach($mergedFeatureNodes as $node){
99 99

  
100 100
    // process $descriptionElements with content only
101 101
    if(is_array($node->descriptionElements) && count($node->descriptionElements) > 0 || count($node->children) > 0){
......
103 103
      $block->module = 'cdm_dataportal';
104 104

  
105 105
      if($node->feature->uuid != UUID_IMAGE){
106

  
106 107
        $block->delta = generalizeString($featureRepresentation);
107 108
        $block->subject = theme('cdm_feature_name', $featureRepresentation);
108 109
        $block->module = "cdm_dataportal-feature";
109 110
        $block->content = '';
110 111

  
112
        /*
113
         * Content/DISTRIBUTION
114
         */
111 115
        if($node->feature->uuid == UUID_DISTRIBUTION){
112 116

  
113 117
          if(variable_get(DISTRIBUTION_TEXTDATA_DISPLAY_ON_TOP, 0)){
......
130 134
          $block->content .= theme('cdm_distribution_map', $taxon);
131 135
        }
132 136

  
133
        //get the text for the feature block
134
        if ($node->feature->uuid == UUID_COMMON_NAME){
137
        /*
138
         * Content/COMMON_NAME
139
         */
140
        else if ($node->feature->uuid == UUID_COMMON_NAME){
135 141
          $block->content .= theme('cdm_common_names', $node->descriptionElements);
136 142
        /*
137 143
        }else if($node->feature->uuid == UUID_IMAGE_SOURCES) {
138 144
          $block->content .= theme('cdm_image_sources', $node->descriptionElements);
139 145
        */
140
        } else {
146
        }
147

  
148
        /*
149
         * Content/ALL OTHER FEATURES
150
         */
151
        else {
141 152
          $block->content .= theme('cdm_descriptionElements', $node->descriptionElements, $node->feature->uuid, $taxon->uuid);
153

  
154
          /*
155
           *  Content/ALL OTHER FEATURES/Subordinate Features
156
           *
157
           *  subordinate features are printed inline in one floating text,
158
           *  it is expected that supordinate features only "contain" TextData elements
159
           */
160
          // TODO move into own theme
161
          if(count($node->children) > 0){
162

  
163
            //TODO support more than one level of childen http://dev.e-taxonomy.eu/trac/ticket/2393
164
            $text = '';
165
            foreach ($node->children as $child){
166

  
167
             if (is_array($child->descriptionElements)){
168
               foreach ($child->descriptionElements as $element) {
169

  
170
                 if(is_array($element->media)){
171
                   // append media of supordinate emelents to list of main feature
172
                   $media_list = array_merge($media_list, $element->media);
173
                 }
174

  
175
                 $description = str_replace("\n", "<br/>", $element->multilanguageText_L10n->text);
176
                //TODO use localized version of feature name, the locale must match the locale of the multilanguage text (http://dev.e-taxonomy.eu/trac/ticket/2394)
177
                 $description = str_replace($element->feature->titleCache, '<em>' . $element->feature->titleCache . '</em>', $description);
178
               }
179
               $text .= " " . $description;
180
               $description = '';
181
             }
182

  
183
            }
184
            $block->content .= $text;
185
          }
186

  
142 187
        }
143 188

  
144
        // get media for the feature block
145
        $media_list = cdm_dataportal_media_from_descriptionElements($node->descriptionElements);
189
        /*
190
         * Media/ALL FEATURES
191
         */
192
        $media_list = array_merge($media_list, cdm_dataportal_media_from_descriptionElements($node->descriptionElements));
146 193
        $captionElements = array('title', 'rights');
147 194

  
148 195
        $gallery = theme('cdm_media_gallerie', $media_list, CDM_DATAPORTAL_DESCRIPTION_GALLERY_NAME.'_'.$node->feature->uuid,
......
162 209

  
163 210
      }
164 211
    }
165
    // theme
166
    if(count($node->children) > 0){
167
      //TODO support more than one level of childen http://dev.e-taxonomy.eu/trac/ticket/2393
168
      $text = '';
169
      foreach ($node->children as $child){
170
       //$out .= theme('cdm_descriptionElementTextData', $child->descriptionElements[0], false);
171
       if (is_array($child->descriptionElements)){//if condition added to avoid warnings
172
         foreach ($child->descriptionElements as $element) {
173
           $description = str_replace("\n", "<br/>", $element->multilanguageText_L10n->text);
174
          //TODO use localized version of feature name, the locale must match the locale of the multilanguage text (http://dev.e-taxonomy.eu/trac/ticket/2394)
175
           $description = str_replace($element->feature->titleCache, '<em>' . $element->feature->titleCache . '</em>', $description);
176
         }
177
         $text .= " " . $description;
178
         $description = '';
179
       }
180
      }
181
      $out .= $text;
182
    }
183 212

  
184 213
  }
185 214
  RenderHints::popFromRenderStack();
modules/cdm_dataportal/theme/cdm_dataportal.media.theme
224 224
function theme_cdm_media_gallerie(
225 225
	$mediaList,
226 226
    $galleryName,
227
	$maxExtend = 150, 
228
	$cols = 4, 
229
	$maxRows = false, 
227
	$maxExtend = 150,
228
	$cols = 4,
229
	$maxRows = false,
230 230
	$captionElements = array('title'),
231
	$mediaLinkType = 'LIGHTBOX', 
232
	$alternativeMediaUri = null, 
231
	$mediaLinkType = 'LIGHTBOX',
232
	$alternativeMediaUri = null,
233 233
	$galleryLinkUri = null,
234 234
	$showCaption = true){
235 235

  
......
303 303

  
304 304
				_add_js_ahah();
305 305
				$content_url = cdm_compose_url(CDM_WS_PORTAL_MEDIA, $media->uuid);
306
				
306

  
307 307
				$cdm_proxy_url = url('cdm_api/proxy/'.urlencode($content_url)."/cdm_media_caption/".serialize($captionElements));
308 308
				$captionPartHtml = '<div class="ahah-content" rel="'.$cdm_proxy_url.'"><span class="loading" style="display: none;">Loading ....</span></div>';
309 309

  
modules/cdm_dataportal/theme/cdm_dataportal.page.theme
283 283
          $captionElements = array('#uri'=>t('open media'));
284 284
          $gallery_html = theme(
285 285
              'cdm_media_gallerie',
286
          $mediaList,
287
          $gallery_name ,
288
          $gallery_settings['cdm_dataportal_media_maxextend'],
289
          $gallery_settings['cdm_dataportal_media_cols'],
290
          $gallery_settings['cdm_dataportal_media_maxRows'],
291
          $captionElements, 'LIGHTBOX', null, null);
286
              $mediaList,
287
              $gallery_name ,
288
              $gallery_settings['cdm_dataportal_media_maxextend'],
289
              $gallery_settings['cdm_dataportal_media_cols'],
290
              $gallery_settings['cdm_dataportal_media_maxRows'],
291
              $captionElements, 'LIGHTBOX', null, null);
292 292
        } else {
293 293
          $gallery_html = '';
294 294
        }

Also available in: Unified diff