parent
67168fcbff
commit
46058678dd
|
|
@ -23,7 +23,6 @@ import org.librecms.contentsection.ContentItemRepository;
|
||||||
import org.librecms.contentsection.ContentSection;
|
import org.librecms.contentsection.ContentSection;
|
||||||
import org.librecms.contentsection.ContentSectionRepository;
|
import org.librecms.contentsection.ContentSectionRepository;
|
||||||
import org.librecms.contentsection.ContentType;
|
import org.librecms.contentsection.ContentType;
|
||||||
import org.librecms.contentsection.ContentTypeManager;
|
|
||||||
import org.librecms.contentsection.ContentTypeRepository;
|
import org.librecms.contentsection.ContentTypeRepository;
|
||||||
import org.librecms.contentsection.DocumentFolderEntry;
|
import org.librecms.contentsection.DocumentFolderEntry;
|
||||||
import org.librecms.contentsection.Folder;
|
import org.librecms.contentsection.Folder;
|
||||||
|
|
@ -58,7 +57,6 @@ import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.PathParam;
|
import javax.ws.rs.PathParam;
|
||||||
import javax.ws.rs.QueryParam;
|
import javax.ws.rs.QueryParam;
|
||||||
|
|
||||||
import org.librecms.ui.CmsAdminMessages;
|
|
||||||
|
|
||||||
import javax.ws.rs.FormParam;
|
import javax.ws.rs.FormParam;
|
||||||
import javax.ws.rs.POST;
|
import javax.ws.rs.POST;
|
||||||
|
|
@ -518,6 +516,70 @@ public class DocumentFolderController {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("/@rename/{folderPath:(.+)?}")
|
||||||
|
@AuthorizationRequired
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
public String renameFolder(
|
||||||
|
@PathParam("sectionIdentifier") final String sectionIdentifier,
|
||||||
|
@PathParam("folderPath") final String folderPath,
|
||||||
|
@FormParam("folderName") final String folderName
|
||||||
|
) {
|
||||||
|
final Optional<ContentSection> sectionResult = retrieveContentSection(
|
||||||
|
sectionIdentifier
|
||||||
|
);
|
||||||
|
if (!sectionResult.isPresent()) {
|
||||||
|
models.put("sectionIdentifier", sectionIdentifier);
|
||||||
|
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
|
||||||
|
}
|
||||||
|
|
||||||
|
final ContentSection section = sectionResult.get();
|
||||||
|
if (!permissionChecker.isPermitted(
|
||||||
|
ItemPrivileges.EDIT, section.getRootDocumentsFolder()
|
||||||
|
)) {
|
||||||
|
models.put("sectionidentifier", sectionIdentifier);
|
||||||
|
return "org/librecms/ui/contentsection/access-denied.xhtml";
|
||||||
|
}
|
||||||
|
|
||||||
|
final Folder folder;
|
||||||
|
final Optional<Folder> folderResult = folderRepo
|
||||||
|
.findByPath(
|
||||||
|
section,
|
||||||
|
folderPath,
|
||||||
|
FolderType.DOCUMENTS_FOLDER
|
||||||
|
);
|
||||||
|
if (folderResult.isPresent()) {
|
||||||
|
folder = folderResult.get();
|
||||||
|
|
||||||
|
documentFolderModel.setBreadcrumbs(buildBreadcrumbs(folderPath));
|
||||||
|
} else {
|
||||||
|
models.put("contentSection", section.getLabel());
|
||||||
|
models.put("folderPath", folderPath);
|
||||||
|
return "org/librecms/ui/contentsection/documentfolder/documentfolder-not-found.xhtml";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!permissionChecker.isPermitted(ItemPrivileges.EDIT, folder)) {
|
||||||
|
models.put("sectionidentifier", sectionIdentifier);
|
||||||
|
models.put("folderPath", folderPath);
|
||||||
|
return "org/librecms/ui/contentsection/access-denied.xhtml";
|
||||||
|
}
|
||||||
|
|
||||||
|
folder.setName(folderName);
|
||||||
|
folderRepo.save(folder);
|
||||||
|
|
||||||
|
final String[] folderPathTokens = folderPath.split("/");
|
||||||
|
final String returnFolderPath = String.join(
|
||||||
|
"/",
|
||||||
|
Arrays.copyOf(folderPathTokens, folderPathTokens.length - 1)
|
||||||
|
);
|
||||||
|
|
||||||
|
return String.format(
|
||||||
|
"redirect:/%s/documentfolders/%s",
|
||||||
|
sectionIdentifier,
|
||||||
|
returnFolderPath
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private Optional<ContentSection> retrieveContentSection(
|
private Optional<ContentSection> retrieveContentSection(
|
||||||
final String sectionIdentifier
|
final String sectionIdentifier
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -315,10 +315,10 @@
|
||||||
name="folderName"
|
name="folderName"
|
||||||
pattern="^([a-zA-Z0-9-_]*)$"
|
pattern="^([a-zA-Z0-9-_]*)$"
|
||||||
type="text"
|
type="text"
|
||||||
value="" />
|
value="#{row.name}" />
|
||||||
<small class="form-text text-muted"
|
<small class="form-text text-muted"
|
||||||
id="rename-folder-name-help">
|
id="rename-folder-name-help">
|
||||||
#{CmsAdminMessages['contentsection.documentfolder.new_subfolder.name.help']}
|
#{CmsAdminMessages['contentsection.documentfolder.rename_folder.name.help']}
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ contentsection.categories.title=Categories & Page Trees
|
||||||
contentsection.configuration.title=Configuration
|
contentsection.configuration.title=Configuration
|
||||||
contentsection.documentfolder.new_subfolder_dialog.title=Create new subfolder
|
contentsection.documentfolder.new_subfolder_dialog.title=Create new subfolder
|
||||||
contentsection.documentfolder.new_subfolder.name.label=Name
|
contentsection.documentfolder.new_subfolder.name.label=Name
|
||||||
contentsection.documentfolder.new_subfolder.name.help=The new name of the subfolder. May only contain the letters a to z and A to Z, numbers, the dash and the underscore
|
contentsection.documentfolder.new_subfolder.name.help=The name of the new subfolder. May only contain the letters a to z and A to Z, numbers, the dash and the underscore
|
||||||
contentsection.documentfolder.new_subfolder_dialog.submit=Create new subfolder
|
contentsection.documentfolder.new_subfolder_dialog.submit=Create new subfolder
|
||||||
contentsection.documentfolder.new_subfolder_dialog.close=Cancel
|
contentsection.documentfolder.new_subfolder_dialog.close=Cancel
|
||||||
contentsection.documentfolders.root.title=Documents
|
contentsection.documentfolders.root.title=Documents
|
||||||
|
|
@ -90,7 +90,8 @@ contentsection.documentfolder.permissions.dialog.close=Cancel
|
||||||
contentsection.documentfolder.permissions.dialog.submit=Apply changed permissions
|
contentsection.documentfolder.permissions.dialog.submit=Apply changed permissions
|
||||||
contentsection.documentfolder.permissions.dialog.granted_by_inheritence=Granted by inhertitence
|
contentsection.documentfolder.permissions.dialog.granted_by_inheritence=Granted by inhertitence
|
||||||
contentsections.role.not_found=Role {0} not found
|
contentsections.role.not_found=Role {0} not found
|
||||||
contentsection.documentfolder.rename_folder_dialog.title=Rename folder {0}
|
contentsection.documentfolder.rename_folder_dialog.title=Rename folder /{0}
|
||||||
contentsection.documentfolder.rename_folder_dialog.close=Cancel
|
contentsection.documentfolder.rename_folder_dialog.close=Cancel
|
||||||
contentsection.documentfolder.rename_folder_dialog.save=Rename folder
|
contentsection.documentfolder.rename_folder_dialog.save=Rename folder
|
||||||
contentsection.documentfolder.rename_folder.name.label=Name
|
contentsection.documentfolder.rename_folder.name.label=Name
|
||||||
|
contentsection.documentfolder.rename_folder.name.help=The new name of the folder. May only contain the letters a to z and A to Z, numbers, the dash and the underscore
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,8 @@ contentsection.documentfolder.permissions.dialog.close=Abbrechen
|
||||||
contentsection.documentfolder.permissions.dialog.submit=Berechtigungen anwenden
|
contentsection.documentfolder.permissions.dialog.submit=Berechtigungen anwenden
|
||||||
contentsection.documentfolder.permissions.dialog.granted_by_inheritence=Durch \u00fcbergeordnetes Objekt gew\u00e4hrt
|
contentsection.documentfolder.permissions.dialog.granted_by_inheritence=Durch \u00fcbergeordnetes Objekt gew\u00e4hrt
|
||||||
contentsections.role.not_found=Rolle {0} nicht gefunden
|
contentsections.role.not_found=Rolle {0} nicht gefunden
|
||||||
contentsection.documentfolder.rename_folder_dialog.title=Order {0} umbenennen
|
contentsection.documentfolder.rename_folder_dialog.title=Order /{0} umbenennen
|
||||||
contentsection.documentfolder.rename_folder_dialog.close=Abbrechen
|
contentsection.documentfolder.rename_folder_dialog.close=Abbrechen
|
||||||
contentsection.documentfolder.rename_folder_dialog.save=Ordner umbenennen
|
contentsection.documentfolder.rename_folder_dialog.save=Ordner umbenennen
|
||||||
contentsection.documentfolder.rename_folder.name.label=Name
|
contentsection.documentfolder.rename_folder.name.label=Name
|
||||||
|
contentsection.documentfolder.rename_folder.name.help=Der neue Name des Ordners. Darf nur die Buchstaben a bis z und A bis Z, Ziffern, den Bindestrich und den Unterstrich enthalten.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue