Permalink
Browse files

"Add explicit downloading of XML file"

  • Loading branch information...
1 parent 5b39a72 commit 6abe42140c1fcb9adf833a917df33401cb88c046 @piscisaureus committed Feb 19, 2012
Showing with 16 additions and 9 deletions.
  1. +2 −1 css/layout.css
  2. +1 −1 index.html
  3. +10 −5 js/export.js
  4. +3 −2 js/maia.js
View
@@ -74,9 +74,10 @@ a:hover { color: black; }
font-family: Verdana,Arial, Helvetica , sans-serif;
}
-.bannersubnav a { color: #3e75a6; text-decoration: none; padding-left: 5px; padding-right: 5px; }
+.bannersubnav a { color: #3e75a6; text-decoration: none; }
.bannersubnav a:visited { color: #3e75a6; }
.bannersubnav a:hover { color: #000000; text-decoration: none; }
+.bannersubnav span.separator { padding-left: 5px; padding-right: 5px; }
.toplogo {
margin-left: 0px;
View
@@ -33,7 +33,7 @@
<div class="container">
<div class="bannerArea">
<div class="bannersubnav">
- <a href="javascript:void(0)" id="exportxml">Export XML</a> | <a href="#about">About</a>
+ <a href="javascript:void(0)" id="exportxml">Export XML</a> (<a href="javascript:void(0)" id="exportxmldownload">download</a>) <span class="separator">|</span> <a href="#about">About</a>
</div>
<div class="toplogo">
<img src="images/MAIAlogo.gif" />
View
@@ -43,9 +43,14 @@ function XMLHelper() {
return serializer.serializeToString(doc);
};
- var download = this.download = function() {
- var dataUri = 'data:application/xml;charset=utf-8,' + encodeURIComponent(serialize());
- window.open(dataUri);
+ var download = this.download = function(force) {
+ if (force) {
+ var mime = "application/binary";
+ } else {
+ var mime = "application/xml";
+ }
+ var dataUri = 'data:' + mime + ';charset=utf-8,' + encodeURIComponent(serialize());
+ window.open(dataUri, "model.xml");
};
var pushJson = this.pushJson = function(parent, tagName, json, itemTagName) {
@@ -72,7 +77,7 @@ function XMLHelper() {
};
}
-function exportXML() {
+function exportXML(download) {
var exportCollections = ['roles', 'agents', 'institutions', 'components', 'actionSituations', 'actions', 'domainProblemVariables', 'roleEnactments', 'validationVariables'];
var xml = new XMLHelper();
@@ -92,5 +97,5 @@ function exportXML() {
}
}
- xml.download();
+ xml.download(download);
}
View
@@ -17,8 +17,9 @@ $(function() {
(new ScopeMatrixView());
- // Bind export butten
- $('#exportxml').click(exportXML);
+ // Bind export buttons
+ $('#exportxml').click(function() { exportXML(false); });
+ $('#exportxmldownload').click(function() { exportXML(true); });
// Set up backbone router
var Workspace = Backbone.Router.extend({

0 comments on commit 6abe421

Please sign in to comment.