Related Link step

pull/10/head
Jens Pelzetter 2021-07-21 21:09:07 +02:00
parent 33c72859ee
commit 30320485d4
8 changed files with 230 additions and 106 deletions

View File

@ -106,7 +106,7 @@ public class ItemAttachmentDto {
return internalLink; return internalLink;
} }
public void setInternalLink(final boolean internalLink) { public void setLink(final boolean internalLink) {
this.internalLink = internalLink; this.internalLink = internalLink;
} }

View File

@ -943,7 +943,7 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
@GET @GET
@Path("/attachmentlists/{attachmentListIdentifier}/links/@create") @Path("/attachmentlists/{attachmentListIdentifier}/links/@create")
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public String createInternalLink( public String createLink(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM) @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier, final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME) @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
@ -990,7 +990,6 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
* @param documentPath * @param documentPath
* @param listIdentifierParam The identifier of the list to which the * @param listIdentifierParam The identifier of the list to which the
* attachment is added. * attachment is added.
* @param name
* @param locale * @param locale
* @param title The title of the new internal link for the * @param title The title of the new internal link for the
* language return by {@link GlobalizationHelper#getNegotiatedLocale() * language return by {@link GlobalizationHelper#getNegotiatedLocale()
@ -1002,17 +1001,15 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
@Path( @Path(
"/attachmentlists/{attachmentListIdentifier}/links/@create") "/attachmentlists/{attachmentListIdentifier}/links/@create")
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public String createInternalLink( public String createLink(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM) @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier, final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME) @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath, final String documentPath,
@PathParam("attachmentListIdentifier") @PathParam("attachmentListIdentifier")
final String listIdentifierParam, final String listIdentifierParam,
@FormParam("targetItemUuid") // @FormParam("name")
final String targetItemUuid, // final String name,
@FormParam("name")
final String name,
@FormParam("locale") @FormParam("locale")
final String locale, final String locale,
@FormParam("title") @FormParam("title")
@ -1037,18 +1034,21 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
} }
final AttachmentList list = listResult.get(); final AttachmentList list = listResult.get();
final Optional<ContentItem> itemResult = itemRepo.findByUuid( // final Optional<ContentItem> itemResult = itemRepo.findByUuid(
targetItemUuid // targetItemUuid
); // );
if (!itemResult.isPresent()) { // if (!itemResult.isPresent()) {
models.put("targetItemUuid", targetItemUuid); // models.put("targetItemUuid", targetItemUuid);
return "org/librecms/ui/contentsection/documents/target-item-not-found.xhtml"; // return "org/librecms/ui/contentsection/documents/target-item-not-found.xhtml";
} // }
final RelatedLink relatedLink = new RelatedLink(); final RelatedLink relatedLink = new RelatedLink();
relatedLink.getTitle().addValue( relatedLink.getTitle().addValue(
globalizationHelper.getNegotiatedLocale(), title globalizationHelper.getNegotiatedLocale(), title
); );
relatedLink.setDisplayName(
title
.toLowerCase(Locale.ROOT)
.replaceAll("\\s*", "-"));
attachmentManager.attachAsset(relatedLink, list); attachmentManager.attachAsset(relatedLink, list);
return buildRedirectPathForStep( return buildRedirectPathForStep(
@ -1126,7 +1126,7 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
if (!linkResult.isPresent()) { if (!linkResult.isPresent()) {
models.put("contentItem", getDocumentPath()); models.put("contentItem", getDocumentPath());
models.put("listIdentifier", listIdentifierParam); models.put("listIdentifier", listIdentifierParam);
models.put("internalLinkUuid", linkUuid); models.put("linkUuid", linkUuid);
return "org/librecms/ui/contentsection/documents/link-asset-not-found.xhtml"; return "org/librecms/ui/contentsection/documents/link-asset-not-found.xhtml";
} }
@ -1139,7 +1139,7 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
link.getBookmark().getDisplayName() link.getBookmark().getDisplayName()
); );
linkDetailsModel.setBookmarkUuid(link.getBookmark().getUuid()); linkDetailsModel.setBookmarkUuid(link.getBookmark().getUuid());
} else { } else if (link.getTargetItem() != null){
linkDetailsModel.setLinkType("internal"); linkDetailsModel.setLinkType("internal");
linkDetailsModel.setTargetItemName( linkDetailsModel.setTargetItemName(
link.getTargetItem().getDisplayName() link.getTargetItem().getDisplayName()
@ -1152,7 +1152,10 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
linkDetailsModel.setTargetItemUuid( linkDetailsModel.setTargetItemUuid(
link.getTargetItem().getUuid() link.getTargetItem().getUuid()
); );
} else {
linkDetailsModel.setLinkType("");
} }
linkDetailsModel.setTitle( linkDetailsModel.setTitle(
link link
.getTitle() .getTitle()
@ -1196,25 +1199,25 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
* @param documentPath * @param documentPath
* @param listIdentifierParam The identifier of the {@link AttachmentList} * @param listIdentifierParam The identifier of the {@link AttachmentList}
* to which the link belongs. * to which the link belongs.
* @param internalLinkUuid The UUID of the link. * @param linkUuid The UUID of the link.
* @param targetItemUuid The UUID of the new target item. * @param targetItemUuid The UUID of the new target item.
* *
* @return A redirect to the details view of the link. * @return A redirect to the details view of the link.
*/ */
@POST @POST
@Path( @Path(
"/attachmentlists/{attachmentListIdentifier}/links/{interalLinkUuid}" "/attachmentlists/{attachmentListIdentifier}/links/{linkUuid}"
) )
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public String updateInternalLinkTarget( public String updateLinkTarget(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM) @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier, final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME) @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath, final String documentPath,
@PathParam("attachmentListIdentifier") @PathParam("attachmentListIdentifier")
final String listIdentifierParam, final String listIdentifierParam,
@PathParam("internalLinkUuid") @PathParam("linkUuid")
final String internalLinkUuid, final String linkUuid,
@FormParam("targetItemUuid") @FormParam("targetItemUuid")
final String targetItemUuid final String targetItemUuid
) { ) {
@ -1251,13 +1254,13 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
.map(ItemAttachment::getAsset) .map(ItemAttachment::getAsset)
.filter(asset -> asset instanceof RelatedLink) .filter(asset -> asset instanceof RelatedLink)
.map(asset -> (RelatedLink) asset) .map(asset -> (RelatedLink) asset)
.filter(link -> link.getUuid().equals(internalLinkUuid)) .filter(link -> link.getUuid().equals(linkUuid))
.findAny(); .findAny();
if (!linkResult.isPresent()) { if (!linkResult.isPresent()) {
models.put("contentItem", getDocumentPath()); models.put("contentItem", getDocumentPath());
models.put("listIdentifier", listIdentifierParam); models.put("listIdentifier", listIdentifierParam);
models.put("internalLinkUuid", internalLinkUuid); models.put("linkUuid", linkUuid);
return "org/librecms/ui/contentsection/documents/internal-link-asset-not-found.xhtml"; return "org/librecms/ui/contentsection/documents/internal-link-asset-not-found.xhtml";
} }
@ -1284,7 +1287,7 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
* @param documentPath * @param documentPath
* @param listIdentifierParam The identifier of the {@link AttachmentList} * @param listIdentifierParam The identifier of the {@link AttachmentList}
* to which the link belongs. * to which the link belongs.
* @param internalLinkUuid The UUID of the link. * @param linkUuid The UUID of the link.
* @param localeParam The locale of the new title value. * @param localeParam The locale of the new title value.
* @param value The localized value. * @param value The localized value.
* *
@ -1292,17 +1295,17 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
*/ */
@POST @POST
@Path( @Path(
"/attachmentlists/{attachmentListIdentifier}/links/{interalLinkUuid}/title/@add") "/attachmentlists/{attachmentListIdentifier}/links/{linkUuid}/title/@add")
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public String addInternalLinkTitle( public String addLinkTitle(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM) @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier, final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME) @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath, final String documentPath,
@PathParam("attachmentListIdentifier") @PathParam("attachmentListIdentifier")
final String listIdentifierParam, final String listIdentifierParam,
@PathParam("internalLinkUuid") @PathParam("linkUuid")
final String internalLinkUuid, final String linkUuid,
@FormParam("locale") @FormParam("locale")
final String localeParam, final String localeParam,
@FormParam("value") @FormParam("value")
@ -1333,13 +1336,13 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
.map(ItemAttachment::getAsset) .map(ItemAttachment::getAsset)
.filter(asset -> asset instanceof RelatedLink) .filter(asset -> asset instanceof RelatedLink)
.map(asset -> (RelatedLink) asset) .map(asset -> (RelatedLink) asset)
.filter(link -> link.getUuid().equals(internalLinkUuid)) .filter(link -> link.getUuid().equals(linkUuid))
.findAny(); .findAny();
if (!linkResult.isPresent()) { if (!linkResult.isPresent()) {
models.put("contentItem", getDocumentPath()); models.put("contentItem", getDocumentPath());
models.put("listIdentifierParam", listIdentifierParam); models.put("listIdentifierParam", listIdentifierParam);
models.put("internalLinkUuid", internalLinkUuid); models.put("linkUuid", linkUuid);
return "org/librecms/ui/contentsection/documents/internal-link-asset-not-found.xhtml"; return "org/librecms/ui/contentsection/documents/internal-link-asset-not-found.xhtml";
} }
@ -1367,7 +1370,7 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
* @param documentPath * @param documentPath
* @param listIdentifierParam The identifier of the {@link AttachmentList} * @param listIdentifierParam The identifier of the {@link AttachmentList}
* to which the link belongs. * to which the link belongs.
* @param internalLinkUuid The UUID of the link. * @param linkUuid The UUID of the link.
* @param localeParam The locale of the title value to update. * @param localeParam The locale of the title value to update.
* @param value The localized value. * @param value The localized value.
* *
@ -1375,17 +1378,17 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
*/ */
@POST @POST
@Path( @Path(
"/attachmentlists/{attachmentListIdentifier}/links/{interalLinkUuid}/title/@edit/{locale}") "/attachmentlists/{attachmentListIdentifier}/links/{linkUuid}/title/@edit/{locale}")
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public String updateInternalLinkTitle( public String updateLinkTitle(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM) @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier, final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME) @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath, final String documentPath,
@PathParam("attachmentListIdentifier") @PathParam("attachmentListIdentifier")
final String listIdentifierParam, final String listIdentifierParam,
@PathParam("internalLinkUuid") @PathParam("linkUuid")
final String internalLinkUuid, final String linkUuid,
@PathParam("locale") @PathParam("locale")
final String localeParam, final String localeParam,
@FormParam("value") @FormParam("value")
@ -1416,13 +1419,13 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
.map(ItemAttachment::getAsset) .map(ItemAttachment::getAsset)
.filter(asset -> asset instanceof RelatedLink) .filter(asset -> asset instanceof RelatedLink)
.map(asset -> (RelatedLink) asset) .map(asset -> (RelatedLink) asset)
.filter(link -> link.getUuid().equals(internalLinkUuid)) .filter(link -> link.getUuid().equals(linkUuid))
.findAny(); .findAny();
if (!linkResult.isPresent()) { if (!linkResult.isPresent()) {
models.put("contentItem", getDocumentPath()); models.put("contentItem", getDocumentPath());
models.put("listIdentifierParam", listIdentifierParam); models.put("listIdentifierParam", listIdentifierParam);
models.put("internalLinkUuid", internalLinkUuid); models.put("linkUuid", linkUuid);
return "org/librecms/ui/contentsection/documents/internal-link-asset-not-found.xhtml"; return "org/librecms/ui/contentsection/documents/internal-link-asset-not-found.xhtml";
} }
@ -1450,25 +1453,25 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
* @param documentPath * @param documentPath
* @param listIdentifierParam The identifier of the {@link AttachmentList} * @param listIdentifierParam The identifier of the {@link AttachmentList}
* to which the link belongs. * to which the link belongs.
* @param internalLinkUuid The UUID of the link. * @param linkUuid The UUID of the link.
* @param localeParam The locale of the value to remove. * @param localeParam The locale of the value to remove.
* *
* @return A redirect to the details view of the link. * @return A redirect to the details view of the link.
*/ */
@POST @POST
@Path( @Path(
"/attachmentlists/{attachmentListIdentifier}/links/{interalLinkUuid}/title/@remove/{locale}" "/attachmentlists/{attachmentListIdentifier}/links/{linkUuid}/title/@remove/{locale}"
) )
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public String removeInternalLinkTitle( public String removeLinkTitle(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM) @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier, final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME) @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath, final String documentPath,
@PathParam("attachmentListIdentifier") @PathParam("attachmentListIdentifier")
final String listIdentifierParam, final String listIdentifierParam,
@PathParam("internalLinkUuid") @PathParam("linkUuid")
final String internalLinkUuid, final String linkUuid,
@PathParam("locale") @PathParam("locale")
final String localeParam final String localeParam
) { ) {
@ -1497,13 +1500,13 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
.map(ItemAttachment::getAsset) .map(ItemAttachment::getAsset)
.filter(asset -> asset instanceof RelatedLink) .filter(asset -> asset instanceof RelatedLink)
.map(asset -> (RelatedLink) asset) .map(asset -> (RelatedLink) asset)
.filter(link -> link.getUuid().equals(internalLinkUuid)) .filter(link -> link.getUuid().equals(linkUuid))
.findAny(); .findAny();
if (!linkResult.isPresent()) { if (!linkResult.isPresent()) {
models.put("contentItem", getDocumentPath()); models.put("contentItem", getDocumentPath());
models.put("listIdentifierParam", listIdentifierParam); models.put("listIdentifierParam", listIdentifierParam);
models.put("internalLinkUuid", internalLinkUuid); models.put("linkUuid", linkUuid);
return "org/librecms/ui/contentsection/documents/internal-link-asset-not-found.xhtml"; return "org/librecms/ui/contentsection/documents/internal-link-asset-not-found.xhtml";
} }
@ -1950,7 +1953,7 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
.getText(assetTypeInfo.getLabelKey()) .getText(assetTypeInfo.getLabelKey())
); );
dto.setAttachmentId(itemAttachment.getAttachmentId()); dto.setAttachmentId(itemAttachment.getAttachmentId());
dto.setInternalLink( dto.setLink(
itemAttachment.getAsset() instanceof RelatedLink itemAttachment.getAsset() instanceof RelatedLink
&& ((RelatedLink) itemAttachment.getAsset()).getTargetItem() && ((RelatedLink) itemAttachment.getAsset()).getTargetItem()
!= null != null

View File

@ -39,7 +39,7 @@
class="modal-content" class="modal-content"
method="post"> method="post">
<div class="modal-header"> <div class="modal-header">
<h4> <h4 id="name-edit-dialog-title">
#{CmsDefaultStepsMessageBundle.getMessage('relatedinfo.attachmentlist.details.name_edit_dialog.title', [CmsAttachmentListDetailsModel.name])} #{CmsDefaultStepsMessageBundle.getMessage('relatedinfo.attachmentlist.details.name_edit_dialog.title', [CmsAttachmentListDetailsModel.name])}
</h4> </h4>
<button aria-label="#{CmsDefaultStepsMessageBundle['relatedinfo.attachmentlist.details.name_edit_dialog.close']}" <button aria-label="#{CmsDefaultStepsMessageBundle['relatedinfo.attachmentlist.details.name_edit_dialog.close']}"

View File

@ -12,7 +12,7 @@
<a class="btn btn-secondary mr-3" <a class="btn btn-secondary mr-3"
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@relatedinfo"> href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@relatedinfo">
<bootstrap:svgIcon icon="arrow-left-circle" /> <bootstrap:svgIcon icon="arrow-left-circle" />
<span>#{CmsDefaultStepsMessageBundle['relatedinfo.links.create.back']}</span> <span class="sr-only">#{CmsDefaultStepsMessageBundle['relatedinfo.links.create.back']}</span>
</a> </a>
<h3> <h3>
#{CmsDefaultStepsMessageBundle.getMessage('relatedinfo.links.create.title', [CmsAttachmentListDetailsModel.name])} #{CmsDefaultStepsMessageBundle.getMessage('relatedinfo.links.create.title', [CmsAttachmentListDetailsModel.name])}
@ -26,22 +26,22 @@
</div> </div>
</c:forEach> </c:forEach>
<form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@relatedinfo/attachmentlists/#{CmsAttachmentListDetailsModel.name}/links/@create" <form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@relatedinfo/attachmentlists/#{attachmentList}/links/@create"
method="post"> method="post">
<bootstrap:formGroupText <!-- <bootstrap:formGroupText
help="#{CmsAssetsStepsDefaultMessagesBundle['createform.name.help']}" help="#{CmsDefaultStepsMessageBundle['relatedinfo.links.name.help']}"
inputId="name" inputId="name"
label="#{CmsAssetsStepsDefaultMessagesBundle['createform.name.label']}" label="#{CmsDefaultStepsMessageBundle['relatedinfo.links.name.label']}"
name="name" name="name"
pattern="^([a-zA-Z0-9_-]*)$" pattern="^([a-zA-Z0-9_-]*)$"
required="true" required="true"
value="#{CmsBookmarkCreateStep.name}" value="#{CmsBookmarkCreateStep.name}"
/> />-->
<bootstrap:formGroupSelect <bootstrap:formGroupSelect
help="#{CmsAssetsStepsDefaultMessagesBundle['createform.initial_locale.help']}" help="#{CmsDefaultStepsMessageBundle['relatedinfo.links.initial_locale.help']}"
inputId="locale" inputId="locale"
label="#{CmsAssetsStepsDefaultMessagesBundle['createform.initial_locale.label']}" label="#{CmsDefaultStepsMessageBundle['relatedinfo.links.initial_locale.label']}"
name="locale" name="locale"
options="#{CmsBookmarkCreateStep.availableLocales}" options="#{CmsBookmarkCreateStep.availableLocales}"
required="true" required="true"
@ -49,9 +49,9 @@
/> />
<bootstrap:formGroupText <bootstrap:formGroupText
help="#{CmsAssetsStepsDefaultMessagesBundle['createform.title.help']}" help="#{CmsDefaultStepsMessageBundle['relatedinfo.links.title.help']}"
inputId="title" inputId="title"
label="#{CmsAssetsStepsDefaultMessagesBundle['createform.title.label']}" label="#{CmsDefaultStepsMessageBundle['relatedinfo.links.title.label']}"
name="title" name="title"
required="true" required="true"
/> />
@ -85,6 +85,18 @@
</div> </div>
</fieldset>--> </fieldset>-->
<div class="buttons">
<a class="btn btn-warning"
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@relatedinfo"
type="button">
#{CmsDefaultStepsMessageBundle['relatedinfo.links.create.cancel']}
</a>
<button class="btn btn-success"
type="submit">
#{CmsDefaultStepsMessageBundle['relatedinfo.links.create.submit']}
</button>
</div>
</form> </form>
</ui:define> </ui:define>

View File

@ -8,22 +8,43 @@
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/authoringstep.xhtml"> <ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/authoringstep.xhtml">
<ui:param name="activePage" value="document" /> <ui:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.internallink.details.title']}" /> <ui:param name="title" value="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.link.details.title']}" />
<ui:define name="authoringStep"> <ui:define name="authoringStep">
<h2> <h2>
#{CmsDefaultStepsMessageBundle['relatedinfo.link.details.title']} #{CmsDefaultStepsMessageBundle['relatedinfo.link.details.title']}
</h2> </h2>
<libreccm:localizedStringEditor addMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@authoringSteps/relatedinfo/attachmentlists/#{list.name}/internal-links/#{CmsInternalLinkDetailsModel.uuid}/title/@add" <libreccm:localizedStringEditor
editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@authoringSteps/relatedinfo/attachmentlists/#{list.name}//internal-links/#{CmsInternalLinkDetailsModel.uuid}/title/@edit" addButtonLabel="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.link.title.add.button_label']}"
editorId="list-title-editor" addDialogCancelLabel="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.link.title.add.cancel']}"
hasUnusedLocales="#{!CmsAttachmentListDetailsModel.unusedDescriptionLocales.isEmpty()}" addDialogLocaleSelectHelp="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.link.title.add.locale.help']}"
objectIdentifier="#{CmsAttachmentListDetailsModel.name}" addDialogLocaleSelectLabel="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.link.title.add.locale.label']}"
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@authoringSteps/relatedinfo/attachmentlists/#{list.name}//internal-links/#{CmsInternalLinkDetailsModel.uuid}/title/@remove" addDialogSubmitLabel="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.link.title.add.submit.label']}"
title="CmsDefaultStepsMessageBundle['relatedinfo.internallink.details.title_editor.title']}" addDialogTitle="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.link.title.add_dialog.title']}"
unusedLocales="#{CmsAttachmentListDetailsModel.unusedDescriptionLocales}" addDialogValueHelp="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.link.title.add.value.help']}"
values="#{CmsAttachmentListDetailsModel.titles}" addDialogValueLabel="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.link.title.add.value.label']}"
addMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@authoringSteps/relatedinfo/attachmentlists/#{CmsLinkDetailsModel.listIdentifier}/links/#{CmsLinkDetailsModel.uuid}/title/@add"
editButtonLabel="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.link.title.edit.button_label']}"
editDialogCancelLabel="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.link.title.edit.cancel']}"
editDialogSubmitLabel="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.link.title.edit.submit']}"
editDialogTitle="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.link.title.edit_dialog.title']}"
editDialogValueHelp="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.link.title.edit.value.help']}"
editDialogValueLabel="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.link.title.edit.value.label']}"
editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@authoringSteps/relatedinfo/attachmentlists/#{CmsLinkDetailsModel.listIdentifier}/links/#{CmsLinkDetailsModel.uuid}/title/@edit"
editorId="link-title-editor"
hasUnusedLocales="#{!CmsLinkDetailsModel.unusedTitleLocales.isEmpty()}"
headingLevel="3"
objectIdentifier="#{CmsLinkDetailsModel.uuid}"
removeButtonLabel="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.link.title.remove.button_label']}"
removeDialogCancelLabel="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.link.title.remove.cancel']}"
removeDialogSubmitLabel="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.link.title.remove.submit']}"
removeDialogText="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.link.title.remove.text']}"
removeDialogTitle="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.link.title.remove.title']}"
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@authoringSteps/relatedinfo/attachmentlists/#{CmsLinkDetailsModel.listIdentifier}/links/#{CmsLinkDetailsModel.uuid}/title/@remove"
title="#{CmsDefaultStepsMessageBundle['relatedinfo.link.details.title_editor.title']}"
unusedLocales="#{CmsLinkDetailsModel.unusedTitleLocales}"
values="#{CmsLinkDetailsModel.title}"
/> />
<form> <form>
@ -32,9 +53,9 @@
<div class="row"> <div class="row">
<legend class="col-form-label col-sm-2 pt-0">#{CmsDefaultStepsMessageBundle['relatedinfo.links.type.label']}</legend> <legend class="col-form-label col-sm-2 pt-0">#{CmsDefaultStepsMessageBundle['relatedinfo.links.type.label']}</legend>
<div class="col-sm-10"> <div class="col-sm-10">
<div class="from-check"> <div class="form-check">
<input <input
checked="#{"internal".equals(selectedType)}" checked="#{'internal'.equals(selectedType)}"
class="form-check-input link-type-select" class="form-check-input link-type-select"
id="linktype-internal" id="linktype-internal"
name="linkType" name="linkType"
@ -42,12 +63,14 @@
value="internal" value="internal"
/> />
<label for="linktype-internal">#{CmsDefaultStepsMessageBundle['relatedinfo.links.type.internal']}</label> <label for="linktype-internal">#{CmsDefaultStepsMessageBundle['relatedinfo.links.type.internal']}</label>
</div>
<div class="form-check">
<input <input
checked="#{"external".equals(selectedType)}" checked="#{'external'.equals(selectedType)}"
class="form-check-input link-type-select" class="form-check-input link-type-select"
id="linktype-internal" id="linktype-internal"
name="linkType" name="linkType"
type="external" type="radio"
value="external" value="external"
/> />
<label for="linktype-internal">#{CmsDefaultStepsMessageBundle['relatedinfo.links.type.external']}</label> <label for="linktype-internal">#{CmsDefaultStepsMessageBundle['relatedinfo.links.type.external']}</label>
@ -75,18 +98,15 @@
buttonText="#{CmsDefaultStepsMessageBundle['relatedinfo.link.details.title.target.select_bookmark']}" buttonText="#{CmsDefaultStepsMessageBundle['relatedinfo.link.details.title.target.select_bookmark']}"
/> />
<librecms:assetPicker <librecms:assetPicker
actionUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@relatedinfo/attachmentlists/#{CmsAttachmentListDetailsModel.name}/links/#{CmsLinkDetailsModel.uuid}/details/@set-target-bookmark" actionUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@relatedinfo/attachmentlists/#{CmsLinkDetailsModel.listIdentifier}/links/#{CmsLinkDetailsModel.uuid}/details/@set-target-bookmark"
assetType="#{CmsLinkDetailsModel.bookmarkType}" assetType="#{CmsLinkDetailsModel.bookmarkType}"
assetPickerId="bookmark-picker" assetPickerId="bookmark-picker"
baseUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@relatedinfo-service" baseUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@relatedinfo-service"
contentSection="#{CmsLinkDetailsModel.sectionName}" contentSection="#{CmsLinkDetailsModel.sectionName}"
formParamName="bookmarkIdentifier" formParamName="bookmarkIdentifier"
/> />
</div> </div>
</ui:define> </ui:define>
</ui:composition> </ui:composition>

View File

@ -166,3 +166,41 @@ relatedinfo.attachmentlists.info.dialog.title=Attachment List {0} Info
relatedinfo.attachmentlists.info.dialog.title.label=Title relatedinfo.attachmentlists.info.dialog.title.label=Title
relatedinfo.attachmentlists.info.dialog.description.label=Description relatedinfo.attachmentlists.info.dialog.description.label=Description
relatedinfo.attachmentlists.info.dialog.close=Close relatedinfo.attachmentlists.info.dialog.close=Close
relatedinfo.links.create.back=Back
relatedinfo.links.create.title=Create a new related link
relatedinfo.links.name.help=The internal name of the related link. Can only contain the letter a to z, A to Z, numbers, the dash ("-") and the underscore ("_").
relatedinfo.links.name.label=Name
relatedinfo.links.initial_locale.help=The locale of the title entered below.
relatedinfo.links.initial_locale.label=Locale
relatedinfo.links.title.help=The title of the related link.
relatedinfo.links.title.label=Title
relatedinfo.links.create.cancel=Cancel
relatedinfo.links.create.submit=Create link
contentsection.documents.relatedinfo.link.details.title=Related Link Details
relatedinfo.link.details.title=Related Link Details
contentsection.documents.relatedinfo.link.title.add.button_label=Add localized title
contentsection.documents.relatedinfo.link.title.add.cancel=Cancel
contentsection.documents.relatedinfo.link.title.add.locale.help=The locale of the localized title.
contentsection.documents.relatedinfo.link.title.add.locale.label=Locale
contentsection.documents.relatedinfo.link.title.add.submit.label=Add localized title
contentsection.documents.relatedinfo.link.title.add_dialog.title=Add localized title
contentsection.documents.relatedinfo.link.title.add.value.help=The localized title of the link.
contentsection.documents.relatedinfo.link.title.add.value.label=Title
contentsection.documents.relatedinfo.link.title.edit.button_label=Edit localized title
contentsection.documents.relatedinfo.link.title.edit.cancel=Cancel
contentsection.documents.relatedinfo.link.title.edit.submit=Save
contentsection.documents.relatedinfo.link.title.edit_dialog.title=Edit localized title
contentsection.documents.relatedinfo.link.title.edit.value.help=The localized title of the link.
contentsection.documents.relatedinfo.link.title.edit.value.label=Title
contentsection.documents.relatedinfo.link.title.remove.button_label=Remove localized title
contentsection.documents.relatedinfo.link.title.remove.cancel=Cancel
contentsection.documents.relatedinfo.link.title.remove.submit=Remove
contentsection.documents.relatedinfo.link.title.remove.text=Are you sure to remove the following localized title:
contentsection.documents.relatedinfo.link.title.remove.title=Remove localized title
relatedinfo.link.details.title_editor.title=Title
relatedinfo.links.type.label=Type
relatedinfo.links.type.internal=Internal link
relatedinfo.links.type.external=External link
relatedinfo.links.type.help=The type of the link. Internal links are linked with another document (content item). External links link to an URL.
relatedinfo.link.details.title.target=Target of the related link
relatedinfo.link.details.title.target.select_bookmark=Select bookmark

View File

@ -166,3 +166,41 @@ relatedinfo.attachmentlists.info.dialog.title=Anhangliste {0} Info
relatedinfo.attachmentlists.info.dialog.title.label=Titel relatedinfo.attachmentlists.info.dialog.title.label=Titel
relatedinfo.attachmentlists.info.dialog.description.label=Beschreibung relatedinfo.attachmentlists.info.dialog.description.label=Beschreibung
relatedinfo.attachmentlists.info.dialog.close=Schlie\u00dfen relatedinfo.attachmentlists.info.dialog.close=Schlie\u00dfen
relatedinfo.links.create.back=Zur\u00fcck
relatedinfo.links.create.title=Neuen weiterf\u00fchrenden Link erzeugen
relatedinfo.links.name.help=Der interne Name des Links. Darf nur die Buchstaben a bis z, A bis Z, Ziffern, die Bindestrich ("-") und den Unterstrich ("_") enthalten.
relatedinfo.links.name.label=Name
relatedinfo.links.initial_locale.help=Die Sprache des Titels.
relatedinfo.links.initial_locale.label=Sprache
relatedinfo.links.title.help=Der Titel des weiterf\u00fchrenden Links.
relatedinfo.links.title.label=Titel
relatedinfo.links.create.cancel=Abbrechen
relatedinfo.links.create.submit=Link anlegen
contentsection.documents.relatedinfo.link.details.title=Weiterf\u00fchrender Link Details
relatedinfo.link.details.title=Weiterf\u00fchrender Link Details
contentsection.documents.relatedinfo.link.title.add.button_label=Lokalisierten Titel hinzuf\u00fcgen
contentsection.documents.relatedinfo.link.title.add.cancel=Abbrechen
contentsection.documents.relatedinfo.link.title.add.locale.help=Die Sprache des lokalisierten Titels.
contentsection.documents.relatedinfo.link.title.add.locale.label=Sprache
contentsection.documents.relatedinfo.link.title.add.submit.label=Lokalisierten Titel hinzuf\u00fcgen
contentsection.documents.relatedinfo.link.title.add_dialog.title=Lokalisierten Titel hinzuf\u00fcgen
contentsection.documents.relatedinfo.link.title.add.value.help=Der lokalisierte Titel des Links.
contentsection.documents.relatedinfo.link.title.add.value.label=Titel
contentsection.documents.relatedinfo.link.title.edit.button_label=Lokaliserten Titel bearbeiten
contentsection.documents.relatedinfo.link.title.edit.cancel=Abbrechen
contentsection.documents.relatedinfo.link.title.edit.submit=Speichern
contentsection.documents.relatedinfo.link.title.edit_dialog.title=Lokaliserten Titel bearbeiten
contentsection.documents.relatedinfo.link.title.edit.value.help=Der lokalisierte Titel des Links.
contentsection.documents.relatedinfo.link.title.edit.value.label=Titel
contentsection.documents.relatedinfo.link.title.remove.button_label=Lokalisierten Titel entfernen
contentsection.documents.relatedinfo.link.title.remove.cancel=Abbrechen
contentsection.documents.relatedinfo.link.title.remove.submit=Entfernen
contentsection.documents.relatedinfo.link.title.remove.text=Sind Sie sicher, dass Sie den folgenden lokaliserten Titel entfernen wollen:
contentsection.documents.relatedinfo.link.title.remove.title=Lokalisierten Titel entfernen
relatedinfo.link.details.title_editor.title=Titel
relatedinfo.links.type.label=Typ
relatedinfo.links.type.internal=Interner Link
relatedinfo.links.type.external=Externener Link
relatedinfo.links.type.help=Der Typ des Links. Interne Links verweisen auf ein anderes Dokument (Content Item). Externe Links verweisen auf eine URL.
relatedinfo.link.details.title.target=Ziel des weiterf\u00fchrenden Links
relatedinfo.link.details.title.target.select_bookmark=Lesezeichen ausw\u00e4hlen

View File

@ -2,7 +2,20 @@ document.addEventListener("DOMContentLoaded", function(event) {
const linkTypes = document.querySelectorAll(".link-type-select"); const linkTypes = document.querySelectorAll(".link-type-select");
for(let i = 0; i < linkTypes.length; i++) { for(let i = 0; i < linkTypes.length; i++) {
linkTypes[i].addEventListener("selected", function(event) { if (linkTypes[i].getAttribute("selected") === "selected") {
const selectedTypeElem = document.querySelector(
`#relatedlink-target-${linkTypes[i].getAttribute("value")}`
);
if (selectedTypeElem) {
const types = document.querySelectorAll(".relatedlink-target");
for(let j = 0; j < types.length; j++) {
types[j].classList.add("d-none");
}
selectedTypeElem.classList.remove("d-none");
}
}
linkTypes[i].addEventListener("input", function(event) {
const target = event.currentTarget as HTMLElement; const target = event.currentTarget as HTMLElement;
const value = target.getAttribute("value"); const value = target.getAttribute("value");