506 |
506 |
|
507 |
507 |
}
|
508 |
508 |
|
509 |
|
function theme_cdm_media_page($media){
|
|
509 |
function theme_cdm_media_page($media, $mediarepresentation_uuid = false, $partId = false){
|
510 |
510 |
$out = '';
|
511 |
511 |
|
|
512 |
|
|
513 |
// determine which reprresentation and which part to show
|
|
514 |
$representationIdx = 0;
|
|
515 |
if($mediarepresentation_uuid){
|
|
516 |
$i = 0;
|
|
517 |
foreach($media->representations as $representation) {
|
|
518 |
if($representation->uuid == $mediarepresentation_uuid){
|
|
519 |
$representationIdx = $i;
|
|
520 |
}
|
|
521 |
$i++;
|
|
522 |
}
|
|
523 |
} else {
|
|
524 |
$mediarepresentation_uuid = $media->representations[0]->uuid;
|
|
525 |
}
|
|
526 |
|
|
527 |
$partIdx = 0;
|
|
528 |
if(!is_numeric($partId)){
|
|
529 |
// assuming it is an uuid
|
|
530 |
$i = 0;
|
|
531 |
foreach($media->representations[$representationIdx]->parts as $part) {
|
|
532 |
if($part->uuid == $partId){
|
|
533 |
$partIdx = $i;
|
|
534 |
}
|
|
535 |
$i++;
|
|
536 |
}
|
|
537 |
} else {
|
|
538 |
// assuming it is an index
|
|
539 |
$partIdx = $partId;
|
|
540 |
}
|
|
541 |
|
|
542 |
|
512 |
543 |
$title = $media->title_L10n;
|
513 |
544 |
|
514 |
545 |
$imageMaxExtend = variable_get('image-page-maxextend', 400);
|
... | ... | |
516 |
547 |
if(!$title){
|
517 |
548 |
$title = 'Media '.$media->uuid.'';
|
518 |
549 |
}
|
519 |
|
|
520 |
|
//choose representation
|
521 |
|
$representation = $media->representations[0];
|
522 |
550 |
|
523 |
551 |
drupal_set_title($title);
|
524 |
|
//TODO show image in openlayers viewer
|
525 |
552 |
|
|
553 |
|
526 |
554 |
$out .= '<div class="media">';
|
527 |
555 |
|
528 |
556 |
$out .= '<div class="viewer">';
|
529 |
|
//$out .= theme('cdm_media_gallerie_image', $representation->parts[0], $imageMaxExtend);
|
530 |
|
$out .= theme('cdm_openlayers_image', $representation->parts[0], $imageMaxExtend);
|
|
557 |
//$out .= theme('cdm_media_gallerie_image', $representation->parts[$partIdx], $imageMaxExtend);
|
|
558 |
$out .= theme('cdm_openlayers_image', $media->representations[$representationIdx]->parts[$partIdx], $imageMaxExtend);
|
531 |
559 |
$out .= '</div>';
|
532 |
560 |
|
533 |
|
|
534 |
561 |
// general media metadata
|
535 |
562 |
$out .= '<h4 class="title">'.$media->title_L10n.'</h4>';
|
536 |
563 |
$out .= '<div class="description">'.$media->description_L10n.'</div>';
|
... | ... | |
539 |
566 |
foreach($media->rights as $right){
|
540 |
567 |
$out .= '<li>'.theme('cdm_right', $right).'</li>';
|
541 |
568 |
}
|
542 |
|
$out .= '</div>';
|
543 |
|
|
|
569 |
$out .= '</ul>';
|
|
570 |
|
|
571 |
//tabs for the different representations
|
|
572 |
//ul.secondary
|
|
573 |
$out .= '<ul class="primary">';
|
|
574 |
foreach($media->representations as $representation){
|
|
575 |
$out .= '<li>'.l($media->representations[$representationIdx]->mimeType, path_to_media($media->uuid, $mediarepresentation_uuid, $partIdx)).'</li>';
|
|
576 |
}
|
|
577 |
$out .= '</ul>';
|
|
578 |
|
544 |
579 |
// representation(-part) specific metadata
|
545 |
580 |
$thumbnailMaxExtend = 100;
|
546 |
581 |
$out .= '<table>';
|
547 |
|
$out .= '<tr><th colspan="3">'.t('MimeType').': '.$representation->mimeType.'</th></tr>';
|
548 |
|
$i = 1;
|
549 |
|
foreach($representation->parts as $part){
|
550 |
|
$out .= '<tr><th>'.t('Part').' '.$i++.'</th><td>';
|
|
582 |
//$out .= '<tr><th colspan="3">'.t('MimeType').': '.$media->representations[$representationIdx]->mimeType.'</th></tr>';
|
|
583 |
$i = 0;
|
|
584 |
foreach($media->representations[$representationIdx]->parts as $part){
|
|
585 |
$out .= '<tr><th>'.t('Part').' '.($i + 1).'</th><td>';
|
551 |
586 |
switch($part->class){
|
552 |
587 |
case 'ImageFile': $out .= $part->width.' x '.$part->height.' - '.$part->size.'k'; break;
|
553 |
588 |
case 'AudioFile':
|
554 |
589 |
case 'MovieFile': $out .= t('Duration').': '.$part->duration.'s - '.$part->size.'k'; break;
|
555 |
590 |
default: $out .= $part->size.'k';
|
556 |
591 |
}
|
557 |
|
$out .= '</td><td>'.theme('cdm_media_gallerie_image', $part, $thumbnailMaxExtend, true);'</td><tr>';
|
|
592 |
$out .= '</td><td><a href="'.url(path_to_media($media->uuid, $mediarepresentation_uuid, $i)).'">'.theme('cdm_media_gallerie_image', $part, $thumbnailMaxExtend, true);'</a></td><tr>';
|
|
593 |
$i++;
|
558 |
594 |
}
|
559 |
595 |
$out .= '</table>';
|
560 |
596 |
$out .= '</div>';
|
... | ... | |
641 |
677 |
drupal_add_js('
|
642 |
678 |
var map;
|
643 |
679 |
|
|
680 |
var layerOptions = {
|
|
681 |
maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90),
|
|
682 |
isBaseLayer: false,
|
|
683 |
displayInLayerSwitcher: false
|
|
684 |
};
|
|
685 |
|
644 |
686 |
var tdwg_1 = new OpenLayers.Layer.WMS.Untiled(
|
645 |
687 |
"tdwg level 1",
|
646 |
688 |
"http://edit.csic.es/geoserver/wms",
|
647 |
|
{layers:"topp:tdwg_level_1",transparent:"true"},
|
648 |
|
{styles:\'\'},
|
649 |
|
{group:\'no base\'},
|
650 |
|
{\'displayInLayerSwitcher\':false},
|
651 |
|
{format: \'image/png\'}
|
|
689 |
{layers:"topp:tdwg_level_1",transparent:"true", format:"image/png"},
|
|
690 |
layerOptions
|
652 |
691 |
);
|
653 |
692 |
|
654 |
693 |
var tdwg_2 = new OpenLayers.Layer.WMS.Untiled(
|
655 |
694 |
"tdwg level 2",
|
656 |
695 |
"http://edit.csic.es/geoserver/wms",
|
657 |
|
{layers:"topp:tdwg_level_2",transparent:"true"},
|
658 |
|
{styles:\'\'},
|
659 |
|
{group:\'no base\'},
|
660 |
|
{\'displayInLayerSwitcher\':false},
|
661 |
|
{format: \'image/png\'}
|
|
696 |
{layers:"topp:tdwg_level_2",transparent:"true", format:"image/png"},
|
|
697 |
layerOptions
|
662 |
698 |
);
|
663 |
699 |
|
664 |
700 |
var tdwg_3 = new OpenLayers.Layer.WMS.Untiled(
|
665 |
701 |
"tdwg level 3",
|
666 |
702 |
"http://edit.csic.es/geoserver/wms",
|
667 |
|
{layers:"topp:tdwg_level_3",transparent:"true"},
|
668 |
|
{styles:\'\'},
|
669 |
|
{group:\'no base\'},
|
670 |
|
{\'displayInLayerSwitcher\':false},
|
671 |
|
{format: \'image/png\'}
|
|
703 |
{layers:"topp:tdwg_level_3", transparent:"true", format:"image/png"},
|
|
704 |
layerOptions
|
672 |
705 |
);
|
673 |
706 |
|
674 |
707 |
var tdwg_4 = new OpenLayers.Layer.WMS.Untiled(
|
675 |
708 |
"tdwg level 4",
|
676 |
709 |
"http://edit.csic.es/geoserver/wms",
|
677 |
|
{layers:"topp:tdwg_level_4",transparent:"true"},
|
678 |
|
{styles:\'\'},
|
679 |
|
{group:\'no base\'},
|
680 |
|
{\'displayInLayerSwitcher\':false},
|
681 |
|
{format: \'image/png\'}
|
|
710 |
{layers:"topp:tdwg_level_4",transparent:"true", format:"image/png"},
|
|
711 |
layerOptions
|
682 |
712 |
);
|
|
713 |
|
|
714 |
// make baselayer
|
|
715 |
layerOptions[\'isBaseLayer\'] = true;
|
683 |
716 |
|
684 |
717 |
var ol_wms = new OpenLayers.Layer.WMS(
|
685 |
718 |
"OpenLayers WMS",
|
686 |
719 |
"http://labs.metacarta.com/wms/vmap0",
|
687 |
720 |
{layers: \'basic\'},
|
688 |
|
{group:\'base\'},
|
689 |
|
{\'displayInLayerSwitcher\':false}
|
|
721 |
layerOptions
|
690 |
722 |
);
|
691 |
723 |
|
692 |
724 |
|
693 |
|
// --- google layers ----
|
694 |
|
// var gphy = new OpenLayers.Layer.Google(
|
695 |
|
// "Google Physical",
|
696 |
|
// {type: G_PHYSICAL_MAP}
|
697 |
|
// );
|
698 |
|
// var gmap = new OpenLayers.Layer.Google(
|
699 |
|
// "Google Streets", // the default
|
700 |
|
// {numZoomLevels: 20}
|
701 |
|
// );
|
702 |
|
// var ghyb = new OpenLayers.Layer.Google(
|
703 |
|
// "Google Hybrid",
|
704 |
|
// {type: G_HYBRID_MAP, numZoomLevels: 20}
|
705 |
|
// );
|
706 |
|
// var gsat = new OpenLayers.Layer.Google(
|
707 |
|
// "Google Satellite",
|
708 |
|
// {type: G_SATELLITE_MAP, numZoomLevels: 20}
|
709 |
|
// );
|
710 |
|
|
711 |
|
|
712 |
|
|
713 |
725 |
// ------------------------------
|
714 |
726 |
|
715 |
727 |
|
716 |
728 |
function init() {
|
717 |
|
var options={
|
|
729 |
|
|
730 |
var mapOptions={
|
718 |
731 |
// controls break openlayers in IE8 !!!!!!!!!!!!!!
|
719 |
732 |
// controls:
|
720 |
733 |
// [
|
... | ... | |
725 |
738 |
// //new OpenLayers.Control.MousePosition(),
|
726 |
739 |
// //new OpenLayers.Control.KeyboardDefaults()
|
727 |
740 |
// ],
|
728 |
|
numZoomLevels: 6,
|
|
741 |
maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90),
|
|
742 |
maxResolution: '.(360 / $display_width).',
|
|
743 |
restrictedExtent: new OpenLayers.Bounds(-180, -90, 180, 90),
|
729 |
744 |
projection: new OpenLayers.Projection("EPSG:4326")
|
730 |
745 |
};
|
731 |
|
map = new OpenLayers.Map(\'openlayers_map\');
|
|
746 |
|
|
747 |
|
|
748 |
map = new OpenLayers.Map(\'openlayers_map\', mapOptions);
|
732 |
749 |
map.addLayers([ol_wms]);
|
733 |
|
// map.addLayers([gphy]);
|
734 |
|
// '.$add_tdwg1.'
|
735 |
|
// '.$add_tdwg2.'
|
736 |
|
// '.$add_tdwg3.'
|
737 |
|
// '.$add_tdwg4.'
|
738 |
|
map.setCenter(new OpenLayers.LonLat(0, 0), 1);
|
|
750 |
'.$add_tdwg1.'
|
|
751 |
'.$add_tdwg2.'
|
|
752 |
'.$add_tdwg3.'
|
|
753 |
'.$add_tdwg4.'
|
|
754 |
map.zoomToMaxExtent();
|
|
755 |
|
739 |
756 |
}
|
740 |
757 |
|
741 |
758 |
$(document).ready(function(){
|
... | ... | |
1009 |
1026 |
default :
|
1010 |
1027 |
$relsign = '–';
|
1011 |
1028 |
}
|
|
1029 |
|
|
1030 |
$renderPath = 'related_taxon';
|
1012 |
1031 |
|
1013 |
1032 |
//$taxonUri = url(path_to_taxon($taxon->uuid));
|
1014 |
1033 |
if($taxon->name->nomenclaturalReference){
|
1015 |
1034 |
$referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
|
1016 |
1035 |
}
|
1017 |
|
$nameHtml = theme('cdm_taxonname', $taxon->name, $taxonUri, $referenceUri);
|
|
1036 |
$nameHtml = theme('cdm_taxonName', $taxon->name, $taxonUri, $referenceUri, $renderPath);
|
1018 |
1037 |
|
1019 |
1038 |
$out = '<span class="relation_sign">'.$relsign.'</span>'.$name_prefix . $nameHtml . $name_postfix;
|
1020 |
1039 |
return $out;
|
... | ... | |
2049 |
2068 |
}
|
2050 |
2069 |
|
2051 |
2070 |
function theme_cdm_search_results($pager, $path, $parameters){
|
|
2071 |
|
|
2072 |
|
|
2073 |
$showThumbnails = $_SESSION['pageoptions']['searchtaxa']['showThumbnails'];
|
|
2074 |
if( !is_numeric($showThumbnails)){
|
|
2075 |
$showThumbnails = 1;
|
|
2076 |
}
|
|
2077 |
$setSessionUri = url('cdm_api/setvalue/session').'/pageoptions|searchtaxa|showThumbnails/';
|
|
2078 |
drupal_add_js('$(document).ready(function() {
|
|
2079 |
|
|
2080 |
// init
|
|
2081 |
if('.$showThumbnails.' == 1){
|
|
2082 |
$(\'.media_gallery\').show(20);
|
|
2083 |
} else {
|
|
2084 |
$(\'.media_gallery\').hide(20);
|
|
2085 |
}
|
|
2086 |
// add change hander
|
|
2087 |
$(\'#showThumbnails\').change(
|
|
2088 |
function(event){
|
|
2089 |
var state = 0;
|
|
2090 |
if($(this).is(\':checked\')){
|
|
2091 |
$(\'.media_gallery\').show(20);
|
|
2092 |
state = 1;
|
|
2093 |
} else {
|
|
2094 |
$(\'.media_gallery\').hide(20);
|
|
2095 |
}
|
|
2096 |
// store state in session variable
|
|
2097 |
var uri = \''.$setSessionUri.'\' + state;
|
|
2098 |
jQuery.get(uri);
|
|
2099 |
});
|
|
2100 |
});', "inline");
|
2052 |
2101 |
|
2053 |
2102 |
drupal_set_title(t('Search Results'));
|
2054 |
2103 |
|
2055 |
2104 |
$out = ''; //l('Advanced Search', '/cdm_dataportal/search');
|
|
2105 |
|
|
2106 |
$out = '<div class="page_options"><form name="pageoptions"><input id="showThumbnails" type="checkbox" name="showThumbnails" '.($showThumbnails == 1? 'checked="checked"': '').'> '.t('Show Thumbnails').'</form></div>';
|
2056 |
2107 |
if(count($pager->records) > 0){
|
2057 |
2108 |
$out .= theme('cdm_list_of_taxa', $pager->records);
|
2058 |
2109 |
$out .= theme('cdm_pager', $pager, $path, $parameters);
|
bugfixes