--- loncom/interface/lonhtmlcommon.pm 2007/10/04 01:16:58 1.166
+++ loncom/interface/lonhtmlcommon.pm 2007/11/02 23:41:01 1.168
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.166 2007/10/04 01:16:58 banghart Exp $
+# $Id: lonhtmlcommon.pm,v 1.168 2007/11/02 23:41:01 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -486,8 +486,8 @@ sub build_url {
my ($base, $fields)=@_;
my $url;
$url = $base.'?';
- foreach my $key(keys(%$fields)) {
- $url.=$key.'='.$$fields{$key}.'&';
+ foreach my $key (keys(%$fields)) {
+ $url.=&escape($key).'='.&escape($$fields{$key}).'&';
}
$url =~ s/&$//;
return $url;
@@ -1101,46 +1101,13 @@ ENDLINK
}
sub htmlareaheaders {
- if (&htmlareablocked()) { return ''; }
- unless (&htmlareabrowser()) { return ''; }
- my $lang='en';
- if (&mt('htmlarea_lang') ne 'htmlarea_lang') {
- $lang=&mt('htmlarea_lang');
- }
+ return if (&htmlareablocked());
+ return if (!&htmlareabrowser());
return (<
-_editor_url='/htmlarea/';
-_editor_lang='$lang';
-
-
-
+
ENDHEADERS
}
-# ------------------------------------------------- Activate additional buttons
-
-sub htmlareaaddbuttons {
- if (&htmlareablocked()) { return ''; }
- unless (&htmlareabrowser()) { return ''; }
- return (<\$','\$ ');
- }
- );
- config.registerButton('ed_math_eqn','LaTeX Equation',
- '/htmlarea/images/ed_math_eqn.gif',false,
- function(editor,id) {
- editor.surroundHTML(
- ' \\n\\\\[','\\\\]\\n ');
- }
- );
- config.toolbar.push(['ed_math','ed_math_eqn']);
-ENDADDBUTTON
-}
-
# ----------------------------------------------------------------- Preferences
sub disablelink {
@@ -1159,16 +1126,33 @@ sub enablelink {
return ''.&mt('Enable WYSIWYG Editor').'';
}
+# ------------------------------------------------- lang to use in html editor
+sub htmlarea_lang {
+ my $lang='en';
+ if (&mt('htmlarea_lang') ne 'htmlarea_lang') {
+ $lang=&mt('htmlarea_lang');
+ }
+ return $lang;
+}
+
# ----------------------------------------- Script to activate only some fields
sub htmlareaselectactive {
my @fields=@_;
unless (&htmlareabrowser()) { return ''; }
if (&htmlareablocked()) { return '
'.&enablelink(@fields); }
- my $output='
".
&disablelink(@fields);