[opencms-dev] rendering external links with attribute target="_blank"
Daniel Wiesner
daniel.wiesner at av-studio.de
Thu May 19 10:55:41 CEST 2005
Xavier,
I'm talking about the InputField in the form based xml-content editor.
In the "External links gallery" users are able to change the target not
so in the OpenCmsHtml .
Daniel
look in the comments:
/------- Additional Comment #1
<http://www.opencms.org/bugzilla/show_bug.cgi?id=57#c1> From Alexander
Kandzior <mailto:a.kandzior at alkacon.com> 2003-08-09 01:50 ------- /
Are you talking about the external links in the "external links gallery"?
/------- Additional Comment #2
<http://www.opencms.org/bugzilla/show_bug.cgi?id=57#c2> From Chase Urich
<mailto:chaseurich at letu.edu> 2003-08-09 02:37 ------- /
Yes, sorry for any confusion. Is there a way to make every link in the "External
Link Gallery" open in a new window by default?
Xavier Ottolini schrieb:
> Hi Daniel
>
> This wish has already been report into the bug tracking system.
> http://www.opencms.org/bugzilla/show_bug.cgi?id=57
>
> Regards,
>
> Wiesner, Daniel a écrit :
>
>> I think the only possible solution is to modify the
>> org.opencms.staticexport.CmsLinkProcessor class. I added this to
>> processLinkTag(LinkTag linkTag)
>>
>> if (linkTag.getAttribute("target") == null && !link.isInternal()){
>> linkTag.setAttribute("target","\"_blank\"");
>> }
>>
>> Now all external links without a target attribute will be opened in a
>> new window.
>>
>> Daniel
>>
>>
>>
>>
>> /**
>> * Process a link tag.<p>
>> *
>> * @param linkTag the tag to process
>> */
>> protected void processLinkTag() {
>>
>> switch (m_mode) {
>>
>> case C_PROCESS_LINKS:
>> if (linkTag.getAttribute("href") != null) {
>> CmsLink link =
>> m_linkTable.getLink(getLinkName(linkTag.getLink()));
>>
>> if (link != null) {
>> linkTag.setLink(processLink(link));
>> //if no targetwindow is assigned and the link
>> is external open a new window
>> if (linkTag.getAttribute("target") == null &&
>> !link.isInternal()){
>> linkTag.setAttribute("target","\"_blank\"");
>> }
>> }
>> }
>> break;
>>
>> case C_REPLACE_LINKS:
>> if (linkTag.getAttribute("href") != null) {
>> String targetUri = linkTag.extractLink();
>>
>> if (CmsStringUtil.isNotEmpty(targetUri)) {
>> String internalUri =
>> CmsLinkManager.getSitePath(m_cms, m_relativePath, targetUri);
>> if (internalUri != null) {
>>
>> linkTag.setLink(replaceLink(m_linkTable.addLink(linkTag.getTagName(),
>> internalUri, true)));
>> } else {
>>
>> linkTag.setLink(replaceLink(m_linkTable.addLink(linkTag.getTagName(),
>> targetUri, false)));
>> }
>> }
>> }
>> break;
>>
>> default:
>> // noop
>> break;
>> }
>> }
>>
>>
>> Wiesner, Daniel schrieb:
>>
>>> hello,
>>>
>>> is there any way to tell ocms 6.0 b3 to automatic render links with the
>>> atribute internal="false" to
>>> <a target="_blank" href="... ?
>>>
>>>
>>> Users don't have a dialog for setting this in pages using the new
>>> xml-content feature. But if they paste text containing links - the
>>> target is
>>> not set at all and so the browser is using the default "_self".
>>>
>>> regards
>>> Daniel
>>>
>>>
>>>
>>> _______________________________________________
>>> This mail is send to you from the opencms-dev mailing list
>>> To change your list options, or to unsubscribe from the list, please
>>> visit
>>> http://mail.opencms.org/mailman/listinfo/opencms-dev
>>>
>>>
>>
>>
>> _______________________________________________
>> This mail is send to you from the opencms-dev mailing list
>> To change your list options, or to unsubscribe from the list, please
>> visit
>> http://mail.opencms.org/mailman/listinfo/opencms-dev
>
>
>
>
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please
> visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
--
-----------------------------------------------------------
AV-Studio Kommunikationsmedien GmbH Halle
Kurallee 13, D-06114 Halle (Saale)
Fon: +49 (0345) 20 999 -0 * Fax: +49 (0345) 20 999 -20
email: office at av-studio.de * http://www.av-studio.de
-----------------------------------------------------------
More information about the opencms-dev
mailing list