aboutsummaryrefslogtreecommitdiff
path: root/js/io
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-04-16 16:06:24 -0700
committerNivesh Rajbhandari2012-04-16 16:06:24 -0700
commitc253192a08b499ea7be46fa5438d273e51f7ec5a (patch)
tree18a1f0e3679c0eb993a9dedb537035d3861f49ac /js/io
parente19376c54eedd1f1c457ba405b2f110be376a559 (diff)
parent4b900ea5cd6bb77eb30cec8c03b9ec9fa662c1e9 (diff)
downloadninja-c253192a08b499ea7be46fa5438d273e51f7ec5a.tar.gz
Merge branch 'refs/heads/ninja-internal' into WebGLFixes
Diffstat (limited to 'js/io')
-rwxr-xr-xjs/io/system/coreioapi.js10
-rw-r--r--js/io/system/ninjalibrary.json4
-rwxr-xr-xjs/io/ui/file-picker/file-input-field.reel/file-input-field.html10
-rwxr-xr-xjs/io/ui/file-picker/file-input-field.reel/file-input-field.js38
-rwxr-xr-xjs/io/ui/file-picker/file-picker-controller.js9
-rw-r--r--js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js13
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-location.reel/new-file-location.html9
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js31
-rw-r--r--js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js118
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-workflow-controller.js25
-rw-r--r--js/io/ui/save-as-dialog.reel/save-as-dialog.html9
-rw-r--r--js/io/ui/save-as-dialog.reel/save-as-dialog.js111
12 files changed, 275 insertions, 112 deletions
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js
index f428a229..a06f45c6 100755
--- a/js/io/system/coreioapi.js
+++ b/js/io/system/coreioapi.js
@@ -217,7 +217,7 @@ exports.CoreIoApi = Montage.create(Component, {
217 value: function(serviceURL, path) { 217 value: function(serviceURL, path) {
218 var urlOut = path.replace(/\\/g,"/"); 218 var urlOut = path.replace(/\\/g,"/");
219 urlOut = urlOut.replace(/:/g,""); 219 urlOut = urlOut.replace(/:/g,"");
220 urlOut = encodeURI(urlOut); 220 urlOut = encodeURIComponent(urlOut);
221 //add leading / if not already there 221 //add leading / if not already there
222 if((urlOut.length > 0) && (urlOut.charAt(0) !== "/")){ 222 if((urlOut.length > 0) && (urlOut.charAt(0) !== "/")){
223 urlOut = "/" + urlOut; 223 urlOut = "/" + urlOut;
@@ -393,12 +393,12 @@ exports.CoreIoApi = Montage.create(Component, {
393 xhr = new XMLHttpRequest(); 393 xhr = new XMLHttpRequest();
394 // 394 //
395 xhr.open("POST", serviceURL, false); 395 xhr.open("POST", serviceURL, false);
396 xhr.responseType = "arraybuffer"; 396 //xhr.responseType = "arraybuffer";
397 if(file.contentType && file.contentType.length) 397 if(file.contentType && file.contentType.length)
398 xhr.setRequestHeader("Content-Type", file.contentType); 398 xhr.setRequestHeader("Content-Type", file.contentType);
399 else 399 else
400 xhr.setRequestHeader("Content-Type", "text/plain"); 400 xhr.setRequestHeader("Content-Type", "text/plain");
401 401
402 if (file.contents) 402 if (file.contents)
403 xhr.send(file.contents); 403 xhr.send(file.contents);
404 else 404 else
@@ -1085,14 +1085,14 @@ exports.CoreIoApi = Montage.create(Component, {
1085 isValidUri:{ 1085 isValidUri:{
1086 value: function(uri){ 1086 value: function(uri){
1087 var isWindowsUri=false, isUnixUri=false,status=false; 1087 var isWindowsUri=false, isUnixUri=false,status=false;
1088 if(uri !== ""){ 1088 if((uri !== null) && (uri !== "")){
1089 uri = uri.replace(/^\s+|\s+$/g,""); // strip any leading or trailing spaces 1089 uri = uri.replace(/^\s+|\s+$/g,""); // strip any leading or trailing spaces
1090 1090
1091 //for local machine folder uri 1091 //for local machine folder uri
1092 isWindowsUri = /^([a-zA-Z]:)([\\/][^<>:"/\\|?*]+)*[\\/]?$/gi.test(uri); 1092 isWindowsUri = /^([a-zA-Z]:)([\\/][^<>:"/\\|?*]+)*[\\/]?$/gi.test(uri);
1093 isUnixUri = /^(\/)?(\/(?![.])[^/]*)*\/?$/gi.test(uri);//folders beginning with . are hidden on Mac / Unix 1093 isUnixUri = /^(\/)?(\/(?![.])[^/]*)*\/?$/gi.test(uri);//folders beginning with . are hidden on Mac / Unix
1094 status = isWindowsUri || isUnixUri; 1094 status = isWindowsUri || isUnixUri;
1095 if(isWindowsUri && isUnixUri){status = false;} 1095 if((uri === "") || (isWindowsUri && isUnixUri)){status = false;}
1096 } 1096 }
1097 return status; 1097 return status;
1098 } 1098 }
diff --git a/js/io/system/ninjalibrary.json b/js/io/system/ninjalibrary.json
index 00ee7ed2..285444b5 100644
--- a/js/io/system/ninjalibrary.json
+++ b/js/io/system/ninjalibrary.json
@@ -1,6 +1,6 @@
1{ 1{
2 "libraries": [ 2 "libraries": [
3 {"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.6.0.0"}, 3 {"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.7.0.0"},
4 {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.1.0"} 4 {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.4.0"}
5 ] 5 ]
6} \ No newline at end of file 6} \ No newline at end of file
diff --git a/js/io/ui/file-picker/file-input-field.reel/file-input-field.html b/js/io/ui/file-picker/file-input-field.reel/file-input-field.html
index 2fcaa075..00df1c11 100755
--- a/js/io/ui/file-picker/file-input-field.reel/file-input-field.html
+++ b/js/io/ui/file-picker/file-input-field.reel/file-input-field.html
@@ -10,13 +10,21 @@
10 <link rel="stylesheet" type="text/css" href="file-input-field.css"> 10 <link rel="stylesheet" type="text/css" href="file-input-field.css">
11 <script type="text/montage-serialization"> 11 <script type="text/montage-serialization">
12 { 12 {
13
14 "newFileDirectory": {
15 "prototype": "montage/ui/textfield.reel",
16 "properties": {
17 "element": {"#": "newFileDirectory"}
18 }
19 },
20
13 "owner":{ 21 "owner":{
14 "module": "js/io/ui/file-picker/file-input-field.reel", 22 "module": "js/io/ui/file-picker/file-input-field.reel",
15 "name": "FileInputField", 23 "name": "FileInputField",
16 "properties": { 24 "properties": {
17 "element": {"#": "fileInputField"}, 25 "element": {"#": "fileInputField"},
18 "findDirectory": {"#": "findDirectory"}, 26 "findDirectory": {"#": "findDirectory"},
19 "newFileDirectory": {"#": "newFileDirectory"} 27 "newFileDirectory": {"@": "newFileDirectory"}
20 } 28 }
21 } 29 }
22 } 30 }
diff --git a/js/io/ui/file-picker/file-input-field.reel/file-input-field.js b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js
index 651fd7fa..9e77759f 100755
--- a/js/io/ui/file-picker/file-input-field.reel/file-input-field.js
+++ b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js
@@ -14,12 +14,10 @@ var FileInputField = exports.FileInputField = Montage.create(Component, {
14 value: function() { 14 value: function() {
15 var that = this; 15 var that = this;
16 this.findDirectory.identifier = "findDirectory"; 16 this.findDirectory.identifier = "findDirectory";
17
18 this.findDirectory.addEventListener("click", this, false); 17 this.findDirectory.addEventListener("click", this, false);
19 18 this.eventManager.addEventListener("pickerSelectionsDone", this.handleFileInputPickerSelectionsDone, false);
20 this.eventManager.addEventListener("pickerSelectionsDone", function(evt){that.handleFileInputPickerSelectionsDone(evt);}, false); 19 this.addEventListener("change@newFileDirectory.value", this.handleNewFileDirectoryChange, false);
21 20 this.newFileDirectory.element.addEventListener("keyup", this, false);
22 this.newFileDirectory.addEventListener("keyup", function(evt){that.handleNewFileDirectoryOnkeyup(evt);}, false);
23 } 21 }
24 }, 22 },
25 23
@@ -63,17 +61,31 @@ var FileInputField = exports.FileInputField = Montage.create(Component, {
63 } 61 }
64 }, 62 },
65 63
66 handleNewFileDirectoryOnkeyup:{ 64 handleNewFileDirectoryChange:{
67 value:function(evt){ 65 value:function(evt){
68 if(this.newFileDirectory.value !== ""){ 66 var newFileDirectorySetEvent = document.createEvent("Events");
69 var newFileDirectorySetEvent = document.createEvent("Events"); 67 newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false);
70 newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); 68 newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value;
71 newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; 69 newFileDirectorySetEvent.keyCode = evt.keyCode;
72 this.eventManager.dispatchEvent(newFileDirectorySetEvent); 70 this.eventManager.dispatchEvent(newFileDirectorySetEvent);
73 }
74 } 71 }
75 }, 72 },
76 73
74
75 handleKeyup:{
76 value: function(evt){
77 if(evt.keyCode === 13){
78 var enterKeyupEvent = document.createEvent("Events");
79 enterKeyupEvent.initEvent("enterKey", false, false);
80 this.eventManager.dispatchEvent(enterKeyupEvent);
81 }else if(evt.keyCode === 27){
82 var escKeyupEvent = document.createEvent("Events");
83 escKeyupEvent.initEvent("escKey", false, false);
84 this.eventManager.dispatchEvent(escKeyupEvent);
85 }
86 }
87 },
88
77 handleFileInputPickerSelectionsDone:{ 89 handleFileInputPickerSelectionsDone:{
78 value: function(evt){ 90 value: function(evt){
79 var selectedUri = ""; 91 var selectedUri = "";
@@ -95,7 +107,7 @@ var FileInputField = exports.FileInputField = Montage.create(Component, {
95 if(!!obj && obj.uri && obj.uri.length > 0){ 107 if(!!obj && obj.uri && obj.uri.length > 0){
96 selectedUri = obj.uri[0]; 108 selectedUri = obj.uri[0];
97 this.newFileDirectory.value = selectedUri; 109 this.newFileDirectory.value = selectedUri;
98 110 this.newFileDirectory.element.focus();
99 var newFileDirectorySetEvent = document.createEvent("Events"); 111 var newFileDirectorySetEvent = document.createEvent("Events");
100 newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); 112 newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false);
101 newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; 113 newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value;
diff --git a/js/io/ui/file-picker/file-picker-controller.js b/js/io/ui/file-picker/file-picker-controller.js
index 105dc223..436a50f3 100755
--- a/js/io/ui/file-picker/file-picker-controller.js
+++ b/js/io/ui/file-picker/file-picker-controller.js
@@ -23,6 +23,11 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
23 } 23 }
24 }, 24 },
25 25
26 pickerNavChoices:{
27 enumerable: true,
28 value: null
29 },
30
26 filePickerPopupType:{ 31 filePickerPopupType:{
27 enumerable: false, 32 enumerable: false,
28 value: "filePicker" 33 value: "filePicker"
@@ -125,8 +130,6 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
125 }