summaryrefslogtreecommitdiff
path: root/modules/gallery
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery')
-rw-r--r--modules/gallery/controllers/albums.php4
-rw-r--r--modules/gallery/controllers/movies.php2
-rw-r--r--modules/gallery/controllers/photos.php2
-rw-r--r--modules/gallery/controllers/quick.php4
-rw-r--r--modules/gallery/helpers/gallery_event.php12
-rw-r--r--modules/gallery/helpers/item.php6
-rw-r--r--modules/gallery/helpers/theme.php3
-rw-r--r--modules/gallery/libraries/Theme_View.php15
8 files changed, 26 insertions, 22 deletions
diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php
index 4e37649c..e67df6f6 100644
--- a/modules/gallery/controllers/albums.php
+++ b/modules/gallery/controllers/albums.php
@@ -26,7 +26,7 @@ class Albums_Controller extends Items_Controller {
$page_size = module::get_var("gallery", "page_size", 9);
if (!access::can("view", $album)) {
if ($album->id == 1) {
- $view = new Theme_View("page.html", "login");
+ $view = new Theme_View("page.html", "other", "login");
$view->page_title = t("Log in to Gallery");
$view->content = new View("login_ajax.html");
$view->content->form = auth::get_login_form("login/auth_html");
@@ -64,7 +64,7 @@ class Albums_Controller extends Items_Controller {
url::redirect($album->abs_url("page=$max_pages"));
}
- $template = new Theme_View("page.html", "album");
+ $template = new Theme_View("page.html", "collection", "album");
$template->set_global("page", $page);
$template->set_global("max_pages", $max_pages);
$template->set_global("page_size", $page_size);
diff --git a/modules/gallery/controllers/movies.php b/modules/gallery/controllers/movies.php
index 5e78376b..2e2e837c 100644
--- a/modules/gallery/controllers/movies.php
+++ b/modules/gallery/controllers/movies.php
@@ -35,7 +35,7 @@ class Movies_Controller extends Items_Controller {
list ($next_item) = $movie->parent()->viewable()->children(1, $position, $where);
}
- $template = new Theme_View("page.html", "movie");
+ $template = new Theme_View("page.html", "item", "movie");
$template->set_global("item", $movie);
$template->set_global("children", array());
$template->set_global("children_count", 0);
diff --git a/modules/gallery/controllers/photos.php b/modules/gallery/controllers/photos.php
index b9adfd90..0c2ff6ee 100644
--- a/modules/gallery/controllers/photos.php
+++ b/modules/gallery/controllers/photos.php
@@ -35,7 +35,7 @@ class Photos_Controller extends Items_Controller {
list ($next_item) = $photo->parent()->viewable()->children(1, $position, $where);
}
- $template = new Theme_View("page.html", "photo");
+ $template = new Theme_View("page.html", "item", "photo");
$template->set_global("item", $photo);
$template->set_global("children", array());
$template->set_global("children_count", 0);
diff --git a/modules/gallery/controllers/quick.php b/modules/gallery/controllers/quick.php
index a1e7dcc3..f2a77033 100644
--- a/modules/gallery/controllers/quick.php
+++ b/modules/gallery/controllers/quick.php
@@ -55,7 +55,7 @@ class Quick_Controller extends Controller {
}
}
- if (Input::instance()->get("page_type") == "album") {
+ if (Input::instance()->get("page_type") == "collection") {
print json_encode(
array("src" => $item->thumb_url() . "?rnd=" . rand(),
"width" => $item->thumb_width,
@@ -118,7 +118,7 @@ class Quick_Controller extends Controller {
$item->delete();
message::success($msg);
- if (Input::instance()->get("page_type") == "album") {
+ if (Input::instance()->get("page_type") == "collection") {
print json_encode(array("result" => "success", "reload" => 1));
} else {
print json_encode(array("result" => "success",
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index cd72d01e..3139951f 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -98,7 +98,7 @@ class gallery_event_Core {
}
static function user_menu($menu, $theme) {
- if ($theme->page_type != "login") {
+ if ($theme->page_subtype != "login") {
$user = identity::active_user();
if ($user->guest) {
$menu->append(Menu::factory("dialog")
@@ -125,7 +125,7 @@ class gallery_event_Core {
}
static function site_menu($menu, $theme) {
- if ($theme->page_type != "login") {
+ if ($theme->page_subtype != "login") {
$menu->append(Menu::factory("link")
->id("home")
->label(t("Home"))
@@ -271,6 +271,7 @@ class gallery_event_Core {
if (access::can("edit", $item)) {
$page_type = $theme->page_type();
+ $page_subtype = $theme->page_subtype();
switch ($item->type) {
case "movie":
$edit_title = t("Edit this movie");
@@ -298,7 +299,6 @@ class gallery_event_Core {
->css_class("ui-icon-pencil")
->url(url::site("quick/form_edit/$item->id?page_type=$page_type")));
-
if ($item->is_photo() && graphics::can("rotate")) {
$options_menu
->append(
@@ -319,9 +319,9 @@ class gallery_event_Core {
->url(url::site("quick/rotate/$item->id/cw?csrf=$csrf&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 ($page_type == "album") {
+ // @todo Don't move photos from the photo page; we don't yet have a good way of redirecting
+ // after move
+ if ($page_subtype == "album") {
$options_menu
->append(Menu::factory("dialog")
->id("move")
diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php
index b3b6d0bb..8f96c3d9 100644
--- a/modules/gallery/helpers/item.php
+++ b/modules/gallery/helpers/item.php
@@ -124,11 +124,7 @@ class item_Core {
* @return string form
*/
static function get_delete_form($item) {
- if (Input::instance()->get("page_type") == "album") {
- $page_type = "album";
- } else {
- $page_type = "photo";
- }
+ $page_type = Input::instance()->get("page_type");
$form = new Forge(
"quick/delete/$item->id?page_type=$page_type", "", "post", array("id" => "g-confirm-delete"));
$form->hidden("_method")->value("put");
diff --git a/modules/gallery/helpers/theme.php b/modules/gallery/helpers/theme.php
index da57a37e..5a3a328a 100644
--- a/modules/gallery/helpers/theme.php
+++ b/modules/gallery/helpers/theme.php
@@ -38,7 +38,8 @@ class theme_Core {
if (!(identity::active_user()->admin && $theme_name = $input->get("theme"))) {
$theme_name = module::get_var(
"gallery",
- !strncmp($path, "/admin", 6) ? "active_admin_theme" : "active_site_theme");
+ $path == "/admin" || !strncmp($path, "/admin/", 7) ?
+ "active_admin_theme" : "active_site_theme");
}
$modules = Kohana::config("core.modules");
array_unshift($modules, THEMEPATH . $theme_name);
diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php
index e98914c4..07ba3bbf 100644
--- a/modules/gallery/libraries/Theme_View.php
+++ b/modules/gallery/libraries/Theme_View.php
@@ -23,11 +23,12 @@ class Theme_View_Core extends Gallery_View {
*
* @throws Kohana_Exception if the requested view cannot be found
* @param string $name view name
- * @param string $page_type page type: album, photo, tags, etc
+ * @param string $page_type page type: collection, item, or other
+ * @param string $page_subtype page sub type: album, photo, tags, etc
* @param string $theme_name view name
* @return void
*/
- public function __construct($name, $page_type) {
+ public function __construct($name, $page_type, $page_subtype) {
$theme_name = module::get_var("gallery", "active_site_theme");
if (!file_exists(THEMEPATH . $theme_name)) {
module::set_var("gallery", "active_site_theme", "wind");
@@ -45,8 +46,9 @@ class Theme_View_Core extends Gallery_View {
$this->set_global("theme", $this);
$this->set_global("user", identity::active_user());
$this->set_global("page_type", $page_type);
+ $this->set_global("page_subtype", $page_subtype);
$this->set_global("page_title", null);
- if ($page_type == "album") {
+ if ($page_type == "collection") {
$this->set_global("thumb_proportion", $this->thumb_proportion());
}
@@ -78,6 +80,10 @@ class Theme_View_Core extends Gallery_View {
return $this->page_type;
}
+ public function page_subtype() {
+ return $this->page_subtype;
+ }
+
public function user_menu() {
$menu = Menu::factory("root")
->css_id("g-login-menu")
@@ -143,12 +149,13 @@ class Theme_View_Core extends Gallery_View {
public function paginator() {
$v = new View("paginator.html");
$v->page_type = $this->page_type;
+ $v->page_subtype = $this->page_subtype;
$v->first_page_url = null;
$v->previous_page_url = null;
$v->next_page_url = null;
$v->last_page_url = null;
- if ($this->page_type == "album" || $this->page_type == "tag") {
+ if ($this->page_type == "collection") {
$v->page = $this->page;
$v->max_pages = $this->max_pages;
$v->total = $this->children_count;