[pLog-svn] r756 - in plugins/trunk/feedreader: . class class/action
class/view class/xml imgs locale templates
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Tue Jan 18 20:45:26 GMT 2005
Author: oscar
Date: 2005-01-18 20:45:26 +0000 (Tue, 18 Jan 2005)
New Revision: 756
Added:
plugins/trunk/feedreader/class/view/
plugins/trunk/feedreader/class/view/feedlistview.class.php
plugins/trunk/feedreader/imgs/
plugins/trunk/feedreader/imgs/down.gif
plugins/trunk/feedreader/imgs/left.gif
Modified:
plugins/trunk/feedreader/class/action/feedreaderaction.class.php
plugins/trunk/feedreader/class/action/readfeedaction.class.php
plugins/trunk/feedreader/class/xml/rssitem.class.php
plugins/trunk/feedreader/locale/locale_en_UK.php
plugins/trunk/feedreader/templates/feed.template
plugins/trunk/feedreader/templates/feedlist.template
Log:
now the plugin looks much better, added a new view to make things easier and also a view with collapsable article topics so that we can have quick overview of the articles in the feed plus also being able to see a bit more.
Modified: plugins/trunk/feedreader/class/action/feedreaderaction.class.php
===================================================================
--- plugins/trunk/feedreader/class/action/feedreaderaction.class.php 2005-01-18 19:56:11 UTC (rev 755)
+++ plugins/trunk/feedreader/class/action/feedreaderaction.class.php 2005-01-18 20:45:26 UTC (rev 756)
@@ -1,9 +1,7 @@
<?php
include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
- include_once( PLOG_CLASS_PATH."class/dao/mylinkscategories.class.php" );
- include_once( PLOG_CLASS_PATH."plugins/feedreader/class/dao/feedreaderdata.class.php" );
- include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+ include_once( PLOG_CLASS_PATH."plugins/feedreader/class/view/feedlistview.class.php" );
class FeedReaderAction extends AdminAction
{
@@ -15,17 +13,7 @@
function perform()
{
- $linkCategories = new MyLinksCategories();
- $blogLinksCategories = $linkCategories->getMyLinksCategories( $this->_blogInfo->getId());
-
- $feedData = new FeedReaderData();
- $feeds = $feedData->getBlogFeeds( $this->_blogInfo->getId());
-
- // show the list with the categories available
- $this->_view = new AdminPluginTemplatedView( $this->_blogInfo, "feedreader", "feedlist" );
- $this->_view->setValue( "mylinkscategories", $blogLinksCategories );
- $this->_view->setValue( "feeds", $feeds );
-
+ $this->_view = new FeedListView( $this->_blogInfo );
$this->setCommonData();
return true;
Modified: plugins/trunk/feedreader/class/action/readfeedaction.class.php
===================================================================
--- plugins/trunk/feedreader/class/action/readfeedaction.class.php 2005-01-18 19:56:11 UTC (rev 755)
+++ plugins/trunk/feedreader/class/action/readfeedaction.class.php 2005-01-18 20:45:26 UTC (rev 756)
@@ -2,9 +2,9 @@
include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
include_once( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
- include_once( PLOG_CLASS_PATH."class/view/admin/adminerrorview.class.php" );
include_once( PLOG_CLASS_PATH."plugins/feedreader/class/xml/rssparser.class.php" );
include_once( PLOG_CLASS_PATH."plugins/feedreader/class/dao/feedreaderdata.class.php" );
+ include_once( PLOG_CLASS_PATH."plugins/feedreader/class/view/feedlistview.class.php" );
include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
class ReadFeedAction extends AdminAction
@@ -15,46 +15,36 @@
function ReadFeedAction( $actionInfo, $request )
{
$this->AdminAction( $actionInfo, $request );
- }
- function validate()
- {
- $this->_feedId = $this->_request->getValue( "feedId" );
-
- $val = new IntegerValidator();
- if( !$val->validate( $this->_feedId )) {
- $this->_view = new AdminErrorView( $this->_blogInfo );
- $this->_view->setMessage( $this->_locale->tr("error_invalid_feed_id" ));
- $this->setCommonData();
-
- return false;
- }
-
- return true;
+ $this->registerFieldValidator( "feedId", new IntegerValidator());
+ $view = new AdminPluginTemplatedView( $this->_blogInfo, "feedreader", "feedlist" );
+ $view->setErrorMessage( $this->_locale->tr("error_invalid_feed_id" ));
+ $this->setValidationErrorView( $view );
}
function perform()
{
+ // get the feed id
+ $this->_feedId = $this->_request->getValue( "feedId" );
+
// load the feed
$feeds = new FeedReaderData();
$feed = $feeds->getFeed( $this->_feedId );
// and check if it is correct
if( !$feed ) {
- $this->_view = new AdminErrorView( $this->_blogInfo );
- $this->_view->setMessage( $this->_locale->tr("error_loading_feed" ));
+ $this->_view = new FeedListView( $this->_blogInfo );
+ $this->_view->setErrorMessage( $this->_locale->tr("error_loading_feed" ));
$this->setCommonData();
-
return false;
}
// also, make sure it has a link to an rss feed
$link = $feed->getMyLink();
if( $link->getRssFeed() == "" ) {
- $this->_view = new AdminErrorView( $this->_blogInfo );
- $this->_view->setMessage( $this->_locale->tr("error_feed_has_no_rss_feed_defined" ));
+ $this->_view = new FeedListView( $this->_blogInfo );
+ $this->_view->setErrorMessage( $this->_locale->tr("error_loading_feed" ));
$this->setCommonData();
-
return false;
}
@@ -71,10 +61,9 @@
$rssParser = new RssParser();
if( !$rssParser->parse( $link->getRssFeed())) {
- $this->_view = new AdminErrorView( $this->_blogInfo );
- $this->_view->setMessage( $this->_locale->tr("error_fetching_feed" ));
+ $this->_view = new FeedListView( $this->_blogInfo );
+ $this->_view->setErrorMessage( $this->_locale->tr("error_loading_feed" ));
$this->setCommonData();
-
return false;
}
Added: plugins/trunk/feedreader/class/view/feedlistview.class.php
===================================================================
--- plugins/trunk/feedreader/class/view/feedlistview.class.php 2005-01-18 19:56:11 UTC (rev 755)
+++ plugins/trunk/feedreader/class/view/feedlistview.class.php 2005-01-18 20:45:26 UTC (rev 756)
@@ -0,0 +1,28 @@
+<?php
+
+ include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+ include_once( PLOG_CLASS_PATH."plugins/feedreader/class/dao/feedreaderdata.class.php" );
+
+ /**
+ * implements the main view of the feed reader plugin
+ */
+ class FeedListView extends AdminPluginTemplatedView
+ {
+
+ function FeedListView( $blogInfo )
+ {
+ $this->AdminPluginTemplatedView( $blogInfo, "feedreader", "feedlist" );
+ }
+
+ function render()
+ {
+ $feedData = new FeedReaderData();
+ $feeds = $feedData->getBlogFeeds( $this->_blogInfo->getId());
+
+ // show the list with the categories available
+ $this->setValue( "feeds", $feeds );
+
+ parent::render();
+ }
+ }
+?>
\ No newline at end of file
Modified: plugins/trunk/feedreader/class/xml/rssitem.class.php
===================================================================
--- plugins/trunk/feedreader/class/xml/rssitem.class.php 2005-01-18 19:56:11 UTC (rev 755)
+++ plugins/trunk/feedreader/class/xml/rssitem.class.php 2005-01-18 20:45:26 UTC (rev 756)
@@ -86,5 +86,15 @@
{
return $this->_item[$key];
}
+
+ /**
+ * returns a unique id for this item
+ *
+ * @return a unique id
+ */
+ function getUniqueId()
+ {
+ return( md5( $this->getLink().$this->getTitle().$this->getDescription()));
+ }
}
?>
Added: plugins/trunk/feedreader/imgs/down.gif
===================================================================
(Binary files differ)
Property changes on: plugins/trunk/feedreader/imgs/down.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: plugins/trunk/feedreader/imgs/left.gif
===================================================================
(Binary files differ)
Property changes on: plugins/trunk/feedreader/imgs/left.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: plugins/trunk/feedreader/locale/locale_en_UK.php
===================================================================
--- plugins/trunk/feedreader/locale/locale_en_UK.php 2005-01-18 19:56:11 UTC (rev 755)
+++ plugins/trunk/feedreader/locale/locale_en_UK.php 2005-01-18 20:45:26 UTC (rev 756)
@@ -6,4 +6,7 @@
$messages["error_loading_feed"] = "There was an error loading data about the feed.";
$messages["error_fetching_feed"] = "There was an error fetching the feed.";
$messages["error_feed_has_no_rss_feed_defined"] = "The feed you selected does not have a link to an RSS/Atom feed defined.";
+$messages["read"] = "Read";
+$messages["never_read"] = "Never read";
+$messages["last_read"] = "Last Read";
?>
\ No newline at end of file
Modified: plugins/trunk/feedreader/templates/feed.template
===================================================================
--- plugins/trunk/feedreader/templates/feed.template 2005-01-18 19:56:11 UTC (rev 755)
+++ plugins/trunk/feedreader/templates/feed.template 2005-01-18 20:45:26 UTC (rev 756)
@@ -2,22 +2,44 @@
{include file="$admintemplatepath/navigation.template" showOpt=feedReader title=$locale->tr("feedReader")}
<script type="text/javascript">
{literal}
-function toggleArticle(id)
+function toggleArticle(articleId)
{
-
+ // get the item from the DOM
+ item = document.getElementById( articleId )
+
+ // if nothing found, let's get out of here
+ if( !item )
+ return false;
+
+ // get the icon
+ icon = document.getElementById( 'img_'+articleId );
+
+ // toggle the whole thing
+ if( item.style.display == 'block' ) {
+ item.style.display = 'none';
+ icon.src = "plugins/feedreader/imgs/left.gif";
+ }
+ else {
+ item.style.display = 'block';
+ icon.src = "plugins/feedreader/imgs/down.gif";
+ }
+
+ return true;
}
{/literal}
</script>
+<div id="feed" style="margin-left: 15px; margin-right: 15px">
{assign var=channel value=$rss->getChannel()}
-<h1>{$channel->getTitle()}</h1>
-<p>{$channel->getDescription()}</p>
-<h2>{$locale->tr("summary")}</h2>
-<ul>
+<h4>» {$channel->getTitle()}</h4>
+{if $channel->getDescription()}
+ <p>{$channel->getDescription()}</p>
+{/if}
+<ul style="list-style: none;">
{foreach from=$rss->getItems() item=rssItem}
<li>
- <a name="{$rssItem->getTitle()|strip_tags|truncate:100}"></a>
+ <a onClick="javascript:toggleArticle('{$rssItem->getUniqueId()}');"><img id="img_{$rssItem->getUniqueId()}" src="plugins/feedreader/imgs/left.gif" alt="+" /></a>
<a href="{$rssItem->getLink()}">{$rssItem->getTitle()}</a><br/>
- <p style="display:none">
+ <p style="display:none" id="{$rssItem->getUniqueId()}">
{$rssItem->getDescription()}
</p>
</li>
Modified: plugins/trunk/feedreader/templates/feedlist.template
===================================================================
--- plugins/trunk/feedreader/templates/feedlist.template 2005-01-18 19:56:11 UTC (rev 755)
+++ plugins/trunk/feedreader/templates/feedlist.template 2005-01-18 20:45:26 UTC (rev 756)
@@ -1,6 +1,12 @@
{include file="$admintemplatepath/header.template"}
{include file="$admintemplatepath/navigation.template" showOpt=feedReader title=$locale->tr("feedReader")}
<div id="list">
+ {if $viewIsSuccess}
+ {include file="$admintemplatepath/successmessage.template" message=$viewSuccessMessage}<br/>
+ {/if}
+ {if $viewIsError}
+ {include file="$admintemplatepath/errormessage.template" message=$viewErrorMessage}<br/>
+ {/if}
<table class="info">
<thead>
<tr>
More information about the pLog-svn
mailing list