version 1.65, 2007/10/06 04:32:49
|
version 1.67.2.1, 2007/11/28 17:36:11
|
Line 72 sub handler {
|
Line 72 sub handler {
|
my $roledom = $env{'form.roleelement'}; |
my $roledom = $env{'form.roleelement'}; |
if ($roledom) { |
if ($roledom) { |
$roleelement = '<input type="hidden" name="roleelement" value="'.$roledom.'" />'; |
$roleelement = '<input type="hidden" name="roleelement" value="'.$roledom.'" />'; |
$submitopener = &Apache::lonroles::processpick(); |
$submitopener = &processpick(); |
$autosubmit = 'process_pick("'.$roledom.'")'; |
$autosubmit = 'process_pick("'.$roledom.'")'; |
} |
} |
|
|
Line 83 sub handler {
|
Line 83 sub handler {
|
} |
} |
|
|
my %loaditem; |
my %loaditem; |
if ($env{'form.form'} eq 'cu' && $env{'form.pickedcourse'}) { |
if ((($env{'form.form'} eq 'cu') || ($env{'form.form'} eq 'studentform')) && |
|
($env{'form.pickedcourse'})) { |
$loaditem{'onload'} ="setSections()"; |
$loaditem{'onload'} ="setSections()"; |
} |
} |
$r->print(&Apache::loncommon::start_page($title,undef, |
$r->print(&Apache::loncommon::start_page($title,undef, |
Line 92 sub handler {
|
Line 93 sub handler {
|
|
|
if ($env{'form.form'} eq 'portform') { |
if ($env{'form.form'} eq 'portform') { |
$lastaction = 'document.courselist.submit()'; |
$lastaction = 'document.courselist.submit()'; |
} elsif ($env{'form.form'} eq 'cu') { |
} elsif ($env{'form.form'} eq 'cu' || ($env{'form.form'} eq 'studentform' && |
|
!$multiple)) { |
$lastaction = |
$lastaction = |
'document.courselist.pickedcourse.value = cdom+"_"+cname;'."\n". |
'document.courselist.pickedcourse.value = cdom+"_"+cname;'."\n". |
'document.courselist.submit();'; |
'document.courselist.submit();'; |
Line 101 sub handler {
|
Line 103 sub handler {
|
} |
} |
|
|
# if called to assign a role in a course to a user via CUSR |
# if called to assign a role in a course to a user via CUSR |
if ($env{'form.form'} eq 'cu') { |
if ($env{'form.form'} eq 'cu' || $env{'form.form'} eq 'studentform') { |
$r->print(&create_user_javascript($type)); |
$r->print(&create_user_javascript($type)); |
} |
} |
|
|
Line 137 sub handler {
|
Line 139 sub handler {
|
return OK; |
return OK; |
} |
} |
|
|
|
sub processpick { |
|
my $openerform = 'rolechoice'; |
|
if ($env{'form.form'} eq 'studentform') { |
|
$openerform = $env{'form.form'}; |
|
} |
|
my $process_pick = <<"ENDONE"; |
|
<script type="text/javascript"> |
|
function process_pick(dom) { |
|
var pickedCourse=opener.document.$openerform.$env{'form.cnumelement'}.value; |
|
var pickedDomain=opener.document.$openerform.$env{'form.cdomelement'}.value; |
|
var okDomain = 0; |
|
ENDONE |
|
if ($openerform eq 'rolechoice') { |
|
$process_pick .= <<"ENDTWO"; |
|
if (pickedDomain == dom) { |
|
if (pickedCourse != '') { |
|
var courseTarget = "cc./"+pickedDomain+"/"+pickedCourse |
|
opener.document.title='Role selected. Please stand by.'; |
|
opener.status='Role selected. Please stand by.'; |
|
opener.document.rolechoice.newrole.value=courseTarget |
|
opener.document.rolechoice.submit(); |
|
} |
|
} |
|
else { |
|
alert("You may only use this screen to select courses in the current domain: "+dom+"\\nPlease return to the roles page window and click the 'Select Course' link for domain: "+pickedDomain+",\\n if you are a Domain Coordinator in that domain, and wish to become a Course Coordinator in a course in the domain"); |
|
} |
|
ENDTWO |
|
} else { |
|
$process_pick .= <<"ENDTHREE"; |
|
if (pickedDomain != dom) { |
|
alert("You may only use this screen to select courses in the current domain: "+dom+"\\nPlease return to the roles page window and click the 'Select Course' link for domain: "+pickedDomain+",\\n if you are a Domain Coordinator in that domain, and wish to become a Course Coordinator in a course in the domain"); |
|
return; |
|
} |
|
ENDTHREE |
|
} |
|
$process_pick .= " |
|
} |
|
|
|
</script> |
|
"; |
|
return $process_pick; |
|
} |
|
|
sub create_user_javascript { |
sub create_user_javascript { |
my ($type) = @_; |
my ($type) = @_; |
my $output; |
my $output; |
Line 303 sub build_filters {
|
Line 348 sub build_filters {
|
if ($formname eq 'portform') { |
if ($formname eq 'portform') { |
$filter->{$item} ||= $env{'user.domain'}; |
$filter->{$item} ||= $env{'user.domain'}; |
$allow_blank=0; |
$allow_blank=0; |
} |
} elsif ($formname eq 'studentform') { |
|
$filter->{$item} ||= $env{'request.role.domain'}; |
|
$allow_blank=0; |
|
} |
$domainselectform = |
$domainselectform = |
&Apache::loncommon::select_dom_form($filter->{$item}, |
&Apache::loncommon::select_dom_form($filter->{$item}, |
'domainfilter', |
'domainfilter', |
Line 382 $multelement
|
Line 430 $multelement
|
if ($domainselectform) { |
if ($domainselectform) { |
$output .= $lt{'cdo'}.': '.$domainselectform.'<br />'."\n"; |
$output .= $lt{'cdo'}.': '.$domainselectform.'<br />'."\n"; |
} |
} |
if ($typeselectform) { |
# if ($typeselectform) { |
$output .= $lt{'cog'}.': '.$typeselectform.'<br />'."\n"; |
# $output .= $lt{'cog'}.': '.$typeselectform.'<br />'."\n"; |
} |
# } |
if ($instcodeform) { |
if ($instcodeform) { |
$output .= $lt{'cin'}.': '.$instcodeform.'<br />'."\n"; |
$output .= $lt{'cin'}.': '.$instcodeform.'<br />'."\n"; |
} |
} |
Line 708 Side Effects: None
|
Line 756 Side Effects: None
|
X<gochoose_javascript()> |
X<gochoose_javascript()> |
B<gochoose_javascript($type,$multiple,$autosubmit,$lastaction)>: |
B<gochoose_javascript($type,$multiple,$autosubmit,$lastaction)>: |
|
|
Input: 4 - course type; single (0) or multiple courses (1); in context of DC selecting a CC role in a course: javascript code from Apache::lonroles::processpick(); final action to take after user chooses course(s): either close window, or submit form for display of next page etc. |
Input: 4 - course type; single (0) or multiple courses (1); in context of DC selecting a CC role in a course: javascript code from &processpick(); final action to take after user chooses course(s): either close window, or submit form for display of next page etc. |
|
|
Output: 1 $output - javascript wrapped in E<lt>scriptE<gt>E<lt>/scriptE<gt> tags |
Output: 1 $output - javascript wrapped in E<lt>scriptE<gt>E<lt>/scriptE<gt> tags |
|
|