--- loncom/interface/lonhtmlcommon.pm 2006/05/29 16:01:22 1.129 +++ loncom/interface/lonhtmlcommon.pm 2006/06/16 22:37:10 1.134 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.129 2006/05/29 16:01:22 raeburn Exp $ +# $Id: lonhtmlcommon.pm,v 1.134 2006/06/16 22:37:10 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -60,6 +60,8 @@ use Time::Local; use Time::HiRes; use Apache::lonlocal; use Apache::lonnet; +use lib '/home/httpd/lib/perl/'; +use LONCAPA; ############################################## ############################################## @@ -93,7 +95,7 @@ sub authorbombs { sub recent_filename { my $area=shift; - return 'nohist_recent_'.&Apache::lonnet::escape($area); + return 'nohist_recent_'.&escape($area); } sub store_recent { @@ -115,7 +117,7 @@ sub store_recent { } # store new value &Apache::lonnet::put($file,{ $name => - time.'&'.&Apache::lonnet::escape($value) }); + time.'&'.&escape($value) }); } sub remove_recent { @@ -134,7 +136,7 @@ sub select_recent { unless ($_=~/^error\:/) { my $escaped = &Apache::loncommon::escape_url($_); $return.="\n'; } } @@ -148,8 +150,13 @@ sub get_recent { # Create hash with key as time and recent as value my %time_hash = (); + my $nfrozen = 0; foreach (keys %recent) { - my $thistime=(split(/\&/,$recent{$_}))[0]; + my ($thistime,$thisvalue)=(split(/\&/,$recent{$_})); + if (($thisvalue eq 'role_frozen') && ($area='roles')) { + $thistime=time+$nfrozen; + $nfrozen++; + } $time_hash{$thistime} = $_; } @@ -158,7 +165,7 @@ sub get_recent { my $idx = 1; foreach (reverse sort keys %time_hash) { $return_hash{$time_hash{$_}} = - &Apache::lonnet::unescape((split(/\&/,$recent{$_}))[1]); + &unescape((split(/\&/,$recent{$time_hash{$_}}))[1]); if ($n && ($idx++ >= $n)) {last;} } @@ -281,7 +288,7 @@ The method used to restrict user input w ############################################## sub date_setter { my ($formname,$dname,$currentvalue,$special,$includeempty,$state, - $no_hh_mm_ss,$defhour,$defmin,$defsec) = @_; + $no_hh_mm_ss,$defhour,$defmin,$defsec,$nolink) = @_; my $wasdefined=1; if (! defined($state) || $state ne 'disabled') { $state = ''; @@ -429,17 +436,24 @@ ENDJS $hourselector .= " \n"; my $minuteselector = qq{}; my $secondselector= qq{}; - my $cal_link = qq{}; + my $cal_link; + if (!$nolink) { + $cal_link = qq{}; + } # if ($no_hh_mm_ss) { - $result .= &mt('[_1] [_2] [_3] [_4]Select Date[_5]', - $monthselector,$dayselector,$yearselector, - $cal_link,''); + $result .= &mt('[_1] [_2] [_3] ', + $monthselector,$dayselector,$yearselector); + if (!$nolink) { + $result .= &mt('[_4]Select Date[_5]',$cal_link,''); + } } else { - $result .= &mt('[_1] [_2] [_3] [_4] [_5]m [_6]s [_7]Select Date[_8]', - $monthselector,$dayselector,$yearselector, - $hourselector,$minuteselector,$secondselector, - $cal_link,''); + $result .= &mt('[_1] [_2] [_3] [_4] [_5]m [_6]s ', + $monthselector,$dayselector,$yearselector, + $hourselector,$minuteselector,$secondselector); + if (!$nolink) { + $result .= &mt('[_7]Select Date[_8]',$cal_link,''); + } } $result .= "\n\n"; return $result; @@ -818,10 +832,10 @@ sub Create_PrgWin { function openpopwin () { popwin=open(\'\',\'popwin\',\'width=400,height=100\');". "popwin.document.writeln(\'".$start_page. - "

$heading

". - "
". + "

$heading<\/h4>". + "". ''.$end_page. + &mt('Starting').'" /><\\/form>'.$end_page. "\');". "popwin.document.close();}". "\nwindow.setTimeout(openpopwin,0)"); @@ -946,7 +960,7 @@ sub r_print { # ------------------------------------------------------- Puts directory header sub crumbs { - my ($uri,$target,$prefix,$form,$size,$noformat)=@_; + my ($uri,$target,$prefix,$form,$size,$noformat,$skiplast)=@_; if (! defined($size)) { $size = '+2'; } @@ -962,7 +976,14 @@ sub crumbs { foreach my $dir (split('/',$uri)) { if (! $dir) { next; } $path .= $dir; - unless ($path eq $uri) { $path.='/'; } + if ($path eq $uri) { + if ($skiplast) { + $output.=$dir; + last; + } + } else { + $path.='/'; + } my $linkpath = &Apache::loncommon::escape_single($path); if ($form) { $linkpath= @@ -996,7 +1017,7 @@ var checkwin; function spellcheckerwindow() { checkwin=window.open($nothing,'spellcheckwin','height=320,width=280,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no'); - checkwin.document.writeln('$start_page
$end_page'); + checkwin.document.writeln('$start_page
<\\/form>$end_page'); checkwin.document.close(); } // END LON-CAPA Internal --> @@ -1079,7 +1100,7 @@ sub disablelink { if (defined($#fields)) { unless ($#fields>=0) { return ''; } } - return ''.&mt('Disable WYSIWYG Editor').''; + return ''.&mt('Disable WYSIWYG Editor').''; } sub enablelink { @@ -1087,7 +1108,7 @@ sub enablelink { if (defined($#fields)) { unless ($#fields>=0) { return ''; } } - return ''.&mt('Enable WYSIWYG Editor').''; + return ''.&mt('Enable WYSIWYG Editor').''; } # ----------------------------------------- Script to activate only some fields