]> git.mxchange.org Git - friendica.git/commitdiff
move some html code from photos.php to photo_album.tpl
authorRabuzarus <rabuzarus@t-online.de>
Thu, 25 Dec 2014 15:20:55 +0000 (16:20 +0100)
committerRabuzarus <rabuzarus@t-online.de>
Thu, 25 Dec 2014 15:20:55 +0000 (16:20 +0100)
mod/photos.php
view/templates/photo_album.tpl

index 605f6153aedad1935e2a789aa9c19a7b21120e57..8fc26d985886e342c0e11f7171a743498ead5a64 100644 (file)
@@ -1211,25 +1211,18 @@ function photos_content(&$a) {
                else {
                        if(($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) {
                                if($can_post) {
-                                       $o .= '<div id="album-edit-link"><a href="'. $a->get_baseurl() . '/photos/' 
-                                               . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/edit' . '">' 
-                                               . t('Edit Album') . '</a></div>';
+                                       $edit = array(t('Edit Album'), $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/edit');
                                }
                        }
                }
 
                if($_GET['order'] === 'posted')
-                       $o .=  '<div class="photos-upload-link" ><a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '" >' . t('Show Newest First') . '</a></div>';
+                       $order =  array(t('Show Newest First'), $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album));
                else
-                       $o .= '<div class="photos-upload-link" ><a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '?f=&order=posted" >' . t('Show Oldest First') . '</a></div>';
+                       $order = array(t('Show Oldest First'), $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '?f=&order=posted');
 
+               $photos = array();
 
-               if($can_post) {
-                       $o .= '<div class="photos-upload-link" ><a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/upload/' . bin2hex($album) . '" >' . t('Upload New Photos') . '</a></div>';
-               }
-
-
-               $tpl = get_markup_template('photo_album.tpl');
                if(count($r))
                        $twist = 'rotright';
                        foreach($r as $rr) {
@@ -1248,19 +1241,34 @@ function photos_content(&$a) {
                                        $imgalt_e = $rr['filename'];
                                        $desc_e = $rr['desc'];
                                }
+                               
+                               $rel=("photo");
 
-                               $o .= replace_macros($tpl,array(
-                                       '$id' => $rr['id'],
-                                       '$twist' => ' ' . $twist . rand(2,4),
-                                       '$photolink' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id']
+                               $photos[] = array(
+                                       'id' => $rr['id'],
+                                       'twist' => ' ' . $twist . rand(2,4),
+                                       'link' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id']
                                                . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''),
-                                       '$phototitle' => t('View Photo'),
-                                       '$imgsrc' => $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] . '.' .$ext,
-                                       '$imgalt' => $imgalt_e,
-                                       '$desc'=> $desc_e
-                               ));
-
+                                       'rel' => $rel,
+                                       'title' => t('View Photo'),
+                                       'src' => $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] . '.' .$ext,
+                                       'alt' => $imgalt_e,
+                                       'desc'=> $desc_e,
+                                       'ext' => $ext,
+                                       'hash'=> $rr['resource_id'],
+                               );
                }
+
+               $tpl = get_markup_template('photo_album.tpl');
+               $o .= replace_macros($tpl, array(
+                               '$photos' => $photos,
+                               '$album' => $album,
+                               '$can_post' => $can_post,
+                               '$upload' => array(t('Upload New Photos'), $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/upload/' . bin2hex($album)),
+                               '$order' => $order,
+                               '$edit' => $edit
+                       ));
+
                $o .= '<div id="photo-album-end"></div>';
                $o .= paginate($a);
 
index 20162a91a2030ffd09de172f61470e8e917d559f..882070d20d225840a0a193d87f708e57868a48ce 100644 (file)
@@ -1,8 +1,19 @@
+<h3 id="photo-album-title">{{$album}}</h3>
 
+{{if $edit}}
+<div id="album-edit-link"><a href="{{$edit.1}}" title="{{$edit.0}}">{{$edit.0}}</a></div>
+{{/if}}
+<div class="photos-upload-link" ><a href="{{$order.1}}" title="{{$order.0}}">{{$order.0}}</a></div>
+{{if $can_post}}
+<div class="photos-upload-link" ><a href="{{$upload.1}}">{{$upload.0}}</a></div>
+{{/if}}
+
+{{foreach $photos as $photo}}
 <div class="photo-album-image-wrapper" id="photo-album-image-wrapper-{{$id}}">
-       <a href="{{$photolink}}" class="photo-album-photo-link" id="photo-album-photo-link-{{$id}}" title="{{$phototitle}}">
-               <img src="{{$imgsrc}}" alt="{{$imgalt}}" title="{{$phototitle}}" class="photo-album-photo lframe resize{{$twist}}" id="photo-album-photo-{{$id}}" />
-               <p class='caption'>{{$desc}}</p>                
+       <a href="{{$photo.link}}" class="photo-album-photo-link" id="photo-album-photo-link-{{$id}}" title="{{$photo.title}}">
+               <img src="{{$photo.src}}" alt="{{if $photo.album.name}}{{$photo.album.name}}{{elseif $photo.desc}}{{$photo.desc}}{{elseif $photo.alt}}{{$photo.alt}}{{else}}{{$photo.unknown}}{{/if}}" title="{{$photo.title}}" class="photo-album-photo lframe resize{{$twist}}" id="photo-album-photo-{{$id}}" />
+               <p class='caption'>{{$photo.desc}}</p>          
        </a>
 </div>
 <div class="photo-album-image-wrapper-end"></div>
+{{/foreach}}
\ No newline at end of file