From 67e00e798d85d897e4793077aa14bcb4fb3d1765 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Fri, 19 Apr 2013 12:31:54 +0200 Subject: added javascript for uploading google reader json files --- js/public/app.js | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'js/public/app.js') 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 . 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 . 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 . 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 . 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 */ -- cgit v1.2.3