diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-05-21 01:31:29 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-05-21 01:31:29 +0000 |
commit | a9e3692027dc767b340242ed18fe7184cbfd883d (patch) | |
tree | 125e9d3cdb28c5acdd34e1bc15fe80df030bf8e7 | |
parent | f24c8f66ea9673d812c882dd7db6fbe49bd01dfb (diff) |
1) This provides the editting functionality for albums and photos in the
organize feature.
2) Remove the tag functionality at this point
3) Added a callback to handle validating conflicting names (only used
by organize at this point.
4) Closes #231
-rw-r--r-- | core/controllers/core_organize.php | 99 | ||||
-rw-r--r-- | core/helpers/core_event.php | 13 | ||||
-rw-r--r-- | core/helpers/core_organize.php | 63 | ||||
-rw-r--r-- | core/helpers/item.php | 20 | ||||
-rw-r--r-- | core/views/organize_edit_general.html.php | 15 | ||||
-rw-r--r-- | core/views/organize_edit_sort.html.php | 11 | ||||
-rw-r--r-- | modules/organize/css/organize.css | 6 | ||||
-rw-r--r-- | modules/organize/js/organize.js | 141 | ||||
-rw-r--r-- | modules/organize/views/organize.html.php | 25 | ||||
-rw-r--r-- | modules/organize/views/organize_button_pane.html.php | 75 | ||||
-rw-r--r-- | modules/organize/views/organize_edit.html.php | 10 | ||||
-rw-r--r-- | modules/tag/helpers/tag_event.php | 34 | ||||
-rw-r--r-- | modules/tag/views/tag_organize.html.php | 25 |
13 files changed, 350 insertions, 187 deletions
diff --git a/core/controllers/core_organize.php b/core/controllers/core_organize.php new file mode 100644 index 00000000..99f8b199 --- /dev/null +++ b/core/controllers/core_organize.php @@ -0,0 +1,99 @@ +<?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 Core_Organize_Controller extends Controller { + public function general() { + access::verify_csrf(); + + $itemids = Input::instance()->post("item"); + $item = ORM::factory("item") + ->in("id", $itemids[0]) + ->find(); + access::required("edit", $item); + + $form = core_organize::getGeneralEditForm($item); + if ($form->validate()) { + $orig = clone $item; + $item->title = $form->title->value; + $item->description = $form->description->value; + $item->rename($form->dirname->value); + $item->save(); + + module::event("item_updated", $orig, $item); + + if ($item->is_album()) { + log::success("content", "Updated album", "<a href=\"albums/$item->id\">view</a>"); + $message = t("Saved album %album_title", array("album_title" => $item->title)); + } else { + log::success("content", "Updated photo", "<a href=\"photos/$item->id\">view</a>"); + $message = t("Saved photo %photo_title", array("photo_title" => $item->title)); + } + print json_encode(array("form" => $form->__toString(), "message" => $message)); + } else { + print json_encode(array("form" => $form->__toString())); + } + } + + public function sort() { + access::verify_csrf(); + + $itemids = Input::instance()->post("item"); + $item = ORM::factory("item") + ->in("id", $itemids[0]) + ->find(); + access::required("edit", $item); + + $form = core_organize::getSortEditForm($item); + if ($form->validate()) { + $orig = clone $item; + $item->sort_column = $form->column->value; + $item->sort_order = $form->direction->value; + $item->save(); + + module::event("item_updated", $orig, $item); + + log::success("content", "Updated album", "<a href=\"albums/$item->id\">view</a>"); + $message = t("Saved album %album_title", array("album_title" => $item->title)); + print json_encode(array("form" => $form->__toString(), "message" => $message)); + } else { + print json_encode(array("form" => $form->__toString())); + } + } + + public function reset_general() { + $itemids = Input::instance()->get("item"); + $item = ORM::factory("item") + ->in("id", $itemids[0]) + ->find(); + access::required("edit", $item); + + print core_organize::getGeneralEditForm($item); + } + + public function reset_sort() { + $itemids = Input::instance()->get("item"); + $item = ORM::factory("item") + ->in("id", $itemids[0]) + ->find(); + access::required("edit", $item); + + print core_organize::getSortEditForm($item); + } + +} diff --git a/core/helpers/core_event.php b/core/helpers/core_event.php index c9e4e743..d1869360 100644 --- a/core/helpers/core_event.php +++ b/core/helpers/core_event.php @@ -44,19 +44,12 @@ class core_event_Core { ->in("id", $event_parms->itemids[0]) ->find(); - $generalPane = new View("organize_edit_general.html"); - $generalPane->item = $item; - $event_parms->panes[] = array("label" => $item->is_album() ? t("Edit Album") : t("Edit Photo"), - "content" => $generalPane); + "content" => core_organize::getGeneralEditForm($item)); if ($item->is_album()) { - $sortPane = new View("organize_edit_sort.html"); - $sortPane->sort_by = $item->sort_column; - $sortPane->sort_order = - empty($item->sort_order) || $item->sort_order == "ASC" ? t("Ascending") : t("Descending"); - - $event_parms->panes[] = array("label" => t("Sort Order"), "content" => $sortPane); + $event_parms->panes[] = array("label" => t("Sort Order"), + "content" => core_organize::getSortEditForm($item)); } } diff --git a/core/helpers/core_organize.php b/core/helpers/core_organize.php new file mode 100644 index 00000000..6ccc0197 --- /dev/null +++ b/core/helpers/core_organize.php @@ -0,0 +1,63 @@ +<?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 core_organize_Core { + static function getGeneralEditForm($item) { + $generalPane = new Forge("core_organize/__FUNCTION__", "", "post", + array("id" => "gEditGeneral", "ref" => "general")); + // In this case we know there is only 1 item, but in general we should loop + // and create multiple hidden items. + $generalPane->hidden("item[]")->value($item->id); + $generalPane->input("title")->label(t("Title"))->value($item->title); + $generalPane->textarea("description")->label(t("Description"))->value($item->description); + $generalPane->input("dirname")->label(t("Path Name"))->value($item->name) + ->callback("item::validate_no_slashes") + ->error_messages("no_slashes", t("The directory name can't contain a \"/\"")) + ->callback("item::validate_no_trailing_period") + ->error_messages("no_trailing_period", t("The directory name can't end in \".\"")) + ->callback("item::validate_no_name_conflict") + ->error_messages("conflict", t("The path name is not unique")); + + return $generalPane; + } + + static function getSortEditForm($item) { + $sortPane = new Forge("core_organize/__FUNCTION__", "", "post", + array("id" => "gEditSort", "ref" => "sort")); + $sortPane->hidden("item[]")->value($item->id); + $sortPane->dropdown("column", array("id" => "gAlbumSortColumn")) + ->label(t("Sort by")) + ->options(array("weight" => t("Default"), + "captured" => t("Capture Date"), + "created" => t("Creation Date"), + "title" => t("Title"), + "updated" => t("Updated Date"), + "view_count" => t("Number of views"), + "rand_key" => t("Random"))) + ->selected($item->sort_column); + $sortPane->dropdown("direction", array("id" => "gAlbumSortDirection")) + ->label(t("Order")) + ->options(array("ASC" => t("Ascending"), + "DESC" => t("Descending"))) + ->selected($item->sort_order); + + return $sortPane; + } +} diff --git a/core/helpers/item.php b/core/helpers/item.php index 8ff09535..7daaf1e1 100644 --- a/core/helpers/item.php +++ b/core/helpers/item.php @@ -79,9 +79,27 @@ class item_Core { } } - static function validate_no_trailing_period($input) { + static function validate_no_trailing_period($input) { if (rtrim($input->value, ".") !== $input->value) { $input->add_error("no_trailing_period", 1); } } + + static function validate_no_name_conflict($input) { + $itemid = Input::instance()->post("item"); + if (is_array($itemid)) { + $itemid = $itemid[0]; + } + $item = ORM::factory("item") + ->in("id", $itemid) + ->find(); + if (Database::instance() + ->from("items") + ->where("parent_id", $item->parent_id) + ->where("id <>", $item->id) + ->where("name", $input->value) + ->count_records()) { + $input->add_error("conflict", 1); + } + } }
\ No newline at end of file diff --git a/core/views/organize_edit_general.html.php b/core/views/organize_edit_general.html.php deleted file mode 100644 index 84e666d8..00000000 --- a/core/views/organize_edit_general.html.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php defined("SYSPATH") or die("No direct script access.") ?> -<ul> - <li> - <label for="title"><?= t("Title") ?></label> - <div id="title" type="text" class="textbox" ><?= $item->title ?></div> - </li> - <li> - <label for="description"><?= t("Description") ?></label> - <div id="description" class="textarea" ><?= $item->description ?></div> - </li> - <li> - <label for="dirname"><?= t("Directory Name") ?></label> - <div id="dirname" type="text" class="textbox" ><?= $item->name ?></div> - </li> -</ul> diff --git a/core/views/organize_edit_sort.html.php b/core/views/organize_edit_sort.html.php deleted file mode 100644 index 1151b014..00000000 --- a/core/views/organize_edit_sort.html.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php defined("SYSPATH") or die("No direct script access.") ?> -<ul> - <li> - <label for="sortby"><?= t("Sort By") ?></label> - <div id="sortby" class="textbox"><?= $sort_by ?></div> - </li> - <li> - <label for="sortorder"><?= t("Sort Order") ?></label> - <div id="sortorder" class="textbox"><?= $sort_order ?></div> - </li> -</ul> diff --git a/modules/organize/css/organize.css b/modules/organize/css/organize.css index cef25f1c..0fdf5aef 100644 --- a/modules/organize/css/organize.css +++ b/modules/organize/css/organize.css @@ -170,12 +170,18 @@ width: 15px; } +#gOrganizeEditHandleButtonsMiddle, #gOrganizeEditHandleButtonsLeft { float: left; height: 20px; padding: 2px 10px; } +#gOrganizeEditHandleButtonsMiddle { + margin-left: 20px; +} + +#gOrganizeEditHandleButtonsMiddle a, #gOrganizeEditHandleButtonsLeft a { float: left; margin: 0 2.5px; diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index 538e366d..30b3f8b6 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -150,9 +150,7 @@ var selectable = { setDrawerButtonState(); }, stop: function(event, ui) { - if ($("#gMicroThumbGrid li.ui-selected").length > 0) { - getEditForm(); - } + getEditForm(); } }; @@ -197,11 +195,21 @@ function drawerHandleButtonsClick(event) { var operation = $(this).attr("ref"); switch (operation) { case "edit": + case "close": $("#gOrganizeEditDrawerPanel").animate( {"height": "toggle", "display": "block"}, {duration: "fast", complete: function() { setSelectedThumbs(); + if (operation == "close") { + $("#gOrganizeEditHandleButtonsLeft a[ref='edit']").css("display", "inline-block"); + $("#gOrganizeEditHandleButtonsLeft a[ref='close']").css("display", "none"); + $("#gOrganizeEditHandleButtonsMiddle a").css("display", "none"); + } else { + $("#gOrganizeEditHandleButtonsLeft a[ref='edit']").css("display", "none"); + $("#gOrganizeEditHandleButtonsLeft a[ref='close']").css("display", "inline-block"); + $("#gOrganizeEditHandleButtonsMiddle a").css("display", "inline-block"); + } }, step: function() { $("#gMicroThumbPanel").height(heightMicroThumbPanel - $(this).height()); @@ -209,22 +217,59 @@ function drawerHandleButtonsClick(event) { }); break; case "select-all": - $(".gMicroThumbContainer").addClass("ui-selected"); + $("#gMicroThumbGrid li").addClass("ui-selected"); $("#gMicroThumbSelectAll").hide(); $("#gMicroThumbUnselectAll").show(); + setDrawerButtonState(); + getEditForm(); break; case "unselect-all": - $(".gMicroThumbContainer").removeClass("ui-selected"); + $("#gMicroThumbGrid li").removeClass("ui-selected"); $("#gMicroThumbSelectAll").show(); $("#gMicroThumbUnselectAll").hide(); + setDrawerButtonState(); break; - case "close": + case "done": $("#gDialog").dialog("close"); break; + case "submit": + var currentTab = $("#gOrganizeEditForm").tabs("option", "selected"); + var form = $("#pane-"+currentTab+" form"); + var url = $(form).attr("action") + .replace("__FUNCTION__", $(form).attr("ref")); + $.ajax({ + data: $(form).serialize(), + dataType: "json", + success: function (data, textStatus) { + if (data.task) { + // @todo if task is sent then create a progress bar and run the task + } else { + $("#pane-"+currentTab).children("form").replaceWith(data.form); + if (data.message) { + $("#pane-"+currentTab + " form").before("<div class=\"gSuccess\">" + data.message +"</div>"); + } + } + }, + type: "POST", + url: url + }); + break; + case "reset": + currentTab = $("#gOrganizeEditForm").tabs("option", "selected"); + form = $("#pane-"+currentTab+" form"); + $.ajax({ + data: serializeItemIds("#gMicroThumbPanel li.ui-selected"), + dataType: "html", + success: function (data, textStatus) { + $("#pane-"+currentTab + " form").replaceWith(data); + }, + type: "GET", + url: $(form).attr("action").replace("__FUNCTION__", "reset_" + $(form).attr("ref")) + }); + break; default: - var postData = serializeItemIds("#gMicroThumbPanel li.ui-selected"); $.ajax({ - data: postData, + data: serializeItemIds("#gMicroThumbPanel li.ui-selected"), dataType: "json", success: operationCallback, type: "POST", @@ -408,25 +453,22 @@ function get_url(uri, parms) { function setDrawerButtonState() { $("#gOrganizeFormThumbStack").empty(); $("#gOrganizeEditForm").empty(); - switch ($("#gMicroThumbGrid li.ui-selected").length) { - case 0: + var selectedCount = $("#gMicroThumbGrid li.ui-selected").length; + if (selectedCount) { + $("#gOrganizeEditHandleButtonsLeft a").removeAttr("disabled"); + $("#gOrganizeEditHandleButtonsLeft a").removeClass("ui-state-disabled"); + + if (selectedCount > 1) { + $("#gOrganizeEditHandleButtonsLeft a[ref='albumCover']").attr("disabled", true); + $("#gOrganizeEditHandleButtonsLeft a[ref='albumCover']").addClass("ui-state-disabled"); + } + setSelectedThumbs(); + } else { if ($("#gOrganizeEditDrawerPanel::visible").length) { - $("#gOrganizeEditHandleButtonsLeft a[ref='edit']").trigger("click"); + $("#gOrganizeEditHandleButtonsLeft a[ref='close']").trigger("click"); } $("#gOrganizeEditHandleButtonsLeft a").attr("disabled", true); $("#gOrganizeEditHandleButtonsLeft a").addClass("ui-state-disabled"); - break; - case 1: - $("#gOrganizeEditHandleButtonsLeft a").removeAttr("disabled"); - $("#gOrganizeEditHandleButtonsLeft a").removeClass("ui-state-disabled"); - setSelectedThumbs(); -// getEditForm(); - break; - default: - $("#gOrganizeEditHandleButtonsLeft a[ref='albumCover']").attr("disabled", true); - $("#gOrganizeEditHandleButtonsLeft a[ref='albumCover']").addClass("ui-state-disabled"); - setSelectedThumbs(); -// getEditForm(); } } @@ -456,17 +498,25 @@ function setSelectedThumbs() { } function getEditForm() { - var postData = ""; - $("li.ui-selected").each(function(i) { - postData += "&item[]=" + $(this).attr("ref"); - }); - var url_data = get_url("organize/editForm", {}) + postData; - $.get(url_data, function(data, textStatus) { + if ($("#gMicroThumbGrid li.ui-selected").length > 0) { + var postData = serializeItemIds("li.ui-selected"); + var url_data = get_url("organize/editForm", {}) + postData; + $.get(url_data, function(data, textStatus) { + $("#gOrganizeEditForm").tabs("destroy"); + $("#gOrganizeEditForm").html(data); + if ($("#gOrganizeEditForm ul li").length) { + $("#gOrganizeEditForm").tabs(); + $("#gOrganizeEditHandleButtonsMiddle a").removeAttr("disabled"); + $("#gOrganizeEditHandleButtonsMiddle a").removeClass("ui-state-disabled"); + } else { + $("#gOrganizeEditHandleButtonsMiddle a").attr("disabled", true); + $("#gOrganizeEditHandleButtonsMiddle a").addClass("ui-state-disabled"); + } + }); + } else { $("#gOrganizeEditForm").tabs("destroy"); - //$("#gOrganizeEditForm").empty(); - $("#gOrganizeEditForm").html(data); - $("#gOrganizeEditForm").tabs(); - }); + $("#gOrganizeEditForm").empty(); + } } function serializeItemIds(selector) { @@ -478,6 +528,16 @@ function serializeItemIds(selector) { return postData; } +function submitCurrentForm(event) { + console.log("submitCurrentForm"); + return false; +} + +function resetCurrentForm(event) { + console.log("resetCurrentForm"); + return false; +} + function createProgressDialog(title) { $("body").append("<div id='gOrganizeProgressDialog'>" + "<div class='gProgressBar'></div>" + @@ -548,12 +608,13 @@ function getViewportSize() { function displayAjaxError(error) { $("body").append("<div id=\"gAjaxError\" title=\"" + FATAL_ERROR + "\">" + error + "</div>"); + $("#gAjaxError").dialog({ - autoOpen: true, - autoResize: false, - modal: true, - resizable: true, - width: 610, - height: $("#gDialog").height() - }); + autoOpen: true, + autoResize: false, + modal: true, + resizable: true, + width: 610, + height: $("#gDialog").height() + }); } diff --git a/modules/organize/views/organize.html.php b/modules/organize/views/organize.html.php index 60c4a524..b1f062a1 100644 --- a/modules/organize/views/organize.html.php +++ b/modules/organize/views/organize.html.php @@ -36,25 +36,18 @@ ref="<?= url::site("organize/content/__ITEM_ID__?width=__WIDTH__&height=__HEIGHT__&offset=__OFFSET__") ?>"> <ul id="gMicroThumbGrid"></ul> </div> - <div id="gOrganizeEditDrawer" class="yui-u"> - <div id="gOrganizeEditDrawerPanel" class="yui-gf"> - <div id="gOrganizeFormThumbs" class="yui-u first"> - <ul id="gOrganizeFormThumbStack" /> - </div> - <div id="gOrganizeEditForm"> - </div> + <div id="gOrganizeEditDrawer" class="yui-u"> + <div id="gOrganizeEditDrawerPanel" class="yui-gf"> + <div id="gOrganizeFormThumbs" class="yui-u first"> + <ul id="gOrganizeFormThumbStack" /> </div> - <div id="gOrganizeEditDrawerHandle"> - <div id="gOrganizeEditHandleButtonsLeft"> - <?= $button_pane ?> - </div> - <div id="gOrganizeEditHandleButtonsRight"> - <a id="gMicroThumbSelectAll" href="#" ref="select-all" class="gButtonLink ui-corner-all ui-state-default"><?= t("Select all") ?></a> - <a id="gMicroThumbUnselectAll" href="#" ref="unselect-all" style="display: none" class="gButtonLink ui-corner-all ui-state-default"><?= t("Deselect all") ?></a> - <a id="gMicroThumbDone" href="#" ref="close" class="gButtonLink ui-corner-all ui-state-default"><?= t("Done") ?></a> - </div> + <div id="gOrganizeEditForm"> </div> </div> + <div id="gOrganizeEditDrawerHandle"> + <?= $button_pane ?> + </div> + </div> </div> </div> </div> diff --git a/modules/organize/views/organize_button_pane.html.php b/modules/organize/views/organize_button_pane.html.php index 9902eafb..cd780d5e 100644 --- a/modules/organize/views/organize_button_pane.html.php +++ b/modules/organize/views/organize_button_pane.html.php @@ -1,39 +1,50 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> +<div id="gOrganizeEditHandleButtonsLeft"> + <a class="gButtonLink ui-corner-all ui-state-default ui-state-disabled" href="#" ref="edit" + disabled="1" title="<?= t("Open Drawer") ?>"> + <span class="ui-icon ui-icon-arrowthickstop-1-n"><?= t("Open Drawer") ?></span> + </a> -<a class="gButtonLink ui-corner-all ui-state-default ui-state-disabled" href="#" ref="edit" - disabled="1" title="<?= t("Edit Selection") ?>"> - <span class="ui-icon ui-icon-pencil"> - <?= t("Edit Selection") ?> - </span> -</a> + <a class="gButtonLink ui-corner-all ui-state-default ui-state-disabled" href="#" ref="close" + disabled="1" title="<?= t("Close Drawer") ?>" style="display: none"> + <span class="ui-icon ui-icon-arrowthickstop-1-s"><?= t("Close Drawer") ?></span> + </a> -<? if (graphics::can("rotate")): ?> -<a class="gButtonLink ui-corner-all ui-state-default ui-state-disabled" href="#" ref="rotateCcw" - disabled="1" title="<?= t("Rotate 90 degrees counter clockwise") ?>"> - <span class="ui-icon ui-icon-rotate-ccw"> - <?= t("Rotate 90 degrees counter clockwise") ?> - </span> -</a> + <? if (graphics::can("rotate")): ?> + <a class="gButtonLink ui-corner-all ui-state-default ui-state-disabled" href="#" ref="rotateCcw" + disabled="1" title="<?= t("Rotate 90 degrees counter clockwise") ?>"> + <span class="ui-icon ui-icon-rotate-ccw"><?= t("Rotate 90 degrees counter clockwise") ?></span> + </a> -<a class="gButtonLink ui-corner-all ui-state-default ui-state-disabled" href="#" ref="rotateCw" - disabled="1" title="<?= t("Rotate 90 degrees clockwise") ?>"> - <span class="ui-icon ui-icon-rotate-cw"> - <?= t("Rotate 90 degrees clockwise") ?> - </span> -</a> -<? endif ?> + <a class="gButtonLink ui-corner-all ui-state-default ui-state-disabled" href="#" ref="rotateCw" + disabled="1" title="<?= t("Rotate 90 degrees clockwise") ?>"> + <span class="ui-icon ui-icon-rotate-cw"> <?= t("Rotate 90 degrees clockwise") ?></span> + </a> + <? endif ?> -<a class="gButtonLink ui-corner-all ui-state-default ui-state-disabled" href="#" ref="albumCover" - disabled="1" title="<?= t("Choose this photo as the album cover") ?>"> - <span class="ui-icon ui-icon-star"> - <?= t("Choose this photo as the album cover") ?> - </span> -</a> + <a class="gButtonLink ui-corner-all ui-state-default ui-state-disabled" href="#" ref="albumCover" + disabled="1" title="<?= t("Choose this photo as the album cover") ?>"> + <span class="ui-icon ui-icon-star"><?= t("Choose this photo as the album cover") ?></span> + </a> -<a class="gButtonLink ui-corner-all ui-state-default ui-state-disabled" href="#" ref="delete" - disabled="1" title="<?= t("Delete selection") ?>"> - <span class="ui-icon ui-icon-trash"> - <?= t("Delete selection") ?> - </span> -</a> + <a class="gButtonLink ui-corner-all ui-state-default ui-state-disabled" href="#" ref="delete" + disabled="1" title="<?= t("Delete selection") ?>"> + <span class="ui-icon ui-icon-trash"><?= t("Delete selection") ?></span> + </a> +</div> +<div id="gOrganizeEditHandleButtonsMiddle"> + <a class="gButtonLink ui-corner-all ui-state-default" href="#" ref="submit" + title="<?= t("Apply Changes") ?>" style="display: none" > + <span class="ui-icon ui-icon-check"><?= t("Apply Changes") ?></span> + </a> + <a class="gButtonLink ui-corner-all ui-state-default" href="#" ref="reset" + title="<?= t("Reset Form") ?>" style="display: none" > + <span class="ui-icon ui-icon-closethick"><?= t("Reset Form") ?></span> + </a> +</div> +<div id="gOrganizeEditHandleButtonsRight"> + <a id="gMicroThumbSelectAll" href="#" ref="select-all" class="gButtonLink ui-corner-all ui-state-default"><?= t("Select all") ?></a> + <a id="gMicroThumbUnselectAll" href="#" ref="unselect-all" style="display: none" class="gButtonLink ui-corner-all ui-state-default"><?= t("Deselect all") ?></a> + <a id="gMicroThumbDone" href="#" ref="done" class="gButtonLink ui-corner-all ui-state-default"><?= t("Done") ?></a> +</div> diff --git a/modules/organize/views/organize_edit.html.php b/modules/organize/views/organize_edit.html.php index c0fc43e5..1adf290f 100644 --- a/modules/organize/views/organize_edit.html.php +++ b/modules/organize/views/organize_edit.html.php @@ -5,6 +5,10 @@ <? endforeach?> </ul> -<? foreach ($panes as $idx => $pane): ?> - <div id="pane-<?= $idx ?>" class="gOrganizeEditPane"><?= $pane["content"] ?></div> -<? endforeach?> +<? if (count($panes) > 0): ?> + <? foreach ($panes as $idx => $pane): ?> + <div id="pane-<?= $idx ?>" class="gOrganizeEditPane ui-tabs-hide"><?= $pane["content"] ?></div> + <? endforeach?> +<? else: ?> +<div class="gWarning"><?= t("No Edit pages apply to the selected items") ?></div> +<? endif ?>
\ No newline at end of file diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php index a13ae99c..735422b5 100644 --- a/modules/tag/helpers/tag_event.php +++ b/modules/tag/helpers/tag_event.php @@ -59,38 +59,4 @@ class tag_event_Core { "SELECT `tag_id` from {items_tags} WHERE `item_id` = $item->id)"); $db->delete("items_tags", array("item_id" => "$item->id")); } - - static function organize_form_creation($event_parms) { - $v = new View("tag_organize.html"); - $v->tags = array(); - - $ids = implode(", ", $event_parms->itemids); - $db = Database::instance(); - $tags = $db->query("SELECT it.tag_id, t.name, - COUNT(DISTINCT it.item_id) as item_count, - UPPER(SUBSTR(t.name, 1, 1)) as first_letter - FROM {items_tags} it, {tags} t - WHERE it.tag_id = t.id - AND it.item_id in($ids) - GROUP BY it.tag_id - ORDER BY first_letter ASC, t.name ASC"); - foreach ($tags as $tag) { - $v->tags[$tag->first_letter]["taglist"][] = - array("id" => $tag->tag_id, "tag" => $tag->name, "count" => $tag->item_count); - } - $v->tag_count = $tags->count(); - - $letters = $db->query("SELECT COUNT(DISTINCT it.item_id) as letter_count, - UPPER(SUBSTR(t.name, 1, 1)) as first_letter - FROM {items_tags} it, {tags} t - WHERE it.tag_id = t.id - AND it.item_id in($ids) - GROUP BY first_letter - ORDER BY first_letter ASC"); - foreach ($letters as $letter) { - $v->tags[$letter->first_letter]["count"] = $letter->letter_count; - } - - $event_parms->panes[] = array("label" => t("Manage Tags"), "content" => $v); - } } diff --git a/modules/tag/views/tag_organize.html.php b/modules/tag/views/tag_organize.html.php deleted file mode 100644 index bb46b861..00000000 --- a/modules/tag/views/tag_organize.html.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php defined("SYSPATH") or die("No direct script access.") ?> -<span id="gTagCount"><?= t2("There is one tag", "There are %count tags", $tag_count) ?></span> -<span id="gAddTag"> - <a id="gAddTagButton" href="#" class="gButtonLink"><?= t("Click to Add Tag") ?></a> -</span> -<? foreach ($tags as $firstLetter => $tagGroup): ?> -<div class="gTagGroup"> - <strong><?= $firstLetter ?></strong><span class="understate"> (<?= $tagGroup["count"] ?>)</span> - <ul> - <? foreach ($tagGroup["taglist"] as $taglist): ?> - <li> - <span id="gTag-<?= $taglist['id'] ?>" class="gEditable tag-name"><?= $taglist["tag"] ?></span> - <span class="understate">(<?= $taglist["count"] ?>)</span> - - <!-- a href="<?= url::site("admin/tags/form_delete/{$taglist['id']}") ?>" - class="gDialogLink delete-link gButtonLink" --> - <a href="#" - class="gDialogLink delete-link gButtonLink"> - <span class="ui-icon ui-icon-trash"><?= t("Delete tag") ?></span> - </a> - </li> - <? endforeach ?> - </ul> -</div> -<? endforeach ?>
\ No newline at end of file |