Class: FileList

OCA.Sharing.FileList

Sharing file list. Contains both "shared with others" and "shared with you" modes.

Constructor

new FileList($el, optionsopt)

Parameters:
Name Type Attributes Description
$el container element with existing markup for the #controls and a table
options <optional>
map of options, see other parameters
Properties
Name Type Attributes Description
sharedWithUser boolean <optional>
true to return files shared with the current user, false to return files that the user shared with others. Defaults to false.
linksOnly boolean <optional>
true to return only link shares
Source:

Extends

Members

$el

Top-level container with controls and file list
Inherited From:
Source:

$fileList

List of rows (table tbody)
Inherited From:
Source:

$table

Files table
Inherited From:
Source:

_allowSelection

Whether selection is allowed, checkboxes and selection overlay will be rendered
Overrides:
Source:

_clientSideSort

Whether to do a client side sort. When false, clicking on a table header will call reload(). When true, clicking on a table header will simply resort the list.
Overrides:
Source:

_currentDirectory :String

Current directory
Type:
  • String
Inherited From:
Source:

_detailsView :OCA.Files.DetailsView

Type:
Inherited From:
Source:

_filter :String

If not empty, only files containing this string will be shown
Type:
  • String
Inherited From:
Source:

_selectedFiles :Object.<int, Object>

Map of file id to file data
Type:
Inherited From:
Source:

_selectionSummary :OCA.Files.FileSummary

Summary of selected files.
Type:
Inherited From:
Source:

_sharedWithUser

Whether the list shows the files shared with the user (true) or the files that the user shared with others (false).
Source:

_sort :String

Sort attribute
Type:
  • String
Inherited From:
Source:

_sortComparator :function

Sort comparator function for the current sort
Type:
  • function
Inherited From:
Source:

_sortDirection :String

Sort direction: 'asc' or 'desc'
Type:
  • String
Inherited From:
Source:
Type:
Inherited From:
Source:

dirInfo :OC.Files.FileInfo

Current directory entry
Type:
Inherited From:
Source:

fileActions :OCA.Files.FileActions

File actions handler, defaults to OCA.Files.FileActions
Type:
Inherited From:
Source:

files :Array.<OC.Files.FileInfo>

Array of files in the current folder. The entries are of file data.
Type:
Inherited From:
Source:

filesClient :OC.Files.Client

Files client instance
Type:
Inherited From:
Source:

fileSummary :OCA.Files.FileSummary

Type:
Inherited From:
Source:

initialized :boolean

Whether the file list was initialized already.
Type:
  • boolean
Inherited From:
Source:

Methods

_createRow(fileData, options)

Creates a new table row element using the given file data.
Parameters:
Name Type Description
fileData OC.Files.FileInfo file info attributes
options map of attributes
Overrides:
Source:
Returns:
new tr element (not appended to the table)

_createSummary()

Creates the file summary section
Inherited From:
Source:

_findInsertionIndex(fileData)

Finds the index of the row before which the given fileData should be inserted, considering the current sorting
Parameters:
Name Type Description
fileData OC.Files.FileInfo file info
Inherited From:
Source:

_getIconUrl(fileInfo) → {string}

Returns the icon URL matching the given file info
Parameters:
Name Type Description
fileInfo OC.Files.FileInfo file info
Inherited From:
Source:
Returns:
icon URL
Type
string

_getWebdavProperties()

Returns list of webdav properties to request
Inherited From:
Source:

_initFileActions(fileActions)

Initializes the file actions, set up listeners.
Parameters:
Name Type Description
fileActions OCA.Files.FileActions file actions
Inherited From:
Source:

_makeFilesFromShares(data) → {Array.<OCA.Sharing.SharedFileInfo>}

Converts the OCS API share response data to a file info list
Parameters:
Name Type Description
data Array OCS API share array
Source:
Returns:
array of shared file info
Type
Array.<OCA.Sharing.SharedFileInfo>

_nextPage(animate)

Appends the next page of files into the table
Parameters:
Name Type Description
animate true to animate the new elements
Inherited From:
Source:
Returns:
array of DOM elements of the newly added files

_onClickBreadCrumb()

Event handler when clicking on a bread crumb
Inherited From:
Source:

_onClickDeleteSelected()

Event handler for when clicking on "Delete" for the selected files
Inherited From:
Source:

_onClickDownloadSelected()

Event handler for when clicking on "Download" for the selected files
Inherited From:
Source:

_onClickFile()

Event handler for when clicking on files to select them
Inherited From:
Source:

_onClickFileCheckbox()

Event handler for when clicking on a file's checkbox
Inherited From:
Source:

_onClickHeader()

Event handler when clicking on a table header
Inherited From:
Source:

_onClickSelectAll()

Event handler for when selecting/deselecting all files
Inherited From:
Source:

_onDropOnBreadCrumb()

