[LON-CAPA-cvs] cvs: loncom /publisher lonpubdir.pm

bisitz bisitz at source.lon-capa.org
Fri Apr 27 12:13:48 EDT 2012


bisitz		Fri Apr 27 16:13:48 2012 EDT

  Modified files:              
    /loncom/publisher	lonpubdir.pm 
  Log:
  - Bug 1320: Corrected links - show bombs again in CSTR
      Work in progress:
          - Resource row: access to bomb needed
          - Confirm backward compatibility
  - Improve lonpubdir.pm 1.142: Only one programmened link "Edit Metadata"
  - Remove inconsistent manual padding
  
  
Index: loncom/publisher/lonpubdir.pm
diff -u loncom/publisher/lonpubdir.pm:1.142 loncom/publisher/lonpubdir.pm:1.143
--- loncom/publisher/lonpubdir.pm:1.142	Tue Apr 24 10:29:53 2012
+++ loncom/publisher/lonpubdir.pm	Fri Apr 27 16:13:47 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Construction Space Directory Lister
 #
-# $Id: lonpubdir.pm,v 1.142 2012/04/24 10:29:53 bisitz Exp $
+# $Id: lonpubdir.pm,v 1.143 2012/04/27 16:13:47 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -458,11 +458,12 @@
     my $disfilename = $dirname;
 # Don't display directory itself, and there is no way up from root directory
     unless ((($dirname eq '..') && ($reqfile=~/^\/[^\/]+\/[^\/]+$/)) || ($dirname eq '.')) {
-	my $kaputt=0;
+        my $kaputt=0;
         if (ref($bombs) eq 'HASH') {
-	    foreach my $key (keys(%{$bombs})) {
-	        if ($key =~ m{^\Q$targetdir/$disfilename\E/}) { $kaputt=1; last; }
-	    }
+            foreach my $key (keys(%{$bombs})) {
+                my $currentdir = &Apache::lonnet::declutter("$targetdir/$disfilename");
+                if (($key) =~ m{^\Q$currentdir\E/}) { $kaputt=1; last; }
+            }
         }
 #
 # Get the metadata from that directory's default.meta to display titles
@@ -522,7 +523,7 @@
     my $pubstatus = 'unpublished';
     my $status=&mt('Unpublished');
     my $css_class='LC_browser_file';
-    my $title=' ';
+    my $title='';
     my $publish_button=&mt('Publish');
     my $cstr_dir = $r->dir_config('lonDocRoot').'/priv'.$thisdisfn;
     my $linkfilename=&HTML::Entities::encode('/priv'.$thisdisfn.'/'.$filename,'<>&"');
@@ -590,10 +591,6 @@
                              &mt('Diffs'),600,500);
 	    }
 	} 
-
-	$title.="\n".'<br /><a href="'.$linkfilename.'.meta">'. 
-	    ($$bombs{$targetdir.'/'.$filename}?'<img src="/adm/lonMisc/bomb.gif" border="0" alt="'.&mt('bomb').'" />':&mt('Edit Metadata')).'</a>';
-
 	if (!$meta_same) {
 	    $title = &mt('Metadata Modified').'<br />'.$title.
 		'<br />'.
@@ -608,10 +605,15 @@
 	$status.="\n".'<br />'.
              &Apache::loncommon::modal_link(
                  '/adm/retrieve?filename='.$linkfilename.'&inhibitmenu=yes&add_modal=yes',&mt('Retrieve'),600,500);
-    } else {
-        # Allow editing metadata of unpublished resources
-        $title .= '<a href="'.$linkfilename.'.meta">'.&mt('Edit Metadata').'</a>';
     }
+    # Allow editing metadata of published and unpublished resources
+    $title .= "\n".'<br />' if ($title);
+    $title .= '<a href="'.$linkfilename.'.meta">'.
+              ($$bombs{&Apache::lonnet::declutter($targetdir.'/'.$filename)}?
+                  '<img src="/adm/lonMisc/bomb.gif" border="0" alt="'.&mt('bomb').'" />':
+                  &mt('Edit Metadata')).
+              '</a>';
+
     my $editlink='';
     my $editlink2='';
     if ($filename=~/\.(xml|html|htm|xhtml|xhtm|sty)$/) {




More information about the LON-CAPA-cvs mailing list