From 70719110469c6f2b3151ef3f3e93e6c9e48985d3 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Sat, 15 Sep 2007 01:54:23 +0000 Subject: [PATCH] Monotone-Parent: 1df5dfce7af858e1373fbc29363e661317b88be7 Monotone-Revision: c9d2f25bdcfea3f8f41656cea282a4a8b50b02be Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-09-15T01:54:23 Monotone-Branch: ca.inverse.sogo --- UI/WebServerResources/ContactsUI.js | 14 +++-- UI/WebServerResources/SchedulerUI.js | 87 ++++++++++++++-------------- 2 files changed, 54 insertions(+), 47 deletions(-) diff --git a/UI/WebServerResources/ContactsUI.js b/UI/WebServerResources/ContactsUI.js index f1912558c..b940720a9 100644 --- a/UI/WebServerResources/ContactsUI.js +++ b/UI/WebServerResources/ContactsUI.js @@ -507,11 +507,15 @@ function appendAddressBook(name, folder) { folder = accessToSubscribedFolder(folder); else folder = "/" + name; - var li = document.createElement("li"); - $("contactFolders").appendChild(li); - li.setAttribute("id", folder); - li.appendChild(document.createTextNode(name)); - setEventsOnContactFolder(li); + if ($(folder)) + window.alert(clabels["You have already subscribed to that folder!"]); + else { + var li = document.createElement("li"); + $("contactFolders").appendChild(li); + li.setAttribute("id", folder); + li.appendChild(document.createTextNode(name)); + setEventsOnContactFolder(li); + } } function newFolderCallback(http) { diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js index ad7d5e8b0..199a1a87c 100644 --- a/UI/WebServerResources/SchedulerUI.js +++ b/UI/WebServerResources/SchedulerUI.js @@ -1374,55 +1374,58 @@ function appendCalendar(folderName, folder) { // log ("append: " + folderName + "; folder: " + folder); - var calendarList = $("calendarList"); - var lis = calendarList.childNodesWithTag("li"); - var color = indexColor(lis.length + 100); - //log ("color: " + color); + if ($(folder)) + window.alert(clabels["You have already subscribed to that folder!"]); + else { + var calendarList = $("calendarList"); + var lis = calendarList.childNodesWithTag("li"); + var color = indexColor(lis.length + 100); + //log ("color: " + color); - var li = document.createElement("li"); - calendarList.appendChild(li); + var li = document.createElement("li"); + calendarList.appendChild(li); - var checkBox = document.createElement("input"); - checkBox.setAttribute("type", "checkbox"); - li.appendChild(checkBox); - - li.appendChild(document.createTextNode(" ")); + var checkBox = document.createElement("input"); + checkBox.setAttribute("type", "checkbox"); + li.appendChild(checkBox); + li.appendChild(document.createTextNode(" ")); - var colorBox = document.createElement("div"); - li.appendChild(colorBox); - li.appendChild(document.createTextNode(" " + folderName)); - colorBox.appendChild(document.createTextNode("OO")); + var colorBox = document.createElement("div"); + li.appendChild(colorBox); + li.appendChild(document.createTextNode(" " + folderName)); + colorBox.appendChild(document.createTextNode("OO")); - li.setAttribute("id", folder); - Event.observe(li, "mousedown", listRowMouseDownHandler); - Event.observe(li, "click", onRowClick); - $(checkBox).addClassName("checkBox"); + li.setAttribute("id", folder); + Event.observe(li, "mousedown", listRowMouseDownHandler); + Event.observe(li, "click", onRowClick); + $(checkBox).addClassName("checkBox"); - Event.observe(checkBox, "click", - updateCalendarStatus.bindAsEventListener(checkBox)); + Event.observe(checkBox, "click", + updateCalendarStatus.bindAsEventListener(checkBox)); - $(colorBox).addClassName("colorBox"); - if (color) - $(colorBox).setStyle({color: color, - backgroundColor: color}); + $(colorBox).addClassName("colorBox"); + if (color) + $(colorBox).setStyle({color: color, + backgroundColor: color}); - var url = URLForFolderID(folder) + "/canAccessContent"; - triggerAjaxRequest(url, calendarEntryCallback, folder); - - if (!document.styleSheets) return; - var theRules = new Array(); - var lastSheet = document.styleSheets[document.styleSheets.length - 1]; - if (lastSheet.insertRule) { // Mozilla - lastSheet.insertRule('.calendarFolder' + folder.substr(1) + ' {' - + ' background-color: ' - + color - + ' !important; }', 0); - } - else { // IE - lastSheet.addRule('.calendarFolder' + folder.substr(1), - ' background-color: ' - + color - + ' !important; }'); + var url = URLForFolderID(folder) + "/canAccessContent"; + triggerAjaxRequest(url, calendarEntryCallback, folder); + + if (!document.styleSheets) return; + var theRules = new Array(); + var lastSheet = document.styleSheets[document.styleSheets.length - 1]; + if (lastSheet.insertRule) { // Mozilla + lastSheet.insertRule('.calendarFolder' + folder.substr(1) + ' {' + + ' background-color: ' + + color + + ' !important; }', 0); + } + else { // IE + lastSheet.addRule('.calendarFolder' + folder.substr(1), + ' background-color: ' + + color + + ' !important; }'); + } } }