summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--appinfo/database.xml5
-rw-r--r--appinfo/version2
-rw-r--r--db/feed.php1
-rw-r--r--js/app/controllers/controllers.coffee6
-rw-r--r--js/app/controllers/itemcontroller.coffee4
-rw-r--r--js/app/services/bl/feedbl.coffee6
-rw-r--r--js/public/app.js16
-rw-r--r--js/tests/controllers/itemcontrollerSpec.coffee9
-rw-r--r--js/tests/services/bl/feedblSpec.coffee14
-rw-r--r--templates/part.items.php4
-rw-r--r--utility/feedfetcher.php5
11 files changed, 58 insertions, 14 deletions
diff --git a/appinfo/database.xml b/appinfo/database.xml
index e4798b492..300f6a2db 100644
--- a/appinfo/database.xml
+++ b/appinfo/database.xml
@@ -90,6 +90,11 @@
<notnull>true</notnull>
</field>
<field>
+ <name>link</name>
+ <type>clob</type>
+ <notnull>false</notnull>
+ </field>
+ <field>
<name>favicon_link</name>
<type>clob</type>
<notnull>false</notnull>
diff --git a/appinfo/version b/appinfo/version
index 8d1eec65a..0dc0f32d5 100644
--- a/appinfo/version
+++ b/appinfo/version
@@ -1 +1 @@
-8.1 \ No newline at end of file
+8.2 \ No newline at end of file
diff --git a/db/feed.php b/db/feed.php
index f337448a4..824aed501 100644
--- a/db/feed.php
+++ b/db/feed.php
@@ -38,6 +38,7 @@ class Feed extends Entity {
public $added;
public $folderId;
public $unreadCount;
+ public $link;
public function __construct(){
$this->addType('parentId', 'int');
diff --git a/js/app/controllers/controllers.coffee b/js/app/controllers/controllers.coffee
index 190f8dd0b..02d5f5e6c 100644
--- a/js/app/controllers/controllers.coffee
+++ b/js/app/controllers/controllers.coffee
@@ -39,8 +39,8 @@ StarredBl, unreadCountFormatter)->
]
angular.module('News').controller 'ItemController',
-['$scope', '_ItemController', 'ItemBl', 'FeedModel', 'FeedLoading',
-($scope, _ItemController, ItemBl, FeedModel, FeedLoading)->
+['$scope', '_ItemController', 'ItemBl', 'FeedModel', 'FeedLoading', 'FeedBl',
+($scope, _ItemController, ItemBl, FeedModel, FeedLoading, FeedBl)->
- return new _ItemController($scope, ItemBl, FeedModel, FeedLoading)
+ return new _ItemController($scope, ItemBl, FeedModel, FeedLoading, FeedBl)
] \ No newline at end of file
diff --git a/js/app/controllers/itemcontroller.coffee b/js/app/controllers/itemcontroller.coffee
index 2daf13335..514186393 100644
--- a/js/app/controllers/itemcontroller.coffee
+++ b/js/app/controllers/itemcontroller.coffee
@@ -25,9 +25,11 @@ angular.module('News').factory '_ItemController', ->
class ItemController
- constructor: (@_$scope, @_itemBl, @_feedModel, @_feedLoading) ->
+ constructor: (@_$scope, @_itemBl, @_feedModel, @_feedLoading,
+ @_feedBl) ->
@_$scope.itemBl = @_itemBl
+ @_$scope.feedBl = @_feedBl
@_$scope.isLoading = =>
return @_feedLoading.isLoading()
diff --git a/js/app/services/bl/feedbl.coffee b/js/app/services/bl/feedbl.coffee
index 77b3d81e2..b0928cccb 100644
--- a/js/app/services/bl/feedbl.coffee
+++ b/js/app/services/bl/feedbl.coffee
@@ -119,6 +119,12 @@ NewLoading) ->
return @_feedModel.getAll()
+ getFeedLink: (feedId) ->
+ feed = @_feedModel.getById(feedId)
+ if angular.isDefined(feed)
+ return feed.link
+
+
return new FeedBl(ShowAll, FeedModel, Persistence, ActiveFeed, FeedType,
ItemModel, NewLoading)
diff --git a/js/public/app.js b/js/public/app.js
index f4f2b41cb..f62a0c645 100644
--- a/js/public/app.js
+++ b/js/public/app.js
@@ -177,8 +177,8 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
]);
angular.module('News').controller('ItemController', [
- '$scope', '_ItemController', 'ItemBl', 'FeedModel', 'FeedLoading', function($scope, _ItemController, ItemBl, FeedModel, FeedLoading) {
- return new _ItemController($scope, ItemBl, FeedModel, FeedLoading);
+ '$scope', '_ItemController', 'ItemBl', 'FeedModel', 'FeedLoading', 'FeedBl', function($scope, _ItemController, ItemBl, FeedModel, FeedLoading, FeedBl) {
+ return new _ItemController($scope, ItemBl, FeedModel, FeedLoading, FeedBl);
}
]);
@@ -323,13 +323,15 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
var ItemController;
ItemController = (function() {
- function ItemController(_$scope, _itemBl, _feedModel, _feedLoading) {
+ function ItemController(_$scope, _itemBl, _feedModel, _feedLoading, _feedBl) {
var _this = this;
this._$scope = _$scope;
this._itemBl = _itemBl;
this._feedModel = _feedModel;
this._feedLoading = _feedLoading;
+ this._feedBl = _feedBl;
this._$scope.itemBl = this._itemBl;
+ this._$scope.feedBl = this._feedBl;
this._$scope.isLoading = function() {
return _this._feedLoading.isLoading();
};
@@ -664,6 +666,14 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
return this._feedModel.getAll();
};
+ FeedBl.prototype.getFeedLink = function(feedId) {
+ var feed;
+ feed = this._feedModel.getById(feedId);
+ if (angular.isDefined(feed)) {
+ return feed.link;
+ }
+ };
+
return FeedBl;
})(_Bl);
diff --git a/js/tests/controllers/itemcontrollerSpec.coffee b/js/tests/controllers/itemcontrollerSpec.coffee
index 35aff7141..f95f4a459 100644
--- a/js/tests/controllers/itemcontrollerSpec.coffee
+++ b/js/tests/controllers/itemcontrollerSpec.coffee
@@ -28,13 +28,18 @@ describe '_ItemController', ->
beforeEach inject (@_ItemController, @ActiveFeed, @ShowAll, @FeedType,
@StarredCount, @FeedModel, @FolderModel, @ItemModel,
- @ItemBl) =>
+ @ItemBl, @FeedBl, @FeedLoading) =>
@scope = {}
@persistence = {
getItems: ->
}
- @controller = new @_ItemController(@scope, @ItemBl, @FeedModel)
+ @controller = new @_ItemController(@scope, @ItemBl, @FeedModel,
+ @FeedLoading, @FeedBl)
it 'should make ItemBl availabe', =>
expect(@scope.itemBl).toBe(@ItemBl)
+
+
+ it 'should make FeedBl availabe', =>
+ expect(@scope.feedBl).toBe(@FeedBl)
diff --git a/js/tests/services/bl/feedblSpec.coffee b/js/tests/services/bl/feedblSpec.coffee
index 70d0c6e8b..c8ba1ec34 100644
--- a/js/tests/services/bl/feedblSpec.coffee
+++ b/js/tests/services/bl/feedblSpec.coffee
@@ -201,4 +201,16 @@ describe 'FeedBl', ->
folders = @FeedBl.getFeedsOfFolder(3)
expect(folders).toContain(item1)
- expect(folders).toContain(item3) \ No newline at end of file
+ expect(folders).toContain(item3)
+
+
+ it 'should return the correct feed link', =>
+ item2 =
+ id: 4,
+ unreadCount:134,
+ urlHash: 'a2',
+ folderId: 3,
+ link: 'test.com'
+ @FeedModel.add(item2)
+
+ expect(@FeedBl.getFeedLink(4)).toBe('test.com') \ No newline at end of file
diff --git a/templates/part.items.php b/templates/part.items.php
index 8c84c5377..284a3e9a3 100644
--- a/templates/part.items.php
+++ b/templates/part.items.php
@@ -24,9 +24,9 @@
</h1>
<h2 class="item_author">
- <span ng-show="itemBl.noFeedActive()">
+ <span ng-show="itemBl.noFeedActive() && feedBl.getFeedLink(item.feedId)">
<?php p($l->t('from')) ?>
- <a href="#"
+ <a target="_blank" href="{{ feedBl.getFeedLink(item.feedId) }}"
class="from_feed">{{ itemBl.getFeedTitle(item.id) }}</a>
</span>
<span ui-if="item.author">
diff --git a/utility/feedfetcher.php b/utility/feedfetcher.php
index 5d600c5c6..2145427f5 100644
--- a/utility/feedfetcher.php
+++ b/utility/feedfetcher.php
@@ -59,6 +59,8 @@ class FeedFetcher implements IFeedFetcher {
$simplePie = new \SimplePie_Core();
$simplePie->set_feed_url( $url );
$simplePie->enable_cache( false );
+ // $simplePie->set_cache_location($cacheDirectory) . '/rss/';
+ // $simplePie->enable_cache(true);
if (!$simplePie->init()) {
throw new FetcherException('Could not initialize simple pie');
@@ -102,8 +104,9 @@ class FeedFetcher implements IFeedFetcher {
}
$feed = new Feed();
- $feed->setTitle( $simplePie->get_title());
+ $feed->setTitle($simplePie->get_title());
$feed->setUrl($url);
+ $feed->setLink($simplePie->get_link());
$feed->setUrlHash(md5($url));
$feed->setAdded(time());