changeset 2860:65b8d9ad75cc

Add XML exporting
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Thu, 27 Apr 2017 12:19:20 +0100
parents d432bf25889b
children 79258b2a8245
files test_create.html test_create/test_core.js
diffstat 2 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test_create.html	Thu Apr 27 12:02:28 2017 +0100
+++ b/test_create.html	Thu Apr 27 12:19:20 2017 +0100
@@ -19,6 +19,7 @@
         <div id="pageRoot">
             <h1>Web Audio Evaluation Tool - Test Creator</h1>
         </div>
+        <button type="button" class="btn btn-success" ng-click="exportXML()">Export XML</button>
         <div id="setupNode" class="node" ng-controller="setup">
             <h2>Setup</h2>
             <div class="attributes">
--- a/test_create/test_core.js	Thu Apr 27 12:02:28 2017 +0100
+++ b/test_create/test_core.js	Thu Apr 27 12:19:20 2017 +0100
@@ -57,6 +57,16 @@
     $s.addPage = function () {
         $s.specification.createNewPage();
     };
+
+    $s.exportXML = function () {
+        var s = new XMLSerializer();
+        var doc = specification.encode();
+        var bb = new Blob([s.serializeToString(doc)], {
+            type: 'application/xml'
+        });
+        var dnlk = window.URL.createObjectURL(bb);
+        window.location.href = dnlk;
+    }
 }]);
 
 AngularInterface.controller("introduction", ['$scope', '$element', '$window', function ($s, $e, $w) {