Diff for /loncom/interface/lonpreferences.pm between versions 1.186.2.8 and 1.187

version 1.186.2.8, 2011/10/10 22:38:20 version 1.187, 2010/03/16 19:55:49
Line 166  sub languagechanger { Line 166  sub languagechanger {
                = &Apache::loncommon::plainlanguagedescription($_);                 = &Apache::loncommon::plainlanguagedescription($_);
  }   }
     }      }
     %langchoices = &Apache::lonlocal::texthash(%langchoices);  
     my $selectionbox=      my $selectionbox=
            &Apache::loncommon::select_form(             &Apache::loncommon::select_form(
                $language,                 $language,
                'language',                 'language',
                \%langchoices);                 &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 230  sub texenginechanger { Line 229  sub texenginechanger {
      'mimetex' => 'mimetex (Convert to Images)',       'mimetex' => 'mimetex (Convert to Images)',
                      'raw' => 'Raw (Screen Reader)'                       'raw' => 'Raw (Screen Reader)'
                      );                       );
     %mathchoices = &Apache::lonlocal::texthash(%mathchoices);  
     my $selectionbox=      my $selectionbox=
            &Apache::loncommon::select_form(             &Apache::loncommon::select_form(
                $texengine,                 $texengine,
                'texengine',                 'texengine',
                \%mathchoices);                 &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 how math is displayed',        'headline' => 'Change how math is displayed',
Line 591  sub verify_and_change_screenname { Line 589  sub verify_and_change_screenname {
 }  }
   
 ################################################################  ################################################################
 #                     Icon Subroutines                         #  
 ################################################################  
 sub iconchanger {  
     my $r = shift;  
     &Apache::lonhtmlcommon::add_breadcrumb(  
             {   href => '/adm/preferences?action=changeicons',  
                 text => 'Change Menu Display'});  
     $r->print(Apache::loncommon::start_page('Page Display Settings'));  
     $r->print(Apache::lonhtmlcommon::breadcrumbs('Change Menu Display'));  
   
     my $user       = $env{'user.name'};  
     my $domain     = $env{'user.domain'};  
     my %userenv = &Apache::lonnet::get('environment',['icons']);  
     my $iconic='checked="checked"';  
     my ($classic,$onlyicon,$iconic_preview,$iconsonly_preview);  
     if ($userenv{'icons'} eq 'classic') {  
         $iconic='';  
         $classic='<div class="LC_info">'.  
                  &mt('Your current selection: "Use buttons and text" is deprecated - it is recommended that you change this to "Use icons and text".').'</div>';  
     }  
     if ($userenv{'icons'} eq 'iconsonly') {  
        $onlyicon='checked="checked"';  
        $iconic='';  
     }  
     my $change=&mt('Save');  
     my %lt = &icon_options();  
     my ($inlinetools,$toolsorder) = &icon_previews();  
     if ((ref($inlinetools) eq 'HASH') && (ref($toolsorder) eq 'ARRAY')) {  
         foreach my $tool (@{$toolsorder}) {  
             my ($command,$row,$col,$img,$top,$bot,$act,$desc) =  
                 split(/\&/,$inlinetools->{$tool});  
             $iconic_preview .= '<li><a title="'.$desc.'" class="LC_menubuttons_link" href=""><img alt="'.$desc.'" src="/res/adm/pages/'.$img.'"  class="LC_icon" /><span class="LC_menubuttons_inline_text">'.$top.('&nbsp;' x 2).'</span></a></li>';  
             $iconsonly_preview .= '<li><a title="'.$desc.'" class="LC_menubuttons_link" href=""><img alt="'.$desc.'" src="/res/adm/pages/'.$img.'"  class="LC_icon" />&nbsp;</a></li>';  
         }  
     }  
     $iconsonly_preview = '<ul class="LC_breadcrumb_tools_outerlist"><li>'.  
                          '<ul>'.  
                          $iconsonly_preview.  
                          '</ul></li></ul>';  
     $iconic_preview = '<ul class="LC_breadcrumb_tools_outerlist"><li>'.  
                       '<ul>'.  
                       $iconic_preview.  
                       '</ul></li></ul>';  
     $r->print(<<ENDSCREEN);  
 $classic  
 <form name="prefs" action="/adm/preferences" method="post">  
 <input type="hidden" name="action" value="verify_and_change_icons" />  
 <label><input type="radio" name="menumode" value="iconic" $iconic /> $lt{'iconic'}</label>$iconic_preview<br />  
 <label><input type="radio" name="menumode" value="iconsonly" $onlyicon /> $lt{'iconsonly'}</label>$iconsonly_preview<br />  
 <input type="submit" value="$change" />  
 </form>  
 ENDSCREEN  
 }  
   
 sub verify_and_change_icons {  
     my $r = shift;  
     my $user       = $env{'user.name'};  
     my $domain     = $env{'user.domain'};  
     my $newicons   = $env{'form.menumode'};  
     my %lt = &icon_options();  
     my $newchoice = $newicons;  
     if ($lt{$newicons}) {  
         $newchoice = $lt{$newicons};  
     }  
     &Apache::lonnet::put('environment',{'icons' => $newicons});  
     &Apache::lonnet::appenv({'environment.icons' => $newicons});  
     my $message=&Apache::lonhtmlcommon::confirm_success(&mt('Set [_1] to [_2]','<i>'.&mt('Menu Display').'</i>','<tt>'.$newchoice.'</tt>'));  
     $message=&Apache::loncommon::confirmwrapper($message);  
     &print_main_menu($r, $message);  
 }  
   
 sub icon_options {  
     my %lt = &Apache::lonlocal::texthash(  
                  iconic    => 'Use icons and text',  
                  iconsonly => 'Use icons only',  
              );  
     return %lt;  
 }  
   
 sub icon_previews {  
      my %icon_text = (  
                       annotate => 'Notes',  
                       bookmark => 'Bookmark',  
                       catalog  => 'Info',  
                       evaluate => 'Evaluate',  
                       feedback => 'Communicate',  
                       printout => 'Print',  
                      );  
     my %inlinetools = (  
         printout => "s&8&3&prt.png&$icon_text{'printout'}&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document",  
         bookmark => "s&9&1&sbkm.png&$icon_text{'bookmark'}&bookmark[_2]&set_bookmark()&Set a bookmark for this resource",  
         evaluate => "s&8&1&eval.png&$icon_text{'evaluate'}&this[_1]&gopost('/adm/evaluate',currentURL,1)&Provide my evaluation of this resource",  
         feedback => "s&8&2&fdbk.png&$icon_text{'feedback'}&discuss[_1]&gopost('/adm/feedback',currentURL,1)&Provide feedback messages or contribute to the course discussion about this resource",  
         annotate => "s&9&3&anot.png&$icon_text{'annotate'}&tations[_1]&annotate()&Make notes and annotations about this resource",  
         catalog  => "s&6&3&catalog.png&$icon_text{'catalog'}&info[_1]&catalog_info()&Show Metadata",  
     );  
     my @toolsorder = qw(annotate bookmark evaluate feedback printout catalog);  
     return (\%inlinetools,\@toolsorder);  
 }  
   
 ################################################################  
 #                     Clicker Subroutines                      #  #                     Clicker Subroutines                      #
 ################################################################  ################################################################
   
Line 1288  sub passwordchanger { Line 1185  sub passwordchanger {
     # This function is a bit of a mess....      # This function is a bit of a mess....
     # Passwords are encrypted using londes.js (DES encryption)      # Passwords are encrypted using londes.js (DES encryption)
     $errormessage = ($errormessage || '');      $errormessage = ($errormessage || '');
     my ($user,$domain,$currentpass);      my ($user,$domain,$currentpass,$defdom);
     &Apache::lonhtmlcommon::add_breadcrumb(      &Apache::lonhtmlcommon::add_breadcrumb(
  { href => '/adm/preferences?action=changepass',   { href => '/adm/preferences?action=changepass',
                   text => 'Change Password'});                    text => 'Change Password'});
Line 1303  sub passwordchanger { Line 1200  sub passwordchanger {
             $caller = 'preferences';              $caller = 'preferences';
         }          }
     } elsif ($caller eq 'reset_by_email') {      } elsif ($caller eq 'reset_by_email') {
               $defdom = $r->dir_config('lonDefDomain');
             my %data = &Apache::lonnet::tmpget($mailtoken);              my %data = &Apache::lonnet::tmpget($mailtoken);
             if (keys(%data) == 0) {              if (keys(%data) == 0) {
                 $r->print(&mt('Sorry, the URL you provided to complete the reset of your password was invalid. Either the token included in the URL has been deleted or the URL you provided was invalid. Please submit a [_1]new request[_2] for a password reset, and follow the link to the new URL included in the e-mail that will be sent to you, to allow you to enter a new password.'                  $r->print(&mt('Sorry, the URL you provided to complete the reset of your password was invalid. Either the token included in the URL has been deleted or the URL you provided was invalid. Please submit a [_1]new request[_2] for a password reset, and follow the link to the new URL included in the e-mail that will be sent to you, to allow you to enter a new password.'
Line 1323  sub passwordchanger { Line 1221  sub passwordchanger {
                 $r->print(&mt('Sorry, the URL generated when you requested reset of your password contained incomplete information.').'<br />');                  $r->print(&mt('Sorry, the URL generated when you requested reset of your password contained incomplete information.').'<br />');
                 return;                  return;
             }              }
             if (&Apache::lonnet::domain($domain) eq '') {  
                 $domain = $r->dir_config('lonDefDomain');  
             }  
    } else {     } else {
         $r->print(&mt('Page requested in unexpected context').'<br />');          $r->print(&mt('Page requested in unexpected context').'<br />');
         return;          return;
Line 1370  $errormessage Line 1265  $errormessage
      crappy browser -->       crappy browser -->
 ENDFORM  ENDFORM
     $r->print(&server_form($logtoken,$caller,$mailtoken));      $r->print(&server_form($logtoken,$caller,$mailtoken));
     $r->print(&client_form($caller,\%hexkey,$currentpass,$domain));      $r->print(&client_form($caller,\%hexkey,$currentpass,$defdom));
   
     #      #
     return;      return;
Line 1704  sub discussionchanger { Line 1599  sub discussionchanger {
         'sdpf' => 'Set display preferences for discussion posts for both discussion boards and individual resources in all your courses.',          'sdpf' => 'Set display preferences for discussion posts for both discussion boards and individual resources in all your courses.',
         'prca' => 'Preferences can be set that determine',          'prca' => 'Preferences can be set that determine',
         'whpo' => 'Which posts are displayed when you display a discussion board or resource, and',          'whpo' => 'Which posts are displayed when you display a discussion board or resource, and',
         'unwh' => 'Under what circumstances posts are identified as "NEW"',          'unwh' => 'Under what circumstances posts are identfied as "New"',
         'allposts' => 'All posts',          'allposts' => 'All posts',
         'unread' => 'New posts only',          'unread' => 'New posts only',
         'ondisp' => 'Once displayed',          'ondisp' => 'Once displayed',
         'onmark' => 'Once marked not NEW',          'onmark' => 'Once marked as read',
         'disa' => 'Posts displayed?',          'disa' => 'Posts displayed?',
         'npmr' => 'New posts cease to be identified as "NEW"?',          'npmr' => 'New posts cease to be identified as "New"?',
         'thde'  => 'The preferences you set here can be overridden within each individual discussion.',          'thde'  => 'The preferences you set here can be overridden within each individual discussion.',
         'chgt' => 'Change to '          'chgt' => 'Change to '
     );      );
Line 1795  sub verify_and_change_discussion { Line 1690  sub verify_and_change_discussion {
             &Apache::lonnet::put('environment',{'discmarkread' => $newmark});              &Apache::lonnet::put('environment',{'discmarkread' => $newmark});
             &Apache::lonnet::appenv({'environment.discmarkread' => $newmark});              &Apache::lonnet::appenv({'environment.discmarkread' => $newmark});
         } else {          } else {
             $message.=&Apache::lonhtmlcommon::confirm_success(&mt('In discussions: posts will be identified as "NEW" until marked as not "NEW".')).'<br />';              $message.=&Apache::lonhtmlcommon::confirm_success(&mt('In discussions: posts will be identified as "NEW" until marked as read by the reader.')).'<br />';
             &Apache::lonnet::del('environment',['discmarkread']);              &Apache::lonnet::del('environment',['discmarkread']);
             &Apache::lonnet::delenv('environment.discmarkread');              &Apache::lonnet::delenv('environment.discmarkread');
         }          }
Line 2026  my @menu= Line 1921  my @menu=
  url => '/adm/preferences?action=changerolespref',   url => '/adm/preferences?action=changerolespref',
  permission => 'F',   permission => 'F',
  #help => '',   #help => '',
  icon => 'role_hotlist.png',   icon => 'sctr.png',
  linktitle => 'Configure the roles hotlist.'   linktitle => 'Configure the roles hotlist.'
     },      },
     { linktext => 'Math display settings',      { linktext => 'Math display settings',
  url => '/adm/preferences?action=changetexenginepref',   url => '/adm/preferences?action=changetexenginepref',
  permission => 'F',   permission => 'F',
  #help => '',   #help => '',
  icon => 'dismath.png',   icon => 'stat.png',
  linktitle => 'Change how math is displayed.'   linktitle => 'Change how math is displayed.'
     },      },
  ]   ]
Line 2047  my @menu= Line 1942  my @menu=
  icon => 'preferences-desktop-theme.png',   icon => 'preferences-desktop-theme.png',
  linktitle => 'Change LON-CAPA default colors.'   linktitle => 'Change LON-CAPA default colors.'
     },      },
             {   linktext => 'Menu Display',  
                 url => '/adm/preferences?action=changeicons',  
                 permission => 'F',  
                 #help => '',  
                 icon => 'preferences-system-windows.png',  
                 linktitle => 'Change whether the menus are displayed with icons or icons and text.'  
             }  
  ]   ]
     },      },
     { categorytitle=>'Messages &amp; Notifications',      { categorytitle=>'Messages &amp; Notifications',
Line 2069  my @menu= Line 1957  my @menu=
  url => '/adm/preferences?action=changediscussions',   url => '/adm/preferences?action=changediscussions',
  permission => 'F',   permission => 'F',
  #help => 'Change_Discussion_Display',   #help => 'Change_Discussion_Display',
  icon => 'chat.png',   icon => 'mail-message-new.png',
  linktitle => 'Set display preferences for discussion posts for both discussion boards and individual resources in all your courses.'   linktitle => 'Set display preferences for discussion posts for both discussion boards and individual resources in all your courses.'
     },      },
  ]   ]
