aboutsummaryrefslogtreecommitdiff
path: root/js/io
diff options
context:
space:
mode:
Diffstat (limited to 'js/io')
-rwxr-xr-xjs/io/system/fileio.js2
-rw-r--r--js/io/templates/descriptor.json18
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js4
-rw-r--r--js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js9
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-workflow-controller.js2
-rw-r--r--js/io/ui/save-as-dialog.reel/save-as-dialog.js12
6 files changed, 24 insertions, 23 deletions
diff --git a/js/io/system/fileio.js b/js/io/system/fileio.js
index 2c49e849..23186cf2 100755
--- a/js/io/system/fileio.js
+++ b/js/io/system/fileio.js
@@ -20,7 +20,7 @@ NOTES:
20var Montage = require("montage/core/core").Montage; 20var Montage = require("montage/core/core").Montage;
21//////////////////////////////////////////////////////////////////////// 21////////////////////////////////////////////////////////////////////////
22//Exporting as File I/O 22//Exporting as File I/O
23exports.FileIo = Montage.create(Object.prototype, { 23exports.FileIo = Montage.create(require("montage/ui/component").Component, {
24 //////////////////////////////////////////////////////////////////// 24 ////////////////////////////////////////////////////////////////////
25 //newFile Object (*required): {uri*, contents, contentType} 25 //newFile Object (*required): {uri*, contents, contentType}
26 //Return codes 26 //Return codes
diff --git a/js/io/templates/descriptor.json b/js/io/templates/descriptor.json
index f28455fa..20870934 100644
--- a/js/io/templates/descriptor.json
+++ b/js/io/templates/descriptor.json
@@ -6,58 +6,58 @@
6 "name":"Blank File", 6 "name":"Blank File",
7 "uri":"/", 7 "uri":"/",
8 "type":"directory", 8 "type":"directory",
9 "children":["files/html.txt", "files/js.txt", "files/css.txt", "files/json.txt", "files/php.txt", "files/pl.txt", "files/py.txt", "files/rb.txt"] 9 "children":["/js/io/templates/files/html.txt", "/js/io/templates/files/files/js.txt", "/js/io/templates/files/css.txt", "/js/io/templates/files/json.txt", "/js/io/templates/files/php.txt", "/js/io/templates/files/pl.txt", "/js/io/templates/files/py.txt", "/js/io/templates/files/rb.txt"]
10 }, 10 },
11 "files/html.txt":{ 11 "/js/io/templates/files/html.txt":{
12 "name":"HTML", 12 "name":"HTML",
13 "uri":"/js/io/templates/files/html.txt", 13 "uri":"/js/io/templates/files/html.txt",
14 "type":"file", 14 "type":"file",
15 "fileExtension":".html", 15 "fileExtension":".html",
16 "children":["defaultTemplate"] 16 "children":["defaultTemplate"]
17 }, 17 },
18 "files/js.txt":{ 18 "/js/io/templates/files/files/js.txt":{
19 "name":"JavaScript", 19 "name":"JavaScript",
20 "uri":"/js/io/templates/files/files/js.txt", 20 "uri":"/js/io/templates/files/files/js.txt",
21 "type":"file", 21 "type":"file",
22 "fileExtension":".js", 22 "fileExtension":".js",
23 "children":["defaultTemplate"] 23 "children":["defaultTemplate"]
24 }, 24 },
25 "files/css.txt":{ 25 "/js/io/templates/files/css.txt":{
26 "name":"Cascading Style Sheets", 26 "name":"Cascading Style Sheets",
27 "uri":"/js/io/templates/files/css.txt", 27 "uri":"/js/io/templates/files/css.txt",
28 "type":"file", 28 "type":"file",
29 "fileExtension":".css", 29 "fileExtension":".css",
30 "children":["defaultTemplate"] 30 "children":["defaultTemplate"]
31 }, 31 },
32 "files/json.txt":{ 32 "/js/io/templates/files/json.txt":{
33 "name":"JSON", 33 "name":"JSON",
34 "uri":"/js/io/templates/files/json.txt", 34 "uri":"/js/io/templates/files/json.txt",
35 "type":"file", 35 "type":"file",
36 "fileExtension":".json", 36 "fileExtension":".json",
37 "children":["defaultTemplate"] 37 "children":["defaultTemplate"]
38 }, 38 },
39 "files/php.txt":{ 39 "/js/io/templates/files/php.txt":{
40 "name":"PHP", 40 "name":"PHP",
41 "uri":"/js/io/templates/files/php.txt", 41 "uri":"/js/io/templates/files/php.txt",
42 "type":"file", 42 "type":"file",
43 "fileExtension":".php", 43 "fileExtension":".php",
44 "children":["defaultTemplate"] 44 "children":["defaultTemplate"]
45 }, 45 },
46 "files/pl.txt":{ 46 "/js/io/templates/files/pl.txt":{
47 "name":"Perl", 47 "name":"Perl",
48 "uri":"/js/io/templates/files/pl.txt", 48 "uri":"/js/io/templates/files/pl.txt",
49 "type":"file", 49 "type":"file",
50 "fileExtension":".pl", 50 "fileExtension":".pl",
51 "children":["defaultTemplate"] 51 "children":["defaultTemplate"]
52 }, 52 },
53 "files/py.txt":{ 53 "/js/io/templates/files/py.txt":{
54 "name":"Python", 54 "name":"Python",
55 "uri":"/js/io/templates/files/py.txt", 55 "uri":"/js/io/templates/files/py.txt",
56 "type":"file", 56 "type":"file",
57 "fileExtension":".py", 57 "fileExtension":".py",
58 "children":["defaultTemplate"] 58 "children":["defaultTemplate"]
59 }, 59 },
60 "files/rb.txt":{ 60 "/js/io/templates/files/rb.txt":{
61 "name":"Ruby", 61 "name":"Ruby",
62 "uri":"/js/io/templates/files/rb.txt", 62 "uri":"/js/io/templates/files/rb.txt",
63 "type":"file", 63 "type":"file",
diff --git a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js
index 7da13dfc..fae8f9c7 100755
--- a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js
+++ b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js
@@ -37,12 +37,12 @@ var NewFileLocation = exports.NewFileLocation = Montage.create(Component, {
37 37
38 this.fileInputField.selectDirectory = true; 38 this.fileInputField.selectDirectory = true;
39 39
40 this.newFileName.addEventListener("blur", function(evt){that.handleNewFileNameOnblur(evt);}, false); 40 this.newFileName.addEventListener("keyup", function(evt){that.handleNewFileNameOnkeyup(evt);}, false);
41 } 41 }
42 42
43 }, 43 },
44 44
45 handleNewFileNameOnblur:{ 45 handleNewFileNameOnkeyup:{
46 value:function(evt){ 46 value:function(evt){
47 if(this.newFileName.value !== ""){ 47 if(this.newFileName.value !== ""){
48 var newFileNameSetEvent = document.createEvent("Events"); 48 var newFileNameSetEvent = document.createEvent("Events");
diff --git a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js
index 2f148621..bcb9d123 100644
--- a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js
+++ b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js
@@ -217,8 +217,9 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C
217 if(/[^/\\]$/g.test(projectDirectory)){ 217 if(/[^/\\]$/g.test(projectDirectory)){
218 projectDirectory = projectDirectory + "/"; 218 projectDirectory = projectDirectory + "/";
219 } 219 }
220 if(!!fileExtension && (projectName.lastIndexOf(fileExtension) !== (projectName.length - fileExtension.length))){ 220
221 projectName = projectName+fileExtension; 221 if(!!fileExtension && ((projectName.lastIndexOf(fileExtension) === -1) || (projectName.lastIndexOf(fileExtension) !== (projectName.length - fileExtension.length)))){
222 projectName = projectName+fileExtension;//append file extension if file extension is already not present or is actually part of the file name
222 } 223 }
223 newFilePath = "" + projectDirectory + projectName; 224 newFilePath = "" + projectDirectory + projectName;
224 225
@@ -367,7 +368,7 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C
367 }, 368 },
368 isValidFileName:{ 369 isValidFileName:{
369 value: function(fileName){ 370 value: function(fileName){
370 var status = this.isValidFileName(fileName); 371 var status = this.validateFileName(fileName);
371 if(fileName !== ""){ 372 if(fileName !== ""){
372 if(!status){ 373 if(!status){
373 this.showError("! Invalid file name."); 374 this.showError("! Invalid file name.");
@@ -399,7 +400,7 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C
399 /*** 400 /***
400 * file name validation 401 * file name validation
401 */ 402 */
402 isValidFileName:{ 403 validateFileName:{
403 value: function(fileName){ 404 value: function(fileName){
404 var status = false; 405 var status = false;
405 if(fileName !== ""){ 406 if(fileName !== ""){
diff --git a/js/io/ui/new-file-dialog/new-file-workflow-controller.js b/js/io/ui/new-file-dialog/new-file-workflow-controller.js
index 16075ecf..6cf2a2ae 100755
--- a/js/io/ui/new-file-dialog/new-file-workflow-controller.js
+++ b/js/io/ui/new-file-dialog/new-file-workflow-controller.js
@@ -44,7 +44,7 @@ var NewFileWorkflowController = exports.NewFileWorkflowController = Montage.cre
44 this.model.projectTypeData = this.loadDescriptor("js/io/templates/descriptor.json"); 44 this.model.projectTypeData = this.loadDescriptor("js/io/templates/descriptor.json");
45 45
46 //get default project type 46 //get default project type
47 this.model.defaultProjectType = "files/html.txt"; 47 this.model.defaultProjectType = "/js/io/templates/files/html.txt";
48 this.model.callback = data.callback || null; 48 this.model.callback = data.callback || null;
49 this.model.callbackScope = data.callbackScope || null; 49 this.model.callbackScope = data.callbackScope || null;
50 50
diff --git a/js/io/ui/save-as-dialog.reel/save-as-dialog.js b/js/io/ui/save-as-dialog.reel/save-as-dialog.js
index d1f1c26b..4546e124 100644
--- a/js/io/ui/save-as-dialog.reel/save-as-dialog.js
+++ b/js/io/ui/save-as-dialog.reel/save-as-dialog.js
@@ -54,7 +54,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, {
54 this.newFileName.value = this.fileName; 54 this.newFileName.value = this.fileName;
55 this.fileInputField.newFileDirectory.value = this.folderUri; 55 this.fileInputField.newFileDirectory.value = this.folderUri;
56 56
57 this.newFileName.addEventListener("blur", function(evt){self.handleNewFileNameOnblur(evt);}, false); 57 this.newFileName.addEventListener("keyup", function(evt){self.handleNewFileNameOnkeyup(evt);}, false);
58 this.eventManager.addEventListener("newFileDirectorySet", function(evt){self.handleNewFileDirectorySet(evt);}, false); 58 this.eventManager.addEventListener("newFileDirectorySet", function(evt){self.handleNewFileDirectorySet(evt);}, false);
59 59
60 this.okButton.addEventListener("click", function(evt){self.handleOkButtonAction(evt);}, false); 60 this.okButton.addEventListener("click", function(evt){self.handleOkButtonAction(evt);}, false);
@@ -68,18 +68,18 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, {
68 value:function(evt){ 68 value:function(evt){
69 if(!!evt._event.newFileDirectory){ 69 if(!!evt._event.newFileDirectory){
70 this.folderUri = evt._event.newFileDirectory; 70 this.folderUri = evt._event.newFileDirectory;
71 if(this.folderUri !== ""){ 71