Diff for /loncom/interface/lonmenu.pm between versions 1.185 and 1.208

version 1.185, 2006/06/12 18:10:37 version 1.208, 2007/03/09 01:29:54
Line 44  use Apache::lonhtmlcommon(); Line 44  use Apache::lonhtmlcommon();
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lonenc();  use Apache::lonenc();
 use Apache::lonlocal;  use Apache::lonlocal;
 use lib '/home/httpd/lib/perl/';  use LONCAPA qw(:DEFAULT :match);
 use LONCAPA;  
   
 use vars qw(@desklines $readdesk);  use vars qw(@desklines $readdesk);
   
   
 my @inlineremote;  my @inlineremote;
   
   
   
 # ================================================================ Little texts  # ================================================================ Little texts
   
 sub initlittle {  sub initlittle {
Line 62  sub initlittle { Line 63  sub initlittle {
                                                     'Roles':'Courses'),                                                      'Roles':'Courses'),
                                        'docs' => 'Course Documents',                                         'docs' => 'Course Documents',
                                        'exit' => 'Exit',                                         'exit' => 'Exit',
                                          'login' => 'Log In',
        'launch' => 'Launch Remote Control',         'launch' => 'Launch Remote Control',
                                        'groups' => 'Course Groups',                                         'groups' => 'Groups',
                                        'gdoc' => 'Group Documents',                                         'gdoc' => 'Group Documents',
                                        'teams' => 'Teams',  
                                        );                                         );
 }  }
   
