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

banghart lon-capa-cvs-allow@mail.lon-capa.org
Thu, 07 Jun 2007 23:11:08 -0000


banghart		Thu Jun  7 19:11:08 2007 EDT

  Modified files:              
    /loncom/interface	loncreateuser.pm 
  Log:
  	TA template pretty much almost works. Still need to add more
  	templates and generalize code.
  
  
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.151 loncom/interface/loncreateuser.pm:1.152
--- loncom/interface/loncreateuser.pm:1.151	Thu Jun  7 18:34:56 2007
+++ loncom/interface/loncreateuser.pm	Thu Jun  7 19:11:05 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.151 2007/06/07 22:34:56 albertel Exp $
+# $Id: loncreateuser.pm,v 1.152 2007/06/07 23:11:05 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1611,14 +1611,22 @@
 	&print_username_entry_form($r);
         return;
     }
-    my $head_script = <<END_SCRIPT;
-    <script type="text/javascript">
-    function setchecks() {
-        document.form1.bre_c.checked = false;
+    my $head_script = "\n";
+    $head_script .= '<script type="text/javascript">'."\n";
+    $head_script .= 'function set_ta() {'."\n";
+    my @ta_c = split(/:/,$Apache::lonnet::pr{'ta:c'});
+    foreach my $priv_item (@ta_c) {
+        my ($priv, $dummy) = split(/\&/,$priv_item);
+        $head_script .= "document.form1.$priv"."_c.checked = true;\n";
+    }
+    my @ta_d = split(/:/,$Apache::lonnet::pr{'ta:d'});
+    foreach my $priv_item (@ta_d) {
+        my ($priv, $dummy) = split(/\&/,$priv_item);
+        $head_script .= "document.form1.$priv"."_d.checked = true;\n";
     }
-    </script>
-END_SCRIPT
-    
+        
+    $head_script .= '}'."\n";
+    $head_script .= '</script>'."\n";
     $r->print(&Apache::loncommon::start_page('Custom Role Editor',$head_script));
     my $syspriv='';
     my $dompriv='';
@@ -1641,11 +1649,7 @@
     my %full=();
     my %courselevel=();
     my %courselevelcurrent=();
-    my @roles = ("st:c","st:d");
-    #foreach my $item (@roles) {
-    #    &Apache::lonnet::logthis(" roles for $item: ".$Apache::lonnet::pr{$item});
-    #}
-     
+    my @roles = ("ta:c","ta:d","ta:s");
     foreach my $item (split(/\:/,$Apache::lonnet::pr{'cr:c'})) {
     
 	my ($priv,$restrict)=split(/\&/,$item);
@@ -1683,7 +1687,8 @@
 		    'crl'  => "Course Level",
                     'dml'  => "Domain Level",
                     'ssl'  => "System Level");
-    $r->print('<form action=""><input type="button" onClick="setchecks()" value="Click" /></form>');
+    $r->print('Select a Template<br />');
+    $r->print('<form action=""><input type="button" onClick="set_ta()" value="TA" /></form>');
     $r->print(<<ENDCCF);
 <form name=form1 method="post">
 <input type="hidden" name="phase" value="set_custom_roles" />