Diff for /loncom/interface/lonmeta.pm between versions 1.245 and 1.246

version 1.245, 2012/03/16 02:12:26 version 1.246, 2012/05/21 19:01:12
Line 874  sub report_bombs { Line 874  sub report_bombs {
     $uri = &Apache::lonnet::declutter($uri);      $uri = &Apache::lonnet::declutter($uri);
     $r->print('<h1>'.&Apache::lonnet::clutter($uri).'</h1>');      $r->print('<h1>'.&Apache::lonnet::clutter($uri).'</h1>');
     my ($domain,$author)=($uri=~/^($match_domain)\/($match_username)\//);      my ($domain,$author)=($uri=~/^($match_domain)\/($match_username)\//);
     if (&Apache::loncacc::constructaccess('/priv/'.$domain.'/'.$author.'/')) {      if (!&Apache::loncacc::constructaccess('/priv/'.$domain.'/'.$author.'/')) {
  if ($env{'form.clearbombs'}) {          $r->print('<p class="LC_error">'.&mt('Not authorized').'</p>');
     &Apache::lonmsg::clear_author_res_msg($uri);          return;
  }      }
         my $clear=&mt('Clear all Messages in Subdirectory');  
         my $cancel=&mt('Back to Directory');      my $showbuttons=1;
         my $cancelurl=$uri;      my $message='';
         $cancelurl=~s/^\Q$domain\E/\/priv/;      if ($env{'form.clearbombs'}) {
         $r->print(<<ENDCLEAR);          my $rc=&Apache::lonmsg::clear_author_res_msg($uri);
 <form method="post">          if ($rc eq 'ok') {
 <input type="submit" name="clearbombs" value="$clear" />                  $message=&Apache::lonhtmlcommon::confirm_success(
 <a href="$cancelurl">$cancel</a>                      &mt('Messages cleared.'));
 </form><hr />                  $showbuttons=0;
 ENDCLEAR          } else {
                   $message=&Apache::lonhtmlcommon::confirm_success(
                                &mt('Error clearing messages'),1)
                           .'<br />'.&mt('Error: [_1]',$rc);
           }
       }
   
       if ($message) {    
           $message=&Apache::loncommon::confirmwrapper($message);
           $r->print($message);
       }
   
       my $cancelurl=$uri;
       $cancelurl=~s/^\Q$domain\E/\/priv\/$domain/;
   
       if ($showbuttons) {
           $r->print(
               '<form method="post" action="">'.
               '<input type="submit" name="clearbombs" value="'.
                   &mt('Clear all Messages in Subdirectory').'" />'.
               ' <a href="'.$cancelurl.'">'.
                   &mt('Back to Source Directory').'</a>'.
               '</form><hr />'
           );
           # Display all bombs of subdirectory
         my %brokenurls =           my %brokenurls = 
             &Apache::lonmsg::all_url_author_res_msg($author,$domain);              &Apache::lonmsg::all_url_author_res_msg($author,$domain);
         foreach my $key (sort(keys(%brokenurls))) {          foreach my $key (sort(keys(%brokenurls))) {
Line 899  ENDCLEAR Line 923  ENDCLEAR
             }              }
         }          }
     } else {      } else {
         $r->print(&mt('Not authorized'));              my $functions=&Apache::lonhtmlcommon::start_funclist('Actions');
               $functions.=&Apache::lonhtmlcommon::add_item_funclist(
                               '<a href="'.$cancelurl.'">'.
                               &mt('Back to Source Directory').'</a>');
               $functions .= &Apache::lonhtmlcommon::end_funclist();
               $r->print('<p>'.$functions.'</p>');
     }      }
     return;      return;
 }  }
