--- loncom/interface/lonmenu.pm 2023/09/02 15:56:34 1.369.2.83.2.9
+++ loncom/interface/lonmenu.pm 2023/09/06 16:05:23 1.369.2.83.2.10
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.369.2.83.2.9 2023/09/02 15:56:34 raeburn Exp $
+# $Id: lonmenu.pm,v 1.369.2.83.2.10 2023/09/06 16:05:23 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1117,6 +1117,71 @@ sub innerregister {
'Folder/Page Content');
}
# End modifiable folder/page container check
+
+#
+# Determine whether to show View As button for shortcut to display problem, answer, and submissions
+#
+
+ if (($env{'request.symb'} ne '') &&
+ ($env{'request.filename'}=~/$LONCAPA::assess_re/) &&
+ (($perms{'mgr'}) || ($perms{'vgr'}))) {
+ my ($viewas,$text,$change,$visibility,$vuname,$vudom,$vid,$leftvis,$defdom,$righticon);
+ my %lt = &Apache::lonlocal::texthash(
+ view => 'View',
+ upda => 'Update',
+ );
+ if ($env{'request.user_in_effect'} =~ /^($match_username):($match_domain)$/) {
+ ($vuname,$vudom) = ($1,$2);
+ unless (&Apache::lonnet::is_advanced_user($vudom,$vuname)) {
+ $vid = (&Apache::lonnet::idrget($vudom,$vuname))[1];
+ }
+ $viewas = $env{'request.user_in_effect'};
+ $text = $lt{'upda'};
+ $change = 'off';
+ $visibility = 'inline';
+ $leftvis = 'none';
+ $defdom = $vudom;
+ $righticon = '✖';
+ } else {
+ $text = $lt{'view'};
+ $change = 'on';
+ $visibility = 'none';
+ $leftvis = 'inline';
+ $defdom = $cdom;
+ }
+ my $sellink = &Apache::loncommon::selectstudent_link('userview','vuname','vudom');
+ my $selscript=&Apache::loncommon::studentbrowser_javascript();
+ my $shownsymb = &HTML::Entities::encode(&Apache::lonenc::check_encrypt($env{'request.symb'}),'<>&"');
+ my $input = &mt('User: [_1] or ID: [_2] at: [_3]',
+ '',
+ '',
+ &Apache::loncommon::select_dom_form($defdom,'vudom')).
+ '',
+ '';
+ my $chooser = <