diff options
Diffstat (limited to 'js/io/ui/new-file-dialog/new-file-options-navigator.reel')
3 files changed, 57 insertions, 19 deletions
diff --git a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.css b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.css index 7ef6d2ce..95ce01f9 100755 --- a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.css +++ b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.css | |||
@@ -153,4 +153,8 @@ | |||
153 | border:2px solid #a1a1a1; | 153 | border:2px solid #a1a1a1; |
154 | background-image:none; | 154 | background-image:none; |
155 | cursor:auto; | 155 | cursor:auto; |
156 | } | ||
157 | |||
158 | .newfile .atree ul{ | ||
159 | -webkit-padding-start: 10px; | ||
156 | } \ No newline at end of file | 160 | } \ No newline at end of file |
diff --git a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.html b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.html index eb4a8045..c9178d65 100755 --- a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.html +++ b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.html | |||
@@ -70,7 +70,7 @@ | |||
70 | <div id="newfile" class="newfile"> | 70 | <div id="newfile" class="newfile"> |
71 | <div class="title">Create New File</div> | 71 | <div class="title">Create New File</div> |
72 | <div class="container left-nav"> | 72 | <div class="container left-nav"> |
73 | <div class="projectTypeHeader"><span>File Type</span></div> | 73 | <div class="projectTypeHeader"><span>Choose Type</span></div> |
74 | <div id="projectTypeTree" class="projectTypeTree"></div> | 74 | <div id="projectTypeTree" class="projectTypeTree"></div> |
75 | </div> | 75 | </div> |
76 | <div class="container right-nav"> | 76 | <div class="container right-nav"> |
diff --git a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js index 3a2e3e96..f17b15d5 100644 --- a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js +++ b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js | |||
@@ -9,7 +9,6 @@ var Montage = require("montage/core/core").Montage, | |||
9 | iconsListModule = require("js/components/ui/icon-list-basic/iconsList.reel"), | 9 | iconsListModule = require("js/components/ui/icon-list-basic/iconsList.reel"), |
10 | treeModule = require("js/components/ui/tree-basic/tree.reel"), | 10 | treeModule = require("js/components/ui/tree-basic/tree.reel"), |
11 | newFileLocationSelectionModule = require("js/io/ui/new-file-dialog/new-file-workflow-controller"); | 11 | newFileLocationSelectionModule = require("js/io/ui/new-file-dialog/new-file-workflow-controller"); |
12 | //nj= ("js/lib/NJUtils.js").NJUtils; | ||
13 | 12 | ||
14 | var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(Component, { | 13 | var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(Component, { |
15 | 14 | ||
@@ -92,6 +91,14 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
92 | 91 | ||
93 | this.selectedProjectType = {"uri":this.newFileModel.defaultProjectType, "element":null}; | 92 | this.selectedProjectType = {"uri":this.newFileModel.defaultProjectType, "element":null}; |
94 | } | 93 | } |
94 | |||
95 | //update file Extension | ||
96 | if(!!this.newFileModel.projectTypeData[this.newFileModel.defaultProjectType].fileExtension){ | ||
97 | var fileExtensionEl = this.element.querySelector(".fileExtension"); | ||
98 | if(!!fileExtensionEl){ | ||
99 | fileExtensionEl.innerHTML = ""+this.newFileModel.projectTypeData[this.newFileModel.defaultProjectType].fileExtension; | ||
100 | } | ||
101 | } | ||
95 | } | 102 | } |
96 | 103 | ||
97 | }, | 104 | }, |
@@ -128,7 +135,15 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
128 | 135 | ||
129 | //clear current template selection | 136 | //clear current template selection |
130 | if((!!this.selectedTemplate) && (this.selectedTemplate.element.classList.contains("selected"))){ | 137 | if((!!this.selectedTemplate) && (this.selectedTemplate.element.classList.contains("selected"))){ |
131 | this.selectedTemplate.element.classList.remove("selected"); | 138 | this.selectedTemplate.element.classList.remove("selected"); |
139 | } | ||
140 | |||
141 | //update file Extension | ||
142 | if(!!this.newFileModel.projectTypeData[evt.uri].fileExtension){ | ||
143 | var fileExtensionEl = this.element.querySelector(".fileExtension"); | ||
144 | if(!!fileExtensionEl){ | ||
145 | fileExtensionEl.innerHTML = ""+this.newFileModel.projectTypeData[evt.uri].fileExtension; | ||
146 | } | ||
132 | } | 147 | } |
133 | 148 | ||
134 | //disable ok | 149 | //disable ok |
@@ -186,6 +201,7 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
186 | projectWidth = this.newFileLocation.templateWidth, | 201 | projectWidth = this.newFileLocation.templateWidth, |
187 | projectHeight = this.newFileLocation.templateHeight, | 202 | projectHeight = this.newFileLocation.templateHeight, |
188 | 203 | ||
204 | newFilePath = "", fileExtension=this.newFileModel.projectTypeData[selectedProjectTypeID].fileExtension, | ||
189 | 205 | ||
190 | selectionlog= "selectedProjectTypeID="+selectedProjectTypeID +"\n"+ | 206 | selectionlog= "selectedProjectTypeID="+selectedProjectTypeID +"\n"+ |
191 | "templateID="+templateID+ "\n"+ | 207 | "templateID="+templateID+ "\n"+ |
@@ -194,29 +210,30 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
194 | "projectWidth="+projectWidth+"\n"+ | 210 | "projectWidth="+projectWidth+"\n"+ |
195 | "projectHeight="+projectHeight; | 211 | "projectHeight="+projectHeight; |
196 | 212 | ||
213 | |||
214 | if(/[^/\\]$/g.test(projectDirectory)){ | ||
215 | projectDirectory = projectDirectory + "/"; | ||
216 | } | ||
217 | if(!!fileExtension && (projectName.lastIndexOf(fileExtension) !== (projectName.length - fileExtension.length))){ | ||
218 | projectName = projectName+fileExtension; | ||
219 | } | ||
220 | newFilePath = "" + projectDirectory + projectName; | ||
221 | |||
222 | |||
197 | if(!!this.selectedProjectType && !!this.selectedTemplate | 223 | if(!!this.selectedProjectType && !!this.selectedTemplate |
198 | && this.isValidFileName(projectName) && this.isValidUri(projectDirectory) | 224 | && this.isValidFileName(projectName) && this.isValidUri(projectDirectory) |
199 | && !this.checkFileExists(projectName, projectDirectory, this.selectedProjectType) | 225 | && !this.checkFileExists(projectName, projectDirectory, this.selectedProjectType) |
200 | ){ | 226 | ){ |
201 | this.error.innerHTML=""; | 227 | this.error.innerHTML=""; |
202 | console.log("$$$ new file selections: \n" + selectionlog); | 228 | //console.log("$$$ new file selections: \n" + selectionlog); |
203 | if(!!this.newFileModel.callback && !!this.newFileModel.callbackScope){//inform document-controller if save successful | 229 | if(!!this.newFileModel.callback && !!this.newFileModel.callbackScope){//inform document-controller if save successful |
204 | this.newFileModel.callback.call(this.newFileModel.callbackScope, {"selectedProjectTypeID":selectedProjectTypeID, | 230 | this.newFileModel.callback.call(this.newFileModel.callbackScope, {"fileTemplateUri":selectedProjectTypeID, |
205 | "templateID":templateID, | 231 | "newFilePath":newFilePath});//document-controller api |
206 | "projectName": projectName, | ||
207 | "projectDirectory":projectDirectory, | ||
208 | "projectWidth":projectWidth, | ||
209 | "projectHeight":projectHeight});//document-controller api | ||
210 | }else{ | 232 | }else{ |
211 | //send selection event | 233 | //send selection event |
212 | var newFileSelectionEvent = document.createEvent("Events"); | 234 | var newFileSelectionEvent = document.createEvent("Events"); |
213 | newFileSelectionEvent.initEvent("createNewFile", false, false); | 235 | newFileSelectionEvent.initEvent("createNewFile", false, false); |
214 | newFileSelectionEvent.newFileOptions = {"selectedProjectTypeID":selectedProjectTypeID, | 236 | newFileSelectionEvent.newFileOptions = {"fileTemplateUri":selectedProjectTypeID, "newFilePath":newFilePath}; |
215 | "templateID":templateID, | ||
216 | "projectName": projectName, | ||
217 | "projectDirectory":projectDirectory, | ||
218 | "projectWidth":projectWidth, | ||
219 | "projectHeight":projectHeight}; | ||
220 | this.eventManager.dispatchEvent(newFileSelectionEvent); | 237 | this.eventManager.dispatchEvent(newFileSelectionEvent); |
221 | } | 238 | } |
222 | //store last selected project type | 239 | //store last selected project type |
@@ -306,7 +323,7 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
306 | 323 | ||
307 | if(!!this.selectedProjectType && !!this.selectedTemplate | 324 | if(!!this.selectedProjectType && !!this.selectedTemplate |
308 | && this.isValidFileName(this.newFileName) && this.isValidUri(this.newFileDirectory) | 325 | && this.isValidFileName(this.newFileName) && this.isValidUri(this.newFileDirectory) |
309 | && !this.checkFileExists(this.newFileName, this.newFileDirectory, this.selectedProjectType) | 326 | && !this.checkFileExists(this.newFileName, this.newFileDirectory, this.newFileModel.projectTypeData[this.selectedProjectType.uri].fileExtension) |
310 | ){ | 327 | ){ |
311 | status = true; | 328 | status = true; |
312 | this.okButton.removeAttribute("disabled"); | 329 | this.okButton.removeAttribute("disabled"); |
@@ -346,7 +363,7 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
346 | }, | 363 | }, |
347 | isValidFileName:{ | 364 | isValidFileName:{ |
348 | value: function(fileName){ | 365 | value: function(fileName){ |
349 | var status = nj.isValidFileName(fileName); | 366 | var status = this.isValidFileName(fileName); |
350 | if(fileName !== ""){ | 367 | if(fileName !== ""){ |
351 | if(!status){ | 368 | if(!status){ |
352 | this.showError("! Invalid file name."); | 369 | this.showError("! Invalid file name."); |
@@ -373,6 +390,23 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
373 | this.okButton.setAttribute("disabled", "true"); | 390 | this.okButton.setAttribute("disabled", "true"); |
374 | } | 391 | } |
375 | } | 392 | } |
376 | } | 393 | }, |
394 | |||
395 | /*** | ||
396 | * file name validation | ||
< |