[LON-CAPA-cvs] cvs: doc /loncapafiles loncapafiles.lpml loncom/homework daxeopen.pm daxepage.pm daxesave.pm loncom/html/res/adm/pages collapsed.png expanded.png loncom/interface loncommon.pm lonmenu.pm
raeburn
raeburn at source.lon-capa.org
Sun Nov 19 16:28:18 EST 2023
raeburn Sun Nov 19 21:28:18 2023 EDT
Added files:
/loncom/html/res/adm/pages expanded.png collapsed.png
Modified files:
/loncom/interface loncommon.pm lonmenu.pm
/loncom/homework daxepage.pm daxesave.pm daxeopen.pm
/doc/loncapafiles loncapafiles.lpml
Log:
- Available editors in Authoring Space: value set for specific author can
override domain default.
- Daxe editor page includes "collapsed" standard inline LON-CAPA menus
(primary, secondary, and Functions). Icons at top left to toggle
expansion or collapse.
-------------- next part --------------
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1420 loncom/interface/loncommon.pm:1.1421
--- loncom/interface/loncommon.pm:1.1420 Sat Nov 18 21:50:06 2023
+++ loncom/interface/loncommon.pm Sun Nov 19 21:28:17 2023
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1420 2023/11/18 21:50:06 raeburn Exp $
+# $Id: loncommon.pm,v 1.1421 2023/11/19 21:28:17 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2498,7 +2498,12 @@
var offset = $offset;
var height = 0;
var hdrtop = 0;
- if (\$('div.LC_head_subbox:first').length) {
+ if (\$('div.LC_menus_content:first').length) {
+ if (\$('div.LC_menus_content:first').hasClass ("shown")) {
+ header = \$('div.LC_menus_content:first');
+ offset = 9;
+ }
+ } else if (\$('div.LC_head_subbox:first').length) {
header = \$('div.LC_head_subbox:first');
offset = 9;
} else {
@@ -6878,10 +6883,21 @@
$bodytag .= Apache::lonhtmlcommon::scripttag(
Apache::lonmenu::utilityfunctions($httphost), 'start');
+ if ($args->{'collapsible_header'}) {
+ my $alttext = &mt('menu state: collapsed');
+ my $tooltip = &mt('display standard menus');
+ $bodytag .= <<"END";
+<div id="LC_expandingContainer" style="display:inline;">
+<div id="LC_collapsible" class="LC_collapse_trigger" style="position: absolute;top: -5px;left: 0px; z-index:101; display:inline;">
+<a href="#" style="text-decoration:none;"><img class="LC_collapsible_indicator" alt="$alttext" title="$tooltip" src="/res/adm/pages/collapsed.png" style="border:0;margin:0;padding:0;max-width:100%;height:auto" /></a></div>
+<div class="LC_menus_content hidden">
+END
+ }
unless ($args->{'no_primary_menu'}) {
my ($left,$right) = Apache::lonmenu::primary_menu($crstype,$ltimenu,$menucoll,$menuref,
$args->{'links_disabled'},
- $args->{'links_target'});
+ $args->{'links_target'},
+ $args->{'collapsible_header'});
if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) {
if ($dc_info) {
@@ -6940,7 +6956,10 @@
$bodytag .= '<hr style="clear:both" />';
$bodytag .= Apache::lonhtmlcommon::scripttag('', 'end');
}
-
+ if ($args->{'collapsible_header'}) {
+ $bodytag .= '<div id="LC_collapsible_separator"></div>'.
+ '</div></div>';
+ }
return $bodytag;
}
@@ -7133,6 +7152,14 @@
display: inline;
}
+.LC_menus_content.shown{
+ display: inline;
+}
+
+.LC_menus_content.hidden {
+ display: none;
+}
+
.LC_right {
text-align:right;
}
@@ -7153,6 +7180,12 @@
width:400px;
}
+#LC_collapsible_separator {
+ border: 1px solid black;
+ width: 99.9%;
+ height: 0px;
+}
+
.LC_iframecontainer {
width: 98%;
margin: 0;
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.541 loncom/interface/lonmenu.pm:1.542
--- loncom/interface/lonmenu.pm:1.541 Fri Nov 3 01:12:15 2023
+++ loncom/interface/lonmenu.pm Sun Nov 19 21:28:17 2023
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.541 2023/11/03 01:12:15 raeburn Exp $
+# $Id: lonmenu.pm,v 1.542 2023/11/19 21:28:17 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -245,7 +245,7 @@
# @primary_menu is filled within the BEGIN block of this module with
# entries from mydesk.tab
sub primary_menu {
- my ($crstype,$ltimenu,$menucoll,$menuref,$links_disabled,$links_target) = @_;
+ my ($crstype,$ltimenu,$menucoll,$menuref,$links_disabled,$links_target,$collapsible) = @_;
my (%menu,%ltiexc,%menuopts);
# each element of @primary contains following array:
# (link url, icon path, alt text, link text, condition, position)
@@ -421,6 +421,10 @@
}
my @output = ('','');
if ($menu{'left'} ne '') {
+ if ($collapsible) {
+ $menu{'left'} = ($listclass?'<li class="'.$listclass.'">':'<li>').
+ ' </li>'.$menu{'left'};
+ }
$output[0] = "<ol class=\"LC_primary_menu LC_floatleft\">$menu{'left'}</ol>";
}
if ($menu{'right'} ne '') {
Index: loncom/homework/daxepage.pm
diff -u loncom/homework/daxepage.pm:1.5 loncom/homework/daxepage.pm:1.6
--- loncom/homework/daxepage.pm:1.5 Wed Aug 23 20:58:32 2023
+++ loncom/homework/daxepage.pm Sun Nov 19 21:28:17 2023
@@ -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.5 2023/08/23 20:58:32 raeburn Exp $
+# $Id: daxepage.pm,v 1.6 2023/11/19 21:28:17 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -30,7 +30,12 @@
package Apache::daxepage;
use strict;
-use Apache::Constants qw(:common);
+use Apache::loncommon();
+use Apache::lonhtmlcommon();
+use Apache::lonmenu();
+use Apache::lonlocal;
+use Apache::Constants qw(:common);
+use HTML::Entities();
sub handler {
my $request = shift;
@@ -41,27 +46,109 @@
$request->status(406);
return OK;
}
- my $result = '';
- $result .= "<!DOCTYPE html>\n";
- $result .= "<html>\n";
- $result .= "<head>\n";
+ my %editors = &Apache::loncommon::permitted_editors();
+ unless ($editors{'daxe'}) {
+ my $msg = '<p class="LC_warning">'.
+ &mt('Daxe editor is not enabled for this Authoring Space.').'</p>';
+ &do_redirect($request,$uri,$msg);
+ return OK;
+ }
+ my %lt = &Apache::lonlocal::texthash(
+ 'noif' => 'No iframe support.',
+ 'show' => 'Show content in pop-up window',
+ );
my $name = $uri;
$name =~ s/^.*\/([^\/]+)$/$1/;
- $result .= " <title>LON-CAPA Daxe: $name</title>\n";
- $result .= " <style>\n";
- $result .= " body { margin: 0; }\n";
- $result .= " #daxe { position:absolute; top:0; left:0; width:100%; height:100%; border:none; }\n";
- $result .= " </style>\n";
- $result .= "</head>\n";
- $result .= "<body>\n";
- my $daxeurl = '/adm/daxe/daxe.html?config=config/loncapa_config.xml&file=/daxeopen'.$uri.
- '&save=/daxesave';
- $result .= ' <iframe id="daxe" src="'.$daxeurl.'"></iframe>'."\n";
- $result .= "</body>\n";
- $result .= "</html>\n";
- $request->print($result);
+ my $daxeurl = '/adm/daxe/daxe.html?config=config/loncapa_config.xml&save=/daxesave'.
+ '&file=/daxeopen'.$uri;
+ my $headjs = &Apache::loncommon::iframe_wrapper_headjs().
+ &toggle_LCmenus_js();
+ my $args = {
+ 'collapsible_header' => 1,
+ };
+ my $startpage = &Apache::loncommon::start_page('Daxe: '.$name,$headjs,$args).
+ &Apache::lonmenu::constspaceform();
+ my $endpage = &Apache::loncommon::end_page();
+
+ # javascript will position the iframe if window was resized (or zoomed)
+ my $script = &Apache::loncommon::iframe_wrapper_resizejs();
+ my $dest = &HTML::Entities::encode($daxeurl,'&<>"');
+ my $noiframe = &Apache::loncommon::modal_link($dest,$lt{'show'},500,400);
+
+ $request->print(<<"ENDFRAME");
+$startpage
+$script
+<div class="LC_iframecontainer" style="padding-right: 5px">
+<iframe src="$dest">$lt{'noif'} $noiframe</iframe>
+</div>
+$endpage
+ENDFRAME
return OK;
}
+sub toggle_LCmenus_js {
+ my %lt = &Apache::lonlocal::texthash(
+ altc => 'menu state: collapsed',
+ alte => 'menu state: explanded',
+ ttlc => 'display standard menus',
+ ttle => 'hide standard menus',
+ );
+ return <<"ENDJS";
+<script type="text/javascript">
+//<![CDATA[
+\$(document).ready (function () {
+ \$(".LC_collapse_trigger").on("click", function (e) {
+ var id = this.id;
+ var \$content = \$(this).next (".LC_menus_content");
+ var expanded = \$content.hasClass ("shown");
+ var frameleftpos;
+ if (expanded) {
+ \$content.removeClass ("shown");
+ \$content.addClass ("hidden");
+ } else {
+ \$content.removeClass ("hidden");
+ \$content.addClass ("shown");
+ }
+
+ \$(this).find ("[aria-expanded]")
+ .attr ("aria-expanded", !expanded);
+
+ \$(this).find ("[aria-pressed]")
+ .attr ("aria-pressed", !expanded);
+
+ \$(this).find (".LC_collapsible_indicator").attr ({
+ "src":
+ (expanded)? "/res/adm/pages/collapsed.png" : "/res/adm/pages/expanded.png",
+ "alt":
+ (expanded)? "$lt{altc}" : "$lt{alte}",
+ "title":
+ (expanded)? "$lt{ttlc}" : "$lt(ttle}"
+ });
+
+ \$(window).trigger('resize');
+ \$(this).focus ();
+ });
+
+ \$("#LC_expandingContainer").attr ("aria-live", "off");
+});
+//]]>
+</script>
+ENDJS
+
+}
+
+sub do_redirect {
+ my ($request,$uri,$msg) = @_;
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ $request->print(
+ &Apache::loncommon::start_page('Authoring Space',undef,
+ {'redirect' => [2,$uri]}).
+
+ '<div style="padding:0;clear:both;margin:0;border:0"></div>'."\n".
+ "$msg\n".
+ &Apache::loncommon::end_page());
+ return;
+}
+
1;
__END__
Index: loncom/homework/daxesave.pm
diff -u loncom/homework/daxesave.pm:1.8 loncom/homework/daxesave.pm:1.9
--- loncom/homework/daxesave.pm:1.8 Tue Aug 29 01:43:35 2023
+++ loncom/homework/daxesave.pm Sun Nov 19 21:28:17 2023
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Convert and save a problem from Daxe.
#
-# $Id: daxesave.pm,v 1.8 2023/08/29 01:43:35 raeburn Exp $
+# $Id: daxesave.pm,v 1.9 2023/11/19 21:28:17 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -43,7 +43,14 @@
my $request = shift;
$request->content_type('text/plain');
-
+
+ my %editors = &Apache::loncommon::permitted_editors();
+ unless ($editors{'daxe'}) {
+ $request->content_type('text/plain');
+ $request->print(&mt('Daxe editor not enabled for this Authoring Space'));
+ return OK;
+ }
+
# path should be in the form "/daxeopen/priv/..."
# or "/daxeopen/uploaded/$cdom/$cnum/(docs|supplemental)/(default|\d+)/\d+/"
my $path = $env{'form.path'};
Index: loncom/homework/daxeopen.pm
diff -u loncom/homework/daxeopen.pm:1.13 loncom/homework/daxeopen.pm:1.14
--- loncom/homework/daxeopen.pm:1.13 Mon Aug 28 18:58:44 2023
+++ loncom/homework/daxeopen.pm Sun Nov 19 21:28:17 2023
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Opening converted problems and directory listings for Daxe
#
-# $Id: daxeopen.pm,v 1.13 2023/08/28 18:58:44 raeburn Exp $
+# $Id: daxeopen.pm,v 1.14 2023/11/19 21:28:17 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -49,6 +49,13 @@
my $uri = $request->uri;
$uri =~ s{^/daxeopen}{};
&Apache::loncommon::no_cache($request);
+ my %editors = &Apache::loncommon::permitted_editors();
+ unless ($editors{'daxe'}) {
+ $request->content_type('text/plain');
+ $request->print(&mt('Daxe editor is not enabled for this Authoring Space.'));
+ $request->status(403);
+ return OK;
+ }
if ($uri =~ m{/$}) {
return directory_listing($uri, $request);
} elsif ($uri =~ m{^/priv/.*\.(task|problem|exam|quiz|assess|survey|library|xml|html|htm|xhtml|xhtm)$}) {
Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.1046 doc/loncapafiles/loncapafiles.lpml:1.1047
--- doc/loncapafiles/loncapafiles.lpml:1.1046 Sun Nov 5 20:06:05 2023
+++ doc/loncapafiles/loncapafiles.lpml Sun Nov 19 21:28:18 2023
@@ -2,7 +2,7 @@
"http://lpml.sourceforge.net/DTD/lpml.dtd">
<!-- loncapafiles.lpml -->
-<!-- $Id: loncapafiles.lpml,v 1.1046 2023/11/05 20:06:05 raeburn Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.1047 2023/11/19 21:28:18 raeburn Exp $ -->
<!--
@@ -8511,6 +8511,7 @@
ccat-22x22.png;
chat.png;
coauthors.png;
+collapsed.png;
comblock.png;
contact-new.png;
contact-new-22x22.png;
@@ -8535,6 +8536,7 @@
emblem-photos.png;
emblem-readonly.png;
emblem-system.png;
+expanded.png;
extres.png;
exttool.png;
folder-new.png;
More information about the LON-CAPA-cvs
mailing list