From 226bda9f58254bf2b77cd5e323385537f6dfe25f Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Sat, 28 Nov 2015 03:50:45 +0100 Subject: [PATCH 1/6] add missing info about if contact is forum to contact related pages --- mod/dirfind.php | 1 + mod/match.php | 1 + mod/suggest.php | 7 ++++--- mod/viewcontacts.php | 7 ++++--- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/mod/dirfind.php b/mod/dirfind.php index 6a4c7f1ced..3f9c82576a 100644 --- a/mod/dirfind.php +++ b/mod/dirfind.php @@ -205,6 +205,7 @@ function dirfind_content(&$a, $prefix = "") { 'details' => $contact_details['location'], 'tags' => $contact_details['keywords'], 'about' => $contact_details['about'], + 'account_type' => (($contact_details['community']) ? t('Forum') : ''), 'network' => network_to_name($jj->network, $jj->url), 'id' => ++$id, ); diff --git a/mod/match.php b/mod/match.php index db1cac0f78..3b0367b429 100644 --- a/mod/match.php +++ b/mod/match.php @@ -79,6 +79,7 @@ function match_content(&$a) { 'details' => $contact_details['location'], 'tags' => $contact_details['keywords'], 'about' => $contact_details['about'], + 'account_type' => (($contact_details['community']) ? t('Forum') : ''), 'thumb' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB), 'inttxt' => ' ' . t('is interested in:'), 'conntxt' => t('Connect'), diff --git a/mod/suggest.php b/mod/suggest.php index 578338b505..b73c2cd1b6 100644 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -36,7 +36,7 @@ function suggest_init(&$a) { } // Now check how the user responded to the confirmation query if(!$_REQUEST['canceled']) { - q("insert into gcign ( uid, gcid ) values ( %d, %d ) ", + q("INSERT INTO `gcign` ( `uid`, `gcid` ) VALUES ( %d, %d ) ", intval(local_user()), intval($_GET['ignore']) ); @@ -90,8 +90,9 @@ function suggest_content(&$a) { 'name' => $rr['name'], 'thumb' => proxy_url($rr['photo'], false, PROXY_SIZE_THUMB), 'details' => $contact_details['location'], - 'tags' => $contact_details['keywords'], - 'about' => $contact_details['about'], + 'tags' => $contact_details['keywords'], + 'about' => $contact_details['about'], + 'account_type' => (($contact_details['community']) ? t('Forum') : ''), 'ignlnk' => $ignlnk, 'ignid' => $rr['id'], 'conntxt' => t('Connect'), diff --git a/mod/viewcontacts.php b/mod/viewcontacts.php index f199574c69..c7f139e1e4 100644 --- a/mod/viewcontacts.php +++ b/mod/viewcontacts.php @@ -26,7 +26,7 @@ function viewcontacts_content(&$a) { } - $r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ", + $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ", intval($a->profile['uid']) ); if(count($r)) @@ -68,8 +68,9 @@ function viewcontacts_content(&$a) { 'name' => htmlentities(substr($rr['name'],0,20)), 'username' => htmlentities($rr['name']), 'details' => $contact_details['location'], - 'tags' => $contact_details['keywords'], - 'about' => $contact_details['about'], + 'tags' => $contact_details['keywords'], + 'about' => $contact_details['about'], + 'account_type' => (($contact_details['community']) ? t('Forum') : ''), 'url' => $url, 'sparkle' => '', 'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']), From 20befee9eda5238fbd4691df8ccf88e7d497a2cf Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 28 Nov 2015 13:15:00 +0100 Subject: [PATCH 2/6] Dupilcated tags shouldn't happen anymore when parsing a webpage. --- mod/parse_url.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mod/parse_url.php b/mod/parse_url.php index 97eebb89ab..ef051d9f6b 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -280,7 +280,8 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co if (isset($keywords)) { $siteinfo["keywords"] = array(); foreach ($keywords as $keyword) - $siteinfo["keywords"][] = trim($keyword); + if (!in_array(trim($keyword), $siteinfo["keywords"])) + $siteinfo["keywords"][] = trim($keyword); } //$list = $xpath->query("head/meta[@property]"); From 1c640902177afad3dfe3d38db723414ff47a8a01 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 28 Nov 2015 14:29:14 +0100 Subject: [PATCH 3/6] Avoid duplicated tags --- include/bb2diaspora.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index fc05e720f4..a8b39f741a 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -83,7 +83,6 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) { 'return \'#\'. str_replace(\' \', \'_\', $match[2]);' ), $Text); - // Converting images with size parameters to simple images. Markdown doesn't know it. $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '[img]$3[/img]', $Text); @@ -94,11 +93,12 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) { // Add all tags that maybe were removed if (preg_match_all("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",$OriginalText, $tags)) { $tagline = ""; - foreach($tags[2] as $tag) - if (!strpos($Text, "#".$tag)) + foreach($tags[2] as $tag) { + $tag = html_entity_decode($tag, ENT_QUOTES, 'UTF-8'); + if (!strpos(html_entity_decode($Text, ENT_QUOTES, 'UTF-8'), "#".$tag)) $tagline .= "#".$tag." "; - - $Text = $Text."
".$tagline; + } + $Text = $Text." ".$tagline; } } else From 388847e1f371554f50613357de06cf4a6ec751c9 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 28 Nov 2015 18:11:34 +0100 Subject: [PATCH 4/6] Issue 1779: There is now an atom feed link under the connect link on the profile page --- include/identity.php | 8 +++++++- mod/item.php | 3 +-- view/templates/profile_vcard.tpl | 3 +++ view/theme/duepuntozero/style.css | 1 + view/theme/duepuntozero/templates/profile_vcard.tpl | 3 +++ view/theme/frost/style.css | 1 + view/theme/frost/templates/profile_vcard.tpl | 5 +++-- view/theme/quattro/dark/style.css | 2 ++ view/theme/quattro/green/style.css | 2 ++ view/theme/quattro/lilac/style.css | 2 ++ view/theme/quattro/templates/profile_vcard.tpl | 3 +++ view/theme/smoothly/style.css | 3 +++ view/theme/vier/style.css | 3 +++ view/theme/vier/templates/profile_vcard.tpl | 3 +++ 14 files changed, 37 insertions(+), 5 deletions(-) diff --git a/include/identity.php b/include/identity.php index a785ce981d..0282b2d9a5 100644 --- a/include/identity.php +++ b/include/identity.php @@ -216,7 +216,12 @@ if(! function_exists('profile_sidebar')) { } if ($connect AND ($profile['network'] != NETWORK_DFRN) AND !isset($profile['remoteconnect'])) - $connect = false; + $connect = false; + + if ($connect) + $subscribe_feed = t("Atom feed"); + else + $subscribe_feed = false; if (isset($profile['remoteconnect'])) $remoteconnect = $profile['remoteconnect']; @@ -337,6 +342,7 @@ if(! function_exists('profile_sidebar')) { '$profile' => $p, '$connect' => $connect, '$remoteconnect' => $remoteconnect, + '$subscribe_feed' => $subscribe_feed, '$wallmessage' => $wallmessage, '$location' => $location, '$gender' => $gender, diff --git a/mod/item.php b/mod/item.php index 91a94974e9..a2b88a8e30 100644 --- a/mod/item.php +++ b/mod/item.php @@ -362,8 +362,7 @@ function item_post(&$a) { if((local_user()) && (local_user() == $profile_uid)) { $self = true; $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1", - intval($_SESSION['uid']) - ); + intval($_SESSION['uid'])); } elseif(remote_user()) { if(is_array($_SESSION['remote'])) { diff --git a/view/templates/profile_vcard.tpl b/view/templates/profile_vcard.tpl index 05e44432fd..fa209bf46f 100644 --- a/view/templates/profile_vcard.tpl +++ b/view/templates/profile_vcard.tpl @@ -55,6 +55,9 @@ {{if $wallmessage}}
  • {{$wallmessage}}
  • {{/if}} + {{if $subscribe_feed}} +
  • {{$subscribe_feed}}
  • + {{/if}} diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index 255a1d089a..eef8ad4ad8 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -205,6 +205,7 @@ aside { font-weight: bold; background: #3465a4 url('friendica-16.png') no-repeat 95% center; } +#subscribe-feed-link, #wallmessage-link { display: block; color: #FFFFFF; diff --git a/view/theme/duepuntozero/templates/profile_vcard.tpl b/view/theme/duepuntozero/templates/profile_vcard.tpl index bf2eb27349..fb5d4e420e 100644 --- a/view/theme/duepuntozero/templates/profile_vcard.tpl +++ b/view/theme/duepuntozero/templates/profile_vcard.tpl @@ -47,6 +47,9 @@ {{if $wallmessage}}
  • {{$wallmessage}}
  • {{/if}} + {{if $subscribe_feed}} +
  • {{$subscribe_feed}}
  • + {{/if}} diff --git a/view/theme/frost/style.css b/view/theme/frost/style.css index 24fe47559a..2edb9221c6 100644 --- a/view/theme/frost/style.css +++ b/view/theme/frost/style.css @@ -284,6 +284,7 @@ aside { /* float:left;*/ } +#subscribe-feed-link, #dfrn-request-link { display: block; color: #FFFFFF; diff --git a/view/theme/frost/templates/profile_vcard.tpl b/view/theme/frost/templates/profile_vcard.tpl index 5157408713..b8f59ccaa8 100644 --- a/view/theme/frost/templates/profile_vcard.tpl +++ b/view/theme/frost/templates/profile_vcard.tpl @@ -43,10 +43,11 @@ {{if $wallmessage}}
  • {{$wallmessage}}
  • {{/if}} + {{if $subscribe_feed}} +
  • {{$subscribe_feed}}
  • + {{/if}} {{$contact_block}} - - diff --git a/view/theme/quattro/dark/style.css b/view/theme/quattro/dark/style.css index 25102ba31d..785b527b27 100644 --- a/view/theme/quattro/dark/style.css +++ b/view/theme/quattro/dark/style.css @@ -838,6 +838,7 @@ aside #profile-extra-links li { margin: 0px; list-style: none; } +aside #subscribe-feed-link, aside #wallmessage-link { display: block; -moz-border-radius: 5px 5px 5px 5px; @@ -850,6 +851,7 @@ aside #wallmessage-link { padding: 4px 2px 2px 35px; margin-top: 3px; } +aside #subscribe-feed:hover, aside #wallmessage-link:hover { text-decoration: none; background-color: #19aeff; diff --git a/view/theme/quattro/green/style.css b/view/theme/quattro/green/style.css index 78de886542..7335440319 100644 --- a/view/theme/quattro/green/style.css +++ b/view/theme/quattro/green/style.css @@ -854,6 +854,7 @@ aside #wallmessage-link:hover { text-decoration: none; background-color: #ccff42; } +aside #subscribe-feed-link, aside #dfrn-request-link { display: block; -moz-border-radius: 5px 5px 5px 5px; @@ -865,6 +866,7 @@ aside #dfrn-request-link { text-transform: uppercase; padding: 4px 2px 2px 35px; } +aside #subscribe-feed-link:hover, aside #dfrn-request-link:hover { text-decoration: none; background-color: #ccff42; diff --git a/view/theme/quattro/lilac/style.css b/view/theme/quattro/lilac/style.css index 1ca27b895c..c5027928b2 100644 --- a/view/theme/quattro/lilac/style.css +++ b/view/theme/quattro/lilac/style.css @@ -854,6 +854,7 @@ aside #wallmessage-link:hover { text-decoration: none; background-color: #86608e; } +aside #subscribe-feed-link, aside #dfrn-request-link { display: block; -moz-border-radius: 5px 5px 5px 5px; @@ -865,6 +866,7 @@ aside #dfrn-request-link { text-transform: uppercase; padding: 4px 2px 2px 35px; } +aside #subscribe-feed-link:hover, aside #dfrn-request-link:hover { text-decoration: none; background-color: #86608e; diff --git a/view/theme/quattro/templates/profile_vcard.tpl b/view/theme/quattro/templates/profile_vcard.tpl index dfa6d0445d..7a06e7588f 100644 --- a/view/theme/quattro/templates/profile_vcard.tpl +++ b/view/theme/quattro/templates/profile_vcard.tpl @@ -73,6 +73,9 @@ {{if $wallmessage}}
  • {{$wallmessage}}
  • {{/if}} + {{if $subscribe_feed}} +
  • {{$subscribe_feed}}
  • + {{/if}} diff --git a/view/theme/smoothly/style.css b/view/theme/smoothly/style.css index ba0c4bff6e..06f32abcdf 100644 --- a/view/theme/smoothly/style.css +++ b/view/theme/smoothly/style.css @@ -690,6 +690,7 @@ aside h4 { list-style: none; } +#subscribe-feed-link, #dfrn-request-link { box-shadow: inset 0px 1px 0px 0px #a65151; -moz-box-shadow: inset 0px 1px 0px 0px #a65151; @@ -725,6 +726,7 @@ aside h4 { background-color: #3465a4; } +#subscribe-feed-link:hover, #dfrn-request-link:hover { background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #1873a2), color-stop(1, #6da6c4) ); background: -moz-linear-gradient( center top, #1873a2 5%, #6da6c4 100% ); @@ -732,6 +734,7 @@ aside h4 { background-color: #1873a2; } +#subscribe-feed-link:active, #dfrn-request-link:active { position: relative; top: 1px; diff --git a/view/theme/vier/style.css b/view/theme/vier/style.css index ecbb2ad96c..07d72c0dde 100644 --- a/view/theme/vier/style.css +++ b/view/theme/vier/style.css @@ -1004,9 +1004,11 @@ aside #profile-extra-links ul { } aside #profile-extra-links li { padding: 0px; + padding-bottom: 4px; margin: 0px; list-style: none; } +aside #subscribe-feed-link, aside #dfrn-request-link, aside #wallmessage-link { display: block; @@ -1019,6 +1021,7 @@ aside #wallmessage-link { text-transform: uppercase; padding: 4px 2px 2px 35px; } +aside #subscribe-feed-link:hover, aside #dfrn-request-link:hover, aside #wallmessage-link:hover { text-decoration: none; diff --git a/view/theme/vier/templates/profile_vcard.tpl b/view/theme/vier/templates/profile_vcard.tpl index c5a51ccbaf..1882c15583 100644 --- a/view/theme/vier/templates/profile_vcard.tpl +++ b/view/theme/vier/templates/profile_vcard.tpl @@ -66,6 +66,9 @@ {{if $wallmessage}}
  • {{$wallmessage}}
  • {{/if}} + {{if $subscribe_feed}} +
  • {{$subscribe_feed}}
  • + {{/if}} From a3059d02d40684f2bc1a0439c979ca7f79d8f10f Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Sat, 28 Nov 2015 20:09:28 +0100 Subject: [PATCH 5/6] group_side - unify look with forumlist --- include/group.php | 34 ++++++++++++------ mod/contacts.php | 2 +- mod/group.php | 2 +- mod/network.php | 2 +- mod/nogroup.php | 2 +- view/templates/group_side.tpl | 68 ++++++++++++++++++----------------- view/theme/smoothly/style.css | 3 +- view/theme/vier/style.css | 13 ++++--- 8 files changed, 74 insertions(+), 52 deletions(-) diff --git a/include/group.php b/include/group.php index fe29d39f1a..862d06818d 100644 --- a/include/group.php +++ b/include/group.php @@ -213,9 +213,20 @@ function mini_group_select($uid,$gid = 0) { } - - -function group_side($every="contacts",$each="group",$edit = false, $group_id = 0, $cid = 0) { +/** + * @brief Create group sidebar widget + * + * @param string $every + * @param string $each + * @param string $editmode + * 'standard' => include link 'Edit groups' + * 'extended' => include link 'Create new group' + * 'full' => include link 'Create new group' and provide for each group a link to edit this group + * @param int $group_id + * @param int $cid + * @return string + */ +function group_side($every="contacts",$each="group",$editmode = "standard", $group_id = 0, $cid = 0) { $o = ''; @@ -239,13 +250,13 @@ function group_side($every="contacts",$each="group",$edit = false, $group_id = 0 $member_of = array(); if($cid) { $member_of = groups_containing(local_user(),$cid); - } + } if(count($r)) { foreach($r as $rr) { $selected = (($group_id == $rr['id']) ? ' group-selected' : ''); - if ($edit) { + if ($editmode == "full") { $groupedit = array( 'href' => "group/".$rr['id'], 'title' => t('edit'), @@ -269,14 +280,17 @@ function group_side($every="contacts",$each="group",$edit = false, $group_id = 0 $tpl = get_markup_template("group_side.tpl"); $o = replace_macros($tpl, array( - '$title' => t('Groups'), + '$title' => t('Groups'), + 'newgroup' => (($editmode == "extended") || ($editmode == "full") ? 1 : ''), + '$editgroupstext' => t('Edit groups'), + 'grouppage' => "group/", '$edittext' => t('Edit group'), '$createtext' => t('Create a new group'), - '$creategroup' => t('Group Name: '), - '$form_security_token' => get_form_security_token("group_edit"), + '$creategroup' => t('Group Name: '), + '$form_security_token' => get_form_security_token("group_edit"), '$ungrouped' => (($every === 'contacts') ? t('Contacts not in any group') : ''), - '$groups' => $groups, - '$add' => t('add'), + '$groups' => $groups, + '$add' => t('add'), )); diff --git a/mod/contacts.php b/mod/contacts.php index 017b1d6435..1dc886363a 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -55,7 +55,7 @@ function contacts_init(&$a) { $findpeople_widget .= findpeople_widget(); } - $groups_widget .= group_side('contacts','group',false,0,$contact_id); + $groups_widget .= group_side('contacts','group','full',0,$contact_id); $a->page['aside'] .= replace_macros(get_markup_template("contacts-widget-sidebar.tpl"),array( '$vcard_widget' => $vcard_widget, diff --git a/mod/group.php b/mod/group.php index 263586e2e9..e9f9561f46 100644 --- a/mod/group.php +++ b/mod/group.php @@ -7,7 +7,7 @@ function validate_members(&$item) { function group_init(&$a) { if(local_user()) { require_once('include/group.php'); - $a->page['aside'] = group_side('contacts','group',false,(($a->argc > 1) ? intval($a->argv[1]) : 0)); + $a->page['aside'] = group_side('contacts','group','extended',(($a->argc > 1) ? intval($a->argv[1]) : 0)); } } diff --git a/mod/network.php b/mod/network.php index 903ee41548..fd22f3e192 100644 --- a/mod/network.php +++ b/mod/network.php @@ -145,7 +145,7 @@ function network_init(&$a) { )); } - $a->page['aside'] .= (feature_enabled(local_user(),'groups') ? group_side('network/0','network',true,$group_id) : ''); + $a->page['aside'] .= (feature_enabled(local_user(),'groups') ? group_side('network/0','network','standard',$group_id) : ''); $a->page['aside'] .= (feature_enabled(local_user(),'forumlist_widget') ? widget_forumlist($a) : ''); $a->page['aside'] .= posted_date_widget($a->get_baseurl() . '/network',local_user(),false); $a->page['aside'] .= networks_widget($a->get_baseurl(true) . '/network',(x($_GET, 'nets') ? $_GET['nets'] : '')); diff --git a/mod/nogroup.php b/mod/nogroup.php index 06fa730e0d..9f6e978433 100644 --- a/mod/nogroup.php +++ b/mod/nogroup.php @@ -15,7 +15,7 @@ function nogroup_init(&$a) { if(! x($a->page,'aside')) $a->page['aside'] = ''; - $a->page['aside'] .= group_side('contacts','group',false,0,$contact_id); + $a->page['aside'] .= group_side('contacts','group','extended',0,$contact_id); } diff --git a/view/templates/group_side.tpl b/view/templates/group_side.tpl index 4905c2fa1a..466882370f 100644 --- a/view/templates/group_side.tpl +++ b/view/templates/group_side.tpl @@ -1,38 +1,42 @@
    -

    {{$title}}

    +

    {{$title}}

    - diff --git a/view/theme/smoothly/style.css b/view/theme/smoothly/style.css index ba0c4bff6e..3b6b73dc6e 100644 --- a/view/theme/smoothly/style.css +++ b/view/theme/smoothly/style.css @@ -854,7 +854,8 @@ li.widget-list { padding: 3px 24px; } -#sidebar-new-group { +#sidebar-new-group, +#sidebar-edit-groups { padding: 7px; width: 165px; margin: auto; diff --git a/view/theme/vier/style.css b/view/theme/vier/style.css index ecbb2ad96c..5bd475759f 100644 --- a/view/theme/vier/style.css +++ b/view/theme/vier/style.css @@ -347,7 +347,7 @@ code { display: inline-block; min-width: 10px; padding: 3px 7px; - font-size: 12px; + font-size: 10px; font-weight: 700; line-height: 1; color: #fff; @@ -382,7 +382,7 @@ code { #sidebar-group-list .tool:hover { background: #EEE; } -#sidebar-group-list .notify { +/*#sidebar-group-list .notify { min-width: 10px; text-align: center; color: #FFF; @@ -391,6 +391,9 @@ code { padding: 3px; border-radius: 10px; display: none; +}*/ +#sidebar-group-list .notify { + display: none; } #sidebar-group-list .notify.show { display: inline-block; } .tool .label { @@ -416,7 +419,7 @@ code { opacity: 1; } -.sidebar-group-li:hover, #sidebar-new-group:hover, #forum-widget-collapse:hover, +.sidebar-group-li:hover, #sidebar-new-group:hover, #sidebar-edit-groups:hover, #forum-widget-collapse:hover, #sidebar-ungrouped:hover, .side-link:hover, .nets-ul li:hover, #forumlist-sidebar li:hover, #forumlist-sidebar-right li:hover, .nets-all:hover, .saved-search-li:hover, li.tool:hover, .admin.link:hover, aside h4 a:hover, right_aside h4 a:hover, #message-new:hover { /* background-color: #ddd; */ @@ -436,7 +439,7 @@ code { font-weight: bold; } -#forum-widget-showmore, #sidebar-new-group, #forum-widget-collapse, #forumlist-rsidebar-right, #sidebar-ungrouped, +#forum-widget-showmore, #sidebar-new-group, #sidebar-edit-groups, #forum-widget-collapse, #forumlist-rsidebar-right, #sidebar-ungrouped, .side-link, #peoplefind-desc, #connect-desc, .nets-all, .admin.link, #message-new { padding-left: 10px; padding-top: 3px; @@ -464,7 +467,7 @@ code { display: inline-block; } -a.nets-link, .side-link a, #sidebar-new-group a, a.savedsearchterm, a.fileas-link, aside h4 a, right_aside h4 a { +a.nets-link, .side-link a, #sidebar-new-group a, #sidebar-edit-groups a, a.savedsearchterm, a.fileas-link, aside h4 a, right_aside h4 a { display: block; color: #737373; } From f5597da059b126b6910cfeee7f5d154fa49cdf0b Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Sat, 28 Nov 2015 23:52:12 +0100 Subject: [PATCH 6/6] forumlist - mark selected forum as selected --- include/forums.php | 15 ++++-- mod/network.php | 4 +- view/templates/widget_forumlist.tpl | 4 +- view/theme/duepuntozero/style.css | 2 +- view/theme/frost-mobile/style.css | 2 +- view/theme/frost/style.css | 2 +- .../quattro/templates/widget_forumlist.tpl | 46 +++++++++++++++++++ view/theme/vier/style.css | 2 +- .../vier/templates/widget_forumlist_right.tpl | 8 ++-- view/theme/vier/theme.php | 10 +++- 10 files changed, 77 insertions(+), 18 deletions(-) create mode 100644 view/theme/quattro/templates/widget_forumlist.tpl diff --git a/include/forums.php b/include/forums.php index 59bf5a6b07..995a29cad1 100644 --- a/include/forums.php +++ b/include/forums.php @@ -60,10 +60,12 @@ function get_forumlist($uid, $showhidden = true, $lastitem, $showprivate = false * Sidebar widget to show subcribed friendica forums. If activated * in the settings, it appears at the notwork page sidebar * - * @param App $a + * @param int $uid + * @param int $cid + * The contact id which is used to mark a forum as "selected" * @return string */ -function widget_forumlist($a) { +function widget_forumlist($uid,$cid = 0) { if(! intval(feature_enabled(local_user(),'forumlist_widget'))) return; @@ -73,7 +75,7 @@ function widget_forumlist($a) { //sort by last updated item $lastitem = true; - $contacts = get_forumlist($a->user['uid'],true,$lastitem, true); + $contacts = get_forumlist($uid,true,$lastitem, true); $total = count($contacts); $visible_forums = 10; @@ -83,11 +85,14 @@ function widget_forumlist($a) { foreach($contacts as $contact) { + $selected = (($cid == $contact['id']) ? ' forum-selected' : ''); + $entry = array( - 'url' => $a->get_baseurl() . '/network?f=&cid=' . $contact['id'], - 'external_url' => $a->get_baseurl() . '/redir/' . $contact['id'], + 'url' => z_root() . '/network?f=&cid=' . $contact['id'], + 'external_url' => z_root() . '/redir/' . $contact['id'], 'name' => $contact['name'], 'cid' => $contact['id'], + 'selected' => $selected, 'micro' => proxy_url($contact['micro'], false, PROXY_SIZE_MICRO), 'id' => ++$id, ); diff --git a/mod/network.php b/mod/network.php index fd22f3e192..f18e3001d0 100644 --- a/mod/network.php +++ b/mod/network.php @@ -6,6 +6,8 @@ function network_init(&$a) { } $is_a_date_query = false; + if(x($_GET['cid']) && intval($_GET['cid']) != 0) + $cid = $_GET['cid']; if($a->argc > 1) { for($x = 1; $x < $a->argc; $x ++) { @@ -146,7 +148,7 @@ function network_init(&$a) { } $a->page['aside'] .= (feature_enabled(local_user(),'groups') ? group_side('network/0','network','standard',$group_id) : ''); - $a->page['aside'] .= (feature_enabled(local_user(),'forumlist_widget') ? widget_forumlist($a) : ''); + $a->page['aside'] .= (feature_enabled(local_user(),'forumlist_widget') ? widget_forumlist(local_user(),$cid) : ''); $a->page['aside'] .= posted_date_widget($a->get_baseurl() . '/network',local_user(),false); $a->page['aside'] .= networks_widget($a->get_baseurl(true) . '/network',(x($_GET, 'nets') ? $_GET['nets'] : '')); $a->page['aside'] .= saved_searches($search); diff --git a/view/templates/widget_forumlist.tpl b/view/templates/widget_forumlist.tpl index 54d7df82d2..32da71f816 100644 --- a/view/templates/widget_forumlist.tpl +++ b/view/templates/widget_forumlist.tpl @@ -24,7 +24,7 @@ function showHideForumlist() { {{$forum.link_desc}} - {{$forum.name}} + {{$forum.name}} {{/if}} @@ -34,7 +34,7 @@ function showHideForumlist() { {{$forum.link_desc}} - {{$forum.name}} + {{$forum.name}} {{/if}} {{/foreach}} diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index 255a1d089a..cbf0410359 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -340,7 +340,7 @@ div.wall-item-content-wrapper.shiny { margin-bottom: 10px; } -.group-selected, .nets-selected, .fileas-selected, .categories-selected { +.group-selected, .nets-selected, .fileas-selected, .categories-selected, .forum-selected { padding: 3px; -moz-border-radius: 3px; border-radius: 3px; diff --git a/view/theme/frost-mobile/style.css b/view/theme/frost-mobile/style.css index 4485c056ff..9a0c50e1e7 100644 --- a/view/theme/frost-mobile/style.css +++ b/view/theme/frost-mobile/style.css @@ -511,7 +511,7 @@ footer { margin-bottom: 10px; } -.group-selected, .nets-selected, .fileas-selected, .categories-selected { +.group-selected, .nets-selected, .fileas-selected, .categories-selected, .forum-selected { padding: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; diff --git a/view/theme/frost/style.css b/view/theme/frost/style.css index 24fe47559a..c0e85facb0 100644 --- a/view/theme/frost/style.css +++ b/view/theme/frost/style.css @@ -489,7 +489,7 @@ div.wall-item-content-wrapper.shiny { margin-bottom: 10px; } -.group-selected, .nets-selected, .fileas-selected, .categories-selected { +.group-selected, .nets-selected, .fileas-selected, .categories-selected, .forum-selected { padding: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; diff --git a/view/theme/quattro/templates/widget_forumlist.tpl b/view/theme/quattro/templates/widget_forumlist.tpl new file mode 100644 index 0000000000..35c54bc690 --- /dev/null +++ b/view/theme/quattro/templates/widget_forumlist.tpl @@ -0,0 +1,46 @@ + + +
    +

    {{$title}}

    + + +
    diff --git a/view/theme/vier/style.css b/view/theme/vier/style.css index 5bd475759f..fcc6c7b8cc 100644 --- a/view/theme/vier/style.css +++ b/view/theme/vier/style.css @@ -435,7 +435,7 @@ code { /* color: #000; */ } -.group-selected, .nets-selected, .fileas-selected { +.group-selected, .nets-selected, .fileas-selected, .forum-selected { font-weight: bold; } diff --git a/view/theme/vier/templates/widget_forumlist_right.tpl b/view/theme/vier/templates/widget_forumlist_right.tpl index 49e7723e8e..93f8e8f105 100644 --- a/view/theme/vier/templates/widget_forumlist_right.tpl +++ b/view/theme/vier/templates/widget_forumlist_right.tpl @@ -20,21 +20,21 @@ function showHideForumlist() { {{foreach $forums as $forum}} {{if $forum.id <= $visible_forums}} {{/if}} {{if $forum.id > $visible_forums}} {{/if}} {{/foreach}} diff --git a/view/theme/vier/theme.php b/view/theme/vier/theme.php index 789ba1daf1..91c384f805 100644 --- a/view/theme/vier/theme.php +++ b/view/theme/vier/theme.php @@ -222,6 +222,9 @@ function vier_community_info() { require_once('include/forums.php'); + if(x($_GET['cid']) && intval($_GET['cid']) != 0) + $cid = $_GET['cid']; + //sort by last updated item $lastitem = true; @@ -235,11 +238,14 @@ function vier_community_info() { foreach($contacts as $contact) { + $selected = (($cid == $contact['id']) ? ' forum-selected' : ''); + $entry = array( - 'url' => $a->get_baseurl() . '/network?f=&cid=' . $contact['id'], - 'external_url' => $a->get_baseurl() . '/redir/' . $contact['id'], + 'url' => z_root() . '/network?f=&cid=' . $contact['id'], + 'external_url' => z_root() . '/redir/' . $contact['id'], 'name' => $contact['name'], 'cid' => $contact['id'], + 'selected' => $selected, 'micro' => proxy_url($contact['micro'], false, PROXY_SIZE_MICRO), 'id' => ++$id, );