/*
   * @param {Object} nodeData The custom data associated with the drop node (this is the same value returned from {@link #getTargetFromEvent} for this node)
   * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
   * @param {Event} e The event
   * @param {Object} data An object containing arbitrary data supplied by the drag source
   * @return {String} status The CSS class that communicates the drop status back to the source so that the underlying {@link Ext.dd.StatusProxy} can be updated
   */

/*
  MIT License http://www.opensource.org/licenses/mit-license.php
  Author Tobias Koppers @sokra
*/

/*
 * Tine 2.0
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Ching En Cheng <c.cheng@metaways.de>
 * @copyright   Copyright (c) 2021 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiß <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2017 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiß <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2017-2019 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiß <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2020 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Michael Spahn <m.spahn@metaways.de>
 * @copyright   Copyright (c) 2017 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 *
 * @package     Filemanager
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Ching En Cheng <c.cheng@metaways.de>
 * @copyright   Copyright (c) 2021 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 *
 * @package     Tinebase
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2010-2012 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 *
 * @package     Tinebase
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2010-2015 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Alexander Stintzing <a.stintzing@metaways.de>
 * @copyright   Copyright (c) 2007-2014 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Alexander Stintzing <a.stintzing@metaways.de>
 * @copyright   Copyright (c) 2012-2017 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2007-2014 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2010-2012 Metaways Infosystems GmbH (http://www.metaways.de)
 * 
 */

/*
 * Tine 2.0
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Martin Jatho <m.jatho@metaways.de>
 * @copyright   Copyright (c) 2007-2012 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Martin Jatho <m.jatho@metaways.de>
 * @copyright   Copyright (c) 2007-2020 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Michael Spahn <m.spahn@metaways.de>
 * @copyright   Copyright (c) 2017 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2010-2012 Metaways Infosystems GmbH (http://www.metaways.de)
 * 
 */

/*
 * Tine 2.0
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2011-2015 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
 * 
 * TODO         maybe we don't need this
 */

/*
 * Tine 2.0
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2018 Metaways Infosystems GmbH (http://www.metaways.de)
 *
 */

/*
 * Tine 2.0
 * Filemanager combo box and store
 * 
 * @package     Filemanager
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Alexander Stintzing <a.stintzing@metaways.de>
 * @author      Michael Spahn <m.spahn@metaways.de>
 * @copyright   Copyright (c) 2012-2017 Metaways Infosystems GmbH (http://www.metaways.de)
 *
 */

/*
 * register additional action for genericpickergridpanel
 */

/* .PersonaContainer */

/* .Personas.WARNING */

/* ["default"] */

/* ["default"].locals */

/* asset import */

/* binding */

/* default */

/* default.locals */

/* harmony default export */

/* harmony export */

/* harmony import */

/* import() */

/* import() | Filemanager/js/FilemanagerFileLocationPlugin */

/* import() | Tinebase/js/Vue-Runtime */

/* import() | Tinebase/js/ace */

/* istanbul ignore if  */

/* istanbul ignore next  */

/* pkg: Filemanager FAT Client (css/Filemanager-FAT.css)*/

/* pkg: Filemanager FAT Client (js/Filemanager-FAT.js)*/

/*#__PURE__*/

/**
     * @event forceNodeSelected
     * Fires when node was force selected (e.g. by dbl click)
     * @param nodeData selected node data
     */

/**
     * @event invalidNodeSelected
     * Fires if a node is selected which does not fulfill the provided constraints
     */

/**
     * @event nodeSelected
     * Fires when a file was selected which fulfills all constraints
     * @param nodeData selected node data
     */

/**
     * @param selected node
     */

/**
     * Fires if no preview is available. Later it should be used to be fired if the browser is not able to load images.
     */

/**
     * If the dialog will close and an valid node was selected
     * @param node
     */

/**
     * checks if an extension item has been registered already
     *
     * @param {String} extension
     * @param {String} xtype panel xtype
     */

/**
     * checks if an item has been registered already
     *
     * @param {String} contentType
     * @return {Bool}
     */

/**
     * checks if an item has been registered already
     *
     * @param {String} type
     * @param {String} key
     * @return {Bool}
     */

/**
     * default grants
     *
     * @return Array
     */

/**
     * fetch items from Filemanager registry
     */

/**
     * get container grants for specific container
     *
     * @param {Tine.Tinebase.Model.Container} container
     * @return Array
     */

/**
     * register grants or grants function for given model
     *
     * @param {Record/String} modelName
     * @param {Array|Function} grants
     */

/**
     * registers a handler
     *
     * @param {String} contentType
     * @param {String} xtype panel xtype
     */

