version 1.319, 2010/03/17 19:35:56
|
version 1.329, 2010/06/06 11:56:12
|
Line 109 Same as primary_menu() but operates on @
|
Line 109 Same as primary_menu() but operates on @
|
|
|
=item show_return_link() |
=item show_return_link() |
|
|
=item registerurl() |
|
|
|
This gets called in the header section |
|
|
|
=item innerregister() |
=item innerregister() |
|
|
This gets called in order to register a URL, both with the Remote |
This gets called in order to register a URL in the body of the document |
and in the body of the document |
|
|
|
=item clear() |
=item clear() |
|
|
Line 182 sub prep_menuitem {
|
Line 177 sub prep_menuitem {
|
return '<li><a' |
return '<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]">$link</a></li>|; |
. qq| href="$$menuitem[0]" target="_top">$link</a></li>|; |
} |
} |
|
|
# primary_menu() evaluates @primary_menu and returns XHTML for the menu |
# primary_menu() evaluates @primary_menu and returns XHTML for the menu |
Line 221 sub primary_menu {
|
Line 216 sub primary_menu {
|
if ($$menuitem[3] eq 'Help') { # special treatment for helplink |
if ($$menuitem[3] eq 'Help') { # special treatment for helplink |
$menu .= '<li>'.&Apache::loncommon::top_nav_help('Help').'</li>'; |
$menu .= '<li>'.&Apache::loncommon::top_nav_help('Help').'</li>'; |
} else { |
} else { |
my @items = @{$menuitem}; |
$menu .= prep_menuitem($menuitem); |
$items[0] = 'javascript:'.$menuitem->[0].';'; |
|
$menu .= &prep_menuitem(\@items); |
|
} |
} |
} |
} |
|
$menu =~ s/\[domain\]/$env{'user.domain'}/g; |
|
$menu =~ s/\[user\]/$env{'user.name'}/g; |
|
|
return "<ol class=\"LC_primary_menu LC_right\">$menu</ol>"; |
return "<ol class=\"LC_primary_menu LC_right\">$menu</ol>"; |
} |
} |
|
|
|
#returns hashref {user=>'',dom=>''} containing: |
|
# own name, domain if user is au |
|
# name, domain of parent author if user is ca or aa |
|
#empty return if user is not an author or not on homeserver |
|
# |
|
#TODO this should probably be moved somewhere more central |
|
#since it can be used by different parts of the system |
|
sub getauthor{ |
|
return unless $env{'request.role'}=~/^(ca|aa|au)/; #nothing to do if user isn't some kind of author |
|
|
|
#co- or assistent author? |
|
my ($dom, $user) = ($env{'request.role'} =~ /^(?:ca|aa)\.\/($match_domain)\/($match_username)$/) |
|
? ($1, $2) #domain, username of the parent author |
|
: @env{ ('request.role.domain', 'user.name') }; #own domain, username |
|
|
|
# current server == home server? |
|
my $home = &Apache::lonnet::homeserver($user,$dom); |
|
foreach (&Apache::lonnet::current_machine_ids()){ |
|
return {user => $user, dom => $dom} if $_ eq $home; |
|
} |
|
|
|
# if wrong server |
|
return; |
|
} |
|
|
sub secondary_menu { |
sub secondary_menu { |
my $menu; |
my $menu; |
|
|
my $crstype = &Apache::loncommon::course_type(); |
my $crstype = &Apache::loncommon::course_type(); |
my $canedit = &Apache::lonnet::allowed('mdc', $env{'request.course.id'}); |
my $crs_sec = $env{'request.course.id'} . ($env{'request.course.sec'} |
my $canviewgrps = &Apache::lonnet::allowed('vcg', $env{'request.course.id'} |
? "/$env{'request.course.sec'}" |
. ($env{'request.course.sec'} ? "/$env{'request.course.sec'}" |
: ''); |
: '')); |
my $canedit = &Apache::lonnet::allowed('mdc', $env{'request.course.id'}); |
|
my $canviewgrps = &Apache::lonnet::allowed('vcg', $crs_sec); |
|
my $canmodifyuser = &Apache::lonnet::allowed('cst', $crs_sec); |
|
my $canviewwnew = &Apache::lonnet::allowed('whn', $crs_sec); |
|
my $canmodpara = &Apache::lonnet::allowed('opa', $crs_sec); |
|
my $author = getauthor(); |
|
|
my $showlink = &show_return_link(); |
my $showlink = &show_return_link(); |
my %groups = &Apache::lonnet::get_active_groups( |
my %groups = &Apache::lonnet::get_active_groups( |
$env{'user.domain'}, $env{'user.name'}, |
$env{'user.domain'}, $env{'user.name'}, |
$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'}); |
|
|
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 $$menuitem[4] ne 'always' |
next if $$menuitem[4] ne 'always' |
|
&& $$menuitem[4] ne 'author' |
&& !$env{'request.course.id'}; |
&& !$env{'request.course.id'}; |
next if $$menuitem[4] eq 'showreturn' |
next if $$menuitem[4] eq 'showreturn' |
&& !$showlink |
&& !$showlink |
Line 258 sub secondary_menu {
|
Line 285 sub secondary_menu {
|
&& $crstype eq 'Community'; |
&& $crstype eq 'Community'; |
next if $$menuitem[4] eq 'mdcCommunity' |
next if $$menuitem[4] eq 'mdcCommunity' |
&& $crstype ne 'Community'; |
&& $crstype ne 'Community'; |
next if $$menuitem[4] =~ /^Course$/ |
next if $$menuitem[4] eq 'cst' |
&& $crstype eq 'Community'; |
&& !$canmodifyuser; |
next if $$menuitem[4] =~ /^Community$/ |
next if $$menuitem[4] eq 'whn' |
&& $crstype ne 'Community'; |
&& !$canviewwnew; |
|
next if $$menuitem[4] eq 'opa' |
|
&& !$canmodpara; |
next if $$menuitem[4] =~ /showgroups$/ |
next if $$menuitem[4] =~ /showgroups$/ |
&& !$canviewgrps |
&& !$canviewgrps |
&& !%groups; |
&& !%groups; |
|
next if $$menuitem[4] eq 'author' |
|
&& !$author; |
|
|
if ($$menuitem[3] eq 'Roles' && $env{'request.course.id'}) { |
if ($$menuitem[3] eq 'Roles' && $env{'request.course.id'}) { |
# special treatment for role selector |
# special treatment for role selector |
Line 297 sub secondary_menu {
|
Line 328 sub secondary_menu {
|
$menu =~ s/\[url\]/$escurl/g; |
$menu =~ s/\[url\]/$escurl/g; |
$menu =~ s/\[symb\]/$escsymb/g; |
$menu =~ s/\[symb\]/$escsymb/g; |
} |
} |
|
$menu =~ s/\[uname\]/$$author{user}/g; |
|
$menu =~ s/\[udom\]/$$author{dom}/g; |
|
|
return "<ul id=\"LC_secondary_menu\">$menu</ul>"; |
return "<ul id=\"LC_secondary_menu\">$menu</ul>"; |
} |
} |
|
|
sub show_return_link { |
sub show_return_link { |
|
if (($env{'request.noversionuri'} =~ m{^/adm/(viewclasslist|navmaps)($|\?)}) |
|
|| ($env{'request.noversionuri'} =~ m{^/adm/.*/aboutme($|\?)})) { |
|
|
|
return if ($env{'form.register'}); |
|
} |
return (($env{'request.noversionuri'}=~m{^/(res|public)/} && |
return (($env{'request.noversionuri'}=~m{^/(res|public)/} && |
$env{'request.symb'} eq '') |
$env{'request.symb'} eq '') |
|| |
|| |
Line 310 sub show_return_link {
|
Line 348 sub show_return_link {
|
(($env{'request.noversionuri'}=~/^\/adm\//) && |
(($env{'request.noversionuri'}=~/^\/adm\//) && |
($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) && |
($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) && |
($env{'request.noversionuri'}!~ |
($env{'request.noversionuri'}!~ |
m[^/adm/.*/(smppg|bulletinboard|aboutme)($|\?)]) |
m{^/adm/.*/(smppg|bulletinboard)($|\?)}) |
)); |
)); |
} |
|
|
|
|
|
sub registerurl { |
|
if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; } |
|
return Apache::lonxml::display_title(); |
|
} |
} |
|
|
sub innerregister { |
sub innerregister { |
my ($forcereg,$titletable,$bread_crumbs) = @_; |
my ($forcereg,$bread_crumbs) = @_; |
my ($uname,$thisdisfn); |
|
my $const_space = ($env{'request.state'} eq 'construct'); |
my $const_space = ($env{'request.state'} eq 'construct'); |
my $is_const_dir = 0; |
my $is_const_dir = 0; |
|
|
Line 343 sub innerregister {
|
Line 374 sub innerregister {
|
#SD |
#SD |
#course_type only Course and Community? |
#course_type only Course and Community? |
# |
# |
my @crumbs = ({text => Apache::loncommon::course_type() |
my @crumbs; |
|
unless (($forcereg) && ($env{'request.noversionuri'} eq '/adm/navmaps') |
|
&& ($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'})) { |
|
@crumbs = ({text => Apache::loncommon::course_type() |
. ' Contents', |
. ' Contents', |
href => "Javascript:gonav('/adm/navmaps')"}); |
href => "Javascript:gopost('/adm/navmaps','')"}); |
|
} |
if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) { |
if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) { |
push(@crumbs, {text => '...', |
push(@crumbs, {text => '...', |
no_mt => 1}); |
no_mt => 1}); |
Line 360 sub innerregister {
|
Line 394 sub innerregister {
|
|
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::add_breadcrumb(@crumbs); |
&Apache::lonhtmlcommon::add_breadcrumb(@crumbs); |
|
}elsif (! $const_space){ |
|
#a situation when we're looking at a resource outside of context of a |
|
#course or construction space (e.g. with cumulative rights) |
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
|
&Apache::lonhtmlcommon::add_breadcrumb({text => 'View Resource'}); |
} |
} |
# ============================================================================= |
# ============================================================================= |
# ============================ This is for URLs that actually can be registered |
# ============================ This is for URLs that actually can be registered |
Line 570 if(length($annotation) > 0){
|
Line 609 if(length($annotation) > 0){
|
$menuitems.="&anno-[_1]&tations[_1]&annotate()&"; |
$menuitems.="&anno-[_1]&tations[_1]&annotate()&"; |
$menuitems.="Make notes and annotations about this resource&&1\n"; |
$menuitems.="Make notes and annotations about this resource&&1\n"; |
|
|
unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) { |
unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme|viewclasslist|portfolio)(\?|$)/) { |
if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/})) { |
if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/})) { |
$menuitems.=(<<ENDREALRES); |
$menuitems.=(<<ENDREALRES); |
s&6&3&catalog.png&catalog[_2]&info[_1]&catalog_info()&Show Metadata |
s&6&3&catalog.png&catalog[_2]&info[_1]&catalog_info()&Show Metadata |
Line 628 ENDMENUITEMS
|
Line 667 ENDMENUITEMS
|
'tools', @inlineremote[63]); |
'tools', @inlineremote[63]); |
} |
} |
|
|
|
unless ($env{'request.noversionuri'}=~ m{^/adm/(navmaps|viewclasslist)(\?|$)}) { |
Apache::lonhtmlcommon::add_breadcrumb_tool( |
Apache::lonhtmlcommon::add_breadcrumb_tool( |
'advtools', @inlineremote[61,71,72,73,92]); |
'advtools', @inlineremote[61,71,72,73,92]); |
|
} |
} |
} |
} |
} |
|
|
Line 677 sub edit_course_upload {
|
Line 717 sub edit_course_upload {
|
|
|
# ================================================================== Raw Config |
# ================================================================== Raw Config |
|
|
#SD |
|
#this is called by |
|
#lonmenu |
|
# |
|
sub clear { |
sub clear { |
my ($row,$col)=@_; |
my ($row,$col)=@_; |
$inlineremote[10*$row+$col]=''; |
$inlineremote[10*$row+$col]=''; |
Line 701 sub switch {
|
Line 737 sub switch {
|
my $idx=10*$row+$col; |
my $idx=10*$row+$col; |
$category_members{$cat}.=':'.$idx; |
$category_members{$cat}.=':'.$idx; |
|
|
# Inline Remote |
# Inline Menu |
if ($nobreak==2) { return ''; } |
if ($nobreak==2) { return ''; } |
my $text=$top.' '.$bot; |
my $text=$top.' '.$bot; |
$text=~s/\s*\-\s*//gs; |
$text=~s/\s*\-\s*//gs; |
Line 1071 function go(url) {
|
Line 1107 function go(url) {
|
} |
} |
} |
} |
|
|
function gotop(url) { |
|
if (url!='' && url!= null) { |
|
top.location.href = url; |
|
} |
|
} |
|
|
|
function gopost(url,postdata) { |
function gopost(url,postdata) { |
if (url!='') { |
if (url!='') { |
this.document.server.action=url; |
this.document.server.action=url; |
Line 1166 function edit_bookmarks() {
|
Line 1196 function edit_bookmarks() {
|
go(''); |
go(''); |
w_BookmarkPal_flag=1; |
w_BookmarkPal_flag=1; |
bookmarkpal=window.open("/adm/bookmarks", |
bookmarkpal=window.open("/adm/bookmarks", |
"BookmarkPal", "width=400,height=505,scrollbars=0"); |
"BookmarkPal", "width=500,height=505,scrollbars=0"); |
} |
} |
|
|
function annotate() { |
function annotate() { |