--- loncom/homework/daxepage.pm 2024/03/03 18:16:27 1.11 +++ loncom/homework/daxepage.pm 2024/03/23 23:11:52 1.12 @@ -1,7 +1,7 @@ # The LearningOnline Network # Page with Daxe on the left side and the preview on the right side # -# $Id: daxepage.pm,v 1.11 2024/03/03 18:16:27 raeburn Exp $ +# $Id: daxepage.pm,v 1.12 2024/03/23 23:11:52 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -72,37 +72,50 @@ sub handler { my %lt = &Apache::lonlocal::texthash( 'noif' => 'No iframe support.', 'show' => 'Show content in pop-up window', + 'save' => 'Save', 'oeds' => 'other editors', 'othe' => 'other editor', - 'edit' => 'Edit', - 'exit' => 'Exit Daxe', + 'edit' => 'Save and Edit', + 'disc' => 'Discard and View', + 'save' => 'Save and View', ); my $name = $uri; $name =~ s/^.*\/([^\/]+)$/$1/; + my $filearg = '/daxeopen'.$uri; my $daxeurl = '/adm/daxe/daxe.html?config=config/loncapa_config.xml&save=/daxesave'. - '&file=/daxeopen'.$uri; + '&file='.$filearg; my $headjs = &Apache::loncommon::iframe_wrapper_headjs(). - &toggle_LCmenus_js(). + &listener_js($filearg). + &toggle_LCmenus_js().&saveandview_js(). &Apache::edit::js_change_detection(); - my $clickexit; + + my ($clickexit,$clicksave,$clickedit); if ($is_assess) { $headjs .= &Apache::lonxml::setmode_javascript(); - $clickexit = "javascript:setmode(this.form,'view')"; + $clickexit = "javascript:setmode(this.form,'view');"; } else { $headjs .= &Apache::lonxml::seteditor_javascript(); - $clickexit = "javascript:seteditmode(this.form,'view')"; + $clickexit = "javascript:seteditmode(this.form,'view');"; } + $clicksave = "javascript:daxesave('exit');"; + $clickedit = "javascript:daxesave();"; my $form_events = &Apache::edit::form_change_detection(); my $editheader = '
'. ''."\n". '
'."\n"; - my $exitbutton = ''."\n"; + my $exitbutton = ''."\n"; + my $saveexitbutton = ''."\n"; + $editheader .= '
'. + $uri.''. + $saveeditbutton.$saveexitbutton.$exitbutton.''; if ($editors{'edit'} || $editors{'xml'}) { my $other = (($editors{'edit'} && $editors{'xml'})? $lt{'oeds'} : $lt{'othe'}); - $editheader .= '
'. - $uri. - ''.$other.': '; + $editheader .= '  |  '.$other.': '. + ''; if ($is_not_assess) { $editheader .= ''."\n". ''."\n"; } } - $editheader .= '  |  '.$exitbutton.'
'; - } else { - $editheader .= '
'. - $uri. - ''. - $exitbutton.'
'; + $editheader .= ''; } - $editheader .= ''."\n"; + $editheader .= '
'."\n"; my $start_collapsed = &collapsible_std_LCmenus(); my $args = { 'collapsible_header' => $editheader, @@ -143,13 +151,57 @@ sub handler { $startpage $script
- +
$endpage ENDFRAME return OK; } +sub listener_js { + my ($filearg) = @_; + return <<"ENDJS"; + +ENDJS + +} + +sub saveandview_js { + return <<"ENDJS"; + + +ENDJS +} + sub toggle_LCmenus_js { my %lt = &Apache::lonlocal::texthash( altc => 'menu state: collapsed',