version 1.301, 2009/11/10 13:58:55
|
version 1.309.2.1, 2009/12/07 20:04:18
|
Line 160 sub prep_menuitem {
|
Line 160 sub prep_menuitem {
|
# entries from mydesk.tab |
# entries from mydesk.tab |
sub primary_menu { |
sub primary_menu { |
my $menu; |
my $menu; |
|
my $custommenu = &Apache::loncommon::needs_gci_custom(); |
# 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) |
foreach my $menuitem (@primary_menu) { |
foreach my $menuitem (@primary_menu) { |
Line 175 sub primary_menu {
|
Line 176 sub primary_menu {
|
next if $$menuitem[4] eq 'onlypublic'# hide links which are |
next if $$menuitem[4] eq 'onlypublic'# hide links which are |
&& $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' # hide links which are |
|
&& $custommenu; # not visible when GCI |
|
next if $$menuitem[4] eq 'courses' # tabbed interface in use |
|
&& $custommenu; # |
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 |
Line 277 sub secondary_menu {
|
Line 282 sub secondary_menu {
|
return "<ul id=\"LC_secondary_menu\">$menu</ul>"; |
return "<ul id=\"LC_secondary_menu\">$menu</ul>"; |
} |
} |
|
|
|
sub gci_secondary_menu { |
|
my %courses = ( |
|
'review' => 'gci_9615072b469884921gcil1', |
|
'submit' => 'gci_1H96711d710194bfegcil1', |
|
); |
|
my %linktext = ( |
|
'review' => 'Review Questions', |
|
'submit' => 'Submit Questions', |
|
'createtest' => 'Create a Test', |
|
); |
|
my (%links,$current); |
|
foreach my $key (keys(%courses)) { |
|
$links{$key} = "javascript:switchpage('$key');"; |
|
if ($env{'request.course.id'} eq $courses{$key}) { |
|
$links{$key} = '/adm/navmaps'; |
|
$current = $key; |
|
} |
|
} |
|
$links{'createtest'} = "javascript:switchpage('createtest');"; |
|
if (($ENV{'REQUEST_URI'} eq '/adm/requestcourse') || |
|
($env{'form.orgurl'} eq '/adm/requestcourse')) { |
|
$current = 'createtest'; |
|
} |
|
my @menutabs = ('review','submit','createtest'); |
|
if ($env{'user.adv'}) { |
|
my $key = 'managetest'; |
|
push(@menutabs,$key); |
|
$linktext{$key} = 'Manage Tests'; |
|
$links{$key} = "javascript:switchpage('$key');"; |
|
if (($current eq '') && (($ENV{'REQUEST_URI'} eq '/adm/menu') || |
|
($env{'form.orgurl'} eq '/adm/menu'))) { |
|
$current = $key; |
|
} |
|
} |
|
my $tabs; |
|
foreach my $item (@menutabs) { |
|
if ($item eq $current) { |
|
$tabs .= ' <li id="current"><a href="'.$links{$item}.'">'. |
|
$linktext{$item}.'</a></li>'; |
|
} else { |
|
$tabs .= ' <li><a href="'.$links{$item}.'">'. |
|
$linktext{$item}.'</a></li>'; |
|
} |
|
} |
|
return '<div id="gciheader">'. |
|
'<ul>'.$tabs.'</ul></div><br />'; |
|
} |
|
|
# |
# |
# This routine returns a translated hash for the menu items in the top inline menu row |
# This routine returns a translated hash for the menu items in the top inline menu row |
Line 512 sub registerurl {
|
Line 564 sub registerurl {
|
} |
} |
|
|
sub innerregister { |
sub innerregister { |
my ($forcereg, $titletable) = @_; |
my ($forcereg,$titletable,$bread_crumbs) = @_; |
my $result = ''; |
my $result = ''; |
my ($uname,$thisdisfn); |
my ($uname,$thisdisfn); |
my $const_space = ($env{'request.state'} eq 'construct'); |
my $const_space = ($env{'request.state'} eq 'construct'); |
Line 689 sub innerregister {
|
Line 741 sub innerregister {
|
} |
} |
# Finally, turn the button on or off |
# Finally, turn the button on or off |
if ($cfile && !$const_space) { |
if ($cfile && !$const_space) { |
$editbutton=&switch |
my $nocrsedit; |
('','',6,1,'pcstr.gif','edit[_1]','resource[_2]', |
# Suppress display where CC has switched to student role. |
|
if ($env{'request.course.id'}) { |
|
unless(&Apache::lonnet::allowed('mdc', |
|
$env{'request.course.id'})) { |
|
$nocrsedit = 1; |
|
} |
|
} |
|
if ($nocrsedit) { |
|
$editbutton=&clear(6,1); |
|
} else { |
|
$editbutton=&switch |
|
('','',6,1,'pcstr.gif','edit[_1]','resource[_2]', |
"go('".$cfile."');","Edit this resource"); |
"go('".$cfile."');","Edit this resource"); |
$noeditbutton = 0; |
$noeditbutton = 0; |
|
} |
} elsif ($editbutton eq '') { |
} elsif ($editbutton eq '') { |
$editbutton=&clear(6,1); |
$editbutton=&clear(6,1); |
} |
} |
Line 741 s&7&1&del.gif&delete[_1]&resource[_2]&go
|
Line 805 s&7&1&del.gif&delete[_1]&resource[_2]&go
|
s&7&2&prt.gif&prepare[_1]&printout[_1]&gocstr('/adm/printout','/~$uname/$cleandisfn')&Prepare a printable document |
s&7&2&prt.gif&prepare[_1]&printout[_1]&gocstr('/adm/printout','/~$uname/$cleandisfn')&Prepare a printable document |
ENDMENUITEMS |
ENDMENUITEMS |
} |
} |
|
if ($noremote) { |
|
if (ref($bread_crumbs) eq 'ARRAY') { |
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
|
foreach my $crumb (@{$bread_crumbs}){ |
|
&Apache::lonhtmlcommon::add_breadcrumb($crumb); |
|
} |
|
} |
|
} |
} elsif ( defined($env{'request.course.id'}) && |
} elsif ( defined($env{'request.course.id'}) && |
$env{'request.symb'} ne '' ) { |
$env{'request.symb'} ne '' ) { |
# |
# |
Line 820 ENDMENUITEMS
|
Line 892 ENDMENUITEMS
|
if ($addremote) { |
if ($addremote) { |
|
|
#SD START (work in progress!) |
#SD START (work in progress!) |
|
Apache::lonhtmlcommon::clear_breadcrumb_tools(); |
# Arrows for navigation |
# Arrows for navigation |
Apache::lonhtmlcommon::add_breadcrumb_tool( 'A', $inlineremote[21] ); |
Apache::lonhtmlcommon::add_breadcrumb_tool( 'A', $inlineremote[21] ); |
Apache::lonhtmlcommon::add_breadcrumb_tool( 'A', $inlineremote[23] ); |
Apache::lonhtmlcommon::add_breadcrumb_tool( 'A', $inlineremote[23] ); |
Line 893 ENDMENUITEMS
|
Line 966 ENDMENUITEMS
|
</script> |
</script> |
$timesync |
$timesync |
$breadcrumb |
$breadcrumb |
<!--$tablestart--!> |
<!-- $tablestart --> |
<!--$inlinebuttons--!> |
<!-- $inlinebuttons --> |
<!--$tableend --!> |
<!-- $tableend --> |
$newmail |
$newmail |
<!--$separator--!> |
<!-- $separator --> |
<script type="text/javascript"> |
<script type="text/javascript"> |
// END LON-CAPA Internal |
// END LON-CAPA Internal |
</script> |
</script> |
Line 1255 sub switch {
|
Line 1328 sub switch {
|
my $pic= |
my $pic= |
'<img alt="'.$text.'" src="'. |
'<img alt="'.$text.'" src="'. |
&Apache::loncommon::lonhttpdurl('/res/adm/pages/'.$img). |
&Apache::loncommon::lonhttpdurl('/res/adm/pages/'.$img). |
'" align="'.($nobreak==3?'right':'left').'" class="LC_noBorder" />'; |
'" align="'.($nobreak==3?'right':'left').'" class="LC_icon" />'; |
if ($env{'browser.interface'} eq 'faketextual') { |
if ($env{'browser.interface'} eq 'faketextual') { |
# Main Menu |
# Main Menu |
if ($nobreak==3) { |
if ($nobreak==3) { |
Line 1311 sub openmenu {
|
Line 1384 sub openmenu {
|
} |
} |
|
|
sub inlinemenu { |
sub inlinemenu { |
|
my ($context,$switcher) = @_; |
undef(@inlineremote); |
undef(@inlineremote); |
undef(%category_members); |
undef(%category_members); |
# calling rawconfig with "1" will evaluate mydesk.tab, even if there is no active remote control |
my $output; |
&rawconfig(1); |
if ($context eq 'gcicustom') { |
my $output='<table id="LC_mainmenu"><tr>'; |
$output.='<div class="LC_left_float">'. |
for (my $col=1; $col<=2; $col++) { |
'<fieldset id="LC_mainmenu_fieldset">'. |
$output.='<td class="LC_mainmenu_col_fieldset">'; |
'<legend class="LC_mainmenu_fieldset_category">'.&mt('Utilities').'</legend>'. |
for (my $row=1; $row<=8; $row++) { |
'<table id="LC_menubuttons_mainmenu">'; |
foreach my $cat (keys(%category_members)) { |
if ($switcher) { |
if ($category_positions{$cat} ne "$col,$row") { next; } |
$output .= '<tr><td class="LC_menubuttons_img" align="left"><a href="javascript:courseswitcher('."'icon'".');"><img alt="choose role" src="/res/adm/pages/roles.png" align="left" /></a></td><td class="LC_menubuttons_text" colspan="3"><span class="LC_menubuttons_inline_text">'.$switcher.'</span></td></tr>'; |
#$output.='<table><tr><td colspan="4" class="LC_menubuttons_category">'.&mt($category_names{$cat}).'</td></tr>'; |
} |
$output.='<div class="LC_Box">'; |
$output .= '<tr><td class="LC_menubuttons_img" align="left"><a href="javascript:go('."'/adm/communicate'".');"><img alt="communication" src="/res/adm/pages/com.png" align="left" /></a></td><td class="LC_menubuttons_text" colspan="3"><a class="LC_menubuttons_link" href="javascript:go('."'/adm/communicate'".');"><span class="LC_menubuttons_inline_text">'.&mt('Send and display messages').'</span></a></td></tr></table></fieldset></div>'; |
$output.='<h4 class="LC_hcell">'.&mt($category_names{$cat}).'</h4>'; |
if (($env{'request.course.id'}) && |
$output.='<table>'; |
(&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) { |
my %active=(); |
$output.= '<div class="LC_left_float">'. |
foreach my $menu_item (split(/\:/,$category_members{$cat})) { |
'<fieldset id="LC_mainmenu_fieldset">'. |
if ($inlineremote[$menu_item]) { |
'<legend class="LC_mainmenu_fieldset_category">'.&mt('Test Management').'</legend>'. |
$active{$menu_item}=1; |
'<table id="LC_menubuttons_mainmenu">'. |
} |
'<tr><td class="LC_menubuttons_img" align="left"><a href="javascript:go('."'/adm/createuser'".');"><img alt="user privs" src="/res/adm/pages/cprv.png" align="left" /></a></td><td class="LC_menubuttons_text" colspan="3"><a class="LC_menubuttons_link" href="javascript:go('."'/adm/createuser'".');"><span class="LC_menubuttons_inline_text">'.&mt('Manage Enrollment').'</span></a></td></tr>'."\n". |
} |
'<tr><td class="LC_menubuttons_img" align="left"><a href="javascript:go('."'/adm/whatsnew'".');"><img alt="what is new" src="/res/adm/pages/new.png" align="left" /></a></td><td class="LC_menubuttons_text" colspan="3"><a class="LC_menubuttons_link" href="javascript:go('."'/adm/whatsnew'".');"><span class="LC_menubuttons_inline_text">'.&mt("What's New?").'</span></a></td></tr></table></fieldset></div>'; |
foreach my $item (sort(keys(%active))) { |
} |
$output.=$inlineremote[$item]; |
$output.='<br clear="all />'; |
} |
} else |
$output.='</table>'; |
# calling rawconfig with "1" will evaluate mydesk.tab, |
$output.='</div>'; |
# even if there is no active remote control |
|
&rawconfig(1); |
|
my $output='<table><tr>'; |
|
for (my $col=1; $col<=2; $col++) { |
|
$output.='<td class="LC_mainmenu_col_fieldset">'; |
|
for (my $row=1; $row<=8; $row++) { |
|
foreach my $cat (keys(%category_members)) { |
|
if ($category_positions{$cat} ne "$col,$row") { next; } |
|
$output.='<div class="LC_Box LC_400Box">'; |
|
$output.='<h3 class="LC_hcell">'.&mt($category_names{$cat}).'</h3>'; |
|
$output.='<table>'; |
|
my %active=(); |
|
foreach my $menu_item (split(/\:/,$category_members{$cat})) { |
|
if ($inlineremote[$menu_item]) { |
|
$active{$menu_item}=1; |
|
} |
|
} |
|
foreach my $item (sort(keys(%active))) { |
|
$output.=$inlineremote[$item]; |
|
} |
|
$output.='</table>'; |
|
$output.='</div>'; |
} |
} |
} |
$output.="</td>"; |
$output.="</td>"; |
} |
|
$output.="</tr></table>"; |
} |
} |
$output.="</tr></table>"; |
|
return $output; |
return $output; |
} |
} |
|
|
Line 1440 sub rawconfig {
|
Line 1535 sub rawconfig {
|
} |
} |
} elsif ($pro =~ /^courseenv_(.*)$/) { |
} elsif ($pro =~ /^courseenv_(.*)$/) { |
my $key = $1; |
my $key = $1; |
if (($env{'course.'.$env{'request.course.id'}.'.'.$key}) && |
if ($crstype ne 'Community') { |
($crstype ne 'Community')) { |
my $coursepref = $env{'course.'.$env{'request.course.id'}.'.'.$key}; |
$output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat); |
if ($key eq 'canuse_pdfforms') { |
|
if ($env{'request.course.id'} && $coursepref eq '') { |
|
my %domdefs = &Apache::lonnet::get_domain_defaults($env{'course.'.$env{'request.course.id'}.'.domain'}); |
|
$coursepref = $domdefs{'canuse_pdfforms'}; |
|
} |
|
} |
|
if ($coursepref) { |
|
$output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat); |
|
} |
} |
} |
} elsif ($pro =~ /^communityenv_(.*)$/) { |
} elsif ($pro =~ /^communityenv_(.*)$/) { |
my $key = $1; |
my $key = $1; |
if (($env{'course.'.$env{'request.course.id'}.'.'.$key}) && |
if ($crstype eq 'Community') { |
($crstype eq 'Community')) { |
my $coursepref = $env{'course.'.$env{'request.course.id'}.'.'.$key}; |
$output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat); |
if ($key eq 'canuse_pdfforms') { |
|
if ($env{'request.course.id'} && $coursepref eq '') { |
|
my %domdefs = &Apache::lonnet::get_domain_defaults($env{'course.'.$env{'request.course.id'}.'.domain'}); |
|
$coursepref = $domdefs{'canuse_pdfforms'}; |
|
} |
|
} |
|
if ($coursepref) { |
|
$output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat); |
|
} |
} |
} |
} elsif ($pro =~ /^course_(.*)$/) { |
} elsif ($pro =~ /^course_(.*)$/) { |
# Check for permissions inside of a course |
# Check for permissions inside of a course |
Line 1593 function gonav(url) {
|
Line 1704 function gonav(url) {
|
NAVCONTROL |
NAVCONTROL |
} |
} |
|
|
|
sub dc_popup_js { |
|
my %lt = &Apache::lonlocal::texthash( |
|
more => '(More ...)', |
|
less => '(Less ...)', |
|
); |
|
return <<"END"; |
|
|
|
function showCourseID() { |
|
document.getElementById('dccid').style.display='block'; |
|
document.getElementById('dccid').style.textAlign='left'; |
|
document.getElementById('dccid').style.textFace='normal'; |
|
document.getElementById('dccidtext').innerHTML ='<a href="javascript:hideCourseID();">$lt{'less'}</a>'; |
|
return; |
|
} |
|
|
|
function hideCourseID() { |
|
document.getElementById('dccid').style.display='none'; |
|
document.getElementById('dccidtext').innerHTML ='<a href="javascript:showCourseID()">$lt{'more'}</a>'; |
|
return; |
|
} |
|
|
|
END |
|
|
|
} |
|
|
sub utilityfunctions { |
sub utilityfunctions { |
my $caller = shift; |
my ($caller,$custommenu) = @_; |
unless ($env{'environment.remote'} eq 'off' || |
unless ($env{'environment.remote'} eq 'off' || |
$caller eq '/adm/menu') { |
$caller eq '/adm/menu') { |
return ''; } |
return ''; } |
|
|
|
my $gcimenujs; |
|
if ($custommenu) { |
|
my %concepttests = &Apache::loncommon::existing_gcitest_courses(); |
|
my $managetesturl = '/adm/menu'; |
|
my $createtesturl = '/adm/requestcourse'; |
|
if (($env{'request.course.id'}) && |
|
($env{'course.'.$env{'request.course.id'}.'.domain'} eq 'gci')) { |
|
my @items = keys(%concepttests); |
|
if (@items== 1) { |
|
my $newrole = $items[0]; |
|
$newrole =~ s{_}{/}; |
|
$managetesturl = '/adm/roles?selectrole=1&cc./'.$newrole.'=1'; |
|
} else { |
|
$managetesturl = '/adm/roles?selectrole=1&cm=1&orgurl=%2fadm%2fmenu'; |
|
} |
|
} |
|
if ($env{'request.course.id'}) { |
|
$createtesturl = '/adm/roles?selectrole=1&cm=1&orgurl=%2fadm%2frequestcourse'; |
|
} |
|
$gcimenujs = <<"ENDCUSTOM"; |
|
|
|
function switchpage(caller) { |
|
if (caller == 'review') { |
|
document.location.href = '/adm/roles?selectrole=1&st./gci/9615072b469884921gcil1=1'; |
|
} |
|
if (caller == 'submit') { |
|
document.location.href = '/adm/roles?selectrole=1&st./gci/1H96711d710194bfegcil1=1'; |
|
} |
|
if (caller == 'createtest') { |
|
document.location.href = '$createtesturl'; |
|
} |
|
if (caller == 'managetest') { |
|
document.location.href = '$managetesturl'; |
|
} |
|
return; |
|
} |
|
|
|
ENDCUSTOM |
|
} |
|
|
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 ($currenturl =~ m{^/adm/wrapper/ext/}) { |
if ($env{'request.external.querystring'}) { |
if ($env{'request.external.querystring'}) { |
Line 1610 sub utilityfunctions {
|
Line 1786 sub utilityfunctions {
|
my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'}); |
my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'}); |
my $nav_control=&nav_control_js(); |
my $nav_control=&nav_control_js(); |
|
|
|
my $dc_popup_cid; |
|
if ($env{'user.adv'} && exists($env{'user.role.dc./'. |
|
$env{'course.'.$env{'request.course.id'}. |
|
'.domain'}.'/'})) { |
|
$dc_popup_cid = &dc_popup_js(); |
|
} |
|
|
my $start_page_annotate = |
my $start_page_annotate = |
&Apache::loncommon::start_page('Annotator',undef, |
&Apache::loncommon::start_page('Annotator',undef, |
{'only_body' => 1, |
{'only_body' => 1, |
Line 1637 return (<<ENDUTILITY)
|
Line 1820 return (<<ENDUTILITY)
|
var currentSymb="$currentsymb"; |
var currentSymb="$currentsymb"; |
|
|
$nav_control |
$nav_control |
|
$dc_popup_cid |
|
|
|
$gcimenujs |
|
|
function go(url) { |
function go(url) { |
if (url!='' && url!= null) { |
if (url!='' && url!= null) { |