[pLog-svn] r1341 - in plugins/trunk/flickr: . install/templates locale

mark at devel.plogworld.net mark at devel.plogworld.net
Mon Mar 7 11:18:41 GMT 2005


Author: mark
Date: 2005-03-07 11:18:40 +0000 (Mon, 07 Mar 2005)
New Revision: 1341

Modified:
   plugins/trunk/flickr/install/templates/flickr.template
   plugins/trunk/flickr/locale/locale_en_UK.php
   plugins/trunk/flickr/locale/locale_zh_TW.php
   plugins/trunk/flickr/pluginflickr.class.php
   plugins/trunk/flickr/readme.txt
Log:
Upgrade to 1.1.1. Add a navigation bar to flickr plugin.

Modified: plugins/trunk/flickr/install/templates/flickr.template
===================================================================
--- plugins/trunk/flickr/install/templates/flickr.template	2005-03-07 03:17:06 UTC (rev 1340)
+++ plugins/trunk/flickr/install/templates/flickr.template	2005-03-07 11:18:40 UTC (rev 1341)
@@ -35,11 +35,16 @@
      padding: 5px 0; 
     } 
       
-    .flickr-nav { 
+    .flickr-album-nav { 
      clear: both; 
      text-align: left; 
-    } 
+    }
 