/**
     * registers a handler
     *
     * @param {String} extension
     * @param {String} xtype panel xtype
     */

/**
     * registers a handler
     *
     * @param {String} type
     * @param {String} key
     * @param {String} value
     */

/**
     * returns a xtype
     *
     * @param {String} extension
     * @param {String} xtype panel xtype
     */

/**
     * returns a xtype for a contentType
     *
     * @param {String} contentType
     * @return {String}
     */

/**
     * returns a xtype for a key
     *
     * @param {String} type
     * @param {String} key
     * @return {String}
     */

/**
   * @cfg filesProperty
   * @type String
   */

/**
   * @cfg {Array} additionalFields
   * additional fields for the quota form
   */

/**
   * @cfg {Array} data of Tine.Tinebase.Model.Container
   * Container to manage grants for
   */

/**
   * @cfg {Array} operators allowed operators
   */

/**
   * @cfg {Array} requiredGrants
   * grants which are required to select nodes
   */

/**
   * @cfg {Boolean}
   * always show the admin grant (default: false)
   */

/**
   * @cfg {Boolean} allowMultiple
   * allow to select multiple fiels at once (source mode only)
   */

/**
   * @cfg {Function} handler
   */

/**
   * @cfg {String|RegExp}
   * A constraint allows to alter the selection behaviour of the picker, for example only allow to select files.
   * By default, file and folder are allowed to be selected, the concrete implementation needs to define it's purpose
   */

/**
   * @cfg {String} batchID of current upload
   */

/**
   * @cfg {String} defaultOperator default operator, one of <tt>{@link #operators} (defaults to equals)
   */

/**
   * @cfg {String} defaultValue default value (defaults to all)
   */

/**
   * @cfg {String} field path
   */

/**
   * @cfg {String} file name
   */

/**
   * @cfg {String} file type
   */

/**
   * @cfg {String} fileName
   * @property {String} fileName
   * (initial) fileName
   */

/**
   * @cfg {String} files
   * @property {String} files
   * (initial) files
   * files to be saved
   */

/**
   * @cfg {String} mode one of source|target
   */

/**
   * @cfg {String} windowTitle
   * title text when openWindow is used
   */

/**
   * @cfg {Tine.Felamimail.Model.Account}
   * 
   * TODO use node record?
   */

/**
   * @cfg {Tine.Tinebase.Application} app
   */

/**
   * @cfg {Tine.widgets.dialog.EditDialog}
   */

/**
   * @cfg {Tine.widgets.grid.GridPanel}
   */

/**
   * @param {Array} promises        List of promises to batch
   * @returns {Promise<any[]>}
   */

/**
   * @param {Object} dragOverEvent
   *
   * tree - The TreePanel
   * target - The node being targeted for the drop
   * data - The drag data from the drag source
   * point - The point of the drop - append, above or below
   * source - The drag source
   * rawEvent - Raw mouse event
   * dropNode - Drop node(s) provided by the source.
   * cancel - Set this to true to signal drop not allowed.
   */

/**
   * @private
   */

/**
   * @returns {*}
   */

/**
   * @returns {Tine.Filemanager.NodeTreePanel}
   */

/**
   * @type SelectionModel
   */

/**
   * @type Tine.Filemanager.DownloadLinkGridPanel
   */

/**
   * @type Tine.Filemanager.QuickLookRegistry
   */

/**
   * An empty function by default, but provided so that you can perform a custom action before the initial
   * drag event begins and optionally cancel it.
   * @param {Object} data An object containing arbitrary data to be shared with drop targets
   * @param {Event} e The event object
   * @return {Boolean} isValid True if the drag event is valid, else false to cancel
   */

/**
   * App which triggered this action
   */

/**
   * App which triggered this action (passed to preview panel)
   */

/**
   * Called when the DropZone determines that a {@link Ext.dd.DragSource} has been dropped onto
   * the drop node.  The default implementation returns false, so it should be overridden to provide the
   * appropriate processing of the drop event and return true so that the drag source's repair action does not run.
   * @param {Object} nodeData The custom data associated with the drop node (this is the same value returned from
   * {@link #getTargetFromEvent} for this node)
   * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
   * @param {Event} e The event
   * @param {Object} data An object containing arbitrary data supplied by the drag source
   * @return {Boolean} True if the drop was valid, else false
   */

/**
   * Capture space to toggle document preview
   */

/**
   * Check if selection fits current constraint
   * @returns {boolean}
   */

/**
   * Checks if a single node matches the constraints
   *
   * @param node
   * @returns {boolean}
   */

