diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-07-13 07:11:02 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-07-13 07:11:02 -0700 |
commit | 021e6eccd03df460fddb0d2bdcab335ddd2d6c52 (patch) | |
tree | 61a5fe2bd4b8e8f52edcb3b530fc3f4cb52d5a93 | |
parent | 75be4ab2e62004811ba7086376bf5abeca4cf791 (diff) | |
parent | a944bf4259a6ff31ac647a3d8336bd5175c3640a (diff) |
Merge branch 'master' of git@github.com:gallery/gallery3
-rw-r--r-- | modules/comment/module.info | 2 | ||||
-rw-r--r-- | modules/gallery/controllers/file_proxy.php | 5 | ||||
-rw-r--r-- | modules/gallery/helpers/MY_remote.php | 27 | ||||
-rw-r--r-- | modules/gallery/libraries/Menu.php | 9 | ||||
-rw-r--r-- | modules/gallery/libraries/Theme_View.php | 11 | ||||
-rw-r--r-- | modules/info/helpers/info_theme.php | 6 | ||||
-rw-r--r-- | themes/default/css/screen.css | 8 | ||||
-rw-r--r-- | themes/default/js/ui.init.js | 41 |
8 files changed, 66 insertions, 43 deletions
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 diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index 0d64bcd9..c5b34033 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 %27 (') + // @todo: figure out why we have to do this and unescape everything appropriate + $request_uri = str_replace(array("%7E", "%20", "%27"), array("~", " ", "'"), $request_uri); // var_uri: http://example.com/gallery3/var/ $var_uri = url::file("var/"); 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)) { diff --git a/modules/gallery/libraries/Menu.php b/modules/gallery/libraries/Menu.php index d37be7d3..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 ? "<ul class=\"gMenu\">" : - "<li title=\"$this->label\"><a href=\"#\">$this->label</a><ul class=\"gMenu\">"; + $html = $this->is_root ? "<ul class=\"$this->css_class\">" : + "<li title=\"$this->label\"><a href=\"#\">$this->label</a><ul>"; $html .= implode("\n", $this->elements); $html .= $this->is_root ? "</ul>" : "</ul></li>"; 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/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 .= "<li>"; - $results .= t("By: %owner_name", array("owner_name" => "<a href=\"#\">{$item->owner->full_name}</a>")); + if ($item->owner->url) { + $results .= t("By: %owner_name", array("owner_name" => "<a href=\"{$item->owner->url}\">{$item->owner->full_name}</a>")); + } else { + $results .= t("By: %owner_name", array("owner_name" => "{$item->owner->full_name}")); + } $results .= "</li>"; } return $results; diff --git a/themes/default/css/screen.css b/themes/default/css/screen.css index 0c65cd96..88631e81 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; @@ -594,11 +594,17 @@ form .gError, #gContent .gThumbMenu li { border-left: none; border-right: none; + border-bottom: none; +} + +#gContent .gThumbMenu li li { + padding: .3em; } #gContent .gThumbMenu 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 b14127f6..92a42ded 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -14,8 +14,7 @@ var shortForms = new Array( $(document).ready(function() { // Remove .gMenu from thumb menu's before initializing Superfish - $("#gContent .gItem .gMenu").removeClass("gMenu"); - $("#gContent .gQuick + ul").addClass("gThumbMenu") + // @todo gallery_menu should only apply gMenu to top-level menus, submenus should be gSubMenu-N // Initialize Superfish menus $("ul.gMenu").addClass("sf-menu"); @@ -40,20 +39,6 @@ $(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") - .not('[class]') - .addClass("gButtonLink ui-icon") - .css({ - "height":"10px", - "margin":"0", - "padding":"0" - }); - } - // Initialize view menu if ($("#gViewMenu").length) { $("#gViewMenu ul").removeClass("gMenu").removeClass("sf-menu"); @@ -109,6 +94,30 @@ $(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 ui-icon-caret-l-n") + .css({ + height: "10px", + margin: "0", + padding: "0 0 3px 0" + }); + + $(".gThumbMenu ul").hide(); + $(".gThumbMenu").hover( + function() { + $(this).find("ul").slideDown("fast"); + }, + function() { + $(this).find("ul").slideUp("slow"); + } + ); + } + }); /** |