[LON-CAPA-cvs] cvs: loncom /homework inputtags.pm /interface lonhtmlcommon.pm spellcheck.pm /xml lonplot.pm doc/loncapafiles loncapafiles.lpml
foxr
foxr at source.lon-capa.org
Mon Sep 10 05:51:15 EDT 2012
foxr Mon Sep 10 09:51:15 2012 EDT
Modified files:
/doc/loncapafiles loncapafiles.lpml
/loncom/homework inputtags.pm
/loncom/interface lonhtmlcommon.pm spellcheck.pm
/loncom/xml lonplot.pm
Log:
bz838 - add spellchecking to <input type='text'> and <textarea>
-------------- next part --------------
Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.809 doc/loncapafiles/loncapafiles.lpml:1.810
--- doc/loncapafiles/loncapafiles.lpml:1.809 Sat Aug 25 04:35:54 2012
+++ doc/loncapafiles/loncapafiles.lpml Mon Sep 10 09:50:47 2012
@@ -2,7 +2,7 @@
"http://lpml.sourceforge.net/DTD/lpml.dtd">
<!-- loncapafiles.lpml -->
-<!-- $Id: loncapafiles.lpml,v 1.809 2012/08/25 04:35:54 raeburn Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.810 2012/09/10 09:50:47 foxr Exp $ -->
<!--
@@ -686,6 +686,33 @@
<description>JQuery countdown timer</description>
</directory>
+<!-- JQuery spellchecker plugin -->
+
+<directory dist='default'>
+ <protectionlevel>modest_delete</protectionlevel>
+ <targetdir dist='default'>/home/httpd/html/adm/spellchecker</targetdir>
+ <categoryname>server readonly</categoryname>
+ <description>JQuery spellchecker plugin</description>
+</directory>
+<directory dist='default'>
+ <protectionlevel>modest_delete</protectionlevel>
+ <targetdir dist='default'>/home/httpd/html/adm/spellchecker/js</targetdir>
+ <categoryname>server readonly</categoryname>
+ <description>JQuery spellchecker plugin</description>
+</directory>
+<directory dist='default'>
+ <protectionlevel>modest_delete</protectionlevel>
+ <targetdir dist='default'>/home/httpd/html/adm/spellchecker/css</targetdir>
+ <categoryname>server readonly</categoryname>
+ <description>JQuery spellchecker plugin</description>
+</directory>
+<directory dist='default'>
+ <protectionlevel>modest_delete</protectionlevel>
+ <targetdir dist='default'>/home/httpd/html/adm/spellchecker/img</targetdir>
+ <categoryname>server readonly</categoryname>
+ <description>JQuery spellchecker plugin</description>
+</directory>
+
<directory dist='default'>
<protectionlevel>modest_delete</protectionlevel>
@@ -805,6 +832,7 @@
<categoryname>server readonly</categoryname>
<description>error warnings and icons</description>
</directory>
+
<directory dist='default'>
<protectionlevel>never_delete</protectionlevel>
<targetdir dist='default'>home/httpd/lonUsers</targetdir>
@@ -1535,6 +1563,15 @@
</fileglob>
<file>
+ <source>loncom/interface/spellcheck.pm</source>
+ <target dist='default'>home/httpd/lib/perl/Apache/spellcheck.pm</target>
+ <categoryname>handler</categoryname>
+ <description>
+Ajax handler for the spellcheck Jquery plugin
+ </description>
+ <status>IN testing</status>
+</file>
+<file>
<source>loncom/homework/insertlist.xml</source>
<target dist='default'>home/httpd/lonTabs/insertlist.xml</target>
<categoryname>static conf</categoryname>
@@ -4755,6 +4792,58 @@
</fileglob>
+<!-- JQuery spellchecker plugin -->
+
+<fileglob>
+ <glob>*.js</glob>
+ <sourcedir>loncom/html/adm/spellcheck/js/</sourcedir>
+ <targetdir dist='default'>home/httpd/html/adm/spellchecker/js/</targetdir>
+ <categoryname>interface file</categoryname>
+ <description>
+ JQuery spellchecker plugin
+ </description>
+ <filenames>
+ jquery.spellcheck.min.js
+ </filenames>
+</fileglob>
+<fileglob>
+ <glob>*.css</glob>
+ <sourcedir>loncom/html/adm/spellcheck/css/</sourcedir>
+ <targetdir dist='default'>home/httpd/html/adm/spellchecker/css/</targetdir>
+ <categoryname>interface file</categoryname>
+ <description>
+ JQuery spellchecker plugin
+ </description>
+ <filenames>
+ spellchecker.css
+ </filenames>
+</fileglob>
+<fileglob>
+ <glob>*.png</glob>
+ <sourcedir>loncom/html/adm/spellcheck/img/</sourcedir>
+ <targetdir dist='default'>home/httpd/html/adm/spellchecker/img/</targetdir>
+ <categoryname>interface file</categoryname>
+ <description>
+ JQuery spellchecker plugin
+ </description>
+ <filenames>
+ spellchecker_shadow.png
+ spellchecker.png
+ </filenames>
+</fileglob>
+<fileglob>
+ <glob>*.gif</glob>
+ <sourcedir>loncom/html/adm/spellcheck/img/</sourcedir>
+ <targetdir dist='default'>home/httpd/html/adm/spellchecker/img/</targetdir>
+ <categoryname>interface file</categoryname>
+ <description>
+ JQuery spellchecker plugin
+ </description>
+ <filenames>
+ spellchecker_bg.gif
+ </filenames>
+</fileglob>
+
<fileglob>
<glob>*.*</glob>
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.307 loncom/homework/inputtags.pm:1.308
--- loncom/homework/inputtags.pm:1.307 Tue Aug 21 18:24:28 2012
+++ loncom/homework/inputtags.pm Mon Sep 10 09:50:57 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# input definitons
#
-# $Id: inputtags.pm,v 1.307 2012/08/21 18:24:28 raeburn Exp $
+# $Id: inputtags.pm,v 1.308 2012/09/10 09:50:57 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -197,9 +197,11 @@
if ($addchars) {
$result.=&addchars('HWVAL_'.$resid,$addchars);
}
- my $textareaclass = 'class="LC_richDetectHtml"';
- $result.= '<textarea wrap="hard" name="HWVAL_'.$resid.'" id="HWVAL_'.$resid.'" '.
- 'rows="'.$rows.'" cols="'.$cols.'" '.$textareaclass.'>'.
+ my $textareaclass = 'class="LC_richDetectHtml spellchecked"';
+ $result.= '<textarea wrap="hard" name="HWVAL_'.$resid.'" id="HWVAL_'.$resid.'" ' .
+ 'rows="'.$rows.'" cols="'.$cols.'" '.$textareaclass
+ . "onblur='\$(this).spellchecker(\"check\")'"
+ .'>'.
&HTML::Entities::encode($oldresponse,'<>&"');
if ($oldresponse ne '') {
@@ -381,7 +383,8 @@
$name = "none";
}
$result.= '<input onkeydown="javascript:setSubmittedPart(\''.$partid.'\');" type="text" '.$readonly.' name="'.$name.'" value="'.
- $oldresponse.'" size="'.$size.'"'.$maxlength.' />';
+ $oldresponse.'" class="spellchecked" size="'.$size.'"'.$maxlength.'
+ onblur=' . "'\$(this).spellchecker(\"check\")'" . '/>';
}
if ($Apache::lonhomework::type eq 'exam'
&& &needs_exam_box($tagstack)) {
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.321 loncom/interface/lonhtmlcommon.pm:1.322
--- loncom/interface/lonhtmlcommon.pm:1.321 Tue Sep 4 11:01:54 2012
+++ loncom/interface/lonhtmlcommon.pm Mon Sep 10 09:51:06 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.321 2012/09/04 11:01:54 foxr Exp $
+# $Id: lonhtmlcommon.pm,v 1.322 2012/09/10 09:51:06 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1212,7 +1212,7 @@
<script type="text/javascript" src="/adm/countdown/js/jquery.countdown.js"></script>
<link rel="stylesheet" type="text/css" href="/adm/countdown/css/jquery.countdown.css" />
-<script type="text/javascript" src="/adm/spellchecker/js/jquery.spellchecker.min.js"></script>
+<script type="text/javascript" src="/adm/spellchecker/js/jquery.spellchecker.js"></script>
<link rel="stylesheet" type="text/css" href="/adm/spellchecker/css/spellchecker.css" />
ENDJQUERY
@@ -1402,6 +1402,30 @@
});
}
});
+
+ /* This code describes the spellcheck options that will be used for
+ items with class 'spellchecked'. It is necessary for those objects'
+ to explicitly request checking (e.g. onblur is a nice event for that).
+ */
+ \$(document).ready(function() {
+ \$(".spellchecked").spellchecker({
+ url: "/ajax/spellcheck",
+ lang: "en",
+ engine: "pspell",
+ suggestionBoxPosition: "below",
+ innerDocument: true
+ });
+ \$("textarea.spellchecked").spellchecker({
+ url: "/ajax/spellcheck",
+ lang: "en",
+ engine: "pspell",
+ suggestionBoxPosition: "below",
+ innerDocument: true
+ });
+
+ });
+
+
JAVASCRIPT
if ($dragmath_prefix ne '') {
$output .= '
Index: loncom/interface/spellcheck.pm
diff -u loncom/interface/spellcheck.pm:1.3 loncom/interface/spellcheck.pm:1.4
--- loncom/interface/spellcheck.pm:1.3 Tue Sep 4 10:46:05 2012
+++ loncom/interface/spellcheck.pm Mon Sep 10 09:51:06 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: spellcheck.pm,v 1.3 2012/09/04 10:46:05 foxr Exp $
+# $Id: spellcheck.pm,v 1.4 2012/09/10 09:51:06 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -124,6 +124,8 @@
} else {
$raw_params = $r->args();
}
+
+
my $query = CGI->new($raw_params);
# Figure out the language defaulting to english.
@@ -148,7 +150,7 @@
} elsif ($query->param('suggest')) {
$data = &suggest_spellings($query->param('suggest'), $language);
} else {
- die "Invalid request";
+ $data = "[]"; # We seem to get this from time to time.
}
$r->print($data);
Index: loncom/xml/lonplot.pm
diff -u loncom/xml/lonplot.pm:1.165 loncom/xml/lonplot.pm:1.166
--- loncom/xml/lonplot.pm:1.165 Tue Jul 24 11:05:11 2012
+++ loncom/xml/lonplot.pm Mon Sep 10 09:51:15 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Dynamic plot
#
-# $Id: lonplot.pm,v 1.165 2012/07/24 11:05:11 foxr Exp $
+# $Id: lonplot.pm,v 1.166 2012/09/10 09:51:15 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1759,6 +1759,7 @@
sub write_gnuplot_file {
my ($tmpdir,$filename,$target)= @_;
my ($fontsize, $font_properties) = &get_font($target);
+ &Apache::lonnet::logthis("Fontsize: $fontsize");
my $gnuplot_input = '';
my $curve;
#
More information about the LON-CAPA-cvs
mailing list