See ChangeLog.

Monotone-Parent: 390f7c206ae4e50ad3d1334c22660aca0c7e31f6
Monotone-Revision: b6c5d167d41a064b4f0368af6cac50707b98be82

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2010-05-16T17:27:25
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Francis Lachapelle
2010-05-16 17:27:25 +00:00
parent 69367de503
commit 5946dc5a67
3 changed files with 76 additions and 4 deletions
+10 -1
View File
@@ -1,5 +1,14 @@
2010-05-21 Francis Lachapelle <flachapelle@inverse.ca>
* UI/WebServerResources/UIxPreferences.js (endEditable,
onColorPickerChoice): those functions will automatically trigger
the reload of the current module (hasChanged is set to 1).
* UI/WebServerResources/SchedulerUI.js (resetCategoriesStyles):
new method to manage the CSS associated to the event categories.
(newBaseEventDIV): a CSS class is added to the event div if a
category is associated to the event.
* SoObjects/Appointments/SOGoAppointmentFolder.m
(-fetchCoreInfosFrom:to:title:component:additionalFilters:): added
c_category field so UIxCalListingActions can fetch it.
@@ -21,7 +30,7 @@
new "c_category" field to the list of fields that require
fetching.
* UI/WebServerResources/SchedulerUI.js: (newBaseEventDIV) shifted
* UI/WebServerResources/SchedulerUI.js (newBaseEventDIV): shifted
field indexes by 1 from the 9th field, which is now the "category"
field.
+56
View File
@@ -29,6 +29,9 @@ var userStates = [ "needs-action", "accepted", "declined", "tentative", "delegat
var calendarHeaderAdjusted = false;
var categoriesStyles = new Hash();
var categoriesStyleSheet = null;
function newEvent(type, day, hour, duration) {
var folder = getSelectedFolder();
var folderID = folder.readAttribute("id");
@@ -1223,6 +1226,7 @@ function refreshCalendarEventsCallback(http) {
_drawCalendarEvents(eventsBlocks[2], eventsBlocks[0]);
}
_setupEventsDragAndDrop(eventsBlocks[0]);
resetCategoriesStyles();
onWindowResize(null);
}
if (http.callbackData["scrollEvent"])
@@ -1233,6 +1237,48 @@ function refreshCalendarEventsCallback(http) {
log("AJAX error when refreshing calendar events");
}
function resetCategoriesStyles() {
if (categoriesStyleSheet == null) {
categoriesStyleSheet = document.createElement("style");
categoriesStyleSheet.type = "text/css";
document.getElementsByTagName("head")[0].appendChild(categoriesStyleSheet);
}
else {
if (Prototype.Browser.IE)
while (categoriesStyleSheet.styleSheet.rules.length)
categoriesStyleSheet.styleSheet.removeRule();
else
while (categoriesStyleSheet.firstChild)
categoriesStyleSheet.removeChild(categoriesStyleSheet.firstChild);
}
// Update stylesheet with new categories colors
var selectors = [];
var rules = [];
categoriesStyles.keys().each(function(category) {
var color = UserDefaults['SOGoCalendarCategoriesColors'][category];
if (color) {
rules[rules.length] = '{ border-right: 8px solid ' + color + '; }';
selectors[selectors.length] = 'DIV.' + categoriesStyles.get(category);
}
});
if (selectors.length > 0) {
if (categoriesStyleSheet.styleSheet && categoriesStyleSheet.styleSheet.addRule) {
// IE
for (var i = 0; i < selectors.length; i++)
categoriesStyleSheet.styleSheet.addRule(selectors[i],
rules[i]);
}
else {
// Mozilla + Safari
for (var i = 0; i < selectors.length; i++)
categoriesStyleSheet.appendChild(document.createTextNode(selectors[i] +
' ' + rules[i]));
}
}
}
function newBaseEventDIV(eventRep, event, eventText) {
// log ("0 cname = " + event[0]);
// log ("1 calendar = " + event[1]);
@@ -1288,6 +1334,14 @@ function newBaseEventDIV(eventRep, event, eventText) {
textDiv.addClassName("text");
textDiv.update(eventText.replace(/(\\r)?\\n/g, "<BR/>"));
if (event[9] != null) {
var categoryStyle = categoriesStyles.get(event[9]);
if (!categoryStyle) {
categoryStyle = 'category_' + categoriesStyles.keys().length;
categoriesStyles.set([event[9]], categoryStyle);
}
innerDiv.addClassName(categoryStyle);
}
if (event[2] == null) {
// Status field is not defined -- user can't read event
eventCell.observe("selectstart", listRowMouseDownHandler);
@@ -1427,9 +1481,11 @@ function adjustCalendarHeaderDIV() {
"DIV#calendarHeader DIV.days"];
var rule = ("{ right: " + delta + "px; }");
if (styleElement.styleSheet && styleElement.styleSheet.addRule) {
// IE
styleElement.styleSheet.addRule(selectors[0], rule);
styleElement.styleSheet.addRule(selectors[1], rule);
} else {
// Mozilla + Firefox
var styleText = selectors.join(",") + " " + rule;
styleElement.appendChild(document.createTextNode(styleText));
}
+10 -3
View File
@@ -11,7 +11,7 @@ function savePreferences(sender) {
sigList.disabled = false;
if ($("categoriesList")) {
serializeCategories(null);
serializeCategories();
}
if ($("dayStartTime")) {
@@ -81,7 +81,7 @@ function _setupEvents(enable) {
var widgets = [ "timezone", "shortDateFormat", "longDateFormat",
"timeFormat", "weekStartDay", "dayStartTime", "dayEndTime",
"firstWeek", "messageCheck", "subscribedFoldersOnly",
"language"];
"language" ];
for (var i = 0; i < widgets.length; i++) {
var widget = $(widgets[i]);
if (widget) {
@@ -92,6 +92,9 @@ function _setupEvents(enable) {
}
}
// Note: we also monitor changes to the calendar categories.
// See functions endEditable and onColorPickerChoice.
$("replyPlacementList").observe ("change", onReplyPlacementListChange);
$("composeMessagesType").observe ("change", onComposeMessagesTypeChange);
@@ -413,6 +416,8 @@ function endEditable (element) {
element.innerHTML = tmp;
element.removeClassName ("editing");
element.addClassName ("categoryListCell");
if (parseInt($("hasChanged").value) == 0)
onChoiceChanged(null);
}
function endAllEditables (e) {
@@ -452,6 +457,8 @@ function onColorPickerChoice (newColor) {
// div.removeClassName ("colorEditing");
div.showColor = newColor;
div.style.background = newColor;
if (parseInt($("hasChanged").value) == 0)
onChoiceChanged(null);
}
@@ -491,7 +498,7 @@ function onCategoryDelete (e) {
}
function serializeCategories (e) {
function serializeCategories() {
var r = $$("TABLE#categoriesList tbody tr");
var values = [];