diff --git a/3.0/client/PHP/Gallery3.php b/3.0/client/PHP/Gallery3.php index fb97ddf8..30dae4f1 100644 --- a/3.0/client/PHP/Gallery3.php +++ b/3.0/client/PHP/Gallery3.php @@ -19,7 +19,6 @@ */ include("Mail.php"); include("Mail/mime.php"); -include("HTTP/Request.php"); class Gallery3 { var $url; @@ -64,6 +63,7 @@ class Gallery3 { */ public function __construct() { $this->data = new stdClass(); + $this->data->entity = new stdClass(); $this->token = null; $this->url = null; } @@ -169,7 +169,55 @@ class Gallery3 { } class Gallery3_Helper { + static $instance = null; + static function request($method, $url, $token=null, $params=array(), $file=null) { + if (!isset(self::$instance)) { + @include("HTTP/Request2.php"); + if (class_exists("HTTP_Request2")) { + self::$instance = new Gallery3_Helper_HTTP_Request2(); + } else { + include("HTTP/Request.php"); + self::$instance = new Gallery3_Helper_HTTP_Request(); + } + } + return self::$instance->request($method, $url, $token, $params, $file); + } +} + +class Gallery3_Helper_HTTP_Request2 { + function request($method, $url, $token, $params, $file) { + $req = new HTTP_Request2($url); + $req->setMethod($method == "get" ? 'GET' : 'POST'); + $req->setHeader("X-Gallery-Request-Method", $method); + if ($token) { + $req->setHeader("X-Gallery-Request-Key", $token); + } + foreach ($params as $key => $value) { + $req->addPostParameter($key, is_string($value) ? $value : json_encode($value)); + } + if ($file) { + $req->addUpload("file", $file, basename($file), mime_content_type($file)); + } + $response = $req->send(); + $status = $response->getStatus(); + + switch ($status) { + case 200: + case 201: + return json_decode($response->getBody()); + + case 403: + throw new Gallery3_Forbidden_Exception($response->getBody(),$status); + + default: + throw new Gallery3_Exception($response->getBody(),$status); + } + } +} + +class Gallery3_Helper_HTTP_Request { + function request($method, $url, $token, $params, $file) { $req = new HTTP_Request($url); $req->setMethod($method == "get" ? HTTP_REQUEST_METHOD_GET : HTTP_REQUEST_METHOD_POST); $req->addHeader("X-Gallery-Request-Method", $method); diff --git a/3.0/client/Python/pylibgal3/libg3/G3Items.py b/3.0/client/Python/pylibgal3/libg3/G3Items.py index 0fdae593..ce812551 100644 --- a/3.0/client/Python/pylibgal3/libg3/G3Items.py +++ b/3.0/client/Python/pylibgal3/libg3/G3Items.py @@ -22,7 +22,16 @@ __all__ = ['Album' , 'Image' , 'LocalImage' , 'RemoteImage' , 'LocalMovie' , 'RemoteMovie' , 'getItemFromResp' , 'getItemsFromResp'] from datetime import datetime -import json , weakref , types , os , mimetypes , re +import weakref , types , os , mimetypes , re +try: + import json +except: + try: + import simplejson + except ImportError , e: + raise ImportError('You must have either the "json" or "simplejson"' + 'library installed!') + class BaseRemote(object): def __init__(self , respObj , weakGalObj , weakParent=None): diff --git a/3.0/client/Python/pylibgal3/libg3/Gallery3.py b/3.0/client/Python/pylibgal3/libg3/Gallery3.py index 6345c1a8..13409c8a 100644 --- a/3.0/client/Python/pylibgal3/libg3/Gallery3.py +++ b/3.0/client/Python/pylibgal3/libg3/Gallery3.py @@ -26,7 +26,15 @@ from G3Items import getItemFromResp , getItemsFromResp , BaseRemote , Album , \ RemoteImage , Tag from urllib import quote , urlencode from uuid import uuid4 -import urllib2 , os , json +import urllib2 , os +try: + import json +except: + try: + import simplejson + except ImportError , e: + raise ImportError('You must have either the "json" or "simplejson"' + 'library installed!') class Gallery3(object): """ @@ -129,7 +137,6 @@ class Gallery3(object): uri(str) : The uri string defining the resource on the defined host """ url = self._buildUrl(uri , kwargs) - print url return self.getRespFromUrl(url) def addAlbum(self , parent , albumName , title , description=''): diff --git a/3.0/client/Python/pylibgal3/libg3/__init__.py b/3.0/client/Python/pylibgal3/libg3/__init__.py index eec91668..3805ff18 100644 --- a/3.0/client/Python/pylibgal3/libg3/__init__.py +++ b/3.0/client/Python/pylibgal3/libg3/__init__.py @@ -21,4 +21,4 @@ from G3Items import * from Gallery3 import * -__version__ = '0.1.4' +__version__ = '0.1.5' diff --git a/3.0/modules/about/controllers/about.php b/3.0/modules/about/controllers/about.php new file mode 100644 index 00000000..473c99a9 --- /dev/null +++ b/3.0/modules/about/controllers/about.php @@ -0,0 +1,28 @@ +css("about.css"); + $template->page_title = t("Gallery :: About"); + $template->content = new View("about.html"); + print $template; + } +} \ No newline at end of file diff --git a/3.0/modules/about/controllers/admin_about.php b/3.0/modules/about/controllers/admin_about.php new file mode 100644 index 00000000..b476c925 --- /dev/null +++ b/3.0/modules/about/controllers/admin_about.php @@ -0,0 +1,61 @@ +_get_view(); + } + + public function handler() { + access::verify_csrf(); + + $form = $this->_get_form(); + if ($form->validate()) { + module::set_var( + "about", "code", $form->about->about_code->value); + module::set_var( + "about", "title", $form->about->about_title->value); + module::set_var ( + "about", "hidden", $form->about->about_hidden->value); + message::success(t("Your settings have been saved.")); + url::redirect("admin/about"); + } + + print $this->_get_view($form); + } + + private function _get_view($form=null) { + $v = new Admin_View("admin.html"); + $v->content = new View("admin_about.html"); + $v->content->form = empty($form) ? $this->_get_form() : $form; + return $v; + } + + private function _get_form() { + $form = new Forge("admin/about/handler", "", "post", array("id" => "g-admin-form")); + $group = $form->group("about"); + $group->input("about_title")->label(t('Enter the headline.'))->value(module::get_var("about", "title")); + $group->textarea("about_code")->label(t('Enter the standard HTML code you want on the page.'))->value(module::get_var("about", "code")); + $group->checkbox("about_hidden")->label(t("Hide link")) + ->checked(module::get_var("about", "hidden", false) == 1); + $group->submit("submit")->value(t("Save")); + + return $form; + } +} \ No newline at end of file diff --git a/3.0/modules/about/css/about.css b/3.0/modules/about/css/about.css new file mode 100644 index 00000000..17903b24 --- /dev/null +++ b/3.0/modules/about/css/about.css @@ -0,0 +1,2 @@ +table.about { text-align: center; width:500px; } +table.about caption { font-size: 1.5em; padding: 0.2em; } \ No newline at end of file diff --git a/3.0/modules/about/helpers/about_block.php b/3.0/modules/about/helpers/about_block.php new file mode 100644 index 00000000..9dc85457 --- /dev/null +++ b/3.0/modules/about/helpers/about_block.php @@ -0,0 +1,39 @@ + t("About page")); + } + + static function get($block_id, $theme) { + $block = ""; + switch ($block_id) { + case "about": + if ($theme->item()) { + $block = new Block(); + $block->css_id = "g-metadata"; + $block->title = module::get_var("about", "title"); + $block->content = new View("about_block.html"); + } + break; + } + return $block; + } +} \ No newline at end of file diff --git a/3.0/modules/about/helpers/about_event.php b/3.0/modules/about/helpers/about_event.php new file mode 100644 index 00000000..e63aeb97 --- /dev/null +++ b/3.0/modules/about/helpers/about_event.php @@ -0,0 +1,37 @@ +get("settings_menu") + ->append(Menu::factory("link") + ->id("about_menu") + ->label(t("About page")) + ->url(url::site("admin/about"))); + } + + static function site_menu($menu, $theme) { + if (module::get_var("about", "hidden") != true) { + $menu->add_after("home", Menu::factory("link") + ->id("about") + ->label(t("About")) + ->url(url::site("about/"))); + } + } +} \ No newline at end of file diff --git a/3.0/modules/about/helpers/about_installer.php b/3.0/modules/about/helpers/about_installer.php new file mode 100644 index 00000000..9725986e --- /dev/null +++ b/3.0/modules/about/helpers/about_installer.php @@ -0,0 +1,26 @@ + +

+ \ No newline at end of file diff --git a/3.0/modules/about/views/about_block.html.php b/3.0/modules/about/views/about_block.html.php new file mode 100644 index 00000000..3fecf5cc --- /dev/null +++ b/3.0/modules/about/views/about_block.html.php @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/3.0/modules/about/views/admin_about.html.php b/3.0/modules/about/views/admin_about.html.php new file mode 100644 index 00000000..c341bdc4 --- /dev/null +++ b/3.0/modules/about/views/admin_about.html.php @@ -0,0 +1,5 @@ + +
+

+ +
diff --git a/3.0/modules/about_this_album/module.info b/3.0/modules/about_this_album/module.info index 8080a24d..19a0e6f1 100644 --- a/3.0/modules/about_this_album/module.info +++ b/3.0/modules/about_this_album/module.info @@ -1,3 +1,7 @@ name = "About this Album" description = "Show some simple, specific and useful info about a given album" version = 1 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:about_this_album" +discuss_url = "http://gallery.menalto.com/forum_module_about_this_album" diff --git a/3.0/modules/about_this_photo/module.info b/3.0/modules/about_this_photo/module.info index e324ae3b..876b111b 100644 --- a/3.0/modules/about_this_photo/module.info +++ b/3.0/modules/about_this_photo/module.info @@ -1,3 +1,7 @@ name = "About this Photo" description = "Show some simple, specific and useful info about a given photo" version = 3 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:about_this_photo" +discuss_url = "http://gallery.menalto.com/forum_module_about_this_photo" diff --git a/3.0/modules/addthis/config/addthis.php b/3.0/modules/addthis/config/addthis.php new file mode 100644 index 00000000..04e314c9 --- /dev/null +++ b/3.0/modules/addthis/config/addthis.php @@ -0,0 +1,29 @@ + email address that appears as the from address + * line-length => word wrap length (PHP documentations suggest no larger tha 70 characters + * reply-to => what goes into the reply to header + */ +$config["ranges"] = array( + "Addthis1" => array("low" => "65.249.152.0", "high" => "65.249.159.255"), + "Addthis2" => array("low" => "208.122.55.0", "high" => "208.122.55.255") +); diff --git a/3.0/modules/addthis/controllers/addthis.php b/3.0/modules/addthis/controllers/addthis.php new file mode 100644 index 00000000..6e55a17b --- /dev/null +++ b/3.0/modules/addthis/controllers/addthis.php @@ -0,0 +1,123 @@ +file_url(true); + $thumb_url = $item->thumb_url(true); + } else { + $proxy = ORM::factory("addthis_proxy"); + $proxy->uuid = md5(rand()); + $proxy->item_id = $item->id; + $proxy->save(); + $full_url = url::abs_site("addthis/print_proxy/full/$proxy->uuid"); + $thumb_url = url::abs_site("addthis/print_proxy/thumb/$proxy->uuid"); + } + + $v = new View("addthis_form.html"); + $v->order_parms = array( + "addthis_api_version" => "100", + "company_id" => module::get_var("addthis", "company_id"), + "event_id" => module::get_var("addthis", "event_id"), + "cmd" => "addimg", + "partner_code" => "69", + "return_url" => url::abs_site("addthis/close_window"), + "num_images" => "1", + "image_1" => $full_url, + "thumb_1" => $thumb_url, + "image_height_1" => $item->height, + "image_width_1" => $item->width, + "thumb_height_1" => $item->thumb_height, + "thumb_width_1" => $item->thumb_width, + "title_1" => html::purify($item->title)); + + print $v; + } + + public function print_proxy($type, $id) { + // If its a request for the full size then make sure we are coming from an + // authorized address + if ($type == "full") { + $remote_addr = ip2long($this->input->server("REMOTE_ADDR")); + if ($remote_addr === false) { + Kohana::show_404(); + } + $config = Kohana::config("addthis"); + + $authorized = false; + foreach ($config["ranges"] as $ip_range) { + $low = ip2long($ip_range["low"]); + $high = ip2long($ip_range["high"]); + $authorized = $low !== false && $high !== false && + $low <= $remote_addr && $remote_addr <= $high; + if ($authorized) { + break; + } + } + if (!$authorized) { + Kohana::show_404(); + } + } + + $proxy = ORM::factory("addthis_proxy", array("uuid" => $id)); + if (!$proxy->loaded || !$proxy->item->loaded) { + Kohana::show_404(); + } + + $file = $type == "full" ? $proxy->item->file_path() : $proxy->item->thumb_path(); + if (!file_exists($file)) { + kohana::show_404(); + } + + // We don't need to save the session for this request + Session::abort_save(); + + if (!TEST_MODE) { + // Dump out the image + header("Content-Type: $proxy->item->mime_type"); + Kohana::close_buffers(false); + $fd = fopen($file, "rb"); + fpassthru($fd); + fclose($fd); + + // If the request was for the image and not the thumb, then delete the proxy. + if ($type == "full") { + $proxy->delete(); + } + } + + $this->_clean_expired(); + } + + public function close_window() { + print ""; + } + + private function _clean_expired() { + Database::instance()->query( + "DELETE FROM {addthis_proxies} " . + "WHERE request_date <= (CURDATE() - INTERVAL 10 DAY) " . + "LIMIT 20"); + } +} \ No newline at end of file diff --git a/3.0/modules/addthis/controllers/admin_addthis.php b/3.0/modules/addthis/controllers/admin_addthis.php new file mode 100644 index 00000000..9c537b00 --- /dev/null +++ b/3.0/modules/addthis/controllers/admin_addthis.php @@ -0,0 +1,26 @@ +content = new View("admin_addthis.html"); + print $v; + } +} \ No newline at end of file diff --git a/3.0/modules/addthis/css/addthis_menu.css b/3.0/modules/addthis/css/addthis_menu.css new file mode 100644 index 00000000..b1deae01 --- /dev/null +++ b/3.0/modules/addthis/css/addthis_menu.css @@ -0,0 +1,3 @@ +#g-view-menu #g-addthis-link { + background-image: url('../images/addthis_logo.png'); +} diff --git a/3.0/modules/addthis/helpers/addthis_event.php b/3.0/modules/addthis/helpers/addthis_event.php new file mode 100644 index 00000000..c0415564 --- /dev/null +++ b/3.0/modules/addthis/helpers/addthis_event.php @@ -0,0 +1,48 @@ +get("settings_menu") + ->append(Menu::factory("link") + ->id("addthis_menu") + ->label(t("AddThis")) + ->url(url::site("admin/addthis"))); + } + + static function photo_menu($menu, $theme) { + $item = $theme->item(); + $menu->append(Menu::factory("link") + ->id("addthis") + ->label(t("Bookmark and Share: $item->title")) + ->url("") + ->css_id("g-addthis-link") + ->css_class("addthis_button")); + } + + static function album_menu($menu, $theme) { + $item = $theme->item(); + $menu->append(Menu::factory("link") + ->id("addthis") + ->label(t("Bookmark and Share: $item->title")) + ->url("") + ->css_id("g-addthis-link") + ->css_class("addthis_button")); + } +} diff --git a/3.0/modules/addthis/helpers/addthis_installer.php b/3.0/modules/addthis/helpers/addthis_installer.php new file mode 100644 index 00000000..ac401eb6 --- /dev/null +++ b/3.0/modules/addthis/helpers/addthis_installer.php @@ -0,0 +1,45 @@ +query("CREATE TABLE {addthis_proxies} ( + `id` int(9) NOT NULL AUTO_INCREMENT, + `uuid` char(32) NOT NULL, + `request_date` TIMESTAMP NOT NULL DEFAULT current_timestamp, + `item_id` int(9) NOT NULL, + PRIMARY KEY (`id`)) + DEFAULT CHARSET=utf8;"); + + module::set_var("addthis", "username", ""); + module::set_version("addthis", 1); + } + + static function upgrade($version) { + if ($version == 1) { + module::set_version("addthis", $version = 1); + } + } + + static function uninstall() { + Database::instance()->query("DROP TABLE IF EXISTS {addthis_proxies}"); + module::delete("addthis"); + } +} diff --git a/3.0/modules/addthis/helpers/addthis_theme.php b/3.0/modules/addthis/helpers/addthis_theme.php new file mode 100644 index 00000000..7308954e --- /dev/null +++ b/3.0/modules/addthis/helpers/addthis_theme.php @@ -0,0 +1,29 @@ +css("addthis_menu.css"); + return "\n" . + ""; + } +} diff --git a/3.0/modules/addthis/images/addthis_logo.png b/3.0/modules/addthis/images/addthis_logo.png new file mode 100644 index 00000000..39372a0c Binary files /dev/null and b/3.0/modules/addthis/images/addthis_logo.png differ diff --git a/3.0/modules/addthis/models/addthis_proxy.php b/3.0/modules/addthis/models/addthis_proxy.php new file mode 100644 index 00000000..dd7ff120 --- /dev/null +++ b/3.0/modules/addthis/models/addthis_proxy.php @@ -0,0 +1,22 @@ + +
+ " alt="Add This logo" class="g-right"/> +

