New option to enable and disable the "share" element

Changes to "vier" to use more "font awesome" icons
This commit is contained in:
Michael Vogel 2012-12-21 00:08:58 +01:00
parent 8e194cb411
commit f4bc5c57f3
9 changed files with 110 additions and 152 deletions

View file

@ -92,5 +92,5 @@ $a->config['system']['lockpath'] = "";
// If enabled, the MyBB fulltext engine is used // If enabled, the MyBB fulltext engine is used
// $a->config['system']['use_fulltext_engine'] = true; // $a->config['system']['use_fulltext_engine'] = true;
// Let reshared messages look like wall-to-wall posts // Use the new "share" element
// $a->config['system']['diaspora_newreshare'] = true; // $a->config['system']['new_share'] = true;

View file

@ -3,6 +3,14 @@
require_once("include/oembed.php"); require_once("include/oembed.php");
require_once('include/event.php'); require_once('include/event.php');
function bb_cleanstyle($st) {
return "<span style=\"".cleancss($st[1]).";\">".$st[2]."</span>";
}
function bb_cleanclass($st) {
return "<span class=\"".cleancss($st[1])."\">".$st[2]."</span>";
}
function cleancss($input) { function cleancss($input) {
$cleaned = ""; $cleaned = "";
@ -385,10 +393,10 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
$Text = str_replace("[*]", "<li>", $Text); $Text = str_replace("[*]", "<li>", $Text);
// Check for style sheet commands // Check for style sheet commands
$Text = preg_replace("(\[style=(.*?)\](.*?)\[\/style\])ism","<span style=\"$1;\">$2</span>",$Text); $Text = preg_replace_callback("(\[style=(.*?)\](.*?)\[\/style\])ism","bb_cleanstyle",$Text);
// Check for CSS classes // Check for CSS classes
$Text = preg_replace("(\[class=(.*?)\](.*?)\[\/class\])ism","<span class=\"$1\">$2</span>",$Text); $Text = preg_replace_callback("(\[class=(.*?)\](.*?)\[\/class\])ism","bb_cleanclass",$Text);
// handle nested lists // handle nested lists
$endlessloop = 0; $endlessloop = 0;

View file

@ -960,12 +960,12 @@ function diaspora_reshare($importer,$xml,$msg) {
$person = find_diaspora_person_by_handle($orig_author); $person = find_diaspora_person_by_handle($orig_author);
if(is_array($person) && x($person,'name') && x($person,'url')) /*if(is_array($person) && x($person,'name') && x($person,'url'))
$details = '[url=' . $person['url'] . ']' . $person['name'] . '[/url]'; $details = '[url=' . $person['url'] . ']' . $person['name'] . '[/url]';
else else
$details = $orig_author; $details = $orig_author;
$prefix = html_entity_decode("&#x2672; ", ENT_QUOTES, 'UTF-8') . $details . "\n"; $prefix = html_entity_decode("&#x2672; ", ENT_QUOTES, 'UTF-8') . $details . "\n";*/
// allocate a guid on our system - we aren't fixing any collisions. // allocate a guid on our system - we aren't fixing any collisions.
@ -1024,15 +1024,7 @@ function diaspora_reshare($importer,$xml,$msg) {
$datarray['owner-name'] = $contact['name']; $datarray['owner-name'] = $contact['name'];
$datarray['owner-link'] = $contact['url']; $datarray['owner-link'] = $contact['url'];
$datarray['owner-avatar'] = ((x($contact,'thumb')) ? $contact['thumb'] : $contact['photo']); $datarray['owner-avatar'] = ((x($contact,'thumb')) ? $contact['thumb'] : $contact['photo']);
if (intval(get_config('system','diaspora_newreshare'))) { if (intval(get_config('system','new_share'))) {
// Let reshared messages look like wall-to-wall posts
// we have to set an additional value in the item in the future
// to distinct the wall-to-wall-posts from reshared/repeated messages
$datarray['author-name'] = $person['name'];
$datarray['author-link'] = $person['url'];
$datarray['author-avatar'] = ((x($person,'thumb')) ? $person['thumb'] : $person['photo']);
$datarray['body'] = $body;
} else {
$prefix = "[share author='".$person['name']. $prefix = "[share author='".$person['name'].
"' profile='".$person['url']. "' profile='".$person['url'].
"' avatar='".((x($person,'thumb')) ? $person['thumb'] : $person['photo']). "' avatar='".((x($person,'thumb')) ? $person['thumb'] : $person['photo']).
@ -1041,6 +1033,12 @@ function diaspora_reshare($importer,$xml,$msg) {
$datarray['author-link'] = $contact['url']; $datarray['author-link'] = $contact['url'];
$datarray['author-avatar'] = $contact['thumb']; $datarray['author-avatar'] = $contact['thumb'];
$datarray['body'] = $prefix.$body."[/share]"; $datarray['body'] = $prefix.$body."[/share]";
} else {
// Let reshared messages look like wall-to-wall posts
$datarray['author-name'] = $person['name'];
$datarray['author-link'] = $person['url'];
$datarray['author-avatar'] = ((x($person,'thumb')) ? $person['thumb'] : $person['photo']);
$datarray['body'] = $body;
} }
$datarray['tag'] = $str_tags; $datarray['tag'] = $str_tags;

View file

@ -808,20 +808,22 @@ function get_atom_elements($feed,$item) {
if (($name != "") and ($uri != "") and ($avatar != "") and ($message != "")) { if (($name != "") and ($uri != "") and ($avatar != "") and ($message != "")) {
logger('get_atom_elements: fixing sender of repeated message.'); logger('get_atom_elements: fixing sender of repeated message.');
/*$res["owner-name"] = $res["author-name"]; if (intval(get_config('system','new_share'))) {
$res["owner-link"] = $res["author-link"]; $prefix = "[share author='".$name.
$res["owner-avatar"] = $res["author-avatar"]; "' profile='".$uri.
"' avatar='".$avatar.
"' link='".$orig_uri."']";
$res["author-name"] = $name; $res["body"] = $prefix.html2bbcode($message)."[/share]";
$res["author-link"] = $uri; } else {
$res["author-avatar"] = $avatar;*/ $res["owner-name"] = $res["author-name"];
$res["owner-link"] = $res["author-link"];
$res["owner-avatar"] = $res["author-avatar"];
$prefix = "[share author='".$name. $res["author-name"] = $name;
"' profile='".$uri. $res["author-link"] = $uri;
"' avatar='".$avatar. $res["author-avatar"] = $avatar;
"' link='".$orig_uri."']"; }
$res["body"] = $prefix.html2bbcode($message)."[/share]";
} }
} }

View file

@ -18,15 +18,30 @@ function share_init(&$a) {
if(! count($r) || ($r[0]['private'] == 1)) if(! count($r) || ($r[0]['private'] == 1))
killme(); killme();
$o = ''; if (intval(get_config('system','new_share'))) {
if (strpos($r[0]['body'], "[/share]") !== false) {
$pos = strpos($r[0]['body'], "[share");
$o = substr($r[0]['body'], $pos);
} else {
$o = "[share author='".$r[0]['author-name'].
"' profile='".$r[0]['author-link'].
"' avatar='".$r[0]['author-avatar'].
"' link='".$r[0]['plink']."']\n";
if($r[0]['title'])
$o .= '[b]'.$r[0]['title'].'[/b]'."\n";
$o .= $r[0]['body'];
$o.= "[/share]";
}
} else {
$o = '';
$o .= "\xE2\x99\xb2" . ' [url=' . $r[0]['author-link'] . ']' . $r[0]['author-name'] . '[/url]' . "\n"; $o .= "\xE2\x99\xb2" . ' [url=' . $r[0]['author-link'] . ']' . $r[0]['author-name'] . '[/url]' . "\n";
if($r[0]['title']) if($r[0]['title'])
$o .= '[b]' . $r[0]['title'] . '[/b]' . "\n"; $o .= '[b]' . $r[0]['title'] . '[/b]' . "\n";
$o .= $r[0]['body'] . "\n" ; $o .= $r[0]['body'] . "\n" ;
$o .= (($r[0]['plink']) ? '[url=' . $r[0]['plink'] . ']' . t('link') . '[/url]' . "\n" : '');
$o .= (($r[0]['plink']) ? '[url=' . $r[0]['plink'] . ']' . t('link') . '[/url]' . "\n" : '');
}
echo $o; echo $o;
killme(); killme();
} }

View file

@ -35,7 +35,7 @@
</li> </li>
{{ endif }} {{ endif }}
<li id="nav-site-linkmenu" class="nav-menu-icon"><a href="#" rel="#nav-site-menu"><span class="icon s22 gear">Site</span></a> <li id="nav-site-linkmenu" class="nav-menu-icon"><a href="#" rel="#nav-site-menu"><span class="icon s22 gear"></span></a>
<ul id="nav-site-menu" class="menu-popup"> <ul id="nav-site-menu" class="menu-popup">
{{ if $nav.manage }}<li><a class="$nav.manage.2" href="$nav.manage.0" title="$nav.manage.3">$nav.manage.1</a></li>{{ endif }} {{ if $nav.manage }}<li><a class="$nav.manage.2" href="$nav.manage.0" title="$nav.manage.3">$nav.manage.1</a></li>{{ endif }}
{{ if $nav.help }} <li><a class="$nav.help.2" target="friendica-help" href="$nav.help.0" title="$nav.help.3" >$nav.help.1</a></li>{{ endif }} {{ if $nav.help }} <li><a class="$nav.help.2" target="friendica-help" href="$nav.help.0" title="$nav.help.3" >$nav.help.1</a></li>{{ endif }}
@ -50,7 +50,7 @@
</ul> </ul>
</li> </li>
{{ if $nav.notifications }} {{ if $nav.notifications }}
<li id="nav-notifications-linkmenu" class="nav-menu-icon"><a href="$nav.notifications.0" rel="#nav-notifications-menu" title="$nav.notifications.1"><span class="icon s22 notify">$nav.notifications.1</span></a> <li id="nav-notifications-linkmenu" class="nav-menu-icon"><a href="$nav.notifications.0" rel="#nav-notifications-menu" title="$nav.notifications.1"><span class="icon s22 notify"></span></a>
<span id="notify-update" class="nav-notify"></span> <span id="notify-update" class="nav-notify"></span>
<ul id="nav-notifications-menu" class="menu-popup"> <ul id="nav-notifications-menu" class="menu-popup">
<li id="nav-notifications-mark-all"><a href="#" onclick="notifyMarkAll(); return false;">$nav.notifications.mark.1</a></li> <li id="nav-notifications-mark-all"><a href="#" onclick="notifyMarkAll(); return false;">$nav.notifications.mark.1</a></li>

View file

@ -5,6 +5,7 @@
/* @import "css/font-awesome.css"; */ /* @import "css/font-awesome.css"; */
@import url("css/font-awesome.css") all; @import url("css/font-awesome.css") all;
@import url("css/font2.css") all;
/* ========= */ /* ========= */
/* = Admin = */ /* = Admin = */
@ -86,35 +87,7 @@
#adminpage .selectall { text-align: right; } #adminpage .selectall { text-align: right; }
/* icons */ /* icons */
.icon.bb-url{ /*
background-image: url("../../../view/theme/diabook/icons/bb-url.png");
float: right;
margin-top: 2px;}
.icon.quote{
background-image: url("../../../view/theme/diabook/icons/quote.png");
float: right;
margin-top: 2px;}
.icon.bold{
background-image: url("../../../view/theme/diabook/icons/bold.png");
float: right;
margin-top: 2px;}
.icon.underline{
background-image: url("../../../view/theme/diabook/icons/underline.png");
float: right;
margin-top: 2px;}
.icon.italic{
background-image: url("../../../view/theme/diabook/icons/italic.png");
float: right;
margin-top: 2px;}
.icon.bb-image{
background-image: url("../../../view/theme/diabook/icons/bb-image.png");
float: right;
margin-top: 2px;}
.icon.bb-video{
background-image: url("../../../view/theme/diabook/icons/bb-video.png");
float: right;
margin-top: 2px;}
.article { background-position: -50px 0px;} .article { background-position: -50px 0px;}
.audio { background-position: -70px 0px;} .audio { background-position: -70px 0px;}
.block { background-position: -90px 0px;} .block { background-position: -90px 0px;}
@ -153,7 +126,9 @@
.prev { background-position: -90px -60px;} .prev { background-position: -90px -60px;}
.next { background-position: -110px -60px;} .next { background-position: -110px -60px;}
.tagged { background-position: -130px -60px;} .tagged { background-position: -130px -60px;}
*/
/*
.attachtype { .attachtype {
display: block; width: 20px; height: 23px; display: block; width: 20px; height: 23px;
background-image: url('../../../images/content-types.png'); background-image: url('../../../images/content-types.png');
@ -164,12 +139,33 @@
.type-audio { background-position: -40px 0px; } .type-audio { background-position: -40px 0px; }
.type-text { background-position: -60px 0px; } .type-text { background-position: -60px 0px; }
.type-unkn { background-position: -80px 0px; } .type-unkn { background-position: -80px 0px; }
*/
.icon.drop, .icon.drophide { .icon.drop, .icon.drophide {
float: left; float: left;
} }
.icon { .icon {
background-color: transparent ;
background-repeat: no-repeat;
width: 18px;
height: 18px;
display: block;
overflow: hidden;
padding: 1px;
color: #999;
}
.icon:hover {
text-decoration: none;
color: #000;
}
.icon a:hover {
}
/*.icon {
display: block; display: block;
width: 18px; width: 18px;
height: 18px; height: 18px;
@ -179,12 +175,11 @@
.icon { .icon {
background-color: transparent ; background-color: transparent ;
background-repeat: no-repeat; background-repeat: no-repeat;
/* background-position: left center; */
display: block; display: block;
overflow: hidden; overflow: hidden;
text-indent: -9999px; text-indent: -9999px;
padding: 1px; padding: 1px;
} } */
.icon.text { .icon.text {
text-indent: 0px; text-indent: 0px;
@ -202,27 +197,9 @@
.icon.s10.add { .icon.s10.add {
background-image: url("../../../images/icons/10/add.png"); background-image: url("../../../images/icons/10/add.png");
} }
.icon.s10.delete {
background-image: url("../../../images/icons/10/delete.png");
}
.icon.s10.edit {
background-image: url("../../../images/icons/10/edit.png");
}
.icon.s10.star {
background-image: url("../../../images/icons/10/star.png");
}
.icon.s10.menu { .icon.s10.menu {
background-image: url("../../../images/icons/10/menu.png"); background-image: url("../../../images/icons/10/menu.png");
} }
.icon.s10.link {
background-image: url("../../../images/icons/10/link.png");
}
.icon.s10.lock {
background-image: url("../../../images/icons/10/lock.png");
}
.icon.s10.unlock {
background-image: url("../../../images/icons/10/unlock.png");
}
.icon.s10.text { .icon.s10.text {
padding: 2px 0px 0px 15px; padding: 2px 0px 0px 15px;
font-size: 10px; font-size: 10px;
@ -240,27 +217,9 @@
.icon.s16.add { .icon.s16.add {
background-image: url("../../../images/icons/16/add.png"); background-image: url("../../../images/icons/16/add.png");
} }
.icon.s16.delete {
background-image: url("../../../images/icons/16/delete.png");
}
/*.icon.s16.edit {
background-image: url("../../../images/icons/16/edit.png");
}*/
.icon.s16.star {
background-image: url("../../../images/icons/16/star.png");
}
.icon.s16.menu { .icon.s16.menu {
background-image: url("../../../images/icons/16/menu.png"); background-image: url("../../../images/icons/16/menu.png");
} }
/*.icon.s16.link {
background-image: url("../../../images/icons/16/link.png");
}*/
.icon.s16.lock {
background-image: url("../../../images/icons/16/lock.png");
}
.icon.s16.unlock {
background-image: url("../../../images/icons/16/unlock.png");
}
.icon.s16.text { .icon.s16.text {
padding: 4px 0px 0px 20px; padding: 4px 0px 0px 20px;
font-size: 10px; font-size: 10px;
@ -278,30 +237,13 @@
.icon.s22.add { .icon.s22.add {
background-image: url("../../../images/icons/22/add.png"); background-image: url("../../../images/icons/22/add.png");
} }
.icon.s22.delete {
background-image: url("../../../images/icons/22/delete.png");
}
.icon.s22.edit {
background-image: url("../../../images/icons/22/edit.png");
}
.icon.s22.star {
background-image: url("../../../images/icons/22/star.png");
}
.icon.s22.menu { .icon.s22.menu {
background-image: url("../../../images/icons/22/menu.png"); background-image: url("../../../images/icons/22/menu.png");
} }
.icon.s22.link {
background-image: url("../../../images/icons/22/link.png");
}
.icon.s22.lock {
background-image: url("../../../images/icons/22/lock.png");
}
.icon.s22.unlock {
background-image: url("../../../images/icons/22/unlock.png");
}
.icon.s22.text { .icon.s22.text {
padding: 10px 0px 0px 25px; padding: 10px 0px 0px 25px;
width: 200px; width: 230px;
font-size: 1em;
} }
.icon.s48 { .icon.s48 {
width: 48px; width: 48px;
@ -316,27 +258,9 @@
.icon.s48.add { .icon.s48.add {
background-image: url("../../../images/icons/48/add.png"); background-image: url("../../../images/icons/48/add.png");
} }
.icon.s48.delete {
background-image: url("../../../images/icons/48/delete.png");
}
.icon.s48.edit {
background-image: url("../../../images/icons/48/edit.png");
}
.icon.s48.star {
background-image: url("../../../images/icons/48/star.png");
}
.icon.s48.menu { .icon.s48.menu {
background-image: url("../../../images/icons/48/menu.png"); background-image: url("../../../images/icons/48/menu.png");
} }
.icon.s48.link {
background-image: url("../../../images/icons/48/link.png");
}
.icon.s48.lock {
background-image: url("../../../images/icons/48/lock.png");
}
.icon.s48.unlock {
background-image: url("../../../images/icons/48/unlock.png");
}
.sparkle { .sparkle {
cursor: url('lock.cur'), pointer; cursor: url('lock.cur'), pointer;
} }
@ -355,10 +279,10 @@ div.pager, .birthday-notice {
border-radius: 6px; border-radius: 6px;
background-color: #f2f2f2; background-color: #f2f2f2;
clear: left; clear: left;
margin-top: 15px; margin-top: 5px;
padding: 1%; padding: 1%;
height: 1em; height: 1em;
margin-bottom: 15px; margin-bottom: 5px;
} }
.birthday-notice { .birthday-notice {
@ -587,6 +511,7 @@ header #banner #logo-text {
} }
/* nav */ /* nav */
nav { nav {
min-width: 1000px;
width: 100%; width: 100%;
height: 32px; height: 32px;
position: fixed; position: fixed;
@ -633,7 +558,7 @@ nav ul li .menu-popup {
right: auto; right: auto;
} }
nav #search-box #search-text { nav #search-box #search-text {
background-image: url('icons/lupe.png'); /* background-image: url('icons/lupe.png'); */
background-repeat:no-repeat; background-repeat:no-repeat;
padding-left:0px; padding-left:0px;
border-top-left-radius: 15px; border-top-left-radius: 15px;
@ -881,8 +806,8 @@ ul.menu-popup .empty {
aside { aside {
display: table-cell; display: table-cell;
vertical-align: top; vertical-align: top;
width: 185px; width: 195px;
padding: 0px 10px 0px 20px; padding: 10px 10px 10px 10px;
border-right: 1px solid #D2D2D2; border-right: 1px solid #D2D2D2;
background-color: #ECECF2; background-color: #ECECF2;
font-size: 14px; font-size: 14px;
@ -1075,7 +1000,7 @@ section {
display: table-cell; display: table-cell;
vertical-align: top; vertical-align: top;
width: 760px; width: 760px;
padding: 0px 0px 0px 10px; padding: 10px 0px 10px 10px;
} }
/* wall item */ /* wall item */
.tread-wrapper { .tread-wrapper {
@ -1743,7 +1668,7 @@ ul.tabs a {
float: left; float: left;
} }
ul.tabs a, #jot-preview-link, .comment-edit-submit-wrapper .fakelink, .comment-edit-bb a{ ul.tabs a, #jot-preview-link, .comment-edit-submit-wrapper .fakelink {
/* padding: 0px 10px 1px 10px; */ /* padding: 0px 10px 1px 10px; */
padding: 0px 5px 1px 5px; padding: 0px 5px 1px 5px;
-webkit-border-radius: 4px; -webkit-border-radius: 4px;
@ -1764,7 +1689,7 @@ ul.tabs a, #jot-preview-link, .comment-edit-submit-wrapper .fakelink, .comment-e
background: linear-gradient(top, #ffffff 0%,#ececf2 100%); background: linear-gradient(top, #ffffff 0%,#ececf2 100%);
} }
ul.tabs li .active, ul.tabs a:hover, #jot-preview-link:hover, .comment-edit-submit-wrapper .fakelink:hover, .comment-edit-bb a:hover { ul.tabs li .active, ul.tabs a:hover, #jot-preview-link:hover, .comment-edit-submit-wrapper .fakelink:hover, {
color: #fff; color: #fff;
text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.5); text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.5);
@ -1783,6 +1708,15 @@ ul.tabs li .active, ul.tabs a:hover, #jot-preview-link:hover, .comment-edit-subm
.comment-edit-bb { .comment-edit-bb {
float:right; float:right;
} }
.comment-edit-bb a {
color: #888;
padding: 0px 5px 1px 5px;
}
.comment-edit-bb a:hover {
color: #000;
text-decoration: none;
}
/** /**
* Form fields * Form fields

View file

@ -1,10 +1,11 @@
<?php <?php
/** /**
* Name: Vier * Name: Vier
* Version: 0.1 * Version: 0.9
* Author: Fabio <http://kirgroup.com/profile/fabrixxm> * Author: Fabio <http://kirgroup.com/profile/fabrixxm>
* Author: Ike <http://pirati.ca/profile/heluecht> * Author: Ike <http://pirati.ca/profile/heluecht>
* Maintainer: Ike <http://pirati.ca/profile/heluecht> * Maintainer: Ike <http://pirati.ca/profile/heluecht>
* Description: "Vier" uses the font awesome font library: http://fortawesome.github.com/Font-Awesome/
*/ */
$a->theme_info = array(); $a->theme_info = array();

View file

@ -54,7 +54,7 @@
<a href="$item.profile_url" target="redir" title="$item.linktitle" class="wall-item-name-link"><span class="wall-item-name$item.sparkle">$item.name</span></a> <a href="$item.profile_url" target="redir" title="$item.linktitle" class="wall-item-name-link"><span class="wall-item-name$item.sparkle">$item.name</span></a>
{{ if $item.owner_url }}$item.via <a href="$item.owner_url" target="redir" title="$item.olinktitle" class="wall-item-name-link"><span class="wall-item-name$item.osparkle" id="wall-item-ownername-$item.id">$item.owner_name</span></a> <!-- $item.vwall -->{{ endif }} {{ if $item.owner_url }}$item.via <a href="$item.owner_url" target="redir" title="$item.olinktitle" class="wall-item-name-link"><span class="wall-item-name$item.osparkle" id="wall-item-ownername-$item.id">$item.owner_name</span></a> <!-- $item.vwall -->{{ endif }}
<span class="wall-item-ago">- <span class="wall-item-ago">-
{{ if $item.plink }}<a class="link" title="$item.plink.title" href="$item.plink.href" style="color: #999">$item.ago</a>{{ else }} $item.ago {{ endif }} {{ if $item.plink }}<a title="$item.plink.title" href="$item.plink.href" style="color: #999">$item.ago</a>{{ else }} $item.ago {{ endif }}
{{ if $item.lock }} - <span class="fakelink" style="color: #999" onclick="lockview(event,$item.id);">$item.lock</span> {{ endif }} {{ if $item.lock }} - <span class="fakelink" style="color: #999" onclick="lockview(event,$item.id);">$item.lock</span> {{ endif }}
</span> </span>
</div> </div>