[LON-CAPA-cvs] cvs: loncom /interface groupsort.pm
www
lon-capa-cvs@mail.lon-capa.org
Fri, 10 Jun 2005 20:43:13 -0000
www Fri Jun 10 16:43:13 2005 EDT
Modified files:
/loncom/interface groupsort.pm
Log:
Recover files
Index: loncom/interface/groupsort.pm
diff -u loncom/interface/groupsort.pm:1.36 loncom/interface/groupsort.pm:1.37
--- loncom/interface/groupsort.pm:1.36 Fri Jun 10 12:56:08 2005
+++ loncom/interface/groupsort.pm Fri Jun 10 16:43:10 2005
@@ -2,7 +2,7 @@
# The LON-CAPA group sort handler
# Allows for sorting prior to import into RAT.
#
-# $Id: groupsort.pm,v 1.36 2005/06/10 16:56:08 www Exp $
+# $Id: groupsort.pm,v 1.37 2005/06/10 20:43:10 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -227,6 +227,7 @@
&Apache::loncommon::plainname($2,$3).', '.
&Apache::lonlocal::locallocaltime($1);
}
+ $name=~s/\&colon\;/\:/g;
$$thash{$url}=$name;
$$shash{$url}=$n;
$n++;
@@ -253,14 +254,22 @@
# finish_import looks different for graphical or "simple" RAT
my $finishimport='';
+ my $begincondition='';
+ my $endcondition='';
+ if ($env{'form.readfile'}) {
+ $begincondition='if (eval("document.forms.groupsort.include"+num+".checked")) {';
+ $endcondition='}';
+ }
if ($env{'form.mode'} eq 'simple' || $env{'form.mode'} eq '') {
$finishimport=(<<ENDSMP);
function finish_import() {
opener.document.forms.simpleedit.importdetail.value='';
for (var num=0; num<document.forms.groupsort.fnum.value; num++) {
+ $begincondition
opener.document.forms.simpleedit.importdetail.value+='&'+
escape(eval("document.forms.groupsort.title"+num+".value"))+'='+
escape(eval("document.forms.groupsort.filelink"+num+".value"));
+ $endcondition
}
opener.document.forms.simpleedit.submit();
self.close();
@@ -271,6 +280,7 @@
function finish_import() {
var linkflag=false;
for (var num=0; num<document.forms.groupsort.fnum.value; num++) {
+ $begincondition
insertRowInLastRow();
placeResourceInLastRow(
eval("document.forms.groupsort.title"+num+".value"),
@@ -278,6 +288,7 @@
linkflag
);
linkflag=true;
+ $endcondition
}
opener.editmode=0;
opener.notclear=0;
@@ -349,7 +360,8 @@
'ca' => 'Cancel',
'co' => 'Change Order',
'ti' => 'Title',
- 'pa' => 'Path'
+ 'pa' => 'Path',
+ 'in' => 'Include'
);
$r->print(&Apache::loncommon::bodytag('Sort Imported Resources'));
$r->print(<<END);
@@ -387,7 +399,11 @@
END
$r->print("<table border='0'><tr><td bgcolor='#eeeeee'>");
$r->print("<table border=0><tr>\n");
- $r->print("<td colspan='2' bgcolor='$titleclr'><b>$lt{'co'}</b></td>\n");
+ if ($env{'form.readfile'}) {
+ $r->print("<td bgcolor='$titleclr'><b>$lt{'in'}</b></td>\n");
+ } else {
+ $r->print("<td colspan='2' bgcolor='$titleclr'><b>$lt{'co'}</b></td>\n");
+ }
$r->print("<td colspan='2' bgcolor='$titleclr'><b>$lt{'ti'}</b></td>\n");
$r->print("<td bgcolor='$titleclr'><b>$lt{'pa'}</b></td></tr>\n");
} else {
@@ -407,13 +423,21 @@
my $iconname=&Apache::loncommon::icon($key);
if ($clen > 1) {
$r->print("<tr><td bgcolor='$fileclr'>");
- $r->print(&movers($clen,$ctr));
+ if ($env{'form.readfile'}) {
+ $r->print(&checkbox($ctr-1));
+ } else {
+ $r->print(&movers($clen,$ctr));
+ }
}
$r->print(&hidden($ctr-1,$thash{$key},$key));
if ($clen > 1) {
- $r->print("</td><td bgcolor='$fileclr'>");
- $r->print(&select_box($clen,$ctr));
- $r->print("</td><td bgcolor='$fileclr'>");
+ $r->print("</td>");
+ unless ($env{'form.readfile'}) {
+ $r->print("<td bgcolor='$fileclr'>".
+ &select_box($clen,$ctr).
+ "</td>");
+ }
+ $r->print("<td bgcolor='$fileclr'>");
$r->print("<img src='$iconname' />");
$r->print("</td><td bgcolor='$fileclr'>");
$r->print("$thash{$key}$nhash{$key}</td><td bgcolor='$fileclr'>\n");
@@ -484,6 +508,15 @@
return $string;
}
+# ------------------------------------------------------------------- Checkbox
+
+sub checkbox {
+ my $sel=shift;
+ return "<label><input type='checkbox' name='include$sel'".
+ ($env{"form.include$sel"}?' checked="checked"':'').
+ ' />'.&mt('Include').'</label>';
+}
+
1;
__END__