mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-13 07:25:26 +00:00
merge of '7659385c293a64fbec59fda5d5bf34bcd7b51d96'
and 'f8b29d68c36441f92d7ffe8056a95fd25a2fd409' Monotone-Parent: 7659385c293a64fbec59fda5d5bf34bcd7b51d96 Monotone-Parent: f8b29d68c36441f92d7ffe8056a95fd25a2fd409 Monotone-Revision: 7822887b219614cd66e9d1e19da4799f884657bf Monotone-Author: dgehl@inverse.ca Monotone-Date: 2007-10-18T01:44:28 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -30,16 +30,17 @@ DIV#rightPanel
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* top list */
|
||||
DIV#contactsListContent
|
||||
{ position: absolute;
|
||||
background: #fff;
|
||||
width: 100%;
|
||||
height: 16em;
|
||||
{ cursor: default;
|
||||
position: absolute;
|
||||
background-color: #fff;
|
||||
top: 2.5em;
|
||||
overflow: auto;
|
||||
overflow-x: hidden;
|
||||
left: 0px;
|
||||
}
|
||||
right: 0px;
|
||||
height: 16em;
|
||||
overflow: auto;
|
||||
overflow-x: hidden; }
|
||||
|
||||
.aptview_text
|
||||
{
|
||||
@@ -107,8 +108,7 @@ table.titletable td.titlecell SELECT
|
||||
}
|
||||
|
||||
DIV#contactFoldersList
|
||||
{
|
||||
position: absolute;
|
||||
{ position: absolute;
|
||||
top: 6em;
|
||||
left: 0px;
|
||||
width: 15em;
|
||||
@@ -129,8 +129,11 @@ UL#contactFolders
|
||||
list-style-image: none;
|
||||
clear: both;
|
||||
cursor: default;
|
||||
color: #000;
|
||||
color: #000;
|
||||
background: #fff;
|
||||
position: absolute; /* required for Safari & IE */
|
||||
top: 53px; /* leave space for the mini addressbook */
|
||||
bottom: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0px;
|
||||
@@ -140,8 +143,7 @@ UL#contactFolders
|
||||
border-right: 1px solid #fff;
|
||||
border-bottom: 1px solid #fff;
|
||||
-moz-border-top-colors: #9c9a94 #000;
|
||||
-moz-border-left-colors: #9c9a94 #000;
|
||||
overflow: auto; }
|
||||
-moz-border-left-colors: #9c9a94 #000; }
|
||||
|
||||
DIV#contactFoldersList LI
|
||||
{
|
||||
@@ -167,21 +169,15 @@ DIV#folderTreeContent TABLE TD
|
||||
padding: 0px; }
|
||||
|
||||
TABLE#contactsList
|
||||
{
|
||||
display: block;
|
||||
position: relative;
|
||||
color: #000;
|
||||
background: #fff;
|
||||
width: 100%;
|
||||
}
|
||||
{ width: 100%; }
|
||||
|
||||
TABLE#contactsList TD
|
||||
{ white-space: nowrap;
|
||||
width: 20%; }
|
||||
TABLE#contactsList TD,
|
||||
TABLE#contactsList TH
|
||||
{ overflow: hidden;
|
||||
white-space: nowrap; } /* pre, normal, nowrap */
|
||||
|
||||
TD#nameHeader,
|
||||
TD#mailHeader
|
||||
{ width: 30%; }
|
||||
TABLE#contactsList TH
|
||||
{ white-space: pre; }
|
||||
|
||||
TABLE#contactsList TD IMG
|
||||
{
|
||||
@@ -217,7 +213,8 @@ DIV#contactView A
|
||||
|
||||
DIV#contactView H3.contactCardTitle
|
||||
{ display: block;
|
||||
margin: .2em 0px;
|
||||
margin: 0px;
|
||||
padding: .2em 0px;
|
||||
font-size: large;
|
||||
font-weight: bold;
|
||||
width: 100%;
|
||||
|
||||
@@ -18,8 +18,8 @@ function validateEditorInput(sender) {
|
||||
errortext = errortext + labels.error_missingrecipients + "\n";
|
||||
|
||||
if (errortext.length > 0) {
|
||||
alert(labels.error_validationfailed.decodeEntities() + ":\n"
|
||||
+ errortext.decodeEntities());
|
||||
alert(labels.error_validationfailed + ":\n"
|
||||
+ errortext);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -35,7 +35,7 @@ function openContactsFolder(contactsFolder, reload, idx) {
|
||||
var searchValue = search["value"];
|
||||
if (searchValue && searchValue.length > 0)
|
||||
url += ("&search=" + search["criteria"]
|
||||
+ "&value=" + escape(searchValue));
|
||||
+ "&value=" + escape(searchValue.utf8encode()));
|
||||
var sortAttribute = sorting["attribute"];
|
||||
if (sortAttribute && sortAttribute.length > 0)
|
||||
url += ("&sort=" + sorting["attribute"]
|
||||
@@ -46,8 +46,8 @@ function openContactsFolder(contactsFolder, reload, idx) {
|
||||
var contactsList = $("contactsList");
|
||||
if (contactsList)
|
||||
selection = contactsList.getSelectedRowsId();
|
||||
else
|
||||
window.alert("no contactsList");
|
||||
// else
|
||||
// window.alert("no contactsList");
|
||||
}
|
||||
else
|
||||
selection = null;
|
||||
@@ -73,43 +73,51 @@ function openContactsFolderAtIndex(element) {
|
||||
= triggerAjaxRequest(url, contactsListCallback);
|
||||
}
|
||||
|
||||
function configureContactsListHeaders(cells) {
|
||||
for (var i = 0; i < cells.length; i++) {
|
||||
var currentCell = $(cells[i]);
|
||||
Event.observe(currentCell, "click",
|
||||
onHeaderClick.bindAsEventListener(currentCell));
|
||||
Event.observe(currentCell, "mousedown", listRowMouseDownHandler);
|
||||
}
|
||||
}
|
||||
|
||||
function contactsListCallback(http) {
|
||||
var div = $("contactsListContent");
|
||||
|
||||
if (http.readyState == 4
|
||||
&& http.status == 200) {
|
||||
document.contactsListAjaxRequest = null;
|
||||
div.innerHTML = http.responseText;
|
||||
|
||||
var table = $("contactsList");
|
||||
if (table)
|
||||
configureContactsListHeaders(table.tBodies[0].rows[0].cells);
|
||||
|
||||
if (table) {
|
||||
// Update table
|
||||
var data = http.responseText;
|
||||
var html = data.replace(/^(.*\n)*.*(<table(.*\n)*)$/, "$2");
|
||||
var tbody = table.tBodies[0];
|
||||
var tmp = document.createElement('div');
|
||||
$(tmp).update(html);
|
||||
table.replaceChild(tmp.firstChild.tBodies[0], tbody);
|
||||
}
|
||||
else {
|
||||
// Add table (doesn't happen .. yet)
|
||||
var div = $("contactsListContent");
|
||||
div.update(http.responseText);
|
||||
table = $("contactsList");
|
||||
configureSortableTableHeaders(table);
|
||||
TableKit.Resizable.init(table, {'trueResize' : true, 'keepWidth' : true});
|
||||
}
|
||||
|
||||
if (sorting["attribute"] && sorting["attribute"].length > 0) {
|
||||
var sortHeader;
|
||||
if (sorting["attribute"] == "cn")
|
||||
if (sorting["attribute"] == "displayName")
|
||||
sortHeader = $("nameHeader");
|
||||
else if (sorting["attribute"] == "mail")
|
||||
sortHeader = $("mailHeader");
|
||||
else if (sorting["attribute"] == "screenname")
|
||||
else if (sorting["attribute"] == "screenName")
|
||||
sortHeader = $("screenNameHeader");
|
||||
else if (sorting["attribute"] == "o")
|
||||
else if (sorting["attribute"] == "org")
|
||||
sortHeader = $("orgHeader");
|
||||
else if (sorting["attribute"] == "telephonenumber")
|
||||
else if (sorting["attribute"] == "phone")
|
||||
sortHeader = $("phoneHeader");
|
||||
else
|
||||
sortHeader = null;
|
||||
|
||||
if (sortHeader) {
|
||||
var sortImages = $(table.tHead).getElementsByClassName("sortImage");
|
||||
$(sortImages).each(function(item) {
|
||||
item.remove();
|
||||
});
|
||||
|
||||
var sortImage = createElement("img", "messageSortImage", "sortImage");
|
||||
sortHeader.insertBefore(sortImage, sortHeader.firstChild);
|
||||
if (sorting["ascending"])
|
||||
@@ -147,11 +155,10 @@ function onContactFoldersContextMenu(event) {
|
||||
$(this).select();
|
||||
}
|
||||
|
||||
function onContactContextMenu(event, element) {
|
||||
function onContactContextMenu(event, element) { log ("onContactContextMenu");
|
||||
var menu = $("contactMenu");
|
||||
//Event.observe(menu, "hideMenu", onContactContextMenuHide, false);
|
||||
|
||||
Event.observe(menu, "mousedown", onContactContextMenuHide, false);
|
||||
//document.documentElement.onclick = onContactContextMenuHide;
|
||||
popupMenu(event, "contactMenu", element);
|
||||
|
||||
var topNode = $("contactsList");
|
||||
@@ -290,9 +297,19 @@ function onMenuEditContact(event) {
|
||||
|
||||
function onMenuWriteToContact(event) {
|
||||
var contactId = document.menuTarget.getAttribute('id');
|
||||
var contactRow = $(contactId);
|
||||
var emailCell = contactRow.down('td', 1);
|
||||
|
||||
if (!emailCell.firstChild) { // .nodeValue is the contact email address
|
||||
window.alert(labels["The selected contact has no email address."].decodeEntities());
|
||||
return false;
|
||||
}
|
||||
|
||||
openMailComposeWindow(ApplicationBaseURL + currentContactFolder
|
||||
+ "/" + contactId + "/write");
|
||||
|
||||
if (document.body.hasClassName("popup"))
|
||||
window.close();
|
||||
}
|
||||
|
||||
function onMenuDeleteContact(event) {
|
||||
@@ -314,10 +331,22 @@ function onToolbarEditSelectedContacts(event) {
|
||||
function onToolbarWriteToSelectedContacts(event) {
|
||||
var contactsList = $('contactsList');
|
||||
var rows = contactsList.getSelectedRowsId();
|
||||
var rowsWithEmail = 0;
|
||||
|
||||
for (var i = 0; i < rows.length; i++)
|
||||
openMailComposeWindow(ApplicationBaseURL + currentContactFolder
|
||||
+ "/" + rows[i] + "/write");
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var emailCell = $(rows[i]).down('td', 1);
|
||||
if (emailCell.firstChild) { // .nodeValue is the contact email address
|
||||
rowsWithEmail++;
|
||||
openMailComposeWindow(ApplicationBaseURL + currentContactFolder
|
||||
+ "/" + rows[i] + "/write");
|
||||
}
|
||||
}
|
||||
|
||||
if (rowsWithEmail == 0) {
|
||||
window.alert(labels["The selected contact has no email address."].decodeEntities());
|
||||
}
|
||||
else if (document.body.hasClassName("popup"))
|
||||
window.close();
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -373,17 +402,15 @@ function onHeaderClick(event) {
|
||||
var headerId = this.getAttribute("id");
|
||||
var newSortAttribute;
|
||||
if (headerId == "nameHeader")
|
||||
newSortAttribute = "cn";
|
||||
newSortAttribute = "displayName";
|
||||
else if (headerId == "mailHeader")
|
||||
newSortAttribute = "mail";
|
||||
else if (headerId == "screenNameHeader")
|
||||
newSortAttribute = "screenname";
|
||||
newSortAttribute = "screenName";
|
||||
else if (headerId == "orgHeader")
|
||||
newSortAttribute = "o";
|
||||
newSortAttribute = "org";
|
||||
else if (headerId == "phoneHeader")
|
||||
newSortAttribute = "telephonenumber";
|
||||
|
||||
log("header: " + headerId);
|
||||
newSortAttribute = "phone";
|
||||
|
||||
if (sorting["attribute"] == newSortAttribute)
|
||||
sorting["ascending"] = !sorting["ascending"];
|
||||
@@ -394,7 +421,7 @@ function onHeaderClick(event) {
|
||||
|
||||
refreshCurrentFolder();
|
||||
|
||||
preventDefault(event);
|
||||
Event.stop(event);
|
||||
}
|
||||
|
||||
function newContact(sender) {
|
||||
@@ -410,7 +437,7 @@ function onFolderSelectionChange() {
|
||||
|
||||
if (nodes[0].hasClassName("denied")) {
|
||||
var div = $("contactsListContent");
|
||||
div.innerHTML = "";
|
||||
div.update();
|
||||
}
|
||||
else {
|
||||
search = {};
|
||||
@@ -470,28 +497,28 @@ function refreshContacts(contactId) {
|
||||
}
|
||||
|
||||
function onAddressBookNew(event) {
|
||||
var name = window.prompt(labels["Name of the Address Book"].decodeEntities());
|
||||
if (name) {
|
||||
if (document.newAbAjaxRequest) {
|
||||
document.newAbAjaxRequest.aborted = true;
|
||||
document.newAbAjaxRequest.abort();
|
||||
}
|
||||
var url = ApplicationBaseURL + "/newAb?name=" + name;
|
||||
document.newAbAjaxRequest
|
||||
= triggerAjaxRequest(url, newAbCallback, name);
|
||||
}
|
||||
createFolder(window.prompt(labels["Name of the Address Book"]),
|
||||
appendAddressBook);
|
||||
preventDefault(event);
|
||||
}
|
||||
|
||||
function appendAddressBook(name, folder) {
|
||||
var li = document.createElement("li");
|
||||
$("contactFolders").appendChild(li);
|
||||
li.setAttribute("id", folder);
|
||||
li.appendChild(document.createTextNode(name));
|
||||
setEventsOnContactFolder(li);
|
||||
if (folder)
|
||||
folder = accessToSubscribedFolder(folder);
|
||||
else
|
||||
folder = "/" + name;
|
||||
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 newAbCallback(http) {
|
||||
function newFolderCallback(http) {
|
||||
if (http.readyState == 4
|
||||
&& http.status == 201) {
|
||||
var name = http.callbackData;
|
||||
@@ -525,60 +552,60 @@ function onAddressBookRemove(event) {
|
||||
var selector = $("contactFolders");
|
||||
var nodes = selector.getSelectedNodes();
|
||||
if (nodes.length > 0) {
|
||||
nodes[0].deselect();
|
||||
var folderId = nodes[0].getAttribute("id");
|
||||
var folderIdElements = folderId.split(":");
|
||||
if (folderIdElements.length > 1)
|
||||
unsubscribeFromFolder(folderId, onFolderUnsubscribeCB, folderId);
|
||||
else {
|
||||
var abId = folderIdElements[0].substr(1);
|
||||
deletePersonalAddressBook(abId);
|
||||
var personal = $("/personal");
|
||||
personal.select();
|
||||
onFolderSelectionChange();
|
||||
}
|
||||
nodes[0].deselect();
|
||||
var folderId = nodes[0].getAttribute("id");
|
||||
var folderIdElements = folderId.split("_");
|
||||
if (folderIdElements.length > 1)
|
||||
unsubscribeFromFolder(folderId, onFolderUnsubscribeCB, folderId);
|
||||
else {
|
||||
var abId = folderIdElements[0].substr(1);
|
||||
deletePersonalAddressBook(abId);
|
||||
var personal = $("/personal");
|
||||
personal.select();
|
||||
onFolderSelectionChange();
|
||||
}
|
||||
}
|
||||
|
||||
preventDefault(event);
|
||||
}
|
||||
|
||||
function deletePersonalAddressBook(folderId) {
|
||||
var label
|
||||
= labels["Are you sure you want to delete the selected address book?"];
|
||||
if (window.confirm(label.decodeEntities())) {
|
||||
if (document.deletePersonalABAjaxRequest) {
|
||||
document.deletePersonalABAjaxRequest.aborted = true;
|
||||
document.deletePersonalABAjaxRequest.abort();
|
||||
}
|
||||
var url = ApplicationBaseURL + "/" + folderId + "/delete";
|
||||
document.deletePersonalABAjaxRequest
|
||||
= triggerAjaxRequest(url, deletePersonalAddressBookCallback,
|
||||
folderId);
|
||||
}
|
||||
var label
|
||||
= labels["Are you sure you want to delete the selected address book?"];
|
||||
if (window.confirm(label)) {
|
||||
if (document.deletePersonalABAjaxRequest) {
|
||||
document.deletePersonalABAjaxRequest.aborted = true;
|
||||
document.deletePersonalABAjaxRequest.abort();
|
||||
}
|
||||
var url = ApplicationBaseURL + "/" + folderId + "/deleteFolder";
|
||||
document.deletePersonalABAjaxRequest
|
||||
= triggerAjaxRequest(url, deletePersonalAddressBookCallback,
|
||||
folderId);
|
||||
}
|
||||
}
|
||||
|
||||
function deletePersonalAddressBookCallback(http) {
|
||||
if (http.readyState == 4) {
|
||||
if (http.status == 200) {
|
||||
var ul = $("contactFolders");
|
||||
if (isHttpStatus204(http.status)) {
|
||||
var ul = $("contactFolders");
|
||||
|
||||
var children = ul.childNodesWithTag("li");
|
||||
var i = 0;
|
||||
var done = false;
|
||||
while (!done && i < children.length) {
|
||||
var currentFolderId = children[i].getAttribute("id").substr(1);
|
||||
if (currentFolderId == http.callbackData) {
|
||||
ul.removeChild(children[i]);
|
||||
done = true;
|
||||
}
|
||||
else
|
||||
i++;
|
||||
var children = ul.childNodesWithTag("li");
|
||||
var i = 0;
|
||||
var done = false;
|
||||
while (!done && i < children.length) {
|
||||
var currentFolderId = children[i].getAttribute("id").substr(1);
|
||||
if (currentFolderId == http.callbackData) {
|
||||
ul.removeChild(children[i]);
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
document.deletePersonalABAjaxRequest = null;
|
||||
else
|
||||
i++;
|
||||
}
|
||||
}
|
||||
document.deletePersonalABAjaxRequest = null;
|
||||
}
|
||||
else
|
||||
log ("ajax problem 5: " + http.status);
|
||||
log ("ajax problem 5: " + http.status);
|
||||
}
|
||||
|
||||
function configureDragHandles() {
|
||||
@@ -587,6 +614,7 @@ function configureDragHandles() {
|
||||
handle.addInterface(SOGoDragHandlesInterface);
|
||||
handle.leftBlock=$("contactFoldersList");
|
||||
handle.rightBlock=$("rightPanel");
|
||||
handle.leftMargin = 100;
|
||||
}
|
||||
|
||||
handle = $("rightDragHandle");
|
||||
@@ -602,7 +630,6 @@ function lookupDeniedFolders() {
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
var folderID = list[i].getAttribute("id");
|
||||
var url = URLForFolderID(folderID) + "/canAccessContent";
|
||||
|
||||
triggerAjaxRequest(url, deniedFoldersLookupCallback, folderID);
|
||||
}
|
||||
}
|
||||
@@ -650,18 +677,52 @@ function setEventsOnContactFolder(node) {
|
||||
onContactFoldersContextMenu.bindAsEventListener(node), false);
|
||||
}
|
||||
|
||||
function onMenuModify(event) {
|
||||
var folders = $("contactFolders");
|
||||
var selected = folders.getSelectedNodes()[0];
|
||||
|
||||
if (UserLogin == selected.getAttribute("owner")) {
|
||||
var currentName = selected.innerHTML;
|
||||
var newName = window.prompt(labels["Address Book Name"],
|
||||
currentName);
|
||||
if (newName && newName.length > 0
|
||||
&& newName != currentName) {
|
||||
var url = (URLForFolderID(selected.getAttribute("id"))
|
||||
+ "/renameFolder?name=" + escape(newName.utf8encode()));
|
||||
triggerAjaxRequest(url, folderRenameCallback,
|
||||
{node: selected, name: newName});
|
||||
}
|
||||
} else
|
||||
window.alert(clabels["Unable to rename that folder!"]);
|
||||
}
|
||||
|
||||
function folderRenameCallback(http) {
|
||||
if (http.readyState == 4) {
|
||||
if (isHttpStatus204(http.status)) {
|
||||
var dict = http.callbackData;
|
||||
dict["node"].innerHTML = dict["name"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onMenuSharing(event) {
|
||||
var folders = $("contactFolders");
|
||||
var selected = folders.getSelectedNodes()[0];
|
||||
var title = this.innerHTML;
|
||||
var url = URLForFolderID(selected.getAttribute("id"));
|
||||
var owner = selected.getAttribute("owner");
|
||||
if (owner == "nobody")
|
||||
window.alert(clabels["The user rights cannot be"
|
||||
+ " edited for this object!"]);
|
||||
else {
|
||||
var title = this.innerHTML;
|
||||
var url = URLForFolderID(selected.getAttribute("id"));
|
||||
|
||||
openAclWindow(url + "/acls", title);
|
||||
openAclWindow(url + "/acls", title);
|
||||
}
|
||||
}
|
||||
|
||||
function getMenus() {
|
||||
var menus = {};
|
||||
menus["contactFoldersMenu"] = new Array(null, "-", null,
|
||||
menus["contactFoldersMenu"] = new Array(onMenuModify, "-", null,
|
||||
null, "-", null, "-",
|
||||
onMenuSharing);
|
||||
menus["contactMenu"] = new Array(onMenuEditContact, "-",
|
||||
@@ -690,6 +751,13 @@ function initContacts(event) {
|
||||
configureSelectionButtons();
|
||||
configureContactFolders();
|
||||
// initDnd();
|
||||
|
||||
var table = $("contactsList");
|
||||
if (table) {
|
||||
// Initialize contacts table
|
||||
configureSortableTableHeaders(table);
|
||||
TableKit.Resizable.init(table, {'trueResize' : true, 'keepWidth' : true});
|
||||
}
|
||||
}
|
||||
|
||||
addEvent(window, 'load', initContacts);
|
||||
|
||||
@@ -156,6 +156,31 @@ Element.addMethods({
|
||||
element.addClassName('_selected');
|
||||
},
|
||||
|
||||
selectRange: function(element, startIndex, endIndex) {
|
||||
element = $(element);
|
||||
var s;
|
||||
var e;
|
||||
var rows;
|
||||
|
||||
if (startIndex > endIndex) {
|
||||
s = endIndex;
|
||||
e = startIndex;
|
||||
}
|
||||
else {
|
||||
s = startIndex;
|
||||
e = endIndex;
|
||||
}
|
||||
if (element.tagName == 'UL')
|
||||
rows = element.getElementsByTagName('LI');
|
||||
else
|
||||
rows = element.getElementsByTagName('TR');
|
||||
while (s <= e) {
|
||||
if (rows[s].nodeType == 1)
|
||||
$(rows[s]).select();
|
||||
s++;
|
||||
}
|
||||
},
|
||||
|
||||
deselect: function(element) {
|
||||
element = $(element);
|
||||
element.removeClassName('_selected');
|
||||
|
||||
@@ -35,4 +35,5 @@ Element.addMethods({
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}); // Element.addMethods
|
||||
|
||||
@@ -82,8 +82,14 @@ Date.prototype.sogoDayName = function() {
|
||||
Date.prototype.daysUpTo = function(otherDate) {
|
||||
var days = new Array();
|
||||
|
||||
var day1 = this.getTime();
|
||||
var day2 = otherDate.getTime();
|
||||
var day1Date = new Date();
|
||||
day1Date.setTime(this.getTime());
|
||||
day1Date.setHours(0, 0, 0, 0);
|
||||
var day2Date = new Date();
|
||||
day2Date.setTime(otherDate.getTime());
|
||||
day2Date.setHours(23, 59, 59, 999);
|
||||
var day1 = day1Date.getTime();
|
||||
var day2 = day2Date.getTime();
|
||||
|
||||
var nbrDays = Math.floor((day2 - day1) / 86400000) + 1;
|
||||
for (var i = 0; i < nbrDays; i++) {
|
||||
@@ -119,11 +125,11 @@ Date.prototype.getHourString = function() {
|
||||
}
|
||||
|
||||
Date.prototype.getDisplayHoursString = function() {
|
||||
var hoursString = "" + this.getHours();
|
||||
var hoursString = "" + this.getUTCHours();
|
||||
if (hoursString.length == 1)
|
||||
hoursString = '0' + hoursString;
|
||||
|
||||
var minutesString = "" + this.getMinutes();
|
||||
var minutesString = "" + this.getUTCMinutes();
|
||||
if (minutesString.length == 1)
|
||||
minutesString = '0' + minutesString;
|
||||
|
||||
@@ -222,3 +228,126 @@ Date.prototype.endOfWeek = function() {
|
||||
|
||||
return endOfWeek;
|
||||
}
|
||||
|
||||
String.prototype._base64_keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
||||
String.prototype.base64encode = function () {
|
||||
var output = "";
|
||||
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
||||
var i = 0;
|
||||
|
||||
var input = this.utf8encode();
|
||||
|
||||
while (i < input.length) {
|
||||
chr1 = input.charCodeAt(i++);
|
||||
chr2 = input.charCodeAt(i++);
|
||||
chr3 = input.charCodeAt(i++);
|
||||
|
||||
enc1 = chr1 >> 2;
|
||||
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
||||
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
||||
enc4 = chr3 & 63;
|
||||
|
||||
if (isNaN(chr2)) {
|
||||
enc3 = enc4 = 64;
|
||||
} else if (isNaN(chr3)) {
|
||||
enc4 = 64;
|
||||
}
|
||||
|
||||
output = output +
|
||||
this._base64_keyStr.charAt(enc1) + this._base64_keyStr.charAt(enc2) +
|
||||
this._base64_keyStr.charAt(enc3) + this._base64_keyStr.charAt(enc4);
|
||||
}
|
||||
|
||||
return output;
|
||||
};
|
||||
|
||||
String.prototype.base64decode = function() {
|
||||
var output = "";
|
||||
var chr1, chr2, chr3;
|
||||
var enc1, enc2, enc3, enc4;
|
||||
var i = 0;
|
||||
|
||||
var input = this.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
||||
|
||||
while (i < input.length) {
|
||||
enc1 = this._base64_keyStr.indexOf(input.charAt(i++));
|
||||
enc2 = this._base64_keyStr.indexOf(input.charAt(i++));
|
||||
enc3 = this._base64_keyStr.indexOf(input.charAt(i++));
|
||||
enc4 = this._base64_keyStr.indexOf(input.charAt(i++));
|
||||
|
||||
chr1 = (enc1 << 2) | (enc2 >> 4);
|
||||
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
||||
chr3 = ((enc3 & 3) << 6) | enc4;
|
||||
|
||||
output = output + String.fromCharCode(chr1);
|
||||
|
||||
if (enc3 != 64) {
|
||||
output = output + String.fromCharCode(chr2);
|
||||
}
|
||||
if (enc4 != 64) {
|
||||
output = output + String.fromCharCode(chr3);
|
||||
}
|
||||
}
|
||||
|
||||
return output.utf8decode();
|
||||
};
|
||||
|
||||
String.prototype.utf8encode = function() {
|
||||
var string = this.replace(/\r\n/g,"\n");
|
||||
var utftext = "";
|
||||
|
||||
for (var n = 0; n < this.length; n++) {
|
||||
var c = this.charCodeAt(n);
|
||||
|
||||
if (c < 128) {
|
||||
utftext += String.fromCharCode(c);
|
||||
}
|
||||
else if((c > 127) && (c < 2048)) {
|
||||
utftext += String.fromCharCode((c >> 6) | 192);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
}
|
||||
else {
|
||||
utftext += String.fromCharCode((c >> 12) | 224);
|
||||
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
}
|
||||
}
|
||||
|
||||
return utftext;
|
||||
};
|
||||
|
||||
String.prototype.utf8decode = function() {
|
||||
var string = "";
|
||||
var i = 0;
|
||||
var c = c1 = c2 = 0;
|
||||
|
||||
while (i < string.length) {
|
||||
c = utftext.charCodeAt(i);
|
||||
|
||||
if (c < 128) {
|
||||
string += String.fromCharCode(c);
|
||||
i++;
|
||||
}
|
||||
else if((c > 191) && (c < 224)) {
|
||||
c2 = this.charCodeAt(i+1);
|
||||
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
|
||||
i += 2;
|
||||
}
|
||||
else {
|
||||
c2 = this.charCodeAt(i+1);
|
||||
c3 = this.charCodeAt(i+2);
|
||||
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
|
||||
i += 3;
|
||||
}
|
||||
}
|
||||
|
||||
return string;
|
||||
};
|
||||
|
||||
String.prototype.cssSafeString = function() {
|
||||
var newString = this.replace("#", "_", "g");
|
||||
newString = newString.replace(".", "_", "g");
|
||||
newString = newString.replace("@", "_", "g");
|
||||
|
||||
return newString;
|
||||
}
|
||||
|
||||
@@ -24,14 +24,7 @@ var MailerUIdTreeExtension = {
|
||||
},
|
||||
_addFolder: function (parent, folder) {
|
||||
var thisCounter = this.elementCounter;
|
||||
var fullName = "";
|
||||
var currentFolder = folder;
|
||||
while (currentFolder.parentFolder) {
|
||||
fullName = "/folder" + currentFolder.name + fullName;
|
||||
currentFolder = currentFolder.parentFolder;
|
||||
}
|
||||
fullName = "/" + currentFolder.name + fullName;
|
||||
this._addFolderNode(parent, folder.name, fullName, folder.type);
|
||||
this._addFolderNode(parent, folder.name, folder.fullName(), folder.type);
|
||||
for (var i = 0; i < folder.children.length; i++)
|
||||
this._addFolder(thisCounter, folder.children[i]);
|
||||
},
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with OGo; see the file COPYING. If not, write to the
|
||||
License along with OGo; see the file COPYING. If not, write toge the
|
||||
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA.
|
||||
*/
|
||||
@@ -33,8 +33,7 @@ DIV#leftPanel
|
||||
}
|
||||
|
||||
DIV#rightPanel
|
||||
{
|
||||
position: absolute;
|
||||
{ position: absolute;
|
||||
top: 5.5em;
|
||||
left: 15em;
|
||||
right: 0px;
|
||||
@@ -42,17 +41,19 @@ DIV#rightPanel
|
||||
margin: 0px;
|
||||
margin-left: 5px;
|
||||
padding: 0px;
|
||||
overflow: hidden;
|
||||
}
|
||||
overflow: hidden; }
|
||||
|
||||
/* top list */
|
||||
DIV#mailboxContent
|
||||
{ background-color: #fff;
|
||||
{ cursor: default;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 15.5em;
|
||||
left: 0px;
|
||||
background-color: #fff;
|
||||
top: 2.5em;
|
||||
right: 0px; }
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
height: 15.5em;
|
||||
overflow: auto;
|
||||
overflow-x: hidden; }
|
||||
|
||||
DIV#messageContent
|
||||
{ position: absolute;
|
||||
@@ -309,8 +310,7 @@ INPUT#editDraftButton
|
||||
}
|
||||
|
||||
TABLE.mailer_fieldtable
|
||||
{
|
||||
top: 0px;
|
||||
{ top: 0px;
|
||||
left: 0px;
|
||||
padding-top: .5em;
|
||||
padding-bottom: .5em;
|
||||
@@ -318,7 +318,7 @@ TABLE.mailer_fieldtable
|
||||
overflow-x: hidden;
|
||||
border-bottom: 1px solid #808080;
|
||||
background: #d4d0c8;
|
||||
}
|
||||
width: 100%; }
|
||||
|
||||
DIV.mailer_mailcontent
|
||||
{
|
||||
@@ -364,9 +364,10 @@ img.mailer_imagecontent
|
||||
}
|
||||
|
||||
DIV.mailer_plaincontent
|
||||
{
|
||||
{
|
||||
position: relative;
|
||||
font-family: monospace, fixed;
|
||||
white-space: normal;
|
||||
white-space: pre;
|
||||
font-size: inherit;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
@@ -383,7 +384,7 @@ DIV.mailer_plaincontent P
|
||||
DIV.mailer_htmlcontent P
|
||||
{
|
||||
white-space: normal;
|
||||
font-family: serif;
|
||||
font-family: sans-serif;
|
||||
font-size: inherit;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
@@ -474,52 +475,39 @@ TABLE#addr_table
|
||||
}
|
||||
|
||||
TABLE#messageList
|
||||
{ cursor: default;
|
||||
display: block;
|
||||
position: absolute;
|
||||
background-color: #fff;
|
||||
color: #000;
|
||||
width: 100%;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
top: 3.25em;
|
||||
bottom: 1px;
|
||||
overflow: auto;
|
||||
overflow-x: hidden; }
|
||||
{ width: 100%; }
|
||||
|
||||
TABLE#messageList THEAD
|
||||
{ position: fixed;
|
||||
margin-top: 1px;
|
||||
top: 7.5em;
|
||||
right: 0px;
|
||||
left: 15.5em;
|
||||
height: 2em; }
|
||||
TABLE#messageList TD,
|
||||
TABLE#messageList TH
|
||||
{ height: 1.2em;
|
||||
overflow: hidden;
|
||||
white-space: nowrap; }
|
||||
|
||||
TABLE#messageList TD
|
||||
{ height: 1.2em; }
|
||||
TABLE#messageList TH
|
||||
{ white-space: pre; }
|
||||
|
||||
TD#messageFlagHeader,
|
||||
TABLE#messageList TD.messageFlagColumn
|
||||
{ width: 1em;
|
||||
{ width: 22px;
|
||||
text-align: center; }
|
||||
|
||||
TD#subjectHeader,
|
||||
TABLE#messageList TD.tbtv_subject_headercell,
|
||||
TABLE#messageList TD.mailer_unreadmailsubject,
|
||||
TABLE#messageList TD.mailer_readmailsubject
|
||||
{ width: 40%;
|
||||
{ /*width: 40%;*/
|
||||
min-width: 40%; }
|
||||
|
||||
TD#fromHeader,
|
||||
TABLE#messageList TD.tbtv_from_headercell,
|
||||
TABLE#messageList TD.messageAddressColumn
|
||||
{ width: 35%;
|
||||
{ /*width: 35%;*/
|
||||
min-width: 35%;
|
||||
overflow: hidden; }
|
||||
|
||||
TD#dateHeader,
|
||||
TABLE#messageList TD.tbtv_date_headercell,
|
||||
TABLE#messageList TD.messageDateColumn
|
||||
{ width: 25%;
|
||||
TABLE#messageList TD.tbtv_date_headercell
|
||||
{ /*width: 25%;*/
|
||||
overflow: hidden; }
|
||||
|
||||
TABLE#messageList TR._selected TD
|
||||
|
||||
+210
-120
@@ -11,6 +11,8 @@ var currentMailboxType = "";
|
||||
var usersRightsWindowHeight = 320;
|
||||
var usersRightsWindowWidth = 400;
|
||||
|
||||
var pageContent;
|
||||
|
||||
/* mail list */
|
||||
|
||||
function openMessageWindow(msguid, url) {
|
||||
@@ -60,10 +62,14 @@ function openAddressbook(sender) {
|
||||
|
||||
function onMenuSharing(event) {
|
||||
var folderID = document.menuTarget.getAttribute("dataname");
|
||||
var urlstr = URLForFolderID(folderID) + "/acls";
|
||||
preventDefault(event);
|
||||
|
||||
openAclWindow(urlstr);
|
||||
var type = document.menuTarget.getAttribute("datatype");
|
||||
if (type == "additional")
|
||||
window.alert(clabels["The user rights cannot be"
|
||||
+ " edited for this object!"]);
|
||||
else {
|
||||
var urlstr = URLForFolderID(folderID) + "/acls";
|
||||
openAclWindow(urlstr);
|
||||
}
|
||||
}
|
||||
|
||||
/* mail list DOM changes */
|
||||
@@ -141,6 +147,8 @@ function openMessageWindowsForSelection(action, firstOnly) {
|
||||
ApplicationBaseURL + currentMailbox
|
||||
+ "/" + rows[i].substr(4)
|
||||
+ "/" + action);
|
||||
} else {
|
||||
window.alert(labels["Please select a message."]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,11 +157,11 @@ function openMessageWindowsForSelection(action, firstOnly) {
|
||||
|
||||
function mailListMarkMessage(event) {
|
||||
var http = createHTTPClient();
|
||||
var url = ApplicationBaseURL + currentMailbox + "/" + action + "?uid=" + msguid;
|
||||
var url = ApplicationBaseURL + currentMailbox + "/" + msguid + "/" + action;
|
||||
|
||||
if (http) {
|
||||
// TODO: add parameter to signal that we are only interested in OK
|
||||
http.open("POST", url + "&jsonly=1", false /* not async */);
|
||||
http.open("POST", url, false /* not async */);
|
||||
http.send("");
|
||||
if (http.status != 200) {
|
||||
// TODO: refresh page?
|
||||
@@ -190,31 +198,6 @@ function ml_lowlight(sender) {
|
||||
}
|
||||
|
||||
|
||||
/* folder operations */
|
||||
|
||||
function ctxFolderAdd(sender) {
|
||||
var folderName;
|
||||
|
||||
folderName = prompt("Foldername: ");
|
||||
if (folderName == undefined)
|
||||
return false;
|
||||
if (folderName == "")
|
||||
return false;
|
||||
|
||||
// TODO: should use a form-POST or AJAX
|
||||
window.location.href = "createFolder?name=" + escape(folderName);
|
||||
return false;
|
||||
}
|
||||
|
||||
function ctxFolderDelete(sender) {
|
||||
if (!confirm("Delete current folder?").decodeEntities())
|
||||
return false;
|
||||
|
||||
// TODO: should use a form-POST or AJAX
|
||||
window.location.href = "deleteFolder";
|
||||
return false;
|
||||
}
|
||||
|
||||
/* bulk delete of messages */
|
||||
|
||||
function uixDeleteSelectedMessages(sender) {
|
||||
@@ -229,11 +212,12 @@ function uixDeleteSelectedMessages(sender) {
|
||||
/* send AJAX request (synchronously) */
|
||||
|
||||
var messageId = currentMailbox + "/" + rowId;
|
||||
url = ApplicationBaseURL + messageId + "/trash?jsonly=1";
|
||||
url = ApplicationBaseURL + messageId + "/trash";
|
||||
http = createHTTPClient();
|
||||
http.open("POST", url, false /* not async */);
|
||||
http.url = url;
|
||||
http.send("");
|
||||
if (http.status != 200) { /* request failed */
|
||||
if (!isHttpStatus204(http.status)) { /* request failed */
|
||||
failCount++;
|
||||
http = null;
|
||||
continue;
|
||||
@@ -241,14 +225,13 @@ function uixDeleteSelectedMessages(sender) {
|
||||
deleteCachedMessage(messageId);
|
||||
if (currentMessages[currentMailbox] == rowId) {
|
||||
var div = $('messageContent');
|
||||
div.innerHTML = "";
|
||||
div.update();
|
||||
currentMessages[currentMailbox] = null;
|
||||
}
|
||||
}
|
||||
http = null;
|
||||
|
||||
|
||||
/* remove from page */
|
||||
|
||||
/* line-through would be nicer, but hiding is OK too */
|
||||
var row = $(rowIds[i]);
|
||||
row.parentNode.removeChild(row);
|
||||
@@ -270,7 +253,7 @@ function moveMessages(rowIds, folder) {
|
||||
|
||||
var messageId = currentMailbox + "/" + rowIds[i];
|
||||
url = (ApplicationBaseURL + messageId
|
||||
+ "/move?jsonly=1&tofolder=" + folder);
|
||||
+ "/move?tofolder=" + folder);
|
||||
http = createHTTPClient();
|
||||
http.open("GET", url, false /* not async */);
|
||||
http.send("");
|
||||
@@ -280,7 +263,7 @@ function moveMessages(rowIds, folder) {
|
||||
deleteCachedMessage(messageId);
|
||||
if (currentMessages[currentMailbox] == rowIds[i]) {
|
||||
var div = $('messageContent');
|
||||
div.innerHTML = "";
|
||||
div.update();
|
||||
currentMessages[currentMailbox] = null;
|
||||
}
|
||||
}
|
||||
@@ -306,10 +289,10 @@ function onMenuDeleteMessage(event) {
|
||||
function onPrintCurrentMessage(event) {
|
||||
var rowIds = $("messageList").getSelectedRowsId();
|
||||
if (rowIds.length == 0) {
|
||||
window.alert(labels["Please select a message to print."].decodeEntities());
|
||||
window.alert(labels["Please select a message to print."]);
|
||||
}
|
||||
else if (rowIds.length > 1) {
|
||||
window.alert(labels["Please select only one message to print."].decodeEntities());
|
||||
window.alert(labels["Please select only one message to print."]);
|
||||
}
|
||||
else
|
||||
window.print();
|
||||
@@ -334,23 +317,49 @@ function onMailboxTreeItemClick(event) {
|
||||
currentMailboxType = this.parentNode.getAttribute("datatype");
|
||||
if (currentMailboxType == "account" || currentMailboxType == "additional") {
|
||||
currentMailbox = mailbox;
|
||||
$("messageContent").innerHTML = "";
|
||||
var body = $("messageList").tBodies[0];
|
||||
$("messageContent").update();
|
||||
var table = $("messageList");
|
||||
var head = table.tHead;
|
||||
var body = table.tBodies[0];
|
||||
for (var i = body.rows.length; i > 0; i--)
|
||||
body.deleteRow(i-1);
|
||||
if (head.rows[1])
|
||||
head.rows[1].firstChild.update();
|
||||
}
|
||||
else
|
||||
openMailbox(mailbox);
|
||||
|
||||
preventDefault(event);
|
||||
Event.stop(event);
|
||||
}
|
||||
|
||||
function onMailboxMenuMove() {
|
||||
window.alert("unimplemented");
|
||||
function _onMailboxMenuAction(menuEntry, error, actionName) {
|
||||
var targetMailbox = menuEntry.mailbox.fullName();
|
||||
|
||||
if (targetMailbox == currentMailbox)
|
||||
window.alert(labels[error]);
|
||||
else {
|
||||
var message;
|
||||
if (document.menuTarget instanceof HTMLDivElement)
|
||||
message = currentMessages[currentMailbox];
|
||||
else
|
||||
message = document.menuTarget.getAttribute("id").substr(4);
|
||||
|
||||
var urlstr = (URLForFolderID(currentMailbox) + "/" + message
|
||||
+ "/" + actionName + "?folder=" + targetMailbox);
|
||||
triggerAjaxRequest(urlstr, folderRefreshCallback, currentMailbox);
|
||||
}
|
||||
}
|
||||
|
||||
function onMailboxMenuCopy() {
|
||||
window.alert("unimplemented");
|
||||
function onMailboxMenuMove(event) {
|
||||
_onMailboxMenuAction(this,
|
||||
"Moving a message into its own folder is impossible!",
|
||||
"move");
|
||||
}
|
||||
|
||||
function onMailboxMenuCopy(event) {
|
||||
_onMailboxMenuAction(this,
|
||||
"Copying a message into its own folder is impossible!",
|
||||
"copy");
|
||||
}
|
||||
|
||||
function refreshMailbox() {
|
||||
@@ -378,9 +387,10 @@ function composeNewMessage() {
|
||||
function openMailbox(mailbox, reload, idx) {
|
||||
if (mailbox != currentMailbox || reload) {
|
||||
currentMailbox = mailbox;
|
||||
var url = ApplicationBaseURL + mailbox + "/view?noframe=1";
|
||||
var url = ApplicationBaseURL + encodeURI(mailbox) + "/view?noframe=1";
|
||||
var messageContent = $("messageContent");
|
||||
messageContent.innerHTML = '';
|
||||
messageContent.update();
|
||||
lastClickedRow = null; // from generic.js
|
||||
|
||||
var currentMessage;
|
||||
if (!idx) {
|
||||
@@ -401,7 +411,6 @@ function openMailbox(mailbox, reload, idx) {
|
||||
+ "&asc=" + sorting["ascending"]);
|
||||
if (idx)
|
||||
url += "&idx=" + idx;
|
||||
|
||||
if (document.messageListAjaxRequest) {
|
||||
document.messageListAjaxRequest.aborted = true;
|
||||
document.messageListAjaxRequest.abort();
|
||||
@@ -416,7 +425,6 @@ function openMailbox(mailbox, reload, idx) {
|
||||
+ rightDragHandle.offsetHeight
|
||||
+ 'px') });
|
||||
}
|
||||
|
||||
document.messageListAjaxRequest
|
||||
= triggerAjaxRequest(url, messageListCallback,
|
||||
currentMessage);
|
||||
@@ -430,35 +438,57 @@ function openMailbox(mailbox, reload, idx) {
|
||||
function openMailboxAtIndex(event) {
|
||||
openMailbox(currentMailbox, true, this.getAttribute("idx"));
|
||||
|
||||
preventDefault(event);
|
||||
Event.stop(event);
|
||||
}
|
||||
|
||||
function messageListCallback(http) {
|
||||
var div = $('mailboxContent');
|
||||
|
||||
var table = $('messageList');
|
||||
|
||||
if (http.readyState == 4
|
||||
&& http.status == 200) {
|
||||
document.messageListAjaxRequest = null;
|
||||
div.innerHTML = http.responseText;
|
||||
document.messageListAjaxRequest = null;
|
||||
|
||||
if (table) {
|
||||
// Update table
|
||||
var thead = table.tHead;
|
||||
var tbody = table.tBodies[0];
|
||||
var tmp = document.createElement('div');
|
||||
$(tmp).update(http.responseText);
|
||||
thead.rows[1].parentNode.replaceChild(tmp.firstChild.tHead.rows[1], thead.rows[1]);
|
||||
table.replaceChild(tmp.firstChild.tBodies[0], tbody);
|
||||
}
|
||||
else {
|
||||
// Add table
|
||||
div.update(http.responseText);
|
||||
table = $('messageList');
|
||||
configureMessageListEvents(table);
|
||||
TableKit.Resizable.init(table, {'trueResize' : true, 'keepWidth' : true});
|
||||
}
|
||||
configureMessageListBodyEvents(table);
|
||||
|
||||
var selected = http.callbackData;
|
||||
if (selected) {
|
||||
var row = $("row_" + selected);
|
||||
if (row)
|
||||
if (row) {
|
||||
row.select();
|
||||
}
|
||||
configureMessageListEvents();
|
||||
if (sorting["attribute"] && sorting["attribute"].length > 0) {
|
||||
var sortHeader;
|
||||
if (sorting["attribute"] == "subject")
|
||||
sortHeader = $("subjectHeader");
|
||||
else if (sorting["attribute"] == "from")
|
||||
sortHeader = $("fromHeader");
|
||||
else if (sorting["attribute"] == "date")
|
||||
sortHeader = $("dateHeader");
|
||||
div.scrollTop = row.rowIndex * row.getHeight(); // scroll to selected message
|
||||
}
|
||||
else
|
||||
sortHeader = null;
|
||||
|
||||
$("messageContent").update();
|
||||
}
|
||||
else
|
||||
div.scrollTop = 0;
|
||||
|
||||
if (sorting["attribute"] && sorting["attribute"].length > 0) {
|
||||
var sortHeader = $(sorting["attribute"] + "Header");
|
||||
|
||||
if (sortHeader) {
|
||||
var sortImages = $(table.tHead).getElementsByClassName("sortImage");
|
||||
$(sortImages).each(function(item) {
|
||||
item.remove();
|
||||
});
|
||||
|
||||
var sortImage = createElement("img", "messageSortImage", "sortImage");
|
||||
sortHeader.insertBefore(sortImage, sortHeader.firstChild);
|
||||
if (sorting["ascending"])
|
||||
@@ -468,8 +498,11 @@ function messageListCallback(http) {
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
log("messageListCallback: problem during ajax request (readyState = " + http.readyState + ", status = " + http.status + ")");
|
||||
else {
|
||||
var data = http.responseText;
|
||||
var msg = data.replace(/^(.*\n)*.*<p>((.*\n)*.*)<\/p>(.*\n)*.*$/, "$2");
|
||||
log("messageListCallback: problem during ajax request (readyState = " + http.readyState + ", status = " + http.status + ", response = " + msg + ")");
|
||||
}
|
||||
}
|
||||
|
||||
function quotasCallback(http) {
|
||||
@@ -489,7 +522,7 @@ function quotasCallback(http) {
|
||||
var used = mbQuotas["usedSpace"];
|
||||
var max = mbQuotas["maxQuota"];
|
||||
var percents = (Math.round(used * 10000 / max) / 100);
|
||||
var format = labels["quotasFormat"].decodeEntities();
|
||||
var format = labels["quotasFormat"];
|
||||
var text = format.formatted(used, max, percents);
|
||||
window.status = text;
|
||||
}
|
||||
@@ -652,7 +685,7 @@ function loadMessage(idx) {
|
||||
markMailInWindow(window, idx, true);
|
||||
} else {
|
||||
var div = $('messageContent');
|
||||
div.innerHTML = cachedMessage['text'];
|
||||
div.update(cachedMessage['text']);
|
||||
cachedMessage['time'] = (new Date()).getTime();
|
||||
document.messageAjaxRequest = null;
|
||||
configureLinksInMessage();
|
||||
@@ -705,7 +738,7 @@ function messageCallback(http) {
|
||||
if (http.readyState == 4
|
||||
&& http.status == 200) {
|
||||
document.messageAjaxRequest = null;
|
||||
div.innerHTML = http.responseText;
|
||||
div.update(http.responseText);
|
||||
configureLinksInMessage();
|
||||
|
||||
if (http.callbackData) {
|
||||
@@ -861,18 +894,18 @@ function onHeaderClick(event) {
|
||||
sorting["attribute"] = newSortAttribute;
|
||||
sorting["ascending"] = true;
|
||||
}
|
||||
|
||||
refreshCurrentFolder();
|
||||
|
||||
preventDefault(event);
|
||||
|
||||
Event.stop(event);
|
||||
}
|
||||
|
||||
function refreshCurrentFolder() {
|
||||
openMailbox(currentMailbox, true);
|
||||
}
|
||||
|
||||
function pouetpouet(event) {
|
||||
window.alert("pouet pouet");
|
||||
function refreshFolderByType(type) {
|
||||
if (currentMailboxType == type)
|
||||
refreshCurrentFolder();
|
||||
}
|
||||
|
||||
var mailboxSpanAcceptType = function(type) {
|
||||
@@ -953,34 +986,34 @@ var messageListData = function(type) {
|
||||
|
||||
/* a model for a futur refactoring of the sortable table headers mechanism */
|
||||
|
||||
function configureMessageListHeaders(cells) {
|
||||
for (var i = 0; i < cells.length; i++) {
|
||||
var currentCell = $(cells[i]);
|
||||
Event.observe(currentCell, "click",
|
||||
onHeaderClick.bindAsEventListener(currentCell));
|
||||
Event.observe(currentCell, "mousedown", listRowMouseDownHandler);
|
||||
|
||||
function configureMessageListEvents(table) {
|
||||
if (table) {
|
||||
table.multiselect = true;
|
||||
// Each body row can load a message
|
||||
Event.observe(table, "mousedown",
|
||||
onMessageSelectionChange.bindAsEventListener(table));
|
||||
// Sortable columns
|
||||
configureSortableTableHeaders(table);
|
||||
}
|
||||
}
|
||||
|
||||
function configureMessageListEvents() {
|
||||
var messageList = $("messageList");
|
||||
if (messageList) {
|
||||
Event.observe(messageList, "mousedown",
|
||||
onMessageSelectionChange.bindAsEventListener(messageList));
|
||||
|
||||
configureMessageListHeaders(messageList.tHead.rows[0].cells);
|
||||
var cell = messageList.tHead.rows[1].cells[0];
|
||||
function configureMessageListBodyEvents(table) {
|
||||
if (table) {
|
||||
// Page navigation
|
||||
var cell = table.tHead.rows[1].cells[0];
|
||||
if ($(cell).hasClassName("tbtv_navcell")) {
|
||||
var anchors = $(cell).childNodesWithTag("a");
|
||||
for (var i = 0; i < anchors.length; i++)
|
||||
Event.observe(anchors[i], "click", openMailboxAtIndex.bindAsEventListener(anchors[i]));
|
||||
}
|
||||
|
||||
rows = messageList.tBodies[0].rows;
|
||||
rows = table.tBodies[0].rows;
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
Event.observe(rows[i], "mousedown", onRowClick);
|
||||
Event.observe(rows[i], "selectstart", listRowMouseDownHandler);
|
||||
Event.observe(rows[i], "contextmenu", onMessageContextMenu.bindAsEventListener(rows[i]));
|
||||
|
||||
|
||||
rows[i].dndTypes = function() { return new Array("mailRow"); };
|
||||
rows[i].dndGhost = messageListGhost;
|
||||
rows[i].dndDataForType = messageListData;
|
||||
@@ -1059,9 +1092,7 @@ function openInbox(node) {
|
||||
|
||||
function initMailer(event) {
|
||||
if (!document.body.hasClassName("popup")) {
|
||||
configureMessageListEvents();
|
||||
initDnd();
|
||||
currentMailbox = "/" + accounts[0] + "/folderINBOX";
|
||||
initMailboxTree();
|
||||
}
|
||||
}
|
||||
@@ -1089,6 +1120,7 @@ function initMailboxTree() {
|
||||
mailboxTree.add(0, -1, '');
|
||||
|
||||
mailboxTree.pendingRequests = mailAccounts.length;
|
||||
activeAjaxRequests += mailAccounts.length;
|
||||
for (var i = 0; i < mailAccounts.length; i++) {
|
||||
var url = ApplicationBaseURL + "/" + mailAccounts[i] + "/mailboxes";
|
||||
triggerAjaxRequest(url, onLoadMailboxesCallback, mailAccounts[i]);
|
||||
@@ -1096,14 +1128,16 @@ function initMailboxTree() {
|
||||
}
|
||||
|
||||
function updateMailboxTreeInPage() {
|
||||
$("folderTreeContent").innerHTML = mailboxTree;
|
||||
$("folderTreeContent").update(mailboxTree);
|
||||
|
||||
var inboxFound = false;
|
||||
var tree = $("mailboxTree");
|
||||
var nodes = document.getElementsByClassName("node", tree);
|
||||
for (i = 0; i < nodes.length; i++) {
|
||||
Event.observe(nodes[i], "click", onMailboxTreeItemClick.bindAsEventListener(nodes[i]));
|
||||
Event.observe(nodes[i], "contextmenu", onFolderMenuClick.bindAsEventListener(nodes[i]));
|
||||
Event.observe(nodes[i], "click",
|
||||
onMailboxTreeItemClick.bindAsEventListener(nodes[i]));
|
||||
Event.observe(nodes[i], "contextmenu",
|
||||
onFolderMenuClick.bindAsEventListener(nodes[i]));
|
||||
if (!inboxFound
|
||||
&& nodes[i].parentNode.getAttribute("datatype") == "inbox") {
|
||||
openInbox(nodes[i]);
|
||||
@@ -1131,12 +1165,13 @@ function generateMenuForMailbox(mailbox, prefix, callback) {
|
||||
menuDIV.setAttribute("id", prefix + "Submenu");
|
||||
var menu = document.createElement("ul");
|
||||
menuDIV.appendChild(menu);
|
||||
pageContent.appendChild(menuDIV);
|
||||
|
||||
var callbacks = new Array();
|
||||
if (mailbox.type != "account") {
|
||||
var newNode = document.createElement("li");
|
||||
newNode.mailbox = mailbox;
|
||||
newNode.appendChild(document.createTextNode("coucou"));
|
||||
newNode.appendChild(document.createTextNode(labels["This Folder"]));
|
||||
menu.appendChild(newNode);
|
||||
menu.appendChild(document.createElement("li"));
|
||||
callbacks.push(callback);
|
||||
@@ -1150,11 +1185,8 @@ function generateMenuForMailbox(mailbox, prefix, callback) {
|
||||
menu.appendChild(newNode);
|
||||
if (child.children.length > 0) {
|
||||
var newPrefix = prefix + submenuCount;
|
||||
var newSubmenu = generateMenuForMailbox(child,
|
||||
newPrefix,
|
||||
callback);
|
||||
document.body.appendChild(newSubmenu);
|
||||
callbacks.push(newPrefix + "Submenu");
|
||||
var newSubmenuId = generateMenuForMailbox(child, newPrefix, callback);
|
||||
callbacks.push(newSubmenuId);
|
||||
submenuCount++;
|
||||
}
|
||||
else {
|
||||
@@ -1164,7 +1196,7 @@ function generateMenuForMailbox(mailbox, prefix, callback) {
|
||||
}
|
||||
initMenu(menuDIV, callbacks);
|
||||
|
||||
return menuDIV;
|
||||
return menuDIV.getAttribute("id");
|
||||
}
|
||||
|
||||
function updateMailboxMenus() {
|
||||
@@ -1178,23 +1210,23 @@ function updateMailboxMenus() {
|
||||
menuDIV.parentNode.removeChild(menuDIV);
|
||||
|
||||
menuDIV = document.createElement("div");
|
||||
document.body.appendChild(menuDIV);
|
||||
pageContent = $("pageContent");
|
||||
pageContent.appendChild(menuDIV);
|
||||
|
||||
var menu = document.createElement("ul");
|
||||
menuDIV.appendChild(menu);
|
||||
|
||||
$(menuDIV).addClassName("menu");
|
||||
menuDIV.setAttribute("id", menuId);
|
||||
|
||||
|
||||
var submenuIds = new Array();
|
||||
for (var i = 0; i < mailAccounts.length; i++) {
|
||||
var menuEntry = mailboxMenuNode("account", mailAccounts[i]);
|
||||
menu.appendChild(menuEntry);
|
||||
var mailbox = accounts[mailAccounts[i]];
|
||||
var newSubmenu = generateMenuForMailbox(mailbox,
|
||||
var newSubmenuId = generateMenuForMailbox(mailbox,
|
||||
key, mailboxActions[key]);
|
||||
document.body.appendChild(newSubmenu);
|
||||
submenuIds.push(newSubmenu.getAttribute("id"));
|
||||
submenuIds.push(newSubmenuId);
|
||||
}
|
||||
initMenu(menuDIV, submenuIds);
|
||||
}
|
||||
@@ -1203,14 +1235,17 @@ function updateMailboxMenus() {
|
||||
function onLoadMailboxesCallback(http) {
|
||||
if (http.readyState == 4
|
||||
&& http.status == 200) {
|
||||
checkAjaxRequestsState();
|
||||
var newAccount = buildMailboxes(http.callbackData,
|
||||
http.responseText);
|
||||
accounts[http.callbackData] = newAccount;
|
||||
mailboxTree.addMailAccount(newAccount);
|
||||
mailboxTree.pendingRequests--;
|
||||
activeAjaxRequests--;
|
||||
if (!mailboxTree.pendingRequests) {
|
||||
updateMailboxTreeInPage();
|
||||
updateMailboxMenus();
|
||||
checkAjaxRequestsState();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1259,7 +1294,7 @@ function buildMailboxes(accountName, encoded) {
|
||||
}
|
||||
|
||||
function onMenuCreateFolder(event) {
|
||||
var name = window.prompt(labels["Name :"].decodeEntities(), "");
|
||||
var name = window.prompt(labels["Name :"], "");
|
||||
if (name && name.length > 0) {
|
||||
var folderID = document.menuTarget.getAttribute("dataname");
|
||||
var urlstr = URLForFolderID(folderID) + "/createFolder?name=" + name;
|
||||
@@ -1269,7 +1304,7 @@ function onMenuCreateFolder(event) {
|
||||
|
||||
function onMenuRenameFolder(event) {
|
||||
var name = window.prompt(labels["Enter the new name of your folder :"]
|
||||
.decodeEntities(),
|
||||
,
|
||||
"");
|
||||
if (name && name.length > 0) {
|
||||
var folderID = document.menuTarget.getAttribute("dataname");
|
||||
@@ -1279,7 +1314,7 @@ function onMenuRenameFolder(event) {
|
||||
}
|
||||
|
||||
function onMenuDeleteFolder(event) {
|
||||
var answer = window.confirm(labels["Do you really want to move this folder into the trash ?"].decodeEntities());
|
||||
var answer = window.confirm(labels["Do you really want to move this folder into the trash ?"]);
|
||||
if (answer) {
|
||||
var folderID = document.menuTarget.getAttribute("dataname");
|
||||
var urlstr = URLForFolderID(folderID) + "/deleteFolder";
|
||||
@@ -1297,27 +1332,64 @@ function onMenuExpungeFolder(event) {
|
||||
function onMenuEmptyTrash(event) {
|
||||
var folderID = document.menuTarget.getAttribute("dataname");
|
||||
var urlstr = URLForFolderID(folderID) + "/emptyTrash";
|
||||
triggerAjaxRequest(urlstr, folderOperationCallback, folderID);
|
||||
|
||||
triggerAjaxRequest(urlstr, folderRefreshCallback, folderID);
|
||||
if (folderID == currentMailbox) {
|
||||
var div = $('messageContent');
|
||||
for (var i = div.childNodes.length - 1; i > -1; i--)
|
||||
div.removeChild(div.childNodes[i]);
|
||||
refreshCurrentFolder();
|
||||
}
|
||||
var msgID = currentMessages[folderID];
|
||||
if (msgID)
|
||||
deleteCachedMessage(folderID + "/" + msgID);
|
||||
}
|
||||
|
||||
function _onMenuChangeToXXXFolder(event, folder) {
|
||||
var type = document.menuTarget.getAttribute("datatype");
|
||||
if (type == "additional")
|
||||
window.alert(labels["You need to choose a non-virtual folder!"]);
|
||||
else {
|
||||
var folderID = document.menuTarget.getAttribute("dataname");
|
||||
var number = folderID.split("/").length;
|
||||
if (number > 3)
|
||||
window.alert(labels["You need to choose a root subfolder!"]);
|
||||
else {
|
||||
var urlstr = URLForFolderID(folderID) + "/setAs" + folder + "Folder";
|
||||
triggerAjaxRequest(urlstr, folderOperationCallback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onMenuChangeToDraftsFolder(event) {
|
||||
return _onMenuChangeToXXXFolder(event, "Drafts");
|
||||
}
|
||||
|
||||
function onMenuChangeToSentFolder(event) {
|
||||
return _onMenuChangeToXXXFolder(event, "Sent");
|
||||
}
|
||||
|
||||
function onMenuChangeToTrashFolder(event) {
|
||||
return _onMenuChangeToXXXFolder(event, "Trash");
|
||||
}
|
||||
|
||||
function folderOperationCallback(http) {
|
||||
if (http.readyState == 4
|
||||
&& http.status == 204)
|
||||
&& isHttpStatus204(http.status))
|
||||
initMailboxTree();
|
||||
else
|
||||
window.alert(labels["Operation failed"].decodeEntities());
|
||||
window.alert(labels["Operation failed"]);
|
||||
}
|
||||
|
||||
function folderRefreshCallback(http) {
|
||||
if (http.readyState == 4
|
||||
&& http.status == 204) {
|
||||
&& isHttpStatus204(http.status)) {
|
||||
var oldMailbox = http.callbackData;
|
||||
if (oldMailbox == currentMailbox)
|
||||
refreshCurrentFolder();
|
||||
}
|
||||
else
|
||||
window.alert(labels["Operation failed"].decodeEntities());
|
||||
window.alert(labels["Operation failed"]);
|
||||
}
|
||||
|
||||
function getMenus() {
|
||||
@@ -1336,7 +1408,9 @@ function getMenus() {
|
||||
onMenuCreateFolder,
|
||||
onMenuRenameFolder,
|
||||
onMenuExpungeFolder,
|
||||
onMenuDeleteFolder, "-", null,
|
||||
onMenuDeleteFolder,
|
||||
"folderTypeMenu",
|
||||
"-", null,
|
||||
onMenuSharing);
|
||||
menus["addressMenu"] = new Array(newContactFromEmail, newEmailTo, null);
|
||||
menus["messageListMenu"] = new Array(onMenuOpenMessage, "-",
|
||||
@@ -1358,6 +1432,10 @@ function getMenus() {
|
||||
null, onMenuViewMessageSource,
|
||||
null, onPrintCurrentMessage,
|
||||
onMenuDeleteMessage);
|
||||
menus["folderTypeMenu"] = new Array(onMenuChangeToSentFolder,
|
||||
onMenuChangeToDraftsFolder,
|
||||
onMenuChangeToTrashFolder);
|
||||
|
||||
menus["label-menu"] = new Array(null, "-", null , null, null, null , null,
|
||||
null);
|
||||
menus["mark-menu"] = new Array(null, null, null, null, "-", null, "-",
|
||||
@@ -1388,6 +1466,18 @@ Mailbox.prototype.dump = function(indent) {
|
||||
}
|
||||
}
|
||||
|
||||
Mailbox.prototype.fullName = function() {
|
||||
var fullName = "";
|
||||
|
||||
var currentFolder = this;
|
||||
while (currentFolder.parentFolder) {
|
||||
fullName = "/folder" + currentFolder.name + fullName;
|
||||
currentFolder = currentFolder.parentFolder;
|
||||
}
|
||||
|
||||
return "/" + currentFolder.name + fullName;
|
||||
}
|
||||
|
||||
Mailbox.prototype.findMailboxByName = function(name) {
|
||||
var mailbox = null;
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
BODY
|
||||
{ background-color: #999; }
|
||||
|
||||
IMG#preparedAnimation
|
||||
{
|
||||
width: 0px;
|
||||
height: 0px;
|
||||
}
|
||||
|
||||
DIV#loginScreen
|
||||
{
|
||||
background-color: #d4d0c8;
|
||||
margin: 0px auto;
|
||||
margin-top: 5em;
|
||||
padding: 5px;
|
||||
border: 2px solid transparent;
|
||||
width: 200px;
|
||||
-moz-border-top-colors: #efebe7 #fff;
|
||||
-moz-border-left-colors: #efebe7 #fff;
|
||||
-moz-border-right-colors: #000 #9c9a94 transparent;
|
||||
-moz-border-bottom-colors: #000 #9c9a94 transparent;
|
||||
}
|
||||
|
||||
IMG#splash
|
||||
{ border: 0px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
height: 200px;
|
||||
width: 200px; }
|
||||
|
||||
DIV#loginScreen INPUT.textField
|
||||
{ width: 187px; }
|
||||
|
||||
DIV#loginButton
|
||||
{ text-align: right; }
|
||||
|
||||
DIV#loginButton INPUT
|
||||
{ width: auto;
|
||||
margin-top: 5px; }
|
||||
|
||||
DIV#loginButton IMG#progressIndicator
|
||||
{ float: left;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border: 0px none;
|
||||
margin-top: 5px;
|
||||
margin-left: 5px; }
|
||||
|
||||
P.error
|
||||
{ color: #f00;
|
||||
text-align: center; }
|
||||
|
||||
P.browser
|
||||
{ background-color: #fff;
|
||||
border-top: 1px solid #888;
|
||||
border-left: 1px solid #888;
|
||||
border-right: 1px solid #eee;
|
||||
border-bottom: 1px solid #eee;
|
||||
line-height: 32px; }
|
||||
|
||||
P.browser img
|
||||
{ padding: 2px;
|
||||
vertical-align: middle; }
|
||||
@@ -0,0 +1,41 @@
|
||||
function initLogin() {
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime() - 86400000);
|
||||
document.cookie = ("0xHIGHFLYxSOGo-0.9=discard; path=/"
|
||||
+ "; expires=" + date.toGMTString());
|
||||
var submit = $("submit");
|
||||
Event.observe(submit, "click", onLoginClick);
|
||||
|
||||
var userName = $("userName");
|
||||
userName.focus();
|
||||
|
||||
var image = $("preparedAnimation");
|
||||
image.parentNode.removeChild(image);
|
||||
}
|
||||
|
||||
function onLoginClick(event) {
|
||||
startAnimation($("loginButton"), $("submit"));
|
||||
|
||||
var userName = $("userName").value;
|
||||
var password = $("password").value;
|
||||
|
||||
if (userName.length > 0) {
|
||||
var url = ($("connectForm").getAttribute("action")
|
||||
+ "?userName=" + userName
|
||||
+ "&password=" + password);
|
||||
document.cookie = "";
|
||||
triggerAjaxRequest(url, onLoginCallback);
|
||||
}
|
||||
|
||||
preventDefault(event);
|
||||
}
|
||||
|
||||
function onLoginCallback(http) {
|
||||
if (http.readyState == 4) {
|
||||
if (isHttpStatus204(http.status)) {
|
||||
window.location.href = ApplicationBaseURL + $("userName").value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addEvent(window, 'load', initLogin);
|
||||
@@ -61,6 +61,7 @@ UL#tasksList, UL#calendarList
|
||||
border-top: 2px solid #222;
|
||||
border-left: 2px solid #222;
|
||||
background-color: #fff;
|
||||
-khtml-user-select: none;
|
||||
-moz-border-top-colors: #9c9a94 #000 transparent;
|
||||
-moz-border-left-colors: #9c9a94 #000 transparent;
|
||||
list-style-type: none;
|
||||
@@ -69,7 +70,8 @@ UL#tasksList, UL#calendarList
|
||||
overflow-x: hidden; }
|
||||
|
||||
UL#calendarList
|
||||
{ clear: both;
|
||||
{ clear: left;
|
||||
width: 100%;
|
||||
height: 10.5em;
|
||||
margin: 0px; }
|
||||
|
||||
@@ -107,7 +109,8 @@ UL#tasksList LI[class~="_selected"].duetoday
|
||||
{ color: #fff !important;
|
||||
background-color: #00f !important; }
|
||||
|
||||
UL#tasksList LI[class~="_selected"].duelater
|
||||
UL#tasksList LI[class~="_selected"].duelater,
|
||||
UL#tasksList LI[class~="_selected"].completed
|
||||
{ color: #fff !important;
|
||||
background-color: #999 !important; }
|
||||
|
||||
@@ -122,9 +125,9 @@ DIV#rightPanel
|
||||
padding: 0px;
|
||||
overflow: hidden; }
|
||||
|
||||
/* top list */
|
||||
DIV#eventsListView
|
||||
{ display: block;
|
||||
cursor: default;
|
||||
{ cursor: default;
|
||||
position: absolute;
|
||||
background-color: #fff;
|
||||
top: 2.5em;
|
||||
@@ -266,13 +269,19 @@ TABLE#dateSelectorTable
|
||||
border: 1px solid #deebf7; }
|
||||
|
||||
TABLE#eventsList
|
||||
{ display: block;
|
||||
position: relative;
|
||||
width: 100%; }
|
||||
{ width: 100%; }
|
||||
|
||||
TABLE#eventsList td.headerTitle,
|
||||
TABLE#eventsList td.headerLocation
|
||||
{ width: 35%; }
|
||||
TABLE#eventsList TD.headerTitle,
|
||||
TABLE#eventsList TD.headerDateTime
|
||||
{ width: 30%; }
|
||||
|
||||
TABLE#eventsList TD,
|
||||
TABLE#eventsList TH
|
||||
{ overflow: hidden;
|
||||
white-space: nowrap; } /* pre, normal, nowrap */
|
||||
|
||||
TABLE#eventsList TH
|
||||
{ white-space: pre; }
|
||||
|
||||
._unfocused#dateSelector TD._selected,
|
||||
UL._unfocused > LI._selected,
|
||||
|
||||
@@ -17,7 +17,7 @@ var cachedDateSelectors = new Array();
|
||||
var contactSelectorAction = 'calendars-contacts';
|
||||
|
||||
var eventsToDelete = new Array();
|
||||
var ownersOfEventsToDelete = new Array();
|
||||
var calendarsOfEventsToDelete = new Array();
|
||||
|
||||
var usersRightsWindowHeight = 250;
|
||||
var usersRightsWindowWidth = 502;
|
||||
@@ -27,15 +27,11 @@ function newEvent(sender, type) {
|
||||
if (!day)
|
||||
day = currentDay;
|
||||
|
||||
var user = UserLogin;
|
||||
if (sender.parentNode.getAttribute("id") != "toolbar"
|
||||
&& currentView == "multicolumndayview" && type == "event")
|
||||
user = sender.parentNode.parentNode.getAttribute("user");
|
||||
|
||||
var hour = sender.hour;
|
||||
if (!hour)
|
||||
hour = sender.getAttribute("hour");
|
||||
var urlstr = UserFolderURL + "../" + user + "/Calendar/new" + type;
|
||||
var folderID = getSelectedFolder();
|
||||
var urlstr = ApplicationBaseURL + folderID + "/new" + type;
|
||||
var params = new Array();
|
||||
if (day)
|
||||
params.push("day=" + day);
|
||||
@@ -49,6 +45,18 @@ function newEvent(sender, type) {
|
||||
return false; /* stop following the link */
|
||||
}
|
||||
|
||||
function getSelectedFolder() {
|
||||
var folder;
|
||||
|
||||
var nodes = $("calendarList").getSelectedRows();
|
||||
if (nodes.length > 0)
|
||||
folder = nodes[0].getAttribute("id");
|
||||
else
|
||||
folder = "/personal";
|
||||
|
||||
return folder;
|
||||
}
|
||||
|
||||
function onMenuNewEventClick(event) {
|
||||
newEvent(this, "event");
|
||||
}
|
||||
@@ -57,13 +65,8 @@ function onMenuNewTaskClick(event) {
|
||||
newEvent(this, "task");
|
||||
}
|
||||
|
||||
function _editEventId(id, owner) {
|
||||
var urlBase;
|
||||
if (owner)
|
||||
urlBase = UserFolderURL + "../" + owner + "/";
|
||||
urlBase += "Calendar/"
|
||||
|
||||
var urlstr = urlBase + id + "/edit";
|
||||
function _editEventId(id, calendar) {
|
||||
var urlstr = ApplicationBaseURL + "/" + calendar + "/" + id + "/edit";
|
||||
var targetname = "SOGo_edit_" + id;
|
||||
var win = window.open(urlstr, "_blank",
|
||||
"width=490,height=470,resizable=0");
|
||||
@@ -76,10 +79,10 @@ function editEvent() {
|
||||
|
||||
for (var i = 0; i < nodes.length; i++)
|
||||
_editEventId(nodes[i].getAttribute("id"),
|
||||
nodes[i].owner);
|
||||
nodes[i].calendar);
|
||||
} else if (selectedCalendarCell) {
|
||||
_editEventId(selectedCalendarCell[0].cname,
|
||||
selectedCalendarCell[0].owner);
|
||||
selectedCalendarCell[0].calendar);
|
||||
}
|
||||
|
||||
return false; /* stop following the link */
|
||||
@@ -87,9 +90,9 @@ function editEvent() {
|
||||
|
||||
function _batchDeleteEvents() {
|
||||
var events = eventsToDelete.shift();
|
||||
var owner = ownersOfEventsToDelete.shift();
|
||||
var urlstr = (UserFolderURL + "../" + owner + "/Calendar/batchDelete?ids="
|
||||
+ events.join('/'));
|
||||
var calendar = calendarsOfEventsToDelete.shift();
|
||||
var urlstr = (ApplicationBaseURL + "/" + calendar
|
||||
+ "/batchDelete?ids=" + events.join('/'));
|
||||
document.deleteEventAjaxRequest = triggerAjaxRequest(urlstr,
|
||||
deleteEventCallback,
|
||||
events);
|
||||
@@ -102,9 +105,9 @@ function deleteEvent() {
|
||||
if (nodes.length > 0) {
|
||||
var label = "";
|
||||
if (listOfSelection == $("tasksList"))
|
||||
label = labels["taskDeleteConfirmation"].decodeEntities();
|
||||
label = labels["taskDeleteConfirmation"];
|
||||
else
|
||||
label = labels["eventDeleteConfirmation"].decodeEntities();
|
||||
label = labels["eventDeleteConfirmation"];
|
||||
|
||||
if (confirm(label)) {
|
||||
if (document.deleteEventAjaxRequest) {
|
||||
@@ -112,33 +115,33 @@ function deleteEvent() {
|
||||
document.deleteEventAjaxRequest.abort();
|
||||
}
|
||||
var sortedNodes = new Array();
|
||||
var owners = new Array();
|
||||
var calendars = new Array();
|
||||
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
var owner = nodes[i].owner;
|
||||
if (!sortedNodes[owner]) {
|
||||
sortedNodes[owner] = new Array();
|
||||
owners.push(owner);
|
||||
var calendar = nodes[i].calendar;
|
||||
if (!sortedNodes[calendar]) {
|
||||
sortedNodes[calendar] = new Array();
|
||||
calendars.push(calendar);
|
||||
}
|
||||
sortedNodes[owner].push(nodes[i].cname);
|
||||
sortedNodes[calendar].push(nodes[i].cname);
|
||||
}
|
||||
for (var i = 0; i < owners.length; i++) {
|
||||
ownersOfEventsToDelete.push(owners[i]);
|
||||
eventsToDelete.push(sortedNodes[owners[i]]);
|
||||
for (var i = 0; i < calendars.length; i++) {
|
||||
calendarsOfEventsToDelete.push(calendars[i]);
|
||||
eventsToDelete.push(sortedNodes[calendars[i]]);
|
||||
}
|
||||
_batchDeleteEvents();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (selectedCalendarCell) {
|
||||
var label = labels["eventDeleteConfirmation"].decodeEntities();
|
||||
var label = labels["eventDeleteConfirmation"];
|
||||
if (confirm(label)) {
|
||||
if (document.deleteEventAjaxRequest) {
|
||||
document.deleteEventAjaxRequest.aborted = true;
|
||||
document.deleteEventAjaxRequest.abort();
|
||||
}
|
||||
eventsToDelete.push([selectedCalendarCell[0].cname]);
|
||||
ownersOfEventsToDelete.push(selectedCalendarCell[0].owner);
|
||||
calendarsOfEventsToDelete.push(selectedCalendarCell[0].calendar);
|
||||
_batchDeleteEvents();
|
||||
}
|
||||
}
|
||||
@@ -162,59 +165,67 @@ function modifyEvent(sender, modification) {
|
||||
|
||||
function closeInvitationWindow() {
|
||||
var closeDiv = document.createElement("div");
|
||||
document.body.appendChild(closeDiv);
|
||||
closeDiv.addClassName("javascriptPopupBackground");
|
||||
|
||||
var closePseudoWin = document.createElement("div");
|
||||
document.body.appendChild(closePseudoWin);
|
||||
closePseudoWin.addClassName("javascriptMessagePseudoTopWindow");
|
||||
closePseudoWin.style.top = "0px;";
|
||||
closePseudoWin.style.left = "0px;";
|
||||
closePseudoWin.style.right = "0px;";
|
||||
closePseudoWin.appendChild(document.createTextNode(labels["closeThisWindowMessage"].decodeEntities()));
|
||||
document.body.appendChild(closeDiv);
|
||||
document.body.appendChild(closePseudoWin);
|
||||
closePseudoWin.appendChild(document.createTextNode(labels["closeThisWindowMessage"]));
|
||||
|
||||
var calLink = document.createElement("a");
|
||||
closePseudoWin.appendChild(calLink);
|
||||
calLink.href = ApplicationBaseURL;
|
||||
calLink.appendChild(document.createTextNode(labels["Calendar"].toLowerCase()));
|
||||
}
|
||||
|
||||
function modifyEventCallback(http) {
|
||||
if (http.readyState == 4) {
|
||||
if (http.status == 200) {
|
||||
if (queryParameters["mail-invitation"].toLowerCase() == "yes")
|
||||
closeInvitationWindow();
|
||||
else {
|
||||
window.opener.setTimeout("refreshEventsAndDisplay();", 100);
|
||||
window.setTimeout("window.close();", 100);
|
||||
}
|
||||
}
|
||||
if (http.readyState == 4) {
|
||||
if (http.status == 200) {
|
||||
var mailInvitation = queryParameters["mail-invitation"];
|
||||
if (mailInvitation && mailInvitation.toLowerCase() == "yes")
|
||||
closeInvitationWindow();
|
||||
else {
|
||||
// log("showing alert...");
|
||||
window.alert(labels["eventPartStatModificationError"]);
|
||||
window.opener.setTimeout("refreshEventsAndDisplay();", 100);
|
||||
window.setTimeout("window.close();", 100);
|
||||
}
|
||||
document.modifyEventAjaxRequest = null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// log("showing alert...");
|
||||
window.alert(labels["eventPartStatModificationError"]);
|
||||
}
|
||||
document.modifyEventAjaxRequest = null;
|
||||
}
|
||||
}
|
||||
|
||||
function deleteEventCallback(http) {
|
||||
if (http.readyState == 4
|
||||
&& http.status == 200) {
|
||||
var nodes = http.callbackData;
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
var node = $(nodes[i]);
|
||||
if (node)
|
||||
node.parentNode.removeChild(node);
|
||||
}
|
||||
if (eventsToDelete.length)
|
||||
_batchDeleteEvents();
|
||||
else {
|
||||
document.deleteEventAjaxRequest = null;
|
||||
refreshEvents();
|
||||
refreshTasks();
|
||||
changeCalendarDisplay();
|
||||
if (http.readyState == 4) {
|
||||
if (isHttpStatus204(http.status)) {
|
||||
var nodes = http.callbackData;
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
var node = $(nodes[i]);
|
||||
if (node)
|
||||
node.parentNode.removeChild(node);
|
||||
}
|
||||
if (eventsToDelete.length)
|
||||
_batchDeleteEvents();
|
||||
else {
|
||||
document.deleteEventAjaxRequest = null;
|
||||
refreshEvents();
|
||||
refreshTasks();
|
||||
changeCalendarDisplay();
|
||||
}
|
||||
}
|
||||
else
|
||||
log ("deleteEventCallback Ajax error");
|
||||
}
|
||||
else
|
||||
log ("deleteEventCallback Ajax error");
|
||||
}
|
||||
|
||||
function editDoubleClickedEvent(event) {
|
||||
_editEventId(this.cname, this.owner);
|
||||
_editEventId(this.cname, this.calendar);
|
||||
|
||||
preventDefault(event);
|
||||
event.cancelBubble = true;
|
||||
@@ -302,20 +313,20 @@ function eventsListCallback(http) {
|
||||
var div = $("eventsListView");
|
||||
|
||||
document.eventsListAjaxRequest = null;
|
||||
var table = $("eventsList").tBodies[0];
|
||||
var table = $("eventsList");
|
||||
var params = parseQueryParameters(http.callbackData);
|
||||
sortKey = params["sort"];
|
||||
sortOrder = params["desc"];
|
||||
configureSortableTableHeaders();
|
||||
lastClickedRow = null; // from generic.js
|
||||
|
||||
var data = http.responseText.evalJSON(true);
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var row = document.createElement("tr");
|
||||
table.appendChild(row);
|
||||
table.tBodies[0].appendChild(row);
|
||||
$(row).addClassName("eventRow");
|
||||
row.setAttribute("id", escape(data[i][0]));
|
||||
row.cname = escape(data[i][0]);
|
||||
row.owner = data[i][1];
|
||||
row.calendar = data[i][1];
|
||||
|
||||
var startDate = new Date();
|
||||
startDate.setTime(data[i][4] * 1000);
|
||||
@@ -366,14 +377,13 @@ function tasksListCallback(http) {
|
||||
//log(i + " = " + data[i][3]);
|
||||
var listItem = document.createElement("li");
|
||||
list.appendChild(listItem);
|
||||
Event.observe(listItem, "mousedown", listRowMouseDownHandler); // causes problem with Safari
|
||||
Event.observe(listItem, "mousedown", listRowMouseDownHandler);
|
||||
Event.observe(listItem, "click", onRowClick);
|
||||
Event.observe(listItem, "dblclick", editDoubleClickedEvent.bindAsEventListener(listItem));
|
||||
listItem.setAttribute("id", data[i][0]);
|
||||
$(listItem).addClassName(data[i][5]);
|
||||
var owner = data[i][1];
|
||||
listItem.owner = owner;
|
||||
$(listItem).addClassName("ownerIs" + owner);
|
||||
listItem.calendar = data[i][1];
|
||||
$(listItem).addClassName("calendarFolder" + data[i][1]);
|
||||
listItem.cname = escape(data[i][0]);
|
||||
var input = document.createElement("input");
|
||||
input.setAttribute("type", "checkbox");
|
||||
@@ -428,7 +438,7 @@ function restoreCurrentDaySelection(div) {
|
||||
}
|
||||
|
||||
function changeDateSelectorDisplay(day, keepCurrentDay) {
|
||||
var url = ApplicationBaseURL + "dateselector";
|
||||
var url = ApplicationBaseURL + "/dateselector";
|
||||
if (day)
|
||||
url += "?day=" + day;
|
||||
|
||||
@@ -456,7 +466,7 @@ function changeDateSelectorDisplay(day, keepCurrentDay) {
|
||||
}
|
||||
|
||||
function changeCalendarDisplay(time, newView) {
|
||||
var url = ApplicationBaseURL + ((newView) ? newView : currentView);
|
||||
var url = ApplicationBaseURL + "/" + ((newView) ? newView : currentView);
|
||||
|
||||
selectedCalendarCell = null;
|
||||
|
||||
@@ -582,7 +592,7 @@ function refreshCalendarEvents() {
|
||||
document.refreshCalendarEventsAjaxRequest.aborted = true;
|
||||
document.refreshCalendarEventsAjaxRequest.abort();
|
||||
}
|
||||
var url = ApplicationBaseURL + "eventslist?sd=" + sd + "&ed=" + ed;
|
||||
var url = ApplicationBaseURL + "/eventslist?sd=" + sd + "&ed=" + ed;
|
||||
document.refreshCalendarEventsAjaxRequest
|
||||
= triggerAjaxRequest(url, refreshCalendarEventsCallback,
|
||||
{"startDate": sd, "endDate": ed});
|
||||
@@ -607,9 +617,17 @@ function drawCalendarEvent(eventData, sd, ed) {
|
||||
var viewEndDate = ed.asDate();
|
||||
|
||||
var startDate = new Date();
|
||||
startDate.setTime(eventData[4] * 1000);
|
||||
var endDate = new Date();
|
||||
endDate.setTime(eventData[5] * 1000);
|
||||
if (eventData[7] == 0) {
|
||||
startDate.setTime(eventData[4] * 1000 + (1000 * UTCOffset));
|
||||
endDate.setTime(eventData[5] * 1000 + (1000 * UTCOffset));
|
||||
}
|
||||
else {
|
||||
startDate.setTime(eventData[4] * 1000);
|
||||
endDate.setTime(eventData[5] * 1000);
|
||||
}
|
||||
|
||||
// log ("s: " + startDate+ "; e: " + endDate);
|
||||
|
||||
var days = startDate.daysUpTo(endDate);
|
||||
|
||||
@@ -635,8 +653,8 @@ function drawCalendarEvent(eventData, sd, ed) {
|
||||
|
||||
// log("day: " + days[i]);
|
||||
if (i == 0) {
|
||||
var quarters = (startDate.getHours() * 4
|
||||
+ Math.floor(startDate.getMinutes() / 15));
|
||||
var quarters = (startDate.getUTCHours() * 4
|
||||
+ Math.floor(startDate.getUTCMinutes() / 15));
|
||||
starts = quarters;
|
||||
startHour = startDate.getDisplayHoursString();
|
||||
endHour = endDate.getDisplayHoursString();
|
||||
@@ -647,8 +665,8 @@ function drawCalendarEvent(eventData, sd, ed) {
|
||||
var ends;
|
||||
var lasts;
|
||||
if (i == days.length - 1) {
|
||||
var quarters = (endDate.getHours() * 4
|
||||
+ Math.ceil(endDate.getMinutes() / 15));
|
||||
var quarters = (endDate.getUTCHours() * 4
|
||||
+ Math.ceil(endDate.getUTCMinutes() / 15));
|
||||
ends = quarters;
|
||||
}
|
||||
else
|
||||
@@ -705,11 +723,11 @@ function drawCalendarEvent(eventData, sd, ed) {
|
||||
}
|
||||
}
|
||||
|
||||
function newEventDIV(cname, owner, starts, lasts,
|
||||
function newEventDIV(cname, calendar, starts, lasts,
|
||||
startHour, endHour, title) {
|
||||
var eventDiv = document.createElement("div");
|
||||
eventDiv.cname = escape(cname);
|
||||
eventDiv.owner = owner;
|
||||
eventDiv.calendar = calendar;
|
||||
$(eventDiv).addClassName("event");
|
||||
$(eventDiv).addClassName("starts" + starts);
|
||||
$(eventDiv).addClassName("lasts" + lasts);
|
||||
@@ -722,7 +740,7 @@ function newEventDIV(cname, owner, starts, lasts,
|
||||
var innerDiv = document.createElement("div");
|
||||
eventDiv.appendChild(innerDiv);
|
||||
$(innerDiv).addClassName("eventInside");
|
||||
$(innerDiv).addClassName("ownerIs" + owner);
|
||||
$(innerDiv).addClassName("calendarFolder" + calendar);
|
||||
|
||||
var gradientDiv = document.createElement("div");
|
||||
innerDiv.appendChild(gradientDiv);
|
||||
@@ -759,7 +777,7 @@ function calendarDisplayCallback(http) {
|
||||
if (http.readyState == 4
|
||||
&& http.status == 200) {
|
||||
document.dayDisplayAjaxRequest = null;
|
||||
div.innerHTML = http.responseText;
|
||||
div.update(http.responseText);
|
||||
if (http.callbackData["view"])
|
||||
currentView = http.callbackData["view"];
|
||||
if (http.callbackData["day"])
|
||||
@@ -880,13 +898,13 @@ function _loadEventHref(href) {
|
||||
document.eventsListAjaxRequest.aborted = true;
|
||||
document.eventsListAjaxRequest.abort();
|
||||
}
|
||||
var url = ApplicationBaseURL + href;
|
||||
var url = ApplicationBaseURL + "/" + href;
|
||||
document.eventsListAjaxRequest
|
||||
= triggerAjaxRequest(url, eventsListCallback, href);
|
||||
|
||||
var table = $("eventsList").tBodies[0];
|
||||
while (table.rows.length > 1)
|
||||
table.removeChild(table.rows[1]);
|
||||
while (table.rows.length > 0)
|
||||
table.removeChild(table.rows[0]);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -896,7 +914,7 @@ function _loadTasksHref(href) {
|
||||
document.tasksListAjaxRequest.aborted = true;
|
||||
document.tasksListAjaxRequest.abort();
|
||||
}
|
||||
url = ApplicationBaseURL + href;
|
||||
url = ApplicationBaseURL + "/" + href;
|
||||
|
||||
var tasksList = $("tasksList");
|
||||
var selectedIds;
|
||||
@@ -915,8 +933,8 @@ function _loadTasksHref(href) {
|
||||
}
|
||||
|
||||
function onHeaderClick(event) {
|
||||
// log("onHeaderClick: " + this.link);
|
||||
_loadEventHref(this.link);
|
||||
//log("onHeaderClick: " + this.link);
|
||||
//_loadEventHref(this.link);
|
||||
|
||||
preventDefault(event);
|
||||
}
|
||||
@@ -946,7 +964,7 @@ function onListFilterChange() {
|
||||
return refreshEvents();
|
||||
}
|
||||
|
||||
function onEventClick(event) {
|
||||
function onEventClick(event) { log ("onEventClick");
|
||||
var day = this.day;
|
||||
var hour = this.hour;
|
||||
|
||||
@@ -1023,7 +1041,7 @@ function onSearchFormSubmit() {
|
||||
|
||||
function onCalendarSelectEvent() {
|
||||
var list = $("eventsList");
|
||||
list.deselectAll();
|
||||
list.tBodies[0].deselectAll();
|
||||
|
||||
if (selectedCalendarCell)
|
||||
for (var i = 0; i < selectedCalendarCell.length; i++)
|
||||
@@ -1118,21 +1136,17 @@ function onShowCompletedTasks(event) {
|
||||
|
||||
function updateTaskStatus(event) {
|
||||
var taskId = this.parentNode.getAttribute("id");
|
||||
var taskOwner = this.parentNode.owner;
|
||||
var newStatus = (this.checked ? 1 : 0);
|
||||
var http = createHTTPClient();
|
||||
|
||||
if (isSafari())
|
||||
|
||||
if (isSafari() && !isSafari3()) {
|
||||
newStatus = (newStatus ? 0 : 1);
|
||||
//log("update task status: " + taskId + " to " + this.checked);
|
||||
event.cancelBubble = true;
|
||||
}
|
||||
|
||||
url = (UserFolderURL + "../" + taskOwner
|
||||
+ "/Calendar/" + taskId
|
||||
+ "/changeStatus?status=" + newStatus);
|
||||
url = (ApplicationBaseURL + "/" + this.parentNode.calendar
|
||||
+ "/" + taskId + "/changeStatus?status=" + newStatus);
|
||||
|
||||
if (http) {
|
||||
// log ("url: " + url);
|
||||
// TODO: add parameter to signal that we are only interested in OK
|
||||
http.open("POST", url, false /* not async */);
|
||||
http.url = url;
|
||||
@@ -1147,6 +1161,12 @@ function updateTaskStatus(event) {
|
||||
|
||||
function updateCalendarStatus(event) {
|
||||
var list = new Array();
|
||||
var newStatus = (this.checked ? 1 : 0);
|
||||
|
||||
if (isSafari() && !isSafari3()) {
|
||||
newStatus = (newStatus ? 0 : 1);
|
||||
this.checked = newStatus;
|
||||
}
|
||||
|
||||
var nodes = $("calendarList").childNodesWithTag("li");
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
@@ -1161,17 +1181,18 @@ function updateCalendarStatus(event) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!list.length) {
|
||||
list.push(UserLogin);
|
||||
nodes[0].childNodesWithTag("input")[0].checked = true;
|
||||
}
|
||||
// if (!list.length) {
|
||||
// list.push(UserLogin);
|
||||
// nodes[0].childNodesWithTag("input")[0].checked = true;
|
||||
// }
|
||||
|
||||
// ApplicationBaseURL = (UserFolderURL + "Groups/_custom_"
|
||||
// + list.join(",") + "/Calendar/");
|
||||
|
||||
if (event) {
|
||||
var folderID = this.parentNode.getAttribute("id");
|
||||
var urlstr = URLForFolderID(folderID);
|
||||
if (this.checked)
|
||||
if (newStatus)
|
||||
urlstr += "/activateFolder";
|
||||
else
|
||||
urlstr += "/deactivateFolder";
|
||||
@@ -1191,22 +1212,22 @@ function updateCalendarStatus(event) {
|
||||
function calendarStatusCallback(http) {
|
||||
if (http.readyState == 4) {
|
||||
if (isHttpStatus204(http.status)) {
|
||||
refreshEvents();
|
||||
refreshTasks();
|
||||
changeCalendarDisplay();
|
||||
}
|
||||
else {
|
||||
var folder = $(http.callbackData);
|
||||
var input = folder.childNodesWithTag("input")[0];
|
||||
input.checked = (!input.checked);
|
||||
}
|
||||
}
|
||||
else
|
||||
log("calendarStatusCallback Ajax error");
|
||||
refreshEvents();
|
||||
refreshTasks();
|
||||
changeCalendarDisplay();
|
||||
}
|
||||
else {
|
||||
var folder = $(http.callbackData);
|
||||
var input = folder.childNodesWithTag("input")[0];
|
||||
input.checked = (!input.checked);
|
||||
}
|
||||
}
|
||||
else
|
||||
log("calendarStatusCallback Ajax error");
|
||||
}
|
||||
|
||||
function calendarEntryCallback(http) {
|
||||
if (http.readyState == 4) {
|
||||
if (http.readyState == 4) {
|
||||
var denied = !isHttpStatus204(http.status);
|
||||
var entry = $(http.callbackData);
|
||||
if (denied)
|
||||
@@ -1288,7 +1309,10 @@ function getMenus() {
|
||||
editEvent, deleteEvent, "-",
|
||||
onSelectAll, "-",
|
||||
null, null);
|
||||
menus["calendarsMenu"] = new Array(null, null, "-", null, null, "-",
|
||||
menus["calendarsMenu"] = new Array(onMenuModify,
|
||||
"-",
|
||||
onCalendarNew, onCalendarRemove,
|
||||
"-", null, null, "-",
|
||||
null, "-", onMenuSharing);
|
||||
menus["searchMenu"] = new Array(setSearchCriteria);
|
||||
|
||||
@@ -1329,88 +1353,139 @@ function initCalendarSelector() {
|
||||
updateCalendarStatus();
|
||||
selector.changeNotification = updateCalendarsList;
|
||||
|
||||
var list = $("calendarList").childNodesWithTag("li");
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
var input = list[i].childNodesWithTag("input")[0];
|
||||
Event.observe(input, "click", updateCalendarStatus.bindAsEventListener(input)); // not registered in IE?
|
||||
//Event.observe(list[i], "mousedown", listRowMouseDownHandler, true); // problem with Safari
|
||||
Event.observe(list[i], "click", onRowClick);
|
||||
var list = $("calendarList");
|
||||
list.multiselect = true;
|
||||
var items = list.childNodesWithTag("li");
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
var input = items[i].childNodesWithTag("input")[0];
|
||||
Event.observe(input, "click", updateCalendarStatus.bindAsEventListener(input));
|
||||
Event.observe(items[i], "mousedown", listRowMouseDownHandler);
|
||||
Event.observe(items[i], "selectstart", listRowMouseDownHandler);
|
||||
Event.observe(items[i], "click", onRowClick);
|
||||
}
|
||||
|
||||
var links = $("calendarSelectorButtons").childNodesWithTag("a");
|
||||
Event.observe(links[0], "click", onCalendarAdd);
|
||||
Event.observe(links[1], "click", onCalendarRemove);
|
||||
Event.observe(links[0], "click", onCalendarNew);
|
||||
Event.observe(links[1], "click", onCalendarAdd);
|
||||
Event.observe(links[2], "click", onCalendarRemove);
|
||||
}
|
||||
|
||||
function onMenuModify(event) {
|
||||
var folders = $("calendarList");
|
||||
var selected = folders.getSelectedNodes()[0];
|
||||
|
||||
if (UserLogin == selected.getAttribute("owner")) {
|
||||
var node = selected.childNodes[4];
|
||||
var currentName = node.nodeValue.trim();
|
||||
var newName = window.prompt(labels["Address Book Name"],
|
||||
currentName);
|
||||
if (newName && newName.length > 0
|
||||
&& newName != currentName) {
|
||||
var url = (URLForFolderID(selected.getAttribute("id"))
|
||||
+ "/renameFolder?name=" + escape(newName.utf8encode()));
|
||||
triggerAjaxRequest(url, folderRenameCallback,
|
||||
{node: node, name: " " + newName});
|
||||
}
|
||||
} else
|
||||
window.alert(clabels["Unable to rename that folder!"]);
|
||||
}
|
||||
|
||||
function folderRenameCallback(http) {
|
||||
if (http.readyState == 4) {
|
||||
if (isHttpStatus204(http.status)) {
|
||||
var dict = http.callbackData;
|
||||
dict["node"].nodeValue = dict["name"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onCalendarNew(event) {
|
||||
createFolder(window.prompt(labels["Name of the Calendar"]),
|
||||
appendCalendar);
|
||||
preventDefault(event);
|
||||
}
|
||||
|
||||
function onCalendarAdd(event) {
|
||||
openUserFolderSelector(onFolderSubscribeCB, "calendar");
|
||||
|
||||
preventDefault(event);
|
||||
openUserFolderSelector(onFolderSubscribeCB, "calendar");
|
||||
preventDefault(event);
|
||||
}
|
||||
|
||||
function appendCalendar(folderName, folder) {
|
||||
var calendarList = $("calendarList");
|
||||
var lis = calendarList.childNodesWithTag("li");
|
||||
var color = indexColor(lis.length);
|
||||
//log ("color: " + color);
|
||||
if (folder)
|
||||
folder = accessToSubscribedFolder(folder);
|
||||
else
|
||||
folder = "/" + folderName;
|
||||
|
||||
var li = document.createElement("li");
|
||||
calendarList.appendChild(li);
|
||||
// log ("append: " + folderName + "; folder: " + folder);
|
||||
|
||||
var checkBox = document.createElement("input");
|
||||
checkBox.setAttribute("type", "checkbox");
|
||||
li.appendChild(checkBox);
|
||||
|
||||
li.appendChild(document.createTextNode(" "));
|
||||
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 colorBox = document.createElement("div");
|
||||
li.appendChild(colorBox);
|
||||
li.appendChild(document.createTextNode(" " + folderName));
|
||||
colorBox.appendChild(document.createTextNode("OO"));
|
||||
var li = document.createElement("li");
|
||||
calendarList.appendChild(li);
|
||||
li.setAttribute("id", folder);
|
||||
|
||||
li.setAttribute("id", folder);
|
||||
Event.observe(li, "mousedown", listRowMouseDownHandler);
|
||||
Event.observe(li, "click", onRowClick);
|
||||
$(checkBox).addClassName("checkBox");
|
||||
var checkBox = document.createElement("input");
|
||||
checkBox.setAttribute("type", "checkbox");
|
||||
li.appendChild(checkBox);
|
||||
li.appendChild(document.createTextNode(" "));
|
||||
$(checkBox).addClassName("checkBox");
|
||||
|
||||
Event.observe(checkBox, "click", updateCalendarStatus.bindAsEventListener(checkBox));
|
||||
var colorBox = document.createElement("div");
|
||||
li.appendChild(colorBox);
|
||||
li.appendChild(document.createTextNode(" " + folderName));
|
||||
colorBox.appendChild(document.createTextNode("OO"));
|
||||
|
||||
$(colorBox).addClassName("colorBox");
|
||||
if (color) {
|
||||
$(colorBox).setStyle({ color: color,
|
||||
backgroundColor: color });
|
||||
}
|
||||
$(colorBox).addClassName("colorBox");
|
||||
if (color)
|
||||
$(colorBox).setStyle({color: color,
|
||||
backgroundColor: color});
|
||||
|
||||
var contactId = folder.split(":")[0];
|
||||
var url = URLForFolderID(folder) + "/canAccessContent";
|
||||
triggerAjaxRequest(url, calendarEntryCallback, folder);
|
||||
// Register events (doesn't work with Safari)
|
||||
Event.observe(li, "mousedown", listRowMouseDownHandler);
|
||||
Event.observe(li, "selectstart", listRowMouseDownHandler);
|
||||
Event.observe(li, "click", onRowClick);
|
||||
Event.observe(checkBox, "click",
|
||||
updateCalendarStatus.bindAsEventListener(checkBox));
|
||||
|
||||
if (!document.styleSheets) return;
|
||||
var theRules = new Array();
|
||||
var lastSheet = document.styleSheets[document.styleSheets.length - 1];
|
||||
if (lastSheet.insertRule) { // Mozilla
|
||||
lastSheet.insertRule('.ownerIs' + contactId + ' {'
|
||||
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('.ownerIs' + contactId,
|
||||
}
|
||||
else { // IE
|
||||
lastSheet.addRule('.calendarFolder' + folder.substr(1),
|
||||
' background-color: '
|
||||
+ color
|
||||
+ ' !important; }');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onFolderSubscribeCB(folderData) {
|
||||
var folder = $(folderData["folder"]);
|
||||
var folder = $(folderData["folder"]);
|
||||
if (!folder)
|
||||
appendCalendar(folderData["folderName"], folderData["folder"]);
|
||||
appendCalendar(folderData["folderName"], folderData["folder"]);
|
||||
}
|
||||
|
||||
function onFolderUnsubscribeCB(folderId) {
|
||||
var node = $(folderId);
|
||||
node.parentNode.removeChild(node);
|
||||
var node = $(folderId);
|
||||
node.parentNode.removeChild(node);
|
||||
refreshEvents();
|
||||
refreshTasks();
|
||||
changeCalendarDisplay();
|
||||
}
|
||||
|
||||
function onCalendarRemove(event) {
|
||||
@@ -1418,15 +1493,59 @@ function onCalendarRemove(event) {
|
||||
if (nodes.length > 0) {
|
||||
nodes[0].deselect();
|
||||
var folderId = nodes[0].getAttribute("id");
|
||||
var folderIdElements = folderId.split(":");
|
||||
var folderIdElements = folderId.split("_");
|
||||
if (folderIdElements.length > 1) {
|
||||
unsubscribeFromFolder(folderId, onFolderUnsubscribeCB, folderId);
|
||||
unsubscribeFromFolder(folderId, onFolderUnsubscribeCB, folderId);
|
||||
}
|
||||
else {
|
||||
var calId = folderIdElements[0].substr(1);
|
||||
deletePersonalCalendar(calId);
|
||||
}
|
||||
}
|
||||
|
||||
preventDefault(event);
|
||||
}
|
||||
|
||||
function deletePersonalCalendar(folderId) {
|
||||
var label
|
||||
= labels["Are you sure you want to delete the selected calendar?"];
|
||||
if (window.confirm(label)) {
|
||||
if (document.deletePersonalCalendarAjaxRequest) {
|
||||
document.deletePersonalCalendarAjaxRequest.aborted = true;
|
||||
document.deletePersonalCalendarAjaxRequest.abort();
|
||||
}
|
||||
var url = ApplicationBaseURL + "/" + folderId + "/deleteFolder";
|
||||
document.deletePersonalCalendarAjaxRequest
|
||||
= triggerAjaxRequest(url, deletePersonalCalendarCallback, folderId);
|
||||
}
|
||||
}
|
||||
|
||||
function deletePersonalCalendarCallback(http) {
|
||||
if (http.readyState == 4) {
|
||||
if (isHttpStatus204(http.status)) {
|
||||
var ul = $("calendarList");
|
||||
var children = ul.childNodesWithTag("li");
|
||||
var i = 0;
|
||||
var done = false;
|
||||
while (!done && i < children.length) {
|
||||
var currentFolderId = children[i].getAttribute("id").substr(1);
|
||||
if (currentFolderId == http.callbackData) {
|
||||
ul.removeChild(children[i]);
|
||||
done = true;
|
||||
}
|
||||
else
|
||||
i++;
|
||||
}
|
||||
refreshEvents();
|
||||
refreshTasks();
|
||||
changeCalendarDisplay();
|
||||
}
|
||||
document.deletePersonalCalendarAjaxRequest = null;
|
||||
}
|
||||
else
|
||||
log ("ajax problem 5: " + http.status);
|
||||
}
|
||||
|
||||
function configureLists() {
|
||||
var list = $("tasksList");
|
||||
list.multiselect = true;
|
||||
@@ -1439,6 +1558,8 @@ function configureLists() {
|
||||
|
||||
list = $("eventsList");
|
||||
list.multiselect = true;
|
||||
//configureSortableTableHeaders(list);
|
||||
TableKit.Resizable.init(list, {'trueResize' : true, 'keepWidth' : true});
|
||||
Event.observe(list, "mousedown",
|
||||
onEventsSelectionChange.bindAsEventListener(list));
|
||||
var div = list.parentNode;
|
||||
|
||||
@@ -17,28 +17,31 @@ DIV.acls LABEL
|
||||
DIV#userSelectorHeader
|
||||
{ margin: 1em; }
|
||||
|
||||
DIV#userSelector SPAN
|
||||
{ display: block; }
|
||||
|
||||
INPUT#defaultRolesBtn
|
||||
{ position: absolute;
|
||||
top: 5em;
|
||||
{ no_position: absolute;
|
||||
margin-left: 1em;
|
||||
margin-top: 1em;
|
||||
left: 1em; }
|
||||
|
||||
DIV#userRoles
|
||||
{ position: absolute;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
left: 1em;
|
||||
top: 7em;
|
||||
top: 8em;
|
||||
right: 1em;
|
||||
bottom: 0px; }
|
||||
|
||||
UL#userList
|
||||
{ position: absolute;
|
||||
top: 1.5em;
|
||||
top: 2.5em;
|
||||
bottom: 0px;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
width: 100%;
|
||||
cursor: default;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
white-space: nowrap;
|
||||
overflow: auto;
|
||||
|
||||
@@ -88,8 +88,7 @@ function subscribeToFolder(refreshCallback, refreshCallbackData) {
|
||||
refreshCallbackData["folder"]);
|
||||
}
|
||||
else
|
||||
refreshCallbackData["window"].alert(clabels["You cannot subscribe to a folder that you own!"]
|
||||
.decodeEntities());
|
||||
refreshCallbackData["window"].alert(clabels["You cannot subscribe to a folder that you own!"]);
|
||||
}
|
||||
|
||||
function openRightsForUserID(userID) {
|
||||
@@ -143,4 +142,4 @@ function onAclLoadHandler() {
|
||||
this.userRightsWidth = window.opener.getUsersRightsWindowWidth();
|
||||
}
|
||||
|
||||
Event.observe(window, "load", onAclLoadHandler);
|
||||
addEvent(window, 'load', onAclLoadHandler);
|
||||
|
||||
@@ -43,36 +43,36 @@ function validateAptEditor() {
|
||||
|
||||
e = $('summary');
|
||||
if (e.value.length == 0) {
|
||||
if (!confirm(labels.validate_notitle.decodeEntities()))
|
||||
if (!confirm(labels.validate_notitle))
|
||||
return false;
|
||||
}
|
||||
|
||||
e = $('startTime_date');
|
||||
if (e.value.length != 10) {
|
||||
alert(labels.validate_invalid_startdate.decodeEntities());
|
||||
alert(labels.validate_invalid_startdate);
|
||||
return false;
|
||||
}
|
||||
startdate = e.calendar.prs_date(e.value);
|
||||
if (startdate == null) {
|
||||
alert(labels.validate_invalid_startdate.decodeEntities());
|
||||
alert(labels.validate_invalid_startdate);
|
||||
return false;
|
||||
}
|
||||
|
||||
e = $('endTime_date');
|
||||
if (e.value.length != 10) {
|
||||
alert(labels.validate_invalid_enddate.decodeEntities());
|
||||
alert(labels.validate_invalid_enddate);
|
||||
return false;
|
||||
}
|
||||
enddate = e.calendar.prs_date(e.value);
|
||||
if (enddate == null) {
|
||||
alert(labels.validate_invalid_enddate.decodeEntities());
|
||||
alert(labels.validate_invalid_enddate);
|
||||
return false;
|
||||
}
|
||||
// cuicui = '';
|
||||
tmpdate = uixEarlierDate(startdate, enddate);
|
||||
if (tmpdate == enddate) {
|
||||
// window.alert(cuicui);
|
||||
alert(labels.validate_endbeforestart.decodeEntities());
|
||||
alert(labels.validate_endbeforestart);
|
||||
return false;
|
||||
}
|
||||
else if (tmpdate == null /* means: same date */) {
|
||||
@@ -83,14 +83,14 @@ function validateAptEditor() {
|
||||
end = parseInt(document.forms[0]['endTime_time_hour'].value);
|
||||
|
||||
if (start > end) {
|
||||
alert(labels.validate_endbeforestart.decodeEntities());
|
||||
alert(labels.validate_endbeforestart);
|
||||
return false;
|
||||
}
|
||||
else if (start == end) {
|
||||
start = parseInt(document.forms[0]['startTime_time_minute'].value);
|
||||
end = parseInt(document.forms[0]['endTime_time_minute'].value);
|
||||
if (start > end) {
|
||||
alert(labels.validate_endbeforestart.decodeEntities());
|
||||
alert(labels.validate_endbeforestart);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,13 @@ DIV#freeBusyView
|
||||
-moz-border-top-colors: #9c9a94 #000;
|
||||
-moz-border-left-colors: #9c9a94 #000; }
|
||||
|
||||
TABLE#freeBusy
|
||||
{ border-collapse: collapse;
|
||||
table-layout: auto; }
|
||||
|
||||
TABLE#freeBusy THEAD TH
|
||||
{ white-space: nowrap; }
|
||||
|
||||
TABLE#freeBusy TD,
|
||||
TABLE#freeBusy TH
|
||||
{ padding: 0px;
|
||||
@@ -56,14 +63,14 @@ TABLE#freeBusy TR.freeBusyHeader2 TH,
|
||||
TABLE#freeBusy TR.freeBusyHeader3 TH
|
||||
{ text-align: left;
|
||||
color: #777;
|
||||
background: #fff;
|
||||
border-collapse: collapse; }
|
||||
background: #fff; }
|
||||
|
||||
TABLE#freeBusy TR.freeBusyHeader2 TH
|
||||
{ width: 6em; }
|
||||
{ padding-right: 2em; }
|
||||
|
||||
TABLE#freeBusy TR.freeBusyHeader3 TH
|
||||
{ border-bottom: 1px solid #cecbff; }
|
||||
{ border-left: 1px solid #fff;
|
||||
border-bottom: 1px solid #cecbff; }
|
||||
|
||||
TABLE#freeBusy TR.attendeeModel
|
||||
{ display: none; }
|
||||
@@ -84,6 +91,7 @@ TABLE#freeBusy TD.noFreeBusy
|
||||
SPAN.freeBusyZoneElement
|
||||
{ display: block;
|
||||
float: left;
|
||||
clear: right;
|
||||
width: 25%;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
|
||||
@@ -268,9 +268,9 @@ function setSlot(tds, nbr, status) {
|
||||
var td = tds[i];
|
||||
var spans = $(td).childNodesWithTag("span");
|
||||
if (status == '2')
|
||||
spans[spannbr].addClassName("maybe-busy");
|
||||
$(spans[spannbr]).addClassName("maybe-busy");
|
||||
else
|
||||
spans[spannbr].addClassName("busy");
|
||||
$(spans[spannbr]).addClassName("busy");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ function updateFreeBusyData(http) {
|
||||
var tds = node.parentNode.parentNode.cells;
|
||||
for (var i = 0; i < slots.length; i++) {
|
||||
if (slots[i] != '0')
|
||||
setSlot(tds, i, slots[i]);
|
||||
setSlot(tds, i, slots[i]);
|
||||
}
|
||||
}
|
||||
document.contactFreeBusyAjaxRequest = null;
|
||||
@@ -502,14 +502,14 @@ function prepareAttendees() {
|
||||
for (var i = 0; i < attendeesNames.length; i++) {
|
||||
var tr = body.insertRow(i);
|
||||
var td = document.createElement("td");
|
||||
td.addClassName("attendees");
|
||||
$(td).addClassName("attendees");
|
||||
var input = document.createElement("input");
|
||||
var value = "";
|
||||
if (attendeesNames[i].length > 0)
|
||||
value += attendeesNames[i] + " ";
|
||||
value += "<" + attendeesEmails[i] + ">";
|
||||
input.value = value;
|
||||
input.addClassName("textField");
|
||||
$(input).addClassName("textField");
|
||||
input.setAttribute("modified", "0");
|
||||
tr.appendChild(td);
|
||||
td.appendChild(input);
|
||||
|
||||
@@ -17,15 +17,10 @@ DIV.calendarUserRights
|
||||
|
||||
DIV.calendarUserRights > TABLE
|
||||
{ background-color: #fff;
|
||||
width: 45em;
|
||||
width: 480px;
|
||||
color: #999;
|
||||
border-collapse: collapse;
|
||||
border-bottom: 1px solid #fff;
|
||||
border-right: 1px solid #fff;
|
||||
border-top: 2px solid #222;
|
||||
border-left: 2px solid #222;
|
||||
-moz-border-top-colors: #9c9a94 #000 transparent;
|
||||
-moz-border-left-colors: #9c9a94 #000 transparent; }
|
||||
border: 1px solid #222; }
|
||||
|
||||
DIV.calendarUserRights > TABLE TR.permissions TH
|
||||
{ color: #00f;
|
||||
@@ -33,11 +28,10 @@ DIV.calendarUserRights > TABLE TR.permissions TH
|
||||
*/ border-bottom: 1px solid #999; }
|
||||
|
||||
DIV.calendarUserRights > TABLE TH
|
||||
{ width: 15em; }
|
||||
{ width: 70px; }
|
||||
|
||||
DIV.calendarUserRights > TABLE TD.eventType
|
||||
{ width: 5em;
|
||||
text-align: right;
|
||||
{ text-align: right;
|
||||
border-right: 1px solid #999; }
|
||||
|
||||
DIV.calendarUserRights > TABLE TD
|
||||
|
||||
@@ -3,7 +3,7 @@ function onCancelClick(event) {
|
||||
}
|
||||
|
||||
function initACLButtons() {
|
||||
$("cancelButton").addEventListener("click", onCancelClick, false);
|
||||
Event.observe($("cancelButton"), "click", onCancelClick);
|
||||
}
|
||||
|
||||
window.addEventListener("load", initACLButtons, false);
|
||||
addEvent(window, "load", initACLButtons);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function onPopupAttendeesWindow(event) {
|
||||
if (event)
|
||||
preventDefault(event);
|
||||
window.open(ApplicationBaseURL + "editAttendees", null,
|
||||
window.open(ApplicationBaseURL + "/editAttendees", null,
|
||||
"width=803,height=573");
|
||||
|
||||
return false;
|
||||
@@ -24,7 +24,7 @@ function onPopupUrlWindow(event) {
|
||||
preventDefault(event);
|
||||
|
||||
var urlInput = document.getElementById("url");
|
||||
var newUrl = window.prompt(labels["Target:"].decodeEntities(), urlInput.value);
|
||||
var newUrl = window.prompt(labels["Target:"], urlInput.value);
|
||||
if (newUrl != null) {
|
||||
var documentHref = $("documentHref");
|
||||
var documentLabel = $("documentLabel");
|
||||
@@ -74,13 +74,7 @@ function onChangeCalendar(event) {
|
||||
var form = document.forms["editform"];
|
||||
var urlElems = form.getAttribute("action").split("/");
|
||||
var choice = calendars[this.value];
|
||||
var ownerLogin;
|
||||
if (choice.indexOf(":") > -1)
|
||||
ownerLogin = choice.split(":")[0];
|
||||
else
|
||||
ownerLogin = UserLogin;
|
||||
urlElems[urlElems.length-4] = ownerLogin;
|
||||
|
||||
urlElems[urlElems.length-3] = choice;
|
||||
form.setAttribute("action", urlElems.join("/"));
|
||||
}
|
||||
|
||||
@@ -170,7 +164,7 @@ function onComponentEditorLoad(event) {
|
||||
|
||||
var menuItems = $("itemPrivacyList").childNodesWithTag("li");
|
||||
for (var i = 0; i < menuItems.length; i++)
|
||||
Event.observe(menuItems[i], "mouseup",
|
||||
Event.observe(menuItems[i], "mousedown",
|
||||
onMenuSetClassification.bindAsEventListener(menuItems[i]),
|
||||
false);
|
||||
}
|
||||
|
||||
@@ -84,13 +84,13 @@ function validateContactEditor() {
|
||||
if (e.value.length == 0)
|
||||
return true;
|
||||
if (uixEmailRegex.test(e.value) != true)
|
||||
return confirm(labels.invalidemailwarn.decodeEntities());
|
||||
return confirm(labels.invalidemailwarn);
|
||||
|
||||
e = $('homeMail');
|
||||
if (e.value.length == 0)
|
||||
return true;
|
||||
if (uixEmailRegex.test(e.value) != true)
|
||||
return confirm(labels.invalidemailwarn.decodeEntities());
|
||||
return confirm(labels.invalidemailwarn);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ function addLineToTree(tree, parent, line) {
|
||||
|| nodes.length > 1) {
|
||||
var parentNode = nodes[0];
|
||||
var userInfos = parentNode.split(":");
|
||||
var email = userInfos[1] + " <" + userInfos[2] + ">";
|
||||
var email = userInfos[1] + " <" + userInfos[2] + ">";
|
||||
tree.add(parent, 0, email, 0, '#', userInfos[0], 'person',
|
||||
'', '',
|
||||
ResourcesURL + '/abcard.gif',
|
||||
@@ -30,12 +30,16 @@ function addLineToTree(tree, parent, line) {
|
||||
for (var i = 1; i < nodes.length; i++) {
|
||||
var folderInfos = nodes[i].split(":");
|
||||
var icon = ResourcesURL + '/';
|
||||
if (folderInfos[2] == 'contact')
|
||||
if (folderInfos[2] == 'Contacts')
|
||||
icon += 'tb-mail-addressbook-flat-16x16.png';
|
||||
else
|
||||
icon += 'calendar-folder-16x16.png';
|
||||
var folderId = userInfos[0] + ":" + folderInfos[1];
|
||||
tree.add(parent + i, parent, folderInfos[0], 0, '#', folderId,
|
||||
var name = folderInfos[0]; // name has the format "Folername (Firstname Lastname <email>)"
|
||||
var pos = name.indexOf(' (')
|
||||
if (pos !== -1)
|
||||
name = name.substring(0, pos); // strip the part with fullname and email
|
||||
tree.add(parent + i, parent, name, 0, '#', folderId,
|
||||
folderInfos[2] + '-folder', '', '', icon, icon);
|
||||
}
|
||||
offset = nodes.length - 1;
|
||||
|
||||
@@ -3,7 +3,8 @@ function onCancelClick(event) {
|
||||
}
|
||||
|
||||
function initACLButtons() {
|
||||
$("cancelButton").addEventListener("click", onCancelClick, false);
|
||||
var button = $("cancelButton");
|
||||
Event.observe(button, "click", onCancelClick);
|
||||
}
|
||||
|
||||
window.addEventListener("load", initACLButtons, false);
|
||||
addEvent(window, "load", initACLButtons);
|
||||
|
||||
@@ -1,47 +1,41 @@
|
||||
/* CSS for compose panel */
|
||||
|
||||
div#compose_panel div table {
|
||||
padding: 2px;
|
||||
}
|
||||
div#compose_panel div table
|
||||
{ padding: 2px; }
|
||||
|
||||
TABLE#compose_table, TABLE#compose_table DIV
|
||||
{
|
||||
width: 100%;
|
||||
}
|
||||
{ width: 100%; }
|
||||
|
||||
TABLE#compose_label
|
||||
{
|
||||
text-align: right;
|
||||
}
|
||||
{ text-align: right; }
|
||||
|
||||
DIV#addressList
|
||||
{ height: 8em;
|
||||
margin-bottom: .25em;
|
||||
{ clear: left;
|
||||
height: 8em;
|
||||
overflow: auto;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
DIV.addressListElement
|
||||
{ margin: 0px;
|
||||
padding: 0px; }
|
||||
|
||||
SPAN.headerField
|
||||
{ line-height: 1.8em;
|
||||
width: 5em;
|
||||
text-align: right; }
|
||||
float: left;
|
||||
clear: left;
|
||||
text-align: right;
|
||||
min-width: 7em;
|
||||
padding-left: 0.5em; }
|
||||
|
||||
SPAN.headerInput INPUT
|
||||
{ width: 100%;
|
||||
padding-left: 24px;
|
||||
{ padding-left: 24px; /* offset text input */
|
||||
padding-right: 4px;
|
||||
background-image: url('/SOGo.woa/WebServerResources/abcard.gif');
|
||||
background-repeat: no-repeat;
|
||||
background-position: 2px center;
|
||||
margin-right: -12em; }
|
||||
background-position: 2px center; }
|
||||
|
||||
DIV#subjectRow INPUT
|
||||
{ background-image: none;
|
||||
width: 100%;
|
||||
padding-left: .5em; }
|
||||
padding-left: 4px; /* offset text input */
|
||||
padding-right: 4px; }
|
||||
|
||||
div#compose_internetmarker
|
||||
{ padding: 8px;
|
||||
@@ -52,8 +46,7 @@ div#compose_internetmarker
|
||||
border-style: solid; }
|
||||
|
||||
div#headerArea
|
||||
{ border-top: 1px solid #fff;
|
||||
border-bottom: 1px solid #848284; }
|
||||
{ border-top: 1px solid #fff; }
|
||||
|
||||
div#attachmentsArea
|
||||
{ display: none;
|
||||
@@ -65,13 +58,25 @@ div#attachmentsArea
|
||||
padding-left: 5px;
|
||||
border-left: 1px solid #888; }
|
||||
|
||||
hr
|
||||
{ background-color: #848284;
|
||||
border: 0;
|
||||
clear: both;
|
||||
color: #848284;
|
||||
float: left;
|
||||
height: 1px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
width: 100%; }
|
||||
|
||||
input.currentAttachment
|
||||
{ position: absolute;
|
||||
top: 1em;
|
||||
right: 1em; }
|
||||
|
||||
input.attachment
|
||||
{ display: none; }
|
||||
{ position: absolute;
|
||||
left: -1000px; }
|
||||
|
||||
div#compose_attachments_list
|
||||
{ background-color: #ffffff;
|
||||
@@ -88,8 +93,7 @@ UL#attachments
|
||||
{ cursor: default;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
width: 100%;
|
||||
height: 10em;
|
||||
height: 9em;
|
||||
border-bottom: 1px solid #fff;
|
||||
border-right: 1px solid #fff;
|
||||
border-top: 2px solid #222;
|
||||
@@ -109,10 +113,10 @@ UL#attachments LI
|
||||
UL#attachments LI IMG
|
||||
{ vertical-align: bottom; }
|
||||
|
||||
DIV.pageContent TEXTAREA
|
||||
#pageContent TEXTAREA
|
||||
{ position: absolute;
|
||||
left: 0em;
|
||||
right: 0em;
|
||||
bottom: 0em;
|
||||
top: 17em;
|
||||
top: 13em;
|
||||
width: 100%; }
|
||||
|
||||
@@ -9,7 +9,6 @@ function onContactAdd() {
|
||||
urlstr += '/';
|
||||
urlstr += ("../../" + UserLogin + "/Contacts/"
|
||||
+ contactSelectorAction + selectorURL);
|
||||
// log (urlstr);
|
||||
var w = window.open(urlstr, "Addressbook",
|
||||
"width=640,height=400,resizable=1,scrollbars=0");
|
||||
w.selector = selector;
|
||||
@@ -133,8 +132,7 @@ function validateEditorInput(sender) {
|
||||
errortext = errortext + labels.error_missingrecipients + "\n";
|
||||
|
||||
if (errortext.length > 0) {
|
||||
alert(labels.error_validationfailed.decodeEntities() + ":\n"
|
||||
+ errortext.decodeEntities());
|
||||
alert(labels.error_validationfailed + ":\n" + errortext);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -153,9 +151,20 @@ function clickedEditorSend(sender) {
|
||||
|
||||
function clickedEditorAttach(sender) {
|
||||
var area = $("attachmentsArea");
|
||||
area.setStyle({ display: "block" });
|
||||
|
||||
|
||||
if (!area.style.display) {
|
||||
area.setStyle({ display: "block" });
|
||||
onWindowResize(null);
|
||||
}
|
||||
|
||||
var inputs = area.getElementsByTagName("input");
|
||||
|
||||
// Verify if there's already a visible file input field
|
||||
for (var i = 0; i < inputs.length; i++)
|
||||
if ($(inputs[i]).hasClassName("currentAttachment"))
|
||||
return false;
|
||||
|
||||
// Add new file input field
|
||||
var attachmentName = "attachment" + inputs.length;
|
||||
var newAttachment = createElement("input", attachmentName,
|
||||
"currentAttachment", null,
|
||||
@@ -169,16 +178,7 @@ function clickedEditorAttach(sender) {
|
||||
}
|
||||
|
||||
function onAddAttachment() {
|
||||
var area = $("attachmentsArea");
|
||||
var inputs = area.getElementsByTagName("input");
|
||||
var attachmentName = "attachment" + inputs.length;
|
||||
var newAttachment = createElement("input", attachmentName,
|
||||
"currentAttachment", null,
|
||||
{ type: "file",
|
||||
name: attachmentName },
|
||||
area);
|
||||
Event.observe(newAttachment, "change",
|
||||
onAttachmentChange.bindAsEventListener(newAttachment));
|
||||
return clickedEditorAttach(null);
|
||||
}
|
||||
|
||||
function onAttachmentChange(event) {
|
||||
@@ -214,6 +214,7 @@ function clickedEditorSave(sender) {
|
||||
document.pageform.action = "save";
|
||||
document.pageform.submit();
|
||||
|
||||
refreshMailbox();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -289,11 +290,40 @@ function onSelectAllAttachments() {
|
||||
function onWindowResize(event) {
|
||||
var textarea = document.pageform.text;
|
||||
var windowheight = (typeof self.innerHeight == "number" ? self.innerHeight : document.body.clientHeight);
|
||||
var textareaoffset = textarea.offsetTop;
|
||||
var rowheight = (Element.getHeight(textarea) / textarea.rows);
|
||||
var headerarea = $("headerArea");
|
||||
|
||||
// Set textarea position
|
||||
textarea.setStyle({ 'top': (headerarea.getHeight() + headerarea.offsetTop) + 'px' });
|
||||
|
||||
var textareaoffset = textarea.offsetTop;
|
||||
|
||||
// Resize the textarea (message content)
|
||||
textarea.rows = Math.round((windowheight - textareaoffset) / rowheight);
|
||||
log ("onWindowResize new number of rows = " + textarea.rows);
|
||||
|
||||
var attachmentsarea = $("attachmentsArea");
|
||||
var attachmentswidth = 0;
|
||||
if (attachmentsarea.style.display)
|
||||
attachmentswidth = attachmentsarea.getWidth();
|
||||
var windowwidth = (typeof self.innerWidth == "number" ? self.innerWidth : document.body.clientWidth);
|
||||
var subjectfield = $(document).getElementsByClassName('headerField', $('subjectRow'))[0];
|
||||
var subjectinput = $(document).getElementsByClassName('textField', $('subjectRow'))[0];
|
||||
|
||||
// Resize subject field
|
||||
subjectinput.setStyle({ width: (windowwidth
|
||||
- $(subjectfield).getWidth()
|
||||
- attachmentswidth
|
||||
- 4 - 30
|
||||
) + 'px' });
|
||||
|
||||
// Resize address fields
|
||||
var addresslist = $('addressList');
|
||||
var firstselect = document.getElementsByClassName('headerField', addresslist)[0];
|
||||
var inputwidth = windowwidth - $(firstselect).getWidth() - attachmentswidth - 24 - 30;
|
||||
var addresses = document.getElementsByClassName('textField', addresslist);
|
||||
for (var i = 0; i < addresses.length; i++) {
|
||||
addresses[i].setStyle({ width: inputwidth + 'px' });
|
||||
}
|
||||
}
|
||||
|
||||
function onMailEditorClose(event) {
|
||||
@@ -304,11 +334,12 @@ function onMailEditorClose(event) {
|
||||
var parts = url.split("/");
|
||||
parts[parts.length-1] = "delete";
|
||||
url = parts.join("/");
|
||||
|
||||
http = createHTTPClient();
|
||||
http.open("POST", url, false /* not async */);
|
||||
http.send("");
|
||||
}
|
||||
|
||||
Event.stopObserving(window, "beforeunload", onMailEditorClose);
|
||||
}
|
||||
|
||||
addEvent(window, 'load', initMailEditor);
|
||||
|
||||
@@ -121,15 +121,15 @@ function fancyAddRow(shouldEdit, text) {
|
||||
input.select();
|
||||
input.setAttribute('autocomplete', 'on');
|
||||
}
|
||||
// this.adjustInlineAttachmentListHeight(this);
|
||||
}
|
||||
|
||||
function addressFieldGotFocus(sender) {
|
||||
var idx;
|
||||
|
||||
idx = this.getIndexFromIdentifier(sender.id);
|
||||
if ((lastIndex == idx) || (idx == 0)) return;
|
||||
if (lastIndex == idx) return;
|
||||
this.removeLastEditedRowIfEmpty();
|
||||
onWindowResize(null);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -156,7 +156,6 @@ function removeLastEditedRowIfEmpty() {
|
||||
addressList = $("addressList");
|
||||
senderRow = $("row_" + idx);
|
||||
addressList.removeChild(senderRow);
|
||||
this.adjustInlineAttachmentListHeight(this);
|
||||
}
|
||||
|
||||
function findAddressWithIndex(idx) {
|
||||
@@ -225,21 +224,5 @@ function UIxRecipientSelectorHasRecipients() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function adjustInlineAttachmentListHeight(sender) {
|
||||
var e;
|
||||
|
||||
e = $('attachmentsArea');
|
||||
if (e.style.display != 'none') {
|
||||
/* need to lower left size first, because left auto-adjusts to right! */
|
||||
xHeight('compose_attachments_list', 10);
|
||||
|
||||
var leftHeight, rightHeaderHeight;
|
||||
leftHeight = xHeight('compose_leftside');
|
||||
rightHeaderHeight = xHeight('compose_attachments_header');
|
||||
xHeight('compose_attachments_list',
|
||||
(leftHeight - rightHeaderHeight) - 16);
|
||||
}
|
||||
}
|
||||
|
||||
/* addressbook helpers */
|
||||
|
||||
|
||||
@@ -6,4 +6,4 @@ function initACLButtons() {
|
||||
$("cancelButton").addEventListener("click", onCancelClick, false);
|
||||
}
|
||||
|
||||
window.addEventListener("load", initACLButtons, false);
|
||||
addEvent(window, "load", initACLButtons);
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
function onPrintCurrentMessage(event) {
|
||||
window.print();
|
||||
|
||||
preventDefault(event);
|
||||
}
|
||||
@@ -5,30 +5,20 @@ DIV#preferencesTabs
|
||||
right: .5em;
|
||||
bottom: .5em; }
|
||||
|
||||
DIV#dateTimeFormat,
|
||||
DIV#passwordView
|
||||
{ text-align: right; }
|
||||
|
||||
DIV#outOfOfficeView
|
||||
DIV#general
|
||||
{ padding-top: 2em;
|
||||
padding-left: 2em;
|
||||
padding-right: 5em; }
|
||||
|
||||
DIV#outOfOfficeView LABEL
|
||||
DIV#general LABEL
|
||||
{ text-align: left;
|
||||
margin-left: 0px;
|
||||
white-space: normal; }
|
||||
|
||||
DIV#outOfOfficeView TEXTAREA
|
||||
{ width: 30em;
|
||||
margin: 0px;
|
||||
DIV#mailOptionsView TEXTAREA
|
||||
{ width: 420px;
|
||||
height: 4em; }
|
||||
|
||||
DIV#dateTimeView
|
||||
{ padding-top: 3em;
|
||||
padding-left: 1em;
|
||||
padding-right: 2em; }
|
||||
|
||||
DIV#passwordView
|
||||
{ padding-top: 3em;
|
||||
padding-right: 10em; }
|
||||
|
||||
@@ -24,7 +24,7 @@ function validateDate(date, label) {
|
||||
|
||||
dateValue = date.calendar.prs_date(date.value);
|
||||
if (date.value.length != 10 || !dateValue) {
|
||||
alert(label.decodeEntities());
|
||||
alert(label);
|
||||
result = false;
|
||||
} else
|
||||
result = dateValue;
|
||||
@@ -37,7 +37,7 @@ function validateTaskEditor() {
|
||||
|
||||
e = document.getElementById('summary');
|
||||
if (e.value.length == 0
|
||||
&& !confirm(labels.validate_notitle.decodeEntities()))
|
||||
&& !confirm(labels.validate_notitle))
|
||||
return false;
|
||||
|
||||
e = document.getElementById('startTime_date');
|
||||
@@ -58,7 +58,7 @@ function validateTaskEditor() {
|
||||
tmpdate = uixEarlierDate(startdate, enddate);
|
||||
if (tmpdate == enddate) {
|
||||
// window.alert(cuicui);
|
||||
alert(labels.validate_endbeforestart.decodeEntities());
|
||||
alert(labels.validate_endbeforestart);
|
||||
return false;
|
||||
}
|
||||
else if (tmpdate == null /* means: same date */) {
|
||||
@@ -69,14 +69,14 @@ function validateTaskEditor() {
|
||||
end = parseInt(document.forms[0]['dueTime_time_hour'].value);
|
||||
|
||||
if (start > end) {
|
||||
alert(labels.validate_endbeforestart.decodeEntities());
|
||||
alert(labels.validate_endbeforestart);
|
||||
return false;
|
||||
}
|
||||
else if (start == end) {
|
||||
start = parseInt(document.forms[0]['startTime_time_minute'].value);
|
||||
end = parseInt(document.forms[0]['dueTime_time_minute'].value);
|
||||
if (start > end) {
|
||||
alert(labels.validate_endbeforestart.decodeEntities());
|
||||
alert(labels.validate_endbeforestart);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 971 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
@@ -33,7 +33,7 @@ IMG#progressIndicator
|
||||
margin-top: 1.5em;
|
||||
margin-right: 1em; }
|
||||
|
||||
DIV.pageContent
|
||||
DIV#pageContent
|
||||
{ /* position: absolute;
|
||||
background-color: #ffa;
|
||||
top: 3em;
|
||||
@@ -54,13 +54,11 @@ LABEL
|
||||
margin-left: .5em; }
|
||||
|
||||
TABLE
|
||||
{ display: block;
|
||||
table-layout: fixed;
|
||||
{ table-layout: fixed;
|
||||
border-spacing: 0px; }
|
||||
|
||||
TABLE TD
|
||||
{ white-space: nowrap;
|
||||
padding-left: .25em;
|
||||
{ padding-left: .25em;
|
||||
padding-right: .25em; }
|
||||
|
||||
a:link
|
||||
@@ -94,7 +92,7 @@ div#header
|
||||
{ margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
padding: 0;
|
||||
border-bottom: 1px solid #000000; }
|
||||
border-bottom: 1px solid #000; }
|
||||
|
||||
div#header img.headerlogo
|
||||
{ float: right;
|
||||
@@ -155,6 +153,12 @@ DIV.linkbanner A
|
||||
DIV.linkbanner A:hover
|
||||
{ color: #dd5; }
|
||||
|
||||
DIV.linkbanner A#logoff
|
||||
{ float: right;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
padding-right: .5em; }
|
||||
|
||||
.linkbannerlinks
|
||||
{ vertical-align: bottom;
|
||||
text-align: left; }
|
||||
@@ -194,6 +198,7 @@ TEXTAREA
|
||||
|
||||
DIV, TEXTAREA, INPUT, SELECT
|
||||
{ font-family: inherit;
|
||||
font-size: 8pt;
|
||||
font-size: inherit; }
|
||||
|
||||
TEXTAREA, INPUT.textField
|
||||
@@ -207,8 +212,7 @@ TEXTAREA, INPUT.textField
|
||||
-moz-border-left-colors: #9c9a94 #000 transparent; }
|
||||
|
||||
INPUT.textField
|
||||
{ line-height: 2em;
|
||||
vertical-align: middle; }
|
||||
{ vertical-align: middle; }
|
||||
|
||||
DIV#toolbar
|
||||
{ left: 0px;
|
||||
@@ -348,6 +352,19 @@ SPAN.toolbarButton:active
|
||||
.menu LI.submenu:hover, .menu LI.submenu-selected
|
||||
{ background-image: url('submenu-active.gif') !important; }
|
||||
|
||||
/* live search popup menu */
|
||||
UL#searchOptions LI
|
||||
{ list-style-position: inside;
|
||||
list-style-image: url("menu-nocheck.gif");
|
||||
padding: 1px 3px;
|
||||
margin: 0px; }
|
||||
|
||||
UL#searchOptions LI._chosen
|
||||
{ list-style-image: url("menu-check.gif"); }
|
||||
|
||||
UL#searchOptions LI._chosen:hover
|
||||
{ list-style-image: url("menu-check-hover.gif"); }
|
||||
|
||||
DIV#logConsole
|
||||
{ position: absolute;
|
||||
overflow: auto;
|
||||
@@ -360,7 +377,7 @@ DIV#logConsole
|
||||
-moz-border-top-colors: #000 #9c9a94 transparent;
|
||||
-moz-border-left-colors: #000 #9c9a94 transparent;
|
||||
font-family: monospace;
|
||||
font-size: 12pt;
|
||||
font-size: 9pt;
|
||||
padding: .25em;
|
||||
background-color: #fff;
|
||||
overflow-y: scroll;
|
||||
@@ -398,8 +415,7 @@ TD.tbtv_navcell
|
||||
-moz-border-bottom-colors: #000 #9c9a94 transparent;
|
||||
-moz-border-right-colors: #000 #9c9a94 transparent; }
|
||||
|
||||
TD.headerCell:active,
|
||||
TD.tbtv_headercell:active
|
||||
TD.sortableTableHeader:active
|
||||
{ background-color: #dcdad5;
|
||||
padding-top: 2px;
|
||||
border-top: 1px solid #9c9a94;
|
||||
@@ -408,18 +424,16 @@ TD.tbtv_headercell:active
|
||||
border-bottom: 1px solid #9c9a94; }
|
||||
|
||||
TD.headerCell SPAN,
|
||||
td.tbtv_headercell SPAN
|
||||
{ float: left;
|
||||
width: 100%; }
|
||||
TD.tbtv_headercell SPAN
|
||||
{ float: left; }
|
||||
|
||||
td.tbtv_headercell a
|
||||
TD.tbtv_headercell A
|
||||
{ cursor: default;
|
||||
margin: 0px auto;
|
||||
display: block;
|
||||
color: black;
|
||||
width: 100%; }
|
||||
color: black; }
|
||||
|
||||
td.tbtv_headercell a:hover
|
||||
TD.tbtv_headercell A:hover
|
||||
{ margin: 0px auto;
|
||||
display: block;
|
||||
color: black;
|
||||
@@ -429,7 +443,7 @@ td.tbtv_headercell a:hover
|
||||
|
||||
IMG.sortImage,
|
||||
TD.headerCell IMG.tbtv_sortcell,
|
||||
td.tbtv_headercell img.tbtv_sortcell
|
||||
TD.tbtv_headercell IMG.tbtv_sortcell
|
||||
{ float: right;
|
||||
text-align: right;
|
||||
border: 0px;
|
||||
@@ -446,8 +460,7 @@ TR.tableview TD
|
||||
padding-right: .3em; }
|
||||
|
||||
TD.headerDateTime
|
||||
{ width: 30em;
|
||||
min-width: 30em; }
|
||||
{ min-width: 30em; }
|
||||
|
||||
TD.headerTitle
|
||||
{ width: 30%; }
|
||||
@@ -465,8 +478,7 @@ td img.tbtv_sortcell
|
||||
|
||||
TD.subjectCell,
|
||||
td.tbtv_subject_headercell
|
||||
{ overflow: hidden;
|
||||
width: auto; }
|
||||
{ overflow: hidden; }
|
||||
|
||||
/* drag handles */
|
||||
DIV.dragHandle
|
||||
@@ -554,7 +566,7 @@ INPUT.button,
|
||||
A.button,
|
||||
A[class~="_disabled"].button:active
|
||||
{ cursor: default;
|
||||
padding: 1px .5em;
|
||||
padding: 1px 0.5em;
|
||||
background-color: #d4d0c8;
|
||||
border-top: 2px solid #fff;
|
||||
border-left: 2px solid #fff;
|
||||
@@ -688,6 +700,20 @@ INPUT.checkBox
|
||||
-moz-border-bottom-colors: #000 #fff;
|
||||
-moz-border-right-colors: #000 #fff; }
|
||||
|
||||
/* tablekit resizable columns */
|
||||
|
||||
TABLE TD.resize-handle-active
|
||||
{ cursor: e-resize; }
|
||||
|
||||
DIV.resize-handle
|
||||
{ cursor: e-resize;
|
||||
width: 2px;
|
||||
border-right: 1px solid #fff;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
max-height: 2em; }
|
||||
|
||||
@media print
|
||||
{
|
||||
BODY
|
||||
|
||||
+251
-136
@@ -32,6 +32,8 @@ var menus = new Array();
|
||||
var search = {};
|
||||
var sorting = {};
|
||||
|
||||
var lastClickedRow = null;
|
||||
|
||||
var weekStartIsMonday = true;
|
||||
|
||||
// logArea = null;
|
||||
@@ -309,19 +311,30 @@ function triggerAjaxRequest(url, callback, userdata) {
|
||||
return http;
|
||||
}
|
||||
|
||||
function startAnimation(parent, nextNode) {
|
||||
var anim = $("progressIndicator");
|
||||
if (anim) return anim;
|
||||
|
||||
anim = document.createElement("img");
|
||||
anim = $(anim);
|
||||
anim.id = "progressIndicator";
|
||||
anim.src = ResourcesURL + "/busy.gif";
|
||||
anim.setStyle({ visibility: "hidden" });
|
||||
if (nextNode)
|
||||
parent.insertBefore(anim, nextNode);
|
||||
else
|
||||
parent.appendChild(anim);
|
||||
anim.setStyle({ visibility: "visible" });
|
||||
|
||||
return anim;
|
||||
}
|
||||
|
||||
function checkAjaxRequestsState() {
|
||||
var toolbar = document.getElementById("toolbar");
|
||||
if (toolbar) {
|
||||
if (activeAjaxRequests > 0
|
||||
&& !document.busyAnim) {
|
||||
var anim = document.createElement("img");
|
||||
anim = $(anim);
|
||||
document.busyAnim = anim;
|
||||
anim.id = "progressIndicator";
|
||||
anim.src = ResourcesURL + "/busy.gif";
|
||||
anim.setStyle({ visibility: "hidden" });
|
||||
toolbar.appendChild(anim);
|
||||
anim.setStyle({ visibility: "visible" });
|
||||
document.busyAnim = startAnimation(toolbar);
|
||||
}
|
||||
else if (activeAjaxRequests == 0
|
||||
&& document.busyAnim
|
||||
@@ -332,6 +345,10 @@ function checkAjaxRequestsState() {
|
||||
}
|
||||
}
|
||||
|
||||
function isSafari3() {
|
||||
return (navigator.appVersion.indexOf("Version") > -1);
|
||||
}
|
||||
|
||||
function isSafari() {
|
||||
//var agt = navigator.userAgent.toLowerCase();
|
||||
//var is_safari = ((agt.indexOf('safari')!=-1)&&(agt.indexOf('mac')!=-1))?true:false;
|
||||
@@ -356,8 +373,8 @@ function getTarget(event) {
|
||||
function preventDefault(event) {
|
||||
if (event.preventDefault)
|
||||
event.preventDefault(); // W3C DOM
|
||||
|
||||
event.returnValue = false; // IE
|
||||
else
|
||||
event.returnValue = false; // IE
|
||||
}
|
||||
|
||||
function resetSelection(win) {
|
||||
@@ -472,7 +489,7 @@ function isNodeSelected(node) {
|
||||
function acceptMultiSelect(node) {
|
||||
var response = false;
|
||||
var attribute = node.getAttribute('multiselect');
|
||||
if (attribute) {
|
||||
if (attribute && attribute.length > 0) {
|
||||
log("node '" + node.getAttribute("id")
|
||||
+ "' is still using old-stylemultiselect!");
|
||||
response = (attribute.toLowerCase() == 'yes');
|
||||
@@ -485,43 +502,63 @@ function acceptMultiSelect(node) {
|
||||
|
||||
function onRowClick(event) {
|
||||
var node = getTarget(event);
|
||||
var rowIndex = null;
|
||||
|
||||
if (node.tagName == 'TD')
|
||||
node = node.parentNode;
|
||||
var startSelection = $(node.parentNode).getSelectedNodes();
|
||||
if (event.shiftKey == 1
|
||||
if (node.tagName == 'TD') {
|
||||
node = node.parentNode; // select TR
|
||||
rowIndex = node.rowIndex - $(node).up('table').down('thead').getElementsByTagName('tr').length;
|
||||
}
|
||||
else if (node.tagName == 'LI') {
|
||||
// Find index of clicked row
|
||||
var list = node.parentNode;
|
||||
var items = list.childNodesWithTag("li");
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
if (items[i] == node) {
|
||||
rowIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var initialSelection = $(node.parentNode).getSelectedNodes();
|
||||
if ((event.shiftKey == 1 || event.ctrlKey == 1)
|
||||
&& lastClickedRow
|
||||
&& (acceptMultiSelect(node.parentNode)
|
||||
|| acceptMultiSelect(node.parentNode.parentNode))) {
|
||||
if (isNodeSelected(node) == true) {
|
||||
if (event.shiftKey)
|
||||
$(node.parentNode).selectRange(lastClickedRow, rowIndex);
|
||||
else if (isNodeSelected(node) == true) {
|
||||
$(node).deselect();
|
||||
} else {
|
||||
$(node).select();
|
||||
}
|
||||
// At this point, should empty content of 3-pane view
|
||||
} else {
|
||||
// Single line selection
|
||||
$(node.parentNode).deselectAll();
|
||||
$(node).select();
|
||||
}
|
||||
|
||||
if (startSelection != $(node.parentNode).getSelectedNodes()) {
|
||||
var parentNode = node.parentNode;
|
||||
if (parentNode.tagName == 'TBODY')
|
||||
parentNode = parentNode.parentNode;
|
||||
//log("onRowClick: parentNode = " + parentNode.tagName);
|
||||
// parentNode is UL or TABLE
|
||||
if (document.createEvent) {
|
||||
var onSelectionChangeEvent;
|
||||
if (isSafari())
|
||||
onSelectionChangeEvent = document.createEvent("UIEvents");
|
||||
else
|
||||
onSelectionChangeEvent = document.createEvent("Events");
|
||||
onSelectionChangeEvent.initEvent("mousedown", true, true);
|
||||
parentNode.dispatchEvent(onSelectionChangeEvent);
|
||||
}
|
||||
else if (document.createEventObject) {
|
||||
parentNode.fireEvent("onmousedown");
|
||||
|
||||
if (initialSelection != $(node.parentNode).getSelectedNodes()) {
|
||||
// Selection has changed; fire mousedown event
|
||||
var parentNode = node.parentNode;
|
||||
if (parentNode.tagName == 'TBODY')
|
||||
parentNode = parentNode.parentNode;
|
||||
if (document.createEvent) {
|
||||
var onSelectionChangeEvent;
|
||||
if (isSafari())
|
||||
onSelectionChangeEvent = document.createEvent("UIEvents");
|
||||
else
|
||||
onSelectionChangeEvent = document.createEvent("Events");
|
||||
onSelectionChangeEvent.initEvent("mousedown", true, true);
|
||||
parentNode.dispatchEvent(onSelectionChangeEvent);
|
||||
}
|
||||
else if (document.createEventObject) {
|
||||
parentNode.fireEvent("onmousedown");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lastClickedRow = rowIndex;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -536,7 +573,7 @@ function popupMenu(event, menuId, target) {
|
||||
hideMenu(document.currentPopupMenu);
|
||||
|
||||
var popup = $(menuId);
|
||||
var menuTop = Event.pointerY(event);
|
||||
var menuTop = Event.pointerY(event);
|
||||
var menuLeft = Event.pointerX(event);
|
||||
var heightDiff = (window.innerHeight
|
||||
- (menuTop + popup.offsetHeight));
|
||||
@@ -584,7 +621,7 @@ function onBodyClickMenuHandler(event) {
|
||||
preventDefault(event);
|
||||
}
|
||||
|
||||
function hideMenu(menuNode) { //log ("hideMenu");
|
||||
function hideMenu(menuNode) {
|
||||
var onHide;
|
||||
|
||||
if (menuNode.submenu) {
|
||||
@@ -595,19 +632,22 @@ function hideMenu(menuNode) { //log ("hideMenu");
|
||||
menuNode.setStyle({ visibility: "hidden" });
|
||||
// menuNode.hide();
|
||||
if (menuNode.parentMenuItem) {
|
||||
Event.stopObserving(menuNode.parentMenuItem, "mousemove", onMouseEnteredSubmenu);
|
||||
Event.stopObserving(menuNode, "mousemove", onMouseEnteredSubmenu);
|
||||
Event.stopObserving(menuNode.parentMenuItem, "mouseout", onMouseLeftSubmenu);
|
||||
Event.stopObserving(menuNode, "mouseout", onMouseLeftSubmenu);
|
||||
menuNode.parentMenuItem.setAttribute('class', 'submenu');
|
||||
menuNode.parentMenuItem = null;
|
||||
menuNode.parentMenu.setAttribute('onmousemove', null);
|
||||
menuNode.parentMenu.submenuItem = null;
|
||||
menuNode.parentMenu.submenu = null;
|
||||
menuNode.parentMenu = null;
|
||||
}
|
||||
|
||||
if (document.createEvent) {
|
||||
if (document.createEvent) { // Safari & Mozilla
|
||||
var onhideEvent;
|
||||
if (isSafari())
|
||||
onhideEvent = document.createEvent("UIEvents");
|
||||
else // Mozilla
|
||||
else
|
||||
onhideEvent = document.createEvent("Events");
|
||||
onhideEvent.initEvent("mousedown", false, true);
|
||||
menuNode.dispatchEvent(onhideEvent);
|
||||
@@ -621,7 +661,6 @@ function onMenuEntryClick(event) {
|
||||
var node = event.target;
|
||||
|
||||
id = getParentMenu(node).menuTarget;
|
||||
// log("clicked " + id + "/" + id.tagName);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -684,6 +723,10 @@ function log(message) {
|
||||
var logConsole = logWindow.document.getElementById("logConsole");
|
||||
if (logConsole) {
|
||||
logConsole.highlighted = !logConsole.highlighted;
|
||||
if (message == '\c') {
|
||||
logConsole.innerHTML = "";
|
||||
return;
|
||||
}
|
||||
var logMessage = message.replace("<", "<", "g");
|
||||
logMessage = logMessage.replace(" ", " ", "g");
|
||||
logMessage = logMessage.replace("\r\n", "<br />\n", "g");
|
||||
@@ -718,61 +761,63 @@ function backtrace() {
|
||||
return str;
|
||||
}
|
||||
|
||||
function dropDownSubmenu(event) {
|
||||
var node = this;
|
||||
function popupSubmenu(event) {
|
||||
if (this.submenu && this.submenu != "") {
|
||||
log ("submenu: " + this.submenu);
|
||||
var submenuNode = $(this.submenu);
|
||||
var parentNode = getParentMenu(node);
|
||||
var parentNode = getParentMenu(this);
|
||||
if (parentNode.submenu)
|
||||
hideMenu(parentNode.submenu);
|
||||
submenuNode.parentMenuItem = node;
|
||||
submenuNode.parentMenuItem = this;
|
||||
submenuNode.parentMenu = parentNode;
|
||||
parentNode.submenuItem = node;
|
||||
parentNode.submenuItem = this;
|
||||
parentNode.submenu = submenuNode;
|
||||
|
||||
var menuTop = (node.offsetTop - 2);
|
||||
|
||||
var heightDiff = (window.innerHeight
|
||||
- (menuTop + submenuNode.offsetHeight));
|
||||
if (heightDiff < 0)
|
||||
menuTop += heightDiff;
|
||||
|
||||
var menuLeft = parentNode.offsetWidth - 3;
|
||||
|
||||
var menuTop = (parentNode.offsetTop - 2
|
||||
+ this.offsetTop);
|
||||
if (window.innerHeight
|
||||
< (menuTop + submenuNode.offsetHeight))
|
||||
menuTop = window.innerHeight - submenuNode.offsetHeight - 3;
|
||||
var menuLeft = (parentNode.offsetLeft + parentNode.offsetWidth - 3);
|
||||
if (window.innerWidth
|
||||
< (menuLeft + submenuNode.offsetWidth
|
||||
+ parentNode.cascadeLeftOffset()))
|
||||
menuLeft = - submenuNode.offsetWidth + 3;
|
||||
|
||||
parentNode.setAttribute('onmousemove', 'checkDropDown(event);');
|
||||
node.setAttribute('class', 'submenu-selected');
|
||||
< (menuLeft + submenuNode.offsetWidth))
|
||||
menuLeft = parentNode.offsetLeft - submenuNode.offsetWidth + 3;
|
||||
|
||||
Event.observe(this, "mousemove", onMouseEnteredSubmenu);
|
||||
Event.observe(submenuNode, "mousemove", onMouseEnteredSubmenu);
|
||||
Event.observe(this, "mouseout", onMouseLeftSubmenu);
|
||||
Event.observe(submenuNode, "mouseout", onMouseLeftSubmenu);
|
||||
this.setAttribute('class', 'submenu-selected');
|
||||
submenuNode.setStyle({ top: menuTop + "px",
|
||||
left: menuLeft + "px",
|
||||
visibility: "visible" });
|
||||
left: menuLeft + "px",
|
||||
visibility: "visible" });
|
||||
preventDefault(event);
|
||||
}
|
||||
}
|
||||
|
||||
function checkDropDown(event) {
|
||||
var parentMenu = getParentMenu(event.target);
|
||||
var submenuItem = parentMenu.submenuItem;
|
||||
if (submenuItem) {
|
||||
var menuX = event.clientX - parentMenu.cascadeLeftOffset();
|
||||
var menuY = event.clientY - parentMenu.cascadeTopOffset();
|
||||
var itemX = submenuItem.offsetLeft;
|
||||
var itemY = submenuItem.offsetTop - 75;
|
||||
function onMouseEnteredSubmenu(event) {
|
||||
this.mouseInside = true;
|
||||
}
|
||||
|
||||
if (menuX >= itemX
|
||||
&& menuX < itemX + submenuItem.offsetWidth
|
||||
&& (menuY < itemY
|
||||
|| menuY > (itemY + submenuItem.offsetHeight))) {
|
||||
hideMenu(parentMenu.submenu);
|
||||
parentMenu.submenu = null;
|
||||
parentMenu.submenuItem = null;
|
||||
parentMenu.setAttribute('onmousemove', null);
|
||||
}
|
||||
function onMouseLeftSubmenu(event) {
|
||||
this.mouseInside = false;
|
||||
if (this instanceof HTMLLIElement) {
|
||||
var menuNode = $(this.submenu);
|
||||
if (menuNode.menuTimeout)
|
||||
window.clearTimeout(menuNode.menuTimeout);
|
||||
menuNode.menuTimeout = setTimeout('onMenuTimeout("'
|
||||
+ this.submenu
|
||||
+ '");', 50);
|
||||
}
|
||||
}
|
||||
|
||||
function onMenuTimeout(menuNodeId) {
|
||||
var menuNode = $(menuNodeId);
|
||||
menuNode.menuTimeout = null;
|
||||
if (!(menuNode.mouseInside
|
||||
|| (menuNode.parentMenuItem && menuNode.parentMenuItem.mouseInside)))
|
||||
hideMenu(menuNode);
|
||||
}
|
||||
|
||||
/* search field */
|
||||
function popupSearchMenu(event) {
|
||||
var menuId = this.getAttribute("menuid");
|
||||
@@ -806,6 +851,11 @@ function setSearchCriteria(event) {
|
||||
|
||||
searchValue.setAttribute("ghost-phrase", this.innerHTML);
|
||||
searchCriteria.value = this.getAttribute('id');
|
||||
|
||||
if (this.parentNode.chosenNode)
|
||||
this.parentNode.chosenNode.removeClassName("_chosen");
|
||||
this.addClassName("_chosen");
|
||||
this.parentNode.chosenNode = this;
|
||||
}
|
||||
|
||||
function checkSearchValue(event) {
|
||||
@@ -823,6 +873,7 @@ function onSearchChange() {
|
||||
|
||||
function configureSearchField() {
|
||||
var searchValue = $("searchValue");
|
||||
var searchOptions = $("searchOptions");
|
||||
|
||||
if (!searchValue) return;
|
||||
|
||||
@@ -836,6 +887,13 @@ function configureSearchField() {
|
||||
onSearchFocus.bindAsEventListener(searchValue));
|
||||
Event.observe(searchValue, "keydown",
|
||||
onSearchKeyDown.bindAsEventListener(searchValue));
|
||||
|
||||
if (!searchOptions) return;
|
||||
|
||||
// Set the checkmark to the first option
|
||||
var firstOption = searchOptions.down('li');
|
||||
firstOption.addClassName("_chosen");
|
||||
searchOptions.chosenNode = firstOption;
|
||||
}
|
||||
|
||||
function onSearchMouseDown(event) {
|
||||
@@ -863,7 +921,7 @@ function onSearchFocus() {
|
||||
|
||||
function onSearchBlur(event) {
|
||||
var ghostPhrase = this.getAttribute("ghost-phrase");
|
||||
//log ("search blur: '" + this.value + "'");
|
||||
|
||||
if (!this.value) {
|
||||
this.setAttribute("modified", "");
|
||||
this.setStyle({ color: "#aaa" });
|
||||
@@ -889,7 +947,7 @@ function onSearchFormSubmit(event) {
|
||||
var searchValue = $("searchValue");
|
||||
var searchCriteria = $("searchCriteria");
|
||||
var ghostPhrase = searchValue.getAttribute('ghost-phrase');
|
||||
|
||||
|
||||
if (searchValue.value == ghostPhrase) return;
|
||||
|
||||
search["criteria"] = searchCriteria.value;
|
||||
@@ -959,6 +1017,7 @@ function subscribeToFolder(refreshCallback, refreshCallbackData) {
|
||||
document.subscriptionAjaxRequest.aborted = true;
|
||||
document.subscriptionAjaxRequest.abort();
|
||||
}
|
||||
|
||||
var rfCbData = { method: refreshCallback, data: refreshCallbackData };
|
||||
document.subscriptionAjaxRequest = triggerAjaxRequest(url,
|
||||
folderSubscriptionCallback,
|
||||
@@ -982,33 +1041,47 @@ function folderUnsubscriptionCallback(http) {
|
||||
}
|
||||
|
||||
function unsubscribeFromFolder(folder, refreshCallback, refreshCallbackData) {
|
||||
if (document.body.hasClassName("popup")) {
|
||||
window.opener.unsubscribeFromFolder(folder, refreshCallback,
|
||||
refreshCallbackData);
|
||||
}
|
||||
else {
|
||||
var folderData = folder.split(":");
|
||||
var username = folderData[0];
|
||||
var folderPath = folderData[1];
|
||||
if (username != UserLogin) {
|
||||
var url = (UserFolderURL + "../" + username
|
||||
+ "/" + folderPath + "/unsubscribe");
|
||||
if (document.unsubscriptionAjaxRequest) {
|
||||
document.unsubscriptionAjaxRequest.aborted = true;
|
||||
document.unsubscriptionAjaxRequest.abort();
|
||||
}
|
||||
var rfCbData = { method: refreshCallback, data: refreshCallbackData };
|
||||
document.unsubscriptionAjaxRequest
|
||||
= triggerAjaxRequest(url, folderUnsubscriptionCallback,
|
||||
rfCbData);
|
||||
if (document.body.hasClassName("popup")) {
|
||||
window.opener.unsubscribeFromFolder(folder, refreshCallback,
|
||||
refreshCallbackData);
|
||||
}
|
||||
else {
|
||||
var folderData = folder.split("+");
|
||||
var username = folderData[0];
|
||||
var folderPath = folderData[1];
|
||||
if (username != UserLogin) {
|
||||
var url = (ApplicationBaseURL + folder + "/unsubscribe");
|
||||
if (document.unsubscriptionAjaxRequest) {
|
||||
document.unsubscriptionAjaxRequest.aborted = true;
|
||||
document.unsubscriptionAjaxRequest.abort();
|
||||
}
|
||||
else
|
||||
window.alert(clabels["You cannot unsubscribe from a folder that you own!"].decodeEntities());
|
||||
}
|
||||
var rfCbData = { method: refreshCallback, data: refreshCallbackData };
|
||||
document.unsubscriptionAjaxRequest
|
||||
= triggerAjaxRequest(url, folderUnsubscriptionCallback,
|
||||
rfCbData);
|
||||
}
|
||||
else
|
||||
window.alert(clabels["You cannot unsubscribe from a folder that you own!"].decodeEntities());
|
||||
}
|
||||
}
|
||||
|
||||
function accessToSubscribedFolder(serverFolder) {
|
||||
var folder;
|
||||
|
||||
var parts = serverFolder.split(":");
|
||||
if (parts.length > 1) {
|
||||
var paths = parts[1].split("/");
|
||||
folder = "/" + parts[0] + "_" + paths[2];
|
||||
}
|
||||
else
|
||||
folder = serverFolder;
|
||||
|
||||
return folder;
|
||||
}
|
||||
|
||||
function listRowMouseDownHandler(event) {
|
||||
preventDefault(event);
|
||||
preventDefault(event);
|
||||
//Event.stop(event);
|
||||
}
|
||||
|
||||
/* tabs */
|
||||
@@ -1073,7 +1146,7 @@ function initMenu(menuDIV, callbacks) {
|
||||
else {
|
||||
node.submenu = callback;
|
||||
node.addClassName("submenu");
|
||||
Event.observe(node, "mouseover", dropDownSubmenu);
|
||||
Event.observe(node, "mouseover", popupSubmenu);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1252,36 +1325,46 @@ function loadPreferences() {
|
||||
}
|
||||
|
||||
function onLoadHandler(event) {
|
||||
loadPreferences();
|
||||
queryParameters = parseQueryParameters('' + window.location);
|
||||
if (!$(document.body).hasClassName("popup")) {
|
||||
initLogConsole();
|
||||
}
|
||||
initCriteria();
|
||||
configureSearchField();
|
||||
initMenus();
|
||||
initTabs();
|
||||
configureDragHandles();
|
||||
configureSortableTableHeaders();
|
||||
configureLinkBanner();
|
||||
var progressImage = $("progressIndicator");
|
||||
if (progressImage)
|
||||
progressImage.parentNode.removeChild(progressImage);
|
||||
Event.observe(document.body, "contextmenu", onBodyClickContextMenu);
|
||||
if (typeof UserLogin != "undefined")
|
||||
loadPreferences();
|
||||
queryParameters = parseQueryParameters('' + window.location);
|
||||
if (!$(document.body).hasClassName("popup")) {
|
||||
initLogConsole();
|
||||
}
|
||||
initCriteria();
|
||||
configureSearchField();
|
||||
initMenus();
|
||||
initTabs();
|
||||
configureDragHandles();
|
||||
configureLinkBanner();
|
||||
translateLabels();
|
||||
var progressImage = $("progressIndicator");
|
||||
if (progressImage)
|
||||
progressImage.parentNode.removeChild(progressImage);
|
||||
Event.observe(document.body, "contextmenu", onBodyClickContextMenu);
|
||||
}
|
||||
|
||||
function translateLabels() {
|
||||
if (typeof labels != "undefined") {
|
||||
for (var key in labels)
|
||||
labels[key] = labels[key].decodeEntities();
|
||||
}
|
||||
|
||||
if (typeof clabels != "undefined") {
|
||||
for (var key in clabels)
|
||||
clabels[key] = clabels[key].decodeEntities();
|
||||
}
|
||||
}
|
||||
|
||||
function onBodyClickContextMenu(event) {
|
||||
preventDefault(event);
|
||||
}
|
||||
|
||||
function configureSortableTableHeaders() {
|
||||
var headers = document.getElementsByClassName("sortableTableHeader");
|
||||
function configureSortableTableHeaders(table) {
|
||||
var headers = $(table).getElementsByClassName("sortableTableHeader");
|
||||
for (var i = 0; i < headers.length; i++) {
|
||||
var header = headers[i];
|
||||
var anchor = $(header).childNodesWithTag("a")[0];
|
||||
if (anchor)
|
||||
Event.observe(anchor, "click",
|
||||
onHeaderClick.bindAsEventListener(anchor));
|
||||
Event.observe(header, "click", onHeaderClick.bindAsEventListener(header))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1292,7 +1375,7 @@ function onLinkBannerClick() {
|
||||
|
||||
function onPreferencesClick(event) {
|
||||
var urlstr = UserFolderURL + "preferences";
|
||||
var w = window.open(urlstr, "User Preferences",
|
||||
var w = window.open(urlstr, "_blank",
|
||||
"width=430,height=250,resizable=0,scrollbars=0");
|
||||
w.opener = window;
|
||||
w.focus();
|
||||
@@ -1304,14 +1387,46 @@ function configureLinkBanner() {
|
||||
var linkBanner = $("linkBanner");
|
||||
if (linkBanner) {
|
||||
var anchors = linkBanner.childNodesWithTag("a");
|
||||
for (var i = 0; i < 2; i++) {
|
||||
for (var i = 1; i < 3; i++) {
|
||||
Event.observe(anchors[i], "mousedown", listRowMouseDownHandler);
|
||||
Event.observe(anchors[i], "click", onLinkBannerClick);
|
||||
}
|
||||
Event.observe(anchors[3], "mousedown", listRowMouseDownHandler);
|
||||
Event.observe(anchors[3], "click", onPreferencesClick);
|
||||
if (anchors.length > 4)
|
||||
Event.observe(anchors[4], "click", toggleLogConsole);
|
||||
Event.observe(anchors[4], "mousedown", listRowMouseDownHandler);
|
||||
Event.observe(anchors[4], "click", onPreferencesClick);
|
||||
if (anchors.length > 5)
|
||||
Event.observe(anchors[5], "click", toggleLogConsole);
|
||||
}
|
||||
}
|
||||
|
||||
/* folder creation */
|
||||
function createFolder(name, okCB, notOkCB) {
|
||||
if (name) {
|
||||
if (document.newFolderAjaxRequest) {
|
||||
document.newFolderAjaxRequest.aborted = true;
|
||||
document.newFolderAjaxRequest.abort();
|
||||
}
|
||||
var url = ApplicationBaseURL + "/createFolder?name=" + name;
|
||||
document.newFolderAjaxRequest
|
||||
= triggerAjaxRequest(url, createFolderCallback,
|
||||
{name: name,
|
||||
okCB: okCB,
|
||||
notOkCB: notOkCB});
|
||||
}
|
||||
}
|
||||
|
||||
function createFolderCallback(http) {
|
||||
if (http.readyState == 4) {
|
||||
var data = http.callbackData;
|
||||
if (http.status == 201) {
|
||||
if (data.okCB)
|
||||
data.okCB(data.name, "/" + http.responseText);
|
||||
}
|
||||
else {
|
||||
if (data.notOkCB)
|
||||
data.notOkCB(name);
|
||||
else
|
||||
log("ajax problem:" + http.status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.7 KiB |
@@ -0,0 +1,101 @@
|
||||
/**
|
||||
* This work is licensed under a Creative Commons Attribution 3.0 License
|
||||
* (http://creativecommons.org/licenses/by/3.0/).
|
||||
*
|
||||
* You are free:
|
||||
* to Share - to copy, distribute and transmit the work
|
||||
* to Remix - to adapt the work
|
||||
* Under the following conditions:
|
||||
* Attribution. You must attribute the work in the manner specified
|
||||
* by the author or licensor (but not in any way that suggests that
|
||||
* they endorse you or your use of the work).
|
||||
*
|
||||
* For any reuse or distribution, you must make clear to others the license
|
||||
* terms of this work. The best way to do this is with a link to the
|
||||
* Creative Commons web page.
|
||||
*
|
||||
* Any of the above conditions can be waived if you get permission from
|
||||
* the copyright holder. Nothing in this license impairs or restricts
|
||||
* the author's moral rights.
|
||||
*
|
||||
* Disclaimer
|
||||
*
|
||||
* Your fair dealing and other rights are in no way affected by the above.
|
||||
* This is a human-readable summary of the Legal Code (the full license).
|
||||
*
|
||||
* The author of this work is Vlad Bailescu (http://vlad.bailescu.ro). No
|
||||
* warranty or support will be provided for this work, although updates
|
||||
* might be made available at http://vlad.bailescu.ro/javascript/tablekit .
|
||||
*
|
||||
* Licence code and basic description provided by Creative Commons.
|
||||
*
|
||||
*/
|
||||
Object.extend(TableKit.options || {}, {
|
||||
// If true table width gets recalculated on column resize
|
||||
trueResize : false,
|
||||
// If true table width will be kept constant on column resize
|
||||
keepWidth : false
|
||||
});
|
||||
|
||||
Object.extend(TableKit.Resizable, {
|
||||
resize : function(table, index, w) {
|
||||
// This part is taken from Andrew Tetlaw's original TableKit.Resizable.resize
|
||||
var cell;
|
||||
if(typeof index === 'number') {
|
||||
if(!table || (table.tagName && table.tagName !== "TABLE")) {return;}
|
||||
table = $(table);
|
||||
index = Math.min(table.rows[0].cells.length, index);
|
||||
index = Math.max(1, index);
|
||||
index -= 1;
|
||||
cell = (table.tHead && table.tHead.rows.length > 0) ? $(table.tHead.rows[table.tHead.rows.length-1].cells[index]) : $(table.rows[0].cells[index]);
|
||||
} else {
|
||||
cell = $(index);
|
||||
table = table ? $(table) : cell.up('table');
|
||||
index = TableKit.getCellIndex(cell);
|
||||
}
|
||||
// And now, for the fun stuff
|
||||
// Read the new options values for the given table
|
||||
var op = TableKit.option('trueResize keepWidth minWidth', table.id);
|
||||
// Took also the minWidth as we're gonna use it later anyway
|
||||
var pad = parseInt(cell.getStyle('paddingLeft'),10) + parseInt(cell.getStyle('paddingRight'),10);
|
||||
// Improvement: add cell border to padding as width incorporates both
|
||||
pad += parseInt(cell.getStyle('borderLeftWidth'),10) + parseInt(cell.getStyle('borderRightWidth'),10);
|
||||
w = Math.max(w-pad, op.minWidth); // This will also be used later
|
||||
if (!op.trueResize) {
|
||||
// Original resize method
|
||||
cell.setStyle({'width' : w + 'px'}); // Using previously read minWidth instead of the old way
|
||||
} else {
|
||||
// New stuff
|
||||
var delta = (w + pad - parseInt(cell.getWidth()));
|
||||
if (!op.keepWidth) {
|
||||
// We'll be updating the table width
|
||||
var tableWidth = parseInt(table.getWidth()) + delta;
|
||||
cell.setStyle({'width' : w + 'px'});
|
||||
table.setStyle({'width' : tableWidth + 'px'});
|
||||
} else {
|
||||
// Let's see what we have to do to keep the table width constant
|
||||
var cells = TableKit.getHeaderCells(table);
|
||||
if (index < 0 || index > cells.length) { return; }
|
||||
var nbour;
|
||||
if (index == cells.length - 1) { // Rightmost cell
|
||||
nbour = cells[index - 1];
|
||||
} else { // Left or inner cell
|
||||
nbour = cells[index + 1];
|
||||
}
|
||||
var nbourWidth = parseInt(nbour.getWidth());
|
||||
var nbourPad = parseInt(nbour.getStyle('paddingLeft'),10) + parseInt(nbour.getStyle('paddingRight'),10);
|
||||
var proposedNbourWidth = nbourWidth - nbourPad - delta;
|
||||
var newNbourWidth;
|
||||
if (proposedNbourWidth < op.minWidth) {
|
||||
// Don't be mean to neighbours. Step off their porch.
|
||||
newNbourWidth = Math.min(nbourWidth - nbourPad, op.minWidth);
|
||||
w -= newNbourWidth - proposedNbourWidth;
|
||||
} else {
|
||||
newNbourWidth = proposedNbourWidth;
|
||||
}
|
||||
nbour.setStyle({'width' : newNbourWidth + 'px'});
|
||||
cell.setStyle({'width' : w + 'px'});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,858 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2007 Andrew Tetlaw & Millstream Web Software
|
||||
* http://www.millstream.com.au/view/code/tablekit/
|
||||
* Version: 1.2.1 2007-03-11
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
* *
|
||||
*/
|
||||
|
||||
// Use the TableKit class constructure if you'd prefer to init your tables as JS objects
|
||||
var TableKit = Class.create();
|
||||
|
||||
TableKit.prototype = {
|
||||
initialize : function(elm, options) {
|
||||
var table = $(elm);
|
||||
if(table.tagName !== "TABLE") {
|
||||
return;
|
||||
}
|
||||
TableKit.register(table,Object.extend(TableKit.options,options || {}));
|
||||
this.id = table.id;
|
||||
var op = TableKit.option('sortable resizable editable', this.id);
|
||||
if(op.sortable) {
|
||||
TableKit.Sortable.init(table);
|
||||
}
|
||||
if(op.resizable) {
|
||||
TableKit.Resizable.init(table);
|
||||
}
|
||||
if(op.editable) {
|
||||
TableKit.Editable.init(table);
|
||||
}
|
||||
},
|
||||
sort : function(column, order) {
|
||||
TableKit.Sortable.sort(this.id, column, order);
|
||||
},
|
||||
resizeColumn : function(column, w) {
|
||||
TableKit.Resizable.resize(this.id, column, w);
|
||||
},
|
||||
editCell : function(row, column) {
|
||||
TableKit.Editable.editCell(this.id, row, column);
|
||||
}
|
||||
};
|
||||
|
||||
Object.extend(TableKit, {
|
||||
getBodyRows : function(table) {
|
||||
table = $(table);
|
||||
var id = table.id;
|
||||
if(!TableKit.rows[id]) {
|
||||
TableKit.rows[id] = (table.tHead && table.tHead.rows.length > 0) ? $A(table.tBodies[0].rows) : $A(table.rows).without(table.rows[0]);
|
||||
}
|
||||
return TableKit.rows[id];
|
||||
},
|
||||
getHeaderCells : function(table, cell) {
|
||||
if(!table) { table = $(cell).up('table'); }
|
||||
var id = table.id;
|
||||
if(!TableKit.heads[id]) {
|
||||
//TableKit.heads[id] = $A((table.tHead && table.tHead.rows.length > 0) ? table.tHead.rows[table.tHead.rows.length-1].cells : table.rows[0].cells);
|
||||
TableKit.heads[id] = $A((table.tHead && table.tHead.rows.length > 0) ? table.tHead.rows[0].cells : table.rows[0].cells);
|
||||
}
|
||||
return TableKit.heads[id];
|
||||
},
|
||||
getCellIndex : function(cell) {
|
||||
return $A(cell.parentNode.cells).indexOf(cell);
|
||||
},
|
||||
getRowIndex : function(row) {
|
||||
return $A(row.parentNode.rows).indexOf(row);
|
||||
},
|
||||
getCellText : function(cell, refresh) {
|
||||
if(!cell) { return ""; }
|
||||
TableKit.registerCell(cell);
|
||||
var data = TableKit.cells[cell.id];
|
||||
if(refresh || data.refresh || !data.textContent) {
|
||||
data.textContent = cell.textContent ? cell.textContent : cell.innerText;
|
||||
data.refresh = false;
|
||||
}
|
||||
return data.textContent;
|
||||
},
|
||||
register : function(table, options) {
|
||||
if(!table.id) {
|
||||
TableKit._tblcount += 1;
|
||||
table.id = "tablekit-table-" + TableKit._tblcount;
|
||||
}
|
||||
var id = table.id;
|
||||
TableKit.tables[id] = TableKit.tables[id] ? Object.extend(TableKit.tables[id], options || {}) : Object.extend({sortable:false,resizable:false,editable:false}, options || {});
|
||||
},
|
||||
registerCell : function(cell) {
|
||||
if(!cell.id) {
|
||||
TableKit._cellcount += 1;
|
||||
cell.id = "tablekit-cell-" + TableKit._cellcount;
|
||||
}
|
||||
if(!TableKit.cells[cell.id]) {
|
||||
TableKit.cells[cell.id] = {textContent : '', htmlContent : '', active : false};
|
||||
}
|
||||
},
|
||||
isSortable : function(table) {
|
||||
return TableKit.tables[table.id] ? TableKit.tables[table.id].sortable : false;
|
||||
},
|
||||
isResizable : function(table) {
|
||||
return TableKit.tables[table.id] ? TableKit.tables[table.id].resizable : false;
|
||||
},
|
||||
isEditable : function(table) {
|
||||
return TableKit.tables[table.id] ? TableKit.tables[table.id].editable : false;
|
||||
},
|
||||
setup : function(o) {
|
||||
Object.extend(TableKit.options, o || {} );
|
||||
},
|
||||
option : function(s, id, o1, o2) {
|
||||
o1 = o1 || TableKit.options;
|
||||
o2 = o2 || (id ? (TableKit.tables[id] ? TableKit.tables[id] : {}) : {});
|
||||
var key = id + s;
|
||||
if(!TableKit._opcache[key]){
|
||||
TableKit._opcache[key] = $A($w(s)).inject([],function(a,v){
|
||||
a.push(a[v] = o2[v] || o1[v]);
|
||||
return a;
|
||||
});
|
||||
}
|
||||
return TableKit._opcache[key];
|
||||
},
|
||||
e : function(event) {
|
||||
return event || window.event;
|
||||
},
|
||||
tables : {},
|
||||
_opcache : {},
|
||||
cells : {},
|
||||
rows : {},
|
||||
heads : {},
|
||||
options : {
|
||||
autoLoad : true,
|
||||
stripe : true,
|
||||
sortable : true,
|
||||
resizable : true,
|
||||
editable : true,
|
||||
rowEvenClass : 'roweven',
|
||||
rowOddClass : 'rowodd',
|
||||
sortableSelector : ['table.sortable'],
|
||||
columnClass : 'sortcol',
|
||||
descendingClass : 'sortdesc',
|
||||
ascendingClass : 'sortasc',
|
||||
noSortClass : 'nosort',
|
||||
sortFirstAscendingClass : 'sortfirstasc',
|
||||
sortFirstDecendingClass : 'sortfirstdesc',
|
||||
resizableSelector : ['table.resizable'],
|
||||
minWidth : 10,
|
||||
showHandle : true,
|
||||
resizeOnHandleClass : 'resize-handle-active',
|
||||
editableSelector : ['table.editable'],
|
||||
formClassName : 'editable-cell-form',
|
||||
noEditClass : 'noedit',
|
||||
editAjaxURI : '/',
|
||||
editAjaxOptions : {}
|
||||
},
|
||||
_tblcount : 0,
|
||||
_cellcount : 0,
|
||||
load : function() {
|
||||
if(TableKit.options.autoLoad) {
|
||||
if(TableKit.options.sortable) {
|
||||
$A(TableKit.options.sortableSelector).each(function(s){
|
||||
$$(s).each(function(t) {
|
||||
TableKit.Sortable.init(t);
|
||||
});
|
||||
});
|
||||
}
|
||||
if(TableKit.options.resizable) {
|
||||
$A(TableKit.options.resizableSelector).each(function(s){
|
||||
$$(s).each(function(t) {
|
||||
TableKit.Resizable.init(t);
|
||||
});
|
||||
});
|
||||
}
|
||||
if(TableKit.options.editable) {
|
||||
$A(TableKit.options.editableSelector).each(function(s){
|
||||
$$(s).each(function(t) {
|
||||
TableKit.Editable.init(t);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
TableKit.Rows = {
|
||||
stripe : function(table) {
|
||||
var rows = TableKit.getBodyRows(table);
|
||||
rows.each(function(r,i) {
|
||||
TableKit.Rows.addStripeClass(table,r,i);
|
||||
});
|
||||
},
|
||||
addStripeClass : function(t,r,i) {
|
||||
t = t || r.up('table');
|
||||
var op = TableKit.option('rowEvenClass rowOddClass', t.id);
|
||||
var css = ((i+1)%2 === 0 ? op[0] : op[1]);
|
||||
// using prototype's assClassName/RemoveClassName was not efficient for large tables, hence:
|
||||
var cn = r.className.split(/\s+/);
|
||||
var newCn = [];
|
||||
for(var x = 0, l = cn.length; x < l; x += 1) {
|
||||
if(cn[x] !== op[0] && cn[x] !== op[1]) { newCn.push(cn[x]); }
|
||||
}
|
||||
newCn.push(css);
|
||||
r.className = newCn.join(" ");
|
||||
}
|
||||
};
|
||||
|
||||
TableKit.Sortable = {
|
||||
init : function(elm, options){
|
||||
var table = $(elm);
|
||||
if(table.tagName !== "TABLE") {
|
||||
return;
|
||||
}
|
||||
TableKit.register(table,Object.extend(options || {},{sortable:true}));
|
||||
var sortFirst;
|
||||
var cells = TableKit.getHeaderCells(table);
|
||||
var op = TableKit.option('noSortClass columnClass sortFirstAscendingClass sortFirstDecendingClass', table.id);
|
||||
cells.each(function(c){
|
||||
c = $(c);
|
||||
if(!c.hasClassName(op.noSortClass)) {
|
||||
Event.observe(c, 'mousedown', TableKit.Sortable._sort);
|
||||
c.addClassName(op.columnClass);
|
||||
if(c.hasClassName(op.sortFirstAscendingClass) || c.hasClassName(op.sortFirstDecendingClass)) {
|
||||
sortFirst = c;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if(sortFirst) {
|
||||
if(sortFirst.hasClassName(op.sortFirstAscendingClass)) {
|
||||
TableKit.Sortable.sort(table, sortFirst, 1);
|
||||
} else {
|
||||
TableKit.Sortable.sort(table, sortFirst, -1);
|
||||
}
|
||||
} else { // just add row stripe classes
|
||||
TableKit.Rows.stripe(table);
|
||||
}
|
||||
},
|
||||
reload : function(table) {
|
||||
table = $(table);
|
||||
var cells = TableKit.getHeaderCells(table);
|
||||
var op = TableKit.option('noSortClass columnClass', table.id);
|
||||
cells.each(function(c){
|
||||
c = $(c);
|
||||
if(!c.hasClassName(op.noSortClass)) {
|
||||
Event.stopObserving(c, 'mousedown', TableKit.Sortable._sort);
|
||||
c.removeClassName(op.columnClass);
|
||||
}
|
||||
});
|
||||
TableKit.Sortable.init(table);
|
||||
},
|
||||
_sort : function(e) {
|
||||
if(TableKit.Resizable._onHandle) {return;}
|
||||
e = TableKit.e(e);
|
||||
Event.stop(e);
|
||||
var cell = Event.element(e);
|
||||
while(!(cell.tagName && cell.tagName.match(/td|th/gi))) {
|
||||
cell = cell.parentNode;
|
||||
}
|
||||
TableKit.Sortable.sort(null, cell);
|
||||
},
|
||||
sort : function(table, index, order) {
|
||||
var cell;
|
||||
if(typeof index === 'number') {
|
||||
if(!table || (table.tagName && table.tagName !== "TABLE")) {
|
||||
return;
|
||||
}
|
||||
table = $(table);
|
||||
index = Math.min(table.rows[0].cells.length, index);
|
||||
index = Math.max(1, index);
|
||||
index -= 1;
|
||||
cell = (table.tHead && table.tHead.rows.length > 0) ? $(table.tHead.rows[table.tHead.rows.length-1].cells[index]) : $(table.rows[0].cells[index]);
|
||||
} else {
|
||||
cell = $(index);
|
||||
table = table ? $(table) : cell.up('table');
|
||||
index = TableKit.getCellIndex(cell);
|
||||
}
|
||||
var op = TableKit.option('noSortClass descendingClass ascendingClass', table.id);
|
||||
|
||||
if(cell.hasClassName(op.noSortClass)) {return;}
|
||||
|
||||
order = order ? order : (cell.hasClassName(op.descendingClass) ? 1 : -1);
|
||||
var rows = TableKit.getBodyRows(table);
|
||||
|
||||
if(cell.hasClassName(op.ascendingClass) || cell.hasClassName(op.descendingClass)) {
|
||||
rows.reverse(); // if it was already sorted we just need to reverse it.
|
||||
} else {
|
||||
var datatype = TableKit.Sortable.getDataType(cell,index,table);
|
||||
var tkst = TableKit.Sortable.types;
|
||||
rows.sort(function(a,b) {
|
||||
return order * tkst[datatype].compare(TableKit.getCellText(a.cells[index]),TableKit.getCellText(b.cells[index]));
|
||||
});
|
||||
}
|
||||
var tb = table.tBodies[0];
|
||||
var tkr = TableKit.Rows;
|
||||
rows.each(function(r,i) {
|
||||
tb.appendChild(r);
|
||||
tkr.addStripeClass(table,r,i);
|
||||
});
|
||||
var hcells = TableKit.getHeaderCells(null, cell);
|
||||
$A(hcells).each(function(c,i){
|
||||
c = $(c);
|
||||
c.removeClassName(op.ascendingClass);
|
||||
c.removeClassName(op.descendingClass);
|
||||
if(index === i) {
|
||||
if(order === 1) {
|
||||
c.removeClassName(op.descendingClass);
|
||||
c.addClassName(op.ascendingClass);
|
||||
} else {
|
||||
c.removeClassName(op.ascendingClass);
|
||||
c.addClassName(op.descendingClass);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
types : {},
|
||||
detectors : [],
|
||||
addSortType : function() {
|
||||
$A(arguments).each(function(o){
|
||||
TableKit.Sortable.types[o.name] = o;
|
||||
});
|
||||
},
|
||||
getDataType : function(cell,index,table) {
|
||||
cell = $(cell);
|
||||
index = (index || index === 0) ? index : TableKit.getCellIndex(cell);
|
||||
|
||||
var colcache = TableKit.Sortable._coltypecache;
|
||||
var cache = colcache[table.id] ? colcache[table.id] : (colcache[table.id] = {});
|
||||
|
||||
if(!cache[index]) {
|
||||
var t = '';
|
||||
// first look for a data type id on the heading row cell
|
||||
if(cell.id && TableKit.Sortable.types[cell.id]) {
|
||||
t = cell.id;
|
||||
}
|
||||
t = cell.classNames().detect(function(n){ // then look for a data type classname on the heading row cell
|
||||
return (TableKit.Sortable.types[n]) ? true : false;
|
||||
});
|
||||
if(!t) {
|
||||
var rows = TableKit.getBodyRows(table);
|
||||
cell = rows[0].cells[index]; // grab same index cell from body row to try and match data type
|
||||
t = TableKit.Sortable.detectors.detect(
|
||||
function(d){
|
||||
return TableKit.Sortable.types[d].detect(TableKit.getCellText(cell));
|
||||
});
|
||||
}
|
||||
cache[index] = t;
|
||||
}
|
||||
return cache[index];
|
||||
},
|
||||
_coltypecache : {}
|
||||
};
|
||||
|
||||
TableKit.Sortable.detectors = $A($w('date-iso date date-eu date-au time currency datasize number casesensitivetext text')); // setting it here because Safari complained when I did it above...
|
||||
|
||||
TableKit.Sortable.Type = Class.create();
|
||||
TableKit.Sortable.Type.prototype = {
|
||||
initialize : function(name, options){
|
||||
this.name = name;
|
||||
options = Object.extend({
|
||||
normal : function(v){
|
||||
return v;
|
||||
},
|
||||
pattern : /.*/
|
||||
}, options || {});
|
||||
this.normal = options.normal;
|
||||
this.pattern = options.pattern;
|
||||
if(options.compare) {
|
||||
this.compare = options.compare;
|
||||
}
|
||||
if(options.detect) {
|
||||
this.detect = options.detect;
|
||||
}
|
||||
},
|
||||
compare : function(a,b){
|
||||
return TableKit.Sortable.Type.compare(this.normal(a), this.normal(b));
|
||||
},
|
||||
detect : function(v){
|
||||
return this.pattern.test(v);
|
||||
}
|
||||
};
|
||||
|
||||
TableKit.Sortable.Type.compare = function(a,b) {
|
||||
return a < b ? -1 : a === b ? 0 : 1;
|
||||
};
|
||||
|
||||
TableKit.Sortable.addSortType(
|
||||
new TableKit.Sortable.Type('number', {
|
||||
pattern : /^[-+]?[\d]*\.?[\d]+(?:[eE][-+]?[\d]+)?/,
|
||||
normal : function(v) {
|
||||
// This will grab the first thing that looks like a number from a string, so you can use it to order a column of various srings containing numbers.
|
||||
v = parseFloat(v.replace(/^.*?([-+]?[\d]*\.?[\d]+(?:[eE][-+]?[\d]+)?).*$/,"$1"));
|
||||
return isNaN(v) ? 0 : v;
|
||||
}}),
|
||||
new TableKit.Sortable.Type('text',{
|
||||
normal : function(v) {
|
||||
return v ? v.toLowerCase() : '';
|
||||
}}),
|
||||
new TableKit.Sortable.Type('casesensitivetext',{pattern : /^[A-Z]+$/}),
|
||||
new TableKit.Sortable.Type('datasize',{
|
||||
pattern : /^[-+]?[\d]*\.?[\d]+(?:[eE][-+]?[\d]+)?\s?[k|m|g|t]b$/i,
|
||||
normal : function(v) {
|
||||
var r = v.match(/^([-+]?[\d]*\.?[\d]+([eE][-+]?[\d]+)?)\s?([k|m|g|t]?b)?/i);
|
||||
var b = r[1] ? Number(r[1]).valueOf() : 0;
|
||||
var m = r[3] ? r[3].substr(0,1).toLowerCase() : '';
|
||||
var result = b;
|
||||
switch(m) {
|
||||
case 'k':
|
||||
result = b * 1024;
|
||||
break;
|
||||
case 'm':
|
||||
result = b * 1024 * 1024;
|
||||
break;
|
||||
case 'g':
|
||||
result = b * 1024 * 1024 * 1024;
|
||||
break;
|
||||
case 't':
|
||||
result = b * 1024 * 1024 * 1024 * 1024;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}}),
|
||||
new TableKit.Sortable.Type('date-au',{
|
||||
pattern : /^\d{2}\/\d{2}\/\d{4}\s?(?:\d{1,2}\:\d{2}(?:\:\d{2})?\s?[a|p]?m?)?/i,
|
||||
normal : function(v) {
|
||||
if(!this.pattern.test(v)) {return 0;}
|
||||
var r = v.match(/^(\d{2})\/(\d{2})\/(\d{4})\s?(?:(\d{1,2})\:(\d{2})(?:\:(\d{2}))?\s?([a|p]?m?))?/i);
|
||||
var yr_num = r[3];
|
||||
var mo_num = parseInt(r[2],10)-1;
|
||||
var day_num = r[1];
|
||||
var hr_num = r[4] ? r[4] : 0;
|
||||
if(r[7] && r[7].toLowerCase().indexOf('p') !== -1) {
|
||||
hr_num = parseInt(r[4],10) + 12;
|
||||
}
|
||||
var min_num = r[5] ? r[5] : 0;
|
||||
var sec_num = r[6] ? r[6] : 0;
|
||||
return new Date(yr_num, mo_num, day_num, hr_num, min_num, sec_num, 0).valueOf();
|
||||
}}),
|
||||
new TableKit.Sortable.Type('date-us',{
|
||||
pattern : /^\d{2}\/\d{2}\/\d{4}\s?(?:\d{1,2}\:\d{2}(?:\:\d{2})?\s?[a|p]?m?)?/i,
|
||||
normal : function(v) {
|
||||
if(!this.pattern.test(v)) {return 0;}
|
||||
var r = v.match(/^(\d{2})\/(\d{2})\/(\d{4})\s?(?:(\d{1,2})\:(\d{2})(?:\:(\d{2}))?\s?([a|p]?m?))?/i);
|
||||
var yr_num = r[3];
|
||||
var mo_num = parseInt(r[1],10)-1;
|
||||
var day_num = r[2];
|
||||
var hr_num = r[4] ? r[4] : 0;
|
||||
if(r[7] && r[7].toLowerCase().indexOf('p') !== -1) {
|
||||
hr_num = parseInt(r[4],10) + 12;
|
||||
}
|
||||
var min_num = r[5] ? r[5] : 0;
|
||||
var sec_num = r[6] ? r[6] : 0;
|
||||
return new Date(yr_num, mo_num, day_num, hr_num, min_num, sec_num, 0).valueOf();
|
||||
}}),
|
||||
new TableKit.Sortable.Type('date-eu',{
|
||||
pattern : /^\d{2}-\d{2}-\d{4}/i,
|
||||
normal : function(v) {
|
||||
if(!this.pattern.test(v)) {return 0;}
|
||||
var r = v.match(/^(\d{2})-(\d{2})-(\d{4})/);
|
||||
var yr_num = r[3];
|
||||
var mo_num = parseInt(r[2],10)-1;
|
||||
var day_num = r[1];
|
||||
return new Date(yr_num, mo_num, day_num).valueOf();
|
||||
}}),
|
||||
new TableKit.Sortable.Type('date-iso',{
|
||||
pattern : /[\d]{4}-[\d]{2}-[\d]{2}(?:T[\d]{2}\:[\d]{2}(?:\:[\d]{2}(?:\.[\d]+)?)?(Z|([-+][\d]{2}:[\d]{2})?)?)?/, // 2005-03-26T19:51:34Z
|
||||
normal : function(v) {
|
||||
if(!this.pattern.test(v)) {return 0;}
|
||||
var d = v.match(/([\d]{4})(-([\d]{2})(-([\d]{2})(T([\d]{2}):([\d]{2})(:([\d]{2})(\.([\d]+))?)?(Z|(([-+])([\d]{2}):([\d]{2})))?)?)?)?/);
|
||||
var offset = 0;
|
||||
var date = new Date(d[1], 0, 1);
|
||||
if (d[3]) { date.setMonth(d[3] - 1) ;}
|
||||
if (d[5]) { date.setDate(d[5]); }
|
||||
if (d[7]) { date.setHours(d[7]); }
|
||||
if (d[8]) { date.setMinutes(d[8]); }
|
||||
if (d[10]) { date.setSeconds(d[10]); }
|
||||
if (d[12]) { date.setMilliseconds(Number("0." + d[12]) * 1000); }
|
||||
if (d[14]) {
|
||||
offset = (Number(d[16]) * 60) + Number(d[17]);
|
||||
offset *= ((d[15] === '-') ? 1 : -1);
|
||||
}
|
||||
offset -= date.getTimezoneOffset();
|
||||
if(offset !== 0) {
|
||||
var time = (Number(date) + (offset * 60 * 1000));
|
||||
date.setTime(Number(time));
|
||||
}
|
||||
return date.valueOf();
|
||||
}}),
|
||||
new TableKit.Sortable.Type('date',{
|
||||
pattern: /^(?:sun|mon|tue|wed|thu|fri|sat)\,\s\d{1,2}\s(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\s\d{4}(?:\s\d{2}\:\d{2}(?:\:\d{2})?(?:\sGMT(?:[+-]\d{4})?)?)?/i, //Mon, 18 Dec 1995 17:28:35 GMT
|
||||
compare : function(a,b) { // must be standard javascript date format
|
||||
if(a && b) {
|
||||
return TableKit.Sortable.Type.compare(new Date(a),new Date(b));
|
||||
} else {
|
||||
return TableKit.Sortable.Type.compare(a ? 1 : 0, b ? 1 : 0);
|
||||
}
|
||||
}}),
|
||||
new TableKit.Sortable.Type('time',{
|
||||
pattern : /^\d{1,2}\:\d{2}(?:\:\d{2})?(?:\s[a|p]m)?$/i,
|
||||
compare : function(a,b) {
|
||||
var d = new Date();
|
||||
var ds = d.getMonth() + "/" + d.getDate() + "/" + d.getFullYear() + " ";
|
||||
return TableKit.Sortable.Type.compare(new Date(ds + a),new Date(ds + b));
|
||||
}}),
|
||||
new TableKit.Sortable.Type('currency',{
|
||||
pattern : /^[$£¥€¤]/, // dollar,pound,yen,euro,generic currency symbol
|
||||
normal : function(v) {
|
||||
return v ? parseFloat(v.replace(/[^-\d\.]/g,'')) : 0;
|
||||
}})
|
||||
);
|
||||
|
||||
TableKit.Resizable = {
|
||||
init : function(elm, options){
|
||||
var table = $(elm);
|
||||
if(table.tagName !== "TABLE") {return;}
|
||||
TableKit.register(table,Object.extend(options || {},{resizable:true}));
|
||||
var cells = TableKit.getHeaderCells(table);
|
||||
cells.each(function(c){
|
||||
c = $(c);
|
||||
//log ("init on " + c.firstChild.nodeValue);
|
||||
Event.observe(c, 'mouseover', TableKit.Resizable.initDetect);
|
||||
Event.observe(c, 'mouseout', TableKit.Resizable.killDetect);
|
||||
});
|
||||
},
|
||||
reload : function(table) {
|
||||
table = $(table);
|
||||
var cells = TableKit.getHeaderCells(table);
|
||||
cells.each(function(c){
|
||||
c = $(c);
|
||||
Event.stopObserving(c, 'mouseover', TableKit.Resizable.initDetect);
|
||||
Event.stopObserving(c, 'mouseout', TableKit.Resizable.killDetect);
|
||||
});
|
||||
TableKit.Resizable.init(table);
|
||||
},
|
||||
resize : function(table, index, w) {
|
||||
var cell;
|
||||
if(typeof index === 'number') {
|
||||
if(!table || (table.tagName && table.tagName !== "TABLE")) {return;}
|
||||
table = $(table);
|
||||
index = Math.min(table.rows[0].cells.length, index);
|
||||
index = Math.max(1, index);
|
||||
index -= 1;
|
||||
cell = (table.tHead && table.tHead.rows.length > 0) ? $(table.tHead.rows[table.tHead.rows.length-1].cells[index]) : $(table.rows[0].cells[index]);
|
||||
} else {
|
||||
cell = $(index);
|
||||
table = table ? $(table) : cell.up('table');
|
||||
index = TableKit.getCellIndex(cell);
|
||||
}
|
||||
var pad = parseInt(cell.getStyle('paddingLeft'),10) + parseInt(cell.getStyle('paddingRight'),10);
|
||||
w = Math.max(w-pad, TableKit.option('minWidth', table.id)[0]);
|
||||
cell.setStyle({'width' : w + 'px'});
|
||||
},
|
||||
initDetect : function(e) {
|
||||
e = TableKit.e(e);
|
||||
var cell = Event.element(e);
|
||||
Event.observe(cell, 'mousemove', TableKit.Resizable.detectHandle);
|
||||
Event.observe(cell, 'mousedown', TableKit.Resizable.startResize);
|
||||
},
|
||||
detectHandle : function(e) {
|
||||
e = TableKit.e(e);
|
||||
var cell = Event.element(e);
|
||||
if(TableKit.Resizable.pointerPos(cell,Event.pointerX(e),Event.pointerY(e))){
|
||||
cell.addClassName(TableKit.option('resizeOnHandleClass', cell.up('table').id)[0]);
|
||||
TableKit.Resizable._onHandle = true;
|
||||
} else {
|
||||
cell.removeClassName(TableKit.option('resizeOnHandleClass', cell.up('table').id)[0]);
|
||||
TableKit.Resizable._onHandle = false;
|
||||
}
|
||||
},
|
||||
killDetect : function(e) {
|
||||
e = TableKit.e(e);
|
||||
TableKit.Resizable._onHandle = false;
|
||||
var cell = Event.element(e);
|
||||
if (!cell.tagName || cell.tagName != 'TD') return;
|
||||
Event.stopObserving(cell, 'mousemove', TableKit.Resizable.detectHandle);
|
||||
Event.stopObserving(cell, 'mousedown', TableKit.Resizable.startResize);
|
||||
cell.removeClassName(TableKit.option('resizeOnHandleClass', cell.up('table').id)[0]);
|
||||
},
|
||||
startResize : function(e) {
|
||||
e = TableKit.e(e);
|
||||
if(!TableKit.Resizable._onHandle) { return;}
|
||||
var cell = Event.element(e);
|
||||
Event.stopObserving(cell, 'mousemove', TableKit.Resizable.detectHandle);
|
||||
Event.stopObserving(cell, 'mousedown', TableKit.Resizable.startResize);
|
||||
Event.stopObserving(cell, 'mouseout', TableKit.Resizable.killDetect);
|
||||
TableKit.Resizable._cell = cell;
|
||||
var table = cell.up('table');
|
||||
TableKit.Resizable._tbl = table;
|
||||
if(TableKit.option('showHandle', table.id)[0]) {
|
||||
TableKit.Resizable._handle = $(document.createElement('div')).addClassName('resize-handle').setStyle({
|
||||
'top' : Position.cumulativeOffset(cell)[1] + 'px',
|
||||
'left' : Event.pointerX(e) + 'px',
|
||||
'height' : table.getDimensions().height + 'px'
|
||||
});
|
||||
document.body.appendChild(TableKit.Resizable._handle);
|
||||
}
|
||||
Event.observe(document, 'mousemove', TableKit.Resizable.drag);
|
||||
Event.observe(document, 'mouseup', TableKit.Resizable.endResize);
|
||||
Event.stop(e);
|
||||
},
|
||||
endResize : function(e) {
|
||||
e = TableKit.e(e);
|
||||
var cell = TableKit.Resizable._cell;
|
||||
TableKit.Resizable.resize(null, cell, (Event.pointerX(e) - Position.cumulativeOffset(cell)[0]));
|
||||
Event.stopObserving(document, 'mousemove', TableKit.Resizable.drag);
|
||||
Event.stopObserving(document, 'mouseup', TableKit.Resizable.endResize);
|
||||
if(TableKit.option('showHandle', TableKit.Resizable._tbl.id)[0]) {
|
||||
$$('div.resize-handle').each(function(elm){
|
||||
document.body.removeChild(elm);
|
||||
});
|
||||
}
|
||||
Event.observe(cell, 'mouseout', TableKit.Resizable.killDetect);
|
||||
TableKit.Resizable._tbl = TableKit.Resizable._handle = TableKit.Resizable._cell = null;
|
||||
Event.stop(e);
|
||||
},
|
||||
drag : function(e) {
|
||||
e = TableKit.e(e);
|
||||
if(TableKit.Resizable._handle === null) {
|
||||
try {
|
||||
TableKit.Resizable.resize(TableKit.Resizable._tbl, TableKit.Resizable._cell, (Event.pointerX(e) - Position.cumulativeOffset(TableKit.Resizable._cell)[0]));
|
||||
} catch(e) {}
|
||||
} else {
|
||||
TableKit.Resizable._handle.setStyle({'left' : Event.pointerX(e) + 'px'});
|
||||
}
|
||||
return false;
|
||||
},
|
||||
pointerPos : function(element, x, y) {
|
||||
var offset = Position.cumulativeOffset(element);
|
||||
return (y >= offset[1] &&
|
||||
y < offset[1] + element.offsetHeight &&
|
||||
x >= offset[0] + element.offsetWidth - 5 &&
|
||||
x < offset[0] + element.offsetWidth);
|
||||
},
|
||||
_onHandle : false,
|
||||
_cell : null,
|
||||
_tbl : null,
|
||||
_handle : null
|
||||
};
|
||||
|
||||
|
||||
TableKit.Editable = {
|
||||
init : function(elm, options){
|
||||
var table = $(elm);
|
||||
if(table.tagName !== "TABLE") {return;}
|
||||
TableKit.register(table,Object.extend(options || {},{editable:true}));
|
||||
Event.observe(table.tBodies[0], 'click', TableKit.Editable._editCell);
|
||||
},
|
||||
_editCell : function(e) {
|
||||
e = TableKit.e(e);
|
||||
var cell = Event.findElement(e,'td');
|
||||
TableKit.Editable.editCell(null, cell);
|
||||
},
|
||||
editCell : function(table, index, cindex) {
|
||||
var cell, row;
|
||||
if(typeof index === 'number') {
|
||||
if(!table || (table.tagName && table.tagName !== "TABLE")) {return;}
|
||||
table = $(table);
|
||||
index = Math.min(table.tBodies[0].rows.length, index);
|
||||
index = Math.max(1, index);
|
||||
index -= 1;
|
||||
cindex = Math.min(table.rows[0].cells.length, cindex);
|
||||
cindex = Math.max(1, cindex);
|
||||
cindex -= 1;
|
||||
row = $(table.tBodies[0].rows[index]);
|
||||
cell = $(row.cells[cindex]);
|
||||
} else {
|
||||
cell = $(index);
|
||||
table = (table && table.tagName && table.tagName !== "TABLE") ? $(table) : cell.up('table');
|
||||
row = cell.up('tr');
|
||||
}
|
||||
var op = TableKit.option('noEditClass', table.id);
|
||||
if(cell.hasClassName(op.noEditClass)) {return;}
|
||||
|
||||
var head = $(TableKit.getHeaderCells(table, cell)[TableKit.getCellIndex(cell)]);
|
||||
if(head.hasClassName(op.noEditClass)) {return;}
|
||||
|
||||
TableKit.registerCell(cell);
|
||||
var data = TableKit.cells[cell.id];
|
||||
if(data.active) {return;}
|
||||
data.htmlContent = cell.innerHTML;
|
||||
var ftype = TableKit.Editable.types['text-input'];
|
||||
if(head.id && TableKit.Editable.types[head.id]) {
|
||||
ftype = TableKit.Editable.types[head.id];
|
||||
} else {
|
||||
var n = head.classNames().detect(function(n){
|
||||
return (TableKit.Editable.types[n]) ? true : false;
|
||||
});
|
||||
ftype = n ? TableKit.Editable.types[n] : ftype;
|
||||
}
|
||||
ftype.edit(cell);
|
||||
data.active = true;
|
||||
},
|
||||
types : {},
|
||||
addCellEditor : function(o) {
|
||||
if(o && o.name) { TableKit.Editable.types[o.name] = o; }
|
||||
}
|
||||
};
|
||||
|
||||
TableKit.Editable.CellEditor = Class.create();
|
||||
TableKit.Editable.CellEditor.prototype = {
|
||||
initialize : function(name, options){
|
||||
this.name = name;
|
||||
this.options = Object.extend({
|
||||
element : 'input',
|
||||
attributes : {name : 'value', type : 'text'},
|
||||
selectOptions : [],
|
||||
showSubmit : true,
|
||||
submitText : 'OK',
|
||||
showCancel : true,
|
||||
cancelText : 'Cancel',
|
||||
ajaxURI : null,
|
||||
ajaxOptions : null
|
||||
}, options || {});
|
||||
},
|
||||
edit : function(cell) {
|
||||
cell = $(cell);
|
||||
var op = this.options;
|
||||
var table = cell.up('table');
|
||||
|
||||
var form = $(document.createElement("form"));
|
||||
form.id = cell.id + '-form';
|
||||
form.addClassName(TableKit.option('formClassName', table.id)[0]);
|
||||
form.onsubmit = this._submit.bindAsEventListener(this);
|
||||
|
||||
var field = document.createElement(op.element);
|
||||
$H(op.attributes).each(function(v){
|
||||
field[v.key] = v.value;
|
||||
});
|
||||
switch(op.element) {
|
||||
case 'input':
|
||||
case 'textarea':
|
||||
field.value = TableKit.getCellText(cell);
|
||||
break;
|
||||
|
||||
case 'select':
|
||||
var txt = TableKit.getCellText(cell);
|
||||
$A(op.selectOptions).each(function(v){
|
||||
field.options[field.options.length] = new Option(v[0], v[1]);
|
||||
if(txt === v[1]) {
|
||||
field.options[field.options.length-1].selected = 'selected';
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
form.appendChild(field);
|
||||
if(op.element === 'textarea') {
|
||||
form.appendChild(document.createElement("br"));
|
||||
}
|
||||
if(op.showSubmit) {
|
||||
var okButton = document.createElement("input");
|
||||
okButton.type = "submit";
|
||||
okButton.value = op.submitText;
|
||||
okButton.className = 'editor_ok_button';
|
||||
form.appendChild(okButton);
|
||||
}
|
||||
if(op.showCancel) {
|
||||
var cancelLink = document.createElement("a");
|
||||
cancelLink.href = "#";
|
||||
cancelLink.appendChild(document.createTextNode(op.cancelText));
|
||||
cancelLink.onclick = this._cancel.bindAsEventListener(this);
|
||||
cancelLink.className = 'editor_cancel';
|
||||
form.appendChild(cancelLink);
|
||||
}
|
||||
cell.innerHTML = '';
|
||||
cell.appendChild(form);
|
||||
},
|
||||
_submit : function(e) {
|
||||
var cell = Event.findElement(e,'td');
|
||||
var form = Event.findElement(e,'form');
|
||||
Event.stop(e);
|
||||
this.submit(cell,form);
|
||||
},
|
||||
submit : function(cell, form) {
|
||||
var op = this.options;
|
||||
form = form ? form : cell.down('form');
|
||||
var head = $(TableKit.getHeaderCells(null, cell)[TableKit.getCellIndex(cell)]);
|
||||
var row = cell.up('tr');
|
||||
var table = cell.up('table');
|
||||
var s = '&row=' + (TableKit.getRowIndex(row)+1) + '&cell=' + (TableKit.getCellIndex(cell)+1) + '&id=' + row.id + '&field=' + head.id + '&' + Form.serialize(form);
|
||||
this.ajax = new Ajax.Updater(cell, op.ajaxURI || TableKit.option('editAjaxURI', table.id)[0], Object.extend(op.ajaxOptions || TableKit.option('editAjaxOptions', table.id)[0], {
|
||||
postBody : s,
|
||||
onComplete : function() {
|
||||
var data = TableKit.cells[cell.id];
|
||||
data.active = false;
|
||||
data.refresh = true; // mark cell cache for refreshing, in case cell contents has changed and sorting is applied
|
||||
}
|
||||
}));
|
||||
},
|
||||
_cancel : function(e) {
|
||||
var cell = Event.findElement(e,'td');
|
||||
Event.stop(e);
|
||||
this.cancel(cell);
|
||||
},
|
||||
cancel : function(cell) {
|
||||
this.ajax = null;
|
||||
var data = TableKit.cells[cell.id];
|
||||
cell.innerHTML = data.htmlContent;
|
||||
data.htmlContent = '';
|
||||
data.active = false;
|
||||
},
|
||||
ajax : null
|
||||
};
|
||||
|
||||
TableKit.Editable.textInput = function(n,attributes) {
|
||||
TableKit.Editable.addCellEditor(new TableKit.Editable.CellEditor(n, {
|
||||
element : 'input',
|
||||
attributes : Object.extend({name : 'value', type : 'text'}, attributes||{})
|
||||
}));
|
||||
};
|
||||
TableKit.Editable.textInput('text-input');
|
||||
|
||||
TableKit.Editable.multiLineInput = function(n,attributes) {
|
||||
TableKit.Editable.addCellEditor(new TableKit.Editable.CellEditor(n, {
|
||||
element : 'textarea',
|
||||
attributes : Object.extend({name : 'value', rows : '5', cols : '20'}, attributes||{})
|
||||
}));
|
||||
};
|
||||
TableKit.Editable.multiLineInput('multi-line-input');
|
||||
|
||||
TableKit.Editable.selectInput = function(n,attributes,selectOptions) {
|
||||
TableKit.Editable.addCellEditor(new TableKit.Editable.CellEditor(n, {
|
||||
element : 'select',
|
||||
attributes : Object.extend({name : 'value'}, attributes||{}),
|
||||
'selectOptions' : selectOptions
|
||||
}));
|
||||
};
|
||||
|
||||
/*
|
||||
TableKit.Bench = {
|
||||
bench : [],
|
||||
start : function(){
|
||||
TableKit.Bench.bench[0] = new Date().getTime();
|
||||
},
|
||||
end : function(s){
|
||||
TableKit.Bench.bench[1] = new Date().getTime();
|
||||
alert(s + ' ' + ((TableKit.Bench.bench[1]-TableKit.Bench.bench[0])/1000)+' seconds.') //console.log(s + ' ' + ((TableKit.Bench.bench[1]-TableKit.Bench.bench[0])/1000)+' seconds.')
|
||||
TableKit.Bench.bench = [];
|
||||
}
|
||||
} */
|
||||
|
||||
if(window.FastInit) {
|
||||
FastInit.addOnLoad(TableKit.load);
|
||||
} else {
|
||||
Event.observe(window, 'load', TableKit.load);
|
||||
}
|
||||
Reference in New Issue
Block a user