diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-16 21:46:05 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-16 21:46:05 +0100 |
commit | 172de781cbc5bb3f6783ef7ab5ef93f04b87307a (patch) | |
tree | effd37b48458da727b9b91dd986eb9ad57f775eb | |
parent | f2dec08b70d7550db56fc5fd467fab6ef31a1eaa (diff) |
dont run broken tests
21 files changed, 1690 insertions, 3 deletions
diff --git a/js/build/app/app.js b/js/build/app/app.js new file mode 100644 index 000000000..74ccb2ce8 --- /dev/null +++ b/js/build/app/app.js @@ -0,0 +1,52 @@ +// 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', ['OC', 'ui']).config(function($provide) { + var config; + return $provide.value('Config', config = { + markReadTimeout: 500, + scrollTimeout: 500, + feedUpdateInterval: 6000000, + itemBatchSize: 20 + }); + }); + + angular.module('News').run([ + 'Persistence', function(Persistence) { + return Persistence.init(); + } + ]); + + $(document).ready(function() { + return $(this).keyup(function(e) { + if ((e.which === 116) || (e.which === 82 && e.ctrlKey)) { + document.location.reload(true); + return false; + } + }); + }); + +}).call(this); diff --git a/js/build/app/services/activefeed.js b/js/build/app/services/activefeed.js new file mode 100644 index 000000000..6f9535c78 --- /dev/null +++ b/js/build/app/services/activefeed.js @@ -0,0 +1,58 @@ +// 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('_ActiveFeed', function() { + var ActiveFeed; + ActiveFeed = (function() { + + function ActiveFeed() { + /* + Default value is all feeds + */ + this._id = 0; + this._type = 3; + } + + ActiveFeed.prototype.handle = function(data) { + this._id = data.id; + return this._type = data.type; + }; + + ActiveFeed.prototype.getType = function() { + return this._type; + }; + + ActiveFeed.prototype.getId = function() { + return this._id; + }; + + return ActiveFeed; + + })(); + return ActiveFeed; + }); + +}).call(this); diff --git a/js/build/app/services/feedtype.js b/js/build/app/services/feedtype.js new file mode 100644 index 000000000..197501ae1 --- /dev/null +++ b/js/build/app/services/feedtype.js @@ -0,0 +1,38 @@ +// 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('FeedType', function() { + var feedType; + return feedType = { + Feed: 0, + Folder: 1, + Starred: 2, + Subscriptions: 3, + Shared: 4 + }; + }); + +}).call(this); diff --git a/js/build/app/services/models/feedmodel.js b/js/build/app/services/models/feedmodel.js new file mode 100644 index 000000000..5ccf1ce04 --- /dev/null +++ b/js/build/app/services/models/feedmodel.js @@ -0,0 +1,55 @@ +// 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() { + 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', function(_Model) { + var FeedModel; + FeedModel = (function(_super) { + + __extends(FeedModel, _super); + + function FeedModel(_utils) { + this._utils = _utils; + FeedModel.__super__.constructor.call(this); + } + + FeedModel.prototype.add = function(item) { + if (item.icon === 'url()') { + item.icon = 'url(' + this._utils.imagePath('news', 'rss.svg') + ')'; + } + return FeedModel.__super__.add.call(this, item); + }; + + return FeedModel; + + })(_Model); + return FeedModel; + } + ]); + +}).call(this); diff --git a/js/build/app/services/models/foldermodel.js b/js/build/app/services/models/foldermodel.js new file mode 100644 index 000000000..ac1e7b11c --- /dev/null +++ b/js/build/app/services/models/foldermodel.js @@ -0,0 +1,47 @@ +// 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() { + 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', function(_Model) { + var FolderModel; + FolderModel = (function(_super) { + + __extends(FolderModel, _super); + + function FolderModel() { + return FolderModel.__super__.constructor.apply(this, arguments); + } + + return FolderModel; + + })(_Model); + return FolderModel; + } + ]); + +}).call(this); diff --git a/js/build/app/services/models/itemmodel.js b/js/build/app/services/models/itemmodel.js new file mode 100644 index 000000000..d1b9cfb12 --- /dev/null +++ b/js/build/app/services/models/itemmodel.js @@ -0,0 +1,47 @@ +// 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() { + 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', function(_Model) { + var ItemModel; + ItemModel = (function(_super) { + + __extends(ItemModel, _super); + + function ItemModel() { + return ItemModel.__super__.constructor.apply(this, arguments); + } + + return ItemModel; + + })(_Model); + return ItemModel; + } + ]); + +}).call(this); diff --git a/js/build/app/services/opmlparser.js b/js/build/app/services/opmlparser.js new file mode 100644 index 000000000..9209d8708 --- /dev/null +++ b/js/build/app/services/opmlparser.js @@ -0,0 +1,115 @@ +// 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('_OPMLParser', function() { + var Feed, Folder, OPMLParser; + Feed = (function() { + + function Feed(_name, _url) { + this._name = _name; + this._url = _url; + } + + Feed.prototype.getName = function() { + return this._name; + }; + + Feed.prototype.getUrl = function() { + return this._url; + }; + + Feed.prototype.isFolder = function() { + return false; + }; + + return Feed; + + })(); + Folder = (function() { + + function Folder(_name) { + this._name = _name; + this._items = []; + } + + Folder.prototype.add = function(feed) { + return this._items.push(feed); + }; + + Folder.prototype.getItems = function() { + return this._items; + }; + + Folder.prototype.getName = function() { + return this._name; + }; + + Folder.prototype.isFolder = function() { + return true; + }; + + return Folder; + + })(); + OPMLParser = (function() { + + function OPMLParser() {} + + OPMLParser.prototype.parseXML = function(xml) { + var $root, $xml, structure; + $xml = $($.parseXML(xml)); + $root = $xml.find('body'); + structure = new Folder('root'); + this._recursivelyParse($root, structure); + return structure; + }; + + OPMLParser.prototype._recursivelyParse = function($xml, structure) { + var $outline, feed, folder, outline, _i, _len, _ref, _results; + _ref = $xml.children('outline'); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + outline = _ref[_i]; + $outline = $(outline); + if (angular.isDefined($outline.attr('type'))) { + feed = new Feed($outline.attr('text'), $outline.attr('xmlUrl')); + _results.push(structure.add(feed)); + } else { + folder = new Folder($outline.attr('text')); + structure.add(folder); + _results.push(this._recursivelyParse($outline, folder)); + } + } + return _results; + }; + + return OPMLParser; + + })(); + return OPMLParser; + }); + +}).call(this); diff --git a/js/build/app/services/persistence.js b/js/build/app/services/persistence.js new file mode 100644 index 000000000..fd0bd3c93 --- /dev/null +++ b/js/build/app/services/persistence.js @@ -0,0 +1,367 @@ +// 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); diff --git a/js/build/app/services/services.js b/js/build/app/services/services.js new file mode 100644 index 000000000..b943fc7da --- /dev/null +++ b/js/build/app/services/services.js @@ -0,0 +1,95 @@ +// 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', [ + '_Persistence', 'Request', 'Loading', 'Config', '$rootScope', 'ActiveFeed', function(_Persistence, Request, Loading, Config, ActiveFeed, $rootScope) { + return new _Persistence(Request, Loading, Config, ActiveFeed, $rootScope); + } + ]); + |