[Jaws-commits] r12361 - in branches/0.8/html/gadgets/Phoo: . templates

afz at jaws-project.com afz at jaws-project.com
Fri Jan 6 05:55:46 UTC 2012


Author: afz
Date: 2012-01-06 05:55:46 +0000 (Fri, 06 Jan 2012)
New Revision: 12361

Modified:
   branches/0.8/html/gadgets/Phoo/HTML.php
   branches/0.8/html/gadgets/Phoo/LayoutHTML.php
   branches/0.8/html/gadgets/Phoo/Model.php
   branches/0.8/html/gadgets/Phoo/templates/Albums.html
   branches/0.8/html/gadgets/Phoo/templates/Random.html
   branches/0.8/html/gadgets/Phoo/templates/ViewAlbumPage.html
   branches/0.8/html/gadgets/Phoo/templates/ViewImage.html
Log:
[Phoo]: some changes for stylish more customizable

Modified: branches/0.8/html/gadgets/Phoo/HTML.php
===================================================================
--- branches/0.8/html/gadgets/Phoo/HTML.php	2012-01-06 04:02:05 UTC (rev 12360)
+++ branches/0.8/html/gadgets/Phoo/HTML.php	2012-01-06 05:55:46 UTC (rev 12361)
@@ -101,14 +101,15 @@
                         $size = Jaws_Image::GetImageSize(JAWS_DATA . 'phoo/' . $image['thumb']);
                         $t->SetBlock('ViewAlbumPage/photos/item');
                         $url = $this->GetURLFor('ViewImage', array('id' => $image['id'], 'albumid' => $image['albumid']));
-                        $t->SetVariable('url', $url);
-                        $t->SetVariable('thumb',  $GLOBALS['app']->getDataURL('phoo/' . $image['thumb']));
-                        $t->SetVariable('medium', $GLOBALS['app']->getDataURL('phoo/' . $image['medium']));
-                        $t->SetVariable('image',  $GLOBALS['app']->getDataURL('phoo/' . $image['image']));
-                        $t->SetVariable('img_desc', $image['description']);
-                        $t->SetVariable('name', $image['name']);
-                        $t->SetVariable('width', $size['width']);
-                        $t->SetVariable('height', $size['height']);
+                        $t->SetVariable('url',      $url);
+                        $t->SetVariable('thumb',    $GLOBALS['app']->getDataURL('phoo/' . $image['thumb']));
+                        $t->SetVariable('medium',   $GLOBALS['app']->getDataURL('phoo/' . $image['medium']));
+                        $t->SetVariable('image',    $GLOBALS['app']->getDataURL('phoo/' . $image['image']));
+                        $t->SetVariable('name',     $image['name']);
+                        $t->SetVariable('filename', $image['filename']);
+                        $t->SetVariable('img_desc', $image['stripped_description']);
+                        $t->SetVariable('width',    $size['width']);
+                        $t->SetVariable('height',   $size['height']);
                         $t->ParseBlock('ViewAlbumPage/photos/item');
                     }
                 }
@@ -200,29 +201,25 @@
             require_once JAWS_PATH . 'include/Jaws/HTTPError.php';
             return Jaws_HTTPError::Get(404);
         }
-        $this->SetTitle($image['title']);
+        $this->SetTitle($image['name']);
         require_once JAWS_PATH . 'include/Jaws/Image.php';
         $size = Jaws_Image::GetImageSize(JAWS_DATA . 'phoo/' . $image['medium']);
 
-        $settings = $model->GetSettings();
-
         $t->SetBlock('ViewImage');
