Now using a natural sort algorithm that is more consistent between JS
and PHP (although not perfect in some corner cases)
- added OC.Util.naturalSortComparator that uses the same algo that was
used for the user list
- changed user list and files list to use OC.Util.naturalSortComparator
- removed toLowerCase() and changed the comparator to use
String.localeCompare()
- added unit tests
- added OC_NaturalSort that is used by OCP\Util::naturalSortCompare()
Added mountType attribute for files/folder to indicated whether they are
regular, external or shared.
The client side then adapts the "Delete" action hint text based on this
information.
Only the mount roots must have the delete icon hint adapted.
To make this detectable on the client side, the mountType can now
be null, "shared", "shared-root", "external" or "external-root".
This also gives room to icon customization on the client side.
Whenever an app needs to register an event late, it does that on the
original file actions object.
Since the file actions that the file list work on is a merged list, not
the original one, the registration event needs to be propagated there as
well.
Reload the files app in case of authentication errors, expired tokens or disabled app
Reloading will triger the full server side handeling of those errors
formatting
fix missing semicolon + some jshint warnings
Whenever file actions are modified, either by registering new actions or
when appending a new page of entries, the sharing app is now notified so
it can correctly refresh the sharing icon status.
Additionally, the core's loadIcons() method is also used to load the
existing shares and also refresh the sharing icons afterwards.
Whenever file actions are registered later, now the file lists are
automatically notified.
Added FileActions.addUpdateListener() to be able to receive such
notifications.
This removes the need for apps to manually call FileActions.display()
after registering new actions.
This fixes issues with race conditions when file actions are
registered after the file list was already rendered.
Rewrote the breadcrumb calculation to be more readable.
Breadcrumb now has a setMaxWidth() method to set the maximum allowed
width which is used to fit the breadcrumbs.
The breadcrumb width is now based on the container width, passed through
setMaxWidth() by the FileList class.
Now using fixed widths for the test crumbs to simulate consistent
widths across browsers which rendering engines might usually yield
different results.
When renaming to an existing file name, blurring the field should not
remove it.
This fix keeps the field until escape is pressed instead of replacing it
with a broken empty space.
When uploading files or folders, they only need to be appended or
updated when their path or a section of their path is inside the current
directory (which happens for folder upload)
Fixes issue where file was appended when dragging on a parent directory
onto the breadcrumb.
Fixes appending issue when uploading folders.
When renaming or deleting a file that is in a subdirectory, performing
the action from the sharing overview or another file list view, the
actual directory of the file must be used instead of the current
directory.
- Fixed renaming and fileActionsReady event
- Added unit tests for shares list
- Fixed public page with defer
- Fixed file actions in sharing overview
- Fixed sharing counterpart list (10 entries max)
- Fixed file path attribute to be used in download action
- Fix sharing list headers
- OC.Share icons now operate on fileList instance
- Fix OC.Share.updateIcon when more than one list in DOM
Legacy file actions are registered by legacy apps through
window.FileActions.register(). These actions can only be used by the
main file list ("all files") because legacy apps can only deal with a
single list / container.
New file actions of compatible apps must be registered through
OCA.Files.fileActions. These will be used for other lists like the
sharing overview.
Fixed versions and sharing actions to use OCA.Files.fileActions, which
makes them available in the sharing overview list.
Added "dir" in file actions handler context so that handlers can know
what the path of the file was without having to look it up from the file
list.
Fixed versions app to use the context.dir instead of the old $('#dir')
element. This makes the versions popup work in the sharing overview.
FileActions can now be clone to be use for separate file list views
without having the side-effect of affecting the main file list view.
Added "Open" action in sharing overview file lists to redirect to the
regular file list when clicking on a folder.
- Fixed detection whether the drop zone is inside the currently visible
table
- Now dragging outside the table does nothing instead of uploading,
because the user might drop on the sidebar
- Added unit tests for the drop handler
- summary is now untouched on rename instead of bogus incrementation
- fixes "Share" status icon by only triggring "fileActionsReady" once
- row is now reinserted even when rename is cancelled, this removes the
hacky/buggy code that tried to rename the element back
- added unit tests to cover the fixed cases
- fixed upload and storage statistics
- fixed infinite scroll to use the correct contain for scroll detection
- fixed unit test that sometimes fail for rename case
- controls are now sticky again
- fixed selection overlay to be aligned with the table
- fixed "select all" checkbox that had id conflicts
- fixed public page
- fixed global actions permissions detection
- fix when URL contains an invalid view id
- viewer mode now hides the sidebar (ex: text editor)
- added unit tests for trashbin
- clean up storage info in template (most is retrieved via ajax call now)
- FileList is now an instantiable class
- FileActions is now in namespace
- added App class for trashbin app
- moved trashbin overrides into classes extending FileList
- replaced many static calls with "this." or "self." to make the classes
reusable/extendable
- new URL parameter "view" to specify which view is shown, for example
"files" or "trashbin"
- added OC.Util.History utility class in core for handling history
- moved URL handling/routing to OCA.Files.App
- popstate will correctly update the current view and notify the view of
the URL change so it can update the current dir
- added JS unitt tests for the trashbin app
- fixed public app to work with the new namespaces
It turns out that the sharing dropdown is embedded into the table row
for some reason.
This fix makes use of a more specific selector for the checkboxes and
file name links to make sure it doesn't spill into any other potential
elements like the sharing dialog.
The file selection is now based on the internal model array
FileList.files instead of the visible checkboxes.
This makes it possible to virtually select files that haven't been
rendered yet (select all, then deselect a visible one)
Added more unit tests for selection (with shift and ctrl as well)
Removed "insert" flag, inserting is by default for FileList.add().
Added "animate" flag to FileList.add().
Added logic to correctly detect when to insert/append elements whenever
the insertion point is visible or not.
Fixed "render next page" logic to work correctly when many pages of
files have been added.
The FileList.files model is now updated with file operations.
Adding files to the list will add to the model first, then to the DOM.
If the insertion point isn't visible yet, the file won't be added to the
DOM until the user scrolls down.
Updated unit tests to include checking for the correct insertion point.
- moved file selection code to FileList
- fix selection summary when all files are selected
- nextPage now auto-selects files if "select all" checkbox is checked
- fixed trashbin to use the same selection logic as FileList
- moved the summary code into a new class FileSummary
- FileSummary is calculated only once, then updated with add/remove
- added new OC.Util namespace for JS utility functions
Directories will not be considered to have an extension, even if a dot is
found.
Stop Scrutinizer being annoyed
But the spaced version looked good!
Stop jsHint being annoyed
These code quality tools are really pestering
- Moved code that replaces the "svg" extension for the given file to
core as OC.Util.replaceSVGIcon.
- Added unit test for OC.Util.replaceSVGIcon
- Moved "replaceSVG" to OC.Util.replaceSVG and deprecated the global
"replaceSVG" function.
- Added alias for SVGSupport() as OC.Util.hasSVGSupport() (for now)
Files app:
- removed file list template, now rendering list from JSON response
- FileList.addFile/addDir is now FileList.add() and takes a JS map with all required
arguments instead of having a long number of function arguments
- added unit tests for many FileList operations
- fixed newfile.php, newfolder.php and rename.php to return the file's
full JSON on success
- removed obsolete/unused undo code
- removed download_url / loading options, now using
Files.getDownloadUrl() for that
- server side now uses Helper::getFileInfo() to prepare file JSON response
- previews are now client-side only
Breadcrumbs are now JS only:
- Added BreadCrumb class to handle breadcrumb rendering and events
- Added unit test for BreadCrumb class
- Moved all relevant JS functions to the BreadCrumb class
Public page now uses ajax to load the file list:
- Added Helper class in sharing app to make it easier to authenticate
and retrieve the file's real path
- Added ajax/list.php to retrieve the file list
- Fixed FileActions and FileList to work with the ajax list
Core:
- Fixed file picker dialog to use the same list format as files app
- When all files are selected, do not send the whole file list
- Download will trigger download for the parent folder, also works
with root
- Delete will send "allfiles" to the server that will find the file
list or the passed directory by itself
- Also fixes a few JSHint warnings in files app
- Added "global" comment on top of files app to suppress warning and
also inform devs about what globals are use
- Refactored download URL building to make it overridable
- Added download URL override in public page
- Added JS unit tests for download URL
- Added OC.redirect() method to facilitate unit testing
When a dir has no delete permission, the draggable isn't initialized on
files. This fix makes sure we don't try to destroy a draggable when it
wasn't inited in the first place.
Fixes#6254
- Refactored file tr lookup into FileList.findFileEl that uses
filterAttr to avoid escaping issues in jQuery selectors
- Fixed versions and sharing app to properly escape file names in
attributes
Whenever a file is renamed, if the extension changes, the mime type and
preview might change. This fix passes the updated info to the client
that updates it.
To prevent having to send the list of all files for deletion, only set a
flag "allfiles". This should make it a bit smoother when deleting 5000+
files.
Also fixes some "empty trash" message issues.
Previously, the storage statistics were always for the root dir.
This means that the upload button would always show the limit for the
root dir, even when uploading to a shared dir or external storage.
This fix adds a "dir" argument to getstoragestats.php.
- show tooltip when violating naming constraints while typing
- when target filename exists on server fallback to dialog to interrupt the users flow because something unexpected went wrong
- fixes#5062
- also fixes some whitespace and codestyle issues in files js
- uses css selector over filterAttr in touched js files
Some files app embed themselves under the controls (like the text
editor). The new method FileList.setViewerMode() makes it possible to
properly show/hide the control buttons using the correct permissions.
Apps using this approach must call setViewerMode(true) when starting and
setViewerMode(false) upon closing to restore the controls.
This is needed for #5284
Creating new files, folders or uploading files now have their sharing
icon updated accordingly.
For this, the global share status list that is cached in
OC.Share.statuses is reused for new files.
Performance should improve as the sharing list is now only loaded once
per navigation session.
In OC.Share, split loadIcons into loadIcons + updateIcons.
Fixes#4977
Ajax loading is not supported yet for public files view.
This fix disabled the history API, ajax loading and ajax directory
switch in public mode until it is implemented properly.
Some apps create URLs to the files app and encode the spaces of a
directory using plus signs.
This fix ensures that plus signs are properly converted back to spaces
when parsing the URL on the JS side.
use places/folder icon,
move link construction to JS,
only show icon on hover,
use 'searchresult' as css class name,
add filter/unfilter methods,
highlight searched files in current filelist
only filter when correct FileList is present
Before this fix, the URL wasn't updated in IE8 when navigating into
folders.
This fix makes use of the hash part of URLs to make this work in IE8,
since IE8 doesn't support the history API nor changing the URL without
redirecting.
From now, both the regular query URL "?dir=somedir" and "#?dir=somedir"
will work in both IE8 and non-IE8 browsers.
In IE8, query based URLs are automatically converted to hash URLs upon
page load. The conversion is done on the server side by redirecting the
user to the updated URL.
When loading a page directly using a hash URL in the form
"#?dir=somedir" in IE8, the server doesn't get the hash, so it will not
return any results in that case and rely on ajax to load the first page.
Frontend:
- The files app list now uses ajax calls to refresh the list.
- Added support the browser back button (history API).
- Added mask + spinner while loading file list
Backend:
- Added utility function in core JS for parsing query strings.
- Moved file list + breadcrumb template data code to helper
functions
- Fixed some file paths in trashbin app to be similar to the files app