From a6581ede0b7a50c6159eb5d36cf6be340a072609 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 21 Sep 2009 11:35:27 -0700 Subject: Fix Item_Model::get_position() so that our sort is stable when the comparison row has a null value in the sort field. Fix for #627 Note: this changes get_position() to take an Item_Model instead of an id! --- modules/gallery/controllers/albums.php | 15 +++++++++------ modules/gallery/controllers/photos.php | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index 183c26d0..3ea08538 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -39,12 +39,15 @@ class Albums_Controller extends Items_Controller { $show = $this->input->get("show"); if ($show) { - $index = $album->get_position($show); - $page = ceil($index / $page_size); - if ($page == 1) { - url::redirect($album->abs_url()); - } else { - url::redirect($album->abs_url("page=$page")); + $child = ORM::factory("item", $show); + $index = $album->get_position($child); + if ($index) { + $page = ceil($index / $page_size); + if ($page == 1) { + url::redirect($album->abs_url()); + } else { + url::redirect($album->abs_url("page=$page")); + } } } diff --git a/modules/gallery/controllers/photos.php b/modules/gallery/controllers/photos.php index 79ad674a..e6154535 100644 --- a/modules/gallery/controllers/photos.php +++ b/modules/gallery/controllers/photos.php @@ -25,7 +25,7 @@ class Photos_Controller extends Items_Controller { public function _show($photo) { access::required("view", $photo); - $position = $photo->parent()->get_position($photo->id); + $position = $photo->parent()->get_position($photo); if ($position > 1) { list ($previous_item, $ignore, $next_item) = $photo->parent()->children(3, $position - 2); -- cgit v1.2.3 From 9e6be40e31b06e5dffe7552928cb8b2d9ee7ad59 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 21 Sep 2009 20:47:55 -0700 Subject: Add viewable() protection to children() and children_count() calls. This is not currently necessary (nor is it a security hole) because we don't constrain permissions at the child level in the core, but it makes our security audits easier and will enable the scenario where somebody writes a module to add per-photo permissions. --- modules/gallery/controllers/photos.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/photos.php b/modules/gallery/controllers/photos.php index e6154535..3de9b3ee 100644 --- a/modules/gallery/controllers/photos.php +++ b/modules/gallery/controllers/photos.php @@ -31,7 +31,7 @@ class Photos_Controller extends Items_Controller { $photo->parent()->children(3, $position - 2); } else { $previous_item = null; - list ($next_item) = $photo->parent()->children(1, $position); + list ($next_item) = $photo->parent()->viewable()->children(1, $position); } $template = new Theme_View("page.html", "photo"); @@ -41,7 +41,7 @@ class Photos_Controller extends Items_Controller { $template->set_global("parents", $photo->parents()); $template->set_global("next_item", $next_item); $template->set_global("previous_item", $previous_item); - $template->set_global("sibling_count", $photo->parent()->children_count()); + $template->set_global("sibling_count", $photo->parent()->viewable()->children_count()); $template->set_global("position", $position); $template->content = new View("photo.html"); -- cgit v1.2.3 From 88350c5b88abb8bfc56b26177b64e049f6b7440f Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 21 Sep 2009 21:21:52 -0700 Subject: Update the next/previous item calculations to match what we do in photos.php Force the children_count to be zero, movies have no children. Rename $photo to $movie everywhere. --- modules/gallery/controllers/movies.php | 86 +++++++++++++++------------------- 1 file changed, 38 insertions(+), 48 deletions(-) (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/movies.php b/modules/gallery/controllers/movies.php index 04e15315..fa07668e 100644 --- a/modules/gallery/controllers/movies.php +++ b/modules/gallery/controllers/movies.php @@ -22,42 +22,32 @@ class Movies_Controller extends Items_Controller { /** * @see REST_Controller::_show($resource) */ - public function _show($photo) { - access::required("view", $photo); + public function _show($movie) { + access::required("view", $movie); - // We sort by id ascending so for now, find sibling info by doing id based queries. - $next_item = ORM::factory("item") - ->viewable() - ->where("parent_id", $photo->parent_id) - ->where("id >", $photo->id) - ->orderby("id", "ASC") - ->find(); - $previous_item = ORM::factory("item") - ->viewable() - ->where("parent_id", $photo->parent_id) - ->where("id <", $photo->id) - ->orderby("id", "DESC") - ->find(); - $position = ORM::factory("item") - ->viewable() - ->where("parent_id", $photo->parent_id) - ->where("id <=", $photo->id) - ->count_all(); + $position = $movie->parent()->get_position($movie); + if ($position > 1) { + list ($previous_item, $ignore, $next_item) = + $movie->parent()->children(3, $position - 2); + } else { + $previous_item = null; + list ($next_item) = $movie->parent()->viewable()->children(1, $position); + } $template = new Theme_View("page.html", "movie"); - $template->set_global("item", $photo); + $template->set_global("item", $movie); $template->set_global("children", array()); - $template->set_global("children_count", $photo->children_count()); - $template->set_global("parents", $photo->parents()); - $template->set_global("next_item", $next_item->loaded ? $next_item : null); - $template->set_global("previous_item", $previous_item->loaded ? $previous_item : null); - $template->set_global("sibling_count", $photo->parent()->children_count()); + $template->set_global("children_count", 0); + $template->set_global("parents", $movie->parents()); + $template->set_global("next_item", $next_item); + $template->set_global("previous_item", $previous_item); + $template->set_global("sibling_count", $movie->parent()->viewable()->children_count()); $template->set_global("position", $position); $template->content = new View("movie.html"); - $photo->view_count++; - $photo->save(); + $movie->view_count++; + $movie->save(); print $template; } @@ -65,21 +55,21 @@ class Movies_Controller extends Items_Controller { /** * @see REST_Controller::_update($resource) */ - public function _update($photo) { + public function _update($movie) { access::verify_csrf(); - access::required("view", $photo); - access::required("edit", $photo); + access::required("view", $movie); + access::required("edit", $movie); - $form = photo::get_edit_form($photo); + $form = photo::get_edit_form($movie); if ($valid = $form->validate()) { - if ($form->edit_item->filename->value != $photo->name || - $form->edit_item->slug->value != $photo->slug) { + if ($form->edit_item->filename->value != $movie->name || + $form->edit_item->slug->value != $movie->slug) { // Make sure that there's not a name or slug conflict if ($row = Database::instance() ->select(array("name", "slug")) ->from("items") - ->where("parent_id", $photo->parent_id) - ->where("id <>", $photo->id) + ->where("parent_id", $movie->parent_id) + ->where("id <>", $movie->id) ->open_paren() ->where("name", $form->edit_item->filename->value) ->orwhere("slug", $form->edit_item->slug->value) @@ -98,16 +88,16 @@ class Movies_Controller extends Items_Controller { } if ($valid) { - $photo->title = $form->edit_item->title->value; - $photo->description = $form->edit_item->description->value; - $photo->slug = $form->edit_item->slug->value; - $photo->rename($form->edit_item->filename->value); - $photo->save(); - module::event("item_edit_form_completed", $photo, $form); + $movie->title = $form->edit_item->title->value; + $movie->description = $form->edit_item->description->value; + $movie->slug = $form->edit_item->slug->value; + $movie->rename($form->edit_item->filename->value); + $movie->save(); + module::event("item_edit_form_completed", $movie, $form); - log::success("content", "Updated movie", "url()}\">view"); + log::success("content", "Updated movie", "url()}\">view"); message::success( - t("Saved movie %movie_title", array("movie_title" => $photo->title))); + t("Saved movie %movie_title", array("movie_title" => $movie->title))); print json_encode( array("result" => "success")); @@ -121,9 +111,9 @@ class Movies_Controller extends Items_Controller { /** * @see REST_Controller::_form_edit($resource) */ - public function _form_edit($photo) { - access::required("view", $photo); - access::required("edit", $photo); - print photo::get_edit_form($photo); + public function _form_edit($movie) { + access::required("view", $movie); + access::required("edit", $movie); + print photo::get_edit_form($movie); } } -- cgit v1.2.3 From 123afc954281c1f924f851a33ae5016774e6d9f3 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 21 Sep 2009 21:22:07 -0700 Subject: Set children_count to 0, photos have no children. --- modules/gallery/controllers/photos.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/photos.php b/modules/gallery/controllers/photos.php index 3de9b3ee..81e7519e 100644 --- a/modules/gallery/controllers/photos.php +++ b/modules/gallery/controllers/photos.php @@ -37,7 +37,7 @@ class Photos_Controller extends Items_Controller { $template = new Theme_View("page.html", "photo"); $template->set_global("item", $photo); $template->set_global("children", array()); - $template->set_global("children_count", $photo->children_count()); + $template->set_global("children_count", 0); $template->set_global("parents", $photo->parents()); $template->set_global("next_item", $next_item); $template->set_global("previous_item", $previous_item); -- cgit v1.2.3 From f1366d275e007141a28a933a6221c6337d7aa1d7 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Tue, 22 Sep 2009 08:46:07 -0700 Subject: Issue an information message if the user clicks "Save Settings" indicating that the key was not changed as it as identical. This addresses the obscure issue raised in ticket #756 --- modules/gallery/controllers/admin_languages.php | 32 +++++++++++++------------ 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/admin_languages.php b/modules/gallery/controllers/admin_languages.php index d91e5205..42968b43 100644 --- a/modules/gallery/controllers/admin_languages.php +++ b/modules/gallery/controllers/admin_languages.php @@ -24,7 +24,7 @@ class Admin_Languages_Controller extends Admin_Controller { $v->content->available_locales = locales::available(); $v->content->installed_locales = locales::installed(); $v->content->default_locale = module::get_var("gallery", "default_locale"); - + if (empty($share_translations_form)) { $share_translations_form = $this->_share_translations_form(); } @@ -35,21 +35,21 @@ class Admin_Languages_Controller extends Admin_Controller { public function save() { access::verify_csrf(); - - locales::update_installed($this->input->post("installed_locales")); - - $installed_locales = array_keys(locales::installed()); + + locales::update_installed($this->input->post("installed_locales")); + + $installed_locales = array_keys(locales::installed()); $new_default_locale = $this->input->post("default_locale"); - if (!in_array($new_default_locale, $installed_locales)) { - if (!empty($installed_locales)) { - $new_default_locale = $installed_locales[0]; - } else { - $new_default_locale = "en_US"; - } - } - module::set_var("gallery", "default_locale", $new_default_locale); - - print json_encode(array("result" => "success")); + if (!in_array($new_default_locale, $installed_locales)) { + if (!empty($installed_locales)) { + $new_default_locale = $installed_locales[0]; + } else { + $new_default_locale = "en_US"; + } + } + module::set_var("gallery", "default_locale", $new_default_locale); + + print json_encode(array("result" => "success")); } public function share() { @@ -88,6 +88,8 @@ class Admin_Languages_Controller extends Admin_Controller { message::success(t("Your API key has been changed.")); } else if (!$old_key && $new_key) { message::success(t("Your API key has been saved.")); + } else if ($old_key && $new_key && $old_key == $new_key) { + message::info(t("Your API key was not changed as it was identical to the current key.")); } log::success(t("gallery"), t("l10n_client API key changed.")); -- cgit v1.2.3 From bec620487af86f566dc7a82549cd4dcb1cf99c9a Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Tue, 22 Sep 2009 09:48:24 -0700 Subject: Wrap the login form with a view in order to include a forgot password link. Fixes ticket #620 --- modules/gallery/controllers/albums.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index 3ea08538..694cc4ff 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -28,7 +28,9 @@ class Albums_Controller extends Items_Controller { if ($album->id == 1) { $view = new Theme_View("page.html", "login"); $view->page_title = t("Log in to Gallery"); - $view->content = user::get_login_form("login/auth_html"); + //$view->content = user::get_login_form("login/auth_html"); + $view->content = new View("login_ajax.html"); + $view->content->form = user::get_login_form("login/auth_html"); print $view; return; } else { -- cgit v1.2.3 From 91c99c9627c8a6352054200d242fd81e963a1c73 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 22 Sep 2009 20:36:12 -0700 Subject: Simplify the "unchanged" status message. --- modules/gallery/controllers/admin_languages.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/admin_languages.php b/modules/gallery/controllers/admin_languages.php index 42968b43..a9693d21 100644 --- a/modules/gallery/controllers/admin_languages.php +++ b/modules/gallery/controllers/admin_languages.php @@ -89,7 +89,7 @@ class Admin_Languages_Controller extends Admin_Controller { } else if (!$old_key && $new_key) { message::success(t("Your API key has been saved.")); } else if ($old_key && $new_key && $old_key == $new_key) { - message::info(t("Your API key was not changed as it was identical to the current key.")); + message::info(t("Your API key was not changed.")); } log::success(t("gallery"), t("l10n_client API key changed.")); -- cgit v1.2.3 From faee4391a3283dbafc0ec101b4902fd01bc2e329 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 23 Sep 2009 07:12:17 -0700 Subject: Remove a commented line I forgot to take out --- modules/gallery/controllers/albums.php | 1 - 1 file changed, 1 deletion(-) (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index 694cc4ff..9733d1cd 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -28,7 +28,6 @@ class Albums_Controller extends Items_Controller { if ($album->id == 1) { $view = new Theme_View("page.html", "login"); $view->page_title = t("Log in to Gallery"); - //$view->content = user::get_login_form("login/auth_html"); $view->content = new View("login_ajax.html"); $view->content->form = user::get_login_form("login/auth_html"); print $view; -- cgit v1.2.3 From b79129e3651a92250b61a501b8c6a1d53bf4928c Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 23 Sep 2009 12:02:35 -0700 Subject: Clone the photo::get_edit_form to the movies helper and use it to generate the movie edit form. Fixes ticket #726. --- modules/gallery/controllers/movies.php | 4 ++-- modules/gallery/helpers/album.php | 5 +++-- modules/gallery/helpers/gallery.php | 19 ++++++++++++++++--- modules/gallery/helpers/movie.php | 30 ++++++++++++++++++++++++++++++ modules/gallery/helpers/photo.php | 5 +++-- 5 files changed, 54 insertions(+), 9 deletions(-) (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/movies.php b/modules/gallery/controllers/movies.php index fa07668e..2a917c58 100644 --- a/modules/gallery/controllers/movies.php +++ b/modules/gallery/controllers/movies.php @@ -60,7 +60,7 @@ class Movies_Controller extends Items_Controller { access::required("view", $movie); access::required("edit", $movie); - $form = photo::get_edit_form($movie); + $form = movie::get_edit_form($movie); if ($valid = $form->validate()) { if ($form->edit_item->filename->value != $movie->name || $form->edit_item->slug->value != $movie->slug) { @@ -114,6 +114,6 @@ class Movies_Controller extends Items_Controller { public function _form_edit($movie) { access::required("view", $movie); access::required("edit", $movie); - print photo::get_edit_form($movie); + print movie::get_edit_form($movie); } } diff --git a/modules/gallery/helpers/album.php b/modules/gallery/helpers/album.php index 9cd746d7..3c62e41e 100644 --- a/modules/gallery/helpers/album.php +++ b/modules/gallery/helpers/album.php @@ -123,14 +123,15 @@ class album_Core { if ($parent->id != 1) { $group->input("dirname")->label(t("Directory Name"))->value($parent->name) ->rules("required") - ->error_messages("name_conflict", t("There is already a photo or album with this name")) + ->error_messages( + "name_conflict", t("There is already amovie, photo or album with this 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 \".\"")); $group->input("slug")->label(t("Internet Address"))->value($parent->slug) ->error_messages( - "slug_conflict", t("There is already a photo or album with this internet address")) + "slug_conflict", t("There is already a movie, photo or album with this internet address")) ->callback("item::validate_url_safe") ->error_messages( "not_url_safe", diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index 80ae65bd..91dd2073 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -114,19 +114,32 @@ class gallery_Core { } } + switch ($item->type) { + case "album": + $option_text = t("Album options"); + $edit_text = t("Edit album"); + break; + case "movie": + $option_text = t("Movie options"); + $edit_text = t("Edit movie"); + break; + default: + $option_text = t("Photo options"); + $edit_text = t("Edit photo"); + } + $menu->append($options_menu = Menu::factory("submenu") ->id("options_menu") - ->label(t("Photo options"))); + ->label($option_text)); if ($item && ($can_edit || $can_add)) { if ($can_edit) { $options_menu->append(Menu::factory("dialog") ->id("edit_item") - ->label($item->is_album() ? t("Edit album") : t("Edit photo")) + ->label($edit_text) ->url(url::site("form/edit/{$item->type}s/$item->id"))); } if ($item->is_album()) { - $options_menu->label(t("Album options")); if ($can_edit) { $options_menu->append(Menu::factory("dialog") ->id("edit_permissions") diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php index 59bf5c19..6c8c6c88 100644 --- a/modules/gallery/helpers/movie.php +++ b/modules/gallery/helpers/movie.php @@ -128,6 +128,36 @@ class movie_Core { return $movie; } + static function get_edit_form($movie) { + $form = new Forge("movies/$movie->id", "", "post", array("id" => "gEditMovieForm")); + $form->hidden("_method")->value("put"); + $group = $form->group("edit_item")->label(t("Edit Movie")); + $group->input("title")->label(t("Title"))->value($movie->title); + $group->textarea("description")->label(t("Description"))->value($movie->description); + $group->input("filename")->label(t("Filename"))->value($movie->name) + ->error_messages( + "name_conflict", t("There is already a movie, photo or album with this name")) + ->callback("item::validate_no_slashes") + ->error_messages("no_slashes", t("The movie name can't contain a \"/\"")) + ->callback("item::validate_no_trailing_period") + ->error_messages("no_trailing_period", t("The movie name can't end in \".\"")); + $group->input("slug")->label(t("Internet Address"))->value($movie->slug) + ->callback("item::validate_url_safe") + ->error_messages( + "slug_conflict", t("There is already a movie, photo or album with this internet address")) + ->error_messages( + "not_url_safe", + t("The internet address should contain only letters, numbers, hyphens and underscores")); + + module::event("item_edit_form", $movie, $form); + + $group = $form->group("buttons")->label(""); + $group->submit("")->value(t("Modify")); + $form->add_rules_from(ORM::factory("item")); + return $form; + } + + static function getmoviesize($filename) { $ffmpeg = self::find_ffmpeg(); if (empty($ffmpeg)) { diff --git a/modules/gallery/helpers/photo.php b/modules/gallery/helpers/photo.php index 3d9fbe69..065d2d31 100644 --- a/modules/gallery/helpers/photo.php +++ b/modules/gallery/helpers/photo.php @@ -163,7 +163,8 @@ class photo_Core { $group->input("title")->label(t("Title"))->value($photo->title); $group->textarea("description")->label(t("Description"))->value($photo->description); $group->input("filename")->label(t("Filename"))->value($photo->name) - ->error_messages("name_conflict", t("There is already a photo or album with this name")) + ->error_messages( + "name_conflict", t("There is already a movie, photo or album with this name")) ->callback("item::validate_no_slashes") ->error_messages("no_slashes", t("The photo name can't contain a \"/\"")) ->callback("item::validate_no_trailing_period") @@ -171,7 +172,7 @@ class photo_Core { $group->input("slug")->label(t("Internet Address"))->value($photo->slug) ->callback("item::validate_url_safe") ->error_messages( - "slug_conflict", t("There is already a photo or album with this internet address")) + "slug_conflict", t("There is already a movie, photo or album with this internet address")) ->error_messages( "not_url_safe", t("The internet address should contain only letters, numbers, hyphens and underscores")); -- cgit v1.2.3 From 467b74c3106558d1656301b9c73236417d4421ac Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sun, 27 Sep 2009 15:24:51 -0700 Subject: This path requires the upgrader to be run and applies the following changes: * moves the composite method back into core * requires that the operation be fully qualified i.e. gallery_graphics::resize * caches the graphics rules on each request --- installer/install.sql | 4 +- .../gallery/controllers/admin_theme_options.php | 8 +-- modules/gallery/helpers/gallery_graphics.php | 55 ++++++++++++++++ modules/gallery/helpers/gallery_installer.php | 21 +++++- modules/gallery/helpers/graphics.php | 30 ++++++--- modules/gallery/module.info | 2 +- modules/watermark/controllers/admin_watermarks.php | 2 +- modules/watermark/helpers/watermark_graphics.php | 75 ---------------------- modules/watermark/helpers/watermark_installer.php | 22 ++++++- modules/watermark/module.info | 2 +- 10 files changed, 124 insertions(+), 97 deletions(-) delete mode 100644 modules/watermark/helpers/watermark_graphics.php (limited to 'modules/gallery/controllers') diff --git a/installer/install.sql b/installer/install.sql index 12785f09..80042b10 100755 --- a/installer/install.sql +++ b/installer/install.sql @@ -88,8 +88,8 @@ CREATE TABLE {graphics_rules} ( PRIMARY KEY (`id`) ) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; SET character_set_client = @saved_cs_client; -INSERT INTO {graphics_rules} VALUES (1,1,'a:3:{s:5:\"width\";i:200;s:6:\"height\";i:200;s:6:\"master\";i:2;}','gallery','resize',100,'thumb'); -INSERT INTO {graphics_rules} VALUES (2,1,'a:3:{s:5:\"width\";i:640;s:6:\"height\";i:480;s:6:\"master\";i:2;}','gallery','resize',100,'resize'); +INSERT INTO {graphics_rules} VALUES (1,1,'a:3:{s:5:\"width\";i:200;s:6:\"height\";i:200;s:6:\"master\";i:2;}','gallery','gallery_graphics::resize',100,'thumb'); +INSERT INTO {graphics_rules} VALUES (2,1,'a:3:{s:5:\"width\";i:640;s:6:\"height\";i:480;s:6:\"master\";i:2;}','gallery','gallery_graphics::resize',100,'resize'); DROP TABLE IF EXISTS {groups}; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; diff --git a/modules/gallery/controllers/admin_theme_options.php b/modules/gallery/controllers/admin_theme_options.php index 8970c3c9..27a67bdb 100644 --- a/modules/gallery/controllers/admin_theme_options.php +++ b/modules/gallery/controllers/admin_theme_options.php @@ -35,9 +35,9 @@ class Admin_Theme_Options_Controller extends Admin_Controller { $thumb_size = $form->edit_theme->thumb_size->value; $thumb_dirty = false; if (module::get_var("gallery", "thumb_size") != $thumb_size) { - graphics::remove_rule("gallery", "thumb", "resize"); + graphics::remove_rule("gallery", "thumb", "gallery_graphics::resize"); graphics::add_rule( - "gallery", "thumb", "resize", + "gallery", "thumb", "gallery_graphics::resize", array("width" => $thumb_size, "height" => $thumb_size, "master" => Image::AUTO), 100); module::set_var("gallery", "thumb_size", $thumb_size); @@ -46,9 +46,9 @@ class Admin_Theme_Options_Controller extends Admin_Controller { $resize_size = $form->edit_theme->resize_size->value; $resize_dirty = false; if (module::get_var("gallery", "resize_size") != $resize_size) { - graphics::remove_rule("gallery", "resize", "resize"); + graphics::remove_rule("gallery", "resize", "gallery_graphics::resize"); graphics::add_rule( - "gallery", "resize", "resize", + "gallery", "resize", "gallery_graphics::resize", array("width" => $resize_size, "height" => $resize_size, "master" => Image::AUTO), 100); module::set_var("gallery", "resize_size", $resize_size); diff --git a/modules/gallery/helpers/gallery_graphics.php b/modules/gallery/helpers/gallery_graphics.php index f62fbf97..bdd600c5 100644 --- a/modules/gallery/helpers/gallery_graphics.php +++ b/modules/gallery/helpers/gallery_graphics.php @@ -51,4 +51,59 @@ class gallery_graphics_Core { module::event("graphics_resize_completed", $input_file, $output_file, $options); } + + /** + * Overlay an image on top of the input file. + * + * Valid options are: file, mime_type, position, transparency_percent, padding + * + * Valid positions: northwest, north, northeast, + * west, center, east, + * southwest, south, southeast + * + * padding is in pixels + * + * @param string $input_file + * @param string $output_file + * @param array $options + */ + static function composite($input_file, $output_file, $options) { + try { + graphics::init_toolkit(); + + module::event("graphics_composite", $input_file, $output_file, $options); + + list ($width, $height) = getimagesize($input_file); + list ($w_width, $w_height) = getimagesize($options["file"]); + + $pad = isset($options["padding"]) ? $options["padding"] : 10; + $top = $pad; + $left = $pad; + $y_center = max($height / 2 - $w_height / 2, $pad); + $x_center = max($width / 2 - $w_width / 2, $pad); + $bottom = max($height - $w_height - $pad, $pad); + $right = max($width - $w_width - $pad, $pad); + + switch ($options["position"]) { + case "northwest": $x = $left; $y = $top; break; + case "north": $x = $x_center; $y = $top; break; + case "northeast": $x = $right; $y = $top; break; + case "west": $x = $left; $y = $y_center; break; + case "center": $x = $x_center; $y = $y_center; break; + case "east": $x = $right; $y = $y_center; break; + case "southwest": $x = $left; $y = $bottom; break; + case "south": $x = $x_center; $y = $bottom; break; + case "southeast": $x = $right; $y = $bottom; break; + } + + Image::factory($input_file) + ->composite($options["file"], $x, $y, $options["transparency"]) + ->quality(module::get_var("gallery", "image_quality")) + ->save($output_file); + + module::event("graphics_composite_completed", $input_file, $output_file, $options); + } catch (ErrorException $e) { + Kohana::log("error", $e->get_message()); + } + } } diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index d4aae4c3..f995b606 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -235,11 +235,11 @@ class gallery_installer { // Add rules for generating our thumbnails and resizes graphics::add_rule( - "gallery", "thumb", "resize", + "gallery", "thumb", "gallery_graphics::resize", array("width" => 200, "height" => 200, "master" => Image::AUTO), 100); graphics::add_rule( - "gallery", "resize", "resize", + "gallery", "resize", "gallery_graphics::resize", array("width" => 640, "height" => 480, "master" => Image::AUTO), 100); @@ -268,7 +268,7 @@ class gallery_installer { module::set_var("gallery", "show_credits", 1); // @todo this string needs to be picked up by l10n_scanner module::set_var("gallery", "credits", "Powered by Gallery %version"); - module::set_version("gallery", 13); + module::set_version("gallery", 14); } static function upgrade($version) { @@ -375,6 +375,21 @@ class gallery_installer { module::set_version("gallery", $version = 13); } + if ($version == 13) { + // Add rules for generating our thumbnails and resizes + graphics::remove_rule("gallery", "thumb", "gallery_graphics::resize"); + graphics::remove_rule("gallery", "resize", "gallery_graphics::resize"); + graphics::add_rule( + "gallery", "thumb", "gallery_graphics::resize", + array("width" => 200, "height" => 200, "master" => Image::AUTO), + 100); + graphics::add_rule( + "gallery", "resize", "gallery_graphics::resize", + array("width" => 640, "height" => 480, "master" => Image::AUTO), + 100); + module::set_version("gallery", $version = 14); + } + } static function uninstall() { diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php index 6705652f..0e32022f 100644 --- a/modules/gallery/helpers/graphics.php +++ b/modules/gallery/helpers/graphics.php @@ -19,6 +19,7 @@ */ class graphics_Core { private static $init; + private static $_rules_cache = array(); /** * Add a new graphics rule. @@ -26,7 +27,7 @@ class graphics_Core { * Rules are applied to targets (thumbnails and resizes) in priority order. Rules are functions * in the graphics class. So for example, the following rule: * - * graphics::add_rule("gallery", "thumb", "resize", + * graphics::add_rule("gallery", "thumb", "gallery_graphics::resize", * array("width" => 200, "height" => 200, "master" => Image::AUTO), 100); * * Specifies that "gallery" is adding a rule to resize thumbnails down to a max of 200px on @@ -35,7 +36,7 @@ class graphics_Core { * * @param string $module_name the module that added the rule * @param string $target the target for this operation ("thumb" or "resize") - * @param string $operation the name of the operation + * @param string $operation the name of the operation (::method) * @param array $args arguments to the operation * @param integer $priority the priority for this rule (lower priorities are run first) */ @@ -56,7 +57,7 @@ class graphics_Core { * Remove any matching graphics rules * @param string $module_name the module that added the rule * @param string $target the target for this operation ("thumb" or "resize") - * @param string $operation the name of the operation + * @param string $operation the name of the operation(::method) */ static function remove_rule($module_name, $target, $operation) { ORM::factory("graphics_rule") @@ -146,13 +147,9 @@ class graphics_Core { $working_file = $input_file; } - foreach (ORM::factory("graphics_rule") - ->where("target", $target) - ->where("active", true) - ->orderby("priority", "asc") - ->find_all() as $rule) { + foreach (self::_get_rules($target) as $rule) { $args = array($working_file, $output_file, unserialize($rule->args)); - call_user_func_array(array("{$rule->module_name}_graphics", $rule->operation), $args); + call_user_func_array($rule->operation, $args); $working_file = $output_file; } } @@ -180,6 +177,21 @@ class graphics_Core { } } + private static function _get_rules($target) { + if (empty(self::$_rules_cache[$target])) { + $rules = array(); + foreach (ORM::factory("graphics_rule") + ->where("target", $target) + ->where("active", true) + ->orderby("priority", "asc") + ->find_all() as $rule) { + $rules[] = (object)$rule->as_array(); + } + self::$_rules_cache[$target] = $rules; + } + return self::$_rules_cache[$target]; + } + /** * Rotate an image. Valid options are degrees * diff --git a/modules/gallery/module.info b/modules/gallery/module.info index 65a0691c..bffcb1c6 100644 --- a/modules/gallery/module.info +++ b/modules/gallery/module.info @@ -1,3 +1,3 @@ name = "Gallery 3" description = "Gallery core application" -version = 13 +version = 14 diff --git a/modules/watermark/controllers/admin_watermarks.php b/modules/watermark/controllers/admin_watermarks.php index 423196ac..2a1d5f60 100644 --- a/modules/watermark/controllers/admin_watermarks.php +++ b/modules/watermark/controllers/admin_watermarks.php @@ -138,7 +138,7 @@ class Admin_Watermarks_Controller extends Admin_Controller { if ($name = module::get_var("watermark", "name")) { foreach (array("thumb", "resize") as $target) { graphics::add_rule( - "watermark", $target, "composite", + "watermark", $target, "gallery_graphics::composite", array("file" => VARPATH . "modules/watermark/$name", "width" => module::get_var("watermark", "width"), "height" => module::get_var("watermark", "height"), diff --git a/modules/watermark/helpers/watermark_graphics.php b/modules/watermark/helpers/watermark_graphics.php deleted file mode 100644 index aef7586b..00000000 --- a/modules/watermark/helpers/watermark_graphics.php +++ /dev/null @@ -1,75 +0,0 @@ -composite($options["file"], $x, $y, $options["transparency"]) - ->quality(module::get_var("gallery", "image_quality")) - ->save($output_file); - - module::event("graphics_composite_completed", $input_file, $output_file, $options); - } catch (ErrorException $e) { - Kohana::log("error", $e->get_message()); - } - } -} diff --git a/modules/watermark/helpers/watermark_installer.php b/modules/watermark/helpers/watermark_installer.php index b3e91044..5c7dfdab 100644 --- a/modules/watermark/helpers/watermark_installer.php +++ b/modules/watermark/helpers/watermark_installer.php @@ -33,11 +33,31 @@ class watermark_installer { DEFAULT CHARSET=utf8;"); @mkdir(VARPATH . "modules/watermark"); - module::set_version("watermark", 1); + module::set_version("watermark", 2); } static function uninstall() { Database::instance()->query("DROP TABLE {watermarks}"); dir::unlink(VARPATH . "modules/watermark"); } + + static function upgrade($version) { + $db = Database::instance(); + if ($version == 1) { + graphics::remove_rules("watermark"); + if ($name = module::get_var("watermark", "name")) { + foreach (array("thumb", "resize") as $target) { + graphics::add_rule( + "watermark", $target, "gallery_graphics::composite", + array("file" => VARPATH . "modules/watermark/$name", + "width" => module::get_var("watermark", "width"), + "height" => module::get_var("watermark", "height"), + "position" => module::get_var("watermark", "position"), + "transparency" => 101 - module::get_var("watermark", "transparency")), + 1000); + } + } + module::set_version("watermark", $version = 2); + } + } } diff --git a/modules/watermark/module.info b/modules/watermark/module.info index abd4a3cf..41a871bd 100644 --- a/modules/watermark/module.info +++ b/modules/watermark/module.info @@ -1,3 +1,3 @@ name = "Watermarks" description = "Allows users to watermark their photos" -version = 1 +version = 2 -- cgit v1.2.3 From 60d35b89929d9029c794f72d6a9c38b676e282f6 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 30 Sep 2009 07:31:11 -0700 Subject: Use the block_manager to manage site sidebar panels. Fixes ticket #110. * Extend block_manager to handle sidebar blocks. get_available has become get_available_admin_blocks, get_list becomes get_admin_list. * Create new functions get_available_site_blocks which will look for gallery_block get_available_site_blocks. * Refactor sidebar_blocks into a separate function and then call block_manager::get_html(site.sidebar). Convert image_block to use block management instead of theme::sidebar_blocks * Change the block_manager api so that the theme is passed into the get method. convert info to the new sidebar block approach * Convert the user module to use the new sidebar block structure. remove the installers for info and image_block modules. * Convert tag and rss modules to the new sidebar framework. reset the version number to 1 for info and image_block modules. * Change the get_html method to ignore empty blocks and change the individual handlers to return an empty string if no block is generated * Add a warning message if no sidebar blocks are active and provide a link to the admin page that configures the sidebar. --- modules/comment/helpers/comment_block.php | 2 +- modules/gallery/controllers/admin_dashboard.php | 4 +- modules/gallery/controllers/admin_sidebar.php | 28 ++++++++++ modules/gallery/helpers/block_manager.php | 24 ++++++--- modules/gallery/helpers/gallery_block.php | 5 +- modules/gallery/libraries/Theme_View.php | 12 ++++- modules/gallery/module.info | 2 +- modules/gallery/views/admin_sidebar.html.php | 9 ++++ modules/image_block/helpers/image_block_block.php | 63 +++++++++++++++++++++++ modules/image_block/helpers/image_block_theme.php | 50 ------------------ modules/info/helpers/info_block.php | 39 ++++++++++++++ modules/info/helpers/info_theme.php | 10 ---- modules/rss/helpers/rss_block.php | 49 ++++++++++++++++++ modules/rss/helpers/rss_theme.php | 40 -------------- modules/tag/helpers/tag_block.php | 45 ++++++++++++++++ modules/tag/helpers/tag_theme.php | 19 ------- modules/user/helpers/user_block.php | 46 +++++++++++++++++ modules/user/helpers/user_theme.php | 17 ------ themes/wind/views/no_sidebar.html.php | 5 ++ 19 files changed, 319 insertions(+), 150 deletions(-) create mode 100644 modules/gallery/controllers/admin_sidebar.php create mode 100644 modules/gallery/views/admin_sidebar.html.php create mode 100644 modules/image_block/helpers/image_block_block.php delete mode 100644 modules/image_block/helpers/image_block_theme.php create mode 100644 modules/info/helpers/info_block.php create mode 100644 modules/rss/helpers/rss_block.php delete mode 100644 modules/rss/helpers/rss_theme.php create mode 100644 modules/tag/helpers/tag_block.php create mode 100644 modules/user/helpers/user_block.php create mode 100644 themes/wind/views/no_sidebar.html.php (limited to 'modules/gallery/controllers') diff --git a/modules/comment/helpers/comment_block.php b/modules/comment/helpers/comment_block.php index 08182905..b989be6b 100644 --- a/modules/comment/helpers/comment_block.php +++ b/modules/comment/helpers/comment_block.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class comment_block_Core { - static function get_list() { + static function get_admin_list() { return array("recent_comments" => t("Recent Comments")); } diff --git a/modules/gallery/controllers/admin_dashboard.php b/modules/gallery/controllers/admin_dashboard.php index 3cb97b14..6bf3b966 100644 --- a/modules/gallery/controllers/admin_dashboard.php +++ b/modules/gallery/controllers/admin_dashboard.php @@ -34,7 +34,7 @@ class Admin_Dashboard_Controller extends Admin_Controller { $form = gallery_block::get_add_block_form(); if ($form->validate()) { list ($module_name, $id) = explode(":", $form->add_block->id->value); - $available = block_manager::get_available(); + $available = block_manager::get_available_admin_blocks(); if ($form->add_block->center->value) { block_manager::add("dashboard_center", $module_name, $id); @@ -66,7 +66,7 @@ class Admin_Dashboard_Controller extends Admin_Controller { } if (!empty($deleted)) { - $available = block_manager::get_available(); + $available = block_manager::get_available_admin_blocks(); $title = $available[join(":", $deleted)]; message::success(t("Removed %title block", array("title" => $title))); } diff --git a/modules/gallery/controllers/admin_sidebar.php b/modules/gallery/controllers/admin_sidebar.php new file mode 100644 index 00000000..7e71426a --- /dev/null +++ b/modules/gallery/controllers/admin_sidebar.php @@ -0,0 +1,28 @@ +content = new View("admin_sidebar.html"); + print $view; + } + +} + diff --git a/modules/gallery/helpers/block_manager.php b/modules/gallery/helpers/block_manager.php index 20b641d4..b99a6571 100644 --- a/modules/gallery/helpers/block_manager.php +++ b/modules/gallery/helpers/block_manager.php @@ -38,13 +38,21 @@ class block_manager_Core { self::set_active($location, $blocks); } - static function get_available() { + static function get_available_admin_blocks() { + return self::_get_blocks("get_admin_list"); + } + + static function get_available_site_blocks() { + return self::_get_blocks("get_site_list"); + } + + private static function _get_blocks($function) { $blocks = array(); foreach (module::active() as $module) { $class_name = "{$module->name}_block"; - if (method_exists($class_name, "get_list")) { - foreach (call_user_func(array($class_name, "get_list")) as $id => $title) { + if (method_exists($class_name, $function)) { + foreach (call_user_func(array($class_name, $function)) as $id => $title) { $blocks["{$module->name}:$id"] = $title; } } @@ -52,14 +60,16 @@ class block_manager_Core { return $blocks; } - static function get_html($location) { + static function get_html($location, $theme) { $active = self::get_active($location); $result = ""; foreach ($active as $id => $desc) { if (method_exists("$desc[0]_block", "get")) { - $block = call_user_func(array("$desc[0]_block", "get"), $desc[1]); - $block->id = $id; - $result .= $block; + $block = call_user_func(array("$desc[0]_block", "get"), $desc[1], $theme); + if (!empty($block)) { + $block->id = $id; + $result .= $block; + } } } return $result; diff --git a/modules/gallery/helpers/gallery_block.php b/modules/gallery/helpers/gallery_block.php index b7816954..f2cb8ded 100644 --- a/modules/gallery/helpers/gallery_block.php +++ b/modules/gallery/helpers/gallery_block.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class gallery_block_Core { - static function get_list() { + static function get_admin_list() { return array( "welcome" => t("Welcome to Gallery 3!"), "photo_stream" => t("Photo Stream"), @@ -94,7 +94,8 @@ class gallery_block_Core { $form = new Forge("admin/dashboard/add_block", "", "post", array("id" => "gAddDashboardBlockForm")); $group = $form->group("add_block")->label(t("Add Block")); - $group->dropdown("id")->label(t("Available Blocks"))->options(block_manager::get_available()); + $group->dropdown("id")->label(t("Available Blocks")) + ->options(block_manager::get_available_admin_blocks()); $group->submit("center")->value(t("Add to center")); $group->submit("sidebar")->value(t("Add to sidebar")); return $form; diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index 728e8bf9..ab25a4b6 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -153,6 +153,17 @@ class Theme_View_Core extends Gallery_View { return message::get(); } + /** + * Print out the sidebar. + */ + public function sidebar_blocks() { + $sidebar = block_manager::get_html("site.sidebar", $this); + if (empty($sidebar) && user::active()->admin) { + $sidebar = new View("no_sidebar.html"); + } + return $sidebar; + } + /** * Handle all theme functions that insert module content. */ @@ -176,7 +187,6 @@ class Theme_View_Core extends Gallery_View { case "photo_top": case "resize_bottom": case "resize_top": - case "sidebar_blocks": case "sidebar_bottom": case "sidebar_top": case "thumb_bottom": diff --git a/modules/gallery/module.info b/modules/gallery/module.info index bffcb1c6..f509ff08 100644 --- a/modules/gallery/module.info +++ b/modules/gallery/module.info @@ -1,3 +1,3 @@ name = "Gallery 3" description = "Gallery core application" -version = 14 +version = 15 diff --git a/modules/gallery/views/admin_sidebar.html.php b/modules/gallery/views/admin_sidebar.html.php new file mode 100644 index 00000000..32386f5d --- /dev/null +++ b/modules/gallery/views/admin_sidebar.html.php @@ -0,0 +1,9 @@ + + +

