deprecatedclass %ZEN.Dialog.fileSelect
extends %CSP.Portal.standardDialog
This dialog page displays a file selection window
listing directories and files on the server.
This is intended for use within server portal pages.
To use this dialog, the current user must hold USE privileges on
one of the following resources:
%Admin_Manage,%Admin_Operate,%Admin_Secure,%Development
For an production-enabled namespace, resource %Ens_ViewFileSystem is required.
How to Use This Dialog
The following arguments maybe passed in:
- Dir: This is the default directory path and optionally with a filename. It is encouraged that you provide a default directory and filename whenever possible.
Alternatively you can pass in the filename using a separate argument File
- showdirectoryonly: 1 or 0. If 1, then the dialog will show directories only. Default is 0.
- wildcard: a wildcard for "Type of files" to filter the files. Examples:*.xml, *.txt, *.log, etc. Default is *.*, i.e if nothing passed in then files of all types are shown.
- extfilter: only display files whose extension appears in the list. Values should be specified in the same format as wildcard. If this parameter is specified wildcard is ignored.
This will remove the option to display all files (*) and files with no extension will never be displayed. Note that on UNIX platforms the extensions are case sensitive.
To display files with the extension .TXT or .txt, you should use 'extfilter=*.txt;*.TXT'.
Example invoking the fileSelect dialog to open in a popup window:
zenLaunchPopupWindow('%ZEN.Dialog.fileSelect.cls?Dir='+encodeURIComponent(Dir)+'&wildcard='+wildcard,'FileSelect','resizable,width=600,height=700');
If Dir is null, then the manager directory is used when the dialog is opened. If Dir contains a partial directory, then the last valid level
of directory, if can be found, is used. If Dir contains a filename or a partical name without a directory then the manager directory is used
for the filename. When OK is pressed, whatever is shown in the File name field is returned to the calling page.
If you are opening the dialog as a popup window such as shown in the above example, then you should have an onPopupAction method defined on the calling page.
In the following example, a Zen control "FileName" is defined on your calling page, and upon returning from the fileSelect dialog by clicking "OK",
the returned value will be set into your Zen control "FileName":
ClientMethod onPopupAction(popupName, action, value) [ Language = javascript ]
{
if (action == "ok") {
if (popupName == "FileSelect") zen("FileName").setValue(value);
}
}
ISC Developers: Please use caution when modifying logic in this class. Your change needs to be tested in Windows, Unix, and VMS for all cases.
This is a Zen Page class.
parameter DOMAIN = "%ZEN";
Localization domain
parameter VALIDATEXML = 0;
Validate user pages
property DefaultDirectory
as %ZEN.Datatype.string;
Composed Default Directory path. After much checking, this is the final default directory that is used as default.
property DirFile
as %ZEN.Datatype.string(ZENURL="Dir");
Original Directory path and/or filename passed in. If null is passed in, then manager directory will be used.
property ExtFilter
as %ZEN.Datatype.string(ZENURL="extfilter");
property FileName
as %ZEN.Datatype.string(ZENURL="File");
Original File name passed in (optional)
property isVMS
as %Boolean [ InitialExpression = "0" ];
property isWINDOWS
as %Boolean [ InitialExpression = "0" ];
property showdirectoryonly
as %ZEN.Datatype.string(ZENURL="showdirectoryonly");
Whether to show directory only or with files
method %OnAfterCreatePage()
as %Status
This callback is called after the server-side page
object and all of its children are created.
Subclasses can override this to add, remove, or modify
items within the page object model, or to provide values
for controls.
method %OnGetSubtitle()
as %String
Get the (localized) subtitle string for the dialog.
This should be implemented in a subclass.
method %OnGetTitle()
as %String
Get the (localized) title string for the dialog.
This should be implemented in a subclass.
method BuildDrive(Output drives As %String, ByRef drive As %String, Output lastexistingdir As %String)
This method builds the list of drives for the "look in" window. It will contain
the available drives (mount points), or the user-configured set of available directories.
In addition, it will contain the set of parent directories for the specified directory.
classmethod CheckFileExt(File, FileType)
as %String
[ ZenMethod ]
Check if file has extension. If not, add it.
classmethod CheckPath(Path As %String, File As %String, FileType As %String)
as %String
[ ZenMethod ]
****** The Following Methods are Called from UtilFile*.csp Also ******
If user enters a directory but without drive, we add the drive here. This overrides the "Look in" directory.
For Windows and VMS only.
classmethod CheckRootDir(File As %String)
as %String
[ ZenMethod ]
Check if user entered filename ends with ":". If yes, then we should add "/" or [000000] to make valid drive.
For Windows: If user enters : without \ then we add it here.
For VMS: If user enters : without any [directory] then add [000000] here.
If we don't do this then directory would be invalid.
classmethod GetDirFile(LookinDir, File, FileType)
as %String
[ ZenMethod ]
Construct new new file name, if it does not have dir yet
method GetDirectory(Dir As %String)
as %String
[ ZenMethod ]
Check if user entered directory exists. Return a valid directory.
classmethod GetSubDir(LookinDir, Dir)
as %String
[ ZenMethod ]
Construct new directory given the Look in directory and selected directory from the middle frame
method GetViewContents(ByRef pParms As %String, Output pContents As %String, ByRef pHeader As %String)
as %Status
Build file and directory list
method RebuildLookin(Dir, wildcard)
[ ZenMethod ]
Construct new directory given the Look in directory and selected directory from the middle frame
method changeDrive(thisobj)
[ Language = javascript ]
User selected a different directory from "Lookin" drop-down. If FileName is available, add to the newly selected directory.
method changeFileType()
[ Language = javascript ]
This method refreshes the contents with the current file type and directory/file name
method changeSortOrder(value)
[ Language = javascript ]
method changeView(viewtype)
[ Language = javascript ]
changeView
method getDialogValue()
[ Language = javascript ]
Get the value that will be applied when the user presses the OK button.
This is implemented by subclasses.
method hasdelimiter(file)
[ Language = javascript ]
method itemClicked(viewobj)
[ Language = javascript ]
User clicked an item.
We put it in the File name field. User can OK it or [Enter] to drill down.
method itemSelected(viewobj)
[ Language = javascript ]
User has selected a new item (double click).
method ondialogFinish(action)
as %Boolean
[ Language = javascript ]
This callback, if defined, is called when the user presses the OK or Apply action buttons.
If this returns false, then the action is cancelled.
Check FileName value. If user entered a path, then return as is.
If user enters something but not including a path, then add selected path in front of it.
It is possible that user is entering a sub directory or file, therefore as a curtersey we add the path for them.
In addition, if user enters a filename without a file extension, then we add the filetype choice from the drop-down.
method ondialogStart()
[ Language = javascript ]
This callback, if defined, is called when the dialog page is loaded.
method onkeydownHandler(evt)
[ Language = javascript ]
Examine if user hit the Return key. If yes, start the search.
This method handles all keydown events on the window.
method onresizeHandler()
[ Language = javascript ]
This client event, if present, is fired when the page is resized.
method reloadLookin(driveobj, tvalue)
[ Language = javascript ]
method upOneLevel()
[ Language = javascript ]
up one level