Line 2097  push(@{ $menu[0]->{items} }, { Line 1985  push(@{ $menu[0]->{items} }, {
  linktitle => 'Change your password.',   linktitle => 'Change your password.',
  });   });
     }      }
     if ($env{'environment.remote'} eq 'off') {  
 push(@{ $menu[1]->{items} }, {  
         linktext => 'Launch Remote Control',  
         url => '/adm/remote?url=/adm/preferences&amp;action=launch',  
         permission => 'F',  
         #help => '',  
         icon => 'remotecontrol.png',  
         linktitle => 'Launch the remote control for LON-CAPA.',  
         });  
     }else{  
 push(@{ $menu[1]->{items} }, {  
         linktext => 'Collapse Remote Control',  
         url => '/adm/remote?url=/adm/preferences&amp;action=collapse',  
         permission => 'F',  
         #help => '',  
         icon => 'remotecontrol.png',  
         linktitle => 'Collapse the remote control for LON-CAPA.',  
         });  
     }  
   
   
     if (&can_toggle_namelocking()) {      if (&can_toggle_namelocking()) {
         push(@{ $menu[0]->{items} }, {          push(@{ $menu[0]->{items} }, {
Line 2149  push(@{ $menu[4]->{items} }, { Line 2017  push(@{ $menu[4]->{items} }, {
  url => '/adm/preferences?action=changecourseinit',   url => '/adm/preferences?action=changecourseinit',
  permission => 'F',   permission => 'F',
  #help => '',   #help => '',
  icon => 'course_ini.png',   icon => 'edit-copy.png',
  linktitle => 'Set the default page to be displayed when you select a course role.',   linktitle => 'Set the default page to be displayed when you select a course role.',
  });   });
   
Line 2234  sub handler { Line 2102  sub handler {
         &texenginechanger($r);          &texenginechanger($r);
     }elsif($env{'form.action'} eq 'verify_and_change_texengine'){      }elsif($env{'form.action'} eq 'verify_and_change_texengine'){
         &verify_and_change_texengine($r);          &verify_and_change_texengine($r);
     }elsif($env{'form.action'} eq 'changeicons'){  
         &iconchanger($r);  
     }elsif($env{'form.action'} eq 'verify_and_change_icons'){  
         &verify_and_change_icons($r);  
     }elsif($env{'form.action'} eq 'changeclicker'){      }elsif($env{'form.action'} eq 'changeclicker'){
         &clickerchanger($r);          &clickerchanger($r);
     }elsif($env{'form.action'} eq 'verify_and_change_clicker'){      }elsif($env{'form.action'} eq 'verify_and_change_clicker'){

Removed from v.1.186.2.8  
changed lines
  Added in v.1.187


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