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

raeburn raeburn@source.lon-capa.org
Fri, 22 Jan 2010 13:54:06 -0000


raeburn		Fri Jan 22 13:54:06 2010 EDT

  Modified files:              (Branch: version_2_9_X)
    /loncom/interface	lonhtmlcommon.pm 
  Log:
  - Backport 1.235, 1.236, 1.237, 1.241.
  
  
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.182.4.8 loncom/interface/lonhtmlcommon.pm:1.182.4.9
--- loncom/interface/lonhtmlcommon.pm:1.182.4.8	Sun Aug 23 12:59:18 2009
+++ loncom/interface/lonhtmlcommon.pm	Fri Jan 22 13:54:06 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.182.4.8 2009/08/23 12:59:18 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.182.4.9 2010/01/22 13:54:06 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1136,7 +1136,7 @@
     my $output='';
     unless ($noformat) { $output.='<br /><tt><b>'; }
     $output.='<font size="'.$size.'">'.$prefix.'/';
-    if ($env{'user.adv'}) {
+    if (($env{'user.adv'}) | ($env{'user.author'})) {
 	my $path=$prefix.'/';
 	foreach my $dir (split('/',$uri)) {
             if (! $dir) { next; }
@@ -1594,6 +1594,10 @@
 
 sub role_select_row {
     my ($roles,$title,$css_class,$show_separate_custom,$cdom,$cnum) = @_;
+    my $crstype = 'Course';
+    if ($cdom ne '' && $cnum ne '') {
+        $crstype = &Apache::loncommon::course_type($cdom.'_'.$cnum);
+    }
     my $output;
     if (defined($title)) {
         $output = &row_title($title,$css_class);
@@ -1618,7 +1622,7 @@
                 $plrole = &mt('Custom Role');
             }
         } else {
-            $plrole=&Apache::lonnet::plaintext($role);
+            $plrole=&Apache::lonnet::plaintext($role,$crstype);
         }
         if (($role ne 'cr') || (!$show_separate_custom)) {
             $output .= '  <option value="'.$role.'">'.$plrole.'</option>';
@@ -1633,15 +1637,15 @@
 
 sub course_select_row {
     my ($title,$formname,$totcodes,$codetitles,$idlist,$idlist_titles,
-	$css_class) = @_;
+	$css_class,$crstype) = @_;
     my $output = &row_title($title,$css_class);
-    $output .= &course_selection($formname,$totcodes,$codetitles,$idlist,$idlist_titles);
+    $output .= &course_selection($formname,$totcodes,$codetitles,$idlist,$idlist_titles,$crstype);
     $output .= &row_closure();
     return $output;
 }
 
 sub course_selection {
-    my ($formname,$totcodes,$codetitles,$idlist,$idlist_titles) = @_;
+    my ($formname,$totcodes,$codetitles,$idlist,$idlist_titles,$crstype) = @_;
     my $output = qq|
 <script type="text/javascript">
 // <![CDATA[
@@ -1670,9 +1674,19 @@
 // ]]>
 </script>
     |;
+
+    my ($allcrs,$pickspec);
+    if ($crstype eq 'Community') {
+        $allcrs = &mt('All communities');
+        $pickspec = &mt('Pick specific communities:');
+    } else {
+        $allcrs = &mt('All courses');
+        $pickspec = &mt('Pick specific course(s):');
+    }
+
     my $courseform='<b>'.&Apache::loncommon::selectcourse_link
-                     ($formname,'pickcourse','pickdomain','coursedesc','',1).'</b>';
-        $output .= '<input type="radio" name="coursepick" value="all" onclick="coursePick(this.form)" />'.&mt('All courses').'<br />';
+                     ($formname,'pickcourse','pickdomain','coursedesc','',1,$crstype).'</b>';
+        $output .= '<input type="radio" name="coursepick" value="all" onclick="coursePick(this.form)" />'.$allcrs.'<br />';
     if ($totcodes > 0) {
         my $numtitles = @$codetitles;
         if ($numtitles > 0) {
@@ -1717,7 +1731,7 @@
             $output .= '</tr></table><br />';
         }
     }
-    $output .= '<input type="radio" name="coursepick" value="specific" onclick="coursePick(this.form);opencrsbrowser('."'".$formname."','dccourse','dcdomain','coursedesc','','1'".')" />'.&mt('Pick specific course(s):').' '.$courseform.'&nbsp;&nbsp;<input type="text" value="0" size="4" name="coursetotal" /><input type="hidden" name="courselist" value="" />selected.<br />'."\n";
+    $output .= '<input type="radio" name="coursepick" value="specific" onclick="coursePick(this.form);opencrsbrowser('."'".$formname."','dccourse','dcdomain','coursedesc','','1'".')" />'.$pickspec.' '.$courseform.'&nbsp;&nbsp;<input type="text" value="0" size="4" name="coursetotal" /><input type="hidden" name="courselist" value="" />selected.<br />'."\n";
     return $output;
 }
 
@@ -2028,6 +2042,7 @@
         }
     }
     $output .= "
+    return;
 }\n";
     return $output;
 }