From adb90eff3323aa780f9a0879572e3cf3b9f0b969 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 21 Feb 2012 13:04:58 -0800 Subject: - file picker - select file on double click - check cloud availability before IO operations [open file, new file, Save, Save As]. Canceling operation if cloud was unavailable, as per team's agreement. Signed-off-by: Ananya Sen --- js/io/ui/new-file-dialog/new-file-workflow-controller.js | 7 ------- 1 file changed, 7 deletions(-) (limited to 'js/io/ui/new-file-dialog') 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 7b7f4572..f34ee000 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 @@ -19,12 +19,6 @@ var NewFileWorkflowController = exports.NewFileWorkflowController = Montage.cre writable:false, enumerable:true, value:function(){ - var that = this; - - this.eventManager.addEventListener("saveAs", function(evt){ - var data = evt._event.data || {};//data will contain the current file name, directory location and callback - that.showSaveAsDialog(data); - }, false); } }, @@ -99,7 +93,6 @@ var NewFileWorkflowController = exports.NewFileWorkflowController = Montage.cre saveAsDialog.fileName = fileName; saveAsDialog.folderUri = folderUri; saveAsDialog.callback = data.callback; - saveAsDialog.callbackScope = data.callbackScope; saveAsDialog.element = saveAsDialogContainer; //remove after rendering and add in modal dialog -- cgit v1.2.3 From f86577d5083aeed2de7a932fe4147e9002e91554 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 21 Feb 2012 21:11:54 -0800 Subject: cleanup - Removing temporary div to render the popups We don't need to render the popup before opening them. Removing that hack. Signed-off-by: Valerio Virgillito --- js/io/ui/new-file-dialog/new-file-workflow-controller.js | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'js/io/ui/new-file-dialog') 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 7b7f4572..c2be687a 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 @@ -29,7 +29,6 @@ var NewFileWorkflowController = exports.NewFileWorkflowController = Montage.cre }, model:{ - writable: true, enumerable:true, value: null }, @@ -56,19 +55,8 @@ var NewFileWorkflowController = exports.NewFileWorkflowController = Montage.cre this.model.defaultProjectType = lastSelectedProjectType; } - //render modal dialog - var newFileNavContent = document.createElement("div"); - newFileNavContent.id = "newFileDialog"; - - //elements needs to be on DOM to be drawn - document.getElementById('modalContainer').appendChild(newFileNavContent); - var newFileOptionsNav = newFileOptionsNavigatorModule.NewFileOptionsNavigator.create(); newFileOptionsNav.newFileModel = this.model; - newFileOptionsNav.element = newFileNavContent; - - //remove after rendering and add in modal dialog - document.getElementById('modalContainer').removeChild(newFileNavContent); var popup = Popup.create(); popup.content = newFileOptionsNav; -- cgit v1.2.3 From a8f5dcd8e85af6600f2e2b6a4536f05fd0c9916d Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 21 Feb 2012 22:37:36 -0800 Subject: Adding the default folder by default when opening a new file dialog. Adding the default folder name in the new file dialog input field. Also some more cleanup. Signed-off-by: Valerio Virgillito --- .../new-file-location.reel/new-file-location.js | 57 +++++++++++++--------- 1 file changed, 33 insertions(+), 24 deletions(-) (limited to 'js/io/ui/new-file-dialog') 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..ee2847ca 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,55 @@ var newFileWorkflowControllerModule = require("js/io/ui/new-file-dialog/new-file var NewFileLocation = exports.NewFileLocation = Montage.create(Component, { templateHeight:{ - enumerable: true, value:"25 px" }, templateWidth:{ - enumerable: true, value:"25 px" }, - willDraw: { - enumerable: false, - value: function() {} - }, + prepareForDraw: { + value: function() { + // Populate the file input field by using the session storage or the default user folder + var defaultSaveDirectory; + + if(window.sessionStorage) { + var storedFolder = window.sessionStorage.getItem("lastOpenedFolderURI_folderSelection"); + if(storedFolder) defaultSaveDirectory = decodeURI(window.sessionStorage.getItem("lastOpenedFolderURI_folderSelection")); + } + + if(!defaultSaveDirectory) { + var driveData = this.application.ninja.coreIoApi.getDirectoryContents({uri:"", recursive:false, returnType:"all"}); + if(driveData.success){ + var topLevelDirectories = (JSON.parse(driveData.content)).children; + defaultSaveDirectory = topLevelDirectories[0].uri; + } else { + console.log("** Error ** Cannot get directory listing"); + defaultSaveDirectory = ""; + } + } - draw: { - enumerable: false, - value: function() {} + this.fileInputField.newFileDirectory.value = defaultSaveDirectory; + } }, didDraw: { - enumerable: false, value: function() { - var that=this; - this.fileInputField.selectDirectory = true; - this.newFileName.addEventListener("keyup", function(evt){that.handleNewFileNameOnkeyup(evt);}, false); - } - + this.newFileName.addEventListener("keyup", this, false); + } }, - handleNewFileNameOnkeyup:{ - value:function(evt){ - if(this.newFileName.value !== ""){ - var newFileNameSetEvent = document.createEvent("Events"); - newFileNameSetEvent.initEvent("newFileNameSet", false, false); - newFileNameSetEvent.newFileName = this.newFileName.value; - this.eventManager.dispatchEvent(newFileNameSetEvent); - } - } + handleKeyup:{ + value:function(evt){ + if(this.newFileName.value !== "") { + var newFileNameSetEvent = document.createEvent("Events"); + newFileNameSetEvent.initEvent("newFileNameSet", false, false); + newFileNameSetEvent.newFileName = this.newFileName.value; + this.eventManager.dispatchEvent(newFileNameSetEvent); + } + } } }); \ No newline at end of file -- cgit v1.2.3 From 69983b800d0179fcccd5b61b64ed22c02e22b93a Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 21 Feb 2012 22:43:45 -0800 Subject: Adding some comments. Signed-off-by: Valerio Virgillito --- js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'js/io/ui/new-file-dialog') 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 ee2847ca..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 @@ -18,16 +18,18 @@ var NewFileLocation = exports.NewFileLocation = Montage.create(Component, { value:"25 px" }, + // Populating the directory input field with the default save location or the last stored location. prepareForDraw: { value: function() { - // Populate the file input field by using the session storage or the default user folder var defaultSaveDirectory; + // Using session storage location if(window.sessionStorage) { var storedFolder = window.sessionStorage.getItem("lastOpenedFolderURI_folderSelection"); if(storedFolder) defaultSaveDirectory = decodeURI(window.sessionStorage.getItem("lastOpenedFolderURI_folderSelection")); } + // Use default if none found in session storage if(!defaultSaveDirectory) { var driveData = this.application.ninja.coreIoApi.getDirectoryContents({uri:"", recursive:false, returnType:"all"}); if(driveData.success){ @@ -39,6 +41,7 @@ var NewFileLocation = exports.NewFileLocation = Montage.create(Component, { } } + // Set the input field to the correct directory this.fileInputField.newFileDirectory.value = defaultSaveDirectory; } }, -- cgit v1.2.3 From 91f6f672ee96c6e7e942b555af7057d6db52d90f Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 22 Feb 2012 11:50:25 -0800 Subject: moving the default folder location to the navigator to fix the ok button issue Signed-off-by: Valerio Virgillito --- .../new-file-location.reel/new-file-location.js | 28 ----------------- .../new-file-options-navigator.js | 36 +++++++++++++++++----- 2 files changed, 29 insertions(+), 35 deletions(-) (limited to 'js/io/ui/new-file-dialog') 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 849c665c..0e1e09a4 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 @@ -18,34 +18,6 @@ var NewFileLocation = exports.NewFileLocation = Montage.create(Component, { value:"25 px" }, - // Populating the directory input field with the default save location or the last stored location. - prepareForDraw: { - value: function() { - var defaultSaveDirectory; - - // Using session storage location - if(window.sessionStorage) { - var storedFolder = window.sessionStorage.getItem("lastOpenedFolderURI_folderSelection"); - if(storedFolder) defaultSaveDirectory = decodeURI(window.sessionStorage.getItem("lastOpenedFolderURI_folderSelection")); - } - - // Use default if none found in session storage - if(!defaultSaveDirectory) { - var driveData = this.application.ninja.coreIoApi.getDirectoryContents({uri:"", recursive:false, returnType:"all"}); - if(driveData.success){ - var topLevelDirectories = (JSON.parse(driveData.content)).children; - defaultSaveDirectory = topLevelDirectories[0].uri; - } else { - console.log("** Error ** Cannot get directory listing"); - defaultSaveDirectory = ""; - } - } - - // Set the input field to the correct directory - this.fileInputField.newFileDirectory.value = defaultSaveDirectory; - } - }, - didDraw: { value: function() { this.fileInputField.selectDirectory = true; 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 11b322fe..aaf39005 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 @@ -47,14 +47,36 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C enumerable:false, value:"0 px" }, - willDraw: { - enumerable: false, - value: function() {} - }, - draw: { - enumerable: false, - value: function() {} + + // Populating the directory input field with the default save location or the last stored location. + prepareForDraw: { + value: function() { + var defaultSaveDirectory; + + // Using session storage location + if(window.sessionStorage) { + var storedFolder = window.sessionStorage.getItem("lastOpenedFolderURI_folderSelection"); + if(storedFolder) defaultSaveDirectory = decodeURI(window.sessionStorage.getItem("lastOpenedFolderURI_folderSelection")); + } + + // Use default if none found in session storage + if(!defaultSaveDirectory) { + var driveData = this.application.ninja.coreIoApi.getDirectoryContents({uri:"", recursive:false, returnType:"all"}); + if(driveData.success){ + var topLevelDirectories = (JSON.parse(driveData.content)).children; + defaultSaveDirectory = topLevelDirectories[0].uri; + } else { + console.log("** Error ** Cannot get directory listing"); + defaultSaveDirectory = ""; + } + } + + // Set the input field to the correct directory + this.newFileLocation.fileInputField.newFileDirectory.value = defaultSaveDirectory; + this.newFileDirectory = defaultSaveDirectory; + } }, + didDraw: { enumerable: false, value: function() { -- cgit v1.2.3