Diff for /loncom/interface/lonwhatsnew.pm between versions 1.90 and 1.99

version 1.90, 2009/02/24 16:16:35 version 1.99, 2010/01/27 13:08:01
Line 42  use Time::Local; Line 42  use Time::Local;
 use GDBM_File;  use GDBM_File;
 use lib '/home/httpd/lib/perl/';  use lib '/home/httpd/lib/perl/';
 use LONCAPA;  use LONCAPA;
   use HTML::Entities;
   
 #----------------------------  #----------------------------
 # handler  # handler
Line 288  sub display_actions_box { Line 289  sub display_actions_box {
     my $lctype = lc($crstype);      my $lctype = lc($crstype);
     my %stulabel = (      my %stulabel = (
                     'Course' => 'students',                      'Course' => 'students',
                     'Group' => 'members',                      'Community' => 'members',
                    );                     );
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
                  'yacc' => 'You are accessing an invalid course',                   'yacc' => 'You are accessing an invalid course',
Line 341  sub display_actions_box { Line 342  sub display_actions_box {
         return;          return;
     }      }
   
       my $header = '';
     if ($refpage eq 'start') {      if ($refpage eq 'start') {
         if (tie(my %bighash,'GDBM_File',$env{'request.course.fn'}.'.db',          if (tie(my %bighash,'GDBM_File',$env{'request.course.fn'}.'.db',
             &GDBM_READER(),0640)) {              &GDBM_READER(),0640)) {
             my $furl=$bighash{'first_url'};              my $furl=&HTML::Entities::encode($bighash{'first_url'},'"<>&');
             untie(%bighash);              untie(%bighash);
             $r->print('<span style="font-size: larger;"><a href="'.$furl.'">'.$lt{'gtfr'}.              $header .= '<b><a href="'.$furl.'">'.$lt{'gtfr'}.
                   '</a></span><br />');                    '</a></b><br />';
         }          }
     }      }
     $r->print(&mt('Page set to be displayed after you have selected a role in this '.$lctype).'.'      $header .= &mt('Page set to be displayed after you have selected a role in this '.$lctype).'.'
               .' <span class="LC_nobreak">'                .' <span class="LC_nobreak">'
               .&mt('Currently: [_1].','<i>'.$currinit.'</i>')                .&mt('Currently: [_1].','<i>'.$currinit.'</i>')
               .'&nbsp;&nbsp;'                .'&nbsp;&nbsp;'
               .&mt('[_1]Change[_2] for just [_3]this course[_4] or for all [_5]your courses[_6].'                .&mt('[_1]Change[_2] for just [_3]this '.$lctype.'[_4] or for [_5]all your courses/communities[_6].'
                   ,'<b>'                    ,'<b>'
                   ,'</b>'                    ,'</b>'
                   ,'<a href="/adm/whatsnew?command=courseinit&amp;refpage='.$refpage.'">'                    ,'<a href="/adm/whatsnew?command=courseinit&amp;refpage='.$refpage.'">'
                   ,'</a>'                    ,'</a>'
                   ,'<a href="/adm/preferences?action=changecourseinit&amp;refpage='.$refpage.'">'                    ,'<a href="/adm/preferences?action=changecourseinit&amp;refpage='.$refpage.'">'
                   ,'</a>')                    ,'</a>')
               .' </span><br /><hr />');                .' </span>';
   
       $r->print(&Apache::loncommon::head_subbox($header));
   
     if ($command eq 'reset') {      if ($command eq 'reset') {
         $result = &process_reset($cdom,$crs);          $result = &process_reset($cdom,$crs);
Line 378  sub display_actions_box { Line 382  sub display_actions_box {
     unless ($store_result eq 'ok') {       unless ($store_result eq 'ok') { 
         &Apache::lonnet::logthis('Error saving whatsnew settings: '.          &Apache::lonnet::logthis('Error saving whatsnew settings: '.
             $store_result.' for '.'user '.$uname.':'.$udom.' in '.$lctype.' '.$cid);              $store_result.' for '.'user '.$uname.':'.$udom.' in '.$lctype.' '.$cid);
         $result .= &mt('Unable to save visibility settings due to [_1]',          $result .= '<span class="LC_error">'
                        $store_result);                     .&mt('Unable to save visibility settings due to [_1]',
                          $store_result)
                     .'</span>';
     }      }
   
     if ($result) {      if ($result) {
         $r->print($result.'<hr width="100%" />');          $r->print($result.'<hr />');
     }      }
     $r->rflush();      $r->rflush();
   
Line 1124  sub process_reset { Line 1130  sub process_reset {
   
 sub process_update {  sub process_update {
     my ($uname,$udom,$threshold_titles) = @_;      my ($uname,$udom,$threshold_titles) = @_;
     my $setoutput = '<b>'.&mt('Changes to threshold(s) for problem tracking:').'</b><br />';      my $setoutput = '<b>'.&mt('Changes to threshold(s) for problem tracking:').'</b><br/><br />';
     foreach (keys %env) {      foreach (keys %env) {
         next if ($_!~/^form\.(.+)\_setparmval$/);          next if ($_!~/^form\.(.+)\_setparmval$/);
         my $name  = $1;          my $name  = $1;
Line 1135  sub process_update { Line 1141  sub process_update {
                         
             my ($shortname) = ($name =~ /^\Q$env{'request.course.id'}\E:threshold_(.+)$/);              my ($shortname) = ($name =~ /^\Q$env{'request.course.id'}\E:threshold_(.+)$/);
             if ($put_result eq 'ok') {              if ($put_result eq 'ok') {
                 $setoutput.=&mt('Set threshold for [_1] to [_2]',                  $setoutput.= &Apache::lonhtmlcommon::confirm_success(&mt('Set threshold for [_1] to [_2]',
  '<b>'.$$threshold_titles{$shortname}.'</b>',   '<b>'.$$threshold_titles{$shortname}.'</b>',
  '<b>'.$value.'</b>').'<br />';   '<b>'.$value.'</b>').'<br />');
     } else {      } else {
                 $setoutput.=&mt('Unable to set threshold for [_1] to [_2] due to [_3].',                  $setoutput.= &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set threshold for [_1] to [_2] due to [_3].',
  '<b>'.$name.'</b>','<b>'.$value.'</b>',   '<b>'.$name.'</b>','<b>'.$value.'</b>',
  '<tt>'.$put_result.'</tt>').'<br />';   '<tt>'.$put_result.'</tt>').'<br />',1);
             }              }
         }          }
     }      }
     return $setoutput;      return &Apache::loncommon::confirmwrapper($setoutput);
 }  }
   
 sub getnormalmail {  sub getnormalmail {
Line 1161  sub getnormalmail { Line 1167  sub getnormalmail {
         if (($fromcid) && ($fromcid eq $env{'request.course.id'})) {          if (($fromcid) && ($fromcid eq $env{'request.course.id'})) {
             if (defined($sendtime) && $sendtime!~/error/) {              if (defined($sendtime) && $sendtime!~/error/) {
                 my $numsendtime = $sendtime;                  my $numsendtime = $sendtime;
                 $sendtime = &Apache::lonlocal::locallocaltime($sendtime);  
                 if ($status eq 'new') {                  if ($status eq 'new') {
                     $msgcount ++;                  $sendtime = &Apache::lonlocal::locallocaltime($sendtime);
       $msgcount ++;
                     if ($shortsubj eq '') {                      if ($shortsubj eq '') {
                         $shortsubj = &mt('No subject');                          $shortsubj = &mt('No subject');
                     }                      }
Line 1835  sub store_interval_setting { Line 1841  sub store_interval_setting {
                                              \%interval_settings,$udom,$uname);                                               \%interval_settings,$udom,$uname);
         if ($outcome eq 'ok') {          if ($outcome eq 'ok') {
             if (ref($interval_titles->{$context}) eq 'HASH') {              if (ref($interval_titles->{$context}) eq 'HASH') {
                 $result = &mt('New filter setting: [_1].','<b>'.                   $result = &Apache::lonhtmlcommon::confirm_success(&mt('New filter setting: [_1].','<b>'. 
                               $interval_titles->{$context}->{$env{'form.interval'}}.'</b>').'<br />';                                $interval_titles->{$context}->{$env{'form.interval'}}.'</b>').'<br />');
             }              }
         } else {          } else {
     my $lctype = lc(&Apache::loncommon::course_type());      my $lctype = lc(&Apache::loncommon::course_type());
             &Apache::lonnet::logthis('Error saving whatsnew '.$context.' interval setting'.              &Apache::lonnet::logthis('Error saving whatsnew '.$context.' interval setting'.
                 ' '.$outcome.' for '.$uname.':'.$udom.' in '.$lctype.' '.$cid);                  ' '.$outcome.' for '.$uname.':'.$udom.' in '.$lctype.' '.$cid);
             $result = &mt('Unable to set interval to [_1] due to [_2].',              $result = &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set interval to [_1] due to [_2].',
                          '<b>'.$interval_titles->{$context}->{$env{'form.interval'}}.'</b>',                           '<b>'.$interval_titles->{$context}->{$env{'form.interval'}}.'</b>',
                          '<tt>'.$outcome.'</tt>.<br />');                           '<tt>'.$outcome.'</tt>'),1);
         }          }
     }      }
     return $result;      return &Apache::loncommon::confirmwrapper($result);
 }  }
   
 sub store_discussion_setting {  sub store_discussion_setting {
Line 1859  sub store_discussion_setting { Line 1865  sub store_discussion_setting {
         my $outcome = &Apache::lonnet::put('nohist_whatsnew',          my $outcome = &Apache::lonnet::put('nohist_whatsnew',
                                              \%discussion_settings,$udom,$uname);                                               \%discussion_settings,$udom,$uname);
         if ($outcome eq 'ok') {          if ($outcome eq 'ok') {
             $result = &mt('Count unread posts in discussions display set to [_1]',              $result = &Apache::lonhtmlcommon::confirm_success(&mt('Count unread posts in discussions display set to [_1]',
                   '<b>'.&mt($env{'form.countunread'}).'</b>').'<br />';                    '<b>'.&mt($env{'form.countunread'}).'</b>').'<br />');
                                                                                                                                                                       
         } else {          } else {
     my $lctype = lc(&Apache::loncommon::course_type());      my $lctype = lc(&Apache::loncommon::course_type());
             &Apache::lonnet::logthis('Error saving whatsnew countunread setting'.              &Apache::lonnet::logthis('Error saving whatsnew countunread setting'.
                 ' '.$outcome.' for '.$uname.':'.$udom.' in '.$lctype.' '.$cid);                  ' '.$outcome.' for '.$uname.':'.$udom.' in '.$lctype.' '.$cid);
             $result = &mt('Unable to set "number unread posts display" to [_1]'.              $result = &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set "number unread posts display" to [_1]'.
                           ' due to [_2].',                            ' due to [_2].',
                          '<b>'.&mt($env{'form.countunread'}).'</b>',                           '<b>'.&mt($env{'form.countunread'}).'</b>',
                          '<tt>'.$outcome.'</tt>.<br />');                           '<tt>'.$outcome.'</tt>'),1);
         }          }
     }      }
     return $result;      return &Apache::loncommon::confirmwrapper($result);
 }  }
   
 sub store_courseinit_setting {  sub store_courseinit_setting {
Line 1897  sub store_courseinit_setting { Line 1903  sub store_courseinit_setting {
                                            \%courseinit_settings,$udom,$uname);                                             \%courseinit_settings,$udom,$uname);
             if ($outcome eq 'ok') {              if ($outcome eq 'ok') {
                 if ($page_control eq 'global preferences') {                  if ($page_control eq 'global preferences') {
                     $result = &mt("Page displayed after role selection in $lctype now set by [_1]user's global preferences[_2].",'<b>','</b>');                      $result = &Apache::lonhtmlcommon::confirm_success(&mt("Page displayed after role selection in $lctype now set by [_1]user's global preferences[_2].",'<b>','</b>'));
                 } else {                  } else {
                     $result = &mt('Page displayed after role selection in this '.$lctype.' set to [_1].'                      $result = &Apache::lonhtmlcommon::confirm_success(&mt('Page displayed after role selection in this '.$lctype.' set to [_1].'
                                  ,'<b>'.$$initpage{$env{'form.courseinit_page'}}.'</b>');                                   ,'<b>'.$$initpage{$env{'form.courseinit_page'}}.'</b>'));
                 }                  }
             } else {              } else {
                 &Apache::lonnet::logthis('Error saving whatsnew courseinit '.                  &Apache::lonnet::logthis('Error saving whatsnew courseinit '.
                                          'setting: '.$outcome.' for '.$uname.                                           'setting: '.$outcome.' for '.$uname.
                                          ':'.$udom.' in '.$lctype.' '.$cid);                                           ':'.$udom.' in '.$lctype.' '.$cid);
                 if ($page_control eq 'global preferences') {                  if ($page_control eq 'global preferences') {
                     $result = &mt('Unable to set control of page display to [_1]'.                      $result = &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set control of page display to [_1]'.
                           ' due to [_2].',                            ' due to [_2].',
                          '<b>'.$page_control.'</b>',                           '<b>'.$page_control.'</b>',
                          '<tt>'.$outcome.'</tt>.<br />');                           '<tt>'.$outcome.'</tt>'),1);
                 } else {                  } else {
                     $result = &mt('Unable to set page display, after role selection, for this '.$lctype.' to [_1] due to [_2].'                      $result = &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set page display, after role selection, for this '.$lctype.' to [_1] due to [_2].'
                                  ,'<b>'.$$initpage{$env{'form.courseinit_page'}}.'</b>'                                   ,'<b>'.$$initpage{$env{'form.courseinit_page'}}.'</b>'
                                  ,'<tt>'.$outcome.'</tt>')                                   ,'<tt>'.$outcome.'</tt>'),1);
                              .'<br />';  
                 }                  }
             }              }
         }          }
     }      }
     return $result;      return &Apache::loncommon::confirmwrapper($result);
 }  }
   
 sub start_box {  sub start_box {
Line 1952  sub start_box { Line 1957  sub start_box {
          if ($$show{$caller}) {           if ($$show{$caller}) {
              $r->print('               $r->print('
               <tr>                <tr>
                 <td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgthreshold&refpage='.$refpage.'">'.$lt{'chth'}.'</a></td>                  <td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgthreshold&amp;refpage='.$refpage.'">'.$lt{'chth'}.'</a></td>
               </tr>');                </tr>');
          }           }
      } elsif (($caller eq 'versionchanges') && ($$show{$caller})) {       } elsif (($caller eq 'versionchanges') && ($$show{$caller})) {
          if ($$show{$caller}) {           if ($$show{$caller}) {
              $r->print('               $r->print('
               <tr>                <tr>
                 <td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chginterval&refpage='.$refpage.'">'.$lt{'chin'}.'</a></td>                  <td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chginterval&amp;refpage='.$refpage.'">'.$lt{'chin'}.'</a></td>
               </tr>');                </tr>');
          }           }
      } elsif ($caller eq 'coursediscussion') {       } elsif ($caller eq 'coursediscussion') {
          if ($$show{$caller}) {           if ($$show{$caller}) {
              $r->print('               $r->print('
               <tr>                <tr>
                 <td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgdisc&refpage='.$refpage.'">'.$lt{'chop'}.'</a></td>                  <td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgdisc&amp;refpage='.$refpage.'">'.$lt{'chop'}.'</a></td>
               </tr>');                </tr>');
          }           }
      } elsif (($caller eq 'newroles') && ($$show{$caller})) {       } elsif (($caller eq 'newroles') && ($$show{$caller})) {
          if ($$show{$caller}) {           if ($$show{$caller}) {
              $r->print('               $r->print('
               <tr>                <tr>
                 <td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgnewroleinterval&refpage='.$refpage.'">'.$lt{'chin'}.'</a></td>                  <td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgnewroleinterval&amp;refpage='.$refpage.'">'.$lt{'chin'}.'</a></td>
               </tr>');                </tr>');
          }           }
      } elsif (($caller eq 'oldroles') && ($$show{$caller})) {       } elsif (($caller eq 'oldroles') && ($$show{$caller})) {
          if ($$show{$caller}) {           if ($$show{$caller}) {
              $r->print('               $r->print('
               <tr>                <tr>
                 <td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgoldroleinterval&refpage='.$refpage.'">'.$lt{'chin'}.'</a></td>                  <td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgoldroleinterval&amp;refpage='.$refpage.'">'.$lt{'chin'}.'</a></td>
               </tr>');                </tr>');
          }           }
      }       }

Removed from v.1.90  
changed lines
  Added in v.1.99


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