Fix problem with "Open link in new window" selection in WebGUI asset tree

link popup plugin to TinyMCE.
This commit is contained in:
Drake 2006-11-07 17:22:53 +00:00
parent f594ec7737
commit 900ec6f724
3 changed files with 13 additions and 11 deletions

View file

@ -28,6 +28,7 @@
- fix: inability to create shortcuts to threads
- fix: Style templates do not render metadata
- fix: Survey duplication not working
- fix: "Open link in new window" with WebGUI asset tree link in TinyMCE
7.1.4
- Template variables in the main Survey Template were out of date in the

View file

@ -167,25 +167,27 @@ sub www_richEditPageTree {
-value=>$i18n->get('done'),
-extras=>'onclick="createLink()"'
);
my $output = ' <fieldset><legend>'.$i18n->get('insert a link').'</legend>'.$f->print.'</fieldset>
my $output = ' <fieldset><legend>'.$i18n->get('insert a link').'</legend>'.$f->print.'</fieldset>'.<<"JS"
<script type="text/javascript">
//<![CDATA[
function createLink() {
if (window.opener) {
if (document.getElementById("url_formId").value == "") {
alert("'.$i18n->get("link enter alert").'");
alert("@{[$i18n->get("link enter alert")]}");
document.getElementById("url_formId").focus();
}
var link = \'<a href="\'+"^" + "/" + ";" + document.getElementById("url_formId").value+\'">\';
link += window.opener.tinyMceSelectedText;
link += \'</a>\';
var link = '<a href="'+"^" + "/" + ";" + document.getElementById("url_formId").value+'"';
var target = document.getElementById('target_formId').value;
if (target != '_self') link += ' target="' + target + '"';
link += '>' + window.opener.tinyMceSelectedText + '</a>';
window.opener.tinyMCE.execCommand("mceInsertContent",false,link);
window.close();
}
}
//]]>
</script>
<fieldset><legend>'.$i18n->get('pages').'</legend> ';
JS
.'<fieldset><legend>'.$i18n->get('pages').'</legend> ';
$output .= '<div class="base">';
my $base = WebGUI::Asset->newByUrl($session) || WebGUI::Asset->getRoot($session);
my @crumb;

View file

@ -2,7 +2,7 @@
tinyMCE.importPluginLanguagePack('pagetree', 'en');
/**
* Returns the HTML contents of the emotions control.
* Returns the HTML contents of the pagetree control.
*/
function TinyMCE_pagetree_getControlHTML(control_name) {
switch (control_name) {
@ -14,7 +14,7 @@ function TinyMCE_pagetree_getControlHTML(control_name) {
}
/**
* Executes the mceEmotion command.
* Executes the wgPageTree command.
*/
var tinyMceSelectedText = '';
function TinyMCE_pagetree_execCommand(editor_id, element, command, user_interface, value) {
@ -26,9 +26,8 @@ function TinyMCE_pagetree_execCommand(editor_id, element, command, user_interfac
tinyMceSelectedText = inst.selection.getSelectedText();
var template = new Array();
//Check for proper get delimiter
var seperator = '';
if (getWebguiProperty ("pageURL").match(/\?/)) { seperator = ';' } else { seperator = '?'}
template['file'] = "../../../../../.." + getWebguiProperty ("pageURL") + seperator + 'op=richEditPageTree';
var separator = getWebguiProperty("pageURL").match(/\?/)? ';' : '?';
template['file'] = "../../../../../.." + getWebguiProperty("pageURL") + separator + 'op=richEditPageTree';
template['width'] = 500;
template['height'] = 500;
tinyMCE.openWindow(template, {editor_id : editor_id, scrollbars : "yes"} );