Simplified controller for editing department texts.

pull/1/head
Jens Pelzetter 2022-10-03 08:35:38 +02:00
parent 258d6c614f
commit 0f86a8f540
1 changed files with 33 additions and 33 deletions

View File

@ -352,38 +352,38 @@ public class SciDepartmentDescriptionStep extends AbstractMvcAuthoringStep {
}
}
@GET
@Path("/texts/view/{textKey}")
@Transactional(Transactional.TxType.REQUIRED)
@AuthorizationRequired
public String viewDepartmentText(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("textKey")
final String textKey
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getDepartment())) {
textsModel.setSelectedText(textKey);
return "org/scientificcms/contenttypes/scidepartment/ui/texts/view-values.xhtml";
} else {
return documentUi.showAccessDenied(
getContentSection(),
getDepartment(),
messageBundle.getMessage("scidepartment.edit.denied")
);
}
}
// @GET
// @Path("/texts/view/{textKey}")
// @Transactional(Transactional.TxType.REQUIRED)
// @AuthorizationRequired
// public String viewDepartmentText(
// @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
// final String sectionIdentifier,
// @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
// final String documentPath,
// @PathParam("textKey")
// final String textKey
// ) {
// try {
// init();
// } catch (ContentSectionNotFoundException ex) {
// return ex.showErrorMessage();
// } catch (DocumentNotFoundException ex) {
// return ex.showErrorMessage();
// }
//
// if (itemPermissionChecker.canEditItem(getDepartment())) {
// textsModel.setSelectedText(textKey);
//
// return "org/scientificcms/contenttypes/scidepartment/ui/texts/view-values.xhtml";
// } else {
// return documentUi.showAccessDenied(
// getContentSection(),
// getDepartment(),
// messageBundle.getMessage("scidepartment.edit.denied")
// );
// }
// }
@GET
@Path("/texts/view/{textKey}/{locale}")
@ -409,7 +409,7 @@ public class SciDepartmentDescriptionStep extends AbstractMvcAuthoringStep {
textsModel.setSelectedText(textKey);
textsModel.setSelectedLocale(new Locale(localeParam).toString());
return "org/scientificcms/contenttypes/scidepartment/ui/texts/view-text.xhtml";
return "org/scientificcms/contenttypes/scidepartment/ui/texts/view.xhtml";
} else {
return documentUi.showAccessDenied(
getContentSection(),