Index: other-projects/nz-flag-design/trunk/main-form/enter-name.html
===================================================================
--- other-projects/nz-flag-design/trunk/main-form/enter-name.html	(revision 29913)
+++ other-projects/nz-flag-design/trunk/main-form/enter-name.html	(revision 29914)
@@ -42,9 +42,22 @@
 	      }
             </style>
-	    <form style="width: 400px; margin-left:auto; margin-right:auto;">
+	    <form id="publish-data"
+		  action="my-design.jsp" method="get"
+		  style="width: 400px; margin-left:auto; margin-right:auto;"
+		  data-ajax="false" 
+		  >
+	      <input type="hidden" name="action" value="publish"/>
+
+	      <p>
+		Flag Name: 
+	      </p>
+	      <input type="text" autofocus="autofocus" style="color: white;" name="pub-name" />
+
+
+
 	      <p>
 		Your Name: 
 	      </p>
-	      <input type="text" autofocus="autofocus" style="color: white;" name="name" />
+	      <input type="text" style="color: white;" name="name" />
 
 	      <p>
@@ -53,23 +66,25 @@
 	      <input type="text" name="email" />
 
+	      <p>
+		Motivation for your flag design:
+	      </p>
+	      <textarea name="desc" style="height: 250px;" >Describe your design ...</textarea>
+	      
 
-	      <div style="padding-top: 120px; padding-left: 100px; padding-right: 100px">
+	      <div style="padding-top: 20px; padding-left: 10px; padding-right: 10px">
 		<input type="submit" value="Submit Flag Design" />
 	      </div>
 	    </form>
 
+	    <script>
+              var jsession_id = $.cookie('JSESSIONID') || new Date().getTime();
+	      $('#publish-data').append('<input type="hidden" name="myid" value="' + jsession_id + '"/>');
+	      //$('#publish-data').append('<input type="hidden" name="png-flag" value="flag-' + jsession_id + '.png"/>');
+	      //$('#publish-data').append('<input type="hidden" name="svg-flag" value="flag-' + jsession_id + '.svg"/>');
 
-<!-- AddToAny BEGIN -->
-<div class="a2a_kit a2a_kit_size_32 a2a_default_style">
-<a class="a2a_dd" href="https://www.addtoany.com/share_save"></a>
-<a class="a2a_button_email"></a>
-<a class="a2a_button_facebook"></a>
-<a class="a2a_button_google_plus"></a>
-<a class="a2a_button_google_gmail"></a>
-<a class="a2a_button_twitter"></a>
-<a class="a2a_button_tumblr"></a>
-</div>
-<script type="text/javascript" src="//static.addtoany.com/menu/page.js"></script>
-<!-- AddToAny END -->
+	      //$('#publish-data').append('<img src="../render-3d/images/flag-' + jsession_id + '.png"/>');
+
+	    </script>
+
 
 	  </div>
Index: other-projects/nz-flag-design/trunk/main-form/iterative-design.html
===================================================================
--- other-projects/nz-flag-design/trunk/main-form/iterative-design.html	(revision 29913)
+++ other-projects/nz-flag-design/trunk/main-form/iterative-design.html	(revision 29914)
@@ -23,5 +23,6 @@
             <div data-role="content">
                 <div data-role="controlgroup" class="control" data-mini="true">        	
-                    <a href="#" class="next right-button test-fwd" style="right:1%;"></a>
+                    <a href="#" class="next right-button test-fwd" 
+		       style="right:1%;" onclick="saveSVGAndPNGAsFiles()"></a>
                     <a href="#" class="prev left-button idea-back" style="left:1%;"></a>
                 </div>
@@ -89,5 +90,6 @@
                 var activatedSVGEditorFrame = false;
 
-                function savePNGAsFile(imgType, quality) {                
+                function savePNGAsFile(imgType, quality) {    
+		    console.log("savePNGAsFile()")            
                     var design_frame = document.getElementById('design-2d-iframe');
                     var svgCanvas = design_frame.contentWindow.svgCanvas;
@@ -121,5 +123,5 @@
                             data: { imageData: datauri, imageFilename: imageFilename },
                             success: function() { 
-                                console.log("Exported PNG data to file ");
+                                console.log("savePNGAsFile() succeeded");
                                 var render_frame = document.getElementById('render-3d-iframe');
                                 // trigger a reload in the 3D Flag Renderer
@@ -141,4 +143,38 @@
                     design_frame.contentWindow.svgCanvas.rasterExport("PNG", null, exportWindow.name);
                 }
+		
+		function saveSVGAsFile()
+		{
+		    console.log("saveSVGAsFile()")
+                    var design_frame = document.getElementById('design-2d-iframe');
+                    var svgCanvas = design_frame.contentWindow.svgCanvas;
+                    //var svgedit = design_frame.contentWindow.svgedit;
+
+                    var svg_str = svgCanvas.svgCanvasToString();
+
+                    // Look up jsession id; if not present fall back to use a timestamp
+                    var jsession_id = $.cookie('JSESSIONID') || new Date().getTime();
+                    //var jsession_id = $.cookie('JSESSIONID') + "-" + new Date().getTime(); // quick hack for summer scholarship presentation day
+
+                    console.log("jsession id = " + jsession_id);
+                    var svgFilename = "flag-" + jsession_id + ".svg";
+
+                    $.ajax({
+                            type: "POST",
+                            url: "../design-2d/svg-data-to-file.jsp",
+                            data: { svgData: svg_str, svgFilename: svgFilename },
+                            success: function() { 
+                                console.log("saveSVGAsFile() succeeded");
+                            }
+                        });
+
+		}
+
+
+		function saveSVGAndPNGAsFiles()
+		{
+		  saveSVGAsFile();
+		  savePNGAsFile("PNG",null);
+		}
 
                 function reconfigureSvgCanvas(settings) {
@@ -281,5 +317,6 @@
                 function activateSVGEditor() {
                     console.log("activateSVGEditor()");
-                    $('#design-2d-iframe').attr("src","svg-edit-trunk/editor/svg-editor.html?noStorageOnLoad=1");
+                    //$('#design-2d-iframe').attr("src","svg-edit-trunk/editor/svg-editor.html?noStorageOnLoad=1");
+                    $('#design-2d-iframe').attr("src","svg-edit-trunk/editor/svg-editor.html");
                     $('#design-2d-iframe').load(function() {
                         console.log("*** loaded svg iframe: " + this);
