Date picker is now localized to the currently selected
[citadel.git] / webcit / static / wclib.js
index 5ff50ab0e2dabe34b8baeca4ac8c8c9584983c25..2ba65152d6c1f86a86c4f36b4badec11711cb7b8 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
 }
 
 
@@ -942,11 +960,14 @@ function TaskViewGatherCategoriesFromTable() {
        var table = $('taskview');
        
 }
-function attachDatePicker(relative) {
+function attachDatePicker(relative, wclang) {
        var dpck = new DatePicker({
        relative: relative,
-       language: 'en', // fix please
-       disableFutureDate: false
+       language: wclang.substr(0,2),
+       disableFutureDate: false,
+       dateFormat: [ ["yyyy", "mm", "dd"], "-"],
+       showDuration: 0.2,
+       closeEffectDuration: 0.2,
        });
        document.getElementById(relative).dpck = dpck; // attach a ref to it
 }
@@ -961,3 +982,26 @@ function eventEditAllDay() {
                dtend.style.textDecoration = "";
        }
 }
+
+
+
+
+// Functions which handle show/hide of various elements in the recurrence editor
+
+function RecurrenceShowHide() {
+
+       if ($('is_recur').checked) {
+               $('rrule').style.display = 'block';
+       }
+       else {
+               $('rrule').style.display = 'none';
+       }
+
+       if ($('freq_selector').selectedIndex == 4) {
+               $('weekday_selector').style.display = 'block';
+       }
+       else {
+               $('weekday_selector').style.display = 'none';
+       }
+
+}