[LON-CAPA-cvs] cvs: loncom /interface lonconfigsettings.pm lonparmset.pm

raeburn raeburn at source.lon-capa.org
Mon Apr 8 19:21:15 EDT 2013


raeburn		Mon Apr  8 23:21:15 2013 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm lonconfigsettings.pm 
  Log:
  - lonparmset::startSettingsScreen() takes third arg - course type 
    (Course or Community).
  
  
-------------- next part --------------
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.530 loncom/interface/lonparmset.pm:1.531
--- loncom/interface/lonparmset.pm:1.530	Mon Jan 28 18:17:26 2013
+++ loncom/interface/lonparmset.pm	Mon Apr  8 23:21:15 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.530 2013/01/28 18:17:26 bisitz Exp $
+# $Id: lonparmset.pm,v 1.531 2013/04/08 23:21:15 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -315,11 +315,15 @@
 
 
 sub startSettingsScreen {
-    my ($r,$mode)=@_;
+    my ($r,$mode,$crstype)=@_;
 
+    my $tabtext = &mt('Course Settings');
+    if ($crstype eq 'Community') {
+        $tabtext = &mt('Community Settings');
+    } 
     $r->print("\n".'<ul class="LC_TabContentBigger" id="main">');
     $r->print("\n".'<li'.($mode eq 'coursepref'?' class="active"':'').'><a href="/adm/courseprefs"><b>    '.
-                                          &mt('Course Settings').
+                                          $tabtext.
                                           '    </b></a></li>');
 
     $r->print("\n".'<li'.($mode eq 'parmset'?' class="active"':'').' id="tabbededitor"><a href="/adm/parmset"><b>'.
@@ -920,7 +924,7 @@
 }
 
 sub startpage {
-    my ($r,$psymb) = @_;
+    my ($r,$psymb,$crstype) = @_;
 
     my %loaditems = (
                       'onload'   => "group_or_section('cgroup')",
@@ -954,7 +958,7 @@
     my $escfilter=&Apache::lonhtmlcommon::entity_encode($env{'form.filter'});
     my $escpart=&Apache::lonhtmlcommon::entity_encode($env{'form.part'});
     $r->print($start_page.$breadcrumbs);
-    &startSettingsScreen($r,'parmset');
+    &startSettingsScreen($r,'parmset',$crstype);
     $r->print(<<ENDHEAD);
 <form method="post" action="/adm/parmset?action=settable" name="parmform">
 <input type="hidden" value="" name="pres_value" />
@@ -2226,7 +2230,8 @@
     if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);}
 # ------------------------------------------------------------------ Start page
 
-    &startpage($r,$pssymb);
+    my $crstype = &Apache::loncommon::course_type();
+    &startpage($r,$pssymb,$crstype);
 
     foreach ('tolerance','date_default','date_start','date_end',
         'date_interval','int','float','string') {
@@ -2306,7 +2311,6 @@
              .'</a>'
              .'</p>');
     } else {
-        $r->print();
         # parameter screen for a single resource. 
         my ($map,$iid,$resource)=&Apache::lonnet::decode_symb($pssymb);
         my $title = &Apache::lonnet::gettitle($pssymb);
@@ -2430,9 +2434,8 @@
                my $defbgtwo='';
                my $defbgthree = '';
 
-               foreach (@ids) {
+               foreach my $rid (@ids) {
 
-                my $rid=$_;
                 my ($inmapid)=($rid=~/\.(\d+)$/);
 
                 if ((!$pssymb &&
@@ -3307,6 +3310,7 @@
 
     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+    my $crstype =  $env{'course.'.$env{'request.course.id'}.'.type'};
     &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview',
         text=>"Overview Mode"});
 
@@ -3326,7 +3330,7 @@
                                                     {'add_entries' => \%loaditems,});
     my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview');
     $r->print($start_page.$breadcrumbs);
-    &startSettingsScreen($r,'parmset');
+    &startSettingsScreen($r,'parmset',$crstype);
     $r->print(<<ENDOVER);
 <form method="post" action="/adm/parmset?action=newoverview" name="parmform">
 ENDOVER
@@ -3495,13 +3499,14 @@
     my ($r) = @_;
     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+    my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
 
     &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview',
     text=>"Overview Mode"});
     my $start_page=&Apache::loncommon::start_page('Modify Parameters');
     my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview');
     $r->print($start_page.$breadcrumbs);
-    &startSettingsScreen($r,'parmset');
+    &startSettingsScreen($r,'parmset',$crstype);
     $r->print('<form method="post" action="/adm/parmset?action=setoverview" name="parmform">');
 
 # Store modified