-        $t->SetVariable('title', $image['title']);
-        $t->SetVariable('posted_by', _t('PHOO_POSTED_BY'));
-        $t->SetVariable('img_author', $image['author']);
-        $t->SetVariable('img_desc', $image['description']);
-        $t->SetVariable('albumid', $albumid);
-        if (!empty($image['description'])) {
-            $t->SetVariable('description', $this->ParseText($image['description'], 'Phoo'));
-        } else {
-            $t->SetVariable('description', ' ');
-        }
-        $t->SetVariable('medium', $GLOBALS['app']->getDataURL('phoo/' . $image['medium']));
-        $t->SetVariable('image',  $GLOBALS['app']->getDataURL('phoo/' . $image['image']));
-        $t->SetVariable('width',  $size['width']);
-        $t->SetVariable('height', $size['height']);
+        $t->SetVariable('posted_by',   _t('PHOO_POSTED_BY'));
+        $t->SetVariable('img_author',  $image['author']);
+        $t->SetVariable('name',        $image['name']);
+        $t->SetVariable('filename',    $image['filename']);
+        $t->SetVariable('img_desc',    $image['stripped_description']);
+        $t->SetVariable('albumid',     $albumid);
+        $t->SetVariable('description', $this->ParseText($image['description'], 'Phoo'));
+        $t->SetVariable('medium',      $GLOBALS['app']->getDataURL('phoo/' . $image['medium']));
+        $t->SetVariable('image',       $GLOBALS['app']->getDataURL('phoo/' . $image['image']));
+        $t->SetVariable('width',       $size['width']);
+        $t->SetVariable('height',      $size['height']);
 
         // show if the original was kept
+        $settings = $model->GetSettings();
         if ($settings['keep_original'] == 'true') {
             $t->SetVariable('url', $GLOBALS['app']->getDataURL('phoo/' . $image['image']));
         } else {
@@ -251,7 +248,7 @@
                 if ($preview_mode) {
                     $t->SetVariable('preview', $this->ShowPreview());
                 }
-                $t->SetVariable('comment-form', $this->DisplayCommentForm($image['id'], $albumid, 0, _t('GLOBAL_RE').$image['title']));
+                $t->SetVariable('comment-form', $this->DisplayCommentForm($image['id'], $albumid, 0, _t('GLOBAL_RE').$image['name']));
             } elseif ($restricted) {
                 $login_url    = $GLOBALS['app']->Map->GetURLFor('Users', 'LoginBox');
                 $register_url = $GLOBALS['app']->Map->GetURLFor('Users', 'Registration');
@@ -263,7 +260,7 @@
                 if ($preview_mode) {
                     $t->SetVariable('preview', $this->ShowPreview());
                 }
-                $title  = $image['title'];
+                $title  = $image['name'];
                 $comment = $model->GetComment($reply_to_comment);
                 if (!Jaws_Error::IsError($comment)) {
                     $title  = $comment['title'];
@@ -401,7 +398,7 @@
                     $t->SetVariable('thumb', $GLOBALS['app']->getDataURL('phoo/' . $entry['thumb']));
                     $url = $this->GetURLFor('PhotoblogPortrait', array('photoid' => $entry['id']));
                     $t->SetVariable('url', $url);
-                    $t->SetVariable('title', $entry['title']);
+                    $t->SetVariable('title', $entry['name']);
                     $t->SetVariable('description', $this->ParseText($entry['description'], 'Phoo'));
                     $t->SetVariable('createtime',  $date->Format($entry['createtime']));
                     $t->SetVariable('width', $size['width']);
@@ -413,7 +410,7 @@
                     $t->SetBlock('photoblog_portrait/main');
                     $t->SetVariable('medium', $GLOBALS['app']->getDataURL('phoo/' . $entry['medium']));
                     $t->SetVariable('url', $GLOBALS['app']->getDataURL('phoo/' . $entry['image']));
-                    $t->SetVariable('title', $entry['title']);
+                    $t->SetVariable('title', $entry['name']);
                     $t->SetVariable('description', $this->ParseText($entry['description'], 'Phoo'));
                     $t->SetVariable('createtime',  $date->Format($entry['createtime']));
                     $t->SetVariable('width', $size['width']);
@@ -428,7 +425,7 @@
                     $t->SetBlock('photoblog_portrait/main');
                     $t->SetVariable('medium', $GLOBALS['app']->getDataURL('phoo/' . $entry['medium']));
                     $t->SetVariable('url', $GLOBALS['app']->getDataURL('phoo/' . $entry['image']));
-                    $t->SetVariable('title', $entry['title']);
+                    $t->SetVariable('title', $entry['name']);
                     $t->SetVariable('description', $this->ParseText($entry['description'], 'Phoo'));
                     $t->SetVariable('createtime',  $date->Format($entry['createtime']));
                     $t->SetVariable('width', $size['width']);
@@ -441,7 +438,7 @@
                     $t->SetVariable('thumb', $GLOBALS['app']->getDataURL('phoo/' . $entry['thumb']));
                     $url = $this->GetURLFor('PhotoblogPortrait', array('photoid' => $entry['id']));
                     $t->SetVariable('url', $url);
-                    $t->SetVariable('title', $entry['title']);
+                    $t->SetVariable('title', $entry['name']);
                     $t->SetVariable('description', $this->ParseText($entry['description'], 'Phoo'));
                     $t->SetVariable('createtime',  $date->Format($entry['createtime']));
                     $t->SetVariable('width', $size['width']);

Modified: branches/0.8/html/gadgets/Phoo/LayoutHTML.php
===================================================================
--- branches/0.8/html/gadgets/Phoo/LayoutHTML.php	2012-01-06 04:02:05 UTC (rev 12360)
+++ branches/0.8/html/gadgets/Phoo/LayoutHTML.php	2012-01-06 05:55:46 UTC (rev 12361)
@@ -37,12 +37,14 @@
                                                                     array(
                                                                         'id' => $r['id'],
                                                                         'albumid' => $r['phoo_album_id'])));
