-#$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
-
-
+ if ($env{'user.adv'}) { $clearcstr='clearbut(6,1)'; }
+ return <
//
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 {
@@ -982,21 +1042,20 @@ sub edit_course_upload {
sub loadevents() {
if ($env{'request.state'} eq 'construct' ||
- $env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
+ $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 ''; }
+ $env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
return 'LONCAPAstale();';
}
-
sub startupremote {
my ($lowerurl)=@_;
- if ($env{'environment.remote'} eq 'off') {
- return ('');
+ unless ($env{'environment.remote'} eq 'on') {
+ return ('');
}
#
# The Remote actually gets launched!
@@ -1010,25 +1069,25 @@ sub startupremote {
var timestart;
function wheelswitch() {
if (typeof(document.wheel) != 'undefined') {
- if (typeof(document.wheel.spin) != 'undefined') {
- var date=new Date();
- var waited=Math.round(30-((date.getTime()-timestart)/1000));
- document.wheel.spin.value=$message;
- }
+ if (typeof(document.wheel.spin) != 'undefined') {
+ var date=new Date();
+ var waited=Math.round(30-((date.getTime()-timestart)/1000));
+ document.wheel.spin.value=$message;
+ }
}
- if (window.status=='|') {
- window.status='/';
+ if (window.status=='|') {
+ window.status='/';
} else {
if (window.status=='/') {
window.status='-';
} else {
- if (window.status=='-') {
- window.status='\\\\';
+ if (window.status=='-') {
+ window.status='\\\\';
} else {
if (window.status=='\\\\') { window.status='|'; }
}
}
- }
+ }
}
// ---------------------------------------------------------- The wait function
@@ -1039,9 +1098,9 @@ function wait() {
if (tim==0) {
clearTimeout(canceltim);
$configmenu
- window.location='$lowerurl';
+ window.location='$lowerurl';
} else {
- window.location='/adm/remote?action=collapse&url=$esclowerurl';
+ window.location='/adm/remote?action=collapse&url=$esclowerurl';
}
} else {
wheelswitch();
@@ -1074,7 +1133,7 @@ ENDSETFLAGS
}
sub maincall() {
- if ($env{'environment.remote'} eq 'off') { return ''; }
+ unless ($env{'environment.remote'} eq 'on') { return ''; }
return(<
// '."\n"
.'// ';
}
my $menuname = &get_menu_name();
-
+
# unless (shift eq 'unix') {
# resizing does not work on linux because of virtual desktop sizes
# $returnval.=(<13)) { return ''; }
return "\n".qq(window.status+='.';swmenu.clearbut($row,$col););
- } else {
- $inlineremote[10*$row+$col]='';
- return '';
- }
+ } else {
+ $inlineremote[10*$row+$col]='';
+ return '';
+ }
}
# ============================================ Switch a button or create a link
@@ -1175,31 +1234,27 @@ 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 ''; }
+ if ($env{'environment.remote'} eq 'on') {
+ if (($row<1) || ($row>13)) { return ''; }
# Remote
- return "\n".
+ $img=~s/\.png$/\.gif/;
+ 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 +1273,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 '';
}
@@ -1248,7 +1308,7 @@ sub secondlevel {
sub openmenu {
my $menuname = &get_menu_name();
- if ($env{'environment.remote'} eq 'off') { return ''; }
+ unless ($env{'environment.remote'} eq 'on') { return ''; }
my $nothing = &Apache::lonhtmlcommon::javascript_nothing();
return "window.open(".$nothing.",'".$menuname."');";
}
@@ -1295,12 +1355,12 @@ sub rawconfig {
#
my $textualoverride=shift;
my $output='';
- unless ($env{'environment.remote'} eq 'off') {
+ if ($env{'environment.remote'} eq 'on') {
$output.=
"window.status='Opening Remote Control';var swmenu=".&openmenu().
"\nwindow.status='Configuring Remote Control ';";
} else {
- unless ($textualoverride) { return ''; }
+ unless ($textualoverride) { return ''; }
}
my $uname=$env{'user.name'};
my $udom=$env{'user.domain'};
@@ -1438,6 +1498,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 +1536,12 @@ 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");';
- }
+ if ($env{'environment.remote'} eq 'on') {
+ $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;
}
@@ -1510,7 +1570,7 @@ sub check_for_rcrs {
# ======================================================================= Close
sub close {
- if ($env{'environment.remote'} eq 'off') { return ''; }
+ unless ($env{'environment.remote'} eq 'on') { return ''; }
my $menuname = &get_menu_name();
return(<
@@ -1529,29 +1589,6 @@ window.status='Done.';
ENDCLOSE
}
-# ====================================================================== Footer
-
-sub footer {
-
-}
-
-sub nav_control_js {
- my $nav=($env{'environment.remotenavmap'} eq 'on');
- return (< '(More ...)',
@@ -1563,13 +1600,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 +1614,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 +1663,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 +1855,20 @@ sub constspaceform {
ENDCONSTSPACEFORM
}
-
sub get_nav_status {
my $navstatus="swmenu.w_loncapanav_flag=";
if ($env{'environment.remotenavmap'} eq 'on') {
- $navstatus.="1";
+ $navstatus.="1";
} else {
- $navstatus.="-1";
+ $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 +1879,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 +1887,17 @@ sub roles_selector {
$ccrole = 'co';
} else {
$ccrole = 'cc';
- }
+ }
+ my $priv;
+ my $destinationurl = $ENV{'REQUEST_URI'};
+ 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 +1910,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 +1926,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 +1963,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 .= '