From f78bdf663ab2a5541c1ee50aac7f954051166d4a Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 2 Mar 2014 00:45:42 +0100 Subject: [PATCH 1/5] Diaspora: set plink to the original url from the origin server --- include/diaspora.php | 48 ++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/include/diaspora.php b/include/diaspora.php index f40566267d..f8d72a2f80 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -861,10 +861,12 @@ function diaspora_post($importer,$xml,$msg) { foreach($matches as $mtch) { if(strlen($str_tags)) $str_tags .= ','; - $str_tags .= '@[url=' . $mtch[1] . '[/url]'; + $str_tags .= '@[url=' . $mtch[1] . '[/url]'; } } + $plink = 'https://'.substr($diaspora_handle,strpos($diaspora_handle,'@')+1).'/posts/'.$guid; + $datarray['uid'] = $importer['uid']; $datarray['contact-id'] = $contact['id']; $datarray['wall'] = 0; @@ -874,6 +876,7 @@ function diaspora_post($importer,$xml,$msg) { $datarray['created'] = $datarray['edited'] = datetime_convert('UTC','UTC',$created); $datarray['private'] = $private; $datarray['parent'] = 0; + $datarray['plink'] = $plink; $datarray['owner-name'] = $contact['name']; $datarray['owner-link'] = $contact['url']; //$datarray['owner-avatar'] = $contact['thumb']; @@ -891,12 +894,12 @@ function diaspora_post($importer,$xml,$msg) { $message_id = item_store($datarray); - if($message_id) { - q("update item set plink = '%s' where id = %d limit 1", - dbesc($a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id), - intval($message_id) - ); - } + //if($message_id) { + // q("update item set plink = '%s' where id = %d limit 1", + // dbesc($a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id), + // intval($message_id) + // ); + //} return; @@ -1030,6 +1033,8 @@ function diaspora_reshare($importer,$xml,$msg) { } } + $plink = 'https://'.substr($diaspora_handle,strpos($diaspora_handle,'@')+1).'/posts/'.$guid; + $datarray['uid'] = $importer['uid']; $datarray['contact-id'] = $contact['id']; $datarray['wall'] = 0; @@ -1039,6 +1044,7 @@ function diaspora_reshare($importer,$xml,$msg) { $datarray['created'] = $datarray['edited'] = datetime_convert('UTC','UTC',$created); $datarray['private'] = $private; $datarray['parent'] = 0; + $datarray['plink'] = $plink; $datarray['owner-name'] = $contact['name']; $datarray['owner-link'] = $contact['url']; $datarray['owner-avatar'] = ((x($contact,'thumb')) ? $contact['thumb'] : $contact['photo']); @@ -1064,12 +1070,12 @@ function diaspora_reshare($importer,$xml,$msg) { $message_id = item_store($datarray); - if($message_id) { - q("update item set plink = '%s' where id = %d limit 1", - dbesc($a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id), - intval($message_id) - ); - } + //if($message_id) { + // q("update item set plink = '%s' where id = %d limit 1", + // dbesc($a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id), + // intval($message_id) + // ); + //} return; @@ -1136,8 +1142,9 @@ function diaspora_asphoto($importer,$xml,$msg) { return; } - $datarray = array(); + $plink = 'https://'.substr($diaspora_handle,strpos($diaspora_handle,'@')+1).'/posts/'.$guid; + $datarray = array(); $datarray['uid'] = $importer['uid']; $datarray['contact-id'] = $contact['id']; @@ -1148,6 +1155,7 @@ function diaspora_asphoto($importer,$xml,$msg) { $datarray['created'] = $datarray['edited'] = datetime_convert('UTC','UTC',$created); $datarray['private'] = $private; $datarray['parent'] = 0; + $datarray['plink'] = $plink; $datarray['owner-name'] = $contact['name']; $datarray['owner-link'] = $contact['url']; //$datarray['owner-avatar'] = $contact['thumb']; @@ -1161,12 +1169,12 @@ function diaspora_asphoto($importer,$xml,$msg) { $message_id = item_store($datarray); - if($message_id) { - q("update item set plink = '%s' where id = %d limit 1", - dbesc($a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id), - intval($message_id) - ); - } + //if($message_id) { + // q("update item set plink = '%s' where id = %d limit 1", + // dbesc($a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id), + // intval($message_id) + // ); + //} return; From 9c87e00dd39e7d636a72544adeaeeb0be00fb8ab Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 2 Mar 2014 00:47:22 +0100 Subject: [PATCH 2/5] Preparation for a new variable that points to the post on the own friendica server --- include/text.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/include/text.php b/include/text.php index 0638f9e241..9761e5fc93 100644 --- a/include/text.php +++ b/include/text.php @@ -1608,16 +1608,19 @@ if(! function_exists('get_plink')) { * @return boolean|array False if item has not plink, otherwise array('href'=>plink url, 'title'=>translated title) */ function get_plink($item) { - $a = get_app(); - if (x($item,'plink') && ($item['private'] != 1)) { - return array( - 'href' => $item['plink'], + $a = get_app(); + $ret = array( + 'href' => $a->get_baseurl()."/display/".$a->user['nickname']."/".$item['id'], 'title' => t('link to source'), ); - } - else { - return false; - } + + $ret["orig"] = $ret["href"]; + + //if (x($item,'plink') && ($item['private'] != 1)) + if (x($item,'plink')) + $ret["href"] = $item['plink']; + + return($ret); }} if(! function_exists('unamp')) { From dc2e60d498249878f0f28df7545c51737c207874 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 2 Mar 2014 00:50:06 +0100 Subject: [PATCH 3/5] Disabling some features for several networks --- object/Item.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/object/Item.php b/object/Item.php index 0dfe915dea..2cb131f1a7 100644 --- a/object/Item.php +++ b/object/Item.php @@ -268,6 +268,26 @@ class Item extends BaseObject { $owner_name_e = $this->get_owner_name(); } + // Disable features that aren't available in several networks + if ($item["item_network"] != "dfrn") { + unset($buttons["dislike"]); + $tagger = ''; + } + + if ($item["item_network"] == "feed") + unset($buttons["like"]); + + if ($item["item_network"] == "mail") + unset($buttons["like"]); + + if (($item["item_network"] == "dspr") AND ($indent == 'comment')) + unset($buttons["like"]); + + // Facebook can like comments - but it isn't programmed in the connector yet. + if (($item["item_network"] == "face") AND ($indent == 'comment')) + unset($buttons["like"]); + + $tmp_item = array( 'template' => $this->get_template(), From 37edb3079de5104d334051a3fdab0197a20e6a84 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 2 Mar 2014 01:00:36 +0100 Subject: [PATCH 4/5] parse_url: Trim the content of the description field. --- mod/parse_url.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mod/parse_url.php b/mod/parse_url.php index 52083dfbcd..e50c94fd07 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -86,7 +86,7 @@ function parseurl_getsiteinfo($url, $no_guessing = false) { if (isset($oembed_data->title)) $siteinfo["title"] = $oembed_data->title; if (isset($oembed_data->description)) - $siteinfo["text"] = $oembed_data->description; + $siteinfo["text"] = trim($oembed_data->description); if (isset($oembed_data->thumbnail_url)) $siteinfo["image"] = $oembed_data->thumbnail_url; } @@ -159,7 +159,7 @@ function parseurl_getsiteinfo($url, $no_guessing = false) { foreach ($node->attributes as $attribute) $attr[$attribute->name] = $attribute->value; - $attr["content"] = html_entity_decode($attr["content"], ENT_QUOTES, "UTF-8"); + $attr["content"] = trim(html_entity_decode($attr["content"], ENT_QUOTES, "UTF-8")); switch (strtolower($attr["name"])) { case "fulltitle": @@ -197,7 +197,7 @@ function parseurl_getsiteinfo($url, $no_guessing = false) { foreach ($node->attributes as $attribute) $attr[$attribute->name] = $attribute->value; - $attr["content"] = html_entity_decode($attr["content"], ENT_QUOTES, "UTF-8"); + $attr["content"] = trim(html_entity_decode($attr["content"], ENT_QUOTES, "UTF-8")); switch (strtolower($attr["property"])) { case "og:image": @@ -280,7 +280,7 @@ function parseurl_getsiteinfo($url, $no_guessing = false) { while (strpos($text, " ")) $text = trim(str_replace(" ", " ", $text)); - $siteinfo["text"] = html_entity_decode(substr($text,0,350), ENT_QUOTES, "UTF-8").'...'; + $siteinfo["text"] = trim(html_entity_decode(substr($text,0,350), ENT_QUOTES, "UTF-8").'...'); } } From 2b5345323f2e79bce9dd503e948d37e5810bd16b Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 2 Mar 2014 01:29:20 +0100 Subject: [PATCH 5/5] "vier": Several design changes. New option for coloured network items. --- view/theme/vier/config.php | 3 +- view/theme/vier/css/font2.css | 2 +- view/theme/vier/netcolour.css | 34 +++++++++++++++ view/theme/vier/style.css | 50 ++++++----------------- view/theme/vier/templates/wall_thread.tpl | 13 +++--- view/theme/vier/theme.php | 2 + 6 files changed, 58 insertions(+), 46 deletions(-) create mode 100644 view/theme/vier/netcolour.css diff --git a/view/theme/vier/config.php b/view/theme/vier/config.php index 653d2c80df..b06551bed2 100644 --- a/view/theme/vier/config.php +++ b/view/theme/vier/config.php @@ -39,7 +39,8 @@ function theme_admin_post(&$a){ function vier_form(&$a, $style){ $styles = array( "shadow"=>"Shadow", - "flat"=>"Flat" + "flat"=>"Flat", + "netcolour"=>"Coloured Networks" ); $t = get_markup_template("theme_settings.tpl" ); $o .= replace_macros($t, array( diff --git a/view/theme/vier/css/font2.css b/view/theme/vier/css/font2.css index 2357af604b..289d75fe3b 100644 --- a/view/theme/vier/css/font2.css +++ b/view/theme/vier/css/font2.css @@ -30,7 +30,7 @@ } .icon.s10 { - font-size: 1em; + font-size: 0.7em; } .icon.s16 { font-size: 1.2em; diff --git a/view/theme/vier/netcolour.css b/view/theme/vier/netcolour.css new file mode 100644 index 0000000000..c76e5b0af4 --- /dev/null +++ b/view/theme/vier/netcolour.css @@ -0,0 +1,34 @@ +.tread-wrapper { + background-color: #fafafa; +} +.twit { + /* background-color: #FFFAFA; */ + background-color: #fafeff; +} +.pump { + /* background-color: #FAFFFA; */ + background-color: #fcfffa; +} +.face { + /* background-color: #FAFAFF; */ + background-color: #fafcff; +} +.feed { + /* background-color: #FFFFFA; */ + background-color: #fffdfa; +} +.dspr { + background-color: #FFFAFF; +} +.dfrn { + background-color: #FAFAFA; +} +.stat { + /* background-color: #FAFFFF; */ + background-color: #fffafd; +} +.mail { + /* background-color: #FFFFF9; */ + background-color: #fffafa; +} + diff --git a/view/theme/vier/style.css b/view/theme/vier/style.css index 87944a8614..7901612068 100644 --- a/view/theme/vier/style.css +++ b/view/theme/vier/style.css @@ -125,7 +125,8 @@ img { background-repeat: no-repeat; width: 18px; height: 18px; - display: block; + /* display: block; */ + display: inline-block; overflow: hidden; padding: 1px; color: #999; @@ -1116,18 +1117,18 @@ section.minimal { /* wall item */ .tread-wrapper { /* border-bottom: 1px solid #BDCDD4; */ -border-bottom: 1px solid #D2D2D2; + border-bottom: 1px solid #D2D2D2; position: relative; padding: 5px; margin-bottom: 10px; box-shadow: 1px 1px 6px -3px rgba(0, 0, 0, 0.7); - background-color: #FAFaFa; + background-color: #FFFFFF; /* width: 755px; */ } .wall-item-decor { position: absolute; left: 755px; - left: calc(100% - 7px); + left: calc(100% - 16px); /* top: -10px; */ width: 16px; } @@ -1157,15 +1158,19 @@ border-bottom: 1px solid #D2D2D2; .wall-item-bottom { /* font-size: 14px; */ } -.wall-item-container .wall-item-bottom { - opacity: 0; +/* .wall-item-container .wall-item-bottom { */ +.wall-item-container .wall-item-links, +.wall-item-container .wall-item-actions { + opacity: 0.2; -webkit-transition: all 0.2s ease-in-out; -moz-transition: all 0.2s ease-in-out; -o-transition: all 0.2s ease-in-out; -ms-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out; } -.wall-item-container:hover .wall-item-bottom { +/* .wall-item-container:hover .wall-item-bottom { */ +.wall-item-container:hover .wall-item-links, +.wall-item-container:hover .wall-item-actions { opacity: 1; -webkit-transition: all 0.2s ease-in-out; -moz-transition: all 0.2s ease-in-out; @@ -1448,37 +1453,6 @@ border-bottom: 1px solid #D2D2D2; padding-right: 12px; */ } -.twit { - /* background-color: #FFFAFA; */ - background-color: #fafeff; -} -.pump { - /* background-color: #FAFFFA; */ - background-color: #fcfffa; -} -.face { - /* background-color: #FAFAFF; */ - background-color: #fafcff; -} -.feed { - /* background-color: #FFFFFA; */ - background-color: #fffdfa; -} -.dspr { - background-color: #FFFAFF; -} -.dfrn { - background-color: #FAFAFA; -} -.stat { - /* background-color: #FAFFFF; */ - background-color: #fffafd; -} -.mail { - /* background-color: #FFFFF9; */ - background-color: #fffafa; -} - #profile-jot-form { box-shadow: 1px 1px 6px -3px #666; background-color: #fafafa; diff --git a/view/theme/vier/templates/wall_thread.tpl b/view/theme/vier/templates/wall_thread.tpl index 57e1fe9f20..3062b518f3 100644 --- a/view/theme/vier/templates/wall_thread.tpl +++ b/view/theme/vier/templates/wall_thread.tpl @@ -27,8 +27,8 @@ {{if $item.thread_level!=1}}
{{/if}}
- {{$item.star.starred}} - {{if $item.lock}}{{$item.lock}}{{/if}} + +
@@ -57,11 +57,11 @@
{{$item.name}} - {{if $item.owner_url}}{{$item.via}} {{$item.owner_name}} {{/if}} + {{if $item.owner_url}}{{$item.via}} {{$item.owner_name}} {{/if}} {{if $item.plink}}{{$item.created}}{{else}} {{$item.created}} {{/if}} - {{if $item.lock}}{{$item.lock}} {{/if}} + {{if $item.lock}}{{$item.lock}}{{/if}} {{$item.network_name}} @@ -92,7 +92,7 @@
@@ -100,8 +100,9 @@ {{/if}}{{/if}} {{if $item.vote}} + {{if $item.vote.like}} - {{if $item.vote.dislike}} + {{/if}}{{if $item.vote.dislike}} {{/if}} {{if $item.vote.share}} diff --git a/view/theme/vier/theme.php b/view/theme/vier/theme.php index ece90facea..e2d007732b 100644 --- a/view/theme/vier/theme.php +++ b/view/theme/vier/theme.php @@ -18,6 +18,8 @@ $a->theme_info = array(); $style = get_pconfig(local_user(), 'vier', 'style'); if ($style == "flat") $a->page['htmlhead'] .= ''."\n"; +else if ($style == "netcolour") + $a->page['htmlhead'] .= ''."\n"; $a->page['htmlhead'] .= <<< EOT