-#$inlineremote[21] $inlineremote[23]
-#ENDARROWSINLINE
-# if ( &hidden_button_check() ne 'yes' ) {
-# $inlinebuttons .= (<
-#ENDINLINEICONS
-# }
-# } else { # not iconsonly
-# if ( $inlineremote[21] ne '' || $inlineremote[23] ne '' ) {
-# $inlinebuttons = (<$inlineremote[21] | | $inlineremote[23] |
-#ENDFIRSTLINE
-# }
-# if ( &hidden_button_check() ne 'yes' ) {
-# foreach my $row ( 6 .. 9 ) {
-# if ( $inlineremote[ ${row} . '1' ] ne ''
-# || $inlineremote[ $row . '2' ] ne ''
-# || $inlineremote[ $row . '3' ] ne '' )
-# {
-# $inlinebuttons .= <<"ENDLINE";
-#$inlineremote["${row}1"] | $inlineremote["${row}2"] | $inlineremote["${row}3"] |
-#ENDLINE
-# }
-# }
-# }
-# }
- }
- $breadcrumb = &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0);
- $result =(<
-// BEGIN LON-CAPA Internal
-
-$timesync
-$breadcrumb
-
-
-
-$newmail
-
-
-
-ENDREGTEXT
-# Registered, graphical output
- } else {
- my $requri=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0]));
- $requri=&Apache::lonenc::check_encrypt(&unescape($requri));
- my $cursymb=&Apache::lonenc::check_encrypt($env{'request.symb'});
- my $navstatus=&get_nav_status();
- my $clearcstr;
-
- if ($env{'user.adv'}) { $clearcstr='clearbut(6,1)'; }
- $result = (<
-//
-
-ENDREGTHIS
- }
-# =============================================================================
- } else {
-# ========================================== This can or will not be registered
- if ($noremote) {
-# Not registered
- $result= (<
-//
-
-ENDDONOTREGTHIS
- }
-# =============================================================================
- }
- return $result;
+ return &Apache::lonhtmlcommon::scripttag('', 'start')
+ . &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0)
+ . &Apache::lonhtmlcommon::scripttag('', 'end');
}
sub is_course_upload {
@@ -980,188 +865,12 @@ sub edit_course_upload {
return $cfile;
}
-sub loadevents() {
- if ($env{'request.state'} eq 'construct' ||
- $env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
- return 'LONCAPAreg();';
-}
-
-sub unloadevents() {
- if ($env{'request.state'} eq 'construct' ||
- $env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
- return 'LONCAPAstale();';
-}
-
-
-sub startupremote {
- my ($lowerurl)=@_;
- if ($env{'environment.remote'} eq 'off') {
- return ('');
- }
-#
-# The Remote actually gets launched!
-#
- my $configmenu=&rawconfig();
- my $esclowerurl=&escape($lowerurl);
- my $message=&mt('"Waiting for Remote Control window to load: "+[_1]','waited');
- return(<
-//
-
-ENDREMOTESTARTUP
-}
-
-sub setflags() {
- return(<
-//
-
-ENDSETFLAGS
-}
-
-sub maincall() {
- if ($env{'environment.remote'} eq 'off') { return ''; }
- return(<
-//
-
-ENDMAINCALL
-}
-
-sub load_remote_msg {
- my ($lowerurl)=@_;
-
- if ($env{'environment.remote'} eq 'off') { return ''; }
-
- my $esclowerurl=&escape($lowerurl);
- my $link=&mt('[_1]Continue[_2] on in Inline Menu mode'
- ,''
- ,'');
- return(<
-
-
-$link
-ENDREMOTEFORM
-}
-
-sub get_menu_name {
- my $hostid = $Apache::lonnet::perlvar{'lonHostID'};
- $hostid =~ s/\W//g;
- return 'LCmenu'.$hostid;
-}
-
-
-sub reopenmenu {
- if ($env{'environment.remote'} eq 'off') { return ''; }
- my $menuname = &get_menu_name();
- my $nothing = &Apache::lonhtmlcommon::javascript_nothing();
- return('window.open('.$nothing.',"'.$menuname.'","",false);');
-}
-
-
-sub open {
- my $returnval='';
- if ($env{'environment.remote'} eq 'off') {
- return
- '';
- }
- my $menuname = &get_menu_name();
-
-# unless (shift eq 'unix') {
-# resizing does not work on linux because of virtual desktop sizes
-# $returnval.=(<
-ENDOPEN
- return '';
-}
-
-
# ================================================================== Raw Config
sub clear {
my ($row,$col)=@_;
- unless ($env{'environment.remote'} eq 'off') {
- if (($row<1) || ($row>13)) { return ''; }
- return "\n".qq(window.status+='.';swmenu.clearbut($row,$col););
- } else {
- $inlineremote[10*$row+$col]='';
- return '';
- }
+ $inlineremote[10*$row+$col]='';
+ return '';
}
# ============================================ Switch a button or create a link
@@ -1175,31 +884,19 @@ sub switch {
$top=&mt($top);
$bot=&mt($bot);
$desc=&mt($desc);
- if (($env{'environment.remote'} ne 'off') || ($env{'environment.icons'} eq 'classic')) {
- $img=&mt($img);
- }
my $idx=10*$row+$col;
$category_members{$cat}.=':'.$idx;
- unless ($env{'environment.remote'} eq 'off') {
- if (($row<1) || ($row>13)) { return ''; }
-# Remote
- return "\n".
- qq(window.status+='.';swmenu.switchbutton($row,$col,"$img","$top","$bot","$act","$desc"););
- } else {
-# Inline Remote
- if ($env{'environment.icons'} ne 'classic') {
- $img=~s/\.gif$/\.png/;
- }
- if ($nobreak==2) { return ''; }
- my $text=$top.' '.$bot;
- $text=~s/\s*\-\s*//gs;
+# Inline Menu
+ if ($nobreak==2) { return ''; }
+ my $text=$top.' '.$bot;
+ $text=~s/\s*\-\s*//gs;
- my $pic=
+ my $pic=
'';
- if ($env{'browser.interface'} eq 'faketextual') {
+ if ($env{'browser.interface'} eq 'faketextual') {
# Main Menu
if ($nobreak==3) {
$inlineremote[$idx]="\n".
@@ -1218,17 +915,22 @@ sub switch {
' | ';
}
- } else {
+ } else {
# Inline Menu
- if ($env{'environment.icons'} eq 'iconsonly') {
- $inlineremote[$idx]=''.$pic.'';
- } else {
- $inlineremote[$idx]=
- '';
- }
- }
- }
+ my @tools = (93,91,81,82,83);
+ unless ($env{'request.state'} eq 'construct') {
+ push(@tools,63);
+ }
+ if (($env{'environment.icons'} eq 'iconsonly') &&
+ (grep(/^$idx$/,@tools))) {
+ $inlineremote[$idx] =
+ '';
+ } else {
+ $inlineremote[$idx] =
+ '';
+ }
+ }
return '';
}
@@ -1246,13 +948,6 @@ sub secondlevel {
return $output;
}
-sub openmenu {
- my $menuname = &get_menu_name();
- if ($env{'environment.remote'} eq 'off') { return ''; }
- my $nothing = &Apache::lonhtmlcommon::javascript_nothing();
- return "window.open(".$nothing.",'".$menuname."');";
-}
-
sub inlinemenu {
undef(@inlineremote);
undef(%category_members);
@@ -1295,13 +990,7 @@ sub rawconfig {
#
my $textualoverride=shift;
my $output='';
- unless ($env{'environment.remote'} eq 'off') {
- $output.=
- "window.status='Opening Remote Control';var swmenu=".&openmenu().
-"\nwindow.status='Configuring Remote Control ';";
- } else {
- unless ($textualoverride) { return ''; }
- }
+ return '' unless $textualoverride;
my $uname=$env{'user.name'};
my $udom=$env{'user.domain'};
my $adv=$env{'user.adv'};
@@ -1438,6 +1127,7 @@ sub rawconfig {
($env{'request.role'}=~/($match_domain)\/($match_username)$/);
}
$act =~ s/\$caname/$caname/g;
+ $act =~ s/\$cadom/$cadom/g;
my $home = &Apache::lonnet::homeserver($caname,$cadom);
my $allowed=0;
my @ids=&Apache::lonnet::current_machine_ids();
@@ -1475,13 +1165,6 @@ sub rawconfig {
$uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
}
}
- unless ($env{'environment.remote'} eq 'off') {
- $output.="\nwindow.status='Synchronizing Time';swmenu.syncclock(1000*".time.");\nwindow.status='Remote Control Configured.';";
- if (&Apache::lonmsg::newmail()) {
- $output.='swmenu.setstatus("you have","messages");';
- }
- }
-
return $output;
}
@@ -1507,51 +1190,6 @@ sub check_for_rcrs {
return $showreqcrs;
}
-# ======================================================================= Close
-
-sub close {
- if ($env{'environment.remote'} eq 'off') { return ''; }
- my $menuname = &get_menu_name();
- return(<
-//
-
-ENDCLOSE
-}
-
-# ====================================================================== Footer
-
-sub footer {
-
-}
-
-sub nav_control_js {
- my $nav=($env{'environment.remotenavmap'} eq 'on');
- return (< '(More ...)',
@@ -1563,13 +1201,13 @@ function showCourseID() {
document.getElementById('dccid').style.display='block';
document.getElementById('dccid').style.textAlign='left';
document.getElementById('dccid').style.textFace='normal';
- document.getElementById('dccidtext').innerHTML ='$lt{'less'}';
+ document.getElementById('dccidtext').innerHTML ='';
return;
}
function hideCourseID() {
document.getElementById('dccid').style.display='none';
- document.getElementById('dccidtext').innerHTML ='$lt{'more'}';
+ document.getElementById('dccidtext').innerHTML ='';
return;
}
@@ -1577,22 +1215,36 @@ END
}
+sub countdown_toggle_js {
+ return <<"END";
+
+function toggleCountdown() {
+ var countdownid = document.getElementById('duedatecountdown');
+ var currstyle = countdownid.style.display;
+ if (currstyle == 'inline') {
+ countdownid.style.display = 'none';
+ document.getElementById('ddcountcollapse').innerHTML='';
+ document.getElementById('ddcountexpand').innerHTML='◄ ';
+ } else {
+ countdownid.style.display = 'inline';
+ document.getElementById('ddcountcollapse').innerHTML='► ';
+ document.getElementById('ddcountexpand').innerHTML='';
+ }
+ return;
+}
+
+END
+}
+
sub utilityfunctions {
- my $caller = shift;
- unless ($env{'environment.remote'} eq 'off' ||
- $caller eq '/adm/menu') {
- return ''; }
-
my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0]));
- if ($currenturl =~ m{^/adm/wrapper/ext/}) {
- if ($env{'request.external.querystring'}) {
+ if ($currenturl =~ m{^/adm/wrapper/ext/}
+ && $env{'request.external.querystring'} ) {
$currenturl .= ($currenturl=~/\?/)?'&':'?'.$env{'request.external.querystring'};
- }
}
$currenturl=&Apache::lonenc::check_encrypt(&unescape($currenturl));
my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'});
- my $nav_control=&nav_control_js();
my $dc_popup_cid;
if ($env{'user.adv'} && exists($env{'user.role.dc./'.
@@ -1612,25 +1264,20 @@ sub utilityfunctions {
my $end_page_annotate =
&Apache::loncommon::end_page({'js_ready' => 1});
- my $start_page_bookmark =
- &Apache::loncommon::start_page('Bookmarks',undef,
- {'only_body' => 1,
- 'js_ready' => 1,
- 'bgcolor' => '#BBBBBB',});
-
- my $end_page_bookmark =
- &Apache::loncommon::end_page({'js_ready' => 1});
-
my $confirm_switch = &mt("Editing requires switching to the resource's home server.").'\n'.
&mt('Switch server?');
+ my $esc_url=&escape($currenturl);
+ my $esc_symb=&escape($currentsymb);
+
+ my $countdown = &countdown_toggle_js();
+
return (<'
- +'$end_page_bookmark' );
- bmquery.document.close();
+function open_StoredLinks_Import(rat) {
+ var newWin;
+ if (rat) {
+ newWin = window.open('/adm/wishlist?inhibitmenu=yes&mode=import&rat='+rat,
+ 'wishlistImport','scrollbars=1,resizable=1,menubar=0');
+ }
+ else {
+ newWin = window.open('/adm/wishlist?inhibitmenu=yes&mode=import',
+ 'wishlistImport','scrollbars=1,resizable=1,menubar=0');
+ }
+ newWin.focus();
}
+(function (\$) {
+ \$(document).ready(function () {
+ \$.single=function(a){return function(b){a[0]=b;return a}}(\$([1]));
+ /*\@cc_on
+ if (!window.XMLHttpRequest) {
+ \$('.LC_hoverable').each(function () {
+ this.attachEvent('onmouseenter', function (evt) { \$.single(evt.srcElement).addClass('hover'); });
+ this.attachEvent('onmouseleave', function (evt) { \$.single(evt.srcElement).removeClass('hover'); });
+ });
+ }
+ \@*/
+ });
+}(jQuery));
+
+$countdown
+
ENDUTILITY
}
@@ -1815,23 +1456,10 @@ sub constspaceform {
ENDCONSTSPACEFORM
}
-
-sub get_nav_status {
- my $navstatus="swmenu.w_loncapanav_flag=";
- if ($env{'environment.remotenavmap'} eq 'on') {
- $navstatus.="1";
- } else {
- $navstatus.="-1";
- }
- return $navstatus;
-}
-
sub hidden_button_check {
- my $hidden;
- if ($env{'request.course.id'} eq '') {
- return;
- }
- if ($env{'request.role.adv'}) {
+ if ( $env{'request.course.id'} eq ''
+ || $env{'request.role.adv'} ) {
+
return;
}
my $buttonshide = &Apache::lonnet::EXT('resource.0.buttonshide');
@@ -1842,7 +1470,7 @@ sub roles_selector {
my ($cdom,$cnum) = @_;
my $crstype = &Apache::loncommon::course_type();
my $now = time;
- my (%courseroles,%seccount);
+ my (%courseroles,%seccount,%courseprivs);
my $is_cc;
my $role_selector;
my $ccrole;
@@ -1850,7 +1478,31 @@ sub roles_selector {
$ccrole = 'co';
} else {
$ccrole = 'cc';
- }
+ }
+ my ($priv,$gotsymb,$destsymb);
+ my $destinationurl = $ENV{'REQUEST_URI'};
+ if ($destinationurl =~ /\?symb=/) {
+ $gotsymb = 1;
+ } elsif ($destinationurl =~ m{^/enc/}) {
+ my $plainurl = &Apache::lonenc::unencrypted($destinationurl);
+ if ($plainurl =~ /\?symb=/) {
+ $gotsymb = 1;
+ }
+ }
+ unless ($gotsymb) {
+ $destsymb = &Apache::lonnet::symbread();
+ if ($destsymb ne '') {
+ $destsymb = &Apache::lonenc::check_encrypt($destsymb);
+ }
+ }
+ my $reqprivs = &required_privs();
+ if (ref($reqprivs) eq 'HASH') {
+ my $destination = $destinationurl;
+ $destination =~ s/(\?.*)$//;
+ if (exists($reqprivs->{$destination})) {
+ $priv = $reqprivs->{$destination};
+ }
+ }
if ($env{'user.role.'.$ccrole.'./'.$cdom.'/'.$cnum}) {
my ($start,$end) = split(/\./,$env{'user.role.'.$ccrole.'./'.$cdom.'/'.$cnum});
@@ -1863,7 +1515,7 @@ sub roles_selector {
}
}
if ($is_cc) {
- &get_all_courseroles($cdom,$cnum,\%courseroles,\%seccount);
+ &get_all_courseroles($cdom,$cnum,\%courseroles,\%seccount,\%courseprivs,$priv);
} else {
my %gotnosection;
foreach my $item (keys(%env)) {
@@ -1879,6 +1531,18 @@ sub roles_selector {
$gotnosection{$role} = 1;
}
}
+ if ($priv ne '') {
+ my $cnumsec = $cnum;
+ if ($sec ne '') {
+ $cnumsec .= "/$sec";
+ }
+ $courseprivs{"$role./$cdom/$cnumsec./"} =
+ $env{"user.priv.$role./$cdom/$cnumsec./"};
+ $courseprivs{"$role./$cdom/$cnumsec./$cdom/"} =
+ $env{"user.priv.$role./$cdom/$cnumsec./$cdom/"};
+ $courseprivs{"$role./$cdom/$cnumsec./$cdom/$cnumsec"} =
+ $env{"user.priv.$role./$cdom/$cnumsec./$cdom/$cnumsec"};
+ }
if (ref($courseroles{$role}) eq 'ARRAY') {
if ($sec ne '') {
if (!grep(/^\Q$sec\E$/,@{$courseroles{$role}})) {
@@ -1904,7 +1568,7 @@ sub roles_selector {
}
my @roles_order = ($ccrole,'in','ta','ep','ad','st');
if (keys(%courseroles) > 1) {
- $role_selector = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles);
+ $role_selector = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles,\%courseprivs,$priv);
$role_selector .= '