diff options
author | Stephan Bergemann <st.bergemann@htw-berlin.de> | 2012-06-12 03:23:22 +0200 |
---|---|---|
committer | Stephan Bergemann <st.bergemann@htw-berlin.de> | 2012-06-14 01:27:01 +0200 |
commit | e4278574a8806b4748d132adb5f29fb61e6c6058 (patch) | |
tree | 2f7459d32b7cdb027547f12b175605d3839b9734 /apps/gallery/lib | |
parent | e15480683820426870be62a26dc7b91cbdc9a157 (diff) | |
download | nextcloud-server-e4278574a8806b4748d132adb5f29fb61e6c6058.tar.gz nextcloud-server-e4278574a8806b4748d132adb5f29fb61e6c6058.zip |
fixed sorting errors and missbehaviours - now sorting like file browser
Diffstat (limited to 'apps/gallery/lib')
-rw-r--r-- | apps/gallery/lib/tiles.php | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/apps/gallery/lib/tiles.php b/apps/gallery/lib/tiles.php index e43c99bb76a..48b54f0cf0e 100644 --- a/apps/gallery/lib/tiles.php +++ b/apps/gallery/lib/tiles.php @@ -63,7 +63,7 @@ class TilesLine { $img_w = $this->tiles_array[$i]->getWidth(); $extra = ''; if ($img_w != IMAGE_WIDTH) $extra = ' style="width:'.$img_w.'px"'; - $r .= '<div class="gallery_div" '.$extra.' onmouseover="'.$this->tiles_array[$i]->getOnHoverAction().'" onmouseout="'.$this->tiles_array[$i]->getOnOutAction().'" onclick="'.$this->tiles_array[$i]->getOnClickAction().'">'.$this->tiles_array[$i]->get().'</div>'; + $r .= '<div class="gallery_div" '.$extra.' onmouseover="'.$this->tiles_array[$i]->getOnHoverAction().'" onmouseout="'.$this->tiles_array[$i]->getOnOutAction().'" onclick="'.$this->tiles_array[$i]->getOnClickAction().'">'.$this->tiles_array[$i]->get().'</div>'; } $r .= '</div>'; @@ -122,7 +122,7 @@ class TileStack extends TileBase { $this->tiles_array = array(); $this->stack_name = $stack_name; for ($i = 0; $i < count($path_array) && $i < self::STACK_REPRESENTATIVES; $i++) { - $tile = new TileSingle($path_array[$i]); + $tile = new TileSingle($path_array[$i]); array_push($this->tiles_array, $tile); } } @@ -134,32 +134,47 @@ class TileStack extends TileBase { public function getWidth() { $max = 0; - for ($i = 0; $i < count($this->tiles_array); $i++) { - $max = max($max, $this->tiles_array[$i]->getWidth()); + if(count($this->tiles_array) == 0) { + $max = IMAGE_WIDTH; + } else { + for ($i = 0; $i < count($this->tiles_array); $i++) { + $max = max($max, $this->tiles_array[$i]->getWidth()); + } } return min(IMAGE_WIDTH, $max); } public function get() { $r = '<div class="title gallery_div">'.$this->stack_name.'</div>'; - for ($i = 0; $i < count($this->tiles_array); $i++) { - $top = rand(-5, 5); - $left = rand(-5, 5); - $img_w = $this->tiles_array[$i]->getWidth(); - $extra = ''; - if ($img_w < IMAGE_WIDTH) { - $extra = 'width:'.$img_w.'px;'; + if(count($this->tiles_array) == 0) { + // aint no pictures in this folder... + $r.='<div class="miniature_border gallery_div" style="border:2px solid; margin-right: 2px;"></div>'; + } else { + for ($i = 0; $i < count($this->tiles_array); $i++) { + $top = rand(-5, 5); + $left = rand(-5, 5); + $img_w = $this->tiles_array[$i]->getWidth(); + $extra = ''; + if ($img_w < IMAGE_WIDTH) { + $extra = 'width:'.$img_w.'px;'; + } + $r .= '<div class="miniature_border gallery_div" style="background-image:url(\''.$this->tiles_array[$i]->getMiniatureSrc().'\');margin-top:'.$top.'px; margin-left:'.$left.'px;'.$extra.'"></div>'; } - $r .= '<div class="miniature_border gallery_div" style="background-image:url(\''.$this->tiles_array[$i]->getMiniatureSrc().'\');margin-top:'.$top.'px; margin-left:'.$left.'px;'.$extra.'"></div>'; } return $r; } public function getOnHoverAction() { + if(count($this->tiles_array) == 0) { + return 'javascript:explode_empty(this);return false;'; + } return 'javascript:explode(this);return false;'; } public function getOnOutAction() { + if(count($this->tiles_array) == 0) { + return 'javascript:deplode_empty(this);return false;'; + } return 'javascript:deplode(this);return false;'; } |