/* * ext-server_open.js * * Licensed under the Apache License, Version 2 * * Copyright(c) 2010 Alexis Deveria * */ svgEditor.addExtension("server_open", { callback: function() { // Do nothing if client support is found if(window.FileReader) return; var cancelled = false; // Change these to appropriate script file var open_svg_action = 'extensions/fileopen.php?type=load_svg'; var import_svg_action = 'extensions/fileopen.php?type=import_svg'; var import_img_action = 'extensions/fileopen.php?type=import_img'; // Set up function for PHP uploader to use svgEditor.processFile = function(str64, type) { if(cancelled) { cancelled = false; return; } $('#dialog_box').hide(); if(type != 'import_img') { var xmlstr = svgCanvas.Utils.decode64(str64); } switch ( type ) { case 'load_svg': svgCanvas.clear(); svgCanvas.setSvgString(xmlstr); svgEditor.updateCanvas(); break; case 'import_svg': svgCanvas.importSvgString(xmlstr); svgEditor.updateCanvas(); break; case 'import_img': svgCanvas.setGoodImage(str64); break; } } // Create upload form var open_svg_form = $('