[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface lonpreferences.pm

raeburn raeburn at source.lon-capa.org
Mon Dec 10 16:03:49 EST 2012


raeburn		Mon Dec 10 21:03:49 2012 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	lonpreferences.pm 
  Log:
  - For 2.11.
    - Backport 1.200.
  
  
Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.196.4.6 loncom/interface/lonpreferences.pm:1.196.4.7
--- loncom/interface/lonpreferences.pm:1.196.4.6	Mon Dec 10 20:55:44 2012
+++ loncom/interface/lonpreferences.pm	Mon Dec 10 21:03:49 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Preferences
 #
-# $Id: lonpreferences.pm,v 1.196.4.6 2012/12/10 20:55:44 raeburn Exp $
+# $Id: lonpreferences.pm,v 1.196.4.7 2012/12/10 21:03:49 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1227,40 +1227,24 @@
     foreach my $item (sort(keys(%colortypes))) {
        my $curcol=&Apache::loncommon::designparm($function.'.'.$item,$domain);
        $chtable.=&Apache::loncommon::start_data_table_row().
-	   '<td>'.$colortypes{$item}.'</td><td style="background: '.$curcol.
-        '">      </td><td><input name="'.$item.
-        '" size="10" value="'.$curcol.
-'" /></td><td><a href="javascript:pjump('."'color_custom','".$colortypes{$item}.
-"','".$curcol."','"
-	    .$item."','parmform.pres','psub'".');">'.&mt('Select').'</a></td>'.
-	    &Apache::loncommon::end_data_table_row()."\n";
+                 '<td>'.$colortypes{$item}.'<td><input name="'.$item.
+                 '" class="colorchooser"  size="10" value="'.$curcol.
+                 '" /></td>'.
+	         &Apache::loncommon::end_data_table_row()."\n";
     }
     my $end_data_table = &Apache::loncommon::end_data_table();
     my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
     my $savebutton = &mt('Save');
     my $resetbutton = &mt('Reset All');
     my $resetbuttondesc = &mt('Reset All Colors to Default');
-    $r->print(<<ENDCOL);
-<script type="text/javascript" language="JavaScript">
-
-    $pjump_def
-
-    function psub() {
-        modalWindow.close();
-        if (document.parmform.pres_marker.value!='') {
-            if (document.parmform.pres_type.value!='') {
-                eval('document.prefs.'+
-                     document.parmform.pres_marker.value+
-		     '.value=document.parmform.pres_value.value;');
-	    }
-        } else {
-            document.parmform.pres_value.value='';
-            document.parmform.pres_marker.value='';
-        }
-    }
+    my $colorchooser=&Apache::lonhtmlcommon::color_picker();
+    $r-print('<script type="text/javascript" language="JavaScript">
+' . $colorchooser . '
+</script>
+');
 
+    $r->print(<<ENDCOL);
 
-</script>
 <form name="parmform">
 <input type="hidden" name="pres_marker" />
 <input type="hidden" name="pres_type" />
@@ -1299,6 +1283,9 @@
     my $message='';
     foreach my $item (keys %colortypes) {
         my $color=$env{'form.'.$item};
+        if (!($color =~ /^#/)) {
+            $color = '#' . $color;
+        }
         my $entry='color.'.$function.'.'.$item;
 	if (($color=~/^\#[0-9A-Fa-f]{6}$/) && (!$env{'form.resetall'})) {
 	    &Apache::lonnet::put('environment',{$entry => $color});




More information about the LON-CAPA-cvs mailing list