[LON-CAPA-cvs] cvs: loncom /interface groupsort.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 26 Aug 2003 05:44:12 -0000
albertel Tue Aug 26 01:44:12 2003 EDT
Modified files:
/loncom/interface groupsort.pm
Log:
- BUG#1414, You can't reorder 1 resource, so if only one resource selected just insert it right away.
Index: loncom/interface/groupsort.pm
diff -u loncom/interface/groupsort.pm:1.21 loncom/interface/groupsort.pm:1.22
--- loncom/interface/groupsort.pm:1.21 Fri Jun 13 20:15:01 2003
+++ loncom/interface/groupsort.pm Tue Aug 26 01:44:11 2003
@@ -2,7 +2,7 @@
# The LON-CAPA group sort handler
# Allows for sorting prior to import into RAT.
#
-# $Id: groupsort.pm,v 1.21 2003/06/14 00:15:01 albertel Exp $
+# $Id: groupsort.pm,v 1.22 2003/08/26 05:44:11 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -139,7 +139,6 @@
</script>
</head>
END
- $r->print(&Apache::loncommon::bodytag('Sort Imported Resources'));
# read pertinent machine configuration
my $domain = $r->dir_config('lonDefDomain');
$iconpath = $r->dir_config('lonIconsURL') . "/";
@@ -290,7 +289,9 @@
untie %hash;
my $ctr = 0;
my $clen = scalar(keys %shash);
- $r->print(<<END);
+ if ($clen > 1) {
+ $r->print(&Apache::loncommon::bodytag('Sort Imported Resources'));
+ $r->print(<<END);
<b><font color="#888888">Finalize order of resources</font></b>
<form method='post' action='/adm/groupsort' name='groupsort'
enctype='application/x-www-form-urlencoded'>
@@ -300,32 +301,42 @@
<input type="hidden" name="mode" value="$ENV{'form.mode'}" />
END
-# --- Expand here if "GO BACK" button desired
- if ($ENV{'form.catalogmode'} eq 'groupimport') {
- $r->print(<<END);
+ # --- Expand here if "GO BACK" button desired
+ if ($ENV{'form.catalogmode'} eq 'groupimport') {
+ $r->print(<<END);
<input type="button" name="alter" value="GO BACK"
onClick="window.location='/res/?catalogmode=groupimport'" />
END
- }
- if ($ENV{'form.catalogmode'} eq 'groupsearch') {
- $r->print(<<END);
+ }
+ if ($ENV{'form.catalogmode'} eq 'groupsearch') {
+ $r->print(<<END);
<input type="button" name="alter" value="New Search"
onClick="window.location='/adm/searchcat?catalogmode=groupsearch&cleargroupsort=1'" />
END
- }
-# ---
+ }
+ # ---
- $r->print(<<END);
+ $r->print(<<END);
<input type="button" name="alter" value="FINISH IMPORT"
onClick="finish_import()" />
<input type="button" name="alter" value="CANCEL" onClick="self.close()" />
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>Change order</b></td>".
- "\n");
- $r->print("<td colspan='2' bgcolor='$titleclr'><b>Title</b></td>\n");
- $r->print("<td bgcolor='$titleclr'><b>Path</b></td></tr>\n");
+ $r->print("<table border='0'><tr><td bgcolor='#eeeeee'>");
+ $r->print("<table border=0><tr>\n");
+ $r->print("<td colspan='2' bgcolor='$titleclr'><b>Change order</b></td>\n");
+ $r->print("<td colspan='2' bgcolor='$titleclr'><b>Title</b></td>\n");
+ $r->print("<td bgcolor='$titleclr'><b>Path</b></td></tr>\n");
+ } else {
+ $r->print(<<END);
+<body>
+<form method='post' action='/adm/groupsort' name='groupsort'
+ enctype='application/x-www-form-urlencoded'>
+<input type="hidden" name="fnum" value="$clen" />
+<input type="hidden" name="oldval" value="" />
+<input type="hidden" name="newval" value="" />
+<input type="hidden" name="mode" value="$ENV{'form.mode'}" />
+END
+ }
foreach (sort {$shash{$a}<=>$shash{$b}} (keys %shash)) {
my $key=$_;
$ctr++;
@@ -336,22 +347,35 @@
# The unless conditional that follows is a bit of overkill
$iconname = $curfext.".gif" unless
(!defined($embstyle) || $embstyle eq 'unk' || $embstyle eq 'hdn');
- $r->print("<tr><td bgcolor='$fileclr'>");
- $r->print(&movers($clen,$ctr));
+ if ($clen > 1) {
+ $r->print("<tr><td bgcolor='$fileclr'>");
+ $r->print(&movers($clen,$ctr));
+ }
$r->print(&hidden($ctr-1,$thash{$key},$key));
- $r->print("</td><td bgcolor='$fileclr'>");
- $r->print(&select_box($clen,$ctr));
- $r->print("</td><td bgcolor='$fileclr'>");
- $r->print("<img src='$iconpath$iconname'>");
- $r->print("</td><td bgcolor='$fileclr'>");
- $r->print("$thash{$key}</td><td bgcolor='$fileclr'>\n");
- $r->print("$key</td></tr>\n");
- }
- $r->print("</table></td></tr></table></form>");
+ if ($clen > 1) {
+ $r->print("</td><td bgcolor='$fileclr'>");
+ $r->print(&select_box($clen,$ctr));
+ $r->print("</td><td bgcolor='$fileclr'>");
+ $r->print("<img src='$iconpath$iconname'>");
+ $r->print("</td><td bgcolor='$fileclr'>");
+ $r->print("$thash{$key}</td><td bgcolor='$fileclr'>\n");
+ $r->print("$key</td></tr>\n");
+ }
+ }
+ if ($clen > 1) {
+ $r->print("</table></td></tr></table></form>");
+ } else {
+ $r->print(<<END);
+<script type="text/javascript">
+ finish_import();
+</script>
+END
+ }
$r->print(<<END);
</body>
</html>
END
+
return OK;
}