Added a checkbox to the Xinha link dialog to make external links open in a new tab/window

git-svn-id: https://svn.libreccm.org/ccm/trunk@3684 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2015-10-11 09:30:02 +00:00
parent 11626c2299
commit e998131935
4 changed files with 167 additions and 150 deletions

View File

@ -17,5 +17,6 @@
"Dimension" : "Dimensionen", "Dimension" : "Dimensionen",
"Width:" : "Breite:", "Width:" : "Breite:",
"Height:" : "Höhe:", "Height:" : "Höhe:",
"Preview" : "Vorschau" "Preview" : "Vorschau",
"New tab/window": "In neuem Tab/Fenster öffnen:"
} }

View File

@ -17,5 +17,6 @@
"Dimension" : "Dimension", "Dimension" : "Dimension",
"Width:" : "Width:", "Width:" : "Width:",
"Height:" : "Height:", "Height:" : "Height:",
"Preview" : "Preview" "Preview" : "Preview",
"New tab/window:": "Open in new tab/window:"
} }

View File

@ -107,6 +107,12 @@
<div class="value"> <div class="value">
<input type="text" name="[href]" id="[href]" value=""/> <input type="text" name="[href]" id="[href]" value=""/>
</div> </div>
<label class="key" for="[newWindow]">
<l10n>New tab/window:</l10n>
</label>
<div class="value">
<input type="checkbox" name="[newWindow]" id="[newWindow]"/>
</div>
</fieldset> </fieldset>
<!-- Evt. für spätere Erweiteung, aber eigentlich sollten Links auf Contact-Items verwendet werden --> <!-- Evt. für spätere Erweiteung, aber eigentlich sollten Links auf Contact-Items verwendet werden -->

View File

@ -20,7 +20,8 @@ OpenCCM.prototype.showLinkDialog = function(link)
type: 'internal', type: 'internal',
ci_name: '', ci_name: '',
ci_href: '', ci_href: '',
href: '' href: '',
target: ''
}; };
if (link && link.tagName.toLowerCase() == 'a') if (link && link.tagName.toLowerCase() == 'a')
@ -47,6 +48,10 @@ OpenCCM.prototype.showLinkDialog = function(link)
data.href = href; data.href = href;
} }
if (link.target === "_blank") {
data.newWindow = "on";
}
} }
// now calling the show method of the Xinha.Dialog object to set the values and show the actual dialog // now calling the show method of the Xinha.Dialog object to set the values and show the actual dialog
@ -97,7 +102,8 @@ OpenCCM.prototype.linkApply = function()
href: '', href: '',
alt: '', alt: '',
title: '', title: '',
class: '' class: '',
target: ''
}; };
// Read needed form values // Read needed form values
@ -116,6 +122,9 @@ OpenCCM.prototype.linkApply = function()
linkAttr.href = values.href; linkAttr.href = values.href;
linkAttr.title = values.title; linkAttr.title = values.title;
linkAttr.class = "linkExternal"; linkAttr.class = "linkExternal";
if (values.newWindow === "on") {
linkAttr.target = "_blank";
}
// Make absolute url // Make absolute url