summaryrefslogtreecommitdiff
path: root/modules/gallery/views
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-06-22 20:46:40 +0800
committerTim Almdal <tnalmdal@shaw.ca>2009-06-22 21:08:35 +0800
commitfa4bb5b7ac89bbbd0325e5c336c2e9b31f59d12b (patch)
treea26e8a4ceae58aa24f8cbbe5c81d4c2479d6d969 /modules/gallery/views
parent49975f10b9982d95b36681be536f3f70fa46dbf4 (diff)
Change the quick pan from static to dynamic. This allows modules to add buttons to the
quick pane. The quick pane is now divided into 4 sections: left, center, right and additional. Additional items appear in the drop down box. Buttons are not sorted within the groupings. In addition, the quick pane will overflow onto the "additional" dropdown if there is not enough room to display all the buttons. The use case is the digibug printing module needed to add a button to the quick pane, and I don't like putting code into core that says if module is active... That's another one of those code smells :-) Signed-off-by: Tim Almdal <tnalmdal@shaw.ca>
Diffstat (limited to 'modules/gallery/views')
-rw-r--r--modules/gallery/views/quick_pane.html.php103
1 files changed, 12 insertions, 91 deletions
diff --git a/modules/gallery/views/quick_pane.html.php b/modules/gallery/views/quick_pane.html.php
index f50e1abe..eabf4a67 100644
--- a/modules/gallery/views/quick_pane.html.php
+++ b/modules/gallery/views/quick_pane.html.php
@@ -1,85 +1,14 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
-<? if ($item->type == "photo"): ?>
-<? $title = t("Edit this photo") ?>
-<? elseif ($item->type == "movie"): ?>
-<? $title = t("Edit this movie") ?>
-<? elseif ($item->type == "album"): ?>
-<? $title = t("Edit this album") ?>
-<? endif ?>
-<a class="gDialogLink gButtonLink ui-corner-all ui-state-default" href="<?= url::site("quick/form_edit/$item->id?page_type=$page_type") ?>"
- title="<?= $title ?>">
- <span class="ui-icon ui-icon-pencil">
- <?= $title ?>
- </span>
-</a>
-
-<? if ($item->is_photo() && graphics::can("rotate")): ?>
-<a class="gButtonLink ui-corner-all ui-state-default" href="<?= url::site("quick/rotate/$item->id/ccw?csrf=$csrf&page_type=$page_type") ?>"
- 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" href="<?= url::site("quick/rotate/$item->id/cw?csrf=$csrf&page_type=$page_type") ?>"
- title="<?= t("Rotate 90 degrees clockwise") ?>">
- <span class="ui-icon ui-icon-rotate-cw">
- <?= t("Rotate 90 degrees clockwise") ?>
+<? foreach ($button_list->main as $button): ?>
+<a class="<?= $button->class ?> ui-corner-all ui-state-default" href="<?= $button->href ?>"
+ title="<?= $button->title ?>">
+ <span class="ui-icon <?= $button->icon ?>">
+ <?= $button->title ?>
</span>
</a>
-<? endif ?>
+<? endforeach ?>
-<? // Don't move photos from the photo page; we don't yet have a good way of redirecting after move ?>
-<? if ($page_type == "album"): ?>
-<? if ($item->type == "photo"): ?>
-<? $title = t("Move this photo to another album") ?>
-<? elseif ($item->type == "movie"): ?>
-<? $title = t("Move this movie to another album") ?>
-<? elseif ($item->type == "album"): ?>
-<? $title = t("Move this album to another album") ?>
-<? endif ?>
-<a class="gDialogLink gButtonLink ui-corner-all ui-state-default" href="<?= url::site("move/browse/$item->id") ?>"
- title="<?= $title ?>">
- <span class="ui-icon ui-icon-folder-open">
- <?= $title ?>
- </span>
-</a>
-<? endif ?>
-
-<? $disabledState = "" ?>
-<? if (access::can("edit", $item->parent())): ?>
-<? if ($item->type == "photo"): ?>
-<? $title = t("Choose this photo as the album cover") ?>
-<? elseif ($item->type == "movie"): ?>
-<? $title = t("Choose this movie as the album cover") ?>
-<? elseif ($item->type == "album"): ?>
-<? if (empty($item->album_cover_item_id)): ?>
-<? $disabledState = empty($item->album_cover_item_id) ? " ui-state-disabled" : "" ?>
-<? endif ?>
-<? $title = t("Choose this album as the album cover") ?>
-<? endif ?>
-<a class="gButtonLink ui-corner-all ui-state-default<?= $disabledState ?>" href="<?= url::site("quick/make_album_cover/$item->id?csrf=$csrf&page_type=$page_type") ?>"
- title="<?= $title ?>">
- <span class="ui-icon ui-icon-star">
- <?= $title ?>
- </span>
-</a>
-
-<? if ($item->type == "photo"): ?>
-<? $title = t("Delete this photo") ?>
-<? elseif ($item->type == "movie"): ?>
-<? $title = t("Delete this movie") ?>
-<? elseif ($item->type == "album"): ?>
-<? $title = t("Delete this album") ?>
-<? endif ?>
-<a class="gDialogLink gButtonLink ui-corner-all ui-state-default" href="<?= url::site("quick/form_delete/$item->id?page_type=$page_type") ?>" id="gQuickDelete" title="<?= $title ?>">
- <span class="ui-icon ui-icon-trash">
- <?= $title ?>
- </span>
-</a>
-<? endif ?>
-
-<? if ($item->is_album()): ?>
+<? if (!empty($button_list->additional)): ?>
<a class="gButtonLink ui-corner-all ui-state-default options" href="#" title="<?= t("additional options") ?>">
<span class="ui-icon ui-icon-triangle-1-s">
<?= t("Additional options") ?>
@@ -87,19 +16,11 @@
</a>
<ul id="gQuickPaneOptions" style="display: none">
- <li><a class="add_item gDialogLink" href="<?= url::site("simple_uploader/app/$item->id") ?>"
- title="<?= t("Add a photo") ?>">
- <?= t("Add a photo") ?>
- </a></li>
-
- <li><a class="add_album gDialogLink" href="<?= url::site("form/add/albums/$item->id?type=album") ?>"
- title="<?= t("Add an album") ?>">
- <?= t("Add an album") ?>
- </a></li>
-
- <li><a class="permissions gDialogLink" href="<?= url::site("permissions/browse/$item->id") ?>"
- title="<?= t("Edit permissions") ?>">
- <?= t("Edit permissions") ?>
+ <? foreach ($button_list->additional as $button): ?>
+ <li><a class="<?= $button->class ?>" href="<?= $button->href ?>"
+ title="<?= $button->title ?>">
+ <?= $button->title ?>
</a></li>
+ <? endforeach ?>
</ul>
<? endif ?>