summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/helpers/graphics.php4
-rw-r--r--modules/organize/controllers/organize.php18
-rw-r--r--modules/organize/js/organize.js26
-rw-r--r--modules/organize/views/organize_dialog.html.php1
-rw-r--r--modules/organize/views/organize_tree.html.php46
-rw-r--r--modules/server_add/helpers/server_add_event.php14
6 files changed, 52 insertions, 57 deletions
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index 2892011f..a20c58dd 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -206,15 +206,11 @@ class graphics_Core {
// Image would get upscaled; do nothing
copy($input_file, $output_file);
} else {
- try {
Image::factory($input_file)
->resize($options["width"], $options["height"], $options["master"])
->quality(module::get_var("gallery", "image_quality"))
->sharpen(module::get_var("gallery", "image_sharpen"))
->save($output_file);
- } catch (Exception $e) {
- Kohana::log("error", $e->getMessage());
- }
}
module::event("graphics_resize_completed", $input_file, $output_file, $options);
diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php
index 2b966657..3cbcfb28 100644
--- a/modules/organize/controllers/organize.php
+++ b/modules/organize/controllers/organize.php
@@ -25,7 +25,7 @@ class Organize_Controller extends Controller {
$v = new View("organize_dialog.html");
$v->album = $album;
- $v->album_tree = self::_tree($album);
+ $v->album_tree = self::_tree(ORM::factory("item", 1));
$v->micro_thumb_grid = self::_get_micro_thumb_grid($album, 0);
print $v;
}
@@ -50,7 +50,7 @@ class Organize_Controller extends Controller {
}
print json_encode(
- array("tree" => self::_tree($album)->__toString(),
+ array("tree" => self::_tree(ORM::factory("item", 1))->__toString(),
"grid" => self::_get_micro_thumb_grid($album, 0)->__toString()));
}
@@ -132,17 +132,15 @@ class Organize_Controller extends Controller {
return $v;
}
+ public function tree($album_id) {
+ $album = ORM::factory("item", $album_id);
+ access::required("view", $album);
+ print self::_tree($album);
+ }
+
private static function _tree($album) {
$v = new View("organize_tree.html");
- $v->parents = $album->parents();
$v->album = $album;
-
- if ($album->id == 1) {
- $v->peers = array($album);
- } else {
- $v->peers = $album->parent()->children(null, 0, array("type" => "album"));
- }
-
return $v;
}
}
diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js
index 04e14a2f..3dbd0c89 100644
--- a/modules/organize/js/organize.js
+++ b/modules/organize/js/organize.js
@@ -159,8 +159,34 @@
$(".gMicroThumbGridCell").mousemove($.organize.mouse_move_handler);
$(".gOrganizeAlbum").droppable($.organize.branch_droppable);
$(".gAlbumText").click($.organize.show_album);
+ $("#gOrganizeAlbumTree .ui-icon-plus,#gOrganizeAlbumTree .ui-icon-minus").click($.organize.toggle_branch);
},
+ toggle_branch: function(event) {
+ event.preventDefault();
+ var target = $(event.currentTarget);
+ var branch = $(target).parent();
+ var id = $(event.currentTarget).parent().attr("ref");
+
+ if ($(target).hasClass("ui-icon-plus")) {
+ // Expanding
+ if (!branch.find("ul").length) {
+ $.get(tree_url.replace("__ALBUM_ID__", id), { },
+ function(data) {
+ branch.replaceWith(data);
+ $.organize.set_handlers();
+ }
+ );
+ } else {
+ branch.find("ul:eq(0)").slideDown();
+ }
+ } else {
+ // Contracting
+ branch.find("ul:eq(0)").slideUp();
+ }
+ $(target).toggleClass("ui-icon-plus");
+ $(target).toggleClass("ui-icon-minus");
+ },
/**
* When the text of a selection is clicked, then show that albums contents
diff --git a/modules/organize/views/organize_dialog.html.php b/modules/organize/views/organize_dialog.html.php
index b03c066c..d4196460 100644
--- a/modules/organize/views/organize_dialog.html.php
+++ b/modules/organize/views/organize_dialog.html.php
@@ -3,6 +3,7 @@
var move_url = "<?= url::site("organize/move_to/__ALBUM_ID__?csrf=$csrf") ?>";
var rearrange_url = "<?= url::site("organize/rearrange/__TARGET_ID__/__BEFORE__?csrf=$csrf") ?>";
var sort_order_url = "<?= url::site("organize/sort_order/__ALBUM_ID__/__COL__/__DIR__?csrf=$csrf") ?>";
+ var tree_url = "<?= url::site("organize/tree/__ALBUM_ID__") ?>";
</script>
<div id="gOrganize" class="gDialogPanel">
<h1 style="display:none"><?= t("Organize %name", array("name" => p::purify($album->title))) ?></h1>
diff --git a/modules/organize/views/organize_tree.html.php b/modules/organize/views/organize_tree.html.php
index 36f900ac..4677234c 100644
--- a/modules/organize/views/organize_tree.html.php
+++ b/modules/organize/views/organize_tree.html.php
@@ -1,44 +1,22 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
-<? foreach ($parents as $parent): ?>
-<li class="gOrganizeAlbum ui-icon-left <?= access::can("edit", $parent) ? "" : "gViewOnly" ?>"
- ref="<?= $parent->id ?>">
+<li class="gOrganizeAlbum ui-icon-left <?= access::can("edit", $album) ? "" : "gViewOnly" ?>"
+ ref="<?= $album->id ?>">
<span class="ui-icon ui-icon-minus">
</span>
- <span class="gAlbumText" ref="<?= $parent->id ?>">
- <?= p::clean($parent->title) ?>
+ <span class="gAlbumText" ref="<?= $album->id ?>">
+ <?= p::clean($album->title) ?>
</span>
- <ul class="ui-icon-plus">
- <? endforeach ?>
-
- <? foreach ($peers as $peer): ?>
- <li class="gOrganizeAlbum ui-icon-left <?= access::can("edit", $peer) ? "" : "gViewOnly" ?>"
- ref="<?= $peer->id ?>">
- <span class="ui-icon <?= $peer->id == $album->id ? "ui-icon-minus" : "ui-icon-plus" ?>">
+ <ul>
+ <? foreach ($album->children(null, 0, array("type" => "album")) as $child): ?>
+ <li class="gOrganizeAlbum ui-icon-left <?= access::can("edit", $child) ? "" : "gViewOnly" ?>"
+ ref="<?= $child->id ?>">
+ <span class="ui-icon ui-icon-plus">
</span>
- <span class="gAlbumText <?= $peer->id == $album->id ? "selected" : "" ?>"
- ref="<?= $peer->id ?>">
- <?= p::clean($peer->title) ?>
+ <span class="gAlbumText" ref="<?= $child->id ?>">
+ <?= p::clean($child->title) ?>
</span>
-
- <? if ($peer->id == $album->id): ?>
- <ul class="ui-icon-plus">
- <? foreach ($album->children(null, 0, array("type" => "album")) as $child): ?>
- <li class="gOrganizeAlbum ui-icon-left <?= access::can("edit", $child) ? "" : "gViewOnly" ?>"
- ref="<?= $child->id ?>">
- <span class="ui-icon ui-icon-plus">
- </span>
- <span class="gAlbumText"
- ref="<?= $child->id ?>">
- <?= p::clean($child->title) ?>
- </span>
- </li>
- <? endforeach ?>
- </ul>
- <? endif ?>
</li>
<? endforeach ?>
-
- <? foreach ($parents as $parent): ?>
</ul>
</li>
-<? endforeach ?>
+
diff --git a/modules/server_add/helpers/server_add_event.php b/modules/server_add/helpers/server_add_event.php
index 6b21ec2e..b9dd8c28 100644
--- a/modules/server_add/helpers/server_add_event.php
+++ b/modules/server_add/helpers/server_add_event.php
@@ -31,15 +31,11 @@ class server_add_event_Core {
$paths = unserialize(module::get_var("server_add", "authorized_paths"));
if ($item && user::active()->admin && $item->is_album() && !empty($paths)) {
- // This is a little tricky. Normally there's an "Add Photo" menu option, but we want to
- // turn that into a dropdown if there are two different ways to add things. Do that in a
- // portable way for now. If we find ourselves duplicating this pattern, we should make an
- // API method for this.
- $add_menu = $menu->get("add_menu");
- $add_menu->append(Menu::factory("dialog")
- ->id("server_add")
- ->label(t("Server add"))
- ->url(url::site("server_add/browse/$item->id")));
+ $menu->get("add_menu")
+ ->append(Menu::factory("dialog")
+ ->id("server_add")
+ ->label(t("Server add"))
+ ->url(url::site("server_add/browse/$item->id")));
}
}
}