Update cookies preferences
Promotic

Preconfiguration "Window for selection of the file/folder"

Selection window limited to folders and files located in specific folders on the disk of the server

This preconfiguration can be activated when creating a new object (e.g. by "New object ..." in the context menu of the object or by pressing the Insert key after selecting the object) and is included in the group: "/ Panels (PmaPanel) / Others examples".
This preconfiguration can be created in the object: PmaFolder, PmaRoot, PmaPanel or PmaWorkspace.

The preconfiguration is created including the panel (object of the PmaPanel type) is functional also as Web panel.

The preconfiguration creates an object of the PmaPanel type named "FileBrowser". The panel contains the PmgForm object that is configured as file selection dialog in the onFormLoad event. The functional buttons allow to perform the desired disk operation over the selected item.

The panel has the following methods:
Init - defines the folder that will be used as root for file/folder selection
CreateDir - for creating folders
DeleteDir - for deleting empty folders
DeleteFile - for deleting files
GetFromDir - returns a list of existing folders and files in requested folder
MoveFile - for moving files


In the "Init" method the enabled root folders for the selection are set. This initialization setup is done in the JSON format and sets:
name - user name of the selected folder
desc - user description of the selected folder
path - path to the selected folder
readonly - specifies whether the folder (and its subfolders and files) are 1=read only, 0=for read and write
subfolder - specifies whether it is allowed to enter the subfolders. 1=yes, 0=no.


Controls for file selection:
Use the arrows or the mouse to select the file or folder. By left mouse button double-clicking or Enter over a folder enters the subfolder. The OK button returns the full path of the selected file. The file operations represented by the buttons are executed on the selected file (folder).

Manager limitations:
- It is possible to delete only individual files.
- The folder can be deleted only if it is empty.
These configurators can be set before the preconfiguration is created:
The name of created objectName of the object created in the Pma objects tree.
The maximum name length is 30 characters.
This is a system name, so it must contain only alphanumeric and must not contain any diacritics (i.e. national dependent characters), empty string, spaces and the first character must not be a number.
Default: "FileExplorer"
Enable as Web componentSpecifies whether this object has to be registered as a Web server component
After the preconfiguration is created, the "PmaPanel > Web server > Enable as Web component" configurator will be set to this value.
Example:
The example of opening the file selection window and getting the full path to the file. The script is called for example in the onButtonUp event of the PmgButton object.
JavaScriptSelect and copy to clipboard

function onViewClose(ev)
{
if (ev.CloseReason == "ok")
{
var sFullPath = ev.ReturnValue;
Pm.Debug(sFullPath);
}
}

// Opening the selection window with the preset file path
var oCreator = Pm.CreateView(null, "../FileBrowser", "pars:{path:#app:Cfg/data.csv;};", "target:_blank;modal:1;pos:view," + pMe.ViewX + "," + pMe.ViewY + ";");
oCreator.View.Arguments = "load";   // "load" or "save"
oCreator.View.onClose = onViewClose;
oCreator.Open();

History:
Pm9.00.25: Created
PROMOTIC 9.0.28 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.