MDL-63210 core: touch-up after review
1. Reworded the string. 2. Removed logic handling form data. 3. Do not use window.location.replace. Backport of MDL-54551.
This commit is contained in:
@@ -186,7 +186,7 @@ $string['service'] = 'Service';
|
||||
$string['servicehelpexplanation'] = 'A service is a set of functions. A service can be accessed by all users or just specified users.';
|
||||
$string['servicename'] = 'Service name';
|
||||
$string['servicenotavailable'] = 'Web service is not available (it doesn\'t exist or might be disabled)';
|
||||
$string['servicerequireslogin'] = 'Web service requires login (the session has been logged out or has expired. Please save any work on the current page before continuing)';
|
||||
$string['servicerequireslogin'] = 'Web service is not available (the session has been logged out or has expired)';
|
||||
$string['servicesbuiltin'] = 'Built-in services';
|
||||
$string['servicescustom'] = 'Custom services';
|
||||
$string['serviceusers'] = 'Authorised users';
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
define(["jquery","core/config","core/log","core/yui","core/url"],function(a,b,c,d,e){var f=!1,g=function(a){var b,c,f=this,g=null,h=0;if(a.error)for(;h<f.length;h++)b=f[h],b.deferred.reject(a);else{for(h=0;h<f.length;h++){if(b=f[h],c=a[h],"undefined"==typeof c){g=new Error("missing response");break}if(c.error!==!1){g=c.exception;break}b.deferred.resolve(c.data)}if(null!==g)if("servicerequireslogin"===g.errorcode)d.use("moodle-core-formchangechecker",function(){if(!M.core_formchangechecker.get_form_dirty_state()){var a=e.relativeUrl("/login/index.php");window.location.replace(a)}});else for(;h<f.length;h++)b=f[h],b.deferred.reject(g)}},h=function(a,b,d){var e=this,g=0;for(g=0;g<e.length;g++){var h=e[g];f?(c.error("Page unloaded."),c.error(d)):h.deferred.reject(d)}};return{call:function(c,d,e){a(window).bind("beforeunload",function(){f=!0});var i,j=[],k=[],l=[],m="";for("undefined"==typeof e&&(e=!0),"undefined"==typeof d&&(d=!0),i=0;i<c.length;i++){var n=c[i];j.push({index:i,methodname:n.methodname,args:n.args}),n.deferred=a.Deferred(),k.push(n.deferred.promise()),"undefined"!=typeof n.done&&n.deferred.done(n.done),"undefined"!=typeof n.fail&&n.deferred.fail(n.fail),n.index=i,l.push(n.methodname)}m=l.length<=5?l.sort().join():l.length+"-method-calls",j=JSON.stringify(j);var o={type:"POST",data:j,context:c,dataType:"json",processData:!1,async:d,contentType:"application/json"},p="service.php";e||(p="service-nologin.php");var q=b.wwwroot+"/lib/ajax/"+p+"?sesskey="+b.sesskey+"&info="+m;return d?a.ajax(q,o).done(g).fail(h):(o.success=g,o.error=h,a.ajax(q,o)),k}}});
|
||||
define(["jquery","core/config","core/log","core/url"],function(a,b,c,d){var e=!1,f=function(a){var b,c,e=this,f=null,g=0;if(a.error)for(;g<e.length;g++)b=e[g],b.deferred.reject(a);else{for(g=0;g<e.length;g++){if(b=e[g],c=a[g],"undefined"==typeof c){f=new Error("missing response");break}if(c.error!==!1){f=c.exception;break}b.deferred.resolve(c.data)}if(null!==f)if("servicerequireslogin"===f.errorcode)window.location=d.relativeUrl("/login/index.php");else for(;g<e.length;g++)b=e[g],b.deferred.reject(f)}},g=function(a,b,d){var f=this,g=0;for(g=0;g<f.length;g++){var h=f[g];e?(c.error("Page unloaded."),c.error(d)):h.deferred.reject(d)}};return{call:function(c,d,h){a(window).bind("beforeunload",function(){e=!0});var i,j=[],k=[],l=[],m="";for("undefined"==typeof h&&(h=!0),"undefined"==typeof d&&(d=!0),i=0;i<c.length;i++){var n=c[i];j.push({index:i,methodname:n.methodname,args:n.args}),n.deferred=a.Deferred(),k.push(n.deferred.promise()),"undefined"!=typeof n.done&&n.deferred.done(n.done),"undefined"!=typeof n.fail&&n.deferred.fail(n.fail),n.index=i,l.push(n.methodname)}m=l.length<=5?l.sort().join():l.length+"-method-calls",j=JSON.stringify(j);var o={type:"POST",data:j,context:c,dataType:"json",processData:!1,async:d,contentType:"application/json"},p="service.php";h||(p="service-nologin.php");var q=b.wwwroot+"/lib/ajax/"+p+"?sesskey="+b.sesskey+"&info="+m;return d?a.ajax(q,o).done(f).fail(g):(o.success=f,o.error=g,a.ajax(q,o)),k}}});
|
||||
+2
-8
@@ -25,7 +25,7 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since 2.9
|
||||
*/
|
||||
define(['jquery', 'core/config', 'core/log', 'core/yui', 'core/url'], function($, config, Log, Y, URL) {
|
||||
define(['jquery', 'core/config', 'core/log', 'core/url'], function($, config, Log, URL) {
|
||||
|
||||
// Keeps track of when the user leaves the page so we know not to show an error.
|
||||
var unloading = false;
|
||||
@@ -81,13 +81,7 @@ define(['jquery', 'core/config', 'core/log', 'core/yui', 'core/url'], function($
|
||||
if (exception !== null) {
|
||||
// If the user isn't doing anything too important, redirect to the login page.
|
||||
if (exception.errorcode === "servicerequireslogin") {
|
||||
Y.use('moodle-core-formchangechecker', function() {
|
||||
if (!M.core_formchangechecker.get_form_dirty_state()) {
|
||||
// If we reach here, the user isn't editing anything on the page.
|
||||
var loginUrl = URL.relativeUrl("/login/index.php");
|
||||
window.location.replace(loginUrl);
|
||||
}
|
||||
});
|
||||
window.location = URL.relativeUrl("/login/index.php");
|
||||
} else {
|
||||
for (; i < requests.length; i++) {
|
||||
request = requests[i];
|
||||
|
||||
Reference in New Issue
Block a user