diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-19 12:31:54 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-19 12:31:54 +0200 |
commit | 67e00e798d85d897e4793077aa14bcb4fb3d1765 (patch) | |
tree | 1a808c1a9a2330ffc5f201bcf62fb546cc658a7d /js/public | |
parent | ed3990b46bcb048963bbfcb567656e82d8686796 (diff) |
added javascript for uploading google reader json files
Diffstat (limited to 'js/public')
-rw-r--r-- | js/public/app.js | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/js/public/app.js b/js/public/app.js index 855bcd895..7422fc83a 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -545,7 +545,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. var _this = this; $scope.feedBusinessLayer = FeedBusinessLayer; - return $scope["import"] = function(fileContent) { + $scope["import"] = function(fileContent) { var error; $scope.error = false; @@ -558,6 +558,20 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. return $scope.error = true; } }; + return $scope.importGoogleReader = function(fileContent) { + var error, parsedJSON; + + $scope.jsonError = false; + ShowAll.setShowAll(true); + try { + parsedJSON = JSON.parse(fileContent); + return FeedBusinessLayer.importGoogleReader(parsedJSON); + } catch (_error) { + error = _error; + console.error(error); + return $scope.jsonError = true; + } + }; } ]); @@ -898,6 +912,23 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. return _results; }; + FeedBusinessLayer.prototype.importGoogleReader = function(json) { + var feed, url; + + url = 'http://owncloud/googlereader'; + if (angular.isUndefined(this._feedModel.getByUrl(url))) { + feed = { + title: 'Google Reader', + url: url, + folderId: 0, + unreadCount: 0, + faviconLink: 'url(' + this._utils.imagePath('core', 'loading.gif') + ')' + }; + this._feedModel.add(feed); + } + return this._persistence.importGoogleReader(json); + }; + return FeedBusinessLayer; })(_BusinessLayer); @@ -2516,6 +2547,17 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. return this._request.post('news_feeds_update', params); }; + Persistence.prototype.importGoogleReader = function(json) { + var params; + + params = { + data: { + json: json + } + }; + return this._request.post('news_feeds_import_googlereader', params); + }; + /* FOLDER CONTROLLER */ |