added link chooser
This commit is contained in:
parent
e3aae81a0e
commit
84764dfe5d
1 changed files with 25 additions and 8 deletions
|
|
@ -14,25 +14,42 @@ use strict;
|
||||||
use WebGUI::Asset;
|
use WebGUI::Asset;
|
||||||
use WebGUI::HTMLForm;
|
use WebGUI::HTMLForm;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
|
use WebGUI::Style;
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
sub www_richEditPageTree {
|
sub www_richEditPageTree {
|
||||||
my $f = WebGUI::HTMLForm->new(-action=>"#");
|
my $f = WebGUI::HTMLForm->new(-action=>"#",-extras=>'name"linkchooser"');
|
||||||
$f->text(
|
$f->text(
|
||||||
-name=>"url",
|
-name=>"url",
|
||||||
-label=>"URL",
|
-label=>"URL",
|
||||||
-extras=>'id="url"'
|
-extras=>'id="url"'
|
||||||
);
|
);
|
||||||
$f->yesNo(
|
$f->selectList(
|
||||||
-name=>"newWindow",
|
-name=>"target",
|
||||||
-label=>"Open in new window?"
|
-label=>"Target",
|
||||||
|
-options=>{"_self"=>"Open link in same window.","_blank"=>"Open link in new window."},
|
||||||
|
-extras=>'id="target"'
|
||||||
);
|
);
|
||||||
$f->button(
|
$f->button(
|
||||||
-value=>"Done",
|
-value=>"Done",
|
||||||
-extras=>'onclick="window.opener.blah()"'
|
-extras=>'onclick="createLink()"'
|
||||||
);
|
);
|
||||||
my $output = $f->print.'<hr>';
|
WebGUI::Style::setScript($session{config}{extrasURL}."/tinymce/jscripts/tiny_mce/tiny_mce_popup.js",{type=>"text/javascript"});
|
||||||
|
my $output = '<fieldset><legend>Insert A Link</legend>
|
||||||
|
<fieldset><legend>Link Settings</legend>'.$f->print.'</fieldset>
|
||||||
|
<script language="javascript">
|
||||||
|
function createLink() {
|
||||||
|
if (window.opener) {
|
||||||
|
if (document.getElementById("url").value == "") {
|
||||||
|
alert("You must enter a link url");
|
||||||
|
document.getElementById("url").focus();
|
||||||
|
}
|
||||||
|
window.opener.tinyMCE.insertLink("^" + "/" + ";" + document.getElementById("url").value,document.getElementById("target").value);
|
||||||
|
window.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script><fieldset><legend>Pages</legend> ';
|
||||||
my $base = WebGUI::Asset->newByUrl || WebGUI::Asset->getRoot;
|
my $base = WebGUI::Asset->newByUrl || WebGUI::Asset->getRoot;
|
||||||
my @crumb;
|
my @crumb;
|
||||||
my $ancestors = $base->getLineage(["self","ancestors"],{returnQuickReadObjects=>1});
|
my $ancestors = $base->getLineage(["self","ancestors"],{returnQuickReadObjects=>1});
|
||||||
|
|
@ -42,10 +59,10 @@ sub www_richEditPageTree {
|
||||||
$output .= '<p>'.join(" > ", @crumb)."</p>\n";
|
$output .= '<p>'.join(" > ", @crumb)."</p>\n";
|
||||||
my $children = $base->getLineage(["children"],{returnQuickReadObjects=>1});
|
my $children = $base->getLineage(["children"],{returnQuickReadObjects=>1});
|
||||||
foreach my $child (@{$children}) {
|
foreach my $child (@{$children}) {
|
||||||
$output .= '<a href="'.$child->getUrl("op=richEditPageTree").'">(•)</a> <a href="#" onclick="document.getElementById(\'url\').value=\''.$child->getUrl.'\'">'.$child->get("menuTitle").'</a>'."<br />\n";
|
$output .= '<a href="#" onclick="document.getElementById(\'url\').value=\''.$child->get("url").'\'">(•)</a> <a href="'.$child->getUrl("op=richEditPageTree").'">'.$child->get("menuTitle").'</a>'."<br />\n";
|
||||||
}
|
}
|
||||||
$session{page}{useEmptyStyle} = 1;
|
$session{page}{useEmptyStyle} = 1;
|
||||||
return $output;
|
return $output.'</fieldset></fieldset>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue