From f744131b18c97f84dd8868a1cee1879c5ea5cbb9 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 22 Aug 2016 10:10:28 +0200 Subject: Do not error on maxUploadChange The new admin page broke the updating of the max upload size. This is due to very old code there. * Now update is done in the background using js * Added proper route+controller to update Fixes #994 --- apps/files/js/admin.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'apps/files/js') diff --git a/apps/files/js/admin.js b/apps/files/js/admin.js index dcfec824cfe..6afd77eb03e 100644 --- a/apps/files/js/admin.js +++ b/apps/files/js/admin.js @@ -8,6 +8,46 @@ * */ +(function() { + if (!OCA.Files) { + /** + * Namespace for the files app + * @namespace OCA.Files + */ + OCA.Files = {}; + } + + /** + * @namespace OCA.Files.Admin + */ + OCA.Files.Admin = { + initialize: function() { + $('#submitMaxUpload').on('click', _.bind(this._onClickSubmitMaxUpload, this)); + }, + + _onClickSubmitMaxUpload: function () { + OC.msg.startSaving('#maxUploadSizeSettingsMsg'); + + var request = $.ajax({ + url: OC.generateUrl('/apps/files/settings/maxUpload'), + type: 'POST', + data: { + maxUploadSize: $('#maxUploadSize').val() + } + }); + + request.done(function (data) { + $('#maxUploadSize').val(data.maxUploadSize); + OC.msg.finishedSuccess('#maxUploadSizeSettingsMsg', 'Saved'); + }); + + request.fail(function () { + OC.msg.finishedError('#maxUploadSizeSettingsMsg', 'Error'); + }); + } + } +})(); + function switchPublicFolder() { var publicEnable = $('#publicEnable').is(':checked'); // find all radiobuttons of that group @@ -19,6 +59,8 @@ function switchPublicFolder() { } $(document).ready(function() { + OCA.Files.Admin.initialize(); + // Execute the function after loading DOM tree switchPublicFolder(); $('#publicEnable').click(function() { -- cgit v1.2.3