changeset 635:ceffbeaf6d22

post data for action
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Thu, 05 Feb 2015 16:47:54 +0100
parents 7fe9c706fdb2
children 6b6d2e002d7f
files htdocs/svg-edit/editor/svg-editor.js
diffstat 1 files changed, 16 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/htdocs/svg-edit/editor/svg-editor.js	Thu Feb 05 16:41:14 2015 +0100
+++ b/htdocs/svg-edit/editor/svg-editor.js	Thu Feb 05 16:47:54 2015 +0100
@@ -1032,20 +1032,31 @@
 
 			var saveHandler = function(wind, svg) {
 				editor.showSaveWarning = false;
+				var titlename = window.content.parent.document.title.split('-')[0];
+
 
 				// by default, we add the XML prolog back, systems integrating SVG-edit (wikis, CMSs)
 				// can just provide their own custom save handler and might not want the XML prolog
 				svg = '<?xml version="1.0"?>\n' + svg;
+				var svg_data = Utils.encode64(svg);
+				var loc = document.location.href;
+				var pagename = loc.split('?url=')[1].split('?')[0];
+				var svg_target = titlename.split(':')[1];
+				$.post(
+					pagename,
+					{'action': "SvgEditor", 'do': "save", 'target': svg_target, 'svg_data': svg_data}
+				);
 
 				// IE9 doesn't allow standalone Data URLs
 				// https://connect.microsoft.com/IE/feedback/details/542600/data-uri-images-fail-when-loaded-by-themselves
-				if (svgedit.browser.isIE()) {
-					showSourceEditor(0, true);
-					return;
-				}
+				//if (svgedit.browser.isIE()) {
+					//showSourceEditor(0, true);
+					//return;
+				//}
+				top.window.location = pagename;
 
 				// Opens the SVG in new window
-				var win = wind.open('data:image/svg+xml;base64,' + Utils.encode64(svg));
+				//var win = wind.open('data:image/svg+xml;base64,' + Utils.encode64(svg));
 
 				// Alert will only appear the first time saved OR the first time the bug is encountered
 				var done = $.pref('save_notice_done');