version 1.511, 2021/11/15 22:36:37
|
version 1.560, 2025/01/07 22:21:56
|
Line 99 It gets filled in the BEGIN block of thi
|
Line 99 It gets filled in the BEGIN block of thi
|
|
|
=over |
=over |
|
|
=item prep_menuitems(\@menuitem,$ltitarget) |
=item prep_menuitems(\@menuitem,$target,$listclass,$linkattr) |
|
|
This routine wraps a menuitem in proper HTML. It is used by primary_menu() and |
This routine wraps a menuitem in proper HTML. It is used by primary_menu() and |
secondary_menu(). |
secondary_menu(). |
Line 210 use Apache::lonenc();
|
Line 210 use Apache::lonenc();
|
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonmsg(); |
use Apache::lonmsg(); |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA::ltiutils; |
|
use HTML::Entities(); |
use HTML::Entities(); |
use Apache::lonwishlist(); |
use Apache::lonwishlist(); |
|
|
Line 220 use vars qw(@desklines %category_names %
|
Line 219 use vars qw(@desklines %category_names %
|
my @inlineremote; |
my @inlineremote; |
|
|
sub prep_menuitem { |
sub prep_menuitem { |
my ($menuitem,$ltitarget,$listclass,$linkattr) = @_; |
my ($menuitem,$target,$listclass,$linkattr) = @_; |
return '' unless(ref($menuitem) eq 'ARRAY'); |
return '' unless(ref($menuitem) eq 'ARRAY'); |
my $link; |
my ($link,$targetattr); |
if ($$menuitem[1]) { # graphical Link |
if ($$menuitem[1]) { # graphical Link |
$link = "<img class=\"LC_noBorder\"" |
$link = "<img class=\"LC_noBorder\"" |
. " src=\"" . &Apache::loncommon::lonhttpdurl($$menuitem[1]) . "\"" |
. " src=\"" . &Apache::loncommon::lonhttpdurl($$menuitem[1]) . "\"" |
Line 230 sub prep_menuitem {
|
Line 229 sub prep_menuitem {
|
} else { # textual Link |
} else { # textual Link |
$link = &mt($$menuitem[3]); |
$link = &mt($$menuitem[3]); |
} |
} |
my $target = ' target="_top"'; |
if ($target ne '') { |
if ($ltitarget eq 'iframe') { |
$targetattr = ' target="'.$target.'"'; |
$target =''; |
|
} |
} |
return ($listclass?'<li class="'.$listclass.'">':'<li>').'<a' |
return ($listclass?'<li class="'.$listclass.'">':'<li>').'<a' |
# highlighting for new messages |
# highlighting for new messages |
. ( $$menuitem[4] eq 'newmsg' ? ' class="LC_new_message"' : '') |
. ( $$menuitem[4] eq 'newmsg' ? ' class="LC_new_message"' : '') |
. qq| href="$$menuitem[0]"$target $linkattr>$link</a></li>|; |
. qq| href="$$menuitem[0]"$targetattr $linkattr>$link</a></li>|; |
} |
} |
|
|
# primary_menu() evaluates @primary_menu and returns a two item array, |
# primary_menu() evaluates @primary_menu and returns a two item array, |
Line 247 sub prep_menuitem {
|
Line 245 sub prep_menuitem {
|
# @primary_menu is filled within the BEGIN block of this module with |
# @primary_menu is filled within the BEGIN block of this module with |
# entries from mydesk.tab |
# entries from mydesk.tab |
sub primary_menu { |
sub primary_menu { |
my ($crstype,$ltimenu,$menucoll,$menuref,$links_disabled) = @_; |
my ($crstype,$ltimenu,$menucoll,$menuref,$links_disabled,$links_target,$collapsible) = @_; |
my (%menu,%ltiexc,%menuopts); |
my (%menu,%ltiexc,%menuopts); |
# each element of @primary contains following array: |
# each element of @primary contains following array: |
# (link url, icon path, alt text, link text, condition, position) |
# (link url, icon path, alt text, link text, condition, position) |
Line 265 sub primary_menu {
|
Line 263 sub primary_menu {
|
my %roles_in_env; |
my %roles_in_env; |
$rolecount = &Apache::lonroles::roles_from_env(\%roles_in_env,$update); |
$rolecount = &Apache::lonroles::roles_from_env(\%roles_in_env,$update); |
} |
} |
my ($lti,$ltitarget); |
my $lti; |
if ($env{'request.lti.login'}) { |
if ($env{'request.lti.login'}) { |
$lti = 1; |
$lti = 1; |
$ltitarget = $env{'request.lti.target'}; |
|
if (ref($ltimenu) eq 'HASH') { |
if (ref($ltimenu) eq 'HASH') { |
foreach my $item ('fullname','logout') { |
foreach my $item ('fullname','logout') { |
unless ($ltimenu->{$item}) { |
unless ($ltimenu->{$item}) { |
Line 277 sub primary_menu {
|
Line 274 sub primary_menu {
|
} |
} |
} |
} |
} |
} |
|
my ($listclass,$linkattr,$target); |
|
if ($links_disabled) { |
|
$listclass = 'LCisDisabled'; |
|
$linkattr = 'aria-disabled="true"'; |
|
} |
|
if ($links_target ne '') { |
|
$target = $links_target; |
|
} else { |
|
my ($ltitarget,$deeplinktarget); |
|
if ($env{'request.lti.login'}) { |
|
$ltitarget = $env{'request.lti.target'}; |
|
} |
|
if ($env{'request.deeplink.login'}) { |
|
$deeplinktarget = $env{'request.deeplink.target'}; |
|
} |
|
if (($ltitarget eq 'iframe') || ($deeplinktarget eq '_self')) { |
|
$target = '_self'; |
|
} else { |
|
$target = '_top'; |
|
} |
|
} |
if (($menucoll) && (ref($menuref) eq 'HASH')) { |
if (($menucoll) && (ref($menuref) eq 'HASH')) { |
%menuopts = %{$menuref}; |
%menuopts = %{$menuref}; |
} |
} |
Line 332 sub primary_menu {
|
Line 350 sub primary_menu {
|
} |
} |
} |
} |
} |
} |
my ($listclass,$linkattr); |
|
if ($links_disabled) { |
|
$listclass = 'LCisDisabled'; |
|
$linkattr = 'aria-disabled="true"'; |
|
} |
|
if (defined($primary_submenu{$title})) { |
if (defined($primary_submenu{$title})) { |
my ($link,$target); |
my $link; |
if ($menuitem->[0] ne '') { |
if ($menuitem->[0] ne '') { |
$link = $menuitem->[0]; |
$link = $menuitem->[0]; |
unless ($ltitarget eq 'iframe') { |
|
$target = '_top'; |
|
} |
|
} else { |
} else { |
$link = '#'; |
$link = '#'; |
} |
} |
Line 356 sub primary_menu {
|
Line 366 sub primary_menu {
|
($item->[2] eq 'blog')) && |
($item->[2] eq 'blog')) && |
(!&Apache::lonnet::usertools_access('','',$item->[2], |
(!&Apache::lonnet::usertools_access('','',$item->[2], |
undef,'tools'))); |
undef,'tools'))); |
|
if (($item->[2] eq 'browsepub') && ($item->[0] eq '/res/')) { |
|
if ($env{'request.role'} =~ /^au\./) { |
|
$item->[0] .= $env{'request.role.domain'}.'/?launch=1'; |
|
} elsif ($env{'request.role'} =~ m{^ca\./($match_domain)/($match_username)$}) { |
|
$item->[0] .= $1.'/'.$2.'/?launch=1'; |
|
} elsif (&Apache::lonnet::allowed('bre',$env{'user.domain'})) { |
|
$item->[0] .= $env{'user.domain'}.'/?launch=1'; |
|
} elsif (&Apache::lonnet::allowed('bro','/res/')) { |
|
$item->[0] .= '?launch=1'; |
|
} else { |
|
next; |
|
} |
|
} |
if ($env{'request.course.id'} && $menucoll) { |
if ($env{'request.course.id'} && $menucoll) { |
next if ($item->[3]) && (!$menuopts{$item->[3]}); |
next if ($item->[3]) && (!$menuopts{$item->[3]}); |
} |
} |
Line 391 sub primary_menu {
|
Line 414 sub primary_menu {
|
'helpdeskmail', |
'helpdeskmail', |
$defdom,$origmail); |
$defdom,$origmail); |
if ($to ne '') { |
if ($to ne '') { |
$menu{$position} .= &prep_menuitem($menuitem,$ltitarget,$listclass,$linkattr); |
$menu{$position} .= &prep_menuitem($menuitem,$target,$listclass,$linkattr); |
} |
} |
} else { |
} else { |
$menu{$position} .= ($listclass?'<li class="'.$listclass.'">':'<li>'). |
$menu{$position} .= ($listclass?'<li class="'.$listclass.'">':'<li>'). |
Line 404 sub primary_menu {
|
Line 427 sub primary_menu {
|
$$menuitem[0] = '/adm/login'; |
$$menuitem[0] = '/adm/login'; |
} |
} |
} |
} |
$menu{$position} .= prep_menuitem($menuitem,$ltitarget,$listclass,$linkattr); |
$menu{$position} .= prep_menuitem($menuitem,$target,$listclass,$linkattr); |
} else { |
} else { |
$menu{$position} .= prep_menuitem($menuitem,$ltitarget,$listclass,$linkattr); |
$menu{$position} .= prep_menuitem($menuitem,$target,$listclass,$linkattr); |
} |
} |
} |
} |
my @output = ('',''); |
my @output = ('',''); |
if ($menu{'left'} ne '') { |
if ($menu{'left'} ne '') { |
|
if ($collapsible) { |
|
$menu{'left'} = ($listclass?'<li class="'.$listclass.'">':'<li>'). |
|
' </li>'.$menu{'left'}; |
|
} |
$output[0] = "<ol class=\"LC_primary_menu LC_floatleft\">$menu{'left'}</ol>"; |
$output[0] = "<ol class=\"LC_primary_menu LC_floatleft\">$menu{'left'}</ol>"; |
} |
} |
if ($menu{'right'} ne '') { |
if ($menu{'right'} ne '') { |
Line 426 sub primary_menu {
|
Line 453 sub primary_menu {
|
# |
# |
#TODO this should probably be moved somewhere more central |
#TODO this should probably be moved somewhere more central |
#since it can be used by different parts of the system |
#since it can be used by different parts of the system |
sub getauthor{ |
sub getauthor { |
return unless $env{'request.role'}=~/^(ca|aa|au)/; #nothing to do if user isn't some kind of author |
return unless $env{'request.role'}=~/^(ca|aa|au)/; #nothing to do if user isn't some kind of author |
|
|
#co- or assistent author? |
#co- or assistant author? |
my ($dom, $user) = ($env{'request.role'} =~ /^(?:ca|aa)\.\/($match_domain)\/($match_username)$/) |
my ($dom, $user) = ($env{'request.role'} =~ /^(?:ca|aa)\.\/($match_domain)\/($match_username)$/) |
? ($1, $2) #domain, username of the parent author |
? ($1, $2) #domain, username of the parent author |
: @env{ ('request.role.domain', 'user.name') }; #own domain, username |
: @env{ ('request.role.domain', 'user.name') }; #own domain, username |
Line 445 sub getauthor{
|
Line 472 sub getauthor{
|
} |
} |
|
|
sub secondary_menu { |
sub secondary_menu { |
my ($httphost,$ltiscope,$ltimenu,$noprimary,$menucoll,$menuref,$links_disabled) = @_; |
my ($httphost,$ltiscope,$ltimenu,$noprimary,$menucoll,$menuref, |
|
$links_disabled,$links_target) = @_; |
my $menu; |
my $menu; |
|
|
my $crstype = &Apache::loncommon::course_type(); |
my $crstype = &Apache::loncommon::course_type(); |
Line 469 sub secondary_menu {
|
Line 497 sub secondary_menu {
|
my $canplc = &Apache::lonnet::allowed('plc', $crs_sec); |
my $canplc = &Apache::lonnet::allowed('plc', $crs_sec); |
my $author = &getauthor(); |
my $author = &getauthor(); |
|
|
|
my ($is_author,$is_coauthor); |
|
if ($author) { |
|
if ($env{'request.role'} =~ /^au\./) { |
|
$is_author = 1; |
|
} elsif ($env{'request.role'} =~ /^ca\./) { |
|
$is_coauthor = 1; |
|
} |
|
} |
|
|
my ($cdom,$cnum,$showsyllabus,$showfeeds,$showresv,$grouptools, |
my ($cdom,$cnum,$showsyllabus,$showfeeds,$showresv,$grouptools, |
$lti,$ltimapres,%ltiexc,%menuopts); |
$lti,$ltimapres,%ltiexc,%menuopts); |
$grouptools = 0; |
$grouptools = 0; |
Line 522 sub secondary_menu {
|
Line 559 sub secondary_menu {
|
%menuopts = %{$menuref}; |
%menuopts = %{$menuref}; |
} |
} |
|
|
my ($listclass,$linkattr); |
my ($listclass,$linkattr,$target); |
if ($links_disabled) { |
if ($links_disabled) { |
$listclass = 'LCisDisabled'; |
$listclass = 'LCisDisabled'; |
$linkattr = 'aria-disabled="true"'; |
$linkattr = 'aria-disabled="true"'; |
} |
} |
|
|
my ($canmodifycoauthor); |
my ($canlistcoauthors,$canmodifycoauthor); |
if ($env{'request.role'} eq "au./$env{'user.domain'}/") { |
if ($env{'request.role'} eq "au./$env{'user.domain'}/") { |
my $extent = "$env{'user.domain'}/$env{'user.name'}"; |
my $extent = "$env{'user.domain'}/$env{'user.name'}"; |
if ((&Apache::lonnet::allowed('cca',$extent)) || |
if ((&Apache::lonnet::allowed('cca',$extent)) || |
(&Apache::lonnet::allowed('caa',$extent))) { |
(&Apache::lonnet::allowed('caa',$extent))) { |
$canmodifycoauthor = 1; |
$canmodifycoauthor = 1; |
} |
} |
|
} elsif ($env{'request.role'} =~ m{^(aa|ca)\./($match_domain/$match_username)$}) { |
|
my ($role,$extent) = ($1,$2); |
|
if (&Apache::lonnet::allowed('vca',$extent)) { |
|
if ($env{"environment.internal.manager./$extent"}) { |
|
$canmodifycoauthor = 1; |
|
} else { |
|
$canlistcoauthors = 1; |
|
} |
|
} elsif (&Apache::lonnet::allowed('vaa',$extent)) { |
|
$canlistcoauthors = 1; |
|
} |
} |
} |
|
my ($roleswitcher_js,$roleswitcher_form); |
my ($roleswitcher_js,$roleswitcher_form,$ltitarget); |
if ($links_target ne '') { |
if ($env{'request.lti.login'}) { |
$target = $links_target; |
$ltitarget = $env{'request.lti.target'}; |
} else { |
|
my ($ltitarget,$deeplinktarget); |
|
if ($env{'request.lti.login'}) { |
|
$ltitarget = $env{'request.lti.target'}; |
|
} |
|
if ($env{'request.deeplink.login'}) { |
|
$deeplinktarget = $env{'request.deeplink.target'}; |
|
} |
|
if (($ltitarget eq 'iframe') || ($deeplinktarget eq '_self')) { |
|
$target = '_self'; |
|
} else { |
|
$target = '_top'; |
|
} |
} |
} |
|
|
foreach my $menuitem (@secondary_menu) { |
foreach my $menuitem (@secondary_menu) { |
# evaluate conditions |
# evaluate conditions |
next if ref($menuitem) ne 'ARRAY'; |
next if ref($menuitem) ne 'ARRAY'; |
next if (($crstype eq 'Placement') && ($$menuitem[3] ne 'Roles') && (!$env{'request.role.adv'})); |
next if (($crstype eq 'Placement') && ($$menuitem[3] ne 'Roles') && (!$env{'request.role.adv'})); |
next if $$menuitem[4] ne 'always' |
next if $$menuitem[4] ne 'always' |
&& ($$menuitem[4] ne 'author' && $$menuitem[4] ne 'cca') |
&& $$menuitem[4] ne 'coauthor' |
|
&& $$menuitem[4] ne 'author' |
|
&& $$menuitem[4] ne 'authorspace' |
|
&& $$menuitem[4] ne 'vca' |
|
&& $$menuitem[4] ne 'mca' |
&& !$env{'request.course.id'}; |
&& !$env{'request.course.id'}; |
next if $$menuitem[4] =~ /^crsedit/ |
next if $$menuitem[4] =~ /^crsedit/ |
&& (!$canedit && !$canvieweditor); |
&& (!$canedit && !$canvieweditor); |
|
next if $$menuitem[4] eq 'crseditCourse' |
|
&& ($crstype eq 'Community'); |
|
next if $$menuitem[4] eq 'crseditCommunity' |
|
&& ($crstype ne 'Community'); |
next if $$menuitem[4] eq 'nvgr' |
next if $$menuitem[4] eq 'nvgr' |
&& ($canvgr || $ltiexc{'grades'}); |
&& ($canvgr || $ltiexc{'grades'}); |
next if $$menuitem[4] eq 'vgr' |
next if $$menuitem[4] eq 'vgr' |
Line 575 sub secondary_menu {
|
Line 643 sub secondary_menu {
|
&& !$showfeeds; |
&& !$showfeeds; |
next if $$menuitem[4] eq 'plc' |
next if $$menuitem[4] eq 'plc' |
&& !$canplc; |
&& !$canplc; |
next if $$menuitem[4] eq 'author' |
next if $$menuitem[4] eq 'authorspace' |
&& !$author; |
&& !$author; |
next if $$menuitem[4] eq 'cca' |
next if $$menuitem[4] eq 'author' |
|
&& !$is_author; |
|
next if $$menuitem[4] eq 'coauthor' |
|
&& !$is_coauthor; |
|
next if $$menuitem[4] eq 'vca' |
|
&& (!$canlistcoauthors || $canmodifycoauthor); |
|
next if $$menuitem[4] eq 'vaa' |
|
&& (!$canlistcoauthors || $canmodifycoauthor); |
|
next if $$menuitem[4] eq 'mca' |
&& !$canmodifycoauthor; |
&& !$canmodifycoauthor; |
next if $$menuitem[4] eq 'notltimapres' |
next if $$menuitem[4] eq 'notltimapres' |
&& $ltimapres; |
&& $ltimapres; |
Line 595 sub secondary_menu {
|
Line 671 sub secondary_menu {
|
} |
} |
} |
} |
if (defined($secondary_submenu{$title})) { |
if (defined($secondary_submenu{$title})) { |
my ($link,$target); |
my $link; |
if ($menuitem->[0] ne '') { |
if ($menuitem->[0] ne '') { |
$link = $menuitem->[0]; |
$link = $menuitem->[0]; |
unless ($ltitarget eq 'iframe') { |
|
$target = '_top'; |
|
} |
|
} else { |
} else { |
$link = '#'; |
$link = '#'; |
} |
} |
Line 616 sub secondary_menu {
|
Line 689 sub secondary_menu {
|
next if ($item->[2] eq 'vcg' && !$canviewgrps); |
next if ($item->[2] eq 'vcg' && !$canviewgrps); |
next if ($item->[2] eq 'crsedit' && !$canedit && !$canvieweditor); |
next if ($item->[2] eq 'crsedit' && !$canedit && !$canvieweditor); |
next if ($item->[2] eq 'params' && !$canmodpara && !$canviewpara); |
next if ($item->[2] eq 'params' && !$canmodpara && !$canviewpara); |
next if ($item->[2] eq 'author' && !$author); |
next if ($item->[2] eq 'author' && !$is_author); |
next if ($item->[2] eq 'cca' && !$canmodifycoauthor); |
next if ($item->[2] eq 'vca' && !$canlistcoauthors); |
next if ($item->[2] eq 'lti' && !$lti); |
next if ($item->[2] eq 'lti' && !$lti); |
if ($item->[2] =~ /^lti(portfolio|wishlist|blog)$/) { |
if ($item->[2] =~ /^lti(portfolio|wishlist|blog)$/) { |
my $tool = $1; |
my $tool = $1; |
Line 637 sub secondary_menu {
|
Line 710 sub secondary_menu {
|
$menu .= &create_submenu($link,$target,&mt($title),\@scndsub,1,undef, |
$menu .= &create_submenu($link,$target,&mt($title),\@scndsub,1,undef, |
$listclass,$linkattr); |
$listclass,$linkattr); |
} elsif ($link ne '#') { |
} elsif ($link ne '#') { |
$menu .= ($listclass?'<li class="'.$listclass.'">':''). |
$menu .= ($listclass?'<li class="'.$listclass.'">':'<li>'). |
'<a href="'.$link.'" target="'.$target.'" '.$linkattr.'>'. |
'<a href="'.$link.'" target="'.$target.'" '.$linkattr.'>'. |
&mt($title).'</a></li>'; |
&mt($title).'</a></li>'; |
} |
} |
Line 649 sub secondary_menu {
|
Line 722 sub secondary_menu {
|
&roles_selector( |
&roles_selector( |
$env{'course.' . $env{'request.course.id'} . '.domain'}, |
$env{'course.' . $env{'request.course.id'} . '.domain'}, |
$env{'course.' . $env{'request.course.id'} . '.num'}, |
$env{'course.' . $env{'request.course.id'} . '.num'}, |
$httphost,$ltitarget |
$httphost,$target,$menucoll,$menuref |
); |
); |
if (($$menuitem[5]) && (!$menuopts{$$menuitem[5]})) { |
if (($$menuitem[5]) && (!$menuopts{$$menuitem[5]})) { |
next unless ($has_opa_priv); |
next unless ($has_opa_priv); |
Line 683 sub secondary_menu {
|
Line 756 sub secondary_menu {
|
} |
} |
$$menuitem[0] = &HTML::Entities::encode($$menuitem[0],'&<>"'); |
$$menuitem[0] = &HTML::Entities::encode($$menuitem[0],'&<>"'); |
} |
} |
$menu .= &prep_menuitem(\@$menuitem,$ltitarget,$listclass,$linkattr); |
$menu .= &prep_menuitem(\@$menuitem,$target,$listclass,$linkattr); |
} |
} |
} |
} |
if ($menu =~ /\[url\].*\[symb\]/) { |
if ($menu =~ /\[url\].*\[symb\]/) { |
Line 703 sub secondary_menu {
|
Line 776 sub secondary_menu {
|
} |
} |
$menu =~ s/\[url\]/$escurl/g; |
$menu =~ s/\[url\]/$escurl/g; |
$menu =~ s/\[symb\]/$escsymb/g; |
$menu =~ s/\[symb\]/$escsymb/g; |
|
} elsif (($menu =~ m{/adm/preferences\?}) && ($menu =~ /\[returnurl\]/)) { |
|
my $returnurl = $ENV{'REQUEST_URI'}; |
|
if ($ENV{'REQUEST_URI'} =~ m{/adm/preferences\?action=authorsettings\&returnurl=([^\&]+)$}) { |
|
$returnurl = $1; |
|
} |
|
if (($returnurl =~ m{^/adm/createuser($|\?action=)}) || |
|
($returnurl =~ m{^/priv/$match_domain/$match_username}) || |
|
($returnurl =~ m{^/res(/?$|/$match_domain/$match_username)})) { |
|
$returnurl =~ s{\?.*$}{}; |
|
$returnurl = '&returnurl='.&HTML::Entities::encode($returnurl,'"<>&\''); |
|
} else { |
|
undef($returnurl); |
|
} |
|
$menu =~ s/\[returnurl\]/$returnurl/; |
} |
} |
$menu =~ s/\[uname\]/$$author{user}/g; |
$menu =~ s/\[uname\]/$$author{user}/g; |
$menu =~ s/\[udom\]/$$author{dom}/g; |
$menu =~ s/\[udom\]/$$author{dom}/g; |
Line 723 sub secondary_menu {
|
Line 810 sub secondary_menu {
|
sub create_submenu { |
sub create_submenu { |
my ($link,$target,$title,$submenu,$translate,$addclass,$listclass,$linkattr) = @_; |
my ($link,$target,$title,$submenu,$translate,$addclass,$listclass,$linkattr) = @_; |
return unless (ref($submenu) eq 'ARRAY'); |
return unless (ref($submenu) eq 'ARRAY'); |
my $disptarget; |
my $targetattr; |
if ($target ne '') { |
if (($target ne '') && ($link ne '#')) { |
$disptarget = ' target="'.$target.'"'; |
$targetattr = ' target="'.$target.'"'; |
} |
} |
my $menu = '<li class="LC_hoverable '.$addclass.'">'. |
my $menu = '<li class="LC_hoverable '.$addclass.'">'. |
'<a href="'.$link.'"'.$disptarget.'>'. |
'<a href="'.$link.'"'.$targetattr.'>'. |
'<span class="LC_nobreak">'.$title. |
'<span class="LC_nobreak">'.$title. |
'<span class="LC_fontsize_small" style="font-weight:normal;">'. |
'<span class="LC_fontsize_small" style="font-weight:normal;">'. |
' ▼</span></span></a>'. |
' ▼</span></span></a>'. |
Line 805 sub build_submenu {
|
Line 892 sub build_submenu {
|
} |
} |
$href =~ s/\[returnurl\]/$returnurl/; |
$href =~ s/\[returnurl\]/$returnurl/; |
} |
} |
|
my $targetattr; |
unless (($href eq '') || ($href =~ /^\#/)) { |
unless (($href eq '') || ($href =~ /^\#/)) { |
if ($target eq '_top') { |
if ($target ne '') { |
$target = ' target="_top"'; |
$targetattr = ' target="'.$target.'"'; |
} |
} |
} |
} |
|
|
$menu .= '<li '. |
$menu .= '<li '; |
$menu .= ($listclass?'class="'.$listclass.'" ':''); |
$menu .= ($listclass?'class="'.$listclass.'" ':''); |
$menu .= 'style="margin:0;padding:0;'. $bordertop . $borderbot .'">'; |
$menu .= 'style="margin:0;padding:0;'. $bordertop . $borderbot .'">'; |
$menu .= '<a href="'.$href.'"'.$target.' '.$linkattr.'>' . $title . '</a>'; |
$menu .= '<a href="'.$href.'"'.$targetattr.' '.$linkattr.'>' . $title . '</a>'; |
$menu .= '</li>'; |
$menu .= '</li>'; |
} |
} |
} |
} |
Line 823 sub build_submenu {
|
Line 911 sub build_submenu {
|
} |
} |
|
|
sub innerregister { |
sub innerregister { |
my ($forcereg,$bread_crumbs,$group,$pagebuttonshide,$hostname,$ltiscope,$ltiuri) = @_; |
my ($forcereg,$bread_crumbs,$group,$pagebuttonshide,$hostname, |
|
$ltiscope,$ltiuri,$showncrumbsref) = @_; |
my $const_space = ($env{'request.state'} eq 'construct'); |
my $const_space = ($env{'request.state'} eq 'construct'); |
my $is_const_dir = 0; |
my $in_daxe = 0; |
|
|
if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; } |
if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; } |
|
|
Line 864 sub innerregister {
|
Line 953 sub innerregister {
|
} |
} |
} |
} |
} |
} |
unless (($forcereg) && |
unless ((($crstype eq 'Placement') && (!$env{'request.role.adv'})) || |
($env{'request.noversionuri'} eq '/adm/navmaps') && |
|
($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'}) || |
|
(($crstype eq 'Placement') && (!$env{'request.role.adv'})) || |
|
($ltiscope eq 'map') || ($ltiscope eq 'resource')) { |
($ltiscope eq 'map') || ($ltiscope eq 'resource')) { |
@crumbs = ({text => $crstype.' Contents', |
@crumbs = ({text => $crstype.' Contents', |
href => "Javascript:gopost('/adm/navmaps','')"}); |
href => "Javascript:gopost('/adm/navmaps','')"}); |
Line 914 sub innerregister {
|
Line 1000 sub innerregister {
|
if ($env{'form.title'}) { |
if ($env{'form.title'}) { |
$title = $env{'form.title'}; |
$title = $env{'form.title'}; |
} |
} |
my $trail; |
my ($trail,$cnum,$cdom); |
|
if ($env{'form.folderpath'}) { |
|
$cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
$cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
&Apache::loncommon::validate_folderpath(1,'',$cnum,$cdom); |
|
} |
if ($env{'form.folderpath'}) { |
if ($env{'form.folderpath'}) { |
&prepare_functions($resurl,$forcereg,$group,undef,undef,1,$hostname); |
&prepare_functions($resurl,$forcereg,$group,undef,undef,1,$hostname); |
|
$title = &HTML::Entities::encode($title,'\'"<>&'); |
($trail) = |
($trail) = |
&Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1); |
&Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1,1); |
} else { |
} else { |
&Apache::lonhtmlcommon::add_breadcrumb( |
&Apache::lonhtmlcommon::add_breadcrumb( |
{text => "Supplemental $crstype Content", |
{text => "Supplemental $crstype Content", |
href => "javascript:gopost('/adm/supplemental','')"}); |
href => "javascript:gopost('/adm/supplemental','')"}); |
$title = &mt('View Resource'); |
$title = &HTML::Entities::encode(&mt('View Resource'),'\'"<>&'); |
($trail) = |
($trail) = |
&Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1); |
&Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1,1); |
|
} |
|
if (ref($showncrumbsref)) { |
|
$$showncrumbsref = 1; |
} |
} |
return $trail; |
return $trail; |
} 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,$hostname); |
$forcereg,$group,undef,undef,1,$hostname); |
$title = &mt('Syllabus File'); |
$title = &HTML::Entities::encode(&mt('Syllabus File'),'\'"<>&'); |
|
my ($trail) = |
|
&Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1,1); |
|
if (ref($showncrumbsref)) { |
|
$$showncrumbsref = 1; |
|
} |
|
return $trail; |
|
} elsif (($resurl eq '/public'.$courseurl.'/syllabus') && |
|
($env{'form.folderpath'})) { |
|
if ($env{'form.title'}) { |
|
$title = $env{'form.title'}; |
|
} else { |
|
$title = 'Syllabus'; |
|
} |
|
&prepare_functions($resurl,$forcereg,$group,undef,undef,1,$hostname); |
|
$title = &HTML::Entities::encode($title,'\'"<>&'); |
my ($trail) = |
my ($trail) = |
&Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1,$hostname); |
&Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1,1); |
return $trail; |
return $trail; |
} |
} |
unless ($env{'request.state'} eq 'construct') { |
unless ($env{'request.state'} eq 'construct') { |
Line 1029 sub innerregister {
|
Line 1139 sub innerregister {
|
'Folder/Page Content'); |
'Folder/Page Content'); |
} |
} |
# End modifiable folder/page container check |
# End modifiable folder/page container check |
|
|
|
# |
|
# Determine whether to show View As button for shortcut to display problem, answer, and submissions |
|
# |
|
|
|
if (($env{'request.symb'} ne '') && |
|
($env{'request.filename'}=~/$LONCAPA::assess_re/) && |
|
(($perms{'mgr'}) || ($perms{'vgr'}))) { |
|
my ($viewas,$text,$change,$visibility,$vuname,$vudom,$vid,$leftvis,$defdom, |
|
$domselector,$righticon); |
|
my %lt = &Apache::lonlocal::texthash( |
|
view => 'View', |
|
upda => 'Update', |
|
); |
|
my $possdomstr = $env{'course.'.$env{'request.course.id'}.'.internal.userdomains'}; |
|
if ($possdomstr =~ /,/) { |
|
my @possdoms = split(/,/,$possdomstr); |
|
if ($env{'request.user_in_effect'} =~ /^$match_username:($match_domain)$/) { |
|
$defdom = $1; |
|
} elsif (grep(/^\Q$cdom\E$/,@possdoms)) { |
|
$defdom = $cdom; |
|
} elsif (&Apache::lonnet::domain($possdoms[0]) ne '') { |
|
$defdom = $possdoms[0]; |
|
} |
|
$domselector = &Apache::loncommon::select_dom_form($defdom,'vudom','','','',\@possdoms); |
|
} elsif (($possdomstr ne '') && (&Apache::lonnet::domain($possdomstr) ne '')) { |
|
if ($env{'request.user_in_effect'} =~ /^$match_username:($match_domain)$/) { |
|
$defdom = $1; |
|
} else { |
|
$defdom = $possdomstr; |
|
} |
|
} |
|
if ($env{'request.user_in_effect'} =~ /^($match_username):($match_domain)$/) { |
|
($vuname,$vudom) = ($1,$2); |
|
unless (&Apache::lonnet::is_advanced_user($vudom,$vuname)) { |
|
$vid = (&Apache::lonnet::idrget($vudom,$vuname))[1]; |
|
} |
|
$viewas = $env{'request.user_in_effect'}; |
|
$text = $lt{'upda'}; |
|
$change = 'off'; |
|
$visibility = 'inline'; |
|
$leftvis = 'none'; |
|
$defdom = $vudom; |
|
$righticon = '✖'; |
|
} else { |
|
$text = $lt{'view'}; |
|
$change = 'on'; |
|
$visibility = 'none'; |
|
$leftvis = 'inline'; |
|
if ($defdom eq '') { |
|
$defdom = $cdom; |
|
} |
|
} |
|
my $sellink = &Apache::loncommon::selectstudent_link('userview','vuname','vudom','','','vuidentifier'); |
|
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
|
my $shownsymb = &HTML::Entities::encode(&Apache::lonenc::check_encrypt($env{'request.symb'}),'<>&"'); |
|
my $input; |
|
my @items = ( |
|
'<label><input type="radio" name="vuidentifier" value="uname" checked="checked" onclick="javascript:toggleIdentifier(this.form);" />', |
|
'</label><input name="vuname" type="text" size="6" value="'.$vuname.'" id="LC_vuname" />', |
|
'<label><input type="radio" name="vuidentifier" value="uid" onclick="javascript:toggleIdentifier(this.form);" />', |
|
'</label><input name="vid" type="hidden" size="6" value="'.$vid.'" id="LC_vid" />' |
|
); |
|
if ($domselector) { |
|
push(@items,$domselector); |
|
$input = &mt('[_1]User:[_2] or [_3]ID:[_4] at [_5] | ',@items); |
|
} else { |
|
$input = &mt('[_1]Username:[_2] or [_3]ID:[_4] | ',@items). |
|
'<input name="vudom" type="hidden" value="'.$defdom.'" />'; |
|
} |
|
$input .= '<input name="LC_viewas" type="hidden" value="'.$viewas.'" />', |
|
'<input name="symb" type="hidden" value="'.$shownsymb.'" />'; |
|
my $chooser = <<END; |
|
$selscript |
|
<a href="javascript:toggleViewAsUser('$change');" class="LC_menubuttons_link"> |
|
<span id="usexpand" class="LC_menubuttons_inline_text" style="display:$leftvis">► </span> |
|
</a> |
|
<fieldset id="LC_selectuser" style="display:$visibility"> |
|
<form name="userview" action="" method="post" onsubmit="event.preventDefault(); return validCourseUser(this,'$change');"> |
|
<span class="LC_menubuttons_inline_text LC_nobreak"> |
|
$input |
|
$sellink |
|
</span> |
|
<input type="submit" value="$text" /> |
|
</form> |
|
</fieldset> |
|
<a href="javascript:toggleViewAsUser('$change');" class="LC_menubuttons_link"> |
|
<span id="uscollapse" class="LC_menubuttons_inline_text">$righticon</span> |
|
</a> |
|
END |
|
&switch('','',7,5,'viewuser.png','View As','user[_1]', |
|
'toggleViewAsUser('."'$change'".')', |
|
'View As','','',$chooser); |
|
} |
|
# End view as user check |
|
|
} |
} |
# End course context |
# End course context |
|
|
# Prepare the rest of the buttons |
# Prepare the rest of the buttons |
my ($menuitems,$got_prt,$got_wishlist); |
my ($menuitems,$got_prt,$got_wishlist,$crsauthor,$toplevel_cstr,$crsauthor_cstr); |
if ($const_space) { |
if ($const_space) { |
# |
# |
# We are in construction space |
# We are in construction space |
# |
# |
Line 1042 sub innerregister {
|
Line 1248 sub innerregister {
|
my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'}; |
my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'}; |
my ($udom,$uname,$thisdisfn) = |
my ($udom,$uname,$thisdisfn) = |
($env{'request.filename'}=~m{^\Q$londocroot/priv/\E([^/]+)/([^/]+)/(.*)$}); |
($env{'request.filename'}=~m{^\Q$londocroot/priv/\E([^/]+)/([^/]+)/(.*)$}); |
|
if (($env{'request.course.id'}) && |
|
($env{'course.'.$env{'request.course.id'}.'.num'} eq $uname) && |
|
($env{'course.'.$env{'request.course.id'}.'.domain'} eq $udom)) { |
|
$crsauthor_cstr = 1; |
|
} |
my $currdir = '/priv/'.$udom.'/'.$uname.'/'.$thisdisfn; |
my $currdir = '/priv/'.$udom.'/'.$uname.'/'.$thisdisfn; |
if ($currdir =~ m-/$-) { |
if ($currdir =~ m-/$-) { |
$is_const_dir = 1; |
|
if ($thisdisfn eq '') { |
if ($thisdisfn eq '') { |
unless (($env{'request.course.id'}) && |
$toplevel_cstr = 1; |
($env{'course.'.$env{'request.course.id'}.'.num'} eq $uname) && |
} |
($env{'course.'.$env{'request.course.id'}.'.domain'} eq $udom)) { |
my $esc_currdir = &Apache::loncommon::escape_single($currdir); |
$is_const_dir = 2; |
$menuitems=(<<ENDMENUITEMS); |
|
s&6&3&pub.png&Publish&dir[_2]&gocstr('/adm/publish','$esc_currdir')&Publish this Directory |
|
s&7&4&docs-22x22.png&Edit Metadata&defaults[_1]&gopost('${esc_currdir}default.meta','')&Edit metadata for this Directory |
|
s&7&2&prt.png&Print&printout[_1]&gocstr('/adm/printout','$esc_currdir')&Print contents of directory |
|
s&7&1&del.png&Delete&dir[_3]&gocstr('/adm/cfile?action=delete','$esc_currdir')&Delete this Directory |
|
ENDMENUITEMS |
|
unless ($crsauthor_cstr) { |
|
if (($env{'environment.canarchive'}) && |
|
($uname eq $env{'user.name'}) && ($udom eq $env{'user.domain'})) { |
|
$menuitems .= (<<ENDMENUITEMS); |
|
s&7&7&archive.png&Export&dir[_1]&gocstr('/adm/cfile?action=archive','$esc_currdir')&Export Authoring Space Archive |
|
ENDMENUITEMS |
} |
} |
} |
} |
} else { |
} else { |
$currdir =~ s|[^/]+$||; |
$currdir =~ s|[^/]+$||; |
my $cleandisfn = &Apache::loncommon::escape_single($thisdisfn); |
my $cleandisfn = &Apache::loncommon::escape_single($thisdisfn); |
my $esc_currdir = &Apache::loncommon::escape_single($currdir); |
my $esc_currdir = &Apache::loncommon::escape_single($currdir); |
|
my $pubfile = "/res/$udom/$uname/$thisdisfn"; |
|
my $candelete = 1; |
|
if (-e $londocroot.$pubfile) { |
|
unless (&Apache::lonnet::metadata($pubfile,'obsolete')) { |
|
undef($candelete); |
|
} |
|
} |
# |
# |
# Probably should be in mydesk.tab |
# Probably should be in mydesk.tab |
# |
# |
$menuitems=(<<ENDMENUITEMS); |
if (($crsauthor_cstr) && ($pubfile eq "/res/$udom/$uname/default.rights")) { |
|
$menuitems=(<<ENDMENUITEMS); |
|
s&6&1&list.png&Directory&dir[_1]&golist('$esc_currdir')&List current directory |
|
s&6&3&pub.png&Publish&resource[_3]&gocstr('/adm/publish','/priv/$udom/$uname/$cleandisfn')&Publish this resource |
|
ENDMENUITEMS |
|
} else { |
|
$menuitems=(<<ENDMENUITEMS); |
s&6&1&list.png&Directory&dir[_1]&golist('$esc_currdir')&List current directory |
s&6&1&list.png&Directory&dir[_1]&golist('$esc_currdir')&List current directory |
s&6&2&rtrv.png&Retrieve&version[_1]&gocstr('/adm/retrieve','/priv/$udom/$uname/$cleandisfn')&Retrieve old version |
s&6&2&rtrv.png&Retrieve&version[_1]&gocstr('/adm/retrieve','/priv/$udom/$uname/$cleandisfn')&Retrieve old version |
s&6&3&pub.png&Publish&resource[_3]&gocstr('/adm/publish','/priv/$udom/$uname/$cleandisfn')&Publish this resource |
s&6&3&pub.png&Publish&resource[_3]&gocstr('/adm/publish','/priv/$udom/$uname/$cleandisfn')&Publish this resource |
|
s&7&3©.png&Copy&resource[_4]&gocstr('/adm/cfile?action=copy','/priv/$udom/$uname/$cleandisfn')&Copy this resource |
|
ENDMENUITEMS |
|
} |
|
# |
|
# Rename and Delete only available if obsolete or unpublished |
|
# |
|
if ($candelete) { |
|
$menuitems .= (<<ENDMENUITEMS); |
|
s&7&4&rename.png&Rename&resource[_5]&gocstr('/adm/cfile?action=rename','/priv/$udom/$uname/$cleandisfn')&Rename this resource |
s&7&1&del.png&Delete&resource[_2]&gocstr('/adm/cfile?action=delete','/priv/$udom/$uname/$cleandisfn')&Delete this resource |
s&7&1&del.png&Delete&resource[_2]&gocstr('/adm/cfile?action=delete','/priv/$udom/$uname/$cleandisfn')&Delete this resource |
|
ENDMENUITEMS |
|
} |
|
# |
|
# Print only makes sense for certain mime types |
|
# |
|
if ($thisdisfn=~/\.(xml|html|htm|xhtml|xhtm|tex)$/ || $thisdisfn=~/$LONCAPA::assess_re/) { |
|
$menuitems .= (<<ENDMENUITEMS); |
s&7&2&prt.png&Print&printout[_1]&gocstr('/adm/printout','/priv/$udom/$uname/$cleandisfn')&Prepare a printable document |
s&7&2&prt.png&Print&printout[_1]&gocstr('/adm/printout','/priv/$udom/$uname/$cleandisfn')&Prepare a printable document |
ENDMENUITEMS |
ENDMENUITEMS |
|
} |
|
# |
|
# "Exit Daxe" in Functions menu when using Daxe |
|
# |
|
if ((($env{'form.editmode'} eq 'daxe') && |
|
($thisdisfn=~/\.(xml|html|htm|xhtml|xhtm)$/)) || |
|
(($env{'form.problemmode'} eq 'daxe') && |
|
($thisdisfn=~/$LONCAPA::assess_re/))) { |
|
my %editors = &Apache::loncommon::permitted_editors(); |
|
if ($editors{'daxe'}) { |
|
my $privfile = &Apache::loncommon::escape_single("/priv/$udom/$uname/$thisdisfn"); |
|
$in_daxe = 1; |
|
$menuitems .= (<<ENDMENUITEMS); |
|
my $privfile = &Apache::loncommon::escape_single("/priv/$udom/$uname/$thisdisfn"); |
|
s&7&6&tolastloc.png&Exit Daxe&resource[_1]&go('$privfile')&Exit editing this resource |
|
ENDMENUITEMS |
|
} |
|
} |
|
} |
|
# |
|
# Editing options usually accessed via "Settings" in inline menu need to be |
|
# accessed in a different way, when Authoring Space is accessed in course |
|
# context |
|
# |
|
if ($env{'request.role'} !~/^(aa|ca|au)/) { |
|
my $privfile = &Apache::loncommon::escape_single("/priv/$udom/$uname/$thisdisfn"); |
|
$menuitems .= (<<ENDMENUITEMS); |
|
s&7&5&editops.png&Options&edit[_1]&gocstr('/adm/preferences?action=authorsettings','$privfile')&Authoring Space Options |
|
ENDMENUITEMS |
} |
} |
if (ref($bread_crumbs) eq 'ARRAY') { |
if (ref($bread_crumbs) eq 'ARRAY') { |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
Line 1139 ENDMENUITEMS
|
Line 1418 ENDMENUITEMS
|
$got_prt = 1; |
$got_prt = 1; |
if (($env{'user.adv'}) && ($env{'request.uri'} =~ /^\/res/) |
if (($env{'user.adv'}) && ($env{'request.uri'} =~ /^\/res/) |
&& (!$env{'request.enc'})) { |
&& (!$env{'request.enc'})) { |
my ($cnum,$cdom) = &Apache::loncommon::crsauthor_url($env{'request.uri'}); |
my $privurl = $env{'request.uri'}; |
unless ($cnum) { |
$privurl =~ s{^/res/}{/priv/}; |
|
my ($cnum,$cdom) = &Apache::loncommon::crsauthor_url($privurl); |
|
if ($cnum) { |
|
$crsauthor = 1; |
|
} else { |
# wishlist is only available for users with access to resource-pool |
# wishlist is only available for users with access to resource-pool |
# and links can only be set for resources within the resource-pool |
# and links can only be set for resources within the resource-pool |
$menuitems .= (<<ENDMENUITEMS); |
$menuitems .= (<<ENDMENUITEMS); |
Line 1195 s&8&3&prt.png&Print&printout[_1]&gopost(
|
Line 1478 s&8&3&prt.png&Print&printout[_1]&gopost(
|
ENDMENUITEMS |
ENDMENUITEMS |
$got_prt = 1; |
$got_prt = 1; |
} |
} |
unless ($got_wishlist) { |
unless (($got_wishlist) || ($crsauthor)) { |
if (($env{'user.adv'}) && (!$env{'request.enc'})) { |
if (($env{'user.adv'}) && (!$env{'request.enc'})) { |
# wishlist is only available for users with access to resource-pool |
# wishlist is only available for users with access to resource-pool |
$menuitems .= (<<ENDMENUITEMS); |
$menuitems .= (<<ENDMENUITEMS); |
Line 1223 ENDMENUITEMS
|
Line 1506 ENDMENUITEMS
|
} |
} |
} |
} |
} |
} |
my $showprogress; |
my ($showprogress,$linkprotout); |
if (($crstype eq 'Placement') && (!$env{'request.role.adv'})) { |
if (($crstype eq 'Placement') && (!$env{'request.role.adv'})) { |
$showprogress = &placement_progress(); |
$showprogress = &placement_progress(); |
} |
} |
|
if ($env{'request.deeplink.login'}) { |
|
$linkprotout = &linkprot_exit(); |
|
} |
|
|
my $addremote=0; |
my $addremote=0; |
foreach (@inlineremote) { if ($_ ne '') { $addremote=1; last;} } |
foreach (@inlineremote) { if ($_ ne '') { $addremote=1; last;} } |
Line 1252 ENDMENUITEMS
|
Line 1538 ENDMENUITEMS
|
if ($countdown) { |
if ($countdown) { |
&Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$countdown); |
&Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$countdown); |
} |
} |
|
if ($linkprotout) { |
|
&Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$linkprotout); |
|
} |
if ($showprogress) { |
if ($showprogress) { |
&Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$showprogress); |
&Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$showprogress); |
} |
} |
Line 1260 ENDMENUITEMS
|
Line 1549 ENDMENUITEMS
|
if ($countdown) { |
if ($countdown) { |
unshift(@tools,$countdown); |
unshift(@tools,$countdown); |
} |
} |
|
if ($linkprotout) { |
|
unshift(@tools,$linkprotout); |
|
} |
&Apache::lonhtmlcommon::add_breadcrumb_tool( |
&Apache::lonhtmlcommon::add_breadcrumb_tool( |
'tools',@tools); |
'tools',@tools); |
|
|
|
#exit editing link/icon when using daxe in construction space |
#publish button in construction space |
#publish button in construction space |
if ($env{'request.state'} eq 'construct'){ |
if ($env{'request.state'} eq 'construct'){ |
|
if ($in_daxe) { |
|
&Apache::lonhtmlcommon::add_breadcrumb_tool( |
|
'advtools', $inlineremote[76]); |
|
} |
&Apache::lonhtmlcommon::add_breadcrumb_tool( |
&Apache::lonhtmlcommon::add_breadcrumb_tool( |
'advtools', $inlineremote[63]); |
'advtools', $inlineremote[63]); |
} else { |
} else { |
Line 1272 ENDMENUITEMS
|
Line 1569 ENDMENUITEMS
|
'tools', $inlineremote[63]); |
'tools', $inlineremote[63]); |
} |
} |
&advtools_crumbs(@inlineremote); |
&advtools_crumbs(@inlineremote); |
|
#options link/icon in constructions space viewed with course role |
|
if (($env{'request.state'} eq 'construct') && |
|
($env{'request.role'} !~/^(aa|ca|au)/)) { |
|
&Apache::lonhtmlcommon::add_breadcrumb_tool( |
|
'advtools', $inlineremote[75]); |
|
} |
} |
} |
} else { |
} else { |
if ($showprogress) { |
if ($showprogress) { |
&Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$showprogress); |
&Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$showprogress); |
} |
} |
|
if ($linkprotout) { |
|
&Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$linkprotout); |
|
} |
} |
} |
my ($topic_help,$topic_help_text); |
my ($topic_help,$topic_help_text); |
if ($is_const_dir == 2) { |
if ($toplevel_cstr && !$crsauthor_cstr) { |
if ((($ENV{'SERVER_PORT'} == 443) || |
if ((($ENV{'SERVER_PORT'} == 443) || |
($Apache::lonnet::protocol{$Apache::lonnet::perlvar{'lonHostID'}} eq 'https')) && |
($Apache::lonnet::protocol{$Apache::lonnet::perlvar{'lonHostID'}} eq 'https')) && |
(&Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},'webdav'))) { |
(&Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},'webdav'))) { |
Line 1288 ENDMENUITEMS
|
Line 1594 ENDMENUITEMS
|
$topic_help_text = 'About WebDAV access'; |
$topic_help_text = 'About WebDAV access'; |
} |
} |
} |
} |
|
if (ref($showncrumbsref)) { |
|
$$showncrumbsref = 1; |
|
} |
return &Apache::lonhtmlcommon::scripttag('', 'start') |
return &Apache::lonhtmlcommon::scripttag('', 'start') |
. &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'','','','',$topic_help,$topic_help_text) |
. &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'','','','',$topic_help,$topic_help_text) |
. &Apache::lonhtmlcommon::scripttag('', 'end'); |
. &Apache::lonhtmlcommon::scripttag('', 'end'); |
Line 1311 sub get_editbutton {
|
Line 1620 sub get_editbutton {
|
if ($env{'form.folderpath'}) { |
if ($env{'form.folderpath'}) { |
$suppanchor = $env{'form.anchor'}; |
$suppanchor = $env{'form.anchor'}; |
} |
} |
|
my $shownsymb; |
|
if ($env{'request.symb'}) { |
|
$shownsymb = &Apache::lonenc::check_encrypt($env{'request.symb'}); |
|
} |
$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'},$shownsymb, |
&escape($env{'form.folderpath'}), |
&escape($env{'form.folderpath'}), |
&escape($env{'form.title'}),$hostname, |
&escape($env{'form.title'}),$hostname, |
$env{'form.idx'},&escape($env{'form.suppurl'}), |
$env{'form.idx'},&escape($env{'form.suppurl'}), |
Line 1348 sub prepare_functions {
|
Line 1661 sub prepare_functions {
|
|
|
my $editbutton = ''; |
my $editbutton = ''; |
my $viewsrcbutton = ''; |
my $viewsrcbutton = ''; |
|
my $clientip = &Apache::lonnet::get_requestor_ip(); |
# |
# |
# Determine whether or not to display 'Edit' or 'View Source' icon/button |
# Determine whether or not to display 'Edit' or 'View Source' icon/button |
# |
# |
if ($resurl =~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) { |
if ($resurl =~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) { |
my $blocked = &Apache::loncommon::blocking_status('about',$2,$1); |
my $blocked = &Apache::loncommon::blocking_status('about',$clientip,$2,$1); |
my $file=&Apache::lonnet::declutter($env{'request.filename'}); |
my $file=&Apache::lonnet::declutter($env{'request.filename'}); |
($cfile,$home,$switchserver,$forceedit,$forceview) = |
($cfile,$home,$switchserver,$forceedit,$forceview) = |
&Apache::lonnet::can_edit_resource($file,$cnum,$cdom, |
&Apache::lonnet::can_edit_resource($file,$cnum,$cdom, |
Line 1361 sub prepare_functions {
|
Line 1675 sub prepare_functions {
|
$editbutton = &get_editbutton($cfile,$home,$switchserver, |
$editbutton = &get_editbutton($cfile,$home,$switchserver, |
$forceedit,$forceview,$forcereg); |
$forceedit,$forceview,$forcereg); |
} |
} |
} elsif ((!$env{'request.course.id'}) && |
} elsif (!$env{'request.course.id'}) { |
($env{'user.author'}) && ($env{'request.filename'}) && |
if (($env{'user.author'}) && ($resurl eq '/adm/viewcoauthors')) { |
($env{'request.role'} !~/^(aa|ca|au)/)) { |
if ($env{'request.role'} =~/^(ca|au)/) { |
|
my ($audom,$auname); |
|
if ($env{'request.role'} eq "au./$env{'user.domain'}/") { |
|
($audom,$auname) = ($env{'user.domain'},$env{'user.name'}); |
|
} elsif ($env{'request.role'} =~ m{^ca\./($match_domain)/($match_username)}) { |
|
($audom,$auname) = ($1,$2); |
|
} |
|
if (($audom ne '') && ($auname ne '')) { |
|
my $file=&Apache::lonnet::declutter($env{'request.filename'}); |
|
($cfile,$home,$switchserver,$forceedit,$forceview) = |
|
&Apache::lonnet::can_edit_resource($file,$auname,$audom, |
|
$resurl); |
|
if ($cfile) { |
|
$editbutton = &get_editbutton($resurl,'','',$forceedit, |
|
$forceview); |
|
} |
|
} |
|
} |
|
} elsif (($env{'user.author'}) && ($env{'request.filename'}) && |
|
($env{'request.role'} !~/^(aa|ca|au)/)) { |
# |
# |
# Currently do not have the role of author or co-author. |
# Currently do not have the role of author or co-author. |
# Do we have authoring privileges for the resource? |
# Do we have authoring privileges for the resource? |
# |
# |
my $file=&Apache::lonnet::declutter($env{'request.filename'}); |
my $file=&Apache::lonnet::declutter($env{'request.filename'}); |
($cfile,$home,$switchserver,$forceedit,$forceview) = |
($cfile,$home,$switchserver,$forceedit,$forceview) = |
&Apache::lonnet::can_edit_resource($file,$cnum,$cdom, |
&Apache::lonnet::can_edit_resource($file,$cnum,$cdom, |
&Apache::lonnet::clutter($resurl),$env{'request.symb'},$group); |
&Apache::lonnet::clutter($resurl),$env{'request.symb'},$group); |
if (($cfile) && ($home ne '') && ($home ne 'no_host')) { |
if (($cfile) && ($home ne '') && ($home ne 'no_host')) { |
$editbutton = &get_editbutton($cfile,$home,$switchserver, |
$editbutton = &get_editbutton($cfile,$home,$switchserver, |
$forceedit,$forceview,$forcereg); |
$forceedit,$forceview,$forcereg); |
|
} |
} |
} |
} elsif ($env{'request.course.id'}) { |
} elsif ($env{'request.course.id'}) { |
# |
# |
Line 1425 sub prepare_functions {
|
Line 1759 sub prepare_functions {
|
} elsif (($resurl !~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) && |
} elsif (($resurl !~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) && |
($resurl ne '/cgi-bin/printout.pl')) { |
($resurl ne '/cgi-bin/printout.pl')) { |
if ($env{'request.filename'}) { |
if ($env{'request.filename'}) { |
my $file=&Apache::lonnet::declutter($env{'request.filename'}); |
my $file; |
|
my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'}; |
|
if ($env{'request.filename'} =~ m{^\Q$londocroot\E/priv/}) { |
|
$file = $env{'request.filename'}; |
|
$file =~ s{^\Q$londocroot\E/}{}; |
|
} else { |
|
$file=&Apache::lonnet::declutter($env{'request.filename'}); |
|
} |
($cfile,$home,$switchserver,$forceedit,$forceview) = |
($cfile,$home,$switchserver,$forceedit,$forceview) = |
&Apache::lonnet::can_edit_resource($file,$cnum,$cdom, |
&Apache::lonnet::can_edit_resource($file,$cnum,$cdom, |
&Apache::lonnet::clutter($resurl),$env{'request.symb'},$group); |
&Apache::lonnet::clutter($resurl),$env{'request.symb'},$group); |
Line 1470 sub prepare_functions {
|
Line 1811 sub prepare_functions {
|
if ($resurl =~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) { |
if ($resurl =~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) { |
my ($sdom,$sname) = ($1,$2); |
my ($sdom,$sname) = ($1,$2); |
unless (&Apache::lonnet::is_course($sdom,$sname)) { |
unless (&Apache::lonnet::is_course($sdom,$sname)) { |
my $blocked = &Apache::loncommon::blocking_status('about',$sname,$sdom); |
my $blocked = &Apache::loncommon::blocking_status('about',$clientip,$sname,$sdom); |
unless ($blocked) { |
unless ($blocked) { |
&switch('','',6,4,'mail-message-new-22x22.png','Message to user', |
&switch('','',6,4,'mail-message-new-22x22.png','Message to user', |
'', |
'', |
Line 1565 sub advtools_crumbs {
|
Line 1906 sub advtools_crumbs {
|
&Apache::lonhtmlcommon::add_breadcrumb_tool( |
&Apache::lonhtmlcommon::add_breadcrumb_tool( |
'advtools', @funcs[61,64,65,66,67,74]); |
'advtools', @funcs[61,64,65,66,67,74]); |
} elsif ($env{'request.noversionuri'} !~ m{^/adm/(navmaps|viewclasslist)(\?|$)}) { |
} elsif ($env{'request.noversionuri'} !~ m{^/adm/(navmaps|viewclasslist)(\?|$)}) { |
&Apache::lonhtmlcommon::add_breadcrumb_tool( |
if ($env{'request.state'} eq 'construct') { |
'advtools', @funcs[61,71,72,73,74,92]); |
&Apache::lonhtmlcommon::add_breadcrumb_tool( |
|
'advtools', @funcs[61,73,74,71,72,77]); |
|
} else { |
|
&Apache::lonhtmlcommon::add_breadcrumb_tool( |
|
'advtools', @funcs[61,71,72,73,74,75,92]); |
|
} |
} elsif ($env{'request.noversionuri'} eq '/adm/viewclasslist') { |
} elsif ($env{'request.noversionuri'} eq '/adm/viewclasslist') { |
&Apache::lonhtmlcommon::add_breadcrumb_tool( |
&Apache::lonhtmlcommon::add_breadcrumb_tool( |
'advtools', $funcs[61]); |
'advtools', $funcs[61]); |
Line 1587 sub clear {
|
Line 1933 sub clear {
|
# The javascript is usually similar to "go('/adm/roles')" or "cstrgo(..)". |
# The javascript is usually similar to "go('/adm/roles')" or "cstrgo(..)". |
|
|
sub switch { |
sub switch { |
my ($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat,$nobreak)=@_; |
my ($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat,$nobreak,$form)=@_; |
$act=~s/\$uname/$uname/g; |
$act=~s/\$uname/$uname/g; |
$act=~s/\$udom/$udom/g; |
$act=~s/\$udom/$udom/g; |
$top=&mt($top); |
$top=&mt($top); |
Line 1638 sub switch {
|
Line 1984 sub switch {
|
} else { |
} else { |
$inlineremote[$idx] = |
$inlineremote[$idx] = |
'<a title="'.$desc.'" class="LC_menubuttons_link" href="javascript:'.$act.';">'.$pic. |
'<a title="'.$desc.'" class="LC_menubuttons_link" href="javascript:'.$act.';">'.$pic. |
'<span class="LC_menubuttons_inline_text">'.$top.' </span></a>'; |
'<span class="LC_menubuttons_inline_text">'.$top.' </span></a>'.$form; |
} |
} |
} |
} |
return ''; |
return ''; |
Line 1777 sub rawconfig {
|
Line 2123 sub rawconfig {
|
} else { |
} else { |
next; |
next; |
} |
} |
|
} elsif ($priv eq 'cca') { |
|
next if ($rol eq 'cm'); |
} |
} |
if ((($priv eq 'bre') && (&Apache::lonnet::allowed($priv,$prt) eq 'F')) || |
if ((($priv eq 'bre') && (&Apache::lonnet::allowed($priv,$prt) eq 'F')) || |
(($priv ne 'bre') && (&Apache::lonnet::allowed($priv,$prt)))) { |
(($priv ne 'bre') && (&Apache::lonnet::allowed($priv,$prt)))) { |
Line 1858 sub rawconfig {
|
Line 2206 sub rawconfig {
|
} |
} |
} |
} |
} |
} |
|
} elsif ($pro eq 'coauthor') { |
|
if ($env{'request.role'}=~ m{^(ca|aa)\./($match_domain)/($match_username)$}) { |
|
my ($role,$audom,$auname) = ($1,$2,$3); |
|
if ((($prt eq 'raa') && ($role eq 'aa')) || |
|
(($prt eq 'rca') && ($role eq 'ca') && |
|
(!$env{"environment.internal.manager./$audom/$auname"}))) { |
|
$output.=&switch($auname,$audom, |
|
$row,$col,$img,$top,$bot,$act,$desc,$cat); |
|
} |
|
} |
|
} elsif ($pro eq 'coauthorenv_manager') { |
|
if ($env{'request.role'}=~ m{^ca\./($match_domain)/($match_username)$}) { |
|
my ($audom,$auname) = ($1,$2); |
|
if ($env{"environment.internal.manager./$audom/$auname"}) { |
|
$output.=&switch($auname,$audom, |
|
$row,$col,$img,$top,$bot,$act,$desc,$cat); |
|
} |
|
} |
} elsif ($pro eq 'tools') { |
} elsif ($pro eq 'tools') { |
my @tools = ('aboutme','blog','portfolio'); |
my @tools = ('aboutme','blog','portfolio'); |
if (grep(/^\Q$prt\E$/,@tools)) { |
if (grep(/^\Q$prt\E$/,@tools)) { |
Line 1902 sub check_for_rcrs {
|
Line 2268 sub check_for_rcrs {
|
if (!$showreqcrs) { |
if (!$showreqcrs) { |
foreach my $type (@reqtypes) { |
foreach my $type (@reqtypes) { |
if ($env{'environment.reqcrsotherdom.'.$type} ne '') { |
if ($env{'environment.reqcrsotherdom.'.$type} ne '') { |
$showreqcrs = 1; |
my @domains = split(',',$env{'environment.reqcrsotherdom.'.$type}); |
last; |
foreach my $entry (@domains) { |
|
my ($extdom,$extopt) = split(':',$entry); |
|
if (&Apache::lonnet::will_trust('reqcrs',$env{'user.domain'},$extdom)) { |
|
$showreqcrs = 1; |
|
last; |
|
} |
|
} |
|
if ($showreqcrs) { |
|
last; |
|
} |
} |
} |
} |
} |
} |
} |
Line 2170 END
|
Line 2545 END
|
} |
} |
} |
} |
|
|
|
sub view_as_js { |
|
my ($url,$symb) = @_; |
|
my %lt = &Apache::lonlocal::texthash( |
|
ente => 'Enter a username or a student/employee ID', |
|
info => 'Information you entered does not match a valid course user', |
|
); |
|
&js_escape(\%lt); |
|
return <<"END"; |
|
|
|
function toggleViewAsUser(change) { |
|
if (document.getElementById('LC_selectuser')) { |
|
var seluserid = document.getElementById('LC_selectuser'); |
|
var currstyle = seluserid.style.display; |
|
if (change == 'off') { |
|
document.userview.elements['LC_viewas'].value = ''; |
|
document.userview.elements['vuname'].value = ''; |
|
document.userview.elements['vid'].value = ''; |
|
document.userview.submit(); |
|
return; |
|
} |
|
if ((document.getElementById('usexpand')) && (document.getElementById('uscollapse'))) { |
|
if (currstyle == 'inline') { |
|
seluserid.style.display = 'none'; |
|
document.getElementById('usexpand').innerHTML='► '; |
|
document.getElementById('uscollapse').innerHTML=''; |
|
} else { |
|
seluserid.style.display = 'inline'; |
|
document.getElementById('usexpand').innerHTML=''; |
|
document.getElementById('uscollapse').innerHTML='◄ '; |
|
toggleIdentifier(document.userview); |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
function validCourseUser(form,change) { |
|
var possuname = form.elements['vuname'].value; |
|
var possuid = form.elements['vid'].value; |
|
var domelem = form.elements['vudom']; |
|
var possudom = ''; |
|
if ((domelem.tagName === 'INPUT') && ((domelem.type === 'text') || (domelem.type === 'hidden'))) { |
|
possudom = domelem.value; |
|
} else if (domelem.tagName === 'SELECT') { |
|
possudom = domelem.options[domelem.selectedIndex].value; |
|
} |
|
if ((possuname == '') && (possuid == '')) { |
|
if (change == 'off') { |
|
form.elements['LC_viewas'].value = ''; |
|
form.submit(); |
|
} else { |
|
alert("$lt{'ente'}"); |
|
} |
|
return; |
|
} |
|
var http = new XMLHttpRequest(); |
|
var url = "/adm/courseuser"; |
|
var params = "uname="+possuname+"&uid="+possuid+"&udom="+possudom; |
|
http.open("POST", url, true); |
|
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); |
|
http.onreadystatechange = function() { |
|
if (http.readyState == 4 && http.status == 200) { |
|
var data = JSON.parse(http.responseText); |
|
if (Array.isArray(data.match)) { |
|
var len = data.match.length; |
|
if (len == 2) { |
|
if (data.match[0] != '' && data.match[1] != '') { |
|
form.elements['LC_viewas'].value = data.match[0]+':'+data.match[1]; |
|
form.submit(); |
|
} |
|
} else { |
|
alert("$lt{'info'}"); |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
http.send(params); |
|
return false; |
|
} |
|
|
|
function toggleIdentifier(form) { |
|
if ((document.getElementById('LC_vuname')) && (document.getElementById('LC_vid'))) { |
|
var radioelem = form.elements['vuidentifier']; |
|
if (radioelem.length > 0) { |
|
var i; |
|
for (i=0; i<radioelem.length; i++) { |
|
if (radioelem[i].checked == true) { |
|
if (radioelem[i].value == 'uname') { |
|
document.getElementById('LC_vuname').type = 'text'; |
|
document.getElementById('LC_vid').type = 'hidden'; |
|
document.getElementById('LC_vid').value = ''; |
|
} else { |
|
document.getElementById('LC_vuname').type = 'hidden'; |
|
document.getElementById('LC_vuname').value = ''; |
|
document.getElementById('LC_vid').type = 'text'; |
|
} |
|
break; |
|
} |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
END |
|
} |
|
|
sub utilityfunctions { |
sub utilityfunctions { |
my ($httphost) = @_; |
my ($httphost) = @_; |
my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0])); |
my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0])); |
Line 2207 sub utilityfunctions {
|
Line 2690 sub utilityfunctions {
|
|
|
my $esc_url=&escape($currenturl); |
my $esc_url=&escape($currenturl); |
my $esc_symb=&escape($currentsymb); |
my $esc_symb=&escape($currentsymb); |
|
my $newname = &mt('New Name'); |
|
&js_escape(\$newname); |
|
|
my $countdown = &countdown_toggle_js(); |
my $countdown = &countdown_toggle_js(); |
|
|
my $ltitarget; |
my $viewuser; |
|
if (($env{'request.course.id'}) && |
|
($env{'request.symb'} ne '') && |
|
($env{'request.filename'}=~/$LONCAPA::assess_re/)) { |
|
my $canview; |
|
foreach my $priv ('mgr','vgr') { |
|
$canview = &Apache::lonnet::allowed($priv,$env{'request.course.id'}); |
|
if (!$canview && $env{'request.course.sec'} ne '') { |
|
$canview = |
|
&Apache::lonnet::allowed($priv,"$env{'request.course.id'}/$env{'request.course.sec'}"); |
|
} |
|
last if ($canview); |
|
} |
|
if ($canview) { |
|
$viewuser = &view_as_js($esc_url,$esc_symb); |
|
} |
|
} |
|
|
|
my ($ltitarget,$deeplinktarget); |
if ($env{'request.lti.login'}) { |
if ($env{'request.lti.login'}) { |
$ltitarget = $env{'request.lti.target'}; |
$ltitarget = $env{'request.lti.target'}; |
} |
} |
|
if ($env{'request.deeplink.login'}) { |
|
$deeplinktarget = $env{'request.deeplink.target'}; |
|
} |
|
|
my $annotateurl = '/adm/annotation'; |
my $annotateurl = '/adm/annotation'; |
if ($httphost) { |
if ($httphost) { |
Line 2277 function gocstr(url,filename) {
|
Line 2783 function gocstr(url,filename) {
|
this.document.cstrdelete.submit(); |
this.document.cstrdelete.submit(); |
return; |
return; |
} |
} |
|
if ((url == '/adm/cfile?action=copy') || (url == '/adm/cfile?action=rename')) { |
|
this.document.cstrcopy.filename.value = filename; |
|
var oldname = filename.substring(filename.lastIndexOf("/") + 1); |
|
var newname=prompt('$newname',oldname); |
|
if (newname == "" || !newname || newname == oldname) { |
|
return; |
|
} |
|
if (url == '/adm/cfile?action=rename') { |
|
this.document.cstrcopy.action.value = 'rename'; |
|
} else { |
|
this.document.cstrcopy.action.value = 'copy'; |
|
} |
|
this.document.cstrcopy.newfilename.value = newname; |
|
this.document.cstrcopy.submit(); |
|
return; |
|
} |
if (url == '/adm/printout') { |
if (url == '/adm/printout') { |
this.document.cstrprint.postdata.value = filename |
this.document.cstrprint.postdata.value = filename |
this.document.cstrprint.curseed.value = 0; |
this.document.cstrprint.curseed.value = 0; |
Line 2303 function gocstr(url,filename) {
|
Line 2825 function gocstr(url,filename) {
|
this.document.cstrprint.submit(); |
this.document.cstrprint.submit(); |
return; |
return; |
} |
} |
|
if (url == '/adm/preferences?action=authorsettings') { |
|
document.location.href=url+'&returnurl='+filename; |
|
return; |
|
} |
if (url !='') { |
if (url !='') { |
this.document.constspace.filename.value = filename; |
this.document.constspace.filename.value = filename; |
this.document.constspace.action = url; |
this.document.constspace.action = url; |
Line 2316 function golist(url) {
|
Line 2842 function golist(url) {
|
currentSymb= null; |
currentSymb= null; |
var lcHostname = setLCHost(); |
var lcHostname = setLCHost(); |
var ltitarget = '$ltitarget'; |
var ltitarget = '$ltitarget'; |
if (ltitarget == 'iframe') { |
var deeplinktarget = '$deeplinktarget'; |
|
if ((ltitarget == 'iframe') || (deeplinktarget == '_self')) { |
document.location.href=lcHostname+url; |
document.location.href=lcHostname+url; |
} else { |
} else { |
top.location.href=lcHostname+url; |
top.location.href=lcHostname+url; |
Line 2406 function open_aboutLC() {
|
Line 2933 function open_aboutLC() {
|
|
|
$countdown |
$countdown |
|
|
|
$viewuser |
|
|
ENDUTILITY |
ENDUTILITY |
} |
} |
|
|
Line 2414 sub serverform {
|
Line 2943 sub serverform {
|
unless (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) { |
unless (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) { |
$target = ' target="_top"'; |
$target = ' target="_top"'; |
} |
} |
|
if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self')) { |
|
$target = ' target="_self"'; |
|
} |
|
my $submit = &mt('Submit'); |
return(<<ENDSERVERFORM); |
return(<<ENDSERVERFORM); |
<form name="server" action="/adm/logout" method="post"$target> |
<form name="server" action="/adm/logout" method="post"$target aria-hidden="true"> |
<input type="hidden" name="postdata" value="none" /> |
<input type="hidden" name="postdata" value="none" /> |
<input type="hidden" name="command" value="none" /> |
<input type="hidden" name="command" value="none" /> |
<input type="hidden" name="url" value="none" /> |
<input type="hidden" name="url" value="none" /> |
<input type="hidden" name="symb" value="none" /> |
<input type="hidden" name="symb" value="none" /> |
|
<input type="submit" value="$submit" class="LC_visually_hidden" tabindex="-1" disabled="disabled" /> |
</form> |
</form> |
ENDSERVERFORM |
ENDSERVERFORM |
} |
} |
|
|
sub constspaceform { |
sub constspaceform { |
|
my ($frameset) = @_; |
my ($target,$printtarget); |
my ($target,$printtarget); |
unless (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) { |
if ($frameset) { |
$target = ' target="_top"'; |
$target = ' target="_parent"'; |
$printtarget = ' target="_parent"'; |
$printtarget = ' target="_parent"'; |
|
} else { |
|
unless ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) || |
|
(($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) { |
|
$target = ' target="_top"'; |
|
$printtarget = ' target="_top"'; |
|
} |
} |
} |
return(<<ENDCONSTSPACEFORM); |
return(<<ENDCONSTSPACEFORM); |
<form name="constspace" action="/adm/logout" method="post"$target> |
<form name="constspace" action="/adm/logout" method="post"$target> |
Line 2443 sub constspaceform {
|
Line 2984 sub constspaceform {
|
<input type="hidden" name="curseed" value="" /> |
<input type="hidden" name="curseed" value="" /> |
<input type="hidden" name="problemtype" value="" /> |
<input type="hidden" name="problemtype" value="" /> |
</form> |
</form> |
|
<form name="cstrcopy" action="/adm/cfile" method="post"$target> |
|
<input type="hidden" name="action" value="copy" /> |
|
<input type="hidden" name="filename" value="" /> |
|
<input type="hidden" name="newfilename" value="" /> |
|
</form> |
|
|
ENDCONSTSPACEFORM |
ENDCONSTSPACEFORM |
} |
} |
Line 2458 sub hidden_button_check {
|
Line 3004 sub hidden_button_check {
|
} |
} |
|
|
sub roles_selector { |
sub roles_selector { |
my ($cdom,$cnum,$httphost,$ltitarget) = @_; |
my ($cdom,$cnum,$httphost,$target,$menucoll,$menuref) = @_; |
my $crstype = &Apache::loncommon::course_type(); |
my $crstype = &Apache::loncommon::course_type(); |
my $now = time; |
my $now = time; |
my (%courseroles,%seccount,%courseprivs,%roledesc); |
my (%courseroles,%seccount,%courseprivs,%roledesc); |
Line 2564 sub roles_selector {
|
Line 3110 sub roles_selector {
|
} |
} |
} |
} |
if ((keys(%seccount) > 1) || ($numdiffsec > 1)) { |
if ((keys(%seccount) > 1) || ($numdiffsec > 1)) { |
|
my $targetattr; |
|
if ($target ne '') { |
|
$targetattr = ' target="'.$target.'"'; |
|
} |
my @submenu; |
my @submenu; |
$js = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles,\%courseprivs,\%roledesc,$privref); |
$js = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles,\%courseprivs, |
|
\%roledesc,$privref,$menucoll,$menuref); |
$form = |
$form = |
'<form name="rolechooser" method="post" action="'.$httphost.'/adm/roles">'."\n". |
'<form name="rolechooser" method="post" action="'.$httphost.'/adm/roles"'.$targetattr.' aria-hidden="true">'."\n". |
' <input type="hidden" name="destinationurl" value="'. |
' <input type="hidden" name="destinationurl" value="'. |
&HTML::Entities::encode($destinationurl).'" />'."\n". |
&HTML::Entities::encode($destinationurl).'" />'."\n". |
' <input type="hidden" name="gotorole" value="1" />'."\n". |
' <input type="hidden" name="gotorole" value="1" />'."\n". |
Line 2577 sub roles_selector {
|
Line 3128 sub roles_selector {
|
$form .= ' <input type="hidden" name="destsymb" value="'. |
$form .= ' <input type="hidden" name="destsymb" value="'. |
&HTML::Entities::encode($destsymb).'" />'."\n"; |
&HTML::Entities::encode($destsymb).'" />'."\n"; |
} |
} |
$form .= '</form>'."\n"; |
$form .= '<input type="submit" value="'.&mt('Submit').'" class="LC_visually_hidden" tabindex="-1" disabled="disabled" />'."\n". |
|
'</form>'."\n"; |
foreach my $role (@roles_order) { |
foreach my $role (@roles_order) { |
my $include; |
my $include; |
if (defined($courseroles{$role})) { |
if (defined($courseroles{$role})) { |
Line 2630 sub roles_selector {
|
Line 3182 sub roles_selector {
|
} |
} |
} |
} |
if (@submenu > 0) { |
if (@submenu > 0) { |
$switcher = &create_submenu('','',&mt('Switch role'),\@submenu,'','',$ltitarget); |
$switcher = &create_submenu('#',$target,&mt('Switch role'),\@submenu); |
} |
} |
} |
} |
return ($js,$form,$switcher,$has_opa_priv); |
return ($js,$form,$switcher,$has_opa_priv); |
Line 2800 sub get_customadhoc_roles {
|
Line 3352 sub get_customadhoc_roles {
|
} |
} |
|
|
sub jump_to_role { |
sub jump_to_role { |
my ($cdom,$cnum,$seccount,$courseroles,$courseprivs,$roledesc,$privref) = @_; |
my ($cdom,$cnum,$seccount,$courseroles,$courseprivs,$roledesc,$privref, |
|
$menucoll,$menuref) = @_; |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
this => 'This role has section(s) associated with it.', |
this => 'This role has section(s) associated with it.', |
ente => 'Enter a specific section.', |
ente => 'Enter a specific section.', |
Line 2811 sub jump_to_role {
|
Line 3364 sub jump_to_role {
|
role => 'The role you selected is not permitted to view the current page.', |
role => 'The role you selected is not permitted to view the current page.', |
swit => 'Switch role, but display Main Menu page instead?', |
swit => 'Switch role, but display Main Menu page instead?', |
); |
); |
|
&js_escape(\%lt); |
my $js; |
my $js; |
if (ref($courseroles) eq 'HASH') { |
if (ref($courseroles) eq 'HASH') { |
$js = ' var secpick = new Array("'.$lt{'ente'}.'","'.$lt{'orlb'}.'");'."\n". |
$js = ' var secpick = new Array("'.$lt{'ente'}.'","'.$lt{'orlb'}.'");'."\n". |
Line 2833 sub jump_to_role {
|
Line 3387 sub jump_to_role {
|
} |
} |
} |
} |
my $checkroles = 0; |
my $checkroles = 0; |
|
my $fallback = '/adm/menu'; |
|
my $displaymsg = $lt{'swit'}; |
if ((ref($privref) eq 'ARRAY') && (@{$privref} > 0) && (ref($courseprivs) eq 'HASH')) { |
if ((ref($privref) eq 'ARRAY') && (@{$privref} > 0) && (ref($courseprivs) eq 'HASH')) { |
my %disallowed; |
my %disallowed; |
foreach my $role (sort(keys(%{$courseprivs}))) { |
foreach my $role (sort(keys(%{$courseprivs}))) { |
Line 2854 sub jump_to_role {
|
Line 3410 sub jump_to_role {
|
$checkroles = 1; |
$checkroles = 1; |
$js .= " var disallow = new Array('".join("','",keys(%disallowed))."');\n". |
$js .= " var disallow = new Array('".join("','",keys(%disallowed))."');\n". |
" var rolecheck = 1;\n"; |
" var rolecheck = 1;\n"; |
|
if ($menucoll) { |
|
if (ref($menuref) eq 'HASH') { |
|
if ($menuref->{'main'} eq 'n') { |
|
$fallback = '/adm/navmaps'; |
|
if (&Apache::loncommon::course_type() eq 'Community') { |
|
$displaymsg = &mt('Switch role, but display Community Contents page instead?'); |
|
} else { |
|
$displaymsg = &mt('Switch role, but display Course Contents page instead?'); |
|
} |
|
&js_escape(\$displaymsg); |
|
} |
|
} |
|
} |
} |
} |
} |
} |
|
&js_escape(\$fallback); |
if (!$checkroles) { |
if (!$checkroles) { |
$js .= " var disallow = new Array();\n". |
$js .= " var disallow = new Array();\n". |
" rolecheck = 0;\n"; |
" rolecheck = 0;\n"; |
Line 2878 function adhocRole(newrole) {
|
Line 3448 function adhocRole(newrole) {
|
if (rolecheck > 0) { |
if (rolecheck > 0) { |
for (var i=0; i<disallow.length; i++) { |
for (var i=0; i<disallow.length; i++) { |
if (disallow[i] == newrole) { |
if (disallow[i] == newrole) { |
if (confirm("$lt{'role'}\\n$lt{'swit'}")) { |
if (confirm("$lt{'role'}\\n$displaymsg")) { |
document.rolechooser.destinationurl.value = '/adm/menu'; |
document.rolechooser.destinationurl.value = '$fallback'; |
} else { |
} else { |
return; |
return; |
} |
} |
Line 3048 $donebutton
|
Line 3618 $donebutton
|
<span id="ddcountcollapse" class="LC_menubuttons_inline_text"> |
<span id="ddcountcollapse" class="LC_menubuttons_inline_text"> |
$collapse |
$collapse |
</span></a> |
</span></a> |
<span id="duedatecountdown" class="LC_menubuttons_inline_text" style="display: $currdisp;"></span> |
<span id="duedatecountdown" class="LC_menubuttons_inline_text" style="display: $currdisp;" role="timer"></span> |
<a href="javascript:toggleCountdown();" class="LC_menubuttons_link"> |
<a href="javascript:toggleCountdown();" class="LC_menubuttons_link"> |
<span id="ddcountexpand" class="LC_menubuttons_inline_text" >$expand</span> |
<span id="ddcountexpand" class="LC_menubuttons_inline_text" >$expand</span> |
<img src="/res/adm/pages/timer.png" title="$desc" class="LC_icon" alt="$alttxt" /><span class="LC_menubuttons_inline_text">$title</span></a> |
<img src="/res/adm/pages/timer.png" title="$desc" class="LC_icon" alt="$alttxt" /><span class="LC_menubuttons_inline_text">$title</span></a> |
Line 3065 sub placement_progress {
|
Line 3635 sub placement_progress {
|
&mt('Test is [_1]% complete',$complete).'</span>'; |
&mt('Test is [_1]% complete',$complete).'</span>'; |
} |
} |
|
|
|
sub linkprot_exit { |
|
if (($env{'request.course.id'}) && ($env{'request.deeplink.login'})) { |
|
my ($deeplink_symb,$deeplink); |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
if (($cnum ne '') && ($cdom ne '')) { |
|
$deeplink_symb = &Apache::loncommon::deeplink_login_symb($cnum,$cdom); |
|
if ($deeplink_symb) { |
|
if ($deeplink_symb =~ /\.(page|sequence)$/) { |
|
my $mapname = &Apache::lonnet::deversion((&Apache::lonnet::decode_symb($deeplink_symb))[2]); |
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
if (ref($navmap)) { |
|
$deeplink = $navmap->get_mapparam(undef,$mapname,'0.deeplink'); |
|
} |
|
} else { |
|
$deeplink = &Apache::lonnet::EXT('resource.0.deeplink',$deeplink_symb); |
|
} |
|
if ($deeplink ne '') { |
|
my ($state,$others,$listed,$scope,$protect,$display,$target,$exit) = split(/,/,$deeplink); |
|
my %lt = &Apache::lonlocal::texthash( |
|
title => 'Exit Tool', |
|
okdone => 'Click "OK" to exit embedded tool', |
|
cancel => 'Click "Cancel" to continue working.', |
|
ok => 'OK', |
|
exit => 'Cancel', |
|
); |
|
if ($exit) { |
|
my ($show,$text) = split(/:/,$exit); |
|
unless ($show eq 'no') { |
|
my $height = 250; |
|
my $width = 300; |
|
my $exitbuttontext; |
|
if ($text eq '') { |
|
$exitbuttontext = &mt('Exit Tool'); |
|
} else { |
|
$exitbuttontext = $text; |
|
} |
|
return <<END; |
|
<form method="post" name="LCexitButton" action="/adm/linkexit"> |
|
<input type="hidden" name="LC_deeplink_exit" value="" /> |
|
<button id="LC_exit-confirm-opener" type="button">$exitbuttontext</button> |
|
</form> |
|
|
|
<div id="LC_exit-confirm" title="$lt{'title'}"> |
|
<p>$lt{'okdone'} $lt{'cancel'}</p> |
|
</div> |
|
|
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
\$( "#LC_exit-confirm" ).dialog({ autoOpen: false }); |
|
\$( "#LC_exit-confirm-opener" ).click(function() { |
|
\$( "#LC_exit-confirm" ).dialog( "open" ); |
|
\$( "#LC_exit-confirm" ).dialog({ |
|
resizable: false, |
|
height: $height, |
|
width: $width, |
|
modal: true, |
|
buttons: [ |
|
{ |
|
text: "$lt{'ok'}", |
|
click: function() { |
|
\$( this ).dialog( "close" ); |
|
\$( '[name="LC_deeplink_exit"]' )[0].value = 'true'; |
|
\$( '[name="LCexitButton"]' )[0].submit(); |
|
}, |
|
}, |
|
{ |
|
text: "$lt{'exit'}", |
|
click: function() { |
|
\$( this ).dialog( "close" ); |
|
}, |
|
}, |
|
], |
|
}); |
|
}); |
|
// ]]> |
|
</script> |
|
|
|
END |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
# ================================================================ Main Program |
# ================================================================ Main Program |
|
|
BEGIN { |
BEGIN { |