diff --git a/README.md b/README.md
index ef31b34..650786b 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,8 @@ http://doc.arcgis.com/en/web-appbuilder/create-apps/widget-draw.htm
## configuration :
-4 options :
+5 options :
+- export file name.
- Confirm on delete. A confirm dialog when user delete drawing(s) ?
- Enable import/export. Let the user import or export drawings ?
- Enable local storage. enable auto-saving in local storage and loading saved drawings on widget load.
diff --git a/Widget.js b/Widget.js
index 811345e..85a6fb4 100644
--- a/Widget.js
+++ b/Widget.js
@@ -657,6 +657,7 @@ define([
if(!has("ie") && (!navigator.appName || navigator.appName != 'Microsoft Internet Explorer')){
this.exportButton.href = 'data:application/json;charset=utf-8,'+this.drawingsAsJson(true);
this.exportButton.target = "_BLANK";
+ this.exportButton.download = this.config.exportFileName;
return true;
}
@@ -671,7 +672,7 @@ define([
iframe.document.write(this.drawingsAsJson(true));
iframe.document.close();
iframe.focus();
- iframe.document.execCommand('SaveAs', true, 'myDraw.json');
+ iframe.document.execCommand('SaveAs', true, this.config.exportFileName);
return false;
}
diff --git a/config.json b/config.json
index aff5fa8..e8e44a9 100644
--- a/config.json
+++ b/config.json
@@ -1,4 +1,5 @@
{
+ "exportFileName":"myDrawings.json",
"confirmOnDelete":true,
"allowImportExport":true,
"allowLocalStorage":true,
diff --git a/setting/Setting.html b/setting/Setting.html
index d681e59..d892099 100644
--- a/setting/Setting.html
+++ b/setting/Setting.html
@@ -2,32 +2,39 @@
-
-
+
+
+ ${nls.exportFileName}
+
+
+ -
+
+
${nls.confirmOnDeleteLabel}
-
-
+
${nls.allowImportExportLabel}
-
-
+
${nls.allowLocalStorageLabel}
-
-
+
${nls.localStorageKeyLabel}
- ?
+ ?
diff --git a/setting/Setting.js b/setting/Setting.js
index a5298db..86d227c 100644
--- a/setting/Setting.js
+++ b/setting/Setting.js
@@ -25,16 +25,22 @@ define([
'jimu/BaseWidgetSetting',
'jimu/dijit/TabContainer',
'jimu/dijit/SimpleTable',
+ 'jimu/dijit/Message',
'jimu/utils',
'dijit/form/Select'
],
function(declare, lang, array, html, query, on, _WidgetsInTemplateMixin, BaseWidgetSetting,
- TabContainer, SimpleTable, jimuUtils, Select) {
+ TabContainer, SimpleTable,Message, jimuUtils, Select) {
return declare([BaseWidgetSetting, _WidgetsInTemplateMixin], {
baseClass: 'jimu-widget-draw-setting',
distanceUnits:null,
areaUnits:null,
-
+
+ localStorageKeyMessage:function(){
+ new Message({message:this.nls.localStorageKeyInfo});
+
+ },
+
postMixInProperties:function(){
this.inherited(arguments);
@@ -146,6 +152,7 @@ define([
this._setDistanceTable(this.config.distanceUnits);
this._setAreaTable(this.config.areaUnits);
+ this.exportFileNameInput.value = (config.exportFileName) ? config.exportFileName : this.nls.exportFileName;
this.confirmOnDeleteInput.checked = (config.confirmOnDelete) ? true : false;
this.allowImportExportInput.checked = (config.allowImportExport) ? true : false;
this.allowLocalStorageInput.checked = (config.allowLocalStorage) ? true : false;
@@ -184,6 +191,7 @@ define([
config.distanceUnits = this._getDistanceConfig();
config.areaUnits = this._getAreaConfig();
+ config.exportFileName = (this.exportFileNameInput.value.trim() != "") ? this.exportFileNameInput.value.trim() : this.nls.exportFileName;
config.confirmOnDelete = this.confirmOnDeleteInput.checked;
config.allowImportExport = this.allowImportExportInput.checked;
config.allowLocalStorage = this.allowLocalStorageInput.checked;
diff --git a/setting/css/style.css b/setting/css/style.css
index c4fffc2..d4f6681 100644
--- a/setting/css/style.css
+++ b/setting/css/style.css
@@ -29,4 +29,23 @@
.jimu-rtl .jimu-widget-draw-setting .btn-add-section .btn-add-label{
margin-left: 0;
margin-right: 7px;
+}
+
+.jimu-widget-draw-setting .settings{
+ list-style-type:none;
+ display:table;
+}
+.jimu-widget-draw-setting .settings li{
+ display:table-row;
+}
+.jimu-widget-draw-setting .settings .input{
+ display:table-cell;
+ width:49%;
+ text-align:right;
+}
+.jimu-widget-draw-setting .settings .label{
+ display:table-cell;
+ width:49%;
+ text-align:left;
+ padding-left:10px;
}
\ No newline at end of file
diff --git a/setting/nls/fr/strings.js b/setting/nls/fr/strings.js
index b2ddc53..4d9848d 100644
--- a/setting/nls/fr/strings.js
+++ b/setting/nls/fr/strings.js
@@ -26,6 +26,7 @@
allowImportExportLabel:"Activer l'import et l'export",
allowLocalStorageLabel:"Utiliser local storage",
localStorageKeyLabel:"Clé Local storage",
- localStorageKeyInfo:"Si vide, toutes les applications partageront le même storage. Sinon, les applications avec la même clé partageront le même storage."
+ localStorageKeyInfo:"Si vide, toutes les applications partageront le même storage. Sinon, les applications avec la même clé partageront le même storage.",
+ exportFileName:"mesDessins.json",
})
);
\ No newline at end of file
diff --git a/setting/nls/strings.js b/setting/nls/strings.js
index 414c007..430a6b4 100644
--- a/setting/nls/strings.js
+++ b/setting/nls/strings.js
@@ -26,7 +26,8 @@ define({
allowImportExportLabel:"Allow import & export ?",
allowLocalStorageLabel:"Use local storage ?",
localStorageKeyLabel:"Local storage key",
- localStorageKeyInfo:"If not empty, applications with same key (and same server) will share the same storage. If empty, all will share same storage."
+ localStorageKeyInfo:"If not empty, applications with same key (and same server) will share the same storage. If empty, all will share same storage.",
+ exportFileName:"myDrawings.json"
}),
"ar": 1,
"cs": 1,