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

raeburn raeburn@source.lon-capa.org
Sat, 31 Oct 2009 19:54:51 -0000


This is a MIME encoded message

--raeburn1257018891
Content-Type: text/plain

raeburn		Sat Oct 31 19:54:51 2009 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  - $type renamed as $crstype where it is used for course type
  - Some additional wording changes to support Community $crstype
     (C)course -> (C)community
  
  
--raeburn1257018891
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20091031195451.txt"

Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.407 loncom/interface/londocs.pm:1.408
--- loncom/interface/londocs.pm:1.407	Fri Oct 30 20:24:39 2009
+++ loncom/interface/londocs.pm	Sat Oct 31 19:54:51 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.407 2009/10/30 20:24:39 raeburn Exp $
+# $Id: londocs.pm,v 1.408 2009/10/31 19:54:51 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -117,15 +117,15 @@
 
 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) {
-	my $link = "<a onclick='javascript:injectData(document.courseverify, \"dummy\", \"dumpcourse\", \"".&mt('Dump '.$type.' DOCS to Construction Space')."\")'>".&mt('Dump '.$type.' DOCS to Construction Space')."</a>";
+	my $link = "<a onclick='javascript:injectData(document.courseverify, \"dummy\", \"dumpcourse\", \"".&mt('Dump '.$crstype.' DOCS to Construction Space')."\")'>".&mt('Dump '.$crstype.' DOCS to Construction Space')."</a>";
 	return $link.' '.
 	    &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs').'<br />';
     } else {
 	return '<div>'.
-     &mt('Dump '.$type.
+     &mt('Dump '.$crstype.
 	 ' DOCS to Construction Space: available on other servers').
 	 '</div>';
     }
@@ -141,10 +141,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'};
@@ -255,14 +255,14 @@
 	$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 "<a onclick='javascript:injectData(document.courseverify, \"dummy\", \"exportcourse\", \"".&mt('IMS Export')."\")'>".&mt('IMS Export')."</a>".
     &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').'<br />';
 }
@@ -271,18 +271,28 @@
 
 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">'.
-                  &mt('Unable to retrieve information about course contents').
-                  '</div><a href="/adm/coursedocs">'.&mt('Return to Course Editor').'</a>');
-        &Apache::lonnet::logthis('IMS export failed - could not create navmap object in '.lc($type).':'.$env{'request.course.id'});
+                  '<div class="LC_error">');
+        if ($crstype eq 'Community') {
+            $r->print(&mt('Unable to retrieve information about community contents'));
+        } else {
+            $r->print(&mt('Unable to retrieve information about course contents'));
+        }
+        $r->print('</div><a href="/adm/coursedocs">');
+        if ($crstype eq 'Community') {
+            $r->print(&mt('Return to Community Editor'));
+        } else {
+            $r->print(&mt('Return to Course Editor'));
+        }
+        $r->print('</a>');
+        &Apache::lonnet::logthis('IMS export failed - could not create navmap object in '.lc($crstype).':'.$env{'request.course.id'});
         return;
     }
     my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef);
@@ -353,7 +363,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());
@@ -361,7 +371,7 @@
         my $display;
         $display = '<form name="exportdoc" action="" method="post">'."\n";
         $display .= '<p>'
-                   .&mt('Choose which items you wish to export from your '.$type.'.')
+                   .&mt('Choose which items you wish to export from your '.$crstype.'.')
                    .'</p>';
         $display .= '<div class="LC_columnSection"><fieldset>'.
                     '<legend>'.&mt('Content items').'</legend>'.
@@ -507,7 +517,7 @@
 // ]]>
 </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('IMS Export'));
 	$r->print($display.
@@ -998,7 +1008,7 @@
 }
 
 sub breadcrumbs {
-    my ($allowed,$type)=@_;
+    my ($allowed,$crstype)=@_;
     &Apache::lonhtmlcommon::clear_breadcrumbs();
     my (@folders);
     if ($env{'form.pagepath'}) {
@@ -1041,7 +1051,7 @@
             if ($3) { $isencrypted=1; }
 	    if ($4 ne '') { $is_random_order = 1; }
             if ($folder eq 'supplemental') {
-                $name = &mt('Supplemental '.$type.' Documents');
+                $name = &mt('Supplemental '.$crstype.' Documents');
             }
 	    &Apache::lonhtmlcommon::add_breadcrumb(
 		      {'href'=>$url.$cpinfo,
@@ -1497,7 +1507,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';
 
@@ -1515,7 +1525,7 @@
     my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order);
     if ($allowed) {
         ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order) =
-	    &breadcrumbs($allowed,$type);
+	    &breadcrumbs($allowed,$crstype);
         $r->print($breadcrumbtrail);
     } else {
         $randompick = -1;
@@ -1636,7 +1646,7 @@
         unless ($name) {  $name=(split(/\//,$url))[-1]; }
         unless ($name) { $idx++; next; }
         $output .= &entryline($idx,$name,$url,$folder,$allowed,$res,
-                              $coursenum);
+                              $coursenum,$crstype);
         $idx++;
         $shown++;
     }
@@ -1804,7 +1814,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)) {
 	($title,$foldertitle,$renametitle) = &parse_supplemental_title($title);
@@ -2067,12 +2077,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>
     '.($url?'<a href="'.$url.'">':'').'<img src="'.$icon.'" alt="" class="LC_icon" />'.($url?'</a>':'').'
   </td>
   <td>
-    '.($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(
@@ -2220,7 +2236,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();
@@ -2229,7 +2245,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()) {
@@ -2243,11 +2259,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=();
@@ -2256,7 +2272,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 />'));
 	   }
@@ -2279,9 +2295,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='';
@@ -2342,7 +2358,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\/.+)$/) {
@@ -2387,7 +2403,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',
@@ -2396,9 +2412,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');
@@ -2445,7 +2461,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};
@@ -2600,7 +2616,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
@@ -2675,7 +2691,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',
@@ -2760,25 +2776,25 @@
     &Apache::lonhtmlcommon::clear_breadcrumbs();
     if ($allowed) {
         &Apache::lonhtmlcommon::add_breadcrumb({
-            href=>"/adm/coursedocs",text=>"$type Editor"});
+            href=>"/adm/coursedocs",text=>"$crstype Editor"});
 
