version 1.55.6.4, 2010/12/03 04:56:56
|
version 1.65, 2011/03/03 00:33:38
|
Line 37 use Apache::lonnet;
|
Line 37 use Apache::lonnet;
|
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonacc(); |
use Apache::lonacc(); |
use Apache::courseclassifier; |
use Apache::courseclassifier; |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
|
|
|
|
sub handler { |
sub handler { |
my ($r) = @_; |
my ($r) = @_; |
Line 296 function initialize_codes() {
|
Line 297 function initialize_codes() {
|
&HTML::Entities::encode($udom,'"<>&').'" />'; |
&HTML::Entities::encode($udom,'"<>&').'" />'; |
my $uname_input = '<input type="hidden" name="uname" value="'. |
my $uname_input = '<input type="hidden" name="uname" value="'. |
&HTML::Entities::encode($uname,'"<>&').'" />'; |
&HTML::Entities::encode($uname,'"<>&').'" />'; |
if (($env{'user.name'} =~ /^$match_username$/) && |
if (($env{'user.name'} =~ /^$match_username$/) && |
($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) { |
($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) { |
$output .= '<i>'.$lt{'unme'}.'</i>: '.$uname.' <i>'.$lt{'doma'}.'</i>: '.$udom.$udom_input.$uname_input; |
$output .= '<i>'.$lt{'unme'}.'</i>: '.$uname.' <i>'.$lt{'doma'}.'</i>: '.$udom.$udom_input.$uname_input; |
} else { |
} else { |
Line 304 function initialize_codes() {
|
Line 305 function initialize_codes() {
|
my $unameform = ''; |
my $unameform = ''; |
if (($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) { |
if (($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) { |
$output .= $lt{'entu'}; |
$output .= $lt{'entu'}; |
} elsif (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
} elsif (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
$output .= $lt{'chdo'}; |
$output .= $lt{'chdo'}; |
} else { |
} else { |
$output .= $lt{'entr'}; |
$output .= $lt{'entr'}; |
Line 332 function initialize_codes() {
|
Line 333 function initialize_codes() {
|
$output .= &Apache::lonhtmlcommon::row_title("$lt{'urlp'}",undef,$css[$i]). |
$output .= &Apache::lonhtmlcommon::row_title("$lt{'urlp'}",undef,$css[$i]). |
$showserver.'<input type="hidden" name="sourceurl" value="'. |
$showserver.'<input type="hidden" name="sourceurl" value="'. |
&HTML::Entities::encode($server,'"<>&').'" />'. |
&HTML::Entities::encode($server,'"<>&').'" />'. |
|
&Apache::lonhtmlcommon::row_closure(). |
|
&Apache::lonhtmlcommon::row_title("$lt{'phon'}",undef,'LC_evenrow_value'). |
|
'<input type="text" size="15" name="phone" /><br />'. |
&Apache::lonhtmlcommon::row_closure(); |
&Apache::lonhtmlcommon::row_closure(); |
if (&Apache::loncommon::check_for_gci_dc()) { |
$num ++; |
$output .= &Apache::lonhtmlcommon::row_title("$lt{'phon'}",undef, |
$i = $num%2; |
'LC_evenrow_value'). |
$output .= &Apache::lonhtmlcommon::row_title("$lt{'crsd'}$details_title",undef,$css[$i]); |
'<input type="text" size="15" name="phone" /><br />'. |
if ($cnum) { |
&Apache::lonhtmlcommon::row_closure(); |
if ($coursecodes{$cnum}) { |
$num ++; |
foreach my $item (@codetitles) { |
$i = $num%2; |
$output .= '<i>'.$item.'</i>: '.$codes{$cnum}{$item}.'; '; |
$output .= &Apache::lonhtmlcommon::row_title("$lt{'crsd'}$details_title",undef,$css[$i]); |
|
if ($cnum) { |
|
if ($coursecodes{$cnum}) { |
|
foreach my $item (@codetitles) { |
|
$output .= '<i>'.$item.'</i>: '.$codes{$cnum}{$item}.'; '; |
|
} |
|
$output .= ' <input type="hidden" name="coursecode" value="'.&HTML::Entities::encode($coursecodes{$cnum},'"<>&').'" />'; |
|
} else { |
|
$output .= $lt{'enin'}.': |
|
<input type="text" name="coursecode" size="15" value="" />'; |
|
} |
} |
|
$output .= ' <input type="hidden" name="coursecode" value="'.&HTML::Entities::encode($coursecodes{$cnum},'"<>&').'" />'; |
} else { |
} else { |
if ($totcodes > 0) { |
$output .= $lt{'enin'}.': |
my $numtitles = @codetitles; |
<input type="text" name="coursecode" size="15" value="" />'; |
if ($numtitles == 0) { |
} |
$output .= $lt{'enin'}.': |
} else { |
<input type="text" name="coursecode" size="15" value="" />'; |
if ($totcodes > 0) { |
|
my $numtitles = @codetitles; |
|
if ($numtitles == 0) { |
|
$output .= $lt{'enin'}.': |
|
<input type="text" name="coursecode" size="15" value="" />'; |
|
} else { |
|
my @standardnames = &Apache::loncommon::get_standard_codeitems(); |
|
my $lasttitle = $numtitles; |
|
if ($numtitles > 4) { |
|
$lasttitle = 4; |
|
} |
|
$output .= '<table><tr><td>'.$codetitles[0].'<br />'."\n". |
|
'<select name="'.$standardnames[0].'" onchange="courseSet('."'$codetitles[0]'".')">'."\n". |
|
' <option value="-1" />'.$lt{'sele'}."\n"; |
|
my @items = (); |
|
my @longitems = (); |
|
if ($idlist{$codetitles[0]} =~ /","/) { |
|
@items = split(/","/,$idlist{$codetitles[0]}); |
} else { |
} else { |
my $lasttitle = $numtitles; |
$items[0] = $idlist{$codetitles[0]}; |
if ($numtitles > 4) { |
} |
$lasttitle = 4; |
if (defined($idlist_titles{$codetitles[0]})) { |
} |
if ($idlist_titles{$codetitles[0]} =~ /","/) { |
$output .= '<table><tr><td>'.$codetitles[0].'<br />'."\n". |
@longitems = split(/","/,$idlist_titles{$codetitles[0]}); |
'<select name="'.$codetitles[0].'" onchange="courseSet('."'$codetitles[0]'".')">'."\n". |
|
' <option value="-1" />'.$lt{'sele'}."\n"; |
|
my @items = (); |
|
my @longitems = (); |
|
if ($idlist{$codetitles[0]} =~ /","/) { |
|
@items = split(/","/,$idlist{$codetitles[0]}); |
|
} else { |
} else { |
$items[0] = $idlist{$codetitles[0]}; |
$longitems[0] = $idlist_titles{$codetitles[0]}; |
} |
} |
if (defined($idlist_titles{$codetitles[0]})) { |
for (my $i=0; $i<@longitems; $i++) { |
if ($idlist_titles{$codetitles[0]} =~ /","/) { |
if ($longitems[$i] eq '') { |
@longitems = split(/","/,$idlist_titles{$codetitles[0]}); |
$longitems[$i] = $items[$i]; |
} else { |
|
$longitems[0] = $idlist_titles{$codetitles[0]}; |
|
} |
|
for (my $i=0; $i<@longitems; $i++) { |
|
if ($longitems[$i] eq '') { |
|
$longitems[$i] = $items[$i]; |
|
} |
|
} |
} |
} else { |
|
@longitems = @items; |
|
} |
|
for (my $i=0; $i<@items; $i++) { |
|
$output .= ' <option value="'.$items[$i].'">'.$longitems[$i].'</option>'."\n"; |
|
} |
|
$output .= '</select></td>'; |
|
for (my $i=1; $i<$numtitles; $i++) { |
|
$output .= '<td>'.$codetitles[$i].'<br />'."\n". |
|
'<select name="'.$codetitles[$i].'" onchange="courseSet('."'$codetitles[$i]'".')">'."\n". |
|
'<option value="-1"><-'.$lt{'pick'}.' '.$codetitles[$i-1].'</option>'."\n". |
|
'</select>'."\n". |
|
'</td>'."\n"; |
|
} |
} |
$output .= '</tr></table>'; |
|
if ($numtitles > 4) { |
|
$output .= '<br /><br />'.$codetitles[$numtitles].'<br />'."\n". |
|
'<select name="'.$codetitles[$numtitles].'" onchange="courseSet('."'$codetitles[$numtitles]'".')">'."\n". |
|
'<option value="-1"><-'.$lt{'pick'}.' '.$codetitles[$numtitles-1].'</option>'."\n". |
|
'</select>'."\n"; |
|
} |
|
} |
|
} else { |
|
$output .= $lt{'enin'}.': |
|
<input type="text" name="coursecode" size="15" value="" />'; |
|
} |
|
} |
|
$output .= '<br />'; |
|
if ($ctitle) { |
|
$output .= '<i>'.$lt{'titl'}.'</i>: '.$ctitle. |
|
'<input type="hidden" name="title" value="'. |
|
&HTML::Entities::encode($ctitle,'"<>&').'" />'."\n"; |
|
} else { |
|
$output .= $lt{'enct'}.': |
|
<input type="text" name="title" size="25" value="" />'."\n"; |
|
} |
|
$output .= &Apache::lonhtmlcommon::row_closure(); |
|
$num ++; |
|
$i = $num%2; |
|
$output .= &Apache::lonhtmlcommon::row_title($lt{'secn'},undef,$css[$i]); |
|
if ($sectionlist) { |
|
$output .= "<select name=\"section\"\n>". |
|
" <option value=\"\" selected=\"selected\">$lt{'sele'}</option>\n"; |
|
foreach my $id (sort(keys(%groupid))) { |
|
if ($id eq $groupid{$id} || $groupid{$id} eq '') { |
|
$output .= " <option value=". |
|
&HTML::Entities::encode($id,'"<>&'). |
|
" >$id</option>\n"; |
|
} else { |
} else { |
$output .= " <option value=". |
@longitems = @items; |
&HTML::Entities::encode($id,'"<>&'). |
} |
" >$id - ($lt{'lsec'}: $groupid{$id})</option>\n"; |
for (my $i=0; $i<@items; $i++) { |
|
$output .= ' <option value="'.$items[$i].'">'.$longitems[$i].'</option>'."\n"; |
|
} |
|
$output .= '</select></td>'; |
|
for (my $i=1; $i<$numtitles; $i++) { |
|
$output .= '<td>'.$codetitles[$i].'<br />'."\n". |
|
'<select name="'.$standardnames[$i].'" onchange="courseSet('."'$codetitles[$i]'".')">'."\n". |
|
'<option value="-1"><-'.$lt{'pick'}.' '.$codetitles[$i-1].'</option>'."\n". |
|
'</select>'."\n". |
|
'</td>'."\n"; |
|
} |
|
$output .= '</tr></table>'; |
|
if ($numtitles > 4) { |
|
$output .= '<br /><br />'.$codetitles[$numtitles].'<br />'."\n". |
|
'<select name="'.$standardnames[$numtitles].'" onchange="courseSet('."'$codetitles[$numtitles]'".')">'."\n". |
|
'<option value="-1"><-'.$lt{'pick'}.' '.$codetitles[$numtitles-1].'</option>'."\n". |
|
'</select>'."\n"; |
} |
} |
} |
} |
$output .= "</select>"; |
|
} else { |
} else { |
$output .= '<input type="text" name="section" size="10" />'; |
$output .= $lt{'enin'}.': |
|
<input type="text" name="coursecode" size="15" value="" />'; |
} |
} |
$output .= &Apache::lonhtmlcommon::row_closure(); |
|
} |
} |
|
if ($ctitle) { |
|
$output .= '<br /><i>'.$lt{'titl'}.'</i>: '.$ctitle. |
|
'<input type="hidden" name="title" value="'. |
|
&HTML::Entities::encode($ctitle,'"<>&').'" />'."\n"; |
|
} else { |
|
$output .= '<br />'.$lt{'enct'}.': |
|
<input type="text" name="title" size="25" value="" />'."\n"; |
|
} |
|
$output .= &Apache::lonhtmlcommon::row_closure(); |
$num ++; |
$num ++; |
$i = $num%2; |
$i = $num%2; |
|
$output .= &Apache::lonhtmlcommon::row_title($lt{'secn'},undef,$css[$i]); |
|
if ($sectionlist) { |
|
$output .= "<select name=\"section\"\n>". |
|
" <option value=\"\" selected=\"selected\">$lt{'sele'}</option>\n"; |
|
foreach my $id (sort(keys(%groupid))) { |
|
if ($id eq $groupid{$id} || $groupid{$id} eq '') { |
|
$output .= " <option value=". |
|
&HTML::Entities::encode($id,'"<>&'). |
|
" >$id</option>\n"; |
|
} else { |
|
$output .= " <option value=". |
|
&HTML::Entities::encode($id,'"<>&'). |
|
" >$id - ($lt{'lsec'}: $groupid{$id})</option>\n"; |
|
} |
|
} |
|
$output .= "</select>"; |
|
} else { |
|
$output .= '<input type="text" name="section" size="10" />'; |
|
} |
|
$output .= &Apache::lonhtmlcommon::row_closure(); |
|
$num ++; |
|
$i = $num%2; |
$output .= &Apache::lonhtmlcommon::row_title($lt{'subj'},undef,'LC_oddrow_value'). |
$output .= &Apache::lonhtmlcommon::row_title($lt{'subj'},undef,'LC_oddrow_value'). |
' <input type="text" size="40" name="subject" />'."\n". |
' <input type="text" size="40" name="subject" />'."\n". |
&Apache::lonhtmlcommon::row_closure(). |
&Apache::lonhtmlcommon::row_closure(). |
Line 453 function initialize_codes() {
|
Line 451 function initialize_codes() {
|
&Apache::lonhtmlcommon::row_closure(); |
&Apache::lonhtmlcommon::row_closure(); |
$num ++; |
$num ++; |
$i = $num%2; |
$i = $num%2; |
if (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
if (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
$output .= &Apache::lonhtmlcommon::row_title($lt{'opfi'},undef,$css[$i]). |
$output .= &Apache::lonhtmlcommon::row_title($lt{'opfi'},undef,$css[$i]). |
' <input type="file" name="screenshot" size="20" /><br />'.$lt{'uplf'}."\n". |
' <input type="file" name="screenshot" size="20" /><br />'.$lt{'uplf'}."\n". |
&Apache::lonhtmlcommon::row_closure(); |
&Apache::lonhtmlcommon::row_closure(); |
Line 499 sub print_request_receipt {
|
Line 497 sub print_request_receipt {
|
my $to = &Apache::loncommon::build_recipient_list(undef,'helpdeskmail', |
my $to = &Apache::loncommon::build_recipient_list(undef,'helpdeskmail', |
$defdom,$origmail); |
$defdom,$origmail); |
my $from = $admin; |
my $from = $admin; |
my $reporttime = &Apache::lonlocal::locallocaltime(time); |
my $bcc; |
my @formvars = ('username','email','uname','udom','sourceurl'); |
my %domconfig = |
if (&Apache::loncommon::check_for_gci_dc()) { |
&Apache::lonnet::get_dom('configuration',['contacts'],$defdom); |
push(@formvars,('phone','section','coursecode','title')); |
if (ref($domconfig{'contacts'}) eq 'HASH') { |
|
if (exists($domconfig{'contacts'}{'helpdeskmail'})) { |
|
if (ref($domconfig{'contacts'}{'helpdeskmail'}) eq 'HASH') { |
|
my $bccmail = $domconfig{'contacts'}{'helpdeskmail'}{'bcc'}; |
|
if ($bccmail ne '') { |
|
my @bccs = split(/,/,$bccmail); |
|
my @ok_bccs; |
|
foreach my $bcc (@bccs) { |
|
$bcc =~ s/^\s+//g; |
|
$bcc =~ s/\s+$//g; |
|
if ($bcc =~ m/^[^\@]+\@[^\@]+$/) { |
|
if (!(grep(/^\Q$bcc\E$/,@ok_bccs))) { |
|
push(@ok_bccs,$bcc); |
|
} |
|
} |
|
} |
|
if (@ok_bccs > 0) { |
|
$bcc = join(', ',@ok_bccs); |
|
} |
|
} |
|
} |
|
} |
} |
} |
push(@formvars,('subject','description','screenshot')); |
my $reporttime = &Apache::lonlocal::locallocaltime(time); |
|
my @formvars = ('username','email','uname','udom','sourceurl','phone','section','coursecode','title','subject','description','screenshot'); |
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},\@formvars); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},\@formvars); |
my $coursecode = $env{'form.coursecode'}; |
my $coursecode = $env{'form.coursecode'}; |
if (&Apache::loncommon::check_for_gci_dc()) { |
if ($coursecode eq '') { |
|
my $totcodes = 0; |
|
my %coursecodes; |
|
$totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$defdom,$totcodes); |
|
my @standardnames = &Apache::loncommon::get_standard_codeitems(); |
|
if ($totcodes > 0) { |
|
my $noregexps = 1; |
|
$coursecode = |
|
&Apache::courseclassifier::instcode_from_selectors($defdom,$noregexps); |
|
} |
if ($coursecode eq '') { |
if ($coursecode eq '') { |
if (defined($env{'form.Year'})) { |
foreach my $item (@standardnames) { |
$coursecode .= $env{'form.Year'}; |
if ((defined($env{'form.'.$item})) && ($env{'form.'.$item} ne '-1')) { |
} |
$coursecode .= $env{'form.'.$item}; |
if (defined($env{'form.Semester'})) { |
} |
$coursecode .= $env{'form.Semester'}; |
|
} |
|
if (defined($env{'form.Department'})) { |
|
$coursecode .= $env{'form.Department'}; |
|
} |
|
if (defined($env{'form.Number'})) { |
|
$coursecode .= $env{'form.Number'}; |
|
} |
} |
} |
} |
} |
} |
Line 560 sub print_request_receipt {
|
Line 583 sub print_request_receipt {
|
if (!(grep(/^\Q$cc\E$/,@ok_ccs))) { |
if (!(grep(/^\Q$cc\E$/,@ok_ccs))) { |
push(@ok_ccs,$cc); |
push(@ok_ccs,$cc); |
} |
} |
} else { |
} elsif ($cc ne '') { |
if (!(grep(/^\Q$cc\E$/,@bad_ccs))) { |
if (!(grep(/^\Q$cc\E$/,@bad_ccs))) { |
push(@bad_ccs,$cc); |
push(@bad_ccs,$cc); |
} |
} |
Line 577 sub print_request_receipt {
|
Line 600 sub print_request_receipt {
|
} |
} |
} |
} |
$env{'form.user'} = "'".$env{'form.uname'}.':'.$env{'form.udom'}."'"; |
$env{'form.user'} = "'".$env{'form.uname'}.':'.$env{'form.udom'}."'"; |
if (&Apache::loncommon::check_for_gci_dc()) { |
$env{'form.crsi'} = $env{'form.title'}.' - '.$coursecode.' - '.$lt{'sect'}.': '.$env{'form.section'}; |
$env{'form.csri'} = $env{'form.title'}.' - '.$coursecode.' - '.$lt{'sect'}.': '.$env{'form.section'}; |
|
} |
|
my $supportmsg = <<END; |
my $supportmsg = <<END; |
$lt{'username'}: $env{'form.username'} |
$lt{'username'}: $env{'form.username'} |
$lt{'email'}: $env{'form.email'} |
$lt{'email'}: $env{'form.email'} |
$lt{'cc'}: $okcclist |
$lt{'cc'}: $okcclist |
$lt{'user'}: $env{'form.user'} |
$lt{'user'}: $env{'form.user'} |
END |
|
if (&Apache::loncommon::check_for_gci_dc()) { |
|
$supportmsg .= <<END |
|
$lt{'phone'}: $env{'form.phone'} |
$lt{'phone'}: $env{'form.phone'} |
$lt{'crsi'}: $env{'form.csri'} |
$lt{'crsi'}: $env{'form.crsi'} |
END |
|
} |
|
$supportmsg = <<END; |
|
$lt{'subject'}: $env{'form.subject'} |
$lt{'subject'}: $env{'form.subject'} |
$lt{'description'}: $env{'form.description'} |
$lt{'description'}: $env{'form.description'} |
$lt{'sourceurl'}: $env{'form.sourceurl'} |
$lt{'sourceurl'}: $env{'form.sourceurl'} |
Line 600 $lt{'date'}: $reporttime
|
Line 615 $lt{'date'}: $reporttime
|
|
|
END |
END |
my $displaymsg; |
my $displaymsg; |
my @items = ('username','email','cc','user'); |
foreach my $item ('username','email','cc','user','phone','crsi','subject','description','sourceurl') { |
if (&Apache::loncommon::check_for_gci_dc()) { |
|
push(@items,'phone','crsi'); |
|
} |
|
push(@items,('subject','description','sourceurl')); |
|
foreach my $item (@items) { |
|
if ($env{'form.'.$item} ne '') { |
if ($env{'form.'.$item} ne '') { |
if ($item eq 'description') { |
if ($item eq 'description') { |
my $descrip = $env{'form.description'}; |
my $descrip = $env{'form.description'}; |
Line 712 END
|
Line 722 END
|
|
|
my $attachmentpath = ''; |
my $attachmentpath = ''; |
my $attachmentsize = ''; |
my $attachmentsize = ''; |
if (defined($env{'user.name'})) { |
if ((defined($env{'user.name'})) && ($env{'user.name'} ne 'public') |
|
&& ($env{'user.domain'} ne 'public')) { |
if ($env{'form.screenshot.filename'}) { |
if ($env{'form.screenshot.filename'}) { |
$attachmentsize = length($env{'form.screenshot'}); |
$attachmentsize = length($env{'form.screenshot'}); |
if ($attachmentsize > 131072) { |
if ($attachmentsize > 131072) { |
Line 760 END
|
Line 771 END
|
my $cc_string = join(', ',@ok_ccs); |
my $cc_string = join(', ',@ok_ccs); |
$msg->add("Cc" => $cc_string); |
$msg->add("Cc" => $cc_string); |
} |
} |
|
if ($bcc ne '') { |
|
$msg->add("Bcc" => $bcc); |
|
} |
|
$msg->attr("content-type" => "text/plain"); |
|
$msg->attr("content-type.charset" => "UTF-8"); |
|
|
if ($attachmentpath) { |
if ($attachmentpath) { |
my ($type, $encoding) = MIME::Types::by_suffix($attachmentpath); |
my ($type, $encoding) = MIME::Types::by_suffix($attachmentpath); |