--- loncom/interface/lonhtmlcommon.pm 2008/06/01 00:04:39 1.175 +++ loncom/interface/lonhtmlcommon.pm 2008/12/12 07:28:09 1.195 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.175 2008/06/01 00:04:39 raeburn Exp $ +# $Id: lonhtmlcommon.pm,v 1.195 2008/12/12 07:28:09 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -62,6 +62,60 @@ use Apache::lonlocal; use Apache::lonnet; use LONCAPA; + +############################################## +############################################## + +=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 < + function mathedit(textarea, doc) { + targetEntry = textarea; + targetDoc = doc; + newwin = window.open("/adm/dragmath/applet/$popup.html","","width=565,height=500,resizable"); + } + + +ENDDRAGMATHJS +} + + ############################################## ############################################## @@ -413,7 +467,7 @@ document.$formname.$dname\_year.value, } ENDJS - $result .= ' '; + $result .= ' '; my $monthselector = qq{