aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjs/components/ui/icon-list-basic/icon.reel/icon.js5
-rwxr-xr-xjs/components/ui/tree-basic/treeItem.reel/treeItem.js5
-rwxr-xr-xjs/controllers/document-controller.js33
-rwxr-xr-xjs/data/menu-data.js2
-rw-r--r--js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js26
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-workflow-controller.js7
-rw-r--r--js/io/ui/save-as-dialog.reel/save-as-dialog.js4
7 files changed, 58 insertions, 24 deletions
diff --git a/js/components/ui/icon-list-basic/icon.reel/icon.js b/js/components/ui/icon-list-basic/icon.reel/icon.js
index b0279207..72adbfa1 100755
--- a/js/components/ui/icon-list-basic/icon.reel/icon.js
+++ b/js/components/ui/icon-list-basic/icon.reel/icon.js
@@ -131,6 +131,11 @@ var Icon = exports.Icon = Montage.create(Component, {
131 openFolderEvent.initEvent("openFolder", false, false); 131 openFolderEvent.initEvent("openFolder", false, false);
132 openFolderEvent.folderUri = this.icondata.uri; 132 openFolderEvent.folderUri = this.icondata.uri;
133 this.element.dispatchEvent(openFolderEvent); 133 this.element.dispatchEvent(openFolderEvent);
134 }else{
135 var openFolderEvent = document.createEvent("Events");
136 openFolderEvent.initEvent("selectFile", false, false);
137 openFolderEvent.fileUri = this.icondata.uri;
138 this.element.dispatchEvent(openFolderEvent);
134 } 139 }
135 if(evt.bubbles){ 140 if(evt.bubbles){
136 evt.stopPropagation(); 141 evt.stopPropagation();
diff --git a/js/components/ui/tree-basic/treeItem.reel/treeItem.js b/js/components/ui/tree-basic/treeItem.reel/treeItem.js
index 755eab8c..4c71cb6b 100755
--- a/js/components/ui/tree-basic/treeItem.reel/treeItem.js
+++ b/js/components/ui/tree-basic/treeItem.reel/treeItem.js
@@ -225,6 +225,11 @@ exports.TreeItem = Montage.create(Component, {
225 openFolderEvent.initEvent("openFolder", false, false); 225 openFolderEvent.initEvent("openFolder", false, false);
226 openFolderEvent.folderUri = this.treeItemData.uri; 226 openFolderEvent.folderUri = this.treeItemData.uri;
227 this.element.dispatchEvent(openFolderEvent); 227 this.element.dispatchEvent(openFolderEvent);
228 }else{
229 var openFolderEvent = document.createEvent("Events");
230 openFolderEvent.initEvent("selectFile", false, false);
231 openFolderEvent.fileUri = this.treeItemData.uri;
232 this.element.dispatchEvent(openFolderEvent);
228 } 233 }
229 if(evt.bubbles){ 234 if(evt.bubbles){
230 evt.stopPropagation(); 235 evt.stopPropagation();
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 9a063280..505daaba 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -58,6 +58,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
58 this.eventManager.addEventListener("executeFileOpen", this, false); 58 this.eventManager.addEventListener("executeFileOpen", this, false);
59 this.eventManager.addEventListener("executeNewFile", this, false); 59 this.eventManager.addEventListener("executeNewFile", this, false);
60 this.eventManager.addEventListener("executeSave", this, false); 60 this.eventManager.addEventListener("executeSave", this, false);
61 this.eventManager.addEventListener("executeSaveAs", this, false);
61 62
62 this.eventManager.addEventListener("recordStyleChanged", this, false); 63 this.eventManager.addEventListener("recordStyleChanged", this, false);
63 64
@@ -100,33 +101,47 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
100 handleExecuteFileOpen: { 101 handleExecuteFileOpen: {
101 value: function(event) { 102 value: function(event) {
102 var pickerSettings = event._event.settings || {}; 103 var pickerSettings = event._event.settings || {};
103 pickerSettings.callback = this.openFileWithURI.bind(this); 104 if (this.application.ninja.coreIoApi.cloudAvailable()) {
104 pickerSettings.pickerMode = "read"; 105 pickerSettings.callback = this.openFileWithURI.bind(this);
105 pickerSettings.inFileMode = true; 106 pickerSettings.pickerMode = "read";
106 this.application.ninja.filePickerController.showFilePicker(pickerSettings); 107 pickerSettings.inFileMode = true;
108 this.application.ninja.filePickerController.showFilePicker(pickerSettings);
109 }
107 } 110 }
108 }, 111 },
109 112
110 handleExecuteNewFile: { 113 handleExecuteNewFile: {
111 value: function(event) { 114 value: function(event) {
112 var newFileSettings = event._event.settings || {}; 115 var newFileSettings = event._event.settings || {};
113 newFileSettings.callback = this.createNewFile.bind(this); 116 if (this.application.ninja.coreIoApi.cloudAvailable()) {
114 this.application.ninja.newFileController.showNewFileDialog(newFileSettings); 117 newFileSettings.callback = this.createNewFile.bind(this);
118 this.application.ninja.newFileController.showNewFileDialog(newFileSettings);
119 }
115 } 120 }
116 }, 121 },
117
118
119 //////////////////////////////////////////////////////////////////// 122 ////////////////////////////////////////////////////////////////////
120 //TODO: Check for appropiate structures 123 //TODO: Check for appropiate structures
121 handleExecuteSave: { 124 handleExecuteSave: {
122 value: function(event) { 125 value: function(event) {
123 if(!!this.activeDocument){ 126 if((typeof this.activeDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){
124 //Text and HTML document classes should return the same save object for fileSave 127 //Text and HTML document classes should return the same save object for fileSave
125 this.application.ninja.ioMediator.fileSave(this.activeDocument.save(), this.fileSaveResult.bind(this)); 128 this.application.ninja.ioMediator.fileSave(this.activeDocument.save(), this.fileSaveResult.bind(this));
126 } 129 }
127 } 130 }
128 }, 131 },
129 //////////////////////////////////////////////////////////////////// 132 ////////////////////////////////////////////////////////////////////
133 handleExecuteSaveAs: {
134 value: function(event) {
135 var saveAsSettings = event._event.settings || {};
136 if((typeof this.activeDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){
137 saveAsSettings.fileName = this.activeDocument.name;
138 saveAsSettings.folderUri = this.activeDocument.uri.substring(0, this.activeDocument.uri.lastIndexOf("/"));
139 //add callback
140 this.application.ninja.newFileController.showSaveAsDialog(saveAsSettings);
141 }
142 }
143 },
144
130 // 145 //
131 fileSaveResult: { 146 fileSaveResult: {
132 value: function (result) { 147 value: function (result) {
diff --git a/js/data/menu-data.js b/js/data/menu-data.js
index 7c3ca5d4..52710b3a 100755
--- a/js/data/menu-data.js
+++ b/js/data/menu-data.js
@@ -44,7 +44,7 @@ exports.MenuData = Montage.create( Montage, {
44 "displayText" : "Save As", 44 "displayText" : "Save As",
45 "hasSubMenu" : false, 45 "hasSubMenu" : false,
46 "enabled": true, 46 "enabled": true,
47 "action":"saveAs" 47 "action":"executeSaveAs"
48 }, 48 },
49 { 49 {
50 "displayText" : "Save All", 50 "displayText" : "Save All",
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;
676
677 //do selection if in file selection mode
678 if(this.pickerModel.inFileMode && (this.application.ninja.filePickerController._directoryContentCache[uri].type === "file")){
679 this.okButton.removeAttribute("disabled");
680 //put into selectedItems..currently single selection is supported
681 this.selectedItems = [uri];
682 this.currentURI = uri.substring(0, uri.lastIndexOf("/"));
683 this.handleOkButtonAction();
684 }
685 }
686 },
687
672 handlePickerNavShowMetadata: { 688 handlePickerNavShowMetadata: {
673 value: function(evt){ 689 value: function(evt){
674 //update matadata only if nothing is already selected 690 //update matadata only if nothing is already selected
675 if(this.currentSelectedNode == null){ 691 if(this.currentSelectedNode == null){
676 //console.log("handle showmetadata - true"); 692 //console.log("handle showmetadata - true");
677 this.metadataSection.innerHTML = evt.metadata; 693 this.metadataSection.innerHTML = evt.metadata;
678 }
679 } 694 }
695 }
680 }, 696 },
681 697
682 handlePickerNavUpdateMetadata:{ 698 handlePickerNavUpdateMetadata:{
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
19 writable:false, 19 writable:false,
20 enumerable:true, 20 enumerable:true,
21 value:function(){ 21 value:function(){
22 var that = this;
23
24 this.eventManager.addEventListener("saveAs", function(evt){
25 var data = evt._event.data || {};//data will contain the current file name, directory location and callback
26 that.showSaveAsDialog(data);
27 }, false);
28 } 22 }
29 }, 23 },
30 24
@@ -99,7 +93,6 @@ var NewFileWorkflowController = exports.NewFileWorkflowController = Montage.cre
99 saveAsDialog.fileName = fileName; 93 saveAsDialog.fileName = fileName;
100 saveAsDialog.folderUri = folderUri; 94 saveAsDialog.folderUri = folderUri;