From a282042ffc69ce910ac92118907305ed38dbd869 Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Mon, 24 Jan 2011 19:50:34 +0100 Subject: [PATCH 1/7] Bigger subject in messages --- view/theme/duepuntozero/style.css | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index b00f24cc2..db947bdb4 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -1453,8 +1453,9 @@ input#dfrn-url { margin-top: 10px; } a.mail-list-link { - display: block; - padding: 4px 5px; + display: block; + font-size: 1.3em; + padding: 4px 0; } /* @@ -1492,8 +1493,8 @@ a.mail-list-link { } .mail-conv-subject { - font-size: 1.1em; - margin-top: 10px; + font-size: 1.4em; + margin: 10px 0; } .mail-conv-outside-wrapper-end { From f2789132ce13c92166f41992dd8955f667cab440 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Tue, 25 Jan 2011 10:16:15 +0100 Subject: [PATCH 2/7] fixed width on wall-item-wrapper --- view/theme/duepuntozero/style.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index db947bdb4..ae7968b3f 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -809,6 +809,8 @@ input#dfrn-url { } .wall-item-wrapper { float: left; + margin-right: 5px; + width: 80px; } .wall-item-lock { height: 20px; From 4a2c0fcc36695c70c70a83ac04a8cb25f28b02d2 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Wed, 26 Jan 2011 16:17:28 +0100 Subject: [PATCH 3/7] Add 'jot_tool' hook, plugins can add tool icons. --- addon/README | 3 ++- mod/network.php | 6 +++++- mod/profile.php | 7 ++++++- view/en/jot.tpl | 5 +++++ view/fr/jot.tpl | 6 ++++++ view/it/jot.tpl | 7 +++++++ view/theme/default/style.css | 13 +++++++++++-- view/theme/duepuntozero/style.css | 12 ++++++++++++ 8 files changed, 54 insertions(+), 5 deletions(-) diff --git a/addon/README b/addon/README index 2e4ed6029..fb1c6340a 100644 --- a/addon/README +++ b/addon/README @@ -156,7 +156,8 @@ Current hooks: 'page_end' - called after HTML content functions have completed $b is (string) HTML of content div - +'jot_plugin' - add tools to jot toolbar + $b is (string) HTML for tool icon *** = subject to change diff --git a/mod/network.php b/mod/network.php index f9badda78..083912f86 100644 --- a/mod/network.php +++ b/mod/network.php @@ -79,6 +79,9 @@ function network_content(&$a, $update = 0) { $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false); + $jotplugins = ""; + call_hooks('jot_tool', $jotplugins); + $o .= replace_macros($tpl,array( '$return_path' => $a->cmd, '$baseurl' => $a->get_baseurl(), @@ -87,7 +90,8 @@ function network_content(&$a, $update = 0) { '$lockstate' => $lockstate, '$acl' => populate_acl((($group) ? $group_acl : $a->user), $celeb), '$bang' => (($group) ? '!' : ''), - '$profile_uid' => $_SESSION['uid'] + '$profile_uid' => $_SESSION['uid'], + '$jotplugins' => $jotplugins )); diff --git a/mod/profile.php b/mod/profile.php index 505edf5ce..c84b493c5 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -134,6 +134,10 @@ function profile_content(&$a, $update = 0) { $lockstate = 'lock'; else $lockstate = 'unlock'; + + $jotplugins = ""; + call_hooks('jot_tool', $jotplugins); + $o .= replace_macros($tpl,array( '$baseurl' => $a->get_baseurl(), '$defloc' => (($is_owner) ? $a->user['default-location'] : ''), @@ -142,7 +146,8 @@ function profile_content(&$a, $update = 0) { '$lockstate' => $lockstate, '$bang' => '', '$acl' => (($is_owner) ? populate_acl($a->user, $celeb) : ''), - '$profile_uid' => $a->profile['profile_uid'] + '$profile_uid' => $a->profile['profile_uid'], + '$jotplugins' => $jotplugins )); } diff --git a/view/en/jot.tpl b/view/en/jot.tpl index 6590cace8..de88fb84f 100644 --- a/view/en/jot.tpl +++ b/view/en/jot.tpl @@ -15,6 +15,11 @@ +
+ $jotplugins +
+
+
diff --git a/view/fr/jot.tpl b/view/fr/jot.tpl index 6590cace8..9a5c58153 100644 --- a/view/fr/jot.tpl +++ b/view/fr/jot.tpl @@ -15,6 +15,12 @@ +
+ $jotplugins +
+
+ +
diff --git a/view/it/jot.tpl b/view/it/jot.tpl index 5aaf9b923..b0c90ddf5 100644 --- a/view/it/jot.tpl +++ b/view/it/jot.tpl @@ -15,6 +15,11 @@ +
+ $jotplugins +
+
+
@@ -40,6 +45,8 @@
+ +
diff --git a/view/theme/default/style.css b/view/theme/default/style.css index fcc9c94a8..6e643d4fe 100644 --- a/view/theme/default/style.css +++ b/view/theme/default/style.css @@ -1034,7 +1034,7 @@ input#dfrn-url { margin-left: 110px; margin-top: 10px; } - +#profile-jot-plugin-wrapper, #profile-jot-submit-wrapper { margin-top: 15px; } @@ -1078,7 +1078,9 @@ input#dfrn-url { #profile-jot-perms-end { clear: both; } - +#profile-jot-plugin-end { + clear:both; +} #profile-jot-end { clear: both; margin-bottom: 30px; @@ -2000,3 +2002,10 @@ a.mail-list-link { margin-bottom: 15px; } +.tool-wrapper { + float: left; + margin-left: 5px; +} +.tool-link { + cursor: pointer; +} diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index 1a415db45..76a37e7c4 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -907,6 +907,7 @@ input#dfrn-url { margin: 10px 0px 10px 110px; } +#profile-jot-plugin-wrapper, #profile-jot-submit-wrapper { margin-top: 15px; } @@ -952,6 +953,9 @@ input#dfrn-url { height: 30px; } +#profile-jot-plugin-end{ + clear: both; +} #profile-jot-end { /*clear: both;*/ margin-bottom: 30px; @@ -1885,3 +1889,11 @@ a.mail-list-link { margin-bottom: 15px; } + +.tool-wrapper { + float: left; + margin-left: 5px; +} +.tool-link { + cursor: pointer; +} From af8ab8cb5350a503bb4043e90484a2bece3de7b4 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Wed, 26 Jan 2011 16:19:40 +0100 Subject: [PATCH 4/7] add [img=wxh][/img] support in tinymce bbcode plugin --- .../jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js b/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js index f12975ba2..ebccfb311 100644 --- a/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js +++ b/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js @@ -53,6 +53,10 @@ rep(/(.*?)<\/span>/gi,"[size=$1]$2[/size]"); rep(/(.*?)<\/span>/gi,"[color=$1]$2[/color]"); rep(/(.*?)<\/font>/gi,"$1"); + rep(//gi,"[img=$1x$2]$3[/img]"); + rep(//gi,"[img=$2x$1]$3[/img]"); + rep(//gi,"[img=$3x$2]$1[/img]"); + rep(//gi,"[img=$2x$3]$1[/img]"); rep(//gi,"[img]$1[/img]"); rep(/(.*?)<\/code>/gi,"[code]$1[/code]"); rep(/<\/(strong|b)>/gi,"[/b]"); @@ -96,6 +100,7 @@ rep(/\[\/u\]/gi,""); rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"$2"); rep(/\[url\](.*?)\[\/url\]/gi,"$1"); + rep(/\[img=(.*?)x(.*?)\](.*?)\[\/img\]/gi,""); rep(/\[img\](.*?)\[\/img\]/gi,""); rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"$2"); // rep(/\[\/code\]\s*\[code\]/gi,"
"); // fold multiline code From 62fda0a120fe4d068f1380924b5493adb70064ea Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Wed, 26 Jan 2011 16:20:12 +0100 Subject: [PATCH 5/7] oembed consumer plugin --- addon/oembed/oembed.js | 51 ++++++++++++++++++++++++++++++++++++ addon/oembed/oembed.php | 56 ++++++++++++++++++++++++++++++++++++++++ addon/oembed/oembed.png | Bin 0 -> 417 bytes 3 files changed, 107 insertions(+) create mode 100644 addon/oembed/oembed.js create mode 100644 addon/oembed/oembed.php create mode 100644 addon/oembed/oembed.png diff --git a/addon/oembed/oembed.js b/addon/oembed/oembed.js new file mode 100644 index 000000000..26541490b --- /dev/null +++ b/addon/oembed/oembed.js @@ -0,0 +1,51 @@ +function oembed(){ + $("#oembed").toggleClass('hide'); +} + +function oembed_do(){ + embedurl = $('#oembed_url').attr('value'); + var url = 'http://oohembed.com/oohembed/?url='+escape( embedurl )+"&callback=?"; + + $.getJSON(url, function(data) { + var ret=""; + switch(data.type){ + case "video": { + if (data.thumbnail_url){ + tw = 200; if (data.thumbnail_width) tw=data.thumbnail_width; + th = 180; if (data.thumbnail_height) tw=data.thumbnail_height; + ret = ""; + // tiny mce bbcode plugin not support image size...... + ret += ""; + } else { + ret = data.html; + } + }; break; + case "photo": { + // tiny mce bbcode plugin not support image size...... + ret = ""; + }; break; + case "link": { + ret = ""+data.title+""; + }; break; + case "rich": { + ret = data.html; // not so safe... http://www.oembed.com/ : "Consumers may wish to load the HTML in an off-domain iframe to avoid XSS" + }; break; + default: { + alert("Error retriving data!"); + return; + } + } + var embedlink = embedurl; + if (data.title) embedlink = data.title + ret+="
"+embedlink+""; + if (data.author_name) { + ret+=" by "+data.author_name; + } + if (data.provider_name) { + ret+=" on "+data.provider_name; + } + tinyMCE.execCommand('mceInsertRawHTML',false,ret); + oembed(); + }); + +} diff --git a/addon/oembed/oembed.php b/addon/oembed/oembed.php new file mode 100644 index 000000000..55654a543 --- /dev/null +++ b/addon/oembed/oembed.php @@ -0,0 +1,56 @@ + + '; + + $b .= ' +
  + + +

