version 1.510, 2010/06/06 02:40:40
|
version 1.515, 2010/09/29 15:47:21
|
Line 642 sub setup_globals {
|
Line 642 sub setup_globals {
|
|
|
sub init_safespace { |
sub init_safespace { |
my ($target,$safeeval,$safehole,$safeinit) = @_; |
my ($target,$safeeval,$safehole,$safeinit) = @_; |
$safeeval->deny_only(':dangerous'); |
|
$safeeval->reval('use Math::Complex;'); |
$safeeval->reval('use Math::Complex;'); |
|
$safeeval->reval('use LaTeX::Table;'); |
|
$safeeval->deny_only(':dangerous'); |
$safeeval->permit_only(":default"); |
$safeeval->permit_only(":default"); |
$safeeval->permit("entereval"); |
$safeeval->permit("entereval"); |
$safeeval->permit(":base_math"); |
$safeeval->permit(":base_math"); |
Line 1491 sub inserteditinfo {
|
Line 1492 sub inserteditinfo {
|
my $dragmath_button; |
my $dragmath_button; |
my ($add_to_onload, $add_to_onresize); |
my ($add_to_onload, $add_to_onresize); |
$initialize=&Apache::lonhtmlcommon::spellheader(); |
$initialize=&Apache::lonhtmlcommon::spellheader(); |
if ($filetype eq 'html' |
if (($filetype eq 'html') && (&Apache::lonhtmlcommon::htmlareabrowser())) { |
&& (!&Apache::lonhtmlcommon::htmlareablocked() && |
|
&Apache::lonhtmlcommon::htmlareabrowser())) { |
|
$textarea_id .= '___Frame'; |
|
my $lang = &Apache::lonhtmlcommon::htmlarea_lang(); |
my $lang = &Apache::lonhtmlcommon::htmlarea_lang(); |
$initialize.=(<<FULLPAGE); |
my %textarea_args = ( |
<script type="text/javascript"> |
fullpage => 'true', |
lonca |
dragmath => 'math', |
function initDocument() { |
); |
var oFCKeditor = new FCKeditor('filecont'); |
$initialize .= &Apache::lonhtmlcommon::htmlareaselectactive(\%textarea_args); |
oFCKeditor.Config['CustomConfigurationsPath'] = '/fckeditor/loncapaconfig.js' ; |
} |
oFCKeditor.Config['FullPage'] = true |
$initialize .= (<<FULLPAGE); |
oFCKeditor.Config['AutoDetectLanguage'] = false; |
|
oFCKeditor.Config['DefaultLanguage'] = "$lang"; |
|
oFCKeditor.ReplaceTextarea(); |
|
} |
|
function check_if_dirty(editor) { |
|
if (editor.IsDirty()) { |
|
unClean(); |
|
} |
|
} |
|
function FCKeditor_OnComplete(editor) { |
|
editor.Events.AttachEvent("OnSelectionChange",check_if_dirty); |
|
resize_textarea('$textarea_id','LC_aftertextarea'); |
|
} |
|
</script> |
|
FULLPAGE |
|
} else { |
|
$initialize.=(<<FULLPAGE); |
|
<script type="text/javascript"> |
<script type="text/javascript"> |
|
// <![CDATA[ |
function initDocument() { |
function initDocument() { |
resize_textarea('$textarea_id','LC_aftertextarea'); |
resize_textarea('$textarea_id','LC_aftertextarea'); |
} |
} |
|
// ]]> |
</script> |
</script> |
FULLPAGE |
FULLPAGE |
if ($filetype eq 'html' || $filetype eq 'tex') { |
if ($filetype eq 'html') { |
$initialize .= "\n".&Apache::lonhtmlcommon::dragmath_js('EditMathPopup'); |
$dragmath_button = '<span id="math_filecont">'.&Apache::lonhtmlcommon::dragmath_button('filecont',1).'</span>'; |
$dragmath_button = &Apache::lonhtmlcommon::dragmath_button('filecont',1); |
$initialize .= "\n".&Apache::lonhtmlcommon::dragmath_js('EditMathPopup'); |
} |
|
} |
} |
|
|
$add_to_onload = 'initDocument();'; |
$add_to_onload = 'initDocument();'; |
$add_to_onresize = "resize_textarea('$textarea_id','LC_aftertextarea');"; |
$add_to_onresize = "resize_textarea('$textarea_id','LC_aftertextarea');"; |
|
|
Line 1540 FULLPAGE
|
Line 1521 FULLPAGE
|
} |
} |
|
|
my $titledisplay=&display_title(); |
my $titledisplay=&display_title(); |
my $wysiwyglink; |
my $textareaclass; |
my %lt=&Apache::lonlocal::texthash('st' => 'Save and Edit', |
my %lt=&Apache::lonlocal::texthash('st' => 'Save and Edit', |
'vi' => 'Save and View', |
'vi' => 'Save and View', |
'dv' => 'Discard Edits and View', |
'dv' => 'Discard Edits and View', |
'un' => 'undo', |
'un' => 'undo', |
'ed' => 'Edit'); |
'ed' => 'Edit'); |
my $spelllink .=&Apache::lonhtmlcommon::spelllink('xmledit','filecont'); |
my $spelllink = &Apache::lonhtmlcommon::spelllink('xmledit','filecont'); |
my $textarea_events = &Apache::edit::element_change_detection(); |
my $textarea_events = &Apache::edit::element_change_detection(); |
my $form_events = &Apache::edit::form_change_detection(); |
my $form_events = &Apache::edit::form_change_detection(); |
my $htmlerror; |
my $htmlerror; |
Line 1556 FULLPAGE
|
Line 1537 FULLPAGE
|
$htmlerror='<span class="LC_error">'.$htmlerror.'</span>'; |
$htmlerror='<span class="LC_error">'.$htmlerror.'</span>'; |
} |
} |
if (&Apache::lonhtmlcommon::htmlareabrowser()) { |
if (&Apache::lonhtmlcommon::htmlareabrowser()) { |
if (&Apache::lonhtmlcommon::htmlareablocked()) { |
$textareaclass = 'class="LC_richDefaultOff"'; |
$wysiwyglink = &Apache::lonhtmlcommon::enablelink($textarea_id); |
|
} else { |
|
$wysiwyglink = &Apache::lonhtmlcommon::disablelink($textarea_id); |
|
} |
|
} |
} |
} |
} |
my $editfooter=(<<ENDFOOTER); |
my $editfooter=(<<ENDFOOTER); |
Line 1577 $initialize
|
Line 1554 $initialize
|
<div class="LC_edit_problem_discards"> |
<div class="LC_edit_problem_discards"> |
<input type="submit" name="discardview" accesskey="d" value="$lt{'dv'}" /> |
<input type="submit" name="discardview" accesskey="d" value="$lt{'dv'}" /> |
<input type="submit" name="Undo" accesskey="u" value="$lt{'un'}" /> |
<input type="submit" name="Undo" accesskey="u" value="$lt{'un'}" /> |
$dragmath_button $spelllink $htmlerror |
$htmlerror $dragmath_button |
</div> |
</div> |
<div class="LC_edit_problem_saves"> |
<div class="LC_edit_problem_saves"> |
<input type="submit" name="savethisfile" accesskey="s" value="$lt{'st'}" /> |
<input type="submit" name="savethisfile" accesskey="s" value="$lt{'st'}" /> |
<input type="submit" name="viewmode" accesskey="v" value="$lt{'vi'}" /> |
<input type="submit" name="viewmode" accesskey="v" value="$lt{'vi'}" /> |
</div> |
</div> |
</div> |
</div> |
<textarea $textarea_events style="width:100%" cols="80" rows="44" name="filecont" id="filecont">$filecontents</textarea> |
<textarea $textarea_events style="width:100%" cols="80" rows="44" name="filecont" id="filecont" $textareaclass>$filecontents</textarea><br />$spelllink |
<div id="LC_aftertextarea"> |
<div id="LC_aftertextarea"> |
$wysiwyglink |
|
<br /> |
<br /> |
$titledisplay |
$titledisplay |
</div> |
</div> |