Diff for /loncom/interface/lonpreferences.pm between versions 1.170 and 1.179

version 1.170, 2009/09/08 22:17:02 version 1.179, 2009/12/02 18:33:27
Line 42  use Apache::loncommon(); Line 42  use Apache::loncommon();
 use Apache::lonhtmlcommon();  use Apache::lonhtmlcommon();
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::lonnet;  use Apache::lonnet;
   use LONCAPA::lonauthcgi();
 use LONCAPA();  use LONCAPA();
   
 #  #
Line 165  sub languagechanger { Line 166  sub languagechanger {
                = &Apache::loncommon::plainlanguagedescription($_);                 = &Apache::loncommon::plainlanguagedescription($_);
  }   }
     }      }
     my $selectionbox=&Apache::loncommon::select_form($language,'language',      my $selectionbox=
      %langchoices);             &Apache::loncommon::select_form(
                  $language,
                  'language',
                  &Apache::lonlocal::texthash(%langchoices));
     $r->print(<<ENDLSCREEN);      $r->print(<<ENDLSCREEN);
 <form name="prefs" action="/adm/preferences" method="post">  <form name="prefs" action="/adm/preferences" method="post">
 <input type="hidden" name="action" value="verify_and_change_languages" />  <input type="hidden" name="action" value="verify_and_change_languages" />
