Changeset 29608

Show
Ignore:
Timestamp:
12.12.2014 15:31:22 (5 years ago)
Author:
davidb
Message:

Switch to using JESSIONID as part of the flagname, so everyone visiting the site gets to design their flag in private.

Location:
other-projects/nz-flag-design/trunk
Files:
1 added
5 modified

Legend:

Unmodified
Added
Removed
  • other-projects/nz-flag-design/trunk/design-2d/image-data-to-file.jsp

    r29566 r29608  
    5252     File flag_file  = new File(render_images_dir,"flag.png"); 
    5353 
    54      String image_data = request.getParameter("imageData"); 
     54     String image_data     = request.getParameter("imageData"); 
     55 
     56     String image_filename = request.getParameter("imageFilename"); 
     57     if (image_filename == null) { 
     58    image_filename = "flag.png"; 
     59     } 
     60     File full_image_file  = new File(render_images_dir,image_filename); 
    5561 
    5662 
    57  
    58      writeImageDataToFile(flag_file,image_data); 
     63     writeImageDataToFile(full_image_file,image_data); 
    5964      
    6065     out.println("<script>"); 
    61      out.println("message = \"Image File Saved: &lt;docBase&gt;/render-3d/images/" + flag_file.getName() + "\";"); 
     66     out.println("message = \"Image File Saved: &lt;docBase&gt;/render-3d/images/" + image_filename + "\";"); 
    6267     out.println("</script>"); 
    6368 
  • other-projects/nz-flag-design/trunk/main-form/index.html

    r29571 r29608  
    2020 
    2121    <!-- jQuery --> 
    22 <!-- 
    23     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> 
    24 --> 
    2522    <script src="lib/jquery-1.11.1.min.js"></script> 
    26 <!-- 
    27     <script src="lib/jquery-1.8.2.min.js"></script> 
    28 --> 
     23    <script src="lib/jquery.cookie.js"></script> 
    2924 
    3025    <!-- page swipe --> 
  • other-projects/nz-flag-design/trunk/main-form/iterative-design.html

    r29606 r29608  
    9898            var datauri = quality ? c.toDataURL('image/' + dataURLType, quality) : c.toDataURL('image/' + dataURLType); 
    9999 
     100            // Look up jsession id; if not present fall back to use a timestamp 
     101            var jsession_id = $.cookie('JSESSIONID') || new Date().getTime(); 
     102            console.log("jsession id = " + jsession_id); 
     103            var imageFilename = "flag-" + jsession_id + ".png"; 
     104 
    100105                    $.ajax({ 
    101106                        type: "POST", 
    102107                        url: "../design-2d/image-data-to-file.jsp", 
    103                         data: { imageData : datauri }, 
     108                        data: { imageData: datauri, imageFilename: imageFilename }, 
    104109                        success: function() {  
    105110                      console.log("Exported PNG data to file "); 
    106111                  var render_frame = document.getElementById('render-3d-iframe'); 
    107                   render_frame.contentWindow.createFlag(); // triggers reload 
     112                  // trigger a reload in the 3D Flag Renderer 
     113                  render_frame.contentWindow.createFlag(imageFilename);  
    108114                } 
    109115                    }); 
  • other-projects/nz-flag-design/trunk/render-3d/flag.html

    r29579 r29608  
    355355            var flag_toggle = 0; 
    356356             
    357             function createFlag() { 
     357            function createFlag(flagFilename) { 
     358                    if (flagFilename) { 
     359                    flags[0] = "./images/" + flagFilename; 
     360                } 
    358361     
    359362                if(initial){ 
  • other-projects/nz-flag-design/trunk/similarity-2d/list-flags.jsp

    r29600 r29608  
    3131 
    3232      out.println("</script>"); 
    33     } 
    34  
    35  
     33     
    3634   %>