From 58d0a5013d4cda1be0cf528b8ff08d44b123d75f Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sun, 12 Jul 2009 11:43:41 -0600 Subject: First attempt at animating gThumbMenu. Doesn't work. --- themes/default/css/screen.css | 2 +- themes/default/js/ui.init.js | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/themes/default/css/screen.css b/themes/default/css/screen.css index 0c65cd96..1853a11d 100644 --- a/themes/default/css/screen.css +++ b/themes/default/css/screen.css @@ -459,7 +459,7 @@ form .gError, font-size: .7em; height: 240px; overflow: hidden; - padding: 14px 8px; + padding: 15px 8px 30px 8px; position: relative; text-align: center; width: 213px; diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js index b14127f6..d5755aed 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -50,8 +50,23 @@ $(document).ready(function() { .css({ "height":"10px", "margin":"0", - "padding":"0" + "padding":"0", + "width":"16px" }); + var menuHt = $("#gContent .gThumbMenu").height(); + var bottomPos = "-" + (menuHt - 15) + "px"; + $("#gContent .gThumbMenu").css("bottom",bottomPos); + console.log("Initilizing: Placing at " + bottomPos); + $("#gContent .gThumbMenu li").hover( + function(){ + $(this).css("bottom","0"); + console.log("Placing at 0px"); + }, + function(){ + $(this).css("bottom",bottomPos); + console.log("Placing at " + bottomPos); + } + ); } // Initialize view menu -- cgit v1.2.3 From 413174e89edb36b311237aea4ab8386d75d16760 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sun, 12 Jul 2009 16:07:16 -0600 Subject: Second attempt at showing and hiding the thumb menu. Renamed gThumbMenu to gPhotoMenu for use on both album and photo pages, eventually. --- themes/default/css/screen.css | 9 +++++---- themes/default/js/ui.init.js | 28 +++++++++++----------------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/themes/default/css/screen.css b/themes/default/css/screen.css index 1853a11d..93b68e68 100644 --- a/themes/default/css/screen.css +++ b/themes/default/css/screen.css @@ -582,23 +582,24 @@ form .gError, margin-bottom: 0; } -/* Thumb Menu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +/* Photo Menu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -#gContent .gThumbMenu { +#gContent .gPhotoMenu { bottom: 0; left: 0; position: absolute; width: 100%; } -#gContent .gThumbMenu li { +#gContent .gPhotoMenu li { border-left: none; border-right: none; } -#gContent .gThumbMenu a:hover { +#gContent .gPhotoMenu a:hover { text-decoration: none; } + /* View Menu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ #gViewMenu { diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js index d5755aed..37261727 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -14,8 +14,9 @@ var shortForms = new Array( $(document).ready(function() { // Remove .gMenu from thumb menu's before initializing Superfish + // @todo gallery_menu should only apply gMenu to top-level menus, submenus should be gSubMenu-N $("#gContent .gItem .gMenu").removeClass("gMenu"); - $("#gContent .gQuick + ul").addClass("gThumbMenu") + $("#gContent .gQuick + ul").addClass("gPhotoMenu"); // Initialize Superfish menus $("ul.gMenu").addClass("sf-menu"); @@ -40,31 +41,24 @@ $(document).ready(function() { $(dialogLinks[i]).bind("click", handleDialogEvent); } - // gThumbMenu - if ($("#gContent .gThumbMenu").length) { - $("#gContent .gThumbMenu li").addClass("ui-state-default"); - // ui-icon-triangle-1-n - $("#gContent .gThumbMenu li a") + // Initialize photo menus + if ($("#gContent .gPhotoMenu").length) { + $("#gContent .gPhotoMenu li").addClass("ui-state-default"); + $("#gContent .gPhotoMenu li a") .not('[class]') .addClass("gButtonLink ui-icon") .css({ "height":"10px", "margin":"0", - "padding":"0", - "width":"16px" + "padding":"0" }); - var menuHt = $("#gContent .gThumbMenu").height(); - var bottomPos = "-" + (menuHt - 15) + "px"; - $("#gContent .gThumbMenu").css("bottom",bottomPos); - console.log("Initilizing: Placing at " + bottomPos); - $("#gContent .gThumbMenu li").hover( + //$(".gPhotoMenu ul").hide(); + $(".gPhotoMenu").hover( function(){ - $(this).css("bottom","0"); - console.log("Placing at 0px"); + $(this + " ul").show(); }, function(){ - $(this).css("bottom",bottomPos); - console.log("Placing at " + bottomPos); + $(this + " ul").hide(); } ); } -- cgit v1.2.3 From b4c279ebb453459a37550b6413a830bed6c74b17 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 11 Jul 2009 17:40:32 -0700 Subject: Fix whitespace typo. --- modules/gallery/libraries/Menu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gallery/libraries/Menu.php b/modules/gallery/libraries/Menu.php index d37be7d3..162cd3b0 100644 --- a/modules/gallery/libraries/Menu.php +++ b/modules/gallery/libraries/Menu.php @@ -136,7 +136,7 @@ class Menu_Core extends Menu_Element { return new Menu_Element_Dialog($type); case "root": - return new Menu("root"); + return new Menu("root"); case "submenu": return new Menu("submenu"); -- cgit v1.2.3 From 895fbfd95b5e7a42dd865f4a18401fd2e1491bc2 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 11 Jul 2009 17:59:55 -0700 Subject: Get the thumbnail menu working. 1) Stop changing the menu classes in JS, instead allow us to specify it in the Menu class itself and then set it to be gThumbMenu in Theme_View 2) Move the gThumbMenu init code to the bottom of the $(document).ready() block; something in there was interfering with it. --- modules/gallery/libraries/Menu.php | 9 ++++-- modules/gallery/libraries/Theme_View.php | 11 ++++---- themes/default/css/screen.css | 8 +++--- themes/default/js/ui.init.js | 47 ++++++++++++++++---------------- 4 files changed, 38 insertions(+), 37 deletions(-) diff --git a/modules/gallery/libraries/Menu.php b/modules/gallery/libraries/Menu.php index 162cd3b0..a39b59a5 100644 --- a/modules/gallery/libraries/Menu.php +++ b/modules/gallery/libraries/Menu.php @@ -136,7 +136,9 @@ class Menu_Core extends Menu_Element { return new Menu_Element_Dialog($type); case "root": - return new Menu("root"); + $menu = new Menu("root"); + $menu->css_class("gMenu"); + return $menu; case "submenu": return new Menu("submenu"); @@ -156,6 +158,7 @@ class Menu_Core extends Menu_Element { } } } + return $this; } public function __construct($type) { @@ -206,8 +209,8 @@ class Menu_Core extends Menu_Element { } public function __toString() { - $html = $this->is_root ? "
    " : - "
  • label\">$this->label
      "; + $html = $this->is_root ? "
        css_class\">" : + "
      • label\">$this->label
          "; $html .= implode("\n", $this->elements); $html .= $this->is_root ? "
        " : "
      "; return $html; diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index 75138f25..fa45ec89 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -99,19 +99,19 @@ class Theme_View_Core extends Gallery_View { } public function album_menu() { - $this->_menu("album"); + print $this->_menu("album"); } public function tag_menu() { - $this->_menu("tag"); + print $this->_menu("tag"); } public function photo_menu() { - $this->_menu("photo"); + print $this->_menu("photo"); } public function thumb_menu($item) { - $this->_menu("thumb", $item); + print $this->_menu("thumb", $item)->css_class("gThumbMenu"); } private function _menu($type, $item=null) { @@ -127,8 +127,7 @@ class Theme_View_Core extends Gallery_View { } } - $menu->compact(); - print $menu; + return $menu->compact(); } public function pager() { diff --git a/themes/default/css/screen.css b/themes/default/css/screen.css index 93b68e68..c0954690 100644 --- a/themes/default/css/screen.css +++ b/themes/default/css/screen.css @@ -582,21 +582,21 @@ form .gError, margin-bottom: 0; } -/* Photo Menu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +/* Thumb Menu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -#gContent .gPhotoMenu { +#gContent .gThumbMenu { bottom: 0; left: 0; position: absolute; width: 100%; } -#gContent .gPhotoMenu li { +#gContent .gThumbMenu li { border-left: none; border-right: none; } -#gContent .gPhotoMenu a:hover { +#gContent .gThumbMenu a:hover { text-decoration: none; } diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js index 37261727..ac7ef8d2 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -15,8 +15,6 @@ $(document).ready(function() { // Remove .gMenu from thumb menu's before initializing Superfish // @todo gallery_menu should only apply gMenu to top-level menus, submenus should be gSubMenu-N - $("#gContent .gItem .gMenu").removeClass("gMenu"); - $("#gContent .gQuick + ul").addClass("gPhotoMenu"); // Initialize Superfish menus $("ul.gMenu").addClass("sf-menu"); @@ -41,28 +39,6 @@ $(document).ready(function() { $(dialogLinks[i]).bind("click", handleDialogEvent); } - // Initialize photo menus - if ($("#gContent .gPhotoMenu").length) { - $("#gContent .gPhotoMenu li").addClass("ui-state-default"); - $("#gContent .gPhotoMenu li a") - .not('[class]') - .addClass("gButtonLink ui-icon") - .css({ - "height":"10px", - "margin":"0", - "padding":"0" - }); - //$(".gPhotoMenu ul").hide(); - $(".gPhotoMenu").hover( - function(){ - $(this + " ul").show(); - }, - function(){ - $(this + " ul").hide(); - } - ); - } - // Initialize view menu if ($("#gViewMenu").length) { $("#gViewMenu ul").removeClass("gMenu").removeClass("sf-menu"); @@ -118,6 +94,29 @@ $(document).ready(function() { } ); + // Initialize thumbnail menus + if ($("#gContent .gThumbMenu").length) { + $("#gContent .gThumbMenu li").addClass("ui-state-default"); + $("#gContent .gThumbMenu li a") + .not('[class]') + .addClass("gButtonLink ui-icon") + .css({ + height: "10px", + margin: "0", + padding: "0" + }); + + $(".gThumbMenu ul").hide(); + $(".gThumbMenu").hover( + function() { + $(this).find("ul").slideDown("fast"); + }, + function() { + $(this).find("ul").slideUp("slow"); + } + ); + } + }); /** -- cgit v1.2.3 From 980923839930fde45120872dcadd437abfbbc09d Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 11 Jul 2009 19:17:12 -0700 Subject: Unescape ' also (single quote) --- modules/gallery/controllers/file_proxy.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index 0d64bcd9..03303d66 100644 --- a/modules/gallery/controllers/file_proxy.php +++ b/modules/gallery/controllers/file_proxy.php @@ -32,8 +32,9 @@ class File_Proxy_Controller extends Controller { $request_uri = $this->input->server("REQUEST_URI"); $request_uri = preg_replace("/\?.*/", "", $request_uri); - // Unescape %7E ("~") and %20 (" ") - $request_uri = str_replace(array("%7E", "%20"), array("~", " "), $request_uri); + // Unescape %7E (~), %20 ( ) and ' (') + // @todo: figure out why we have to do this and unescape everything appropriate + $request_uri = str_replace(array("%7E", "%20", "'"), array("~", " ", "'"), $request_uri); // var_uri: http://example.com/gallery3/var/ $var_uri = url::file("var/"); -- cgit v1.2.3 From ac181d6227f77cfa33585704fdbc1b041a129e6a Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 11 Jul 2009 20:12:32 -0700 Subject: Whitespace fixes. --- modules/gallery/helpers/MY_remote.php | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/modules/gallery/helpers/MY_remote.php b/modules/gallery/helpers/MY_remote.php index 4abf5bf1..af2a05d8 100644 --- a/modules/gallery/helpers/MY_remote.php +++ b/modules/gallery/helpers/MY_remote.php @@ -21,11 +21,11 @@ class remote extends remote_Core { static function post($url, $post_data_array, $extra_headers=array()) { $post_data_raw = self::_encode_post_data($post_data_array, $extra_headers); - + /* Read the web page into a buffer */ list ($response_status, $response_headers, $response_body) = self::do_request($url, 'POST', $extra_headers, $post_data_raw); - + return array($response_body, $response_status, $response_headers); } @@ -49,22 +49,23 @@ class remote extends remote_Core { } $post_data_raw .= urlencode($key) . '=' . urlencode($value); } - + $extra_headers['Content-Type'] = 'application/x-www-form-urlencoded'; $extra_headers['Content-Length'] = strlen($post_data_raw); - + return $post_data_raw; } /** * A single request, without following redirects * - * @todo: Handle redirects? If so, only for GET (i.e. not for POST), and use G2's WebHelper_simple::_parseLocation logic. + * @todo: Handle redirects? If so, only for GET (i.e. not for POST), and use G2's + * WebHelper_simple::_parseLocation logic. */ static function do_request($url, $method='GET', $headers=array(), $body='') { /* Convert illegal characters */ $url = str_replace(' ', '%20', $url); - + $url_components = self::_parse_url_for_fsockopen($url); $handle = fsockopen( $url_components['fsockhost'], $url_components['port'], $errno, $errstr, 5); @@ -72,12 +73,12 @@ class remote extends remote_Core { // log "Error $errno: '$errstr' requesting $url"; return array(null, null, null); } - + $header_lines = array('Host: ' . $url_components['host']); foreach ($headers as $key => $value) { $header_lines[] = $key . ': ' . $value; } - + $success = fwrite($handle, sprintf("%s %s HTTP/1.0\r\n%s\r\n\r\n%s", $method, $url_components['uri'], @@ -89,7 +90,7 @@ class remote extends remote_Core { return array(null, null, null); } fflush($handle); - + /* * Read the status line. fgets stops after newlines. The first line is the protocol * version followed by a numeric status code and its associated textual phrase. @@ -99,7 +100,7 @@ class remote extends remote_Core { // 'Empty http response code, maybe timeout' return array(null, null, null); } - + /* Read the headers */ $response_headers = array(); while (!feof($handle)) { @@ -107,10 +108,10 @@ class remote extends remote_Core { if (empty($line)) { break; } - + /* Normalize the line endings */ $line = str_replace("\r", '', $line); - + list ($key, $value) = explode(':', $line, 2); if (isset($response_headers[$key])) { if (!is_array($response_headers[$key])) { @@ -121,7 +122,7 @@ class remote extends remote_Core { $response_headers[$key] = trim($value); } } - + /* Read the body */ $response_body = ''; while (!feof($handle)) { -- cgit v1.2.3 From 9588e8604d46e548dc4ac8788589f9f89b1992ab Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 12 Jul 2009 20:08:02 -0700 Subject: Use %27 instead of ' (the latter is the wrong form of escaping for urls). --- modules/gallery/controllers/file_proxy.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index 03303d66..c5b34033 100644 --- a/modules/gallery/controllers/file_proxy.php +++ b/modules/gallery/controllers/file_proxy.php @@ -32,9 +32,9 @@ class File_Proxy_Controller extends Controller { $request_uri = $this->input->server("REQUEST_URI"); $request_uri = preg_replace("/\?.*/", "", $request_uri); - // Unescape %7E (~), %20 ( ) and ' (') + // Unescape %7E (~), %20 ( ) and %27 (') // @todo: figure out why we have to do this and unescape everything appropriate - $request_uri = str_replace(array("%7E", "%20", "'"), array("~", " ", "'"), $request_uri); + $request_uri = str_replace(array("%7E", "%20", "%27"), array("~", " ", "'"), $request_uri); // var_uri: http://example.com/gallery3/var/ $var_uri = url::file("var/"); -- cgit v1.2.3 From 50cd41655a5e083de3fee5b43fd72c21ffb3dd25 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sun, 12 Jul 2009 22:41:57 -0600 Subject: Minor style tweaks. --- themes/default/css/screen.css | 5 +++++ themes/default/js/ui.init.js | 9 +++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/themes/default/css/screen.css b/themes/default/css/screen.css index c0954690..88631e81 100644 --- a/themes/default/css/screen.css +++ b/themes/default/css/screen.css @@ -594,6 +594,11 @@ form .gError, #gContent .gThumbMenu li { border-left: none; border-right: none; + border-bottom: none; +} + +#gContent .gThumbMenu li li { + padding: .3em; } #gContent .gThumbMenu a:hover { diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js index ac7ef8d2..92a42ded 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -95,24 +95,25 @@ $(document).ready(function() { ); // Initialize thumbnail menus + // @todo Toggle between north and south caret's on hover if ($("#gContent .gThumbMenu").length) { $("#gContent .gThumbMenu li").addClass("ui-state-default"); $("#gContent .gThumbMenu li a") .not('[class]') - .addClass("gButtonLink ui-icon") + .addClass("gButtonLink ui-icon ui-icon-caret-l-n") .css({ height: "10px", margin: "0", - padding: "0" + padding: "0 0 3px 0" }); $(".gThumbMenu ul").hide(); $(".gThumbMenu").hover( function() { - $(this).find("ul").slideDown("fast"); + $(this).find("ul").slideDown("fast"); }, function() { - $(this).find("ul").slideUp("slow"); + $(this).find("ul").slideUp("slow"); } ); } -- cgit v1.2.3 From ff0b66a1a4ed189c3e02a8ad50a63f4d65b3bfa7 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sun, 12 Jul 2009 22:53:47 -0600 Subject: Put owner's url into user link. Seems better than displaying email until we have something like a user profile page. --- modules/info/helpers/info_theme.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/info/helpers/info_theme.php b/modules/info/helpers/info_theme.php index 863317a8..51378e54 100644 --- a/modules/info/helpers/info_theme.php +++ b/modules/info/helpers/info_theme.php @@ -37,7 +37,11 @@ class info_theme_Core { } if ($item->owner) { $results .= "
    • "; - $results .= t("By: %owner_name", array("owner_name" => "{$item->owner->full_name}")); + if ($item->owner->url) { + $results .= t("By: %owner_name", array("owner_name" => "owner->url}\">{$item->owner->full_name}")); + } else { + $results .= t("By: %owner_name", array("owner_name" => "{$item->owner->full_name}")); + } $results .= "
    • "; } return $results; -- cgit v1.2.3 From a944bf4259a6ff31ac647a3d8336bd5175c3640a Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 13 Jul 2009 06:43:44 -0700 Subject: Avoid using the bare word "on" in a value; it breaks PHP 5.3. Fixes ticket #540. --- modules/comment/module.info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/comment/module.info b/modules/comment/module.info index 946f1d39..55997317 100644 --- a/modules/comment/module.info +++ b/modules/comment/module.info @@ -1,3 +1,3 @@ name = Comments -description = Allows users and guests to leave comments on photos and albums. +description = "Allows users and guests to leave comments on photos and albums." version = 2 -- cgit v1.2.3