Event handler when dropping on a breadcrumb
Inherited From:
Source:

_onFileActionsUpdated()

Event handler for when file actions were updated. This will refresh the file actions on the list.
Inherited From:
Source:

_onResize()

Event handler for when the window size changed
Inherited From:
Source:

_onScroll()

Event handler for when scrolling the list container. This appends/renders the next page of entries when reaching the bottom.
Inherited From:
Source:

_onUrlChanged()

Event handler for when the URL changed
Inherited From:
Source:

_renderRow(fileData, optionsopt)

Creates a new row element based on the given attributes and returns it.
Parameters:
Name Type Attributes Description
fileData OC.Files.FileInfo map of file attributes
options Object <optional>
map of attributes
Properties
Name Type Attributes Description
index int <optional>
index at which to insert the element
updateSummary boolean <optional>
true to update the summary after adding (default), false otherwise. Defaults to true.
animate boolean <optional>
true to animate the thumbnail image after load defaults to true.
Overrides:
Source:
Returns:
new tr element (not appended to the table)

_selectFileEl($tr, state)

Selected/deselects the given file element and updated the internal selection cache.
Parameters:
Name Type Description
$tr Object single file row element
state bool true to select, false to deselect
Inherited From:
Source:

_setCurrentDir(targetDir, changeUrl)

Sets the current directory name and updates the breadcrumb.
Parameters:
Name Type Description
targetDir directory to display
changeUrl true to also update the URL, false otherwise (default)
Inherited From:
Source:

_showPermissionDeniedNotification()

Shows a "permission denied" notification
Inherited From:
Source:

_updateDetailsView(fileName, showopt)

Update the details view to display the given file
Parameters:
Name Type Attributes Default Description
fileName string file name from the current list
show boolean <optional>
true whether to open the sidebar if it was closed
Inherited From:
Source:

add(fileData, optionsopt)

Adds an entry to the files array and also into the DOM in a sorted manner.
Parameters:
Name Type Attributes Description
fileData OC.Files.FileInfo map of file attributes
options Object <optional>
map of attributes
Properties
Name Type Attributes Description
updateSummary boolean <optional>
true to update the summary after adding (default), false otherwise. Defaults to true.
silent boolean <optional>
true to prevent firing events like "fileActionsReady", defaults to false.
animate boolean <optional>
true to animate the thumbnail image after load defaults to true.
Inherited From:
Source:
Returns:
new tr element (not appended to the table)

changeDirectory(targetDir, changeUrl, force)

Parameters:
Name Type Description
targetDir target directory (non URL encoded)
changeUrl false if the URL must not be changed (defaults to true)
force boolean set to true to force changing directory
Inherited From:
Source:

createDirectory(name) → {Promise}

Create a directory inside the current directory.
Parameters:
Name Type Description
name string name of the directory
Since:
  • 8.2
Inherited From:
Source:
Returns:
promise that will be resolved after the directory was created
Type
Promise

createFile(name) → {Promise}

Create an empty file inside the current directory.
Parameters:
Name Type Description
name string name of the file
Since:
  • 8.2
Inherited From:
Source:
Returns:
promise that will be resolved after the file was created
Type
Promise

destroy()

Destroy / uninitialize this instance.
Inherited From:
Source:

do_delete(files, dir)

Delete the given files from the given dir
Parameters:
Name Type Description
files file names list (without path)
dir directory in which to delete the files, defaults to the current directory
Inherited From:
Source:

elementToFile($el)

Returns the file data from a given file element.
Parameters:
Name Type Description
$el file tr element
Inherited From:
Source:
Returns:
file data

filter()

Inherited From:
Deprecated:
  • use setFilter(filter)
Source:

findFile(fileName) → {OCA.Files.FileInfo}

Returns the file info for the given file name from the internal collection.
Parameters:
Name Type Description
fileName string file name
Since:
  • 8.2
Inherited From:
Source:
Returns:
file info or null if it was not found
Type
OCA.Files.FileInfo

findFileEl(fileName) → {Object}

Returns the tr element for a given file name, but only if it was already rendered.
Parameters:
Name Type Description
fileName string file name
Inherited From:
Source:
Returns:
jQuery object of the matching row
Type
Object

generatePreviewUrl(urlSpec)

Generates a preview URL based on the URL space.
Parameters:
Name Type Description
urlSpec attributes for the URL
Properties
Name Type Description
x int width
y int height
file String path to the file
Inherited From:
Source:
Returns:
preview URL

getAjaxUrl()

Inherited From:
Deprecated:
  • do not use nor override
Source:

getDirectoryPermissions()

Returns the directory permissions
Overrides:
Source:
Returns:
permission value as integer

getFilter(filter)

get the current filter
Parameters:
Name Type Description
filter
Inherited From:
Source:

getModelForFile(fileName) → {OCA.Files.FileInfoModel}

