From c22f65bafa08ea348d55fb1f3c05774b0f320c99 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Wed, 19 Dec 2012 12:18:52 +0100 Subject: [PATCH 1/5] repeated items from ostatus and diaspora are now using the share-element. Some design changes to repeated items in "vier". --- include/bbcode.php | 5 +++-- include/delivery.php | 19 ++++++++++++++----- include/diaspora.php | 7 ++++++- include/items.php | 14 ++++++++++---- include/notifier.php | 17 +++++++++++++---- include/onepoll.php | 5 +++-- include/text.php | 3 +++ view/de/strings.php | 2 ++ view/theme/vier/style.css | 4 ++-- 9 files changed, 56 insertions(+), 20 deletions(-) diff --git a/include/bbcode.php b/include/bbcode.php index b3f6aa826..e09b1ed34 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -251,11 +251,11 @@ function bb_ShareAttributes($match) { if ($avatar != "") $headline .= ''; - $headline .= sprintf(t('%s wrote the following post:'), $profile, $author, $link); + $headline .= sprintf(t('%s wrote the following post:'), $profile, $author, $link); $headline .= ""; - $text = "
".$headline.'
'.trim($match[2])."
"; + $text = $headline.'
'.trim($match[2])."
"; return($text); } @@ -314,6 +314,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { // We'll emulate it. + $Text = trim($Text); $Text = str_replace("\r\n","\n", $Text); $Text = str_replace(array("\r","\n"), array('
','
'), $Text); diff --git a/include/delivery.php b/include/delivery.php index c56d7d288..e8bf338a8 100644 --- a/include/delivery.php +++ b/include/delivery.php @@ -439,14 +439,14 @@ function delivery_run(&$argv, &$argc){ } if(! $it) break; - + $local_user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval($uid) ); if(! count($local_user)) break; - + $reply_to = ''; $r1 = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1", intval($uid) @@ -482,12 +482,21 @@ function delivery_run(&$argv, &$argc){ if($it['uri'] !== $it['parent-uri']) { $headers .= 'References: <' . iri2msgid($it['parent-uri']) . '>' . "\n"; - if(!strlen($it['title'])) { - $r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' LIMIT 1", - dbesc($it['parent-uri'])); + if(!$it['title']) { + $r = q("SELECT `title` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", + dbesc($it['parent-uri']), + intval($uid)); if(count($r) AND ($r[0]['title'] != '')) $subject = $r[0]['title']; + else { + $r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d LIMIT 1", + dbesc($it['parent-uri']), + intval($uid)); + + if(count($r) AND ($r[0]['title'] != '')) + $subject = $r[0]['title']; + } } if(strncasecmp($subject,'RE:',3)) $subject = 'Re: '.$subject; diff --git a/include/diaspora.php b/include/diaspora.php index c2b2fbcf4..b14402b5a 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -923,6 +923,7 @@ function diaspora_reshare($importer,$xml,$msg) { $orig_guid = notags(unxmlify($xml->root_guid)); $source_url = 'https://' . substr($orig_author,strpos($orig_author,'@')+1) . '/p/' . $orig_guid . '.xml'; + $orig_url = 'https://'.substr($orig_author,strpos($orig_author,'@')+1).'/posts/'.$orig_guid; $x = fetch_url($source_url); if(! $x) $x = fetch_url(str_replace('https://','http://',$source_url)); @@ -1032,10 +1033,14 @@ function diaspora_reshare($importer,$xml,$msg) { $datarray['author-avatar'] = ((x($person,'thumb')) ? $person['thumb'] : $person['photo']); $datarray['body'] = $body; } else { + $prefix = "[share author='".$person['name']. + "' profile='".$person['url']. + "' avatar='".((x($person,'thumb')) ? $person['thumb'] : $person['photo']). + "' link='".$orig_url."']"; $datarray['author-name'] = $contact['name']; $datarray['author-link'] = $contact['url']; $datarray['author-avatar'] = $contact['thumb']; - $datarray['body'] = $prefix . $body; + $datarray['body'] = $prefix.$body."[/share]"; } $datarray['tag'] = $str_tags; diff --git a/include/items.php b/include/items.php index fb7a7e25d..5bd4423cf 100755 --- a/include/items.php +++ b/include/items.php @@ -798,6 +798,7 @@ function get_atom_elements($feed,$item) { logger('get_atom_elements: Looking for status.net repeated message'); $message = $child["http://activitystrea.ms/spec/1.0/"]["object"][0]["child"][SIMPLEPIE_NAMESPACE_ATOM_10]["content"][0]["data"]; + $orig_uri = $child["http://activitystrea.ms/spec/1.0/"]["object"][0]["child"][SIMPLEPIE_NAMESPACE_ATOM_10]["id"][0]["data"]; $author = $child[SIMPLEPIE_NAMESPACE_ATOM_10]["author"][0]["child"][SIMPLEPIE_NAMESPACE_ATOM_10]; $uri = $author["uri"][0]["data"]; $name = $author["name"][0]["data"]; @@ -805,17 +806,22 @@ function get_atom_elements($feed,$item) { $avatar = $avatar["href"]; 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. '.print_r($child, true)); - $res["owner-name"] = $res["author-name"]; + /*$res["owner-name"] = $res["author-name"]; $res["owner-link"] = $res["author-link"]; $res["owner-avatar"] = $res["author-avatar"]; $res["author-name"] = $name; $res["author-link"] = $uri; - $res["author-avatar"] = $avatar; + $res["author-avatar"] = $avatar;*/ - $res["body"] = html2bbcode($message); + $prefix = "[share author='".$name. + "' profile='".$uri. + "' avatar='".$avatar. + "' link='".$orig_uri."']"; + + $res["body"] = $prefix.html2bbcode($message)."[/share]"; } } diff --git a/include/notifier.php b/include/notifier.php index b685e1b99..c522bcb6b 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -791,12 +791,21 @@ function notifier_run(&$argv, &$argc){ if($it['uri'] !== $it['parent-uri']) { $headers .= 'References: <' . iri2msgid($it['parent-uri']) . '>' . "\n"; - if(!strlen($it['title'])) { - $r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' LIMIT 1", - dbesc($it['parent-uri'])); + if(!$it['title']) { + $r = q("SELECT `title` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", + dbesc($it['parent-uri']), + intval($uid)); - if(count($r) AND ($r[0]['title'] != '')) + if(count($r) AND ($r[0]['title'] != '')) $subject = $r[0]['title']; + else { + $r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d LIMIT 1", + dbesc($it['parent-uri']), + intval($uid)); + + if(count($r) AND ($r[0]['title'] != '')) + $subject = $r[0]['title']; + } } if(strncasecmp($subject,'RE:',3)) $subject = 'Re: '.$subject; diff --git a/include/onepoll.php b/include/onepoll.php index 1e11f2ca1..7b2eba70d 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -405,8 +405,9 @@ function onepoll_run(&$argv, &$argc){ // If it seems to be a reply but a header couldn't be found take the last message with matching subject if(!x($datarray,'parent-uri') and $reply) { - $r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE MATCH (`title`) AGAINST ('".'"%s"'."' IN BOOLEAN MODE) ORDER BY `created` DESC LIMIT 1", - dbesc(protect_sprintf($datarray['title']))); + $r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE MATCH (`title`) AGAINST ('".'"%s"'."' IN BOOLEAN MODE) AND `uid` = %d ORDER BY `created` DESC LIMIT 1", + dbesc(protect_sprintf($datarray['title'])), + intval($importer_uid)); if(count($r)) $datarray['parent-uri'] = $r[0]['parent-uri']; } diff --git a/include/text.php b/include/text.php index 7d26d3550..4212e23ca 100644 --- a/include/text.php +++ b/include/text.php @@ -982,6 +982,9 @@ function prepare_body($item,$attach = false) { $s = $prep_arr['html']; if(! $attach) { + // Replace the blockquotes with quotes that are used in mails + $mailquote = '
'; + $s = str_replace(array('
', '
', '
'), array($mailquote, $mailquote, $mailquote), $s); return $s; } diff --git a/view/de/strings.php b/view/de/strings.php index 7bded94a4..30e2d740f 100644 --- a/view/de/strings.php +++ b/view/de/strings.php @@ -2081,3 +2081,5 @@ $a->strings["Post to Drupal by default"] = "Veröffentliche öffentliche Beiträ $a->strings["OEmbed settings updated"] = "OEmbed Einstellungen aktualisiert."; $a->strings["Use OEmbed for YouTube videos"] = "OEmbed für Youtube Videos verwenden"; $a->strings["URL to embed:"] = "URL zum Einbetten:"; +$a->strings['%s wrote the following post:'] = + '%s hat diesen Beitrag ursprünglich gepostet:'; diff --git a/view/theme/vier/style.css b/view/theme/vier/style.css index d6acade69..91680f41c 100644 --- a/view/theme/vier/style.css +++ b/view/theme/vier/style.css @@ -356,8 +356,8 @@ div.pager, .birthday-notice { height: 32px; color: #999; border-top: 1px solid #D2D2D2; - padding-top: 16px; - margin-top: 16px; + padding-top: 5px; + margin-top: 5px; } .shared_header img { From a86baa372a2de75d08ac6c08d2df973404392ef9 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Wed, 19 Dec 2012 15:58:38 +0100 Subject: [PATCH 2/5] Mailimport is now realized like a wall-to-wall-post --- include/items.php | 2 +- include/onepoll.php | 27 +++++++++++++++++++++++---- view/theme/vier/style.css | 4 ++++ 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/include/items.php b/include/items.php index 5bd4423cf..b5e6062b2 100755 --- a/include/items.php +++ b/include/items.php @@ -806,7 +806,7 @@ function get_atom_elements($feed,$item) { $avatar = $avatar["href"]; if (($name != "") and ($uri != "") and ($avatar != "") and ($message != "")) { - logger('get_atom_elements: fixing sender of repeated message. '.print_r($child, true)); + logger('get_atom_elements: fixing sender of repeated message.'); /*$res["owner-name"] = $res["author-name"]; $res["owner-link"] = $res["author-link"]; diff --git a/include/onepoll.php b/include/onepoll.php index 7b2eba70d..2abd41b78 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -437,7 +437,29 @@ function onepoll_run(&$argv, &$argc){ else $fromdecoded .= $frompart->text; - $datarray['body'] = "[b]".t('From: ') . escape_tags($fromdecoded) . "[/b]\n\n" . $datarray['body']; + $fromarr = imap_rfc822_parse_adrlist($fromdecoded, $a->get_hostname()); + + $frommail = $fromarr[0]->mailbox."@".$fromarr[0]->host; + + if (isset($fromarr[0]->personal)) + $fromname = $fromarr[0]->personal; + else + $fromname = $frommail; + + //$datarray['body'] = "[b]".t('From: ') . escape_tags($fromdecoded) . "[/b]\n\n" . $datarray['body']; + + $datarray['author-name'] = $fromname; + $datarray['author-link'] = "mailto:".$frommail; + $datarray['author-avatar'] = $contact['photo']; + + $datarray['owner-name'] = $contact['name']; + $datarray['owner-link'] = "mailto:".$contact['addr']; + $datarray['owner-avatar'] = $contact['photo']; + + } else { + $datarray['author-name'] = $contact['name']; + $datarray['author-link'] = 'mailbox'; + $datarray['author-avatar'] = $contact['photo']; } $datarray['uid'] = $importer_uid; @@ -448,9 +470,6 @@ function onepoll_run(&$argv, &$argc){ $datarray['private'] = 1; $datarray['allow_cid'] = '<' . $contact['id'] . '>'; } - $datarray['author-name'] = $contact['name']; - $datarray['author-link'] = 'mailbox'; - $datarray['author-avatar'] = $contact['photo']; $stored_item = item_store($datarray); q("UPDATE `item` SET `last-child` = 0 WHERE `parent-uri` = '%s' AND `uid` = %d", diff --git a/view/theme/vier/style.css b/view/theme/vier/style.css index 91680f41c..b6aaae51d 100644 --- a/view/theme/vier/style.css +++ b/view/theme/vier/style.css @@ -313,6 +313,10 @@ cursor: url('lock.cur'), pointer; } +#birthday-title, #event-title { + font-weight: bold; + margin-bottom: 5px; +} div.pager, .birthday-notice { text-align: center; From 0a29927e6d15fe77786b9f6e9dbb4b8ac8b83ab2 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Wed, 19 Dec 2012 16:31:06 +0100 Subject: [PATCH 3/5] Mail: real threading now works with outgoing mails. --- include/delivery.php | 8 +++++++- include/notifier.php | 8 +++++++- include/onepoll.php | 4 ++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/include/delivery.php b/include/delivery.php index e8bf338a8..fcb0ee47b 100644 --- a/include/delivery.php +++ b/include/delivery.php @@ -481,7 +481,13 @@ function delivery_run(&$argv, &$argc){ //logger("Mail: Data: ".print_r($it, true), LOGGER_DATA); if($it['uri'] !== $it['parent-uri']) { - $headers .= 'References: <' . iri2msgid($it['parent-uri']) . '>' . "\n"; + $headers .= "References: <".iri2msgid($it["parent-uri"]).">"; + + // If Threading is enabled, write down the correct parent + if (($it["thr-parent"] != "") and ($it["thr-parent"] != $it["parent-uri"])) + $headers .= " <".iri2msgid($it["thr-parent"]).">"; + $headers .= "\n"; + if(!$it['title']) { $r = q("SELECT `title` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", dbesc($it['parent-uri']), diff --git a/include/notifier.php b/include/notifier.php index c522bcb6b..b5a92ff25 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -790,7 +790,13 @@ function notifier_run(&$argv, &$argc){ $headers .= 'Message-Id: <' . iri2msgid($it['uri']) . '>' . "\n"; if($it['uri'] !== $it['parent-uri']) { - $headers .= 'References: <' . iri2msgid($it['parent-uri']) . '>' . "\n"; + $headers .= "References: <".iri2msgid($it["parent-uri"]).">"; + + // If Threading is enabled, write down the correct parent + if (($it["thr-parent"] != "") and ($it["thr-parent"] != $it["parent-uri"])) + $headers .= " <".iri2msgid($it["thr-parent"]).">"; + $headers .= "\n"; + if(!$it['title']) { $r = q("SELECT `title` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", dbesc($it['parent-uri']), diff --git a/include/onepoll.php b/include/onepoll.php index 2abd41b78..c493aff76 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -335,7 +335,7 @@ function onepoll_run(&$argv, &$argc){ intval($r[0]['id']) ); } - /*switch ($mailconf[0]['action']) { + switch ($mailconf[0]['action']) { case 0: logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user'].". Doing nothing.", LOGGER_DEBUG); break; @@ -353,7 +353,7 @@ function onepoll_run(&$argv, &$argc){ if ($mailconf[0]['movetofolder'] != "") imap_mail_move($mbox, $msg_uid, $mailconf[0]['movetofolder'], FT_UID); break; - }*/ + } continue; } From 330960f8f719052763cb54804681bdcdb7fc5fc5 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Thu, 20 Dec 2012 03:33:36 +0100 Subject: [PATCH 4/5] Vier: Now there are buttons for inserting bbcode elements in the comments --- view/de/strings.php | 3 +- view/theme/vier/comment_item.tpl | 50 ++++++++++++++++++++++++++++++++ view/theme/vier/style.css | 45 ++++++++++++++++++++++++++-- view/theme/vier/theme.php | 8 +++-- 4 files changed, 99 insertions(+), 7 deletions(-) create mode 100644 view/theme/vier/comment_item.tpl diff --git a/view/de/strings.php b/view/de/strings.php index e97ae297f..297e7fac3 100644 --- a/view/de/strings.php +++ b/view/de/strings.php @@ -1024,6 +1024,7 @@ $a->strings["Delegate Page Management"] = "Delegiere das Management für die Sei $a->strings["Delegates are able to manage all aspects of this account/page except for basic account settings. Please do not delegate your personal account to anybody that you do not trust completely."] = "Bevollmächtigte sind in der Lage, alle Aspekte dieses Kontos/dieser Seite zu verwalten, abgesehen von den Grundeinstellungen des Kontos. Bitte gib niemandem eine Bevollmächtigung für deinen privaten Account, dem du nicht absolut vertraust!"; $a->strings["Existing Page Managers"] = "Vorhandene Seiten Manager"; $a->strings["Existing Page Delegates"] = "Vorhandene Bevollmächtigte für die Seite"; +$a->strings["Delegations"] = "Bevollmächtigungen"; $a->strings["Potential Delegates"] = "Potentielle Bevollmächtigte"; $a->strings["Add"] = "Hinzufügen"; $a->strings["No entries."] = "Keine Einträge"; @@ -2076,7 +2077,7 @@ $a->strings["Birthday Reminders"] = "Geburtstagserinnerungen"; $a->strings["Birthdays this week:"] = "Geburtstage diese Woche:"; $a->strings["[No description]"] = "[keine Beschreibung]"; $a->strings["Event Reminders"] = "Veranstaltungserinnerungen"; -$a->strings["Events this week:"] = "Veranstaltungen diese Woche"; +$a->strings["Events this week:"] = "Veranstaltungen diese Woche:"; $a->strings["Status Messages and Posts"] = "Statusnachrichten und Beiträge"; $a->strings["Profile Details"] = "Profildetails"; $a->strings["Events and Calendar"] = "Ereignisse und Kalender"; diff --git a/view/theme/vier/comment_item.tpl b/view/theme/vier/comment_item.tpl new file mode 100644 index 000000000..ac7073d71 --- /dev/null +++ b/view/theme/vier/comment_item.tpl @@ -0,0 +1,50 @@ + {{ if $threaded }} +
+ {{ else }} +
+ {{ endif }} +
+ + + + + + + + +
+ $mytitle +
+
+ + {{ if $qcomment }} + + {{ endif }} + +
+ + +
+
+ +
diff --git a/view/theme/vier/style.css b/view/theme/vier/style.css index b6aaae51d..b278cbf8c 100644 --- a/view/theme/vier/style.css +++ b/view/theme/vier/style.css @@ -86,6 +86,34 @@ #adminpage .selectall { text-align: right; } /* 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;} .audio { background-position: -70px 0px;} @@ -1243,7 +1271,7 @@ border-bottom: 1px solid #D2D2D2; } .comment-edit-preview { - width: 710px; + width: 660px; border: 1px solid #2d2d2d; margin-top: 10px; } @@ -1307,6 +1335,10 @@ border-bottom: 1px solid #D2D2D2; height: 100px; } +#jot-preview-content { + padding-top: 25px; +} + #jot-preview-content .tread-wrapper { background-color: #fce94f; } @@ -1698,10 +1730,15 @@ ul.tabs li { /*ul.tabs li .active { border-bottom: 1px solid #005c94; }*/ + ul.tabs a { display: block; float: left; - padding: 0px 10px 1px 10px; +} + +ul.tabs a, #jot-preview-link, .comment-edit-submit-wrapper .fakelink { + /* padding: 0px 10px 1px 10px; */ + padding: 0px 5px 1px 5px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; @@ -1719,7 +1756,9 @@ ul.tabs a { filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ececf2',GradientType=0 ); background: linear-gradient(top, #ffffff 0%,#ececf2 100%); } -ul.tabs li .active, ul.tabs a:hover { + +ul.tabs li .active, ul.tabs a:hover, #jot-preview-link:hover, .comment-edit-submit-wrapper .fakelink:hover { + color: #fff; text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.5); border: 1px solid #ececf2; diff --git a/view/theme/vier/theme.php b/view/theme/vier/theme.php index 5e483c5ad..db74385c8 100644 --- a/view/theme/vier/theme.php +++ b/view/theme/vier/theme.php @@ -12,7 +12,7 @@ $a->theme_info = array(); function vier_init(&$a) { $a->page['htmlhead'] .= <<< EOT