/**
   * Constructor.
   */

/**
   * Create a new filepicker and register listener
   * @returns {*}
   */

/**
   * Creates a new pop up dialog/window (acc. configuration)
   *
   * @returns {null}
   */

/**
   * Customized column model for the grid
   * @returns {*}
   */

/**
   * Expands a specified path in this TreePanel. A path can be retrieved from a node with {@link Ext.data.Node#getPath}
   *
   * NOTE: path does not consist of id's starting from the second depth
   *
   * @param {String} path
   * @param {String} attr (optional) The attribute used in the path (see {@link Ext.data.Node#getPath} for more info)
   * @param {Function} callback (optional) The callback to call when the expand is complete. The callback will be called with
   * (bSuccess, oLastNode) where bSuccess is if the expand was successful and oLastNode is the last node that was expanded.
   */

/**
   * Filemanager
   */

/**
   * Fires if no previews are available
   */

/**
   * Get translated application title of this application
   *
   * @return {String}
   */

/**
   * If a node was selected
   * @param nodes
   */

/**
   * If an invalid node was selected
   */

/**
   * Layout
   */

/**
   * Node record to preview
   */

/**
   * Password used to protect downloadlink
   */

/**
   * Selects the node in this tree at the specified path. A path can be retrieved from a node with {@link Ext.data.Node#getPath}
   * @param {String} path
   * @param {String} attr (optional) The attribute used in the path (see {@link Ext.data.Node#getPath} for more info)
   * @param {Function} callback (optional) The callback to call when the selection is complete. The callback will be called with
   * (bSuccess, oSelNode) where bSuccess is if the selection was successful and oSelNode is the selected node.
   */

/**
   * Tine.Filemanager.Model.DownloadLink
   */

/**
   * Tine.widgets.account.PickerGridPanel config values
   */

/**
   * Tine.widgets.tree.FilterPlugin
   * returns a filter plugin to be used in a grid
   */

/**
   * Updates selected element and triggers an event
   */

/**
   * after grid renderd
   */

/**
   * bus notified about record changes
   */

/**
   * called before store queries for data
   */

/**
   * called when the store gets updated, e.g. from editgrid
   * 
   * @param {Ext.data.store} store
   * @param {Tine.Tinebase.data.Record} record
   * @param {String} operation
   */

/**
   * called when tree selection changes
   *
   * @param {} sm     SelectionModel
   * @param {Ext.tree.TreeNode} node
   */

/**
   * canonical name
   * @cfg {String} canonicalName
   */

/**
   * check action constraints for given nodes
   * 
   * @param {String} action (create|delete|move|copy) 
   * @param {Record} targetNode
   * @param {Array}  sourceNodes
   * @param {Object} options
   * @return {Boolean}
   */

/**
   * check if node path is in current grid panel
   * @param path
   * @returns {boolean}
   */

/**
   * check if record can be edited
   *
   * @param row
   * @returns {boolean}
   */

/**
   * checkes if user has requested grant for given node
   *
   * @param {Tine.Filemanager.Model.Node} node
   * @param {Array} grants
   * @return bool
   */

/**
   * checks whether pause button shuold be enabled or disabled
   * 
   * @param action
   * @param grants
   * @param records
   */

/**
   * checks whether resume button shuold be enabled or disabled
   * 
   * @param action
   * @param grants
   * @param records
   */

/**
   * clone a tree node / create a node from grid node
   *
   * @param node
   * @returns {Ext.tree.AsyncTreeNode}
   */

/**
   * config values
   * @private
   */

/**
   * convert filesystem path to treePath
   *
   * NOTE: only the first depth gets converted!
   *       fs pathes of not yet loaded tree nodes can't be converted!
   *
   * @param {String} containerPath
   * @return {String} tree path
   */

/**
   * copy/move folder/files to a folder
   *
   * @param items files/folders to copy
   *
   * @param target
   * @param move
   * @param showConfirmDialog
   * @param params
   */

/**
   * creating folder
   * 
   * @param name      folder name
   * @param options   additional options
   * @returns
   */

/**
   * display file/directory in mainscreen
   * /#/Filemanager/showNode/shared/someFolder/someFile
   */

/**
   * exception handler for this proxy
   * 
   * @param {Tine.Exception} exception
   */

/**
   * executed after record got updated from proxy
   * -> we don't have a real record here
   * 
   * @private
   */

/**
   * executed when record is loaded
   * @private
   */

/**
   * expand folder node
   *
   * @param {Sting | Tine.Filemanager.Model.Node} path
   */

/**
   * fetch/manage preview panels for records by content-type
   */

/**
   * filemanager
   */

