--- loncom/interface/loncommon.pm 2008/09/19 23:03:20 1.679.2.4
+++ loncom/interface/loncommon.pm 2008/12/03 00:09:56 1.702
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.679.2.4 2008/09/19 23:03:20 raeburn Exp $
+# $Id: loncommon.pm,v 1.702 2008/12/03 00:09:56 harmsja 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);
@@ -657,6 +659,57 @@ sub select_timezone {
return $output;
}
+sub select_datelocale {
+ my ($name,$selected,$onchange,$includeempty)=@_;
+ my $output='";
+ return $output;
+}
+
=pod
=item * &linked_select_forms(...)
@@ -873,7 +926,7 @@ sub help_open_topic {
if ($text ne "") {
$template .=
"
".
- "$text";
+ " | $text";
}
# Add the graphic
@@ -882,7 +935,7 @@ sub help_open_topic {
$template .= <<"ENDTEMPLATE";
ENDTEMPLATE
- if ($text ne '') { $template.=' |
' };
+ if ($text ne '') { $template.='' };
return $template;
}
@@ -2945,7 +2998,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,59 +3010,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;
@@ -3353,16 +3356,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 {
@@ -3372,6 +3380,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));
@@ -3854,7 +3880,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;
@@ -4378,6 +4411,7 @@ 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'
@@ -4385,22 +4419,35 @@ sub standard_css {
return < td,
table.LC_aboutme_port tr td {
@@ -4699,7 +4742,7 @@ table.LC_nested tr.LC_empty_row td {
table.LC_nested_outer tr th {
font-weight: bold;
background-color: $data_table_head;
- font-size: smaller;
+ font-size: small;
border-bottom: 1px solid #000000;
}
table.LC_nested_outer tr td.LC_subheader {
@@ -4738,7 +4781,7 @@ 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 {
@@ -4794,24 +4837,6 @@ 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_cstr_controls {
width: 100%;
border-collapse: collapse;
@@ -4830,35 +4855,27 @@ table#LC_cstr_controls tr th {
font-size: smaller;
}
-table#LC_browser {
-
-}
-table#LC_browser tr th {
- background: $table_header;
-}
-table#LC_browser tr td {
- padding: 2px;
-}
-table#LC_browser tr.LC_browser_file,
-table#LC_browser tr.LC_browser_file_published {
+table.LC_data_table tr > td.LC_browser_file,
+table.LC_data_table tr > td.LC_browser_file_published {
background: #CCFF88;
}
-table#LC_browser tr.LC_browser_file_locked,
-table#LC_browser tr.LC_browser_file_unpublished {
+table.LC_data_table tr > td.LC_browser_file_locked,
+table.LC_data_table tr > td.LC_browser_file_unpublished {
background: #FFAA99;
}
-table#LC_browser tr.LC_browser_file_obsolete {
+table.LC_data_table tr > td.LC_browser_file_obsolete {
background: #AAAAAA;
}
-table#LC_browser tr.LC_browser_file_modified,
-table#LC_browser tr.LC_browser_file_metamodified {
+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.LC_browser_folder {
+table.LC_data_table tr.LC_browser_folder > td {
background: #CCCCFF;
}
+
span.LC_current_location {
- font-size: x-large;
+ font-size:larger;
background: $pgbg;
}
@@ -5366,10 +5383,10 @@ 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;
margin: 2px;
@@ -5423,6 +5440,324 @@ img.stift{
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;
+ font-family: $sans;
+ font-size: small;
+ font-weight: bold;
+}
+fieldset#LC_mainmenu_fieldset {
+ margin:0px 10px 10px 0px;
+
+}
+/* ---- 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.smallMenu a:hover,
+ol#MenuBreadcrumbs a:hover,
+ul#TabMainMenuContent a:hover,
+.FormSectionClearButton input:hover{
+ color:#BF2317;
+ text-decoration:none;
+}
+
+h1 {
+ padding:5px 10px 5px 0px;
+ line-height:130%;
+}
+
+h2,h3,h4,h5,h6
+{
+margin:5px 0px 5px 0px;
+line-height:130%;
+}
+.hcell{
+ padding:3px 15px 3px 15px;
+ margin:0px;
+ background-color:$pgbg;
+ background-color:$ border-bottom:solid 1px $lg_border_color;
+}
+.noBorder {
+ border:0px;
+}
+/*
+.bgLightGrey { background:URL(images/TabMenuBG.png) repeat-x left top; }
+.bgLightGreyYellow {background-color:#EFECE0;}
+*/
+
+
+/* Main Header with discription of Person, Course, etc. */
+.HeadRight {
+ text-align: right;
+ float: right;
+ margin: 0px;
+ padding: 0px;
+ right:0;
+ position:absolute;
+ overflow:hidden;
+}
+
+p {
+ padding: 10px;
+
+}
+.FormSectionClearButton input {
+ background-color:transparent;
+ border:0px;
+ cursor:pointer;
+ text-decoration:underline;
+}
+
+
+dl,ul,div,fieldset {
+ margin: 10px 10px 10px 0px;
+ overflow:hidden;
+}
+ol.smallMenu {
+ margin: 0px;
+}
+
+ol.smallMenu li {
+ display: inline;
+ padding: 5px 5px 0px 10px;
+ vertical-align: top;
+}
+
+ol.smallMenu li img {
+ vertical-align: bottom;
+}
+
+ol.smallMenu a {
+ font-size: 90%;
+ color: RGB(80, 80, 80);
+ text-decoration: none;
+}
+
+ol#TabMainMenuContent {
+
+ margin: 0px 0px 10px 0px;
+ padding: 0px;
+}
+
+ol#TabMainMenuContent li {
+ display: inline;
+ vertical-align: bottom;
+ border-bottom: solid 1px RGB(175, 175, 175);
+ border-right: solid 1px RGB(175, 175, 175);
+ padding: 5px 15px 5px 15px;
+ margin-right:4px;
+ line-height: 140%;
+ font-weight: bold;
+ overflow:hidden;
+/* background: RGB(211, 206, 205) URL(images/TabMenuBG.png) repeat-x left top;*/
+}
+
+ol#TabMainMenuContent li a{
+ color: RGB(47, 47, 47);
+ text-decoration: none;
+}
+
+ol#TabMainMenuContent div.columnSection {
+ margin-bottom: 0px;
+}
+
+ol#MenuBreadcrumbs, ol#PathBreadcrumbs {
+ border-top: solid 1px RGB(255, 255, 255);
+ height: 20px;
+ line-height: 20px;
+ vertical-align: bottom;
+ margin: 0px 0px 30px 0px;
+ padding-left: 10px;
+ list-style-position: inside;
+/* background: RGB(211, 206, 205) URL(images/TabMenuBG.png) repeat-x left
+ top;*/
+}
+
+ol#MenuBreadcrumbs li, ol#PathBreadcrumbs li {
+/* background: url(images/pfeil_white.png) no-repeat left center;*/
+ display: inline;
+ padding: 0px 0px 0px 10px;
+ vertical-align: bottom;
+ overflow:hidden;
+}
+
+ol#MenuBreadcrumbs li a {
+ text-decoration: none;
+ font-size:90%;
+}
+ol#PathBreadcrumbs li a{
+ text-decoration:none;
+ font-size:100%;
+ font-weight:bold;
+}
+
+.ContentBoxSpecial
+{
+ border: solid 1px $lg_border_color;
+}
+.ContentBox {
+ padding:10px;
+}
+.PopUp
+{
+ padding:10px;
+ border-left:solid 1px $lg_border_color;
+ border-top:solid 1px $lg_border_color;
+ border-bottom:outset 1px $lg_border_color;
+ border-right:outset 1px $lg_border_color;
+ display:none;
+ position:absolute;
+ right:0;
+ background-color:white;
+ z-index:5;
+}
+
+dl.ListStyleClean dt {
+ padding-right: 5px;
+ display: table-header-group;
+}
+
+dl.ListStyleClean dd {
+ display: table-row;
+}
+
+.ListStyleClean,
+.ListStyleSimple,
+.ListStyleNormal,
+.ListStyleNormal_Border,
+.ListStyleSpecial
+ {
+ /*display:block; */
+ list-style-position: inside;
+ list-style-type: none;
+ overflow: hidden;
+ padding: 0px;
+}
+
+.ListStyleSimple li,
+.ListStyleSimple dd,
+.ListStyleNormal li,
+.ListStyleNormal dd,
+.ListStyleSpecial li,
+.ListStyleSpecial dd
+ {
+ margin: 0px;
+ padding: 5px 5px 5px 10px;
+ clear: both;
+}
+
+.ListStyleClean li,
+.ListStyleClean dd {
+ padding-top: 0px;
+ padding-bottom: 0px;
+}
+
+.ListStyleSimple dd,
+.ListStyleSimple li{
+ border-bottom: solid 1px $lg_border_color;
+}
+
+.ListStyleSpecial li,
+.ListStyleSpecial dd {
+ list-style-type: none;
+ background-color: RGB(220, 220, 220);
+ margin-bottom: 4px;
+}
+
+table.SimpleTable {
+ margin:5px;
+ border:solid 1px $lg_border_color;
+ }
+
+table.SimpleTable tr {
+ padding:0px;
+ border:solid 1px $lg_border_color;
+}
+table.SimpleTable thead{
+ background:rgb(220,220,220);
+}
+
+div.columnSection {
+ display: block;
+ clear: both;
+ overflow: hidden;
+ margin:0px;
+}
+
+div.columnSection>* {
+ float: left;
+ margin: 10px 20px 10px 0px;
+ overflow:hidden;
+}
+div.columnSection > .ContentBox,
+div.columnSection > .ContentBoxSpecial
+ {
+ width: 400px;
+
+}
+
+.LC_loginpage_container {
+ text-align:left;
+ margin : 0 auto;
+ width:65%;
+ padding: 10px;
+ height: auto;
+ background-color:#FFFFFF;
+ border:1px solid #CCCCCC;
+}
+
+
+.LC_loginpage_loginContainer {
+ float:left;
+ width:60%;
+}
+
+.LC_loginpage_loginInfo {
+ margin-top:20px;
+ margin-left:20px;
+ float:left;
+ width:30%;
+ border:1px solid #CCCCCC;
+ padding:10px;
+}
+
+.LC_loginpage_space {
+ clear:both;
+ margin-bottom:20px;
+ border-bottom: 1px solid #CCCCCC;
+}
+
+.LC_loginpage_fieldset{
+ border: 1px solid #CCCCCC;
+ margin: 0 auto;
+}
+
+.LC_loginpage_legend{
+ padding: 2px;
+ margin: 0px;
+ font-size:14px;
+ font-weight:bold;
+}
+
+
+
END
}
@@ -7610,7 +7945,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(' |