diff options
author | Pushkar Joshi | 2012-02-28 14:19:25 -0800 |
---|---|---|
committer | Pushkar Joshi | 2012-02-28 14:19:25 -0800 |
commit | 16d6a90579cdafede931a9c818689fad2e622d8b (patch) | |
tree | e87f5d4a131d3574ef06cff1c46373d5b1046956 /js/io/ui | |
parent | 03ca7a5ed13c25faaa9100bb666e062fd15335e6 (diff) | |
parent | 63307c9abf120985d979a40a53a0598d3f0d5c5a (diff) | |
download | ninja-16d6a90579cdafede931a9c818689fad2e622d8b.tar.gz |
Merge branch 'pentool' into brushtool
Diffstat (limited to 'js/io/ui')
8 files changed, 79 insertions, 105 deletions
diff --git a/js/io/ui/cloudpopup.reel/cloudpopup.js b/js/io/ui/cloudpopup.reel/cloudpopup.js index d2e82662..a4656bb5 100755 --- a/js/io/ui/cloudpopup.reel/cloudpopup.js +++ b/js/io/ui/cloudpopup.reel/cloudpopup.js | |||
@@ -63,8 +63,8 @@ exports.CloudPopup = Montage.create(Component, { | |||
63 | enumerable: false, | 63 | enumerable: false, |
64 | value: function() { | 64 | value: function() { |
65 | // | 65 | // |
66 | if (window.localStorage['ioRootUrl']) { | 66 | if (this.application.localStorage.getItem("ioRootUrl")) { |
67 | this.components.url.value = window.localStorage['ioRootUrl']; | 67 | this.components.url.value = this.application.localStorage.getItem("ioRootUrl"); |
68 | } | 68 | } |
69 | // | 69 | // |
70 | this.testConnection(); | 70 | this.testConnection(); |
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 235be8ad..651fd7fa 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 | |||
@@ -9,24 +9,13 @@ var Montage = require("montage/core/core").Montage, | |||
9 | 9 | ||
10 | var FileInputField = exports.FileInputField = Montage.create(Component, { | 10 | var FileInputField = exports.FileInputField = Montage.create(Component, { |
11 | 11 | ||
12 | hasReel: { | ||
13 | value: true | ||
14 | }, | ||
15 | |||
16 | willDraw: { | ||
17 | enumerable: false, | ||
18 | value: function() {} | ||
19 | }, | ||
20 | draw: { | ||
21 | enumerable: false, | ||
22 | value: function() {} | ||
23 | }, | ||
24 | didDraw: { | 12 | didDraw: { |
25 | enumerable: false, | 13 | enumerable: false, |
26 | value: function() { | 14 | value: function() { |
27 | var that = this; | 15 | var that = this; |
28 | this.findDirectory.identifier = "findDirectory"; | 16 | this.findDirectory.identifier = "findDirectory"; |
29 | this.findDirectory.addEventListener("click", function(evt){that.handleFindDirectoryClick(evt);}, false); | 17 | |
18 | this.findDirectory.addEventListener("click", this, false); | ||
30 | 19 | ||
31 | this.eventManager.addEventListener("pickerSelectionsDone", function(evt){that.handleFileInputPickerSelectionsDone(evt);}, false); | 20 | this.eventManager.addEventListener("pickerSelectionsDone", function(evt){that.handleFileInputPickerSelectionsDone(evt);}, false); |
32 | 21 | ||
@@ -60,8 +49,6 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { | |||
60 | 49 | ||
61 | handleFindDirectoryClick: { | 50 | handleFindDirectoryClick: { |
62 | value: function(evt){ | 51 | value: function(evt){ |
63 | var openFilePicker = document.createEvent("Events"); | ||
64 | openFilePicker.initEvent("openFilePicker", false, false); | ||
65 | var settings = {}; | 52 | var settings = {}; |
66 | if(this.selectDirectory === true){ | 53 | if(this.selectDirectory === true){ |
67 | settings.inFileMode = false; | 54 | settings.inFileMode = false; |
@@ -71,8 +58,8 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { | |||
71 | settings.pickerName = this.pickerName || "fileSelector"; | 58 | settings.pickerName = this.pickerName || "fileSelector"; |
72 | } | 59 | } |
73 | settings.callback = this.filePickerCallback.bind(this); | 60 | settings.callback = this.filePickerCallback.bind(this); |
74 | openFilePicker.settings = settings; | 61 | |
75 | this.eventManager.dispatchEvent(openFilePicker); | 62 | NJevent("openFilePicker", settings); |
76 | } | 63 | } |
77 | }, | 64 | }, |
78 | 65 | ||
diff --git a/js/io/ui/file-picker/file-picker-controller.js b/js/io/ui/file-picker/file-picker-controller.js index 129bebad..3b19de83 100755 --- a/js/io/ui/file-picker/file-picker-controller.js +++ b/js/io/ui/file-picker/file-picker-controller.js | |||
@@ -19,25 +19,21 @@ var FilePickerController = exports.FilePickerController = Montage.create(require | |||
19 | writable:false, | 19 | writable:false, |
20 | enumerable:true, | 20 | enumerable:true, |
21 | value:function(){ | 21 | value:function(){ |
22 | var that = this; | 22 | this.eventManager.addEventListener("openFilePicker", this, false); |
23 | |||
24 | this.eventManager.addEventListener("openFilePicker", function(evt){ | ||
25 | var settings; | ||
26 | if(typeof evt._event.settings !== "undefined"){ | ||
27 | settings = evt._event.settings; | ||
28 | } | ||
29 | that.showFilePicker(settings); | ||
30 | }, false); | ||
31 | |||
32 | } | 23 | } |
33 | }, | 24 | }, |
34 | 25 | ||
35 | filePickerPopupType:{ | 26 | filePickerPopupType:{ |
36 | writable: true, | ||
37 | enumerable: false, | 27 | enumerable: false, |
38 | value: "filePicker" | 28 | value: "filePicker" |
39 | }, | 29 | }, |
40 | 30 | ||
31 | handleOpenFilePicker: { | ||
32 | value: function(evt) { | ||
33 | this.showFilePicker(evt.detail); | ||
34 | } | ||
35 | }, | ||
36 | |||
41 | /** | 37 | /** |
42 | *this function is used to create an instance of a file picker | 38 | *this function is used to create an instance of a file picker |
43 | * | 39 | * |
@@ -129,7 +125,9 @@ var FilePickerController = exports.FilePickerController = Montage.create(require | |||
129 | } | 125 | } |
130 | 126 | ||
131 | if(!!storedUri){ | 127 | if(!!storedUri){ |
132 | aModel.currentRoot = unescape(storedUri); | 128 | // This is depracated -- use decodeURI instead |
129 | //aModel.currentRoot = unescape(storedUri); | ||
130 | aModel.currentRoot = decodeURI(storedUri); | ||
133 | } | 131 | } |
134 | 132 | ||
135 | if(!!allFileFilters){aModel.fileFilters = allFileFilters;} | 133 | if(!!allFileFilters){aModel.fileFilters = allFileFilters;} |
@@ -138,7 +136,6 @@ var FilePickerController = exports.FilePickerController = Montage.create(require | |||
138 | if(typeof pickerMode !== "undefined"){aModel.pickerMode = pickerMode;} | 136 | if(typeof pickerMode !== "undefined"){aModel.pickerMode = pickerMode;} |
139 | 137 | ||
140 | 138 | ||
141 | |||
142 | //logic: get file content data onDemand from the REST api for the default or last opened root. Cache the data in page [in local cache ? dirty fs? ]. Filter on client side to reduce network calls. | 139 | //logic: get file content data onDemand from the REST api for the default or last opened root. Cache the data in page [in local cache ? dirty fs? ]. Filter on client side to reduce network calls. |
143 | this.openFilePickerAsModal(callback, aModel); | 140 | this.openFilePickerAsModal(callback, aModel); |
144 | 141 | ||
@@ -152,15 +149,6 @@ var FilePickerController = exports.FilePickerController = Montage.create(require | |||
152 | writable:false, | 149 | writable:false, |
153 | enumerable:true, | 150 | enumerable:true, |
154 | value:function(callback, aModel){ | 151 | value:function(callback, aModel){ |
155 | //render modal dialog | ||
156 | var pickerNavContent = document.createElement("div"); | ||
157 | pickerNavContent.id = "filePicker"; | ||
158 | |||
159 | pickerNavContent.style.color = "#fff"; | ||
160 | |||
161 | //hack (elements needs to be on DOM to be drawn) | ||
162 | document.getElementById('modalContainer').appendChild(pickerNavContent); | ||
163 | |||
164 | var pickerNavChoices = Montage.create(pickerNavigatorReel); | 152 | var pickerNavChoices = Montage.create(pickerNavigatorReel); |
165 | var initUri = aModel.currentRoot; | 153 | var initUri = aModel.currentRoot; |
166 | 154 | ||
@@ -171,10 +159,6 @@ var FilePickerController = exports.FilePickerController = Montage.create(require | |||
171 | 159 | ||
172 | pickerNavChoices.mainContentData = this.prepareContentList(initUri, aModel); | 160 | pickerNavChoices.mainContentData = this.prepareContentList(initUri, aModel); |
173 | pickerNavChoices.pickerModel = aModel; | 161 | pickerNavChoices.pickerModel = aModel; |
174 | pickerNavChoices.element = pickerNavContent; | ||
175 | |||
176 | //hack - remove after rendering and add in modal dialog | ||
177 | document.getElementById('modalContainer').removeChild(pickerNavContent); | ||
178 | 162 | ||
179 | var popup = Popup.create(); | 163 | var popup = Popup.create(); |
180 | popup.content = pickerNavChoices; | 164 | popup.content = pickerNavChoices; |
diff --git a/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js index 411386f9..428e7bab 100644 --- a/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js +++ b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js | |||
@@ -214,6 +214,7 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { | |||
214 | 214 | ||
215 | this.element.addEventListener("openFolder", function(evt){that.handlePickerNavOpenFolder(evt);}, false);//add icon double click event listener to reload iconList with new set of data | 215 | this.element.addEventListener("openFolder", function(evt){that.handlePickerNavOpenFolder(evt);}, false);//add icon double click event listener to reload iconList with new set of data |
216 | this.element.addEventListener("selectedItem", function(evt){that.handlePickerNavSelectedItem(evt);}, false);//for single selection only | 216 | this.element.addEventListener("selectedItem", function(evt){that.handlePickerNavSelectedItem(evt);}, false);//for single selection only |
217 | this.element.addEventListener("selectFile", function(evt){that.handlePickerNavSelectedFile(evt);}, false);//for file selection | ||
217 | this.element.addEventListener("showMetadata", function(evt){that.handlePickerNavShowMetadata(evt);}, false);//show metadata on hover of icon | 218 | this.element.addEventListener("showMetadata", function(evt){that.handlePickerNavShowMetadata(evt);}, false);//show metadata on hover of icon |
218 | this.element.addEventListener("updateMetadata", function(evt){that.handlePickerNavUpdateMetadata(evt);}, false);//show metadata on click of icon | 219 | this.element.addEventListener("updateMetadata", function(evt){that.handlePickerNavUpdateMetadata(evt);}, false);//show metadata on click of icon |
219 | //this.addressGo.addEventListener("click", this, false); | 220 | //this.addressGo.addEventListener("click", this, false); |
@@ -669,14 +670,29 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { | |||
669 | } | 670 | } |
670 | }, | 671 | }, |
671 | 672 | ||
673 | handlePickerNavSelectedFile:{ | ||
674 | value: function(evt){ | ||
675 | var uri = evt.fileUri; |