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

raeburn raeburn@source.lon-capa.org
Fri, 22 Jan 2010 03:41:58 -0000


This is a MIME encoded message

--raeburn1264131718
Content-Type: text/plain

raeburn		Fri Jan 22 03:41:58 2010 EDT

  Modified files:              (Branch: version_2_9_X)
    /loncom/interface	londocs.pm 
  Log:
  - Backport 1.408, 1.411.
  
  
--raeburn1264131718
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20100122034158.txt"

Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.325.2.5 loncom/interface/londocs.pm:1.325.2.6
--- loncom/interface/londocs.pm:1.325.2.5	Fri Jan 22 01:23:34 2010
+++ loncom/interface/londocs.pm	Fri Jan 22 03:41:58 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.325.2.5 2010/01/22 01:23:34 raeburn Exp $
+# $Id: londocs.pm,v 1.325.2.6 2010/01/22 03:41:58 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -117,17 +117,17 @@
 
 sub dumpbutton {
     my ($home,$other,%outhash)=&authorhosts();
-    my $type = &Apache::loncommon::course_type();
+    my $crstype = &Apache::loncommon::course_type();
     if ($home+$other==0) { return ''; }
     if ($home) {
 	return '<div>'.
 	    '<input type="submit" name="dumpcourse" value="'.
-	    &mt('Dump '.$type.' DOCS to Construction Space').'" />'.
+	    &mt('Dump '.$crstype.' DOCS to Construction Space').'" />'.
 	    &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs').
 	    '</div>';
     } else {
 	return '<div>'.
-     &mt('Dump '.$type.
+     &mt('Dump '.$crstype.
 	 ' DOCS to Construction Space: available on other servers').
 	 '</div>';
     }
@@ -143,10 +143,10 @@
 
 sub dumpcourse {
     my ($r) = @_;
-    my $type = &Apache::loncommon::course_type();
-    $r->print(&Apache::loncommon::start_page('Dump '.$type.' DOCS to Construction Space').
+    my $crstype = &Apache::loncommon::course_type();
+    $r->print(&Apache::loncommon::start_page('Dump '.$crstype.' DOCS to Construction Space').
 	      '<form name="dumpdoc" action="" method="post">');
-    $r->print(&Apache::lonhtmlcommon::breadcrumbs('Dump '.$type.' DOCS to Construction Space'));
+    $r->print(&Apache::lonhtmlcommon::breadcrumbs('Dump '.$crstype.' DOCS to Construction Space'));
     my ($home,$other,%outhash)=&authorhosts();
     unless ($home) { return ''; }
     my $origcrsid=$env{'request.course.id'};
@@ -257,17 +257,17 @@
 	$r->print(&Apache::loncommon::end_data_table());
 	&untiehash();
 	$r->print(
-  '<p><input type="submit" name="dumpcourse" value="'.&mt("Dump $type DOCS").'" /></p></form>');
+  '<p><input type="submit" name="dumpcourse" value="'.&mt("Dump $crstype DOCS").'" /></p></form>');
     }
 }
 
 
 
 sub exportbutton {
-    my $type = &Apache::loncommon::course_type();
+    my $crstype = &Apache::loncommon::course_type();
     return '<input type="submit" name="exportcourse"'
           .' value="'.&mt('IMS Export').'"'
-          .' title="'.&mt('Export '.$type.' to IMS Package').'" />'.
+          .' title="'.&mt('Export '.$crstype.' to IMS Package').'" />'.
     &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').'<br />';
 }
 
@@ -275,13 +275,13 @@
 
 sub exportcourse {
     my $r=shift;
-    my $type = &Apache::loncommon::course_type();
+    my $crstype = &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);
     my $navmap = Apache::lonnavmaps::navmap->new();
     if (!defined($navmap)) {
-        $r->print(&Apache::loncommon::start_page('Export '.$type.' to IMS Package').
+        $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package').
                   '<h2>'.&mt('IMS Export Failed').'</h2>'.
                   '<div class="LC_error">');
         if ($crstype eq 'Community') {
@@ -367,7 +367,7 @@
                           .'</a></p>';
             }
         }
-        $r->print(&Apache::loncommon::start_page('Export '.$type.' to IMS Package'));
+        $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package'));
         $r->print(&Apache::lonhtmlcommon::breadcrumbs('IMS Export'));
         $r->print($outcome);
         $r->print(&Apache::loncommon::end_page());
@@ -518,9 +518,9 @@
 // ]]>
 </script>
         |;
-        $r->print(&Apache::loncommon::start_page('Export '.$type.' to IMS Package',
+        $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package',
  						 $scripttag));
-	$r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package'));
+	$r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($crstype).' to IMS content package'));
 	$r->print($display.
                   '<p><input type="hidden" name="finishexport" value="1" />'.
                   '<input type="submit" name="exportcourse" value="'.
@@ -1009,7 +1009,7 @@
 }
 
 sub breadcrumbs {
-    my ($where,$allowed,$type)=@_;
+    my ($allowed,$crstype)=@_;
     &Apache::lonhtmlcommon::clear_breadcrumbs();
     my (@folders);
     if ($env{'form.pagepath'}) {
@@ -1044,9 +1044,9 @@
 	    if ($4 ne '') { $is_random_order = 1; }
             if ($folder eq 'supplemental') {
                 if ($allowed) {
-                    $name = &mt('Supplemental '.$type.' Documents');
+                    $name = &mt('Supplemental '.$crstype.' Documents');
                 } else {
-                    $name = &mt($type.' Documents');
+                    $name = &mt($crstype.' Documents');
                 }
             }
 	    &Apache::lonhtmlcommon::add_breadcrumb(
@@ -1503,7 +1503,7 @@
 }
 
 sub editor {
-    my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$type)=@_;
+    my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype)=@_;
 
     my $container= ($env{'form.pagepath'}) ? 'page'
 		                           : 'sequence';
@@ -1520,7 +1520,7 @@
     }
     
     my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order)=
