--- loncom/xml/lonxml.pm 2007/10/08 09:20:22 1.462 +++ loncom/xml/lonxml.pm 2007/10/16 23:20:05 1.465 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.462 2007/10/08 09:20:22 foxr Exp $ +# $Id: lonxml.pm,v 1.465 2007/10/16 23:20:05 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -631,6 +631,24 @@ sub callsub { return $currentstring; } +{ + my %state; + + sub init_state { + undef(%state); + } + + sub set_state { + my ($key,$value) = @_; + $state{$key} = $value; + return $value; + } + sub get_state { + my ($key) = @_; + return $state{$key}; + } +} + sub setup_globals { my ($request,$target)=@_; $Apache::lonxml::request=$request; @@ -640,6 +658,7 @@ sub setup_globals { $Apache::lonxml::usestyle=1; &init_counter(); &clear_bubble_lines_for_part(); + &init_state(); @Apache::lonxml::pwd=(); @Apache::lonxml::extlinks=(); @script_var_displays=(); @@ -1464,36 +1483,37 @@ sub inserteditinfo { my $initialize=''; my $textarea_id = 'filecont'; my ($add_to_onload, $add_to_onresize); - my $addbuttons=&Apache::lonhtmlcommon::htmlareaaddbuttons(); $initialize=&Apache::lonhtmlcommon::spellheader(); if ($filetype eq 'html' && (!&Apache::lonhtmlcommon::htmlareablocked() && &Apache::lonhtmlcommon::htmlareabrowser())) { - $textarea_id .= '_htmlarea'; + $textarea_id .= '___Frame'; + my $lang = &Apache::lonhtmlcommon::htmlarea_lang(); $initialize.=(< -$addbuttons - - HTMLArea.loadPlugin("FullPage"); - +lonca function initDocument() { - var editor=new HTMLArea("filecont",config); - editor.registerPlugin(FullPage); - editor.generate(); - setTimeout( - function () { - HTMLArea._addEvents(editor._doc, - ["keypress","mousedown"], unClean); - editor._iframe.id = '$textarea_id'; - resize_textarea('$textarea_id','LC_aftertextarea'); - },300); + var oFCKeditor = new FCKeditor('filecont'); + oFCKeditor.Config['CustomConfigurationsPath'] = '/fckeditor/loncapaconfig.js' ; + oFCKeditor.Config['FullPage'] = true + 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'); } FULLPAGE } else { $initialize.=(< -$addbuttons function initDocument() { resize_textarea('$textarea_id','LC_aftertextarea'); }