-            $t->SetVariable('thumb',  $GLOBALS['app']->getDataURL('phoo/' . $r['thumb']));
-            $t->SetVariable('medium', $GLOBALS['app']->getDataURL('phoo/' . $r['medium']));
-            $t->SetVariable('image',  $GLOBALS['app']->getDataURL('phoo/' . $r['image']));
-            $t->SetVariable('img_desc', $r['description']);
-            $t->SetVariable('width', $size['width']);
-            $t->SetVariable('height', $size['height']);
+            $t->SetVariable('name',     $r['name']);
+            $t->SetVariable('filename', $r['filename']);
+            $t->SetVariable('thumb',    $GLOBALS['app']->getDataURL('phoo/' . $r['thumb']));
+            $t->SetVariable('medium',   $GLOBALS['app']->getDataURL('phoo/' . $r['medium']));
+            $t->SetVariable('image',    $GLOBALS['app']->getDataURL('phoo/' . $r['image']));
+            $t->SetVariable('img_desc', $r['stripped_description']);
+            $t->SetVariable('width',    $size['width']);
+            $t->SetVariable('height',   $size['height']);
             $t->ParseBlock('random_image');
         }
 
@@ -142,13 +144,14 @@
 
                 $size = Jaws_Image::GetImageSize(JAWS_DATA . 'phoo/' . $album['thumb']);
                 $t->SetBlock('albums/item');
-                $t->SetVariable('thumb', $GLOBALS['app']->getDataURL('phoo/' . $album['thumb']));
-                $t->SetVariable('width', $size['width']);
-                $t->SetVariable('height', $size['height']);
-                $t->SetVariable('howmany', _t('PHOO_NUM_PHOTOS_ALBUM', $album['qty']));
                 $url = $GLOBALS['app']->Map->GetURLFor('Phoo','ViewAlbum', array('id' => $album['id']));
-                $t->SetVariable('url', $url);
-                $t->SetVariable('name', $album['name']);
+                $t->SetVariable('url',      $url);
+                $t->SetVariable('name',     $album['name']);
+                $t->SetVariable('filename', $album['filename']);
+                $t->SetVariable('thumb',    $GLOBALS['app']->getDataURL('phoo/' . $album['thumb']));
+                $t->SetVariable('width',    $size['width']);
+                $t->SetVariable('height',   $size['height']);
+                $t->SetVariable('howmany',  _t('PHOO_NUM_PHOTOS_ALBUM', $album['qty']));
                 $t->SetVariable('description', Jaws_Gadget::ParseText($album['description'], 'Phoo'));
                 $t->SetVariable('createtime', $date->Format($album['createtime']));
                 $t->ParseBlock('albums/item');

