[LON-CAPA-cvs] cvs: rat / lonpage.pm

raeburn raeburn at source.lon-capa.org
Sun Jun 9 23:12:25 EDT 2013


raeburn		Mon Jun 10 03:12:25 2013 EDT

  Modified files:              
    /rat	lonpage.pm 
  Log:
  - Include edit icon in row of icons for each item in a .page, if user
    has privileges to edit the content item. 
  
  
Index: rat/lonpage.pm
diff -u rat/lonpage.pm:1.101 rat/lonpage.pm:1.102
--- rat/lonpage.pm:1.101	Sun Jun  9 02:59:25 2013
+++ rat/lonpage.pm	Mon Jun 10 03:12:24 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Page Handler
 #
-# $Id: lonpage.pm,v 1.101 2013/06/09 02:59:25 raeburn Exp $
+# $Id: lonpage.pm,v 1.102 2013/06/10 03:12:24 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -36,6 +36,7 @@
 use Apache::Constants qw(:common :http);
 use Apache::lonnet;
 use Apache::loncommon();
+use Apache::lonhtmlcommon;
 use Apache::lonxml();
 use Apache::lonlocal;
 use Apache::lonmenu;
@@ -489,7 +490,6 @@
                           my $avespan=$lcm/($#colcont+1);
                           for ($j=0;$j<=$#colcont;$j++) {
                               my $rid=$colcont[$j];
-
 			      my $metainfo =&get_buttons(\%hash,$rid).'<br />';
 			    unless (($target eq 'tex') || ($target eq 'tex_answer')) {
 				$r->print('<td colspan="'.$avespan.'"');
@@ -667,6 +667,26 @@
 		'</a>';
 	}
     }
+    if (($env{'request.course.id'}) && (&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) {
+        my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+        my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+        my $file=&Apache::lonnet::declutter($hash->{'src_'.$rid});
+        my ($cfile,$home,$switchserver,$forceedit,$forceview) =
+            &Apache::lonnet::can_edit_resource($file,$cnum,$cdom,$hash->{'src_'.$rid},$symb);
+        if ($cfile ne '') {
+            my $jscall = &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver,
+                                                                 $forceedit,1,$symb,undef,
+                                                                 &escape($env{'form.title'}));
+            if ($jscall) {
+                my $icon = 'pcstr.png';
+                my $label = &mt('Edit');
+                my $title = &mt('Edit this resource');
+                my $pic = '<img src="'.&Apache::loncommon::lonhttpdurl('/res/adm/pages/'.$icon).'"'.
+                          ' class="LC_icon" alt="'.$label.'" title="'.$title.'" />';
+                $metainfo .= ' <a href="javascript:'.$jscall.';">'.$pic.'</a>';
+            }
+        }
+    }
     return $metainfo;
 }
 




More information about the LON-CAPA-cvs mailing list