version 1.405, 2012/12/28 17:12:49
|
version 1.416, 2013/06/26 04:25:41
|
Line 106 secondary_menu().
|
Line 106 secondary_menu().
|
|
|
=item primary_menu() |
=item primary_menu() |
|
|
This routine evaluates @primary_menu and returns XHTML for the menu |
This routine evaluates @primary_menu and returns a two item array, |
that contains following links: About, Message, Roles, Help, Logout |
with the array elements containing XHTML for the left and right sides of |
|
the menu that contains the following links: About, Message, Roles, Help, Logout |
@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 |
|
|
=item secondary_menu() |
=item secondary_menu() |
|
|
Line 203 sub prep_menuitem {
|
Line 204 sub prep_menuitem {
|
. qq| href="$$menuitem[0]" target="_top">$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 a two item array, |
# that contains following links: |
# with the array elements containing XHTML for the left and right sides of |
# About, Message, Personal, Roles, Help, Logout |
# the menu that contains the following links: |
|
# Personal, About, Message, Roles, Help, Logout |
# @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 $menu; |
my (%menu); |
# each element of @primary contains following array: |
# each element of @primary contains following array: |
# (link url, icon path, alt text, link text, condition) |
# (link url, icon path, alt text, link text, condition, position) |
my $public; |
my $public; |
if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) |
if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) |
|| (($env{'user.name'} eq '') && ($env{'user.domain'} eq ''))) { |
|| (($env{'user.name'} eq '') && ($env{'user.domain'} eq ''))) { |
Line 236 sub primary_menu {
|
Line 238 sub primary_menu {
|
&& !&Apache::loncommon::show_course(); ## |
&& !&Apache::loncommon::show_course(); ## |
|
|
my $title = $menuitem->[3]; |
my $title = $menuitem->[3]; |
|
my $position = $menuitem->[5]; |
|
if ($position eq '') { |
|
$position = 'right'; |
|
} |
if (defined($primary_submenu{$title})) { |
if (defined($primary_submenu{$title})) { |
my ($link,$target); |
my ($link,$target); |
if ($menuitem->[0] ne '') { |
if ($menuitem->[0] ne '') { |
Line 248 sub primary_menu {
|
Line 254 sub primary_menu {
|
if (ref($primary_submenu{$title}) eq 'ARRAY') { |
if (ref($primary_submenu{$title}) eq 'ARRAY') { |
foreach my $item (@{$primary_submenu{$title}}) { |
foreach my $item (@{$primary_submenu{$title}}) { |
next if (($item->[2] eq 'wishlist') && (!$env{'user.adv'})); |
next if (($item->[2] eq 'wishlist') && (!$env{'user.adv'})); |
next if (($item->[2] eq 'reqcrs') && (!&check_for_rcrs())); |
|
next if ((($item->[2] eq 'portfolio') || |
next if ((($item->[2] eq 'portfolio') || |
($item->[2] eq 'blog')) && |
($item->[2] eq 'blog')) && |
(!&Apache::lonnet::usertools_access('','',$item->[2], |
(!&Apache::lonnet::usertools_access('','',$item->[2], |
Line 256 sub primary_menu {
|
Line 261 sub primary_menu {
|
push(@primsub,$item); |
push(@primsub,$item); |
} |
} |
if (@primsub > 0) { |
if (@primsub > 0) { |
$menu .= &create_submenu($link,$target,$title,\@primsub); |
$menu{$position} .= &create_submenu($link,$target,$title,\@primsub); |
} elsif ($link) { |
} elsif ($link) { |
$menu .= '<li><a href="'.$link.'" target="'.$target.'">'.&mt($title).'</a></li>'; |
$menu{$position} .= '<li><a href="'.$link.'" target="'.$target.'">'.&mt($title).'</a></li>'; |
} |
} |
} |
} |
} elsif ($$menuitem[3] eq 'Help') { # special treatment for helplink |
} elsif ($$menuitem[3] eq 'Help') { # special treatment for helplink |
Line 269 sub primary_menu {
|
Line 274 sub primary_menu {
|
'helpdeskmail', |
'helpdeskmail', |
$defdom,$origmail); |
$defdom,$origmail); |
if ($to ne '') { |
if ($to ne '') { |
$menu .= &prep_menuitem($menuitem); |
$menu{$position} .= &prep_menuitem($menuitem); |
} |
} |
} else { |
} else { |
$menu .= '<li>'.&Apache::loncommon::top_nav_help('Help').'</li>'; |
$menu{$position} .= '<li>'.&Apache::loncommon::top_nav_help('Help').'</li>'; |
} |
} |
} else { |
} else { |
$menu .= prep_menuitem($menuitem); |
$menu{$position} .= prep_menuitem($menuitem); |
} |
} |
} |
} |
$menu =~ s/\[domain\]/$env{'user.domain'}/g; |
return ("<ol class=\"LC_primary_menu LC_floatleft\">$menu{'left'}</ol>", |
$menu =~ s/\[user\]/$env{'user.name'}/g; |
"<ol class=\"LC_primary_menu LC_floatright LC_right\">$menu{'right'}</ol>"); |
|
|
return "<ol class=\"LC_primary_menu LC_right\">$menu</ol>"; |
|
} |
} |
|
|
#returns hashref {user=>'',dom=>''} containing: |
#returns hashref {user=>'',dom=>''} containing: |
Line 326 sub secondary_menu {
|
Line 329 sub secondary_menu {
|
my $canmgr = &Apache::lonnet::allowed('mgr', $crs_sec); |
my $canmgr = &Apache::lonnet::allowed('mgr', $crs_sec); |
my $author = &getauthor(); |
my $author = &getauthor(); |
|
|
|
my ($cdom,$cnum,$showsyllabus,$showfeeds); |
|
if ($env{'request.course.id'}) { |
|
$cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
$cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
if ($canedit) { |
|
$showsyllabus = 1; |
|
$showfeeds = 1; |
|
} else { |
|
unless (&Apache::lonnet::is_on_map("public/$cdom/$cnum/syllabus")) { |
|
if (($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'}) || |
|
($env{'course.'.$env{'request.course.id'}.'.uploadedsyllabus'}) || |
|
($env{'course.'.$env{'request.course.id'}.'.updatedsyllabus'}) || |
|
($env{'request.course.syllabustime'})) { |
|
$showsyllabus = 1; |
|
} |
|
} |
|
if ($env{'request.course.feeds'}) { |
|
$showfeeds = 1; |
|
} |
|
} |
|
} |
|
|
my ($canmodifycoauthor); |
my ($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'}"; |
Line 369 sub secondary_menu {
|
Line 394 sub secondary_menu {
|
next if $$menuitem[4] =~ /showgroups$/ |
next if $$menuitem[4] =~ /showgroups$/ |
&& !$canviewgrps |
&& !$canviewgrps |
&& !%groups; |
&& !%groups; |
|
next if $$menuitem[4] eq 'showsyllabus' |
|
&& !$showsyllabus; |
|
next if $$menuitem[4] eq 'showfeeds' |
|
&& !$showfeeds; |
next if $$menuitem[4] eq 'author' |
next if $$menuitem[4] eq 'author' |
&& !$author; |
&& !$author; |
next if $$menuitem[4] eq 'cca' |
next if $$menuitem[4] eq 'cca' |
Line 383 sub secondary_menu {
|
Line 412 sub secondary_menu {
|
); |
); |
$menu .= $switcher; |
$menu .= $switcher; |
} else { |
} else { |
|
if ($$menuitem[3] eq 'Syllabus' && $env{'request.course.id'}) { |
|
my $url = $$menuitem[0]; |
|
$url =~ s{\[cdom\]/\[cnum\]}{$cdom/$cnum}; |
|
if (&Apache::lonnet::is_on_map($url)) { |
|
unless ($$menuitem[0] =~ /\?register=1/) { |
|
$$menuitem[0] .= '?register=1'; |
|
} |
|
} else { |
|
$$menuitem[0] =~ s{\?register=1}{}; |
|
} |
|
} |
$menu .= &prep_menuitem(\@$menuitem); |
$menu .= &prep_menuitem(\@$menuitem); |
} |
} |
} |
} |
Line 406 sub secondary_menu {
|
Line 446 sub secondary_menu {
|
} |
} |
$menu =~ s/\[uname\]/$$author{user}/g; |
$menu =~ s/\[uname\]/$$author{user}/g; |
$menu =~ s/\[udom\]/$$author{dom}/g; |
$menu =~ s/\[udom\]/$$author{dom}/g; |
|
if ($showsyllabus || $showfeeds) { |
|
$menu =~ s/\[cnum\]/$cnum/g; |
|
$menu =~ s/\[cdom\]/$cdom/g; |
|
} |
if ($menu) { |
if ($menu) { |
$menu = "<ul id=\"LC_secondary_menu\">$menu</ul>"; |
$menu = "<ul id=\"LC_secondary_menu\">$menu</ul>"; |
} |
} |
Line 422 sub create_submenu {
|
Line 466 sub create_submenu {
|
if ($target ne '') { |
if ($target ne '') { |
$disptarget = ' target="'.$target.'"'; |
$disptarget = ' target="'.$target.'"'; |
} |
} |
|
my $name; |
|
if ($title eq 'Personal') { |
|
if ($env{'user.name'} && $env{'user.domain'}) { |
|
$name = &Apache::loncommon::plainname($env{'user.name'},$env{'user.domain'}); |
|
} else { |
|
$name = &mt($title); |
|
} |
|
} else { |
|
$name = &mt($title); |
|
} |
my $menu = '<li class="LC_hoverable">'. |
my $menu = '<li class="LC_hoverable">'. |
'<a href="'.$link.'"'.$disptarget.'>'. |
'<a href="'.$link.'"'.$disptarget.'>'. |
'<span class="LC_nobreak">'.&mt($title). |
'<span class="LC_nobreak">'.$name. |
'<span class="LC_fontsize_small" style="font-weight:normal;">'. |
'<span class="LC_fontsize_small" style="font-weight:normal;">'. |
' ▼</span></span></a>'. |
' ▼</span></span></a>'. |
'<ul>'; |
'<ul>'; |
Line 433 sub create_submenu {
|
Line 487 sub create_submenu {
|
foreach my $item (@{$submenu}) { |
foreach my $item (@{$submenu}) { |
$count ++; |
$count ++; |
if (ref($item) eq 'ARRAY') { |
if (ref($item) eq 'ARRAY') { |
|
my $href = $item->[0]; |
|
if ($href =~ /(aboutme|rss\.html)$/) { |
|
next unless (($env{'user.name'} ne '') && ($env{'user.domain'} ne '')); |
|
$href =~ s/\[domain\]/$env{'user.domain'}/g; |
|
$href =~ s/\[user\]/$env{'user.name'}/g; |
|
} |
my $borderbot; |
my $borderbot; |
if ($count == $numsub) { |
if ($count == $numsub) { |
$borderbot = 'border-bottom:1px solid black;'; |
$borderbot = 'border-bottom:1px solid black;'; |
} |
} |
$menu .= '<li style="margin:0;padding:0;'. |
$menu .= '<li style="margin:0;padding:0;'. |
$borderbot.'"><a href="'.$item->[0].'">'. |
$borderbot.'"><a href="'.$href.'">'. |
&mt($item->[1]).'</a></li>'; |
&mt($item->[1]).'</a></li>'; |
} |
} |
} |
} |
Line 515 sub innerregister {
|
Line 575 sub innerregister {
|
&Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1); |
&Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1); |
} |
} |
return $trail; |
return $trail; |
|
} elsif ($resurl =~ m{^\Q/uploaded$courseurl/portfolio/syllabus/}) { |
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
|
&prepare_functions('/public'.$courseurl."/syllabus", |
|
$forcereg,$group,undef,undef,1); |
|
$title = &mt('Syllabus File'); |
|
my ($trail) = |
|
&Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1); |
|
return $trail; |
} |
} |
unless ($env{'request.state'} eq 'construct') { |
unless ($env{'request.state'} eq 'construct') { |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
Line 847 sub prepare_functions {
|
Line 915 sub prepare_functions {
|
# |
# |
# This applies in course context |
# This applies in course context |
# |
# |
if (($resurl eq "/public/$cdom/$cnum/syllabus") && ($perms{'mdc'})) { |
if (($perms{'mdc'}) && |
if ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ /\w/) { |
(($resurl eq "/public/$cdom/$cnum/syllabus") || |
&switch('','',6,1,'pcstr.png','Edit', |
($resurl =~ m{^/uploaded/$cdom/$cnum/portfolio/syllabus/}))) { |
'resource[_2]', |
$cfile = $resurl; |
"go('/adm/courseprefs?phase=display&actions=courseinfo')", |
$home = &Apache::lonnet::homeserver($cnum,$cdom); |
'Edit this resource'); |
if ($env{'form.forceedit'}) { |
$editbutton = 1; |
$forceview = 1; |
} else { |
} else { |
$cfile = $resurl; |
$forceedit = 1; |
$home = &Apache::lonnet::homeserver($cnum,$cdom); |
|
if ($env{'form.forceedit'}) { |
|
$forceview = 1; |
|
} else { |
|
$forceedit = 1; |
|
} |
|
$editbutton = &get_editbutton($cfile,$home,$switchserver, |
|
$forceedit,$forceview,$forcereg); |
|
} |
} |
|
$editbutton = &get_editbutton($cfile,$home,$switchserver, |
|
$forceedit,$forceview,$forcereg); |
} elsif (($resurl eq '/adm/extresedit') && |
} elsif (($resurl eq '/adm/extresedit') && |
(($env{'form.symb'}) || ($env{'form.folderpath'}))) { |
(($env{'form.symb'}) || ($env{'form.folderpath'}))) { |
($cfile,$home,$switchserver,$forceedit,$forceview) = |
($cfile,$home,$switchserver,$forceedit,$forceview) = |
Line 875 sub prepare_functions {
|
Line 937 sub prepare_functions {
|
$forceedit,$forceview,$forcereg, |
$forceedit,$forceview,$forcereg, |
$env{'form.title'},$env{'form.suppurl'}); |
$env{'form.title'},$env{'form.suppurl'}); |
} |
} |
|
} elsif (($resurl =~ m{^/?adm/viewclasslist$}) && |
|
(&Apache::lonnet::allowed('opa',$env{'request.course.id'}))) { |
|
($cfile,$home,$switchserver,$forceedit,$forceview) = |
|
&Apache::lonnet::can_edit_resource($resurl,$cnum,$cdom,$resurl, |
|
$env{'form.symb'}); |
|
$editbutton = &get_editbutton($cfile,$home,$switchserver, |
|
$forceedit,$forceview,$forcereg); |
} 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'}) { |
Line 898 sub prepare_functions {
|
Line 967 sub prepare_functions {
|
unless (&Apache::lonnet::is_course($sdom,$sname)) { |
unless (&Apache::lonnet::is_course($sdom,$sname)) { |
&switch('','',6,4,'mail-message-new-22x22.png','Message to user', |
&switch('','',6,4,'mail-message-new-22x22.png','Message to user', |
'', |
'', |
"go('/adm/email?compose=individual&recname=$sname&recdom=$sdom')", |
"go('/adm/email?compose=individual&recname=$sname&recdom=$sdom')", |
'Send message to specific user'); |
'Send message to specific user'); |
} |
} |
my $hideprivileged = 1; |
my $hideprivileged = 1; |
Line 920 sub prepare_functions {
|
Line 989 sub prepare_functions {
|
if ($perms{'vgr'}) { |
if ($perms{'vgr'}) { |
&switch('','',6,6,'rsrv-22x22.png','Reservations', |
&switch('','',6,6,'rsrv-22x22.png','Reservations', |
'', |
'', |
"go('/adm/slotrequest?command=showresv&origin=aboutme&uname=$sname&udom=$sdom')", |
"go('/adm/slotrequest?command=showresv&origin=aboutme&uname=$sname&udom=$sdom')", |
'Slot reservation history'); |
'Slot reservation history'); |
} |
} |
if ($perms{'srm'}) { |
if ($perms{'srm'}) { |
&switch('','',6,7,'contact-new-22x22.png','Records', |
&switch('','',6,7,'contact-new-22x22.png','Records', |
'', |
'', |
"go('/adm/email?recordftf=retrieve&recname=$sname&recdom=$sdom')", |
"go('/adm/email?recordftf=retrieve&recname=$sname&recdom=$sdom')", |
'Add records'); |
'Add records'); |
} |
} |
} |
} |
} elsif ($resurl =~ m{^/?adm/viewclasslist}) { |
|
# This applies to viewclasslist page for users in a course |
|
if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) { |
|
&switch('','',6,4,'pparm.png','Settings', |
|
'', |
|
"go('/adm/courseprefs?actions=classlists&phase=display')", |
|
'Student-viewable classlist options'); |
|
} |
|
} |
} |
if (($env{'form.folderpath'} =~ /^supplemental/) && |
if (($env{'form.folderpath'} =~ /^supplemental/) && |
(&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) && |
(&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) && |
Line 950 sub prepare_functions {
|
Line 1011 sub prepare_functions {
|
if ((@folders > 2) || ($resurl ne '/adm/supplemental')) { |
if ((@folders > 2) || ($resurl ne '/adm/supplemental')) { |
my $esc_path=&escape(&HTML::Entities::encode(&escape($env{'form.folderpath'}),'<>&"')); |
my $esc_path=&escape(&HTML::Entities::encode(&escape($env{'form.folderpath'}),'<>&"')); |
&switch('','',7,4,'docs-22x22.png','Edit Folder','parms[_2]', |
&switch('','',7,4,'docs-22x22.png','Edit Folder','parms[_2]', |
"location.href='/adm/coursedocs?command=direct&forcesupplement=1&supppath=$esc_path'", |
"location.href='/adm/coursedocs?command=direct&forcesupplement=1&supppath=$esc_path'", |
'Folder/Page Content'); |
'Folder/Page Content'); |
} |
} |
} |
} |
Line 991 sub advtools_crumbs {
|
Line 1052 sub advtools_crumbs {
|
'advtools', @funcs[61,71,72,73,74,92]); |
'advtools', @funcs[61,71,72,73,74,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[64]); |
'advtools', $funcs[61]); |
} |
} |
|
return; |
} |
} |
|
|
# ================================================================== Raw Config |
# ================================================================== Raw Config |
Line 1674 sub roles_selector {
|
Line 1736 sub roles_selector {
|
} |
} |
} |
} |
} |
} |
if ($crstype eq 'Community') { |
$switchtext = &mt('Switch role'); |
$switchtext = &mt('Switch community role') |
|
} else { |
|
$switchtext = &mt('Switch course role') |
|
} |
|
my @roles_order = ($ccrole,'in','ta','ep','ad','st'); |
my @roles_order = ($ccrole,'in','ta','ep','ad','st'); |
my $numdiffsec; |
my $numdiffsec; |
if (keys(%seccount) == 1) { |
if (keys(%seccount) == 1) { |
Line 1800 sub get_all_courseroles {
|
Line 1858 sub get_all_courseroles {
|
push(@{$courseroles->{'st'}},keys(%sections_count)); |
push(@{$courseroles->{'st'}},keys(%sections_count)); |
$seccount->{'st'} = scalar(keys(%sections_count)); |
$seccount->{'st'} = scalar(keys(%sections_count)); |
} |
} |
|
$seccount->{'st'} ++; # Increment for a section-less student role. |
my $rolehash = { |
my $rolehash = { |
'roles' => $courseroles, |
'roles' => $courseroles, |
'seccount' => $seccount, |
'seccount' => $seccount, |
Line 2004 sub countdown_timer {
|
Line 2063 sub countdown_timer {
|
} |
} |
my $duedate = &Apache::lonnet::EXT("resource.0.duedate"); |
my $duedate = &Apache::lonnet::EXT("resource.0.duedate"); |
my @interval=&Apache::lonnet::EXT("resource.0.interval"); |
my @interval=&Apache::lonnet::EXT("resource.0.interval"); |
my $hastimeleft; |
|
if (@interval > 1) { |
if (@interval > 1) { |
my $first_access=&Apache::lonnet::get_first_access($interval[1]); |
my $first_access=&Apache::lonnet::get_first_access($interval[1]); |
if ($first_access > 0) { |
if ($first_access > 0) { |
Line 2062 BEGIN {
|
Line 2120 BEGIN {
|
$category_positions{$entries[2]}=$entries[1]; |
$category_positions{$entries[2]}=$entries[1]; |
$category_names{$entries[2]}=$entries[3]; |
$category_names{$entries[2]}=$entries[3]; |
} elsif ($configline=~/^prim\:/) { |
} elsif ($configline=~/^prim\:/) { |
my @entries = (split(/\:/, $configline))[1..5]; |
my @entries = (split(/\:/, $configline))[1..6]; |
push(@primary_menu,\@entries); |
push(@primary_menu,\@entries); |
} elsif ($configline=~/^primsub\:/) { |
} elsif ($configline=~/^primsub\:/) { |
my ($parent,@entries) = (split(/\:/, $configline))[1..4]; |
my ($parent,@entries) = (split(/\:/, $configline))[1..4]; |