@@ -3618,13 +3623,14 @@
     my ($r) = @_;
     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+    my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
 
     &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'},
         text=>"Shifting Dates"});
     my $start_page=&Apache::loncommon::start_page('Shift Dates');
     my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift');
     $r->print($start_page.$breadcrumbs);
-    &startSettingsScreen($r,'parmset');
+    &startSettingsScreen($r,'parmset',$crstype);
     $r->print('<form name="shiftform" method="post">'.
               '<table><tr><td>'.&mt('Currently set date:').'</td><td>'.
               &Apache::lonlocal::locallocaltime($env{'form.timebase'}).'</td></tr>'.
@@ -3646,12 +3652,13 @@
     my ($r) = @_;
     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+    my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
     &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'},
         text=>"Shifting Dates"});
     my $start_page=&Apache::loncommon::start_page('Shift Dates');
     my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift');
     $r->print($start_page.$breadcrumbs);
-    &startSettingsScreen($r,'parmset');
+    &startSettingsScreen($r,'parmset',$crstype);
     my $timeshifted=&Apache::lonhtmlcommon::get_date_from_form('timeshifted');
     $r->print(&mt('Shifting all dates such that [_1] becomes [_2]',
               &Apache::lonlocal::locallocaltime($env{'form.timebase'}),
@@ -3713,7 +3720,10 @@
     #
     $r->print(&header());
     $r->print(&Apache::lonhtmlcommon::breadcrumbs('Content and Problem Settings'));
-    &startSettingsScreen($r,'parmset');
+    my $crstype = &Apache::loncommon::course_type();
+    my $lc_crstype = lc($crstype);
+
+    &startSettingsScreen($r,'parmset',$crstype);
     $r->print(<<ENDMAINFORMHEAD);
 <form method="post" enctype="multipart/form-data"
       action="/adm/parmset" name="studentform">
@@ -3729,9 +3739,6 @@
                                         '/'.$env{'request.course.sec'});
     }
 
-    my $crstype = &Apache::loncommon::course_type();
-    my $lc_crstype = lc($crstype);
-
     my @menu =
         ( { categorytitle=>"Content Settings for this $crstype",
         items => [
@@ -3867,6 +3874,7 @@
     my $idx = 1;
     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+    my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};;
     $r->print(&Apache::loncommon::start_page('Order Metadata Fields'));
     &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata',
         text=>"Add Metadata Field"});
@@ -3875,7 +3883,7 @@
               text=>"Restrict Metadata"},
              {text=>"Order Metadata"});
     $r->print(&Apache::lonhtmlcommon::breadcrumbs('Order Metadata'));
-    &startSettingsScreen($r,'parmset');
+    &startSettingsScreen($r,'parmset',$crstype);
     if ($env{'form.storeorder'}) {
         my $newpos = $env{'form.newpos'} - 1;
         my $currentpos = $env{'form.currentpos'} - 1;
@@ -3965,9 +3973,10 @@
         text=>"Add Metadata Field"});
     $r->print(&Apache::loncommon::start_page('Add Metadata Field'));
     $r->print(&Apache::lonhtmlcommon::breadcrumbs('Add Metadata Field'));
-    &startSettingsScreen($r,'parmset');
     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+    my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
+    &startSettingsScreen($r,'parmset',$crstype);
     if (exists($env{'form.undelete'})) {
         my @meta_fields = &Apache::loncommon::get_env_multiple('form.undeletefield');
         foreach my $meta_field(@meta_fields) {
@@ -4022,9 +4031,10 @@
         text=>"Restrict Metadata"});
     $r->print(&Apache::loncommon::start_page('Restrict Metadata'));
     $r->print(&Apache::lonhtmlcommon::breadcrumbs('Restrict Metadata'));
-    &startSettingsScreen($r,'parmset');
     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+    my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
+    &startSettingsScreen($r,'parmset',$crstype);
     my $key_base = $env{'course.'.$env{'request.course.id'}.'.'};
     my $save_field = '';
     if ($env{'form.restrictmeta'}) {
@@ -4136,15 +4146,16 @@
 
     &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setdefaults',
         text=>"Set Defaults"});
+    my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+    my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+    my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
     my $start_page =
-    &Apache::loncommon::start_page('Parameter Setting Default Actions');
+        &Apache::loncommon::start_page('Parameter Setting Default Actions');
     my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Defaults');
     $r->print($start_page.$breadcrumbs);
