-
-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "Duplicate" feature to mediamanager #1083
base: develop
Are you sure you want to change the base?
Conversation
@damsfx can you add some screenshots? |
@LukeTowers WinterCMS_Mediamanager_Duplicate.webmPopup to give new name (with suggested one) : Popup for multiple selected files or folders : Automatically generated names : "_x" is added to the name of the item to be duplicated, where x is a numeric counter. For example, |
Fantastic @damsfx! What happens if they rename the proposed name in the duplicate file popup to the original name (ignoring the suggested name)? |
@LukeTowers the golden question! The php copy manual says:
So I think it may be the same here. Test needed and if it's the case, maybe ask the user to confirm the overwrite? |
@LukeTowers I can confirm that a file with the same name is overwritten. What solution do you plan to use to solve this problem? |
@damsfx I would say probably start with just throwing an ApplicationException which will popup the error. I'm not sure how we're currently handling it in the rename popup and / or on file upload, maybe take a quick look there and then we can standardize across all three? |
@LukeTowers At this time, both upload and rename actions simply replace an existing file, no errors, no warnings. |
@damsfx thats what I thought, I think there was an issue at some point to fix that by auto renaming to the suffixed form, any thoughts on the approach that we should take for all of the scenarios so that we can standardize on that? I think the options are:
The last option is slightly more difficult to implement but I think is the best option. Do you have any other thoughts or perhaps any options I missed? Also would like to get input from any of the other maintainers if they're available (@bennothommo, @mjauvin, @jaxwilko). |
I would definitely prefer the following option: allow the file put but force a rename to an auto suffixed filename |
I agree with @mjauvin. It's the least intrusive and destructive. If someone wants to be clever with their naming, they will most certainly be skilled enough to find the file with an additional suffix. |
It's hard to say ... Allowing an existing file to be overwritten (without warning) can be an advantage, but it can also be a risk. Having a warning before any file overwrite action would be a bonus, but perhaps this behaviour should be configurable in the backend settings? |
The way it's typically handled in OS level file managers is to present a dialog that asks the user if they want to Replace, Keep Both (auto rename), or Cancel. That would be my preferred way to handle it here, but I'm also fine with defaulting to Keep Both if that's easier to implement to start with. |
@LukeTowers , @mjauvin , @bennothommo |
I prefer to include it in this PR |
looking GREAT! This will be used a lot by my team creating the content |
@AIC-BV As a user likely to use this function a lot, what are your feelings about overwriting files already present with the same name (see previous messages)? |
It can work both ways but I think that the correct way, or the expected UX default behaviour, is to not automatically overwrite it. When you do this in Windows File Explorer it automatically changes the name to 'filename - Copy' which makes sense to me. Just like you did with the _1, _2, _3, ... For me it doesn't need a popup, just the 'version' behind the string. |
-use basename to avoid using `'/'` or DIRECTORY_SEPARATOR php const -less filtering before calling `unique` on files and folders
Add a button for duplicating files or folders in the Media Manager menu bar.
Single item selection:
If a file or folder is selected, the user is prompted for the new name of the duplicated file/folder.
Multiple item selection:
If multiple files and/or folders are selected, a warning is displayed to the user that the files/folders will be duplicated with an automatically generated name.
Automatically generated names :
"-x" is added to the name of the item to be duplicated, where x is a numeric counter.
The folder where the item is located is scanned for occurrences with identical names.
For example,
myfile.pdf
will givemyfile-1.pdf
.If
myfile-1.pdf
is already present, then the new name will bemyfile-2.pdf
.