+
+

+ +AddThis uses services to provide an intelligent, optimized sharing menu that is designed to offer the right options at the right time and maximize distribution of your content - everywhere.") ?> +

+ +

+ register with Add This and enter your addthis username in the Advanced Settings page you can get Analytics. Example data below.", + array("signup_url" => "http://www.addthis.com/register", + "advanced_settings_url" => html::mark_clean(url::site("admin/advanced_settings")))) ?> +

+
+
+
diff --git a/3.0/modules/adsense/module.info b/3.0/modules/adsense/module.info index 41cc63b2..066e0ade 100644 --- a/3.0/modules/adsense/module.info +++ b/3.0/modules/adsense/module.info @@ -1,3 +1,7 @@ name = "Adsense" description = "Display Google Adsense ads" version = 1 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:adsense" +discuss_url = "http://gallery.menalto.com/forum_module_adsense" diff --git a/3.0/modules/albumpassword/controllers/albumpassword.php b/3.0/modules/albumpassword/controllers/albumpassword.php index 83ff4f0e..bf79698d 100644 --- a/3.0/modules/albumpassword/controllers/albumpassword.php +++ b/3.0/modules/albumpassword/controllers/albumpassword.php @@ -71,7 +71,7 @@ class albumpassword_Controller extends Controller { // Convert submitted data to local variables. $album_id = Input::instance()->post("item_id"); - $album_password = Input::instance()->post("assignpassword_password"); + $album_password = strtolower(Input::instance()->post("assignpassword_password")); // Check for, and remove, any existing passwords and cached ids. $existing_password = ORM::factory("items_albumpassword")->where("album_id", "=", $album_id)->find_all(); @@ -109,7 +109,7 @@ class albumpassword_Controller extends Controller { // Display a success message and close the dialog. message::success(t("Password saved.")); - print "\n\n\n\n\n"; + json::reply(array("result" => "success")); } public function logout() { @@ -126,7 +126,7 @@ class albumpassword_Controller extends Controller { access::verify_csrf(); // Convert submitted data to local variables. - $album_password = Input::instance()->post("albumpassword_password"); + $album_password = strtolower(Input::instance()->post("albumpassword_password")); // See if the submitted password matches any in the database. $existing_password = ORM::factory("items_albumpassword") @@ -139,10 +139,10 @@ class albumpassword_Controller extends Controller { cookie::delete("g3_albumpassword_id"); cookie::set("g3_albumpassword", $album_password); message::success(t("Password Accepted.")); - print "\n\n\n\n\n"; + json::reply(array("result" => "success")); } else { message::error(t("Password Rejected.")); - print "\n\n\n\n\n"; + json::reply(array("result" => "success")); } } diff --git a/3.0/modules/albumpassword/helpers/albumpassword_event.php b/3.0/modules/albumpassword/helpers/albumpassword_event.php index 1201400d..b6b93e81 100644 --- a/3.0/modules/albumpassword/helpers/albumpassword_event.php +++ b/3.0/modules/albumpassword/helpers/albumpassword_event.php @@ -34,7 +34,7 @@ class albumpassword_event_Core { ->id("albumpassword_login") ->css_id("g-album-password-login") ->url(url::site("albumpassword/login")) - ->label(t("Enter password"))); + ->label(t("Unlock albums"))); } else { // If a password has been entered already // display the log out link, and links to the protected albums diff --git a/3.0/modules/albumpassword/helpers/albumpassword_task.php b/3.0/modules/albumpassword/helpers/albumpassword_task.php index b6ea007a..07f620e1 100644 --- a/3.0/modules/albumpassword/helpers/albumpassword_task.php +++ b/3.0/modules/albumpassword/helpers/albumpassword_task.php @@ -26,11 +26,70 @@ class albumpassword_task_Core { ->join("albumpassword_idcaches", "items_albumpasswords.id", "albumpassword_idcaches.password_id", "LEFT OUTER") ->and_where("albumpassword_idcaches.password_id", "IS", NULL)->count_all(); - return array(Task_Definition::factory() - ->callback("albumpassword_task::update_idcaches") - ->name(t("Rebuild Album Password ID Caches DB")) - ->description(t("Logs the contents of all protected albums into the db.")) - ->severity($bad_albums ? log::WARNING : log::SUCCESS)); + $tasks = array(); + + $tasks[] = Task_Definition::factory() + ->callback("albumpassword_task::update_idcaches") + ->name(t("Rebuild Album Password ID Caches DB")) + ->description(t("Logs the contents of all protected albums into the db.")) + ->severity($bad_albums ? log::WARNING : log::SUCCESS); + + $tasks[] = Task_Definition::factory() + ->callback("albumpassword_task::lowercase_passwords") + ->name(t("Fix Password DB Casing")) + ->description(t("Fixes case sensitivity issues.")) + ->severity(log::SUCCESS); + + return $tasks; + } + + static function lowercase_passwords($task) { + // Converts all passwords to lower case. + + $start = microtime(true); + $total = $task->get("total"); + $existing_passwords = ORM::factory("items_albumpassword")->find_all(); + + if (empty($total)) { + // Set the initial values for all variables. + $task->set("total", count($existing_passwords)); + $total = $task->get("total"); + $task->set("last_password_id", 0); + $task->set("completed_passwords", 0); + } + + // Retrieve the values for variables from the last time this + // function was run. + $last_password_id = $task->get("last_password_id"); + $completed_passwords = $task->get("completed_passwords"); + + foreach (ORM::factory("items_albumpassword") + ->where("id", ">", $last_password_id) + ->order_by("id") + ->find_all(100) as $one_password) { + $one_password->password = strtolower($one_password->password); + $one_password->save(); + + $last_password_id = $one_password->id; + $completed_passwords++; + + if ($completed_passwords == count($existing_passwords) || microtime(true) - $start > 1.5) { + break; + } + } + + $task->set("last_password_id", $last_password_id); + $task->set("completed_passwords", $completed_passwords); + + if ($completed_passwords == count($existing_passwords)) { + $task->done = true; + $task->state = "success"; + $task->percent_complete = 100; + } else { + $task->percent_complete = round(100 * $completed_passwords / count($existing_passwords)); + } + $task->status = t2("One password fixed", "%count / %total passwords fixed", $completed_passwords, + array("total" => count($existing_passwords))); } static function update_idcaches($task) { diff --git a/3.0/modules/albumpassword/module.info b/3.0/modules/albumpassword/module.info index 6469b332..313bddf5 100644 --- a/3.0/modules/albumpassword/module.info +++ b/3.0/modules/albumpassword/module.info @@ -1,3 +1,7 @@ name = "Album Password" description = "Restrict access to individual albums." version = 3 +author_name = "rWatcher" +author_url = "http://codex.gallery2.org/User:RWatcher" +info_url = "http://codex.gallery2.org/Gallery3:Modules:albumpassword" +discuss_url = "http://gallery.menalto.com/node/98856" diff --git a/3.0/modules/albumtree/helpers/albumtree_installer.php b/3.0/modules/albumtree/helpers/albumtree_installer.php index 592a9b71..77c7066f 100644 --- a/3.0/modules/albumtree/helpers/albumtree_installer.php +++ b/3.0/modules/albumtree/helpers/albumtree_installer.php @@ -20,7 +20,7 @@ class albumtree_installer { static function install() { module::set_var("albumtree", "style", "select"); - module::set_version("albumtree", 2); + module::set_version("albumtree", 3); } static function upgrade($version) { diff --git a/3.0/modules/albumtree/images/base.gif b/3.0/modules/albumtree/images/base.gif new file mode 100755 index 00000000..9ac0b117 Binary files /dev/null and b/3.0/modules/albumtree/images/base.gif differ diff --git a/3.0/modules/albumtree/images/empty.gif b/3.0/modules/albumtree/images/empty.gif new file mode 100755 index 00000000..b5cf5237 Binary files /dev/null and b/3.0/modules/albumtree/images/empty.gif differ diff --git a/3.0/modules/albumtree/images/folder.gif b/3.0/modules/albumtree/images/folder.gif new file mode 100755 index 00000000..eb129763 Binary files /dev/null and b/3.0/modules/albumtree/images/folder.gif differ diff --git a/3.0/modules/albumtree/images/folderopen.gif b/3.0/modules/albumtree/images/folderopen.gif new file mode 100755 index 00000000..c5c31102 Binary files /dev/null and b/3.0/modules/albumtree/images/folderopen.gif differ diff --git a/3.0/modules/albumtree/images/imgfolder.gif b/3.0/modules/albumtree/images/imgfolder.gif new file mode 100755 index 00000000..e6d88034 Binary files /dev/null and b/3.0/modules/albumtree/images/imgfolder.gif differ diff --git a/3.0/modules/albumtree/images/join.gif b/3.0/modules/albumtree/images/join.gif new file mode 100755 index 00000000..34dd4761 Binary files /dev/null and b/3.0/modules/albumtree/images/join.gif differ diff --git a/3.0/modules/albumtree/images/join_rtl.gif b/3.0/modules/albumtree/images/join_rtl.gif new file mode 100755 index 00000000..04bc3a7b Binary files /dev/null and b/3.0/modules/albumtree/images/join_rtl.gif differ diff --git a/3.0/modules/albumtree/images/joinbottom.gif b/3.0/modules/albumtree/images/joinbottom.gif new file mode 100755 index 00000000..48b81c80 Binary files /dev/null and b/3.0/modules/albumtree/images/joinbottom.gif differ diff --git a/3.0/modules/albumtree/images/joinbottom_rtl.gif b/3.0/modules/albumtree/images/joinbottom_rtl.gif new file mode 100755 index 00000000..24fdbce8 Binary files /dev/null and b/3.0/modules/albumtree/images/joinbottom_rtl.gif differ diff --git a/3.0/modules/albumtree/images/line.gif b/3.0/modules/albumtree/images/line.gif new file mode 100755 index 00000000..1a259eea Binary files /dev/null and b/3.0/modules/albumtree/images/line.gif differ diff --git a/3.0/modules/albumtree/images/line_rtl.gif b/3.0/modules/albumtree/images/line_rtl.gif new file mode 100755 index 00000000..704b07de Binary files /dev/null and b/3.0/modules/albumtree/images/line_rtl.gif differ diff --git a/3.0/modules/albumtree/images/minus.gif b/3.0/modules/albumtree/images/minus.gif new file mode 100755 index 00000000..3d212a97 Binary files /dev/null and b/3.0/modules/albumtree/images/minus.gif differ diff --git a/3.0/modules/albumtree/images/minus_rtl.gif b/3.0/modules/albumtree/images/minus_rtl.gif new file mode 100755 index 00000000..f0db8fa8 Binary files /dev/null and b/3.0/modules/albumtree/images/minus_rtl.gif differ diff --git a/3.0/modules/albumtree/images/minusbottom.gif b/3.0/modules/albumtree/images/minusbottom.gif new file mode 100755 index 00000000..dc3198be Binary files /dev/null and b/3.0/modules/albumtree/images/minusbottom.gif differ diff --git a/3.0/modules/albumtree/images/minusbottom_rtl.gif b/3.0/modules/albumtree/images/minusbottom_rtl.gif new file mode 100755 index 00000000..69ecf510 Binary files /dev/null and b/3.0/modules/albumtree/images/minusbottom_rtl.gif differ diff --git a/3.0/modules/albumtree/images/nolines_minus.gif b/3.0/modules/albumtree/images/nolines_minus.gif new file mode 100755 index 00000000..2592ac20 Binary files /dev/null and b/3.0/modules/albumtree/images/nolines_minus.gif differ diff --git a/3.0/modules/albumtree/images/nolines_plus.gif b/3.0/modules/albumtree/images/nolines_plus.gif new file mode 100755 index 00000000..f258ce21 Binary files /dev/null and b/3.0/modules/albumtree/images/nolines_plus.gif differ diff --git a/3.0/modules/albumtree/images/plus.gif b/3.0/modules/albumtree/images/plus.gif new file mode 100755 index 00000000..b2c99723 Binary files /dev/null and b/3.0/modules/albumtree/images/plus.gif differ diff --git a/3.0/modules/albumtree/images/plus_rtl.gif b/3.0/modules/albumtree/images/plus_rtl.gif new file mode 100755 index 00000000..c527f9fe Binary files /dev/null and b/3.0/modules/albumtree/images/plus_rtl.gif differ diff --git a/3.0/modules/albumtree/images/plusbottom.gif b/3.0/modules/albumtree/images/plusbottom.gif new file mode 100755 index 00000000..b5671d89 Binary files /dev/null and b/3.0/modules/albumtree/images/plusbottom.gif differ diff --git a/3.0/modules/albumtree/images/plusbottom_rtl.gif b/3.0/modules/albumtree/images/plusbottom_rtl.gif new file mode 100755 index 00000000..b7105c56 Binary files /dev/null and b/3.0/modules/albumtree/images/plusbottom_rtl.gif differ diff --git a/3.0/modules/albumtree/module.info b/3.0/modules/albumtree/module.info index b7fb9f50..b14d4487 100644 --- a/3.0/modules/albumtree/module.info +++ b/3.0/modules/albumtree/module.info @@ -1,3 +1,7 @@ name = "Album Tree" description = "Provides a block in the sidebar with quick links to all other albums." -version = 2 +version = 3 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:albumtree" +discuss_url = "http://gallery.menalto.com/forum_module_albumtree" diff --git a/3.0/modules/albumtree/views/albumtree_block_dtree.html.php b/3.0/modules/albumtree/views/albumtree_block_dtree.html.php new file mode 100644 index 00000000..10f6c264 --- /dev/null +++ b/3.0/modules/albumtree/views/albumtree_block_dtree.html.php @@ -0,0 +1,414 @@ + + + + +
+
+ +
+
diff --git a/3.0/modules/albumtree/views/albumtree_block_list.html.php b/3.0/modules/albumtree/views/albumtree_block_list.html.php index 0e2cdb6d..58daf0ce 100644 --- a/3.0/modules/albumtree/views/albumtree_block_list.html.php +++ b/3.0/modules/albumtree/views/albumtree_block_list.html.php @@ -10,29 +10,21 @@ diff --git a/3.0/modules/albumtree/views/albumtree_block_select.html.php b/3.0/modules/albumtree/views/albumtree_block_select.html.php index 4a73c333..cb543c86 100644 --- a/3.0/modules/albumtree/views/albumtree_block_select.html.php +++ b/3.0/modules/albumtree/views/albumtree_block_select.html.php @@ -1,24 +1,16 @@ - + + +viewable()->children(null, null, array(array("type", "=", "album"))) as $child){ + makeselect($child,$level+1); + } +} +makeselect($root,0); +?> diff --git a/3.0/modules/all_tags/controllers/all_tags.php b/3.0/modules/all_tags/controllers/all_tags.php new file mode 100644 index 00000000..e0e1c344 --- /dev/null +++ b/3.0/modules/all_tags/controllers/all_tags.php @@ -0,0 +1,56 @@ +css("all_tags.css"); + $template->page_title = t("Gallery :: All Tags"); + $template->content = new View("all_tags.html"); + + $filter = Input::instance()->get("filter"); + $template->content->filter = $filter; + $query = ORM::factory("tag"); + if ($filter) { + $query->like("name", $filter); + } + $template->content->tags = $query->order_by("name", "ASC")->find_all(); + + print $template; + } +} + +/* + public function index() { + $filter = Input::instance()->get("filter"); + + $view = new Admin_View("admin.html"); + $view->page_title = t("Manage tags"); + $view->content = new View("admin_tags.html"); + $view->content->filter = $filter; + + $query = ORM::factory("tag"); + if ($filter) { + $query->like("name", $filter); + } + $view->content->tags = $query->order_by("name", "ASC")->find_all(); + print $view; + } + */ diff --git a/3.0/modules/all_tags/css/all_tags.css b/3.0/modules/all_tags/css/all_tags.css new file mode 100644 index 00000000..3dc93836 --- /dev/null +++ b/3.0/modules/all_tags/css/all_tags.css @@ -0,0 +1,2 @@ +table.all_tags { text-align: center; width:500px; } +table.all_tags caption { font-size: 1.5em; padding: 0.2em; } \ No newline at end of file diff --git a/3.0/modules/all_tags/helpers/all_tags_event.php b/3.0/modules/all_tags/helpers/all_tags_event.php new file mode 100644 index 00000000..3007f434 --- /dev/null +++ b/3.0/modules/all_tags/helpers/all_tags_event.php @@ -0,0 +1,29 @@ +add_after("home", Menu::factory("link") + ->id("all_tags") + ->label(t("All Tags")) + ->url(url::site("all_tags/"))); + } + } +} \ No newline at end of file diff --git a/3.0/modules/all_tags/helpers/all_tags_theme.php b/3.0/modules/all_tags/helpers/all_tags_theme.php new file mode 100644 index 00000000..89b91e70 --- /dev/null +++ b/3.0/modules/all_tags/helpers/all_tags_theme.php @@ -0,0 +1,24 @@ +css("all_tags.css"); + } +} diff --git a/3.0/modules/all_tags/module.info b/3.0/modules/all_tags/module.info new file mode 100644 index 00000000..10862900 --- /dev/null +++ b/3.0/modules/all_tags/module.info @@ -0,0 +1,7 @@ +name = "All Tags" +description = "All Tags page and menu item." +version = 2 +author_name = "Undagiga" +author_url = "http://codex.gallery2.org/User:Undagiga" +info_url = "http://codex.gallery2.org/Gallery3:Modules:all_tags" +discuss_url = "http://gallery.menalto.com/forum_module_all_tags" \ No newline at end of file diff --git a/3.0/modules/all_tags/views/all_tags.html.php b/3.0/modules/all_tags/views/all_tags.html.php new file mode 100644 index 00000000..381ee6b6 --- /dev/null +++ b/3.0/modules/all_tags/views/all_tags.html.php @@ -0,0 +1,44 @@ + + +count()/5 ?> + + +
+

+ +
+ + + + + + +
+ count()) ?> +
+ $tag): ?> + name, 0, 1)) ?> + + + +
    + +
+ $tags_per_column): /* new column */ ?> + +
+ + + +
+
+
diff --git a/3.0/modules/atom/module.info b/3.0/modules/atom/module.info index e9d35a69..77f5c0b8 100644 --- a/3.0/modules/atom/module.info +++ b/3.0/modules/atom/module.info @@ -1,3 +1,7 @@ name = "Atom" description = "Enable Atom feeds in your Gallery" version = 1 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:atom" +discuss_url = "http://gallery.menalto.com/forum_module_atom" diff --git a/3.0/modules/author/module.info b/3.0/modules/author/module.info index 4a9b80b6..e606e24d 100644 --- a/3.0/modules/author/module.info +++ b/3.0/modules/author/module.info @@ -1,3 +1,7 @@ name = "Author" description = "Allows for the display and modification of the Author/Photographer/Byline data in photos." version = 2 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:author" +discuss_url = "http://gallery.menalto.com/forum_module_author" diff --git a/3.0/modules/autorotate/module.info b/3.0/modules/autorotate/module.info index 42a108fb..c4087382 100644 --- a/3.0/modules/autorotate/module.info +++ b/3.0/modules/autorotate/module.info @@ -1,3 +1,7 @@ name = "Autorotate" description = "Rotate an image automatically on upload based on EXIF data" -version = 2 \ No newline at end of file +version = 2 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:autorotate" +discuss_url = "http://gallery.menalto.com/forum_module_autorotate" diff --git a/3.0/modules/aws_s3/module.info b/3.0/modules/aws_s3/module.info index 8e8f30a8..8ce80545 100644 --- a/3.0/modules/aws_s3/module.info +++ b/3.0/modules/aws_s3/module.info @@ -1,3 +1,7 @@ name = "Amazon S3" description = "Seamlessly transfer your Gallery data to Amazon S3 CDN for a lightning fast gallery" version = 2 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:aws_s3" +discuss_url = "http://gallery.menalto.com/forum_module_aws_s3" diff --git a/3.0/modules/basket/module.info b/3.0/modules/basket/module.info index 559c59aa..965a7df3 100644 --- a/3.0/modules/basket/module.info +++ b/3.0/modules/basket/module.info @@ -1,3 +1,7 @@ name = "Shopping Basket" description = "Provides a simple shopping basket and checkout with paypal integration" version = 5 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:basket" +discuss_url = "http://gallery.menalto.com/forum_module_basket" diff --git a/3.0/modules/batchtag/module.info b/3.0/modules/batchtag/module.info index eb00345a..c1380ad4 100644 --- a/3.0/modules/batchtag/module.info +++ b/3.0/modules/batchtag/module.info @@ -1,3 +1,7 @@ name = "BatchTag" description = "Automatically apply a tag to the entire contents of an album." version = 1 +author_name = "rWatcher" +author_url = "http://codex.gallery2.org/User:RWatcher" +info_url = "http://codex.gallery2.org/Gallery3:Modules:batchtag" +discuss_url = "http://gallery.menalto.com/node/101076" diff --git a/3.0/modules/calendarview/module.info b/3.0/modules/calendarview/module.info index e70ff69f..f51f1625 100644 --- a/3.0/modules/calendarview/module.info +++ b/3.0/modules/calendarview/module.info @@ -1,3 +1,7 @@ name = "CalendarView" description = "View your photos by the date they were taken." -version = 1 \ No newline at end of file +version = 1 +author_name = "rWatcher" +author_url = "http://codex.gallery2.org/User:RWatcher" +info_url = "http://codex.gallery2.org/Gallery3:Modules:calendarview" +discuss_url = "http://gallery.menalto.com/node/92405" diff --git a/3.0/modules/calendarview/views/calendarview_year.html.php b/3.0/modules/calendarview/views/calendarview_year.html.php index 880e0267..b40d7d58 100644 --- a/3.0/modules/calendarview/views/calendarview_year.html.php +++ b/3.0/modules/calendarview/views/calendarview_year.html.php @@ -38,7 +38,7 @@ // Check and see if any photos were taken in January, // If so, make the month title into a clickable link. print "
"; - if (date("n", $items_for_year[$counter]->captured) == 1) { + if ((count($items_for_year) > 0) && (date("n", $items_for_year[$counter]->captured) == 1)) { $month_url = url::site("calendarview/month/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/"); } else { $month_url = ""; diff --git a/3.0/modules/captionator/module.info b/3.0/modules/captionator/module.info index d9087368..5edf301c 100644 --- a/3.0/modules/captionator/module.info +++ b/3.0/modules/captionator/module.info @@ -1,3 +1,7 @@ name = "Captionator" description = "Caption all photos, movies and albums in an album at once." version = 1 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:captionator" +discuss_url = "http://gallery.menalto.com/forum_module_captionator" diff --git a/3.0/modules/captionator/views/captionator_dialog.html.php b/3.0/modules/captionator/views/captionator_dialog.html.php index f6103d60..cdce7906 100644 --- a/3.0/modules/captionator/views/captionator_dialog.html.php +++ b/3.0/modules/captionator/views/captionator_dialog.html.php @@ -34,7 +34,7 @@ diff --git a/3.0/modules/carousel/controllers/admin_carousel.php b/3.0/modules/carousel/controllers/admin_carousel.php new file mode 100644 index 00000000..0852ec3f --- /dev/null +++ b/3.0/modules/carousel/controllers/admin_carousel.php @@ -0,0 +1,183 @@ +_get_view(); + } + + public function handler() { + access::verify_csrf(); + + $form = $this->_get_form(); + if ($form->validate()) { + module::set_var( + "carousel", "circular", $form->carousel->circular->value); + module::set_var( + "carousel", "autoscroll", $form->carousel->autoscroll->value); + module::set_var( + "carousel", "autostart", $form->carousel->autostart->value); + module::set_var( + "carousel", "speed", $form->carousel->speed->value); + module::set_var( + "carousel", "mousewheel", $form->carousel->mousewheel->value); + + module::set_var( + "carousel", "title2", $form->recent->title2->value); + module::set_var( + "carousel", "thumbsize2", $form->recent->thumbsize2->value); + module::set_var( + "carousel", "visible2", $form->recent->visible2->value); + module::set_var( + "carousel", "quantity2", $form->recent->quantity2->value); + module::set_var( + "carousel", "onphoto2", $form->recent->onphoto2->value); + module::set_var( + "carousel", "onalbum2", $form->recent->onalbum2->value); + + module::set_var( + "carousel", "title3", $form->popular->title3->value); + module::set_var( + "carousel", "thumbsize3", $form->popular->thumbsize3->value); + module::set_var( + "carousel", "visible3", $form->popular->visible3->value); + module::set_var( + "carousel", "quantity3", $form->popular->quantity3->value); + module::set_var( + "carousel", "onphoto3", $form->popular->onphoto3->value); + module::set_var( + "carousel", "onalbum3", $form->popular->onalbum3->value); + + module::set_var( + "carousel", "title", $form->random->title->value); + module::set_var( + "carousel", "thumbsize", $form->random->thumbsize->value); + module::set_var( + "carousel", "visible", $form->random->visible->value); + module::set_var( + "carousel", "quantity", $form->random->quantity->value); + module::set_var( + "carousel", "onphoto", $form->random->onphoto->value); + module::set_var( + "carousel", "onalbum", $form->random->onalbum->value); + + message::success(t("Your settings have been saved.")); + url::redirect("admin/carousel"); + } + print $this->_get_view($form); + } + + private function _get_view($form=null) { + $v = new Admin_View("admin.html"); + $v->content = new View("admin_carousel.html"); + $v->content->form = empty($form) ? $this->_get_form() : $form; + return $v; + } + + private function _get_form() { + for ($i = 5; $i <= 50; $i+=5) { + $range[$i] = "$i"; + } + $shortrange = array(); + for ($i = 1; $i < 21; $i++) { + $key=((float)$i / 2); + $shortrange["$key"] = sprintf("%.1f", (float)$i / 2); + } + if (module::get_var("carousel", "autoscroll") == true) { + $disableme == "false"; + } else { + $disableme == "true"; + } + $form = new Forge("admin/carousel/handler", "", "post", array("id" => "g-admin-form")); + + $group = $form->group("carousel")->label(t("General carousel settings")); + $group->checkbox("circular")->label(t('Enable the carousel to be circular so it starts over again from the beggining.')) + ->checked(module::get_var("carousel", "circular", "0")); + $group->checkbox("autoscroll")->label(t('Carousel should auto scroll. Toggle value to change settings below.')) + ->onClick("toggle()") + ->id("autoscroll") + ->checked(module::get_var("carousel", "autoscroll", "0")); + $group->input("autostart")->label(t("Enter the value of the auto start. (800)")) + ->value(module::get_var("carousel", "autostart", "800")) + ->id("auto") + ->disabled("false") + ->rules("valid_numeric|length[1,5]"); + $group->input("speed")->label(t('Enter the scrolling speed of the carousel. (1000)')) + ->value(module::get_var("carousel", "speed", "1000")) + ->id("speed") + ->disabled($disableme) + ->rules("valid_numeric|length[1,5]"); + $group->checkbox("mousewheel")->label(t('Enable mouse wheel. Allows for mouse wheel to scroll items.')) + ->checked(module::get_var("carousel", "mousewheel", "0")); + + $group = $form->group("recent")->label(t("Recent carousel block")); + $group->input("title2")->label(t('Enter the title of the recent block.')) + ->value(module::get_var("carousel", "title2", "Recent items")); + $group->input("thumbsize2")->label(t('Enter the size of the thumbs. (pixels)')) + ->value(module::get_var("carousel", "thumbsize2", "200")) + ->rules("valid_numeric|length[2,3]"); + $group->dropdown("visible2")->label(t('Enter number of thumbs to show. (height of carousel)')) + ->options($shortrange) + ->selected(module::get_var("carousel", "visible2", "1")); + $group->dropdown("quantity2")->label(t("Choose the toal quantity of thumbs in recent carousel.")) + ->options($range) + ->selected(module::get_var("carousel", "quantity2", "25")); + $group->checkbox("onalbum2")->label(t("Show on album & collection pages")) + ->checked(module::get_var("carousel", "onalbum2", "0")); + $group->checkbox("onphoto2")->label(t("Show on photo pages")) + ->checked(module::get_var("carousel", "onphoto2", "0")); + + $group = $form->group("popular")->label(t("Popular carousel block")); + $group->input("title3")->label(t('Enter the title of the popular block.')) + ->value(module::get_var("carousel", "title3", "Popular items")); + $group->input("thumbsize3")->label(t('Enter the thumb size. (pixels)')) + ->value(module::get_var("carousel", "thumbsize3", "200")) + ->rules("valid_numeric|length[2,3]"); + $group->dropdown("visible3")->label(t('Enter number of thumbs to show. (height of carousel)')) + ->options($shortrange) + ->selected(module::get_var("carousel", "visible3", "1")); + $group->dropdown("quantity3")->label(t("Choose the toal quantity of thumbs in popular carousel.")) + ->options($range) + ->selected(module::get_var("carousel", "quantity3", "25")); + $group->checkbox("onalbum3")->label(t("Show on album & collection pages")) + ->checked(module::get_var("carousel", "onalbum3", "0")); + $group->checkbox("onphoto3")->label(t("Show on photo pages")) + ->checked(module::get_var("carousel", "onphoto3", "0")); + + $group = $form->group("random")->label(t("Random carousel block. Some issues with smaller galleries.")); + $group->input("title")->label(t('Enter the title of the random block.')) + ->value(module::get_var("carousel", "title", "Random items")); + $group->input("thumbsize")->label(t('Enter the thumb size. (pixels)')) + ->value(module::get_var("carousel", "thumbsize", "200")) + ->rules("valid_numeric|length[2,3]"); + $group->dropdown("visible")->label(t('Enter number of thumbs to show. (height of carousel)')) + ->options($shortrange) + ->selected(module::get_var("carousel", "visible", "1")); + $group->dropdown("quantity")->label(t("Choose the toal quantity of thumbs in random carousel.")) + ->options($range) + ->selected(module::get_var("carousel", "quantity", "25")); + $group->checkbox("onalbum")->label(t("Show on album & collection pages")) + ->checked(module::get_var("carousel", "onalbum", "0")); + $group->checkbox("onphoto")->label(t("Show on photo pages")) + ->checked(module::get_var("carousel", "onphoto", "0")); + + $form->submit("submit")->value(t("Save")); + return $form; + } +} \ No newline at end of file diff --git a/3.0/modules/carousel/css/carousel.css b/3.0/modules/carousel/css/carousel.css new file mode 100644 index 00000000..28b9defb --- /dev/null +++ b/3.0/modules/carousel/css/carousel.css @@ -0,0 +1,30 @@ +.jcarousel-container { + -moz-border-radius: 10px; + background: #F0F6F9; + border: 1px solid #346F97; +} + +.jcarousel-container-vertical { + width: 75px; + height: 245px; + padding: 40px 20px; +} + +.jcarousel-clip-vertical { + width: 75px; + height: 245px; +} + +.jcarousel-item { + width: 75px; + height: 75px; +} + +.jcarousel-item-vertical { + margin-bottom: 10px; +} + +.jcarousel-item-placeholder { + background: #fff; + color: #000; +} \ No newline at end of file diff --git a/3.0/modules/carousel/helpers/carousel_block.php b/3.0/modules/carousel/helpers/carousel_block.php new file mode 100644 index 00000000..6141fcae --- /dev/null +++ b/3.0/modules/carousel/helpers/carousel_block.php @@ -0,0 +1,61 @@ + t("Recent items carousel"), + "carousel_popular" => t("Popular items carousel"), + "carousel_random" => t("Random items carousel")); + } + + static function get($block_id, $theme) { + $block = ""; + switch ($block_id) { + case "carousel_recent": + if (module::get_var("carousel", "onalbum2") && $theme->page_type == "collection" || + module::get_var("carousel", "onphoto2") && $theme->page_type == "item") { + $block = new Block(); + $block->css_id = "g-carousel-rec"; + $block->title = module::get_var("carousel", "title2", "Recent items"); + $block->content = new View("carousel_recent.html"); + } + break; + case "carousel_popular": + if (module::get_var("carousel", "onalbum3") && $theme->page_type == "collection" || + module::get_var("carousel", "onphoto3") && $theme->page_type == "item") { + $block = new Block(); + $block->css_id = "g-carousel-pop"; + $block->title = module::get_var("carousel", "title3", "Popular items"); + $block->content = new View("carousel_popular.html"); + } + break; + case "carousel_random": + if (module::get_var("carousel", "onalbum") && $theme->page_type == "collection" || + module::get_var("carousel", "onphoto") && $theme->page_type == "item") { + $block = new Block(); + $block->css_id = "g-carousel-ran"; + $block->title = module::get_var("carousel", "title", "Random items"); + $block->content = new View("carousel_random.html"); + } + break; + } + return $block; + } +} \ No newline at end of file diff --git a/3.0/modules/carousel/helpers/carousel_event.php b/3.0/modules/carousel/helpers/carousel_event.php new file mode 100644 index 00000000..ffe2ac69 --- /dev/null +++ b/3.0/modules/carousel/helpers/carousel_event.php @@ -0,0 +1,28 @@ +get("settings_menu") + ->append(Menu::factory("link") + ->id("carousel_menu") + ->label(t("Carousel")) + ->url(url::site("admin/carousel"))); + } +} diff --git a/3.0/modules/carousel/helpers/carousel_theme.php b/3.0/modules/carousel/helpers/carousel_theme.php new file mode 100644 index 00000000..fe1f9abe --- /dev/null +++ b/3.0/modules/carousel/helpers/carousel_theme.php @@ -0,0 +1,24 @@ +script("jcarousellite.min.js"); + } +} \ No newline at end of file diff --git a/3.0/modules/carousel/js/jcarousellite.min.js b/3.0/modules/carousel/js/jcarousellite.min.js new file mode 100644 index 00000000..f16734ae --- /dev/null +++ b/3.0/modules/carousel/js/jcarousellite.min.js @@ -0,0 +1 @@ +(function($){$.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},o||{});return this.each(function(){var b=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var c=$(this),ul=$("ul",c),tLi=$("li",ul),tl=tLi.size(),v=o.visible;if(o.circular){ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());o.start+=v}var f=$("li",ul),itemLength=f.size(),curr=o.start;c.css("visibility","visible");f.css({overflow:"hidden",float:o.vertical?"none":"left"});ul.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});c.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var g=o.vertical?height(f):width(f);var h=g*itemLength;var j=g*v;f.css({width:f.width(),height:f.height()});ul.css(sizeCss,h+"px").css(animCss,-(curr*g));c.css(sizeCss,j+"px");if(o.btnPrev)$(o.btnPrev).click(function(){return go(curr-o.scroll)});if(o.btnNext)$(o.btnNext).click(function(){return go(curr+o.scroll)});if(o.btnGo)$.each(o.btnGo,function(i,a){$(a).click(function(){return go(o.circular?o.visible+i:i)})});if(o.mouseWheel&&c.mousewheel)c.mousewheel(function(e,d){return d>0?go(curr-o.scroll):go(curr+o.scroll)});if(o.auto)setInterval(function(){go(curr+o.scroll)},o.auto+o.speed);function vis(){return f.slice(curr).slice(0,v)};function go(a){if(!b){if(o.beforeStart)o.beforeStart.call(this,vis());if(o.circular){if(a<=o.start-v-1){ul.css(animCss,-((itemLength-(v*2))*g)+"px");curr=a==o.start-v-1?itemLength-(v*2)-1:itemLength-(v*2)-o.scroll}else if(a>=itemLength-v+1){ul.css(animCss,-((v)*g)+"px");curr=a==itemLength-v+1?v+1:v+o.scroll}else curr=a}else{if(a<0||a>itemLength-v)return;else curr=a}b=true;ul.animate(animCss=="left"?{left:-(curr*g)}:{top:-(curr*g)},o.speed,o.easing,function(){if(o.afterEnd)o.afterEnd.call(this,vis());b=false});if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled")}}return false}})};function css(a,b){return parseInt($.css(a[0],b))||0};function width(a){return a[0].offsetWidth+css(a,'marginLeft')+css(a,'marginRight')};function height(a){return a[0].offsetHeight+css(a,'marginTop')+css(a,'marginBottom')}})(jQuery); \ No newline at end of file diff --git a/3.0/modules/carousel/js/jcarousellite_orig.js b/3.0/modules/carousel/js/jcarousellite_orig.js new file mode 100644 index 00000000..f68b5ed0 --- /dev/null +++ b/3.0/modules/carousel/js/jcarousellite_orig.js @@ -0,0 +1,364 @@ +/** + * jCarouselLite - jQuery plugin to navigate images/any content in a carousel style widget. + * @requires jQuery v1.2 or above + * + * http://gmarwaha.com/jquery/jcarousellite/ + * + * Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com) + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * Version: 1.0.1 + * Note: Requires jquery 1.2 or above from version 1.0.1 + */ + +/** + * Creates a carousel-style navigation widget for images/any-content from a simple HTML markup. + * + * The HTML markup that is used to build the carousel can be as simple as... + * + * + * + * As you can see, this snippet is nothing but a simple div containing an unordered list of images. + * You don't need any special "class" attribute, or a special "css" file for this plugin. + * I am using a class attribute just for the sake of explanation here. + * + * To navigate the elements of the carousel, you need some kind of navigation buttons. + * For example, you will need a "previous" button to go backward, and a "next" button to go forward. + * This need not be part of the carousel "div" itself. It can be any element in your page. + * Lets assume that the following elements in your document can be used as next, and prev buttons... + * + * + * + * + * Now, all you need to do is call the carousel component on the div element that represents it, and pass in the + * navigation buttons as options. + * + * $(".carousel").jCarouselLite({ + * btnNext: ".next", + * btnPrev: ".prev" + * }); + * + * That's it, you would have now converted your raw div, into a magnificient carousel. + * + * There are quite a few other options that you can use to customize it though. + * Each will be explained with an example below. + * + * @param an options object - You can specify all the options shown below as an options object param. + * + * @option btnPrev, btnNext : string - no defaults + * @example + * $(".carousel").jCarouselLite({ + * btnNext: ".next", + * btnPrev: ".prev" + * }); + * @desc Creates a basic carousel. Clicking "btnPrev" navigates backwards and "btnNext" navigates forward. + * + * @option btnGo - array - no defaults + * @example + * $(".carousel").jCarouselLite({ + * btnNext: ".next", + * btnPrev: ".prev", + * btnGo: [".0", ".1", ".2"] + * }); + * @desc If you don't want next and previous buttons for navigation, instead you prefer custom navigation based on + * the item number within the carousel, you can use this option. Just supply an array of selectors for each element + * in the carousel. The index of the array represents the index of the element. What i mean is, if the + * first element in the array is ".0", it means that when the element represented by ".0" is clicked, the carousel + * will slide to the first element and so on and so forth. This feature is very powerful. For example, i made a tabbed + * interface out of it by making my navigation elements styled like tabs in css. As the carousel is capable of holding + * any content, not just images, you can have a very simple tabbed navigation in minutes without using any other plugin. + * The best part is that, the tab will "slide" based on the provided effect. :-) + * + * @option mouseWheel : boolean - default is false + * @example + * $(".carousel").jCarouselLite({ + * mouseWheel: true + * }); + * @desc The carousel can also be navigated using the mouse wheel interface of a scroll mouse instead of using buttons. + * To get this feature working, you have to do 2 things. First, you have to include the mouse-wheel plugin from brandon. + * Second, you will have to set the option "mouseWheel" to true. That's it, now you will be able to navigate your carousel + * using the mouse wheel. Using buttons and mouseWheel or not mutually exclusive. You can still have buttons for navigation + * as well. They complement each other. To use both together, just supply the options required for both as shown below. + * @example + * $(".carousel").jCarouselLite({ + * btnNext: ".next", + * btnPrev: ".prev", + * mouseWheel: true + * }); + * + * @option auto : number - default is null, meaning autoscroll is disabled by default + * @example + * $(".carousel").jCarouselLite({ + * auto: 800, + * speed: 500 + * }); + * @desc You can make your carousel auto-navigate itself by specfying a millisecond value in this option. + * The value you specify is the amount of time between 2 slides. The default is null, and that disables auto scrolling. + * Specify this value and magically your carousel will start auto scrolling. + * + * @option speed : number - 200 is default + * @example + * $(".carousel").jCarouselLite({ + * btnNext: ".next", + * btnPrev: ".prev", + * speed: 800 + * }); + * @desc Specifying a speed will slow-down or speed-up the sliding speed of your carousel. Try it out with + * different speeds like 800, 600, 1500 etc. Providing 0, will remove the slide effect. + * + * @option easing : string - no easing effects by default. + * @example + * $(".carousel").jCarouselLite({ + * btnNext: ".next", + * btnPrev: ".prev", + * easing: "bounceout" + * }); + * @desc You can specify any easing effect. Note: You need easing plugin for that. Once specified, + * the carousel will slide based on the provided easing effect. + * + * @option vertical : boolean - default is false + * @example + * $(".carousel").jCarouselLite({ + * btnNext: ".next", + * btnPrev: ".prev", + * vertical: true + * }); + * @desc Determines the direction of the carousel. true, means the carousel will display vertically. The next and + * prev buttons will slide the items vertically as well. The default is false, which means that the carousel will + * display horizontally. The next and prev items will slide the items from left-right in this case. + * + * @option circular : boolean - default is true + * @example + * $(".carousel").jCarouselLite({ + * btnNext: ".next", + * btnPrev: ".prev", + * circular: false + * }); + * @desc Setting it to true enables circular navigation. This means, if you click "next" after you reach the last + * element, you will automatically slide to the first element and vice versa. If you set circular to false, then + * if you click on the "next" button after you reach the last element, you will stay in the last element itself + * and similarly for "previous" button and first element. + * + * @option visible : number - default is 3 + * @example + * $(".carousel").jCarouselLite({ + * btnNext: ".next", + * btnPrev: ".prev", + * visible: 4 + * }); + * @desc This specifies the number of items visible at all times within the carousel. The default is 3. + * You are even free to experiment with real numbers. Eg: "3.5" will have 3 items fully visible and the + * last item half visible. This gives you the effect of showing the user that there are more images to the right. + * + * @option start : number - default is 0 + * @example + * $(".carousel").jCarouselLite({ + * btnNext: ".next", + * btnPrev: ".prev", + * start: 2 + * }); + * @desc You can specify from which item the carousel should start. Remember, the first item in the carousel + * has a start of 0, and so on. + * + * @option scrool : number - default is 1 + * @example + * $(".carousel").jCarouselLite({ + * btnNext: ".next", + * btnPrev: ".prev", + * scroll: 2 + * }); + * @desc The number of items that should scroll/slide when you click the next/prev navigation buttons. By + * default, only one item is scrolled, but you may set it to any number. Eg: setting it to "2" will scroll + * 2 items when you click the next or previous buttons. + * + * @option beforeStart, afterEnd : function - callbacks + * @example + * $(".carousel").jCarouselLite({ + * btnNext: ".next", + * btnPrev: ".prev", + * beforeStart: function(a) { + * alert("Before animation starts:" + a); + * }, + * afterEnd: function(a) { + * alert("After animation ends:" + a); + * } + * }); + * @desc If you wanted to do some logic in your page before the slide starts and after the slide ends, you can + * register these 2 callbacks. The functions will be passed an argument that represents an array of elements that + * are visible at the time of callback. + * + * + * @cat Plugins/Image Gallery + * @author Ganeshji Marwaha/ganeshread@gmail.com + */ + +(function($) { // Compliant with jquery.noConflict() +$.fn.jCarouselLite = function(o) { + o = $.extend({ + btnPrev: null, + btnNext: null, + btnGo: null, + mouseWheel: false, + auto: null, + hoverPause: false, + + speed: 200, + easing: null, + + vertical: false, + circular: true, + visible: 3, + start: 0, + scroll: 1, + + beforeStart: null, + afterEnd: null + }, o || {}); + + return this.each(function() { // Returns the element collection. Chainable. + + var running = false, animCss=o.vertical?"top":"left", sizeCss=o.vertical?"height":"width"; + var div = $(this), ul = $("ul", div), tLi = $("li", ul), tl = tLi.size(), v = o.visible; + + if(o.circular) { + ul.prepend(tLi.slice(tl-v+1).clone()) + .append(tLi.slice(0,o.scroll).clone()); + o.start += v-1; + } + + var li = $("li", ul), itemLength = li.size(), curr = o.start; + div.css("visibility", "visible"); + + li.css({overflow: "hidden", float: o.vertical ? "none" : "left"}); + ul.css({margin: "0", padding: "0", position: "relative", "list-style-type": "none", "z-index": "1"}); + div.css({overflow: "hidden", position: "relative", "z-index": "2", left: "0px"}); + + var liSize = o.vertical ? height(li) : width(li); // Full li size(incl margin)-Used for animation + var ulSize = liSize * itemLength; // size of full ul(total length, not just for the visible items) + var divSize = liSize * v; // size of entire div(total length for just the visible items) + + li.css({width: li.width(), height: li.height()}); + ul.css(sizeCss, ulSize+"px").css(animCss, -(curr*liSize)); + + div.css(sizeCss, divSize+"px"); // Width of the DIV. length of visible images + + if(o.btnPrev) { + $(o.btnPrev).click(function() { + return go(curr-o.scroll); + }); + if(o.hoverPause) { + $(o.btnPrev).hover(function(){stopAuto();}, function(){startAuto();}); + } + } + + + if(o.btnNext) { + $(o.btnNext).click(function() { + return go(curr+o.scroll); + }); + if(o.hoverPause) { + $(o.btnNext).hover(function(){stopAuto();}, function(){startAuto();}); + } + } + + if(o.btnGo) + $.each(o.btnGo, function(i, val) { + $(val).click(function() { + return go(o.circular ? o.visible+i : i); + }); + }); + + if(o.mouseWheel && div.mousewheel) + div.mousewheel(function(e, d) { + return d>0 ? go(curr-o.scroll) : go(curr+o.scroll); + }); + + var autoInterval; + + function startAuto() { + stopAuto(); + autoInterval = setInterval(function() { + go(curr+o.scroll); + }, o.auto+o.speed); + }; + + function stopAuto() { + clearInterval(autoInterval); + }; + + if(o.auto) { + if(o.hoverPause) { + div.hover(function(){stopAuto();}, function(){startAuto();}); + } + startAuto(); + }; + + function vis() { + return li.slice(curr).slice(0,v); + }; + + function go(to) { + if(!running) { + + if(o.beforeStart) + o.beforeStart.call(this, vis()); + + if(o.circular) { // If circular we are in first or last, then goto the other end + if(to<0) { // If before range, then go around + ul.css(animCss, -( (curr + tl) * liSize)+"px"); + curr = to + tl; + } else if(to>itemLength-v) { // If beyond range, then come around + ul.css(animCss, -( (curr - tl) * liSize ) + "px" ); + curr = to - tl; + } else curr = to; + } else { // If non-circular and to points to first or last, we just return. + if(to<0 || to>itemLength-v) return; + else curr = to; + } // If neither overrides it, the curr will still be "to" and we can proceed. + + running = true; + + ul.animate( + animCss == "left" ? { left: -(curr*liSize) } : { top: -(curr*liSize) } , o.speed, o.easing, + function() { + if(o.afterEnd) + o.afterEnd.call(this, vis()); + running = false; + } + ); + // Disable buttons when the carousel reaches the last/first, and enable when not + if(!o.circular) { + $(o.btnPrev + "," + o.btnNext).removeClass("disabled"); + $( (curr-o.scroll<0 && o.btnPrev) + || + (curr+o.scroll > itemLength-v && o.btnNext) + || + [] + ).addClass("disabled"); + } + + } + return false; + }; + }); +}; + +function css(el, prop) { + return parseInt($.css(el[0], prop)) || 0; +}; +function width(el) { + return el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight'); +}; +function height(el) { + return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom'); +}; + +})(jQuery); \ No newline at end of file diff --git a/3.0/modules/carousel/js/jquery.mousewheel.min.js b/3.0/modules/carousel/js/jquery.mousewheel.min.js new file mode 100644 index 00000000..05ebb0a9 --- /dev/null +++ b/3.0/modules/carousel/js/jquery.mousewheel.min.js @@ -0,0 +1,11 @@ +/* Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net) + * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) + * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. + * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. + * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. + * + * Version: 3.0.2 + * + * Requires: 1.2.2+ + */ +(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}});function b(f){var d=[].slice.call(arguments,1),g=0,e=true;f=c.event.fix(f||window.event);f.type="mousewheel";if(f.wheelDelta){g=f.wheelDelta/120}if(f.detail){g=-f.detail/3}d.unshift(f,g);return c.event.handle.apply(this,d)}})(jQuery); \ No newline at end of file diff --git a/3.0/modules/carousel/module.info b/3.0/modules/carousel/module.info new file mode 100644 index 00000000..0ee02423 --- /dev/null +++ b/3.0/modules/carousel/module.info @@ -0,0 +1,7 @@ +name = "Carousel" +description = "Add a vertical carousel for recent & popular items in the sidebar." +version = 1.0 +author_name = "floridave" +author_url = "http://codex.gallery2.org/User:Floridave" +info_url = "http://codex.gallery2.org/Gallery3:Modules:carousel" +discuss_url = "http://gallery.menalto.com/forum_module_all_carousel" \ No newline at end of file diff --git a/3.0/modules/carousel/views/admin_carousel.html.php b/3.0/modules/carousel/views/admin_carousel.html.php new file mode 100644 index 00000000..8c3197e2 --- /dev/null +++ b/3.0/modules/carousel/views/admin_carousel.html.php @@ -0,0 +1,23 @@ + + + diff --git a/3.0/modules/carousel/views/carousel_popular.html.php b/3.0/modules/carousel/views/carousel_popular.html.php new file mode 100644 index 00000000..887cb5c2 --- /dev/null +++ b/3.0/modules/carousel/views/carousel_popular.html.php @@ -0,0 +1,47 @@ + +viewable() + ->where("type", "!=", "album") + ->order_by("view_count", "DESC") + ->find_all($quantity); +?> + + + + +
+ +
\ No newline at end of file diff --git a/3.0/modules/carousel/views/carousel_random.html.php b/3.0/modules/carousel/views/carousel_random.html.php new file mode 100644 index 00000000..54f864cc --- /dev/null +++ b/3.0/modules/carousel/views/carousel_random.html.php @@ -0,0 +1,49 @@ + +viewable() + ->where("rand_key", "<", ((float)mt_rand()) / (float)mt_getrandmax()) + ->merge_where(NULL) + ->order_by("rand_key", "DESC") + ->find_all($quantity); +?> + + + + +
+ +
\ No newline at end of file diff --git a/3.0/modules/carousel/views/carousel_recent.html.php b/3.0/modules/carousel/views/carousel_recent.html.php new file mode 100644 index 00000000..95f3d610 --- /dev/null +++ b/3.0/modules/carousel/views/carousel_recent.html.php @@ -0,0 +1,48 @@ + +viewable() + ->where("type", "!=", "album") + ->order_by("created", "DESC") + ->find_all($quantity); +?> + + + + +
+ +
\ No newline at end of file diff --git a/3.0/modules/contactowner/controllers/contactowner.php b/3.0/modules/contactowner/controllers/contactowner.php index 0a302c91..8d140872 100644 --- a/3.0/modules/contactowner/controllers/contactowner.php +++ b/3.0/modules/contactowner/controllers/contactowner.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class ContactOwner_Controller extends Controller { - static function get_email_form($user_id, $item_id) { + static function get_email_form($user_id, $item_id=null) { // Determine name of the person the message is going to. $str_to_name = ""; if ($user_id == -1) { @@ -34,7 +34,7 @@ class ContactOwner_Controller extends Controller { // If item_id is set, include a link to the item. $email_body = ""; - if ($item_id <> "") { + if (!empty($item_id)) { $item = ORM::factory("item", $item_id); $email_body = "This message refers to type}s/{$item->id}") . "\">this page."; } @@ -83,10 +83,10 @@ class ContactOwner_Controller extends Controller { } // Set up and display the actual page. - $template = new Theme_View("page.html", "other", "Contact"); - $template->content = new View("contactowner_emailform.html"); - $template->content->sendmail_form = $this->get_email_form("-1", $item_id); - print $template; + $view = new View("contactowner_emailform.html"); + $view->sendmail_form = $this->get_email_form("-1", $item_id); + + print $view; } public function emailid($user_id, $item_id) { @@ -98,10 +98,11 @@ class ContactOwner_Controller extends Controller { } // Set up and display the actual page. - $template = new Theme_View("page.html", "other", "Contact"); - $template->content = new View("contactowner_emailform.html"); - $template->content->sendmail_form = $this->get_email_form($user_id, $item_id); - print $template; + // Set up and display the actual page. + $view = new View("contactowner_emailform.html"); + $view->sendmail_form = $this->get_email_form($user_id, $item_id); + + print $view; } public function sendemail($user_id) { @@ -154,18 +155,12 @@ class ContactOwner_Controller extends Controller { ->message($str_emailbody) ->send(); - // Display a message telling the visitor that their email has been sent. - $template = new Theme_View("page.html", "other", "Contact"); - $template->content = new View("contactowner_emailform.html"); - $template->content->sendmail_form = t("Your Message Has Been Sent."); - print $template; + message::info(t("Your Message Has Been Sent.")); + json::reply(array("result" => "success")); } else { // Set up and display the actual page. - $template = new Theme_View("page.html", "other", "Contact"); - $template->content = new View("contactowner_emailform.html"); - $template->content->sendmail_form = $form; - print $template; + json::reply(array("result" => "error", "html" => (string) $form)); } } } diff --git a/3.0/modules/contactowner/helpers/contactowner_block.php b/3.0/modules/contactowner/helpers/contactowner_block.php index b2c31500..c2629a56 100644 --- a/3.0/modules/contactowner/helpers/contactowner_block.php +++ b/3.0/modules/contactowner/helpers/contactowner_block.php @@ -53,7 +53,7 @@ class contactowner_block_Core { if ((count($userDetails) > 0) && ($userDetails[0]->email != "") && (module::get_var("contactowner", "contact_user_link") == true)) { $block->content->userLink = "item->owner_id) . "/" . $theme->item->id . "\">" . t("Contact") . " " . + $theme->item->owner_id) . "/" . $theme->item->id . "\" class='g-dialog-link'>" . t("Contact") . " " . $userDetails[0]->name . ""; $displayBlock = true; } @@ -63,10 +63,10 @@ class contactowner_block_Core { if (module::get_var("contactowner", "contact_owner_link")) { if ($theme->item()) { $block->content->ownerLink = "item->id . - "\">" . t(module::get_var("contactowner", "contact_button_text")) . ""; + "\" class='g-dialog-link'>" . t(module::get_var("contactowner", "contact_button_text")) . ""; } else { $block->content->ownerLink = "" . t(module::get_var("contactowner", "contact_button_text")) . ""; + "\" class='g-dialog-link'>" . t(module::get_var("contactowner", "contact_button_text")) . ""; } $displayBlock = true; } diff --git a/3.0/modules/contactowner/module.info b/3.0/modules/contactowner/module.info index e6995d27..70e9ef09 100644 --- a/3.0/modules/contactowner/module.info +++ b/3.0/modules/contactowner/module.info @@ -1,3 +1,7 @@ name = "ContactOwner" description = "Allows visitors to send the website owner an email." version = 2 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:contactowner" +discuss_url = "http://gallery.menalto.com/forum_module_contactowner" diff --git a/3.0/modules/content_warning/controllers/admin_content_warning.php b/3.0/modules/content_warning/controllers/admin_content_warning.php new file mode 100644 index 00000000..c03cf31d --- /dev/null +++ b/3.0/modules/content_warning/controllers/admin_content_warning.php @@ -0,0 +1,62 @@ +_get_view(); + } + + public function handler() { + access::verify_csrf(); + + $form = $this->_get_form(); + + if ($form->validate()) { + module::set_var("content_warning", "title", $form->content_warning->inputs["title"]->value); + module::set_var("content_warning", "message", $form->content_warning->inputs["message"]->value); + module::set_var("content_warning", "enter_link_text", $form->content_warning->inputs["enter_link_text"]->value); + //module::set_var("content_warning", "enter_link_url", $form->content_warning->inputs["enter_link_url"]->value); + module::set_var("content_warning", "exit_link_text", $form->content_warning->inputs["exit_link_text"]->value); + module::set_var("content_warning", "exit_link_url", $form->content_warning->inputs["exit_link_url"]->value); + url::redirect("admin/content_warning"); + } + print $this->_get_view($form); + } + + private function _get_view($form=null) { + $v = new Admin_View("admin.html"); + $v->content = new View("admin_content_warning.html"); + $v->content->form = empty($form) ? $this->_get_form() : $form; + return $v; + } + + private function _get_form() { + $form = new Forge("admin/content_warning/handler", "", "post", + array("id" => "gAdminContentWerning")); + $group = $form->group("content_warning"); + $group->input("title")->label(t('Title (Will be displayed within H3)'))->rules("required")->value(module::get_var("content_warning", "title")); + $group->textarea("message")->label(t('Message (you can use HTML tags)'))->rules("required")->value(module::get_var("content_warning", "message")); + $group->input("enter_link_text")->label(t('Enter Label'))->rules("required")->value(module::get_var("content_warning", "enter_link_text")); + //$group->input("enter_link_url")->label(t('Enter Url (Leave empty to redirect to the previous page)'))->value(module::get_var("content_warning", "enter_link_url")); + $group->input("exit_link_text")->label(t('Exit Label'))->rules("required")->value(module::get_var("content_warning", "exit_link_text")); + $group->input("exit_link_url")->label(t('Exit Url'))->rules("required")->value(module::get_var("content_warning", "exit_link_url")); + + $group->submit("submit")->value(t("Save")); + return $form; + } +} \ No newline at end of file diff --git a/3.0/modules/content_warning/controllers/content_warning.php b/3.0/modules/content_warning/controllers/content_warning.php new file mode 100644 index 00000000..1dc489fb --- /dev/null +++ b/3.0/modules/content_warning/controllers/content_warning.php @@ -0,0 +1,26 @@ +abs_url()); + } + } +} \ No newline at end of file diff --git a/3.0/modules/content_warning/css/jqModal.css b/3.0/modules/content_warning/css/jqModal.css new file mode 100644 index 00000000..d20b96ce --- /dev/null +++ b/3.0/modules/content_warning/css/jqModal.css @@ -0,0 +1,65 @@ +/* jqModal base Styling courtesy of; + Brice Burgess */ + +/* The Window's CSS z-index value is respected (takes priority). If none is supplied, + the Window's z-index value will be set to 3000 by default (via jqModal.js). */ + +.jqmWindow { + display: none; + position: fixed; + top: 5%; + left: 5%; + /*margin-left: -500px;*/ + width: 90%; + height: 90%; + background-color: #EEE; + color: #333; + border: 1px solid black; + padding: 12px; +} + +.jqmOverlay { + background-color: #000; +} + +/* Background iframe styling for IE6. Prevents ActiveX bleed-through (" type="application/x-shockwave-flash">" />" onclick="this.focus(); this.select();" readonly> - + file_url(true); + if (module::is_active("videos")) { + $items_video = ORM::factory("items_video") + ->where("item_id", "=", $item->id) + ->find(); + if ($items_video->loaded()) { + if (file_exists($item->resize_path() . ".flv")) { + $str_movie_path = str_replace("?m=", ".flv?m=", $item->resize_url(true)); + } else { + $str_movie_path = ""; + } + } + } + ?> + + + + " />width ?>" height="height ?>" src="" flashvars='config={"clip":""}'/>" onclick="this.focus(); this.select();" readonly> + + @@ -198,4 +215,4 @@ input[type="text"] { - \ No newline at end of file + diff --git a/3.0/modules/embedlinks/views/embedlinks_sidebar.html.php b/3.0/modules/embedlinks/views/embedlinks_sidebar.html.php index 21d8b7f3..0991382a 100644 --- a/3.0/modules/embedlinks/views/embedlinks_sidebar.html.php +++ b/3.0/modules/embedlinks/views/embedlinks_sidebar.html.php @@ -21,4 +21,4 @@ - \ No newline at end of file + diff --git a/3.0/modules/exif_gps/helpers/exif_gps_installer.php b/3.0/modules/exif_gps/helpers/exif_gps_installer.php index ef5c5645..9dc77968 100644 --- a/3.0/modules/exif_gps/helpers/exif_gps_installer.php +++ b/3.0/modules/exif_gps/helpers/exif_gps_installer.php @@ -65,6 +65,14 @@ class exif_gps_installer { site_status::clear("exif_gps_needs_exif"); } + static function can_activate() { + $messages = array(); + if (!module::is_active("exif")) { + $messages["warn"][] = t("The EXIF_GPS module requires the EXIF module."); + } + return $messages; + } + static function uninstall() { // Delete the GPS table before uninstalling. $db = Database::instance(); diff --git a/3.0/modules/exif_gps/module.info b/3.0/modules/exif_gps/module.info index 05a3aae3..ebde931e 100644 --- a/3.0/modules/exif_gps/module.info +++ b/3.0/modules/exif_gps/module.info @@ -1,3 +1,7 @@ name = "Exif GPS Data" description = "Extract Exif GPS data from photos." version = 2 +author_name = "rWatcher" +author_url = "http://codex.gallery2.org/User:RWatcher" +info_url = "http://codex.gallery2.org/Gallery3:Modules:exif_gps" +discuss_url = "http://gallery.menalto.com/node/94762" diff --git a/3.0/modules/exif_gps/views/exif_gps_dynamic2_sidebar.html.php b/3.0/modules/exif_gps/views/exif_gps_dynamic2_sidebar.html.php index 24b69acb..f4f95799 100644 --- a/3.0/modules/exif_gps/views/exif_gps_dynamic2_sidebar.html.php +++ b/3.0/modules/exif_gps/views/exif_gps_dynamic2_sidebar.html.php @@ -1,4 +1,8 @@ + - + diff --git a/3.0/modules/exif_gps/views/exif_gps_dynamic_sidebar.html.php b/3.0/modules/exif_gps/views/exif_gps_dynamic_sidebar.html.php index d5b497dc..ff28e101 100644 --- a/3.0/modules/exif_gps/views/exif_gps_dynamic_sidebar.html.php +++ b/3.0/modules/exif_gps/views/exif_gps_dynamic_sidebar.html.php @@ -19,4 +19,4 @@ google.setOnLoadCallback(initialize); - + diff --git a/3.0/modules/exif_gps/views/exif_gps_map.html.php b/3.0/modules/exif_gps/views/exif_gps_map.html.php index 6c8a59ee..95f6221c 100644 --- a/3.0/modules/exif_gps/views/exif_gps_map.html.php +++ b/3.0/modules/exif_gps/views/exif_gps_map.html.php @@ -62,14 +62,14 @@ infowindow.open(map,marker); }); - + // If there is a maximum auto-zoom value, then set up an event to check the zoom // level the first time it is changed, and adjust it if necessary. // (if we call map.getZoom right after .fitBounds, getZoom will return the initial // zoom level, not the auto zoom level, this way we get the auto zoomed value). google.maps.event.addListener(map, 'zoom_changed', function() { if (google_zoom_hack) { - if (map.getZoom() > 18) map.setZoom(18); + if (map.getZoom() > ) map.setZoom(); google_zoom_hack = false; } }); diff --git a/3.0/modules/export_facebook/module.info b/3.0/modules/export_facebook/module.info index 1f65154a..f7388b95 100644 --- a/3.0/modules/export_facebook/module.info +++ b/3.0/modules/export_facebook/module.info @@ -1,3 +1,7 @@ name = "export_facebook" description = "Export Photos from Gallery 3 to Facebook." version = 1 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:export_facebook" +discuss_url = "http://gallery.menalto.com/forum_module_export_facebook" diff --git a/3.0/modules/favourites/module.info b/3.0/modules/favourites/module.info index aa2df84a..a3d6b898 100644 --- a/3.0/modules/favourites/module.info +++ b/3.0/modules/favourites/module.info @@ -1,3 +1,7 @@ name = "Favourites" description = "Allows users and guests to create favourite lists and then e-mail them to people." version = 1 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:favourites" +discuss_url = "http://gallery.menalto.com/forum_module_favourites" diff --git a/3.0/modules/fittoscreen/controllers/admin_fittoscreen.php b/3.0/modules/fittoscreen/controllers/admin_fittoscreen.php new file mode 100644 index 00000000..3a8eb456 --- /dev/null +++ b/3.0/modules/fittoscreen/controllers/admin_fittoscreen.php @@ -0,0 +1,46 @@ +_get_view(); + } + + private function _get_view($form=null) { + $view = new Admin_View("admin.html"); + $view->page_title = t("Fit to Screen parameters"); + + $view->content = new View("admin_fittoscreen.html"); + $view->content->form = (empty($form) ? $this->_get_form() : $form) ; + + return $view; + } + + private function _get_form() { + $form = new Forge("admin/fittoscreen/save", "", "post", array("id" => "g-admin-form")); + + $form->dropdown("width_unit")->label(t("Image width unit"))->options(array("px"=>"pixel margin","pr"=>"max pourcentage"))->selected(module::get_var("fittoscreen", "width_unit")); + $form->input("width")->label(t('width'))->rules("required|valid_numeric|length[1,5]")->value(module::get_var("fittoscreen", "width")); + $form->dropdown("height_unit")->label(t("Image height unit"))->options(array("px"=>"pixel margin","pr"=>"max pourcentage"))->selected(module::get_var("fittoscreen", "height_unit")); + $form->input("height")->label(t('height'))->rules("required|valid_numeric|length[1,5]")->value(module::get_var("fittoscreen", "height")); + + $form->submit("submit")->value(t("Save")); + return $form; + } + + public function save(){ + access::verify_csrf(); + + $form = $this->_get_form(); + if ($form->validate()) { + module::set_var("fittoscreen", "width_unit", $form->width_unit->value); + module::set_var("fittoscreen", "width", $form->width->value); + module::set_var("fittoscreen", "height_unit", $form->height_unit->value); + module::set_var("fittoscreen", "height", $form->height->value); + + } + + print $this->_get_view($form); + } +} + +?> diff --git a/3.0/modules/fittoscreen/helpers/fittoscreen_event.php b/3.0/modules/fittoscreen/helpers/fittoscreen_event.php new file mode 100644 index 00000000..5dbe65f7 --- /dev/null +++ b/3.0/modules/fittoscreen/helpers/fittoscreen_event.php @@ -0,0 +1,13 @@ +get("settings_menu") + ->append(Menu::factory("link") + ->id("fittoscreen_menu") + ->label(t("Fit to Screen")) + ->url(url::site("admin/fittoscreen"))); + } +} + +?> diff --git a/3.0/modules/fittoscreen/helpers/fittoscreen_installer.php b/3.0/modules/fittoscreen/helpers/fittoscreen_installer.php new file mode 100644 index 00000000..0e4b7ec0 --- /dev/null +++ b/3.0/modules/fittoscreen/helpers/fittoscreen_installer.php @@ -0,0 +1,14 @@ + + diff --git a/3.0/modules/fittoscreen/helpers/fittoscreen_theme.php b/3.0/modules/fittoscreen/helpers/fittoscreen_theme.php new file mode 100644 index 00000000..de804e95 --- /dev/null +++ b/3.0/modules/fittoscreen/helpers/fittoscreen_theme.php @@ -0,0 +1,9 @@ + diff --git a/3.0/modules/fittoscreen/module.info b/3.0/modules/fittoscreen/module.info new file mode 100644 index 00000000..39067339 --- /dev/null +++ b/3.0/modules/fittoscreen/module.info @@ -0,0 +1,7 @@ +name = "Fit to Screen" +description = "Dynamicaly resize the photo size to fit the screen.
Version 1.0 | By Matthieu Bouthors | Visit plugin Site | Support | Settings" +version = 10 +author_name = "Matthieu Bouthors" +author_url = "http://www.bouthors.fr" +info_url = "http://codex.gallery2.org/Gallery3:Modules:Fittoscreen" +discuss_url = "http://gallery.menalto.com/node/103929" diff --git a/3.0/modules/fittoscreen/views/admin_fittoscreen.html.php b/3.0/modules/fittoscreen/views/admin_fittoscreen.html.php new file mode 100644 index 00000000..dffd8e8d --- /dev/null +++ b/3.0/modules/fittoscreen/views/admin_fittoscreen.html.php @@ -0,0 +1,7 @@ + +
+

+
+ +
+
diff --git a/3.0/modules/fittoscreen/views/fittoscreen_photo.html.php b/3.0/modules/fittoscreen/views/fittoscreen_photo.html.php new file mode 100644 index 00000000..762a588d --- /dev/null +++ b/3.0/modules/fittoscreen/views/fittoscreen_photo.html.php @@ -0,0 +1,35 @@ + + + diff --git a/3.0/modules/gmaps/module.info b/3.0/modules/gmaps/module.info index 12dd61d4..e524eb69 100644 --- a/3.0/modules/gmaps/module.info +++ b/3.0/modules/gmaps/module.info @@ -1,3 +1,7 @@ name = "Google Maps" description = "Integrate with the Google Maps service" version = 1 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:gmaps" +discuss_url = "http://gallery.menalto.com/forum_module_gmaps" diff --git a/3.0/modules/google_analytics/module.info b/3.0/modules/google_analytics/module.info index 6d42bf4b..ca5a51e3 100644 --- a/3.0/modules/google_analytics/module.info +++ b/3.0/modules/google_analytics/module.info @@ -1,3 +1,7 @@ name = "Google Analytics" description = "Renders the Google Analytics Code at the end of the page. Written by 'mcp'." version = 2 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:google_analytics" +discuss_url = "http://gallery.menalto.com/forum_module_google_analytics" diff --git a/3.0/modules/gwtorganize/module.info b/3.0/modules/gwtorganize/module.info index 33a4f797..c56c0976 100644 --- a/3.0/modules/gwtorganize/module.info +++ b/3.0/modules/gwtorganize/module.info @@ -1,3 +1,7 @@ name = "GWT Organise" description = "An alternative to organise and simple uploader making use of funky google technology." version = 1 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:gwtorganize" +discuss_url = "http://gallery.menalto.com/forum_module_gwtorganize" diff --git a/3.0/modules/hide/module.info b/3.0/modules/hide/module.info index 0daf9f50..12fc3041 100644 --- a/3.0/modules/hide/module.info +++ b/3.0/modules/hide/module.info @@ -1,3 +1,7 @@ name = "Hide" description = "Allows admins to hide some items from everyone but a given group." version = 1 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:hide" +discuss_url = "http://gallery.menalto.com/forum_module_hide" diff --git a/3.0/modules/highroller/module.info b/3.0/modules/highroller/module.info index 9b573a98..7b89e9cb 100644 --- a/3.0/modules/highroller/module.info +++ b/3.0/modules/highroller/module.info @@ -1,3 +1,7 @@ name = "High Roller" description = "Let users choose from a selection of ThemeRoller themes" version = 1 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:highroller" +discuss_url = "http://gallery.menalto.com/forum_module_highroller" diff --git a/3.0/modules/html_uploader/module.info b/3.0/modules/html_uploader/module.info index f3dc5dc8..de2becbb 100644 --- a/3.0/modules/html_uploader/module.info +++ b/3.0/modules/html_uploader/module.info @@ -1,3 +1,7 @@ name = "HTML Uploader" description = "Simple HTML uploader that replaces the Flash based uploader" version = 1 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:html_uploader" +discuss_url = "http://gallery.menalto.com/forum_module_html_uploader" diff --git a/3.0/modules/iptc/module.info b/3.0/modules/iptc/module.info index 4cf38649..65060f87 100644 --- a/3.0/modules/iptc/module.info +++ b/3.0/modules/iptc/module.info @@ -1,3 +1,7 @@ name = "Iptc Data" description = "Extract Iptc data and display it on photo pages." version = 2 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:iptc" +discuss_url = "http://gallery.menalto.com/forum_module_iptc" diff --git a/3.0/modules/item_links/helpers/item_links_event.php b/3.0/modules/item_links/helpers/item_links_event.php new file mode 100644 index 00000000..12cc94a1 --- /dev/null +++ b/3.0/modules/item_links/helpers/item_links_event.php @@ -0,0 +1,58 @@ +where("item_id", "=", $item->id) + ->find_all(); + + $existing_url = ""; + if (count($item_url) > 0) { + $existing_url = $item_url[0]->url; + } + $form->edit_item + ->input("item_links_url") + ->label(t("Redirect to URL:")) + ->value($existing_url); + } + + static function item_deleted($item) { + // Whenever an item is deleted, delete any corresponding data. + db::build()->delete("item_links")->where("item_id", "=", $item->id)->execute(); + } + + static function item_edit_form_completed($item, $form) { + // Update the database with any changes to the item_links field. + $record = ORM::factory("item_link")->where("item_id", "=", $item->id)->find(); + + if ($form->edit_item->item_links_url->value != "") { + if (!$record->loaded()) { + $record->item_id = $item->id; + } + $record->url = $form->edit_item->item_links_url->value; + $record->save(); + } else { + db::build()->delete("item_links")->where("item_id", "=", $item->id)->execute(); + } + } +} diff --git a/3.0/modules/item_links/helpers/item_links_installer.php b/3.0/modules/item_links/helpers/item_links_installer.php new file mode 100644 index 00000000..f9d34d98 --- /dev/null +++ b/3.0/modules/item_links/helpers/item_links_installer.php @@ -0,0 +1,34 @@ +query("CREATE TABLE IF NOT EXISTS {item_links} ( + `id` int(9) NOT NULL auto_increment, + `item_id` int(9) NOT NULL, + `url` text default NULL, + PRIMARY KEY (`id`), + KEY(`item_id`, `id`)) + DEFAULT CHARSET=utf8;"); + + // Set the module's version number. + module::set_version("item_links", 1); + } +} diff --git a/3.0/modules/item_links/helpers/item_links_theme.php b/3.0/modules/item_links/helpers/item_links_theme.php new file mode 100644 index 00000000..fbfcbb45 --- /dev/null +++ b/3.0/modules/item_links/helpers/item_links_theme.php @@ -0,0 +1,34 @@ +item()) { + $item_url = ORM::factory("item_link") + ->where("item_id", "=", $theme->item->id) + ->find_all(); + if (count($item_url) > 0) { + url::redirect($item_url[0]->url); + } + } + return; + } +} diff --git a/3.0/modules/videos/models/videos_file.php b/3.0/modules/item_links/models/item_link.php similarity index 95% rename from 3.0/modules/videos/models/videos_file.php rename to 3.0/modules/item_links/models/item_link.php index 07beccda..65335e27 100644 --- a/3.0/modules/videos/models/videos_file.php +++ b/3.0/modules/item_links/models/item_link.php @@ -17,5 +17,5 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class Videos_File_Model extends ORM { +class Item_Link_Model extends ORM { } diff --git a/3.0/modules/item_links/module.info b/3.0/modules/item_links/module.info new file mode 100644 index 00000000..e53131b1 --- /dev/null +++ b/3.0/modules/item_links/module.info @@ -0,0 +1,7 @@ +name = "Item Links" +description = "Allows users to use Gallery items as links to external URLs." +version = 1 +author_name = "rWatcher" +author_url = "http://codex.gallery2.org/User:RWatcher" +info_url = "http://codex.gallery2.org/Gallery3:Modules:item_links" +discuss_url = "http://gallery.menalto.com/node/102548" diff --git a/3.0/modules/itemchecksum/module.info b/3.0/modules/itemchecksum/module.info index 0dda6880..d56f7b20 100644 --- a/3.0/modules/itemchecksum/module.info +++ b/3.0/modules/itemchecksum/module.info @@ -1,3 +1,7 @@ name = "ItemChecksum" description = "Display's a photo or video's MD5 and SHA-1 checksum." version = 1 +author_name = "rWatcher" +author_url = "http://codex.gallery2.org/User:RWatcher" +info_url = "http://codex.gallery2.org/Gallery3:Modules:itemchecksum" +discuss_url = "http://gallery.menalto.com/node/90270" diff --git a/3.0/modules/jhead/module.info b/3.0/modules/jhead/module.info index 233ae064..ea0de472 100644 --- a/3.0/modules/jhead/module.info +++ b/3.0/modules/jhead/module.info @@ -1,3 +1,7 @@ name = "jhead Autorotation" description = "Invoke jhead to rotate images according to Exif orientation tag." version = 1 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:jhead" +discuss_url = "http://gallery.menalto.com/forum_module_jhead" diff --git a/3.0/modules/keeporiginal/helpers/keeporiginal_event.php b/3.0/modules/keeporiginal/helpers/keeporiginal_event.php index 8febcb35..f9356571 100644 --- a/3.0/modules/keeporiginal/helpers/keeporiginal_event.php +++ b/3.0/modules/keeporiginal/helpers/keeporiginal_event.php @@ -20,13 +20,16 @@ class keeporiginal_event_Core { static function graphics_rotate($input_file, $output_file, $options) { // Make a copy of the original fullsized image before rotating it. + keeporiginal_event_Core::_preserve($input_file); + } + static function _preserve($input_file) { // If $input_file is located in VARPATH/albums/ then assume its a fullsize photo. if (strncmp($input_file, VARPATH . "albums/", strlen(VARPATH . "albums/")) == 0) { // Figure out where the original copy should be stashed at. $temp_path = str_replace(VARPATH . "albums/", "", $input_file); $original_image = VARPATH . "original/" . $temp_path; - $individual_dirs = split("[/\]", "original/" . $temp_path); + $individual_dirs = preg_split("|[/\\\\]|", "original/" . $temp_path); // If any original file does not already exist, then create a folder structure // similar to that found in VARPATH/albums/ and copy the photo over before // rotating it. @@ -71,6 +74,10 @@ class keeporiginal_event_Core { // VARPATH/original/ as well. if ($old->is_photo() || $old->is_album()) { + $data_file = $new->data_file; + if (isset($data_file)) { + keeporiginal_event_Core::_preserve($old->file_path()); + } if ($old->file_path() != $new->file_path()) { $old_original = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $old->file_path()); $new_original = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $new->file_path()); @@ -105,6 +112,7 @@ class keeporiginal_event_Core { } // Move the file to its new location. + // TODO: If the files have different extensions, then the old extension should be preserved. @rename($old_original, $new_original); } } diff --git a/3.0/modules/keeporiginal/module.info b/3.0/modules/keeporiginal/module.info index c665bd69..5c7b180b 100644 --- a/3.0/modules/keeporiginal/module.info +++ b/3.0/modules/keeporiginal/module.info @@ -1,3 +1,7 @@ name = "Keep Original" description = "Make a copy of the original photo before rotating it." version = 1 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:keeporiginal" +discuss_url = "http://gallery.menalto.com/forum_module_keeporiginal" diff --git a/3.0/modules/language_flags/module.info b/3.0/modules/language_flags/module.info index d0838d10..d0ce676b 100644 --- a/3.0/modules/language_flags/module.info +++ b/3.0/modules/language_flags/module.info @@ -1,3 +1,7 @@ name = "Language Flags" description = "Replaces the language selection drop-down box with clickable flags." -version = 1 \ No newline at end of file +version = 1 +author_name = "rWatcher" +author_url = "http://codex.gallery2.org/User:RWatcher" +info_url = "http://codex.gallery2.org/Gallery3:Modules:language_flags" +discuss_url = "http://gallery.menalto.com/node/94647" diff --git a/3.0/modules/latestalbums/module.info b/3.0/modules/latestalbums/module.info index ae1d4dde..9c78cc31 100644 --- a/3.0/modules/latestalbums/module.info +++ b/3.0/modules/latestalbums/module.info @@ -1,3 +1,7 @@ name = "Latest Albums" description = "Display recently created albums." version = 1 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:latestalbums" +discuss_url = "http://gallery.menalto.com/forum_module_latestalbums" diff --git a/3.0/modules/latestupdates/module.info b/3.0/modules/latestupdates/module.info index 9f5d518d..a4916cd6 100644 --- a/3.0/modules/latestupdates/module.info +++ b/3.0/modules/latestupdates/module.info @@ -1,3 +1,7 @@ name = "LatestUpdates" description = "Display recently uploaded photos and videos." version = 1 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:latestupdates" +discuss_url = "http://gallery.menalto.com/forum_module_latestupdates" diff --git a/3.0/modules/ldap/module.info b/3.0/modules/ldap/module.info index 06fa311b..96785139 100644 --- a/3.0/modules/ldap/module.info +++ b/3.0/modules/ldap/module.info @@ -1,3 +1,7 @@ name = "LDAP" description = "Use LDAP for authentication" version = 1 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:ldap" +discuss_url = "http://gallery.menalto.com/forum_module_ldap" diff --git a/3.0/modules/metadescription/helpers/metadescription_event.php b/3.0/modules/metadescription/helpers/metadescription_event.php index 5fedfa11..7e773d7e 100644 --- a/3.0/modules/metadescription/helpers/metadescription_event.php +++ b/3.0/modules/metadescription/helpers/metadescription_event.php @@ -31,4 +31,10 @@ class metadescription_event_Core { site_status::clear("metadescription_needs_tag"); } } + + static function pre_deactivate($data) { + if ($data->module == "tag") { + $data->messages["warn"][] = t("The MetaDescription module requires the Tags module."); + } + } } diff --git a/3.0/modules/metadescription/helpers/metadescription_installer.php b/3.0/modules/metadescription/helpers/metadescription_installer.php index 6d7d540c..6609ecd9 100644 --- a/3.0/modules/metadescription/helpers/metadescription_installer.php +++ b/3.0/modules/metadescription/helpers/metadescription_installer.php @@ -28,6 +28,14 @@ class metadescription_installer { site_status::clear("metadescription_needs_tag"); } + static function can_activate() { + $messages = array(); + if (!module::is_active("tag")) { + $messages["warn"][] = t("The MetaDescription module requires the Tags module."); + } + return $messages; + } + static function uninstall() { module::delete("metadescription"); } diff --git a/3.0/modules/metadescription/helpers/metadescription_theme.php b/3.0/modules/metadescription/helpers/metadescription_theme.php index 72ef29d0..2952e10a 100644 --- a/3.0/modules/metadescription/helpers/metadescription_theme.php +++ b/3.0/modules/metadescription/helpers/metadescription_theme.php @@ -42,7 +42,7 @@ class metadescription_theme_Core { // Load the meta tags into the top of the page. // @todo: metadescription_block.html requires an item so for now, don't render it unless we // have one. - if ($theme->item()) { + if ($theme->item() || $theme->tag()) { $metaView = new View("metadescription_block.html"); $metaView->tags = $tagsItem; return $metaView; diff --git a/3.0/modules/metadescription/module.info b/3.0/modules/metadescription/module.info index 19c2cd48..7010a0d1 100644 --- a/3.0/modules/metadescription/module.info +++ b/3.0/modules/metadescription/module.info @@ -1,3 +1,7 @@ name = "MetaDescription" description = "Automatically generates and inserts KEYWORD and DESCRIPTION meta tags into any theme." version = 1 +author_name = "rWatcher" +author_url = "http://codex.gallery2.org/User:RWatcher" +info_url = "http://codex.gallery2.org/Gallery3:Modules:metadescription" +discuss_url = "http://gallery.menalto.com/node/102477" diff --git a/3.0/modules/minislideshow/controllers/admin_minislideshow.php b/3.0/modules/minislideshow/controllers/admin_minislideshow.php index dfd008fe..f66a495a 100644 --- a/3.0/modules/minislideshow/controllers/admin_minislideshow.php +++ b/3.0/modules/minislideshow/controllers/admin_minislideshow.php @@ -76,7 +76,6 @@ class Admin_Minislideshow_Controller extends Admin_Controller { $form = new Forge("admin/minislideshow/saveprefs", "", "post", array("id" => "g-mini-slideshow-admin-form")); - // Get location of slideshow files. $group_slideshow_files = $form->group("Minislideshow"); $group_slideshow_files->input("slideshow_url") @@ -124,4 +123,4 @@ class Admin_Minislideshow_Controller extends Admin_Controller { // Return the newly generated form. return $form; } -} \ No newline at end of file +} diff --git a/3.0/modules/minislideshow/css/minislideshow_menu.css b/3.0/modules/minislideshow/css/minislideshow_menu.css index 19d5e414..d1f5271f 100644 --- a/3.0/modules/minislideshow/css/minislideshow_menu.css +++ b/3.0/modules/minislideshow/css/minislideshow_menu.css @@ -1,4 +1,3 @@ #g-view-menu #g-mini-slideshow-link { background-image: url('../images/ico-view-minislideshow.png'); } - diff --git a/3.0/modules/minislideshow/helpers/minislideshow_event.php b/3.0/modules/minislideshow/helpers/minislideshow_event.php index 6d88569a..a4f76361 100644 --- a/3.0/modules/minislideshow/helpers/minislideshow_event.php +++ b/3.0/modules/minislideshow/helpers/minislideshow_event.php @@ -41,6 +41,12 @@ class minislideshow_event_Core { } } + static function pre_deactivate($data) { + if ($data->module == "rss") { + $data->messages["warn"][] = t("The MiniSlide Show module requires the RSS module."); + } + } + static function album_menu($menu, $theme) { // Add an option to access the slideshow from the album view. $menu diff --git a/3.0/modules/minislideshow/helpers/minislideshow_installer.php b/3.0/modules/minislideshow/helpers/minislideshow_installer.php index da071844..3edcf98a 100644 --- a/3.0/modules/minislideshow/helpers/minislideshow_installer.php +++ b/3.0/modules/minislideshow/helpers/minislideshow_installer.php @@ -22,4 +22,12 @@ class minislideshow_installer { static function deactivate() { site_status::clear("minislideshow_needs_rss"); } + + static function can_activate() { + $messages = array(); + if (!module::is_active("rss")) { + $messages["warn"][] = t("The MiniSlide Show module requires the RSS module."); + } + return $messages; + } } diff --git a/3.0/modules/minislideshow/helpers/minislideshow_theme.php b/3.0/modules/minislideshow/helpers/minislideshow_theme.php index 266452e0..ee724bcc 100644 --- a/3.0/modules/minislideshow/helpers/minislideshow_theme.php +++ b/3.0/modules/minislideshow/helpers/minislideshow_theme.php @@ -20,10 +20,6 @@ class minislideshow_theme_Core { static function head($theme) { - if (!$theme->item()) { - return; - } - - return new View("minislideshow_header_block.html"); + return $theme->css("minislideshow_menu.css"); } } diff --git a/3.0/modules/minislideshow/module.info b/3.0/modules/minislideshow/module.info index a64a54e2..923b02d5 100644 --- a/3.0/modules/minislideshow/module.info +++ b/3.0/modules/minislideshow/module.info @@ -1,3 +1,7 @@ name = "MiniSlide Show" description = "Display MiniSlide Show on your Gallery." version = 1 +author_name = "rWatcher" +author_url = "http://codex.gallery2.org/User:RWatcher" +info_url = "http://codex.gallery2.org/Gallery3:Modules:minislideshow" +discuss_url = "http://gallery.menalto.com/node/90362" diff --git a/3.0/modules/minislideshow/views/minislideshow_dialog.html.php b/3.0/modules/minislideshow/views/minislideshow_dialog.html.php index c9507594..9ae60c0b 100644 --- a/3.0/modules/minislideshow/views/minislideshow_dialog.html.php +++ b/3.0/modules/minislideshow/views/minislideshow_dialog.html.php @@ -15,4 +15,4 @@ flashvars="xmlUrl= Embed: " width="485" height="300" align="middle" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="minislide" wmode="transparent" allowFullscreen="true" allowScriptAccess="always" quality="high" flashvars="xmlUrl=">" readonly> -
\ No newline at end of file + diff --git a/3.0/modules/minislideshow/views/minislideshow_header_block.html.php b/3.0/modules/minislideshow/views/minislideshow_header_block.html.php deleted file mode 100644 index c52d0117..00000000 --- a/3.0/modules/minislideshow/views/minislideshow_header_block.html.php +++ /dev/null @@ -1,5 +0,0 @@ - - -" /> - - diff --git a/3.0/modules/moduleorder/module.info b/3.0/modules/moduleorder/module.info index 108e813d..c6379871 100644 --- a/3.0/modules/moduleorder/module.info +++ b/3.0/modules/moduleorder/module.info @@ -1,3 +1,7 @@ name = "Module Order" description = "Allows you to change the order in which modules are executed" version = 1 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:moduleorder" +discuss_url = "http://gallery.menalto.com/forum_module_moduleorder" diff --git a/3.0/modules/moduleupdates/controllers/admin_moduleupdates.php b/3.0/modules/moduleupdates/controllers/admin_moduleupdates.php index a469fe67..72ec5112 100755 --- a/3.0/modules/moduleupdates/controllers/admin_moduleupdates.php +++ b/3.0/modules/moduleupdates/controllers/admin_moduleupdates.php @@ -39,6 +39,9 @@ class Admin_Moduleupdates_Controller extends Admin_Controller { */ public function index() { + //Start execution timer + $bgtime=time(); + $view = new Admin_View("admin.html"); $view->page_title = t("Gallery 3 :: Manage Module Updates"); $view->content = new View("admin_moduleupdates.html"); @@ -111,10 +114,12 @@ class Admin_Moduleupdates_Controller extends Admin_Controller { $font_color_local = $this->get_local_module_version_color ($module_info->version, $module_info->code_version); list ($core_version, $core_server) = $this->get_remote_module_version($this_module_name, "CORE"); $font_color_core = $this->get_module_version_color ($module_info->version, $module_info->code_version, $core_version); - list ($contrib_version, $contrib_server) = $this->get_remote_module_version($this_module_name, "CONTRIB"); - $font_color_contrib = $this->get_module_version_color ($module_info->version, $module_info->code_version, $contrib_version); - list ($gh_version, $gh_server) = $this->get_remote_module_version($this_module_name, "GH"); - $font_color_gh = $this->get_module_version_color ($module_info->version, $module_info->code_version, $gh_version); + if(!is_numeric($core_version)) { + list ($contrib_version, $contrib_server) = $this->get_remote_module_version($this_module_name, "CONTRIB"); + $font_color_contrib = $this->get_module_version_color ($module_info->version, $module_info->code_version, $contrib_version); + list ($gh_version, $gh_server) = $this->get_remote_module_version($this_module_name, "GH"); + $font_color_gh = $this->get_module_version_color ($module_info->version, $module_info->code_version, $gh_version); + } if($font_color_core == "red" or $font_color_contrib == "red" or $font_color_gh == "red"){ $update_count++; @@ -174,6 +179,20 @@ class Admin_Moduleupdates_Controller extends Admin_Controller { $view->content->GitHub = $GitHub; $view->content->Gallery_Version = substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")); + //End execution timer + $ExecutionTime = (time()-$bgtime); + if ($ExecutionTime < 1) { + $ExecutionTime = '1'; + }else if ($ExecutionTime <= 30){ + $ExecutionTime = '' . $ExecutionTime . ''; + }else if ($ExecutionTime <= 60){ + $ExecutionTime = '' . $ExecutionTime . ''; + }else{ + $ExecutionTime = '' . $ExecutionTime . ''; + } + + + $view->content->ExecutionTime = $ExecutionTime; print $view; } @@ -252,13 +271,24 @@ class Admin_Moduleupdates_Controller extends Admin_Controller { //Check the Gallery3 Community Contributions GitHub if ($file == null) { try { + $thisInstalledVersion = gallery::VERSION; + //Gallery versions prior to 3.0.2 contained the codename in the version string + if (substr_count($thisInstalledVersion, ' ') > 0 ){ + $thisInstalledVersion = substr_replace($thisInstalledVersion,"",strpos($thisInstalledVersion," ")); + } + //Truncate the minor version number + if (substr_count($thisInstalledVersion, '.') > 1 ){ + $thisInstalledVersion = substr_replace($thisInstalledVersion,"",strripos($thisInstalledVersion,".")); + } $file = fopen ("http://github.com/gallery/gallery3-contrib/raw/master/". - substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," "))."/modules/".$module_name."/module.info", "r"); + $thisInstalledVersion ."/modules/".$module_name."/module.info", "r"); + if ($file != null) { $server = '(GCC)'; } } catch (Exception $e) { + //echo 'Message: ' .$e->getMessage() . '
'; } } break; @@ -303,6 +333,9 @@ class Admin_Moduleupdates_Controller extends Admin_Controller { if($line == "Not entered" or $line == "See git") { $line = ""; } + if (substr_count($line, '.') > 0) { + $line = str_replace('.','',$line); + } $version = $line; break; } else { diff --git a/3.0/modules/moduleupdates/helpers/moduleupdates_installer.php b/3.0/modules/moduleupdates/helpers/moduleupdates_installer.php index 1e60a2cb..85f90489 100644 --- a/3.0/modules/moduleupdates/helpers/moduleupdates_installer.php +++ b/3.0/modules/moduleupdates/helpers/moduleupdates_installer.php @@ -24,7 +24,7 @@ class moduleupdates_installer { $version = module::get_version("moduleupdates"); if ($version < 1) { - module::set_version("moduleupdates", 7); + module::set_version("moduleupdates", 8); //Remove the ModuleUpdates cache entry 'JIC' Cache::instance()->delete("ModuleUpdates"); //create the blank ModuleUpdates cache entry with an expiration of 0 days @@ -34,7 +34,7 @@ class moduleupdates_installer { } static function upgrade($version) { - module::set_version("moduleupdates", 7); + module::set_version("moduleupdates", 8); //Remove the ModuleUpdates cache entry 'JIC' Cache::instance()->delete("ModuleUpdates"); //Empty the ModuleUpdates cache entry so our new version starts from scratch diff --git a/3.0/modules/moduleupdates/module.info b/3.0/modules/moduleupdates/module.info index bbf3516a..7c73c340 100755 --- a/3.0/modules/moduleupdates/module.info +++ b/3.0/modules/moduleupdates/module.info @@ -1,3 +1,7 @@ -name = "Module Updates" +name = "ModuleUpdates" description = "Compares your installed module version against the ones stored in the GitHub." -version = 7 \ No newline at end of file +version = 8 +author_name = "brentil" +author_url = "http://gallery.menalto.com/user/153736" +info_url = "http://codex.gallery2.org/Gallery3:Modules:moduleupdates" +discuss_url = "http://gallery.menalto.com/node/96574" diff --git a/3.0/modules/moduleupdates/views/admin_moduleupdates.html.php b/3.0/modules/moduleupdates/views/admin_moduleupdates.html.php index e55ed7af..18ff31ed 100644 --- a/3.0/modules/moduleupdates/views/admin_moduleupdates.html.php +++ b/3.0/modules/moduleupdates/views/admin_moduleupdates.html.php @@ -2,7 +2,7 @@
-

+

@@ -16,7 +16,7 @@
  • Green = Your version is newer than the GitHub
    ") ?>
  • Orange = Your file version is newer than the installed version
    ") ?>
  • Pink = Your installed version is newer than file version
    ") ?>
  • -
  • ") ?>
  • +
  • ") ?>
  • " class="submit" />
  • diff --git a/3.0/modules/navcarousel/module.info b/3.0/modules/navcarousel/module.info index 0dd8e5ff..f4c7bf3d 100644 --- a/3.0/modules/navcarousel/module.info +++ b/3.0/modules/navcarousel/module.info @@ -1,3 +1,7 @@ name = "Navigation Carousel" description = "Adds a navigation carousel under the photo." version = 4 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:navcarousel" +discuss_url = "http://gallery.menalto.com/forum_module_navcarousel" diff --git a/3.0/modules/no_home_link/module.info b/3.0/modules/no_home_link/module.info index 32b0d337..fc3aa1db 100644 --- a/3.0/modules/no_home_link/module.info +++ b/3.0/modules/no_home_link/module.info @@ -1,3 +1,7 @@ name = "No Home Link" description = "Gets rid of the 'Home' link in the menu." version = 1 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:no_home_link" +discuss_url = "http://gallery.menalto.com/forum_module_no_home_link" diff --git a/3.0/modules/nobots/module.info b/3.0/modules/nobots/module.info index 0f706f43..74f9bb3c 100644 --- a/3.0/modules/nobots/module.info +++ b/3.0/modules/nobots/module.info @@ -1,3 +1,7 @@ name = "NoBots" description = "Block web crawlers from indexing your Gallery." version = 1 +author_name = "rWatcher" +author_url = "http://codex.gallery2.org/User:RWatcher" +info_url = "http://codex.gallery2.org/Gallery3:Modules:nobots" +discuss_url = "http://gallery.menalto.com/node/88451" diff --git a/3.0/modules/noffmpeg/helpers/movie.php b/3.0/modules/noffmpeg/helpers/movie.php index a42804d2..99308994 100644 --- a/3.0/modules/noffmpeg/helpers/movie.php +++ b/3.0/modules/noffmpeg/helpers/movie.php @@ -24,6 +24,7 @@ * Note: by design, this class does not do any permission checking. */ +// rWatcher edit: include MP4Info.php library. include MODPATH . "noffmpeg/libraries/MP4Info.php"; class movie_Core { @@ -61,7 +62,7 @@ class movie_Core { } static function extract_frame($input_file, $output_file) { - $ffmpeg = self::find_ffmpeg(); + $ffmpeg = movie::find_ffmpeg(); if (empty($ffmpeg)) { // BEGIN rWatcher Edit. copy(MODPATH . "noffmpeg/images/missing_movie.png", $output_file); @@ -89,27 +90,23 @@ class movie_Core { } } + /** + * Return the path to the ffmpeg binary if one exists and is executable, or null. + */ static function find_ffmpeg() { if (!($ffmpeg_path = module::get_var("gallery", "ffmpeg_path")) || !file_exists($ffmpeg_path)) { - $graphics_path = module::get_var("gallery", "graphics_toolkit_path", null); - - putenv("PATH=" . getenv("PATH") . (empty($graphics_path) ? "" : ":$graphics_path") . - ":/usr/local/bin:/opt/local/bin:/opt/bin"); - if (function_exists("exec")) { - $ffmpeg_path = exec("which ffmpeg"); - } - + $ffmpeg_path = system::find_binary( + "ffmpeg", module::get_var("gallery", "graphics_toolkit_path")); module::set_var("gallery", "ffmpeg_path", $ffmpeg_path); } return $ffmpeg_path; } - /** * Return the width, height, mime_type and extension of the given movie file. */ static function get_file_metadata($file_path) { - $ffmpeg = self::find_ffmpeg(); + $ffmpeg = movie::find_ffmpeg(); if (empty($ffmpeg)) { // BEGIN rWatcher Edit. $pi = pathinfo($file_path); @@ -147,4 +144,4 @@ class movie_Core { return array($width, $height, $mime_type, $extension); } -} +} \ No newline at end of file diff --git a/3.0/modules/noffmpeg/module.info b/3.0/modules/noffmpeg/module.info index c11f0853..fe6b0ec3 100644 --- a/3.0/modules/noffmpeg/module.info +++ b/3.0/modules/noffmpeg/module.info @@ -1,3 +1,7 @@ name = "NoFFMPEG" description = "Allow video uploads on systems without FFMPEG." version = 1 +author_name = "" +author_url = "" +info_url = "http://codex.gallery2.org/Gallery3:Modules:noffmpeg" +discuss_url = "http://gallery.menalto.com/forum_module_noffmpeg" diff --git a/3.0/modules/noffmpeg/views/form_uploadify.html.php b/3.0/modules/noffmpeg/views/form_uploadify.html.php new file mode 100644 index 00000000..911e02d5 --- /dev/null +++ b/3.0/modules/noffmpeg/views/form_uploadify.html.php @@ -0,0 +1,164 @@ + + + + + +
    + admin && !$movies_allowed)): ?> +
    + +

    + suhosin.session.encrypt setting from Suhosin. You must disable this setting to upload photos.", + array("encrypt_url" => "http://www.hardened-php.net/suhosin/configuration.html#suhosin.session.encrypt", + "suhosin_url" => "http://www.hardened-php.net/suhosin/")) ?> +

    + + + admin && !$movies_allowed): ?> +

    + ffmpeg on your system. Movie uploading disabled. Help!", array("help_url" => "http://codex.gallery2.org/Gallery3:FAQ#Why_does_it_say_I.27m_missing_ffmpeg.3F")) ?> +

    + +
    + + +
    +

    + +

    +
      + parents() as $i => $parent): ?> + > title) ?> + +
    • title) ?>
    • +
    +
    + +
    + + +
    +
    +
      +
    +
    +
    + + \ No newline at end of file diff --git a/3.0/modules/pages/controllers/admin_pages.php b/3.0/modules/pages/controllers/admin_pages.php new file mode 100644 index 00000000..cbf8ce6e --- /dev/null +++ b/3.0/modules/pages/controllers/admin_pages.php @@ -0,0 +1,271 @@ +page_title = t("Manage pages"); + $view->content = new View("admin_pages.html"); + $query = ORM::factory("static_page"); + $view->content->pages = $query->order_by("name", "ASC")->find_all(); + $view->content->form = $this->get_prefs_form(); + print $view; + } + + public function createpage() { + // Display a form for creating a new page. + $view = new Admin_View("admin.html"); + $view->page_title = t("Create page"); + $view->content = new View("admin_pages_new.html"); + $view->content->form = $this->get_new_page_form(); + print $view; + } + + public function editpage($id) { + // Display a form for editing an existing page. + $existing_page = ORM::factory("static_page", $id); + $view = new Admin_View("admin.html"); + $view->page_title = t("Edit page"); + $view->content = new View("admin_pages_new.html"); + $view->content->form = $this->get_edit_page_form($existing_page); + print $view; + } + + public function savepage() { + // Save a page to the database. + + access::verify_csrf(); + + // Store form values into variables. + $page_id = Input::instance()->post("page_id"); + $page_name = urlencode(trim(Input::instance()->post("page_name"))); + $page_title = Input::instance()->post("page_title"); + $page_code = Input::instance()->post("page_code"); + $display_menu = Input::instance()->post("display_menu"); + + // If $page_id is set, update an existing page. + if (isset($page_id)) { + $update_page = ORM::factory("static_page", $page_id); + $update_page->title = $page_title; + $update_page->html_code = $page_code; + $update_page->display_menu = $display_menu; + $update_page->save(); + message::success(t("Page %page_name updated", array("page_name" => $update_page->name))); + log::success("pages", t("Page %page_name updated", array("page_name" => $update_page->name))); + url::redirect("admin/pages"); + } else { + + // If $page_id is not set, we are dealing with a new page. + // Check and make sure a page with the same names doesn't already exist. + $existing_page = ORM::factory("static_page") + ->where("name", "=", $page_name) + ->find_all(); + + // If the page doesn't exist, save it to the database. + if (count($existing_page) == 0) { + $new_page = ORM::factory("static_page"); + $new_page->name = $page_name; + $new_page->title = $page_title; + $new_page->html_code = $page_code; + $new_page->display_menu = $display_menu; + $new_page->save(); + message::success(t("Page %page_name created", array("page_name" => $page_name))); + log::success("pages", t("Page %page_name created", array("page_name" => $page_name))); + url::redirect("admin/pages"); + } else { + + // If the page does exist, ask the user if they want to overwrite the old page with the new one. + message::error(t("Page %page_name already exists, press Save again to overwrite.", array("page_name" => $page_name))); + $view = new Admin_View("admin.html"); + $view->page_title = t("Edit page"); + $view->content = new View("admin_pages_new.html"); + $view->content->form = $this->get_overwrite_page_form($existing_page[0]->id, $page_name, $page_title, $page_code, $display_menu); + print $view; + } + } + } + + public function form_delete($id) { + // Display a form asking the user if they want to delete a page. + $one_page = ORM::factory("static_page", $id); + if ($one_page->loaded()) { + print $this->get_delete_form($one_page); + } + } + + public function delete($id) { + // Delete the specified page. + + access::verify_csrf(); + + // Make sure $id belongs to an actual page. + $one_page = ORM::factory("static_page", $id); + if (!$one_page->loaded()) { + throw new Kohana_404_Exception(); + } + + // If the form validates, delete the specified page. + $form = $this->get_delete_form($one_page); + if ($form->validate()) { + $name = $one_page->name; + $one_page->delete(); + message::success(t("Deleted page %page_name", array("page_name" => $name))); + log::success("pages", t("Deleted page %page_name", array("page_name" => $name))); + json::reply(array("result" => "success", "location" => url::site("admin/pages"))); + } else { + print $form; + } + } + + public function form_rename($id) { + // Display a form to allow the user to rename a page. + $one_page = ORM::factory("static_page", $id); + if ($one_page->loaded()) { + print InPlaceEdit::factory(urldecode($one_page->name)) + ->action("admin/pages/rename/$id") + ->render(); + } + } + + public function rename($id) { + // Rename an existing page. + access::verify_csrf(); + + // Make sure the page specified by $id exists. + $one_page = ORM::factory("static_page", $id); + if (!$one_page->loaded()) { + throw new Kohana_404_Exception(); + } + + $in_place_edit = InPlaceEdit::factory($one_page->name) + ->action("admin/pages/rename/$one_page->id") + ->rules(array("required", "length[1,64]")); + + // If the form validates, and if the new name doesn't already exist, rename the page. + if ($in_place_edit->validate()) { + $old_name = $one_page->name; + $new_name = urlencode(trim($in_place_edit->value())); + $new_name_exists = ORM::factory("static_page")->where("name", "=", $new_name)->find_all(); + if (count($new_name_exists) == 0) { + $one_page->name = $new_name; + $one_page->save(); + $message = t("Renamed page %old_name to %new_name", + array("old_name" => $old_name, "new_name" => $new_name)); + message::success($message); + log::success("pages", $message); + json::reply(array("result" => "success", "location" => url::site("admin/pages"))); + } else { + json::reply(array("result" => "error", "form" => (string)$in_place_edit->render())); + } + } else { + json::reply(array("result" => "error", "form" => (string)$in_place_edit->render())); + } + } + + static function get_delete_form($one_page) { + // Generate a new form asking the user if they want to delete a page. + $form = new Forge("admin/pages/delete/$one_page->id", "", "post", array("id" => "g-delete-pages-form")); + $group = $form->group("delete_page") + ->label(t("Really delete page %page_name?", array("page_name" => $one_page->name))); + $group->submit("")->value(t("Delete Page")); + return $form; + } + + private function get_new_page_form() { + // Generate a form for creating a new page. + $form = new Forge("admin/pages/savepage", "", "post", + array("id" => "g-pages-admin-form")); + + $pages_group = $form->group("new_page"); + $pages_group->input("page_name") + ->label(t("Name")); + $pages_group->input("page_title") + ->label(t("Title")); + $pages_group->textarea("page_code") + ->label(t("HTML Code")); + $pages_group->checkbox("display_menu") + ->label(t("Display in menu?")) + ->checked(false); + $pages_group->submit("save_page") + ->value(t("Save")); + + return $form; + } + + private function get_overwrite_page_form($id, $name, $title, $html_code, $display_menu) { + // Generate a form for overwriting an existing page. + $form = new Forge("admin/pages/savepage", "", "post", + array("id" => "g-pages-admin-form")); + + $pages_group = $form->group("new_page"); + $pages_group->hidden("page_id") + ->value($id); + $pages_group->input("page_name") + ->label(t("Name")) + ->readonly() + ->value($name); + $pages_group->input("page_title") + ->label(t("Title")) + ->value($title); + $pages_group->textarea("page_code") + ->label(t("HTML Code")) + ->value($html_code); + $pages_group->checkbox("display_menu") + ->label(t("Display in menu?")) + ->checked($display_menu); + $pages_group->submit("save_page") + ->value(t("Save")); + + return $form; + } + + private function get_edit_page_form($existing_page) { + // Generate a form for editing an existing page. Reuse the overwrite form for as it's basically the same thing. + return ($this->get_overwrite_page_form($existing_page->id, $existing_page->name, $existing_page->title, $existing_page->html_code, $existing_page->display_menu)); + } + + private function get_prefs_form() { + // Generate a form for global preferences. + $form = new Forge("admin/pages/saveprefs", "", "post", + array("id" => "g-pages-admin-form")); + + $pages_group = $form->group("preferences")->label(t("Settings")); + $pages_group->checkbox("display_sidebar") + ->label(t("Hide sidebar on Pages?")) + ->checked(module::get_var("pages", "show_sidebar")); + $pages_group->submit("save_prefs") + ->value(t("Save")); + + return $form; + } + + public function saveprefs() { + // Save a preferences to the database. + + access::verify_csrf(); + + // Save form variables. + module::set_var("pages", "show_sidebar", Input::instance()->post("display_sidebar")); + + // Display message and load main pages admin screen. + message::success(t("Your settings have been saved.")); + url::redirect("admin/pages"); + } +} diff --git a/3.0/modules/pages/controllers/pages.php b/3.0/modules/pages/controllers/pages.php new file mode 100644 index 00000000..d567af47 --- /dev/null +++ b/3.0/modules/pages/controllers/pages.php @@ -0,0 +1,42 @@ +where("name", "=", $page_name) + ->find_all(); + + // If it doesn't exist, display a 404 error. + if (count($existing_page) == 0) { + throw new Kohana_404_Exception(); + } + + // Display the page. + $template = new Theme_View("page.html", "other", "Pages"); + $template->page_title = t("Gallery :: ") . t($existing_page[0]->title); + $template->content = new View("pages_display.html"); + $template->content->title = $existing_page[0]->title; + $template->content->body = $existing_page[0]->html_code; + print $template; + } +} diff --git a/3.0/modules/pages/css/jHtmlArea.css b/3.0/modules/pages/css/jHtmlArea.css new file mode 100644 index 00000000..641ea291 --- /dev/null +++ b/3.0/modules/pages/css/jHtmlArea.css @@ -0,0 +1,48 @@ +div.jHtmlArea { display: inline block; border: solid 1px #ccc; } +div.jHtmlArea div { padding: 0px; margin: 0px; } +div.jHtmlArea .ToolBar { } +div.jHtmlArea .ToolBar ul { border: solid 0px #ccc; margin: 1px; padding: 1px; position:relative; display: inline; background: #fff url(../images/jHtmlArea_Toolbar_Group_BG.png) repeat-x;} +div.jHtmlArea .ToolBar ul li { list-style-type: none; float: left; border: none; padding: 1px; margin: 1px; } +div.jHtmlArea .ToolBar ul li:hover { border: solid 1px #ccc; background: #ddd url(../images/jHtmlArea_Toolbar_Group__Btn_Select_BG.png); padding: 0; } +div.jHtmlArea .ToolBar ul li a { display: block; width: 16px; height: 16px; background: url(../images/jHtmlArea.png) no-repeat -16px -500px; border: none; cursor: pointer; padding: 0px; } +div.jHtmlArea .ToolBar ul li a.highlighted { border: solid 1px #aaa; background-color: #bbb; padding: 0; } +div.jHtmlArea .ToolBar ul li.separator {height: 16px; margin: 0 2px 0 3px; border-left: 1px solid #ccc;} +div.jHtmlArea .ToolBar ul li.separator:hover { padding: 1px; background-color: #fff; border-top:none; border-bottom:none; border-right:none;} + +div.jHtmlArea .ToolBar ul li a:hover { } +div.jHtmlArea .ToolBar ul li a.bold { background-position: 0 0; } +div.jHtmlArea .ToolBar ul li a.italic { background-position: -16px 0; } +div.jHtmlArea .ToolBar ul li a.underline { background-position: -32px 0; } +div.jHtmlArea .ToolBar ul li a.strikethrough { background-position: -48px 0; } +div.jHtmlArea .ToolBar ul li a.link { background-position: -64px 0; } +div.jHtmlArea .ToolBar ul li a.unlink { background-position: -80px 0; } +div.jHtmlArea .ToolBar ul li a.orderedlist { background-position: -96px 0; } +div.jHtmlArea .ToolBar ul li a.unorderedlist { background-position: -112px 0; } +div.jHtmlArea .ToolBar ul li a.image { background-position: -128px 0; } +div.jHtmlArea .ToolBar ul li a.cut { background-position: -144px 0; } +div.jHtmlArea .ToolBar ul li a.copy { background-position: -160px 0; } +div.jHtmlArea .ToolBar ul li a.paste { background-position: -176px 0; } + +div.jHtmlArea .ToolBar ul li a.html { background-position: -192px 0; opacity:0.6; filter:alpha(opacity=60);} +div.jHtmlArea .ToolBar ul li a.html.highlighted { opacity:1.0; filter:alpha(opacity=100);} + +div.jHtmlArea .ToolBar ul li a.h1 { background-position: 0 -16px;} +div.jHtmlArea .ToolBar ul li a.h2 { background-position: -16px -16px;} +div.jHtmlArea .ToolBar ul li a.h3 { background-position: -32px -16px;} +div.jHtmlArea .ToolBar ul li a.h4 { background-position: -48px -16px;} +div.jHtmlArea .ToolBar ul li a.h5 { background-position: -64px -16px;} +div.jHtmlArea .ToolBar ul li a.h6 { background-position: -80px -16px;} +div.jHtmlArea .ToolBar ul li a.subscript { background-position: -96px -16px;} +div.jHtmlArea .ToolBar ul li a.superscript { background-position: -112px -16px;} +div.jHtmlArea .ToolBar ul li a.indent { background-position: -128px -16px;} +div.jHtmlArea .ToolBar ul li a.outdent { background-position: -144px -16px;} +div.jHtmlArea .ToolBar ul li a.horizontalrule { background-position: -160px -16px;} +div.jHtmlArea .ToolBar ul li a.p { background-position: -176px -16px;} + + +div.jHtmlArea .ToolBar ul li a.justifyleft { background-position: 0 -32px;} +div.jHtmlArea .ToolBar ul li a.justifycenter { background-position: -16px -32px;} +div.jHtmlArea .ToolBar ul li a.justifyright { background-position: -32px -32px;} +div.jHtmlArea .ToolBar ul li a.increasefontsize { background-position: -48px -32px;} +div.jHtmlArea .ToolBar ul li a.decreasefontsize { background-position: -64px -32px;} +div.jHtmlArea .ToolBar ul li a.forecolor { background-position: -80px -32px;} \ No newline at end of file diff --git a/3.0/modules/pages/helpers/pages_block.php b/3.0/modules/pages/helpers/pages_block.php new file mode 100644 index 00000000..2eae8861 --- /dev/null +++ b/3.0/modules/pages/helpers/pages_block.php @@ -0,0 +1,57 @@ + t("Pages Links")); + } + + static function get($block_id, $theme) { + $block = ""; + + switch ($block_id) { + case "pages_block": + + // Create a new block with a list of all Pages and their links. + + // Query the database for all existing pages. + // If at least one page exists, display the sidebar block. + $query = ORM::factory("static_page"); + $pages = $query->order_by("title", "ASC")->find_all(); + if (count($pages) > 0) { + + // Loop through each page and generate an HTML list of their links and titles. + $content = ""; + + // Make a new sidebar block. + $block = new Block(); + $block->css_id = "g-pages"; + $block->title = t("Pages"); + $block->content = new View("pages_sidebar.html"); + $block->content->links = $content; + } + break; + } + return $block; + } +} diff --git a/3.0/modules/pages/helpers/pages_event.php b/3.0/modules/pages/helpers/pages_event.php new file mode 100644 index 00000000..3cb37d0b --- /dev/null +++ b/3.0/modules/pages/helpers/pages_event.php @@ -0,0 +1,44 @@ +get("content_menu") + ->append(Menu::factory("link") + ->id("pages") + ->label(t("Pages Settings")) + ->url(url::site("admin/pages"))); + } + + static function site_menu($menu, $theme) { + $menu_pages = ORM::factory("static_page") + ->where("display_menu", "=", true) + ->order_by("title", "DESC") + ->find_all(); + if (count($menu_pages) > 0) { + foreach ($menu_pages as $one_page) { + $menu->add_after("home", Menu::factory("link") + ->id("pages-" . $one_page->id) + ->label(t($one_page->title)) + ->url(url::site("pages/show/" . $one_page->name))); + } + } + } +} diff --git a/3.0/modules/pages/helpers/pages_installer.php b/3.0/modules/pages/helpers/pages_installer.php new file mode 100644 index 00000000..cd1f1546 --- /dev/null +++ b/3.0/modules/pages/helpers/pages_installer.php @@ -0,0 +1,44 @@ +query("CREATE TABLE IF NOT EXISTS {static_pages} ( + `id` int(9) NOT NULL auto_increment, + `name` varchar(255) default NULL, + `title` varchar(255) default NULL, + `html_code` text default NULL, + `display_menu` boolean default 0, + PRIMARY KEY (`id`), + UNIQUE KEY(`name`)) + DEFAULT CHARSET=utf8;"); + + // Set the module version number. + module::set_version("pages", 2); + } + static function upgrade($version) { + $db = Database::instance(); + if ($version == 1) { + $db->query("ALTER TABLE {static_pages} ADD COLUMN `display_menu` boolean default 0"); + module::set_version("pages", $version = 2); + } + } +} diff --git a/3.0/modules/pages/helpers/pages_theme.php b/3.0/modules/pages/helpers/pages_theme.php new file mode 100644 index 00000000..ec57a2ce --- /dev/null +++ b/3.0/modules/pages/helpers/pages_theme.php @@ -0,0 +1,27 @@ +script("jHtmlArea-0.7.0.js") . + $theme->css("jHtmlArea.css"); + } +} + \ No newline at end of file diff --git a/3.0/modules/pages/images/jHtmlArea.png b/3.0/modules/pages/images/jHtmlArea.png new file mode 100644 index 00000000..54c66a10 Binary files /dev/null and b/3.0/modules/pages/images/jHtmlArea.png differ diff --git a/3.0/modules/pages/images/jHtmlArea_Toolbar_Group_BG.png b/3.0/modules/pages/images/jHtmlArea_Toolbar_Group_BG.png new file mode 100644 index 00000000..bcfb0545 Binary files /dev/null and b/3.0/modules/pages/images/jHtmlArea_Toolbar_Group_BG.png differ diff --git a/3.0/modules/pages/images/jHtmlArea_Toolbar_Group__Btn_Select_BG.png b/3.0/modules/pages/images/jHtmlArea_Toolbar_Group__Btn_Select_BG.png new file mode 100644 index 00000000..4287b5b8 Binary files /dev/null and b/3.0/modules/pages/images/jHtmlArea_Toolbar_Group__Btn_Select_BG.png differ diff --git a/3.0/modules/pages/js/jHtmlArea-0.7.0.js b/3.0/modules/pages/js/jHtmlArea-0.7.0.js new file mode 100644 index 00000000..d1e360c4 --- /dev/null +++ b/3.0/modules/pages/js/jHtmlArea-0.7.0.js @@ -0,0 +1,403 @@ +/* +* jHtmlArea 0.7.0 - WYSIWYG Html Editor jQuery Plugin +* Copyright (c) 2009 Chris Pietschmann +* http://jhtmlarea.codeplex.com +* Licensed under the Microsoft Reciprocal License (Ms-RL) +* http://jhtmlarea.codeplex.com/license +*/ +(function($) { + $.fn.htmlarea = function(opts) { + if (opts && typeof (opts) === "string") { + var args = []; + for (var i = 1; i < arguments.length; i++) { args.push(arguments[i]); } + var htmlarea = jHtmlArea(this[0]); + var f = htmlarea[opts]; + if (f) { return f.apply(htmlarea, args); } + } + return this.each(function() { jHtmlArea(this, opts); }); + }; + var jHtmlArea = window.jHtmlArea = function(elem, options) { + if (elem.jquery) { + return jHtmlArea(elem[0]); + } + if (elem.jhtmlareaObject) { + return elem.jhtmlareaObject; + } else { + return new jHtmlArea.fn.init(elem, options); + } + }; + jHtmlArea.fn = jHtmlArea.prototype = { + + // The current version of jHtmlArea being used + jhtmlarea: "0.7.0", + + init: function(elem, options) { + if (elem.nodeName.toLowerCase() === "textarea") { + var opts = $.extend({}, jHtmlArea.defaultOptions, options); + elem.jhtmlareaObject = this; + + var textarea = this.textarea = $(elem); + var container = this.container = $("
    ").addClass("jHtmlArea").width(textarea.width()).insertAfter(textarea); + + var toolbar = this.toolbar = $("
    ").addClass("ToolBar").appendTo(container); + priv.initToolBar.call(this, opts); + + var iframe = this.iframe = $("