mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-11 00:08:51 +00:00
Monotone-Parent: 85e8a21a77536298272957804613bdc6189853fc
Monotone-Revision: 1166336fab8e7bdf13b850af8c0155fa72c445ff Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-12-20T16:45:52 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -144,18 +144,24 @@ function openContactsFolderAtIndex(element) {
|
||||
|
||||
function contactsListCallback(http)
|
||||
{
|
||||
var div = $('contactsListContent');
|
||||
var div = $("contactsListContent");
|
||||
|
||||
if (http.readyState == 4
|
||||
&& http.status == 200) {
|
||||
document.contactsListAjaxRequest = null;
|
||||
div.innerHTML = http.responseText;
|
||||
var selected = http.callbackData;
|
||||
if (selected) {
|
||||
for (var i = 0; i < selected.length; i++)
|
||||
selectNode($(selected[i]));
|
||||
if (http.readyState == 4) {
|
||||
if (http.status == 200) {
|
||||
document.contactsListAjaxRequest = null;
|
||||
div.innerHTML = http.responseText;
|
||||
var selected = http.callbackData;
|
||||
if (selected) {
|
||||
for (var i = 0; i < selected.length; i++)
|
||||
selectNode($(selected[i]));
|
||||
}
|
||||
configureSortableTableHeaders();
|
||||
} else if (http.status == 403) {
|
||||
window.alert(labels.error_ab_access_denied.decodeEntities());
|
||||
openContactsFolder("/personal", null, false);
|
||||
var cf = $("contactFolders");
|
||||
cf.deselectAll();
|
||||
}
|
||||
configureSortableTableHeaders();
|
||||
}
|
||||
else
|
||||
log ("ajax fuckage");
|
||||
|
||||
@@ -855,8 +855,7 @@ function calendarUidsList()
|
||||
{
|
||||
var list = "";
|
||||
|
||||
var clist = $("calendarsList");
|
||||
var nodes = clist.childNodes[5].childNodesWithTag("li");
|
||||
var nodes = $("uixselector-calendarsList-display").childNodesWithTag("li");
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
var currentNode = nodes[i];
|
||||
var input = currentNode.childNodesWithTag("input")[0];
|
||||
@@ -907,8 +906,44 @@ function inhibitMyCalendarEntry()
|
||||
}
|
||||
}
|
||||
|
||||
function userCalendarEntry(user, color) {
|
||||
var li = document.createElement("li");
|
||||
li.setAttribute("uid", user);
|
||||
li.addEventListener("mousedown", listRowMouseDownHandler, false);
|
||||
li.addEventListener("click", onRowClick, false);
|
||||
var colorBox = document.createElement("span");
|
||||
colorBox.addClassName("colorBox");
|
||||
if (color) {
|
||||
log("color: " + color);
|
||||
colorBox.style.backgroundColor = color + ";";
|
||||
}
|
||||
li.appendChild(colorBox);
|
||||
var checkBox = document.createElement("input");
|
||||
checkBox.addClassName("checkBox");
|
||||
checkBox.type = "checkbox";
|
||||
checkBox.addEventListener("change", updateCalendarStatus, false);
|
||||
li.appendChild(checkBox);
|
||||
var text = document.createTextNode(" " + user);
|
||||
li.appendChild(text);
|
||||
|
||||
return li;
|
||||
}
|
||||
|
||||
function ensureSelfIfPresent() {
|
||||
var ul = $("uixselector-calendarsList-display");
|
||||
var list = ul.childNodesWithTag("li");
|
||||
var selfEntry = userCalendarEntry(UserLogin, indexColor(0));
|
||||
selfEntry.style.fontWeight = "bold;";
|
||||
if (list.length < 1) {
|
||||
ul.appendChild(selfEntry);
|
||||
} else if (list[0].getAttribute("uid") != UserLogin) {
|
||||
ul.insertBefore(selfEntry, list[0]);
|
||||
}
|
||||
}
|
||||
|
||||
function updateCalendarsList(method)
|
||||
{
|
||||
ensureSelfIfPresent();
|
||||
var url = (ApplicationBaseURL + "updateCalendars?ids="
|
||||
+ calendarUidsList());
|
||||
if (document.calendarsListAjaxRequest) {
|
||||
@@ -963,21 +998,9 @@ function addContact(tag, fullContactName, contactId, contactName, contactEmail)
|
||||
else
|
||||
uids.value = contactId;
|
||||
var names = $("uixselector-calendarsList-display");
|
||||
names.innerHTML += ('<li onmousedown="return false;"'
|
||||
+ ' uid="' + contactId + '">'
|
||||
+ ' <span class="colorBox"></span>'
|
||||
+ ' <input class="checkBox" type="checkbox" />'
|
||||
+ contactName + '</li>');
|
||||
var listElems = names.childNodesWithTag("li");
|
||||
var i = (listElems.length - 1);
|
||||
var colorDef = indexColor(i);
|
||||
log("colorDef: " + colorDef);
|
||||
var input = listElems[i].childNodesWithTag("input")[0];
|
||||
listElems[i].addEventListener("click", onRowClick, false);
|
||||
var colorBox = listElems[i].childNodesWithTag("span")[0];
|
||||
log("colorBox: " + colorBox);
|
||||
colorBox.style.backgroundColor = colorDef + ";";
|
||||
input.addEventListener("change", updateCalendarStatus, false);
|
||||
var colorDef = indexColor(listElems.length);
|
||||
names.appendChild(userCalendarEntry(contactId, colorDef));
|
||||
|
||||
var styles = document.getElementsByTagName("style");
|
||||
styles[0].innerHTML += ('.ownerIs' + contactId + ' {'
|
||||
|
||||
@@ -5,6 +5,7 @@ DIV.acls
|
||||
|
||||
DIV.acls LABEL
|
||||
{ position: relative;
|
||||
white-space: normal;
|
||||
width: 100%; }
|
||||
|
||||
DIV.acls LABEL > SPAN.value
|
||||
|
||||
@@ -940,24 +940,32 @@ function d2h(d) {
|
||||
}
|
||||
|
||||
function indexColor(number) {
|
||||
var colorTable = new Array(1, 1, 1);
|
||||
var color;
|
||||
|
||||
var currentValue = number;
|
||||
var index = 0;
|
||||
while (currentValue)
|
||||
{
|
||||
if (currentValue & 1)
|
||||
colorTable[index]++;
|
||||
if (number == 0)
|
||||
color = "#ccf";
|
||||
else {
|
||||
var colorTable = new Array(1, 1, 1);
|
||||
|
||||
var currentValue = number;
|
||||
var index = 0;
|
||||
while (currentValue)
|
||||
{
|
||||
if (currentValue & 1)
|
||||
colorTable[index]++;
|
||||
if (index == 3)
|
||||
index = 0;
|
||||
currentValue >>= 1;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
color = ("#"
|
||||
+ d2h((256 / colorTable[2]) - 1)
|
||||
+ d2h((256 / colorTable[1]) - 1)
|
||||
+ d2h((256 / colorTable[0]) - 1));
|
||||
}
|
||||
|
||||
return ("#"
|
||||
+ d2h((256 / colorTable[2]) - 1)
|
||||
+ d2h((256 / colorTable[1]) - 1)
|
||||
+ d2h((256 / colorTable[0]) - 1));
|
||||
return color;
|
||||
}
|
||||
|
||||
var onLoadHandler = {
|
||||
|
||||
Reference in New Issue
Block a user