--- loncom/interface/loncommon.pm 2008/09/11 15:15:29 1.684 +++ loncom/interface/loncommon.pm 2009/05/27 13:36:46 1.825 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.684 2008/09/11 15:15:29 www Exp $ +# $Id: loncommon.pm,v 1.825 2009/05/27 13:36:46 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -61,6 +61,7 @@ use POSIX qw(strftime mktime); use Apache::lonmenu(); use Apache::lonenc(); use Apache::lonlocal; +use Apache::lonnet(); use HTML::Entities; use Apache::lonhtmlcommon(); use Apache::loncoursedata(); @@ -68,6 +69,7 @@ use Apache::lontexconvert(); use Apache::lonclonecourse(); use LONCAPA qw(:DEFAULT :match); use DateTime::TimeZone; +use DateTime::Locale::Catalog; # ---------------------------------------------- Designs use vars qw(%defaultdesign); @@ -269,7 +271,7 @@ BEGIN { } } &Apache::lonnet::logthis( - "INFO: Read file types"); + "INFO: Read file types"); $readit=1; } # end of unless($readit) @@ -404,9 +406,10 @@ sub studentbrowser_javascript { || ($env{'request.role'}=~/^(au|dc|su)/) ) { return ''; } return (<<'ENDSTDBRW'); - ENDSTDBRW } sub selectstudent_link { - my ($form,$unameele,$udomele)=@_; + my ($form,$unameele,$udomele,$courseadvonly)=@_; + my $callargs = "'".$form."','".$unameele."','".$udomele."'"; if ($env{'request.course.id'}) { if (!&Apache::lonnet::allowed('srm',$env{'request.course.id'}) && !&Apache::lonnet::allowed('srm',$env{'request.course.id'}. '/'.$env{'request.course.sec'})) { return ''; } - return "".&mt('Select User').""; + if ($courseadvonly) { + $callargs .= ",'',1,1"; + } + return ''. + ''. + &mt('Select User').''; } if ($env{'request.role'}=~/^(au|dc|su)/) { - return "".&mt('Select User').""; + $callargs .= ",1"; + return ''. + ''. + &mt('Select User').''; } return ''; } sub authorbrowser_javascript { return <<"ENDAUTHORBRW"; - ENDAUTHORBRW } @@ -471,7 +485,8 @@ sub coursebrowser_javascript { my ($domainfilter,$sec_element,$formname)=@_; my $crs_or_grp_alert = &mt('Please select the type of LON-CAPA entity - Course or Group - for which you wish to add/modify a user role'); my $output = ' -'; return $output; } @@ -600,8 +620,13 @@ function setSect(sectionlist) { sub selectcourse_link { my ($form,$unameele,$udomele,$desc,$extra_element,$multflag,$selecttype)=@_; - return "".&mt('Select Course').""; + return '' + ."".&mt('Select Course').'' + .''; } sub selectauthor_link { @@ -657,6 +682,72 @@ sub select_timezone { return $output; } +sub select_datelocale { + my ($name,$selected,$onchange,$includeempty)=@_; + my $output='"; + $output.="\n".''; + ''; } sub gradeleveldescription { @@ -1687,7 +1787,7 @@ sub select_level_form { =pod -=item * &select_dom_form($defdom,$name,$includeempty,$showdomdesc) +=item * &select_dom_form($defdom,$name,$includeempty,$showdomdesc,$autosubmit) Returns a string containing a \n"; + my $selectdomain = "'."\n"; if ($default) { - $result .= ''."\n"; } foreach my $hostid (sort(keys(%servers))) { @@ -2056,14 +2162,14 @@ sub authform_kerberos { $autharg,$jscall); my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); if ($in{'kerb_def_auth'} eq 'krb5') { - $check5 = ' checked="on"'; + $check5 = ' checked="checked"'; } else { - $check4 = ' checked="on"'; + $check4 = ' checked="checked"'; } $krbarg = $in{'kerb_def_dom'}; if (defined($in{'curr_authtype'})) { if ($in{'curr_authtype'} eq 'krb') { - $krbcheck = ' checked="on"'; + $krbcheck = ' checked="checked"'; if (defined($in{'mode'})) { if ($in{'mode'} eq 'modifyuser') { $krbcheck = ''; @@ -2071,10 +2177,10 @@ sub authform_kerberos { } if (defined($in{'curr_kerb_ver'})) { if ($in{'curr_krb_ver'} eq '5') { - $check5 = ' checked="on"'; + $check5 = ' checked="checked"'; $check4 = ''; } else { - $check4 = ' checked="on"'; + $check4 = ' checked="checked"'; $check5 = ''; } } @@ -2095,7 +2201,7 @@ sub authform_kerberos { } } else { if ($authnum == 1) { - $authtype = ''; + $authtype = ''; } } if (!$can_assign{'krb4'} && !$can_assign{'krb5'}) { @@ -2104,7 +2210,7 @@ sub authform_kerberos { if (defined($in{'mode'})) { if ($in{'mode'} eq 'modifycourse') { if ($authnum == 1) { - $authtype = ''; + $authtype = ''; } } } @@ -2165,7 +2271,7 @@ sub authform_internal{ if (defined($in{'curr_authtype'})) { if ($in{'curr_authtype'} eq 'int') { if ($can_assign{'int'}) { - $intcheck = 'checked="on" '; + $intcheck = 'checked="checked" '; if (defined($in{'mode'})) { if ($in{'mode'} eq 'modifyuser') { $intcheck = ''; @@ -2181,7 +2287,7 @@ sub authform_internal{ } } else { if ($authnum == 1) { - $authtype = ''; + $authtype = ''; } } if (!$can_assign{'int'}) { @@ -2190,7 +2296,7 @@ sub authform_internal{ if (defined($in{'mode'})) { if ($in{'mode'} eq 'modifycourse') { if ($authnum == 1) { - $authtype = ''; + $authtype = ''; } } } @@ -2205,7 +2311,7 @@ sub authform_internal{ $result = &mt ('[_1] Internally authenticated (with initial password [_2])', ''.$autharg); - $result.="'; + $result.="'; return $result; } @@ -2220,7 +2326,7 @@ sub authform_local{ if (defined($in{'curr_authtype'})) { if ($in{'curr_authtype'} eq 'loc') { if ($can_assign{'loc'}) { - $loccheck = 'checked="on" '; + $loccheck = 'checked="checked" '; if (defined($in{'mode'})) { if ($in{'mode'} eq 'modifyuser') { $loccheck = ''; @@ -2236,7 +2342,7 @@ sub authform_local{ } } else { if ($authnum == 1) { - $authtype = ''; + $authtype = ''; } } if (!$can_assign{'loc'}) { @@ -2245,7 +2351,7 @@ sub authform_local{ if (defined($in{'mode'})) { if ($in{'mode'} eq 'modifycourse') { if ($authnum == 1) { - $authtype = ''; + $authtype = ''; } } } @@ -2274,7 +2380,7 @@ sub authform_filesystem{ if (defined($in{'curr_authtype'})) { if ($in{'curr_authtype'} eq 'fsys') { if ($can_assign{'fsys'}) { - $fsyscheck = 'checked="on" '; + $fsyscheck = 'checked="checked" '; if (defined($in{'mode'})) { if ($in{'mode'} eq 'modifyuser') { $fsyscheck = ''; @@ -2287,7 +2393,7 @@ sub authform_filesystem{ } } else { if ($authnum == 1) { - $authtype = ''; + $authtype = ''; } } if (!$can_assign{'fsys'}) { @@ -2296,7 +2402,7 @@ sub authform_filesystem{ if (defined($in{'mode'})) { if ($in{'mode'} eq 'modifycourse') { if ($authnum == 1) { - $authtype = ''; + $authtype = ''; } } } @@ -2664,6 +2770,43 @@ sub flush_email_cache { &Apache::lonnet::devalidate_cache_new('emailscache',$id); } +# -------------------------------------------------------------------- getlangs + +=pod + +=item * &getlangs($uname,$udom) + +Gets a user's language preference and returns it as a hash with key: +language. + +=cut + + +sub getlangs { + my ($uname,$udom) = @_; + if (!$udom) { $udom =$env{'user.domain'}; } + if (!$uname) { $uname=$env{'user.name'}; } + my $id=$uname.':'.$udom; + my ($langs,$cached)=&Apache::lonnet::is_cached_new('userlangs',$id); + if ($cached) { + return %{$langs}; + } else { + my %loadlangs=&Apache::lonnet::get('environment',['languages'], + $udom,$uname); + &Apache::lonnet::do_cache_new('userlangs',$id,\%loadlangs); + return %loadlangs; + } +} + +sub flush_langs_cache { + my ($uname,$udom)=@_; + if (!$udom) { $udom =$env{'user.domain'}; } + if (!$uname) { $uname=$env{'user.name'}; } + return if ($udom eq 'public' && $uname eq 'public'); + my $id=$uname.':'.$udom; + &Apache::lonnet::devalidate_cache_new('userlangs',$id); +} + # ------------------------------------------------------------------ Screenname =pod @@ -2683,6 +2826,26 @@ sub screenname { } +# ------------------------------------------------------------- Confirm Wrapper +=pod + +=item confirmwrapper + +Wrap messages about completion of operation in box + +=cut + +sub confirmwrapper { + my ($message)=@_; + if ($message) { + return "\n".'
'."\n" + .$message."\n" + .'
'."\n"; + } else { + return $message; + } +} + # ------------------------------------------------------------- Message Wrapper sub messagewrapper { @@ -2693,6 +2856,7 @@ sub messagewrapper { '&subject='.&escape($subject).'&text='.&escape($text).'" '. 'title="'.&mt('Send message').'">'.$link.''; } + # --------------------------------------------------------------- Notes Wrapper sub noteswrapper { @@ -2700,6 +2864,7 @@ sub noteswrapper { return "$link"; } + # ------------------------------------------------------------- Aboutme Wrapper sub aboutmewrapper { @@ -2708,20 +2873,18 @@ sub aboutmewrapper { return; } return ''.$link.''; + ($target?' target="$target"':'').' title="'.&mt("View this user's personal information page").'">'.$link.''; } # ------------------------------------------------------------ Syllabus Wrapper - sub syllabuswrapper { - my ($linktext,$coursedir,$domain,$fontcolor)=@_; - if ($fontcolor) { - $linktext=''.$linktext.''; - } + my ($linktext,$coursedir,$domain)=@_; return qq{$linktext}; } +# ----------------------------------------------------------------------------- + sub track_student_link { my ($linktext,$sname,$sdom,$target,$start) = @_; my $link ="/adm/trackstudent?"; @@ -2743,6 +2906,27 @@ sub track_student_link { &help_open_topic('View_recent_activity'); } +sub slot_reservations_link { + my ($linktext,$sname,$sdom,$target) = @_; + my $link ="/adm/slotrequest?command=showresv&origin=aboutme"; + my $title = 'View slot reservation history'; + if (defined($sname) && $sname !~ /^\s*$/ && + defined($sdom) && $sdom !~ /^\s*$/) { + $link .= "&uname=$sname&udom=$sdom"; + $title .= ' of this student'; + } + if (defined($target) && $target !~ /^\s*$/) { + $target = qq{target="$target"}; + } else { + $target = ''; + } + $title = &mt($title); + $linktext = &mt($linktext); + return qq{$linktext}; +# FIXME uncomment when help item created: &help_open_topic('Slot_Reservation_History'); + +} + # ===================================================== Display a student photo @@ -2945,7 +3129,7 @@ sub fileextensions { sub display_languages { my %languages=(); - foreach my $lang (&preferred_languages()) { + foreach my $lang (&Apache::lonlocal::preferred_languages()) { $languages{$lang}=1; } &get_unprocessed_cgi($ENV{'QUERY_STRING'},['displaylanguage']); @@ -2957,54 +3141,9 @@ sub display_languages { return %languages; } -sub preferred_languages { - my @languages=(); - if (($env{'request.role.adv'}) && ($env{'form.languages'})) { - @languages=(@languages,split(/\s*(\,|\;|\:)\s*/,$env{'form.languages'})); - } - if ($env{'course.'.$env{'request.course.id'}.'.languages'}) { - @languages=(@languages,split(/\s*(\,|\;|\:)\s*/, - $env{'course.'.$env{'request.course.id'}.'.languages'})); - } - - if ($env{'environment.languages'}) { - @languages=(@languages, - split(/\s*(\,|\;|\:)\s*/,$env{'environment.languages'})); - } - my $browser=$ENV{'HTTP_ACCEPT_LANGUAGE'}; - if ($browser) { - my @browser = - map { (split(/\s*;\s*/,$_))[0] } (split(/\s*,\s*/,$browser)); - push(@languages,@browser); - } - - foreach my $domtype ($env{'user.domain'},$env{'request.role.domain'}, - $Apache::lonnet::perlvar{'lonDefDomain'}) { - if ($domtype ne '') { - my %domdefs = &Apache::lonnet::get_domain_defaults($domtype); - if ($domdefs{'lang_def'} ne '') { - push(@languages,$domdefs{'lang_def'}); - } - } - } -# turn "en-ca" into "en-ca,en" - my @genlanguages; - foreach my $lang (@languages) { - unless ($lang=~/\w/) { next; } - push(@genlanguages,$lang); - if ($lang=~/(\-|\_)/) { - push(@genlanguages,(split(/(\-|\_)/,$lang))[0]); - } - } - #uniqueify the languages list - my %count; - @genlanguages = map { $count{$_}++ == 0 ? $_ : () } @genlanguages; - return @genlanguages; -} - sub languages { my ($possible_langs) = @_; - my @preferred_langs = &preferred_languages(); + my @preferred_langs = &Apache::lonlocal::preferred_languages(); if (!ref($possible_langs)) { if( wantarray ) { return @preferred_langs; @@ -3025,6 +3164,29 @@ sub languages { return $preferred_possibilities[0]; } +sub user_lang { + my ($touname,$toudom,$fromcid) = @_; + my @userlangs; + if (($fromcid ne '') && ($env{'course.'.$fromcid.'.languages'} ne '')) { + @userlangs=(@userlangs,split(/\s*(\,|\;|\:)\s*/, + $env{'course.'.$fromcid.'.languages'})); + } else { + my %langhash = &getlangs($touname,$toudom); + if ($langhash{'languages'} ne '') { + @userlangs = split(/\s*(\,|\;|\:)\s*/,$langhash{'languages'}); + } else { + my %domdefs = &Apache::lonnet::get_domain_defaults($toudom); + if ($domdefs{'lang_def'} ne '') { + @userlangs = ($domdefs{'lang_def'}); + } + } + } + my @languages=&Apache::lonlocal::get_genlanguages(@userlangs); + my $user_lh = Apache::localize->get_handle(@languages); + return $user_lh; +} + + ############################################################### ## Student Answer Attempts ## ############################################################### @@ -3163,7 +3325,7 @@ sub relative_to_absolute { } $thisdir=~s-/[^/]*$--; foreach my $link (@rlinks) { - unless (($link=~/^http:\/\//i) || + unless (($link=~/^https?\:\/\//i) || ($link=~/^\//) || ($link=~/^javascript:/i) || ($link=~/^mailto:/i) || @@ -3348,16 +3510,21 @@ sub pprmlink { sub timehash { - my @ltime=localtime(shift); - return ( 'seconds' => $ltime[0], - 'minutes' => $ltime[1], - 'hours' => $ltime[2], - 'day' => $ltime[3], - 'month' => $ltime[4]+1, - 'year' => $ltime[5]+1900, - 'weekday' => $ltime[6], - 'dayyear' => $ltime[7]+1, - 'dlsav' => $ltime[8] ); + my ($thistime) = @_; + my $timezone = &Apache::lonlocal::gettimezone(); + my $dt = DateTime->from_epoch(epoch => $thistime) + ->set_time_zone($timezone); + my $wday = $dt->day_of_week(); + if ($wday == 7) { $wday = 0; } + return ( 'second' => $dt->second(), + 'minute' => $dt->minute(), + 'hour' => $dt->hour(), + 'day' => $dt->day_of_month(), + 'month' => $dt->month(), + 'year' => $dt->year(), + 'weekday' => $wday, + 'dayyear' => $dt->day_of_year(), + 'dlsav' => $dt->is_dst() ); } sub utc_string { @@ -3367,6 +3534,24 @@ sub utc_string { sub maketime { my %th=@_; + my ($epoch_time,$timezone,$dt); + $timezone = &Apache::lonlocal::gettimezone(); + eval { + $dt = DateTime->new( year => $th{'year'}, + month => $th{'month'}, + day => $th{'day'}, + hour => $th{'hour'}, + minute => $th{'minute'}, + second => $th{'second'}, + time_zone => $timezone, + ); + }; + if (!$@) { + $epoch_time = $dt->epoch; + if ($epoch_time) { + return $epoch_time; + } + } return POSIX::mktime( ($th{'seconds'},$th{'minutes'},$th{'hours'}, $th{'day'},$th{'month'}-1,$th{'year'}-1900,0,0,-1)); @@ -3717,7 +3902,7 @@ sub blocking_status { &Apache::lonnet::coursedescription($course); $coursedesc = $courseinfo{'description'}; } - $category = "Group files in the course '$coursedesc'"; + $category = "Group portfolio in the course '$coursedesc'"; } else { $category = 'Portfolio files belonging to '; if ($env{'user.name'} eq 'public' && @@ -3849,7 +4034,14 @@ sub get_domainconf { if (ref($domconfig{'login'}) eq 'HASH') { if (keys(%{$domconfig{'login'}})) { foreach my $key (keys(%{$domconfig{'login'}})) { - $designhash{$udom.'.login.'.$key}=$domconfig{'login'}{$key}; + if (ref($domconfig{'login'}{$key}) eq 'HASH') { + foreach my $img (keys(%{$domconfig{'login'}{$key}})) { + $designhash{$udom.'.login.'.$key.'_'.$img} = + $domconfig{'login'}{$key}{$img}; + } + } else { + $designhash{$udom.'.login.'.$key}=$domconfig{'login'}{$key}; + } } } else { $legacy{'login'} = 1; @@ -3964,41 +4156,92 @@ Returns: value of designparamter $which ############################################## sub designparm { my ($which,$domain)=@_; - if ($env{'browser.blackwhite'} eq 'on') { - if ($which=~/\.(font|alink|vlink|link|textcol)$/) { - return '#000000'; - } - if ($which=~/\.(pgbg|sidebg|bgcol)$/) { - return '#FFFFFF'; - } - if ($which=~/\.tabbg$/) { - return '#CCCCCC'; - } - } if (exists($env{'environment.color.'.$which})) { - return $env{'environment.color.'.$which}; + return $env{'environment.color.'.$which}; } $domain=&determinedomain($domain); my %domdesign = &get_domainconf($domain); my $output; if ($domdesign{$domain.'.'.$which} ne '') { - $output = $domdesign{$domain.'.'.$which}; + $output = $domdesign{$domain.'.'.$which}; } else { $output = $defaultdesign{$which}; } if (($which =~ /^(student|coordinator|author|admin)\.img$/) || ($which =~ /login\.(img|logo|domlogo|login)/)) { if ($output =~ m{^/(adm|res)/}) { - if ($output =~ m{^/res/}) { - my $local_name = &Apache::lonnet::filelocation('',$output); - &Apache::lonnet::repcopy($local_name); - } + if ($output =~ m{^/res/}) { + my $local_name = &Apache::lonnet::filelocation('',$output); + &Apache::lonnet::repcopy($local_name); + } $output = &lonhttpdurl($output); } } return $output; } +############################################## +=pod + +=item * &head_subbox() + +Inputs: $content (contains HTML code with page functions, etc.) + +Returns: HTML div with $content + To be included in page header + +=cut + +sub head_subbox { + my ($content)=@_; + my $output = + '
' #FIXME: solve conflicts with lonhtmlcommon:breadcrumbs LC_head_subbox + .$content + .'
' +} + +############################################## +=pod + +=item * &CSTR_pageheader() + +Inputs: ./. + +Returns: HTML div with CSTR path and recent box + To be included on Construction Space pages + +=cut + +sub CSTR_pageheader { + # this is for resources; directories have customtitle, and crumbs + # and select recent are created in lonpubdir.pm + my ($uname,$thisdisfn)= + ($env{'request.filename'} =~ m|^/home/([^/]+)/public_html/(.*)|); + my $formaction='/priv/'.$uname.'/'.$thisdisfn; + $formaction=~s/\/+/\//g; + + my $parentpath = ''; + my $lastitem = ''; + if ($thisdisfn =~ m-(.+/)([^/]*)$-) { + $parentpath = $1; + $lastitem = $2; + } else { + $lastitem = $thisdisfn; + } + return + '
' + .&Apache::loncommon::help_open_menu('','',3,'Authoring') #FIXME: Broken? Where is it? + .''.&mt('Construction Space:').' ' + .'
' #FIXME lonpubdir: target="_parent" + .&Apache::lonhtmlcommon::crumbs($uname.'/'.$parentpath,'_top','/priv','','+1',1)."$lastitem
" + #FIXME lonpubdir: &Apache::lonhtmlcommon::crumbs($uname.$thisdisfn.'/','_top','/priv','','+1',1)."
" + .&Apache::lonhtmlcommon::select_recent('construct','recent','this.form.action=this.form.recent.value;this.form.submit()') + .'
' + .&Apache::lonmenu::constspaceform() + .'
'; +} + ############################################### ############################################### @@ -4035,13 +4278,11 @@ Inputs: in the title box that appears, this text is not auto translated like the $title is -=item * $notopbar, if true, keep the 'what is this' info but remove the - navigational links +=item * $no_nav_bar, if true, keep the 'what is this' info but remove the + navigational links =item * $bgcolor, used to override the bgcolor on a webpage to a specific value -=item * $notitle, if true keep the nav controls, but remove the title bar - =item * $no_inline_link, if true and in remote mode, don't show the 'Switch To Inline Menu' link @@ -4062,7 +4303,7 @@ other decorations will be returned. sub bodytag { my ($title,$function,$addentries,$bodyonly,$domain,$forcereg,$customtitle, - $notopbar,$bgcolor,$notitle,$no_inline_link,$args)=@_; + $no_nav_bar,$bgcolor,$no_inline_link,$args)=@_; if (!$args->{'no_auto_mt_title'}) { $title = &mt($title); } @@ -4071,7 +4312,7 @@ sub bodytag { my $font = &designparm($function.'.font',$domain); my $pgbg = $bgcolor || &designparm($function.'.pgbg',$domain); - my %design = ( 'style' => 'margin-top: 0px', + my %design = ( 'style' => 'margin-top: 0', 'bgcolor' => $pgbg, 'text' => $font, 'alink' => &designparm($function.'.alink',$domain), @@ -4107,15 +4348,7 @@ sub bodytag { if ($bodyonly) { return $bodytag; - } elsif ($env{'browser.interface'} eq 'textual') { -# Accessibility - - $bodytag.=&Apache::lonmenu::menubuttons($forcereg,$forcereg); - if (!$notitle) { - $bodytag.='

LON-CAPA: '.$title.'

'; - } - return $bodytag; - } + } my $name = &plainname($env{'user.name'},$env{'user.domain'}); if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') { @@ -4139,7 +4372,7 @@ $realm  ENDROLE - my $titleinfo = ''.$title.''; + my $titleinfo = '

'.$title.'

'; if ($customtitle) { $titleinfo = $customtitle; } @@ -4161,43 +4394,19 @@ ENDROLE $forcereg=1; } - if (!$customtitle && $env{'request.state'} eq 'construct') { - # this is for resources; directories have customtitle, and crumbs - # and select recent are created in lonpubdir.pm - my ($uname,$thisdisfn)= - ($env{'request.filename'} =~ m|^/home/([^/]+)/public_html/(.*)|); - my $formaction='/priv/'.$uname.'/'.$thisdisfn; - $formaction=~s/\/+/\//g; - - my $parentpath = ''; - my $lastitem = ''; - if ($thisdisfn =~ m-(.+/)([^/]*)$-) { - $parentpath = $1; - $lastitem = $2; - } else { - $lastitem = $thisdisfn; - } - $titleinfo = - &Apache::loncommon::help_open_menu('','',3,'Authoring') - .''.&mt('Construction Space').': ' - .'
' - .&Apache::lonhtmlcommon::crumbs($uname.'/'.$parentpath,'_top','/priv','','+1',1)."$lastitem
" - .&Apache::lonhtmlcommon::select_recent('construct','recent','this.form.action=this.form.recent.value;this.form.submit()') - .'
' - .&Apache::lonmenu::constspaceform(); - } - - my $titletable; - if (!$notitle) { - $titletable = - ''. - "".$roleinfo. - '
$titleinfo $dc_info
'; - } - if ($notopbar) { + if (!$customtitle && $env{'request.state'} eq 'construct') { + $titleinfo = &CSTR_pageheader(); #FIXME: Will be removed once all scripts have their own calls + } + + my $titletable = '' + ."".$roleinfo + .'
$titleinfo $dc_info
'; + + if ($no_nav_bar) { $bodytag .= $titletable; } else { + $bodytag .= qq|
$name ($role)
+ $realm $dc_info
|; if ($env{'request.state'} eq 'construct') { $bodytag .= &Apache::lonmenu::menubuttons($forcereg,$forcereg, $titletable); @@ -4223,14 +4432,11 @@ ENDROLE my $menu= ($no_inline_link?'' :'
'.&mt('Switch to Inline Menu Mode').''); # - if ($notitle) { - return $bodytag; - } return(< -$upperleft - $messages  +$upperleft + $messages  $titleinfo $dc_info $menu $roleinfo @@ -4278,15 +4484,6 @@ sub make_attr_string { $attr_ref->{'style'}=$style.'; font-size: x-large;'; } - if ($env{'browser.blackwhite'} eq 'on') { - delete($attr_ref->{'font'}); - delete($attr_ref->{'link'}); - delete($attr_ref->{'alink'}); - delete($attr_ref->{'vlink'}); - delete($attr_ref->{'bgcolor'}); - delete($attr_ref->{'background'}); - } - my $attr_string; foreach my $attr (keys(%$attr_ref)) { $attr_string .= " $attr=\"".$attr_ref->{$attr}.'" '; @@ -4347,6 +4544,8 @@ sub standard_css { my $img = &designparm($function.'.img', $domain); my $tabbg = &designparm($function.'.tabbg', $domain); my $font = &designparm($function.'.font', $domain); + my $fontmenu = &designparm($function.'.fontmenu', $domain); +#second colour for later usage my $sidebg = &designparm($function.'.sidebg',$domain); my $pgbg_or_bgcolor = $bgcolor || @@ -4356,6 +4555,10 @@ sub standard_css { my $vlink = &designparm($function.'.vlink', $domain); my $link = &designparm($function.'.link', $domain); + my $loginbg = &designparm('login.sidebg',$domain); + my $bgcol = &designparm('login.bgcol',$domain); + my $textcol = &designparm('login.textcol',$domain); + my $sans = 'Verdana,Arial,Helvetica,sans-serif'; my $mono = 'monospace'; my $data_table_head = $tabbg; @@ -4373,34 +4576,64 @@ sub standard_css { my $mail_other_hover = '#669999'; my $table_header = '#DDDDDD'; my $feedback_link_bg = '#BBBBBB'; + my $lg_border_color = '#C8C8C8'; my $border = ($env{'browser.type'} eq 'explorer' || - $env{'browser.type'} eq 'safari' ) ? '0px 2px 0px 2px' - : '0px 3px 0px 4px'; + $env{'browser.type'} eq 'safari' ) ? '0 2px 0 2px' + : '0 3px 0 4px'; return < td { + background-color: #CCCCCC; + font-weight: bold; + text-align: left; } -table.LC_data_table tr.LC_odd_row > td, -table.LC_aboutme_port tr td { + +table.LC_data_table tr.LC_odd_row > td, +table.LC_pick_box tr > td.LC_odd_row { background-color: $data_table_light; padding: 2px; } + table.LC_data_table tr.LC_even_row > td, -table.LC_aboutme_port tr.LC_even_row td { +table.LC_pick_box tr > td.LC_even_row { background-color: $data_table_dark; + padding: 2px; } + table.LC_data_table tr.LC_data_table_highlight td { background-color: $data_table_darker; } + table.LC_data_table tr td.LC_leftcol_header { background-color: $data_table_head; font-weight: bold; } + table.LC_data_table tr.LC_empty_row td, table.LC_nested tr.LC_empty_row td { background-color: #FFFFFF; @@ -4687,15 +4990,19 @@ table.LC_nested tr.LC_empty_row td { text-align: center; padding: 8px; } + table.LC_nested tr.LC_empty_row td { padding: 4ex } + table.LC_nested_outer tr th { font-weight: bold; + color:$fontmenu; background-color: $data_table_head; - font-size: smaller; + font-size: small; border-bottom: 1px solid #000000; } + table.LC_nested_outer tr td.LC_subheader { background-color: $data_table_head; font-weight: bold; @@ -4703,20 +5010,24 @@ table.LC_nested_outer tr td.LC_subheader border-bottom: 1px solid #000000; text-align: right; } + table.LC_nested tr.LC_info_row td { - background-color: #CCC; + background-color: #CCCCCC; font-weight: bold; font-size: small; text-align: center; } + table.LC_nested tr.LC_info_row td.LC_left_item, table.LC_nested_outer tr th.LC_left_item { text-align: left; } + table.LC_nested td { - background-color: #FFF; + background-color: #FFFFFF; font-size: small; } + table.LC_nested_outer tr th.LC_right_item, table.LC_nested tr.LC_info_row td.LC_right_item, table.LC_nested tr.LC_odd_row td.LC_right_item, @@ -4725,18 +5036,18 @@ table.LC_nested tr td.LC_right_item { } table.LC_nested tr.LC_odd_row td { - background-color: #EEE; + background-color: #EEEEEE; } table.LC_createuser { } table.LC_createuser tr.LC_section_row td { - font-size: smaller; + font-size: small; } table.LC_createuser tr.LC_info_row td { - background-color: #CCC; + background-color: #CCCCCC; font-weight: bold; text-align: center; } @@ -4745,16 +5056,20 @@ table.LC_calendar { border: 1px solid #000000; border-collapse: collapse; } + table.LC_calendar_pickdate { font-size: xx-small; } + table.LC_calendar tr td { border: 1px solid #000000; vertical-align: top; } + table.LC_calendar tr td.LC_calendar_day_empty { background-color: $data_table_dark; } + table.LC_calendar tr td.LC_calendar_day_current { background-color: $data_table_highlight; } @@ -4762,97 +5077,90 @@ table.LC_calendar tr td.LC_calendar_day_ table.LC_mail_list tr.LC_mail_new { background-color: $mail_new; } + table.LC_mail_list tr.LC_mail_new:hover { background-color: $mail_new_hover; } + +table.LC_mail_list tr.LC_mail_even { +} + +table.LC_mail_list tr.LC_mail_odd { +} + table.LC_mail_list tr.LC_mail_read { background-color: $mail_read; } + table.LC_mail_list tr.LC_mail_read:hover { background-color: $mail_read_hover; } + table.LC_mail_list tr.LC_mail_replied { background-color: $mail_replied; } + table.LC_mail_list tr.LC_mail_replied:hover { background-color: $mail_replied_hover; } + table.LC_mail_list tr.LC_mail_other { background-color: $mail_other; } + table.LC_mail_list tr.LC_mail_other:hover { background-color: $mail_other_hover; } -table.LC_mail_list tr.LC_mail_even { -} -table.LC_mail_list tr.LC_mail_odd { -} - -table#LC_portfolio_actions { - width: auto; - background: $pgbg; - border: 0px; - border-spacing: 2px 2px; - padding: 0px; - margin: 0px; - border-collapse: separate; -} -table#LC_portfolio_actions td.LC_label { - background: $tabbg; - text-align: right; -} -table#LC_portfolio_actions td.LC_value { - background: $tabbg; +table.LC_data_table tr > td.LC_browser_file, +table.LC_data_table tr > td.LC_browser_file_published { + background: #CCFF88; } -table#LC_cstr_controls { - width: 100%; - border-collapse: collapse; -} -table#LC_cstr_controls tr td { - border: 4px solid $pgbg; - padding: 4px; - text-align: center; - background: $tabbg; +table.LC_data_table tr > td.LC_browser_file_locked, +table.LC_data_table tr > td.LC_browser_file_unpublished { + background: #FFAA99; } -table#LC_cstr_controls tr th { - border: 4px solid $pgbg; - background: $table_header; - text-align: center; - font-family: $sans; - font-size: smaller; + +table.LC_data_table tr > td.LC_browser_file_obsolete { + background: #AAAAAA; } -table#LC_browser { - +table.LC_data_table tr > td.LC_browser_file_modified, +table.LC_data_table tr > td.LC_browser_file_metamodified { + background: #FFFF77; } -table#LC_browser tr th { - background: $table_header; + +table.LC_data_table tr.LC_browser_folder > td { + background: #CCCCFF; } -table#LC_browser tr td { - padding: 2px; + +table.LC_data_table tr > td.LC_roles_is { +/* background: #77FF77; */ } -table#LC_browser tr.LC_browser_file, -table#LC_browser tr.LC_browser_file_published { - background: #CCFF88; + +table.LC_data_table tr > td.LC_roles_future { + background: #FFFF77; } -table#LC_browser tr.LC_browser_file_locked, -table#LC_browser tr.LC_browser_file_unpublished { - background: #FFAA99; + +table.LC_data_table tr > td.LC_roles_will { + background: #FFAA77; } -table#LC_browser tr.LC_browser_file_obsolete { - background: #AAAAAA; + +table.LC_data_table tr > td.LC_roles_expired { + background: #FF7777; } -table#LC_browser tr.LC_browser_file_modified, -table#LC_browser tr.LC_browser_file_metamodified { - background: #FFFF77; + +table.LC_data_table tr > td.LC_roles_will_not { + background: #AAFF77; } -table#LC_browser tr.LC_browser_folder { - background: #CCCCFF; + +table.LC_data_table tr > td.LC_roles_selected { + background: #11CC55; } + span.LC_current_location { - font-size: x-large; + font-size:larger; background: $pgbg; } @@ -4860,58 +5168,70 @@ span.LC_parm_menu_item { font-size: larger; font-family: $sans; } + span.LC_parm_scope_all { color: red; } + span.LC_parm_scope_folder { color: green; } + span.LC_parm_scope_resource { color: orange; } + span.LC_parm_part { color: blue; } + span.LC_parm_folder, span.LC_parm_symb { font-size: x-small; font-family: $mono; color: #AAAAAA; } -td.LC_parm_overview_level_menu, td.LC_parm_overview_map_menu, -td.LC_parm_overview_parm_selectors, td.LC_parm_overview_parm_restrictions { +td.LC_parm_overview_level_menu, +td.LC_parm_overview_map_menu, +td.LC_parm_overview_parm_selectors, +td.LC_parm_overview_restrictions { border: 1px solid black; border-collapse: collapse; } + table.LC_parm_overview_restrictions td { border-width: 1px 4px 1px 4px; border-style: solid; border-color: $pgbg; text-align: center; } + table.LC_parm_overview_restrictions th { background: $tabbg; border-width: 1px 4px 1px 4px; border-style: solid; border-color: $pgbg; } + table#LC_helpmenu { - border: 0px; + border: none; height: 55px; - border-spacing: 0px; + border-spacing: 0; } table#LC_helpmenu fieldset legend { font-size: larger; font-weight: bold; } + table#LC_helpmenu_links { width: 100%; border: 1px solid black; background: $pgbg; - padding: 0px; + padding: 0; border-spacing: 1px; } + table#LC_helpmenu_links tr td { padding: 1px; background: $tabbg; @@ -4919,11 +5239,13 @@ table#LC_helpmenu_links tr td { font-weight: bold; } -table#LC_helpmenu_links a:link, table#LC_helpmenu_links a:visited, +table#LC_helpmenu_links a:link, +table#LC_helpmenu_links a:visited, table#LC_helpmenu_links a:active { text-decoration: none; color: $font; } + table#LC_helpmenu_links a:hover { text-decoration: underline; color: $vlink; @@ -4933,27 +5255,33 @@ table#LC_helpmenu_links a:hover { border: 1px solid #339933; margin: -1px; } + .LC_chrt_popup_up { border: 1px solid yellow; margin: -1px; } + .LC_chrt_popup { border: 1px solid #8888FF; background: #CCCCFF; } + table.LC_pick_box { border-collapse: separate; background: white; border: 1px solid black; border-spacing: 1px; } + table.LC_pick_box td.LC_pick_box_title { background: $tabbg; font-weight: bold; text-align: right; + vertical-align: top; width: 184px; padding: 8px; } + table.LC_pick_box td.LC_selfenroll_pick_box_title { background: $tabbg; font-weight: bold; @@ -4966,28 +5294,34 @@ table.LC_pick_box td.LC_pick_box_value { text-align: left; padding: 8px; } + table.LC_pick_box td.LC_pick_box_select { text-align: left; padding: 8px; } + table.LC_pick_box td.LC_pick_box_separator { - padding: 0px; + padding: 0; height: 1px; background: black; } + table.LC_pick_box td.LC_pick_box_submit { text-align: right; } + table.LC_pick_box td.LC_evenrow_value { text-align: left; padding: 8px; background-color: $data_table_light; } + table.LC_pick_box td.LC_oddrow_value { text-align: left; padding: 8px; background-color: $data_table_light; } + table.LC_helpform_receipt { width: 620px; border-collapse: separate; @@ -4995,6 +5329,7 @@ table.LC_helpform_receipt { border: 1px solid black; border-spacing: 1px; } + table.LC_helpform_receipt td.LC_pick_box_title { background: $tabbg; font-weight: bold; @@ -5002,51 +5337,61 @@ table.LC_helpform_receipt td.LC_pick_box width: 184px; padding: 8px; } + table.LC_helpform_receipt td.LC_evenrow_value { text-align: left; padding: 8px; background-color: $data_table_light; } + table.LC_helpform_receipt td.LC_oddrow_value { text-align: left; padding: 8px; background-color: $data_table_light; } + table.LC_helpform_receipt td.LC_pick_box_separator { - padding: 0px; + padding: 0; height: 1px; background: black; } + span.LC_helpform_receipt_cat { font-weight: bold; } + table.LC_group_priv_box { background: white; border: 1px solid black; border-spacing: 1px; } + table.LC_group_priv_box td.LC_pick_box_title { background: $tabbg; font-weight: bold; text-align: right; width: 184px; } + table.LC_group_priv_box td.LC_groups_fixed { background: $data_table_light; text-align: center; } + table.LC_group_priv_box td.LC_groups_optional { background: $data_table_dark; text-align: center; } + table.LC_group_priv_box td.LC_groups_functionality { background: $data_table_darker; text-align: center; font-weight: bold; } + table.LC_group_priv td { text-align: left; - padding: 0px; + padding: 0; } table.LC_notify_front_page { @@ -5054,12 +5399,15 @@ table.LC_notify_front_page { border: 1px solid black; padding: 8px; } + table.LC_notify_front_page td { padding: 8px; } + .LC_navbuttons { margin: 2ex 0ex 2ex 0ex; } + .LC_topic_bar { font-family: $sans; font-weight: bold; @@ -5067,35 +5415,38 @@ table.LC_notify_front_page td { background: $tabbg; vertical-align: middle; margin: 2ex 0ex 2ex 0ex; + padding: 3px; } + .LC_topic_bar span { vertical-align: middle; } + .LC_topic_bar img { vertical-align: bottom; } + table.LC_course_group_status { margin: 20px; } + table.LC_status_selector td { vertical-align: top; text-align: center; padding: 4px; } -table.LC_descriptive_input td.LC_description { - vertical-align: top; - text-align: right; - font-weight: bold; -} + div.LC_feedback_link { clear: both; background: white; - width: 100%; + width: 100%; } + span.LC_feedback_link { background: $feedback_link_bg; font-size: larger; } + span.LC_message_link { background: $feedback_link_bg; font-size: larger; @@ -5114,33 +5465,49 @@ table.LC_prior_tries td { } .LC_answer_correct { - background: #AAFFAA; - color: black; + background: lightgreen; + font-family: $sans; + color: darkgreen; + padding: 6px; } + .LC_answer_charged_try { - background: #FFAAAA ! important; - color: black; + background: #FFAAAA; + font-family: $sans; + color: darkred; + padding: 6px; } -.LC_answer_not_charged_try, + +.LC_answer_not_charged_try, .LC_answer_no_grade, .LC_answer_late { - background: #FFFFAA; + background: lightyellow; + font-family: $sans; color: black; + padding: 6px; } + .LC_answer_previous { - background: #AAAAFF; - color: black; + background: lightblue; + font-family: $sans; + color: darkblue; + padding: 6px; } + .LC_answer_no_message { background: #FFFFFF; + font-family: $sans; color: black; + padding: 6px; } + .LC_answer_unknown { background: orange; + font-family: $sans; color: black; + padding: 6px; } - span.LC_prior_numerical, span.LC_prior_string, span.LC_prior_custom, @@ -5159,15 +5526,19 @@ table.LC_prior_option { width: 100%; border-collapse: collapse; } -table.LC_prior_rank, table.LC_prior_match { + +table.LC_prior_rank, +table.LC_prior_match { border-collapse: collapse; } + table.LC_prior_option tr td, table.LC_prior_rank tr td, table.LC_prior_match tr td { border: 1px solid #000000; } +td.LC_nobreak, span.LC_nobreak { white-space: nowrap; } @@ -5183,7 +5554,7 @@ span.LC_cusr_subheading { table.LC_docs_documents { background: #BBBBBB; - border-width: 0px; + border-width: 0; border-collapse: collapse; } @@ -5192,15 +5563,8 @@ table.LC_docs_documents td.LC_docs_docum padding: 4px; } -.LC_docs_course_commands div { - float: left; - border: 4px solid #AAAAAA; - padding: 4px; - background: #DDDDCC; -} - .LC_docs_entry_move { - border: 0px; + border: none; border-collapse: collapse; } @@ -5213,15 +5577,19 @@ table.LC_docs_documents td.LC_docs_docum background: #DDDDDD; font-size: x-small; } + .LC_docs_copy { color: #000099; } + .LC_docs_cut { color: #550044; } + .LC_docs_rename { color: #009900; } + .LC_docs_remove { color: #990000; } @@ -5235,6 +5603,7 @@ table.LC_docs_documents td.LC_docs_docum .LC_docs_editor td.LC_docs_entry_icon { background: #FFFFBB; } + .LC_docs_editor td.LC_docs_entry_parameter { background: #BBBBFF; font-size: x-small; @@ -5251,12 +5620,13 @@ table.LC_docs_adddocs th { table.LC_sty_begin { background: #BBFFBB; } + table.LC_sty_end { background: #FFBBBB; } table.LC_double_column { - border-width: 0px; + border-width: 0; border-collapse: collapse; width: 100%; padding: 2px; @@ -5271,7 +5641,7 @@ table.LC_double_column tr td.LC_left_col table.LC_double_column tr td.LC_right_col { top: 2px; - right: 2px; + right: 2px; width: 47%; vertical-align: top; } @@ -5295,33 +5665,18 @@ div.LC_clear_float_footer { clear: both; } - -div.LC_grade_select_mode { - font-family: $sans; -} -div.LC_grade_select_mode div div { - margin: 5px; -} -div.LC_grade_select_mode_selector { - margin: 5px; - float: left; -} -div.LC_grade_select_mode_selector_header { - font: bold medium $sans; -} -div.LC_grade_select_mode_type { - clear: left; -} - div.LC_grade_show_user { margin-top: 20px; border: 1px solid black; } + div.LC_grade_user_name { background: #DDDDEE; border-bottom: 1px solid black; - font: bold large $sans; + font-weight: bold; + font-size: large; } + div.LC_grade_show_user_odd_row div.LC_grade_user_name { background: #DDEEDD; } @@ -5335,12 +5690,15 @@ div.LC_grade_assign { width: 99%; background: #FFFFFF; } + div.LC_grade_show_problem_header, div.LC_grade_submissions_header, div.LC_grade_message_center_header, div.LC_grade_assign_header { - font: bold large $sans; + font-weight: bold; + font-size: large; } + div.LC_grade_show_problem_problem, div.LC_grade_submissions_body, div.LC_grade_message_center_body, @@ -5349,8 +5707,10 @@ div.LC_grade_assign_body { width: 99%; background: #FFFFFF; } + span.LC_grade_check_note { - font: normal medium $sans; + font-weight: normal; + font-size: medium; display: inline; position: absolute; right: 1em; @@ -5359,15 +5719,19 @@ span.LC_grade_check_note { table.LC_scantron_action { width: 100%; } + table.LC_scantron_action tr th { - font: normal bold $sans; + font-weight:bold; + font-style:normal; } -div.LC_edit_problem_header, +.LC_edit_problem_header, div.LC_edit_problem_footer { - font: normal medium $sans; + font-weight: normal; + font-size: medium; margin: 2px; } + div.LC_edit_problem_header, div.LC_edit_problem_header div, div.LC_edit_problem_footer, @@ -5376,58 +5740,65 @@ div.LC_edit_problem_editxml_header, div.LC_edit_problem_editxml_header div { margin-top: 5px; } + div.LC_edit_problem_header_edit_row { background: $tabbg; padding: 3px; margin-bottom: 5px; } + div.LC_edit_problem_header_title { - font: larger bold $sans; + font-weight: bold; + font-size: larger; background: $tabbg; padding: 3px; } + table.LC_edit_problem_header_title { - font: larger bold $sans; + font-size: larger; + font-weight: bold; width: 100%; border-color: $pgbg; border-style: solid; border-width: $border; - background: $tabbg; border-collapse: collapse; - padding: 0px + padding: 0; } div.LC_edit_problem_discards { float: left; padding-bottom: 5px; } + div.LC_edit_problem_saves { float: right; padding-bottom: 5px; } + hr.LC_edit_problem_divide { clear: both; color: $tabbg; background-color: $tabbg; height: 3px; - border: 0px; + border: none; } + img.stift{ - border-width:0; - vertical-align:middle; + border-width: 0; + vertical-align: middle; } table#LC_mainmenu{ margin-top:10px; width:80%; - } table#LC_mainmenu td.LC_mainmenu_col_fieldset{ vertical-align: top; width: 45%; } + .LC_mainmenu_fieldset_category { color: $font; background: $pgbg; @@ -5435,10 +5806,509 @@ table#LC_mainmenu td.LC_mainmenu_col_fie font-size: small; font-weight: bold; } -fieldset#LC_mainmenu_fieldset { - margin:0px 10px 10px 0px; +div.LC_createcourse { + margin: 10px 10px 10px 10px; +} + +/* ---- Remove when done ---- +# The following styles is part of the redesign of LON-CAPA and are +# subject to change during this project. +# Don't rely on their current functionality as they might be +# changed or removed. +# --------------------------*/ + +a:hover, +ol.LC_smallMenu a:hover, +ol#LC_MenuBreadcrumbs a:hover, +ol#LC_PathBreadcrumbs a:hover, +ul#LC_TabMainMenuContent a:hover, +.LC_FormSectionClearButton input:hover +ul.LC_TabContent li:hover a { + color:#BF2317; + text-decoration:none; +} + +h1 { + padding: 0; + line-height:130%; +} + +h2,h3,h4,h5,h6 { + margin: 5px 0 5px 0; + padding: 0; + line-height:130%; +} + +.LC_hcell { + padding:3px 15px 3px 15px; + margin: 0; + background-color:$tabbg; + color:$fontmenu; + border-bottom:solid 1px $lg_border_color; +} + +.LC_noBorder { + border: 0; +} + + +/* Main Header with discription of Person, Course, etc. */ + +.LC_Right { + float: right; + margin: 0; + padding: 0; } + +.LC_FormSectionClearButton input { + background-color:transparent; + border: none; + cursor:pointer; + text-decoration:underline; +} + +.LC_help_open_topic { + color: #FFFFFF; + background-color: #EEEEFF; + margin: 1px; + padding: 4px; + border: 1px solid #000033; + white-space: nowrap; +/* vertical-align: middle; */ +} + +dl,ul,div,fieldset { + margin: 10px 10px 10px 0; +/* overflow: hidden; */ +} + +#LC_nav_bar { + float: left; + margin: 0; +} + +#LC_nav_bar em{ + font-weight: bold; + font-style: normal; +} + +ol.LC_smallMenu { + float: right; +} + +ol.LC_smallMenu, ol#LC_PathBreadcrumbs { + margin: 0; +} + +ol.LC_smallMenu li { + display: inline; + padding: 5px 5px 0 10px; + vertical-align: top; +} + +ol.LC_smallMenu li img { + vertical-align: bottom; +} + +ol.LC_smallMenu a { + font-size: 90%; + color: RGB(80, 80, 80); + text-decoration: none; +} + +ul#LC_TabMainMenuContent { + clear: both; + color: $fontmenu; + background: $tabbg; + list-style: none; + padding: 0; + margin: 0; + float:left; + width: 100%; +} + +ul#LC_TabMainMenuContent li { + float: left; + font-weight: bold; + line-height: 1.8em; + padding: 0 0.8em; + border-right: 1px solid black; + display: inline; + vertical-align: middle; +} + +ul.LC_TabContent , +ul.LC_TabContentBigger { + display:block; + list-style:none; + margin: 0; + padding: 0; +} + +ul.LC_TabContent li, +ul.LC_TabContentBigger li { + display: inline; + border-right: solid 1px $lg_border_color; + float:left; + line-height:140%; + white-space:nowrap; +} + +ul#LC_TabMainMenuContent li a { + color: $fontmenu; + text-decoration: none; +} + +ul.LC_TabContent { + min-height:1.6em; +} + +ul.LC_TabContent li { + vertical-align:middle; + padding: 0 10px 0 10px; + background-color:$tabbg; + border-bottom:solid 1px $lg_border_color; +} + +ul.LC_TabContent li a, ul.LC_TabContent li { + color:rgb(47,47,47); + text-decoration:none; + font-size:95%; + font-weight:bold; + padding-right: 16px; +} + +ul.LC_TabContent li:hover, ul.LC_TabContent li.active { + background:#FFFFFF url(/adm/lonIcons/open.gif) no-repeat scroll right center; + border-bottom:solid 1px #FFFFFF; + padding-right: 16px; +} + +ul.LC_TabContentBigger li { + vertical-align:bottom; + border-top:solid 1px $lg_border_color; + border-left:solid 1px $lg_border_color; + padding:5px 10px 5px 10px; + margin-left:2px; + background:url(/adm/lonIcons/lightGreyBG.png) repeat-x left top; +} + +ul.LC_TabContentBigger li:hover, +ul.LC_TabContentBigger li.active { + background:url(/adm/lonIcons/lightGreyBG.png) repeat-x right bottom; +} + +ul.LC_TabContentBigger li, +ul.LC_TabContentBigger li a { + font-size:110%; + font-weight:bold; +} + +ol#LC_MenuBreadcrumbs, +ol#LC_PathBreadcrumbs, +ul#LC_CourseBreadcrumbs { + padding-left: 10px; + margin: 0; + list-style-position: inside; +} + +ol#LC_MenuBreadcrumbs li, +ol#LC_PathBreadcrumbs li, +ul#LC_CourseBreadcrumbs li { + display: inline; + padding: 0 0 0 10px; + overflow:hidden; +} + +ol#LC_MenuBreadcrumbs li a, +ul#LC_CourseBreadcrumbs li a { + text-decoration: none; + font-size:90%; +} + +ol#LC_PathBreadcrumbs li a { + text-decoration:none; + font-size:100%; + font-weight:bold; +} + +.LC_BoxPadding { + padding: 10px; +} + +.LC_ContentBoxSpecial { + border: solid 1px $lg_border_color; +} + +.LC_ContentBoxSpecialContactInfo { + border: solid 1px $lg_border_color; + max-width:25%; + min-width:25%; +} + +.LC_AboutMe_Image { + float:left; + margin-right:10px; +} + +.LC_Clear_AboutMe_Image { + clear:left; +} + +dl.LC_ListStyleClean dt { + padding-right: 5px; + display: table-header-group; +} + +dl.LC_ListStyleClean dd { + display: table-row; +} + +.LC_ListStyleClean, +.LC_ListStyleSimple, +.LC_ListStyleNormal, +.LC_ListStyle_Border, +.LC_ListStyleSpecial { + /*display:block; */ + list-style-position: inside; + list-style-type: none; + overflow: hidden; + padding: 0; +} + +.LC_ListStyleSimple li, +.LC_ListStyleSimple dd, +.LC_ListStyleNormal li, +.LC_ListStyleNormal dd, +.LC_ListStyleSpecial li, +.LC_ListStyleSpecial dd { + margin: 0; + padding: 5px 5px 5px 10px; + clear: both; +} + +.LC_ListStyleClean li, +.LC_ListStyleClean dd { + padding-top: 0; + padding-bottom: 0; +} + +.LC_ListStyleSimple dd, +.LC_ListStyleSimple li { + border-bottom: solid 1px $lg_border_color; +} + +.LC_ListStyleSpecial li, +.LC_ListStyleSpecial dd { + list-style-type: none; + background-color: RGB(220, 220, 220); + margin-bottom: 4px; +} + +table.LC_SimpleTable { + margin:5px; + border:solid 1px $lg_border_color; +} + +table.LC_SimpleTable tr { + padding: 0; + border:solid 1px $lg_border_color; +} + +table.LC_SimpleTable thead { + background:rgb(220,220,220); +} + +div.LC_columnSection { + display: block; + clear: both; + overflow: hidden; + margin: 0; +} + +div.LC_columnSection>* { + float: left; + margin: 10px 20px 10px 0; + overflow:hidden; +} + +.ContentBoxSpecialTemplate { + border: solid 1px $lg_border_color; +} + +.ContentBoxTemplate { + padding:10px; +} + +div.LC_columnSection > .ContentBoxTemplate, +div.LC_columnSection > .ContentBoxSpecialTemplate { + width: 600px; +} + +.clear { + clear: both; + line-height: 0; + font-size: 0; + height: 0; +} + +.LC_loginpage_container { + text-align:left; + margin : 0 auto; + width:90%; + padding: 10px; + height: auto; + background-color:#FFFFFF; + border:1px solid #CCCCCC; +} + + +.LC_loginpage_loginContainer { + float:left; + width: 182px; + padding: 2px; + border:1px solid #CCCCCC; + background-color:$loginbg; +} + +.LC_loginpage_loginContainer h2 { + margin-top: 0; + display:block; + background:$bgcol; + color:$textcol; + padding-left:5px; +} + +.LC_loginpage_loginInfo { + float:left; + width:182px; + border:1px solid #CCCCCC; + padding:2px; +} + +.LC_loginpage_space { + clear: both; + margin-bottom: 20px; + border-bottom: 1px solid #CCCCCC; +} + +.LC_loginpage_floatLeft { + float: left; + width: 200px; + margin: 0; +} + +table em { + font-weight: bold; + font-style: normal; +} + +table.LC_tableBrowseRes, +table.LC_tableOfContent { + border:none; + border-spacing: 1; + padding: 3px; + background-color: #FFFFFF; + font-size: 90%; +} + +table.LC_tableOfContent{ + border-collapse: collapse; +} + +table.LC_tableBrowseRes a, +table.LC_tableOfContent a { + background-color: transparent; + text-decoration: none; +} + +table.LC_tableBrowseRes tr.LC_trOdd, +table.LC_tableOfContent tr.LC_trOdd{ + background-color: #EEEEEE; +} + +table.LC_tableOfContent img { + border: none; + height: 1.3em; + vertical-align: text-bottom; + margin-right: 0.3em; +} + +a#LC_content_toolbar_firsthomework { + background-image:url(/res/adm/pages/open-first-problem.gif); +} + +a#LC_content_toolbar_launchnav { + background-image:url(/res/adm/pages/start-navigation.gif); +} + +a#LC_content_toolbar_closenav { + background-image:url(/res/adm/pages/close-navigation.gif); +} + +a#LC_content_toolbar_everything { + background-image:url(/res/adm/pages/show-all.gif); +} + +a#LC_content_toolbar_uncompleted { + background-image:url(/res/adm/pages/show-incomplete-problems.gif); +} + +#LC_content_toolbar_clearbubbles { + background-image:url(/res/adm/pages/mark-discussionentries-read.gif); +} + +a#LC_content_toolbar_changefolder { + background : url(/res/adm/pages/close-all-folders.gif) top center ; +} + +a#LC_content_toolbar_changefolder_toggled { + background-image:url(/res/adm/pages/open-all-folders.gif); +} + +ul#LC_toolbar li a:hover { + background-position: bottom center; +} + +ul#LC_toolbar { + padding: 0; + margin: 2px; + list-style:none; + position:relative; + background-color:white; +} + +ul#LC_toolbar li { + border:1px solid white; + padding: 0; + margin: 0; + float: left; + display:inline; + vertical-align:middle; +} + + +a.LC_toolbarItem { + display:block; + padding: 0; + margin: 0; + height: 32px; + width: 32px; + color:white; + border: none; + background-repeat:no-repeat; + background-color:transparent; +} + +ul.LC_functionslist li { + float: left; + white-space: nowrap; + height: 35px; /* at least as high as heighest list item */ + margin: 0 15px 15px 10px; +} + + END } @@ -5628,7 +6498,7 @@ $args - additional optional args support only_body -> is true will set &bodytag() onlybodytag arg on - no_nav_bar -> is true will set &bodytag() notopbar arg on + no_nav_bar -> is true will set &bodytag() no_nav_bar arg on add_entries -> additional attributes to add to the domain -> force to color decorate a page for a specific domain @@ -5647,7 +6517,6 @@ $args - additional optional args support is not auto translated like the $title is frameset -> if true will start with a rather than - no_title -> if true the title bar won't be shown skip_phases -> hash ref of head -> skip the generation body -> skip all generation @@ -5696,16 +6565,42 @@ sub start_page { $args->{'only_body'}, $args->{'domain'}, $args->{'force_register'}, $args->{'body_title'}, $args->{'no_nav_bar'}, $args->{'bgcolor'}, - $args->{'no_title'}, $args->{'no_inline_link'}, + $args->{'no_inline_link'}, $args); } } if ($args->{'js_ready'}) { - $result = &js_ready($result); + $result = &js_ready($result); } if ($args->{'html_encode'}) { - $result = &html_encode($result); + $result = &html_encode($result); + } + + # Preparation for new and consistent functionlist at top of screen + # if ($args->{'functionlist'}) { + # $result .= &build_functionlist(); + #} + + # Don't add anything more if only_body wanted + return $result if $args->{'only_body'}; + + #Breadcrumbs + if (exists($args->{'bread_crumbs'}) or exists($args->{'bread_crumbs_component'})) { + &Apache::lonhtmlcommon::clear_breadcrumbs(); + #if any br links exists, add them to the breadcrumbs + if (exists($args->{'bread_crumbs'}) and ref($args->{'bread_crumbs'}) eq 'ARRAY') { + foreach my $crumb (@{$args->{'bread_crumbs'}}){ + &Apache::lonhtmlcommon::add_breadcrumb($crumb); + } + } + + #if bread_crumbs_component exists show it as headline else show only the breadcrumbs + if(exists($args->{'bread_crumbs_component'})){ + $result .= &Apache::lonhtmlcommon::breadcrumbs($args->{'bread_crumbs_component'}); + }else{ + $result .= &Apache::lonhtmlcommon::breadcrumbs(); + } } return $result; } @@ -5853,7 +6748,7 @@ sub simple_error_page { } sub start_data_table_empty_row { - $row_count[0]++; +# $row_count[0]++; return ''."\n";; } @@ -5934,7 +6829,10 @@ Returns either 'student','coordinator',' ############################################### sub get_users_function { - my $function = 'student'; + my $function = 'norole'; + if ($env{'request.role'}=~/^(st)/) { + $function='student'; + } if ($env{'request.role'}=~/^(cc|in|ta|ep)/) { $function='coordinator'; } @@ -5952,6 +6850,38 @@ sub get_users_function { =pod +=item * &show_course() + +Used by lonmenu.pm and lonroles.pm to determine whether to use the word +'Courses' or 'Roles' in inline navigation and on screen displaying user's roles. + +Inputs: +None + +Outputs: +Scalar: 1 if 'Course' to be used, 0 otherwise. + +=cut + +############################################### +sub show_course { + my $course = !$env{'user.adv'}; + if (!$env{'user.adv'}) { + foreach my $env (keys(%env)) { + next if ($env !~ m/^user\.priv\./); + if ($env !~ m/^user\.priv\.(?:st|cm)/) { + $course = 0; + last; + } + } + } + return $course; +} + +############################################### + +=pod + =item * &check_user_status() Determines current status of supplied role for a @@ -6455,6 +7385,8 @@ If the user's status includes multiple t the largest default quota which applies to the user determines the default quota returned. +=back + =cut ############################################### @@ -6467,21 +7399,37 @@ sub default_quota { ['quotas'],$udom); if (ref($quotahash{'quotas'}) eq 'HASH') { if ($inststatus ne '') { - my @statuses = split(/:/,$inststatus); + my @statuses = map { &unescape($_); } split(/:/,$inststatus); foreach my $item (@statuses) { - if ($quotahash{'quotas'}{$item} ne '') { - if ($defquota eq '') { - $defquota = $quotahash{'quotas'}{$item}; - $settingstatus = $item; - } elsif ($quotahash{'quotas'}{$item} > $defquota) { - $defquota = $quotahash{'quotas'}{$item}; - $settingstatus = $item; + if (ref($quotahash{'quotas'}{'defaultquota'}) eq 'HASH') { + if ($quotahash{'quotas'}{'defaultquota'}{$item} ne '') { + if ($defquota eq '') { + $defquota = $quotahash{'quotas'}{'defaultquota'}{$item}; + $settingstatus = $item; + } elsif ($quotahash{'quotas'}{'defaultquota'}{$item} > $defquota) { + $defquota = $quotahash{'quotas'}{'defaultquota'}{$item}; + $settingstatus = $item; + } + } + } else { + if ($quotahash{'quotas'}{$item} ne '') { + if ($defquota eq '') { + $defquota = $quotahash{'quotas'}{$item}; + $settingstatus = $item; + } elsif ($quotahash{'quotas'}{$item} > $defquota) { + $defquota = $quotahash{'quotas'}{$item}; + $settingstatus = $item; + } } } } } if ($defquota eq '') { - $defquota = $quotahash{'quotas'}{'default'}; + if (ref($quotahash{'quotas'}{'defaultquota'}) eq 'HASH') { + $defquota = $quotahash{'quotas'}{'defaultquota'}{'default'}; + } else { + $defquota = $quotahash{'quotas'}{'default'}; + } $settingstatus = 'default'; } } else { @@ -6630,12 +7578,17 @@ sub user_picker { if ($cancreate) { $new_user_create = '

&"').'" onclick="javascript:setSearch(\'1\','.$caller.');" />

'; } else { - my $helplink = ' href="javascript:helpMenu('."'display'".')"'; + my $helplink = 'javascript:helpMenu('."'display'".')'; my %usertypetext = ( official => 'institutional', unofficial => 'non-institutional', ); - $new_user_create = '
'.&mt("You are not authorized to create new $usertypetext{$usertype} users in this domain.").' '.&mt('Contact the helpdesk for assistance.',$helplink).'

'; + $new_user_create = '

' + .&mt("You are not authorized to create new $usertypetext{$usertype} users in this domain.") + .' ' + .&mt('Please contact the [_1]helpdesk[_2] for assistance.' + ,'','') + .'


'; } } } @@ -6672,6 +7625,7 @@ ENDSCRIPT my $output = <<"END_BLOCK"; $new_user_create @@ -6917,6 +7872,7 @@ sub personal_data_fieldtitles { middlename => 'Middle Name', generation => 'Generation', gen => 'Generation', + inststatus => 'Affiliation', ); return %fieldtitles; } @@ -6986,8 +7942,57 @@ sub get_institutional_codes { =pod +=head1 Slot Helpers + +=over 4 + +=item * sorted_slots() + +Sorts an array of slot names in order of slot start time (earliest first). + +Inputs: + +=over 4 + +slotsarr - Reference to array of unsorted slot names. + +slots - Reference to hash of hash, where outer hash keys are slot names. + =back +Returns: + +=over 4 + +sorted - An array of slot names sorted by the start time of the slot. + +=back + +=back + +=cut + + +sub sorted_slots { + my ($slotsarr,$slots) = @_; + my @sorted; + if ((ref($slotsarr) eq 'ARRAY') && (ref($slots) eq 'HASH')) { + @sorted = + sort { + if (ref($slots->{$a}) && ref($slots->{$b})) { + return $slots->{$a}{'starttime'} <=> $slots->{$b}{'starttime'} + } + if (ref($slots->{$a})) { return -1;} + if (ref($slots->{$b})) { return 1;} + return 0; + } @{$slotsarr}; + } + return @sorted; +} + + +=pod + =head1 HTTP Helpers =over 4 @@ -7277,9 +8282,9 @@ sub upload_embedded { ' '. $orig_uploaded_filename.'
'; } else { - $output .= ''. + $output .= ''. &mt('View embedded file: [_1]',''. - $orig_uploaded_filename.'').'
'; + $orig_uploaded_filename.'').'
'; } } close($fh); @@ -7538,7 +8543,7 @@ sub upfile_select_html { # xml => &mt('HTML/XML'), ); my $Str = ''. - '
Type: '; foreach my $type (sort(keys(%Types))) { $Str .= '\n"; } @@ -7626,7 +8631,7 @@ sub csv_print_select_table { &end_data_table_header_row()."\n"); foreach my $array_ref (@$d) { my ($value,$display,$defaultcol)=@{ $array_ref }; - $r->print(&start_data_table_row().''.$display.''); + $r->print(&start_data_table_row().''.$display.''); $r->print('