[LON-CAPA-cvs] cvs: loncom /interface lonparmset.pm
www
lon-capa-cvs@mail.lon-capa.org
Sun, 05 Jun 2005 17:24:07 -0000
This is a MIME encoded message
--www1117992247
Content-Type: text/plain
www Sun Jun 5 13:24:07 2005 EDT
Modified files:
/loncom/interface lonparmset.pm
Log:
Bug #3079: logical display order for standard parameters, easier selection
--www1117992247
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20050605132407.txt"
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.209 loncom/interface/lonparmset.pm:1.210
--- loncom/interface/lonparmset.pm:1.209 Sat Jun 4 21:37:26 2005
+++ loncom/interface/lonparmset.pm Sun Jun 5 13:24:04 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.209 2005/06/05 01:37:26 www Exp $
+# $Id: lonparmset.pm,v 1.210 2005/06/05 17:24:04 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -667,7 +667,9 @@
my $symbp = shift;
my $maptitles=shift;
my $uris=shift;
+ my $keyorder=shift;
+ my $keyordercnt=100;
my $navmap = Apache::lonnavmaps::navmap->new();
my @allres=$navmap->retrieveResources(undef,undef,1,undef,1);
@@ -709,6 +711,14 @@
} else {
$$keyp{$id}=$key;
}
+#
+# Put in order
+#
+ unless ($$keyorder{$key}) {
+ $$keyorder{$key}=$keyordercnt;
+ $keyordercnt++;
+ }
+
}
}
$$mapp{$id}=
@@ -743,6 +753,46 @@
}
}
}
+
+ function checkthis(thisvalue, checkName) {
+ for (i=0; i<document.forms.parmform.elements.length; i++) {
+ ele = document.forms.parmform.elements[i];
+ if (ele.name == checkName) {
+ if (ele.value == thisvalue) {
+ document.forms.parmform.elements[i].checked=true;
+ }
+ }
+ }
+ }
+
+ function checkdates() {
+ checkthis('duedate','pscat');
+ checkthis('opendate','pscat');
+ checkthis('answerdate','pscat');
+ checkthis('interval','pscat');
+ }
+
+ function checkvisi() {
+ checkthis('hiddenresource','pscat');
+ checkthis('encrypturl','pscat');
+ checkthis('problemstatus','pscat');
+ checkthis('contentopen','pscat');
+ checkthis('opendate','pscat');
+ }
+
+ function checkparts() {
+ checkthis('hiddenparts','pscat');
+ checkthis('display','pscat');
+ checkthis('ordered','pscat');
+ }
+
+ function checkstandard() {
+ checkall(false,'pscat');
+ checkdates();
+ checkthis('weight','pscat');
+ checkthis('maxtries','pscat');
+ }
+
</script>
ENDSCRIPT
$r->print();
@@ -764,9 +814,14 @@
}
$r->print('
</tr><tr><td>
-<input type="button" onclick="checkall(true, \'pscat\')" value="Select All" />
-</td><td></td><td>
-<input type="button" onclick="checkall(false, \'pscat\')" value="Unselect All" />
+<a href="javascript:checkall(true, \'pscat\')">Select All</a>
+<a href="javascript:checkstandard()">Select Standard</a>
+</td><td>
+<a href="javascript:checkdates()">Select Dates</a>
+<a href="javascript:checkvisi()">Select Visibilities</a>
+<a href="javascript:checkparts()">Select Part Parameters</a>
+</td><td>
+<a href="javascript:checkall(false, \'pscat\')">Unselect All</a>
</td>
');
$r->print('</tr></table>');
@@ -868,6 +923,18 @@
$r->print("</select>");
}
+sub keysplit {
+ my $keyp=shift;
+ return (split(/\,/,$keyp));
+}
+
+sub keysinorder {
+ my ($name,$keyorder)=@_;
+ return sort {
+ $$keyorder{$a} <=> $$keyorder{$b};
+ } (keys %{$name});
+}
+
##################################################
##################################################
@@ -928,7 +995,27 @@
my %allparms;
my %allparts;
-
+#
+# Order in which these parameters will be displayed
+#
+ my %keyorder=('parameter_0_opendate' => 1,
+ 'parameter_0_duedate' => 2,
+ 'parameter_0_answerdate' => 3,
+ 'parameter_0_interval' => 4,
+ 'parameter_0_weight' => 5,
+ 'parameter_0_maxtries' => 6,
+ 'parameter_0_hinttries' => 7,
+ 'parameter_0_contentopen' => 8,
+ 'parameter_0_contentclose' => 9,
+ 'parameter_0_type' => 10,
+ 'parameter_0_problemstatus' => 11,
+ 'parameter_0_hiddenresource' => 12,
+ 'parameter_0_hiddenparts' => 13,
+ 'parameter_0_display' => 14,
+ 'parameter_0_ordered' => 15,
+ 'parameter_0_tol' => 16,
+ 'parameter_0_sig' => 17,
+ 'parameter_0_turnoffunit' => 18);
@ids=();
%symbp=();
%typep=();
@@ -1022,7 +1109,9 @@
unless ($csec) { $csec=''; }
# --------------------------------------------------------- Get all assessments
- &extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, \%mapp, \%symbp,\%maptitles,\%uris);
+ &extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps,
+ \%mapp, \%symbp,\%maptitles,\%uris,
+ \%keyorder);
$mapp{'0.0'} = '';
$symbp{'0.0'} = '';
@@ -1054,8 +1143,6 @@
$r->print('<input type="hidden" value="'.
$env{'form.recent_'.$_}.'" name="recent_'.$_.'">');
}
-
- $r->print('<h2>'.$message.'</h2>');
if (!$pssymb) {
$r->print('<table border="1"><tr><td>');
@@ -1074,6 +1161,8 @@
}
&usermenu($r,$uname,$id,$udom,$csec);
+ $r->print('<p>'.$message.'</p>');
+
$r->print('<br /><input type="submit" name="dis" value="'.&mt("Update Parameter Display").'" />');
my @temp_pscat;
@@ -1176,7 +1265,7 @@
my %default=();
my $uri=&Apache::lonnet::declutter($uris{$rid});
- foreach (split(/\,/,$keyp{$rid})) {
+ foreach (&keysplit($keyp{$rid})) {
my $tempkeyp = $_;
if (grep $_ eq $tempkeyp, @catmarker) {
$part{$_}=&Apache::lonnet::metadata($uri,$_.'.part');
@@ -1220,7 +1309,7 @@
$r->print('</font></tt></td>');
- foreach (sort keys %name) {
+ foreach (&keysinorder(\%name,\%keyorder)) {
unless ($firstrow) {
$r->print('<tr>');
} else {
@@ -1283,7 +1372,7 @@
# When storing information, store as part 0
# When requesting information, request from full part
#-------------------------------------------------------------------
- foreach (split(/\,/,$keyp{$rid})) {
+ foreach (&keysplit($keyp{$rid})) {
my $tempkeyp = $_;
my $fullkeyp = $tempkeyp;
$tempkeyp =~ s/_\w+_/_0_/;
@@ -1333,12 +1422,11 @@
$r->print('<th>'.&mt('Default Value').'</th>');
$r->print('<th>'.&mt('Parameter in Effect').'</th></tr>');
- foreach (sort keys %name) {
+ foreach (&keysinorder(\%name,\%keyorder)) {
$r->print('<tr>');
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default,
\%type,\%display,$defbgone,$defbgtwo,
$parmlev,$uname,$udom,$csec);
-# $r->print("<tr><td>resource.$part{$_}.$name{$_},$symbp{$mapid}</td></tr>\n");
}
$r->print("</table></center>");
} # end each map
@@ -1370,7 +1458,7 @@
# When storing information, store as part 0
# When requesting information, request from full part
#-------------------------------------------------------------------
- foreach (split(/\,/,$keyp{$rid})) {
+ foreach (&keysplit($keyp{$rid})) {
my $tempkeyp = $_;
my $fullkeyp = $tempkeyp;
$tempkeyp =~ s/_\w+_/_0_/;
@@ -1411,11 +1499,10 @@
$r->print('<th>'.&mt('Default Value').'</th>');
$r->print('<th>'.&mt('Parameter in Effect').'</th></tr>');
- foreach (sort keys %name) {
+ foreach (&keysinorder(\%name,\%keyorder)) {
$r->print('<tr>');
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default,
\%type,\%display,$defbgone,$defbgtwo,$parmlev,$uname,$udom,$csec);
-# $r->print("<tr><td>resource.$part{$_}.$name{$_},$symbp{$mapid}</td></tr>\n");
}
$r->print("</table></center>");
} # end of $parmlev eq general
--www1117992247--