--- loncom/interface/loncommon.pm 2008/09/19 22:54:46 1.679.2.3
+++ loncom/interface/loncommon.pm 2008/11/14 13:29:28 1.693
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.679.2.3 2008/09/19 22:54:46 raeburn Exp $
+# $Id: loncommon.pm,v 1.693 2008/11/14 13:29:28 droeschl 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;
}
@@ -2987,14 +3040,19 @@ sub preferred_languages {
}
}
}
+ 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]);
- }
+ unless ($lang=~/\w/) { next; }
+ push(@genlanguages,$lang);
+ if ($lang=~/(\-|\_)/) {
+ push(@genlanguages,(split(/(\-|\_)/,$lang))[0]);
+ }
}
#uniqueify the languages list
my %count;
@@ -3348,16 +3406,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 +3430,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));
@@ -4547,7 +4628,6 @@ table.LC_docs_path td.LC_docs_path_compo
td.LC_table_cell_checkbox {
text-align: center;
}
-
table#LC_mainmenu td.LC_mainmenu_column {
vertical-align: top;
}
@@ -4561,7 +4641,7 @@ table#LC_mainmenu td.LC_mainmenu_column
.LC_menubuttons_link {
text-decoration: none;
}
-
+#2008--9-5: new menu style sheet.Changed category
.LC_menubuttons_category {
color: $font;
background: $pgbg;
@@ -5418,6 +5498,309 @@ 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.
+# --------------------------*/
+
+
+body {
+ font-family: Tahoma, Arial,Helvetica,sans-serif;
+ font-size: 0.85em;
+ line-height: 130%;
+ color: RGB(45, 45, 45);
+}
+
+a:link,a:visited {
+ /*color: RGB(0, 118, 127);*/
+ /*text-decoration: underline;*/
+}
+
+a:hover{
+ text-decoration:none;
+}
+/*a:hover,
+UL.smallMenu A:hover,
+UL.MenuBreadcrumbs A:hover,
+UL#TabMainMenuContent A:hover{
+ color: rgb(200, 10, 50);
+}*/
+
+h1 {
+ padding:5px 10px 5px 20px;
+ line-height:130%;
+}
+h2,h4,h6 {
+ /*color: RGB(0, 118, 127);*/
+}
+h2,h3,h4,h5,h6
+{
+margin:5px 0px 5px 0px;
+line-height:130%;
+}
+
+.right {
+ text-align: right;
+}
+
+.center {
+ text-align: center;
+}
+
+.left {
+ text-align: left;
+}
+
+
+.HeadRight {
+ text-align: right;
+ float: right;
+ margin: 0px;
+ padding: 0px;
+ right:0;
+ position:absolute;
+}
+
+img {
+/* border: 0px; */
+}
+
+.personalBgColor {
+ background: RGB(237, 239, 0) url(images/headHighlight.png) repeat-y left top;
+}
+
+p {
+ padding: 10px;
+}
+DL,UL,Div,Fieldset {
+ /*margin: 10px;*/
+ overflow:hidden;
+}
+OL.smallMenu {
+ margin: 0px 0px 0px 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 {
+ 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 {
+ 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%;
+}
+
+h4.hcell {
+ padding: 3px 10px 3px 10px;
+ margin: 0px;
+ background: RGB(0, 118, 127);
+ color: white;
+ border: outset 1px;
+}
+
+DIV.DivContentBoxSpecial
+{
+ border: solid 1px RGB(100, 100, 100);
+}
+
+FIELDSET
+{
+ /*width:78%;*/
+}
+DIV.DivContentBox,
+DIV.DivContentBoxSpecial {
+ width: 80%;
+ margin:10px;
+}
+
+FIELDSET legend,DL DT {
+ font-weight: bold;
+ font-size: 110%;
+ /*padding-left: 0px;*/
+/* margin-left: 0px;*/
+}
+
+DIV.DivImportant {
+ background: url(images/important.png) no-repeat center top;
+ padding: 100px 10px 10px 10px;
+ width: 200px;
+ border: double 4px RGB(200, 200, 200);
+}
+
+
+
+DL.ListStyleClean DT {
+ padding-right: 5px;
+ display: table-header-group;
+}
+
+DL.ListStyleClean DD {
+ display: table-row;
+}
+
+.ListStyleClean,
+.ListStyleSimple,
+.ListStyleNormal,
+.ListStyleNormal_Border,
+.ListStyleSpecial
+ {
+ /*display:block; */
+ width: 400px;
+ list-style-position: inside;
+ list-style-type: none;
+ overflow: hidden;
+ padding: 0px;
+}
+
+.ListStyleClean li,
+.ListStyleSimple li,
+.ListStyleSimple DD,
+.ListStyleNormal li,
+.ListStyleNormal DD,
+.ListStyleSpecial li,
+.ListStyleSpecial DD
+ {
+ margin: 0px;
+ padding: 5px 5px 5px 10px;
+ clear: both;
+ /*display:block;*/
+}
+
+.ListStyleClean LI,
+.ListStyleClean DD {
+ padding-top: 0px;
+ padding-bottom: 0px;
+}
+
+.ListStyleSimple DD,
+.ListStyleSimple LI{
+ border-bottom: solid 1px RGB(150, 150, 150);
+}
+
+.ListStyleSpecial LI,
+.ListStyleSpecial DD {
+ list-style-type: none;
+ background-color: RGB(220, 220, 220);
+ margin-bottom: 4px;
+}
+
+table.SimpleTable *{
+ padding:10px;
+ }
+
+table.SimpleTable td {
+ vertical-align:top;
+ border:solid 1px RGB(210,210,210);
+}
+table.SimpleTable thead{
+ background:rgb(210,210,210);
+}
+
+DIV.columnSection {
+ display: block;
+ clear: both;
+ overflow: hidden;
+ margin:0px;
+}
+
+DIV.columnSection>* {
+ float: left;
+ margin: 10px 20px 10px 0px;
+ overflow:hidden;
+}
+
+DIV.columnSection>FIELDSET,
+DIV.columnSection>DIV.DivContentBox,
+DIV.columnSection>DIV.DivContentBoxSpecial
+ {
+ width: 480px;
+
+}
+
+
END
}
@@ -7605,7 +7988,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(' |