summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/organize/controllers/organize.php22
-rw-r--r--modules/organize/helpers/organize_event.php2
-rw-r--r--modules/organize/helpers/organize_theme.php27
-rw-r--r--modules/organize/js/organize.js6
-rw-r--r--modules/organize/views/organize_dialog.html.php9
-rw-r--r--modules/organize/views/organize_thumb_grid.html.php31
-rw-r--r--modules/organize/views/organize_tree.html.php2
7 files changed, 33 insertions, 66 deletions
diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php
index 95d71e9c..3a81ef4f 100644
--- a/modules/organize/controllers/organize.php
+++ b/modules/organize/controllers/organize.php
@@ -18,10 +18,7 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class Organize_Controller extends Controller {
- private static $_MICRO_THUMB_SIZE = 90;
- private static $_MICRO_THUMB_PADDING = 10;
-
- function index($item_id) {
+ function dialog($item_id) {
$item = ORM::factory("item", $item_id);
$root = $item->id == 1 ? $item : ORM::factory("item", 1);
access::required("view", $item);
@@ -36,26 +33,21 @@ class Organize_Controller extends Controller {
$parents[$item->id] = 1;
$v->album_tree = $this->_tree($root, $parents);
- $v->micro_thumb_grid = $this->_get_micro_thumb_grid($item);
+ $v->micro_thumb_grid = $this->_get_micro_thumb_grid($item, 0);
print $v;
}
- function content($item_id, $offset=0) {
+ function content($item_id, $offset) {
$item = ORM::factory("item", $item_id);
access::required("view", $item);
access::required("edit", $item);
-
- $v = $this->_get_micro_thumb_grid($item, $offset);
- print $v->__toString();
+ print $this->_get_micro_thumb_grid($item, $offset);
}
- private function _get_micro_thumb_grid($item, $offset=0) {
+ private function _get_micro_thumb_grid($item, $offset) {
$v = new View("organize_thumb_grid.html");
- $v->item_id = $item->id;
- $v->children = $item->children(25, $offset);
- $v->thumbsize = self::$_MICRO_THUMB_SIZE;
- $v->offset = $offset + 25;
-
+ $v->item = $item;
+ $v->offset = $offset;
return $v;
}
diff --git a/modules/organize/helpers/organize_event.php b/modules/organize/helpers/organize_event.php
index 887d9c2d..7d6b3e24 100644
--- a/modules/organize/helpers/organize_event.php
+++ b/modules/organize/helpers/organize_event.php
@@ -27,7 +27,7 @@ class organize_event_Core {
->id("organize")
->label(t("Organize Album"))
->css_id("gOrganizeLink")
- ->url(url::site("organize/index/{$item->id}")));
+ ->url(url::site("organize/dialog/{$item->id}")));
}
}
}
diff --git a/modules/organize/helpers/organize_theme.php b/modules/organize/helpers/organize_theme.php
deleted file mode 100644
index 0fd117c3..00000000
--- a/modules/organize/helpers/organize_theme.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php defined("SYSPATH") or die("No direct script access.");
-/**
- * Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2009 Bharat Mediratta
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
- */
-class organize_theme {
- static function head($theme) {
- if (access::can("view", $theme->item()) && access::can("edit", $theme->item())) {
- $theme->script("organize.js");
- $theme->css("organize.css");
- }
- }
-}
diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js
index d2006c27..6b4a5934 100644
--- a/modules/organize/js/organize.js
+++ b/modules/organize/js/organize.js
@@ -4,6 +4,12 @@
* Dynamically initialize the organize dialog when it is displayed
*/
init: function(data) {
+ // Resize with 50 pixels padding all around
+ var size = $.getViewportSize();
+ $("#gDialog").dialog("option", "height", size.height() - 100)
+ .dialog("option", "width", size.width() - 100)
+ .dialog("option", "position", "center");
+
// Deal with ui.jquery bug: http://dev.jqueryui.com/ticket/4475 (target 1.8?)
$(".sf-menu li.sfHover ul").css("z-index", 70);
diff --git a/modules/organize/views/organize_dialog.html.php b/modules/organize/views/organize_dialog.html.php
index 11ce0a37..6001e038 100644
--- a/modules/organize/views/organize_dialog.html.php
+++ b/modules/organize/views/organize_dialog.html.php
@@ -1,4 +1,5 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
+<link rel="stylesheet" type="text/css" href="<?= url::file("modules/organize/css/organize.css") ?>" />
<div id="gOrganize">
<h1 style="display:none"><?= t("Organize %name", array("name" => p::purify($title))) ?></h1>
<div id="bd">
@@ -38,13 +39,9 @@
</div>
</div>
+<script type="text/javascript" src="<?= url::file("modules/organize/js/organize.js") ?>"></script>
<script type="text/javascript">
setTimeout(function() {
- // Resize with 50 pixels padding all around
- var size = $.getViewportSize();
- $("#gDialog").dialog("option", "height", size.height() - 100)
- .dialog("option", "width", size.width() - 100)
- .dialog("option", "position", "center");
$.organize.init();
}, 0);
-</script> \ No newline at end of file
+</script>
diff --git a/modules/organize/views/organize_thumb_grid.html.php b/modules/organize/views/organize_thumb_grid.html.php
index e6b7aec0..0d54c5c8 100644
--- a/modules/organize/views/organize_thumb_grid.html.php
+++ b/modules/organize/views/organize_thumb_grid.html.php
@@ -1,19 +1,20 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
-<? foreach ($children as $i => $child): ?>
- <? $item_class = "gPhoto"; ?>
- <? if ($child->is_album()): ?>
- <? $item_class = "gAlbum"; ?>
- <? endif ?>
- <li id="gMicroThumb_<?= $child->id ?>" class="gMicroThumb <?= $item_class ?>" ref="<?= $child->id ?>">
- <?= $child->thumb_img(array("class" => "gThumbnail"), $thumbsize, true) ?>
- </li>
+<? foreach ($item->children(25, $offset) as $child): ?>
+<li id="gMicroThumb_<?= $child->id ?>"
+ class="gMicroThumb <?= $child->is_album() ? "gAlbum" : "gPhoto" ?>"
+ ref="<?= $child->id ?>">
+ <?= $child->thumb_img(array("class" => "gThumbnail"), 90, true) ?>
+</li>
<? endforeach ?>
-<? if (count($children) >= 25): ?>
+
+<? if ($item->children_count() > $offset): ?>
<script>
- $.get("<?= url::site("organize/content/{$item_id}/$offset") ?>",
- function(data) {
- $("#gMicroThumbGrid").append(data);
- }
- );
+ setTimeout(function() {
+ $.get("<?= url::site("organize/content/$item->id/" . ($offset + 25)) ?>",
+ function(data) {
+ $("#gMicroThumbGrid").append(data);
+ }
+ );
+ }, 50);
</script>
-<? endif ?> \ No newline at end of file
+<? endif ?>
diff --git a/modules/organize/views/organize_tree.html.php b/modules/organize/views/organize_tree.html.php
index 280bdc5f..99b0dc1a 100644
--- a/modules/organize/views/organize_tree.html.php
+++ b/modules/organize/views/organize_tree.html.php
@@ -1,6 +1,5 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<li class="gOrganizeBranch ui-icon-left" ref="<?= $album->id ?>">
-
<div id="gOrganizeBranch-<?= $album->id ?>" ref="<?= $album->id ?>"
class="<?= $selected ? "gBranchSelected" : "" ?> gBranchText">
<span id="gOrganizeIcon-<?= $album->id ?>" ref="<?= $album->id ?>"
@@ -16,4 +15,3 @@
<? endforeach ?>
</ul>
</li>
-