From 67f3c1a8d40d6e05ea2fa72af917b26fb9503e06 Mon Sep 17 00:00:00 2001 From: csarven Date: Fri, 14 Nov 2008 16:05:06 -0500 Subject: [PATCH] trac626 Put a list of feed links darcs-hash:20081114210506-eefa4-ba7e9bdd794ddfcacc397d732073abf99e97f3a5.gz --- actions/all.php | 5 +++ actions/replies.php | 5 +++ actions/showfavorites.php | 4 ++ actions/showstream.php | 17 +++++++++ lib/personal.php | 70 ++++++++++++++++++++++++++++++++++- lib/util.php | 3 ++ theme/default/display.css | 31 ++++++++++++++++ theme/identica/icon_foaf.gif | Bin 0 -> 1144 bytes theme/identica/icon_rss.png | Bin 0 -> 781 bytes 9 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 theme/identica/icon_foaf.gif create mode 100644 theme/identica/icon_rss.png diff --git a/actions/all.php b/actions/all.php index bd5b9f01e5..729b8dd16a 100644 --- a/actions/all.php +++ b/actions/all.php @@ -69,6 +69,11 @@ class AllAction extends StreamAction { } $this->views_menu(); + + $this->show_feeds_list(array(0=>array('href'=>common_local_url('allrss', array('nickname' => $user->nickname)), + 'type' => 'rss', + 'version' => 'RSS 1.0', + 'item' => 'allrss'))); } function show_notices($user) { diff --git a/actions/replies.php b/actions/replies.php index f5bc2ce1a4..529ce7e980 100644 --- a/actions/replies.php +++ b/actions/replies.php @@ -73,6 +73,11 @@ class RepliesAction extends StreamAction { } $this->views_menu(); + + $this->show_feeds_list(array(0=>array('href'=>common_local_url('repliesrss', array('nickname' => $user->nickname)), + 'type' => 'rss', + 'version' => 'RSS 1.0', + 'item' => 'repliesrss'))); } function show_replies($user) { diff --git a/actions/showfavorites.php b/actions/showfavorites.php index f7061dc08e..c18c73a7a1 100644 --- a/actions/showfavorites.php +++ b/actions/showfavorites.php @@ -68,6 +68,10 @@ class ShowfavoritesAction extends StreamAction { common_notice_form('all'); } + $this->show_feeds_list(array(0=>array('href'=>common_local_url('favoritesrss', array('nickname' => $user->nickname)), + 'type' => 'rss', + 'version' => 'RSS 1.0', + 'item' => 'Favorites'))); $this->views_menu(); } diff --git a/actions/showstream.php b/actions/showstream.php index 16bffa4ea7..9db31c108e 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -72,8 +72,25 @@ class ShowstreamAction extends StreamAction { } $this->views_menu(); + + $this->show_feeds_list(array(0=>array('href'=>common_local_url('userrss', array('nickname' => $user->nickname)), + 'type' => 'rss', + 'version' => 'RSS 1.0', + 'item' => 'notices'), + 1=>array('href'=>common_local_url('usertimeline', array('nickname' => $user->nickname)), + 'type' => 'atom', + 'version' => 'Atom 1.0', + 'item' => 'usertimeline'), + + 2=>array('href'=>common_local_url('foaf',array('nickname' => $user->nickname)), + 'type' => 'rdf', + 'version' => 'FOAF', + 'item' => 'foaf'))); } + + + function show_header($user) { # Feeds common_element('link', array('rel' => 'alternate', diff --git a/lib/personal.php b/lib/personal.php index 248b4cc6bb..f1c6ea9b13 100644 --- a/lib/personal.php +++ b/lib/personal.php @@ -84,6 +84,74 @@ class PersonalAction extends Action { common_element_end('ul'); } + + function show_feeds_list($feeds) { + common_element_start('div', array('class' => 'feeds')); + common_element('p', null, 'Feeds:'); + common_element_start('ul', array('class' => 'xoxo')); + + foreach ($feeds as $key => $value) { + $this->common_feed_item($feeds[$key]); + } + common_element_end('ul'); + common_element_end('div'); + } + + function common_feed_item($feed) { + $nickname = $this->trimmed('nickname'); + + switch($feed['item']) { + case 'notices': default: + $feed_classname = $feed['type']; + $feed_mimetype = "application/".$feed['type']."+xml"; + $feed_title = "$nickname's ".$feed['version']." notice feed"; + $feed['textContent'] = "RSS"; + break; + + case 'allrss': + $feed_classname = $feed['type']; + $feed_mimetype = "application/".$feed['type']."+xml"; + $feed_title = $feed['version']." feed for $nickname and friends"; + $feed['textContent'] = "RSS"; + break; + + case 'repliesrss': + $feed_classname = $feed['type']; + $feed_mimetype = "application/".$feed['type']."+xml"; + $feed_title = $feed['version']." feed for replies to $nickname"; + $feed['textContent'] = "RSS"; + break; + + case 'foaf': + $feed_classname = "foaf"; + $feed_mimetype = "application/".$feed['type']."+xml"; + $feed_title = "$nickname's FOAF file"; + $feed['textContent'] = "FOAF"; + break; + + case 'favoritesrss': + $feed_classname = "favorites"; + $feed_mimetype = "application/".$feed['type']."+xml"; + $feed_title = "Feed for favorites of $nickname"; + $feed['textContent'] = "RSS"; + break; + + case 'usertimeline': + $feed_classname = "atom"; + $feed_mimetype = "application/".$feed['type']."+xml"; + $feed_title = "$nickname's ".$feed['version']." notice feed"; + $feed['textContent'] = "Atom"; + break; + } + common_element_start('li'); + common_element('a', array('href' => $feed['href'], + 'class' => $feed_classname, + 'type' => $feed_mimetype, + 'title' => $feed_title), + $feed['textContent']); + common_element_end('li'); + } + function source_link($source) { $source_name = _($source); @@ -107,4 +175,4 @@ class PersonalAction extends Action { } return; } -} \ No newline at end of file +} diff --git a/lib/util.php b/lib/util.php index 6f6d615e5c..2b4071ba6d 100644 --- a/lib/util.php +++ b/lib/util.php @@ -1029,6 +1029,9 @@ function common_fancy_url($action, $args=NULL) { } else { return common_path($args['nickname']); } + + case 'usertimeline': + return common_path("api/statuses/user_timeline/".$args['nickname']."atom"); case 'confirmaddress': return common_path('main/confirmaddress/'.$args['code']); case 'userbyid': diff --git a/theme/default/display.css b/theme/default/display.css index f4eb917ef9..b17e5f4482 100644 --- a/theme/default/display.css +++ b/theme/default/display.css @@ -138,6 +138,37 @@ p#branding a { border-right: 1px solid #dcaa3f; } + +.feeds { +clear:both; +float:right; +margin-top:1.25em; +position:absolute; +right:0; +bottom:-30px; +} +.feeds * { +line-height:1.4; +padding:0; +margin:0; +font-size:12px; +} + +.feeds p { +font-weight:bold; +display:inline; +display:none; +} +.feeds ul { +display:inline; +} +.feeds li { +list-style-type:none; +display:inline; +margin-left:0.5em; +} + + /* ----- Nav Footer ----- */ #nav_sub { clear: both; diff --git a/theme/identica/icon_foaf.gif b/theme/identica/icon_foaf.gif new file mode 100644 index 0000000000000000000000000000000000000000..f8f78442355bf0d0b509536bca7c57b4eedab04a GIT binary patch literal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u{>3~=f{5zlh9 literal 0 HcmV?d00001 diff --git a/theme/identica/icon_rss.png b/theme/identica/icon_rss.png new file mode 100644 index 0000000000000000000000000000000000000000..da7a39b4e494d1862a21c27aab457210ceeee63b GIT binary patch literal 781 zcmV+o1M>WdP)WV3Mt4THzgF58;c}eX0?$KDu{xhZEaj;P*jU* zldF~ywUHup#9jVG;G#sLKU&zPXogBn%b&UT&OPURE!1IdMD(r>yg!`x`}mZIP>tZ+ zq5Wv@nkd!kP+4&fv8I5vQ&@Ag{?Y5V)p}JO5S(ux1eKGOMJR``&MAfSeBzW3&gHi} ze$$-@h%TQ=yYF8<5(ZgW{>8sg_IwPw@KgD_cRhI(Y5@23bN~OC0XEne&zbCI6Z8Y9 z()o@9h)l}-cK|Z^X=G&)_kI%lauhQ@@YkS4(TH;gRq0&YQwdg%5Cs)-PEypiAEWN* zDZEYfly6-?W{Sxw0-===EnaFb}Yf7ct)onB!*=5#-qbnZuog#;%z`oGWTf{K0vC z#hmUNBHcHHrxbGkCbgX>Da981Vw9SeHlnqF&{$Gheb5fo8>jrl53CdBOA#_##M_=F zGzKXxp=#?X+ttcTQ5j=wuM!a!PPGgwYjPWG48VLTTCI|)0bpi1VB4mRm3KPj5yd9o zG*;-=0E>R+v_Tgl;OXKj>>Z;ZU78=V^ zR7Q#9o5l*sW2(kXSMxsW