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: inability to create shortcuts to threads
- fix: Style templates do not render metadata - fix: Style templates do not render metadata
- fix: Survey duplication not working - fix: Survey duplication not working
- fix: "Open link in new window" with WebGUI asset tree link in TinyMCE
7.1.4 7.1.4
- Template variables in the main Survey Template were out of date in the - 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'), -value=>$i18n->get('done'),
-extras=>'onclick="createLink()"' -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"> <script type="text/javascript">
//<![CDATA[ //<![CDATA[
function createLink() { function createLink() {
if (window.opener) { if (window.opener) {
if (document.getElementById("url_formId").value == "") { if (document.getElementById("url_formId").value == "") {
alert("'.$i18n->get("link enter alert").'"); alert("@{[$i18n->get("link enter alert")]}");
document.getElementById("url_formId").focus(); document.getElementById("url_formId").focus();
} }
var link = \'<a href="\'+"^" + "/" + ";" + document.getElementById("url_formId").value+\'">\'; var link = '<a href="'+"^" + "/" + ";" + document.getElementById("url_formId").value+'"';
link += window.opener.tinyMceSelectedText; var target = document.getElementById('target_formId').value;
link += \'</a>\'; if (target != '_self') link += ' target="' + target + '"';
link += '>' + window.opener.tinyMceSelectedText + '</a>';
window.opener.tinyMCE.execCommand("mceInsertContent",false,link); window.opener.tinyMCE.execCommand("mceInsertContent",false,link);
window.close(); window.close();
} }
} }
//]]> //]]>
</script> </script>
<fieldset><legend>'.$i18n->get('pages').'</legend> '; JS
.'<fieldset><legend>'.$i18n->get('pages').'</legend> ';
$output .= '<div class="base">'; $output .= '<div class="base">';
my $base = WebGUI::Asset->newByUrl($session) || WebGUI::Asset->getRoot($session); my $base = WebGUI::Asset->newByUrl($session) || WebGUI::Asset->getRoot($session);
my @crumb; my @crumb;

View file

@ -2,7 +2,7 @@
tinyMCE.importPluginLanguagePack('pagetree', 'en'); 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) { function TinyMCE_pagetree_getControlHTML(control_name) {
switch (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 = ''; var tinyMceSelectedText = '';
function TinyMCE_pagetree_execCommand(editor_id, element, command, user_interface, value) { 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(); tinyMceSelectedText = inst.selection.getSelectedText();
var template = new Array(); var template = new Array();
//Check for proper get delimiter //Check for proper get delimiter
var seperator = ''; var separator = getWebguiProperty("pageURL").match(/\?/)? ';' : '?';
if (getWebguiProperty ("pageURL").match(/\?/)) { seperator = ';' } else { seperator = '?'} template['file'] = "../../../../../.." + getWebguiProperty("pageURL") + separator + 'op=richEditPageTree';
template['file'] = "../../../../../.." + getWebguiProperty ("pageURL") + seperator + 'op=richEditPageTree';
template['width'] = 500; template['width'] = 500;
template['height'] = 500; template['height'] = 500;
tinyMCE.openWindow(template, {editor_id : editor_id, scrollbars : "yes"} ); tinyMCE.openWindow(template, {editor_id : editor_id, scrollbars : "yes"} );