Diff for /loncom/interface/lonmenu.pm between versions 1.467 and 1.468

version 1.467, 2017/02/18 23:39:16 version 1.468, 2017/02/20 18:29:22
Line 497  sub secondary_menu { Line 497  sub secondary_menu {
                 my $url = $$menuitem[0];                  my $url = $$menuitem[0];
                 $url =~ s{\[cdom\]/\[cnum\]}{$cdom/$cnum};                  $url =~ s{\[cdom\]/\[cnum\]}{$cdom/$cnum};
                 if (&Apache::lonnet::is_on_map($url)) {                  if (&Apache::lonnet::is_on_map($url)) {
                     unless ($$menuitem[0] =~ /\?register=1/) {                      unless ($$menuitem[0] =~ /(\?|\&)register=1/) {
                         $$menuitem[0] .= '?register=1';                          $$menuitem[0] .= (($$menuitem[0]=~/\?/)? '&' : '?').'register=1';
                     }                      }
                 } else {                  } else {
                     $$menuitem[0] =~ s{\?register=1}{};                      $$menuitem[0] =~ s{\&?register=1}{};
                 }                  }
                 if (($ENV{'SERVER_PORT'} == 443) &&                  if ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://}) {
                     ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {                      if (($ENV{'SERVER_PORT'} == 443) || ($env{'request.use_absolute'} =~ m{^https://})) {
                     $$menuitem[0] .= ($$menuitem[0]=~/\?/) ? '&' : '?' . 'usehttp=1';                          unless ($$menuitem[0] =~ m{^https?://}) {
                               $$menuitem[0] = 'http://'.$ENV{'SERVER_NAME'}.$$menuitem[0];
                           }
                           unless ($$menuitem[0] =~ /(\&|\?)usehttp=1/) {
                               $$menuitem[0] .= (($$menuitem[0]=~/\?/) ? '&' : '?').'usehttp=1';
                           }
                       }
                 }                  }
             }              }
             $menu .= &prep_menuitem(\@$menuitem);              $menu .= &prep_menuitem(\@$menuitem);
Line 629  sub build_submenu { Line 635  sub build_submenu {
 }  }
   
 sub innerregister {  sub innerregister {
     my ($forcereg,$bread_crumbs,$group,$pagebuttonshide) = @_;      my ($forcereg,$bread_crumbs,$group,$pagebuttonshide,$hostname) = @_;
     my $const_space = ($env{'request.state'} eq 'construct');      my $const_space = ($env{'request.state'} eq 'construct');
     my $is_const_dir = 0;      my $is_const_dir = 0;
   
Line 696  sub innerregister { Line 702  sub innerregister {
                 }                  }
                 my $trail;                  my $trail;
                 if ($env{'form.folderpath'}) {                  if ($env{'form.folderpath'}) {
                     &prepare_functions($resurl,$forcereg,$group,undef,undef,1);                      &prepare_functions($resurl,$forcereg,$group,undef,undef,1,$hostname);
                     ($trail) =                      ($trail) =
                         &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);                          &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);
                 } else {                  } else {
Line 711  sub innerregister { Line 717  sub innerregister {
             } elsif ($resurl =~ m{^\Q/uploaded$courseurl/portfolio/syllabus/}) {              } elsif ($resurl =~ m{^\Q/uploaded$courseurl/portfolio/syllabus/}) {
                 &Apache::lonhtmlcommon::clear_breadcrumbs();                  &Apache::lonhtmlcommon::clear_breadcrumbs();
                 &prepare_functions('/public'.$courseurl."/syllabus",                  &prepare_functions('/public'.$courseurl."/syllabus",
                                    $forcereg,$group,undef,undef,1);                                     $forcereg,$group,undef,undef,1,$hostname);
                 $title = &mt('Syllabus File');                  $title = &mt('Syllabus File');
                 my ($trail) =                  my ($trail) =
                     &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);                      &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1,$hostname);
                 return $trail;                  return $trail;
             }              }
             unless ($env{'request.state'} eq 'construct') {              unless ($env{'request.state'} eq 'construct') {
Line 738  sub innerregister { Line 744  sub innerregister {
         $forceview,$editbutton);          $forceview,$editbutton);
     if (($resurl =~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) ||      if (($resurl =~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) ||
         ($env{'request.role'} !~/^(aa|ca|au)/)) {          ($env{'request.role'} !~/^(aa|ca|au)/)) {
         $editbutton = &prepare_functions($resurl,$forcereg,$group);          $editbutton = &prepare_functions($resurl,$forcereg,$group,'','','',$hostname);
     }      }
     if ($editbutton eq '') {      if ($editbutton eq '') {
         $editbutton = &clear(6,1);          $editbutton = &clear(6,1);
Line 1037  ENDMENUITEMS Line 1043  ENDMENUITEMS
 }  }
   
 sub get_editbutton {  sub get_editbutton {
     my ($cfile,$home,$switchserver,$forceedit,$forceview,$forcereg) = @_;      my ($cfile,$home,$switchserver,$forceedit,$forceview,$forcereg,$hostname) = @_;
     my $jscall;      my $jscall;
     if (($forceview) && ($env{'form.todocs'})) {      if (($forceview) && ($env{'form.todocs'})) {
         my ($folderpath,$command,$navmap);          my ($folderpath,$command,$navmap);
Line 1057  sub get_editbutton { Line 1063  sub get_editbutton {
         $jscall = &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver,          $jscall = &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver,
                                                 $forceedit,$forcereg,$env{'request.symb'},                                                  $forceedit,$forcereg,$env{'request.symb'},
                                                 &escape($env{'form.folderpath'}),                                                  &escape($env{'form.folderpath'}),
                                                 &escape($env{'form.title'}),$env{'form.idx'},                                                  &escape($env{'form.title'}),$hostname,
                                                 &escape($env{'form.suppurl'}),$env{'form.todocs'},                                                  $env{'form.idx'},&escape($env{'form.suppurl'}),
                                                 $suppanchor);                                                  $env{'form.todocs'},$suppanchor);
     }      }
     if ($jscall) {      if ($jscall) {
         my $icon = 'pcstr.png';          my $icon = 'pcstr.png';
Line 1076  sub get_editbutton { Line 1082  sub get_editbutton {
 }  }
   
 sub prepare_functions {  sub prepare_functions {
     my ($resurl,$forcereg,$group,$bread_crumbs,$advtools,$docscrumbs) = @_;      my ($resurl,$forcereg,$group,$bread_crumbs,$advtools,$docscrumbs,$hostname) = @_;
     unless ($env{'request.registered'}) {      unless ($env{'request.registered'}) {
         undef(@inlineremote);          undef(@inlineremote);
     }      }
Line 1132  sub prepare_functions { Line 1138  sub prepare_functions {
                 $forceedit = 1;                  $forceedit = 1;
             }              }
             $editbutton = &get_editbutton($cfile,$home,$switchserver,              $editbutton = &get_editbutton($cfile,$home,$switchserver,
                                           $forceedit,$forceview,$forcereg);                                            $forceedit,$forceview,$forcereg,
                                             $hostname);
         } elsif (($resurl eq '/adm/extresedit') &&          } elsif (($resurl eq '/adm/extresedit') &&
                  (($env{'form.symb'}) || ($env{'form.folderpath'}))) {                   (($env{'form.symb'}) || ($env{'form.folderpath'}))) {
             ($cfile,$home,$switchserver,$forceedit,$forceview) =              ($cfile,$home,$switchserver,$forceedit,$forceview) =
Line 1140  sub prepare_functions { Line 1147  sub prepare_functions {
                                                $env{'form.symb'});                                                 $env{'form.symb'});
             if ($cfile ne '') {              if ($cfile ne '') {
                 $editbutton = &get_editbutton($cfile,$home,$switchserver,                  $editbutton = &get_editbutton($cfile,$home,$switchserver,
                                               $forceedit,$forceview,$forcereg,                                                $forceedit,$forceview,$forcereg);
                                               $env{'form.title'},$env{'form.suppurl'});  
             }              }
         } elsif (($resurl =~ m{^/?adm/viewclasslist$}) &&          } elsif (($resurl =~ m{^/?adm/viewclasslist$}) &&
                  (&Apache::lonnet::allowed('opa',$env{'request.course.id'}))) {                   (&Apache::lonnet::allowed('opa',$env{'request.course.id'}))) {
Line 1159  sub prepare_functions { Line 1165  sub prepare_functions {
                         &Apache::lonnet::clutter($resurl),$env{'request.symb'},$group);                          &Apache::lonnet::clutter($resurl),$env{'request.symb'},$group);
                 if ($cfile ne '') {                  if ($cfile ne '') {
                     $editbutton = &get_editbutton($cfile,$home,$switchserver,                      $editbutton = &get_editbutton($cfile,$home,$switchserver,
                                                   $forceedit,$forceview,$forcereg);                                                    $forceedit,$forceview,$forcereg,
                                                     $hostname);
                 }                  }
             }              }
         }          }
Line 1221  sub prepare_functions { Line 1228  sub prepare_functions {
                     $suppanchor = $env{'form.anchor'};                      $suppanchor = $env{'form.anchor'};
                 }                  }
                 my $esc_path=&escape(&HTML::Entities::encode(&escape($env{'form.folderpath'}),'<>&"'));                  my $esc_path=&escape(&HTML::Entities::encode(&escape($env{'form.folderpath'}),'<>&"'));
                   my $link = '/adm/coursedocs?command=direct&amp;forcesupplement=1&amp;supppath='.
                              "$esc_path&amp;anchor=$suppanchor";
                   if ($env{'request.use_absolute'} ne '') {
                       $link = $env{'request.use_absolute'}.$link;
                   }
                 &switch('','',7,4,'docs-22x22.png','Edit Folder','parms[_2]',                  &switch('','',7,4,'docs-22x22.png','Edit Folder','parms[_2]',
                         "location.href='/adm/coursedocs?command=direct&amp;forcesupplement=1&amp;supppath=$esc_path&amp;anchor=$suppanchor'",                          "location.href='$link'",'Folder/Page Content');
                         'Folder/Page Content');  
             }              }
         }          }
     }      }
Line 2114  sub roles_selector { Line 2125  sub roles_selector {
     }      }
     my ($privref,$gotsymb,$destsymb);      my ($privref,$gotsymb,$destsymb);
     my $destinationurl = $ENV{'REQUEST_URI'};      my $destinationurl = $ENV{'REQUEST_URI'};
     if ($destinationurl =~ /\?symb=/) {      if ($destinationurl =~ /(\?|\&)symb=/) {
         $gotsymb = 1;          $gotsymb = 1;
     } elsif ($destinationurl =~ m{^/enc/}) {      } elsif ($destinationurl =~ m{^/enc/}) {
         my $plainurl = &Apache::lonenc::unencrypted($destinationurl);          my $plainurl = &Apache::lonenc::unencrypted($destinationurl);
         if ($plainurl =~ /\?symb=/) {          if ($plainurl =~ /(\?|\&)symb=/) {
             $gotsymb = 1;              $gotsymb = 1;
         }          }
     }      }

Removed from v.1.467  
changed lines
  Added in v.1.468


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