diff --git a/editor/SavedImage.svg b/editor/SavedImage.svg
deleted file mode 100755
index 27a0d77c..00000000
--- a/editor/SavedImage.svg
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
diff --git a/editor/save.php b/editor/save.php
deleted file mode 100644
index 45bd3699..00000000
--- a/editor/save.php
+++ /dev/null
@@ -1,9 +0,0 @@
-
diff --git a/editor/svg-editor.html b/editor/svg-editor.html
index b5924a0d..55841c18 100644
--- a/editor/svg-editor.html
+++ b/editor/svg-editor.html
@@ -12,7 +12,6 @@
SVG-edit @ http://svg-edit.googlecode.com/
-Click Here to see Saved Image
diff --git a/editor/svg-editor.js b/editor/svg-editor.js
index f0a2d15f..722cc229 100644
--- a/editor/svg-editor.js
+++ b/editor/svg-editor.js
@@ -7,7 +7,6 @@ $(document).ready(function(){
});
$('#palette').append(str);
-
var pos = $('#tools_rect_show').position();
$('#tools_rect').css({'left': pos.left+2, 'top': pos.top+2});
pos = $('#tools_ellipse_show').position();
@@ -123,7 +122,7 @@ $(document).ready(function(){
});
$('#tool_submit').click(function(){
- SvgCanvas.serialize(serializeHandler);
+ SvgCanvas.save();
});
var colorPicker = function(elem) {
@@ -191,20 +190,4 @@ $(document).ready(function(){
$('#tools_ellipse').show();
});
-})
-
-var serializeHandler = function(svg) {
- //alert(svg);
- submitSvgStr(svg);
-}
-
-function submitSvgStr(str){
- //alert("This is svg image in string format \n This will be posted to server \n " + str)
- //posting the data to server
- $.post(
- "save.php",
- {svg_data: escape(str)},
- function(data){
- alert(data);
- });
-}
+});
diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js
index b9ea3fc8..0bbcde90 100644
--- a/editor/svgcanvas.js
+++ b/editor/svgcanvas.js
@@ -408,11 +408,11 @@ function SvgCanvas(doc)
// public functions
- this.serialize = function(handler) {
+ this.save = function() {
var str = "\n"
str += "\n";
str += svgToString(svgroot, 0);
- handler(str);
+ this.saveHandler(str);
}
this.clear = function() {
@@ -504,4 +504,8 @@ function SvgCanvas(doc)
});
}
+ this.saveHandler = function(svg) {
+ alert(svg);
+ }
+
}
diff --git a/extras/server-save/README b/extras/server-save/README
new file mode 100644
index 00000000..e94370bf
--- /dev/null
+++ b/extras/server-save/README
@@ -0,0 +1,8 @@
+Usage:
+
+1) copy file svg-editor-save.php into the directory
+
+2) edit the end of the svgcanvas.js and change this.saveHandler method
+ into the method described in svg-editor-save.js
+
+3) now the drawings will be saved into the file named saved.svg
diff --git a/extras/server-save/svg-editor-save.js b/extras/server-save/svg-editor-save.js
new file mode 100644
index 00000000..ea6a089a
--- /dev/null
+++ b/extras/server-save/svg-editor-save.js
@@ -0,0 +1,3 @@
+this.saveHandler = function(svg) {
+ $.post("svg-editor-save.php", { svg_data: escape(svg) } );
+});
diff --git a/extras/server-save/svg-editor-save.php b/extras/server-save/svg-editor-save.php
new file mode 100644
index 00000000..10617b94
--- /dev/null
+++ b/extras/server-save/svg-editor-save.php
@@ -0,0 +1,8 @@
+