+

+ +

+ +
+
\ No newline at end of file diff --git a/modules/image_block/helpers/image_block_block.php b/modules/image_block/helpers/image_block_block.php new file mode 100644 index 00000000..d0402eb6 --- /dev/null +++ b/modules/image_block/helpers/image_block_block.php @@ -0,0 +1,63 @@ + t("Random Image")); + } + + static function get($block_id, $theme) { + $block = ""; + switch ($block_id) { + case "random_image": + $block = new Block(); + $block->css_id = "gImageBlock"; + $block->title = t("Random Image"); + $block->content = new View("image_block_block.html"); + + $random = ((float)mt_rand()) / (float)mt_getrandmax(); + + $items = ORM::factory("item") + ->viewable() + ->where("type !=", "album") + ->where("rand_key < ", $random) + ->orderby(array("rand_key" => "DESC")) + ->find_all(1); + + if ($items->count() == 0) { + // Try once more. If this fails, just ditch the block altogether + $items = ORM::factory("item") + ->viewable() + ->where("type !=", "album") + ->where("rand_key >= ", $random) + ->orderby(array("rand_key" => "DESC")) + ->find_all(1); + } + + if ($items->count() > 0) { + $block->content->item = $items->current(); + } else { + $block = ""; + } + break; + } + + return $block; + } +} diff --git a/modules/image_block/helpers/image_block_theme.php b/modules/image_block/helpers/image_block_theme.php deleted file mode 100644 index 78138b23..00000000 --- a/modules/image_block/helpers/image_block_theme.php +++ /dev/null @@ -1,50 +0,0 @@ -css_id = "gImageBlock"; - $block->title = t("Random Image"); - $block->content = new View("image_block_block.html"); - - $random = ((float)mt_rand()) / (float)mt_getrandmax(); - - $items = ORM::factory("item") - ->viewable() - ->where("type !=", "album") - ->where("rand_key < ", $random) - ->orderby(array("rand_key" => "DESC")) - ->find_all(1); - - if ($items->count() == 0) { - // Try once more. If this fails, just ditch the block altogether - $items = ORM::factory("item") - ->viewable() - ->where("type !=", "album") - ->where("rand_key >= ", $random) - ->orderby(array("rand_key" => "DESC")) - ->find_all(1); - } - - $block->content->item = $items->current(); - - return $items->count() == 0 ? "" : $block; - } -} diff --git a/modules/info/helpers/info_block.php b/modules/info/helpers/info_block.php new file mode 100644 index 00000000..3a853609 --- /dev/null +++ b/modules/info/helpers/info_block.php @@ -0,0 +1,39 @@ + t("Metadata")); + } + + static function get($block_id, $theme) { + $block = ""; + switch ($block_id) { + case "metadata": + if ($theme->item()) { + $block = new Block(); + $block->css_id = "gMetadata"; + $block->title = $theme->item()->is_album() ? t("Album Info") : t("Photo Info"); + $block->content = new View("info_block.html"); + } + break; + } + return $block; + } +} \ No newline at end of file diff --git a/modules/info/helpers/info_theme.php b/modules/info/helpers/info_theme.php index 4bf894ad..8b8602a1 100644 --- a/modules/info/helpers/info_theme.php +++ b/modules/info/helpers/info_theme.php @@ -18,16 +18,6 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class info_theme_Core { - static function sidebar_blocks($theme) { - if ($theme->item()) { - $block = new Block(); - $block->css_id = "gMetadata"; - $block->title = $theme->item()->is_album() ? t("Album Info") : t("Photo Info"); - $block->content = new View("info_block.html"); - return $block; - } - } - static function thumb_info($theme, $item) { $results = ""; if ($item->view_count) { diff --git a/modules/rss/helpers/rss_block.php b/modules/rss/helpers/rss_block.php new file mode 100644 index 00000000..43043f5f --- /dev/null +++ b/modules/rss/helpers/rss_block.php @@ -0,0 +1,49 @@ + t("Available RSS Feeds")); + } + + static function get($block_id, $theme) { + $block = ""; + switch ($block_id) { + case "rss_feeds": + $feeds = array(); + foreach (module::active() as $module) { + $class_name = "{$module->name}_rss"; + if (method_exists($class_name, "available_feeds")) { + $feeds = array_merge($feeds, + call_user_func(array($class_name, "available_feeds"), $theme->item(), $theme->tag())); + } + } + if (!empty($feeds)) { + $block = new Block(); + $block->css_id = "gRss"; + $block->title = t("Available RSS Feeds"); + $block->content = new View("rss_block.html"); + $block->content->feeds = $feeds; + } + break; + } + + return $block; + } +} diff --git a/modules/rss/helpers/rss_theme.php b/modules/rss/helpers/rss_theme.php deleted file mode 100644 index 3d1b9a29..00000000 --- a/modules/rss/helpers/rss_theme.php +++ /dev/null @@ -1,40 +0,0 @@ -css_id = "gRss"; - $block->title = t("Available RSS Feeds"); - $block->content = new View("rss_block.html"); - $block->content->feeds = array(); - foreach (module::active() as $module) { - $class_name = "{$module->name}_rss"; - if (method_exists($class_name, "available_feeds")) { - $block->content->feeds = array_merge( - $block->content->feeds, - call_user_func(array($class_name, "available_feeds"), $theme->item(), $theme->tag())); - } - } - - if ($block->content->feeds) { - return $block; - } - } -} diff --git a/modules/tag/helpers/tag_block.php b/modules/tag/helpers/tag_block.php new file mode 100644 index 00000000..bbcc5fd1 --- /dev/null +++ b/modules/tag/helpers/tag_block.php @@ -0,0 +1,45 @@ + t("Popular Tags")); + } + + static function get($block_id, $theme) { + $block = ""; + switch ($block_id) { + case "tag": + $block = new Block(); + $block->css_id = "gTag"; + $block->title = t("Popular Tags"); + $block->content = new View("tag_block.html"); + $block->content->cloud = tag::cloud(30); + + if ($theme->item() && $theme->page_type() != "tag" && access::can("edit", $theme->item())) { + $controller = new Tags_Controller(); + $block->content->form = tag::get_add_form($theme->item()); + } else { + $block->content->form = ""; + } + break; + } + return $block; + } +} \ No newline at end of file diff --git a/modules/tag/helpers/tag_theme.php b/modules/tag/helpers/tag_theme.php index 1bce9bd8..4f22d2ac 100644 --- a/modules/tag/helpers/tag_theme.php +++ b/modules/tag/helpers/tag_theme.php @@ -28,25 +28,6 @@ class tag_theme_Core { $theme->script("tag.js"); } - static function sidebar_blocks($theme) { - // @todo this needs to be data driven - - $block = new Block(); - $block->css_id = "gTag"; - $block->title = t("Popular Tags"); - $block->content = new View("tag_block.html"); - $block->content->cloud = tag::cloud(30); - - if ($theme->item() && $theme->page_type() != "tag" && access::can("edit", $theme->item())) { - $controller = new Tags_Controller(); - $block->content->form = tag::get_add_form($theme->item()); - } else { - $block->content->form = ""; - } - - return $block; - } - static function sort_by_name($tag1, $tag2) { return strcasecmp($tag1->name, $tag2->name); } diff --git a/modules/user/helpers/user_block.php b/modules/user/helpers/user_block.php new file mode 100644 index 00000000..e7671f06 --- /dev/null +++ b/modules/user/helpers/user_block.php @@ -0,0 +1,46 @@ + t("Language Preference")); + } + + static function get($block_id, $theme) { + $block = ""; + switch ($block_id) { + case "language": + $locales = locales::installed(); + foreach ($locales as $locale => $display_name) { + $locales[$locale] = SafeString::of_safe_html($display_name); + } + if (count($locales) > 1) { + $block = new Block(); + $block->css_id = "gUserLanguageBlock"; + $block->title = t("Language Preference"); + $block->content = new View("user_languages_block.html"); + $block->content->installed_locales = + array_merge(array("" => t("« none »")), $locales); + $block->content->selected = (string) user::cookie_locale(); + } + break; + } + return $block; + } +} \ No newline at end of file diff --git a/modules/user/helpers/user_theme.php b/modules/user/helpers/user_theme.php index 098d87fd..69d63eaf 100644 --- a/modules/user/helpers/user_theme.php +++ b/modules/user/helpers/user_theme.php @@ -33,21 +33,4 @@ class user_theme_Core { return $view->render(); } } - - static function sidebar_blocks($theme) { - $locales = locales::installed(); - foreach ($locales as $locale => $display_name) { - $locales[$locale] = SafeString::of_safe_html($display_name); - } - if (count($locales) > 1) { - $block = new Block(); - $block->css_id = "gUserLanguageBlock"; - $block->title = t("Language Preference"); - $block->content = new View("user_languages_block.html"); - $block->content->installed_locales = - array_merge(array("" => t("« none »")), $locales); - $block->content->selected = (string) user::cookie_locale(); - return $block; - } - } } diff --git a/themes/wind/views/no_sidebar.html.php b/themes/wind/views/no_sidebar.html.php new file mode 100644 index 00000000..7324cf9e --- /dev/null +++ b/themes/wind/views/no_sidebar.html.php @@ -0,0 +1,5 @@ + +
+ Add panels", + array("url" => html::mark_clean(url::site("admin/sidebar")))) ?> +
-- cgit v1.2.3 From 4de412e72270587cbd656ebafe08892344055a4d Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 30 Sep 2009 14:25:33 -0700 Subject: Enable the administration screen for the sidebar. Fix for ticket #110. --- modules/gallery/controllers/admin_sidebar.php | 39 ++++++++++++++++++ modules/gallery/helpers/gallery_event.php | 6 ++- modules/gallery/views/admin_sidebar.html.php | 47 +++++++++++++++++++--- .../gallery/views/admin_sidebar_blocks.html.php | 5 +++ themes/admin_wind/css/screen.css | 28 +++++++++++++ 5 files changed, 119 insertions(+), 6 deletions(-) create mode 100644 modules/gallery/views/admin_sidebar_blocks.html.php (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/admin_sidebar.php b/modules/gallery/controllers/admin_sidebar.php index 7e71426a..f029d259 100644 --- a/modules/gallery/controllers/admin_sidebar.php +++ b/modules/gallery/controllers/admin_sidebar.php @@ -21,8 +21,47 @@ class Admin_Sidebar_Controller extends Admin_Controller { public function index() { $view = new Admin_View("admin.html"); $view->content = new View("admin_sidebar.html"); + $view->content->csrf = access::csrf_token(); + $view->content->available = new View("admin_sidebar_blocks.html"); + $view->content->active = new View("admin_sidebar_blocks.html"); + list($view->content->available->blocks, $view->content->active->blocks) = $this->_get_blocks(); print $view; } + public function update() { + access::verify_csrf(); + + $available_blocks = block_manager::get_available_site_blocks(); + + $active_blocks = array(); + foreach ($this->input->get("block", array()) as $block_id) { + $active_blocks[] = explode(":", (string) $block_id); + } + block_manager::set_active("site.sidebar", $active_blocks); + + $result = array("result" => "success"); + list($available, $active) = $this->_get_blocks(); + $v = new View("admin_sidebar_blocks.html"); + $v->blocks = $available; + $result["available"] = $v->render(); + $v = new View("admin_sidebar_blocks.html"); + $v->blocks = $active; + $result["active"] = $v->render(); + + print json_encode($result); + } + + private function _get_blocks() { + $active_blocks = array(); + $available_blocks = block_manager::get_available_site_blocks(); + foreach (block_manager::get_active("site.sidebar") as $block) { + $id = "{$block[0]}:{$block[1]}"; + if (!empty($available_blocks[$id])) { + $active_blocks[$id] = $available_blocks[$id]; + unset($available_blocks[$id]); + } + } + return array($available_blocks, $active_blocks); + } } diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php index 9305580f..69458e74 100644 --- a/modules/gallery/helpers/gallery_event.php +++ b/modules/gallery/helpers/gallery_event.php @@ -171,7 +171,11 @@ class gallery_event_Core { ->append(Menu::factory("link") ->id("theme_options") ->label(t("Theme Options")) - ->url(url::site("admin/theme_options")))) + ->url(url::site("admin/theme_options"))) + ->append(Menu::factory("link") + ->id("sidebar") + ->label(t("Manage Sidebar")) + ->url(url::site("admin/sidebar")))) ->append(Menu::factory("submenu") ->id("statistics_menu") ->label(t("Statistics"))) diff --git a/modules/gallery/views/admin_sidebar.html.php b/modules/gallery/views/admin_sidebar.html.php index 32386f5d..62b59ac1 100644 --- a/modules/gallery/views/admin_sidebar.html.php +++ b/modules/gallery/views/admin_sidebar.html.php @@ -1,9 +1,46 @@ - -

+ +

- -
-
\ No newline at end of file +
"> +
+

+
+
    + +
+
+
+
+

+
+
    + +
+
+
+
diff --git a/modules/gallery/views/admin_sidebar_blocks.html.php b/modules/gallery/views/admin_sidebar_blocks.html.php new file mode 100644 index 00000000..a1a71743 --- /dev/null +++ b/modules/gallery/views/admin_sidebar_blocks.html.php @@ -0,0 +1,5 @@ + + + $text): ?> +
  • + diff --git a/themes/admin_wind/css/screen.css b/themes/admin_wind/css/screen.css index 737c5939..c733b482 100644 --- a/themes/admin_wind/css/screen.css +++ b/themes/admin_wind/css/screen.css @@ -656,6 +656,34 @@ li.gDefaultGroup h4, li.gDefaultGroup .gUser { background: #ffc; } +/* admin/sidebar ~~~~~~~~~~~~~~~~~~~~~~~~~ */ +.gAdminBlocksList { + float: left; + height: 300px; + margin-left: 20px; + width: 30%; +} + +.gAdminBlocksList div:last-child { + border: .1em solid; + height: 100%; + overflow-y: auto; +} + +.gAdminBlocksList ul { + margin: .1em .1em; + padding: .1em; +} + +.gAdminBlocksList ul li { + background-color: #e8e8e8; + font-size: 1em; + font-weight: bold; + margin: .5em; + padding: .3em .8em; +} + + /** ******************************************************************* * 5) Navigation and menus *********************************************************************/ -- cgit v1.2.3 From 3e6ba7acc3291f2268cbe9c9bef0a492b557babb Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sun, 4 Oct 2009 00:27:22 -0600 Subject: Renamed most, if not all css selectors from gName to g-name. Moved a few shared images from wind to lib. Deleted unused images in the admin_wind. This will likely break a few ajax features. --- lib/gallery.common.css | 57 ++- lib/gallery.common.js | 24 +- lib/gallery.dialog.js | 4 +- lib/gallery.panel.js | 24 +- lib/gallery.show_full_size.js | 20 +- lib/images/ico-separator.gif | Bin 0 -> 106 bytes modules/akismet/helpers/akismet.php | 2 +- modules/akismet/views/admin_akismet.html.php | 4 +- modules/akismet/views/admin_akismet_stats.html.php | 6 +- modules/comment/helpers/comment.php | 20 +- modules/comment/helpers/comment_block.php | 2 +- modules/comment/helpers/comment_event.php | 2 +- modules/comment/helpers/comment_theme.php | 2 +- modules/comment/js/comment.js | 26 +- .../views/admin_block_recent_comments.html.php | 4 +- modules/comment/views/admin_comments.html.php | 20 +- modules/comment/views/comment.html.php | 6 +- modules/comment/views/comments.html.php | 14 +- modules/digibug/helpers/digibug_event.php | 7 +- modules/digibug/js/digibug.js | 7 +- modules/digibug/views/admin_digibug.html.php | 8 +- modules/exif/helpers/exif.php | 2 +- modules/exif/views/exif_dialog.html.php | 22 +- modules/exif/views/exif_sidebar.html.php | 5 +- modules/g2_import/controllers/admin_g2_import.php | 2 +- modules/g2_import/helpers/g2_import.php | 6 +- modules/g2_import/views/admin_g2_import.html.php | 18 +- modules/gallery/controllers/admin_dashboard.php | 2 +- modules/gallery/controllers/admin_languages.php | 2 +- modules/gallery/controllers/l10n_client.php | 4 +- modules/gallery/css/debug.css | 8 +- modules/gallery/css/l10n_client.css | 28 +- modules/gallery/helpers/album.php | 10 +- modules/gallery/helpers/gallery_block.php | 16 +- modules/gallery/helpers/gallery_event.php | 2 +- modules/gallery/helpers/graphics.php | 2 +- modules/gallery/helpers/item.php | 2 +- modules/gallery/helpers/log.php | 8 +- modules/gallery/helpers/message.php | 10 +- modules/gallery/helpers/movie.php | 2 +- modules/gallery/helpers/photo.php | 4 +- modules/gallery/helpers/site_status.php | 10 +- modules/gallery/helpers/theme.php | 14 +- modules/gallery/js/albums_form_add.js | 20 +- modules/gallery/js/l10n_client.js | 44 +- modules/gallery/libraries/Admin_View.php | 2 +- modules/gallery/libraries/Menu.php | 8 +- modules/gallery/libraries/Theme_View.php | 6 +- modules/gallery/models/item.php | 2 +- modules/gallery/tests/DrawForm_Test.php | 12 +- modules/gallery/tests/selenium/Add_Comment.html | 8 +- modules/gallery/tests/selenium/Login.html | 8 +- modules/gallery/tests/xss_data.txt | 62 +-- .../gallery/views/admin_advanced_settings.html.php | 8 +- .../views/admin_block_photo_stream.html.php | 2 +- modules/gallery/views/admin_dashboard.html.php | 22 +- modules/gallery/views/admin_graphics.html.php | 10 +- modules/gallery/views/admin_graphics_gd.html.php | 8 +- .../views/admin_graphics_graphicsmagick.html.php | 6 +- .../views/admin_graphics_imagemagick.html.php | 6 +- modules/gallery/views/admin_graphics_none.html.php | 2 +- modules/gallery/views/admin_languages.html.php | 12 +- modules/gallery/views/admin_maintenance.html.php | 26 +- .../views/admin_maintenance_show_log.html.php | 8 +- .../gallery/views/admin_maintenance_task.html.php | 24 +- modules/gallery/views/admin_modules.html.php | 4 +- modules/gallery/views/admin_sidebar.html.php | 24 +- .../gallery/views/admin_sidebar_blocks.html.php | 2 +- modules/gallery/views/admin_theme_options.html.php | 2 +- modules/gallery/views/admin_themes.html.php | 20 +- modules/gallery/views/form.html.php | 4 +- modules/gallery/views/l10n_client.html.php | 6 +- modules/gallery/views/move_browse.html.php | 14 +- modules/gallery/views/permissions_browse.html.php | 14 +- modules/gallery/views/permissions_form.html.php | 10 +- modules/gallery/views/simple_uploader.html.php | 28 +- modules/gallery/views/welcome_message.html.php | 6 +- .../gallery/views/welcome_message_loader.html.php | 4 +- modules/image_block/helpers/image_block_block.php | 2 +- .../image_block/views/image_block_block.html.php | 4 +- modules/info/helpers/info_block.php | 2 +- modules/info/views/info_block.html.php | 2 +- .../notification/helpers/notification_event.php | 2 +- modules/organize/css/organize.css | 50 +-- modules/organize/helpers/organize_event.php | 4 +- modules/organize/js/organize.js | 84 ++-- modules/organize/views/organize_dialog.html.php | 28 +- .../organize/views/organize_thumb_grid.html.php | 10 +- modules/organize/views/organize_tree.html.php | 8 +- modules/recaptcha/helpers/recaptcha.php | 2 +- modules/recaptcha/helpers/recaptcha_event.php | 2 +- modules/recaptcha/views/admin_recaptcha.html.php | 8 +- modules/recaptcha/views/form_recaptcha.html.php | 4 +- modules/rss/helpers/rss_block.php | 2 +- modules/rss/views/rss_block.html.php | 2 +- modules/search/helpers/search.php | 2 +- modules/search/helpers/search_installer.php | 2 +- modules/search/views/search.html.php | 12 +- modules/search/views/search_link.html.php | 6 +- .../server_add/controllers/admin_server_add.php | 2 +- modules/server_add/js/admin.js | 2 +- modules/server_add/js/server_add.js | 58 +-- modules/server_add/views/admin_server_add.html.php | 10 +- modules/server_add/views/server_add_tree.html.php | 6 +- .../views/server_add_tree_dialog.html.php | 26 +- modules/slideshow/helpers/slideshow_event.php | 6 +- modules/tag/helpers/tag.php | 6 +- modules/tag/helpers/tag_block.php | 2 +- modules/tag/js/tag.js | 38 +- modules/tag/views/admin_tags.html.php | 14 +- modules/tag/views/tag_block.html.php | 10 +- modules/user/controllers/password.php | 10 +- modules/user/helpers/group.php | 10 +- modules/user/helpers/user.php | 52 +-- modules/user/helpers/user_block.php | 2 +- modules/user/views/admin_users.html.php | 36 +- modules/user/views/admin_users_group.html.php | 6 +- modules/user/views/login.html.php | 8 +- modules/user/views/user_languages_block.html.php | 4 +- modules/watermark/helpers/watermark.php | 6 +- modules/watermark/views/admin_watermarks.html.php | 8 +- themes/admin_wind/css/fix-ie.css | 12 +- themes/admin_wind/css/screen.css | 453 ++++++++++----------- themes/admin_wind/images/avatar.jpg | Bin 914 -> 0 bytes themes/admin_wind/images/ico-album.png | Bin 397 -> 0 bytes themes/admin_wind/images/ico-print.png | Bin 989 -> 0 bytes themes/admin_wind/images/ico-separator.gif | Bin 106 -> 0 bytes themes/admin_wind/images/ico-view-comments.png | Bin 768 -> 0 bytes themes/admin_wind/images/ico-view-fullsize.png | Bin 1046 -> 0 bytes themes/admin_wind/images/ico-view-hybrid.png | Bin 494 -> 0 bytes themes/admin_wind/images/ico-view-slideshow.png | Bin 960 -> 0 bytes themes/admin_wind/js/ui.init.js | 38 +- themes/admin_wind/views/admin.html.php | 20 +- themes/admin_wind/views/block.html.php | 6 +- themes/admin_wind/views/pager.html.php | 4 +- themes/wind/css/fix-ie.css | 18 +- themes/wind/css/screen.css | 432 +++++++++----------- themes/wind/images/ico-separator.gif | Bin 106 -> 0 bytes themes/wind/images/ico-view-hybrid.png | Bin 494 -> 0 bytes themes/wind/js/ui.init.js | 72 ++-- themes/wind/views/album.html.php | 20 +- themes/wind/views/block.html.php | 4 +- themes/wind/views/dynamic.html.php | 12 +- themes/wind/views/movie.html.php | 12 +- themes/wind/views/no_sidebar.html.php | 2 +- themes/wind/views/page.html.php | 22 +- themes/wind/views/pager.html.php | 4 +- themes/wind/views/photo.html.php | 18 +- themes/wind/views/sidebar.html.php | 4 +- 149 files changed, 1278 insertions(+), 1317 deletions(-) create mode 100644 lib/images/ico-separator.gif delete mode 100644 themes/admin_wind/images/avatar.jpg delete mode 100644 themes/admin_wind/images/ico-album.png delete mode 100644 themes/admin_wind/images/ico-print.png delete mode 100644 themes/admin_wind/images/ico-separator.gif delete mode 100644 themes/admin_wind/images/ico-view-comments.png delete mode 100644 themes/admin_wind/images/ico-view-fullsize.png delete mode 100644 themes/admin_wind/images/ico-view-hybrid.png delete mode 100644 themes/admin_wind/images/ico-view-slideshow.png delete mode 100644 themes/wind/images/ico-separator.gif delete mode 100644 themes/wind/images/ico-view-hybrid.png (limited to 'modules/gallery/controllers') diff --git a/lib/gallery.common.css b/lib/gallery.common.css index 5768e1cf..c422fe6e 100644 --- a/lib/gallery.common.css +++ b/lib/gallery.common.css @@ -133,11 +133,11 @@ form .g-error { .g-last { } -.g-even-row { +.g-even { background-color: #fff; } -.g-odd-row { +.g-odd { background-color: #eee; } @@ -211,7 +211,60 @@ form .g-error { margin-bottom: .4em; } +/* Breadcrumbs ~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + +.g-breadcrumbs { + padding: 0 20px; +} + +.g-breadcrumbs li { + background: transparent url('images/ico-separator.gif') no-repeat scroll left center; + float: left; + padding: 10px 6px 10px 16px !important; +} + +.g-breadcrumbs li.root { + background: transparent; +} + +.g-breadcrumbs li a, +.g-breadcrumbs li span { + display: block; +} + +.g-breadcrumbs li.active, +.g-breadcrumbs li.active span { + font-weight: bold; +} + +#g-dialog ul.g-breadcrumbs { + clear: both; + margin-left: 0; + padding-left: 0; +} + +#g-dialog .g-breadcrumbs li { + font-size: .9em; +} + +/* Pagination ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + .g-pager { + clear: both; + margin: 0; + padding: 5px 0 !important; + width: 100%; +} + +.g-pager li { + float: left; + margin: 0; + width: 30%; +} + +.g-pager .g-info { + text-align: center; + width: 40%; } .g-list-horizontal { diff --git a/lib/gallery.common.js b/lib/gallery.common.js index 59482b22..f2de74ad 100644 --- a/lib/gallery.common.js +++ b/lib/gallery.common.js @@ -24,8 +24,8 @@ if (container == null) { container = 'div'; } - $(this).html("<" + container + " class=\"gValign\">" + $(this).html() + ""); - var el = $(this).children(container + ".gValign"); + $(this).html("<" + container + " class=\"g-valign\">" + $(this).html() + ""); + var el = $(this).children(container + ".g-valign"); var elh = $(el).height(); var ph = $(this).height(); var nh = (ph - elh) / 2; @@ -47,21 +47,21 @@ /** * Toggle the processing indicator, both large and small - * @param elementID Target ID, including #, to apply .gLoadingSize + * @param elementID Target ID, including #, to apply .g-loading-size */ $.fn.gallery_show_loading = function() { return this.each(function(i){ var size; switch ($(this).attr("id")) { case "#g-dialog": - case "#gPanel": - size = "Large"; + case "#g-panel": + size = "large"; break; default: - size = "Small"; + size = "small"; break; } - $(this).toggleClass("gLoading" + size); + $(this).toggleClass("g-loading" + size); }); }; @@ -89,7 +89,7 @@ */ $.fn.gallery_get_photo = function() { var photo = $(this).find("img").filter(function() { - return this.id.match(/gPhotoId-\d+/); + return this.id.match(/g-photoId-\d+/); }); return photo; }; @@ -124,8 +124,8 @@ }; $.fn.gallery_context_menu = function() { - if ($(".gContextMenu li").length) { - var hover_target = ".gContextMenu"; + if ($(".g-context-menu li").length) { + var hover_target = ".g-context-menu"; var in_progress = 0; $(hover_target + " *").removeAttr('title'); $(hover_target + " ul").hide(); @@ -133,8 +133,8 @@ function() { if (in_progress == 0) { $(this).find("ul").slideDown("fast", function() { in_progress = 1; }); - $(this).find(".g-dialogLink").gallery_dialog(); - $(this).find(".gAjaxLink").gallery_ajax(); + $(this).find(".g-dialog-link").gallery_dialog(); + $(this).find(".g-ajax-link").gallery_ajax(); } }, function() { diff --git a/lib/gallery.dialog.js b/lib/gallery.dialog.js index a70200f9..c162ab2a 100644 --- a/lib/gallery.dialog.js +++ b/lib/gallery.dialog.js @@ -36,7 +36,7 @@ $("#g-dialog").dialog("open"); // Remove titlebar for progress dialogs or set title - if ($("#g-dialog #gProgress").length) { + if ($("#g-dialog #g-progress").length) { $(".ui-dialog-titlebar").remove(); } else if ($("#g-dialog h1").length) { $("#g-dialog").dialog('option', 'title', $("#g-dialog h1:eq(0)").html()); @@ -61,7 +61,7 @@ dialogWidth = size.width() - 100; // Set the iframe width and height $("#g-dialog iframe").width("100%").height(size.height() - 100); - } else if ($("#g-dialog .g-dialogPanel").length) { + } else if ($("#g-dialog .g-dialog-panel").length) { dialogWidth = size.width() - 100; $("#g-dialog").dialog("option", "height", size.height() - 100); } else if (childWidth == "" || childWidth > 300) { diff --git a/lib/gallery.panel.js b/lib/gallery.panel.js index 6115297d..8530dd9f 100644 --- a/lib/gallery.panel.js +++ b/lib/gallery.panel.js @@ -8,7 +8,7 @@ var parent = $(element).parent().parent(); var sHref = $(element).attr("href"); var parentClass = $(parent).attr("class"); - var ePanel = ""; + var ePanel = ""; // We keep track of the open vs. closed state by looking to see if there' // an orig_text attr. If that attr is missing, then the panel is closed @@ -16,12 +16,12 @@ var should_open = !$(element).attr("orig_text"); // Close any open panels and reset their button text - if ($("#gPanel").length) { - $("#gPanel").slideUp("slow").remove(); - $.each($(".gPanelLink"), + if ($("#g-panel").length) { + $("#g-panel").slideUp("slow").remove(); + $.each($(".g-panel-link"), function() { if ($(this).attr("orig_text")) { - $(this).children(".gButtonText").text($(this).attr("orig_text")); + $(this).children(".g-button-text").text($(this).attr("orig_text")); $(this).attr("orig_text", ""); } } @@ -30,15 +30,15 @@ if (should_open) { $(parent).after(ePanel); - $("#gPanel td").html(sHref); + $("#g-panel td").html(sHref); $.get(sHref, function(data) { - $("#gPanel td").html(data); + $("#g-panel td").html(data); self._ajaxify_panel(); if ($(element).attr("open_text")) { - $(element).attr("orig_text", $(element).children(".gButtonText").text()); - $(element).children(".gButtonText").text($(element).attr("open_text")); + $(element).attr("orig_text", $(element).children(".g-button-text").text()); + $(element).children(".g-button-text").text($(element).attr("open_text")); } - $("#gPanel").addClass(parentClass).show().slideDown("slow"); + $("#g-panel").addClass(parentClass).show().slideDown("slow"); }); } @@ -48,11 +48,11 @@ _ajaxify_panel: function () { var self = this; - $("#gPanel td form").ajaxForm({ + $("#g-panel td form").ajaxForm({ dataType: "json", success: function(data) { if (data.form) { - $("#gPanel td form").replaceWith(data.form); + $("#g-panel td form").replaceWith(data.form); self._ajaxify_panel(); } if (data.result == "success") { diff --git a/lib/gallery.show_full_size.js b/lib/gallery.show_full_size.js index 360ecdc2..49dc620a 100644 --- a/lib/gallery.show_full_size.js +++ b/lib/gallery.show_full_size.js @@ -7,7 +7,7 @@ var height = $(document).height(); var size = $.gallery_get_viewport_size(); - $("body").append('
    ' + - '
    '); $().click(function() { - $("#gFullsizeOverlay*").remove(); - $("#gFullsize").remove(); + $("#g-fullsize-overlay*").remove(); + $("#g-fullsize").remove(); }); $().bind("keypress", function() { - $("#gFullsizeOverlay*").remove(); - $("#gFullsize").remove(); + $("#g-fullsize-overlay*").remove(); + $("#g-fullsize").remove(); }); $(window).resize(function() { - $("#gFullsizeOverlay").width($(document).width()).height($(document).height()); + $("#g-fullsize-overlay").width($(document).width()).height($(document).height()); image_size = $.gallery_auto_fit_window(image_width, image_height); - $("#gFullsize").height(image_size.height) + $("#g-fullsize").height(image_size.height) .width(image_size.width) .css("top", image_size.top) .css("left", image_size.left); - $("#gFullSizeImage").height(image_size.height).width(image_size.width); + $("#g-fullsize-image").height(image_size.height).width(image_size.width); }); }; })(jQuery); diff --git a/lib/images/ico-separator.gif b/lib/images/ico-separator.gif new file mode 100644 index 00000000..3de2d0d3 Binary files /dev/null and b/lib/images/ico-separator.gif differ diff --git a/modules/akismet/helpers/akismet.php b/modules/akismet/helpers/akismet.php index acd5cb3e..43549ffa 100644 --- a/modules/akismet/helpers/akismet.php +++ b/modules/akismet/helpers/akismet.php @@ -21,7 +21,7 @@ class akismet_Core { public static $test_mode = TEST_MODE; static function get_configure_form() { - $form = new Forge("admin/akismet", "", "post", array("id" => "gConfigureAkismetForm")); + $form = new Forge("admin/akismet", "", "post", array("id" => "g-configure-akismet-form")); $group = $form->group("configure_akismet")->label(t("Configure Akismet")); $group->input("api_key")->label(t("API Key"))->value(module::get_var("akismet", "api_key")); $group->api_key->error_messages("invalid", t("The API key you provided is invalid.")); diff --git a/modules/akismet/views/admin_akismet.html.php b/modules/akismet/views/admin_akismet.html.php index 009d8810..22c60c97 100644 --- a/modules/akismet/views/admin_akismet.html.php +++ b/modules/akismet/views/admin_akismet.html.php @@ -1,5 +1,5 @@ -
    +

    Wordpress.com API Key, which is also free. Your comments will be automatically relayed to Akismet.com where they'll be scanned for spam. Spam messages will be flagged accordingly and hidden from your vistors until you approve or delete them.", @@ -8,7 +8,7 @@

    -
    +
    diff --git a/modules/akismet/views/admin_akismet_stats.html.php b/modules/akismet/views/admin_akismet_stats.html.php index 41bad15b..32908ba0 100644 --- a/modules/akismet/views/admin_akismet_stats.html.php +++ b/modules/akismet/views/admin_akismet_stats.html.php @@ -1,11 +1,11 @@ -
    -
    diff --git a/modules/comment/helpers/comment.php b/modules/comment/helpers/comment.php index f74a8644..7b2332a8 100644 --- a/modules/comment/helpers/comment.php +++ b/modules/comment/helpers/comment.php @@ -65,12 +65,12 @@ class comment_Core { } static function get_add_form($item) { - $form = new Forge("comments", "", "post", array("id" => "gAddCommentForm")); + $form = new Forge("comments", "", "post", array("id" => "g-comment-form")); $group = $form->group("add_comment")->label(t("Add comment")); - $group->input("name") ->label(t("Name")) ->id("gAuthor"); - $group->input("email") ->label(t("Email (hidden)")) ->id("gEmail"); - $group->input("url") ->label(t("Website (hidden)"))->id("gUrl"); - $group->textarea("text")->label(t("Comment")) ->id("gText"); + $group->input("name") ->label(t("Name")) ->id("g-author"); + $group->input("email") ->label(t("Email (hidden)")) ->id("g-email"); + $group->input("url") ->label(t("Website (hidden)"))->id("g-url"); + $group->textarea("text")->label(t("Comment")) ->id("g-text"); $group->hidden("item_id")->value($item->id); module::event("comment_add_form", $form); $group->submit("")->value(t("Add")); @@ -90,12 +90,12 @@ class comment_Core { static function get_edit_form($comment) { $form = new Forge("comments/{$comment->id}?_method=put", "", "post", - array("id" => "gEditCommentForm")); + array("id" => "g-edit-comment-form")); $group = $form->group("edit_comment")->label(t("Edit comment")); - $group->input("name") ->label(t("Author")) ->id("gAuthor"); - $group->input("email") ->label(t("Email (hidden)")) ->id("gEmail"); - $group->input("url") ->label(t("Website (hidden)"))->id("gUrl"); - $group->textarea("text")->label(t("Comment")) ->id("gText"); + $group->input("name") ->label(t("Author")) ->id("g-author"); + $group->input("email") ->label(t("Email (hidden)")) ->id("g-email"); + $group->input("url") ->label(t("Website (hidden)"))->id("g-url"); + $group->textarea("text")->label(t("Comment")) ->id("g-text"); $group->submit("")->value(t("Edit")); $group->text = $comment->text; diff --git a/modules/comment/helpers/comment_block.php b/modules/comment/helpers/comment_block.php index b989be6b..c00c6c51 100644 --- a/modules/comment/helpers/comment_block.php +++ b/modules/comment/helpers/comment_block.php @@ -26,7 +26,7 @@ class comment_block_Core { $block = new Block(); switch ($block_id) { case "recent_comments": - $block->css_id = "gRecentComments"; + $block->css_id = "g-recent-comments"; $block->title = t("Recent Comments"); $block->content = new View("admin_block_recent_comments.html"); $block->content->comments = diff --git a/modules/comment/helpers/comment_event.php b/modules/comment/helpers/comment_event.php index 0234aea9..2199eb7f 100644 --- a/modules/comment/helpers/comment_event.php +++ b/modules/comment/helpers/comment_event.php @@ -36,7 +36,7 @@ class comment_event_Core { ->id("comments") ->label(t("View comments on this item")) ->url("#comments") - ->css_id("gCommentsLink")); + ->css_id("g-comments-link")); } static function item_index_data($item, $data) { diff --git a/modules/comment/helpers/comment_theme.php b/modules/comment/helpers/comment_theme.php index e9b402f6..10c855db 100644 --- a/modules/comment/helpers/comment_theme.php +++ b/modules/comment/helpers/comment_theme.php @@ -25,7 +25,7 @@ class comment_theme_Core { static function photo_bottom($theme) { $block = new Block; - $block->css_id = "gComments"; + $block->css_id = "g-comments"; $block->title = t("Comments"); $block->anchor = "comments"; diff --git a/modules/comment/js/comment.js b/modules/comment/js/comment.js index 6e985626..96370fb1 100644 --- a/modules/comment/js/comment.js +++ b/modules/comment/js/comment.js @@ -1,43 +1,43 @@ $("document").ready(function() { - $("#gAddCommentButton").click(function(event) { + $("#g-admin-comment-button").click(function(event) { event.preventDefault(); - if (!$("#gAddCommentForm").length) { + if (!$("#g-comment-form").length) { $.get($(this).attr("href"), {}, function(data) { - $("#gCommentDetail").append(data); + $("#g-comment-detail").append(data); ajaxify_comment_form(); }); } }); - $("#gNoComments").click(function(event) { + $("#g-no-comments").click(function(event) { event.preventDefault(); - if (!$("#gAddCommentForm").length) { + if (!$("#g-comment-form").length) { $.get($(this).attr("href"), {}, function(data) { - $("#gCommentDetail").append(data); + $("#g-comment-detail").append(data); ajaxify_comment_form(); }); - $("#gNoCommentsYet").remove(); + $("#g-no-comments-yet").remove(); } }); }); function ajaxify_comment_form() { - $("#gComments form").ajaxForm({ + $("#g-comments form").ajaxForm({ dataType: "json", success: function(data) { if (data.form) { - $("#gComments form").replaceWith(data.form); + $("#g-comments form").replaceWith(data.form); ajaxify_comment_form(); } if (data.result == "success") { $.get(data.resource, function(data, textStatus) { - $("#gComments .gBlockContent ul:first").append("
  • "+data+"
  • "); - $("#gComments .gBlockContent ul:first li:last").effect("highlight", {color: "#cfc"}, 8000); - $("#gAddCommentForm").hide(2000).remove(); - $("#gNoCommentsYet").hide(2000); + $("#g-comments .g-block-content ul:first").append("
  • "+data+"
  • "); + $("#g-comments .g-block-content ul:first li:last").effect("highlight", {color: "#cfc"}, 8000); + $("#g-comment-form").hide(2000).remove(); + $("#g-no-comments-yet").hide(2000); }); } } diff --git a/modules/comment/views/admin_block_recent_comments.html.php b/modules/comment/views/admin_block_recent_comments.html.php index ca0d1c0b..7941e02d 100644 --- a/modules/comment/views/admin_block_recent_comments.html.php +++ b/modules/comment/views/admin_block_recent_comments.html.php @@ -1,9 +1,9 @@
      $comment): ?> -
    • "> +
    • "> " - class="gAvatar" + class="g-avatar" alt="author_name()) ?>" width="32" height="32" /> diff --git a/modules/comment/views/admin_comments.html.php b/modules/comment/views/admin_comments.html.php index 82de378c..0e8dd525 100644 --- a/modules/comment/views/admin_comments.html.php +++ b/modules/comment/views/admin_comments.html.php @@ -6,7 +6,7 @@ $.get(set_state_url.replace("__STATE__", state).replace("__ID__", id), {}, function() { - $("#gComment-" + id).slideUp(); + $("#g-comment-" + id).slideUp(); update_menu(); }); } @@ -18,7 +18,7 @@ $.get(delete_url.replace("__ID__", id), {}, function() { - $("#gComment-" + id).slideUp(); + $("#g-comment-" + id).slideUp(); update_menu(); }); } @@ -27,18 +27,18 @@ $.get(, {}, function(data) { for (var i = 0; i < data.length; i++) { - $("#gAdminCommentsMenu li:eq(" + i + ") a").html(data[i]); + $("#g-admin-comments-menu li:eq(" + i + ") a").html(data[i]); } }, "json"); } -
      +

      -
      +
      @@ -90,7 +90,7 @@
      - +
      $comment): ?> - "> + ">
      @@ -103,11 +103,11 @@
      " - class="gAvatar" + class="g-avatar" alt="author_name()) ?>" width="40" height="40" /> @@ -118,7 +118,7 @@ -
        +
          state != "unpublished"): ?>
        • -
        • -

          +

        • +

          " - class="gAvatar" + class="g-avatar" alt="author_name()) ?>" width="40" height="40" /> diff --git a/modules/comment/views/comments.html.php b/modules/comment/views/comments.html.php index ee4a8ad6..636f1522 100644 --- a/modules/comment/views/comments.html.php +++ b/modules/comment/views/comments.html.php @@ -1,23 +1,23 @@ - id})") ?>" id="gAddCommentButton" + id})") ?>" id="g-admin-comment-button" class="g-button ui-corner-all ui-icon-left ui-state-default right"> -

          +
          count()): ?> -

          +

          comment!", - array("attrs" => html::mark_clean("id= \"gNoComments\" href=\"" . url::site("form/add/comments/{$item->id}") . "\" class=\"showCommentForm\""))) ?> + array("attrs" => html::mark_clean("id= \"g-no-comments\" href=\"" . url::site("form/add/comments/{$item->id}") . "\" class=\"showCommentForm\""))) ?>

            -
          • -

            +

          • +

            " - class="gAvatar" + class="g-avatar" alt="author_name()) ?>" width="40" height="40" /> diff --git a/modules/digibug/helpers/digibug_event.php b/modules/digibug/helpers/digibug_event.php index d2830b80..37fa57e5 100644 --- a/modules/digibug/helpers/digibug_event.php +++ b/modules/digibug/helpers/digibug_event.php @@ -32,8 +32,8 @@ class digibug_event_Core { ->id("digibug") ->label(t("Print with Digibug")) ->url(url::site("digibug/print_photo/$item->id?csrf=$theme->csrf")) - ->css_id("gDigibugLink") - ->css_class("ui-icon-print")); + ->css_id("g-print-digibug-link") + ->css_class("g-print-digibug-link ui-icon-print")); } static function context_menu($menu, $theme, $item) { @@ -43,8 +43,7 @@ class digibug_event_Core { ->id("digibug") ->label(t("Print with Digibug")) ->url(url::site("digibug/print_photo/$item->id?csrf=$theme->csrf")) - ->css_id("gDigibugLink") - ->css_class("ui-icon-print")); + ->css_class("g-print-digibug-link ui-icon-print")); } } } diff --git a/modules/digibug/js/digibug.js b/modules/digibug/js/digibug.js index 30bff47d..46ddac52 100644 --- a/modules/digibug/js/digibug.js +++ b/modules/digibug/js/digibug.js @@ -1,10 +1,5 @@ $(document).ready(function() { - $(".gDigibugPrintButton a").click(function(e) { - e.preventDefault(); - return digibug_popup(e.currentTarget.href, { width: 800, height: 600 } ); - }); - - $("#gDigibugLink").click(function(e) { + $(".g-print-digibug-link").click(function(e) { e.preventDefault(); return digibug_popup(e.currentTarget.href, { width: 800, height: 600 } ); }); diff --git a/modules/digibug/views/admin_digibug.html.php b/modules/digibug/views/admin_digibug.html.php index cb952a8a..f75adc60 100644 --- a/modules/digibug/views/admin_digibug.html.php +++ b/modules/digibug/views/admin_digibug.html.php @@ -1,14 +1,14 @@ -

            -
            - "> +
            +
            + ">

              -
            • +
            diff --git a/modules/exif/helpers/exif.php b/modules/exif/helpers/exif.php index 453690ea..5ddd09d4 100644 --- a/modules/exif/helpers/exif.php +++ b/modules/exif/helpers/exif.php @@ -163,7 +163,7 @@ class exif_Core { list ($remaining) = exif::stats(); if ($remaining) { site_status::warning( - t('Your Exif index needs to be updated.
            Fix this now', + t('Your Exif index needs to be updated. Fix this now', array("url" => html::mark_clean(url::site("admin/maintenance/start/exif_task::update_index?csrf=__CSRF__")))), "exif_index_out_of_date"); } diff --git a/modules/exif/views/exif_dialog.html.php b/modules/exif/views/exif_dialog.html.php index 11d1e212..b50eea1d 100644 --- a/modules/exif/views/exif_dialog.html.php +++ b/modules/exif/views/exif_dialog.html.php @@ -1,30 +1,30 @@ -

            -
            - +
            +
            - - - - - + diff --git a/modules/exif/views/exif_sidebar.html.php b/modules/exif/views/exif_sidebar.html.php index 3c7bb517..04f72b02 100644 --- a/modules/exif/views/exif_sidebar.html.php +++ b/modules/exif/views/exif_sidebar.html.php @@ -1,7 +1,6 @@ -id}") ?>" title="for_html_attr() ?>" - class="g-dialogLink g-button ui-icon-left ui-state-default ui-corner-all"> +id}") ?>" title="for_html_attr() ?>" + class="g-dialog-link g-button ui-icon-left ui-state-default ui-corner-all"> - diff --git a/modules/g2_import/controllers/admin_g2_import.php b/modules/g2_import/controllers/admin_g2_import.php index 18d09363..1c65f482 100644 --- a/modules/g2_import/controllers/admin_g2_import.php +++ b/modules/g2_import/controllers/admin_g2_import.php @@ -68,7 +68,7 @@ class Admin_g2_import_Controller extends Admin_Controller { private function _get_import_form() { $form = new Forge( - "admin/g2_import/save", "", "post", array("id" => "gAdminConfigureG2ImportForm")); + "admin/g2_import/save", "", "post", array("id" => "g-admin-configure-g2-import-form")); $group = $form->group("configure_g2_import")->label(t("Configure Gallery 2 Import")); $group->input("embed_path")->label(t("Filesystem path to your Gallery 2 embed.php file")) ->value(module::get_var("g2_import", "embed_path", "")); diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 7e5c6f75..99d56d5d 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -201,7 +201,7 @@ class g2_import_Core { if (g2_import::g2_module_active("tags") && module::is_active("tag")) { $result = - g2($gallery->search("SELECT COUNT(DISTINCT([TagItemMap::itemId])) FROM [TagItemMap]")) + g2($gallery->search("SELECT COUNT(DISTINCT([Tag-itemMap::itemId])) FROM [Tag-itemMap]")) ->nextResult(); $stats["tags"] = $result[0]; } else { @@ -853,8 +853,8 @@ class g2_import_Core { $ids = array(); $results = g2($gallery->search( - "SELECT DISTINCT([TagItemMap::itemId]) FROM [TagItemMap] " . - "WHERE [TagItemMap::itemId] > ?", + "SELECT DISTINCT([Tag-itemMap::itemId]) FROM [Tag-itemMap] " . + "WHERE [Tag-itemMap::itemId] > ?", array($min_id), array("limit" => array("count" => 100)))); while ($result = $results->nextResult()) { diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php index 314f030b..51a1e245 100644 --- a/modules/g2_import/views/admin_g2_import.html.php +++ b/modules/g2_import/views/admin_g2_import.html.php @@ -1,11 +1,11 @@ -
            +

            -
            +

            @@ -28,14 +28,14 @@ -

            +

            -
              -
            • +
                +
              • g2_import::version())) ?>
              • -
              • +
              • Using the same value will speed up your import.", array("g2_pixels" => $g2_sizes["thumb"]["size"], "g3_pixels" => $thumb_size, @@ -44,7 +44,7 @@ -
              • +
              • Using the same value will speed up your import.", array("g2_pixels" => $g2_sizes["resize"]["size"], "g3_pixels" => $resize_size, @@ -53,7 +53,7 @@
              -
              +

              @@ -84,7 +84,7 @@

              - "> diff --git a/modules/gallery/controllers/admin_dashboard.php b/modules/gallery/controllers/admin_dashboard.php index 6bf3b966..7e28f625 100644 --- a/modules/gallery/controllers/admin_dashboard.php +++ b/modules/gallery/controllers/admin_dashboard.php @@ -22,7 +22,7 @@ class Admin_Dashboard_Controller extends Admin_Controller { $view = new Admin_View("admin.html"); $view->content = new View("admin_dashboard.html"); $view->content->blocks = block_manager::get_html("dashboard_center"); - $view->sidebar = "

              " . + $view->sidebar = "
              " . block_manager::get_html("dashboard_sidebar") . "
              "; print $view; diff --git a/modules/gallery/controllers/admin_languages.php b/modules/gallery/controllers/admin_languages.php index a9693d21..8af1dd85 100644 --- a/modules/gallery/controllers/admin_languages.php +++ b/modules/gallery/controllers/admin_languages.php @@ -105,7 +105,7 @@ class Admin_Languages_Controller extends Admin_Controller { } private function _share_translations_form() { - $form = new Forge("admin/languages/share", "", "post", array("id" => "gShareTranslationsForm")); + $form = new Forge("admin/languages/share", "", "post", array("id" => "g-share-translations-form")); $group = $form->group("sharing") ->label(t("Sharing your own translations with the Gallery community is easy. Please do!")); $api_key = l10n_client::api_key(); diff --git a/modules/gallery/controllers/l10n_client.php b/modules/gallery/controllers/l10n_client.php index 6e19310b..6fdbb3a1 100644 --- a/modules/gallery/controllers/l10n_client.php +++ b/modules/gallery/controllers/l10n_client.php @@ -102,9 +102,9 @@ class L10n_Client_Controller extends Controller { } private static function _l10n_client_search_form() { - $form = new Forge("l10n_client/search", "", "post", array("id" => "gL10nSearchForm")); + $form = new Forge("l10n_client/search", "", "post", array("id" => "g-l10n-search-form")); $group = $form->group("l10n_search"); - $group->input("l10n-search")->id("gL10nSearch"); + $group->input("l10n-search")->id("g-l10n-search"); $group->submit("l10n-search-filter-clear")->value(t("X")); return $form; diff --git a/modules/gallery/css/debug.css b/modules/gallery/css/debug.css index fe5665ad..6808da09 100644 --- a/modules/gallery/css/debug.css +++ b/modules/gallery/css/debug.css @@ -1,4 +1,4 @@ -.gAnnotatedThemeBlock { +.g-annotated-theme-block { border: 1px solid #C00; clear: both; margin: 1em; @@ -6,15 +6,15 @@ position: relative; } -.gAnnotatedThemeBlock_album_top { +.g-annotated-theme-block_album_top { float: right; } -.gAnnotatedThemeBlock_header_bottom { +.g-annotated-theme-block_header_bottom { float: right; } -.gAnnotatedThemeBlock div.title { +.g-annotated-theme-block div.title { background: #C00; border: 1px solid black; color: white; diff --git a/modules/gallery/css/l10n_client.css b/modules/gallery/css/l10n_client.css index 9c1b12d0..542da8e6 100644 --- a/modules/gallery/css/l10n_client.css +++ b/modules/gallery/css/l10n_client.css @@ -1,6 +1,8 @@ -// TODO(andy_st): Add original copyright notice from Drupal l10_client. -// TODO(andy_st): Add G3 copyright notice. -// TODO(andy_st): clean up formatting to match our other CSS files. +/** + * TODO(andy_st): Add original copyright notice from Drupal l10_client. + * TODO(andy_st): Add G3 copyright notice. + * TODO(andy_st): clean up formatting to match our other CSS files. + */ /* $Id: l10n_client.css,v 1.6 2008/09/09 10:48:20 goba Exp $ */ @@ -50,7 +52,7 @@ font-size: 1em; padding: .5em; } -#l10n-client-toggler #gMinimizeL10n { +#l10n-client-toggler #g-minimize-l10n { border-right: 1px solid #ffffff; } @@ -126,31 +128,31 @@ #l10n-client .string-list li.active { font-weight:bold;} -#l10n-client #gL10nSearchForm { +#l10n-client #g-l10n-search-form { background:#eee; text-align:center; height:2em; line-height:2em; margin:0em; padding:.5em .5em; } -#l10n-client #gL10nSearchForm .form-item, -#l10n-client #gL10nSearchForm input.form-text, -#l10n-client #gL10nSearchForm #search-filter-go, -#l10n-client #gL10nSearchForm #search-filter-clear { +#l10n-client #g-l10n-search-form .form-item, +#l10n-client #g-l10n-search-form input.form-text, +#l10n-client #g-l10n-search-form #search-filter-go, +#l10n-client #g-l10n-search-form #search-filter-clear { display:inline; vertical-align:middle; } -#l10n-client #gL10nSearchForm .form-item { +#l10n-client #g-l10n-search-form .form-item { margin:0em; padding:0em; } -#l10n-client #gL10nSearchForm input.form-text { +#l10n-client #g-l10n-search-form input.form-text { width:80%; } -#l10n-client #gL10nSearchForm #search-filter-clear { +#l10n-client #g-l10n-search-form #search-filter-clear { width:10%; margin:0em; } @@ -178,7 +180,7 @@ overflow:hidden; width:49%; float:right;} -#gL10nClientSaveForm { +#g-l10n-client-save-form { padding:0em;} #l10n-client form ul, diff --git a/modules/gallery/helpers/album.php b/modules/gallery/helpers/album.php index 65868cf2..72a79a75 100644 --- a/modules/gallery/helpers/album.php +++ b/modules/gallery/helpers/album.php @@ -92,7 +92,7 @@ class album_Core { } static function get_add_form($parent) { - $form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gAddAlbumForm")); + $form = new Forge("albums/{$parent->id}", "", "post", array("id" => "g-add-album-form")); $group = $form->group("add_album") ->label(t("Add an album to %album_title", array("album_title" => $parent->title))); $group->input("title")->label(t("Title")); @@ -114,7 +114,7 @@ class album_Core { } static function get_edit_form($parent) { - $form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gEditAlbumForm")); + $form = new Forge("albums/{$parent->id}", "", "post", array("id" => "g-edit-album-form")); $form->hidden("_method")->value("put"); $group = $form->group("edit_item")->label(t("Edit Album")); @@ -141,14 +141,14 @@ class album_Core { $group->hidden("slug")->value($parent->slug); } - $sort_order = $group->group("sort_order", array("id" => "gAlbumSortOrder")) + $sort_order = $group->group("sort_order", array("id" => "g-album-sort-order")) ->label(t("Sort Order")); - $sort_order->dropdown("column", array("id" => "gAlbumSortColumn")) + $sort_order->dropdown("column", array("id" => "g-album-sort-column")) ->label(t("Sort by")) ->options(album::get_sort_order_options()) ->selected($parent->sort_column); - $sort_order->dropdown("direction", array("id" => "gAlbumSortDirection")) + $sort_order->dropdown("direction", array("id" => "g-album-sort-direction")) ->label(t("Order")) ->options(array("ASC" => t("Ascending"), "DESC" => t("Descending"))) diff --git a/modules/gallery/helpers/gallery_block.php b/modules/gallery/helpers/gallery_block.php index f2cb8ded..5d49a9de 100644 --- a/modules/gallery/helpers/gallery_block.php +++ b/modules/gallery/helpers/gallery_block.php @@ -32,13 +32,13 @@ class gallery_block_Core { $block = new Block(); switch($block_id) { case "welcome": - $block->css_id = "gWelcome"; + $block->css_id = "g-welcome"; $block->title = t("Welcome to Gallery 3"); $block->content = new View("admin_block_welcome.html"); break; case "photo_stream": - $block->css_id = "gPhotoStream"; + $block->css_id = "g-photo-stream"; $block->title = t("Photo Stream"); $block->content = new View("admin_block_photo_stream.html"); $block->content->photos = @@ -46,7 +46,7 @@ class gallery_block_Core { break; case "log_entries": - $block->css_id = "gLogEntries"; + $block->css_id = "g-log-entries"; $block->title = t("Log Entries"); $block->content = new View("admin_block_log_entries.html"); $block->content->entries = ORM::factory("log") @@ -54,7 +54,7 @@ class gallery_block_Core { break; case "stats": - $block->css_id = "gStats"; + $block->css_id = "g-stats"; $block->title = t("Gallery Stats"); $block->content = new View("admin_block_stats.html"); $block->content->album_count = @@ -63,7 +63,7 @@ class gallery_block_Core { break; case "platform_info": - $block->css_id = "gPlatform"; + $block->css_id = "g-platform"; $block->title = t("Platform Information"); $block->content = new View("admin_block_platform.html"); if (is_readable("/proc/loadavg")) { @@ -75,14 +75,14 @@ class gallery_block_Core { break; case "project_news": - $block->css_id = "gProjectNews"; + $block->css_id = "g-project-news"; $block->title = t("Gallery Project News"); $block->content = new View("admin_block_news.html"); $block->content->feed = feed::parse("http://gallery.menalto.com/node/feed", 3); break; case "block_adder": - $block->css_id = "gBlockAdder"; + $block->css_id = "g-block-adder"; $block->title = t("Dashboard Content"); $block->content = self::get_add_block_form(); } @@ -92,7 +92,7 @@ class gallery_block_Core { static function get_add_block_form() { $form = new Forge("admin/dashboard/add_block", "", "post", - array("id" => "gAddDashboardBlockForm")); + array("id" => "g-add-dashboard-block-form")); $group = $form->group("add_block")->label(t("Add Block")); $group->dropdown("id")->label(t("Available Blocks")) ->options(block_manager::get_available_admin_blocks()); diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php index c01f4135..290d7d12 100644 --- a/modules/gallery/helpers/gallery_event.php +++ b/modules/gallery/helpers/gallery_event.php @@ -281,7 +281,7 @@ class gallery_event_Core { ->id("delete") ->label($delete_title) ->css_class("ui-icon-trash") - ->css_id("gQuickDelete") + ->css_id("g-quick-delete") ->url(url::site("quick/form_delete/$item->id?csrf=$csrf&page_type=$page_type"))); } diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php index f9b88638..ecddd86b 100644 --- a/modules/gallery/helpers/graphics.php +++ b/modules/gallery/helpers/graphics.php @@ -249,7 +249,7 @@ class graphics_Core { "%count of your photos are out of date. Click here to fix them", $count, array("attrs" => html::mark_clean(sprintf( - 'href="%s" class="g-dialogLink"', + 'href="%s" class="g-dialog-link"', url::site("admin/maintenance/start/gallery_task::rebuild_dirty_images?csrf=__CSRF__"))))), "graphics_dirty"); } diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php index 588c08d4..084bbc15 100644 --- a/modules/gallery/helpers/item.php +++ b/modules/gallery/helpers/item.php @@ -130,7 +130,7 @@ class item_Core { $page_type = "photo"; } $form = new Forge( - "quick/delete/$item->id?page_type=$page_type", "", "post", array("id" => "gConfirmDelete")); + "quick/delete/$item->id?page_type=$page_type", "", "post", array("id" => "g-confirm-delete")); $form->hidden("_method")->value("put"); $group = $form->group("confirm_delete")->label(t("Confirm Deletion")); $group->submit("")->value(t("Delete")); diff --git a/modules/gallery/helpers/log.php b/modules/gallery/helpers/log.php index 451f985a..c8e94b45 100644 --- a/modules/gallery/helpers/log.php +++ b/modules/gallery/helpers/log.php @@ -93,16 +93,16 @@ class log_Core { static function severity_class($severity) { switch($severity) { case self::SUCCESS: - return "gSuccess"; + return "g-success"; case self::INFO: - return "gInfo"; + return "g-info"; case self::WARNING: - return "gWarning"; + return "g-warning"; case self::ERROR: - return "gError"; + return "g-error"; } } } diff --git a/modules/gallery/helpers/message.php b/modules/gallery/helpers/message.php index af3b96cc..0d638571 100644 --- a/modules/gallery/helpers/message.php +++ b/modules/gallery/helpers/message.php @@ -81,7 +81,7 @@ class message_Core { $buf[] = "
            • $msg[0]
            • "; } if ($buf) { - return "
                " . implode("", $buf) . "
              "; + return "
                " . implode("", $buf) . "
              "; } } @@ -93,16 +93,16 @@ class message_Core { static function severity_class($severity) { switch($severity) { case self::SUCCESS: - return "gSuccess"; + return "g-success"; case self::INFO: - return "gInfo"; + return "g-info"; case self::WARNING: - return "gWarning"; + return "g-warning"; case self::ERROR: - return "gError"; + return "g-error"; } } } diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php index 6c8c6c88..2190fc94 100644 --- a/modules/gallery/helpers/movie.php +++ b/modules/gallery/helpers/movie.php @@ -129,7 +129,7 @@ class movie_Core { } static function get_edit_form($movie) { - $form = new Forge("movies/$movie->id", "", "post", array("id" => "gEditMovieForm")); + $form = new Forge("movies/$movie->id", "", "post", array("id" => "g-edit-movie-form")); $form->hidden("_method")->value("put"); $group = $form->group("edit_item")->label(t("Edit Movie")); $group->input("title")->label(t("Title"))->value($movie->title); diff --git a/modules/gallery/helpers/photo.php b/modules/gallery/helpers/photo.php index 065d2d31..692f7111 100644 --- a/modules/gallery/helpers/photo.php +++ b/modules/gallery/helpers/photo.php @@ -138,7 +138,7 @@ class photo_Core { } static function get_add_form($parent) { - $form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gAddPhotoForm")); + $form = new Forge("albums/{$parent->id}", "", "post", array("id" => "g-add-photo-form")); $group = $form->group("add_photo")->label( t("Add Photo to %album_title", array("album_title" => $parent->title))); $group->input("title")->label(t("Title")); @@ -157,7 +157,7 @@ class photo_Core { } static function get_edit_form($photo) { - $form = new Forge("photos/$photo->id", "", "post", array("id" => "gEditPhotoForm")); + $form = new Forge("photos/$photo->id", "", "post", array("id" => "g-edit-photo-form")); $form->hidden("_method")->value("put"); $group = $form->group("edit_item")->label(t("Edit Photo")); $group->input("title")->label(t("Title"))->value($photo->title); diff --git a/modules/gallery/helpers/site_status.php b/modules/gallery/helpers/site_status.php index 6d47e565..b7c6de9a 100644 --- a/modules/gallery/helpers/site_status.php +++ b/modules/gallery/helpers/site_status.php @@ -105,7 +105,7 @@ class site_status_Core { } if ($buf) { - return "
                " . implode("", $buf) . "
              "; + return "
                " . implode("", $buf) . "
              "; } } @@ -117,16 +117,16 @@ class site_status_Core { static function severity_class($severity) { switch($severity) { case self::SUCCESS: - return "gSuccess"; + return "g-success"; case self::INFO: - return "gInfo"; + return "g-info"; case self::WARNING: - return "gWarning"; + return "g-warning"; case self::ERROR: - return "gError"; + return "g-error"; } } } diff --git a/modules/gallery/helpers/theme.php b/modules/gallery/helpers/theme.php index b46a2c14..fb8f7ca7 100644 --- a/modules/gallery/helpers/theme.php +++ b/modules/gallery/helpers/theme.php @@ -40,22 +40,22 @@ class theme_Core { } static function get_edit_form_admin() { - $form = new Forge("admin/theme_options/save/", "", null, array("id" =>"gThemeOptionsForm")); + $form = new Forge("admin/theme_options/save/", "", null, array("id" =>"g-theme-options-form")); $group = $form->group("edit_theme"); - $group->input("page_size")->label(t("Items per page"))->id("gPageSize") + $group->input("page_size")->label(t("Items per page"))->id("g-page-size") ->rules("required|valid_digit") ->value(module::get_var("gallery", "page_size")); - $group->input("thumb_size")->label(t("Thumbnail size (in pixels)"))->id("gThumbSize") + $group->input("thumb_size")->label(t("Thumbnail size (in pixels)"))->id("g-thumb-size") ->rules("required|valid_digit") ->value(module::get_var("gallery", "thumb_size")); - $group->input("resize_size")->label(t("Resized image size (in pixels)"))->id("gResizeSize") + $group->input("resize_size")->label(t("Resized image size (in pixels)"))->id("g-resize-size") ->rules("required|valid_digit") ->value(module::get_var("gallery", "resize_size")); - $group->textarea("header_text")->label(t("Header text"))->id("gHeaderText") + $group->textarea("header_text")->label(t("Header text"))->id("g-header-text") ->value(module::get_var("gallery", "header_text")); - $group->textarea("footer_text")->label(t("Footer text"))->id("gFooterText") + $group->textarea("footer_text")->label(t("Footer text"))->id("g-footer-text") ->value(module::get_var("gallery", "footer_text")); - $group->checkbox("show_credits")->label(t("Show site credits"))->id("gFooterText") + $group->checkbox("show_credits")->label(t("Show site credits"))->id("g-footer-text") ->checked(module::get_var("gallery", "show_credits")); $group->submit("")->value(t("Save")); return $form; diff --git a/modules/gallery/js/albums_form_add.js b/modules/gallery/js/albums_form_add.js index 43166f27..a568f35d 100644 --- a/modules/gallery/js/albums_form_add.js +++ b/modules/gallery/js/albums_form_add.js @@ -1,22 +1,22 @@ -$("#gAddAlbumForm input[name=title]").change( +$("#g-add-album-form input[name=title]").change( function() { - $("#gAddAlbumForm input[name=name]").attr( - "value", $("#gAddAlbumForm input[name=title]").attr("value") + $("#g-add-album-form input[name=name]").attr( + "value", $("#g-add-album-form input[name=title]").attr("value") .replace(/[\s\/]+/g, "-").replace(/\.+$/, "")); - $("#gAddAlbumForm input[name=slug]").attr( - "value", $("#gAddAlbumForm input[name=title]").attr("value") + $("#g-add-album-form input[name=slug]").attr( + "value", $("#g-add-album-form input[name=title]").attr("value") .replace(/[^A-Za-z0-9-_]+/g, "-") .replace(/^-+/, "") .replace(/-+$/, "")); }); -$("#gAddAlbumForm input[name=title]").keyup( +$("#g-add-album-form input[name=title]").keyup( function() { - $("#gAddAlbumForm input[name=name]").attr( - "value", $("#gAddAlbumForm input[name=title]").attr("value") + $("#g-add-album-form input[name=name]").attr( + "value", $("#g-add-album-form input[name=title]").attr("value") .replace(/[\s\/]+/g, "-") .replace(/\.+$/, "")); - $("#gAddAlbumForm input[name=slug]").attr( - "value", $("#gAddAlbumForm input[name=title]").attr("value") + $("#g-add-album-form input[name=slug]").attr( + "value", $("#g-add-album-form input[name=title]").attr("value") .replace(/[^A-Za-z0-9-_]+/g, "-") .replace(/^-+/, "") .replace(/-+$/, "")); diff --git a/modules/gallery/js/l10n_client.js b/modules/gallery/js/l10n_client.js index 35986e5a..9acb6ca8 100644 --- a/modules/gallery/js/l10n_client.js +++ b/modules/gallery/js/l10n_client.js @@ -35,12 +35,12 @@ jQuery.extend(Gallery, { if(userSelection.length > 0) { Gallery.l10nClient.filter(userSelection); Gallery.l10nClient.toggle(1); - $('#l10n-client #gL10nSearch').focus(); + $('#l10n-client #g-l10n-search').focus(); } else { if($('#l10n-client').is('.hidden')) { Gallery.l10nClient.toggle(1); if(!$.browser.safari) { - $('#l10n-client #gL10nSearch').focus(); + $('#l10n-client #g-l10n-search').focus(); } } else { Gallery.l10nClient.toggle(0); @@ -59,7 +59,7 @@ jQuery.extend(Gallery, { $('#l10n-client-string-select, #l10n-client-string-editor, #l10n-client .labels .label').show(); $('#l10n-client').height('22em').removeClass('hidden'); //$('#l10n-client').slideUp(); - $('#gMinimizeL10n').text("_"); + $('#g-minimize-l10n').text("_"); /* * This CSS clashes with Gallery's CSS, probably due to * YUI's grid / floats. @@ -73,7 +73,7 @@ jQuery.extend(Gallery, { $('#l10n-client-string-select, #l10n-client-string-editor, #l10n-client .labels .label').hide(); $('#l10n-client').height('2em').addClass('hidden'); // TODO: Localize this message - $('#gMinimizeL10n').text(MSG_TRANSLATE_TEXT); + $('#g-minimize-l10n').text(MSG_TRANSLATE_TEXT); /* if(!$.browser.msie) { $('body').css('border-bottom', '0px'); @@ -131,13 +131,13 @@ jQuery.extend(Gallery, { if(search == false || search == '') { $('#l10n-client #l10n-search-filter-clear').focus(); $('#l10n-client-string-select li').show(); - $('#l10n-client #gL10nSearch').val(''); - $('#l10n-client #gL10nSearch').focus(); + $('#l10n-client #g-l10n-search').val(''); + $('#l10n-client #g-l10n-search').focus(); } else { if(search.length > 0) { $('#l10n-client-string-select li').hide(); $('#l10n-client-string-select li:contains('+search+')').show(); - $('#l10n-client #gL10nSearch').val(search); + $('#l10n-client #g-l10n-search').val(search); } } } @@ -193,12 +193,12 @@ Gallery.behaviors.l10nClient = function(context) { var is_plural = Gallery.l10nClient.isPluralMessage(source); Gallery.l10nClient.showSourceMessage(source, is_plural); Gallery.l10nClient.updateTranslationForm(Gallery.l10nClient.getString(index, 'translation'), is_plural); - $("#gL10nClientSaveForm input[name='l10n-message-key']").val(key); + $("#g-l10n-client-save-form input[name='l10n-message-key']").val(key); Gallery.l10nClient.selected = index; }); // When l10n_client window is clicked, toggle based on current state. - $('#gMinimizeL10n').click(function() { + $('#g-minimize-l10n').click(function() { if($('#l10n-client').is('.hidden')) { Gallery.l10nClient.toggle(1); } else { @@ -207,7 +207,7 @@ Gallery.behaviors.l10nClient = function(context) { }); // Close the l10n client using an AJAX call and refreshing the page - $('#gCloseL10n').click(function(event) { + $('#g-close-l10n').click(function(event) { $.ajax({ type: "GET", url: toggle_l10n_mode_url, @@ -223,12 +223,12 @@ Gallery.behaviors.l10nClient = function(context) { // TODO: Either remove hotkeys code or add query.hotkeys.js. if($.hotkeys) { $.hotkeys.add(Gallery.l10nClient.keys['toggle'], function(){Gallery.l10nClient.key('toggle')}); - $.hotkeys.add(Gallery.l10nClient.keys['clear'], {target:'#l10n-client #gL10nSearch', type:'keyup'}, function(){Gallery.l10nClient.key('clear')}); + $.hotkeys.add(Gallery.l10nClient.keys['clear'], {target:'#l10n-client #g-l10n-search', type:'keyup'}, function(){Gallery.l10nClient.key('clear')}); } // Custom listener for l10n_client livesearch - $('#l10n-client #gL10nSearch').keyup(function(key) { - Gallery.l10nClient.filter($('#l10n-client #gL10nSearch').val()); + $('#l10n-client #g-l10n-search').keyup(function(key) { + Gallery.l10nClient.filter($('#l10n-client #g-l10n-search').val()); }); // Clear search @@ -238,7 +238,7 @@ Gallery.behaviors.l10nClient = function(context) { }); // Send AJAX POST data on form submit. - $('#gL10nClientSaveForm').ajaxForm({ + $('#g-l10n-client-save-form').ajaxForm({ dataType: "json", success: function(data) { var source = Gallery.l10nClient.getString(Gallery.l10nClient.selected, 'source'); @@ -250,7 +250,7 @@ Gallery.behaviors.l10nClient = function(context) { var translation = {}; for (var i = 0; i < num_plural_forms; i++) { var form = plural_forms[i]; - translation[form] = $('#gL10nClientSaveForm #l10n-edit-plural-translation-' + form).attr('value'); + translation[form] = $('#g-l10n-client-save-form #l10n-edit-plural-translation-' + form).attr('value'); } } else { translation = $('#l10n-edit-translation').attr('value'); @@ -262,13 +262,13 @@ Gallery.behaviors.l10nClient = function(context) { // Clear the translation form fields Gallery.l10nClient.showSourceMessage('', false); - $('#gL10nClientSaveForm #l10n-edit-translation').val(''); + $('#g-l10n-client-save-form #l10n-edit-translation').val(''); for (var i = 0; i < num_plural_forms; i++) { var form = plural_forms[i]; - $('#gL10nClientSaveForm #l10n-edit-plural-translation-' + form).val(''); + $('#g-l10n-client-save-form #l10n-edit-plural-translation-' + form).val(''); } - $("#gL10nClientSaveForm input[name='l10n-message-key']").val(''); + $("#g-l10n-client-save-form input[name='l10n-message-key']").val(''); }, error: function(xmlhttp) { // TODO: Localize this message @@ -283,12 +283,12 @@ Gallery.behaviors.l10nClient = function(context) { // TODO: Handle plurals in copy button // Copy source text to translation field on button click. - $('#gL10nClientSaveForm #l10n-edit-copy').click(function() { - $('#gL10nClientSaveForm #l10n-edit-target').val($('#l10n-client-string-editor .source-text').text()); + $('#g-l10n-client-save-form #l10n-edit-copy').click(function() { + $('#g-l10n-client-save-form #l10n-edit-target').val($('#l10n-client-string-editor .source-text').text()); }); // Clear translation field on button click. - $('#gL10nClientSaveForm #l10n-edit-clear').click(function() { - $('#gL10nClientSaveForm #l10n-edit-target').val(''); + $('#g-l10n-client-save-form #l10n-edit-clear').click(function() { + $('#g-l10n-client-save-form #l10n-edit-target').val(''); }); }; diff --git a/modules/gallery/libraries/Admin_View.php b/modules/gallery/libraries/Admin_View.php index 9b12df7e..fa6d1dd3 100644 --- a/modules/gallery/libraries/Admin_View.php +++ b/modules/gallery/libraries/Admin_View.php @@ -96,7 +96,7 @@ class Admin_View_Core extends Gallery_View { if (Session::instance()->get("debug")) { if ($function != "admin_head") { array_unshift( - $blocks, "
              " . + $blocks, "
              " . "
              $function
              "); $blocks[] = "
              "; } diff --git a/modules/gallery/libraries/Menu.php b/modules/gallery/libraries/Menu.php index 4be374a2..47af8531 100644 --- a/modules/gallery/libraries/Menu.php +++ b/modules/gallery/libraries/Menu.php @@ -91,7 +91,7 @@ class Menu_Element_Link extends Menu_Element { } else { $css_class = ""; } - return "
            • url\" " . + return "
            • url\" " . "title=\"$this->label\">$this->label
            • "; } } @@ -122,7 +122,7 @@ class Menu_Element_Ajax_Link extends Menu_Element { } else { $css_class = ""; } - return "
            • url\" " . + return "
            • url\" " . "title=\"$this->label\" ajax_handler=\"$this->ajax_handler\">$this->label
            • "; } } @@ -142,7 +142,7 @@ class Menu_Element_Dialog extends Menu_Element { } else { $css_class = ""; } - return "
            • url\" " . + return "
            • url\" " . "title=\"$this->label\">$this->label
            • "; } } @@ -171,7 +171,7 @@ class Menu_Core extends Menu_Element { case "root": $menu = new Menu("root"); - $menu->css_class("gMenu"); + $menu->css_class("g-menu"); return $menu; case "submenu": diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index ab25a4b6..cba436e8 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -103,7 +103,7 @@ class Theme_View_Core extends Gallery_View { ->id("fullsize") ->label(t("View full size")) ->url($this->item()->file_url()) - ->css_class("gFullSizeLink")); + ->css_class("g-fullsize-link")); } module::event("photo_menu", $menu, $this); @@ -121,7 +121,7 @@ class Theme_View_Core extends Gallery_View { ->append(Menu::factory("submenu") ->id("context_menu") ->label(t("Options"))) - ->css_class("gContextMenu"); + ->css_class("g-context-menu"); module::event("context_menu", $menu, $this, $item, $thumbnail_css_selector); return $menu->compact(); @@ -231,7 +231,7 @@ class Theme_View_Core extends Gallery_View { if (Session::instance()->get("debug")) { if ($function != "head") { array_unshift( - $blocks, "
              " . + $blocks, "
              " . "
              $function
              "); $blocks[] = "
              "; } diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index ff02daf8..246d5fcd 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -567,7 +567,7 @@ class Item_Model extends ORM_MPTT { $v->attrs = array_merge($extra_attrs, array("style" => "display:block;width:{$this->width}px;height:{$this->height}px")); if (empty($v->attrs["id"])) { - $v->attrs["id"] = "gMovieId-{$this->id}"; + $v->attrs["id"] = "g-movie-id-{$this->id}"; } return $v; } diff --git a/modules/gallery/tests/DrawForm_Test.php b/modules/gallery/tests/DrawForm_Test.php index dde54257..7ee80ca2 100644 --- a/modules/gallery/tests/DrawForm_Test.php +++ b/modules/gallery/tests/DrawForm_Test.php @@ -19,14 +19,14 @@ */ class DrawForm_Test extends Unit_Test_Case { function no_group_test() { - $form = new Forge("test/controller", "", "post", array("id" => "gTestGroupForm")); + $form = new Forge("test/controller", "", "post", array("id" => "g-test-group-form")); $form->input("title")->label(t("Title")); $form->textarea("description")->label(t("Text Area")); $form->submit("")->value(t("Submit")); $rendered = $form->__toString(); $expected = "
              \n" . + "id=\"g-test-group-form\">\n" . "\n" . "
                \n" . "
              • \n" . @@ -48,7 +48,7 @@ class DrawForm_Test extends Unit_Test_Case { } function group_test() { - $form = new Forge("test/controller", "", "post", array("id" => "gTestGroupForm")); + $form = new Forge("test/controller", "", "post", array("id" => "g-test-group-form")); $group = $form->group("test_group")->label(t("Test Group")); $group->input("title")->label(t("Title")); $group->textarea("description")->label(t("Text Area")); @@ -56,7 +56,7 @@ class DrawForm_Test extends Unit_Test_Case { $rendered = $form->__toString(); $expected = "\n" . + "id=\"g-test-group-form\">\n" . "\n" . "
                \n" . " Test Group\n" . @@ -81,7 +81,7 @@ class DrawForm_Test extends Unit_Test_Case { } function form_script_test() { - $form = new Forge("test/controller", "", "post", array("id" => "gTestGroupForm")); + $form = new Forge("test/controller", "", "post", array("id" => "g-test-group-form")); $group = $form->group("test_group")->label(t("Test Group")); $group->input("title")->label(t("Title")); $group->textarea("description")->label(t("Text Area")); @@ -92,7 +92,7 @@ class DrawForm_Test extends Unit_Test_Case { $rendered = $form->__toString(); $expected = "\n" . + "id=\"g-test-group-form\">\n" . "\n" . "
                \n" . " Test Group\n" . diff --git a/modules/gallery/tests/selenium/Add_Comment.html b/modules/gallery/tests/selenium/Add_Comment.html index b4b96ed2..dff653da 100644 --- a/modules/gallery/tests/selenium/Add_Comment.html +++ b/modules/gallery/tests/selenium/Add_Comment.html @@ -18,22 +18,22 @@
            - + - + - + - + diff --git a/modules/gallery/tests/selenium/Login.html b/modules/gallery/tests/selenium/Login.html index 5e17a3c7..d2e45c63 100644 --- a/modules/gallery/tests/selenium/Login.html +++ b/modules/gallery/tests/selenium/Login.html @@ -18,17 +18,17 @@ - + - + - + @@ -38,7 +38,7 @@ - + diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt index 5fd6a390..c8ba3770 100644 --- a/modules/gallery/tests/xss_data.txt +++ b/modules/gallery/tests/xss_data.txt @@ -1,12 +1,12 @@ modules/akismet/views/admin_akismet.html.php 16 DIRTY $form modules/akismet/views/admin_akismet_stats.html.php 9 DIRTY_ATTR $api_key modules/akismet/views/admin_akismet_stats.html.php 9 DIRTY_ATTR urlencode($blog_url) -modules/comment/views/admin_block_recent_comments.html.php 4 DIRTY_ATTR ($i%2==0)?"g-even-row":"g-odd-row" +modules/comment/views/admin_block_recent_comments.html.php 4 DIRTY_ATTR ($i%2==0)?"g-even":"g-odd" modules/comment/views/admin_block_recent_comments.html.php 5 DIRTY_ATTR $comment->author()->avatar_url(32,$theme->url(,true)) modules/comment/views/admin_block_recent_comments.html.php 10 DIRTY gallery::date_time($comment->created) modules/comment/views/admin_comments.html.php 42 DIRTY $menu modules/comment/views/admin_comments.html.php 106 DIRTY_ATTR $comment->id -modules/comment/views/admin_comments.html.php 106 DIRTY_ATTR ($i%2==0)?"g-odd-row":"g-even-row" +modules/comment/views/admin_comments.html.php 106 DIRTY_ATTR ($i%2==0)?"g-odd":"g-even" modules/comment/views/admin_comments.html.php 109 DIRTY_ATTR $comment->author()->avatar_url(40,$theme->url(,true)) modules/comment/views/admin_comments.html.php 122 DIRTY_JS $item->url() modules/comment/views/admin_comments.html.php 124 DIRTY_ATTR $item->thumb_url() @@ -56,14 +56,14 @@ modules/gallery/views/admin_dashboard.html.php 35 DIRTY $block modules/gallery/views/admin_graphics.html.php 22 DIRTY newView("admin_graphics_none.html") modules/gallery/views/admin_graphics.html.php 24 DIRTY newView("admin_graphics_$active.html",array("tk"=>$tk->$active,"is_active"=>true)) modules/gallery/views/admin_graphics.html.php 31 DIRTY newView("admin_graphics_$id.html",array("tk"=>$tk->$id,"is_active"=>false)) -modules/gallery/views/admin_graphics_gd.html.php 2 DIRTY_ATTR $is_active?" gSelected":"" -modules/gallery/views/admin_graphics_gd.html.php 2 DIRTY_ATTR $tk->installed?" gInstalledToolkit":" gUnavailable" +modules/gallery/views/admin_graphics_gd.html.php 2 DIRTY_ATTR $is_active?" g-selected":"" +modules/gallery/views/admin_graphics_gd.html.php 2 DIRTY_ATTR $tk->installed?" g-installed-toolkit":" g-unavailable" modules/gallery/views/admin_graphics_gd.html.php 19 DIRTY $tk->error -modules/gallery/views/admin_graphics_graphicsmagick.html.php 2 DIRTY_ATTR $is_active?" gSelected":"" -modules/gallery/views/admin_graphics_graphicsmagick.html.php 2 DIRTY_ATTR $tk->installed?" gInstalledToolkit":" gUnavailable" +modules/gallery/views/admin_graphics_graphicsmagick.html.php 2 DIRTY_ATTR $is_active?" g-selected":"" +modules/gallery/views/admin_graphics_graphicsmagick.html.php 2 DIRTY_ATTR $tk->installed?" g-installed-toolkit":" g-unavailable" modules/gallery/views/admin_graphics_graphicsmagick.html.php 18 DIRTY $tk->error -modules/gallery/views/admin_graphics_imagemagick.html.php 2 DIRTY_ATTR $is_active?" gSelected":"" -modules/gallery/views/admin_graphics_imagemagick.html.php 2 DIRTY_ATTR $tk->installed?" gInstalledToolkit":" gUnavailable" +modules/gallery/views/admin_graphics_imagemagick.html.php 2 DIRTY_ATTR $is_active?" g-selected":"" +modules/gallery/views/admin_graphics_imagemagick.html.php 2 DIRTY_ATTR $tk->installed?" g-installed-toolkit":" g-unavailable" modules/gallery/views/admin_graphics_imagemagick.html.php 18 DIRTY $tk->error modules/gallery/views/admin_languages.html.php 9 DIRTY access::csrf_form_field() modules/gallery/views/admin_languages.html.php 27 DIRTY_ATTR (isset($installed_locales[$code]))?"installed":"" @@ -72,20 +72,20 @@ modules/gallery/views/admin_languages.html.php 28 DIRTY form:: modules/gallery/views/admin_languages.html.php 29 DIRTY $display_name modules/gallery/views/admin_languages.html.php 31 DIRTY form::radio("default_locale",$code,($default_locale==$code),((isset($installed_locales[$code]))?'':'disabled="disabled"')) modules/gallery/views/admin_languages.html.php 102 DIRTY $share_translations_form -modules/gallery/views/admin_maintenance.html.php 24 DIRTY_ATTR ($i%2==0)?"g-odd-row":"g-even-row" +modules/gallery/views/admin_maintenance.html.php 24 DIRTY_ATTR ($i%2==0)?"g-odd":"g-even" modules/gallery/views/admin_maintenance.html.php 24 DIRTY_ATTR log::severity_class($task->severity) modules/gallery/views/admin_maintenance.html.php 25 DIRTY_ATTR log::severity_class($task->severity) modules/gallery/views/admin_maintenance.html.php 26 DIRTY $task->name modules/gallery/views/admin_maintenance.html.php 29 DIRTY $task->description -modules/gallery/views/admin_maintenance.html.php 72 DIRTY_ATTR ($i%2==0)?"g-odd-row":"g-even-row" -modules/gallery/views/admin_maintenance.html.php 72 DIRTY_ATTR $task->state=="stalled"?"gWarning":"" -modules/gallery/views/admin_maintenance.html.php 73 DIRTY_ATTR $task->state=="stalled"?"gWarning":"" +modules/gallery/views/admin_maintenance.html.php 72 DIRTY_ATTR ($i%2==0)?"g-odd":"g-even" +modules/gallery/views/admin_maintenance.html.php 72 DIRTY_ATTR $task->state=="stalled"?"g-warning":"" +modules/gallery/views/admin_maintenance.html.php 73 DIRTY_ATTR $task->state=="stalled"?"g-warning":"" modules/gallery/views/admin_maintenance.html.php 74 DIRTY gallery::date_time($task->updated) modules/gallery/views/admin_maintenance.html.php 77 DIRTY $task->name modules/gallery/views/admin_maintenance.html.php 92 DIRTY $task->status -modules/gallery/views/admin_maintenance.html.php 145 DIRTY_ATTR ($i%2==0)?"g-odd-row":"g-even-row" -modules/gallery/views/admin_maintenance.html.php 145 DIRTY_ATTR $task->state=="success"?"gSuccess":"gError" -modules/gallery/views/admin_maintenance.html.php 146 DIRTY_ATTR $task->state=="success"?"gSuccess":"gError" +modules/gallery/views/admin_maintenance.html.php 145 DIRTY_ATTR ($i%2==0)?"g-odd":"g-even" +modules/gallery/views/admin_maintenance.html.php 145 DIRTY_ATTR $task->state=="success"?"g-success":"g-error" +modules/gallery/views/admin_maintenance.html.php 146 DIRTY_ATTR $task->state=="success"?"g-success":"g-error" modules/gallery/views/admin_maintenance.html.php 147 DIRTY gallery::date_time($task->updated) modules/gallery/views/admin_maintenance.html.php 150 DIRTY $task->name modules/gallery/views/admin_maintenance.html.php 162 DIRTY $task->status @@ -93,7 +93,7 @@ modules/gallery/views/admin_maintenance_show_log.html.php 8 DIRTY_JS url::s modules/gallery/views/admin_maintenance_show_log.html.php 13 DIRTY $task->name modules/gallery/views/admin_maintenance_task.html.php 55 DIRTY $task->name modules/gallery/views/admin_modules.html.php 9 DIRTY access::csrf_form_field() -modules/gallery/views/admin_modules.html.php 19 DIRTY_ATTR ($i%2==0)?"g-odd-row":"g-even-row" +modules/gallery/views/admin_modules.html.php 19 DIRTY_ATTR ($i%2==0)?"g-odd":"g-even" modules/gallery/views/admin_modules.html.php 22 DIRTY form::checkbox($data,'1',module::is_active($module_name)) modules/gallery/views/admin_modules.html.php 24 DIRTY $module_info->version modules/gallery/views/admin_theme_options.html.php 5 DIRTY $form @@ -178,7 +178,7 @@ modules/gallery/views/upgrader.html.php 45 DIRTY_ATTR $id modules/gallery/views/upgrader.html.php 49 DIRTY $module->version modules/gallery/views/upgrader.html.php 52 DIRTY $module->code_version modules/image_block/views/image_block_block.html.php 3 DIRTY_JS $item->url() -modules/image_block/views/image_block_block.html.php 4 DIRTY $item->thumb_img(array("class"=>"gThumbnail")) +modules/image_block/views/image_block_block.html.php 4 DIRTY $item->thumb_img(array("class"=>"g-thumbnail")) modules/info/views/info_block.html.php 22 DIRTY date("M j, Y H:i:s",$item->captured) modules/info/views/info_block.html.php 29 DIRTY_JS $item->owner->url modules/notification/views/comment_published.html.php 28 DIRTY_JS $comment->item()->abs_url() @@ -195,19 +195,19 @@ modules/organize/views/organize_dialog.html.php 5 DIRTY_JS url::s modules/organize/views/organize_dialog.html.php 6 DIRTY_JS url::site("organize/tree/__ALBUM_ID__") modules/organize/views/organize_dialog.html.php 22 DIRTY $album_tree modules/organize/views/organize_dialog.html.php 29 DIRTY $micro_thumb_grid -modules/organize/views/organize_dialog.html.php 37 DIRTY form::dropdown(array("id"=>"gOrganizeSortColumn"),album::get_sort_order_options(),$album->sort_column) -modules/organize/views/organize_dialog.html.php 38 DIRTY form::dropdown(array("id"=>"gOrganizeSortOrder"),array("ASC"=>"Ascending","DESC"=>"Descending"),$album->sort_order) +modules/organize/views/organize_dialog.html.php 37 DIRTY form::dropdown(array("id"=>"g-organize-sort-column"),album::get_sort_order_options(),$album->sort_column) +modules/organize/views/organize_dialog.html.php 38 DIRTY form::dropdown(array("id"=>"g-organize-sort-order"),array("ASC"=>"Ascending","DESC"=>"Descending"),$album->sort_order) modules/organize/views/organize_thumb_grid.html.php 3 DIRTY_ATTR $child->id modules/organize/views/organize_thumb_grid.html.php 4 DIRTY_ATTR $child->id -modules/organize/views/organize_thumb_grid.html.php 5 DIRTY_ATTR $child->is_album()?"gAlbum":"gPhoto" -modules/organize/views/organize_thumb_grid.html.php 6 DIRTY $child->thumb_img(array("class"=>"gThumbnail","ref"=>$child->id),90,true) +modules/organize/views/organize_thumb_grid.html.php 5 DIRTY_ATTR $child->is_album()?"g-album":"g-photo" +modules/organize/views/organize_thumb_grid.html.php 6 DIRTY $child->thumb_img(array("class"=>"g-thumbnail","ref"=>$child->id),90,true) modules/organize/views/organize_thumb_grid.html.php 14 DIRTY_JS url::site("organize/album/$album->id/".($offset+25)) -modules/organize/views/organize_tree.html.php 2 DIRTY_ATTR access::can("edit",$album)?"":"gViewOnly" +modules/organize/views/organize_tree.html.php 2 DIRTY_ATTR access::can("edit",$album)?"":"g-view-only" modules/organize/views/organize_tree.html.php 3 DIRTY_ATTR $album->id modules/organize/views/organize_tree.html.php 6 DIRTY_ATTR $selected&&$album->id==$selected->id?"selected":"" modules/organize/views/organize_tree.html.php 7 DIRTY_ATTR $album->id modules/organize/views/organize_tree.html.php 13 DIRTY View::factory("organize_tree.html",array("selected"=>$selected,"album"=>$child)); -modules/organize/views/organize_tree.html.php 15 DIRTY_ATTR access::can("edit",$child)?"":"gViewOnly" +modules/organize/views/organize_tree.html.php 15 DIRTY_ATTR access::can("edit",$child)?"":"g-view-only" modules/organize/views/organize_tree.html.php 16 DIRTY_ATTR $child->id modules/organize/views/organize_tree.html.php 19 DIRTY_ATTR $child->id modules/recaptcha/views/admin_recaptcha.html.php 10 DIRTY $form @@ -252,7 +252,7 @@ modules/search/views/search.html.php 32 DIRTY $item- modules/server_add/views/admin_server_add.html.php 15 DIRTY_ATTR $id modules/server_add/views/admin_server_add.html.php 24 DIRTY $form modules/server_add/views/server_add_tree.html.php 20 DIRTY_ATTR is_dir($file)?"ui-icon-folder-collapsed":"ui-icon-document" -modules/server_add/views/server_add_tree.html.php 21 DIRTY_ATTR is_dir($file)?"gDirectory":"gFile" +modules/server_add/views/server_add_tree.html.php 21 DIRTY_ATTR is_dir($file)?"g-directory":"g-file" modules/server_add/views/server_add_tree_dialog.html.php 3 DIRTY_JS url::site("server_add/children?path=__PATH__") modules/server_add/views/server_add_tree_dialog.html.php 4 DIRTY_JS url::site("server_add/start?item_id={$item->id}&csrf=$csrf") modules/server_add/views/server_add_tree_dialog.html.php 23 DIRTY $tree @@ -267,19 +267,19 @@ modules/user/views/admin_users.html.php 3 DIRTY_JS url::s modules/user/views/admin_users.html.php 26 DIRTY_JS url::site("admin/users/group/__GROUPID__") modules/user/views/admin_users.html.php 36 DIRTY_JS url::site("admin/users/remove_user_from_group/__USERID__/__GROUPID__?csrf=$csrf") modules/user/views/admin_users.html.php 67 DIRTY_ATTR $user->id -modules/user/views/admin_users.html.php 67 DIRTY_ATTR text::alternate("g-odd-row","g-even-row") +modules/user/views/admin_users.html.php 67 DIRTY_ATTR text::alternate("g-odd","g-even") modules/user/views/admin_users.html.php 67 DIRTY_ATTR $user->admin?"admin":"" modules/user/views/admin_users.html.php 68 DIRTY_ATTR $user->id modules/user/views/admin_users.html.php 69 DIRTY_ATTR $user->avatar_url(20,$theme->url(,true)) modules/user/views/admin_users.html.php 83 DIRTY ($user->last_login==0)?"":gallery::date($user->last_login) modules/user/views/admin_users.html.php 121 DIRTY_ATTR $group->id -modules/user/views/admin_users.html.php 121 DIRTY_ATTR ($group->special?"gDefaultGroup":"") +modules/user/views/admin_users.html.php 121 DIRTY_ATTR ($group->special?"g-default-group":"") modules/user/views/admin_users.html.php 123 DIRTY $v modules/user/views/admin_users_group.html.php 22 DIRTY_JS $user->id modules/user/views/admin_users_group.html.php 22 DIRTY_JS $group->id modules/user/views/login_ajax.html.php 6 DIRTY_JS url::site("password/reset") modules/user/views/login_ajax.html.php 37 DIRTY $form -modules/user/views/user_languages_block.html.php 2 DIRTY form::dropdown("gSelectSessionLocale",$installed_locales,$selected) +modules/user/views/user_languages_block.html.php 2 DIRTY form::dropdown("g-select-session-locale",$installed_locales,$selected) modules/watermark/views/admin_watermarks.html.php 19 DIRTY_ATTR $width modules/watermark/views/admin_watermarks.html.php 19 DIRTY_ATTR $height modules/watermark/views/admin_watermarks.html.php 19 DIRTY_ATTR $url @@ -308,13 +308,13 @@ themes/admin_wind/views/pager.html.php 37 DIRTY_JS str_re themes/wind/views/album.html.php 16 DIRTY_ATTR $child->id themes/wind/views/album.html.php 16 DIRTY_ATTR $item_class themes/wind/views/album.html.php 18 DIRTY_JS $child->url() -themes/wind/views/album.html.php 19 DIRTY $child->thumb_img(array("class"=>"gThumbnail")) +themes/wind/views/album.html.php 19 DIRTY $child->thumb_img(array("class"=>"g-thumbnail")) themes/wind/views/album.html.php 23 DIRTY_JS $child->url() themes/wind/views/block.html.php 3 DIRTY_ATTR $anchor themes/wind/views/block.html.php 5 DIRTY_ATTR $css_id themes/wind/views/block.html.php 6 DIRTY $title themes/wind/views/block.html.php 8 DIRTY $content -themes/wind/views/dynamic.html.php 11 DIRTY_ATTR $child->is_album()?"gAlbum":"" +themes/wind/views/dynamic.html.php 11 DIRTY_ATTR $child->is_album()?"g-album":"" themes/wind/views/dynamic.html.php 13 DIRTY_JS $child->url() themes/wind/views/dynamic.html.php 14 DIRTY_ATTR $child->id themes/wind/views/dynamic.html.php 15 DIRTY_ATTR $child->thumb_url() @@ -322,7 +322,7 @@ themes/wind/views/dynamic.html.php 16 DIRTY_ATTR $chi themes/wind/views/dynamic.html.php 17 DIRTY_ATTR $child->thumb_height themes/wind/views/movie.html.php 8 DIRTY_JS $previous_item->url() themes/wind/views/movie.html.php 18 DIRTY_JS $next_item->url() -themes/wind/views/movie.html.php 28 DIRTY $item->movie_img(array("class"=>"gMovie","id"=>"gMovieId-{$item->id}")) +themes/wind/views/movie.html.php 28 DIRTY $item->movie_img(array("class"=>"g-movie","id"=>"g-movie-id-{$item->id}")) themes/wind/views/page.html.php 9 DIRTY $page_title themes/wind/views/page.html.php 32 DIRTY_JS $theme->url() themes/wind/views/page.html.php 41 DIRTY $new_width @@ -344,4 +344,4 @@ themes/wind/views/photo.html.php 8 DIRTY_JS $theme themes/wind/views/photo.html.php 21 DIRTY_JS $previous_item->url() themes/wind/views/photo.html.php 31 DIRTY_JS $next_item->url() themes/wind/views/photo.html.php 43 DIRTY_JS $item->file_url() -themes/wind/views/photo.html.php 45 DIRTY $item->resize_img(array("id"=>"gPhotoId-{$item->id}","class"=>"gResize")) +themes/wind/views/photo.html.php 45 DIRTY $item->resize_img(array("id"=>"g-photoId-{$item->id}","class"=>"g-resize")) diff --git a/modules/gallery/views/admin_advanced_settings.html.php b/modules/gallery/views/admin_advanced_settings.html.php index 6ad265ac..422bd8f7 100644 --- a/modules/gallery/views/admin_advanced_settings.html.php +++ b/modules/gallery/views/admin_advanced_settings.html.php @@ -1,11 +1,11 @@ -
            +

            -
              -
            • +
                +
              @@ -23,7 +23,7 @@