summaryrefslogtreecommitdiffstats
path: root/js/build/app/services/models
diff options
context:
space:
mode:
Diffstat (limited to 'js/build/app/services/models')
-rw-r--r--js/build/app/services/models/feedmodel.js198
-rw-r--r--js/build/app/services/models/foldermodel.js159
-rw-r--r--js/build/app/services/models/itemmodel.js133
3 files changed, 0 insertions, 490 deletions
diff --git a/js/build/app/services/models/feedmodel.js b/js/build/app/services/models/feedmodel.js
deleted file mode 100644
index 6a7d55b02..000000000
--- a/js/build/app/services/models/feedmodel.js
+++ /dev/null
@@ -1,198 +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() {
- var __hasProp = {}.hasOwnProperty,
- __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
-
- angular.module('News').factory('FeedModel', [
- '_Model', '_EqualQuery', 'Utils', function(_Model, _EqualQuery, Utils) {
- var FeedModel;
- FeedModel = (function(_super) {
- __extends(FeedModel, _super);
-
- function FeedModel(_utils) {
- this._utils = _utils;
- this._url = {};
- FeedModel.__super__.constructor.call(this);
- }
-
- FeedModel.prototype.clear = function() {
- this._url = {};
- return FeedModel.__super__.clear.call(this);
- };
-
- FeedModel.prototype.add = function(data, clearCache) {
- var item, updateById, updateByUrl;
- if (clearCache == null) {
- clearCache = true;
- }
- if (data.faviconLink === null) {
- data.faviconLink = 'url(' + this._utils.imagePath('news', 'rss.svg') + ')';
- } else if (angular.isDefined(data.faviconLink) && data.faviconLink.indexOf('url(') !== 0) {
- data.faviconLink = 'url(' + data.faviconLink + ')';
- }
- /*
- We want to add a feed on the client side before
- we have an id from the server. Once the server returns
- an id, we have to update the existing item without id
- */
-
- item = this._url[data.url];
- updateById = angular.isDefined(data.id) && angular.isDefined(this.getById(data.id));
- updateByUrl = angular.isDefined(item) && angular.isUndefined(item.id);
- if (updateById || updateByUrl) {
- return this.update(data, clearCache);
- } else {
- if (angular.isDefined(data.url)) {
- this._url[data.url] = data;
- if (angular.isDefined(data.id)) {
- return FeedModel.__super__.add.call(this, data, clearCache);
- } else {
- this._data.push(data);
- if (clearCache) {
- return this._invalidateCache();
- }
- }
- }
- }
- };
-
- FeedModel.prototype.update = function(data, clearCache) {
- var item, itemWithId;
- if (clearCache == null) {
- clearCache = true;
- }
- if (angular.isDefined(data.url)) {
- item = this._url[data.url];
- }
- if (angular.isUndefined(data.id) && angular.isDefined(item)) {
- return angular.extend(item, data);
- } else {
- if (angular.isDefined(data.id) && angular.isDefined(item) && angular.isUndefined(item.id)) {
- item.id = data.id;
- this._dataMap[data.id] = item;
- }
- itemWithId = this.getById(data.id);
- if (angular.isDefined(itemWithId) && itemWithId.url !== data.url) {
- delete this._url[itemWithId.url];
- this._url[data.url] = itemWithId;
- }
- return FeedModel.__super__.update.call(this, data, clearCache);
- }
- };
-
- FeedModel.prototype.removeById = function(id) {
- var item;
- item = this.getById(id);
- delete this._url[item.url];
- return FeedModel.__super__.removeById.call(this, id);
- };
-
- FeedModel.prototype.getByUrl = function(url) {
- return this._url[url];
- };
-
- FeedModel.prototype.getUnreadCount = function() {
- var count, feed, _i, _len, _ref;
- count = 0;
- _ref = this.getAll();
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- feed = _ref[_i];
- count += feed.unreadCount;
- }
- return count;
- };
-
- FeedModel.prototype.getFeedUnreadCount = function(feedId) {
- var count, feed;
- feed = this.getById(feedId);
- count = 0;
- if (angular.isDefined(feed)) {
- return count += feed.unreadCount;
- } else {
- return 0;
- }
- };
-
- FeedModel.prototype.getFolderUnreadCount = function(folderId) {
- var count, feed, query, _i, _len, _ref;
- query = new _EqualQuery('folderId', parseInt(folderId));
- count = 0;
- _ref = this.get(query);
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- feed = _ref[_i];
- count += feed.unreadCount;
- }
- return count;
- };
-
- 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;
- }
- /*
- Remove an entry by id
- */
-
- _ref = this._dataMap;
- for (key in _ref) {
- value = _ref[key];
- if (this._dataMap[key].url === url) {
- delete this._dataMap[key];
- break;
- }
- }
- _ref1 = this._data;
- _results = [];
- for (counter = _i = 0, _len = _ref1.length; _i < _len; counter = ++_i) {
- entry = _ref1[counter];
- if (entry.url === url) {
- this._data.splice(counter, 1);
- delete this._url[url];
- if (clearCache) {
- this._invalidateCache();
- }
- break;
- } else {
- _results.push(void 0);
- }
- }
- return _results;
- };
-
- return FeedModel;
-
- })(_Model);
- return new FeedModel(Utils);
- }
- ]);
-
-}).call(this);
diff --git a/js/build/app/services/models/foldermodel.js b/js/build/app/services/models/foldermodel.js
deleted file mode 100644
index 762c008d6..000000000
--- a/js/build/app/services/models/foldermodel.js
+++ /dev/null
@@ -1,159 +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() {
- var __hasProp = {}.hasOwnProperty,
- __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
-
- angular.module('News').factory('FolderModel', [
- '_Model', '_EqualQuery', function(_Model, _EqualQuery) {
- var FolderModel;
- FolderModel = (function(_super) {
- __extends(FolderModel, _super);
-
- function FolderModel() {
- this._nameCache = {};
- FolderModel.__super__.constructor.call(this);
- }
-
- FolderModel.prototype.add = function(data, clearCache) {
- var item, updateById, updateByName;
- if (clearCache == null) {
- clearCache = true;
- }
- /*
- We want to add a folder on the client side before
- we have an id from the server. Once the server returns
- an id, we have to update the existing item without id
- */
-
- data.name = this._transformName(data.name);
- item = this._nameCache[data.name];
- updateById = angular.isDefined(data.id) && angular.isDefined(this.getById(data.id));
- updateByName = angular.isDefined(item) && angular.isUndefined(item.id);
- if (updateById || updateByName) {
- return this.update(data, clearCache);
- } else {
- this._nameCache[data.name] = data;
- if (angular.isDefined(data.id)) {
- return FolderModel.__super__.add.call(this, data, clearCache);
- } else {
- this._data.push(data);
- if (clearCache) {
- return this._invalidateCache();
- }
- }
- }
- };
-
- FolderModel.prototype.update = function(data, clearCache) {
- var item, itemWithId;
- if (clearCache == null) {
- clearCache = true;
- }
- data.name = this._transformName(data.name);
- item = this._nameCache[data.name];
- if (angular.isUndefined(data.id) && angular.isDefined(item)) {
- return angular.extend(item, data);
- } else {
- if (angular.isDefined(data.id) && angular.isDefined(item) && angular.isUndefined(item.id)) {
- item.id = data.id;
- this._dataMap[data.id] = item;
- }
- itemWithId = this.getById(data.id);
- if (angular.isDefined(itemWithId) && itemWithId.name !== data.name) {
- delete this._nameCache[itemWithId.name];
- this._nameCache[data.name] = itemWithId;
- }
- return FolderModel.__super__.update.call(this, data, clearCache);
- }
- };
-
- FolderModel.prototype.getByName = function(folderName) {
- folderName = this._transformName(folderName);
- return this._nameCache[folderName];
- };
-
- FolderModel.prototype.clear = function() {
- this._nameCache = {};
- return FolderModel.__super__.clear.call(this);
- };
-
- FolderModel.prototype.removeById = function(id, clearCache) {
- var item;
- if (clearCache == null) {
- clearCache = true;
- }
- item = this.getById(id);
- delete this._nameCache[this._transformName(item.name)];
- return FolderModel.__super__.removeById.call(this, id, clearCache);
- };
-
- FolderModel.prototype._transformName = function(folderName) {
- return folderName.trim().toLowerCase();
- };
-
- FolderModel.prototype.removeByName = function(name, clearCache) {
- var counter, entry, key, value, _i, _len, _ref, _ref1, _results;
- if (clearCache == null) {
- clearCache = true;
- }
- /*
- Remove an entry by id
- */
-
- name = name.toLowerCase();
- _ref = this._dataMap;
- for (key in _ref) {
- value = _ref[key];
- if (this._dataMap[key].name === name) {
- delete this._dataMap[key];
- break;
- }
- }
- _ref1 = this._data;
- _results = [];
- for (counter = _i = 0, _len = _ref1.length; _i < _len; counter = ++_i) {
- entry = _ref1[counter];
- if (entry.name === name) {
- this._data.splice(counter, 1);
- delete this._nameCache[name];
- if (clearCache) {
- this._invalidateCache();
- }
- break;
- } else {
- _results.push(void 0);
- }
- }
- return _results;
- };
-
- return FolderModel;
-
- })(_Model);
- return new FolderModel();
- }
- ]);
-
-}).call(this);
diff --git a/js/build/app/services/models/itemmodel.js b/js/build/app/services/models/itemmodel.js
deleted file mode 100644
index 3f2e996a7..000000000
--- a/js/build/app/services/models/itemmodel.js
+++ /dev/null
@@ -1,133 +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() {
- var __hasProp = {}.hasOwnProperty,
- __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
-
- angular.module('News').factory('ItemModel', [
- '_Model', '_MinimumQuery', 'StatusFlag', function(_Model, _MinimumQuery, StatusFlag) {
- var ItemModel;
- ItemModel = (function(_super) {
- __extends(ItemModel, _super);
-
- function ItemModel() {
- this._guidFeedIdHash = {};
- ItemModel.__super__.constructor.call(this);
- }
-
- ItemModel.prototype.clear = function() {
- this._guidFeedIdHash = {};
- return ItemModel.__super__.clear.call(this);
- };
-
- ItemModel.prototype.add = function(data, clearCache) {
- var entry, hash;
- if (clearCache == null) {
- clearCache = true;
- }
- this._bindMethods(data);
- hash = data.feedId + '_' + data.guidHash;
- entry = this._guidFeedIdHash[hash];
- if (angular.isDefined(entry)) {
- return this.update(data, clearCache);
- } else {
- this._guidFeedIdHash[hash] = data;
- return ItemModel.__super__.add.call(this, data, clearCache);
- }
- };
-
- ItemModel.prototype._bindMethods = function(data) {
- data.isRead = function() {
- return !((this.status & StatusFlag.UNREAD) === StatusFlag.UNREAD);
- };
- data.setRead = function() {
- return this.status &= ~StatusFlag.UNREAD;
- };
- data.setUnread = function() {
- return this.status |= StatusFlag.UNREAD;
- };
- data.isStarred = function() {
- return (this.status & StatusFlag.STARRED) === StatusFlag.STARRED;
- };
- data.setStarred = function() {
- return this.status |= StatusFlag.STARRED;
- };
- return data.setUnstarred = function() {
- return this.status &= ~StatusFlag.STARRED;
- };
- };
-
- ItemModel.prototype.update = function(data, clearCache) {
- var entry, hash, key, value;
- if (clearCache == null) {
- clearCache = true;
- }
- hash = data.feedId + '_' + data.guidHash;
- entry = this._guidFeedIdHash[hash];
- delete this._dataMap[entry.id];
- this._dataMap[data.id] = entry;
- for (key in data) {
- value = data[key];
- if (key === 'feedId' || key === 'guidHash') {
- continue;
- } else {
- entry[key] = value;
- }
- }
- return ItemModel.__super__.update.call(this, entry, clearCache);
- };
-
- 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];
- return ItemModel.__super__.removeById.call(this, id);
- };
-
- ItemModel.prototype.getLowestId = function() {
- var lowestId, query;
- query = new _MinimumQuery('id');
- lowestId = this.get(query);
- if (angular.isDefined(lowestId)) {
- return lowestId.id;
- } else {
- return 0;
- }
- };
-
- return ItemModel;
-
- })(_Model);
- return new ItemModel();
- }
- ]);
-
-}).call(this);