-	&breadcrumbs($folder,$allowed,$type);
+	&breadcrumbs($allowed,$crstype);
     $r->print($breadcrumbtrail);
     
 # ------------------------------------------------------------ Process commands
@@ -1619,7 +1619,7 @@
 	unless ($name) {  $name=(split(/\//,$url))[-1]; }
 	unless ($name) { $idx++; next; }
 	$r->print(&entryline($idx,$name,$url,$folder,$allowed,$res,
-			     $coursenum));
+			     $coursenum,$crstype));
 	$idx++;
 	$shown++;
     }
@@ -1770,7 +1770,7 @@
 # --------------------------------------------------------------- An entry line
 
 sub entryline {
-    my ($index,$title,$url,$folder,$allowed,$residx,$coursenum)=@_;
+    my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$crstype)=@_;
 
     my ($foldertitle,$pagetitle,$renametitle);
     if (&is_supplemental_title($title)) {
@@ -2036,12 +2036,18 @@
     } else {
 	undef($external);
     }
+    my $reinit;
+    if ($crstype eq 'Community') {
+        $reinit = &mt('(re-initialize community to access)');
+    } else {
+        $reinit = &mt('(re-initialize course to access)');
+    }  
     $line.='
   <td class="LC_docs_entry_icon">
     '.($url?'<a href="'.$url.'">':'').'<img src="'.$icon.'" alt="" class="LC_icon" />'.($url?'</a>':'').'
   </td>
   <td class="LC_docs_entry_title">
-    '.($url?"<a href=\"$url\">":'').$title.($url?'</a>':' <span class="LC_docs_reinit_warn">'.&mt('(re-initialize course to access)').'</span>').$external."
+    '.($url?"<a href=\"$url\">":'').$title.($url?'</a>':' <span class="LC_docs_reinit_warn">'.$reinit.'</span>').$external."
   </td>";
     if (($allowed) && ($folder!~/^supplemental/)) {
  	my %lt=&Apache::lonlocal::texthash(
@@ -2189,7 +2195,7 @@
 sub list_symbs {
     my ($r) = @_;
 
-    my $type = &Apache::loncommon::course_type();
+    my $crstype = &Apache::loncommon::course_type();
     $r->print(&Apache::loncommon::start_page('Symb List'));
     $r->print(&Apache::lonhtmlcommon::breadcrumbs('Symb List'));
     my $navmap = Apache::lonnavmaps::navmap->new();
@@ -2198,7 +2204,7 @@
                   '<div class="LC_error">'.
                   &mt('Unable to retrieve information about course contents').
                   '</div>');
-        &Apache::lonnet::logthis('Symb list failed - could not create navmap object in '.lc($type).':'.$env{'request.course.id'});
+        &Apache::lonnet::logthis('Symb list failed - could not create navmap object in '.lc($crstype).':'.$env{'request.course.id'});
     } else {
         $r->print("<pre>\n");
         foreach my $res ($navmap->retrieveResources()) {
@@ -2212,11 +2218,11 @@
 
 sub verifycontent {
     my ($r) = @_;
-    my $type = &Apache::loncommon::course_type();
+    my $crstype = &Apache::loncommon::course_type();
    my $loaderror=&Apache::lonnet::overloaderror($r);
    if ($loaderror) { return $loaderror; }
-   $r->print(&Apache::loncommon::start_page('Verify '.$type.' Documents'));
-   $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$type.' Documents'));
+   $r->print(&Apache::loncommon::start_page('Verify '.$crstype.' Documents'));
+   $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$crstype.' Documents'));
    $hashtied=0;
    undef %alreadyseen;
    %alreadyseen=();
