From 0093b035c12bf21c88f57e4f0931b0abce214f43 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 13 Jan 2009 23:48:05 -0500 Subject: Modify public stream to use new UI framework I modified public.php to use the new UI framework. Since the Action class isn't functional yet, I don't know if it works. I took some of the functionality, like the public tabs nav and the feeds list, and made them widgets. I also moved the navigation from common_navigation() to a method of Action. --- lib/feedlist.php | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 lib/feedlist.php (limited to 'lib/feedlist.php') diff --git a/lib/feedlist.php b/lib/feedlist.php new file mode 100644 index 000000000..0ff88cb25 --- /dev/null +++ b/lib/feedlist.php @@ -0,0 +1,156 @@ +. + * + * @category Widget + * @package Laconica + * @author Evan Prodromou + * @author Sarven Capadisli + * @copyright 2008 Control Yourself, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ + */ + +if (!defined('LACONICA')) { + exit(1); +} + +/** + * Widget for showing a list of feeds + * + * Typically used for Action::showExportList() + * + * @category Widget + * @package Laconica + * @author Evan Prodromou + * @author Sarven Capadisli + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ + * + * @see Action::showExportList() + */ + +class FeedList +{ + var $out = null; + + function __construct($out=null) + { + $this->out = $out; + } + + function show($feeds) + { + $this->out->elementStart('div', array('class' => 'feeds')); + $this->out->element('p', null, 'Feeds:'); + $this->out->elementStart('ul', array('class' => 'xoxo')); + + foreach ($feeds as $key => $value) { + $this->feedItem($feeds[$key]); + } + + $this->out->elementEnd('ul'); + $this->out->elementEnd('div'); + } + + function feedItem($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 'publicrss': + $feed_classname = $feed['type']; + $feed_mimetype = "application/".$feed['type']."+xml"; + $feed_title = "Public timeline ".$feed['version']." feed"; + $feed['textContent'] = "RSS"; + break; + + case 'publicatom': + $feed_classname = "atom"; + $feed_mimetype = "application/".$feed['type']."+xml"; + $feed_title = "Public timeline ".$feed['version']." feed"; + $feed['textContent'] = "Atom"; + break; + + case 'tagrss': + $feed_classname = $feed['type']; + $feed_mimetype = "application/".$feed['type']."+xml"; + $feed_title = $feed['version']." feed for this tag"; + $feed['textContent'] = "RSS"; + break; + + case 'favoritedrss': + $feed_classname = $feed['type']; + $feed_mimetype = "application/".$feed['type']."+xml"; + $feed_title = "Favorited ".$feed['version']." feed"; + $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; + } + $this->out->elementStart('li'); + $this->out->element('a', array('href' => $feed['href'], + 'class' => $feed_classname, + 'type' => $feed_mimetype, + 'title' => $feed_title), + $feed['textContent']); + $this->out->elementEnd('li'); + } +} -- cgit v1.2.3-54-g00ecf From 37350e873d7d0d3350c4286a0c7d028ffe49825a Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 15 Jan 2009 20:22:14 +0000 Subject: Make the feedlist work -- kinda --- actions/public.php | 1 + lib/feedlist.php | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'lib/feedlist.php') diff --git a/actions/public.php b/actions/public.php index 76e922dff..62071eccc 100644 --- a/actions/public.php +++ b/actions/public.php @@ -33,6 +33,7 @@ if (!defined('LACONICA')) { require_once INSTALLDIR.'/lib/publicgroupnav.php'; require_once INSTALLDIR.'/lib/noticelist.php'; +require_once INSTALLDIR.'/lib/feedlist.php'; /** * Action for displaying the public stream diff --git a/lib/feedlist.php b/lib/feedlist.php index 0ff88cb25..9bc77ca15 100644 --- a/lib/feedlist.php +++ b/lib/feedlist.php @@ -47,13 +47,14 @@ if (!defined('LACONICA')) { * @see Action::showExportList() */ -class FeedList +class FeedList extends Widget { - var $out = null; - - function __construct($out=null) + var $action = null; + + function __construct($action=null) { - $this->out = $out; + parent::__construct($action); + $this->action = $action; } function show($feeds) @@ -72,7 +73,7 @@ class FeedList function feedItem($feed) { - $nickname = $this->trimmed('nickname'); + $nickname = $this->action->trimmed('nickname'); switch($feed['item']) { case 'notices': default: -- cgit v1.2.3-54-g00ecf From cf809f6464ee41ccbb654d226f328457fc2e5299 Mon Sep 17 00:00:00 2001 From: sarven Date: Thu, 15 Jan 2009 21:58:07 +0000 Subject: feed show() id and class --- lib/feedlist.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/feedlist.php') diff --git a/lib/feedlist.php b/lib/feedlist.php index 9bc77ca15..47d909e96 100644 --- a/lib/feedlist.php +++ b/lib/feedlist.php @@ -59,8 +59,9 @@ class FeedList extends Widget function show($feeds) { - $this->out->elementStart('div', array('class' => 'feeds')); - $this->out->element('p', null, 'Feeds:'); + $this->out->elementStart('div', array('id' => 'export_data', + 'class' => 'section')); + $this->out->element('h2', null, _('Export data')); $this->out->elementStart('ul', array('class' => 'xoxo')); foreach ($feeds as $key => $value) { -- cgit v1.2.3-54-g00ecf