/**
   * files/folder got dropped on node
   *
   * @param {Object} dropEvent
   * @private
   */

/**
   * fm specific delete handler
   */

/**
   * folder or file?
   */

/**
   * generic apply changes handler
   * @param {Boolean} closeWindow
   */

/**
   * get action toolbar
   *
   * @return {Ext.Toolbar}
   */

/**
   * get record by data path
   * @param data
   * @returns {string}
   */

/**
   * get the right contextMenu
   */

/**
   * gets currently displayed node in case a path filter is set
   * NOTE: this data is unresolved as it comes from filter and not through json convert!
   *
   * @return {Object}
   */

/**
   * go up one folder
   *
   * @param {Ext.Component} button
   * @param {Ext.EventObject} event
   */

/**
   * grid on load handler
   *
   * @param store
   * @param records
   * @param options
   */

/**
   * grid row doubleclick handler
   *
   * @param {Tine.Filemanager.NodeGridPanel} grid
   * @param {} row record
   * @param {Ext.EventObjet} e
   */

/**
   * handels tree drop of object from outside the browser
   *
   * @param fileSelector
   * @param targetNodeId
   */

/**
   * helper function for users e.g. FilePickerDialog / SelectionDialog/FilemanagerPlugin
   * can be used after a final selection to check if a file exists (which might be hidden due to paging etc)
   * 
   * @return {Promise<unknown>}
   */

/**
   * holds Ids of record preview panels (index is record ID)
   */

/**
   * init actions and toolbars
   */

/**
   * init actions with actionToolbar, contextMenu and actionUpdater
   * @private
   */

/**
   * init buttons
   */

/**
   * init ext grid panel
   * @private
   */

/**
   * init grid columns
   */

/**
   * init panel
   */

/**
   * init record to edit
   * -> we don't have a real record here
   */

/**
   * initial path
   * @cfg {String} initialPath
   */

/**
   * initiates tree context menus
   *
   * @private
   */

/**
   * inits this cmp
   * @private
   */

/**
   * inserts a quota Message when using old Browsers with html4upload
   */

/**
   * is automatically called in generic GridPanel
   */

/**
   * load everything from server
   * @returns {Object} root node definition
   */

/**
   * monitor upload tasks
   * 
   * - cross window : if yes , duplicated window should not proceed upload at all
   */

/**
   * navigate previews
   *
   * @param e
   */

/**
   * on pause
   * @param {} button
   * @param {} event
   */

/**
   * on remove handler
   *
   * @param {} button
   * @param {} event
   */

/**
   * on resume
   * @param {} button
   * @param {} event
   */

/**
   * on store load exception
   *
   * @param {Tine.Tinebase.data.RecordProxy} proxy
   * @param {String} type
   * @param {Object} error
   * @param {Object} options
   */

/**
   * on update after edit
   *
   * @param {String|Tine.Tinebase.data.Record} record
   * @param {String} mode
   */

/**
   * overwrite update toolbars function (we don't have record grants yet)
   * 
   * @private
   */

/**
   * populate grid store
   *
   * @param {} record
   */

/**
   * preform the initial load of grid data
   */

/**
   * register constraint action provider
   * @param {Function} provider function with same signature as checkConstraints
   */

/**
   * remove handler
   * 
   * @param {} button
   * @param {} event
   */

/**
   * returns add action / test
   * 
   * - handle both file and folder upload action
   *
   * @return {Object} add action config
   */

/**
   * returns cm
   * 
   * @return Ext.grid.ColumnModel
   * @private
   * 
   * TODO    add more columns
   */

/**
   * returns dialog
   * 
   * NOTE: when this method gets called, all initalisation is done.
   * 
   * @return {Object}
   * @private
   * 
   */

/**
   * returns dialog
   * @return {Object}
   * @private
   */

/**
   * returns filter toolbar -> supress OR filters
   * @private
   */

/**
   * returns params for async request
   *
   * @param {Ext.tree.TreeNode} node
   * @return {Object}
   */

/**
   * returns true if node can accept contents
   *
   * @param nodeAttributes
   * @returns boolean
   */

/**
   * returns view row class
   */

/**
   * searches all (lightweight) records matching filter
   *
   * @param   {Object} filter
   * @param   {Object} paging
   * @param   {Object} options
   * @return  {Number} Ext.Ajax transaction id
   * @success {Object} root:[records], totalcount: number
   */

/**
   * select tree node(s)
   * 
   * @param {String} value
   */

/**
   * show context menu
   *
   * @param {Ext.tree.TreeNode} node
   * @param {Ext.EventObject} event
   */

/**
   * status column renderer
   * @param {string} value
   * @return {string}
   */

/**
   * that's the context menu handler
   * @param {} grid
   * @param {} row
   * @param {} e
   */

/**
   * updates given record with nodeData from from response
   */

/**
   * upload files
   * 
   * @param {} params Request parameters
   * @param [] uploadKeyArray
   * @param Boolean addToGridStore
   */

/**
   * upload new files and add to store
   *
   * - handle both folder and files
   * 
   * @param {ux.BrowsePlugin} fileSelector
   * @param event
   */

/**
   * value renderer
   * 
   * @param {Ext.data.Record} filter line
   * @param {Ext.Element} element to render to 
   */

/**
   * virtual nodes are part of the tree but don't exists / are editable
   *
   * NOTE: only "real" virtual node is node with path "otherUsers". all other nodes exist
   *
   * @returns {boolean}
   */

/**
 * @namespace   Tine.Filemanager
 * @class       Tine.Filemanager.DownloadLinkDialog
 * @extends     Tine.widgets.dialog.EditDialog
 * 
 * <p>Sieve Filter Dialog</p>
 * <p>This dialog is for editing sieve filters (rules).</p>
 * <p>
 * </p>
 * 
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * 
 * @param       {Object} config
 * @constructor
 * Create a new RulesDialog
 */

/**
 * @namespace   Tine.Filemanager
 * @class       Tine.Filemanager.NodeEditDialog
 * @extends     Tine.widgets.dialog.EditDialog
 *
 * <p>Node Compose Dialog</p>
 * <p></p>
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Alexander Stintzing <a.stintzing@metaways.de>
 *
 * @param       {Object} config
 * @constructor
 * Create a new Tine.Filemanager.NodeEditDialog
 */

/**
 * @namespace   Tine.Filemanager
 * @class       Tine.Filemanager.UsagePanel
 * @extends     Ext.Panel
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiß <c.weiss@metaways.de>
 *
 * @param       {Object} config
 * @constructor
 */

/**
 * @namespace   Tine.Filemanager.Model
 * @class       Tine.Filemanager.Model.DownloadLink
 * @extends     Tine.Tinebase.data.Record
 * Example record definition
 */

/**
 * @namespace   Tine.Filemanager.Model
 * @class       Tine.Filemanager.Model.Node
 * @extends     Tine.Tinebase.data.Record
 * Example record definition
 * 
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 */

/**
 * @namespace   Tine.widgets.container
 * @class       Tine.Filemanager.PathFilterModel
 * @extends     Tine.widgets.grid.FilterModel
 * 
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * 
 * @TODO make valueRenderer a path picker widget
 */

/**
 * @namespace Tine.Filemanager
 * @class Tine.Filemanager.Application
 * @extends Tine.Tinebase.Application
 */

/**
 * @namespace Tine.Filemanager
 * @class Tine.Filemanager.MainScreen
 * @extends Tine.widgets.MainScreen
 */

/**
 * @namespace Tine.Filemanager
 * @class Tine.Filemanager.NodeTreePanel
 * @extends Tine.widgets.container.TreePanel
 *
 * @author Martin Jatho <m.jatho@metaways.de>
 */

/**
 * @namespace Tine.Filemanager
 * @class Tine.Filemanager.QuickLookRegistry
 * @singleton
 *
 * @todo think about adding a generalized registry / @see Tine.Tinebase.ExceptionHandlerRegistry and others
 */

/**
 * @singleton
 */

/**
 * Container Grants grid
 * 
 * @namespace   Tine.widgets.container
 * @class       Tine.widgets.container.GrantsDialog
 * @extends     Tine.widgets.dialog.EditDialog
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2011 Metaways Infosystems GmbH (http://www.metaways.de)
 * @constructor
 * @param {Object} config The configuration options.
 */

/**
 * Creates a new pop up dialog/window (acc. configuration)
 *
 * @returns {null}
 */

/**
 * DownloadLink Edit Popup
 * 
 * @param   {Object} config
 * @return  {Ext.ux.Window}
 */

/**
 * Execute promise which is provided as a separate function in order to make a clean/original promise call.
 * If there was an error, log it and return rejected promise execution so it might be used again for retrial
 *
 * @param {Object} [logger]     Custom logger that can be provided
 * @returns {function(*=): Promise<T | {rejectedPromise: *, error: any, status: string}>}
 */

