Added popup toggle for rich edit.
This commit is contained in:
parent
9711a8d299
commit
b51248624c
5 changed files with 105 additions and 12 deletions
|
|
@ -633,6 +633,12 @@ The number of characters tall this form element should be. There should be no re
|
|||
|
||||
The number of characters wide this form element should be. There should be no reason for anyone to specify this.
|
||||
|
||||
=item popupToggle
|
||||
|
||||
Defaults to "0". If set to "1" the rich editor will be a pop-up editor. If set to "0" the rich editor will be inline.
|
||||
|
||||
NOTE: WebGUI uses a great variety of rich editors. Not all of them are capable of inline mode, so even if you leave this set to "0" the editor may be a pop-up anyway.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
@ -653,12 +659,25 @@ sub HTMLArea {
|
|||
} else {
|
||||
my $browser = HTTP::BrowserDetect->new($session{env}{HTTP_USER_AGENT});
|
||||
if ($browser->ie && $browser->version >= 5.5) {
|
||||
$output .= '<script language="Javascript1.2" src="'.$session{config}{extrasURL}
|
||||
.'/htmlArea/editor.js"></script>'."\n";
|
||||
$output .= '<script>'."\n";
|
||||
$output .= '_editor_url = "'.$session{config}{extrasURL}.'/htmlArea/";'."\n";
|
||||
$output .= '</script>'."\n";
|
||||
$htmlArea = 1;
|
||||
if ($_[0]->{popupToggle}) {
|
||||
$output .= '<script language="JavaScript">
|
||||
var formObj;
|
||||
var extrasDir="'.$session{config}{extrasURL}.'";
|
||||
function openEditWindow(obj) {
|
||||
formObj = obj;
|
||||
window.open("'.$session{config}{extrasURL}.'/htmlArea/editor.html","editWindow","width=490,height=400,resizable=1"); }
|
||||
function setContent(content) {
|
||||
formObj.value = content;
|
||||
} </script>';
|
||||
$output .= $button;
|
||||
} else {
|
||||
$output .= '<script language="Javascript1.2" src="'.$session{config}{extrasURL}
|
||||
.'/htmlArea/editor.js"></script>'."\n";
|
||||
$output .= '<script>'."\n";
|
||||
$output .= '_editor_url = "'.$session{config}{extrasURL}.'/htmlArea/";'."\n";
|
||||
$output .= '</script>'."\n";
|
||||
$htmlArea = 1;
|
||||
}
|
||||
} elsif ($browser->ie && $browser->version >= 5) {
|
||||
$output .= '<script language="JavaScript">
|
||||
var formObj;
|
||||
|
|
|
|||
|
|
@ -700,7 +700,7 @@ sub hidden {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 HTMLArea ( name [ label, value, subtext, extras, wrap, rows, columns, uiLevel ] )
|
||||
=head2 HTMLArea ( name [ label, value, subtext, extras, wrap, rows, columns, uiLevel, popupToggle ] )
|
||||
|
||||
Adds an HTML area row to this form. An HTML area is different than a standard text area in that it provides rich edit functionality and some special error trapping for HTML and other special characters.
|
||||
|
||||
|
|
@ -744,6 +744,12 @@ The number of characters wide this form element should be. There should be no re
|
|||
|
||||
The UI level for this field. See the WebGUI developer's site for details. Defaults to "0".
|
||||
|
||||
=item popupToggle
|
||||
|
||||
Defaults to "0". If set to "1" the rich editor will be a pop-up editor. If set to "0" the rich editor will be inline.
|
||||
|
||||
NOTE: WebGUI uses a great variety of rich editors. Not all of them are capable of inline mode, so even if you leave this set to "0" the editor may be a pop-up anyway.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
@ -751,8 +757,8 @@ The UI level for this field. See the WebGUI developer's site for details. Defaul
|
|||
sub HTMLArea {
|
||||
my ($output);
|
||||
my ($self, @p) = @_;
|
||||
my ($name, $label, $value, $subtext, $extras, $wrap, $rows, $columns, $uiLevel) =
|
||||
rearrange([qw(name label value subtext extras wrap rows columns uiLevel)], @p);
|
||||
my ($name, $label, $value, $subtext, $extras, $wrap, $rows, $columns, $uiLevel, $popupToggle) =
|
||||
rearrange([qw(name label value subtext extras wrap rows columns uiLevel popupToggle)], @p);
|
||||
if (_uiLevelChecksOut($uiLevel)) {
|
||||
$output = WebGUI::Form::HTMLArea({
|
||||
"name"=>$name,
|
||||
|
|
@ -760,7 +766,8 @@ sub HTMLArea {
|
|||
"wrap"=>$wrap,
|
||||
"columns"=>$columns,
|
||||
"rows"=>$rows,
|
||||
"extras"=>$extras
|
||||
"extras"=>$extras,
|
||||
"popupToggle"=>$popupToggle
|
||||
});
|
||||
$output .= _subtext($subtext);
|
||||
$output = $self->_tableFormRow($label,$output);
|
||||
|
|
|
|||
|
|
@ -1049,7 +1049,11 @@ sub www_edit {
|
|||
-value=>$endDate,
|
||||
-uiLevel=>9
|
||||
);
|
||||
$f->HTMLArea("description",WebGUI::International::get(85),$_[0]->get("description"));
|
||||
$f->HTMLArea(
|
||||
-name=>"description",
|
||||
-label=>WebGUI::International::get(85),
|
||||
-value=>$_[0]->get("description")
|
||||
);
|
||||
$f->raw($_[1]);
|
||||
$f->submit;
|
||||
return $f->print;
|
||||
|
|
|
|||
63
www/extras/htmlArea/editor.html
Normal file
63
www/extras/htmlArea/editor.html
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<html><head><title>Rich Edit</title>
|
||||
<style type="text/css"><!--
|
||||
body {margin:0pt;border:none;padding:0pt}
|
||||
body, td { font-family: arial; font-size: x-small; }
|
||||
a { color: #0000BB; text-decoration: none; }
|
||||
a:hover { color: #FF0000; text-decoration: underline; }
|
||||
.subhead { font-family: arial, arial; font-size: 18px; font-weight: bold; font-style: italic; }
|
||||
.backtotop { font-family: arial, arial; font-size: xx-small; }
|
||||
.code { background-color: #EEEEEE; font-family: Courier New; font-size: x-small;
|
||||
margin: 5px 0px 5px 0px; padding: 5px;
|
||||
border: black 1px dotted;
|
||||
}
|
||||
|
||||
font { font-family: arial black, arial; font-size: 28px; letter-spacing: -1px; }
|
||||
|
||||
--></style>
|
||||
|
||||
<script language="JavaScript">
|
||||
function doneEditing() {
|
||||
window.blur();
|
||||
window.opener.focus();
|
||||
window.opener.setContent(editor_getHTML('yourFieldNameHere'));
|
||||
window.close();
|
||||
}
|
||||
</script>
|
||||
|
||||
<script language="Javascript1.2"><!-- // load htmlarea
|
||||
_editor_url = ""; // URL to htmlarea files
|
||||
var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
|
||||
document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
|
||||
document.write(' language="Javascript1.2"></scr' + 'ipt>');
|
||||
|
||||
// --></script>
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<form method=POST action="">
|
||||
<div align="center"><a style="color: orange; font-weight:bold; text-decoration: underline;" href="javascript:doneEditing();">Click here when FINISHED EDITING.</a></div>
|
||||
|
||||
<script>
|
||||
document.write('<textarea name="yourFieldNameHere" style="width:100%; height:85%">');
|
||||
document.write(window.opener.formObj.value);
|
||||
document.write('</textarea>');
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
|
||||
<a href="javascript:editor_setHTML('yourFieldNameHere',window.opener.formObj.value);">setHTML</a>
|
||||
|
||||
<script language="javascript1.2">
|
||||
editor_generate('yourFieldNameHere');
|
||||
//editor_setHTML('yourFieldNameHere',window.opener.formObj.value);
|
||||
</script>
|
||||
|
||||
|
||||
</form>
|
||||
</body></html>
|
||||
|
|
@ -51,7 +51,7 @@ this.toolbar = [
|
|||
['Macros','separator'],
|
||||
|
||||
// ['custom1','custom2','custom3','separator'],
|
||||
['popupeditor','about']];
|
||||
['popupeditor']]; //,'about']];
|
||||
|
||||
this.fontnames = {
|
||||
"Arial": "arial, helvetica, sans-serif",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue