From 9bdc84733de3786652004f083cade989c00c5240 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 28 Jun 2009 17:07:41 -0700 Subject: use jquery.scrollTo to scroll the active upload into view. --- modules/gallery/views/simple_uploader.html.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'modules') diff --git a/modules/gallery/views/simple_uploader.html.php b/modules/gallery/views/simple_uploader.html.php index f10d764c..4c1e70f0 100644 --- a/modules/gallery/views/simple_uploader.html.php +++ b/modules/gallery/views/simple_uploader.html.php @@ -1,6 +1,7 @@ +
"> @@ -184,6 +185,7 @@ var fp = new File_Progress(file); fp.title.html(file.name); fp.set_status("uploading", ""); + $("#gAddPhotosCanvas").scrollTo(fp.box, 1000); return true; // @todo add cancel button to call this.cancelUpload(file.id) } -- cgit v1.2.3 From 5b2c08d797697430dca716cce5b51a4c128027c0 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 28 Jun 2009 17:37:14 -0700 Subject: Set the gallery module version to 6 in install() (missed this in my last change). Refresh the install.sql. --- installer/install.sql | 15 ++++++++++++++- modules/gallery/helpers/gallery_installer.php | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/installer/install.sql b/installer/install.sql index 1fe9b866..7da5fe68 100755 --- a/installer/install.sql +++ b/installer/install.sql @@ -32,6 +32,19 @@ CREATE TABLE {access_intents} ( ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; SET character_set_client = @saved_cs_client; INSERT INTO {access_intents} VALUES (1,1,1,1,0,0,1,1,0,0); +DROP TABLE IF EXISTS {caches}; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +CREATE TABLE {caches} ( + `id` int(9) NOT NULL auto_increment, + `key` varchar(255) NOT NULL, + `tags` varchar(255) default NULL, + `expiration` int(9) NOT NULL, + `cache` longblob, + PRIMARY KEY (`id`), + KEY `tags` (`tags`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS {comments}; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; @@ -208,7 +221,7 @@ CREATE TABLE {modules} ( UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; SET character_set_client = @saved_cs_client; -INSERT INTO {modules} VALUES (1,1,'gallery',3),(2,1,'user',1),(3,1,'comment',2),(4,1,'organize',1),(5,1,'info',1),(6,1,'rss',1),(7,1,'search',1),(8,1,'slideshow',1),(9,1,'tag',1); +INSERT INTO {modules} VALUES (1,1,'gallery',6),(2,1,'user',1),(3,1,'comment',2),(4,1,'organize',1),(5,1,'info',1),(6,1,'rss',1),(7,1,'search',1),(8,1,'slideshow',1),(9,1,'tag',1); DROP TABLE IF EXISTS {outgoing_translations}; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index c3c3543c..0e5d29b9 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -259,7 +259,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", 5); + module::set_version("gallery", 6); } static function upgrade($version) { -- cgit v1.2.3 From b235fd6e5f2197869c8ef04637d990d2017a19bf Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 28 Jun 2009 18:00:00 -0700 Subject: Pass the item into the block. --- modules/info/helpers/info_theme.php | 1 + 1 file changed, 1 insertion(+) (limited to 'modules') diff --git a/modules/info/helpers/info_theme.php b/modules/info/helpers/info_theme.php index 151885b7..2a761fb4 100644 --- a/modules/info/helpers/info_theme.php +++ b/modules/info/helpers/info_theme.php @@ -22,6 +22,7 @@ class info_theme_Core { if ($theme->item()) { $block = new Block(); $block->css_id = "gMetadata"; + $block->item = $theme->item(); $block->title = $theme->item()->is_album() ? t("Album Info") : t("Photo Info"); $block->content = new View("info_block.html"); return $block; -- cgit v1.2.3 From 24f0c4bd1914e5dc62d4fef936c901227620abbe Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 28 Jun 2009 18:10:42 -0700 Subject: Undo my last change; it's not the right fix for the problem. --- modules/info/helpers/info_theme.php | 1 - modules/info/views/info_block.html.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/info/helpers/info_theme.php b/modules/info/helpers/info_theme.php index 2a761fb4..151885b7 100644 --- a/modules/info/helpers/info_theme.php +++ b/modules/info/helpers/info_theme.php @@ -22,7 +22,6 @@ class info_theme_Core { if ($theme->item()) { $block = new Block(); $block->css_id = "gMetadata"; - $block->item = $theme->item(); $block->title = $theme->item()->is_album() ? t("Album Info") : t("Photo Info"); $block->content = new View("info_block.html"); return $block; diff --git a/modules/info/views/info_block.html.php b/modules/info/views/info_block.html.php index 3a96937c..db621006 100644 --- a/modules/info/views/info_block.html.php +++ b/modules/info/views/info_block.html.php @@ -32,4 +32,4 @@ - \ No newline at end of file + -- cgit v1.2.3 From c4f991bb7d7e90f8c55897f89888d9196c7e438f Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 28 Jun 2009 19:45:11 -0700 Subject: Clean up the combined javascript change and refactor out the Gallery_View base class from Theme_View and Admin_View. 1) Move all the theme specific jquery stuff from gallery_theme::head() and admin_head() into the theme files. Use $theme->script() as appropriate. 2) Get rid of the extra boolean on $theme->url() that we were using so that we could call $theme->script($theme->url(...)) -- add $theme->theme_script() instead (poorly named, but still clearer than what we had before) 3) Fix the bug that combined scripts didn't work at all in the admin theme. 4) Get rid of $theme->display() in favor of new View(...) --- modules/gallery/helpers/gallery_theme.php | 24 -------- modules/gallery/libraries/Admin_View.php | 17 ++---- modules/gallery/libraries/Gallery_View.php | 89 ++++++++++++++++++++++++++++++ modules/gallery/libraries/Theme_View.php | 61 +------------------- themes/admin_default/views/admin.html.php | 10 ++++ themes/default/views/page.html.php | 24 +++++++- 6 files changed, 128 insertions(+), 97 deletions(-) create mode 100644 modules/gallery/libraries/Gallery_View.php (limited to 'modules') diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php index b6b24b27..cffecb12 100644 --- a/modules/gallery/helpers/gallery_theme.php +++ b/modules/gallery/helpers/gallery_theme.php @@ -21,22 +21,6 @@ class gallery_theme_Core { static function head($theme) { $session = Session::instance(); $buf = ""; - $theme->script("lib/jquery.js"); - $theme->script("lib/jquery.form.js"); - $theme->script("lib/jquery-ui.js"); - $theme->script("lib/gallery.common.js"); - $theme->script("lib/gallery.dialog.js"); - $theme->script("lib/gallery.form.js"); - $theme->script("lib/superfish/js/superfish.js"); - if ($theme->page_type == 'photo') { - $theme->script("lib/jquery.scrollTo.js"); - $theme->script("lib/jquery.localscroll.js"); - $theme->script("lib/gallery.show_full_size.js"); - } - if ($theme->page_type == 'movie') { - $theme->script("lib/flowplayer.js"); - } - $theme->script($theme->url("js/ui.init.js", false, true)); if ($session->get("debug")) { $buf .= ""; @@ -95,14 +79,6 @@ class gallery_theme_Core { static function admin_head($theme) { $session = Session::instance(); $buf = ""; - $theme->script("lib/jquery.js"); - $theme->script("lib/jquery.form.js"); - $theme->script("lib/jquery-ui.js"); - $theme->script("lib/gallery.common.js"); - $theme->script("lib/gallery.dialog.js"); - $theme->script("lib/superfish/js/superfish.js"); - $theme->script($theme->url("js/jquery.dropshadow.js", false, true)); - $theme->script($theme->url("js/ui.init.js", false, true)); if ($session->get("debug")) { $buf .= ""; diff --git a/modules/gallery/libraries/Admin_View.php b/modules/gallery/libraries/Admin_View.php index 7a7396eb..01496c0d 100644 --- a/modules/gallery/libraries/Admin_View.php +++ b/modules/gallery/libraries/Admin_View.php @@ -17,9 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class Admin_View_Core extends View { - private $theme_name = null; - +class Admin_View_Core extends Gallery_View { /** * Attempts to load a view and pre-load view data. * @@ -46,15 +44,6 @@ class Admin_View_Core extends View { $this->set_global("user", user::active()); } - public function url($path, $absolute_url=false) { - $arg = "themes/{$this->theme_name}/$path"; - return $absolute_url ? url::abs_file($arg) : url::file($arg); - } - - public function display($page_name, $view_class="View") { - return new $view_class($page_name); - } - public function admin_menu() { $menu = Menu::factory("root"); gallery_menu::admin($menu, $this); @@ -109,6 +98,10 @@ class Admin_View_Core extends View { } } + if ($function == "admin_head") { + array_unshift($blocks, $this->combine_script()); + } + if (Session::instance()->get("debug")) { if ($function != "admin_head") { array_unshift( diff --git a/modules/gallery/libraries/Gallery_View.php b/modules/gallery/libraries/Gallery_View.php new file mode 100644 index 00000000..f2298b7d --- /dev/null +++ b/modules/gallery/libraries/Gallery_View.php @@ -0,0 +1,89 @@ +scripts[$file] = 1; + } + + /** + * Add a script to the combined scripts list. + * @param $file the relative path to a script from the base of the active theme + * @param + */ + public function theme_script($file) { + $file = "themes/{$this->theme_name}/$file"; + $this->scripts[$file] = 1; + } + + /** + * Provide a url to a resource within the current theme. This allows us to refer to theme + * resources without naming the theme itself which makes themes easier to copy. + */ + public function url($path, $absolute_url=false) { + $arg = "themes/{$this->theme_name}/$path"; + return $absolute_url ? url::abs_file($arg) : url::file($arg); + } + + /** + * Combine a series of Javascript files into a single one and cache it in the database, then + * return a single "; + } +} \ No newline at end of file diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index 25818821..8e320f44 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -17,10 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class Theme_View_Core extends View { - private $theme_name = null; - private $scripts = array(); - +class Theme_View_Core extends Gallery_View { /** * Attempts to load a view and pre-load view data. * @@ -69,11 +66,6 @@ class Theme_View_Core extends View { return module::get_var("gallery", "thumb_size", 200) / 200; } - public function url($path, $absolute_url=false, $no_root=false) { - $arg = "themes/{$this->theme_name}/$path"; - return $absolute_url ? url::abs_file($arg) : $no_root ? $arg : url::file($arg); - } - public function item() { return $this->item; } @@ -86,10 +78,6 @@ class Theme_View_Core extends View { return $this->page_type; } - public function display($page_name, $view_class="View") { - return new $view_class($page_name); - } - public function site_menu() { $menu = Menu::factory("root"); if ($this->page_type != "login") { @@ -168,49 +156,6 @@ class Theme_View_Core extends View { return message::get(); } - public function script($file) { - $this->scripts[$file] = 1; - } - - /** - * Combine a series of Javascript files into a single one and cache it in the database, then - * return a single "; - } - /** * Handle all theme functions that insert module content. */ @@ -270,8 +215,8 @@ class Theme_View_Core extends View { } } - if ($function == "head" || $function == "admin_head") { - array_unshift($blocks, $this->_combine_script()); + if ($function == "head") { + array_unshift($blocks, $this->combine_script()); } if (Session::instance()->get("debug")) { diff --git a/themes/admin_default/views/admin.html.php b/themes/admin_default/views/admin.html.php index dfbafe31..2a91a76c 100644 --- a/themes/admin_default/views/admin.html.php +++ b/themes/admin_default/views/admin.html.php @@ -20,6 +20,16 @@ " media="screen,print,projection" /> + + script("lib/jquery.js") ?> + script("lib/jquery.form.js") ?> + script("lib/jquery-ui.js") ?> + script("lib/gallery.common.js") ?> + script("lib/gallery.dialog.js") ?> + script("lib/superfish/js/superfish.js") ?> + theme_script("js/jquery.dropshadow.js") ?> + theme_script("js/ui.init.js") ?> + admin_head() ?> diff --git a/themes/default/views/page.html.php b/themes/default/views/page.html.php index c74d4097..8b9466ac 100644 --- a/themes/default/views/page.html.php +++ b/themes/default/views/page.html.php @@ -49,6 +49,24 @@ + script("lib/jquery.js") ?> + script("lib/jquery.form.js") ?> + script("lib/jquery-ui.js") ?> + script("lib/gallery.common.js") ?> + script("lib/gallery.dialog.js") ?> + script("lib/gallery.form.js") ?> + script("lib/superfish/js/superfish.js") ?> + script("lib/jquery.localscroll.js") ?> + theme_script("js/ui.init.js") ?> + + head() they get combined */ ?> + page_type == "photo"): ?> + script("lib/jquery.scrollTo.js") ?> + script("lib/gallery.show_full_size.js") ?> + page_type == "movie"): ?> + script("lib/flowplayer.js") ?> + + head() ?> @@ -57,7 +75,7 @@
site_status() ?>
- display("header.html") ?> +
@@ -70,12 +88,12 @@
page_type != "login"): ?> - display("sidebar.html") ?> +
- display("footer.html") ?> +
page_bottom() ?> -- cgit v1.2.3 From 6e8a8c53e685a6c3f35f1426ab4dd6dcc18578e0 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 28 Jun 2009 19:49:48 -0700 Subject: Rename $theme->url() to $theme->theme_url() for consistency wiht $theme->theme_script(). --- modules/comment/views/admin_block_recent_comments.html.php | 2 +- modules/comment/views/admin_comments.html.php | 2 +- modules/comment/views/comment.html.php | 2 +- modules/comment/views/comments.html.php | 2 +- modules/gallery/libraries/Gallery_View.php | 2 +- modules/user/views/admin_users.html.php | 2 +- themes/admin_default/views/admin.html.php | 4 ++-- themes/default/views/header.html.php | 2 +- themes/default/views/page.html.php | 6 +++--- 9 files changed, 12 insertions(+), 12 deletions(-) (limited to 'modules') diff --git a/modules/comment/views/admin_block_recent_comments.html.php b/modules/comment/views/admin_block_recent_comments.html.php index edaa19ae..af4d946e 100644 --- a/modules/comment/views/admin_block_recent_comments.html.php +++ b/modules/comment/views/admin_block_recent_comments.html.php @@ -2,7 +2,7 @@