diff options
Diffstat (limited to 'js/build/app/services/persistence.js')
-rw-r--r-- | js/build/app/services/persistence.js | 577 |
1 files changed, 0 insertions, 577 deletions
diff --git a/js/build/app/services/persistence.js b/js/build/app/services/persistence.js deleted file mode 100644 index d4c3e85e7..000000000 --- a/js/build/app/services/persistence.js +++ /dev/null @@ -1,577 +0,0 @@ -// Generated by CoffeeScript 1.6.3 -/* - -ownCloud - News - -@author Bernhard Posselt -@copyright 2012 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/>. -*/ - - -(function() { - angular.module('News').factory('Persistence', [ - '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; - this._feedLoading = _feedLoading; - this._autoPageLoading = _autoPageLoading; - this._newLoading = _newLoading; - this._config = _config; - this._activeFeed = _activeFeed; - this._$rootScope = _$rootScope; - } - - Persistence.prototype.init = function() { - /* - Loads the initial data from the server - */ - - var successCallback, - _this = this; - this.deferred = $q.defer(); - this.getActiveFeed(function() { - return _this.getItems(_this._activeFeed.getType(), _this._activeFeed.getId()); - }); - this.getAllFolders(); - successCallback = function() { - return _this.deferred.resolve(); - }; - this.getAllFeeds(successCallback); - this.userSettingsRead(); - this.userSettingsLanguage(); - return this.deferred.promise; - }; - - /* - ITEM CONTROLLER - */ - - - Persistence.prototype.getItems = function(type, id, offset, onSuccess) { - var failureCallbackWrapper, loading, params, successCallbackWrapper, - _this = this; - if (onSuccess == null) { - onSuccess = null; - } - onSuccess || (onSuccess = function() {}); - if (offset === 0) { - loading = this._feedLoading; - } else { - loading = this._autoPageLoading; - } - loading.increase(); - successCallbackWrapper = function(data) { - onSuccess(data); - return loading.decrease(); - }; - failureCallbackWrapper = function(data) { - return loading.decrease(); - }; - params = { - data: { - limit: this._config.itemBatchSize, - offset: offset, - id: id, - type: type - }, - onSuccess: successCallbackWrapper, - onFailure: failureCallbackWrapper - }; - return this._request.get('news_items', params); - }; - - Persistence.prototype.starItem = function(feedId, guidHash) { - /* - Stars an item - */ - - var params; - params = { - routeParams: { - feedId: feedId, - guidHash: guidHash - } - }; - return this._request.post('news_items_star', params); - }; - - Persistence.prototype.unstarItem = function(feedId, guidHash) { - /* - Unstars an item - */ - - var params; - params = { - routeParams: { - feedId: feedId, - guidHash: guidHash - } - }; - return this._request.post('news_items_unstar', params); - }; - - Persistence.prototype.readItem = function(itemId) { - /* - Sets an item as read - */ - - var params; - params = { - routeParams: { - itemId: itemId - } - }; - return this._request.post('news_items_read', params); - }; - - Persistence.prototype.unreadItem = function(itemId) { - /* - Sets an item as unread - */ - - var params; - params = { - routeParams: { - itemId: itemId - } - }; - return this._request.post('news_items_unread', params); - }; - - Persistence.prototype.setAllRead = function(highestItemId) { - /* - sets all items as read - */ - - var params; - params = { - data: { - highestItemId: highestItemId - } - }; - return this._request.post('news_items_all_read', params); - }; - - /* - FEED CONTROLLER - */ - - - Persistence.prototype.getAllFeeds = function(onSuccess, showLoading) { - var failureCallbackWrapper, params, successCallbackWrapper, - _this = this; - if (showLoading == null) { - showLoading = true; - } - onSuccess || (onSuccess = function() {}); - if (showLoading) { - this._feedLoading.increase(); - successCallbackWrapper = function(data) { - onSuccess(); - return _this._feedLoading.decrease(); - }; - failureCallbackWrapper = function(data) { - return _this._feedLoading.decrease(); - }; - } else { - successCallbackWrapper = function(data) { - return onSuccess(); - }; - failureCallbackWrapper = function(data) {}; - } - params = { - onSuccess: successCallbackWrapper, - onFailure: failureCallbackWrapper - }; - return this._request.get('news_feeds', params); - }; - - Persistence.prototype.getActiveFeed = function(onSuccess) { - var failureCallbackWrapper, params, successCallbackWrapper, - _this = this; - this._feedLoading.increase(); - successCallbackWrapper = function(data) { - onSuccess(); - return _this._feedLoading.decrease(); - }; - failureCallbackWrapper = function(data) { - return _this._feedLoading.decrease(); - }; - params = { - onSuccess: successCallbackWrapper, - onFailure: failureCallbackWrapper - }; - return this._request.get('news_feeds_active', params); - }; - - Persistence.prototype.createFeed = function(url, parentFolderId, onSuccess, onFailure) { - var params; - if (onSuccess == null) { - onSuccess = null; - } - if (onFailure == null) { - onFailure = null; - } - onSuccess || (onSuccess = function() {}); - onFailure || (onFailure = function() {}); - params = { - data: { - parentFolderId: parentFolderId, - url: url - }, - onSuccess: onSuccess, - onFailure: onFailure - }; - return this._request.post('news_feeds_create', params); - }; - - Persistence.prototype.deleteFeed = function(feedId) { - var params; - params = { - routeParams: { - feedId: feedId - } - }; - return this._request["delete"]('news_feeds_delete', params); - }; - - Persistence.prototype.restoreFeed = function(feedId, onSuccess) { - var params; - if (onSuccess == null) { - onSuccess = null; - } - onSuccess || (onSuccess = function() {}); - params = { - onSuccess: onSuccess, - routeParams: { - feedId: feedId - } - }; - return this._request.post('news_feeds_restore', params); - }; - - Persistence.prototype.moveFeed = function(feedId, folderId) { - /* - moves a feed to a new folder - */ - - var params; - params = { - routeParams: { - feedId: feedId - }, - data: { - parentFolderId: folderId - } - }; - return this._request.post('news_feeds_move', params); - }; - - Persistence.prototype.setFeedRead = function(feedId, highestItemId) { - /* - sets all items of a feed as read - */ - - var params; - params = { - routeParams: { - feedId: feedId - }, - data: { - highestItemId: highestItemId - } - }; - return this._request.post('news_feeds_read', params); - }; - - Persistence.prototype.updateFeed = function(feedId) { - /* - moves a feed to a new folder - */ - - var params; - params = { - routeParams: { - feedId: feedId - } - }; - return this._request.post('news_feeds_update', params); - }; - - Persistence.prototype.importGoogleReader = function(json, onSuccess) { - var params; - params = { - data: { - json: json - }, - onSuccess: onSuccess - }; - return this._request.post('news_feeds_import_googlereader', params); - }; - - /* - FOLDER CONTROLLER - */ - - - Persistence.prototype.getAllFolders = function(onSuccess, showLoading) { - var failureCallbackWrapper, params, successCallbackWrapper, - _this = this; - if (showLoading == null) { - showLoading = true; - } - onSuccess || (onSuccess = function() {}); - if (showLoading) { - this._feedLoading.increase(); - successCallbackWrapper = function(data) { - onSuccess(); - return _this._feedLoading.decrease(); - }; - failureCallbackWrapper = function(data) { - return _this._feedLoading.decrease(); - }; - } else { - successCallbackWrapper = function(data) { - return onSuccess(); - }; - failureCallbackWrapper = function(data) {}; - } - params = { - onSuccess: successCallbackWrapper, - onFailure: failureCallbackWrapper - }; - return this._request.get('news_folders', params); - }; - - Persistence.prototype.openFolder = function(folderId) { - /* - Save if a folder was opened - */ - - var params; - params = { - routeParams: { - folderId: folderId - } - }; - return this._request.post('news_folders_open', params); - }; - - Persistence.prototype.collapseFolder = function(folderId) { - /* - Save if a folder was collapsed - */ - - var params; - params = { - routeParams: { - folderId: folderId - } - }; - return this._request.post('news_folders_collapse', params); - }; - - Persistence.prototype.createFolder = function(folderName, parentFolderId, onSuccess, onFailure) { - var params; - if (parentFolderId == null) { - parentFolderId = 0; - } - if (onSuccess == null) { - onSuccess = null; - } - if (onFailure == null) { - onFailure = null; - } - onSuccess || (onSuccess = function() {}); - onFailure || (onFailure = function() {}); - params = { - data: { - folderName: folderName, - parentFolderId: parentFolderId - }, - onSuccess: onSuccess, - onFailure: onFailure - }; - return this._request.post('news_folders_create', params); - }; - - Persistence.prototype.deleteFolder = function(folderId) { - /* - Save if a folder was collapsed - */ - - var params; - params = { - routeParams: { - folderId: folderId - } - }; - return this._request["delete"]('news_folders_delete', params); - }; - - Persistence.prototype.restoreFolder = function(folderId, onSuccess) { - var params; - if (onSuccess == null) { - onSuccess = null; - } - onSuccess || (onSuccess = function() {}); - params = { - onSuccess: onSuccess, - routeParams: { - folderId: folderId - } - }; - return this._request.post('news_folders_restore', params); - }; - - Persistence.prototype.renameFolder = function(folderId, folderName) { - /* - Save if a folder was collapsed - */ - - var params; - params = { - routeParams: { - folderId: folderId - }, - data: { - folderName: folderName - } - }; - return this._request.post('news_folders_rename', params); - }; - - Persistence.prototype.setFolderRead = function(folderId, highestItemId) { - /* - sets all items of a folder as read - */ - - var params; - params = { - routeParams: { - folderId: folderId - }, - data: { - highestItemId: highestItemId - } - }; - return this._request.post('news_folders_read', params); - }; - - /* - EXPORT CONTROLLER - */ - - - Persistence.prototype.exportOPML = function() { - /* - Prompts for an OPML download - */ - - return this._request.get('news_export_opml'); - }; - - /* - USERSETTINGS CONTROLLER - */ - - - Persistence.prototype.userSettingsRead = function(onSuccess) { - var failureCallbackWrapper, params, successCallbackWrapper, - _this = this; - if (onSuccess == null) { - onSuccess = null; - } - /* - Gets the configs for read settings - */ - - onSuccess || (onSuccess = function() {}); - this._feedLoading.increase(); - successCallbackWrapper = function(data) { - onSuccess(); - return _this._feedLoading.decrease(); - }; - failureCallbackWrapper = function(data) { - return _this._feedLoading.decrease(); - }; - params = { - onSuccess: successCallbackWrapper, - onFailure: failureCallbackWrapper - }; - return this._request.get('news_usersettings_read', params); - }; - - Persistence.prototype.userSettingsReadShow = function(callback) { - /* - Sets the reader mode to show all - */ - - var data; - data = { - onSuccess: callback - }; - return this._request.post('news_usersettings_read_show', data); - }; - - Persistence.prototype.userSettingsReadHide = function(callback) { - /* - Sets the reader mode to show only unread - */ - - var data; - data = { - onSuccess: callback - }; - return this._request.post('news_usersettings_read_hide', data); - }; - - Persistence.prototype.userSettingsLanguage = function(onSuccess) { - var data, failureCallbackWrapper, successCallbackWrapper, - _this = this; - if (onSuccess == null) { - onSuccess = null; - } - onSuccess || (onSuccess = function() {}); - this._feedLoading.increase(); - successCallbackWrapper = function(data) { - onSuccess(); - return _this._feedLoading.decrease(); - }; - failureCallbackWrapper = function(data) { - return _this._feedLoading.decrease(); - }; - data = { - onSuccess: successCallbackWrapper, - onFailure: failureCallbackWrapper - }; - return this._request.get('news_usersettings_language', data); - }; - - Persistence.prototype._triggerHideRead = function() { - return this._$rootScope.$broadcast('triggerHideRead'); - }; - - return Persistence; - - })(); - return new Persistence(Request, FeedLoading, AutoPageLoading, NewLoading, Config, ActiveFeed, $rootScope); - } - ]); - -}).call(this); |