[LON-CAPA-cvs] cvs: loncom /interface londocs.pm

albertel lon-capa-cvs@mail.lon-capa.org
Sat, 03 Jun 2006 21:14:27 -0000


This is a MIME encoded message

--albertel1149369267
Content-Type: text/plain

albertel		Sat Jun  3 17:14:27 2006 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  - switch to course_type function
  - switch to type being translateable rather than an untranslated arg
  
  
--albertel1149369267
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20060603171427.txt"

Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.229 loncom/interface/londocs.pm:1.230
--- loncom/interface/londocs.pm:1.229	Tue May 30 16:09:25 2006
+++ loncom/interface/londocs.pm	Sat Jun  3 17:14:27 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.229 2006/05/30 20:09:25 raeburn Exp $
+# $Id: londocs.pm,v 1.230 2006/06/03 21:14:27 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -121,21 +121,18 @@
 
 sub dumpbutton {
     my ($home,$other,%outhash)=&authorhosts();
-    my $type = 'Course';
-    if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {
-        $type = $env{'course.'.$env{'request.course.id'}.'.type'};
-    }
+    my $type = &Apache::loncommon::course_type();
     if ($home+$other==0) { return ''; }
     my $output='</td><td bgcolor="#DDDDCC">';
     if ($home) {
 	return '</td><td bgcolor="#DDDDCC">'.
 	    '<input type="submit" name="dumpcourse" value="'.
-	    &mt('Dump [_1] DOCS to Construction Space',$type).'" />'.
+	    &mt('Dump '.$type.' DOCS to Construction Space').'" />'.
 	    &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs');
     } else {
 	return'</td><td bgcolor="#DDDDCC">'.
-     &mt('Dump [_1] DOCS to Construction Space: available on other servers',
-         $type);
+     &mt('Dump '.$type.
+	 ' DOCS to Construction Space: available on other servers');
     }
 }
 
