".&mt('Select Course')."";
+ my $linktext = &mt('Select Course');
+ if ($selecttype eq 'Community') {
+ $linktext = &mt('Select Community');
+ }
+ return ''
+ ."".$linktext.' '
+ .' ';
}
sub selectauthor_link {
@@ -612,6 +717,14 @@ sub selectauthor_link {
&mt('Select Author').'';
}
+sub selectuser_link {
+ my ($form,$unameelem,$domelem,$lastelem,$firstelem,$emailelem,$hdomelem,
+ $coursedom,$linktext,$caller) = @_;
+ return ''.$linktext.' ';
+}
+
sub check_uncheck_jscript {
my $jscript = <<"ENDSCRT";
function checkAll(field) {
@@ -677,7 +790,7 @@ sub select_datelocale {
if ($id ne '') {
my $en_terr = $locale->{'en_territory'};
my $native_terr = $locale->{'native_territory'};
- my @languages = &preferred_languages();
+ my @languages = &Apache::lonlocal::preferred_languages();
if (grep(/^en$/,@languages) || !@languages) {
if ($en_terr ne '') {
$locale_names{$id} = '('.$en_terr.')';
@@ -710,6 +823,21 @@ sub select_datelocale {
return $output;
}
+sub select_language {
+ my ($name,$selected,$includeempty) = @_;
+ my %langchoices;
+ if ($includeempty) {
+ %langchoices = ('' => 'No language preference');
+ }
+ foreach my $id (&languageids()) {
+ my $code = &supportedlanguagecode($id);
+ if ($code) {
+ $langchoices{$code} = &plainlanguagedescription($id);
+ }
+ }
+ return &select_form($selected,$name,%langchoices);
+}
+
=pod
=item * &linked_select_forms(...)
@@ -796,7 +924,8 @@ sub linked_select_forms {
my $first = "document.$formname.$firstselectname";
# output the javascript to do the changing
my $result = '';
- $result.="
END
# output the initial values for the selection lists
@@ -926,16 +1056,18 @@ sub help_open_topic {
if ($text ne "") {
$template .=
"".
- "$text ";
+ "$text ";
}
# Add the graphic
my $title = &mt('Online Help');
my $helpicon=&lonhttpdurl("/adm/help/help.png");
- $template .= <<"ENDTEMPLATE";
-
-ENDTEMPLATE
- if ($text ne '') { $template.='
' };
+ $template .= ''.
+ ' ';
+ if ($text ne '') {
+ $template.='';
+ }
return $template;
}
@@ -943,24 +1075,30 @@ ENDTEMPLATE
# This is a quicky function for Latex cheatsheet editing, since it
# appears in at least four places
sub helpLatexCheatsheet {
- my $other = shift;
+ my ($topic,$text,$not_author) = @_;
+ my $out;
my $addOther = '';
- if ($other) {
- $addOther = Apache::loncommon::help_open_topic($other, shift,
+ if ($topic) {
+ $addOther = &Apache::loncommon::help_open_topic($topic,$text,
undef, undef, 600) .
'';
}
- return ''.
- $addOther .
- &Apache::loncommon::help_open_topic("Greek_Symbols",&mt('Greek Symbols'),
- undef,undef,600)
- .' '.
- &Apache::loncommon::help_open_topic("Other_Symbols",&mt('Other Symbols'),
- undef,undef,600)
- .' '.
- &Apache::loncommon::help_open_topic("Authoring_Output_Tags",&mt('Output Tags'),
- undef,undef,600)
- .'
';
+ $out = ''.
+ $addOther .
+ &Apache::loncommon::help_open_topic("Greek_Symbols",&mt('Greek Symbols'),
+ undef,undef,600).
+ ' '.
+ &Apache::loncommon::help_open_topic("Other_Symbols",&mt('Other Symbols'),
+ undef,undef,600).
+ ' ';
+ unless ($not_author) {
+ $out .= ''.
+ &Apache::loncommon::help_open_topic("Authoring_Output_Tags",&mt('Output Tags'),
+ undef,undef,600).
+ ' ';
+ }
+ $out .= '
';
+ return $out;
}
sub general_help {
@@ -987,7 +1125,9 @@ sub update_help_link {
my $banner_link = "/adm/helpmenu?page=banner&topic=$topic&component_help=$component_help&faq=$faq&bug=$bug&origurl=$origurl&stamp=$timestamp&stayonpage=$stayOnPage";
my $output .= <<"ENDOUTPUT";
ENDOUTPUT
return $output;
@@ -1064,8 +1204,8 @@ sub help_menu_js {
my $template .= <<"ENDTEMPLATE";
ENDTEMPLATE
return $template;
@@ -1359,6 +1499,7 @@ sub resize_textarea_js {
my $geometry = &viewport_geometry_js();
return <<"RESIZE";
RESIZE
@@ -1629,7 +1771,7 @@ sub multiple_select_form {
$size = scalar(keys(%$hash));
}
}
- $output.="\n";
+ $output.="\n".'';
my @order;
if (ref($order) eq 'ARRAY') {
@order = @{$order};
@@ -1686,17 +1828,17 @@ sub select_form {
sub display_filter {
if (!$env{'form.show'}) { $env{'form.show'}=10; }
if (!$env{'form.displayfilter'}) { $env{'form.displayfilter'}='currentfolder'; }
- return ''.&mt('Records [_1]',
+ return ''.&mt('Records [_1]',
&Apache::lonmeta::selectbox('show',$env{'form.show'},undef,
(&mt('all'),10,20,50,100,1000,10000))).
- ' '.
+ ' '.
&mt('Filter [_1]',
&select_form($env{'form.displayfilter'},
'displayfilter',
('currentfolder' => 'Current folder/page',
'containing' => 'Containing phrase',
'none' => 'None'))).
- ' ';
+ ' ';
}
sub gradeleveldescription {
@@ -1740,7 +1882,7 @@ sub select_level_form {
=pod
-=item * &select_dom_form($defdom,$name,$includeempty,$showdomdesc)
+=item * &select_dom_form($defdom,$name,$includeempty,$showdomdesc,$onchange)
Returns a string containing a form to
allow a user to select the domain to preform an operation in.
@@ -1749,16 +1891,21 @@ See loncreateuser.pm for an example invo
If the $includeempty flag is set, it also includes an empty choice ("no domain
selected");
-If the $showdomdesc flag is set, the domain name is followed by the domain description.
+If the $showdomdesc flag is set, the domain name is followed by the domain description.
+
+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.
=cut
#-------------------------------------------
sub select_dom_form {
- my ($defdom,$name,$includeempty,$showdomdesc) = @_;
+ my ($defdom,$name,$includeempty,$showdomdesc,$onchange) = @_;
+ if ($onchange) {
+ $onchange = ' onchange="'.$onchange.'"';
+ }
my @domains = sort {lc($a) cmp lc($b)} (&Apache::lonnet::all_domains());
if ($includeempty) { @domains=('',@domains); }
- my $selectdomain = "\n";
+ my $selectdomain = "\n";
foreach my $dom (@domains) {
$selectdomain.="'.$dom;
@@ -1814,7 +1961,7 @@ sub home_server_form_item {
if ($numlib > 1) {
$result .= ' '."\n";
if ($default) {
- $result .= ' '.&mt('default').
+ $result .= ' '.&mt('default').
' '."\n";
}
foreach my $hostid (sort(keys(%servers))) {
@@ -2109,14 +2256,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 = '';
@@ -2124,10 +2271,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 = '';
}
}
@@ -2148,7 +2295,7 @@ sub authform_kerberos {
}
} else {
if ($authnum == 1) {
- $authtype = ' ';
+ $authtype = ' ';
}
}
if (!$can_assign{'krb4'} && !$can_assign{'krb5'}) {
@@ -2157,7 +2304,7 @@ sub authform_kerberos {
if (defined($in{'mode'})) {
if ($in{'mode'} eq 'modifycourse') {
if ($authnum == 1) {
- $authtype = ' ';
+ $authtype = ' ';
}
}
}
@@ -2218,7 +2365,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 = '';
@@ -2234,7 +2381,7 @@ sub authform_internal{
}
} else {
if ($authnum == 1) {
- $authtype = ' ';
+ $authtype = ' ';
}
}
if (!$can_assign{'int'}) {
@@ -2243,7 +2390,7 @@ sub authform_internal{
if (defined($in{'mode'})) {
if ($in{'mode'} eq 'modifycourse') {
if ($authnum == 1) {
- $authtype = ' ';
+ $authtype = ' ';
}
}
}
@@ -2258,7 +2405,7 @@ sub authform_internal{
$result = &mt
('[_1] Internally authenticated (with initial password [_2])',
''.$authtype,' '.$autharg);
- $result.=" ".&mt('Visible input').' ';
+ $result.=" ".&mt('Visible input').' ';
return $result;
}
@@ -2273,7 +2420,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 = '';
@@ -2289,7 +2436,7 @@ sub authform_local{
}
} else {
if ($authnum == 1) {
- $authtype = ' ';
+ $authtype = ' ';
}
}
if (!$can_assign{'loc'}) {
@@ -2298,7 +2445,7 @@ sub authform_local{
if (defined($in{'mode'})) {
if ($in{'mode'} eq 'modifycourse') {
if ($authnum == 1) {
- $authtype = ' ';
+ $authtype = ' ';
}
}
}
@@ -2327,7 +2474,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 = '';
@@ -2340,7 +2487,7 @@ sub authform_filesystem{
}
} else {
if ($authnum == 1) {
- $authtype = ' ';
+ $authtype = ' ';
}
}
if (!$can_assign{'fsys'}) {
@@ -2349,7 +2496,7 @@ sub authform_filesystem{
if (defined($in{'mode'})) {
if ($in{'mode'} eq 'modifycourse') {
if ($authnum == 1) {
- $authtype = ' ';
+ $authtype = ' ';
}
}
}
@@ -2717,6 +2864,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
@@ -2735,6 +2919,25 @@ sub screenname {
return $names{'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
@@ -2761,7 +2964,7 @@ sub aboutmewrapper {
return;
}
return ''.$link.' ';
+ ($target?' target="$target"':'').' title="'.&mt("View this user's personal information page").'">'.$link.'';
}
# ------------------------------------------------------------ Syllabus Wrapper
@@ -2776,7 +2979,7 @@ sub syllabuswrapper {
}
sub track_student_link {
- my ($linktext,$sname,$sdom,$target,$start) = @_;
+ my ($linktext,$sname,$sdom,$target,$start,$only_body) = @_;
my $link ="/adm/trackstudent?";
my $title = 'View recent activity';
if (defined($sname) && $sname !~ /^\s*$/ &&
@@ -2790,12 +2993,34 @@ sub track_student_link {
$target = '';
}
if ($start) { $link.='&start='.$start; }
+ if ($only_body) { $link .= '&only_body=1'; }
$title = &mt($title);
$linktext = &mt($linktext);
return qq{$linktext }.
&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
@@ -2998,7 +3223,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']);
@@ -3010,59 +3235,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'});
- }
- }
- }
- return &get_genlanguages(@languages);
-}
-
-sub get_genlanguages {
- my (@languages) = @_;
-# 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;
@@ -3083,6 +3258,28 @@ 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 ##
###############################################################
@@ -3221,7 +3418,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) ||
@@ -3798,7 +3995,7 @@ sub blocking_status {
&Apache::lonnet::coursedescription($course);
$coursedesc = $courseinfo{'description'};
}
- $category = "Group files in the course '$coursedesc'";
+ $category = "Group portfolio files in the course '$coursedesc'";
} else {
$category = 'Portfolio files belonging to ';
if ($env{'user.name'} eq 'public' &&
@@ -3901,7 +4098,7 @@ sub determinedomain {
my $domain=shift;
if (! $domain) {
# Determine domain if we have not been given one
- $domain = $Apache::lonnet::perlvar{'lonDefDomain'};
+ $domain = &Apache::lonnet::default_login_domain();
if ($env{'user.domain'}) { $domain=$env{'user.domain'}; }
if ($env{'request.role.domain'}) {
$domain=$env{'request.role.domain'};
@@ -3930,7 +4127,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;
@@ -4152,7 +4356,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),
@@ -4440,8 +4644,8 @@ sub standard_css {
my $sans = 'Verdana,Arial,Helvetica,sans-serif';
my $mono = 'monospace';
my $data_table_head = $tabbg;
- my $data_table_light = '#EEEEEE';
- my $data_table_dark = '#DDDDDD';
+ my $data_table_light = '#FAFAFA';
+ my $data_table_dark = '#F0F0F0';
my $data_table_darker = '#CCCCCC';
my $data_table_highlight = '#FFFF00';
my $mail_new = '#FFBB77';
@@ -4454,15 +4658,25 @@ 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_pick_box tr > td.LC_odd_row,
table.LC_aboutme_port tr td {
background-color: $data_table_light;
padding: 2px;
}
table.LC_data_table tr.LC_even_row > td,
+table.LC_pick_box tr > td.LC_even_row,
table.LC_aboutme_port tr.LC_even_row td {
background-color: $data_table_dark;
+ padding: 2px;
}
table.LC_data_table tr.LC_data_table_highlight td {
background-color: $data_table_darker;
@@ -4785,7 +4997,7 @@ table.LC_nested_outer tr td.LC_subheader
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;
@@ -4795,7 +5007,7 @@ 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,
@@ -4806,7 +5018,7 @@ 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 {
@@ -4817,7 +5029,7 @@ table.LC_createuser tr.LC_section_row td
}
table.LC_createuser tr.LC_info_row td {
- background-color: #CCC;
+ background-color: #CCCCCC;
font-weight: bold;
text-align: center;
}
@@ -4873,10 +5085,10 @@ table.LC_mail_list tr.LC_mail_odd {
table#LC_portfolio_actions {
width: auto;
background: $pgbg;
- border: 0px;
+ border: none;
border-spacing: 2px 2px;
- padding: 0px;
- margin: 0px;
+ padding: 0;
+ margin: 0;
border-collapse: separate;
}
table#LC_portfolio_actions td.LC_label {
@@ -4932,6 +5144,26 @@ table#LC_browser tr.LC_browser_file_meta
table#LC_browser tr.LC_browser_folder {
background: #CCCCFF;
}
+
+table.LC_data_table tr > td.LC_roles_is {
+/* background: #77FF77; */
+}
+table.LC_data_table tr > td.LC_roles_future {
+ background: #FFFF77;
+}
+table.LC_data_table tr > td.LC_roles_will {
+ background: #FFAA77;
+}
+table.LC_data_table tr > td.LC_roles_expired {
+ background: #FF7777;
+}
+table.LC_data_table tr > td.LC_roles_will_not {
+ background: #AAFF77;
+}
+table.LC_data_table tr > td.LC_roles_selected {
+ background: #11CC55;
+}
+
span.LC_current_location {
font-size: x-large;
background: $pgbg;
@@ -4977,9 +5209,9 @@ table.LC_parm_overview_restrictions th {
border-color: $pgbg;
}
table#LC_helpmenu {
- border: 0px;
+ border: none;
height: 55px;
- border-spacing: 0px;
+ border-spacing: 0;
}
table#LC_helpmenu fieldset legend {
@@ -4990,7 +5222,7 @@ 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 {
@@ -5032,6 +5264,7 @@ table.LC_pick_box td.LC_pick_box_title {
background: $tabbg;
font-weight: bold;
text-align: right;
+ vertical-align: top;
width: 184px;
padding: 8px;
}
@@ -5052,7 +5285,7 @@ table.LC_pick_box td.LC_pick_box_select
padding: 8px;
}
table.LC_pick_box td.LC_pick_box_separator {
- padding: 0px;
+ padding: 0;
height: 1px;
background: black;
}
@@ -5094,7 +5327,7 @@ table.LC_helpform_receipt td.LC_oddrow_v
background-color: $data_table_light;
}
table.LC_helpform_receipt td.LC_pick_box_separator {
- padding: 0px;
+ padding: 0;
height: 1px;
background: black;
}
@@ -5127,7 +5360,7 @@ table.LC_group_priv_box td.LC_groups_fun
}
table.LC_group_priv td {
text-align: left;
- padding: 0px;
+ padding: 0;
}
table.LC_notify_front_page {
@@ -5148,6 +5381,7 @@ 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;
@@ -5264,7 +5498,7 @@ span.LC_cusr_subheading {
table.LC_docs_documents {
background: #BBBBBB;
- border-width: 0px;
+ border-width: 0;
border-collapse: collapse;
}
@@ -5281,7 +5515,7 @@ table.LC_docs_documents td.LC_docs_docum
}
.LC_docs_entry_move {
- border: 0px;
+ border: none;
border-collapse: collapse;
}
@@ -5337,7 +5571,7 @@ table.LC_sty_end {
}
table.LC_double_column {
- border-width: 0px;
+ border-width: 0;
border-collapse: collapse;
width: 100%;
padding: 2px;
@@ -5476,7 +5710,7 @@ table.LC_edit_problem_header_title {
background: $tabbg;
border-collapse: collapse;
- padding: 0px
+ padding: 0;
}
div.LC_edit_problem_discards {
@@ -5492,7 +5726,7 @@ hr.LC_edit_problem_divide {
color: $tabbg;
background-color: $tabbg;
height: 3px;
- border: 0px;
+ border: none;
}
img.stift{
border-width:0;
@@ -5517,9 +5751,14 @@ table#LC_mainmenu td.LC_mainmenu_col_fie
font-weight: bold;
}
fieldset#LC_mainmenu_fieldset {
- margin:0px 10px 10px 0px;
+ margin:0 10px 10px 0;
}
+
+div.LC_createcourse {
+ margin: 10px 10px 10px 10px;
+}
+
END
}
@@ -5647,7 +5886,8 @@ sub xml_begin {
.'';
} else {
- $output='';
+ $output=''.
+ '';
}
return $output;
}
@@ -5788,10 +6028,26 @@ sub start_page {
if ($args->{'html_encode'}) {
$result = &html_encode($result);
}
+ #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;
}
-
=pod
=item * &head()
@@ -6022,7 +6278,7 @@ sub get_users_function {
if ($env{'request.role'}=~/^(su|dc|ad|li)/) {
$function='admin';
}
- if (($env{'request.role'}=~/^(au|ca)/) ||
+ if (($env{'request.role'}=~/^(au|ca|aa)/) ||
($ENV{'REQUEST_URI'}=~/^(\/priv|\~)/)) {
$function='author';
}
@@ -6033,6 +6289,37 @@ 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
@@ -6536,6 +6823,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
###############################################
@@ -6548,21 +6837,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 {
@@ -6668,6 +6973,7 @@ sub user_picker {
# loncreateuser::print_user_query_page()
# has been completed.
next if ($option eq 'alc');
+ next if (($option eq 'crs') && ($env{'form.form'} eq 'requestcrs'));
next if ($option eq 'crs' && !$env{'request.course.id'});
if ($curr_selected{'srchin'} eq $option) {
$srchinsel .= '
@@ -6711,12 +7017,14 @@ 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.','',' ').'
';
}
}
}
@@ -6753,6 +7061,7 @@ ENDSCRIPT
my $output = <<"END_BLOCK";
$new_user_create
-
-
END_BLOCK
+ $output .= &Apache::lonhtmlcommon::start_pick_box().
+ &Apache::lonhtmlcommon::row_title($lt{'doma'}).
+ $domform.
+ &Apache::lonhtmlcommon::row_closure().
+ &Apache::lonhtmlcommon::row_title($lt{'usr'}).
+ $srchbysel.
+ $srchtypesel.
+ ' '.
+ $srchinsel.
+ &Apache::lonhtmlcommon::row_closure(1).
+ &Apache::lonhtmlcommon::end_pick_box().
+ ' ';
return $output;
}
@@ -6998,6 +7304,7 @@ sub personal_data_fieldtitles {
middlename => 'Middle Name',
generation => 'Generation',
gen => 'Generation',
+ inststatus => 'Affiliation',
);
return %fieldtitles;
}
@@ -7067,8 +7374,56 @@ 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
@@ -7619,7 +7974,7 @@ sub upfile_select_html {
# xml => &mt('HTML/XML'),
);
my $Str = ' '.
- ' Type: ';
+ ' '.&mt('Type').': ';
foreach my $type (sort(keys(%Types))) {
$Str .= ''.$Types{$type}." \n";
}
@@ -7665,7 +8020,8 @@ sub csv_print_samples {
$r->print(&mt('Samples').' '.&start_data_table().
&start_data_table_header_row());
foreach my $sample (sort({$a <=> $b} keys(%{ $samples->[0] }))) {
- $r->print(''.&mt('Column [_1]',($sample+1)).' '); }
+ $r->print(''.&mt('Column [_1]',($sample+1)).' ');
+ }
$r->print(&end_data_table_header_row());
foreach my $hash (@$samples) {
$r->print(&start_data_table_row());
@@ -7707,9 +8063,9 @@ 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('print('');
$r->print(' ');
foreach my $sample (sort({$a <=> $b} keys(%{ $samples->[0] }))) {
@@ -8363,9 +8719,11 @@ sub restore_settings {
=item * &build_recipient_list()
-Build recipient lists for three types of e-mail:
-(a) Error Reports, (b) Package Updates, (c) Help requests, generated by
-lonerrorhandler.pm, CHECKRPMS and lonsupportreq.pm respectively.
+Build recipient lists for five types of e-mail:
+(a) Error Reports, (b) Package Updates, (c) lonstatus warnings/errors
+(d) Help requests, (e) Course requests needing approval, generated by
+lonerrorhandler.pm, CHECKRPMS, loncron, lonsupportreq.pm and
+loncoursequeueadmin.pm respectively.
Inputs:
defmail (scalar - email address of default recipient),
@@ -8389,17 +8747,21 @@ sub build_recipient_list {
my %domconfig =
&Apache::lonnet::get_dom('configuration',['contacts'],$defdom);
if (ref($domconfig{'contacts'}) eq 'HASH') {
- if (ref($domconfig{'contacts'}{$mailing}) eq 'HASH') {
- my @contacts = ('adminemail','supportemail');
- foreach my $item (@contacts) {
- if ($domconfig{'contacts'}{$mailing}{$item}) {
- my $addr = $domconfig{'contacts'}{$item};
- if (!grep(/^\Q$addr\E$/,@recipients)) {
- push(@recipients,$addr);
+ if (exists($domconfig{'contacts'}{$mailing})) {
+ if (ref($domconfig{'contacts'}{$mailing}) eq 'HASH') {
+ my @contacts = ('adminemail','supportemail');
+ foreach my $item (@contacts) {
+ if ($domconfig{'contacts'}{$mailing}{$item}) {
+ my $addr = $domconfig{'contacts'}{$item};
+ if (!grep(/^\Q$addr\E$/,@recipients)) {
+ push(@recipients,$addr);
+ }
}
+ $otheremails = $domconfig{'contacts'}{$mailing}{'others'};
}
- $otheremails = $domconfig{'contacts'}{$mailing}{'others'};
}
+ } elsif ($origmail ne '') {
+ push(@recipients,$origmail);
}
} elsif ($origmail ne '') {
push(@recipients,$origmail);
@@ -8934,8 +9296,9 @@ sub check_clone {
$clonemsg = &mt('No new course created.').$linefeed.&mt('A new course could not be cloned from the specified original - [_1] - because it is a non-existent course.',$args->{'clonecourse'}.':'.$args->{'clonedomain'});
} else {
my %clonedesc = &Apache::lonnet::coursedescription($cloneid,{'one_time' => 1});
- if ($env{'request.role.domain'} eq $args->{'clonedomain'}) {
- $can_clone = 1;
+ if (($env{'request.role.domain'} eq $args->{'clonedomain'}) &&
+ (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'}))) {
+ $can_clone = 1;
} else {
my %clonehash = &Apache::lonnet::get('environment',['cloners'],
$args->{'clonedomain'},$args->{'clonecourse'});
@@ -8962,7 +9325,7 @@ sub check_clone {
}
sub construct_course {
- my ($args,$logmsg,$courseid,$crsudom,$crsunum,$udom,$uname,$context) = @_;
+ my ($args,$logmsg,$courseid,$crsudom,$crsunum,$udom,$uname,$context,$cnum,$category) = @_;
my $outcome;
my $linefeed = ' '."\n";
if ($context eq 'auto') {
@@ -9000,7 +9363,9 @@ sub construct_course {
$args->{'crscode'},
$args->{'ccuname'}.':'.
$args->{'ccdomain'},
- $args->{'crstype'});
+ $args->{'crstype'},
+ $cnum,$context,$category);
+
# Note: The testing routines depend on this being output; see
# Utils::Course. This needs to at least be output as a comment
@@ -9043,7 +9408,9 @@ sub construct_course {
'policy.email',
'comment.email',
'pch.users.denied',
- 'plc.users.denied'],
+ 'plc.users.denied',
+ 'hidefromcat',
+ 'categories'],
$$crsudom,$$crsunum);
}
@@ -9271,10 +9638,10 @@ sub construct_course {
$outcome .= ($fatal?$errtext:'read ok').' - ';
my $title; my $url;
if ($args->{'firstres'} eq 'syl') {
- $title='Syllabus';
+ $title=&mt('Syllabus');
$url='/public/'.$$crsudom.'/'.$$crsunum.'/syllabus';
} else {
- $title='Navigate Contents';
+ $title=&mt('Navigate Contents');
$url='/adm/navmaps';
}
@@ -9306,8 +9673,8 @@ sub course_type {
sub group_term {
my $crstype = &course_type();
my %names = (
- 'Course' => 'group',
- 'Group' => 'team',
+ 'Course' => 'group',
+ 'Community' => 'group',
);
return $names{$crstype};
}
@@ -9328,28 +9695,14 @@ sub icon {
return &lonhttpdurl($iconname);
}
-sub lonhttpd_port {
- my $lonhttpd_port=$Apache::lonnet::perlvar{'lonhttpdPort'};
- if (!defined($lonhttpd_port)) { $lonhttpd_port='8080'; }
- # IE doesn't like a secure page getting images from a non-secure
- # port (when logging we haven't parsed the browser type so default
- # back to secure
- if ((!exists($env{'browser.type'}) || $env{'browser.type'} eq 'explorer')
- && $ENV{'SERVER_PORT'} == 443) {
- return 443;
- }
- return $lonhttpd_port;
-
-}
-
sub lonhttpdurl {
+#
+# Had been used for "small fry" static images on separate port 8080.
+# Modify here if lightweight http functionality desired again.
+# Currently eliminated due to increasing firewall issues.
+#
my ($url)=@_;
-
- my $lonhttpd_port = &lonhttpd_port();
- if ($lonhttpd_port == 443) {
- return 'https://'.$ENV{'SERVER_NAME'}.$url;
- }
- return 'http://'.$ENV{'SERVER_NAME'}.':'.$lonhttpd_port.$url;
+ return $url;
}
sub connection_aborted {
@@ -9385,6 +9738,22 @@ sub escape_url {
return join('/',@urlslices).'/'.$lastitem;
}
+sub compare_arrays {
+ my ($arrayref1,$arrayref2) = @_;
+ my (@difference,%count);
+ @difference = ();
+ %count = ();
+ if ((ref($arrayref1) eq 'ARRAY') && (ref($arrayref2) eq 'ARRAY')) {
+ foreach my $element (@{$arrayref1}, @{$arrayref2}) { $count{$element}++; }
+ foreach my $element (keys(%count)) {
+ if ($count{$element} == 1) {
+ push(@difference,$element);
+ }
+ }
+ }
+ return @difference;
+}
+
# -------------------------------------------------------- Initliaze user login
sub init_user_environment {
my ($r, $username, $domain, $authhost, $form, $args) = @_;
@@ -9515,6 +9884,17 @@ sub init_user_environment {
}
}
+ foreach my $tool ('aboutme','blog','portfolio') {
+ $userenv{'availabletools.'.$tool} =
+ &Apache::lonnet::usertools_access($username,$domain,$tool,'reload');
+ }
+
+ foreach my $crstype ('official','unofficial','community') {
+ $userenv{'canrequest.'.$crstype} =
+ &Apache::lonnet::usertools_access($username,$domain,$crstype,
+ 'reload','requestcourses');
+ }
+
$env{'user.environment'} = "$lonids/$cookie.id";
if (tie(my %disk_env,'GDBM_File',"$lonids/$cookie.id",
@@ -9553,7 +9933,7 @@ sub _add_to_env {
# --- Get the symbolic name of a problem and the url
sub get_symb {
my ($request,$silent) = @_;
- (my $url=$env{'form.url'}) =~ s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--;
+ (my $url=$env{'form.url'}) =~ s-^https?\://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--;
my $symb=($env{'form.symb'} ne '' ? $env{'form.symb'} : (&Apache::lonnet::symbread($url)));
if ($symb eq '') {
if (!$silent) {
@@ -9580,11 +9960,13 @@ sub get_annotation {
}
sub clean_symb {
- my ($symb) = @_;
+ my ($symb,$delete_enc) = @_;
&Apache::lonenc::check_decrypt(\$symb);
my $enc = $env{'request.enc'};
- delete($env{'request.enc'});
+ if ($delete_enc) {
+ delete($env{'request.enc'});
+ }
return ($symb,$enc);
}