mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Merge branch 'MDL-47140-master' of git://github.com/gurgus/moodle
This commit is contained in:
commit
7c50998039
@ -45,6 +45,8 @@ require_sesskey();
|
||||
|
||||
$action = required_param('action', PARAM_ALPHA);
|
||||
|
||||
$response = array();
|
||||
|
||||
if ($action === 'save') {
|
||||
$drafttext = required_param('drafttext', PARAM_RAW);
|
||||
$params = array('elementid' => $elementid,
|
||||
@ -138,7 +140,8 @@ if ($action === 'save') {
|
||||
|
||||
// A response means the draft has been restored and here is the auto-saved text.
|
||||
if (!$stale) {
|
||||
echo $record->drafttext;
|
||||
$response['result'] = $record->drafttext;
|
||||
echo json_encode($response);
|
||||
}
|
||||
die();
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
$string['autosavefailed'] = 'Could not connect to the server. If you submit this page now, your changes may be lost.';
|
||||
$string['autosavefrequency'] = 'Autosave frequency (seconds).';
|
||||
$string['autosavefrequency'] = 'Autosave frequency';
|
||||
$string['autosavefrequency_desc'] = 'This is the number of seconds between auto save attempts. Atto will automatically save the text in the editor according to this setting, so that text can be automatically restored when the same user returns to the same form.';
|
||||
$string['autosavesucceeded'] = 'Draft saved.';
|
||||
$string['errorcannotparseline'] = 'The line \'{$a}\' is not in the correct format.';
|
||||
@ -31,6 +31,7 @@ $string['errorgroupisusedtwice'] = 'The group \'{$a}\' is defined twice; group n
|
||||
$string['errornopluginsorgroupsfound'] = 'No plugins or groups found; please add some groups and plugins.';
|
||||
$string['errorpluginnotfound'] = 'The plugin \'{$a}\' cannot be used; it does not appear to be installed.';
|
||||
$string['errorpluginisusedtwice'] = 'The plugin \'{$a}\' is used twice; plugins can only be defined once.';
|
||||
$string['errortextrecovery'] = 'The draft version of this text was unable to be restored.';
|
||||
$string['pluginname'] = 'Atto HTML editor';
|
||||
$string['subplugintype_atto'] = 'Atto plugin';
|
||||
$string['subplugintype_atto_plural'] = 'Atto plugins';
|
||||
|
@ -127,7 +127,8 @@ class atto_texteditor extends texteditor {
|
||||
'plugin_title_shortcut',
|
||||
'textrecovered',
|
||||
'autosavefailed',
|
||||
'autosavesucceeded'
|
||||
'autosavesucceeded',
|
||||
'errortextrecovery'
|
||||
), 'editor_atto');
|
||||
$PAGE->requires->strings_for_js(array(
|
||||
'warning',
|
||||
|
@ -849,10 +849,19 @@ EditorAutosave.prototype = {
|
||||
if (typeof o.responseText !== "undefined" &&
|
||||
o.responseText !== "" &&
|
||||
o.responseText !== this.textarea.get('value')) {
|
||||
Y.log('Autosave text found - recover it.', 'debug', LOGNAME_AUTOSAVE);
|
||||
this.recoverText(o.responseText);
|
||||
response_json = JSON.parse(o.responseText);
|
||||
if (!response_json.error && response_json.result) {
|
||||
Y.log('Autosave text found - recover it.', 'debug', LOGNAME_AUTOSAVE);
|
||||
this.recoverText(response_json.result);
|
||||
} else {
|
||||
Y.log('Error occurred recovering draft text: ' + response_json.error, 'debug', LOGNAME_AUTOSAVE);
|
||||
this.showMessage(M.util.get_string('errortextrecovery', 'editor_atto'), NOTIFY_WARNING, RECOVER_MESSAGE_TIMEOUT);
|
||||
}
|
||||
this._fireSelectionChanged();
|
||||
}
|
||||
},
|
||||
failure: function() {
|
||||
this.showMessage(M.util.get_string('errortextrecovery', 'editor_atto'), NOTIFY_WARNING, RECOVER_MESSAGE_TIMEOUT);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
File diff suppressed because one or more lines are too long
@ -844,9 +844,17 @@ EditorAutosave.prototype = {
|
||||
if (typeof o.responseText !== "undefined" &&
|
||||
o.responseText !== "" &&
|
||||
o.responseText !== this.textarea.get('value')) {
|
||||
this.recoverText(o.responseText);
|
||||
response_json = JSON.parse(o.responseText);
|
||||
if (!response_json.error && response_json.result) {
|
||||
this.recoverText(response_json.result);
|
||||
} else {
|
||||
this.showMessage(M.util.get_string('errortextrecovery', 'editor_atto'), NOTIFY_WARNING, RECOVER_MESSAGE_TIMEOUT);
|
||||
}
|
||||
this._fireSelectionChanged();
|
||||
}
|
||||
},
|
||||
failure: function() {
|
||||
this.showMessage(M.util.get_string('errortextrecovery', 'editor_atto'), NOTIFY_WARNING, RECOVER_MESSAGE_TIMEOUT);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
13
lib/editor/atto/yui/src/editor/js/autosave.js
vendored
13
lib/editor/atto/yui/src/editor/js/autosave.js
vendored
@ -145,10 +145,19 @@ EditorAutosave.prototype = {
|
||||
if (typeof o.responseText !== "undefined" &&
|
||||
o.responseText !== "" &&
|
||||
o.responseText !== this.textarea.get('value')) {
|
||||
Y.log('Autosave text found - recover it.', 'debug', LOGNAME_AUTOSAVE);
|
||||
this.recoverText(o.responseText);
|
||||
response_json = JSON.parse(o.responseText);
|
||||
if (!response_json.error && response_json.result) {
|
||||
Y.log('Autosave text found - recover it.', 'debug', LOGNAME_AUTOSAVE);
|
||||
this.recoverText(response_json.result);
|
||||
} else {
|
||||
Y.log('Error occurred recovering draft text: ' + response_json.error, 'debug', LOGNAME_AUTOSAVE);
|
||||
this.showMessage(M.util.get_string('errortextrecovery', 'editor_atto'), NOTIFY_WARNING, RECOVER_MESSAGE_TIMEOUT);
|
||||
}
|
||||
this._fireSelectionChanged();
|
||||
}
|
||||
},
|
||||
failure: function() {
|
||||
this.showMessage(M.util.get_string('errortextrecovery', 'editor_atto'), NOTIFY_WARNING, RECOVER_MESSAGE_TIMEOUT);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user