[interchange-cvs] interchange - racke modified 4 files
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Thu Dec 1 16:21:27 EST 2005
User: racke
Date: 2005-12-01 21:21:27 GMT
Modified: . Tag: STABLE_5_4-branch MANIFEST WHATSNEW-5.3
Modified: code/Widget Tag: STABLE_5_4-branch htmlarea.widget
Removed: code/Widget Tag: STABLE_5_4-branch fck.widget
Log:
merge fck widget with htmlarea widget
Revision Changes Path
No revision
No revision
2.185.2.1 +0 -1 interchange/MANIFEST
rev 2.185.2.1, prev_rev 2.185
Index: MANIFEST
===================================================================
RCS file: /var/cvs/interchange/MANIFEST,v
retrieving revision 2.185
retrieving revision 2.185.2.1
diff -u -r2.185 -r2.185.2.1
--- MANIFEST 8 Nov 2005 21:53:06 -0000 2.185
+++ MANIFEST 1 Dec 2005 21:21:27 -0000 2.185.2.1
@@ -296,7 +296,6 @@
code/Widget/date.widget
code/Widget/default.widget
code/Widget/display.widget
-code/Widget/fck.widget
code/Widget/gpg_keys.widget
code/Widget/htmlarea.widget
code/Widget/imagedir.widget
2.22.2.3 +6 -0 interchange/WHATSNEW-5.3
rev 2.22.2.3, prev_rev 2.22.2.2
Index: WHATSNEW-5.3
===================================================================
RCS file: /var/cvs/interchange/WHATSNEW-5.3,v
retrieving revision 2.22.2.2
retrieving revision 2.22.2.3
diff -u -r2.22.2.2 -r2.22.2.3
--- WHATSNEW-5.3 1 Dec 2005 14:56:15 -0000 2.22.2.2
+++ WHATSNEW-5.3 1 Dec 2005 21:21:27 -0000 2.22.2.3
@@ -14,6 +14,12 @@
* Use current time only as default for stock date widget, not for date_blank
widget.
+Widget
+------
+
+* Merge fck widget with htmlarea widget. The rich-text editor can be
+ selected by the HTMLAREA_FLAVOUR variable.
+
Profiles
--------
No revision
No revision
1.6.2.2 +79 -23 interchange/code/Widget/htmlarea.widget
rev 1.6.2.2, prev_rev 1.6.2.1
Index: htmlarea.widget
===================================================================
RCS file: /var/cvs/interchange/code/Widget/htmlarea.widget,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -u -r1.6.2.1 -r1.6.2.2
--- htmlarea.widget 26 Nov 2005 10:02:25 -0000 1.6.2.1
+++ htmlarea.widget 1 Dec 2005 21:21:27 -0000 1.6.2.2
@@ -1,6 +1,6 @@
# Copyright 2005 Interchange Development Group (http://www.icdevgroup.org/)
# Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: htmlarea.widget,v 1.6.2.1 2005/11/26 10:02:25 racke Exp $
+# $Id: htmlarea.widget,v 1.6.2.2 2005/12/01 21:21:27 racke Exp $
CodeDef htmlarea Widget 1
CodeDef htmlarea Description Rich text editor
@@ -22,18 +22,28 @@
=head1 DESCRIPTION
-The C<htmlarea> widget makes calls to HTMLArea, an excellent rich-text
-editor that replaces a C<TEXTAREA> component on supported browsers. It
-operates as a normal textarea otherwise.
+The C<htmlarea> widget makes calls to a rich-text editor that replaces
+a C<TEXTAREA> component on supported browsers. It operates as a normal
+textarea otherwise.
+
+Two flavours of rich-text editors are available, htmlarea (HTMLArea) and
+fckeditor (FCKeditor).
Supported browsers include at least Mozilla 1.3.1 and higher, and
MSIE 6 and higher.
=head1 INSTALLATION
-To install, get HTMLArea-3.0-RC1 or later and install in the C<htmlarea>
-directory of your DocumentRoot. (That means that routines can be accessed
-with a base HREF of C</htmlarea/>.
+The flavour can be selected by the Interchange Variable HTMLAREA_FLAVOUR
+or the flavour option and defaults to htmlarea.
+
+To install the htmlarea flavour, get HTMLArea-3.0-RC1 or later and install
+in the C<htmlarea> directory of your DocumentRoot.
+That means that routines can be accessed with a base HREF of C</htmlarea/>).
+
+To install the fckeditor flavour, get FCKeditor 2.1 or later and install
+in the C<fckeditor> directory of your DocumentRoot.
+That means that routines can be accessed with a base HREF of C</fckeditor/>.
Alternatively, you can set the Interchange Variable HTMLAREA_PATH to
the appropriate path.
@@ -41,7 +51,7 @@
This widget requires Interchange 5.0 and higher.
If you are planning on using it outside of the Interchange UI, you must
-either have the output-style of layout (the "mike" demo) with a
+either have the output-style of layout (the "standard" demo) with a
[scratch meta_header] call in the <HEAD> area, or you must place the
equivalent of the following in the header of any page to use this widget:
@@ -52,9 +62,18 @@
</script>
<script type="text/javascript" src="[scratch tmp_hpath]htmlarea.js"></script>
+For the fckeditor flavour:
+
+ [tmp tmp_hpath][either]__HTMLAREA_PATH__[or]/htmlarea/[/either][/tmp]
+ <script type="text/javascript">
+ _editor_url = "[scratch tmp_hpath]";
+ </script>
+ <script type="text/javascript" src="[scratch tmp_hpath]fckeditor.js"></script>
+
The "en" is the language locale to use. If you use the output-style
layout, this is automatically determined from the Interchange locale.
-You can also override this with the Variable HTMLAREA_LANG.
+You can also override this with the Variable HTMLAREA_LANG. This is not
+applicable for the fckeditor flavour.
=head1 BUGS
@@ -70,6 +89,37 @@
#::logDebug("called kupu widget, value=$opt->{value}");
use vars qw/$Tag/;
+ my %flavours = (htmlarea => {path => '/htmlarea/',
+ header => qq|
+<script type="text/javascript">
+ _editor_url = "{PATH}";
+ _editor_lang = "{LANG}";
+</script>
+<script type="text/javascript" src="{PATH}htmlarea.js"></script>
+|,
+ area => qq|<textarea id="htmlarea_{NAME}" rows="{HEIGHT}" cols={WIDTH} name="{NAME}"{ONMOUSE}>{VALUE}</textarea>|},
+ fckeditor => {path => '/fckeditor/',
+ header => qq|
+<script type="text/javascript" src="{PATH}fckeditor.js"></script>
+<script type="text/javascript">
+ _editor_url = "{PATH}";
+</script>|,
+ pre => qq|<script>
+window.onload = function()
+{
+ var {NAME}FCKeditor = new FCKeditor( '{NAME}' ) ;
+ {NAME}FCKeditor.BasePath = _editor_url ;
+ {NAME}FCKeditor.ReplaceTextarea() ;
+}
+
+</script>
+|,
+ area => qq|<textarea id="{NAME}" rows="{HEIGHT}" cols="{WIDTH}" name="{NAME}">{VALUE}</textarea>|,
+ post => ''
+});
+
+ my $flavour = $opt->{flavour} || $::Variable->{HTMLAREA_FLAVOUR} || 'htmlarea';
+
my $fname = $opt->{form_name} || 'editor';
my $callpage = $opt->{append} || 'special/kupu';
@@ -87,17 +137,11 @@
if(! $::Scratch->{htmlarea_added}) {
$Tag->tmp({ name => 'htmlarea_added', body => 1 });
$::Scratch->{meta_header} ||= '';
- my $path = $::Variable->{HTMLAREA_PATH} || '/htmlarea/';
+ my $path = $::Variable->{HTMLAREA_PATH} || $flavours{$flavour}->{path};
my $lang = $::Variable->{HTMLAREA_LANG} || $::Scratch->{mv_locale} || 'en';
$lang = substr($lang, 0, 2);
$path =~ s:/*$:/:;
- $::Scratch->{meta_header} .= <<EOF;
-<script type="text/javascript">
- _editor_url = "$path";
- _editor_lang = "$lang";
-</script>
-<script type="text/javascript" src="${path}htmlarea.js"></script>
-EOF
+ $::Scratch->{meta_header} .= $Tag->uc_attr_list({hash => {path => $path, lang => $lang}}, $flavours{$flavour}->{header});
}
my $val;
@@ -117,20 +161,32 @@
}
if($Session->{browser} =~ /MSIE/) {
- $pre_scr = qq{
+ if ($flavour eq 'htmlarea') {
+ $pre_scr = qq{
<script>
var htmlarea_needinit_$pname = true;
</script>
};
- $onmouse = qq{ onMouseOver="if(htmlarea_needinit_$pname) { HTMLArea.replace('htmlarea_$pname'$htmlarea_config); htmlarea_needinit_$pname=false }"};
+ $onmouse = qq{ onMouseOver="if(htmlarea_needinit_$pname) { HTMLArea.replace('htmlarea_$pname'$htmlarea_config); htmlarea_needinit_$pname=false }"};
+ }
}
else {
- $post_scr = <<EOF;
+ if ($flavour eq 'fckeditor') {
+ $post_scr = <<EOF;
+
+EOF
+ } else {
+ $post_scr = <<EOF;
<script>
HTMLArea.replace('htmlarea_$pname'$htmlarea_config);
</script>
EOF
+ }
}
+
+ $pre_scr .= $Tag->uc_attr_list({hash => {name => $pname},
+ body => $flavours{$flavour}->{pre}});
+
$opt->{height} =~ s/\D+//;
$opt->{width} =~ s/\D+//;
@@ -141,9 +197,9 @@
my $textra = $opt->{text_class} ? qq{ class="$opt->{text_class}"} : '';
$textra .= qq{ style="$opt->{text_style}"} if $opt->{text_style};
- my $wid = qq{$pre_scr
-<textarea id="htmlarea_$pname" rows=$opt->{height} cols=$opt->{width} name=$pname$onmouse>$val</textarea>
-$post_scr};
+ my $wid = $pre_scr . $Tag->uc_attr_list({hash => {name => $pname,
+ height => $opt->{height}, width => $opt->{width}, mouse => $onmouse,
+ value => $val}, body => $flavours{$flavour}->{area}}) . $post_scr;
return $wid;
}
More information about the interchange-cvs
mailing list