Returns a unique model for the given file name.
Parameters:
Name Type Description
fileName string | object file name or jquery row
Inherited From:
Source:
Returns:
file info model
Type
OCA.Files.FileInfoModel

getSelectedFiles()

Returns the file info of the selected files
Inherited From:
Source:
Returns:
array of file names

hideMask()

Hide the loading mask.
Inherited From:
Source:
See:

highlightFiles(files, highlightFunctionopt)

Scroll to the last file of the given list Highlight the list of files
Parameters:
Name Type Attributes Description
files array of filenames,
highlightFunction function <optional>
optional function to be called after the scrolling is finished
Inherited From:
Source:

inList(file) → {bool}

Returns whether the given file name exists in the list
Parameters:
Name Type Description
file string file name
Inherited From:
Source:
Returns:
true if the file exists in the list, false otherwise
Type
bool

isAllSelected()

Returns whether all files are selected
Inherited From:
Source:
Returns:
true if all files are selected, false otherwise

isSelectedDeletable()

Check whether all selected files are deletable
Inherited From:
Source:

lazyLoadPreview(path, mime, callback, etag)

Lazy load a file's preview.
Parameters:
Name Type Description
path path of the file
mime mime type
callback callback function to call when the image was loaded
etag file etag (for caching)
Inherited From:
Source:

move(fileNames, targetPath)

Moves a file to a given target folder.
Parameters:
Name Type Description
fileNames array of file names to move
targetPath absolute target path
Inherited From:
Source:

pageSize() → {int}

Number of files per page
Inherited From:
Source:
Returns:
page size
Type
int

registerDetailView()

Register a detail view to be added to all views
Inherited From:
Source:

registerTabView()

Register a tab view to be added to all views
Inherited From:
Source:

reload()

Reloads the file list using ajax call
Overrides:
Source:
Returns:
ajax call object

remove(name, optionsopt)

Removes a file entry from the list
Parameters:
Name Type Attributes Description
name name of the file to remove
options Object <optional>
map of attributes
Properties
Name Type Attributes Description
updateSummary boolean <optional>
true to update the summary after removing, false otherwise. Defaults to true.
Inherited From:
Source:
Returns:
deleted element

rename(oldName)

Triggers file rename input field for the given file name. If the user enters a new name, the file will be renamed.
Parameters:
Name Type Description
oldName file name of the file to rename
Inherited From:
Source:

setDirectoryPermissions()

Inherited From:
Deprecated:
  • Yes
Source:

setFiles(filesArray)

Sets the files to be displayed in the list. This operation will re-render the list and update the summary.
Parameters:
Name Type Description
filesArray array of file data (map)
Inherited From:
Source:

setFilter(filter)

hide files matching the given filter
Parameters:
Name Type Description
filter
Inherited From:
Source:

setPageTitle()

Sets a new page title
Inherited From:
Source:

setSharedWithUser(state)

Set whether the list should contain outgoing shares or incoming shares.
Parameters:
Name Type Description
state true for incoming shares, false otherwise
Source:

setSort(sort, direction, update)

Sets the current sorting and refreshes the list
Parameters:
Name Type Description
sort sort attribute name
direction sort direction, one of "asc" or "desc"
update true to update the list, false otherwise (default)
Inherited From:
Source:

setupUploadEvents()

Setup file upload events related to the file-upload plugin
Inherited From:
Source:

setViewerMode(show)

Enables/disables viewer mode. In viewer mode, apps can embed themselves under the controls bar. In viewer mode, the actions of the file list will be hidden.
Parameters:
Name Type Description
show true for enabling, false for disabling
Inherited From:
Source:

showActions(show)

Shows/hides action buttons
Parameters:
Name Type Description
show true for enabling, false for disabling
Inherited From:
Source:

showDetailsView(fileName, tabIdopt)

Displays the details view for the given file and selects the given tab
Parameters:
Name Type Attributes Description
fileName string file name for which to show details
tabId string <optional>
optional tab id to select
Inherited From:
Source:

showFileBusyState(files, busyopt)

Shows busy state on a given file row or multiple
Parameters:
Name Type Attributes Default Description
files string | Array.<string> file name or array of file names
busy bool <optional>
true busy state, true for busy, false to remove busy state
Since:
  • 8.2
Inherited From:
Source:

showMask()

Shows the loading mask.
Inherited From:
Source:
See:

unfilter()

Inherited From:
Deprecated:
  • use setFilter('')
Source:

updateRow($tr, fileInfo, options) → {Object}

Updates the given row with the given file info
Parameters:
Name Type Description
$tr Object row element
fileInfo OCA.Files.FileInfo file info
options Object options
Inherited From:
Source:
Returns:
new row element
Type
Object

updateSearch()

update the search object to use this filelist when filtering
Inherited From:
Source:

updateSelectionSummary()

Update UI based on the current selection
Inherited From:
Source: