aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAnanya Sen2012-02-10 01:55:30 -0800
committerAnanya Sen2012-02-10 01:55:30 -0800
commitad0ee69be3512325ede94738f23597086a141a3e (patch)
tree938c531ee1592e14807fa3d96f439bf8483d9fbc /js
parent67a5b6a1fb352bdc69ff05297268c27e7e2ba795 (diff)
downloadninja-ad0ee69be3512325ede94738f23597086a141a3e.tar.gz
file open and file new integrated again
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js')
-rwxr-xr-xjs/components/ui/FilePicker/file-input-field.reel/file-input-field.js3
-rwxr-xr-xjs/components/ui/FilePicker/file-picker-controller.js50
-rw-r--r--js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js37
-rwxr-xr-xjs/data/menu-data.js2
-rwxr-xr-xjs/io/document/document-controller.js57
-rw-r--r--js/io/templates/descriptor.json34
-rw-r--r--js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js8
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-workflow-controller.js2
8 files changed, 108 insertions, 85 deletions
diff --git a/js/components/ui/FilePicker/file-input-field.reel/file-input-field.js b/js/components/ui/FilePicker/file-input-field.reel/file-input-field.js
index 8710de63..235be8ad 100755
--- a/js/components/ui/FilePicker/file-input-field.reel/file-input-field.js
+++ b/js/components/ui/FilePicker/file-input-field.reel/file-input-field.js
@@ -70,8 +70,7 @@ var FileInputField = exports.FileInputField = Montage.create(Component, {
70 settings.inFileMode = true; 70 settings.inFileMode = true;
71 settings.pickerName = this.pickerName || "fileSelector"; 71 settings.pickerName = this.pickerName || "fileSelector";
72 } 72 }
73 settings.callback = this.filePickerCallback; 73 settings.callback = this.filePickerCallback.bind(this);
74 settings.callbackScope = this;
75 openFilePicker.settings = settings; 74 openFilePicker.settings = settings;
76 this.eventManager.dispatchEvent(openFilePicker); 75 this.eventManager.dispatchEvent(openFilePicker);
77 } 76 }
diff --git a/js/components/ui/FilePicker/file-picker-controller.js b/js/components/ui/FilePicker/file-picker-controller.js
index e71d1460..0ff20cc8 100755
--- a/js/components/ui/FilePicker/file-picker-controller.js
+++ b/js/components/ui/FilePicker/file-picker-controller.js
@@ -39,30 +39,6 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
39 }, 39 },
40 40
41 /** 41 /**
42 * this will be stored in the local storage and in the cloud may be, for the cloud one.
43 */
44 _lastOpenedFolderURI:{
45 writable:true,
46 enumerable:true,
47 value:{
48 lastFolderUri_local:null,
49 lastFolderUri_cloud:null
50 }
51 },
52
53 /**
54 * this will be stored in the local storage and in the cloud may be, for the cloud one.
55 */
56 _lastSavedFolderURI:{
57 writable:true,
58 enumerable:true,
59 value:{
60 lastSavedFolderUri_local:null,
61 lastSavedFolderUri_cloud:null
62 }
63 },
64
65 /**
66 *this function is used to create an instance of a file picker 42 *this function is used to create an instance of a file picker
67 * 43 *
68 * parameters: 44 * parameters:
@@ -87,7 +63,6 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
87 var callback, callbackScope, pickerMode, currentFilter, allFileFilters, inFileMode, allowNewFileCreation, allowMultipleSelections, pickerName; 63 var callback, callbackScope, pickerMode, currentFilter, allFileFilters, inFileMode, allowNewFileCreation, allowMultipleSelections, pickerName;
88 if(!!settings){ 64 if(!!settings){
89 if(typeof settings.callback !== "undefined"){callback = settings.callback;} 65 if(typeof settings.callback !== "undefined"){callback = settings.callback;}
90 if(typeof settings.callbackScope !== "undefined"){callbackScope = settings.callbackScope;}
91 if(typeof settings.pickerMode !== "undefined"){pickerMode = settings.pickerMode;} 66 if(typeof settings.pickerMode !== "undefined"){pickerMode = settings.pickerMode;}
92 if(typeof settings.currentFilter !== "undefined"){currentFilter = settings.currentFilter;} 67 if(typeof settings.currentFilter !== "undefined"){currentFilter = settings.currentFilter;}
93 if(typeof settings.allFileFilters !== "undefined"){allFileFilters = settings.allFileFilters;} 68 if(typeof settings.allFileFilters !== "undefined"){allFileFilters = settings.allFileFilters;}
@@ -97,6 +72,12 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
97 if(typeof settings.pickerName !== "undefined"){this.filePickerPopupType = settings.pickerName;} 72 if(typeof settings.pickerName !== "undefined"){this.filePickerPopupType = settings.pickerName;}
98 } 73 }
99 74
75 if(settings.pickerName === "saveAsDirectoryPicker"){//need to set the picker mode in a better way
76 pickerMode = "write";
77 }else{
78 pickerMode = "read";
79 }
80
100 var aModel = filePickerModelModule.FilePickerModel.create(); 81 var aModel = filePickerModelModule.FilePickerModel.create();
101 82
102 var topLevelDirectories = null; 83 var topLevelDirectories = null;
@@ -131,13 +112,20 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
131 } 112 }
132 113
133 //populate the last opened folder first, if none then populate default root 114 //populate the last opened folder first, if none then populate default root
134 var sessionStorage = window.sessionStorage;
135 var storedUri = null; 115 var storedUri = null;
136 116 var sessionStorage = window.sessionStorage;
137 if(pickerMode === "write"){ 117 try{
138 storedUri = sessionStorage.getItem("lastSavedFolderURI"); 118 if(pickerMode === "write"){
139 }else{ 119 storedUri = sessionStorage.getItem("lastSavedFolderURI");
140 storedUri = sessionStorage.getItem("lastOpenedFolderURI"); 120 }else if(inFileMode === true){
121 storedUri = sessionStorage.getItem("lastOpenedFolderURI_fileSelection");
122 }else if(inFileMode === false){
123 storedUri = sessionStorage.getItem("lastOpenedFolderURI_folderSelection");
124 }
125 }catch(e){
126 if(e.code == 22){
127 sessionStorage.clear();
128 }
141 } 129 }
142 130
143 if(!!storedUri){ 131 if(!!storedUri){
diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js
index d7a19c14..ff9c7073 100644
--- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js
+++ b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js
@@ -7,7 +7,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
7var Montage = require("montage/core/core").Montage, 7var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component, 8 Component = require("montage/ui/component").Component,
9 iconsListModule = require("js/components/ui/icon-list-basic/iconsList.reel"), 9 iconsListModule = require("js/components/ui/icon-list-basic/iconsList.reel"),
10 filePickerControllerModule = require("js/components/ui/FilePicker/file-picker-controller"),
11 treeModule = require("js/components/ui/tree-basic/tree.reel"); 10 treeModule = require("js/components/ui/tree-basic/tree.reel");
12 11
13var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { 12var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
@@ -335,7 +334,7 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
335 temp = temp.substring(0, temp.lastIndexOf("/")); 334 temp = temp.substring(0, temp.lastIndexOf("/"));
336 335
337 //populate dropdown irrespective of validity 336 //populate dropdown irrespective of validity
338// if(!!filePickerControllerModule.FilePickerController._directoryContentCache[temp]){//check if it is a valid location 337// if(!!this.application.ninja.filePickerController._directoryContentCache[temp]){//check if it is a valid location
339// arr.push(temp); 338// arr.push(temp);
340// }else{ 339// }else{
341// break; 340// break;
@@ -358,7 +357,7 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
358 value:function(element, uri){ 357 value:function(element, uri){
359 if(!!element){ 358 if(!!element){
360 var tree = treeModule.Tree.create(); 359 var tree = treeModule.Tree.create();
361 tree.treeViewDataObject = filePickerControllerModule.FilePickerController.prepareContentList(uri, this.pickerModel); 360 tree.treeViewDataObject = this.application.ninja.filePickerController.prepareContentList(uri, this.pickerModel);
362 //console.log("renderTree() for "+ uri); 361 //console.log("renderTree() for "+ uri);
363 //console.log(tree.treeViewDataObject); 362 //console.log(tree.treeViewDataObject);
364 tree.element = element; 363 tree.element = element;
@@ -374,10 +373,10 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
374 var status = true; 373 var status = true;
375 var iconViewContainer = this.element.querySelector(".iconViewContainer"); 374 var iconViewContainer = this.element.querySelector(".iconViewContainer");
376 if((typeof fromCache === 'undefined') || (fromCache === true)){ 375 if((typeof fromCache === 'undefined') || (fromCache === true)){
377 this.newContent = filePickerControllerModule.FilePickerController.prepareContentList(uri, this.pickerModel); 376 this.newContent = this.application.ninja.filePickerController.prepareContentList(uri, this.pickerModel);
378 } 377 }
379 else{ 378 else{
380 this.newContent = filePickerControllerModule.FilePickerController.prepareContentList(uri, this.pickerModel, false); 379 this.newContent = this.application.ninja.filePickerController.prepareContentList(uri, this.pickerModel, false);
381 } 380 }
382 if(!!this.newContent && this.newContent.length > 0){ 381 if(!!this.newContent && this.newContent.length > 0){
383 //clear selection 382 //clear selection
@@ -423,10 +422,10 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
423 if(!!treeViewContainer){ 422 if(!!treeViewContainer){
424 var data = []; 423 var data = [];
425 if((typeof fromCache === 'undefined') || (fromCache === true)){ 424 if((typeof fromCache === 'undefined') || (fromCache === true)){
426 data = filePickerControllerModule.FilePickerController.prepareContentList(uri, this.pickerModel); 425 data = this.application.ninja.filePickerController.prepareContentList(uri, this.pickerModel);
427 } 426 }
428 else{ 427 else{
429 data = filePickerControllerModule.FilePickerController.prepareContentList(uri, this.pickerModel, false); 428 data = this.application.ninja.filePickerController.prepareContentList(uri, this.pickerModel, false);
430 } 429 }
431 430
432 if(data.length > 0){ 431 if(data.length > 0){
@@ -475,7 +474,7 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
475 enumerable: false, 474 enumerable: false,
476 writable:false, 475 writable:false,
477 value:function(currentUri){ 476 value:function(currentUri){
478 var data = filePickerControllerModule.FilePickerController._directoryContentCache[currentUri]; 477 var data = this.application.ninja.filePickerController._directoryContentCache[currentUri];
479 var metadata = "";