--- loncom/interface/lonhtmlcommon.pm 2007/10/01 18:45:40 1.165
+++ loncom/interface/lonhtmlcommon.pm 2007/11/06 04:39:19 1.169
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.165 2007/10/01 18:45:40 banghart Exp $
+# $Id: lonhtmlcommon.pm,v 1.169 2007/11/06 04:39:19 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -481,6 +481,19 @@ ENDJS
return $result;
}
+
+sub build_url {
+ my ($base, $fields)=@_;
+ my $url;
+ $url = $base.'?';
+ foreach my $key (keys(%$fields)) {
+ $url.=&escape($key).'='.&escape($$fields{$key}).'&';
+ }
+ $url =~ s/&$//;
+ return $url;
+}
+
+
##############################################
##############################################
@@ -1088,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 {
@@ -1146,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);
@@ -1476,7 +1473,14 @@ sub course_select_row {
my ($title,$formname,$totcodes,$codetitles,$idlist,$idlist_titles,
$css_class) = @_;
my $output = &row_title($title,$css_class);
- $output .= qq|
+ $output .= &course_selection($formname,$totcodes,$codetitles,$idlist,$idlist_titles);
+ $output .= &row_closure();
+ return $output;
+}
+
+sub course_selection {
+ my ($formname,$totcodes,$codetitles,$idlist,$idlist_titles) = @_;
+ my $output = qq|