-#$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
-# }
-# }
-# }
-# }
- }
- #SD see below
- $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 {
@@ -1102,19 +893,6 @@ 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') {
@@ -1132,25 +910,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
@@ -1161,9 +939,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();
@@ -1237,13 +1015,13 @@ sub reopenmenu {
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
+ 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.=(<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
@@ -1297,31 +1070,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".
@@ -1340,17 +1101,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 '';
}
@@ -1368,86 +1134,37 @@ 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 {
- my ($context,$switcher) = @_;
undef(@inlineremote);
undef(%category_members);
- my $output;
- if (($context eq 'gcicustom') || ($context eq 'gcistudent')) {
- $output=''.
- ''.
- ' | '.
- ''.
- ' | ';
- } else {
- my $navtext = &mt('Table of Contents');
- if ($env{'request.role.domain'} eq 'gcitest') {
- $navtext = &mt('Display Test Contents');
- }
- $output .= '
|
';
+# calling rawconfig with "1" will evaluate mydesk.tab, even if there is no active remote control
+ &rawconfig(1);
+ my $output='';
+ for (my $col=1; $col<=2; $col++) {
+ $output.='';
+ for (my $row=1; $row<=8; $row++) {
+ foreach my $cat (keys(%category_members)) {
+ if ($category_positions{$cat} ne "$col,$row") { next; }
+ #$output.=' ';
+ $output.='';
+ $output.=' '.&mt($category_names{$cat}).'';
+ $output.=' ';
+ 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.=' ';
+ $output.=' ';
}
- }
- $output.=' ';
- } else {
- # calling rawconfig with "1" will evaluate mydesk.tab,
- # even if there is no active remote control
- &rawconfig(1);
- $output='';
- for (my $col=1; $col<=2; $col++) {
- $output.='';
- for (my $row=1; $row<=8; $row++) {
- foreach my $cat (keys(%category_members)) {
- if ($category_positions{$cat} ne "$col,$row") { next; }
- $output.='';
- $output.=' '.&mt($category_names{$cat}).'';
- $output.=' ';
- 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.=' ';
- $output.=' ';
- }
- }
- $output.=" | ";
- }
- $output.=" ";
+ }
+ $output.=" | ";
}
+ $output.="
";
return $output;
}
@@ -1459,13 +1176,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'};
@@ -1602,6 +1313,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();
@@ -1639,13 +1351,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;
}
@@ -1693,29 +1398,6 @@ window.status='Done.';
ENDCLOSE
}
-# ====================================================================== Footer
-
-sub footer {
-
-}
-
-sub nav_control_js {
- my $nav=($env{'environment.remotenavmap'} eq 'on');
- return (< '(More ...)',
@@ -1727,13 +1409,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;
}
@@ -1741,62 +1423,36 @@ END
}
-sub utilityfunctions {
- my ($caller,$custommenu) = @_;
- unless ($env{'environment.remote'} eq 'off' ||
- $caller eq '/adm/menu') {
- return ''; }
-
- my $gcimenujs;
- if ($custommenu) {
- my %concepttests = &Apache::loncommon::existing_gcitest_courses('cc');
- 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";
+sub countdown_toggle_js {
+ return <<"END";
-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';
+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;
}
-ENDCUSTOM
- }
-
+END
+}
+
+sub utilityfunctions {
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./'.
@@ -1816,26 +1472,22 @@ ENDCUSTOM
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 $confirm_switch = &mt("Editing requires switching to the resource's home server.").'\n'.
+ &mt('Switch server?');
- my $end_page_bookmark =
- &Apache::loncommon::end_page({'js_ready' => 1});
+ 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
}
@@ -2009,27 +1664,12 @@ 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 '') {
+ if ( $env{'request.course.id'} eq ''
+ || $env{'request.role.adv'} ) {
+
return;
}
- if ($env{'request.role.adv'}) {
- unless (&Apache::loncommon::needs_gci_custom()) {
- return;
- }
- }
my $buttonshide = &Apache::lonnet::EXT('resource.0.buttonshide');
return $buttonshide;
}
@@ -2038,7 +1678,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;
@@ -2046,7 +1686,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});
@@ -2059,7 +1709,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)) {
@@ -2075,6 +1725,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}})) {
@@ -2100,7 +1762,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 .= '