version 1.534, 2023/07/14 00:54:13
|
version 1.560, 2025/01/07 22:21:56
|
Line 245 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,$links_target) = @_; |
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 366 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 421 sub primary_menu {
|
Line 434 sub primary_menu {
|
} |
} |
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 436 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 480 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 539 sub secondary_menu {
|
Line 565 sub secondary_menu {
|
$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); |
if ($links_target ne '') { |
if ($links_target ne '') { |
$target = $links_target; |
$target = $links_target; |
Line 570 sub secondary_menu {
|
Line 606 sub 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 599 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 637 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 724 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 848 sub innerregister {
|
Line 914 sub innerregister {
|
my ($forcereg,$bread_crumbs,$group,$pagebuttonshide,$hostname, |
my ($forcereg,$bread_crumbs,$group,$pagebuttonshide,$hostname, |
$ltiscope,$ltiuri,$showncrumbsref) = @_; |
$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 968 sub innerregister {
|
Line 1034 sub innerregister {
|
$$showncrumbsref = 1; |
$$showncrumbsref = 1; |
} |
} |
return $trail; |
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) = |
|
&Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1,1); |
|
return $trail; |
} |
} |
unless ($env{'request.state'} eq 'construct') { |
unless ($env{'request.state'} eq 'construct') { |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
Line 1069 sub innerregister {
|
Line 1147 sub innerregister {
|
if (($env{'request.symb'} ne '') && |
if (($env{'request.symb'} ne '') && |
($env{'request.filename'}=~/$LONCAPA::assess_re/) && |
($env{'request.filename'}=~/$LONCAPA::assess_re/) && |
(($perms{'mgr'}) || ($perms{'vgr'}))) { |
(($perms{'mgr'}) || ($perms{'vgr'}))) { |
my ($viewas,$text,$change,$visibility,$vuname,$vudom,$vid,$leftvis,$defdom,$righticon); |
my ($viewas,$text,$change,$visibility,$vuname,$vudom,$vid,$leftvis,$defdom, |
|
$domselector,$righticon); |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
view => 'View', |
view => 'View', |
upda => 'Update', |
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)$/) { |
if ($env{'request.user_in_effect'} =~ /^($match_username):($match_domain)$/) { |
($vuname,$vudom) = ($1,$2); |
($vuname,$vudom) = ($1,$2); |
unless (&Apache::lonnet::is_advanced_user($vudom,$vuname)) { |
unless (&Apache::lonnet::is_advanced_user($vudom,$vuname)) { |
Line 1091 sub innerregister {
|
Line 1188 sub innerregister {
|
$change = 'on'; |
$change = 'on'; |
$visibility = 'none'; |
$visibility = 'none'; |
$leftvis = 'inline'; |
$leftvis = 'inline'; |
$defdom = $cdom; |
if ($defdom eq '') { |
|
$defdom = $cdom; |
|
} |
} |
} |
my $sellink = &Apache::loncommon::selectstudent_link('userview','vuname','vudom'); |
my $sellink = &Apache::loncommon::selectstudent_link('userview','vuname','vudom','','','vuidentifier'); |
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
my $shownsymb = &HTML::Entities::encode(&Apache::lonenc::check_encrypt($env{'request.symb'}),'<>&"'); |
my $shownsymb = &HTML::Entities::encode(&Apache::lonenc::check_encrypt($env{'request.symb'}),'<>&"'); |
my $input = &mt('User: [_1] or ID: [_2] at: [_3]', |
my $input; |
'<input name="vuname" type="text" size="8" value="'.$vuname.'" />', |
my @items = ( |
'<input name="vid" type="text" size="8" value="'.$vid.'" />', |
'<label><input type="radio" name="vuidentifier" value="uname" checked="checked" onclick="javascript:toggleIdentifier(this.form);" />', |
&Apache::loncommon::select_dom_form($defdom,'vudom')). |
'</label><input name="vuname" type="text" size="6" value="'.$vuname.'" id="LC_vuname" />', |
'<input name="LC_viewas" type="hidden" value="'.$viewas.'" />', |
'<label><input type="radio" name="vuidentifier" value="uid" onclick="javascript:toggleIdentifier(this.form);" />', |
'<input name="symb" type="hidden" value="'.$shownsymb.'" />'; |
'</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; |
my $chooser = <<END; |
$selscript |
$selscript |
<a href="javascript:toggleViewAsUser('$change');" class="LC_menubuttons_link"> |
<a href="javascript:toggleViewAsUser('$change');" class="LC_menubuttons_link"> |
Line 1130 END
|
Line 1239 END
|
# 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 1139 END
|
Line 1248 END
|
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([^/]+)/([^/]+)/(.*)$}); |
my $crsauthor; |
|
if (($env{'request.course.id'}) && |
if (($env{'request.course.id'}) && |
($env{'course.'.$env{'request.course.id'}.'.num'} eq $uname) && |
($env{'course.'.$env{'request.course.id'}.'.num'} eq $uname) && |
($env{'course.'.$env{'request.course.id'}.'.domain'} eq $udom)) { |
($env{'course.'.$env{'request.course.id'}.'.domain'} eq $udom)) { |
$crsauthor = 1; |
$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 '') && ($crsauthor)) { |
$toplevel_cstr = 1; |
$is_const_dir = 2; |
|
} |
} |
my $esc_currdir = &Apache::loncommon::escape_single($currdir); |
my $esc_currdir = &Apache::loncommon::escape_single($currdir); |
$menuitems=(<<ENDMENUITEMS); |
$menuitems=(<<ENDMENUITEMS); |
Line 1158 s&7&4&docs-22x22.png&Edit Metadata&defau
|
Line 1265 s&7&4&docs-22x22.png&Edit Metadata&defau
|
s&7&2&prt.png&Print&printout[_1]&gocstr('/adm/printout','$esc_currdir')&Print contents of 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 |
s&7&1&del.png&Delete&dir[_3]&gocstr('/adm/cfile?action=delete','$esc_currdir')&Delete this Directory |
ENDMENUITEMS |
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); |
Line 1172 ENDMENUITEMS
|
Line 1287 ENDMENUITEMS
|
# |
# |
# Probably should be in mydesk.tab |
# Probably should be in mydesk.tab |
# |
# |
if (($crsauthor) && ($pubfile eq "/res/$udom/$uname/default.rights")) { |
if (($crsauthor_cstr) && ($pubfile eq "/res/$udom/$uname/default.rights")) { |
$menuitems=(<<ENDMENUITEMS); |
$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&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 |
Line 1194 s&7&4&rename.png&Rename&resource[_5]&goc
|
Line 1309 s&7&4&rename.png&Rename&resource[_5]&goc
|
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 |
ENDMENUITEMS |
} |
} |
$menuitems .= (<<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 1270 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 1326 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 1403 ENDMENUITEMS
|
Line 1555 ENDMENUITEMS
|
&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 1412 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) { |
Line 1422 ENDMENUITEMS
|
Line 1585 ENDMENUITEMS
|
} |
} |
} |
} |
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 1512 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 1576 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 1718 sub advtools_crumbs {
|
Line 1908 sub advtools_crumbs {
|
} elsif ($env{'request.noversionuri'} !~ m{^/adm/(navmaps|viewclasslist)(\?|$)}) { |
} elsif ($env{'request.noversionuri'} !~ m{^/adm/(navmaps|viewclasslist)(\?|$)}) { |
if ($env{'request.state'} eq 'construct') { |
if ($env{'request.state'} eq 'construct') { |
&Apache::lonhtmlcommon::add_breadcrumb_tool( |
&Apache::lonhtmlcommon::add_breadcrumb_tool( |
'advtools', @funcs[61,73,74,71,72]); |
'advtools', @funcs[61,73,74,71,72,77]); |
} else { |
} else { |
&Apache::lonhtmlcommon::add_breadcrumb_tool( |
&Apache::lonhtmlcommon::add_breadcrumb_tool( |
'advtools', @funcs[61,71,72,73,74,75,92]); |
'advtools', @funcs[61,71,72,73,74,75,92]); |
Line 1933 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 2014 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 2345 sub view_as_js {
|
Line 2555 sub view_as_js {
|
return <<"END"; |
return <<"END"; |
|
|
function toggleViewAsUser(change) { |
function toggleViewAsUser(change) { |
var seluserid = document.getElementById('LC_selectuser'); |
if (document.getElementById('LC_selectuser')) { |
var currstyle = seluserid.style.display; |
var seluserid = document.getElementById('LC_selectuser'); |
if (change == 'off') { |
var currstyle = seluserid.style.display; |
document.userview.elements['LC_viewas'].value = ''; |
if (change == 'off') { |
document.userview.elements['vuname'].value = ''; |
document.userview.elements['LC_viewas'].value = ''; |
document.userview.elements['vid'].value = ''; |
document.userview.elements['vuname'].value = ''; |
document.userview.submit(); |
document.userview.elements['vid'].value = ''; |
return; |
document.userview.submit(); |
} |
return; |
if (currstyle == 'inline') { |
} |
seluserid.style.display = 'none'; |
if ((document.getElementById('usexpand')) && (document.getElementById('uscollapse'))) { |
document.getElementById('usexpand').innerHTML='► '; |
if (currstyle == 'inline') { |
document.getElementById('uscollapse').innerHTML=''; |
seluserid.style.display = 'none'; |
} else { |
document.getElementById('usexpand').innerHTML='► '; |
seluserid.style.display = 'inline'; |
document.getElementById('uscollapse').innerHTML=''; |
document.getElementById('usexpand').innerHTML=''; |
} else { |
document.getElementById('uscollapse').innerHTML='◄ '; |
seluserid.style.display = 'inline'; |
|
document.getElementById('usexpand').innerHTML=''; |
|
document.getElementById('uscollapse').innerHTML='◄ '; |
|
toggleIdentifier(document.userview); |
|
} |
|
} |
} |
} |
return; |
return; |
} |
} |
Line 2369 function toggleViewAsUser(change) {
|
Line 2584 function toggleViewAsUser(change) {
|
function validCourseUser(form,change) { |
function validCourseUser(form,change) { |
var possuname = form.elements['vuname'].value; |
var possuname = form.elements['vuname'].value; |
var possuid = form.elements['vid'].value; |
var possuid = form.elements['vid'].value; |
var possudom = form.elements['vudom'].options[form.elements['vudom'].selectedIndex].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 ((possuname == '') && (possuid == '')) { |
if (change == 'off') { |
if (change == 'off') { |
form.elements['LC_viewas'].value = ''; |
form.elements['LC_viewas'].value = ''; |
Line 2405 function validCourseUser(form,change) {
|
Line 2626 function validCourseUser(form,change) {
|
return false; |
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 |
END |
} |
} |
|
|
Line 2446 sub utilityfunctions {
|
Line 2691 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'); |
my $newname = &mt('New Name'); |
|
&js_escape(\$newname); |
|
|
my $countdown = &countdown_toggle_js(); |
my $countdown = &countdown_toggle_js(); |
|
|
Line 2454 sub utilityfunctions {
|
Line 2700 sub utilityfunctions {
|
($env{'request.symb'} ne '') && |
($env{'request.symb'} ne '') && |
($env{'request.filename'}=~/$LONCAPA::assess_re/)) { |
($env{'request.filename'}=~/$LONCAPA::assess_re/)) { |
my $canview; |
my $canview; |
foreach my $priv ('msg','vgr') { |
foreach my $priv ('mgr','vgr') { |
$canview = &Apache::lonnet::allowed($priv,$env{'request.course.id'}); |
$canview = &Apache::lonnet::allowed($priv,$env{'request.course.id'}); |
if (!$canview && $env{'request.course.sec'} ne '') { |
if (!$canview && $env{'request.course.sec'} ne '') { |
$canview = |
$canview = |
Line 2579 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 2696 sub serverform {
|
Line 2946 sub serverform {
|
if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self')) { |
if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self')) { |
$target = ' target="_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 |
} |
} |
Line 2866 sub roles_selector {
|
Line 3118 sub roles_selector {
|
$js = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles,\%courseprivs, |
$js = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles,\%courseprivs, |
\%roledesc,$privref,$menucoll,$menuref); |
\%roledesc,$privref,$menucoll,$menuref); |
$form = |
$form = |
'<form name="rolechooser" method="post" action="'.$httphost.'/adm/roles"'.$targetattr.'>'."\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 2876 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 3365 $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> |