@@ -2225,7 +2231,7 @@
        if ($hash{$key}=~/\.(page|sequence)$/) {
 	   if (($key=~/^src_/) && ($alreadyseen{&unescape($hash{$key})})) {
 	       $r->print('<hr /><span class="LC_error">'.
-			 &mt('The following sequence or page is included more than once in your '.$type.': ').
+                         &mt('The following sequence or page is included more than once in your '.$crstype.': ').
 			 &unescape($hash{$key}).'</span><br />'.
 			 &mt('Note that grading records for problems included in this sequence or folder will overlap.<hr />'));
 	   }
@@ -2248,9 +2254,9 @@
 
 sub checkversions {
     my ($r) = @_;
-    my $type = &Apache::loncommon::course_type();
-    $r->print(&Apache::loncommon::start_page("Check $type Document Versions"));
-    $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $type Document Versions"));
+    my $crstype = &Apache::loncommon::course_type();
+    $r->print(&Apache::loncommon::start_page("Check $crstype Document Versions"));
+    $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $crstype Document Versions"));
     my $header='';
     my $startsel='';
     my $monthsel='';
@@ -2311,7 +2317,7 @@
     &changewarning($r,'');
     if ($env{'form.timerange'} eq 'all') {
 # show all documents
-	$header=&mt('All Documents in '.$type);
+        $header=&mt('All Documents in '.$crstype);
 	$allsel=1;
 	foreach my $key (keys(%hash)) {
 	    if ($key=~/^ids\_(\/res\/.+)$/) {
@@ -2356,7 +2362,7 @@
 			  $env{'course.'.$env{'request.course.id'}.'.domain'},
 			  $env{'course.'.$env{'request.course.id'}.'.num'});
     my %lt=&Apache::lonlocal::texthash
-	      ('st' => 'Version changes since start of '.$type,
+              ('st' => 'Version changes since start of '.$crstype,
 	       'lm' => 'Version changes since last Month',
 	       'lw' => 'Version changes since last Week',
 	       'sy' => 'Version changes since Yesterday',
@@ -2365,9 +2371,9 @@
 	       'fi' => 'File',
 	       'md' => 'Modification Date',
                'mr' => 'Most recently published Version',
-	       've' => 'Version used in '.$type,
-               'vu' => 'Set Version to be used in '.$type,
-'sv' => 'Set Versions to be used in '.$type.' according to Selections below',
+	       've' => 'Version used in '.$crstype,
+               'vu' => 'Set Version to be used in '.$crstype,
+'sv' => 'Set Versions to be used in '.$crstype.' according to Selections below',
 'sm' => 'Keep all Resources up-to-date with most recent Versions (default)',
 'sc' => 'Set all Resource Versions to current Version (Fix Versions)',
 	       'di' => 'Differences');
@@ -2414,7 +2420,7 @@
                       '<td title="'.$lt{'mr'}.'"><span class="LC_nobreak">Most Recent: '.
                       '<font size="+1">'.$currentversion.'</font>'.
                       '</span></td>'.
-                      '<td title="'.$lt{'ve'}.'"><span class="LC_nobreak">In '.$type.': '.
+                      '<td title="'.$lt{'ve'}.'"><span class="LC_nobreak">In '.$crstype.': '.
                       '<font size="+1">');
 # Used in course
 	    my $usedversion=$hash{'version_'.$linkurl};
@@ -2431,7 +2437,7 @@
 						      ('select_form_order' =>
 						       ['',1..$currentversion,'mostrecent'],
 						       '' => '',
-						       'mostrecent' => 'most recent',
+						       'mostrecent' => &mt('most recent'),
 						       map {$_,$_} (1..$currentversion))));
 	    $r->print('</span></td></tr><tr><td></td>');
 	    my $lastold=1;
@@ -2570,7 +2576,7 @@
     &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;
     return OK if $r->header_only;
-    my $type = &Apache::loncommon::course_type();
+    my $crstype = &Apache::loncommon::course_type();
 
 # --------------------------------------------- Initialize help topics for this
     foreach my $topic ('Adding_Course_Doc','Main_Course_Documents',
@@ -2642,7 +2648,7 @@
     }
     if ($env{'form.folderpath'} =~ /^supplemental_\d+/) {
         $env{'form.folderpath'} = 'supplemental&'.
-                                  &escape(&mt('Supplemental '.$type.' Documents')).'&'.
+                                  &escape(&mt('Supplemental '.$crstype.' Documents')).'&'.
                                   $env{'form.folderpath'};
     }
     &Apache::loncommon::store_course_settings('docs_folderpath',
@@ -2702,8 +2708,8 @@
               .$script."\n"
               .'// ]]>'."\n"
               .'</script>'."\n";
-    my $brcrum = [{href=>"/adm/createuser",text=>"$type Documents"}];
-    $r->print(&Apache::loncommon::start_page("$type Documents", $script,
+    my $brcrum = [{href=>"/adm/createuser",text=>"$crstype Documents"}];
+    $r->print(&Apache::loncommon::start_page("$crstype Documents", $script,
 				    {'force_register' => $showdoc,
                                      'bread_crumbs' => $brcrum}).
 	      &Apache::loncommon::help_open_menu('','',273,'RAT'));
@@ -2798,8 +2804,8 @@
   unless ($showdoc ||  $upload_result eq 'phasetwo') {
 # -----------------------------------------------------------------------------
        my %lt=&Apache::lonlocal::texthash(
-                'uplm' => 'Upload a new main '.lc($type).' document',
-                'upls' => 'Upload a new supplemental '.lc($type).' document',
+                'uplm' => 'Upload a new main '.lc($crstype).' document',
+                'upls' => 'Upload a new supplemental '.lc($crstype).' document',
                 'impp' => 'Import a document',
                 'pubd' => 'Published documents',
 		'copm' => 'All documents out of a published map into this folder',
@@ -2858,7 +2864,7 @@
        if (!$folderpath) {
 	   if ($env{'form.folder'} eq '' ||
 	       $env{'form.folder'} eq 'supplemental') {
-	       $folderpath='default&'.&escape($tabtitles{'main'}{$type});
+	       $folderpath='default&'.&escape($tabtitles{'main'}{$crstype});
 	   }
        }
        unless ($env{'form.pagepath'}) {
@@ -2901,7 +2907,7 @@
 <div style="clear: both; height: 0px;">&nbsp;</div>
 ENDCOURSEVERIFY
        $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
-		     &mt('Editing the Table of Contents for your '.$type)));
+		     &mt('Editing the Table of Contents for your '.$crstype)));
     }
 # --------------------------------------------------------- Standard documents
     $r->print('<table class="LC_docs_documents">');
@@ -2913,7 +2919,7 @@
        my $folder=$env{'form.folder'};
        if ($folder eq '' || $folder eq 'supplemental') {
            $folder='default';
-	   $env{'form.folderpath'}='default&'.&escape(&mt('Main '.$type.' Documents'));
+	   $env{'form.folderpath'}='default&'.&escape(&mt('Main '.$crstype.' Documents'));
            $uploadtag = '<input type="hidden" name="folderpath" value="'.
 	       &HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />';
        }
@@ -2930,7 +2936,7 @@
        }
        $hadchanges=0;
        my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,
-			   $upload_output,$type);
+			   $upload_output,$crstype);
        if ($error) {
 	   $r->print('<p><span class="LC_error">'.$error.'</span></p>');
        }
@@ -3178,9 +3184,9 @@
        if ($folder =~ /^supplemental$/ &&
 	   (($env{'form.folderpath'} =~ /^default\&/) || ($env{'form.folderpath'} eq ''))) {
           $env{'form.folderpath'} = 'supplemental&'.
-                                    &escape($tabtitles{'supplemental'}{$type});
+                                    &escape($tabtitles{'supplemental'}{$crstype});
        }
-       my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);
+       my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype);
        if ($error) {
 	   $r->print('<p><span class="LC_error">'.$error.'</span></p>');
        }

--raeburn1264131718--