diff options
Diffstat (limited to 'js/build/app/services/persistence.js')
-rw-r--r-- | js/build/app/services/persistence.js | 367 |
1 files changed, 0 insertions, 367 deletions
diff --git a/js/build/app/services/persistence.js b/js/build/app/services/persistence.js deleted file mode 100644 index fd0bd3c93..000000000 --- a/js/build/app/services/persistence.js +++ /dev/null @@ -1,367 +0,0 @@ -// Generated by CoffeeScript 1.4.0 - -/* - -ownCloud - News - -@author Bernhard Posselt -@copyright 2012 Bernhard Posselt nukeawhale@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').factory('_Persistence', function() { - var Persistence; - Persistence = (function() { - - function Persistence(_request, _loading, _config, _activeFeed, _$rootScope) { - this._request = _request; - this._loading = _loading; - this._config = _config; - this._activeFeed = _activeFeed; - this._$rootScope = _$rootScope; - } - - Persistence.prototype.init = function() { - /* - Loads the initial data from the server - */ - - var _this = this; - this._loading.increase(); - this.getActiveFeed(function() { - return _this.getItems(_this._activeFeed.getType(), _this._activeFeed.getId(), null, function() { - return _this._loading.decrease(); - }); - }); - this.getAllFolders(this._triggerHideRead); - this.getAllFeeds(this._triggerHideRead); - this.userSettingsRead(this._triggerHideRead); - return this.getStarredItems(this._triggerHideRead); - }; - - /* - ITEM CONTROLLER - */ - - - Persistence.prototype.getItems = function(type, id, offset, onSuccess, updatedSince) { - var data; - if (updatedSince == null) { - updatedSince = null; - } - if (updatedSince !== null) { - data = { - updatedSince: updatedSince, - type: type, - id: id - }; - } else { - data = { - limit: this._config.itemBatchSize, - offset: offset, - id: id, - type: type - }; - } - return this._request.get('news_items', {}, data, onSuccess); - }; - - Persistence.prototype.getItemById = function(itemId) { - var url; - url = { - itemId: itemId - }; - return this._request.get('news_item', url); - }; - - Persistence.prototype.getStarredItems = function(onSuccess) { - return this._request.get('news_starred_items', {}, {}, onSuccess); - }; - - Persistence.prototype.starItem = function(itemId) { - /* - Stars an item - */ - - var url; - url = { - itemId: itemId - }; - return this._request.post('news_star_item', url); - }; - - Persistence.prototype.unstarItem = function(itemId) { - /* - Unstars an item - */ - - var url; - url = { - itemId: itemId - }; - return this._request.post('news_unstar_item', url); - }; - - Persistence.prototype.readItem = function(itemId) { - /* - Sets an item as read - */ - - var url; - url = { - itemId: itemId - }; - return this._request.post('news_read_item', url); - }; - - Persistence.prototype.unreadItem = function(itemId) { - /* - Sets an item as unread - */ - - var url; - url = { - itemId: itemId - }; - return this._request.post('news_unread_item', url); - }; - - /* - FOLDER CONTROLLER - */ - - - Persistence.prototype.getAllFolders = function(callback) { - callback || (callback = angular.noop); - return this._request.get('news_folders', {}, {}, callback); - }; - - Persistence.prototype.getFolderById = function(folderId) { - var url; - url = { - folderId: folderId - }; - return this._request.get('news_folder', url); - }; - - Persistence.prototype.openFolder = function(folderId) { - /* - Save if a folder was opened - */ - - var url; - url = { - folderId: folderId - }; - return this._request.post('news_open_folder', url); - }; - - Persistence.prototype.collapseFolder = function(folderId) { - /* - Save if a folder was collapsed - */ - - var url; - url = { - folderId: folderId - }; - return this._request.post('news_collapse_folder', url); - }; - - Persistence.prototype.createFolder = function(folderName, parentFolderId, onSuccess, onError) { - var data; - if (parentFolderId == null) { - parentFolderId = 0; - } - if (onSuccess == null) { - onSuccess = null; - } - if (onError == null) { - onError = null; - } - data = { - folderName: folderName, - parentFolderId: parentFolderId - }; - onSuccess || (onSuccess = angular.noop); - onError || (onError = angular.noop); - return this._request.post('news_create_folder', {}, data, onSuccess, onError); - }; - - Persistence.prototype.deleteFolder = function(folderId) { - /* - Save if a folder was collapsed - */ - - var url; - url = { - folderId: folderId - }; - return this._request.post('news_delete_folder', url); - }; - - Persistence.prototype.renameFolder = function(folderId, folderName) { - /* - Save if a folder was collapsed - */ - - var data, url; - url = { - folderId: folderId - }; - data = { - folderName: folderName - }; - return this._request.post('news_rename_folder', url, data); - }; - - /* - FEED CONTROLLER - */ - - - Persistence.prototype.getAllFeeds = function(callback) { - callback || (callback = angular.noop); - return this._request.get('news_feeds', {}, {}, callback); - }; - - Persistence.prototype.getFeedById = function(feedId) { - var url; - url = { - feedId: feedId - }; - return this._request.get('news_feed', url); - }; - - Persistence.prototype.getActiveFeed = function(onSuccess) { - return this._request.get('news_active_feed', {}, {}, onSuccess); - }; - - Persistence.prototype.createFeed = function(url, parentFolderId, onSuccess, onError) { - var data; - data = { - parentFolderId: parentFolderId, - url: url - }; - return this._request.post('news_create_feed', {}, data, onSuccess, onError); - }; - - Persistence.prototype.deleteFeed = function(feedId) { - var url; - url = { - feedId: feedId - }; - return this._request.post('news_delete_feed', url); - }; - - Persistence.prototype.moveFeed = function(feedId, folderId) { - /* - moves a feed to a new folder - */ - - var data, url; - url = { - feedId: feedId - }; - data = { - folderId: folderId - }; - return this._request.post('news_move_feed', url, data); - }; - - Persistence.prototype.setFeedRead = function(feedId, highestItemId) { - /* - sets all items of a feed as read - */ - - var data, url; - url = { - feedId: feedId - }; - data = { - highestItemId: highestItemId - }; - return this._request.post('news_set_feed_read', url, data); - }; - - Persistence.prototype.updateFeed = function(feedId) { - /* - moves a feed to a new folder - */ - - var url; - url = { - feedId: feedId - }; - return this._request.post('news_update_feed', url); - }; - - /* - EXPORT CONTROLLER - */ - - - Persistence.prototype.exportOPML = function() { - /* - Prompts for an OPML download - */ - return this._request.get('news_export_opml'); - }; - - /* - USERSETTINGS CONTROLLER - */ - - - Persistence.prototype.userSettingsRead = function(callback) { - if (callback == null) { - callback = null; - } - /* - Gets the configs for read settings - */ - - callback || (callback = angular.noop); - return this._request.get('news_user_settings_read', {}, {}, callback); - }; - - Persistence.prototype.userSettingsReadShow = function() { - /* - Sets the reader mode to show all - */ - return this._request.post('news_user_settings_read_show'); - }; - - Persistence.prototype.userSettingsReadHide = function() { - /* - Sets the reader mode to show only unread - */ - return this._request.post('news_user_settings_read_hide'); - }; - - Persistence.prototype._trigerHideRead = function() { - return this._$rootScope.$broadcast('triggerHideRead'); - }; - - return Persistence; - - })(); - return Persistence; - }); - -}).call(this); |