+    .flickr-photo-nav { 
+     clear: both; 
+     text-align: center; 
+    }    
+
     .flickr-slideshow { 
      clear: both; 
      text-align: right; 
@@ -83,9 +88,11 @@
   {assign var=photoId value=$smarty.request.photo}
   {assign var=secretId value=$smarty.request.secret}
   {if $albumId != '' && $photoId != '' && $secretId != ''}
-   <div class="flickr-nav"><a href="{$flickr->pluginTemplatePage()}">{$locale->tr("flickr")}</a>  &raquo; <a href="{$flickr->getAlbumUrl($albumId)}">{$locale->tr("flickr_album_id")} {$albumId}</a>  &raquo; <b>{$locale->tr("flickr_photo_id")} {$photoId}</b></div>
+   <div class="flickr-album-nav"><a href="{$flickr->pluginTemplatePage()}">{$locale->tr("flickr")}</a>  &raquo; <a href="{$flickr->getAlbumUrl($albumId)}">{$locale->tr("flickr_album_id")} {$albumId}</a>  &raquo; <b>{$locale->tr("flickr_photo_id")} {$photoId}</b></div>
    {assign var=flickrPhotoInfo value=$flickr->getPhotoInfo($photoId,$secretId)}
    <h3 class="flickr-title">{$locale->tr("flickr_photo_title")} {$flickrPhotoInfo.title}</h3>
+   {assign var=photoNavigation value=$flickr->getPhotoNavigation($albumId,$photoId)}
+   <div class="flickr-photo-nav">{if $photoNavigation.prevPhotoUrl != ''}<a href="{$photoNavigation.prevPhotoUrl}">&laquo;{$locale->tr("flickr_prev_photo")}</a>{/if} | {if $photoNavigation.nextPhotoUrl != ''}<a href="{$photoNavigation.nextPhotoUrl}">{$locale->tr("flickr_next_photo")}&raquo;</a>{/if}</div>
    <a href="{$flickrPhotoInfo.originalimageUrl}"><img class="annotated flickr-photo" src="{$flickrPhotoInfo.resizeimageUrl}" alt="" usemap="imgmap" /></a><br />
    {assign var=flickrNotes value=$flickrPhotoInfo.notes}
    <map id="imgmap">

Modified: plugins/trunk/flickr/locale/locale_en_UK.php
===================================================================
--- plugins/trunk/flickr/locale/locale_en_UK.php	2005-03-07 03:17:06 UTC (rev 1340)
+++ plugins/trunk/flickr/locale/locale_en_UK.php	2005-03-07 11:18:40 UTC (rev 1341)
@@ -47,4 +47,6 @@
 $messages["flickr_photo_url"] = "Flickr Url:";
 $messages["flickr_photo_see_url"] = "See this photo on Flickr.";
 $messages["flickr_view_as_slideshow"] = "View as Slide Show";
+$messages["flickr_prev_photo"] = "Previous Photo";
+$messages["flickr_next_photo"] = "Next Photo";
 ?>
\ No newline at end of file

Modified: plugins/trunk/flickr/locale/locale_zh_TW.php
===================================================================
--- plugins/trunk/flickr/locale/locale_zh_TW.php	2005-03-07 03:17:06 UTC (rev 1340)
+++ plugins/trunk/flickr/locale/locale_zh_TW.php	2005-03-07 11:18:40 UTC (rev 1341)
@@ -47,4 +47,6 @@
 $messages["flickr_photo_url"] = "Flickr 連結:";
 $messages["flickr_photo_see_url"] = "察看 Flickr 相片。";
 $messages["flickr_view_as_slideshow"] = "觀看相簿投影片";
+$messages["flickr_prev_photo"] = "上一張";
+$messages["flickr_next_photo"] = "下一張";
 ?>
\ No newline at end of file

Modified: plugins/trunk/flickr/pluginflickr.class.php
===================================================================
--- plugins/trunk/flickr/pluginflickr.class.php	2005-03-07 03:17:06 UTC (rev 1340)
+++ plugins/trunk/flickr/pluginflickr.class.php	2005-03-07 11:18:40 UTC (rev 1341)
@@ -112,7 +112,7 @@
             $this->userRoot = $this->pluginTemplatePage();
 
             $data = $this->cached_get_file_contents($apiUrl, 'r', $this->expiredTime, $this->cacheFolder);
-            $parser = new XMLParser($data, 'raw', 1);
+            $parser =& new XMLParser($data, 'raw', 1);
             $tree = $parser->getTree();
             
             $total_albums = count($tree['RSP']['PHOTOSETS']['PHOTOSET']);
@@ -166,7 +166,7 @@
                 $apiUrl .= '&email=' . $this->email . '&password=' . $this->password . '&photoset_id=' . $albumId;
             
             $data = $this->cached_get_file_contents($apiUrl, 'r', $this->expiredTime, $this->cacheFolder);
-            $parser = new XMLParser($data, 'raw', 1);
+            $parser =& new XMLParser($data, 'raw', 1);
             $tree = $parser->getTree();
 
             $this->userRoot = $this->pluginTemplatePage();
@@ -216,7 +216,7 @@
             $this->userRoot = $this->pluginTemplatePage(); 
  
             $data = $this->cached_get_file_contents($apiUrl, 'r', $this->expiredTime, $this->cacheFolder);
-            $parser = new XMLParser($data, 'raw', 1);
+            $parser =& new XMLParser($data, 'raw', 1);
             $tree = $parser->getTree();
             
             $photo = Array();
@@ -266,6 +266,64 @@
         }
 
         /**
+         * Get the photo navigation from specific photo album
+         */
+        function getPhotoNavigation($albumId, $currentPhotoId)
+        {
+            $apiUrl = FLICKR_GET_PHOTOS.FLICKR_API_KEY;
+            if ($this->showPrivate == 1)
+                $apiUrl .= '&photoset_id=' . $albumId;
+            else
+                $apiUrl .= '&email=' . $this->email . '&password=' . $this->password . '&photoset_id=' . $albumId;
+            
+            $data = $this->cached_get_file_contents($apiUrl, 'r', $this->expiredTime, $this->cacheFolder);
+            $parser =& new XMLParser($data, 'raw', 1);
+            $tree = $parser->getTree();
+
+            $this->userRoot = $this->pluginTemplatePage();
+
+            $totalPhotos = count($tree['RSP']['PHOTOSET']['PHOTO']);
+            
+            $navigationUrl = Array();
+            
+            if ($tree['RSP']['PHOTOSET']['PHOTO'][0] != NULL) {
+                for ($i = 0; $i < $totalPhotos; $i++) {
+                    $photoId = $tree['RSP']['PHOTOSET']['PHOTO'][$i]['ATTRIBUTES']['ID'];
+                    if ( $photoId == $currentPhotoId ) {
+                        if ($i == 0) {
+                            $prevPhotoUrl = '';
+                            
+                            $nextPhotoId = $tree['RSP']['PHOTOSET']['PHOTO'][$i+1]['ATTRIBUTES']['ID'];
+                            $nextPhotoSecret =$tree['RSP']['PHOTOSET']['PHOTO'][$i+1]['ATTRIBUTES']['SECRET'];
+                            $nextPhotoUrl = $this->userRoot."&album=".$albumId."&photo=".$nextPhotoId."&secret=".$nextPhotoSecret;
+                        } elseif ($i < $totalPhotos-1) {
+                            $prevPhotoId = $tree['RSP']['PHOTOSET']['PHOTO'][$i-1]['ATTRIBUTES']['ID'];
+                            $prevPhotoSecret =$tree['RSP']['PHOTOSET']['PHOTO'][$i-1]['ATTRIBUTES']['SECRET'];
+                            $prevPhotoUrl = $this->userRoot."&album=".$albumId."&photo=".$prevPhotoId."&secret=".$prevPhotoSecret;
+                            
+                            $nextPhotoId = $tree['RSP']['PHOTOSET']['PHOTO'][$i+1]['ATTRIBUTES']['ID'];
+                            $nextPhotoSecret =$tree['RSP']['PHOTOSET']['PHOTO'][$i+1]['ATTRIBUTES']['SECRET'];
+                            $nextPhotoUrl = $this->userRoot."&album=".$albumId."&photo=".$nextPhotoId."&secret=".$nextPhotoSecret;
+                        } else {
+                            $prevPhotoId = $tree['RSP']['PHOTOSET']['PHOTO'][$i-1]['ATTRIBUTES']['ID'];
+                            $prevPhotoSecret =$tree['RSP']['PHOTOSET']['PHOTO'][$i-1]['ATTRIBUTES']['SECRET'];
+                            $prevPhotoUrl = $this->userRoot."&album=".$albumId."&photo=".$prevPhotoId."&secret=".$prevPhotoSecret;
+                            
+                            $nextPhotoUrl = '';
+                        }
+                        $navigationUrl['prevPhotoUrl'] = $prevPhotoUrl;
+                        $navigationUrl['nextPhotoUrl'] = $nextPhotoUrl;
+                        return $navigationUrl;
+                    }
+                }
+            } else {
+                $navigationUrl['prevPhotoUrl'] = '';
+                $navigationUrl['nextPhotoUrl'] = '';
+                return $navigationUrl;
+            }
+        }        
+
+        /**
          * Get the slide show of specific photo album
          */
         function getSlideShowUrl($albumId)

Modified: plugins/trunk/flickr/readme.txt
===================================================================
--- plugins/trunk/flickr/readme.txt	2005-03-07 03:17:06 UTC (rev 1340)
+++ plugins/trunk/flickr/readme.txt	2005-03-07 11:18:40 UTC (rev 1341)
@@ -2,7 +2,7 @@
 Author: Mark Wu
 Idea: http://www.worrad.com/archives/2005/01/08/flickr-gallery-07/
 Release Date: 2005/01/24
-Version: 1.1
+Version: 1.1.1
 
 This plugin offers you to integrate with Flickr service. 
 It is inspired by Wordpress Flickr Gallery Plugin written by Ray.
@@ -17,8 +17,12 @@
 http://your-plog/index.php?op=FlickrShow&blogId=1
 
 History:
-1.1 Add a new css to butify the template page from http://www.worrad.com
-    Fixed a typo error of template
-    Add flickr slide show URL
-1.0 Flickr pLog plugin release
+1.1.1
+ Add Navigation Bar to Flickr Plugin
+1.1 
+ Add a new css to butify the template page from http://www.worrad.com
+ Fixed a typo error of template
+ Add flickr slide show URL
+1.0 
+ Flickr pLog plugin release
 




More information about the pLog-svn mailing list