version 1.501, 2009/11/30 21:17:41
|
version 1.510, 2010/06/06 02:40:40
|
Line 222 sub xmlend {
|
Line 222 sub xmlend {
|
return $discussion; |
return $discussion; |
} |
} |
|
|
sub tokeninputfield { |
|
my $defhost=$Apache::lonnet::perlvar{'lonHostID'}; |
|
$defhost=~tr/a-z/A-Z/; |
|
return (<<ENDINPUTFIELD) |
|
<script type="text/javascript"> |
|
function updatetoken() { |
|
var comp=new Array; |
|
var barcode=unescape(document.tokeninput.barcode.value); |
|
comp=barcode.split('*'); |
|
if (typeof(comp[0])!="undefined") { |
|
document.tokeninput.codeone.value=comp[0]; |
|
} |
|
if (typeof(comp[1])!="undefined") { |
|
document.tokeninput.codetwo.value=comp[1]; |
|
} |
|
if (typeof(comp[2])!="undefined") { |
|
comp[2]=comp[2].toUpperCase(); |
|
document.tokeninput.codethree.value=comp[2]; |
|
} |
|
document.tokeninput.barcode.value=''; |
|
} |
|
</script> |
|
<form method="post" name="tokeninput"> |
|
<table border="2" bgcolor="#FFFFBB"> |
|
<tr><th>DocID Checkin</th></tr> |
|
<tr><td> |
|
<table> |
|
<tr> |
|
<td>Scan in Barcode</td> |
|
<td><input type="text" size="22" name="barcode" |
|
onChange="updatetoken()"/></td> |
|
</tr> |
|
<tr><td><i>or</i> Type in DocID</td> |
|
<td> |
|
<input type="text" size="5" name="codeone" /> |
|
<b><font size="+2">*</font></b> |
|
<input type="text" size="5" name="codetwo" /> |
|
<b><font size="+2">*</font></b> |
|
<input type="text" size="10" name="codethree" value="$defhost" |
|
onChange="this.value=this.value.toUpperCase()" /> |
|
</td></tr> |
|
</table> |
|
</td></tr> |
|
<tr><td><input type="submit" value="Check in DocID" /></td></tr> |
|
</table> |
|
</form> |
|
ENDINPUTFIELD |
|
} |
|
|
|
sub maketoken { |
|
my ($symb,$tuname,$tudom,$tcrsid)=@_; |
|
unless ($symb) { |
|
$symb=&Apache::lonnet::symbread(); |
|
} |
|
unless ($tuname) { |
|
$tuname=$env{'user.name'}; |
|
$tudom=$env{'user.domain'}; |
|
$tcrsid=$env{'request.course.id'}; |
|
} |
|
|
|
return &Apache::lonnet::checkout($symb,$tuname,$tudom,$tcrsid); |
|
} |
|
|
|
sub printtokenheader { |
|
my ($target,$token,$tsymb,$tcrsid,$tudom,$tuname)=@_; |
|
unless ($token) { return ''; } |
|
|
|
my ($symb,$courseid,$domain,$name) = &Apache::lonnet::whichuser(); |
|
unless ($tsymb) { |
|
$tsymb=$symb; |
|
} |
|
unless ($tuname) { |
|
$tuname=$name; |
|
$tudom=$domain; |
|
$tcrsid=$courseid; |
|
} |
|
|
|
my $plainname=&Apache::loncommon::plainname($tuname,$tudom); |
|
|
|
if ($target eq 'web') { |
|
my %idhash=&Apache::lonnet::idrget($tudom,($tuname)); |
|
return |
|
'<img align="right" src="/cgi-bin/barcode.png?encode='.$token.'" />'. |
|
&mt('Checked out for').' '.$plainname. |
|
'<br />'.&mt('User').': '.$tuname.' at '.$tudom. |
|
'<br />'.&mt('ID').': '.$idhash{$tuname}. |
|
'<br />'.&mt('CourseID').': '.$tcrsid. |
|
'<br />'.&mt('Course').': '.$env{'course.'.$tcrsid.'.description'}. |
|
'<br />'.&mt('DocID').': '.$token. |
|
'<br />'.&mt('Time').': '.&Apache::lonlocal::locallocaltime().'<hr />'; |
|
} else { |
|
return $token; |
|
} |
|
} |
|
|
|
sub printalltags { |
sub printalltags { |
my $temp; |
my $temp; |
foreach $temp (sort keys %Apache::lonxml::alltags) { |
foreach $temp (sort keys %Apache::lonxml::alltags) { |
Line 571 sub inner_xmlparse {
|
Line 476 sub inner_xmlparse {
|
} |
} |
if (($ENV{'QUERY_STRING'}) && ($target eq 'web')) { |
if (($ENV{'QUERY_STRING'}) && ($target eq 'web')) { |
$finaloutput=&afterburn($finaloutput); |
$finaloutput=&afterburn($finaloutput); |
|
} |
|
if ($target eq 'modified') { |
|
# if modfied, handle startpart and endpart |
|
$finaloutput=~s/\<startpartmarker[^\>]*\>(.*)\<endpartmarker[^\>]*\>/<part>$1<\/part>/gs; |
} |
} |
return $finaloutput; |
return $finaloutput; |
} |
} |
Line 1549 sub renderingoptions {
|
Line 1458 sub renderingoptions {
|
} |
} |
my $output; |
my $output; |
unless ($env{'form.forceedit'}) { |
unless ($env{'form.forceedit'}) { |
$output .= ' |
$output .= |
<span class="LC_nobreak">'. |
'<span class="LC_nobreak">'. |
&mt('Language:').' '. |
&mt('Language:').' '. |
&Apache::loncommon::select_form($env{'form.languages'},'languages', |
&Apache::loncommon::select_form( |
%langchoices).' |
$env{'form.languages'}, |
</span>'; |
'languages', |
|
{&Apache::lonlocal::texthash(%langchoices)}). |
|
'</span>'; |
} |
} |
$output .= ' |
$output .= |
<span class="LC_nobreak">'. |
' <span class="LC_nobreak">'. |
&mt('Math Rendering:').' '. |
&mt('Math Rendering:').' '. |
&Apache::loncommon::select_form($env{'form.texengine'},'texengine', |
&Apache::loncommon::select_form( |
('' => '', |
$env{'form.texengine'}, |
'tth' => 'tth (TeX to HTML)', |
'texengine', |
'jsMath' => 'jsMath', |
{&Apache::lonlocal::texthash |
'mimetex' => 'mimetex (Convert to Images)')).' |
('' => '', |
</span>'; |
'tth' => 'tth (TeX to HTML)', |
|
'jsMath' => 'jsMath', |
|
'mimetex' => 'mimetex (Convert to Images)')}). |
|
'</span>'; |
return $output; |
return $output; |
} |
} |
|
|
Line 1612 FULLPAGE
|
Line 1526 FULLPAGE
|
} |
} |
</script> |
</script> |
FULLPAGE |
FULLPAGE |
if ($filetype eq 'html') { |
if ($filetype eq 'html' || $filetype eq 'tex') { |
$initialize .= "\n".&Apache::lonhtmlcommon::dragmath_js('EditMathPopup'); |
$initialize .= "\n".&Apache::lonhtmlcommon::dragmath_js('EditMathPopup'); |
$dragmath_button = &Apache::lonhtmlcommon::dragmath_button('filecont',1); |
$dragmath_button = &Apache::lonhtmlcommon::dragmath_button('filecont',1); |
} |
} |
Line 1742 sub handler {
|
Line 1656 sub handler {
|
|
|
|
|
my $file=&Apache::lonnet::filelocation("",$request->uri); |
my $file=&Apache::lonnet::filelocation("",$request->uri); |
my $filetype; |
my ($filetype,$breadcrumbtext); |
if ($file =~ /\.(sty|css|js|txt)$/) { |
if ($file =~ /\.(sty|css|js|txt|tex)$/) { |
$filetype=$1; |
$filetype=$1; |
} else { |
} else { |
$filetype='html'; |
$filetype='html'; |
} |
} |
|
if ($filetype eq 'sty') { |
|
$breadcrumbtext = 'Style File Editor'; |
|
} elsif ($filetype eq 'js') { |
|
$breadcrumbtext = 'Javascript Editor'; |
|
} elsif ($filetype eq 'css') { |
|
$breadcrumbtext = 'CSS Editor'; |
|
} elsif ($filetype eq 'txt') { |
|
$breadcrumbtext = 'Text Editor'; |
|
} elsif ($filetype eq 'tex') { |
|
$breadcrumbtext = 'TeX Editor'; |
|
} else { |
|
$breadcrumbtext = 'HTML Editor'; |
|
} |
|
|
# |
# |
# Edit action? Save file. |
# Edit action? Save file. |
Line 1782 ENDNOTFOUND
|
Line 1709 ENDNOTFOUND
|
$filecontents=&createnewsty(); |
$filecontents=&createnewsty(); |
} elsif ($filetype eq 'js') { |
} elsif ($filetype eq 'js') { |
$filecontents=&createnewjs(); |
$filecontents=&createnewjs(); |
} elsif (($filetype ne 'css') && ($filetype ne 'txt')) { |
} elsif ($filetype ne 'css' && $filetype ne 'txt' && $filetype ne 'tex') { |
$filecontents=&createnewhtml(); |
$filecontents=&createnewhtml(); |
} |
} |
$env{'form.editmode'}='Edit'; #force edit mode |
$env{'form.editmode'}='Edit'; #force edit mode |
Line 1806 ENDNOTFOUND
|
Line 1733 ENDNOTFOUND
|
# up if it did |
# up if it did |
&Apache::structuretags::reset_problem_globals(); |
&Apache::structuretags::reset_problem_globals(); |
&Apache::lonhomework::finished_parsing(); |
&Apache::lonhomework::finished_parsing(); |
|
} elsif ($filetype eq 'tex') { |
|
$result = &Apache::lontexconvert::converted(\$filecontents, |
|
$env{'form.texengine'}); |
|
if ($env{'form.return_only_error_and_warning_counts'}) { |
|
if (&verify_html('<html><body>'.$result.'</body></html>')) { |
|
$errorcount++; |
|
} |
|
$result = "$errorcount:$warningcount"; |
|
} |
} else { |
} else { |
$result = $filecontents; |
$result = $filecontents; |
} |
} |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['rawmode']); |
['rawmode']); |
if ($env{'form.rawmode'}) { $result = $filecontents; } |
if ($env{'form.rawmode'}) { $result = $filecontents; } |
if ($filetype ne 'html') { |
if (($filetype ne 'html') && |
my $nochgview = 1; |
(!$env{'form.return_only_error_and_warning_counts'})) { |
|
my $nochgview = 1; |
my $controls = ''; |
my $controls = ''; |
if ($env{'request.state'} eq 'construct') { |
if ($env{'request.state'} eq 'construct') { |
$controls = &Apache::loncommon::head_subbox( |
$controls = &Apache::loncommon::head_subbox( |
&Apache::loncommon::CSTR_pageheader() |
&Apache::loncommon::CSTR_pageheader() |
.&Apache::londefdef::edit_controls($nochgview)); |
.&Apache::londefdef::edit_controls($nochgview)); |
} |
} |
if ($filetype ne 'sty') { |
if ($filetype ne 'sty' && $filetype ne 'tex') { |
$result =~ s/</</g; |
$result =~ s/</</g; |
$result =~ s/>/>/g; |
$result =~ s/>/>/g; |
$result = '<table class="LC_sty_begin">'. |
$result = '<table class="LC_sty_begin">'. |
'<tr><td><b><pre>'.$result. |
'<tr><td><b><pre>'.$result. |
'</pre></b></td></tr></table>'; |
'</pre></b></td></tr></table>'; |
} |
} |
if ($env{'environment.remote'} eq 'off') { |
my $brcrum; |
my $brcrum; |
if ($env{'request.state'} eq 'construct') { |
if ($env{'request.state'} eq 'construct') { |
$brcrum = [{'href' => &Apache::loncommon::authorspace(), |
$brcrum = [{'href' => &Apache::loncommon::authorspace(), |
'text' => 'Construction Space'}, |
'text' => 'Construction Space'}, |
{'href' => '', |
{'href' => '', |
'text' => $breadcrumbtext}]; |
'text' => 'Editor'}]; |
|
} else { |
|
$brcrum = ''; # FIXME: Where are we? |
|
} |
|
my %options = ('bread_crumbs' => $brcrum, |
|
'bgcolor' => '#FFFFFF'); |
|
$result = |
|
&Apache::loncommon::start_page(undef,undef,\%options) |
|
.$controls |
|
.$result |
|
.&Apache::loncommon::end_page(); |
|
} else { |
} else { |
$result = $controls.$result; |
$brcrum = ''; # FIXME: Where are we? |
} |
} |
|
my %options = ('bread_crumbs' => $brcrum, |
|
'bgcolor' => '#FFFFFF'); |
|
$result = |
|
&Apache::loncommon::start_page(undef,undef,\%options) |
|
.$controls |
|
.$result |
|
.&Apache::loncommon::end_page(); |
} |
} |
} |
} |
} |
} |
Line 1873 ENDNOTFOUND
|
Line 1806 ENDNOTFOUND
|
'href' => &Apache::loncommon::authorspace(), |
'href' => &Apache::loncommon::authorspace(), |
'text' => 'Construction Space'}, |
'text' => 'Construction Space'}, |
{'href' => '', |
{'href' => '', |
'text' => 'HTML Editor'}]; |
'text' => $breadcrumbtext}]; |
$header = &Apache::loncommon::head_subbox( |
$header = &Apache::loncommon::head_subbox( |
&Apache::loncommon::CSTR_pageheader()); |
&Apache::loncommon::CSTR_pageheader()); |
} |
} |
if ($env{'environment.remote'} ne 'off') { |
|
$options{'bgcolor'} = '#FFFFFF'; |
|
$options{'only_body'} = 1; |
|
} |
|
my $js = |
my $js = |
&Apache::edit::js_change_detection(). |
&Apache::edit::js_change_detection(). |
&Apache::loncommon::resize_textarea_js(); |
&Apache::loncommon::resize_textarea_js(); |
Line 2263 sub get_tag {
|
Line 2192 sub get_tag {
|
|
|
=pod |
=pod |
|
|
=item &print_pdf_radiobutton(fieldname, value, text) |
=item &print_pdf_radiobutton(fieldname, value) |
|
|
Returns a latexline to generate a PDF-Form-Radiobutton with Text. |
Returns a latexline to generate a PDF-Form-Radiobutton. |
|
Note: Radiobuttons with equal names are automaticly grouped |
|
in a selection-group. |
|
|
$fieldname: PDF internalname of the radiobutton |
$fieldname: PDF internalname of the radiobutton(group) |
$value: Value of radiobutton (read when dumping the PDF data) |
$value: Value of radiobutton |
$text: Text on the rightside of the radiobutton |
|
|
|
=cut |
=cut |
sub print_pdf_radiobutton { |
sub print_pdf_radiobutton { |
my $result = ''; |
my ($fieldname, $value) = @_; |
my ($fieldName, $value, $text) = @_; |
return '\radioButton[\symbolchoice{circle}]{' |
$result .= '\begin{tabularx}{\textwidth}{p{0cm}X}'."\n"; |
.$fieldname.'}{10bp}{10bp}{'.$value.'}'; |
$result .= '\radioButton[\symbolchoice{circle}]{'. |
|
$fieldName.'}{10bp}{10bp}{'.$value.'}&'.$text."\n"; |
|
$result .= '\end{tabularx}' . "\n"; |
|
$result .= '\hspace{2mm}' . "\n"; |
|
return $result; |
|
} |
} |
|
|
|
|