--- loncom/homework/daxepage.pm 2023/11/27 23:24:04 1.9 +++ loncom/homework/daxepage.pm 2024/03/03 18:16:27 1.11 @@ -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.9 2023/11/27 23:24:04 raeburn Exp $ +# $Id: daxepage.pm,v 1.11 2024/03/03 18:16:27 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -31,6 +31,7 @@ package Apache::daxepage; use strict; use Apache::loncommon(); +use Apache::lonnet(); use Apache::lonhtmlcommon(); use Apache::lonxml(); use Apache::edit(); @@ -74,6 +75,7 @@ sub handler { 'oeds' => 'other editors', 'othe' => 'other editor', 'edit' => 'Edit', + 'exit' => 'Exit Daxe', ); my $name = $uri; $name =~ s/^.*\/([^\/]+)$/$1/; @@ -82,15 +84,20 @@ sub handler { my $headjs = &Apache::loncommon::iframe_wrapper_headjs(). &toggle_LCmenus_js(). &Apache::edit::js_change_detection(); + my $clickexit; if ($is_assess) { $headjs .= &Apache::lonxml::setmode_javascript(); + $clickexit = "javascript:setmode(this.form,'view')"; } else { $headjs .= &Apache::lonxml::seteditor_javascript(); + $clickexit = "javascript:seteditmode(this.form,'view')"; } my $form_events = &Apache::edit::form_change_detection(); my $editheader = '
'. ''."\n". '
'."\n"; + my $exitbutton = ''."\n"; if ($editors{'edit'} || $editors{'xml'}) { my $other = (($editors{'edit'} && $editors{'xml'})? $lt{'oeds'} : $lt{'othe'}); $editheader .= '
'. @@ -110,15 +117,18 @@ sub handler { 'onclick="javascript:setmode(this.form,'."'editxml'".')" />'."\n"; } } - $editheader .= '
'; + $editheader .= '  |  '.$exitbutton.''; } else { $editheader .= '
'. $uri. - '
'; + ''. + $exitbutton.''; } $editheader .= '
'."\n"; + my $start_collapsed = &collapsible_std_LCmenus(); my $args = { 'collapsible_header' => $editheader, + 'start_collapsed' => $start_collapsed, }; my $startpage = &Apache::loncommon::start_page('Daxe: '.$name,$headjs,$args). &Apache::lonmenu::constspaceform(); @@ -203,5 +213,19 @@ sub do_redirect { return; } +sub collapsible_std_LCmenus { + my $daxecollapse = $Apache::lonnet::env{'environment.daxecollapse'}; + unless ($daxecollapse) { + my %domdefs = &Apache::lonnet::get_domain_defaults($Apache::lonnet::env{'user.domain'}); + if ($domdefs{'daxecollapse'}) { + $daxecollapse = 'yes'; + } + } + if ($daxecollapse eq 'yes') { + return 1; + } + return; +} + 1; __END__