--- loncom/interface/lonhtmlcommon.pm 2008/07/07 11:02:05 1.176 +++ loncom/interface/lonhtmlcommon.pm 2009/08/13 16:12:51 1.182.4.5 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.176 2008/07/07 11:02:05 foxr Exp $ +# $Id: lonhtmlcommon.pm,v 1.182.4.5 2009/08/13 16:12:51 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -62,41 +62,87 @@ use Apache::lonlocal; use Apache::lonnet; use LONCAPA; - ############################################## ############################################## =pod -=item dragmath +=item confirm_success -Creates a button that will allow dragmath to edit an equation into -a specified textbox. +Successful completion of an operation message - textarea - Name of the text area to edit. =cut +sub confirm_success { + my ($message,$failure)=@_; + if ($failure) { + return ''."\n" + .''.&mt('Error').' '."\n" + .$message."\n" + .''."\n"; + } else { + return ''."\n" + .''.&mt('OK').' '."\n" + .$message."\n" + .''."\n"; + } +} + ############################################## -# TODO: Figure out a way to only emit the mathedit function once. -# per html output document. -# ############################################## -sub dragmath { - my ($textarea) = @_; +=pod + +=item dragmath_button +Creates a button that launches a dragmath popup-window, in which an +expression can be edited and pasted as LaTeX into a specified textarea. + + textarea - Name of the textarea to edit. + helpicon - If true, show a help icon to the right of the button. + +=cut + +sub dragmath_button { + my ($textarea,$helpicon) = @_; + my $help_text; + if ($helpicon) { + $help_text = &Apache::loncommon::help_open_topic('Authoring_Math_Editor'); + } + my $buttontext=&mt('Edit Math'); return < + $help_text +ENDDRAGMATH +} + +############################################## + +=pod + +=item dragmath_js + +Javascript used to open pop-up window containing dragmath applet which +can be used to paste LaTeX into a textarea. + +=cut + +sub dragmath_js { + my ($popup) = @_; + return < + // - -ENDDRAGMATH + +ENDDRAGMATHJS } + ############################################## ############################################## @@ -266,7 +312,7 @@ sub checkbox { $Str .= 'value="'.$value.'"'; } if ($checked) { - $Str .= ' checked="1"'; + $Str .= ' checked="checked"'; } $Str .= ' />'; return $Str; @@ -288,7 +334,7 @@ sub radio { $Str .= 'value="'.$value.'"'; } if ($checked eq $value) { - $Str .= ' checked="1"'; + $Str .= ' checked="checked"'; } $Str .= ' />'; return $Str; @@ -386,6 +432,7 @@ sub date_setter { my $result = "\n\n"; $result .= < +// ENDJS $result .= ' '; @@ -457,23 +505,23 @@ ENDJS unshift(@Months,'If you can read this an error occurred'); if ($includeempty) { $monthselector.=""; } for(my $m = 1;$m <=$#Months;$m++) { - $monthselector .= qq{