From 9fd54de691f3829dc63b8fa2c64330fab42d12c9 Mon Sep 17 00:00:00 2001 From: tommy tomson Date: Tue, 27 Mar 2012 15:29:46 +0200 Subject: provide a close-option for boxes in right_aside and store info via js and cookies --- view/theme/diabook-blue/communityhome.tpl | 32 ++++++-- view/theme/diabook-blue/icons/close_box.png | Bin 0 -> 206 bytes view/theme/diabook-blue/js/jquery.cookie.js | 47 ++++++++++++ view/theme/diabook-blue/style-network.css | 11 ++- view/theme/diabook-blue/style-profile.css | 10 ++- view/theme/diabook-blue/theme.php | 114 ++++++++++++++++++++++++++-- 6 files changed, 195 insertions(+), 19 deletions(-) create mode 100755 view/theme/diabook-blue/icons/close_box.png create mode 100644 view/theme/diabook-blue/js/jquery.cookie.js diff --git a/view/theme/diabook-blue/communityhome.tpl b/view/theme/diabook-blue/communityhome.tpl index 748e6d077..1e3da2199 100755 --- a/view/theme/diabook-blue/communityhome.tpl +++ b/view/theme/diabook-blue/communityhome.tpl @@ -1,17 +1,22 @@ +
{{ if $page }}
$page
{{ endif }} +
+
{{ if $lastusers_title }} -

Help or @NewHere ?

+

Help or @NewHere ?

Friendica Support
Let's talk
Local Friendica NewHere {{ endif }} +
+
{{ if $lastusers_title }} -

Connectable Services

+

Connectable Services

Facebook StatusNet @@ -23,28 +28,36 @@ E-Mail
{{ endif }} +
+
{{ if $nv }} -

Find Friends

+

Find Friends

$nv.directory.1
$nv.match.1
$nv.suggest.1 $nv.invite.1 {{ endif }} +
+
{{ if $lastusers_title }} -

PostIt to Friendica

+

PostIt to Friendica

Post to Friendica from anywhere by bookmarking the Link.
{{ endif }} +
+
{{ if $lastusers_title }} -

$lastusers_title

+

$lastusers_title

{{ for $lastusers_items as $i }} $i {{ endfor }}
{{ endif }} +
+ {{ if $activeusers_title }}

$activeusers_title

@@ -55,21 +68,24 @@ {{ endif }} +
{{ if $photos_title }} -

$photos_title

+

$photos_title

{{ for $photos_items as $i }} $i {{ endfor }}
{{ endif }} +
- +
{{ if $like_title }} -

$like_title

+

$like_title

