[LON-CAPA-cvs] cvs: loncom /interface lonparmset.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 30 May 2005 17:50:21 -0000
This is a MIME encoded message
--albertel1117475421
Content-Type: text/plain
albertel Mon May 30 13:50:21 2005 EDT
Modified files:
/loncom/interface lonparmset.pm
Log:
- patch from Mark Lucas for adding breadcrumbs ro the parmset interface
- adds menu for selceting different screens
--albertel1117475421
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20050530135021.txt"
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.192 loncom/interface/lonparmset.pm:1.193
--- loncom/interface/lonparmset.pm:1.192 Fri May 6 15:00:31 2005
+++ loncom/interface/lonparmset.pm Mon May 30 13:50:18 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.192 2005/05/06 19:00:31 albertel Exp $
+# $Id: lonparmset.pm,v 1.193 2005/05/30 17:50:18 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -385,6 +385,8 @@
my $bodytag=&Apache::loncommon::bodytag('Set/Modify Course Parameters','',
'onUnload="pclose()"');
+ my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs
+ (undef,'Table');
my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '.
&Apache::loncommon::selectstudent_link('parmform','uname','udom');
my $selscript=&Apache::loncommon::studentbrowser_javascript();
@@ -454,6 +456,7 @@
$selscript
</head>
$bodytag
+$breadcrumbs
$overallhelp
ENDHEAD
@@ -490,7 +493,7 @@
$sections.='</select>';
}
$r->print(<<ENDHEAD3);
-<form method="post" action="/adm/parmset" name="parmform">
+<form method="post" action="/adm/parmset?action=settable" name="parmform">
<h4>$lt{'captm'}</h4>
ENDHEAD3
@@ -840,7 +843,7 @@
if (($env{'form.command'} eq 'set') && ($env{'form.url'})
&& (!$env{'form.dis'})) {
my $url=$env{'form.url'};
- $url=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--;
+ $url=~s-^http://($env{'SERVER_NAME'}|$env{'HTTP_HOST'})--;
$pssymb=&Apache::lonnet::symbread($url);
if (!@pscat) { @pscat=('all'); }
$pschp='';
@@ -966,6 +969,7 @@
my $have_assesments=1;
if (scalar(keys(%allkeys)) eq 0) { $have_assesments=0; }
+ $trimheader = 'yes';
&startpage($r,$id,$udom,$csec,$uname,$have_assesments,$trimheader);
if (!$have_assesments) {
@@ -1510,6 +1514,8 @@
my $setoutput='';
my $bodytag=&Apache::loncommon::bodytag(
'Set Course Environment Parameters');
+ my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs
+ (undef,'Edit Course Environment');
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
@@ -1801,7 +1807,8 @@
<title>LON-CAPA Course Environment</title>
</head>
$bodytag
-<form method="post" action="/adm/parmset" name="envform">
+$breadcrumbs
+<form method="post" action="/adm/parmset?action=crsenv" name="envform">
$setoutput
<p>
<table border=2>
@@ -1843,6 +1850,8 @@
'Set/Modify Course Assessment Parameters');
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs
+ (undef,'Overview');
my $html=&Apache::lonxml::xmlbegin();
$r->print(<<ENDOVER);
$html
@@ -1850,7 +1859,8 @@
<title>LON-CAPA Course Environment</title>
</head>
$bodytag
-<form method="post" action="/adm/parmset" name="overviewform">
+$breadcrumbs
+<form method="post" action="/adm/parmset?action=setoverview" name="overviewform">
<input type="hidden" name="overview" value="1" />
ENDOVER
# Setting
@@ -2047,6 +2057,93 @@
}
}
+
+##################################################
+##################################################
+
+=pod
+
+=item * header
+
+Output html header for page
+
+=cut
+
+##################################################
+##################################################
+sub header {
+ my $html=&Apache::lonxml::xmlbegin();
+ my $bodytag=&Apache::loncommon::bodytag('Parameter Manager');
+ my $title = &mt('LON-CAPA Parameter Manager');
+ return(<<ENDHEAD);
+$html
+<head>
+<title>$title</title>
+</head>
+$bodytag
+ENDHEAD
+}
+##################################################
+##################################################
+sub print_main_menu {
+ my ($r,$parm_permission)=@_;
+ #
+ $r->print(<<ENDMAINFORMHEAD);
+<form method="post" enctype="multipart/form-data"
+ action="/adm/parmset" name="studentform">
+ENDMAINFORMHEAD
+#
+ my ($cdom,$cnum) = split/_/,$env{'request.course.id'};
+ my @menu =
+ (
+ { text => 'Set Course Environment Parameters',
+ help => 'Course_Setting_Parameters',
+ action => 'crsenv',
+ permission => $parm_permission,
+ },
+ { text => 'Set/Modify Course Assessment Parameters - Helper Mode',
+ url => '/adm/helper/parameter.helper',
+ permission => $parm_permission,
+ },
+ { text => 'Modify Course Assessment Parameters - Overview Mode',
+ action => 'setoverview',
+ permission => $parm_permission,
+ },
+ { text => 'Set/Modify Course Assessment Parameters - Table Mode',
+ action => 'settable',
+ permission => $parm_permission,
+ },
+# { text => 'Set Parameter Default Preferences',
+# help => 'Course_View_Class_List',
+# action => 'setdefaults',
+# permission => $parm_permission,
+# },
+ );
+ my $menu_html = '';
+ foreach my $menu_item (@menu) {
+ next if (! $menu_item->{'permission'});
+ $menu_html.='<p>';
+ $menu_html.='<font size="+1">';
+ if (exists($menu_item->{'url'})) {
+ $menu_html.=qq{<a href="$menu_item->{'url'}">};
+ } else {
+ $menu_html.=
+ qq{<a href="/adm/parmset?action=$menu_item->{'action'}">};
+ }
+ $menu_html.= &mt($menu_item->{'text'}).'</a></font>';
+ if (exists($menu_item->{'help'})) {
+ $menu_html.=
+ &Apache::loncommon::help_open_topic($menu_item->{'help'});
+ }
+ $menu_html.='</p>'.$/;
+ }
+ $r->print($menu_html);
+ return;
+}
+
+
+
+
##################################################
##################################################
@@ -2057,7 +2154,6 @@
Main handler. Calls &assessparms and &crsenv subroutines.
=cut
-
##################################################
##################################################
use Data::Dumper;
@@ -2069,7 +2165,8 @@
$r->send_http_header;
return OK;
}
- &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'});
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
+ ['action','state']);
# ----------------------------------------------------------- Clear out garbage
@@ -2085,28 +2182,60 @@
%maptitles=();
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>"/adm/parmset",
+ text=>"Parameter Manager",
+ faq=>9,bug=>'Instructor Interface',});
# ----------------------------------------------------- Needs to be in a course
-
if (($env{'request.course.id'}) &&
(&Apache::lonnet::allowed('opa',$env{'request.course.id'}) ||
&Apache::lonnet::allowed('opa',$env{'request.course.id'}.'/'.
$env{'request.course.sec'})
)) {
+ my $parm_permission =
+ (&Apache::lonnet::allowed('opa',$env{'request.course.id'}) ||
+ &Apache::lonnet::allowed('opa',$env{'request.course.id'}.'/'.
+ $env{'request.course.sec'}));
+
+ # Start Page
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
- if (($env{'form.crsenv'}) || (!$env{'request.course.fn'})) {
-# ---------------------------------------------- This is for course environment
-# -------------------------- also call if toplevel map coudl not be initialized
- &crsenv($r);
- } elsif ($env{'form.overview'}) {
-# --------------------------------------------------------------- Overview mode
+ #
+ # Main switch on form.action and form.state, as appropriate
+ #
+ # Check first if coming from someone else headed directly for
+ # the table mode
+ if ((($env{'form.command'} eq 'set') && ($env{'form.url'})
+ && (!$env{'form.dis'})) || ($env{'form.symb'})) {
+ &assessparms($r);
+
+ } elsif (! exists($env{'form.action'})) {
+ $r->print(&header());
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs
+ (undef,'Parameter Manager'));
+ &print_main_menu($r,$parm_permission);
+ } elsif ($env{'form.action'} eq 'crsenv' && $parm_permission) {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>'/adm/parmset?action=crsenv',
+ text=>"Course Environment"});
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs
+ (undef,'Edit Course Environment'));
+ &crsenv($r);
+ } elsif ($env{'form.action'} eq 'setoverview' && $parm_permission) {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>'/adm/parmset?action=setoverview',
+ text=>"Overview Mode"});
&overview($r);
- } else {
-# --------------------------------------------------------- Bring up assessment
+ } elsif ($env{'form.action'} eq 'settable' && $parm_permission) {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>'/adm/parmset?action=settable',
+ text=>"Table Mode"});
&assessparms($r);
- }
+ }
+
} else {
# ----------------------------- Not in a course, or not allowed to modify parms
$env{'user.error.msg'}=
--albertel1117475421--