diff --git a/vasl_templates/webapp/static/vassal.js b/vasl_templates/webapp/static/vassal.js
index 8cf4ea9..88cd9b0 100644
--- a/vasl_templates/webapp/static/vassal.js
+++ b/vasl_templates/webapp/static/vassal.js
@@ -402,7 +402,7 @@ function _create_vo_entries_from_analysis( report )
// add a vehicle/ordnance for each relevant GPID
var nCreated = 0 ;
- gpids = Object.keys( report ) ;
+ gpids = Object.keys( report.pieces ) ;
for ( i=0 ; i < gpids.length ; ++i ) {
var gpid = gpids[ i ] ;
var entry = chooseEntry( gpid ) ;
@@ -421,6 +421,17 @@ function _create_vo_entries_from_analysis( report )
[ create_vo_entries( 2, "vehicles" ), create_vo_entries( 2, "ordnance" ) ]
] ;
+ // report the VASSAL and VASL versions
+ // NOTE: We don't do this during the test suite since it can only store 1 message at a time :-/
+ // It would be nice to test this functionality, but the implemenation is simple, so we can live without it.
+ if ( ! getUrlParam( "store_msgs" ) ) {
+ showInfoMsg( "The scenario was created with:
" +
+ "- VASSAL " + report.vassal_version +
+ "
- VASL " + report.vasl_version +
+ "
"
+ ) ;
+ }
+
// report what happened
var report_strings = [] ;
function make_report_string( nat, nVehicles, nOrdnance ) {
diff --git a/vasl_templates/webapp/vassal.py b/vasl_templates/webapp/vassal.py
index 31f482d..34074e6 100644
--- a/vasl_templates/webapp/vassal.py
+++ b/vasl_templates/webapp/vassal.py
@@ -12,6 +12,8 @@ import logging
import pprint
import base64
import time
+import io
+import zipfile
import xml.etree.cElementTree as ET
from flask import request, jsonify
@@ -227,7 +229,7 @@ def _parse_label_report( fname ):
# ---------------------------------------------------------------------
@app.route( "/analyze-vsav", methods=["POST"] )
-def analyze_vsav():
+def analyze_vsav(): #pylint: disable=too-many-locals
"""Analyze a VASL scenario file."""
# parse the request
@@ -272,13 +274,24 @@ def analyze_vsav():
# and it contains pieces that had their GPID's changed from 6.4.4. This kind of nonsense
# is probably unsustainable over the long-term, but we try to maintain some semblance of
# back-compatibility for as long as we can :-/
- report2 = {}
+ report2 = { "pieces": {} }
for gpid,vals in report.items():
orig_gpid = get_reverse_remapped_gpid( globvars.vasl_mod, gpid )
if orig_gpid == gpid:
- report2[ gpid ] = vals
+ report2["pieces"][ gpid ] = vals
else:
- report2[ orig_gpid ] = vals
+ report2["pieces"][ orig_gpid ] = vals
+
+ # extract the VASSAL and VASL versions from the VSAV data
+ def get_node_text( key, node_name ):
+ elem = doc.find( "./{}".format( node_name ) )
+ if elem is not None:
+ report2[ key ] = elem.text
+ with zipfile.ZipFile( io.BytesIO( vsav_data ) ) as zfile:
+ module_data = zfile.read( "moduledata" )
+ doc = ET.parse( io.BytesIO( module_data ) )
+ get_node_text( "vassal_version", "VassalVersion" )
+ get_node_text( "vasl_version", "version" )
# return the results
logger.info( "Analyzed the VSAV file OK: elapsed=%.3fs\n%s",