{{ endif }} +
diff --git a/view/theme/diabook-blue/icons/close_box.png b/view/theme/diabook-blue/icons/close_box.png new file mode 100755 index 000000000..28e2675b8 Binary files /dev/null and b/view/theme/diabook-blue/icons/close_box.png differ diff --git a/view/theme/diabook-blue/js/jquery.cookie.js b/view/theme/diabook-blue/js/jquery.cookie.js new file mode 100644 index 000000000..6d5974a2c --- /dev/null +++ b/view/theme/diabook-blue/js/jquery.cookie.js @@ -0,0 +1,47 @@ +/*! + * jQuery Cookie Plugin + * https://github.com/carhartl/jquery-cookie + * + * Copyright 2011, Klaus Hartl + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://www.opensource.org/licenses/mit-license.php + * http://www.opensource.org/licenses/GPL-2.0 + */ +(function($) { + $.cookie = function(key, value, options) { + + // key and at least value given, set cookie... + if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value === null || value === undefined)) { + options = $.extend({}, options); + + if (value === null || value === undefined) { + options.expires = -1; + } + + if (typeof options.expires === 'number') { + var days = options.expires, t = options.expires = new Date(); + t.setDate(t.getDate() + days); + } + + value = String(value); + + return (document.cookie = [ + encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value), + options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE + options.path ? '; path=' + options.path : '', + options.domain ? '; domain=' + options.domain : '', + options.secure ? '; secure' : '' + ].join('')); + } + + // key and possibly options given, get cookie... + options = value || {}; + var decode = options.raw ? function(s) { return s; } : decodeURIComponent; + + var pairs = document.cookie.split('; '); + for (var i = 0, pair; pair = pairs[i] && pairs[i].split('='); i++) { + if (decode(pair[0]) === key) return decode(pair[1] || ''); // IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, thus pair[1] may be undefined + } + return null; + }; +})(jQuery); diff --git a/view/theme/diabook-blue/style-network.css b/view/theme/diabook-blue/style-network.css index d0bcd3209..ebf4da695 100644 --- a/view/theme/diabook-blue/style-network.css +++ b/view/theme/diabook-blue/style-network.css @@ -1174,8 +1174,8 @@ body .pageheader{ right_aside { display: table-cell; vertical-align: top; - width: 160px; - padding-right: 10px; + width: 170px; + /*border-left: 1px solid #D2D2D2;*/ /* background: #F1F1F1; */ @@ -1192,6 +1192,13 @@ right_aside #lastusers-wrapper { padding-left: 6px; padding-top: 3px; overflow: right_aside #ra-photos-wrapper { padding-left: 5px; padding-top: 3px; overflow: auto; width: 100%; } #page-sidebar-right_aside{margin-top: 0px; margin-bottom: 30px;} #page-sidebar-right_aside ul {margin-top: 0px;} +right_aside .icon {width: 10px; height: 10px;} +.close_box { + background-image: url("../../../view/theme/diabook-blue/icons/close_box.png"); + float: right; + cursor: pointer; + } + /* wall item */ .tread-wrapper { border-bottom: 1px solid #D2D2D2; diff --git a/view/theme/diabook-blue/style-profile.css b/view/theme/diabook-blue/style-profile.css index 1296f1647..db172dcda 100644 --- a/view/theme/diabook-blue/style-profile.css +++ b/view/theme/diabook-blue/style-profile.css @@ -1173,8 +1173,8 @@ body .pageheader{ right_aside { display: table-cell; vertical-align: top; - width: 160px; - padding-right: 10px; + width: 170px; + /*padding-right: 10px;*/ /*border-left: 1px solid #D2D2D2;*/ /* background: #F1F1F1; */ @@ -1191,6 +1191,12 @@ right_aside #lastusers-wrapper { padding-left: 6px; padding-top: 3px; overflow: right_aside #ra-photos-wrapper { padding-left: 5px; padding-top: 3px; overflow: auto; width: 100%; } #page-sidebar-right_aside{margin-top: 0px; margin-bottom: 30px;} #page-sidebar-right_aside ul {margin-top: 0px;} +right_aside .icon {width: 10px; height: 10px;} +.close_box { + background-image: url("../../../view/theme/diabook-blue/icons/close_box.png"); + float: right; + cursor: pointer; + } /* wall item */ .tread-wrapper { border-bottom: 1px solid #D2D2D2; diff --git a/view/theme/diabook-blue/theme.php b/view/theme/diabook-blue/theme.php index e12d940aa..3e35144de 100755 --- a/view/theme/diabook-blue/theme.php +++ b/view/theme/diabook-blue/theme.php @@ -147,9 +147,10 @@ function diabook_blue_community_info(){ $aside['$nv'] = $nv; }; //Community Page + if(local_user()) { $page = '
-

'.t("Community Pages").'

+

'.t("Community Pages").'

'; - if (sizeof($contacts) > 0) + //if (sizeof($contacts) > 0) $aside['$page'] = $page; - + } //END Community Page @@ -222,31 +223,39 @@ if ($a->argv[0] === "network" && local_user()){ } + $ccCookie = $_COOKIE['close_pages'] + $_COOKIE['close_helpers'] + $_COOKIE['close_services'] + $_COOKIE['close_friends'] + $_COOKIE['close_postit'] + $_COOKIE['close_lastusers'] + $_COOKIE['close_lastphotos'] + $_COOKIE['close_lastlikes']; + + if($ccCookie != "8") { // COMMUNITY diabook_blue_community_info(); // CUSTOM CSS $cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook-blue/style-network.css"; - + } } //right_aside at profile pages if ($a->argv[0] === "profile"){ - + if($ccCookie != "8") { // COMMUNITY diabook_blue_community_info(); // CUSTOM CSS $cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook-blue/style-profile.css"; - + } } // custom css if (!is_null($cssFile)) $a->page['htmlhead'] .= sprintf('', $cssFile); +//load jquery.cookie.js +$cookieJS = $a->get_baseurl($ssl_state)."/view/theme/diabook-blue/js/jquery.cookie.js"; +$a->page['htmlhead'] .= sprintf(' + + + + + EOT; -- cgit v1.2.3