[LON-CAPA-cvs] cvs: rat /client parameter.html loncom/html/adm/lonDomColors default.tab loncom/interface loncommon.pm lonpreferences.pm

www lon-capa-cvs@mail.lon-capa.org
Sat, 19 Apr 2003 15:34:06 -0000


www		Sat Apr 19 11:34:06 2003 EDT

  Modified files:              
    /loncom/html/adm/lonDomColors	default.tab 
    /loncom/interface	loncommon.pm lonpreferences.pm 
    /rat/client	parameter.html 
  Log:
  Bug #1061: Each user can set their own color scheme.
  
  
Index: loncom/html/adm/lonDomColors/default.tab
diff -u loncom/html/adm/lonDomColors/default.tab:1.6 loncom/html/adm/lonDomColors/default.tab:1.7
--- loncom/html/adm/lonDomColors/default.tab:1.6	Sat Apr  5 17:14:40 2003
+++ loncom/html/adm/lonDomColors/default.tab	Sat Apr 19 11:34:05 2003
@@ -32,7 +32,7 @@
 author.vlink=#006666
 author.alink=#CC0000
 student.img=/adm/lonInterFace/student.jpg
-student.pgbg=#FFFFBB
+student.pgbg=#FFFFDD
 student.tabbg=#EEEE99
 student.font=#551100
 student.sidebg=#991100
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.95 loncom/interface/loncommon.pm:1.96
--- loncom/interface/loncommon.pm:1.95	Sat Apr  5 17:14:40 2003
+++ loncom/interface/loncommon.pm	Sat Apr 19 11:34:06 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.95 2003/04/05 22:14:40 www Exp $
+# $Id: loncommon.pm,v 1.96 2003/04/19 15:34:06 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1635,6 +1635,9 @@
 ##############################################
 sub designparm {
     my ($which,$domain)=@_;
+    if ($ENV{'environment.color.'.$which}) {
+	return $ENV{'environment.color.'.$which};
+    }
     $domain=&determinedomain($domain);
     if ($designhash{$domain.'.'.$which}) {
 	return $designhash{$domain.'.'.$which};
Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.20 loncom/interface/lonpreferences.pm:1.21
--- loncom/interface/lonpreferences.pm:1.20	Fri Apr 18 21:42:34 2003
+++ loncom/interface/lonpreferences.pm	Sat Apr 19 11:34:06 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Preferences
 #
-# $Id: lonpreferences.pm,v 1.20 2003/04/19 01:42:34 www Exp $
+# $Id: lonpreferences.pm,v 1.21 2003/04/19 15:34:06 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -272,7 +272,8 @@
 sub colorschanger {
     my $r = shift;
     my $bodytag=&Apache::loncommon::bodytag(
-                    'Change Color Scheme for Current Role Type');
+                    'Change Color Scheme for Current Role Type','',
+                    'onUnload="pclose();"');
 # figure out colors
     my $function='student';
     if ($ENV{'request.role'}=~/^(cc|in|ta|ep)/) {
@@ -298,10 +299,10 @@
        my $curcol=&Apache::loncommon::designparm($function.'.'.$item,$domain);
        $chtable.='<tr><td>'.$colortypes{$item}.'</td><td bgcolor="'.$curcol.
         '">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td><input name="'.$item.
-        '" size="8" value="'.$curcol.
-'" /></td><td><a href="javascript:pjump('."'color','".$colortypes{$item}.
+        '" size="10" value="'.$curcol.
+'" /></td><td><a href="javascript:pjump('."'color_custom','".$colortypes{$item}.
 "','".$curcol."','"
-	    .$item."','".$item."','psub'".');">Select</a></td></tr>';
+	    .$item."','parmform.pres','psub'".');">Select</a></td></tr>';
     }
     $r->print(<<ENDCOL);
 <html>
@@ -325,20 +326,11 @@
     function psub() {
         pclose();
         if (document.parmform.pres_marker.value!='') {
-            document.parmform.action+='#'+document.parmform.pres_marker.value;
-            var typedef=new Array();
-            typedef=document.parmform.pres_type.value.split('_');
-           if (document.parmform.pres_type.value!='') {
-            if (typedef[0]=='date') {
-                eval('document.parmform.recent_'+
-                     document.parmform.pres_type.value+
+            if (document.parmform.pres_type.value!='') {
+                eval('document.server.'+
+                     document.parmform.pres_marker.value+
 		     '.value=document.parmform.pres_value.value;');
-            } else {
-                eval('document.parmform.recent_'+typedef[0]+
-		     '.value=document.parmform.pres_value.value;');
-            }
-	   }
-            document.parmform.submit();
+	    }
         } else {
             document.parmform.pres_value.value='';
             document.parmform.pres_marker.value='';
@@ -348,13 +340,18 @@
 
 </script>
 $bodytag
-
+<form name="parmform">
+<input type="hidden" name="pres_marker" />
+<input type="hidden" name="pres_type" />
+<input type="hidden" name="pres_value" />
+</form>
 <form name="server" action="/adm/preferences" method="post">
 <input type="hidden" name="action" value="verify_and_change_colors" />
 <table border="2">
 $chtable
 </table>
-<input type="submit" value="Change" />
+<input type="submit" value="Change Custom Colors" />
+<input type="submit" name="resetall" value="Reset All Colors to Default" />
 </form>
 </body>
 </html>
@@ -385,18 +382,19 @@
                     'alink' => 'Active Link');
 
     my $message='';
-#    my $newscreen='';
-#    $newscreen=~s/\,$//;
-#    if ($newscreen) {
-#        &Apache::lonnet::put('environment',{'msgforward' => $newscreen});
-#        &Apache::lonnet::appenv('environment.msgforward' => $newscreen);
-#        $message.='Set new message forwarding to '.$newscreen.'<br />';
-#    } else {
-#        &Apache::lonnet::del('environment',['msgforward']);
-#        &Apache::lonnet::delenv('environment\.msgforward');
-#        $message.='Reset message forwarding<br />';
-#    }
-
+    foreach my $item (keys %colortypes) {
+        my $color=$ENV{'form.'.$item};
+        my $entry='color.'.$function.'.'.$item;
+	if (($color=~/^\#[0-9A-Fa-f]{6}$/) && (!$ENV{'form.resetall'})) {
+	    &Apache::lonnet::put('environment',{$entry => $color});
+	    &Apache::lonnet::appenv('environment.'.$entry => $color);
+	    $message.='Set '.$colortypes{$item}.' to '.$color.'<br />';
+	} else {
+	    &Apache::lonnet::del('environment',[$entry]);
+	    &Apache::lonnet::delenv('environment\.'.$entry);
+	    $message.='Reset '.$colortypes{$item}.'<br />';
+	}
+    }
     my $bodytag=&Apache::loncommon::bodytag(
                            'Change Color Scheme for Current Role Type');
     $r->print(<<ENDVCCOL);
@@ -404,6 +402,10 @@
 $bodytag
 </p>
 $message
+<form name="client" action="/adm/preferences" method="post">
+<input type="hidden" name="action" value="changecolors" />
+<input type="submit" value="Revise color scheme again" />
+</form>
 </body></html>
 ENDVCCOL
 }
Index: rat/client/parameter.html
diff -u rat/client/parameter.html:1.21 rat/client/parameter.html:1.22
--- rat/client/parameter.html:1.21	Fri Apr 18 16:21:38 2003
+++ rat/client/parameter.html	Sat Apr 19 11:34:06 2003
@@ -3,7 +3,7 @@
 The LearningOnline Network with CAPA
 Parameter Input Window
 //
-// $Id: parameter.html,v 1.21 2003/04/18 20:21:38 www Exp $
+// $Id: parameter.html,v 1.22 2003/04/19 15:34:06 www Exp $
 //
 // Copyright Michigan State University Board of Trustees
 //
@@ -718,6 +718,11 @@
   if (ptype=='string') {
      sopt('default','Default');
      sopt('string','String Value');
+  }
+
+  if (ptype=='color') {
+     sopt('default','Use Default Color');
+     sopt('custom','Use Custom Color');
   }
 
   selwrite('</select></form>');