556 |
556 |
* @see http://drupal.org/node/1354
|
557 |
557 |
*/
|
558 |
558 |
function theme_cdm_media_page($variables) {
|
|
559 |
|
559 |
560 |
$media = $variables['media'];
|
560 |
561 |
$mediarepresentation_uuid = $variables['mediarepresentation_uuid'];
|
561 |
562 |
$partId = $variables['partId'];
|
... | ... | |
563 |
564 |
// Determine which representation and which part to show.
|
564 |
565 |
$representationIdx = 0;
|
565 |
566 |
if ($mediarepresentation_uuid) {
|
566 |
|
$i = 0;
|
|
567 |
$p_i = 0;
|
567 |
568 |
foreach ($media->representations as $representation) {
|
568 |
569 |
if ($representation->uuid == $mediarepresentation_uuid) {
|
569 |
|
$representationIdx = $i;
|
|
570 |
$representationIdx = $p_i;
|
570 |
571 |
}
|
571 |
|
$i++;
|
|
572 |
$p_i++;
|
572 |
573 |
}
|
573 |
574 |
}
|
574 |
|
else {
|
575 |
|
$mediarepresentation_uuid = $media->representations[0]->uuid;
|
576 |
|
}
|
577 |
575 |
|
578 |
576 |
$partIdx = 0;
|
579 |
577 |
if (!is_numeric($partId)) {
|
580 |
578 |
// Assuming it is an uuid.
|
581 |
|
$i = 0;
|
|
579 |
$p_i = 0;
|
582 |
580 |
foreach ($media->representations[$representationIdx]->parts as $part) {
|
583 |
581 |
if ($part->uuid == $partId) {
|
584 |
|
$partIdx = $i;
|
|
582 |
$partIdx = $p_i;
|
585 |
583 |
}
|
586 |
|
$i++;
|
|
584 |
$p_i++;
|
587 |
585 |
}
|
588 |
586 |
}
|
589 |
587 |
else {
|
... | ... | |
622 |
620 |
$out .= $metadataToPrint;
|
623 |
621 |
|
624 |
622 |
// Tabs for the different representations.
|
625 |
|
// ul.secondary
|
626 |
|
$out .= '<ul class="primary">';
|
627 |
|
foreach ($media->representations as $representation) {
|
628 |
|
$out .= '<li>' . l($media->representations[$representationIdx]->mimeType, path_to_media($media->uuid, $mediarepresentation_uuid, $partIdx)) . '</li>';
|
629 |
|
}
|
630 |
|
$out .= '</ul>';
|
631 |
|
|
632 |
623 |
// Representation(-part) specific metadata.
|
633 |
624 |
$thumbnailMaxExtend = 100;
|
634 |
|
$out .= '<table>';
|
635 |
|
$i = 0;
|
636 |
|
foreach ($media->representations[$representationIdx]->parts as $part) {
|
637 |
|
$out .= '<tr><th>' . t('Part') . ' ' . ($i + 1) . '</th><td>';
|
638 |
|
switch ($part->class) {
|
639 |
|
case 'ImageFile':
|
640 |
|
$out .= $part->width . ' x ' . $part->height . ' - ' . $part->size . 'k';
|
641 |
|
break;
|
642 |
|
case 'AudioFile':
|
643 |
|
case 'MovieFile':
|
644 |
|
$out .= t('Duration') . ': ' . $part->duration . 's - ' . $part->size . 'k';
|
645 |
|
break;
|
646 |
|
default:
|
647 |
|
$out .= $part->size . 'k';
|
|
625 |
$out .= '<h3>' .t('Media representations') .'</h3><ul id="media-representations">';
|
|
626 |
$r_i = 0;
|
|
627 |
foreach ($media->representations as $representation) {
|
|
628 |
$out .= '<li><strong>'. t('Representation') . ' ' . $r_i . "</strong> ($representation->mimeType)" ;
|
|
629 |
// parts
|
|
630 |
$p_i = 0;
|
|
631 |
$table_class_attribute = '';
|
|
632 |
if($partIdx == $p_i && $representationIdx == $r_i ){
|
|
633 |
$table_class_attribute = 'class="active"';
|
648 |
634 |
}
|
|
635 |
$out .= "<table $table_class_attribute>";
|
|
636 |
foreach ($representation->parts as $part) {
|
|
637 |
$out .= '<tr><th>' . t('Part') . ' ' . ($p_i + 1) . '</th></tr><tr><td>';
|
|
638 |
switch ($part->class) {
|
|
639 |
case 'ImageFile':
|
|
640 |
$out .= $part->width . 'x' . $part->height . ' px - ' . $part->size . ' kB';
|
|
641 |
break;
|
|
642 |
case 'AudioFile':
|
|
643 |
case 'MovieFile':
|
|
644 |
$out .= t('Duration') . ': ' . $part->duration . 's - ' . $part->size . ' kB';
|
|
645 |
break;
|
|
646 |
default:
|
|
647 |
$out .= $part->size . 'k';
|
|
648 |
}
|
649 |
649 |
|
650 |
|
$out .= '</td><td><a href="' . url(path_to_media($media->uuid, $mediarepresentation_uuid, $i)) . '">' . theme('cdm_media_gallerie_image', array('mediaRepresentationPart' => $part, 'maxExtend' => $thumbnailMaxExtend, 'addPassePartout' => TRUE));
|
651 |
|
$i++;
|
|
650 |
$out .= '</td><td><a href="' . url(path_to_media($media->uuid, $representation->uuid, $p_i)) . '">'
|
|
651 |
. theme('cdm_media_gallerie_image', array('mediaRepresentationPart' => $part, 'maxExtend' => $thumbnailMaxExtend, 'addPassePartout' => TRUE));
|
|
652 |
$p_i++;
|
|
653 |
}
|
|
654 |
$out .= '</table>';
|
|
655 |
$out .= '</li>';
|
|
656 |
$r_i++;
|
652 |
657 |
}
|
653 |
|
$out .= '</table>';
|
654 |
|
$out .= '</div>';
|
|
658 |
$out .= '</ul>';
|
|
659 |
|
655 |
660 |
|
|
661 |
$out .= '</div>';
|
656 |
662 |
return $out;
|
657 |
663 |
}
|
658 |
664 |
|
fix #6259 solving multiple problems in the media page related to representations and parts