-        $r->print(&Apache::loncommon::start_page("$type Editor", $script,
+        $r->print(&Apache::loncommon::start_page("$crstype Editor", $script,
                                                  {'force_register' => $showdoc,})
                  .&Apache::loncommon::help_open_menu('','',273,'RAT')
                  .&Apache::lonhtmlcommon::breadcrumbs(
-                     'Editing the Table of Contents for your '.$type,
+                     'Editing the Table of Contents for your '.$crstype,
                      'Docs_Adding_Course_Doc')
         );
     } elsif ($showdoc) {
-        $r->print(&Apache::loncommon::start_page("$type documents",undef,
+        $r->print(&Apache::loncommon::start_page("$crstype documents",undef,
                                                 {'force_register' => $showdoc,}));
     } else {
         my $folder=$env{'form.folder'};
         if ($folder eq '' || $folder eq 'supplemental') {
             $env{'form.folderpath'} = 'supplemental&'.
-                                      &escape(&mt('Supplemental '.$type.' Documents'));
+                                      &escape(&mt('Supplemental '.$crstype.' Documents'));
         }
-        my ($breadcrumbtrail) = &breadcrumbs($allowed,$type);
+        my ($breadcrumbtrail) = &breadcrumbs($allowed,$crstype);
         $r->print(&Apache::loncommon::start_page("Supplemental documents").
                   $breadcrumbtrail);
     }
@@ -2873,8 +2889,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',
 		'copm' => 'All documents out of a published map into this folder',
                 'upld' => 'Upload Document',
@@ -2991,7 +3007,7 @@
 	   if ($env{'form.folder'} eq '' ||
 	       $env{'form.folder'} eq 'supplemental') {
 	       $folderpath='default&'.
-		   &escape(&mt('Main '.$type.' Documents'));
+		   &escape(&mt('Main '.$crstype.' Documents'));
 	   }
        }
        unless ($env{'form.pagepath'}) {
@@ -3034,14 +3050,14 @@
 	        $activeClass = 0;
 	    }
         }
-        $r->print('<li '.$active.' onclick="javascript:showPage(this,\'mainCourseDocuments\',\'mainnav\',\'maincoursedoc\');"><a href="#"><b>'.$tabtitles{'main'}{$type}.'</b></a></li>');
+        $r->print('<li '.$active.' onclick="javascript:showPage(this,\'mainCourseDocuments\',\'mainnav\',\'maincoursedoc\');"><a href="#"><b>'.$tabtitles{'main'}{$crstype}.'</b></a></li>');
         $active = '';
         if (!$forcestandard || ($env{'form.folderpath'}=~/^supplemental/)) {
             if($activeClass == 1){
                 $active = 'class="active"';
             }
         }
-        $r->print('<li '.$active.' onclick="javascript:showPage(this,\'supplCourseDocuments\',\'mainnav\',\'maincoursedoc\');"><a href="#"><b>'.$tabtitles{'supplemental'}{$type}.'</b></a></li>');
+        $r->print('<li '.$active.' onclick="javascript:showPage(this,\'supplCourseDocuments\',\'mainnav\',\'maincoursedoc\');"><a href="#"><b>'.$tabtitles{'supplemental'}{$crstype}.'</b></a></li>');
         $r->print('</ul>');
     } else {
         $r->print('<br />');
@@ -3060,7 +3076,7 @@
        if ($folder eq '' || $folder=~/^supplemental/) {
            $folder='default';
 	   $savefolderpath = $env{'form.folderpath'};
-	   $env{'form.folderpath'}='default&'.&escape($tabtitles{'main'}{$type});
+	   $env{'form.folderpath'}='default&'.&escape($tabtitles{'main'}{$crstype});
            $uploadtag = '<input type="hidden" name="folderpath" value="'.
 	       &HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />';
        }
@@ -3285,7 +3301,7 @@
                 );
 my $tid='1';
  $hadchanges=0;
-        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>');
        }
@@ -3313,7 +3329,7 @@
        if ($folder =~ /^supplemental$/ &&
 	   (($env{'form.folderpath'} =~ /^default\&/) || ($env{'form.folderpath'} eq ''))) {
           $env{'form.folderpath'} = 'supplemental&'.
-                                    &escape(&mt('Supplemental '.$type.' Documents'));
+                                    &escape(&mt('Supplemental '.$crstype.' Documents'));
        } elsif ($allowed) {
 	  $env{'form.folderpath'} = $savefolderpath;
        }
@@ -3398,14 +3414,14 @@
                 'ff' => ['Special Documents',create_form_ul(create_list_elements(@specialdocs))]
                 );
 
-        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>');
         }
         my $tid='2';
         $r->print(&generate_edit_table($tid,\%suporderhash));
     } else {
-        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>');
         }

--raeburn1257018891--