--- loncom/interface/lonhelper.pm	2005/04/11 18:13:39	1.102
+++ loncom/interface/lonhelper.pm	2005/07/07 04:16:01	1.106
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # .helper XML handler to implement the LON-CAPA helper
 #
-# $Id: lonhelper.pm,v 1.102 2005/04/11 18:13:39 albertel Exp $
+# $Id: lonhelper.pm,v 1.106 2005/07/07 04:16:01 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3183,7 +3183,7 @@ sub render {
     my $targetURL = '';
     my $finish=&mt('Finish');
     if ($self->{'restartCourse'}) {
-	my $actionURL = '/adm/roles';
+	$actionURL = '/adm/roles';
 	$targetURL = '/adm/menu';
 	if ($env{'course.'.$env{'request.course.id'}.'.url'}=~/^uploaded/) {
 	    $targetURL = '/adm/coursedocs';
@@ -3279,7 +3279,13 @@ sub render {
     # Print the granularity, depending on the action
     if ($vars->{GRANULARITY} eq 'whole_course') {
         $resourceString .= '<li>'.&mt('for <b>all resources in the course</b>').'</li>';
-        $level = 9; # general course, see lonparmset.pm perldoc
+	if ($vars->{TARGETS} eq 'course') {
+	    $level = 11; # general course, see lonparmset.pm perldoc
+	} elsif ($vars->{TARGETS} eq 'section') {
+	    $level = 6;
+	} else {
+	    $level = 3;
+	}
         $affectedResourceId = "0.0";
         $symb = 'a';
         $paramlevel = 'general';
@@ -3289,7 +3295,13 @@ sub render {
         my $title = $res->compTitle();
         $symb = $res->symb();
         $resourceString .= '<li>'.&mt('for the map named [_1]',"<b>$title</b>").'</li>';
-        $level = 8;
+	if ($vars->{TARGETS} eq 'course') {
+	    $level = 10; # general course, see lonparmset.pm perldoc
+	} elsif ($vars->{TARGETS} eq 'section') {
+	    $level = 5;
+	} else {
+	    $level = 2;
+	}
         $affectedResourceId = $vars->{RESOURCE_ID};
         $paramlevel = 'map';
     } else {
@@ -3300,22 +3312,35 @@ sub render {
         $symb = $res->symb();
         my $title = $res->compTitle();
         $resourceString .= '<li>'.&mt('for the resource named [_1] part [_2]',"<b>$title</b>","<b>$part</b>").'</li>';
-        $level = 7;
+	if ($vars->{TARGETS} eq 'course') {
+	    $level = 7; # general course, see lonparmset.pm perldoc
+	} elsif ($vars->{TARGETS} eq 'section') {
+	    $level = 4;
+	} else {
+	    $level = 1;
+	}
         $affectedResourceId = $vars->{RESOURCE_ID};
         $paramlevel = 'full';
     }
 
-    my $result = "<form name='helpform' method='get' action='/adm/parmset#$affectedResourceId&$parm_name&$level'>\n";
+    my $result = "<form name='helpform' method='POST' action='/adm/parmset#$affectedResourceId&$parm_name&$level'>\n";
+    $result .= "<input type='hidden' name='action' value='settable' />\n";
+    $result .= "<input type='hidden' name='dis' value='helper' />\n";
+    if ($vars->{ACTION_TYPE} eq 'tries') {
+	$result .= "<input type='hidden' name='pscat' value='maxtries' />\n";
+    } else {
+	$result .= "<input type='hidden' name='pscat' value='".
+	    HTML::Entities::encode($vars->{ACTION_TYPE},"'<>&\"") . "' />\n";
+    }
     if ($vars->{GRANULARITY} eq 'resource') {
 	$result .= "<input type='hidden' name='symb' value='".
 	    HTML::Entities::encode($symb,"'<>&\"") . "' />\n";
-	$result .= "<input type='hidden' name='pscat' value='".
-	    HTML::Entities::encode($vars->{ACTION_TYPE},"'<>&\"") . "' />\n";
-	my $part = $vars->{RESOURCE_ID_part};
-	if ($part eq 'All Parts' || !$part) { $part=0; }
-	$result .= "<input type='hidden' name='psprt' value='".
-	    HTML::Entities::encode($part,"'<>&\"") . "' />\n";
     }
+    my $part = $vars->{RESOURCE_ID_part};
+    if ($part eq 'All Parts' || !$part) { $part=0; }
+    $result .= "<input type='hidden' name='psprt' value='".
+	HTML::Entities::encode($part,"'<>&\"") . "' />\n";
+
     $result .= '<p>'.&mt('Confirm that this information is correct, then click &quot;Finish Helper&quot; to complete setting the parameter.').'<ul>';
     
     # Print the type of manipulation:
@@ -3353,6 +3378,8 @@ sub render {
     } elsif ($vars->{ACTION_TYPE} eq 'tries') {
 	$result .= "<input type='hidden' name='pres_value' " .
 	    "value='" . $vars->{TRIES} . "' />\n";
+        $result .= "<input type='hidden' name='pres_type' " .
+            "value='int_pos' />\n";
     } elsif ($vars->{ACTION_TYPE} eq 'weight') {
 	$result .= "<input type='hidden' name='pres_value' " .
 	    "value='" . $vars->{WEIGHT} . "' />\n";
@@ -3366,19 +3393,17 @@ sub render {
     } elsif ($vars->{TARGETS} eq 'section') {
         my $section = $vars->{SECTION_NAME};
         $result .= '<li>'.&mt('for section [_1]',"<b>$section</b>").'</li>';
-        $level -= 3;
-        $result .= "<input type='hidden' name='csec' value='" .
+	$result .= "<input type='hidden' name='csec' value='" .
             HTML::Entities::encode($section,"'<>&\"") . "' />\n";
     } else {
         # FIXME: This is probably wasteful! Store the name!
         my $classlist = Apache::loncoursedata::get_classlist();
         my $username = $vars->{USER_NAME};
         # Chop off everything after the last colon (section)
-        $username = substr($username, 0, rindex($username, ':'));
-        my $name = $classlist->{$username}->[6];
+	my ($uname,$udom)=split(':',$username);
+        my $name = $classlist->{$uname.':'.$udom}->[6];
         $result .= '<li>'.&mt('for [_1]',"<b>$name</b>").'</li>';
-        $level -= 6;
-        my ($uname, $udom) = split /:/, $vars->{USER_NAME};
+	my ($uname, $udom) = split /:/, $vars->{USER_NAME};
         $result .= "<input type='hidden' name='uname' value='".
             HTML::Entities::encode($uname,"'<>&\"") . "' />\n";
         $result .= "<input type='hidden' name='udom' value='".