/**
 * File grid panel
 *
 * @namespace   Tine.Filemanager
 * @class       Tine.Filemanager.NodeGridPanel
 * @extends     Tine.widgets.grid.GridPanel
 *
 * <p>Node Grid Panel</p>
 * <p><pre>
 * </pre></p>
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Martin Jatho <m.jatho@metaways.de>
 * @copyright   Copyright (c) 2007-2011 Metaways Infosystems GmbH (http://www.metaways.de)
 *
 * @param       {Object} config
 * @constructor
 * Create a new Tine.Filemanager.FileGridPanel
 */

/**
 * File grid panel
 * 
 * @namespace   Tine.Filemanager
 * @class       Tine.Filemanager.DownloadLinkGridPanel
 * @extends     Tine.widgets.grid.GridPanel
 * 
 * <p>DownloadLink Grid Panel</p>
 * <p><pre>
 * </pre></p>
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
 * 
 * @param       {Object} config
 * @constructor
 * Create a new Tine.Filemanager.FileGridPanel
 */

/**
 * File picker dialog
 * 
 * @namespace   Tine.Filemanager
 * @class       Tine.Filemanager.FilePickerDialog
 * @extends     Tine.Tinebase.dialog.Dialog
 * @constructor
 * @param       {Object} config The configuration options.
 */

/**
 * FilePicker component.
 *
 * Standalone file picker for selecting a node or a folder from _Filemanager_.
 * If you need a generic picker including up/download, attachments, ... use {Tine.Tinebase.widgets.file.SelectionDialog}
 */

/**
 * Filemanager Edit Popup
 *
 * @param   {Object} config
 * @return  {Ext.ux.Window}
 */

/**
 * For provided list of promises and `raceTimeoutInMs` method will execute promises in parallel and wait for the
 * response for certain amount of time. After time is out (based on `raceTimeoutInMs`) caller may decide what response
 * to receive. By default method returns only promises that "won" the timeout race. Otherwise it can return all
 * reflected promises including promises that "lost" the race.
 *
 * @param {Array} listOfPromises                  A list of promises to race against time
 * @param {Number} [raceTimeoutInMs]              The time in milliseconds that each promise will race against
 * @param {String} [raceTimeoutMessage]           A custom message provided for promise which "lost" the race
 * @param {(
 * 'ONLY_RESOLVED' | 'ONLY_WINNER_PROMISES' | 'ALL'
 * )} responseMode                                Different mode will provide different responses,
 *                                                depending on caller requirements.
 * @returns {Promise<any[]>}
 */

/**
 * Node selection combo box
 * 
 * @namespace   Tine.Filemanager
 * @class       Tine.Filemanager.SearchCombo
 * @extends     Ext.form.TriggerField
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Alexander Stintzing <a.stintzing@metaways.de>
 * @author      Michael Spahn <m.spahn@metaways.de>
 * @copyright   Copyright (c) 2012-2017 Metaways Infosystems GmbH (http://www.metaways.de)
 * 
 * @param       {Object} config
 * @constructor
 * Create a new Tine.Filemanager.SearchCombo
 */

/**
 * Recursive Filter
 *
 * @namespace   Tine.Filemanager
 * @class       Tine.Filemanager.RecursiveFilter
 * @extends     Ext.Toolbar
 *
 * @param       {Object} config
 * @constructor
 */

/**
 * This method resolves all promises without failing, logs an error if there is logger provided and displays a final status of executed promise.
 * It can be "resolved" or "rejected". If "rejected", it also provides a reference to rejected function that returns a promise.
 * The purpose is to continue with the execution of all promises even if some of them were rejected
 *
 * @param {Array} listOfPromises      Array of promises, which are mapped into reflect function
 * @param {Object} [logger]           Custom logger that can be provided
 * @returns {Promise<any[]>}
 */

/**
 * Tine 2.0
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Ching En Cheng <c.cheng@metaways.de>
 * @copyright   Copyright (c) 2025 Metaways Infosystems GmbH (http://www.metaways.de)
 *
 */

/**
 * Tine 2.0
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Ching En Cheng <c.cheng@metaways.de>
 * @copyright   Copyright (c) 2025 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/**
 * Tine 2.0
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2017-2018 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/**
 * Tine 2.0
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiß <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2022 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/**
 * Tine 2.0
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiß <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2025 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/**
 * Tine 2.0
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2017-2018 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/**
 * creat folder task
 *
 * - create node in NodeGridPanel
 * @param targetFolderPath
 * @param folders
 * @param existNodeList
 * @returns {Promise<{path, taskId: *}>}
 */

/**
 * create new folder, needs a single folder selection with addGrant
 */

/**
 * create sorted folders from files
 *
 * @param files
 */

