From 3a754133dbc138390503341fd2e9beba3e43aa4b Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Fri, 27 Jan 2012 12:05:17 -0800 Subject: Merged old FileIO --- js/io/workflow/new-project-manager.js | 0 .../new-file-location.reel/new-file-location.css | 23 +- .../new-file-location.reel/new-file-location.html | 61 +++- .../new-file-location.reel/new-file-location.js | 30 +- .../new-file-options-navigator.css | 107 ++++-- .../new-file-options-navigator.html | 45 ++- .../new-file-options-navigator.js | 375 +++++++++++++++++---- .../newFileDialog/new-file-workflow-controller.js | 75 ++++- .../newFileDialog/new-file-workflow-model.js | 39 ++- js/io/workflow/newProjectNavigator.js | 0 .../newProjectNavigator.css | 0 .../newProjectNavigator.html | 0 .../save-as-dialog.reel/save-as-dialog.css | 60 ++++ .../save-as-dialog.reel/save-as-dialog.html | 84 +++++ .../workflow/save-as-dialog.reel/save-as-dialog.js | 126 +++++++ 15 files changed, 907 insertions(+), 118 deletions(-) mode change 100644 => 100755 js/io/workflow/new-project-manager.js mode change 100644 => 100755 js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.css mode change 100644 => 100755 js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.html mode change 100644 => 100755 js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.js mode change 100644 => 100755 js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.css mode change 100644 => 100755 js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.html mode change 100644 => 100755 js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.js mode change 100644 => 100755 js/io/workflow/newFileDialog/new-file-workflow-controller.js mode change 100644 => 100755 js/io/workflow/newFileDialog/new-file-workflow-model.js mode change 100644 => 100755 js/io/workflow/newProjectNavigator.js mode change 100644 => 100755 js/io/workflow/newProjectNavigator.reel/newProjectNavigator.css mode change 100644 => 100755 js/io/workflow/newProjectNavigator.reel/newProjectNavigator.html create mode 100755 js/io/workflow/save-as-dialog.reel/save-as-dialog.css create mode 100755 js/io/workflow/save-as-dialog.reel/save-as-dialog.html create mode 100755 js/io/workflow/save-as-dialog.reel/save-as-dialog.js (limited to 'js/io/workflow') diff --git a/js/io/workflow/new-project-manager.js b/js/io/workflow/new-project-manager.js old mode 100644 new mode 100755 diff --git a/js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.css b/js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.css old mode 100644 new mode 100755 index 1e857874..7f11c225 --- a/js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.css +++ b/js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.css @@ -38,13 +38,22 @@ padding-bottom: 5px; } -.newfileLocation .locationSelection span{ - padding-right: 5px; +.newfileLocation .locationSelection input{ + margin-left: 5px; white-space: nowrap; } -.newfileLocation .findDirectory{ - width: 17px; - height:17px; - vertical-align: bottom; -} \ No newline at end of file +.newfileLocation .templatePx{ + padding-left: 5px; + white-space: nowrap; +} + +.newfileLocation .nameText{ + margin-right:31px; +} + +.newfileLocation .hottextunit{ + float: none; + display: inline; +} + diff --git a/js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.html b/js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.html old mode 100644 new mode 100755 index 1be4e485..7c271511 --- a/js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.html +++ b/js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.html @@ -10,12 +10,61 @@ + + +
+
Save As
+
+
+ Save As : + +
+
+ Location : +
+
+
+
+
+ + +
+ +
+ + \ No newline at end of file diff --git a/js/io/workflow/save-as-dialog.reel/save-as-dialog.js b/js/io/workflow/save-as-dialog.reel/save-as-dialog.js new file mode 100755 index 00000000..1255a1bd --- /dev/null +++ b/js/io/workflow/save-as-dialog.reel/save-as-dialog.js @@ -0,0 +1,126 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component; + +var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { + + hasReel: { + value: true + }, + + fileName : { + enumerable: true, + writable: true, + value: "" + }, + + callback : { + enumerable: true, + writable: true, + value: null + }, + + callbackScope : { + enumerable: true, + writable: true, + value: null + }, + + willDraw: { + enumerable: false, + value: function() {} + }, + draw: { + enumerable: false, + value: function() {} + }, + didDraw: { + enumerable: false, + value: function() { + this.fileInputField.selectDirectory = true; + this.fileInputField.pickerName = "saveAsDirectoryPicker"; + this.newFileName.value = this.fileName; + this.fileInputField.newFileDirectory.value = this.folderUri; + } + }, + + handleCancelButtonAction :{ + value:function(evt){ + //clean up memory + //this.cleanup(); + + if(this.popup){ + this.popup.hide(); + } + + } + }, + + handleOkButtonAction:{ + value: function(evt){ + var filename = this.fileName, + newFileDirectory = this.newFileDirectory, + success = true; + try{ + //validate file name and folder path + //check if file already exists + if(!!this.callback && !!this.callbackScope){//inform document-controller if save successful + this.callback.call(this.callbackScope, {"filename":filename, "destination": newFileDirectory});//document-controller api + }else{ + //send save as event + var saveAsEvent = document.createEvent("Events"); + saveAsEvent.initEvent("saveAsFile", false, false); + saveAsEvent.saveAsOptions = {"filename":filename, "destination": newFileDirectory}; + this.eventManager.dispatchEvent(saveAsEvent); + } + }catch(e){ + success = false; + console.log("[ERROR] Failed to save: "+ this.fileName + " at "+ this.newFileDirectory); + } + + if(success){ + //clean up memory + //this.cleanup(); + + if(this.popup){ + this.popup.hide(); + } + } + } + }, + + isValidUri:{ + value: function(uri){ + var isWindowsUri=false, isUnixUri=false,status=false; + if(uri !== ""){ + uri = uri.replace(/^\s+|\s+$/g,""); // strip any leading or trailing spaces + + //for local machine folder uri + isWindowsUri = /^([a-zA-Z]:)(\\[^<>:"/\\|?*]+)*\\?$/gi.test(uri); + isUnixUri = /^(\/)?(\/(?![.])[^/]*)*\/?$/gi.test(uri);//folders beginning with . are hidden on Mac / Unix + status = isWindowsUri || isUnixUri; + if(isWindowsUri && isUnixUri){status = false;} + } + return status; + } + }, + isValidFileName:{ + value: function(fileName){ + var status = false; + if(fileName !== ""){ + fileName = fileName.replace(/^\s+|\s+$/g,""); + status = !(/[/\\]/g.test(fileName)); + if(status && navigator.userAgent.indexOf("Macintosh") != -1){//for Mac files beginning with . are hidden + status = !(/^\./g.test(fileName)); + } + } + return status; + } + } + +}); \ No newline at end of file -- cgit v1.2.3