Line 205  sub texenginechanger { Line 209  sub texenginechanger {
     my $r = shift;      my $r = shift;
     Apache::lonhtmlcommon::add_breadcrumb(      Apache::lonhtmlcommon::add_breadcrumb(
     { href => '/adm/preferences?action=changetexenginepref',      { href => '/adm/preferences?action=changetexenginepref',
                 text => 'Change How Math Equations Are Displayed'});                  text => 'Math display settings'});
     $r->print(Apache::loncommon::start_page('Content Display Settings'));      $r->print(Apache::loncommon::start_page('Content Display Settings'));
     $r->print(Apache::lonhtmlcommon::breadcrumbs('Change How Math Equations Are Displayed'));      $r->print(Apache::lonhtmlcommon::breadcrumbs('Math display settings'));
     my $user       = $env{'user.name'};      my $user       = $env{'user.name'};
     my $domain     = $env{'user.domain'};      my $domain     = $env{'user.domain'};
     my %userenv = &Apache::lonnet::get('environment',['texengine']);      my %userenv = &Apache::lonnet::get('environment',['texengine']);
Line 220  sub texenginechanger { Line 224  sub texenginechanger {
      'mimetex' => 'mimetex (Convert to Images)',       'mimetex' => 'mimetex (Convert to Images)',
                      'raw' => 'Raw (Screen Reader)'                       'raw' => 'Raw (Screen Reader)'
                      );                       );
     my $selectionbox=&Apache::loncommon::select_form($texengine,'texengine',      my $selectionbox=
      %mathchoices);             &Apache::loncommon::select_form(
                  $texengine,
                  'texengine',
                  &Apache::lonlocal::texthash(%mathchoices));
     my $jsMath_start=&Apache::lontexconvert::jsMath_header();      my $jsMath_start=&Apache::lontexconvert::jsMath_header();
     my %lt=&Apache::lonlocal::texthash(      my %lt=&Apache::lonlocal::texthash(
       'headline' => 'Change Math Preferences',        'headline' => 'Change how math is displayed',
       'preftxt'  => 'Preferred method to display Math',        'preftxt'  => 'Preferred method to display math',
       'change'   => 'Save',        'change'   => 'Save',
       'exmpl'    => 'Examples',        'exmpl'    => 'Examples',
       'jsmath'   => 'jsMath:',        'jsmath'   => 'jsMath:',
Line 280  if (jsMath.nofonts == 1) { Line 287  if (jsMath.nofonts == 1) {
   
 <h3>$lt{'tth'}</h3>  <h3>$lt{'tth'}</h3>
 <p>  <p>
 <iframe src="/res/adm/pages/math_example.tex?inhibitmenu=yes&texengine=tth" width="400" height="200"></iframe>  <iframe src="/res/adm/pages/math_example.tex?inhibitmenu=yes&texengine=tth" width="400" height="220"></iframe>
 </p>  </p>
 ENDLSCREEN  ENDLSCREEN
     if ($env{'environment.texengine'} ne 'jsMath') {      if ($env{'environment.texengine'} ne 'jsMath') {
Line 778  sub msgforwardchanger { Line 785  sub msgforwardchanger {
                                           all   => 'All',                                            all   => 'All',
                                           crit  => 'Critical only',                                            crit  => 'Critical only',
                                           reg   => 'Non-critical only',                                            reg   => 'Non-critical only',
                                           foad  => 'Forwarding Address(es)',                                            foad  => 'Forward to account(s)',
                                           noti  => 'Notification E-mail Address(es)',                                             fwdm  => 'Forward messages to other account(s) in LON-CAPA',
                                             noti  => 'E-mail notification of LON-CAPA messages',
                                           foad_exmpl => 'e.g. <tt>userA:domain1,userB:domain2,...</tt>',                                            foad_exmpl => 'e.g. <tt>userA:domain1,userB:domain2,...</tt>',
                                           mnot  => 'E-mail Address(es) which should be notified about new LON-CAPA messages',                                            mnot  => 'E-mail address(es) which should be notified about new LON-CAPA messages',
  # old: 'Message Notification Email Address(es)',  
                                           mnot_exmpl => 'e.g. <tt>joe@doe.com</tt>',                                            mnot_exmpl => 'e.g. <tt>joe@doe.com</tt>',
                                           chg   => 'Save',                                            chg   => 'Save',
                                           email => 'The e-mail address entered in row ',                                            email => 'The e-mail address entered in row ',
Line 792  sub msgforwardchanger { Line 799  sub msgforwardchanger {
                                         );                                          );
     Apache::lonhtmlcommon::add_breadcrumb(      Apache::lonhtmlcommon::add_breadcrumb(
     { href => '/adm/preferences?action=changemsgforward',      { href => '/adm/preferences?action=changemsgforward',
  text => 'Change Message Forwarding/Notification'});   text => 'Messages & Notifications'});
     $r->print(Apache::loncommon::start_page('Message Management'));      $r->print(Apache::loncommon::start_page('Messages &amp; Notifications'));
     $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Message Forwarding/Notification'));      $r->print(Apache::lonhtmlcommon::breadcrumbs('Messages &amp; Notifications'));
     my $forwardingHelp = &Apache::loncommon::help_open_topic("Prefs_Forwarding");      my $forwardingHelp = &Apache::loncommon::help_open_topic("Prefs_Forwarding");
     my $notificationHelp = &Apache::loncommon::help_open_topic("Prefs_Notification");      my $notificationHelp = &Apache::loncommon::help_open_topic("Prefs_Notification");
     my $criticalMessageHelp = &Apache::loncommon::help_open_topic("Course_Critical_Message");      my $criticalMessageHelp = &Apache::loncommon::help_open_topic("Course_Critical_Message");
Line 860  $validatescript Line 867  $validatescript
     $r->print(<<ENDMSG);      $r->print(<<ENDMSG);
 $jscript  $jscript
 $message  $message
 <h3>$lt{'foad'} $forwardingHelp</h3>  <h3>$lt{'fwdm'} $forwardingHelp</h3>
 <form name="prefs" action="/adm/preferences" method="post">  <form name="prefs" action="/adm/preferences" method="post">
 <input type="hidden" name="action" value="verify_and_change_msgforward" />  <input type="hidden" name="action" value="verify_and_change_msgforward" />
 $lt{'foad'} ($lt{'foad_exmpl'}):  $lt{'foad'} ($lt{'foad_exmpl'}):
 <input type="text" size="40" value="$msgforward" name="msgforward" /><br />  <input type="text" size="40" value="$msgforward" name="msgforward" />
   <br /><br />
 <h3>$lt{'noti'} $notificationHelp</h3>  <h3>$lt{'noti'} $notificationHelp</h3>
 $lt{'mnot'} ($lt{'mnot_exmpl'}):<br />  $lt{'mnot'} ($lt{'mnot_exmpl'}):<br />
 ENDMSG  ENDMSG
Line 909  ENDMSG Line 917  ENDMSG
                        '<input type="radio" name="notify_type_'.$num.                          '<input type="radio" name="notify_type_'.$num. 
                        '" value="'.$type.'" '.$chk{$type}.                         '" value="'.$type.'" '.$chk{$type}.
                        ' onchange="javascript:address_changes('."'$num'".')" />'.                         ' onchange="javascript:address_changes('."'$num'".')" />'.
                        $lt{$type}.'</label></span>&nbsp;';                         $lt{$type}.'</label></span>'.('&nbsp;' x4);
         }          }
         my $htmlon = '';          my $htmlon = '';
         my $htmloff = '';          my $htmloff = '';
Line 921  ENDMSG Line 929  ENDMSG
         $output .= '</td><td><label><input type="radio" name="html_'.$num.          $output .= '</td><td><label><input type="radio" name="html_'.$num.
                    '" value="1" '.$htmlon.                     '" value="1" '.$htmlon.
                    ' onchange="javascript:address_changes('."'$num'".')" />'.                     ' onchange="javascript:address_changes('."'$num'".')" />'.
                    &mt('Yes').'</label>&nbsp;'.                     &mt('Yes').'</label>'.('&nbsp;' x3).
                    '<label><input type="radio" name="html_'.$num.'" value="0" '.                     '<label><input type="radio" name="html_'.$num.'" value="0" '.
                    $htmloff. ' onchange="javascript:address_changes('."'$num'".                     $htmloff. ' onchange="javascript:address_changes('."'$num'".
 ')" />'.  ')" />'.
Line 946  ENDMSG Line 954  ENDMSG
         $output .= '<span class="LC_nobreak"><label>'.          $output .= '<span class="LC_nobreak"><label>'.
                    '<input type="radio" name="notify_type_'.$num.                     '<input type="radio" name="notify_type_'.$num.
                    '" value="'.$type.'" '.$defchk{$type}.'/>'.                     '" value="'.$type.'" '.$defchk{$type}.'/>'.
                    $lt{$type}.'</label></span>&nbsp;';                     $lt{$type}.'</label></span>'.('&nbsp;' x4);
     }      }
     $output .= '</td><td><label><input type="radio" name="html_'.$num.      $output .= '</td><td><label><input type="radio" name="html_'.$num.
                '" value="1" />'.&mt('Yes').'</label>&nbsp;'.                 '" value="1" />'.&mt('Yes').'</label>'.('&nbsp;' x3).
                '<label><input type="radio" name="html_'.$num.'" value="0" '.                 '<label><input type="radio" name="html_'.$num.'" value="0" '.
                ' checked="checked" />'.                 ' checked="checked" />'.
                &mt('No').'</label></td>'.                 &mt('No').'</label></td>'.
Line 1338  sub jscript_send { Line 1346  sub jscript_send {
                    this.document.client.elements.uname.value;                     this.document.client.elements.uname.value;
         this.document.pserver.elements.udom.value =          this.document.pserver.elements.udom.value =
                    this.document.client.elements.udom.options[this.document.client.elements.udom.selectedIndex].value;                     this.document.client.elements.udom.options[this.document.client.elements.udom.selectedIndex].value;
           this.document.pserver.elements.email.value =
                      this.document.client.elements.email.value;
 |;  |;
     }      }
     $ output .= qq|      $ output .= qq|
Line 1422  sub server_form { Line 1432  sub server_form {
 <input type="hidden" name="token"   value="$mailtoken" />  <input type="hidden" name="token"   value="$mailtoken" />
 <input type="hidden" name="uname"   value="" />  <input type="hidden" name="uname"   value="" />
 <input type="hidden" name="udom"   value="" />  <input type="hidden" name="udom"   value="" />
   <input type="hidden" name="email"   value="" />
   
 |;  |;
     }      }
Line 1574  ENDERROR Line 1585  ENDERROR
         }          }
     } else {      } else {
  # error error: run in circles, scream and shout   # error error: run in circles, scream and shout
         $message = &Apache::lonhtmlcommon::confirm_success(          if ($caller eq 'reset_by_email') {
           &mt("The password for user [_1] was not changed.",'<i>'.$user.'</i>').' '.&mt('Please make sure your old password was entered correctly.'),1);              if (!$result) {
         unless ($caller eq 'reset_by_email') {                  return 1;
               } else {
                   return $result;
               }
           } else {
               $message = &Apache::lonhtmlcommon::confirm_success(
                   &mt("The password for user [_1] was not changed.",'<i>'.$user.'</i>').' '.&mt('Please make sure your old password was entered correctly.'),1);
             $message=&Apache::loncommon::confirmwrapper($message);              $message=&Apache::loncommon::confirmwrapper($message);
             &print_main_menu($r, $message);              &print_main_menu($r, $message);
         }          }
         return 1;  
     }      }
     return;      return;
 }  }
