From e8d45a4644f1435d6687a3a744a94c2d5a7acb9b Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 25 Aug 2011 11:30:07 -0700 Subject: [PATCH 1/6] * Add conversation ID to Twitter compatible API * Fix formatting of blocking info in JSON API output --- lib/apiaction.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/apiaction.php b/lib/apiaction.php index 64b4284f6a..7b2f70c07c 100644 --- a/lib/apiaction.php +++ b/lib/apiaction.php @@ -241,13 +241,13 @@ class ApiAction extends Action // Is the requesting user following this user? $twitter_user['following'] = false; - $twitter_user['statusnet:blocking'] = false; + $twitter_user['statusnet_blocking'] = false; $twitter_user['notifications'] = false; if (isset($this->auth_user)) { $twitter_user['following'] = $this->auth_user->isSubscribed($profile); - $twitter_user['statusnet:blocking'] = $this->auth_user->hasBlocked($profile); + $twitter_user['statusnet_blocking'] = $this->auth_user->hasBlocked($profile); // Notifications on? $sub = Subscription::pkeyGet(array('subscriber' => @@ -317,6 +317,7 @@ class ApiAction extends Action $twitter_status['source'] = $source; $twitter_status['id'] = intval($notice->id); + $twitter_status['statusnet_conversation_id'] = intval($notice->conversation); $replier_profile = null; From 8b9258c0ec46f0c12fc4d8d1da73120a4ed62cbc Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 25 Aug 2011 12:48:36 -0700 Subject: [PATCH 2/6] Function to test for RTL language --- lib/language.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/language.php b/lib/language.php index 2af62fea0c..d72380e466 100644 --- a/lib/language.php +++ b/lib/language.php @@ -289,6 +289,21 @@ function get_nice_language_list() return $nice_lang; } +/* + * Check whether a language is right-to-left + * + * @param string $lang language code of the language to check + * + * @return boolean true if language is rtl + */ + +function is_rtl($lang) +{ + $all_languages = common_config('site', 'languages'); + $lang = $all_languages[$lang]; + return ($lang['direction'] == 'rtl'); +} + /** * Get a list of all languages that are enabled in the default config * From 3bdae5aed432386e5f1be049d1ad382c5ea6bf08 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 25 Aug 2011 13:12:44 -0700 Subject: [PATCH 3/6] Link in additional stylesheet for RTL languages --- lib/action.php | 5 ++ theme/neo/css/rtl.css | 157 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 162 insertions(+) create mode 100644 theme/neo/css/rtl.css diff --git a/lib/action.php b/lib/action.php index d63569cba3..c0b251cc05 100644 --- a/lib/action.php +++ b/lib/action.php @@ -277,6 +277,11 @@ class Action extends HTMLOutputter // lawsuit $this->cssLink('css/display.css', $baseTheme, $media); } $this->cssLink('css/display.css', $mainTheme, $media); + + // Additional styles for RTL languages + if (is_rtl(common_language())) { + $this->cssLink('css/rtl.css', $mainTheme, $media); + } } /** diff --git a/theme/neo/css/rtl.css b/theme/neo/css/rtl.css new file mode 100644 index 0000000000..f198fe6474 --- /dev/null +++ b/theme/neo/css/rtl.css @@ -0,0 +1,157 @@ +body { + direction: rtl; +} + +span.rtl{ + direction: rtl !important; +} + +#content .notice .entry-title{ + direction: ltr; +} + +.form_notice textarea{ + direction: ltr; +} + +#site_nav_global_primary ul{ + float: left; +} + +.notice div.entry-content { + float: right; +} + +#content .notice .threaded-replies .notice div.entry-content{ + clear: right; + float: right; +} + +.threaded-replies { + border-right: 3px solid #ECECF2; + border-left: 0; + margin-right: 59px; + margin-left: 0; +} + +address{ + float: right; +} + +#site_nav_global_primary { + left: 0; + right: auto; +} + +.input_form .form_settings .submit{ + float: left; +} + +.input_form .form_settings fieldset fieldset{ + float: right; +} + +.input_form fieldset fieldset label{ + right: 6px; + text-align: right; +} + +#input_form_event .form_settings .form_data li{ + float: right; +} + +.notice .author { + direction: rtl; + float: right; + margin-left: 8px; + margin-right: 0; +} + +.section .notice .author { + margin-left: 0; +} + +.threaded-replies .form_notice #notice_action-submit { + right: 10px; +} + +.form_notice input.submit{ + float: right; +} + +#export_data li a{ + padding-right: 30px; + padding-left: 0; + background-position: right center; +} + +#content .notice .threaded-replies .notice .entry-title{ + margin: 2px 35px 0 7px; +} + +#content .notice .entry-title { + margin: 2px 59px 0 7px; +} + +#content .notice .author .photo{ + right: 0; +} + +.notice-options{ + float: left; +} + +.notice div.entry-content { + margin-right: 59px; + margin-left: 0; +} + +#core .vcard .photo { + margin-left: 11px; + margin-right: 0; +} + +.threaded-replies .notice-reply-comments { + margin: 2px 10px 4px 0; +} + +#shownotice .notice div.entry-content { + margin-right: 0; +} + +.notice .addressees:before { + content: "◂"; +} + +#content thead th { + text-align: right; +} + +.profile_list th.current a { + background-position: left top; + padding-left: 25px; +} + +.form_settings .form_data textarea, .form_settings .form_data select, .form_settings .form_data input { + float: right; +} + +.form_settings .form_data label { + float: right; +} + +.form_settings label { + text-align: left; +} + +#form_search input.submit { + margin-right: 5px; +} + +#site_nav_local_views { + float: right; +} + +#content { + float: right; +} \ No newline at end of file From f0443aff1aa44977615cf08d1e2fc57b2c754612 Mon Sep 17 00:00:00 2001 From: Samantha Doherty Date: Thu, 25 Aug 2011 16:24:54 -0400 Subject: [PATCH 4/6] Style for Activity notices. --- plugins/Activity/ActivityPlugin.php | 12 ++++++------ plugins/Activity/joinlistitem.php | 2 +- plugins/Activity/systemlistitem.php | 2 +- theme/base/css/display.css | 9 +++++++++ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/plugins/Activity/ActivityPlugin.php b/plugins/Activity/ActivityPlugin.php index 92972ff173..1a460219dc 100644 --- a/plugins/Activity/ActivityPlugin.php +++ b/plugins/Activity/ActivityPlugin.php @@ -84,7 +84,7 @@ class ActivityPlugin extends Plugin if (!empty($user)) { $sub = Subscription::pkeyGet(array('subscriber' => $subscriber->id, 'subscribed' => $other->id)); - $rendered = sprintf(_m('%s started following %s.'), + $rendered = sprintf(_m('%s started following %s.'), $subscriber->profileurl, $subscriber->getBestName(), $other->profileurl, @@ -113,7 +113,7 @@ class ActivityPlugin extends Plugin if(!$this->StopFollowUser) return true; $user = $subscriber->getUser(); if (!empty($user)) { - $rendered = sprintf(_m('%s stopped following %s.'), + $rendered = sprintf(_m('%s stopped following %s.'), $subscriber->profileurl, $subscriber->getBestName(), $other->profileurl, @@ -154,7 +154,7 @@ class ActivityPlugin extends Plugin $fave = Fave::pkeyGet(array('user_id' => $user->id, 'notice_id' => $notice->id)); - $rendered = sprintf(_m('%s liked %s\'s update.'), + $rendered = sprintf(_m('%s liked %s\'s update.'), $profile->profileurl, $profile->getBestName(), $notice->bestUrl(), @@ -186,7 +186,7 @@ class ActivityPlugin extends Plugin if (!empty($user)) { $author = Profile::staticGet('id', $notice->profile_id); - $rendered = sprintf(_m('%s stopped liking %s\'s update.'), + $rendered = sprintf(_m('%s stopped liking %s\'s update.'), $profile->profileurl, $profile->getBestName(), $notice->bestUrl(), @@ -226,7 +226,7 @@ class ActivityPlugin extends Plugin return true; } - $rendered = sprintf(_m('%s joined the group %s.'), + $rendered = sprintf(_m('%s joined the group %s.'), $profile->profileurl, $profile->getBestName(), $group->homeUrl(), @@ -262,7 +262,7 @@ class ActivityPlugin extends Plugin return true; } - $rendered = sprintf(_m('%s left the group %s.'), + $rendered = sprintf(_m('%s left the group %s.'), $profile->profileurl, $profile->getBestName(), $group->homeUrl(), diff --git a/plugins/Activity/joinlistitem.php b/plugins/Activity/joinlistitem.php index 1979524001..5764f1d2e6 100644 --- a/plugins/Activity/joinlistitem.php +++ b/plugins/Activity/joinlistitem.php @@ -58,7 +58,7 @@ class JoinListItem extends SystemListItem $out->elementStart('div', 'join-activity'); $profile = $mem->getMember(); $group = $mem->getGroup(); - $out->raw(sprintf(_m('%s joined the group %s.'), + $out->raw(sprintf(_m('%s joined the group %s.'), $profile->profileurl, $profile->getBestName(), $group->homeUrl(), diff --git a/plugins/Activity/systemlistitem.php b/plugins/Activity/systemlistitem.php index d2b99c802e..0b8d2f4c02 100644 --- a/plugins/Activity/systemlistitem.php +++ b/plugins/Activity/systemlistitem.php @@ -56,7 +56,7 @@ class SystemListItem extends NoticeListItemAdapter function showNotice() { $out = $this->nli->out; - $out->elementStart('div'); + $out->elementStart('div', 'entry-title'); $this->showContent(); $out->elementEnd('div'); } diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 9ad1b4ec15..5b18772db8 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -1514,6 +1514,15 @@ content:'☠'; font-size:150%; } +#content .notice-source-system div.entry-title, .notice-source-system div.entry-content { + margin-left: 0; +} + +#content .notice-source-system div.entry-title { + font-style: italic; + min-height: 0; +} + /* override OStatus plugin style */ #form_ostatus_connect.form_settings.dialogbox, #form_ostatus_sub.dialogbox { From 2dd13b071c828af0b1004f50402cf9ed46f05c4c Mon Sep 17 00:00:00 2001 From: Samantha Doherty Date: Thu, 25 Aug 2011 17:14:13 -0400 Subject: [PATCH 5/6] Update DirectionDetector style for 1.0 and move to base stylesheet. --- plugins/DirectionDetector/DirectionDetectorPlugin.php | 9 --------- theme/base/css/display.css | 7 +++++++ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/plugins/DirectionDetector/DirectionDetectorPlugin.php b/plugins/DirectionDetector/DirectionDetectorPlugin.php index be8dbea8e5..890af06807 100644 --- a/plugins/DirectionDetector/DirectionDetectorPlugin.php +++ b/plugins/DirectionDetector/DirectionDetectorPlugin.php @@ -42,15 +42,6 @@ class DirectionDetectorPlugin extends Plugin { return true; } - /** - * SN plugin API, here we will add css needed for modifiyed rendered - * - * @param Action $xml - */ - public function onEndShowStatusNetStyles($xml){ - $xml->element('style', array('type' => 'text/css'), 'span.rtl {display:block;direction:rtl;text-align:right;float:right;} .notice .author {float:left}'); - } - /** * is passed string a rtl content or not * diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 5b18772db8..5d65c14cc8 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -1521,6 +1521,13 @@ font-size:150%; #content .notice-source-system div.entry-title { font-style: italic; min-height: 0; +} + +span.rtl { + display: block; + direction: rtl; + text-align: right; + float: right; } /* override OStatus plugin style */ From 8ea5cd0cac762e99bdec69e6ec5ad5bdf1e14150 Mon Sep 17 00:00:00 2001 From: Samantha Doherty Date: Thu, 25 Aug 2011 17:48:27 -0400 Subject: [PATCH 6/6] Check for existence of RTL stylesheets; placeholder files for base and neo themes. --- lib/action.php | 4 +- theme/base/css/rtl.css | 1 + theme/neo/css/rtl.css | 158 +---------------------------------------- 3 files changed, 5 insertions(+), 158 deletions(-) create mode 100644 theme/base/css/rtl.css diff --git a/lib/action.php b/lib/action.php index c0b251cc05..ed0144515c 100644 --- a/lib/action.php +++ b/lib/action.php @@ -280,7 +280,9 @@ class Action extends HTMLOutputter // lawsuit // Additional styles for RTL languages if (is_rtl(common_language())) { - $this->cssLink('css/rtl.css', $mainTheme, $media); + if (file_exists(Theme::file('css/rtl.css'))) { + $this->cssLink('css/rtl.css', $mainTheme, $media); + } } } diff --git a/theme/base/css/rtl.css b/theme/base/css/rtl.css new file mode 100644 index 0000000000..a9b6e593cd --- /dev/null +++ b/theme/base/css/rtl.css @@ -0,0 +1 @@ +/* placeholder for RTL style */ diff --git a/theme/neo/css/rtl.css b/theme/neo/css/rtl.css index f198fe6474..a9b6e593cd 100644 --- a/theme/neo/css/rtl.css +++ b/theme/neo/css/rtl.css @@ -1,157 +1 @@ -body { - direction: rtl; -} - -span.rtl{ - direction: rtl !important; -} - -#content .notice .entry-title{ - direction: ltr; -} - -.form_notice textarea{ - direction: ltr; -} - -#site_nav_global_primary ul{ - float: left; -} - -.notice div.entry-content { - float: right; -} - -#content .notice .threaded-replies .notice div.entry-content{ - clear: right; - float: right; -} - -.threaded-replies { - border-right: 3px solid #ECECF2; - border-left: 0; - margin-right: 59px; - margin-left: 0; -} - -address{ - float: right; -} - -#site_nav_global_primary { - left: 0; - right: auto; -} - -.input_form .form_settings .submit{ - float: left; -} - -.input_form .form_settings fieldset fieldset{ - float: right; -} - -.input_form fieldset fieldset label{ - right: 6px; - text-align: right; -} - -#input_form_event .form_settings .form_data li{ - float: right; -} - -.notice .author { - direction: rtl; - float: right; - margin-left: 8px; - margin-right: 0; -} - -.section .notice .author { - margin-left: 0; -} - -.threaded-replies .form_notice #notice_action-submit { - right: 10px; -} - -.form_notice input.submit{ - float: right; -} - -#export_data li a{ - padding-right: 30px; - padding-left: 0; - background-position: right center; -} - -#content .notice .threaded-replies .notice .entry-title{ - margin: 2px 35px 0 7px; -} - -#content .notice .entry-title { - margin: 2px 59px 0 7px; -} - -#content .notice .author .photo{ - right: 0; -} - -.notice-options{ - float: left; -} - -.notice div.entry-content { - margin-right: 59px; - margin-left: 0; -} - -#core .vcard .photo { - margin-left: 11px; - margin-right: 0; -} - -.threaded-replies .notice-reply-comments { - margin: 2px 10px 4px 0; -} - -#shownotice .notice div.entry-content { - margin-right: 0; -} - -.notice .addressees:before { - content: "◂"; -} - -#content thead th { - text-align: right; -} - -.profile_list th.current a { - background-position: left top; - padding-left: 25px; -} - -.form_settings .form_data textarea, .form_settings .form_data select, .form_settings .form_data input { - float: right; -} - -.form_settings .form_data label { - float: right; -} - -.form_settings label { - text-align: left; -} - -#form_search input.submit { - margin-right: 5px; -} - -#site_nav_local_views { - float: right; -} - -#content { - float: right; -} \ No newline at end of file +/* placeholder for RTL style */