Permalink
Browse files

Get rid of the move dialog and move option. Instead, replace it with

a call to Organize with the appropriate album open.  I have not yet
figured out how to get the SWF code to highlight the active image, but
that's coming.  Partial fix for #1204.
  • Loading branch information...
1 parent 91fab0f commit 04add75f6ff7596319b01c635cb62fafacf504cf @bharat bharat committed Aug 22, 2010
@@ -1,71 +0,0 @@
-<?php defined("SYSPATH") or die("No direct script access.");
-/**
- * Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2010 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 Move_Controller extends Controller {
- public function browse($source_id) {
- $source = ORM::factory("item", $source_id);
- access::required("view", $source);
- access::required("edit", $source);
-
- $view = new View("move_browse.html");
- $view->source = $source;
- $view->tree = $this->_get_tree_html($source, ORM::factory("item", 1));
- print $view;
- }
-
- public function save($source_id) {
- access::verify_csrf();
- $source = ORM::factory("item", $source_id);
- $target = ORM::factory("item", Input::instance()->post("target_id"));
-
- access::required("view", $source);
- access::required("edit", $source);
- access::required("view", $target);
- access::required("edit", $target);
-
- item::move($source, $target);
-
- json::reply(array("result" => "success", "location" => $target->url()));
- }
-
- public function show_sub_tree($source_id, $target_id) {
- $source = ORM::factory("item", $source_id);
- $target = ORM::factory("item", $target_id);
- access::required("view", $source);
- access::required("edit", $source);
- access::required("view", $target);
- // show targets even if they're not editable because they may contain children which *are*
- // editable
-
- print $this->_get_tree_html($source, $target);
- }
-
- private function _get_tree_html($source, $target) {
- $view = new View("move_tree.html");
- $view->source = $source;
- $view->parent = $target;
- $view->children = ORM::factory("item")
- ->viewable()
- ->where("type", "=", "album")
- ->where("parent_id", "=", $target->id)
- ->find_all();
- return $view;
- }
-
-}
@@ -447,7 +447,6 @@ static function context_menu($menu, $theme, $item, $thumb_css_selector) {
break;
}
$cover_title = t("Choose as the album cover");
- $move_title = t("Move to another album");
$csrf = access::csrf_token();
@@ -478,17 +477,6 @@ static function context_menu($menu, $theme, $item, $thumb_css_selector) {
->url(url::site("quick/rotate/$item->id/cw?csrf=$csrf&amp;from_id={$theme_item->id}&amp;page_type=$page_type")));
}
- // @todo Don't move photos from the photo page; we don't yet have a good way of redirecting
- // after move
- if ($theme->page_subtype() == "album") {
- $options_menu
- ->append(Menu::factory("dialog")
- ->id("move")
- ->label($move_title)
- ->css_class("ui-icon-folder-open")
- ->url(url::site("move/browse/$item->id")));
- }
-
$parent = $item->parent();
if (access::can("edit", $parent)) {
// We can't make this item the highlight if it's an album with no album cover, or if it's
@@ -1,50 +0,0 @@
-<?php defined("SYSPATH") or die("No direct script access.") ?>
-<div>
-<script type="text/javascript">
- var load_tree = function(target_id, locked) {
- var load_url = "<?= url::site("move/show_sub_tree/{$source->id}/__TARGETID__") ?>";
- var node = $("#node_" + target_id);
- $("#g-move .node a").removeClass("selected");
- node.find("a:first").addClass("selected");
- if (locked) {
- $("#g-move-button").attr("disabled", "disabled");
- $("#g-move form input[name=target_id]").attr("value", "");
- } else {
- $("#g-move-button").removeAttr("disabled");
- $("#g-move form input[name=target_id]").attr("value", target_id);
- }
- var sub_tree = $("#tree_" + target_id);
- if (sub_tree.length) {
- sub_tree.toggle();
- } else {
- $.get(load_url.replace("__TARGETID__", target_id), {},
- function(data) {
- node.html(data);
- node.find("a:first").addClass("selected");
- });
- }
- }
-</script>
-<h1 style="display:none" >
- <? if ($source->type == "photo"): ?>
- <?= t("Move this photo to a new album") ?>
- <? elseif ($source->type == "movie"): ?>
- <?= t("Move this movie to a new album") ?>
- <? elseif ($source->type == "album"): ?>
- <?= t("Move this album to a new album") ?>
- <? endif ?>
-</h1>
-<div id="g-move">
- <ul id="tree_0">
- <li id="node_1" class="node">
- <?= $tree ?>
- </li>
- </ul>
- <form method="post" action="<?= url::site("move/save/$source->id") ?>">
- <?= access::csrf_form_field() ?>
- <input type="hidden" name="target_id" value="" />
- <input type="submit" id="g-move-button" value="<?= t("Move")->for_html_attr() ?>"
- disabled="disabled" class="submit" />
- </form>
-</div>
-</div>
@@ -1,19 +0,0 @@
-<?php defined("SYSPATH") or die("No direct script access.") ?>
-<?= $parent->thumb_img(array(), 25); ?>
-<? if (!access::can("edit", $parent) || $source->contains($parent)): ?>
-<a href="javascript:load_tree('<?= $parent->id ?>',1)"> <?= html::clean($parent->title) ?> <?= t("(locked)") ?> </a>
-<? else: ?>
-<a href="javascript:load_tree('<?= $parent->id ?>',0)"> <?= html::clean($parent->title) ?></a>
-<? endif ?>
-<ul id="tree_<?= $parent->id ?>">
- <? foreach ($children as $child): ?>
- <li id="node_<?= $child->id ?>" class="node">
- <?= $child->thumb_img(array(), 25); ?>
- <? if (!access::can("edit", $child) || $source->contains($child)): ?>
- <a href="javascript:load_tree('<?= $child->id ?>',1)"> <?= html::clean($child->title) ?> <?= t("(locked)") ?></a>
- <? else: ?>
- <a href="javascript:load_tree('<?= $child->id ?>',0)"> <?= html::clean($child->title) ?> </a>
- <? endif ?>
- </li>
- <? endforeach ?>
-</ul>
@@ -42,6 +42,7 @@ function dialog($album_id) {
$v->file_filter = addslashes($file_filter);
$v->sort_order = addslashes(json_encode($sort_order));
$v->sort_fields = addslashes(json_encode($sort_fields));
+ $v->selected_id = Input::instance()->get("selected_id", null);
$v->rest_uri = url::site("rest") . "/";
$v->controller_uri = url::site("organize") . "/";
$v->swf_uri = url::file("modules/organize/lib/Gallery3WebClient.swf?") .
@@ -32,13 +32,23 @@ static function site_menu($menu, $theme) {
}
static function context_menu($menu, $theme, $item) {
- if ($item->is_album() && access::can("edit", $item)) {
- $menu->get("options_menu")
- ->append(Menu::factory("dialog")
- ->id("organize")
- ->label(t("Organize album"))
- ->css_class("ui-icon-folder-open g-organize-link")
- ->url(url::site("organize/dialog/{$item->id}")));
+ if (access::can("edit", $item)) {
+ if ($item->is_album()) {
+ $menu->get("options_menu")
+ ->append(Menu::factory("dialog")
+ ->id("organize")
+ ->label(t("Organize album"))
+ ->css_class("ui-icon-folder-open g-organize-link")
+ ->url(url::site("organize/dialog/{$item->id}")));
+ } else {
+ $parent = $item->parent();
+ $menu->get("options_menu")
+ ->append(Menu::factory("dialog")
+ ->id("move")
+ ->label(t("Move to another album"))
+ ->css_class("ui-icon-folder-open g-organize-link")
+ ->url(url::site("organize/dialog/{$parent->id}?selected_id={$item->id}")));
+ }
}
}
@@ -94,6 +94,7 @@ function getGalleryParameters() {
sortOrder: "<?= $sort_order ?>",
sortFields: "<?= $sort_fields ?>",
albumId: "<?= $album->id ?>",
+ selectedId: "<?= $selected_id ?>",
restUri: "<?= $rest_uri ?>",
controllerUri: "<?= $controller_uri ?>"
};

0 comments on commit 04add75

Please sign in to comment.