version 1.60, 2010/12/02 22:05:17
|
version 1.66.6.1, 2012/02/08 17:49:01
|
Line 36 use Apache::lonhtmlcommon;
|
Line 36 use Apache::lonhtmlcommon;
|
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonacc(); |
use Apache::lonacc(); |
use Apache::courseclassifier; |
|
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
|
|
|
|
Line 70 sub handler {
|
Line 69 sub handler {
|
|
|
sub print_request_form { |
sub print_request_form { |
my ($r,$origurl,$function) = @_; |
my ($r,$origurl,$function) = @_; |
my ($os,$browser,$bversion,$uhost,$uname,$udom,$uhome,$urole,$usec,$email,$cid,$cdom,$cnum,$ctitle,$ccode,$sectionlist,$lastname,$firstname,$server,$formname); |
my ($os,$browser,$bversion,$uhost,$uname,$udom,$uhome,$email, |
|
$lastname,$firstname,$server,$formname,$public); |
$function = &Apache::loncommon::get_users_function() if (!$function); |
$function = &Apache::loncommon::get_users_function() if (!$function); |
$ccode = ''; |
$ccode = ''; |
$os = $env{'browser.os'}; |
$os = $env{'browser.os'}; |
$browser = $env{'browser.type'}; |
$browser = $env{'browser.type'}; |
$bversion = $env{'browser.version'}; |
$bversion = $env{'browser.version'}; |
$uhost = $env{'request.host'}; |
$uhost = $env{'request.host'}; |
my ($uname,$udom,$public); |
|
if (($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) { |
if (($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) { |
$public = 1; |
$public = 1; |
} else { |
} else { |
Line 85 sub print_request_form {
|
Line 84 sub print_request_form {
|
$udom = $env{'user.domain'}; |
$udom = $env{'user.domain'}; |
} |
} |
$uhome = $env{'user.home'}; |
$uhome = $env{'user.home'}; |
$urole = $env{'request.role'}; |
|
$usec = $env{'request.course.sec'}; |
|
$cid = $env{'request.course.id'}; |
|
$formname = 'logproblem'; |
$formname = 'logproblem'; |
my $machine = &Apache::lonnet::absolute_url(); |
my $machine = &Apache::lonnet::absolute_url(); |
if ($origurl =~ m-^https?://-) { |
if ($origurl =~ m-^https?://-) { |
Line 113 sub print_request_form {
|
Line 109 sub print_request_form {
|
entr => 'Enter the username you use to log-in to LON-CAPA, and your domain.', |
entr => 'Enter the username you use to log-in to LON-CAPA, and your domain.', |
urlp => 'URL of page', |
urlp => 'URL of page', |
phon => 'Phone', |
phon => 'Phone', |
crsd => 'Course Details', |
|
enin => 'Enter institutional course code', |
|
pick => 'Pick', |
pick => 'Pick', |
enct => 'Enter course title', |
|
secn => 'Section Number', |
|
sele => 'Select', |
|
titl => 'Title', |
|
lsec => 'LON-CAPA sec', |
|
subj => 'Subject', |
subj => 'Subject', |
detd => 'Detailed Description', |
detd => 'Detailed Description', |
opfi => 'Optional file upload', |
opfi => 'Optional file upload', |
Line 147 function validate() {
|
Line 136 function validate() {
|
|
|
END |
END |
$scripttag .= &Apache::lonhtmlcommon::javascript_valid_email(); |
$scripttag .= &Apache::lonhtmlcommon::javascript_valid_email(); |
if ($cid) { |
|
$cdom = $env{'course.'.$cid.'.domain'}; |
|
$cnum = $env{'course.'.$cid.'.num'}; |
|
} |
|
if ($cdom && $cnum) { |
|
my %csettings = &Apache::lonnet::get('environment',['description','internal.coursecode','internal.sectionnums'],$cdom,$cnum); |
|
$ctitle = $csettings{'description'}; |
|
$ccode = $csettings{'internal.coursecode'}; |
|
$sectionlist = $csettings{'internal.sectionnums'}; |
|
} |
|
|
|
if ($env{'environment.permanentemail'}) { |
if ($env{'environment.permanentemail'}) { |
$email = $env{'environment.permanentemail'}; |
$email = $env{'environment.permanentemail'}; |
Line 171 END
|
Line 150 END
|
if ($env{'environment.firstname'}) { |
if ($env{'environment.firstname'}) { |
$firstname = $env{'environment.firstname'}; |
$firstname = $env{'environment.firstname'}; |
} |
} |
my @sections = split(/,/,$sectionlist); |
|
my %groupid; |
|
foreach my $section (@sections) { |
|
my ($sec,$grp) = split(/:/,$section); |
|
$groupid{$sec} = $grp; |
|
} |
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['codedom', |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['codedom', |
'useremail','useraccount']); |
'useremail','useraccount']); |
if ($env{'form.origurl'} eq '/adm/createaccount') { |
if ($env{'form.origurl'} eq '/adm/createaccount') { |
Line 192 END
|
Line 166 END
|
} |
} |
} |
} |
my $codedom = &get_domain(); |
my $codedom = &get_domain(); |
my $details_title; |
|
if ($codedom) { |
|
$details_title = '<br />('.$codedom.')'; |
|
} |
|
my %coursecodes; |
|
my %codes; |
|
my @codetitles; |
|
my %cat_titles; |
|
my %cat_order; |
|
my %idlist; |
|
my %idnums; |
|
my %idlist_titles; |
|
my $caller = 'global'; |
my $caller = 'global'; |
my $totcodes = 0; |
|
my $format_reply; |
my $format_reply; |
my $jscript = ''; |
my $jscript = ''; |
my $loaditems = qq| |
|
function initialize_codes() { |
|
return; |
|
} |
|
|; |
|
if ($cnum) { |
|
$coursecodes{$cnum} = $ccode; |
|
if ($ccode eq '') { |
|
$totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$codedom,$totcodes); |
|
} else { |
|
$coursecodes{$cnum} = $ccode; |
|
$caller = $cnum; |
|
$totcodes ++; |
|
} |
|
} else { |
|
$totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$codedom,$totcodes); |
|
} |
|
if ($totcodes > 0) { |
|
if ($ccode eq '') { |
|
$format_reply = &Apache::lonnet::auto_instcode_format($caller,$codedom,\%coursecodes,\%codes,\@codetitles,\%cat_titles,\%cat_order); |
|
if ($format_reply eq 'ok') { |
|
my $numtypes = @codetitles; |
|
&Apache::courseclassifier::build_code_selections(\%codes,\@codetitles,\%cat_titles,\%cat_order,\%idlist,\%idnums,\%idlist_titles); |
|
my ($scripttext,$longtitles) = &Apache::courseclassifier::javascript_definitions(\@codetitles,\%idlist,\%idlist_titles,\%idnums,\%cat_titles); |
|
my $longtitles_str = join('","',@{$longtitles}); |
|
my $allidlist = $idlist{$codetitles[0]}; |
|
$jscript .= &Apache::courseclassifier::courseset_js_start($formname,$longtitles_str,$allidlist); |
|
$jscript .= $scripttext; |
|
$jscript .= &Apache::courseclassifier::javascript_code_selections($formname,@codetitles); |
|
$loaditems = ''; |
|
} |
|
} |
|
} |
|
|
|
my $js = '<script type="text/javascript">'."\n$scripttag\n$jscript\n". |
my $js = '<script type="text/javascript">'."\n$scripttag\n$jscript\n". |
'</script>'; |
'</script>'; |
my %add_entries = (topmargin => "0", |
my %add_entries = (topmargin => "0", |
marginheight => "0", |
marginheight => "0", |
onLoad =>"initialize_codes()",); |
); |
|
|
|
|
$r->print(&Apache::loncommon::start_page('Support Request',$js, |
$r->print(&Apache::loncommon::start_page('Support Request',$js, |
{ 'function' => $function, |
{ 'function' => $function, |
Line 333 function initialize_codes() {
|
Line 259 function initialize_codes() {
|
$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_closure(). |
&Apache::lonhtmlcommon::row_title("$lt{'phon'}",undef,'LC_evenrow_value'). |
$num ++; |
|
$i = $num%2; |
|
$output .= &Apache::lonhtmlcommon::row_title("$lt{'phon'}",undef, |
|
'LC_evenrow_value'). |
'<input type="text" size="15" name="phone" /><br />'. |
'<input type="text" size="15" name="phone" /><br />'. |
&Apache::lonhtmlcommon::row_closure(); |
&Apache::lonhtmlcommon::row_closure(); |
$num ++; |
$num ++; |
$i = $num%2; |
|
$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="" />'; |
|
} |
|
} else { |
|
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 { |
|
$items[0] = $idlist{$codetitles[0]}; |
|
} |
|
if (defined($idlist_titles{$codetitles[0]})) { |
|
if ($idlist_titles{$codetitles[0]} =~ /","/) { |
|
@longitems = split(/","/,$idlist_titles{$codetitles[0]}); |
|
} 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="'.$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"; |
|
} |
|
} |
|
} else { |
|
$output .= $lt{'enin'}.': |
|
<input type="text" name="coursecode" size="15" value="" />'; |
|
} |
|
} |
|
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 ++; |
|
$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 523 sub print_request_receipt {
|
Line 348 sub print_request_receipt {
|
} |
} |
} |
} |
my $reporttime = &Apache::lonlocal::locallocaltime(time); |
my $reporttime = &Apache::lonlocal::locallocaltime(time); |
my @formvars = ('username','email','uname','udom','sourceurl','phone','section','coursecode','title','subject','description','screenshot'); |
my @formvars = ('username','email','uname','udom','sourceurl','phone', |
|
'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'}; |
|
if ($coursecode eq '') { |
|
my $totcodes = 0; |
|
my %coursecodes; |
|
$totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$defdom,$totcodes); |
|
my $coursecode; |
|
my @standardnames = &Apache::loncommon::get_standard_codeitems(); |
|
if ($totcodes > 0) { |
|
$coursecode = &Apache::courseclassifier::instcode_from_selectors($defdom); |
|
} |
|
if ($coursecode eq '') { |
|
foreach my $item (@standardnames) { |
|
if ((defined($env{'form.'.$item})) && ($env{'form.'.$item} ne '-1')) { |
|
$coursecode .= $env{'form.'.$item}; |
|
} |
|
} |
|
} |
|
} |
|
my %lt = &Apache::lonlocal::texthash ( |
my %lt = &Apache::lonlocal::texthash ( |
username => 'Name', |
username => 'Name', |
email => 'E-mail', |
email => 'E-mail', |
cc => 'Cc', |
cc => 'Cc', |
user => 'Username/domain', |
user => 'Username/domain', |
phone => 'Phone', |
phone => 'Phone', |
crsi => 'Course Information', |
|
subject => 'Subject', |
subject => 'Subject', |
description => 'Description', |
description => 'Description', |
sourceurl => 'URL', |
sourceurl => 'URL', |
date => 'Date/Time', |
date => 'Date/Time', |
secn => 'Section', |
|
asup => 'A support request has been sent to', |
|
warn => 'Warning: Problem with support e-mail address', |
warn => 'Warning: Problem with support e-mail address', |
your => 'Your support request contained the following information', |
your => 'Your support request contained the following information', |
sect => 'section', |
|
info => 'Information supplied', |
info => 'Information supplied', |
adin => 'Additional information recorded', |
adin => 'Additional information recorded', |
); |
); |
Line 598 sub print_request_receipt {
|
Line 401 sub print_request_receipt {
|
} |
} |
} |
} |
$env{'form.user'} = "'".$env{'form.uname'}.':'.$env{'form.udom'}."'"; |
$env{'form.user'} = "'".$env{'form.uname'}.':'.$env{'form.udom'}."'"; |
$env{'form.crsi'} = $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'} |
$lt{'phone'}: $env{'form.phone'} |
$lt{'phone'}: $env{'form.phone'} |
$lt{'crsi'}: $env{'form.crsi'} |
|
$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 613 $lt{'date'}: $reporttime
|
Line 414 $lt{'date'}: $reporttime
|
|
|
END |
END |
my $displaymsg; |
my $displaymsg; |
foreach my $item ('username','email','cc','user','phone','crsi','subject','description','sourceurl') { |
foreach my $item ('username','email','cc','user','phone','subject', |
|
'description','sourceurl') { |
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 687 END
|
Line 489 END
|
$bad_email = 1; |
$bad_email = 1; |
} |
} |
} |
} |
if ($bad_email) { |
|
$r->print(' |
my $message; |
<h3>'.$lt{'warn'}.'</h3>'. |
if (!$bad_email) { |
&mt('As the e-mail address provided for this LON-CAPA server ([_1]) does not appear to be a valid e-mail address, your support request has <b>not</b> been sent to the LON-CAPA support staff or administrator at your institution.',$to).' '.&mt('Instead a copy has been sent to the LON-CAPA support team at Michigan State University.')); |
$message = &Apache::lonhtmlcommon::confirm_success( |
$to = 'helpdesk@lon-capa.org'; |
&mt('A support request has been sent to [_1]','<tt>'.$to.'</tt>')); |
} else { |
} else { |
$r->print('<h3>'.$lt{'asup'}.' '.$to.'</h3>'); |
$message = &Apache::lonhtmlcommon::confirm_success( |
|
$lt{'warn'}.'<br />' |
|
.&mt('As the e-mail address provided for this LON-CAPA server ([_1]) does not appear to be a valid e-mail address, your support request has [_2]not[_3] been sent to the LON-CAPA support staff or administrator at your institution.','<tt>'.$to.'</tt>','<b>','</b>') |
|
.' '.&mt('Instead a copy has been sent to the LON-CAPA support team at Michigan State University.'),1); |
|
$to = 'helpdesk@lon-capa.org'; |
} |
} |
|
$r->print(&Apache::loncommon::confirmwrapper($message)); |
|
|
if (defined($env{'form.email'})) { |
if (defined($env{'form.email'})) { |
$env{'form.email'} =~ s/^\s+//; |
$env{'form.email'} =~ s/^\s+//; |
$env{'form.email'} =~ s/\s+$//; |
$env{'form.email'} =~ s/\s+$//; |
Line 742 END
|
Line 550 END
|
$fname = $1; |
$fname = $1; |
$displaymsg .= '<br />' |
$displaymsg .= '<br />' |
.&mt('An uploaded screenshot file [_1] ([_2] bytes) was included in the request sent by [_3].' |
.&mt('An uploaded screenshot file [_1] ([_2] bytes) was included in the request sent by [_3].' |
,'<span class="LC_filename">'.$fname.'<span>' |
,'<span class="LC_filename">'.$fname.'</span>' |
,$attachmentsize |
,$attachmentsize |
,$env{'user.name'}.':'.$env{'user.domain'} |
,$env{'user.name'}.':'.$env{'user.domain'} |
); |
); |
Line 772 END
|
Line 580 END
|
if ($bcc ne '') { |
if ($bcc ne '') { |
$msg->add("Bcc" => $bcc); |
$msg->add("Bcc" => $bcc); |
} |
} |
$msg->add('Content-type','text/plain; charset=UTF-8'); |
$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); |