Line 1593  sub discussionchanger { Line 1609  sub discussionchanger {
     Apache::lonhtmlcommon::add_breadcrumb(      Apache::lonhtmlcommon::add_breadcrumb(
     { href => '/adm/preferences?action=changediscussions',      { href => '/adm/preferences?action=changediscussions',
                 text => 'Change Discussion Preferences'});                  text => 'Change Discussion Preferences'});
     $r->print(Apache::loncommon::start_page('Message Management'));      $r->print(Apache::loncommon::start_page('Change Discussion Preferences'));
     $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Discussion Preferences'));      $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Discussion Preferences'));
     my $user       = $env{'user.name'};      my $user       = $env{'user.name'};
     my $domain     = $env{'user.domain'};      my $domain     = $env{'user.domain'};
Line 1608  sub discussionchanger { Line 1624  sub discussionchanger {
         }          }
     }      }
     if (defined($userenv{'discmarkread'})) {      if (defined($userenv{'discmarkread'})) {
         unless ($userenv{'discdisplay'} eq '') {           unless ($userenv{'discmarkread'} eq '') { 
             $discmark = $userenv{'discmarkread'};              $discmark = $userenv{'discmarkread'};
         }          }
     }      }
Line 1652  sub discussionchanger { Line 1668  sub discussionchanger {
         $currmark = $lt{'ondisp'};          $currmark = $lt{'ondisp'};
         $newmark = 'onmark';          $newmark = 'onmark';
     }      }
       
     $r->print(<<"END");      $r->print(<<"END");
 <form name="prefs" action="/adm/preferences" method="post">  <form name="prefs" action="/adm/preferences" method="post">
 <input type="hidden" name="action" value="verify_and_change_discussion" />  <input type="hidden" name="action" value="verify_and_change_discussion" />
