]> code.citadel.org Git - citadel.git/blobdiff - webcit/static/wclib.js
* Eliminated the sometimes-wonky resize behavior by changing
[citadel.git] / webcit / static / wclib.js
index 5ff50ab0e2dabe34b8baeca4ac8c8c9584983c25..8ef0d63e00871e88c72d93f01dde19a32db60a84 100644 (file)
@@ -523,13 +523,31 @@ function NotesClickPalette(evt, uid) {
 // Called when the user clicks on one of the colors in an open color selector.
 // Sets the desired color and then closes the color selector.
 
-function NotesClickColor(evt, uid, red, green, blue) {
+function NotesClickColor(evt, uid, red, green, blue, notecolor, titlecolor) {
        uid_of_note_being_colored = uid;
-       d = $('palette-' + uid_of_note_being_colored);
-
-       alert('FIXME red=' + red + ' green=' + green + ' blue=' + blue);
-
-       d.style.display = 'none';
+       palette_button = $('palette-' + uid_of_note_being_colored);
+       note_div = $('note-' + uid_of_note_being_colored);
+       titlebar_div = $('titlebar-' + uid_of_note_being_colored);
+
+       // alert('FIXME red=' + red + ' green=' + green + ' blue=' + blue);
+
+       note_div.style.backgroundColor = notecolor;
+       titlebar_div.style.backgroundColor = titlecolor;
+       palette_button.style.display = 'none';
+
+       // submit an ajax http call to record it to the server
+       p = 'note_uid=' + uid_of_note_being_colored
+               + '&red=' + red
+               + '&green=' + green
+               + '&blue=' + blue
+               + '&r=' + CtdlRandomString();
+       new Ajax.Request(
+               'ajax_update_note',
+               {
+                       method: 'post',
+                       parameters: p
+               }
+       );
 }
 
 
@@ -567,7 +585,7 @@ function NotesResizeMouseUp(evt) {
        }
 
        uid_of_note_being_resized = '';
-       return true;
+       return false;           // disable the default action
 }
 
 function NotesResizeMouseMove(evt) {
@@ -588,7 +606,7 @@ function NotesResizeMouseMove(evt) {
        saved_x = x;
        saved_y = y;
        note_was_resized = 1;
-       return true;
+       return false;           // disable the default action
 }