[LON-CAPA-cvs] cvs: loncom /interface lonhtmlcommon.pm slotrequest.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 21 Nov 2005 21:20:07 -0000
albertel Mon Nov 21 16:20:07 2005 EDT
Modified files:
/loncom/interface lonhtmlcommon.pm slotrequest.pm
Log:
- control whther slots marked deleted show
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.119 loncom/interface/lonhtmlcommon.pm:1.120
--- loncom/interface/lonhtmlcommon.pm:1.119 Tue Nov 15 16:08:47 2005
+++ loncom/interface/lonhtmlcommon.pm Mon Nov 21 16:20:06 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.119 2005/11/15 21:08:47 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.120 2005/11/21 21:20:06 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -207,6 +207,28 @@
return $Str;
}
+
+=pod
+
+=item radiobutton
+
+=cut
+
+##############################################
+##############################################
+sub radio {
+ my ($name,$checked,$value) = @_;
+ my $Str = '<input type="radio" name="'.$name.'" ';
+ if (defined($value)) {
+ $Str .= 'value="'.$value.'"';
+ }
+ if ($checked eq $value) {
+ $Str .= ' checked="1"';
+ }
+ $Str .= ' />';
+ return $Str;
+}
+
##############################################
##############################################
Index: loncom/interface/slotrequest.pm
diff -u loncom/interface/slotrequest.pm:1.34 loncom/interface/slotrequest.pm:1.35
--- loncom/interface/slotrequest.pm:1.34 Mon Nov 21 14:50:36 2005
+++ loncom/interface/slotrequest.pm Mon Nov 21 16:20:06 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler for requesting to have slots added to a students record
#
-# $Id: slotrequest.pm,v 1.34 2005/11/21 19:50:36 albertel Exp $
+# $Id: slotrequest.pm,v 1.35 2005/11/21 21:20:06 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -524,10 +524,15 @@
}
sub to_show {
- my ($when,$slot) = @_;
+ my ($slot,$when,$deleted) = @_;
my $time=time;
my $week=60*60*24*7;
- if ($when eq 'now') {
+ if ($deleted eq 'hide' && $slot->{'type'} eq 'deleted') {
+ return 0;
+ }
+ if ($when eq 'any') {
+ return 1;
+ } elsif ($when eq 'now') {
if ($time > $slot->{'starttime'} &&
$time < $slot->{'endtime'}) {
return 1;
@@ -605,10 +610,11 @@
$r->print('</div>');
}
- my %Saveable_Parameters = ('show' => 'array',
- 'when' => 'scalar',
- 'order' => 'scalar');
-
+ my %Saveable_Parameters = ('show' => 'array',
+ 'when' => 'scalar',
+ 'order' => 'scalar',
+ 'deleted' => 'scalar',
+ );
&Apache::loncommon::store_course_settings('slotrequest',\%Saveable_Parameters);
&Apache::loncommon::restore_course_settings('slotrequest',\%Saveable_Parameters);
@@ -634,22 +640,48 @@
my %show = map { $_ => 1 } (@show);
my %when_fields=&Apache::lonlocal::texthash(
- 'now' => 'Open now',
+ 'now' => 'Open now',
'nextweek' => 'Open within the next week',
'lastweek' => 'Were open last week',
'willopen' => 'Will open later',
- 'wereopen' => 'Were open');
- my @when_order=('now','nextweek','lastweek','willopen','wereopen');
+ 'wereopen' => 'Were open',
+ 'any' => 'Anytime',
+ );
+ my @when_order=('any','now','nextweek','lastweek','willopen','wereopen');
$when_fields{'select_form_order'} = \@when_order;
my $when = (exists($env{'form.when'})) ? $env{'form.when'}
: 'now';
+ my $hide_radio =
+ &Apache::lonhtmlcommon::radio('deleted',$env{'form.deleted'},'hide');
+ my $show_radio =
+ &Apache::lonhtmlcommon::radio('deleted',$env{'form.deleted'},'show');
+
$r->print('<form method="POST" action="/adm/slotrequest">
<input type="hidden" name="command" value="showslots" />');
$r->print('<div>');
- $r->print('<table class="inline"><tr><th>'.&mt('Show').'</th><th>'.&mt('Open').'</th></tr><tr><td>'.&Apache::loncommon::multiple_select_form('show',\@show,6,\%show_fields,\@show_order).
- '</td><td>'.&Apache::loncommon::select_form($when,'when',%when_fields).
- '</td></tr></table>');
+ $r->print('<table class="inline">
+ <tr><th>'.&mt('Show').'</th>
+ <th>'.&mt('Open').'</th>
+ <th>'.&mt('Options').'</th>
+ </tr>
+ <tr><td>'.&Apache::loncommon::multiple_select_form('show',\@show,6,\%show_fields,\@show_order).
+ '</td>
+ <td>'.&Apache::loncommon::select_form($when,'when',%when_fields).
+ '</td>
+ <td>
+ <table>
+ <tr>
+ <td rowspan="2">Deleted slots:</td>
+ <td><label>'.$show_radio.'Show</label></td>
+ </tr>
+ <tr>
+ <td><label>'.$hide_radio.'Hide</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>');
$r->print('</div>');
$r->print('<p><input type="submit" name="start" value="'.&mt('Update Display').'" /></p>');
my $linkstart='<a href="/adm/slotrequest?command=showslots&order=';
@@ -691,7 +723,7 @@
return $slots{$a}->{'starttime'} <=> $slots{$b}->{'starttime'};
};
foreach my $slot (sort $slotsort (keys(%slots))) {
- if (!&to_show($when,$slots{$slot})) { next; }
+ if (!&to_show($slots{$slot},$when,$env{'form.deleted'})) { next; }
if (defined($slots{$slot}->{'type'})
&& $slots{$slot}->{'type'} ne 'schedulable_student') {
#next;