Line 1193  sub print_dynamic_metadata { Line 1222  sub print_dynamic_metadata {
         my $bombs = &Apache::lonmsg::retrieve_author_res_msg($uri);          my $bombs = &Apache::lonmsg::retrieve_author_res_msg($uri);
         if (defined($bombs) && $bombs ne '') {          if (defined($bombs) && $bombs ne '') {
             $r->print('<a name="bombs" />'              $r->print('<a name="bombs" />'
                      .'<h4 class="LC_error">'.&mt('Error Messages').'</h4>'                       .'<h4 class="LC_warning">'.&mt('Error Messages').'</h4>'
                      .'<div>('                       .'<div>('
                      .&mt('visible to author and co-authors only')                       .&mt('visible to author and co-authors only')
                      .')</div>'                       .')</div>'
Line 1276  sub present_editable_metadata { Line 1305  sub present_editable_metadata {
     $target=~s/\.meta$//;      $target=~s/\.meta$//;
     my $bombs=&Apache::lonmsg::retrieve_author_res_msg($target);      my $bombs=&Apache::lonmsg::retrieve_author_res_msg($target);
     if ($bombs) {      if ($bombs) {
         my $showdel=1;          # Display Bombs, not Metadata
           $r->print("<h1>$disuri</h1>");
           my $showbuttons=1;
           my $message='';
           my $rc='';
         if ($env{'form.delmsg'}) {          if ($env{'form.delmsg'}) {
             if (&Apache::lonmsg::del_url_author_res_msg($target) eq 'ok') {              $rc=&Apache::lonmsg::del_url_author_res_msg($target);
                 $bombs=&mt('Messages deleted.');              if ($rc eq 'ok') {
  $showdel=0;                  $message=&Apache::lonhtmlcommon::confirm_success(
                                &mt('Messages deleted.'));
    $showbuttons=0;
             } else {              } else {
                 $bombs=&mt('Error deleting messages');                  $message=&Apache::lonhtmlcommon::confirm_success(
                                &mt('Error deleting messages'), 1)
                           .'<br />'.&mt('Error: [_1]',$rc);
             }              }
         }          }
         if ($env{'form.clearmsg'}) {          if ($env{'form.clearmsg'}) {
     my $cleardir=$target;      my $cleardir=$target;
     $cleardir=~s/\/[^\/]+$/\//;      $cleardir=~s/\/[^\/]+$/\//; # Extract dir: keep path, remove filename
             if (&Apache::lonmsg::clear_author_res_msg($cleardir) eq 'ok') {              $rc=&Apache::lonmsg::clear_author_res_msg($cleardir);
                 $bombs=&mt('Messages cleared.');              if ($rc eq 'ok') {
  $showdel=0;                  $message=&Apache::lonhtmlcommon::confirm_success(
                       &mt('Messages cleared.'));
    $showbuttons=0;
             } else {              } else {
                 $bombs=&mt('Error clearing messages');                  $message=&Apache::lonhtmlcommon::confirm_success(
                                &mt('Error clearing messages'),1)
                           .'<br />'.&mt('Error: [_1]',$rc);
             }              }
         }          }
         my $del=&mt('Delete Messages for this Resource');          if ($message) {
  my $clear=&mt('Clear all Messages in Subdirectory');              $message=&Apache::loncommon::confirmwrapper($message);
  my $goback=&mt('Back to Source File');              $r->print($message);
         $r->print(<<ENDBOMBS);          }
 <h1>$disuri</h1>  
 <form method="post" action="" name="defaultmeta">          $r->print('<form method="post" action="" name="defaultmeta">');
 ENDBOMBS          if ($showbuttons) {
         if ($showdel) {              $r->print(
     $r->print(<<ENDDEL);                  '<input type="submit" name="delmsg" value="'.
 <input type="submit" name="delmsg" value="$del" />                  &mt('Delete Messages for this Resource').'" />'.
 <input type="submit" name="clearmsg" value="$clear" />                  '<input type="submit" name="clearmsg" value="'.
 ENDDEL                  &mt('Clear all Messages in Subdirectory').'" />'
                  .'<br />'.$bombs
               );
         } else {          } else {
             $r->print('<p><a href="'.$disuri.'">'.$goback.'</a></p>');              my $functions=&Apache::lonhtmlcommon::start_funclist('Actions');
     if ($env{'form.clearmsg'}) {              $functions.=&Apache::lonhtmlcommon::add_item_funclist(
  my ($diruri) = ($disuri =~ m{(.*/)[^/]*});                              '<a href="'.$disuri.'">'.
  $r->print('<p><a href="'.$diruri.'">'.                              &mt('Back to Source File').'</a>');
   &mt('Back To Directory').'</a></p>');              my ($diruri) = ($disuri =~ m{(.*/)[^/]*});
     }              $functions.=&Apache::lonhtmlcommon::add_item_funclist(
  }                              '<a href="'.$diruri.'">'.
  $r->print('<br />'.$bombs);                              &mt('Back to Source Directory').'</a>');
               $functions .= &Apache::lonhtmlcommon::end_funclist();
               $r->print('<p>'.$functions.'</p>');
           }
     } else {      } else {
   
           # Display Metadata, not Bombs
         my $displayfile=&mt('Metadata for [_1]',$disuri);          my $displayfile=&mt('Metadata for [_1]',$disuri);
         if ($disuri=~/\/default$/) {          if ($disuri=~/\/default$/) {
             my $dir=$disuri;              my $dir=$disuri;

Removed from v.1.245  
changed lines
  Added in v.1.246


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>