Skip to content

F gpu 1861 #526

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

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cms-aloha-plugins/src/main/js/gcn/lib/gcn-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* @prop {string=} internalTargetLabel The label/name to where the internal link is referring to
* @prop {number=} internalTargetId The ID of the target element
* @prop {string=} internalTargetType The type of the target element
* @prop {string=} internalTargetLang The language of the target element, if available
* @prop {number=} internalTargetNodeId In which Node the target element resides in
*/
/**
Expand Down Expand Up @@ -291,7 +292,7 @@ define('gcn/gcn-links', [
element.setAttribute(ATTR_URL, data.url.href);
element.setAttribute(ATTR_HREF, link);
element.setAttribute(ATTR_ANCHOR, data.url.anchor);
element.setAttribute(ATTR_HREF_LANG, data.lang);
element.setAttribute(ATTR_HREF_LANG, data.lang || data.url.internalTargetLang);
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,23 @@
"hideInEditor" : false,
"externalEditorUrl" : "",
"regexId" : 0
}, {
"globalId" : "A547.85233",
"name" : {
"de" : "Sprache",
"en" : "Language"
},
"keyword" : "language",
"editable" : true,
"typeId" : 1,
"order" : 10,
"mlId" : 0,
"visible" : false,
"required" : false,
"inlineEditable" : false,
"hideInEditor" : false,
"externalEditorUrl" : "",
"regexId" : 0
} ],
"category" : {
"globalId" : "3D6C.351d4688-4aee-11ed-9fbf-482ae36fb1c5",
Expand All @@ -161,4 +178,4 @@
},
"sortOrder" : 1
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{#gtx_alohalink cms.tag cms.rendermode ~}}
<a{{{title}}}{{{target}}}{{{class}}}{{{data}}} href="{{{href}}}">{{cms.tag.parts.text.text}}</a>
{{~/gtx_alohalink}}
<a{{{title}}}{{{target}}}{{{class}}}{{{language}}}{{{data}}} href="{{{href}}}">{{cms.tag.parts.text.text}}</a>
{{~/gtx_alohalink}}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,24 @@ function gtx_alohalink(tag, renderMode, options) {
} else {
ctx['target'] = ' target="_blank" rel="noopener noreferrer"'
}

}

if (parts.language.text) {
ctx['language'] = ' hreflang="' + parts.language.text + '"';
}
if (parts.title.text) {
ctx['title'] = ' title="' + encodeURIComponent(parts.title.text) + '"';
ctx['title'] = ' title="'
+ parts.title.text
.replaceAll(/([\s]+)/, ' ')
.replaceAll('&', '&amp;')
.replaceAll('"', '&quot;')
.replaceAll('\'', '&apos;')
.replaceAll('<', '&lt;')
.replaceAll('>', '&gt;')
.replaceAll('\\', '&bsol;')
.replaceAll(':', '&col;')
.replaceAll('(', '&lpar;')
.replaceAll(')', '&rpar;')
+ '"';
}

if (parts.class.text) {
Expand All @@ -29,10 +42,14 @@ function gtx_alohalink(tag, renderMode, options) {
let href = '';

if (url.target && url.target.id) {
// Set the language only then, if no language has been saved yet.
if (!parts.language.text && url.target.language && url.target.language.code) {
ctx['language'] = ' hreflang="' + url.target.language.code + '"';
}
ctx['data'] = ' data-gentics-aloha-repository="com.gentics.aloha.GCN.Page" data-gentics-aloha-object-id="10007.' + url.target.id + '" data-gentics-aloha-object-online="' + url.target.online + '"';
href = url.target.url;
} else {
if (!/^https?:\/\/$/.test(url.externalurl)) {
if (/^(https|http):\/\/(.*)$/.test(url.externalurl)) {
ctx['data'] = ' data-gentics-gcn-url="' + encodeURIComponent(url.externalurl) + '"';
href = url.externalurl;
}
Expand Down Expand Up @@ -73,4 +90,4 @@ function gtx_alohalink(tag, renderMode, options) {
ctx['href'] = href.trim();

return options.fn(ctx);
}
}
2 changes: 2 additions & 0 deletions cms-oss-doc/src/main/source/aloha_gcn_alohapagelink.textile
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ WARNING: Do not overwrite the "anchorLinks setting":http://www.alohaeditor.org/g

h3. Aloha Page Link Language set

_Starting from CMS 6.3, the language support in Aloha Page links is already built-in and needs no additional changes. As this change cannot be applied to the older CMS installations, below are the instructions for those to achieve this functionality._

A special part-type may be defined, which will be used by Aloha to add language to link tags.

NOTE: For external links the user can choose the language in the link sidebar menu. For internal links, the language of the page will be used instead.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export class AlohaLinkTargetRendererComponent
internalTargetLabel: pickedItem?.name || '',
internalTargetId: pickedItem?.id,
internalTargetType: pickedItem?.type,
internalTargetLang: (pickedItem as any)?.language || '',
internalTargetNodeId: (pickedItem as any)?.nodeId,
});
});
Expand Down
1 change: 1 addition & 0 deletions cms-ui/libs/aloha-models/src/lib/components/link-target.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface ExtendedLinkTarget extends LinkTarget {
internalTargetLabel?: string;
internalTargetId?: number;
internalTargetType?: string;
internalTargetLang?: string;
internalTargetNodeId?: number;
}

Expand Down