-    &startSettingsScreen($r,'parmset');
+    &startSettingsScreen($r,'parmset',$crstype);
     $r->print('<form method="post" action="/adm/parmset?action=setdefaults" name="defaultform">');
 
-    my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
-    my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
     my @ids=();
     my %typep=();
     my %keyp=();
@@ -4198,8 +4209,8 @@
     foreach my $key (keys %allparms) {
         $newrules{$key.'_triggers'}=$triggers{$key};
     }
-    &Apache::lonnet::put('parmdefactions',\%newrules,$dom,$crs);
-    &Apache::lonnet::del('parmdefactions',\@delrules,$dom,$crs);
+    &Apache::lonnet::put('parmdefactions',\%newrules,$cdom,$cnum);
+    &Apache::lonnet::del('parmdefactions',\@delrules,$cdom,$cnum);
     &resetrulescache();
     }
     my %lt=&Apache::lonlocal::texthash('days' => 'Days',
@@ -4376,6 +4387,9 @@
 
 sub parm_change_log {
     my ($r)=@_;
+    my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+    my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+    my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}
     &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable',
     text=>"Parameter Change Log"});
     my $js = '<script type="text/javascript">'."\n".
@@ -4385,10 +4399,8 @@
              '</script>'."\n";
     $r->print(&Apache::loncommon::start_page('Parameter Change Log',$js));
     $r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Change Log'));
-    &startSettingsScreen($r,'parmset');
-    my %parmlog=&Apache::lonnet::dump('nohist_parameterlog',
-                      $env{'course.'.$env{'request.course.id'}.'.domain'},
-                      $env{'course.'.$env{'request.course.id'}.'.num'});
+    &startSettingsScreen($r,'parmset',$crstype);
+    my %parmlog=&Apache::lonnet::dump('nohist_parameterlog',$cdom,$cnum);
 
     if ((keys(%parmlog))[0]=~/^error\:/) { undef(%parmlog); }
 
@@ -4406,8 +4418,7 @@
               '<input type="submit" value="'.&mt('Display').'" />'.
               '</form></fieldset></div><br clear="all" />');
 
-    my $courseopt=&Apache::lonnet::get_courseresdata($env{'course.'.$env{'request.course.id'}.'.num'},
-                             $env{'course.'.$env{'request.course.id'}.'.domain'});
+    my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom);
     $r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row().
           '<th>'.&mt('Time').'</th><th>'.&mt('User').'</th><th>'.&mt('Extent').'</th><th>'.&mt('Users').'</th><th>'.
           &mt('Parameter').'</th><th>'.&mt('Part').'</th><th>'.&mt('New Value').'</th><th>'.&mt('Announce').'</th>'.
Index: loncom/interface/lonconfigsettings.pm
diff -u loncom/interface/lonconfigsettings.pm:1.23 loncom/interface/lonconfigsettings.pm:1.24
--- loncom/interface/lonconfigsettings.pm:1.23	Fri Dec  7 16:12:18 2012
+++ loncom/interface/lonconfigsettings.pm	Mon Apr  8 23:21:15 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: lonconfigsettings.pm,v 1.23 2012/12/07 16:12:18 bisitz Exp $
+# $Id: lonconfigsettings.pm,v 1.24 2013/04/08 23:21:15 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -39,7 +39,7 @@
 
 sub print_header {
     my ($r,$phase,$context,$jscript,$container) = @_;
-    my ($pagetitle,$brcrumtitle,$action,$call_category_check);
+    my ($pagetitle,$brcrumtitle,$action,$call_category_check,$crstype);
     if ($context eq 'domain') {
         ($pagetitle, $brcrumtitle) = ('View/Modify Domain Settings','View/Modify Domain Settings');
         $action = '/adm/domainprefs';
@@ -56,7 +56,8 @@
             }
         }
     } else {
-        if (&Apache::loncommon::course_type() eq 'Community') {
+        $crstype = &Apache::loncommon::course_type();
+        if ($crstype eq 'Community') {
             ($pagetitle,$brcrumtitle) = ('Community Configuration','Community Configuration');
         } else {
             ($pagetitle,$brcrumtitle) = ('Course Configuration','Course Configuration');
@@ -130,7 +131,7 @@
 </form>
 ');
     if ($container) {
-       &Apache::lonparmset::startSettingsScreen($r,$container);
+       &Apache::lonparmset::startSettingsScreen($r,$container,$crstype);
     }
     $r->print('<form method="post" name="'.$phase.'" action="'.$action.'"'.
               ' enctype="multipart/form-data">');


More information about the LON-CAPA-cvs mailing list