--- loncom/interface/loncommon.pm 2008/09/29 22:58:41 1.679.2.6 +++ loncom/interface/loncommon.pm 2008/09/13 02:37:26 1.686 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.679.2.6 2008/09/29 22:58:41 raeburn Exp $ +# $Id: loncommon.pm,v 1.686 2008/09/13 02:37:26 raeburn 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(); @@ -3353,21 +3354,16 @@ sub pprmlink { sub timehash { - 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() ); + 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] ); } sub utc_string { @@ -3377,24 +3373,6 @@ 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)); @@ -4575,7 +4553,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; } @@ -4589,7 +4566,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; @@ -5446,6 +5423,28 @@ 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; + +} END } @@ -8330,10 +8329,8 @@ sub build_recipient_list { } elsif ($origmail ne '') { push(@recipients,$origmail); } - if (defined($defmail)) { - if ($defmail ne '') { - push(@recipients,$defmail); - } + if ($defmail ne '') { + push(@recipients,$defmail); } if ($otheremails) { my @others; @@ -9476,6 +9473,44 @@ 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 $symb=($env{'form.symb'} ne '' ? $env{'form.symb'} : (&Apache::lonnet::symbread($url))); + if ($symb eq '') { + if (!$silent) { + $request->print("Unable to handle ambiguous references:$url:."); + return (); + } + } + &Apache::lonenc::check_decrypt(\$symb); + return ($symb); +} + +# --------------------------------------------------------------Get annotation + +sub get_annotation { + my ($symb,$enc) = @_; + + my $key = $symb; + if (!$enc) { + $key = + &Apache::lonnet::clutter((&Apache::lonnet::decode_symb($symb))[2]); + } + my %annotation=&Apache::lonnet::get('nohist_annotations',[$key]); + return $annotation{$key}; +} + +sub clean_symb { + my ($symb) = @_; + + &Apache::lonenc::check_decrypt(\$symb); + my $enc = $env{'request.enc'}; + delete($env{'request.enc'}); + + return ($symb,$enc); +} =pod