forked from Archives/Athou_commafeed
don't use ngupload for opml import, use a classic http post
This commit is contained in:
@@ -335,7 +335,6 @@ public class FeedREST extends AbstractResourceREST {
|
||||
@POST
|
||||
@Path("/import")
|
||||
@Consumes(MediaType.MULTIPART_FORM_DATA)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@ApiOperation(value = "OPML import", notes = "Import an OPML file, posted as a FORM with the 'file' name")
|
||||
public Response importOpml() {
|
||||
if (StartupBean.USERNAME_DEMO.equals(getUser().getName())) {
|
||||
@@ -360,7 +359,9 @@ public class FeedREST extends AbstractResourceREST {
|
||||
.status(Status.INTERNAL_SERVER_ERROR)
|
||||
.entity(e.getMessage()).build());
|
||||
}
|
||||
return Response.ok(Status.OK).build();
|
||||
return Response.temporaryRedirect(
|
||||
URI.create(applicationSettingsService.get().getPublicUrl()))
|
||||
.build();
|
||||
}
|
||||
|
||||
@GET
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
<js minimize="false">/vendor/mousetrap/*.js</js>
|
||||
<js minimize="false">/vendor/nggrid/*.js</js>
|
||||
<js minimize="false">/vendor/nginfinitescroll/*.js</js>
|
||||
<js minimize="false">/vendor/ngupload/*.js</js>
|
||||
<js minimize="false">/vendor/spinjs/*.js</js>
|
||||
<js minimize="false">/vendor/momentjs/*.js</js>
|
||||
|
||||
|
||||
@@ -97,11 +97,6 @@ function($scope, FeedService, CategoryService, MobileService) {
|
||||
$scope.isOpenImport = false;
|
||||
};
|
||||
|
||||
$scope.uploadComplete = function(contents, completed) {
|
||||
CategoryService.init();
|
||||
$scope.closeImport();
|
||||
};
|
||||
|
||||
$scope.cat = {};
|
||||
|
||||
$scope.openCategory = function() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
var app = angular.module('commafeed', [ 'ui', 'ui.bootstrap', 'ui.state',
|
||||
'commafeed.directives', 'commafeed.controllers', 'commafeed.services',
|
||||
'commafeed.filters', 'ngSanitize', 'ngUpload', 'infinite-scroll',
|
||||
'commafeed.filters', 'ngSanitize', 'infinite-scroll',
|
||||
'ngGrid' ]);
|
||||
|
||||
app.config([ '$routeProvider', '$stateProvider', '$urlRouterProvider', '$httpProvider',
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
<button type="button" class="close" ng-click="closeImport()">×</button>
|
||||
<h4>${tree.import}</h4>
|
||||
</div>
|
||||
<form ng-upload class="form-horizontal" action="rest/feed/import">
|
||||
<form class="form-horizontal" action="rest/feed/import" method="post" enctype="multipart/form-data">
|
||||
<div class="modal-body">
|
||||
<div class="control-group">
|
||||
<div>${import.google_reader_prefix}
|
||||
@@ -81,7 +81,7 @@
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn cancel" ng-click="closeImport()">${global.cancel}</button>
|
||||
<button class="btn btn-primary ok" type="submit" upload-submit="uploadComplete(contents, completed)">${tree.import}</button>
|
||||
<button class="btn btn-primary ok" type="submit">${tree.import}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
angular.module("ngUpload",[]).directive("uploadSubmit",["$parse",function(t){return{restrict:"AC",link:function(a,e,n){var i={};i.enableControls=n.uploadOptionsEnableControls;var o=angular.element(e).parents("form"),r=t(n.uploadSubmit);if(!angular.isFunction(r)){var l="The expression on the ngUpload directive does not point to a valid function.";throw l+"\n"}e.bind("click",function(t){t&&(t.preventDefault=!0);var n=angular.element("<iframe id='upload_iframe' name='upload_iframe' border='0' width='0' height='0' style='width: 0px; height: 0px; border: none; display: none' />");n.bind("load",function(){var t=n.contents().find("body").html();a.$apply(function(){r(a,{content:t,completed:!0})}),""!==t&&setTimeout(function(){n.remove()},250),e.attr("disabled",null),e.attr("title","Click to start upload.")}),o.parent().append(n),a.$apply(function(){r(a,{content:"Please wait...",completed:!1})});var l=!0;i.enableControls||(e.attr("disabled","disabled"),l=!1),e.attr("title",(l?"[ENABLED]: ":"[DISABLED]: ")+"Uploading, please wait..."),o.submit()}).attr("title","Click to start upload.")}}}]).directive("ngUpload",["$parse",function(){return{restrict:"AC",link:function(t,a){a.attr("target","upload_iframe"),a.attr("method","post");var e=-1==a.attr("action").indexOf("?")?"?":"&";a.attr("action",a.attr("action")+e+"_t="+(new Date).getTime()),a.attr("enctype","multipart/form-data"),a.attr("encoding","multipart/form-data")}}}]);
|
||||
Reference in New Issue
Block a user