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

www lon-capa-cvs@mail.lon-capa.org
Mon, 13 Jun 2005 15:35:39 -0000


www		Mon Jun 13 11:35:39 2005 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  Saving my (minimal) work on default parameter setting actions
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.219 loncom/interface/lonparmset.pm:1.220
--- loncom/interface/lonparmset.pm:1.219	Thu Jun  9 16:35:48 2005
+++ loncom/interface/lonparmset.pm	Mon Jun 13 11:35:37 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.219 2005/06/09 20:35:48 www Exp $
+# $Id: lonparmset.pm,v 1.220 2005/06/13 15:35:37 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2505,11 +2505,10 @@
             permission => $parm_permission,
             help => 'Cascading_Parameters',
             },
-#          { text => 'Set Parameter Default Preferences',
-#            help => 'Course_View_Class_List',
-#            action => 'setdefaults',
-#            permission => $parm_permission,
-#            },
+          { text => 'Set Parameter Setting Default Actions',
+            action => 'setdefaults',
+            permission => $parm_permission,
+            },
           );
     my $menu_html = '';
     foreach my $menu_item (@menu) {
@@ -2534,7 +2533,32 @@
 }
 
 
+##################################################
 
+sub defaultsetter {
+    my $r=shift;
+    my $bodytag=&Apache::loncommon::bodytag('Parameter Setting Default Actions');
+    my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+    my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+    my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Defaults');
+    my $html=&Apache::lonxml::xmlbegin();
+    $r->print(<<ENDDEFHEAD);
+$html
+<head>
+<title>LON-CAPA Parameters</title>
+</head>
+$bodytag
+$breadcrumbs
+<form method="post" action="/adm/parmset?action=setdefaults" name="defaultform">
+ENDDEFHEAD
+    my %rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs);
+    if ($env{'form.storerules'}) {
+	%rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs);
+    }
+    
+    
+    return;
+}
 
 ##################################################
 ##################################################
@@ -2548,7 +2572,8 @@
 =cut
 ##################################################
 ##################################################
-    use Data::Dumper;
+#    use Data::Dumper;
+
 sub handler {
     my $r=shift;
 
@@ -2615,7 +2640,11 @@
             &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview',
 						    text=>"Overview Mode"});
 	    &newoverview($r);
-        } elsif ($env{'form.action'} eq 'settable' && $parm_permission) {
+        }  elsif ($env{'form.action'} eq 'setdefaults' && $parm_permission) {
+            &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setdefaults',
+						    text=>"Set Defaults"});
+	    &defaultsetter($r);
+	} elsif ($env{'form.action'} eq 'settable' && $parm_permission) {
             &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable',
 						    text=>"Table Mode",
 						    help => 'Course_Setting_Parameters'});