aboutsummaryrefslogtreecommitdiff
path: root/js/io/ui/new-file-dialog
diff options
context:
space:
mode:
authorAnanya Sen2012-02-22 12:18:25 -0800
committerAnanya Sen2012-02-22 12:18:25 -0800
commitdbf0ca5637a3bca87c21c65ada47f8a4d794f78c (patch)
treeace2a2415ef14662c27cdb2528914bef0a7f9208 /js/io/ui/new-file-dialog
parent9aa442da1ac9fd3212b37fa63a36090af47b6808 (diff)
parent27589634d3e8ea52abe8623f8f2cc48ce0aa04c9 (diff)
downloadninja-dbf0ca5637a3bca87c21c65ada47f8a4d794f78c.tar.gz
Merge branch 'refs/heads/FileIO-jose' into FileIO
Conflicts: js/controllers/document-controller.js Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/io/ui/new-file-dialog')
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js60
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-workflow-controller.js12
2 files changed, 36 insertions, 36 deletions
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 fae8f9c7..849c665c 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
@@ -11,46 +11,58 @@ var newFileWorkflowControllerModule = require("js/io/ui/new-file-dialog/new-file
11var NewFileLocation = exports.NewFileLocation = Montage.create(Component, { 11var NewFileLocation = exports.NewFileLocation = Montage.create(Component, {
12 12
13 templateHeight:{ 13 templateHeight:{
14 enumerable: true,
15 value:"25 px" 14 value:"25 px"
16 }, 15 },
17 16
18 templateWidth:{ 17 templateWidth:{
19 enumerable: true,
20 value:"25 px" 18 value:"25 px"
21 }, 19 },
22 20
23 willDraw: { 21 // Populating the directory input field with the default save location or the last stored location.
24 enumerable: false, 22 prepareForDraw: {
25 value: function() {} 23 value: function() {
26 }, 24 var defaultSaveDirectory;
25
26 // Using session storage location
27 if(window.sessionStorage) {
28 var storedFolder = window.sessionStorage.getItem("lastOpenedFolderURI_folderSelection");
29 if(storedFolder) defaultSaveDirectory = decodeURI(window.sessionStorage.getItem("lastOpenedFolderURI_folderSelection"));
30 }
31
32 // Use default if none found in session storage
33 if(!defaultSaveDirectory) {
34 var driveData = this.application.ninja.coreIoApi.getDirectoryContents({uri:"", recursive:false, returnType:"all"});
35 if(driveData.success){
36 var topLevelDirectories = (JSON.parse(driveData.content)).children;
37 defaultSaveDirectory = topLevelDirectories[0].uri;
38 } else {
39 console.log("** Error ** Cannot get directory listing");
40 defaultSaveDirectory = "";
41 }
42 }
27 43
28 draw: { 44 // Set the input field to the correct directory
29 enumerable: false, 45 this.fileInputField.newFileDirectory.value = defaultSaveDirectory;
30 value: function() {} 46 }
31 }, 47 },
32 48
33 didDraw: { 49 didDraw: {
34 enumerable: false,
35 value: function() { 50 value: function() {
36 var that=this;
37
38 this.fileInputField.selectDirectory = true; 51 this.fileInputField.selectDirectory = true;
39 52
40 this.newFileName.addEventListener("keyup", function(evt){that.handleNewFileNameOnkeyup(evt);}, false); 53 this.newFileName.addEventListener("keyup", this, false);
41 } 54 }
42
43 }, 55 },
44 56
45 handleNewFileNameOnkeyup:{ 57 handleKeyup:{
46 value:function(evt){ 58 value:function(evt){
47 if(this.newFileName.value !== ""){ 59 if(this.newFileName.value !== "") {
48 var newFileNameSetEvent = document.createEvent("Events"); 60 var newFileNameSetEvent = document.createEvent("Events");
49 newFileNameSetEvent.initEvent("newFileNameSet", false, false); 61 newFileNameSetEvent.initEvent("newFileNameSet", false, false);
50 newFileNameSetEvent.newFileName = this.newFileName.value; 62 newFileNameSetEvent.newFileName = this.newFileName.value;
51 this.eventManager.dispatchEvent(newFileNameSetEvent); 63 this.eventManager.dispatchEvent(newFileNameSetEvent);
52 } 64 }
53 } 65 }
54 } 66 }
55 67
56}); \ No newline at end of file 68}); \ No newline at end of file
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 f34ee000..901b61c7 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
@@ -23,7 +23,6 @@ var NewFileWorkflowController = exports.NewFileWorkflowController = Montage.cre
23 }, 23 },
24 24
25 model:{ 25 model:{
26 writable: true,
27 enumerable:true, 26 enumerable:true,
28 value: null 27 value: null
29 }, 28 },
@@ -50,19 +49,8 @@ var NewFileWorkflowController = exports.NewFileWorkflowController = Montage.cre
50 this.model.defaultProjectType = lastSelectedProjectType; 49 this.model.defaultProjectType = lastSelectedProjectType;
51 } 50 }
52 51
53 //render modal dialog
54 var newFileNavContent = document.createElement("div");
55 newFileNavContent.id = "newFileDialog";
56
57 //elements needs to be on DOM to be drawn
58 document.getElementById('modalContainer').appendChild(newFileNavContent);
59
60 var newFileOptionsNav = newFileOptionsNavigatorModule.NewFileOptionsNavigator.create(); 52 var newFileOptionsNav = newFileOptionsNavigatorModule.NewFileOptionsNavigator.create();
61 newFileOptionsNav.newFileModel = this.model; 53 newFileOptionsNav.newFileModel = this.model;
62 newFileOptionsNav.element = newFileNavContent;
63
64 //remove after rendering and add in modal dialog
65 document.getElementById('modalContainer').removeChild(newFileNavContent);
66 54
67 var popup = Popup.create(); 55 var popup = Popup.create();
68 popup.content = newFileOptionsNav; 56 popup.content = newFileOptionsNav;