From: phasefx Date: Sat, 15 Mar 2008 05:46:51 +0000 (+0000) Subject: tweaks to file picker X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=5474fec446767aa51299e7bd4f5568153ae8dfc6;p=Evergreen.git tweaks to file picker git-svn-id: svn://svn.open-ils.org/ILS/trunk@9040 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/chrome/content/util/file.js b/Open-ILS/xul/staff_client/chrome/content/util/file.js index 6244546aa9..2bbe3d27fa 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/file.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/file.js @@ -227,6 +227,7 @@ util.file.prototype = { 'pick_file' : function(params) { try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + if (typeof params == 'undefined') params = {}; if (typeof params.mode == 'undefined') params.mode = 'open'; var nsIFilePicker = Components.interfaces.nsIFilePicker; var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance( nsIFilePicker ); @@ -235,6 +236,9 @@ util.file.prototype = { typeof params.title == 'undefined' ? params.mode : params.title, params.mode == 'open' ? nsIFilePicker.modeOpen : nsIFilePicker.modeSave ); + if (params.defaultFileName) { + fp.defaultString = params.defaultFileName; + } fp.appendFilters( nsIFilePicker.filterAll ); var fp_result = fp.show(); if ( ( fp_result == nsIFilePicker.returnOK || fp_result == nsIFilePicker.returnReplace ) && fp.file ) {