/**
 * create tasks for folder creation and file uploads
 *
 * - the priority of folder creation is based on deep level
 
 * @param targetFolderPath
 * @param files
 * @returns {Promise<[]>}
 */

/**
 * create upload file tasks
 *
 * - create node in NodeGridPanel
 * @param targetFolderPath
 * @param filesToUpload
 * @param existNodeList
 * @returns {Promise<void>}
 */

/**
 * download file/folder into browser
 *
 * @param record
 * @param revision
 * @returns {Ext.ux.file.Download}
 *
 */

/**
 * download link backend
 */

/**
 * filter plugin for container tree
 * 
 * @namespace Tine.widgets.tree
 * @class     Tine.Filemanager.PathFilterPlugin
 * @extends   Tine.widgets.grid.FilterPlugin
 */

/**
 * generic exception handler for filemanager
 * 
 * @namespace Tine.Filemanager
 * @param {Tine.Exception} exception
 * @param {Object} request
 */

/**
 * get files to upload from specific folder path
 *
 * @param files
 * @param folder
 */

/**
 * get folder dependency paths
 *
 * @returns {*}
 * @param targetFolderPath
 * @param path
 */

/**
 * grants by model registry
 *
 * @type {{defaultGrants, getByContainer, register}}
 */

/**
 * helper for disabled field
 *
 * @param action
 * @param grants
 * @param records
 * @param isFilterSelect
 * @param filteredContainers
 * @returns {*}
 */

/**
 * one file node with download grant
 */

/**
 * one file node with readGrant
 */

/**
 * one node with publish grant
 * 
 * - user needs both publishGrant and downloadGrant to execute this action.
 */

/**
 * one or multiple file nodes currently upload paused
 */

/**
 * one or multiple file nodes currently uploaded
 */

/**
 * one or multiple file nodes currently uploaded or upload paused
 * @TODO deletes node as well?
 */

/**
 * one or multiple nodes with read, edit AND deleteGrant
 */

/**
 * one or multiple nodes, all need deleteGrant
 */

/**
 * resolve uploadId for file
 *
 * @param targetFolderPath
 * @param files
 */

/**
 * show native file select, upload files, create nodes
 * a single directory node with create grant has to be selected
 * for this action to be active
 * 
 * - allow open node edit dialog with only readGrant,
 * - most panels are readonly if user has no editGrant
 */

/**
 * single file or directory node with editGrant
 */

/**
 * single file or directory node with readGrant
 */

/**
 * upload(files)
 *
 * uploadFiles does:
 * - sorts out which folders to create
 * - creates the uploadFolder and uploadFiles tasks with deps
 * - upload(Folder/File) tasks post messages with postal message bus
 * - gridPanel/treePanel listens to message bus and adds/update files and folders
 * - files have progress and info about transitional state (the (empty) file is not yet created)
 * - folders have transitional state only (not yet created, just in uploadManager)
 */

/***/

/*use SoftQuota*/

//         // arg - does not trigger tree children reload!

//         Tine.Filemanager.nodeBackend.loadRecord(record);

//         var record = this.initialConfig.selections[0];

//        atm. the server can't cope with it -> see #490, #484

//        this.onRecordLoad();

//     app: 'Filemanager',

//     handler: function() {

//     iconCls: 'x-tbar-loading',

//     text: 'Reload', // _('Reload'),

//     }

//    loadRecord: false,

//  * reload

//  */

//  Clear previous selection

// /**

// 3rd party modules

// 5 minutes

// @TODO validate filename

// @TODO: enable box for non admins if not hasOwnNotificationSettings

// @TODO: fixme - ux problems with filterselect / initialData

// @TODO: rethink: do I need delte on the record or parent?

// CONCATENATED MODULE: ./ux/form/FieldTriggerPlugin.js

// DIN A4 and so on

// EXPORTS

// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js

// Exports

// Filemanager_Exception_DestinationIsOwnChild

// Filemanager_Exception_DestinationIsSameNode

// Filemanager_Exception_Quarantined

// For old IE

// Hide filter toolbar

// If no constraints apply, skip here

// If selection doesn't fullfil constraint, we don't throw a selectionChange event

// If there is no admin grant, only allow to edit the own record

// If url is already wrapped in quotes, remove them

// In case there is no own setting, we don't need to persist current values we just empty it

// Minimum information to proceed here

// Module

// NOTE we have to encode the path here because it might contain quotes or other bad chars

// NOTE: atm the activity records are stored as Tinebase_Model_Tree_Node records

// NOTE: custom fields of Tree_Nodes are inherited but mc can't show it

// NOTE: fm tree is initially loaded from grid!

// NOTE: path filter throws an error in not existent

