version 1.285, 2009/10/13 13:18:25
|
version 1.293, 2009/10/20 01:57:42
|
Line 113 The javascript is usually similar to "go
|
Line 113 The javascript is usually similar to "go
|
|
|
=item get_nav_status() |
=item get_nav_status() |
|
|
=item convert_menu_function() |
|
|
|
FIXME this needs to move into mydesktab and the other locations |
|
the text is generated |
|
|
|
=item hidden_button_check() |
=item hidden_button_check() |
|
|
=item roles_selector() |
=item roles_selector() |
Line 142 use HTML::Entities();
|
Line 137 use HTML::Entities();
|
use vars qw(@desklines %category_names %category_members %category_positions |
use vars qw(@desklines %category_names %category_members %category_positions |
$readdesk @primary_menu @secondary_menu); |
$readdesk @primary_menu @secondary_menu); |
|
|
|
|
my @inlineremote; |
my @inlineremote; |
|
|
sub prep_menuitem { |
sub prep_menuitem { |
my $menuitem = shift; |
my ($menuitem) = @_; |
return '' unless ref $menuitem eq 'ARRAY'; |
return '' unless(ref($menuitem) eq 'ARRAY'); |
my $link; |
my $link; |
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]) . "\"" |
. " alt=\"" . mt($$menuitem[2]) . "\" />"; |
. " alt=\"" . &mt($$menuitem[2]) . "\" />"; |
} else { # textual Link |
} else { # textual Link |
$link = mt($$menuitem[3]); |
$link = &mt($$menuitem[3]); |
} |
} |
return "<li><a href=\"javascript:$$menuitem[0]\">$link</a></li>"; |
return '<li><a href="'.$$menuitem[0].'">'.$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 171 sub primary_menu {
|
Line 165 sub primary_menu {
|
foreach my $menuitem (@primary_menu) { |
foreach my $menuitem (@primary_menu) { |
# evaluate conditions |
# evaluate conditions |
next if $$menuitem[4] eq 'nonewmsg' # show links depending on |
next if $$menuitem[4] eq 'nonewmsg' # show links depending on |
&& Apache::lonmsg::mynewmail(); # whether a new msg |
&& &Apache::lonmsg::mynewmail(); # whether a new msg |
next if $$menuitem[4] eq 'newmsg' # arrived or not |
next if $$menuitem[4] eq 'newmsg' # arrived or not |
&& !Apache::lonmsg::mynewmail(); # |
&& !&Apache::lonmsg::mynewmail(); # |
next if $$menuitem[4] !~ /public/ ##we've a public user, |
next if $$menuitem[4] !~ /public/ ##we've a public user, |
&& $env{'user.name'} eq 'public' ##who should not see all |
&& $env{'user.name'} eq 'public' ##who should not see all |
&& $env{'user.domain'} eq 'public'; ##links |
&& $env{'user.domain'} eq 'public'; ##links |
Line 181 sub primary_menu {
|
Line 175 sub primary_menu {
|
&& $env{'user.name'} ne 'public' # only visible to public |
&& $env{'user.name'} ne 'public' # only visible to public |
&& $env{'user.domain'} ne 'public'; # users |
&& $env{'user.domain'} ne 'public'; # users |
next if $$menuitem[4] eq 'roles' ##show links depending on |
next if $$menuitem[4] eq 'roles' ##show links depending on |
&& Apache::loncommon::show_course(); ##term 'Courses' or |
&& &Apache::loncommon::show_course(); ##term 'Courses' or |
next if $$menuitem[4] eq 'courses' ##'Roles' wanted |
next if $$menuitem[4] eq 'courses' ##'Roles' wanted |
&& !Apache::loncommon::show_course(); ## |
&& !&Apache::loncommon::show_course(); ## |
|
|
|
|
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 { |
$menu .= prep_menuitem(\@$menuitem); |
if (ref($menuitem) eq 'ARRAY') { |
|
my @items = @{$menuitem}; |
|
$items[0] = 'javascript:'.$menuitem->[0].';'; |
|
$menu .= &prep_menuitem(\@items); |
|
} |
} |
} |
} |
} |
|
|
return "<ol class=\"LC_primary_menu LC_right\">$menu</ol>"; |
return "<ol class=\"LC_primary_menu LC_right\">$menu</ol>"; |
} |
} |
|
|
|
|
sub secondary_menu { |
sub secondary_menu { |
my $menu; |
my $menu; |
|
|
|
my $crstype = &Apache::loncommon::course_type(); |
|
my $canedit = &Apache::lonnet::allowed('mdc', $env{'request.course.id'}); |
|
my $canviewgrps = &Apache::lonnet::allowed('vcg', $env{'request.course.id'} |
|
. ($env{'request.course.sec'} ? "/$env{'request.course.sec'}" |
|
: '')); |
|
my $showlink = &show_return_link(); |
|
my %groups = &Apache::lonnet::get_active_groups( |
|
$env{'user.domain'}, $env{'user.name'}, |
|
$env{'course.' . $env{'request.course.id'} . '.domain'}, |
|
$env{'course.' . $env{'request.course.id'} . '.num'}); |
foreach my $menuitem (@secondary_menu) { |
foreach my $menuitem (@secondary_menu) { |
# evaluate conditions |
# evaluate conditions |
next if $$menuitem[4] ne 'always' |
next if $$menuitem[4] ne 'always' |
&& !$env{'request.course.id'}; |
&& !$env{'request.course.id'}; |
next if $$menuitem[4] eq 'showreturn' |
next if $$menuitem[4] eq 'showreturn' |
&& !show_return_link() |
&& !$showlink |
&& !($env{'request.state'} eq 'construct'); |
&& !($env{'request.state'} eq 'construct'); |
next if $$menuitem[4] =~ /^mdc/ |
next if $$menuitem[4] =~ /^mdc/ |
&& !Apache::lonnet::allowed('mdc', $env{'request.course.id'}); |
&& !$canedit; |
next if $$menuitem[4] =~ /nogrp$/ |
next if $$menuitem[4] eq 'mdcCourse' |
&& Apache::loncommon::course_type() eq 'Group'; |
&& $crstype eq 'Community'; |
next if $$menuitem[4] =~ /group$/ |
next if $$menuitem[4] eq 'mdcCommunity' |
&& Apache::loncommon::course_type() ne 'Group'; |
&& $crstype ne 'Community'; |
next if $$menuitem[4] eq 'remotenav' |
next if $$menuitem[4] =~ /^remotenav/ |
&& $env{'environment.remotenavmap'} ne 'on'; |
&& $env{'environment.remotenavmap'} ne 'on'; |
next if $$menuitem[4] eq 'noremotenav' |
next if $$menuitem[4] =~ /noremotenav/ |
&& $env{'environment.remotenavmap'} eq 'on'; |
&& $env{'environment.remotenavmap'} eq 'on'; |
next if $$menuitem[4] =~ /showgroups$/ |
next if $$menuitem[4] =~ /showgroups$/ |
&& !Apache::lonnet::allowed('vcg', $env{'request.course.id'} |
&& $canviewgrps |
. ($env{'request.course.sec'} ? "/$env{'request.course.sec'}" |
&& !%groups; |
: '')) |
|
&& !Apache::lonnet::get_active_groups( |
|
$env{'user.domain'}, $env{'user.name'}, |
|
$env{'course.' . $env{'request.course.id'} . '.domain'}, |
|
$env{'course.' . $env{'request.course.id'} . '.num'}); |
|
|
|
|
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 |
my $roles_selector = roles_selector( |
my $roles_selector = roles_selector( |
$env{'course.' . $env{'request.course.id'} . '.domain'}, |
$env{'course.' . $env{'request.course.id'} . '.domain'}, |
Line 236 sub secondary_menu {
|
Line 238 sub secondary_menu {
|
$menu .= $roles_selector ? "<li>$roles_selector</li>" |
$menu .= $roles_selector ? "<li>$roles_selector</li>" |
: ''; |
: ''; |
} else { |
} else { |
$menu .= prep_menuitem(\@$menuitem); |
if ($env{'environment.remotenavmap'} eq 'on') { |
|
my @items = @{$menuitem}; |
|
if ($menuitem->[4] eq 'remotenav') { |
|
$items[0] = "javascript:gonav('$menuitem->[0]');"; |
|
} else { |
|
$items[0] = "javascript:go('$menuitem->[0]');"; |
|
} |
|
$menu .= &prep_menuitem(\@items); |
|
} else { |
|
$menu .= &prep_menuitem(\@$menuitem); |
|
} |
} |
} |
} |
} |
if ($menu =~ /\[url\].*\[symb\]/) { |
if ($menu =~ /\[url\].*\[symb\]/) { |
my $escurl = escape( Apache::lonenc::check_encrypt( |
my $escurl = &escape( &Apache::lonenc::check_encrypt( |
$env{'request.noversionuri'})); |
$env{'request.noversionuri'})); |
|
|
my $escsymb = escape( Apache::lonenc::check_encrypt( |
my $escsymb = &escape( &Apache::lonenc::check_encrypt( |
$env{'request.symb'})); |
$env{'request.symb'})); |
|
|
if ( $env{'request.state'} eq 'construct' |
if ( $env{'request.state'} eq 'construct' |
and ( $env{'request.noversionuri'} eq '' |
and ( $env{'request.noversionuri'} eq '' |
Line 253 sub secondary_menu {
|
Line 265 sub secondary_menu {
|
($escurl = $env{'request.filename'}) =~ |
($escurl = $env{'request.filename'}) =~ |
s{^/home/([^/]+)/public_html/(.*)$}{/priv/$1/$2}; |
s{^/home/([^/]+)/public_html/(.*)$}{/priv/$1/$2}; |
|
|
$escurl = escape($escurl); |
$escurl = &escape($escurl); |
} |
} |
$menu =~ s/\[url\]/$escurl/g; |
$menu =~ s/\[url\]/$escurl/g; |
$menu =~ s/\[symb\]/$escsymb/g; |
$menu =~ s/\[symb\]/$escsymb/g; |
Line 280 sub initlittle {
|
Line 292 sub initlittle {
|
'login' => 'Log In', |
'login' => 'Log In', |
'launch' => 'Launch Remote Control', |
'launch' => 'Launch Remote Control', |
'groups' => 'Groups', |
'groups' => 'Groups', |
'gdoc' => 'Group Documents', |
'gdoc' => 'Community Documents', |
); |
); |
} |
} |
|
|
Line 355 sub menubuttons {
|
Line 367 sub menubuttons {
|
my %lt=&initlittle(); |
my %lt=&initlittle(); |
|
|
my $domain=&Apache::loncommon::determinedomain(); |
my $domain=&Apache::loncommon::determinedomain(); |
my $function =&Apache::loncommon::get_users_function(); |
my $function=&Apache::loncommon::get_users_function(); |
my $link=&Apache::loncommon::designparm($function.'.link',$domain); |
my $link=&Apache::loncommon::designparm($function.'.link',$domain); |
my $alink=&Apache::loncommon::designparm($function.'.alink',$domain); |
my $alink=&Apache::loncommon::designparm($function.'.alink',$domain); |
my $vlink=&Apache::loncommon::designparm($function.'.vlink',$domain); |
my $vlink=&Apache::loncommon::designparm($function.'.vlink',$domain); |
Line 381 ENDINLINEMENU
|
Line 393 ENDINLINEMENU
|
$navmaps=(<<ENDNAV); |
$navmaps=(<<ENDNAV); |
<li><a href="$link" target="_top">$lt{'nav'}</a></li> |
<li><a href="$link" target="_top">$lt{'nav'}</a></li> |
ENDNAV |
ENDNAV |
my $is_group = (&Apache::loncommon::course_type() eq 'Group'); |
my $is_community = |
|
(&Apache::loncommon::course_type() eq 'Community'); |
if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) { |
if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) { |
my $text = ($is_group) ? $lt{'gdoc'} : $lt{'docs'}; |
my $text = ($is_community) ? $lt{'gdoc'} : $lt{'docs'}; |
$docs=(<<ENDDOCS); |
$docs=(<<ENDDOCS); |
<li><a href="/adm/coursedocs" target="_top">$text</a></li> |
<li><a href="/adm/coursedocs" target="_top">$text</a></li> |
ENDDOCS |
ENDDOCS |
Line 415 ENDCRELOAD
|
Line 428 ENDCRELOAD
|
my $utility = &utilityfunctions(); |
my $utility = &utilityfunctions(); |
|
|
#Prepare the message link that indicates the arrival of new mail |
#Prepare the message link that indicates the arrival of new mail |
my $messagelink = Apache::lonmsg::mynewmail() ? "Message (new)" : "Message"; |
my $messagelink = &Apache::lonmsg::mynewmail() ? "Message (new)" : "Message"; |
$messagelink = '<a href="javascript:go(\'/adm/communicate\');">' |
$messagelink = '<a href="javascript:go(\'/adm/communicate\');">' |
. mt($messagelink) .'</a>'; |
. mt($messagelink) .'</a>'; |
|
|
Line 519 sub innerregister {
|
Line 532 sub innerregister {
|
$newmail= 'swmenu.setstatus("you have","messages");'; |
$newmail= 'swmenu.setstatus("you have","messages");'; |
} |
} |
|
|
my $breadcrumb; |
my ($breadcrumb,$separator); |
if ($noremote |
if ($noremote |
&& ($env{'request.symb'}) |
&& ($env{'request.symb'}) |
&& ($env{'request.course.id'})) { |
&& ($env{'request.course.id'})) { |
Line 529 sub innerregister {
|
Line 542 sub innerregister {
|
|
|
my $maptitle = &Apache::lonnet::gettitle($mapurl); |
my $maptitle = &Apache::lonnet::gettitle($mapurl); |
my $restitle = &Apache::lonnet::gettitle(&Apache::lonnet::symbread()); |
my $restitle = &Apache::lonnet::gettitle(&Apache::lonnet::symbread()); |
my @crumbs = ({text => "Course Content", |
my @crumbs = ({text => "Course Contents", |
href => "Javascript:gonav('/adm/navmaps')"}, |
href => "Javascript:gonav('/adm/navmaps')"}); |
{text => '...', |
|
no_mt => 1}); |
if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) { |
|
push(@crumbs, {text => '...', |
|
no_mt => 1}); |
|
} |
|
|
push @crumbs, {text => $maptitle, no_mt => 1} if ($maptitle |
push @crumbs, {text => $maptitle, no_mt => 1} if ($maptitle |
&& $maptitle ne 'default.sequence' |
&& $maptitle ne 'default.sequence' |
Line 540 sub innerregister {
|
Line 556 sub innerregister {
|
|
|
push @crumbs, {text => $restitle, no_mt => 1} if $restitle; |
push @crumbs, {text => $restitle, no_mt => 1} if $restitle; |
|
|
Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
Apache::lonhtmlcommon::add_breadcrumb(@crumbs); |
&Apache::lonhtmlcommon::add_breadcrumb(@crumbs); |
$breadcrumb .= Apache::lonhtmlcommon::breadcrumbs(undef,undef,0); |
$breadcrumb .= &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0); |
|
unless (($env{'request.state'} eq 'edit') || ($newmail) || |
|
($env{'request.state'} eq 'construct') || |
|
($env{'form.register'})) { |
|
$separator = &Apache::loncommon::head_subbox(); |
|
} |
# |
# |
} |
} |
if ($env{'request.state'} eq 'construct') { |
if ($env{'request.state'} eq 'construct') { |
Line 831 $tablestart
|
Line 852 $tablestart
|
$inlinebuttons |
$inlinebuttons |
$tableend |
$tableend |
$newmail |
$newmail |
|
$separator |
<script type="text/javascript"> |
<script type="text/javascript"> |
// END LON-CAPA Internal |
// END LON-CAPA Internal |
</script> |
</script> |
Line 1317 sub rawconfig {
|
Line 1339 sub rawconfig {
|
$prt=~s/\$requested_domain/$requested_domain/g; |
$prt=~s/\$requested_domain/$requested_domain/g; |
if ($category_names{$cat}!~/\w/) { $cat='oth'; } |
if ($category_names{$cat}!~/\w/) { $cat='oth'; } |
my $type = &Apache::loncommon::course_type(); |
my $type = &Apache::loncommon::course_type(); |
# |
|
# I don't think we support this |
|
# |
|
# if ($type eq 'Group') { |
|
# $desc = &convert_menu_function($desc,$type); |
|
# } |
|
if ($pro eq 'clear') { |
if ($pro eq 'clear') { |
$output.=&clear($row,$col); |
$output.=&clear($row,$col); |
} elsif ($pro eq 'any') { |
} elsif ($pro eq 'any') { |
Line 1503 sub utilityfunctions {
|
Line 1519 sub utilityfunctions {
|
return ''; } |
return ''; } |
|
|
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])); |
|
if ($currenturl =~ m{^/adm/wrapper/ext/}) { |
|
if ($env{'request.external.querystring'}) { |
|
$currenturl .= ($currenturl=~/\?/)?'&':'?'.$env{'request.external.querystring'}; |
|
} |
|
} |
$currenturl=&Apache::lonenc::check_encrypt(&unescape($currenturl)); |
$currenturl=&Apache::lonenc::check_encrypt(&unescape($currenturl)); |
|
|
my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'}); |
my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'}); |
Line 1620 function catalog_info() {
|
Line 1641 function catalog_info() {
|
} |
} |
|
|
function chat_win() { |
function chat_win() { |
lonchat=window.open('/res/adm/pages/chatroom.html',"LONchat",'height=320,width=280,resizable=yes,location=no,menubar=no,toolbar=no'); |
lonchat=window.open('/res/adm/pages/chatroom.html',"LONchat",'height=320,width=480,resizable=yes,location=no,menubar=no,toolbar=no'); |
} |
} |
|
|
function group_chat(group) { |
function group_chat(group) { |
Line 1714 sub get_nav_status {
|
Line 1735 sub get_nav_status {
|
return $navstatus; |
return $navstatus; |
} |
} |
|
|
#FIXME this needs to move into mydesk.tab and the other locations |
|
# the text is generated |
|
# |
|
# We currently do not support this anyway. |
|
# |
|
#sub convert_menu_function { |
|
# my ($rolename,$type) = @_; |
|
# if ($type eq 'Group') { |
|
# $rolename =~ s/student/member/g; |
|
# $rolename =~ s/group/team/g; |
|
# $rolename =~ s/course/group/g; |
|
# $rolename =~ s/Course/Group/g; |
|
# } |
|
# return $rolename; |
|
#} |
|
|
|
sub hidden_button_check { |
sub hidden_button_check { |
my $hidden; |
my $hidden; |
if ($env{'request.course.id'} eq '') { |
if ($env{'request.course.id'} eq '') { |
Line 1744 sub hidden_button_check {
|
Line 1749 sub hidden_button_check {
|
|
|
sub roles_selector { |
sub roles_selector { |
my ($cdom,$cnum) = @_; |
my ($cdom,$cnum) = @_; |
|
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
|
if ($crstype eq '') { |
|
$crstype = 'Course'; |
|
} |
my $now = time; |
my $now = time; |
my (%courseroles,%seccount); |
my (%courseroles,%seccount); |
my $is_cc; |
my $is_cc; |
Line 1793 sub roles_selector {
|
Line 1802 sub roles_selector {
|
} |
} |
} |
} |
} |
} |
|
my $switchtext; |
|
if ($crstype eq 'Community') { |
|
$switchtext = &mt('Switch community role to...') |
|
} else { |
|
$switchtext = &mt('Switch course role to...') |
|
} |
my @roles_order = ('cc','in','ta','ep','ad','st'); |
my @roles_order = ('cc','in','ta','ep','ad','st'); |
if (keys(%courseroles) > 1) { |
if (keys(%courseroles) > 1) { |
$role_selector = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles); |
$role_selector = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles); |
$role_selector .= '<form name="rolechooser" method="post" action="/adm/roles"> |
$role_selector .= '<form name="rolechooser" method="post" action="/adm/roles"> |
<select name="switchrole" onchange="javascript:adhocRole('."'switchrole'".')">'; |
<select name="switchrole" onchange="javascript:adhocRole('."'switchrole'".')">'; |
$role_selector .= '<option value="">'.&mt('Switch course role to...').'</option>'; |
$role_selector .= '<option value="">'.$switchtext.'</option>'; |
foreach my $role (@roles_order) { |
foreach my $role (@roles_order) { |
if (defined($courseroles{$role})) { |
if (defined($courseroles{$role})) { |
$role_selector .= "\n".'<option value="'.$role.'">'.&Apache::lonnet::plaintext($role).'</option>'; |
$role_selector .= "\n".'<option value="'.$role.'">'.&Apache::lonnet::plaintext($role).'</option>'; |