Modified: branches/0.8/html/gadgets/Phoo/Model.php
===================================================================
--- branches/0.8/html/gadgets/Phoo/Model.php	2012-01-06 04:02:05 UTC (rev 12360)
+++ branches/0.8/html/gadgets/Phoo/Model.php	2012-01-06 05:55:46 UTC (rev 12361)
@@ -318,8 +318,9 @@
 
             $images = $GLOBALS['db']->queryAll($sql, $params);
             if (!Jaws_Error::IsError($images) && !empty($images)) {
-                $albums[$i]['thumb'] = $this->GetThumbPath($images[0]['filename']);
-                $albums[$i]['qty']   = count($images);
+                $albums[$i]['qty']      = count($images);
+                $albums[$i]['filename'] = $images[0]['filename'];
+                $albums[$i]['thumb']    = $this->GetThumbPath($images[0]['filename']);
                 unset($images);
             }
         }
@@ -347,6 +348,7 @@
                 [phoo_album_id],
                 [filename],
                 [[phoo_image]].[id],
+                [[phoo_image]].[title],
                 [[phoo_image]].[description]
             FROM [[phoo_image_album]]
             INNER JOIN [[phoo_image]] ON [[phoo_image]].[id] = [[phoo_image_album]].[phoo_image_id]
@@ -367,9 +369,11 @@
             return new Jaws_Error(_t('PHOO_ERROR_RANDOMIMAGE'), _t('PHOO_NAME'));
         }
 
+        $row['name']   = $row['title'];
         $row['thumb']  = $this->GetThumbPath($row['filename']);
         $row['medium'] = $this->GetMediumPath($row['filename']);
         $row['image']  = $this->GetOriginalPath($row['filename']);
+        $row['stripped_description'] = strip_tags($row['description']);
 
         return $row;
     }
@@ -727,8 +731,10 @@
             $info['medium']      = $this->GetMediumPath($row['filename']);
             $info['image']       = $this->GetOriginalPath($row['filename']);
             $info['name']        = $row['title'];
+            $info['filename']    = $row['filename'];
             $info['description'] = $row['description'];
             $info['published']   = $row['published'];
+            $info['stripped_description'] = strip_tags($row['description']);
 
             $album['images'][]   = $info;
         }
@@ -802,14 +808,16 @@
         $image = array();
 
         $image['id']             = $r['id'];
-        $image['title']          = $r['title'];
+        $image['name']           = $r['title'];
         $image['albumid']        = $album_id;
         $image['description']    = $r['description'];
+        $image['filename']       = $r['filename'];
         $image['medium']         = $this->GetMediumPath($r['filename']);
         $image['image']          = $this->GetOriginalPath($r['filename']);
         $image['author']         = $r['nickname'];
         $image['published']      = $r['published'];
         $image['allow_comments'] = $r['allow_comments'];
