[LON-CAPA-cvs] cvs: loncom / LONCAPA.pm /interface londocs.pm lonfeedback.pm lonmenu.pm lonmeta.pm lonnavmaps.pm lonprintout.pm /lonnet/perl lonnet.pm /publisher lonpubdir.pm

www www at source.lon-capa.org
Mon Nov 7 15:06:03 EST 2011


www		Mon Nov  7 20:06:03 2011 EDT

  Modified files:              
    /loncom	LONCAPA.pm 
    /loncom/interface	londocs.pm lonfeedback.pm lonmenu.pm lonmeta.pm 
                     	lonnavmaps.pm lonprintout.pm 
    /loncom/lonnet/perl	lonnet.pm 
    /loncom/publisher	lonpubdir.pm 
  Log:
  Trying to get rid of some of the copy/paste regular expressions.
  
  
-------------- next part --------------
Index: loncom/LONCAPA.pm
diff -u loncom/LONCAPA.pm:1.32 loncom/LONCAPA.pm:1.33
--- loncom/LONCAPA.pm:1.32	Mon Jul  4 09:25:53 2011
+++ loncom/LONCAPA.pm	Mon Nov  7 20:05:52 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Base routines
 #
-# $Id: LONCAPA.pm,v 1.32 2011/07/04 09:25:53 foxr Exp $
+# $Id: LONCAPA.pm,v 1.33 2011/11/07 20:05:52 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -175,6 +175,14 @@
     return $str;
 }
 
