diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/comment/views/admin_block_recent_comments.html.php | 2 | ||||
-rw-r--r-- | modules/comment/views/admin_comments.html.php | 2 | ||||
-rw-r--r-- | modules/comment/views/comment.html.php | 2 | ||||
-rw-r--r-- | modules/comment/views/comments.html.php | 2 | ||||
-rw-r--r-- | modules/gallery/helpers/gallery_installer.php | 2 | ||||
-rw-r--r-- | modules/gallery/helpers/gallery_theme.php | 42 | ||||
-rw-r--r-- | modules/gallery/libraries/Admin_View.php | 17 | ||||
-rw-r--r-- | modules/gallery/libraries/Gallery_View.php | 124 | ||||
-rw-r--r-- | modules/gallery/libraries/Theme_View.php | 89 | ||||
-rw-r--r-- | modules/gallery/views/simple_uploader.html.php | 2 | ||||
-rw-r--r-- | modules/info/views/info_block.html.php | 2 | ||||
-rw-r--r-- | modules/user/views/admin_users.html.php | 2 |
12 files changed, 147 insertions, 141 deletions
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 @@ <ul> <? foreach ($comments as $i => $comment): ?> <li class="<?= ($i % 2 == 0) ? "gEvenRow" : "gOddRow" ?>"> - <img src="<?= $comment->author()->avatar_url(32, $theme->url("images/avatar.jpg", true)) ?>" + <img src="<?= $comment->author()->avatar_url(32, $theme->theme_url("images/avatar.jpg", true)) ?>" class="gAvatar" alt="<?= p::clean($comment->author_name()) ?>" width="32" diff --git a/modules/comment/views/admin_comments.html.php b/modules/comment/views/admin_comments.html.php index 86585c65..453cf849 100644 --- a/modules/comment/views/admin_comments.html.php +++ b/modules/comment/views/admin_comments.html.php @@ -106,7 +106,7 @@ <tr id="gComment-<?= $comment->id ?>" class="<?= ($i % 2 == 0) ? "gEvenRow" : "gOddRow" ?>"> <td> <a href="#"> - <img src="<?= $comment->author()->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>" + <img src="<?= $comment->author()->avatar_url(40, $theme->theme_url("images/avatar.jpg", true)) ?>" class="gAvatar" alt="<?= p::clean($comment->author_name()) ?>" width="40" diff --git a/modules/comment/views/comment.html.php b/modules/comment/views/comment.html.php index ce52951b..6d2cc592 100644 --- a/modules/comment/views/comment.html.php +++ b/modules/comment/views/comment.html.php @@ -2,7 +2,7 @@ <li id="gComment-<?= $comment->id; ?>"> <p class="gAuthor"> <a href="#"> - <img src="<?= $comment->author()->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>" + <img src="<?= $comment->author()->avatar_url(40, $theme->theme_url("images/avatar.jpg", true)) ?>" class="gAvatar" alt="<?= p::clean($comment->author_name()) ?>" width="40" diff --git a/modules/comment/views/comments.html.php b/modules/comment/views/comments.html.php index 854f9554..d9405e5f 100644 --- a/modules/comment/views/comments.html.php +++ b/modules/comment/views/comments.html.php @@ -10,7 +10,7 @@ <li id="gComment-<?= $comment->id ?>"> <p class="gAuthor"> <a href="#"> - <img src="<?= $comment->author()->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>" + <img src="<?= $comment->author()->avatar_url(40, $theme->theme_url("images/avatar.jpg", true)) ?>" class="gAvatar" alt="<?= p::clean($comment->author_name()) ?>" width="40" 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 <a href=\"%url\">Gallery %version</a>"); - module::set_version("gallery", 5); + module::set_version("gallery", 6); } static function upgrade($version) { diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php index b6b24b27..0e3150bc 100644 --- a/modules/gallery/helpers/gallery_theme.php +++ b/modules/gallery/helpers/gallery_theme.php @@ -21,30 +21,12 @@ 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 .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . - url::file("modules/gallery/css/debug.css") . "\" />"; + $theme->css("modules/gallery/css/debug.css"); } if (($theme->page_type == "album" || $theme->page_type == "photo") && access::can("edit", $theme->item())) { - $buf .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . - url::file("modules/gallery/css/quick.css") . "\" />"; + $theme->css("modules/gallery/css/quick.css"); $theme->script("modules/gallery/js/quick.js"); } @@ -57,8 +39,7 @@ class gallery_theme_Core { } if ($session->get("l10n_mode", false)) { - $buf .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . - url::file("modules/gallery/css/l10n_client.css") . "\" />"; + $theme->css("modules/gallery/css/l10n_client.css"); $theme->script("lib/jquery.cookie.js"); $theme->script("modules/gallery/js/l10n_client.js"); } @@ -94,28 +75,15 @@ 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 .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . - url::file("modules/gallery/css/debug.css") . "\" />"; + $theme->css("modules/gallery/css/debug.css"); } if ($session->get("l10n_mode", false)) { - $buf .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . - url::file("modules/gallery/css/l10n_client.css") . "\" />"; + $theme->css("modules/gallery/css/l10n_client.css"); $theme->script("lib/jquery.cookie.js"); $theme->script("modules/gallery/js/l10n_client.js"); } - - return $buf; } static function page_bottom($theme) { 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..7000d3de --- /dev/null +++ b/modules/gallery/libraries/Gallery_View.php @@ -0,0 +1,124 @@ +<?php defined("SYSPATH") or die("No direct script access."); +/** + * Gallery - a web based photo album viewer and editor + * Copyright (C) 2000-2009 Bharat Mediratta + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + */ +class Gallery_View_Core extends View { + protected $theme_name = null; + protected $scripts = array(); + protected $css = array(); + + /** + * Add a script to the combined scripts list. + * @param $file the relative path to a script from the gallery3 directory + */ + public function script($file, $theme_relative=false) { + $this->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 theme_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 <script> element to refer to it. + */ + protected function combine_script() { + $links = array(); + $key = ""; + foreach (array_keys($this->scripts) as $file) { + $path = DOCROOT . $file; + if (file_exists($path)) { + $stats = stat($path); + $links[] = $path; + // 7 == size, 9 == mtime, see http://php.net/stat + $key = "{$key}$file $stats[7] $stats[9],"; + } else { + Kohana::log("alert", "Javascript file missing: " . $file); + } + } + + $key = md5($key); + $cache = Cache::instance(); + $contents = $cache->get($key); + if (empty($contents)) { + $contents = ""; + foreach ($links as $link) { + $contents .= file_get_contents($link); + } + $cache->set($key, $contents, array("javascript"), 30 * 84600); + if (function_exists("gzencode")) { + $cache->set("{$key}_gz", gzencode($contents, 9, FORCE_GZIP), + array("javascript", "gzip"), 30 * 84600); + } + } + + // Handcraft the script link because html::script will add a .js extenstion + return "<script type=\"text/javascript\" src=\"" . url::site("combined/javascript/$key") . + "\"></script>"; + } + + /** + * Add a css file to the combined css list. + * @param $file the relative path to a script from the gallery3 directory + */ + public function css($file, $theme_relative=false) { + $this->css[$file] = 1; + } + + /** + * Add a css file to the combined css list. + * @param $file the relative path to a script from the base of the active theme + * @param + */ + public function theme_css($file) { + $file = "themes/{$this->theme_name}/$file"; + $this->css[$file] = 1; + } + + /** + * Combine a series of Javascript files into a single one and cache it in the database, then + * return a single <script> element to refer to it. + */ + protected function combine_css() { + $links = array(); + $key = ""; + foreach (array_keys($this->css) as $file) { + $links[] = "<link media=\"screen, projection\" rel=\"stylesheet\" type=\"text/css\" href=\"" . + url::file($file) . "\" />"; + + } + return implode("\n", $links); + } + +}
\ No newline at end of file diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index c5888b4a..bc8e540a 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -17,11 +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(); - private $css = array(); - +class Theme_View_Core extends Gallery_View { /** * Attempts to load a view and pre-load view data. * @@ -70,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; } @@ -87,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") { @@ -169,68 +156,6 @@ class Theme_View_Core extends View { return message::get(); } - public function script($file) { - $this->scripts[$file] = 1; - } - - public function css($file) { - $this->css[$file] = 1; - } - - /** - * Combine a series of Javascript files into a single one and cache it in the database, then - * return a single <script> element to refer to it. - */ - private function _combine_script() { - $links = array(); - $key = ""; - foreach (array_keys($this->scripts) as $file) { - $path = DOCROOT . $file; - if (file_exists($path)) { - $stats = stat($path); - $links[] = $path; - // 7 == size, 9 == mtime, see http://php.net/stat - $key = "{$key}$file $stats[7] $stats[9],"; - } else { - Kohana::log("warn", "Javascript file missing: " . $file); - } - } - - $key = md5($key); - $cache = Cache::instance(); - $contents = $cache->get($key); - if (empty($contents)) { - $contents = ""; - foreach ($links as $link) { - $contents .= file_get_contents($link); - } - $cache->set($key, $contents, array("javascript"), 30 * 84600); - if (function_exists("gzencode")) { - $cache->set("{$key}_gz", gzencode($contents, 9, FORCE_GZIP), - array("javascript", "gzip"), 30 * 84600); - } - } - - // Handcraft the script link because html::script will add a .js extenstion - return "<script type=\"text/javascript\" src=\"" . url::site("combined/javascript/$key") . - "\"></script>"; - } - - /** - * Combine a series of Javascript files into a single one and cache it in the database, then - * return a single <script> element to refer to it. - */ - private function _combine_css() { - $links = array(); - $key = ""; - foreach (array_keys($this->css) as $file) { - $links[] = "<link media=\"screen, projection\" rel=\"stylesheet\" type=\"text/css\" href=\"" . - url::file($file) . "\" />"; - - } - return implode("\n", $links); - } - /** * Handle all theme functions that insert module content. */ @@ -278,12 +203,6 @@ class Theme_View_Core extends View { } } - // Give the theme a chance to add its blocks - $helper_class = "{$this->theme_name}_theme"; - $blocks[] = call_user_func_array( - array($helper_class, $function), - array_merge(array($this), $args)); - foreach (module::active() as $module) { if ($module->name == "gallery") { continue; @@ -296,9 +215,9 @@ class Theme_View_Core extends View { } } - if ($function == "head" || $function == "admin_head") { - array_unshift($blocks, $this->_combine_css()); - array_unshift($blocks, $this->_combine_script()); + if ($function == "head") { + array_unshift($blocks, $this->combine_css()); + array_unshift($blocks, $this->combine_script()); } if (Session::instance()->get("debug")) { 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 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> <script type="text/javascript" src="<?= url::file("lib/swfupload/swfupload.js") ?>"></script> <script type="text/javascript" src="<?= url::file("lib/swfupload/swfupload.queue.js") ?>"></script> +<script type="text/javascript" src="<?= url::file("lib/jquery.scrollTo.js") ?>"></script> <!-- hack to set the title for the dialog --> <form id="gAddPhotosForm" action="<?= url::site("simple_uploader/finish?csrf=$csrf") ?>"> @@ -184,6 +185,7 @@ var fp = new File_Progress(file); fp.title.html(file.name); fp.set_status("uploading", "<?= t("Uploading...") ?>"); + $("#gAddPhotosCanvas").scrollTo(fp.box, 1000); return true; // @todo add cancel button to call this.cancelUpload(file.id) } 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 @@ <? endif ?> </li> <? endif ?> -</ul>
\ No newline at end of file +</ul> diff --git a/modules/user/views/admin_users.html.php b/modules/user/views/admin_users.html.php index 542b8b8b..b469f82d 100644 --- a/modules/user/views/admin_users.html.php +++ b/modules/user/views/admin_users.html.php @@ -66,7 +66,7 @@ <? foreach ($users as $i => $user): ?> <tr id="gUser-<?= $user->id ?>" class="<?= text::alternate("gOddRow", "gEvenRow") ?> user <?= $user->admin ? "admin" : "" ?>"> <td id="user-<?= $user->id ?>" class="core-info gDraggable"> - <img src="<?= $user->avatar_url(20, $theme->url("images/avatar.jpg", true)) ?>" + <img src="<?= $user->avatar_url(20, $theme->theme_url("images/avatar.jpg", true)) ?>" title="<?= t("Drag user onto group below to add as a new member") ?>" alt="<?= p::clean($user->name) ?>" width="20" |