Line 1701  sub verify_and_change_discussion { Line 1717  sub verify_and_change_discussion {
     if (defined($env{'form.discdisp'}) ) {      if (defined($env{'form.discdisp'}) ) {
         my $newdisp  = $env{'form.newdisp'};          my $newdisp  = $env{'form.newdisp'};
         if ($newdisp eq 'unread') {          if ($newdisp eq 'unread') {
             $message .=&mt('In discussions: only new posts will be displayed.').'<br />';              $message .=&Apache::lonhtmlcommon::confirm_success(&mt('In discussions: only new posts will be displayed.')).'<br />';
             &Apache::lonnet::put('environment',{'discdisplay' => $newdisp});              &Apache::lonnet::put('environment',{'discdisplay' => $newdisp});
             &Apache::lonnet::appenv({'environment.discdisplay' => $newdisp});              &Apache::lonnet::appenv({'environment.discdisplay' => $newdisp});
         } else {          } else {
             $message .= &mt('In discussions: all posts will be displayed.').'<br />';              $message .= &Apache::lonhtmlcommon::confirm_success(&mt('In discussions: all posts will be displayed.')).'<br />';
             &Apache::lonnet::del('environment',['discdisplay']);              &Apache::lonnet::del('environment',['discdisplay']);
             &Apache::lonnet::delenv('environment.discdisplay');              &Apache::lonnet::delenv('environment.discdisplay');
         }          }
Line 1888  my @menu= Line 1904  my @menu=
  icon => 'sctr.png',   icon => 'sctr.png',
  linktitle => 'Configure the roles hotlist.'   linktitle => 'Configure the roles hotlist.'
     },      },
     { linktext => 'Display of Scientific Equations',      { linktext => 'Math display settings',
  url => '/adm/preferences?action=changetexenginepref',   url => '/adm/preferences?action=changetexenginepref',
  permission => 'F',   permission => 'F',
  #help => '',   #help => '',
  icon => 'stat.png',   icon => 'stat.png',
  linktitle => 'Change how Scientific Equations are displayed.'   linktitle => 'Change how math is displayed.'
     },      },
  ]   ]
     },      },
     { categorytitle=>'Message Management',      { categorytitle=>'Messages &amp; Notifications',
  items =>[   items =>[
     { linktext => 'Messages &amp; Notifications',      { linktext => 'Messages &amp; Notifications',
  url => '/adm/preferences?action=changemsgforward',   url => '/adm/preferences?action=changemsgforward',
Line 1944  push(@{ $menu[1]->{items} }, { Line 1960  push(@{ $menu[1]->{items} }, {
  url => '/adm/remote?url=/adm/preferences&amp;action=launch',   url => '/adm/remote?url=/adm/preferences&amp;action=launch',
  permission => 'F',   permission => 'F',
  #help => '',   #help => '',
  icon => 'network-wireless.png',   icon => 'remotecontrol.png',
  linktitle => 'Launch the remote control for LON-CAPA.',   linktitle => 'Launch the remote control for LON-CAPA.',
  });   });
     }else{      }else{
Line 1953  push(@{ $menu[1]->{items} }, { Line 1969  push(@{ $menu[1]->{items} }, {
  url => '/adm/remote?url=/adm/preferences&amp;action=collapse',   url => '/adm/remote?url=/adm/preferences&amp;action=collapse',
  permission => 'F',   permission => 'F',
  #help => '',   #help => '',
  icon => 'network-wireless.png',   icon => 'remotecontrol.png',
  linktitle => 'Collapse the remote control for LON-CAPA.',   linktitle => 'Collapse the remote control for LON-CAPA.',
  });   });
     }      }
Line 1982  push(@{ $menu[4]->{items} }, { Line 1998  push(@{ $menu[4]->{items} }, {
  });   });
   
     }      }
     if ($env{'user.name'} =~ /^(albertel|fox|foxr|kortemey|korte|raeburn)$/) {      if (&can_toggle_debug()) {
 push(@{ $menu[4]->{items} }, {  push(@{ $menu[4]->{items} }, {
  linktext => 'Toggle Debug Messages (Current:'.$env{'user.debug'}.')',   linktext => 'Toggle Debug Messages (Currently '.($env{'user.debug'} ? 'on)' : 'off)'),
  url => '/adm/preferences?action=debugtoggle',   url => '/adm/preferences?action=debugtoggle',
  permission => 'F',   permission => 'F',
  #help => '',   #help => '',
Line 2083  sub handler { Line 2099  sub handler {
     }elsif($env{'form.action'} eq 'verify_and_change_coursepage'){      }elsif($env{'form.action'} eq 'verify_and_change_coursepage'){
         &verify_and_change_coursepage($r);          &verify_and_change_coursepage($r);
     }elsif($env{'form.action'} eq 'debugtoggle'){      }elsif($env{'form.action'} eq 'debugtoggle'){
         &toggle_debug();          if (&can_toggle_debug()) {
               &toggle_debug();
           }
  &print_main_menu($r);   &print_main_menu($r);
     }      }
   
Line 2106  sub toggle_debug { Line 2124  sub toggle_debug {
     }      }
 }  }
   
   sub can_toggle_debug {
       my $can_toggle = 0;
       my $page = 'toggledebug';
       if (&LONCAPA::lonauthcgi::can_view($page)) {
           $can_toggle = 1;
       } elsif (&LONCAPA::lonauthcgi::check_ipbased_access($page)) {
           $can_toggle = 1;
       }
       return $can_toggle;
   }
   
 1;  1;
 __END__  __END__

Removed from v.1.170  
changed lines
  Added in v.1.179


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