[LON-CAPA-cvs] cvs: loncom /homework grades.pm /interface loncommon.pm lonpickstudent.pm

www www@source.lon-capa.org
Sun, 23 Jan 2011 01:04:26 -0000


www		Sun Jan 23 01:04:26 2011 EDT

  Modified files:              
    /loncom/homework	grades.pm 
    /loncom/interface	loncommon.pm lonpickstudent.pm 
  Log:
  When picking a student who might correspond to an unregistered clicker,
  show the clickers that the students registered including similarities.
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.642 loncom/homework/grades.pm:1.643
--- loncom/homework/grades.pm:1.642	Mon Dec 20 22:01:26 2010
+++ loncom/homework/grades.pm	Sun Jan 23 01:04:21 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.642 2010/12/20 22:01:26 raeburn Exp $
+# $Id: grades.pm,v 1.643 2011/01/23 01:04:21 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -8973,7 +8973,7 @@
                    "\n".&mt("Username").": <input type='text' name='uname".$id."' />&nbsp;".
                    "\n".&mt("Domain").": ".
                    &Apache::loncommon::select_dom_form($env{'course.'.$env{'request.course.id'}.'.domain'},'udom'.$id).'&nbsp;'.
-                   &Apache::loncommon::selectstudent_link('clickeranalysis','uname'.$id,'udom'.$id);
+                   &Apache::loncommon::selectstudent_link('clickeranalysis','uname'.$id,'udom'.$id,0,$id);
           $unknown_count++;
        }
     }
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.998 loncom/interface/loncommon.pm:1.999
--- loncom/interface/loncommon.pm:1.998	Sun Jan 16 03:50:12 2011
+++ loncom/interface/loncommon.pm	Sun Jan 23 01:04:26 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.998 2011/01/16 03:50:12 raeburn Exp $
+# $Id: loncommon.pm,v 1.999 2011/01/23 01:04:26 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -409,7 +409,7 @@
 <script type="text/javascript" language="Javascript">
 // <![CDATA[
     var stdeditbrowser;
-    function openstdbrowser(formname,uname,udom,roleflag,ignorefilter,courseadvonly) {
+    function openstdbrowser(formname,uname,udom,clicker,roleflag,ignorefilter,courseadvonly) {
         var url = '/adm/pickstudent?';
         var filter;
 	if (!ignorefilter) {
@@ -421,7 +421,8 @@
 	   }
         }
         url += 'form=' + formname + '&unameelement='+uname+
-                                    '&udomelement='+udom;
+                                    '&udomelement='+udom+
+                                    '&clicker='+clicker;
 	if (roleflag) { url+="&roles=1"; }
         if (courseadvonly) { url+="&courseadvonly=1"; }
         var title = 'Student_Browser';
@@ -436,14 +437,17 @@
 }
 
 sub selectstudent_link {
-   my ($form,$unameele,$udomele,$courseadvonly)=@_;
-   my $callargs = "'".$form."','".$unameele."','".$udomele."'";
+   my ($form,$unameele,$udomele,$courseadvonly,$clickerid)=@_;
+   my $callargs = "'".&Apache::lonhtmlcommon::entity_encode($form)."','".
+                      &Apache::lonhtmlcommon::entity_encode($unameele)."','".
+                      &Apache::lonhtmlcommon::entity_encode($udomele)."'";
    if ($env{'request.course.id'}) {  
        if (!&Apache::lonnet::allowed('srm',$env{'request.course.id'})
 	   && !&Apache::lonnet::allowed('srm',$env{'request.course.id'}.
 					'/'.$env{'request.course.sec'})) {
 	   return '';
        }
+       $callargs.=",'".&Apache::lonhtmlcommon::entity_encode($clickerid)."'";
        if ($courseadvonly)  {
            $callargs .= ",'',1,1";
        }
Index: loncom/interface/lonpickstudent.pm
diff -u loncom/interface/lonpickstudent.pm:1.28 loncom/interface/lonpickstudent.pm:1.29
--- loncom/interface/lonpickstudent.pm:1.28	Thu Nov  5 14:24:01 2009
+++ loncom/interface/lonpickstudent.pm	Sun Jan 23 01:04:26 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Pick a student from the classlist
 #
-# $Id: lonpickstudent.pm,v 1.28 2009/11/05 14:24:01 raeburn Exp $
+# $Id: lonpickstudent.pm,v 1.29 2011/01/23 01:04:26 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -50,7 +50,7 @@
 
     &Apache::loncommon::get_unprocessed_cgi
         ($ENV{'QUERY_STRING'},['filter','form','unameelement','udomelement',
-			       'roles','courseadvonly']);
+			       'roles','courseadvonly','clicker']);
 # Allowed?
     my $allowed;
     my $scope = $env{'request.course.id'};
@@ -136,6 +136,26 @@
         unless ($env{'form.courseadvonly'}) {
 
 # ------------------------------------------------------------------ Students
+
+# Do we have a clicker?
+
+            my $clicker=$env{'form.clicker'};
+            my @fragments=();
+            if ($clicker) {
+               $r->print('<h1>'.&mt('Clicker: [_1]',$clicker).'</h1>');
+               my $clicklength=length($clicker);
+               my $maxlength=$clicklength-1;
+               if ($maxlength>2) {
+                  my $minlength=$maxlength-2;
+                  if ($minlength<2) { $minlength=2; }
+                  for (my $length=$maxlength;$length>=$minlength;$length--) {
+                      for (my $startidx=0; $startidx<=$clicklength-$length; $startidx++) {
+                          push(@fragments,substr($clicker,$startidx,$length));
+                      }
+                  }
+               }
+            }
+
 	    my $result;
             my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
             my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
@@ -164,6 +184,20 @@
 			    }
 		        }
 		        $grouplist =~ s/,$//;
+                        my $markedupclicker;
+                        if ($clicker) {
+                           $markedupclicker=(&Apache::lonnet::userenvironment($udom,$uname,'clickers'))[1];
+                           if ($markedupclicker!~/\w/) { 
+                              $markedupclicker='-'; 
+                           } else {
+                               foreach my $frag (@fragments) {
+                                  if ($markedupclicker=~/\Q$frag\E/is) {
+                                     $markedupclicker=~s/(\Q$frag\E)/<font color=\"green\" size=\"\+1\"><b>$1<\/b><\/font>/gis;
+                                     last;
+                                  }
+                               }
+                           }
+                        }
 		        $result .=&Apache::loncommon::start_data_table_row().
 		    	          '<td>'.
 			          '<input type="button" value="'.&mt('Select').'" onClick="gochoose('.
@@ -174,6 +208,7 @@
 				    				     $uname,$udom).
 			          '</td><td>'.$id.'</td><td>'.$section.
 			          '</td><td>'.$grouplist.'</td>'.
+                                  ($clicker?'<td>'.$markedupclicker.'</td>':'').
 			          &Apache::loncommon::end_data_table_row();
 		    }
 	        }
@@ -191,6 +226,7 @@
 		          '<th>'.&mt('ID').'</th>'.
 		          '<th>'.&mt('section').'</th>'.
 		          '<th>'.&mt('active group(s)').'</th>'.
+                          ($clicker?'<th>'.&mt('clicker').'</th>':'').
 		          &Apache::loncommon::end_data_table_header_row().
 		          $result.
 		          &Apache::loncommon::end_data_table());