+        $image['stripped_description'] = strip_tags($r['description']);
 
         // create an array with the gallery elements to find previous and next images
         if ($album_id != '0') {  //UNKNOWN
@@ -979,7 +987,7 @@
             SELECT
                 [filename],
                 [[phoo_image]].[id],
-                [title],
+                [[phoo_image]].[title],
                 [[phoo_image]].[description],
                 [[phoo_image]].[createtime]
             FROM [[phoo_image_album]]
@@ -1015,13 +1023,15 @@
         foreach ($result as $r) {
             $info = array();
 
-            $info['title']       = $r['title'];
+            $info['id']          = $r['id'];
+            $info['name']        = $r['title'];
+            $info['filename']    = $r['filename'];
             $info['description'] = $r['description'];
             $info['createtime']  = $r['createtime'];
             $info['thumb']       = $this->GetThumbPath($r['filename']);
             $info['medium']      = $this->GetMediumPath($r['filename']);
             $info['image']       = $this->GetOriginalPath($r['filename']);
-            $info['id']          = $r['id'];
+            $info['stripped_description'] = strip_tags($r['description']);
 
             $portrait[] = $info;
         }

Modified: branches/0.8/html/gadgets/Phoo/templates/Albums.html
===================================================================
--- branches/0.8/html/gadgets/Phoo/templates/Albums.html	2012-01-06 04:02:05 UTC (rev 12360)
+++ branches/0.8/html/gadgets/Phoo/templates/Albums.html	2012-01-06 05:55:46 UTC (rev 12361)
@@ -11,7 +11,7 @@
     <div class="album-info">{createtime}<br />{howmany}</div>
     </td>
     <td valign="top" width="1%">
-    <a href="{url}"><img src="{thumb}" width="{width}" height="{height}" border="0" alt="{name}" /></a>
+    <a href="{url}" title="{name}"><img src="{thumb}" width="{width}" height="{height}" border="0" alt="{filename}" /></a>
     </td>
     </tr>
     </table>

Modified: branches/0.8/html/gadgets/Phoo/templates/Random.html
===================================================================
--- branches/0.8/html/gadgets/Phoo/templates/Random.html	2012-01-06 04:02:05 UTC (rev 12360)
+++ branches/0.8/html/gadgets/Phoo/templates/Random.html	2012-01-06 05:55:46 UTC (rev 12361)
@@ -2,7 +2,7 @@
 <div class="gadget phoo_random">
   <h2>{title}</h2>
   <div class="content">
-    <a href="{url}" title="{img_desc}"><img src="{thumb}" width="{width}" height="{height}" alt="{title}" /></a>
+    <a href="{url}" title="{name}"><img src="{thumb}" width="{width}" height="{height}" title="{name}" alt="{filename}" /></a>
   </div>
 </div>
 <!-- END random_image -->
\ No newline at end of file

Modified: branches/0.8/html/gadgets/Phoo/templates/ViewAlbumPage.html
===================================================================
--- branches/0.8/html/gadgets/Phoo/templates/ViewAlbumPage.html	2012-01-06 04:02:05 UTC (rev 12360)
+++ branches/0.8/html/gadgets/Phoo/templates/ViewAlbumPage.html	2012-01-06 05:55:46 UTC (rev 12361)
@@ -5,7 +5,7 @@
   <!-- BEGIN photos -->
   <div class="content">
     <!-- BEGIN item -->
-    <a href="{url}" title="{img_desc}"><img width="{width}" height="{height}" src="{thumb}" title="{name}" alt="{name}" /></a> 
+    <a href="{url}" title="{name}"><img width="{width}" height="{height}" src="{thumb}" title="{name}" alt="{filename}" /></a> 
     <!-- END item -->
   </div>
   <!-- END photos -->

Modified: branches/0.8/html/gadgets/Phoo/templates/ViewImage.html
===================================================================
--- branches/0.8/html/gadgets/Phoo/templates/ViewImage.html	2012-01-06 04:02:05 UTC (rev 12360)
+++ branches/0.8/html/gadgets/Phoo/templates/ViewImage.html	2012-01-06 05:55:46 UTC (rev 12361)
@@ -25,12 +25,12 @@
   <!-- END navigation -->
   <div class="content">
     <a href="{url}" title="{img_desc}" target="_blank">
-      <img src="{medium}" width="{width}" height="{height}" title="{name}" alt="{name}" /></a>
+      <img src="{medium}" width="{width}" height="{height}" title="{name}" alt="{filename}" /></a>
     <p>{description}</p>
     <!-- BEGIN exif -->
     <div>
       <h4>{exif_info}</h4>
-      <p><img src="{cameraimg}" title="{name}" width="48" alt="{name}" height="48" />
+      <p><img src="{cameraimg}" title="{camera}" width="48" alt="{camera}" height="48" />
          <span><strong>{camera}</strong><br />{data}</span></p>
     </div>
     <!-- END exif -->



More information about the Jaws-commits mailing list