// NOTE: qtip dosn't work, but implementing is not worth the effort...

// NOTE: this could also be solved withe the useGrant method!

// NOTE: we don't expand here any longer - macos and win don't do it either

// Open preview on space if a node is selected and the node type equals file

// Remove properties

// See https://drafts.csswg.org/css-values-3/#urls

// Should url be wrapped?

// Special case to return head of iframe instead of iframe itself

// This will throw an exception if access to iframe is blocked

// Tine.Filemanager.nodeActions.Reload = {

// Tine.Filemanager.nodeActions.UploadFiles = {};

// When reloaded the server is supposed to send the correct inherited values

// _('Copy')

// _('Create Folder')

// _('Delete')

// _('Edit Properties')

// _('Move')

// _('Open Data Safe')

// _('Preview')

// _('Publish')

// _('Rename')

// _('Save locally')

// _('System Link')

// actionType: 'add',

// actionType: 'edit',

// activities and tags

// add / remount node

// add grant for target required

// add grant required

// allways start with an empty filter set!

// always prepare parent's acl node

// announce delete before server delete to improve ux

// apparently config might be empty for shared folders

// as the path of all children changed as well

// attachments preview

// check filtered node if nothing is selected

// check if already in

// cope with attachments

// copy 'real' data to a node record NOTE: not a full record as we have no record reader here

// delete grant required

// do not use basename() here -> recursion!

// do nothing, other nodes has been moved already

// don't allow any actions 

// don't save these records. Add them to the parents' record store

// due to cross-origin restrictions

// edit grant required

// extends Tine.widgets.tree.ContextMenu

// fill potential gaps in folder list as we don't have mkdir -p

// fixme: NodeTreePanel fetches grid via app registry

// generic node actions - work on selections grid/tree nodes

// get uniq folder tree

// grants-grid only - checkboxes have own state

// grid only actions - work on node which is displayed (this.currentFolderNode)

// hfit?

// i18n._('Add')

// i18n._('Admin')

// i18n._('Delete')

// i18n._('Download')

// i18n._('Edit')

// i18n._('Export')

// i18n._('Publish')

// i18n._('Read')

// i18n._('Save locally')

// i18n._('Show in Filemanager')

// i18n._('Sync')

// i18n._('The grant to add records to this container')

// i18n._('The grant to administrate this container')

// i18n._('The grant to delete records in this container')

// i18n._('The grant to download files')

// i18n._('The grant to edit records in this container')

// i18n._('The grant to export records from this container')

// i18n._('The grant to read records of this container')

// i18n._('The grant to synchronise records with this container')

// if state change -> reload

// import a list of modules into the list

// in case of path change we need to reload the node (children) as well

// init actions

// initialLoadAfterRender: false,

// istanbul ignore if

// istanbul ignore next

// legacy for reload action

// local modules

// manage runtime depended grants

// mark this expansion as done and check if all are done

// ngettext('Download Link', 'Download Links', n); gettext('Download Link');

// node core modules

// node specific checks (@TODO what about folders with quarantined contents?)

// note: the exception process needs to be completed before load parent node

// on rowcontextmenu handler

// on selectionchange handler

// only folders allowed in virtual folders

// only show if we have a contributing filter

// overwrite default 503 handling and add a link to the wiki

// preserve space for triggers

// prevent to send accountName here

// private

// register grants for nodes

// remove content filters if indexing is not enabled

// removes temporarily added items

// require('./GrantsPanel');

// reset own filter

// return the list of modules as css string

// run default updater

// safari and chrome use the non std. fileX props

// set all grants and mask other checkboxes

// somehow once a month

// sort folder by deep level

// sort new/edited record

// sourceNode != targetNode && source != direct children of target

// this is important for paging and sort header!

// this.defaultContainerPath = Tine.Tinebase.container.getMyFileNodePath();

// this.hasOwnNotificationSettings.setDisabled(!featureEnabled || !hasRequiredGrant || (hasOwnNotificationSettings && !hasAdminGrant))

// this.updateActions(sm, node);

// try to generate the id here which is used for grid update

// update record in store to prevent concurrency problems

// update the latest filter here, make sure each gridPanel have their own latest filter

// use default secured doc preview panel

// user record

// when user delete virtual node , make sure delete the related tasks in localstorage

// };

//@TODO

//@TODO implement selection vs ctxNode if multiselect is allowed

//@TODO it should be possible to register audio/* video/*

//const useOriginalSizeLimit = 30 * 1024 * 1024; // @TODO have pref or conf, but do we really need this for native browser preview ?

//private

//todo: if record is virtual , disable all actions except the delete action