+$LONCAPA::assess_re = qr{\.(problem|exam|quiz|assess|survey|form|library|task)$};
+$LONCAPA::assess_page_re = qr{\.(problem|exam|quiz|assess|survey|form|library|task|page)$};
+$LONCAPA::assess_page_seq_re = qr{\.(problem|exam|quiz|assess|survey|form|library|task|sequence|page)$};
+$LONCAPA::parse_re = qr{\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$};
+$LONCAPA::parse_page_re = qr{\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm|page)$};
+$LONCAPA::parse_page_sty_re = qr{\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm|page|sty)$};
+
+
 $match_domain     = $LONCAPA::domain_re     = qr{[[:alnum:]\-.]+};
 $match_not_domain = $LONCAPA::not_domain_re = qr{[^[:alnum:]\-.]+};
 sub clean_domain {
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.462 loncom/interface/londocs.pm:1.463
--- loncom/interface/londocs.pm:1.462	Mon Oct 31 01:22:25 2011
+++ loncom/interface/londocs.pm	Mon Nov  7 20:05:55 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.462 2011/10/31 01:22:25 raeburn Exp $
+# $Id: londocs.pm,v 1.463 2011/11/07 20:05:55 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1577,7 +1577,7 @@
 
     if ($cmd eq 'del') {
 	if (($url=~m|/+uploaded/\Q$coursedom\E/\Q$coursenum\E/|) &&
-	    ($url!~/\.(page|sequence|problem|exam|quiz|assess|survey|form|library|task)$/)) {
+	    ($url!~/$LONCAPA::assess_page_seq_re/)) {
 	    &Apache::lonnet::removeuploadedurl($url);
 	} else {
 	    &LONCAPA::map::makezombie($LONCAPA::map::order[$idx]);
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.304 loncom/interface/lonfeedback.pm:1.305
--- loncom/interface/lonfeedback.pm:1.304	Sat Nov 20 01:07:05 2010
+++ loncom/interface/lonfeedback.pm	Mon Nov  7 20:05:55 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.304 2010/11/20 01:07:05 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.305 2011/11/07 20:05:55 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -135,7 +135,7 @@
     $crs=~s/\_/\//g;
     my $encsymb=&Apache::lonenc::check_encrypt($ressymb);
     my $viewgrades=(&Apache::lonnet::allowed('vgr',$crs)
-		  && ($ressymb=~/\.(problem|exam|quiz|assess|survey|form|task)$/));
+		  && ($ressymb=~/$LONCAPA::assess_re/));
     
     my %usernamesort = ();
     my %namesort =();
@@ -3814,7 +3814,7 @@
       my $mode='board';
       my $status='OPEN';
       my $previous=$env{'form.previous'};
-      if ($feedurl =~ /\.(problem|exam|quiz|assess|survey|form|library|task)$/) {
+      if ($feedurl =~ /$LONCAPA::assess_re/) {
           $mode='problem';
           $status=$Apache::inputtags::status[-1];
       }
@@ -3854,7 +3854,7 @@
           &dewrapper(\$feedurl);
       }
       my $goahead=1;
-      if ($feedurl=~/\.(problem|exam|quiz|assess|survey|form|task)$/) {
+      if ($feedurl=~/$LONCAPA::assess_re/) {
 	  unless ($symb) { $goahead=0; }
       }
       if (!$goahead) {
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.359 loncom/interface/lonmenu.pm:1.360
--- loncom/interface/lonmenu.pm:1.359	Mon Nov  7 18:22:37 2011
+++ loncom/interface/lonmenu.pm	Mon Nov  7 20:05:55 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.359 2011/11/07 18:22:37 raeburn Exp $
+# $Id: lonmenu.pm,v 1.360 2011/11/07 20:05:55 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -410,7 +410,7 @@
 
         my $hwkadd='';
         if ($env{'request.symb'} ne '' &&
-	    $env{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form|task)$/) {
+	    $env{'request.filename'}=~/$LONCAPA::assess_re/) {
 	    if (&Apache::lonnet::allowed('mgr',$crs)) {
 		$hwkadd.=&switch('','',7,2,'pgrd.png','Content Grades','grades[_4]',
                        "gocmd('/adm/grades','gradingmenu')",
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.242 loncom/interface/lonmeta.pm:1.243
--- loncom/interface/lonmeta.pm:1.242	Mon Oct 24 22:39:18 2011
+++ loncom/interface/lonmeta.pm	Mon Nov  7 20:05:56 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.242 2011/10/24 22:39:18 www Exp $
+# $Id: lonmeta.pm,v 1.243 2011/11/07 20:05:56 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1053,7 +1053,7 @@
     }
     #
     # Assessment statistics
-    if ($uri=~/\.(problem|exam|quiz|assess|survey|form)$/) {
+    if ($uri=~/$LONCAPA::assess_re/) {
         if (exists($dynmeta{'stdno'}) ||
             exists($dynmeta{'avetries'}) ||
             exists($dynmeta{'difficulty'}) ||
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.465 loncom/interface/lonnavmaps.pm:1.466
--- loncom/interface/lonnavmaps.pm:1.465	Fri Oct 21 10:13:57 2011
+++ loncom/interface/lonnavmaps.pm	Mon Nov  7 20:05:56 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.465 2011/10/21 10:13:57 foxr Exp $
+# $Id: lonnavmaps.pm,v 1.466 2011/11/07 20:05:56 www Exp $
 
 #
 # Copyright Michigan State University Board of Trustees
@@ -3819,7 +3819,7 @@
 sub is_problem {
     my $self=shift;
     my $src = $self->src();
-    if ($src =~ /\.(problem|exam|quiz|assess|survey|form|library|task)$/) {
+    if ($src =~ /$LONCAPA::assess_re/) {
 	return !($self->is_practice());
     }
     return 0;
@@ -3854,7 +3854,7 @@
 sub is_raw_problem {
     my $self=shift;
     my $src = $self->src();
-    if ($src =~ /\.(problem|exam|quiz|assess|survey|form|library|task)$/) {
+    if ($src =~ /$LONCAPA::assess_re/) {
         return 1;
     }
     return 0;
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.608 loncom/interface/lonprintout.pm:1.609
--- loncom/interface/lonprintout.pm:1.608	Mon Nov  7 18:24:42 2011
+++ loncom/interface/lonprintout.pm	Mon Nov  7 20:05:56 2011
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.608 2011/11/07 18:24:42 raeburn Exp $
+# $Id: lonprintout.pm,v 1.609 2011/11/07 20:05:56 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2229,7 +2229,7 @@
 	    }
 	    if((($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||
 		($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) && 
-	       ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|page)$/)) {
+	       ($urlp=~/$LONCAPA::assess_page_re/)) {
 		#  Don't permanently modify %$form...
 		my %answerform = %form;
 		$answerform{'grade_target'}='answer';
@@ -2707,7 +2707,7 @@
                             $texversion=~s/(\\keephidden{ENDOFPROBLEM})/$answer$1/;
                         }
 		    } else {
-			if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|page)$/) {
+			if ($urlp=~/$LONCAPA::assess_page_re/) {
 			    $texversion=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'});
 #			    $texversion =~ s/\\begin{document}//; # FIXME
 			    my $title = &Apache::lonnet::gettitle($master_seq[$i]);
@@ -3297,7 +3297,7 @@
 	$current_output .= &get_extra_vspaces($helper, $curresline);
 	$i++;
 	if ( !($type eq 'problems' && 
-	       ($curresline!~ m/\.(problem|exam|quiz|assess|survey|form|library|page)$/)) ) {
+	       ($curresline!~ m/$LONCAPA::assess_page_re/)) ) {
 	    my ($map,$id,$res_url) = &Apache::lonnet::decode_symb($curresline);
 	    if ($print_incomplete && !&incomplete($username, $userdomain, $res_url)) {
 		next;
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1143 loncom/lonnet/perl/lonnet.pm:1.1144
--- loncom/lonnet/perl/lonnet.pm:1.1143	Mon Nov  7 19:29:48 2011
+++ loncom/lonnet/perl/lonnet.pm	Mon Nov  7 20:05:59 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1143 2011/11/07 19:29:48 raeburn Exp $
+# $Id: lonnet.pm,v 1.1144 2011/11/07 20:05:59 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3338,7 +3338,7 @@
     my $fnsymb=shift;
     unless ($env{'request.course.id'}) { return ''; }
     my $what=$fnsymb.':'.$env{'user.name'}.':'.$env{'user.domain'};
-    if ($fnsymb=~/(problem|exam|quiz|assess|survey|form|task|page)$/) {
+    if ($fnsymb=~/$LONCAPA::assess_re/) {
         $what.=':POST';
         # FIXME: Probably ought to escape things....
 	foreach my $key (keys(%env)) {
Index: loncom/publisher/lonpubdir.pm
diff -u loncom/publisher/lonpubdir.pm:1.135 loncom/publisher/lonpubdir.pm:1.136
--- loncom/publisher/lonpubdir.pm:1.135	Mon Oct 31 17:27:10 2011
+++ loncom/publisher/lonpubdir.pm	Mon Nov  7 20:06:02 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Construction Space Directory Lister
 #
-# $Id: lonpubdir.pm,v 1.135 2011/10/31 17:27:10 raeburn Exp $
+# $Id: lonpubdir.pm,v 1.136 2011/11/07 20:06:02 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -605,7 +605,7 @@
     if ($filename=~/\.(xml|html|htm|xhtml|xhtm|sty)$/) {
 	$editlink=' <br />(<a href="'.$linkdir.'/'.$filename.'?forceedit=1" target="_parent">'.&mt('Edit').'</a>)';
     }
-    if ($filename=~/\.(problem|exam|quiz|assess|survey|form|library)$/) {
+    if ($filename=~/$LONCAPA::assess_re/) {
 	$editlink=' (<a href="'.$linkdir.'/'.$filename.'?forceedit=1" target="_parent">'.&mt('EditXML').'</a>)';
 	$editlink2=' <br />(<a href="'.$linkdir.'/'.$filename.'?forceColoredit=1" target="_parent">'.&mt('Edit').'</a>)';
     }


More information about the LON-CAPA-cvs mailing list