Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
chamilo-lms/main/inc/lib/svg-edit/extensions/ext-php_savefile_chamilo.js

34 lines
1.1 KiB

/*globals $, svgCanvas, svgEditor*/
/*jslint regexp:true*/
// TODO: Might add support for "exportImage" custom
// handler as in "ext-server_opensave.js" (and in savefile.php)
svgEditor.addExtension("php_savefile_chamilo", {
callback: function() {
'use strict';
function getFileNameFromTitle () {
var title = svgCanvas.getDocumentTitle();
return $.trim(title);
}
var save_svg_action = svgEditor.curConfig.extPath + 'savefile.php';
svgEditor.setCustomHandlers({
save: function(win, data) {
var svg = '<?xml version="1.0" encoding="UTF-8"?>\n' + data,
filename = getFileNameFromTitle();
$.post(
save_svg_action,
{output_svg: svg, filename: filename}
).done(function(data) {
var response = jQuery.parseJSON(data);
console.log(response.message);
alert(response.message);
if (response.url != '') {
window.top.location.href = response.url;
}
}
);
}
});
}
});