Paste a link from 5min.com, Amazon Product Image, blip.tv, Clikthrough, CollegeHumor Video, + Daily Show with Jon Stewart, Dailymotion, dotSUB.com, Flickr Photos, Funny or Die Video, + Google Video, Hulu, Kinomap, LiveJournal UserPic, Metacafe, National Film Board of Canada, + Phodroid Photos, Photobucket, Qik Video, Revision3, Scribd, SlideShare, TwitPic, Twitter Status, + Viddler Video, Vimeo, Wikipedia, Wordpress.com, XKCD Comic, YFrog, YouTube

+
+ '; +} + + +function oembed_hook_jot_tool($a, &$b) { + $b .= ' +
+ Embed +
+ '; +} + + + +?> \ No newline at end of file diff --git a/addon/oembed/oembed.png b/addon/oembed/oembed.png new file mode 100644 index 0000000000000000000000000000000000000000..6fc3794bba5b1aa57c04469e384c301108d23892 GIT binary patch literal 417 zcmV;S0bc%zP)Yq{$FzW&zl)UA8YJ0`33Mi-f)=wY3w9|D?DQ2TLLU2VjuM>wuH5`Z^H>*F;_-_ z)db!`T}HZ&#msNU5#F)z`GRW+yn*UMOS_mZ#2RprFe_Cl=^2A)Eoj`CM9i%oO-ZZE zPu6kVqlDfRtHBFuv+CWrz!Rp5BKG4Nw-`bf&a?9Y+~5vlKRsgy&eClrv6qSWkP7tW zn6jT3V?4t!X3?JY|A Date: Wed, 26 Jan 2011 17:11:56 +0100 Subject: [PATCH 6/7] remove fixed width from wall-item-content --- view/theme/duepuntozero/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index 76a37e7c4..7fbeed4fe 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -853,7 +853,7 @@ input#dfrn-url { } .wall-item-content { float: left; - width: 450px; + /*width: 450px;*/ margin-left: 10px; margin-bottom: 20px; padding: 20px; From 43be72297a281b41e7b77ba6078aeb48ee007299 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Wed, 26 Jan 2011 17:17:02 +0100 Subject: [PATCH 7/7] Rewrite oembed plugin to use new bbcode tag [embed] and make discovery server-side --- addon/oembed/oembed.js | 47 +++-------------------------------------- addon/oembed/oembed.php | 45 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 44 deletions(-) diff --git a/addon/oembed/oembed.js b/addon/oembed/oembed.js index 26541490b..54547a86e 100644 --- a/addon/oembed/oembed.js +++ b/addon/oembed/oembed.js @@ -3,49 +3,8 @@ function oembed(){ } function oembed_do(){ - embedurl = $('#oembed_url').attr('value'); - var url = 'http://oohembed.com/oohembed/?url='+escape( embedurl )+"&callback=?"; - - $.getJSON(url, function(data) { - var ret=""; - switch(data.type){ - case "video": { - if (data.thumbnail_url){ - tw = 200; if (data.thumbnail_width) tw=data.thumbnail_width; - th = 180; if (data.thumbnail_height) tw=data.thumbnail_height; - ret = ""; - // tiny mce bbcode plugin not support image size...... - ret += ""; - } else { - ret = data.html; - } - }; break; - case "photo": { - // tiny mce bbcode plugin not support image size...... - ret = ""; - }; break; - case "link": { - ret = ""+data.title+""; - }; break; - case "rich": { - ret = data.html; // not so safe... http://www.oembed.com/ : "Consumers may wish to load the HTML in an off-domain iframe to avoid XSS" - }; break; - default: { - alert("Error retriving data!"); - return; - } - } - var embedlink = embedurl; - if (data.title) embedlink = data.title - ret+="
"+embedlink+""; - if (data.author_name) { - ret+=" by "+data.author_name; - } - if (data.provider_name) { - ret+=" on "+data.provider_name; - } - tinyMCE.execCommand('mceInsertRawHTML',false,ret); - oembed(); - }); + embed = "[embed]"+$('#oembed_url').attr('value')+"[/embed]"; + tinyMCE.execCommand('mceInsertRawHTML',false,embed); + oembed(); } diff --git a/addon/oembed/oembed.php b/addon/oembed/oembed.php index 55654a543..82183f3cc 100644 --- a/addon/oembed/oembed.php +++ b/addon/oembed/oembed.php @@ -10,11 +10,13 @@ function oembed_install() { register_hook('jot_tool', 'addon/oembed/oembed.php', 'oembed_hook_jot_tool'); register_hook('page_header', 'addon/oembed/oembed.php', 'oembed_hook_page_header'); + register_hook('bbcode', 'addon/oembed/oembed.php', 'oembed_hook_bbcode'); } function oembed_uninstall() { unregister_hook('jot_tool', 'addon/oembed/oembed.php', 'oembed_hook_jot_tool'); unregister_hook('page_header', 'addon/oembed/oembed.php', 'oembed_hook_page_header'); + unregister_hook('bbcode', 'addon/oembed/oembed.php', 'oembed_hook_bbcode'); } function oembed_hook_page_header($a, &$b){ @@ -51,6 +53,49 @@ function oembed_hook_jot_tool($a, &$b) { '; } +function oembed_replacecb($matches){ + $embedurl=$matches[1]; + $ourl = "http://oohembed.com/oohembed/?url=".urlencode($embedurl); + $txt = fetch_url($ourl); + $j = json_decode($txt); + $ret=""; + switch ($j->type) { + case "video": { + if (isset($j->thumbnail_url)) { + $tw = (isset($j->thumbnail_width)) ? $j->thumbnail_width:200; + $th = (isset($j->thumbnail_height)) ? $j->thumbnail_height:180; + $ret = ""; + $ret.= ""; + $ret.= ""; + } else { + $ret=$j->html; + } + $ret.="
"; + }; break; + case "photo": { + $ret = ""; + $ret.="
"; + }; break; + case "link": { + //$ret = "".$j->title.""; + }; break; + case "rich": { + // not so safe.. + $ret = "
".$j->html."
"; + }; break; + } + + $embedlink = (isset($j->title))?$j->title:$embedurl; + $ret .= "$embedlink"; + if (isset($j->author_name)) $ret.=" by ".$j->author_name; + if (isset($j->provider_name)) $ret.=" on ".$j->provider_name; + $ret.=""; + return $ret; +} + +function oembed_hook_bbcode($a, &$text){ + $text = preg_replace_callback("/\[embed\](.+?)\[\/embed\]/is", oembed_replacecb ,$text); +} ?> \ No newline at end of file