ShowScript
CAdminFileDialog::ShowScript( Array arConfig )
Method receives an array of configuration parameters and generates scripts, necessary to show file dialog. Static method.
Function parameters
Sole method parameter is the associative array, which keys are parameters of a dialog call. Keys and their descriptions are provided in the table below.
Key | Description |
---|---|
event | String, containing name of Javascript function, which calls file dialog. Function should be specified in global scope. |
arResultDest | Associative array that defines the way of file dialog result is returning. The following variants of the task are possible.
|
arPath | Associative array that specifies a path. The array can be empty or contain one of the following keys:
|
select | Specifies which objects can be selected by user in dialog:
|
operation | Determines file dialog operation mode:
|
showUploadTab | Specifies to show file upload tab (enabled only if operation = "O"):
|
showAddToMenuTab | Specifies to show page add to menu tab (enabled only if operation = "S"):
|
fileFilter | File filter by extension, can have the following values:
|
allowAllFiles | Specifies for users to use the "All files(*.*)" option in the filter filter (only enabled if the fileFilter parameter is not equal ""):
|
SaveConfig | Specifies to save user settings for dialog (type, sorting, path):
|
Example of calling dialog to open file:
CAdminFileDialog::ShowScript(Array ( "event" => "OpenImage", "arResultDest" => Array("FUNCTION_NAME" => "SetImageUrl"), "arPath" => Array(), "select" => 'F', "operation" => 'O', "showUploadTab" => true, "showAddToMenuTab" => false, "fileFilter" => 'image', "allowAllFiles" => true, "saveConfig" => true ) ); <script> document.getElementById("open_dialog_button").oncl ick = OpenImage; var SetImageUrl = function(filename,path,site) { // Result processing alert("filename = "+filename+"; /n path = "+path+"; /n site = "+site); } </script>