From 1e37bc139bb28e6fe9b0dd0d477e2dbef5a2cab9 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Sun, 14 Oct 2012 21:15:16 +0200 Subject: Whitespace cleanup --- ajax/changefoldername.php | 4 +- ajax/collapsefolder.php | 4 +- ajax/importopml.php | 14 +- ajax/loadfeed.php | 4 +- ajax/movefeedtofolder.php | 4 +- ajax/setallitemsread.php | 14 +- ajax/setitemstatus.php | 4 +- ajax/updatefeed.php | 2 +- ajax/usersettings.php | 8 +- appinfo/app.php | 14 +- controllers/controller.php | 18 ++- controllers/news.controller.php | 16 +-- css/firstrun.css | 42 +++--- css/news.css | 280 ++++++++++++++++++++-------------------- index.php | 2 +- js/cache.js | 2 - js/firstrun.js | 6 +- js/items.js | 4 +- js/main.js | 8 +- js/menu.js | 16 +-- js/news.js | 14 +- js/settings.js | 6 +- lib/backgroundjob.php | 16 +-- lib/collection.php | 12 +- lib/feed.php | 8 +- lib/feedmapper.php | 20 +-- lib/folder.php | 4 +- lib/foldermapper.php | 30 ++--- lib/item.php | 30 ++--- lib/itemmapper.php | 66 +++++----- lib/utils.php | 10 +- opmlexporter.php | 2 +- opmlparser.php | 20 +-- subscribe.php | 14 +- templates/main.php | 1 - templates/part.feeds.php | 4 +- templates/part.items.php | 12 +- templates/part.listfolder.php | 2 +- templates/subscribelet.php | 2 +- templates/test.php | 2 +- tests/index.php | 8 +- 41 files changed, 369 insertions(+), 380 deletions(-) diff --git a/ajax/changefoldername.php b/ajax/changefoldername.php index e7a7b6f1b..9c829bccb 100644 --- a/ajax/changefoldername.php +++ b/ajax/changefoldername.php @@ -4,10 +4,10 @@ * * @author Bernhard Posselt * Copyright (c) 2012 - Bernhard Posselt -* +* * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file -* +* */ // Check if we are a user diff --git a/ajax/collapsefolder.php b/ajax/collapsefolder.php index 66d879d2c..5c170a8e6 100644 --- a/ajax/collapsefolder.php +++ b/ajax/collapsefolder.php @@ -4,10 +4,10 @@ * * @author Bernhard Posselt * Copyright (c) 2012 - Bernhard Posselt -* +* * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file -* +* */ // Check if we are a user diff --git a/ajax/importopml.php b/ajax/importopml.php index f826fd81b..adf14e86e 100644 --- a/ajax/importopml.php +++ b/ajax/importopml.php @@ -26,7 +26,7 @@ function bailOut($msg) { if(!isset($_POST['path'])) { bailOut($l->t('No file path was submitted.')); -} +} require_once 'news/opmlparser.php'; @@ -39,7 +39,7 @@ try { } if ($parsed == null) { - bailOut($l->t('An error occurred while parsing the file.')); + bailOut($l->t('An error occurred while parsing the file.')); } $data = $parsed->getData(); @@ -65,7 +65,7 @@ function importFeed($feedurl, $folderid) { OCP\Util::writeLog('news','ajax/importopml.php: Error adding feed: '. $feedurl, OCP\Util::ERROR); return false; } - + return true; } @@ -86,7 +86,7 @@ function importFolder($name, $parentid) { OCP\Util::writeLog('news','ajax/importopml.php: Error adding folder' . $name, OCP\Util::ERROR); return null; } - + return $folderid; } @@ -94,11 +94,11 @@ function importList($data, $parentid) { $countsuccess = 0; foreach($data as $collection) { if ($collection instanceOf OCA\News\Feed) { - $feedurl = $collection->getUrl(); + $feedurl = $collection->getUrl(); if (importFeed($feedurl, $parentid)) { $countsuccess++; } - } + } else if ($collection instanceOf OCA\News\Folder) { $folderid = importFolder($collection->getName(), $parentid); if ($folderid) { @@ -115,5 +115,5 @@ function importList($data, $parentid) { $countsuccess = importList($data, 0); -OCP\JSON::success(array('data' => array('title'=>$parsed->getTitle(), 'count'=>$parsed->getCount(), +OCP\JSON::success(array('data' => array('title'=>$parsed->getTitle(), 'count'=>$parsed->getCount(), 'countsuccess'=>$countsuccess))); diff --git a/ajax/loadfeed.php b/ajax/loadfeed.php index 45d6071e5..1880f2986 100644 --- a/ajax/loadfeed.php +++ b/ajax/loadfeed.php @@ -26,8 +26,8 @@ $feedId = (int)$_POST['id']; $feedType = (int)$_POST['type']; -OCP\Config::setUserValue(OCP\USER::getUser(), 'news', 'lastViewedFeed', $feedId); -OCP\Config::setUserValue(OCP\USER::getUser(), 'news', 'lastViewedFeedType', $feedType); +OCP\Config::setUserValue(OCP\USER::getUser(), 'news', 'lastViewedFeed', $feedId); +OCP\Config::setUserValue(OCP\USER::getUser(), 'news', 'lastViewedFeedType', $feedType); $showAll = OCP\Config::getUserValue(OCP\USER::getUser(), 'news', 'showAll'); diff --git a/ajax/movefeedtofolder.php b/ajax/movefeedtofolder.php index 4a3747bb6..92d618c67 100644 --- a/ajax/movefeedtofolder.php +++ b/ajax/movefeedtofolder.php @@ -4,10 +4,10 @@ * * @author Bernhard Posselt * Copyright (c) 2012 - Bernhard Posselt -* +* * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file -* +* */ // Check if we are a user diff --git a/ajax/setallitemsread.php b/ajax/setallitemsread.php index f6d206e20..059c14749 100644 --- a/ajax/setallitemsread.php +++ b/ajax/setallitemsread.php @@ -4,10 +4,10 @@ * * @author Bernhard Posselt * Copyright (c) 2012 - Bernhard Posselt -* +* * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file -* +* */ // Check if we are a user @@ -26,19 +26,19 @@ switch ($feedId) { case -2: $items = $itemMapper->findEveryItemByStatus(OCA\News\StatusFlag::UNREAD); break; - + case -1: $items = $itemMapper->findEveryItemByStatus(OCA\News\StatusFlag::UNREAD | OCA\News\StatusFlag::IMPORTANT); break; default: - $items = $itemMapper->findAllStatus($feedId, OCA\News\StatusFlag::UNREAD); + $items = $itemMapper->findAllStatus($feedId, OCA\News\StatusFlag::UNREAD); break; } // FIXME: maybe there is a way to set all items read in the -// FeedMapper instead of iterating through every item and updating as +// FeedMapper instead of iterating through every item and updating as // necessary $success = false; if($mostRecentItemId !== 0) { @@ -50,8 +50,8 @@ foreach($items as $item) { // FIXME: this should compare the modified date if($mostRecentItemId === 0 || $item->getDate() <= $mostRecentItem->getDate()) { $item->setRead(); - $success = $itemMapper->update($item); - $unreadCount--; + $success = $itemMapper->update($item); + $unreadCount--; } } diff --git a/ajax/setitemstatus.php b/ajax/setitemstatus.php index 9586940b3..1886de738 100644 --- a/ajax/setitemstatus.php +++ b/ajax/setitemstatus.php @@ -4,10 +4,10 @@ * * @author Alessandro Cosentino * Copyright (c) 2012 - Alessandro Cosentino -* +* * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file -* +* */ // Check if we are a user diff --git a/ajax/updatefeed.php b/ajax/updatefeed.php index 5c981f38d..19542fa6d 100644 --- a/ajax/updatefeed.php +++ b/ajax/updatefeed.php @@ -41,7 +41,7 @@ if(!$newfeedid) { else { $itemmapper = new OCA\News\ItemMapper($userid); $unreadcounter = $itemmapper->countAllStatus($newfeedid, OCA\News\StatusFlag::UNREAD); - + OCP\JSON::success(array('data' => array('message' => $l->t('Feed updated!'), 'unreadcount' => $unreadcounter))); exit(); } diff --git a/ajax/usersettings.php b/ajax/usersettings.php index f027ee91b..2602230dd 100644 --- a/ajax/usersettings.php +++ b/ajax/usersettings.php @@ -4,10 +4,10 @@ * * @author Bernhard Posselt * Copyright (c) 2012 - Bernhard Posselt -* +* * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file -* +* */ // Check if we are a user @@ -22,7 +22,7 @@ if(isset($_POST['showAll'])) { } else { $showAll = true; } - OCP\Config::setUserValue(OCP\USER::getUser(), 'news', 'showAll', $showAll); + OCP\Config::setUserValue(OCP\USER::getUser(), 'news', 'showAll', $showAll); } -OCP\JSON::success(); +OCP\JSON::success(); diff --git a/appinfo/app.php b/appinfo/app.php index 9609ffa59..ed51748da 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -4,10 +4,10 @@ * * @author Alessandro Cosentino * Copyright (c) 2012 - Alessandro Cosentino -* +* * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file -* +* */ OC::$CLASSPATH['OCA\News\StatusFlag'] = 'apps/news/lib/item.php'; @@ -27,10 +27,10 @@ OCP\Backgroundjob::addRegularTask( 'OCA\News\Backgroundjob', 'run' ); $l = new OC_l10n('news'); -OCP\App::addNavigationEntry( array( - 'id' => 'news', - 'order' => 74, - 'href' => OC_Helper::linkTo( 'news', 'index.php' ), - 'icon' => OC_Helper::imagePath( 'news', 'icon.svg' ), +OCP\App::addNavigationEntry( array( + 'id' => 'news', + 'order' => 74, + 'href' => OC_Helper::linkTo( 'news', 'index.php' ), + 'icon' => OC_Helper::imagePath( 'news', 'icon.svg' ), 'name' => $l->t('News') )); diff --git a/controllers/controller.php b/controllers/controller.php index 73ad3ad4d..032cb45ee 100644 --- a/controllers/controller.php +++ b/controllers/controller.php @@ -16,8 +16,8 @@ class Controller { protected $userId; protected $trans; - - + + public function __construct(){ $this->userId = \OCP\USER::getUser(); $this->trans = \OC_L10N::get('news'); @@ -51,7 +51,7 @@ class Controller { * @param $value the value that you want to store */ protected function setUserValue($key, $value){ - \OCP\Config::setUserValue($this->userId, 'news', $key, $value); + \OCP\Config::setUserValue($this->userId, 'news', $key, $value); } @@ -73,22 +73,22 @@ class Controller { * @param $fullPage if true, it will render a full page, otherwise only a part * defaults to true */ - protected function render($template, $arguments=array(), $safeParams=array(), + protected function render($template, $arguments=array(), $safeParams=array(), $fullPage=true){ - + if($fullPage){ $template = new \OCP\Template('news', $template, 'user'); } else { $template = new \OCP\Template('news', $template); } - + foreach($arguments as $key => $value){ if(array_key_exists($key, $safeParams)) { - $template->assign($key, $value, false); + $template->assign($key, $value, false); } else { $template->assign($key, $value); } - + } $template->assign('userId', $this->userId); @@ -98,5 +98,3 @@ class Controller { } - -?> \ No newline at end of file diff --git a/controllers/news.controller.php b/controllers/news.controller.php index 14bef126e..4f498b944 100644 --- a/controllers/news.controller.php +++ b/controllers/news.controller.php @@ -57,7 +57,7 @@ class NewsController extends Controller { // always show the last viewed feed on reload $lastViewedFeedId = (int)$this->getUserValue('lastViewedFeed'); $lastViewedFeedType = (int)$this->getUserValue('lastViewedFeedType'); - $showAll = $this->getUserValue('showAll'); + $showAll = $this->getUserValue('showAll'); if( $lastViewedFeedId === null || $lastViewedFeedType === null) { $lastViewedFeedId = $feedMapper->mostRecent(); @@ -66,7 +66,7 @@ class NewsController extends Controller { if( ( $lastViewedFeedType === FeedType::FEED && $feedMapper->findById($lastViewedFeedId) === null - ) || + ) || ( $lastViewedFeedType === FeedType::FOLDER && $folderMapper->findById($lastViewedFeedId) === null @@ -106,14 +106,14 @@ class NewsController extends Controller { $itemMapper = new ItemMapper($this->userId); // starred or subscriptions - if ($feedType === FeedType::STARRED || $feedType === FeedType::SUBSCRIPTIONS) { + if ($feedType === FeedType::STARRED || $feedType === FeedType::SUBSCRIPTIONS) { if($feedType === FeedType::STARRED){ $statusFlag = StatusFlag::IMPORTANT; } if($feedType === FeedType::SUBSCRIPTIONS){ - $statusFlag = StatusFlag::UNREAD; + $statusFlag = StatusFlag::UNREAD; } $items = $itemMapper->findEveryItemByStatus($statusFlag); @@ -125,7 +125,7 @@ class NewsController extends Controller { $items = $itemMapper->findByFeedId($feedId); } else { $items = $itemMapper->findAllStatus($feedId, StatusFlag::UNREAD); - } + } // folder } elseif ($feedType === FeedType::FOLDER){ @@ -136,7 +136,7 @@ class NewsController extends Controller { if($showAll) { $items = array_merge($items, $itemMapper->findByFeedId($feed->getId())); } else { - $items = array_merge($items, + $items = array_merge($items, $itemMapper->findAllStatus($feed->getId(), StatusFlag::UNREAD)); } } @@ -163,7 +163,7 @@ class NewsController extends Controller { case FeedType::SUBSCRIPTIONS: $unreadCount = $itemMapper->countEveryItemByStatus(StatusFlag::UNREAD); break; - + case FeedType::FOLDER: $feedMapper = new FeedMapper($this->userId); $feeds = $feedMapper->findByFolderId($feedId); @@ -182,5 +182,3 @@ class NewsController extends Controller { } - -?> \ No newline at end of file diff --git a/css/firstrun.css b/css/firstrun.css index 2c3474990..1e2feabb2 100644 --- a/css/firstrun.css +++ b/css/firstrun.css @@ -1,31 +1,31 @@ /** - * when there are no feeds in the db + * when there are no feeds in the db */ -#firstrun { +#firstrun { position: relative; top: 50%; left: 50%; margin-left: -25em; margin-top: -10em; - width: 50em; + width: 50em; height: 20em; - text-align: center; - font-weight:bold; - font-size:1.5em; - color:#777; + text-align: center; + font-weight:bold; + font-size:1.5em; + color:#777; } #firstrun small { display: block; font-weight: normal; font-size: 0.8em; margin: .5em 0 1em 0; } #firstrun .button { font-size: 0.7em; } - #firstrun #selections { - font-size:0.8em; - margin: 2em auto 2em 10em; - clear: both; + #firstrun #selections { + font-size:0.8em; + margin: 2em auto 2em 10em; + clear: both; } - + #firstrun #feed_add_url { width:20em; } - + #firstrun #selections #addfeed_dialog_firstrun, #firstrun #selections #importopml_dialog_firstrun { width:40em; border:1px solid; @@ -33,20 +33,20 @@ border-radius:10px; -moz-border-radius:10px; /* Firefox 3.6 and earlier */ } - + #firstrun #selections #addfeed_dialog_firstrun { height:5em; } - + #firstrun #selections #importopml_dialog_firstrun { height:4em; } - -#file_upload_start { - -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; - filter:alpha(opacity=0); - opacity:0; - z-index:1001; + +#file_upload_start { + -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + filter:alpha(opacity=0); + opacity:0; + z-index:1001; width:0; height:0; } diff --git a/css/news.css b/css/news.css index 8212616ea..10bfe5f30 100644 --- a/css/news.css +++ b/css/news.css @@ -1,33 +1,33 @@ -.news_input { - float:left; - font-size:12px; - padding:4px 2px; - border:solid 1px #aacfe4; - width:200px; +.news_input { + float:left; + font-size:12px; + padding:4px 2px; + border:solid 1px #aacfe4; + width:200px; } -.svg { - border: inherit; - background: inherit; +.svg { + border: inherit; + background: inherit; } -div.add_parentfolder { - position: relative; +div.add_parentfolder { + position: relative; } -#file_upload_start { - -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; - filter:alpha(opacity=0); - opacity:0; - z-index:1001; +#file_upload_start { + -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + filter:alpha(opacity=0); + opacity:0; + z-index:1001; width:0; height:0; } - + /* feed/folder list */ -#leftcontent_news { - width: 20em; - margin: 0; +#leftcontent_news { + width: 20em; + margin: 0; height: 100%; position: relative; overflow: hidden; @@ -38,8 +38,8 @@ div.add_parentfolder { } -#feed_wrapper { - background-color: #f8f8f8; +#feed_wrapper { + background-color: #f8f8f8; position: relative; top: 0; height: 100%; @@ -71,9 +71,9 @@ div.add_parentfolder { -o-transition: padding-bottom 500ms ease 0s; -webkit-transition: padding-bottom 500ms ease 0s; -ms-transition: padding-bottom 500ms ease 0s; - transition: padding-bottom 500ms ease 0s; + transition: padding-bottom 500ms ease 0s; } - + #feeds > ul.dnd_over { } @@ -93,7 +93,7 @@ div.add_parentfolder { -ms-transition: padding-bottom 500ms ease 0s; transition: padding-bottom 500ms ease 0s; padding-bottom: 2.5em !important; - } + } .all_read { font-weight: normal !important; @@ -119,15 +119,15 @@ div.add_parentfolder { } #feeds .buttons button.feeds_delete { - background-image: url('%webroot%/core/img/actions/delete.svg'); + background-image: url('%webroot%/core/img/actions/delete.svg'); } #feeds .buttons button.feeds_edit { - background-image: url('%webroot%/core/img/actions/rename.svg'); + background-image: url('%webroot%/core/img/actions/rename.svg'); } #feeds .buttons button.feeds_markread { - background-image: url('%appswebroot%/news/img/mark_read.svg'); + background-image: url('%appswebroot%/news/img/mark_read.svg'); } #feeds button.collapsable_trigger { @@ -135,7 +135,7 @@ div.add_parentfolder { left: .5em; top: .4em; background: none; - background-image: url('%webroot%/core/img/actions/triangle-s.svg'); + background-image: url('%webroot%/core/img/actions/triangle-s.svg'); background-repeat: no-repeat; background-size: 16px 16px; height: 16px; @@ -176,7 +176,7 @@ div.add_parentfolder { position: relative; } - #feeds li.active { + #feeds li.active { background: none !important; background-color: #d0d0d0 !important; border-bottom: 1px solid #ccc; @@ -210,11 +210,11 @@ div.add_parentfolder { } #feeds .starred a.title { - background-image: url('%appswebroot%/news/img/starred.png'); + background-image: url('%appswebroot%/news/img/starred.png'); } #feeds .subscriptions a.title { - background-image: url('%appswebroot%/news/img/rss.svg'); + background-image: url('%appswebroot%/news/img/rss.svg'); } #feeds .feed { @@ -279,22 +279,22 @@ div.add_parentfolder { /* feed settings */ -#feed_settings { - padding: 0; - bottom: 0; - overflow:visible; - height:2.8em; - width: 20em; - margin:0; +#feed_settings { + padding: 0; + bottom: 0; + overflow:visible; + height:2.8em; + width: 20em; + margin:0; z-index: 2; - background:#eee; - border-top: 1px solid #ccc; - border-right: 1px solid #ccc; + background:#eee; + border-top: 1px solid #ccc; + border-right: 1px solid #ccc; box-sizing: border-box; -moz-box-sizing: border-box; - position:fixed; + position:fixed; } - + #feed_settings .controls { height: 100%; width: 100%; @@ -331,23 +331,23 @@ div.add_parentfolder { } #feed_settings #view.show_all button { - background-image: url('%appswebroot%/news/img/eye_all.png'); + background-image: url('%appswebroot%/news/img/eye_all.png'); } #feed_settings #view.show_unread button { - background-image: url('%appswebroot%/news/img/eye_unread.png'); + background-image: url('%appswebroot%/news/img/eye_unread.png'); } #feed_settings #addfeedfolder { margin: 0 .3em .3em .3em; } - #feed_settings #addfeedfolder #addfolder { - background: url('%webroot%/core/img/places/folder.svg') no-repeat 10px center; + #feed_settings #addfeedfolder #addfolder { + background: url('%webroot%/core/img/places/folder.svg') no-repeat 10px center; } - #feed_settings #addfeedfolder #addfeed { - background: url('%appswebroot%/news/img/rss.svg') no-repeat 10px center; + #feed_settings #addfeedfolder #addfeed { + background: url('%appswebroot%/news/img/rss.svg') no-repeat 10px center; } /* @@ -355,30 +355,30 @@ div.add_parentfolder { display: block; }*/ - #feed_settings ul#feedfoldermenu { + #feed_settings ul#feedfoldermenu { display: none; - background:#EEEEEE; - background:-webkit-gradient(linear, 0 0, 0 100%, from(#DCDCDC), to(#EEEEEE)); - background:-moz-linear-gradient(#DCDCDC, #EEEEEE); - background:-o-linear-gradient(#DCDCDC, #EEEEEE); - background:linear-gradient(#DCDCDC, #EEEEEE); - position:fixed; + background:#EEEEEE; + background:-webkit-gradient(linear, 0 0, 0 100%, from(#DCDCDC), to(#EEEEEE)); + background:-moz-linear-gradient(#DCDCDC, #EEEEEE); + background:-o-linear-gradient(#DCDCDC, #EEEEEE); + background:linear-gradient(#DCDCDC, #EEEEEE); + position:fixed; z-index: 6; - margin-left: 0; - bottom: 2.8em; - border-left:1px solid #ccc; - border-top:1px solid #ccc; - border-right:1px solid #ccc; + margin-left: 0; + bottom: 2.8em; + border-left:1px solid #ccc; + border-top:1px solid #ccc; + border-right:1px solid #ccc; border-bottom: 0; - -moz-box-shadow: 0 -3px 3px -3px #000; - -webkit-box-shadow: 0 -3px 3px -3px #000; + -moz-box-shadow: 0 -3px 3px -3px #000; + -webkit-box-shadow: 0 -3px 3px -3px #000; box-shadow: 0 -3px 3px -3px #000; } - #feed_settings ul#feedfoldermenu li { - padding: 0 1em 0 2.5em; - float: none !important; - text-align: left; + #feed_settings ul#feedfoldermenu li { + padding: 0 1em 0 2.5em; + float: none !important; + text-align: left; } #feed_settings ul#feedfoldermenu li:hover { @@ -389,10 +389,10 @@ div.add_parentfolder { /* item view */ -#rightcontent { - top: 3.5em !important; - box-sizing: border-box; - -moz-box-sizing: border-box; +#rightcontent { + top: 3.5em !important; + box-sizing: border-box; + -moz-box-sizing: border-box; left: 32.5em; overflow: hidden; } @@ -401,21 +401,21 @@ div.add_parentfolder { * Area below the feed title and controls */ #rightcontent #feed_items { - box-sizing: border-box; - -moz-box-sizing: border-box; + box-sizing: border-box; + -moz-box-sizing: border-box; overflow: auto; height: 100%; } #rightcontent #feed_items.loading { - background-image: url('%webroot%/core/img/loading.gif'); + background-image: url('%webroot%/core/img/loading.gif'); background-position: center; background-repeat: no-repeat; - background-size: + background-size: } - #rightcontent #feed_items li:active { - background: none; + #rightcontent #feed_items li:active { + background: none; } /** @@ -458,8 +458,8 @@ div.add_parentfolder { float: left; } - .feed_item .primary_item_utils li { - display: inline-block; + .feed_item .primary_item_utils li { + display: inline-block; line-height: 1.5em; font-size: 1em; color: #aaa; @@ -469,7 +469,7 @@ div.add_parentfolder { } .feed_item .primary_item_utils li:first-child { margin: 0} - .feed_item .primary_item_utils li.star { + .feed_item .primary_item_utils li.star { background-image: url('%appswebroot%/news/img/inactive_star.svg'); background-repeat: no-repeat; background-size: 1.5em 1.5em; @@ -486,29 +486,29 @@ div.add_parentfolder { /** * Feed title */ - .feed_item h1.item_title { + .feed_item h1.item_title { font-size: 1.5em; margin: 0 13em 0 2.1em; font-weight: bold; } - .feed_item h1.item_title a { - color: #222; + .feed_item h1.item_title a { + color: #222; } - .feed_item h1.item_title a:hover { - color: #222; - text-decoration: underline; + .feed_item h1.item_title a:hover { + color: #222; + text-decoration: underline; } - + /** * Feed title when read */ - .feed_item.read h1.item_title { + .feed_item.read h1.item_title { font-weight: normal; } - .feed_item.read h1.item_title a { - color: #888; + .feed_item.read h1.item_title a { + color: #888; } /** @@ -519,7 +519,7 @@ div.add_parentfolder { font-size: 1.1em; margin-left: 3em; } - + /** * Author of the item */ @@ -537,7 +537,7 @@ div.add_parentfolder { * Feed timestamp */ .timeago { - float: right; + float: right; color: #aaa; margin: 0 1.2em 0 0; font-size: 1.1em; @@ -546,16 +546,16 @@ div.add_parentfolder { /** * Body of the feed item */ - .feed_item div.body { - padding: .75em 3em 0 3em; + .feed_item div.body { + padding: .75em 3em 0 3em; max-width: 55em; font-size: 1.1em; clear: both; overflow: auto; } - .feed_item div.body p { - line-height: 1.5; + .feed_item div.body p { + line-height: 1.5; margin: .5em 0 1em 0; } @@ -589,32 +589,32 @@ div.add_parentfolder { .feed_item div.body > div { margin: .5em 0; } - - .feed_item div.body a { - color: #0000ff; - text-decoration: underline; + + .feed_item div.body a { + color: #0000ff; + text-decoration: underline; } - - .feed_item div.body ul { + + .feed_item div.body ul { margin: .5em 0; - padding-left: 1em; - list-style-type: disc; + padding-left: 1em; + list-style-type: disc; } .feed_item div.body ol { margin: .5em 0; - padding-left: 1.5em; + padding-left: 1.5em; } - .feed_item div.body ul li { - cursor: default; + .feed_item div.body ul li { + cursor: default; line-height: 1.5em; } - - .feed_item div.body pre { - padding: .5em .5em .5em 1em; - background-color: #dadada; - border: 1px solid #ccc; + + .feed_item div.body pre { + padding: .5em .5em .5em 1em; + background-color: #dadada; + border: 1px solid #ccc; margin: .5em 0 1em 0; background-image: linear-gradient(top, rgb(215,215,215) 0%, rgb(220,220,220) 100%); background-image: -o-linear-gradient(top, rgb(215,215,215) 0%, rgb(220,220,220) 100%); @@ -623,9 +623,9 @@ div.add_parentfolder { background-image: -ms-linear-gradient(top, rgb(215,215,215) 0%, rgb(220,220,220) 100%); overflow-y: auto; } - - .feed_item div.body pre code { - font-family: monospace; + + .feed_item div.body pre code { + font-family: monospace; font-size: 1.5em; } .feed_item div.body > *:last-child { @@ -634,14 +634,14 @@ div.add_parentfolder { /** * Line with utils at the bottom - */ + */ .bottom_utils { width: 100%; height: 2.5em; margin: 0; padding: 0; - box-sizing: border-box; - -moz-box-sizing: border-box; + box-sizing: border-box; + -moz-box-sizing: border-box; } /** @@ -653,17 +653,17 @@ div.add_parentfolder { float: right; margin: 0 1.2em; } - + .feed_item:hover .secondary_item_utils { display: block; } .feed_item:hover .secondary_item_utils li.keep_unread { cursor: pointer; - + } - .feed_item .secondary_item_utils li input[type=checkbox]{ + .feed_item .secondary_item_utils li input[type=checkbox]{ } /* dialog/menues */ @@ -675,30 +675,30 @@ div.add_parentfolder { background: none !important; } -.dropdownBtn { - width: 12.5em; - padding-left: 0; - padding-right:20px; - background: url('%webroot%/core/img/actions/triangle-s.svg') no-repeat right center; - text-align: left; +.dropdownBtn { + width: 12.5em; + padding-left: 0; + padding-right:20px; + background: url('%webroot%/core/img/actions/triangle-s.svg') no-repeat right center; + text-align: left; overflow: hidden; } -ul.dropdownmenu { - left: 0em; +ul.dropdownmenu { + left: 0em; } -ul.menu { - position: absolute; - z-index:1; - margin-left: 0.3em; - display: none; - background:#EEEEEE; - background:-webkit-gradient(linear, 0 0, 0 100%, from(#eee), to(#f1f1f1)); - background:-moz-linear-gradient(#eee, #f1f1f1); - background:-o-linear-gradient(#eee, #f1f1f1); - background:linear-gradient(#eee, #f1f1f1); +ul.menu { + position: absolute; + z-index:1; + margin-left: 0.3em; + display: none; + background:#EEEEEE; + background:-webkit-gradient(linear, 0 0, 0 100%, from(#eee), to(#f1f1f1)); + background:-moz-linear-gradient(#eee, #f1f1f1); + background:-o-linear-gradient(#eee, #f1f1f1); + background:linear-gradient(#eee, #f1f1f1); border: 1px solid #ccc; } diff --git a/index.php b/index.php index 57e782a37..6bca9711d 100644 --- a/index.php +++ b/index.php @@ -24,5 +24,5 @@ $controller = new OCA\News\NewsController(); if(isset($_GET['jstest'])){ $controller->javascriptTests(); } else { - $controller->index(); + $controller->index(); } \ No newline at end of file diff --git a/js/cache.js b/js/cache.js index 08353bae8..d73ed0063 100644 --- a/js/cache.js +++ b/js/cache.js @@ -30,5 +30,3 @@ exports.Cache = Cache; }(typeof exports === "undefined" ? (this.moduleName = {}): exports)); - - diff --git a/js/firstrun.js b/js/firstrun.js index 532b0e9cb..cc06fbccf 100644 --- a/js/firstrun.js +++ b/js/firstrun.js @@ -1,9 +1,7 @@ var News = News || {}; $(document).ready(function(){ - - $('#browsebtn_firstrun, #cloudbtn_firstrun, #importbtn_firstrun').hide(); - -}); + $('#browsebtn_firstrun, #cloudbtn_firstrun, #importbtn_firstrun').hide(); +}); diff --git a/js/items.js b/js/items.js index cf6107ad0..4a71094b6 100644 --- a/js/items.js +++ b/js/items.js @@ -36,7 +36,7 @@ var News = News || {}; $(window).resize(function(){ self._setScrollBottom(); }); - + // mark items whose title was hid under the top edge as read this._scrollTimeoutMiliSecs = 100; this._markReadTimeoutMiliSecs = 500; @@ -354,7 +354,7 @@ var News = News || {}; */ ItemCache.prototype._getSortedItemIds = function(type, id) { var pairs = this._getItemIdTimestampPairs(type, id); - + var sorted = pairs.slice(0).sort(function(a, b) { return a.value - b.value; }); diff --git a/js/main.js b/js/main.js index 6c88e9cfe..e5a313841 100644 --- a/js/main.js +++ b/js/main.js @@ -46,7 +46,7 @@ $(document).ready(function(){ $('#addfeed_dialog .menu').append($folder); }); }); - + $('#addfolder').click(function() { $('#addfolder_dialog').dialog('open'); $('#folder_add_name').val(''); @@ -104,9 +104,9 @@ $(document).ready(function(){ $(this).addClass('show_all').removeClass('show_unread'); $(this).attr('title', t('news', 'Show everything')); } - + News.Objects.Menu.triggerHideRead(); - + $.post(OC.filePath('news', 'ajax', 'usersettings.php'), data, function(jsondata){ if(jsondata.status == 'success'){ News.Objects.Menu.setShowAll(data.showAll); @@ -115,7 +115,7 @@ $(document).ready(function(){ } }); }); - + $(document).click(function(event) { $('#feedfoldermenu').hide(); }); diff --git a/js/menu.js b/js/menu.js index 25f5ae135..26b4a75ad 100644 --- a/js/menu.js +++ b/js/menu.js @@ -19,7 +19,7 @@ We create a new instance of the menu. Then we need to bind it on an ul which contains all the items: - + var updateIntervalMiliseconds = 2000; var items = new News.Items('#feed_items'); var menu = new News.Menu(updateIntervalMiliseconds, items); @@ -44,7 +44,7 @@ Deleting nodes: Creating nodes: - + var parentId = 0; var html = ''; menu.addNode(parentId, html); @@ -171,7 +171,7 @@ var News = News || {}; Menu.prototype.updateNode = function(type, id, data){ var $node = this._getNodeFromTypeAndId(type, id); id = parseInt(id, 10); - + if(data.title !== undefined){ // prevent xss var title = $('
').text(data.title).html(); @@ -339,11 +339,11 @@ var News = News || {}; this._$activeFeed = $('#feeds .active'); this._activeFeedId = this._$activeFeed.data('id'); this._activeFeedType = this._listItemToMenuNodeType(this._$activeFeed); - + setTimeout(function(){ self._updateUnreadCountAll(); }, 3000); - + setInterval(function(){ self._updateUnreadCountAll(); }, self._updateInterval); @@ -592,7 +592,7 @@ var News = News || {}; OC.dialogs.alert(jsonData.data.message, t('news', 'Error')); } }); - + break; } }; @@ -651,13 +651,13 @@ var News = News || {}; */ Menu.prototype._toggleCollapse = function($listItem){ $listItem.toggleClass('open'); - + var folderId = this._getIdAndTypeFromNode($listItem).id; var data = { 'folderId': folderId, 'opened': $listItem.hasClass('open') }; - + $.post(OC.filePath('news', 'ajax', 'collapsefolder.php'), data, function(jsondata){ if(jsondata.status != 'success'){ OC.dialogs.alert(jsonData.data.message, t('news', 'Error')); diff --git a/js/news.js b/js/news.js index bc7e7348c..953afab27 100644 --- a/js/news.js +++ b/js/news.js @@ -63,9 +63,9 @@ News = { $(button).prop('value', t('news', 'Changing...')); var url = OC.filePath('news', 'ajax', 'changefoldername.php'); - var data = { - folderName: folderName, - folderId: folderId + var data = { + folderName: folderName, + folderId: folderId }; $.post(url, data, function(jsonData){ @@ -93,7 +93,7 @@ News = { $(button).attr("disabled", true); $(button).prop('value', t('news', 'Adding...')); - + var folderid = 0; if($('#firstrun').length == 0){ folderid = $('#addfeed_dialog .inputfolderid').val(); @@ -106,9 +106,9 @@ News = { dataType: "json", success: function(jsonData){ if($('#firstrun').length > 0){ - window.location.reload(); + window.location.reload(); } else { - if(jsonData.status == 'success'){ + if(jsonData.status == 'success'){ News.Objects.Menu.addNode(folderid, jsonData.data.listfeed); News.Objects.Menu.load(News.MenuNodeType.Feed, jsonData.data.feedid); $('#addfeed_dialog').dialog('close'); @@ -128,7 +128,7 @@ News = { } }); }, - + }, } diff --git a/js/settings.js b/js/settings.js index ae6e7257e..4d5956cbd 100644 --- a/js/settings.js +++ b/js/settings.js @@ -35,13 +35,13 @@ News.Settings={ if (News.Settings.importkind == News.Settings.IMPORTCLOUD) { path = News.Settings.importpath; } else if (this.importkind == this.IMPORTLOCAL) { - + } $.post(OC.filePath('news', 'ajax', 'importopml.php'), { path: path }, function(jsondata){ if (jsondata.status == 'success') { - var message = jsondata.data.countsuccess + t('news', ' out of ') + jsondata.data.count + - t('news', ' feeds imported successfully from ') + jsondata.data.title; + var message = jsondata.data.countsuccess + t('news', ' out of ') + jsondata.data.count + + t('news', ' feeds imported successfully from ') + jsondata.data.title; OC.dialogs.alert(message, t('news', 'Success')); } else { OC.dialogs.alert(jsondata.data.message, t('news', 'Error')); diff --git a/lib/backgroundjob.php b/lib/backgroundjob.php index 896fd6f03..9495086f0 100644 --- a/lib/backgroundjob.php +++ b/lib/backgroundjob.php @@ -37,7 +37,7 @@ class Backgroundjob { return 1; } } - + static public function run() { if( \OC::$CLI ) { self::cliStep(); @@ -46,25 +46,25 @@ class Backgroundjob { self::webStep(); } } - + static private function cliStep() { $feedmapper = new FeedMapper(); - + // Iterate over all feeds $feeds = $feedmapper->findAll(); foreach( $feeds as $feed ) { self::updateFeed( $feedmapper, $feed ); } } - + static private function webStep() { // Iterate over all users $lastid = \OCP\Config::getAppValue('news', 'backgroundjob_lastid',0); - + $feedmapper = new FeedMapper(); $feeds = $feedmapper->findAll(); usort( $feeds, array( 'OCA\News\Backgroundjob', 'sortFeeds' )); - + $done = false; foreach( $feeds as $feed ) { if( $feed['id'] > $lastid ) { @@ -74,12 +74,12 @@ class Backgroundjob { self::updateFeed( $feedmapper, $feed ); } } - + if( !$done ) { \OCP\Config::setAppValue('news', 'backgroundjob_lastid',0); } } - + static private function updateFeed( $feedmapper, $feed ) { $newfeed = null; $newfeed = Utils::fetch( $feed['url'] ); diff --git a/lib/collection.php b/lib/collection.php index 3c36dbceb..30b926c00 100644 --- a/lib/collection.php +++ b/lib/collection.php @@ -4,10 +4,10 @@ * * @author Alessandro Cosentino * Copyright (c) 2012 - Alessandro Cosentino -* +* * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file -* +* */ namespace OCA\News; @@ -16,9 +16,9 @@ namespace OCA\News; * This class models a collection, which is either a feed or a folder. */ class Collection { - + private $id; - + public function __construct($id) { $this->id = $id; } @@ -26,9 +26,9 @@ class Collection { public function getId() { return $this->id; } - + public function setId($id) { $this->id = $id; } - + } diff --git a/lib/feed.php b/lib/feed.php index 4f82404f6..e99ba3c75 100644 --- a/lib/feed.php +++ b/lib/feed.php @@ -4,10 +4,10 @@ * * @author Alessandro Cosentino * Copyright (c) 2012 - Alessandro Cosentino -* +* * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file -* +* */ namespace OCA\News; @@ -35,7 +35,7 @@ class Feed extends Collection { parent::__construct($id); } } - + public function getUrl() { return $this->url; } @@ -43,7 +43,7 @@ class Feed extends Collection { public function getTitle() { return $this->title; } - + public function setTitle($title) { $this->title = $title; } diff --git a/lib/feedmapper.php b/lib/feedmapper.php index 35847acdf..4220f99d7 100644 --- a/lib/feedmapper.php +++ b/lib/feedmapper.php @@ -41,7 +41,7 @@ class FeedMapper { $feed = new Feed($url, $title, null, $id); $favicon = $row['favicon_link']; $feed->setFavicon($favicon); - + return $feed; } @@ -125,7 +125,7 @@ class FeedMapper { $stmt = \OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE id = ?'); $result = $stmt->execute(array($id)); $row = $result->fetchRow(); - + $feed = self::fromRow($row); $itemMapper = new ItemMapper(); $items = $itemMapper->findById($id); @@ -179,9 +179,9 @@ class FeedMapper { $l = \OC_L10N::get('news'); $title = $l->t('no title'); } - + $favicon = $feed->getFavicon(); - + //FIXME: Detect when feed contains already a database id $feedid = $this->findIdFromUrl($url); if ($feedid === null) { @@ -203,20 +203,20 @@ class FeedMapper { $feedid = \OCP\DB::insertid(self::tableName); } - else { + else { //update the db. it needs to be done, since it might be the first save after a full fetch $stmt = \OCP\DB::prepare(' UPDATE ' . self::tableName . ' SET favicon_link = ? , lastmodified = UNIX_TIMESTAMP() , folder_id = ? WHERE id = ? '); - + $params=array( $favicon, $folderid, $feedid ); - $stmt->execute($params); + $stmt->execute($params); } $feed->setId($feedid); @@ -228,10 +228,10 @@ class FeedMapper { $itemMapper->save($item, $feedid); } } - + return $feedid; } - + public function deleteById($id) { if ($id == null) { @@ -247,7 +247,7 @@ class FeedMapper { return true; } - + public function delete(Feed $feed) { $id = $feed->getId(); return deleteById($id); diff --git a/lib/folder.php b/lib/folder.php index 93a37baa2..2e3c96a7c 100644 --- a/lib/folder.php +++ b/lib/folder.php @@ -62,11 +62,11 @@ class Folder extends Collection { public function addChild(Collection $child) { $this->children[] = $child; } - + public function addChildren($children) { $this->children = $children; } - + public function getChildren() { return $this->children; } diff --git a/lib/foldermapper.php b/lib/foldermapper.php index a30759d2d..5d7145176 100644 --- a/lib/foldermapper.php +++ b/lib/foldermapper.php @@ -33,15 +33,15 @@ class FolderMapper { /** * @brief Returns the forest (list of trees) of folders children of $parentid - * @param - * @returns + * @param + * @returns */ public function childrenOf($parentid) { - $folderlist = array(); + $folderlist = array(); $stmt = \OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE user_id = ? AND parent_id = ?'); $result = $stmt->execute(array($this->userid, $parentid)); - + while( $row = $result->fetchRow()) { $folderid = $row['id']; $folder = new Folder($row['name'], $folderid); @@ -50,25 +50,25 @@ class FolderMapper { $folder->addChildren($children); $folderlist[] = $folder; } - + return $folderlist; } /** - * @brief Returns the forest (list of trees) of folders children of $parentid, + * @brief Returns the forest (list of trees) of folders children of $parentid, * including the feeds that they contain - * @param - * @returns + * @param + * @returns */ public function childrenOfWithFeeds($parentid) { - + $feedmapper = new FeedMapper(); $collectionlist = $feedmapper->findByFolderId($parentid); - + $stmt = \OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE user_id = ? AND parent_id = ?'); $result = $stmt->execute(array($this->userid, $parentid)); - + while( $row = $result->fetchRow()) { $folderid = $row['id']; $folder = new Folder($row['name'], $folderid); @@ -77,18 +77,18 @@ class FolderMapper { $folder->addChildren($children); $collectionlist[] = $folder; } - + return $collectionlist; } - + /** * This is being used for consistency */ public function findById($id){ return $this->find($id); } - + /** * @brief Retrieve a folder from the database @@ -148,7 +148,7 @@ class FolderMapper { * @param folder the folder to be updated */ public function update(Folder $folder) { - $query = \OCP\DB::prepare('UPDATE ' . self::tableName + $query = \OCP\DB::prepare('UPDATE ' . self::tableName . ' SET name = ?, opened = ?' . ' WHERE id = ?'); $params = array($folder->getName(), $folder->getOpened(), $folder->getId()); diff --git a/lib/item.php b/lib/item.php index 577b6d8e8..f2d4fbd63 100644 --- a/lib/item.php +++ b/lib/item.php @@ -4,10 +4,10 @@ * * @author Alessandro Cosentino * Copyright (c) 2012 - Alessandro Cosentino -* +* * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file -* +* */ namespace OCA\News; @@ -34,7 +34,7 @@ class Item { private $id; //id of the item in the database table private $author; private $date; //date is stored in the Unix format - + public function __construct($url, $title, $guid, $body, $id = null) { $this->title = $title; $this->url = $url; @@ -77,38 +77,38 @@ class Item { } public function setUnread() { - $this->status |= StatusFlag::UNREAD; + $this->status |= StatusFlag::UNREAD; } public function isRead() { return !($this->status & StatusFlag::UNREAD); } - + public function setImportant() { - $this->status |= StatusFlag::IMPORTANT; + $this->status |= StatusFlag::IMPORTANT; } - + public function setUnimportant() { $this->status &= ~StatusFlag::IMPORTANT; } - + public function isImportant() { return ($this->status & StatusFlag::IMPORTANT); } - + /** - * NOTE: this is needed to store items in the database, otherwise + * NOTE: this is needed to store items in the database, otherwise * the status of an item should be retrieved with methods: isRead(), isImportant(), ... */ public function getStatus() { return $this->status; } - + public function setStatus($status) { $this->status = $status; } - - /* change the following method with set/get magic methods + + /* change the following method with set/get magic methods * http://www.php.net/manual/en/language.oop5.overloading.php#object.get */ @@ -135,7 +135,7 @@ class Item { public function setBody($body) { $this->body = $body; } - + public function getAuthor() { return $this->author; } @@ -147,7 +147,7 @@ class Item { public function getDate() { return $this->date; } - + //TODO: check if the parameter is in the Unix format public function setDate($date) { $this->date = $date; diff --git a/lib/itemmapper.php b/lib/itemmapper.php index 2f4e295b2..58894cce8 100644 --- a/lib/itemmapper.php +++ b/lib/itemmapper.php @@ -4,10 +4,10 @@ * * @author Alessandro Cosentino * Copyright (c) 2012 - Alessandro Cosentino -* +* * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file -* +* */ namespace OCA\News; @@ -31,7 +31,7 @@ class ItemMapper { } /** - * @brief + * @brief * @param row a row from the items table of the database * @returns an object of the class OC_News_Item */ @@ -46,10 +46,10 @@ class ItemMapper { $item->setAuthor($row['author']); $item->setFeedId($row['feed_id']); $item->setDate(Utils::dbtimestampToUnixtime($row['pub_date'])); - + return $item; } - + /** * @brief Retrieve all the item corresponding to a feed from the database * @param feedid The id of the feed in the database table. @@ -57,7 +57,7 @@ class ItemMapper { public function findByFeedId($feedid) { $stmt = \OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE feed_id = ? ORDER BY pub_date DESC'); $result = $stmt->execute(array($feedid)); - + $items = array(); while ($row = $result->fetchRow()) { $item = $this->fromRow($row); @@ -66,7 +66,7 @@ class ItemMapper { return $items; } - + /** * @brief Retrieve all the items corresponding to a feed from the database with a particular status @@ -74,12 +74,12 @@ class ItemMapper { * @param status one of the constants defined in OCA\News\StatusFlag */ public function findAllStatus($feedid, $status) { - $stmt = \OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' + $stmt = \OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE feed_id = ? - AND ((status & ?) > 0) + AND ((status & ?) > 0) ORDER BY pub_date DESC'); $result = $stmt->execute(array($feedid, $status)); - + $items = array(); while ($row = $result->fetchRow()) { $item = $this->fromRow($row); @@ -88,20 +88,20 @@ class ItemMapper { return $items; } - + /* * @brief Retrieve all the items from the database with a particular status * @param status one of the constants defined in OCA\News\StatusFlag */ public function findEveryItemByStatus($status) { - $stmt = \OCP\DB::prepare('SELECT ' . self::tableName . '.* FROM ' . self::tableName . ' + $stmt = \OCP\DB::prepare('SELECT ' . self::tableName . '.* FROM ' . self::tableName . ' JOIN '. FeedMapper::tableName .' ON '. FeedMapper::tableName .'.id = ' . self::tableName . '.feed_id WHERE '. FeedMapper::tableName .'.user_id = ? AND ((' . self::tableName . '.status & ?) > 0) ORDER BY ' . self::tableName . '.pub_date DESC'); $result = $stmt->execute(array($this->userid, $status)); - + $items = array(); while ($row = $result->fetchRow()) { $item = $this->fromRow($row); @@ -112,19 +112,19 @@ class ItemMapper { } public function countAllStatus($feedid, $status) { - $stmt = \OCP\DB::prepare('SELECT COUNT(*) as size FROM ' . self::tableName . ' + $stmt = \OCP\DB::prepare('SELECT COUNT(*) as size FROM ' . self::tableName . ' WHERE feed_id = ? AND ((status & ?) > 0)'); $result=$stmt->execute(array($feedid, $status))->fetchRow(); return $result['size']; } - + /** * @brief Count all the items from the database with a particular status * @param status one of the constants defined in OCA\News\StatusFlag */ public function countEveryItemByStatus($status) { - $stmt = \OCP\DB::prepare('SELECT COUNT(*) as size FROM ' . self::tableName . ' + $stmt = \OCP\DB::prepare('SELECT COUNT(*) as size FROM ' . self::tableName . ' JOIN '. FeedMapper::tableName .' ON '. FeedMapper::tableName .'.id = ' . self::tableName . '.feed_id WHERE '. FeedMapper::tableName .'.user_id = ? @@ -136,7 +136,7 @@ class ItemMapper { public function findIdFromGuid($guid_hash, $guid, $feedid) { $stmt = \OCP\DB::prepare(' - SELECT * FROM ' . self::tableName . ' + SELECT * FROM ' . self::tableName . ' WHERE guid_hash = ? AND feed_id = ? '); @@ -155,25 +155,25 @@ class ItemMapper { * @returns The item whose status has changed. */ public function update(Item $item) { - + $itemid = $item->getId(); $status = $item->getStatus(); - + $stmt = \OCP\DB::prepare(' UPDATE ' . self::tableName . ' SET status = ? WHERE id = ? '); - + $params=array( $status, $itemid ); $stmt->execute($params); - + return true; } - + /** * @brief Save the feed and all its items into the database * @returns The id of the feed in the database table. @@ -181,11 +181,11 @@ class ItemMapper { public function save(Item $item, $feedid) { $guid = $item->getGuid(); $guid_hash = md5($guid); - + $status = $item->getStatus(); $itemid = $this->findIdFromGuid($guid_hash, $guid, $feedid); - + if ($itemid == null) { $title = $item->getTitle(); $body = $item->getBody(); @@ -206,9 +206,9 @@ class ItemMapper { $l = \OC_L10N::get('news'); $body = $l->t('no body'); } - + $pub_date = Utils::unixtimeToDbtimestamp($item->getDate()); - + $params=array( $item->getUrl(), $title, @@ -220,9 +220,9 @@ class ItemMapper { $feedid, $status ); - + $stmt->execute($params); - + $itemid = \OCP\DB::insertid(self::tableName); } else { @@ -231,7 +231,7 @@ class ItemMapper { $item->setId($itemid); return $itemid; } - + /** * @brief Retrieve an item from the database * @param id The id of the feed in the database table. @@ -242,16 +242,16 @@ class ItemMapper { $row = $result->fetchRow(); $item = $this->fromRow($row); - + return $item; } - + /** * @brief Permanently delete all items belonging to a feed from the database * @param feedid The id of the feed that we wish to delete - * @return + * @return */ public function deleteAll($feedid) { if ($feedid == null) { @@ -260,7 +260,7 @@ class ItemMapper { $stmt = \OCP\DB::prepare('DELETE FROM ' . self::tableName .' WHERE feed_id = ?'); $result = $stmt->execute(array($feedid)); - + return $result; } } \ No newline at end of file diff --git a/lib/utils.php b/lib/utils.php index ab80018d6..e7ae2107e 100644 --- a/lib/utils.php +++ b/lib/utils.php @@ -100,9 +100,9 @@ class Utils { } /** - * Perform a "slim" fetch of a feed from remote. + * Perform a "slim" fetch of a feed from remote. * Differently from Utils::fetch(), it doesn't retrieve items nor a favicon - * + * * @param url remote url of the feed * @returns an instance of OC_News_Feed */ @@ -121,7 +121,7 @@ class Utils { $title = $spfeed->get_title(); $feed = new Feed($url, $title); - + return $feed; } catch (Exception $e) { @@ -130,7 +130,7 @@ class Utils { } public static function checkFavicon($favicon) { - if ($favicon === null || $favicon == false) + if ($favicon === null || $favicon == false) return false; $file = new \SimplePie_File($favicon); @@ -158,7 +158,7 @@ class Utils { //try to extract favicon from web page $absoluteUrl = \SimplePie_Misc::absolutize_url('/', $url); - + $handle = curl_init ( ); curl_setopt ( $handle, CURLOPT_URL, $absoluteUrl ); curl_setopt ( $handle, CURLOPT_RETURNTRANSFER, 1 ); diff --git a/opmlexporter.php b/opmlexporter.php index bbd5f649f..ed3c272ea 100644 --- a/opmlexporter.php +++ b/opmlexporter.php @@ -1,4 +1,4 @@ -data = array(); $this->count = 0; @@ -38,7 +38,7 @@ class OPMLParser { public function getData() { return $this->data; } - + /** * @brief * @returns the number of feeds found in the file @@ -46,7 +46,7 @@ class OPMLParser { public function getCount() { return $this->count; } - + /** * @brief This is used as a utility private function by the method OPMLParser::parse */ @@ -69,7 +69,7 @@ class OPMLParser { } return $list; } - + private static function parseFeed($rawfeed) { $url = (string)$rawfeed['xmlUrl']; $title = (string)$rawfeed['title']; @@ -77,21 +77,21 @@ class OPMLParser { $feed = new OCA\News\Feed($url, $title); return $feed; } - + /** - * @brief + * @brief * @param $raw the XML string to be parsed * @return an object of the OPMLParser class itself * or null if the parsing failed - * @throws + * @throws */ public static function parse($raw) { $parsed = new OPMLParser(); - + $xml_parser = new SimpleXMLElement($raw, LIBXML_NOERROR); $parsed->title = (string)$xml_parser->head->title; $parsed->body = $xml_parser->body; - + if ($parsed->body != null) { $parsed->data = self::parseFolder($parsed->body, $parsed->count); return $parsed; diff --git a/subscribe.php b/subscribe.php index bd79c4aba..cff21d9ff 100644 --- a/subscribe.php +++ b/subscribe.php @@ -1,8 +1,8 @@ - - - - - News - ownCloud + + + + + News - ownCloud
@@ -30,7 +30,7 @@ echo $l->t('An error occurred'); } else { echo $l->t('Nice! You have subscribed to ') . $feed->getTitle(); - } + } } else { echo $l->t('You had already subcribed to this feed!'); @@ -39,5 +39,5 @@ ?>
Close this window - + diff --git a/templates/main.php b/templates/main.php index e2a27c324..3c4eff3f4 100644 --- a/templates/main.php +++ b/templates/main.php @@ -59,4 +59,3 @@ echo $this->inc("part.dialogues");
- diff --git a/templates/part.feeds.php b/templates/part.feeds.php index 77afb8d5e..14a7b0dd4 100644 --- a/templates/part.feeds.php +++ b/templates/part.feeds.php @@ -1,7 +1,7 @@ assign('lastViewedFeedId', $lastViewedFeedId); $tmpl_folder->assign('lastViewedFeedType', $lastViewedFeedType); $tmpl_folder->printpage(); - print_collection_list($collection->getChildren(), $lastViewedFeedId, + print_collection_list($collection->getChildren(), $lastViewedFeedId, $lastViewedFeedType); echo ''; } diff --git a/templates/part.items.php b/templates/part.items.php index e318a8466..174a96e5e 100644 --- a/templates/part.items.php +++ b/templates/part.items.php @@ -4,13 +4,13 @@ $items = isset($_['items']) ? $_['items'] : ''; echo '
    '; foreach($items as $item) { - + if($item->isRead()) { $newsItemClass = "read"; } else { $newsItemClass = ""; } - + if($item->isImportant()) { $starClass = 'important'; $startTitle = $l->t('Mark as unimportant'); @@ -21,7 +21,7 @@ foreach($items as $item) { echo '
  • '; echo '' . $item->getDate() . ''; - echo '

    '; echo '
    '; @@ -30,12 +30,12 @@ foreach($items as $item) { echo '
'; echo ''; - echo '

' . htmlspecialchars($item->getTitle(), ENT_QUOTES, 'UTF-8') . '

'; - + echo '

' . htmlspecialchars($item->getTitle(), ENT_QUOTES, 'UTF-8') . '

'; + if(($item->getAuthor() !== null) && (trim($item->getAuthor()) != '')) { echo '

'. $l->t('by') . ' ' . htmlspecialchars($item->getAuthor(), ENT_QUOTES, 'UTF-8') . '

'; } - + echo '
' . $item->getBody() . '
'; echo '
'; diff --git a/templates/part.listfolder.php b/templates/part.listfolder.php index 847c05cad..4f3b6fdef 100644 --- a/templates/part.listfolder.php +++ b/templates/part.listfolder.php @@ -6,7 +6,7 @@ require_once(\OC_App::getAppPath('news') . '/lib/feedtypes.php'); $l = new OC_l10n('news'); -$folder = isset($_['folder']) ? $_['folder'] : null; +$folder = isset($_['folder']) ? $_['folder'] : null; $folderId = $folder->getId(); $folderName = $folder->getName(); diff --git a/templates/subscribelet.php b/templates/subscribelet.php index d4a8994fc..d0c5f371d 100644 --- a/templates/subscribelet.php +++ b/templates/subscribelet.php @@ -5,4 +5,4 @@ function createSubscribelet() { echo '' . $l->t('Drag this to your browser bookmarks and click on it whenever you want to subscribe to a webpage quickly:') . '' . '' . $l->t('Subscribe') . ''; -} +} diff --git a/templates/test.php b/templates/test.php index 3ef18c954..348f495ce 100644 --- a/templates/test.php +++ b/templates/test.php @@ -1,4 +1,4 @@ -assertTrue(false); } } - -?> \ No newline at end of file -- cgit v1.2.3