@@ -148,12 +145,9 @@
 
 sub dumpcourse {
     my ($r) = @_;
-    my $type = 'Course';
-    if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {
-        $type = $env{'course.'.$env{'request.course.id'}.'.type'};
-    }
-    $r->print(&Apache::loncommon::start_page('Dump [_1] DOCS to Construction Space',
-	      $type).'<form name="dumpdoc" method="post">');
+    my $type = &Apache::loncommon::course_type();
+    $r->print(&Apache::loncommon::start_page('Dump '.$type.' DOCS to Construction Space').
+	      '<form name="dumpdoc" method="post">');
     my ($home,$other,%outhash)=&authorhosts();
     unless ($home) { return ''; }
     my $origcrsid=$env{'request.course.id'};
@@ -261,22 +255,16 @@
 # ------------------------------------------------------ Generate "export" button
 
 sub exportbutton {
-    my $type = 'Course';
-    if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {
-        $type = $env{'course.'.$env{'request.course.id'}.'.type'};
-    }
+    my $type = &Apache::loncommon::course_type();
     return '</td><td bgcolor="#DDDDCC">'.
             '<input type="submit" name="exportcourse" value="'.
-            &mt('Export [_1] to IMS',$type).'" />'.
+            &mt('Export '.$type.' to IMS').'" />'.
     &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs');
 }
 
 sub exportcourse {
     my $r=shift;
-    my $type = 'Course';
-    if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {
-        $type = $env{'course.'.$env{'request.course.id'}.'.type'};
-    }
+    my $type = &Apache::loncommon::course_type();
     my %discussiontime = &Apache::lonnet::dump('discussiontimes',
                                                $env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'});
     my $numdisc = keys %discussiontime;
@@ -317,7 +305,7 @@
                 open(OUTPUT, "zip -r $imszip *  2> /dev/null |");
                 close(OUTPUT);
                 chdir $cwd;
-                $outcome .= &mt('Download the zip file from <a href="[_1]">IMS [_2] archive</a><br />',$imszipfile,lc($type));
+                $outcome .= &mt('Download the zip file from <a href="[_1]">IMS '.lc($type).' archive</a><br />',$imszipfile,);
                 if ($copyresult) {
                     $outcome .= 'The following errors occurred during export - '.$copyresult;
                 }
@@ -331,7 +319,7 @@
     } else {
         my $display;
         $display = '<form name="exportdoc" method="post">'."\n";
-        $display .= &mt('Choose which items you wish to export from your [_1].<br /><br />',$type);
+        $display .= &mt('Choose which items you wish to export from your '.$type.'.<br /><br />');
         $display .= '<table border="0" cellspacing="0" cellpadding="3">'.
                     '<tr><td><fieldset><legend>&nbsp;<b>Content items</b></legend>'.
                     '<input type="button" value="check all" '.
@@ -470,7 +458,7 @@
 	$r->print($display.'</table>'.
                   '<p><input type="hidden" name="finishexport" value="1">'.
                   '<input type="submit" name="exportcourse" value="'.
-                  &mt('Export [_1] DOCS',$type).'" /></p></form>'.
+                  &mt('Export '.$type.' DOCS').'" /></p></form>'.
 		  &Apache::loncommon::end_page());
     }
 }
@@ -1780,10 +1768,7 @@
 # 
 sub verifycontent {
     my ($r) = @_;
-    my $type = 'Course';
-    if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {
-        $type = $env{'course.'.$env{'request.course.id'}.'.type'};
-    }
+    my $type = &Apache::loncommon::course_type();
    my $loaderror=&Apache::lonnet::overloaderror($r);
    if ($loaderror) { return $loaderror; }
    $r->print(&Apache::loncommon::start_page('Verify '.$type.' Documents'));
@@ -1795,7 +1780,7 @@
        if ($hash{$_}=~/\.(page|sequence)$/) {
 	   if (($_=~/^src_/) && ($alreadyseen{&unescape($hash{$_})})) {
 	       $r->print('<hr /><font color="red">'.
-			 &mt('The following sequence or page is included more than once in your [_1]: ',$type).
+			 &mt('The following sequence or page is included more than once in your '.$type.': ').
 			 &unescape($hash{$_}).'</font><br />'.
 			 &mt('Note that grading records for problems included in this sequence or folder will overlap.<hr />'));
 	   }
@@ -1820,10 +1805,7 @@
 
 sub checkversions {
     my ($r) = @_;
-    my $type = 'Course';
-    if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {
-        $type = $env{'course.'.$env{'request.course.id'}.'.type'};
-    }
+    my $type = &Apache::loncommon::course_type();
     $r->print(&Apache::loncommon::start_page("Check $type Document Versions"));
     my $header='';
     my $startsel='';
@@ -1885,7 +1867,7 @@
     &changewarning($r,'');
     if ($env{'form.timerange'} eq 'all') {
 # show all documents
-	$header=&mt('All Documents in [_1]',$type);
+	$header=&mt('All Documents in '.$type);
 	$allsel=1;
 	foreach (keys %hash) {
 	    if ($_=~/^ids\_(\/res\/.+)$/) {
@@ -2101,10 +2083,7 @@
 	}
 	$url='/adm/coursedocs?'.$pathvar.'='.$path;
     }
-    my $crstype = 'course';
-    if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {
-        $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
-    }
+    my $course_type = &Apache::loncommon::course_type();
     if (!defined($message)) {
 	$message='Changes will become active for your current session after [_1], or the next time you log in.';
     }
@@ -2115,7 +2094,7 @@
 '" /><input type="hidden" name="selectrole" value="1" /><h3><font color="red">'.
 &mt($message,' <input type="hidden" name="'.
     $env{'request.role'}.'" value="1" /><input type="button" value="'.
-    &mt('re-initializing [_1]',$crstype).'" onClick="reinit(this.form)" />').
+    &mt('re-initializing '.$course_type).'" onClick="reinit(this.form)" />').
 $help{'Caching'}.'</font></h3></form>'."\n\n");
 }
 
@@ -2125,12 +2104,7 @@
     &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;
     return OK if $r->header_only;
-# Identify type - Course or Group. 
-    my $type = 'Course';
-    if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {
-        $type = $env{'course.'.$env{'request.course.id'}.'.type'};
-    }
-
+    my $type = &Apache::loncommon::course_type();
 
 # --------------------------------------------- Initialize help topics for this
     foreach ('Adding_Course_Doc','Main_Course_Documents',
@@ -2366,7 +2340,7 @@
 	   if ($env{'form.folder'} eq '' ||
 	       $env{'form.folder'} eq 'supplemental') {
 	       $folderpath='default&'.
-		   &escape(&mt('Main [_1] Documents',$type));
+		   &escape(&mt('Main '.$type.' Documents'));
 	   }
        }
        unless ($env{'form.pagepath'}) {
@@ -2399,7 +2373,7 @@
 </form>
 ENDCOURSEVERIFY
        $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
-		     &mt('Editing the Table of Contents for your [_1]',$type)));
+		     &mt('Editing the Table of Contents for your '.$type)));
     }
 # --------------------------------------------------------- Standard documents
     $r->print('<table border=2 cellspacing=4 cellpadding=4>');
@@ -2410,7 +2384,7 @@
        my $folder=$env{'form.folder'};
        if ($folder eq '' || $folder eq 'supplemental') {
            $folder='default';
-	   $env{'form.folderpath'}='default&'.&escape(&mt('Main [_1] Documents',$type));
+	   $env{'form.folderpath'}='default&'.&escape(&mt('Main '.$type.' Documents'));
        }
        my $postexec='';
        if ($folder eq 'default') {
@@ -2641,7 +2615,7 @@
        if ($folder =~ /^supplemental$/ &&
 	   $env{'form.folderpath'} =~ /^default\&/) {
 	   $env{'form.folderpath'}='supplemental&'.
-	       &escape(&mt('Supplemental [_1] Documents',$type));
+	       &escape(&mt('Supplemental '.$type.' Documents'));
        }
        &editor($r,$coursenum,$coursedom,$folder,$allowed);
        if ($allowed) {

--albertel1149369267--