--- loncom/interface/loncommon.pm 2015/04/20 11:48:27 1.1075.2.93 +++ loncom/interface/loncommon.pm 2012/07/06 22:46:06 1.1085 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.1075.2.93 2015/04/20 11:48:27 raeburn Exp $ +# $Id: loncommon.pm,v 1.1085 2012/07/06 22:46:06 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -67,16 +67,9 @@ use Apache::lonhtmlcommon(); use Apache::loncoursedata(); use Apache::lontexconvert(); use Apache::lonclonecourse(); -use Apache::lonuserutils(); -use Apache::lonuserstate(); -use Apache::courseclassifier(); use LONCAPA qw(:DEFAULT :match); use DateTime::TimeZone; use DateTime::Locale::Catalog; -use Authen::Captcha; -use Captcha::reCAPTCHA; -use Crypt::DES; -use DynaLoader; # for Crypt::DES version # ---------------------------------------------- Designs use vars qw(%defaultdesign); @@ -531,8 +524,7 @@ ENDAUTHORBRW } sub coursebrowser_javascript { - my ($domainfilter,$sec_element,$formname,$role_element,$crstype, - $credits_element) = @_; + my ($domainfilter,$sec_element,$formname,$role_element,$crstype) = @_; my $wintitle = 'Course_Browser'; if ($crstype eq 'Community') { $wintitle = 'Community_Browser'; @@ -595,9 +587,8 @@ sub coursebrowser_javascript { } $id_functions ENDSTDBRW - if (($sec_element ne '') || ($role_element ne '') || ($credits_element ne '')) { - $output .= &setsec_javascript($sec_element,$formname,$role_element, - $credits_element); + if (($sec_element ne '') || ($role_element ne '')) { + $output .= &setsec_javascript($sec_element,$formname,$role_element); } $output .= ' // ]]> @@ -754,7 +745,7 @@ ENDUSERBRW } sub setsec_javascript { - my ($sec_element,$formname,$role_element,$credits_element) = @_; + my ($sec_element,$formname,$role_element) = @_; my (@courserolenames,@communityrolenames,$rolestr,$courserolestr, $communityrolestr); if ($role_element ne '') { @@ -849,14 +840,6 @@ function setRole(crstype) { } |; } - if ($credits_element) { - $setsections .= qq| -function setCredits(defaultcredits) { - document.$formname.$credits_element.value = defaultcredits; - return; -} -|; - } return $setsections; } @@ -902,14 +885,10 @@ sub check_uncheck_jscript { function checkAll(field) { if (field.length > 0) { for (i = 0; i < field.length; i++) { - if (!field[i].disabled) { - field[i].checked = true; - } + field[i].checked = true ; } } else { - if (!field.disabled) { - field.checked = true; - } + field.checked = true } } @@ -1011,7 +990,6 @@ sub select_language { $langchoices{$code} = &plainlanguagedescription($id); } } - %langchoices = &Apache::lonlocal::texthash(%langchoices); return &select_form($selected,$name,\%langchoices); } @@ -1043,12 +1021,6 @@ linked_select_forms takes the following =item * $menuorder, the order of values in the first menu -=item * $onchangefirst, additional javascript call to execute for an onchange - event for the first tag - =back Below is an example of such a hash. Only the 'text', 'default', and @@ -1102,8 +1074,6 @@ sub linked_select_forms { $secondselectname, $hashref, $menuorder, - $onchangefirst, - $onchangesecond ) = @_; my $second = "document.$formname.$secondselectname"; my $first = "document.$formname.$firstselectname"; @@ -1160,7 +1130,7 @@ function select1_changed() { END # output the initial values for the selection lists - $result .= "\n"; my @order = sort(keys(%{$hashref})); if (ref($menuorder) eq 'ARRAY') { @order = @{$menuorder}; @@ -1173,11 +1143,7 @@ END $result .= "\n"; my %select2 = %{$hashref->{$firstdefault}->{'select2'}}; $result .= $middletext; - $result .= " form to allow a user to select the domain to preform an operation in. @@ -2192,31 +2143,25 @@ If the $showdomdesc flag is set, the dom The optional $onchange argument specifies what should occur if the domain selector is changed, e.g., 'this.form.submit()' if the form is to be automatically submitted. -The optional $incdoms is a reference to an array of domains which will be the only available options. - -The optional $excdoms is a reference to an array of domains which will be excluded from the available options. +The optional $incdoms is a reference to an array of domains which will be the only available options. =cut #------------------------------------------- sub select_dom_form { - my ($defdom,$name,$includeempty,$showdomdesc,$onchange,$incdoms,$excdoms) = @_; + my ($defdom,$name,$includeempty,$showdomdesc,$onchange,$incdoms) = @_; if ($onchange) { $onchange = ' onchange="'.$onchange.'"'; } - my (@domains,%exclude); + my @domains; if (ref($incdoms) eq 'ARRAY') { @domains = sort {lc($a) cmp lc($b)} (@{$incdoms}); } else { @domains = sort {lc($a) cmp lc($b)} (&Apache::lonnet::all_domains()); } if ($includeempty) { @domains=('',@domains); } - if (ref($excdoms) eq 'ARRAY') { - map { $exclude{$_} = 1; } @{$excdoms}; - } my $selectdomain = "'; } if (($can_assign{'krb4'} && $can_assign{'krb5'}) || - ($can_assign{'krb4'} && !$can_assign{'krb5'} && + ($can_assign{'krb4'} && !$can_assign{'krb5'} && $in{'curr_authtype'} eq 'krb5') || - (!$can_assign{'krb4'} && $can_assign{'krb5'} && + (!$can_assign{'krb4'} && $can_assign{'krb5'} && $in{'curr_authtype'} eq 'krb4')) { $result .= &mt ('[_1] Kerberos authenticated with domain [_2] '. @@ -2691,14 +2613,14 @@ sub authform_kerberos { return $result; } -sub authform_internal { +sub authform_internal{ my %in = ( formname => 'document.cu', kerb_def_dom => 'MSU.EDU', @_, ); my ($intcheck,$intarg,$result,$authtype,$autharg,$jscall); - my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); + my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); if (defined($in{'curr_authtype'})) { if ($in{'curr_authtype'} eq 'int') { if ($can_assign{'int'}) { @@ -2727,7 +2649,7 @@ sub authform_internal { if (defined($in{'mode'})) { if ($in{'mode'} eq 'modifycourse') { if ($authnum == 1) { - $authtype = ''; + $authtype = ''; } } } @@ -2746,14 +2668,14 @@ sub authform_internal { return $result; } -sub authform_local { +sub authform_local{ my %in = ( formname => 'document.cu', kerb_def_dom => 'MSU.EDU', @_, ); my ($loccheck,$locarg,$result,$authtype,$autharg,$jscall); - my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); + my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); if (defined($in{'curr_authtype'})) { if ($in{'curr_authtype'} eq 'loc') { if ($can_assign{'loc'}) { @@ -2782,7 +2704,7 @@ sub authform_local { if (defined($in{'mode'})) { if ($in{'mode'} eq 'modifycourse') { if ($authnum == 1) { - $authtype = ''; + $authtype = ''; } } } @@ -2800,14 +2722,14 @@ sub authform_local { return $result; } -sub authform_filesystem { +sub authform_filesystem{ my %in = ( formname => 'document.cu', kerb_def_dom => 'MSU.EDU', @_, ); my ($fsyscheck,$result,$authtype,$autharg,$jscall); - my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); + my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); if (defined($in{'curr_authtype'})) { if ($in{'curr_authtype'} eq 'fsys') { if ($can_assign{'fsys'}) { @@ -2833,7 +2755,7 @@ sub authform_filesystem { if (defined($in{'mode'})) { if ($in{'mode'} eq 'modifycourse') { if ($authnum == 1) { - $authtype = ''; + $authtype = ''; } } } @@ -3261,7 +3183,7 @@ sub screenname { # ------------------------------------------------------------- Confirm Wrapper =pod -=item * &confirmwrapper($message) +=item confirmwrapper Wrap messages about completion of operation in box @@ -3304,7 +3226,7 @@ sub aboutmewrapper { if (!defined($username) && !defined($domain)) { return; } - return ''.$link.''; } @@ -3677,7 +3599,7 @@ sub user_lang { =over 4 =item * &get_previous_attempt($symb, $username, $domain, $course, - $getattempt, $regexp, $gradesub, $usec, $identifier) + $getattempt, $regexp, $gradesub) Return string with previous attempt on problem. Arguments: @@ -3699,11 +3621,6 @@ Return string with previous attempt on p =item * $gradesub: routine that processes the string if it matches $regexp -=item * $usec: section of the desired student - -=item * $identifier: counter for student (multiple students one problem) or - problem (one student; whole sequence). - =back The output string is a table containing all desired attempts, if any. @@ -3711,7 +3628,7 @@ The output string is a table containing =cut sub get_previous_attempt { - my ($symb,$username,$domain,$course,$getattempt,$regexp,$gradesub,$usec,$identifier)=@_; + my ($symb,$username,$domain,$course,$getattempt,$regexp,$gradesub)=@_; my $prevattempts=''; no strict 'refs'; if ($symb) { @@ -3721,18 +3638,13 @@ sub get_previous_attempt { my %lasthash=(); my $version; for ($version=1;$version<=$returnhash{'version'};$version++) { - foreach my $key (reverse(sort(split(/\:/,$returnhash{$version.':keys'})))) { - if ($key =~ /\.rawrndseed$/) { - my ($id) = ($key =~ /^(.+)\.rawrndseed$/); - $lasthash{$id.'.rndseed'} = $returnhash{$version.':'.$key}; - } else { - $lasthash{$key}=$returnhash{$version.':'.$key}; - } + foreach my $key (sort(split(/\:/,$returnhash{$version.':keys'}))) { + $lasthash{$key}=$returnhash{$version.':'.$key}; } } $prevattempts=&start_data_table().&start_data_table_header_row(); $prevattempts.=''.&mt('History').''; - my (%typeparts,%lasthidden,%regraded,%hidestatus); + my (%typeparts,%lasthidden); my $showsurv=&Apache::lonnet::allowed('vas',$env{'request.course.id'}); foreach my $key (sort(keys(%lasthash))) { my ($ign,@parts) = split(/\./,$key); @@ -3749,18 +3661,6 @@ sub get_previous_attempt { $lasthidden{$ign.'.'.$id} = 1; } } - if ($identifier ne '') { - my $id = join(',',@parts); - if (&Apache::lonnet::EXT("resource.$id.problemstatus",$symb, - $domain,$username,$usec,undef,$course) =~ /^no/) { - $hidestatus{$ign.'.'.$id} = 1; - } - } - } elsif ($data eq 'regrader') { - if (($identifier ne '') && (@parts)) { - my $id = join(',',@parts); - $regraded{$ign.'.'.$id} = 1; - } } } else { if ($#parts == 0) { @@ -3772,60 +3672,17 @@ sub get_previous_attempt { } $prevattempts.=&end_data_table_header_row(); if ($getattempt eq '') { - my (%solved,%resets,%probstatus); - if (($identifier ne '') && (keys(%regraded) > 0)) { - for ($version=1;$version<=$returnhash{'version'};$version++) { - foreach my $id (keys(%regraded)) { - if (($returnhash{$version.':'.$id.'.regrader'}) && - ($returnhash{$version.':'.$id.'.tries'} eq '') && - ($returnhash{$version.':'.$id.'.award'} eq '')) { - push(@{$resets{$id}},$version); - } - } - } - } for ($version=1;$version<=$returnhash{'version'};$version++) { - my (@hidden,@unsolved); + my @hidden; if (%typeparts) { foreach my $id (keys(%typeparts)) { - if (($returnhash{$version.':'.$id.'.type'} eq 'anonsurvey') || - ($returnhash{$version.':'.$id.'.type'} eq 'anonsurveycred')) { + if (($returnhash{$version.':'.$id.'.type'} eq 'anonsurvey') || ($returnhash{$version.':'.$id.'.type'} eq 'anonsurveycred')) { push(@hidden,$id); - } elsif ($identifier ne '') { - unless (($returnhash{$version.':'.$id.'.type'} eq 'survey') || - ($returnhash{$version.':'.$id.'.type'} eq 'surveycred') || - ($hidestatus{$id})) { - next if ((ref($resets{$id}) eq 'ARRAY') && grep(/^\Q$version\E$/,@{$resets{$id}})); - if ($returnhash{$version.':'.$id.'.solved'} eq 'correct_by_student') { - push(@{$solved{$id}},$version); - } elsif (($returnhash{$version.':'.$id.'.solved'} ne '') && - (ref($solved{$id}) eq 'ARRAY')) { - my $skip; - if (ref($resets{$id}) eq 'ARRAY') { - foreach my $reset (@{$resets{$id}}) { - if ($reset > $solved{$id}[-1]) { - $skip=1; - last; - } - } - } - unless ($skip) { - my ($ign,$partslist) = split(/\./,$id,2); - push(@unsolved,$partslist); - } - } - } } } } $prevattempts.=&start_data_table_row(). - ''.&mt('Transaction [_1]',$version); - if (@unsolved) { - $prevattempts .= ''; - } - $prevattempts .= ''; + ''.&mt('Transaction [_1]',$version).''; if (@hidden) { foreach my $key (sort(keys(%lasthash))) { next if ($key =~ /\.foilorder$/); @@ -3847,15 +3704,9 @@ sub get_previous_attempt { } } else { if ($key =~ /\./) { - my $value = $returnhash{$version.':'.$key}; - if ($key =~ /\.rndseed$/) { - my ($id) = ($key =~ /^(.+)\.rndseed$/); - if (exists($returnhash{$version.':'.$id.'.rawrndseed'})) { - $value = $returnhash{$version.':'.$id.'.rawrndseed'}; - } - } - $prevattempts.=''.&format_previous_attempt_value($key,$value). - ' '; + my $value = &format_previous_attempt_value($key, + $returnhash{$version.':'.$key}); + $prevattempts.=''.$value.' '; } else { $prevattempts.=' '; } @@ -3864,15 +3715,9 @@ sub get_previous_attempt { } else { foreach my $key (sort(keys(%lasthash))) { next if ($key =~ /\.foilorder$/); - my $value = $returnhash{$version.':'.$key}; - if ($key =~ /\.rndseed$/) { - my ($id) = ($key =~ /^(.+)\.rndseed$/); - if (exists($returnhash{$version.':'.$id.'.rawrndseed'})) { - $value = $returnhash{$version.':'.$id.'.rawrndseed'}; - } - } - $prevattempts.=''.&format_previous_attempt_value($key,$value). - ' '; + my $value = &format_previous_attempt_value($key, + $returnhash{$version.':'.$key}); + $prevattempts.=''.$value.' '; } } $prevattempts.=&end_data_table_row(); @@ -4322,20 +4167,23 @@ sub findallcourses { ############################################### sub blockcheck { - my ($setters,$activity,$uname,$udom,$url,$is_course) = @_; + my ($setters,$activity,$uname,$udom,$url) = @_; - if (defined($udom) && defined($uname)) { - # If uname and udom are for a course, check for blocks in the course. - if (($is_course) || (&Apache::lonnet::is_course($udom,$uname))) { - my ($startblock,$endblock,$triggerblock) = - &get_blocks($setters,$activity,$udom,$uname,$url); - return ($startblock,$endblock,$triggerblock); - } - } else { + if (!defined($udom)) { $udom = $env{'user.domain'}; + } + if (!defined($uname)) { $uname = $env{'user.name'}; } + # If uname and udom are for a course, check for blocks in the course. + + if (&Apache::lonnet::is_course($udom,$uname)) { + my ($startblock,$endblock,$triggerblock) = + &get_blocks($setters,$activity,$udom,$uname,$url); + return ($startblock,$endblock,$triggerblock); + } + my $startblock = 0; my $endblock = 0; my $triggerblock = ''; @@ -4345,8 +4193,7 @@ sub blockcheck { # boards, chat or groups, check for blocking in current course only. if (($activity eq 'boards' || $activity eq 'chat' || - $activity eq 'groups' || $activity eq 'printout') && - ($env{'request.course.id'})) { + $activity eq 'groups') && ($env{'request.course.id'})) { foreach my $key (keys(%live_courses)) { if ($key ne $env{'request.course.id'}) { delete($live_courses{$key}); @@ -4610,12 +4457,12 @@ sub parse_block_record { } sub blocking_status { - my ($activity,$uname,$udom,$url,$is_course) = @_; + my ($activity,$uname,$udom,$url) = @_; my %setters; # check for active blocking my ($startblock,$endblock,$triggerblock) = - &blockcheck(\%setters,$activity,$uname,$udom,$url,$is_course); + &blockcheck(\%setters,$activity,$uname,$udom,$url); my $blocked = 0; if ($startblock && $endblock) { $blocked = 1; @@ -4648,15 +4495,13 @@ END_MYBLOCK my $popupUrl = "/adm/blockingstatus/$querystring"; my $text = &mt('Communication Blocked'); - my $class = 'LC_comblock'; if ($activity eq 'docs') { $text = &mt('Content Access Blocked'); - $class = ''; } elsif ($activity eq 'printout') { $text = &mt('Printing Blocked'); } $output .= <<"END_BLOCK"; -
+
$text @@ -4774,28 +4619,23 @@ sub get_domainconf { if (keys(%{$domconfig{'login'}})) { foreach my $key (keys(%{$domconfig{'login'}})) { if (ref($domconfig{'login'}{$key}) eq 'HASH') { - if (($key eq 'loginvia') || ($key eq 'headtag')) { - if (ref($domconfig{'login'}{$key}) eq 'HASH') { - foreach my $hostname (keys(%{$domconfig{'login'}{$key}})) { - if (ref($domconfig{'login'}{$key}{$hostname}) eq 'HASH') { - if ($key eq 'loginvia') { - if ($domconfig{'login'}{'loginvia'}{$hostname}{'server'}) { - my $server = $domconfig{'login'}{'loginvia'}{$hostname}{'server'}; - $designhash{$udom.'.login.loginvia'} = $server; - if ($domconfig{'login'}{'loginvia'}{$hostname}{'serverpath'} eq 'custom') { - $designhash{$udom.'.login.loginvia_'.$hostname} = $server.':'.$domconfig{'login'}{'loginvia'}{$hostname}{'custompath'}; - } else { - $designhash{$udom.'.login.loginvia_'.$hostname} = $server.':'.$domconfig{'login'}{'loginvia'}{$hostname}{'serverpath'}; - } + if ($key eq 'loginvia') { + if (ref($domconfig{'login'}{'loginvia'}) eq 'HASH') { + foreach my $hostname (keys(%{$domconfig{'login'}{'loginvia'}})) { + if (ref($domconfig{'login'}{'loginvia'}{$hostname}) eq 'HASH') { + if ($domconfig{'login'}{'loginvia'}{$hostname}{'server'}) { + my $server = $domconfig{'login'}{'loginvia'}{$hostname}{'server'}; + $designhash{$udom.'.login.loginvia'} = $server; + if ($domconfig{'login'}{'loginvia'}{$hostname}{'serverpath'} eq 'custom') { + + $designhash{$udom.'.login.loginvia_'.$hostname} = $server.':'.$domconfig{'login'}{'loginvia'}{$hostname}{'custompath'}; + } else { + $designhash{$udom.'.login.loginvia_'.$hostname} = $server.':'.$domconfig{'login'}{'loginvia'}{$hostname}{'serverpath'}; } - } elsif ($key eq 'headtag') { - if ($domconfig{'login'}{'headtag'}{$hostname}{'url'}) { - $designhash{$udom.'.login.headtag_'.$hostname} = $domconfig{'login'}{'headtag'}{$hostname}{'url'}; + if ($domconfig{'login'}{'loginvia'}{$hostname}{'exempt'}) { + $designhash{$udom.'.login.loginvia_exempt_'.$hostname} = $domconfig{'login'}{'loginvia'}{$hostname}{'exempt'}; } } - if ($domconfig{'login'}{$key}{$hostname}{'exempt'}) { - $designhash{$udom.'.login.'.$key.'_exempt_'.$hostname} = $domconfig{'login'}{$key}{$hostname}{'exempt'}; - } } } } @@ -4961,7 +4801,7 @@ sub designparm { Inputs: $url (usually will be undef). -Returns: Path to Authoring Space containing the resource or +Returns: Path to Construction Space containing the resource or directory being viewed (or for which action is being taken). If $url is provided, and begins /priv// the path will be that portion of the $context argument. @@ -5024,7 +4864,7 @@ Input: (optional) filename from which br is appropriate for use in building the breadcrumb trail. Returns: HTML div with CSTR path and recent box - To be included on Authoring Space pages + To be included on Construction Space pages =cut @@ -5039,7 +4879,7 @@ sub CSTR_pageheader { my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'}; my ($udom,$uname,$thisdisfn)= - ($trailfile =~ m{^\Q$londocroot\E/priv/([^/]+)/([^/]+)(?:|/(.*))$}); + ($trailfile =~ m{^\Q$londocroot\E/priv/([^/]+)/([^/]+)/(.*)$}); my $formaction = "/priv/$udom/$uname/$thisdisfn"; $formaction =~ s{/+}{/}g; @@ -5055,7 +4895,7 @@ sub CSTR_pageheader { my $output = '
' .&Apache::loncommon::help_open_menu('','',3,'Authoring') #FIXME: Broken? Where is it? - .''.&mt('Authoring Space:').' ' + .''.&mt('Construction Space:').' ' .'
' #FIXME lonpubdir: target="_parent" .&Apache::lonhtmlcommon::crumbs($uname.'/'.$parentpath,'_top','/priv/'.$udom,undef,undef); @@ -5114,19 +4954,12 @@ Inputs: =item * $bgcolor, used to override the bgcolor on a webpage to a specific value -=item * $no_inline_link, if true and in remote mode, don't show the - 'Switch To Inline Menu' link - =item * $args, optional argument valid values are no_auto_mt_title -> prevents &mt()ing the title arg inherit_jsmath -> when creating popup window in a page, should it have jsmath forced on by the current page -=item * $advtoolsref, optional argument, ref to an array containing - inlineremote items to be added in "Functions" menu below - breadcrumbs. - =back Returns: A uniform header for LON-CAPA web pages. @@ -5138,7 +4971,7 @@ other decorations will be returned. sub bodytag { my ($title,$function,$addentries,$bodyonly,$domain,$forcereg, - $no_nav_bar,$bgcolor,$no_inline_link,$args,$advtoolsref)=@_; + $no_nav_bar,$bgcolor,$args)=@_; my $public; if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) @@ -5146,7 +4979,6 @@ sub bodytag { $public = 1; } if (!$args->{'no_auto_mt_title'}) { $title = &mt($title); } - my $httphost = $args->{'use_absolute'}; $function = &get_users_function() if (!$function); my $img = &designparm($function.'.img',$domain); @@ -5162,10 +4994,7 @@ sub bodytag { @design{keys(%$addentries)} = @$addentries{keys(%$addentries)}; # role and realm - my ($role,$realm) = split(m{\./},$env{'request.role'},2); - if ($realm) { - $realm = '/'.$realm; - } + my ($role,$realm) = split(/\./,$env{'request.role'},2); if ($role eq 'ca') { my ($rdom,$rname) = ($realm =~ m{^/($match_domain)/($match_username)$}); $realm = &plainname($rname,$rdom); @@ -5191,14 +5020,16 @@ sub bodytag { my $bodytag = "". &Apache::lontexconvert::init_math_support($args->{'inherit_jsmath'}); - &get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['inhibitmenu']); - - if (($bodyonly) || ($no_nav_bar) || ($env{'form.inhibitmenu'} eq 'yes')) { + if ($bodyonly) { return $bodytag; - } + } + my $name = &plainname($env{'user.name'},$env{'user.domain'}); if ($public) { undef($role); + } else { + $name = &aboutmewrapper($name,$env{'user.name'},$env{'user.domain'}, + undef,'LC_menubuttons_link'); } my $titleinfo = '

'.$title.'

'; @@ -5214,78 +5045,53 @@ sub bodytag { } $role = '('.$role.')' if $role; + &get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['inhibitmenu']); - if ($env{'request.state'} eq 'construct') { $forcereg=1; } - - + if ($no_nav_bar || $env{'form.inhibitmenu'} eq 'yes') { + return $bodytag; + } - my $funclist; - if (($env{'environment.remote'} eq 'on') && ($env{'request.state'} ne 'construct')) { - $bodytag .= Apache::lonhtmlcommon::scripttag(Apache::lonmenu::utilityfunctions($httphost), 'start')."\n". - Apache::lonmenu::serverform(); - my $forbodytag; - &Apache::lonmenu::prepare_functions($env{'request.noversionuri'}, - $forcereg,$args->{'group'}, - $args->{'bread_crumbs'}, - $advtoolsref,'',\$forbodytag); - unless (ref($args->{'bread_crumbs'}) eq 'ARRAY') { - $funclist = $forbodytag; - } - } else { + if ($env{'request.state'} eq 'construct') { $forcereg=1; } # if ($env{'request.state'} eq 'construct') { # $titleinfo = &CSTR_pageheader(); #FIXME: Will be removed once all scripts have their own calls # } - $bodytag .= Apache::lonhtmlcommon::scripttag( - Apache::lonmenu::utilityfunctions($httphost), 'start'); - my ($left,$right) = Apache::lonmenu::primary_menu(); if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { - if ($dc_info) { + if ($dc_info) { $dc_info = qq|$dc_info|; - } - $bodytag .= qq|
$left $role
- $realm $dc_info
|; + } + $bodytag .= qq|
$name $role
+ $realm $dc_info
|; return $bodytag; } unless ($env{'request.symb'} =~ m/\.page___\d+___/) { - $bodytag .= qq|
$left $role
|; + $bodytag .= qq|
$name $role
|; } - $bodytag .= $right; + $bodytag .= Apache::lonhtmlcommon::scripttag( + Apache::lonmenu::utilityfunctions(), 'start'); + + $bodytag .= Apache::lonmenu::primary_menu(); if ($dc_info) { $dc_info = &dc_courseid_toggle($dc_info); } $bodytag .= qq|
$realm $dc_info
|; - #if directed to not display the secondary menu, don't. - if ($args->{'no_secondary_menu'}) { - return $bodytag; - } #don't show menus for public users if (!$public){ - $bodytag .= Apache::lonmenu::secondary_menu($httphost); + $bodytag .= Apache::lonmenu::secondary_menu(); $bodytag .= Apache::lonmenu::serverform(); $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); if ($env{'request.state'} eq 'construct') { $bodytag .= &Apache::lonmenu::innerregister($forcereg, $args->{'bread_crumbs'}); } elsif ($forcereg) { - $bodytag .= &Apache::lonmenu::innerregister($forcereg,undef, - $args->{'group'}); - } else { - my $forbodytag; - &Apache::lonmenu::prepare_functions($env{'request.noversionuri'}, - $forcereg,$args->{'group'}, - $args->{'bread_crumbs'}, - $advtoolsref,'',\$forbodytag); - unless (ref($args->{'bread_crumbs'}) eq 'ARRAY') { - $bodytag .= $forbodytag; - } + $bodytag .= &Apache::lonmenu::innerregister($forcereg); } }else{ # this is to seperate menu from content when there's no secondary @@ -5295,54 +5101,6 @@ sub bodytag { } return $bodytag; - } - -# -# Top frame rendering, Remote is up -# - - my $imgsrc = $img; - if ($img =~ /^\/adm/) { - $imgsrc = &lonhttpdurl($img); - } - my $upperleft=''.$function.''; - - my $help=($no_inline_link?'' - :&Apache::loncommon::top_nav_help('Help')); - - # Explicit link to get inline menu - my $menu= ($no_inline_link?'' - :''.&mt('Switch to Inline Menu Mode').''); - - if ($dc_info) { - $dc_info = qq|($dc_info)|; - } - - my $name = &plainname($env{'user.name'},$env{'user.domain'}); - unless ($public) { - $name = &aboutmewrapper($name,$env{'user.name'},$env{'user.domain'}, - undef,'LC_menubuttons_link'); - } - - unless ($env{'form.inhibitmenu'}) { - $bodytag .= qq|
$name $role
-
    -
  1. $help
  2. -
  3. $menu
  4. -
$realm $dc_info
|; - } - if ($env{'request.state'} eq 'construct') { - if (!$public){ - if ($env{'request.state'} eq 'construct') { - $funclist = &Apache::lonhtmlcommon::scripttag( - &Apache::lonmenu::utilityfunctions($httphost), 'start'). - &Apache::lonhtmlcommon::scripttag('','end'). - &Apache::lonmenu::innerregister($forcereg, - $args->{'bread_crumbs'}); - } - } - } - return $bodytag."\n".$funclist; } sub dc_courseid_toggle { @@ -5374,19 +5132,12 @@ sub make_attr_string { delete($attr_ref->{$key}); } } - if ($env{'environment.remote'} eq 'on') { - $attr_ref->{'onload'} = - &Apache::lonmenu::loadevents(). $on_load; - $attr_ref->{'onunload'}= - &Apache::lonmenu::unloadevents().$on_unload; - } else { - $attr_ref->{'onload'} = $on_load; - $attr_ref->{'onunload'}= $on_unload; - } + $attr_ref->{'onload'} = $on_load; + $attr_ref->{'onunload'}= $on_unload; } my $attr_string; - foreach my $attr (sort(keys(%$attr_ref))) { + foreach my $attr (keys(%$attr_ref)) { $attr_string .= " $attr=\"".$attr_ref->{$attr}.'" '; } return $attr_string; @@ -5517,14 +5268,6 @@ form, .inline { vertical-align:middle; } -.LC_floatleft { - float: left; -} - -.LC_floatright { - float: right; -} - .LC_400Box { width:400px; } @@ -5563,12 +5306,10 @@ form, .inline { .LC_error { color: red; + font-size: larger; } -.LC_warning { - color: darkorange; -} - +.LC_warning, .LC_diff_removed { color: red; } @@ -5731,11 +5472,11 @@ td.LC_table_cell_checkbox { text-align: left; } -.LC_head_subbox, .LC_actionbox { +.LC_head_subbox { clear:both; background: #F8F8F8; /* $sidebg; */ border: 1px solid $sidebg; - margin: 0 0 10px 0; + margin: 0 0 10px 0; padding: 3px; text-align: left; } @@ -5868,8 +5609,7 @@ table.LC_nested tr.LC_empty_row td { padding: 8px; } -table.LC_data_table tr.LC_empty_row td, -table.LC_data_table tr.LC_footer_row td { +table.LC_data_table tr.LC_empty_row td { background-color: $sidebg; } @@ -6431,6 +6171,7 @@ div.LC_docs_entry_move { table.LC_data_table tr > td.LC_docs_entry_commands, table.LC_data_table tr > td.LC_docs_entry_parameter { + background: #DDDDDD; font-size: x-small; } @@ -6595,19 +6336,6 @@ div.LC_edit_problem_saves { padding-bottom: 5px; } -.LC_edit_opt { - padding-left: 1em; - white-space: nowrap; -} - -.LC_edit_problem_latexhelper{ - text-align: right; -} - -#LC_edit_problem_colorful div{ - margin-left: 40px; -} - img.stift { border-width: 0; vertical-align: middle; @@ -6622,7 +6350,6 @@ div.LC_createcourse { } .LC_dccid { - float: right; margin: 0.2em 0 0 0; padding: 0; font-size: 90%; @@ -6695,10 +6422,6 @@ fieldset { /* overflow: hidden; */ } -article.geogebraweb div { - margin: 0; -} - fieldset > legend { font-weight: bold; padding: 0 5px 0 5px; @@ -6724,6 +6447,7 @@ fieldset > legend { } ol.LC_primary_menu { + float: right; margin: 0; padding: 0; background-color: $pgbg_or_bgcolor; @@ -6820,7 +6544,7 @@ ol.LC_docs_parameters li.LC_docs_paramet } ul#LC_secondary_menu { - clear: right; + clear: both; color: $fontmenu; background: $tabbg; list-style: none; @@ -6828,53 +6552,15 @@ ul#LC_secondary_menu { margin: 0; width: 100%; text-align: left; - float: left; } ul#LC_secondary_menu li { font-weight: bold; line-height: 1.8em; - border-right: 1px solid black; - vertical-align: middle; - float: left; -} - -ul#LC_secondary_menu li.LC_hoverable:hover, ul#LC_secondary_menu li.hover { - background-color: $data_table_light; -} - -ul#LC_secondary_menu li a { padding: 0 0.8em; -} - -ul#LC_secondary_menu li ul { - display: none; -} - -ul#LC_secondary_menu li:hover ul, ul#LC_secondary_menu li.hover ul { - display: block; - position: absolute; - margin: 0; - padding: 0; - list-style:none; - float: none; - background-color: $data_table_light; - z-index: 2; - margin-left: -1px; -} - -ul#LC_secondary_menu li ul li { - font-size: 90%; - vertical-align: top; - border-left: 1px solid black; border-right: 1px solid black; - background-color: $data_table_light; - list-style:none; - float: none; -} - -ul#LC_secondary_menu li ul li:hover, ul#LC_secondary_menu li ul li.hover { - background-color: $data_table_dark; + display: inline; + vertical-align: middle; } ul.LC_TabContent { @@ -7321,27 +7007,6 @@ ul.LC_funclist li { cursor:pointer; } -/* - styles used by TTH when "Default set of options to pass to tth/m - when converting TeX" in course settings has been set - - option passed: -t - -*/ - -td div.comp { margin-top: -0.6ex; margin-bottom: -1ex;} -td div.comb { margin-top: -0.6ex; margin-bottom: -.6ex;} -td div.hrcomp { line-height: 0.9; margin-top: -0.8ex; margin-bottom: -1ex;} -td div.norm {line-height:normal;} - -/* - option passed -y3 -*/ - -span.roman {font-family: serif; font-style: normal; font-weight: normal;} -span.overacc2 {position: relative; left: .8em; top: -1.2ex;} -span.overacc1 {position: relative; left: .6em; top: -1.2ex;} - END } @@ -7378,7 +7043,6 @@ sub headtag { my $function = $args->{'function'} || &get_users_function(); my $domain = $args->{'domain'} || &determinedomain(); my $bgcolor = $args->{'bgcolor'} || &designparm($function.'.pgbg',$domain); - my $httphost = $args->{'use_absolute'}; my $url = join(':',$env{'user.name'},$env{'user.domain'}, $Apache::lonnet::perlvar{'lonVersion'}, #time(), @@ -7389,23 +7053,20 @@ sub headtag { my $result = ''. - &font_settings($args); + &font_settings(); - my $inhibitprint; - if ($args->{'print_suppress'}) { - $inhibitprint = &print_suppression(); - } + my $inhibitprint = &print_suppression(); if (!$args->{'frameset'}) { $result .= &Apache::lonhtmlcommon::htmlareaheaders(); } - if ($args->{'force_register'}) { - $result .= &Apache::lonmenu::registerurl(1); + if ($args->{'force_register'} && $env{'request.noversionuri'} !~ m{^/res/adm/pages/}) { + $result .= Apache::lonxml::display_title(); } if (!$args->{'no_nav_bar'} && !$args->{'only_body'} && !$args->{'frameset'}) { - $result .= &help_menu_js($httphost); + $result .= &help_menu_js(); $result.=&modal_window(); $result.=&togglebox_script(); $result.=&wishlist_window(); @@ -7434,99 +7095,15 @@ sub headtag { ADDMETA - } else { - unless (($args->{'frameset'}) || ($args->{'js_ready'}) || ($args->{'only_body'}) || ($args->{'no_nav_bar'})) { - my $requrl = $env{'request.uri'}; - if ($requrl eq '') { - $requrl = $ENV{'REQUEST_URI'}; - $requrl =~ s/\?.+$//; - } - unless (($requrl =~ m{^/adm/(?:switchserver|login|authenticate|logout|groupsort|cleanup|helper|slotrequest|grades)(\?|$)}) || - (($requrl =~ m{^/res/}) && (($env{'form.submitted'} eq 'scantron') || - ($env{'form.grade_symb'}) || ($Apache::lonhomework::scantronmode)))) { - my $dom_in_use = $Apache::lonnet::perlvar{'lonDefDomain'}; - unless (&Apache::lonnet::allowed('mau',$dom_in_use)) { - my %domdefs = &Apache::lonnet::get_domain_defaults($dom_in_use); - if (ref($domdefs{'offloadnow'}) eq 'HASH') { - my $lonhost = $Apache::lonnet::perlvar{'lonHostID'}; - if ($domdefs{'offloadnow'}{$lonhost}) { - my $newserver = &Apache::lonnet::spareserver(30000,undef,1,$dom_in_use); - if (($newserver) && ($newserver ne $lonhost)) { - my $numsec = 5; - my $timeout = $numsec * 1000; - my ($newurl,$locknum,%locks,$msg); - if ($env{'request.role.adv'}) { - ($locknum,%locks) = &Apache::lonnet::get_locks(); - } - my $disable_submit = 0; - if ($requrl =~ /$LONCAPA::assess_re/) { - $disable_submit = 1; - } - if ($locknum) { - my @lockinfo = sort(values(%locks)); - $msg = &mt('Once the following tasks are complete: ')."\\n". - join(", ",sort(values(%locks)))."\\n". - &mt('your session will be transferred to a different server, after you click "Roles".'); - } else { - if (($requrl =~ m{^/res/}) && ($env{'form.submitted'} =~ /^part_/)) { - $msg = &mt('Your LON-CAPA submission has been recorded')."\\n"; - } - $msg .= &mt('Your current LON-CAPA session will be transferred to a different server in [quant,_1,second].',$numsec); - $newurl = '/adm/switchserver?otherserver='.$newserver; - if (($env{'request.role'}) && ($env{'request.role'} ne 'cm')) { - $newurl .= '&role='.$env{'request.role'}; - } - if ($env{'request.symb'}) { - $newurl .= '&symb='.$env{'request.symb'}; - } else { - $newurl .= '&origurl='.$requrl; - } - } - $result.=< - -OFFLOAD - } - } - } - } - } - } } if (!defined($title)) { $title = 'The LearningOnline Network with CAPA'; } if (!$args->{'no_auto_mt_title'}) { $title = &mt($title); } $result .= ' LON-CAPA '.$title.'' - .'{'frameset'}) { - $result .= ' /'; - } - $result .= '>' + .'' .$inhibitprint .$head_extra; - if ($env{'browser.mobile'}) { - $result .= ' - -'; - } return $result.''; } @@ -7536,21 +7113,15 @@ OFFLOAD Returns neccessary to set the proper encoding -Inputs: optional reference to HASH -- $args passed to &headtag() +Inputs: none =cut sub font_settings { - my ($args) = @_; my $headerstring=''; - if ((!$env{'browser.mathml'} && $env{'browser.unicode'}) || - ((ref($args) eq 'HASH') && ($args->{'browser.unicode'}))) { + if (!$env{'browser.mathml'} && $env{'browser.unicode'}) { $headerstring.= - '{'frameset'}) { - $headerstring.= ' /'; - } - $headerstring .= '>'."\n"; + ''; } return $headerstring; } @@ -7595,7 +7166,7 @@ sub print_suppression { } my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; - my $blocked = &blocking_status('printout',$cnum,$cdom,undef,1); + my $blocked = &blocking_status('printout',$cnum,$cdom); if ($blocked) { my $checkrole = "cm./$cdom/$cnum"; if ($env{'request.course.sec'} ne '') { @@ -7642,7 +7213,6 @@ Inputs: none =cut sub xml_begin { - my ($is_frameset) = @_; my $output=''; if ($env{'browser.mathml'}) { @@ -7654,12 +7224,9 @@ sub xml_begin { .'' .''; - } elsif ($is_frameset) { - $output=''."\n". - ''."\n"; } else { - $output=''."\n". - ''."\n"; + $output='' + .''; } return $output; } @@ -7703,16 +7270,12 @@ $args - additional optional args support skip_phases -> hash ref of head -> skip the generation body -> skip all generation - no_inline_link -> if true and in remote mode, don't show the - 'Switch To Inline Menu' link no_auto_mt_title -> prevent &mt()ing the title arg inherit_jsmath -> when creating popup window in a page, should it have jsmath forced on by the current page bread_crumbs -> Array containing breadcrumbs bread_crumbs_component -> if exists show it as headline else show only the breadcrumbs - group -> includes the current group, if page is for a - specific group =back @@ -7725,10 +7288,10 @@ sub start_page { #&Apache::lonnet::logthis("start_page ".join(':',caller(0))); $env{'internal.start_page'}++; - my ($result,@advtools); + my $result; if (! exists($args->{'skip_phases'}{'head'}) ) { - $result .= &xml_begin($args->{'frameset'}) . &headtag($title, $head_extra, $args); + $result .= &xml_begin() . &headtag($title, $head_extra, $args); } if (! exists($args->{'skip_phases'}{'body'}) ) { @@ -7742,8 +7305,7 @@ sub start_page { $args->{'function'}, $args->{'add_entries'}, $args->{'only_body'}, $args->{'domain'}, $args->{'force_register'}, $args->{'no_nav_bar'}, - $args->{'bgcolor'}, $args->{'no_inline_link'}, - $args, \@advtools); + $args->{'bgcolor'}, $args); } } @@ -7772,10 +7334,6 @@ sub start_page { &Apache::lonhtmlcommon::add_breadcrumb($crumb); } } - # if @advtools array contains items add then to the breadcrumbs - if (@advtools > 0) { - &Apache::lonmenu::advtools_crumbs(@advtools); - } #if bread_crumbs_component exists show it as headline else show only the breadcrumbs if(exists($args->{'bread_crumbs_component'})){ @@ -7783,11 +7341,6 @@ sub start_page { }else{ $result .= &Apache::lonhtmlcommon::breadcrumbs(); } - } elsif (($env{'environment.remote'} eq 'on') && - ($env{'form.inhibitmenu'} ne 'yes') && - ($env{'request.noversionuri'} =~ m{^/res/}) && - ($env{'request.noversionuri'} !~ m{^/res/adm/pages/})) { - $result .= '

'; } return $result; } @@ -7834,13 +7387,9 @@ function set_wishlistlink(title, path) { title = document.title; title = title.replace(/^LON-CAPA /,''); } - title = encodeURIComponent(title); - title = title.replace("'","\\\'"); if (!path) { path = location.pathname; } - path = encodeURIComponent(path); - path = path.replace("'","\\\'"); Win = window.open('/adm/wishlist?mode=newLink&setTitle='+title+'&setPath='+path, 'wishlistNewLink','width=560,height=350,scrollbars=0'); } @@ -7881,15 +7430,14 @@ var modalWindow = { $(".LCmodal-overlay").click(function(){modalWindow.close();}); } }; - var openMyModal = function(source,width,height,scrolling,transparency,style) + var openMyModal = function(source,width,height,scrolling) { - source = source.replace("'","'"); modalWindow.windowId = "myModal"; modalWindow.width = width; modalWindow.height = height; - modalWindow.content = ""; + modalWindow.content = "