aboutsummaryrefslogtreecommitdiff
path: root/js/components/ui
diff options
context:
space:
mode:
Diffstat (limited to 'js/components/ui')
-rw-r--r--js/components/ui/FilePicker/file-picker-controller.js497
-rw-r--r--js/components/ui/FilePicker/file-picker-model.js122
-rw-r--r--js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css201
-rw-r--r--js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html81
-rw-r--r--js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js1019
-rwxr-xr-x[-rw-r--r--]js/components/ui/color-chip.reel/color-chip.css0
-rwxr-xr-x[-rw-r--r--]js/components/ui/color-chip.reel/color-chip.html0
-rwxr-xr-x[-rw-r--r--]js/components/ui/color-chip.reel/color-chip.js72
-rwxr-xr-x[-rw-r--r--]js/components/ui/file-input.reel/file-input.css0
-rwxr-xr-x[-rw-r--r--]js/components/ui/file-input.reel/file-input.html6
-rwxr-xr-x[-rw-r--r--]js/components/ui/file-input.reel/file-input.js2
-rw-r--r--js/components/ui/icon-list-basic/icon.reel/icon.css25
-rwxr-xr-x[-rw-r--r--]js/components/ui/icon-list-basic/icon.reel/icon.html0
-rwxr-xr-x[-rw-r--r--]js/components/ui/icon-list-basic/icon.reel/icon.js14
-rwxr-xr-x[-rw-r--r--]js/components/ui/icon-list-basic/iconsList.reel/iconsList.css0
-rwxr-xr-x[-rw-r--r--]js/components/ui/icon-list-basic/iconsList.reel/iconsList.html5
-rwxr-xr-x[-rw-r--r--]js/components/ui/icon-list-basic/iconsList.reel/iconsList.js8
-rwxr-xr-x[-rw-r--r--]js/components/ui/input-group.reel/input-group.css2
-rwxr-xr-x[-rw-r--r--]js/components/ui/input-group.reel/input-group.html10
-rwxr-xr-x[-rw-r--r--]js/components/ui/input-group.reel/input-group.js0
-rwxr-xr-x[-rw-r--r--]js/components/ui/modalDialog/modal-dialog-manager.js0
-rwxr-xr-x[-rw-r--r--]js/components/ui/modalDialog/modalDialogHeader.js0
-rwxr-xr-x[-rw-r--r--]js/components/ui/modalDialog/modalDialogHeader.reel/modalDialogHeader.css0
-rwxr-xr-x[-rw-r--r--]js/components/ui/modalDialog/modalDialogHeader.reel/modalDialogHeader.html0
-rwxr-xr-x[-rw-r--r--]js/components/ui/property-control.reel/property-control.css0
-rwxr-xr-x[-rw-r--r--]js/components/ui/property-control.reel/property-control.html6
-rwxr-xr-x[-rw-r--r--]js/components/ui/property-control.reel/property-control.js27
-rwxr-xr-x[-rw-r--r--]js/components/ui/radio-button.reel/radio-button.html0
-rwxr-xr-x[-rw-r--r--]js/components/ui/radio-button.reel/radio-button.js0
-rwxr-xr-x[-rw-r--r--]js/components/ui/row-renderer.reel/row-renderer.html0
-rwxr-xr-x[-rw-r--r--]js/components/ui/row-renderer.reel/row-renderer.js0
-rwxr-xr-x[-rw-r--r--]js/components/ui/tree-basic/tree.reel/tree.css0
-rwxr-xr-x[-rw-r--r--]js/components/ui/tree-basic/tree.reel/tree.html10
-rwxr-xr-x[-rw-r--r--]js/components/ui/tree-basic/tree.reel/tree.js12
-rwxr-xr-x[-rw-r--r--]js/components/ui/tree-basic/treeItem.reel/treeItem.css0
-rwxr-xr-x[-rw-r--r--]js/components/ui/tree-basic/treeItem.reel/treeItem.html0
-rwxr-xr-x[-rw-r--r--]js/components/ui/tree-basic/treeItem.reel/treeItem.js23
37 files changed, 175 insertions, 1967 deletions
diff --git a/js/components/ui/FilePicker/file-picker-controller.js b/js/components/ui/FilePicker/file-picker-controller.js
deleted file mode 100644
index 526578d1..00000000
--- a/js/components/ui/FilePicker/file-picker-controller.js
+++ /dev/null
@@ -1,497 +0,0 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7
8var Montage = require("montage/core/core").Montage,
9 pickerNavigatorReel = require("js/components/ui/FilePicker/pickerNavigator.reel").PickerNavigator,
10 filePickerModelModule = require("js/components/ui/FilePicker/file-picker-model"),
11 fileSystem = require("js/io/system/filesystem").FileSystem,
12 Popup = require("montage/ui/popup/popup.reel").Popup;
13
14//singleton with functions to create a new file picker instance and utilities to format or filter the model data
15var FilePickerController = exports.FilePickerController = Montage.create(require("montage/ui/component").Component, {
16 /**
17 * Register a listener for file open event
18 */
19 deserializedFromTemplate:{
20 writable:false,
21 enumerable:true,
22 value:function(){
23 var that = this;
24 this.eventManager.addEventListener("executeFileOpen", function(evt){
25
26 var callback, pickerMode, currentFilter, allFileFilters,inFileMode, allowNewFileCreation, allowMultipleSelections;
27
28 if(!!evt.callback){
29 callback = evt.callback;
30 }
31 if(!!evt.pickerMode){
32 pickerMode = evt.pickerMode;
33 }
34 if(!!evt.currentFilter){
35 currentFilter = evt.currentFilter;
36 }
37 if(!!evt.inFileMode){
38 inFileMode = evt.inFileMode;
39 }
40 if(!!evt.allFileFilters){
41 allFileFilters = evt.allFileFilters;
42 }
43 if(!!evt.allowNewFileCreation){
44 allowNewFileCreation = evt.allowNewFileCreation;
45 }
46 if(!!evt.allowMultipleSelections){
47 allowMultipleSelections = evt.allowMultipleSelections;
48 }
49
50 that.showFilePicker(callback, pickerMode, currentFilter, allFileFilters,inFileMode, allowNewFileCreation, allowMultipleSelections);
51
52 }, false);
53 }
54 },
55
56 /**
57 * this will be stored in the local storage and in the cloud may be, for the cloud one.
58 */
59 _lastOpenedFolderURI:{
60 writable:true,
61 enumerable:true,
62 value:{
63 lastFolderUri_local:null,
64 lastFolderUri_cloud:null
65 }
66 },
67
68 /**
69 * this will be stored in the local storage and in the cloud may be, for the cloud one.
70 */
71 _lastSavedFolderURI:{
72 writable:true,
73 enumerable:true,
74 value:{
75 lastSavedFolderUri_local:null,
76 lastSavedFolderUri_cloud:null
77 }
78 },
79
80 /**
81 *this function is used to create an instance of a file picker
82 *
83 * parameters:
84 * callback: the call back function which will be used to send the selected URIs back
85 * pickerMode: ["read", "write"] : specifies if the file picker is opened to read a file/folder or to save a file
86 * currentFilter: if a current filter needs to be applied [ex: .psd]
87 * allFileFilters: list of filters that user can use to filter the view
88 * inFileMode: true => allow file selection , false => allow directory selection
89 * allowNewFileCreation: flag to specify whether or not it should return URI(s) to item(s) that do not exist. i.e. a user can type a filename to a new file that doesn't yet exist in the file system.
90 * allowMultipleSelections: allowMultipleSelections
91 *rootDirectories: invoker of this function can mention a subset of the allowed root directories to show in the file picker
92 *
93 * return: none
94 */
95
96 showFilePicker:{
97 writable:false,
98 enumerable:true,
99 value:function(callback, pickerMode, currentFilter, allFileFilters,inFileMode, allowNewFileCreation, allowMultipleSelections){
100
101 var aModel = filePickerModelModule.FilePickerModel.create();
102
103 var topLevelDirectories = null;
104 var driveData = fileSystem.shellApiHandler.getDirectoryContents({uri:"", recursive:false, returnType:"all"});
105 if(driveData.success){
106 topLevelDirectories = (JSON.parse(driveData.content)).children;
107 }else{
108 var errorCause = "";
109 if(driveData.status === null){
110 errorCause = "Service Unavailable"
111 }else{
112 errorCause = driveData.status;
113 }
114 aModel.fatalError = " ** Unable to get files [Error: "+ errorCause +"]";
115 }
116
117 aModel.currentFilter = currentFilter;
118 aModel.inFileMode = inFileMode;
119 aModel.topLevelDirectories = topLevelDirectories;
120
121 if(!!topLevelDirectories && !!topLevelDirectories[0]){
122 aModel.currentRoot = topLevelDirectories[0].uri;
123 }
124
125 //populate the last opened folder first, if none then populate default root
126 var sessionStorage = window.sessionStorage;
127 var storedUri = null;
128
129 if(pickerMode === "write"){
130 storedUri = sessionStorage.getItem("lastSavedFolderURI");
131 }else{
132 storedUri = sessionStorage.getItem("lastOpenedFolderURI");
133 }
134
135 if(!!storedUri){
136 aModel.currentRoot = unescape(storedUri);
137 }
138
139 aModel.fileFilters = allFileFilters;
140 aModel.callback = callback;
141 aModel.pickerMode = pickerMode;
142
143 //dummy data - TODO:remove after testing
144 //aModel.currentFilter = "*.html, *.png";
145 //aModel.currentFilter = "*.jpg";
146 aModel.currentFilter = "*.*";
147 aModel.inFileMode = true;
148 aModel.fileFilters = [".html, .htm", ".jpg, .jpeg, .png, .gif", ".js, .json", ".css", ".txt, .rtf", ".doc, .docx", ".pdf", ".avi, .mov, .mpeg, .ogg, .webm", "*.*"];