]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
still cleaning up album view - this fixes a count bug with an empty album
authorCash Costello <cash.costello@gmail.com>
Sat, 20 Jun 2009 20:32:17 +0000 (20:32 +0000)
committerCash Costello <cash.costello@gmail.com>
Sat, 20 Jun 2009 20:32:17 +0000 (20:32 +0000)
languages/en.php
views/default/object/album.php
views/default/object/image.php
views/default/tidypics/css.php

index 4802308ff572f4436c322097fe47dd0792a04cd0..135344d6dfdcaf6d68caab09c128fe5dda7d0d93 100644 (file)
                                \r
                //Error messages\r
                                 \r
-                       'image:none' => "We could not find any images at the moment.",\r
                        'tidypics:partialuploadfailure' => "There were errors uploading some of the images (%s of %s images).",\r
                        'tidypics:completeuploadfailure' => "Upload of images failed.",\r
                        'tidypics:exceedpostlimit' => "Too many large images - try to upload fewer or smaller images.",\r
index 34174e5717b9207659579f4791c54b6e2b3f821b..3a5f5a97561bb6519762b678e34cfb95f2243459 100644 (file)
@@ -5,19 +5,19 @@
 
        global $CONFIG;
        
-       $file = $vars['entity'];
-       $file_guid = $file->getGUID();
-       $tags = $file->tags;
-       $title = $file->title;
-       $desc = $file->description;
-       $owner = $vars['entity']->getOwnerEntity();
-       $friendlytime = friendly_time($vars['entity']->time_created);
-       $mime = $file->mimetype;
+       $album = $vars['entity'];
+       $album_guid = $album->getGUID();
+       $owner = $album->getOwnerEntity();
+       $tags = $album->tags;
+       $title = $album->title;
+       $desc = $album->description;
+       $friendlytime = friendly_time($album->time_created);
+       $mime = $album->mimetype;
 
        if (get_context() == "search") {
 
                if (get_input('search_viewtype') == "gallery") {
-               
+
 /******************************************************************************
  *
  *  Gallery view of an album object
  *****************************************************************************/
 
                        //get album cover if one was set 
-                       if ($file->cover)
-                               $album_cover = '<img src="'.$vars['url'].'mod/tidypics/thumbnail.php?file_guid='.$file->cover.'&size=small" class="tidypics_album_cover"  alt="thumbnail"/>';
+                       if ($album->cover)
+                               $album_cover = '<img src="' . $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $album->cover . '&size=small" class="tidypics_album_cover" alt="thumbnail"/>';
                        else
-                               $album_cover = '<img src="'.$vars['url'].'mod/tidypics/graphics/empty_album.png" class="tidypics_album_cover" alt="new album">';
+                               $album_cover = '<img src="' . $vars['url'] . 'mod/tidypics/graphics/empty_album.png" class="tidypics_album_cover" alt="new album">';
 
 ?>
 <div class="tidypics_album_gallery_item">
-       <a href="<?php echo $file->getURL();?>"><?php echo $title;?></a><br>
-       <a href="<?php echo $file->getURL();?>"><?php echo $album_cover;?></a><br>
+       <a href="<?php echo $album->getURL();?>"><?php echo $title;?></a><br>
+       <a href="<?php echo $album->getURL();?>"><?php echo $album_cover;?></a><br>
        <small><a href="<?php echo $vars['url'];?>pg/profile/<?php echo $owner->username;?>"><?php echo $owner->name;?></a> <?php echo $friendlytime;?><br>
 <?php
                        //get the number of comments
-                       $numcomments = elgg_count_comments($file);
+                       $numcomments = elgg_count_comments($album);
                        if ($numcomments)
-                               echo "<a href=\"{$file->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a>";
+                               echo "<a href=\"{$album->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a>";
 ?>
        </small>
 </div>
  *
  *****************************************************************************/
 
-                       $info = '<p><a href="' .$file->getURL(). '">'.$title.'</a></p>';
+                       $info = '<p><a href="' . $album->getURL() . '">' . $title . '</a></p>';
                        $info .= "<p class=\"owner_timestamp\"><a href=\"{$vars['url']}pg/file/{$owner->username}\">{$owner->name}</a> {$friendlytime}";
-                       $numcomments = elgg_count_comments($file);
+                       $numcomments = elgg_count_comments($album);
                        if ($numcomments)
-                               $info .= ", <a href=\"{$file->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a>";
+                               $info .= ", <a href=\"{$album->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a>";
                        $info .= "</p>";
                        
-                       $icon = "<a href=\"{$file->getURL()}\">" . elgg_view("tidypics/icon", array('album' => true, 'size' => 'small')) . "</a>";
+                       $icon = "<a href=\"{$album->getURL()}\">" . elgg_view("tidypics/icon", array('album' => true, 'size' => 'small')) . "</a>";
                        
                        echo elgg_view_listing($icon, $info);
                }
                <?php echo elgg_view('tidypics/breadcrumbs', array() ); ?>
        </div>
 <?php 
-               echo '<div id="tidypics_desc">'.autop($desc).'</div>';
-       
-               // display the simple image views. Uses: via 'object/image.php'
-               $count = get_entities("object","image", $file_guid, '', 999);
-
+               echo '<div id="tidypics_desc">' . autop($desc) . '</div>';
+               
+               $images = get_entities("object", "image", $album_guid, '', 999);
+               
                //build array for back | next links 
                $_SESSION['image_sort'] = array();
-       
-               if(count($count) > 0) {
-                       foreach($count as $image){
+               
+               if (is_array($images)) {
+                       foreach ($images as $image) {
                                array_push($_SESSION['image_sort'], $image->guid);
                        }
-               
-                       echo list_entities("object","image", $file_guid, 24, false);
+                       
+                       // display the simple image views. Uses 'object/image' view
+                       echo list_entities("object", "image", $album_guid, 24, false);
+                       
+                       $num_images = count($images);
                } else {
-                       echo elgg_echo('image:none');
+                       echo '<div class="tidypics_info">' . elgg_echo('image:none') . '</div>';
+                       $num_images = 0;
                }
        
 ?>
        <div class="clearfloat"></div>
-       <div id="tidypics_info">
-<?php if (!is_null($tags)) { ?>
-                       <div class="object_tag_string"><?php echo elgg_view('output/tags',array('value' => $tags));?></div>
-<?php } ?>
+       <div class="tidypics_info">
+<?php 
+
+       if (!is_null($tags)) { 
+?>
+               <div class="object_tag_string"><?php echo elgg_view('output/tags',array('value' => $tags));?></div>
+<?php 
+       } 
+?>
                <?php echo elgg_echo('album:by');?> <b><a href="<?php echo $vars['url'] ;?>pg/profile/<?php echo $owner->username; ?>"><?php echo $owner->name; ?></a></b>  <?php echo $friendlytime; ?><br>
-               <?php echo elgg_echo('image:total');?> <b><?php echo count($count);?></b><br>
+               <?php echo elgg_echo('image:total');?> <b><?php echo $num_images; ?></b><br>
        </div>
 
 <?php
index 5bca81a49d3e1f119aeda5d265ceceda6f7c309c..03ba12a02b47c6e574610f6e714c16bc916bbcf1 100644 (file)
@@ -219,7 +219,7 @@ if ($photo_tags) {
 ?>
                                <?php echo elgg_view('tidypics/exif', array('guid'=> $file_guid)); ?>
 <?php          } ?>
-               <div id="tidypics_info">
+               <div class="tidypics_info">
 <?php if (!is_null($tags)) { ?>
                        <div class="object_tag_string"><?php echo elgg_view('output/tags',array('value' => $tags));?></div>
 <?php } 
index 5f4fa3417137c42fccc31d5aa982f84657364204..07b02eeb103b96b0e5e7f4799179209dc63e4e81 100644 (file)
@@ -18,7 +18,7 @@ padding:0 20px;
 font-style:italic;
 }
 
-#tidypics_info {
+.tidypics_info {
 padding:20px;
 }