Line 91  sub menubuttons { Line 92  sub menubuttons {
     my $escurl=&escape(&Apache::lonenc::check_encrypt($env{'request.noversionuri'}));      my $escurl=&escape(&Apache::lonenc::check_encrypt($env{'request.noversionuri'}));
     my $escsymb=&escape(&Apache::lonenc::check_encrypt($env{'request.symb'}));      my $escsymb=&escape(&Apache::lonenc::check_encrypt($env{'request.symb'}));
   
       my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif");
       $logo = '<td class="LC_top_nav_logo"><a href="/adm/about.html"><img src="'.
    $logo.'" alt="LON-CAPA Logo" /></a></td>';
   
     if ($env{'request.state'} eq 'construct') {      if ($env{'request.state'} eq 'construct') {
         if (($env{'request.noversionuri'} eq '') || (!defined($env{'request.noversionuri'}))) {          if (($env{'request.noversionuri'} eq '') || (!defined($env{'request.noversionuri'}))) {
             my $returnurl = $env{'request.filename'};              my $returnurl = $env{'request.filename'};
Line 100  sub menubuttons { Line 105  sub menubuttons {
     }      }
     if ($env{'request.course.id'}) {      if ($env{'request.course.id'}) {
         my %coursegroups;          my %coursegroups;
         my $viewgrps_permission =                                                          my $viewgrps_permission =
                      &Apache::lonnet::allowed('vcg',$env{'request.course.id'});      &Apache::lonnet::allowed('vcg',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
         if (!$viewgrps_permission) {          if (!$viewgrps_permission) {
             %coursegroups = &Apache::lonnet::get_active_groups($env{'user.domain'},$env{'user.name'},$env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'});              %coursegroups = &Apache::lonnet::get_active_groups($env{'user.domain'},$env{'user.name'},$env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'});
         }   }
         if ((keys(%coursegroups) > 0) || ($viewgrps_permission)) {          if ((keys(%coursegroups) > 0) || ($viewgrps_permission)) {
             $showgroups = 1;              $showgroups = 1;
         }          }
Line 131  ENDDOCS Line 136  ENDDOCS
             }              }
             if ($showgroups) {              if ($showgroups) {
                 $groups =(<<ENDGROUPS);                  $groups =(<<ENDGROUPS);
 <a href="/adm/coursegroups" target="_top">$lt{'groups'}</a></td>  <a href="/adm/coursegroups" target="_top">$lt{'groups'}</a>
 ENDGROUPS  ENDGROUPS
             }              }
  }   }
Line 168  ENDMAINMENU Line 173  ENDMAINMENU
         my $vlink=&Apache::loncommon::designparm($function.'.vlink',$domain);          my $vlink=&Apache::loncommon::designparm($function.'.vlink',$domain);
         my $sidebg=&Apache::loncommon::designparm($function.'.sidebg',$domain);          my $sidebg=&Apache::loncommon::designparm($function.'.sidebg',$domain);
  if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') {   if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') {
     my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif");  
     return (<<ENDINLINEMENU);      return (<<ENDINLINEMENU);
    <table id="LC_top_nav">     <table id="LC_top_nav">
     <tr>      <tr>
       <td>        $logo
         <a href="/adm/logout" target="_top">$lt{'exit'}</a>        <td></td>
      </td>        <td class="LC_top_nav_login">
      <td "LC_top_nav_logo">          <a href="/adm/roles" target="_top">$lt{'login'}</a>
        <img align="right" src="$logo" alt="Logo" />  
        <b>LON-CAPA</b>&nbsp;  
      </td>       </td>
    </tr>      </tr>
   </table>    </table>
 </font>  </font>
 ENDINLINEMENU  ENDINLINEMENU
Line 194  ENDINLINEMENU Line 196  ENDINLINEMENU
     $navmaps=(<<ENDNAV);      $navmaps=(<<ENDNAV);
 <td><a href="$link" target="_top">$lt{'nav'}</a></td>  <td><a href="$link" target="_top">$lt{'nav'}</a></td>
 ENDNAV  ENDNAV
   my $is_group = (&Apache::loncommon::course_type() eq 'Group');
     if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {      if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
                 my $text = $lt{'docs'};                  my $text = ($is_group) ? $lt{'gdoc'} : $lt{'docs'};
                 if ($env{'course.'.$env{'request.course.id'}.'.type'} eq   
                     'Group') {  
                     $text = $lt{'gdoc'};  
                 }   
  $docs=(<<ENDDOCS);   $docs=(<<ENDDOCS);
 <td><a href="/adm/coursedocs" target="_top">$text</a></td>  <td><a href="/adm/coursedocs" target="_top">$text</a></td>
 ENDDOCS  ENDDOCS
             }              }
             if ($showgroups) {              if ($showgroups) {
                 my $text = $lt{'groups'};  
                 if ($env{'course.'.$env{'request.course.id'}.'.type'} eq  
                     'Group') {  
                     $text = $lt{'teams'};  
                 }  
                 $groups =(<<ENDGROUPS);                  $groups =(<<ENDGROUPS);
 <td><a href="/adm/coursegroups" target="_top">$text</a></td>  <td><a href="/adm/coursegroups" target="_top">$lt{'groups'}</a></td>
 ENDGROUPS  ENDGROUPS
             }              }
     if (      if (
Line 242  ENDCRELOAD Line 236  ENDCRELOAD
         }          }
         my $form=&serverform();          my $form=&serverform();
  my $utility=&utilityfunctions();   my $utility=&utilityfunctions();
  my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif");  
  my $remote;   my $remote;
  if ($env{'user.adv'}) {   if ($env{'user.adv'}) {
     $remote = '<td><a href="/adm/remote?action=launch&amp;url='.$escurl.'" target="_top">'.$lt{'launch'}.'</a></td>'      $remote = '<td><a href="/adm/remote?action=launch&amp;url='.$escurl.'" target="_top">'.$lt{'launch'}.'</a></td>'
  }   }
   
           my $helplink=&Apache::loncommon::top_nav_help('Help');
  return (<<ENDINLINEMENU);   return (<<ENDINLINEMENU);
 <script type="text/javascript">  <script type="text/javascript">
 // BEGIN LON-CAPA Internal  // BEGIN LON-CAPA Internal
Line 256  $utility Line 251  $utility
 </script>  </script>
 <table id="LC_top_nav">  <table id="LC_top_nav">
 <tr>  <tr>
   $logo
 <td><a href="/adm/menu" target="_top">$lt{'main'}</a></td>  <td><a href="/adm/menu" target="_top">$lt{'main'}</a></td>
 $reloadlink  $reloadlink
 $navmaps  $navmaps
Line 263  $docs Line 259  $docs
 $groups  $groups
 $remote  $remote
 <td><a href="/adm/roles" target="_top">$lt{'roles'}</a></td>  <td><a href="/adm/roles" target="_top">$lt{'roles'}</a></td>
 <td><a href="/adm/logout" target="_top">$lt{'exit'}</a></td>  <td class="LC_top_nav_help">$helplink</td>
 <td class="LC_top_nav_logo"><img align="right" src="$logo" alt="Logo" /><b>LON-CAPA</b></td>  <td class="LC_top_nav_exit"><a href="/adm/logout" target="_top">$lt{'exit'}</a></td>
 </tr>  </tr>
 </table>  </table>
 $form  $form
Line 393  sub innerregister { Line 389  sub innerregister {
     &Apache::lonnet::allowed('opa',$crs)) {      &Apache::lonnet::allowed('opa',$crs)) {
     $hwkadd.=&switch('','',7,3,'pparm.gif','problem[_2]','parms[_2]',      $hwkadd.=&switch('','',7,3,'pparm.gif','problem[_2]','parms[_2]',
      "gocmd('/adm/parmset','set')",       "gocmd('/adm/parmset','set')",
      'Modify deadlines, etc, for this resource');       'Modify parameter settings for this resource');
  }   }
 # -- End Homework  # -- End Homework
         ###          ###
Line 411  sub innerregister { Line 407  sub innerregister {
                 my $desc = "Enter my resource construction space";                  my $desc = "Enter my resource construction space";
                 # Set defaults for co-authors                  # Set defaults for co-authors
                 if ($env{'request.role'} =~ /^ca/) {                   if ($env{'request.role'} =~ /^ca/) { 
                     ($cadom,$caname)=($env{'request.role'}=~/(\w+)\/(\w+)$/);                      ($cadom,$caname)=($env{'request.role'}=~/($match_domain)\/($match_username)$/);
                     ($top,$bottom) = ('co con-','struct');                      ($top,$bottom) = ('co con-','struct');
                     $action = "go('/priv/".$caname."');";                      $action = "go('/priv/".$caname."');";
                     $desc = "Enter construction space as co-author";                      $desc = "Enter construction space as co-author";
Line 433  sub innerregister { Line 429  sub innerregister {
             my $cfudom='';              my $cfudom='';
             if ($env{'request.filename'}) {              if ($env{'request.filename'}) {
                 my $file=&Apache::lonnet::declutter($env{'request.filename'});                  my $file=&Apache::lonnet::declutter($env{'request.filename'});
                 $file=~s/^(\w+)\/(\w+)/\/priv\/$2/;                  $file=~s/^($match_domain)\/($match_username)/\/priv\/$2/;
                 # Check that the user has permission to edit this resource                  # Check that the user has permission to edit this resource
                 ($cfuname,$cfudom)=&Apache::loncacc::constructaccess($file,$1);                  ($cfuname,$cfudom)=&Apache::loncacc::constructaccess($file,$1);
                 if (defined($cfudom)) {                  if (defined($cfudom)) {
Line 452  sub innerregister { Line 448  sub innerregister {
                     ('','',6,1,'cstr.gif','edit[_1]','resource[_2]',                      ('','',6,1,'cstr.gif','edit[_1]','resource[_2]',
                      "go('".$cfile."');","Edit this resource");                       "go('".$cfile."');","Edit this resource");
             } elsif ($editbutton eq '') {              } elsif ($editbutton eq '') {
                 $editbutton=&switch('','',6,1,'port.gif',                  $editbutton=&clear(6,1);
     'port-[_1]','folio[_1]',  
     "go('/adm/portfolio');",  
     "Enter my portfolio space");  
             }              }
         }          }
         ###          ###
Line 470  sub innerregister { Line 463  sub innerregister {
                 $is_const_dir = 1;                  $is_const_dir = 1;
             } else {              } else {
                 $currdir =~ s#[^/]+$##;                  $currdir =~ s#[^/]+$##;
    my $cleandisfn = &Apache::loncommon::escape_single($thisdisfn);
    my $esc_currdir = &Apache::loncommon::escape_single($currdir);
                 $menuitems=(<<ENDMENUITEMS);                  $menuitems=(<<ENDMENUITEMS);
 s&6&1&list.gif&list[_1]&dir[_1]&golist('$currdir')&List current directory  s&6&1&list.gif&list[_1]&dir[_1]&golist('$esc_currdir')&List current directory
 s&6&2&rtrv.gif&retrieve[_1]&version[_1]&gocstr('/adm/retrieve','/~$uname/$thisdisfn')&Retrieve old version  s&6&2&rtrv.gif&retrieve[_1]&version[_1]&gocstr('/adm/retrieve','/~$uname/$cleandisfn')&Retrieve old version
 s&6&3&pub.gif&publish[_1]&resource[_1]&gocstr('/adm/publish','/~$uname/$thisdisfn')&Publish this resource  s&6&3&pub.gif&publish[_1]&resource[_1]&gocstr('/adm/publish','/~$uname/$cleandisfn')&Publish this resource
 s&7&1&del.gif&delete[_1]&resource[_2]&gocstr('/adm/cfile?action=delete','/~$uname/$thisdisfn')&Delete this resource  s&7&1&del.gif&delete[_1]&resource[_2]&gocstr('/adm/cfile?action=delete','/~$uname/$cleandisfn')&Delete this resource
 s&7&2&prt.gif&prepare[_1]&printout[_1]&gocstr('/adm/printout','/~$uname/$thisdisfn')&Prepare a printable document  s&7&2&prt.gif&prepare[_1]&printout[_1]&gocstr('/adm/printout','/~$uname/$cleandisfn')&Prepare a printable document
 ENDMENUITEMS  ENDMENUITEMS
             }              }
         } elsif (defined($env{'request.course.id'}) &&           } elsif ( defined($env{'request.course.id'}) && 
  $env{'request.symb'} ne '') {   $env{'request.symb'} ne '' ) {
     $menuitems=(<<ENDMENUITEMS);      $menuitems=(<<ENDMENUITEMS);
 c&3&1  c&3&1
 s&2&1&back.gif&backward[_1]&&gopost('/adm/flip','back:'+currentURL)&Go to the previous resource in the course sequence&1  s&2&1&back.gif&backward[_1]&&gopost('/adm/flip','back:'+currentURL)&Go to the previous resource in the course sequence&1
Line 499  s&8&2&fdbk.gif&feedback[_1]&discuss[_1]& Line 494  s&8&2&fdbk.gif&feedback[_1]&discuss[_1]&
 ENDREALRES  ENDREALRES
     }      }
         }          }
    if ($env{'request.uri'} =~ /^\/res/) {
       $menuitems .= (<<ENDMENUITEMS);
   s&8&3&prt.gif&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document
   ENDMENUITEMS
    }
         my $buttons='';          my $buttons='';
         foreach (split(/\n/,$menuitems)) {          foreach (split(/\n/,$menuitems)) {
     my ($command,@rest)=split(/\&/,$_);      my ($command,@rest)=split(/\&/,$_);
Line 787  ENDRESIZE Line 787  ENDRESIZE
     $returnval.=(<<ENDOPEN);      $returnval.=(<<ENDOPEN);
 window.status='Opening LON-CAPA Remote Control';  window.status='Opening LON-CAPA Remote Control';
 var menu=window.open("/res/adm/pages/menu.html","$menuname",  var menu=window.open("/res/adm/pages/menu.html","$menuname",
 "height=350,width=150,scrollbars=no,menubar=no,top=5,left=5,screenX=5,screenY=5");  "height=375,width=150,scrollbars=no,menubar=no,top=5,left=5,screenX=5,screenY=5");
 self.name='loncapaclient';  self.name='loncapaclient';
 ENDOPEN  ENDOPEN
     return '<script type="text/javascript">'.$returnval.'</script>';      return '<script type="text/javascript">'.$returnval.'</script>';
Line 940  sub rawconfig { Line 940  sub rawconfig {
         $prt=~s/\$udom/$udom/g;          $prt=~s/\$udom/$udom/g;
         $prt=~s/\$crs/$crs/g;           $prt=~s/\$crs/$crs/g; 
         $prt=~s/\$requested_domain/$requested_domain/g;          $prt=~s/\$requested_domain/$requested_domain/g;
         my $type = $env{'course.'.$env{'request.course.id'}.'.type'};          my $type = &Apache::loncommon::course_type();
         if ($type eq 'Group') {          if ($type eq 'Group') {
             $desc = &convert_menu_function($desc,$type);              $desc = &convert_menu_function($desc,$type);
         }          }
Line 989  sub rawconfig { Line 989  sub rawconfig {
                     my $caname=$env{'user.name'};                      my $caname=$env{'user.name'};
                     if ($prt eq 'rca') {                      if ($prt eq 'rca') {
        ($cadom,$caname)=         ($cadom,$caname)=
                                ($env{'request.role'}=~/(\w+)\/(\w+)$/);                                 ($env{'request.role'}=~/($match_domain)\/($match_username)$/);
                     }                                             }                       
                     $act =~ s/\$caname/$caname/g;                      $act =~ s/\$caname/$caname/g;
                     my $home = &Apache::lonnet::homeserver($caname,$cadom);                      my $home = &Apache::lonnet::homeserver($caname,$cadom);
Line 1077  sub utilityfunctions { Line 1077  sub utilityfunctions {
  'add_entries' => {   'add_entries' => {
     'onload' => 'javascript:document.goannotate.submit();'}});      'onload' => 'javascript:document.goannotate.submit();'}});
   
       my $end_page_annotate = 
           &Apache::loncommon::end_page({'js_ready' => 1});
   
     my $start_page_bookmark =       my $start_page_bookmark = 
         &Apache::loncommon::start_page('Bookmarks',undef,          &Apache::loncommon::start_page('Bookmarks',undef,
        {'only_body' => 1,         {'only_body' => 1,
  'js_ready'  => 1,   'js_ready'  => 1,
  'bgcolor'   => '#BBBBBB',});   'bgcolor'   => '#BBBBBB',});
   
     my $end_page =       my $end_page_bookmark = 
         &Apache::loncommon::end_page({'js_ready' => 1});          &Apache::loncommon::end_page({'js_ready' => 1});
   
 return (<<ENDUTILITY)  return (<<ENDUTILITY)
Line 1203  function annotate() { Line 1206  function annotate() {
   +"action='/adm/annotations'>"    +"action='/adm/annotations'>"
   +"<input type='hidden' name='urlnew' value='"+currentURL+"' />"    +"<input type='hidden' name='urlnew' value='"+currentURL+"' />"
   +"<\\/form>"    +"<\\/form>"
   +'$end_page');    +'$end_page_annotate');
    annotator.document.close();     annotator.document.close();
 }  }
   
Line 1225  function set_bookmark() { Line 1228  function set_bookmark() {
    +"value='Save' /> <input type='button' value='Close (no save)' "     +"value='Save' /> <input type='button' value='Close (no save)' "
    +"onclick='javascript:window.close();' /><\\/center><\\/td>"     +"onclick='javascript:window.close();' /><\\/center><\\/td>"
    +"<\\/tr><\\/table><\\/form><\\/center>"     +"<\\/tr><\\/table><\\/form><\\/center>"
    +'$end_page' );     +'$end_page_bookmark' );
    bmquery.document.close();     bmquery.document.close();
 }  }
   
Line 1272  sub get_nav_status { Line 1275  sub get_nav_status {
     return $navstatus;      return $navstatus;
 }  }
   
   #FIXME this needs to move into mydesktab and the other locations 
   # the text is generated
 sub convert_menu_function {  sub convert_menu_function {
     my ($rolename,$type) = @_;      my ($rolename,$type) = @_;
     if ($type eq 'Group') {      if ($type eq 'Group') {

Removed from v.1.185  
changed lines
  Added in v.1.208


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