summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <Raydiation@users.noreply.github.com>2013-09-03 07:02:34 -0700
committerBernhard Posselt <Raydiation@users.noreply.github.com>2013-09-03 07:02:34 -0700
commit6e6db11d207007ab4077f7baa2e5d8265fdfab57 (patch)
tree4f6a136560b65aca2accb0067547cd2b36afa988
parent3d2d9e8258405443ded6981662981c0f94342e0a (diff)
parent778f7b2be62f5573fb437b1c586dad0e19a31ea1 (diff)
Merge pull request #326 from owncloud/first-run
First run page
-rw-r--r--css/addnew.css1
-rw-r--r--css/firstrun.css41
-rw-r--r--js/app/app.coffee2
-rw-r--r--js/app/controllers/appcontroller.coffee42
-rw-r--r--js/app/services/businesslayer/feedbusinesslayer.coffee3
-rw-r--r--js/app/services/persistence.coffee15
-rw-r--r--js/public/app.js412
-rw-r--r--templates/main.php11
-rw-r--r--templates/part.addnew.php9
-rw-r--r--templates/part.firstrun.php3
10 files changed, 490 insertions, 49 deletions
diff --git a/css/addnew.css b/css/addnew.css
index 87b7185d4..bc819abc9 100644
--- a/css/addnew.css
+++ b/css/addnew.css
@@ -26,7 +26,6 @@
}
.add-new-popup {
- display: none;
padding: 15px 10px;
}
diff --git a/css/firstrun.css b/css/firstrun.css
new file mode 100644
index 000000000..7467a7b2b
--- /dev/null
+++ b/css/firstrun.css
@@ -0,0 +1,41 @@
+/**
+* ownCloud - News
+*
+* @author Alessandro Cosentino
+* @author Bernhard Posselt
+* @copyright 2013 Alessandro Cosentino cosenal@gmail.com
+* @copyright 2013 Bernhard Posselt dev@bernhard-posselt.com
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+* License as published by the Free Software Foundation; either
+* version 3 of the License, or any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+*
+* You should have received a copy of the GNU Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#firstrun {
+ height: 100%;
+ margin-left: 300px;
+ position: relative;
+}
+
+#firstrun .message {
+ color: #888888;
+ font-size: 1.5em;
+ font-weight: bold;
+ text-shadow: 0 1px 0 #FFFFFF;
+ position: absolute;
+ top: 50%;
+ text-align: center;
+ width: 100%;
+ margin-top: -0.75em;
+}
+
diff --git a/js/app/app.coffee b/js/app/app.coffee
index 9b33812ad..03a25c6c4 100644
--- a/js/app/app.coffee
+++ b/js/app/app.coffee
@@ -37,8 +37,6 @@ angular.module('News', ['OC', 'ui']).config ($provide) ->
angular.module('News').run ['Persistence', 'Config',
(Persistence, Config) ->
- Persistence.init()
-
setInterval ->
Persistence.getAllFeeds(null, false)
Persistence.getAllFolders(null, false)
diff --git a/js/app/controllers/appcontroller.coffee b/js/app/controllers/appcontroller.coffee
new file mode 100644
index 000000000..bcb256077
--- /dev/null
+++ b/js/app/controllers/appcontroller.coffee
@@ -0,0 +1,42 @@
+###
+
+ownCloud - News
+
+@author Alessandro Cosentino
+@copyright 2013 Alessandro Cosentino cosenal@gmail.com
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+License as published by the Free Software Foundation; either
+version 3 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+You should have received a copy of the GNU Affero General Public
+License along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+###
+
+
+angular.module('News').controller 'AppController',
+['$scope', 'Persistence', 'FeedBusinessLayer',
+($scope, Persistence, FeedBusinessLayer) ->
+
+ class AppController
+
+ constructor: (@_$scope, @_persistence, @_feedBusinessLayer) ->
+
+ @_$scope.initialized = false
+ @_$scope.feedBusinessLayer = @_feedBusinessLayer
+
+ successCallback = =>
+ @_$scope.initialized = true
+
+ @_persistence.init().then(successCallback)
+
+ return new AppController($scope, Persistence, FeedBusinessLayer)
+
+] \ No newline at end of file
diff --git a/js/app/services/businesslayer/feedbusinesslayer.coffee b/js/app/services/businesslayer/feedbusinesslayer.coffee
index b26806ac8..cff714ac0 100644
--- a/js/app/services/businesslayer/feedbusinesslayer.coffee
+++ b/js/app/services/businesslayer/feedbusinesslayer.coffee
@@ -81,6 +81,9 @@ FeedModel, NewLoading, _ExistsError, Utils, $rootScope, NewestItem)->
getNumberOfFeeds: ->
return @_feedModel.size()
+ noFeeds: ->
+ return @getNumberOfFeeds() == 0
+
isVisible: (feedId) ->
if @isActive(feedId) or @_showAll.getShowAll()
diff --git a/js/app/services/persistence.coffee b/js/app/services/persistence.coffee
index 59a28489c..e1562fc46 100644
--- a/js/app/services/persistence.coffee
+++ b/js/app/services/persistence.coffee
@@ -22,9 +22,9 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').factory 'Persistence',
['Request', 'FeedLoading', 'AutoPageLoading', 'NewLoading', 'Config',
-'ActiveFeed', '$rootScope',
+'ActiveFeed', '$rootScope', '$q'
(Request, FeedLoading, AutoPageLoading, NewLoading, Config, ActiveFeed,
-$rootScope) ->
+$rootScope, $q) ->
class Persistence
@@ -37,15 +37,22 @@ $rootScope) ->
Loads the initial data from the server
###
+ @deferred = $q.defer()
+
# items can only be loaded after the active feed is known
@getActiveFeed =>
@getItems(@_activeFeed.getType(), @_activeFeed.getId())
-
+
@getAllFolders()
- @getAllFeeds()
+
+ successCallback = =>
+ @deferred.resolve()
+
+ @getAllFeeds(successCallback)
@userSettingsRead()
@userSettingsLanguage()
+ @deferred.promise
###
ITEM CONTROLLER
diff --git a/js/public/app.js b/js/public/app.js
index a4dda620b..b7c4b1aa8 100644
--- a/js/public/app.js
+++ b/js/public/app.js
@@ -1,3 +1,4 @@
+(function(angular, $, moment, undefined){
/**
* ownCloud News App - v0.0.1
@@ -10,7 +11,7 @@
*/
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -36,6 +37,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
(function() {
angular.module('News', ['OC', 'ui']).config(function($provide) {
var config;
+
return $provide.value('Config', config = {
markReadTimeout: 500,
scrollTimeout: 500,
@@ -48,7 +50,6 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').run([
'Persistence', 'Config', function(Persistence, Config) {
- Persistence.init();
return setInterval(function() {
Persistence.getAllFeeds(null, false);
return Persistence.getAllFolders(null, false);
@@ -67,7 +68,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -93,6 +94,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
(function() {
angular.module('News').directive('newsAudio', function() {
var directive;
+
return directive = {
restrict: 'E',
scope: {
@@ -103,6 +105,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
template: '' + '<audio controls="controls" preload="none" ng-hide="cantPlay()">' + '<source src="{{ src }}">' + '</audio>' + '<a href="{{ src }}" class="button" ng-show="cantPlay()" ' + 'ng-transclude></a>',
link: function(scope, elm, attrs) {
var cantPlay, source;
+
source = elm.children().children('source')[0];
cantPlay = false;
source.addEventListener('error', function() {
@@ -119,7 +122,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -147,6 +150,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
'$rootScope', function($rootScope) {
return function(scope, elm, attr) {
var $elem, details;
+
$elem = $(elm);
details = {
accept: '.feed',
@@ -154,6 +158,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
greedy: true,
drop: function(event, ui) {
var data;
+
$('.drag-and-drop').removeClass('drag-and-drop');
data = {
folderId: parseInt($elem.data('id'), 10),
@@ -170,7 +175,101 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
+/*
+
+ownCloud - News
+
+@author Alessandro Cosentino
+@copyright 2013 Alessandro Cosentino cosenal@gmail.com
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+License as published by the Free Software Foundation; either
+version 3 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+You should have received a copy of the GNU Affero General Public
+License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+(function() {
+ angular.module('News').directive('globalShortcuts', [
+ '$window', function($window) {
+ return function(scope, elm, attr) {
+ var jumpTo;
+
+ jumpTo = function($scrollArea, $item) {
+ var position;
+
+ position = $item.offset().top - $scrollArea.offset().top + $scrollArea.scrollTop();
+ return $scrollArea.scrollTop(position);
+ };
+ return $($window.document).keydown(function(e) {
+ var focused;
+
+ focused = $(':focus');
+ if (!(focused.is('input') || focused.is('select') || focused.is('textarea') || focused.is('checkbox') || focused.is('button'))) {
+ if (e.keyCode === 191) {
+ return jumpToNextItem(scrollArea);
+ }
+ }
+ });
+ };
+ }
+ ]);
+
+}).call(this);
+
+// Generated by CoffeeScript 1.6.2
+/*
+
+ownCloud - News
+
+@author Alessandro Cosentino
+@copyright 2013 Alessandro Cosentino cosenal@gmail.com
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+License as published by the Free Software Foundation; either
+version 3 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+You should have received a copy of the GNU Affero General Public
+License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+(function() {
+ angular.module('News').directive('hideOnClick', function() {
+ return function(scope, elm, attr) {
+ var options;
+
+ options = scope.$eval(attr.hideOnClick);
+ if (angular.isDefined(options) && angular.isDefined(options.selector)) {
+ return $(elm).click(function() {
+ return $(options.selector).fadeOut();
+ });
+ } else {
+ return $(elm).click(function() {
+ return $(elm).fadeOut();
+ });
+ }
+ };
+ });
+
+}).call(this);
+
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -198,13 +297,16 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
'$window', function($window) {
return function(scope, elm, attr) {
var getCurrentItem, jumpTo, jumpToNextItem, jumpToPreviousItem, keepUnreadCurrentItem, openCurrentItem, starCurrentItem;
+
jumpTo = function($scrollArea, $item) {
var position;
+
position = $item.offset().top - $scrollArea.offset().top + $scrollArea.scrollTop();
return $scrollArea.scrollTop(position);
};
jumpToPreviousItem = function(scrollArea) {
var $item, $items, $previous, $scrollArea, item, notJumped, _i, _len;
+
$scrollArea = $(scrollArea);
$items = $scrollArea.find('.feed_item');
notJumped = true;
@@ -226,6 +328,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
};
jumpToNextItem = function(scrollArea) {
var $item, $items, $scrollArea, item, jumped, _i, _len;
+
$scrollArea = $(scrollArea);
$items = $scrollArea.find('.feed_item');
jumped = false;
@@ -244,6 +347,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
};
getCurrentItem = function(scrollArea) {
var $item, $items, $scrollArea, item, _i, _len;
+
$scrollArea = $(scrollArea);
$items = $scrollArea.find('.feed_item');
for (_i = 0, _len = $items.length; _i < _len; _i++) {
@@ -256,22 +360,26 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
};
keepUnreadCurrentItem = function(scrollArea) {
var $item;
+
$item = getCurrentItem(scrollArea);
return $item.find('.keep_unread').trigger('click');
};
starCurrentItem = function(scrollArea) {
var $item;
+
$item = getCurrentItem(scrollArea);
return $item.find('.star').trigger('click');
};
openCurrentItem = function(scrollArea) {
var $item;
+
$item = getCurrentItem(scrollArea).find('.item_title a');
$item.trigger('click');
return window.open($item.attr('href'), '_blank');
};
return $($window.document).keydown(function(e) {
var focused, scrollArea;
+
focused = $(':focus');
if (!(focused.is('input') || focused.is('select') || focused.is('textarea') || focused.is('checkbox') || focused.is('button'))) {
scrollArea = elm;
@@ -297,7 +405,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -325,13 +433,16 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
'$timeout', function($timeout) {
return function(scope, elm, attr) {
var options;
+
options = scope.$eval(attr.newsClickScroll);
return elm.click(function() {
var direction, scrollArea;
+
scrollArea = $(options.scrollArea);
direction = options.direction;
return $timeout(function() {
var scrollPosition;
+
if (direction === 'top') {
scrollPosition = 0;
} else {
@@ -346,7 +457,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -381,6 +492,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
return function(scope, elm, attr) {
return elm.bind('scroll', function() {
var counter, item, _i, _ref, _results;
+
if (scrolling) {
scrolling = false;
setTimeout(function() {
@@ -390,6 +502,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
markingRead = false;
setTimeout(function() {
var $elems, feedItem, id, offset, _i, _len, _results;
+
markingRead = true;
$elems = elm.find('.feed_item:not(.read)');
_results = [];
@@ -429,7 +542,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -457,16 +570,19 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
'$rootScope', '$timeout', 'Config', function($rootScope, $timeout, Config) {
return function(scope, elm, attr) {
var caption, timeout, undo;
+
undo = function() {};
caption = '';
timeout = null;
$(elm).click(function() {
var timout;
+
timout = null;
return $(this).fadeOut();
});
$(elm).find('a').click(function() {
var timout;
+
undo();
timout = null;
$rootScope.$apply();
@@ -477,6 +593,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
};
return scope.$on('undoMessage', function(scope, data) {
var _this = this;
+
if (timeout) {
$timeout.cancel(timeout.promise);
}
@@ -493,7 +610,60 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
+/*
+
+ownCloud - News
+
+@author Alessandro Cosentino
+@copyright 2013 Alessandro Cosentino cosenal@gmail.com
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+License as published by the Free Software Foundation; either
+version 3 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+You should have received a copy of the GNU Affero General Public
+License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+(function() {
+ angular.module('News').controller('AppController', [
+ '$scope', 'Persistence', 'FeedBusinessLayer', function($scope, Persistence, FeedBusinessLayer) {
+ var AppController;
+
+ AppController = (function() {
+ function AppController(_$scope, _persistence, _feedBusinessLayer) {
+ var successCallback,
+ _this = this;
+
+ this._$scope = _$scope;
+ this._persistence = _persistence;
+ this._feedBusinessLayer = _feedBusinessLayer;
+ this._$scope.initialized = false;
+ this._$scope.feedBusinessLayer = this._feedBusinessLayer;
+ successCallback = function() {
+ return _this._$scope.initialized = true;
+ };
+ this._persistence.init().then(successCallback);
+ }
+
+ return AppController;
+
+ })();
+ return new AppController($scope, Persistence, FeedBusinessLayer);
+ }
+ ]);
+
+}).call(this);
+
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -520,9 +690,11 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').controller('FeedController', [
'$scope', '_ExistsError', 'Persistence', 'FolderBusinessLayer', 'FeedBusinessLayer', 'SubscriptionsBusinessLayer', 'StarredBusinessLayer', 'unreadCountFormatter', 'ActiveFeed', 'FeedType', '$window', function($scope, _ExistsError, Persistence, FolderBusinessLayer, FeedBusinessLayer, SubscriptionsBusinessLayer, StarredBusinessLayer, unreadCountFormatter, ActiveFeed, FeedType, $window) {
var FeedController;
+
FeedController = (function() {
function FeedController(_$scope, _persistence, _folderBusinessLayer, _feedBusinessLayer, _subscriptionsBusinessLayer, _starredBusinessLayer, _unreadCountFormatter, _activeFeed, _feedType, _$window) {
var _this = this;
+
this._$scope = _$scope;
this._persistence = _persistence;
this._folderBusinessLayer = _folderBusinessLayer;
@@ -542,6 +714,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
this._$scope.unreadCountFormatter = this._unreadCountFormatter;
this._$scope.getTotalUnreadCount = function() {
var count, title, titleCount;
+
count = _this._subscriptionsBusinessLayer.getUnreadCount(0);
if (count > 0) {
titleCount = _this._unreadCountFormatter(count);
@@ -562,6 +735,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
};
this._$scope.addFeed = function(feedUrl, parentFolderId) {
var error;
+
if (parentFolderId == null) {
parentFolderId = 0;
}
@@ -588,11 +762,13 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
};
this._$scope.addFolder = function(folderName) {
var error;
+
_this._$scope.folderExistsError = false;
try {
_this._isAddingFolder = true;
return _this._folderBusinessLayer.create(folderName, function(data) {
var activeId;
+
_this._$scope.folderName = '';
_this._$scope.addNewFolder = false;
_this._isAddingFolder = false;
@@ -623,7 +799,60 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
+/*
+
+ownCloud - News
+
+@_author Alessandro Cosentino
+@copyright 2013 Alessandro Cosentino cosenal@gmail.com
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+License as published by the Free Software Foundation; either
+version 3 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+You should have received a copy of the GNU Affero General Public
+License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+(function() {
+ angular.module('News').controller('InitController', [
+ '$scope', 'Persistence', 'FeedBusinessLayer', function($scope, Persistence, FeedBusinessLayer) {
+ var InitController;
+
+ InitController = (function() {
+ function InitController(_$scope, _persistence, _feedBusinessLayer) {
+ var successCallback,
+ _this = this;
+
+ this._$scope = _$scope;
+ this._persistence = _persistence;
+ this._feedBusinessLayer = _feedBusinessLayer;
+ this._$scope.initialized = false;
+ this._$scope.feedBusinessLayer = this._feedBusinessLayer;
+ successCallback = function() {
+ return _this._$scope.initialized = true;
+ };
+ this._persistence.init().then(successCallback);
+ }
+
+ return InitController;
+
+ })();
+ return new InitController($scope, Persistence, FeedBusinessLayer);
+ }
+ ]);
+
+}).call(this);
+
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -650,9 +879,11 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').controller('ItemController', [
'$scope', 'ItemBusinessLayer', 'FeedModel', 'FeedLoading', 'FeedBusinessLayer', 'Language', 'AutoPageLoading', function($scope, ItemBusinessLayer, FeedModel, FeedLoading, FeedBusinessLayer, Language, AutoPageLoading) {
var ItemController;
+
ItemController = (function() {
function ItemController(_$scope, _itemBusinessLayer, _feedModel, _feedLoading, _autoPageLoading, _feedBusinessLayer, _language) {
var _this = this;
+
this._$scope = _$scope;
this._itemBusinessLayer = _itemBusinessLayer;
this._feedModel = _feedModel;
@@ -671,6 +902,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
};
this._$scope.getFeedTitle = function(feedId) {
var feed;
+
feed = _this._feedModel.getById(feedId);
if (angular.isDefined(feed)) {
return feed.title;
@@ -707,7 +939,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -734,9 +966,11 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').controller('SettingsController', [
'$scope', 'FeedBusinessLayer', 'FolderBusinessLayer', 'ShowAll', function($scope, FeedBusinessLayer, FolderBusinessLayer, ShowAll) {
var _this = this;
+
$scope.feedBusinessLayer = FeedBusinessLayer;
$scope["import"] = function(fileContent) {
var error;
+
$scope.error = false;
ShowAll.setShowAll(true);
try {
@@ -749,6 +983,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
};
return $scope.importGoogleReader = function(fileContent) {
var error, parsedJSON;
+
$scope.jsonError = false;
ShowAll.setShowAll(true);
try {
@@ -765,7 +1000,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -791,12 +1026,12 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
(function() {
angular.module('News').factory('ActiveFeed', function() {
var ActiveFeed;
+
ActiveFeed = (function() {
function ActiveFeed() {
/*
Default value is all feeds
*/
-
this._id = 0;
this._type = 3;
}
@@ -822,7 +1057,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -848,6 +1083,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
(function() {
angular.module('News').factory('_BusinessLayer', function() {
var BusinessLayer;
+
BusinessLayer = (function() {
function BusinessLayer(_activeFeed, _persistence, _itemModel, _type) {
this._activeFeed = _activeFeed;
@@ -877,7 +1113,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -907,6 +1143,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').factory('FeedBusinessLayer', [
'_BusinessLayer', 'ShowAll', 'Persistence', 'ActiveFeed', 'FeedType', 'ItemModel', 'FeedModel', 'NewLoading', '_ExistsError', 'Utils', '$rootScope', 'NewestItem', function(_BusinessLayer, ShowAll, Persistence, ActiveFeed, FeedType, ItemModel, FeedModel, NewLoading, _ExistsError, Utils, $rootScope, NewestItem) {
var FeedBusinessLayer;
+
FeedBusinessLayer = (function(_super) {
__extends(FeedBusinessLayer, _super);
@@ -940,6 +1177,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedBusinessLayer.prototype["delete"] = function(feedId) {
var data, feed,
_this = this;
+
feed = this._feedModel.removeById(feedId);
data = {
undoCallback: function() {
@@ -954,6 +1192,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedBusinessLayer.prototype.markRead = function(feedId) {
var feed, item, newestItemId, _i, _len, _ref;
+
feed = this._feedModel.getById(feedId);
newestItemId = this._newestItem.getId();
if (angular.isDefined(feed) && newestItemId !== 0) {
@@ -973,6 +1212,10 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
return this._feedModel.size();
};
+ FeedBusinessLayer.prototype.noFeeds = function() {
+ return this.getNumberOfFeeds() === 0;
+ };
+
FeedBusinessLayer.prototype.isVisible = function(feedId) {
if (this.isActive(feedId) || this._showAll.getShowAll()) {
return true;
@@ -983,6 +1226,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedBusinessLayer.prototype.move = function(feedId, folderId) {
var feed;
+
feed = this._feedModel.getById(feedId);
if (angular.isDefined(feed) && feed.folderId !== folderId) {
this._feedModel.update({
@@ -997,6 +1241,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedBusinessLayer.prototype.setShowAll = function(showAll) {
var callback,
_this = this;
+
this._showAll.setShowAll(showAll);
callback = function() {
_this._itemModel.clear();
@@ -1022,6 +1267,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedBusinessLayer.prototype.getFeedLink = function(feedId) {
var feed;
+
feed = this._feedModel.getById(feedId);
if (angular.isDefined(feed)) {
return feed.link;
@@ -1031,6 +1277,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedBusinessLayer.prototype.create = function(url, parentId, onSuccess, onFailure) {
var feed, success,
_this = this;
+
if (parentId == null) {
parentId = 0;
}
@@ -1079,6 +1326,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedBusinessLayer.prototype.importGoogleReader = function(json) {
var feed, onSuccess, url,
_this = this;
+
url = 'http://owncloud/googlereader';
if (angular.isUndefined(this._feedModel.getByUrl(url))) {
feed = {
@@ -1092,6 +1340,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}
onSuccess = function(response) {
var id;
+
id = response.data.feeds[0].id;
return _this.load(id);
};
@@ -1107,7 +1356,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -1137,6 +1386,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').factory('FolderBusinessLayer', [
'_BusinessLayer', 'FolderModel', 'FeedBusinessLayer', 'Persistence', 'FeedType', 'ActiveFeed', 'ItemModel', 'ShowAll', '_ExistsError', 'OPMLParser', 'NewestItem', 'FeedModel', '$rootScope', function(_BusinessLayer, FolderModel, FeedBusinessLayer, Persistence, FeedType, ActiveFeed, ItemModel, ShowAll, _ExistsError, OPMLParser, NewestItem, FeedModel, $rootScope) {
var FolderBusinessLayer;
+
FolderBusinessLayer = (function(_super) {
__extends(FolderBusinessLayer, _super);
@@ -1159,6 +1409,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FolderBusinessLayer.prototype["delete"] = function(folderId) {
var data, feed, feeds, folder, _i, _len, _ref,
_this = this;
+
feeds = [];
_ref = this._feedBusinessLayer.getFeedsOfFolder(folderId);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@@ -1185,6 +1436,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FolderBusinessLayer.prototype.open = function(folderId) {
var folder;
+
folder = this._folderModel.getById(folderId);
if (angular.isDefined(folder)) {
if (!folder.opened) {
@@ -1196,6 +1448,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FolderBusinessLayer.prototype.toggleFolder = function(folderId) {
var folder;
+
folder = this._folderModel.getById(folderId);
if (angular.isDefined(folder)) {
folder.opened = !folder.opened;
@@ -1209,6 +1462,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FolderBusinessLayer.prototype.markRead = function(folderId) {
var feed, folder, item, newestItemId, _i, _j, _len, _len1, _ref, _ref1;
+
newestItemId = this._newestItem.getId();
folder = this._folderModel.getById(folderId);
if (newestItemId !== 0 && angular.isDefined(folder)) {
@@ -1234,6 +1488,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FolderBusinessLayer.prototype.isVisible = function(folderId) {
var feed, _i, _len, _ref;
+
if (this._showAll.getShowAll()) {
return true;
} else {
@@ -1260,6 +1515,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FolderBusinessLayer.prototype.create = function(folderName, onSuccess, onFailure) {
var folder, success,
_this = this;
+
if (onSuccess == null) {
onSuccess = null;
}
@@ -1297,6 +1553,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FolderBusinessLayer.prototype["import"] = function(xml) {
var opml;
+
opml = this._opmlParser.parseXML(xml);
return this._importElement(opml, 0);
};
@@ -1304,12 +1561,14 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FolderBusinessLayer.prototype._importElement = function(opml, parentFolderId) {
var item, _i, _len, _ref, _results,
_this = this;
+
_ref = opml.getItems();
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
item = _ref[_i];
_results.push((function(item) {
var error, folder;
+
if (item.isFolder()) {
try {
return _this.create(item.getName(), function(data) {
@@ -1349,7 +1608,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -1376,6 +1635,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').factory('ItemBusinessLayer', [
'ItemModel', 'FeedModel', 'Persistence', 'ActiveFeed', 'FeedType', 'StarredBusinessLayer', 'NewestItem', function(ItemModel, FeedModel, Persistence, ActiveFeed, FeedType, StarredBusinessLayer, NewestItem) {
var ItemBusinessLayer;
+
ItemBusinessLayer = (function() {
function ItemBusinessLayer(_itemModel, _feedModel, _persistence, _activeFeed, _feedType, _starredBusinessLayer, _newestItem) {
this._itemModel = _itemModel;
@@ -1397,6 +1657,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
ItemBusinessLayer.prototype.isKeptUnread = function(itemId) {
var item;
+
item = this._itemModel.getById(itemId);
if (angular.isDefined(item) && angular.isDefined(item.keptUnread)) {
return item.keptUnread;
@@ -1406,6 +1667,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
ItemBusinessLayer.prototype.toggleKeepUnread = function(itemId) {
var item;
+
item = this._itemModel.getById(itemId);
if (angular.isDefined(item) && !item.keptUnread) {
item.keptUnread = true;
@@ -1419,6 +1681,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
ItemBusinessLayer.prototype.toggleStarred = function(itemId) {
var item;
+
item = this._itemModel.getById(itemId);
if (item.isStarred()) {
item.setUnstarred();
@@ -1433,6 +1696,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
ItemBusinessLayer.prototype.setRead = function(itemId) {
var feed, item, keptUnread;
+
item = this._itemModel.getById(itemId);
if (angular.isDefined(item)) {
keptUnread = angular.isDefined(item.keptUnread) && item.keptUnread;
@@ -1449,6 +1713,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
ItemBusinessLayer.prototype.setUnread = function(itemId) {
var feed, item;
+
item = this._itemModel.getById(itemId);
if (angular.isDefined(item)) {
if (item.isRead()) {
@@ -1464,6 +1729,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
ItemBusinessLayer.prototype.getFeedTitle = function(itemId) {
var feed, item;
+
item = this._itemModel.getById(itemId);
if (angular.isDefined(item)) {
feed = this._feedModel.getById(item.feedId);
@@ -1475,6 +1741,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
ItemBusinessLayer.prototype.loadNext = function(callback) {
var lowestItemId;
+
lowestItemId = this._itemModel.getLowestId();
if (lowestItemId !== 0) {
return this._persistence.getItems(this._activeFeed.getType(), this._activeFeed.getId(), lowestItemId, callback);
@@ -1494,7 +1761,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -1524,6 +1791,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').factory('StarredBusinessLayer', [
'_BusinessLayer', 'StarredCount', 'Persistence', 'ActiveFeed', 'FeedType', 'ItemModel', function(_BusinessLayer, StarredCount, Persistence, ActiveFeed, FeedType, ItemModel) {
var StarredBusinessLayer;
+
StarredBusinessLayer = (function(_super) {
__extends(StarredBusinessLayer, _super);
@@ -1561,7 +1829,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -1591,6 +1859,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').factory('SubscriptionsBusinessLayer', [
'_BusinessLayer', 'FeedBusinessLayer', 'Persistence', 'ShowAll', 'ActiveFeed', 'FeedType', 'ItemModel', 'FeedModel', 'NewestItem', function(_BusinessLayer, FeedBusinessLayer, Persistence, ShowAll, ActiveFeed, FeedType, ItemModel, FeedModel, NewestItem) {
var SubscriptionsBusinessLayer;
+
SubscriptionsBusinessLayer = (function(_super) {
__extends(SubscriptionsBusinessLayer, _super);
@@ -1604,6 +1873,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
SubscriptionsBusinessLayer.prototype.isVisible = function() {
var visible;
+
if (this.isActive(0) && this._feedBusinessLayer.getNumberOfFeeds() > 0) {
return true;
}
@@ -1617,6 +1887,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
SubscriptionsBusinessLayer.prototype.markRead = function() {
var feed, item, newestItemId, _i, _j, _len, _len1, _ref, _ref1;
+
newestItemId = this._newestItem.getId();
if (newestItemId !== 0) {
_ref = this._feedModel.getAll();
@@ -1646,7 +1917,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -1672,6 +1943,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
(function() {
angular.module('News').factory('_ExistsError', function() {
var ExistsError;
+
ExistsError = (function() {
function ExistsError(message) {
this.message = message;
@@ -1685,7 +1957,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -1711,6 +1983,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
(function() {
angular.module('News').factory('FeedType', function() {
var feedType;
+
return feedType = {
Feed: 0,
Folder: 1,
@@ -1722,7 +1995,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -1750,6 +2023,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').factory('Language', function() {
var Language;
+
Language = (function() {
function Language() {
this._language = 'en';
@@ -1783,7 +2057,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -1813,6 +2087,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').factory('FeedModel', [
'_Model', '_EqualQuery', 'Utils', function(_Model, _EqualQuery, Utils) {
var FeedModel;
+
FeedModel = (function(_super) {
__extends(FeedModel, _super);
@@ -1829,6 +2104,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedModel.prototype.add = function(data, clearCache) {
var item, updateById, updateByUrl;
+
if (clearCache == null) {
clearCache = true;
}
@@ -1865,6 +2141,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedModel.prototype.update = function(data, clearCache) {
var item, itemWithId;
+
if (clearCache == null) {
clearCache = true;
}
@@ -1889,6 +2166,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedModel.prototype.removeById = function(id) {
var item;
+
item = this.getById(id);
delete this._url[item.url];
return FeedModel.__super__.removeById.call(this, id);
@@ -1900,6 +2178,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedModel.prototype.getUnreadCount = function() {
var count, feed, _i, _len, _ref;
+
count = 0;
_ref = this.getAll();
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@@ -1911,6 +2190,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedModel.prototype.getFeedUnreadCount = function(feedId) {
var count, feed;
+
feed = this.getById(feedId);
count = 0;
if (angular.isDefined(feed)) {
@@ -1922,6 +2202,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedModel.prototype.getFolderUnreadCount = function(folderId) {
var count, feed, query, _i, _len, _ref;
+
query = new _EqualQuery('folderId', parseInt(folderId));
count = 0;
_ref = this.get(query);
@@ -1934,12 +2215,14 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedModel.prototype.getAllOfFolder = function(folderId) {
var query;
+
query = new _EqualQuery('folderId', parseInt(folderId));
return this.get(query);
};
FeedModel.prototype.removeByUrl = function(url, clearCache) {
var counter, entry, key, value, _i, _len, _ref, _ref1, _results;
+
if (clearCache == null) {
clearCache = true;
}
@@ -1982,7 +2265,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -2012,6 +2295,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').factory('FolderModel', [
'_Model', '_EqualQuery', function(_Model, _EqualQuery) {
var FolderModel;
+
FolderModel = (function(_super) {
__extends(FolderModel, _super);
@@ -2022,6 +2306,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FolderModel.prototype.add = function(data, clearCache) {
var item, updateById, updateByName;
+
if (clearCache == null) {
clearCache = true;
}
@@ -2052,6 +2337,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FolderModel.prototype.update = function(data, clearCache) {
var item, itemWithId;
+
if (clearCache == null) {
clearCache = true;
}
@@ -2085,6 +2371,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FolderModel.prototype.removeById = function(id, clearCache) {
var item;
+
if (clearCache == null) {
clearCache = true;
}
@@ -2099,6 +2386,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FolderModel.prototype.removeByName = function(name, clearCache) {
var counter, entry, key, value, _i, _len, _ref, _ref1, _results;
+
if (clearCache == null) {
clearCache = true;
}
@@ -2142,7 +2430,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -2172,6 +2460,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').factory('ItemModel', [
'_Model', '_MinimumQuery', 'StatusFlag', function(_Model, _MinimumQuery, StatusFlag) {
var ItemModel;
+
ItemModel = (function(_super) {
__extends(ItemModel, _super);
@@ -2187,6 +2476,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
ItemModel.prototype.add = function(data, clearCache) {
var entry, hash;
+
if (clearCache == null) {
clearCache = true;
}
@@ -2224,6 +2514,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
ItemModel.prototype.update = function(data, clearCache) {
var entry, hash, key, value;
+
if (clearCache == null) {
clearCache = true;
}
@@ -2244,12 +2535,14 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
ItemModel.prototype.getByGuidHashAndFeedId = function(guidHash, feedId) {
var hash;
+
hash = feedId + '_' + guidHash;
return this._guidFeedIdHash[hash];
};
ItemModel.prototype.removeById = function(id) {
var hash, item;
+
item = this.getById(id);
hash = item.feedId + '_' + item.guidHash;
delete this._guidFeedIdHash[hash];
@@ -2258,6 +2551,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
ItemModel.prototype.getLowestId = function() {
var lowestId, query;
+
query = new _MinimumQuery('id');
lowestId = this.get(query);
if (angular.isDefined(lowestId)) {
@@ -2276,7 +2570,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -2302,6 +2596,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
(function() {
angular.module('News').factory('NewestItem', function() {
var NewestItem;
+
NewestItem = (function() {
function NewestItem() {
this._id = 0;
@@ -2323,7 +2618,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -2349,6 +2644,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
(function() {
angular.module('News').factory('OPMLParser', function() {
var Feed, Folder, OPMLParser;
+
Feed = (function() {
function Feed(_name, _url) {
this._name = _name;
@@ -2400,6 +2696,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
OPMLParser.prototype.parseXML = function(xml) {
var $root, $xml, structure;
+
$xml = $($.parseXML(xml));
$root = $xml.find('body');
structure = new Folder('root');
@@ -2409,6 +2706,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
OPMLParser.prototype._recursivelyParse = function($xml, structure) {
var $outline, feed, folder, outline, title, _i, _len, _ref, _results;
+
_ref = $xml.children('outline');
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@@ -2435,7 +2733,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -2460,8 +2758,9 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
(function() {
angular.module('News').factory('Persistence', [
- 'Request', 'FeedLoading', 'AutoPageLoading', 'NewLoading', 'Config', 'ActiveFeed', '$rootScope', function(Request, FeedLoading, AutoPageLoading, NewLoading, Config, ActiveFeed, $rootScope) {
+ 'Request', 'FeedLoading', 'AutoPageLoading', 'NewLoading', 'Config', 'ActiveFeed', '$rootScope', '$q', function(Request, FeedLoading, AutoPageLoading, NewLoading, Config, ActiveFeed, $rootScope, $q) {
var Persistence;
+
Persistence = (function() {
function Persistence(_request, _feedLoading, _autoPageLoading, _newLoading, _config, _activeFeed, _$rootScope) {
this._request = _request;
@@ -2478,14 +2777,21 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Loads the initial data from the server
*/
- var _this = this;
+ var successCallback,
+ _this = this;
+
+ this.deferred = $q.defer();
this.getActiveFeed(function() {
return _this.getItems(_this._activeFeed.getType(), _this._activeFeed.getId());
});
this.getAllFolders();
- this.getAllFeeds();
+ successCallback = function() {
+ return _this.deferred.resolve();
+ };
+ this.getAllFeeds(successCallback);
this.userSettingsRead();
- return this.userSettingsLanguage();
+ this.userSettingsLanguage();
+ return this.deferred.promise;
};
/*
@@ -2496,6 +2802,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Persistence.prototype.getItems = function(type, id, offset, onSuccess) {
var failureCallbackWrapper, loading, params, successCallbackWrapper,
_this = this;
+
if (onSuccess == null) {
onSuccess = null;
}
@@ -2532,6 +2839,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
var params;
+
params = {
routeParams: {
feedId: feedId,
@@ -2547,6 +2855,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
var params;
+
params = {
routeParams: {
feedId: feedId,
@@ -2562,6 +2871,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
var params;
+
params = {
routeParams: {
itemId: itemId
@@ -2576,6 +2886,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
var params;
+
params = {
routeParams: {
itemId: itemId
@@ -2590,6 +2901,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
var params;
+
params = {
data: {
highestItemId: highestItemId
@@ -2606,6 +2918,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Persistence.prototype.getAllFeeds = function(onSuccess, showLoading) {
var failureCallbackWrapper, params, successCallbackWrapper,
_this = this;
+
if (showLoading == null) {
showLoading = true;
}
@@ -2635,6 +2948,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Persistence.prototype.getActiveFeed = function(onSuccess) {
var failureCallbackWrapper, params, successCallbackWrapper,
_this = this;
+
this._feedLoading.increase();
successCallbackWrapper = function(data) {
onSuccess();
@@ -2652,6 +2966,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Persistence.prototype.createFeed = function(url, parentFolderId, onSuccess, onFailure) {
var params;
+
if (onSuccess == null) {
onSuccess = null;
}
@@ -2673,6 +2988,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Persistence.prototype.deleteFeed = function(feedId) {
var params;
+
params = {
routeParams: {
feedId: feedId
@@ -2683,6 +2999,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Persistence.prototype.restoreFeed = function(feedId, onSuccess) {
var params;
+
if (onSuccess == null) {
onSuccess = null;
}
@@ -2702,6 +3019,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
var params;
+
params = {
routeParams: {
feedId: feedId
@@ -2719,6 +3037,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
var params;
+
params = {
routeParams: {
feedId: feedId
@@ -2736,6 +3055,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
var params;
+
params = {
routeParams: {
feedId: feedId
@@ -2746,6 +3066,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Persistence.prototype.importGoogleReader = function(json, onSuccess) {
var params;
+
params = {
data: {
json: json
@@ -2763,6 +3084,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Persistence.prototype.getAllFolders = function(onSuccess, showLoading) {
var failureCallbackWrapper, params, successCallbackWrapper,
_this = this;
+
if (showLoading == null) {
showLoading = true;
}
@@ -2795,6 +3117,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
var params;
+
params = {
routeParams: {
folderId: folderId
@@ -2809,6 +3132,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
var params;
+
params = {
routeParams: {
folderId: folderId
@@ -2819,6 +3143,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Persistence.prototype.createFolder = function(folderName, parentFolderId, onSuccess, onFailure) {
var params;
+
if (parentFolderId == null) {
parentFolderId = 0;
}
@@ -2847,6 +3172,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
var params;
+
params = {
routeParams: {
folderId: folderId
@@ -2857,6 +3183,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Persistence.prototype.restoreFolder = function(folderId, onSuccess) {
var params;
+
if (onSuccess == null) {
onSuccess = null;
}
@@ -2876,6 +3203,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
var params;
+
params = {
routeParams: {
folderId: folderId
@@ -2893,6 +3221,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
var params;
+
params = {
routeParams: {
folderId: folderId
@@ -2913,7 +3242,6 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
/*
Prompts for an OPML download
*/
-
return this._request.get('news_export_opml');
};
@@ -2925,6 +3253,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Persistence.prototype.userSettingsRead = function(onSuccess) {
var failureCallbackWrapper, params, successCallbackWrapper,
_this = this;
+
if (onSuccess == null) {
onSuccess = null;
}
@@ -2954,6 +3283,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
var data;
+
data = {
onSuccess: callback
};
@@ -2966,6 +3296,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
var data;
+
data = {
onSuccess: callback
};
@@ -2975,6 +3306,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Persistence.prototype.userSettingsLanguage = function(onSuccess) {
var data, failureCallbackWrapper, successCallbackWrapper,
_this = this;
+
if (onSuccess == null) {
onSuccess = null;
}
@@ -3007,7 +3339,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -3058,6 +3390,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').factory('Publisher', [
'_Publisher', 'ActiveFeed', 'ShowAll', 'StarredCount', 'ItemModel', 'FolderModel', 'FeedModel', 'Language', 'NewestItem', function(_Publisher, ActiveFeed, ShowAll, StarredCount, ItemModel, FolderModel, FeedModel, Language, NewestItem) {
var publisher;
+
publisher = new _Publisher();
publisher.subscribeObjectTo(ActiveFeed, 'activeFeed');
publisher.subscribeObjectTo(ShowAll, 'showAll');
@@ -3073,7 +3406,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -3099,6 +3432,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
(function() {
angular.module('News').factory('ShowAll', function() {
var ShowAll;
+
ShowAll = (function() {
function ShowAll() {
this._showAll = false;
@@ -3124,7 +3458,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -3150,6 +3484,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
(function() {
angular.module('News').factory('StarredCount', function() {
var StarredCount;
+
StarredCount = (function() {
function StarredCount() {
this._count = 0;
@@ -3175,7 +3510,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -3210,7 +3545,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -3245,3 +3580,4 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
+})(window.angular, window.jQuery, window.moment); \ No newline at end of file
diff --git a/templates/main.php b/templates/main.php
index ab70caddf..ecfaa9515 100644
--- a/templates/main.php
+++ b/templates/main.php
@@ -17,6 +17,8 @@
\OCP\Util::addStyle('news', 'items');
\OCP\Util::addStyle('news', 'settings');
\OCP\Util::addStyle('news', 'showall');
+\OCP\Util::addStyle('news', 'firstrun');
+
// stylesheets for different OC versions
$version = \OCP\Util::getVersion();
@@ -29,7 +31,7 @@ if($version[0] > 5 || ($version[0] >= 5 && $version[1] >= 80)) {
?>
-<div id="app" ng-app="News" ng-cloak>
+<div id="app" ng-app="News" ng-cloak ng-controller="AppController">
<div id="undo-container">
<div undo-notification id="undo">
<a href="#"><?php p($l->t('Undo deletion of %s', '{{ getCaption() }}')); ?></a>
@@ -47,7 +49,8 @@ if($version[0] > 5 || ($version[0] >= 5 && $version[1] >= 80)) {
<?php print_unescaped($this->inc('part.showall')); ?>
</ul>
- <div id="app-settings" ng-controller="SettingsController">
+ <div id="app-settings" ng-controller="SettingsController"
+ ng-class="{open: initialized && feedBusinessLayer.noFeeds()}">
<?php print_unescaped($this->inc('part.settings')) ?>
</div>
@@ -58,10 +61,14 @@ if($version[0] > 5 || ($version[0] >= 5 && $version[1] >= 80)) {
autopaging: isAutoPaging()
}"
ng-controller="ItemController"
+ ng-show="initialized && !feedBusinessLayer.noFeeds()"
news-item-scroll="true"
item-shortcuts
tabindex="-1">
<?php print_unescaped($this->inc("part.items")); ?>
</div>
+ <div id="firstrun" ng-show="initialized && feedBusinessLayer.noFeeds()">
+ <?php print_unescaped($this->inc("part.firstrun")); ?>
+ </div>
</div>
diff --git a/templates/part.addnew.php b/templates/part.addnew.php
index fe0776101..10511c95d 100644
--- a/templates/part.addnew.php
+++ b/templates/part.addnew.php
@@ -8,8 +8,13 @@
href="#"
oc-click-focus="{
selector: '.add-new-popup input[ng-model=feedUrl]'
- }">+ <span><?php p($l->t('Add Website'))?></span></a>
- <div class="add-new-popup">
+ }"
+ ng-class="{opened: initialized && feedBusinessLayer.noFeeds()}"
+ >+ <span><?php p($l->t('Add Website'))?></span></a>
+
+ <div class="add-new-popup"
+ ng-show="initialized && feedBusinessLayer.noFeeds()">
+
<fieldset class="personalblock">
<p class="error" ng-show="feedExistsError || folderExistsError">
<span ng-show="feedExistsError">
diff --git a/templates/part.firstrun.php b/templates/part.firstrun.php
new file mode 100644
index 000000000..6edf8617e
--- /dev/null
+++ b/templates/part.firstrun.php
@@ -0,0 +1,3 @@
+<h1 class="message">
+ <?php p($l->t('Welcome to the ownCloud News app!')) ?>
+</h1> \ No newline at end of file