--- loncom/interface/loncommon.pm 2007/04/16 22:50:44 1.523 +++ loncom/interface/loncommon.pm 2007/06/18 23:19:12 1.537 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.523 2007/04/16 22:50:44 albertel Exp $ +# $Id: loncommon.pm,v 1.537 2007/06/18 23:19:12 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -240,7 +240,7 @@ Inputs: formname, elementname formname and elementname specify the name of the html form and the name of the element the selection from the search results will be placed in. - +=back =cut sub browser_and_searcher_javascript { @@ -1467,6 +1467,8 @@ sub home_server_option_list { =pod +=back + =cut ############################################################### @@ -2052,6 +2054,7 @@ if $first is set to 'lastname' then it r ############################################################### sub plainname { my ($uname,$udom,$first)=@_; + return if (!defined($uname) || !defined($udom)); my %names=&getnames($uname,$udom); my $name=&Apache::lonnet::format_name($names{'firstname'}, $names{'middlename'}, @@ -2083,6 +2086,7 @@ if the user does not sub nickname { my ($uname,$udom)=@_; + return if (!defined($uname) || !defined($udom)); my %names=&getnames($uname,$udom); my $name=$names{'nickname'}; if ($name) { @@ -2098,6 +2102,7 @@ sub nickname { sub getnames { my ($uname,$udom)=@_; + return if (!defined($uname) || !defined($udom)); if ($udom eq 'public' && $uname eq 'public') { return ('lastname' => &mt('Public')); } @@ -2912,7 +2917,7 @@ sub blockcheck { } my $no_ownblock = 0; my $no_userblock = 0; - if ($otheruser) { + if ($otheruser && $activity ne 'com') { # Check if current user has 'evb' priv for this if (defined($own_courses{$course})) { foreach my $sec (keys(%{$own_courses{$course}})) { @@ -3165,7 +3170,7 @@ Returns: Determines which domain should ############################################### sub determinedomain { my $domain=shift; - if (! $domain) { + if (! $domain) { # Determine domain if we have not been given one $domain = $Apache::lonnet::perlvar{'lonDefDomain'}; if ($env{'user.domain'}) { $domain=$env{'user.domain'}; } @@ -3411,9 +3416,7 @@ sub bodytag { my $bodytag = "". &Apache::lontexconvert::init_math_support(); - if ($bodyonly - || ($env{'request.state'} eq 'construct' - && $env{'environment.remote'} ne 'off' )) { + if ($bodyonly) { return $bodytag; } elsif ($env{'browser.interface'} eq 'textual') { # Accessibility @@ -3717,6 +3720,8 @@ form, .inline { display: inline; } .LC_diff_removed { color: red; } + +.LC_info, .LC_success, .LC_diff_added { color: green; @@ -3725,6 +3730,10 @@ form, .inline { display: inline; } border: 0px; } +.LC_internal_info { + color: #999; +} + table.LC_pastsubmission { border: 1px solid black; margin: 2px; @@ -3786,7 +3795,7 @@ table#LC_title_bar td.LC_title_bar_role_ } table#LC_menubuttons_mainmenu { - background: $pgbg; + width: 100%; border: 0px; border-spacing: 1px; padding: 0px 1px; @@ -3851,20 +3860,27 @@ table#LC_mainmenu td.LC_mainmenu_column font-size: smaller; } +.LC_menubuttons_link { + text-decoration: none; +} + .LC_menubuttons_category { color: $font; + background: $pgbg; font-family: $sans; font-size: larger; font-weight: bold; } td.LC_menubuttons_text { + width: 90%; color: $font; font-family: $sans; } + td.LC_menubuttons_img { - background: $tabbg; } + .LC_current_location { font-family: $sans; background: $tabbg; @@ -3874,6 +3890,45 @@ td.LC_menubuttons_img { font-weight: bold; } +.LC_rolesmenu_is { + font-family: $sans; +} + +.LC_rolesmenu_selected { + font-family: $sans; +} + +.LC_rolesmenu_future { + font-family: $sans; +} + + +.LC_rolesmenu_will { + font-family: $sans; +} + +.LC_rolesmenu_will_not { + font-family: $sans; +} + +.LC_rolesmenu_expired { + font-family: $sans; +} + +.LC_rolesinfo { + font-family: $sans; +} + +.LC_dropadd_labeltext { + font-family: $sans; + text-align: right; +} + +.LC_preferences_labeltext { + font-family: $sans; + text-align: right; +} + table.LC_aboutme_port { border: 0px; border-collapse: collapse; @@ -4278,21 +4333,13 @@ span.LC_feedback_link { } table.LC_prior_tries { - border-width: 1px; - border-style: solid; - border-color: gray; - border-collapse: collapse; + border: 1px solid #000000; + border-collapse: separate; + border-spacing: 1px; } table.LC_prior_tries td { - border-width: 1px; - border-style: solid; - border-color: gray; - padding: 3px; -} -table.LC_prior_tries tr.LC_correct { - font-weight: bold; - background: #aaffaa; + padding: 2px; } .LC_answer_correct { @@ -4323,7 +4370,16 @@ table.LC_prior_tries tr.LC_correct { } -span.LC_prior_numerical { +span.LC_prior_numerical, +span.LC_prior_string, +span.LC_prior_custom, +span.LC_prior_reaction, +span.LC_prior_math { + font-family: monospace; + white-space: pre; +} + +span.LC_prior_string { font-family: monospace; white-space: pre; } @@ -4332,9 +4388,13 @@ table.LC_prior_option { width: 100%; border-collapse: collapse; } -table.LC_prior_option tr td { - border-style: solid; - border-width: 1px +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; } span.LC_nobreak { @@ -5170,11 +5230,18 @@ Incoming parameters: 2. user's domain Returns: -1. Disk quota (in Mb) assigned to student. +1. Disk quota (in Mb) assigned to student. +2. (Optional) Type of setting: custom or default + (individually assigned or default for user's + institutional status). +3. (Optional) - User's institutional status (e.g., faculty, staff + or student - types as defined in localenroll::inst_usertypes + for user's domain, which determines default quota for user. +4. (Optional) - Default quota which would apply to the user. If a value has been stored in the user's environment, -it will return that, otherwise it returns the default -for users in the domain. +it will return that, otherwise it returns the maximal default +defined for the user's instituional status(es) in the domain. =cut @@ -5183,7 +5250,7 @@ for users in the domain. sub get_user_quota { my ($uname,$udom) = @_; - my $quota; + my ($quota,$quotatype,$settingstatus,$defquota); if (!defined($udom)) { $udom = $env{'user.domain'}; } @@ -5193,23 +5260,38 @@ sub get_user_quota { if (($udom eq '' || $uname eq '') || ($udom eq 'public') && ($uname eq 'public')) { $quota = 0; + $quotatype = 'default'; + $defquota = 0; } else { + my $inststatus; if ($udom eq $env{'user.domain'} && $uname eq $env{'user.name'}) { $quota = $env{'environment.portfolioquota'}; + $inststatus = $env{'environment.inststatus'}; } else { - my %userenv = &Apache::lonnet::dump('environment',$udom,$uname); + my %userenv = + &Apache::lonnet::get('environment',['portfolioquota', + 'inststatus'],$udom,$uname); my ($tmp) = keys(%userenv); if ($tmp !~ /^(con_lost|error|no_such_host)/i) { $quota = $userenv{'portfolioquota'}; + $inststatus = $userenv{'inststatus'}; } else { undef(%userenv); } } + ($defquota,$settingstatus) = &default_quota($udom,$inststatus); if ($quota eq '') { - $quota = &default_quota($udom); + $quota = $defquota; + $quotatype = 'default'; + } else { + $quotatype = 'custom'; } } - return $quota; + if (wantarray) { + return ($quota,$quotatype,$settingstatus,$defquota); + } else { + return $quota; + } } ############################################### @@ -5218,32 +5300,68 @@ sub get_user_quota { =item * &default_quota() -Retrieves default quota assigned for storage of user portfolio files +Retrieves default quota assigned for storage of user portfolio files, +given an (optional) user's institutional status. Incoming parameters: 1. domain +2. (Optional) institutional status(es). This is a : separated list of + status types (e.g., faculty, staff, student etc.) + which apply to the user for whom the default is being retrieved. + If the institutional status string in undefined, the domain + default quota will be returned. Returns: 1. Default disk quota (in Mb) for user portfolios in the domain. +2. (Optional) institutional type which determined the value of the + default quota. If a value has been stored in the domain's configuration db, it will return that, otherwise it returns 20 (for backwards compatibility with domains which have not set up a configuration db file; the original statically defined portfolio quota was 20 Mb). +If the user's status includes multiple types (e.g., staff and student), +the largest default quota which applies to the user determines the +default quota returned. + =cut ############################################### sub default_quota { - my ($udom) = @_; - my %defaults = &Apache::lonnet::get_dom('configuration', - ['portfolioquota'],$udom); - if ($defaults{'portfolioquota'} ne '') { - return $defaults{'portfolioquota'}; + my ($udom,$inststatus) = @_; + my ($defquota,$settingstatus); + my %quotahash = &Apache::lonnet::get_dom('configuration', + ['quota'],$udom); + if (ref($quotahash{'quota'}) eq 'HASH') { + if ($inststatus ne '') { + my @statuses = split(/:/,$inststatus); + foreach my $item (@statuses) { + if ($quotahash{'quota'}{$item} ne '') { + if ($defquota eq '') { + $defquota = $quotahash{'quota'}{$item}; + $settingstatus = $item; + } elsif ($quotahash{'quota'}{$item} > $defquota) { + $defquota = $quotahash{'quota'}{$item}; + $settingstatus = $item; + } + } + } + } + if ($defquota eq '') { + $defquota = $quotahash{'quota'}{'default'}; + $settingstatus = 'default'; + } + } else { + $settingstatus = 'default'; + $defquota = 20; + } + if (wantarray) { + return ($defquota,$settingstatus); } else { - return '20'; + return $defquota; } }