diff --git a/UI/WebServerResources/AdministrationUI.css b/UI/WebServerResources/AdministrationUI.css deleted file mode 100644 index 46e787a1a..000000000 --- a/UI/WebServerResources/AdministrationUI.css +++ /dev/null @@ -1,136 +0,0 @@ -DIV#helpDialog -{ - width: 300px; -} - -DIV#helpDialog H3 -{ - font-size: 1.2em; - margin: 0; - padding: 0; -} - -DIV#helpDialog DIV DIV -{ - border: 0; - margin: 0; - padding: 0; -} - -DIV#helpDialog P.button -{ - margin: 0; - padding: 0 0 5px 0; - text-align: right; -} - -DIV#verticalDragHandle -{ - cursor: e-resize; - top: 6em; - left: 15em; - width: 5px; - bottom: 0px; -} - -.titlediv -{ - vertical-align: bottom; - padding-top: 14px; - padding-left: 6px; -} - -DIV#administrationModules -{ - position: absolute; - top: 9em; - left: 0; - width: 15em; - bottom: 2px; - margin: 0px; - padding: 0px; - overflow: hidden; -} - -DIV#administrationModules UL -{ - display: block; - list-style-type: none; - list-style-image: none; - clear: both; - cursor: default; - color: #000; - position: absolute; /* required for Safari & IE */ - top: 0px; - bottom: 0px; - left: 0; - right: 0; - width: auto; - margin: 0px; - padding: 0px; - overflow: auto; - overflow-x: hidden; - border-top: 1px solid #909090; - border-left: 1px solid #909090; - border-bottom: 1px solid #FFFFFF; - border-right: 1px solid #FFFFFF; - -moz-user-select: none; - -khtml-user-select: none; -} -DIV#administrationModules -{ background: #CCDDEC; } - -DIV#administrationModules UL LI -{ - cursor: pointer; - line-height: 20px; - height: 20px; - padding-left: 0.5em; - margin: 0px; - width: auto; - white-space: nowrap; -} - -DIV#rightPanel -{ - position: absolute; - top: 80px; - left: 15em; - margin-left: 5px; - right: 0px; - bottom: 0px; - overflow: hidden; -} - -DIV#rightPanel > SPAN -{ - float: left; -} - -DIV#rightPanel H1 -{ - font-size: 14px; - margin: 0.5em 0 5px 0; -} - -DIV#filterPanel -{ - n0padding-top: 5px; - width: auto; -} - -DIV#administrationContent -{ - position: absolute; - left: 0; - right: 1em; - top: 3em; - bottom: 2px; - background-color: #fff; - padding: .5em; - overflow: auto; - border-top: 1px solid #909090; - border-left: 1px solid #909090; - border-bottom: 1px solid #FFFFFF; - border-right: 1px solid #FFFFFF; -} diff --git a/UI/WebServerResources/AdministrationUI.js b/UI/WebServerResources/AdministrationUI.js deleted file mode 100644 index 961beedf9..000000000 --- a/UI/WebServerResources/AdministrationUI.js +++ /dev/null @@ -1,221 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -var d; -var usersRightsWindowHeight = 220; -var usersRightsWindowWidth = 450; - -/* ACLs module */ - -function onSearchFormSubmit(panel) { - var searchValue = panel.down('[name="search"]'); - var encodedValue = encodeURI(searchValue.value); - - if (encodedValue.blank()) { - checkAjaxRequestsState(); - } - else { - var url = (UserFolderURL - + "usersSearch?search=" + encodedValue); - if (document.userFoldersRequest) { - document.userFoldersRequest.aborted = true; - document.userFoldersRequest.abort(); - } - document.userFoldersRequest - = triggerAjaxRequest(url, usersSearchCallback); - } - - return false; -} - -function usersSearchCallback(http) { - document.userFoldersRequest = null; - var div = $("administrationContent"); - if (http.status == 200) { - var response = http.responseText.evalJSON(); - buildUsersTree(div, response) - } - else if (http.status == 404) - div.update(); -} - -function buildUsersTree(treeDiv, response) { - d = new dTree("d"); - d.config.hideRoot = true; - d.icon.root = ResourcesURL + '/tbtv_account_17x17.gif'; - d.icon.folder = ResourcesURL + '/tbtv_leaf_corner_17x17.png'; - d.icon.folderOpen = ResourcesURL + '/tbtv_leaf_corner_17x17.png'; - d.icon.node = ResourcesURL + '/tbtv_leaf_corner_17x17.png'; - d.icon.line = ResourcesURL + '/tbtv_line_17x22.png'; - d.icon.join = ResourcesURL + '/tbtv_junction_17x22.png'; - d.icon.joinBottom = ResourcesURL + '/tbtv_corner_17x22.png'; - d.icon.plus = ResourcesURL + '/tbtv_plus_17x22.png'; - d.icon.plusBottom = ResourcesURL + '/tbtv_corner_plus_17x22.png'; - d.icon.minus = ResourcesURL + '/tbtv_minus_17x22.png'; - d.icon.minusBottom = ResourcesURL + '/tbtv_corner_minus_17x22.png'; - d.icon.nlPlus = ResourcesURL + '/tbtv_corner_plus_17x22.png'; - d.icon.nlMinus = ResourcesURL + '/tbtv_corner_minus_17x22.png'; - d.icon.empty = ResourcesURL + '/empty.gif'; - d.preload (); - d.add(0, -1, ''); - - var isUserDialog = false; - var multiplier = ((isUserDialog) ? 1 : 2); - - for (var i = 0; i < response.length; i++) - addUserLineToTree(d, 1 + i * multiplier, response[i]); - treeDiv.innerHTML = ""; - treeDiv.appendChild(d.domObject()); - treeDiv.clean = false; - for (var i = 0; i < response.length; i++) { - if (!isUserDialog) { - var toggle = $("tgd" + (1 + i * 2)); - toggle.observe ("click", onUserNodeToggle); - } - var sd = $("sd" + (1 + i * multiplier)); - sd.observe("click", onTreeItemClick); - } -} - -function addUserLineToTree(tree, parent, line) { - var icon = ResourcesURL + '/busy.gif'; - - var email = line[1] + " <" + line[2] + ">"; - if (line[4] && !line[4].empty()) - email += ", " + line[4]; // extra contact info - tree.add(parent, 0, email, 0, '#', line[0], 'person', - '', '', - ResourcesURL + '/abcard.png', - ResourcesURL + '/abcard.png'); - tree.add(parent + 1, parent, _("Please wait..."), 0, '#', null, - null, '', '', icon, icon); -} - -function onTreeItemClick(event) { - preventDefault(event); - - var topNode = $("d"); - if (topNode.selectedEntry) - topNode.selectedEntry.deselect(); - this.selectElement(); - topNode.selectedEntry = this; -} - -function onUserNodeToggle(event) { - this.stopObserving("click", onUserNodeToggle); - - var person = this.parentNode.getAttribute("dataname"); - var url = (UserFolderURLForUser(person) + "foldersSearch"); - var nodeId = this.getAttribute("id").substr(3); - triggerAjaxRequest(url, foldersSearchCallback, - { nodeId: nodeId, user: person }); -} - -function foldersSearchCallback(http) { - if (http.status == 200) { - var response = http.responseText; - var nodeId = parseInt(http.callbackData["nodeId"]); - - var dd = $("dd" + (nodeId + 2)); - var indentValue = (dd ? 1 : 0); - d.aIndent.push(indentValue); - - var dd = $("dd" + nodeId); - if (response.length) { - var folders = response.evalJSON(); - var user = http.callbackData["user"]; - - dd.innerHTML = ''; - for (var i = 0; i < folders.length - 1; i++) - dd.appendChild(addFolderBranchToTree (d, user, folders[i], nodeId, i+1, false)); - dd.appendChild (addFolderBranchToTree (d, user, folders[folders.length-1], nodeId, - (folders.length), true)); - for (var i = 0; i < folders.length; i++) { - var sd = $("sd" + (nodeId + i + 1)); - sd.observe("click", onTreeItemClick); - sd.observe("dblclick", onFolderOpen); - } - } - else { - dd.innerHTML = ''; - dd.appendChild (addFolderNotFoundNode (d, nodeId, null)); - var sd = $("sd" + (nodeId + 1)); - sd.observe("click", onTreeItemClick); - } - - d.aIndent.pop(); - } -} - -function addFolderBranchToTree(tree, user, folder, nodeId, subId, isLast) { - var icon = ResourcesURL + '/'; - if (folder.type == 'Contact') - icon += 'tb-mail-addressbook-flat-16x16.png'; - else - icon += 'calendar-folder-16x16.png'; - var folderId = user + ":" + folder.name.substr(1); - var name = folder.displayName.escapeHTML(); - var node = new dTreeNode(subId, nodeId, name, 0, '#', folderId, - folder.type + '-folder', '', '', icon, icon); - node._ls = isLast; - var content = tree.node(node, (nodeId + subId), null); - - return content; -} - -function addFolderNotFoundNode (tree, nodeId) { - var icon = ResourcesURL + '/icon_unread.gif'; - var node = new dTreeNode(1, nodeId, _("No possible subscription"), 0, '#', - null, null, '', '', icon, icon); - node._ls = true; - return tree.node(node, (nodeId + 1), null); -} - -function onFolderOpen(event) { - var obj = Event.element(event); - var node = obj.up("div.dTreeNode"); - var folderID = node.readAttribute("dataname"); - var urlstr = URLForFolderID(folderID) + "/acls"; - openAclWindow(urlstr); -} - -/* Common functions */ - -function configureDragHandles() { - var handle = $("verticalDragHandle"); - if (handle) { - handle.addInterface(SOGoDragHandlesInterface); - handle.leftBlock = $("administrationModules"); - handle.rightBlock = $("rightPanel"); - handle.leftMargin = 100; - } -} - -function help() { - var div = $("helpDialog"); - var title = div.select('H3').first(); - var description = div.select('DIV DIV')[0]; - var module = $$("#administrationModules LI._selected").first(); - - var cellPosition = module.cumulativeOffset(); - var cellDimensions = module.getDimensions(); - var left = cellDimensions.width - 20; - var top = cellPosition.top + 3; - - div.setStyle({ top: top + 'px', - left: left + 'px' }); - title.update($("moduleTitle").innerHTML); - description.update($("moduleDescription").innerHTML); - - div.show(); -} - -function initAdministration() { - $("helpDialogClose").observe("click", function(event) { - $("helpDialog").hide(); - }); - - var searchValue = $$('[data-search="admin"] [name="search"]').first(); - searchValue.focus(); -} - -document.observe("dom:loaded", initAdministration); diff --git a/UI/WebServerResources/COPYING-thunderbird.txt b/UI/WebServerResources/COPYING-thunderbird.txt deleted file mode 100644 index 74925c7d0..000000000 --- a/UI/WebServerResources/COPYING-thunderbird.txt +++ /dev/null @@ -1,5 +0,0 @@ -The default theme icons are derived from the icons provided as -part of the Mozilla Thunderbird application. -The licensing terms of Mozilla Thunderbird are available in the -LICENSE-thunderbird.txt file. - diff --git a/UI/WebServerResources/ContactsUI.css b/UI/WebServerResources/ContactsUI.css deleted file mode 100644 index e1423ccb4..000000000 --- a/UI/WebServerResources/ContactsUI.css +++ /dev/null @@ -1,426 +0,0 @@ -/* - Copyright (C) 2005 SKYRIX Software AG - - This file is part of OpenGroupware.org. - - OGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - OGo is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - 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 - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -DIV#rightPanel -{ position: absolute; - top: 80px; - left: 15em; - margin-left: 5px; - right: 0px; - bottom: 0px; - overflow: hidden; } - -/* top list */ -DIV#contactsListContent -{ cursor: default; - position: absolute; - background-color: #FFFFFF; - top: 27px; - left: 0px; - right: 0px; - height: 15.5em; - border-left: 1px solid #9B9B9B; - overflow: auto; - overflow-x: hidden; } - -.aptview_text -{ - color: #000000; -} - -.apt_other -{ - color: #000000; -} - -.apt_other_print -{ - font-style: italic; -} - -.foldercell -{ - width: 25%; -} - -.titlediv -{ line-height: 18px; - vertical-align: middle; - padding-top: 8px; - padding-left: 6px; } - -TABLE.titletable -{ - height: 24px; - vertical-align: middle; - padding-top: 6px; - padding-left: 6px; -} - -TD.titlecell -{ - height: 22px; - vertical-align: middle; - padding-bottom: 2px; - white-space: nowrap; -} - -TABLE.titletable TD.titlecell SELECT -{ - display: -moz-popup; - border-top: 1px solid #fff; - border-left: 1px solid #fff; - border-right: 2px solid #222; - border-bottom: 2px solid #222; - -moz-border-bottom-colors: #000 #9c9a94 transparent; - -moz-border-right-colors: #000 #9c9a94 transparent; - background-color: #DCDAD5; -} - -.whitesec_title -{ - background-color: #DCDAD5; - padding: 4px; -} - -DIV#contactFoldersList -{ position: absolute; - top: 82px; - left: 0px; - width: 15em; - background-color: #CCDDEC; - bottom: 0px; - margin: 0px; - padding: 0px; - overflow: auto; - overflow-x: hidden; } - -DIV#abToolbar -{ padding-left: 6px; } - -SPAN.toolbarButton -{ float: none; - padding: 14px 2px 0px 2px; } - -A.toolbarButton -{ text-decoration: none; } - -UL#contactFolders -{ list-style-type: none; - list-style-image: none; - clear: left; - cursor: default; - color: #000; - margin: 0px; - padding: 0px; - overflow: auto; - overflow-x: hidden; - -moz-user-select: none; - -khtml-user-select: none; -} - -UL#contactFolders LI -{ - background-repeat: no-repeat; - background-position: 14px 2px; - cursor: pointer; - line-height: 2em; - padding-left: 34px; - margin: 0px; - width: auto; - white-space: nowrap; -} - -DIV#contactFoldersList LI.local -{ - background-image: url('addrbook.png'); -} - -DIV#contactFoldersList LI.remote -{ - background-image: url('remote-addrbook.png'); -} - -.treecell -{ - color: black; - vertical-align: bottom; - padding-left: 4px; /* move away from the icon */ - padding-right: 2px; /* move away from the right border */ - white-space: nowrap; -} - -DIV#folderTreeContent TABLE TD -{ height: 2em; - border-top: 1px solid #fff; - margin: 0px; - padding: 0px; } - -TABLE#contactsList -{ -moz-user-select: none; - -khtml-user-select: none; - width: 100%; } - -TABLE#contactsList TBODY TD -{ cursor: pointer; } - -TABLE#contactsList TD, -TABLE#contactsList TH -{ overflow: hidden; - line-height: 16px; - height: 18px; - text-overflow: ellipsis; - white-space: nowrap; } /* pre, normal, nowrap */ - -TABLE#contactsList TH -{ white-space: pre; } - -TABLE#contactsList TR._deleted TD -{ - text-decoration: line-through; -} - -TABLE#contactsList TD.displayName -{ background-repeat: no-repeat; - background-position: 4px 1px; - padding-left: 24px; } - -TABLE#contactsList TR.vcard TD.displayName -{ - background-image: url('abcard.png'); -} - -TABLE#contactsList TR.vlist TD.displayName -{ - background-image: url('ablist.png'); -} - -DIV#contactView -{ - position: absolute; - background: #fff; - padding: .5em; - top: 18em; - left: 0px; - right: 0px; - bottom: 0px; - overflow: auto; - margin-top: 5px; - border-top: 1px solid #aaa; - border-left: 1px solid #aaa; - line-height: 1em; -} - -DIV#contactView A -{ color: #00f; - text-decoration: none; } - -DIV#contactView H3.contactCardTitle -{ margin: 0px; - padding: .2em 0px; - font-size: large; - font-weight: bold; - text-decoration: underline; } - -DIV.contactColumn -{ width: 50%; - margin: 0; - padding: 0; - float: left; } - -DIV.contactColumn DIV -{ margin: 1em; } - -DIV.contactColumn H4 -{ margin: .2em 0px; - margin-left: 0; - font-size: 10pt; - font-weight: bold; - background: #9ABCD8; - color: #fff; - width: 100%; - padding: .1em .2em; } - -dt { - color: #666; - line-height: 13px; -} -dd { - line-height: 14px; -} -.dl-horizontal dt { - width: 100px; -} -.dl-horizontal dd { - margin-left: 110px; -} - -SPAN.photoFrame -{ cursor: pointer; - float: left; - background-color: #fff; - border: 1px solid #999; - padding: 8px; - margin: 8px; - box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.2); - -moz-transform: rotate(-2deg); - -webkit-transform: rotate(-2deg); - -ms-transform: rotate(-2deg); - -moz-transition: all 0.2s ease-in-out; - -webkit-transition: all 0.2s ease-in-out; } - -SPAN.photoFrame IMG.contactPhoto -{ max-width: 120px; - max-height: 120px;} - -SPAN.photoFrame:hover { - -moz-transform: scale(3.0, 3.0) rotate(0deg) translate(33%, 33%); - -webkit-transform: scale(3.0, 3.0) rotate(0deg) translate(33%, 33%); - -ms-transform: rotate(0deg) scale(3.0, 3.0); } - -/* drag handles */ -DIV#dragHandle -{ cursor: e-resize; - border: 0px; - top: 81px; - left: 15em; - width: 5px; - bottom: 0px; } - -DIV#rightDragHandle -{ - cursor: n-resize; - top: 18em; - left: 0px; - right: 0px; - height: 5px; -} - -DIV.contactSelector -{ - position: absolute; - top: 0px; - bottom: 0px; - right: 0px; - left: 0px; -} - -BODY.popup DIV#rightPanel -{ top: 4em; } - -BODY.popup DIV#dragHandle -{ top: 7em; } - -BODY.popup DIV#contactsListContent -{ height: 7em; - top: 34px; } - -BODY.popup DIV#contactFoldersList -{ top: 50px; } - -BODY.popup DIV#rightDragHandle -{ top: 10.2em; } - -BODY.popup DIV#contactView -{ top: 10.2em; } - -BODY.popup DIV#filterPanel -{ position: relative; - top: 7px; -} - -DIV.contactSelection -{ - z-index: 10; - background: inherit; - position: absolute; - bottom: 0em; - padding: 1em; - left: 0px; - right: 0px; - height: 90px; - text-align: right; - background: #E6E7E6; - border-top: 1px solid #fff; - border-left: 0px; - border-right: 0px; - border-bottom: 0px; -} - -DIV.contactSelection > DIV.calendar -{ text-align: center; } - -DIV.contactSelection INPUT.button -{ font-size: 8pt; - margin-top: .25em; - padding: 0px; } - -DIV.contactSelection SPAN#selectionLabel -{ float: left; } - -DIV#dragDropVisual -{ - background-image: url(abcard.png); - background-repeat: no-repeat; - background-position: 4px 2px; - width: 5px; - height: 20px; - padding-left: 24px; - padding-top: 5px; -} - -DIV.copy -{ - background-image: url(add-contact.gif) !important; - background-position: 1px -2px !important; -} - -@media print -{ - div#linkBanner, - div#contactFoldersList, - div#dragHandle, - div#rightDragHandle, - div.menu, - div#filterPanel, - div#contactsListContent - { - display: none; - } - - div#contactView, - div#rightPanel - { - color: black; - top: 0px; - left: 0px; - margin: 0px; - border: none; - display: block; - visibility: visible; - width: 100%; - height: 100%; - } - - div.contactColumn h4 { - background: none; - } -} diff --git a/UI/WebServerResources/ContactsUI.js b/UI/WebServerResources/ContactsUI.js deleted file mode 100644 index 3386bff6e..000000000 --- a/UI/WebServerResources/ContactsUI.js +++ /dev/null @@ -1,1649 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* JavaScript for SOGoContacts */ - -var cachedContacts = {}; - -var usersRightsWindowHeight = 194; -var usersRightsWindowWidth = 450; - -var Contact = { - currentAddressBook: "/personal", - currentContactId: null -}; - -var refreshViewCheckTimer; - -function openContactsFolder(contactsFolder, reload, idx) { - if ((contactsFolder && contactsFolder != Contact.currentAddressBook) - || reload) { - Contact.currentAddressBook = contactsFolder; - var url = URLForFolderID(Contact.currentAddressBook, "Contacts") + - "/view?noframe=1"; - - var searchValue = search["contacts"]["value"]; - if (searchValue && searchValue.length > 0) - url += ("&search=" + search["contacts"]["criteria"] - + "&value=" + escape(searchValue.utf8encode())); - var sortAttribute = sorting["attribute"]; - if (sortAttribute && sortAttribute.length > 0) - url += ("&sort=" + sorting["attribute"] - + "&asc=" + sorting["ascending"]); - - var selection; - if (idx) { - selection = [idx.asCSSIdentifier()]; - } - else if (contactsFolder == Contact.currentAddressBook) { - var contactsList = $("contactsList"); - if (contactsList) - selection = contactsList.getSelectedRowsId(); - } - else - selection = null; - - if (document.contactsListAjaxRequest) { - document.contactsListAjaxRequest.aborted = true; - document.contactsListAjaxRequest.abort(); - } - - document.contactsListAjaxRequest - = triggerAjaxRequest(url, contactsListCallback, selection); - } -} - -function contactsListCallback(http) { - if (http.readyState == 4) { - if (http.status == 200) { - document.contactsListAjaxRequest = null; - - var div = $("contactsListContent"); - var table = $("contactsList"); - var tbody = table.tBodies[0]; - var rows = tbody.getElementsByTagName("TR"); - var fullView = (table.tHead.rows[0].cells.length > 2); - var data = []; - if (http.responseText.length > 0) - data = http.responseText.evalJSON(true); - - tbody.deselectAll(); - - div.scrollTop = 0; - if (data.length > 0) { - // Replace existing rows - for (var i = 0; i < data.length && i < rows.length; i++) { - var contact = data[i]; - var row = rows[i]; - row.className = contact["c_component"]; - row.setAttribute("id", contact["c_name"].asCSSIdentifier()); - row.setAttribute("categories", contact["c_categories"]); - row.setAttribute("contactname", contact["c_cn"]); - var cells = row.getElementsByTagName("TD"); - if (contact["c_cn"]) - $(cells[0]).update(contact["c_cn"].escapeHTML()); - else - $(cells[0]).update(); - cells[0].title = contact["c_cn"]; - log('mail ' + contact["c_mail"]); - if (contact["c_mail"]) - $(cells[1]).update(contact["c_mail"].escapeHTML()); - else - $(cells[1]).update(); - cells[1].title = contact["c_mail"]; - if (fullView) { - if (contact["c_screenname"]) - $(cells[2]).update(contact["c_screenname"].escapeHTML()); - else - $(cells[2]).update(); - - if (contact["c_o"]) - $(cells[3]).update(contact["c_o"].escapeHTML()); - else - $(cells[3]).update(); - - if (contact["c_telephonenumber"]) - $(cells[4]).update(contact["c_telephonenumber"].escapeHTML()); - else - $(cells[4]).update(); - } - } - - // Add extra rows - for (var j = i; j < data.length; j++) { - var contact = data[j]; - var row = createElement("tr", - contact["c_name"].asCSSIdentifier(), - contact["c_component"], - null, - { categories: contact["c_categories"], - contactname: contact["c_cn"] }, - tbody); - var cell = createElement("td", - null, - ( "displayName" ), - null, - null, - row); - - if (contact["c_cn"]) { - $(cell).update(contact["c_cn"].escapeHTML()); - cell.title = contact["c_cn"]; - } - - cell = document.createElement("td"); - row.appendChild(cell); - - if (contact["c_mail"]) { - $(cell).update(contact["c_mail"].escapeHTML()); - cell.title = contact["c_mail"]; - } - - if (fullView) { - cell = document.createElement("td"); - row.appendChild(cell); - if (contact["c_screenname"]) - $(cell).update(contact["c_screenname"].escapeHTML()); - - cell = document.createElement("td"); - row.appendChild(cell); - if (contact["c_o"]) - $(cell).update(contact["c_o"].escapeHTML()); - - cell = document.createElement("td"); - row.appendChild(cell); - if (contact["c_telephonenumber"]) - $(cell).update(contact["c_telephonenumber"].escapeHTML()); - } - } - } - - // Remove unnecessary rows - for (i = rows.length - 1; i >= data.length; i--) { - tbody.removeChild(rows[i]); - } - - if (sorting["attribute"] && sorting["attribute"].length > 0) { - var sortHeader; - if (sorting["attribute"] == "c_cn") - sortHeader = $("nameHeader"); - else if (sorting["attribute"] == "c_mail") - sortHeader = $("mailHeader"); - else if (sorting["attribute"] == "c_screenname") - sortHeader = $("screenNameHeader"); - else if (sorting["attribute"] == "c_o") - sortHeader = $("orgHeader"); - else if (sorting["attribute"] == "c_telephonenumber") - sortHeader = $("phoneHeader"); - else - sortHeader = null; - - if (sortHeader) { - var sortImages = $(table.tHead).select(".sortImage"); - $(sortImages).each(function(item) { - item.remove(); - }); - - var sortImage = createElement("img", "messageSortImage", "sortImage"); - sortHeader.insertBefore(sortImage, sortHeader.firstChild); - if (sorting["ascending"]) - sortImage.src = ResourcesURL + "/arrow-up.png"; - else - sortImage.src = ResourcesURL + "/arrow-down.png"; - } - } - - // Restore selection and scroll to first selected node - var selection = http.callbackData; - if (selection && tbody.refreshSelectionByIds(selection) > 0) { - for (var i = 0; i < selection.length; i++) { - var row = $(selection[i]); - if (row) { - var rowPosition = row.rowIndex * row.getHeight(); - if (div.getHeight() < rowPosition) - div.scrollTop = rowPosition; // scroll to selected contact - row.selectElement(); - break; - } - } - } - else - tbody.deselectAll(); - } - else { - // No more access to this address book; empty the list - var table = $("contactsList"); - if (table) { - var sortImages = $(table.tHead).select(".sortImage"); - $(sortImages).each(function(item) { - item.remove(); - }); - var tBody = $(table.tBodies[0]); - var length = tBody.rows.length; - for (var i = length - 1; i > -1; i--) - tBody.removeChild(tBody.rows[i]); - } - } - - configureDraggables(); - } - else - log ("ajax problem 1: status = " + http.status); -} - -function onContactContextMenu(event) { - var target = Event.element(event); - var contact = target.up('TR'); - var contactsList = $("contactsList"); - var contacts = contactsList.getSelectedRows(); - - if (contacts.indexOf(contact) < 0) { - onRowClick(event, target); - contacts = contactsList.getSelectedRows(); - } - - if (contactsList) { - var menu = $("contactMenu"); - menu.observe("contextmenu:hide", onContactContextMenuHide); - popupMenu(event, "contactMenu", contacts); - } -} - -function onContactContextMenuHide(event) { - var topNode = $("contactsList"); - - if (topNode.menuSelectedEntry) { - $(topNode.menuSelectedEntry).deselect(); - topNode.menuSelectedEntry = null; - } - if (topNode.menuSelectedRows) { - var nodes = topNode.menuSelectedRows; - for (var i = 0; i < nodes.length; i++) - $(nodes[i]).selectElement(); - topNode.menuSelectedRows = null; - } - - this.stopObserving("contextmenu:hide", onContactContextMenuHide); -} - -function _onContactMenuAction(folderItem, action, refresh) { - var selectedFolders = $("contactFolders").getSelectedNodes(); - var folderId = $(folderItem).readAttribute("folderId"); - if (folderId) - folderId = folderId.substring(1); - if (Object.isArray(document.menuTarget) && selectedFolders.length > 0) { - var selectedFolderId = $(selectedFolders[0]).readAttribute("id"); - var contactIds = $(document.menuTarget).collect(function(row) { - return row.getAttribute("id").fromCSSIdentifier(); - }); - - for (var i = 0; i < contactIds.length; i++) { - if (contactIds[i].endsWith ("vlf")) { - showAlertDialog(_("Lists can't be moved or copied.")); - return false; - } - } - - var url = ApplicationBaseURL + "/" + selectedFolderId + "/" + action; - var uids = contactIds.collect(encodeURIComponent).join('&uid='); - if (refresh) - triggerAjaxRequest(url, actionContactCallback, selectedFolderId, - ('folder='+ folderId + '&uid=' + uids), - { "Content-type": "application/x-www-form-urlencoded" }); - - else - triggerAjaxRequest(url, actionContactCallback, null, - ('folder='+ folderId + '&uid=' + uids), - { "Content-type": "application/x-www-form-urlencoded" }); - } -} - -function onContactMenuCopy(event) { - _onContactMenuAction(this, "copy", false); -} - -function onContactMenuMove(event) { - _onContactMenuAction(this, "move", true); -} - -function onMenuExportContact (event) { - var selectedFolders = $("contactFolders").getSelectedNodes(); - var canExport = (selectedFolders[0].getAttribute("owner") != "nobody"); - if (canExport) { - var selectedFolderId = $(selectedFolders[0]).readAttribute("id"); - var contactIds = document.menuTarget.collect(function(row) { - return row.readAttribute("id").fromCSSIdentifier(); - }); - var url = ApplicationBaseURL + "/" + selectedFolderId + "/export" - + "?uid=" + contactIds.collect(encodeURIComponent).join("&uid="); - window.location.href = url; - } -} - -function onMenuRawContact (event) { - var cname = document.menuTarget.collect(function(row) { - return row.readAttribute("id").fromCSSIdentifier(); - }); - - $(function() { - openGenericWindow(URLForFolderID(Contact.currentAddressBook) - + "/" + encodeURIComponent(cname) + "/raw"); - }).delay(0.1); -} - -function actionContactCallback(http) { - if (http.readyState == 4) - if (isHttpStatus204(http.status)) { - var refreshFolderId = http.callbackData; - if (refreshFolderId) - openContactsFolder(refreshFolderId, true); - } - else { - var html = new Element("div").update(http.responseText); - var error = html.select("p").first().firstChild.nodeValue.trim(); - log("actionContactCallback failed: error " + http.status + " (" + error + ")"); - if (parseInt(http.status) == 403) - showAlertDialog(_("You don't have the required privileges to perform the operation.")); - else if (error) - showAlertDialog(_(error)); - refreshCurrentFolder(); - } -} - -function loadContact(cname) { - if (document.contactAjaxRequest) { - document.contactAjaxRequest.aborted = true; - document.contactAjaxRequest.abort(); - } - - if (cachedContacts[Contact.currentAddressBook + "/" + cname]) { - var div = $('contactView'); - Contact.currentContactId = cname; - div.innerHTML = cachedContacts[Contact.currentAddressBook + "/" + cname]; - } - else { - var url = (URLForFolderID(Contact.currentAddressBook) - + "/" + encodeURIComponent(cname) + "/view?noframe=1"); - document.contactAjaxRequest - = triggerAjaxRequest(url, contactLoadCallback, cname); - } -} - -function contactLoadCallback(http) { - var div = $('contactView'); - - if (http.readyState == 4 - && http.status == 200) { - document.contactAjaxRequest = null; - var content = http.responseText; - cachedContacts[Contact.currentAddressBook + "/" + http.callbackData] = content; - Contact.currentContactId = http.callbackData; - div.innerHTML = content; - } - else { - log ("ajax problem 2: " + http.status); - refreshCurrentFolder(); - } -} - -var rowSelectionCount = 0; - -validateControls(); - -function showElement(e, shouldShow) { - e.style.display = shouldShow ? "" : "none"; -} - -function enableElement(e, shouldEnable) { - if(!e) - return; - if(shouldEnable) { - if(e.hasAttribute("disabled")) - e.removeAttribute("disabled"); - } - else { - e.setAttribute("disabled", "1"); - } -} - -function validateControls() { - var e = $("moveto"); - this.enableElement(e, rowSelectionCount > 0); -} - -function moveTo(uri) { - alert("MoveTo: " + uri); -} - -/* contact menu entries */ -function onContactRowDblClick(event) { - var t = getTarget(event); - var cname = t.parentNode.getAttribute('id').fromCSSIdentifier(); - - cname = encodeURIComponent(cname); - openContactWindow(URLForFolderID(Contact.currentAddressBook) - + "/" + cname + "/edit", cname); - - return false; -} - -function onContactSelectionChange(event) { - var contactView = $("contactView"); - if (event) { - // Update rows selection - var t = getTarget(event); - onRowClick(event, t); - } - if (contactView) { - var rows = this.parentNode.getSelectedRowsId(); - - if (rows.length == 1) { - var node = $(rows[0]); - loadContact(node.getAttribute('id').fromCSSIdentifier()); - } - else if (rows.length > 1) { - $('contactView').update(); - Contact.currentContactId = null; - } - } -} - -function onMenuEditContact(event) { - onToolbarEditSelectedContacts(event); -} - -function onMenuWriteToContact(event) { - onToolbarWriteToSelectedContacts(event); - - if (document.body.hasClassName("popup")) - window.close(); -} - -function onMenuAIMContact(event) { - var contactRow = $(document.menuTarget.getAttribute('id')); - var aimCell = contactRow.down('td', 2); - - window.location.href = "aim:goim?ScreenName=" + aimCell.firstChild.nodeValue; -} - -function onMenuDeleteContact(event) { - onToolbarDeleteSelectedContacts(event); -} - -function onToolbarEditSelectedContacts(event) { - var contactsList = $('contactsList'); - var rows = contactsList.getSelectedRowsId(); - - if (rows.length == 0) { - showAlertDialog(_("Please select a contact.")); - return false; - } - - for (var i = 0; i < rows.length; i++) { - var id = encodeURIComponent(rows[i].fromCSSIdentifier()); - openContactWindow(URLForFolderID(Contact.currentAddressBook) - + "/" + id + "/edit", rows[i]); - } - - return false; -} - -function onToolbarWriteToSelectedContacts(event) { - var contactsList = $('contactsList'); - var rowIds = contactsList.getSelectedRowsId(); - - if (rowIds.length == 0) { - showAlertDialog(_("Please select a contact.")); - } - else { - openMailComposeWindow(ApplicationBaseURL + "/../Mail/compose" - + "?folder=" + Contact.currentAddressBook.substring(1) - + "&uid=" + rowIds.collect(function(id) { - return encodeURIComponent(id.fromCSSIdentifier()); - }).join("&uid=")); - if (document.body.hasClassName("popup")) - window.close(); - } - - return false; -} - -function onToolbarDeleteSelectedContacts(event) { - var contactsList = $('contactsList'); - var rows = contactsList.getSelectedRowsId(); - - if (rows && rows.length) - showConfirmDialog(_("Confirmation"), - _("Are you sure you want to delete the selected contacts?"), - onToolbarDeleteSelectedContactsConfirm); - else if (!onAddressBookRemove(event)) - showAlertDialog(_("Please select a contact.")); - - return false; -} - -function onToolbarDeleteSelectedContactsConfirm(dialogId) { - disposeDialog(); - var contactsList = $('contactsList'); - var rowIds = contactsList.getSelectedRowsId(); - var urlstr = (URLForFolderID(Contact.currentAddressBook) + "/batchDelete"); - - for (var i = 0; i < rowIds.length; i++) - $(rowIds[i]).hide(); - triggerAjaxRequest(urlstr, onContactDeleteEventCallback, rowIds, - ('ids=' + rowIds.collect(function(id) { - return encodeURIComponent(id.fromCSSIdentifier()); - }).join(",")), - { "Content-type": "application/x-www-form-urlencoded" }); -} - -function onContactDeleteEventCallback(http) { - if (http.readyState == 4) { - if (isHttpStatus204(http.status)) { - var rowIds = http.callbackData; - var row; - var nextRow = null; - for (var i = 0; i < rowIds.length; i++) { - var id = rowIds[i].fromCSSIdentifier(); - delete cachedContacts[Contact.currentAddressBook + "/" + id]; - row = $(rowIds[i]); - var displayName = row.readAttribute("contactname"); - if (Contact.currentContactId == id) { - Contact.currentContactId = null; - } - var nextRow = row.next("tr"); - if (!nextRow) - nextRow = row.previous("tr"); - if (row) { - row.deselect(); - row.parentNode.removeChild(row); - } - } - if (nextRow) { - Contact.currentContactId = nextRow.getAttribute("id").fromCSSIdentifier(); - nextRow.selectElement(); - loadContact(Contact.currentContactId); - } - - $("contactView").update(); - } - else if (parseInt(http.status) == 403) { - for (var i = 0; i < rowIds.length; i++) { - var row = $(rowIds[i]); - row.show(); - } - var displayName = row.readAttribute("contactname"); - showAlertDialog(_("You cannot delete the card of \"%{0}\".").formatted(displayName)); - } - } -} - -function newEmailTo(sender) { - var mailto = sanitizeMailTo(sender.parentNode.parentNode.menuTarget.innerHTML); - - if (mailto.length > 0) - openMailComposeWindow("compose?mailto=" + mailto); - - return false; /* stop following the link */ -} - -function onHeaderClick(event) { - var headerId = this.getAttribute("id"); - var newSortAttribute; - if (headerId == "nameHeader") - newSortAttribute = "c_cn"; - else if (headerId == "mailHeader") - newSortAttribute = "c_mail"; - else if (headerId == "screenNameHeader") - newSortAttribute = "c_screenname"; - else if (headerId == "orgHeader") - newSortAttribute = "c_o"; - else if (headerId == "phoneHeader") - newSortAttribute = "c_telephonenumber"; - - if (sorting["attribute"] == newSortAttribute) - sorting["ascending"] = !sorting["ascending"]; - else { - sorting["attribute"] = newSortAttribute; - sorting["ascending"] = true; - } - - refreshCurrentFolder(); - - Event.stop(event); -} - -function newContact(sender) { - openContactWindow(URLForFolderID(Contact.currentAddressBook) + "/newcontact"); - - return false; /* stop following the link */ -} - -function newList(sender) { - var li = $(Contact.currentAddressBook); - var listEditing = li.getAttribute("list-editing"); - if (listEditing && listEditing == "available") - openContactWindow(URLForFolderID(Contact.currentAddressBook) + "/newlist"); - else - showAlertDialog(_("You cannot create a list in a shared address book.")); - - return false; -} - -function onFolderSelectionChange(event) { - var folderList = $("contactFolders"); - - if (event) { - var node = getTarget(event); - if (node.tagName == 'UL') - return; - if (node.tagName == "SPAN") - node = node.parentNode; - - // Update rows selection - onRowClick(event, node); - } - - var nodes = folderList.getSelectedNodes(); - $("contactView").update(); - Contact.currentContactId = null; - - if (nodes[0].hasClassName("denied")) { - var div = $("contactsListContent"); - div.update(); - } - else { - search = {}; - $$('[name="search"]').each(function(input) { input.value = "" }); - initCriteria(); - openContactsFolder(nodes[0].getAttribute("id")); - } -} - -function refreshCurrentFolder() { - openContactsFolder(Contact.currentAddressBook, true); -} - -/* Only used in UIxMailEditor */ -function onConfirmContactSelection(event) { - var tag = this.getAttribute("name"); - var folder = $("contactFolder"); - var currentAddressBookName = folder.textContent; - var selectorList = null; - var initialValues = null; - - var contactsList = $("contactsList"); - var rows = contactsList.getSelectedRows(); - for (i = 0; i < rows.length; i++) { - var cid = rows[i].getAttribute("id").fromCSSIdentifier(); - if (cid.endsWith(".vlf")) { - addListToOpener(tag, Contact.currentAddressBook, currentAddressBookName, cid); - } - else { - var cname = '' + rows[i].readAttribute("contactname"); - var email = '' + rows[i].cells[1].innerHTML; - addContact(tag, currentAddressBookName + '/' + cname, cid, cname, email); - } - } - - this.blur(); // required by IE - Event.stop(event); - - return false; -} - -function addListToOpener (tag, aBookId, aBookName, listId) { - var url = UserFolderURL + "Contacts/" + aBookId + "/" + listId + "/properties"; - triggerAjaxRequest (url, addListToOpenerCallback, { - "aBookId": aBookId, - "aBookName": aBookName, - "tag": tag - }); -} - -function addListToOpenerCallback (http) { - var data = http.callbackData; - var received = http.responseText.evalJSON (true); - for (var i = 0; i < received.length; i++) { - var contact = received[i]; - addContact(data.tag, data.aBookName + '/' + contact[1], - contact[0], contact[1], contact[2]); - } -} - -function refreshContacts(cname) { - openContactsFolder(Contact.currentAddressBook, true, cname); - delete cachedContacts[Contact.currentAddressBook + "/" + cname]; - loadContact(cname); - - return false; -} - -function onAddressBookNew(event) { - showPromptDialog(_("New Addressbook..."), _("Name of the Address Book"), onAddressBookNewConfirm); - preventDefault(event); -} - -function onAddressBookNewConfirm() { - if (this.value.length > 0) - createFolder(this.value, appendAddressBook); - disposeDialog(); -} - -function appendAddressBook(name, folder) { - var owner; - var result = true; - - if (folder) { - owner = getSubscribedFolderOwner(folder); - folder = accessToSubscribedFolder(folder); - } - else - folder = "/" + name; - - if (!owner) - owner = UserLogin; - - if ($(folder)) - result = false; - else { - var contactFolders = $("contactFolders"); - var items = contactFolders.childNodesWithTag("li"); - var li = document.createElement("li"); - li = Element.extend(li); - - // Add the calendar to the proper place - var i = getListIndexForFolder(items, owner, name); - if (i != items.length) // User is subscribed to other calendars of the same owner - contactFolders.insertBefore(li, items[i]); - else - contactFolders.appendChild(li); - - li.setAttribute("id", folder); - li.setAttribute("owner", owner); - li.setAttribute("list-editing", "available"); - li.setAttribute("acl-editing", "available"); - li.addClassName("local"); - - var displayName = document.createElement("span"); - displayName.appendChild(document.createTextNode(name - .replace("<", "<", "g") - .replace(">", ">", "g"))); - li.appendChild(displayName); - - updateAddressBooksMenus(); - configureDroppables(); - } - - return result; -} - -function newUserFolderCallback(folderData) { - var folder = $(folderData["folder"]); - if (!folder) - appendAddressBook(folderData["folderName"], folderData["folder"]); -} - -function onAddressBookAdd(event) { - openUserFolderSelector(newUserFolderCallback, "contact"); - - preventDefault(event); -} - -function onFolderUnsubscribeCB(folderId) { - var node = $(folderId); - node.deselect(); - node.parentNode.removeChild(node); - - var personal = $("/personal"); - personal.selectElement(); - onFolderSelectionChange(); -} - -function onAddressBookExport(event) { - var node = $("contactFolders").getSelectedNodes().first(); - var folderID = node.getAttribute("id"); - var url = URLForFolderID(folderID) + "/exportFolder"; - window.location.href = url; - - event.stop(); - hideMenu(document.currentPopupMenu); -} - -function onAddressBookImport(event) { - var node = $("contactFolders").getSelectedNodes().first(); - var folderId = node.getAttribute("id"); - - var url = ApplicationBaseURL + "/" + folderId + "/import"; - $("uploadForm").action = url; - $("contactsFile").value = ""; - - var cellPosition = node.cumulativeOffset(); - var cellDimensions = node.getDimensions(); - var left = cellDimensions['width'] - 20; - var top = cellPosition[1]; - - var div = $("uploadDialog"); - var res = $("uploadResults"); - res.setStyle({ top: top + "px", left: left + "px" }); - div.setStyle({ top: top + "px", left: left + "px" }); - div.show(); -} - -function hideContactsImport(event) { - $("uploadDialog").hide(); -} - -function hideImportResults () { - $("uploadResults").hide(); -} - -function validateUploadForm () { - rc = false; - if ($("contactsFile").value.length) { - var btn = jQuery('#uploadSubmit'); - jQuery('#uploadCancel').fadeOut('fast'); - btn.addClass("disabled"); - btn.children('span').text(_('Uploading')); - rc = true; - } - return rc; -} - -function uploadCompleted(response) { - jQuery('#uploadCancel').show(); - var btn = jQuery('#uploadSubmit'); - btn.removeClass("disabled"); - btn.children('span').text(_('Upload')); - var div = $("uploadResults"); - - try { - data = response.evalJSON(true); - - if (data.imported <= 0) - $("uploadResultsContent").update(_("An error occured while importing contacts.")); - else if (data.imported == 0) - $("uploadResultsContent").update(_("No card was imported.")); - else { - $("uploadResultsContent").update(_("A total of %{0} cards were imported in the addressbook.").formatted(data.imported)); - refreshCurrentFolder(); - } - } catch (e) { - $("uploadResultsContent").update(_("An error occured while importing contacts.")); - } - - hideContactsImport(); - $("uploadResults").show(); -} - -function onAddressBookRemove(event) { - var selector = $("contactFolders"); - var nodes = selector.getSelectedNodes(); - if (nodes.length > 0) { - var node = $(nodes[0]); - var owner = node.getAttribute("owner"); - if (owner == "nobody") { - var label = _("You cannot remove nor unsubscribe from a public addressbook."); - showAlertDialog(label); - } - else if (owner == UserLogin) { - var folderIdElements = node.getAttribute("id").split(":"); - var abId = folderIdElements[0].substr(1); - deletePersonalAddressBook(abId); - } - else { - var folderId = node.getAttribute("id"); - var folderUrl = ApplicationBaseURL + "/" + folderId; - unsubscribeFromFolder(folderUrl, owner, onFolderUnsubscribeCB, folderId); - } - } - - preventDefault(event); - - return (nodes.length > 0); -} - -function deletePersonalAddressBook(folderId) { - if (folderId == "personal") - showAlertDialog(_("You cannot remove nor unsubscribe from your personal addressbook.")); - else - showConfirmDialog(_("Confirmation"), - _("Are you sure you want to delete the selected address book?"), - deletePersonalAddressBookConfirm.bind(this, folderId)); - - return false; -} - -function deletePersonalAddressBookConfirm(folderId) { - if (document.deletePersonalABAjaxRequest) { - document.deletePersonalABAjaxRequest.aborted = true; - document.deletePersonalABAjaxRequest.abort(); - } - var url = ApplicationBaseURL + "/" + folderId + "/delete"; - document.deletePersonalABAjaxRequest - = triggerAjaxRequest(url, deletePersonalAddressBookCallback, folderId); - - disposeDialog(); -} - - -function deletePersonalAddressBookCallback(http) { - if (http.readyState == 4) { - 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) { - children[i].deselect(); - ul.removeChild(children[i]); - done = true; - } - else - i++; - } - var personal = $("/personal"); - personal.selectElement(); - onFolderSelectionChange(); - } - document.deletePersonalABAjaxRequest = null; - } - else - log ("ajax problem 5: " + http.status); -} - -function configureDragHandles() { - var handle = $("dragHandle"); - if (handle) { - handle.addInterface(SOGoDragHandlesInterface); - handle.leftBlock = $("contactFoldersList"); - handle.rightBlock = $("rightPanel"); - handle.leftMargin = 100; - } - - handle = $("rightDragHandle"); - if (handle) { - handle.addInterface(SOGoDragHandlesInterface); - handle.upperBlock = $("contactsListContent"); - handle.lowerBlock = $("contactView"); - } -} - -function lookupDeniedFolders() { - var list = $("contactFolders").childNodesWithTag("li"); - for (var i = 0; i < list.length; i++) { - var folderID = list[i].getAttribute("id"); - var url = URLForFolderID(folderID) + "/canAccessContent"; - triggerAjaxRequest(url, deniedFoldersLookupCallback, folderID); - } -} - -function deniedFoldersLookupCallback(http) { - if (http.readyState == 4) { - var denied = ! isHttpStatus204(http.status); - var entry = $(http.callbackData); - if (denied) - entry.addClassName("denied"); - else - entry.removeClassName("denied"); - } -} - -function configureAbToolbar() { - var toolbar = $("abToolbar"); - if (toolbar) { - var links = toolbar.childNodesWithTag("a"); - $(links[0]).observe("click", onAddressBookNew); - $(links[1]).observe("click", onAddressBookAdd); - $(links[2]).observe("click", onAddressBookRemove); - } -} - -function configureAddressBooks() { - var contactFolders = $("contactFolders"); - if (contactFolders) { - contactFolders.on("mousedown", onFolderSelectionChange); - contactFolders.on("dblclick", onAddressBookModify); - contactFolders.on("selectstart", listRowMouseDownHandler); - contactFolders.attachMenu("contactFoldersMenu"); - - lookupDeniedFolders(); - configureDroppables(); - - // Select initial addressbook - $(Contact.currentAddressBook).selectElement(); - } -} - -function onAddressBookMenuPrepareVisibility() { - var selectedFolder = $("contactFolders").getSelectedNodes()[0]; - if (selectedFolder) { - var selectedFolderId = selectedFolder.readAttribute("id"); - $(this).select("li").each(function(menuEntry) { - if (menuEntry.readAttribute("folderId") == selectedFolderId) - menuEntry.addClassName("disabled"); - else - menuEntry.removeClassName("disabled"); - }); - } - - return true; -} - -function updateAddressBooksMenus() { - var contactFoldersList = $("contactFolders"); - if (contactFoldersList) { - var pageContent = $("pageContent"); - var contactFolders = contactFoldersList.select("li"); - var contactActions = new Hash({ move: onContactMenuMove, - copy: onContactMenuCopy }); - var actions = contactActions.keys(); - for (var j = 0; j < actions.size(); j++) { - var key = actions[j]; - var callbacks = new Array(); - var menuId = key + "ContactMenu"; - var menuDIV = $(menuId); - if (menuDIV) - menuDIV.parentNode.removeChild(menuDIV); - - menuDIV = document.createElement("div"); - 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 < contactFolders.length; i++) { - if (contactFolders[i].hasClassName("local")) { - var menuEntry = new Element("li", - { folderId: contactFolders[i].readAttribute("id"), - owner: contactFolders[i].readAttribute("owner") } - ).update(contactFolders[i].innerHTML); - menu.appendChild(menuEntry); - callbacks.push(contactActions.get(key)); - } - } - menuDIV.prepareVisibility = onAddressBookMenuPrepareVisibility; - initMenu(menuDIV, callbacks); - } - } -} - -function onAddressBookModify(event) { - var folders = $("contactFolders"); - var selected = folders.getSelectedNodes()[0]; - if (selected.getAttribute("list-editing") == "available") { - var addressBookID = selected.getAttribute("id"); - var url = ApplicationBaseURL + addressBookID + "/properties"; - var windowID = sanitizeWindowName(addressBookID + " properties"); - var width = 410; - var height = 410; - - $(function() { - var properties = window.open(url, windowID, "width="+width+",height="+height+",resizable=0"); - properties.focus(); - }).delay(0.1); - } -} - -function onMenuSharing(event) { - if ($(this).hasClassName("disabled")) - return; - - var folders = $("contactFolders"); - var selected = folders.getSelectedNodes()[0]; - var aclEditing = selected.getAttribute("acl-editing"); - if (aclEditing && aclEditing == "available") { - var title = this.innerHTML; - var url = URLForFolderID(selected.getAttribute("id")); - - openAclWindow(url + "/acls", title); - } - else - showAlertDialog(_("The user rights cannot be edited for this object!")); -} - -function onAddressBooksMenuPrepareVisibility() { - var folders = $("contactFolders"); - var selected = folders.getSelectedNodes(); - - if (selected.length > 0) { - var folderOwner = selected[0].getAttribute("owner"); - - var menu = $("contactFoldersMenu").down("ul");; - var listElements = menu.childNodesWithTag("li"); - var newListOption = listElements[3]; - var removeOption = listElements[5]; - var exportOption = listElements[7]; - var importOption = listElements[8]; - var sharingOption = listElements[listElements.length - 1]; - - // Disable the "Sharing" option when address book is not owned by user - if (folderOwner == UserLogin || IsSuperUser) { - var aclEditing = selected[0].getAttribute("acl-editing"); - if (aclEditing && aclEditing == "available") { - sharingOption.removeClassName("disabled"); - } - else { - sharingOption.addClassName("disabled"); - } - } - else { - modifyOption.addClassName("disabled"); - sharingOption.addClassName("disabled"); - } - - var listEditing = selected[0].getAttribute("list-editing"); - if (listEditing && listEditing == "available") { - newListOption.removeClassName("disabled"); - } - else { - newListOption.addClassName("disabled"); - } - - // Disable the "remove" and "export ab" options when address book is public - if (folderOwner == "nobody") { - exportOption.addClassName("disabled"); - importOption.addClassName("disabled"); - removeOption.addClassName("disabled"); - } - else { - exportOption.removeClassName("disabled"); - importOption.removeClassName("disabled"); - if (selected[0].getAttribute("id") == "/personal") { - removeOption.addClassName("disabled"); - } - else { - removeOption.removeClassName("disabled"); - } - } - - return true; - } - - return false; -} - -function onContactMenuPrepareVisibility() { - var contactRows = document.menuTarget; - var selectedFolder = $("contactFolders").getSelectedNodes().first(); - var options = { write: false, - aim: false }; - - var elements = $(this).down("ul").childElements(); - - var categoriesOption = elements[1]; - if (selectedFolder.getAttribute("owner") == UserLogin) { - categoriesOption.removeClassName("disabled"); - } - else { - categoriesOption.addClassName("disabled"); - } - - $A(contactRows).each(function(contactRow) { - var cells = contactRow.getElementsByTagName('td'); - var emailCell = cells[1]; - options.write |= (emailCell.firstChild != null); - var aimCell = cells[2]; - options.aim |= (aimCell.firstChild != null); - }); - - var writeOption = elements[3]; - if (options.write) - writeOption.removeClassName("disabled"); - else - writeOption.addClassName("disabled"); - - var aimOption = elements[4]; - if (options.aim) - aimOption.removeClassName("disabled"); - else - aimOption.addClassName("disabled"); - - var deleteOption = elements[6]; - var moveOption = elements[8]; - if ($(selectedFolder).hasClassName("remote")) { - // Remote address books are always read-only - deleteOption.addClassName("disabled"); - moveOption.addClassName("disabled"); - } - else { - deleteOption.removeClassName("disabled"); - moveOption.removeClassName("disabled"); - } - - var exportOption = elements[10]; - var rawOption = elements[11]; - if ($(selectedFolder).getAttribute("owner") == "nobody") { - // public folders (ldap) cannot export or show raw contacts - exportOption.addClassName("disabled"); - rawOption.addClassName("disabled"); - } - else { - exportOption.removeClassName("disabled"); - rawOption.removeClassName("disabled"); - } - - if (contactRows.length != 1) - rawOption.addClassName("disabled"); - - return true; -} - -var originalGetMenus = null; -if (typeof getMenus == 'function') { - originalGetMenus = getMenus; -} -getMenus = function() { - var menus = {}; - menus["contactFoldersMenu"] = new Array(onAddressBookModify, "-", newContact, - newList, "-", - onAddressBookRemove, "-", - onAddressBookExport, onAddressBookImport, "-", - onMenuSharing); - menus["contactMenu"] = new Array(onMenuEditContact, - "categoriesMenu", - "-", - onMenuWriteToContact, onMenuAIMContact, - "-", onMenuDeleteContact, "-", - "moveContactMenu", "copyContactMenu", - onMenuExportContact, onMenuRawContact); - menus["searchMenu"] = new Array(setSearchCriteria, setSearchCriteria, setSearchCriteria); - - var contactFoldersMenu = $("contactFoldersMenu"); - if (contactFoldersMenu) - contactFoldersMenu.prepareVisibility = onAddressBooksMenuPrepareVisibility; - var contactMenu = $("contactMenu"); - if (contactMenu) - contactMenu.prepareVisibility = onContactMenuPrepareVisibility; - - if (originalGetMenus) { - var originalMenus = originalGetMenus(); - if (originalMenus) - menus = Object.extend(menus, originalMenus); - } - - return menus; -} - - function configureSelectionButtons() { - var container = $("contactSelectionButtons"); - if (container) { - var buttons = container.select("A.button"); - for (var i = 0; i < buttons.length; i++) { - $(buttons[i]).observe("click", onConfirmContactSelection); - } - } - } - -function onDocumentKeydown(event) { - var target = Event.element(event); - if (target.tagName != "INPUT" && target.tagName != "TEXTAREA") { - var keyCode = event.keyCode; - if (!keyCode) { - keyCode = event.charCode; - if (keyCode == "a".charCodeAt(0)) { - keyCode = "A".charCodeAt(0); - } - } - if (keyCode == Event.KEY_DELETE || - keyCode == Event.KEY_BACKSPACE && isMac()) { - onToolbarDeleteSelectedContacts(); - Event.stop(event); - } - else if (keyCode == Event.KEY_DOWN || - keyCode == Event.KEY_UP) { - if (Contact.currentContactId) { - var row = $(Contact.currentContactId.asCSSIdentifier()); - var nextRow; - if (keyCode == Event.KEY_DOWN) - nextRow = row.next("tr"); - else - nextRow = row.previous("tr"); - if (nextRow) { - row.up().deselectAll(); - - // Adjust the scollbar - var viewPort = $("contactsListContent"); - var divDimensions = viewPort.getDimensions(); - var rowScrollOffset = nextRow.cumulativeScrollOffset(); - var rowPosition = nextRow.positionedOffset(); - var divBottom = divDimensions.height + rowScrollOffset.top; - var rowBottom = rowPosition.top + nextRow.getHeight(); - - if (divBottom < rowBottom) - viewPort.scrollTop += rowBottom - divBottom; - else if (rowScrollOffset.top > rowPosition.top) - viewPort.scrollTop -= rowScrollOffset.top - rowPosition.top; - - // Select and load the next message - nextRow.selectElement(); - loadContact(nextRow.readAttribute("id").fromCSSIdentifier()); - } - Event.stop(event); - } - } - else if (((isMac() && event.metaKey == 1) || (!isMac() && event.ctrlKey == 1)) - && keyCode == "A".charCodeAt(0)) { // Ctrl-A - $("contactsList").selectAll(); - Event.stop(event); - } - } -} - -/*function fixSearchFieldPosition () { - var panel = $("filterPanel"); - if (panel) { - panel.style.position = "relative"; - panel.style.top = "7px"; - } - }*/ - -function initContacts(event) { - if ($(document.body).hasClassName("popup")) { - configureSelectionButtons(); - } - - var foldersList = $("contactFoldersList"); - if (foldersList) { - configureAbToolbar(); - - // Addressbook import form - $("uploadCancel").observe("click", hideContactsImport); - $("uploadOK").observe("click", hideImportResults); - } - - Event.observe(document, "keydown", onDocumentKeydown); - - configureAddressBooks(); - configureDraggables(); - updateAddressBooksMenus(); - initRefreshViewCheckTimer(); - - var table = $("contactsList"); - if (table) { - // Initialize event delegation on contacts table - table.multiselect = true; - var tbody = $(table.tBodies[0]); - tbody.on("click", onContactSelectionChange); - if ($("contactView")) { - tbody.on("dblclick", onContactRowDblClick); - tbody.on("selectstart", listRowMouseDownHandler); - tbody.on("contextmenu", onContactContextMenu); - resetCategoriesMenu(); - TableKit.Resizable.init(table, {'trueResize' : true, 'keepWidth' : true}); - } - configureSortableTableHeaders(table); - } - - if (typeof onWindowResize != 'function') { - // When loaded from the mail editor, onWindowResize is - // already registered - onWindowResize = onContactsWindowResize; - onWindowResize.defer(); - Event.observe(window, "resize", onWindowResize); - } - // Default sort options - sorting["attribute"] = "c_cn"; - sorting["ascending"] = true; -} - -onContactsWindowResize = function (event) { - var handle = $("dragHandle"); - if (handle) - handle.adjust(); - handle = $("rightDragHandle"); - if (handle) - handle.adjust(); -} - - function resetCategoriesMenu() { - var menu = $("categoriesMenu"); - if (menu) { - menu.parentNode.removeChild(menu); - } - - menu = createElement("div", "categoriesMenu", "menu"); - var menuUL = createElement("ul", null, "choiceMenu"); - menu.appendChild(menuUL); - if (UserDefaults && UserDefaults["SOGoContactsCategories"]) { - for (var i = 0; - i < UserDefaults["SOGoContactsCategories"].length; - i++) { - var catName = UserDefaults["SOGoContactsCategories"][i]; - if (catName.length > 0) { - var menuLI = createElement("li"); - menuLI.observe("mousedown", onCategoriesMenuItemClick); - menuLI.category = catName; - menuLI.appendChild(document.createTextNode(catName)); - menuUL.appendChild(menuLI); - } - } - } - - menu.prepareVisibility = onCategoriesMenuPrepareVisibility; - - var pageContent = $("pageContent"); - pageContent.appendChild(menu); - } - -function onCategoriesMenuPrepareVisibility() { - var contactsList = $("contactsList"); - if (contactsList) { - var rows = contactsList.getSelectedRows(); - if (rows.length > 0) { - var catList = rows[0].readAttribute("categories"); - var catsArray; - if (catList && catList.length > 0) { - catsArray = catList.split(","); - } - else { - catsArray = []; - } - var menu = $("categoriesMenu"); - var ul = menu.down("ul"); - var listElements = ul.select("li"); - for (var i = 0; i < listElements.length; i++) { - var li = listElements[i]; - if (catsArray.indexOf(li.category) > -1) { - li.addClassName("_chosen"); - } - else { - li.removeClassName("_chosen"); - } - } - } - } - return true; -} - -function onCategoriesMenuItemClick() { - var set = !this.hasClassName("_chosen"); - var method = (set ? "setCategory" : "unsetCategory"); - var contactsList = $("contactsList"); - var rowIds = contactsList.getSelectedRowsId(); - if (rowIds.length > 0) { - for (var i = 0; i < rowIds.length; i++) { - var id = rowIds[i].fromCSSIdentifier(); - var url = (URLForFolderID(Contact.currentAddressBook) - + "/" + encodeURIComponent(id) + "/" + method); - url += "?category=" + encodeURIComponent(this.category); - triggerAjaxRequest(url, onCategoriesMenuItemCallback, - { 'addressBook' : Contact.currentAddressBook, 'id' : id }); - if (set) { - setCategoryOnNode($(rowIds[i]), this.category); - } - else { - unsetCategoryOnNode($(rowIds[i]), this.category); - } - } - } -} - -function onCategoriesMenuItemCallback(http) { - if (http.readyState == 4) - if (isHttpStatus204(http.status)) { - var contact = http.callbackData; - if (cachedContacts[contact.addressBook + "/" + contact.id]) - delete cachedContacts[contact.addressBook + "/" + contact.id]; - if (contact.addressBook == Contact.currentAddressBook - && contact.id == Contact.currentContactId) - loadContact(Contact.currentContactId); - } - else if (parseInt(http.status) == 403) { - log("onCategoriesMenuItemCallback failed: error " + http.status + " (" + http.responseText + ")"); - } -} - -function setCategoryOnNode(contactNode, category) { - var catList = contactNode.getAttribute("categories"); - var catsArray = catList? catList.split(",") : []; - if (catsArray.indexOf(category) == -1) { - catsArray.push(category); - contactNode.setAttribute("categories", catsArray.join(",")); - } -} - -function unsetCategoryOnNode(contactNode, category) { - var catList = contactNode.getAttribute("categories"); - var catsArray = catList.split(","); - var catIdx = catsArray.indexOf(category); - if (catsArray.indexOf(category) > -1) { - catsArray.splice(catIdx, 1); - contactNode.setAttribute("categories", catsArray.join(",")); - } -} - -function configureDraggables() { - if ($("contactFolders")) { - var rows = jQuery("tr.vcard"); - try { rows.draggable("destroy"); } catch (e) {} - rows.draggable({ - helper: function (event) { return '
'; }, - start: startDragging, - drag: whileDragging, - stop: stopDragging, - appendTo: 'body', - cursorAt: { right: 25 }, - scroll: false, - distance: 4, - zIndex: 20 - }); - } -} - -function configureDroppables() { - jQuery("li.local").droppable({ - hoverClass: 'genericHoverClass', - drop: dropAction }); -} - -function currentFolderIsRemote() { - rc = false; - var selectedFolders = $("contactFolders").getSelectedNodes(); - if (selectedFolders.length > 0) { - var fromObject = $(selectedFolders[0]); - rc = fromObject.hasClassName("remote"); - } - return rc; -} - -function startDragging(event, ui) { - var row = event.target; - var handle = ui.helper; - var contacts = $('contactsList').getSelectedRowsId(); - var count = contacts.length; - - if (count == 0 || contacts.indexOf(row.id) < 0) { - onRowClick(event, $(row.id)); - contacts = $("contactsList").getSelectedRowsId(); - count = contacts.length; - } - handle.html(count); - - if (event.shiftKey || currentFolderIsRemote()) { - handle.addClass("copy"); - } - handle.show(); -} - -function whileDragging(event, ui) { - if (event) { - var handle = ui.helper; - if (event.shiftKey || currentFolderIsRemote()) - handle.addClass("copy"); - else if (handle.hasClass("copy")) - handle.removeClass("copy"); - } -} - -function stopDragging(event, ui) { - var handle = ui.helper; - handle.hide(); - if (handle.hasClass("copy")) - handle.removeClass("copy"); -} - -function dropAction(event, ui) { - var action = "move"; - if (ui.helper.hasClass("copy")) - action = "copy"; - else - $('contactView').update(); - dropSelectedContacts(action, this.id.substr(1)); -} - -function dropSelectedContacts(action, toId) { - var selectedFolders = $("contactFolders").getSelectedNodes(); - if (selectedFolders.length > 0) { - var contactIds = $('contactsList').getSelectedRowsId(); - for (var i = 0; i < contactIds.length; i++) { - if (contactIds[i].endsWith("vlf")) { - showAlertDialog(_("Lists can't be moved or copied.")); - return false; - } - } - var fromId = $(selectedFolders[0]).id; - if ((!currentFolderIsRemote() || action != "move") - && fromId.substring(1) != toId) { - - var url = ApplicationBaseURL + fromId + "/" + action; - var uids = contactIds.collect(function(id) { - return encodeURIComponent(id.fromCSSIdentifier()); - }).join('&uid='); - triggerAjaxRequest(url, actionContactCallback, fromId, - ('folder='+ toId + '&uid=' + uids), - { "Content-type": "application/x-www-form-urlencoded" }); - } - } -} - -function onContactsReload () { - openContactsFolder(Contact.currentAddressBook, true); -} - -function initRefreshViewCheckTimer() { - var refreshViewCheck = typeof UserDefaults == 'undefined' ? false : UserDefaults["SOGoRefreshViewCheck"]; - if (refreshViewCheck && refreshViewCheck != "manually") { - var interval; - if (refreshViewCheck == "once_per_hour") - interval = 3600; - else if (refreshViewCheck == "every_minute") - interval = 60; - else { - interval = parseInt(refreshViewCheck.substr(6)) * 60; - } - refreshViewCheckTimer = window.setInterval(onRefreshViewCheckCallback, - interval * 1000); - } -} - -function onRefreshViewCheckCallback(event) { - onContactsReload(); -} - -document.observe("dom:loaded", initContacts); diff --git a/UI/WebServerResources/HTMLElement.js b/UI/WebServerResources/HTMLElement.js deleted file mode 100644 index 4ae8c60c0..000000000 --- a/UI/WebServerResources/HTMLElement.js +++ /dev/null @@ -1,383 +0,0 @@ -/* -*- Mode: js-mode; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -["HTMLCollection", "NodeList"].each( - function (className) { - if (className in window) { - var contClass = window[className]; - var _each = contClass.prototype.forEach; - if (!_each) { - _each = function HTMLElement_each(iterator, context) { - for (var i = 0, length = this.length >>> 0; i < length; i++) { - if (i in this) iterator.call(context, this[i], i, this); - } - }; - } - contClass.prototype._each = _each; - Object.extend(contClass.prototype, Enumerable); - } - } -); - -/* custom extensions to the DOM api */ -Element.addMethods({ - addInterface: function(element, objectInterface) { - element = $(element); - Object.extend(element, objectInterface); - if (element.bind) - element.bind(); - }, - - allTextContent: function(element) { - var content = ""; - for (var i = 0; i < element.childNodes.length; i++) { - var node = $(element.childNodes[i]); - if (node.nodeType == Node.TEXT_NODE) { - content += node.nodeValue; - } - else if (node.nodeType === Node.ELEMENT_NODE) { - content += Element.allTextContent(node); - } - } - - return content; - }, - - childNodesWithTag: function(element, tagName) { - element = $(element); - - var matchingNodes = new Array(); - tagName = tagName.toUpperCase(); - - for (var i = 0; i < element.childNodes.length; i++) { - var childNode = $(element.childNodes[i]); - if (Object.isElement(childNode) - && childNode.tagName - && childNode.tagName.toUpperCase() == tagName) - matchingNodes.push(childNode); - } - - return matchingNodes; - }, - - getParentWithTagName: function(element, tagName) { - element = $(element); - var currentElement = element; - tagName = tagName.toUpperCase(); - - currentElement = currentElement.parentNode; - while (currentElement - && currentElement.tagName != tagName) { - currentElement = currentElement.parentNode; - } - - return currentElement; - }, - - cascadeLeftOffset: function(element) { - element = $(element); - var currentElement = element; - - var offset = 0; - while (currentElement) { - offset += currentElement.offsetLeft; - currentElement = $(currentElement).getParentWithTagName("div"); - } - - return offset; - }, - - cascadeTopOffset: function(element) { - element = $(element); - var currentElement = element; - var offset = 0; - - var i = 0; - - while (currentElement && currentElement.tagName) { - offset += currentElement.offsetTop; - currentElement = currentElement.parentNode; - i++; - } - - return offset; - }, - - dump: function(element, additionalInfo, additionalKeys) { - element = $(element); - var id = element.getAttribute("id"); - var nclass = element.getAttribute("class"); - - var str = element.tagName; - if (id) - str += "; id = " + id; - if (nclass) - str += "; class = " + nclass; - - if (additionalInfo) - str += "; " + additionalInfo; - - if (additionalKeys) - for (var i = 0; i < additionalKeys.length; i++) { - var value = element.readAttribute(additionalKeys[i]); - if (value) - str += "; " + additionalKeys[i] + " = " + value; - } - - log (str); - }, - - getSelectedNodes: function(element) { - element = $(element); - - if (!element.selectedElements) - element.selectedElements = new Array(); - - return element.selectedElements; - }, - - getSelectedNodesId: function(element) { - element = $(element); - - var selArray = null; - if (element.selectedIds) { - selArray = element.selectedIds; - } - else { - selArray = []; - if (element.selectedElements) { - for (var i = 0; i < element.selectedElements.length; i++) { - var node = element.selectedElements[i]; - selArray.push(node.getAttribute("id")); - } - } - } - - return selArray; - }, - - onContextMenu: function(element, event) { - element = $(element); - if (document.currentPopupMenu) - hideMenu(document.currentPopupMenu); - - var popup = element.sogoContextMenu; - var menuTop = Event.pointerY(event); - var menuLeft = Event.pointerX(event); - var heightDiff = (window.height() - - (menuTop + popup.offsetHeight)); - if (heightDiff < 0) - menuTop += heightDiff; - - var leftDiff = (window.width() - - (menuLeft + popup.offsetWidth)); - if (leftDiff < 0) - menuLeft -= popup.offsetWidth; - - var isVisible = true; - if (popup.prepareVisibility) - isVisible = popup.prepareVisibility(); - - Event.stop(event); - - if (isVisible) { - popup.setStyle( { top: menuTop + "px", - left: menuLeft + "px", - visibility: "visible" } ); - document.currentPopupMenu = popup; - $(document.body).on("mousedown", onBodyClickMenuHandler); - } - else - log ("Warning: not showing the contextual menu " + element.id); - }, - - attachMenu: function(element, menuName) { - element = $(element); - element.sogoContextMenu = $(menuName); - element.on("contextmenu", element.onContextMenu); - }, - - selectElement: function(element) { - element = $(element); - element.addClassName('_selected'); - var parent = element.up(); - if (!parent.selectedElements || !parent.selectedIds) { - // Selected nodes are kept in a array at the - // container level. - parent.selectedElements = new Array(); - parent.selectedIds = new Array(); - } - for (var i = 0; i < parent.selectedElements.length; i++) - if (parent.selectedElements[i] == element) return; - parent.selectedElements.push(element); // use index instead ? - if (element.id) { - for (var i = 0; i < parent.selectedIds.length; i++) - if (parent.selectedIds[i] == element.id) return; - parent.selectedIds.push(element.id); - } - }, - - 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]).selectElement(); - s++; - } - }, - - selectAll: function(element) { - element = $(element); - if (element.tagName == 'UL') - rows = element.getElementsByTagName('LI'); - else - rows = element.select('TBODY TR'); - for (var i = 0; i < rows.length; i++) { - if (rows[i].nodeType == 1) - $(rows[i]).selectElement(); - } - }, - - deselect: function(element) { - element = $(element); - element.removeClassName('_selected'); - var parent = element.parentNode; - if (parent) { - if (parent.selectedElements) - parent.selectedElements = parent.selectedElements.without(element); - if (parent.selectedIds) - parent.selectedIds = parent.selectedIds.without(element.id); - } - }, - - deselectAll: function(element) { - if (element.tagName == 'TABLE') { - var tbody = element.tBodies[0]; - if (tbody) - element = tbody; - } - element = $(element); - var s = element.select("._selected"); - for (var i = 0; i < s.length; i++) - s[i].removeClassName("_selected"); - - element.selectedElements = null; - element.selectedIds = null; - }, - - refreshSelectionByIds: function(element, selectedIds) { - element = $(element); - var selectedCount = 0; - if (selectedIds) - element.selectedIds = selectedIds; - if (element.selectedIds) { - for (var i = 0; i < element.selectedIds.length; i++) { - //var e = element.down('#'+element.selectedIds[i]); // buggy with IE - var e = $(element.selectedIds[i]); - if (e) { - if (!e.hasClassName('_selected')) - e.addClassName('_selected'); - selectedCount++; - } - else { - log ("refreshSelectionByIds Error: " + element.tagName - + " select by ID " + element.selectedIds[i] - + " not found (" + element.childNodes.length + " children)"); - } - } - } - return selectedCount; - }, - - setCaretTo: function(element, pos) { - element = $(element); - if (element.setSelectionRange) { // For Mozilla and Safari - element.focus(); - element.setSelectionRange(pos, pos); - } - else if (element.createTextRange) { // For IE - var range = element.createTextRange(); - range.move("character", pos); - range.select(); - } - }, - - selectText: function(element, start, end) { - element = $(element); - if (element.setSelectionRange) { // For Mozilla and Safari - element.setSelectionRange(start, end); - } - else if (element.createTextRange) { // For IE - var textRange = element.createTextRange(); - textRange.moveStart("character", start); - textRange.moveEnd("character", end-element.value.length); - textRange.select(); - } - else { - element.select(); - } - }, - - getRadioValue: function(element, radioName) { - element = $(element); - var radioValue; - Form.getInputs(element, 'radio', radioName).each(function(input) { - if (input.checked) - radioValue = input.value; - }); - return radioValue; - }, - - setRadioValue: function(element, radioName, value) { - element = $(element); - var i = 0; - - Form.getInputs(element, 'radio', radioName).each(function(input) { - if (i == value) - input.checked = 1; - i++; - }); - }, - - getCheckBoxListValues: function(element, checkboxName) { - element = $(element); - var values = new Array(); - var i = 0; - - Form.getInputs(element, 'checkbox', checkboxName).each(function(input) { - if (input.checked) - values.push(i+1); - - i++; - }); - return values.join(","); - }, - - setCheckBoxListValues: function(element, checkboxName, values) { - element = $(element); - var v = values.split(','); - var i = 1; - - Form.getInputs(element, 'checkbox', checkboxName).each(function(input) { - - if ($(v).indexOf(i+"") != -1) - input.checked = 1; - i++; - }); - } -}); diff --git a/UI/WebServerResources/HTMLInputElement.js b/UI/WebServerResources/HTMLInputElement.js deleted file mode 100644 index 618b8065f..000000000 --- a/UI/WebServerResources/HTMLInputElement.js +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -Form.Element.Methods._replicate = function(element) { - element = $(element); - if (element.replica) { - element.replica.value = $F(element); - var onReplicaChangeEvent = document.createEvent("UIEvents"); - onReplicaChangeEvent.initEvent("change", true, true); - element.replica.dispatchEvent(onReplicaChangeEvent); - } -}; - -Form.Element.Methods.assignReplica = function(element, otherInput) { - element = $(element); - if (!element._onChangeBound) { - element.observe("change", element._replicate, false); - element._onChangeBound = true; - } - element.replica = otherInput; -}; - -Form.Element.Methods.inputAsDate = function(element) { - return $F(element).asDate(); -}; - -Form.Element.Methods.setInputAsDate = function(element, dateValue) { - element = $(element); - if (!element.dateSeparator) - element._detectDateSeparator(); - element.value = dateValue.stringWithSeparator(element.dateSeparator); -}; - -Form.Element.Methods.updateShadowValue = function(element) { - element = $(element); - element.setAttribute("shadow-value", $F(element)); -}; - -Form.Element.Methods._detectDateSeparator = function(element) { - element = $(element); - var date = $F(element).split("/"); - if (date.length == 3) - element.dateSeparator = "/"; - else - element.dateSeparator = "-"; -}; - -Form.Element.Methods.valueAsShortDateString = function(element) { - element = $(element); - var dateStr = ''; - - if (!element.dateSeparator) - element._detectDateSeparator(); - - var date = $F(element).split(element.dateSeparator); - if (element.dateSeparator == '/') - dateStr += date[2] + date[1] + date[0]; - else - dateStr += date[0] + date[1] + date[2]; - - return dateStr; -}; - -Element.addMethods(); diff --git a/UI/WebServerResources/HTMLTableElement.js b/UI/WebServerResources/HTMLTableElement.js deleted file mode 100644 index 979887332..000000000 --- a/UI/WebServerResources/HTMLTableElement.js +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -Element.addMethods({ - getSelectedRows: function(element) { - element = $(element); - if (element.tagName == 'TABLE') { - var tbody = (element.getElementsByTagName('tbody'))[0]; - - return $(tbody).getSelectedNodes(); - } - else if (element.tagName == 'TBODY') { - return element.getSelectedNodes(); - } - else if (element.tagName == 'UL') { - return element.getSelectedNodes(); - } - }, - - getSelectedRowsId: function(element) { - element = $(element); - var rowsId = null; - if (element.tagName == 'TABLE') { - var tbody = (element.getElementsByTagName('tbody'))[0]; - rowsId = $(tbody).getSelectedNodesId(); - } - else if (element.tagName == 'UL') { - rowsId = element.getSelectedNodesId(); - } - - return rowsId; - }, - - selectRowsMatchingClass: function(element, className) { - element = $(element); - if (element.tagName == 'TABLE') { - var tbody = (element.getElementsByTagName('tbody'))[0]; - var nodes = tbody.childNodes; - for (var i = 0; i < nodes.length; i++) { - var node = nodes.item(i); - if (node.tagName && node.hasClassName(className)) - node.selectElement(); - } - } - } - -}); // Element.addMethods diff --git a/UI/WebServerResources/JavascriptAPIExtensions.js b/UI/WebServerResources/JavascriptAPIExtensions.js deleted file mode 100644 index 12db867bd..000000000 --- a/UI/WebServerResources/JavascriptAPIExtensions.js +++ /dev/null @@ -1,438 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -String.prototype.trim = function() { - return this.replace(/(^\s+|\s+$)/g, ''); -}; - -String.prototype.formatted = function() { - var newString = this; - - for (var i = 0; i < arguments.length; i++) { - newString = newString.replace("%{" + i + "}", arguments[i], "g"); - } - - return newString; -}; - -String.prototype.formatTime = function(hours, minutes) { - var newString = this; - - // See http://www.gnustep.org/resources/documentation/Developer/Base/Reference/NSCalendarDate.html#method$NSCalendarDate-descriptionWithCalendarFormat$ - var p = 'am', i = hours, m = minutes; - if (hours > 12) { - p = 'pm'; - i = hours % 12; - } - if (minutes < 10) { - m = '0' + minutes; - } - - // %H : hour as a decimal number using 24-hour clock - newString = newString.replace("%H", hours < 10 ? '0' + hours : hours); - // %I : hour as a decimal number using 12-hour clock - newString = newString.replace("%I", i < 10 ? '0' + i : i); - // %M : minute as decimal number - newString = newString.replace("%M", m); - // %p : 'am' or 'pm' - newString = newString.replace("%p", p); - - return newString; -}; - -String.prototype.repeat = function(count) { - var newString = ""; - for (var i = 0; i < count; i++) { - newString += this; - } - - return newString; -}; - -String.prototype.capitalize = function() { - return this.replace(/\w+/g, - function(a) { - return ( a.charAt(0).toUpperCase() - + a.substr(1).toLowerCase() ); - }); -}; - -String.prototype.cssIdToHungarianId = function() { - var parts = this.split("-"); - var newId = parts[0]; - for (var i = 1; i < parts.length; i++) { - newId += parts[i].capitalize(); - } - - return newId; -} - -String.prototype.decodeEntities = function() { - return this.replace(/&#(\d+);/g, - function(wholematch, parenmatch1) { - return String.fromCharCode(+parenmatch1); - }); -}; - -String.prototype.unescapeHTMLEntities = function() { - return this.unescapeHTML().replace(/"/g,'"'); -}; - -String.prototype.asDate = function () { - var newDate; - var date = this.split("/"); - if (date.length == 3) - newDate = new Date(date[2], date[1] - 1, date[0]); // dd/mm/yyyy - else { - date = this.split("-"); - if (date.length == 3) - newDate = new Date(date[0], date[1] - 1, date[2]); // yyyy-mm-dd - else { - if (this.length == 8) { - newDate = new Date(this.substring(0, 4), - this.substring(4, 6) - 1, - this.substring(6, 8)); - } - } - } - - return newDate; -}; - -RegExp.escape = function(text) { - return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); -} - -var css_invalid_characters = [ '_' , '.', '#' , '@' , '*', ':' , ';' , ',' , ' ', - '(', ')', '[', ']', '{', '}', - "'", '"', '&', '+' ]; -var css_escape_characters = [ '_U_', '_D_', '_H_', '_A_', '_S_', '_C_', '_SC_', '_CO_', '_SP_', - '_LP_', '_RP_', '_LS_', '_RQ_', '_LC_', '_RC_', - '_SQ_', '_DQ_', '_AM_', '_P_' ]; - -String.prototype.asCSSIdentifier = function() { - var newString = this; - for (var i = 0; i < css_invalid_characters.length; i++) { - var re = new RegExp(RegExp.escape(css_invalid_characters[i]), 'g'); - newString = newString.replace(re, css_escape_characters[i]); - } - - if (/^\d/.test(newString)) - newString = '_' + newString; - - return newString; -}; - -String.prototype.fromCSSIdentifier = function() { - var newString = this; - - if (/^_\d/.test(newString)) - newString = newString.substring(1); - - for (var i = 0; i < css_escape_characters.length; i++) { - var re = new RegExp(css_escape_characters[i], 'g'); - newString = newString.replace(re, css_invalid_characters[i]); - } - - return newString; -}; - -Date.prototype.clone = function() { - var newDate = new Date(); - - newDate.setTime(this.getTime()); - - return newDate; -}; - -Date.prototype.deltaDays = function(otherDate) { - var day1 = this.getTime(); - var day2 = otherDate.getTime(); - if (day1 > day2) { - var tmp = day2; - day2 = day1; - day1 = tmp; - } - - return Math.round((day2 - day1) / 86400000); -}; - -Date.prototype.daysUpTo = function(otherDate) { - var days = new Array(); - - var day1 = this.getTime(); - var day2 = otherDate.getTime(); - if (day1 > day2) { - var tmp = day1; - day1 = day2; - day2 = tmp; - } - // 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.round((day2 - day1) / 86400000) + 1; - for (var i = 0; i < nbrDays; i++) { - var newDate = new Date(); - newDate.setTime(day1 + (i * 86400000)); - days.push(newDate); - } - - return days; -}; - -Date.prototype.getDayString = function() { - var newString = this.getYear(); - if (newString < 1000) newString += 1900; - var month = '' + (this.getMonth() + 1); - if (month.length == 1) - month = '0' + month; - newString += month; - var day = '' + this.getDate(); - if (day.length == 1) - day = '0' + day; - newString += day; - - return newString; -}; - -Date.prototype.getHourString = function() { - var newString = this.getHours() + '00'; - if (newString.length == 3) - newString = '0' + newString; - - return newString; -}; - -Date.prototype.getDisplayHoursString = function() { - var hoursString = "" + this.getHours(); - if (hoursString.length == 1) - hoursString = '0' + hoursString; - - var minutesString = "" + this.getMinutes(); - if (minutesString.length == 1) - minutesString = '0' + minutesString; - - return hoursString + ":" + minutesString; -}; - -Date.prototype.stringWithSeparator = function(separator) { - var month = '' + (this.getMonth() + 1); - var day = '' + this.getDate(); - var year = this.getYear(); - if (year < 1000) - year = '' + (year + 1900); - if (month.length == 1) - month = '0' + month; - if (day.length == 1) - day = '0' + day; - - if (separator == '-') - str = year + '-' + month + '-' + day; - else - str = day + '/' + month + '/' + year; - - return str; -}; - -Date.prototype.addDays = function(nbrDays) { - var dat = new Date(this.valueOf()); - this.setDate(dat.getDate() + Math.round(nbrDays)); -}; - -Date.prototype.earlierDate = function(otherDate) { - var workDate = new Date(); - workDate.setTime(otherDate.getTime()); - workDate.setHours(0); - return ((this.getTime() < workDate.getTime()) - ? this : otherDate); -}; - -Date.prototype.laterDate = function(otherDate) { - var workDate = new Date(); - workDate.setTime(otherDate.getTime()); - workDate.setHours(23); - workDate.setMinutes(59); - workDate.setSeconds(59); - workDate.setMilliseconds(999); - return ((this.getTime() < workDate.getTime()) - ? otherDate : this); -}; - -Date.prototype.beginOfDay = function() { - var beginOfDay = new Date(this.getTime()); - beginOfDay.setHours(0); - beginOfDay.setMinutes(0); - beginOfDay.setSeconds(0); - beginOfDay.setMilliseconds(0); - - return beginOfDay; -}; - -Date.prototype.beginOfWeek = function() { - var offset = firstDayOfWeek - this.getDay(); - if (offset > 0) - offset -= 7; - - var beginOfWeek = this.beginOfDay(); - beginOfWeek.setHours(12); - beginOfWeek.addDays(offset); - - return beginOfWeek; -}; - -Date.prototype.endOfWeek = function() { - var endOfWeek = this.beginOfWeek(); - endOfWeek.addDays(6); - - endOfWeek.setHours(23); - endOfWeek.setMinutes(59); - endOfWeek.setSeconds(59); - endOfWeek.setMilliseconds(999); - - 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; -}; - -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; -}; - -window.width = function() { - if (window.innerWidth) - return window.innerWidth; - else if (document.body && document.body.offsetWidth) - return document.body.offsetWidth; - else - return 0; -}; - -window.height = function() { - if (window.innerHeight) - return window.innerHeight; - else if (document.body && document.body.offsetHeight) - return document.body.offsetHeight; - else - return 0; -}; diff --git a/UI/WebServerResources/LICENSE-thunderbird.txt b/UI/WebServerResources/LICENSE-thunderbird.txt deleted file mode 100644 index 18f8109b7..000000000 --- a/UI/WebServerResources/LICENSE-thunderbird.txt +++ /dev/null @@ -1,567 +0,0 @@ - MOZILLA PUBLIC LICENSE - Version 1.1 - - --------------- - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the - Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to - the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original - Code, prior Modifications used by a Contributor, and the Modifications - made by that particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the - combination of the Original Code and Modifications, in each case - including portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally - accepted in the software development community for the electronic - transfer of data. - - 1.5. "Executable" means Covered Code in any form other than Source - Code. - - 1.6. "Initial Developer" means the individual or entity identified - as the Initial Developer in the Source Code notice required by Exhibit - A. - - 1.7. "Larger Work" means a work which combines Covered Code or - portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum - extent possible, whether at the time of the initial grant or - subsequently acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the - substance or structure of either the Original Code or any previous - Modifications. When Covered Code is released as a series of files, a - Modification is: - A. Any addition to or deletion from the contents of a file - containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or - previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code - which is described in the Source Code notice required by Exhibit A as - Original Code, and which, at the time of its release under this - License is not already Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or - hereafter acquired, including without limitation, method, process, - and apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for - making modifications to it, including all modules it contains, plus - any associated interface definition files, scripts used to control - compilation and installation of an Executable, or source code - differential comparisons against either the Original Code or another - well known, available Covered Code of the Contributor's choice. The - Source Code can be in a compressed or archival form, provided the - appropriate decompression or de-archiving software is widely available - for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity - exercising rights under, and complying with all of the terms of, this - License or a future version of this License issued under Section 6.1. - For legal entities, "You" includes any entity which controls, is - controlled by, or is under common control with You. For purposes of - this definition, "control" means (a) the power, direct or indirect, - to cause the direction or management of such entity, whether by - contract or otherwise, or (b) ownership of more than fifty percent - (50%) of the outstanding shares or beneficial ownership of such - entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, - non-exclusive license, subject to third party intellectual property - claims: - (a) under intellectual property rights (other than patent or - trademark) Licensable by Initial Developer to use, reproduce, - modify, display, perform, sublicense and distribute the Original - Code (or portions thereof) with or without Modifications, and/or - as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or - selling of Original Code, to make, have made, use, practice, - sell, and offer for sale, and/or otherwise dispose of the - Original Code (or portions thereof). - - (c) the licenses granted in this Section 2.1(a) and (b) are - effective on the date Initial Developer first distributes - Original Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is - granted: 1) for code that You delete from the Original Code; 2) - separate from the Original Code; or 3) for infringements caused - by: i) the modification of the Original Code or ii) the - combination of the Original Code with other software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor - hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Contributor, to use, reproduce, modify, - display, perform, sublicense and distribute the Modifications - created by such Contributor (or portions thereof) either on an - unmodified basis, with other Modifications, as Covered Code - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or - selling of Modifications made by that Contributor either alone - and/or in combination with its Contributor Version (or portions - of such combination), to make, use, sell, offer for sale, have - made, and/or otherwise dispose of: 1) Modifications made by that - Contributor (or portions thereof); and 2) the combination of - Modifications made by that Contributor with its Contributor - Version (or portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are - effective on the date Contributor first makes Commercial Use of - the Covered Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is - granted: 1) for any code that Contributor has deleted from the - Contributor Version; 2) separate from the Contributor Version; - 3) for infringements caused by: i) third party modifications of - Contributor Version or ii) the combination of Modifications made - by that Contributor with other software (except as part of the - Contributor Version) or other devices; or 4) under Patent Claims - infringed by Covered Code in the absence of Modifications made by - that Contributor. - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are - governed by the terms of this License, including without limitation - Section 2.2. The Source Code version of Covered Code may be - distributed only under the terms of this License or a future version - of this License released under Section 6.1, and You must include a - copy of this License with every copy of the Source Code You - distribute. You may not offer or impose any terms on any Source Code - version that alters or restricts the applicable version of this - License or the recipients' rights hereunder. However, You may include - an additional document offering the additional rights described in - Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be - made available in Source Code form under the terms of this License - either on the same media as an Executable version or via an accepted - Electronic Distribution Mechanism to anyone to whom you made an - Executable version available; and if made available via Electronic - Distribution Mechanism, must remain available for at least twelve (12) - months after the date it initially became available, or at least six - (6) months after a subsequent version of that particular Modification - has been made available to such recipients. You are responsible for - ensuring that the Source Code version remains available even if the - Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a - file documenting the changes You made to create that Covered Code and - the date of any change. You must include a prominent statement that - the Modification is derived, directly or indirectly, from Original - Code provided by the Initial Developer and including the name of the - Initial Developer in (a) the Source Code, and (b) in any notice in an - Executable version or related documentation in which You describe the - origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's - intellectual property rights is required to exercise the rights - granted by such Contributor under Sections 2.1 or 2.2, - Contributor must include a text file with the Source Code - distribution titled "LEGAL" which describes the claim and the - party making the claim in sufficient detail that a recipient will - know whom to contact. If Contributor obtains such knowledge after - the Modification is made available as described in Section 3.2, - Contributor shall promptly modify the LEGAL file in all copies - Contributor makes available thereafter and shall take other steps - (such as notifying appropriate mailing lists or newsgroups) - reasonably calculated to inform those who received the Covered - Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming - interface and Contributor has knowledge of patent licenses which - are reasonably necessary to implement that API, Contributor must - also include this information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to - Section 3.4(a) above, Contributor believes that Contributor's - Modifications are Contributor's original creation(s) and/or - Contributor has sufficient rights to grant the rights conveyed by - this License. - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source - Code. If it is not possible to put such notice in a particular Source - Code file due to its structure, then You must include such notice in a - location (such as a relevant directory) where a user would be likely - to look for such a notice. If You created one or more Modification(s) - You may add your name as a Contributor to the notice described in - Exhibit A. You must also duplicate this License in any documentation - for the Source Code where You describe recipients' rights or ownership - rights relating to Covered Code. You may choose to offer, and to - charge a fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Code. However, You - may do so only on Your own behalf, and not on behalf of the Initial - Developer or any Contributor. You must make it absolutely clear than - any such warranty, support, indemnity or liability obligation is - offered by You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred by the - Initial Developer or such Contributor as a result of warranty, - support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the - requirements of Section 3.1-3.5 have been met for that Covered Code, - and if You include a notice stating that the Source Code version of - the Covered Code is available under the terms of this License, - including a description of how and where You have fulfilled the - obligations of Section 3.2. The notice must be conspicuously included - in any notice in an Executable version, related documentation or - collateral in which You describe recipients' rights relating to the - Covered Code. You may distribute the Executable version of Covered - Code or ownership rights under a license of Your choice, which may - contain terms different from this License, provided that You are in - compliance with the terms of this License and that the license for the - Executable version does not attempt to limit or alter the recipient's - rights in the Source Code version from the rights set forth in this - License. If You distribute the Executable version under a different - license You must make it absolutely clear that any terms which differ - from this License are offered by You alone, not by the Initial - Developer or any Contributor. You hereby agree to indemnify the - Initial Developer and every Contributor for any liability incurred by - the Initial Developer or such Contributor as a result of any such - terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code - not governed by the terms of this License and distribute the Larger - Work as a single product. In such a case, You must make sure the - requirements of this License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this - License with respect to some or all of the Covered Code due to - statute, judicial order, or regulation then You must: (a) comply with - the terms of this License to the maximum extent possible; and (b) - describe the limitations and the code they affect. Such description - must be included in the LEGAL file described in Section 3.4 and must - be included with all distributions of the Source Code. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has - attached the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised - and/or new versions of the License from time to time. Each version - will be given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the - License, You may always continue to use it under the terms of that - version. You may also choose to use such Covered Code under the terms - of any subsequent version of the License published by Netscape. No one - other than Netscape has the right to modify the terms applicable to - Covered Code created under this License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may - only do in order to apply it to code which is not already Covered Code - governed by this License), You must (a) rename Your license so that - the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", - "MPL", "NPL" or any confusingly similar phrase do not appear in your - license (except to note that your license differs from this License) - and (b) otherwise make it clear that Your version of the license - contains terms which differ from the Mozilla Public License and - Netscape Public License. (Filling in the name of the Initial - Developer, Original Code or Contributor in the notice described in - Exhibit A shall not of themselves be deemed to be modifications of - this License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF - DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. - THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE - IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, - YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE - COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER - OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate - automatically if You fail to comply with terms herein and fail to cure - such breach within 30 days of becoming aware of the breach. All - sublicenses to the Covered Code which are properly granted shall - survive any termination of this License. Provisions which, by their - nature, must remain in effect beyond the termination of this License - shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement - claim (excluding declatory judgment actions) against Initial Developer - or a Contributor (the Initial Developer or Contributor against whom - You file such action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly - infringes any patent, then any and all rights granted by such - Participant to You under Sections 2.1 and/or 2.2 of this License - shall, upon 60 days notice from Participant terminate prospectively, - unless if within 60 days after receipt of notice You either: (i) - agree in writing to pay Participant a mutually agreeable reasonable - royalty for Your past and future use of Modifications made by such - Participant, or (ii) withdraw Your litigation claim with respect to - the Contributor Version against such Participant. If within 60 days - of notice, a reasonable royalty and payment arrangement are not - mutually agreed upon in writing by the parties or the litigation claim - is not withdrawn, the rights granted by Participant to You under - Sections 2.1 and/or 2.2 automatically terminate at the expiration of - the 60 day notice period specified above. - - (b) any software, hardware, or device, other than such Participant's - Contributor Version, directly or indirectly infringes any patent, then - any rights granted to You by such Participant under Sections 2.1(b) - and 2.2(b) are revoked effective as of the date You first made, used, - sold, distributed, or had made, Modifications made by that - Participant. - - 8.3. If You assert a patent infringement claim against Participant - alleging that such Participant's Contributor Version directly or - indirectly infringes any patent where such claim is resolved (such as - by license or settlement) prior to the initiation of patent - infringement litigation, then the reasonable value of the licenses - granted by such Participant under Sections 2.1 or 2.2 shall be taken - into account in determining the amount or value of any payment or - license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, - all end user license agreements (excluding distributors and resellers) - which have been validly granted by You or any distributor hereunder - prior to termination shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL - DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, - OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR - ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY - CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, - WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY - RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW - PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE - EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO - THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in - 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer - software" and "commercial computer software documentation," as such - terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 - C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), - all U.S. Government End Users acquire Covered Code with only those - rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. This License shall be governed by - California law provisions (except to the extent applicable law, if - any, provides otherwise), excluding its conflict-of-law provisions. - With respect to disputes in which at least one party is a citizen of, - or an entity chartered or registered to do business in the United - States of America, any litigation relating to this License shall be - subject to the jurisdiction of the Federal Courts of the Northern - District of California, with venue lying in Santa Clara County, - California, with the losing party responsible for costs, including - without limitation, court costs and reasonable attorneys' fees and - expenses. The application of the United Nations Convention on - Contracts for the International Sale of Goods is expressly excluded. - Any law or regulation which provides that the language of a contract - shall be construed against the drafter shall not apply to this - License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or indirectly, - out of its utilization of rights under this License and You agree to - work with Initial Developer and Contributors to distribute such - responsibility on an equitable basis. Nothing herein is intended or - shall be deemed to constitute any admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as - "Multiple-Licensed". "Multiple-Licensed" means that the Initial - Developer permits you to utilize portions of the Covered Code under - Your choice of the NPL or the alternative licenses, if any, specified - by the Initial Developer in the file described in Exhibit A. - -EXHIBIT A -Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. - - The Original Code is ______________________________________. - - The Initial Developer of the Original Code is ________________________. - Portions created by ______________________ are Copyright (C) ______ - _______________________. All Rights Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the terms - of the _____ license (the "[___] License"), in which case the - provisions of [______] License are applicable instead of those - above. If you wish to allow use of your version of this file only - under the terms of the [____] License and not to allow others to use - your version of this file under the MPL, indicate your decision by - deleting the provisions above and replace them with the notice and - other provisions required by the [___] License. If you do not delete - the provisions above, a recipient may use your version of this file - under either the MPL or the [___] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of - the notices in the Source Code files of the Original Code. You should - use the text of this Exhibit A rather than the text found in the - Original Code Source Code for Your Modifications.] - - ---------------------------------------------------------------------- - - AMENDMENTS - - The Netscape Public License Version 1.1 ("NPL") consists of the - Mozilla Public License Version 1.1 with the following Amendments, - including Exhibit A-Netscape Public License. Files identified with - "Exhibit A-Netscape Public License" are governed by the Netscape - Public License Version 1.1. - - Additional Terms applicable to the Netscape Public License. - I. Effect. - These additional terms described in this Netscape Public - License -- Amendments shall apply to the Mozilla Communicator - client code and to all Covered Code under this License. - - II. "Netscape's Branded Code" means Covered Code that Netscape - distributes and/or permits others to distribute under one or more - trademark(s) which are controlled by Netscape but which are not - licensed for use under this License. - - III. Netscape and logo. - This License does not grant any rights to use the trademarks - "Netscape", the "Netscape N and horizon" logo or the "Netscape - lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript", - "Smart Browsing" even if such marks are included in the Original - Code or Modifications. - - IV. Inability to Comply Due to Contractual Obligation. - Prior to licensing the Original Code under this License, Netscape - has licensed third party code for use in Netscape's Branded Code. - To the extent that Netscape is limited contractually from making - such third party code available under this License, Netscape may - choose to reintegrate such code into Covered Code without being - required to distribute such code in Source Code form, even if - such code would otherwise be considered "Modifications" under - this License. - - V. Use of Modifications and Covered Code by Initial Developer. - V.1. In General. - The obligations of Section 3 apply to Netscape, except to - the extent specified in this Amendment, Section V.2 and V.3. - - V.2. Other Products. - Netscape may include Covered Code in products other than the - Netscape's Branded Code which are released by Netscape - during the two (2) years following the release date of the - Original Code, without such additional products becoming - subject to the terms of this License, and may license such - additional products on different terms from those contained - in this License. - - V.3. Alternative Licensing. - Netscape may license the Source Code of Netscape's Branded - Code, including Modifications incorporated therein, without - such Netscape Branded Code becoming subject to the terms of - this License, and may license such Netscape Branded Code on - different terms from those contained in this License. - - VI. Litigation. - Notwithstanding the limitations of Section 11 above, the - provisions regarding litigation in Section 11(a), (b) and (c) of - the License shall apply to all disputes relating to this License. - - EXHIBIT A-Netscape Public License. - - "The contents of this file are subject to the Netscape Public - License Version 1.1 (the "License"); you may not use this file - except in compliance with the License. You may obtain a copy of - the License at http://www.mozilla.org/NPL/ - - Software distributed under the License is distributed on an "AS - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - implied. See the License for the specific language governing - rights and limitations under the License. - - The Original Code is Mozilla Communicator client code, released - March 31, 1998. - - The Initial Developer of the Original Code is Netscape - Communications Corporation. Portions created by Netscape are - Copyright (C) 1998-1999 Netscape Communications Corporation. All - Rights Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the - terms of the _____ license (the "[___] License"), in which case - the provisions of [______] License are applicable instead of - those above. If you wish to allow use of your version of this - file only under the terms of the [____] License and not to allow - others to use your version of this file under the NPL, indicate - your decision by deleting the provisions above and replace them - with the notice and other provisions required by the [___] - License. If you do not delete the provisions above, a recipient - may use your version of this file under either the NPL or the - [___] License." diff --git a/UI/WebServerResources/MailerUI.css b/UI/WebServerResources/MailerUI.css deleted file mode 100644 index 61c8750b2..000000000 --- a/UI/WebServerResources/MailerUI.css +++ /dev/null @@ -1,897 +0,0 @@ -/* - Copyright (C) 2005-2013 Inverse inc. - Copyright (C) 2005 SKYRIX Software AG - - This file is part of SOGo. - - SOGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOGo is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - 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 toge the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -DIV#leftPanel -{ - position: absolute; - top: 85px; - left: 0px; - width: 15em; - bottom: 0px; - margin: 0px; - padding: 0px; - overflow: hidden; -} - -DIV#rightPanel -{ position: absolute; - top: 80px; - left: 15em; - right: 0px; - bottom: 0px; - margin: 0px; - margin-left: 5px; - padding: 0px; - overflow: hidden; } - -/* top list */ -DIV#mailboxContent -{ cursor: default; - position: absolute; - background-color: #FFFFFF; - top: 2.5em; - left: 0px; - right: 0px; - height: 15.5em; - border-left: 1px solid #9B9B9B; - overflow: hidden; } - -DIV#mailboxList -{ overflow: auto; - overflow-x: hidden; } - -DIV#messageContent -{ position: absolute; - overflow: hidden; - top: 18em; - bottom: 0px; - left: 0px; - right: 0px; - margin: 0px; - margin-top: 5px; - padding: 0px; - border: 0px; - border-top: 1px solid #aaa; - border-left: 1px solid #aaa; - background: #fff; } - -DIV#messageContent P IMG -{ border: 0px; - vertical-align: middle; - margin-right: 1em; } - -DIV#folderTreeContent -{ border-top: 1px solid #909090; - border-left: 1px solid #909090; - border-bottom: 1px solid #FFFFFF; - border-right: 1px solid #FFFFFF; - position: absolute; - background: #CCDDEC; - color: #535D6D; - width: auto; - top: 2em; - bottom: 0px; - left: 0px; - right: 0px; - overflow: auto; } - -.aptview_title -{ - color: #000000; - font-weight: bold; -} - -.aptview_text -{ - color: #000000; -} - -.apt_other -{ - color: #000000; -} - -.apt_other_print -{ - font-style: italic; -} - -/* new stuff for Thunderbird like mailer */ - -.vertframerow -{ - border-top-color: white; - border-top-width: 1px; - border-top-style: solid; - border-bottom-color: #808080; - border-bottom-width: 1px; - border-bottom-style: solid; - background-color: #dcdad5; -} - -.foldercell -{ - width: 25%; -} - -.contentcell -{ -} - -.embedwhite_out -{ - border-width: 1px; - border-style: solid; - border-top-color: #808080; - border-left-color: #808080; - border-bottom-color: white; - border-right-color: white; -} - -.embedwhite_in -{ - border-width: 1px; - border-style: solid; - border-top-color: #808080; /* TODO */ - border-left-color: #808080; /* TODO */ - border-bottom-color: #808080; - border-right-color: #808080; - - background-color: white; - /* height: 300px; */ - /* height: 100%; */ -} - -.titlediv -{ - height: 2em; - line-height: 18px; - vertical-align: middle; - padding-top: 0px; - padding-left: 6px; } - -TABLE.titletable -{ - height: 24px; - vertical-align: middle; - padding-top: 6px; - padding-left: 6px; -} - -TABLE.titletable TD.titlecell SELECT -{ - display: -moz-popup; - border-top: 1px solid #fff; - border-left: 1px solid #fff; - border-right: 2px solid #222; - border-bottom: 2px solid #222; - -moz-border-bottom-colors: #000 #9c9a94 transparent; - -moz-border-right-colors: #000 #9c9a94 transparent; - background: #dcdad5; -} - -.whitesec_title -{ - background-color: #dcdad5; - padding: 4px; -} - -.treecell -{ - color: black; - vertical-align: bottom; - padding-left: 4px; /* move away from the icon */ - padding-right: 2px; /* move away from the right border */ - white-space: nowrap; -} - -DIV#folderTreeContent -{ -khtml-user-select: none;} - -/* mailbox tree (dtree) */ -DIV.dTreeNode SPAN.unseen -{ font-weight: bold; } - -/* mail tableview */ - -/* messages table with fixed headers */ - -TABLE.messageList -{ width: 100%; - -moz-user-select: none; - -khtml-user-select: none; } - -TABLE.messageList TH, -TABLE.messageList TD -{ height: 20px; - min-height: 20px; - text-overflow: ellipsis; - overflow: hidden; - padding: 0px 3px; - min-width: 22px; - margin: 0; - white-space: nowrap; } - -TABLE.messageList TH, -TR#messageCountHeader TH -{ height: 22px; - min-height: 22px; } - -TR#messageCountHeader TH -{ border-top: 0px; } - -TABLE.messageList TD -{ border-right: 1px solid transparent; } - -TABLE.messageList .messageThreadColumn, -TABLE.messageList .messageFlagColumn, -TABLE.messageList .messageAttachmentColumn, -TABLE.messageList .messageUnreadColumn -{ width: 22px; - max-width: 22px; - text-align: center; } - -TABLE.messageList .messageSubjectColumn -{ max-width: 30%; - width: 30%; } - -TABLE.messageList .messageSubjectColumn SPAN -{ padding-left: 20px; } - -TABLE.messageList TR.openedThread TD, -TABLE.messageList TR.closedThread TD, -TABLE.messageList TR.thread .messageThreadColumn -{ background-color: #DDD; } - -TABLE.messageList TR.thread TD -{ background-color: #EEE; } - -TABLE.messageList TR.thread1 .messageSubjectColumn -{ background-position: 20px 0px !important; - padding-left: 20px; } -TABLE.messageList TR.thread2 .messageSubjectColumn -{ background-position: 40px 0px !important; - padding-left: 40px; } -TABLE.messageList TR.thread3 .messageSubjectColumn -{ background-position: 60px 0px !important; - padding-left: 60px; } -TABLE.messageList TR.thread4 .messageSubjectColumn -{ background-position: 80px 0px !important; - padding-left: 80px; } -TABLE.messageList TR.thread5 .messageSubjectColumn -{ background-position: 100px 0px !important; - padding-left: 100px; } -TABLE.messageList TR.thread6 .messageSubjectColumn -{ background-position: 120px 0px !important; - padding-left: 120px; } -TABLE.messageList TR.thread7 .messageSubjectColumn -{ background-position: 140px 0px !important; - padding-left: 140px; } -TABLE.messageList TR.thread8 .messageSubjectColumn -{ background-position: 160px 0px !important; - padding-left: 160px; } -TABLE.messageList TR.thread9 .messageSubjectColumn -{ background-position: 180px 0px !important; - padding-left: 180px; } -TABLE.messageList TR.thread10 .messageSubjectColumn -{ background-position: 200px 0px !important; - padding-left: 200px; } - -TABLE.messageList .messageAddressColumn -{ max-width: 18%; - width: 18%; } - -TABLE.messageList .messageDateColumn -{ max-width: 22%; - width: 22%; } - -TABLE.messageList .messagePriorityColumn -{ width: 60px; - max-width: 60px; } - -TABLE.messageList .messageSizeColumn -{ min-width: 40px; } - -TR#rowTop TD -{ height: 0; - min-height: 0; - padding-top: 0; - padding-bottom: 0; } - -TABLE.messageList TR._selected TD -{ background-color: #9ABCD8; - color: #fff; } - -TABLE.messageList TR._deleted TD -{ text-decoration: line-through; } - -TABLE.messageList TR.mailer_unreadmail TD, -TR.mailer_unreadmail TD.messageSubjectColumn -{ font-weight: bold !important; } - -TR.mailer_repliedmailsubject TD.messageSubjectColumn -{ background-image: url(icon-replied.png) !important; - background-repeat: no-repeat !important; - background-position: 0px 0px !important; } - -TR.mailer_forwardedmailsubject TD.messageSubjectColumn -{ background-image: url(icon-forwarded.png) !important; - background-repeat: no-repeat !important; - background-position: 0px 0px !important; } - -TR.mailer_forwardedrepliedmailsubject TD.messageSubjectColumn -{ - background-image: url(icon-forwarded-replied.png) !important; - background-repeat: no-repeat !important; - background-position: 0px 0px !important; } - -TR.mailer_deletedmailsubject TD.messageSubjectColumn -{ - background-image: url(icon-deleted.png) !important; - background-repeat: no-repeat !important; - background-position: 0px 0px !important; } - -TD.mailer_readmailsubject A -{ - color: black; - text-decoration: none; -} - -TD.mailer_unreadmailsubject A -{ - color: black; - text-decoration: none; -} - -TR.mailer_listcell_deleted TD -{ - text-decoration: line-through; -} - -TR.mailer_listcell_regular TD A -{ - color: black; - text-decoration: none; -} - -/* mail viewer */ -#actionButtons -{ - position: absolute; - top: 2.5em; - right: 1em; -} - -.popup #actionButtons -{ - top: 7.0em; -} - -#editDraftButton, -#loadImagesButton -{ - float: right; -} - - -#signedImage -{ - position: absolute; - top: 5px; - right: 5px; -} - -.popup #signedImage -{ - top: 54px; - right: 5px; -} - -TABLE.mailer_fieldtable -{ top: 0px; - left: 0px; - padding-top: .5em; - padding-bottom: .5em; - overflow-y: auto; - overflow-x: hidden; - border-bottom: 1px solid #808080; - background: #DDDDDD; - width: 100%; } - -DIV.mailer_mailcontent -{ background-color: #fff; - padding: .5em; - position: absolute; - top: 7.5em; - left: 0px; - right: 0px; - bottom: 0px; - overflow: auto; } - -DIV.mailer_mailcontent TABLE -{ - table-layout: auto; -} - -/* collapsable header */ -TD.mailer_fieldname IMG.collapse, -TD.mailer_fieldname IMG.expand -{ cursor: pointer; - padding-right: 5px; } -TD.mailer_fieldvalue SPAN.collapse -{ white-space: nowrap; } -TD.mailer_fieldvalue SPAN.expand -{ white-space: normal; } - -TD.mailer_fieldname -{ - white-space: nowrap; - padding: 0 1em; - text-align: right; - font-weight: bold; - vertical-align: top; - width: 9em; -} - -TD.mailer_fieldvalue -{ vertical-align: top; } - -TD.mailer_subjectfieldvalue -{ - font-weight: bold; - white-space: pre; - white-space: pre-wrap; /* css-3 */ - white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */ - white-space: -pre-wrap; /* Opera 4-6 */ - white-space: -o-pre-wrap; /* Opera 7 */ - white-space: pre-wrap; -} - -TD.mailer_fieldvalue a -{ - text-decoration: underline; - vertical-align: top; -} - -TR.deleted TD -{ /* text-decoration: line-through; -- alternative display */ } - -img.mailer_imagecontent -{ - border: 0px; -} - -DIV.mailer_plaincontent -{ - position: relative; - clear: left; - font-family: monospace, fixed; - white-space: pre; - white-space: pre-wrap; /* css-3 */ - white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */ - white-space: -pre-wrap; /* Opera 4-6 */ - white-space: -o-pre-wrap; /* Opera 7 */ - word-wrap: break-word; /* Internet Explorer 5.5+ */ - width: 99%; - font-size: inherit; - margin: 0px; - padding: 0px; -} - -DIV.mailer_plaincontent P -{ - line-height: 3em; - height: auto; - margin: 0px; - padding: 0px; -} - -DIV.mailer_htmlcontent P -{ - white-space: normal; - font-family: sans-serif; - font-size: inherit; - padding: 0px; -} - -/* attachment editor */ - -form#attachment_form -{ - background-color: #dcdad5; - padding: 1px; -} - -div#attachment_list -{ - border-top-color: white; - border-top-width: 1px; - border-top-style: solid; -} - -div#attachment_upload -{ - border-bottom-color: #808080; - border-bottom-width: 1px; - border-bottom-style: solid; - padding: 4px; -} - -TD.attachment_uplabel -{ - width: 15%; - text-align: left; -} - -/* attachment link viewer */ - -DIV.linked_attachment_frame -{ - border: 0px; - clear: left; - margin: 0px; - margin-top: 10px; - padding: 5px; - /*background: #F0F0F0;*/ -} - -DIV.linked_attachment_frame fieldset -{ - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; -} - -DIV.linked_attachment_frame.file -{ display: inline; - clear: none; - float: left; } - -DIV.linked_attachment_body -{ - border: 0px; - text-align: center; -} - -DIV.linked_attachment_meta -{ - color: #444444; - border-width: 0; - padding: 2px 4px; -} - -TABLE.linked_attachment_meta -{ - color: #444444; -} - -.linked_attachment_body a:hover -{ - text-decoration: none; -} - -.linked_attachment_body a:hover .linked_attachment_meta -{ - background-color: #9ABCD8; - color: #fff; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 5px; -} - -.linked_attachment_body a:hover .muted -{ - color: #fff !important; -} - -DIV.linked_attachment_body HR -{ - border: 0px; - border-top: 1px solid #ddd; -} - -DIV.bodyFields -{ - background: #eee; - line-height: 1.5em; - margin: 0.5em 0px; - padding-bottom: 0.5em; - padding-top: 0.5em; - text-align: left; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; -} - -DIV.bodyFields SPAN.fieldName -{ - float: left; - font-weight: bold; - padding-right: 1em; - text-align: right; - width: 9em; -} - -DIV.bodyAdditionalFields -{ - color: #777; -} - -DIV.bodyMailContent -{ margin: 0.5em; - text-align: left; } - -DIV[datatype~="additional"] > A.node > SPAN.nodeName -{ color: #777; - font-style: italic; } - -DIV[datatype~="additional"] > A.node._selected > SPAN.nodeName -{ color: #fff; } - -/* drag-n-drop */ -IMG.dragMessage -{ position: absolute; - visibility: hidden; - border: 0px; - -moz-opacity: 0.7; - opacity: 0.7; } - -TABLE#addr_table -{ - margin-left: 30%; - width: 100%; -} - -/* quota indicator */ -DIV.quota -{ border-bottom: 1px solid #ccc; - margin: 2px 4px 2px 2px; } -DIV.quota DIV.level -{ background-image: url(quota-level.png); - background-repeat: repeat-x; - background-position: 25% 0; - border-left: 1px solid #999; - border-right: 1px solid #999; - /*height: 20px;*/ } -DIV.quota DIV.marks DIV -{ float: left; - margin: 0; - padding: 0; - width: 25%; - border: 0; - border-right: 1px solid #999; - height: 3px; } -DIV.quota DIV.level DIV.value -{ background-repeat: repeat-x; - border-left: 1px solid transparent; - height: 9px; - margin: 0; - position: relative; } -DIV.quota DIV.level DIV.value.ok -{ background-image: url(quota-level-ok.png); } -DIV.quota DIV.level DIV.value.warn -{ background-image: url(quota-level-warn.png); } -DIV.quota DIV.level DIV.value.alert -{ background-image: url(quota-level-alert.png); } -DIV.quota DIV.level P -{ margin: 0; - padding: 0; - clear: both; - color: #555; - font-size: 1em; - text-align: center; -} -DIV#quotaDialog -{ background-image: url("dialog-left.png"); - background-repeat: no-repeat; - background-position: top left; - position: absolute; - top: 100px; - left: 75px; - width: 200px; - z-index: 50; } -DIV#quotaDialog DIV -{ border: 1px solid #444; - background-color: #fff; - padding: 5px; } -DIV#quotaDialog DIV -{ border-left: 0; - margin-left: 19px; - text-align: left; } -DIV#quotaDialog H1, -DIV#quotaDialog P -{ font-size: 10px; - margin: 0; - padding: 0; } - -/* drag handles */ -DIV#verticalDragHandle -{ cursor: e-resize; - border: 0px; - top: 81px; - left: 15em; - width: 5px; - bottom: 0px; } - -DIV#rightDragHandle -{ cursor: n-resize; - top: 18em; - left: 0px; - right: 0px; - height: 5px; } - -@media print -{ - DIV#leftPanel, - DIV#verticalDragHandle, - DIV#filterPanel, - DIV#mailboxContent, - DIV.dragHandle - { display: none; } - - DIV#rightPanel - { position: static; - overflow: visible; - margin: 0px; } - - DIV#messageContent - { position: static; - border: 0px; - margin: 0px; - overflow: visible; } - - TABLE.mailer_fieldtable - { border: 0px; - font-family: serif; - height: auto; - overflow: visible; } - - TD.mailer_fieldname - { text-align: left; } - - TD.mailer_fieldname IMG - { display: none; } - - TD.mailer_fieldvalue, - TD.mailer_fieldvalue SPAN.collapse - { white-space: normal; } - - TD.mailer_fieldvalue A - { text-decoration: none; - white-space: nowrap; - color: #000; } - - A:visited - { color: #00f; } - - DIV.mailer_mailcontent - { position: static; - overflow: visible; } -} - -DIV#dragDropVisual -{ - background-image: url(message.gif); - background-repeat: no-repeat; - background-position: 4px 2px; - width: 5px; - height: 20px; - padding-left: 24px; - padding-top: 5px; -} - -DIV.copy -{ - background-image: url(message-copy.gif) !important; - background-position: 1px -2px !important; -} - -DIV#signatureFlagMessage DIV -{ text-align: left !important; } - -DIV#signatureFlagMessage H1, -DIV#signatureFlagMessage P -{ font-size: 10px; - margin: 0; - padding: 0; } - -TR#messageCountHeader TD -{ border-top: none; } - -/* UIxMailPartICalViewer */ -#iCalAttendees -{ padding: 0; } - -#iCalAttendees dt -{ font-weight: bold; } - -#iCalAttendees SPAN -{ line-height: 19px; } - -#iCalAttendees DIV.status-icon -{ background-repeat: no-repeat; - float: left; - padding: 0px; - clear: both; - width: 12px; - height: 18px; - margin-top: 1px; - margin-left: 4px; - margin-right: 4px; - background-image: url("attendee-partstats.png"); } - -#iCalAttendees .accepted DIV.status-icon -{ background-position: 0px 0px; } - -#iCalAttendees .declined DIV.status-icon -{ background-position: -12px 0px; } - -#iCalAttendees .needs-action DIV.status-icon -{ background-position: -24px 0px; } - -#iCalAttendees .tentative DIV.status-icon -{ background-position: -36px 0px; } - -#iCalAttendees .delegated DIV.status-icon -{ background-position: -48px 0px; } - -#iCalAttendees .attendeeUser, -#iCalAttendees .attendeeUser A -{ font-weight: bold; } - -#delegateEditor -{ padding-left: 5px; } - -#delegatedTo -{ width: 220px; } - -#delegatedTo -{ background-image: url("abcard.png"); - background-repeat: no-repeat; - background-position: 4px center; - padding: 2px 2px 2px 24px; - width: 220px; } - -DIV#iCalendarToolbar A.button -{ float: left; - vertical-align: middle;} - -DIV#iCalendarToolbar -{ padding: 0; } - -SPAN#delegateEditor -{ line-height: 23px; - vertical-align: middle; } - -INPUT#delegatedTo -{ float: left; } - -SPAN.floatLeft -{ float: left; - padding: 0 5px; } - -A#iCalendarDeleteFromCalendar -{ float: left; } - -A#iCalendarAddToCalendar -{ border-left: 2px solid #E6E7E6; - margin-left: 5px;} \ No newline at end of file diff --git a/UI/WebServerResources/MailerUI.js b/UI/WebServerResources/MailerUI.js deleted file mode 100644 index c0b319b14..000000000 --- a/UI/WebServerResources/MailerUI.js +++ /dev/null @@ -1,3131 +0,0 @@ -/* -*- Mode: js2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* JavaScript for SOGoMail */ -var accounts = []; -var mailboxTree; - -var Mailer = { - defaultWindowTitle: null, - currentMailbox: null, - currentMailboxType: "", - currentMessages: {}, - unseenCountMailboxes: [], - maxCachedMessages: 20, - cachedMessages: new Array(), - foldersStateTimer: false, - popups: new Array(), - - dataTable: null, - dataSources: new Hash(), - - drops: new Array(), - - columnsOrder: null, - sortByThread: false -}; - -var usersRightsWindowHeight = 335; -var usersRightsWindowWidth = 400; - -var pageContent = $("pageContent"); - -var deleteMessageRequestCount = 0; - -var refreshViewCheckTimer; - -// Variables for feature threadsCollapsing -var displayThreadElement = false; -var cachedThreadsCollapsed = []; - -// Variables for feature threadsCollapsing -var displayThreadElement = false; -var cachedThreadsCollapsed = UserSettings.Mail.threadsCollapsed; - -/* We need to override this method since it is adapted to GCS-based folder - references, which we do not use here */ -function URLForFolderID(folderID, application) { - if (application) - application = UserFolderURL + application + "/"; - else - application = ApplicationBaseURL; - - var url = application + encodeURI(folderID); - - if (url[url.length-1] == '/') - url = url.substr(0, url.length-1); - - return url; -} - -/* mail list */ - -function openMessageWindow(msguid, url) { - var wId = ''; - if (msguid) { - wId += "SOGo_msg" + Mailer.currentMailbox + "/" + msguid; - mailListToggleMessagesRead($("row_" + msguid), true); - } - var msgWin = openMailComposeWindow(url, wId); - - msgWin.focus(); - Mailer.popups.push(msgWin); - - return false; -} - -function onMessageDoubleClick(event) { - var action; - - if (Mailer.currentMailboxType == "draft") - action = "edit"; - else - action = "popupview"; - - return openMessageWindowsForSelection(action, true); -} - -function toggleMailSelect(sender) { - var row; - row = $(sender.name); - row.className = sender.checked ? "tableview_selected" : "tableview"; -} - -function openAddressbook(sender) { - var urlstr; - - urlstr = ApplicationBaseURL + "../Contacts/?popup=YES"; - var w = window.open(urlstr, "Addressbook", - "width=640,height=400,resizable=1,scrollbars=1,toolbar=0," - + "location=no,directories=0,status=0,menubar=0,copyhistory=0"); - w.focus(); - - return false; -} - -function onMenuSharing(event) { - var folderID = document.menuTarget.getAttribute("dataname"); - var type = document.menuTarget.getAttribute("datatype"); - - if (type == "additional") - showAlertDialog(clabels["The user rights cannot be" - + " edited for this object!"]); - else { - var urlstr = URLForFolderID(folderID) + "/acls"; - openAclWindow(urlstr); - } -} - -/* mail list DOM changes */ - -/* Update the messages list when flagging/unflagging a message. - * No AJAX is triggered here. */ -function flagMailInWindow (win, msguid, flagged) { - var row = win.$("row_" + msguid); - - if (row) { - var col = row.down("TD.messageFlagColumn"); - var img = col.down("img"); - if (flagged) { - img.setAttribute("src", ResourcesURL + "/flag.png"); - img.addClassName("messageIsFlagged"); - } - else { - img.setAttribute("src", ResourcesURL + "/dot.png"); - img.removeClassName ("messageIsFlagged"); - } - } -} - -/* Update the messages list when setting the unread/read flag of a message. - * No AJAX is triggered here. See mailListToggleMessagesRead */ -function markMailInWindow(win, msguid, markread) { - var row = win.$("row_" + msguid); - var unseenCount = 0; - - if (row) { - if (markread) { - if (row.hasClassName("mailer_unreadmail")) { - row.removeClassName("mailer_unreadmail"); - var img = win.$("readdiv_" + msguid); - if (img) { - img.setAttribute("src", ResourcesURL + "/dot.png"); - var title = img.getAttribute("title-markunread"); - if (title) - img.setAttribute("title", title); - } - else { - log ("No IMG found for " + msguid); - } - unseenCount = -1; - } - } - else { - if (!row.hasClassName("mailer_unreadmail")) { - row.addClassName("mailer_unreadmail"); - var img = win.$("readdiv_" + msguid); - if (img) { - img.setAttribute("src", ResourcesURL + "/unread.png"); - var title = img.getAttribute("title-markread"); - if (title) - img.setAttribute("title", title); - } - else { - log ("No IMG found for message " + msguid); - } - unseenCount = 1; - } - } - - if (unseenCount != 0) { - var node = mailboxTree.getMailboxNode(Mailer.currentMailbox); - if (node) { - updateUnseenCount(node, unseenCount, true); - } - } - } - else { - log ("No row found for message " + msguid); - } - - return (unseenCount != 0); -} - -/** - * This is called by UIxMailView with window.opener. - */ -function markMailReadInWindow(win, msguid) { - return markMailInWindow(win, msguid, true); -} - -/* mail list reply */ - -function openMessageWindowsForSelection(action, firstOnly) { - if ($(document.body).hasClassName("popup")) { - var url = window.location.href; - var parts = url.split("/"); - parts[parts.length-1] = action; - window.name += "_" + action; - window.location.href = parts.join("/"); - } - else { - var messageList = $("messageListBody"); - var rowsId = messageList.getSelectedRowsId(); - if (rowsId.length > 0) { - for (var i = 0; i < rowsId.length; i++) { - openMessageWindow(rowsId[i].substr(4), - ApplicationBaseURL + encodeURI(Mailer.currentMailbox) - + "/" + rowsId[i].substr(4) - + "/" + action); - if (firstOnly) - break; - } - } else { - showAlertDialog(_("Please select a message.")); - } - } - - return false; -} - - -function mailListToggleMessageThread(row, cell) { - var show = row.hasClassName('closedThread'); - var msguid = row.id.split("_")[1]; - var action = "markMessageCollapse"; - $(cell).down('img').remove(); - if (show) { - row.removeClassName('closedThread'); - row.addClassName('openedThread'); - action = "markMessageUncollapse"; - var img = createElement("img", null, null, { src: ResourcesURL + '/arrow-down.png' }); - cell.insertBefore(img, cell.firstChild); - } - else { - row.removeClassName('openedThread'); - row.addClassName('closedThread'); - var img = createElement("img", null, null, { src: ResourcesURL + '/arrow-right.png' }); - cell.insertBefore(img, cell.firstChild); - } - while ((row = row.next()) && row.hasClassName('thread')) { - if (show) - row.show(); - else - row.hide(); - } - - // Update the dictionary of the collapsed threads - var mailbox = Mailer.currentMailbox; - var url = ApplicationBaseURL + encodeURI(mailbox) + "/" + msguid + "/" + action; - var callbackData = { "currentMailbox": Mailer.currentMailbox, "msguid": msguid, "action": action}; - var content = {"currentMailbox": Mailer.currentMailbox, "msguid": msguid}; - - triggerAjaxRequest(url, mailListToggleMessageCollapseCallback, callbackData, Object.toJSON(content)); -} - -function mailListToggleMessageCollapseCallback(http) { - var data = http.callbackData; - if (isHttpStatus204(http.status)) - triggerAjaxRequest(UserFolderURL + "/preferences/jsonSettings", refreshUserSettingsCallback); - else { - log("Message Collapse Failed (" + http.status + "): " + http.statusText); - } -} - - -/* Triggered when clicking on the read/unread dot of a message row or - * through the contextual menu. */ -function mailListToggleMessagesRead(row, force_mark_as_read) { - var selectedRowsId = []; - if (row) { - selectedRowsId = [row.id]; - } - else { - var messageList = $("messageListBody"); - if (messageList) { - var selectedRows = messageList.getSelectedRows(); - row = selectedRows[0]; - selectedRowsId = messageList.getSelectedRowsId(); - } - } - if (selectedRowsId.length > 0) { - var action; - var markread; - if (row.hasClassName("mailer_unreadmail")) { - action = 'markMessageRead'; - markread = true; - } - else if (!force_mark_as_read) { - action = 'markMessageUnread'; - markread = false; - } - else { - return; - } - - for (var i = 0; i < selectedRowsId.length; i++) { - var msguid = selectedRowsId[i].split('_')[1]; - // Assume ajax request will succeed and change message flag in table - markMailInWindow(window, msguid, markread); - - var url = ApplicationBaseURL + encodeURI(Mailer.currentMailbox) + "/" - + msguid + "/" + action; - - var data = { "msguid": msguid }; - triggerAjaxRequest(url, mailListMarkMessageCallback, data); - } - } -} - -/* - function mailListMarkMessage(event) { - mailListToggleMessagesRead(); - - preventDefault(event); - - return false; - } - */ - -function mailListMarkMessageCallback(http) { - var data = http.callbackData; - if (isHttpStatus204(http.status)) { - Mailer.dataTable.invalidate(data["msguid"], true); - } - else { - log("Message Mark Failed (" + http.status + "): " + http.statusText); - Mailer.dataTable.invalidate(data["msguid"], false); - } -} - -function mailListFlagMessageToggle(e) { - mailListToggleMessagesFlagged(); -} - -/* Triggered when clicking on the flag/unflag dot of a message row */ -function mailListToggleMessagesFlagged(row) { - var selectedRowsId = []; - if (row) { - selectedRowsId = [row.id]; - } - else { - var messageList = $("messageListBody"); - if (messageList) { - var selectedRows = messageList.getSelectedRows(); - row = selectedRows[0]; - selectedRowsId = messageList.getSelectedRowsId(); - } - } - if (selectedRowsId.length > 0) { - var td = row.down("td.messageFlagColumn"); - var img = td.childElements().first(); - - var action = "markMessageFlagged"; - var flagged = true; - if (img.hasClassName("messageIsFlagged")) { - action = "markMessageUnflagged"; - flagged = false; - } - - for (var i = 0; i < selectedRowsId.length; i++) { - var msguid = selectedRowsId[i].split("_")[1]; - flagMailInWindow(window, msguid, flagged); - - var url = ApplicationBaseURL + encodeURI(Mailer.currentMailbox) + "/" - + msguid + "/" + action; - var data = { "msguid": msguid }; - - triggerAjaxRequest(url, mailListToggleMessageFlaggedCallback, data); - } - } -} - -function mailListToggleMessageFlaggedCallback(http) { - var data = http.callbackData; - if (!isHttpStatus204(http.status)) { - log("Message Mark Failed (" + http.status + "): " + http.statusText); - } - Mailer.dataTable.invalidate(data["msguid"], true); -} - -function onUnload(event) { - var url = ApplicationBaseURL + encodeURI(Mailer.currentMailbox) + "/expunge"; - - new Ajax.Request(url, { - asynchronous: false, - method: 'get', - onFailure: function(transport) { - log("Can't expunge current folder: " + transport.status); - } - }); - - return true; -} - -function onDocumentKeydown(event) { - var target = Event.element(event); - if (target.tagName != "INPUT") { - var keyCode = event.keyCode; - if (!keyCode) { - keyCode = event.charCode; - if (keyCode == "a".charCodeAt(0)) { - keyCode = "A".charCodeAt(0); - } - } - if (keyCode == Event.KEY_DELETE || - keyCode == Event.KEY_BACKSPACE) { - deleteSelectedMessages(); - Event.stop(event); - } - else if (keyCode == Event.KEY_DOWN || - keyCode == Event.KEY_UP) { - if (Mailer.currentMessages[Mailer.currentMailbox]) { - var row = $("row_" + Mailer.currentMessages[Mailer.currentMailbox]); - var nextRow; - if (keyCode == Event.KEY_DOWN) - nextRow = row.next("tr"); - else - nextRow = row.previous("tr"); - if (nextRow && nextRow.id != 'rowTop' && nextRow.id != 'rowBottom') { - Mailer.currentMessages[Mailer.currentMailbox] = nextRow.getAttribute("id").substr(4); - row.parentNode.deselectAll(); - - // Adjust the scollbar - var viewPort = $("mailboxList"); - var divDimensions = viewPort.getDimensions(); - var centerOffset = divDimensions.height/2; - var rowScrollOffset = nextRow.cumulativeScrollOffset(); - var divBottom = divDimensions.height + rowScrollOffset.top; - var rowBottom = nextRow.offsetTop + nextRow.getHeight(); - - if (divBottom < rowBottom) - viewPort.scrollTop += rowBottom - divBottom + centerOffset; - else if (viewPort.scrollTop > nextRow.offsetTop) - viewPort.scrollTop -= rowScrollOffset.top - nextRow.offsetTop + centerOffset; - - // Select and load the next message - nextRow.selectElement(); - loadMessage(Mailer.currentMessages[Mailer.currentMailbox]); - // from generic.js - lastClickedRow = nextRow.rowIndex; - lastClickedRowId = nextRow.id; - } - Event.stop(event); - } - } - else if (((isMac() && event.metaKey == 1) || (!isMac() && event.ctrlKey == 1)) - && keyCode == "A".charCodeAt(0)) { // Ctrl-A - $("messageListBody").down("TBODY").selectAll(); - Event.stop(event); - } - } -} - -/* Search mail, call the template and open inside a dialog windoÆ’w */ -function onSearchMail(event) { - Event.stop(event); - var element = Event.findElement(event); - if (element.disabled == false || element.disabled == undefined) { - element.disabled = true; - element.writeAttribute("id", "toolbarSearchButton"); - if ($("searchMailView")) { - $("searchMailView").style.display = "block"; - $("bgDialogDiv").style.display = "block"; - initSearchMailView(); - } - else { - var urlstr = ApplicationBaseURL + "/search"; - - // Return the template for the searchMail feature - triggerAjaxRequest(urlstr, displaySearchMailCallback); - } - } - return false; -} - -function displaySearchMailCallback(http) { - if (http.readyState == 4 && http.status == 200) { - var fields = createElement("div", null); // (tagName, id, classes, attributes, htmlAttributes, parentNode) - var title = _("Search multiple mailboxes"); - var id = _("searchMailView"); - fields.innerHTML = http.responseText; - - var dialog = createDialog(id, title, null, fields, "searchMail"); // (id, title, legend, content, positionClass) - document.body.appendChild(dialog); - - if (Prototype.Browser.IE) - jQuery('#bgDialogDiv').css('opacity', 0.4); - jQuery(dialog).fadeIn('fast'); - initSearchMailView(); - } -} - -/* bulk delete of messages */ - -function deleteSelectedMessages(sender) { - if (Mailer.currentMailboxType == "account" || Mailer.currentMailboxType == "additional") - return false; - - var messageList = $("messageListBody").down("TBODY"); - var messageContent = $("messageContent"); - var rowIds = messageList.getSelectedNodesId(); - var uids = new Array(); // message IDs - var paths = new Array(); // row IDs - var unseenCount = 0; - var refreshFolder = false; - - if (rowIds && rowIds.length > 0) { - messageList.deselectAll(); - for (var i = 0; i < rowIds.length; i++) { - if (unseenCount < 1) { - var rows = messageList.select('#' + rowIds[i]); - if (rows.length > 0) { - var row = rows.first(); - row.hide(); - if (row.hasClassName("mailer_unreadmail")) - unseenCount--; - } - else { - unseenCount = 1; - } - } - var uid = rowIds[i].substr(4); // drop "row_" - var path = Mailer.currentMailbox + "/" + uid; - uids.push(uid); - paths.push(path); - deleteMessageRequestCount++; - - deleteCachedMessage(path); - if (Mailer.currentMessages[Mailer.currentMailbox] == uid) { - if (messageContent) messageContent.innerHTML = ''; - Mailer.currentMessages[Mailer.currentMailbox] = null; - } - - if (i+1 == rowIds.length) { - // Select next message - var row = $("row_" + uid); - var nextRow = false; - if (row) { - //row.addClassName("deleted"); // when we'll offer "mark as deleted" - nextRow = row.next("tr"); - if (!nextRow.id.startsWith('row_')) - nextRow = row.previous("tr"); - else if (row.hasClassName('openedThread') || row.hasClassName('closedThread')) { - // Thread root deleted -- must refresh folder - refreshFolder = true; - // New row will be the new thread root -- mark it as first mail of the thread - var nextUid = nextRow.id.substr(4); - var nextIndex = Mailer.dataTable.dataSource.indexOf(nextUid); - Mailer.dataTable.dataSource.uids[nextIndex][2] = 1; // mark it as "first" - Mailer.dataTable.dataSource.invalidate(nextUid); // next refresh will reload headers for row - } - if (nextRow.id.startsWith('row_')) { - Mailer.currentMessages[Mailer.currentMailbox] = nextRow.id.substr(4); - nextRow.selectElement(); - if (loadMessage(Mailer.currentMessages[Mailer.currentMailbox]) && !refreshFolder) { - // Seen state has changed - Mailer.dataTable.dataSource.invalidate(Mailer.currentMessages[Mailer.currentMailbox]); - refreshFolder = true; - } - } - } - else if (messageContent) { - messageContent.innerHTML = ''; - } - Mailer.dataTable.remove(uid); - if (nextRow) { - // from generic.js - lastClickedRow = nextRow.rowIndex; - lastClickedRowId = nextRow.id; - } - if (Mailer.currentMailboxType != "trash") - deleteCachedMailboxByType("trash"); - } - else { - Mailer.dataTable.remove(uid); - } - } - updateMessageListCounter(0 - rowIds.length, true); - if (unseenCount < 0) { - var node = mailboxTree.getMailboxNode(Mailer.currentMailbox); - if (node) { - updateUnseenCount(node, unseenCount, true); - } - } - var url = ApplicationBaseURL + encodeURI(Mailer.currentMailbox) + "/batchDelete"; - var parameters = "uid=" + uids.join(","); - var data = { "id": uids, "mailbox": Mailer.currentMailbox, "path": paths, "refreshUnseenCount": (unseenCount > 0), "refreshFolder": refreshFolder }; - triggerAjaxRequest(url, deleteSelectedMessagesCallback, data, parameters, - { "Content-type": "application/x-www-form-urlencoded" }); - } - if (uids.length == 0) - showAlertDialog(_("Please select a message.")); - - return false; -} - -function deleteSelectedMessagesCallback(http) { - if (isHttpStatus204(http.status) || http.status == 200) { - var data = http.callbackData; - if (http.status == 200) { - // The answer contains quota information - var rdata = http.responseText.evalJSON(true); - if (rdata.quotas && data["mailbox"].startsWith('/0/')) - updateQuotas(rdata.quotas); - } - if (data["refreshUnseenCount"]) - // TODO : the unseen count should be returned when calling the batchDelete remote action, - // in order to avoid this extra AJAX call. - getUnseenCountForFolder(data["mailbox"]); - if (data["refreshFolder"]) - Mailer.dataTable.refresh(); - } - else if (!http.callbackData["withoutTrash"]) { - showConfirmDialog(_("Warning"), - _("The messages could not be moved to the trash folder. Would you like to delete them immediately?"), - deleteMessagesWithoutTrash.bind(document, http.callbackData), - function() { refreshCurrentFolder(); disposeDialog(); }); - } - else { - var html = new Element('div').update(http.responseText); - log ("Messages deletion failed (" + http.status + ") : "); - log (html.down('p').innerHTML); - showAlertDialog(_("Operation failed")); - refreshCurrentFolder(); - } -} - -function deleteMessagesWithoutTrash(data) { - var url = ApplicationBaseURL + encodeURI(data["mailbox"]) + "/batchDelete"; - var parameters = "uid=" + data["id"].join(",") + '&withoutTrash=1'; - data["withoutTrash"] = true; - triggerAjaxRequest(url, deleteSelectedMessagesCallback, data, parameters, - { "Content-type": "application/x-www-form-urlencoded" }); - disposeDialog(); -} - -function onMenuDeleteMessage(event) { - deleteSelectedMessages(); - preventDefault(event); -} - -/** - * The following two functions are called from UIxMailPopupView - * with window.opener. - */ -function deleteMessageWithDelay(url, id, mailbox, messageId) { - var row = $("row_" + id); - if (row) row.hide(); - setTimeout("deleteMessage('" + - url + "', '" + - id + "', '" + - mailbox + "', '" + - messageId + "')", - 50); -} - -function deleteMessage(url, id, mailbox, messageId) { - var data = { "id": new Array(id), "mailbox": mailbox, "path": new Array(messageId) }; - var parameters = "uid=" + id; - deleteMessageRequestCount++; - triggerAjaxRequest(url, deleteSelectedMessagesCallback, data, parameters, - { "Content-type": "application/x-www-form-urlencoded" }); -} - -function onPrintCurrentMessage(event) { - var messageList = $("messageListBody").down("TBODY"); - var rows = messageList.getSelectedNodesId(); - if (rows.length == 0) { - showAlertDialog(_("Please select a message to print.")); - } - else if (rows.length > 1) { - showAlertDialog(_("Please select only one message to print.")); - } - else - window.print(); - - preventDefault(event); -} - -function onMailboxTreeItemClick(event) { - var topNode = $("mailboxTree"); - var mailbox = this.parentNode.getAttribute("dataname"); - if (topNode.selectedEntry) - topNode.selectedEntry.deselect(); - this.selectElement(); - topNode.selectedEntry = this; - - search = {}; - $$('[name="search"]').first().value = ""; - initCriteria(); - - Mailer.currentMailboxType = this.parentNode.getAttribute("datatype"); - if (Mailer.currentMailboxType == "account" || Mailer.currentMailboxType == "additional") { - Mailer.currentMailbox = mailbox; - var messageContent = $("messageContent"); - if (messageContent) messageContent.innerHTML = ''; - $("messageCountHeader").childNodes[0].innerHTML = ' '; - Mailer.dataTable._emptyTable(); - updateWindowTitle(); - } - else { - var datatype = this.parentNode.getAttribute("datatype"); - if (datatype == 'draft' || datatype == 'sent') - toggleAddressColumn("from", "to"); - else - toggleAddressColumn("to", "from"); - - updateWindowTitle(this.childNodesWithTag("span")[0]); - openMailbox(mailbox); - } - - Event.stop(event); -} - -function toggleAddressColumn(search, replace) { - var header = $(search + "Header"); - if (header) { - header.id = replace + "Header"; - header.update(_(replace.capitalize())); - var i = Mailer.columnsOrder.indexOf(search.capitalize()); - if (i >= 0) - Mailer.columnsOrder[i] = replace.capitalize(); - } - if (sorting["attribute"] == search) - sorting["attribute"] = replace; -} - -function onMailboxMenuMove(event) { - var targetMailbox; - var messageList = $("messageListBody").down("TBODY"); - var rowIds = messageList.getSelectedNodesId(); - var uids = new Array(); // message IDs - var paths = new Array(); // row IDs - - Mailer.currentMessages[Mailer.currentMailbox] = null; - $('messageContent').update(); - - if (this.tagName == 'LI') // from contextual menu - targetMailbox = this.mailbox.fullName(); - else // from DnD - targetMailbox = this.readAttribute("dataname"); - - for (var i = 0; i < rowIds.length; i++) { - var uid = rowIds[i].substr(4); - var path = Mailer.currentMailbox + "/" + uid; - var rows = messageList.select('#' + rowIds[i]); - if (rows.length > 0) - rows.first().hide(); - uids.push(uid); - paths.push(path); - // Remove references to closed popups - for (var j = Mailer.popups.length - 1; j > -1; j--) - if (!Mailer.popups[j].open || Mailer.popups[j].closed) - Mailer.popups.splice(j,1); - // Close message popup if opened - for (var j = 0; j < Mailer.popups.length; j++) - if (Mailer.popups[j].messageUID == path) { - Mailer.popups[j].close(); - Mailer.popups.splice(j,1); - break; - } - } - - // Remove cache of target data source - deleteCachedMailbox(targetMailbox); - - var url = ApplicationBaseURL + encodeURI(Mailer.currentMailbox) + "/moveMessages"; - var parameters = "uid=" + uids.join(",") + "&folder=" + encodeURIComponent(targetMailbox); - var data = { "id": uids, "mailbox": Mailer.currentMailbox, "path": paths, "folder": targetMailbox, "refresh": true }; - triggerAjaxRequest(url, folderRefreshCallback, data, parameters, - { "Content-type": "application/x-www-form-urlencoded" }); - - return false; -} - -function onMailboxMenuCopy(event) { - var messageList = $("messageListBody").down("TBODY"); - var rowIds = messageList.getSelectedNodesId(); - var uids = new Array(); // message IDs - var paths = new Array(); // row IDs - - var targetMailbox; - if (this.tagName == 'LI') // from contextual menu - targetMailbox = this.mailbox.fullName(); - else // from DnD - targetMailbox = this.readAttribute("dataname"); - for (var i = 0; i < rowIds.length; i++) { - var uid = rowIds[i].substr(4); - var path = Mailer.currentMailbox + "/" + uid; - uids.push(uid); - paths.push(path); - } - - // Remove cache of target data source - deleteCachedMailbox(targetMailbox); - - var url = ApplicationBaseURL + encodeURI(Mailer.currentMailbox) + "/copyMessages"; - var parameters = "uid=" + uids.join(",") + "&folder=" + encodeURIComponent(targetMailbox); - var data = { "id": uids, "mailbox": Mailer.currentMailbox, "path": paths, "folder": targetMailbox, "refresh": false }; - triggerAjaxRequest(url, folderRefreshCallback, data, parameters, - { "Content-type": "application/x-www-form-urlencoded" }); - - return false; -} - -function refreshMailbox() { - var topWindow = getTopWindow(); - if (topWindow) { - topWindow.refreshCurrentFolder(); - topWindow.refreshUnseenCounts(); - } - - return false; -} - -function onComposeMessage() { - var topWindow = getTopWindow(); - if (topWindow) - topWindow.composeNewMessage(); - - return false; -} - -function composeNewMessage() { - var account; - if (Mailer.currentMailbox) - account = Mailer.currentMailbox.split("/")[1]; - else if (mailAccounts.length) - account = "0"; - else - account = null; - if (account) { - var url = ApplicationBaseURL + encodeURI("/" + account) + "/compose"; - openMailComposeWindow(url); - } -} - -function openMailbox(mailbox, reload) { - if (mailbox != Mailer.currentMailbox || reload) { - var url = ApplicationBaseURL + encodeURI(mailbox.unescapeHTML()); - var urlParams = {filters: [], sortingAttributes: {}}; - - if (!reload) { - var messageContent = $("messageContent"); - if (messageContent) messageContent.innerHTML = ''; - $("messageCountHeader").childNodes[0].innerHTML = ' '; - lastClickedRow = -1; // from generic.js - } - - var searchValue = search["mail"]["value"]; - if (searchValue && searchValue.length > 0) { - var searchCriteria = []; - if (search["mail"]["criteria"] == "subject") - searchCriteria.push("subject"); - else if (search["mail"]["criteria"] == "sender") - searchCriteria.push("from"); - else if (search["mail"]["criteria"] == "subject_or_sender") - searchCriteria.push("subject", "from"); - else if (search["mail"]["criteria"] == "to_or_cc") - searchCriteria.push("to", "cc"); - else if (search["mail"]["criteria"] == "entire_message") - searchCriteria.push("body"); - - var filters = []; - for (i = 0; i < searchCriteria.length; i++) - filters.push({"searchBy": searchCriteria[i], "searchArgument": "doesContain", "searchInput": searchValue}); - - urlParams.filters = filters; - } - var sortAttribute = sorting["attribute"]; - if (sortAttribute && sortAttribute.length > 0) { - var sortingAttributes = {"sort":sorting["attribute"], "asc":sorting["ascending"], "match":"OR"}; - urlParams.sortingAttributes = sortingAttributes; - - var sortHeader = $(sorting["attribute"] + "Header"); - if (sortHeader) { - var sortImages = sortHeader.up('THEAD').select(".sortImage"); - $(sortImages).each(function(item) { - item.remove(); - }); - var sortImage = createElement("img", "messageSortImage", "sortImage"); - sortHeader.insertBefore(sortImage, sortHeader.firstChild); - if (sorting["ascending"]) - sortImage.src = ResourcesURL + "/arrow-up.png"; - else - sortImage.src = ResourcesURL + "/arrow-down.png"; - } - } - - var messageList = $("messageListBody").down('TBODY'); - var key = mailbox; - - if (reload) { - // Don't change data source, only query UIDs from server and refresh - // the view. Cases that end up here: - // - performed a search - // - clicked on Get Mail button - urlParams.sortingAttributes.no_headers= "1"; - var content = Object.toJSON(urlParams); - Mailer.dataTable.load(content); - Mailer.dataTable.refresh(); - } - else { - var dataSource = Mailer.dataSources.get(key); - if (!dataSource) { - // Data source is not cached - dataSource = new SOGoMailDataSource(Mailer.dataTable, url); - if (inboxData) { - // Use UIDs and headers from the WOX template; this only - // happens once and only with the inbox - dataSource.init(inboxData['uids'], inboxData['threaded'], inboxData['headers'], inboxData['quotas']); - inboxData = null; // invalidate this initial lookup - } - else { - // Fetch UIDs and headers from server - var content = Object.toJSON(urlParams); - dataSource.load(content); - } - // Cache data source - Mailer.dataSources.set(key, dataSource); - // Update unseen count - getUnseenCountForFolder(mailbox); - } - else { - // Data source is cached, query only UIDs from server - urlParams.sortingAttributes.no_headers= "1"; - var content = Object.toJSON(urlParams); - dataSource.load(content); - } - // Associate data source with data table and render the view - Mailer.dataTable.setSource(dataSource); - Mailer.dataTable.render(); - } - - Mailer.currentMailbox = mailbox; - - if (Mailer.unseenCountMailboxes.indexOf(mailbox) == -1) { - Mailer.unseenCountMailboxes.push(mailbox); - } - - // Restore previous selection - var currentMessage = Mailer.currentMessages[mailbox]; - if (currentMessage) { - if (!reload) { - loadMessage(currentMessage); - } - } - } -} - -/* - * Called from SOGoDataTable.render() - */ - -function messageListCallback(row, data, isNew) { - var currentMessages = []; - if (!Object.isArray(document.menuTarget)) { - // Menu called from one selection in message list view - currentMessages.push(Mailer.currentMessages[Mailer.currentMailbox]); - } - else { - // Menu called from multiple selection in messages list view - var rows = $(document.menuTarget); - for (var i = 0; i < rows.length; i++) { - var _row = $(rows[i]); - if (_row) { - currentMessages.push(rows[i].substr(4)); - } - } - } - row.id = data['rowID']; - row.writeAttribute('labels', (data['labels']?data['labels']:"")); - row.className = data['rowClasses']; - row.show(); // make sure the row is visible - - // Restore previous selection - if (currentMessages.indexOf(String(data['uid'])) != -1) - row.addClassName('_selected'); - - if (data['Thread']) { - if (cachedThreadsCollapsed) { - var mailbox = Mailer.currentMailbox; - var collapsedList = cachedThreadsCollapsed[mailbox]; - if (collapsedList != undefined && collapsedList.indexOf(row.id.split("_")[1]) != -1) { - row.addClassName('closedThread'); - displayThreadElement = true; - } - else { - row.addClassName('openedThread'); - } - } - } - - else if (data['ThreadLevel'] > 0) { - if (data['ThreadLevel'] > 10) data['ThreadLevel'] = 10; - row.addClassName('thread'); - row.addClassName('thread' + data['ThreadLevel']); - - if (displayThreadElement) - row.hide(); - } - - else - displayThreadElement = false; - - var cells = row.childElements(); - for (var j = 0; j < cells.length; j++) { - var cell = cells[j]; - var cellType = Mailer.columnsOrder[j]; - if (data[cellType]) cell.innerHTML = data[cellType]; - else cell.innerHTML = ' '; - } -} - -function refreshUnseenCounts() { - for (var i = 0; i < Mailer.unseenCountMailboxes.length; i++) { - var mailboxPath = Mailer.unseenCountMailboxes[i]; - var node = mailboxTree.getMailboxNode(mailboxPath); - if (node) { - getUnseenCountForFolder(mailboxPath); - } - } -} - -function getUnseenCountForFolder(mailbox) { - var url = URLForFolderID(mailbox) + '/unseenCount'; - triggerAjaxRequest(url, unseenCountCallback, mailbox); -} - -function unseenCountCallback(http) { - var div = $('mailboxContent'); - var table = $('messageList'); - - if (http.status == 200) { - document.unseenCountAjaxRequest = null; - var data = http.responseText.evalJSON(true); - var node = mailboxTree.getMailboxNode(http.callbackData); - if (node) - updateUnseenCount(node, data.unseen, false); - } -} - -function updateUnseenCount(node, count, isDelta) { - var unseenSpan = null; - var counterSpan = null; - - var spans = node.select("SPAN.unseenCount"); - if (spans.length > 0) { - counterSpan = spans[0]; - unseenSpan = counterSpan.parentNode; - } - if (counterSpan) { - if (typeof(count) == "undefined" || isDelta) { - if (typeof(count) == "undefined") { - count = 0; - } - var content = ""; - for (var i = 0; i < counterSpan.childNodes.length; i++) { - var cNode = counterSpan.childNodes[i]; - if (cNode.nodeType == 3) { - content += cNode.nodeValue; - } - } - var digits = ""; - for (var i = 0; i < content.length; i++) { - var code = content.charCodeAt(i); - if (code > 47 && code < 58) { - digits += content.charAt(i); - } - } - count += parseInt(digits); - } - while (counterSpan.firstChild) { - counterSpan.removeChild(counterSpan.firstChild); - } - counterSpan.appendChild(document.createTextNode(" (" + count + ")")); - if (count > 0) { - counterSpan.removeClassName("hidden"); - unseenSpan.addClassName("unseen"); - } - else { - counterSpan.addClassName("hidden"); - unseenSpan.removeClassName("unseen"); - } - if (node.getAttribute("dataname") == Mailer.currentMailbox) - updateWindowTitle(unseenSpan); - } -} - -function updateMessageListCounter(count, isDelta) { - var cell = $("messageCountHeader").down(); - - if (isDelta) { - var value = parseInt(cell.innerHTML); - count += value; - } - - if (count > 0) - cell.update(count + " " + _("messages")); - else - cell.update(_("No message")); -} - -function updateWindowTitle(span) { - if (!Mailer.defaultWindowTitle) - Mailer.defaultWindowTitle = document.title || "SOGo"; - else if (!span) - document.title = Mailer.defaultWindowTitle; - if (span) { - var title = Mailer.defaultWindowTitle + " - "; - if (span.hasClassName("unseen")) { - var subtitle = span.innerHTML.stripTags(); - var idx = subtitle.lastIndexOf("("); - var len = subtitle.length-idx-2; - title += "(" + subtitle.substr(idx+1, len) + ") " + subtitle.substring(0, idx); - } - else - title += span.childNodes[0].nodeValue; - document.title = title; - } -} - -/* Function is called when the event datatable:rendered is fired from SOGoDataTable. */ -function onMessageListRender(event) { - // Restore previous selection - var currentMessage = Mailer.currentMessages[Mailer.currentMailbox]; - if (currentMessage) { - var rows = this.select("TR#row_" + currentMessage); - if (rows.length == 1) - rows[0].selectElement(); - } - // Update message counter in folder name - updateMessageListCounter(event.memo, false); -} - -function onMessageContextMenu(event) { - var target = Event.element(event); - var menu = $('messageListMenu'); - var topNode = $('messageListBody'); - var selectedNodes = topNode.getSelectedRowsId(); - var row = target.up('TR'); - - if (selectedNodes.indexOf(row.id) < 0) { - if (target.tagName != 'TD') - target = target.up('TD'); - onRowClick(event, target); - selectedNodes = topNode.getSelectedRowsId(); - } - - if (selectedNodes.length > 1) - popupMenu(event, "messagesListMenu", selectedNodes); - else if (selectedNodes.length == 1) - popupMenu(event, "messageListMenu", row); -} - -function onFolderMenuClick(event) { - var onhide, menuName; - - var menutype = this.parentNode.getAttribute("datatype"); - if (menutype) { - if (menutype == "inbox") { - menuName = "inboxIconMenu"; - } else if (menutype == "account") { - menuName = "accountIconMenu"; - } else if (menutype == "trash") { - menuName = "trashIconMenu"; - } else { - menuName = "mailboxIconMenu"; - } - } else { - menuName = "mailboxIconMenu"; - } - - var menu = $(menuName); - menu.on("contextmenu:hide", onFolderMenuHide); - popupMenu(event, menuName, this.parentNode); - - var topNode = $("mailboxTree"); - if (topNode.selectedEntry) - topNode.selectedEntry.deselect(); - if (topNode.menuSelectedEntry) - topNode.menuSelectedEntry.deselect(); - topNode.menuSelectedEntry = this; - this.selectElement(); - - preventDefault(event); -} - -function onFolderMenuHide(event) { - var topNode = $("mailboxTree"); - - if (topNode.menuSelectedEntry) { - topNode.menuSelectedEntry.deselect(); - topNode.menuSelectedEntry = null; - } - if (topNode.selectedEntry) - topNode.selectedEntry.selectElement(); - - this.stopObserving("contextmenu:hide", onFolderMenuHide); -} - -function deleteCachedMailboxByType(type) { - var nodes = $("mailboxTree").select("DIV[datatype=" + type + "]"); - if (nodes.length == 1) - deleteCachedMailbox(nodes[0].readAttribute("dataname")); - - if (Mailer.currentMailboxType == type) - refreshCurrentFolder(); -} - -function deleteCachedMailbox(mailboxPath) { - var keys = Mailer.dataSources.keys(); - for (var i = 0; i < keys.length; i++) { - if (keys[i] == mailboxPath || keys[i].startsWith(mailboxPath + "?")) - Mailer.dataSources.unset(keys[i]); - } -} - -function deleteCachedMessage(messageId) { - var done = false; - var counter = 0; - - while (counter < Mailer.cachedMessages.length - && !done) - if (Mailer.cachedMessages[counter] - && Mailer.cachedMessages[counter]['idx'] == messageId) { - Mailer.cachedMessages.splice(counter, 1); - done = true; - } - else - counter++; -} - -function getCachedMessage(idx) { - var message = null; - var counter = 0; - - while (counter < Mailer.cachedMessages.length - && message == null) - if (Mailer.cachedMessages[counter] - && Mailer.cachedMessages[counter]['idx'] == Mailer.currentMailbox + '/' + idx) - message = Mailer.cachedMessages[counter]; - else - counter++; - - return message; -} - -function storeCachedMessage(cachedMessage) { - var oldest = -1; - var timeOldest = -1; - var counter = 0; - - if (Mailer.cachedMessages.length < Mailer.maxCachedMessages) - oldest = Mailer.cachedMessages.length; - else { - while (Mailer.cachedMessages[counter]) { - if (oldest == -1 - || Mailer.cachedMessages[counter]['time'] < timeOldest) { - oldest = counter; - timeOldest = Mailer.cachedMessages[counter]['time']; - } - counter++; - } - - if (oldest == -1) - oldest = 0; - } - - Mailer.cachedMessages[oldest] = cachedMessage; -} - -function onMessageSelectionChange(event) { - var t = getTarget(event); - - if (t.tagName == 'IMG') { - t = t.parentNode; - if (t.tagName == 'TD') { - if (t.className == 'messageThreadColumn') { - mailListToggleMessageThread(t.parentNode, t); - } - else if (t.className == 'messageUnreadColumn') { - mailListToggleMessagesRead(t.parentNode); - return false; - } - else if (t.className == 'messageFlagColumn') { - mailListToggleMessagesFlagged(t.parentNode); - return false; - } - } - } - if (t.tagName == 'SPAN') - t = t.parentNode; - - // Update rows selection - onRowClick(event, t); - - var messageContent = $("messageContent"); - var rows = this.getSelectedRowsId(); - if (rows.length == 1) { - var idx = rows[0].substr(4); - if (Mailer.currentMessages[Mailer.currentMailbox] != idx) { - Mailer.currentMessages[Mailer.currentMailbox] = idx; - if (messageContent) loadMessage(idx); - } - } - else if (rows.length > 1 && messageContent) - $('messageContent').innerHTML = ''; - - return true; -} - -function loadMessage(msguid) { - if (document.messageAjaxRequest) { - document.messageAjaxRequest.aborted = true; - document.messageAjaxRequest.abort(); - } - - var div = $('messageContent'); - if (div == null) - // Single-window mode - return false; - - var cachedMessage = getCachedMessage(msguid); - var row = $("row_" + msguid); - var seenStateHasChanged = row && row.hasClassName('mailer_unreadmail'); - if (cachedMessage == null) { - var url = (ApplicationBaseURL + encodeURI(Mailer.currentMailbox) + "/" - + msguid + "/view?noframe=1"); - div.innerHTML = ''; - document.messageAjaxRequest = triggerAjaxRequest(url, - loadMessageCallback, - { 'mailbox': Mailer.currentMailbox, - 'msguid': msguid, - 'seenStateHasChanged': seenStateHasChanged }); - } - else { - div.innerHTML = cachedMessage['text']; - cachedMessage['time'] = (new Date()).getTime(); - document.messageAjaxRequest = null; - configureLinksInMessage(); - resizeMailContent(); - if (seenStateHasChanged) { - // Mark message as read on server - mailListToggleMessagesRead(); - } - } - - configureLoadImagesButton(); - configureSignatureFlagImage(); - - if (UserDefaults["SOGoMailDisplayRemoteInlineImages"] == 'always') - loadRemoteImages(); - - return seenStateHasChanged; -} - -/** - * Hide the "Load Images" button when there's no unsafe content - */ -function configureLoadImagesButton() { - var loadImagesButton = $("loadImagesButton"); - if (typeof(loadImagesButton) == "undefined" || - loadImagesButton == null ) { - return; - } - var content = $("messageContent"); - var unsafeElements = content.select('[unsafe-src], [unsafe-data], [unsafe-classid], [unsafe-background], [unsafe-style]'); - if (unsafeElements.length == 0) { - loadImagesButton.setStyle({ display: 'none' }); - } - else { - content.hiddenElements = unsafeElements; - } -} - -function configureSignatureFlagImage() { - var signedPart = $("signedMessage"); - if (signedPart) { - var supportsSMIME - = parseInt(signedPart.getAttribute("supports-smime")); - - if (supportsSMIME) { - var loadImagesButton = $("loadImagesButton"); - var parentNode = loadImagesButton.parentNode; - - var valid = parseInt(signedPart.getAttribute("valid")); - var flagImage; - - if (valid) - flagImage = "signature-ok.png"; - else - flagImage = "signature-not-ok.png"; - - var error = signedPart.getAttribute("error"); - var newImg = createElement("img", "signedImage", null, null, - { src: ResourcesURL + "/" + flagImage }); - - var msgDiv = $("signatureFlagMessage"); - if (msgDiv && error) { - // First line in a h1, others each in a p - var formattedMessage = "

" + error.replace(/\n/, "

"); - formattedMessage = formattedMessage.replace(/\n/g, "

") + "

"; - msgDiv.innerHTML = "
" + formattedMessage + "
"; - newImg.observe("mouseover", showSignatureMessage); - newImg.observe("mouseout", hideSignatureMessage); - } - loadImagesButton.parentNode.insertBefore(newImg, loadImagesButton.nextSibling); - } - } -} - -function showSignatureMessage () { - var div = $("signatureFlagMessage"); - if (div) { - var node = $("signedImage"); - var cellPosition = node.cumulativeOffset(); - var divDimensions = div.getDimensions(); - var left = cellPosition[0] - divDimensions['width']; - var top = cellPosition[1]; - div.style.top = (top + 5) + "px"; - div.style.left = (left + 5) + "px"; - div.style.display = "block"; - } -} -function hideSignatureMessage () { - var div = $("signatureFlagMessage"); - if (div) - div.style.display = "none"; -} - -function configureLinksInMessage() { - var messageDiv = $('messageContent'); - var mailContentDiv = document.getElementsByClassName('mailer_mailcontent', - messageDiv)[0]; - if (!$(document.body).hasClassName("popup")) - mailContentDiv.observe("contextmenu", onMessageContentMenu); - - configureLinks(messageDiv); - - var attachmentsMenu = $("attachmentsMenu"); - if (attachmentsMenu) { - var options = attachmentsMenu.select("li"); - var callbacks = []; - for (var i = 0; i < options.length; i++) { - if (options[i].className == 'separator') - callbacks.push(null); - else - callbacks.push(saveAttachment); - } - initMenu(attachmentsMenu, callbacks); - $("attachmentsHref").on("click", function (event) { - popupMenu(event, 'attachmentsMenu', this); - preventDefault(event); - return false; - }); - } - - var images = messageDiv.select("IMG.mailer_imagecontent"); - for (var i = 0; i < images.length; i++) - $(images[i]).observe("contextmenu", onImageClick); - - var editDraftButton = $("editDraftButton"); - if (editDraftButton) - editDraftButton.on("click", onMessageEditDraft); - - var loadImagesButton = $("loadImagesButton"); - if (loadImagesButton) - loadImagesButton.on("click", onMessageLoadImages); - - configureiCalLinksInMessage(); -} - -function configureiCalLinksInMessage() { - var buttons = { "iCalendarAccept": "accept", - "iCalendarDecline": "decline", - "iCalendarTentative": "tentative", - "iCalendarUpdateUserStatus": "updateUserStatus", - "iCalendarAddToCalendar": "addToCalendar", - "iCalendarDeleteFromCalendar": "deleteFromCalendar" }; - - for (var key in buttons) { - var button = $(key); - if (button) { - button.action = buttons[key]; - button.stopObserving("click"); - button.observe("click", - onICalendarButtonClick.bindAsEventListener(button)); - } - } - - var button = $("iCalendarDelegate"); - if (button) { - button.stopObserving("click"); - button.observe("click", onICalendarDelegate); - var delegatedTo = $("delegatedTo"); - delegatedTo.addInterface(SOGoAutoCompletionInterface); - delegatedTo.uidField = "c_mail"; - delegatedTo.excludeGroups = true; - delegatedTo.excludeLists = true; - - var editDelegate = $("editDelegate"); - if (editDelegate) { - // The user delegates the invitation - editDelegate.stopObserving("click"); - editDelegate.observe("click", function(event) { - $("delegateEditor").show(); - $("delegatedTo").focus(); - this.hide(); - }); - } - - var delegatedToLink = $("delegatedToLink"); - if (delegatedToLink) { - // The user already delegated the invitation and wants - // to change the delegated attendee - delegatedToLink.stopObserving("click"); - delegatedToLink.observe("click", function(event) { - $("delegatedTo").show(); - $("iCalendarDelegate").show(); - $("delegatedTo").focus(); - this.hide(); - Event.stop(event); - }); - } - } -} - -function onICalendarDelegate(event) { - var link = $("iCalendarAttachment").value; - if (link) { - var currentMsg; - if ($(document.body).hasClassName("popup")) - currentMsg = mailboxName + "/" + messageName; - else - currentMsg = Mailer.currentMailbox + "/" - + Mailer.currentMessages[Mailer.currentMailbox]; - delegateInvitation(link, ICalendarButtonCallback, currentMsg); - } - this.blur(); // required by IE - Event.stop(event); -} - -function onICalendarButtonClick(event) { - var link = $("iCalendarAttachment").value; - if (link) { - var urlstr = link + "/" + this.action; - var currentMsg; - currentMsg = Mailer.currentMailbox + "/" - + Mailer.currentMessages[Mailer.currentMailbox]; - triggerAjaxRequest(urlstr, ICalendarButtonCallback, currentMsg); - } - else - log("no link"); - - this.blur(); // Required by IE - Event.stop(event); -} - -function ICalendarButtonCallback(http) { - if ($(document.body).hasClassName("popup")) { - if (window.opener && window.opener.open && !window.opener.closed) - window.opener.ICalendarButtonCallback(http); - else - window.location.reload(); - } - else { - var oldMsg = http.callbackData; - if (isHttpStatus204(http.status)) { - var msg = Mailer.currentMailbox + "/" + Mailer.currentMessages[Mailer.currentMailbox]; - deleteCachedMessage(oldMsg); - if (oldMsg == msg) { - loadMessage(Mailer.currentMessages[Mailer.currentMailbox]); - } - for (var i = 0; i < Mailer.popups.length; i++) { - if (Mailer.popups[i].messageUID == oldMsg) { - // Don't reload, just close; - // Reloading the popup would disconnect the popup from the parent - //Mailer.popups[i].location.reload(); - Mailer.popups[i].close(); - Mailer.popups.splice(i,1); - break; - } - } - } - else if (http.status == 403) { - var data = http.responseText; - var msg = data.replace(/^(.*\n)*.*

((.*\n)*.*)<\/p>(.*\n)*.*$/, "$2"); - for (var i = 0; i < Mailer.popups.length; i++) { - if (Mailer.popups[i].messageUID == oldMsg) { - // Show the alert in the proper popup window - Mailer.popups[i].alert(_(msg)); - break; - } - } - if (i == Mailer.popups.length) - showAlertDialog(_(msg)); - } - else - showAlertDialog("received code: " + http.status + "\nerror: " + http.responseText); - } -} - -function resizeMailContent() { - var headerTable = document.getElementsByClassName('mailer_fieldtable')[0]; - var contentDiv = document.getElementsByClassName('mailer_mailcontent')[0]; - - contentDiv.setStyle({ 'top': - (Element.getHeight(headerTable) + headerTable.offsetTop) + 'px' }); - - // Show expand buttons if necessary - var spans = $$("TABLE TR.mailer_fieldrow TD.mailer_fieldvalue SPAN"); - spans.each(function(span) { - var row = span.up("TR"); - if (span.getWidth() > row.getWidth()) { - var cell = row.select("TD.mailer_fieldname").first(); - var link = cell.down("img"); - link.show(); - link.observe("click", toggleDisplayHeader); - } - }); -} - -function toggleDisplayHeader(event) { - var row = this.up("TR"); - var span = row.down("SPAN"); - - if (this.hasClassName("collapse")) { - this.writeAttribute("src", ResourcesURL + '/minus.png'); - this.writeAttribute("class", "expand"); - span.writeAttribute("class", "expand"); - } - else { - this.writeAttribute("src", ResourcesURL + '/plus.png'); - this.writeAttribute("class", "collapse"); - span.writeAttribute("class", "collapse"); - } - resizeMailContent(); - - preventDefault(event); - return false; -} - -function onMessageContentMenu(event) { - var element = getTarget(event); - if ((element.tagName == 'A' && element.href.substring(0,7) == "mailto:") - || element.tagName == 'IMG') - // Don't show the default contextual menu; let the click propagate to - // other observers - return true; - popupMenu(event, 'messageContentMenu', this); -} - -function onMessageEditDraft(event) { - Event.stop(event); - return openMessageWindowsForSelection("edit", true); -} - -function onMessageLoadImages(event) { - Event.stop(event); - loadRemoteImages(); -} - -function loadRemoteImages() { - var content = $("messageContent"); - if (content.hiddenElements) { - $(content.hiddenElements).each(function(element) { - ['src', 'data', 'classid', 'background', 'style'].each(function(attr) { - var unsafeAttr = element.readAttribute('unsafe-' + attr); - if (unsafeAttr) { - log ('unsafe ' + attr + ': ' + unsafeAttr); - element.writeAttribute(attr, unsafeAttr); - } - }); - }); - content.hiddenElements = null; - } - var loadImagesButton = $("loadImagesButton"); - if (loadImagesButton) - loadImagesButton.setStyle({ display: 'none' }); -} - -function onEmailAddressClick(event) { - popupMenu(event, 'addressMenu', this); - preventDefault(event); - return false; -} - -function onImageClick(event) { - popupMenu(event, 'imageMenu', this); - preventDefault(event); - return false; -} - -function handleReturnReceipt() { - var input = $("shouldAskReceipt"); - if (input) { - if (eval(input.value)) { - showConfirmDialog(_("Return Receipt"), - _("The sender of this message has asked to be notified when you read this message. " - + "Do you with to notify the sender?"), - onReadMessageConfirmMDN); - } - } -} - -function onReadMessageConfirmMDN(event) { - var messageURL; - if (window.opener && window.opener.Mailer) { - /* from UIxMailPopupView */ - messageURL = (ApplicationBaseURL + encodeURI("/" + mailboxName) - + "/" + messageName); - } - else { - /* from main window */ - messageURL = (ApplicationBaseURL + encodeURI(Mailer.currentMailbox) + "/" - + Mailer.currentMessages[Mailer.currentMailbox]); - } - disposeDialog(); - var url = messageURL + "/sendMDN"; - triggerAjaxRequest(url); -} - -function loadMessageCallback(http) { - var div = $('messageContent'); - - if (http.status == 200) { - if (http.callbackData) { - document.messageAjaxRequest = null; - var msguid = http.callbackData.msguid; - var mailbox = http.callbackData.mailbox; - if (Mailer.currentMailbox == mailbox && - Mailer.currentMessages[Mailer.currentMailbox] == msguid) { - div.innerHTML = http.responseText; - configureLinksInMessage(); - resizeMailContent(); - configureLoadImagesButton(); - if (UserDefaults["SOGoMailDisplayRemoteInlineImages"] == 'always') - loadRemoteImages(); - configureSignatureFlagImage(); - handleReturnReceipt(); - } - var cachedMessage = new Array(); - cachedMessage['idx'] = Mailer.currentMailbox + '/' + msguid; - cachedMessage['time'] = (new Date()).getTime(); - cachedMessage['text'] = http.responseText; - if (cachedMessage['text'].length < 30000) - storeCachedMessage(cachedMessage); - // Mark the mail as read - mailListToggleMessagesRead($("row_" + msguid), true); - } - } - else if (http.status == 404) { - showAlertDialog (_("The message you have selected doesn't exist anymore.")); - Mailer.dataTable.remove(http.callbackData.msguid); - Mailer.currentMessages[Mailer.currentMailbox] = null; - } - else - log("messageCallback: problem during ajax request: " + http.status); -} - -function processMailboxMenuAction(mailbox) { - var currentNode, upperNode; - var mailboxName; - var action; - - mailboxName = mailbox.getAttribute('mailboxname'); - currentNode = mailbox; - upperNode = null; - - while (currentNode - && !currentNode.hasAttribute('mailboxaction')) - currentNode = currentNode.parentNode.parentNode.parentMenuItem; - - if (currentNode) { - action = currentNode.getAttribute('mailboxaction'); - } -} - -var rowSelectionCount = 0; - -validateControls(); - -function showElement(e, shouldShow) { - e.style.display = shouldShow ? "" : "none"; -} - -function enableElement(e, shouldEnable) { - if(!e) - return; - if(shouldEnable) { - if(e.hasAttribute("disabled")) - e.removeAttribute("disabled"); - } - else { - e.setAttribute("disabled", "1"); - } -} - -function validateControls() { - var e = $("moveto"); - this.enableElement(e, rowSelectionCount > 0); -} - -function moveTo(uri) { - alert("MoveTo: " + uri); -} - -/* message menu entries */ -function onMenuOpenMessage(event) { - return openMessageWindowsForSelection('popupview'); -} - -function onMenuReplyToSender(event) { - return openMessageWindowsForSelection('reply'); -} - -function onMenuReplyToAll(event) { - return openMessageWindowsForSelection('replyall'); -} - -function onMenuForwardMessage(event) { - return openMessageWindowsForSelection('forward'); -} - -function onMenuViewMessageSource(event) { - var messageList = $("messageListBody"); - var rows = messageList.getSelectedRowsId(); - - if (rows.length > 0) { - var url = (ApplicationBaseURL + encodeURI(Mailer.currentMailbox) + "/" - + rows[0].substr(4) + "/viewsource"); - $(function() { - openMailComposeWindow(url); - }).delay(0.1); - } - - preventDefault(event); -} - -function saveImage(event) { - var img = document.menuTarget; - var url = img.getAttribute("src"); - var urlAsAttachment = url.replace(/(\/[^\/]*)$/,"/asAttachment$1"); - - window.location.href = urlAsAttachment; -} - -/* Download a file using a temporary iframe that we delete once the download is started */ -function download(url) { - var form = createElement('form', null, 'hidden', { action: url, method: 'GET'}); - $(document.body).appendChild(form); - var div = AIM.submit(form); - form.submit(); - setTimeout(function () { - form.remove(); - div.remove(); - }, 20000); -} - -function saveAttachment(event) { - var url = $(this).readAttribute('data-url'); - if (url) { - download(url); - } - else { - $(this).up('ul').select('li[data-url]').each(function (item) { - url = $(item).readAttribute('data-url'); - download(url); - }); - } -} - -/* contacts */ -function newContactFromEmail(event) { - var mailto = document.menuTarget.innerHTML; - - var email = extractEmailAddress(mailto); - var c_name = extractEmailName(mailto); - if (email.length > 0) { - var url = (UserFolderURL + "Contacts/personal/newcontact?contactEmail=" - + encodeURI(email)); - if (c_name) - url += "&contactFN=" + c_name; - openContactWindow(url); - } - - return false; /* stop following the link */ -} - -function newEmailTo(sender) { - return openMailTo(document.menuTarget.innerHTML); -} - -function expandUpperTree(node) { - var currentNode = node.parentNode; - - while (currentNode.className != "dtree") { - if (currentNode.className == 'clip') { - var id = currentNode.getAttribute("id"); - var number = parseInt(id.substr(2)); - if (number > 0) { - var cn = mailboxTree.aNodes[number]; - mailboxTree.nodeStatus(1, number, cn._ls); - } - } - currentNode = currentNode.parentNode; - } -} - -function onHeaderClick(event) { - if (SOGoResizableTable._onHandle) - return; - - var headerId = this.getAttribute("id"); - var newSortAttribute; - if (headerId == "subjectHeader") - newSortAttribute = "subject"; - else if (headerId == "fromHeader") - newSortAttribute = "from"; - else if (headerId == "toHeader") - newSortAttribute = "to"; - else if (headerId == "dateHeader") - newSortAttribute = "date"; - else if (headerId == "sizeHeader") - newSortAttribute = "size"; - else - newSortAttribute = "arrival"; - - if (sorting["attribute"] == newSortAttribute) - sorting["ascending"] = !sorting["ascending"]; - else { - sorting["attribute"] = newSortAttribute; - sorting["ascending"] = true; - } - - refreshCurrentFolder(); - - Event.stop(event); -} - -function refreshCurrentFolder() { - if (Mailer.currentMailboxType != "account" && Mailer.currentMailboxType != "additional") - openMailbox(Mailer.currentMailbox, true); -} - -/* Called after sending an email */ -function refreshMessage(mailbox, messageUID) { - if (Mailer.currentMailboxType == 'sent' || Mailer.currentMailboxType == 'draft') - refreshCurrentFolder(); - else if (mailbox == Mailer.currentMailbox) { - Mailer.dataTable.invalidate(messageUID); - } -} - -function configureMessageListEvents() { - var headerTable = $("messageListHeader"); - var dataTable = $("messageListBody"); - var messageContent = $("messageContent"); - - if (headerTable) - // Sortable columns - configureSortableTableHeaders(headerTable); - - if (dataTable) { - dataTable.multiselect = true; - if (messageContent) { - dataTable.observe("click", onMessageSelectionChange); - dataTable.observe("dblclick", onMessageDoubleClick); - } - else { - // Single-window mode - dataTable.observe("click", function(e) { - onMessageSelectionChange.bind(this)(e) && - onMessageDoubleClick.bind(this)(e); }); - } - dataTable.observe("selectstart", listRowMouseDownHandler); - dataTable.observe("contextmenu", onMessageContextMenu); - } -} - -function configureDragHandles() { - var handle = $("verticalDragHandle"); - if (handle) { - handle.addInterface(SOGoDragHandlesInterface); - handle.leftMargin = 50; - handle.leftBlock=$("leftPanel"); - handle.rightBlock=$("rightPanel"); - } - - handle = $("rightDragHandle"); - if (handle) { - handle.addInterface(SOGoDragHandlesInterface); - handle.upperBlock=$("mailboxContent"); - handle.lowerBlock=$("messageContent"); - handle.observe("handle:dragged", onMessageListResize); - } -} - -function onMessageListResize(event) { - var h = $("mailboxContent").getHeight() - $("messageListHeader").getHeight(); - $("mailboxList").setStyle({'height': h + 'px'}); -} - -function onWindowResize(event) { - var handle = $("verticalDragHandle"); - if (handle) - handle.adjust(); - handle = $("rightDragHandle"); - if (handle) - handle.adjust(); -} - -/* stub */ - -function refreshContacts() { -} - -function openInbox(node) { - var done = false; - openMailbox(node.parentNode.getAttribute("dataname"), false); - mailboxTree.o(1); - mailboxTree.s(2); -} - -function initMailer(event) { - if (!$(document.body).hasClassName("popup")) { - Mailer.columnsOrder = UserDefaults["SOGoMailListViewColumnsOrder"]; - Mailer.sortByThread = UserDefaults["SOGoMailSortByThreads"] != null && parseInt(UserDefaults["SOGoMailSortByThreads"]) > 0; - if (Mailer.sortByThread && Mailer.columnsOrder[0] != "Thread") - Mailer.columnsOrder = ["Thread"].concat(Mailer.columnsOrder); - else if (!Mailer.sortByThread && Mailer.columnsOrder[0] == "Thread") - Mailer.columnsOrder.shift(); // drop the thread column - - if (UserSettings && UserSettings.Mail) { - // Restore threads - cachedThreadsCollapsed = UserSettings.Mail.threadsCollapsed; - - // Restore sorting from user settings - if (UserSettings.Mail.SortingState) { - sorting["attribute"] = UserSettings["Mail"]["SortingState"][0]; - sorting["ascending"] = parseInt(UserSettings["Mail"]["SortingState"][1]) > 0; - if (sorting["attribute"] == 'to') sorting["attribute"] = 'from'; // initial mailbox is always the inbox - } - else { - sorting["attribute"] = "date"; - sorting["ascending"] = false; - } - } - - Mailer.dataTable = $("mailboxList"); - Mailer.dataTable.addInterface(SOGoDataTableInterface); - Mailer.dataTable.setRowRenderCallback(messageListCallback); - Mailer.dataTable.observe("datatable:rendered", onMessageListRender); - - var messageListHeader = $("messageListHeader"); - messageListHeader.addInterface(SOGoResizableTableInterface); - if (UserSettings["Mail"] && UserSettings["Mail"]["ColumnsState"]) { - messageListHeader.restore($H(UserSettings["Mail"]["ColumnsState"])); - } - else { - messageListHeader.restore(); - } - - configureDraggables(); - configureMessageListEvents(); - - initMailboxTree(); - initRefreshViewCheckTimer(); - - Event.observe(document, "keydown", onDocumentKeydown); - - /* Perform an expunge when leaving the webmail */ - // if (isSafari()) { - // $('calendarBannerLink').observe("click", onUnload); - // $('contactsBannerLink').observe("click", onUnload); - // $('logoff').observe("click", onUnload); - // } - // else - Event.observe(window, "beforeunload", onUnload); - - onMessageListResize(); - } - - onWindowResize.defer(); - Event.observe(window, "resize", onWindowResize); -} - -function initRefreshViewCheckTimer() { - // TEMPORARY : to be erase - var refreshViewCheck = UserDefaults["SOGoMailMessageCheck"]; - if (refreshViewCheck == null) - refreshViewCheck = UserDefaults["SOGoRefreshViewCheck"]; - - if (refreshViewCheck && refreshViewCheck != "manually") { - var interval; - if (refreshViewCheck == "once_per_hour") - interval = 3600; - else if (refreshViewCheck == "every_minute") - interval = 60; - else { - interval = parseInt(refreshViewCheck.substr(6)) * 60; - } - refreshViewCheckTimer = window.setInterval(onRefreshViewCheckCallback, - interval * 1000); - } -} - -function onRefreshViewCheckCallback(event) { - refreshMailbox(); -} - -function initMailboxTree() { - var node = $("mailboxTree"); - if (node) - node.parentNode.removeChild(node); - mailboxTree = new dTree("mailboxTree"); - mailboxTree.config.hideRoot = true; - mailboxTree.icon.root = ResourcesURL + "/tbtv_account_17x17.png"; - mailboxTree.icon.folder = ResourcesURL + "/tbtv_leaf_corner_17x17.png"; - mailboxTree.icon.folderOpen = ResourcesURL + "/tbtv_leaf_corner_17x17.png"; - mailboxTree.icon.node = ResourcesURL + "/tbtv_leaf_corner_17x17.png"; - mailboxTree.icon.line = ResourcesURL + "/tbtv_line_17x22.png"; - mailboxTree.icon.join = ResourcesURL + "/tbtv_junction_17x22.png"; - mailboxTree.icon.joinBottom = ResourcesURL + "/tbtv_corner_17x22.png"; - mailboxTree.icon.plus = ResourcesURL + "/tbtv_plus_17x22.png"; - mailboxTree.icon.plusBottom = ResourcesURL + "/tbtv_corner_plus_17x22.png"; - mailboxTree.icon.minus = ResourcesURL + "/tbtv_minus_17x22.png"; - mailboxTree.icon.minusBottom = ResourcesURL + "/tbtv_corner_minus_17x22.png"; - mailboxTree.icon.nlPlus = ResourcesURL + "/tbtv_corner_plus_17x22.png"; - mailboxTree.icon.nlMinus = ResourcesURL + "/tbtv_corner_minus_17x22.png"; - mailboxTree.icon.empty = ResourcesURL + "/empty.gif"; - mailboxTree.preload (); - - mailboxTree.add(0, -1, ''); - - var chainRq = new AjaxRequestsChain(initMailboxTreeCB); - for (var i = 0; i < mailAccounts.length; i++) { - var url = ApplicationBaseURL + "/" + i + "/mailboxes"; - chainRq.requests.push([url, onLoadMailboxesCallback, i]); - } - chainRq.start(); -} - -function initMailboxTreeCB() { - updateMailboxTreeInPage(); - updateMailboxMenus(); - checkAjaxRequestsState(); - getFoldersState(); - configureDroppables(); - if (unseenCountFolders.length > 0) { - for (var i = 0; i < unseenCountFolders.length; i++) { - Mailer.unseenCountMailboxes.push(unseenCountFolders[i]); - } - refreshUnseenCounts(); - } -} - -function onLoadMailboxesCallback(http) { - if (http.status == 200) { - checkAjaxRequestsState(); - if (http.responseText.length > 0) { - var accountIdx = http.callbackData; - var newAccount = buildMailboxes(accountIdx, http.responseText); - accounts[accountIdx] = newAccount; - mailboxTree.addMailAccount(newAccount); - } - else { - log ("onLoadMailboxesCallback " + http.status); - } - } -} - -function updateMailboxTreeInPage() { - var treeContent = $("folderTreeContent"); - //treeContent.update(mailboxTree.toString ()); - treeContent.appendChild(mailboxTree.domObject ()); - - var inboxFound = false; - var tree = $("mailboxTree"); - var nodes = document.getElementsByClassName("node", tree); - for (i = 0; i < nodes.length; i++) { - nodes[i].observe("click", - onMailboxTreeItemClick.bindAsEventListener(nodes[i])); - nodes[i].observe("contextmenu", - onFolderMenuClick.bindAsEventListener(nodes[i])); - if (!inboxFound - && nodes[i].parentNode.getAttribute("datatype") == "inbox") { - Mailer.currentMailboxType = "inbox"; - openInbox(nodes[i]); - inboxFound = true; - } - } -} - -function updateQuotas(quotas) { - if (quotas && parseInt(quotas.maxQuota) > 0) { - log ("updating quotas " + quotas.usedSpace + "/" + quotas.maxQuota); - var treeContent = $("folderTreeContent"); - var tree = $("mailboxTree"); - var quotaDiv = $("quotaIndicator"); - if (quotaDiv) { - treeContent.removeChild(quotaDiv); - } - // Build quota indicator, show values in MB - var percents = (Math.round(quotas.usedSpace * 10000 - / quotas.maxQuota) - / 100); - var level = (percents > 85)? "alert" : (percents > 70)? "warn" : "ok"; - var format = _("quotasFormat"); - var text = format.formatted(percents, - Math.round(quotas.maxQuota/10.24)/100); - quotaDiv = new Element('div', { 'id': 'quotaIndicator', - 'class': 'quota', - 'info': text }); - var levelDiv = new Element('div', { 'class': 'level' }); - var valueDiv = new Element('div', { 'class': 'value ' + level, 'style': 'width: ' + ((percents > 100)?100:percents) + '%' }); - var marksDiv = new Element('div', { 'class': 'marks' }); - var textP = new Element('p').update(text); - marksDiv.insert(new Element('div')); - marksDiv.insert(new Element('div')); - marksDiv.insert(new Element('div')); - levelDiv.insert(valueDiv); - levelDiv.insert(marksDiv); - levelDiv.insert(textP); - quotaDiv.insert(levelDiv); - treeContent.insertBefore(quotaDiv, tree); - } -} - -function mailboxMenuNode(type, displayName) { - var newNode = document.createElement("li"); - var icon = MailerUIdTreeExtension.folderIcons[type]; - if (!icon) - icon = "tbtv_leaf_corner_17x17.png"; - var image = document.createElement("img"); - image.src = ResourcesURL + "/" + icon; - newNode.appendChild(image); - var dnOverride = MailerUIdTreeExtension.folderNames[type]; - if (dnOverride) - displayName = dnOverride; - newNode.appendChild(document.createTextNode(" " + displayName)); - - return newNode; -} - -function generateMenuForMailbox(mailbox, prefix, callback) { - var menuDIV = document.createElement("div"); - $(menuDIV).addClassName("menu"); - var menuID = prefix + "Submenu"; - var previousMenuDIV = $(menuID); - if (previousMenuDIV) - previousMenuDIV.parentNode.removeChild(previousMenuDIV); - menuDIV.setAttribute("id", menuID); - var menu = document.createElement("ul"); - menu.style.cssFloat="left"; - menu.style.styleFloat="left"; - menuDIV.appendChild(menu); - pageContent.appendChild(menuDIV); - - var windowHeight = 0; - if ( typeof(window.innerHeight) != "undefined" && window.innerHeight != 0 ) { - windowHeight = window.innerHeight; - } - else { - windowHeight = document.body.clientHeight; - } - var offset = 70; - if ( navigator.appVersion.indexOf("Safari") >= 0 ) { - offset = 140; - } - - var callbacks = new Array(); - if (mailbox.type != "account") { - var newNode = document.createElement("li"); - newNode.mailbox = mailbox; - newNode.appendChild(document.createTextNode(_("This Folder"))); - menu.appendChild(newNode); - menu.appendChild(document.createElement("li")); - callbacks.push(callback); - callbacks.push("-"); - } - - var submenuCount = 0; - var newNode; - for (var i = 0; i < mailbox.children.length; i++) { - if (menu.offsetHeight > windowHeight-offset) { - // Split menu to fit screen - var menuWidth = (parseInt(menu.offsetWidth) + 15) + "px"; - menu.style.width = menuWidth; - menu = document.createElement("ul"); - menu.style.cssFloat="left"; - menu.style.styleFloat="left"; - menuDIV.appendChild(menu); - } - var child = mailbox.children[i]; - newNode = mailboxMenuNode(child.type, child.displayName); - newNode.style.width = "auto"; - menu.appendChild(newNode); - if (child.children.length > 0) { - var newPrefix = prefix + submenuCount; - var newSubmenuId = generateMenuForMailbox(child, newPrefix, callback); - callbacks.push(newSubmenuId); - submenuCount++; - } - else { - newNode.mailbox = child; - callbacks.push(callback); - } - } - menu.style.width = (parseInt(menu.offsetWidth) + 15) + "px"; - - initMenu(menuDIV, callbacks); - - return menuDIV.getAttribute("id"); -} - -function updateMailboxMenus() { - var mailboxActions = { move: onMailboxMenuMove, - copy: onMailboxMenuCopy }; - var accountsMenus = { move: $$('#moveMailboxMenu li'), - copy: $$('#copyMailboxMenu li') }; - - for (var key in mailboxActions) { - for (var i = 0; i < mailAccounts.length; i++) { - var mailbox = accounts[i]; - var id = generateMenuForMailbox(mailbox, key + "-" + i, - mailboxActions[key]); - accountsMenus[key][i].submenu = id; - } - } -} - -function buildMailboxes(accountIdx, encoded) { - var account = new Mailbox("account", "" + accountIdx, - undefined, //necessary, null will cause issues - mailAccounts[accountIdx]); - var data = encoded.evalJSON(true); - var mailboxes = data.mailboxes; - var unseen = (data.status? data.status.unseen : 0); - - for (var i = 0; i < mailboxes.length; i++) { - var currentNode = account; - var names = mailboxes[i].path.split("/"); - var displayNames = mailboxes[i].displayName.split("/"); - - for (var j = 1; j < (names.length - 1); j++) { - var name = names[j]; - var node = currentNode.findMailboxByName(name); - if (!node) { - node = new Mailbox("additional", name, 0, displayNames[j]); - currentNode.addMailbox(node); - } - currentNode = node; - } - var basename = names[names.length-1]; - var leaf = currentNode.findMailboxByName(basename); - if (leaf) - leaf.type = mailboxes[i].type; - else { - if (mailboxes[i].type == 'inbox') - leaf = new Mailbox(mailboxes[i].type, basename, unseen, displayNames[names.length-1]); - else - leaf = new Mailbox(mailboxes[i].type, basename, 0, displayNames[names.length-1]); - currentNode.addMailbox(leaf); - } - } - - return account; -} - -function getFoldersState() { - if (mailAccounts.length > 0) { - var urlstr = ApplicationBaseURL + "/foldersState"; - triggerAjaxRequest(urlstr, getFoldersStateCallback); - } -} - -function getFoldersStateCallback(http) { - if (http.status == 200) { - if (http.responseText.length > 0) { - // The response text is a JSON array - // of the folders that were left opened. - var data = http.responseText.evalJSON(true); - for (var i = 1; i < mailboxTree.aNodes.length; i++) { - if ($(data).indexOf(mailboxTree.aNodes[i].dataname) > 0) - // If the folder is found, open it - mailboxTree.o(i); - } - } - mailboxTree.autoSync(); - } -} - -function saveFoldersState() { - if (mailAccounts.length > 0) { - var foldersState = mailboxTree.getFoldersState(); - var urlstr = ApplicationBaseURL + "/saveFoldersState"; - var parameters = "expandedFolders=" + foldersState; - triggerAjaxRequest(urlstr, saveFoldersStateCallback, null, parameters, - { "Content-type": "application/x-www-form-urlencoded" }); - } -} - -function saveFoldersStateCallback(http) { - if (isHttpStatus204(http.status)) { - log ("folders state saved"); - } -} - -function onMenuCreateFolder(event) { - showPromptDialog(_("New Folder..."), _("Name :"), onMenuCreateFolderConfirm); -} - -function onMenuCreateFolderConfirm(event) { - var name = this.value; - if (name && name.length > 0) { - var folderID = document.menuTarget.getAttribute("dataname"); - var urlstr = URLForFolderID(folderID) + "/createFolder?name=" + encodeURIComponent(name); - var errorLabel = labels["The folder with name \"%{0}\" could not be created."]; - triggerAjaxRequest(urlstr, folderOperationCallback, - errorLabel.formatted(name)); - } - disposeDialog(); -} - -function onMenuRenameFolder(event) { - var folderName = document.menuTarget.down('.nodeName').childNodes[0].nodeValue; - showPromptDialog(_("Rename Folder..."), _("Enter the new name of your folder :"), onMenuRenameFolderConfirm, folderName); -} - -function onMenuRenameFolderConfirm() { - var name = this.value; - if (name && name.length > 0) { - var folderID = document.menuTarget.getAttribute("dataname"); - var urlstr = URLForFolderID(folderID) + "/renameFolder?name=" + encodeURIComponent(name); - var errorLabel = labels["This folder could not be renamed to \"%{0}\"."]; - triggerAjaxRequest(urlstr, folderOperationCallback, - errorLabel.formatted(name)); - } - disposeDialog(); -} - -function onMenuDeleteFolder(event) { - var folderID = document.menuTarget.getAttribute("dataname"); - var urlstr = URLForFolderID(folderID) + "/delete"; - var errorLabel = _("The folder could not be deleted."); - showConfirmDialog(_("Confirmation"), - _("Do you really want to move this folder into the trash ?"), - function(event) { - triggerAjaxRequest(urlstr, folderOperationCallback, errorLabel); - disposeDialog(); - }); -} - -function onMenuMarkFolderRead(event) { - var folderID = document.menuTarget.getAttribute("dataname"); - var urlstr = URLForFolderID(folderID) + "/markRead"; - - // Delete the associated data sources - deleteCachedMailbox(folderID); - - if (folderID == Mailer.currentMailbox) { - // Reset the data source so the message headers are reloaded in the callback function - Mailer.dataTable.dataSource.destroy(); - } - else { - // Reset the unseen count of the mailbox - var node = mailboxTree.getMailboxNode(folderID); - if (node) { - updateUnseenCount(node, 0, false); - } - } - - triggerAjaxRequest(urlstr, folderRefreshCallback, { "mailbox": folderID, "refresh": true }); -} - -function onMenuExpungeFolder(event) { - var folderID = document.menuTarget.getAttribute("dataname"); - var urlstr = URLForFolderID(folderID) + "/expunge"; - triggerAjaxRequest(urlstr, folderRefreshCallback, { "mailbox": folderID, "refresh": false }); -} - -function onMenuEmptyTrash(event) { - var folderID = document.menuTarget.getAttribute("dataname"); - var urlstr = URLForFolderID(folderID) + "/emptyTrash"; - triggerAjaxRequest(urlstr, onMenuEmptyTrashCallback, { "mailbox" : folderID }); - - if (folderID == Mailer.currentMailbox) { - $('messageContent').innerHTML = ''; - } - var msgID = Mailer.currentMessages[folderID]; - if (msgID) { - delete Mailer.currentMessages[folderID]; - deleteCachedMessage(folderID + "/" + msgID); - } -} - -function onMenuEmptyTrashCallback(http) { - if (http.readyState == 4 - && http.status == 200) { - deleteCachedMailboxByType('trash'); - // Reload the folder tree if there was folders in the trash - var reloaded = false; - var nodes = $("mailboxTree").select("DIV[datatype=trash]"); - for (var i = 0; i < nodes.length; i++) { - if (http.callbackData.mailbox == nodes[i].readAttribute('dataname')) { - // Reset the unread message count - updateUnseenCount(nodes[i], 0); - var sibling = nodes[i].next(); - if (sibling && sibling.hasClassName("clip")) { - initMailboxTree(); - reloaded = true; - break; - } - } - } - if (!reloaded) { - var data = http.responseText.evalJSON(true); - // We currently only show the quota for the first account (0). - if (data.quotas && http.callbackData.mailbox.startsWith('/0/')) - updateQuotas(data.quotas); - } - } - else - showAlertDialog(_("The trash could not be emptied.")); -} - -function _onMenuChangeToXXXFolder(event, folder) { - var type = document.menuTarget.getAttribute("datatype"); - if (type == "additional") - showAlertDialog(_("You need to choose a non-virtual folder!")); - else { - var folderID = document.menuTarget.getAttribute("dataname"); - var urlstr = URLForFolderID(folderID) + "/setAs" + folder + "Folder"; - var errorLabel = _("The folder functionality could not be changed."); - triggerAjaxRequest(urlstr, folderOperationCallback, errorLabel); - } -} - -function onMenuChangeToDraftsFolder(event) { - return _onMenuChangeToXXXFolder(event, "Drafts"); -} - -function onMenuChangeToSentFolder(event) { - return _onMenuChangeToXXXFolder(event, "Sent"); -} - -function onMenuChangeToTrashFolder(event) { - return _onMenuChangeToXXXFolder(event, "Trash"); -} - -function onMenuToggleMessageRead(event) { - mailListToggleMessagesRead(); -} - -function onMenuLabelNone() { - var msgUIDs = []; - var url = ApplicationBaseURL + encodeURI(Mailer.currentMailbox); - - if (!Object.isArray(document.menuTarget)) { - if (document.menuTarget.tagName == "DIV") - // Menu called from message content view - msgUIDs.push(Mailer.currentMessages[Mailer.currentMailbox]); - - else - // Menu called from one selection in message list view - msgUIDs.push(document.menuTarget.getAttribute("id").substr(4)); - } - else { - // Menu called from multiple selection in messages list view - var rows = $(document.menuTarget); - for (var i = 0; i < rows.length; i++) { - var row = $(rows[i]); - if (row) { - msgUIDs.push(rows[i].substr(4)); - } - } - } - - var callbackData = { mailbox: Mailer.currentMailbox, msgUIDs: msgUIDs }; - var content = { mailbox: Mailer.currentMailbox, msgUIDs: msgUIDs }; - content = Object.toJSON(content); - triggerAjaxRequest(url + "/removeAllLabels", messageFlagCallback, callbackData, content); -} - -function onMenuLabelFlag() { - var flag = this.readAttribute("data-name"); - var url = ApplicationBaseURL + encodeURI(Mailer.currentMailbox); - var operation = "add"; - var msgUIDs = []; - var msgLabels; - - if (!Object.isArray(document.menuTarget)) { - msgUIDs.push(Mailer.currentMessages[Mailer.currentMailbox]); - if (document.menuTarget.tagName == "DIV") - // Menu called from message content view - msgLabels = $('row_' + msgUIDs[0]).getAttribute("labels"); - else - // Menu called from one selection in messages list view - msgLabels = document.menuTarget.getAttribute("labels"); - - var flags = msgLabels.split(" "); - if (flags.indexOf(flag) > -1) - operation = "remove"; - } - else { - // Menu called from multiple selection in messages list view - var rows = $(document.menuTarget); - var blockedOperation = false; - for (var i = 0; i < rows.length; i++) { - var row = $(rows[i]); - if (row) { - msgUIDs.push(rows[i].substr(4)); - msgLabels = row.getAttribute("labels"); - - var flags = msgLabels.split(" "); - if (flags.indexOf(flag) > -1 && !blockedOperation) { - operation = "remove"; - } - else { - blockedOperation = true; - operation = "add"; - } - } - } - } - - var callbackData = { mailbox: Mailer.currentMailbox, operation: operation, flag: flag, msgUIDs: msgUIDs}; - var content = {flags: flag.asCSSIdentifier(), msgUIDs: msgUIDs, operation: operation}; - content = Object.toJSON(content); - triggerAjaxRequest(url + "/addOrRemoveLabel", messageFlagCallback, callbackData, content); -} - -function messageFlagCallback(http) { - if (http.readyState == 4 - && isHttpStatus204(http.status)) { - var data = http.callbackData; - if (data["mailbox"] == Mailer.currentMailbox) { - var msgUIDs = data["msgUIDs"]; - for (var i = 0; i < msgUIDs.length; i++) { - Mailer.dataTable.invalidate(msgUIDs[i]); - var row = $("row_" + msgUIDs[i]); - var operation = data["operation"]; - if (operation) { - var labels = row.getAttribute("labels"); - var flags = []; - if (labels.length > 0) - flags = labels.split(" "); - if (operation == "add") { - if (flags.indexOf(data["flag"]) == -1) - flags.push(data["flag"]); - } - else { - // Remove flag - var flag = data["flag"]; - var idx = flags.indexOf(flag); - flags.splice(idx, 1); - } - row.writeAttribute("labels", flags.join(" ")); - } - else - row.writeAttribute("labels", ""); - } - } - } -} - -function onMenuToggleMessageFlag(event) { - mailListToggleMessagesFlagged(); -} - -function refreshUserSettingsCallback(http) { - var allUserSettings = http.response.evalJSON(); - if (UserSettings.Mail) { - UserSettings.Mail = allUserSettings.Mail; - cachedThreadsCollapsed = UserSettings.Mail.threadsCollapsed; - } - refreshMailbox(); -} - -function folderOperationCallback(http) { - if (http.readyState == 4 && isHttpStatus204(http.status)) { - initMailboxTree(); - triggerAjaxRequest(UserFolderURL + "/preferences/jsonSettings", refreshUserSettingsCallback); - } - else - showAlertDialog(http.callbackData); -} - -function folderRefreshCallback(http) { - if (http.readyState == 4 - && (http.status == 200 || isHttpStatus204(http.status))) { - var oldMailbox = http.callbackData.mailbox; - if (http.callbackData.refresh - && oldMailbox == Mailer.currentMailbox) { - getUnseenCountForFolder(oldMailbox); - if (http.callbackData.id) { - var s = http.callbackData.id + ""; - var uids = s.split(","); - for (var i = 0; i < uids.length; i++) - Mailer.dataTable.remove(uids[i]); - Mailer.dataTable.refresh(); - } - else - refreshCurrentFolder(); - } - if (http.status == 200) { - var data = http.responseText.evalJSON(true); - if (data.quotas && http.callbackData.mailbox.startsWith('/0/')) - updateQuotas(data.quotas); - } - } - else { - if (http.callbackData.id) { - // Display hidden rows from move operation - var s = http.callbackData.id + ""; - var uids = s.split(","); - log ("folderRefreshCallback failed for UIDs " + s); - for (var i = 0; i < uids.length; i++) { - var row = $("row_" + uids[i]); - if (row) - row.show(); - } - } - var msg = /

(.*)<\/p>/m.exec(http.responseText); - showAlertDialog(_("Operation failed") + ": " + msg[1]); - } -} - -function onMessageListMenuPrepareVisibility() { - /* This method attaches the right mailbox-menu to the generic message list - menu. */ - var indexes = { "messageListMenu": 7, - "messagesListMenu": 2, - "messageContentMenu": 4 }; - if (document.menuTarget) { - var mbx = Mailer.currentMailbox; - if (mbx) { - var lis = this.getElementsByTagName("li"); - var idx = indexes[this.id]; - var parts = mbx.split("/"); - var acctNbr = parseInt(parts[1]); - lis[idx].submenu = "move-" + acctNbr + "Submenu"; - lis[idx+1].submenu = "copy-" + acctNbr + "Submenu"; - } - } - - return true; -} - -function onAccountIconMenuPrepareVisibility() { - /* This methods disables or enables the "Delegation..." menu option on - mail accounts. */ - if (document.menuTarget) { - var mbx = document.menuTarget.getAttribute("dataname"); - if (mbx) { - var lis = this.getElementsByTagName("li"); - var li = lis[lis.length - 1]; - var parts = mbx.split("/"); - var acctNbr = parseInt(parts[1]); - if (acctNbr > 0) { - li.addClassName("disabled"); - } - else { - li.removeClassName("disabled"); - } - } - } - - return true; -} - -function onFolderMenuPrepareVisibility() { - /* This methods disables or enables the "Sharing" menu option on - mailboxes. */ - if (document.menuTarget) { - var mbx = document.menuTarget.getAttribute("dataname"); - if (mbx) { - var lis = this.getElementsByTagName("li"); - var li = lis[lis.length - 1]; - var parts = mbx.split("/"); - var acctNbr = parseInt(parts[1]); - if (acctNbr > 0) { - li.addClassName("disabled"); - } - else { - li.removeClassName("disabled"); - } - } - } - - return true; -} - -function onLabelMenuPrepareVisibility() { - var messageList = $("messageListBody"); - var flags = {}; - - if (messageList) { - var rows = messageList.getSelectedRows(); - for (var i = 0; i < rows.length; i++) { - $w(rows[i].getAttribute("labels")).each(function(flag) { - flags[flag] = true; - }); - } - } - - var lis = this.childNodesWithTag("ul")[0].childNodesWithTag("li"); - var isFlagged = false; - - // lis is our array of labels, ex: - // li - // li.seperator - // li.label1 - // li.broccoli - // ... - for (var i = 2; i < lis.length; i++) { - - // We bind the event handlers if we need to - if (lis[i].menuCallback == null) { - lis[i].menuCallback = onMenuLabelFlag; - lis[i].on("mousedown", onMenuClickHandler); - lis[i].removeClassName("disabled"); - } - - var flag = lis[i].readAttribute("data-name"); - - if (flags[flag]) { - isFlagged = true; - lis[i].addClassName("_chosen"); - } - else { - lis[i].removeClassName("_chosen"); - } - } - - if (isFlagged) - lis[0].removeClassName("_chosen"); - else - lis[0].addClassName("_chosen"); -} - -function onMarkMenuPrepareVisibility() { - var messageList = $("messageListBody"); - if (messageList) { - var nodes = messageList.down("TBODY").getSelectedNodesId(); - - var isRead = false; - var isFlagged = false; - - if (nodes.length > 0) { - var row = null; - for (var i = 0; row == null && i < nodes.length; i++) - row = $(nodes[i]); - var img = row.down('img'); - isFlagged = img.hasClassName ("messageIsFlagged"); - isRead = !row.hasClassName("mailer_unreadmail"); - } - - var menuUL = this.down(); - var menuLIS = menuUL.childElements(); - - if (isRead) { - menuLIS[0].addClassName("_chosen"); - } - else { - menuLIS[0].removeClassName("_chosen"); - } - if (isFlagged) { - menuLIS[5].addClassName("_chosen"); - } - else { - menuLIS[5].removeClassName("_chosen"); - } - } -} - -function saveAs(event) { - var messageList = $("messageListBody").down("TBODY"); - - var uids = messageList.getSelectedNodesId(); - if (uids.length > 0) { - for (var i = 0; i < uids.length; i++) - uids[i] = uids[i].substr(4); - var url = ApplicationBaseURL + encodeURI(Mailer.currentMailbox) + "/saveMessages"; - window.location.href = url + "?uid=" + uids.join(","); - } - else - showAlertDialog(_("Please select a message.")); - - return false; -} - -function onMenuArchiveFolder(event) { - var folderID = document.menuTarget.getAttribute("dataname"); - var url = URLForFolderID(folderID) + "/exportFolder"; - window.location.href = url; -} - -function onMenuAccountDelegation(event) { - var folderID = document.menuTarget.getAttribute("dataname"); - var urlstr = ApplicationBaseURL + folderID + "/delegation"; - openAclWindow(urlstr); -} - -function getMenus() { - var menus = { - accountIconMenu: [ null, null, onMenuCreateFolder, null, null, onMenuAccountDelegation ], - inboxIconMenu: [ null, null, null, "-", onMenuMarkFolderRead, - onMenuCreateFolder, onMenuExpungeFolder, - onMenuArchiveFolder, "-", null, - onMenuSharing ], - trashIconMenu: [ null, null, null, "-", onMenuMarkFolderRead, - onMenuCreateFolder, onMenuExpungeFolder, - onMenuArchiveFolder, onMenuEmptyTrash, - "-", null, - onMenuSharing ], - mailboxIconMenu: [ null, null, null, "-", onMenuMarkFolderRead, - onMenuCreateFolder, onMenuRenameFolder, - onMenuExpungeFolder, onMenuArchiveFolder, - onMenuDeleteFolder, "folderTypeMenu", - "-", null, - onMenuSharing ], - addressMenu: [ newContactFromEmail, newEmailTo ], - messageListMenu: [ onMenuOpenMessage, "-", - onMenuReplyToSender, - onMenuReplyToAll, - onMenuForwardMessage, null, - "-", "moveMailboxMenu", - "copyMailboxMenu", "label-menu", - "mark-menu", "-", saveAs, - onMenuViewMessageSource, null, - null, onMenuDeleteMessage ], - messagesListMenu: [ onMenuForwardMessage, - "-", "moveMailboxMenu", - "copyMailboxMenu", "label-menu", - "mark-menu", "-", - saveAs, null, null, - onMenuDeleteMessage ], - imageMenu: [ saveImage ], - messageContentMenu: [ onMenuReplyToSender, - onMenuReplyToAll, - onMenuForwardMessage, - null, "moveMailboxMenu", - "copyMailboxMenu", - "-", "label-menu", "mark-menu", - "-", - saveAs, onMenuViewMessageSource, - null, onPrintCurrentMessage, - onMenuDeleteMessage ], - folderTypeMenu: [ onMenuChangeToSentFolder, - onMenuChangeToDraftsFolder, - onMenuChangeToTrashFolder ], - - "label-menu": [ onMenuLabelNone, "-" ], - - "mark-menu": [ onMenuToggleMessageRead, null, null, null, "-", onMenuToggleMessageFlag ], - - searchMenu: [ setSearchCriteria, setSearchCriteria, - setSearchCriteria, setSearchCriteria, - setSearchCriteria ] - }; - - - if (typeof mailAccounts != 'undefined') { - menus['moveMailboxMenu'] = mailAccounts.collect(function (account) { return account.asCSSIdentifier() }); - menus['copyMailboxMenu'] = mailAccounts.collect(function (account) { return account.asCSSIdentifier() }); - } - - var labelMenu = $("label-menu"); - if (labelMenu) { - labelMenu.prepareVisibility = onLabelMenuPrepareVisibility; - } - - var markMenu = $("mark-menu"); - if (markMenu) { - markMenu.prepareVisibility = onMarkMenuPrepareVisibility; - } - - var accountIconMenu = $("accountIconMenu"); - if (accountIconMenu) { - accountIconMenu.prepareVisibility = onAccountIconMenuPrepareVisibility; - } - - var folderMenus = [ "inboxIconMenu", "trashIconMenu", "mailboxIconMenu" ]; - for (var i = 0; i < folderMenus.length; i++) { - var menu = $(folderMenus[i]); - if (menu) { - menu.prepareVisibility = onFolderMenuPrepareVisibility; - } - } - - return menus; -} - -document.observe("dom:loaded", initMailer); - -function Mailbox(type, name, unseen, displayName) { - this.type = type; - if (displayName) - this.displayName = displayName; - else - this.displayName = name; - // log("name: " + name + "; dn: " + displayName); - this.name = name; - this.unseen = unseen; - this.parentFolder = null; - this.children = new Array(); - return this; -} - -Mailbox.prototype = { - dump: function(indent) { - if (!indent) - indent = 0; - log(" ".repeat(indent) + this.name); - for (var i = 0; i < this.children.length; i++) { - this.children[i].dump(indent + 2); - } - }, - fullName: function() { - var fullName = ""; - - var currentFolder = this; - while (currentFolder.parentFolder) { - fullName = ("/folder" + currentFolder.name).asCSSIdentifier() + fullName; - currentFolder = currentFolder.parentFolder; - } - - return "/" + currentFolder.name + fullName; - }, - findMailboxByName: function(name) { - var mailbox = null; - - var i = 0; - while (!mailbox && i < this.children.length) - if (this.children[i].name == name - || this.children[i].displayName == name) - mailbox = this.children[i]; - else - i++; - - return mailbox; - }, - addMailbox: function(mailbox) { - mailbox.parentFolder = this; - this.children.push(mailbox); - } -}; - -function configureDraggables() { - var table = jQuery("#messageListBody"); - table.draggable({ - addClasses: false, - helper: function (event) { return '

'; }, - start: startDragging, - drag: whileDragging, - stop: stopDragging, - appendTo: 'body', - cursorAt: { top: 15, right: 15 }, - scroll: false, - distance: 4, - zIndex: 20 - }); -} - -function configureDroppables() { - jQuery('#mailboxTree .dTreeNode[datatype!="account"][datatype!="additional"] .node .nodeName').droppable({ - hoverClass: 'genericHoverClass', - drop: dropAction }); -} - -function startDragging(event, ui) { - var handle = ui.helper; - var count = $('messageListBody').getSelectedRowsId().length; - - if (count == 0) { - jQuery(this).trigger("stop"); - return false; - } - handle.html(count); - - if (event.shiftKey) { - handle.addClass("copy"); - } - handle.show(); -} - -function whileDragging(event, ui) { - if (event) { - var handle = ui.helper; - if (event.shiftKey) - handle.addClass("copy"); - else if (handle.hasClass("copy")) - handle.removeClass("copy"); - } -} - -function stopDragging(event, ui) { - var handle = ui.helper; - handle.hide(); - if (handle.hasClass("copy")) - handle.removeClass("copy"); - for (var i = 0; i < accounts.length; i++) { - handle.removeClass("account" + i); - } -} - -function dropAction(event, ui) { - var destination = $(this).up("div.dTreeNode"); - var f; - if (ui.helper.hasClass("copy")) { - // Message(s) copied - f = onMailboxMenuCopy.bind(destination); - } - else { - // Message(s) moved - f = onMailboxMenuMove.bind(destination); - } - f(); -} diff --git a/UI/WebServerResources/MailerUIdTree.js b/UI/WebServerResources/MailerUIdTree.js deleted file mode 100644 index d37149a64..000000000 --- a/UI/WebServerResources/MailerUIdTree.js +++ /dev/null @@ -1,71 +0,0 @@ -var MailerUIdTreeExtension = { - elementCounter: 1, - folderIcons: { account: "tbtv_account_17x17.png", - inbox: "tbtv_inbox_17x17.png", - sent: "tbtv_sent_17x17.png", - draft: "tbtv_drafts_17x17.png", - trash: "tbtv_trash_17x17.png" }, - folderNames: { inbox: _("InboxFolderName"), - sent: _("SentFolderName"), - draft: _("DraftsFolderName"), - trash: _("TrashFolderName") }, - _addFolderNode: function (parent, name, fullName, type, unseen) { - var icon = this.folderIcons[type]; - if (icon) - icon = ResourcesURL + "/" + icon; - else - icon = ""; - var displayName = this.folderNames[type]; - if (!displayName) - displayName = name; - displayName += " (" + parseInt(unseen) + ")"; - this.add(this.elementCounter, parent, displayName, 1, '#', fullName, - type, '', '', icon, icon, true); - this.elementCounter++; - }, - _addFolder: function (parent, folder) { - var thisCounter = this.elementCounter; - this._addFolderNode(parent, folder.displayName, folder.fullName(), folder.type, folder.unseen); - for (var i = 0; i < folder.children.length; i++) - this._addFolder(thisCounter, folder.children[i]); - }, - addMailAccount: function (mailAccount) { - this._addFolder(0, mailAccount); - }, - setCookie: function(cookieName, cookieValue, expires, path, domain, secure) { - - }, - getCookie: function(cookieName) { - return (""); - }, - updateCookie: function () { - if (Mailer.foldersStateTimer) - clearTimeout(Mailer.foldersStateTimer); - Mailer.foldersStateTimer = setTimeout('saveFoldersState()', 3000); // 3 seconds - }, - getFoldersState: function () { - var expandedFolders = new Array(); - for (var n = 0; n < this.aNodes.length; n++) { - if (this.aNodes[n]._io && this.aNodes[n].pid != this.root.id) { - expandedFolders.push(this.aNodes[n].dataname); - } - } - return Object.toJSON(expandedFolders); - }, - autoSync: function() { - this.config.useCookies = true; - }, - getMailboxNode: function(mailbox) { - var childNode = null; - for (var i = 0; (childNode == null) && (i < this.aNodes.length); i++) { - var aNode = this.aNodes[i]; - if (aNode.dataname == mailbox) { - childNode = $("smailboxTree" + aNode.id); - } - } - - return ((childNode) ? childNode.parentNode : null); - } -}; - -Object.extend(dTree.prototype, MailerUIdTreeExtension); diff --git a/UI/WebServerResources/PasswordPolicy.js b/UI/WebServerResources/PasswordPolicy.js deleted file mode 100644 index 440a4bf7c..000000000 --- a/UI/WebServerResources/PasswordPolicy.js +++ /dev/null @@ -1,98 +0,0 @@ -var PolicyPasswordChangeUnsupported = -3; -var PolicyPasswordSystemUnknown = -2; -var PolicyPasswordUnknown = -1; -var PolicyPasswordExpired = 0; -var PolicyAccountLocked = 1; -var PolicyChangeAfterReset = 2; -var PolicyPasswordModNotAllowed = 3; -var PolicyMustSupplyOldPassword = 4; -var PolicyInsufficientPasswordQuality = 5; -var PolicyPasswordTooShort = 6; -var PolicyPasswordTooYoung = 7; -var PolicyPasswordInHistory = 8; -var PolicyNoError = 65535; - -function _passwordPolicyAjaxCallback(http) { - if (http.readyState == 4) { - var policy = http.callbackData; - policy.callback(http); - } -} - -function PasswordPolicy(userName, password) { - this.userName = userName; - this.password = password; -} - -PasswordPolicy.prototype = { - userName: null, - password: null, - successCallback: null, - failureCallback: null, - - setCallbacks: function(successCallback, failureCallback) { - this.successCallback = successCallback; - this.failureCallback = failureCallback; - }, - - changePassword: function (newPassword) { - var content = Object.toJSON({ userName: this.userName, - password: this.password, - newPassword: newPassword }); - var urlParts = ApplicationBaseURL.split("/"); - var url = "/" + urlParts[1] + "/so/changePassword"; - triggerAjaxRequest(url, _passwordPolicyAjaxCallback, this, - content, {"content-type": "application/json"} ); - }, - - callback: function(http) { - if (isHttpStatus204(http.status)) { - if (this.successCallback) - this.successCallback(_("The password was changed successfully.")); - } else { - if (this.failureCallback) { - var perr = PolicyPasswordUnknown; - var error = ""; - switch (http.status) { - case 403: - if (http.getResponseHeader("content-type") - == "application/json") { - var jsonResponse = http.responseText.evalJSON(false); - perr = jsonResponse["LDAPPasswordPolicyError"]; - - // Normal password change failed - if (perr == PolicyNoError) { - error = _("Password change failed"); - } else if (perr == PolicyPasswordModNotAllowed) { - error = _("Password change failed - Permission denied"); - } else if (perr == PolicyInsufficientPasswordQuality) { - error = _("Password change failed - Insufficient password quality"); - } else if (perr == PolicyPasswordTooShort) { - error = _("Password change failed - Password is too short"); - } else if (perr == PolicyPasswordTooYoung) { - error = _("Password change failed - Password is too young"); - } else if (perr == PolicyPasswordInHistory) { - error = _("Password change failed - Password is in history"); - } else { - error = _("Unhandled policy error: %{0}").formatted(perr); - perr = PolicyPasswordUnknown; - } - } else { - perr = PolicyPasswordSystemUnknown; - error = _("Unhandled error response"); - } - break; - case 404: - perr = PolicyPasswordChangeUnsupported; - error = _("Password change is not supported."); - break; - default: - perr = PolicyPasswordSystemUnknown; - error = _("Unhandled HTTP error code: %{0}").formatted(http.status); - } - this.failureCallback(perr, error); - // showPasswordMessage(error); - } - } - } -}; diff --git a/UI/WebServerResources/RowEditionController.js b/UI/WebServerResources/RowEditionController.js deleted file mode 100644 index 04524141d..000000000 --- a/UI/WebServerResources/RowEditionController.js +++ /dev/null @@ -1,130 +0,0 @@ -/* bind method: attachToRowElement(row: TD or LI) - * callback methods: - notifyStartEditingCallback(this) - notifyEndEditingCallback(this) - notifyNewValueCallback(this, newValue), - */ - -function RowEditionController() { -} - -RowEditionController.prototype = { - initialValue: null, - rowElement: null, - textField: null, - - /* notification callbacks */ - notifyStartEditingCallback: null, - notifyEndEditingCallback: null, - notifyNewValueCallback: null, - - /* bind method */ - attachToRowElement: function REC_attachToRowElement(rowElement) { - var onRowDblClickBound = this.onRowDblClick.bindAsEventListener(this); - rowElement.observe("dblclick", onRowDblClickBound); - this.rowElement = rowElement; - rowElement.editionController = this; - }, - - /* internal */ - emptyRow: function REC_emptyRow() { - var rowElement = this.rowElement; - while (rowElement.firstChild) { - rowElement.removeChild(rowElement.firstChild); - } - }, - - startEditing: function REC_startEditing() { - var rowElement = this.rowElement; - rowElement.addClassName("editing"); - - var value = ""; - for (var i = 0; i < rowElement.childNodes.length; i++) { - var child = rowElement.childNodes[i]; - if (child.nodeType == Node.TEXT_NODE) { - value += child.nodeValue; - } - } - this.initialValue = value; - this.emptyRow(); - - this.showInputField(value); - - this.onBodyMouseDownBound = this.onBodyMouseDown.bindAsEventListener(this); - $(document.body).observe("mousedown", this.onBodyMouseDownBound); - - if (this.notifyStartEditingCallback) { - this.notifyStartEditingCallback(this); - } - }, - showInputField: function REC_showInputField(value) { - var textField = createElement("input", null, null, {"type": "text"}); - this.textField = textField; - if (value) { - textField.value = value; - } - this.rowElement.appendChild(textField); - var onInputKeyDownBound = this.onInputKeyDown.bindAsEventListener(this); - textField.observe("keydown", onInputKeyDownBound); - textField.focus(); - textField.select(); - }, - - stopEditing: function REC_stopEditing(accept) { - var displayValue = (accept ? this.textField.value : this.initialValue); - this.textField = null; - this.emptyRow(); - var rowElement = this.rowElement; - rowElement.removeClassName("editing"); - rowElement.appendChild(document.createTextNode(displayValue)); - this.initialValue = null; - - $(document.body).stopObserving("mousedown", this.onBodyMouseDownBound); - this.onBodyMouseDownBound = null; - - if (this.notifyEndEditingCallback) { - this.notifyEndEditingCallback(this); - } - }, - - acceptEdition: function REC_acceptEdition() { - var newValue = this.textField.value; - var isValid = (newValue && newValue.length > 0); - if (this.initialValue != newValue - && isValid - && this.notifyNewValueCallback) { - this.notifyNewValueCallback(this, newValue); - } - this.stopEditing(isValid); - }, - cancelEdition: function REC_acceptEdition() { - this.stopEditing(false); - }, - - /* event handlers */ - onRowDblClick: function REC_onRowDblClick(event) { - if (!this.textField) { - this.startEditing(); - event.stop(); - } - }, - - onInputKeyDown: function REC_onInputKeyDown(event) { - if (event.keyCode == Event.KEY_ESC) { - this.cancelEdition(); - event.stop(); - } - else if (event.keyCode == Event.KEY_RETURN) { - this.acceptEdition(); - event.stop(); - } - else if (event.keyCode == Event.KEY_TAB) { - this.acceptEdition(); - } - }, - onBodyMouseDown: function REC_onBodyMouseDown(event) { - if (event.target != this.textField) { - this.acceptEdition(); - } - } -}; diff --git a/UI/WebServerResources/SOGoAutoCompletion.js b/UI/WebServerResources/SOGoAutoCompletion.js deleted file mode 100644 index 0434f2175..000000000 --- a/UI/WebServerResources/SOGoAutoCompletion.js +++ /dev/null @@ -1,385 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -// NOTE: The popup menu with id "contactsMenu" must exist before -// using this interface. -// -// This interface fires two events: -// - autocompletion:changed : fired when a new contact is selected -// - autocompletion:changedlist : fired when a new list is selected -// -var SOGoAutoCompletionInterface = { - - // Attributes that could be changed from the object - // inheriting the inteface -uidField: "c_name", -addressBook: null, -SOGoUsersSearch: false, -excludeGroups: false, -excludeLists: false, - - // Internal attributes -animationParent: null, -selectedIndex: -1, -delay: 0.750, -delayedSearch: false, -menu: null, - -bind: function () { - this.menu = $('contactsMenu'); - this.writeAttribute("autocomplete", "off"); - this.writeAttribute("container", null); - this.confirmedValue = null; - this.observe("keydown", this.onKeydown.bindAsEventListener(this)); - this.observe("blur", this.onBlur.bindAsEventListener(this)); -}, - -onKeydown: function (event) { - if (event.ctrlKey || event.metaKey) { - this.focussed = true; - return; - } - if (event.keyCode == Event.KEY_TAB) { - if (this.confirmedValue) - this.value = this.confirmedValue; - else - this.writeAttribute("uid", null); - if (document.currentPopupMenu) - hideMenu(document.currentPopupMenu); - } - else if (event.keyCode == 0 - || event.keyCode == Event.KEY_BACKSPACE - || event.keyCode == Event.KEY_DELETE - || event.keyCode == 32 // Space - || event.keyCode > 47) { - this.confirmedValue = null; - this.selectedIndex = -1; - if (this.delayedSearch) - window.clearTimeout(this.delayedSearch); - this.delayedSearch = this.performSearch.delay(this.delay, this); - } - else if (event.keyCode == Event.KEY_RETURN) { - preventDefault(event); - if (this.confirmedValue) - this.value = this.confirmedValue; - else - this.writeAttribute("uid", null); - if (document.currentPopupMenu) - hideMenu(document.currentPopupMenu); - this.selectedIndex = -1; - if (this.readAttribute("container")) { - this.confirmedValue = null; - this.fire("autocompletion:changedlist", this.readAttribute("container")); - } - else - this.fire("autocompletion:changed", event.keyCode); - } - else if (this.menu.getStyle('visibility') == 'visible') { - if (event.keyCode == Event.KEY_UP) { // Up arrow - if (this.selectedIndex > 0) { - var contacts = this.menu.select("li"); - contacts[this.selectedIndex--].removeClassName("selected"); - this.value = contacts[this.selectedIndex].readAttribute("address"); - this.confirmedValue = this.value; - this.writeAttribute("uid", contacts[this.selectedIndex].readAttribute("uid")); - contacts[this.selectedIndex].addClassName("selected"); - var container = contacts[this.selectedIndex].readAttribute("container"); - if (container) - this.writeAttribute("container", container); - } - } - else if (event.keyCode == Event.KEY_DOWN) { // Down arrow - var contacts = this.menu.select("li"); - if (contacts.size() - 1 > this.selectedIndex) { - if (this.selectedIndex >= 0) - contacts[this.selectedIndex].removeClassName("selected"); - this.selectedIndex++; - this.value = contacts[this.selectedIndex].readAttribute("address"); - this.confirmedValue = this.value; - this.writeAttribute("uid", contacts[this.selectedIndex].readAttribute("uid")); - contacts[this.selectedIndex].addClassName("selected"); - var container = contacts[this.selectedIndex].readAttribute("container"); - if (container) - this.writeAttribute("container", container); - } - } - } -}, - -onBlur: function (event) { - if (this.delayedSearch) - window.clearTimeout(this.delayedSearch); - if (this.confirmedValue) { - this.value = this.confirmedValue; - if (this.readAttribute("container")) - this.fire("autocompletion:changedlist", this.readAttribute("container")); - else - this.fire("autocompletion:changed", event.keyCode); - } - else - this.writeAttribute("uid", null); -}, - -performSearch: function (input) { - // Perform address completion - if (document.contactLookupAjaxRequest) { - // Abort any pending request - document.contactLookupAjaxRequest.aborted = true; - document.contactLookupAjaxRequest.abort(); - } - if (input.value.trim().length > minimumSearchLength) { - if (input.SOGoUsersSearch) { - var urlstr = UserFolderURL + "usersSearch?search=" + encodeURIComponent(input.value); - document.contactLookupAjaxRequest = - triggerAjaxRequest(urlstr, input.performUsersSearchCallback.bind(input), input); - } - else { - var urlstr = UserFolderURL + "Contacts/"; - if (input.addressBook) - urlstr += input.addressBook + "/contact"; - else - urlstr += "allContact"; - urlstr += "Search?search=" + encodeURIComponent(input.value); - if (input.excludeGroups) - urlstr += "&excludeGroups=1"; - if (input.excludeLists) - urlstr += "&excludeLists=1"; - if (input.animationParent) - startAnimation(input.animationParent); - document.contactLookupAjaxRequest = - triggerAjaxRequest(urlstr, input.performSearchCallback.bind(input), input); - } - } - else { - if (document.currentPopupMenu) - hideMenu(document.currentPopupMenu); - } -}, - -performSearchCallback: function (http) { - if (http.readyState == 4) { - var list = this.menu.down("ul"); - - var input = http.callbackData; - - if (http.status == 200) { - var start = input.value.length; - var data = http.responseText.evalJSON(true); - - if (data.contacts.length > 1) { - list.select("li").each(function(item) { - item.stopObserving("mousedown"); - item.remove(); - }); - - // Populate popup menu - for (var i = 0; i < data.contacts.length; i++) { - var contact = data.contacts[i]; - var completeEmail = contact["c_cn"]; - var uid = "" + contact[this.uidField]; - var c_name = "" + contact['c_name']; - if (contact["c_mail"]) - completeEmail += " <" + contact["c_mail"] + ">"; - var node = new Element('li', { 'address': completeEmail, - 'uid': uid }); - var matchPosition = completeEmail.toLowerCase().indexOf(data.searchText.toLowerCase()); - if (matchPosition > -1) { - var matchBefore = completeEmail.substring(0, matchPosition); - var matchText = completeEmail.substring(matchPosition, matchPosition + data.searchText.length); - var matchAfter = completeEmail.substring(matchPosition + data.searchText.length); - node.appendChild(document.createTextNode(matchBefore)); - node.appendChild(new Element('strong').update(matchText)); - node.appendChild(document.createTextNode(matchAfter)); - } - else { - node.appendChild(document.createTextNode(completeEmail)); - } - list.appendChild(node); - if (c_name.endsWith(".vlf")) { - // Keep track of list containers - node.writeAttribute("container", contact['container']); - } - if (contact["contactInfo"]) - node.appendChild(document.createTextNode(" (" + contact["contactInfo"] + ")")); - $(node).observe("mousedown", this.onAddressResultClick.bindAsEventListener(this)); - } - - // Show popup menu - var offsetScroll = Element.cumulativeScrollOffset(input); - var offset = Element.positionedOffset(input); - if ($(document.body).hasClassName("popup") && typeof initPopupMailer == 'undefined') - // Hack for some situations where the offset must be computed differently - offset = Element.cumulativeOffset(input); - var top = offset.top - offsetScroll.top + node.offsetHeight + 3; - var height = 'auto'; - var heightDiff = window.height() - offset[1]; - var nodeHeight = node.getHeight(); - - if ((data.contacts.length * nodeHeight) > heightDiff) - // Limit the size of the popup to the window height, minus 12 pixels - height = parseInt(heightDiff/nodeHeight) * nodeHeight - 12 + 'px'; - - this.menu.setStyle({ top: top + "px", - left: offset[0] + "px", - height: height, - maxWidth: (window.width() - offset[0] - 12) + "px", - visibility: "visible" }); - this.menu.scrollTop = 0; - - document.currentPopupMenu = this.menu; - $(document.body).stopObserving("click"); - $(document.body).observe("click", onBodyClickMenuHandler); - } - else { - if (document.currentPopupMenu) - hideMenu(document.currentPopupMenu); - - if (data.contacts.length == 1) { - // Single result - var contact = data.contacts[0]; - var uid = "" + contact[this.uidField]; - var c_name = "" + contact['c_name']; - input.writeAttribute("uid", uid); - if (c_name.endsWith(".vlf")) { - this.writeAttribute("container", contact['container']); - } - var completeEmail = contact["c_cn"]; - if (contact["c_mail"]) - completeEmail += " <" + contact["c_mail"] + ">"; - if (contact["c_cn"].substring(0, input.value.length).toUpperCase() - == input.value.toUpperCase()) - input.value = completeEmail; - else - // The result matches email address, not user name - input.value += ' >> ' + completeEmail; - input.confirmedValue = completeEmail; - - var end = input.value.length; - $(input).selectText(start, end); - - this.selectedIndex = -1; - } - } - } - else - if (document.currentPopupMenu) - hideMenu(document.currentPopupMenu); - document.contactLookupAjaxRequest = null; - } -}, - -performUsersSearchCallback: function (http) { - if (http.readyState == 4) { - var list = this.menu.down("ul"); - var input = http.callbackData; - if (http.status == 200) { - var response = http.responseText.evalJSON(); - - if (response.length > 1) { - list.select("li").each(function(item) { - item.stopObserving("mousedown"); - item.remove(); - }); - - // Populate popup menu - for (var i = 0; i < response.length; i++) { - var c_name = response[i][1]; - var completeEmail = c_name; - var c_mail = response[i][2]; - var uid = response[i][3]; - if (c_mail) - completeEmail += " <" + c_mail + ">"; - var node = new Element('li', { 'address': completeEmail, - 'uid': uid }); - var matchPosition = completeEmail.toLowerCase().indexOf(input.getValue().toLowerCase()); - if (matchPosition > -1) { - var matchBefore = completeEmail.substring(0, matchPosition); - var matchText = completeEmail.substring(matchPosition, matchPosition + input.getValue().length); - var matchAfter = completeEmail.substring(matchPosition + input.getValue().length); - node.appendChild(document.createTextNode(matchBefore)); - node.appendChild(new Element('strong').update(matchText)); - node.appendChild(document.createTextNode(matchAfter)); - } - else { - node.appendChild(document.createTextNode(completeEmail)); - } - list.appendChild(node); - $(node).observe("mousedown", this.onAddressResultClick.bindAsEventListener(this)); - } - - // Show popup menu - var offsetScroll = Element.cumulativeScrollOffset(input); - var offset = Element.positionedOffset(input); - if ($(document.body).hasClassName("popup") && typeof initPopupMailer == 'undefined') - // Hack for some situations where the offset must be computed differently - offset = Element.cumulativeOffset(input); - var top = offset.top - offsetScroll.top + node.offsetHeight + 3; - var height = 'auto'; - var heightDiff = window.height() - offset[1]; - var nodeHeight = node.getHeight(); - - if ((response.length * nodeHeight) > heightDiff) - // Limit the size of the popup to the window height, minus 12 pixels - height = parseInt(heightDiff/nodeHeight) * nodeHeight - 12 + 'px'; - - this.menu.setStyle({ top: top + "px", - left: offset[0] + "px", - height: height, - maxWidth: (window.width() - offset[0] - 12) + "px", - visibility: "visible" }); - this.menu.scrollTop = 0; - - document.currentPopupMenu = this.menu; - $(document.body).stopObserving("click"); - $(document.body).observe("click", onBodyClickMenuHandler); - } - else { - if (document.currentPopupMenu) - hideMenu(document.currentPopupMenu); - - if (response.length == 1) { - // Single result - var c_name = response[0][1]; - var completeEmail = c_name; - var c_mail = response[0][2]; - var c_uid = response[0][0]; - input.writeAttribute("uid", c_uid); - if (c_mail) - completeEmail += " <" + c_mail + ">"; - if (c_uid.substring(0, input.getValue().length).toUpperCase() == input.getValue().toUpperCase()) - input.value = completeEmail; - else - // The result matches email address, not user name - input.value += ' >> ' + completeEmail; - input.confirmedValue = completeEmail; - - var end = input.getValue().length; - $(input).selectText(start, end); - - this.selectedIndex = -1; - } - } - } - else - if (document.currentPopupMenu) - hideMenu(document.currentPopupMenu); - document.contactLookupAjaxRequest = null; - } -}, - -onAddressResultClick: function(event) { - var e = Event.element(event); - if (e.tagName != 'LI') - e = e.up('LI'); - if (e) { - preventDefault(event); - this.value = e.readAttribute("address"); - this.writeAttribute("uid", e.readAttribute("uid")); - if (e.readAttribute("container")) - this.fire("autocompletion:changedlist", e.readAttribute("container")); - else { - this.confirmedValue = this.value; - this.fire("autocompletion:changed", Event.KEY_RETURN); - } - } -} -}; diff --git a/UI/WebServerResources/SOGoDataTable.js b/UI/WebServerResources/SOGoDataTable.js deleted file mode 100644 index 8cb0a94f0..000000000 --- a/UI/WebServerResources/SOGoDataTable.js +++ /dev/null @@ -1,345 +0,0 @@ -/* -*- Mode: js2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - * Data table interface to be added to a DIV (this!) - * - * Available events: - * datatable:rendered -- fired once the view rendering is completed - * - */ -var SOGoDataTableInterface = { - - // Object variables initialized with "bind" - columnsCount: null, - rowModel: null, - rowHeight: 0, - body: null, - - // Object variables - dataSource: null, - rowTop: null, - rowBottom: null, - renderedIndex: -1, - renderedCount: 0, - rowRenderCallback: null, - - // Constants - overflow: 30, // must be lower than the overflow of the data source class - renderDelay: 0.1, // delay (in seconds) before which the table is rendered upon scrolling - - bind: function() { - this.observe("scroll" , this.render.bind(this)); - - this.body = this.down("tbody"); - this.rowModel = this.body.down("tr"); - - /** - * Overrided methods from HTMLElement.js - * Handle selection based on rows ID. - */ - this.body.selectRange = function(startIndex, endIndex) { - var s; - var e; - var rows; - var div = this.up('div'); - var uid = lastClickedRowId.substr(4); - - startIndex = div.dataSource.indexOf(uid); - uid = div.down('tr', endIndex).id.substr(4); - endIndex = div.dataSource.indexOf(uid); - - if (startIndex > endIndex) { - s = endIndex; - e = startIndex; - } - else { - s = startIndex; - e = endIndex; - } - - while (s <= e) { - uid = "row_" + div.dataSource.uidAtIndex(s); - if (this.selectedIds.indexOf(uid) < 0) - this.selectedIds.push(uid); - s++; - } - this.refreshSelectionByIds(); - }; - - this.body.selectAll = function() { - var div = this.up('div'); - this.selectedIds = new Array(); - for (var i = 0; i < div.dataSource.uids.length; i++) - this.selectedIds.push("row_" + div.dataSource.uidAtIndex(i)); - this.refreshSelectionByIds(); - }, - - // Since we use the fixed table layout, the first row must have the - // proper CSS classes that will define the columns width. - this.rowTop = new Element('tr', {'id': 'rowTop'}); - this.body.insertBefore(this.rowTop, this.rowModel); // IE requires the element to be inside the DOM before appending new children - var cells = this.rowModel.select('TD'); - for (var i = 0; i < cells.length; i++) { - var cell = cells[i]; - var td = new Element('td', {'class': cell.className}); - this.rowTop.appendChild(td); - } - - this.rowBottom = new Element('tr', {'id': 'rowBottom'}).update(new Element('td')); - this.body.insertBefore(this.rowBottom, this.rowModel); - - this.columnsCount = this.rowModel.select("td").length; - this.rowHeight = this.rowModel.getHeight(); -// log ("DataTable.bind() row height = " + this.rowHeight + "px"); - }, - - setRowRenderCallback: function(callbackFunction) { - // Each time a row is created or updated with new data, this callback - // function will be called. - this.rowRenderCallback = callbackFunction; - }, - - setSource: function(ds) { - this.dataSource = ds; - this.currentRenderID = ""; - this._emptyTable(); - this.scrollTop = 0; - }, - - initSource: function(dataSourceClass, url, params) { -// log ("DataTable.setSource() " + url); - if (this.dataSource) this.dataSource.destroy(); - this._emptyTable(); - this.dataSource = new window[dataSourceClass](this, url); - this.scrollTop = 0; - this.load(params); - }, - - load: function(urlParams) { - if (!this.dataSource) return; -// log ("DataTable.load() with parameters [" + urlParams.keys().join(' ') + "]"); - this.dataSource.load(urlParams); - }, - - visibleRowCount: function() { - var divHeight = this.getHeight(); - var visibleRowCount = Math.ceil(divHeight/this.rowHeight); - - return visibleRowCount; - }, - - firstVisibleRowIndex: function() { - var firstRowIndex = Math.floor(this.scrollTop/this.rowHeight); - - return firstRowIndex; - }, - - refresh: function() { - this.render(true); - }, - - render: function(refresh) { - // Setting "refresh" to true will force the call to getData which - // recomputes the top and bottom padding with respect to the total - // number of rows. - var index = this.firstVisibleRowIndex(); - var count = this.visibleRowCount(); - // Overflow the query to the maximum defined in the class variable overflow - var start = index - (this.overflow/2); - if (start < 0) start = 0; - var end = index + count + this.overflow - (index - start); -// log ("DataTable.render() from " + index + " to " + (index + count) + " boosted from " + start + " to " + end); - - // Don't overflow above the maximum number of entries from the data source - //if (this.dataSource.uids && this.dataSource.uids.length < end) end = this.dataSource.uids.length; - - index = start; - count = end - start; - - this.currentRenderID = this.dataSource.id + "/" + index + "-" + count; - - // Query the data source only if at least one row is not loaded - if (refresh === true || - this.renderedIndex < 0 || - this.renderedIndex > index || - this.renderedCount < count || - (index + count) > (this.renderedIndex + this.renderedCount)) { - this.dataSource.getData(this.currentRenderID, - index, - count, - (refresh === true)?this._refresh.bind(this):this._render.bind(this), - this.renderDelay); - } - }, - - _refresh: function(renderID, start, max, data) { - this._render(renderID, start, max, data, true); - }, - - _render: function(renderID, start, max, data, refresh) { - if (this.currentRenderID != renderID) { -// log ("DataTable._render() ignore render for " + renderID + " (current is " + this.currentRenderID + ")"); - return; - } -// log("DataTable._render() for " + data.length + " uids (from " + start + ", max " + max + ")"); - - var h, i, j; - var rows = this.body.select("tr"); - var scroll; - - scroll = this.scrollTop; - - h = start * this.rowHeight; - if (Prototype.Browser.IE) - this.rowTop.setStyle({ 'height': h + 'px', 'line-height': h + 'px' }); - this.rowTop.firstChild.setStyle({ 'height': h + 'px', 'line-height': h + 'px' }); - - h = (max - start - data.length) * this.rowHeight; - if (Prototype.Browser.IE) - this.rowBottom.setStyle({ 'height': h + 'px', 'line-height': h + 'px' }); - this.rowBottom.firstChild.setStyle({ 'height': h + 'px', 'line-height': h + 'px' }); - - if (this.renderedIndex < 0) { - this.renderedIndex = 0; - this.renderedCount = 0; - } - - if (refresh === true || - start > (this.renderedIndex + this.renderedCount) || - start + data.length < this.renderedIndex) { - // No reusable row in the viewport; - // refresh the complete view port - for (i = 0, j = start; - i < this.renderedCount && i < data.length; - i++, j++) { - // Render all existing rows with new data - var row = rows[i+1]; // must skip the first row (this.rowTop) - this.rowRenderCallback(row, data[i], false); - } - - for (i = this.renderedCount; - i < data.length; - i++, j++) { - // Add new rows, if necessary - var row = this.rowModel.cloneNode(true); - this.rowRenderCallback(row, data[i], true); - row.show(); - this.body.insertBefore(row, this.rowBottom); - } - - for (i = this.renderedCount; - i > data.length; - i--) { - // Delete extra rows, if necessary - this.body.removeChild(rows[i]); - } - } - else if (start >= this.renderedIndex) { - // Scrolling down - - // Delete top rows - for (i = start; i > this.renderedIndex; i--) { - this.body.removeChild(rows[i - this.renderedIndex]); - } - - // Add bottom rows - for (j = this.renderedIndex + this.renderedCount - start, i = this.renderedIndex + this.renderedCount; - j < data.length; - j++, i++) { - var row = this.rowModel.cloneNode(true); - this.rowRenderCallback(row, data[j], true); - this.body.insertBefore(row, this.rowBottom); - } - } - else { - // Scrolling up - - // Delete bottom rows - for (i = this.renderedIndex + this.renderedCount, j = this.renderedCount; - i > (start + data.length); - i--, j--) { - this.body.removeChild(rows[j]); - } - - // Add top rows - for (i = 0, j = start; - j < this.renderedIndex; - i++, j++) { - var row = this.rowModel.cloneNode(true); - this.rowRenderCallback(row, data[i], true); - row.show(); - this.body.insertBefore(row, rows[1]); - } - } - - // Update references to selected rows - this.body.refreshSelectionByIds(); -// log ("DataTable._render() top gap/bottom gap/total rows = " + this.rowTop.getStyle('height') + "/" + this.rowBottom.getStyle('height') + "/" + this.body.select("tr").length + " (height = " + this.down("table").getHeight() + "px)"); - - // Save current rendered view index and count - this.renderedIndex = start; - this.renderedCount = data.length; - - // Restore scroll position (necessary in certain cases) - this.scrollTop = scroll; - - Event.fire(this, "datatable:rendered", max); - }, - - invalidate: function(uid, withoutRefresh) { - // Refetch the data for uid. Only refresh the data table if - // necessary. -// log ("DataTable.invalidate(" + uid + ", with" + (withoutRefresh?"out":"") + " refresh)"); - var index = this.dataSource.invalidate(uid); - this.currentRenderID = index + "-" + 1; - this.dataSource.getData(this.currentRenderID, - index, - 1, - (withoutRefresh?false:this._invalidate.bind(this)), - 0); - }, - - _invalidate: function(renderID, start, max, data) { - if (renderID == this.currentRenderID) { - var rows = this.body.select("TR#" + data[0]['rowID']); - if (rows.length > 0) - this.rowRenderCallback(rows[0], data[0], false); - } - }, - - remove: function(uid) { - var rows = this.body.select("TR#row_" + uid); - if (rows.length == 1) { - var row = rows.first(); - row.deselect(); - row.parentNode.removeChild(row); - } - var index = this.dataSource.remove(uid); -// log ("DataTable.remove(" + uid + ") at index " + index); - if (index >= 0) { - if (this.renderedIndex > index) - this.renderedIndex--; - else if ((this.renderedIndex + this.renderedCount) > index) - this.renderedCount--; - } - return index; - }, - - _emptyTable: function() { - var rows = this.body.select("tr"); - var currentCount = rows.length; - - for (var i = currentCount - 1; i >= 0; i--) { - if (rows[i] != this.rowModel && - rows[i] != this.rowTop && - rows[i] != this.rowBottom) - this.body.removeChild(rows[i]); - } - - this.body.deselectAll(); - this.renderedIndex = -1; - this.renderedCount = 0; - this.rowTop.firstChild.setStyle({ 'height': '0px', 'line-height': '0px' }); - this.rowBottom.firstChild.setStyle({ 'height': '0px', 'line-height': '0px' }); - } -}; diff --git a/UI/WebServerResources/SOGoDragHandles.js b/UI/WebServerResources/SOGoDragHandles.js deleted file mode 100644 index 882c38517..000000000 --- a/UI/WebServerResources/SOGoDragHandles.js +++ /dev/null @@ -1,203 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - * Drag handle widget interface to be added to a DIV (the drag handle) - * - * Available events: - * handle:dragged -- fired once the handle has been dropped - * - */ -var SOGoDragHandlesInterface = { - leftMargin: 180, - topMargin: 180, - dhType: null, - dhLimit: -1, - origX: -1, - origLeft: -1, - origRight: -1, - origY: -1, - origUpper: -1, - origLower: -1, - delta: -1, - btn: null, - leftBlock: null, - rightBlock: null, - upperBlock: null, - lowerBlock: null, - rightSafetyBlock: null, - startHandleDraggingBound: null, - stopHandleDraggingBound: null, - moveBound: null, - delayedSave: null, - bind: function () { - this.startHandleDraggingBound = this.startHandleDragging.bindAsEventListener(this); - this.observe("mousedown", this.startHandleDraggingBound, false); - }, - enableRightSafety: function () { - this.rightSafetyBlock = new Element('div', {'class': 'safetyBlock'}); - this.rightSafetyBlock.hide(); - document.body.appendChild(this.rightSafetyBlock); - }, - adjust: function () { - if (!this.dhType) - this._determineType(); - if (this.dhType == 'horizontal') { - this.dhLimit = window.width() - 20; - if (parseInt(this.getStyle("left")) > this.dhLimit) { - this.setStyle({ left: this.dhLimit + "px" }); - this.rightBlock.setStyle({ left: (this.dhLimit) + 'px' }); - this.leftBlock.setStyle({ width: (this.dhLimit) + 'px' }); - if (this.delayedSave) window.clearTimeout(this.delayedSave); - this.delayedSave = this.saveDragHandleState.delay(3, this.dhType, this.dhLimit, this.saveDragHandleStateCallback); - } - } - else if (this.dhType == 'vertical') { - var windowHeight = window.height(); - this.dhLimit = windowHeight - 20 - this.upperBlock.cumulativeOffset().top + this.upperBlock.offsetTop; - if (parseInt(this.getStyle("top")) > this.dhLimit && - windowHeight > this.topMargin) { - this.setStyle({ top: this.dhLimit + 'px' }); - this.lowerBlock.setStyle({ top: this.dhLimit + 'px' }); - this.upperBlock.setStyle({ height: (this.dhLimit - this.upperBlock.offsetTop) + 'px' }); - if (this.delayedSave) window.clearTimeout(this.delayedSave); - this.delayedSave = this.saveDragHandleState.delay(3, this.dhType, this.dhLimit, this.saveDragHandleStateCallback); - } - } - }, - _determineType: function () { - if (this.leftBlock && this.rightBlock) - this.dhType = 'horizontal'; - else if (this.upperBlock && this.lowerBlock) - this.dhType = 'vertical'; - }, - startHandleDragging: function (event) { - this.btn = event.button; - if (!this.dhType) - this._determineType(); - var targ = getTarget(event); - if (targ.nodeType == 1) { - if (this.dhType == 'horizontal') { - this.dhLimit = window.width() - 20; - this.origX = this.offsetLeft; - this.origLeft = this.leftBlock.offsetWidth; - this.delta = 0; - this.origRight = this.rightBlock.offsetLeft - 5; - document.body.setStyle({ cursor: "e-resize" }); - if (this.rightSafetyBlock) { - this.rightSafetyBlock.setStyle({ - top: this.rightBlock.getStyle('top'), - left: this.rightBlock.getStyle('left') }); - this.rightSafetyBlock.show(); - } - } else if (this.dhType == 'vertical') { - this.dhLimit = window.height() - 20; - this.origY = this.offsetTop; - this.origUpper = this.upperBlock.offsetHeight; - var pointY = Event.pointerY(event); - this.delta = pointY - this.offsetTop - 5; - this.origLower = this.lowerBlock.offsetTop - 5; - document.body.setStyle({ cursor: "n-resize" }); - } - this.stopHandleDraggingBound = this.stopHandleDragging.bindAsEventListener(this); - if (Prototype.Browser.IE) - Event.observe(document.body, "mouseup", this.stopHandleDraggingBound); - else - Event.observe(window, "mouseup", this.stopHandleDraggingBound); - this.moveBound = this.move.bindAsEventListener(this); - Event.observe(document.body, "mousemove", this.moveBound); - this.move(event); - } - - return false; - }, - stopHandleDragging: function (event) { - if (!this.dhType) - this._determineType(); - if (this.dhType == 'horizontal') { - var pointerX = Event.pointerX(event); - if (pointerX <= this.leftMargin) { - this.rightBlock.setStyle({ left: (this.leftMargin) + 'px' }); - this.leftBlock.setStyle({ width: (this.leftMargin) + 'px' }); - } - else if (pointerX >= this.dhLimit) { - this.rightBlock.setStyle({ left: (this.dhLimit) + 'px' }); - this.leftBlock.setStyle({ width: (this.dhLimit) + 'px' }); - } - else { - var deltaX = Math.floor(pointerX - this.origX - (this.offsetWidth / 2)); - this.rightBlock.setStyle({ left: (this.origRight + deltaX) + 'px' }); - this.leftBlock.setStyle({ width: (this.origLeft + deltaX) + 'px' }); - } - this.saveDragHandleState(this.dhType, parseInt(this.leftBlock.getStyle("width"))); - if (this.rightSafetyBlock) - this.rightSafetyBlock.hide(); - } - else if (this.dhType == 'vertical') { - var pointerY = Event.pointerY(event); - var deltaY; - if (pointerY <= this.topMargin) - deltaY = Math.floor(this.topMargin - this.origY - (this.offsetHeight / 2)); - else if (pointerY >= this.dhLimit) - deltaY = Math.floor(this.dhLimit - this.origY - (this.offsetHeight / 2)); - else - deltaY = Math.floor(pointerY - this.origY - (this.offsetHeight / 2)); - this.lowerBlock.setStyle({ top: (this.origLower + deltaY - this.delta) + 'px' }); - this.upperBlock.setStyle({ height: (this.origUpper + deltaY - this.delta) + 'px' }); - this.saveDragHandleState(this.dhType, parseInt(this.lowerBlock.getStyle("top"))); - } - if (Prototype.Browser.IE) - Event.stopObserving(document.body, "mouseup", this.stopHandleDraggingBound); - else - Event.stopObserving(window, "mouseup", this.stopHandleDraggingBound); - Event.stopObserving(document.body, "mousemove", this.moveBound); - - document.body.setAttribute('style', ''); - document.body.setStyle({ cursor: "default" }); - this.fire("handle:dragged"); - - Event.stop(event); - }, - move: function (event) { - if (!this.dhType) - this._determineType(); - if (this.dhType == 'horizontal') { - var hX = Event.pointerX(event); - var width = this.offsetWidth; - if (hX < this.leftMargin) - hX = this.leftMargin + Math.floor(width / 2); - else if (hX > this.dhLimit) - hX = this.dhLimit + Math.floor(width / 2); - var newLeft = Math.floor(hX - (width / 2)); - this.setStyle({ left: newLeft + 'px' }); - } else if (this.dhType == 'vertical') { - var hY = Event.pointerY(event); - var height = this.offsetHeight; - if (hY < this.topMargin) - hY = this.topMargin; - else if (hY > this.dhLimit) - hY = this.dhLimit; - - var newTop = Math.floor(hY - (height / 2)) - this.delta; - this.setStyle({ top: newTop + 'px' }); - } - Event.stop(event); - if (Prototype.Browser.IE && event.button != this.btn) - this.stopHandleDragging(event); - }, - saveDragHandleState: function (type, position, fcn) { - if (!$(document.body).hasClassName("popup")) { - var urlstr = ApplicationBaseURL + "/saveDragHandleState" - + "?" + type + "=" + position; - var callbackFunction = fcn || this.saveDragHandleStateCallback; - triggerAjaxRequest(urlstr, callbackFunction); - } - }, - saveDragHandleStateCallback: function (http) { - if (isHttpStatus204(http.status)) { - log ("Drag handle state saved"); - } - else if (http.readyState == 4) { - log ("Can't save handle state"); - } - } -}; diff --git a/UI/WebServerResources/SOGoMailDataSource.js b/UI/WebServerResources/SOGoMailDataSource.js deleted file mode 100644 index b6758e559..000000000 --- a/UI/WebServerResources/SOGoMailDataSource.js +++ /dev/null @@ -1,244 +0,0 @@ -/* -*- Mode: js2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -SOGoMailDataSource = Class.create({ - - initialize: function(dataTable, url) { - // Instance variables - this.dataTable = dataTable; - this.id = url; - this.url = url; - - this.uids = new Array(); - this.threaded = false; - this.cache = new Hash(); - - this.loaded = false; - this.delayedGetData = false; - this.ajaxGetData = false; - - // Constants - this.overflow = 50; // must be higher or equal to the overflow of the data table class - }, - - destroy: function() { - this.uids.clear(); - var keys = this.cache.keys(); - for (var i = 0; i < keys.length; i++) - this.cache.unset(keys[i]); - }, - - invalidate: function(uid) { - this.cache.unset(uid); - var index = this.indexOf(uid); -// log ("MailDataSource.invalidate(" + uid + ") at index " + index); - - return index; - }, - - remove: function(uid) { -// log ("MailDataSource.remove(" + uid + ")"); - var index = this.invalidate(uid); - if (index >= 0) { - this.uids.splice(index, 1); - } - - return index; - }, - - init: function(uids, threaded, headers, quotas) { - this.uids = uids; - if (typeof threaded != "undefined") { - this.threaded = threaded; - if (threaded) - this.uids.shift(); // drop key fields - } -// log ("MailDataSource.init() " + this.uids.length + " uids loaded"); - - if (quotas && Object.isFunction(updateQuotas)) - updateQuotas(quotas); - - if (headers) { - var keys = headers[0]; - for (var i = 1; i < headers.length; i++) { - var header = []; - for (var j = 0; j < keys.length; j++) - header[keys[j]] = headers[i][j]; - this.cache.set(header["uid"], header); - } -// log ("MailDataSource.init() " + this.cache.keys().length + " headers loaded"); - } - - this.loaded = true; -// log ("MailDataSource.init() " + this.uids.length + " UIDs, " + this.cache.keys().length + " headers"); - }, - - load: function(content) { - this.loaded = false; - triggerAjaxRequest(this.url + "/uids", - this._loadCallback.bind(this), - null, - content, - { "content-type": "application/json" }); - }, - - _loadCallback: function(http) { - if (http.status == 200) { - if (http.responseText.length > 0) { - var data = http.responseText.evalJSON(true); - if (data.uids) - this.init(data.uids, data.threaded, data.headers, data.quotas); - else - this.init(data); - if (this.delayedGetData) { - this.delayedGetData(); - this.delayedGetData = false; - } - } - } - else { - log("SOGoMailDataSource._loadCallback Error " + http.status + ": " + http.responseText); - } - }, - - getData: function(id, index, count, callbackFunction, delay) { - if (this.loaded == false) { - // UIDs are not yet loaded -- delay the call until loading the data is completed. -// log ("MailDataSource.getData() delaying data fetching while waiting for UIDs"); - this.delayedGetData = this.getData.bind(this, id, index, count, callbackFunction, delay); - return; - } - - var start, end; - - if (count > 1) { - // Compute last index depending on number of UIDs - start = index - (this.overflow/2); - if (start < 0) start = 0; - end = index + count + this.overflow - (index - start); - if (end > this.uids.length) { - start -= end - this.uids.length; - end = this.uids.length; - if (start < 0) start = 0; - } - } - else { - // Count is 1; don't fetch more data since the caller is - // SOGoDataTable.invalide() and asks for only one data row. - start = index; - end = index + count; - } -// log ("MailDataSource._getData() from " + index + " to " + (index + count) + " boosted from " + start + " to " + end); - - var missingUids = []; - for (var j = start; j < end; j++) { - var uid = this.threaded? this.uids[j][0] : this.uids[j]; - if (!this.cache.get(uid)) { -// log ("MailDataSource._getData missing headers of uid " + uid + " at index " + j + (this.threaded? " (":" (non-") + "threaded)"); - missingUids.push(uid); - } - } - - if (this.delayed_getRemoteData) window.clearTimeout(this.delayed_getRemoteData); - if (missingUids.length > 0) { - var params = "uids=" + missingUids.join(","); - this.delayed_getRemoteData = this._getRemoteData.bind(this, - { callbackFunction: callbackFunction, - start: start, end: end, - id: id }, - params).delay(delay); - } - else if (callbackFunction) - this._returnData(callbackFunction, id, start, end); - }, - - _getRemoteData: function(callbackData, urlParams) { - if (this.ajaxGetData) { - this.ajaxGetData.aborted = true; - this.ajaxGetData.abort(); -// log ("MailDataSource._getRemoteData() aborted previous AJAX request"); - } -// log ("MailDataSource._getRemoteData() fetching headers of " + urlParams); - this.ajaxGetData = triggerAjaxRequest(this.url + "/headers", - this._getRemoteDataCallback.bind(this), - callbackData, - urlParams, - { "Content-type": "application/x-www-form-urlencoded" }); - }, - - _getRemoteDataCallback: function(http) { - if (http.status == 200) { - if (http.responseText.length > 0) { - // We receives an array of hashes - var headers = $A(http.responseText.evalJSON(true)); - var data = http.callbackData; - var keys = headers[0]; - for (var i = 1; i < headers.length; i++) { - var header = []; - for (var j = 0; j < keys.length; j++) - header[keys[j]] = headers[i][j]; - this.cache.set(header["uid"], header); - } - - if (data["callbackFunction"]) - this._returnData(data["callbackFunction"], data["id"], data["start"], data["end"]); - } - } - else { - log("SOGoMailDataSource._getRemoteDataCallback Error " + http.status + ": " + http.responseText); - } - }, - - _returnData: function(callbackFunction, id, start, end) { - var i, j; - var data = new Array(); - for (i = start, j = 0; i < end; i++, j++) { - if (this.threaded) { - data[j] = this.cache.get(this.uids[i][0]); - - // Add thread-related data - if (parseInt(this.uids[i][2]) > 0) { - var mailbox = Mailer.currentMailbox; - if ((UserSettings.Mail.threadsCollapsed != undefined) && - (UserSettings.Mail.threadsCollapsed[Mailer.currentMailbox] != undefined) && - (UserSettings.Mail.threadsCollapsed[Mailer.currentMailbox].indexOf((this.uids[i][0]).toString())) != -1) { - data[j]['Thread'] = ''; - } - else - data[j]['Thread'] = ''; - } - else if (data[j]['Thread']) - delete data[j]['Thread']; - if (parseInt(this.uids[i][1]) > -1) - data[j]['ThreadLevel'] = this.uids[i][1]; - else - delete data[j]['ThreadLevel']; - } - else { - data[j] = this.cache.get(this.uids[i]); - } - } - callbackFunction(id, start, this.uids.length, data); - }, - - indexOf: function(uid) { - var index = -1; - if (this.threaded) { - for (var i = 0; i < this.uids.length; i++) - if (this.uids[i][0] == uid) { - index = i; - break; - } - } - else - index = this.uids.indexOf(parseInt(uid)); - - return index; - }, - - uidAtIndex: function(index) { - if (this.threaded) - return this.uids[index][0]; - else - return this.uids[index]; - } -}); diff --git a/UI/WebServerResources/SOGoResizableTable.js b/UI/WebServerResources/SOGoResizableTable.js deleted file mode 100644 index 10694296f..000000000 --- a/UI/WebServerResources/SOGoResizableTable.js +++ /dev/null @@ -1,286 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - * Resizable table interface to be added to a TABLE (this!) - * - * Columns with the class resizable will be .. resizable. - * - */ -var SOGoResizableTableInterface = { - - delayedResize: null, - ratios: null, - - bind: function() { - var i; - var cells = $(this).down('tr').childElements(); - for (i = 0; i < cells.length; i++) { - var cell = cells[i]; - if (Prototype.Browser.IE) - cell.observe("selectstart", Event.stop); - if (cell.hasClassName('resizable')) { - Event.observe(cell, 'mouseover', SOGoResizableTable.initDetect); - Event.observe(cell, 'mouseout', SOGoResizableTable.killDetect); - } - SOGoResizableTable._resize(this, $(cell), i, null, cell.getWidth()); - } - this.computeColumnsWidths(); - Event.observe(window, "resize", this.resize.bind(this)); - }, - - resize: function(e) { - // Only resize the columns after a certain delay, otherwise it slows - // down the interface. - if (this.delayedResize) window.clearTimeout(this.delayedResize); - this.delayedResize = this._resize.bind(this).delay(0.2); - }, - - _resize: function() { - this.restore(); - }, - - restore: function(relativeWidths) { - if (SOGoResizableTable._stylesheet != null) - if (Prototype.Browser.IE) - while (SOGoResizableTable._stylesheet.styleSheet.rules.length) - SOGoResizableTable._stylesheet.styleSheet.removeRule(0); - else - while (SOGoResizableTable._stylesheet.firstChild) - SOGoResizableTable._stylesheet.removeChild(SOGoResizableTable._stylesheet.firstChild); - - if (relativeWidths) - this.ratios = relativeWidths; - var tableWidth = this.getWidth()/100; - var cells = $(this).down('tr').select('.resizable'); - for (i = 0; i < cells.length; i++) { - var cell = cells[i]; - var ratio = this.ratios.get(cell.id); - SOGoResizableTable._resize(this, $(cell), i, null, ratio*tableWidth); - } - }, - - computeColumnsWidths: function() { - this.ratios = new Hash(); - var tableWidth = 100/this.getWidth(); - var cells = $(this).down('tr').childElements(); - for (i = 0; i < cells.length; i++) { - var cell = cells[i]; - if (cell.hasClassName('resizable')) - this.ratios.set(cell.id, Math.round(cell.getWidth()*tableWidth)); - } - }, - - saveColumnsState: function() { - this.computeColumnsWidths(); - if (!$(document.body).hasClassName("popup")) { - var url = ApplicationBaseURL + "/saveColumnsState"; - var data = this.ratios; - var columns = data.keys(); - var params = "columns=" + columns.join(",") - + "&widths=" + columns.collect(function(c) { return data.get(c); }).join(","); - triggerAjaxRequest(url, - this.saveColumnsStateCallback, - null, - params, - { "Content-type": "application/x-www-form-urlencoded" }); - } - }, - - saveColumnsStateCallback: function(http) { - if (isHttpStatus204(http.status)) { - log ("ResizableTable.saveColumnsStateCallback() Columns state saved"); - } - else if (http.readyState == 4) { - log ("ResizableTable.saveColumnsStateCallback() Can't save columns state"); - } - } - -}; - -SOGoResizableTable = { - - _onHandle: false, - _cell: null, - _tbl: null, - _handle: null, - _stylesheet: null, - - 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.rows[0].cells[index]); - } - else { - cell = $(index); - table = table ? $(table) : cell.up('table'); - index = SOGoResizableTable.getCellIndex(cell); - } - - var cells = table.down('tr').childElements(); - var nextResizableCell = null; - for (var i = index + 1; i < cells.length; i++) { - var c = cells[i]; - if (c.hasClassName('resizable')) { - nextResizableCell = c; - break; - } - } - - var delta = SOGoResizableTable._resize(table, cell, index, nextResizableCell, w, false); - if (delta != 0 && nextResizableCell != null) { - var w = nextResizableCell.getWidth() - delta; - SOGoResizableTable._resize(table, nextResizableCell, i, null, w, true); - } - - table.saveColumnsState(); - }, - - _resize: function(table, cell, index, nextResizableCell, w, isAdjustment) { - var pad = 0; - if (!Prototype.Browser.WebKit) { - pad = parseInt(cell.getStyle('paddingLeft'),10) + parseInt(cell.getStyle('paddingRight'),10); - pad += parseInt(cell.getStyle('borderLeftWidth'),10) + parseInt(cell.getStyle('borderRightWidth'),10); - } - - var cells = table.down('tr').childElements(); - if ((index + 1) == cells.length) { - return 0; - } - - if (!isAdjustment && cell.getWidth() < w) { - if (nextResizableCell == null && (index + 2) == cells.length) - // The next cell is the last cell; respect its minimum width - // event if it's not resizable. - nextResizableCell = cells[index + 1]; - if (nextResizableCell != null) { - // Respect the minimum width of the next resizable cell. - var max = cells[index].getWidth() - + nextResizableCell.getWidth() - - parseInt(nextResizableCell.getStyle('minWidth')) - - pad; - w = Math.min(max, w); - } - } - - // Respect the minimum width of the cell. - w = Math.max(Math.round(w) - pad, parseInt(cell.getStyle('minWidth'))); - - var delta = w - cell.getWidth() + pad; - - var cssSelector = ' TABLE.' + $w(table.className).first() + ' .' + $w(cell.className).first(); - - if (SOGoResizableTable._stylesheet == null) { - SOGoResizableTable._stylesheet = document.createElement("style"); - SOGoResizableTable._stylesheet.type = "text/css"; - document.getElementsByTagName("head")[0].appendChild(SOGoResizableTable._stylesheet); - } - - if (SOGoResizableTable._stylesheet.styleSheet && SOGoResizableTable._stylesheet.styleSheet.addRule) { - // IE - SOGoResizableTable._stylesheet.styleSheet.addRule(cssSelector, - ' { width: ' + w + 'px; max-width: ' + w + 'px; }'); - } - else { - // Mozilla + Safari - SOGoResizableTable._stylesheet.appendChild(document.createTextNode(cssSelector + - ' { width: ' + w + 'px; max-width: ' + w + 'px; }')); - } - - return delta; - }, - - initDetect: function(e) { - var cell = Event.element(e); - if (cell.tagName != "TH") { return; } - Event.observe(cell, 'mousemove', SOGoResizableTable.detectHandle); - Event.observe(cell, 'mousedown', SOGoResizableTable.startResize); - }, - - detectHandle: function(e) { - var cell = Event.element(e); - if (SOGoResizableTable.pointerPos(cell, Event.pointerX(e), Event.pointerY(e))) { - cell.addClassName('resize-handle-active'); - SOGoResizableTable._onHandle = true; - } - else { - cell.removeClassName('resize-handle-active'); - SOGoResizableTable._onHandle = false; - } - }, - - killDetect: function(e) { - SOGoResizableTable._onHandle = false; - var cell = Event.element(e); - Event.stopObserving(cell, 'mousemove', SOGoResizableTable.detectHandle); - Event.stopObserving(cell, 'mousedown', SOGoResizableTable.startResize); - cell.removeClassName('resize-handle-active'); - }, - - startResize: function(e) { - if (!SOGoResizableTable._onHandle) { return; } - var cell = Event.element(e); - Event.stopObserving(cell, 'mousemove', SOGoResizableTable.detectHandle); - Event.stopObserving(cell, 'mousedown', SOGoResizableTable.startResize); - Event.stopObserving(cell, 'mouseout', SOGoResizableTable.killDetect); - SOGoResizableTable._cell = cell; - var table = cell.up('table'); - SOGoResizableTable._tbl = table; - SOGoResizableTable._handle = $(document.createElement('div')).addClassName('resize-handle').setStyle({ - 'top' : table.cumulativeOffset()[1] + 'px', - 'left' : Event.pointerX(e) + 'px', - 'height' : table.getHeight() + 'px', - 'max-height' : table.getHeight() + 'px' - }); - document.body.appendChild(SOGoResizableTable._handle); - - Event.observe(document, 'mousemove', SOGoResizableTable.drag); - Event.observe(document, 'mouseup', SOGoResizableTable.endResize); - Event.stop(e); - }, - - endResize: function(e) { - var cell = SOGoResizableTable._cell; - if (!cell) { return; } - SOGoResizableTable.resize(null, cell, (Event.pointerX(e) - cell.cumulativeOffset()[0])); - Event.stopObserving(document, 'mousemove', SOGoResizableTable.drag); - Event.stopObserving(document, 'mouseup', SOGoResizableTable.endResize); - $$('div.resize-handle').each(function(elm){ - document.body.removeChild(elm); - }); - Event.observe(cell, 'mouseout', SOGoResizableTable.killDetect); - SOGoResizableTable._tbl = SOGoResizableTable._handle = SOGoResizableTable._cell = null; - Event.stop(e); - }, - - drag: function(e) { - e = $(e); - if (SOGoResizableTable._handle === null) { - try { - SOGoResizableTable.resize(SOGoResizableTable._tbl, SOGoResizableTable._cell, (Event.pointerX(e) - SOGoResizableTable._cell.cumulativeOffset()[0])); - } - catch(e) {} - } - else { - SOGoResizableTable._handle.setStyle({'left' : Event.pointerX(e) + 'px'}); - } - return false; - }, - - pointerPos: function(element, x, y) { - var offset = $(element).cumulativeOffset(); - return (y >= offset[1] && - y < offset[1] + element.offsetHeight && - x >= offset[0] + element.offsetWidth - 5 && - x < offset[0] + element.offsetWidth); - }, - - getCellIndex : function(cell) { - return $A(cell.parentNode.cells).indexOf(cell); - } - -}; \ No newline at end of file diff --git a/UI/WebServerResources/SOGoRootPage.css b/UI/WebServerResources/SOGoRootPage.css deleted file mode 100644 index a8aa75659..000000000 --- a/UI/WebServerResources/SOGoRootPage.css +++ /dev/null @@ -1,138 +0,0 @@ -BODY -{ background-color: #E6E7E6; - text-align: center; } - -IMG#preparedAnimation -{ width: 0px; - height: 0px; } - -DIV.linkbanner A#about -{ float: right; - margin: 0px; - padding: 0px .5em; } - -DIV#aboutBox -{ position: absolute; - z-index: 1000; - left: 0px; - top: 30px; - width: 100%; - text-align: center; } - -DIV#aboutBox DIV -{ background-color: #fff; - border: 1px solid #222; - margin: auto; - padding-bottom: 20px; - width: 550px; } - -DIV#aboutBox SPAN.buildDate -{ color: #666; } - -A#aboutClose -{ position: relative; - margin-right: 10px; - top: -10px; } - -A, -A:link, -A:visited -{ color: #54b948; } - -DIV A.button -{ color: #000; } - -DIV#aboutBox P.logo -{ background-color: #222; - margin-top: 0; - margin-bottom: 10px; } - -DIV#aboutBox P.scroll -{ border: 1px solid #222; - height: 120px; - margin: auto; - padding: 5px; - width: 350px; - text-align: left; - overflow-y: auto; } - -DIV#aboutBox P.links -{ margin: 0 0 20px 0; } - -DIV.linkbanner -{ text-align: right; } - -DIV.linkbanner A -{ padding-right: .5em; } - -DIV#loginScreen -{ clear: both; - margin: 0px auto; - padding-top: 5em; - border: 2px solid transparent; - text-align: center; -} - -DIV#loginScreen TABLE -{ margin: auto; } - -DIV#loginScreen TABLE TD -{ text-align: right; } - -DIV#loginScreen TABLE TD#loginCell -{ border-left: 1px solid #fff; - padding-left: 10px; - vertical-align: top; } - -LABEL -{ display: inline-block; - padding: 10px; } - -DIV#loginScreen LABEL -{ display: block; - padding: 5px; } - -#animation -{ margin: 0px auto; - padding: 0px; } - -IMG#splash -{ border: 0; - margin: 0px; - padding: 0px 0px 0px 0px; } - -DIV#loginScreen INPUT.textField -{ width: 187px; } - -DIV#loginScreen A#submit, -DIV#loginScreen A#submit SPAN -{ color: #535D6D; } - -IMG#progressIndicator -{ width: 16px; - height: 16px; - margin-top: 20px; - margin-left: 5px; } - -#errorMessage -{ color: #f00; - width: 400px; - margin: 0px auto; - 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; - padding-right: 5px; } - -P.browser IMG -{ padding: 0 2px; - margin: 0; - vertical-align: middle; } - -#passwordChangeDialog INPUT -{ width: 150px; } diff --git a/UI/WebServerResources/SOGoRootPage.js b/UI/WebServerResources/SOGoRootPage.js deleted file mode 100644 index a2300ee62..000000000 --- a/UI/WebServerResources/SOGoRootPage.js +++ /dev/null @@ -1,350 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -var dialogs = {}; - -function initLogin() { - var date = new Date(); - date.setTime(date.getTime() - 86400000); - - var href = $("connectForm").action.split("/"); - var appName = href[href.length-2]; - - document.cookie = ("0xHIGHFLYxSOGo=discarded" - + "; expires=" + date.toGMTString() - + "; path=/" + appName + "/"); - - var about = $("about"); - if (about) { - about.observe("click", function(event) { - jQuery('#aboutBox').slideToggle('fast'); - event.stop(); }); - var aboutClose = $("aboutClose"); - aboutClose.observe("click", function(event) { - jQuery('#aboutBox').slideUp('fast'); - event.stop() }); - } - - var submit = $("submit"); - submit.observe("click", onLoginClick); - - var userName = $("userName"); - userName.observe("keydown", onFieldKeyDown); - - var passw = $("password"); - passw.observe("keydown", onFieldKeyDown); - - var image = $("preparedAnimation"); - image.parentNode.removeChild(image); - - var submitBtn = $("submit"); - submitBtn.disabled = false; - - if (userName.value.empty()) - userName.focus(); - else - passw.focus(); -} - -function onFieldKeyDown(event) { - if (event.keyCode == Event.KEY_RETURN) { - if ($("password").value.length > 0 - && $("userName").value.length > 0) - return onLoginClick(event); - else - Event.stop(event); - } else if (IsCharacterKey(event.keyCode) - || event.keyCode == Event.KEY_BACKSPACE) { - SetLogMessage("errorMessage", null); - } -} - -function onLoginClick(event) { - var userNameField = $("userName"); - var userName = userNameField.value; - var password = $("password").value; - var language = $("language"); - var domain = $("domain"); - - SetLogMessage("errorMessage"); - - if (userName.length > 0 && password.length > 0) { - this.disabled = true; - startAnimation($("animation")); - - if (typeof(loginSuffix) != "undefined" - && loginSuffix.length > 0 - && !userName.endsWith(loginSuffix)) - userName += loginSuffix; - - var url = $("connectForm").getAttribute("action"); - var parameters = ("userName=" + encodeURIComponent(userName) - + "&password=" + encodeURIComponent(password)); - if (language) - parameters += ((language.value == "WONoSelectionString") - ? "" - : ("&language=" + language.value)); - if (domain) - parameters += "&domain=" + domain.value; - var rememberLogin = $("rememberLogin"); - if (rememberLogin && rememberLogin.checked) - parameters += "&rememberLogin=1"; - - /// Discarded as it seems to create a cookie for nothing. To discard - // a cookie in JS, have a look here: http://www.quirksmode.org/js/cookies.html - //document.cookie = "";\ - triggerAjaxRequest(url, onLoginCallback, null, (parameters), - { "Content-type": "application/x-www-form-urlencoded", - "Content-length": parameters.length, - "Connection": "close" }); - } - else - userNameField.focus(); - - preventDefault(event); -} - -function onLoginCallback(http) { - if (http.readyState == 4) { - var submitBtn = $("submit"); - - if (http.status == 200) { - // Make sure browser's cookies are enabled - var loginCookie = readLoginCookie(); - - if (!loginCookie) { - SetLogMessage("errorMessage", _("cookiesNotEnabled")); - submitBtn.disabled = false; - return; - } - - var jsonResponse = http.responseText.evalJSON(false); - if (jsonResponse - && typeof(jsonResponse["expire"]) != "undefined" - && typeof(jsonResponse["grace"]) != "undefined") { - - if (jsonResponse["expire"] < 0 && jsonResponse["grace"] > 0) - showPasswordDialog("grace", createPasswordGraceDialog, jsonResponse["grace"]); - else if (jsonResponse["expire"] > 0 && jsonResponse["grace"] == -1) - showPasswordDialog("expiration", createPasswordExpirationDialog, jsonResponse["expire"]); - else { - redirectToUserPage(); - } - } - else - redirectToUserPage(); - } - else { - if (http.status == 403 - && http.getResponseHeader("content-type") - == "application/json") { - var jsonResponse = http.responseText.evalJSON(false); - handlePasswordError(jsonResponse); - } else { - SetLogMessage("errorMessage", _("An unhandled error occurred.")); - } - submitBtn.disabled = false; - } - } -} - -function redirectToUserPage() { - // Redirect to proper page - var userName = $("userName").value; - var domain = $("domain"); - if (domain) - userName += '@' + domain.value; - else if (typeof(loginSuffix) != "undefined" - && loginSuffix.length > 0 - && !userName.endsWith(loginSuffix)) - userName += loginSuffix; - var address = "" + window.location.href; - var baseAddress = ApplicationBaseURL + "/" + encodeURIComponent(userName); - var altBaseAddress; - if (baseAddress[0] == "/") { - var parts = address.split("/"); - var hostpart = parts[2]; - var protocol = parts[0]; - baseAddress = protocol + "//" + hostpart + baseAddress; - } - var altBaseAddress; - var parts = baseAddress.split("/"); - parts.splice(3, 0); - altBaseAddress = parts.join("/"); - - var newAddress; - if ((address.startsWith(baseAddress) - || address.startsWith(altBaseAddress)) - && !address.endsWith("/logoff")) - newAddress = address; - else - newAddress = baseAddress; - window.location.href = newAddress; -} - -function handlePasswordError(jsonResponse) { - var perr = jsonResponse["LDAPPasswordPolicyError"]; - if (perr == PolicyNoError) { - SetLogMessage("errorMessage", _("Wrong username or password.")); - } else if (perr == PolicyAccountLocked) { - SetLogMessage("errorMessage", - _("Your account was locked due to too many failed attempts.")); - } else if (perr == PolicyChangeAfterReset) { - showPasswordDialog("change", createPasswordChangeDialog, 5); - } else if (perr == PolicyPasswordExpired) { - SetLogMessage("errorMessage", - _("Your account was locked due to an expired password.")); - } - else - SetLogMessage("errorMessage", - _("Login failed due to unhandled error case: " + perr)); -} - -function showPasswordDialog(dialogType, constructor, parameters) { - var dialog = dialogs[dialogType]; - if (!dialog) { - dialog = constructor(parameters); - var form = $("connectForm"); - form.appendChild(dialog); - dialogs[dialogType] = dialog; - } - var password = $("password"); - var offsets = password.positionedOffset(); - dialog.show(); - var top = offsets[1] - 2; - var left = offsets[0] + 10 - dialog.clientWidth; - dialog.setStyle({ "top": top + "px", "left": left + "px"}); -} - -function createPasswordChangeDialog() { - var fields = createElement("p"); - createElement("span", "passwordError", null, null, null, fields); - - var fieldNames = [ "newPassword", "newPassword2" ]; - var fieldLabels = [ _("New password:"), _("Confirmation:") ]; - for (var i = 0; i < fieldNames.length; i++) { - var label = createElement("label", null, null, null, null, fields); - label.appendChild(document.createTextNode(fieldLabels[i])); - createElement("input", fieldNames[i], "textField", - { "name": fieldNames[i], "type": "password" }, - null, label); - createElement("br", null, null, null, null, fields); - } - - var button = createButton("passwordOKButton", _("OK"), passwordDialogOK); - button.addClassName("actionButton"); - fields.appendChild(button); - fields.appendChild(document.createTextNode(" ")); - button = createButton("passwordCancelButton", - _("Cancel"), passwordDialogCancel); - fields.appendChild(button); - - var dialog = createDialog("passwordChangeDialog", - _("Change your Password"), - _("Your password has expired, please enter a new one below:"), - fields, - "right"); - - return dialog; -} - -function passwordDialogOK(event) { - var field = $("newPassword"); - var confirmationField = $("newPassword2"); - if (field && confirmationField) { - var newPassword = field.value; - if (newPassword == confirmationField.value) { - if (newPassword.length > 0) { - var userName = $("userName"); - var password = $("password"); - var policy = new PasswordPolicy(userName.value, - password.value); - policy.setCallbacks(onPasswordChangeSuccess, - onPasswordChangeFailure); - policy.changePassword(newPassword); - } - else - SetLogMessage("passwordError", - _("Password must not be empty.")); - } - else { - SetLogMessage("passwordError", - _("The passwords do not match. Please try again.")); - field.focus(); - field.select(); - } - } - event.stop(); -} - -function onPasswordChangeSuccess() { - SetLogMessage("passwordError", _("Please wait...")); - redirectToUserPage(); -} - -function onPasswordChangeFailure(code, message) { - SetLogMessage("passwordError", message); -} - -function passwordDialogCancel(event) { - var dialog = $("passwordChangeDialog"); - dialog.hide(); - event.stop(); -} - -function createPasswordGraceDialog(tries) { - var button = createButton("graceOKButton", _("OK")); - button.observe("click", passwordGraceDialogOK); - button.addClassName("actionButton"); - - return createDialog("passwordGraceDialog", - _("Password Grace Period"), - _("You have %{0} logins remaining before your account is locked. Please change your password in the preference dialog.").formatted(tries), - button, - "right"); -} - -function passwordGraceDialogOK(event) { - var dialog = $("passwordGraceDialog"); - dialog.hide(); - event.stop(); - redirectToUserPage(); -} - -function createPasswordExpirationDialog(expire) { - var button = createButton("expirationOKButton", _("OK")); - button.observe("click", passwordExpirationDialogOK); - button.addClassName("actionButton"); - - var value, string; - - if (expire > 86400) { - value = Math.round(expire/86400); - string = _("days"); - } - else if (expire > 3600) { - value = Math.round(expire/3600); - string = _("hours"); - } - else if (expire > 60) { - value = Math.round(expire/60); - string = _("minutes"); - } - else { - value = expire; - string = _("seconds"); - } - return createDialog("passwordExpirationDialog", - _("Password about to expire"), - _("Your password is going to expire in %{0} %{1}.").formatted(value, string), - button, - "right"); -} - -function passwordExpirationDialogOK(event) { - var dialog = $("passwordExpirationDialog"); - dialog.hide(); - event.stop(); - redirectToUserPage(); -} - -document.observe("dom:loaded", initLogin); diff --git a/UI/WebServerResources/SOGoTabsController.js b/UI/WebServerResources/SOGoTabsController.js deleted file mode 100644 index b523836b3..000000000 --- a/UI/WebServerResources/SOGoTabsController.js +++ /dev/null @@ -1,169 +0,0 @@ -/* -*- Mode: java; tab-width: 2; c-label-minimum-indentation: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -function SOGoTabsController() { -} - -SOGoTabsController.prototype = { - container: null, - firstTab: null, - activeTab: null, - - list: null, - offset: 0, - - createScrollButtons: function STC_createScrollButtons() { - var scrollToolbar = createElement("div", null, "scrollToolbar"); - scrollToolbar.hide(); - var lnk = createElement("a", null, - [ "leftScrollButton", - "scrollButton", "smallToolbarButton"], - { href: "#" }, - null, scrollToolbar); - var span = createElement("span"); - lnk.appendChild(span); - span.appendChild(document.createTextNode("<")); - this.onScrollLeftBound = this.onScrollLeft.bindAsEventListener(this); - lnk.observe("click", this.onScrollLeftBound, false); - - var lnk = createElement("a", null, - [ "rightScrollButton", - "scrollButton", "smallToolbarButton"], - { href: "#" }, - null, scrollToolbar); - var span = createElement("span"); - lnk.appendChild(span); - span.appendChild(document.createTextNode(">")); - this.onScrollRightBound = this.onScrollRight.bindAsEventListener(this); - lnk.observe("click", this.onScrollRightBound, false); - - this.container.appendChild(scrollToolbar); - this.scrollToolbar = scrollToolbar; - }, - - onScrollLeft: function(event) { - if (this.offset < 0) { - var offset = this.offset + 20; - if (offset > 0) { - offset = 0; - } - this.list.setStyle("margin-left: " + offset + "px;"); - // log("offset: " + offset); - this.offset = offset; - } - event.stop(); - }, - onScrollRight: function(event) { - if (this.offset > this.minOffset) { - var offset = this.offset - 20; - if (offset < this.minOffset) { - offset = this.minOffset; - } - this.list.setStyle("margin-left: " + offset + "px;"); - // log("offset: " + offset); - this.offset = offset; - } - event.stop(); - }, - - attachToTabsContainer: function STC_attachToTabsContainer(container) { - this.container = container; - container.controller = this; - this.onTabMouseDownBound = this.onTabMouseDown.bindAsEventListener(this); - this.onTabClickBound = this.onTabClick.bindAsEventListener(this); - - var list = container.childNodesWithTag("ul"); - if (list.length > 0) { - this.list = $(list[0]); - var nodes = this.list.childNodesWithTag("li"); - if (nodes.length > 0) { - this.firstTab = $(nodes[0]); - for (var i = 0; i < nodes.length; i++) { - var currentNode = $(nodes[i]); - currentNode.observe("mousedown", this.onTabMouseDownBound, false); - currentNode.observe("click", this.onTabClickBound, false); - if (currentNode.hasClassName("active")) - this.activeTab = currentNode; - //$(currentNode.getAttribute("target")).hide(); - } - - this.firstTab.addClassName("first"); - if (this.activeTab == null) { - this.activeTab = this.firstTab; - this.activeTab.addClassName("active"); - } - var last = nodes.length - 1; - this.lastTab = $(nodes[last]); - - var target = $(this.activeTab.getAttribute("target")); - target.addClassName("active"); - } - this.onWindowResizeBound = this.onWindowResize.bindAsEventListener(this); - Event.observe(window, "resize", this.onWindowResizeBound, false); - } - - this.createScrollButtons(); - this.recomputeMinOffset(); - }, - - onWindowResize: function STC_onWindowResize(event) { - this.recomputeMinOffset(); - }, - - recomputeMinOffset: function() { - var tabsWidth = (this.lastTab.offsetLeft + this.lastTab.clientWidth - - this.firstTab.offsetLeft - + 4); - this.minOffset = (this.container.clientWidth - tabsWidth - 40); - if (this.minOffset < -40) { - this.scrollToolbar.show(); - } else { - this.scrollToolbar.hide(); - if (this.offset < 0) { - this.list.setStyle("margin-left: 0px;"); - this.offset = 0; - } - } - }, - - onTabMouseDown: function STC_onTabMouseDown(event) { - event.stop(); - }, - - onTabClick: function STC_onTabClick(event) { - var clickedTab = getTarget(event); - if (clickedTab.nodeType == 1) { - while (clickedTab.tagName.toLowerCase() != "li") { - clickedTab = $(clickedTab.parentNode); - } - var content = $(clickedTab.getAttribute("target")); - var oldContent = $(this.activeTab.getAttribute("target")); - oldContent.removeClassName("active"); - this.activeTab.removeClassName("active"); // previous LI - this.activeTab = $(clickedTab); - this.activeTab.addClassName("active"); // current LI - content.addClassName("active"); - this.activeTab.fire("tabs:click", content.id); - - content.select('.tabsContainer').each(function(c) { - // When the tab contains an inner tabs container, - // show or hide the tabs navigation arrows of this - // inner container - c.controller.recomputeMinOffset(); - }); - - // Prototype alternative - - //oldContent.removeClassName("active"); - //container.activeTab.removeClassName("active"); // previous LI - //container.activeTab = node; - //container.activeTab.addClassName("active"); // current LI - - //container.activeTab.hide(); - //oldContent.hide(); - //content.show(); - - //container.activeTab = node; - //container.activeTab.show(); - } - } -} diff --git a/UI/WebServerResources/SOGoTimePicker.css b/UI/WebServerResources/SOGoTimePicker.css deleted file mode 100644 index b69a4e4d8..000000000 --- a/UI/WebServerResources/SOGoTimePicker.css +++ /dev/null @@ -1,134 +0,0 @@ -.SOGoTimePickerMenu -{ position: absolute; - z-index: 1000; - background-color: #fff; - border: 1px solid #ccc; - border: 1px solid rgba(0, 0, 0, 0.2); - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 5px; - -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); - -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); - box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); - -webkit-background-clip: padding-box; - -moz-background-clip: padding; - background-clip: padding-box; - *border-right-width: 2px; - *border-bottom-width: 2px; - color: #000; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 11px; - line-height: 18px; - text-align: center; } - -.SOGoTimePickerMenu > DIV -{ padding: 5px; } - -.SOGoTimePickerMenu.bellow > DIV:before { - content: ''; - display: inline-block; - border-left: 7px solid transparent; - border-right: 7px solid transparent; - border-bottom: 7px solid #ccc; - border-bottom-color: rgba(0, 0, 0, 0.2); - position: absolute; - top: -7px; - left: 6px; - left: 35px; -} -.SOGoTimePickerMenu.bellow > DIV:after { - content: ''; - display: inline-block; - border-left: 6px solid transparent; - border-right: 6px solid transparent; - border-bottom: 6px solid #ffffff; - position: absolute; - top: -6px; - left: 7px; - left: 36px; -} - -.SOGoTimePickerMenu.above > DIV:before { - content: ''; - display: inline-block; - border-left: 7px solid transparent; - border-right: 7px solid transparent; - border-top: 7px solid #ccc; - border-top-color: rgba(0, 0, 0, 0.2); - position: absolute; - bottom: -7px; - right: 35px; -} -.SOGoTimePickerMenu.above > DIV:after { - content: ''; - display: inline-block; - border-left: 6px solid transparent; - border-right: 6px solid transparent; - border-top: 6px solid #ffffff; - position: absolute; - bottom: -6px; - right: 36px; -} - -.SOGoTimePickerMenu .hours, -.SOGoTimePickerMenu .minutes, -.SOGoTimePickerMenu .button -{ clear: both; /* Opera fix */ } - -.SOGoTimePickerMenu SPAN DIV -{ padding: 2px; } - -.SOGoTimePickerMenu DIV.hours SPAN -{ float: left; - width: 25px; } - -.SOGoTimePickerMenu DIV.hours SPAN DIV -{ -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; } - -.SOGoTimePickerMenu DIV.min5 SPAN -{ float: left; - width: 50px; } - -.SOGoTimePickerMenu DIV.min1 SPAN -{ float: left; - width: 60px; } - -.SOGoTimePickerMenu DIV.minutes SPAN DIV -{ -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; } - -.SOGoTimePickerMenu DIV.hours SPAN DIV:hover, -.SOGoTimePickerMenu DIV.minutes SPAN DIV:hover -{ background-color: #eee; - color: #333; - cursor: pointer; } - -.SOGoTimePickerMenu DIV.hours SPAN DIV.selected, -.SOGoTimePickerMenu DIV.minutes SPAN DIV.selected, -.SOGoTimePickerMenu DIV.hours SPAN DIV.selected:hover, -.SOGoTimePickerMenu DIV.minutes SPAN DIV.selected:hover -{ background-color: #006dcc; - background-image: -moz-linear-gradient(top, #0088cc, #0044cc); - background-image: -ms-linear-gradient(top, #0088cc, #0044cc); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); - background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); - background-image: -o-linear-gradient(top, #0088cc, #0044cc); - background-image: linear-gradient(top, #0088cc, #0044cc); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); - border-color: #0044cc #0044cc #002a80; - border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); - filter: progid:dximagetransform.microsoft.gradient(enabled=false); - color: #fff; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); } - -.SOGoTimePickerMenu HR -{ clear: both; - height: 0px; - margin: 0px; - padding: 0px; - color: #fff; - border: 0px; } \ No newline at end of file diff --git a/UI/WebServerResources/SOGoTimePicker.js b/UI/WebServerResources/SOGoTimePicker.js deleted file mode 100644 index 18efc19cc..000000000 --- a/UI/WebServerResources/SOGoTimePicker.js +++ /dev/null @@ -1,241 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - * Time picker widget interface to be added to an INPUT (this!) - * - * Available events: - * time:change -- fired once the value of the input has changed - * - */ -var SOGoTimePickerInterface = { - - div: null, - extendedButton: null, - - pos: 'bellow', - - minutes: '00', - hours: '00', - extended: false, - - mouseInside: false, - disposeHandler: null, - - bind: function () { - // Build widget - this.div = new Element("div", {'class': 'SOGoTimePickerMenu ' + this.pos}); - this.div.hide(); - document.body.appendChild(this.div); - var inner = new Element("div"); - this.div.appendChild(inner); - - var hours = new Element("div", {'class': 'hours'}); - inner.appendChild(hours); - for (var i = 0; i < 24; i++) { - var v = (i < 10)? '0' + i : i; - var content = new Element("div", {'class': 'SOGoTimePickerHour_'+v}).update(v); - content.on("click", this.onHourClick.bindAsEventListener(this)); - var span = new Element("span", {'class': 'cell'}); - span.appendChild(content); - hours.appendChild(span); - if (i == 11) { - hours = new Element("div", {'class': 'hours'}); - inner.appendChild(hours); - } - } - - var minutes = new Element("div", {'class': 'minutes min5'}); - inner.appendChild(minutes); - for (var i = 0; i < 60; i += 5) { - var v = (i < 10)? '0' + i : i; - var content = new Element("div", {'class': 'SOGoTimePickerMinute_'+v}).update(":"+v); - content.on("click", this.onMinuteClick.bindAsEventListener(this)); - var span = new Element("span", {'class': 'cell'}); - span.appendChild(content); - minutes.appendChild(span); - if (i == 25) { - minutes = new Element("div", {'class': 'minutes min5'}); - inner.appendChild(minutes); - } - } - - var minutes = new Element("div", {'class': 'minutes min1'}); - minutes.hide(); - inner.appendChild(minutes); - for (var i = 0; i < 60;) { - var v = (i < 10)? '0' + i : i; - var content = new Element("div", {'class': 'SOGoTimePickerMinute_'+v}).update(":"+v); - content.on("click", this.onMinuteClick.bindAsEventListener(this)); - var span = new Element("span", {'class': 'cell'}); - span.appendChild(content); - minutes.appendChild(span); - i++; - if (i % 5 == 0) { - minutes = new Element("div", {'class': 'minutes min1'}); - minutes.hide(); - inner.appendChild(minutes); - } - } - - var a = new Element("a", {'class': 'button'}); - a.on("click", this.toggleExtendedView.bindAsEventListener(this)); - this.extendedButton = new Element("span").update('>>'); - a.appendChild(this.extendedButton); - inner.appendChild(a); - - inner.appendChild(new Element("hr")); - - // Compute position - this.position(); - - // Register observers - this.on("click", this.toggleVisibility.bindAsEventListener(this)); - this.on("change", this.onChange.bindAsEventListener(this)); - this.on("keydown", this.onKeydown.bindAsEventListener(this)); - this.div.on("mouseenter", this.onEnter.bindAsEventListener(this)); - this.div.on("mouseleave", this.onLeave.bindAsEventListener(this)); - this.disposeHandler = $(document.body).on("click", this.onDispose.bindAsEventListener(this)); - this.disposeHandler.stop(); - - // Apply current input value if defined - this.onChange(); - }, - - setPosition: function (newPos) { - if (newPos == 'bellow' || newPos == 'above') { - this.div.removeClassName(this.pos); - this.div.addClassName(newPos); - this.pos = newPos; - this.position(); - } - }, - - position: function () { - var inputPosition = this.cumulativeOffset(); - var inputDimensions = this.getDimensions(); - var divWidth = this.div.getWidth(); - var windowWidth = window.width(); - var left = inputPosition[0]; - var arrow = -1000 + inputDimensions['width'] - 10; - if (left + divWidth > windowWidth) { - left = windowWidth - divWidth - 4; - arrow += (inputPosition[0] - left); - } - var top = inputPosition[1]; - if (this.pos == 'bellow') - top += 22; - else - top -= this.div.getHeight(); - this.div.setStyle({ top: top+"px", - left: left+"px", - backgroundPosition: arrow+'px top'}); - }, - - onHourClick: function (event) { - this.div.down('.SOGoTimePickerHour_' + this.hours).removeClassName("selected"); - this.hours = Event.findElement(event).className.substring(19); - this.div.down('.SOGoTimePickerHour_' + this.hours).addClassName("selected"); - this._updateValue(); - }, - - onMinuteClick: function (event) { - this.div.select('.SOGoTimePickerMinute_' + this.minutes).each(function(e) { e.removeClassName("selected") }); - this.minutes = Event.findElement(event).className.substring(21); - this.div.select('.SOGoTimePickerMinute_' + this.minutes).each(function(e) { e.addClassName("selected") }); - this._updateValue(); - this.div.hide(); - }, - - toggleExtendedView: function (event) { - this.extended = !this.extended; - if (this.extended) { - this.extendedButton.update('<<'); - this.div.select("DIV.min5").invoke('hide'); - this.div.select("DIV.min1").invoke('show'); - } - else { - this.extendedButton.update('>>'); - this.div.select("DIV.min1").invoke('hide'); - this.div.select("DIV.min5").invoke('show'); - } - if (this.pos == 'above') - this.position(); - }, - - toggleVisibility: function (event) { - if (this.div.visible()) - this.div.hide(); - else { - $$('DIV.SOGoTimePickerMenu').invoke('hide'); - this.div.show(); - this.disposeHandler.start(); - } - Event.stop(event); - }, - - onChange: function (event) { - this.div.down('.SOGoTimePickerHour_' + this.hours).removeClassName("selected"); - this.div.select('.SOGoTimePickerMinute_' + this.minutes).each(function(e) { e.removeClassName("selected") }); - - var matches = this.value.match(/([0-9]{1,2}):?([0-9]{2})/); - if (matches) { - this.hours = matches[1]; - this.minutes = matches[2] || '0'; - if (parseInt(this.hours, 10) > 23) this.hours = 23; - if (parseInt(this.minutes, 10) > 59) this.minutes = 59; - if (this.minutes % 5 == 0) { - if (this.extended) - this.toggleExtendedView(); - } - else if (!this.extended) - this.toggleExtendedView(); - - if (this.hours.length < 2) this.hours = '0' + this.hours; - if (this.minutes.length < 2) this.minutes = '0' + this.minutes; - this.div.down('.SOGoTimePickerHour_' + this.hours).addClassName("selected"); - this.div.select('.SOGoTimePickerMinute_' + this.minutes).each(function(e) { e.addClassName("selected") }); - } - - this._updateValue(true); - }, - - onKeydown: function (event) { - this.div.hide(); - this.disposeHandler.stop(); - if (event.metaKey == 1 || event.ctrlKey == 1 || - event.keyCode == Event.KEY_TAB || - event.keyCode == Event.KEY_BACKSPACE) - return true; - if (event.keyCode > 57 && // ignore non-numeric characters - (event.keyCode < 96 || event.keyCode > 105) && // but allow entries from keypad - event.keyCode != 186 && event.keyCode != 59 || - (event.keyCode == 186 || event.keyCode == 59) && this.value.indexOf(":") >= 0) - Event.stop(event); - }, - - onEnter: function (event) { - this.mouseInside = true; - this.disposeHandler.stop(); - }, - - onLeave: function (event) { - this.mouseInside = false; - this.disposeHandler.start(); - }, - - onDispose: function (event) { - if (!this.mouseInside) { - this.div.hide(); - this.disposeHandler.stop(); - Event.stop(event); - } - }, - - _updateValue: function (force) { - var value = this.hours + ':' + this.minutes; - if (force || value != this.value) { - this.value = value; - this.fire("time:change"); - } - } -}; diff --git a/UI/WebServerResources/SchedulerUI.css b/UI/WebServerResources/SchedulerUI.css deleted file mode 100644 index 6a03ffbc0..000000000 --- a/UI/WebServerResources/SchedulerUI.css +++ /dev/null @@ -1,1562 +0,0 @@ -DIV#leftPanel -{ position: absolute; - top: 80px; - left: 0px; - width: 19.25em; - bottom: 0px; - background-color: #CCDDEC; - overflow: auto; - overflow-x: hidden; } - -DIV#schedulerTabs -{ position: absolute; - top: 4px; - left: 1px; - right: 0px; - height: 186px; } - -DIV#schedulerTabs .tabs -{ right: 5px; } - -DIV#schedulerTabs .tab -{ left: 0px; - right: 0px; } - -DIV#calendarSelectorButtons -{ padding-left: 6px; } - -DIV.colorBox -{ display: inline-block; } - -TD DIV.colorBox, TD DIV.colorBox:hover -{ border-color: #fff; } - -UL#calendarList -{ cursor: default; - clear: left; - margin: 0px; - padding: 0px; - list-style-type: none; - list-style-image: none; - -moz-user-select: none; - -khtml-user-select: none; } - -UL#calendarList LI -{ cursor: pointer; - width: 100%; - white-space: nowrap; - line-height: 2em; - padding-left: 10px; } - -#calendarList .badge -{ margin-left: 4px; } - -#tasksList .duelater, -#tasksList .duetoday, -#tasksList .overdue -{ font-weight: bold; } - -#tasksList .overdue, -#tasksList .important -{ color: #f00 !important; } - -#tasksList .low -{ color: #666 !important; } - -#tasksList .duetoday -{ color: #00f !important; } - -#tasksList .completed span -{ text-decoration: line-through; - color: #000; } - -#tasksList .important SPAN -{ background-image: url(important.png); - background-repeat: no-repeat; - background-position: 3px 2px; - padding-left: 10px; -} -#tasksList SPAN -{ padding-left: 2px; } - -#tasksList ._selected.overdue -{ color: #fff !important; - background-color: #f00 !important; } - -#tasksList ._selected.duetoday -{ color: #fff !important; - background-color: #00f !important; } - -#tasksList ._selected.duelater, -#tasksList ._selected.completed -{ color: #fff !important; - background-color: #9ABCD8 !important; } - -DIV#rightPanel -{ position: absolute; - top: 80px; - left: 19.25em; - right: 0px; - bottom: 0px; - margin-left: 5px; - overflow: hidden; } - -/* top lists in tabs */ -DIV#eventsListView, -DIV#tasksListView -{ cursor: default; - background-color: #FFFFFF; - overflow: hidden; - overflow-y: auto; } - -DIV#calendarView -{ position: absolute; - background-color: #fff; - top: 18em; - margin-top: 5px; - bottom: 0px; - width: 100%; - border-top: 1px solid #aaa; - border-left: 1px solid #aaa; - -moz-user-select: none; - -khtml-user-select: none; } - -DIV#calendarView A -{ text-decoration: none; - font: inherit; - color: inherit; } - -#verticalDragHandle -{ cursor: e-resize; - border: 0px; - top: 81px; - bottom: 0px; - left: 19.25em; - width: 5px; } - -#rightDragHandle -{ cursor: n-resize; - top: 18em; - left: 0px; - right: 0px; - height: 5px; } - -DIV#dateSelectorView -{ overflow: hidden; } - -#dateSelector -{ margin: 0px auto; - background-color: #fff; - border-top: 1px solid #909090 !important; - border-left: 1px solid #FFFFFF !important; - border-bottom: 1px solid #909090 !important; - border-right: 1px solid #909090 !important; } - -#dateSelector > .header -{ background-color: #efefef; - width: 100%; - white-space: nowrap; - vertical-align: middle; - text-align: center; - padding: .2em 0px; - margin: 0px; - border: 0px; } - -#dateSelector > .header #leftArrow -{ float: left; - margin-top: 3px; } - -#dateSelector > .header #rightArrow -{ float: right; - margin-top: 3px; - margin-right: 2px; } - -#dateSelector > .header SPAN -{ cursor: default; - font-size: medium; - vertical-align: middle; - font-weight: bold; - border: 1px solid transparent; } - -#dateSelector > .header SPAN:hover -{ border-left: 1px solid #fff; - border-top: 1px solid #fff; - border-right: 1px solid #ccc; - border-bottom: 1px solid #ccc; } - -#dateSelector .dayOfWeek -{ color: #00f; } - -#dateSelector TABLE, -#dateSelector TABLE TABLE -{ border-collapse: collapse; - text-align: center; - margin: 0px auto; - width: 100%; } - -TABLE#dateSelectorTable -{ margin-bottom: 5px; } - -TABLE#dateSelectorTable TD TABLE TD -{ width: 5px; /* temp hack */ } - -TABLE#dateSelectorTable TD TABLE TD.activeDay, -TABLE#dateSelectorTable TD TABLE TD.inactiveDay, -TABLE#dateSelectorTable TD TABLE TD.dayOfToday -{ width: 100%; } - -#dateSelector TABLE TABLE TD.activeDay, -#dateSelector TABLE TABLE TD.inactiveDay, -#dateSelector TABLE TABLE TD.dayOfToday -{ cursor: pointer; - margin: 0px; - padding: 0px; - border: 1px solid #fff; } - -#dateSelectorTable TABLE TD.activeDay:hover, -#dateSelectorTable TABLE TD.inactiveDay:hover -{ border: 1px solid #CCDDEC; } - -#dateSelectorTable TABLE TD.activeDay:active, -#dateSelectorTable TABLE TD.inactiveDay:active -{ background-color: #ddd; } - -#dateSelectorTable TD SPAN -{ display: block; - color: #000; - background: inherit; } - -#dateSelector TD.inactiveDay SPAN -{ color: #dedfde; } - -#dateSelector TD.dayOfToday -{ background-color: #CCDDEC; - border: 1px solid #CCDDEC; } - -#dateSelectorTable TABLE TD._selected SPAN -{ color: #fff; } - -#dateSelectorTable TD.activeDay + TD, -#dateSelectorTable TD.inactiveDay + TD, -#dateSelectorTable TD.dayOfToday + TD -{ visibility: hidden; - display: none; } - -TABLE#eventsList, -TABLE#tasksList -{ width: 100%; } - -TABLE#eventsList .colorBox -{ margin-right: 4px; } - -#eventsList TD.headerTitle, -#eventsList TD.headerDateTime -{ width: 30%; } - -#tasksList .headerPriority -{ width: 80px;} - -TABLE#eventsList TD, -TABLE#eventsList TH, -TABLE#tasksList TD, -TABLE#tasksList TH -{ overflow: hidden; - line-height: 1.5em; - white-space: nowrap; } /* pre, normal, nowrap */ - -TABLE#eventsList TH, -TABLE#tasksList TH -{ white-space: pre; } - -TABLE#tasksList TD#taskCompletedHeader -{ text-align: center; - width: 20px; } - -TABLE#eventsList THEAD TD:last-child, -TABLE#tasksList THEAD TD:last-child -{ border-right: 0px; } - -.filterPanel, -#schedulerTabs .tab label -{ display: block; - margin: 0; - padding: 0 0 5px 5px; - background-color: #eee; - background-color: #E6E7E6; } - -DIV#eventDialog -{ width: 200px; } - -DIV#eventDialog H1, -DIV#eventDialog P -{ font-size: 13px; - margin: 0; - padding: 0; } - -DIV#eventDialog SPAN.label -{ color: #444; } - -DIV#eventDialog .description -{ margin-top: 1em; - font-size: 11px; - max-height: 125px; - overflow: auto; - border-top: 1px solid #eee; } - -._unfocused#dateSelector TD._selected, -UL._unfocused > LI._selected, -TABLE._unfocused#eventsList TR._selected TD -{ background-color: #B3CCE2 !important; - color: #fff !important; } - -SPAN.dayCellLabel -{ color: #77a; - font-weight: bold; } - -SPAN.daysHeader, -SPAN.weeksHeader, -SPAN.monthsHeader -{ display: block; - white-space: nowrap; - text-align: center; - background-color: #DFDFDF; - overflow: hidden; - width: 100%; - margin: 0px; - height: 3em; - padding: 2px 0px; - border-bottom: 1px solid #ccc; } - -SPAN.daysHeader SPAN, -SPAN.weeksHeader SPAN, -SPAN.monthsHeader SPAN -{ font-size: large; - margin: .1em; - padding: 6px 12px; - text-align: center; - line-height: 1.5em; - border: 1px solid transparent; - vertical-align: top; } - -SPAN.daysHeader A, -SPAN.weeksHeader A, -SPAN.monthsHeader A -{ border: 1px solid transparent; - line-height: 1.5em; - padding: 0px 0.7em; } - -.day1 A:hover, -.week1 A:hover, -.month1 A:hover -{ border-top: 1px solid #fff; - border-left: 1px solid #fff; - border-bottom: 1px solid #828482; - border-right: 1px solid #828482; } - -.day1 A:active, -.week1 A:active, -.month1 A:active -{ border-top: 1px solid #828482; - border-left: 1px solid #828482; - border-bottom: 1px solid #fff; - border-right: 1px solid #fff; } - -#listCollapse -{ position: absolute; - top: .2em; - right: 0; - margin: 0.5em 1em; } - -#listCollapse img -{ position: absolute; } - -#listCollapse img.collapse -{ clip: rect(0 18px 18px 0); - left: 0; - top: 0; } - -#listCollapse img.collapse:hover -{ clip: rect(0 36px 18px 18px); - left: -18px; } - -#listCollapse img.rise -{ clip: rect(18px 18px 36px 0); - left: 0; - top: -18px; } - -#listCollapse img.rise:hover -{ clip: rect(18px 36px 36px 18px); - left: -18px; } - -DIV#calendarHeader, -DIV#daysView -{ position: absolute; - top: 0px; - left: 0px; } - -DIV#daysView -{ top: 97px; - bottom: 0px; - border-top: 1px solid #ccc; - overflow: auto; - overflow-x: hidden; - right: 0px; } - -DIV#calendarHeader -{ top: 25px; - border: 0px; - height: 85px; - right: 0px; } - -DIV#calendarHeader DIV.calendarLabels, -DIV#calendarHeader DIV.dayLabels, -DIV#calendarHeader DIV.days -{ position: absolute; - border-right: 1px solid #ccc; - border-top: 1px solid #ccc; - left: 50px; - /* 'right' is computed from JS code when daysView is first drawn */ - overflow: hidden; } - -DIV#calendarHeader DIV.calendarLabels -{ top: 11px; - height: 20px; - border-left: 1px solid #ccc; - text-align: center; - font-size:150%; -} -.calendarsToDisplay -{ border-top: 2px solid #fff; } -DIV#calendarHeader DIV.dayLabels -{ top: 32px; - height: 35px; } - -DIV#calendarHeader DIV.dayLabels DIV.day -{ text-align: center; - color: #666; - background-color: #E7E7E7; } - -DIV#calendarHeader SPAN.dayOfWeek -{ font-size: medium; } - -DIV#calendarHeader DIV.dayLabels -{ cursor: default; } - -DIV#calendarHeader DIV.days -{ cursor: pointer; - bottom: 0px; - top: 67px; - z-index:0; - border-bottom:1px solid #ccc; - background:white; - } - -DIV#calendarHeader DIV.day, -DIV#daysView DIV.day -{ position: absolute; - border-left: 1px solid #ccc; } - -DIV#calendarHeader DIV.day -{ height: 100%; } - -DIV#calendarHeader DIV.days DIV.day -{ overflow: auto; - overflow-x: hidden; } - -.menu LI.currentMonth, -.menu LI.currentYear -{ border-top: 1px solid #aaa; - border-left: 1px solid #aaa; - border-bottom: 1px solid #fff; - border-right: 1px solid #fff; - background-color: #ccc; - color: #222; } - -DIV.eventView -{ display: block; - overflow: hidden; - white-space: nowrap; - border: 1px solid #000; } - -/* new draggable presentation */ - -DIV#daysView DIV.hours -{ display: inline-block; - position: relative; - float: left; - top: 0px; - left: 0; - height: 960px; - width: 50px; } - -DIV#daysView DIV.hour -{ position: relative; - left: 0px; - top: 0px; - padding-top: 2px; - padding-right: 2px; - text-align: right; - right: 0px; - height: 37px; - font-weight: bold; - border-bottom: 1px solid #ccc; } - -DIV#daysView DIV.days -{ position: relative; - left: 0; - right: 0; - top: 0; - margin-left: 50px; } - -DIV.multicolumnDayView DIV.lastDayUser -{ border-right: 1px solid #ccc; } - -DIV.monthView -{ position: absolute; - left: .5em; - top: 40px; - right: 1em; - bottom: 1em; - min-width: 20em; - min-height: 25em; } - -DIV.monthView > DIV, -DIV.monthView > DIV.days > DIV -{ position: absolute; } - -DIV.monthView > DIV.headerDay -{ text-align: center; - cursor: default; - padding-top: .5em; - border-left: 1px solid #909090 !important; - border-top: 1px solid #909090 !important; - top: 0px; - color: #666; - height: 1.5em; - font-weight: bold; - background-color: #E7E7E7; } - -DIV.dayOfAnotherMonth -{ background-color: #e7efef; } - -DIV.monthView DIV.dayHeader -{ margin-right: 0px; - height: 20px; - padding-top: 2px; - padding-right: 2px; - text-align: right; - cursor: pointer; - color: #666; - -moz-user-select: none; - } - -DIV#monthDaysView DIV.selectedDay DIV.dayHeader -{ font-weight: bold; } - -DIV.monthView DIV.days -{ top: 2em; - cursor: pointer; - bottom: 0px; - left: 0px; - right: 0px; - } - -DIV.monthView DIV.day -{ position: absolute; - border-left: 1px solid #909090; - border-top: 1px solid #909090; - min-height: 40px; - overflow: auto; - overflow-x: hidden; } - -DIV#daysView DIV.day DIV.clickableHourCell -{ cursor: pointer; - height: 39px; - background-color: #fff; - border-bottom: 1px solid #ccc; } - -DIV#calendarHeader DIV.days DIV.weekEndDay, -DIV#daysView DIV.day DIV.clickableHourCell.outOfDay, -DIV#daysView DIV.weekEndDay DIV.clickableHourCell, -DIV#daysView DIV.weekEndDay DIV.clickableHourCell.outOfDay -{ background-color: #e6e7e6; } - -DIV#monthDaysView DIV.dayOfToday, -DIV.daysViewFor7Days#calendarHeader DIV.days DIV.dayOfToday, -DIV.daysViewFor7Days#daysView DIV.dayOfToday DIV.clickableHourCell -{ background-color: #d6dfe9; } - -DIV.daysViewFor7Days#daysView DIV.dayOfToday DIV.clickableHourCell.outOfDay -{ background-color: #ccddec; } - -DIV.daysViewFor7Days#calendarHeader DIV.days DIV.selectedDay, -DIV.daysViewFor7Days#daysView DIV.selectedDay DIV.clickableHourCell, -DIV#monthDaysView DIV.selectedDay -{ background-color: #ffe79c; } - -DIV.daysViewFor7Days#calendarHeader DIV.days DIV.selectedDay.weekEndDay, -DIV.daysViewFor7Days#daysView DIV.selectedDay.weekEndDay DIV.clickableHourCell, -DIV.daysViewFor7Days#daysView DIV.selectedDay DIV.clickableHourCell.outOfDay -{ background-color: #f5dd92; } - -.minutes15, .minutes30, .minutes45 -{ display: block; - height: 9px; - border-bottom: 1px dotted #eee; } - -.minutes30 -{ border-bottom: 1px dotted #ccc; } - -DIV.weekOf4 -{ height: 25%; } - -DIV.weekOf5 -{ height: 20%; } - -DIV.weekOf6 -{ height: 16.666667%; } - -DIV.monthView DIV.week0of4, -DIV.monthView DIV.week0of5, -DIV.monthView DIV.week0of6 -{ top: 0px; } - -DIV.monthView DIV.week1of4 -{ top: 25%; } - -DIV.monthView DIV.week2of4 -{ top: 50%; } - -DIV.monthView DIV.week3of4 -{ top: 75%; } - -DIV.monthView DIV.week1of5 -{ top: 20%; } - -DIV.monthView DIV.week2of5 -{ top: 40%; } - -DIV.monthView DIV.week3of5 -{ top: 60%; } - -DIV.monthView DIV.week4of5 -{ top: 80%; } - -DIV.monthView DIV.week1of6 -{ top: 16.666667%; } - -DIV.monthView DIV.week2of6 -{ top: 33.333333%; } - -DIV.monthView DIV.week3of6 -{ top: 50%; } - -DIV.monthView DIV.week4of6 -{ top: 66.666667%; } - -DIV.monthView DIV.week5of6 -{ top: 83.333333%; } - -DIV.monthView DIV.week3 -{ top: 45%; } - -DIV.monthView DIV.week4 -{ top: 60%; } - -DIV.monthView DIV.week5 -{ top: 75%; } - -DIV.monthView DIV.week6 -{ top: 90%; } - -DIV.monthView DIV.week3of4, -DIV.monthView DIV.week4of5, -DIV.monthView DIV.week5of6 -{ border-bottom: 2px solid #909090 !important; } - -DIV.daysViewFor1Days DIV.day -{ width: 100%; } - -DIV.monthView DIV.headerDay, -DIV.monthView DIV.day, -DIV.daysViewFor7Days DIV.day -{ width: 14.2857%; } - -DIV.monthView DIV.day0, -DIV.daysViewFor7Days DIV.day0 -{ left: 0px; } - -DIV.monthView DIV.day1, -DIV.daysViewFor7Days DIV.day1 -{ left: 14.2857%; } - -DIV.monthView DIV.day2, -DIV.daysViewFor7Days DIV.day2 -{ left: 28.5714%; } - -DIV.monthView DIV.day3, -DIV.daysViewFor7Days DIV.day3 -{ left: 42.8571%; } - -DIV.monthView DIV.day4, -DIV.daysViewFor7Days DIV.day4 -{ left: 57.1428%; } - -DIV.monthView DIV.day5, -DIV.daysViewFor7Days DIV.day5 -{ left: 71.4285%; } - -DIV.monthView DIV.day6, -DIV.daysViewFor7Days DIV.day6 -{ left: 85.7142%; } - -/* "left" and "width" for #daysView DIV.event are computed in JS code */ -#daysView DIV.event -{ cursor: default; - margin-right: 1px; - position: absolute; } - -DIV#daysView DIV.event.starts0 -{ top: 0px; } - -DIV#daysView DIV.event.starts1 -{ top: 10px; } - -DIV#daysView DIV.event.starts2 -{ top: 20px; } - -DIV#daysView DIV.event.starts3 -{ top: 30px; } - -DIV#daysView DIV.event.starts4 -{ top: 40px; } - -DIV#daysView DIV.event.starts5 -{ top: 50px; } - -DIV#daysView DIV.event.starts6 -{ top: 60px; } - -DIV#daysView DIV.event.starts7 -{ top: 70px; } - -DIV#daysView DIV.event.starts8 -{ top: 80px; } - -DIV#daysView DIV.event.starts9 -{ top: 90px; } - -DIV#daysView DIV.event.starts10 -{ top: 100px; } - -DIV#daysView DIV.event.starts11 -{ top: 110px; } - -DIV#daysView DIV.event.starts12 -{ top: 120px; } - -DIV#daysView DIV.event.starts13 -{ top: 130px; } - -DIV#daysView DIV.event.starts14 -{ top: 140px; } - -DIV#daysView DIV.event.starts15 -{ top: 150px; } - -DIV#daysView DIV.event.starts16 -{ top: 160px; } - -DIV#daysView DIV.event.starts17 -{ top: 170px; } - -DIV#daysView DIV.event.starts18 -{ top: 180px; } - -DIV#daysView DIV.event.starts19 -{ top: 190px; } - -DIV#daysView DIV.event.starts20 -{ top: 200px; } - -DIV#daysView DIV.event.starts21 -{ top: 210px; } - -DIV#daysView DIV.event.starts22 -{ top: 220px; } - -DIV#daysView DIV.event.starts23 -{ top: 230px; } - -DIV#daysView DIV.event.starts24 -{ top: 240px; } - -DIV#daysView DIV.event.starts25 -{ top: 250px; } - -DIV#daysView DIV.event.starts26 -{ top: 260px; } - -DIV#daysView DIV.event.starts27 -{ top: 270px; } - -DIV#daysView DIV.event.starts28 -{ top: 280px; } - -DIV#daysView DIV.event.starts29 -{ top: 290px; } - -DIV#daysView DIV.event.starts30 -{ top: 300px; } - -DIV#daysView DIV.event.starts31 -{ top: 310px; } - -DIV#daysView DIV.event.starts32 -{ top: 320px; } - -DIV#daysView DIV.event.starts33 -{ top: 330px; } - -DIV#daysView DIV.event.starts34 -{ top: 340px; } - -DIV#daysView DIV.event.starts35 -{ top: 350px; } - -DIV#daysView DIV.event.starts36 -{ top: 360px; } - -DIV#daysView DIV.event.starts37 -{ top: 370px; } - -DIV#daysView DIV.event.starts38 -{ top: 380px; } - -DIV#daysView DIV.event.starts39 -{ top: 390px; } - -DIV#daysView DIV.event.starts40 -{ top: 400px; } - -DIV#daysView DIV.event.starts41 -{ top: 410px; } - -DIV#daysView DIV.event.starts42 -{ top: 420px; } - -DIV#daysView DIV.event.starts43 -{ top: 430px; } - -DIV#daysView DIV.event.starts44 -{ top: 440px; } - -DIV#daysView DIV.event.starts45 -{ top: 450px; } - -DIV#daysView DIV.event.starts46 -{ top: 460px; } - -DIV#daysView DIV.event.starts47 -{ top: 470px; } - -DIV#daysView DIV.event.starts48 -{ top: 480px; } - -DIV#daysView DIV.event.starts49 -{ top: 490px; } - -DIV#daysView DIV.event.starts50 -{ top: 500px; } - -DIV#daysView DIV.event.starts51 -{ top: 510px; } - -DIV#daysView DIV.event.starts52 -{ top: 520px; } - -DIV#daysView DIV.event.starts53 -{ top: 530px; } - -DIV#daysView DIV.event.starts54 -{ top: 540px; } - -DIV#daysView DIV.event.starts55 -{ top: 550px; } - -DIV#daysView DIV.event.starts56 -{ top: 560px; } - -DIV#daysView DIV.event.starts57 -{ top: 570px; } - -DIV#daysView DIV.event.starts58 -{ top: 580px; } - -DIV#daysView DIV.event.starts59 -{ top: 590px; } - -DIV#daysView DIV.event.starts60 -{ top: 600px; } - -DIV#daysView DIV.event.starts61 -{ top: 610px; } - -DIV#daysView DIV.event.starts62 -{ top: 620px; } - -DIV#daysView DIV.event.starts63 -{ top: 630px; } - -DIV#daysView DIV.event.starts64 -{ top: 640px; } - -DIV#daysView DIV.event.starts65 -{ top: 650px; } - -DIV#daysView DIV.event.starts66 -{ top: 660px; } - -DIV#daysView DIV.event.starts67 -{ top: 670px; } - -DIV#daysView DIV.event.starts68 -{ top: 680px; } - -DIV#daysView DIV.event.starts69 -{ top: 690px; } - -DIV#daysView DIV.event.starts70 -{ top: 700px; } - -DIV#daysView DIV.event.starts71 -{ top: 710px; } - -DIV#daysView DIV.event.starts72 -{ top: 720px; } - -DIV#daysView DIV.event.starts73 -{ top: 730px; } - -DIV#daysView DIV.event.starts74 -{ top: 740px; } - -DIV#daysView DIV.event.starts75 -{ top: 750px; } - -DIV#daysView DIV.event.starts76 -{ top: 760px; } - -DIV#daysView DIV.event.starts77 -{ top: 770px; } - -DIV#daysView DIV.event.starts78 -{ top: 780px; } - -DIV#daysView DIV.event.starts79 -{ top: 790px; } - -DIV#daysView DIV.event.starts80 -{ top: 800px; } - -DIV#daysView DIV.event.starts81 -{ top: 810px; } - -DIV#daysView DIV.event.starts82 -{ top: 820px; } - -DIV#daysView DIV.event.starts83 -{ top: 830px; } - -DIV#daysView DIV.event.starts84 -{ top: 840px; } - -DIV#daysView DIV.event.starts85 -{ top: 850px; } - -DIV#daysView DIV.event.starts86 -{ top: 860px; } - -DIV#daysView DIV.event.starts87 -{ top: 870px; } - -DIV#daysView DIV.event.starts88 -{ top: 880px; } - -DIV#daysView DIV.event.starts89 -{ top: 890px; } - -DIV#daysView DIV.event.starts90 -{ top: 900px; } - -DIV#daysView DIV.event.starts91 -{ top: 910px; } - -DIV#daysView DIV.event.starts92 -{ top: 920px; } - -DIV#daysView DIV.event.starts93 -{ top: 930px; } - -DIV#daysView DIV.event.starts94 -{ top: 940px; } - -DIV#daysView DIV.event.starts95 -{ top: 950px; } - -DIV#daysView DIV.event.lasts0 -{ height: 0px; } - -DIV#daysView DIV.event.lasts1 -{ height: 10px; } - -DIV#daysView DIV.event.lasts2 -{ height: 20px; } - -DIV#daysView DIV.event.lasts3 -{ height: 30px; } - -DIV#daysView DIV.event.lasts4 -{ height: 40px; } - -DIV#daysView DIV.event.lasts5 -{ height: 50px; } - -DIV#daysView DIV.event.lasts6 -{ height: 60px; } - -DIV#daysView DIV.event.lasts7 -{ height: 70px; } - -DIV#daysView DIV.event.lasts8 -{ height: 80px; } - -DIV#daysView DIV.event.lasts9 -{ height: 90px; } - -DIV#daysView DIV.event.lasts10 -{ height: 100px; } - -DIV#daysView DIV.event.lasts11 -{ height: 110px; } - -DIV#daysView DIV.event.lasts12 -{ height: 120px; } - -DIV#daysView DIV.event.lasts13 -{ height: 130px; } - -DIV#daysView DIV.event.lasts14 -{ height: 140px; } - -DIV#daysView DIV.event.lasts15 -{ height: 150px; } - -DIV#daysView DIV.event.lasts16 -{ height: 160px; } - -DIV#daysView DIV.event.lasts17 -{ height: 170px; } - -DIV#daysView DIV.event.lasts18 -{ height: 180px; } - -DIV#daysView DIV.event.lasts19 -{ height: 190px; } - -DIV#daysView DIV.event.lasts20 -{ height: 200px; } - -DIV#daysView DIV.event.lasts21 -{ height: 210px; } - -DIV#daysView DIV.event.lasts22 -{ height: 220px; } - -DIV#daysView DIV.event.lasts23 -{ height: 230px; } - -DIV#daysView DIV.event.lasts24 -{ height: 240px; } - -DIV#daysView DIV.event.lasts25 -{ height: 250px; } - -DIV#daysView DIV.event.lasts26 -{ height: 260px; } - -DIV#daysView DIV.event.lasts27 -{ height: 270px; } - -DIV#daysView DIV.event.lasts28 -{ height: 280px; } - -DIV#daysView DIV.event.lasts29 -{ height: 290px; } - -DIV#daysView DIV.event.lasts30 -{ height: 300px; } - -DIV#daysView DIV.event.lasts31 -{ height: 310px; } - -DIV#daysView DIV.event.lasts32 -{ height: 320px; } - -DIV#daysView DIV.event.lasts33 -{ height: 330px; } - -DIV#daysView DIV.event.lasts34 -{ height: 340px; } - -DIV#daysView DIV.event.lasts35 -{ height: 350px; } - -DIV#daysView DIV.event.lasts36 -{ height: 360px; } - -DIV#daysView DIV.event.lasts37 -{ height: 370px; } - -DIV#daysView DIV.event.lasts38 -{ height: 380px; } - -DIV#daysView DIV.event.lasts39 -{ height: 390px; } - -DIV#daysView DIV.event.lasts40 -{ height: 400px; } - -DIV#daysView DIV.event.lasts41 -{ height: 410px; } - -DIV#daysView DIV.event.lasts42 -{ height: 420px; } - -DIV#daysView DIV.event.lasts43 -{ height: 430px; } - -DIV#daysView DIV.event.lasts44 -{ height: 440px; } - -DIV#daysView DIV.event.lasts45 -{ height: 450px; } - -DIV#daysView DIV.event.lasts46 -{ height: 460px; } - -DIV#daysView DIV.event.lasts47 -{ height: 470px; } - -DIV#daysView DIV.event.lasts48 -{ height: 480px; } - -DIV#daysView DIV.event.lasts49 -{ height: 490px; } - -DIV#daysView DIV.event.lasts50 -{ height: 500px; } - -DIV#daysView DIV.event.lasts51 -{ height: 510px; } - -DIV#daysView DIV.event.lasts52 -{ height: 520px; } - -DIV#daysView DIV.event.lasts53 -{ height: 530px; } - -DIV#daysView DIV.event.lasts54 -{ height: 540px; } - -DIV#daysView DIV.event.lasts55 -{ height: 550px; } - -DIV#daysView DIV.event.lasts56 -{ height: 560px; } - -DIV#daysView DIV.event.lasts57 -{ height: 570px; } - -DIV#daysView DIV.event.lasts58 -{ height: 580px; } - -DIV#daysView DIV.event.lasts59 -{ height: 590px; } - -DIV#daysView DIV.event.lasts60 -{ height: 600px; } - -DIV#daysView DIV.event.lasts61 -{ height: 610px; } - -DIV#daysView DIV.event.lasts62 -{ height: 620px; } - -DIV#daysView DIV.event.lasts63 -{ height: 630px; } - -DIV#daysView DIV.event.lasts64 -{ height: 640px; } - -DIV#daysView DIV.event.lasts65 -{ height: 650px; } - -DIV#daysView DIV.event.lasts66 -{ height: 660px; } - -DIV#daysView DIV.event.lasts67 -{ height: 670px; } - -DIV#daysView DIV.event.lasts68 -{ height: 680px; } - -DIV#daysView DIV.event.lasts69 -{ height: 690px; } - -DIV#daysView DIV.event.lasts70 -{ height: 700px; } - -DIV#daysView DIV.event.lasts71 -{ height: 710px; } - -DIV#daysView DIV.event.lasts72 -{ height: 720px; } - -DIV#daysView DIV.event.lasts73 -{ height: 730px; } - -DIV#daysView DIV.event.lasts74 -{ height: 740px; } - -DIV#daysView DIV.event.lasts75 -{ height: 750px; } - -DIV#daysView DIV.event.lasts76 -{ height: 760px; } - -DIV#daysView DIV.event.lasts77 -{ height: 770px; } - -DIV#daysView DIV.event.lasts78 -{ height: 780px; } - -DIV#daysView DIV.event.lasts79 -{ height: 790px; } - -DIV#daysView DIV.event.lasts80 -{ height: 800px; } - -DIV#daysView DIV.event.lasts81 -{ height: 810px; } - -DIV#daysView DIV.event.lasts82 -{ height: 820px; } - -DIV#daysView DIV.event.lasts83 -{ height: 830px; } - -DIV#daysView DIV.event.lasts84 -{ height: 840px; } - -DIV#daysView DIV.event.lasts85 -{ height: 850px; } - -DIV#daysView DIV.event.lasts86 -{ height: 860px; } - -DIV#daysView DIV.event.lasts87 -{ height: 870px; } - -DIV#daysView DIV.event.lasts88 -{ height: 880px; } - -DIV#daysView DIV.event.lasts89 -{ height: 890px; } - -DIV#daysView DIV.event.lasts90 -{ height: 900px; } - -DIV#daysView DIV.event.lasts91 -{ height: 910px; } - -DIV#daysView DIV.event.lasts92 -{ height: 920px; } - -DIV#daysView DIV.event.lasts93 -{ height: 930px; } - -DIV#daysView DIV.event.lasts94 -{ height: 940px; } - -DIV#daysView DIV.event.lasts95 -{ height: 950px; } - -DIV#daysView DIV.event.lasts96 -{ height: 960px; } - -DIV.event > DIV.eventInside -{ position: absolute; - overflow: hidden; - top: 0px; - bottom: 0px; - left: 0px; - right: 0px; - -webkit-border-radius: 2px; - border-radius: 2px; - cursor:move; } - -DIV.eventInside SPAN.location -{ font-size: smaller; } - -DIV.gradient, DIV.text -{ position: absolute; - top: 1px; - left: 1px; - right: 1px; - bottom: 1px; - overflow: hidden; } - -DIV.gradient > IMG -{ position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - height: 100%; - min-height: 15px; /* for 15-minute events */ - width: 100%; } - -DIV.event._selected > DIV.eventInside > DIV.gradient -{ display: none; } - -DIV.text SPAN.icons -{ float: right; } - -DIV.text SPAN IMG -{ vertical-align: middle; } - -DIV#calendarHeader DIV.event, -DIV.monthView DIV.event -{ position: relative; - cursor: default; - margin-right: 0px; - left: 0px; - right: 0px; - margin-right: 1px; - white-space: nowrap; - height: 20px; } - -DIV.eventInside.tentative, -DIV.eventInside.needs-action -{ -moz-opacity: 0.7; - opacity: 0.7; } - -DIV.eventInside.needs-action -{ border: 2px dotted #000; } - -DIV.eventInside.tentative DIV.text, -DIV.eventInside.needs-action DIV.text -{ top: 0px; - left: 2px; } - -DIV.eventInside.delegated, -DIV.eventInside.declined -{ -moz-opacity: 0.4; - opacity: 0.4; } - -/* event DnD */ -DIV.event DIV.topDragGrip, -DIV.event DIV.bottomDragGrip -{ position: absolute; - border: 0px; - left: 1px; - right: 1px; - height: 5px; - background-repeat: no-repeat; - background-position: center; } - -DIV.event DIV.topDragGrip -{ top: 1px; } - -DIV.event DIV.bottomDragGrip -{ bottom: 1px; } - -DIV.event DIV.leftDragGrip, -DIV.event DIV.rightDragGrip -{ position: absolute; - border: 0px; - top: 4px; - height: 11px; - width: 3px; - background-repeat: no-repeat; - background-position: center; } - -DIV.event DIV.leftDragGrip -{ left: 1px; } - -DIV.event DIV.rightDragGrip -{ right: 1px; } - -#daysView DIV.event.dragging -{ left: 0px !important; - right: 0px !important; } - -DIV.event.dragging > DIV.eventInside -{ -moz-opacity: 1 !important; - border: 1px dashed #555; - opacity: 1 !important; - background-color: transparent !important; } - -DIV.event.dragging DIV.text -{ color: #555; - top: 0px; - left: 0px; } - -DIV.event.dragging IMG, -DIV.event.dragging DIV.topDragGrip, -DIV.event.dragging DIV.bottomDragGrip, -DIV.event.dragging DIV.leftDragGrip, -DIV.event.dragging DIV.rightDragGrip -{ display: none; } - -DIV.event.draggable:hover DIV.topDragGrip -{ cursor: n-resize; - background-image: url(event-grippy-top.png); } - -DIV.event.draggable:hover DIV.bottomDragGrip -{ cursor: s-resize; - background-image: url(event-grippy-bottom.png); } - -DIV.event.draggable:hover DIV.leftDragGrip -{ cursor: w-resize; - background-image: url(event-grippy-vertical.png); } - -DIV.event.draggable:hover DIV.rightDragGrip -{ cursor: e-resize; - background-image: url(event-grippy-vertical.png); } - -#daysView DIV.eventDragGhost -{ left: 0px; right: 0px; } - -#daysView DIV.eventDragGhost > DIV.eventInside -{ padding: 0px; - border-left: 1px solid #555; - border-right: 1px solid #555; -} - -#daysView DIV.eventDragGhost.startGhost > DIV.eventInside -{ border-top: 1px solid #555; } - -#daysView DIV.eventDragGhost.endGhost > DIV.eventInside -{ border-bottom: 1px solid #555; } - -#monthDaysView DIV.eventDragGhost, -#calendarHeader DIV.eventDragGhost -{ position: absolute !important; - color: #fff; - left: 0px; - right: 0px; - margin-right: 1px; - border-top: 1px solid #555; - border-bottom: 1px solid #555; } - -#monthDaysView DIV.eventDragGhost -{ top: 21px; } - -#calendarHeader DIV.eventDragGhost -{ top: 0px; } - -#monthDaysView DIV.eventDragGhost.startGhost, -#calendarHeader DIV.eventDragGhost.startGhost -{ border-left: 1px solid #555; } - -#monthDaysView DIV.eventDragGhost.endGhost, -#calendarHeader DIV.eventDragGhost.endGhost -{ border-right: 1px solid #555; } - -#ghostStartHour, -#ghostEndHour -{ position: absolute; - width: 100%; - vertical-align: baseline; - height: 14px; - left: 0px; - color: #222; - text-align: center; } - -#ghostStartHour -{ top: -14px; } - -#ghostEndHour -{ bottom: -14px; } - -DIV.nowLineDisplay -{ position: relative; - width: 100%; - height: 2px; - background: red; - z-index: 49; } - -DIV#freeBusyReplicas INPUT.textField -{ width: 7em; } -DIV#freeBusyReplicas a.calendarButton -{ right: 0px; } -DIV#freeBusyReplicas DIV -{ display: inline-block; height: 2em; } -TD.attendees A.button -{ float: left; left: 19px; margin-top: 5px; } - -DIV#calendarContent .alert-box { - color:#555; - border-radius:10px; - font-family:Tahoma,Geneva,Arial,sans-serif;font-size:11px; - padding:10px 10px 10px 36px; - margin:10px; -} - -DIV#calendarContent .alert-box span { - font-weight:bold; - text-transform:uppercase; -} - -.error { - background:#ffecec url('error.png') no-repeat 10px 50%; - border:1px solid #f5aca6; -} -.success { - background:#e9ffd9 url('success.png') no-repeat 10px 50%; - border:1px solid #a6ca8a; -} -.warning { - background:#fff8c4 url('warning.png') no-repeat 10px 50%; - border:1px solid #f2c779; -} -.notice { - background:#e3f7fc url('notice.png') no-repeat 10px 50%; - border:1px solid #8ed9f6; -} - -DIV#DnDVisualEvents -{ background-image: url(event7.png); } - -DIV#DnDVisualTasks -{ background-image: url(task.png); } - -DIV#DnDVisualEvents, DIV#DnDVisualTasks -{ - background-repeat: no-repeat; - background-position: 4px 2px; - width: 5px; - height: 20px; - padding-left: 24px; - padding-top: 5px; -} - -#DnDLeftPanelImage -{ - position:absolute; - z-index:1; - left:0; - top:0; -} diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js deleted file mode 100644 index 22ba2f8c2..000000000 --- a/UI/WebServerResources/SchedulerUI.js +++ /dev/null @@ -1,3943 +0,0 @@ -var eventListFilter = 'view_today'; -var taskListFilter = 'view_today'; - -var listOfSelection = null; -var selectedCalendarCell = null; - -var showCompletedTasks; - -var currentDay = ''; -var selectedDayNumber = -1; -var selectedDayDate = ''; - -var cachedDateSelectors = []; - -var contactSelectorAction = 'calendars-contacts'; - -var eventsToDelete = []; -var calendarsOfEventsToDelete = []; - -var usersRightsWindowHeight = 215; -var usersRightsWindowWidth = 502; - -var calendarEvents = null; - -var preventAutoScroll = false; - -var userStates = [ "needs-action", "accepted", "declined", "tentative", "delegated" ]; - -var calendarHeaderAdjusted = false; -var recurrenceBool = false; - -var categoriesStyles = new Hash(); -var categoriesStyleSheet = null; - -var clipboard = null; -var eventsToCopy = []; - -var refreshViewCheckTimer; - -// This should probably go in the generic.js -function printView() { - var flag = false; - var calendarsList = $("calendarList").children; - for (var i = 0; i < calendarsList.length; i++) { - if (calendarsList[i].down("input").checked) { - flag = true; - break; - } - } - if (flag) - window.open("printView","","width=660,height=470"); - - else - showAlertDialog("Please select at least one calendar"); - - - return false; -} - -function newEvent(type, day, hour, duration) { - var folder = null; - /* if (currentView == "multicolumndayview") { - Need to find where the click register is saved - }*/ - if (UserDefaults['SOGoDefaultCalendar'] == 'personal') - folder = $("calendarList").down("li"); - else if (UserDefaults['SOGoDefaultCalendar'] == 'first') { - var list = $("calendarList"); - var inputs = list.select("input"); - for (var i = 0; i < inputs.length; i++) { - var input = inputs[i]; - if (input.checked) { - folder = input.up(); - break; - } - } - if (!folder) - folder = list.down("li"); - } - else - folder = getSelectedFolder(); - var folderID = folder.readAttribute("id"); - var urlstr = ApplicationBaseURL + folderID + "/new" + type; - var params = []; - if (!day) - day = currentDay; - params.push("day=" + day); - if (hour) - params.push("hm=" + hour); - if (duration) - params.push("duration=" + duration); - if (params.length > 0) - urlstr += "?" + params.join("&"); - - window.open(urlstr, "", "width=490,height=470,resizable=0"); - - return false; /* stop following the link */ -} - -function newEventFromWidget(sender, type) { - var day = $(sender).readAttribute("day"); - var hour = sender.readAttribute("hour"); - - newEvent.delay(0.1, type, day, hour); -} - -function minutesToHM(minutes) { - var hours = Math.floor(minutes / 60); - if (hours < 10) - hours = "0" + hours; - var mins = minutes % 60; - if (mins < 10) - mins = "0" + mins; - - return "" + hours + mins; -} - -function newEventFromDragging(controller, day, coordinates) { - var startHm; - if (controller.eventType == "multiday") - startHm = minutesToHM(coordinates.start * 15); - else - startHm = "allday"; - var lengthHm = minutesToHM(coordinates.duration * 15); - newEvent("event", day, startHm, lengthHm); -} - -function updateEventFromDragging(controller, eventCells, eventDelta, calendarID) { - if (eventDelta.dayNumber || eventDelta.start || eventDelta.duration || calendarID != 0) { - if (calendarID != 0) - var params = ("destination=" + calendarID[1] - + "&days=" + 0 - + "&start=" + eventDelta.start * 15 - + "&duration=" + eventDelta.duration * 15); - else - var params = ("destination=" + 0 - + "&days=" + eventDelta.dayNumber - + "&start=" + eventDelta.start * 15 - + "&duration=" + eventDelta.duration * 15); - // log("eventCells: " + eventCells.length); - var eventCell = eventCells[0]; - // log(" time: " + eventCell.recurrenceTime); - // log(" exception: " + eventCell.isException); - recurrenceBool = false; - if (calendarID == 0) { - recurrenceBool = true; - } - if (eventCell.recurrenceTime && !eventCell.isException) - _editRecurrenceDialog(eventCell, "confirmAdjustment", params); - else { - var urlstr = (ApplicationBaseURL + "/" + eventCell.calendar + "/" + eventCell.cname); - if (eventCell.recurrenceTime && recurrenceBool) - urlstr += "/occurence" + eventCell.recurrenceTime; - urlstr += ("/adjust?" + params); - // log(" urlstr: " + urlstr); - triggerAjaxRequest(urlstr, updateEventFromDraggingCallback); - } - } -} - -function performEventAdjustment(folder, event, recurrence, params) { - var urlstr = ApplicationBaseURL + "/" + folder + "/" + event; - if (recurrence && recurrenceBool) - urlstr += "/" + recurrence; - urlstr += "/adjust" + generateQueryString(params); - triggerAjaxRequest(urlstr, updateEventFromDraggingCallback); -} - -function updateEventFromDraggingCallback(http) { - if (http.readyState == 4) { - if (isHttpStatus204(http.status)) { - refreshEventsAndDisplay(); - } - else { - var response = http.responseText.evalJSON(true); - showAlertDialog(response['message']); - } - } -} - -function updateTaskFromDraggingCallback(http) { - if (http.readyState == 4) { - if (http.status == 200) { - refreshTasks(); - } - } -} - -function getSelectedFolder() { - var folder; - var list = $("calendarList"); - var nodes = list.getSelectedRows(); - if (nodes.length > 0) - folder = nodes[0]; - else - folder = list.down("li"); // personal calendar - - return folder; -} - -function onMenuNewEventClick(event) { - var target = document.menuTarget; - if (target) { - if (/(minutes\d{2}|dayHeader)/.test(target.className)) - target = target.parentNode; - newEventFromWidget(target, "event"); - } - else { - newEvent('event'); - } -} - -function onMenuNewTaskClick(event) { - var target = document.menuTarget; - if (target) { - if (/(minutes\d{2}|dayHeader)/.test(target.className)) - target = target.parentNode; - newEventFromWidget(target, "task"); - } - else { - newEvent('task'); - } -} - -function _editEventId(id, calendar, recurrence) { - var targetname = "SOGo_edit_" + id; - var urlstr = ApplicationBaseURL + "/" + calendar + "/" + id; - if (recurrence) { - urlstr += "/" + recurrence; - targetname += recurrence; - } - urlstr += "/edit"; - var win = window.open(urlstr, "_blank", - "width=490,height=470,resizable=0"); - if (win) - win.focus(); -} - -function editEvent() { - if (listOfSelection) { - var nodes = listOfSelection.getSelectedRows(); - - if (nodes.length == 0) { - showAlertDialog(_("Please select an event or a task.")); - return false; - } - - for (var i = 0; i < nodes.length; i++) - _editEventId.delay(0.1, - nodes[i].cname, - nodes[i].calendar); - } else if (selectedCalendarCell) { - if (selectedCalendarCell[0].recurrenceTime && !selectedCalendarCell[0].isException) - _editRecurrenceDialog.delay(0.1, - selectedCalendarCell[0], - "confirmEditing"); - else - _editEventId.delay(0.1, - selectedCalendarCell[0].cname, - selectedCalendarCell[0].calendar); - } else { - showAlertDialog(_("Please select an event or a task.")); - } - - return false; /* stop following the link */ -} - -function _batchDeleteEvents() { - // Delete the events of the next calendar - var calendar = calendarsOfEventsToDelete.shift(); - var events = eventsToDelete.shift(); - var urlstr = (ApplicationBaseURL + "/" + calendar - + "/batchDelete?ids=" + events.join(',')); - document.deleteEventAjaxRequest = triggerAjaxRequest(urlstr, - deleteEventCallback, - { calendar: calendar, events: events }); -} - -function deleteEvent() { - var label = ""; - var events = []; - if (listOfSelection) { - var nodes = listOfSelection.getSelectedRows(); - if (nodes.length > 0) { - if (listOfSelection.parentNode == $("tasksList")) - label = _("taskDeleteConfirmation"); - else - label = _("eventDeleteConfirmation"); - - if (nodes.length == 1 - && nodes[0].recurrenceTime) { - if (nodes[0].erasable) - _editRecurrenceDialog(nodes[0], "confirmDeletion"); - else - showAlertDialog(_("You don't have the required privileges to perform the operation.")); - } - else { - var canDelete; - var sortedNodes = []; - var calendars = []; - for (var i = 0; i < nodes.length; i++) { - canDelete = nodes[i].erasable; - if (canDelete) { - var calendar = nodes[i].calendar; - var cname = nodes[i].cname; - if (nodes[i].recurrenceTime) { - cname += '/occurence' + nodes[i].recurrenceTime; - } - if (!sortedNodes[calendar]) { - sortedNodes[calendar] = []; - calendars.push(calendar); - } - if (sortedNodes[calendar].indexOf(cname) < 0) { - // Build list item element for confirmation dialog - var itemElement = new Element('li'); - var colorBox = new Element('div', {'class': 'colorBox calendarFolder' + nodes[i].calendar}); - var content = ''; - if (nodes[i].tagName == 'TR') { - var cell = nodes[i].down('td span'); - content = cell.allTextContent(); // extract the first column only - } - else { - content = nodes[i].allTextContent(); - } - itemElement.appendChild(colorBox); - itemElement.appendChild(new Element('span').update(content.escapeHTML())); - if (nodes[i].startDate) { - var startDate = new Date(nodes[i].startDate*1000); - var dateElement = new Element('div', {'class': 'muted'}); - var date; - if (typeof nodes[i].hour == 'undefined') - date = startDate.toLocaleDateString(localeCode); - else - date = startDate.toLocaleString(localeCode); - dateElement.update(date); - itemElement.appendChild(dateElement); - } - events.push(itemElement); - sortedNodes[calendar].push(cname); - } - } - } - // Update global arrays - for (i = 0; i < calendars.length; i++) { - calendarsOfEventsToDelete.push(calendars[i]); - eventsToDelete.push(sortedNodes[calendars[i]]); - } - if (i == 0) - showAlertDialog(_("You don't have the required privileges to perform the operation.")); - } - } - else - showAlertDialog(_("Please select an event or a task.")); - } - else if (selectedCalendarCell) { - if (selectedCalendarCell.length == 1 - && selectedCalendarCell[0].recurrenceTime) { - if (selectedCalendarCell[0].erasable) - _editRecurrenceDialog(selectedCalendarCell[0], "confirmDeletion"); - else - showAlertDialog(_("You don't have the required privileges to perform the operation.")); - } - else { - var canDelete; - var sortedNodes = []; - var calendars = []; - var cname; - for (var i = 0; i < selectedCalendarCell.length; i++) { - canDelete = selectedCalendarCell[i].erasable; - if (canDelete) { - var calendar = selectedCalendarCell[i].calendar; - var cname = selectedCalendarCell[i].cname; - if (selectedCalendarCell[i].recurrenceTime) { - cname += '/occurence' + selectedCalendarCell[i].recurrenceTime; - } - if (!sortedNodes[calendar]) { - sortedNodes[calendar] = []; - calendars.push(calendar); - } - if (sortedNodes[calendar].indexOf(cname) < 0) { - // Build list item element for confirmation dialog - var itemElement = new Element('li'); - var colorBox = new Element('div', {'class': 'colorBox calendarFolder' + selectedCalendarCell[i].calendar}); - var content = ''; - var event = $(selectedCalendarCell[i]).down("DIV.text"); - for (var j = 0; j < event.childNodes.length; j++) { - var node = event.childNodes[j]; - if (node.nodeType == Node.TEXT_NODE) { - content += node.nodeValue; - } - } - itemElement.appendChild(colorBox); - itemElement.appendChild(new Element('span').update(content.escapeHTML())); - if (selectedCalendarCell[i].startDate) { - var startDate = new Date(selectedCalendarCell[i].startDate*1000); - var dateElement = new Element('div', {'class': 'muted'}); - var date; - if (selectedCalendarCell[i].readAttribute('hour') == 'allday') - date = startDate.toLocaleDateString(localeCode); - else - date = startDate.toLocaleString(localeCode); - dateElement.update(date); - itemElement.appendChild(dateElement); - } - events.push(itemElement); - sortedNodes[calendar].push(cname); - } - } - } - // Update global arrays - for (i = 0; i < calendars.length; i++) { - calendarsOfEventsToDelete.push(calendars[i]); - eventsToDelete.push(sortedNodes[calendars[i]]); - } - if (i == 0) - showAlertDialog(_("You don't have the required privileges to perform the operation.")); - } - } - else - showAlertDialog(_("Please select an event or a task.")); - - if (events.length > 0) { - // Show confirmation dialog - var p = new Element('p'); - p.appendChild(document.createTextNode(label)); - var list = new Element('ul'); - for (i = 0; i < events.length; i++) { - list.appendChild(events[i]); - } - p.appendChild(list); - p.appendChild(document.createTextNode(_("Would you like to continue?"))); - showConfirmDialog(_("Warning"), p, deleteEventFromListConfirm, deleteEventCancel); - } - - return false; -} - -function deleteEventFromListConfirm() { - if (document.deleteEventAjaxRequest) { - document.deleteEventAjaxRequest.aborted = true; - document.deleteEventAjaxRequest.abort(); - } - - _batchDeleteEvents(); - refreshTasks(); - disposeDialog(); -} - -function deleteEventFromViewConfirm() { - if (document.deleteEventAjaxRequest) { - document.deleteEventAjaxRequest.aborted = true; - document.deleteEventAjaxRequest.abort(); - } - - selectedCalendarCell = null; - _batchDeleteEvents(); - disposeDialog(); -} - -function deleteEventCancel(event) { - calendarsOfEventsToDelete = []; - eventsToDelete = []; - disposeDialog(); -} - -function copyEventToClipboard() { - if (listOfSelection) { - clipboard = new Array(); - var nodes = listOfSelection.getSelectedRows(); - for (var i = 0; i < nodes.length; i++) - clipboard.push(nodes[i].calendar + "/" + nodes[i].cname); - } - else if (selectedCalendarCell) { - clipboard = new Array(); - for (var i = 0; i < selectedCalendarCell.length; i++) - clipboard.push(selectedCalendarCell[i].calendar + "/" + selectedCalendarCell[i].cname); - } - log ("clipboard : " + clipboard.join(", ")); -} - -function copyEventFromClipboard() { - if (clipboard && clipboard.length > 0) { - var folder = getSelectedFolder(); - var folderID = folder.readAttribute("id").substr(1); - eventsToCopy = []; - for (var i = 0; i < clipboard.length; i++) - eventsToCopy[i] = clipboard[i] + "/copy?destination=" + folderID; - copyEvents(); - } -} - -function copyEventToPersonalCalendar(event) { - var calendar = selectedCalendarCell[0].calendar; - var cname = selectedCalendarCell[0].cname; - eventsToCopy = [calendar + "/" + cname + "/copy"]; - copyEvents(); -} - -function copyEvents() { - var path = eventsToCopy.shift(); - var urlstr = ApplicationBaseURL + "/" + path; log (urlstr); - triggerAjaxRequest(urlstr, - copyEventCallback); -} - -function copyEventCallback(http) { - if (http.readyState == 4) { - if (isHttpStatus204(http.status)) { - if (eventsToCopy.length) - copyEvents(); - else - refreshEventsAndDisplay(); - } - else if (parseInt(http.status) == 403) - showAlertDialog(_("You don't have the required privileges to perform the operation.")); - else if (parseInt(http.status) == 400) - showAlertDialog(_("DestinationCalendarError")); - else - showAlertDialog(_("EventCopyError")); - } -} - -function onMenuRawEvent(event) { - if (selectedCalendarCell.length != 1) { - return; - } - - var calendar = selectedCalendarCell[0].calendar; - var cname = selectedCalendarCell[0].cname; - - var url = ApplicationBaseURL + "/" + calendar + "/" + cname + "/raw"; - openGenericWindow.delay(0.1, url); -} - -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(_("closeThisWindowMessage"))); - - var calLink = document.createElement("a"); - closePseudoWin.appendChild(calLink); - calLink.href = ApplicationBaseURL; - calLink.appendChild(document.createTextNode(_("Calendar").toLowerCase())); -} - -function modifyEventCallback(http) { - if (http.readyState == 4) { - if (isHttpStatus204(http.status) || http.status == 200) { - var mailInvitation = queryParameters["mail-invitation"]; - if (mailInvitation && mailInvitation.toLowerCase() == "yes") - closeInvitationWindow(); - else { - window.opener.setTimeout("refreshEventsAndDisplay();", 100); - window.setTimeout("window.close();", 100); - } - } - else if (http.status == 403) { - var data = http.responseText; - var msg; - if (data.indexOf("An error occurred during object publishing") > - -1) { - msg = data.replace(/^(.*\n)*.*

((.*\n)*.*)<\/p>(.*\n)*.*$/, "$2"); - } else { - msg = "delegate is a participant"; - } - showAlertDialog(_(msg)); - } - else { - showAlertDialog(_("eventPartStatModificationError")); - } - document.modifyEventAjaxRequest = null; - } -} - -function _deleteCalendarEventBlocks(calendar, cname, occurenceTime) { - // Delete event (or occurence) from the specified calendar - var ownerIsOrganizer = false; - var events = calendarEvents[calendar]; - if (events) { - var occurences = events[cname]; - if (occurences) { - for (var i = 0; i < occurences.length; i++) { - var nodes = occurences[i].blocks; - for (var j = 0; j < nodes.length; j++) { - var node = nodes[j]; - if (occurenceTime == null - || occurenceTime == node.recurrenceTime) { - ownerIsOrganizer = node.ownerIsOrganizer; - node.parentNode.removeChild(node); - } - } - } - if (ownerIsOrganizer) - // Search for the same event in other calendars (using the cache) - // only if the delete operation is triggered from the organizer's - // calendar. - for (var otherCalendar in calendarEvents) { - if (calendar != otherCalendar) { - occurences = calendarEvents[otherCalendar][cname]; - if (occurences) { - for (var i = 0; i < occurences.length; i++) { - var occurence = occurences[i]; - if (occurenceTime == null || occurenceTime == occurence[15]) { - var nodes = occurence.blocks; - for (var j = 0; j < nodes.length; j++) { - var node = nodes[j]; - if (node.parentNode) - node.parentNode.removeChild(node); - } - } - } - } - } - } - } - } - - resizeCalendarHeaderDIV(); -} - -function _deleteEventFromTables(calendar, cname, occurenceTime) { - var basename = "-" + cname; - if (occurenceTime) { - basename = basename + "-" + occurenceTime; - } - if (calendarEvents[calendar]) { - var occurences = calendarEvents[calendar][cname]; - if (occurences) { - var occurence = occurences.first(); - var ownerIsOrganizer = occurence[19]; - - // Delete event from events list - var table = $("eventsList"); - var rows = table.tBodies[0].rows; - for (var j = rows.length; j > 0; j--) { - var row = $(rows[j - 1]); - var id = row.getAttribute("id"); - var pos = id.indexOf(basename); - if (pos > 0) { - var otherCalendar = id.substr(0, pos); - occurences = calendarEvents[otherCalendar][cname]; - if (occurences) { - for (var k = 0; k < occurences.length; k++) { - var occurence = occurences[k]; - if (calendar == otherCalendar || ownerIsOrganizer) { - // This is the specified event or the same event in another - // calendar. In this case, remove it only if the delete - // operation is triggered from the organizer's calendar. - if (occurenceTime == null || occurenceTime == occurence[15]) { - row.parentNode.removeChild(row); - break; - } - } - } - } - } - } - } - } - - // Delete task from tasks list - var rows = $$("tr[id^='" + calendar + basename + "']"); - rows.each(function(row) { - row.parentNode.removeChild(row); - }); -} - -function _deleteCalendarEventCache(calendar, cname, occurenceTime) { - var ownerIsOrganizer = false; - if (calendarEvents[calendar]) { - var occurences = calendarEvents[calendar][cname]; - if (occurences) - ownerIsOrganizer = occurences[0][19]; - } - - for (var otherCalendar in calendarEvents) { - if (calendarEvents[otherCalendar]) { - var occurences = calendarEvents[otherCalendar][cname]; - if (occurences) { - var newOccurences = []; - for (var i = 0; i < occurences.length; i++) { - var occurence = occurences[i]; - if (calendar == otherCalendar || ownerIsOrganizer) { - // This is the specified event or the same event in another - // calendar. In this case, remove it only if the delete - // operation is triggered from the organizer's calendar. - if (occurenceTime == null) { - delete calendarEvents[otherCalendar][cname]; - } - else if (occurenceTime != occurence[15]) { - // || occurenceTime == occurence[15]) { - newOccurences.push(occurence); - } - } - } - if (occurenceTime) - calendarEvents[otherCalendar][cname] = newOccurences; - } - } - } -} - -/** - * This is the Ajax callback function for _batchDeleteEvents. - */ -function deleteEventCallback(http) { - if (http.readyState == 4) { - if (isHttpStatus204(http.status)) { - var calendar = http.callbackData.calendar; - var events = http.callbackData.events; - for (var i = 0; i < events.length; i++) { - var cname = /(.+)\/occurence([0-9]+)/.exec(events[i]) || [null, events[i]]; - _deleteCalendarEventBlocks(calendar, cname[1], cname[2]); - _deleteEventFromTables(calendar, cname[1], cname[2]); - _deleteCalendarEventCache(calendar, cname[1], cname[2]); - } - if (eventsToDelete.length) - _batchDeleteEvents(); - else - document.deleteEventAjaxRequest = null; - } - else if (parseInt(http.status) == 403) - showAlertDialog(_("You don't have the required privileges to perform the operation.")); - else - log ("deleteEventCallback Ajax error (" + http.status + ")"); - } -} - -function getEventById(cname, owner) { - var event = null; - - if (calendarEvents) { - if (!owner) - owner = UserLogin; - var userEvents = calendarEvents[owner]; - if (userEvents) - event = userEvents[cname]; - } - - return event; -} - -function _editRecurrenceDialog(eventCell, method, params) { - var targetname = "SOGo_edit_" + eventCell.cname + eventCell.recurrenceTime; - var urlstr = (ApplicationBaseURL + "/" + eventCell.calendar + "/" + eventCell.cname - + "/occurence" + eventCell.recurrenceTime + "/" + method); - if (params && params.length) { - urlstr += "?" + params; - } - var win = window.open(urlstr, "_blank", - "width=490,height=70,resizable=0"); - if (win) - win.focus(); -} - -function onViewEvent(event) { - if (event.detail == 2) return; - var url = ApplicationBaseURL + "/" + this.calendar + "/" + this.cname; - - if (typeof this.recurrenceTime != "undefined") - url += "/occurence" + this.recurrenceTime; - url += "/view"; - if (document.viewEventAjaxRequest) { - document.viewEventAjaxRequest.aborted = true; - document.viewEventAjaxRequest.abort(); - } - document.viewEventAjaxRequest = triggerAjaxRequest(url, onViewEventCallback, this); -} - -function onViewEventCallback(http) { - if (http.readyState == 4 && http.status == 200) { - if (http.responseText.length > 0) { - var data = http.responseText.evalJSON(true); - // $H(data).keys().each(function(key) { - // log (key + " = " + data[key]); - // }); - var cell = http.callbackData; - var cellPosition = cell.cumulativeOffset(); - var cellDimensions = cell.getDimensions(); - var div = $("eventDialog"); - var divDimensions = div.getDimensions(); - var view; - var left; - var top = cellPosition[1] - 5; - - if (currentView != "monthview") { - view = $("daysView"); - var viewPosition = view.cumulativeOffset(); - - if (parseInt(data["isAllDay"]) == 0) { - top -= view.scrollTop; - if (viewPosition[1] > top + 2) { - view.stopObserving("scroll", onBodyClickHandler); - view.scrollTop = cell.offsetTop; - top = viewPosition[1]; - Event.observe.delay(0.1, view, "scroll", onBodyClickHandler); - } - } - } - else { - top -= cell.up("DIV.day").scrollTop; - } - - left = cellPosition[0] + cellDimensions["width"] + 4; - if (left + divDimensions["width"] > window.width()) { - left = cellPosition[0] - divDimensions["width"]; - div.removeClassName("left"); - div.addClassName("right"); - } - else { - div.removeClassName("right"); - div.addClassName("left"); - } - - // Put the event's data in the DIV - div.down("h1").update(data["summary"].replace(/\r?\n/g, "
")); - - var paras = div.getElementsByTagName("p"); - var para = $(paras[0]); - if (parseInt(data["isAllDay"]) == 0) { - para.down("SPAN").update(data["startTime"] + " - " + data["endTime"]); - para.show(); - } else - para.hide(); - - para = $(paras[1]); - if (data["calendar"].length) { - para.down("SPAN", 1).update(data["calendar"]); - para.show(); - } else - para.hide(); - - para = $(paras[2]); - if (data["location"].length) { - para.down("SPAN", 1).update(data["location"]); - para.show(); - } else - para.hide(); - - para = $(paras[3]); - if (data["created_by"].length) { - para.down("SPAN", 1).update(data["created_by"]); - para.show(); - } else - para.hide(); - - para = $(paras[4]); - if (data["description"].length) { - para.update(data["description"].replace(/\r?\n/g, "
")); - para.show(); - } else - para.hide(); - - div.setStyle({ left: left + "px", top: top + "px" }); - div.show(); - configureLinks(div); - } - } - else { - log("onViewEventCallback ajax error (" + http.status + "): " + http.url); - } -} - -function editDoubleClickedEvent(event) { - if (this.isException && this.recurrenceTime) - _editEventId(this.cname, this.calendar, "occurence" + this.recurrenceTime); - else if (this.recurrenceTime) - _editRecurrenceDialog(this, "confirmEditing"); - else - _editEventId(this.cname, this.calendar); - - Event.stop(event); -} - -function performEventEdition(folder, event, recurrence) { - _editEventId(event, folder, recurrence); -} - -function performEventDeletion(folder, event, recurrence) { - if (calendarEvents) { - if (recurrence) { - // Only one recurrence - var occurenceTime = recurrence.substring(9); - //var nodes = _eventBlocksMatching(folder, event, occurenceTime); - var urlstr = ApplicationBaseURL + "/" + folder + "/" + event + "/" + recurrence + "/delete"; - - document.deleteEventAjaxRequest = triggerAjaxRequest(urlstr, - performDeleteEventCallback, - { calendar: folder, - cname: event, - occurence: occurenceTime }); - } - else { - // All recurrences - if (document.deleteEventAjaxRequest) { - document.deleteEventAjaxRequest.aborted = true; - document.deleteEventAjaxRequest.abort(); - } - eventsToDelete.push([event]); - calendarsOfEventsToDelete.push(folder); - _batchDeleteEvents(); - } - } -} - -function performDeleteEventCallback(http) { - if (http.readyState == 4) { - if (isHttpStatus204(http.status)) { - - var occurenceTime = http.callbackData.occurence; - var cname = http.callbackData.cname; - var calendar = http.callbackData.calendar; - - _deleteCalendarEventBlocks(calendar, cname, occurenceTime); - _deleteEventFromTables(calendar, cname, occurenceTime); - _deleteCalendarEventCache(calendar, cname, occurenceTime); - } - } -} - -/* in dateselector */ -function onDaySelect(node) { - var day = node.getAttribute('day'); - var needRefresh = (eventListFilter == 'view_selectedday' - && day != currentDay); - - var td = $(node).getParentWithTagName("td"); - - // var table = $(td).getParentWithTagName("table"); - // log ("table.selected: " + table.selected); - - if (document.selectedDate) - document.selectedDate.deselect(); - - td.selectElement(); - document.selectedDate = td; - - changeCalendarDisplay( { "day": day } ); - currentDay = day; - selectedDayDate = day; - if (needRefresh) - refreshEvents(); - - return false; -} - -function onDateSelectorGotoMonth(event) { - var day = this.getAttribute("date"); - - changeDateSelectorDisplay(day, true); - - Event.stop(event); -} - -function onCalendarGotoDay(node) { - var day = node.getAttribute("date"); - var needRefresh = (eventListFilter == 'view_selectedday' && day != currentDay); - - changeDateSelectorDisplay(day); - changeCalendarDisplay( { "day": day } ); - if (needRefresh) - refreshEvents(); - - return false; -} - -function gotoToday() { - var todayDate = new Date(); - selectedDayDate = todayDate.getDayString(); - changeDateSelectorDisplay(''); - changeCalendarDisplay(); - - return false; -} - -function setDateSelectorContent(content) { - var div = $("dateSelectorView"); - - div.update(content); - if (currentDay.length > 0) - restoreCurrentDaySelection(div); - - initDateSelectorEvents(); -} - -function dateSelectorCallback(http) { - if (http.readyState == 4 - && http.status == 200) { - document.dateSelectorAjaxRequest = null; - var content = http.responseText; - setDateSelectorContent(content); - cachedDateSelectors[http.callbackData] = content; - } - else - log ("dateSelectorCallback Ajax error"); -} - -function eventsListCallback(http) { - if (http.readyState == 4 - && http.status == 200) { - var div = $("eventsListView"); - document.eventsListAjaxRequest = null; - var table = $("eventsList"); - lastClickedRow = -1; // from generic.js - - var rows = table.select("TBODY TR"); - rows.each(function(e) { - e.remove(); - }); - - if (http.responseText.length > 0) { - var data = http.responseText.evalJSON(true); - for (var i = 0; i < data.length; i++) { - var row = createElement("tr"); - table.tBodies[0].appendChild(row); - row.addClassName("eventRow"); - var calendar = escape(data[i][1]); - var rTime = data[i][16]; - var id = escape(data[i][1] + "-" + data[i][0]); - if (rTime) - id += "-" + escape(rTime); - row.setAttribute("id", id); - row.cname = escape(data[i][0]); - row.calendar = calendar; - if (rTime) - row.recurrenceTime = escape(rTime); - row.isException = data[i][17]; - row.editable = data[i][18] || IsSuperUser; - row.erasable = data[i][19] || IsSuperUser; - row.startDate = data[i][5]; - var startDate = new Date(data[i][5]*1000); - row.day = startDate.getDayString(); - if (!data[i][8]) - row.hour = startDate.getHourString(); // event is not all day - row.observe("mousedown", onRowClick); - row.observe("selectstart", listRowMouseDownHandler); - if (data[i][3] != null) - // Status is defined -- event is readable - row.observe("dblclick", editDoubleClickedEvent); - - var td = createElement("td"); - row.appendChild(td); - td.observe("mousedown", listRowMouseDownHandler, true); - var colorDiv = createElement("div", false, "colorBox calendarFolder" + calendar); - td.appendChild(colorDiv); - colorDiv.update(' '); - var span = createElement("span"); - td.appendChild(span); - span.update(data[i][4]); // title - - td = createElement("td"); - row.appendChild(td); - td.observe("mousedown", listRowMouseDownHandler, true); - td.update(data[i][21]); // start date - - td = createElement("td"); - row.appendChild(td); - td.observe("mousedown", listRowMouseDownHandler, true); - td.update(data[i][22]); // end date - - td = createElement("td"); - row.appendChild(td); - td.observe("mousedown", listRowMouseDownHandler, true); - if (data[i][7]) - td.update(data[i][7]); // location - - td = createElement("td"); - row.appendChild(td); - td.observe("mousedown", listRowMouseDownHandler, true); - if (data[i][10]) - td.update(data[i][10]); // category - - td = createElement("td"); - row.appendChild(td); - td.observe("mousedown", listRowMouseDownHandler, true); - td.update(data[i][2]); // calendar - } - - if (sorting["event-header"] && sorting["event-header"].length > 0) { - var sortHeader = $(sorting["event-header"]); - - if (sortHeader) { - var sortImages = $(table.tHead).select(".sortImage"); - $(sortImages).each(function(item) { - item.remove(); - }); - - var sortImage = createElement("img", "messageSortImage", "sortImage"); - sortHeader.insertBefore(sortImage, sortHeader.firstChild); - if (sorting["event-ascending"]) - sortImage.src = ResourcesURL + "/arrow-up.png"; - else - sortImage.src = ResourcesURL + "/arrow-down.png"; - } - } - } - configureEventsDraggables(); - } - else - log ("eventsListCallback Ajax error"); -} - -function activeTasksCallback(http) { - if (http.readyState == 4 && http.status == 200) { - if (http.responseText.length > 0) { - document.activeTasksAjaxRequest = null; - var data = http.responseText.evalJSON(true); - var list = $("calendarList"); - var items = list.childNodesWithTag("li"); - for (var i = 0; i < items.length; i++) { - var id = items[i].getAttribute("id").substr(1); - var number = parseInt(data[id]); - var input = items[i].childNodesWithTag("input")[0]; - var activeTasks = items[i].childNodesWithTag("span")[1]; - if (typeof activeTasks == "undefined") { - if (number > 0) { - activeTasks = createElement("span", null, "badge"); - items[i].appendChild(activeTasks); - } - } - else if (number == 0) { - items[i].removeChild(activeTasks); - } - if (number > 0) { - activeTasks.innerHTML = number; - } - } - } - } -} - -function tasksListCallback(http) { - if (http.readyState == 4 - && http.status == 200) { - var div = $("tasksListView"); - document.tasksListAjaxRequest = null; - var table = $("tasksList"); - lastClickedRow = -1; // from generic.js - - var rows = table.select("TBODY TR"); - rows.each(function(e) { - e.remove(); - }); - - if (http.responseText.length > 0) { - var data = http.responseText.evalJSON(true); - - // [0] Task ID - // [1] Calendar ID - // [2] Calendar name - // [3] Status (0, 1 = completed, 2) - // [4] Title - // [5] Due date (int) - // [6] Classification (0 = public, 1, = private, 2 = confidential) - // [7] Location - // [8] Category - // [9] Editable? - // [10] Erasable? - // [11] Priority (0, 1 = important, 9 = low) - // [12] Owner - // [13] recurrence-id - // [14] isException - // [15] Status CSS class (duelater, completed, etc) - // [16] Due date (formatted) - - for (var i = 0; i < data.length; i++) { - var row = createElement("tr"); - table.tBodies[0].appendChild(row); - - row.on("dblclick", editDoubleClickedEvent); - - var calendar = escape(data[i][1]); - var cname = escape(data[i][0]); - - var rTime = data[i][13]; - var id = escape(data[i][1] + "-" + data[i][0]); - if (rTime) - id += "-" + escape(rTime); - row.setAttribute("id", id); - //row.cname = escape(data[i][0]); - //row.calendar = calendar; - if (rTime) - row.recurrenceTime = escape(rTime); - row.isException = data[i][14]; - - - //row.setAttribute("id", calendar + "-" + cname); - //listItem.addClassName(data[i][5]); // Classification - //row.addClassName(data[i][14]); // status - row.addClassName("taskRow"); - row.calendar = calendar; - row.cname = cname; - row.erasable = data[i][10] || IsSuperUser; - if (parseInt(data[i][11]) == 1) { - row.addClassName("important"); - } - else if (parseInt(data[i][11]) == 9) { - row.addClassName("low"); - } - - var cell = createElement("td"); - row.appendChild(cell); - var input = createElement("input"); - input.setAttribute("type", "checkbox"); - cell.appendChild(input); - input.setAttribute("value", "1"); - if (parseInt(data[i][9]) == 0) // editable? - input.setAttribute("disabled", true); - input.addClassName("checkBox"); - if (parseInt(data[i][3]) == 1) // completed? - input.setAttribute("checked", "checked"); - input.observe("click", updateTaskStatus, true); - - cell = createElement("td"); - row.appendChild(cell); - if (data[i][11] != null) { - cell.update(_("prio_" + data[i][11])); // Priority - } - else { - cell.update(""); // Priority - } - - cell = createElement("td"); - row.appendChild(cell); - var colorDiv = createElement("div", false, "colorBox calendarFolder" + calendar); - cell.appendChild(colorDiv); - colorDiv.update(' '); - var t = new Element ("span"); - cell.appendChild(t); - t.update(data[i][4]); // title - - cell = createElement("td"); - row.appendChild(cell); - if (data[i][16]) - cell.update(data[i][16]); // end date - - cell = createElement("td"); - row.appendChild(cell); - cell.update(data[i][7]); // location - - cell = createElement("td"); - row.appendChild(cell); - cell.update(data[i][8]); // category - - cell = createElement("td"); - row.appendChild(cell); - cell.update(data[i][2]); // calendar name - } - - table.scrollTop = table.previousScroll; - - if (sorting["task-attribute"] && sorting["task-attribute"].length > 0) { - var sortHeader = $(sorting["task-header"]); - - if (sortHeader) { - var sortImages = $(table.tHead).select(".sortImage"); - $(sortImages).each(function(item) { - item.remove(); - }); - - var sortImage = createElement("img", "messageSortImage", "sortImage"); - sortHeader.insertBefore(sortImage, sortHeader.firstChild); - if (sorting["task-ascending"]) - sortImage.src = ResourcesURL + "/arrow-up.png"; - else - sortImage.src = ResourcesURL + "/arrow-down.png"; - } - } - if (http.callbackData) { - var selectedNodesId = http.callbackData; - for (var i = 0; i < selectedNodesId.length; i++) { - // log(selectedNodesId[i] + " (" + i + ") is selected"); - var node = $(selectedNodesId[i]); - if (node) { - node.selectElement(); - } - } - } - else - log ("tasksListCallback: no data"); - - - } - configureTasksDraggables(); - } - } - else - log ("tasksListCallback Ajax error"); -} - -/* in dateselector */ -function restoreCurrentDaySelection(div) { - var elements = $(div).select("TD.activeDay SPAN"); - if (elements.size()) { - var day = elements[0].readAttribute('day'); - if (day.substr(0, 6) == currentDay.substr(0, 6)) { - for (var i = 0; i < elements.length; i++) { - day = elements[i].readAttribute('day'); - if (day && day == currentDay) { - var td = $(elements[i]).getParentWithTagName("td"); - if (document.selectedDate) - document.selectedDate.deselect(); - $(td).selectElement(); - document.selectedDate = td; - } - } - } - } -} - -function loadPreviousView(event) { - onCalendarGotoDay($("leftNavigationArrow")); -} - -function loadNextView(event) { - onCalendarGotoDay($("rightNavigationArrow")); -} - -function changeDateSelectorDisplay(day, keepCurrentDay) { - var url = ApplicationBaseURL + "/dateselector"; - if (day) { - if (day.length < 8) - day += "01"; - url += "?day=" + day; - } - - if (!keepCurrentDay) - currentDay = day; - - var month = day.substr(0, 6); - if (cachedDateSelectors[month]) { - // log ("restoring cached selector for month: " + month); - setDateSelectorContent(cachedDateSelectors[month]); - } - else { - // log ("loading selector for month: " + month); - if (document.dateSelectorAjaxRequest) { - document.dateSelectorAjaxRequest.aborted = true; - document.dateSelectorAjaxRequest.abort(); - } - document.dateSelectorAjaxRequest - = triggerAjaxRequest(url, - dateSelectorCallback, - month); - } -} - -function changeCalendarDisplay(data, newView) { - newView = ((newView) ? newView : currentView); - var url = ApplicationBaseURL + "/" + newView; - var day = null; - var scrollEvent = null; - if (data) { - day = data['day']; - scrollEvent = data['scrollEvent']; - } - - if (!day) - day = currentDay; - - if (day) { - if (data) { - var dayDiv = $("day"+day); - if (dayDiv) { - // Don't reload the view if the event is present in current view - - // Deselect day in date selector - if (document.selectedDate) - document.selectedDate.deselect(); - - // Select day in date selector - var selectedLink = $$('table#dateSelectorTable span[day='+day+']'); - if (selectedLink.length > 0) { - selectedCell = selectedLink[0].getParentWithTagName("td"); - $(selectedCell).selectElement(); - document.selectedDate = selectedCell; - } else - document.selectedDate = null; - - // Scroll to event - if (scrollEvent) { - preventAutoScroll = false; - scrollDayView(scrollEvent); - } - - setSelectedDayDate(day); - - return false; - } - else if (day.length == 6) { - day += "01"; - } - } - url += "?day=" + day; - } - - selectedCalendarCell = null; - - if (document.dayDisplayAjaxRequest) { - document.dayDisplayAjaxRequest.aborted = true; - document.dayDisplayAjaxRequest.abort(); - } - document.dayDisplayAjaxRequest - = triggerAjaxRequest(url, calendarDisplayCallback, - { "view": newView, - "day": day, - "scrollEvent": scrollEvent }); - - return false; -} - -function _ensureView(view) { - if (currentView != view) - changeCalendarDisplay(null, view); - - return false; -} - -function onDayOverview() { - return _ensureView("dayview"); -} - -function onMulticolumnDayOverview() { - return _ensureView("multicolumndayview"); -} - -function onWeekOverview() { - return _ensureView("weekview"); -} - -function onMonthOverview() { - return _ensureView("monthview"); -} - -function refreshEventsAndTasks() { - refreshEvents(); - refreshTasks(); -} - -function initRefreshViewCheckTimer() { - var refreshViewCheck = UserDefaults["SOGoRefreshViewCheck"]; - if (refreshViewCheck && refreshViewCheck != "manually") { - var interval; - if (refreshViewCheck == "once_per_hour") - interval = 3600; - else if (refreshViewCheck == "every_minute") - interval = 60; - else { - interval = parseInt(refreshViewCheck.substr(6)) * 60; - } - refreshViewCheckTimer = window.setInterval(onRefreshViewCheckCallback, - interval * 1000); - } -} - -function onRefreshViewCheckCallback(event) { - onCalendarReload(); -} - -function onCalendarReload() { - if (!reloadWebCalendars()) { - refreshEventsAndTasks(); - changeCalendarDisplay(); - } - - return false; -} - -function reloadWebCalendars() { - var remaining = []; - var refreshOperations = { "remaining": remaining }; - if (UserSettings['Calendar'] - && UserSettings['Calendar']['WebCalendars']) { - var webCalendars = UserSettings['Calendar']['WebCalendars']; - - var folders = $("calendarList"); - var calendarNodes = folders.childNodesWithTag("li"); - for (var i = 0; i < calendarNodes.length; i++) { - var current = calendarNodes[i]; - var calendarID = current.getAttribute("id"); - var owner = current.getAttribute("owner"); - var realID = owner + ":Calendar/" + calendarID.substr(1); - if (webCalendars[realID]) { /* is web calendar ? */ - remaining.push(realID); - reloadWebCalendar(realID, refreshOperations); - } - } - } - - return (remaining.length > 0); -} - -var calendarReloadErrors = { "invalid-calendar-content": - _("the returned content was not valid calendar" - + " data"), - "http-error": _("an unknown http error occurred" - + " during the load operation"), - "bad-url": _("the url in use is invalid or the" - + " host is currently unreachable"), - "invalid-url": _("the url being used is invalid" - + " or not handled") }; - -function reloadWebCalendar(folderID, refreshOperations) { - var url = URLForFolderID(folderID) + "/reload"; - var cbData = { "folderID": folderID }; - if (refreshOperations) { - cbData["refreshOperations"] = refreshOperations; - } - triggerAjaxRequest(url, reloadWebCalendarCallback, cbData); -} - -function reloadWebCalendarCallback(http) { - var cbData = http.callbackData; - if (http.status == 200) { - var result = http.responseText.evalJSON(true); - var requireAuth = false; - var success = false; - if (result.status) { - if (result.status == 401) { - requireAuth = true; - } - else { - if (result.status == 200) { - success = true; - } - else { - var errorMessage = _("An error occurred while importing calendar."); - if (result["error"]) { - var message = calendarReloadErrors[result["error"]]; - errorMessage = (_("An error occurred while loading remote" - + " calendar: %{0}.").formatted(message)); - } - showAlertDialog (errorMessage); - } - } - } - else { - var errorMessage = _("An error occurred while importing calendar."); - if (result["error"]) { - var message = calendarReloadErrors[result["error"]]; - errorMessage = (_("An error occurred while loading remote" - + " calendar: %{0}.").formatted(message)); - } - showAlertDialog (errorMessage); - } - - if (requireAuth) { - reauthenticateWebCalendar(cbData["folderID"], cbData); - } - else { - var refreshOperations = cbData["refreshOperations"]; - if (refreshOperations) { - var remaining = refreshOperations["remaining"]; - var calIdx = remaining.indexOf(cbData["folderID"]); - remaining.splice(calIdx, 1); - if (remaining.length == 0) { - refreshEventsAndTasks(); - changeCalendarDisplay(); - } - } - else { - if (success) { - refreshEventsAndTasks(); - changeCalendarDisplay(); - } - } - } - } - else { - showAlertDialog(_("An error occurred while importing calendar.")); - var refreshOperations = cbData["refreshOperations"]; - if (refreshOperations) { - var remaining = refreshOperations["remaining"]; - var calIdx = remaining.indexOf(cbData["folderID"]); - remaining.splice(calIdx, 1); - if (remaining.length > 0) { - var newFolderID = remaining[0]; - reloadWebCalendar(newFolderID, refreshOperations); - } - } - } -} - -function reauthenticateWebCalendar(folderID, refreshCBData) { - var remoteURL = null; - if (UserSettings['Calendar'] && UserSettings['Calendar']['WebCalendars']) { - var webCalendars = UserSettings['Calendar']['WebCalendars']; - remoteURL = webCalendars[folderID]; - } - var parts = remoteURL.split("/"); - var hostname = parts[2]; - function authenticate(username, password) { - disposeDialog(); - var url = URLForFolderID(folderID) + "/set-credentials"; - var parameters = ("username=" + encodeURIComponent(username) - + "&password=" + encodeURIComponent(password)); - triggerAjaxRequest(url, authenticateWebCalendarCallback, refreshCBData, parameters, - { "Content-type": "application/x-www-form-urlencoded" }); - } - showAuthenticationDialog(_("Please identify yourself to %{0}") - .formatted(hostname), - authenticate); -} - -function authenticateWebCalendarCallback(http) { - var cbData = http.callbackData; - var folderID = cbData["folderID"]; - var refreshOperations = cbData["refreshOperations"]; - if (isHttpStatus204(http.status)) { - reloadWebCalendar(folderID, refreshOperations); - } - else { - if (refreshOperations) { - var remaining = refreshOperations["remaining"]; - var calIdx = remaining.indexOf(folderID); - remaining.splice(calIdx, 1); - if (remaining.length > 0) { - var newFolderID = remaining[0]; - reloadWebCalendar(newFolderID, refreshOperations); - } - } - } -} - -function scrollDayView(scrollEvent) { - if (!preventAutoScroll) { - if (scrollEvent) { - var contentView; - var eventRow = $(scrollEvent); - if (eventRow) { - var eventBlocks = selectCalendarEvent(eventRow.calendar, eventRow.cname, eventRow.recurrenceTime); - if (eventBlocks) { - var firstEvent = eventBlocks.first(); - - if (currentView == "monthview") - contentView = firstEvent.up("DIV.day"); - else - contentView = $("daysView"); - - // Don't scroll to an all-day event - if (typeof eventRow.hour != "undefined") { - var top = firstEvent.cumulativeOffset()[1] - contentView.scrollTop; - // Don't scroll if the event is visible to the user - if (top < contentView.cumulativeOffset()[1]) - contentView.scrollTop = firstEvent.cumulativeOffset()[1] - contentView.cumulativeOffset()[1]; - else if (top > contentView.cumulativeOffset()[1] + contentView.getHeight() - firstEvent.getHeight()) - contentView.scrollTop = firstEvent.cumulativeOffset()[1] - contentView.cumulativeOffset()[1]; - } - } - } - } - else if (currentView != "monthview") { - var contentView = $("daysView"); - var hours = (contentView.childNodesWithTag("div")[0]).childNodesWithTag("div"); - contentView.scrollTop = hours[dayStartHour].offsetTop; - } - } -} - -function onClickableCellsDblClick(event) { - var target = getTarget(event); - // Hack to ignore double-click in the scrollbar - if (target.hasClassName("dayHeader") || (this.scrollHeight - this.clientHeight <= 1)) { - newEventFromWidget(this, 'event'); - Event.stop(event); - } -} - -function refreshCalendarEvents(scrollEvent) { - var todayDate = new Date(); - var sd; - var ed; - - if (!currentDay) - currentDay = todayDate.getDayString(); - - if (currentView == "dayview" || currentView == "multicolumndayview") { - sd = currentDay; - ed = sd; - } - else if (currentView == "weekview") { - var startDate; - startDate = currentDay.asDate(); - startDate = startDate.beginOfWeek(); - sd = startDate.getDayString(); - var endDate = new Date(); - endDate.setTime(startDate.getTime()); - endDate.addDays(6); - ed = endDate.getDayString(); - } - else { - var monthDate; - monthDate = currentDay.asDate(); - monthDate.setDate(1); - sd = monthDate.beginOfWeek().getDayString(); - - var lastMonthDate = new Date(); - lastMonthDate.setTime(monthDate.getTime()); - lastMonthDate.setMonth(monthDate.getMonth() + 1); - lastMonthDate.addDays(-1); - ed = lastMonthDate.endOfWeek().getDayString(); - } - if (document.refreshCalendarEventsAjaxRequest) { - document.refreshCalendarEventsAjaxRequest.aborted = true; - document.refreshCalendarEventsAjaxRequest.abort(); - } - var url = (ApplicationBaseURL + "/eventsblocks?sd=" + sd + "&ed=" + ed - + "&view=" + currentView); - document.refreshCalendarEventsAjaxRequest - = triggerAjaxRequest(url, refreshCalendarEventsCallback, - {"startDate": sd, "endDate": ed, - "scrollEvent": scrollEvent}); -} - -function _parseEvents(list, calendars) { - var newCalendarEvents = {}; - - if (currentView == "multicolumndayview") { - var list; - for (var i = 0; i < calendars.length; i++) { - list = calendars[i][0]; - for (var j = 0; j < list.length; j++) { - var event = list[j]; - var cname = event[0]; - var calendar = event[1]; - // log("parsed cname: " + cname + "; calendar: " + calendar); - var calendarDict = newCalendarEvents[calendar]; - if (!calendarDict) { - calendarDict = {}; - newCalendarEvents[calendar] = calendarDict; - } - var occurences = calendarDict[cname]; - if (!occurences) { - occurences = []; - calendarDict[cname] = occurences; - } - event.blocks = []; - occurences.push(event); - } - } - } - else { - for (var i = 0; i < list.length; i++) { - var event = list[i]; - var cname = event[0]; - var calendar = event[1]; - // log("parsed cname: " + cname + "; calendar: " + calendar); - var calendarDict = newCalendarEvents[calendar]; - if (!calendarDict) { - calendarDict = {}; - newCalendarEvents[calendar] = calendarDict; - } - var occurences = calendarDict[cname]; - if (!occurences) { - occurences = []; - calendarDict[cname] = occurences; - } - event.blocks = []; - occurences.push(event); - } - - } - return newCalendarEvents; -} - -function _setupEventsDragAndDrop(events) { - /* We setup the drag controllers for all the events. - Since the same events may be listed more than once per calendar - (repeating events), we must keep account of those that have already - been setup. */ - var setupFlags = {}; - - for (var i = 0; i < events.length; i++) { - var cname = events[i][0]; - var calendar = events[i][1]; - var setupId = calendar + "_" + cname; - if (!setupFlags[setupId]) { - var occurrences = calendarEvents[calendar][cname]; - for (var j = 0; j < occurrences.length; j++) { - var blocks = occurrences[j].blocks; - var dragController = new SOGoEventDragController(); - dragController.updateDropCallback = updateEventFromDragging; - if (blocks.length > 0) - // Ignore events that have no visible blocks - dragController.attachToEventCells(blocks); - } - setupFlags[setupId] = true; - } - } -} - -function refreshCalendarEventsCallback(http) { - if (http.readyState == 4 - && http.status == 200) { - if (http.responseText.length > 0) { - var eventsBlocks = http.responseText.evalJSON(true); - - if (currentView == "multicolumndayview") { - calendarEvents = _parseEvents(null, eventsBlocks); - _drawCalendarAllDayEvents(null, null, eventsBlocks); - _drawCalendarEvents(null, null, eventsBlocks); - for (var i = 0 ; i < eventsBlocks.length; i++) { - _setupEventsDragAndDrop(eventsBlocks[i][0]); - } - } - else { - calendarEvents = _parseEvents(eventsBlocks[0], null); - allDayEventsList = eventsBlocks[1]; - eventsList = eventsBlocks[2]; - if (currentView == "monthview") - _drawMonthCalendarEvents(eventsList, eventsBlocks[0], null); - else { - _drawCalendarAllDayEvents(allDayEventsList, eventsBlocks[0], null); - _drawCalendarEvents(eventsList, eventsBlocks[0], null); - } - _setupEventsDragAndDrop(eventsBlocks[0]); - } - resetCategoriesStyles(); - onWindowResize(null); - } - if (http.callbackData["scrollEvent"]) - preventAutoScroll = false; - scrollDayView(http.callbackData["scrollEvent"]); - } - else - log("AJAX error when refreshing calendar events"); -} - -function resetCategoriesStyles() { - if (categoriesStyleSheet == null) { - categoriesStyleSheet = document.createElement("style"); - categoriesStyleSheet.type = "text/css"; - document.getElementsByTagName("head")[0].appendChild(categoriesStyleSheet); - } - else { - if (Prototype.Browser.IE) - while (categoriesStyleSheet.styleSheet.rules.length) - categoriesStyleSheet.styleSheet.removeRule(); - else - while (categoriesStyleSheet.firstChild) - categoriesStyleSheet.removeChild(categoriesStyleSheet.firstChild); - } - - if (UserDefaults['SOGoCalendarCategoriesColors']) { - // Update stylesheet with new categories colors - var selectors = []; - var rules = []; - categoriesStyles.keys().each(function(category) { - var color = UserDefaults['SOGoCalendarCategoriesColors'][category]; - if (color) { - rules.push('border-right: 8px solid ' + color); - selectors.push('DIV.' + categoriesStyles.get(category)); - } - }); - - if (selectors.length > 0) { - if (categoriesStyleSheet.styleSheet && categoriesStyleSheet.styleSheet.addRule) { - // IE - for (var i = 0; i < selectors.length; i++) { - categoriesStyleSheet.styleSheet.addRule(selectors[i], - rules[i]); - } - } - else { - // Mozilla + Safari - for (var i = 0; i < selectors.length; i++) { - categoriesStyleSheet.appendChild(document.createTextNode(selectors[i] + - ' { ' + rules[i] + '; }')); - } - } - } - } -} - -function newBaseEventDIV(eventRep, event, eventText) { - // log ("0 cname = " + event[0]); - // log ("1 calendar = " + event[1]); - // log ("2 calendar name = " + event[2]); - // log ("3 status = " + event[3]); - // log ("4 title = " + event[4]); - // log ("5 start = " + event[5]); - // log ("6 end = " + event[6]); - // log ("7 location = " + event[7]); - // log ("8 isallday = " + event[8]); - // log ("9 classification = " + event[9]); // 0 = public, 1 = private, 2 = confidential - // log ("10 category = " + event[10]); - // log ("11 participants emails = " + event[11]); - // log ("12 participants states = " + event[12]); - // log ("13 owner = " + event[13]); - // log ("14 iscycle = " + event[14]); - // log ("15 nextalarm = " + event[15]); - // log ("16 recurrenceid = " + event[16]); - // log ("17 isexception = " + event[17]); - // log ("18 editable = " + event[18]); - // log ("19 erasable = " + event[19]); - // log ("20 ownerisorganizer = " + event[20]); - - var eventCell = createElement("div"); - eventCell.cname = event[0]; - eventCell.calendar = event[1]; - var startDate = new Date(event[5]*1000); - if (startDate) { - eventCell.startDate = event[5]; - eventCell.writeAttribute('day', startDate.getDayString()); - eventCell.writeAttribute('hour', event[8]? 'allday' : startDate.getHourString()); - } - // if (event[8] == 1) - // eventCell.addClassName("private"); - // else if (event[8] == 2) - // eventCell.addClassName("confidential"); - if (eventRep.recurrenceTime) - eventCell.recurrenceTime = eventRep.recurrenceTime; - //eventCell.owner = event[12]; - eventCell.isException = event[17]; - eventCell.editable = event[18]; - eventCell.erasable = event[19] || IsSuperUser; - eventCell.ownerIsOrganizer = event[20]; - eventCell.addClassName("event"); - // if (event[14] > 0) - // eventCell.addClassName("alarm"); - - var innerDiv = createElement("div"); - eventCell.appendChild(innerDiv); - innerDiv.addClassName("eventInside"); - innerDiv.addClassName("calendarFolder" + event[1]); - if (eventRep.userState >= 0 && userStates[eventRep.userState]) - innerDiv.addClassName(userStates[eventRep.userState]); - - var gradientDiv = createElement("div"); - innerDiv.appendChild(gradientDiv); - gradientDiv.addClassName("gradient"); - - var gradientImg = createElement("img"); - gradientDiv.appendChild(gradientImg); - gradientImg.src = ResourcesURL + "/event-gradient.png"; - - var textDiv = createElement("div"); - innerDiv.appendChild(textDiv); - textDiv.addClassName("text"); - var iconSpan = createElement("span", null, "icons"); - textDiv.update(eventText.replace(/(\\r)?\\n/g, "
")); - textDiv.appendChild(iconSpan); - - // Add alarm and classification icons - if (event[9] == 1) - createElement("img", null, null, {src: ResourcesURL + "/private.png"}, null, iconSpan); - else if (event[9] == 2) - createElement("img", null, null, {src: ResourcesURL + "/confidential.png"}, null, iconSpan); - if (event[15] > 0) - createElement("img", null, null, {src: ResourcesURL + "/alarm.png"}, null, iconSpan); - - if (event[10] != null) { - var category = event[10].decodeEntities(); - var categoryStyle = categoriesStyles.get(category); - if (!categoryStyle) { - categoryStyle = 'category_' + categoriesStyles.keys().length; - categoriesStyles.set([category], categoryStyle); - } - innerDiv.addClassName(categoryStyle); - } - eventCell.observe("contextmenu", onMenuCurrentView); - - if (event[3] == null) { - // Status field is not defined -- user can't read event - eventCell.observe("selectstart", listRowMouseDownHandler); - eventCell.observe("click", onCalendarSelectEvent); - eventCell.observe("dblclick", Event.stop); - } - else { - // Status field is defined -- user can read event - eventCell.observe("mousedown", listRowMouseDownHandler); - eventCell.observe("click", onCalendarSelectEvent); - eventCell.observe("dblclick", editDoubleClickedEvent); - eventCell.observe("click", onViewEvent); - } - - event.blocks.push(eventCell); - - return eventCell; -} - -function _drawCalendarAllDayEvents(events, eventsData, columnsData) { - var headerView = $("calendarHeader"); - var subdivs = headerView.childNodesWithTag("div"); - - if (currentView == "multicolumndayview"){ - var days = subdivs[2].childNodesWithTag("div"); - for (var i = 0; i < days.length; i++) { - var parentDiv = days[i]; - var calendar = columnsData[i]; - var calendarAllDayEvents = calendar[1][0]; - var calendarAllDayEventsData = calendar[0]; - for (var j = 0; j < calendarAllDayEvents.length; j++) { - var eventRep = calendarAllDayEvents[j]; - var nbr = eventRep.nbr; - var eventCell = newAllDayEventDIV(eventRep, calendarAllDayEventsData[nbr]); - parentDiv.appendChild(eventCell); - } - } - } - else { - var days = subdivs[1].childNodesWithTag("div"); - for (var i = 0; i < days.length; i++) { - var parentDiv = days[i]; - for (var j = 0; j < events[i].length; j++) { - var eventRep = events[i][j]; - var nbr = eventRep.nbr; - var eventCell = newAllDayEventDIV(eventRep, eventsData[nbr]); - parentDiv.appendChild(eventCell); - } - } - } - resizeCalendarHeaderDIV(); -} - -/* When the list of all day events overflows, we resize it in order to contain - at least 6 or 7 items. Afterwards we restore the regular scrollbar - mechanism. */ -function resizeCalendarHeaderDIV() { - var headerView = $("calendarHeader"); - var daysView = $("daysView"); - if (headerView && daysView) { - /* consts */ - var headerViewBaseHeight = 90; - var daysViewBaseTop = 95; - /* /consts */ - - var maxEventPerDay = 0; - - var subdivs = headerView.childNodesWithTag("div"); - if (currentView == "multicolumndayview") - var days = subdivs[2].childNodesWithTag("div"); - else - var days = subdivs[1].childNodesWithTag("div"); - for (var i = 0; i < days.length; i++) { - var parentDiv = days[i]; - var divs = parentDiv.childNodesWithTag("div"); - if (divs.length > maxEventPerDay) { - maxEventPerDay = divs.length; - } - } - if (maxEventPerDay > 0 && maxEventPerDay <= 4) { - var moveDaysView = (maxEventPerDay * 19.5); - var expendHeaderHeight = ((maxEventPerDay - 1) * 20); - var deltaMax = 60; - if (expendHeaderHeight > deltaMax){ - expendHeaderHeight = deltaMax; - moveDaysView = deltaMax; - } - daysView.style.top = String(daysViewBaseTop + moveDaysView) + "px"; - headerView.style.height = String(headerViewBaseHeight + expendHeaderHeight) + "px"; - } - - else if (maxEventPerDay > 4) { - var deltaMax = 60; - daysView.style.top = String(daysViewBaseTop + deltaMax + 19) + "px"; - headerView.style.height = String(headerViewBaseHeight + deltaMax) + "px"; - } - else { - var headerDays = document.getElementsByClassName("days")[0]; - headerDays.observe("mouseenter", function(event){ - headerDays.style.zIndex = "1"; - }); - headerDays.observe("mouseleave", function(event){ - headerDays.style.zIndex = "0"; - }); - daysView.style.top = null; - headerView.style.height = null; - } - } -} - -function newAllDayEventDIV(eventRep, event) { - // cname, calendar, starts, lasts, - // startHour, endHour, title) { - var eventCell = newBaseEventDIV(eventRep, event, event[4]); - - return eventCell; -} - -function _drawCalendarEvents(events, eventsData, columnsData) { - var daysView = $("daysView"); - var subdivs = daysView.childNodesWithTag("div"); - for (var i = 0; i < subdivs.length; i++) { - var subdiv = subdivs[i]; - if (subdiv.hasClassName("days")) { - var days = subdiv.childNodesWithTag("div"); - if (currentView == "multicolumndayview") { - for (var j = 0; j < days.length; j++) { - var parentDiv = days[j].childNodesWithTag("div")[0]; - var calendar = columnsData[j]; - var calendarEvents = calendar[2][0]; - var calendarEventsData = calendar[0]; - for (var k = 0; k < calendarEvents.length; k++) { - var eventRep = calendarEvents[k]; - var nbr = eventRep.nbr; - var eventCell = newEventDIV(eventRep, calendarEventsData[nbr]); - parentDiv.appendChild(eventCell); - } - } - } - else { - for (var j = 0; j < days.length; j++) { - var parentDiv = days[j].childNodesWithTag("div")[0]; - for (var k = 0; k < events[j].length; k++) { - var eventRep = events[j][k]; - var nbr = eventRep.nbr; - var eventCell = newEventDIV(eventRep, eventsData[nbr]); - parentDiv.appendChild(eventCell); - } - } - } - } - } - } -} - -function newEventDIV(eventRep, event) { - var eventCell = newBaseEventDIV(eventRep, event, event[4]); - - var pc = 100 / eventRep.siblings; - var left = eventRep.position * pc; - eventCell.style.left = left + "%"; - var right = 100 - (eventRep.position + 1) * pc; - - eventCell.style.right = right + "%"; - eventCell.addClassName("starts" + eventRep.start); - eventCell.addClassName("lasts" + eventRep.length); - - if (event[7]) { - var inside = eventCell.childNodesWithTag("div")[0]; - var textDiv = inside.childNodesWithTag("div")[1]; - textDiv.appendChild(createElement("br")); - var span = createElement("span", null, "location"); - var text = _("Location:") + " " + event[7]; - span.update(text); - textDiv.appendChild(span); - } - - return eventCell; -} - -function _drawMonthCalendarEvents(events, eventsData) { - var daysView = $("monthDaysView"); - var days = daysView.childNodesWithTag("div"); - for (var i = 0; i < days.length; i++) { - var parentDiv = days[i]; - for (var j = 0; j < events[i].length; j++) { - var eventRep = events[i][j]; - var nbr = eventRep.nbr; - var eventCell = newMonthEventDIV(eventRep, eventsData[nbr]); - parentDiv.appendChild(eventCell); - } - } -} - -function newMonthEventDIV(eventRep, event) { - var eventText; - if (event[8]) // all-day event - eventText = event[4]; - else - eventText = eventRep.starthour + " - " + event[4]; - - var eventCell = newBaseEventDIV(eventRep, event, - eventText); - - return eventCell; -} - -function attachDragControllers(contentView) { - var dayNodes = contentView.select("DIV.days DIV.day"); - for (var j = 0; j < dayNodes.length; j++) { - var dayNode = dayNodes[j]; - if (dayNode.hasClassName("day")) { - var dragController = new SOGoEventDragController(); - dragController.createDropCallback = newEventFromDragging; - dragController.attachToDayNode(dayNode); - } - } -} - -/* On IE, the scroll bar is part of the last element. For other browsers, we - execute this method so that the "right" style attribute of the - "calendarHeader" element can be computed. This is execute only once. */ -function adjustCalendarHeaderDIV() { - var dv = $("daysView"); - if (dv) { - var ch = $("calendarHeader"); - var delta = ch.clientWidth - dv.clientWidth - 1; - var styleElement = document.createElement("style"); - styleElement.type = "text/css"; - var selectors = ["DIV#calendarHeader DIV.calendarLabels", - "DIV#calendarHeader DIV.dayLabels", - "DIV#calendarHeader DIV.days"]; - var rule = ("right: " + delta + "px"); - if (styleElement.styleSheet && styleElement.styleSheet.addRule) { - // IE - for (var i = 0; i < selectors.length; i++) { - styleElement.styleSheet.addRule(selectors[i], rule); - } - } else { - // Mozilla + Firefox - var styleText = selectors.join(",") + " { " + rule + "; }"; - styleElement.appendChild(document.createTextNode(styleText)); - } - document.getElementsByTagName("head")[0].appendChild(styleElement); - calendarHeaderAdjusted = true; - } -} - -function adjustMultiColumnCalendarHeaderDIV() { - var ch = $("calendarHeader"); - var calendarLabels = ch.getElementsByClassName("calendarLabels")[0]; - var calendarsToDisplay = calendarLabels.getElementsByClassName("calendarsToDisplay"); - var dayLabels = ch.getElementsByClassName("dayLabels")[0].getElementsByClassName("dayColumn")[0]; - var days = ch.getElementsByClassName("days")[0].getElementsByClassName("dayColumn"); - var daysView = $("daysView").getElementsByClassName("dayColumn"); - - var nbCalendars = calendarsToDisplay.length; - - if (nbCalendars > 0) { - var width = 100/nbCalendars; - var left = 0; - var position = "absolute"; - for(var i=0; i < nbCalendars; i++){ - calendarsToDisplay[i].setStyle({ width: width + '%', left: left + '%', position: position}).show(); - days[i].setStyle({ width: width + '%', left: left + '%'}).show(); - daysView[i].setStyle({ width: width + '%', left: left + '%'}).show(); - left += width; - } - dayLabels.setStyle({ width: '100%'}).show(); - } - else { - $("calendarHeader").remove(); - $("daysView").remove(); - $("calendarContent").style.height = "100%"; - $("calendarContent").style.background = "#E7E7E7"; - } -} - -function calendarDisplayCallback(http) { - var div = $("calendarView"); - var daysView = $("daysView"); - var position = -1; - - // Check the previous view to restore the scrolling position - if (daysView) - position = daysView.scrollTop; - preventAutoScroll = (position != -1); - - if (http.readyState == 4 - && http.status == 200) { - document.dayDisplayAjaxRequest = null; - div.update(http.responseText); - - // DOM has changed - daysView = $("daysView"); - if (daysView) { - if (preventAutoScroll) - daysView.scrollTop = position; - if (!calendarHeaderAdjusted) - adjustCalendarHeaderDIV(); - } - - if (http.callbackData["view"]) - currentView = http.callbackData["view"]; - if (http.callbackData["day"]) - currentDay = http.callbackData["day"]; - - if (currentView == "multicolumndayview") - adjustMultiColumnCalendarHeaderDIV(); - - if (currentView == "multicolumndayview") - adjustMultiColumnCalendarHeaderDIV(); - - // Initialize contextual menu - var menu = new Array(onMenuNewEventClick, - onMenuNewTaskClick, - "-", - loadPreviousView, - loadNextView, - "-", - deleteEvent, - copyEventToPersonalCalendar, - onMenuRawEvent - ); - var observer; - if (currentView == 'dayview' || currentView == 'weekview' || currentView == 'multicolumndayview') { - observer = $("daysView"); - } - else { - observer = $("monthDaysView"); - } - - var contentView; - if (currentView == "monthview") - contentView = $("calendarContent"); - else { - contentView = $("daysView"); - contentView.observe("scroll", onBodyClickHandler); - attachDragControllers($("calendarHeader")); - - // Create a clone of the contextual menu for the all-day - // events area - var allDayViewMenu = Element.clone($("currentViewMenu"), true); - allDayViewMenu.id = "allDayViewMenu"; - var newEventMenuItem = allDayViewMenu.select("LI").first(); - newEventMenuItem.writeAttribute("hour", "allday"); - $("currentViewMenu").parentNode.appendChild(allDayViewMenu); - initMenu($("allDayViewMenu"), menu); - var allDayArea = $$("DIV#calendarHeader DIV.days").first(); - allDayArea.observe("contextmenu", onMenuAllDayView); - } - attachDragControllers(contentView); - - // Attach contextual menu - var currentViewMenu = $("currentViewMenu"); - initMenu(currentViewMenu, menu); - observer.observe("contextmenu", onMenuCurrentView); - currentViewMenu.prepareVisibility = onMenuCurrentViewPrepareVisibility; - - restoreSelectedDay(); - - refreshCalendarEvents(http.callbackData.scrollEvent); - - var days = contentView.select("DIV.day"); - - if (currentView == "monthview") - for (var i = 0; i < days.length; i++) { - days[i].observe("click", onCalendarSelectDay); - days[i].observe("dblclick", onClickableCellsDblClick); - days[i].observe("selectstart", listRowMouseDownHandler); - //days[i].down(".dayHeader").observe("selectstart", listRowMouseDownHandler); - if (currentView == "monthview") - days[i].observe("scroll", onBodyClickHandler); - } - else if (currentView == "multicolumndayview") { - var calendarHeader = $("calendarHeader"); - var headerCalendarsLabels = calendarHeader.select("DIV.calendarLabels DIV.calendarsToDisplay"); - var headerDays = calendarHeader.select("DIV.days DIV.day"); - for (var i = 0; i < days.length; i++) { - headerDays[i].hour = "allday"; - headerCalendarsLabels[i].observe("mousedown", listRowMouseDownHandler); - headerDays[i].observe("click", onCalendarSelectDay); - headerDays[i].observe("dblclick", onClickableCellsDblClick); - Event.on(days[i], "mousedown", onCalendarSelectDay); - - var clickableCells = days[i].select("DIV.clickableHourCell"); - for (var j = 0; j < clickableCells.length; j++) - clickableCells[j].observe("dblclick", onClickableCellsDblClick); - } - } - else { - var calendarHeader = $("calendarHeader"); - var headerDaysLabels = calendarHeader.select("DIV.dayLabels DIV.day"); - var headerDays = calendarHeader.select("DIV.days DIV.day"); - for (var i = 0; i < days.length; i++) { - headerDays[i].hour = "allday"; - headerDaysLabels[i].observe("mousedown", listRowMouseDownHandler); - headerDays[i].observe("click", onCalendarSelectDay); - headerDays[i].observe("dblclick", onClickableCellsDblClick); - days[i].observe("click", onCalendarSelectDay); - - var clickableCells = days[i].select("DIV.clickableHourCell"); - for (var j = 0; j < clickableCells.length; j++) - clickableCells[j].observe("dblclick", onClickableCellsDblClick); - } - } - } - else - log ("calendarDisplayCallback Ajax error (" - + http.readyState + "/" + http.status + ")"); -} - -function onEventsSelectionChange() { - listOfSelection = this; - this.removeClassName("_unfocused"); - - var tasksList = $("tasksList"); - tasksList.addClassName("_unfocused"); - deselectAll(tasksList); - - var rows = $(this).getSelectedNodes(); - if (rows.length == 1) { - var row = rows[0]; - changeCalendarDisplay( { "day": row.day, - "scrollEvent": row.getAttribute("id") } ); - changeDateSelectorDisplay(row.day, true); - } - else { - // Select visible events cells - for (var i = 0; i < rows.length; i++) { - var row = rows[i]; - selectCalendarEvent(row.calendar, row.cname, row.recurrenceTime); - } - } -} - -function onTasksSelectionChange(event) { - listOfSelection = this; - this.removeClassName("_unfocused"); - - var target = Event.element(event); - if (target.tagName == 'SPAN') - target = target.parentNode; - // Update selection - onRowClick(event, target); - - var eventsList = $("eventsList"); - eventsList.addClassName("_unfocused"); - eventsList.deselectAll(); -} - -function _loadEventHref(href) { - if (document.eventsListAjaxRequest) { - document.eventsListAjaxRequest.aborted = true; - document.eventsListAjaxRequest.abort(); - } - var url = ApplicationBaseURL + "/" + href; - document.eventsListAjaxRequest - = triggerAjaxRequest(url, eventsListCallback, href); - - return false; -} - -function _loadTasksHref(href) { - if (document.tasksListAjaxRequest) { - document.tasksListAjaxRequest.aborted = true; - document.tasksListAjaxRequest.abort(); - } - if (document.activeTasksAjaxRequest) { - document.activeTasksAjaxRequest.aborted = true; - document.activeTasksAjaxRequest.abort(); - } - url = ApplicationBaseURL + "/" + href; - urlActiveTasks = ApplicationBaseURL + "/activeTasks"; - - var tasksList = $("tasksList"); - var selectedIds; - if (tasksList) - selectedIds = tasksList.getSelectedNodesId(); - else - selectedIds = null; - - document.tasksListAjaxRequest = triggerAjaxRequest(url, tasksListCallback, selectedIds); - - document.activeTasksAjaxRequest = triggerAjaxRequest(urlActiveTasks, activeTasksCallback); - - return true; -} - -function onHeaderClick(event) { - var newSortAttribute; - var headerId; - - headerId = this.getAttribute("id"); - - if (headerId.startsWith('event')) - { - // This is needed to get the dom object and flip the triangle - sorting["event-header"] = headerId; - // Take away the 'events' and 'Header' and lowercase the result - newSortAttribute = headerId.sub("Header", "").sub("event", "").toLowerCase(); - if (sorting["event-attribute"] == newSortAttribute) - sorting["event-ascending"] = !sorting["event-ascending"]; - else - sorting["event-ascending"] = true; - sorting["event-attribute"] = newSortAttribute; - refreshEvents(); - } - else // Tasks - { - // This is needed to get the dom object and flip the triangle - sorting["task-header"] = headerId; - // Take away the 'tasks' and 'Header' and lowercase the result - newSortAttribute = headerId.sub("Header", "").sub("task", "").toLowerCase(); - if (sorting["task-attribute"] == newSortAttribute) - sorting["task-ascending"] = !sorting["task-ascending"]; - else - sorting["task-ascending"] = true; - sorting["task-attribute"] = newSortAttribute; - refreshTasks(); - } - - Event.stop(event); -} - -function refreshCurrentFolder(id) { - if (id == 'tasks') - refreshTasks(); - else - refreshEvents(); -} - -/* refreshes the "unifinder" list */ -function refreshEvents() { - var specificSearch; - var value = search["events"]["value"]; - - if (value && value.length) - specificSearch = ("&search=" + search["events"]["criteria"] - + "&value=" + escape(value.utf8encode())); - else - specificSearch = ""; - - refreshAlarms(); - - return _loadEventHref("eventslist?asc=" + sorting["event-ascending"] - + "&sort=" + sorting["event-attribute"] - + "&day=" + currentDay - + specificSearch - + "&filterpopup=" + eventListFilter); -} - -function refreshTasks(setUserDefault) { - var specificSearch; - var value = search["tasks"]["value"]; - - if (value && value.length) - specificSearch = ("&search=" + search["tasks"]["criteria"] - + "&value=" + escape(value.utf8encode())); - else - specificSearch = ""; - - if (setUserDefault == 1) - specificSearch += "&setud=1"; - - refreshAlarms(); - - return _loadTasksHref("taskslist?show-completed=" + showCompletedTasks - + "&asc=" + sorting["task-ascending"] - + "&sort=" + sorting["task-attribute"] - + specificSearch - + "&filterpopup=" + taskListFilter); -} - -function refreshEventsAndDisplay() { - refreshEvents(); - changeCalendarDisplay(); -} - -function onEventsListFilterChange() { - var node = $("filterpopup"); - - eventListFilter = node.value; - - return refreshEvents(); -} - -function onTasksListFilterChange() { - var node = $("tasksFilterpopup"); - - taskListFilter = node.value; - - $("showHideCompletedTasks").disabled = taskListFilter == "view_overdue" || - taskListFilter == "view_incomplete" || - taskListFilter == "view_not_started"; - - return refreshTasks(); -} - -function selectMonthInMenu(menu, month) { - var entries = $(menu).select("LI"); - for (i = 0; i < entries.length; i++) { - var entry = entries[i]; - var entryMonth = entry.getAttribute("month"); - if (entryMonth == month) - entry.addClassName("currentMonth"); - else - entry.removeClassName("currentMonth"); - } -} - -function selectYearInMenu(menu, year) { - var entries = $(menu).select("LI"); - for (i = 0; i < entries.length; i++) { - var entry = entries[i]; - var entryYear = entry.innerHTML.strip(); - if (entryYear == year) - entry.addClassName("currentMonth"); - else - entry.removeClassName("currentMonth"); - } -} - -function popupMonthMenu(event) { - if (event.button == 0) { - var id = this.getAttribute("id"); - if (id == "monthLabel") - menuId = "monthListMenu"; - else - menuId = "yearListMenu"; - - var popup = $(menuId); - if (id == "monthLabel") - selectMonthInMenu(popup, this.getAttribute("month")); - else - selectYearInMenu(popup, this.innerHTML); - - popupToolbarMenu(this, menuId); - Event.stop(event); - } -} - -function onMonthMenuItemClick(event) { - var month = '' + this.getAttribute("month"); - var year = '' + $("yearLabel").innerHTML.strip(); - - changeDateSelectorDisplay(year + month + "01", true); -} - -function onYearMenuItemClick(event) { - var month = '' + $("monthLabel").getAttribute("month");; - var year = '' + this.innerHTML.strip(); - - changeDateSelectorDisplay(year + month + "01", true); -} - -function _eventBlocksMatching(calendar, cname, recurrenceTime) { - var blocks = null; - var events = calendarEvents[calendar]; - if (events) { - var occurences = events[cname]; - if (occurences) { - if (recurrenceTime) { - for (var i = 0; i < occurences.length; i++) { - var occurence = occurences[i]; - if (occurence[16] == recurrenceTime) - blocks = occurence.blocks; - } - } - else { - blocks = []; - for (var i = 0; i < occurences.length; i++) { - var occurence = occurences[i]; - blocks = blocks.concat(occurence.blocks); - } - } - } - } - - return blocks; -} - -/** Select event in calendar view */ -function selectCalendarEvent(calendar, cname, recurrenceTime) { - var selection = _eventBlocksMatching(calendar, cname, recurrenceTime); - if (selection) { - for (var i = 0; i < selection.length; i++) - selection[i].selectElement(); - if (selectedCalendarCell) { - selectedCalendarCell = selectedCalendarCell.concat(selection); - } - else - selectedCalendarCell = selection; - } - - return selection; -} - -function onSelectAll(event) { - if (listOfSelection) - listOfSelection.selectAll(); - else { - // Select events cells - var selectedBlocks = []; - for (var c in calendarEvents) { - var events = calendarEvents[c]; - for (var e in events) { - var occurrences = events[e]; - for (var i = 0; i < occurrences.length; i++) - selectedBlocks = selectedBlocks.concat(occurrences[i].blocks); - } - } - for (var i = 0; i < selectedBlocks.length; i++) - selectedBlocks[i].selectElement(); - - selectedCalendarCell = selectedBlocks; - } - - return false; -} - -function deselectAll(list) { - if (list) { - list.deselectAll(); - } - else { - $("eventsList").deselectAll(); - $("tasksList").deselectAll(); - } - if (selectedCalendarCell) { - for (var i = 0; i < selectedCalendarCell.length; i++) - selectedCalendarCell[i].deselect(); - selectedCalendarCell = null; - } -} - -/** Click on an event in the calendar view */ -function onCalendarSelectEvent(event, willShowContextualMenu) { - var alreadySelected = false; - - // Look for event in events list - // TODO: event will likely not be found if an Ajax query is refreshing - // the events list. - var rowID = this.calendar + "-" + this.cname; - if (this.recurrenceTime) - rowID += "-" + this.recurrenceTime; - var row = $(rowID); - - // Check if event is already selected - if (selectedCalendarCell) - for (var i = 0; i < selectedCalendarCell.length; i++) - if (selectedCalendarCell[i] == this) { - alreadySelected = true; - break; - } - - if ((isMac() && event.metaKey == 1) || (!isMac() && event.ctrlKey == 1)) { - // If meta or ctrl key is pressed, inverse the selection - if (alreadySelected) { - this.deselect(); - selectedCalendarCell.splice(i, 1); - if (row) - row.deselect(); - - return true; - } - } - else if (!(alreadySelected && willShowContextualMenu) - && event.shiftKey == 0) { - // Unselect entries in events list and calendar view, unless : - // - Shift key is pressed; - // - Or right button is clicked and event is already selected. - deselectAll(); - listOfSelection = null; - this.selectElement(); - if (alreadySelected) - selectedCalendarCell = [this]; - } - - if (!alreadySelected) { - // Select event in calendar view - selectCalendarEvent(this.calendar, this.cname, this.recurrenceTime); - } - // Select event in events list - if (row) { - var div = row.parentNode.parentNode.parentNode; - div.scrollTop = row.offsetTop - (div.offsetHeight / 2); - row.selectElement(); - } -} - -function onCalendarSelectDay(event) { - var day = this.getAttribute("day"); - var needRefresh = (eventListFilter == 'view_selectedday' && day != currentDay); - - setSelectedDayDate(day); - changeDateSelectorDisplay(day); - - if (needRefresh) - refreshEvents(); - - var target = Event.findElement(event); - var div = target.up('div'); - - // Select the calendar associated with the day clicked - if (currentView == "multicolumndayview") { - if (target.getAttribute("calendar")) - var calendar = "[id='/" + target.getAttribute("calendar") + "']"; - else - var calendar = "[id='/" + target.up("[calendar]").getAttribute("calendar") + "']"; - var list = $("calendarList"); - var selectedCalendar = list.down(calendar); - - onRowClick(event, selectedCalendar); - } - - if (div && !div.hasClassName('event') && !div.hasClassName('eventInside') && !div.hasClassName('text') && !div.hasClassName('gradient')) { - // Target is not an event -- unselect all events. - listOfSelection = $("eventsList"); - deselectAll(); - return true; - } - - if (listOfSelection) { - listOfSelection.addClassName("_unfocused"); - } - - changeCalendarDisplay( { "day": currentDay } ); -} - -function setSelectedDayDate(dayDate) { - if (selectedDayDate != dayDate) { - var day = $("day" + selectedDayDate); - if (day) - day.removeClassName("selectedDay"); - var allDay = $("allDay" + selectedDayDate); - if (allDay) - allDay.removeClassName("selectedDay"); - - selectedDayDate = dayDate; - - day = $("day" + selectedDayDate); - day.addClassName("selectedDay"); - selectedDayNumber = day.readAttribute("day-number"); - allDay = $("allDay" + selectedDayDate); - if (allDay) - allDay.addClassName("selectedDay"); - } -} - -/* after loading a new view, to reselect the currently selected day */ -function restoreSelectedDay() { - var day = null; - if (selectedDayDate.length > 0) - day = $("day" + selectedDayDate); - if (!day) { - if (selectedDayNumber > -1) - selectedDayDate = findDateFromDayNumber(selectedDayNumber); - else - selectedDayDate = currentDay; - if (selectedDayDate && selectedDayDate.length > 0) - day = $("day" + selectedDayDate); - } - if (day) { - selectedDayDate = null; - setSelectedDayDate(day.id.substr(3)); - } -} - -function findDateFromDayNumber(dayNumber) { - var view; - if (currentView == "monthview") - view = $("monthDaysView"); - else - view = $("daysView"); - var days = view.select(".day"); - return (dayNumber < days.size()) ? days[dayNumber].readAttribute("day") : null; -} - -function onShowCompletedTasks(event) { - showCompletedTasks = (this.checked ? 1 : 0); - - return refreshTasks(1); -} - -function updateTaskStatus(event) { - var newStatus = (this.checked ? 1 : 0); - _updateTaskCompletion (this.up("tr"), newStatus); - return false; -} - -function updateCalendarStatus(event) { - var list = []; - var newStatus = (this.checked ? 1 : 0); - - var nodes = $("calendarList").childNodesWithTag("li"); - for (var i = 0; i < nodes.length; i++) { - var input = $(nodes[i]).childNodesWithTag("input")[0]; - if (input.checked) { - var folderId = nodes[i].getAttribute("id"); - var elems = folderId.split(":"); - if (elems.length > 1) - list.push(elems[0]); - else - list.push(UserLogin); - } - } - - // 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 (newStatus) - urlstr += "/activateFolder"; - else - urlstr += "/deactivateFolder"; - //log("updateCalendarStatus: ajax request = " + urlstr + ", folderID = " + folderID); - triggerAjaxRequest(urlstr, calendarStatusCallback, folderID); - } - else { - updateCalendarsList(); - refreshEvents(); - refreshTasks(); - changeCalendarDisplay(); - } - - if (event) { - event.returnValue = true; - } -} - -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"); -} - -function calendarEntryCallback(http) { - if (http.readyState == 4) { - var denied = !isHttpStatus204(http.status); - var entry = $(http.callbackData); - if (denied) - entry.addClassName("denied"); - else - entry.removeClassName("denied"); - } -} - -function updateCalendarsList(method) { - var list = $("calendarList").childNodesWithTag("li"); - for (var i = 0; i < list.length; i++) { - var folderID = list[i].getAttribute("id"); - var url = URLForFolderID(folderID) + "/canAccessContent"; - triggerAjaxRequest(url, calendarEntryCallback, folderID); - } - configureDroppables(); -} - -//function validateBrowseURL(input) { -// var button = $("browseURLBtn"); -// -// if (input.value.length) { -// if (!button.enabled) -// enableAnchor(button); -// } else if (!button.disabled) -// disableAnchor(button); -//} - -//function browseURL(anchor, event) { -// if (event.button == 0) { -// var input = $("url"); -// var url = input.value; -// if (url.length) -// window.open(url, '_blank'); -// } -// -// return false; -//} - -function onCalendarsMenuPrepareVisibility() { - var folders = $("calendarList"); - var selected = folders.getSelectedNodes(); - if (selected.length > 0) { - var folderOwner = selected[0].getAttribute("owner"); - - var lis = $(this).down("ul").childElements(); - - /* distance: sharing = length - 1, export = length - 7 */ - var endDists = [ 1, 7 ]; - for (var i = 0; i < endDists.length; i++) { - var dist = lis.length - endDists[i]; - var option = $(lis[dist]); - if (folderOwner == UserLogin || IsSuperUser) - option.removeClassName("disabled"); - else - option.addClassName("disabled"); - } - - var deleteCalendarOption = $("deleteCalendarMenuItem"); - // Swith between Delete and Unsubscribe - if (folderOwner == UserLogin) - deleteCalendarOption.update(_("Delete Calendar")); - else - deleteCalendarOption.update(_("Unsubscribe Calendar")); - - return true; - } - return false; -} - -function onMenuCurrentViewPrepareVisibility() { - var options = $(this).down("ul"); - var deleteOption = options.down("li", 6); - var copyOption = options.down("li", 7); - var rawOption = options.down("li", 8); - if (!selectedCalendarCell) { - deleteOption.addClassName("disabled"); - copyOption.addClassName("disabled"); - rawOption.addClassName("disabled"); - } - else { - deleteOption.removeClassName("disabled"); - var calendarEntry = $("/" + selectedCalendarCell[0].calendar); - if (calendarEntry.getAttribute("owner") == UserLogin) - copyOption.addClassName("disabled"); - else - copyOption.removeClassName("disabled"); - if (selectedCalendarCell.length == 1) { - // show raw content is only allowed for single event - rawOption.removeClassName("disabled"); - } - else - rawOption.addClassName("disabled"); - } - - return true; -} - -function onTasksListMenuPrepareVisibility() { - var options = $(this).down("ul"); - var rawOption = options.down("li", 6); - - var selectedTasks = $$("#tasksList ._selected"); - if (selectedTasks.length == 1) - rawOption.removeClassName("disabled"); - else - rawOption.addClassName("disabled"); - - return true; -} - -function getMenus() { - var menus = {}; - - var dateMenu = []; - for (var i = 0; i < 12; i++) - dateMenu.push(onMonthMenuItemClick); - menus["monthListMenu"] = dateMenu; - - dateMenu = []; - for (var i = 0; i < 11; i++) - dateMenu.push(onYearMenuItemClick); - menus["yearListMenu"] = dateMenu; - - menus["eventsListMenu"] = new Array(onMenuNewEventClick, - onMenuNewTaskClick, "-", - editEvent, deleteEvent, "-", - onSelectAll, "-", - null, null); - menus["calendarsMenu"] = new Array(onCalendarModify, - "-", - onCalendarNew, onCalendarRemove, - "-", onCalendarExport, onCalendarImport, - null, "-", null, "-", onMenuSharing); - menus["eventSearchMenu"] = new Array(setSearchCriteria, setSearchCriteria, setSearchCriteria); - - menus["tasksListMenu"] = new Array (editEvent, newTask, "-", - marksTasksAsCompleted, deleteEvent, "-", - onMenuRawTask); - menus["taskSearchMenu"] = new Array(setSearchCriteria, setSearchCriteria, setSearchCriteria); - - var calendarsMenu = $("calendarsMenu"); - if (calendarsMenu) - calendarsMenu.prepareVisibility = onCalendarsMenuPrepareVisibility; - - var tasksListMenu = $("tasksListMenu"); - if (tasksListMenu) - tasksListMenu.prepareVisibility = onTasksListMenuPrepareVisibility; - - return menus; -} - -function newTask () { - newEventFromWidget.delay(0.1, this, 'task'); -} - -function marksTasksAsCompleted () { - var selectedTasks = $$("#tasksList ._selected"); - - for (var i = 0; i < selectedTasks.length; i++) { - var task = selectedTasks[i]; - _updateTaskCompletion (task, 1); - } -} - -function _updateTaskCompletion (task, value) { - url = (ApplicationBaseURL + "/" + task.calendar - + "/" + task.cname); - - if (task.recurrenceTime) - url += ("/occurence" + task.recurrenceTime); - - url += ("/changeStatus?status=" + value); - - triggerAjaxRequest(url, refreshTasks, null); - - return false; -} - -function onMenuRawTask(event) { - var selectedTasks = $$("#tasksList ._selected"); - if (selectedTasks.length != 1) { - return; - } - - var url = ApplicationBaseURL + "/" + selectedTasks[0].calendar + "/" + selectedTasks[0].cname + "/raw" - openGenericWindow.delay(0.1, url); -} - -function onMenuSharing(event) { - if ($(this).hasClassName("disabled")) - return; - - var folders = $("calendarList"); - var selected = folders.getSelectedNodes()[0]; - /* FIXME: activation of the context menu should preferably select the entry - above which the event has occurred */ - if (selected) { - var folderID = selected.getAttribute("id"); - var urlstr = URLForFolderID(folderID) + "/acls"; - - openAclWindow(urlstr); - } -} - -function multicolumndayviewCalendarSelector(event, target) { - // Select the calendar associated with the day clicked - if (currentView == "multicolumndayview") { - if (target.getAttribute("calendar")) - var calendar = "[id='/" + target.getAttribute("calendar") + "']"; - else - var calendar = "[id='/" + target.up("[calendar]").getAttribute("calendar") + "']"; - var list = $("calendarList"); - var selectedCalendar = list.down(calendar); - - onRowClick(event, selectedCalendar); - } -} - -function onMenuCurrentView(event) { - var target = getTarget(event); - $("eventDialog").hide(); - if (this.hasClassName('event')) { - // Select event cell - var onClick = onCalendarSelectEvent.bind(this); - onClick(event, true); - target = this; - } - multicolumndayviewCalendarSelector(event, target); - popupMenu(event, 'currentViewMenu', target); -} - -function onMenuAllDayView(event) { - $("eventDialog").hide(); - multicolumndayviewCalendarSelector(event, getTarget(event)); - popupMenu(event, 'allDayViewMenu', getTarget(event)); -} - -function configureEventsDraggables() { - if ($("eventsList")) { - var rows = jQuery("tr.eventRow"); - try { rows.draggable("destroy"); } catch (e) {} - rows.draggable({ - helper: function (event) { return '

'; }, - start: startDragging, - drag: whileDragging, - stop: stopDragging, - appendTo: 'body', - cursorAt: { right: 25 }, - scroll: false, - distance: 4, - zIndex: 20 - }); - } -} - -function configureTasksDraggables() { - if ($("tasksList")) { - var rows = jQuery("tr.taskRow"); - try { rows.draggable("destroy"); } catch (e) {} - rows.draggable({ - helper: function (event) { return '
'; }, - start: startDragging, - drag: whileDragging, - stop: stopDragging, - appendTo: 'body', - cursorAt: { right: 25 }, - scroll: false, - distance: 4, - zIndex: 20 - }); - } -} - -function configureDroppables() { - jQuery("#calendarList li").droppable({ hoverClass: 'genericHoverClass', - drop: dropAction }); -} - -function startDragging(event, ui) { - var row = Event.findElement(event); - var handle = ui.helper; - var table = row.up('table'); - var elements = table.getSelectedRowsId(); - var count = elements.length; - - if (count == 0 || elements.indexOf(row.id) < 0) { - onRowClick(event, row); - elements = table.getSelectedRowsId(); - count = elements.length; - } - - handle.html(count); - handle.show(); -} - -function whileDragging(event, ui) { - if (event) - var handle = ui.helper; -} - -function stopDragging(event, ui) { - var handle = ui.helper; - handle.hide(); -} - -function dropAction(event, ui) { - var toId = this.id.substr(1); - var table = ui.draggable.closest('table')[0]; - var itemIds = { data: table.getSelectedRowsId(), - // The table ID is either eventsList or tasksList - type: table.id.substr(0, table.id.indexOf('List')) }; - - for (var i = 0; i < itemIds.data.length; i++) { - // Find the event ID (.ics) - if (!itemIds.data[i].endsWith("ics")) { - // If it is a repeated event, substract the occurence part - if (itemIds.data[i].indexOf(".ics")) { - var x = eventIds[i].indexOf(".ics") + 4; - itemIds.data[i] = itemIds.data[i].substr(0,x); - } - else { - log("Can't find the event(.ics) on the item dragged : " + eventIds[i]); - return false; - } - } - // Distinction between personal calendar and a calendar with a reference ID (ex: 4535-7545-B-5D3J) - if (itemIds.data[i].search(toId+"-") == -1) { - var x = itemIds.data[i].indexOf('-'); - if (itemIds.data[i].indexOf('-') == 4) { - var regEx = new RegExp(/\w+\-\w+\-\w+\-\w+/); - var fromId = regEx.exec(itemIds.data[i]); - var eventICS = itemIds.data[i].substr(fromId[0].length + 1); - } - else { - var regEx = new RegExp(/\w+/); - var fromId = regEx.exec(itemIds.data[i]); - var eventICS = itemIds.data[i].substr(fromId[0].length + 1); - } - - if (itemIds.type == "events") { - var destinationCalendar = "destination=" + toId; - var params = destinationCalendar + "&days=0&start=0&duration=0"; - var urlstr = ApplicationBaseURL + "/" + fromId + "/" + eventICS + "/adjust?" + params; - - triggerAjaxRequest(urlstr, updateEventFromDraggingCallback); - } - else if (itemIds.type == "tasks") { - var params = "moveToCalendar=" + toId; - var urlstr = ApplicationBaseURL + "/" + fromId + "/" + eventICS + "/saveAsTask?" + params; - triggerAjaxRequest(urlstr, updateTaskFromDraggingCallback); - } - } - } -} - -function configureDragHandles() { - var handle = $("verticalDragHandle"); - if (handle) { - handle.addInterface(SOGoDragHandlesInterface); - handle.leftBlock = $("leftPanel"); - handle.rightBlock = $("rightPanel"); - } - - handle = $("rightDragHandle"); - if (handle) { - handle.addInterface(SOGoDragHandlesInterface); - handle.upperBlock = $("schedulerTabs"); - handle.lowerBlock = $("calendarView"); - } -} - -function initCalendarSelector() { - var selector = $("calendarSelector"); - updateCalendarStatus(); // triggers the initial events refresh - selector.changeNotification = updateCalendarsList; - - var list = $("calendarList"); - list.on("mousedown", onCalendarSelectionChange); - list.on("dblclick", onCalendarModify); - list.on("selectstart", listRowMouseDownHandler); - list.attachMenu("calendarsMenu"); - - var items = list.childNodesWithTag("li"); - for (var i = 0; i < items.length; i++) { - var input = items[i].childNodesWithTag("input")[0]; - var activeTasks = items[i].childNodesWithTag("span")[1]; - $(input).observe("click", clickEventWrapper(updateCalendarStatus)); - } - - var links = $("calendarSelectorButtons").childNodesWithTag("a"); - $(links[0]).observe("click", clickEventWrapper(onCalendarNew)); - $(links[1]).observe("click", clickEventWrapper(onCalendarWebAdd)); - $(links[2]).observe("click", clickEventWrapper(onCalendarAdd)); - $(links[3]).observe("click", clickEventWrapper(onCalendarRemove)); -} - -function onCalendarSelectionChange(event) { - var target = Event.element(event); - if (target.tagName == 'DIV' || target.tagName == 'SPAN') { - target = target.parentNode; - } - - onRowClick(event, target); -} - -function onCalendarModify(event) { - var folders = $("calendarList"); - var selected = folders.getSelectedNodes()[0]; - var calendarID = selected.getAttribute("id"); - var owner = selected.getAttribute("owner"); - var url = ApplicationBaseURL + calendarID + "/properties"; - var windowID = sanitizeWindowName(calendarID + " properties"); - var width = 410; - var height = 410; - var isWebCalendar = false; - if (UserSettings['Calendar'] - && UserSettings['Calendar']['WebCalendars']) { - var webCalendars = UserSettings['Calendar']['WebCalendars']; - var realID = owner + ":Calendar/" + calendarID.substr (1, calendarID.length - 1); - if (webCalendars[realID]) { - isWebCalendar = true; - } - } - if (Prototype.Browser.IE) height += 10; - - if (owner == UserLogin) { - height += 20; - } - if (isWebCalendar) { - height += 26; - } - else if (calendarID == "/personal") { - height -= 26; - } - - $(function() { - var properties = window.open(url, windowID, - "width="+width+",height="+height+",resizable=0"); - properties.focus(); - }).delay(0.1); -} - -function updateCalendarProperties(calendarID, calendarName, calendarColor) { - var idParts = calendarID.split(":"); - var folderName = idParts[1].split("/")[1]; - var nodeID; - - if (idParts[0] != UserLogin) - nodeID = "/" + idParts[0].asCSSIdentifier() + "_" + folderName; - else - nodeID = "/" + folderName; - // log("nodeID: " + nodeID); - var calendarNode = $(nodeID); - var displayNameNode = calendarNode.childNodesWithTag("span")[0]; - displayNameNode.innerHTML = calendarName.escapeHTML(); - - appendStyleElement(nodeID, calendarColor); -} - -function onCalendarNew(event) { - showPromptDialog(_("New Calendar..."), _("Name of the Calendar"), onCalendarNewConfirm); - preventDefault(event); -} - -function onCalendarNewConfirm() { - createFolder(this.value, appendCalendar); - disposeDialog(); -} - -function onCalendarAdd(event) { - openUserFolderSelector(onFolderSubscribeCB, "calendar"); - preventDefault(event); -} - -function onCalendarWebAdd(event) { - showPromptDialog(_("Subscribe to a web calendar..."), _("URL of the Calendar"), onCalendarWebAddConfirm); -} - -function onCalendarWebAddConfirm() { - disposeDialog(); - var calendarUrl = this.value; - if (calendarUrl) { - var url = ApplicationBaseURL + "/addWebCalendar"; - var parameters = "url=" + encodeURIComponent(calendarUrl); - triggerAjaxRequest(url, addWebCalendarCallback, calendarUrl, parameters, - { "Content-type": "application/x-www-form-urlencoded" }); - } -} - -function addWebCalendarCallback(http) { - if (http.status == 200) { - var data = http.responseText.evalJSON(true); - if (!data || data["error"] || !data["name"] || !data["folderID"]) { - showAlertDialog (_("An error occurred while importing calendar.")); - } - else { - if (UserSettings['Calendar']) { - var webCalendars = UserSettings['Calendar']['WebCalendars']; - if (!webCalendars) { - webCalendars = {}; - UserSettings['Calendar']['WebCalendars'] = webCalendars; - } - webCalendars[data["folderID"]] = http.callbackData; - } - - appendCalendar(data["name"], data["folderID"]); - reloadWebCalendar(data["folderID"]); - } - } - else { - showAlertDialog (_("An error occurred while importing calendar.")); - } - - // if (data.imported) { - // appendCalendar(data.displayname, "/" + data.name); - // refreshEvents(); - // refreshTasks(); - // changeCalendarDisplay(); - // } - // else if (data.status && data.status == 401) { - // reauthenticateWebCalendar(data.name, data.url); - // } - // else { - // } -} - -function onCalendarExport(event) { - var node = $("calendarList").getSelectedNodes().first(); - var folderId = node.getAttribute("id"); - var url = URLForFolderID(folderId) + ".ics/export"; - window.location.href = url; -} - -function onCalendarImport(event) { - var list = $("calendarList"); - var node = list.getSelectedNodes().first(); - var folderId = node.getAttribute("id"); - - var url = ApplicationBaseURL + folderId + "/import"; - $("uploadForm").action = url; - $("calendarFile").value = ""; - - var cellPosition = node.cumulativeOffset(); - var cellDimensions = node.getDimensions(); - var left = cellDimensions['width'] - 20; - var top = cellPosition[1]; - top -= list.scrollTop; - - var div = $("uploadDialog"); - var res = $("uploadResults"); - res.setStyle({ top: top + "px", left: left + "px" }); - div.setStyle({ top: top + "px", left: left + "px" }); - div.show(); -} -function hideCalendarImport(event) { - $("uploadDialog").hide(); -} -function hideImportResults(event) { - $("uploadResults").hide(); -} -function validateUploadForm() { - rc = false; - if ($("calendarFile").value.length) { - var btn = jQuery('#uploadSubmit'); - jQuery('#uploadCancel').fadeOut('fast'); - btn.addClass("disabled"); - btn.children('span').text(_('Uploading')); - rc = true; - } - return rc; -} -function uploadCompleted(response) { - jQuery('#uploadCancel').show(); - var btn = jQuery('#uploadSubmit'); - btn.removeClass("disabled"); - btn.children('span').text(_('Upload')); - var div = $("uploadResults"); - - try { - data = response.evalJSON(true); - - if (data.imported < 0) - $("uploadResultsContent").update(_("An error occurred while importing calendar.")); - else if (data.imported == 0) - $("uploadResultsContent").update(_("No event was imported.")); - else { - $("uploadResultsContent").update(_("A total of %{0} events were imported in the calendar.").formatted(data.imported)); - refreshEventsAndDisplay(); - } - } catch (e) { - $("uploadResultsContent").update(_("An error occurred while importing calendar.")); - } - - hideCalendarImport(); - $("uploadResults").show(); -} - -function appendCalendar(folderName, folderPath) { - var owner; - - if (folderPath) { - owner = getSubscribedFolderOwner(folderPath); - folderPath = accessToSubscribedFolder(folderPath); - } - else - folderPath = "/" + folderName; - - if (!owner) - owner = UserLogin; - - //log ("append name: " + folderName + "; path: " + folderPath + "; owner: " + owner); - - if ($(folderPath)) - showAlertDialog(_("You have already subscribed to that folder!")); - else { - var calendarList = $("calendarList"); - var items = calendarList.select("li"); - var li = document.createElement("li"); - - // Add the calendar to the proper place - var i = getListIndexForFolder(items, owner, folderName); - if (i != items.length) // User is subscribed to other calendars of the same owner - calendarList.insertBefore(li, items[i]); - else - calendarList.appendChild(li); - $(li).writeAttribute("id", folderPath); - $(li).writeAttribute("owner", owner); - - var checkBox = createElement("input", null, "checkBox", { checked: 1 }, - { type: "checkbox" }, li); - - li.appendChild(document.createTextNode(" ")); - - var colorBox = document.createElement("div"); - colorBox.appendChild(document.createTextNode("\u00a0")); - li.appendChild(colorBox); - - var displayName = document.createElement("span"); - displayName.appendChild(document.createTextNode(folderName)); - li.appendChild(displayName); - - $(colorBox).addClassName("colorBox"); - $(colorBox).addClassName('calendarFolder' + folderPath.substr(1)); - - // Check the checkbox (required for IE) - li.getElementsByTagName("input")[0].checked = true; - - // Register event on checkbox - $(checkBox).on("click", clickEventWrapper(updateCalendarStatus)); - - var url = URLForFolderID(folderPath) + "/canAccessContent"; - triggerAjaxRequest(url, calendarEntryCallback, folderPath); - - // Update CSS for events color - appendStyleElement(folderPath, "#AAAAAA"); - } -} - -function appendStyleElement(folderPath, color) { - if (document.styleSheets) { - var fgColor = getContrastingTextColor(color); - var styleElement = document.createElement("style"); - styleElement.type = "text/css"; - - var styles = ' .calendarFolder' + folderPath.substr(1) - + ' { background-color: ' + color + ' !important;' + ' color: ' + fgColor + ' !important; }' - + ' div.colorBox.calendarFolder' + folderPath.substr(1) - + ' { color: ' + color + ' !important; }'; - - if (styleElement.styleSheet) styleElement.styleSheet.cssText = styles; // IE - else styleElement.appendChild(document.createTextNode(styles)); // Mozilla + Webkit - - document.getElementsByTagName("head")[0].appendChild(styleElement); - } -} - -function onFolderSubscribeCB(folderData) { - var folder = $(folderData["folder"]); - if (!folder) { - appendCalendar(folderData["folderName"].unescapeHTML(), folderData["folder"]); - refreshEvents(); - refreshTasks(); - changeCalendarDisplay(); - } -} - -function onFolderUnsubscribeCB(folderId) { - var node = $(folderId); - var list = $(node.parentNode); - node.deselect(); - list.removeChild(node); - if (removeFolderRequestCount == 0) { - list.down("li").selectElement(); // personal calendar - refreshEvents(); - refreshTasks(); - changeCalendarDisplay(); - } -} - -function onCalendarRemove(event) { - if (removeFolderRequestCount == 0) { - var nodes = $("calendarList").getSelectedNodes(); - for (var i = 0; i < nodes.length; i++) { - var owner = nodes[i].getAttribute("owner"); - var folderId = nodes[i].getAttribute("id"); - if (owner == UserLogin) { - if (folderId == "/personal") { - var label = labels["You cannot remove nor unsubscribe from your" - + " personal calendar."]; - showAlertDialog(label); - } - else { - deletePersonalCalendar(nodes[i]); - } - } - else { - var folderUrl = ApplicationBaseURL + folderId; - nodes[i].deselect(); - unsubscribeFromFolder(folderUrl, owner, - onFolderUnsubscribeCB, folderId); - } - } - } - - preventDefault(event); -} - -function deletePersonalCalendar(folderElement) { - var displayName = folderElement.childNodesWithTag("span")[0].innerHTML.strip().unescapeHTML(); - showConfirmDialog(_("Confirmation"), - _("Are you sure you want to delete the calendar \"%{0}\"?").formatted(displayName), - deletePersonalCalendarConfirm.bind(folderElement)); -} - -function deletePersonalCalendarConfirm() { - var folderId = this.getAttribute("id").substr(1); - this.deselect(); - this.hide(); - removeFolderRequestCount++; - var url = ApplicationBaseURL + "/" + folderId + "/delete"; - triggerAjaxRequest(url, deletePersonalCalendarCallback, this); - disposeDialog(); -} - -function deletePersonalCalendarCallback(http) { - if (http.readyState == 4) { - if (isHttpStatus204(http.status)) { - var folderElement = http.callbackData; - if (folderElement) { - var list = folderElement.parentNode; - list.removeChild(folderElement); - } - removeFolderRequestCount--; - if (removeFolderRequestCount == 0) { - refreshEvents(); - refreshTasks(); - changeCalendarDisplay(); - } - } - } - else { - log ("ajax problem 5: " + http.status); - var folderElement = http.callbackData; - folderElement.show(); - } -} - -function configureLists() { - // Move calendar view if lists are collapsed - if (!$("schedulerTabs").visible()) { - $('calendarView').setStyle({ top: '0' }).show(); - } - - // TASK LIST - var list = $("tasksList"); - list.multiselect = true; - configureSortableTableHeaders(list); - TableKit.Resizable.init(list, {'trueResize' : true, 'keepWidth' : true}); - list.down("tbody").on("mousedown", onTasksSelectionChange); - list.down("tbody").on("selectstart", listRowMouseDownHandler); - list.down("tbody").attachMenu("tasksListMenu"); - - var input = $("showHideCompletedTasks"); - input.observe("click", onShowCompletedTasks); - - if (showCompletedTasks) - input.checked = true; - - // EVENT LIST - list = $("eventsList"); - list.multiselect = true; - configureSortableTableHeaders(list); - TableKit.Resizable.init(list, {'trueResize' : true, 'keepWidth' : true}); - list.down("tbody").on("mousedown", onEventsSelectionChange); - list.down("tbody").attachMenu("eventsListMenu"); -} - -function initDateSelectorEvents() { - var arrow = $("rightArrow"); - arrow.observe("click", onDateSelectorGotoMonth); - arrow = $("leftArrow"); - arrow.observe("click", onDateSelectorGotoMonth); - - var menuButton = $("monthLabel"); - menuButton.observe("click", popupMonthMenu); - menuButton = $("yearLabel"); - menuButton.observe("click", popupMonthMenu); -} - -function onBodyClickHandler(event) { - $("eventDialog").hide(); -} - -function onWindowResize(event) { - var handle = $("verticalDragHandle"); - if (handle) - handle.adjust(); - handle = $("rightDragHandle"); - if (handle) - handle.adjust(); - - if (!$(document.body).hasClassName("popup")) - drawNowLine(); -} - -function drawNowLine() { - var d = new Date(); - var hours = d.getHours(); - var minutes = d.getMinutes(); - - if (currentView == "dayview") { - var today = new Date(); - var m = parseInt(today.getMonth()) + 1; - var d = today.getDate(); - if (m < 10) - m = "0" + m; - if (d < 10) - d = "0" + d; - var day = today.getFullYear() + "" + m + "" + d; - var targets = $$("DIV#daysView DIV.days DIV.day[day=" + day - + "] DIV.hourCells"); - } - else if (currentView == "multicolumndayview") { - var targets = $$("DIV#daysView DIV.hourCells"); - } - else if (currentView == "weekview") - var targets = $$("DIV#daysView DIV.days DIV.dayOfToday DIV.hourCells"); - - else { - var targets = []; - } - - if (targets[0] != undefined) { - if (currentView == "multicolumndayview") { - var nbCalendars = targets.length; - for(var i = 0; i < nbCalendars; i++){ - var target = targets[i].getElementsByClassName("clickableHourCell")[hours]; - - if (target) { - var div = targets[i].getElementsByClassName("nowLineDisplay")[0]; - if (!div) - div = new Element("div", {'class': 'nowLineDisplay'}); - - div.style.top = parseInt((minutes * target.offsetHeight / 60) - 1) + "px"; - target.insertBefore(div, target.firstChild); - } - } - } - else { - var target = targets[0].getElementsByClassName("clickableHourCell")[hours]; - if (target) { - var div = targets[0].getElementsByClassName("nowLineDisplay")[0]; - if (!div) - div = new Element("div", {'class': 'nowLineDisplay'}); - - div.style.top = parseInt((minutes * target.offsetHeight / 60) - 1) + "px"; - target.insertBefore(div, target.firstChild); - } - } - setTimeout("drawNowLine ();", 60000); // 1 min. - } - else { - var target = targets[0].getElementsByClassName("clickableHourCell")[hours]; - if (target) { - var div = targets[0].getElementsByClassName("nowLineDisplay")[0]; - if (!div) - div = new Element("div", {'class': 'nowLineDisplay'}); - - div.style.top = parseInt((minutes * target.offsetHeight / 60) - 1) + "px"; - target.insertBefore(div, target.firstChild); - } - } - setTimeout("drawNowLine ();", 60000); // 1 min. - } -} - -function onListCollapse(event, element) { - var img = element.select('img').first(); - var tabs = $("schedulerTabs"); - var handle = $("rightDragHandle"); - var view = jQuery("#calendarView"); - var state = 'collapse'; - - if (tabs.visible()) { - img.removeClassName('collapse').addClassName('rise'); - handle.hide(); - view.animate({ top: '0' }, 200, function() { - tabs.hide(); - }); - } - else { - state = 'rise'; - img.removeClassName('rise').addClassName('collapse'); - tabs.show(); - tabs.controller.onWindowResize(); - view.animate({ top: handle.getStyle('top') }, 200, function() { - handle.show(); - }); - } - - var url = ApplicationBaseURL + "/saveListState"; - var params = "state=" + state; - triggerAjaxRequest(url, null, null, params, - { "Content-type": "application/x-www-form-urlencoded" }); - -} - -function onDocumentKeydown(event) { - var target = Event.element(event); - if (target.tagName != "INPUT") { - var keyCode = event.keyCode; - if (!keyCode) { - keyCode = event.charCode; - if (keyCode == "a".charCodeAt(0)) - keyCode = "A".charCodeAt(0); - else if (keyCode == "c".charCodeAt(0)) - keyCode = "C".charCodeAt(0); - else if (keyCode == "v".charCodeAt(0)) - keyCode = "V".charCodeAt(0); - } - if (keyCode == Event.KEY_DELETE - || (keyCode == Event.KEY_BACKSPACE)) { - $("eventDialog").hide(); - deleteEvent(); - event.stop(); - } - else if (((isMac() && event.metaKey == 1) || (!isMac() && event.ctrlKey == 1)) - && keyCode == "A".charCodeAt(0)) { // Ctrl-A - onSelectAll(event); - Event.stop(event); - } - else if (((isMac() && event.metaKey == 1) || (!isMac() && event.ctrlKey == 1)) - && keyCode == "C".charCodeAt(0)) { // Ctrl-C - copyEventToClipboard(); - } - else if (((isMac() && event.metaKey == 1) || (!isMac() && event.ctrlKey == 1)) - && keyCode == "V".charCodeAt(0)) { // Ctrl-V - copyEventFromClipboard(); - } - } -} - -function saveTabState(event) { - var tab = $(event).memo; - - var url = ApplicationBaseURL + "/saveSelectedList"; - var params = "list=" + tab; - triggerAjaxRequest(url, null, null, params, - { "Content-type": "application/x-www-form-urlencoded" }); -} - -function initScheduler() { - sorting["event-header"] = ""; - sorting["task-header"] = ""; - sorting["event-attribute"] = "start"; - sorting["task-attribute"] = "end"; - sorting["event-ascending"] = true; - sorting["task-ascending"] = true; - - if (!$(document.body).hasClassName("popup")) { - var node = $("filterpopup"); - eventListFilter = node.value; - - var tabsContainer = $("schedulerTabs"); - var controller = new SOGoTabsController(); - controller.attachToTabsContainer(tabsContainer); - tabsContainer.on("tabs:click", saveTabState); - - if (UserSettings['ShowCompletedTasks']) { - showCompletedTasks = parseInt(UserSettings['ShowCompletedTasks']); - } - else { - showCompletedTasks = 0; - } - - initDateSelectorEvents(); - initCalendarSelector(); - configureSearchField(); - configureLists(); - $(document.body).observe("click", onBodyClickHandler); - // Calendar import form - $("uploadCancel").observe("click", hideCalendarImport); - $("uploadOK").observe("click", hideImportResults); - $("calendarView").on("click", "#listCollapse", onListCollapse); - Event.observe(document, "keydown", onDocumentKeydown); - - initRefreshViewCheckTimer() - } - - onWindowResize.defer(); - Event.observe(window, "resize", onWindowResize); -} - -document.observe("generic:loaded", initScheduler); diff --git a/UI/WebServerResources/SchedulerUIDnD.js b/UI/WebServerResources/SchedulerUIDnD.js deleted file mode 100644 index a7140ed41..000000000 --- a/UI/WebServerResources/SchedulerUIDnD.js +++ /dev/null @@ -1,1501 +0,0 @@ -/* bind method: attachToEventCells(cells), attachToDayNode(dayNode) - * callback method: updateDropCallback(this, eventCells, delta), - createDropCallback(this, dayDate, currentCoordinates); - */ - - -var SOGoEventDragDayLength = 24 * 4; /* quarters */ -var SOGoEventDragHandleSize = 8; /* handles for dragging mode */ -var SOGoEventDragHorizontalOffset = 3; -var SOGoEventDragVerticalOffset = 3; -var calendarID = [], activeCalendars = []; - -/* singleton */ -var _sogoEventDragUtilities = null; -function SOGoEventDragUtilities() { - if (!_sogoEventDragUtilities) - _sogoEventDragUtilities = new _SOGoEventDragUtilities(); - - return _sogoEventDragUtilities; -} - -function _SOGoEventDragUtilities() { -} - -_SOGoEventDragUtilities.prototype = { - eventType: null, - eventContainerNodes: null, - _prepareEventContainerNodes: null, - quarterHeight: -1, - dayWidth: -1, - dayHeight: -1, - daysOffset: -1, - eventsViewNode: null, - eventsViewNodeCumulativeCoordinates: null, - - reset: function() { - this.eventContainerNodes = null; - this._prepareEventContainerNodes = null; - this.quarterHeight = -1; - this.dayWidth = -1; - this.dayHeight = -1; - this.daysOffset = -1; - this.eventsViewNode = null; - this.eventsViewNodeCumulativeCoordinates = null; - }, - - setEventType: function(eventType) { - var prepareMethods - = { "multiday": this._prepareEventMultiDayContainerNodes, - "multiday-allday": this._prepareEventMultiDayAllDayContainerNodes, - "monthly": this._prepareEventMonthlyContainerNodes, - "unknown": null }; - this._prepareEventContainerNodes = prepareMethods[eventType]; - this.eventType = eventType; - }, - getEventType: function(eventType) { - return this.eventType; - }, - - getEventContainerNodes: function() { - if (!this.eventContainerNodes) { - this._prepareEventContainerNodes(); - } - - return this.eventContainerNodes; - }, - _prepareEventMultiDayContainerNodes: function() { - this.eventContainerNodes = []; - var daysView = $("daysView"); - var daysViewSubnodes = daysView.childNodesWithTag("div"); - for (var i = 0; i < daysViewSubnodes.length; i++) { - var daysViewSubnode = daysViewSubnodes[i]; - if (daysViewSubnode.hasClassName("days")) { - this.daysOffset = daysViewSubnode.offsetLeft + 2; - var daysSubnodes = daysViewSubnode.childNodesWithTag("div"); - for (var j = 0; j < daysSubnodes.length; j++) { - var daysSubnode = daysSubnodes[j]; - if (daysSubnode.hasClassName("day")) { - this._appendDayEventsNode(daysSubnode); - } - } - } - } - }, - _prepareEventMultiDayAllDayContainerNodes: function() { - this.eventContainerNodes = []; - var headerNode = $("calendarHeader"); - var headerSubnodes = headerNode.childNodesWithTag("div"); - for (var i = 0; i < headerSubnodes.length; i++) { - var headerSubnode = headerSubnodes[i]; - if (headerSubnode.hasClassName("days")) { - this.daysOffset = headerSubnode.offsetLeft + 2; - var daysSubnodes = headerSubnode.childNodesWithTag("div"); - for (var j = 0; j < daysSubnodes.length; j++) { - var daysSubnode = daysSubnodes[j]; - if (daysSubnode.hasClassName("day")) - this.eventContainerNodes.push(daysSubnode); - } - } - } - }, - _prepareEventMonthlyContainerNodes: function() { - var monthView = $("monthDaysView"); - this.eventContainerNodes = monthView.childNodesWithTag("div"); - this.daysOffset = this.eventContainerNodes[0].offsetLeft + 2; - }, - - _appendDayEventsNode: function(dayNode) { - var daySubnodes = dayNode.childNodesWithTag("div"); - for (var i = 0; i < daySubnodes.length; i++) { - var daySubnode = daySubnodes[i]; - if (daySubnode.hasClassName("events")) { - this.eventContainerNodes.push(daySubnode); - } - } - }, - - getQuarterHeight: function() { - if (this.quarterHeight == -1) { - var hour0 = $("hour0"); - var hour23 = $("hour23"); - this.quarterHeight = ((hour23.offsetTop - hour0.offsetTop) - / (23 * 4)); - } - - return this.quarterHeight; - }, - - getDaysOffset: function() { - if (this.daysOffset == -1) - this._prepareEventContainerNodes(); - - return this.daysOffset; - }, - - getDayWidth: function() { - if (this.dayWidth == -1) { - var nodes = this.getEventContainerNodes(); - if (nodes.length > 1) { - if (this.eventType == "monthly") { - var total = (nodes[6].cumulativeOffset()[0] - - nodes[0].cumulativeOffset()[0]); - this.dayWidth = total / 6; - } else { - var total = (nodes[nodes.length-1].cumulativeOffset()[0] - - nodes[0].cumulativeOffset()[0]); - this.dayWidth = total / (nodes.length - 1); - } - } - else - this.dayWidth = nodes[0].offsetWidth; - } - - return this.dayWidth; - }, - - getDayHeight: function() { - /* currently only used for monthly view */ - if (this.dayHeight == -1) { - var nodes = this.getEventContainerNodes(); - if (nodes.length > 1) { - var total = (nodes[3*7].cumulativeOffset()[1] - - nodes[0].cumulativeOffset()[1]); - this.dayHeight = total / 3; - } - } - - return this.dayHeight; - }, - - getEventsViewNode: function() { - if (!this.eventsViewNode) { - if (this.eventType.startsWith("multiday")) - this.eventsViewNode = $("daysView"); - else if (this.eventType.startsWith("multiday-allday")) { - this.eventsViewNode = $("calendarHeader"); - } - else - this.eventsViewNode = $("monthDaysView"); - } - return this.eventsViewNode; - }, - - getEventsViewNodeCumulativeCoordinates: function() { - if (!this.eventsViewNodeCumulativeCoordinates) { - this.eventsViewNodeCumulativeCoordinates = new SOGoCoordinates(); - var node = this.getEventsViewNode(); - var cumulativeOffset = node.cumulativeOffset(); - this.eventsViewNodeCumulativeCoordinates.x = cumulativeOffset[0]; - this.eventsViewNodeCumulativeCoordinates.y = cumulativeOffset[1]; - } - - return this.eventsViewNodeCumulativeCoordinates; - } -}; - -function SOGoEventDragEventCoordinates() { -} - -SOGoEventDragEventCoordinates.prototype = { - dayNumber: -1, - start: -1, - duration: -1, - - eventType: null, - - setEventType: function(eventType) { - this.eventType = eventType; - this._prepareEventType(); - }, - _prepareEventType: function() { - var methods - = { "multiday": this.initFromEventCellMultiDay, - "multiday-allday": this.initFromEventCellMultiDayAllDay, - "monthly": this.initFromEventCellMonthly, - "unknown": null }; - this.initFromEventCell = methods[this.eventType]; - }, - - initFromEventCellMultiDay: function(eventCell) { - var classNames = eventCell.className.split(" "); - for (var i = 0; (this.start == -1 || this.duration == -1) && i < classNames.length; i++) { - var className = classNames[i]; - if (className.startsWith("starts")) { - this.start = parseInt(className.substr(6)); - } - else if (className.startsWith("lasts")) { - this.duration = parseInt(className.substr(5)); - } - } - var dayNumber = -1; - - var dayNode = eventCell.parentNode.parentNode; - if (currentView == "multicolumndayview") { - calendarID[0] = dayNode.getAttribute("calendar"); - var dayNumber = this._updateMulticolumnViewDayNumber(calendarID); - } - else { - var classNames = dayNode.className.split(" "); - for (var i = 0; dayNumber == -1 && i < classNames.length; i++) { - var className = classNames[i]; - if (className.startsWith("day") && className.length > 3) { - dayNumber = parseInt(className.substr(3)); - } - } - } - this.dayNumber = dayNumber; - }, - initFromEventCellMultiDayAllDay: function(eventCell) { - this.start = 0; - this.duration = SOGoEventDragDayLength; - - var dayNode = eventCell.parentNode; - if (currentView == "multicolumndayview") { - calendarID[0] = dayNode.getAttribute("calendar"); - var dayNumber = this._updateMulticolumnViewDayNumber(calendarID); - } - else { - var classNames = dayNode.className.split(" "); - var dayNumber = -1; - for (var i = 0; dayNumber == -1 && i < classNames.length; i++) { - var className = classNames[i]; - if (className.startsWith("day") && className.length > 3) { - dayNumber = parseInt(className.substr(3)); - } - } - } - this.dayNumber = dayNumber; - }, - initFromEventCellMonthly: function(eventCell) { - this.start = 0; - this.duration = SOGoEventDragDayLength; - - var dayNumber = -1; - - var week = -1; - var day = -1; - - var dayNode = eventCell.parentNode; - var classNames = dayNode.className.split(" "); - for (var i = 0; - (day == -1 || week == -1) - && i < classNames.length; - i++) { - var className = classNames[i]; - if (className.startsWith("day") && className.length > 3) { - day = parseInt(className.substr(3)); - } else if (className.startsWith("week") - && !className.startsWith("weekOf") - && className != "weekEndDay") { - var ofIndex = className.indexOf("of"); - if (ofIndex > -1) { - var len = ofIndex - 4; - week = parseInt(className.substr(4, len)); - } - } - } - this.dayNumber = week * 7 + day; - }, - - initFromEventCells: function(eventCells) { - this.duration = 0; - for (var i = 0; i < eventCells.length; i++) { - var current = new SOGoEventDragEventCoordinates(); - current.setEventType(this.eventType); - current.initFromEventCell(eventCells[i]); - if (this.dayNumber == -1 || current.dayNumber < this.dayNumber) { - this.dayNumber = current.dayNumber; - this.start = current.start; - } - this.duration += current.duration; - } - }, - - getDelta: function(otherCoordinates) { - var delta = new SOGoEventDragEventCoordinates(); - delta.dayNumber = (this.dayNumber - otherCoordinates.dayNumber); - delta.start = (this.start - otherCoordinates.start); - delta.duration = (this.duration - otherCoordinates.duration); - - return delta; - }, - - _quartersToHM: function(quarters) { - var minutes = quarters * 15; - var hours = Math.floor(minutes / 60); - if (hours < 10) - hours = "0" + hours; - var mins = minutes % 60; - if (mins < 10) - mins = "0" + mins; - - return "" + hours + ":" + mins; - }, - - _updateMulticolumnViewDayNumber: function(calendarID) { - var calendarList = $("calendarList").getElementsByTagName("li"); - for (var j = 0; j < calendarList.length ; j++) { - if ($("calendarList").getElementsByTagName("li")[j].down().checked) - activeCalendars.push($("calendarList").getElementsByTagName("li")[j].getAttribute("id").substr(1)); - } - for (var k = 0; k < activeCalendars.length; k++) { - if (activeCalendars[k] == calendarID[0]) { - return k; - } - } - }, - - getStartTime: function() { - return this._quartersToHM(this.start); - }, - - getEndTime: function() { - var end = (this.start + this.duration) % SOGoEventDragDayLength; - return this._quartersToHM(end); - }, - - clone: function() { - var coordinates = new SOGoEventDragEventCoordinates(); - coordinates.dayNumber = this.dayNumber; - coordinates.start = this.start; - coordinates.duration = this.duration; - - return coordinates; - } -}; - -var SOGoDragGhostInterface = { - visible: true, - - title: null, - folderClass: null, - inside: null, - - currentStart: -1, - currentDuration: -1, - isStartGhost: false, - isEndGhost: false, - - show: function SDGI_show() { - if (!this.visible) { - this.removeClassName("hidden"); - if (this.inside) - this.inside.removeClassName("hidden"); - this.visible = true; - } - }, - hide: function SDGI_hide() { - if (this.visible) { - this.addClassName("hidden"); - if (this.inside) - this.inside.addClassName("hidden"); - this.visible = false; - } - }, - - setTitle: function SDGI_setTitle(title) { - if (this.title != title) { - while (this.inside.childNodes.length) { - this.inside.removeChild(this.inside.firstChild); - } - if (title) { - this.inside.appendChild(document.createTextNode(title)); - } - this.title = title; - } - }, - setLocation: function SDGI_setLocation(location) { - if (this.location != location) { - var spans = this.inside.select("SPAN.location"); - if (spans && spans.length > 0) { - this.inside.removeChild(spans[0]); - } - if (location) { - this.inside.appendChild(createElement("br")); - var span = createElement("span", null, "location"); - span.appendChild(document.createTextNode(location)); - this.inside.appendChild(span); - } - this.location = location; - } - }, - - setFolderClass: function SDGI_setFolderClass(folderClass) { - if (this.folderClass != folderClass) { - this.removeClassName(this.folderClass); - this.folderClass = folderClass; - this.addClassName(this.folderClass); - } - }, - - setStart: function SDGI_setStart(start) { - if (this.currentStart != start) { - if (this.cssHandlesPosition) - this.removeClassName("starts" + this.currentStart); - this.currentStart = start; - if (this.cssHandlesPosition) - this.addClassName("starts" + this.currentStart); - } - }, - setDuration: function SDGI_setDuration(duration) { - if (this.currentDuration != duration) { - if (this.cssHandlesPosition) - this.removeClassName("lasts" + this.currentDuration); - this.currentDuration = duration; - if (this.cssHandlesPosition) - this.addClassName("lasts" + this.currentDuration); - } - }, - - setStartGhost: function SDGI_setStartGhost() { - if (!this.isStartGhost) { - this.addClassName("startGhost"); - this.isStartGhost = true; - } - }, - unsetStartGhost: function SDGI_unsetStartGhost() { - if (this.isStartGhost) { - this.removeClassName("startGhost"); - this.isStartGhost = false; - } - }, - setEndGhost: function SDGI_setEndGhost() { - if (!this.isEndGhost) { - this.addClassName("endGhost"); - this.isEndGhost = true; - } - }, - unsetEndGhost: function SDGI_unsetEndGhost() { - if (this.isEndGhost) { - this.removeClassName("endGhost"); - this.isEndGhost = false; - } - } -}; - -function SOGoEventDragGhostController() { -} - -SOGoEventDragGhostController.prototype = { - originalCoordinates: null, - currentCoordinates: null, - - originalPointerCoordinates: null, - currentPointerCoordinates: null, - - dragMode: null, - - startHourPara: null, - endHourPara: null, - ghosts: null, - - initWithCoordinates: function SEDGC_initWithCoordinates(coordinates) { - this.originalCoordinates = coordinates; - this.currentCoordinates = coordinates.clone(); - }, - - setTitle: function SEDGC_setTitle(title) { - this.eventTitle = title; - }, - - setLocation: function SEDGC_setLocation(location) { - this.eventLocation = location; - }, - - setFolderClass: function SEDGC_setFolderClass(folderClass) { - this.folderClass = folderClass; - }, - - setDragMode: function SEDGC_setDragMode(dragMode) { - this.dragMode = dragMode; - }, - - setPointerHandler: function SEDGC_setPointerHandler(pointerHandler) { - this.pointerHandler = pointerHandler; - this.originalPointerCoordinates = null; - this.currentPointerCoordinates = null; - this.updateFromPointerHandler(); - this.originalPointerCoordinates = this.currentPointerCoordinates.clone(); - }, - - updateFromPointerHandler: function SEDGC_updateFromPointerHandler() { - var newCoordinates = this.pointerHandler.getEventViewCoordinates(); - if (!this.currentPointerCoordinates - || !newCoordinates - || newCoordinates.x != this.currentPointerCoordinates.x - || newCoordinates.y != this.currentPointerCoordinates.y) { - this.currentPointerCoordinates = newCoordinates; - if (this.originalPointerCoordinates) { - if (!newCoordinates) - this.currentPointerCoordinates = this.originalPointerCoordinates.clone(); - this._updateCoordinates(); - if (this.ghosts) { - this._updateGhosts(); - if (this.startHourPara) - this._updateGhostsParas(); - } - } - } - }, - - _updateMulticolumnViewDayNumber_SEDGC: function() { - var calendarID_SEDGC = this.folderClass.substr(14); - var calendarList = $("calendarList").getElementsByTagName("li"); - activeCalendars = []; - for (var j = 0; j < calendarList.length ; j++) { - if ($("calendarList").getElementsByTagName("li")[j].down().checked) - activeCalendars.push($("calendarList").getElementsByTagName("li")[j].getAttribute("id").substr(1)); - } - for (var k = 0; k < activeCalendars.length; k++) { - if (activeCalendars[k] == calendarID_SEDGC) { - this.currentCoordinates.dayNumber = k; - break; - } - } - }, - - _updateCoordinates: function SEDGC__updateCoordinates() { - var delta = this.currentPointerCoordinates - .getDelta(this.originalPointerCoordinates); - var deltaQuarters = delta.x * SOGoEventDragDayLength + delta.y; - if (currentView == "multicolumndayview") - this._updateMulticolumnViewDayNumber_SEDGC(); - else - this.currentCoordinates.dayNumber = this.originalCoordinates.dayNumber; - - // log("dragMode: " + this.dragMode); - if (this.dragMode == "move-event") { - this.currentCoordinates.start - = this.originalCoordinates.start + deltaQuarters; - this.currentCoordinates.duration - = this.originalCoordinates.duration; - // log("start: " + this.currentCoordinates.start); - // log(" duration: " + this.currentCoordinates.duration); - } else { - if (this.dragMode == "change-start") { - var newDuration = this.originalCoordinates.duration - deltaQuarters; - if (newDuration > 0) { - this.currentCoordinates.start - = this.originalCoordinates.start + deltaQuarters; - this.currentCoordinates.duration = newDuration; - } else if (newDuration < 0) { - this.currentCoordinates.start - = (this.originalCoordinates.start - + this.originalCoordinates.duration); - this.currentCoordinates.duration = -newDuration; - } - } else if (this.dragMode == "change-end") { - var newDuration = this.originalCoordinates.duration + deltaQuarters; - if (newDuration > 0) { - this.currentCoordinates.start = this.originalCoordinates.start; - this.currentCoordinates.duration = newDuration; - } else if (newDuration < 0) { - this.currentCoordinates.start - = this.originalCoordinates.start + newDuration; - this.currentCoordinates.duration = -newDuration; - } - } - } - - if (this.currentCoordinates.start < 0) { - var deltaDays = Math.ceil(-this.currentCoordinates.start - / SOGoEventDragDayLength); - this.currentCoordinates.start += deltaDays * SOGoEventDragDayLength; - this.currentCoordinates.dayNumber -= deltaDays; - } else if (this.currentCoordinates.start >= SOGoEventDragDayLength) { - var deltaDays = Math.floor(this.currentCoordinates.start - / SOGoEventDragDayLength); - this.currentCoordinates.start -= deltaDays * SOGoEventDragDayLength; - - // This dayNumber needs to be updated with the calendar number. - if (currentView == "multicolumndayview") - this._updateMulticolumnViewDayNumber_SEDGC(); - this.currentCoordinates.dayNumber += deltaDays; - } - }, - - showGhosts: function SEDGC_showGhosts() { - if (!this.ghosts) { - this.ghosts = []; - var utilities = SOGoEventDragUtilities(); - var nodes = utilities.getEventContainerNodes(); - var isMultiday = (utilities.getEventType() == "multiday"); - for (var i = 0; i < nodes.length; i++) { - var newGhost = $(document.createElement("div")); - Object.extend(newGhost, SOGoDragGhostInterface); - newGhost.className = "event eventDragGhost"; - newGhost.cssHandlesPosition = isMultiday; - newGhost.hide(); - - var ghostInside = $(document.createElement("div")); - ghostInside.className = "eventInside"; - newGhost.inside = ghostInside; - newGhost.appendChild(ghostInside); - - nodes[i].appendChild(newGhost); - this.ghosts.push(newGhost); - } - if (isMultiday) { - var ghostHourPara = $(document.createElement("div")); - ghostHourPara.setAttribute("id", "ghostStartHour"); - this.startHourPara = ghostHourPara; - ghostHourPara = $(document.createElement("div")); - ghostHourPara.setAttribute("id", "ghostEndHour"); - this.endHourPara = ghostHourPara; - } - this._updateGhosts(); - if (this.startHourPara) - this._updateGhostsParas(); - } - }, - hideGhosts: function SEDGC_hideGhosts() { - if (this.ghosts) { - if (this.startHourPara && this.startHourPara.parentNode) - this.startHourPara.parentNode.removeChild(this.startHourPara); - this.startHourPara = null; - if (this.endHourPara && this.endHourPara.parentNode) - this.endHourPara.parentNode.removeChild(this.endHourPara); - this.endHourPara = null; - for (var i = 0; i < this.ghosts.length; i++) { - var ghost = this.ghosts[i]; - ghost.parentNode.removeChild(ghost); - } - this.ghosts = null; - } - }, - - _updateGhosts: function SEDGC__updateGhosts() { - var maxGhosts = this.ghosts.length; - var max = this.currentCoordinates.dayNumber; - if (max > maxGhosts) - max = maxGhosts; - for (var i = 0; i < max; i++) { - var ghost = this.ghosts[i]; - ghost.hide(); - ghost.unsetStartGhost(); - ghost.unsetEndGhost(); - } - if (this.currentCoordinates.dayNumber < maxGhosts) { - var currentDay = this.currentCoordinates.dayNumber; - var durationLeft = this.currentCoordinates.duration; - var start = this.currentCoordinates.start; - var maxDuration = SOGoEventDragDayLength - start; - var duration = durationLeft; - if (duration > maxDuration) - duration = maxDuration; - - var ghost = null; - if (currentDay > -1) { - ghost = this.ghosts[currentDay]; - ghost.setStartGhost(); - ghost.unsetEndGhost(); - ghost.setTitle(this.eventTitle); - ghost.setLocation(this.eventLocation); - ghost.setFolderClass(this.folderClass); - ghost.setStart(this.currentCoordinates.start); - ghost.setDuration(duration); - ghost.show(); - - if (this.startHourPara) { - var parentNode = this.startHourPara.parentNode; - if (parentNode && parentNode != ghost) - parentNode.removeChild(this.startHourPara); - ghost.appendChild(this.startHourPara); - } - } - durationLeft -= duration; - currentDay++; - while (durationLeft && currentDay < maxGhosts) { - duration = durationLeft; - if (duration > SOGoEventDragDayLength) - duration = SOGoEventDragDayLength; - if (currentDay > -1) { - ghost = this.ghosts[currentDay]; - ghost.unsetStartGhost(); - ghost.unsetEndGhost(); - ghost.setTitle(); - ghost.setFolderClass(this.folderClass); - ghost.setStart(0); - ghost.setDuration(duration); - ghost.show(); - } - durationLeft -= duration; - currentDay++; - } - if (!durationLeft) { - ghost.setEndGhost(); - } - - if (this.endHourPara) { - var parentNode = this.endHourPara.parentNode; - if (parentNode && parentNode != ghost) - parentNode.removeChild(this.endHourPara); - ghost.appendChild(this.endHourPara); - } - - while (currentDay < maxGhosts) { - var ghost = this.ghosts[currentDay]; - ghost.hide(); - ghost.unsetStartGhost(); - ghost.unsetEndGhost(); - currentDay++; - } - } - }, - - _updateGhostsParas: function SEDGC__updateGhostsParas() { - var para = this.startHourPara; - while (para.childNodes.length) - para.removeChild(para.childNodes[0]); - var time = this.currentCoordinates.getStartTime(); - para.appendChild(document.createTextNode(time)); - - para = this.endHourPara; - while (para.childNodes.length) - para.removeChild(para.childNodes[0]); - time = this.currentCoordinates.getEndTime(); - para.appendChild(document.createTextNode(time)); - } -}; - -function SOGoCoordinates() { -} - -SOGoCoordinates.prototype = { - x: -1, - y: -1, - - getDelta: function SC_getDelta(otherCoordinates) { - var delta = new SOGoCoordinates(); - delta.x = this.x - otherCoordinates.x; - delta.y = this.y - otherCoordinates.y; - - return delta; - }, - - getDistance: function SC_getDistance(otherCoordinates) { - var delta = this.getDelta(otherCoordinates); - - return Math.sqrt(delta.x * delta.x + delta.y * delta.y); - }, - - clone: function SC_clone() { - var coordinates = new SOGoCoordinates(); - coordinates.x = this.x; - coordinates.y = this.y; - - return coordinates; - } -}; - -function SOGoEventDragPointerHandler() { -} - -SOGoEventDragPointerHandler.prototype = { - originalCoordinates: null, - currentCoordinates: null, - containerCoordinates: null, - - /* return the day and quarter coordinates of the pointer cursor within the - day view */ - getEventViewCoordinates: null, - - initFromEvent: function SEDPH_initFromEvent(event) { - this.currentCoordinates = new SOGoCoordinates(); - this.updateFromEvent(event); - this.originalCoordinates = this.currentCoordinates.clone(); - - var utilities = SOGoEventDragUtilities(); - this.containerCoordinates = utilities.getEventsViewNodeCumulativeCoordinates(); - if (utilities.getEventType() == "multiday-allday") { - /* a hack */ - this.containerCoordinates.x -= SOGoEventDragVerticalOffset; - this.containerCoordinates.y -= 40; - } - }, - - updateFromEvent: function SEDPH_updateFromEvent(event) { - this.currentCoordinates.x = Event.pointerX(event); - this.currentCoordinates.y = Event.pointerY(event); - }, - - getContainerBasedCoordinates: function SEDPH_getCBC() { - var coordinates = this.currentCoordinates.getDelta(this.containerCoordinates); - var container = SOGoEventDragUtilities().getEventsViewNode(); - - if (container.clientWidth == 0) - /* a hack for Safari */ - container = $(container.id); - if (coordinates.x < 0 || coordinates.x > container.clientWidth - || coordinates.y < 0 || coordinates.y > container.clientHeight) - coordinates = null; - - return coordinates; - }, - - prepareWithEventType: function SEDPH_prepareWithEventType(eventType) { - var methods = { "multiday": this.getEventMultiDayViewCoordinates, - "multiday-allday": this.getEventMultiDayAllDayViewCoordinates, - "monthly": this.getEventMonthlyViewCoordinates, - "unknown": null }; - var method = methods[eventType]; - this.getEventViewCoordinates = method; - }, - - getEventMultiDayViewCoordinates: function SEDPH_gEMultiDayViewC() { - var coordinates = this.getEventMultiDayAllDayViewCoordinates(); - if (coordinates) { - var utilities = SOGoEventDragUtilities(); - var quarterHeight = utilities.getQuarterHeight(); - var container = utilities.getEventsViewNode(); - var pxCoordinates = this.getContainerBasedCoordinates(); - pxCoordinates.y += container.scrollTop; - coordinates.y = Math.floor((pxCoordinates.y - - SOGoEventDragHorizontalOffset) - / quarterHeight); - var maxY = SOGoEventDragDayLength - 1; - if (coordinates.y < 0) - coordinates.y = 0; - else if (coordinates.y > maxY) - coordinates.y = maxY; - } - - return coordinates; - }, - getEventMultiDayAllDayViewCoordinates: function SEDPH_gEMultiDayADVC() { - /* x = day; y = quarter */ - var coordinates; - - var pxCoordinates = this.getContainerBasedCoordinates(); - if (pxCoordinates) { - coordinates = new SOGoCoordinates(); - - var utilities = SOGoEventDragUtilities(); - var dayWidth = utilities.getDayWidth(); - var daysOffset = utilities.getDaysOffset(); - - coordinates.x = Math.floor((pxCoordinates.x - daysOffset) / dayWidth); - var maxX = utilities.getEventContainerNodes().length - 1; - if (coordinates.x < 0) - coordinates.x = 0; - else if (coordinates.x > maxX) - coordinates.x = maxX; - coordinates.y = 0; - } else { - coordinates = null; - } - - // logOnly("coordinates.x: " + coordinates.x); - - return coordinates; - }, - getEventMonthlyViewCoordinates: function SEDPH_gEMonthlyViewC() { - /* x = day; y = quarter */ - var coordinates; - - var pxCoordinates = this.getContainerBasedCoordinates(); - if (pxCoordinates) { - coordinates = new SOGoCoordinates(); - var utilities = SOGoEventDragUtilities(); - var daysOffset = utilities.getDaysOffset(); - var daysTopOffset = daysOffset; /* change later */ - var dayHeight = utilities.getDayHeight(); - var daysY = Math.floor((pxCoordinates.y - daysTopOffset) / dayHeight); - if (daysY < 0) - daysY = 0; - var dayWidth = utilities.getDayWidth(); - - coordinates.x = Math.floor((pxCoordinates.x - daysOffset) / dayWidth); - if (coordinates.x < 0) - coordinates.x = 0; - else if (coordinates.x > 6) - coordinates.x = 6; - coordinates.x += 7 * daysY; - coordinates.y = 0; - } else { - coordinates = null; - } - - return coordinates; - }, - - getDistance: function SEDPH_getDistance() { - return this.currentCoordinates.getDistance(this.originalCoordinates); - } -}; - -function SOGoScrollController() { - this.init(); -} - -SOGoScrollController.prototype = { - pointerHandler: null, - - scrollView: null, - lastScroll: 0, - scrollStep: 0, - - init: function SSC_init() { - var utilities = SOGoEventDragUtilities(); - this.scrollView = utilities.getEventsViewNode(); - this.scrollStep = 6 * utilities.getQuarterHeight(); - }, - - setPointerHandler: function SSC_setPointerHandler(pointerHandler) { - this.pointerHandler = pointerHandler; - }, - - updateFromPointerHandler: function SSC_updateFromPointerHandler() { - var pointerCoordinates - = this.pointerHandler.getContainerBasedCoordinates(); - if (pointerCoordinates) { - var now = new Date().getTime(); - if (!this.lastScroll || now > this.lastScroll + 100) { - this.lastScroll = now; - var scrollY = pointerCoordinates.y - this.scrollStep; - if (scrollY < 0) { - var minY = -this.scrollView.scrollTop; - if (scrollY < minY) - scrollY = minY; - this.scrollView.scrollTop += scrollY; - } else { - scrollY = pointerCoordinates.y + this.scrollStep; - var delta = scrollY - this.scrollView.clientHeight; - if (delta > 0) { - this.scrollView.scrollTop += delta; - } - } - } - } - } -}; - -function SOGoEventDragLeftPanelController() { -} - -SOGoEventDragLeftPanelController.prototype = { - updateLeftPanelVisual : null, - dropCalendar : null, - DnDLeftPanelImage : $("DnDLeftPanelImage"), - - setLeftPanelVisual: function SEDLPC_setLeftPanelVisual() { - var that = this; - this.updateLeftPanelVisual = $("leftPanel").on("mousemove", function(e){ - that.DnDLeftPanelImage.style.left = e.pageX + 5 + "px"; - that.DnDLeftPanelImage.style.top = e.pageY + 5 + "px"; - }); - }, - - updateFromPointerHandler: function SEDLPC_updateFromPointerHandler(event) { - // Highlight the calendar hover - $$('#calendarList li').each(function(e){ - e.removeClassName('genericHoverClass'); - }); - var hoverCalendar = $(event).findElement('#calendarList li'); - if (hoverCalendar) { - hoverCalendar.addClassName('genericHoverClass'); - this.dropCalendar = hoverCalendar; - } - else - this.dropCalendar = null; - }, - - startEvent: function SEDLPC_startEvent() { - this.DnDLeftPanelImage.style.visibility = 'visible'; - this.updateLeftPanelVisual.start(); - }, - - stopEvent: function SEDLPC_stopEvent() { - this.DnDLeftPanelImage.style.visibility = 'hidden'; - this.updateLeftPanelVisual.stop(); - } -} - -function SOGoEventDragController() { -} - -SOGoEventDragController.prototype = { - eventCells: null, - - eventType: null, - eventIsInvitation: false, - title: null, - folderClass: null, - - draggingModeAreas: null, - - ghostController: null, - leftPanelController: null, - - hasSelected: false, - dragHasStarted: false, - dragMode: null, - originalDayNumber: -1, - - pointerHandler: null, - - dropCallback: null, - - onDragStartBound: null, - onDragStopBound: null, - onDragModeBound: null, - - _determineDragMode: null, - - attachToEventCells: function SEDC_attachToEventCells(eventCells) { - this.eventCells = eventCells; - - this.ghostController = new SOGoEventDragGhostController(); - this.leftPanelController = new SOGoEventDragLeftPanelController(); - this._determineEventInvitation(eventCells[0]); - this._determineEventType(eventCells[0]); - this._prepareEventType(); - this._determineTitleAndFolderClass(); - this.ghostController.setTitle(this.title); - this.ghostController.setLocation(this.location); - this.ghostController.setFolderClass(this.folderClass); - this.leftPanelController.setLeftPanelVisual(); - - this.onDragStartBound = this.onDragStart.bindAsEventListener(this); - for (var i = 0; i < eventCells.length; i++) { - eventCells[i].observe("mousedown", this.onDragStartBound, false); - if (eventCells[i].editable && !this.eventIsInvitation) { - eventCells[i].addClassName("draggable"); - } - } - - if (this.eventType == "multiday") { - var topDragGrip = $(document.createElement("div")); - topDragGrip.addClassName("topDragGrip"); - eventCells[0].appendChild(topDragGrip); - - var bottomDragGrip = $(document.createElement("div")); - bottomDragGrip.addClassName("bottomDragGrip"); - eventCells[eventCells.length-1].appendChild(bottomDragGrip); - } else { - var leftDragGrip = $(document.createElement("div")); - leftDragGrip.addClassName("leftDragGrip"); - eventCells[0].appendChild(leftDragGrip); - - var rightDragGrip = $(document.createElement("div")); - rightDragGrip.addClassName("rightDragGrip"); - eventCells[eventCells.length-1].appendChild(rightDragGrip); - } - }, - - attachToDayNode: function SEDC_attachToDayNode(dayNode) { - this._determineEventType(dayNode); - this._prepareEventType(); - this.ghostController = new SOGoEventDragGhostController(); - this.ghostController.setTitle(_("New Event")); - - this.onDragStartBound = this.onDragStart.bindAsEventListener(this); - dayNode.observe("mousedown", this.onDragStartBound, false); - }, - - onDragStart: function SEDC_onDragStart(event) { - var target = getTarget(event); - if (eventIsLeftClick(event) && (target.nodeType == 1)) { - if (/minutes\d{2}/.test(target.className)) - target = target.parentNode; - if ((!this.eventCells - && (target.hasClassName("clickableHourCell") - || target.hasClassName("day")) - && (target.scrollHeight - target.clientHeight <= 1)) - || (this.eventCells && this.eventCells[0].editable - && !this.eventIsInvitation)) { - var utilities = SOGoEventDragUtilities(); - utilities.setEventType(this.eventType); - - this.pointerHandler = new SOGoEventDragPointerHandler(); - this.pointerHandler.prepareWithEventType(this.eventType); - this.pointerHandler.initFromEvent(event); - - var coordinates = new SOGoEventDragEventCoordinates(); - coordinates.setEventType(this.eventType); - if (this.eventCells) { - coordinates.initFromEventCells(this.eventCells); - } else { - var eventViewCoordinates - = this.pointerHandler.getEventViewCoordinates(); - coordinates.dayNumber = eventViewCoordinates.x; - coordinates.start = eventViewCoordinates.y; - coordinates.duration = 1; - } - this.ghostController.initWithCoordinates(coordinates); - - if (!this.eventCells) { - if (currentView == "multicolumndayview") { - if (target.getAttribute("calendar")) - var folderID = target.getAttribute("calendar"); - else - var folderID = target.up("[calendar]").getAttribute("calendar"); - } - else { - var folder = getSelectedFolder(); - var folderID = folder.readAttribute("id").substr(1); - } - this.ghostController.setFolderClass("calendarFolder" + folderID); - } - this.ghostController.setDragMode(this._determineDragMode()); - this.ghostController.setPointerHandler(this.pointerHandler); - - if (this.eventType == "multiday") { - this.scrollController = new SOGoScrollController(); - this.scrollController.setPointerHandler(this.pointerHandler); - } - - this.onDragStopBound - = this.onDragStop.bindAsEventListener(this); - if (Prototype.Browser.IE) - Event.observe(document.body, - "mouseup", this.onDragStopBound); - else - Event.observe(window, "mouseup", this.onDragStopBound); - this.onDragModeBound = this.onDragMode.bindAsEventListener(this); - Event.observe(document.body, "mousemove", this.onDragModeBound); - } - } - }, - - _determineEventInvitation: function SEDC__determineEventType(node) { - var isInvitation = false; - for (var i = 0; !isInvitation && i < userStates.length; i++) { - var inside = node.select("DIV.eventInside")[0]; - if (inside.hasClassName(userStates[i])) - isInvitation = true; - } - - this.eventIsInvitation = isInvitation; - }, - - _determineEventType: function SEDC__determineEventType(node) { - var type = "unknown"; - - var dayNode; - var currentNode = node; - while (!currentNode.hasClassName("day")) - currentNode = currentNode.parentNode; - dayNode = currentNode; - - // log("dayNode: " + dayNode.className); - var secondParent = dayNode.parentNode; - // log("secondParent: " + secondParent.className); - if (secondParent.id == "monthDaysView") { - type = "monthly"; - } else { - var thirdParent = secondParent.parentNode; - // log("thirdParent: " + thirdParent.id); - if (thirdParent.id == "calendarHeader") - type = "multiday-allday"; - else if (thirdParent.id == "daysView") - type = "multiday"; - } - - // log("type: " + type); - - this.eventType = type; - }, - _prepareEventType: function SEDC__prepareEventType() { - var methods - = { "multiday": this._determineDragModeMultiDay, - "multiday-allday": this._determineDragModeMultiDayAllDay, - "monthly": this._determineDragModeMonthly, - "unknown": null }; - this._determineDragMode = methods[this.eventType]; - }, - - _determineDragModeMultiDay: function SEDC__determineDragModeMultiDay() { - var dragMode; - - if (this.eventCells) { - var coordinates = this.pointerHandler.currentCoordinates.clone(); - var utilities = SOGoEventDragUtilities(); - var scrollView = utilities.getEventsViewNode(); - coordinates.y += scrollView.scrollTop; - coordinates.y -= SOGoEventDragVerticalOffset; - - var firstCell = this.eventCells[0]; - var handleCoords = firstCell.cumulativeOffset(); - - dragMode = "move-event"; - if ((handleCoords[0] <= coordinates.x - && coordinates.x <= handleCoords[0] + firstCell.clientWidth) - && (handleCoords[1] <= coordinates.y - && coordinates.y <= handleCoords[1] + SOGoEventDragHandleSize)) - dragMode = "change-start"; - else { - var lastCell = this.eventCells[this.eventCells.length-1]; - handleCoords = lastCell.cumulativeOffset(); - handleCoords[1] += (lastCell.clientHeight - - SOGoEventDragHandleSize - 1); - if ((handleCoords[0] <= coordinates.x - && coordinates.x <= handleCoords[0] + lastCell.clientWidth) - && (handleCoords[1] <= coordinates.y - && coordinates.y <= handleCoords[1] + SOGoEventDragHandleSize)) - dragMode = "change-end"; - } - } else { - dragMode = "change-end"; - } - - return dragMode; - }, - _determineDragModeMultiDayAllDay: function SEDC__detDMMultiDayAllDay() { - var dragMode; - - if (this.eventCells) { - var coordinates = this.pointerHandler.currentCoordinates.clone(); - coordinates.x -= SOGoEventDragHorizontalOffset; - coordinates.y -= SOGoEventDragVerticalOffset; - - var firstCell = this.eventCells[0]; - var handleCoords = firstCell.cumulativeOffset(); - - dragMode = "move-event"; - if (handleCoords[0] <= coordinates.x - && coordinates.x <= handleCoords[0] + SOGoEventDragHandleSize) - dragMode = "change-start"; - else { - var lastCell = this.eventCells[this.eventCells.length-1]; - handleCoords = lastCell.cumulativeOffset(); - handleCoords[0] += lastCell.clientWidth; - if (handleCoords[0] - SOGoEventDragHandleSize <= coordinates.x - && coordinates.x <= handleCoords[0]) - dragMode = "change-end"; - } - } else { - dragMode = "change-end"; - } - - return dragMode; - }, - _determineDragModeMonthly: function SEDC__determineDragModeMultiDay() { - var dragMode; - - if (this.eventCells) { - var coordinates = this.pointerHandler.currentCoordinates.clone(); - coordinates.x -= SOGoEventDragHorizontalOffset; - coordinates.y -= SOGoEventDragVerticalOffset; - - var firstCell = this.eventCells[0]; - var handleCoords = firstCell.cumulativeOffset(); - - dragMode = "move-event"; - var eventHeight = 16; /* arbitrary value */ - - if (handleCoords[1] <= coordinates.y - && coordinates.y <= handleCoords[1] + eventHeight - && handleCoords[0] <= coordinates.x - && coordinates.x <= handleCoords[0] + SOGoEventDragHandleSize) - dragMode = "change-start"; - else { - var lastCell = this.eventCells[this.eventCells.length-1]; - handleCoords = lastCell.cumulativeOffset(); - handleCoords[0] += lastCell.clientWidth; - if (handleCoords[1] <= coordinates.y - && coordinates.y <= handleCoords[1] + eventHeight - && handleCoords[0] - SOGoEventDragHandleSize <= coordinates.x - && coordinates.x <= handleCoords[0]) - dragMode = "change-end"; - } - } else { - dragMode = "change-end"; - } - - return dragMode; - }, - - _determineTitleAndFolderClass: function SEDC__dTAFC() { - var title = ""; - var folderClass = ""; - var location = null; - if (this.eventCells) { - var firstCell = this.eventCells[0]; - var divs = firstCell.childNodesWithTag("div"); - for (var i = 0; i < divs.length; i++) { - var div = divs[i]; - if (div.hasClassName("eventInside")) { - var titleDIV = this._determineTitleDIV(div); - if (titleDIV) { - title = this._determineTitleFromDIV(titleDIV); - location = this._determineLocationFromDIV(titleDIV); - } - folderClass = this._determineFolderClassFromDIV(div); - } - } - } - this.title = title; - this.location = location; - this.folderClass = folderClass; - }, - _determineTitleDIV: function SEDC__determineTitleDIV(div) { - var titleDIV = null; - var insideDivs = div.childNodesWithTag("div"); - for (var i = 0; titleDIV == null && i < insideDivs.length; i++) { - var insideDiv = insideDivs[i]; - if (insideDiv.hasClassName("text")) { - titleDIV = insideDiv; - } - } - - return titleDIV; - }, - _determineTitleFromDIV: function SEDC__determineTitleFromDIV(titleDIV) { - var title = ""; - - var currentNode = titleDIV.firstChild; - while (currentNode) { - if (currentNode.nodeType == Node.TEXT_NODE) { - title += currentNode.nodeValue; - } - currentNode = currentNode.nextSibling; - } - - return title.trim(); - }, - _determineLocationFromDIV: function SEDC__determineLocationFromDIV(titleDIV) { - var location = ""; - - var spans = titleDIV.select("span.location"); - if (spans && spans.length > 0) { - var locationSPAN = spans[0]; - var currentNode = locationSPAN.firstChild; - while (currentNode) { - if (currentNode.nodeType == Node.TEXT_NODE) { - location += currentNode.nodeValue; - } - currentNode = currentNode.nextSibling; - } - } - - return location.trim(); - }, - _determineFolderClassFromDIV: function SEDC__detFolderClassFromDIV(div) { - var folderClass = null; - - var classes = div.className.split(" "); - for (var i = 0; folderClass == null && i < classes.length; i++) { - var currentClass = classes[i]; - if (currentClass.startsWith("calendarFolder")) { - folderClass = currentClass; - } - } - - return folderClass; - }, - - onDragStop: function SEDC_onDragStop(event) { - if (Prototype.Browser.IE) - Event.stopObserving(document.body, "mouseup", this.onDragStopBound); - else - Event.stopObserving(window, "mouseup", this.onDragStopBound); - Event.stopObserving(document.body, "mousemove", this.onDragModeBound); - this.onDragStopBound = null; - this.onDragModeBound = null; - if (this.leftPanelController) - this.leftPanelController.stopEvent(); - - var utilities = SOGoEventDragUtilities(); - if (this.dragHasStarted) { - this.ghostController.hideGhosts(); - this.dragHasStarted = false; - - if (this.eventCells) { - for (var i = 0; i < this.eventCells.length; i++) { - var currentCell = this.eventCells[i]; - currentCell.removeClassName("dragging"); - } - var delta = this.ghostController - .currentCoordinates - .getDelta(this.ghostController - .originalCoordinates); - - if (this.leftPanelController.dropCalendar != null) { - $$('#calendarList li').each(function(e) { - e.removeClassName('genericHoverClass'); - }); - calendarID[0] = this.folderClass.substr(14); - calendarID[1] = this.leftPanelController.dropCalendar.getAttribute("id").substr(1); - delta.start = 0; - if (calendarID[0] != calendarID[1]) - this.updateDropCallback(this, this.eventCells, delta, calendarID); - } - else if (currentView == "multicolumndayview" && delta.dayNumber != 0) { - var position = activeCalendars.indexOf(calendarID[0]); - position += delta.dayNumber; - calendarID[1] = activeCalendars[position]; - this.updateDropCallback(this, this.eventCells, delta, calendarID); - } - else - this.updateDropCallback(this, this.eventCells, delta, 0); - } else { - var eventContainerNodes = utilities.getEventContainerNodes(); - var dayNode = eventContainerNodes[this.ghostController - .currentCoordinates - .dayNumber]; - if (dayNode.hasClassName("events")) - dayNode = dayNode.parentNode; - this.createDropCallback(this, - dayNode.readAttribute("day"), - this.ghostController.currentCoordinates); - } - } - utilities.reset(); - - Event.stop(event); - }, - - _coordinateToTime: function SEDC_coordinateToTime(coordinate) { - var hours = Math.floor(coordinate / 4); - var minutes = (coordinate % 4) * 15; - if (minutes < 10) - minutes = "0" + minutes; - var time = hours + ":" + minutes; - - return time; - }, - - onDragMode: function SEDC_onDragMode(event) { - this.pointerHandler.updateFromEvent(event); - if (this.scrollController) - this.scrollController.updateFromPointerHandler(); - - if (this.dragHasStarted) { - var newCoordinates = this.ghostController.pointerHandler.getEventViewCoordinates(); - if (newCoordinates == null && this.leftPanelController != null) { - if (this.ghostController.ghosts) { - this.ghostController.hideGhosts(); - this.leftPanelController.startEvent(); - } - this.leftPanelController.updateFromPointerHandler(event); - } - else { - if (this.ghostController.ghosts == null) { - this.ghostController.showGhosts(); - this.leftPanelController.dropCalendar = null; - $$('#calendarList li').each(function(e){ e.removeClassName('genericHoverClass'); }); - this.leftPanelController.stopEvent(); - } - this.ghostController.updateFromPointerHandler(); - } - } - else { - var distance = this.pointerHandler.getDistance(); - if (distance > 3) { - $("eventDialog").hide(); - this.dragHasStarted = true; - if (this.eventCells) { - for (var i = 0; i < this.eventCells.length; i++) { - var currentCell = this.eventCells[i]; - currentCell.addClassName("dragging"); - } - } - this.ghostController.showGhosts(); - this.ghostController.updateFromPointerHandler(); - } - } - Event.stop(event); - } -}; diff --git a/UI/WebServerResources/Search-bar.png b/UI/WebServerResources/Search-bar.png deleted file mode 100644 index 4bae71c76..000000000 Binary files a/UI/WebServerResources/Search-bar.png and /dev/null differ diff --git a/UI/WebServerResources/UIxAclEditor.css b/UI/WebServerResources/UIxAclEditor.css deleted file mode 100644 index 6fa681531..000000000 --- a/UI/WebServerResources/UIxAclEditor.css +++ /dev/null @@ -1,76 +0,0 @@ -DIV.acls -{ position: absolute; - top: 0px; - left: 0px; - right: 0px; - bottom: 0px; - padding: 0px; - border: 0px; - margin: 0px; } - -DIV.acls LABEL -{ white-space: nowrap; - width: 100%; } - -#userRoles -{ position: absolute; - top: 5px; - left: 0px; - right: 0px; - bottom: 0px; } - -#userSelectorButtons -{ margin-left: 5px; - padding-bottom: 2px; } - -UL#userList -{ position: absolute; - left: 0px; - right: 0px; - top: 40px; - bottom: 0px; - padding: 0px; - margin: 0px; - white-space: nowrap; - overflow: auto; - border-bottom: 1px solid #fff; - border-right: 1px solid #fff; - border-top: 1px solid #909090; - border-left: 1px solid #909090; - background-color: #CCDDEC; - list-style-type: none; - list-style-image: none; } - -UL#userList LI -{ clear: both; - cursor: pointer; - height: 20px; - text-align: right; - margin-left: 0px; - padding-left: 24px; - background-repeat: no-repeat; - background-position: 4px center; } - -UL#userList LI.normal-user, -UL#userList LI.normal-person -{ background-image: url("abcard.png"); } - -UL#userList LI.normal-group -{ background-image: url("ablist.png"); } - -UL#userList LI.any-user -{ background-image: url("abcard-anyone.png"); - border-top: 1px dotted #555; } - -UL#userList LI.anonymous-user -{ background-image: url("abcard-anonymous.png"); } - -DIV#userSelectorButtons A.smallToolbarButton -{ float: left; } - -SPAN.userFullName -{ float: left; - margin-top: 2px; } - -LABEL.subscriptionArea -{ padding-right: 5px; } diff --git a/UI/WebServerResources/UIxAclEditor.js b/UI/WebServerResources/UIxAclEditor.js deleted file mode 100644 index b586c475d..000000000 --- a/UI/WebServerResources/UIxAclEditor.js +++ /dev/null @@ -1,246 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -var contactSelectorAction = 'acls-contacts'; -var defaultUserID = ''; -var AclEditor = { - userRightsHeight: null, - userRightsWidth: null -}; - -var usersToSubscribe = []; - -function addUser(userName, userID, type) { - var result = false; - if (!$(userID)) { - var ul = $("userList"); - var lis = ul.childNodesWithTag("li"); - var newNode = nodeForUser(userName, userID, canSubscribeUsers); - newNode.addClassName("normal-" + type); - - var count = lis.length - 1; - var inserted = false; - while (count > -1 && !inserted) { - if ($(lis[count]).hasClassName("normal-user")) { - if ((count+1) < lis.length) - ul.insertBefore(newNode, lis[count+1]); - else - ul.appendChild(newNode); - inserted = true; - } - else { - count--; - } - } - if (!inserted) { - if (lis.length > 0) - ul.insertBefore(newNode, lis[0]); - else - ul.appendChild(newNode); - } - - var url = window.location.href; - var elements = url.split("/"); - elements[elements.length-1] = ("addUserInAcls?uid=" - + encodeURIComponent(userID.unescapeHTML())); - triggerAjaxRequest(elements.join("/"), addUserCallback, newNode); - result = true; - } - return result; -} - -function addUserCallback(http) { - if (http.readyState == 4) { - if (!isHttpStatus204(http.status)) { - var node = http.callbackData; - node.parentNode.removeChild(node); - } - } -} - -function setEventsOnUserNode(node) { - var n = $(node); - n.observe("mousedown", listRowMouseDownHandler); - n.observe("selectstart", listRowMouseDownHandler); - n.observe("dblclick", onOpenUserRights); - n.observe("click", onRowClick); - - var cbParents = n.childNodesWithTag("label"); - if (cbParents && cbParents.length) { - var cbParent = $(cbParents[0]); - var checkbox = cbParent.childNodesWithTag("input")[0]; - $(checkbox).observe("change", onSubscriptionChange); - } -} - -function onSubscriptionChange(event) { - var li = this.parentNode.parentNode; - var username = li.getAttribute("id"); - var idx = usersToSubscribe.indexOf(username); - if (this.checked) { - if (idx < 0) - usersToSubscribe.push(username); - } else { - if (idx > -1) - usersToSubscribe.splice(idx, 1); - } -} - -function nodeForUser(userName, userId, canSubscribe) { - var node = createElement("li"); - node.id = userId; - - var span = createElement("span"); - span.addClassName("userFullName"); - span.appendChild(document.createTextNode(" " + userName.unescapeHTML())); - node.appendChild(span); - - if (canSubscribe) { - var label = createElement("label"); - label.addClassName("subscriptionArea"); - var cb = createElement("input"); - cb.type = "checkbox"; - label.appendChild(cb); - label.appendChild(document.createTextNode(_("Subscribe User"))); - node.appendChild(label); - } - - setEventsOnUserNode(node); - - return node; -} - -function onUserAdd(event) { - openUserFolderSelector(null, "user"); - - preventDefault(event); -} - -function removeUserCallback(http) { - var node = http.callbackData; - - if (http.readyState == 4 - && isHttpStatus204(http.status)) - node.parentNode.removeChild(node); - else - log("error deleting user: " + node.getAttribute("id")); -} - -function onUserRemove(event) { - var userList = $("userList"); - var nodes = userList.getSelectedRows(); - - var url = window.location.href; - var elements = url.split("/"); - elements[elements.length-1] = "removeUserFromAcls?uid="; - var baseURL = elements.join("/"); - - for (var i = 0; i < nodes.length; i++) { - var userId = nodes[i].id.unescapeHTML(); - if (userId != defaultUserID && userId != "anonymous") { - triggerAjaxRequest(baseURL + encodeURIComponent(userId), removeUserCallback, - nodes[i]); - } - } - preventDefault(event); -} - -function subscribeToFolder(refreshCallback, refreshCallbackData) { - var result = true; - if (UserLogin != refreshCallbackData["folder"]) { - result = addUser(refreshCallbackData["folderName"], - refreshCallbackData["folder"], - refreshCallbackData["type"]); - } - else - refreshCallbackData["window"].alert(_("You cannot subscribe to a folder that you own!")); - return result; -} - -function openRightsForUserID(userID) { - var url = window.location.href; - var elements = url.split("/"); - elements[elements.length-1] = "userRights?uid=" + encodeURIComponent(userID); - - var height = AclEditor.userRightsHeight; - if (userID == "anonymous") { - height -= 42; - if (CurrentModule() == "Contacts") { - height -= 21; - } - } - window.open(elements.join("/"), "", - "width=" + AclEditor.userRightsWidth - + ",height=" + height - + ",resizable=0,scrollbars=0,toolbar=0," - + "location=0,directories=0,status=0,menubar=0,copyhistory=0"); -} - -function openRightsForUser(button) { - var nodes = $("userList").getSelectedRows(); - if (nodes.length > 0) - openRightsForUserID(nodes[0].id.unescapeHTML()); - - return false; -} - -function onOpenUserRights(event) { - openRightsForUser(); - preventDefault(event); -} - -function onAclLoadHandler() { - var ul = $("userList"); - var lis = ul.childNodesWithTag("li"); - for (var i = 0; i < lis.length; i++) - setEventsOnUserNode(lis[i]); - - var input = $("defaultUserID"); - if (input) { - defaultUserID = $("defaultUserID").value; - var userNode = nodeForUser(_("Any Authenticated User"), - defaultUserID.escapeHTML()); - userNode.addClassName("any-user"); - userNode.setAttribute("title", - _("Any user not listed above")); - ul.appendChild(userNode); - } - if (isPublicAccessEnabled && CurrentModule() != "Mail") { - userNode = nodeForUser(_("Public Access"), "anonymous"); - userNode.addClassName("anonymous-user"); - userNode.setAttribute("title", - _("Anybody accessing this resource from the public area")); - ul.appendChild(userNode); - } - - var buttonArea = $("userSelectorButtons"); - if (buttonArea) { - var buttons = buttonArea.childNodesWithTag("a"); - $("aclAddUser").stopObserving ("click"); - $("aclDeleteUser").stopObserving ("click"); - $("aclAddUser").observe("mousedown", onUserAdd); - $("aclDeleteUser").observe("mousedown", onUserRemove); - } - - AclEditor['userRightsHeight'] = window.opener.getUsersRightsWindowHeight(); - AclEditor['userRightsWidth'] = window.opener.getUsersRightsWindowWidth(); - - Event.observe(window, "unload", onAclCloseHandler); -} - -function onAclCloseHandler(event) { - if (usersToSubscribe.length) { - var url = (URLForFolderID($("folderID").value) - + "/subscribeUsers?uids=" + usersToSubscribe.join(",")); - new Ajax.Request(url, { - asynchronous: false, - method: 'get', - onFailure: function(transport) { - log("Can't subscribe users: " + transport.status); - } - }); - } - - return true; -} - -document.observe("dom:loaded", onAclLoadHandler); diff --git a/UI/WebServerResources/UIxAppointmentEditor.css b/UI/WebServerResources/UIxAppointmentEditor.css deleted file mode 100644 index da00a3857..000000000 --- a/UI/WebServerResources/UIxAppointmentEditor.css +++ /dev/null @@ -1,168 +0,0 @@ -DIV.appointmentLabel -{ display: block; - position: relative; - line-height: 1.8em; - text-align: right; - width: 3em; } - -DIV#eventView -{ overflow: hidden; - position: absolute; - top: 0; bottom: 0; left: 0; right: 0; } - -DIV#eventView > DIV -{ padding: 1em; } - -DIV.appointmentRightLabel -{ display: inline; - vertical-align: middle; } - -UL.contactList -{ display: block; - cursor: default; - list-style-type: none; - list-style-image: none; - margin: 0px; - padding: 0px; - background: #fff; - border: 1px solid #000; - width: 15em; - height: 5em; - overflow: auto; } - -UL.contactList LI IMG -{ vertical-align: middle; } - -UL.contactList LI -{ width: 100%; - white-space: nowrap; - vertical-align: middle; } - -UL.contactList LI._selected -{ background: #4b6983; - color: #fff; } - -DIV.contactSelector -{ margin: 0px; } - -LABEL, SPAN.checkBoxList -{ display: block; - position: relative; - line-height: 1.5em; - height: 1.5em; - margin-left: 0px; - margin-bottom: .5em; - width: 100%; } - -SELECT -{ margin-left: 1px; } - -n0LABEL#commentArea -{ height: 17em; } - -LABEL#commentArea textarea -{ height: 15.5em; } - -SPAN.checkBoxList#participantsCB -{ height: 7em; } - -SPAN.checkBoxList#categoriesCB -{ height: 3em; } - -DIV#participants UL.contactList -{ height: 4.5em; } - -SPAN.checkBoxList SPAN.content LABEL -{ display: inline; } - -SPAN.content A -{ line-height: 2em; } - -A#detailsButton -{ position: absolute; - right: 1em; - z-index: 1; } - -SPAN.contactSelectorButtons -{ vertical-align: top; - line-height: 2em; } - -SPAN#cycleSelectionFirstLevel, -SPAN#cycleSelectionSecondLevel -{ visibility: hidden; - margin-left: 1em; } - -SPAN#cycleSelectionSecondLevel SPAN.timeDateControl -{ position: static; - margin: 0px; } - -SPAN#categoriesCB INPUT -{ border: 2px solid #000; - vertical-align: middle; - -moz-border-top-colors: #000 #fff; - -moz-border-left-colors: #000 #fff; - -moz-border-bottom-colors: #000 #fff; - -moz-border-right-colors: #000 #fff; } - -SPAN#categoriesCB LABEL -{ margin-left: 0px; - margin-right: 1em; } - -SPAN.content > INPUT.textField -{ n0width: 380px; - width: 97%; } - -LABEL#urlArea INPUT -{ position: static; } - -DIV#attendeesMenu LI -{ padding-left: 10px; - width: auto; } - -DIV#attendeesMenu .attendeeUser -{ font-weight: bold; } - -DIV#attendeesMenu .opt-participant -{ font-style: italic; } - -DIV#attendeesMenu .non-participant A -{ color: #888; } - -#attendeesLabel DIV#attendeesMenu > DIV -{ margin-left: 4px; } - -#attendeesLabel DIV#attendeesMenu > DIV, -DIV#attendeesMenu .attendee -{ height: 18px; } - -#attendeesLabel DIV#attendeesMenu .statusIcon -{ margin-top: 4px; } - -DIV#attendeesMenu .statusIcon -{ background-repeat: no-repeat; - float: left; - width: 12px; - height: 14px; - margin-right: 4px; - background-image: url("attendee-partstats.png"); } - -DIV#attendeesMenu .accepted .statusIcon -{ background-position: 0px 0px; } - -DIV#attendeesMenu .declined .statusIcon -{ background-position: -12px 0px; } - -DIV#attendeesMenu .needs-action .statusIcon -{ background-position: -24px 0px; } - -DIV#attendeesMenu .tentative .statusIcon -{ background-position: -36px 0px; } - -DIV#attendeesMenu .delegated .statusIcon -{ background-position: -48px 0px; } - -DIV#attendeesMenu .no-partstat .statusIcon -{ background-position: -60px 0px; } - -DIV#attendeesMenu .delegate -{ padding-left: 16px !important; } diff --git a/UI/WebServerResources/UIxAppointmentEditor.js b/UI/WebServerResources/UIxAppointmentEditor.js deleted file mode 100644 index 72b0b84a4..000000000 --- a/UI/WebServerResources/UIxAppointmentEditor.js +++ /dev/null @@ -1,544 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - Copyright (C) 2006-2014 Inverse inc. - - This file is part of SOGo. - - SOGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOGo is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - 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 - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -var contactSelectorAction = 'calendars-contacts'; -var AppointmentEditor = { - attendeesMenu: null, - timeRE: /(\d{1,2}):?(\d{1,2})/ -}; - -function uixEarlierDate(date1, date2) { - // can this be done in a sane way? - if (date1.getYear() < date2.getYear()) return date1; - if (date1.getYear() > date2.getYear()) return date2; - // same year - if (date1.getMonth() < date2.getMonth()) return date1; - if (date1.getMonth() > date2.getMonth()) return date2; - // // same month - if (date1.getDate() < date2.getDate()) return date1; - if (date1.getDate() > date2.getDate()) return date2; - // same day - return null; -} - -function validateAptEditor() { - var e, startdate, enddate, tmpdate; - - e = $('summary'); - if (e.value.length == 0) { - if (!confirm(labels.validate_notitle)) - return false; - } - - e = $('startTime_date'); - if (e.value.length != 10) { - showAlertDialog(labels.validate_invalid_startdate); - return false; - } - - startdate = getStartDate(); - if (startdate == null) { - showAlertDialog(labels.validate_invalid_startdate); - return false; - } - - e = $('endTime_date'); - if (e.value.length != 10) { - showAlertDialog(labels.validate_invalid_enddate); - return false; - } - enddate = getEndDate(); - if (enddate == null) { - showAlertDialog(labels.validate_invalid_enddate); - return false; - } - tmpdate = uixEarlierDate(startdate, enddate); - if (tmpdate == enddate) { - showAlertDialog(labels.validate_endbeforestart); - return false; - } - else if (tmpdate == null /* means: same date */) { - var startHour, startMinute, endHour, endMinute; - var matches; - - matches = AppointmentEditor.timeRE.exec(window.timeWidgets['start']['time'].value); - if (matches) { - startHour = parseInt(matches[1], 10); - startMinute = parseInt(matches[2], 10); - matches = AppointmentEditor.timeRE.exec(window.timeWidgets['end']['time'].value); - if (matches) { - endHour = parseInt(matches[1], 10); - endMinute = parseInt(matches[2], 10); - - if (startHour > endHour) { - showAlertDialog(labels.validate_endbeforestart); - return false; - } - else if (startHour == endHour) { - if (startMinute > endMinute) { - showAlertDialog(labels.validate_endbeforestart); - return false; - } - } - } - else { - showAlertDialog(labels.validate_invalid_enddate); - return false; - } - } - else { - showAlertDialog(labels.validate_invalid_startdate); - return false; - } - } - - AIM.submit($(document.editform), {'onComplete' : onEventPostComplete}); - - return true; -} - -function onAttendeesMenuPrepareVisibility() -{ - var composeToUndecidedAttendees = $('composeToUndecidedAttendees'); - var attendeesStates = $('attendeesMenu').innerHTML; - - if (attendeesStates.indexOf("needs-action") < 0) - composeToUndecidedAttendees.addClassName("disabled"); - else - composeToUndecidedAttendees.removeClassName("disabled"); - - return true; -} - -function onComposeToAllAttendees() -{ - var attendees = $$("DIV#attendeesMenu LI.attendee"); - var addresses = new Array(); - attendees.each(function(item) { - var textChild = null; - var childNodes = item.childNodes; - for (var i = 0; !textChild && i < childNodes.length; i++) { - if (childNodes[i].nodeType == 3) { - textChild = childNodes[i]; - var address = textChild.nodeValue.trim() + " <" + item.readAttribute("email") + ">"; - addresses.push(address); - } - } - }); - if (window.opener) - window.opener.openMailTo(addresses.join(";")); -} - -function onComposeToUndecidedAttendees() -{ - if ($(this).hasClassName("disabled")) - return; - - var attendees = $$("DIV#attendeesMenu LI.attendee.needs-action"); - var addresses = new Array(); - attendees.each(function(item) { - var textChild = null; - var childNodes = item.childNodes; - for (var i = 0; !textChild && i < childNodes.length; i++) { - if (childNodes[i].nodeType == 3) { - textChild = childNodes[i]; - var address = textChild.nodeValue.trim() + " <" + item.readAttribute("email") + ">"; - addresses.push(address); - } - } - }); - if (window.opener) - window.opener.openMailTo(addresses.join(";")); -} - -function addContact(tag, fullContactName, contactId, contactName, contactEmail) { - var uids = $('uixselector-participants-uidList'); - - if (contactId) - { - var re = new RegExp("(^|,)" + contactId + "($|,)"); - - if (!re.test(uids.value)) - { - if (uids.value.length > 0) - uids.value += ',' + contactId; - else - uids.value = contactId; - - var names = $('uixselector-participants-display'); - names.innerHTML += ('
  • ' - + contactName + '
  • '); - } - } - - return false; -} - -function onEventPostComplete(response) { - if (response && response.length > 0) { - var jsonResponse = response.evalJSON(); - if (jsonResponse["status"] == "success") { - if (window.opener) - window.opener.refreshEventsAndDisplay(); - window.close(); - } - else { - var message = jsonResponse["message"]; - showAlertDialog(jsonResponse["message"]); - } - } -} - -function saveEvent(sender) { - if (validateAptEditor()) { - document.forms['editform'].attendees.value = Object.toJSON($(attendees)); - document.forms['editform'].submit(); - } - - return false; -} - -function startDayAsShortString() { - return $('startTime_date').valueAsShortDateString(); -} - -function endDayAsShortString() { - return $('endTime_date').valueAsShortDateString(); -} - -function _getDate(which) { - var date = window.timeWidgets[which]['date'].inputAsDate(); - var time = AppointmentEditor.timeRE.exec(window.timeWidgets[which]['time'].value); - if (time) { - date.setHours(time[1]); - date.setMinutes(time[2]); - } - - if (isNaN(date.getTime())) - return null; - - return date; -} - -function _getShadowDate(which) { - var date = window.timeWidgets[which]['date'].getAttribute("shadow-value").asDate(); - var time = AppointmentEditor.timeRE.exec(window.timeWidgets[which]['time'].getAttribute("shadow-value")); - if (time) { - date.setHours(time[1]); - date.setMinutes(time[2]); - } - - return date; -} - -function getStartDate() { - return this._getDate('start'); -} - -function getEndDate() { - return this._getDate('end'); -} - -function getShadowStartDate() { - return this._getShadowDate('start'); -} - -function getShadowEndDate() { - return this._getShadowDate('end'); -} - -function _setDate(which, newDate) { - if (newDate) { - window.timeWidgets[which]['date'].setInputAsDate(newDate); - window.timeWidgets[which]['time'].value = newDate.getDisplayHoursString(); - } - // Update date picker - var dateComponent = jQuery(window.timeWidgets[which]['date']).closest('.date'); - dateComponent.data('date', window.timeWidgets[which]['date'].value); - dateComponent.datepicker('update'); -} - -function setStartDate(newStartDate) { - this._setDate('start', newStartDate); -} - -function setEndDate(newEndDate) { - this._setDate('end', newEndDate); -} - -function onAdjustTime(event) { - var endDate = window.getEndDate(); - var startDate = window.getStartDate(); - var input = $(this); - if (input.tagName != 'INPUT') - input = input.down('input'); - - if (input.id.startsWith("start")) { - // Start date was changed - if (startDate == null) { - var oldStartDate = window.getShadowStartDate(); - window.setStartDate(oldStartDate); - } - else { - var delta = window.getShadowStartDate().valueOf() - startDate.valueOf(); - window.setStartDate(); - if (delta != 0) { - // Increment end date - var newEndDate = new Date(endDate.valueOf() - delta); - window.setEndDate(newEndDate); - - window.timeWidgets['end']['date'].updateShadowValue(); - window.timeWidgets['end']['time'].updateShadowValue(); - window.timeWidgets['start']['date'].updateShadowValue(); - window.timeWidgets['start']['time'].updateShadowValue(); - if (window.timeWidgets['end']['time'].onChange) - window.timeWidgets['end']['time'].onChange(); // method from SOGoTimePicker - } - } - } - else { - // End date was changed - if (endDate == null) { - var oldEndDate = window.getShadowEndDate(); - window.setEndDate(oldEndDate); - } - else { - var delta = endDate.valueOf() - startDate.valueOf(); - if (delta < 0) { - showAlertDialog(labels.validate_endbeforestart); - var oldEndDate = window.getShadowEndDate(); - window.setEndDate(oldEndDate); - - window.timeWidgets['end']['date'].updateShadowValue(); - window.timeWidgets['end']['time'].updateShadowValue(); - window.timeWidgets['end']['time'].onChange(); // method from SOGoTimePicker - } - else { - window.setEndDate(); - } - } - } -} - -function onAllDayChanged(event) { - for (var type in window.timeWidgets) - window.timeWidgets[type]['time'].disabled = this.checked; -} - -function initTimeWidgets(widgets) { - this.timeWidgets = widgets; - - if (widgets['start']['date']) { - jQuery(widgets['start']['date']).closest('.date').datepicker({autoclose: true, weekStart: firstDayOfWeek}) - .on('changeDate', onAdjustTime); - widgets['start']['time'].on("time:change", onAdjustTime); - widgets['start']['time'].addInterface(SOGoTimePickerInterface); - } - - if (widgets['end']['date']) { - jQuery(widgets['end']['date']).closest('.date').datepicker({autoclose: true, weekStart: firstDayOfWeek}) - .on('changeDate', onAdjustTime); - widgets['end']['time'].on("time:change", onAdjustTime); - widgets['end']['time'].addInterface(SOGoTimePickerInterface); - } - - var allDayLabel = $("allDay"); - if (allDayLabel) { - var input = $(allDayLabel).childNodesWithTag("input")[0]; - input.observe("change", onAllDayChanged.bindAsEventListener(input)); - if (input.checked) { - for (var type in widgets) - widgets[type]['time'].disabled = true; - } - } -} - -function refreshAttendeesRO() { - var attendeesMenu = $("attendeesMenu"); - var attendeesLabel = $("attendeesLabel"); - var attendeesDiv = $("attendeesDiv"); - - if (attendeesLabel) - attendeesLabel.setStyle({display: "block"}); - if (attendeesDiv) - attendeesDiv.setStyle({display: "block"}); - - if (attendeesMenu) { - // Register "click" event on each attendee's email - var attendees = attendeesMenu.getElementsByTagName('a'); - $A(attendees).each(function(attendee) { - $(attendee).observe("click", onMailTo); - }); - } -} - -function refreshAttendees(newAttendees) { - var attendeesLabel = $("attendeesLabel"); - var attendeesHref = $("attendeesHref"); - var attendeesMenu = $("attendeesMenu"); - - if (!attendeesHref) - return refreshAttendeesRO(); - - if (attendeesMenu) - attendeesMenu = $("attendeesMenu").down("ul"); - - // Remove link of attendees - for (var i = 0; i < attendeesHref.childNodes.length; i++) - attendeesHref.removeChild(attendeesHref.childNodes[i]); - - // Remove attendees from menu - var menuItems = $$("DIV#attendeesMenu LI.attendee"); - if (menuItems && attendeesMenu) - for (var i = 0; i < menuItems.length; i++) - attendeesMenu.removeChild(menuItems[i]); - - if (newAttendees) - // Update global variable - attendees = $H(newAttendees.evalJSON()); - - if (attendees.keys().length > 0) { - // Update attendees link and show label - var names = new Array(); - attendees.values().each(function(attendee) { - attendee = $H(attendee); - var name = attendee.get('name') || attendee.get('email'); - var delegatedTo = attendee.get('delegated-to'); - if (!delegatedTo) - names.push(name); - - if (attendeesMenu) { - if (!attendee.get('delegated-from') || delegatedTo) { - var node = createElement("li"); - attendeesMenu.appendChild(node); - setupAttendeeNode(node, attendee); - } - if (delegatedTo) { - var delegate = attendees.get(delegatedTo); - var node = createElement("li"); - attendeesMenu.appendChild(node); - setupAttendeeNode(node, $H(delegate), true); - } - } - }); - attendeesHref.appendChild(document.createTextNode(names.join(", "))); - attendeesLabel.setStyle({ display: "block" }); - } - else { - // Hide link of attendees - attendeesLabel.setStyle({ display: "none" }); - } - - // Recompute the position of the time picker widgets - window.timeWidgets['start']['time'].position(); - window.timeWidgets['end']['time'].position(); -} - -function setupAttendeeNode(aNode, aAttendee, isDelegate) { - // Construct the display string from common name and/or email address. - var name = aAttendee.get('name'); - var email = aAttendee.get('email'); -// if (name) -// name += ' <' + email + '>'; -// else -// name = email; - name = name || email; - - aNode.writeAttribute("email", email); - aNode.addClassName("attendee"); - var partstat = aAttendee.get('partstat'); - if (!partstat) - partstat = "no-partstat"; - aNode.addClassName(partstat); - if (isDelegate) - aNode.addClassName("delegate"); - var statusIconNode = createElement("div", null, "statusIcon"); - aNode.appendChild(statusIconNode); - aNode.appendChild(document.createTextNode(name)); - aNode.observe("click", onMailTo); -} - -function initializeAttendeesHref() { - var attendeesHref = $("attendeesHref"); - if (attendeesHref && !attendeesHref.hasClassName("nomenu")) - attendeesHref.observe("click", onAttendeesHrefClick, false); - refreshAttendees(); -} - -function onAttendeesHrefClick(event) { - popupMenu(event, 'attendeesMenu', this); - preventDefault(event); - return false; -} - -function onMailTo(event) { - var target = $(getTarget(event)); - var address = target.lastChild.nodeValue.trim() + " <" + target.readAttribute("email") + ">"; - openMailTo(address); - Event.stop(event); - return false; -} - -function getMenus() { - AppointmentEditor.attendeesMenu = new Array(onPopupAttendeesWindow, - "-", - onComposeToAllAttendees, - onComposeToUndecidedAttendees, - "-", - null); - - var attendeesMenu = $('attendeesMenu'); - if (attendeesMenu) - attendeesMenu.prepareVisibility = onAttendeesMenuPrepareVisibility; - - return { "attendeesMenu": AppointmentEditor.attendeesMenu }; -} - -function onAppointmentEditorLoad() { - if (readOnly == false) { - var widgets = {'start': {'date': $("startTime_date"), - 'time': $("startTime_time")}, - 'end': {'date': $("endTime_date"), - 'time': $("endTime_time")}}; - initTimeWidgets(widgets); - } - - var organizer = $("organizerLabel"); - if (organizer && organizer.down("a")) { - organizer.down("a").on("click", onMailTo); - } - - var createdBy = $("createdByLabel"); - if (createdBy && createdBy.down("a")) { - createdBy.down("a").on("click", onMailTo); - } - - // Extend JSON representation of attendees - attendees = $H(attendees); - - initializeAttendeesHref(); -} - -document.observe("dom:loaded", onAppointmentEditorLoad); diff --git a/UI/WebServerResources/UIxAttendeesEditor.css b/UI/WebServerResources/UIxAttendeesEditor.css deleted file mode 100644 index f3ba190db..000000000 --- a/UI/WebServerResources/UIxAttendeesEditor.css +++ /dev/null @@ -1,276 +0,0 @@ -DIV#attendeesMenu -{ overflow: auto; - overflow-x: hidden; } - -DIV#attendeesView -{ position: absolute; - left: 1em; - right: 1em; - top: 1em; - bottom: 1em; } - -DIV#freeBusyView -{ background-color: #fff; - position: absolute; - top: 30px; - bottom: 135px; - left: 0px; - right: 0px; - overflow: hidden; - border-top: 1px solid #909090; - border-left: 1px solid #909090; - border-right: 1px solid #fff; - border-bottom: 1px solid #fff; } - -SPAN.timeDateControl A:hover -{ text-decoration: none; } - -TABLE -{ border-collapse: separate; - table-layout: auto; - border-spacing: 0px 0px; } - -TABLE#freeBusyHeader TH -{ white-space: nowrap; } - -TABLE#freeBusy TD, -TABLE#freeBusy TH -{ padding: 0px; - margin: 0px; - border: 0px; - vertical-align: top; } - -TABLE#freeBusy TD.freeBusyHeader DIV, -TABLE#freeBusy TD.freeBusyAttendees DIV -{ overflow: hidden; } - -TABLE#freeBusy TD.freeBusyData DIV -{ overflow: scroll; } - -TABLE#freeBusyAttendees TD.attendeeStatus -{ width: 24px; - min-width: 24px; - max-width: 24px; } - -TABLE#freeBusyAttendees TD.attendeeStatus DIV -{ width: 12px; - min-width: 12px; - max-width: 24px; - background-image: none; } - -UL.roles-legend SPAN.role-icon -{ display: block; - float: left; } - -UL.roles-legend SPAN.role-icon, -TABLE#freeBusyAttendees TR.attendee-row TD.attendeeStatus DIV -{ background-repeat: no-repeat; - width: 24px; - height: 20px; - background-image: url("attendee-roles.png"); } - -LI[role="req-participant"] > SPAN.role-icon, -TABLE#freeBusyAttendees TR[role="req-participant"].attendee-row TD.attendeeStatus DIV -{ background-position: 0px 4px; } - -LI[role="opt-participant"] > SPAN.role-icon, -TABLE#freeBusyAttendees TR[role="opt-participant"].attendee-row TD.attendeeStatus DIV -{ background-position: -24px 4px; } - -LI[role="non-participant"] > SPAN.role-icon, -TABLE#freeBusyAttendees TR[role="non-participant"].attendee-row TD.attendeeStatus DIV -{ background-position: -72px 4px; } - -LI[role="chair"] > SPAN.role-icon, -TABLE#freeBusyAttendees TR[role="chair"].attendee-row TD.attendeeStatus DIV -{ background-position: -48px 4px; } - -TABLE#freeBusyAttendees TR.organizer-row TD.attendeeStatus DIV -{ background-repeat: no-repeat; - width: 12px; - height: 18px; - margin-left: 6px; - background-image: url("attendee-partstats.png"); } - -TABLE#freeBusyAttendees TR[partstat="accepted"].organizer-row TD.attendeeStatus DIV -{ background-position: 0px 4px; } - -TABLE#freeBusyAttendees TR[partstat="declined"].organizer-row TD.attendeeStatus DIV -{ background-position: -12px 4px; } - -TABLE#freeBusyAttendees TR[partstat="needs-action"].organizer-row TD.attendeeStatus DIV -{ background-position: -24px 4px; } - -TABLE#freeBusyAttendees TR[partstat="tentative"].organizer-row TD.attendeeStatus DIV -{ background-position: -36px 4px; } - -TABLE#freeBusyHeader TR.freeBusyHeader2 TH -{ font-weight: normal; } - -TABLE#freeBusyHeader TR.freeBusyHeader1 TH, -TABLE#freeBusyHeader TR.freeBusyHeader2 TH, -TABLE#freeBusyHeader TR.freeBusyHeader3 TH -{ text-align: left; - color: #777; - background: #fff; } - -TABLE#freeBusyHeader TR.freeBusyHeader2 TH -{ padding-right: 2em; } - -TABLE#freeBusyHeader TR.freeBusyHeader3 TH -{ border-left: 1px solid #fff; - border-bottom: 1px solid #cecbff; } - -TABLE#freeBusyAttendees TR.attendeeModel, -TABLE#freeBusyData TR.dataModel -{ display: none; } - -TABLE#freeBusy TD.freeBusyHeader, -TABLE#freeBusy TD.freeBusyData -{ border-left: 2px solid #bbb; } - -TABLE#freeBusyAttendees TD, -TABLE#freeBusyData TD -{ border-bottom: 1px solid #cecbff; - border-left: 1px solid #cecbff; - border-top: 0px; - border-right: 0px; - height: 24px; - background-color: #fff; } - -TABLE#freeBusyAttendees TD -{ border-left: 1px solid #fff; } - -TABLE#freeBusyData TR.futureData TD -{ border-left: none; } - -TABLE#freeBusy TD.freeBusyAttendees DIV -{ width: 16em; } - -TABLE#freeBusyAttendees TD.attendees INPUT -{ background-image: url("abcard.png"); - background-repeat: no-repeat; - background-position: 4px center; - border: 0px; - width: 12em; - padding-left: 24px; } - -TABLE#freeBusyAttendees TR.futureAttendee INPUT -{ background-image: none; - color: #aaa; } - -TABLE#freeBusyAttendees TR.futureAttendee TD, -TABLE#freeBusyData TR.futureData TD -{ border: 0px; - height: 3em; - line-height: 3em; } - -SPAN.freeBusyZoneElement -{ display: block; - float: left; - clear: right; - width: 25%; - margin: 0px; - padding: 0px; - border: 0px; } - -TABLE#freeBusyHeader TR.freeBusyHeader3 SPAN.freeBusyZoneElement -{ height: 2px; } - -TABLE#freeBusyHeader TR.freeBusyHeader3 SPAN.freeBusyZoneElement.busy -{ background-color: #f03 !important; } - -TABLE#freeBusyData TD SPAN.freeBusyZoneElement -{ height: 24px; } - -.colorBox.free, -TABLE#freeBusyData TD SPAN.freeBusyZoneElement -{ background-color: #ebebe4; } - -DIV#freeBusyFooter -{ position: absolute; - height: 130px; - left: 0px; - right: 0px; - bottom: 0px; - line-height: 2em; - text-align: right; } - -DIV#legend -{ margin-left: 1em; - text-align: left; } - -DIV#legend UL -{ cursor: default; - float: left; - margin: 0px; - margin-right: 10px; - padding: 0px; - list-style-type: none; - list-style-image: none; } - -DIV#legend LI -{ height: 20px; - white-space: nowrap; - margin: 0px; - padding: 0px; } - -#legend .colorBox -{ border: 1px solid #fff; - cursor: default; } - -.colorBox.busy, -SPAN.freeBusyZoneElement.busy -{ background-color: #35556b !important; } - -.colorBox.maybe-busy, -SPAN.freeBusyZoneElement.maybe-busy -{ background-color: #adc0d0 !important; } - -.colorBox.noFreeBusy, -TABLE#freeBusyData TD.noFreeBusy -{ background-color: #e09ebd; } - -#freeBusyViewButtons -{ margin: 0px; - text-align: left; } - -SPAN#freeBusyViewOptions -{ float: left; } - -#freeBusyViewButtons SELECT -{ width: 50px; } - -SPAN.hidden -{ display: none; } - -DIV#freeBusyReplicas -{ position: absolute; - top: 2px; - right: 0px; - width: 30em; - height: 4em; } - -DIV#freeBusyReplicas LABEL -{ line-height: 1.5em; } - -DIV#windowButtons -{ position: absolute; - bottom: 0px; - left: 0px; - right: 0px; - height: 24px; - text-align: right; } - -.officeHour -{ color: #666 !important; - font-weight: bold !important; } - -SPAN.content INPUT, -SPAN.content SELECT, -SPAN.content SPAN, -SPAN.timeDateControl INPUT, -SPAN.timeDateControl SELECT, -SPAN.timeDateControl SPAN, -DIV#freeBusyReplicas SPAN -{ vertical-align: top; } diff --git a/UI/WebServerResources/UIxAttendeesEditor.js b/UI/WebServerResources/UIxAttendeesEditor.js deleted file mode 100644 index 16d297425..000000000 --- a/UI/WebServerResources/UIxAttendeesEditor.js +++ /dev/null @@ -1,1782 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* TODO: - - set work days from preferences */ - -var OwnerLogin = ""; - -var resultsDiv; -var address; - -var availability; - -var isAllDay = parent$("isAllDay").checked + 0; -var displayStartHour = 0; -var displayEndHour = 23; - -var attendeesEditor = { - delay: 500, - selectedIndex: -1 -}; - -function handleAllDay() { - window.timeWidgets['start']['time'].value = dayStartHour + ":00"; - window.timeWidgets['end']['time'].value = dayEndHour + ":00"; - - $("startTime_time").disabled = true; - $("endTime_time").disabled = true; - - $("freeBusyTimeRange").addClassName("hidden"); -} - -/* address completion */ - -function resolveListAttendees(input, append) { - var urlstr = (UserFolderURL - + "Contacts/" - + escape(input.container) + "/" - + escape(input.cname) + "/properties"); - triggerAjaxRequest(urlstr, resolveListAttendeesCallback, - { "input": input, "append": append }); -} - -function resolveListAttendeesCallback(http) { - var input = http.callbackData["input"]; - if (http.readyState == 4 && http.status == 200) { - var append = http.callbackData["append"]; - var contacts = http.responseText.evalJSON(true); - for (var i = 0; i < contacts.length; i++) { - var contact = contacts[i]; - var fullName = contact[1]; - if (fullName && fullName.length > 0) { - fullName += " <" + contact[2] + ">"; - } - else { - fullName = contact[2]; - } - input.uid = null; - input.cname = null; - input.container = null; - input.isList = false; - input.value = contact[2]; - input.confirmedValue = null; - input.hasfreebusy = false; - input.modified = true; - input.checkAfterLookup = true; - performSearch(input); - if (i < (contacts.length - 1)) { - var nextRow = newAttendee(input.parentNode.parentNode); - input = nextRow.down("input"); - } else if (append) { - var row = input.parentNode.parentNode; - var tBody = row.parentNode; - if (row.rowIndex == (tBody.rows.length - 3)) { - //input.setCaretTo(0); - newAttendee(); - } else { - var nextRow = tBody.rows[row.rowIndex + 1]; - input = nextRow.down("input"); - //input.selectText(0, input.value.length); - //input.focussed = true; - } - } else { - //input.setCaretTo(0); - //input.blur(); - } - } - } - else { - // List not found (probably an LDAP group) - performSearch(input); - } -} - -function onContactKeydown(event) { - if (event.ctrlKey || event.metaKey) { - this.focussed = true; - return; - } - if (event.keyCode == Event.KEY_TAB || event.keyCode == Event.KEY_RETURN) { - preventDefault(event); - this.scrollLeft = 0; - $(this).up('DIV').scrollLeft = 0; - attendeesEditor.selectedIndex = -1; - if (this.confirmedValue) - this.value = this.confirmedValue; - this.hasfreebusy = false; - if (this.isList) { - resolveListAttendees(this, true); - event.stop(); - } else { - this.focussed = false; - var row = $(this).up("tr").next(); - var input = row.down("input"); - if (input) { - input.focussed = true; - input.activate(); - } - else if (!this.value.blank()) - newAttendee(); - } - } - else if (event.keyCode == 0 - || event.keyCode == Event.KEY_BACKSPACE - || event.keyCode == 32 // Space - || event.keyCode > 47) { - this.modified = true; - this.confirmedValue = null; - this.cname = null; - this.uid = null; - this.container = null; - this.hasfreebusy = false; - if (this.searchTimeout) { - window.clearTimeout(this.searchTimeout); - } - if (this.value.length > 0) { - var thisInput = this; - this.searchTimeout = setTimeout(function() - {performSearch(thisInput); - thisInput = null;}, - attendeesEditor.delay); - } - else if (this.value.length == 0) { - if (document.currentPopupMenu) - hideMenu(document.currentPopupMenu); - } - } - else if ($('attendeesMenu').getStyle('visibility') == 'visible') { - if (event.keyCode == Event.KEY_UP) { // Up arrow - if (attendeesEditor.selectedIndex > 0) { - var attendees = $('attendeesMenu').select("li"); - attendees[attendeesEditor.selectedIndex--].removeClassName("selected"); - var attendee = attendees[attendeesEditor.selectedIndex]; - attendee.addClassName("selected"); - this.value = this.confirmedValue = attendee.address; - this.uid = attendee.uid; - this.isList = attendee.isList; - this.cname = attendee.cname; - this.container = attendee.container; - } - } - else if (event.keyCode == Event.KEY_DOWN) { // Down arrow - var attendees = $('attendeesMenu').select("li"); - if (attendees.size() - 1 > attendeesEditor.selectedIndex) { - if (attendeesEditor.selectedIndex >= 0) - attendees[attendeesEditor.selectedIndex].removeClassName("selected"); - attendeesEditor.selectedIndex++; - var attendee = attendees[attendeesEditor.selectedIndex]; - attendee.addClassName("selected"); - this.value = this.confirmedValue = attendee.address; - this.isList = attendee.isList; - this.uid = attendee.uid; - this.cname = attendee.cname; - this.container = attendee.container; - } - } - } -} - -function performSearch(input) { - // Perform address completion - if (input.value.trim().length > minimumSearchLength) { - var urlstr = (UserFolderURL - + "Contacts/allContactSearch?excludeGroups=1&search=" - + encodeURIComponent(input.value)); - triggerAjaxRequest(urlstr, performSearchCallback, input); - } - input.searchTimeout = null; -} - -function performSearchCallback(http) { - if (http.readyState == 4) { - var menu = $('attendeesMenu'); - var list = menu.down("ul"); - - var input = http.callbackData; - - if (http.status == 200) { - var start = input.value.length; - var data = http.responseText.evalJSON(true); - - if (data.contacts.length > 1 && input.focussed) { - list.input = input; - $(list.childNodesWithTag("li")).each(function(item) { - item.remove(); - }); - - // Populate popup menu - for (var i = 0; i < data.contacts.length; i++) { - var contact = data.contacts[i]; - var isList = (contact["c_component"] && - contact["c_component"] == "vlist"); - var completeEmail = contact["c_cn"].trim(); - if (contact["c_mail"]) { - if (completeEmail) - completeEmail += " <" + contact["c_mail"] + ">"; - else - completeEmail = contact["c_mail"]; - } - var node = createElement('li'); - list.appendChild(node); - node.address = completeEmail; - // log("node.address: " + node.address); - if (contact["c_uid"]) { - node.uid = (contact["isMSExchange"]? UserLogin + ":" : "") + contact["c_uid"]; - } - else { - node.uid = null; - node.appendChild(new Element('div').addClassName('colorBox').addClassName('noFreeBusy')); - } - node.isList = isList; - if (isList) { - node.cname = contact["c_name"]; - node.container = contact["container"]; - } - var matchPosition = completeEmail.toLowerCase().indexOf(data.searchText.toLowerCase()); - if (matchPosition > -1) { - var matchBefore = completeEmail.substring(0, matchPosition); - var matchText = completeEmail.substring(matchPosition, matchPosition + data.searchText.length); - var matchAfter = completeEmail.substring(matchPosition + data.searchText.length); - node.appendChild(document.createTextNode(matchBefore)); - node.appendChild(new Element('strong').update(matchText)); - node.appendChild(document.createTextNode(matchAfter)); - } - else { - node.appendChild(document.createTextNode(completeEmail)); - } - if (contact["contactInfo"]) - node.appendChild(document.createTextNode(" (" + - contact["contactInfo"] + ")")); - node.observe("mousedown", - onAttendeeResultClick.bindAsEventListener(node)); - } - - // Show popup menu - var offsetScroll = Element.cumulativeScrollOffset(input); - var offset = Element.cumulativeOffset(input); - var top = offset[1] - offsetScroll[1] + node.offsetHeight + 3; - var height = 'auto'; - var heightDiff = window.height() - offset[1]; - var nodeHeight = node.getHeight(); - - if ((data.contacts.length * nodeHeight) > heightDiff) - // Limit the size of the popup to the window height, minus 12 pixels - height = parseInt(heightDiff/nodeHeight) * nodeHeight - 12 + 'px'; - - menu.setStyle({ top: top + "px", - left: offset[0] + "px", - height: height, - visibility: "visible" }); - menu.scrollTop = 0; - - document.currentPopupMenu = menu; - $(document.body).observe("click", onBodyClickMenuHandler); - } - else { - if (document.currentPopupMenu) - hideMenu(document.currentPopupMenu); - - if (data.contacts.length == 1) { - // Single result - var contact = data.contacts[0]; - if (contact["c_uid"]) - input.uid = (contact["isMSExchange"]? UserLogin + ":" : "") + contact["c_uid"]; - else - input.uid = null; - var isList = (contact["c_component"] && - contact["c_component"] == "vlist"); - if (isList) { - input.cname = contact["c_name"]; - input.container = contact["container"]; - } - var completeEmail = contact["c_cn"].trim(); - if (contact["c_mail"]) { - if (completeEmail) - completeEmail += " <" + contact["c_mail"] + ">"; - else - completeEmail = contact["c_mail"]; - } - if ((input.value == contact["c_mail"]) - || (contact["c_cn"].substring(0, input.value.length).toUpperCase() - == input.value.toUpperCase()) - || !input.focussed) { - input.value = completeEmail; - } - else - // The result matches email address, not user name - input.value += ' >> ' + completeEmail; - input.isList = isList; - input.confirmedValue = completeEmail; - var end = input.value.length; - if (input.focussed) - $(input).selectText(start, end); - else if (isList) - resolveListAttendees(input, true); - else - // We lost the focus -- force freebusy lookup - input.checkAfterLookup = true; - - attendeesEditor.selectedIndex = -1; - - if (input.checkAfterLookup) { - input.checkAfterLookup = false; - input.modified = true; - input.hasfreebusy = false; - checkAttendee(input); - } - } - initializeAttendeeRole(input); - } - } - else - if (document.currentPopupMenu) - hideMenu(document.currentPopupMenu); - } -} - -function initializeAttendeeRole(input) { - var row = $(input.parentNode.parentNode); - if (input.uid && input.uid == OwnerLogin) { - row.removeAttribute("role"); - row.removeClassName("attendee-row"); - row.setAttribute("partstat", "accepted"); - row.addClassName("organizer-row"); - row.isOrganizer = true; - } else { - row.removeAttribute("partstat"); - row.removeClassName("organizer-row"); - if (input.value.length > 0) { - row.setAttribute("role", "req-participant"); - row.addClassName("attendee-row"); - } - row.isOrganizer = false; - } -} - -function onAttendeeResultClick(event) { - var input = this.parentNode.input; - input.uid = this.uid; - input.cname = this.cname; - input.container = this.container; - input.isList = this.isList; - input.confirmedValue = input.value = this.address; - initializeAttendeeRole(input); - checkAttendee(input); - this.scrollLeft = 0; - $(this).up('DIV').scrollLeft = 0; - - this.parentNode.input = null; -} - -function redisplayEventSpans() { - // log("redisplayEventSpans"); - - var table = $("freeBusyHeader"); - var row = table.rows[2]; - var stDay = window.getStartDate(); - var etDay = window.getEndDate(); - - var days = stDay.daysUpTo(etDay); - var addDays = days.length - 1; - var stHour = stDay.getHours(); - var stMinute = Math.round(stDay.getMinutes() / 15); - if (stMinute == 4) { - stMinute = 0; - stHour++; - } - var etHour = etDay.getHours(); - var etMinute = Math.round(etDay.getMinutes() / 15); - if (etMinute == 4) { - etMinute = 0; - etHour++; - } - - if (isAllDay) { - addDays++; - stHour = stMinute = 0; - etHour = etMinute = 0; - } - - if (stHour < displayStartHour) { - stHour = displayStartHour; - stMinute = 0; - } - if (stHour > displayEndHour + 1) { - stHour = displayEndHour + 1; - stMinute = 0; - } - if (etHour < displayStartHour) { - etHour = displayStartHour; - etMinute = 0; - } - if (etHour > displayEndHour + 1) { - etHour = displayEndHour; - etMinute = 0; - } - - var deltaCells = (etHour - stHour) + ((displayEndHour - displayStartHour + 1) * addDays); - var deltaSpans = (deltaCells * 4 ) + (etMinute - stMinute); - var currentCellNbr = stHour - displayStartHour; - var currentCell = row.cells[currentCellNbr]; - var currentSpanNbr = stMinute; - var spans = $(currentCell).childNodesWithTag("span"); - - /* we first reset the cache of busy spans */ - if (row.busySpans) { - for (var i = 0; i < row.busySpans.length; i++) { - row.busySpans[i].removeClassName("busy"); - } - } - row.busySpans = []; - - /* now we mark the spans corresponding to our event */ - while (deltaSpans > 0) { - var currentSpan = spans[currentSpanNbr]; - row.busySpans.push(currentSpan); - currentSpan.addClassName("busy"); - currentSpanNbr++; - if (currentSpanNbr > 3) { - currentSpanNbr = 0; - currentCellNbr++; - if (currentCellNbr < row.cells.length) { - currentCell = row.cells[currentCellNbr]; - spans = $(currentCell).childNodesWithTag("span"); - } - } - deltaSpans--; - } - scrollToEvent(); -} - -function onAttendeeStatusClick(event) { - rotateAttendeeStatus(this); -} - -function rotateAttendeeStatus(row) { - var values; - var attributeName; - if (row.isOrganizer) { - values = [ "accepted", "declined", "tentative", "needs-action" ]; - attributeName = "partstat"; - } else { - values = [ "req-participant", "opt-participant", - "chair", "non-participant" ]; - attributeName = "role"; - } - var value = row.getAttribute(attributeName); - var idx = (value ? values.indexOf(value) : -1); - if (idx == -1 || idx > (values.length - 2)) { - idx = 0; - } else { - idx++; - } - row.setAttribute(attributeName, values[idx]); - if (!Prototype.Browser.Gecko) { - /* This hack enables a refresh of the row element right after the - click. Otherwise, this occurs only when leaving the element with - them mouse cursor. */ - row.className = row.className; - } -} - -function onNewAttendeeClick(event) { - newAttendee(); - event.stop(); -} - -function newAttendee(previousAttendee) { - var table = $("freeBusyAttendees"); - var tbody = table.tBodies[0]; - var model = tbody.rows[tbody.rows.length - 1]; - var nextRowIndex = tbody.rows.length - 2; - if (previousAttendee) { - nextRowIndex = previousAttendee.rowIndex + 1; - } - var nextRow = tbody.rows[nextRowIndex]; - var newRow = $(model.cloneNode(true)); - tbody.insertBefore(newRow, nextRow); - var result = newRow; - - var statusTD = newRow.down(".attendeeStatus"); - if (statusTD) { - var boundOnStatusClick = onAttendeeStatusClick.bindAsEventListener(newRow); - statusTD.observe("click", boundOnStatusClick, false); - } - - $(newRow).removeClassName("attendeeModel"); - - var input = newRow.down("input"); - input.observe("keydown", onContactKeydown.bindAsEventListener(input)); - input.observe("blur", onInputBlur); - - input.focussed = true; - input.activate(); - - table = $("freeBusyData"); - tbody = table.tBodies[0]; - model = tbody.rows[tbody.rows.length - 1]; - nextRow = tbody.rows[nextRowIndex]; - newRow = $(model.cloneNode(true)); - tbody.insertBefore(newRow, nextRow); - newRow.removeClassName("dataModel"); - - var attendeesDiv = $$('TABLE#freeBusy TD.freeBusyAttendees DIV').first(); - var dataDiv = $$('TABLE#freeBusy TD.freeBusyData DIV').first(); - - dataDiv.scrollTop = attendeesDiv.scrollTop = table.clientHeight; - - return result; -} - -function checkAttendee(input) { - var row = $(input.parentNode.parentNode); - var tbody = row.parentNode; - if (tbody && input.value.blank()) { - var dataTable = $("freeBusyData").tBodies[0]; - var dataRow = dataTable.rows[row.sectionRowIndex]; - input.stopObserving(); - tbody.removeChild(row); - dataTable.removeChild(dataRow); - } - else if (input.modified) { - if (!row.hasClassName("needs-action")) { - row.addClassName("needs-action"); - row.removeClassName("declined"); - row.removeClassName("accepted"); - } - if (!input.hasfreebusy) { - if (input.uid && input.confirmedValue) { - input.value = input.confirmedValue; - } - displayFreeBusyForNode(input); - input.hasfreebusy = true; - } - input.modified = false; - } -} - -function onInputBlur(event) { - if (document.currentPopupMenu && !this.confirmedValue) { - // Hack for IE7; blur event is triggered on input field when - // selecting a menu item - var visible = $(document.currentPopupMenu).getStyle('visibility') != 'hidden'; - if (visible) { - // log("XXX we return"); - return; - } - } - - if (document.currentPopupMenu) - hideMenu(document.currentPopupMenu); - - if (this.isList) { - resolveListAttendees(this, false); - } else { - initializeAttendeeRole(this); - checkAttendee(this); - } -} - -/* FIXME: any other way to repeat an object? */ -var _fullFreeDay = []; -for (var i = 0; i < 96; i++) { - _fullFreeDay.push('0'); -} - -function availabilitySession(uids, direction, start, end, listener) { - this.mDirection = direction; - if (direction > 0) { - this._findDate = this._forwardFindDate; - this._adjustCurrentStart = this._forwardAdjustCurrentStart; - } - else { - this._findDate = this._backwardFindDate; - this._adjustCurrentStart = this._backwardAdjustCurrentStart; - } - - this.mStart = start; - - this.mStartLimit = 0; - this.mEndLimit = 24 * 4; - this.mWorkDaysOnly = false; - - /* The duration of the range covering the start and end of the event, in - quarters. - - 15 minutes * 60 secs * 1000 ms = 900000 ms */ - this.mDuration = Math.ceil((end.getTime() - start.getTime()) / 900000); - this.mUids = uids; - this.mListener = listener; -} - -availabilitySession.prototype = { - mStart: null, - mDirection: null, - mStartLimit: 0, - mEndLimit: 0, - mWorkDaysOnly: 0, - - mListener: null, - mUids: null, - - mCurrentStart: null, - mFirstStep: false, - - mCurrentEntries: null, - mActiveRequests: 0, - - setLimits: function aS_setLimits(start, end) { - this.mStartLimit = start; - this.mEndLimit = end; - }, - - setWorkDaysOnly: function aS_setWorkDaysOnly(workDaysOnly) { - this.mWorkDaysOnly = workDaysOnly; - }, - - _step: function aS__step() { - this.mCurrentEntries = null; - var max = this.mUids.length; - if (max > 0) { - this.mActiveRequests = max; - for (var i = 0; i < max; i++) { - // log("request start"); - var fbRequest = new freeBusyRequest(this.mCurrentStart, - this.mCurrentStart, - this.mUids[i], - this); - fbRequest.start(); - } - } - else { - this.mActiveRequests = 1; - this.onRequestComplete(null, true, _fullFreeDay); - } - }, - - start: function aS_start() { - this.mCurrentStart = this.mStart.clone(); - this.mCurrentStart.setHours(0); - this.mCurrentStart.setMinutes(0); - if (this.mWorkDaysOnly) { - this._adjustCurrentStart(); - } - this.mFirstStep = true; - this._step(); - }, - - onRequestComplete: function aS_onRequestComplete(request, success, entries) { - this.mActiveRequests--; - this._mergeEntries(entries); - if (this.mActiveRequests == 0) { - var foundDate = this._findDate(); - if (foundDate) { - var foundEndDate = foundDate.clone(); - foundEndDate.setTime(foundDate.getTime() - + this.mDuration * 900000); - this.mListener.onRequestComplete(this, foundDate, foundEndDate); - } - else { - if (this.mDirection > 0) { - this.mCurrentStart.addDays(1); - } - else { - this.mCurrentStart.addDays(-1); - } - if (this.mWorkDaysOnly) { - this._adjustCurrentStart(); - } - this._step(); - } - } - }, - - _forwardAdjustCurrentStart: function aS__forwardAdjustCurrentStart() { - var day = this.mCurrentStart.getDay(); - if (day == 0) { - this.mCurrentStart.addDays(1); - } - else if (day == 6) { - this.mCurrentStart.addDays(2); - } - }, - _backwardAdjustCurrentStart: function aS__backwardAdjustCurrentStart() { - var day = this.mCurrentStart.getDay(); - if (day == 0) { - this.mCurrentStart.addDays(-2); - } - else if (day == 6) { - this.mCurrentStart.addDays(-1); - } - }, - - _mergeEntries: function aS__mergeEntries(entries) { - if (this.mCurrentEntries) { - var currentIndex = 0; - while (currentIndex > -1) { - this.mCurrentEntries[currentIndex] = entries[currentIndex]; - currentIndex = entries.indexOf('1', currentIndex + 1); - } - } - else { - this.mCurrentEntries = entries; - } - }, - - _forwardFindDate: function aS__forwardFindDate() { - var foundDate = null; - - var maxOffset = this.mEndLimit - this.mDuration; - var offset = 0; - if (this.mFirstStep) { - offset = Math.floor(this.mStart.getHours() * 4 - + this.mStart.getMinutes() / 15) + 1; - this.mFirstStep = false; - } - else { - offset = this.mCurrentEntries.indexOf('0'); - } - if (offset > -1 && offset < this.mStartLimit) { - offset = this.mStartLimit; - } - while (!foundDate && offset > -1 && offset <= maxOffset) { - var testDuration = 0; - while (this.mCurrentEntries[offset] == '0' - && testDuration < this.mDuration) { - testDuration++; - offset++; - } - if (testDuration == this.mDuration) { - foundDate = new Date(); - var foundTime = (this.mCurrentStart.getTime() - + (offset - testDuration) * 900000); - foundDate.setTime(foundTime); - } - else { - offset = this.mCurrentEntries.indexOf('0', offset + 1); - } - } - - return foundDate; - }, - _backwardFindDate: function aS__backwardFindDate() { - var foundDate = null; - - var maxOffset = this.mEndLimit - this.mDuration; - var offset; - if (this.mFirstStep) { - offset = Math.floor(this.mStart.getHours() * 4 - + this.mStart.getMinutes() / 15) - 1; - this.mFirstStep = false; - } - else { - offset = this.mCurrentEntries.lastIndexOf('0'); - } - if (offset > maxOffset) { - offset = maxOffset; - } - while (!foundDate - && offset >= this.mStartLimit) { - var testDuration = 0; - var testOffset = offset; - while (this.mCurrentEntries[testOffset] == '0' - && testDuration < this.mDuration) { - testDuration++; - testOffset++; - } - if (testDuration == this.mDuration) { - foundDate = new Date(); - var foundTime = (this.mCurrentStart.getTime() - + offset * 900000); - foundDate.setTime(foundTime); - } - else { - offset = this.mCurrentEntries.lastIndexOf('0', offset - 1); - } - } - - return foundDate; - } -}; - -function availabilityController(previousSlotButton, nextSlotButton) { - this.mActive = false; - this.previousSlotButton = previousSlotButton; - this.nextSlotButton = nextSlotButton; - - var boundCallback = this.onPreviousSlotClick.bindAsEventListener(this); - previousSlotButton.observe("click", boundCallback, false); - boundCallback = this.onNextSlotClick.bindAsEventListener(this); - $("nextSlot").observe("click", boundCallback, false); -} - -availabilityController.prototype = { - mActive: false, - previousSlotButton: null, - nextSlotButton: null, - - onPreviousSlotClick: function ac_onPreviousSlotClick(event) { - if (!this.mActive) { - this.mActive = true; - this._findSlot(-1); - } - this.previousSlotButton.blur(); - }, - onNextSlotClick: function aC_onNextSlotClick(event) { - if (!this.mActive) { - this.mActive = true; - this._findSlot(1); - } - this.nextSlotButton.blur(); - }, - _findSlot: function aC__findSlot(direction) { - var uids = []; - - var inputs = $("freeBusy").getElementsByTagName("input"); - for (var i = 0; i < inputs.length - 1; i++) { - if (inputs[i].uid) { - uids.push(inputs[i].uid); - } - } - - var start; - var end; - if (isAllDay) { - start = window.timeWidgets['start']['date'].inputAsDate(); - end = window.timeWidgets['end']['date'].inputAsDate(); - start.setHours(dayStartHour); - start.setMinutes(0); - start.setSeconds(0); - end.setHours(dayEndHour); - end.setMinutes(0); - end.setSeconds(0); - } - else { - start = window.getStartDate(); - end = window.getEndDate(); - } - var session = new availabilitySession(uids, direction, - start, end, - this); - if (isAllDay) { - session.setLimits(dayStartHour * 4, dayEndHour * 4); - } else { - var start = (parseInt($("timeSlotStartLimitHour").value) - + parseInt($("timeSlotStartLimitMinute").value)); - var end = (parseInt($("timeSlotEndLimitHour").value) - + parseInt($("timeSlotEndLimitMinute").value)); - session.setLimits(start, end); - } - session.setWorkDaysOnly($("workDaysOnly").checked); - session.start(); - }, - onRequestComplete: function aC_onRequestComplete(session, start, end) { - window.setStartDate(start); - window.setEndDate(end); - - if (start.getDay() != session.mStart.getDay()) { - onTimeDateWidgetChange(); - } - else { - redisplayEventSpans(); - } - this.mActive = false; - } -}; - -/* freebusy cache, used internally by freeBusyRequest below */ -var _fbCache = {}; - -function _freeBusyCacheEntry() { -} - -_freeBusyCacheEntry.prototype = { - startDate: null, - entries: null, - - getEntries: function fBCE_getEntries(sd, ed) { - var entries = null; - - var adjustedSd = sd.beginOfDay(); - - if (this.startDate && this.startDate.getTime() <= adjustedSd.getTime()) { - var offset = this.startDate.deltaDays(adjustedSd) * 96; - if (this.entries.length > offset) { - var adjustedEd = ed.beginOfDay(); - var nbrDays = adjustedSd.deltaDays(adjustedEd) + 1; - var offsetEnd = offset + (nbrDays * 96); - if (Math.round((this.entries.length - offset)/96) >= nbrDays) { - entries = this.entries.slice(offset, offsetEnd); - } - } - } - - return entries; - }, - - getFetchRanges: function fBCE_getFetchRanges(sd, ed) { - var fetchDates; - - var adjustedSd = sd.beginOfDay(); - var adjustedEd = ed.beginOfDay(); - var start = adjustedSd.clone(); - start.addDays(-7); - var end = adjustedEd.clone(); - end.addDays(7); - if (this.startDate) { - fetchDates = []; - - if (adjustedSd.getTime() < this.startDate.getTime()) { - // Period extends to before current start - if (end.getTime() >= this.startDate.getTime()) { - end = this.startDate.beginOfDay(); - end.addDays(-1); - } - fetchDates.push({ start: start, end: end }); - } - - var currentNbrDays = this.entries.length / 96; - var nextDate = this.startDate.clone(); - nextDate.addDays(currentNbrDays); - if (adjustedEd.getTime() >= nextDate.getTime()) { - // Period extends to after current end - if (start.getTime() <= nextDate.getTime()) { - start = nextDate.beginOfDay(); - } - fetchDates.push({ start: start, end: end }); - } - } - else { - // Initial range - fetchDates = [ { start: start, end: end } ]; - } - - return fetchDates; - }, - - integrateEntries: function fBCE_integrateEntries(entries, start, end) { - var days, merged = false; - if (this.startDate) { - if (start.getTime() < this.startDate) { - days = start.deltaDays(this.startDate); - if (Math.round(entries.length/96) == days) { - // New period is just before previous period - this.startDate = start; - this.entries = entries.concat(this.entries); - merged = true; - } - } - else { - days = this.startDate.deltaDays(start); - if (Math.round(this.entries.length/96) == days) { - // New period is just after previous period - this.entries = this.entries.concat(entries); - merged = true; - } - } - } - if (!merged) { - this.startDate = start; - this.entries = entries; - } - } -}; - -function freeBusyRequest(start, end, uid, listener) { - this.mStart = start.beginOfDay(); - this.mEnd = end.beginOfDay(); - this.mUid = uid; - this.mListener = listener; - this.mPendingRequests = 0; -} - -freeBusyRequest.prototype = { - mStart: null, - mEnd: null, - mUid: null, - mListener: null, - - mCacheEntry: null, - - mPendingRequests: 0, - - start: function fBR_start() { - this.mCacheEntry = _fbCache[this.mUid]; - if (!this.mCacheEntry) { - this.mCacheEntry = new _freeBusyCacheEntry(); - _fbCache[this.mUid] = this.mCacheEntry; - } - var entries = this.mCacheEntry.getEntries(this.mStart, this.mEnd); - if (entries) { - this.mListener.onRequestComplete(this, true, entries); - } - else { - if (this.mPendingRequests == 0) { - var fetchRanges = this.mCacheEntry.getFetchRanges(this.mStart, this.mEnd); - this.mPendingRequests = fetchRanges.length; - for (var i = 0; i < fetchRanges.length; i++) { - var fetchRange = fetchRanges[i]; - this._performAjaxRequest(fetchRange.start, fetchRange.end); - } - } - else { - /* a nearly impossible condition that we want to handle */ - log("freebusy request is already active"); - } - } - }, - - _performAjaxRequest: function fBR__performAjaxRequest(rqStart, rqEnd) { - var urlstr = UserFolderURL + "../"; - var uids = this.mUid.split(":"); - if (uids.length > 1) - urlstr += (uids[0] - + "/freebusy.ifb/ajaxRead?" - + "uid=" + uids[1] - + "&"); - else - urlstr += (this.mUid - + "/freebusy.ifb/ajaxRead?"); - urlstr += ("sday=" + rqStart.getDayString() - + "&eday=" + rqEnd.getDayString()); - - var thisRequest = this; - var callback = function fBR__performAjaxRequest_cb(http) { - if (http.readyState == 4) { - thisRequest.onRequestComplete(http, rqStart, rqEnd); - thisRequest = null; - } - }; - - triggerAjaxRequest(urlstr, callback); - }, - - onRequestComplete: function fBR_onRequestComplete(http, rqStart, rqEnd) { - this.mPendingRequests--; - if (http.status == 200 && http.responseText) { - var newEntries = http.responseText.split(","); - var cacheEntry = this.mCacheEntry; - cacheEntry.integrateEntries(newEntries, rqStart, rqEnd); - if (this.mPendingRequests == 0) { - var entries = this.mCacheEntry.getEntries(this.mStart, - this.mEnd); - this.mListener.onRequestComplete(this, true, entries); - } - } - } -}; - -function editorConflictHandler(uids, startDate, endDate, listener) { - this.mUids = uids; - this.mRemaining = uids.length; - this.mCurrentUid = 0; - - this.mStartDate = startDate; - this.mEndDate = endDate; - - this.mListener = listener; -} - -editorConflictHandler.prototype = { - mUids: null, - mCurrentUid: 0, - - mStartDate: null, - mEndDate: null, - - mQuOffset: 0, - mQuOffsetMax: 0, - - mCurrentEntries: null, - - mListener: null, - - start: function eCH_start() { - this.mQuOffset = (this.mStartDate.getHours() * 4 - + Math.floor(this.mStartDate.getMinutes() / 15)); - this.mQuOffsetMax = (this.mEndDate.deltaDays(this.mStartDate) * 96 - + this.mEndDate.getHours() * 4 - + Math.ceil(this.mEndDate.getMinutes() / 15)); - this._step(); - }, - - _step: function eCH__step() { - if (this.mCurrentUid < this.mUids.length) { - var fbRequest = new freeBusyRequest(this.mStartDate, - this.mEndDate, - this.mUids[this.mCurrentUid], - this); - fbRequest.start(); - } - else { - this.mListener.onRequestComplete(this, true); - } - }, - - onRequestComplete: function eCH_onRequestComplete(fbRequest, success, - entries) { - var periodEntries = entries.slice(this.mQuOffset, this.mQuOffsetMax); - if (periodEntries.indexOf("1") > -1) { - this.mListener.onRequestComplete(this, false); - } - else { - this.mCurrentUid++; - this._step(); - } - } -}; - -function displayFreeBusyForNode(input) { - var rowIndex = input.parentNode.parentNode.sectionRowIndex; - var row = $("freeBusyData").tBodies[0].rows[rowIndex]; - var nodes = row.cells; - //log ("displayFreeBusyForNode index " + rowIndex + " uid " + input.uid + " (" + nodes.length + " cells)"); - if (input.uid) { - if (!input.hasfreebusy) { - // log("forcing draw of nodes"); - for (var i = 0; i < nodes.length; i++) { - var node = $(nodes[i]); - node.removeClassName("noFreeBusy"); - while (node.firstChild) { - node.removeChild(node.firstChild); - } - for (var j = 0; j < 4; j++) { - createElement("span", null, "freeBusyZoneElement", - null, null, node); - } - } - } - - var sd = $('startTime_date').inputAsDate(); - var ed = $('endTime_date').inputAsDate(); - var listener = { - onRequestComplete: function(request, success, entries) { - if (success) { - drawFbData(input, entries); - } - } - }; - - var rq = new freeBusyRequest(sd, ed, input.uid, listener); - rq.start(); - } else { - for (var i = 0; i < nodes.length; i++) { - var node = $(nodes[i]); - node.addClassName("noFreeBusy"); - while (node.firstChild) { - node.removeChild(node.firstChild); - } - } - } -} - -function setSpanStatus(span, status) { - var currentClass = span.freeBusyClass; - if (!currentClass) - currentClass = ""; - var newClass; - if (status == '1') { - newClass = "busy"; - } - else if (status == '2') { - newClass = "maybe-busy"; - } - else { - newClass = ""; - } - if (newClass != currentClass) { - if (currentClass.length > 0) { - span.removeClassName(currentClass); - } - if (newClass.length > 0) { - span.addClassName(newClass); - } - span.freeBusyClass = newClass; - } -} - -function drawFbData(input, slots) { - var rowIndex = input.parentNode.parentNode.sectionRowIndex; - - var slotNbr = 0; - var tds = $("freeBusyData").tBodies[0].rows[rowIndex].cells; - if (tds.length * 4 == slots.length) { - for (var i = 0; i < tds.length; i++) { - var spans = tds[i].childNodesWithTag("span"); - for (var j = 0; j < spans.length; j++) { - setSpanStatus(spans[j], slots[slotNbr]); - slotNbr++; - } - } - } - else { - log("inconsistency between freebusy results and" - + " the number of cells"); - log(" expecting: " + (tds.length * 4) + " received: " + slots.length); - } -} - -function resetAllFreeBusys() { - var inputs = $("freeBusy").getElementsByTagName("input"); - for (var i = 0; i < inputs.length - 1; i++) { - var currentInput = inputs[i]; - currentInput.hasfreebusy = false; - displayFreeBusyForNode(currentInput); - } -} - -function initializeTimeSlotWidgets() { - availability = new availabilityController($("previousSlot"), - $("nextSlot")); - - var hourWidgets = [ "timeSlotStartLimitHour", - "timeSlotEndLimitHour" ]; - for (var i = 0; i < hourWidgets.length; i++) { - var hourWidget = $(hourWidgets[i]); - for (var h = 0; h < 24; h++) { - var option = createElement("option", null, null, - { value: h * 4 }); - var text = (h < 10) ? ("0" + h) : ("" + h); - option.appendChild(document.createTextNode(text)); - hourWidget.appendChild(option); - } - } - var limitWidget = $("timeSlotStartLimitHour"); - limitWidget.value = dayStartHour * 4; - limitWidget = $("timeSlotEndLimitHour"); - limitWidget.value = dayEndHour * 4; - - var minuteWidgets = [ "timeSlotStartLimitMinute", - "timeSlotEndLimitMinute" ]; - for (var i = 0; i < minuteWidgets.length; i++) { - var minuteWidget = $(minuteWidgets[i]); - for (var h = 0; h < 4; h++) { - var option = createElement("option", null, null, - { value: h }); - var quValue = h * 15; - var text = (h == 0) ? "00" : ("" + quValue); - option.appendChild(document.createTextNode(text)); - minuteWidget.appendChild(option); - } - } -// var limitWidget = $("timeSlotStartLimitMinute"); -// limitWidget.value = Math.floor(parseInt($("startTime_time_minute").value) -// / 15); -// limitWidget = $("timeSlotEndLimitMinute"); -// limitWidget.value = Math.floor(parseInt($("endTime_time_minute").value) -// / 15); -} - -function initializeWindowButtons() { - var okButton = $("okButton"); - var cancelButton = $("cancelButton"); - - okButton.observe("click", onEditorOkClick, false); - cancelButton.observe("click", onEditorCancelClick, false); -} - -function cleanInt(data) { - var rc = data; - if (rc.substr (0, 1) == "0") - rc = rc.substr (1, rc.length - 1); - return parseInt (rc); -} - -function scrollToEvent () { - var headerDiv = $$('TABLE#freeBusy TD.freeBusyHeader DIV').first(); - var dataDiv = $$('TABLE#freeBusy TD.freeBusyData DIV').first(); - - var scroll = 0; - var spans = $$('TR#currentEventPosition TH SPAN'); - for (var i = 0; i < spans.length; i++) { - scroll += spans[i].getWidth (spans[i]); - if (spans[i].hasClassName("busy")) { - scroll -= 20 * spans[i].getWidth (spans[i]); - break; - } - } - - headerDiv.scrollLeft = scroll; - dataDiv.scrollLeft = headerDiv.scrollLeft; -} - -//function updateSlotDisplayCallback(http) { -// var data = http.responseText.evalJSON(true); -// var start = new Date(); -// var end = new Date(); -// var cb = redisplayEventSpans; -// -// start.setFullYear(parseInt (data[0]['startDate'].substr(0, 4)), -// parseInt (data[0]['startDate'].substr(4, 2)) - 1, -// parseInt (data[0]['startDate'].substr(6, 2))); -// end.setFullYear(parseInt (data[0]['endDate'].substr(0, 4)), -// parseInt (data[0]['endDate'].substr(4, 2)) - 1, -// parseInt (data[0]['endDate'].substr(6, 2))); -// -// window.timeWidgets['end']['date'].setInputAsDate(end); -// window.timeWidgets['end']['hour'].value = cleanInt(data[0]['endHour']); -// window.timeWidgets['end']['minute'].value = cleanInt(data[0]['endMinute']); -// -// if (window.timeWidgets['start']['date'].valueAsShortDateString() != -// data[0]['startDate']) { -// cb = onTimeDateWidgetChange; -// } -// -// window.timeWidgets['start']['date'].setInputAsDate(start); -// window.timeWidgets['start']['hour'].value = cleanInt(data[0]['startHour']); -// window.timeWidgets['start']['minute'].value = cleanInt(data[0]['startMinute']); -// -// cb(); -//} - -function onEditorOkClick(event) { - preventDefault(event); - - var uids = []; - var inputs = $("freeBusy").getElementsByTagName("input"); - for (var i = 0; i < inputs.length - 1; i++) { - var input = inputs[i]; - if (!input.disabled && input.uid) { - uids.push(input.uid); - } - } - - var startDate = getStartDate(); - var endDate = getEndDate(); - - var listener = { - onRequestComplete: function eCH_l_onRequestComplete(handlers, code) { - if (code) { - _confirmEditorOkClick(); - } - else { - var label = ("A time conflict exists with one or more attendees.\n" - + "Would you like to keep the current settings anyway?"); - showConfirmDialog(_('Warning'), _(label), _confirmEditorOkClick); - } - } - }; - - var conflictHandler = new editorConflictHandler(uids, startDate, endDate, listener); - conflictHandler.start(); -} - -function _confirmEditorOkClick() { - var attendees = window.opener.attendees; - var newAttendees = new Hash(); - var inputs = $("freeBusy").getElementsByTagName("input"); - for (var i = 0; i < inputs.length - 1; i++) { - if (inputs[i].disabled) - continue; - var row = $(inputs[i]).up("tr"); - var name = extractEmailName(inputs[i].value); - var email = extractEmailAddress(inputs[i].value); - var uid = ""; - if (inputs[i].uid) - uid = inputs[i].uid; - if (!(name && name.length > 0)) - if (uid.length > 0) - name = uid; - else - name = email; - var attendee = attendees["email"]; - if (!attendee) { - attendee = {"email": email, - "name": name, - "role": "req-participant", - "partstat": "needs-action", - "uid": uid}; - } - var partstat = row.getAttribute("partstat"); - if (partstat) - attendee["partstat"] = partstat; - var role = row.getAttribute("role"); - if (role) - attendee["role"] = role; - newAttendees.set(email, attendee); - } - window.opener.refreshAttendees(Object.toJSON(newAttendees)); - - updateParentDateFields("startTime", "startTime"); - updateParentDateFields("endTime", "endTime"); - - window.close(); -} - -function onEditorCancelClick(event) { - preventDefault(event); - window.close(); -} - -function synchronizeWithParent(srcWidgetName, dstWidgetName) { - var srcDate = parent$(srcWidgetName + "_date"); - var dstDate = $(dstWidgetName + "_date"); - dstDate.value = srcDate.value; - dstDate.updateShadowValue(srcDate); - - var srcTime = parent$(srcWidgetName + "_time"); - var dstTime = $(dstWidgetName + "_time"); - dstTime.value = srcTime.value; - dstTime.updateShadowValue(srcTime); -} - -function updateParentDateFields(srcWidgetName, dstWidgetName) { - var srcDate = $(srcWidgetName + "_date"); - var dstDate = parent$(dstWidgetName + "_date"); - dstDate.value = srcDate.value; - - var srcTime = $(srcWidgetName + "_time"); - var dstTime = parent$(dstWidgetName + "_time"); - dstTime.value = srcTime.value; -} - -function onTimeWidgetChange() { - redisplayEventSpans(); -} - -function onTimeDateWidgetChange() { - var rows = $("freeBusyHeader").select("tr"); - for (var i = 0; i < rows.length; i++) { - for (var j = rows[i].cells.length - 1; j > -1; j--) { - rows[i].deleteCell(j); - } - } - - rows = $("freeBusyData").select("tr"); - for (var i = 0; i < rows.length; i++) { - for (var j = rows[i].cells.length - 1; j > -1; j--) { - rows[i].deleteCell(j); - } - } - - prepareTableHeaders(); - prepareTableRows(); - redisplayEventSpans(); - resetAllFreeBusys(); -} - -function prepareTableHeaders() { - var startTimeDate = $("startTime_date"); - var startDate = startTimeDate.inputAsDate(); - startDate.setHours(0, 0); - - var endTimeDate = $("endTime_date"); - var endDate = endTimeDate.inputAsDate(); - endDate.setHours(0, 0); - - var rows = $("freeBusyHeader").rows; - var days = startDate.daysUpTo(endDate); - - for (var i = 0; i < days.length; i++) { - var header1 = document.createElement("th"); - header1.colSpan = ((displayEndHour - displayStartHour) + 1)/2; - header1.appendChild(document.createTextNode(days[i].toLocaleDateString())); - rows[0].appendChild(header1); - var header1b = document.createElement("th"); - header1b.colSpan = ((displayEndHour - displayStartHour) + 1)/2; - header1b.appendChild(document.createTextNode(days[i].toLocaleDateString())); - rows[0].appendChild(header1b); - for (var hour = displayStartHour; hour < (displayEndHour + 1); hour++) { - var header2 = document.createElement("th"); - header2.appendChild(document.createTextNode(timeFormat.formatTime(hour, 0))); - rows[1].appendChild(header2); - var header3 = document.createElement("th"); - for (var span = 0; span < 4; span++) { - var spanElement = document.createElement("span"); - $(spanElement).addClassName("freeBusyZoneElement"); - header3.appendChild(spanElement); - } - rows[2].appendChild(header3); - } - } -} - -function prepareTableRows() { - var startTimeDate = $("startTime_date"); - var startDate = startTimeDate.inputAsDate(); - - var endTimeDate = $("endTime_date"); - var endDate = endTimeDate.inputAsDate(); - endDate.setTime(endDate.getTime()); - - var rows = $("freeBusyData").tBodies[0].rows; - var days = startDate.daysUpTo(endDate); - var width = $('freeBusyHeader').getWidth(); - $("freeBusyData").setStyle({ width: width + 'px' }); - - for (var i = 0; i < days.length; i++) - for (var rowNbr = 0; rowNbr < rows.length; rowNbr++) - for (var hour = displayStartHour; hour < (displayEndHour + 1); hour++) - rows[rowNbr].appendChild(createElement("td")); -} - -function prepareAttendees() { - var tableAttendees = $("freeBusyAttendees"); - var tableData = $("freeBusyData"); - var organizer = window.opener.getCalendarOwner(); - var attendees = window.opener.attendees; - var attendeesKeys = (attendees ? attendees.keys() : null); - - var tbodyAttendees = tableAttendees.tBodies[0]; - var modelAttendee = tbodyAttendees.rows[tbodyAttendees.rows.length - 1]; - var newAttendeeRow = tbodyAttendees.rows[tbodyAttendees.rows.length - 2]; - - var tbodyData = tableData.tBodies[0]; - var modelData = tbodyData.rows[tbodyData.rows.length - 1]; - var newDataRow = tbodyData.rows[tbodyData.rows.length - 2]; - - // Unconditionaly add the organizer - var row = $(modelAttendee.cloneNode(true)); - tbodyAttendees.insertBefore(row, newAttendeeRow); - row.removeClassName("attendeeModel"); - row.setAttribute("partstat", organizer["partstat"]); - row.setAttribute("role", organizer["role"]); - var uid = organizer["uid"]; - row.addClassName("organizer-row"); - row.removeClassName("attendee-row"); - row.isOrganizer = true; - var input = row.down("input"); - var value = organizer["name"]; - if (value) - value += " "; - else - value = ""; - value += "<" + organizer["email"] + ">"; - input.value = value; - input.uid = uid; - //input.cname = organizer["cname"]; - input.setAttribute("name", ""); - input.modified = false; - input.disable(); - - row = $(modelData.cloneNode(true)); - tbodyData.insertBefore(row, newDataRow); - row.removeClassName("dataModel"); - displayFreeBusyForNode(input); - - if (attendeesKeys && attendeesKeys.length > 0) { - - attendeesKeys.each(function(atKey) { - var attendee = attendees.get(atKey); - var row = $(modelAttendee.cloneNode(true)); - tbodyAttendees.insertBefore(row, newAttendeeRow); - row.removeClassName("attendeeModel"); - row.setAttribute("partstat", attendee["partstat"]); - row.setAttribute("role", attendee["role"]); - var uid = attendee["uid"]; - if (uid && uid == OwnerLogin) { - row.addClassName("organizer-row"); - row.removeClassName("attendee-row"); - row.isOrganizer = true; - } else { - row.addClassName("attendee-row"); - row.removeClassName("organizer-row"); - row.isOrganizer = false; - } - var statusTD = row.down(".attendeeStatus"); - if (statusTD) { - var boundOnStatusClick - = onAttendeeStatusClick.bindAsEventListener(row); - statusTD.observe("click", boundOnStatusClick, false); - } - - var input = row.down("input"); - var value = attendee["name"]; - if (value) - value += " "; - else - value = ""; - value += "<" + attendee["email"] + ">"; - input.value = value; - input.uid = uid; - input.cname = attendee["cname"]; - input.setAttribute("name", ""); - input.modified = false; - input.observe("blur", onInputBlur); - input.observe("keydown", - onContactKeydown.bindAsEventListener(input)); - - row = $(modelData.cloneNode(true)); - tbodyData.insertBefore(row, newDataRow); - row.removeClassName("dataModel"); - displayFreeBusyForNode(input); - }); - } - else { - newAttendee(); - } - - // Activate "Add attendee" button - var links = tableAttendees.select("TR.futureAttendee TD A"); - links.first().observe("click", onNewAttendeeClick); -} - -function onWindowResize(event) { - var view = $('freeBusyView'); - var attendeesCell = $$('TABLE#freeBusy TD.freeBusyAttendees').first(); - var headerDiv = $$('TABLE#freeBusy TD.freeBusyHeader DIV').first(); - var attendeesDiv = $$('TABLE#freeBusy TD.freeBusyAttendees DIV').first(); - var dataDiv = $$('TABLE#freeBusy TD.freeBusyData DIV').first(); - var width = view.getWidth() - attendeesCell.getWidth(); - var height = view.getHeight() - headerDiv.getHeight(); - - attendeesDiv.setStyle({ height: (height - 20) + 'px' }); - headerDiv.setStyle({ width: (width - 20) + 'px' }); - dataDiv.setStyle({ width: (width - 4) + 'px', - height: (height - 2) + 'px' }); -} - -function onScroll(event) { - var headerDiv = $$('TABLE#freeBusy TD.freeBusyHeader DIV').first(); - var attendeesDiv = $$('TABLE#freeBusy TD.freeBusyAttendees DIV').first(); - var dataDiv = $$('TABLE#freeBusy TD.freeBusyData DIV').first(); - - headerDiv.scrollLeft = dataDiv.scrollLeft; - attendeesDiv.scrollTop = dataDiv.scrollTop; -} - -function onFreeBusyLoadHandler() { - OwnerLogin = window.opener.getOwnerLogin(); - - var widgets = {'start': {'date': $("startTime_date"), - 'time': $("startTime_time")}, - 'end': {'date': $("endTime_date"), - 'time': $("endTime_time")}}; - synchronizeWithParent("startTime", "startTime"); - synchronizeWithParent("endTime", "endTime"); - - initTimeWidgets(widgets); - initializeTimeSlotWidgets(); - - initializeWindowButtons(); - prepareAttendees(); - onWindowResize(null); - Event.observe(window, "resize", onWindowResize); - $$('TABLE#freeBusy TD.freeBusyData DIV').first().observe("scroll", onScroll); - scrollToEvent(); -} - -document.observe("dom:loaded", onFreeBusyLoadHandler); - -/* Functions related to UIxTimeDateControl widget */ - -function initTimeWidgets(widgets) { - this.timeWidgets = widgets; - - jQuery(widgets['start']['date']).closest('.date').datepicker( - { autoclose: true, position: 'above', weekStart: parentvar('firstDayOfWeek') }); - jQuery(widgets['start']['date']).change(onAdjustTime); - widgets['start']['time'].on("time:change", onAdjustTime); - widgets['start']['time'].addInterface(SOGoTimePickerInterface); - widgets['start']['time'].setPosition('above'); - - jQuery(widgets['end']['date']).closest('.date').datepicker( - { autoclose: true, position: 'above', weekStart: parentvar('firstDayOfWeek') }); - jQuery(widgets['end']['date']).change(onAdjustTime); - widgets['end']['time'].on("time:change", onAdjustTime); - widgets['end']['time'].addInterface(SOGoTimePickerInterface); - widgets['end']['time'].setPosition('above'); - - var allDayLabel = $("allDay"); - if (allDayLabel) { - var input = $(allDayLabel).childNodesWithTag("input")[0]; - input.observe("change", onAllDayChanged.bindAsEventListener(input)); - if (input.checked) { - for (var type in widgets) - widgets[type]['time'].disabled = true; - } - } - - if (isAllDay) - handleAllDay(); -} - -function onAdjustTime(event) { - var endDate = window.getEndDate(); - var startDate = window.getStartDate(); - var delta = 0; - if (this.id.startsWith("start")) { - // Start date was changed - delta = window.getShadowStartDate().valueOf() - startDate.valueOf(); - var newEndDate = new Date(endDate.valueOf() - delta); - window.setEndDate(newEndDate); - window.timeWidgets['end']['date'].updateShadowValue(); - window.timeWidgets['end']['time'].updateShadowValue(); - window.timeWidgets['start']['date'].updateShadowValue(); - window.timeWidgets['start']['time'].updateShadowValue(); - } - else { - // End date was changed - delta = window.getShadowEndDate().valueOf() - endDate.valueOf(); - if (delta != 0) { - var startEndDelta = endDate.valueOf() - startDate.valueOf(); - if (startEndDelta < 0) { - showAlertDialog(labels.validate_endbeforestart); - var oldEndDate = window.getShadowEndDate(); - window.setEndDate(oldEndDate); - window.timeWidgets['end']['date'].updateShadowValue(); - window.timeWidgets['end']['time'].updateShadowValue(); - window.timeWidgets['end']['time'].onChange(); // method from SOGoTimePicker - } - else { - window.timeWidgets['end']['date'].updateShadowValue(); - window.timeWidgets['end']['time'].updateShadowValue(); - } - } - } - - if ($("freeBusyHeader").getElementsByTagName("th").length == 0 || delta != 0) - // Update freebusy data - onTimeDateWidgetChange(); -} - -function _getDate(which) { - var date = window.timeWidgets[which]['date'].inputAsDate(); - var time = window.timeWidgets[which]['time'].value.split(":"); - date.setHours(time[0]); - date.setMinutes(time[1]); - - return date; -} - -function getStartDate() { - return this._getDate('start'); -} - -function getEndDate() { - return this._getDate('end'); -} - -function _getShadowDate(which) { - var date = window.timeWidgets[which]['date'].getAttribute("shadow-value").asDate(); - var time = window.timeWidgets[which]['time'].getAttribute("shadow-value").split(":"); - date.setHours(time[0]); - date.setMinutes(time[1]); - - return date; -} - -function getShadowStartDate() { - return this._getShadowDate('start'); -} - -function getShadowEndDate() { - return this._getShadowDate('end'); -} - -function _setDate(which, newDate) { - window.timeWidgets[which]['date'].setInputAsDate(newDate); - jQuery(window.timeWidgets[which]['date']).closest('.date').datepicker('update'); - if (!isAllDay) { - window.timeWidgets[which]['time'].value = newDate.getDisplayHoursString(); - if (window.timeWidgets[which]['time'].onChange) window.timeWidgets[which]['time'].onChange(); // method from SOGoTimePicker - } -} - -function setStartDate(newStartDate) { - this._setDate('start', newStartDate); -} - -function setEndDate(newEndDate) { - this._setDate('end', newEndDate); -} diff --git a/UI/WebServerResources/UIxCalUserRightsEditor.css b/UI/WebServerResources/UIxCalUserRightsEditor.css deleted file mode 100644 index afdb0cfeb..000000000 --- a/UI/WebServerResources/UIxCalUserRightsEditor.css +++ /dev/null @@ -1,48 +0,0 @@ -DIV.title -{ color: #000; - vertical-align: bottom; - padding-top: 8px; - padding-left: 1em; - padding: 5px; - background-color: #fff; - border-bottom: 1px solid #555; } - -DIV.title SPAN -{ float: left; - line-height: 14px; - text-align: right; - width: 120px; } - -DIV.title SPAN.value -{ float: none; - margin-left: 1em; - font-size: 14px; - font-weight: bold; } - -DIV.title LABEL -{ display: block; - clear: both; } - -DIV.calendarUserRights, -DIV.basicUserRights -{ margin: 1em;} - -DIV.calendarUserRights SPAN -{ float: left; - clear: both; - line-height: 2em; - margin-right: 1em; - text-align: right; - width: 120px; } - -DIV.buttons -{ text-align: right; - margin: 1em; - margin-top: 0px; } - -DIV.dialog.none -{ position: absolute; - top: 0px; - left: 0px; - right: 0px; - margin: 25px auto; } \ No newline at end of file diff --git a/UI/WebServerResources/UIxCalUserRightsEditor.js b/UI/WebServerResources/UIxCalUserRightsEditor.js deleted file mode 100644 index 8f5d1541f..000000000 --- a/UI/WebServerResources/UIxCalUserRightsEditor.js +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -function onUpdateACL(event) { - var uid = $('uid').value; - if (uid == '' || uid == 'anonymous') { - var selects = $$('#userRightsForm select'); - var enabled = false; - for (var i = 0; i < selects.length; i++) { - if (selects[i].value != 'None') { - enabled = true; - break; - } - } - if (!enabled) { - var inputs = $$('#userRightsForm input[type="checkbox"]'); - for (var i = 0; i < inputs.length; i++) { - if (inputs[i].checked) { - enabled = true; - break; - } - } - } - if (enabled) { - if (uid == '') - showConfirmDialog(_("Warning"), - _("Any user with an account on this system will be able to access your calendar \"%{0}\". Are you certain you trust them all?").formatted($("folderName").allTextContent()), - onUpdateACLConfirm, onUpdateACLCancel, - "Give Access", "Keep Private"); - else - showConfirmDialog(_("Warning"), - _("Potentially anyone on the Internet will be able to access your calendar \"%{0}\", even if they do not have an account on this system. Is this information suitable for the public Internet?").formatted($("folderName").allTextContent()), - onUpdateACLConfirm, onUpdateACLCancel, - "Give Access", "Keep Private"); - return false; - } - } - - return onUpdateACLConfirm(event); -} - -function onUpdateACLConfirm(event) { - disposeDialog(); - - $('userRightsForm').submit(); - Event.stop(event); - - return false; -} - -function onUpdateACLCancel(event) { - var options = $$('#userRightsForm option'); - for (var i = 0; i < options.length; i++) - options[i].selected = (options[i].value == 'None'); - var inputs = $$('#userRightsForm input[type="checkbox"]'); - for (var i = 0; i < inputs.length; i++) - if (inputs[i].checked) - inputs[i].checked = false; - - disposeDialog(); -} - -function onCancelACL(event) { - window.close(); -} - -function initACLButtons() { - $("updateButton").observe("click", onUpdateACL); - $("cancelButton").observe("click", onCancelACL); -} - -document.observe("dom:loaded", initACLButtons); diff --git a/UI/WebServerResources/UIxCalendarProperties.css b/UI/WebServerResources/UIxCalendarProperties.css deleted file mode 100644 index b7fc873c8..000000000 --- a/UI/WebServerResources/UIxCalendarProperties.css +++ /dev/null @@ -1,64 +0,0 @@ -DIV -{ clear: both; } - -FIELDSET -{ margin-bottom: 5px; - border: 1px solid #FFFFFF; - border-top: 1px solid #909090; - border-left: 1px solid #909090; } - -FIELDSET DIV -{ margin-left: 20px; - margin-right: 10px; } - -SPAN.label -{ cursor: default; - width: 55px; - text-align: right; - line-height: 2em; - float: left; - display: block; } - -INPUT.checkBox -{ margin-left: 38px; - margin-right: 6px; } - -SPAN.content -{ line-height: 1.5em; - vertical-align: middle; - margin-left: 4px; } - -SPAN.content INPUT.textField -{ width: 160px; } - -DIV.colorBox -{ margin: 5px 0; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; - border: 2px solid #eee; } - -DIV.colorBox:hover -{ border-color: #fff; } - -#colorPickerDialog -{ width: 146px; - height: 191px; } - -DIV#buttons -{ position: absolute; - bottom: 5px; - right: 5px; - padding: 10px; - padding-top: 5px; - text-align: right; } - -INPUT#calendarSyncTag -{ width: 7em; } - -LABEL -{ white-space: nowrap; } - -#webCalendarUrl SPAN.content -{ white-space: nowrap; - overflow: hidden; } diff --git a/UI/WebServerResources/UIxCalendarProperties.js b/UI/WebServerResources/UIxCalendarProperties.js deleted file mode 100644 index a44eb9c7a..000000000 --- a/UI/WebServerResources/UIxCalendarProperties.js +++ /dev/null @@ -1,121 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -function onLoadCalendarProperties() { - var tabsContainer = $("propertiesTabs"); - var controller = new SOGoTabsController(); - controller.attachToTabsContainer(tabsContainer); - - var colorButton = $("colorButton"); - var calendarColor = $("calendarColor"); - colorButton.setStyle({ "backgroundColor": colorButton.readAttribute('data-color') }); - colorButton.observe("click", onColorClick); - - $('colorPickerDialog').on('click', 'span', onColorPickerChoice); - $(document.body).on("click", onBodyClickHandler); - - var cancelButton = $("cancelButton"); - cancelButton.observe("click", onCancelClick); - - var okButton = $("okButton"); - okButton.observe("click", onOKClick); - - Event.observe(document, "keydown", onDocumentKeydown); -} - -function onDocumentKeydown(event) { - var target = Event.element(event); - if (target.tagName == "INPUT" || target.tagName == "SELECT") { - if (event.keyCode == Event.KEY_RETURN) { - onOKClick(event); - } - } - if (event.keyCode == Event.KEY_ESC) { - onCancelClick(); - } -} - -function onCancelClick(event) { - window.close(); -} - -function onOKClick(event) { - var calendarName = $("calendarName"); - var calendarColor = $("calendarColor"); - var calendarID = $("calendarID"); - var save = true; - var tag = $("calendarSyncTag"); - var originalTag = $("originalCalendarSyncTag"); - var allTags = $("allCalendarSyncTags"); - - if (calendarName.value.blank()) { - alert(_("Please specify a calendar name.")); - save = false; - } - - if (save - && allTags) - allTags = allTags.value.split(","); - - if (save - && tag - && $("synchronizeCalendar").checked) { - if (tag.value.blank()) { - alert(_("tagNotDefined")); - save = false; - } - else if (allTags - && allTags.indexOf(tag.value) > -1) { - alert(_("tagAlreadyExists")); - save = false; - } - else if (originalTag - && !originalTag.value.blank()) { - if (tag.value != originalTag.value) - save = confirm(_("tagHasChanged")); - } - else - save = confirm(_("tagWasAdded")); - } - else if (save - && originalTag - && !originalTag.value.blank()) - save = confirm(_("tagWasRemoved")); - - if (save) { - window.opener.updateCalendarProperties(calendarID.value, - calendarName.value, - calendarColor.value); - $("propertiesform").submit(); - } - else - Event.stop(event); -} - -function onBodyClickHandler(event) { - var target = getTarget(event); - if (!target.hasClassName('colorBox')) - $("colorPickerDialog").hide(); -} - -function onColorClick(event) { - var cellPosition = this.cumulativeOffset(); - var cellDimensions = this.getDimensions(); - var div = $('colorPickerDialog'); - var divDimensions = div.getDimensions(); - var left = cellPosition[0] + cellDimensions["width"] + 4; - var top = cellPosition[1] - 5; - div.setStyle({ left: left + "px", top: top + "px" }); - div.show(); - - preventDefault(event); -} - -function onColorPickerChoice(event) { - var span = getTarget(event); - var newColor = "#" + span.className.substr(4); - var colorButton = $("colorButton"); - colorButton.setStyle({ "backgroundColor": newColor }); - $("calendarColor").value = newColor; -} - -document.observe("dom:loaded", onLoadCalendarProperties); diff --git a/UI/WebServerResources/UIxColorPicker.js b/UI/WebServerResources/UIxColorPicker.js deleted file mode 100644 index cca959603..000000000 --- a/UI/WebServerResources/UIxColorPicker.js +++ /dev/null @@ -1,14 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -var type; - -function onLoadColorPicker(event) { - showColorPicker(); -} - -function onChooseColor(newColor) { - window.opener.onColorPickerChoice(newColor, type); - window.close(); -} - -document.observe("dom:loaded", onLoadColorPicker); diff --git a/UI/WebServerResources/UIxComponentEditor.css b/UI/WebServerResources/UIxComponentEditor.css deleted file mode 100644 index 70f7e4be3..000000000 --- a/UI/WebServerResources/UIxComponentEditor.css +++ /dev/null @@ -1,135 +0,0 @@ -form[name="editform"] -{ position: absolute; - top: 48px; - left: 0; - right: 0; - bottom: 0; } - -form[name="editform"] #eventView -{ padding: 1em; } - -SELECT#calendarList, -SELECT#categoryList, -SELECT#priorityList, -SELECT#repeatList, -SELECT#reminderList -{ width: 13em; } - -#attendeesLabel -{ display: none; } - -A#changeAttachButton -{ margin-left: 1em; - position: absolute; - right: 0; - display: inline; } - -SPAN.datePicker INPUT.textField, -SPAN.timeDateControl INPUT.textField -{ width: 7em; } - -SPAN.timeDateControl A.button -{ border: 0; } - -SPAN.timeDateControl A:hover -{ text-decoration: none; } - -SPAN.content -{ position: absolute; - white-space: nowrap; - line-height: 2em; - top: -.25em; - left: 8em; - right: 0em; - text-overflow: ellipsis; - overflow: hidden; - min-height: 22px; } - -LABEL, SPAN.checkBoxList -{ display: block; - position: relative; - line-height: 1.5em; - height: 1.5em; - margin-left: 0px; - margin-bottom: .5em; - width: 100%; } - -LABEL#commentArea textarea -{ width: 97%; } - -SPAN.headerContent -{ - width: 80%; - height: 1px; - top: 0.9em; -} -LABEL.title -{ - margin-top: 1em; - font-weight: bold; -} -LABEL.titleNoSpace -{ - margin-top: 0px; -} - -DIV#windowButtons -{ position: absolute; - bottom: 2em; - left: auto; - right: 2em; } - -LABEL.calendarName -{ background-color: #fff; - border-bottom: 1px solid #555; - font-weight: bold; - text-align: right; - margin: 0; - padding: 10px; - width: auto; -} - -DIV#attendeesMenu -{ overflow: auto; } - -DIV.fakeTextArea -{ overflow: auto; - background: white; - border-width: 2px; - border-style: inset; - padding: 2px; - height: 100px; } - -DIV#descriptionDiv, -DIV#attendeesDiv -{ height: 120px; } - -DIV#descriptionDiv DIV.fakeTextArea -{ line-height: 1.5em; - padding: 2px 4px; - white-space: pre-wrap; } - -/* #delegateEditor -{ padding-bottom: 1em; } */ - -#delegatedTo -{ background-image: url("abcard.png"); - background-repeat: no-repeat; - background-position: 4px center; - background-color: #CCDDEC; - padding: 2px 2px 2px 24px; - width: 260px; } - -IMG#progressIndicator -{ float: none; - position: absolute; - right: 1em; - margin: 0 5px; } - -SPAN.content INPUT, -SPAN.content SELECT, -SPAN.content SPAN, -SPAN.timeDateControl INPUT, -SPAN.timeDateControl SELECT, -SPAN.timeDateControl SPAN -{ vertical-align: top; } diff --git a/UI/WebServerResources/UIxComponentEditor.js b/UI/WebServerResources/UIxComponentEditor.js deleted file mode 100644 index 8208b597b..000000000 --- a/UI/WebServerResources/UIxComponentEditor.js +++ /dev/null @@ -1,411 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -var ComponentEditor = { - attendeesWindow: null, - recurrenceWindow: null, - reminderWindow: null -}; - -function getOwnerLogin() { - return ownerLogin; -} - -function getCalendarOwner() { - var ownerProfile; - - if (typeof organizer == "undefined") { - var calendarIndex = $("calendarList").value; - var ownersList = owners[0]; - var profiles = owners[1]; - var ownerUid = ownersList[calendarIndex]; - ownerProfile = profiles[ownerUid]; - ownerProfile["uid"] = ownerUid; - } - else { - ownerProfile = organizer; - } - - return ownerProfile; -} - -function onPopupAttendeesWindow(event) { - if (event) - preventDefault(event); - if (ComponentEditor.attendeesWindow && ComponentEditor.attendeesWindow.open && !ComponentEditor.attendeesWindow.closed) - ComponentEditor.attendeesWindow.focus(); - else - ComponentEditor.attendeesWindow = window.open(ApplicationBaseURL + "/editAttendees", - sanitizeWindowName(activeCalendar + activeComponent + "Attendees"), - "width=900,height=573"); - - return false; -} - -function onSelectClassification(event) { - if (event.button == 0 || (isWebKit() && event.button == 1)) { - var node = getTarget(event); - if (node.tagName != 'A') - node = $(node).up("A"); - popupToolbarMenu(node, "classification-menu"); - Event.stop(event); - } -} - -function onPopupAttachWindow(event) { - if (event) - preventDefault(event); - - var attachInput = $("attach"); - var newAttach = window.prompt(_("Target:"), attachInput.value || "http://"); - if (newAttach != null) { - var documentHref = $("documentHref"); - var documentLabel = $("documentLabel"); - if (documentHref.childNodes.length > 0) { - documentHref.childNodes[0].nodeValue = newAttach; - if (newAttach.length > 0) - documentLabel.setStyle({ display: "block" }); - else - documentLabel.setStyle({ display: "none" }); - } - else { - documentHref.appendChild(document.createTextNode(newAttach)); - if (newAttach.length > 0) - documentLabel.setStyle({ display: "block" }); - } - attachInput.value = newAttach; - } - onWindowResize(event); - - return false; -} - -function onPopupDocumentWindow(event) { - var documentUrl = $("attach"); - - preventDefault(event); - window.open(documentUrl.value, "SOGo_Document"); - - return false; -} - -function onMenuSetClassification(event) { - event.cancelBubble = true; - - var classification = this.getAttribute("classification"); - if (this.parentNode.chosenNode) - this.parentNode.chosenNode.removeClassName("_chosen"); - this.addClassName("_chosen"); - this.parentNode.chosenNode = this; - - var classificationInput = $("classification"); - classificationInput.value = classification; -} - -function onChangeCalendar(event) { - var calendars = $("calendarFoldersList").value.split(","); - var form = document.forms["editform"]; - var urlElems = form.getAttribute("action").split("?"); - var choice = calendars[this.value]; - var urlParam = "moveToCalendar=" + choice; - if (urlElems.length == 1) - urlElems.push(urlParam); - else - urlElems[2] = urlParam; - - while (urlElems.length > 2) - urlElems.pop(); - - form.setAttribute("action", urlElems.join("?")); -} - -function initializeDocumentHref() { - var documentHref = $("documentHref"); - var documentLabel = $("documentLabel"); - var documentUrl = $("attach"); - - documentHref.on("click", onPopupDocumentWindow); - if (documentUrl.value.length > 0) { - documentHref.appendChild(document.createTextNode(documentUrl.value)); - documentLabel.setStyle({ display: "block" }); - } - - var changeUrlButton = $("changeAttachButton"); - if (changeUrlButton) - changeUrlButton.on("click", onPopupAttachWindow); -} - -function initializeClassificationMenu() { - if ($("classification-menu")) { - var classification = $("classification").value.toUpperCase(); - var classificationMenu = $("classification-menu").childNodesWithTag("ul")[0]; - var menuEntries = $(classificationMenu).childNodesWithTag("li"); - var chosenNode; - if (classification == "CONFIDENTIAL") - chosenNode = menuEntries[1]; - else if (classification == "PRIVATE") - chosenNode = menuEntries[2]; - else - chosenNode = menuEntries[0]; - classificationMenu.chosenNode = chosenNode; - $(chosenNode).addClassName("_chosen"); - } -} - -function findAttendeeWithFieldValue(field, fieldValue) { - var foundAttendee = null; - - var attendeesKeys = attendees.keys(); - for (var i = 0; !foundAttendee && i < attendeesKeys.length; i++) { - var attendee = attendees.get(attendeesKeys[i]); - if (attendee[field] == fieldValue) { - foundAttendee = attendee; - } - } - - return foundAttendee; -} - -function findDelegateAddress() { - var delegateAddress = null; - - var ownerAttendee = findAttendeeWithFieldValue("uid", ownerLogin); - if (ownerAttendee && ownerAttendee["delegated-to"]) { - var delegateAttendee - = findAttendeeWithFieldValue("email", - ownerAttendee["delegated-to"]); - if (delegateAttendee) { - if (delegateAttendee["name"]) { - delegateAddress = (delegateAttendee["name"] - + " <" + delegateAttendee["email"] + ">"); - } - else { - delegateAddress = delegateAttendee["email"]; - } - } - } - - return delegateAddress; -} - -function onComponentEditorLoad(event) { - initializeDocumentHref(); - initializeClassificationMenu(); - var list = $("calendarList"); - if (list) { - list.on("change", onChangeCalendar); - list.fire("mousedown"); - } - - var tmp = $("itemClassificationList"); - if (tmp) { - var menuItems = tmp.childNodesWithTag("li"); - for (var i = 0; i < menuItems.length; i++) - menuItems[i].on("mousedown", onMenuSetClassification); - } - - tmp = $("replyList"); - if (tmp) { - tmp.on("change", onReplyChange); - var isDelegated = (tmp.value == 4); - tmp = $("delegatedTo"); - tmp.addInterface(SOGoAutoCompletionInterface); - tmp.uidField = "c_mail"; - tmp.excludeGroups = true; - var delegateEditor = $("delegateEditor"); - tmp.animationParent = delegateEditor; - if (isDelegated) { - var delegateAddress = findDelegateAddress(); - if (delegateAddress) { - tmp.value = delegateAddress; - } - delegateEditor.show(); - } - } - - tmp = $("repeatHref"); - if (tmp) - tmp.on("click", onPopupRecurrenceWindow); - tmp = $("repeatList"); - if (tmp) - tmp.on("change", onPopupRecurrenceWindow); - tmp = $("reminderHref"); - if (tmp) - tmp.on("click", onPopupReminderWindow); - tmp = $("reminderList"); - if (tmp) - tmp.on("change", onPopupReminderWindow); - tmp = $("summary"); - if (tmp) - tmp.on("keyup", onSummaryChange); - - Event.on(window, "resize", onWindowResize); - Event.on(window, "beforeunload", onComponentEditorClose); - - onPopupRecurrenceWindow(null); - onPopupReminderWindow(null); - onSummaryChange (null); - - var summary = $("summary"); - if (summary) { - summary.focus(); - summary.selectText(0, summary.value.length); - } - - tmp = $("okButton"); - if (tmp) - tmp.on ("click", onOkButtonClick); - tmp = $("cancelButton"); - if (tmp) - tmp.on ("click", onCancelButtonClick); -} - -function onSummaryChange (e) { - if ($("summary")) - document.title = $("summary").value; -} - -function onReplyChange(event) { - var delegateEditor = $("delegateEditor"); - if (this.value == 4) { - // Delegated - delegateEditor.show(); - $("delegatedTo").focus(); - } - else { - delegateEditor.hide(); - } - onWindowResize(null); - - return true; -} - -function onComponentEditorClose(event) { - if (ComponentEditor.attendeesWindow && ComponentEditor.attendeesWindow.open && !ComponentEditor.attendeesWindow.closed) - ComponentEditor.attendeesWindow.close(); - if (ComponentEditor.recurrenceWindow && ComponentEditor.recurrenceWindow.open && !ComponentEditor.recurrenceWindow.closed) - ComponentEditor.recurrenceWindow.close(); - if (ComponentEditor.reminderWindow && ComponentEditor.reminderWindow.open && !ComponentEditor.reminderWindow.closed) - ComponentEditor.reminderWindow.close(); -} - -function onWindowResize(event) { - var comment = $("commentArea"); - if (comment) { - // Resize comment area of read-write component - var document = $("documentLabel"); - var area = comment.select("textarea").first(); - var offset = 6; - var height; - - height = window.height() - comment.cumulativeOffset().top - offset; - - if (document.visible()) { - // Component has an attachment - if ($("changeAttachButton")) - height -= $("changeAttachButton").getHeight(); - else - height -= $("documentHref").getHeight(); - } - - if (area) - area.setStyle({ height: (height - offset*2) + "px" }); - - comment.setStyle({ height: (height - offset) + "px" }); - } - else { - // Resize attendees area of a read-only component - $("eventView").style.height = window.height () + "px"; - var height = window.height() - 120; - var tmp = $("generalDiv"); - if (tmp) - height -= tmp.offsetHeight; - tmp = $("descriptionDiv"); - if (tmp) - height -= tmp.offsetHeight; - - tmp = $("attendeesDiv"); - if (tmp) { - tmp.style.height = height + "px"; - $("attendeesMenu").style.height = (height - 20) + "px"; - } - } - - return true; -} - -function onPopupRecurrenceWindow(event) { - if (event) - preventDefault(event); - - var repeatHref = $("repeatHref"); - - var repeatList = $("repeatList"); - if (repeatList && repeatList.value == 7) { - // Custom repeat rule - repeatHref.show(); - if (event) { - if (ComponentEditor.recurrenceWindow && ComponentEditor.recurrenceWindow.open && !ComponentEditor.recurrenceWindow.closed) - ComponentEditor.recurrenceWindow.focus(); - else - ComponentEditor.recurrenceWindow = window.open(ApplicationBaseURL + "/editRecurrence", - sanitizeWindowName(activeCalendar + activeComponent + "Recurrence"), - "width=500,height=400"); - } - } - else if (repeatHref) - repeatHref.hide(); - - return false; -} - -function onPopupReminderWindow(event) { - if (event) - preventDefault(event); - - var reminderHref = $("reminderHref"); - - var reminderList = $("reminderList"); - if (reminderList && reminderList.value == 15) { - reminderHref.show(); - if (event) { - if (ComponentEditor.reminderWindow && ComponentEditor.reminderWindow.open && !ComponentEditor.reminderWindow.closed) - ComponentEditor.reminderWindow.focus(); - else { - var height = (emailAlarmsEnabled ? 235 : 150); - ComponentEditor.reminderWindow - = window.open(ApplicationBaseURL + "/editReminder", - sanitizeWindowName(activeCalendar + activeComponent + "Reminder"), - "width=255,height=" + height); - } - } - } - else if (reminderHref) - reminderHref.hide(); - - return false; -} - -function onOkButtonClick (e) { - - var jsonData = Form.serialize(document.forms['rsvpform'], true); - - var input = $("delegatedTo"); - if (input && input.readAttribute("uid") != null) { - jsonData['delegatedTo'] = input.readAttribute("uid"); - } - - triggerAjaxRequest(document.forms['rsvpform'].readAttribute("action"), - modifyEventCallback, - null, - Object.toJSON(jsonData), - { "content-type": "application/json"} - ); - - return false; -} - -function onCancelButtonClick (e) { - window.close (); -} - -document.on("dom:loaded", onComponentEditorLoad); diff --git a/UI/WebServerResources/UIxContactEditor.css b/UI/WebServerResources/UIxContactEditor.css deleted file mode 100644 index db0cf2061..000000000 --- a/UI/WebServerResources/UIxContactEditor.css +++ /dev/null @@ -1,100 +0,0 @@ -DIV#addressBookSelector -{ margin: .5em; } - -DIV#addressBookSelector SELECT -{ width: 32em; } - -SELECT -{ width: 8em; } - -TR -{ width: 100% !important; - border: 2px solid #0ff; } - -/********** Frame of the current tab **********/ - -DIV#editorTabs -{ position: absolute; - left: 5px; - right: 5px; - top: 5px; - bottom: 5px; -} - -DIV#editorTabs DIV.tab TD.titleCell -{ text-align: left; - font-weight: bold; } - -DIV#buttons -{ color: #535D6D; - visibility: visible; - position: absolute; - bottom: 12px; - right: 10px; } - -/********** Contact **********/ - -INPUT.textField -{ width: 60%; } - -TD#htmlMailFormat -{ text-align: left !important; } - -TABLE#emailInfos TD.preferred -{ width: 10% !important; - overflow: visible; - text-align: center; } - -/********** Categories **********/ - -#categoryContainer -{ max-height: 400px; - overflow: auto; - padding: 0px; - overflow-y: auto; } - -#categoryContainer > DIV -{ margin: 0px; - padding: 0px; - border: 0px; - height: 22px; } - -INPUT.comboBoxField, #emptyCategory -{ width: 370px; - height: 16px; - padding-top: 0px; - padding-bottom: 0px; - margin-bottom: 0px; - margin-top: 0px; } - -/********** Address **********/ - -DIV.tab TD.firstColumn INPUT.textField, -DIV.tab TD.secondColumn INPUT.textField -{ width: 35%; } - -/********** Photos **********/ - - - -/********** OTHER **********/ - -#birthdayDate -{ width: auto; - vertical-align: 8px; -} - -#birthdayLabel -{ - vertical-align: 8px; -} - -#otherInfos table td -{ text-align: left; - padding-bottom: 8px; -} - -#otherInfos textarea -{ width: 100%; - height: 100%; -} \ No newline at end of file diff --git a/UI/WebServerResources/UIxContactEditor.js b/UI/WebServerResources/UIxContactEditor.js deleted file mode 100644 index 0488cb154..000000000 --- a/UI/WebServerResources/UIxContactEditor.js +++ /dev/null @@ -1,306 +0,0 @@ -/* -*- Mode: js2-mode; tab-width: 4; c-label-minimum-indentation: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - Copyright (C) 2005 SKYRIX Software AG - Copyright (C) 2006-2011 Inverse - - This file is part of OpenGroupware.org. - - OGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - OGo is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - 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 - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -var dateRegex = /^(([0-9]{2})?[0-9])?[0-9]-[0-9]?[0-9]-[0-9]?[0-9]$/; - -var displaynameChanged = false; - -var tabIndex = 0; - -function unescapeCallbackParameter(s) { - if(!s || s.length == 0) - return s; - s = s.replace(/'/g, "'"); - s = s.replace(/"/g, '"'); - return s; -} - -function copyContact(type, email, uid, sn, displayname, - givenname, telephonenumber, facsimiletelephonenumber, - mobile, postalAddress, homePostalAddress, departmentnumber, l) -{ - // var type = arguments[0]; - // var email = arguments[1]; - // var uid = arguments[2]; - // var sn = arguments[3]; - // var givenname = arguments[4]; - // var telephonenumber = arguments[5]; - // var facsimiletelephonenumber = arguments[6]; - // var mobile = arguments[7]; - // var postaladdress = arguments[8]; - // var homepostaladdress = arguments[9]; - // var departmentnumber = arguments[10]; - // var l = arguments[11]; - var e; - e = $('displayname'); - e.setAttribute('value', unescapeCallbackParameter(displayname)); - e = $('email'); - e.setAttribute('value', email); - e = $('sn'); - e.setAttribute('value', unescapeCallbackParameter(sn)); - e = $('givenname'); - e.setAttribute('value', unescapeCallbackParameter(givenname)); - e = $('telephonenumber'); - e.setAttribute('value', telephonenumber); - e = $('facsimiletelephonenumber'); - e.setAttribute('value', facsimileTelephonenumber); - e = $('mobile'); - e.setAttribute('value', mobile); - e = $('postaladdress'); - e.setAttribute('value', unescapeCallbackParameter(postalAddress)); - e = $('homepostaladdress'); - e.setAttribute('value', unescapeCallbackParameter(homePostalAddress)); - e = $('departmentnumber'); - e.setAttribute('value', unescapeCallbackParameter(departmentnumber)); - e = $('l'); - e.setAttribute('value', unescapeCallbackParameter(l)); -}; - -function validateContactEditor() { - var rc = true; - - var e = $('mail'); - if (e.value.length > 0 - && !emailRE.test(e.value)) { - alert(_("invalidemailwarn")); - rc = false; - } - - e = $('mozillasecondemail'); - if (e.value.length > 0 - && !emailRE.test(e.value)) { - alert(_("invalidemailwarn")); - rc = false; - } - return rc -} - -function initTimeWidget(input) { - var firstDay = new Date(); - firstDay.setFullYear(1900,0,1); - var lastDay = new Date(); - - jQuery(input).closest('.date').datepicker({autoclose: true, - endDate: lastDay, - startDate: firstDay, - setStartDate: lastDay, - startView: 2}) -} - -function onDisplaynameKeyDown() { - var fn = $("displayname"); - fn.onkeydown = null; - displaynameChanged = true; - - return true; -} - -function onDisplaynameNewValue(event) { - if (!displaynameChanged) { - var sn = $("sn").value.trim(); - var givenname = $("givenname").value.trim(); - - var fullname = givenname; - if (fullname && sn) - fullname += ' '; - fullname += sn; - - $("displayname").value = fullname; - } - - return true; -} - -function onEditorCancelClick(event) { - this.blur(); - onCloseButtonClick(event); -} - -function onEditorSubmitClick(event) { - if (validateContactEditor()) { - saveCategories(); - $('mainForm').submit(); - } - this.blur(); -} - -function saveCategories() { - var container = $("categoryContainer"); - var catsInput = $("jsonContactCategories"); - if (container && catsInput) { - var newCategories = $([]); - var inputs = container.select("INPUT"); - for (var i = 0; i < inputs.length; i++) { - var newValue = inputs[i].value.trim(); - if (newValue.length > 0 && newValue != _("New category") - && newCategories.indexOf(newValue) == -1) { - newCategories.push(newValue); - } - } - var json = Object.toJSON(newCategories); - catsInput.value = json; - } -} - -function onDocumentKeydown(event) { - var target = Event.element(event); - if (target.tagName == "INPUT" || target.tagName == "SELECT") { - if (event.keyCode == Event.KEY_RETURN) { - var fdisplayname = onEditorSubmitClick.bind($("submitButton")); - fdisplayname(); - Event.stop(event); - } - } -} - -function appendCategoryInput(label) { - var container = $("categoryContainer"); - - var inputContainer = createElement("div"); - var textInput = createElement("input", null, "comboBoxField", null, - { type: "text"}, inputContainer); - textInput.observe("change", onCategoryInputChange); - textInput.observe("focus", onCategoryInputFocus); - textInput.value = label; - textInput.tabIndex = tabIndex; - tabIndex++; - var button = createElement("button", null, "comboBoxButton"); - inputContainer.appendChild(button); - button.observe("click", onComboButtonClick); - button.textInput = textInput; - button.menuName = "categoriesMenu"; - - container.appendChild(inputContainer); - - return textInput; -} - -function onComboButtonClick(event) { - var menu = $(this.menuName); - popupMenu(event, this.menuName, this.textInput); - var container = $("categoryContainer"); - var menuTop = (container.cascadeTopOffset() - - container.scrollTop - + this.textInput.offsetTop - + this.textInput.clientHeight); - var menuLeft = this.textInput.cascadeLeftOffset() + 1; - var width = this.textInput.clientWidth; - menu.setStyle({ "top": menuTop + "px", - "left": menuLeft + "px", - "width": width + "px" }); - - return false; -} - -function onCategoryInputChange(event) { - var newValue = this.value.trim(); - if (newValue == "") { - var inputContainer = this.parentNode; - inputContainer.parentNode.removeChild(inputContainer); - } - else { - if (gCategories.indexOf(newValue) == -1) { - gCategories.push(newValue); - gCategories.sort(function (a, b) - { return a.toLowerCase() > b.toLowerCase(); } ); - regenerateCategoriesMenu(); - } - } -} - -function onCategoryInputFocus(event) { - this.select(); -} - -function regenerateCategoriesMenu() { - var menu = $("categoriesMenu"); - if (menu) { - while (menu.lastChild) { - menu.removeChild(menu.lastChild); - } - var list = createElement("ul"); - for (var i = 0; i < gCategories.length; i++) { - var label = gCategories[i]; - var entry = createElement("li"); - entry.label = label; - entry.menuCallback = onCategoryMenuEntryClick; - entry.on("mousedown", onMenuClickHandler); - entry.appendChild(document.createTextNode(label)); - list.appendChild(entry); - } - menu.appendChild(list); - } -} - -function onCategoryMenuEntryClick(event) { - document.menuTarget.value = this.label; - document.menuTarget.focus(); -} - -function onEmptyCategoryClick(event) { - var textInput = appendCategoryInput(_("New category")); - window.setTimeout(function() {textInput.focus();}, - 100); - event.preventDefault(); -} - -function initEditorForm() { - var tabsContainer = $("editorTabs"); - var controller = new SOGoTabsController(); - controller.attachToTabsContainer(tabsContainer); - - displaynameChanged = ($("displayname").value.length > 0); - $("displayname").onkeydown = onDisplaynameKeyDown; - $("sn").onkeyup = onDisplaynameNewValue; - $("givenname").onkeyup = onDisplaynameNewValue; - - $("cancelButton").observe("click", onEditorCancelClick); - var submitButton = $("submitButton"); - if (submitButton) { - submitButton.observe("click", onEditorSubmitClick); - } - - Event.observe(document, "keydown", onDocumentKeydown); - - if (typeof(gCategories) != "undefined") { - regenerateCategoriesMenu(); - } - var catsInput = $("jsonContactCategories"); - if (catsInput && catsInput.value.length > 0) { - var contactCats = $(catsInput.value.evalJSON(false)); - for (var i = 0; i < contactCats.length; i++) { - appendCategoryInput(contactCats[i]); - } - } - - var emptyCategory = $("emptyCategory"); - if (emptyCategory) { - emptyCategory.tabIndex = 10000; - emptyCategory.observe("click", onEmptyCategoryClick); - } - - initTimeWidget($("birthdayDate")); -} - -document.observe("dom:loaded", initEditorForm); diff --git a/UI/WebServerResources/UIxContactsUserFolders.css b/UI/WebServerResources/UIxContactsUserFolders.css deleted file mode 100644 index 020984321..000000000 --- a/UI/WebServerResources/UIxContactsUserFolders.css +++ /dev/null @@ -1,49 +0,0 @@ -DIV.filterPanel -{ position: absolute; - text-align: center; - width: auto; - top: 0; - left: 0; - padding: 3px 1em 0; } - -SPAN.searchBox -{ float: none !important; } - -IMG#progressIndicator -{ float: none; - position: absolute; - right: 1em; - margin: 7px 5px; }} - -INPUT[name="search"] -{ margin: 0px; } - -INPUT[name="search"].notfound -{ color: #f00 !important; } - - -DIV#folders -{ position: absolute; - left: 1em; - right: 1em; - top: 3em; - bottom: 3em; - background-color: #CCDDEC; - padding: .5em; - padding-top: 0px; - overflow: auto; - border-top: 1px solid #909090; - border-left: 1px solid #909090; - border-bottom: 1px solid #FFFFFF; - border-right: 1px solid #FFFFFF; } - -DIV#folders DIV -{ width: auto; } - -DIV#buttons -{ position: absolute; - text-align: center; - height: 1.5em; - left: 1em; - right: 1em; - bottom: 1em; } diff --git a/UI/WebServerResources/UIxContactsUserFolders.js b/UI/WebServerResources/UIxContactsUserFolders.js deleted file mode 100644 index 37433ccaf..000000000 --- a/UI/WebServerResources/UIxContactsUserFolders.js +++ /dev/null @@ -1,270 +0,0 @@ -var d; - -function onSearchFormSubmit(filterPanel) { - var searchValue = filterPanel.down('[name="search"]'); - var encodedValue = encodeURI(searchValue.value); - - if (encodedValue.blank()) { - checkAjaxRequestsState(); - } - else { - var url = (UserFolderURL - + "usersSearch?search=" + encodedValue); - if (document.userFoldersRequest) { - document.userFoldersRequest.aborted = true; - document.userFoldersRequest.abort(); - } - if (encodedValue.trim().length > minimumSearchLength) { - startAnimation($("pageContent"), filterPanel); - document.userFoldersRequest - = triggerAjaxRequest(url, usersSearchCallback); - } - } - - return false; -} - -function usersSearchCallback(http) { - document.userFoldersRequest = null; - var div = $("folders"); - if (http.status == 200) { - var response = http.responseText.evalJSON(); - buildUsersTree(div, response); - } - else if (http.status == 404) - div.update(); -} - -function addUserLineToTree(tree, parent, line) { - // line[0] = uid - // line[1] = cn - // line[2] = email - // line[3] = 1 if it's a group - // line[4] = contact info - var icon = ResourcesURL + '/busy.gif'; - - var email = line[1] + " <" + line[2] + ">"; - if (line[4] && !line[4].empty()) - email += ", " + line[4].split("\n").join("; "); // extra contact info - var icon_card = 'abcard.png'; - var datatype = 'user'; - if (line[3]) { - icon_card = 'ablist.png'; - datatype = 'group'; - } - tree.add(parent, 0, email, 0, '#', line[0], datatype, - '', '', - ResourcesURL + '/' + icon_card, - ResourcesURL + '/' + icon_card); - if (window.opener.userFolderType != "user") { - tree.add(parent + 1, parent, _("Please wait..."), 0, '#', null, - null, '', '', icon, icon); - } -} - -function buildUsersTree(treeDiv, response) { - if (!treeDiv.clean) { - var oldD = $("d"); // the folders tree - if (oldD) { - oldD.remove(); - delete d; - } - treeDiv.clean = true; - $("addButton").addClassName("disabled"); - } - - d = new dTree("d"); - d.config.hideRoot = true; - d.icon.root = ResourcesURL + '/tbtv_account_17x17.gif'; - d.icon.folder = ResourcesURL + '/tbtv_leaf_corner_17x17.png'; - d.icon.folderOpen = ResourcesURL + '/tbtv_leaf_corner_17x17.png'; - d.icon.node = ResourcesURL + '/tbtv_leaf_corner_17x17.png'; - d.icon.line = ResourcesURL + '/tbtv_line_17x22.png'; - d.icon.join = ResourcesURL + '/tbtv_junction_17x22.png'; - d.icon.joinBottom = ResourcesURL + '/tbtv_corner_17x22.png'; - d.icon.plus = ResourcesURL + '/tbtv_plus_17x22.png'; - d.icon.plusBottom = ResourcesURL + '/tbtv_corner_plus_17x22.png'; - d.icon.minus = ResourcesURL + '/tbtv_minus_17x22.png'; - d.icon.minusBottom = ResourcesURL + '/tbtv_corner_minus_17x22.png'; - d.icon.nlPlus = ResourcesURL + '/tbtv_corner_plus_17x22.png'; - d.icon.nlMinus = ResourcesURL + '/tbtv_corner_minus_17x22.png'; - d.icon.empty = ResourcesURL + '/empty.gif'; - d.preload(); - d.add(0, -1, ''); - - var isUserDialog = (window.opener.userFolderType == "user"); - var multiplier = ((isUserDialog) ? 1 : 2); - - if (response.length > 0) { - for (var i = 0; i < response.length; i++) - addUserLineToTree(d, 1 + i * multiplier, response[i]); - treeDiv.appendChild(d.domObject ()); - treeDiv.clean = false; - for (var i = 0; i < response.length; i++) { - if (!isUserDialog) { - var toggle = $("tgd" + (1 + i * 2)); - toggle.on("click", onUserNodeToggle); - } - var sd = $("sd" + (1 + i * multiplier)); - sd.on("click", onTreeItemClick); - } - } - else { - $$('[name="search"]').first().addClassName("notfound"); - } -} - -function onUserNodeToggle(event) { - this.stopObserving("click", onUserNodeToggle); - - var person = this.parentNode.getAttribute("dataname").unescapeHTML(); - - var url = (UserFolderURLForUser(person) + "foldersSearch" - + "?type=" + window.opener.userFolderType); - var nodeId = this.getAttribute("id").substr(3); - triggerAjaxRequest(url, foldersSearchCallback, - { nodeId: nodeId, user: person }); -} - -function onTreeItemClick(event) { - preventDefault(event); - - var topNode = $("d"); - if (topNode.selectedEntry) - topNode.selectedEntry.deselect(); - this.selectElement(); - topNode.selectedEntry = this; - - if (window.opener.userFolderType == "user") - $("addButton").removeClassName("disabled"); - else { - var dataname = this.parentNode.getAttribute("dataname"); - if (!dataname) - dataname = ""; - if (dataname.indexOf(":") == -1) - $("addButton").addClassName("disabled"); - else - $("addButton").removeClassName("disabled"); - }; -} - -function foldersSearchCallback(http) { - if (http.status == 200) { - var response = http.responseText; - var nodeId = parseInt(http.callbackData["nodeId"]); - - var dd = $("dd" + (nodeId + 2)); - var indentValue = (dd ? 1 : 0); - d.aIndent.push(indentValue); - - var dd = $("dd" + nodeId); - var folders = response.evalJSON(); - if (folders.length) { - var user = http.callbackData["user"]; - - dd.innerHTML = ''; - for (var i = 0; i < folders.length-1; i++) - dd.appendChild(addFolderBranchToTree(d, user, folders[i], nodeId, i+1, false)); - dd.appendChild(addFolderBranchToTree(d, user, folders[folders.length-1], nodeId, - folders.length, true)); - //dd.update(str); - for (var i = 0; i < folders.length; i++) { - var sd = $("sd" + (nodeId + i + 1)); - sd.on("click", onTreeItemClick); - } - } - else { - dd.innerHTML = ''; - dd.appendChild(addFolderNotFoundNode(d, nodeId, null)); - var sd = $("sd" + (nodeId + 1)); - sd.on("click", onTreeItemClick); - } - - d.aIndent.pop(); - } -} - -function addFolderBranchToTree(tree, user, folder, nodeId, subId, isLast) { - var icon = ResourcesURL + '/'; - if (folder.type == 'Contact') - icon += 'tb-mail-addressbook-flat-16x16.png'; - else - icon += 'calendar-folder-16x16.png'; - var folderId = user + ":" + folder.name.substr(1); - - // We sanitize the value to avoid XSS issues - var name = folder.displayName.escapeHTML(); - var node = new dTreeNode(subId, nodeId, name, 0, '#', folderId, - folder.type + '-folder', '', '', icon, icon); - node._ls = isLast; - - var content = tree.node(node, (nodeId + subId), null); - content.displayName = folder.displayName; - - return content; -} - -function addFolderNotFoundNode(tree, nodeId) { - var icon = ResourcesURL + '/dot.png'; - var node = new dTreeNode(1, nodeId, _("No possible subscription"), 0, '#', - null, null, '', '', icon, icon); - node._ls = true; - return tree.node(node, (nodeId + 1)); -} - -function onConfirmFolderSelection(event) { - if (!this.hasClassName("disabled")) { - var topNode = $("d"); - if (topNode && topNode.selectedEntry) { - var node = topNode.selectedEntry.parentNode; - var folder = node.getAttribute("dataname"); - var type = node.getAttribute("datatype"); - var folderName; - if (window.opener.userFolderType == "user") { - var resource = $(topNode.selectedEntry).down("SPAN.nodeName"); - var description = (resource.innerHTML - .replace("<", "<", "g") - .replace(">", ">", "g")); - folderName = description.replace(/>,.*$/, ">", "g"); - } - else { - folderName = node.displayName; - } - var data = { folderName: folderName, folder: folder, type: type, window: window }; - if (parent$(accessToSubscribedFolder(folder))) - window.alert(_("You have already subscribed to that folder!")); - else - window.opener.subscribeToFolder(window.opener.userFolderCallback, data); - this.blur(); // required by IE - } - } -} - -function onFolderSearchKeyDown(event) { - if (event.keyCode == Event.KEY_BACKSPACE - || IsCharacterKey(event.keyCode)) { - $(this).removeClassName("notfound"); - var div = $("folders"); - if (!div.clean) { - var oldD = $("d"); // the folders tree - if (oldD) { - oldD.remove(); - delete d; - } - div.clean = true; - $("addButton").addClassName("disabled"); - } - } -} - -function initUserFoldersWindow() { - var searchValue = $$('[name="search"]').first(); - searchValue.on("keydown", onFolderSearchKeyDown); - - $("addButton").on("click", onConfirmFolderSelection); - $("doneButton").on("click", onCloseButtonClick); - - searchValue.focus(); -} - -document.observe("dom:loaded", initUserFoldersWindow); diff --git a/UI/WebServerResources/UIxContactsUserRightsEditor.css b/UI/WebServerResources/UIxContactsUserRightsEditor.css deleted file mode 100644 index 781edc7ca..000000000 --- a/UI/WebServerResources/UIxContactsUserRightsEditor.css +++ /dev/null @@ -1,39 +0,0 @@ -DIV.title -{ color: #000; - vertical-align: bottom; - padding-top: 8px; - padding-left: 1em; - padding: 5px; - background-color: #fff; - border-bottom: 1px solid #555; } - -DIV.calendarUserRights, -DIV.basicUserRights -{ margin: 1em;} - -DIV.title SPAN -{ float: left; - line-height: 14px; - text-align: right; - width: 120px; } - -DIV.title SPAN.value -{ float: none; - margin-left: 1em; - font-size: 14px; - font-weight: bold; } - -DIV.title LABEL -{ display: block; - clear: both; } - -DIV.buttons -{ text-align: right; - margin: 1em; } - -DIV.dialog.none -{ position: absolute; - top: 0px; - left: 0px; - right: 0px; - margin: 10px auto; } \ No newline at end of file diff --git a/UI/WebServerResources/UIxContactsUserRightsEditor.js b/UI/WebServerResources/UIxContactsUserRightsEditor.js deleted file mode 100644 index e075c7107..000000000 --- a/UI/WebServerResources/UIxContactsUserRightsEditor.js +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -function onUpdateACL(event) { - var uid = $('uid').value; - if (uid == '' || uid == 'anonymous') { - var inputs = $$('#userRightsForm input[type="checkbox"]'); - var enabled = false; - for (var i = 0; i < inputs.length; i++) { - if (inputs[i].checked) { - enabled = true; - break; - } - } - if (enabled) { - if (uid == '') - showConfirmDialog(_("Warning"), - _("Any user with an account on this system will be able to access your address book \"%{0}\". Are you certain you trust them all?").formatted($("folderName").allTextContent()), - onUpdateACLConfirm, onUpdateACLCancel, - "Give Access", "Keep Private"); - else - showConfirmDialog(_("Warning"), - _("Potentially anyone on the Internet will be able to access your address book \"%{0}\", even if they do not have an account on this system. Is this information suitable for the public Internet?").formatted($("folderName").allTextContent()), - onUpdateACLConfirm, onUpdateACLCancel, - "Give Access", "Keep Private"); - return false; - } - } - - return onUpdateACLConfirm(event); -} - -function onUpdateACLConfirm(event) { - disposeDialog(); - - $('userRightsForm').submit(); - Event.stop(event); - - return false; -} - -function onUpdateACLCancel(event) { - var inputs = $$('#userRightsForm input[type="checkbox"]'); - for (var i = 0; i < inputs.length; i++) - if (inputs[i].checked) - inputs[i].checked = false; - - disposeDialog(); -} - -function onCancelACL(event) { - window.close(); -} - -function initACLButtons() { - $("updateButton").observe("click", onUpdateACL); - $("cancelButton").observe("click", onCancelACL); -} - -document.observe("dom:loaded", initACLButtons); diff --git a/UI/WebServerResources/UIxFilterEditor.css b/UI/WebServerResources/UIxFilterEditor.css deleted file mode 100644 index 8567472c3..000000000 --- a/UI/WebServerResources/UIxFilterEditor.css +++ /dev/null @@ -1,106 +0,0 @@ -DIV#pageContent -{ padding: 10px; - padding-top: 15px; } - -#splitter -{ cursor: n-resize; - top: 230px; - left: 0px; - right: 0px; - height: 5px; } - -LABEL -{ margin: 0px; - padding: 0px; } - -#pageContent INPUT, -#pageContent SELECT -{ background-color: #ccddec; - padding: 1px; - margin: 1px; - border-width: 1px; } - -#pageContent INPUT -{ padding-left: 2px; } - -DIV.container -{ margin-bottom: 14px; } - -DIV#filterRulesContainer, -DIV#filterActionsContainer -{ position: absolute; - margin: 0px; - border: 0px; - padding: 0px; - left: 10px; - right: 10px; } - -DIV#filterRulesContainer -{ top: 128px; - height: 102px; } - -DIV#filterActionsContainer -{ top: 235px; - bottom: 0px; } - -DIV#filterRules, DIV#filterActions -{ position: absolute; - cursor: default; - left: 0px; - right: 0px; - bottom: 21px; - border-top: 1px solid #909090; - border-left: 1px solid #909090; - border-bottom: 1px solid #ffffff; - border-right: 1px solid #ffffff; - background: #ccddec; - overflow: hidden; - overflow-y: auto; } - -DIV#filterRules -{ top: 0px; } - -DIV#filterActions -{ top: 20px; } - -DIV.bottomToolbar -{ position: absolute; - left: 0px; - right: 0px; - margin: 0px; - padding: 0px; - bottom: 0px; } - -DIV.rule, -DIV.action -{ overflow: hidden; - padding-left: 2px; - padding-right: 2px; - width: 100%; - border-bottom: 1px solid #9b9b9b; } - -DIV.rule._selected, -DIV.action._selected -{ background-color: #9abcd8; - color: #fff; } - -SPAN.fieldContainer -{ width: 100px; } - -SPAN.operatorContainer -{ width: 300px; } - -SPAN.valueContainer INPUT -{ width: 160px; } - -SPAN.redirectArgument INPUT -{ width: 160px; } - -SPAN.fileintoArgument SELECT -{ max-width: 250px; } - -SPAN.rejectArgument TEXTAREA -{ height: 54px; - width: 90%; - margin-left: 5%; - padding-right: -50px; } diff --git a/UI/WebServerResources/UIxFilterEditor.js b/UI/WebServerResources/UIxFilterEditor.js deleted file mode 100644 index ac109a368..000000000 --- a/UI/WebServerResources/UIxFilterEditor.js +++ /dev/null @@ -1,802 +0,0 @@ -/* -*- Mode: java; tab-width: 2; c-label-minimum-indentation: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* Cyrus: comparator-i;ascii-numeric fileinto reject vacation imapflags - notify envelope relational regex subaddress copy */ -var sieveCapabilities = []; - -var filter; - -var selectedRuleDiv = null; -var selectedActionDiv = null; - -var fieldLabels; -var methodLabels; -var operatorLabels; -var operatorRequirements; -var methodRequirements; -var flagLabels; - -var mailboxes = []; - -function onLoadHandler() { - setupConstants(); - setupEventHandlers(); - - if (window.opener) - sieveCapabilities = window.opener.getSieveCapabilitiesFromEditor(); - if (!window.opener || filterId == "new") { - setupNewFilterData(); - } else { - filter = window.opener.getFilterFromEditor(filterId).evalJSON(); - } - - if (!window.opener || window.opener.userMailboxes) { - setupFilterViews(); - } else { - loadMailboxes(); - } -} - -function loadMailboxes() { - var url = ApplicationBaseURL + "/Mail/0/mailboxes"; - triggerAjaxRequest(url, onLoadMailboxesCallback); -} - -function onLoadMailboxesCallback(http) { - if (http.readyState == 4) { - // log("http.status: " + http.status); - if (http.status == 200) { - checkAjaxRequestsState(); - if (http.responseText.length > 0) { - var jsonResponse = http.responseText.evalJSON(true); - window.opener.setupMailboxesFromJSON(jsonResponse); - } - } - setupFilterViews(); - } -} - -function setupConstants() { - fieldLabels = { "subject": _("Subject"), - "from": _("From"), - "to": _("To"), - "cc": _("Cc"), - "to_or_cc": _("To or Cc"), - "size": _("Size (Kb)"), - "header": _("Header"), - "body": _("Body") }; - methodLabels = { "addflag": _("Flag the message with:"), - "discard": _("Discard the message"), - "fileinto": _("File the message in:"), - "keep": _("Keep the message"), - "redirect": _("Forward the message to:"), - "reject": _("Send a reject message:"), - "vacation": _("Send a vacation message"), - "stop": _("Stop processing filter rules") }; - - operatorLabels = { "under": _("is under"), - "over": _("is over"), - "is": _("is"), - "is_not": _("is not"), - "contains": _("contains"), - "contains_not": _("does not contain"), - "matches": _("matches"), - "matches_not": _("does not match"), - "regex": _("matches regex"), - "regex_not": _("does not match regex") }; - - flagLabels = { "seen": _("Seen"), - "deleted": _("Deleted"), - "answered": _("Answered"), - "flagged": _("Flagged"), - "junk": _("Junk"), - "not_junk": _("Not Junk") }; - - for (var name in mailTags) { - flagLabels[name] = _( mailTags[name][0] ); - } -} - -function setupEventHandlers() { - var filterName = $($("mainForm").filterName); - if (filterName) { - filterName.on('change', onFilterNameChange); - } - var matchTypeSelect = $("matchType"); - if (matchTypeSelect) { - matchTypeSelect.on('change', onMatchTypeChange); - } - - // Filter rules - $("filterRules").on('click', onFilterRulesDivClick); - var ruleAdd = $("ruleAdd"); - if (ruleAdd) { - ruleAdd.on('click', onRuleAddClick); - } - var ruleDelete = $("ruleDelete"); - if (ruleDelete) { - ruleDelete.on('click', onRuleDeleteClick); - } - - // Filter actions - $('filterActions').on('click', onFilterActionsDivClick); - var actionAdd = $("actionAdd"); - if (actionAdd) { - actionAdd.on('click', onActionAddClick); - } - var actionDelete = $("actionDelete"); - if (actionDelete) { - actionDelete.on('click', onActionDeleteClick); - } -} - -function onFilterNameChange(event) { - filter.name = this.value; -} - -function onMatchTypeChange() { - var matchType = this.value; - filter.match = matchType; - var container = $("filterRulesContainer"); - var otherContainer = $("filterActionsContainer"); - var otherContainerTop; - if (matchType == "allmessages") { - container.hide(); - otherContainerTop = 130; - } else { - container.show(); - otherContainerTop = 240; - } - otherContainer.setStyle({ top: otherContainerTop + "px" }); -} - -function onFilterRulesDivClick(event) { - setSelectedRuleDiv(null); - Event.stop(event); -} - -function onFilterActionsDivClick(event) { - setSelectedActionDiv(null); - Event.stop(event); -} - -function createFilterRule() { - return { field: "subject", operator: "contains", value: "" }; -} - -function createFilterAction() { - return { method: "fileinto", argument: "INBOX" }; -} - -function setupNewFilterData() { - var newFilterTemplate = $({ name: _("Untitled Filter"), - match: "any", - active: true }); - newFilterTemplate.rules = $([ createFilterRule() ]); - newFilterTemplate.actions = $([ createFilterAction() ]); - - filter = newFilterTemplate; -} - -function setupFilterViews() { - var filterName = $("mainForm").filterName; - if (filterName) { - filterName.value = filter.name; - if (filterId == "new") { - filterName.focus(); - $(filterName).selectText(0, filterName.value.length); - } - } - - var matchTypeSelect = $("matchType"); - if (matchTypeSelect) { - matchTypeSelect.value = filter.match; - } - if (filter.match != "allmessages") { - var filterRules = $("filterRules"); - if (filterRules && filter.rules) { - for (var i = 0; i < filter.rules.length; i++) { - appendRule(filterRules, filter.rules[i]); - } - } - } - onMatchTypeChange.apply(matchTypeSelect); - - var filterActions = $("filterActions"); - if (filterActions && filter.actions) { - for (var i = 0; i < filter.actions.length; i++) { - appendAction(filterActions, filter.actions[i]); - } - } -} - -function appendRule(container, rule) { - var ruleDiv = createElement("div", null, "rule", - { rule: rule }, null, - container); - ruleDiv.on('click', onRuleDivClick); - ensureRuleRepresentation(ruleDiv); - - return ruleDiv; -} - -function onRuleDivClick(event) { - setSelectedRuleDiv(this); - Event.stop(event); -} - -function setSelectedRuleDiv(newDiv) { - if (selectedRuleDiv) { - selectedRuleDiv.removeClassName("_selected"); - } - selectedRuleDiv = newDiv; - if (selectedRuleDiv) { - selectedRuleDiv.addClassName("_selected"); - } -} - -function ensureRuleRepresentation(container) { - ensureFieldRepresentation(container); - ensureOperatorRepresentation(container); - ensureValueRepresentation(container); -} - -function ensureFieldRepresentation(container) { - var fieldSpans = container.select("SPAN.fieldContainer"); - var fieldSpan; - if (fieldSpans.length) - fieldSpan = fieldSpans[0]; - else { - while (container.firstChild) { - container.removeChild(container.firstChild); - } - fieldSpan = createElement("span", null, "fieldContainer", - null, null, container); - } - ensureFieldSelectRepresentation(container, fieldSpan); - ensureFieldCustomHeaderRepresentation(container, fieldSpan); -} - -function ensureFieldSelectRepresentation(container, fieldSpan) { - var fields = [ "subject", "from", "to", "cc", "to_or_cc", "size", "header" ]; - if (sieveCapabilities.indexOf("body") > -1) { - fields.push("body"); - } - var selects = fieldSpan.select("SELECT"); - var select; - if (selects.length) - select = selects[0]; - else { - select = createElement("select"); - select.rule = container.rule; - select.on('change', onFieldSelectChange); - for (var i = 0; i < fields.length; i++) { - var field = fields[i]; - var fieldOption = createElement("option", null, null, - { value: field }, null, select); - fieldOption.appendChild(document.createTextNode(fieldLabels[field])); - } - fieldSpan.appendChild(select); - } - select.value = container.rule.field; - container.rule.field = select.value; -} - -function onFieldSelectChange(event) { - this.rule.field = this.value; - var fieldSpan = this.parentNode; - var container = fieldSpan.parentNode; - ensureFieldCustomHeaderRepresentation(container, fieldSpan); - ensureOperatorRepresentation(container); - ensureValueRepresentation(container); -} - -function ensureFieldCustomHeaderRepresentation(container, fieldSpan) { - var headerInputs = fieldSpan.select("INPUT"); - var headerInput = null; - if (headerInputs.length) { - headerInput = headerInputs[0]; - } - if (container.rule.field == "header") { - if (!headerInput) { - headerInput = createElement("input", null, null, - { type: "text" }, null, fieldSpan); - headerInput.rule = container.rule; - if (!container.rule.custom_header) - container.rule.custom_header = ""; - headerInput.value = container.rule.custom_header; - headerInput.on('change', onFieldCustomHeaderChange); - headerInput.focus(); - } - } else { - if (headerInput) { - if (container.rule.custom_header) - container.rule.custom_header = null; - fieldSpan.removeChild(headerInput); - } - } -} - -function onFieldCustomHeaderChange(event) { - this.rule.custom_header = this.value; -} - -function ensureOperatorRepresentation(container) { - var operatorSpans = container.select("SPAN.operatorContainer"); - var operatorSpan; - if (operatorSpans.length) - operatorSpan = operatorSpans[0]; - else - operatorSpan = createElement("span", null, "operatorContainer", - null, null, container); - ensureOperatorSelectRepresentation(container, operatorSpan); -} - -function ensureOperatorSelectRepresentation(container, operatorSpan) { - var operators = determineOperators(container.rule.field); - - var ruleField = container.rule.field; - var selects = operatorSpan.select("SELECT"); - var select = null; - if (selects.length) { - select = selects[0]; - if ((ruleField == "size" && !select.sizeOperator) - || (ruleField != "size" && select.sizeOperator)) { - operatorSpan.removeChild(select); - select = null; - } - } - if (!select) { - select = createElement("select"); - select.rule = container.rule; - select.sizeOperator = (ruleField == "size"); - select.on('change', onOperatorSelectChange); - for (var i = 0; i < operators.length; i++) { - var operator = operators[i]; - var operatorOption = createElement("option", null, null, - { value: operator }, null, - select); - operatorOption.appendChild(document.createTextNode(operatorLabels[operator])); - } - operatorSpan.appendChild(select); - } - if (container.rule.operator - && operators.indexOf(container.rule.operator) == -1) { - container.rule.operator = operators[0]; - } - select.value = container.rule.operator; - container.rule.operator = select.value; -} - -function onOperatorSelectChange(event) { - this.rule.operator = this.value; - var valueSpans = this.parentNode.parentNode.select("SPAN.valueContainer"); - if (valueSpans.length) { - var valueInputs = valueSpans[0].select("INPUT"); - if (valueInputs.length) { - valueInputs[0].focus(); - } - } -} - -function determineOperators(field) { - var operators; - if (field == "size") { - operators = [ "under", "over" ]; - } else { - var baseOperators = [ "is", "contains", "matches" ]; - if (sieveCapabilities.indexOf("regex") > -1) { - baseOperators.push("regex"); - } - operators = []; - for (var i = 0; i < baseOperators.length; i++) { - operators.push(baseOperators[i]); - operators.push(baseOperators[i] + "_not"); - } - } - - return operators; -} - -function ensureValueRepresentation(container) { - var valueSpans = container.select("SPAN.valueContainer"); - var valueSpan; - if (valueSpans.length) - valueSpan = valueSpans[0]; - else - valueSpan = createElement("span", null, "valueContainer", - null, null, container); - ensureValueInputRepresentation(container, valueSpan); -} - -function ensureValueInputRepresentation(container, valueSpan) { - var inputs = valueSpan.select("INPUT"); - var input; - if (inputs.length) { - input = inputs[0]; - } - else { - input = createElement("input", null, "textField"); - input.rule = container.rule; - input.on('change', onValueInputChange); - valueSpan.appendChild(input); - } - input.value = container.rule.value; - ensureFieldValidity(input); -} - -function ensureFieldValidity(input) { - var valid = ensureFieldIsNotEmpty(input); - if (valid && input.rule.field == "size") { - valid = ensureFieldIsNumerical(input); - } - - return valid; -} - -function onValueInputChange(event) { - if (ensureFieldValidity(this)) - this.rule.value = this.value; - else - this.rule.value = ""; -} - -function ensureFieldIsNumerical(input) { - var valid = !isNaN(input.value); - if (valid) { - input.removeClassName("_invalid"); - } else { - input.addClassName("_invalid"); - } - - return valid; -} - -function ensureFieldIsNotEmpty(input) { - var valid = !input.value.blank(); - if (valid) { - input.removeClassName("_invalid"); - } else { - input.addClassName("_invalid"); - } - - return valid; -} - -function appendAction(container, action) { - var actionDiv = createElement("div", null, "action", - { action: action }, null, - container); - actionDiv.on('click', onActionDivClick); - ensureActionRepresentation(actionDiv); - - return actionDiv; -} - -function onActionDivClick(event) { - setSelectedActionDiv(this); - Event.stop(event); -} - -function setSelectedActionDiv(newSpan) { - if (selectedActionDiv) { - selectedActionDiv.removeClassName("_selected"); - } - selectedActionDiv = newSpan; - if (selectedActionDiv) { - selectedActionDiv.addClassName("_selected"); - } -} - -function ensureActionRepresentation(container) { - ensureMethodRepresentation(container); - ensureArgumentRepresentation(container); -} - -function ensureMethodRepresentation(container) { - var methodSpans = container.select("SPAN.methodContainer"); - var methodSpan; - if (methodSpans.length) - methodSpan = methodSpans[0]; - else { - while (container.firstChild) { - container.removeChild(container.firstChild); - } - methodSpan = createElement("span", null, "methodContainer", - null, null, container); - } - ensureMethodSelectRepresentation(container, methodSpan); -} - -function ensureMethodSelectRepresentation(container, methodSpan) { - var methods = [ "redirect", "discard", "keep" ]; - if (sieveCapabilities.indexOf("reject") > -1) { - methods.push("reject"); - } - if (sieveCapabilities.indexOf("fileinto") > -1) { - methods.push("fileinto"); - } - if (sieveCapabilities.indexOf("imapflags") > -1 || sieveCapabilities.indexOf("imap4flags") > -1) { - methods.push("addflag"); - } - methods.push("stop"); - /* TODO: those are currently unimplemented */ - // if (sieveCapabilities.indexOf("notify") > -1) { - // methods.push("notify"); - // } - // if (sieveCapabilities.indexOf("vacation") > -1) { - // methods.push("vacation"); - // } - - var selects = methodSpan.select("SELECT"); - var select; - if (selects.length) - select = selects[0]; - else { - select = createElement("select"); - select.action = container.action; - select.on('change', onMethodSelectChange); - for (var i = 0; i < methods.length; i++) { - var method = methods[i]; - var methodOption = createElement("option", null, null, - { value: method }, null, select); - methodOption.appendChild(document.createTextNode(methodLabels[method])); - } - methodSpan.appendChild(select); - } - select.value = container.action.method; -} - -function onMethodSelectChange(event) { - this.action.method = this.value; - var methodSpan = this.parentNode; - var container = methodSpan.parentNode; - ensureArgumentRepresentation(container); -} - -function ensureArgumentRepresentation(container) { - var argumentWidgetMethods - = { "addflag": ensureFlagArgRepresentation, - "fileinto": ensureMailboxArgRepresentation, - "redirect": ensureRedirectArgRepresentation, - "reject": ensureRejectArgRepresentation, - "vacation": ensureVacationArgRepresentation }; - - var widgetMethod = argumentWidgetMethods[container.action.method]; - var spanClass = container.action.method + "Argument"; - - var argumentSpans = container.select("SPAN.argumentContainer"); - var argumentSpan; - if (argumentSpans.length) { - argumentSpan = argumentSpans[0]; - if (argumentSpan - && (!widgetMethod || !argumentSpan.hasClassName(spanClass))) { - container.removeChild(argumentSpan); - container.action.argument = null; - argumentSpan = null; - } - } - else - argumentSpan = null; - - if (!argumentSpan && widgetMethod) { - argumentSpan = createElement("span", null, - ["argumentContainer", spanClass], - null, null, container); - widgetMethod(container, argumentSpan); - } -} - -function ensureFlagArgRepresentation(container, argumentSpan) { - var selects = argumentSpan.select("SELECT"); - var select; - if (selects.length) - select = selects[0]; - else { - select = createElement("select"); - select.action = container.action; - select.on('change', onFlagArgumentSelectChange); - for (var flag in flagLabels) { - if (typeof flag != 'undefined') { - var flagOption = createElement("option", null, null, - { value: flag }, null, select); - var label = flagLabels[flag]; - flagOption.appendChild(document.createTextNode(label)); - } - } - argumentSpan.appendChild(select); - } - /* 1) initialize the value if null - 2) set the SELECT to the corresponding value - 3) if value was not null in 1, we must ensure the SELECT contains it */ - if (!container.action.argument) - container.action.argument = "seen"; - select.value = container.action.argument; - container.action.argument = select.value; -} - -function onFlagArgumentSelectChange(event) { - this.action.argument = this.value; -} - -function ensureMailboxArgRepresentation(container, argumentSpan) { - var selects = argumentSpan.select("SELECT"); - var select; - if (selects.length) - select = selects[0]; - else { - select = createElement("select"); - select.action = container.action; - if (!container.action.argument) - container.action.argument = "INBOX"; - select.on('change', onMailboxArgumentSelectChange); - var mailboxes = (window.opener - ? window.opener.userMailboxes - : {'displayName': 'INBOX', 'path': 'INBOX' }); - for (var i = 0; i < mailboxes.length; i++) { - var mailbox = mailboxes[i]; - var folderValue; - ((sieveFolderEncoding == "UTF-8") ? folderValue = mailbox.displayName - : folderValue = mailbox.path); - - var mboxOption = createElement("option", null, null, - { value: folderValue }, null, select); - mboxOption.appendChild(document.createTextNode(mailbox.displayName)); - } - argumentSpan.appendChild(select); - } - select.value = container.action.argument; - container.action.argument = select.value; -} - -function onMailboxArgumentSelectChange(event) { - this.action.argument = this.value; -} - -function ensureRedirectArgRepresentation(container, argumentSpan) { - var emailInputs = argumentSpan.select("INPUT"); - var emailInput = null; - if (emailInputs.length) { - emailInput = emailInputs[0]; - } - if (!emailInput) { - emailInput = createElement("input", null, "textField", - { type: "text" }, null, argumentSpan); - emailInput.action = container.action; - if (!container.action.argument) - container.action.argument = ""; - emailInput.on('change', onEmailArgumentChange); - emailInput.focus(); - } - emailInput.value = container.action.argument; -} - -function onEmailArgumentChange(event) { - this.action.argument = this.value; -} - -function ensureRejectArgRepresentation(container, argumentSpan) { - var msgAreas = argumentSpan.select("TEXTAREA"); - var msgArea = null; - if (msgAreas.length) { - msgArea = msgAreas[0]; - } - if (!msgArea) { - msgArea = createElement("textarea", null, null, - { action: container.action }, null, - argumentSpan); - if (!container.action.argument) - container.action.argument = ""; - msgArea.on('change', onMsgArgumentChange); - msgArea.focus(); - } - msgArea.value = container.action.argument; -} - -function onMsgArgumentChange(event) { - this.action.argument = this.value; -} - -function ensureVacationArgRepresentation(container, argumentSpan) { - -} - -function onRuleAddClick(event) { - var filterRules = $("filterRules"); - if (filterRules) { - var newRule = createFilterRule(); - if (!filter.rules) - filter.rules = []; - filter.rules.push(newRule); - var newRuleDiv = appendRule(filterRules, newRule); - setSelectedRuleDiv(newRuleDiv); - filterRules.scrollTop = newRuleDiv.offsetTop; - } - Event.stop(event); -} - -function onRuleDeleteClick(event) { - if (selectedRuleDiv) { - var ruleIndex = filter.rules.indexOf(selectedRuleDiv.rule); - filter.rules.splice(ruleIndex, 1); - var nextSelected = selectedRuleDiv.next(); - if (!nextSelected) - nextSelected = selectedRuleDiv.previous(); - selectedRuleDiv.parentNode.removeChild(selectedRuleDiv); - setSelectedRuleDiv(nextSelected); - } - - Event.stop(event); -} - -function onActionAddClick(event) { - var filterActions = $("filterActions"); - if (filterActions) { - var newAction = createFilterAction(); - filter.actions.push(newAction); - var newActionDiv = appendAction(filterActions, newAction); - setSelectedActionDiv(newActionDiv); - filterActions.scrollTop = newActionDiv.offsetTop; - } - Event.stop(event); -} - -function onActionDeleteClick(event) { - if (selectedActionDiv) { - var actionIndex = filter.actions.indexOf(selectedActionDiv.action); - filter.actions.splice(actionIndex, 1); - var nextSelected = selectedActionDiv.next(); - if (!nextSelected) - nextSelected = selectedActionDiv.previous(); - selectedActionDiv.parentNode.removeChild(selectedActionDiv); - setSelectedActionDiv(nextSelected); - } - - Event.stop(event); -} - -function savePreferences(event) { - var valid = true; - - var container = $('filterRulesContainer'); - if (container.visible()) { - var rules = container.select("DIV#filterRules DIV.rule"); - if (rules.length == 0) { - onRuleAddClick(event); - valid = false; - } - else { - var inputs = $$("DIV#filterRules input"); - inputs.each(function(input) { - if (input.hasClassName("_invalid")) - valid = false; - }); - } - } - - var actions = $$("DIV#filterActions DIV.action"); - if (actions.length == 0) { - onActionAddClick(event); - valid = false; - } - - if (valid) { - if (window.opener) { - window.opener.updateFilterFromEditor(filterId, Object.toJSON(filter)); - } - window.close(); - } - - return false; -} - -// function configureDragHandles() { -// var handle = $("splitter"); -// if (handle) { -// handle.addInterface(SOGoDragHandlesInterface); -// handle.upperBlock = $("filterRulesContainer"); -// handle.lowerBlock = $("filterActionsContainer"); -// } -// } - -document.observe("dom:loaded", onLoadHandler); diff --git a/UI/WebServerResources/UIxListEditor.css b/UI/WebServerResources/UIxListEditor.css deleted file mode 100644 index dd7ecfb19..000000000 --- a/UI/WebServerResources/UIxListEditor.css +++ /dev/null @@ -1,90 +0,0 @@ -TABLE.details -{ float: right; - margin-right: 14px; - text-align: right; } - -TABLE.details TD -{ padding: 0; } - -TABLE#referenceList -{ width: 100%; } - -TABLE#referenceList THEAD TD -{ padding-right: 2px; } - -TABLE#referenceList TBODY TD TR -{ background: #CCDDEC; - text-align: left;} - -TD.referenceListCell -{ padding-left: 2em; - background: #CCDDEC; - text-align: left;} - -DIV#referenceListWrapper -{ background: #CCDDEC; - overflow: auto; - position: relative; - right: 0; - top: 0; - left: 0; - height: 300px; - border-left: 1px solid #9B9B9B; - margin: 2px; } - -DIV#referenceListWrapper TR, -TR.referenceListRow -{ background: #CCDDEC; - line-height: 2em; } - -TD.referenceListCell, -TD.editing -{ background-repeat: no-repeat; - background-position: 4px 50%; - background-image: url('abcard.png'); - text-align: left; - -moz-user-select: none; } - -TD.referenceListCell SPAN, -TD.editing INPUT -{ margin-left: 24px; } - -TD.editing INPUT, -TABLE#referenceList TD INPUT -{ width: 90%; } - -TR.notfound TD.referenceListCell -{ color: #f00 !important; } - -DIV#windowButtons -{ position: fixed; - top: auto; - bottom: 5em; - left: 0px; - right: 25px; - height: 3.5em; - line-height: 2em; - vertical-align: middle; - text-align: right; } - -INPUT.textField -{ width: 100%; } - -DIV#buttons -{ position: fixed; - top: auto; - bottom: 0px; - left: 0px; - right: 25px; - height: 3.5em; - line-height: 2em; - color: #535D6D; - vertical-align: middle; - text-align: right; } - -TD -{ color: #535D6D; } - -DIV#listEditor -{ padding: 5px; } - diff --git a/UI/WebServerResources/UIxListEditor.js b/UI/WebServerResources/UIxListEditor.js deleted file mode 100644 index 0ab846349..000000000 --- a/UI/WebServerResources/UIxListEditor.js +++ /dev/null @@ -1,172 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -function validateListEditor () { - return serializeReferences(); -} - -function makeEditable (element) { - element.addClassName("editing"); - element.removeClassName("referenceListCell"); - - var span = element.down("SPAN"); - span.update(); - - var textField = element.down("INPUT"); - textField.show(); - textField.focus(); - textField.select(); - - return true; -} - -function endEditable(event, textField) { - if (!textField) - textField = this; - - var uid = textField.readAttribute("uid"); - var cell = textField.up("TD"); - var textSpan = cell.down("SPAN"); - - cell.removeClassName("editing"); - cell.addClassName("referenceListCell"); - textField.hide(); - - var tmp = textField.value; - tmp = tmp.replace (//, ">"); - if (!uid) - cell.up("TR").addClassName("notfound"); - if (tmp) - textSpan.update(tmp); - else - cell.up("TR").remove(); - - if (event) - Event.stop(event); - - return false; -} - -function endAllEditables (e) { - var r = $$("TABLE#referenceList TBODY TR TD"); - for (var i = 0; i < r.length; i++) { - var element = $(r[i]); - if (r[i] != this && element.hasClassName("editing")) - endEditable(null, element.down("INPUT")); - } -} - -function onNameEdit (e) { - endAllEditables(); - if (!this.hasClassName("editing")) { - makeEditable (this); - } -} - -function onReferenceAdd (e) { - var tablebody = $("referenceList").tBodies[0]; - var row = new Element("tr"); - var td = new Element("td"); - var textField = new Element("input"); - var span = new Element("span"); - - row.addClassName ("referenceListRow"); - row.observe("mousedown", onRowClick); - td.addClassName ("referenceListCell"); - td.observe("mousedown", endAllEditables); - td.observe("dblclick", onNameEdit); - textField.addInterface(SOGoAutoCompletionInterface); - textField.addressBook = activeAddressBook; - textField.excludeLists = true; - textField.observe("autocompletion:changed", endEditable); - textField.addClassName("textField"); - - td.appendChild(textField); - td.appendChild(span); - row.appendChild (td); - tablebody.appendChild(row); - $(tablebody).deselectAll(); - row.selectElement(); - - makeEditable(td); -} - -function onReferenceDelete(e) { - var list = $('referenceList').down("TBODY");; - var rows = list.getSelectedNodes(); - var count = rows.length; - - for (var i = 0; i < count; i++) { - rows[i].remove(); - } - return false; -} - -function serializeReferences(e) { - var r = $$("TABLE#referenceList TBODY TR INPUT"); - var cards = new Array(); - for (var i = 0; i < r.length; i++) { - var uid = $(r[i]).readAttribute("uid"); - if (uid) - cards.push(uid); - else { - var addresses = r[i].value.split(/[,;]/); - for (var j = 0; j < addresses.length; j++) { - var mailto = addresses[j].strip(); - var email = extractEmailAddress(mailto); - var c_name = extractEmailName(mailto); - if (!email && !c_name) - c_name = mailto; - cards.push(email + '|' + c_name); - } - } - } - $("referencesValue").value = cards.join(","); - - return true; -} - -function resetTableActions() { - var r = $$("TABLE#referenceList TBODY TR"); - for (var i = 0; i < r.length; i++) { - var row = $(r[i]); - row.observe("mousedown", onRowClick); - var td = row.down("TD"); - td.observe("mousedown", endAllEditables); - td.observe("dblclick", onNameEdit); - var textField = td.down("INPUT"); - textField.addInterface(SOGoAutoCompletionInterface); - textField.addressBook = activeAddressBook; - textField.excludeLists = true; - textField.confirmedValue = textField.value; - textField.observe("autocompletion:changed", endEditable); - } -} - -function onEditorSubmitClick(event) { - if (validateListEditor()) - $("mainForm").submit(); -} - -function onDocumentKeydown(event) { - var target = Event.element(event); - if (target.tagName == "INPUT") { - if (event.keyCode == Event.KEY_RETURN && target.menu == null) { - onEditorSubmitClick(event); - Event.stop(event); - } - } -} - -function initListEditor() { - var table = $("referenceList"); - table.multiselect = true; - resetTableActions(); - $("referenceAdd").observe("click", onReferenceAdd); - $("referenceDelete").observe("click", onReferenceDelete); - $("cancelButton").observe("click", onCloseButtonClick); - $("submitButton").observe("click", onEditorSubmitClick); - - Event.observe(document, "keydown", onDocumentKeydown); -} - -document.observe("dom:loaded", initListEditor); diff --git a/UI/WebServerResources/UIxMailEditor.css b/UI/WebServerResources/UIxMailEditor.css deleted file mode 100644 index 6590507a3..000000000 --- a/UI/WebServerResources/UIxMailEditor.css +++ /dev/null @@ -1,274 +0,0 @@ -/* CSS for compose panel */ - -DIV#leftPanel -{ top: 52px; } - -DIV#rightPanel -{ top: 48px; - left: 0em; } - -DIV#hiddenDragHandle -{ cursor: e-resize; - border: 0px; - top: 52px; - left: 15em; - width: 5px; - bottom: 0; } - -div#compose_panel div table -{ padding: 2px; } - -TABLE#compose_table, TABLE#compose_table DIV -{ width: 100%; } - -TABLE#compose_label -{ text-align: right; } - -DIV#addressList -{ clear: left; - height: 8em; - overflow: auto; - overflow-y: auto; - overflow-x: hidden; -} - -DIV.addressList -{ margin: 5px; } - -TABLE#addressList -{ border-bottom: 1px solid #fff; - border-right: 1px solid #fff; - border-top: 1px solid #909090; - border-left: 1px solid #909090; - border-spacing: 0px; - margin: 0px; - padding: 0px; - width: 100%; } - -TABLE#addressList TD -{ background-color: #fff; - border: 0px; - border-bottom: 1px solid #C4C8FF; - margin: 0px; - padding: 1px; } - -TABLE#addressList TD.headerField -{ border-right: 1px solid #C4C8FF; - width: 120px; } - -TABLE#addressList TD.headerField SELECT -{ border: 1px solid #eee; } - -TABLE#addressList TD.headerInput -{ background-image: url('abcard.png'); - background-repeat: no-repeat; - background-position: 2px center; - padding-left: 24px; - padding-right: 4px; } - -TABLE#addressList TD.headerInput INPUT -{ background: #fff !important; - border: 0px; - margin: 0px; - padding: 0px; - width: 100%; } - -SPAN.headerField -{ line-height: 2.0em; - padding-left: 0.5em; } - -TABLE#addressList TR#lastRow SELECT -{ visibility: hidden; } - -DIV#subjectRow SPAN.headerField -{ float: left; } - -DIV#subjectRow INPUT -{ background: #fff; - margin-left: 2px; - padding: 0px 2px 0px 2px; } - -div#compose_internetmarker -{ padding: 8px; - text-align: center; - background-color: white; - border-color: red; - border-width: 2px; - border-style: solid; } - -div#headerArea -{ padding: 5px 0px; } - -div#headerArea div.addressList -{ max-height: 10em; - overflow: auto; - overflow-x: hidden; } - -input.currentAttachment -{ position: fixed; - top: 1em; - right: 1em; } - -input.attachment -{ position: absolute; - left: -1000px; } - -#dropZone -{ position: absolute; - background: #000 url('upload_document.png') no-repeat center center; - opacity: 0.6; - border: 4px dashed #fff; - left: 0px; - right: 0px; - top: 0px; - bottom: 0px; - z-index: 999; } - -#dropZone div -{ position: absolute; - color: #fff; - font-size: 18px; - height: 100px; - width: 300px; - margin: 60px 0 0 -150px; - left: 50%; - top: 50%; - text-align: center; -} - -#fileupload { - margin-top: 5px; - clear: both; -} - -.button.fileinput-button -{ display: inline-block; - float: none; } - -UL#attachments -{ cursor: default; - margin: 0px; - padding: 0px; - list-style-type: none; - list-style-image: none; - overflow: auto; - overflow-x: hidden; - -moz-user-select: none; - -khtml-user-select: none; } - -UL#attachments LI -{ float: left; } - -UL#attachments LI[data-filename] -{ white-space: nowrap; - line-height: 18px; - margin: 3px 6px; } - -UL#attachments LI[data-filename] SPAN -{ margin-left: 5px; } - -UL#attachments LI[data-filename] A, -UL#attachments LI[data-filename] SPAN -{ padding-left: 2px; - vertical-align: top; } - -UL#attachments LI IMG -{ vertical-align: top; } - -UL#attachments .icon-attachment -{ background: url('attachment.png') no-repeat top left; - display: inline-block; - width: 16px; - height: 16px; } -UL#attachments .progress0 .icon-attachment -{ background-position: 0px 0px; } -UL#attachments .progress1 .icon-attachment -{ background-position: -16px 0px; } -UL#attachments .progress2 .icon-attachment -{ background-position: -32px 0px; } -UL#attachments .progress3 .icon-attachment -{ background-position: -48px 0px; } -UL#attachments .progress4 .icon-attachment -{ background-position: -64px 0px; } -UL#attachments .progressDone .icon-attachment -{ background-position: -80px 0px; } -UL#attachments .progressDone .icon-attachment:hover -{ background-position: -96px 0px; - cursor: pointer; } - -#pageContent TEXTAREA -{ width: 99%; } - -TEXTAREA#text -{ background: #fff; } - -#cke_text -{ clear: both; } - -/* Contacts search pane */ - -DIV#contactsSearch -{ border-right: 1px solid #fff; - padding-top: 5px; - padding-bottom: 5px; - margin-left: 5px; } - -DIV#contactsSearch LABEL -{ display: block; - margin: 0 0 5px 0; } - -SELECT#contactFolder -{ margin-bottom: 5px; } - -INPUT[name="search"] -{ position: absolute; - top: 6.2em; - left: 5px; - right: 0px; /* doesn't work in FF */ - display: block; - width: auto; } - -DIV#contactsListContent -{ position: absolute; - top: 9em; - left: 0px; - right: 0px; - bottom: 110px; - margin: 0; - border-right: 1px solid #fff; - background-color: #fff; - overflow-y: auto; } - -TABLE#contactsList -{ width: 100%; } - -TABLE#contactsList TD, -TABLE#contactsList TH -{ overflow: hidden; - line-height: 16px; - height: 18px; - text-overflow: ellipsis; - white-space: nowrap; } - -TABLE#contactsList TD#nameHeader, -TABLE#contactsList TD#mailHeader -{ width: 50%; - max-width: 50%; } - -DIV.contactSelection -{ - z-index: 1; - background: inherit; - position: absolute; - bottom: 0em; - padding: 1em; - left: 0px; - right: 0px; - height: 90px; - text-align: right; - background: #E6E7E6; - border-top: 1px solid #fff; - border-left: 0px; - border-right: 0px; - border-bottom: 0px; -} diff --git a/UI/WebServerResources/UIxMailEditor.js b/UI/WebServerResources/UIxMailEditor.js deleted file mode 100644 index 60e10dfa9..000000000 --- a/UI/WebServerResources/UIxMailEditor.js +++ /dev/null @@ -1,758 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -var contactSelectorAction = 'mailer-contacts'; -var attachmentCount = 0; -var MailEditor = { - currentField: null, - selectedIndex: -1, - delay: 750, - delayedSearch: false, - signatureLength: 0, - textFirstFocus: true -}; - -var autoSaveTimer; - -function refreshDraftsFolder() { - if (window.opener && window.opener.getUnseenCountForFolder) { - var nodes = window.opener.$("mailboxTree").select("DIV[datatype=draft]"); - window.opener.getUnseenCountForFolder(nodes[0].readAttribute("dataname")); - } -} - -function onContactAdd(button) { - var div = $("contacts"); - if (div.visible()) { - div.hide(); - $("rightPanel").setStyle({ left: "0px" }); - $(button).removeClassName("active"); - } - else { - $("rightPanel").setStyle({ left: $("leftPanel").getStyle("width") }); - div.show(); - $(button).addClassName("active"); - } - - $("hiddenDragHandle").adjust(); - onWindowResize(null); -} - -function addContact(tag, fullContactName, contactId, contactName, contactEmail) { - if (!mailIsRecipient(contactEmail)) { - var neededOptionValue = 0; - if (tag == "cc") - neededOptionValue = 1; - else if (tag == "bcc") - neededOptionValue = 2; - - var stop = false; - var counter = 0; - var currentRow = $('row_' + counter); - while (currentRow && !stop) { - var currentValue = $(currentRow.childNodesWithTag("td")[1]).childNodesWithTag("input")[0].value; - if (currentValue == neededOptionValue) { - stop = true; - insertContact($("addr_" + counter), contactName, contactEmail); - } - counter++; - currentRow = $('row_' + counter); - } - - if (!stop) { - fancyAddRow(""); - var row = $("row_" + currentIndex); - var td = $(row.childNodesWithTag("td")[0]); - var select = $(td.childNodesWithTag("select")[0]); - select.value = neededOptionValue; - insertContact($("addr_" + currentIndex), contactName, contactEmail); - onWindowResize(null); - } - } -} - -function onContactFolderChange(event) { - initCriteria(); - openContactsFolder(this.value); -} - -function mailIsRecipient(mailto) { - var isRecipient = false; - - var counter = 0; - var currentRow = $('row_' + counter); - - var email = extractEmailAddress(mailto).toUpperCase(); - - while (currentRow && !isRecipient) { - var currentValue = $("addr_"+counter).value.toUpperCase(); - if (currentValue.indexOf(email) > -1) - isRecipient = true; - else - { - counter++; - currentRow = $('row_' + counter); - } - } - - return isRecipient; -} - -function insertContact(inputNode, contactName, contactEmail) { - var value = '' + inputNode.value; - - var newContact = contactName; - if (newContact.length > 0) - newContact += ' <' + contactEmail + '>'; - else - newContact = contactEmail; - - if (value.length > 0) - value += ", "; - value += newContact; - - inputNode.value = value; -} - -function updateWindowTitleFromSubject(event) { - if (this.value) { - document.title = this.value; - }else{ - document.title = '(' + _("Untitled") + ')'; - } -} - -/* mail editor */ - -function onValidate(onSuccess) { - if (document.pageform.action != "send") { - - if (!hasRecipients()) { - showAlertDialog(_("error_missingrecipients")); - } - else if (document.pageform.subject.value == "") { - showConfirmDialog(_("Warning"), _("error_missingsubject"), onValidateDone.bind(this, onSuccess), null, _("Send Anyway"), _("Cancel")); - } - else { - onValidateDone(onSuccess); - } - } -} - -function onValidateDone(onSuccess) { - // Create "blocking" div to avoid double-clicking on send button - var safetyNet = createElement("div", "javascriptSafetyNet"); - $('pageContent').insert({top: safetyNet}); - - if (!document.busyAnim) { - var toolbar = document.getElementById("toolbar"); - document.busyAnim = startAnimation(toolbar); - } - - var lastRow = $("lastRow"); - lastRow.down("select").name = "popup_last"; - - window.shouldPreserve = true; - - document.pageform.action = "send"; - - if (typeof onSuccess == 'function') - onSuccess(); - - disposeDialog(); - - return true; -} - -function onPostComplete(http) { - var response = http.responseText; - if (response && response.length > 0) { - var jsonResponse = response.evalJSON(); - if (jsonResponse["status"] == "success") { - var p; - if (window.frameElement && window.frameElement.id) - p = parent; - if (window.opener && window.opener.refreshMessage) - p = window.opener; - if (p && p.refreshMessage) - p.refreshMessage(jsonResponse["sourceFolder"], - jsonResponse["sourceMessageID"]); - - refreshDraftsFolder(); - onCloseButtonClick(); - } - else { - var message = jsonResponse["message"]; - document.pageform.action = ""; - var progressImage = $("progressIndicator"); - if (progressImage) { - progressImage.parentNode.removeChild(progressImage); - } - showAlertDialog(jsonResponse["message"]); - // Remove "blocking" div - onFinalLoadHandler(); // from generic.js - } - } - else { - onCloseButtonClick(); - } -} - -function clickedEditorSend() { - onValidate(function() { - if (CKEDITOR.instances.text) CKEDITOR.instances.text.updateElement(); - triggerAjaxRequest(document.pageform.action, - onPostComplete, - null, - Form.serialize(document.pageform), // excludes the file input - { "Content-type": "application/x-www-form-urlencoded" }); - }); - - return false; -} - -function formatBytes(bytes, si) { - var thresh = si ? 1000 : 1024; - if (bytes < thresh) return bytes + ' B'; - var units = si ? ['KiB','MiB','GiB'] : ['KB','MB','GB']; - var u = -1; - do { - bytes /= thresh; - ++u; - } while (bytes >= thresh); - return bytes.toFixed(1) + ' ' + units[u]; -} - -function createAttachment(file) { - var list = $('attachments'); - var attachment; - if (list.select('[data-filename="'+file.name+'"]').length == 0) { - // File is not already uploaded - var attachment = createElement('li', null, ['muted progress0'], null, { 'data-filename': file.name }, list); - attachment.appendChild(new Element('i', { 'class': 'icon-attachment' })); - var a = createElement('a', null, null, null, {'href': '#', 'target': '_new' }, attachment); - - a.appendChild(document.createTextNode(file.name)); - if (file.size) - attachment.appendChild(new Element('span', { 'class': 'muted' }).update('(' + formatBytes(file.size, true) + ')')); - } - - return attachment; -} - -function clickedEditorSave() { - var lastRow = $("lastRow"); - lastRow.down("select").name = "popup_last"; - - window.shouldPreserve = true; - document.pageform.action = "save"; - if (CKEDITOR.instances.text) CKEDITOR.instances.text.updateElement(); - - triggerAjaxRequest(document.pageform.action, function (http) { - if (http.readyState == 4) { - if (http.status == 200) { - refreshDraftsFolder(); - } - else { - var response = http.responseText.evalJSON(true); - showAlertDialog(_("Error while saving the draft:") + " " + response.textStatus); - } - } - }, - null, - Form.serialize(document.pageform), // excludes the file input - { "Content-type": "application/x-www-form-urlencoded" }); - - return false; -} - -/** - * On first focus of textarea, position the caret with respect to user's preferences - */ -function onTextFocus(event) { - if (MailEditor.textFirstFocus) { - var content = this.getValue(); - var replyPlacement = UserDefaults["SOGoMailReplyPlacement"]; - if (replyPlacement == "above" || !mailIsReply) { - // For forwards, place caret at top unconditionally - this.setCaretTo(0); - } - else { - var caretPosition = this.getValue().length - MailEditor.signatureLength; - caretPosition = adjustOffset(this, caretPosition); - if (hasSignature()) - caretPosition -= 2; - this.setCaretTo(caretPosition); - } - MailEditor.textFirstFocus = false; - } -} - -/** - * Change behavior of tab key in textarea (plain-text mail) - */ -function onTextKeyDown(event) { - if (event.keyCode == Event.KEY_TAB) { - if (event.shiftKey) { - // Shift-tab goes back to subject field - var subjectField = $$("div#subjectRow input").first(); - subjectField.focus(); - subjectField.selectText(0, subjectField.value.length); - preventDefault(event); - } - else { - if (!(event.shiftKey || event.metaKey || event.ctrlKey)) { - // Convert a tab to 4 spaces - if (typeof(this.selectionStart) != "undefined") { // Mozilla and Safari - var cursor = this.selectionStart; - var startText = ((cursor > 0) - ? this.value.substr(0, cursor) - : ""); - var endText = this.value.substr(cursor); - var newText = startText + " " + endText; - this.value = newText; - cursor += 4; - this.setSelectionRange(cursor, cursor); - } - else if (this.selectionRange) // IE - this.selectionRange.text = " "; - preventDefault(event); - } - } - } -} - -function onTextIEUpdateCursorPos(event) { - this.selectionRange = document.selection.createRange().duplicate(); -} - -function onHTMLFocus(event) { - if (MailEditor.textFirstFocus) { - var s = event.editor.getSelection(); - var selected_ranges = s.getRanges(); - var children = event.editor.document.getBody().getChildren(); - var node; - var caretAtTop = (UserDefaults["SOGoMailReplyPlacement"] == "above") - || !mailIsReply; // for forwards, place caret at top unconditionally - - if (caretAtTop) { - node = children.getItem(0); - } - else { - // Search for signature starting from bottom - node = children.getItem(children.count() - 1); - while (true) { - var x = node.getPrevious(); - if (x == null) { - break; - } - if (x.getText() == '--') { - node = x.getPrevious().getPrevious(); - break; - } - node = x; - } - } - - s.selectElement(node); - - // Place the caret - if (caretAtTop) - s.scrollIntoView(); // top - selected_ranges = s.getRanges(); - selected_ranges[0].collapse(true); - s.selectRanges(selected_ranges); - if (!caretAtTop) - s.scrollIntoView(); // bottom - - MailEditor.textFirstFocus = false; - } -} - -function initAddresses() { - var addressList = $("addressList"); - addressList.select("input.textField").each(function (input) { - if (!input.readAttribute("readonly")) { - input.addInterface(SOGoAutoCompletionInterface); - input.uidField = "c_name"; - input.on("focus", addressFieldGotFocus.bind(input)); - input.on("blur", addressFieldLostFocus.bind(input)); - input.on("autocompletion:changedlist", expandContactList); - input.on("autocompletion:changed", addressFieldChanged.bind(input)); - //input.onListAdded = expandContactList; - } - }); -} - -function initAutoSaveTimer() { - var autoSave = UserDefaults["SOGoMailAutoSave"]; - - if (autoSave) { - var interval; - - interval = parseInt(autoSave) * 60; - - autoSaveTimer = window.setInterval(onAutoSaveCallback, - interval * 1000); - } -} - -function onAutoSaveCallback(event) { - clickedEditorSave(); -} - - -/* Overwrite function of MailerUI.js */ -function configureDragHandle() { - var handle = $("hiddenDragHandle"); - if (handle) { - handle.addInterface(SOGoDragHandlesInterface); - handle.leftMargin = 135; // minimum width - handle.leftBlock = $("leftPanel"); - handle.rightBlock = $("rightPanel"); - handle.enableRightSafety(); - handle.observe("handle:dragged", onWindowResize); - } -} - -function configureAttachments() { - var list = $("attachments"); - - if (!list) return; - - list.on('click', 'a', function (event, element) { - // Don't follow links of attachments not yet uploaded - if (!element.up('li').hasClassName('progressDone')) { - Event.stop(event); - return false; - } - }); - - list.on('click', 'i.icon-attachment', function (event, element) { - // Delete attachment when clicking on small icon - var item = element.up('li'); - if (item.hasClassName('progressDone')) { - var filename = item.readAttribute('data-filename'); - var url = "" + window.location; - var parts = url.split("/"); - parts[parts.length-1] = "deleteAttachment?filename=" + encodeURIComponent(filename); - url = parts.join("/"); - triggerAjaxRequest(url, attachmentDeleteCallback, item); - } - }); - - var dropzone = jQuery('#dropZone'); - jQuery('#fileUpload').fileupload({ - // With singleFileUploads option enabled, the 'add' and 'done' (or 'fail') callbacks - // are called once for each file in the selection for XHR file uploads - singleFileUploads: true, - pasteZone: null, - dataType: 'json', - add: function (e, data) { - var file = data.files[0]; - var attachment = createAttachment(file); - if (attachment) { - file.attachment = attachment; - // Update the text field when using HTML mode - if (CKEDITOR.instances.text) CKEDITOR.instances.text.updateElement(); - data.submit(); - } - if (dropzone.is(":visible")) - dropzone.fadeOut('fast'); - }, - done: function (e, data) { - var attachment = data.files[0].attachment; - var attrs = data.result[data.result.length-1]; - attachment.className = 'progressDone'; - attachment.down('a').setAttribute('href', attrs.url); - if (window.opener && window.opener.open && !window.opener.closed) - window.opener.refreshFolderByType('draft'); - }, - fail: function (e, data) { - var attachment = data.files[0].attachment; - var filename = data.files[0].name; - var textStatus; - try { - var response = data.xhr().response.evalJSON(); - textStatus = response.textStatus; - } catch (e) {} - if (!textStatus) - textStatus = _("Can't contact server"); - showAlertDialog(_("Error while uploading the file \"%{0}\":").formatted(filename) + " " + textStatus); - attachment.remove(); - }, - dragover: function (e, data) { - if (!dropzone.is(":visible")) - dropzone.show(); - }, - progress: function (e, data) { - var progress = parseInt(data.loaded / data.total * 4, 10); - var attachment = data.files[0].attachment; - attachment.className = 'muted progress' + progress; - } - }); - - dropzone.on('dragleave', function (e) { - dropzone.fadeOut('fast'); - }); -} - -function initMailEditor() { - var textarea = $("text"); - - if (composeMode != "html" && $("text")) - textarea.show(); - - configureAttachments(); - - initAddresses(); - initAutoSaveTimer(); - - var focusField = textarea; - if (!mailIsReply) { - focusField = $("addr_0"); - focusField.focus(); - } - - initializePriorityMenu(); - initializeReturnReceiptMenu(); - - configureDragHandle(); - - // Set current subject as window title if not set, use '(Untitled)' - if (document.pageform.subject.value == "") - document.title = '(' + _("Untitled") + ')'; - else - document.title = _(document.pageform.subject.value); - - // Change the window title when typing the subject - $$("div#subjectRow input").first().on("keyup", updateWindowTitleFromSubject); - - var composeMode = UserDefaults["SOGoMailComposeMessageType"]; - if (composeMode == "html") { - // HTML mode - CKEDITOR.replace('text', - { - language : localeCode, - scayt_sLang : localeCode - } - ); - CKEDITOR.on('instanceReady', function(event) { - if (focusField == textarea) - // CKEditor reports being ready but it's still not focusable; - // we wait for a few more milliseconds - setTimeout("CKEDITOR.instances.text.focus()", 500); - }); - CKEDITOR.instances.text.on('focus', onHTMLFocus); - } - else { - // Plain text mode - var textContent = textarea.getValue(); - if (hasSignature()) { - var sigLimit = textContent.lastIndexOf("--"); - if (sigLimit > -1) - MailEditor.signatureLength = (textContent.length - sigLimit); - } - if (UserDefaults["SOGoMailReplyPlacement"] != "above") { - textarea.scrollTop = textarea.scrollHeight; - } - textarea.observe("focus", onTextFocus); - textarea.observe("keydown", onTextKeyDown); - - if (Prototype.Browser.IE) { - // Hack to allow to replace the tab by spaces in IE < 9 - var ieEvents = [ "click", "select", "keyup" ]; - for (var i = 0; i < ieEvents.length; i++) - textarea.observe(ieEvents[i], onTextIEUpdateCursorPos, false); - } - - if (focusField == textarea) - textarea.focus(); - } - - $("contactFolder").observe("change", onContactFolderChange); - - Event.observe(window, "beforeunload", onMailEditorClose); -} - -function initializePriorityMenu() { - var priority = $("priority").value.toUpperCase(); - var priorityMenu = $("priorityMenu").childNodesWithTag("ul")[0]; - var menuEntries = $(priorityMenu).childNodesWithTag("li"); - var chosenNode; - if (priority == "HIGHEST") - chosenNode = menuEntries[0]; - else if (priority == "HIGH") - chosenNode = menuEntries[1]; - else if (priority == "LOW") - chosenNode = menuEntries[3]; - else if (priority == "LOWEST") - chosenNode = menuEntries[4]; - else - chosenNode = menuEntries[2]; - priorityMenu.chosenNode = chosenNode; - $(chosenNode).addClassName("_chosen"); -} - -function initializeReturnReceiptMenu() { - var receipt = $("receipt").value.toLowerCase(); - if (receipt == "true") - $("optionsMenu").down('li').addClassName("_chosen"); -} - -function onMenuCheckReturnReceipt(event) { - event.cancelBubble = true; - - this.enabled = !this.enabled; - var enabled = this.enabled; - if (enabled) { - this.addClassName("_chosen"); - } - else { - this.removeClassName("_chosen"); - } - var receiptInput = $("receipt"); - receiptInput.value = (enabled ? "true" : "false") ; -} - -function getMenus() { - return { - "optionsMenu": [ onMenuCheckReturnReceipt, - "-", - "priorityMenu" ], - "priorityMenu": [ onMenuSetPriority, - onMenuSetPriority, - onMenuSetPriority, - onMenuSetPriority, - onMenuSetPriority ] - }; -} - -function attachmentDeleteCallback(http) { - if (http.readyState == 4) { - if (isHttpStatus204(http.status)) { - var node = http.callbackData; - node.parentNode.removeChild(node); - } - else - log("attachmentDeleteCallback: an error occured: " + http.responseText); - } -} - -/** - * Adjust offset when the browser uses two characters for line feeds. - */ -function adjustOffset(element, offset) { - var val = element.value, newOffset = offset; - if (val.indexOf("\r\n") > -1) { - var matches = val.replace(/\r\n/g, "\n").slice(0, offset).match(/\n/g); - newOffset -= matches ? matches.length - 1 : 0; - } - return newOffset; -} - -function hasSignature() { - try { - return(UserDefaults["SOGoMailSignature"].length > 0); - } catch(e) { - return false; - } -} - -function onMenuSetPriority(event) { - event.cancelBubble = true; - - var priority = this.getAttribute("priority"); - if (this.parentNode.chosenNode) - this.parentNode.chosenNode.removeClassName("_chosen"); - this.addClassName("_chosen"); - this.parentNode.chosenNode = this; - - var priorityInput = $("priority"); - priorityInput.value = priority; -} - -function onSelectOptions(event) { - if (event.button == 0 || (isWebKit() && event.button == 1)) { - var node = getTarget(event); - if (node.tagName != 'A') - node = $(node).up("A"); - popupToolbarMenu(node, "optionsMenu"); - Event.stop(event); - } -} - -/** - * Overwrite definition of MailerUI.js - */ -function onWindowResize(event) { - if (!document.pageform) - return; - var textarea = document.pageform.text; - var rowheight = (Element.getHeight(textarea) / textarea.rows); - var headerarea = $("headerArea"); - var totalwidth = $("rightPanel").getWidth(); - - var subjectfield = headerarea.down("div#subjectRow span.headerField"); - var subjectinput = headerarea.down("div#subjectRow input.textField"); - - // Resize subject field - subjectinput.setStyle({ width: (totalwidth - - $(subjectfield).getWidth() - - 17) + 'px' }); - // Resize from field - $("fromSelect").setStyle({ width: (totalwidth - - $("fromField").getWidth() - - 15) + 'px' }); - - // Resize address fields -// var addresslist = $('addressList'); -// addresslist.setStyle({ width: (totalwidth - 10) + 'px' }); - - // Resize the textarea (message content) - var offsetTop = $('rightPanel').offsetTop + headerarea.getHeight(); - var composeMode = UserDefaults["SOGoMailComposeMessageType"]; - if (composeMode == "html") { - var editor = $('cke_text'); - if (editor == null) { - onWindowResize.defer(); - return; - } - var height = window.height() - offsetTop; - CKEDITOR.instances["text"].resize('100%', height); - } - else - textarea.rows = Math.floor((window.height() - offsetTop) / rowheight); - - // Resize search contacts addressbook selector - if ($("contacts").visible()) - $("contactFolder").setStyle({ width: ($("contactsSearch").getWidth() - 10) + "px" }); -} - -function onMailEditorClose(event) { - var e = event || window.event; - - if (window.shouldPreserve) { - window.shouldPreserve = false; - if (jQuery('#fileUpload').fileupload('active') > 0) { - var msg = _("There is an active file upload. Closing the window will interrupt it."); - if (e) { - e.returnValue = msg; - } - return msg; - } - } - else { - var url = "" + window.location; - var parts = url.split("/"); - parts[parts.length-1] = "delete"; - url = parts.join("/"); - if (window.frameElement && window.frameElement.id) - parent.deleteDraft(url); - else if (window.opener && window.opener.open && !window.opener.closed) - window.opener.deleteDraft(url); - } - - Event.stopObserving(window, "beforeunload", onMailEditorClose); -} - -document.observe("dom:loaded", initMailEditor); diff --git a/UI/WebServerResources/UIxMailPartExternalHTMLViewer.css b/UI/WebServerResources/UIxMailPartExternalHTMLViewer.css deleted file mode 100644 index c2be10da6..000000000 --- a/UI/WebServerResources/UIxMailPartExternalHTMLViewer.css +++ /dev/null @@ -1,4 +0,0 @@ -HTML, BODY -{ background-color: #fff; - font-size: normal; - font-family: sans-serif; } \ No newline at end of file diff --git a/UI/WebServerResources/UIxMailPopupView.js b/UI/WebServerResources/UIxMailPopupView.js deleted file mode 100644 index e5b619375..000000000 --- a/UI/WebServerResources/UIxMailPopupView.js +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -function onPrintCurrentMessage(event) { - window.print(); - - preventDefault(event); -} - -function initPopupMailer(event) { - configureLinksInMessage(); - resizeMailContent(); - - configureLoadImagesButton(); - configureSignatureFlagImage(); - - if (UserDefaults["SOGoMailDisplayRemoteInlineImages"] == 'always') - loadRemoteImages(); - - window.messageUID = mailboxName + "/" + messageName; - - handleReturnReceipt(); - - var td = $("subject"); - if (td) - document.title = td.allTextContent(); -} - -function onICalendarButtonClick(event) { - var link = $("iCalendarAttachment").value; - if (link) { - var urlstr = link + "/" + this.action; - if (window.opener && window.opener.open && !window.opener.closed && window.messageUID) { - var c = window.opener; - window.opener.triggerAjaxRequest(urlstr, - window.opener.ICalendarButtonCallback, - window.messageUID); - } - } - else - log("no link"); -} - -function onMenuDeleteMessage(event) { - if (window.opener && window.opener.open && !window.opener.closed) { - var url = ApplicationBaseURL + encodeURI(mailboxName) + "/batchDelete"; - var path = mailboxName + "/" + messageName; - - window.opener.deleteMessageWithDelay(url, messageName, mailboxName, path); - } - - window.close(); - return false; -} - -document.observe("dom:loaded", initPopupMailer); diff --git a/UI/WebServerResources/UIxMailToSelection.js b/UI/WebServerResources/UIxMailToSelection.js deleted file mode 100644 index 19d837937..000000000 --- a/UI/WebServerResources/UIxMailToSelection.js +++ /dev/null @@ -1,286 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - Copyright (C) 2005 SKYRIX Software AG - - This file is part of OpenGroupware.org. - - OGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - OGo is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - 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 - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -/* Dependencies: - * It's required that "currentIndex" is defined in a top level context. - * - * Exports: - * defines hasRecipients() returning a bool for the - * surrounding context to check. - */ - -var lastIndex = currentIndex; - -function sanitizedCn(cn) { - var parts; - parts = cn.split(', '); - if(parts.length == 1) - return cn; - return parts[0]; -} - -function hasAddress(email) { - var e = $(email); - if(e) - return true; - return false; -} - -function checkAddresses() { - alert("addressCount: " + this.getAddressCount() + " currentIndex: " + currentIndex + " lastIndex: " + lastIndex); -} - -function fancyAddRow(text, type) { - var addr = $('addr_' + lastIndex); - if (addr && addr.value == '') { - var sub = $('subjectField'); - if (sub && sub.value != '') { - sub.focus(); - sub.select(); - return; - } - } - var addressList = $("addressList").tBodies[0]; - var lastChild = $("lastRow"); - - currentIndex++; - var proto = lastChild.previous("tr"); - var row = proto.cloneNode(true); - row.writeAttribute("id", 'row_' + currentIndex); - var rowNodes = row.childNodesWithTag("td"); - var select = $(rowNodes[0]).childNodesWithTag("select")[0]; - select.name = 'popup_' + currentIndex; - select.value = (type? type : proto.down("select").value); - var cell = $(rowNodes[1]); - var input = cell.childNodesWithTag("input")[0]; - if (Prototype.Browser.IE) { - cell.removeChild(input); - input = new Element("input"); - cell.appendChild(input); - } - - input.name = 'addr_' + currentIndex; - input.id = 'addr_' + currentIndex; - input.value = text; - input.stopObserving(); - input.addInterface(SOGoAutoCompletionInterface); - addressList.insertBefore(row, lastChild); - input.observe("focus", addressFieldGotFocus.bind(input)); - input.observe("blur", addressFieldLostFocus.bind(input)); - input.observe("autocompletion:changedlist", expandContactList); - input.on("autocompletion:changed", addressFieldChanged.bind(input)); - input.focus(); - - return input; -} - -function expandContactList (e) { - var container = $(e).memo; - var url = UserFolderURL + "Contacts/" + container + "/" - + this.readAttribute("uid") + "/properties"; - triggerAjaxRequest (url, expandContactListCallback, this); -} - -function expandContactListCallback (http) { - if (http.readyState == 4) { - var input = http.callbackData; - if (http.status == 200) { - var data = http.responseText.evalJSON(true); - // TODO: Should check for duplicated entries - for (var i = data.length - 1; i >= 0; i--) - // Remove contacts with no email address - if (data[i][2].length == 0) data.splice(i, 1); - if (data.length >= 1) { - var text = data[0][2]; - if (data[0][1].length) - text = data[0][1] + " <" + data[0][2] + ">"; - input.value = text; - input.writeAttribute("container", null); - } - if (data.length > 1) { - for (var i = 1; i < data.length; i++) { - var text = data[i][2]; - if (data[i][1].length) - text = data[i][1] + " <" + data[i][2] + ">"; - fancyAddRow(text, $(input).up("tr").down("select").value); - } - } - } - } -} - -function addressFieldGotFocus(event) { - var idx; - - idx = getIndexFromIdentifier(this.id); - if (lastIndex == idx) return; - removeLastEditedRowIfEmpty(); - if (Prototype.Browser.IE && this.value.length == 0) - $(this).setCaretTo(0); // IE hack - onWindowResize(null); - - return false; -} - -function addressFieldLostFocus(event) { - lastIndex = getIndexFromIdentifier(this.id); - addressFieldChanged.bind(this, event)(); -} - -function addressFieldChanged(event) { - // We first split by semi-colon and then by comma only if there's no - // email address detected. - // Examples: - // "dude, buddy dude@domain.com; bro" => "dude, buddy " + "bro" - // "dude, buddy, bro " => "dude, buddy, bro " - // "dude, buddy, bro" => "dude" + "buddy" + "bro" - // "dude@domain.com, " => "" + "" - var addresses = this.value.split(';'); - if (addresses.length > 0) { - var first = true; - for (var i = 0; i < addresses.length; i++) { - var words = addresses[i] - .replace('\t', ' ') - .replace(/,(?! )/, ', ') - .split(' '); - var phrase = new Array(); - for (var j = 0; j < words.length; j++) { - var word = words[j].strip().replace(/<(.+)>/, "$1").replace(',', ''); - if (word.length > 0) { - // Use the regexp defined in generic.js - if (emailRE.test(word)) { - phrase.push('<' + word + '>'); - if (first) { - this.value = phrase.join(' '); - first = false; - } - else - fancyAddRow(phrase.join(' '), $(this).up("tr").down("select").value); - - phrase = new Array(); - } - else - phrase.push(words[j].strip()); - } - } - if (phrase.length > 0) { - words = phrase.join(' ').split(','); - for (var j = 0; j < words.length; j++) { - word = words[j]; - if (first) { - this.value = word; - first = false; - } - else - fancyAddRow(word, $(this).up("tr").down("select").value); - } - - phrase = new Array(); - } - } - } - - // Verify if a new row should be created - var keyCode = event.memo; - if (keyCode == Event.KEY_RETURN) { - var input = fancyAddRow(""); - if (Prototype.Browser.IE) - $(input.id).focus(); - else - input.focus(); - } - - onWindowResize(null); -} - -function removeLastEditedRowIfEmpty() { - var addr, addressList, senderRow; - - addressList = $("addressList").tBodies[0]; - - if (lastIndex == 0 && addressList.childNodes.length <= 2) return; - addr = $('addr_' + lastIndex); - if (!addr) return; - if (addr.value.strip() != '') return; - senderRow = $("row_" + lastIndex); - addressList.removeChild(senderRow); -} - -function getIndexFromIdentifier(id) { - return id.split('_')[1]; -} - -function getAddressIDs() { - var addressList, rows, i, count, addressIDs; - - addressIDs = new Array(); - - addressList = $("addressList").tBodies[0]; - rows = addressList.childNodes; - count = rows.length; - - for (i = 0; i < count; i++) { - var row, rowId; - - row = rows[i]; - rowId = row.id; - if (rowId && rowId != 'lastRow') { - var idx; - - idx = this.getIndexFromIdentifier(rowId); - addressIDs.push(idx); - } - } - return addressIDs; -} - -function getAddressCount() { - var addressCount, addressIDs, i, count; - - addressCount = 0; - addressIDs = this.getAddressIDs(); - count = addressIDs.length; - for (i = 0; i < count; i++) { - var idx, input; - - idx = addressIDs[i]; - input = $('addr_' + idx); - if (input && input.value != '') - addressCount++; - } - return addressCount; -} - -function hasRecipients() { - var count; - - count = this.getAddressCount(); - - return (count > 0); -} - -function initMailToSelection() { - currentIndex = lastIndex = $$("table#addressList tr").length - 2; -} - -document.observe("dom:loaded", initMailToSelection); diff --git a/UI/WebServerResources/UIxMailUserDelegationEditor.css b/UI/WebServerResources/UIxMailUserDelegationEditor.css deleted file mode 100644 index 030fe115b..000000000 --- a/UI/WebServerResources/UIxMailUserDelegationEditor.css +++ /dev/null @@ -1,58 +0,0 @@ -DIV.delegation -{ position: absolute; - top: 0px; - left: 0px; - right: 0px; - bottom: 0px; - padding: 0px; - border: 0px; - margin: 0px; } - -DIV.delegation LABEL -{ white-space: nowrap; - width: 100%; } - -#delegateRoles -{ position: absolute; - top: 5px; - left: 0px; - right: 0px; - bottom: 0px; } - -#delegateSelectorButtons -{ margin-left: 5px; - padding-bottom: 2px; } - -UL#delegateList -{ position: absolute; - left: 0px; - right: 0px; - top: 40px; - bottom: 0px; - padding: 0px; - margin: 0px; - white-space: nowrap; - overflow: auto; - border-bottom: 1px solid #fff; - border-right: 1px solid #fff; - border-top: 1px solid #909090; - border-left: 1px solid #909090; - background-color: #CCDDEC; - list-style-type: none; - list-style-image: none; } - -UL#delegateList LI -{ clear: both; - cursor: pointer; - height: 20px; - margin-left: 0px; - padding-left: 24px; - background-repeat: no-repeat; - background-position: 4px center; - background-image: url("abcard.png"); } - -DIV#delegateSelectorButtons A.smallToolbarButton -{ float: left; } - -SPAN.userFullName -{ margin-top: 2px; } diff --git a/UI/WebServerResources/UIxMailUserDelegationEditor.js b/UI/WebServerResources/UIxMailUserDelegationEditor.js deleted file mode 100644 index f47754684..000000000 --- a/UI/WebServerResources/UIxMailUserDelegationEditor.js +++ /dev/null @@ -1,111 +0,0 @@ -var contactSelectorAction = 'delegation-contacts'; - -function addDelegate(delegateName, delegateID) { - var result = false; - if (!$(delegateID)) { - var ul = $("delegateList"); - var newNode = nodeForDelegate(delegateName, delegateID); - ul.appendChild(newNode); - - var url = window.location.href; - var elements = url.split("/"); - elements[elements.length-1] = ("addDelegate?uid=" - + delegateID); - triggerAjaxRequest(elements.join("/"), addDelegateCallback, newNode); - result = true; - } - return result; -} - -function addDelegateCallback(http) { - if (http.readyState == 4) { - if (!isHttpStatus204(http.status)) { - var node = http.callbackData; - node.parentNode.removeChild(node); - } - } -} - -function setEventsOnDelegateNode(node) { - node.observe("mousedown", listRowMouseDownHandler); - node.observe("selectstart", listRowMouseDownHandler); - node.observe("click", onRowClick); -} - -function nodeForDelegate(delegateName, delegateId) { - var node = createElement("li"); - node.id = delegateId; - - var span = createElement("span"); - span.addClassName("userFullName"); - span.appendChild(document.createTextNode(" " + delegateName)); - node.appendChild(span); - - setEventsOnDelegateNode(node); - - return node; -} - -function onDelegateAdd(event) { - openUserFolderSelector(null, "user"); - - preventDefault(event); -} - -function removeDelegateCallback(http) { - var node = http.callbackData; - - if (http.readyState == 4 - && isHttpStatus204(http.status)) - node.parentNode.removeChild(node); - else - log("error deleting delegate: " + node.getAttribute("id")); -} - -function onDelegateRemove(event) { - var delegateList = $("delegateList"); - var nodes = delegateList.getSelectedRows(); - - var url = window.location.href; - var elements = url.split("/"); - elements[elements.length-1] = "removeDelegate?uid="; - var baseURL = elements.join("/"); - - for (var i = 0; i < nodes.length; i++) { - var delegateId = nodes[i].id; - triggerAjaxRequest(baseURL + delegateId, removeDelegateCallback, - nodes[i]); - } - preventDefault(event); -} - -function subscribeToFolder(refreshCallback, refreshCallbackData) { - var result = true; - if (UserLogin != refreshCallbackData["folder"]) { - result = addDelegate(refreshCallbackData["folderName"], - refreshCallbackData["folder"]); - } - else - refreshCallbackData["window"].alert(_("You cannot subscribe to a folder that you own!")); - return result; -} - -function onDelegationLoadHandler() { - var ul = $("delegateList"); - var lis = ul.childNodesWithTag("li"); - for (var i = 0; i < lis.length; i++) - setEventsOnDelegateNode(lis[i]); - - var buttonArea = $("delegateSelectorButtons"); - if (buttonArea) { - var buttons = buttonArea.childNodesWithTag("a"); - $("addDelegate").stopObserving ("click"); - $("deleteDelegate").stopObserving ("click"); - $("addDelegate").observe("mousedown", onDelegateAdd); - $("deleteDelegate").observe("mousedown", onDelegateRemove); - } - - Event.observe(window, "unload", onDelegationCloseHandler); -} - -document.observe("dom:loaded", onDelegationLoadHandler); diff --git a/UI/WebServerResources/UIxMailUserRightsEditor.css b/UI/WebServerResources/UIxMailUserRightsEditor.css deleted file mode 100644 index 662b250f5..000000000 --- a/UI/WebServerResources/UIxMailUserRightsEditor.css +++ /dev/null @@ -1,31 +0,0 @@ -DIV.title -{ color: #000; - vertical-align: bottom; - padding-top: 8px; - padding-left: 1em; - padding: 5px; - background-color: #fff; - border-bottom: 1px solid #555; } - -DIV.title SPAN.value -{ margin-left: 2em; - font-size: 14px; - font-weight: bold; } - -DIV.title LABEL -{ display: block; } - -DIV.calendarUserRights, -DIV.basicUserRights -{ margin: 1em;} - -DIV.buttons -{ text-align: right; - margin: 1em; } - -DIV.dialog.none -{ position: absolute; - top: 0px; - left: 0px; - right: 0px; - margin: 75px auto; } \ No newline at end of file diff --git a/UI/WebServerResources/UIxMailUserRightsEditor.js b/UI/WebServerResources/UIxMailUserRightsEditor.js deleted file mode 100644 index d3e303f14..000000000 --- a/UI/WebServerResources/UIxMailUserRightsEditor.js +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -function onUpdateACL(event) { - if ($('uid').value == 'anyone') { - var inputs = $$('#userRightsForm input[type="checkbox"]'); - var enabled = false; - for (var i = 0; i < inputs.length; i++) { - if (inputs[i].checked) { - enabled = true; - break; - } - } - if (enabled) { - showConfirmDialog(_("Warning"), _("Any user with an account on this system will be able to access your mailbox \"%{0}\". Are you certain you trust them all?").formatted($("folderName").allTextContent()), - onUpdateACLConfirm, onUpdateACLCancel, - "Give Access", "Keep Private"); - return false; - } - } - - return onUpdateACLConfirm(event); -} - -function onUpdateACLConfirm(event) { - disposeDialog(); - - $('userRightsForm').submit(); - Event.stop(event); - - return false; -} - -function onUpdateACLCancel(event) { - var inputs = $$('#userRightsForm input[type="checkbox"]'); - for (var i = 0; i < inputs.length; i++) - if (inputs[i].checked) - inputs[i].checked = false; - - disposeDialog(); -} - -function onCancelACL(event) { - window.close(); -} - -function initACLButtons() { - $("updateButton").observe("click", onUpdateACL); - $("cancelButton").observe("click", onCancelACL); -} - -document.observe("dom:loaded", initACLButtons); diff --git a/UI/WebServerResources/UIxMailView.js b/UI/WebServerResources/UIxMailView.js deleted file mode 100644 index 4e0551ec4..000000000 --- a/UI/WebServerResources/UIxMailView.js +++ /dev/null @@ -1,7 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -function onPrintCurrentMessage(event) { - window.print(); - - preventDefault(event); -} diff --git a/UI/WebServerResources/UIxOccurenceDialog.css b/UI/WebServerResources/UIxOccurenceDialog.css deleted file mode 100644 index 84b13e4db..000000000 --- a/UI/WebServerResources/UIxOccurenceDialog.css +++ /dev/null @@ -1,16 +0,0 @@ -DIV#message, DIV#windowButtons -{ margin: 10px; } - -DIV#windowButtons INPUT -{ text-align: center; } - -DIV#leftButtons -{ float: left; - width: 200px; - text-align: left; } - -DIV#rightButtons -{ text-align: right; } - -A#thisButton -{ float: left !important; } diff --git a/UI/WebServerResources/UIxOccurenceDialog.js b/UI/WebServerResources/UIxOccurenceDialog.js deleted file mode 100644 index c58aac923..000000000 --- a/UI/WebServerResources/UIxOccurenceDialog.js +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -function onCancelButtonClick(event) { - window.close(); -} - -function onThisButtonClick(event) { - if (action == 'edit') - window.opener.performEventEdition(calendarFolder, componentName, - recurrenceName); - else if (action == 'delete') - window.opener.performEventDeletion(calendarFolder, componentName, - recurrenceName); - else if (action == 'adjust') - window.opener.performEventAdjustment(calendarFolder, componentName, - recurrenceName, queryParameters); - else - window.alert("Invalid action: " + action); - - window.close(); -} - -function onAllButtonClick(event) { - if (action == 'edit') - window.opener.performEventEdition(calendarFolder, componentName); - else if (action == 'delete') - window.opener.performEventDeletion(calendarFolder, componentName); - else if (action == 'adjust') - window.opener.performEventAdjustment(calendarFolder, componentName, - null, queryParameters); - else - window.alert("Invalid action: " + action); - - window.close(); -} - -function onOccurenceDialogLoad() { - var thisButton = $("thisButton"); - thisButton.observe("click", onThisButtonClick); - - var allButton = $("allButton"); - allButton.observe("click", onAllButtonClick); - - var cancelButton = $("cancelButton"); - cancelButton.observe("click", onCancelButtonClick); -} - -document.observe("dom:loaded", onOccurenceDialogLoad); diff --git a/UI/WebServerResources/UIxPreferences.css b/UI/WebServerResources/UIxPreferences.css deleted file mode 100644 index d9ab197ee..000000000 --- a/UI/WebServerResources/UIxPreferences.css +++ /dev/null @@ -1,272 +0,0 @@ -DIV#preferencesTabs -{ position: absolute; - top: 54px; - left: 5px; - right: 5px; - bottom: 5px; } - -DIV.bottomToolbar -{ position: absolute; - height: 20px; - margin: 0px; - padding: 0px; - left: 2em; - right: 2em; - bottom: 8px; } - -#WhiteListAdd, #WhiteListDelete -{ - border-bottom: 1px solid #9B9B9B; - border-right: 1px solid #9B9B9B; -} - -#mailAccountsToolbar -{ left: 5px; - bottom: 9px; - width: 130px; } - -TABLE.categoriesList -{ width: 100%; } - -#colorTableHeader -{ width: 50px; } - -TR.categoryListRow -{ background: #ccddec; - cursor: pointer; } - -TD.categoryListCell -{ -moz-user-select: none; } - -DIV.colorBox -{ -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; - border: 2px solid #ccddec; } - -DIV.colorBox:hover -{ border-color: #eee; } - -DIV.listWrapper -{ overflow: auto; - position: absolute; - padding: 0px; - margin-top: 2px; - border-left: 1px solid #9b9b9b; - border-right: 1px solid #9b9b9b; - background: #ccddec;} - -.listWrapper TABLE TD -{ height: 22px; } - -#calendarCategoriesListWrapper -{ top:1em; - bottom: 30px; - right: 2em; - left: 2em; } - -#appointmentsWhiteListWrapper -{ top:4.5em; - bottom: 30px; - right: 2em; - left: 2em; } - -#tableViewWhiteList -{ width:100%; } - -DIV#calendarOptionsTabs -{ position: absolute; - top: 225px; - left: 0px; - right: 0px; - bottom: 0px; -} - -#contactsCategoriesListWrapper -{ overflow: auto; - position: absolute; - bottom: 30px; - right: 2em; - top: 20px; - left: 2em; - padding: 0px; - margin-top: 2px; - border-left: 1px solid #9b9b9b; - background: #ccddec; } - -/* time date control */ -SPAN.timeDateControl INPUT.textField -{ width: 7em; - vertical-align: text-bottom; } - -/* vacation, forward */ -#vacation, #forward -{ padding-left: 2.5em; } -#vacation LABEL -{ margin-left: 0; } -#vacation TEXTAREA, -#forward TEXTAREA -{ width: 100%; } -#vacation TEXTAREA#autoReplyText -{ height: 100px; } -#vacation TEXTAREA#autoReplyEmailAddresses, -#forward TEXTAREA -{ height: 50px; } -#vacation SPAN -{ float: right; } -#vacation SPAN.timeDateControl, -#vacation SPAN.timeDateControl SPAN -{ float: none; - vertical-align: middle; } -#vacation BR, -#passwordView BR -{ clear: both; } - -/* mail options */ -DIV#mailOptionsTabs -{ position: absolute; - top: 225px; - left: 0px; - right: 0px; - bottom: 0px; } - -DIV#filtersListWrapper, -DIV#mailLabelsListWrapper -{ bottom: 22px; - right: 0px; - top: 0px; - left: 0px; } - -#mailOptionsTabs .bottomToolbar -{ bottom: 0px; - left: 0px; - right: 0px; } - -DIV#filtersListWrapper TD, -DIV#mailLabelsListWrapper TD, -DIV.bottomToolbar -{ -khtml-user-select: none; - -moz-user-select: none; } - -#filtersList, #labelsList -{ width: 100%; - cursor: default; } - -TH#activeTableHeader -{ width: 50px; - text-align: center; } - -TD.activeColumn -{ text-align: center; } - -P#passwordFields, -P#passwordError -{ width: 410px; - text-align: right; } - -P.errorMessage#passwordError -{ color: #f00; } - -P.infoMessage#passwordError -{ color: #00f; } - -/* mail accounts */ -#mailAccountsListWrapper, #mailAccountEditor -{ bottom: 30px; - top: 5px; - left: 0px; - margin: 0px; } - -#mailAccountEditor -{ position: absolute; - overflow: auto; - bottom: 30px; - left: 140px; - padding: 0px; - right: 5px; } - -#mailAccountEditor dl -{ margin: 5px; } - -#mailAccountsListWrapper -{ overflow-x: hidden; - left: 5px; - width: 130px; - border-top: 1px solid #9b9b9b; } - -#mailAccountsList -{ position: absolute; - top: 0px; - bottom: 0px; - left: 0px; - right: 0px; - margin: 0px; - padding: 0px; } - -#mailAccountsList LI -{ cursor: pointer; - white-space: nowrap; - padding-left: 5px; - height: 22px; - line-height: 22px; } - -#mailAccountsList LI.readonly -{ cursor: default; - font-style: italic; } - -#serverName -{ width: 100px; } - -#port -{ width: 30px; } - -#userName, #password -{ width: 180px; } - -#fullName, #email, #replyTo -{ width: 180px; } - -#actSignature -{ color: #55f; - cursor: pointer; - text-decoration: underline; } - -#actSignature.disabled -{ color: #999; - cursor: default; - text-decoration: none; } - -#signatureDialog -{ position: absolute; - left: 10px; - width: auto !important; - right: 10px; - top: 0px; } - -#cke_signature, #cke_signature div -{ padding: 0px; } - -#signature -{ width: 100%; - height: 170px; - margin: 0px auto; - margin-bottom: 10px; } - -#receiptOptions -{ text-align: right; } - -#colorPickerDialog -{ width: 146px; - height: 191px; } - -#colorPickerDialog.dialog.right > DIV -{ padding-left: 10px; } - -.dialog.bottom > DIV:before { - top: auto; - bottom: 12px; -} -.dialog.bottom > DIV:after { - top: auto; - bottom: 13px; -} diff --git a/UI/WebServerResources/UIxPreferences.js b/UI/WebServerResources/UIxPreferences.js deleted file mode 100644 index bf6a503f5..000000000 --- a/UI/WebServerResources/UIxPreferences.js +++ /dev/null @@ -1,1464 +0,0 @@ -var filters = []; -var mailAccounts = null; -var dialogs = {}; - -function savePreferences(sender) { - var sendForm = true; - - var sigList = $("signaturePlacementList"); - if (sigList) - sigList.disabled = false; - - if ($("appointmentsWhiteListWrapper")) - serializeAppointmentsWhiteList(); - - if ($("calendarCategoriesListWrapper")) - serializeCalendarCategories(); - - if ($("contactsCategoriesListWrapper")) - serializeContactsCategories(); - - if ($("mailLabelsListWrapper")) - serializeMailLabels(); - - if (typeof mailCustomFromEnabled !== "undefined" && !emailRE.test($("email").value)) { - showAlertDialog(_("Please specify a valid sender address.")); - sendForm = false; - } - - if ($("replyTo")) { - var replyTo = $("replyTo").value; - if (!replyTo.blank() && !emailRE.test(replyTo)) { - showAlertDialog(_("Please specify a valid reply-to address.")); - sendForm = false; - } - } - - if ($("dayStartTime")) { - var start = $("dayStartTime"); - var selectedStart = parseInt(start.options[start.selectedIndex].value); - var end = $("dayEndTime"); - var selectedEnd = parseInt(end.options[end.selectedIndex].value); - - if (selectedStart >= selectedEnd) { - showAlertDialog (_("Day start time must be prior to day end time.")); - sendForm = false; - } - } - - if ($("enableVacation") && $("enableVacation").checked) { - if ($("autoReplyText").value.strip().length == 0 || $("autoReplyEmailAddresses").value.strip().length == 0) { - showAlertDialog(_("Please specify your message and your email addresses for which you want to enable auto reply.")); - sendForm = false; - } - - if ($("autoReplyText").value.strip().endsWith('\n.')) { - showAlertDialog(_("Your vacation message must not end with a single dot on a line.")); - sendForm = false; - } - - if ($("enableVacationEndDate") && $("enableVacationEndDate").checked) { - var e = $("vacationEndDate_date"); - var endDate = e.inputAsDate(); - var now = new Date(); - if (isNaN(endDate.getTime()) || endDate.getTime() < now.getTime()) { - showAlertDialog(_("End date of your auto reply must be in the future.")); - sendForm = false; - } - } - } - - if ($("enableForward") && $("enableForward").checked) { - var addresses = $("forwardAddress").value.split(","); - - // We check if all addresses are valid - for (var i = 0; i < addresses.length && sendForm; i++) - if (!emailRE.test(addresses[i].strip())) { - showAlertDialog(_("Please specify an address to which you want to forward your messages.")); - sendForm = false; - } - - // We check if we can only to internal/external addresses. - var constraints = (typeof forwardConstraints != "undefined") && parseInt(forwardConstraints); - - if (constraints > 0) { - // We first extract the list of 'known domains' to SOGo - var defaultAddresses = $("defaultEmailAddresses").value.split(/, */); - var domains = new Array(); - - defaultAddresses.each(function(adr) { - var domain = adr.split("@")[1]; - if (domain) { - domains.push(domain.toLowerCase()); - } - }); - - // We check if we're allowed or not to forward based on the domain defaults - for (var i = 0; i < addresses.length && sendForm; i++) { - var domain = addresses[i].split("@")[1].toLowerCase(); - if (domains.indexOf(domain) < 0 && constraints == 1) { - showAlertDialog(_("You are not allowed to forward your messages to an external email address.")); - sendForm = false; - } - else if (domains.indexOf(domain) >= 0 && constraints == 2) { - showAlertDialog(_("You are not allowed to forward your messages to an internal email address.")); - sendForm = false; - } - } - } - } - - if (typeof sieveCapabilities != "undefined") { - var jsonFilters = prototypeIfyFilters(); - $("sieveFilters").setValue(Object.toJSON(jsonFilters)); - } - - if (sendForm) { - saveMailAccounts(); - - triggerAjaxRequest($("mainForm").readAttribute("action"), function (http) { - if (http.readyState == 4) { - var response = http.responseText.evalJSON(true); - if (http.status == 503) { - showAlertDialog(_(response.textStatus)); - } - else if (http.status == 200) { - if (response.hasChanged == 1) { - window.opener.location.reload(); - window.close(); - } - else { - window.close(); - } - } - else { - showAlertDialog(_(response.textStatus)); - } - } - }, - null, - Form.serialize($("mainForm")), // excludes the file input - { "Content-type": "application/x-www-form-urlencoded"} - ); - } - return false; -} - -function prototypeIfyFilters() { - var newFilters = $([]); - for (var i = 0; i < filters.length; i++) { - var filter = filters[i]; - var newFilter = $({}); - newFilter.name = filter.name; - newFilter.match = filter.match; - newFilter.active = filter.active; - - if (filter.rules) { - newFilter.rules = $([]); - for (var j = 0; j < filter.rules.length; j++) { - newFilter.rules.push($(filter.rules[j])); - } - } - - if (filter.actions) { - newFilter.actions = $([]); - for (var j = 0; j < filter.actions.length; j++) { - newFilter.actions.push($(filter.actions[j])); - } - } - newFilters.push(newFilter); - } - - return newFilters; -} - -function _setupEvents() { - var widgets = [ "timezone", "shortDateFormat", "longDateFormat", - "timeFormat", "weekStartDay", "dayStartTime", "dayEndTime", - "firstWeek", "refreshViewCheck", "sortByThreads", "displayRemoteInlineImages", - "subscribedFoldersOnly", "language", "defaultCalendar", - "enableVacation" ]; - for (var i = 0; i < widgets.length; i++) { - var widget = $(widgets[i]); - if (widget) { - widget.observe("change", onChoiceChanged); - } - } - - // We check for non-null elements as replyPlacementList and composeMessagesType - // might not be present if ModulesConstraints disable those elements - if ($("replyPlacementList")) - $("replyPlacementList").on("change", onReplyPlacementListChange); - - if ($("composeMessagesType")) - $("composeMessagesType").on("change", onComposeMessagesTypeChange); - - // Note: we also monitor changes to the calendar categories. - // See functions endEditable and onColorPickerChoice. - var valueInputs = [ "calendarCategoriesValue", "calendarCategoriesValue" ]; - for (var i = 0; i < valueInputs.length; i++) { - var valueInput = $(valueInputs[i]); - if (valueInput) - valueInput.value = ""; - } -} - -function onBodyClickHandler(event) { - var target = getTarget(event); - if (!target.hasClassName('colorBox')) - $("colorPickerDialog").hide(); -} - -function onChoiceChanged(event) { - var hasChanged = $("hasChanged"); - hasChanged.value = "1"; -} - -function addDefaultEmailAddresses(event) { - var defaultAddresses = $("defaultEmailAddresses").value.split(/, */); - var addresses = $("autoReplyEmailAddresses").value.trim(); - - if (addresses) addresses = addresses.split(/, */); - else addresses = new Array(); - - defaultAddresses.each(function(adr) { - for (var i = 0; i < addresses.length; i++) - if (adr == addresses[i]) - break; - if (i == addresses.length) - addresses.push(adr); - }); - - $("autoReplyEmailAddresses").value = addresses.join(", "); - - event.stop(); -} - -function initPreferences() { - var tabsContainer = $("preferencesTabs"); - var controller = new SOGoTabsController(); - controller.attachToTabsContainer(tabsContainer); - - // Inner tabs on the mail module tab - tabsContainer = $('mailOptionsTabs'); - if (tabsContainer) { - var mailController = new SOGoTabsController(); - mailController.attachToTabsContainer(tabsContainer); - } - - // Inner tabs on the calendar module tab - tabsContainer = $('calendarOptionsTabs'); - if (tabsContainer) { - var mailController = new SOGoTabsController(); - mailController.attachToTabsContainer(tabsContainer); - } - - _setupEvents(); - - // Optional function called when initializing the preferences - // Typically defined inline in the UIxAdditionalPreferences.wox template - if (typeof (initAdditionalPreferences) != "undefined") - initAdditionalPreferences(); - - // Color picker - $('colorPickerDialog').on('click', 'span', onColorPickerChoice); - $(document.body).on("click", onBodyClickHandler); - - // Calendar whiteList - var whiteList = $("appointmentsWhiteListWrapper"); - if (whiteList) { - var whiteListString = $("whiteList").getValue(); - var whiteListObject = {}; - // This condition is a backward compatibility where the strings looks like : "sogo1=John DOE " - if (whiteListString.search("=") != -1) { - var split = whiteListString.split("="); - whiteListObject[split[0]] = split[1]; - - } - else if (whiteListString != "") { - whiteListObject = JSON.parse(whiteListString); - } - var allKeys = Object.keys(whiteListObject); - var allValues = Object.values(whiteListObject); - var tablebody = $("appointmentsWhiteListWrapper").childNodesWithTag("table")[0].tBodies[0]; - for (i = 0; i < allKeys.length; i++) { - var row = new Element("tr"); - var td = new Element("td").update(""); - var textField = new Element("input"); - var span = new Element("span"); - - row.addClassName("whiteListRow"); - row.observe("mousedown", onRowClick); - td.addClassName ("whiteListCell"); - td.observe("mousedown", endAllEditables); - td.observe("dblclick", onNameEdit); - textField.addInterface(SOGoAutoCompletionInterface); - textField.SOGoUsersSearch = true; - textField.observe("autocompletion:changed", endEditable); - textField.addClassName("textField"); - textField.value = allValues[i]; - textField.setAttribute("uid", allKeys[i]); - textField.hide(); - span.innerText = allValues[i]; - - td.appendChild(textField); - td.appendChild(span); - row.appendChild (td); - tablebody.appendChild(row); - $(tablebody).deselectAll(); - - } - - var table = whiteList.childNodesWithTag("table")[0]; - table.multiselect = true; - $("appointmentsWhiteListAdd").observe("click", onAppointmentsWhiteListAdd); - $("appointmentsWhiteListDelete").observe("click", onAppointmentsWhiteListDelete); - } - - // Calender categories - var wrapper = $("calendarCategoriesListWrapper"); - if (wrapper) { - var table = wrapper.childNodesWithTag("table")[0]; - resetCalendarCategoriesColors(null); - var r = $$("#calendarCategoriesListWrapper tbody tr"); - for (var i= 0; i < r.length; i++) - r[i].identify(); - table.multiselect = true; - resetCalendarTableActions(); - $("calendarCategoryAdd").observe("click", onCalendarCategoryAdd); - $("calendarCategoryDelete").observe("click", onCalendarCategoryDelete); - wrapper.observe("scroll", onBodyClickHandler); - } - - // Mail labels/tags - var wrapper = $("mailLabelsListWrapper"); - if (wrapper) { - var table = wrapper.childNodesWithTag("table")[0]; - resetMailLabelsColors(null); - var r = $$("#mailLabelsListWrapper tbody tr"); - for (var i= 0; i < r.length; i++) - r[i].identify(); - table.multiselect = true; - resetMailTableActions(); - $("mailLabelAdd").observe("click", onMailLabelAdd); - $("mailLabelDelete").observe("click", onMailLabelDelete); - } - - // Contact categories - wrapper = $("contactsCategoriesListWrapper"); - if (wrapper) { - var table = wrapper.childNodesWithTag("table")[0]; - var r = $$("#contactsCategoriesListWrapper tbody tr"); - for (var i= 0; i < r.length; i++) - r[i].identify(); - table.multiselect = true; - resetContactsTableActions(); - $("contactsCategoryAdd").observe("click", onContactsCategoryAdd); - $("contactsCategoryDelete").observe("click", onContactsCategoryDelete); - } - - if ($("replyPlacementList")) - onReplyPlacementListChange(); - - var button = $("addDefaultEmailAddresses"); - if (button) - button.observe("click", addDefaultEmailAddresses); - - button = $("changePasswordBtn"); - if (button) - button.observe("click", onChangePasswordClick); - - initSieveFilters(); - - initMailAccounts(); - - button = $("enableVacationEndDate"); - if (button) { - jQuery("#vacationEndDate_date").closest(".date").datepicker({ autoclose: true, position: 'above', weekStart: $('weekStartDay').getValue() }); - button.on("click", function(event) { - if (this.checked) - $("vacationEndDate_date").enable(); - else - $("vacationEndDate_date").disable(); - }); - } - onAddOutgoingAddressesCheck(); -} - -function initSieveFilters() { - var table = $("filtersList"); - if (table) { - var filtersValue = $("sieveFilters").getValue(); - if (filtersValue && filtersValue.length) { - filters = $(filtersValue.evalJSON(false)); - for (var i = 0; i < filters.length; i++) { - appendSieveFilterRow(table, i, filters[i]); - } - } - $("filterAdd").observe("click", onFilterAdd); - $("filterDelete").observe("click", onFilterDelete); - $("filterMoveUp").observe("click", onFilterMoveUp); - $("filterMoveDown").observe("click", onFilterMoveDown); - } -} - -function appendSieveFilterRow(filterTable, number, filter) { - var row = createElement("tr"); - row.observe("mousedown", onRowClick); - row.observe("dblclick", onFilterEdit.bindAsEventListener(row)); - - var nameColumn = createElement("td"); - nameColumn.appendChild(document.createTextNode(filter["name"])); - row.appendChild(nameColumn); - - var activeColumn = createElement("td", null, "activeColumn"); - var cb = createElement("input", null, "checkBox", - { type: "checkbox" }, - null, activeColumn); - cb.checked = filter.active; - var bound = onScriptActiveCheck.bindAsEventListener(cb); - cb.observe("click", bound); - row.appendChild(activeColumn); - - filterTable.tBodies[0].appendChild(row); -} - -function onScriptActiveCheck(event) { - var index = this.parentNode.parentNode.rowIndex - 1; - filters[index].active = this.checked; -} - -function updateSieveFilterRow(filterTable, number, filter) { - var row = $(filterTable.tBodies[0].rows[number]); - var columns = row.childNodesWithTag("td"); - var nameColumn = columns[0]; - while (nameColumn.firstChild) { - nameColumn.removeChild(nameColumn.firstChild); - } - nameColumn.appendChild(document.createTextNode(filter.name)); - - var activeColumn = columns[1]; - var cb = activeColumn.childNodesWithTag("input"); - cb[0].checked = filter.active; -} - -function _editFilter(filterId) { - var urlstr = ApplicationBaseURL + "/editFilter?filter=" + filterId; - var win = window.open(urlstr, "sieve_filter_" + filterId, - "width=560,height=380,resizable=0"); - if (win) - win.focus(); -} - -function onFilterAdd(event) { - _editFilter("new"); - event.stop(); -} - -function onFilterDelete(event) { - var filtersList = $("filtersList").tBodies[0]; - var nodes = filtersList.getSelectedNodes(); - if (nodes.length > 0) { - var deletedFilters = []; - for (var i = 0; i < nodes.length; i++) { - var node = nodes[i]; - deletedFilters.push(node.rowIndex - 1); - } - deletedFilters = deletedFilters.sort(function(x,y) { return x-y; }); - var rows = filtersList.rows; - for (var i = 0; i < deletedFilters.length; i++) { - var filterNbr = deletedFilters[i]; - filters.splice(filterNbr, 1); - var row = rows[filterNbr]; - row.parentNode.removeChild(row); - } - } - event.stop(); -} - -function onFilterMoveUp(event) { - var filtersList = $("filtersList").tBodies[0]; - var nodes = filtersList.getSelectedNodes(); - if (nodes.length > 0) { - var node = nodes[0]; - var previous = node.previous(); - if (previous) { - var count = node.rowIndex - 1; - node.parentNode.removeChild(node); - filtersList.insertBefore(node, previous); - var swapFilter = filters[count]; - filters[count] = filters[count - 1]; - filters[count - 1] = swapFilter; - } - } - event.stop(); -} - -function onFilterMoveDown(event) { - var filtersList = $("filtersList").tBodies[0]; - var nodes = filtersList.getSelectedNodes(); - if (nodes.length > 0) { - var node = nodes[0]; - var next = node.next(); - if (next) { - var count = node.rowIndex - 1; - filtersList.removeChild(next); - filtersList.insertBefore(next, node); - var swapFilter = filters[count]; - filters[count] = filters[count + 1]; - filters[count + 1] = swapFilter; - } - } - event.stop(); -} - -function onFilterEdit(event) { - _editFilter(this.rowIndex - 1); - event.stop(); - - return false; -} - -function copyFilter(originalFilter) { - var newFilter = {}; - newFilter.name = originalFilter.name; - newFilter.match = originalFilter.match; - newFilter.active = originalFilter.active; - if (originalFilter.rules) { - newFilter.rules = []; - for (var i = 0; i < originalFilter.rules.length; i++) { - newFilter.rules.push(_copyFilterElement(originalFilter.rules[i])); - } - } - newFilter.actions = []; - for (var i = 0; i < originalFilter.actions.length; i++) { - newFilter.actions.push(_copyFilterElement(originalFilter.actions[i])); - } - - return newFilter; -} - -function _copyFilterElement(filterElement) { /* element = rule or action */ - var newElement = {}; - for (var k in filterElement) { - var value = filterElement[k]; - if (typeof(value) == "string" || typeof(value) == "number") { - newElement[k] = value; - } - } - - return newElement; -} - -function getSieveCapabilitiesFromEditor() { - return sieveCapabilities; -} - -function getFilterFromEditor(filterId) { - var filter = copyFilter(filters[filterId]); - return Object.toJSON(filter); -} - -function setupMailboxesFromJSON(jsonResponse) { - var responseMboxes = jsonResponse.mailboxes; - userMailboxes = $([]); - for (var i = 0; i < responseMboxes.length; i++) { - var mbox = { 'displayName': responseMboxes[i].displayName.substr(1), - 'path': responseMboxes[i].path.substr(1) }; - userMailboxes.push(mbox); - } -} - -function updateFilterFromEditor(filterId, filterJSON) { - var filter = filterJSON.evalJSON(); - var sanitized = {}; - for (var k in filter) { - if (!(k == "rules" && filter.match == "allmessages")) { - sanitized[k] = filter[k]; - } - } - - var table = $("filtersList"); - if (filterId == "new") { - var newNumber = filters.length; - filters.push(sanitized); - appendSieveFilterRow(table, newNumber, sanitized); - } else { - filters[filterId] = sanitized; - updateSieveFilterRow(table, filterId, sanitized); - } -} - -/* mail accounts */ -function initMailAccounts() { - var mailAccountsJSON = $("mailAccountsJSON"); - if (mailAccountsJSON) { - mailAccounts = mailAccountsJSON.value.evalJSON(); - - var mailAccountsList = $("mailAccountsList"); - if (mailAccountsList) { - var li = createMailAccountLI(mailAccounts[0], true); - mailAccountsList.appendChild(li); - for (var i = 1; i < mailAccounts.length; i++) { - li = createMailAccountLI(mailAccounts[i]); - mailAccountsList.appendChild(li); - } - var lis = mailAccountsList.childNodesWithTag("li"); - lis[0].readOnly = true; - lis[0].selectElement(); - - var button = $("mailAccountAdd"); - if (button) { - button.observe("click", onMailAccountAdd); - } - button = $("mailAccountDelete"); - if (button) { - button.observe("click", onMailAccountDelete); - } - } - - var inputs = $$("#accountInfo input"); - for (var i = 0; i < inputs.length; i++) { - $(inputs[i]).observe("change", onMailAccountInfoChange); - } - - inputs = $$("#identityInfo input"); - for (var i = 0; i < inputs.length; i++) { - $(inputs[i]).observe("change", onMailIdentityInfoChange); - } - $("actSignature").observe("click", onMailIdentitySignatureClick); - displayMailAccount(mailAccounts[0], true); - - inputs = $$("#returnReceiptsInfo input"); - for (var i = 0; i < inputs.length; i++) { - $(inputs[i]).observe("change", onMailReceiptInfoChange); - } - inputs = $$("#returnReceiptsInfo select"); - for (var i = 0; i < inputs.length; i++) { - $(inputs[i]).observe("change", onMailReceiptActionChange); - } - } -} - -function onMailAccountInfoChange(event) { - this.mailAccount[this.name] = this.value; - var hasChanged = $("hasChanged"); - hasChanged.value = "1"; -} - -function onMailIdentityInfoChange(event) { - if (!this.mailAccount["identities"]) { - this.mailAccount["identities"] = [{}]; - } - var identity = this.mailAccount["identities"][0]; - identity[this.name] = this.value; - var hasChanged = $("hasChanged"); - hasChanged.value = "1"; -} - -function onMailReceiptInfoChange(event) { - if (!this.mailAccount["receipts"]) { - this.mailAccount["receipts"] = {}; - } - var keyName = this.name.cssIdToHungarianId(); - this.mailAccount["receipts"][keyName] = this.value; - - var popupIds = [ "receipt-non-recipient-action", - "receipt-outside-domain-action", - "receipt-any-action" ]; - var receiptActionsDisable = (this.value == "ignore"); - for (var i = 0; i < popupIds.length; i++) { - var actionPopup = $(popupIds[i]); - actionPopup.disabled = receiptActionsDisable; - } -} - -function onMailReceiptActionChange(event) { - if (!this.mailAccount["receipts"]) { - this.mailAccount["receipts"] = {}; - } - var keyName = this.name.cssIdToHungarianId(); - this.mailAccount["receipts"][keyName] = this.value; -} - -function onMailIdentitySignatureClick(event) { - if (!this.readOnly) { - var dialogId = "signatureDialog"; - var dialog = dialogs[dialogId]; - if (!dialog) { - var label = _("Please enter your signature below:"); - var fields = createElement("p"); - fields.appendChild(createElement("textarea", "signature")); - fields.appendChild(createButton("okBtn", _("OK"), - onMailIdentitySignatureOK)); - fields.appendChild(createButton("cancelBtn", _("Cancel"), - disposeDialog)); - var dialog = createDialog(dialogId, - _("Signature"), - label, - fields, - "none"); - if (Prototype.Browser.IE) - // Overwrite some fixes from iefixes.css - dialog.setStyle({ width: 'auto', marginLeft: 'auto' }); - - document.body.appendChild(dialog); - dialogs[dialogId] = dialog; - - if ($("composeMessagesType").value != 0) { - CKEDITOR.replace('signature', - { height: "150px", - toolbar: [['Bold', 'Italic', '-', 'Link', - 'Font','FontSize','-','TextColor', - 'BGColor'], ['Source'] - ], - language: localeCode, - scayt_sLang: localeCode }); - } - } - dialog.mailAccount = this.mailAccount; - if (!this.mailAccount["identities"]) { - this.mailAccount["identities"] = [{}]; - } - var identity = this.mailAccount["identities"][0]; - var area = $("signature"); - if (typeof(identity["signature"]) != "undefined") - area.value = identity["signature"]; - else - area.value = ""; - - $("bgDialogDiv").show(); - if (Prototype.Browser.IE) - jQuery('#bgDialogDiv').css('opacity', 0.4); - jQuery(dialog).fadeIn('fast', function() { - if (CKEDITOR.instances["signature"]) - focusCKEditor(); - else - area.focus(); - }); - Event.stop(event); - } -} - -function focusCKEditor() { - if (CKEDITOR.status != 'loaded') - setTimeout("focusCKEditor()", 100); - else - CKEDITOR.instances.signature.focus() -} - -function hideSignature() { - if (CKEDITOR.status != 'loaded') - setTimeout("hideSignature()", 100); - else - disposeDialog("signatureDialog"); -} - -function onMailIdentitySignatureOK(event) { - var dialog = $("signatureDialog"); - var mailAccount = dialog.mailAccount; - if (!mailAccount["identities"]) { - mailAccount["identities"] = [{}]; - } - var identity = mailAccount["identities"][0]; - - var content = (CKEDITOR.instances["signature"] - ? CKEDITOR.instances["signature"].getData() - : $("signature").value); - identity["signature"] = content; - displayAccountSignature(mailAccount); - hideSignature(); - dialog.mailAccount = null; - var hasChanged = $("hasChanged"); - hasChanged.value = "1"; -} - -function createMailAccountLI(mailAccount, readOnly) { - var li = createElement("li"); - li.appendChild(document.createTextNode(mailAccount["name"])); - li.observe("click", onMailAccountEntryClick); - li.observe("mousedown", onRowClick); - if (readOnly) { - li.addClassName("readonly"); - } - else { - var editionCtlr = new RowEditionController(); - editionCtlr.attachToRowElement(li); - editionCtlr.notifyNewValueCallback = function(ignore, newValue) { - mailAccount["name"] = newValue; - }; - li.editionController = editionCtlr; - } - li.mailAccount = mailAccount; - - return li; -} - -function onMailAccountEntryClick(event) { - displayMailAccount(this.mailAccount, this.readOnly); -} - -function displayMailAccount(mailAccount, readOnly) { - var inputs = $$("#accountInfo input"); - inputs.each(function(i) { - i.disabled = readOnly; - i.mailAccount = mailAccount; - }); - - inputs = $$("#identityInfo input"); - inputs.each(function(i) { i.mailAccount = mailAccount; }); - if (!mailCustomFromEnabled) { - for (var i = 0; i < 2; i++) { - inputs[i].disabled = readOnly; - } - } - - var form = $("mainForm"); - - var encryption = "none"; - var encRadioValues = [ "none", "ssl", "tls" ]; - if (mailAccount["encryption"]) { - encryption = mailAccount["encryption"]; - } - form.setRadioValue("encryption", encRadioValues.indexOf(encryption)); - - var port; - if (mailAccount["port"]) { - port = mailAccount["port"]; - } - else { - if (encryption == "ssl") { - port = 993; - } - else { - port = 143; - } - } - $("port").value = port; - - $("serverName").value = mailAccount["serverName"]; - $("userName").value = mailAccount["userName"]; - $("password").value = mailAccount["password"]; - - var identity = (mailAccount["identities"] - ? mailAccount["identities"][0] - : {} ); - $("fullName").value = identity["fullName"] || ""; - $("email").value = identity["email"] || ""; - $("replyTo").value = identity["replyTo"] || ""; - - displayAccountSignature(mailAccount); - - var receiptAction = "ignore"; - var receiptActionValues = [ "ignore", "allow" ]; - if (mailAccount["receipts"] && mailAccount["receipts"]["receiptAction"]) { - receiptAction = mailAccount["receipts"]["receiptAction"]; - } - for (var i = 0; i < receiptActionValues.length; i++) { - var keyName = "receipt-action-" + receiptActionValues[i]; - var input = $(keyName); - input.mailAccount = mailAccount; - } - form.setRadioValue("receipt-action", - receiptActionValues.indexOf(receiptAction)); - var popupIds = [ "receipt-non-recipient-action", - "receipt-outside-domain-action", - "receipt-any-action" ]; - var receiptActionsDisable = (receiptAction == "ignore"); - for (var i = 0; i < popupIds.length; i++) { - var actionPopup = $(popupIds[i]); - actionPopup.disabled = receiptActionsDisable; - var settingValue = "ignore"; - var settingName = popupIds[i].cssIdToHungarianId(); - if (mailAccount["receipts"] && mailAccount["receipts"][settingName]) { - settingValue = mailAccount["receipts"][settingName]; - } - actionPopup.value = settingValue; - actionPopup.mailAccount = mailAccount; - } -} - -function displayAccountSignature(mailAccount) { - var actSignature = $("actSignature"); - actSignature.mailAccount = mailAccount; - - var actSignatureValue; - var identity = (mailAccount["identities"] - ? mailAccount["identities"][0] - : {} ); - var value = identity["signature"]; - if (value && value.length > 0) - value = value.stripTags().unescapeHTML().replace(/^[ \n\r]*/, ""); - if (value && value.length > 0) { - if (value.length < 30) { - actSignatureValue = value; - } - else { - actSignatureValue = value.substr(0, 30) + "..."; - } - } - else { - actSignatureValue = _("(Click to create)"); - } - while (actSignature.firstChild) { - actSignature.removeChild(actSignature.firstChild); - } - actSignature.update(actSignatureValue); -} - -function createMailAccount() { - var firstIdentity = mailAccounts[0]["identities"][0]; - var newIdentity = {}; - for (var k in firstIdentity) { - newIdentity[k] = firstIdentity[k]; - } - delete newIdentity["isDefault"]; - - var newMailAccount = { name: _("New Mail Account"), - serverName: "mailserver", - userName: UserLogin, - password: "", - identities: [ newIdentity ] }; - - return newMailAccount; -} - -function onMailAccountAdd(event) { - var newMailAccount = createMailAccount(); - mailAccounts.push(newMailAccount); - var li = createMailAccountLI(newMailAccount); - var mailAccountsList = $("mailAccountsList"); - mailAccountsList.appendChild(li); - var selection = mailAccountsList.getSelectedNodes(); - for (var i = 0; i < selection.length; i++) { - selection[i].deselect(); - } - displayMailAccount(newMailAccount, false); - li.selectElement(); - li.editionController.startEditing(); - - var hasChanged = $("hasChanged"); - hasChanged.value = "1"; - - event.stop(); -} - -function onMailAccountDelete(event) { - var mailAccountsList = $("mailAccountsList"); - var selection = mailAccountsList.getSelectedNodes(); - if (selection.length > 0) { - var li = selection[0]; - if (!li.readOnly) { - li.deselect(); - li.editionController = null; - var next = li.next(); - if (!next) { - next = li.previous(); - } - mailAccountsList.removeChild(li); - var index = mailAccounts.indexOf(li.mailAccount); - mailAccounts.splice(index, 1); - next.selectElement(); - displayMailAccount(next.mailAccount, next.readOnly); - - var hasChanged = $("hasChanged"); - hasChanged.value = "1"; - } - } - event.stop(); -} - -function saveMailAccounts() { - /* This removal enables us to avoid a few warning from SOPE for the inputs - that were created dynamically. */ - var editor = $("mailAccountEditor"); - - // Could be null if ModuleConstraints disables email access - if (editor) - //Instead of removing the modules, we disable it. This will prevent the window to crash if we have a connection error. - editor.select('input, select').each(function(i) { i.disable(); }) - - compactMailAccounts(); - var mailAccountsJSON = $("mailAccountsJSON"); - - if (mailAccountsJSON) - mailAccountsJSON.value = Object.toJSON(mailAccounts); -} - -function compactMailAccounts() { - - if (!mailAccounts) - return; - - for (var i = 1; i < mailAccounts.length; i++) { - var account = mailAccounts[i]; - var encryption = account["encryption"]; - if (encryption) { - if (encryption == "none") { - delete account["encryption"]; - } - } - else { - encryption = "none"; - } - var port = account["port"]; - if (port) { - if ((encryption == "ssl" && port == 993) - || port == 143) { - delete account["port"]; - } - } - } -} - -/* common function between calendar categories and mail labels */ -function onColorEdit(e, target) { - var view = $(target); - - view.select('div.colorEditing').each(function(box) { - box.removeClassName('colorEditing'); - }); - this.addClassName("colorEditing"); - - var cellPosition = this.cumulativeOffset(); - var cellDimensions = this.getDimensions(); - var div = $('colorPickerDialog'); - var divDimensions = div.getDimensions(); - var left = cellPosition[0] - divDimensions["width"]; - var top = cellPosition[1] - 165 - view.scrollTop; - div.setStyle({ left: left + "px", top: top + "px" }); - div.writeAttribute('data-target', target); - div.show(); -} - -function onColorPickerChoice(event) { - var span = getTarget(event); - var dialog = span.up('.dialog'); - var target = dialog.readAttribute('data-target'); - var newColor = "#" + span.className.substr(4); - - var wrapper = $(target); - var div = wrapper.select("div.colorEditing").first(); - - div.writeAttribute('data-color', newColor); - div.style.background = newColor; - if (parseInt($("hasChanged").value) == 0) { - var hasChanged = $("hasChanged"); - hasChanged.value = "1"; - } - - dialog.hide(); -} - -/* calendar categories */ -function resetCalendarTableActions() { - var r = $$("#calendarCategoriesListWrapper tbody tr"); - for (var i = 0; i < r.length; i++) { - var row = $(r[i]); - row.observe("mousedown", onRowClick); - var tds = row.childElements(); - var editionCtlr = new RowEditionController(); - editionCtlr.attachToRowElement(tds[0]); - tds[1].childElements()[0].observe("click", onCalendarColorEdit); - } -} - -function onCalendarColorEdit(e) { - var onCCE = onColorEdit.bind(this); - onCCE(e, "calendarCategoriesListWrapper"); -} - -function makeEditable (element) { - element.addClassName("editing"); - element.removeClassName("whiteListCell"); - - var span = element.down("SPAN"); - span.update(); - - var textField = element.down("INPUT"); - textField.show(); - textField.focus(); - textField.select(); - - return true; -} - -function endAllEditables (e) { - var r = $$("TABLE#tableViewWhiteList TBODY TR TD"); - for (var i = 0; i < r.length; i++) { - var element = $(r[i]); - if (r[i] != this && element.hasClassName("editing")) - endEditable(null, element.down("INPUT")); - } -} - -function onNameEdit (e) { - endAllEditables(); - if (!this.hasClassName("editing")) { - makeEditable (this); - } -} - -function endEditable(event, textField) { - if (!textField) - textField = this; - - var uid = textField.readAttribute("uid"); - var cell = textField.up("TD"); - var textSpan = cell.down("SPAN"); - - cell.removeClassName("editing"); - cell.addClassName("whiteListCell"); - textField.hide(); - - var tmp = textField.value; - tmp = tmp.replace (//, ">"); - if (!uid) - cell.up("TR").addClassName("notfound"); - if (tmp) - textSpan.update(tmp); - else - cell.up("TR").remove(); - - if (event) - Event.stop(event); - - return false; -} - -function onAppointmentsWhiteListAdd(e) { - var tablebody = $("appointmentsWhiteListWrapper").childNodesWithTag("table")[0].tBodies[0]; - var row = new Element("tr"); - var td = new Element("td").update(""); - var textField = new Element("input"); - var span = new Element("span"); - - row.addClassName("whiteListRow"); - row.observe("mousedown", onRowClick); - td.addClassName ("whiteListCell"); - td.observe("mousedown", endAllEditables); - td.observe("dblclick", onNameEdit); - textField.addInterface(SOGoAutoCompletionInterface); - textField.SOGoUsersSearch = true; - textField.observe("autocompletion:changed", endEditable); - textField.addClassName("textField"); - - td.appendChild(textField); - td.appendChild(span); - row.appendChild (td); - tablebody.appendChild(row); - $(tablebody).deselectAll(); - row.selectElement(); - - makeEditable(td); - -} - -function onAppointmentsWhiteListDelete(e) { - var list = $('appointmentsWhiteListWrapper').down("TABLE").down("TBODY"); - var rows = list.getSelectedNodes(); - var count = rows.length; - - for (var i=0; i < count; i++) { - rows[i].editionController = null; - rows[i].remove(); - } -} - -function serializeAppointmentsWhiteList() { - var r = $$("#appointmentsWhiteListWrapper TBODY TR"); - - var users = {}; - for (var i = 0; i < r.length; i++) { - var tds = r[i].childElements().first().down("INPUT"); - var uid = tds.getAttribute("uid"); - var value = tds.getValue(); - if (uid != null) - users[uid] = value; - } - $("whiteList").value = Object.toJSON(users); -} - -function onCalendarCategoryAdd(e) { - var row = new Element("tr"); - var nametd = new Element("td").update(""); - var colortd = new Element("td"); - var colordiv = new Element("div", {"class": "colorBox", dataColor: "#F0F0F0"}); - - row.identify(); - row.addClassName("categoryListRow"); - - nametd.addClassName("categoryListCell"); - colortd.addClassName("categoryListCell"); - colordiv.setStyle({backgroundColor: "#F0F0F0"}); - - colortd.appendChild(colordiv); - row.appendChild(nametd); - row.appendChild(colortd); - $("calendarCategoriesListWrapper").childNodesWithTag("table")[0].tBodies[0].appendChild(row); - - resetCalendarTableActions(); - nametd.editionController.startEditing(); -} - -function onCalendarCategoryDelete(e) { - var list = $('calendarCategoriesListWrapper').down("TABLE").down("TBODY"); - var rows = list.getSelectedNodes(); - var count = rows.length; - - for (var i=0; i < count; i++) { - rows[i].editionController = null; - rows[i].remove(); - } -} - -function serializeCalendarCategories() { - var r = $$("#calendarCategoriesListWrapper TBODY TR"); - - var values = []; - for (var i = 0; i < r.length; i++) { - var tds = r[i].childElements(); - var name = $(tds.first()).innerHTML.trim(); - var color = $(tds.last().childElements().first()).readAttribute('data-color'); - values.push("\"" + name + "\": \"" + color + "\""); - } - - $("calendarCategoriesValue").value = "{ " + values.join(",\n") + "}"; -} - -function resetCalendarCategoriesColors(e) { - var divs = $$("#calendarCategoriesListWrapper DIV.colorBox"); - for (var i = 0; i < divs.length; i++) { - var d = divs[i]; - var color = d.readAttribute("data-color"); - if (color != "undefined") - d.setStyle({ backgroundColor: color }); - } -} - -/* /calendar categories */ - -/* mail label/tags */ -function resetMailTableActions() { - var r = $$("#mailLabelsListWrapper tbody tr"); - for (var i = 0; i < r.length; i++) { - var row = $(r[i]); - row.observe("mousedown", onRowClick); - var tds = row.childElements(); - var editionCtlr = new RowEditionController(); - editionCtlr.attachToRowElement(tds[0]); - tds[1].childElements()[0].observe("click", onMailColorEdit); - } -} - -function onMailColorEdit(e) { - var onMCE = onColorEdit.bind(this); - onMCE(e, "mailLabelsListWrapper"); -} - -function onMailLabelAdd(e) { - var row = new Element("tr"); - var nametd = new Element("td").update(""); - var colortd = new Element("td"); - var colordiv = new Element("div", {"class": "colorBox", dataColor: "#F0F0F0"}); - - row.identify(); - row.addClassName("labelListRow"); - - nametd.addClassName("labelListCell"); - colortd.addClassName("labelListCell"); - colordiv.setStyle({backgroundColor: "#F0F0F0"}); - - colortd.appendChild(colordiv); - row.appendChild(nametd); - row.appendChild(colortd); - $("mailLabelsListWrapper").childNodesWithTag("table")[0].tBodies[0].appendChild(row); - - resetMailTableActions(); - nametd.editionController.startEditing(); -} - -function onMailLabelDelete(e) { - var list = $('mailLabelsListWrapper').down("TABLE").down("TBODY"); - var rows = list.getSelectedNodes(); - var count = rows.length; - - for (var i=0; i < count; i++) { - rows[i].editionController = null; - rows[i].remove(); - } -} - -function resetMailLabelsColors(e) { - var divs = $$("#mailLabelsListWrapper DIV.colorBox"); - for (var i = 0; i < divs.length; i++) { - var d = divs[i]; - var color = d.readAttribute('data-color'); - if (color != "undefined") - d.setStyle({ backgroundColor: color }); - } -} - -function serializeMailLabels() { - var r = $$("#mailLabelsListWrapper TBODY TR"); - - var values = []; - for (var i = 0; i < r.length; i++) { - var tds = r[i].childElements(); - var name = r[i].readAttribute("data-name"); - var label = $(tds.first()).innerHTML; - var color = $(tds.last().childElements().first()).readAttribute('data-color'); - - /* if name is null, that's because we've just added a new tag */ - if (!name) { - name = label.replace(/[ \(\)\/\{%\*<>\\\"]/g, "_"); - } - - values.push("\"" + name + "\": [\"" + label + "\", \"" + color + "\"]"); - } - - $("mailLabelsValue").value = "{ " + values.join(",\n") + "}"; -} - -/* /mail label/tags */ - - -/* contacts categories */ -function resetContactsTableActions() { - var r = $$("#contactsCategoriesListWrapper tbody tr"); - for (var i = 0; i < r.length; i++) { - var row = $(r[i]); - row.observe("mousedown", onRowClick); - var tds = row.childElements(); - var editionCtlr = new RowEditionController(); - editionCtlr.attachToRowElement(tds[0]); - } -} - -function onContactsCategoryAdd(e) { - var row = new Element("tr"); - row.identify(); - row.addClassName("categoryListRow"); - - var nametd = new Element("td").update(""); - nametd.addClassName("categoryListCell"); - row.appendChild(nametd); - var list = $('contactsCategoriesListWrapper').down("TABLE").down("TBODY"); - list.appendChild(row); - - resetContactsTableActions(); - nametd.editionController.startEditing(); -} - -function onContactsCategoryDelete(e) { - var list = $('contactsCategoriesListWrapper').down("TABLE").down("TBODY"); - var rows = list.getSelectedNodes(); - var count = rows.length; - - for (var i = 0; i < count; i++) { - rows[i].editionController = null; - rows[i].remove(); - } -} - -function serializeContactsCategories() { - var values = []; - - var tds = $$("#contactsCategoriesListWrapper TBODY TD"); - - for (var i = 0; i < tds.length; i++) { - var td = $(tds[i]); - values.push(td.allTextContent()); - } - - $("contactsCategoriesValue").value = Object.toJSON(values); -} - -/* / contact categories */ - -function onAddOutgoingAddressesCheck(checkBox) { - if (!checkBox) { - checkBox = $("addOutgoingAddresses"); - } - $("addressBookList").disabled = !checkBox.checked; -} - -function onReplyPlacementListChange() { - if ($("replyPlacementList").value == 0) { - // Reply placement is above quote, signature can be place before of after quote - $("signaturePlacementList").disabled = false; - } - else { - // Reply placement is bellow quote, signature is unconditionally placed after quote - $("signaturePlacementList").value = 1; - $("signaturePlacementList").disabled = true; - } -} - -function onComposeMessagesTypeChange(event) { - // var textArea = $('signature'); - - if (this.value == 0) /* text */ { - if (CKEDITOR.instances["signature"]) { - var content = CKEDITOR.instances["signature"].getData(); - var htmlEditorWidget = $('cke_signature'); - htmlEditorWidget.parentNode.removeChild(htmlEditorWidget); - delete CKEDITOR.instances["signature"]; - var textArea = $("signature"); - textArea.value = content; - textArea.style.display = ""; - textArea.style.visibility = ""; - } - } else { - if ($("signature") && !CKEDITOR.instances["signature"]) { - CKEDITOR.replace('signature', - { - height: "70px", - toolbar: [['Bold', 'Italic', '-', 'Link', - 'Font','FontSize','-','TextColor', - 'BGColor'] - ], - language: localeCode, - scayt_sLang: localeCode - } - ); - } - } -} - -function onChangePasswordClick(event) { - var field = $("newPasswordField"); - var confirmationField = $("newPasswordConfirmationField"); - if (field && confirmationField) { - var password = field.value; - if (password == confirmationField.value) { - if (password.length > 0) { - var loginValues = readLoginCookie(); - var policy = new PasswordPolicy(loginValues[0], - loginValues[1]); - policy.setCallbacks(onPasswordChangeSuccess, - onPasswordChangeFailure); - policy.changePassword(password); - } - else - SetLogMessage("passwordError", _("Password must not be empty."), "error"); - } - else { - SetLogMessage("passwordError", _("The passwords do not match. Please try again."), "error"); - field.focus(); - field.select(); - } - } - event.stop(); -} - -function onPasswordChangeSuccess(message) { - SetLogMessage("passwordError", message, "info"); -} - -function onPasswordChangeFailure(code, message) { - SetLogMessage("passwordError", message, "error"); -} - -document.observe("dom:loaded", initPreferences); diff --git a/UI/WebServerResources/UIxRecurrenceEditor.css b/UI/WebServerResources/UIxRecurrenceEditor.css deleted file mode 100644 index 7fa805f6b..000000000 --- a/UI/WebServerResources/UIxRecurrenceEditor.css +++ /dev/null @@ -1,92 +0,0 @@ -DIV#windowButtonz -{ position: absolute; - bottom: 0px; - left: 0px; - right: 0px; - height: 2em; - margin: 1em; - text-align: right; } - -DIV#windowButtons -{ position: absolute; - bottom: 0px; - left: 0px; - right: 15px; - height: 3em; - line-height: 2em; - vertical-align: middle; - text-align: right; } - -DIV#pageContent -{ padding: 1em; } - -TABLE.frame TH -{ font-weight: normal; - text-align: right; - width: 5em; } - -TABLE TD -{ text-align: left; } - -TABLE TD.label -{ width: 11em; } - -INPUT.textField -{ margin: 0px 0.7em; - width: 2em; } - -SPAN.datePicker INPUT.textField -{ width: 6em; } - -SPAN.datePicker SPAN IMG -{ vertical-align: top; } - -/* Days selectors */ - -DIV#week, -DIV#month -{ background-color: #fff; - border-top: 1px solid #fff; - border-left: 1px solid #fff; - border-right: 1px solid #999; - border-bottom: 1px solid #999; } - -DIV#week -{ width: 210px; /* 7*(28+2)px */ } - -DIV#month -{ width: 140px; /* 7*(18+2)px */ } - -SPAN.week -{ clear: both; - display: block; } - -SPAN.week DIV -{ border: 1px solid #fff; - cursor: pointer; - display: block; - float: left; } - -SPAN.week DIV._selected -{ background-color: #4b6983; - border-color: #4b6983; - color: #fff; } - -SPAN.week DIV P -{ display: block; - margin: 2px 0px; - padding: 0px; - text-align: center; } - -DIV#week SPAN.week DIV P -{ width: 28px; } - -DIV#month SPAN.week DIV P -{ width: 18px; } - -SPAN.week DIV:hover -{ border: 1px solid #4b6983; } - -A.calendarButton -{ right: 240px; } - diff --git a/UI/WebServerResources/UIxRecurrenceEditor.js b/UI/WebServerResources/UIxRecurrenceEditor.js deleted file mode 100644 index 02d81977e..000000000 --- a/UI/WebServerResources/UIxRecurrenceEditor.js +++ /dev/null @@ -1,404 +0,0 @@ -/* -*- Mode: java; tab-width: 2; c-label-minimum-indentation: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -var RecurrenceEditor = { - types: new Array("Daily", "Weekly", "Monthly", "Yearly"), - currentRepeatType: 0 -}; - -function onRepeatTypeChange(event) { - setRepeatType(parseInt(this.value)); -} - -function setRepeatType(type) { - var elements; - - RecurrenceEditor.currentRepeatType = type; - - for (var i = 0; i <= 3; i++) { - elements = $$("TABLE TR.recurrence" + RecurrenceEditor.types[i]); - if (i != type) - elements.each(function(row) { - row.hide(); - }); - } - elements = $$("TABLE TR.recurrence" + RecurrenceEditor.types[type]); - elements.each(function(row) { - row.show(); - }); -} - -function getSelectedDays(periodType) { - var element = $(periodType); - var elementsArray = $A(element.getElementsByTagName('DIV')); - var days = new Array(); - var dayPrefix = periodType + "Day"; - elementsArray.each(function(item) { - if (isNodeSelected(item)) { - var label = "" + item.getAttribute("id"); - days.push(label.substr(dayPrefix.length)); - } - }); - return days.join(","); -} - -function onDayClick(event) { - var element = $(this); - if (isNodeSelected(element)) - this.removeClassName("_selected"); - else - this.addClassName("_selected"); -} - -function onRangeChange(event) { - $('endDate_date').disabled = (this.value != 2); -} - -function onAdjustTime(event) { - // must be defined for date picker widget -} - -function initializeSelectors() { - $$("DIV#week SPAN.week DIV").each(function(element) { - element.observe("click", onDayClick, false); - }); - - $$("DIV#month SPAN.week DIV").each(function(element) { - element.observe("click", onDayClick, false); - }); -} - -function initializeWindowButtons() { - var okButton = $("okButton"); - var cancelButton = $("cancelButton"); - - okButton.observe("click", onEditorOkClick, false); - cancelButton.observe("click", onEditorCancelClick, false); - - var repeatType = $("repeatType"); - setRepeatType(parseInt(repeatType.value)); - repeatType.observe("change", onRepeatTypeChange, false); -} - -function initializeFormValues() { - var repeatType = parent$("repeatType").value; - - // Select repeat type - $("repeatType").value = repeatType; - - // Default values - var startTimeDate = parent$("startTime_date").value.asDate(); - $('yearlyDayField').value = startTimeDate.getDate(); - $('yearlyMonth1').value = startTimeDate.getMonth(); - $("weekDay"+startTimeDate.getDay()).addClassName("_selected"); - $("monthDay"+startTimeDate.getDate()).addClassName("_selected"); - - $('recurrence_form').setRadioValue('dailyRadioButtonName', 0); - $('recurrence_form').setRadioValue('monthlyRadioButtonName', 1); - $('recurrence_form').setRadioValue('yearlyRadioButtonName', 0); - $('endDate_date').disabled = true; - $('dailyDaysField').value = "1"; - $('weeklyWeeksField').value = "1"; - $('monthlyMonthsField').value = "1"; - $('yearlyYearsField').value = "1"; - - if (repeatType == 0) { - // Repeat daily - $('recurrence_form').setRadioValue('dailyRadioButtonName', parent$("repeat1").value); - $('dailyDaysField').value = parent$("repeat2").value; - } - else if (repeatType == 1) { - // Repeat weekly - $('weeklyWeeksField').value = parent$("repeat1").value; - // log ("div: " + weekDiv); - // log ("days: " + parent$("repeat2").value); - for (var i = 0; i < 7; i++) { - $("weekDay" + i).removeClassName("_selected"); - } - var days = "" + parent$("repeat2").value; - if (days.length > 0) { - var daysArray = days.split(","); - daysArray.each(function(index) { - $("weekDay"+index).addClassName("_selected"); - }); - } - } - else if (repeatType == 2) { - // Repeat monthly - $('monthlyMonthsField').value = parent$("repeat1").value; - $('recurrence_form').setRadioValue('monthlyRadioButtonName', parent$("repeat2").value); - $('monthlyRepeat').value = parent$("repeat3").value; - $('monthlyDay').value = parent$("repeat4").value; - var days = "" + parent$("repeat5").value; - for (var i = 0; i < 31; i++) { - $("monthDay" + (i + 1)).removeClassName("_selected"); - } - - if (days.length > 0) { - var daysArray = days.split(","); - daysArray.each(function(index) { - $("monthDay" + index).addClassName("_selected"); - }); - } - } - else if (repeatType == 3) { - // Repeat yearly - $('yearlyYearsField').value = parent$("repeat1").value; - $('recurrence_form').setRadioValue('yearlyRadioButtonName', parent$("repeat2").value); - $('yearlyDayField').value = parent$("repeat3").value; - $('yearlyMonth1').value = parent$("repeat4").value; - $('yearlyRepeat').value = parent$("repeat5").value; - $('yearlyDay').value = parent$("repeat6").value; - $('yearlyMonth2').value = parent$("repeat7").value; - } - else - repeatType = 0; - - setRepeatType(repeatType); - - var range = parent$("range1").value; - $('recurrence_form').setRadioValue('rangeRadioButtonName', range); - - if (range == 1) { - $('rangeAppointmentsField').value = parent$("range2").value; - } - else if (range == 2) { - $('endDate_date').value = parent$("range2").value; - $('endDate_date').disabled = false; - } - - $('rangeAppointmentsField').observe("click", function(event) { - // Set the range to a fixed number of appointments if user - // clicks in the range field. - $('recurrence_form').setRadioValue('rangeRadioButtonName', 1); - }); - - // Observe change of range radio buttons to activate the date picker when required - Form.getInputs($('recurrence_form'), 'radio', 'rangeRadioButtonName').each(function(input) { - input.observe("change", onRangeChange); - }); - - // Show page - $("recurrence_pattern").show(); - $("range_of_recurrence").show(); -} - -function handleDailyRecurrence() { - var validate = false; - - var radioValue = $('recurrence_form').getRadioValue('dailyRadioButtonName'); - - // We check if the dailyDaysField really contains an integer - if (radioValue == 0) { - var showError = true; - - var v = "" + $('dailyDaysField').value; - if (v.length > 0) { - v = parseInt(v); - // log("v: " + v); - if (!isNaN(v) && v > 0) { - validate = true; - showError = false; - parent$("repeat1").value = radioValue; - parent$("repeat2").value = v; - } - } - - if (showError) - window.alert(dayFieldInvalid); - } - else { - validate = true; - parent$("repeat1").value = radioValue; - } - - return validate; -} - -function handleWeeklyRecurrence() { - var validate = false; - - var showError = true; - var fieldValue = "" + $('weeklyWeeksField').value; - if (fieldValue.length > 0) { - // We check if the weeklyWeeksField really contains an integer - var v = parseInt(fieldValue); - if (!isNaN(v) && v > 0) { - validate = true; - showError = false; - parent$("repeat1").value = fieldValue; - parent$("repeat2").value = getSelectedDays("week"); - } - } - - if (showError) - window.alert(weekFieldInvalid); - - return validate; -} - -function handleMonthlyRecurrence() { - var validate = false; - - var radioValue = $('recurrence_form').getRadioValue('monthlyRadioButtonName'); - - // We check if the monthlyMonthsField really contains an integer - var showError = true; - - var fieldValue = "" + $('monthlyMonthsField').value; - if (fieldValue.length > 0) { - var v = parseInt(fieldValue); - if (!isNaN(v) && v > 0) { - validate = true; - showError = false; - parent$("repeat1").value = fieldValue; - parent$("repeat2").value = radioValue; - parent$("repeat3").value = $('monthlyRepeat').value; - parent$("repeat4").value = $('monthlyDay').value; - parent$("repeat5").value = getSelectedDays("month"); - } - } - - if (showError) - window.alert(monthFieldInvalid); - - return validate; -} - -function validateYearlyRecurrence() { - var errors = [yearFieldInvalid, monthDayFieldInvalid]; - - var errorToShow = 0; - var fieldValue = "" + $('yearlyYearsField').value; - if (fieldValue.length > 0) { - // We check if the yearlyYearsField really contains an integer - var v = parseInt(fieldValue); - if (!isNaN(v) && v > 0) { - var radioValue = $('recurrence_form').getRadioValue('yearlyRadioButtonName'); - if (radioValue == 0) { - errorToShow = 1; - fieldValue = "" + $('yearlyDayField').value; - if (fieldValue.length > 0) { - // We check if the yearlyDayField really contains an integer - var v = parseInt(fieldValue); - if (!isNaN(v) && v > 0) { - errorToShow = -1; - } - } - } - else - errorToShow = -1; - } - } - - if (errorToShow > -1) - window.alert(errors[errorToShow]); - - return (errorToShow == -1); -} - -function handleYearlyRecurrence() { - var validate = false; - - if (validateYearlyRecurrence()) { - var radioValue = $('recurrence_form').getRadioValue('yearlyRadioButtonName'); - var fieldValue = "" + $('yearlyYearsField').value; - if (fieldValue.length > 0) { - // We check if the yearlyYearsField (interval) really contains an integer - var v = parseInt(fieldValue); - if (!isNaN(v) && v > 0) { - validate = true; - showError = false; - parent$("repeat1").value = fieldValue; - parent$("repeat2").value = radioValue; - parent$("repeat3").value = $('yearlyDayField').value; - parent$("repeat4").value = $('yearlyMonth1').value; - parent$("repeat5").value = $('yearlyRepeat').value; - parent$("repeat6").value = $('yearlyDay').value; - parent$("repeat7").value = $('yearlyMonth2').value; - } - } - } - else - validate = false; - - return validate; -} - -function handleRange() { - var validate = false; - - var radioValue = $('recurrence_form').getRadioValue('rangeRadioButtonName'); - if (radioValue == 0) - validate = true; - else if (radioValue == 1) { - var showError = true; - - var fieldValue = "" + $('rangeAppointmentsField').value; - if (fieldValue.length > 0) { - // We check if the rangeAppointmentsField really contains an integer - var v = parseInt(fieldValue); - if (!isNaN(v) && v > 0) { - validate = true; - showError = false; - parent$("range2").value = fieldValue; - } - } - - if (showError) - window.alert(appointmentFieldInvalid); - } - else if (radioValue == 2) { - validate = true; - parent$("range2").value = $('endDate_date').value; - } - - if (validate) - parent$("range1").value = radioValue; - - return validate; -} - -function onEditorOkClick(event) { - preventDefault(event); - var repeatType = $("repeatType").value; - parent$("repeatType").value = repeatType; - - var validate; - if (repeatType == 0) - validate = handleDailyRecurrence(); - else if (repeatType == 1) - validate = handleWeeklyRecurrence(); - else if (repeatType == 2) - validate = handleMonthlyRecurrence(); - else - validate = handleYearlyRecurrence(); - - if (validate && handleRange()) - window.close(); -} - -function onEditorCancelClick(event) { - preventDefault(event); - window.close(); -} - -function escapeAlertMessages () { - dayFieldInvalid = dayFieldInvalid.decodeEntities(); - weekFieldInvalid = weekFieldInvalid.decodeEntities(); - monthFieldInvalid = monthFieldInvalid.decodeEntities(); - monthDayFieldInvalid = monthDayFieldInvalid.decodeEntities(); - yearFieldInvalid = yearFieldInvalid.decodeEntities(); - appointmentFieldInvalid = appointmentFieldInvalid.decodeEntities(); - recurrenceUnsupported = recurrenceUnsupported.decodeEntities(); -} - -function onRecurrenceLoadHandler() { - initializeFormValues(); - initializeSelectors(); - initializeWindowButtons(); - jQuery('#endDate_date').closest('.date').datepicker( - { autoclose: true, weekStart: parentvar('firstDayOfWeek') }); - escapeAlertMessages(); -} - -document.observe("dom:loaded", onRecurrenceLoadHandler); diff --git a/UI/WebServerResources/UIxReminderEditor.css b/UI/WebServerResources/UIxReminderEditor.css deleted file mode 100644 index 4ceb1323e..000000000 --- a/UI/WebServerResources/UIxReminderEditor.css +++ /dev/null @@ -1,76 +0,0 @@ -DIV#windowButtons -{ position: absolute; - bottom: 0px; - left: 0px; - right: 15px; - height: 3em; - line-height: 2em; - vertical-align: middle; - text-align: right; } - -DIV#pageContent -{ padding: 1em; } - -TABLE TH -{ font-weight: normal; - text-align: right; - width: 5em; } - -TABLE TD -{ text-align: left; } - -TABLE TD.label -{ width: 11em; } - -INPUT.textField -{ margin: 0 0.7em 0 0; - width: 2em; } - -SPAN.datePicker INPUT.textField -{ width: 6em; } - -/* Days selectors */ - -DIV#week, -DIV#month -{ background-color: #fff; - border-top: 1px solid #fff; - border-left: 1px solid #fff; - border-right: 1px solid #999; - border-bottom: 1px solid #999; } - -DIV#week -{ width: 210px; /* 7*(28+2)px */ } - -DIV#month -{ width: 140px; /* 7*(18+2)px */ } - -SPAN.week -{ clear: both; - display: block; } - -SPAN.week DIV -{ border: 1px solid #fff; - cursor: pointer; - display: block; - float: left; } - -SPAN.week DIV._selected -{ background-color: #4b6983; - border-color: #4b6983; - color: #fff; } - -SPAN.week DIV P -{ display: block; - margin: 2px 0px; - padding: 0px; - text-align: center; } - -DIV#week SPAN.week DIV P -{ width: 28px; } - -DIV#month SPAN.week DIV P -{ width: 18px; } - -SPAN.week DIV:hover -{ border: 1px solid #4b6983; } diff --git a/UI/WebServerResources/UIxReminderEditor.js b/UI/WebServerResources/UIxReminderEditor.js deleted file mode 100644 index 59342e3e1..000000000 --- a/UI/WebServerResources/UIxReminderEditor.js +++ /dev/null @@ -1,85 +0,0 @@ -function initializeWindowButtons() { - var okButton = $("okButton"); - var cancelButton = $("cancelButton"); - - okButton.observe("click", onEditorOkClick, false); - cancelButton.observe("click", onEditorCancelClick, false); -} - -function initializeFormValues() { - if (parent$("reminderUnit").value.length > 0) { - $("quantityField").value = parent$("reminderQuantity").value; - $("unitsList").value = parent$("reminderUnit").value; - $("relationsList").value = parent$("reminderRelation").value; - $("referencesList").value = parent$("reminderReference").value; - } - - var actionList = $("actionList"); - if (actionList) { - actionList.observe("change", onActionListChange); - var action = parent$("reminderAction").value; - if (!action) - action = "display"; - actionList.value = action; - if (action == "email") { - $("emailOrganizer").checked = (parent$("reminderEmailOrganizer").value - == "true"); - $("emailAttendees").checked = (parent$("reminderEmailAttendees").value - == "true"); - } - updateActionCheckboxes(actionList); - } -} - -function onActionListChange() { - updateActionCheckboxes(this); -} - -function updateActionCheckboxes(list) { - var disabled = (list.value != "email"); - - $("emailOrganizer").disabled = disabled; - $("emailAttendees").disabled = disabled; -} - -function onEditorOkClick(event) { - preventDefault(event); - if (parseInt($("quantityField").value) > 0) { - parent$("reminderQuantity").value = parseInt($("quantityField").value); - parent$("reminderUnit").value = $("unitsList").value; - parent$("reminderRelation").value = $("relationsList").value; - parent$("reminderReference").value = $("referencesList").value; - - var actionList = $("actionList"); - var action; - if (actionList) { - action = $("actionList").value; - parent$("reminderEmailOrganizer").value = ($("emailOrganizer").checked - ? "true" - : "false"); - - parent$("reminderEmailAttendees").value = ($("emailAttendees").checked - ? "true" - : "false"); - } - else { - action = "display"; - } - parent$("reminderAction").value = action; - window.close(); - } - else - alert(_("Invalid number.")); -} - -function onEditorCancelClick(event) { - preventDefault(event); - window.close(); -} - -function onRecurrenceLoadHandler() { - initializeFormValues(); - initializeWindowButtons(); -} - -document.observe("dom:loaded", onRecurrenceLoadHandler); diff --git a/UI/WebServerResources/UIxTaskEditor.css b/UI/WebServerResources/UIxTaskEditor.css deleted file mode 100644 index d89cb0961..000000000 --- a/UI/WebServerResources/UIxTaskEditor.css +++ /dev/null @@ -1,75 +0,0 @@ -DIV.appointmentLabel -{ display: block; - position: relative; - line-height: 1.8em; - text-align: right; - width: 3em; } - -DIV#eventView -{ overflow: hidden; - padding: .5em; } - -DIV.appointmentRightLabel -{ display: inline; - vertical-align: middle; } - -SPAN.checkBoxList#participantsCB -{ height: 7em; } - -SPAN.checkBoxList#categoriesCB -{ height: 3em; } - -DIV#participants UL.contactList -{ height: 4.5em; } - -SPAN.checkBoxList SPAN.content LABEL -{ display: inline; } - -A#changeUrlButton -{ margin-left: 1em; } - -A#detailsButton -{ position: absolute; - right: 1em; - z-index: 1; } - -SPAN.contactSelectorButtons -{ vertical-align: top; - line-height: 2em; } - -SPAN#cycleSelectionFirstLevel, -SPAN#cycleSelectionSecondLevel -{ visibility: hidden; - margin-left: 1em; } - -SPAN#cycleSelectionSecondLevel SPAN.timeDateControl -{ position: static; - margin: 0px; } - -SPAN#categoriesCB INPUT -{ border: 2px solid #000; - vertical-align: middle; - -moz-border-top-colors: #000 #fff; - -moz-border-left-colors: #000 #fff; - -moz-border-bottom-colors: #000 #fff; - -moz-border-right-colors: #000 #fff; } - -SPAN#categoriesCB LABEL -{ margin-left: 0px; - margin-right: 1em; } - -SPAN#allDay > INPUT -{ position: static; } - -SPAN.content > INPUT.textField -{ width: 390px; - width: 97%; } - -INPUT#startDateCB, -INPUT#dueDateCB, -INPUT#statusPercent, -LABEL#urlArea INPUT -{ position: static; } - -INPUT#statusPercent -{ width: 2em; } diff --git a/UI/WebServerResources/UIxTaskEditor.js b/UI/WebServerResources/UIxTaskEditor.js deleted file mode 100644 index 6fa0aa649..000000000 --- a/UI/WebServerResources/UIxTaskEditor.js +++ /dev/null @@ -1,273 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -var contactSelectorAction = 'calendars-contacts'; - -function uixEarlierDate(date1, date2) { - // can this be done in a sane way? - if (date1 && date2) { - if (date1.getYear() < date2.getYear()) return date1; - if (date1.getYear() > date2.getYear()) return date2; - // same year - if (date1.getMonth() < date2.getMonth()) return date1; - if (date1.getMonth() > date2.getMonth()) return date2; - // same month - if (date1.getDate() < date2.getDate()) return date1; - if (date1.getDate() > date2.getDate()) return date2; - } - // same day - return null; -} - -function validateDate(which, label) { - var result, dateValue; - - dateValue = this._getDate(which); - if (dateValue == null) { - alert(label); - result = false; - } else - result = dateValue; - - return result; -} - -function validateTaskEditor() { - var e, startdate, enddate, tmpdate; - - e = document.getElementById('summary'); - if (e.value.length == 0 - && !confirm(labels.validate_notitle)) - return false; - - e = document.getElementById('startTime_date'); - if (!e.disabled) { - startdate = validateDate('start', labels.validate_invalid_startdate); - if (!startdate) - return false; - } - - e = document.getElementById('dueTime_date'); - if (!e.disabled) { - enddate = validateDate('due', labels.validate_invalid_enddate); - if (!enddate) - return false; - } - - if (startdate && enddate) { - tmpdate = uixEarlierDate(startdate, enddate); - if (tmpdate == enddate) { - alert(labels.validate_endbeforestart); - return false; - } - else if (tmpdate == null /* means: same date */) { - // TODO: check time - - var startHour, startMinute, endHour, endMinute; - var matches; - - matches = document.forms[0]['startTime_time'].value.match(/([0-9]+):([0-9]+)/); - if (matches) { - startHour = parseInt(matches[1]); - startMinute = parseInt(matches[2]); - matches = document.forms[0]['dueTime_time'].value.match(/([0-9]+):([0-9]+)/); - if (matches) { - endHour = parseInt(matches[1]); - endMinute = parseInt(matches[2]); - - if (startHour > endHour) { - alert(labels.validate_endbeforestart); - return false; - } - else if (startHour == endHour) { - if (startMinute > endMinute) { - alert(labels.validate_endbeforestart); - return false; - } - } - } - else { - alert(labels.validate_invalid_enddate); - return false; - } - } - else { - alert(labels.validate_invalid_startdate); - return false; - } - } - } - - return true; -} - -function onTimeControlCheck(checkBox) { - if (checkBox) { - var inputs = checkBox.parentNode.getElementsByTagName("input"); - var selects = checkBox.parentNode.getElementsByTagName("select"); - for (var i = 0; i < inputs.length; i++) - if (inputs[i] != checkBox) - inputs[i].disabled = !checkBox.checked; - for (var i = 0; i < selects.length; i++) - if (selects[i] != checkBox) - selects[i].disabled = !checkBox.checked; - if (checkBox.id == "startDateCB") { - $("repeatList").disabled = !checkBox.checked; - $("reminderList").disabled = !checkBox.checked; - } - } -} - -function saveEvent(sender) { - if (validateTaskEditor()) - document.forms['editform'].submit(); - - return false; -} - -function startDayAsShortString() { - return dayAsShortDateString($('startTime_date')); -} - -function dueDayAsShortString() { - return dayAsShortDateString($('dueTime_date')); -} - -this._getDate = function(which) { - var date = window.timeWidgets[which]['date'].inputAsDate(); - var time = window.timeWidgets[which]['time'].value.split(":"); - date.setHours(time[0]); - date.setMinutes(time[1]); - - if (isNaN(date.getTime())) - return null; - - return date; -}; - -this._getShadowDate = function(which) { - var date = window.timeWidgets[which]['date'].getAttribute("shadow-value").asDate(); - var time = window.timeWidgets[which]['time'].getAttribute("shadow-value").split(":"); - date.setHours(time[0]); - date.setMinutes(time[1]); - - return date; -}; - -this.getStartDate = function() { - return this._getDate('start'); -}; - -this.getDueDate = function() { - return this._getDate('due'); -}; - -this.getShadowStartDate = function() { - return this._getShadowDate('start'); -}; - -this.getShadowDueDate = function() { - return this._getShadowDate('due'); -}; - -this._setDate = function(which, newDate) { - window.timeWidgets[which]['date'].setInputAsDate(newDate); - window.timeWidgets[which]['time'].value = newDate.getDisplayHoursString(); - - // Update date picker - var dateComponent = jQuery(window.timeWidgets[which]['date']).closest('.date'); - dateComponent.data('date', window.timeWidgets[which]['date'].value); - dateComponent.datepicker('update'); -}; - -this.setStartDate = function(newStartDate) { - this._setDate('start', newStartDate); -}; - -this.setDueDate = function(newDueDate) { - this._setDate('due', newDueDate); -}; - -this.onAdjustTime = function(event) { - onAdjustDueTime(event); -}; - -this.onAdjustDueTime = function(event) { - if (!window.timeWidgets['due']['date'].disabled) { - var dateDelta = (window.getStartDate().valueOf() - - window.getShadowStartDate().valueOf()); - var newDueDate = new Date(window.getDueDate().valueOf() + dateDelta); - window.setDueDate(newDueDate); - } - window.timeWidgets['start']['date'].updateShadowValue(); - window.timeWidgets['start']['time'].updateShadowValue(); -}; - -this.initTimeWidgets = function (widgets) { - this.timeWidgets = widgets; - - jQuery(widgets['start']['date']).closest('.date').datepicker({autoclose: true, weekStart: firstDayOfWeek}) - .on('changeDate', onAdjustTime); - widgets['start']['time'].on("time:change", onAdjustDueTime); - widgets['start']['time'].addInterface(SOGoTimePickerInterface); - - jQuery(widgets['due']['date']).closest('.date').datepicker({autoclose: true, weekStart: firstDayOfWeek}); - widgets['due']['time'].addInterface(SOGoTimePickerInterface); - - jQuery('#statusTime_date').closest('.date').datepicker({autoclose: true, weekStart: firstDayOfWeek}); -}; - -function onStatusListChange(event) { - var value = $("statusList").value; - var statusTimeDate = $("statusTime_date"); - var statusPercent = $("statusPercent"); - - if (value == "WONoSelectionString") { - statusTimeDate.disabled = true; - statusPercent.disabled = true; - statusPercent.value = ""; - } - else if (value == "0") { - statusTimeDate.disabled = true; - statusPercent.disabled = false; - } - else if (value == "1") { - statusTimeDate.disabled = true; - statusPercent.disabled = false; - } - else if (value == "2") { - statusTimeDate.disabled = false; - statusPercent.disabled = false; - statusPercent.value = "100"; - } - else if (value == "3") { - statusTimeDate.disabled = true; - statusPercent.disabled = true; - } - else { - statusTimeDate.disabled = true; - } -} - -function initializeStatusLine() { - var statusList = $("statusList"); - if (statusList) { - statusList.observe("change", onStatusListChange); - } -} - -function onTaskEditorLoad() { - if (readOnly == false) { - var widgets = {'start': {'date': $("startTime_date"), - 'time': $("startTime_time")}, - 'due': {'date': $("dueTime_date"), - 'time': $("dueTime_time")}}; - initTimeWidgets(widgets); - } - - // Enable or disable the reminder list - onTimeControlCheck($("startDateCB")); - - initializeStatusLine(); -} - -document.observe("dom:loaded", onTaskEditorLoad); diff --git a/UI/WebServerResources/XMLHttpRequest.js b/UI/WebServerResources/XMLHttpRequest.js deleted file mode 100644 index 4c2ca215e..000000000 --- a/UI/WebServerResources/XMLHttpRequest.js +++ /dev/null @@ -1,536 +0,0 @@ -/** -* XMLHttpRequest.js Copyright (C) 2011 Sergey Ilinsky (http://www.ilinsky.com) -* -* This work is free software; you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License as published by -* the Free Software Foundation; either version 2.1 of the License, or -* (at your option) any later version. -* -* This work is distributed in the hope that it will be useful, -* but without any warranty; without even the implied warranty of -* merchantability or fitness for a particular purpose. See the -* GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License -* along with this library; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -(function () { - - // Save reference to earlier defined object implementation (if any) - var oXMLHttpRequest = window.XMLHttpRequest; - - // Define on browser type - var bGecko = !!window.controllers; - var bIE = !!window.document.namespaces; - var bIE7 = bIE && window.navigator.userAgent.match(/MSIE 7.0/); - - // Enables "XMLHttpRequest()" call next to "new XMLHttpRequest()" - function fXMLHttpRequest() { - if (!window.XMLHttpRequest || bIE7) { - this._object = new window.ActiveXObject("Microsoft.XMLHTTP"); - } // only use initial XHR object internally if current reference to XHR is our normalized replacement - else if (window.XMLHttpRequest.isNormalizedObject) { - this._object = new oXMLHttpRequest(); - } // otherwise use whatever is currently referenced by XMLHttpRequest - else { - this._object = new window.XMLHttpRequest(); - } - this._listeners = []; - } - - // Constructor - function cXMLHttpRequest() { - return new fXMLHttpRequest; - } - cXMLHttpRequest.prototype = fXMLHttpRequest.prototype; - - // BUGFIX: Firefox with Firebug installed would break pages if not executed - if (bGecko && oXMLHttpRequest.wrapped) { - cXMLHttpRequest.wrapped = oXMLHttpRequest.wrapped; - } - - // Marker to be able to easily identify our object - cXMLHttpRequest.isNormalizedObject = true; - - // Constants - cXMLHttpRequest.UNSENT = 0; - cXMLHttpRequest.OPENED = 1; - cXMLHttpRequest.HEADERS_RECEIVED = 2; - cXMLHttpRequest.LOADING = 3; - cXMLHttpRequest.DONE = 4; - - // Interface level constants - cXMLHttpRequest.prototype.UNSENT = cXMLHttpRequest.UNSENT; - cXMLHttpRequest.prototype.OPENED = cXMLHttpRequest.OPENED; - cXMLHttpRequest.prototype.HEADERS_RECEIVED = cXMLHttpRequest.HEADERS_RECEIVED; - cXMLHttpRequest.prototype.LOADING = cXMLHttpRequest.LOADING; - cXMLHttpRequest.prototype.DONE = cXMLHttpRequest.DONE; - - // Public Properties - cXMLHttpRequest.prototype.readyState = cXMLHttpRequest.UNSENT; - cXMLHttpRequest.prototype.responseText = ''; - cXMLHttpRequest.prototype.responseXML = null; - cXMLHttpRequest.prototype.status = 0; - cXMLHttpRequest.prototype.statusText = ''; - - // Priority proposal - cXMLHttpRequest.prototype.priority = "NORMAL"; - - // Instance-level Events Handlers - cXMLHttpRequest.prototype.onreadystatechange = null; - - // Class-level Events Handlers - cXMLHttpRequest.onreadystatechange = null; - cXMLHttpRequest.onopen = null; - cXMLHttpRequest.onsend = null; - cXMLHttpRequest.onabort = null; - - // Public Methods - cXMLHttpRequest.prototype.open = function(sMethod, sUrl, bAsync, sUser, sPassword) { - // http://www.w3.org/TR/XMLHttpRequest/#the-open-method - var sLowerCaseMethod = sMethod.toLowerCase(); - if (sLowerCaseMethod == "connect" || sLowerCaseMethod == "trace" || sLowerCaseMethod == "track") { - // Using a generic error and an int - not too sure all browsers support correctly - // http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#securityerror, so, this is safer - // XXX should do better than that, but this is OT to XHR. - throw new Error(18); - } - - // Delete headers, required when object is reused - delete this._headers; - - // When bAsync parameter value is omitted, use true as default - if (arguments.length < 3) { - bAsync = true; - } - - // Save async parameter for fixing Gecko bug with missing readystatechange in synchronous requests - this._async = bAsync; - - // Set the onreadystatechange handler - var oRequest = this; - var nState = this.readyState; - var fOnUnload = null; - - // BUGFIX: IE - memory leak on page unload (inter-page leak) - if (bIE && bAsync) { - fOnUnload = function() { - if (nState != cXMLHttpRequest.DONE) { - fCleanTransport(oRequest); - // Safe to abort here since onreadystatechange handler removed - oRequest.abort(); - } - }; - window.attachEvent("onunload", fOnUnload); - } - - // Add method sniffer - if (cXMLHttpRequest.onopen) { - cXMLHttpRequest.onopen.apply(this, arguments); - } - - if (arguments.length > 4) { - this._object.open(sMethod, sUrl, bAsync, sUser, sPassword); - } else if (arguments.length > 3) { - this._object.open(sMethod, sUrl, bAsync, sUser); - } else { - this._object.open(sMethod, sUrl, bAsync); - } - - this.readyState = cXMLHttpRequest.OPENED; - fReadyStateChange(this); - - this._object.onreadystatechange = function() { - if (bGecko && !bAsync) { - return; - } - - // Synchronize state - oRequest.readyState = oRequest._object.readyState; - fSynchronizeValues(oRequest); - - // BUGFIX: Firefox fires unnecessary DONE when aborting - if (oRequest._aborted) { - // Reset readyState to UNSENT - oRequest.readyState = cXMLHttpRequest.UNSENT; - - // Return now - return; - } - - if (oRequest.readyState == cXMLHttpRequest.DONE) { - // Free up queue - delete oRequest._data; - - // Uncomment these lines for bAsync - /** - * if (bAsync) { - * fQueue_remove(oRequest); - * } - */ - - fCleanTransport(oRequest); - - // Uncomment this block if you need a fix for IE cache - /** - * // BUGFIX: IE - cache issue - * if (!oRequest._object.getResponseHeader("Date")) { - * // Save object to cache - * oRequest._cached = oRequest._object; - * - * // Instantiate a new transport object - * cXMLHttpRequest.call(oRequest); - * - * // Re-send request - * if (sUser) { - * if (sPassword) { - * oRequest._object.open(sMethod, sUrl, bAsync, sUser, sPassword); - * } else { - * oRequest._object.open(sMethod, sUrl, bAsync); - * } - * - * oRequest._object.setRequestHeader("If-Modified-Since", oRequest._cached.getResponseHeader("Last-Modified") || new window.Date(0)); - * // Copy headers set - * if (oRequest._headers) { - * for (var sHeader in oRequest._headers) { - * // Some frameworks prototype objects with functions - * if (typeof oRequest._headers[sHeader] == "string") { - * oRequest._object.setRequestHeader(sHeader, oRequest._headers[sHeader]); - * } - * } - * } - * oRequest._object.onreadystatechange = function() { - * // Synchronize state - * oRequest.readyState = oRequest._object.readyState; - * - * if (oRequest._aborted) { - * // - * oRequest.readyState = cXMLHttpRequest.UNSENT; - * - * // Return - * return; - * } - * - * if (oRequest.readyState == cXMLHttpRequest.DONE) { - * // Clean Object - * fCleanTransport(oRequest); - * - * // get cached request - * if (oRequest.status == 304) { - * oRequest._object = oRequest._cached; - * } - * - * // - * delete oRequest._cached; - * - * // - * fSynchronizeValues(oRequest); - * - * // - * fReadyStateChange(oRequest); - * - * // BUGFIX: IE - memory leak in interrupted - * if (bIE && bAsync) { - * window.detachEvent("onunload", fOnUnload); - * } - * - * } - * }; - * oRequest._object.send(null); - * - * // Return now - wait until re-sent request is finished - * return; - * }; - */ - - // BUGFIX: IE - memory leak in interrupted - if (bIE && bAsync) { - window.detachEvent("onunload", fOnUnload); - } - - // BUGFIX: Some browsers (Internet Explorer, Gecko) fire OPEN readystate twice - if (nState != oRequest.readyState) { - fReadyStateChange(oRequest); - } - - nState = oRequest.readyState; - } - }; - }; - - cXMLHttpRequest.prototype.send = function(vData) { - // Add method sniffer - if (cXMLHttpRequest.onsend) { - cXMLHttpRequest.onsend.apply(this, arguments); - } - - if (!arguments.length) { - vData = null; - } - - // BUGFIX: Safari - fails sending documents created/modified dynamically, so an explicit serialization required - // BUGFIX: IE - rewrites any custom mime-type to "text/xml" in case an XMLNode is sent - // BUGFIX: Gecko - fails sending Element (this is up to the implementation either to standard) - if (vData && vData.nodeType) { - vData = window.XMLSerializer ? new window.XMLSerializer().serializeToString(vData) : vData.xml; - if (!this._headers["Content-Type"]) { - this._object.setRequestHeader("Content-Type", "application/xml"); - } - } - - this._data = vData; - - /** - * // Add to queue - * if (this._async) { - * fQueue_add(this); - * } else { */ - fXMLHttpRequest_send(this); - /** - * } - */ - }; - - cXMLHttpRequest.prototype.abort = function() { - // Add method sniffer - if (cXMLHttpRequest.onabort) { - cXMLHttpRequest.onabort.apply(this, arguments); - } - - // BUGFIX: Gecko - unnecessary DONE when aborting - if (this.readyState > cXMLHttpRequest.UNSENT) { - this._aborted = true; - } - - this._object.abort(); - - // BUGFIX: IE - memory leak - fCleanTransport(this); - - this.readyState = cXMLHttpRequest.UNSENT; - - delete this._data; - - /* if (this._async) { - * fQueue_remove(this); - * } - */ - }; - - cXMLHttpRequest.prototype.getAllResponseHeaders = function() { - return this._object.getAllResponseHeaders(); - }; - - cXMLHttpRequest.prototype.getResponseHeader = function(sName) { - return this._object.getResponseHeader(sName); - }; - - cXMLHttpRequest.prototype.setRequestHeader = function(sName, sValue) { - // BUGFIX: IE - cache issue - if (!this._headers) { - this._headers = {}; - } - - this._headers[sName] = sValue; - - return this._object.setRequestHeader(sName, sValue); - }; - - // EventTarget interface implementation - cXMLHttpRequest.prototype.addEventListener = function(sName, fHandler, bUseCapture) { - for (var nIndex = 0, oListener; oListener = this._listeners[nIndex]; nIndex++) { - if (oListener[0] == sName && oListener[1] == fHandler && oListener[2] == bUseCapture) { - return; - } - } - - // Add listener - this._listeners.push([sName, fHandler, bUseCapture]); - }; - - cXMLHttpRequest.prototype.removeEventListener = function(sName, fHandler, bUseCapture) { - for (var nIndex = 0, oListener; oListener = this._listeners[nIndex]; nIndex++) { - if (oListener[0] == sName && oListener[1] == fHandler && oListener[2] == bUseCapture) { - break; - } - } - - // Remove listener - if (oListener) { - this._listeners.splice(nIndex, 1); - } - }; - - cXMLHttpRequest.prototype.dispatchEvent = function(oEvent) { - var oEventPseudo = { - 'type': oEvent.type, - 'target': this, - 'currentTarget': this, - 'eventPhase': 2, - 'bubbles': oEvent.bubbles, - 'cancelable': oEvent.cancelable, - 'timeStamp': oEvent.timeStamp, - 'stopPropagation': function() {}, // There is no flow - 'preventDefault': function() {}, // There is no default action - 'initEvent': function() {} // Original event object should be initialized - }; - - // Execute onreadystatechange - if (oEventPseudo.type == "readystatechange" && this.onreadystatechange) { - (this.onreadystatechange.handleEvent || this.onreadystatechange).apply(this, [oEventPseudo]); - } - - - // Execute listeners - for (var nIndex = 0, oListener; oListener = this._listeners[nIndex]; nIndex++) { - if (oListener[0] == oEventPseudo.type && !oListener[2]) { - (oListener[1].handleEvent || oListener[1]).apply(this, [oEventPseudo]); - } - } - - }; - - // - cXMLHttpRequest.prototype.toString = function() { - return '[' + "object" + ' ' + "XMLHttpRequest" + ']'; - }; - - cXMLHttpRequest.toString = function() { - return '[' + "XMLHttpRequest" + ']'; - }; - - /** - * // Queue manager - * var oQueuePending = {"CRITICAL":[],"HIGH":[],"NORMAL":[],"LOW":[],"LOWEST":[]}, - * aQueueRunning = []; - * function fQueue_add(oRequest) { - * oQueuePending[oRequest.priority in oQueuePending ? oRequest.priority : "NORMAL"].push(oRequest); - * // - * setTimeout(fQueue_process); - * }; - * - * function fQueue_remove(oRequest) { - * for (var nIndex = 0, bFound = false; nIndex < aQueueRunning.length; nIndex++) - * if (bFound) { - * aQueueRunning[nIndex - 1] = aQueueRunning[nIndex]; - * } else { - * if (aQueueRunning[nIndex] == oRequest) { - * bFound = true; - * } - * } - * - * if (bFound) { - * aQueueRunning.length--; - * } - * - * - * // - * setTimeout(fQueue_process); - * }; - * - * function fQueue_process() { - * if (aQueueRunning.length < 6) { - * for (var sPriority in oQueuePending) { - * if (oQueuePending[sPriority].length) { - * var oRequest = oQueuePending[sPriority][0]; - * oQueuePending[sPriority] = oQueuePending[sPriority].slice(1); - * // - * aQueueRunning.push(oRequest); - * // Send request - * fXMLHttpRequest_send(oRequest); - * break; - * } - * } - * } - * }; - */ - - // Helper function - function fXMLHttpRequest_send(oRequest) { - oRequest._object.send(oRequest._data); - - // BUGFIX: Gecko - missing readystatechange calls in synchronous requests - if (bGecko && !oRequest._async) { - oRequest.readyState = cXMLHttpRequest.OPENED; - - // Synchronize state - fSynchronizeValues(oRequest); - - // Simulate missing states - while (oRequest.readyState < cXMLHttpRequest.DONE) { - oRequest.readyState++; - fReadyStateChange(oRequest); - // Check if we are aborted - if (oRequest._aborted) { - return; - } - } - } - } - - function fReadyStateChange(oRequest) { - // Sniffing code - if (cXMLHttpRequest.onreadystatechange){ - cXMLHttpRequest.onreadystatechange.apply(oRequest); - } - - - // Fake event - oRequest.dispatchEvent({ - 'type': "readystatechange", - 'bubbles': false, - 'cancelable': false, - 'timeStamp': new Date().getTime() - }); - } - - function fGetDocument(oRequest) { - var oDocument = oRequest.responseXML; - var sResponse = oRequest.responseText; - // Try parsing responseText - if (bIE && sResponse && oDocument && !oDocument.documentElement && oRequest.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/)) { - oDocument = new window.ActiveXObject("Microsoft.XMLDOM"); - oDocument.async = false; - oDocument.validateOnParse = false; - oDocument.loadXML(sResponse); - } - - // Check if there is no error in document - if (oDocument){ - if ((bIE && oDocument.parseError != 0) || !oDocument.documentElement || (oDocument.documentElement && oDocument.documentElement.tagName == "parsererror")) { - return null; - } - } - return oDocument; - } - - function fSynchronizeValues(oRequest) { - try { oRequest.responseText = oRequest._object.responseText; } catch (e) {} - try { oRequest.responseXML = fGetDocument(oRequest._object); } catch (e) {} - try { oRequest.status = oRequest._object.status; } catch (e) {} - try { oRequest.statusText = oRequest._object.statusText; } catch (e) {} - } - - function fCleanTransport(oRequest) { - // BUGFIX: IE - memory leak (on-page leak) - oRequest._object.onreadystatechange = new window.Function; - } - - // Internet Explorer 5.0 (missing apply) - if (!window.Function.prototype.apply) { - window.Function.prototype.apply = function(oRequest, oArguments) { - if (!oArguments) { - oArguments = []; - } - oRequest.__func = this; - oRequest.__func(oArguments[0], oArguments[1], oArguments[2], oArguments[3], oArguments[4]); - delete oRequest.__func; - }; - } - - // Register new object with window - window.XMLHttpRequest = cXMLHttpRequest; - -})(); diff --git a/UI/WebServerResources/abcard-anonymous.png b/UI/WebServerResources/abcard-anonymous.png deleted file mode 100644 index b05f5095a..000000000 Binary files a/UI/WebServerResources/abcard-anonymous.png and /dev/null differ diff --git a/UI/WebServerResources/abcard-anyone.png b/UI/WebServerResources/abcard-anyone.png deleted file mode 100644 index 9fee0f922..000000000 Binary files a/UI/WebServerResources/abcard-anyone.png and /dev/null differ diff --git a/UI/WebServerResources/abcard.png b/UI/WebServerResources/abcard.png deleted file mode 100644 index 85aa07dc6..000000000 Binary files a/UI/WebServerResources/abcard.png and /dev/null differ diff --git a/UI/WebServerResources/ablist.png b/UI/WebServerResources/ablist.png deleted file mode 100644 index 45d81a4c8..000000000 Binary files a/UI/WebServerResources/ablist.png and /dev/null differ diff --git a/UI/WebServerResources/account-settings.png b/UI/WebServerResources/account-settings.png deleted file mode 100644 index 46b7e71d8..000000000 Binary files a/UI/WebServerResources/account-settings.png and /dev/null differ diff --git a/UI/WebServerResources/add-addressbook.png b/UI/WebServerResources/add-addressbook.png deleted file mode 100644 index f387c7b24..000000000 Binary files a/UI/WebServerResources/add-addressbook.png and /dev/null differ diff --git a/UI/WebServerResources/add-calendar.png b/UI/WebServerResources/add-calendar.png deleted file mode 100644 index 3ef04b77e..000000000 Binary files a/UI/WebServerResources/add-calendar.png and /dev/null differ diff --git a/UI/WebServerResources/add-contact.gif b/UI/WebServerResources/add-contact.gif deleted file mode 100644 index 94a8ceca9..000000000 Binary files a/UI/WebServerResources/add-contact.gif and /dev/null differ diff --git a/UI/WebServerResources/add-icon.png b/UI/WebServerResources/add-icon.png deleted file mode 100644 index f49cde3e7..000000000 Binary files a/UI/WebServerResources/add-icon.png and /dev/null differ diff --git a/UI/WebServerResources/add-user-addressbook.png b/UI/WebServerResources/add-user-addressbook.png deleted file mode 100644 index 68e7a88b6..000000000 Binary files a/UI/WebServerResources/add-user-addressbook.png and /dev/null differ diff --git a/UI/WebServerResources/add-user-calendar.png b/UI/WebServerResources/add-user-calendar.png deleted file mode 100644 index 30c392672..000000000 Binary files a/UI/WebServerResources/add-user-calendar.png and /dev/null differ diff --git a/UI/WebServerResources/add-web-calendar.png b/UI/WebServerResources/add-web-calendar.png deleted file mode 100644 index 4df36e05e..000000000 Binary files a/UI/WebServerResources/add-web-calendar.png and /dev/null differ diff --git a/UI/WebServerResources/addrbook.png b/UI/WebServerResources/addrbook.png deleted file mode 100644 index ece8fb004..000000000 Binary files a/UI/WebServerResources/addrbook.png and /dev/null differ diff --git a/UI/WebServerResources/alarm.png b/UI/WebServerResources/alarm.png deleted file mode 100644 index e8676dfde..000000000 Binary files a/UI/WebServerResources/alarm.png and /dev/null differ diff --git a/UI/WebServerResources/arrow-down.png b/UI/WebServerResources/arrow-down.png deleted file mode 100644 index 8f0ed1c2c..000000000 Binary files a/UI/WebServerResources/arrow-down.png and /dev/null differ diff --git a/UI/WebServerResources/arrow-dwn-sharp.gif b/UI/WebServerResources/arrow-dwn-sharp.gif deleted file mode 100644 index 8b265a627..000000000 Binary files a/UI/WebServerResources/arrow-dwn-sharp.gif and /dev/null differ diff --git a/UI/WebServerResources/arrow-left.png b/UI/WebServerResources/arrow-left.png deleted file mode 100644 index 0a02a6232..000000000 Binary files a/UI/WebServerResources/arrow-left.png and /dev/null differ diff --git a/UI/WebServerResources/arrow-right.png b/UI/WebServerResources/arrow-right.png deleted file mode 100644 index 0b04f17c3..000000000 Binary files a/UI/WebServerResources/arrow-right.png and /dev/null differ diff --git a/UI/WebServerResources/arrow-up.png b/UI/WebServerResources/arrow-up.png deleted file mode 100644 index 0a98b18e9..000000000 Binary files a/UI/WebServerResources/arrow-up.png and /dev/null differ diff --git a/UI/WebServerResources/attachment.gif b/UI/WebServerResources/attachment.gif deleted file mode 100644 index e12c78fb5..000000000 Binary files a/UI/WebServerResources/attachment.gif and /dev/null differ diff --git a/UI/WebServerResources/attachment.png b/UI/WebServerResources/attachment.png deleted file mode 100644 index 85f43eacd..000000000 Binary files a/UI/WebServerResources/attachment.png and /dev/null differ diff --git a/UI/WebServerResources/attendee-partstats.png b/UI/WebServerResources/attendee-partstats.png deleted file mode 100644 index c55a18ece..000000000 Binary files a/UI/WebServerResources/attendee-partstats.png and /dev/null differ diff --git a/UI/WebServerResources/attendee-roles.png b/UI/WebServerResources/attendee-roles.png deleted file mode 100644 index b714a4dd9..000000000 Binary files a/UI/WebServerResources/attendee-roles.png and /dev/null differ diff --git a/UI/WebServerResources/browser_chrome.gif b/UI/WebServerResources/browser_chrome.gif deleted file mode 100644 index 08e514583..000000000 Binary files a/UI/WebServerResources/browser_chrome.gif and /dev/null differ diff --git a/UI/WebServerResources/browser_firefox.gif b/UI/WebServerResources/browser_firefox.gif deleted file mode 100644 index d91340461..000000000 Binary files a/UI/WebServerResources/browser_firefox.gif and /dev/null differ diff --git a/UI/WebServerResources/browser_ie.gif b/UI/WebServerResources/browser_ie.gif deleted file mode 100644 index 20f97efd9..000000000 Binary files a/UI/WebServerResources/browser_ie.gif and /dev/null differ diff --git a/UI/WebServerResources/browser_safari.gif b/UI/WebServerResources/browser_safari.gif deleted file mode 100644 index 6403cd07e..000000000 Binary files a/UI/WebServerResources/browser_safari.gif and /dev/null differ diff --git a/UI/WebServerResources/btn_a_bg.png b/UI/WebServerResources/btn_a_bg.png deleted file mode 100644 index 3ab9e725f..000000000 Binary files a/UI/WebServerResources/btn_a_bg.png and /dev/null differ diff --git a/UI/WebServerResources/btn_span_bg.png b/UI/WebServerResources/btn_span_bg.png deleted file mode 100644 index 1cca1c873..000000000 Binary files a/UI/WebServerResources/btn_span_bg.png and /dev/null differ diff --git a/UI/WebServerResources/busy.gif b/UI/WebServerResources/busy.gif deleted file mode 100644 index cce32f20f..000000000 Binary files a/UI/WebServerResources/busy.gif and /dev/null differ diff --git a/UI/WebServerResources/calendar-folder-16x16.png b/UI/WebServerResources/calendar-folder-16x16.png deleted file mode 100644 index 977173e4c..000000000 Binary files a/UI/WebServerResources/calendar-folder-16x16.png and /dev/null differ diff --git a/UI/WebServerResources/calendar-reload.png b/UI/WebServerResources/calendar-reload.png deleted file mode 100644 index 3ea357d32..000000000 Binary files a/UI/WebServerResources/calendar-reload.png and /dev/null differ diff --git a/UI/WebServerResources/choose-date.png b/UI/WebServerResources/choose-date.png deleted file mode 100644 index b81fb3c18..000000000 Binary files a/UI/WebServerResources/choose-date.png and /dev/null differ diff --git a/UI/WebServerResources/collapse.png b/UI/WebServerResources/collapse.png deleted file mode 100644 index 0cb238216..000000000 Binary files a/UI/WebServerResources/collapse.png and /dev/null differ diff --git a/UI/WebServerResources/confidential.png b/UI/WebServerResources/confidential.png deleted file mode 100644 index 8af82f011..000000000 Binary files a/UI/WebServerResources/confidential.png and /dev/null differ diff --git a/UI/WebServerResources/create-account.png b/UI/WebServerResources/create-account.png deleted file mode 100644 index 6f9450c9a..000000000 Binary files a/UI/WebServerResources/create-account.png and /dev/null differ diff --git a/UI/WebServerResources/datepicker.css b/UI/WebServerResources/datepicker.css deleted file mode 100644 index 6f061df8b..000000000 --- a/UI/WebServerResources/datepicker.css +++ /dev/null @@ -1,514 +0,0 @@ -/*! - * Datepicker for Bootstrap - * - * Copyright 2012 Stefan Petre - * Improvements by Andrew Rowls - * Licensed under the Apache License v2.0 - * http://www.apache.org/licenses/LICENSE-2.0 - * - */ -.datepicker { - padding: 4px; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; - direction: ltr; - /*.dow { - border-top: 1px solid #ddd !important; - }*/ -} -.datepicker-inline { - width: 220px; -} -.datepicker.datepicker-rtl { - direction: rtl; -} -.datepicker.datepicker-rtl table tr td span { - float: right; -} -.datepicker-dropdown { - top: 0; - left: 0; -} -.datepicker-dropdown:before { - content: ''; - display: inline-block; - border-left: 7px solid transparent; - border-right: 7px solid transparent; - border-bottom: 7px solid #ccc; - border-top: 0; - border-bottom-color: rgba(0, 0, 0, 0.2); - position: absolute; -} -.datepicker-dropdown:after { - content: ''; - display: inline-block; - border-left: 6px solid transparent; - border-right: 6px solid transparent; - border-bottom: 6px solid #ffffff; - border-top: 0; - position: absolute; -} -.datepicker-dropdown.datepicker-orient-left:before { - left: 6px; -} -.datepicker-dropdown.datepicker-orient-left:after { - left: 7px; -} -.datepicker-dropdown.datepicker-orient-right:before { - right: 6px; -} -.datepicker-dropdown.datepicker-orient-right:after { - right: 7px; -} -.datepicker-dropdown.datepicker-orient-top:before { - top: -7px; -} -.datepicker-dropdown.datepicker-orient-top:after { - top: -6px; -} -.datepicker-dropdown.datepicker-orient-bottom:before { - bottom: -7px; - border-bottom: 0; - border-top: 7px solid #999; -} -.datepicker-dropdown.datepicker-orient-bottom:after { - bottom: -6px; - border-bottom: 0; - border-top: 6px solid #ffffff; -} -.datepicker > div { - display: none; -} -.datepicker.days div.datepicker-days { - display: block; -} -.datepicker.months div.datepicker-months { - display: block; -} -.datepicker.years div.datepicker-years { - display: block; -} -.datepicker table { - margin: 0; - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} -.datepicker td, -.datepicker th { - text-align: center; - width: 20px; - height: 20px; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; - border: none; -} -.table-striped .datepicker table tr td, -.table-striped .datepicker table tr th { - background-color: transparent; -} -.datepicker table tr td.day:hover, -.datepicker table tr td.day.focused { - background: #eeeeee; - cursor: pointer; -} -.datepicker table tr td.old, -.datepicker table tr td.new { - color: #999999; -} -.datepicker table tr td.disabled, -.datepicker table tr td.disabled:hover { - background: none; - color: #999999; - cursor: default; -} -.datepicker table tr td.today, -.datepicker table tr td.today:hover, -.datepicker table tr td.today.disabled, -.datepicker table tr td.today.disabled:hover { - background-color: #fde19a; - background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a); - background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a)); - background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a); - background-image: -o-linear-gradient(top, #fdd49a, #fdf59a); - background-image: linear-gradient(top, #fdd49a, #fdf59a); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a', endColorstr='#fdf59a', GradientType=0); - border-color: #fdf59a #fdf59a #fbed50; - border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); - filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); - color: #000; -} -.datepicker table tr td.today:hover, -.datepicker table tr td.today:hover:hover, -.datepicker table tr td.today.disabled:hover, -.datepicker table tr td.today.disabled:hover:hover, -.datepicker table tr td.today:active, -.datepicker table tr td.today:hover:active, -.datepicker table tr td.today.disabled:active, -.datepicker table tr td.today.disabled:hover:active, -.datepicker table tr td.today.active, -.datepicker table tr td.today:hover.active, -.datepicker table tr td.today.disabled.active, -.datepicker table tr td.today.disabled:hover.active, -.datepicker table tr td.today.disabled, -.datepicker table tr td.today:hover.disabled, -.datepicker table tr td.today.disabled.disabled, -.datepicker table tr td.today.disabled:hover.disabled, -.datepicker table tr td.today[disabled], -.datepicker table tr td.today:hover[disabled], -.datepicker table tr td.today.disabled[disabled], -.datepicker table tr td.today.disabled:hover[disabled] { - background-color: #fdf59a; -} -.datepicker table tr td.today:active, -.datepicker table tr td.today:hover:active, -.datepicker table tr td.today.disabled:active, -.datepicker table tr td.today.disabled:hover:active, -.datepicker table tr td.today.active, -.datepicker table tr td.today:hover.active, -.datepicker table tr td.today.disabled.active, -.datepicker table tr td.today.disabled:hover.active { - background-color: #fbf069 \9; -} -.datepicker table tr td.today:hover:hover { - color: #000; -} -.datepicker table tr td.today.active:hover { - color: #fff; -} -.datepicker table tr td.range, -.datepicker table tr td.range:hover, -.datepicker table tr td.range.disabled, -.datepicker table tr td.range.disabled:hover { - background: #eeeeee; - -webkit-border-radius: 0; - -moz-border-radius: 0; - border-radius: 0; -} -.datepicker table tr td.range.today, -.datepicker table tr td.range.today:hover, -.datepicker table tr td.range.today.disabled, -.datepicker table tr td.range.today.disabled:hover { - background-color: #f3d17a; - background-image: -moz-linear-gradient(top, #f3c17a, #f3e97a); - background-image: -ms-linear-gradient(top, #f3c17a, #f3e97a); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f3c17a), to(#f3e97a)); - background-image: -webkit-linear-gradient(top, #f3c17a, #f3e97a); - background-image: -o-linear-gradient(top, #f3c17a, #f3e97a); - background-image: linear-gradient(top, #f3c17a, #f3e97a); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f3c17a', endColorstr='#f3e97a', GradientType=0); - border-color: #f3e97a #f3e97a #edde34; - border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); - filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); - -webkit-border-radius: 0; - -moz-border-radius: 0; - border-radius: 0; -} -.datepicker table tr td.range.today:hover, -.datepicker table tr td.range.today:hover:hover, -.datepicker table tr td.range.today.disabled:hover, -.datepicker table tr td.range.today.disabled:hover:hover, -.datepicker table tr td.range.today:active, -.datepicker table tr td.range.today:hover:active, -.datepicker table tr td.range.today.disabled:active, -.datepicker table tr td.range.today.disabled:hover:active, -.datepicker table tr td.range.today.active, -.datepicker table tr td.range.today:hover.active, -.datepicker table tr td.range.today.disabled.active, -.datepicker table tr td.range.today.disabled:hover.active, -.datepicker table tr td.range.today.disabled, -.datepicker table tr td.range.today:hover.disabled, -.datepicker table tr td.range.today.disabled.disabled, -.datepicker table tr td.range.today.disabled:hover.disabled, -.datepicker table tr td.range.today[disabled], -.datepicker table tr td.range.today:hover[disabled], -.datepicker table tr td.range.today.disabled[disabled], -.datepicker table tr td.range.today.disabled:hover[disabled] { - background-color: #f3e97a; -} -.datepicker table tr td.range.today:active, -.datepicker table tr td.range.today:hover:active, -.datepicker table tr td.range.today.disabled:active, -.datepicker table tr td.range.today.disabled:hover:active, -.datepicker table tr td.range.today.active, -.datepicker table tr td.range.today:hover.active, -.datepicker table tr td.range.today.disabled.active, -.datepicker table tr td.range.today.disabled:hover.active { - background-color: #efe24b \9; -} -.datepicker table tr td.selected, -.datepicker table tr td.selected:hover, -.datepicker table tr td.selected.disabled, -.datepicker table tr td.selected.disabled:hover { - background-color: #9e9e9e; - background-image: -moz-linear-gradient(top, #b3b3b3, #808080); - background-image: -ms-linear-gradient(top, #b3b3b3, #808080); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#b3b3b3), to(#808080)); - background-image: -webkit-linear-gradient(top, #b3b3b3, #808080); - background-image: -o-linear-gradient(top, #b3b3b3, #808080); - background-image: linear-gradient(top, #b3b3b3, #808080); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#b3b3b3', endColorstr='#808080', GradientType=0); - border-color: #808080 #808080 #595959; - border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); - filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); - color: #fff; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); -} -.datepicker table tr td.selected:hover, -.datepicker table tr td.selected:hover:hover, -.datepicker table tr td.selected.disabled:hover, -.datepicker table tr td.selected.disabled:hover:hover, -.datepicker table tr td.selected:active, -.datepicker table tr td.selected:hover:active, -.datepicker table tr td.selected.disabled:active, -.datepicker table tr td.selected.disabled:hover:active, -.datepicker table tr td.selected.active, -.datepicker table tr td.selected:hover.active, -.datepicker table tr td.selected.disabled.active, -.datepicker table tr td.selected.disabled:hover.active, -.datepicker table tr td.selected.disabled, -.datepicker table tr td.selected:hover.disabled, -.datepicker table tr td.selected.disabled.disabled, -.datepicker table tr td.selected.disabled:hover.disabled, -.datepicker table tr td.selected[disabled], -.datepicker table tr td.selected:hover[disabled], -.datepicker table tr td.selected.disabled[disabled], -.datepicker table tr td.selected.disabled:hover[disabled] { - background-color: #808080; -} -.datepicker table tr td.selected:active, -.datepicker table tr td.selected:hover:active, -.datepicker table tr td.selected.disabled:active, -.datepicker table tr td.selected.disabled:hover:active, -.datepicker table tr td.selected.active, -.datepicker table tr td.selected:hover.active, -.datepicker table tr td.selected.disabled.active, -.datepicker table tr td.selected.disabled:hover.active { - background-color: #666666 \9; -} -.datepicker table tr td.active, -.datepicker table tr td.active:hover, -.datepicker table tr td.active.disabled, -.datepicker table tr td.active.disabled:hover { - background-color: #006dcc; - background-image: -moz-linear-gradient(top, #0088cc, #0044cc); - background-image: -ms-linear-gradient(top, #0088cc, #0044cc); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); - background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); - background-image: -o-linear-gradient(top, #0088cc, #0044cc); - background-image: linear-gradient(top, #0088cc, #0044cc); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); - border-color: #0044cc #0044cc #002a80; - border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); - filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); - color: #fff; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); -} -.datepicker table tr td.active:hover, -.datepicker table tr td.active:hover:hover, -.datepicker table tr td.active.disabled:hover, -.datepicker table tr td.active.disabled:hover:hover, -.datepicker table tr td.active:active, -.datepicker table tr td.active:hover:active, -.datepicker table tr td.active.disabled:active, -.datepicker table tr td.active.disabled:hover:active, -.datepicker table tr td.active.active, -.datepicker table tr td.active:hover.active, -.datepicker table tr td.active.disabled.active, -.datepicker table tr td.active.disabled:hover.active, -.datepicker table tr td.active.disabled, -.datepicker table tr td.active:hover.disabled, -.datepicker table tr td.active.disabled.disabled, -.datepicker table tr td.active.disabled:hover.disabled, -.datepicker table tr td.active[disabled], -.datepicker table tr td.active:hover[disabled], -.datepicker table tr td.active.disabled[disabled], -.datepicker table tr td.active.disabled:hover[disabled] { - background-color: #0044cc; -} -.datepicker table tr td.active:active, -.datepicker table tr td.active:hover:active, -.datepicker table tr td.active.disabled:active, -.datepicker table tr td.active.disabled:hover:active, -.datepicker table tr td.active.active, -.datepicker table tr td.active:hover.active, -.datepicker table tr td.active.disabled.active, -.datepicker table tr td.active.disabled:hover.active { - background-color: #003399 \9; -} -.datepicker table tr td span { - display: block; - width: 23%; - height: 54px; - line-height: 54px; - float: left; - margin: 1%; - cursor: pointer; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; -} -.datepicker table tr td span:hover { - background: #eeeeee; -} -.datepicker table tr td span.disabled, -.datepicker table tr td span.disabled:hover { - background: none; - color: #999999; - cursor: default; -} -.datepicker table tr td span.active, -.datepicker table tr td span.active:hover, -.datepicker table tr td span.active.disabled, -.datepicker table tr td span.active.disabled:hover { - background-color: #006dcc; - background-image: -moz-linear-gradient(top, #0088cc, #0044cc); - background-image: -ms-linear-gradient(top, #0088cc, #0044cc); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); - background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); - background-image: -o-linear-gradient(top, #0088cc, #0044cc); - background-image: linear-gradient(top, #0088cc, #0044cc); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); - border-color: #0044cc #0044cc #002a80; - border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); - filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); - color: #fff; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); -} -.datepicker table tr td span.active:hover, -.datepicker table tr td span.active:hover:hover, -.datepicker table tr td span.active.disabled:hover, -.datepicker table tr td span.active.disabled:hover:hover, -.datepicker table tr td span.active:active, -.datepicker table tr td span.active:hover:active, -.datepicker table tr td span.active.disabled:active, -.datepicker table tr td span.active.disabled:hover:active, -.datepicker table tr td span.active.active, -.datepicker table tr td span.active:hover.active, -.datepicker table tr td span.active.disabled.active, -.datepicker table tr td span.active.disabled:hover.active, -.datepicker table tr td span.active.disabled, -.datepicker table tr td span.active:hover.disabled, -.datepicker table tr td span.active.disabled.disabled, -.datepicker table tr td span.active.disabled:hover.disabled, -.datepicker table tr td span.active[disabled], -.datepicker table tr td span.active:hover[disabled], -.datepicker table tr td span.active.disabled[disabled], -.datepicker table tr td span.active.disabled:hover[disabled] { - background-color: #0044cc; -} -.datepicker table tr td span.active:active, -.datepicker table tr td span.active:hover:active, -.datepicker table tr td span.active.disabled:active, -.datepicker table tr td span.active.disabled:hover:active, -.datepicker table tr td span.active.active, -.datepicker table tr td span.active:hover.active, -.datepicker table tr td span.active.disabled.active, -.datepicker table tr td span.active.disabled:hover.active { - background-color: #003399 \9; -} -.datepicker table tr td span.old, -.datepicker table tr td span.new { - color: #999999; -} -.datepicker th.datepicker-switch { - width: 145px; -} -.datepicker thead tr:first-child th, -.datepicker tfoot tr th { - cursor: pointer; -} -.datepicker thead tr:first-child th:hover, -.datepicker tfoot tr th:hover { - background: #eeeeee; -} -.datepicker .cw { - font-size: 10px; - width: 12px; - padding: 0 2px 0 5px; - vertical-align: middle; -} -.datepicker thead tr:first-child th.cw { - cursor: default; - background-color: transparent; -} -.input-append.date .add-on i, -.input-prepend.date .add-on i { - cursor: pointer; - width: 16px; - height: 16px; -} -.input-daterange input { - text-align: center; -} -.input-daterange input:first-child { - -webkit-border-radius: 3px 0 0 3px; - -moz-border-radius: 3px 0 0 3px; - border-radius: 3px 0 0 3px; -} -.input-daterange input:last-child { - -webkit-border-radius: 0 3px 3px 0; - -moz-border-radius: 0 3px 3px 0; - border-radius: 0 3px 3px 0; -} -.input-daterange .add-on { - display: inline-block; - width: auto; - min-width: 16px; - height: 20px; - padding: 4px 5px; - font-weight: normal; - line-height: 20px; - text-align: center; - text-shadow: 0 1px 0 #ffffff; - vertical-align: middle; - background-color: #eeeeee; - border: 1px solid #ccc; - margin-left: -5px; - margin-right: -5px; -} -.datepicker.dropdown-menu { - position: absolute; - top: 100%; - left: 0; - z-index: 1000; - float: left; - display: none; - min-width: 160px; - list-style: none; - background-color: #ffffff; - border: 1px solid #ccc; - border: 1px solid rgba(0, 0, 0, 0.2); - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 5px; - -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); - -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); - box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); - -webkit-background-clip: padding-box; - -moz-background-clip: padding; - background-clip: padding-box; - *border-right-width: 2px; - *border-bottom-width: 2px; - color: #333333; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 13px; - line-height: 20px; -} -.datepicker.dropdown-menu th, -.datepicker.datepicker-inline th, -.datepicker.dropdown-menu td, -.datepicker.datepicker-inline td { - padding: 4px 5px; -} diff --git a/UI/WebServerResources/datepicker.js b/UI/WebServerResources/datepicker.js deleted file mode 100644 index 48af72f54..000000000 --- a/UI/WebServerResources/datepicker.js +++ /dev/null @@ -1,1671 +0,0 @@ -/* ========================================================= - * bootstrap-datepicker.js - * Repo: https://github.com/eternicode/bootstrap-datepicker/ - * Demo: http://eternicode.github.io/bootstrap-datepicker/ - * Docs: http://bootstrap-datepicker.readthedocs.org/ - * Forked from http://www.eyecon.ro/bootstrap-datepicker - * ========================================================= - * Started by Stefan Petre; improvements by Andrew Rowls + contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ========================================================= */ - -(function($, undefined){ - - var $window = $(window); - - function UTCDate(){ - return new Date(Date.UTC.apply(Date, arguments)); - } - function UTCToday(){ - var today = new Date(); - return UTCDate(today.getFullYear(), today.getMonth(), today.getDate()); - } - function alias(method){ - return function(){ - return this[method].apply(this, arguments); - }; - } - - var DateArray = (function(){ - var extras = { - get: function(i){ - return this.slice(i)[0]; - }, - contains: function(d){ - // Array.indexOf is not cross-browser; - // $.inArray doesn't work with Dates - var val = d && d.valueOf(); - for (var i=0, l=this.length; i < l; i++) - if (this[i].valueOf() === val) - return i; - return -1; - }, - remove: function(i){ - this.splice(i,1); - }, - replace: function(new_array){ - if (!new_array) - return; - if (!$.isArray(new_array)) - new_array = [new_array]; - this.clear(); - this.push.apply(this, new_array); - }, - clear: function(){ - this.length = 0; - }, - copy: function(){ - var a = new DateArray(); - a.replace(this); - return a; - } - }; - - return function(){ - var a = []; - a.push.apply(a, arguments); - $.extend(a, extras); - return a; - }; - })(); - - - // Picker object - - var Datepicker = function(element, options){ - this.dates = new DateArray(); - this.viewDate = UTCToday(); - this.focusDate = null; - - this._process_options(options); - - this.element = $(element); - this.isInline = false; - this.isInput = this.element.is('input'); - this.component = this.element.is('.date') ? this.element.find('.add-on, .input-group-addon, .btn') : false; - this.hasInput = this.component && this.element.find('input').length; - if (this.component && this.component.length === 0) - this.component = false; - - this.picker = $(DPGlobal.template); - this._buildEvents(); - this._attachEvents(); - - if (this.isInline){ - this.picker.addClass('datepicker-inline').appendTo(this.element); - } - else { - this.picker.addClass('datepicker-dropdown dropdown-menu'); - } - - if (this.o.rtl){ - this.picker.addClass('datepicker-rtl'); - } - - this.viewMode = this.o.startView; - - if (this.o.calendarWeeks) - this.picker.find('tfoot th.today') - .attr('colspan', function(i, val){ - return parseInt(val) + 1; - }); - - this._allow_update = false; - - this.setStartDate(this._o.startDate); - this.setEndDate(this._o.endDate); - this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled); - - this.fillDow(); - this.fillMonths(); - - this._allow_update = true; - - this.update(); - this.showMode(); - - if (this.isInline){ - this.show(); - } - }; - - Datepicker.prototype = { - constructor: Datepicker, - - _process_options: function(opts){ - // Store raw options for reference - this._o = $.extend({}, this._o, opts); - // Processed options - var o = this.o = $.extend({}, this._o); - - // Check if "de-DE" style date is available, if not language should - // fallback to 2 letter code eg "de" - var lang = o.language; - if (!dates[lang]){ - lang = lang.split('-')[0]; - if (!dates[lang]) - lang = defaults.language; - } - o.language = lang; - - switch (o.startView){ - case 2: - case 'decade': - o.startView = 2; - break; - case 1: - case 'year': - o.startView = 1; - break; - default: - o.startView = 0; - } - - switch (o.minViewMode){ - case 1: - case 'months': - o.minViewMode = 1; - break; - case 2: - case 'years': - o.minViewMode = 2; - break; - default: - o.minViewMode = 0; - } - - o.startView = Math.max(o.startView, o.minViewMode); - - // true, false, or Number > 0 - if (o.multidate !== true){ - o.multidate = Number(o.multidate) || false; - if (o.multidate !== false) - o.multidate = Math.max(0, o.multidate); - else - o.multidate = 1; - } - o.multidateSeparator = String(o.multidateSeparator); - - o.weekStart %= 7; - o.weekEnd = ((o.weekStart + 6) % 7); - - var format = DPGlobal.parseFormat(o.format); - if (o.startDate !== -Infinity){ - if (!!o.startDate){ - if (o.startDate instanceof Date) - o.startDate = this._local_to_utc(this._zero_time(o.startDate)); - else - o.startDate = DPGlobal.parseDate(o.startDate, format, o.language); - } - else { - o.startDate = -Infinity; - } - } - if (o.endDate !== Infinity){ - if (!!o.endDate){ - if (o.endDate instanceof Date) - o.endDate = this._local_to_utc(this._zero_time(o.endDate)); - else - o.endDate = DPGlobal.parseDate(o.endDate, format, o.language); - } - else { - o.endDate = Infinity; - } - } - - o.daysOfWeekDisabled = o.daysOfWeekDisabled||[]; - if (!$.isArray(o.daysOfWeekDisabled)) - o.daysOfWeekDisabled = o.daysOfWeekDisabled.split(/[,\s]*/); - o.daysOfWeekDisabled = $.map(o.daysOfWeekDisabled, function(d){ - return parseInt(d, 10); - }); - - var plc = String(o.orientation).toLowerCase().split(/\s+/g), - _plc = o.orientation.toLowerCase(); - plc = $.grep(plc, function(word){ - return (/^auto|left|right|top|bottom$/).test(word); - }); - o.orientation = {x: 'auto', y: 'auto'}; - if (!_plc || _plc === 'auto') - ; // no action - else if (plc.length === 1){ - switch (plc[0]){ - case 'top': - case 'bottom': - o.orientation.y = plc[0]; - break; - case 'left': - case 'right': - o.orientation.x = plc[0]; - break; - } - } - else { - _plc = $.grep(plc, function(word){ - return (/^left|right$/).test(word); - }); - o.orientation.x = _plc[0] || 'auto'; - - _plc = $.grep(plc, function(word){ - return (/^top|bottom$/).test(word); - }); - o.orientation.y = _plc[0] || 'auto'; - } - }, - _events: [], - _secondaryEvents: [], - _applyEvents: function(evs){ - for (var i=0, el, ch, ev; i < evs.length; i++){ - el = evs[i][0]; - if (evs[i].length === 2){ - ch = undefined; - ev = evs[i][1]; - } - else if (evs[i].length === 3){ - ch = evs[i][1]; - ev = evs[i][2]; - } - el.on(ev, ch); - } - }, - _unapplyEvents: function(evs){ - for (var i=0, el, ev, ch; i < evs.length; i++){ - el = evs[i][0]; - if (evs[i].length === 2){ - ch = undefined; - ev = evs[i][1]; - } - else if (evs[i].length === 3){ - ch = evs[i][1]; - ev = evs[i][2]; - } - el.off(ev, ch); - } - }, - _buildEvents: function(){ - if (this.isInput){ // single input - this._events = [ - [this.element, { - focus: $.proxy(this.show, this), - keyup: $.proxy(function(e){ - if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1) - this.update(); - }, this), - keydown: $.proxy(this.keydown, this) - }] - ]; - } - else if (this.component && this.hasInput){ // component: input + button - this._events = [ - // For components that are not readonly, allow keyboard nav - [this.element.find('input'), { - focus: $.proxy(this.show, this), - keyup: $.proxy(function(e){ - if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1) - this.update(); - }, this), - keydown: $.proxy(this.keydown, this) - }], - [this.component, { - click: $.proxy(this.show, this) - }] - ]; - } - else if (this.element.is('div')){ // inline datepicker - this.isInline = true; - } - else { - this._events = [ - [this.element, { - click: $.proxy(this.show, this) - }] - ]; - } - this._events.push( - // Component: listen for blur on element descendants - [this.element, '*', { - blur: $.proxy(function(e){ - this._focused_from = e.target; - }, this) - }], - // Input: listen for blur on element - [this.element, { - blur: $.proxy(function(e){ - this._focused_from = e.target; - }, this) - }] - ); - - this._secondaryEvents = [ - [this.picker, { - click: $.proxy(this.click, this) - }], - [$(window), { - resize: $.proxy(this.place, this) - }], - [$(document), { - 'mousedown touchstart': $.proxy(function(e){ - // Clicked outside the datepicker, hide it - if (!( - this.element.is(e.target) || - this.element.find(e.target).length || - this.picker.is(e.target) || - this.picker.find(e.target).length - )){ - this.hide(); - } - }, this) - }] - ]; - }, - _attachEvents: function(){ - this._detachEvents(); - this._applyEvents(this._events); - }, - _detachEvents: function(){ - this._unapplyEvents(this._events); - }, - _attachSecondaryEvents: function(){ - this._detachSecondaryEvents(); - this._applyEvents(this._secondaryEvents); - }, - _detachSecondaryEvents: function(){ - this._unapplyEvents(this._secondaryEvents); - }, - _trigger: function(event, altdate){ - var date = altdate || this.dates.get(-1), - local_date = this._utc_to_local(date); - - this.element.trigger({ - type: event, - date: local_date, - dates: $.map(this.dates, this._utc_to_local), - format: $.proxy(function(ix, format){ - if (arguments.length === 0){ - ix = this.dates.length - 1; - format = this.o.format; - } - else if (typeof ix === 'string'){ - format = ix; - ix = this.dates.length - 1; - } - format = format || this.o.format; - var date = this.dates.get(ix); - return DPGlobal.formatDate(date, format, this.o.language); - }, this) - }); - }, - - show: function(){ - if (!this.isInline) - this.picker.appendTo('body'); - this.picker.show(); - this.place(); - this._attachSecondaryEvents(); - this._trigger('show'); - }, - - hide: function(){ - if (this.isInline) - return; - if (!this.picker.is(':visible')) - return; - this.focusDate = null; - this.picker.hide().detach(); - this._detachSecondaryEvents(); - this.viewMode = this.o.startView; - this.showMode(); - - if ( - this.o.forceParse && - ( - this.isInput && this.element.val() || - this.hasInput && this.element.find('input').val() - ) - ) - this.setValue(); - //this._trigger('hide'); - }, - - remove: function(){ - this.hide(); - this._detachEvents(); - this._detachSecondaryEvents(); - this.picker.remove(); - delete this.element.data().datepicker; - if (!this.isInput){ - delete this.element.data().date; - } - }, - - _utc_to_local: function(utc){ - return utc && new Date(utc.getTime() + (utc.getTimezoneOffset()*60000)); - }, - _local_to_utc: function(local){ - return local && new Date(local.getTime() - (local.getTimezoneOffset()*60000)); - }, - _zero_time: function(local){ - return local && new Date(local.getFullYear(), local.getMonth(), local.getDate()); - }, - _zero_utc_time: function(utc){ - return utc && new Date(Date.UTC(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate())); - }, - - getDates: function(){ - return $.map(this.dates, this._utc_to_local); - }, - - getUTCDates: function(){ - return $.map(this.dates, function(d){ - return new Date(d); - }); - }, - - getDate: function(){ - return this._utc_to_local(this.getUTCDate()); - }, - - getUTCDate: function(){ - return new Date(this.dates.get(-1)); - }, - - setDates: function(){ - var args = $.isArray(arguments[0]) ? arguments[0] : arguments; - this.update.apply(this, args); - this._trigger('changeDate'); - this.setValue(); - }, - - setUTCDates: function(){ - var args = $.isArray(arguments[0]) ? arguments[0] : arguments; - this.update.apply(this, $.map(args, this._utc_to_local)); - this._trigger('changeDate'); - this.setValue(); - }, - - setDate: alias('setDates'), - setUTCDate: alias('setUTCDates'), - - setValue: function(){ - var formatted = this.getFormattedDate(); - if (!this.isInput){ - if (this.component){ - this.element.find('input').val(formatted).change(); - } - } - else { - this.element.val(formatted).change(); - } - }, - - getFormattedDate: function(format){ - if (format === undefined) - format = this.o.format; - - var lang = this.o.language; - return $.map(this.dates, function(d){ - return DPGlobal.formatDate(d, format, lang); - }).join(this.o.multidateSeparator); - }, - - setStartDate: function(startDate){ - this._process_options({startDate: startDate}); - this.update(); - this.updateNavArrows(); - }, - - setEndDate: function(endDate){ - this._process_options({endDate: endDate}); - this.update(); - this.updateNavArrows(); - }, - - setDaysOfWeekDisabled: function(daysOfWeekDisabled){ - this._process_options({daysOfWeekDisabled: daysOfWeekDisabled}); - this.update(); - this.updateNavArrows(); - }, - - place: function(){ - if (this.isInline) - return; - var calendarWidth = this.picker.outerWidth(), - calendarHeight = this.picker.outerHeight(), - visualPadding = 10, - windowWidth = $window.width(), - windowHeight = $window.height(), - scrollTop = $window.scrollTop(); - - var zIndex = parseInt(this.element.parents().filter(function(){ - return $(this).css('z-index') !== 'auto'; - }).first().css('z-index'))+10; - var offset = this.component ? this.component.parent().offset() : this.element.offset(); - var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false); - var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false); - var left = offset.left, - top = offset.top; - - this.picker.removeClass( - 'datepicker-orient-top datepicker-orient-bottom '+ - 'datepicker-orient-right datepicker-orient-left' - ); - - if (this.o.orientation.x !== 'auto'){ - this.picker.addClass('datepicker-orient-' + this.o.orientation.x); - if (this.o.orientation.x === 'right') - left -= calendarWidth - width; - } - // auto x orientation is best-placement: if it crosses a window - // edge, fudge it sideways - else { - // Default to left - this.picker.addClass('datepicker-orient-left'); - if (offset.left < 0) - left -= offset.left - visualPadding; - else if (offset.left + calendarWidth > windowWidth) - left = windowWidth - calendarWidth - visualPadding; - } - - // auto y orientation is best-situation: top or bottom, no fudging, - // decision based on which shows more of the calendar - var yorient = this.o.orientation.y, - top_overflow, bottom_overflow; - if (yorient === 'auto'){ - top_overflow = -scrollTop + offset.top - calendarHeight; - bottom_overflow = scrollTop + windowHeight - (offset.top + height + calendarHeight); - if (Math.max(top_overflow, bottom_overflow) === bottom_overflow) - yorient = 'top'; - else - yorient = 'bottom'; - } - this.picker.addClass('datepicker-orient-' + yorient); - if (yorient === 'top') - top += height; - else - top -= calendarHeight + parseInt(this.picker.css('padding-top')); - - this.picker.css({ - top: top, - left: left, - zIndex: zIndex - }); - }, - - _allow_update: true, - update: function(){ - if (!this._allow_update) - return; - - var oldDates = this.dates.copy(), - dates = [], - fromArgs = false; - if (arguments.length){ - $.each(arguments, $.proxy(function(i, date){ - if (date instanceof Date) - date = this._local_to_utc(date); - dates.push(date); - }, this)); - fromArgs = true; - } - else { - dates = this.isInput - ? this.element.val() - : this.element.data('date') || this.element.find('input').val(); - if (dates && this.o.multidate) - dates = dates.split(this.o.multidateSeparator); - else - dates = [dates]; - delete this.element.data().date; - } - - dates = $.map(dates, $.proxy(function(date){ - return DPGlobal.parseDate(date, this.o.format, this.o.language); - }, this)); - dates = $.grep(dates, $.proxy(function(date){ - return ( - date < this.o.startDate || - date > this.o.endDate || - !date - ); - }, this), true); - this.dates.replace(dates); - - if (this.dates.length) - this.viewDate = new Date(this.dates.get(-1)); - else if (this.viewDate < this.o.startDate) - this.viewDate = new Date(this.o.startDate); - else if (this.viewDate > this.o.endDate) - this.viewDate = new Date(this.o.endDate); - - if (fromArgs){ - // setting date by clicking - this.setValue(); - } - else if (dates.length){ - // setting date by typing - if (String(oldDates) !== String(this.dates)) - this._trigger('changeDate'); - } - if (!this.dates.length && oldDates.length) - this._trigger('clearDate'); - - this.fill(); - }, - - fillDow: function(){ - var dowCnt = this.o.weekStart, - html = ''; - if (this.o.calendarWeeks){ - var cell = ' '; - html += cell; - this.picker.find('.datepicker-days thead tr:first-child').prepend(cell); - } - while (dowCnt < this.o.weekStart + 7){ - html += ''+_(dates[this.o.language].daysMin[(dowCnt++)%7])+''; - } - html += ''; - this.picker.find('.datepicker-days thead').append(html); - }, - - fillMonths: function(){ - var html = '', - i = 0; - while (i < 12){ - html += ''+_(dates[this.o.language].monthsShort[i++])+''; - } - this.picker.find('.datepicker-months td').html(html); - }, - - setRange: function(range){ - if (!range || !range.length) - delete this.range; - else - this.range = $.map(range, function(d){ - return d.valueOf(); - }); - this.fill(); - }, - - getClassNames: function(date){ - var cls = [], - year = this.viewDate.getUTCFullYear(), - month = this.viewDate.getUTCMonth(), - today = new Date(); - if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)){ - cls.push('old'); - } - else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)){ - cls.push('new'); - } - if (this.focusDate && date.valueOf() === this.focusDate.valueOf()) - cls.push('focused'); - // Compare internal UTC date with local today, not UTC today - if (this.o.todayHighlight && - date.getUTCFullYear() === today.getFullYear() && - date.getUTCMonth() === today.getMonth() && - date.getUTCDate() === today.getDate()){ - cls.push('today'); - } - if (this.dates.contains(date) !== -1) - cls.push('active'); - if (date.valueOf() < this.o.startDate || date.valueOf() > this.o.endDate || - $.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1){ - cls.push('disabled'); - } - if (this.range){ - if (date > this.range[0] && date < this.range[this.range.length-1]){ - cls.push('range'); - } - if ($.inArray(date.valueOf(), this.range) !== -1){ - cls.push('selected'); - } - } - return cls; - }, - - fill: function(){ - var d = new Date(this.viewDate), - year = d.getUTCFullYear(), - month = d.getUTCMonth(), - startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity, - startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity, - endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity, - endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity, - todaytxt = _(dates[this.o.language].today) || dates['en'].today || '', - cleartxt = _(dates[this.o.language].clear) || dates['en'].clear || '', - tooltip; - this.picker.find('.datepicker-days thead th.datepicker-switch') - .text(_(dates[this.o.language].months[month])+' '+year); - this.picker.find('tfoot th.today') - .text(todaytxt) - .toggle(this.o.todayBtn !== false); - this.picker.find('tfoot th.clear') - .text(cleartxt) - .toggle(this.o.clearBtn !== false); - this.updateNavArrows(); - this.fillMonths(); - var prevMonth = UTCDate(year, month-1, 28), - day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth()); - prevMonth.setUTCDate(day); - prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7); - var nextMonth = new Date(prevMonth); - nextMonth.setUTCDate(nextMonth.getUTCDate() + 42); - nextMonth = nextMonth.valueOf(); - var html = []; - var clsName; - while (prevMonth.valueOf() < nextMonth){ - if (prevMonth.getUTCDay() === this.o.weekStart){ - html.push(''); - if (this.o.calendarWeeks){ - // ISO 8601: First week contains first thursday. - // ISO also states week starts on Monday, but we can be more abstract here. - var - // Start of current week: based on weekstart/current date - ws = new Date(+prevMonth + (this.o.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5), - // Thursday of this week - th = new Date(Number(ws) + (7 + 4 - ws.getUTCDay()) % 7 * 864e5), - // First Thursday of year, year from thursday - yth = new Date(Number(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay())%7*864e5), - // Calendar week: ms between thursdays, div ms per day, div 7 days - calWeek = (th - yth) / 864e5 / 7 + 1; - html.push(''+ calWeek +''); - - } - } - clsName = this.getClassNames(prevMonth); - clsName.push('day'); - - if (this.o.beforeShowDay !== $.noop){ - var before = this.o.beforeShowDay(this._utc_to_local(prevMonth)); - if (before === undefined) - before = {}; - else if (typeof(before) === 'boolean') - before = {enabled: before}; - else if (typeof(before) === 'string') - before = {classes: before}; - if (before.enabled === false) - clsName.push('disabled'); - if (before.classes) - clsName = clsName.concat(before.classes.split(/\s+/)); - if (before.tooltip) - tooltip = before.tooltip; - } - - clsName = $.unique(clsName); - html.push(''+prevMonth.getUTCDate() + ''); - if (prevMonth.getUTCDay() === this.o.weekEnd){ - html.push(''); - } - prevMonth.setUTCDate(prevMonth.getUTCDate()+1); - } - this.picker.find('.datepicker-days tbody').empty().append(html.join('')); - - var months = this.picker.find('.datepicker-months') - .find('th:eq(1)') - .text(year) - .end() - .find('span').removeClass('active'); - - $.each(this.dates, function(i, d){ - if (d.getUTCFullYear() === year) - months.eq(d.getUTCMonth()).addClass('active'); - }); - - if (year < startYear || year > endYear){ - months.addClass('disabled'); - } - if (year === startYear){ - months.slice(0, startMonth).addClass('disabled'); - } - if (year === endYear){ - months.slice(endMonth+1).addClass('disabled'); - } - - html = ''; - year = parseInt(year/10, 10) * 10; - var yearCont = this.picker.find('.datepicker-years') - .find('th:eq(1)') - .text(year + '-' + (year + 9)) - .end() - .find('td'); - year -= 1; - var years = $.map(this.dates, function(d){ - return d.getUTCFullYear(); - }), - classes; - for (var i = -1; i < 11; i++){ - classes = ['year']; - if (i === -1) - classes.push('old'); - else if (i === 10) - classes.push('new'); - if ($.inArray(year, years) !== -1) - classes.push('active'); - if (year < startYear || year > endYear) - classes.push('disabled'); - html += ''+year+''; - year += 1; - } - yearCont.html(html); - }, - - updateNavArrows: function(){ - if (!this._allow_update) - return; - - var d = new Date(this.viewDate), - year = d.getUTCFullYear(), - month = d.getUTCMonth(); - switch (this.viewMode){ - case 0: - if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear() && month <= this.o.startDate.getUTCMonth()){ - this.picker.find('.prev').css({visibility: 'hidden'}); - } - else { - this.picker.find('.prev').css({visibility: 'visible'}); - } - if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear() && month >= this.o.endDate.getUTCMonth()){ - this.picker.find('.next').css({visibility: 'hidden'}); - } - else { - this.picker.find('.next').css({visibility: 'visible'}); - } - break; - case 1: - case 2: - if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear()){ - this.picker.find('.prev').css({visibility: 'hidden'}); - } - else { - this.picker.find('.prev').css({visibility: 'visible'}); - } - if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear()){ - this.picker.find('.next').css({visibility: 'hidden'}); - } - else { - this.picker.find('.next').css({visibility: 'visible'}); - } - break; - } - }, - - click: function(e){ - e.preventDefault(); - var target = $(e.target).closest('span, td, th'), - year, month, day; - if (target.length === 1){ - switch (target[0].nodeName.toLowerCase()){ - case 'th': - switch (target[0].className){ - case 'datepicker-switch': - this.showMode(1); - break; - case 'prev': - case 'next': - var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1); - switch (this.viewMode){ - case 0: - this.viewDate = this.moveMonth(this.viewDate, dir); - this._trigger('changeMonth', this.viewDate); - break; - case 1: - case 2: - this.viewDate = this.moveYear(this.viewDate, dir); - if (this.viewMode === 1) - this._trigger('changeYear', this.viewDate); - break; - } - this.fill(); - break; - case 'today': - var date = new Date(); - date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0); - - this.showMode(-2); - var which = this.o.todayBtn === 'linked' ? null : 'view'; - this._setDate(date, which); - break; - case 'clear': - var element; - if (this.isInput) - element = this.element; - else if (this.component) - element = this.element.find('input'); - if (element) - element.val("").change(); - this.update(); - this._trigger('changeDate'); - if (this.o.autoclose) - this.hide(); - break; - } - break; - case 'span': - if (!target.is('.disabled')){ - this.viewDate.setUTCDate(1); - if (target.is('.month')){ - day = 1; - month = target.parent().find('span').index(target); - year = this.viewDate.getUTCFullYear(); - this.viewDate.setUTCMonth(month); - this._trigger('changeMonth', this.viewDate); - if (this.o.minViewMode === 1){ - this._setDate(UTCDate(year, month, day)); - } - } - else { - day = 1; - month = 0; - year = parseInt(target.text(), 10)||0; - this.viewDate.setUTCFullYear(year); - this._trigger('changeYear', this.viewDate); - if (this.o.minViewMode === 2){ - this._setDate(UTCDate(year, month, day)); - } - } - this.showMode(-1); - this.fill(); - } - break; - case 'td': - if (target.is('.day') && !target.is('.disabled')){ - day = parseInt(target.text(), 10)||1; - year = this.viewDate.getUTCFullYear(); - month = this.viewDate.getUTCMonth(); - if (target.is('.old')){ - if (month === 0){ - month = 11; - year -= 1; - } - else { - month -= 1; - } - } - else if (target.is('.new')){ - if (month === 11){ - month = 0; - year += 1; - } - else { - month += 1; - } - } - this._setDate(UTCDate(year, month, day)); - } - break; - } - } - if (this.picker.is(':visible') && this._focused_from){ - $(this._focused_from).focus(); - } - delete this._focused_from; - }, - - _toggle_multidate: function(date){ - var ix = this.dates.contains(date); - if (!date){ - this.dates.clear(); - } - else if (ix !== -1){ - this.dates.remove(ix); - } - else { - this.dates.push(date); - } - if (typeof this.o.multidate === 'number') - while (this.dates.length > this.o.multidate) - this.dates.remove(0); - }, - - _setDate: function(date, which){ - if (!which || which === 'date') - this._toggle_multidate(date && new Date(date)); - if (!which || which === 'view') - this.viewDate = date && new Date(date); - - this.fill(); - this.setValue(); - this._trigger('changeDate'); - var element; - if (this.isInput){ - element = this.element; - } - else if (this.component){ - element = this.element.find('input'); - } - if (element){ - element.change(); - } - if (this.o.autoclose && (!which || which === 'date')){ - this.hide(); - } - }, - - moveMonth: function(date, dir){ - if (!date) - return undefined; - if (!dir) - return date; - var new_date = new Date(date.valueOf()), - day = new_date.getUTCDate(), - month = new_date.getUTCMonth(), - mag = Math.abs(dir), - new_month, test; - dir = dir > 0 ? 1 : -1; - if (mag === 1){ - test = dir === -1 - // If going back one month, make sure month is not current month - // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02) - ? function(){ - return new_date.getUTCMonth() === month; - } - // If going forward one month, make sure month is as expected - // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02) - : function(){ - return new_date.getUTCMonth() !== new_month; - }; - new_month = month + dir; - new_date.setUTCMonth(new_month); - // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11 - if (new_month < 0 || new_month > 11) - new_month = (new_month + 12) % 12; - } - else { - // For magnitudes >1, move one month at a time... - for (var i=0; i < mag; i++) - // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)... - new_date = this.moveMonth(new_date, dir); - // ...then reset the day, keeping it in the new month - new_month = new_date.getUTCMonth(); - new_date.setUTCDate(day); - test = function(){ - return new_month !== new_date.getUTCMonth(); - }; - } - // Common date-resetting loop -- if date is beyond end of month, make it - // end of month - while (test()){ - new_date.setUTCDate(--day); - new_date.setUTCMonth(new_month); - } - return new_date; - }, - - moveYear: function(date, dir){ - return this.moveMonth(date, dir*12); - }, - - dateWithinRange: function(date){ - return date >= this.o.startDate && date <= this.o.endDate; - }, - - keydown: function(e){ - if (this.picker.is(':not(:visible)')){ - if (e.keyCode === 27) // allow escape to hide and re-show picker - this.show(); - return; - } - var dateChanged = false, - dir, newDate, newViewDate, - focusDate = this.focusDate || this.viewDate; - switch (e.keyCode){ - case 27: // escape - if (this.focusDate){ - this.focusDate = null; - this.viewDate = this.dates.get(-1) || this.viewDate; - this.fill(); - } - else - this.hide(); - e.preventDefault(); - break; - case 37: // left - case 39: // right - if (!this.o.keyboardNavigation) - break; - dir = e.keyCode === 37 ? -1 : 1; - if (e.ctrlKey){ - newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir); - newViewDate = this.moveYear(focusDate, dir); - this._trigger('changeYear', this.viewDate); - } - else if (e.shiftKey){ - newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir); - newViewDate = this.moveMonth(focusDate, dir); - this._trigger('changeMonth', this.viewDate); - } - else { - newDate = new Date(this.dates.get(-1) || UTCToday()); - newDate.setUTCDate(newDate.getUTCDate() + dir); - newViewDate = new Date(focusDate); - newViewDate.setUTCDate(focusDate.getUTCDate() + dir); - } - if (this.dateWithinRange(newDate)){ - this.focusDate = this.viewDate = newViewDate; - this.setValue(); - this.fill(); - e.preventDefault(); - } - break; - case 38: // up - case 40: // down - if (!this.o.keyboardNavigation) - break; - dir = e.keyCode === 38 ? -1 : 1; - if (e.ctrlKey){ - newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir); - newViewDate = this.moveYear(focusDate, dir); - this._trigger('changeYear', this.viewDate); - } - else if (e.shiftKey){ - newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir); - newViewDate = this.moveMonth(focusDate, dir); - this._trigger('changeMonth', this.viewDate); - } - else { - newDate = new Date(this.dates.get(-1) || UTCToday()); - newDate.setUTCDate(newDate.getUTCDate() + dir * 7); - newViewDate = new Date(focusDate); - newViewDate.setUTCDate(focusDate.getUTCDate() + dir * 7); - } - if (this.dateWithinRange(newDate)){ - this.focusDate = this.viewDate = newViewDate; - this.setValue(); - this.fill(); - e.preventDefault(); - } - break; - case 32: // spacebar - // Spacebar is used in manually typing dates in some formats. - // As such, its behavior should not be hijacked. - break; - case 13: // enter - focusDate = this.focusDate || this.dates.get(-1) || this.viewDate; - this._toggle_multidate(focusDate); - dateChanged = true; - this.focusDate = null; - this.viewDate = this.dates.get(-1) || this.viewDate; - this.setValue(); - this.fill(); - if (this.picker.is(':visible')){ - e.preventDefault(); - if (this.o.autoclose) - this.hide(); - } - break; - case 9: // tab - this.focusDate = null; - this.viewDate = this.dates.get(-1) || this.viewDate; - this.fill(); - this.hide(); - break; - } - if (dateChanged){ - if (this.dates.length) - this._trigger('changeDate'); - else - this._trigger('clearDate'); - var element; - if (this.isInput){ - element = this.element; - } - else if (this.component){ - element = this.element.find('input'); - } - if (element){ - element.change(); - } - } - }, - - showMode: function(dir){ - if (dir){ - this.viewMode = Math.max(this.o.minViewMode, Math.min(2, this.viewMode + dir)); - } - this.picker - .find('>div') - .hide() - .filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName) - .css('display', 'block'); - this.updateNavArrows(); - } - }; - - var DateRangePicker = function(element, options){ - this.element = $(element); - this.inputs = $.map(options.inputs, function(i){ - return i.jquery ? i[0] : i; - }); - delete options.inputs; - - $(this.inputs) - .datepicker(options) - .bind('changeDate', $.proxy(this.dateUpdated, this)); - - this.pickers = $.map(this.inputs, function(i){ - return $(i).data('datepicker'); - }); - this.updateDates(); - }; - DateRangePicker.prototype = { - updateDates: function(){ - this.dates = $.map(this.pickers, function(i){ - return i.getUTCDate(); - }); - this.updateRanges(); - }, - updateRanges: function(){ - var range = $.map(this.dates, function(d){ - return d.valueOf(); - }); - $.each(this.pickers, function(i, p){ - p.setRange(range); - }); - }, - dateUpdated: function(e){ - // `this.updating` is a workaround for preventing infinite recursion - // between `changeDate` triggering and `setUTCDate` calling. Until - // there is a better mechanism. - if (this.updating) - return; - this.updating = true; - - var dp = $(e.target).data('datepicker'), - new_date = dp.getUTCDate(), - i = $.inArray(e.target, this.inputs), - l = this.inputs.length; - if (i === -1) - return; - - $.each(this.pickers, function(i, p){ - if (!p.getUTCDate()) - p.setUTCDate(new_date); - }); - - if (new_date < this.dates[i]){ - // Date being moved earlier/left - while (i >= 0 && new_date < this.dates[i]){ - this.pickers[i--].setUTCDate(new_date); - } - } - else if (new_date > this.dates[i]){ - // Date being moved later/right - while (i < l && new_date > this.dates[i]){ - this.pickers[i++].setUTCDate(new_date); - } - } - this.updateDates(); - - delete this.updating; - }, - remove: function(){ - $.map(this.pickers, function(p){ p.remove(); }); - delete this.element.data().datepicker; - } - }; - - function opts_from_el(el, prefix){ - // Derive options from element data-attrs - var data = $(el).data(), - out = {}, inkey, - replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])'); - prefix = new RegExp('^' + prefix.toLowerCase()); - function re_lower(_,a){ - return a.toLowerCase(); - } - for (var key in data) - if (prefix.test(key)){ - inkey = key.replace(replace, re_lower); - out[inkey] = data[key]; - } - return out; - } - - function opts_from_locale(lang){ - // Derive options from locale plugins - var out = {}; - // Check if "de-DE" style date is available, if not language should - // fallback to 2 letter code eg "de" - if (!dates[lang]){ - lang = lang.split('-')[0]; - if (!dates[lang]) - return; - } - var d = dates[lang]; - $.each(locale_opts, function(i,k){ - if (k in d) - out[k] = d[k]; - }); - return out; - } - - var old = $.fn.datepicker; - $.fn.datepicker = function(option){ - var args = Array.apply(null, arguments); - args.shift(); - var internal_return; - this.each(function(){ - var $this = $(this), - data = $this.data('datepicker'), - options = typeof option === 'object' && option; - if (!data){ - var elopts = opts_from_el(this, 'date'), - // Preliminary otions - xopts = $.extend({}, defaults, elopts, options), - locopts = opts_from_locale(xopts.language), - // Options priority: js args, data-attrs, locales, defaults - opts = $.extend({}, defaults, locopts, elopts, options); - if ($this.is('.input-daterange') || opts.inputs){ - var ropts = { - inputs: opts.inputs || $this.find('input').toArray() - }; - $this.data('datepicker', (data = new DateRangePicker(this, $.extend(opts, ropts)))); - } - else { - $this.data('datepicker', (data = new Datepicker(this, opts))); - } - } - if (typeof option === 'string' && typeof data[option] === 'function'){ - internal_return = data[option].apply(data, args); - if (internal_return !== undefined) - return false; - } - }); - if (internal_return !== undefined) - return internal_return; - else - return this; - }; - - var defaults = $.fn.datepicker.defaults = { - autoclose: false, - beforeShowDay: $.noop, - calendarWeeks: false, - clearBtn: false, - daysOfWeekDisabled: [], - endDate: Infinity, - forceParse: true, - format: 'mm/dd/yyyy', - keyboardNavigation: true, - language: 'en', - minViewMode: 0, - multidate: false, - multidateSeparator: ',', - orientation: "auto", - rtl: false, - startDate: -Infinity, - startView: 0, - todayBtn: false, - todayHighlight: false, - weekStart: 0 - }; - var locale_opts = $.fn.datepicker.locale_opts = [ - 'format', - 'rtl', - 'weekStart' - ]; - $.fn.datepicker.Constructor = Datepicker; - var dates = $.fn.datepicker.dates = { - en: { - days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], - daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], - daysMin: ["a2_Sunday", "a2_Monday", "a2_Tuesday", "a2_Wednesday", "a2_Thursday", "a2_Friday", "a2_Saturday", "a2_Sunday"], - months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], - monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], - today: "Today", - clear: "Clear" - } - }; - - var DPGlobal = { - modes: [ - { - clsName: 'days', - navFnc: 'Month', - navStep: 1 - }, - { - clsName: 'months', - navFnc: 'FullYear', - navStep: 1 - }, - { - clsName: 'years', - navFnc: 'FullYear', - navStep: 10 - }], - isLeapYear: function(year){ - return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)); - }, - getDaysInMonth: function(year, month){ - return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; - }, - validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g, - nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g, - parseFormat: function(format){ - // IE treats \0 as a string end in inputs (truncating the value), - // so it's a bad format delimiter, anyway - var separators = format.replace(this.validParts, '\0').split('\0'), - parts = format.match(this.validParts); - if (!separators || !separators.length || !parts || parts.length === 0){ - throw new Error("Invalid date format."); - } - return {separators: separators, parts: parts}; - }, - parseDate: function(date, format, language){ - if (!date) - return undefined; - if (date instanceof Date) - return date; - if (typeof format === 'string') - format = DPGlobal.parseFormat(format); - var part_re = /([\-+]\d+)([dmwy])/, - parts = date.match(/([\-+]\d+)([dmwy])/g), - part, dir, i; - if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)){ - date = new Date(); - for (i=0; i < parts.length; i++){ - part = part_re.exec(parts[i]); - dir = parseInt(part[1]); - switch (part[2]){ - case 'd': - date.setUTCDate(date.getUTCDate() + dir); - break; - case 'm': - date = Datepicker.prototype.moveMonth.call(Datepicker.prototype, date, dir); - break; - case 'w': - date.setUTCDate(date.getUTCDate() + dir * 7); - break; - case 'y': - date = Datepicker.prototype.moveYear.call(Datepicker.prototype, date, dir); - break; - } - } - return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0); - } - parts = date && date.match(this.nonpunctuation) || []; - date = new Date(); - var parsed = {}, - setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'], - setters_map = { - yyyy: function(d,v){ - return d.setUTCFullYear(v); - }, - yy: function(d,v){ - return d.setUTCFullYear(2000+v); - }, - m: function(d,v){ - if (isNaN(d)) - return d; - v -= 1; - while (v < 0) v += 12; - v %= 12; - d.setUTCMonth(v); - while (d.getUTCMonth() !== v) - d.setUTCDate(d.getUTCDate()-1); - return d; - }, - d: function(d,v){ - return d.setUTCDate(v); - } - }, - val, filtered; - setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m']; - setters_map['dd'] = setters_map['d']; - date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0); - var fparts = format.parts.slice(); - // Remove noop parts - if (parts.length !== fparts.length){ - fparts = $(fparts).filter(function(i,p){ - return $.inArray(p, setters_order) !== -1; - }).toArray(); - } - // Process remainder - function match_part(){ - var m = this.slice(0, parts[i].length), - p = parts[i].slice(0, m.length); - return m === p; - } - if (parts.length === fparts.length){ - var cnt; - for (i=0, cnt = fparts.length; i < cnt; i++){ - val = parseInt(parts[i], 10); - part = fparts[i]; - if (isNaN(val)){ - switch (part){ - case 'MM': - filtered = $(dates[language].months).filter(match_part); - val = $.inArray(filtered[0], dates[language].months) + 1; - break; - case 'M': - filtered = $(dates[language].monthsShort).filter(match_part); - val = $.inArray(filtered[0], dates[language].monthsShort) + 1; - break; - } - } - parsed[part] = val; - } - var _date, s; - for (i=0; i < setters_order.length; i++){ - s = setters_order[i]; - if (s in parsed && !isNaN(parsed[s])){ - _date = new Date(date); - setters_map[s](_date, parsed[s]); - if (!isNaN(_date)) - date = _date; - } - } - } - return date; - }, - formatDate: function(date, format, language){ - if (!date) - return ''; - if (typeof format === 'string') - format = DPGlobal.parseFormat(format); - var val = { - d: date.getUTCDate(), - D: dates[language].daysShort[date.getUTCDay()], - DD: dates[language].days[date.getUTCDay()], - m: date.getUTCMonth() + 1, - M: dates[language].monthsShort[date.getUTCMonth()], - MM: dates[language].months[date.getUTCMonth()], - yy: date.getUTCFullYear().toString().substring(2), - yyyy: date.getUTCFullYear() - }; - val.dd = (val.d < 10 ? '0' : '') + val.d; - val.mm = (val.m < 10 ? '0' : '') + val.m; - date = []; - var seps = $.extend([], format.separators); - for (var i=0, cnt = format.parts.length; i <= cnt; i++){ - if (seps.length) - date.push(seps.shift()); - date.push(val[format.parts[i]]); - } - return date.join(''); - }, - headTemplate: ''+ - ''+ - '«'+ - ''+ - '»'+ - ''+ - '', - contTemplate: '', - footTemplate: ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - '' - }; - DPGlobal.template = '
    '+ - '
    '+ - ''+ - DPGlobal.headTemplate+ - ''+ - DPGlobal.footTemplate+ - '
    '+ - '
    '+ - '
    '+ - ''+ - DPGlobal.headTemplate+ - DPGlobal.contTemplate+ - DPGlobal.footTemplate+ - '
    '+ - '
    '+ - '
    '+ - ''+ - DPGlobal.headTemplate+ - DPGlobal.contTemplate+ - DPGlobal.footTemplate+ - '
    '+ - '
    '+ - '
    '; - - $.fn.datepicker.DPGlobal = DPGlobal; - - - /* DATEPICKER NO CONFLICT - * =================== */ - - $.fn.datepicker.noConflict = function(){ - $.fn.datepicker = old; - return this; - }; - - - /* DATEPICKER DATA-API - * ================== */ - - $(document).on( - 'focus.datepicker.data-api click.datepicker.data-api', - '[data-provide="datepicker"]', - function(e){ - var $this = $(this); - if ($this.data('datepicker')) - return; - e.preventDefault(); - // component click requires us to explicitly show it - $this.datepicker('show'); - } - ); - $(function(){ - $('[data-provide="datepicker-inline"]').datepicker(); - }); - -}(window.jQuery)); diff --git a/UI/WebServerResources/day-view-multicolumn.png b/UI/WebServerResources/day-view-multicolumn.png deleted file mode 100644 index e478dc881..000000000 Binary files a/UI/WebServerResources/day-view-multicolumn.png and /dev/null differ diff --git a/UI/WebServerResources/day-view.png b/UI/WebServerResources/day-view.png deleted file mode 100644 index 5f7172b09..000000000 Binary files a/UI/WebServerResources/day-view.png and /dev/null differ diff --git a/UI/WebServerResources/dialog-left.png b/UI/WebServerResources/dialog-left.png deleted file mode 100644 index 38ba2937c..000000000 Binary files a/UI/WebServerResources/dialog-left.png and /dev/null differ diff --git a/UI/WebServerResources/dialog-right.png b/UI/WebServerResources/dialog-right.png deleted file mode 100644 index dfea12bd5..000000000 Binary files a/UI/WebServerResources/dialog-right.png and /dev/null differ diff --git a/UI/WebServerResources/dialog-top.png b/UI/WebServerResources/dialog-top.png deleted file mode 100644 index 78128787a..000000000 Binary files a/UI/WebServerResources/dialog-top.png and /dev/null differ diff --git a/UI/WebServerResources/dot.png b/UI/WebServerResources/dot.png deleted file mode 100644 index fe80b779d..000000000 Binary files a/UI/WebServerResources/dot.png and /dev/null differ diff --git a/UI/WebServerResources/down-icon.png b/UI/WebServerResources/down-icon.png deleted file mode 100644 index 4ebac0a08..000000000 Binary files a/UI/WebServerResources/down-icon.png and /dev/null differ diff --git a/UI/WebServerResources/dragdot.png b/UI/WebServerResources/dragdot.png deleted file mode 100644 index 4de496c87..000000000 Binary files a/UI/WebServerResources/dragdot.png and /dev/null differ diff --git a/UI/WebServerResources/dtree.css b/UI/WebServerResources/dtree.css deleted file mode 100644 index 37638e86c..000000000 --- a/UI/WebServerResources/dtree.css +++ /dev/null @@ -1,49 +0,0 @@ -/*--------------------------------------------------| -| dTree 2.05 | www.destroydrop.com/javascript/tree/ | -|---------------------------------------------------| -| Copyright (c) 2002-2003 Geir Landrö | -|--------------------------------------------------*/ - -.dtree -{ - color: #000; - white-space: nowrap; -} - -.dtree img -{ - vertical-align: middle; - border: 0px; - padding: 0px; - margin: 0px; -} - -.dtree a -{ - cursor: default; - color: #000; - text-decoration: none; -} - -.dtree a.node -{ - white-space: nowrap; - padding: 1px 2px; - line-height: 2em; -} - -.dtree a.node:hover -{ - text-decoration: none; -} - -.dtree .clip -{ - overflow: hidden; -} - -.dTreeNode -{ height: 22px; } - -.dTreeNode._selected -{ background-color: #9ABCD8; } diff --git a/UI/WebServerResources/dtree.js b/UI/WebServerResources/dtree.js deleted file mode 100644 index 0a874b67a..000000000 --- a/UI/WebServerResources/dtree.js +++ /dev/null @@ -1,431 +0,0 @@ -/*--------------------------------------------------| - | dTree 2.05 | www.destroydrop.com/javascript/tree/ | - |---------------------------------------------------| - | Copyright (c) 2002-2003 Geir Landrö | - | | - | This script can be used freely as long as all | - | copyright messages are intact. | - | | - | Updated: 17.04.2003 | - |--------------------------------------------------*/ - -/* The content of attribute values should be quoted properly by using the - equivalent entities. */ -function dTreeQuote(str) { - return str.escapeHTML(); -} - -// Node object -function dTreeNode(id, pid, name, isParent, url, dataname, datatype, title, target, - icon, iconOpen, open) { - this.isParent = isParent; - this.id = id; - this.pid = pid; - this.name = name; - this.url = url; - this.title = title; - this.target = target; - this.icon = icon; - this.iconOpen = iconOpen; - this.dataname = dataname; - this.datatype = datatype; - this._io = open || false; - this._is = false; - this._ls = false; - this._hc = false; - this._ai = 0; - this._p; -}; - -// Tree object -function dTree(objName) { - this.obj = objName; - this.config = { - target: null, - useCookies: false - }; - this.icon = { - root: 'img/base.gif', - folder: 'img/folder.gif', - folderOpen: 'img/folderopen.gif', - node: 'img/page.gif', - empty: 'img/empty.gif', - line: 'img/line.gif', - join: 'img/join.gif', - joinBottom: 'img/joinbottom.gif', - plus: 'img/plus.gif', - plusBottom: 'img/plusbottom.gif', - minus: 'img/minus.gif', - minusBottom: 'img/minusbottom.gif', - nlPlus: 'img/nolines_plus.gif', - nlMinus: 'img/nolines_minus.gif' - }; - this.images = {}; - this.objects = {}; - this.aNodes = []; - this.aIndent = []; - this.root = new dTreeNode(-1); - this.selectedNode = null; - this.selectedFound = false; - this.completed = false; - - return this; -}; - -dTree.prototype = { - obj: null, - config: null, - icon: null, - aNodes: null, - aIndent: null, - root: null, - selectedNode: null, - selectedFound: false, - completed: false, - - // Adds a new node to the node array - add: function(id, pid, name, isParent, url, datatype, - title, target, icon, iconOpen, open) { - this.aNodes[this.aNodes.length] = new dTreeNode(id, pid, name, isParent, url, - datatype, title, target, icon, - iconOpen, open, false); - }, - - preload: function () { - this.images['line'] = new Element ("img", {"src": this.icon.line}); - this.images['empty'] = new Element ("img", {"src": this.icon.empty}); - this.images['plus'] = new Element ("img", {"src": this.icon.plus}); - this.images['minus'] = new Element ("img", {"src": this.icon.minus}); - this.images['plusbottom'] = new Element ("img", {"src": this.icon.plusBottom}); - this.images['minusbottom'] = new Element ("img", {"src": this.icon.minusBottom}); - this.images['join'] = new Element ("img", {"src": this.icon.join}); - this.images['joinbottom'] = new Element ("img", {"src": this.icon.joinBottom}); - - this.objects['link'] = new Element ("a", {"href": "#"}); - this.objects['nodelink'] = new Element ("a", {"href": "#", "class": "node"}); - this.objects['div'] = new Element ("div"); - this.objects['nodediv'] = new Element ("div", {"class": "dTreeNode"}); - this.objects['clipdiv'] = new Element ("div", {"class": "clip"}); - this.objects['namespan'] = new Element ("span", {"class": "nodeName"}); - this.objects['image'] = new Element ("img"); - }, - - - // Open/close all nodes - openAll: function() { - this.oAll(true); - }, - closeAll: function() { - this.oAll(false); - }, - - // Outputs the tree to the page - domObject: function() { - var div = this.objects["div"].cloneNode (true); - div.id = this.obj; - div.addClassName ("dtree"); - if (this.config.useCookies) - this.selectedNode = this.getSelected(); - this.addNode (this.root, div); - if (!this.selectedFound) this.selectedNode = null; - this.completed = true; - return div; - }, - - // Creates the tree structure - addNode: function(pNode, container) { - var n=0; - for (n; n DIV.highlighted -{ background-color: #ddf; } - */ - -/* content lists */ -td.tbtv_actcell -{ border-width: 1px; - border-style: solid; - border-top-color: #808080; - border-left-color: #808080; - border-bottom-color: #808080; - border-right-color: #808080; - padding-top: 4px; - padding-bottom: 3px; - padding-left: 4px; - padding-right: 4px; } - -TD.headerCell, -TH.headerCell, -TD.tbtv_headercell, -TH.tbtv_headercell, -TD.tbtv_navcell, -TH.tbtv_navcell -{ vertical-align: middle; - background: transparent url('thead_bg.png') repeat-x top right; - border: 1px solid #9B9B9B; - border-left: none; - text-align: left; - font-weight: normal; - background-color: #E7E7E7; - height: 20px;} - -TD.sortableTableHeader:active, -TH.sortableTableHeader:active -{ background-position: bottom left; } - -TD.headerCell SPAN, -TH.headerCell SPAN, -TD.tbtv_headercell SPAN, -TH.tbtv_headercell SPAN -{ float: left; } - -TD.tbtv_headercell A, -TH.tbtv_headercell A -{ cursor: default; - margin: 0px auto; - display: block; - color: black; } - -TD.tbtv_headercell A:hover, -TH.tbtv_headercell A:hover -{ margin: 0px auto; - display: block; - color: black; - text-decoration: none; - /* background-color: #C4C0B8; */ -} - -IMG.sortImage, -TD.headerCell IMG.tbtv_sortcell, -TD.tbtv_headercell IMG.tbtv_sortcell, -TH.tbtv_headercell IMG.tbtv_sortcell -{ float: right; - text-align: right; - border: 0px; - width: 12px; - height: 12px; - top:0;} - -.tableview -{ cursor: default; - vertical-align: top; } - -TR.tableview TD -{ white-space: nowrap; - padding-left: .3em; - padding-right: .3em; } - -TD.headerDateTime -{ min-width: 30em; } - -TD.headerTitle -{ width: 20%; } - -TD.headerLocation, -TD.headerCalendarName, -TD.headerCategory -{ min-width: 15em; - width: 15em; } - -td img.tbtv_sortcell -{ float: right; - text-align: right; - margin-top: .2em; - border: 0px; - width: 12px; - height: 12px; } - -TD.subjectCell, -TD.tbtv_subject_headercell -{ overflow: hidden; } - -/* drag handles */ -DIV.dragHandle -{ position: absolute; - z-index: 1; - background: #E6E7E6 url("dragdot.png") no-repeat center center; } - -DIV.dragHandle:active -{ background-color: #99a; } - -/* search fields */ -DIV.filterPanel -{ height: 2em; - vertical-align: middle; - width: 100%; - padding-top: 3px; -} - -DIV#javascriptSafetyNet -{ position: absolute; - background-color: transparent; - left: 0px; - right: 0px; - top: 0px; - bottom: 0px; } - -DIV.javascriptPopupBackground -{ position: absolute; - background-color: #999; - -moz-opacity: 0.6; - opacity: 0.6; - z-index: 2; - top: 0px; - left: 0px; - right: 0px; - bottom: 0px; - text-align: center; } - -DIV.javascriptMessagePseudoWindow, -DIV.javascriptMessagePseudoTopWindow -{ position: absolute; - z-index: 2; - border-bottom: 2px solid #888; - padding: 1em; - margin: 0px auto; - color: #262B33; - background-color: #E6E7E6; - -moz-border-bottom-colors: #000 #9c9a94 transparent; - -moz-opacity: 1.0; - opacity: 1.0; } - -DIV.javascriptMessagePseudoTopWindow -{ border-top: 0px; - border-left: 0px; - border-right: 0px; } - -DIV.javascriptMessagePseudoWindow -{ border-top: 2px solid #fff; - border-left: 2px solid #fff; - border-right: 2px solid #888; - -moz-border-top-colors: #efebe7 #fff; - -moz-border-left-colors: #efebe7 #fff; - -moz-border-right-colors: #000 #9c9a94 transparent; } - -DIV.noJavascriptErrorMessage -{ top: 10em; - left: 17em; - width: 24em; } - -DIV.noJavascriptErrorMessage A -{ float: right; - margin: 0px auto; } - -LI.denied -{ color: #999; } - -.popupMenu LI:hover, -.popupMenu LI.selected, -LI._selected, -TR._selected > TD, -TD._selected -{ - background-color: #9ABCD8 !important; - color: #fff; -} - -LI._selected.denied -{ - background-color: #f33; -} - -.hidden -{ display: none; } - -/* folder tree (js) )*/ -DIV.dTreeNode A SPAN.nodeName -{ - margin: 0px .2em; - padding: 0px .2em; - display: inline-block; -} - -DIV.dTreeNode A._selected SPAN.nodeName -{ - background-color: #9ABCD8; - color: #fff; -} - -/* drag'n'drop */ - -DIV.dTreeNode SPAN._dragOver -{ - background-color: #9ABCD8; - color: #fff; -} - -.genericHoverClass -{ - background-color: #9ABCD8 !important; - color: #fff !important; - -webkit-border-radius: 4px; - border-radius: 4px; -} - -/* resizable columns */ - -TABLE TD.resize-handle-active, -TABLE TH.resize-handle-active -{ cursor: e-resize; } - -DIV.resize-handle -{ cursor: e-resize; - width: 2px; - border-right: 1px solid #fff; - position: absolute; - top: 0px; - left: 0px; } - -DIV.dialog -{ position: absolute; - width: 350px; - z-index: 1000; - background-color: #fff; - border: 1px solid #ccc; - border: 1px solid rgba(0, 0, 0, 0.2); - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 5px; - -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); - -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); - box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); - -webkit-background-clip: padding-box; - -moz-background-clip: padding; - background-clip: padding-box; - *border-right-width: 2px; - *border-bottom-width: 2px; - color: #000; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 13px; - line-height: 18px; } - -DIV.dialog > DIV -{ padding: 5px 10px; } - -.dialog.left > DIV { - padding-right: 5px; -} -.dialog.left > DIV:before { - content: ''; - display: inline-block; - border-top: 7px solid transparent; - border-bottom: 7px solid transparent; - border-right: 7px solid #ccc; - border-right-color: rgba(0, 0, 0, 0.2); - position: absolute; - left: -7px; - top: 6px; -} -.dialog.left > DIV:after { - content: ''; - display: inline-block; - border-top: 6px solid transparent; - border-bottom: 6px solid transparent; - border-right: 6px solid #ffffff; - position: absolute; - left: -6px; - top: 7px; -} - -.dialog.right > DIV { - padding-left: 5px; -} -.dialog.right > DIV:before { - content: ''; - display: inline-block; - border-top: 7px solid transparent; - border-bottom: 7px solid transparent; - border-left: 7px solid #ccc; - border-left-color: rgba(0, 0, 0, 0.2); - position: absolute; - right: -7px; - top: 6px; -} -.dialog.right > DIV:after { - content: ''; - display: inline-block; - border-top: 6px solid transparent; - border-bottom: 6px solid transparent; - border-left: 6px solid #ffffff; - position: absolute; - right: -6px; - top: 7px; -} - -DIV.dialog.none -{ position: relative; - margin: 0px; - padding: 0px; - opacity: 1; - margin: 100px auto; /* top margin could be dynamically set depending on window height */ } - -DIV.dialog.none > DIV -{ padding: 10px; } - -DIV.dialog DIV.muted -{ font-size: smaller; - padding: 0; } - -DIV.dialog HR -{ clear: both; - height: 0px; - margin: 0px; - padding: 0px; - color: #fff; - border: 0px; } - -DIV.dialog H3 -{ margin: 0; } - -DIV.dialog.none P -{ margin: 0px; - padding: 5px 0px; } - -DIV.dialog P.prompt -{ text-align: right; } - -DIV.dialog P.list, -DIV.dialog UL -{ max-height: 200px; - overflow-y: auto; } - -DIV.dialog UL -{ list-style-type: none; - padding-left: 20px; } - -DIV.dialog UL LI -{ margin-bottom: 10px; } - -DIV.dialog .button -{ font-family: Lucida Grande, Bitstream VeraSans, Tahoma, sans-serif; - font-size: 8pt; - margin-top: 10px; } - -DIV#bgFrameDiv -{ position: absolute; - top: 0px; left: 0px; - bottom: 0px; - right: 0px; - z-index: 2; - background: -webkit-radial-gradient(ellipse cover,rgba(0, 0, 0, .1) 0,rgba(0, 0, 0, .1) 20%,rgba(0, 0, 0, .7) 80%); - background: -moz-linear-gradient(top, rgba(0, 0, 0, .5), rgba(0, 0, 0, .1)); } - -DIV#bgDialogDiv -{ position: absolute; - top: 0px; left: 0px; - bottom: 0px; - right: 0px; - z-index: 2; - background: -webkit-radial-gradient(ellipse cover,rgba(0, 0, 0, .1) 0,rgba(0, 0, 0, .1) 20%,rgba(0, 0, 0, .7) 80%); - background: -moz-linear-gradient(top, rgba(0, 0, 0, .5), rgba(0, 0, 0, .1)); } - -/* INPUT styles */ -TEXTAREA -{ vertical-align: top; } - -DIV, TEXTAREA, INPUT, SELECT -{ font-family: inherit; - font-size: 8pt; - font-size: inherit; } - -INPUT[type="text"], INPUT[type="password"], -TEXTAREA -{ border-top: 1px solid #909090; - border-left: 1px solid #909090; - border-bottom: 1px solid #EFF0EF; - border-right: 1px solid #EFF0EF; - background-color: #CCDDEC; - color: #262B33; } - -INPUT[disabled], INPUT[readonly], -SELECT[disabled], SELECT[readonly], -TEXTAREA[disabled], TEXTAREA[readonly] -{ background: #E6E7E6; - border-color: #ccc; - color: #9ABCD8; } - -INPUT[type="text"], INPUT[type="password"], TEXTAREA -{ background: url("input_bg.gif"); } - -TEXTAREA -{ padding: 0px; - padding-left: 2px; } - -INPUT.textField, INPUT.comboBoxField -{ margin: 2px; - padding: 2px; - vertical-align: middle; - width: 250px; } - -INPUT.comboBoxField -{ margin-right: 0px; } - -INPUT.textField._invalid, INPUT.comboBoxField._invalid -{ background-color: #f66 !important; - border-color: #f00; } - -BUTTON.comboBoxButton -{ background-image: url("arrow-down.png"); - background-repeat: no-repeat; - background-position: center center; - background-color: #e6e7e6; - width: 20px; - height: 20px; - margin: 0px; - padding: 0px; - border-bottom: 1px solid #909090; - border-right: 1px solid #909090; - border-left: 1px solid #eff0ef; - border-top: 1px solid #eff0ef; -} - -BUTTON.comboBoxButton:active -{ - border-bottom: 1px solid #eff0ef; - border-right: 1px solid #eff0ef; - border-top: 1px solid #909090; - border-left: 1px solid #909090; - background-color: #d6d7d6; -} - -INPUT[name="search"] -{ margin-right: 1em; - width: 20em; - padding-left: 24px; - background-image: url('Search-bar.png'); - background-repeat: no-repeat; - background-position: 2px 2px; - background-color: #CCDDEC; - color: #909090; } - -/* Buttons - * Avoid using DIVS as buttons, they're only helpful when they have multiple - * listeners for "onclick" - */ -.button, a.button { - padding: 0px 0.5em; - background: transparent url('btn_a_bg.png') no-repeat scroll top right; - display: block; - float: right; - height: 23px; - padding-right: 3px; /* sliding doors padding */ - text-decoration: none; - text-align: center; - color: inherit; - cursor: pointer; -} - -.button SPAN { - background: transparent url('btn_span_bg.png') no-repeat; - display: block; - line-height: 13px; - height: 13px; - padding: 5px 2px 5px 5px; - cursor: pointer; - min-width: 70px; - vertical-align: top; -} - -.button.actionButton SPAN -{ font-weight: bold; } - -.button:active SPAN -{ background-position: bottom left; - padding: 6px 2px 4px 5px; } - -.disabled.button, -.disabled.button:active, -.disabled.button SPAN -{ color: #999; } - -.disabled.button:active SPAN -{ background-position: top left; - padding: 5px 2px 5px 5px; } - -.badge -{ display: inline-block; - min-width: 10px; - padding: 2px 3px; - font-size: 9px; - font-weight: 700; - line-height: 1; - color: #fff; - text-align: center; - white-space: nowrap; - vertical-align: baseline; - background-color: #777; - border-radius: 10px; } - -.badge:empty -{ display: none; } - -dt, dd { - line-height: 20px; -} -dd { - margin-left: 9px; -} -.dl-horizontal dt { - float: left; - width: 225px; - overflow: hidden; - clear: left; - text-align: right; - text-overflow: ellipsis; - white-space: nowrap; -} -fieldset .dl-horizontal dt { - width: 150px; -} -.dl-horizontal dd { - margin-left: 235px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} -fieldset .dl-horizontal dd { - margin-left: 160px; -} - -.dl-horizontal ul { - list-style-type: none; - margin: 0px; - padding-left: 0px; -} -.dl-horizontal li { - margin-left: 0; -} - -/* Frames */ -TABLE.frame, -TABLE.framenocaption -{ border-top: 1px solid #909090; - border-left: 1px solid #909090; - border-bottom: 1px solid #FFFFFF; - border-right: 1px solid #FFFFFF; - margin-top: -.5em; - margin-left: auto; - margin-right: auto; - margin-bottom: 1em; - padding: 1em; - display: table; - text-align: right; - width: 100%; } - -TABLE.nopadding -{ padding: 4px; } -TABLE.framenocaption -{ margin-top: 14px; } - -TABLE.frame TD -{ padding: 0px; } - -SPAN.caption -{ display: inline-block; - position: relative; - text-align: center; - cursor: default; - background-color: #E6E7E6; - color: #262B33; - width: auto; - padding: .25em; - margin-left: 7px; - border: 0px; } - -/* Tabs */ - -DIV.tabsContainer -{ overflow: hidden; - padding: 0px 5px; } - -DIV.tabsContainer > DIV.scrollToolbar -{ position: absolute; - background-color: #c6c7c6; - border: 1px solid #9B9B9B; - padding: 1px; - top: 8px; - right: 0px; - height: 12px; - vertical-align: bottom; - text-align: center; - width: 30px; } - -DIV.tabsContainer > DIV.scrollToolbar > A > SPAN -{ border: 0px; - text-align: center; - width: 12px; - padding: 0px !important; - margin: 0px !important; - margin-top: 5px; } - -DIV.tabsContainer > DIV.scrollToolbar > A, -DIV.tabsContainer > DIV.scrollToolbar > A > SPAN -{ height: 12px; } - -DIV.tabsContainer > UL -{ cursor: default; - width: 1000px; - list-style-type: none; - list-style-image: none; - margin: 0px; - padding: 0px; } - -DIV.tabsContainer > UL LI -{ overflow: hidden; - padding: 0px; - margin-right: -1px; - background: transparent url('tab_a_inactive_bg.png') no-repeat scroll top right; - display: block; - float: left; - height: 24px; - padding-right: 2px; /* sliding doors padding */ - text-decoration: none; - color: inherit; } - -DIV.tabsContainer > UL LI SPAN -{ background: transparent url('tab_span_inactive_bg.png') no-repeat; - display: block; - line-height: 14px; - padding: 5px 6px 5px 5px; } - -DIV.tabsContainer > UL LI.active -{ background: transparent url('tab_a_active_bg.png') no-repeat scroll top right !important; } -DIV.tabsContainer > UL LI.active SPAN -{ background: transparent url('tab_span_active_bg.png') no-repeat !important; } -DIV.tabsContainer > UL LI SPAN:hover -{ cursor: pointer; } -DIV.tabsContainer > UL LI.first -{ margin-left: -1px; - padding-left: -1px; } /* Firefox will complain */ - -DIV.tabsContainer > DIV.tabs -{ position: absolute; - color: #262B33; - background-color: #E6E7E6; - border: 1px solid #9B9B9B; - top: 23px; - bottom: 0px; - left: 0px; - right: 0px; - overflow: hidden; } - -DIV.tabsContainer > DIV.tabs > DIV.tab -{ position: absolute; - top: 5px; - bottom: 5px; - left: 5px; - right: 5px; - overflow: hidden; } - -IFRAME.hidden, -DIV.tab -{ display: none; } - -DIV#popupFrame -{ position: absolute; - top: 40px; - bottom: 40px; - left: 15%; - right: 15%; - padding: 4px; - z-index: 2000; - background-color: #E6E7E6; - -webkit-border-radius: 4px 4px 0 0; - border-radius: 4px 4px 0 0; - -webkit-box-shadow: 0 5px 10px rgba(0,0,0,.5); - box-shadow: 0 5px 10px rgba(0,0,0,.5); -} - -DIV#popupFrame.small -{ left: 30%; - right: 30%; -} - -DIV#popupFrame > IFRAME -{ margin: 0; - padding: 0; - color: #000; - background-color: #E6E7E6; - border: 0; - -webkit-border-radius: 4px 4px 0 0; - border-radius: 4px 4px 0 0; -} - -DIV.tabsContainer DIV.active -{ display: block; } - -DIV.tabsContainer > DIV.active.tab -{ display: block !important; } - -/* Toolbar */ -DIV#toolbar -{ left: 0px; - border-top: 1px solid #fff; - border-bottom: 1px solid #848284; - margin: 0px; - padding: 0px; - white-space: nowrap; - overflow: hidden; } - -BODY.popup DIV#toolbar -{ border-top: 0px; } - -SPAN.toolbarSeparator -{ display: block; - float: left; - height: 3.8em; - vertical-align: middle; - border-right : 1px solid #fff; - border-left : 1px solid #9c9a94; - margin: 0px .25em; - margin-top: 0.125em; - width: 0px; - padding: 0px; } - -DIV.toolbar IMG.buttonImage -{ width: 24px; - height: 24px; } - -A.toolbarButton, -A.toolbarButton:hover, -A.smallToolbarButton, -A.smallToolbarButton:hover { - display: inline; - float: left; - height: 49px; - padding-right: 3px; /* sliding doors padding */ - text-decoration: none; - color: inherit; - cursor: pointer; -} -A.smallToolbarButton, -A.smallToolbarButton:hover { - height: 37px; -} -A.toolbarButton:hover { - background: transparent url('toolbarbtn_a_bg.png') no-repeat scroll top right; -} -A.smallToolbarButton:hover { - background: transparent url('smalltoolbarbtn_a_bg.png') no-repeat scroll top right; -} - -A.toolbarButton SPAN, -A.toolbarButton:hover SPAN { - text-align: center; - display: block; - line-height: 13px; - padding: 5px 2px 5px 5px; - cursor: pointer; -} - -A.smallToolbarButton SPAN, -A.smallToolbarButton:hover SPAN { - text-align: center; - display: block; - line-height: 8px; - padding: 5px 2px 5px 5px !important; - cursor: pointer; -} - -A.toolbarButton:hover SPAN { - background: transparent url('toolbarbtn_span_bg.png') no-repeat; -} -A.smallToolbarButton:hover SPAN { - background: transparent url('smalltoolbarbtn_span_bg.png') no-repeat; -} -A.toolbarButton:active SPAN { - background-position: bottom left; -} -A.smallToolbarButton:active SPAN { - background-position: bottom left; -} - -A._disabled.toolbarButton, -A._disabled.toolbarButton:active -{ color: #999; } - -P#mailerSelectionContainer -{ line-height: 25px; - margin-top: 2px; } - -DIV.bottomToolbar -{ vertical-align: middle; - background-image: url("thead_bg.png"); - border: 1px solid #9B9B9B; - background-color: #E6E7E6; - height: 20px; - margin-top: -4px; - text-align: left; - margin-left: 2px; - margin-right: 2px; } - -DIV.bottomToolbar A.bottomButton SPAN, -DIV.bottomToolbar A.bottomButton -{ margin: 0px; - padding: 0px; - width: 23px; - text-align: center; - text-decoration: none; - color: inherit; - cursor: pointer; - border-bottom: 1px solid #9B9B9B; - border-right: 1px solid #9B9B9B; - float: left; - height: 20px; } - -DIV.bottomToolbar A.bottomButton SPAN -{ background: transparent url('thead_bg.png') repeat-x top right; } -DIV.bottomToolbar A.bottomButton SPAN:active -{ background-position: bottom left; } - -/* row editing */ -.editing > INPUT[type="text"] -{ width: 98%; } - -.safetyBlock -{ position: absolute; - top: 0px; - right: 0px; - bottom: 0px; - left: 0px; } - -/* color box */ -DIV.colorBox, -#colorPickerDialog SPAN -{ cursor: pointer; - margin: 0 3px 0 0; - height: 12px; - line-height: 12px; - width: 12px; - -webkit-border-radius: 2px; - -moz-border-radius: 2px; - border-radius: 2px; - border: 0px; } - -#colorPickerDialog SPAN -{ float: left; - margin: 3px; } - -#colorPickerDialog SPAN:hover -{ border: 2px solid transparent; - margin: 1px; } - -.blc-FFFFFF { - background-color: #FFFFFF; -} -.blc-CCCCCC { - background-color: #CCCCCC; -} -.blc-C0C0C0 { - background-color: #C0C0C0; -} -.blc-999999 { - background-color: #999999; -} -.blc-666666 { - background-color: #666666; -} -.blc-333333 { - background-color: #333333; -} -.blc-000000 { - background-color: #000000; -} -.blc-FFCCCC { - background-color: #FFCCCC; -} -.blc-FF6666 { - background-color: #FF6666; -} -.blc-FF0000 { - background-color: #FF0000; -} -.blc-CC0000 { - background-color: #CC0000; -} -.blc-990000 { - background-color: #990000; -} -.blc-660000 { - background-color: #660000; -} -.blc-330000 { - background-color: #330000; -} -.blc-FFCC99 { - background-color: #FFCC99; -} -.blc-FF9966 { - background-color: #FF9966; -} -.blc-FF9900 { - background-color: #FF9900; -} -.blc-FF6600 { - background-color: #FF6600; -} -.blc-CC6600 { - background-color: #CC6600; -} -.blc-993300 { - background-color: #993300; -} -.blc-663300 { - background-color: #663300; -} -.blc-FFFF99 { - background-color: #FFFF99; -} -.blc-FFFF66 { - background-color: #FFFF66; -} -.blc-FFCC66 { - background-color: #FFCC66; -} -.blc-FFCC33 { - background-color: #FFCC33; -} -.blc-CC9933 { - background-color: #CC9933; -} -.blc-996633 { - background-color: #996633; -} -.blc-663333 { - background-color: #663333; -} -.blc-FFFFCC { - background-color: #FFFFCC; -} -.blc-FFFF33 { - background-color: #FFFF33; -} -.blc-FFFF00 { - background-color: #FFFF00; -} -.blc-FFCC00 { - background-color: #FFCC00; -} -.blc-999900 { - background-color: #999900; -} -.blc-666600 { - background-color: #666600; -} -.blc-333300 { - background-color: #333300; -} -.blc-99FF99 { - background-color: #99FF99; -} -.blc-66FF99 { - background-color: #66FF99; -} -.blc-33FF33 { - background-color: #33FF33; -} -.blc-33CC00 { - background-color: #33CC00; -} -.blc-009900 { - background-color: #009900; -} -.blc-006600 { - background-color: #006600; -} -.blc-003300 { - background-color: #003300; -} -.blc-99FFFF { - background-color: #99FFFF; -} -.blc-33FFFF { - background-color: #33FFFF; -} -.blc-66CCCC { - background-color: #66CCCC; -} -.blc-00CCCC { - background-color: #00CCCC; -} -.blc-339999 { - background-color: #339999; -} -.blc-336666 { - background-color: #336666; -} -.blc-003333 { - background-color: #003333; -} -.blc-CCFFFF { - background-color: #CCFFFF; -} -.blc-66FFFF { - background-color: #66FFFF; -} -.blc-33CCFF { - background-color: #33CCFF; -} -.blc-3366FF { - background-color: #3366FF; -} -.blc-3333FF { - background-color: #3333FF; -} -.blc-000099 { - background-color: #000099; -} -.blc-000066 { - background-color: #000066; -} -.blc-CCCCFF { - background-color: #CCCCFF; -} -.blc-9999FF { - background-color: #9999FF; -} -.blc-6666CC { - background-color: #6666CC; -} -.blc-6633FF { - background-color: #6633FF; -} -.blc-6600CC { - background-color: #6600CC; -} -.blc-333399 { - background-color: #333399; -} -.blc-330099 { - background-color: #330099; -} -.blc-FFCCFF { - background-color: #FFCCFF; -} -.blc-FF99FF { - background-color: #FF99FF; -} -.blc-CC66CC { - background-color: #CC66CC; -} -.blc-CC33CC { - background-color: #CC33CC; -} -.blc-993399 { - background-color: #993399; -} -.blc-663366 { - background-color: #663366; -} -.blc-330033 { - background-color: #330033; -} - -/* ckeditor */ -span.cke_skin_kama -{ padding: 0px !important; } - -@media print -{ - BODY - { position: static; - font-size: 10pt; - height: auto; - overflow: visible; } - - DIV#logConsole, - DIV#linkBanner, - DIV#toolbar, - DIV.menu, - DIV.filterPanel, - DIV.tabsContainer - { display: none; } -} diff --git a/UI/WebServerResources/generic.js b/UI/WebServerResources/generic.js deleted file mode 100644 index 385c5c835..000000000 --- a/UI/WebServerResources/generic.js +++ /dev/null @@ -1,2340 +0,0 @@ -/* generic.js - this file is part of SOGo - - Copyright (C) 2006-2014 Inverse - - SOGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOGo is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOGo; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -var logConsole; -var logWindow = null; - -var queryParameters; - -var menus = new Array(); -var search = {}; -var sorting = {}; -var dialogs = {}; -var dialogsStack = new Array(); - -var lastClickedRow = -1; -var lastClickedRowId = -1; - -// logArea = null; -var allDocumentElements = null; - -// Alarms -var nextAlarm = null; -var Alarms = new Array(); - -// Ajax requests counts -var activeAjaxRequests = 0; -var removeFolderRequestCount = 0; - -// Email validation regexp -var emailRE = /^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/i; - - -/* This function enables the execution of a wrapper function just before the - user callback is executed. The wrapper in question executes "preventDefault" - to the event parameter if and only when "this" is a link. The goal of this - operation is to prevent links with attached even handlers to be followed, - including those with an href set to "#". */ -function clickEventWrapper(functionRef) { - function button_clickEventWrapper(event) { - if (this.tagName == "A") { - preventDefault(event); - } - return functionRef.apply(this, [event]); - } - - return button_clickEventWrapper; -} - - -function createElement(tagName, id, classes, attributes, htmlAttributes, parentNode) { - var newElement = $(document.createElement(tagName)); - if (id) - newElement.setAttribute("id", id); - if (classes) { - if (typeof(classes) == "string") - newElement.addClassName(classes); - else - for (var i = 0; i < classes.length; i++) - newElement.addClassName(classes[i]); - } - if (attributes) - for (var i in attributes) - newElement[i] = attributes[i]; - if (htmlAttributes) - for (var i in htmlAttributes) - newElement.setAttribute(i, htmlAttributes[i]); - if (parentNode) - parentNode.appendChild(newElement); - - return newElement; -} - -function URLForFolderID(folderID) { - var folderInfos = folderID.split(":"); - var url; - - if (folderInfos.length > 1) { - url = UserFolderURL + "../" + encodeURI(folderInfos[0]); - if (!(folderInfos[0].endsWith('/') - || folderInfos[1].startsWith('/'))) - url += '/'; - url += folderInfos[1]; - } - else { - var folderInfo = folderInfos[0]; - if (!(folderInfo.startsWith('/'))) - folderInfo = "/" + folderInfo; - url = ApplicationBaseURL + encodeURI(folderInfo); - } - - if (url[url.length-1] == '/') - url = url.substr(0, url.length-1); - - return url; -} - -function extractEmailAddress(mailTo) { - var email = ""; - - var emailre - = /([a-zA-Z0-9\._\-]*[a-zA-Z0-9_\-]+@[a-zA-Z0-9\._\-]*[a-zA-Z0-9])/; - if (emailre.test(mailTo)) { - emailre.exec(mailTo); - email = RegExp.$1; - } - - return email; -} - -function extractEmailName(mailTo) { - var emailName = ""; - - var tmpMailTo = mailTo.replace("<", "<"); - tmpMailTo = tmpMailTo.replace(">", ">"); - tmpMailTo = tmpMailTo.replace("&", "&"); - - var emailNamere = /([ ]+)?(.+)\ 0) - mailto = emailName + ' <' + email + '>'; - else - mailto = email; - - return mailto; -} - -function sanitizeWindowName(dirtyWindowName) { - // IE is picky about the characters used for the window name. - return dirtyWindowName.replace(/[\s\.\/\-\@]/g, "_"); -} - -function openUserFolderSelector(callback, type) { - var urlstr = ApplicationBaseURL; - urlstr += ("/../../" + UserLogin + "/Contacts/userFolders"); - - var div = $("popupFrame"); - if (div) { - if (!div.hasClassName("small")) - div.addClassName("small"); - var iframe = div.down("iframe"); - iframe.src = urlstr; - iframe.id = "folderSelectorFrame"; - var bgDiv = $("bgFrameDiv"); - if (bgDiv) { - bgDiv.show(); - } - else { - bgDiv = createElement("div", "bgFrameDiv", ["bgMail"]); - document.body.appendChild(bgDiv); - } - div.show(); - } - else { - var w = window.open(urlstr, "_blank", - "width=322,height=250,resizable=1,scrollbars=0,location=0"); - w.opener = window; - window.userFolderCallback = callback; - window.userFolderType = type; - w.focus(); - } -} - -function openGenericWindow(url, wId) { - var div = $("popupFrame"); - if (div) { - if (!div.hasClassName("small")) - div.addClassName("small"); - var iframe = div.down("iframe"); - iframe.src = url; - if (!wId) - wId = "genericFrame"; - iframe.id = wId;; - var bgDiv = $("bgFrameDiv"); - if (bgDiv) { - bgDiv.show(); - } - else { - bgDiv = createElement("div", "bgFrameDiv"); - document.body.appendChild(bgDiv); - } - div.show(); - - return div; - } - else { - if (!wId) - wId = "_blank"; - else - wId = sanitizeWindowName(wId); - - var w = window.open(url, wId, - "width=550,height=650,resizable=1,scrollbars=1,location=0"); - w.focus(); - - return w; - } -} - -function openContactWindow(url, wId) { - var div = $("popupFrame"); - if (div) { - if (!div.hasClassName("small")) - div.addClassName("small"); - var iframe = div.down("iframe"); - iframe.src = url; - iframe.id = "contactEditorFrame"; - var bgDiv = $("bgFrameDiv"); - if (bgDiv) { - bgDiv.show(); - } - else { - bgDiv = createElement("div", "bgFrameDiv"); - document.body.appendChild(bgDiv); - } - div.show(); - - return div; - } - else { - if (!wId) - wId = "_blank"; - else - wId = sanitizeWindowName(wId); - - $(function() { - var w = window.open(url, wId, - "width=460,height=560,resizable=0,location=0"); - w.focus(); - }).delay(0.1); - } -} - -function openMailComposeWindow(url, wId) { - var div = $("popupFrame"); - if (div) { - if (div.hasClassName("small")) - div.removeClassName("small"); - var iframe = div.down("iframe"); - iframe.src = url; - iframe.id = "messageCompositionFrame"; - var bgDiv = $("bgFrameDiv"); - if (bgDiv) { - bgDiv.show(); - } - else { - bgDiv = createElement("div", "bgFrameDiv"); - document.body.appendChild(bgDiv); - } - div.show(); - - return div; - } - else { - var parentWindow = this; - - if (!wId) - wId = "_blank"; - else - wId = sanitizeWindowName(wId); - - if (document.body.hasClassName("popup")) - parentWindow = window.opener; - - var w = parentWindow.open(url, wId, - "width=680,height=520,resizable=1,scrollbars=1,toolbar=0," - + "location=0,directories=0,status=0,menubar=0" - + ",copyhistory=0"); - - w.focus(); - - return w; - } -} - -function openMailTo(senderMailTo) { - var addresses = senderMailTo.split(";"); - var sanitizedAddresses = new Array(); - var subject = extractSubject(senderMailTo); - for (var i = 0; i < addresses.length; i++) { - var sanitizedAddress = sanitizeMailTo(addresses[i]); - if (sanitizedAddress.length > 0) - sanitizedAddresses.push(sanitizedAddress); - } - - if (sanitizedAddresses.length > 0) - $(function() { - openMailComposeWindow(ApplicationBaseURL - + "/../Mail/compose?mailto=" + encodeURIComponent(Object.toJSON(sanitizedAddresses)) - + ((subject.length > 0)?"?subject=" + encodeURIComponent(subject):"")); - }).delay(0.1); - - return false; /* stop following the link */ -} - -function onEmailTo(event) { - var s = this.innerHTML.strip(); - if (!/@/.test(s)) { - s += ' <' + this.href.substr(7) + '>'; - } - openMailTo(s); - Event.stop(event); - return false; -} - -function deleteDraft(url) { - /* this is called by UIxMailEditor with window.opener */ - new Ajax.Request(url, { - asynchronous: false, - method: 'post', - onFailure: function(transport) { - log("draftDeleteCallback: problem during ajax request: " + transport.status); - } - }); -} - -function refreshFolderByType(type) { - /* this is called by UIxMailEditor with window.opener */ - if (typeof Mailer != 'undefined') - deleteCachedMailboxByType(type); -} - -function createHTTPClient() { - return new XMLHttpRequest(); -} - -function createCASRecoveryIFrame(request) { - var urlstr = UserFolderURL; - if (!urlstr.endsWith('/')) - urlstr += '/'; - urlstr += "recover"; - - var newIFrame = createElement("iframe", null, "hidden", - { src: urlstr }); - newIFrame.request = request; - newIFrame.observe("load", onCASRecoverIFrameLoaded); - document.body.appendChild(newIFrame); -} - -function onCASRecoverIFrameLoaded(event) { - if (this.request) { - var request = this.request; - if (request.attempt == 0) { - window.setTimeout(function() { - triggerAjaxRequest(request.url, - request.callback, - request.callbackData, - request.content, - request.paramHeaders, - 1); }, - 100); - } - else { - window.location.href = UserFolderURL; - } - this.request = null; - } - var this_ = this; - window.setTimeout(function() { this_.parentNode.removeChild(this_); }, - 500); -} - -function onAjaxRequestStateChange(http) { - try { - if (http.readyState == 4) { - if (http.status == 0 && usesCASAuthentication) { - activeAjaxRequests--; - checkAjaxRequestsState(); - createCASRecoveryIFrame(http); - } - else if (activeAjaxRequests > 0) { - if (!http.aborted && http.callback) - http.callback(http); - activeAjaxRequests--; - checkAjaxRequestsState(); - http.onreadystatechange = Prototype.emptyFunction; - http.callback = Prototype.emptyFunction; - http.callbackData = null; - } - } - } - catch(e) { - activeAjaxRequests--; - checkAjaxRequestsState(); - http.onreadystatechange = Prototype.emptyFunction; - http.callback = Prototype.emptyFunction; - http.callbackData = null; - log("AJAX Request, Caught Exception: " + e.name); - log(e.message); - if (e.fileName) { - if (e.lineNumber) - log("at " + e.fileName + ": " + e.lineNumber); - else - log("in " + e.fileName); - } - log(backtrace()); - log("request url was '" + http.url + "'"); - } -} - -/* taken from Lightning */ -function getContrastingTextColor(bgColor) { - var calcColor = bgColor.substring(1); - var red = parseInt(calcColor.substring(0, 2), 16); - var green = parseInt(calcColor.substring(2, 4), 16); - var blue = parseInt(calcColor.substring(4, 6), 16); - - // Calculate the brightness (Y) value using the YUV color system. - var brightness = (0.299 * red) + (0.587 * green) + (0.114 * blue); - - // Consider all colors with less than 56% brightness as dark colors and - // use white as the foreground color, otherwise use black. - return ((brightness < 144) ? "white" : "black"); -} - -function triggerAjaxRequest(url, callback, userdata, content, headers, attempt) { - var http = createHTTPClient(); - if (http) { - activeAjaxRequests++; - document.animTimer = setTimeout("checkAjaxRequestsState();", 250); - - http.open("POST", url, true); - http.url = url; - http.paramHeaders = headers; - http.content = content; - http.callback = callback; - http.callbackData = userdata; - http.onreadystatechange = function() { onAjaxRequestStateChange(http); }; - - if (typeof(attempt) == "undefined") { - attempt = 0; - } - http.attempt = attempt; - // = function() { - // // log ("state changed (" + http.readyState + "): " + url); - // }; - if (headers) { - for (var i in headers) { - http.setRequestHeader(i, headers[i]); - } - } - http.send(content ? content : ""); - } - else { - log("triggerAjaxRequest: error creating HTTP Client!"); - } - - return http; -} - -function AjaxRequestsChain(callback, callbackData) { - this.requests = []; - this.counter = 0; - this.callback = callback; - this.callbackData = callbackData; -} - -AjaxRequestsChain.prototype = { - requests: null, - counter: 0, - callback: null, - callbackData: null, - - _step: function ARC__step() { - if (this.counter < this.requests.length) { - var request = this.requests[this.counter]; - this.counter++; - var chain = this; - var origCallback = request[1]; - request[1] = function ARC__step_callback(http) { - if (origCallback) { - http.callback = origCallback; - origCallback.apply(http, [http]); - } - chain._step(); - }; - triggerAjaxRequest.apply(window, request); - } - else { - this.callback.apply(this, [this.callbackData]); - } - }, - - start: function ARC_start() { - this._step(); - } -}; - -function startAnimation(parent, nextNode) { - var anim = $("progressIndicator"); - if (!anim) { - anim = createElement("img", "progressIndicator", null, - {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 progressImage = $("progressIndicator"); - if (activeAjaxRequests > 0 - && !progressImage) { - var toolbar = $("toolbar"); - if (toolbar) - startAnimation(toolbar); - } - else if (!activeAjaxRequests - && progressImage) { - progressImage.parentNode.removeChild(progressImage); - } -} - -function isMac() { - return (navigator.platform.indexOf('Mac') > -1); -} - -function isWindows() { - return (navigator.platform.indexOf('Win') > -1); -} - -function isSafari3() { - return (navigator.appVersion.indexOf("Version") > -1); -} - -function isWebKit() { - //var agt = navigator.userAgent.toLowerCase(); - //var is_safari = ((agt.indexOf('safari')!=-1)&&(agt.indexOf('mac')!=-1))?true:false; - return (navigator.vendor == "Apple Computer, Inc.") || - (navigator.userAgent.toLowerCase().indexOf('konqueror') != -1) || - (navigator.userAgent.indexOf('AppleWebKit') != -1); -} - -function isHttpStatus204(status) { - return (status == 204 || // Firefox - (isWebKit() && typeof(status) == 'undefined') || // Safari - status == 1223); // IE -} - -function getTarget(event) { - event = event || window.event; - if (event.target) - return $(event.target); // W3C DOM - else - return $(event.srcElement); // IE -} - -function preventDefault(event) { - if (event) { - if (event.preventDefault) - event.preventDefault(); // W3C DOM - else - event.returnValue = false; // IE - } -} - -function resetSelection(win) { - var t = ""; - if (win && win.getSelection) { - t = win.getSelection().toString(); - win.getSelection().removeAllRanges(); - } - return t; -} - -function refreshOpener() { - if (window.opener && !window.opener.closed) { - window.opener.location.reload(); - } -} - -/* selection mechanism */ - -function eventIsLeftClick(event) { - var isLeftClick = true; - if (isMac() && isWebKit()) { - if (event.ctrlKey == 1) { - // Control-click is equivalent to right-click under Mac OS X - isLeftClick = false; - } - else if (event.metaKey == 1) { - // Command-click - isLeftClick = true; - } - else { - isLeftClick = Event.isLeftClick(event); - } - } - else { - isLeftClick = event.isLeftClick(); - } - - return isLeftClick; -} - -function deselectAll(parent) { - for (var i = 0; i < parent.childNodes.length; i++) { - var node = parent.childNodes.item(i); - if (node.nodeType == 1) - $(node).deselect(); - } -} - -function isNodeSelected(node) { - return $(node).hasClassName('_selected'); -} - -function acceptMultiSelect(node) { - var response = false; - var attribute = node.getAttribute('multiselect'); - if (attribute && attribute.length > 0) { - log("node '" + node.getAttribute("id") - + "' is still using old-stylemultiselect!"); - response = (attribute.toLowerCase() == 'yes'); - } - else - response = node.multiselect; - - return response; -} - -function onRowClick(event, target) { - var node = target || getTarget(event); - var rowIndex = null; - - if (node.tagName != 'TD' && node.tagName != 'LI' && node.tagName != 'TR') - node = this; - - if (node.tagName == 'TD') { - node = node.parentNode; // select TR - } - if (node.tagName == 'TR') { - var head = $(node).up('table').down('thead'); - rowIndex = node.rowIndex; - if (head) - rowIndex -= head.getElementsByTagName('tr').length; - } - else if (node.tagName == 'LI') { - // Find index of clicked row - var list = node.parentNode; - if (list) { - var items = list.childNodesWithTag("li"); - for (var i = 0; i < items.length; i++) { - if (items[i] == node) { - rowIndex = i; - break; - } - } - } - else - // No parent; stop here - return true; - } - else - // Not a list; stop here - return true; - - var initialSelection = $(node.parentNode).getSelectedNodesId(); - if (initialSelection && initialSelection.length > 0 - && initialSelection.indexOf(node.id) >= 0 - && !eventIsLeftClick(event)) - // Ignore non primary-click (ie right-click) inside current selection - return true; - - if ((event.shiftKey == 1 || (isMac() && event.metaKey == 1) || (!isMac() && event.ctrlKey == 1)) - && (lastClickedRow >= 0) - && (acceptMultiSelect(node.parentNode) - || acceptMultiSelect(node.parentNode.parentNode))) { - if (event.shiftKey) { - $(node.parentNode).selectRange(lastClickedRow, rowIndex); - } else if (isNodeSelected(node)) { - $(node).deselect(); - rowIndex = null; - } else { - $(node).selectElement(); - } - // At this point, should empty content of 3-pane view - } else { - // Single line selection - $(node.parentNode).deselectAll(); - $(node).selectElement(); - } - if (rowIndex != null) { - lastClickedRow = rowIndex; - lastClickedRowId = node.getAttribute("id"); - } - - return true; -} - -/* popup menus */ - -function popupMenu(event, menuId, target) { - document.menuTarget = target; - - if (document.currentPopupMenu) - hideMenu(document.currentPopupMenu); - - var popup = $(menuId); - - var deltaX = 0; - var deltaY = 0; - - var pageContent = $("pageContent"); - if (popup.parentNode.tagName != "BODY") { - var offset = pageContent.cascadeLeftOffset(); - deltaX = -($(popup.parentNode).cascadeLeftOffset() - offset); - offset = pageContent.cascadeTopOffset(); - deltaY = -($(popup.parentNode).cascadeTopOffset() - offset); - } - - var menuTop = Event.pointerY(event) + deltaY; - var menuLeft = Event.pointerX(event) + deltaX; - var heightDiff = ((window.height() + deltaY) - - (menuTop + popup.offsetHeight + 1)); - if (heightDiff < 0) - menuTop += heightDiff; - - var leftDiff = ((window.width() + deltaX) - - (menuLeft + popup.offsetWidth)); - if (leftDiff < 0) - menuLeft -= (popup.offsetWidth + 1); - - var isVisible = true; - if (popup.prepareVisibility) { - if (!popup.prepareVisibility()) - isVisible = false; - } - - Event.stop(event); - if (isVisible) { - popup.setStyle({ top: menuTop + "px", - left: menuLeft + "px", - visibility: "visible" }); - - document.currentPopupMenu = popup; - $(document.body).observe("mousedown", onBodyClickMenuHandler); - } -} - -function getParentMenu(node) { - var currentNode, menuNode; - - menuNode = null; - currentNode = node; - var menure = new RegExp("(^|\s+)menu(\s+|$)", "i"); - - while (menuNode == null - && currentNode) { - if (menure.test(currentNode.className)) - menuNode = currentNode; - else - currentNode = currentNode.parentNode; - } - - return menuNode; -} - -function onBodyClickMenuHandler(event) { - this.stopObserving(event.type); - hideMenu(document.currentPopupMenu); - document.currentPopupMenu = null; - - if (event) - preventDefault(event); -} - -function onMenuClickHandler(event) { - if (!this.hasClassName("disabled")) - this.menuCallback.apply(this, [event]); -} - -function hideMenu(menuNode) { - var onHide; - - if (!menuNode) - return; - - if (menuNode.submenu) { - hideMenu(menuNode.submenu); - menuNode.submenu = null; - } - - menuNode.setStyle({ visibility: "hidden" }); - if (menuNode.parentMenuItem) { - menuNode.parentMenuItem.stopObserving("mouseover", - onMouseEnteredSubmenu); - menuNode.stopObserving("mouseover", - onMouseEnteredSubmenu); - menuNode.parentMenuItem.stopObserving("mouseout", - onMouseLeftSubmenu); - menuNode.stopObserving("mouseout", - onMouseLeftSubmenu); - menuNode.parentMenu.stopObserving("mouseover", - onMouseEnteredParentMenu); - $(menuNode.parentMenuItem).removeClassName("submenu-selected"); - menuNode.parentMenuItem.mouseInside = false; - menuNode.parentMenuItem = null; - menuNode.parentMenu.submenuItem = null; - menuNode.parentMenu.submenu = null; - menuNode.parentMenu = null; - } - - Event.fire(menuNode, "contextmenu:hide"); -} - -//function onMenuEntryClick(event) { -// var node = event.target; -// -// id = getParentMenu(node).menuTarget; -// -// return false; -//} - -/* query string */ - -function generateQueryString(queryDict) { - var s = ""; - for (var key in queryDict) { - var value = queryDict[key]; - if (typeof(value) == "string" - || typeof(value) == "number") { - if (s.length == 0) - s = "?"; - else - s = s + "&"; - s = s + key + "=" + escape(value); - } - } - return s; -} - -function parseQueryParameters(url) { - var parameters = new Array(); - - var params = url.split("?")[1]; - if (params) { - var pairs = params.split("&"); - for (var i = 0; i < pairs.length; i++) { - var pair = pairs[i].split("="); - parameters[pair[0]] = pair[1]; - } - } - - return parameters; -} - -function initLogConsole() { - var logConsole = $("logConsole"); - if (logConsole) { - logConsole.highlighted = false; - logConsole.observe("dblclick", onLogDblClick, false); - logConsole.update(); - Event.observe(window, "keydown", onBodyKeyDown); - } -} - -function onBodyKeyDown(event) { - if (event.keyCode == Event.KEY_ESC) { - toggleLogConsole(); - preventDefault(event); - } -} - -function toggleLogConsole(event) { - var logConsole = $("logConsole"); - var display = '' + logConsole.style.display; - if (display.length == 0) { - logConsole.setStyle({ display: 'block' }); - } else { - logConsole.setStyle({ display: '' }); - } - if (event) - preventDefault(event); -} - -function log(message) { - if (!logWindow) { - try { - if (window.frameElement && window.frameElement.id) { - logWindow = parent.window; - while (logWindow.frameElement && window.frameElement.id) - logWindow = logWindow.parent.window; - } - else { - logWindow = window; - while (logWindow.opener && logWindow.opener._logMessage) - logWindow = logWindow.opener; - } - } - catch(e) {} - } - if (logWindow && logWindow._logMessage) { - var logMessage = message; - setTimeout(function() { logWindow._logMessage(logMessage) }, 10); - } -} - -function _logMessage(message) { - var logConsole = $("logConsole"); - if (logConsole) { - if (message == "\c") { - while (logConsole.firstChild) { - logConsole.removeChild(logConsole.firstChild); - } - return; - } - if (message[message.length-1] == "\n") { - message = message.substr(0, message.length-1); - } - var lines = message.split("\n"); - for (var i = 0; i < lines.length; i++) { - logConsole.appendChild(document.createTextNode(lines[i])); - logConsole.appendChild(createElement("br")); - } - logConsole.scrollTop += 300; /* abritrary number */ - } -} - -function logOnly(message) { - log("\c"); - log(message); -} - -function onLogDblClick(event) { - log("\c"); -} - -function backtrace() { - var func = backtrace.caller; - var str = "backtrace:\n"; - - while (func) { - if (func.name) { - str += " " + func.name; - if (this) - str += " (" + this + ")"; - } - else - str += "[anonymous]\n"; - - str += "\n"; - func = func.caller; - } - str += "--\n"; - - return str; -} - -function popupSubmenu(event) { - if (this.submenu && this.submenu != "" && !$(this).hasClassName("disabled")) { - var submenuNode = $(this.submenu); - var parentNode = getParentMenu(this); - if (parentNode.submenu) - hideMenu(parentNode.submenu); - submenuNode.parentMenuItem = this; - submenuNode.parentMenu = parentNode; - parentNode.submenuItem = this; - parentNode.submenu = submenuNode; - - if (submenuNode.prepareVisibility) - submenuNode.prepareVisibility.apply(submenuNode, []); - - var menuTop = (parentNode.offsetTop - 1 - + this.offsetTop); - - if (window.height() - < (menuTop + submenuNode.offsetHeight)) { - if (submenuNode.offsetHeight < window.height()) - menuTop = window.height() - submenuNode.offsetHeight; - else - menuTop = 0; - } - - var menuLeft = this.offsetLeft + this.offsetWidth; - menuLeft = $(this.parentNode.parentNode).positionedOffset()[0] - + $(this.parentNode).positionedOffset()[0] - + $(this).getWidth(); - if (menuLeft + submenuNode.getWidth() > window.width()) - // Keep the submenu inside the viewport - menuLeft = window.width() - submenuNode.getWidth(); - - this.mouseInside = true; - this.observe("mouseover", onMouseEnteredSubmenu); - submenuNode.observe("mouseover", onMouseEnteredSubmenu); - this.observe("mouseout", onMouseLeftSubmenu); - submenuNode.observe("mouseout", onMouseLeftSubmenu); - parentNode.observe("mouseover", onMouseEnteredParentMenu); - $(this).addClassName("submenu-selected"); - submenuNode.setStyle({ top: menuTop + "px", - left: menuLeft + "px", - visibility: "visible" }); - preventDefault(event); - } -} - -function onMouseEnteredParentMenu(event) { - if (this.submenuItem && !this.submenuItem.mouseInside) - hideMenu(this.submenu); -} - -function onMouseEnteredSubmenu(event) { - $(this).mouseInside = true; -} - -function onMouseLeftSubmenu(event) { - $(this).mouseInside = false; -} - -/* search field */ -function popupSearchMenu(event) { - var menuId = this.getAttribute("menuid"); - var offset = Position.cumulativeOffset(this); - - relX = Event.pointerX(event) - offset[0]; - relY = Event.pointerY(event) - offset[1]; - - if (event.button == 0 - && relX < 24) { - event.cancelBubble = true; - event.returnValue = false; - - if (document.currentPopupMenu) - hideMenu(document.currentPopupMenu); - - var popup = $(menuId); - offset = Position.positionedOffset(this); - popup.setStyle({ top: (offset.top + this.getHeight()) + "px", - left: (offset.left + 3) + "px", - visibility: "visible" }); - - document.currentPopupMenu = popup; - $(document.body).observe("click", onBodyClickMenuHandler); - } -} - -function setSearchCriteria(event) { - var panel = $(this).up('.filterPanel'); - var searchValue = panel.down('[name="search"]'); - var searchCriteria = panel.down('[name="criteria"]'); - - if (searchValue.ghostPhrase == searchValue.value) - searchValue.value = ""; - - searchValue.ghostPhrase = this.innerHTML; - searchCriteria.value = this.readAttribute('data-option'); - - if (this.parentNode.chosenNode) - this.parentNode.chosenNode.removeClassName("_chosen"); - this.addClassName("_chosen"); - - searchValue.focus(); - - if (this.parentNode.chosenNode != this) { - searchValue.lastSearch = ""; - this.parentNode.chosenNode = this; - - onSearchFormSubmit(panel); - } -} - -function configureSearchField() { - $$('.searchBox [name="search"]').each(function(searchValue) { - searchValue.on("click", popupSearchMenu); - searchValue.on("blur", onSearchBlur); - searchValue.on("focus", onSearchFocus); - searchValue.on("keydown", onSearchKeyDown); - searchValue.on("mousedown", onSearchMouseDown); - }); -} - -function onSearchMouseDown(event) { - var superNode = this.parentNode.parentNode.parentNode; - relX = (Event.pointerX(event) - superNode.offsetLeft - this.offsetLeft); - relY = (Event.pointerY(event) - superNode.offsetTop - this.offsetTop); - - if (relX < 24) - Event.stop(event); -} - -function onSearchFocus(event) { - var ghostPhrase = this.ghostPhrase; - if (this.value == ghostPhrase) { - this.value = ""; - this.setAttribute("modified", ""); - } else { - this.selectElement(); - } - this.setStyle({ color: "#262B33" }); -} - -function onSearchBlur(event) { - if (!this.value || this.value.blank()) { - var id = $(this).up('[data-search]').readAttribute('data-search'); - this.setAttribute("modified", ""); - this.setStyle({ color: "#909090" }); - this.value = this.ghostPhrase; - if (this.timer) - clearTimeout(this.timer); - search[id]["value"] = ""; - if (this.lastSearch != "") { - this.lastSearch = ""; - refreshCurrentFolder(id); - } - } else if (this.value == this.ghostPhrase) { - this.setAttribute("modified", ""); - this.setStyle({ color: "#909090" }); - } else { - this.setAttribute("modified", "yes"); - this.setStyle({ color: "#262B33" }); - } -} - -function IsCharacterKey(keyCode) { - return (keyCode == 32 /* space */ - || (keyCode > 47 && keyCode < 58) /* digits */ - || (keyCode > 64 && keyCode < 91) /* letters */ - || (keyCode > 95 && keyCode < 112) /* numpad digits */ - || (keyCode > 186 && keyCode < 193) - || (keyCode > 218 && keyCode < 223)); -} - -function onSearchKeyDown(event) { - if (event.keyCode == Event.KEY_RETURN) { - var panel = $(this).up('.filterPanel'); - if (this.timer) - clearTimeout(this.timer); - onSearchFormSubmit(panel); - preventDefault(event); - } - else if (event.keyCode == Event.KEY_BACKSPACE - || IsCharacterKey(event.keyCode)) { - var panel = $(this).up('.filterPanel'); - if (this.timer) - clearTimeout(this.timer); - this.timer = onSearchFormSubmit.delay(0.5, panel); - } -} - -function onSearchFormSubmit(filterPanel) { - var id = filterPanel.readAttribute('data-search'); - var searchValue = filterPanel.down('[name="search"]'); - var searchCriteria = filterPanel.down('[name="criteria"]'); - - if (searchValue.value != searchValue.ghostPhrase - && (searchValue.value != searchValue.lastSearch - && (searchValue.value.strip().length > minimumSearchLength - || searchValue.value.strip() == "." - || searchValue.value.length == 0))) { - search[id]["criteria"] = searchCriteria.value; - search[id]["value"] = searchValue.value; - searchValue.lastSearch = searchValue.value; - refreshCurrentFolder(id); - } -} - -function initCriteria() { - $$('[data-search]').each(function(element) { - var box = $(element); - var id = box.readAttribute('data-search'); - var searchCriteria = box.down('[name="criteria"]'); - var searchValue = box.down('[name="search"]'); - var searchOptions = box.down('.choiceMenu'); - var firstOption = searchOptions.down("li"); - if (firstOption) { - searchCriteria.value = firstOption.readAttribute('data-option'); - searchValue.ghostPhrase = firstOption.innerHTML; - searchValue.lastSearch = ""; - if (searchValue.value == '') { - searchValue.value = firstOption.innerHTML; - searchValue.setAttribute("modified", ""); - searchValue.setStyle({ color: "#909090" }); - } - // Set the checkmark to the first option - if (searchOptions.chosenNode) - searchOptions.chosenNode.removeClassName("_chosen"); - firstOption.addClassName("_chosen"); - searchOptions.chosenNode = firstOption; - // Initialize global array - search[id] = {}; - } - searchValue.blur(); - }); -} - -/* toolbar buttons */ -function popupToolbarMenu(node, menuId) { - if (document.currentPopupMenu) - hideMenu(document.currentPopupMenu); - - var popup = $(menuId); - if (popup.prepareVisibility) { - popup.prepareVisibility(); - } - - var offset = $(node).cumulativeOffset(); - var top = offset.top + node.offsetHeight; - popup.setStyle({ top: top + "px", - left: offset.left + "px", - visibility: "visible" }); - - document.currentPopupMenu = popup; - $(document.body).on("mouseup", onBodyClickMenuHandler); -} - -/* contact selector */ - -function folderSubscriptionCallback(http) { - if (http.readyState == 4) { - if (isHttpStatus204(http.status)) { - if (http.callbackData) - http.callbackData["method"](http.callbackData["data"]); - } - else - showAlertDialog(_("Unable to subscribe to that folder!")); - document.subscriptionAjaxRequest = null; - } - else - log ("folderSubscriptionCallback Ajax error"); -} - -function subscribeToFolder(refreshCallback, refreshCallbackData) { - var folderData = refreshCallbackData["folder"].split(":"); - var username = folderData[0]; - var folderPath = folderData[1]; - if (username != UserLogin) { - var url = (UserFolderURL + "../" + username - + "/" + folderPath + "/subscribe"); - if (document.subscriptionAjaxRequest) { - document.subscriptionAjaxRequest.aborted = true; - document.subscriptionAjaxRequest.abort(); - } - - var rfCbData = { method: refreshCallback, data: refreshCallbackData }; - document.subscriptionAjaxRequest = triggerAjaxRequest(url, - folderSubscriptionCallback, - rfCbData); - } - else - refreshCallbackData["window"].alert(_("You cannot subscribe to a folder that you own!")); -} - -function folderUnsubscriptionCallback(http) { - if (http.readyState == 4) { - removeFolderRequestCount--; - if (isHttpStatus204(http.status)) { - if (http.callbackData) - http.callbackData["method"](http.callbackData["data"]); - } - else - showAlertDialog(_("Unable to unsubscribe from that folder!")); - } -} - -function unsubscribeFromFolder(folderUrl, owner, refreshCallback, - refreshCallbackData) { - if (document.body.hasClassName("popup")) { - window.opener.unsubscribeFromFolder(folderUrl, owner, refreshCallback, - refreshCallbackData); - } - else { - if (owner.charAt(0) == '/') - owner = owner.substring(1); - if (owner != UserLogin) { - var url = folderUrl + "/unsubscribe"; - removeFolderRequestCount++; - var rfCbData = { method: refreshCallback, data: refreshCallbackData }; - triggerAjaxRequest(url, folderUnsubscriptionCallback, rfCbData); - } - else - showAlertDialog(_("You cannot unsubscribe from a folder that you own!")); - } -} - -function accessToSubscribedFolder(serverFolder) { - var folder; - - var parts = serverFolder.split(":"); - if (parts.length > 1) { - var username = parts[0]; - var paths = parts[1].split("/"); - if (username == UserLogin) { - folder = "/" + paths[1]; - } - else { - folder = "/" + username.asCSSIdentifier() + "_" + paths[1]; - } - } - else { - folder = serverFolder; - } - - return folder; -} - -function getSubscribedFolderOwner(serverFolder) { - var owner; - - var parts = serverFolder.split(":"); - if (parts.length > 1) { - owner = parts[0]; - } - - return owner; -} - -function getListIndexForFolder(items, owner, folderName) { - var i; - var previousOwner = null; - - for (i = 0; i < items.length; i++) { - if (items[i].id == '/personal') continue; - var currentFolderName = items[i].childNodesWithTag("span")[0].innerHTML.strip(); - var currentOwner = items[i].readAttribute('owner'); - if (currentOwner == owner) { - previousOwner = currentOwner; - if (currentFolderName > folderName) - break; - } - else if (previousOwner || - (currentOwner != UserLogin && currentOwner > owner)) { - break; - } - else if (currentOwner == "nobody") { - break; - } - } - - return i; -} - -function listRowMouseDownHandler(event) { - preventDefault(event); - return false; -} - -function reverseSortByAlarmTime(a, b) { - var x = parseInt(a[2]); - var y = parseInt(b[2]); - return (y - x); -} - -function refreshAlarms() { - var url; - var now = new Date(); - var utc = Math.floor(now.getTime()/1000); - - if (document.alarmsListAjaxRequest) - return false; - url = UserFolderURL + "Calendar/alarmslist?browserTime=" + utc; - document.alarmsListAjaxRequest - = triggerAjaxRequest(url, refreshAlarmsCallback); - - return true; -} - -function refreshAlarmsCallback(http) { - if (http.readyState == 4 - && http.status == 200) { - document.alarmsListAjaxRequest = null; - - if (http.responseText.length > 0) { - Alarms = http.responseText.evalJSON(true); - Alarms.sort(reverseSortByAlarmTime); - triggerNextAlarm(); - } - } - else - log ("refreshAlarmsCallback Ajax error"); -} - -function triggerNextAlarm() { - if (Alarms.length > 0) { - var next = Alarms.pop(); - var now = new Date(); - var utc = Math.floor(now.getTime()/1000); - var url = next[0] + '/' + next[1]; - var alarmTime = parseInt(next[2]); - var delay = alarmTime; - if (alarmTime > 0) delay -= utc; - var d = new Date(alarmTime*1000); - log ("now = " + now.toUTCString()); - log ("next event " + url + " in " + delay + " seconds (on " + d.toUTCString() + ")"); - showAlarm.delay(delay, url); - } -} - -function snoozeAlarm(url) { - url += "?snoozeAlarm=" + this.value; - triggerAjaxRequest(url, snoozeAlarmCallback); - disposeDialog(); -} - -function snoozeAlarmCallback(http) { - if (http.readyState == 4 - && http.status == 200) { - refreshAlarms(); - } -} - -function showAlarm(url) { - url = UserFolderURL + "Calendar/" + url + "/view"; - if (document.viewAlarmAjaxRequest) { - document.viewAlarmAjaxRequest.aborted = true; - document.viewAlarmAjaxRequest.abort(); - } - document.viewAlarmAjaxRequest = triggerAjaxRequest(url + "?resetAlarm=yes", showAlarmCallback, url); -} - -function showAlarmCallback(http) { - if (http.readyState == 4 - && http.status == 200) { - if (http.responseText.length) { - var url = http.callbackData; - var data = http.responseText.evalJSON(true); - var msg = _("Reminder:") + " " + data["summary"] + "\n"; - if (data["startDate"]) { - msg += _("Start:") + " " + data["startDate"]; - if (parseInt(data["isAllDay"]) == 0) - msg += " - " + data["startTime"]; - msg += "\n"; - } - if (data["dueDate"]) { - msg += _("Due Date:") + " " + data["dueDate"]; - if (data["dueTime"]) - msg += " - " + data["dueTime"]; - msg += "\n"; - } - if (data["location"].length) - msg += "\n" + _("Location:") + " " + data["location"]; - if (data["description"].length) - msg += "\n\n" + data["description"]; - - window.alert(msg.decodeEntities()); - showSelectDialog(data["summary"], _('Snooze for '), - { '5': _('5 minutes'), - '10': _('10 minutes'), - '15': _('15 minutes'), - '30': _('30 minutes'), - '45': _('45 minutes'), - '60': _('1 hour'), - '1440': _('1 day') }, - _('OK'), - snoozeAlarm, url, - '10'); - } - else - log("showAlarmCallback ajax error: no data received"); - } - else { - log("showAlarmCallback ajax error (" + http.status + "): " + http.url); - } - - triggerNextAlarm(); -} - -function initMenus() { - var menus = getMenus(); - if (menus) { - for (var menuID in menus) { - var menuDIV = $(menuID); - if (menuDIV) - initMenu(menuDIV, menus[menuID]); - else - log("Can't find menu " + menuID); - } - } -} - -function initMenu(menuDIV, callbacks) { - var uls = menuDIV.childNodesWithTag("ul"); - for (var i = 0, j = 0; i < uls.length; i++) { - var lis = $(uls[i]).childNodesWithTag("li"); - for (var k = 0; k < lis.length; k++, j++) { - var node = $(lis[k]); - node.on("mousedown", listRowMouseDownHandler); - var callback = callback = callbacks[j]; - if (callback) { - if (typeof(callback) == "string") { - if (callback == "-") - node.addClassName("separator"); - else { - node.submenu = callback; - node.addClassName("submenu"); - node.on("mouseover", popupSubmenu); - } - } - else { - node.menuCallback = callback; - node.on("mousedown", onMenuClickHandler); - } - } - else - node.addClassName("disabled"); - } - } -} - -function openExternalLink(anchor) { - return false; -} - -function openAclWindow(url) { - $(function () { - var w = window.open(url, "aclWindow", - "width=420,height=300,resizable=1,scrollbars=1,toolbar=0," - + "location=0,directories=0,status=0,menubar=0" - + ",copyhistory=0"); - w.opener = window; - w.focus(); - }).delay(0.1); -} - -function getUsersRightsWindowHeight() { - return usersRightsWindowHeight; -} - -function getUsersRightsWindowWidth() { - return usersRightsWindowWidth; -} - -function getTopWindow() { - var topWindow = null; - var currentWindow = window; - while (!topWindow) { - if ($(currentWindow.document.body).hasClassName("popup") - && currentWindow.opener - && currentWindow.opener.getTopWindow) - currentWindow = currentWindow.opener; - else - topWindow = currentWindow; - } - - return topWindow; -} - -//function enableAnchor(anchor) { -// var classStr = '' + anchor.getAttribute("class"); -// var position = classStr.indexOf("_disabled", 0); -// if (position > -1) { -// var disabledHref = anchor.getAttribute("disabled-href"); -// if (disabledHref) -// anchor.setAttribute("href", disabledHref); -// var disabledOnclick = anchor.getAttribute("disabled-onclick"); -// if (disabledOnclick) -// anchor.setAttribute("onclick", disabledOnclick); -// anchor.removeClassName("_disabled"); -// anchor.setAttribute("disabled-href", null); -// anchor.setAttribute("disabled-onclick", null); -// anchor.disabled = 0; -// anchor.enabled = 1; -// } -//} - -//function disableAnchor(anchor) { -// var classStr = '' + anchor.getAttribute("class"); -// var position = classStr.indexOf("_disabled", 0); -// if (position < 0) { -// var href = anchor.getAttribute("href"); -// if (href) -// anchor.setAttribute("disabled-href", href); -// var onclick = anchor.getAttribute("onclick"); -// if (onclick) -// anchor.setAttribute("disabled-onclick", onclick); -// anchor.addClassName("_disabled"); -// anchor.setAttribute("href", "#"); -// anchor.setAttribute("onclick", "return false;"); -// anchor.disabled = 1; -// anchor.enabled = 0; -// } -//} - -function d2h(d) { - var hD = "0123456789abcdef"; - var h = hD.substr(d & 15, 1); - - while (d > 15) { - d >>= 4; - h = hD.substr(d & 15, 1) + h; - } - - return h; -} - -function indexColor(number) { - var color; - - if (number == 0) - color = "#ccf"; - else { - var colorTable = new Array(1, 1, 1); - - var currentValue = number; - var index = 0; - while (currentValue) { - if (currentValue & 1) - colorTable[index]++; - if (index == 3) - index = 0; - currentValue >>= 1; - index++; - } - - color = ("#" - + d2h((256 / colorTable[2]) - 1) - + d2h((256 / colorTable[1]) - 1) - + d2h((256 / colorTable[0]) - 1)); - } - - return color; -} - -function onLoadHandler(event) { - queryParameters = parseQueryParameters('' + window.location); - if (!$(document.body).hasClassName("popup")) { - initLogConsole(); - if ($("calendarBannerLink")) { - refreshAlarms(); - } - } - initCriteria(); - configureSearchField(); - initMenus(); - configureDragHandles(); - configureLinkBanner(); - var progressImage = $("progressIndicator"); - if (progressImage) - progressImage.parentNode.removeChild(progressImage); - $(document.body).observe("contextmenu", onBodyClickContextMenu); - - // Some module are initialized only once this method is completed - document.fire('generic:loaded'); - - onFinalLoadHandler(); -} - -function onCloseButtonClick(event) { - if (event) - Event.stop(event); - - if (window.frameElement && window.frameElement.id) { - var bgDiv = parent$("bgFrameDiv"); - jQuery(bgDiv).fadeOut('fast', function(event) { - var div = parent$("popupFrame"); - div.hide(); - div.down("iframe").src = "/SOGo/loading"; - }); - } - else { - window.close(); - } - - return false; -} - -function onBodyClickContextMenu(event) { - var target = $(event.target); - if (!(target - && (target.tagName == "INPUT" - || target.tagName == "TEXTAREA" - || (target.tagName == "A" - && target.hasClassName("clickableLink"))))) - preventDefault(event); -} - -function configureSortableTableHeaders(table) { - var headers = $(table).getElementsByClassName("sortableTableHeader"); - for (var i = 0; i < headers.length; i++) { - var header = $(headers[i]); - header.observe("selectstart", listRowMouseDownHandler); - header.stopObserving("click", onHeaderClick); - header.observe("click", onHeaderClick); - } -} - -function onLinkBannerClick() { - activeAjaxRequests++; - checkAjaxRequestsState(); -} - -function onPreferencesClick(event) { - var urlstr = UserFolderURL + "preferences"; - var div = $("popupFrame"); - if (div) { - if (div.hasClassName("small")) - div.removeClassName("small"); - var iframe = div.down("iframe"); - iframe.src = urlstr; - iframe.id = "preferencesFrame"; - var bgDiv = $("bgFrameDiv"); - if (bgDiv) { - bgDiv.show(); - } - else { - bgDiv = createElement("div", "bgFrameDiv", ["bgMail"]); - document.body.appendChild(bgDiv); - } - div.show(); //setStyle({display: "block"}); - } - else { - var w = window.open(urlstr, "SOGoPreferences", - "width=615,height=520,resizable=1,scrollbars=0,location=0"); - w.opener = window; - w.focus(); - } -} - -function configureLinkBanner() { - var linkBanner = $("linkBanner"); - if (linkBanner) { - var moduleLinks = [ "calendar", "contacts", "mail" ]; - for (var i = 0; i < moduleLinks.length; i++) { - var link = $(moduleLinks[i] + "BannerLink"); - if (link) { - link.observe("mousedown", listRowMouseDownHandler); - link.observe("click", onLinkBannerClick); - } - } - link = $("preferencesBannerLink"); - if (link) { - link.observe("mousedown", listRowMouseDownHandler); - link.observe("click", clickEventWrapper(onPreferencesClick)); - } - link = $("consoleBannerLink"); - if (link) { - link.observe("mousedown", listRowMouseDownHandler); - link.observe("click", toggleLogConsole); - } - } -} - -function configureLinks(element) { - var onAnchorClick = function (event) { - if (this.href) - window.open(this.href); - preventDefault(event); - }; - var anchors = element.getElementsByTagName('a'); - for (var i = 0; i < anchors.length; i++) { - var anchor = $(anchors[i]); - if (!anchor.href && anchor.readAttribute("moz-do-not-send")) { - anchor.writeAttribute("moz-do-not-send", false); - anchor.removeClassName("moz-txt-link-abbreviated"); - anchor.href = "mailto:" + anchors[i].innerHTML; - } - if (anchor.href.substring(0,7) == "mailto:") { - anchor.observe("click", onEmailTo); - if (typeof onEmailAddressClick == 'function') - anchor.observe("contextmenu", onEmailAddressClick); - anchor.writeAttribute("moz-do-not-send", false); - } - else if (!anchor.id) - anchor.observe("click", onAnchorClick); - } -} - -function CurrentModule() { - var module = null; - if (ApplicationBaseURL) { - var parts = ApplicationBaseURL.split("/"); - var last = parts.length - 1; - module = parts[last]; - } - - return module; -} - -/* accessing another user's data */ -function UserFolderURLForUser(user) { - var folderArray = UserFolderURL.split("/"); - var count; - if (UserFolderURL.endsWith('/')) - count = folderArray.length - 2; - else - count = folderArray.length - 1; - folderArray[count] = escape(user); - - return folderArray.join("/"); -} - -/* folder creation */ -function createFolder(name, okCB, notOkCB) { - if (name) { - if (document.newFolderAjaxRequest) { - document.newFolderAjaxRequest.aborted = true; - document.newFolderAjaxRequest.abort(); - } - var url = ApplicationBaseURL + "/createFolder?name=" + escape(name.utf8encode()); - 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, UserLogin); - } - else if (http.status == 409) { - alert (_("A folder by that name already exists.")); - } - else { - if (data.notOkCB) - data.notOkCB(name); - else - log("ajax problem:" + http.status); - } - } -} - -/* invitation delegation */ -function delegateInvitation(componentUrl, callbackFunction, callbackData) { - var input = $("delegatedTo"); - var delegatedTo = null; - if (input.readAttribute("uid") != null) { - delegatedTo = input.readAttribute("uid"); - } - else if (input.value.blank()) { - alert(_("noEmailForDelegation")); - } - else { - delegatedTo = input.value; - } - - if (delegatedTo) { - var receiveUpdates = false; //confirm("Do you want to keep receiving updates on the event?"); - var urlstr = componentUrl + "/delegate"; - var parameters = "to=" + delegatedTo + "&receiveUpdates=" + (receiveUpdates?"YES":"NO"); - triggerAjaxRequest(urlstr, callbackFunction, callbackData, parameters, - { "Content-type": "application/x-www-form-urlencoded" }); - } -} - -function onFinalLoadHandler(event) { - var safetyNet = $("javascriptSafetyNet"); - if (safetyNet) - safetyNet.parentNode.removeChild(safetyNet); -} - -function parent$(element) { - var div = $("popupFrame"); - - if (div) - p = parent.document; - else if (this.opener) - p = this.opener.document; - else - p = null; - - return (p ? p.getElementById(element) : null); -} - -function parentvar(name) { - var div = $("popupFrame"); - - if (div) - p = parent; - else if (this.opener) - p = this.opener; - else - p = null; - - return (p ? p[name] : null); -} - -/* stubs */ -function refreshCurrentFolder(id) { -} - -function configureDragHandles() { -} - -function getMenus() { -} - -function onHeaderClick(event) { -} - -function _(key) { - var value = key; - if (labels[key]) { - value = labels[key]; - } - else { - var topWindow = getTopWindow(); - if (topWindow && topWindow.clabels && topWindow.clabels[key]) - value = topWindow.clabels[key]; - } - - return value; -} - -/** - * - * AJAX IFRAME METHOD (AIM) - * http://www.webtoolkit.info/ - * - **/ - -AIM = { - frame: function(c) { - var d = new Element('div'); - var n = d.identify(); - d.innerHTML = ''; - document.body.appendChild(d); - var i = $(n); - if (c && typeof(c.onComplete) == 'function') - i.onComplete = c.onComplete; - return n; - }, - - form: function(f, name) { - f.writeAttribute('target', name); - }, - - submit: function(f, c) { - var id = AIM.frame(c); - AIM.form(f, id); - if (c && typeof(c.onStart) == 'function') - return c.onStart(); - else - return $(id); - }, - - loaded: function(id) { - var i = $(id); - var d; - if (i.contentDocument) { - d = i.contentDocument; - } - else if (i.contentWindow) { - d = i.contentWindow.document; - } - else { - d = window.frames[id].document; - } - if (d.location.href == "about:blank") - return; - if (typeof(i.onComplete) == 'function') { - i.onComplete(Element.allTextContent(d.body)); - } - } -}; - -function createDialog(id, title, legend, content, positionClass) { - if (!positionClass) - positionClass = "left"; - var newDialog = createElement("div", id, ["dialog", positionClass]); - newDialog.setStyle({"display": "none"}); - - if (positionClass == "none" || positionClass == "searchMail") { - var bgDiv = $("bgDialogDiv"); - if (bgDiv) { - bgDiv.show(); - } - else { - bgDiv = createElement("div", "bgDialogDiv", ["bgDialog"]); - document.body.appendChild(bgDiv); - //bgDiv.observe("click", disposeDialog); - } - } - - var subdiv = createElement("div", null, null, null, null, newDialog); - if (title && title.length > 0) { - var titleh3 = createElement("h3", null, null, null, null, subdiv); - titleh3.update(title); - } - if (legend) { - if (Object.isElement(legend)) - subdiv.appendChild(legend); - else if (legend.length > 0) { - var legendP = createElement("p", null, null, null, null, subdiv); - legendP.appendChild(document.createTextNode(legend)); - } - } - if (content) - subdiv.appendChild(content); - createElement("hr", null, null, null, null, subdiv); - - return newDialog; -} - -function createButton(id, caption, action) { - var newButton = createElement("a", id, "button", { "href": "#" }); - if (caption && caption.length > 0) { - var span = createElement("span", null, null, null, null, newButton); - span.appendChild(document.createTextNode(caption)); - } - if (action) { - newButton.on("click", clickEventWrapper(action)); - } - - return newButton; -} - -function showAlertDialog(label) { - var div = $("bgDialogDiv"); - if (div && div.visible() && div.getOpacity() > 0) - dialogsStack.push(_showAlertDialog.bind(this, label)); - else - _showAlertDialog(label); -} - -function _showAlertDialog(label) { - var dialog = dialogs[label]; - if (dialog) { - $("bgDialogDiv").show(); - } - else { - var fields = createElement("p"); - fields.appendChild(createButton(null, - _("OK"), - disposeDialog)); - dialog = createDialog(null, - _("Warning"), - label, - fields, - "none"); - document.body.appendChild(dialog); - dialogs[label] = dialog; - } - if (Prototype.Browser.IE) - jQuery('#bgDialogDiv').css('opacity', 0.4); - jQuery(dialog).fadeIn('fast'); -} - -function showConfirmDialog(title, label, callbackYes, callbackNo, yesLabel, noLabel) { - var div = $("bgDialogDiv"); - if (div && div.visible() && div.getOpacity() > 0) - dialogsStack.push(_showConfirmDialog.bind(this, title, label, callbackYes, callbackNo, yesLabel, noLabel)); - else - _showConfirmDialog(title, label, callbackYes, callbackNo, yesLabel, noLabel); -} - -function _showConfirmDialog(title, label, callbackYes, callbackNo, yesLabel, noLabel) { - var key = title; - if (Object.isElement(label)) key += label.allTextContent(); - else key += label; - var dialog = dialogs[key]; - if (dialog) { - $("bgDialogDiv").show(); - - // Update callbacks on buttons - var buttons = dialog.getElementsByTagName("a"); - buttons[0].stopObserving(); - buttons[0].on("click", callbackYes); - buttons[1].stopObserving(); - buttons[1].on("click", callbackNo || disposeDialog); - } - else { - var fields = createElement("p"); - fields.appendChild(createButton(null, _(yesLabel || "Yes"), callbackYes)); - fields.appendChild(createButton(null, _(noLabel || "No"), callbackNo || disposeDialog)); - dialog = createDialog(null, - title, - label, - fields, - "none"); - document.body.appendChild(dialog); - dialogs[key] = dialog; - } - if (Prototype.Browser.IE) - jQuery('#bgDialogDiv').css('opacity', 0.4); - jQuery(dialog).fadeIn('fast'); -} - -function showPromptDialog(title, label, callback, defaultValue) { - var div = $("bgDialogDiv"); - if (div && div.visible() && div.getOpacity() > 0) - dialogsStack.push(_showPromptDialog.bind(this, title, label, callback, defaultValue)); - else - _showPromptDialog(title, label, callback, defaultValue); -} - -function _showPromptDialog(title, label, callback, defaultValue) { - var dialog = dialogs[title+label]; - v = defaultValue?defaultValue:""; - if (dialog) { - $("bgDialogDiv").show(); - dialog.down("input").value = v; - } - else { - var fields = createElement("p", null, ["prompt"]); - fields.appendChild(document.createTextNode(label)); - var input = createElement("input", null, "textField", - { type: "text", "value": v }, - { previousValue: v }); - fields.appendChild(input); - fields.appendChild(createButton(null, - _("OK"), - callback.bind(input))); - fields.appendChild(createButton(null, - _("Cancel"), - disposeDialog)); - dialog = createDialog(null, - title, - null, - fields, - "none"); - document.body.appendChild(dialog); - dialogs[title+label] = dialog; - } - if (Prototype.Browser.IE) - jQuery('#bgDialogDiv').css('opacity', 0.4); - jQuery(dialog).fadeIn('fast', function () { - var input = dialog.down("input"); - input.selectText(0, input.value.length); - }); -} - -function showSelectDialog(title, label, options, button, callbackFcn, callbackArg, defaultValue) { - var div = $("bgDialogDiv"); - if (div && div.visible() && div.getOpacity() > 0) { - dialogsStack.push(_showSelectDialog.bind(this, title, label, options, button, callbackFcn, callbackArg, defaultValue)); - } - else - _showSelectDialog(title, label, options, button, callbackFcn, callbackArg, defaultValue); -} - -function _showSelectDialog(title, label, options, button, callbackFcn, callbackArg, defaultValue) { - var dialog = dialogs[title+label]; - if (dialog) { - $("bgDialogDiv").show(); - } - else { - var fields = createElement("p", null, []); - fields.update(label); - var select = createElement("select"); //, null, null, { cname: name } ); - fields.appendChild(select); - var values = $H(options).keys(); - for (var i = 0; i < values.length; i++) { - var option = createElement("option", null, null, - { value: values[i] }, null, select); - option.update(options[values[i]]); - } - fields.appendChild(createElement("br")); - - fields.appendChild(createButton(null, - button, - callbackFcn.bind(select, callbackArg))); - fields.appendChild(createButton(null, - _("Cancel"), - disposeDialog)); - dialog = createDialog(null, - title, - null, - fields, - "none"); - document.body.appendChild(dialog); - dialogs[title+label] = dialog; - } - if (defaultValue) - defaultOption = dialog.down('option[value="'+defaultValue+'"]').selected = true; - if (Prototype.Browser.IE) - jQuery('#bgDialogDiv').css('opacity', 0.4); - jQuery(dialog).fadeIn('fast'); -} - -function showAuthenticationDialog(label, callback) { - var div = $("bgDialogDiv"); - if (div && div.visible() && div.getOpacity() > 0) - dialogsStack.push(_showAuthenticationDialog.bind(this, label, callback)); - else - _showAuthenticationDialog(label, callback); -} - -function _showAuthenticationDialog(label, callback) { - var dialog = dialogs[label]; - if (dialog) { - $("bgDialogDiv").show(); - var inputs = dialog.getElementsByTagName("input"); - for (var i = 0; i < inputs.length; i++) { - inputs[i].value = ""; - } - } - else { - var fields = createElement("p", null, ["prompt"]); - fields.appendChild(document.createTextNode(_("Username:"))); - var un_input = createElement("input", null, "textField", - { type: "text", "value": "" }); - fields.appendChild(un_input); - fields.appendChild(document.createTextNode(_("Password:"))); - var pw_input = createElement("input", null, "textField", - { type: "password", "value": "" }); - fields.appendChild(pw_input); - function callbackWrapper() { - callback(un_input.value, pw_input.value); - } - fields.appendChild(createButton(null, _("OK"), callbackWrapper)); - fields.appendChild(createButton(null, _("Cancel"), disposeDialog)); - dialog = createDialog(null, label, null, fields, "none"); - document.body.appendChild(dialog); - dialogs[label] = dialog; - } - if (Prototype.Browser.IE) - jQuery('#bgDialogDiv').css('opacity', 0.4); - jQuery(dialog).fadeIn('fast', function () { dialog.down("input").focus(); }); -} - -function disposeDialog() { - $$("DIV.dialog").each(function(div) { - if (div.visible() && div.getOpacity() == 1) - jQuery(div).fadeOut('fast'); - }); - if (dialogsStack.length > 0) { - // Show the next dialog box - var dialogFcn = dialogsStack.first(); - dialogsStack.splice(0, 1); - dialogFcn.delay(0.2); - } - else if ($('bgDialogDiv')) { - // By the end the background fade out, a new dialog - // may need to be displayed. - jQuery('#bgDialogDiv').fadeOut('fast', _disposeDialog); - } -} - -function _disposeDialog() { - if (dialogsStack.length) { - var div = $("bgDialogDiv"); - jQuery(div).fadeIn(100); - var dialogFcn = dialogsStack.first(); - dialogsStack.splice(0, 1); - dialogFcn(); - } -} - -function readCookie(name) { - var foundCookie = null; - - var prefix = name + "="; - var pairs = document.cookie.split(';'); - for (var i = 0; !foundCookie && i < pairs.length; i++) { - var currentPair = pairs[i]; - var start = 0; - while (currentPair.charAt(start) == " ") - start++; - if (start > 0) - currentPair = currentPair.substr(start); - if (currentPair.indexOf(prefix) == 0) - foundCookie = currentPair.substr(prefix.length); - } - - return foundCookie; -} - -function readLoginCookie() { - var loginValues = null; - var cookie = readCookie("0xHIGHFLYxSOGo"); - if (cookie && cookie.length > 8) { - var value = decodeURIComponent(cookie.substr(8)); - loginValues = value.base64decode().split(":"); - } - - return loginValues; -} - -/* logging widgets */ -function SetLogMessage(containerId, message, msgType) { - var container = $(containerId); - if (container) { - if (!msgType) - msgType = "error"; - var typeClass = msgType + "Message"; - if (!container.typeClass || container.typeClass != typeClass) { - if (container.typeClass) { - container.removeClassName(container.typeClass); - } - container.typeClass = typeClass; - container.addClassName(typeClass); - } - if (container.message != message) { - while (container.lastChild) { - container.removeChild(container.lastChild); - } - if (message && message.length > 0) { - var sentences = message.split("\n"); - container.appendChild(document.createTextNode(sentences[0])); - for (var i = 1; i < sentences.length; i++) { - container.appendChild(document.createElement("br")); - container.appendChild(document.createTextNode(sentences[i])); - } - } - container.message = message; - } - } -} - -document.observe("dom:loaded", onLoadHandler); diff --git a/UI/WebServerResources/goto-today.png b/UI/WebServerResources/goto-today.png deleted file mode 100644 index e92627908..000000000 Binary files a/UI/WebServerResources/goto-today.png and /dev/null differ diff --git a/UI/WebServerResources/green_corner.gif b/UI/WebServerResources/green_corner.gif deleted file mode 100644 index 6a06d0583..000000000 Binary files a/UI/WebServerResources/green_corner.gif and /dev/null differ diff --git a/UI/WebServerResources/icon-deleted.png b/UI/WebServerResources/icon-deleted.png deleted file mode 100644 index 147db859d..000000000 Binary files a/UI/WebServerResources/icon-deleted.png and /dev/null differ diff --git a/UI/WebServerResources/icon-forwarded-replied.png b/UI/WebServerResources/icon-forwarded-replied.png deleted file mode 100644 index 17c18ffe4..000000000 Binary files a/UI/WebServerResources/icon-forwarded-replied.png and /dev/null differ diff --git a/UI/WebServerResources/icon-forwarded.png b/UI/WebServerResources/icon-forwarded.png deleted file mode 100644 index 821af5c0d..000000000 Binary files a/UI/WebServerResources/icon-forwarded.png and /dev/null differ diff --git a/UI/WebServerResources/icon-new.png b/UI/WebServerResources/icon-new.png deleted file mode 100644 index 227ab50e4..000000000 Binary files a/UI/WebServerResources/icon-new.png and /dev/null differ diff --git a/UI/WebServerResources/icon-replied.png b/UI/WebServerResources/icon-replied.png deleted file mode 100644 index 9d0fb1ee5..000000000 Binary files a/UI/WebServerResources/icon-replied.png and /dev/null differ diff --git a/UI/WebServerResources/iefixes.css b/UI/WebServerResources/iefixes.css deleted file mode 100644 index aaf871494..000000000 --- a/UI/WebServerResources/iefixes.css +++ /dev/null @@ -1,260 +0,0 @@ -/* SOGoRootPage */ -HTML -{ overflow: hidden; } - -FORM -{ padding: 0px; - margin: 0px; } - -DIV#loginScreen A.button SPAN -{ padding: 0; } - -/* generic */ - -SPAN.disabledToolbarButton -{ filter: alpha(opacity=40); } - -DIV.javascriptPopupBackground -{ filter: alpha(opacity=60); } - -DIV.javascriptMessagePseudoWindow, -DIV.javascriptMessagePseudoTopWindow -{ filter: alpha(opacity=100); } - -DIV#windowButtons -{ height: 3em; } - -INPUT.button -{ border: 1px solid #fff; - border-right: 1px solid #666; - border-bottom: 1px solid #666; } - -.menu LI.disabled:hover -{ background-color: #E6E7E6; } - -UL#userList -{ top: 35px; } - -DIV.tabsContainer > DIV.scrollToolbar > A > SPAN -{ line-height: 12px; } - -DIV#popupFrame IFRAME -{ height: expression(document.body.clientHeight - 88 + "px") } - -DIV#bgFrameDiv, -DIV#bgDialogDiv -{ background-color: #555; - filter: alpha(opacity=40); } - -DIV.colorBox -{ line-height: 15px; } - -/* MailerUI */ - -IMG.dragMessage -{ filter: alpha(opacity=70); } - -TABLE.messageList TD -{ white-space: pre; } - -TABLE.messageList TR._selected TD -{ border-right: 1px solid #9ABCD8 !important; } - -TABLE.messageList TR.openedThread TD, -TABLE.messageList TR.closedThread TD, -TABLE.messageList TR.thread .messageThreadColumn -{ border-right: 1px solid #DDD; } - -TABLE.messageList TR.thread TD -{ border-right: 1px solid #EEE; } - -/* ContactsUI */ - -/*DIV#contactFoldersList SPAN.toolbarButton -{ padding: 2px; } */ - -/* UIxContactEditor */ - -DIV#editorTabs TABLE.frame INPUT.textField -{ margin: 0px; } - -INPUT.textField._invalid, INPUT.comboBoxField._invalid -{ background: #f66 !important; } - -/* SchedulerUI */ - -DIV.eventInside.tentative, -DIV.eventInside.needs-action -{ filter: alpha(opacity=70); } - -DIV.eventInside.delegated, -DIV.eventInside.declined -{ filter: alpha(opacity=40); } - -#calendarList DIV.colorBox, -#schedulerTabs DIV.colorBox -{ *display: inline; /* for IE7 */ } - -/* UIxAppointmentEditor */ - -DIV#attendeesMenu LI.separator -{ padding-left: 0px; } - -#eventView SPAN.content A -{ line-height: 2.5em; } - -#eventView SPAN.content > INPUT.textField -{ width: 99%; } - -/* UIxAttendeesEditor */ - -DIV#attendeesView -{ left: 0.5em; } - -TABLE#freeBusyAttendees TD.attendeeStatus, -TABLE#freeBusyAttendees TD.attendeeStatus DIV -{ width: 24px; } - -TABLE#freeBusyData TD.noFreeBusy -{ height: 25px } - -TABLE -{ empty-cells: show; /* no impact? */ } - -/* UIxCalendarProperties */ - -BUTTON#colorButton -{ margin-top: 2px; } - -DIV#propertiesTabs FIELDSET -{ padding: 5px; } - -DIV#propertiesTabs LEGEND -{ margin-bottom: 5px; } - -/* UIxMailPartICalViewer */ - -#iCalAttendees SPAN -{ display: block; - height: 18px; - border: 0px; - margin: 0px; - padding: 0px; } - -#iCalAttendees DIV.status-icon -{ margin-top: 2px; - border: 0px; - padding: 0px; } - -.clear -{ padding-top: 0; } - -#messageContent FIELDSET -{ padding: 0.5em 1.0em; } - -#messageContent FIELDSET DIV, -#messageContent FIELDSET P -{ margin: 1.0em; } - -/* UIxMailEditor */ -DIV#headerArea -{ padding-bottom: 0px; } - -TABLE#categoriesList -{ width: auto; } - -DIV#windowButtons -{ bottom: 11px; } - -TABLE.frame -{ margin-top: -4px; } - -TABLE.framenocaption -{ margin-top: 17px; } - -TABLE.frame TBODY -{ padding: 20px; } - -UL#calendarList, -UL#contactFolders -{ margin-top: 2px; } - -A.toolbarButton SPAN, -A.toolbarButton:hover SPAN { - height: 50px; - padding: 5px 2px 6px 5px; -} -A.smallToolbarButton, A.smallToolbarButton:hover -{ height: 34px; } -A.toolbarButton:active SPAN { - background-position: auto; /*broken*/ -} - -A.toolbarButton, A.toolbarButton SPAN, A.button, A.button SPAN -{ color: #262B33; } - -DIV#toolbar -{ overflow: hidden; } - -INPUT#statusPercent -{ width: 2em !important; } - -DIV#referencesListWrapper -{ margin-bottom: 0px; } - -DIV#listEditor TABLE TBODY TR TD:first-child -{ margin-bottom: 0px; - padding-bottom: 0px; } - -A#aboutClose -{ top: 25px;} - -.dialog h3 -{ font-size: 14px; } - -.dialog p -{ margin: 0px; } - -/* UIxPreferences */ - -DIV#filtersListWrapper -{ overflow-x: hidden; } - -dl.dl-horizontal -{ margin-top: 2px; - margin-bottom: 2px; } - -/* UIxComponentEditor */ - -.SOGoTimePickerMenu > DIV -{ width: 310px; } - -/* UIx*UserRights */ -BODY.popup DIV.dialog.none -{ left: 50%; - width: 350px; - margin-left: -175px; } - -/* SOGoDragHandles */ -.safetyBlock -{ background-color: #fff; - filter: alpha(opacity=0); } - -/* datepicker pseudo-elements fix for IE7 */ -.datepicker .prev, -.datepicker .next { - *zoom: expression( - this.runtimeStyle.zoom="1", - this.appendChild( document.createElement("small") ).className="ie-after" - ); -} -.datepicker .prev .ie-after { - zoom: expression( - this.runtimeStyle['zoom'] = '1', - this.innerHTML = '«'); -} -.datepicker .next .ie-after { - zoom: expression( - this.runtimeStyle['zoom'] = '1', - this.innerHTML = '»'); -} \ No newline at end of file diff --git a/UI/WebServerResources/important.png b/UI/WebServerResources/important.png deleted file mode 100644 index 91ed5127b..000000000 Binary files a/UI/WebServerResources/important.png and /dev/null differ diff --git a/UI/WebServerResources/input_bg.gif b/UI/WebServerResources/input_bg.gif deleted file mode 100644 index dc621e21a..000000000 Binary files a/UI/WebServerResources/input_bg.gif and /dev/null differ diff --git a/UI/WebServerResources/inverse.png b/UI/WebServerResources/inverse.png deleted file mode 100644 index b5b736283..000000000 Binary files a/UI/WebServerResources/inverse.png and /dev/null differ diff --git a/UI/WebServerResources/jquery-ui.js b/UI/WebServerResources/jquery-ui.js deleted file mode 100644 index 96f078011..000000000 --- a/UI/WebServerResources/jquery-ui.js +++ /dev/null @@ -1,2283 +0,0 @@ -/*! jQuery UI - v1.10.3 - 2013-07-18 -* http://jqueryui.com -* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js -* Copyright 2013 jQuery Foundation and other contributors Licensed MIT */ - -(function( $, undefined ) { - -var uuid = 0, - runiqueId = /^ui-id-\d+$/; - -// $.ui might exist from components with no dependencies, e.g., $.ui.position -$.ui = $.ui || {}; - -$.extend( $.ui, { - version: "1.10.3", - - keyCode: { - BACKSPACE: 8, - COMMA: 188, - DELETE: 46, - DOWN: 40, - END: 35, - ENTER: 13, - ESCAPE: 27, - HOME: 36, - LEFT: 37, - NUMPAD_ADD: 107, - NUMPAD_DECIMAL: 110, - NUMPAD_DIVIDE: 111, - NUMPAD_ENTER: 108, - NUMPAD_MULTIPLY: 106, - NUMPAD_SUBTRACT: 109, - PAGE_DOWN: 34, - PAGE_UP: 33, - PERIOD: 190, - RIGHT: 39, - SPACE: 32, - TAB: 9, - UP: 38 - } -}); - -// plugins -$.fn.extend({ - focus: (function( orig ) { - return function( delay, fn ) { - return typeof delay === "number" ? - this.each(function() { - var elem = this; - setTimeout(function() { - $( elem ).focus(); - if ( fn ) { - fn.call( elem ); - } - }, delay ); - }) : - orig.apply( this, arguments ); - }; - })( $.fn.focus ), - - scrollParent: function() { - var scrollParent; - if (($.ui.ie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) { - scrollParent = this.parents().filter(function() { - return (/(relative|absolute|fixed)/).test($.css(this,"position")) && (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x")); - }).eq(0); - } else { - scrollParent = this.parents().filter(function() { - return (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x")); - }).eq(0); - } - - return (/fixed/).test(this.css("position")) || !scrollParent.length ? $(document) : scrollParent; - }, - - zIndex: function( zIndex ) { - if ( zIndex !== undefined ) { - return this.css( "zIndex", zIndex ); - } - - if ( this.length ) { - var elem = $( this[ 0 ] ), position, value; - while ( elem.length && elem[ 0 ] !== document ) { - // Ignore z-index if position is set to a value where z-index is ignored by the browser - // This makes behavior of this function consistent across browsers - // WebKit always returns auto if the element is positioned - position = elem.css( "position" ); - if ( position === "absolute" || position === "relative" || position === "fixed" ) { - // IE returns 0 when zIndex is not specified - // other browsers return a string - // we ignore the case of nested elements with an explicit value of 0 - //
    - value = parseInt( elem.css( "zIndex" ), 10 ); - if ( !isNaN( value ) && value !== 0 ) { - return value; - } - } - elem = elem.parent(); - } - } - - return 0; - }, - - uniqueId: function() { - return this.each(function() { - if ( !this.id ) { - this.id = "ui-id-" + (++uuid); - } - }); - }, - - removeUniqueId: function() { - return this.each(function() { - if ( runiqueId.test( this.id ) ) { - $( this ).removeAttr( "id" ); - } - }); - } -}); - -// selectors -function focusable( element, isTabIndexNotNaN ) { - var map, mapName, img, - nodeName = element.nodeName.toLowerCase(); - if ( "area" === nodeName ) { - map = element.parentNode; - mapName = map.name; - if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { - return false; - } - img = $( "img[usemap=#" + mapName + "]" )[0]; - return !!img && visible( img ); - } - return ( /input|select|textarea|button|object/.test( nodeName ) ? - !element.disabled : - "a" === nodeName ? - element.href || isTabIndexNotNaN : - isTabIndexNotNaN) && - // the element and all of its ancestors must be visible - visible( element ); -} - -function visible( element ) { - return $.expr.filters.visible( element ) && - !$( element ).parents().addBack().filter(function() { - return $.css( this, "visibility" ) === "hidden"; - }).length; -} - -$.extend( $.expr[ ":" ], { - data: $.expr.createPseudo ? - $.expr.createPseudo(function( dataName ) { - return function( elem ) { - return !!$.data( elem, dataName ); - }; - }) : - // support: jQuery <1.8 - function( elem, i, match ) { - return !!$.data( elem, match[ 3 ] ); - }, - - focusable: function( element ) { - return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) ); - }, - - tabbable: function( element ) { - var tabIndex = $.attr( element, "tabindex" ), - isTabIndexNaN = isNaN( tabIndex ); - return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN ); - } -}); - -// support: jQuery <1.8 -if ( !$( "" ).outerWidth( 1 ).jquery ) { - $.each( [ "Width", "Height" ], function( i, name ) { - var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], - type = name.toLowerCase(), - orig = { - innerWidth: $.fn.innerWidth, - innerHeight: $.fn.innerHeight, - outerWidth: $.fn.outerWidth, - outerHeight: $.fn.outerHeight - }; - - function reduce( elem, size, border, margin ) { - $.each( side, function() { - size -= parseFloat( $.css( elem, "padding" + this ) ) || 0; - if ( border ) { - size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0; - } - if ( margin ) { - size -= parseFloat( $.css( elem, "margin" + this ) ) || 0; - } - }); - return size; - } - - $.fn[ "inner" + name ] = function( size ) { - if ( size === undefined ) { - return orig[ "inner" + name ].call( this ); - } - - return this.each(function() { - $( this ).css( type, reduce( this, size ) + "px" ); - }); - }; - - $.fn[ "outer" + name] = function( size, margin ) { - if ( typeof size !== "number" ) { - return orig[ "outer" + name ].call( this, size ); - } - - return this.each(function() { - $( this).css( type, reduce( this, size, true, margin ) + "px" ); - }); - }; - }); -} - -// support: jQuery <1.8 -if ( !$.fn.addBack ) { - $.fn.addBack = function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter( selector ) - ); - }; -} - -// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413) -if ( $( "" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) { - $.fn.removeData = (function( removeData ) { - return function( key ) { - if ( arguments.length ) { - return removeData.call( this, $.camelCase( key ) ); - } else { - return removeData.call( this ); - } - }; - })( $.fn.removeData ); -} - - - - - -// deprecated -$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); - -$.support.selectstart = "onselectstart" in document.createElement( "div" ); -$.fn.extend({ - disableSelection: function() { - return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) + - ".ui-disableSelection", function( event ) { - event.preventDefault(); - }); - }, - - enableSelection: function() { - return this.unbind( ".ui-disableSelection" ); - } -}); - -$.extend( $.ui, { - // $.ui.plugin is deprecated. Use $.widget() extensions instead. - plugin: { - add: function( module, option, set ) { - var i, - proto = $.ui[ module ].prototype; - for ( i in set ) { - proto.plugins[ i ] = proto.plugins[ i ] || []; - proto.plugins[ i ].push( [ option, set[ i ] ] ); - } - }, - call: function( instance, name, args ) { - var i, - set = instance.plugins[ name ]; - if ( !set || !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) { - return; - } - - for ( i = 0; i < set.length; i++ ) { - if ( instance.options[ set[ i ][ 0 ] ] ) { - set[ i ][ 1 ].apply( instance.element, args ); - } - } - } - }, - - // only used by resizable - hasScroll: function( el, a ) { - - //If overflow is hidden, the element might have extra content, but the user wants to hide it - if ( $( el ).css( "overflow" ) === "hidden") { - return false; - } - - var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", - has = false; - - if ( el[ scroll ] > 0 ) { - return true; - } - - // TODO: determine which cases actually cause this to happen - // if the element doesn't have the scroll set, see if it's possible to - // set the scroll - el[ scroll ] = 1; - has = ( el[ scroll ] > 0 ); - el[ scroll ] = 0; - return has; - } -}); - -})( jQuery ); -(function( $, undefined ) { - -var uuid = 0, - slice = Array.prototype.slice, - _cleanData = $.cleanData; -$.cleanData = function( elems ) { - for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { - try { - $( elem ).triggerHandler( "remove" ); - // http://bugs.jquery.com/ticket/8235 - } catch( e ) {} - } - _cleanData( elems ); -}; - -$.widget = function( name, base, prototype ) { - var fullName, existingConstructor, constructor, basePrototype, - // proxiedPrototype allows the provided prototype to remain unmodified - // so that it can be used as a mixin for multiple widgets (#8876) - proxiedPrototype = {}, - namespace = name.split( "." )[ 0 ]; - - name = name.split( "." )[ 1 ]; - fullName = namespace + "-" + name; - - if ( !prototype ) { - prototype = base; - base = $.Widget; - } - - // create selector for plugin - $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { - return !!$.data( elem, fullName ); - }; - - $[ namespace ] = $[ namespace ] || {}; - existingConstructor = $[ namespace ][ name ]; - constructor = $[ namespace ][ name ] = function( options, element ) { - // allow instantiation without "new" keyword - if ( !this._createWidget ) { - return new constructor( options, element ); - } - - // allow instantiation without initializing for simple inheritance - // must use "new" keyword (the code above always passes args) - if ( arguments.length ) { - this._createWidget( options, element ); - } - }; - // extend with the existing constructor to carry over any static properties - $.extend( constructor, existingConstructor, { - version: prototype.version, - // copy the object used to create the prototype in case we need to - // redefine the widget later - _proto: $.extend( {}, prototype ), - // track widgets that inherit from this widget in case this widget is - // redefined after a widget inherits from it - _childConstructors: [] - }); - - basePrototype = new base(); - // we need to make the options hash a property directly on the new instance - // otherwise we'll modify the options hash on the prototype that we're - // inheriting from - basePrototype.options = $.widget.extend( {}, basePrototype.options ); - $.each( prototype, function( prop, value ) { - if ( !$.isFunction( value ) ) { - proxiedPrototype[ prop ] = value; - return; - } - proxiedPrototype[ prop ] = (function() { - var _super = function() { - return base.prototype[ prop ].apply( this, arguments ); - }, - _superApply = function( args ) { - return base.prototype[ prop ].apply( this, args ); - }; - return function() { - var __super = this._super, - __superApply = this._superApply, - returnValue; - - this._super = _super; - this._superApply = _superApply; - - returnValue = value.apply( this, arguments ); - - this._super = __super; - this._superApply = __superApply; - - return returnValue; - }; - })(); - }); - constructor.prototype = $.widget.extend( basePrototype, { - // TODO: remove support for widgetEventPrefix - // always use the name + a colon as the prefix, e.g., draggable:start - // don't prefix for widgets that aren't DOM-based - widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name - }, proxiedPrototype, { - constructor: constructor, - namespace: namespace, - widgetName: name, - widgetFullName: fullName - }); - - // If this widget is being redefined then we need to find all widgets that - // are inheriting from it and redefine all of them so that they inherit from - // the new version of this widget. We're essentially trying to replace one - // level in the prototype chain. - if ( existingConstructor ) { - $.each( existingConstructor._childConstructors, function( i, child ) { - var childPrototype = child.prototype; - - // redefine the child widget using the same prototype that was - // originally used, but inherit from the new version of the base - $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto ); - }); - // remove the list of existing child constructors from the old constructor - // so the old child constructors can be garbage collected - delete existingConstructor._childConstructors; - } else { - base._childConstructors.push( constructor ); - } - - $.widget.bridge( name, constructor ); -}; - -$.widget.extend = function( target ) { - var input = slice.call( arguments, 1 ), - inputIndex = 0, - inputLength = input.length, - key, - value; - for ( ; inputIndex < inputLength; inputIndex++ ) { - for ( key in input[ inputIndex ] ) { - value = input[ inputIndex ][ key ]; - if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { - // Clone objects - if ( $.isPlainObject( value ) ) { - target[ key ] = $.isPlainObject( target[ key ] ) ? - $.widget.extend( {}, target[ key ], value ) : - // Don't extend strings, arrays, etc. with objects - $.widget.extend( {}, value ); - // Copy everything else by reference - } else { - target[ key ] = value; - } - } - } - } - return target; -}; - -$.widget.bridge = function( name, object ) { - var fullName = object.prototype.widgetFullName || name; - $.fn[ name ] = function( options ) { - var isMethodCall = typeof options === "string", - args = slice.call( arguments, 1 ), - returnValue = this; - - // allow multiple hashes to be passed on init - options = !isMethodCall && args.length ? - $.widget.extend.apply( null, [ options ].concat(args) ) : - options; - - if ( isMethodCall ) { - this.each(function() { - var methodValue, - instance = $.data( this, fullName ); - if ( !instance ) { - return $.error( "cannot call methods on " + name + " prior to initialization; " + - "attempted to call method '" + options + "'" ); - } - if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) { - return $.error( "no such method '" + options + "' for " + name + " widget instance" ); - } - methodValue = instance[ options ].apply( instance, args ); - if ( methodValue !== instance && methodValue !== undefined ) { - returnValue = methodValue && methodValue.jquery ? - returnValue.pushStack( methodValue.get() ) : - methodValue; - return false; - } - }); - } else { - this.each(function() { - var instance = $.data( this, fullName ); - if ( instance ) { - instance.option( options || {} )._init(); - } else { - $.data( this, fullName, new object( options, this ) ); - } - }); - } - - return returnValue; - }; -}; - -$.Widget = function( /* options, element */ ) {}; -$.Widget._childConstructors = []; - -$.Widget.prototype = { - widgetName: "widget", - widgetEventPrefix: "", - defaultElement: "
    ", - options: { - disabled: false, - - // callbacks - create: null - }, - _createWidget: function( options, element ) { - element = $( element || this.defaultElement || this )[ 0 ]; - this.element = $( element ); - this.uuid = uuid++; - this.eventNamespace = "." + this.widgetName + this.uuid; - this.options = $.widget.extend( {}, - this.options, - this._getCreateOptions(), - options ); - - this.bindings = $(); - this.hoverable = $(); - this.focusable = $(); - - if ( element !== this ) { - $.data( element, this.widgetFullName, this ); - this._on( true, this.element, { - remove: function( event ) { - if ( event.target === element ) { - this.destroy(); - } - } - }); - this.document = $( element.style ? - // element within the document - element.ownerDocument : - // element is window or document - element.document || element ); - this.window = $( this.document[0].defaultView || this.document[0].parentWindow ); - } - - this._create(); - this._trigger( "create", null, this._getCreateEventData() ); - this._init(); - }, - _getCreateOptions: $.noop, - _getCreateEventData: $.noop, - _create: $.noop, - _init: $.noop, - - destroy: function() { - this._destroy(); - // we can probably remove the unbind calls in 2.0 - // all event bindings should go through this._on() - this.element - .unbind( this.eventNamespace ) - // 1.9 BC for #7810 - // TODO remove dual storage - .removeData( this.widgetName ) - .removeData( this.widgetFullName ) - // support: jquery <1.6.3 - // http://bugs.jquery.com/ticket/9413 - .removeData( $.camelCase( this.widgetFullName ) ); - this.widget() - .unbind( this.eventNamespace ) - .removeAttr( "aria-disabled" ) - .removeClass( - this.widgetFullName + "-disabled " + - "ui-state-disabled" ); - - // clean up events and states - this.bindings.unbind( this.eventNamespace ); - this.hoverable.removeClass( "ui-state-hover" ); - this.focusable.removeClass( "ui-state-focus" ); - }, - _destroy: $.noop, - - widget: function() { - return this.element; - }, - - option: function( key, value ) { - var options = key, - parts, - curOption, - i; - - if ( arguments.length === 0 ) { - // don't return a reference to the internal hash - return $.widget.extend( {}, this.options ); - } - - if ( typeof key === "string" ) { - // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } - options = {}; - parts = key.split( "." ); - key = parts.shift(); - if ( parts.length ) { - curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); - for ( i = 0; i < parts.length - 1; i++ ) { - curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; - curOption = curOption[ parts[ i ] ]; - } - key = parts.pop(); - if ( value === undefined ) { - return curOption[ key ] === undefined ? null : curOption[ key ]; - } - curOption[ key ] = value; - } else { - if ( value === undefined ) { - return this.options[ key ] === undefined ? null : this.options[ key ]; - } - options[ key ] = value; - } - } - - this._setOptions( options ); - - return this; - }, - _setOptions: function( options ) { - var key; - - for ( key in options ) { - this._setOption( key, options[ key ] ); - } - - return this; - }, - _setOption: function( key, value ) { - this.options[ key ] = value; - - if ( key === "disabled" ) { - this.widget() - .toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value ) - .attr( "aria-disabled", value ); - this.hoverable.removeClass( "ui-state-hover" ); - this.focusable.removeClass( "ui-state-focus" ); - } - - return this; - }, - - enable: function() { - return this._setOption( "disabled", false ); - }, - disable: function() { - return this._setOption( "disabled", true ); - }, - - _on: function( suppressDisabledCheck, element, handlers ) { - var delegateElement, - instance = this; - - // no suppressDisabledCheck flag, shuffle arguments - if ( typeof suppressDisabledCheck !== "boolean" ) { - handlers = element; - element = suppressDisabledCheck; - suppressDisabledCheck = false; - } - - // no element argument, shuffle and use this.element - if ( !handlers ) { - handlers = element; - element = this.element; - delegateElement = this.widget(); - } else { - // accept selectors, DOM elements - element = delegateElement = $( element ); - this.bindings = this.bindings.add( element ); - } - - $.each( handlers, function( event, handler ) { - function handlerProxy() { - // allow widgets to customize the disabled handling - // - disabled as an array instead of boolean - // - disabled class as method for disabling individual parts - if ( !suppressDisabledCheck && - ( instance.options.disabled === true || - $( this ).hasClass( "ui-state-disabled" ) ) ) { - return; - } - return ( typeof handler === "string" ? instance[ handler ] : handler ) - .apply( instance, arguments ); - } - - // copy the guid so direct unbinding works - if ( typeof handler !== "string" ) { - handlerProxy.guid = handler.guid = - handler.guid || handlerProxy.guid || $.guid++; - } - - var match = event.match( /^(\w+)\s*(.*)$/ ), - eventName = match[1] + instance.eventNamespace, - selector = match[2]; - if ( selector ) { - delegateElement.delegate( selector, eventName, handlerProxy ); - } else { - element.bind( eventName, handlerProxy ); - } - }); - }, - - _off: function( element, eventName ) { - eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace; - element.unbind( eventName ).undelegate( eventName ); - }, - - _delay: function( handler, delay ) { - function handlerProxy() { - return ( typeof handler === "string" ? instance[ handler ] : handler ) - .apply( instance, arguments ); - } - var instance = this; - return setTimeout( handlerProxy, delay || 0 ); - }, - - _hoverable: function( element ) { - this.hoverable = this.hoverable.add( element ); - this._on( element, { - mouseenter: function( event ) { - $( event.currentTarget ).addClass( "ui-state-hover" ); - }, - mouseleave: function( event ) { - $( event.currentTarget ).removeClass( "ui-state-hover" ); - } - }); - }, - - _focusable: function( element ) { - this.focusable = this.focusable.add( element ); - this._on( element, { - focusin: function( event ) { - $( event.currentTarget ).addClass( "ui-state-focus" ); - }, - focusout: function( event ) { - $( event.currentTarget ).removeClass( "ui-state-focus" ); - } - }); - }, - - _trigger: function( type, event, data ) { - var prop, orig, - callback = this.options[ type ]; - - data = data || {}; - event = $.Event( event ); - event.type = ( type === this.widgetEventPrefix ? - type : - this.widgetEventPrefix + type ).toLowerCase(); - // the original event may come from any element - // so we need to reset the target on the new event - event.target = this.element[ 0 ]; - - // copy original event properties over to the new event - orig = event.originalEvent; - if ( orig ) { - for ( prop in orig ) { - if ( !( prop in event ) ) { - event[ prop ] = orig[ prop ]; - } - } - } - - this.element.trigger( event, data ); - return !( $.isFunction( callback ) && - callback.apply( this.element[0], [ event ].concat( data ) ) === false || - event.isDefaultPrevented() ); - } -}; - -$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { - $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { - if ( typeof options === "string" ) { - options = { effect: options }; - } - var hasOptions, - effectName = !options ? - method : - options === true || typeof options === "number" ? - defaultEffect : - options.effect || defaultEffect; - options = options || {}; - if ( typeof options === "number" ) { - options = { duration: options }; - } - hasOptions = !$.isEmptyObject( options ); - options.complete = callback; - if ( options.delay ) { - element.delay( options.delay ); - } - if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { - element[ method ]( options ); - } else if ( effectName !== method && element[ effectName ] ) { - element[ effectName ]( options.duration, options.easing, callback ); - } else { - element.queue(function( next ) { - $( this )[ method ](); - if ( callback ) { - callback.call( element[ 0 ] ); - } - next(); - }); - } - }; -}); - -})( jQuery ); -(function( $, undefined ) { - -var mouseHandled = false; -$( document ).mouseup( function() { - mouseHandled = false; -}); - -$.widget("ui.mouse", { - version: "1.10.3", - options: { - cancel: "input,textarea,button,select,option", - distance: 1, - delay: 0 - }, - _mouseInit: function() { - var that = this; - - this.element - .bind("mousedown."+this.widgetName, function(event) { - return that._mouseDown(event); - }) - .bind("click."+this.widgetName, function(event) { - if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) { - $.removeData(event.target, that.widgetName + ".preventClickEvent"); - event.stopImmediatePropagation(); - return false; - } - }); - - this.started = false; - }, - - // TODO: make sure destroying one instance of mouse doesn't mess with - // other instances of mouse - _mouseDestroy: function() { - this.element.unbind("."+this.widgetName); - if ( this._mouseMoveDelegate ) { - $(document) - .unbind("mousemove."+this.widgetName, this._mouseMoveDelegate) - .unbind("mouseup."+this.widgetName, this._mouseUpDelegate); - } - }, - - _mouseDown: function(event) { - // don't let more than one widget handle mouseStart - if( mouseHandled ) { return; } - - // we may have missed mouseup (out of window) - (this._mouseStarted && this._mouseUp(event)); - - this._mouseDownEvent = event; - - var that = this, - btnIsLeft = (event.which === 1), - // event.target.nodeName works around a bug in IE 8 with - // disabled inputs (#7620) - elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false); - if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { - return true; - } - - this.mouseDelayMet = !this.options.delay; - if (!this.mouseDelayMet) { - this._mouseDelayTimer = setTimeout(function() { - that.mouseDelayMet = true; - }, this.options.delay); - } - - if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { - this._mouseStarted = (this._mouseStart(event) !== false); - if (!this._mouseStarted) { - event.preventDefault(); - return true; - } - } - - // Click event may never have fired (Gecko & Opera) - if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) { - $.removeData(event.target, this.widgetName + ".preventClickEvent"); - } - - // these delegates are required to keep context - this._mouseMoveDelegate = function(event) { - return that._mouseMove(event); - }; - this._mouseUpDelegate = function(event) { - return that._mouseUp(event); - }; - $(document) - .bind("mousemove."+this.widgetName, this._mouseMoveDelegate) - .bind("mouseup."+this.widgetName, this._mouseUpDelegate); - - event.preventDefault(); - - mouseHandled = true; - return true; - }, - - _mouseMove: function(event) { - // IE mouseup check - mouseup happened when mouse was out of window - if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) { - return this._mouseUp(event); - } - - if (this._mouseStarted) { - this._mouseDrag(event); - return event.preventDefault(); - } - - if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { - this._mouseStarted = - (this._mouseStart(this._mouseDownEvent, event) !== false); - (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); - } - - return !this._mouseStarted; - }, - - _mouseUp: function(event) { - $(document) - .unbind("mousemove."+this.widgetName, this._mouseMoveDelegate) - .unbind("mouseup."+this.widgetName, this._mouseUpDelegate); - - if (this._mouseStarted) { - this._mouseStarted = false; - - if (event.target === this._mouseDownEvent.target) { - $.data(event.target, this.widgetName + ".preventClickEvent", true); - } - - this._mouseStop(event); - } - - return false; - }, - - _mouseDistanceMet: function(event) { - return (Math.max( - Math.abs(this._mouseDownEvent.pageX - event.pageX), - Math.abs(this._mouseDownEvent.pageY - event.pageY) - ) >= this.options.distance - ); - }, - - _mouseDelayMet: function(/* event */) { - return this.mouseDelayMet; - }, - - // These are placeholder methods, to be overriden by extending plugin - _mouseStart: function(/* event */) {}, - _mouseDrag: function(/* event */) {}, - _mouseStop: function(/* event */) {}, - _mouseCapture: function(/* event */) { return true; } -}); - -})(jQuery); -(function( $, undefined ) { - -$.widget("ui.draggable", $.ui.mouse, { - version: "1.10.3", - widgetEventPrefix: "drag", - options: { - addClasses: true, - appendTo: "parent", - axis: false, - connectToSortable: false, - containment: false, - cursor: "auto", - cursorAt: false, - grid: false, - handle: false, - helper: "original", - iframeFix: false, - opacity: false, - refreshPositions: false, - revert: false, - revertDuration: 500, - scope: "default", - scroll: true, - scrollSensitivity: 20, - scrollSpeed: 20, - snap: false, - snapMode: "both", - snapTolerance: 20, - stack: false, - zIndex: false, - - // callbacks - drag: null, - start: null, - stop: null - }, - _create: function() { - - if (this.options.helper === "original" && !(/^(?:r|a|f)/).test(this.element.css("position"))) { - this.element[0].style.position = "relative"; - } - if (this.options.addClasses){ - this.element.addClass("ui-draggable"); - } - if (this.options.disabled){ - this.element.addClass("ui-draggable-disabled"); - } - - this._mouseInit(); - - }, - - _destroy: function() { - this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" ); - this._mouseDestroy(); - }, - - _mouseCapture: function(event) { - - var o = this.options; - - $( document.activeElement ).blur(); - - // among others, prevent a drag on a resizable-handle - if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) { - return false; - } - - //Quit if we're not on a valid handle - this.handle = this._getHandle(event); - if (!this.handle) { - return false; - } - - $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() { - $("
    ") - .css({ - width: this.offsetWidth+"px", height: this.offsetHeight+"px", - position: "absolute", opacity: "0.001", zIndex: 1000 - }) - .css($(this).offset()) - .appendTo("body"); - }); - - return true; - - }, - - _mouseStart: function(event) { - - var o = this.options; - - //Create and append the visible helper - this.helper = this._createHelper(event); - - this.helper.addClass("ui-draggable-dragging"); - - //Cache the helper size - this._cacheHelperProportions(); - - //If ddmanager is used for droppables, set the global draggable - if($.ui.ddmanager) { - $.ui.ddmanager.current = this; - } - - /* - * - Position generation - - * This block generates everything position related - it's the core of draggables. - */ - - //Cache the margins of the original element - this._cacheMargins(); - - //Store the helper's css position - this.cssPosition = this.helper.css( "position" ); - this.scrollParent = this.helper.scrollParent(); - this.offsetParent = this.helper.offsetParent(); - this.offsetParentCssPosition = this.offsetParent.css( "position" ); - - //The element's absolute position on the page minus margins - this.offset = this.positionAbs = this.element.offset(); - this.offset = { - top: this.offset.top - this.margins.top, - left: this.offset.left - this.margins.left - }; - - //Reset scroll cache - this.offset.scroll = false; - - $.extend(this.offset, { - click: { //Where the click happened, relative to the element - left: event.pageX - this.offset.left, - top: event.pageY - this.offset.top - }, - parent: this._getParentOffset(), - relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper - }); - - //Generate the original position - this.originalPosition = this.position = this._generatePosition(event); - this.originalPageX = event.pageX; - this.originalPageY = event.pageY; - - //Adjust the mouse offset relative to the helper if "cursorAt" is supplied - (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); - - //Set a containment if given in the options - this._setContainment(); - - //Trigger event + callbacks - if(this._trigger("start", event) === false) { - this._clear(); - return false; - } - - //Recache the helper size - this._cacheHelperProportions(); - - //Prepare the droppable offsets - if ($.ui.ddmanager && !o.dropBehaviour) { - $.ui.ddmanager.prepareOffsets(this, event); - } - - - this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position - - //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003) - if ( $.ui.ddmanager ) { - $.ui.ddmanager.dragStart(this, event); - } - - return true; - }, - - _mouseDrag: function(event, noPropagation) { - // reset any necessary cached properties (see #5009) - if ( this.offsetParentCssPosition === "fixed" ) { - this.offset.parent = this._getParentOffset(); - } - - //Compute the helpers position - this.position = this._generatePosition(event); - this.positionAbs = this._convertPositionTo("absolute"); - - //Call plugins and callbacks and use the resulting position if something is returned - if (!noPropagation) { - var ui = this._uiHash(); - if(this._trigger("drag", event, ui) === false) { - this._mouseUp({}); - return false; - } - this.position = ui.position; - } - - if(!this.options.axis || this.options.axis !== "y") { - this.helper[0].style.left = this.position.left+"px"; - } - if(!this.options.axis || this.options.axis !== "x") { - this.helper[0].style.top = this.position.top+"px"; - } - if($.ui.ddmanager) { - $.ui.ddmanager.drag(this, event); - } - - return false; - }, - - _mouseStop: function(event) { - - //If we are using droppables, inform the manager about the drop - var that = this, - dropped = false; - if ($.ui.ddmanager && !this.options.dropBehaviour) { - dropped = $.ui.ddmanager.drop(this, event); - } - - //if a drop comes from outside (a sortable) - if(this.dropped) { - dropped = this.dropped; - this.dropped = false; - } - - //if the original element is no longer in the DOM don't bother to continue (see #8269) - if ( this.options.helper === "original" && !$.contains( this.element[ 0 ].ownerDocument, this.element[ 0 ] ) ) { - return false; - } - - if((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { - $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { - if(that._trigger("stop", event) !== false) { - that._clear(); - } - }); - } else { - if(this._trigger("stop", event) !== false) { - this._clear(); - } - } - - return false; - }, - - _mouseUp: function(event) { - //Remove frame helpers - $("div.ui-draggable-iframeFix").each(function() { - this.parentNode.removeChild(this); - }); - - //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003) - if( $.ui.ddmanager ) { - $.ui.ddmanager.dragStop(this, event); - } - - return $.ui.mouse.prototype._mouseUp.call(this, event); - }, - - cancel: function() { - - if(this.helper.is(".ui-draggable-dragging")) { - this._mouseUp({}); - } else { - this._clear(); - } - - return this; - - }, - - _getHandle: function(event) { - return this.options.handle ? - !!$( event.target ).closest( this.element.find( this.options.handle ) ).length : - true; - }, - - _createHelper: function(event) { - - var o = this.options, - helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper === "clone" ? this.element.clone().removeAttr("id") : this.element); - - if(!helper.parents("body").length) { - helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo)); - } - - if(helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) { - helper.css("position", "absolute"); - } - - return helper; - - }, - - _adjustOffsetFromHelper: function(obj) { - if (typeof obj === "string") { - obj = obj.split(" "); - } - if ($.isArray(obj)) { - obj = {left: +obj[0], top: +obj[1] || 0}; - } - if ("left" in obj) { - this.offset.click.left = obj.left + this.margins.left; - } - if ("right" in obj) { - this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; - } - if ("top" in obj) { - this.offset.click.top = obj.top + this.margins.top; - } - if ("bottom" in obj) { - this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; - } - }, - - _getParentOffset: function() { - - //Get the offsetParent and cache its position - var po = this.offsetParent.offset(); - - // This is a special case where we need to modify a offset calculated on start, since the following happened: - // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent - // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that - // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag - if(this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) { - po.left += this.scrollParent.scrollLeft(); - po.top += this.scrollParent.scrollTop(); - } - - //This needs to be actually done for all browsers, since pageX/pageY includes this information - //Ugly IE fix - if((this.offsetParent[0] === document.body) || - (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) { - po = { top: 0, left: 0 }; - } - - return { - top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), - left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) - }; - - }, - - _getRelativeOffset: function() { - - if(this.cssPosition === "relative") { - var p = this.element.position(); - return { - top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), - left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() - }; - } else { - return { top: 0, left: 0 }; - } - - }, - - _cacheMargins: function() { - this.margins = { - left: (parseInt(this.element.css("marginLeft"),10) || 0), - top: (parseInt(this.element.css("marginTop"),10) || 0), - right: (parseInt(this.element.css("marginRight"),10) || 0), - bottom: (parseInt(this.element.css("marginBottom"),10) || 0) - }; - }, - - _cacheHelperProportions: function() { - this.helperProportions = { - width: this.helper.outerWidth(), - height: this.helper.outerHeight() - }; - }, - - _setContainment: function() { - - var over, c, ce, - o = this.options; - - if ( !o.containment ) { - this.containment = null; - return; - } - - if ( o.containment === "window" ) { - this.containment = [ - $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left, - $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top, - $( window ).scrollLeft() + $( window ).width() - this.helperProportions.width - this.margins.left, - $( window ).scrollTop() + ( $( window ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top - ]; - return; - } - - if ( o.containment === "document") { - this.containment = [ - 0, - 0, - $( document ).width() - this.helperProportions.width - this.margins.left, - ( $( document ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top - ]; - return; - } - - if ( o.containment.constructor === Array ) { - this.containment = o.containment; - return; - } - - if ( o.containment === "parent" ) { - o.containment = this.helper[ 0 ].parentNode; - } - - c = $( o.containment ); - ce = c[ 0 ]; - - if( !ce ) { - return; - } - - over = c.css( "overflow" ) !== "hidden"; - - this.containment = [ - ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ), - ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ) , - ( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - this.helperProportions.width - this.margins.left - this.margins.right, - ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - this.helperProportions.height - this.margins.top - this.margins.bottom - ]; - this.relative_container = c; - }, - - _convertPositionTo: function(d, pos) { - - if(!pos) { - pos = this.position; - } - - var mod = d === "absolute" ? 1 : -1, - scroll = this.cssPosition === "absolute" && !( this.scrollParent[ 0 ] !== document && $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? this.offsetParent : this.scrollParent; - - //Cache the scroll - if (!this.offset.scroll) { - this.offset.scroll = {top : scroll.scrollTop(), left : scroll.scrollLeft()}; - } - - return { - top: ( - pos.top + // The absolute mouse position - this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent - this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border) - ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : this.offset.scroll.top ) * mod ) - ), - left: ( - pos.left + // The absolute mouse position - this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent - this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border) - ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : this.offset.scroll.left ) * mod ) - ) - }; - - }, - - _generatePosition: function(event) { - - var containment, co, top, left, - o = this.options, - scroll = this.cssPosition === "absolute" && !( this.scrollParent[ 0 ] !== document && $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? this.offsetParent : this.scrollParent, - pageX = event.pageX, - pageY = event.pageY; - - //Cache the scroll - if (!this.offset.scroll) { - this.offset.scroll = {top : scroll.scrollTop(), left : scroll.scrollLeft()}; - } - - /* - * - Position constraining - - * Constrain the position to a mix of grid, containment. - */ - - // If we are not dragging yet, we won't check for options - if ( this.originalPosition ) { - if ( this.containment ) { - if ( this.relative_container ){ - co = this.relative_container.offset(); - containment = [ - this.containment[ 0 ] + co.left, - this.containment[ 1 ] + co.top, - this.containment[ 2 ] + co.left, - this.containment[ 3 ] + co.top - ]; - } - else { - containment = this.containment; - } - - if(event.pageX - this.offset.click.left < containment[0]) { - pageX = containment[0] + this.offset.click.left; - } - if(event.pageY - this.offset.click.top < containment[1]) { - pageY = containment[1] + this.offset.click.top; - } - if(event.pageX - this.offset.click.left > containment[2]) { - pageX = containment[2] + this.offset.click.left; - } - if(event.pageY - this.offset.click.top > containment[3]) { - pageY = containment[3] + this.offset.click.top; - } - } - - if(o.grid) { - //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950) - top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY; - pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; - - left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX; - pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; - } - - } - - return { - top: ( - pageY - // The absolute mouse position - this.offset.click.top - // Click offset (relative to the element) - this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent - this.offset.parent.top + // The offsetParent's offset without borders (offset + border) - ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : this.offset.scroll.top ) - ), - left: ( - pageX - // The absolute mouse position - this.offset.click.left - // Click offset (relative to the element) - this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent - this.offset.parent.left + // The offsetParent's offset without borders (offset + border) - ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : this.offset.scroll.left ) - ) - }; - - }, - - _clear: function() { - this.helper.removeClass("ui-draggable-dragging"); - if(this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) { - this.helper.remove(); - } - this.helper = null; - this.cancelHelperRemoval = false; - }, - - // From now on bulk stuff - mainly helpers - - _trigger: function(type, event, ui) { - ui = ui || this._uiHash(); - $.ui.plugin.call(this, type, [event, ui]); - //The absolute position has to be recalculated after plugins - if(type === "drag") { - this.positionAbs = this._convertPositionTo("absolute"); - } - return $.Widget.prototype._trigger.call(this, type, event, ui); - }, - - plugins: {}, - - _uiHash: function() { - return { - helper: this.helper, - position: this.position, - originalPosition: this.originalPosition, - offset: this.positionAbs - }; - } - -}); - -$.ui.plugin.add("draggable", "connectToSortable", { - start: function(event, ui) { - - var inst = $(this).data("ui-draggable"), o = inst.options, - uiSortable = $.extend({}, ui, { item: inst.element }); - inst.sortables = []; - $(o.connectToSortable).each(function() { - var sortable = $.data(this, "ui-sortable"); - if (sortable && !sortable.options.disabled) { - inst.sortables.push({ - instance: sortable, - shouldRevert: sortable.options.revert - }); - sortable.refreshPositions(); // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page). - sortable._trigger("activate", event, uiSortable); - } - }); - - }, - stop: function(event, ui) { - - //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper - var inst = $(this).data("ui-draggable"), - uiSortable = $.extend({}, ui, { item: inst.element }); - - $.each(inst.sortables, function() { - if(this.instance.isOver) { - - this.instance.isOver = 0; - - inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance - this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work) - - //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: "valid/invalid" - if(this.shouldRevert) { - this.instance.options.revert = this.shouldRevert; - } - - //Trigger the stop of the sortable - this.instance._mouseStop(event); - - this.instance.options.helper = this.instance.options._helper; - - //If the helper has been the original item, restore properties in the sortable - if(inst.options.helper === "original") { - this.instance.currentItem.css({ top: "auto", left: "auto" }); - } - - } else { - this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance - this.instance._trigger("deactivate", event, uiSortable); - } - - }); - - }, - drag: function(event, ui) { - - var inst = $(this).data("ui-draggable"), that = this; - - $.each(inst.sortables, function() { - - var innermostIntersecting = false, - thisSortable = this; - - //Copy over some variables to allow calling the sortable's native _intersectsWith - this.instance.positionAbs = inst.positionAbs; - this.instance.helperProportions = inst.helperProportions; - this.instance.offset.click = inst.offset.click; - - if(this.instance._intersectsWith(this.instance.containerCache)) { - innermostIntersecting = true; - $.each(inst.sortables, function () { - this.instance.positionAbs = inst.positionAbs; - this.instance.helperProportions = inst.helperProportions; - this.instance.offset.click = inst.offset.click; - if (this !== thisSortable && - this.instance._intersectsWith(this.instance.containerCache) && - $.contains(thisSortable.instance.element[0], this.instance.element[0]) - ) { - innermostIntersecting = false; - } - return innermostIntersecting; - }); - } - - - if(innermostIntersecting) { - //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once - if(!this.instance.isOver) { - - this.instance.isOver = 1; - //Now we fake the start of dragging for the sortable instance, - //by cloning the list group item, appending it to the sortable and using it as inst.currentItem - //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one) - this.instance.currentItem = $(that).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item", true); - this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it - this.instance.options.helper = function() { return ui.helper[0]; }; - - event.target = this.instance.currentItem[0]; - this.instance._mouseCapture(event, true); - this.instance._mouseStart(event, true, true); - - //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes - this.instance.offset.click.top = inst.offset.click.top; - this.instance.offset.click.left = inst.offset.click.left; - this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left; - this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top; - - inst._trigger("toSortable", event); - inst.dropped = this.instance.element; //draggable revert needs that - //hack so receive/update callbacks work (mostly) - inst.currentItem = inst.element; - this.instance.fromOutside = inst; - - } - - //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable - if(this.instance.currentItem) { - this.instance._mouseDrag(event); - } - - } else { - - //If it doesn't intersect with the sortable, and it intersected before, - //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval - if(this.instance.isOver) { - - this.instance.isOver = 0; - this.instance.cancelHelperRemoval = true; - - //Prevent reverting on this forced stop - this.instance.options.revert = false; - - // The out event needs to be triggered independently - this.instance._trigger("out", event, this.instance._uiHash(this.instance)); - - this.instance._mouseStop(event, true); - this.instance.options.helper = this.instance.options._helper; - - //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size - this.instance.currentItem.remove(); - if(this.instance.placeholder) { - this.instance.placeholder.remove(); - } - - inst._trigger("fromSortable", event); - inst.dropped = false; //draggable revert needs that - } - - } - - }); - - } -}); - -$.ui.plugin.add("draggable", "cursor", { - start: function() { - var t = $("body"), o = $(this).data("ui-draggable").options; - if (t.css("cursor")) { - o._cursor = t.css("cursor"); - } - t.css("cursor", o.cursor); - }, - stop: function() { - var o = $(this).data("ui-draggable").options; - if (o._cursor) { - $("body").css("cursor", o._cursor); - } - } -}); - -$.ui.plugin.add("draggable", "opacity", { - start: function(event, ui) { - var t = $(ui.helper), o = $(this).data("ui-draggable").options; - if(t.css("opacity")) { - o._opacity = t.css("opacity"); - } - t.css("opacity", o.opacity); - }, - stop: function(event, ui) { - var o = $(this).data("ui-draggable").options; - if(o._opacity) { - $(ui.helper).css("opacity", o._opacity); - } - } -}); - -$.ui.plugin.add("draggable", "scroll", { - start: function() { - var i = $(this).data("ui-draggable"); - if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") { - i.overflowOffset = i.scrollParent.offset(); - } - }, - drag: function( event ) { - - var i = $(this).data("ui-draggable"), o = i.options, scrolled = false; - - if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") { - - if(!o.axis || o.axis !== "x") { - if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) { - i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed; - } else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity) { - i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed; - } - } - - if(!o.axis || o.axis !== "y") { - if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) { - i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed; - } else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity) { - i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed; - } - } - - } else { - - if(!o.axis || o.axis !== "x") { - if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) { - scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); - } else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) { - scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); - } - } - - if(!o.axis || o.axis !== "y") { - if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) { - scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); - } else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) { - scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); - } - } - - } - - if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { - $.ui.ddmanager.prepareOffsets(i, event); - } - - } -}); - -$.ui.plugin.add("draggable", "snap", { - start: function() { - - var i = $(this).data("ui-draggable"), - o = i.options; - - i.snapElements = []; - - $(o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap).each(function() { - var $t = $(this), - $o = $t.offset(); - if(this !== i.element[0]) { - i.snapElements.push({ - item: this, - width: $t.outerWidth(), height: $t.outerHeight(), - top: $o.top, left: $o.left - }); - } - }); - - }, - drag: function(event, ui) { - - var ts, bs, ls, rs, l, r, t, b, i, first, - inst = $(this).data("ui-draggable"), - o = inst.options, - d = o.snapTolerance, - x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, - y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; - - for (i = inst.snapElements.length - 1; i >= 0; i--){ - - l = inst.snapElements[i].left; - r = l + inst.snapElements[i].width; - t = inst.snapElements[i].top; - b = t + inst.snapElements[i].height; - - if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains( inst.snapElements[ i ].item.ownerDocument, inst.snapElements[ i ].item ) ) { - if(inst.snapElements[i].snapping) { - (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); - } - inst.snapElements[i].snapping = false; - continue; - } - - if(o.snapMode !== "inner") { - ts = Math.abs(t - y2) <= d; - bs = Math.abs(b - y1) <= d; - ls = Math.abs(l - x2) <= d; - rs = Math.abs(r - x1) <= d; - if(ts) { - ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top; - } - if(bs) { - ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top; - } - if(ls) { - ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left; - } - if(rs) { - ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left; - } - } - - first = (ts || bs || ls || rs); - - if(o.snapMode !== "outer") { - ts = Math.abs(t - y1) <= d; - bs = Math.abs(b - y2) <= d; - ls = Math.abs(l - x1) <= d; - rs = Math.abs(r - x2) <= d; - if(ts) { - ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top; - } - if(bs) { - ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top; - } - if(ls) { - ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left; - } - if(rs) { - ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left; - } - } - - if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) { - (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); - } - inst.snapElements[i].snapping = (ts || bs || ls || rs || first); - - } - - } -}); - -$.ui.plugin.add("draggable", "stack", { - start: function() { - var min, - o = this.data("ui-draggable").options, - group = $.makeArray($(o.stack)).sort(function(a,b) { - return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0); - }); - - if (!group.length) { return; } - - min = parseInt($(group[0]).css("zIndex"), 10) || 0; - $(group).each(function(i) { - $(this).css("zIndex", min + i); - }); - this.css("zIndex", (min + group.length)); - } -}); - -$.ui.plugin.add("draggable", "zIndex", { - start: function(event, ui) { - var t = $(ui.helper), o = $(this).data("ui-draggable").options; - if(t.css("zIndex")) { - o._zIndex = t.css("zIndex"); - } - t.css("zIndex", o.zIndex); - }, - stop: function(event, ui) { - var o = $(this).data("ui-draggable").options; - if(o._zIndex) { - $(ui.helper).css("zIndex", o._zIndex); - } - } -}); - -})(jQuery); -(function( $, undefined ) { - -function isOverAxis( x, reference, size ) { - return ( x > reference ) && ( x < ( reference + size ) ); -} - -$.widget("ui.droppable", { - version: "1.10.3", - widgetEventPrefix: "drop", - options: { - accept: "*", - activeClass: false, - addClasses: true, - greedy: false, - hoverClass: false, - scope: "default", - tolerance: "intersect", - - // callbacks - activate: null, - deactivate: null, - drop: null, - out: null, - over: null - }, - _create: function() { - - var o = this.options, - accept = o.accept; - - this.isover = false; - this.isout = true; - - this.accept = $.isFunction(accept) ? accept : function(d) { - return d.is(accept); - }; - - //Store the droppable's proportions - this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight }; - - // Add the reference and positions to the manager - $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || []; - $.ui.ddmanager.droppables[o.scope].push(this); - - (o.addClasses && this.element.addClass("ui-droppable")); - - }, - - _destroy: function() { - var i = 0, - drop = $.ui.ddmanager.droppables[this.options.scope]; - - for ( ; i < drop.length; i++ ) { - if ( drop[i] === this ) { - drop.splice(i, 1); - } - } - - this.element.removeClass("ui-droppable ui-droppable-disabled"); - }, - - _setOption: function(key, value) { - - if(key === "accept") { - this.accept = $.isFunction(value) ? value : function(d) { - return d.is(value); - }; - } - $.Widget.prototype._setOption.apply(this, arguments); - }, - - _activate: function(event) { - var draggable = $.ui.ddmanager.current; - if(this.options.activeClass) { - this.element.addClass(this.options.activeClass); - } - if(draggable){ - this._trigger("activate", event, this.ui(draggable)); - } - }, - - _deactivate: function(event) { - var draggable = $.ui.ddmanager.current; - if(this.options.activeClass) { - this.element.removeClass(this.options.activeClass); - } - if(draggable){ - this._trigger("deactivate", event, this.ui(draggable)); - } - }, - - _over: function(event) { - - var draggable = $.ui.ddmanager.current; - - // Bail if draggable and droppable are same element - if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) { - return; - } - - if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { - if(this.options.hoverClass) { - this.element.addClass(this.options.hoverClass); - } - this._trigger("over", event, this.ui(draggable)); - } - - }, - - _out: function(event) { - - var draggable = $.ui.ddmanager.current; - - // Bail if draggable and droppable are same element - if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) { - return; - } - - if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { - if(this.options.hoverClass) { - this.element.removeClass(this.options.hoverClass); - } - this._trigger("out", event, this.ui(draggable)); - } - - }, - - _drop: function(event,custom) { - - var draggable = custom || $.ui.ddmanager.current, - childrenIntersection = false; - - // Bail if draggable and droppable are same element - if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) { - return false; - } - - this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function() { - var inst = $.data(this, "ui-droppable"); - if( - inst.options.greedy && - !inst.options.disabled && - inst.options.scope === draggable.options.scope && - inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element)) && - $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance) - ) { childrenIntersection = true; return false; } - }); - if(childrenIntersection) { - return false; - } - - if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { - if(this.options.activeClass) { - this.element.removeClass(this.options.activeClass); - } - if(this.options.hoverClass) { - this.element.removeClass(this.options.hoverClass); - } - this._trigger("drop", event, this.ui(draggable)); - return this.element; - } - - return false; - - }, - - ui: function(c) { - return { - draggable: (c.currentItem || c.element), - helper: c.helper, - position: c.position, - offset: c.positionAbs - }; - } - -}); - -$.ui.intersect = function(draggable, droppable, toleranceMode) { - - if (!droppable.offset) { - return false; - } - - var draggableLeft, draggableTop, - x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width, - y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height, - l = droppable.offset.left, r = l + droppable.proportions.width, - t = droppable.offset.top, b = t + droppable.proportions.height; - - switch (toleranceMode) { - case "fit": - return (l <= x1 && x2 <= r && t <= y1 && y2 <= b); - case "intersect": - return (l < x1 + (draggable.helperProportions.width / 2) && // Right Half - x2 - (draggable.helperProportions.width / 2) < r && // Left Half - t < y1 + (draggable.helperProportions.height / 2) && // Bottom Half - y2 - (draggable.helperProportions.height / 2) < b ); // Top Half - case "pointer": - draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left); - draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top); - return isOverAxis( draggableTop, t, droppable.proportions.height ) && isOverAxis( draggableLeft, l, droppable.proportions.width ); - case "touch": - return ( - (y1 >= t && y1 <= b) || // Top edge touching - (y2 >= t && y2 <= b) || // Bottom edge touching - (y1 < t && y2 > b) // Surrounded vertically - ) && ( - (x1 >= l && x1 <= r) || // Left edge touching - (x2 >= l && x2 <= r) || // Right edge touching - (x1 < l && x2 > r) // Surrounded horizontally - ); - default: - return false; - } - -}; - -/* - This manager tracks offsets of draggables and droppables -*/ -$.ui.ddmanager = { - current: null, - droppables: { "default": [] }, - prepareOffsets: function(t, event) { - - var i, j, - m = $.ui.ddmanager.droppables[t.options.scope] || [], - type = event ? event.type : null, // workaround for #2317 - list = (t.currentItem || t.element).find(":data(ui-droppable)").addBack(); - - droppablesLoop: for (i = 0; i < m.length; i++) { - - //No disabled and non-accepted - if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) { - continue; - } - - // Filter out elements in the current dragged item - for (j=0; j < list.length; j++) { - if(list[j] === m[i].element[0]) { - m[i].proportions.height = 0; - continue droppablesLoop; - } - } - - m[i].visible = m[i].element.css("display") !== "none"; - if(!m[i].visible) { - continue; - } - - //Activate the droppable if used directly from draggables - if(type === "mousedown") { - m[i]._activate.call(m[i], event); - } - - m[i].offset = m[i].element.offset(); - m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight }; - - } - - }, - drop: function(draggable, event) { - - var dropped = false; - // Create a copy of the droppables in case the list changes during the drop (#9116) - $.each(($.ui.ddmanager.droppables[draggable.options.scope] || []).slice(), function() { - - if(!this.options) { - return; - } - if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance)) { - dropped = this._drop.call(this, event) || dropped; - } - - if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { - this.isout = true; - this.isover = false; - this._deactivate.call(this, event); - } - - }); - return dropped; - - }, - dragStart: function( draggable, event ) { - //Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003) - draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() { - if( !draggable.options.refreshPositions ) { - $.ui.ddmanager.prepareOffsets( draggable, event ); - } - }); - }, - drag: function(draggable, event) { - - //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse. - if(draggable.options.refreshPositions) { - $.ui.ddmanager.prepareOffsets(draggable, event); - } - - //Run through all droppables and check their positions based on specific tolerance options - $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { - - if(this.options.disabled || this.greedyChild || !this.visible) { - return; - } - - var parentInstance, scope, parent, - intersects = $.ui.intersect(draggable, this, this.options.tolerance), - c = !intersects && this.isover ? "isout" : (intersects && !this.isover ? "isover" : null); - if(!c) { - return; - } - - if (this.options.greedy) { - // find droppable parents with same scope - scope = this.options.scope; - parent = this.element.parents(":data(ui-droppable)").filter(function () { - return $.data(this, "ui-droppable").options.scope === scope; - }); - - if (parent.length) { - parentInstance = $.data(parent[0], "ui-droppable"); - parentInstance.greedyChild = (c === "isover"); - } - } - - // we just moved into a greedy child - if (parentInstance && c === "isover") { - parentInstance.isover = false; - parentInstance.isout = true; - parentInstance._out.call(parentInstance, event); - } - - this[c] = true; - this[c === "isout" ? "isover" : "isout"] = false; - this[c === "isover" ? "_over" : "_out"].call(this, event); - - // we just moved out of a greedy child - if (parentInstance && c === "isout") { - parentInstance.isout = false; - parentInstance.isover = true; - parentInstance._over.call(parentInstance, event); - } - }); - - }, - dragStop: function( draggable, event ) { - draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" ); - //Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003) - if( !draggable.options.refreshPositions ) { - $.ui.ddmanager.prepareOffsets( draggable, event ); - } - } -}; - -})(jQuery); diff --git a/UI/WebServerResources/jquery.fileupload.css b/UI/WebServerResources/jquery.fileupload.css deleted file mode 100644 index fb6044d34..000000000 --- a/UI/WebServerResources/jquery.fileupload.css +++ /dev/null @@ -1,36 +0,0 @@ -@charset "UTF-8"; -/* - * jQuery File Upload Plugin CSS 1.3.0 - * https://github.com/blueimp/jQuery-File-Upload - * - * Copyright 2013, Sebastian Tschan - * https://blueimp.net - * - * Licensed under the MIT license: - * http://www.opensource.org/licenses/MIT - */ - -.fileinput-button { - position: relative; - overflow: hidden; -} -.fileinput-button input { - position: absolute; - top: 0; - right: 0; - margin: 0; - opacity: 0; - -ms-filter: 'alpha(opacity=0)'; - font-size: 200px; - direction: ltr; - cursor: pointer; -} - -/* Fixes for IE < 8 */ -@media screen\9 { - .fileinput-button input { - filter: alpha(opacity=0); - font-size: 100%; - height: 100%; - } -} diff --git a/UI/WebServerResources/jquery.fileupload.js b/UI/WebServerResources/jquery.fileupload.js deleted file mode 100644 index 0803592d6..000000000 --- a/UI/WebServerResources/jquery.fileupload.js +++ /dev/null @@ -1,1426 +0,0 @@ -/* - * jQuery File Upload Plugin 5.40.1 - * https://github.com/blueimp/jQuery-File-Upload - * - * Copyright 2010, Sebastian Tschan - * https://blueimp.net - * - * Licensed under the MIT license: - * http://www.opensource.org/licenses/MIT - */ - -/* jshint nomen:false */ -/* global define, window, document, location, Blob, FormData */ - -(function (factory) { - 'use strict'; - if (typeof define === 'function' && define.amd) { - // Register as an anonymous AMD module: - define([ - 'jquery', - 'jquery.ui.widget' - ], factory); - } else { - // Browser globals: - factory(window.jQuery); - } -}(function ($) { - 'use strict'; - - // Detect file input support, based on - // http://viljamis.com/blog/2012/file-upload-support-on-mobile/ - $.support.fileInput = !(new RegExp( - // Handle devices which give false positives for the feature detection: - '(Android (1\\.[0156]|2\\.[01]))' + - '|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)' + - '|(w(eb)?OSBrowser)|(webOS)' + - '|(Kindle/(1\\.0|2\\.[05]|3\\.0))' - ).test(window.navigator.userAgent) || - // Feature detection for all other devices: - $('').prop('disabled')); - - // The FileReader API is not actually used, but works as feature detection, - // as some Safari versions (5?) support XHR file uploads via the FormData API, - // but not non-multipart XHR file uploads. - // window.XMLHttpRequestUpload is not available on IE10, so we check for - // window.ProgressEvent instead to detect XHR2 file upload capability: - $.support.xhrFileUpload = !!(window.ProgressEvent && window.FileReader); - $.support.xhrFormDataFileUpload = !!window.FormData; - - // Detect support for Blob slicing (required for chunked uploads): - $.support.blobSlice = window.Blob && (Blob.prototype.slice || - Blob.prototype.webkitSlice || Blob.prototype.mozSlice); - - // The fileupload widget listens for change events on file input fields defined - // via fileInput setting and paste or drop events of the given dropZone. - // In addition to the default jQuery Widget methods, the fileupload widget - // exposes the "add" and "send" methods, to add or directly send files using - // the fileupload API. - // By default, files added via file input selection, paste, drag & drop or - // "add" method are uploaded immediately, but it is possible to override - // the "add" callback option to queue file uploads. - $.widget('blueimp.fileupload', { - - options: { - // The drop target element(s), by the default the complete document. - // Set to null to disable drag & drop support: - dropZone: $(document), - // The paste target element(s), by the default the complete document. - // Set to null to disable paste support: - pasteZone: $(document), - // The file input field(s), that are listened to for change events. - // If undefined, it is set to the file input fields inside - // of the widget element on plugin initialization. - // Set to null to disable the change listener. - fileInput: undefined, - // By default, the file input field is replaced with a clone after - // each input field change event. This is required for iframe transport - // queues and allows change events to be fired for the same file - // selection, but can be disabled by setting the following option to false: - replaceFileInput: true, - // The parameter name for the file form data (the request argument name). - // If undefined or empty, the name property of the file input field is - // used, or "files[]" if the file input name property is also empty, - // can be a string or an array of strings: - paramName: undefined, - // By default, each file of a selection is uploaded using an individual - // request for XHR type uploads. Set to false to upload file - // selections in one request each: - singleFileUploads: true, - // To limit the number of files uploaded with one XHR request, - // set the following option to an integer greater than 0: - limitMultiFileUploads: undefined, - // The following option limits the number of files uploaded with one - // XHR request to keep the request size under or equal to the defined - // limit in bytes: - limitMultiFileUploadSize: undefined, - // Multipart file uploads add a number of bytes to each uploaded file, - // therefore the following option adds an overhead for each file used - // in the limitMultiFileUploadSize configuration: - limitMultiFileUploadSizeOverhead: 512, - // Set the following option to true to issue all file upload requests - // in a sequential order: - sequentialUploads: false, - // To limit the number of concurrent uploads, - // set the following option to an integer greater than 0: - limitConcurrentUploads: undefined, - // Set the following option to true to force iframe transport uploads: - forceIframeTransport: false, - // Set the following option to the location of a redirect url on the - // origin server, for cross-domain iframe transport uploads: - redirect: undefined, - // The parameter name for the redirect url, sent as part of the form - // data and set to 'redirect' if this option is empty: - redirectParamName: undefined, - // Set the following option to the location of a postMessage window, - // to enable postMessage transport uploads: - postMessage: undefined, - // By default, XHR file uploads are sent as multipart/form-data. - // The iframe transport is always using multipart/form-data. - // Set to false to enable non-multipart XHR uploads: - multipart: true, - // To upload large files in smaller chunks, set the following option - // to a preferred maximum chunk size. If set to 0, null or undefined, - // or the browser does not support the required Blob API, files will - // be uploaded as a whole. - maxChunkSize: undefined, - // When a non-multipart upload or a chunked multipart upload has been - // aborted, this option can be used to resume the upload by setting - // it to the size of the already uploaded bytes. This option is most - // useful when modifying the options object inside of the "add" or - // "send" callbacks, as the options are cloned for each file upload. - uploadedBytes: undefined, - // By default, failed (abort or error) file uploads are removed from the - // global progress calculation. Set the following option to false to - // prevent recalculating the global progress data: - recalculateProgress: true, - // Interval in milliseconds to calculate and trigger progress events: - progressInterval: 100, - // Interval in milliseconds to calculate progress bitrate: - bitrateInterval: 500, - // By default, uploads are started automatically when adding files: - autoUpload: true, - - // Error and info messages: - messages: { - uploadedBytes: 'Uploaded bytes exceed file size' - }, - - // Translation function, gets the message key to be translated - // and an object with context specific data as arguments: - i18n: function (message, context) { - message = this.messages[message] || message.toString(); - if (context) { - $.each(context, function (key, value) { - message = message.replace('{' + key + '}', value); - }); - } - return message; - }, - - // Additional form data to be sent along with the file uploads can be set - // using this option, which accepts an array of objects with name and - // value properties, a function returning such an array, a FormData - // object (for XHR file uploads), or a simple object. - // The form of the first fileInput is given as parameter to the function: - formData: function (form) { - return form.serializeArray(); - }, - - // The add callback is invoked as soon as files are added to the fileupload - // widget (via file input selection, drag & drop, paste or add API call). - // If the singleFileUploads option is enabled, this callback will be - // called once for each file in the selection for XHR file uploads, else - // once for each file selection. - // - // The upload starts when the submit method is invoked on the data parameter. - // The data object contains a files property holding the added files - // and allows you to override plugin options as well as define ajax settings. - // - // Listeners for this callback can also be bound the following way: - // .bind('fileuploadadd', func); - // - // data.submit() returns a Promise object and allows to attach additional - // handlers using jQuery's Deferred callbacks: - // data.submit().done(func).fail(func).always(func); - add: function (e, data) { - if (e.isDefaultPrevented()) { - return false; - } - if (data.autoUpload || (data.autoUpload !== false && - $(this).fileupload('option', 'autoUpload'))) { - data.process().done(function () { - data.submit(); - }); - } - }, - - // Other callbacks: - - // Callback for the submit event of each file upload: - // submit: function (e, data) {}, // .bind('fileuploadsubmit', func); - - // Callback for the start of each file upload request: - // send: function (e, data) {}, // .bind('fileuploadsend', func); - - // Callback for successful uploads: - // done: function (e, data) {}, // .bind('fileuploaddone', func); - - // Callback for failed (abort or error) uploads: - // fail: function (e, data) {}, // .bind('fileuploadfail', func); - - // Callback for completed (success, abort or error) requests: - // always: function (e, data) {}, // .bind('fileuploadalways', func); - - // Callback for upload progress events: - // progress: function (e, data) {}, // .bind('fileuploadprogress', func); - - // Callback for global upload progress events: - // progressall: function (e, data) {}, // .bind('fileuploadprogressall', func); - - // Callback for uploads start, equivalent to the global ajaxStart event: - // start: function (e) {}, // .bind('fileuploadstart', func); - - // Callback for uploads stop, equivalent to the global ajaxStop event: - // stop: function (e) {}, // .bind('fileuploadstop', func); - - // Callback for change events of the fileInput(s): - // change: function (e, data) {}, // .bind('fileuploadchange', func); - - // Callback for paste events to the pasteZone(s): - // paste: function (e, data) {}, // .bind('fileuploadpaste', func); - - // Callback for drop events of the dropZone(s): - // drop: function (e, data) {}, // .bind('fileuploaddrop', func); - - // Callback for dragover events of the dropZone(s): - // dragover: function (e) {}, // .bind('fileuploaddragover', func); - - // Callback for the start of each chunk upload request: - // chunksend: function (e, data) {}, // .bind('fileuploadchunksend', func); - - // Callback for successful chunk uploads: - // chunkdone: function (e, data) {}, // .bind('fileuploadchunkdone', func); - - // Callback for failed (abort or error) chunk uploads: - // chunkfail: function (e, data) {}, // .bind('fileuploadchunkfail', func); - - // Callback for completed (success, abort or error) chunk upload requests: - // chunkalways: function (e, data) {}, // .bind('fileuploadchunkalways', func); - - // The plugin options are used as settings object for the ajax calls. - // The following are jQuery ajax settings required for the file uploads: - processData: false, - contentType: false, - cache: false - }, - - // A list of options that require reinitializing event listeners and/or - // special initialization code: - _specialOptions: [ - 'fileInput', - 'dropZone', - 'pasteZone', - 'multipart', - 'forceIframeTransport' - ], - - _blobSlice: $.support.blobSlice && function () { - var slice = this.slice || this.webkitSlice || this.mozSlice; - return slice.apply(this, arguments); - }, - - _BitrateTimer: function () { - this.timestamp = ((Date.now) ? Date.now() : (new Date()).getTime()); - this.loaded = 0; - this.bitrate = 0; - this.getBitrate = function (now, loaded, interval) { - var timeDiff = now - this.timestamp; - if (!this.bitrate || !interval || timeDiff > interval) { - this.bitrate = (loaded - this.loaded) * (1000 / timeDiff) * 8; - this.loaded = loaded; - this.timestamp = now; - } - return this.bitrate; - }; - }, - - _isXHRUpload: function (options) { - return !options.forceIframeTransport && - ((!options.multipart && $.support.xhrFileUpload) || - $.support.xhrFormDataFileUpload); - }, - - _getFormData: function (options) { - var formData; - if ($.type(options.formData) === 'function') { - return options.formData(options.form); - } - if ($.isArray(options.formData)) { - return options.formData; - } - if ($.type(options.formData) === 'object') { - formData = []; - $.each(options.formData, function (name, value) { - formData.push({name: name, value: value}); - }); - return formData; - } - return []; - }, - - _getTotal: function (files) { - var total = 0; - $.each(files, function (index, file) { - total += file.size || 1; - }); - return total; - }, - - _initProgressObject: function (obj) { - var progress = { - loaded: 0, - total: 0, - bitrate: 0 - }; - if (obj._progress) { - $.extend(obj._progress, progress); - } else { - obj._progress = progress; - } - }, - - _initResponseObject: function (obj) { - var prop; - if (obj._response) { - for (prop in obj._response) { - if (obj._response.hasOwnProperty(prop)) { - delete obj._response[prop]; - } - } - } else { - obj._response = {}; - } - }, - - _onProgress: function (e, data) { - if (e.lengthComputable) { - var now = ((Date.now) ? Date.now() : (new Date()).getTime()), - loaded; - if (data._time && data.progressInterval && - (now - data._time < data.progressInterval) && - e.loaded !== e.total) { - return; - } - data._time = now; - loaded = Math.floor( - e.loaded / e.total * (data.chunkSize || data._progress.total) - ) + (data.uploadedBytes || 0); - // Add the difference from the previously loaded state - // to the global loaded counter: - this._progress.loaded += (loaded - data._progress.loaded); - this._progress.bitrate = this._bitrateTimer.getBitrate( - now, - this._progress.loaded, - data.bitrateInterval - ); - data._progress.loaded = data.loaded = loaded; - data._progress.bitrate = data.bitrate = data._bitrateTimer.getBitrate( - now, - loaded, - data.bitrateInterval - ); - // Trigger a custom progress event with a total data property set - // to the file size(s) of the current upload and a loaded data - // property calculated accordingly: - this._trigger( - 'progress', - $.Event('progress', {delegatedEvent: e}), - data - ); - // Trigger a global progress event for all current file uploads, - // including ajax calls queued for sequential file uploads: - this._trigger( - 'progressall', - $.Event('progressall', {delegatedEvent: e}), - this._progress - ); - } - }, - - _initProgressListener: function (options) { - var that = this, - xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr(); - // Accesss to the native XHR object is required to add event listeners - // for the upload progress event: - if (xhr.upload) { - $(xhr.upload).bind('progress', function (e) { - var oe = e.originalEvent; - // Make sure the progress event properties get copied over: - e.lengthComputable = oe.lengthComputable; - e.loaded = oe.loaded; - e.total = oe.total; - that._onProgress(e, options); - }); - options.xhr = function () { - return xhr; - }; - } - }, - - _isInstanceOf: function (type, obj) { - // Cross-frame instanceof check - return Object.prototype.toString.call(obj) === '[object ' + type + ']'; - }, - - _initXHRData: function (options) { - var that = this, - formData, - file = options.files[0], - // Ignore non-multipart setting if not supported: - multipart = options.multipart || !$.support.xhrFileUpload, - paramName = $.type(options.paramName) === 'array' ? - options.paramName[0] : options.paramName; - options.headers = $.extend({}, options.headers); - if (options.contentRange) { - options.headers['Content-Range'] = options.contentRange; - } - if (!multipart || options.blob || !this._isInstanceOf('File', file)) { - options.headers['Content-Disposition'] = 'attachment; filename="' + - encodeURI(file.name) + '"'; - } - if (!multipart) { - options.contentType = file.type || 'application/octet-stream'; - options.data = options.blob || file; - } else if ($.support.xhrFormDataFileUpload) { - if (options.postMessage) { - // window.postMessage does not allow sending FormData - // objects, so we just add the File/Blob objects to - // the formData array and let the postMessage window - // create the FormData object out of this array: - formData = this._getFormData(options); - if (options.blob) { - formData.push({ - name: paramName, - value: options.blob - }); - } else { - $.each(options.files, function (index, file) { - formData.push({ - name: ($.type(options.paramName) === 'array' && - options.paramName[index]) || paramName, - value: file - }); - }); - } - } else { - if (that._isInstanceOf('FormData', options.formData)) { - formData = options.formData; - } else { - formData = new FormData(); - $.each(this._getFormData(options), function (index, field) { - formData.append(field.name, field.value); - }); - } - if (options.blob) { - formData.append(paramName, options.blob, file.name); - } else { - $.each(options.files, function (index, file) { - // This check allows the tests to run with - // dummy objects: - if (that._isInstanceOf('File', file) || - that._isInstanceOf('Blob', file)) { - formData.append( - ($.type(options.paramName) === 'array' && - options.paramName[index]) || paramName, - file, - file.uploadName || file.name - ); - } - }); - } - } - options.data = formData; - } - // Blob reference is not needed anymore, free memory: - options.blob = null; - }, - - _initIframeSettings: function (options) { - var targetHost = $('
    ').prop('href', options.url).prop('host'); - // Setting the dataType to iframe enables the iframe transport: - options.dataType = 'iframe ' + (options.dataType || ''); - // The iframe transport accepts a serialized array as form data: - options.formData = this._getFormData(options); - // Add redirect url to form data on cross-domain uploads: - if (options.redirect && targetHost && targetHost !== location.host) { - options.formData.push({ - name: options.redirectParamName || 'redirect', - value: options.redirect - }); - } - }, - - _initDataSettings: function (options) { - if (this._isXHRUpload(options)) { - if (!this._chunkedUpload(options, true)) { - if (!options.data) { - this._initXHRData(options); - } - this._initProgressListener(options); - } - if (options.postMessage) { - // Setting the dataType to postmessage enables the - // postMessage transport: - options.dataType = 'postmessage ' + (options.dataType || ''); - } - } else { - this._initIframeSettings(options); - } - }, - - _getParamName: function (options) { - var fileInput = $(options.fileInput), - paramName = options.paramName; - if (!paramName) { - paramName = []; - fileInput.each(function () { - var input = $(this), - name = input.prop('name') || 'files[]', - i = (input.prop('files') || [1]).length; - while (i) { - paramName.push(name); - i -= 1; - } - }); - if (!paramName.length) { - paramName = [fileInput.prop('name') || 'files[]']; - } - } else if (!$.isArray(paramName)) { - paramName = [paramName]; - } - return paramName; - }, - - _initFormSettings: function (options) { - // Retrieve missing options from the input field and the - // associated form, if available: - if (!options.form || !options.form.length) { - options.form = $(options.fileInput.prop('form')); - // If the given file input doesn't have an associated form, - // use the default widget file input's form: - if (!options.form.length) { - options.form = $(this.options.fileInput.prop('form')); - } - } - options.paramName = this._getParamName(options); - if (!options.url) { - options.url = options.form.prop('action') || location.href; - } - // The HTTP request method must be "POST" or "PUT": - options.type = (options.type || - ($.type(options.form.prop('method')) === 'string' && - options.form.prop('method')) || '' - ).toUpperCase(); - if (options.type !== 'POST' && options.type !== 'PUT' && - options.type !== 'PATCH') { - options.type = 'POST'; - } - if (!options.formAcceptCharset) { - options.formAcceptCharset = options.form.attr('accept-charset'); - } - }, - - _getAJAXSettings: function (data) { - var options = $.extend({}, this.options, data); - this._initFormSettings(options); - this._initDataSettings(options); - return options; - }, - - // jQuery 1.6 doesn't provide .state(), - // while jQuery 1.8+ removed .isRejected() and .isResolved(): - _getDeferredState: function (deferred) { - if (deferred.state) { - return deferred.state(); - } - if (deferred.isResolved()) { - return 'resolved'; - } - if (deferred.isRejected()) { - return 'rejected'; - } - return 'pending'; - }, - - // Maps jqXHR callbacks to the equivalent - // methods of the given Promise object: - _enhancePromise: function (promise) { - promise.success = promise.done; - promise.error = promise.fail; - promise.complete = promise.always; - return promise; - }, - - // Creates and returns a Promise object enhanced with - // the jqXHR methods abort, success, error and complete: - _getXHRPromise: function (resolveOrReject, context, args) { - var dfd = $.Deferred(), - promise = dfd.promise(); - context = context || this.options.context || promise; - if (resolveOrReject === true) { - dfd.resolveWith(context, args); - } else if (resolveOrReject === false) { - dfd.rejectWith(context, args); - } - promise.abort = dfd.promise; - return this._enhancePromise(promise); - }, - - // Adds convenience methods to the data callback argument: - _addConvenienceMethods: function (e, data) { - var that = this, - getPromise = function (args) { - return $.Deferred().resolveWith(that, args).promise(); - }; - data.process = function (resolveFunc, rejectFunc) { - if (resolveFunc || rejectFunc) { - data._processQueue = this._processQueue = - (this._processQueue || getPromise([this])).pipe( - function () { - if (data.errorThrown) { - return $.Deferred() - .rejectWith(that, [data]).promise(); - } - return getPromise(arguments); - } - ).pipe(resolveFunc, rejectFunc); - } - return this._processQueue || getPromise([this]); - }; - data.submit = function () { - if (this.state() !== 'pending') { - data.jqXHR = this.jqXHR = - (that._trigger( - 'submit', - $.Event('submit', {delegatedEvent: e}), - this - ) !== false) && that._onSend(e, this); - } - return this.jqXHR || that._getXHRPromise(); - }; - data.abort = function () { - if (this.jqXHR) { - return this.jqXHR.abort(); - } - this.errorThrown = 'abort'; - that._trigger('fail', null, this); - return that._getXHRPromise(false); - }; - data.state = function () { - if (this.jqXHR) { - return that._getDeferredState(this.jqXHR); - } - if (this._processQueue) { - return that._getDeferredState(this._processQueue); - } - }; - data.processing = function () { - return !this.jqXHR && this._processQueue && that - ._getDeferredState(this._processQueue) === 'pending'; - }; - data.progress = function () { - return this._progress; - }; - data.response = function () { - return this._response; - }; - }, - - // Parses the Range header from the server response - // and returns the uploaded bytes: - _getUploadedBytes: function (jqXHR) { - var range = jqXHR.getResponseHeader('Range'), - parts = range && range.split('-'), - upperBytesPos = parts && parts.length > 1 && - parseInt(parts[1], 10); - return upperBytesPos && upperBytesPos + 1; - }, - - // Uploads a file in multiple, sequential requests - // by splitting the file up in multiple blob chunks. - // If the second parameter is true, only tests if the file - // should be uploaded in chunks, but does not invoke any - // upload requests: - _chunkedUpload: function (options, testOnly) { - options.uploadedBytes = options.uploadedBytes || 0; - var that = this, - file = options.files[0], - fs = file.size, - ub = options.uploadedBytes, - mcs = options.maxChunkSize || fs, - slice = this._blobSlice, - dfd = $.Deferred(), - promise = dfd.promise(), - jqXHR, - upload; - if (!(this._isXHRUpload(options) && slice && (ub || mcs < fs)) || - options.data) { - return false; - } - if (testOnly) { - return true; - } - if (ub >= fs) { - file.error = options.i18n('uploadedBytes'); - return this._getXHRPromise( - false, - options.context, - [null, 'error', file.error] - ); - } - // The chunk upload method: - upload = function () { - // Clone the options object for each chunk upload: - var o = $.extend({}, options), - currentLoaded = o._progress.loaded; - o.blob = slice.call( - file, - ub, - ub + mcs, - file.type - ); - // Store the current chunk size, as the blob itself - // will be dereferenced after data processing: - o.chunkSize = o.blob.size; - // Expose the chunk bytes position range: - o.contentRange = 'bytes ' + ub + '-' + - (ub + o.chunkSize - 1) + '/' + fs; - // Process the upload data (the blob and potential form data): - that._initXHRData(o); - // Add progress listeners for this chunk upload: - that._initProgressListener(o); - jqXHR = ((that._trigger('chunksend', null, o) !== false && $.ajax(o)) || - that._getXHRPromise(false, o.context)) - .done(function (result, textStatus, jqXHR) { - ub = that._getUploadedBytes(jqXHR) || - (ub + o.chunkSize); - // Create a progress event if no final progress event - // with loaded equaling total has been triggered - // for this chunk: - if (currentLoaded + o.chunkSize - o._progress.loaded) { - that._onProgress($.Event('progress', { - lengthComputable: true, - loaded: ub - o.uploadedBytes, - total: ub - o.uploadedBytes - }), o); - } - options.uploadedBytes = o.uploadedBytes = ub; - o.result = result; - o.textStatus = textStatus; - o.jqXHR = jqXHR; - that._trigger('chunkdone', null, o); - that._trigger('chunkalways', null, o); - if (ub < fs) { - // File upload not yet complete, - // continue with the next chunk: - upload(); - } else { - dfd.resolveWith( - o.context, - [result, textStatus, jqXHR] - ); - } - }) - .fail(function (jqXHR, textStatus, errorThrown) { - o.jqXHR = jqXHR; - o.textStatus = textStatus; - o.errorThrown = errorThrown; - that._trigger('chunkfail', null, o); - that._trigger('chunkalways', null, o); - dfd.rejectWith( - o.context, - [jqXHR, textStatus, errorThrown] - ); - }); - }; - this._enhancePromise(promise); - promise.abort = function () { - return jqXHR.abort(); - }; - upload(); - return promise; - }, - - _beforeSend: function (e, data) { - if (this._active === 0) { - // the start callback is triggered when an upload starts - // and no other uploads are currently running, - // equivalent to the global ajaxStart event: - this._trigger('start'); - // Set timer for global bitrate progress calculation: - this._bitrateTimer = new this._BitrateTimer(); - // Reset the global progress values: - this._progress.loaded = this._progress.total = 0; - this._progress.bitrate = 0; - } - // Make sure the container objects for the .response() and - // .progress() methods on the data object are available - // and reset to their initial state: - this._initResponseObject(data); - this._initProgressObject(data); - data._progress.loaded = data.loaded = data.uploadedBytes || 0; - data._progress.total = data.total = this._getTotal(data.files) || 1; - data._progress.bitrate = data.bitrate = 0; - this._active += 1; - // Initialize the global progress values: - this._progress.loaded += data.loaded; - this._progress.total += data.total; - }, - - _onDone: function (result, textStatus, jqXHR, options) { - var total = options._progress.total, - response = options._response; - if (options._progress.loaded < total) { - // Create a progress event if no final progress event - // with loaded equaling total has been triggered: - this._onProgress($.Event('progress', { - lengthComputable: true, - loaded: total, - total: total - }), options); - } - response.result = options.result = result; - response.textStatus = options.textStatus = textStatus; - response.jqXHR = options.jqXHR = jqXHR; - this._trigger('done', null, options); - }, - - _onFail: function (jqXHR, textStatus, errorThrown, options) { - var response = options._response; - if (options.recalculateProgress) { - // Remove the failed (error or abort) file upload from - // the global progress calculation: - this._progress.loaded -= options._progress.loaded; - this._progress.total -= options._progress.total; - } - response.jqXHR = options.jqXHR = jqXHR; - response.textStatus = options.textStatus = textStatus; - response.errorThrown = options.errorThrown = errorThrown; - this._trigger('fail', null, options); - }, - - _onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) { - // jqXHRorResult, textStatus and jqXHRorError are added to the - // options object via done and fail callbacks - this._trigger('always', null, options); - }, - - _onSend: function (e, data) { - if (!data.submit) { - this._addConvenienceMethods(e, data); - } - var that = this, - jqXHR, - aborted, - slot, - pipe, - options = that._getAJAXSettings(data), - send = function () { - that._sending += 1; - // Set timer for bitrate progress calculation: - options._bitrateTimer = new that._BitrateTimer(); - jqXHR = jqXHR || ( - ((aborted || that._trigger( - 'send', - $.Event('send', {delegatedEvent: e}), - options - ) === false) && - that._getXHRPromise(false, options.context, aborted)) || - that._chunkedUpload(options) || $.ajax(options) - ).done(function (result, textStatus, jqXHR) { - that._onDone(result, textStatus, jqXHR, options); - }).fail(function (jqXHR, textStatus, errorThrown) { - that._onFail(jqXHR, textStatus, errorThrown, options); - }).always(function (jqXHRorResult, textStatus, jqXHRorError) { - that._onAlways( - jqXHRorResult, - textStatus, - jqXHRorError, - options - ); - that._sending -= 1; - that._active -= 1; - if (options.limitConcurrentUploads && - options.limitConcurrentUploads > that._sending) { - // Start the next queued upload, - // that has not been aborted: - var nextSlot = that._slots.shift(); - while (nextSlot) { - if (that._getDeferredState(nextSlot) === 'pending') { - nextSlot.resolve(); - break; - } - nextSlot = that._slots.shift(); - } - } - if (that._active === 0) { - // The stop callback is triggered when all uploads have - // been completed, equivalent to the global ajaxStop event: - that._trigger('stop'); - } - }); - return jqXHR; - }; - this._beforeSend(e, options); - if (this.options.sequentialUploads || - (this.options.limitConcurrentUploads && - this.options.limitConcurrentUploads <= this._sending)) { - if (this.options.limitConcurrentUploads > 1) { - slot = $.Deferred(); - this._slots.push(slot); - pipe = slot.pipe(send); - } else { - this._sequence = this._sequence.pipe(send, send); - pipe = this._sequence; - } - // Return the piped Promise object, enhanced with an abort method, - // which is delegated to the jqXHR object of the current upload, - // and jqXHR callbacks mapped to the equivalent Promise methods: - pipe.abort = function () { - aborted = [undefined, 'abort', 'abort']; - if (!jqXHR) { - if (slot) { - slot.rejectWith(options.context, aborted); - } - return send(); - } - return jqXHR.abort(); - }; - return this._enhancePromise(pipe); - } - return send(); - }, - - _onAdd: function (e, data) { - var that = this, - result = true, - options = $.extend({}, this.options, data), - files = data.files, - filesLength = files.length, - limit = options.limitMultiFileUploads, - limitSize = options.limitMultiFileUploadSize, - overhead = options.limitMultiFileUploadSizeOverhead, - batchSize = 0, - paramName = this._getParamName(options), - paramNameSet, - paramNameSlice, - fileSet, - i, - j = 0; - if (limitSize && (!filesLength || files[0].size === undefined)) { - limitSize = undefined; - } - if (!(options.singleFileUploads || limit || limitSize) || - !this._isXHRUpload(options)) { - fileSet = [files]; - paramNameSet = [paramName]; - } else if (!(options.singleFileUploads || limitSize) && limit) { - fileSet = []; - paramNameSet = []; - for (i = 0; i < filesLength; i += limit) { - fileSet.push(files.slice(i, i + limit)); - paramNameSlice = paramName.slice(i, i + limit); - if (!paramNameSlice.length) { - paramNameSlice = paramName; - } - paramNameSet.push(paramNameSlice); - } - } else if (!options.singleFileUploads && limitSize) { - fileSet = []; - paramNameSet = []; - for (i = 0; i < filesLength; i = i + 1) { - batchSize += files[i].size + overhead; - if (i + 1 === filesLength || - ((batchSize + files[i + 1].size + overhead) > limitSize) || - (limit && i + 1 - j >= limit)) { - fileSet.push(files.slice(j, i + 1)); - paramNameSlice = paramName.slice(j, i + 1); - if (!paramNameSlice.length) { - paramNameSlice = paramName; - } - paramNameSet.push(paramNameSlice); - j = i + 1; - batchSize = 0; - } - } - } else { - paramNameSet = paramName; - } - data.originalFiles = files; - $.each(fileSet || files, function (index, element) { - var newData = $.extend({}, data); - newData.files = fileSet ? element : [element]; - newData.paramName = paramNameSet[index]; - that._initResponseObject(newData); - that._initProgressObject(newData); - that._addConvenienceMethods(e, newData); - result = that._trigger( - 'add', - $.Event('add', {delegatedEvent: e}), - newData - ); - return result; - }); - return result; - }, - - _replaceFileInput: function (input) { - var inputClone = input.clone(true); - $('
    ').append(inputClone)[0].reset(); - // Detaching allows to insert the fileInput on another form - // without loosing the file input value: - input.after(inputClone).detach(); - // Avoid memory leaks with the detached file input: - $.cleanData(input.unbind('remove')); - // Replace the original file input element in the fileInput - // elements set with the clone, which has been copied including - // event handlers: - this.options.fileInput = this.options.fileInput.map(function (i, el) { - if (el === input[0]) { - return inputClone[0]; - } - return el; - }); - // If the widget has been initialized on the file input itself, - // override this.element with the file input clone: - if (input[0] === this.element[0]) { - this.element = inputClone; - } - }, - - _handleFileTreeEntry: function (entry, path) { - var that = this, - dfd = $.Deferred(), - errorHandler = function (e) { - if (e && !e.entry) { - e.entry = entry; - } - // Since $.when returns immediately if one - // Deferred is rejected, we use resolve instead. - // This allows valid files and invalid items - // to be returned together in one set: - dfd.resolve([e]); - }, - dirReader; - path = path || ''; - if (entry.isFile) { - if (entry._file) { - // Workaround for Chrome bug #149735 - entry._file.relativePath = path; - dfd.resolve(entry._file); - } else { - entry.file(function (file) { - file.relativePath = path; - dfd.resolve(file); - }, errorHandler); - } - } else if (entry.isDirectory) { - dirReader = entry.createReader(); - dirReader.readEntries(function (entries) { - that._handleFileTreeEntries( - entries, - path + entry.name + '/' - ).done(function (files) { - dfd.resolve(files); - }).fail(errorHandler); - }, errorHandler); - } else { - // Return an empy list for file system items - // other than files or directories: - dfd.resolve([]); - } - return dfd.promise(); - }, - - _handleFileTreeEntries: function (entries, path) { - var that = this; - return $.when.apply( - $, - $.map(entries, function (entry) { - return that._handleFileTreeEntry(entry, path); - }) - ).pipe(function () { - return Array.prototype.concat.apply( - [], - arguments - ); - }); - }, - - _getDroppedFiles: function (dataTransfer) { - dataTransfer = dataTransfer || {}; - var items = dataTransfer.items; - if (items && items.length && (items[0].webkitGetAsEntry || - items[0].getAsEntry)) { - return this._handleFileTreeEntries( - $.map(items, function (item) { - var entry; - if (item.webkitGetAsEntry) { - entry = item.webkitGetAsEntry(); - if (entry) { - // Workaround for Chrome bug #149735: - entry._file = item.getAsFile(); - } - return entry; - } - return item.getAsEntry(); - }) - ); - } - return $.Deferred().resolve( - $.makeArray(dataTransfer.files) - ).promise(); - }, - - _getSingleFileInputFiles: function (fileInput) { - fileInput = $(fileInput); - var entries = fileInput.prop('webkitEntries') || - fileInput.prop('entries'), - files, - value; - if (entries && entries.length) { - return this._handleFileTreeEntries(entries); - } - files = $.makeArray(fileInput.prop('files')); - if (!files.length) { - value = fileInput.prop('value'); - if (!value) { - return $.Deferred().resolve([]).promise(); - } - // If the files property is not available, the browser does not - // support the File API and we add a pseudo File object with - // the input value as name with path information removed: - files = [{name: value.replace(/^.*\\/, '')}]; - } else if (files[0].name === undefined && files[0].fileName) { - // File normalization for Safari 4 and Firefox 3: - $.each(files, function (index, file) { - file.name = file.fileName; - file.size = file.fileSize; - }); - } - return $.Deferred().resolve(files).promise(); - }, - - _getFileInputFiles: function (fileInput) { - if (!(fileInput instanceof $) || fileInput.length === 1) { - return this._getSingleFileInputFiles(fileInput); - } - return $.when.apply( - $, - $.map(fileInput, this._getSingleFileInputFiles) - ).pipe(function () { - return Array.prototype.concat.apply( - [], - arguments - ); - }); - }, - - _onChange: function (e) { - var that = this, - data = { - fileInput: $(e.target), - form: $(e.target.form) - }; - this._getFileInputFiles(data.fileInput).always(function (files) { - data.files = files; - if (that.options.replaceFileInput) { - that._replaceFileInput(data.fileInput); - } - if (that._trigger( - 'change', - $.Event('change', {delegatedEvent: e}), - data - ) !== false) { - that._onAdd(e, data); - } - }); - }, - - _onPaste: function (e) { - var items = e.originalEvent && e.originalEvent.clipboardData && - e.originalEvent.clipboardData.items, - data = {files: []}; - if (items && items.length) { - $.each(items, function (index, item) { - var file = item.getAsFile && item.getAsFile(); - if (file) { - data.files.push(file); - } - }); - if (this._trigger( - 'paste', - $.Event('paste', {delegatedEvent: e}), - data - ) !== false) { - this._onAdd(e, data); - } - } - }, - - _onDrop: function (e) { - e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer; - var that = this, - dataTransfer = e.dataTransfer, - data = {}; - if (dataTransfer && dataTransfer.files && dataTransfer.files.length) { - e.preventDefault(); - this._getDroppedFiles(dataTransfer).always(function (files) { - data.files = files; - if (that._trigger( - 'drop', - $.Event('drop', {delegatedEvent: e}), - data - ) !== false) { - that._onAdd(e, data); - } - }); - } - }, - - _onDragOver: function (e) { - e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer; - var dataTransfer = e.dataTransfer; - if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1 && - this._trigger( - 'dragover', - $.Event('dragover', {delegatedEvent: e}) - ) !== false) { - e.preventDefault(); - dataTransfer.dropEffect = 'copy'; - } - }, - - _initEventHandlers: function () { - if (this._isXHRUpload(this.options)) { - this._on(this.options.dropZone, { - dragover: this._onDragOver, - drop: this._onDrop - }); - this._on(this.options.pasteZone, { - paste: this._onPaste - }); - } - if ($.support.fileInput) { - this._on(this.options.fileInput, { - change: this._onChange - }); - } - }, - - _destroyEventHandlers: function () { - this._off(this.options.dropZone, 'dragover drop'); - this._off(this.options.pasteZone, 'paste'); - this._off(this.options.fileInput, 'change'); - }, - - _setOption: function (key, value) { - var reinit = $.inArray(key, this._specialOptions) !== -1; - if (reinit) { - this._destroyEventHandlers(); - } - this._super(key, value); - if (reinit) { - this._initSpecialOptions(); - this._initEventHandlers(); - } - }, - - _initSpecialOptions: function () { - var options = this.options; - if (options.fileInput === undefined) { - options.fileInput = this.element.is('input[type="file"]') ? - this.element : this.element.find('input[type="file"]'); - } else if (!(options.fileInput instanceof $)) { - options.fileInput = $(options.fileInput); - } - if (!(options.dropZone instanceof $)) { - options.dropZone = $(options.dropZone); - } - if (!(options.pasteZone instanceof $)) { - options.pasteZone = $(options.pasteZone); - } - }, - - _getRegExp: function (str) { - var parts = str.split('/'), - modifiers = parts.pop(); - parts.shift(); - return new RegExp(parts.join('/'), modifiers); - }, - - _isRegExpOption: function (key, value) { - return key !== 'url' && $.type(value) === 'string' && - /^\/.*\/[igm]{0,3}$/.test(value); - }, - - _initDataAttributes: function () { - var that = this, - options = this.options, - clone = $(this.element[0].cloneNode(false)); - // Initialize options set via HTML5 data-attributes: - $.each( - clone.data(), - function (key, value) { - var dataAttributeName = 'data-' + - // Convert camelCase to hyphen-ated key: - key.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); - if (clone.attr(dataAttributeName)) { - if (that._isRegExpOption(key, value)) { - value = that._getRegExp(value); - } - options[key] = value; - } - } - ); - }, - - _create: function () { - this._initDataAttributes(); - this._initSpecialOptions(); - this._slots = []; - this._sequence = this._getXHRPromise(true); - this._sending = this._active = 0; - this._initProgressObject(this); - this._initEventHandlers(); - }, - - // This method is exposed to the widget API and allows to query - // the number of active uploads: - active: function () { - return this._active; - }, - - // This method is exposed to the widget API and allows to query - // the widget upload progress. - // It returns an object with loaded, total and bitrate properties - // for the running uploads: - progress: function () { - return this._progress; - }, - - // This method is exposed to the widget API and allows adding files - // using the fileupload API. The data parameter accepts an object which - // must have a files property and can contain additional options: - // .fileupload('add', {files: filesList}); - add: function (data) { - var that = this; - if (!data || this.options.disabled) { - return; - } - if (data.fileInput && !data.files) { - this._getFileInputFiles(data.fileInput).always(function (files) { - data.files = files; - that._onAdd(null, data); - }); - } else { - data.files = $.makeArray(data.files); - this._onAdd(null, data); - } - }, - - // This method is exposed to the widget API and allows sending files - // using the fileupload API. The data parameter accepts an object which - // must have a files or fileInput property and can contain additional options: - // .fileupload('send', {files: filesList}); - // The method returns a Promise object for the file upload call. - send: function (data) { - if (data && !this.options.disabled) { - if (data.fileInput && !data.files) { - var that = this, - dfd = $.Deferred(), - promise = dfd.promise(), - jqXHR, - aborted; - promise.abort = function () { - aborted = true; - if (jqXHR) { - return jqXHR.abort(); - } - dfd.reject(null, 'abort', 'abort'); - return promise; - }; - this._getFileInputFiles(data.fileInput).always( - function (files) { - if (aborted) { - return; - } - if (!files.length) { - dfd.reject(); - return; - } - data.files = files; - jqXHR = that._onSend(null, data).then( - function (result, textStatus, jqXHR) { - dfd.resolve(result, textStatus, jqXHR); - }, - function (jqXHR, textStatus, errorThrown) { - dfd.reject(jqXHR, textStatus, errorThrown); - } - ); - } - ); - return this._enhancePromise(promise); - } - data.files = $.makeArray(data.files); - if (data.files.length) { - return this._onSend(null, data); - } - } - return this._getXHRPromise(false, data && data.context); - } - - }); - -})); diff --git a/UI/WebServerResources/jquery.iframe-transport.js b/UI/WebServerResources/jquery.iframe-transport.js deleted file mode 100644 index 8d64b591b..000000000 --- a/UI/WebServerResources/jquery.iframe-transport.js +++ /dev/null @@ -1,214 +0,0 @@ -/* - * jQuery Iframe Transport Plugin 1.8.2 - * https://github.com/blueimp/jQuery-File-Upload - * - * Copyright 2011, Sebastian Tschan - * https://blueimp.net - * - * Licensed under the MIT license: - * http://www.opensource.org/licenses/MIT - */ - -/* global define, window, document */ - -(function (factory) { - 'use strict'; - if (typeof define === 'function' && define.amd) { - // Register as an anonymous AMD module: - define(['jquery'], factory); - } else { - // Browser globals: - factory(window.jQuery); - } -}(function ($) { - 'use strict'; - - // Helper variable to create unique names for the transport iframes: - var counter = 0; - - // The iframe transport accepts four additional options: - // options.fileInput: a jQuery collection of file input fields - // options.paramName: the parameter name for the file form data, - // overrides the name property of the file input field(s), - // can be a string or an array of strings. - // options.formData: an array of objects with name and value properties, - // equivalent to the return data of .serializeArray(), e.g.: - // [{name: 'a', value: 1}, {name: 'b', value: 2}] - // options.initialIframeSrc: the URL of the initial iframe src, - // by default set to "javascript:false;" - $.ajaxTransport('iframe', function (options) { - if (options.async) { - // javascript:false as initial iframe src - // prevents warning popups on HTTPS in IE6: - /*jshint scripturl: true */ - var initialIframeSrc = options.initialIframeSrc || 'javascript:false;', - /*jshint scripturl: false */ - form, - iframe, - addParamChar; - return { - send: function (_, completeCallback) { - form = $('
    '); - form.attr('accept-charset', options.formAcceptCharset); - addParamChar = /\?/.test(options.url) ? '&' : '?'; - // XDomainRequest only supports GET and POST: - if (options.type === 'DELETE') { - options.url = options.url + addParamChar + '_method=DELETE'; - options.type = 'POST'; - } else if (options.type === 'PUT') { - options.url = options.url + addParamChar + '_method=PUT'; - options.type = 'POST'; - } else if (options.type === 'PATCH') { - options.url = options.url + addParamChar + '_method=PATCH'; - options.type = 'POST'; - } - // IE versions below IE8 cannot set the name property of - // elements that have already been added to the DOM, - // so we set the name along with the iframe HTML markup: - counter += 1; - iframe = $( - '' - ).bind('load', function () { - var fileInputClones, - paramNames = $.isArray(options.paramName) ? - options.paramName : [options.paramName]; - iframe - .unbind('load') - .bind('load', function () { - var response; - // Wrap in a try/catch block to catch exceptions thrown - // when trying to access cross-domain iframe contents: - try { - response = iframe.contents(); - // Google Chrome and Firefox do not throw an - // exception when calling iframe.contents() on - // cross-domain requests, so we unify the response: - if (!response.length || !response[0].firstChild) { - throw new Error(); - } - } catch (e) { - response = undefined; - } - // The complete callback returns the - // iframe content document as response object: - completeCallback( - 200, - 'success', - {'iframe': response} - ); - // Fix for IE endless progress bar activity bug - // (happens on form submits to iframe targets): - $('') - .appendTo(form); - window.setTimeout(function () { - // Removing the form in a setTimeout call - // allows Chrome's developer tools to display - // the response result - form.remove(); - }, 0); - }); - form - .prop('target', iframe.prop('name')) - .prop('action', options.url) - .prop('method', options.type); - if (options.formData) { - $.each(options.formData, function (index, field) { - $('') - .prop('name', field.name) - .val(field.value) - .appendTo(form); - }); - } - if (options.fileInput && options.fileInput.length && - options.type === 'POST') { - fileInputClones = options.fileInput.clone(); - // Insert a clone for each file input field: - options.fileInput.after(function (index) { - return fileInputClones[index]; - }); - if (options.paramName) { - options.fileInput.each(function (index) { - $(this).prop( - 'name', - paramNames[index] || options.paramName - ); - }); - } - // Appending the file input fields to the hidden form - // removes them from their original location: - form - .append(options.fileInput) - .prop('enctype', 'multipart/form-data') - // enctype must be set as encoding for IE: - .prop('encoding', 'multipart/form-data'); - // Remove the HTML5 form attribute from the input(s): - options.fileInput.removeAttr('form'); - } - form.submit(); - // Insert the file input fields at their original location - // by replacing the clones with the originals: - if (fileInputClones && fileInputClones.length) { - options.fileInput.each(function (index, input) { - var clone = $(fileInputClones[index]); - // Restore the original name and form properties: - $(input) - .prop('name', clone.prop('name')) - .attr('form', clone.attr('form')); - clone.replaceWith(input); - }); - } - }); - form.append(iframe).appendTo(document.body); - }, - abort: function () { - if (iframe) { - // javascript:false as iframe src aborts the request - // and prevents warning popups on HTTPS in IE6. - // concat is used to avoid the "Script URL" JSLint error: - iframe - .unbind('load') - .prop('src', initialIframeSrc); - } - if (form) { - form.remove(); - } - } - }; - } - }); - - // The iframe transport returns the iframe content document as response. - // The following adds converters from iframe to text, json, html, xml - // and script. - // Please note that the Content-Type for JSON responses has to be text/plain - // or text/html, if the browser doesn't include application/json in the - // Accept header, else IE will show a download dialog. - // The Content-Type for XML responses on the other hand has to be always - // application/xml or text/xml, so IE properly parses the XML response. - // See also - // https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation - $.ajaxSetup({ - converters: { - 'iframe text': function (iframe) { - return iframe && $(iframe[0].body).text(); - }, - 'iframe json': function (iframe) { - return iframe && $.parseJSON($(iframe[0].body).text()); - }, - 'iframe html': function (iframe) { - return iframe && $(iframe[0].body).html(); - }, - 'iframe xml': function (iframe) { - var xmlDoc = iframe && iframe[0]; - return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc : - $.parseXML((xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) || - $(xmlDoc.body).html()); - }, - 'iframe script': function (iframe) { - return iframe && $.globalEval($(iframe[0].body).text()); - } - } - }); - -})); diff --git a/UI/WebServerResources/jquery.js b/UI/WebServerResources/jquery.js deleted file mode 100644 index 16ad06c5a..000000000 --- a/UI/WebServerResources/jquery.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! jQuery v1.7.2 jquery.com | jquery.org/license */ -(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"":"")+""),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;e=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){if(typeof c!="string"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
    a",d=p.getElementsByTagName("*"),e=p.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=p.getElementsByTagName("input")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:p.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode==="CSS1Compat",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),i.setAttribute("name","t"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m="on"+n,o=m in p,o||(p.setAttribute(m,"return;"),o=typeof p[m]=="function"),b[n+"Bubbles"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName("body")[0];!u||(m=1,t="padding:0;margin:0;border:",r="position:absolute;top:0;left:0;width:1px;height:1px;",s=t+"0;visibility:hidden;",n="style='"+r+t+"5px solid #000;",q="
    "+""+"
    ",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="
    t
    ",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="none",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="
    ",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position="relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function( -a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&j.push({elem:this,matches:d.slice(e)});for(k=0;k0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

    ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
    ";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/]","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*",""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
    ","
    "]),f.fn.extend({text:function(a){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f -.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(;d1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]===""&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;i1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=["*/"]+["*"];try{bU=e.href}catch(bX){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
    ").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bW},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cb(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bW+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bZ(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n);try{m.text=h.responseText}catch(a){}try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);f.fn[a]=function(e){return f.access(this,function(a,e,g){var h=cy(a);if(g===b)return h?c in h?h[c]:f.support.boxModel&&h.document.documentElement[e]||h.document.body[e]:a[e];h?h.scrollTo(d?f(h).scrollLeft():g,d?g:f(h).scrollTop()):a[e]=g},a,e,arguments.length,null)}}),f.each({Height:"height",Width:"width"},function(a,c){var d="client"+a,e="scroll"+a,g="offset"+a;f.fn["inner"+a]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,c,"padding")):this[c]():null},f.fn["outer"+a]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,c,a?"margin":"border")):this[c]():null},f.fn[c]=function(a){return f.access(this,function(a,c,h){var i,j,k,l;if(f.isWindow(a)){i=a.document,j=i.documentElement[d];return f.support.boxModel&&j||i.body&&i.body[d]||j}if(a.nodeType===9){i=a.documentElement;if(i[d]>=i[e])return i[d];return Math.max(a.body[e],i[e],a.body[g],i[g])}if(h===b){k=f.css(a,c),l=parseFloat(k);return f.isNumeric(l)?l:k}f(a).css(c,h)},c,a,arguments.length,null)}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file diff --git a/UI/WebServerResources/ckeditor/LICENSE.md b/UI/WebServerResources/js/vendor/ckeditor/LICENSE.md similarity index 100% rename from UI/WebServerResources/ckeditor/LICENSE.md rename to UI/WebServerResources/js/vendor/ckeditor/LICENSE.md diff --git a/UI/WebServerResources/ckeditor/build-config.js b/UI/WebServerResources/js/vendor/ckeditor/build-config.js similarity index 100% rename from UI/WebServerResources/ckeditor/build-config.js rename to UI/WebServerResources/js/vendor/ckeditor/build-config.js diff --git a/UI/WebServerResources/ckeditor/ckeditor.js b/UI/WebServerResources/js/vendor/ckeditor/ckeditor.js similarity index 100% rename from UI/WebServerResources/ckeditor/ckeditor.js rename to UI/WebServerResources/js/vendor/ckeditor/ckeditor.js diff --git a/UI/WebServerResources/ckeditor/config.js b/UI/WebServerResources/js/vendor/ckeditor/config.js similarity index 100% rename from UI/WebServerResources/ckeditor/config.js rename to UI/WebServerResources/js/vendor/ckeditor/config.js diff --git a/UI/WebServerResources/ckeditor/contents.css b/UI/WebServerResources/js/vendor/ckeditor/contents.css similarity index 100% rename from UI/WebServerResources/ckeditor/contents.css rename to UI/WebServerResources/js/vendor/ckeditor/contents.css diff --git a/UI/WebServerResources/ckeditor/lang/ar.js b/UI/WebServerResources/js/vendor/ckeditor/lang/ar.js similarity index 100% rename from UI/WebServerResources/ckeditor/lang/ar.js rename to UI/WebServerResources/js/vendor/ckeditor/lang/ar.js diff --git a/UI/WebServerResources/ckeditor/lang/ca.js b/UI/WebServerResources/js/vendor/ckeditor/lang/ca.js similarity index 100% rename from UI/WebServerResources/ckeditor/lang/ca.js rename to UI/WebServerResources/js/vendor/ckeditor/lang/ca.js diff --git a/UI/WebServerResources/ckeditor/lang/cs.js b/UI/WebServerResources/js/vendor/ckeditor/lang/cs.js similarity index 100% rename from UI/WebServerResources/ckeditor/lang/cs.js rename to UI/WebServerResources/js/vendor/ckeditor/lang/cs.js diff --git a/UI/WebServerResources/ckeditor/lang/cy.js b/UI/WebServerResources/js/vendor/ckeditor/lang/cy.js similarity index 100% rename from UI/WebServerResources/ckeditor/lang/cy.js rename to UI/WebServerResources/js/vendor/ckeditor/lang/cy.js diff --git a/UI/WebServerResources/ckeditor/lang/da.js b/UI/WebServerResources/js/vendor/ckeditor/lang/da.js similarity index 100% rename from UI/WebServerResources/ckeditor/lang/da.js rename to UI/WebServerResources/js/vendor/ckeditor/lang/da.js diff --git a/UI/WebServerResources/ckeditor/lang/de.js b/UI/WebServerResources/js/vendor/ckeditor/lang/de.js similarity index 100% rename from UI/WebServerResources/ckeditor/lang/de.js rename to UI/WebServerResources/js/vendor/ckeditor/lang/de.js diff --git a/UI/WebServerResources/ckeditor/lang/en.js b/UI/WebServerResources/js/vendor/ckeditor/lang/en.js similarity index 100% rename from UI/WebServerResources/ckeditor/lang/en.js rename to UI/WebServerResources/js/vendor/ckeditor/lang/en.js diff --git a/UI/WebServerResources/ckeditor/lang/es.js b/UI/WebServerResources/js/vendor/ckeditor/lang/es.js similarity index 100% rename from UI/WebServerResources/ckeditor/lang/es.js rename to UI/WebServerResources/js/vendor/ckeditor/lang/es.js diff --git a/UI/WebServerResources/ckeditor/lang/fi.js b/UI/WebServerResources/js/vendor/ckeditor/lang/fi.js similarity index 100% rename from UI/WebServerResources/ckeditor/lang/fi.js rename to UI/WebServerResources/js/vendor/ckeditor/lang/fi.js diff --git a/UI/WebServerResources/ckeditor/lang/fr.js b/UI/WebServerResources/js/vendor/ckeditor/lang/fr.js similarity index 100% rename from UI/WebServerResources/ckeditor/lang/fr.js rename to UI/WebServerResources/js/vendor/ckeditor/lang/fr.js diff --git a/UI/WebServerResources/ckeditor/lang/hu.js b/UI/WebServerResources/js/vendor/ckeditor/lang/hu.js similarity index 100% rename from UI/WebServerResources/ckeditor/lang/hu.js rename to UI/WebServerResources/js/vendor/ckeditor/lang/hu.js diff --git a/UI/WebServerResources/ckeditor/lang/is.js b/UI/WebServerResources/js/vendor/ckeditor/lang/is.js similarity index 100% rename from UI/WebServerResources/ckeditor/lang/is.js rename to UI/WebServerResources/js/vendor/ckeditor/lang/is.js diff --git a/UI/WebServerResources/ckeditor/lang/it.js b/UI/WebServerResources/js/vendor/ckeditor/lang/it.js similarity index 100% rename from UI/WebServerResources/ckeditor/lang/it.js rename to UI/WebServerResources/js/vendor/ckeditor/lang/it.js diff --git a/UI/WebServerResources/ckeditor/lang/nb.js b/UI/WebServerResources/js/vendor/ckeditor/lang/nb.js similarity index 100% rename from UI/WebServerResources/ckeditor/lang/nb.js rename to UI/WebServerResources/js/vendor/ckeditor/lang/nb.js diff --git a/UI/WebServerResources/ckeditor/lang/nl.js b/UI/WebServerResources/js/vendor/ckeditor/lang/nl.js similarity index 100% rename from UI/WebServerResources/ckeditor/lang/nl.js rename to UI/WebServerResources/js/vendor/ckeditor/lang/nl.js diff --git a/UI/WebServerResources/ckeditor/lang/no.js b/UI/WebServerResources/js/vendor/ckeditor/lang/no.js similarity index 100% rename from UI/WebServerResources/ckeditor/lang/no.js rename to UI/WebServerResources/js/vendor/ckeditor/lang/no.js diff --git a/UI/WebServerResources/ckeditor/lang/pl.js b/UI/WebServerResources/js/vendor/ckeditor/lang/pl.js similarity index 100% rename from UI/WebServerResources/ckeditor/lang/pl.js rename to UI/WebServerResources/js/vendor/ckeditor/lang/pl.js diff --git a/UI/WebServerResources/ckeditor/lang/pt-br.js b/UI/WebServerResources/js/vendor/ckeditor/lang/pt-br.js similarity index 100% rename from UI/WebServerResources/ckeditor/lang/pt-br.js rename to UI/WebServerResources/js/vendor/ckeditor/lang/pt-br.js diff --git a/UI/WebServerResources/ckeditor/lang/ru.js b/UI/WebServerResources/js/vendor/ckeditor/lang/ru.js similarity index 100% rename from UI/WebServerResources/ckeditor/lang/ru.js rename to UI/WebServerResources/js/vendor/ckeditor/lang/ru.js diff --git a/UI/WebServerResources/ckeditor/lang/sk.js b/UI/WebServerResources/js/vendor/ckeditor/lang/sk.js similarity index 100% rename from UI/WebServerResources/ckeditor/lang/sk.js rename to UI/WebServerResources/js/vendor/ckeditor/lang/sk.js diff --git a/UI/WebServerResources/ckeditor/lang/sv.js b/UI/WebServerResources/js/vendor/ckeditor/lang/sv.js similarity index 100% rename from UI/WebServerResources/ckeditor/lang/sv.js rename to UI/WebServerResources/js/vendor/ckeditor/lang/sv.js diff --git a/UI/WebServerResources/ckeditor/lang/uk.js b/UI/WebServerResources/js/vendor/ckeditor/lang/uk.js similarity index 100% rename from UI/WebServerResources/ckeditor/lang/uk.js rename to UI/WebServerResources/js/vendor/ckeditor/lang/uk.js diff --git a/UI/WebServerResources/ckeditor/plugins/about/dialogs/about.js b/UI/WebServerResources/js/vendor/ckeditor/plugins/about/dialogs/about.js similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/about/dialogs/about.js rename to UI/WebServerResources/js/vendor/ckeditor/plugins/about/dialogs/about.js diff --git a/UI/WebServerResources/ckeditor/plugins/about/dialogs/hidpi/logo_ckeditor.png b/UI/WebServerResources/js/vendor/ckeditor/plugins/about/dialogs/hidpi/logo_ckeditor.png similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/about/dialogs/hidpi/logo_ckeditor.png rename to UI/WebServerResources/js/vendor/ckeditor/plugins/about/dialogs/hidpi/logo_ckeditor.png diff --git a/UI/WebServerResources/ckeditor/plugins/about/dialogs/logo_ckeditor.png b/UI/WebServerResources/js/vendor/ckeditor/plugins/about/dialogs/logo_ckeditor.png similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/about/dialogs/logo_ckeditor.png rename to UI/WebServerResources/js/vendor/ckeditor/plugins/about/dialogs/logo_ckeditor.png diff --git a/UI/WebServerResources/ckeditor/plugins/clipboard/dialogs/paste.js b/UI/WebServerResources/js/vendor/ckeditor/plugins/clipboard/dialogs/paste.js similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/clipboard/dialogs/paste.js rename to UI/WebServerResources/js/vendor/ckeditor/plugins/clipboard/dialogs/paste.js diff --git a/UI/WebServerResources/ckeditor/plugins/colordialog/dialogs/colordialog.js b/UI/WebServerResources/js/vendor/ckeditor/plugins/colordialog/dialogs/colordialog.js similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/colordialog/dialogs/colordialog.js rename to UI/WebServerResources/js/vendor/ckeditor/plugins/colordialog/dialogs/colordialog.js diff --git a/UI/WebServerResources/ckeditor/plugins/dialog/dialogDefinition.js b/UI/WebServerResources/js/vendor/ckeditor/plugins/dialog/dialogDefinition.js similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/dialog/dialogDefinition.js rename to UI/WebServerResources/js/vendor/ckeditor/plugins/dialog/dialogDefinition.js diff --git a/UI/WebServerResources/ckeditor/plugins/div/dialogs/div.js b/UI/WebServerResources/js/vendor/ckeditor/plugins/div/dialogs/div.js similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/div/dialogs/div.js rename to UI/WebServerResources/js/vendor/ckeditor/plugins/div/dialogs/div.js diff --git a/UI/WebServerResources/js/vendor/ckeditor/plugins/fakeobjects/images/spacer.gif b/UI/WebServerResources/js/vendor/ckeditor/plugins/fakeobjects/images/spacer.gif new file mode 100644 index 000000000..5bfd67a2d Binary files /dev/null and b/UI/WebServerResources/js/vendor/ckeditor/plugins/fakeobjects/images/spacer.gif differ diff --git a/UI/WebServerResources/ckeditor/plugins/icons.png b/UI/WebServerResources/js/vendor/ckeditor/plugins/icons.png similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/icons.png rename to UI/WebServerResources/js/vendor/ckeditor/plugins/icons.png diff --git a/UI/WebServerResources/ckeditor/plugins/icons_hidpi.png b/UI/WebServerResources/js/vendor/ckeditor/plugins/icons_hidpi.png similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/icons_hidpi.png rename to UI/WebServerResources/js/vendor/ckeditor/plugins/icons_hidpi.png diff --git a/UI/WebServerResources/ckeditor/plugins/image/dialogs/image.js b/UI/WebServerResources/js/vendor/ckeditor/plugins/image/dialogs/image.js similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/image/dialogs/image.js rename to UI/WebServerResources/js/vendor/ckeditor/plugins/image/dialogs/image.js diff --git a/UI/WebServerResources/ckeditor/plugins/image/images/noimage.png b/UI/WebServerResources/js/vendor/ckeditor/plugins/image/images/noimage.png similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/image/images/noimage.png rename to UI/WebServerResources/js/vendor/ckeditor/plugins/image/images/noimage.png diff --git a/UI/WebServerResources/ckeditor/plugins/link/dialogs/anchor.js b/UI/WebServerResources/js/vendor/ckeditor/plugins/link/dialogs/anchor.js similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/link/dialogs/anchor.js rename to UI/WebServerResources/js/vendor/ckeditor/plugins/link/dialogs/anchor.js diff --git a/UI/WebServerResources/ckeditor/plugins/link/dialogs/link.js b/UI/WebServerResources/js/vendor/ckeditor/plugins/link/dialogs/link.js similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/link/dialogs/link.js rename to UI/WebServerResources/js/vendor/ckeditor/plugins/link/dialogs/link.js diff --git a/UI/WebServerResources/ckeditor/plugins/link/images/anchor.png b/UI/WebServerResources/js/vendor/ckeditor/plugins/link/images/anchor.png similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/link/images/anchor.png rename to UI/WebServerResources/js/vendor/ckeditor/plugins/link/images/anchor.png diff --git a/UI/WebServerResources/ckeditor/plugins/link/images/hidpi/anchor.png b/UI/WebServerResources/js/vendor/ckeditor/plugins/link/images/hidpi/anchor.png similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/link/images/hidpi/anchor.png rename to UI/WebServerResources/js/vendor/ckeditor/plugins/link/images/hidpi/anchor.png diff --git a/UI/WebServerResources/ckeditor/plugins/scayt/LICENSE.md b/UI/WebServerResources/js/vendor/ckeditor/plugins/scayt/LICENSE.md similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/scayt/LICENSE.md rename to UI/WebServerResources/js/vendor/ckeditor/plugins/scayt/LICENSE.md diff --git a/UI/WebServerResources/ckeditor/plugins/scayt/dialogs/options.js b/UI/WebServerResources/js/vendor/ckeditor/plugins/scayt/dialogs/options.js similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/scayt/dialogs/options.js rename to UI/WebServerResources/js/vendor/ckeditor/plugins/scayt/dialogs/options.js diff --git a/UI/WebServerResources/ckeditor/plugins/scayt/dialogs/toolbar.css b/UI/WebServerResources/js/vendor/ckeditor/plugins/scayt/dialogs/toolbar.css similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/scayt/dialogs/toolbar.css rename to UI/WebServerResources/js/vendor/ckeditor/plugins/scayt/dialogs/toolbar.css diff --git a/UI/WebServerResources/ckeditor/plugins/table/dialogs/table.js b/UI/WebServerResources/js/vendor/ckeditor/plugins/table/dialogs/table.js similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/table/dialogs/table.js rename to UI/WebServerResources/js/vendor/ckeditor/plugins/table/dialogs/table.js diff --git a/UI/WebServerResources/ckeditor/plugins/tabletools/dialogs/tableCell.js b/UI/WebServerResources/js/vendor/ckeditor/plugins/tabletools/dialogs/tableCell.js similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/tabletools/dialogs/tableCell.js rename to UI/WebServerResources/js/vendor/ckeditor/plugins/tabletools/dialogs/tableCell.js diff --git a/UI/WebServerResources/ckeditor/plugins/wsc/LICENSE.md b/UI/WebServerResources/js/vendor/ckeditor/plugins/wsc/LICENSE.md similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/wsc/LICENSE.md rename to UI/WebServerResources/js/vendor/ckeditor/plugins/wsc/LICENSE.md diff --git a/UI/WebServerResources/ckeditor/plugins/wsc/dialogs/ciframe.html b/UI/WebServerResources/js/vendor/ckeditor/plugins/wsc/dialogs/ciframe.html similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/wsc/dialogs/ciframe.html rename to UI/WebServerResources/js/vendor/ckeditor/plugins/wsc/dialogs/ciframe.html diff --git a/UI/WebServerResources/ckeditor/plugins/wsc/dialogs/tmpFrameset.html b/UI/WebServerResources/js/vendor/ckeditor/plugins/wsc/dialogs/tmpFrameset.html similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/wsc/dialogs/tmpFrameset.html rename to UI/WebServerResources/js/vendor/ckeditor/plugins/wsc/dialogs/tmpFrameset.html diff --git a/UI/WebServerResources/ckeditor/plugins/wsc/dialogs/wsc.css b/UI/WebServerResources/js/vendor/ckeditor/plugins/wsc/dialogs/wsc.css similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/wsc/dialogs/wsc.css rename to UI/WebServerResources/js/vendor/ckeditor/plugins/wsc/dialogs/wsc.css diff --git a/UI/WebServerResources/ckeditor/plugins/wsc/dialogs/wsc.js b/UI/WebServerResources/js/vendor/ckeditor/plugins/wsc/dialogs/wsc.js similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/wsc/dialogs/wsc.js rename to UI/WebServerResources/js/vendor/ckeditor/plugins/wsc/dialogs/wsc.js diff --git a/UI/WebServerResources/ckeditor/plugins/wsc/dialogs/wsc_ie.js b/UI/WebServerResources/js/vendor/ckeditor/plugins/wsc/dialogs/wsc_ie.js similarity index 100% rename from UI/WebServerResources/ckeditor/plugins/wsc/dialogs/wsc_ie.js rename to UI/WebServerResources/js/vendor/ckeditor/plugins/wsc/dialogs/wsc_ie.js diff --git a/UI/WebServerResources/ckeditor/skins/moono/dialog.css b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/dialog.css similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/dialog.css rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/dialog.css diff --git a/UI/WebServerResources/ckeditor/skins/moono/dialog_ie.css b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/dialog_ie.css similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/dialog_ie.css rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/dialog_ie.css diff --git a/UI/WebServerResources/ckeditor/skins/moono/dialog_ie7.css b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/dialog_ie7.css similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/dialog_ie7.css rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/dialog_ie7.css diff --git a/UI/WebServerResources/ckeditor/skins/moono/dialog_ie8.css b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/dialog_ie8.css similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/dialog_ie8.css rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/dialog_ie8.css diff --git a/UI/WebServerResources/ckeditor/skins/moono/dialog_iequirks.css b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/dialog_iequirks.css similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/dialog_iequirks.css rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/dialog_iequirks.css diff --git a/UI/WebServerResources/js/vendor/ckeditor/skins/moono/dialog_opera.css b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/dialog_opera.css new file mode 100644 index 000000000..62f4c3633 --- /dev/null +++ b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/dialog_opera.css @@ -0,0 +1,5 @@ +/* +Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or http://ckeditor.com/license +*/ +.cke_dialog{visibility:visible}.cke_dialog_body{z-index:1;background:#eaeaea;border:1px solid #b2b2b2;border-bottom-color:#999;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;-moz-box-shadow:0 0 3px rgba(0,0,0,.15);-webkit-box-shadow:0 0 3px rgba(0,0,0,.15);box-shadow:0 0 3px rgba(0,0,0,.15)}.cke_browser_gecko19 .cke_dialog_body{position:relative}.cke_dialog strong{font-weight:bold}.cke_dialog_title{font-weight:bold;font-size:13px;cursor:move;position:relative;color:#474747;text-shadow:0 1px 0 rgba(255,255,255,.75);border-bottom:1px solid #999;padding:6px 10px;-moz-border-radius:2px 2px 0 0;-webkit-border-radius:2px 2px 0 0;border-radius:2px 2px 0 0;-moz-box-shadow:0 1px 0 #fff inset;-webkit-box-shadow:0 1px 0 #fff inset;box-shadow:0 1px 0 #fff inset;background:#cfd1cf;background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#cfd1cf));background-image:-moz-linear-gradient(top,#f5f5f5,#cfd1cf);background-image:-webkit-linear-gradient(top,#f5f5f5,#cfd1cf);background-image:-o-linear-gradient(top,#f5f5f5,#cfd1cf);background-image:-ms-linear-gradient(top,#f5f5f5,#cfd1cf);background-image:linear-gradient(top,#f5f5f5,#cfd1cf);filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0,startColorstr='#f5f5f5',endColorstr='#cfd1cf')}.cke_dialog_contents{background-color:#fff;overflow:auto;padding:15px 10px 5px 10px;margin-top:30px;border-top:1px solid #bfbfbf;-moz-border-radius:0 0 3px 3px;-webkit-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px}.cke_dialog_contents_body{overflow:auto;padding:17px 10px 5px 10px;margin-top:22px}.cke_dialog_footer{text-align:right;position:relative;border:0;outline:1px solid #bfbfbf;-moz-box-shadow:0 1px 0 #fff inset;-webkit-box-shadow:0 1px 0 #fff inset;box-shadow:0 1px 0 #fff inset;-moz-border-radius:0 0 2px 2px;-webkit-border-radius:0 0 2px 2px;border-radius:0 0 2px 2px;background:#cfd1cf;background-image:-webkit-gradient(linear,left top,left bottom,from(#ebebeb),to(#cfd1cf));background-image:-moz-linear-gradient(top,#ebebeb,#cfd1cf);background-image:-webkit-linear-gradient(top,#ebebeb,#cfd1cf);background-image:-o-linear-gradient(top,#ebebeb,#cfd1cf);background-image:-ms-linear-gradient(top,#ebebeb,#cfd1cf);background-image:linear-gradient(top,#ebebeb,#cfd1cf);filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0,startColorstr='#ebebeb',endColorstr='#cfd1cf')}.cke_rtl .cke_dialog_footer{text-align:left}.cke_hc .cke_dialog_footer{outline:0;border-top:1px solid #fff}.cke_dialog .cke_resizer{margin-top:22px}.cke_dialog .cke_resizer_rtl{margin-left:5px}.cke_dialog .cke_resizer_ltr{margin-right:5px}.cke_dialog_tabs{height:24px;display:inline-block;margin:5px 0 0;position:absolute;z-index:2;left:10px}.cke_rtl .cke_dialog_tabs{right:10px}a.cke_dialog_tab{height:16px;padding:4px 8px;margin-right:3px;display:inline-block;cursor:pointer;line-height:16px;outline:0;color:#595959;border:1px solid #bfbfbf;-moz-border-radius:3px 3px 0 0;-webkit-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0;background:#d4d4d4;background-image:-webkit-gradient(linear,left top,left bottom,from(#fafafa),to(#ededed));background-image:-moz-linear-gradient(top,#fafafa,#ededed);background-image:-webkit-linear-gradient(top,#fafafa,#ededed);background-image:-o-linear-gradient(top,#fafafa,#ededed);background-image:-ms-linear-gradient(top,#fafafa,#ededed);background-image:linear-gradient(top,#fafafa,#ededed);filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0,startColorstr='#fafafa',endColorstr='#ededed')}.cke_rtl a.cke_dialog_tab{margin-right:0;margin-left:3px}a.cke_dialog_tab:hover{background:#ebebeb;background:-moz-linear-gradient(top,#ebebeb 0,#dfdfdf 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#ebebeb),color-stop(100%,#dfdfdf));background:-webkit-linear-gradient(top,#ebebeb 0,#dfdfdf 100%);background:-o-linear-gradient(top,#ebebeb 0,#dfdfdf 100%);background:-ms-linear-gradient(top,#ebebeb 0,#dfdfdf 100%);background:linear-gradient(to bottom,#ebebeb 0,#dfdfdf 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ebebeb',endColorstr='#dfdfdf',GradientType=0)}a.cke_dialog_tab_selected{background:#fff;color:#383838;border-bottom-color:#fff;cursor:default;filter:none}a.cke_dialog_tab_selected:hover{background:#ededed;background:-moz-linear-gradient(top,#ededed 0,#fff 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#ededed),color-stop(100%,#fff));background:-webkit-linear-gradient(top,#ededed 0,#fff 100%);background:-o-linear-gradient(top,#ededed 0,#fff 100%);background:-ms-linear-gradient(top,#ededed 0,#fff 100%);background:linear-gradient(to bottom,#ededed 0,#fff 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed',endColorstr='#ffffff',GradientType=0)}.cke_hc a.cke_dialog_tab:hover,.cke_hc a.cke_dialog_tab_selected{border:3px solid;padding:2px 6px}a.cke_dialog_tab_disabled{color:#bababa;cursor:default}.cke_single_page .cke_dialog_tabs{display:none}.cke_single_page .cke_dialog_contents{padding-top:5px;margin-top:0;border-top:0}.cke_dialog_close_button{background-image:url(images/close.png);background-repeat:no-repeat;background-position:0 0;position:absolute;cursor:pointer;text-align:center;height:20px;width:20px;top:5px;z-index:5}.cke_hidpi .cke_dialog_close_button{background-image:url(images/hidpi/close.png);background-size:16px}.cke_dialog_close_button span{display:none}.cke_hc .cke_dialog_close_button span{display:inline;cursor:pointer;font-weight:bold;position:relative;top:3px}.cke_ltr .cke_dialog_close_button{right:5px}.cke_rtl .cke_dialog_close_button{left:6px}.cke_dialog_close_button{top:4px}div.cke_disabled .cke_dialog_ui_labeled_content div *{background-color:#ddd;cursor:default}.cke_dialog_ui_vbox table,.cke_dialog_ui_hbox table{margin:auto}.cke_dialog_ui_vbox_child{padding:5px 0}.cke_dialog_ui_hbox{width:100%}.cke_dialog_ui_hbox_first,.cke_dialog_ui_hbox_child,.cke_dialog_ui_hbox_last{vertical-align:top}.cke_ltr .cke_dialog_ui_hbox_first,.cke_ltr .cke_dialog_ui_hbox_child{padding-right:10px}.cke_rtl .cke_dialog_ui_hbox_first,.cke_rtl .cke_dialog_ui_hbox_child{padding-left:10px}.cke_ltr .cke_dialog_footer_buttons .cke_dialog_ui_hbox_first,.cke_ltr .cke_dialog_footer_buttons .cke_dialog_ui_hbox_child{padding-right:5px}.cke_rtl .cke_dialog_footer_buttons .cke_dialog_ui_hbox_first,.cke_rtl .cke_dialog_footer_buttons .cke_dialog_ui_hbox_child{padding-left:5px;padding-right:0}.cke_hc div.cke_dialog_ui_input_text,.cke_hc div.cke_dialog_ui_input_password,.cke_hc div.cke_dialog_ui_input_textarea,.cke_hc div.cke_dialog_ui_input_select,.cke_hc div.cke_dialog_ui_input_file{border:1px solid}textarea.cke_dialog_ui_input_textarea{overflow:auto;resize:none}input.cke_dialog_ui_input_text,input.cke_dialog_ui_input_password,textarea.cke_dialog_ui_input_textarea{background-color:#fff;border:1px solid #c9cccf;border-top-color:#aeb3b9;padding:4px 6px;outline:0;width:100%;*width:95%;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;-moz-box-shadow:0 1px 2px rgba(0,0,0,.15) inset;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.15) inset;box-shadow:0 1px 2px rgba(0,0,0,.15) inset}input.cke_dialog_ui_input_text:hover,input.cke_dialog_ui_input_password:hover,textarea.cke_dialog_ui_input_textarea:hover{border:1px solid #aeb3b9;border-top-color:#a0a6ad}input.cke_dialog_ui_input_text:focus,input.cke_dialog_ui_input_password:focus,textarea.cke_dialog_ui_input_textarea:focus,select.cke_dialog_ui_input_select:focus{outline:0;border:1px solid #139ff7;border-top-color:#1392e9}a.cke_dialog_ui_button{display:inline-block;*display:inline;*zoom:1;padding:3px 0;margin:0;text-align:center;color:#333;vertical-align:middle;cursor:pointer;border:1px solid #b6b6b6;border-bottom-color:#999;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;-moz-box-shadow:0 1px 0 rgba(255,255,255,.5),0 0 2px rgba(255,255,255,.15) inset,0 1px 0 rgba(255,255,255,.15) inset;-webkit-box-shadow:0 1px 0 rgba(255,255,255,.5),0 0 2px rgba(255,255,255,.15) inset,0 1px 0 rgba(255,255,255,.15) inset;box-shadow:0 1px 0 rgba(255,255,255,.5),0 0 2px rgba(255,255,255,.15) inset,0 1px 0 rgba(255,255,255,.15) inset;background:#e4e4e4;background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#e4e4e4));background-image:-moz-linear-gradient(top,#fff,#e4e4e4);background-image:-webkit-linear-gradient(top,#fff,#e4e4e4);background-image:-o-linear-gradient(top,#fff,#e4e4e4);background-image:-ms-linear-gradient(top,#fff,#e4e4e4);background-image:linear-gradient(top,#fff,#e4e4e4);filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0,startColorstr='#ffffff',endColorstr='#e4e4e4')}span.cke_dialog_ui_button{padding:0 12px}a.cke_dialog_ui_button:hover{border-color:#9e9e9e;background:#ccc;background-image:-webkit-gradient(linear,left top,left bottom,from(#f2f2f2),to(#ccc));background-image:-moz-linear-gradient(top,#f2f2f2,#ccc);background-image:-webkit-linear-gradient(top,#f2f2f2,#ccc);background-image:-o-linear-gradient(top,#f2f2f2,#ccc);background-image:-ms-linear-gradient(top,#f2f2f2,#ccc);background-image:linear-gradient(top,#f2f2f2,#ccc);filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0,startColorstr='#f2f2f2',endColorstr='#cccccc')}a.cke_dialog_ui_button:focus,a.cke_dialog_ui_button:active{border-color:#969696;outline:0;-moz-box-shadow:0 0 6px rgba(0,0,0,.4) inset;-webkit-box-shadow:0 0 6px rgba(0,0,0,.4) inset;box-shadow:0 0 6px rgba(0,0,0,.4) inset}.cke_hc a.cke_dialog_ui_button:hover,.cke_hc a.cke_dialog_ui_button:focus,.cke_hc a.cke_dialog_ui_button:active{border:3px solid;padding-top:1px;padding-bottom:1px}.cke_hc a.cke_dialog_ui_button:hover span,.cke_hc a.cke_dialog_ui_button:focus span,.cke_hc a.cke_dialog_ui_button:active span{padding-left:10px;padding-right:10px}.cke_dialog_footer_buttons a.cke_dialog_ui_button span{color:inherit;font-size:12px;font-weight:bold;line-height:20px}a.cke_dialog_ui_button_ok{color:#fff;text-shadow:0 -1px 0 #55830c;border-color:#62a60a #62a60a #4d9200;background:#69b10b;background-image:-webkit-gradient(linear,0 0,0 100%,from(#9ad717),to(#69b10b));background-image:-webkit-linear-gradient(top,#9ad717,#69b10b);background-image:-o-linear-gradient(top,#9ad717,#69b10b);background-image:linear-gradient(to bottom,#9ad717,#69b10b);background-image:-moz-linear-gradient(top,#9ad717,#69b10b);filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0,startColorstr='#9ad717',endColorstr='#69b10b')}a.cke_dialog_ui_button_ok:hover{border-color:#5b9909 #5b9909 #478500;background:#88be14;background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#88be14),color-stop(100%,#5d9c0a));background:-webkit-linear-gradient(top,#88be14 0,#5d9c0a 100%);background:-o-linear-gradient(top,#88be14 0,#5d9c0a 100%);background:linear-gradient(to bottom,#88be14 0,#5d9c0a 100%);background:-moz-linear-gradient(top,#88be14 0,#5d9c0a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#88be14',endColorstr='#5d9c0a',GradientType=0)}a.cke_dialog_ui_button span{text-shadow:0 1px 0 #fff}a.cke_dialog_ui_button_ok span{text-shadow:0 -1px 0 #55830c}span.cke_dialog_ui_button{cursor:pointer}a.cke_dialog_ui_button_ok:focus,a.cke_dialog_ui_button_ok:active,a.cke_dialog_ui_button_cancel:focus,a.cke_dialog_ui_button_cancel:active{border-width:2px;padding:2px 0}a.cke_dialog_ui_button_ok:focus,a.cke_dialog_ui_button_ok:active{border-color:#568c0a}a.cke_dialog_ui_button_ok:focus span,a.cke_dialog_ui_button_ok:active span,a.cke_dialog_ui_button_cancel:focus span,a.cke_dialog_ui_button_cancel:active span{padding:0 11px}.cke_dialog_footer_buttons{display:inline-table;margin:5px;width:auto;position:relative;vertical-align:middle}div.cke_dialog_ui_input_select{display:table}select.cke_dialog_ui_input_select{height:24px;line-height:24px;background-color:#fff;border:1px solid #c9cccf;border-top-color:#aeb3b9;padding:2px 6px;outline:0;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;-moz-box-shadow:0 1px 2px rgba(0,0,0,.15) inset;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.15) inset;box-shadow:0 1px 2px rgba(0,0,0,.15) inset}.cke_dialog_ui_input_file{width:100%;height:25px}.cke_hc .cke_dialog_ui_labeled_content input:focus,.cke_hc .cke_dialog_ui_labeled_content select:focus,.cke_hc .cke_dialog_ui_labeled_content textarea:focus{outline:1px dotted}.cke_dialog .cke_dark_background{background-color:#dedede}.cke_dialog .cke_light_background{background-color:#ebebeb}.cke_dialog .cke_centered{text-align:center}.cke_dialog a.cke_btn_reset{float:right;background:url(images/refresh.png) top left no-repeat;width:16px;height:16px;border:1px none;font-size:1px}.cke_hidpi .cke_dialog a.cke_btn_reset{background-size:16px;background-image:url(images/hidpi/refresh.png)}.cke_rtl .cke_dialog a.cke_btn_reset{float:left}.cke_dialog a.cke_btn_locked,.cke_dialog a.cke_btn_unlocked{float:left;width:16px;height:16px;background-repeat:no-repeat;border:none 1px;font-size:1px}.cke_dialog a.cke_btn_locked .cke_icon{display:none}.cke_rtl .cke_dialog a.cke_btn_locked,.cke_rtl .cke_dialog a.cke_btn_unlocked{float:right}.cke_dialog a.cke_btn_locked{background-image:url(images/lock.png)}.cke_dialog a.cke_btn_unlocked{background-image:url(images/lock-open.png)}.cke_hidpi .cke_dialog a.cke_btn_unlocked,.cke_hidpi .cke_dialog a.cke_btn_locked{background-size:16px}.cke_hidpi .cke_dialog a.cke_btn_locked{background-image:url(images/hidpi/lock.png)}.cke_hidpi .cke_dialog a.cke_btn_unlocked{background-image:url(images/hidpi/lock-open.png)}.cke_dialog .cke_btn_over{border:outset 1px;cursor:pointer}.cke_dialog .ImagePreviewBox{border:2px ridge black;overflow:scroll;height:200px;width:300px;padding:2px;background-color:white}.cke_dialog .ImagePreviewBox table td{white-space:normal}.cke_dialog .ImagePreviewLoader{position:absolute;white-space:normal;overflow:hidden;height:160px;width:230px;margin:2px;padding:2px;opacity:.9;filter:alpha(opacity = 90);background-color:#e4e4e4}.cke_dialog .FlashPreviewBox{white-space:normal;border:2px ridge black;overflow:auto;height:160px;width:390px;padding:2px;background-color:white}.cke_dialog .cke_pastetext{width:346px;height:170px}.cke_dialog .cke_pastetext textarea{width:340px;height:170px;resize:none}.cke_dialog iframe.cke_pasteframe{width:346px;height:130px;background-color:white;border:1px solid #aeb3b9;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px}.cke_dialog .cke_hand{cursor:pointer}.cke_disabled{color:#a0a0a0}.cke_dialog_body .cke_label{display:none}.cke_dialog_body label{display:inline;margin-bottom:auto;cursor:default}.cke_dialog_body label.cke_required{font-weight:bold}a.cke_smile{overflow:hidden;display:block;text-align:center;padding:.3em 0}a.cke_smile img{vertical-align:middle}a.cke_specialchar{cursor:inherit;display:block;height:1.25em;padding:.2em .3em;text-align:center}a.cke_smile,a.cke_specialchar{border:1px solid transparent}a.cke_smile:hover,a.cke_smile:focus,a.cke_smile:active,a.cke_specialchar:hover,a.cke_specialchar:focus,a.cke_specialchar:active{background:#fff;outline:0}a.cke_smile:hover,a.cke_specialchar:hover{border-color:#888}a.cke_smile:focus,a.cke_smile:active,a.cke_specialchar:focus,a.cke_specialchar:active{border-color:#139ff7}.cke_dialog_contents a.colorChooser{display:block;margin-top:6px;margin-left:10px;width:80px}.cke_rtl .cke_dialog_contents a.colorChooser{margin-right:10px}.cke_dialog_ui_checkbox_input:focus,.cke_dialog_ui_radio_input:focus,.cke_btn_over{outline:1px dotted #696969}.cke_iframe_shim{display:block;position:absolute;top:0;left:0;z-index:-1;filter:alpha(opacity = 0);width:100%;height:100%}.cke_dialog_footer{display:block;height:38px}.cke_ltr .cke_dialog_footer>*{float:right}.cke_rtl .cke_dialog_footer>*{float:left} \ No newline at end of file diff --git a/UI/WebServerResources/ckeditor/skins/moono/editor.css b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/editor.css similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/editor.css rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/editor.css diff --git a/UI/WebServerResources/ckeditor/skins/moono/editor_gecko.css b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/editor_gecko.css similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/editor_gecko.css rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/editor_gecko.css diff --git a/UI/WebServerResources/ckeditor/skins/moono/editor_ie.css b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/editor_ie.css similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/editor_ie.css rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/editor_ie.css diff --git a/UI/WebServerResources/ckeditor/skins/moono/editor_ie7.css b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/editor_ie7.css similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/editor_ie7.css rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/editor_ie7.css diff --git a/UI/WebServerResources/ckeditor/skins/moono/editor_ie8.css b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/editor_ie8.css similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/editor_ie8.css rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/editor_ie8.css diff --git a/UI/WebServerResources/ckeditor/skins/moono/editor_iequirks.css b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/editor_iequirks.css similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/editor_iequirks.css rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/editor_iequirks.css diff --git a/UI/WebServerResources/ckeditor/skins/moono/icons.png b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/icons.png similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/icons.png rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/icons.png diff --git a/UI/WebServerResources/ckeditor/skins/moono/icons_hidpi.png b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/icons_hidpi.png similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/icons_hidpi.png rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/icons_hidpi.png diff --git a/UI/WebServerResources/ckeditor/skins/moono/images/arrow.png b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/images/arrow.png similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/images/arrow.png rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/images/arrow.png diff --git a/UI/WebServerResources/ckeditor/skins/moono/images/close.png b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/images/close.png similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/images/close.png rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/images/close.png diff --git a/UI/WebServerResources/ckeditor/skins/moono/images/hidpi/close.png b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/images/hidpi/close.png similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/images/hidpi/close.png rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/images/hidpi/close.png diff --git a/UI/WebServerResources/ckeditor/skins/moono/images/hidpi/lock-open.png b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/images/hidpi/lock-open.png similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/images/hidpi/lock-open.png rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/images/hidpi/lock-open.png diff --git a/UI/WebServerResources/ckeditor/skins/moono/images/hidpi/lock.png b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/images/hidpi/lock.png similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/images/hidpi/lock.png rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/images/hidpi/lock.png diff --git a/UI/WebServerResources/ckeditor/skins/moono/images/hidpi/refresh.png b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/images/hidpi/refresh.png similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/images/hidpi/refresh.png rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/images/hidpi/refresh.png diff --git a/UI/WebServerResources/ckeditor/skins/moono/images/lock-open.png b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/images/lock-open.png similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/images/lock-open.png rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/images/lock-open.png diff --git a/UI/WebServerResources/ckeditor/skins/moono/images/lock.png b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/images/lock.png similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/images/lock.png rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/images/lock.png diff --git a/UI/WebServerResources/ckeditor/skins/moono/images/refresh.png b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/images/refresh.png similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/images/refresh.png rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/images/refresh.png diff --git a/UI/WebServerResources/ckeditor/skins/moono/readme.md b/UI/WebServerResources/js/vendor/ckeditor/skins/moono/readme.md similarity index 100% rename from UI/WebServerResources/ckeditor/skins/moono/readme.md rename to UI/WebServerResources/js/vendor/ckeditor/skins/moono/readme.md diff --git a/UI/WebServerResources/ckeditor/styles.js b/UI/WebServerResources/js/vendor/ckeditor/styles.js similarity index 100% rename from UI/WebServerResources/ckeditor/styles.js rename to UI/WebServerResources/js/vendor/ckeditor/styles.js diff --git a/UI/WebServerResources/js_color_picker_v2.js b/UI/WebServerResources/js_color_picker_v2.js deleted file mode 100644 index 90011853d..000000000 --- a/UI/WebServerResources/js_color_picker_v2.js +++ /dev/null @@ -1,581 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************************************************ -@fileoverview -JS Color picker -Copyright (C) October 2005, DHTMLGoodies.com, Alf Magne Kalleland - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Dhtmlgoodies.com., hereby disclaims all copyright interest in this script -written by Alf Magne Kalleland. - -Alf Magne Kalleland, 2007 -Owner of DHTMLgoodies.com - - -************************************************************************************************************/ - -var MSIE = navigator.userAgent.indexOf('MSIE')>=0?true:false; -var navigatorVersion = navigator.appVersion.replace(/.*?MSIE (\d\.\d).*/g,'$1')/1; - -var form_widget_amount_slider_handle = ResourcesURL + "/slider_handle.gif"; -var slider_handle_image_obj = false; -var sliderObjectArray = new Array(); -var slider_counter = 0; -var slideInProgress = false; -var handle_start_x; -var event_start_x; -var currentSliderIndex; - -function form_widget_cancel_event() -{ - return false; -} - -function getImageSliderHeight(){ - if(!slider_handle_image_obj){ - slider_handle_image_obj = new Image(); - slider_handle_image_obj.src = form_widget_amount_slider_handle; - } - if(slider_handle_image_obj.width>0){ - return; - }else{ - setTimeout('getImageSliderHeight()',50); - } -} - -function positionSliderImage(e,theIndex,inputObj) -{ - if(this)inputObj = this; - if(!theIndex)theIndex = inputObj.getAttribute('sliderIndex'); - var handleImg = document.getElementById('slider_handle' + theIndex); - var ratio = sliderObjectArray[theIndex]['width'] / (sliderObjectArray[theIndex]['max']-sliderObjectArray[theIndex]['min']); - var currentValue = sliderObjectArray[theIndex]['formTarget'].value-sliderObjectArray[theIndex]['min']; - handleImg.style.left = currentValue * ratio + 'px'; - setColorByRGB(); -} - -function adjustFormValue(theIndex) -{ - var handleImg = document.getElementById('slider_handle' + theIndex); - var ratio = sliderObjectArray[theIndex]['width'] / (sliderObjectArray[theIndex]['max']-sliderObjectArray[theIndex]['min']); - var currentPos = handleImg.style.left.replace('px',''); - sliderObjectArray[theIndex]['formTarget'].value = Math.round(currentPos / ratio) + sliderObjectArray[theIndex]['min']; - -} - -function initMoveSlider(e) -{ - - if(document.all)e = event; - slideInProgress = true; - event_start_x = e.clientX; - handle_start_x = this.style.left.replace('px',''); - currentSliderIndex = this.id.replace(/[^\d]/g,''); - return false; -} - -function startMoveSlider(e) -{ - if(document.all)e = event; - if(!slideInProgress)return; - var leftPos = handle_start_x/1 + e.clientX/1 - event_start_x; - if(leftPos<0)leftPos = 0; - if(leftPos/1>sliderObjectArray[currentSliderIndex]['width'])leftPos = sliderObjectArray[currentSliderIndex]['width']; - document.getElementById('slider_handle' + currentSliderIndex).style.left = leftPos + 'px'; - adjustFormValue(currentSliderIndex); - if(sliderObjectArray[currentSliderIndex]['onchangeAction']){ - eval(sliderObjectArray[currentSliderIndex]['onchangeAction']); - } -} - -function stopMoveSlider() -{ - slideInProgress = false; -} - - -function form_widget_amount_slider(targetElId,formTarget,width,min,max,onchangeAction) -{ - if(!slider_handle_image_obj){ - getImageSliderHeight(); - } - - slider_counter = slider_counter +1; - sliderObjectArray[slider_counter] = new Array(); - sliderObjectArray[slider_counter] = {"width":width - 9,"min":min,"max":max,"formTarget":formTarget,"onchangeAction":onchangeAction}; - - formTarget.setAttribute('sliderIndex',slider_counter); - formTarget.onchange = positionSliderImage; - var parentObj = document.createElement('DIV'); - parentObj.style.width = width + 'px'; - parentObj.style.height = '12px'; // The height of the image - parentObj.style.position = 'relative'; - parentObj.id = 'slider_container' + slider_counter; - document.getElementById(targetElId).appendChild(parentObj); - - var obj = document.createElement('DIV'); - obj.className = 'form_widget_amount_slider'; - obj.innerHTML = ''; - obj.style.width = width + 'px'; - obj.id = 'slider_slider' + slider_counter; - obj.style.position = 'absolute'; - obj.style.bottom = '0px'; - parentObj.appendChild(obj); - - var handleImg = document.createElement('IMG'); - handleImg.style.position = 'absolute'; - handleImg.style.left = '0px'; - handleImg.style.zIndex = 5; - handleImg.src = slider_handle_image_obj.src; - handleImg.id = 'slider_handle' + slider_counter; - handleImg.onmousedown = initMoveSlider; - if(document.body.onmouseup){ - if(document.body.onmouseup.toString().indexOf('stopMoveSlider')==-1){ - alert('You allready have an onmouseup event assigned to the body tag'); - } - }else{ - document.body.onmouseup = stopMoveSlider; - document.body.onmousemove = startMoveSlider; - } - handleImg.ondragstart = form_widget_cancel_event; - parentObj.appendChild(handleImg); - positionSliderImage(false,slider_counter); -} - - - -var namedColors = new Array('AliceBlue','AntiqueWhite','Aqua','Aquamarine','Azure','Beige','Bisque','Black','BlanchedAlmond','Blue','BlueViolet','Brown', - 'BurlyWood','CadetBlue','Chartreuse','Chocolate','Coral','CornflowerBlue','Cornsilk','Crimson','Cyan','DarkBlue','DarkCyan','DarkGoldenRod','DarkGray', - 'DarkGreen','DarkKhaki','DarkMagenta','DarkOliveGreen','Darkorange','DarkOrchid','DarkRed','DarkSalmon','DarkSeaGreen','DarkSlateBlue','DarkSlateGray', - 'DarkTurquoise','DarkViolet','DeepPink','DeepSkyBlue','DimGray','DodgerBlue','Feldspar','FireBrick','FloralWhite','ForestGreen','Fuchsia','Gainsboro', - 'GhostWhite','Gold','GoldenRod','Gray','Green','GreenYellow','HoneyDew','HotPink','IndianRed','Indigo','Ivory','Khaki','Lavender','LavenderBlush', - 'LawnGreen','LemonChiffon','LightBlue','LightCoral','LightCyan','LightGoldenRodYellow','LightGrey','LightGreen','LightPink','LightSalmon','LightSeaGreen', - 'LightSkyBlue','LightSlateBlue','LightSlateGray','LightSteelBlue','LightYellow','Lime','LimeGreen','Linen','Magenta','Maroon','MediumAquaMarine', - 'MediumBlue','MediumOrchid','MediumPurple','MediumSeaGreen','MediumSlateBlue','MediumSpringGreen','MediumTurquoise','MediumVioletRed','MidnightBlue', - 'MintCream','MistyRose','Moccasin','NavajoWhite','Navy','OldLace','Olive','OliveDrab','Orange','OrangeRed','Orchid','PaleGoldenRod','PaleGreen', - 'PaleTurquoise','PaleVioletRed','PapayaWhip','PeachPuff','Peru','Pink','Plum','PowderBlue','Purple','Red','RosyBrown','RoyalBlue','SaddleBrown', - 'Salmon','SandyBrown','SeaGreen','SeaShell','Sienna','Silver','SkyBlue','SlateBlue','SlateGray','Snow','SpringGreen','SteelBlue','Tan','Teal','Thistle', - 'Tomato','Turquoise','Violet','VioletRed','Wheat','White','WhiteSmoke','Yellow','YellowGreen'); - -var namedColorRGB = new Array('#F0F8FF','#FAEBD7','#00FFFF','#7FFFD4','#F0FFFF','#F5F5DC','#FFE4C4','#000000','#FFEBCD','#0000FF','#8A2BE2','#A52A2A','#DEB887', - '#5F9EA0','#7FFF00','#D2691E','#FF7F50','#6495ED','#FFF8DC','#DC143C','#00FFFF','#00008B','#008B8B','#B8860B','#A9A9A9','#006400','#BDB76B','#8B008B', - '#556B2F','#FF8C00','#9932CC','#8B0000','#E9967A','#8FBC8F','#483D8B','#2F4F4F','#00CED1','#9400D3','#FF1493','#00BFFF','#696969','#1E90FF','#D19275', - '#B22222','#FFFAF0','#228B22','#FF00FF','#DCDCDC','#F8F8FF','#FFD700','#DAA520','#808080','#008000','#ADFF2F','#F0FFF0','#FF69B4','#CD5C5C','#4B0082', - '#FFFFF0','#F0E68C','#E6E6FA','#FFF0F5','#7CFC00','#FFFACD','#ADD8E6','#F08080','#E0FFFF','#FAFAD2','#D3D3D3','#90EE90','#FFB6C1','#FFA07A','#20B2AA', - '#87CEFA','#8470FF','#778899','#B0C4DE','#FFFFE0','#00FF00','#32CD32','#FAF0E6','#FF00FF','#800000','#66CDAA','#0000CD','#BA55D3','#9370D8','#3CB371', - '#7B68EE','#00FA9A','#48D1CC','#C71585','#191970','#F5FFFA','#FFE4E1','#FFE4B5','#FFDEAD','#000080','#FDF5E6','#808000','#6B8E23','#FFA500','#FF4500', - '#DA70D6','#EEE8AA','#98FB98','#AFEEEE','#D87093','#FFEFD5','#FFDAB9','#CD853F','#FFC0CB','#DDA0DD','#B0E0E6','#800080','#FF0000','#BC8F8F','#4169E1', - '#8B4513','#FA8072','#F4A460','#2E8B57','#FFF5EE','#A0522D','#C0C0C0','#87CEEB','#6A5ACD','#708090','#FFFAFA','#00FF7F','#4682B4','#D2B48C','#008080', - '#D8BFD8','#FF6347','#40E0D0','#EE82EE','#D02090','#F5DEB3','#FFFFFF','#F5F5F5','#FFFF00','#9ACD32'); - - -var color_picker_div = false; -var color_picker_active_tab = false; -// var color_picker_form_field = false; -// var color_picker_active_input = false; -function baseConverter (number,ob,nb) { - number = number + ""; - number = number.toUpperCase(); - var list = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - var dec = 0; - for (var i = 0; i <= number.length; i++) { - dec += (list.indexOf(number.charAt(i))) * (Math.pow(ob , (number.length - i - 1))); - } - number = ""; - var magnitude = Math.floor((Math.log(dec))/(Math.log(nb))); - for (var i = magnitude; i >= 0; i--) { - var amount = Math.floor(dec/Math.pow(nb,i)); - number = number + list.charAt(amount); - dec -= amount*(Math.pow(nb,i)); - } - if(number.length==0)number=0; - return number; -} - -// function colorPickerGetTopPos(inputObj) -// { - -// var returnValue = inputObj.offsetTop; -// while((inputObj = inputObj.offsetParent) != null){ -// returnValue += inputObj.offsetTop; -// } -// return returnValue; -// } - -// function colorPickerGetLeftPos(inputObj) -// { -// var returnValue = inputObj.offsetLeft; -// while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft; -// return returnValue; -// } - -function cancelColorPickerEvent(){ - return false; -} - -function showHideColorOptions(e,inputObj) -{ - var thisObj = this; - if(inputObj){ - var parentNode = inputObj.parentNode; - thisObj = inputObj; - }else var parentNode = this.parentNode; - var activeColorDiv = false; - var subDiv = parentNode.getElementsByTagName('DIV')[0]; - counter=0; - var initZIndex = 10; - var contentDiv = document.getElementById('color_picker_content').getElementsByTagName('DIV')[0]; - do{ - if(subDiv.tagName=='DIV') { - if(subDiv==thisObj){ - thisObj.className='colorPickerTab_active'; - thisObj.style.zIndex = 50; - var img = thisObj.getElementsByTagName('IMG')[0]; - img.src = ResourcesURL + "/tab_right_active.gif" - img.src = img.src.replace(/inactive/,'active'); - contentDiv.style.display='block'; - activeColorDiv = contentDiv; - }else{ - subDiv.className = 'colorPickerTab_inactive'; - var img = subDiv.getElementsByTagName('IMG')[0]; - img.src = ResourcesURL + "/tab_right_inactive.gif"; - if(activeColorDiv) - subDiv.style.zIndex = initZIndex - counter; - else - subDiv.style.zIndex = counter; - contentDiv.style.display='none'; - } - counter++; - } - subDiv = subDiv.nextSibling; - if(contentDiv.nextSibling)contentDiv = contentDiv.nextSibling; - }while(subDiv); - - - document.getElementById('colorPicker_statusBarTxt').innerHTML = ' '; - - -} - -function createColorPickerTopRow(inputObj){ - var tabs = ['RGB','Named colors','Color slider']; - var tabWidths = [37,90,70]; - var div = document.createElement('DIV'); - div.className='colorPicker_topRow'; - - inputObj.appendChild(div); - var currentWidth = 0; - for(var no=0;no=0;r-=3){ - for(var g=0;g<=15;g+=3){ - for(var b=0;b<=15;b+=3){ - var red = baseConverter(r,10,16) + ''; - var green = baseConverter(g,10,16) + ''; - var blue = baseConverter(b,10,16) + ''; - - var color = '#' + red + red + green + green + blue + blue; - var div = document.createElement('DIV'); - div.style.backgroundColor=color; - div.innerHTML = ''; - div.className='colorSquare'; - div.title = color; - div.onclick = chooseColor; - div.setAttribute('rgbColor',color); - div.onmouseover = colorPickerShowStatusBarText; - div.onmouseout = colorPickerHideStatusBarText; - webColorDiv.appendChild(div); - } - } - } -} - -function createNamedColors(inputObj){ - var namedColorDiv = document.createElement('DIV'); - namedColorDiv.style.paddingTop = '1px'; - namedColorDiv.style.display='none'; - inputObj.appendChild(namedColorDiv); - for(var no=0;no255)r=255; - if(g/1>255)g=255; - if(b/1>255)b=255; - r = baseConverter(r,10,16) + ''; - g = baseConverter(g,10,16) + ''; - b = baseConverter(b,10,16) + ''; - if(r.length==1)r = '0' + r; - if(g.length==1)g = '0' + g; - if(b.length==1)b = '0' + b; - - document.getElementById('colorPreview').style.backgroundColor = '#' + r + g + b; - document.getElementById('js_color_picker_color_code').value = '#' + r + g + b; -} diff --git a/UI/WebServerResources/last.gif b/UI/WebServerResources/last.gif deleted file mode 100644 index 5412ed01c..000000000 Binary files a/UI/WebServerResources/last.gif and /dev/null differ diff --git a/UI/WebServerResources/layout2or3_xlib.js b/UI/WebServerResources/layout2or3_xlib.js deleted file mode 100644 index 9052b6928..000000000 --- a/UI/WebServerResources/layout2or3_xlib.js +++ /dev/null @@ -1,4 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* X Library, Copyright (C) 2001,2002,2003,2004,2005 Michael Foster (Cross-Browser.com). Distributed under the terms of the GNU LGPL */ -/* layout2or3_xlib.js compiled with XC v0.22b, see layout2or3_xlib.txt for contributor copyrights, license info and documentation */ -var xVersion='4.0',xOp7,xOp5or6,xIE4Up,xIE4,xIE5,xNN4,xMoz,xMac,xUA=navigator.userAgent.toLowerCase();if (window.opera){xOp7=(xUA.indexOf('opera 7')!=-1 || xUA.indexOf('opera/7')!=-1);if (!xOp7) xOp5or6=(xUA.indexOf('opera 5')!=-1 || xUA.indexOf('opera/5')!=-1 || xUA.indexOf('opera 6')!=-1 || xUA.indexOf('opera/6')!=-1);}else if (document.all && xUA.indexOf('msie')!=-1) {xIE4Up=parseInt(navigator.appVersion)>=4;xIE4=xUA.indexOf('msie 4')!=-1;xIE5=xUA.indexOf('msie 5')!=-1;}else if (document.layers) {xNN4=true;}xMoz=xUA.indexOf('gecko')!=-1;xMac=xUA.indexOf('mac')!=-1;function xGetElementById(e){if(typeof(e)!='string') return e;if(document.getElementById) e=document.getElementById(e);else if(document.all) e=document.all[e];else e=null;return e;}function xStr(s){for(var i=0; i=0) {var pt=0,pb=0,bt=0,bb=0;if (document.compatMode=='CSS1Compat') {var gcs = xGetComputedStyle;pt=gcs(e,'padding-top',1);if (pt != null) {pb=gcs(e,'padding-bottom',1);bt=gcs(e,'border-top-width',1);bb=gcs(e,'border-bottom-width',1);}else if(xDef(e.offsetHeight,e.style.height)){e.style.height=h+'px';pt=e.offsetHeight-h;}}h-=(pt+pb+bt+bb);if(isNaN(h)||h<0) return;else e.style.height=h+'px';}h=e.offsetHeight;}else if(css && xDef(e.style.pixelHeight)) {if(h>=0) e.style.pixelHeight=h;h=e.style.pixelHeight;}return h;}function xClientWidth(){var w=0;if(xOp5or6) w=window.innerWidth;else if(document.compatMode == 'CSS1Compat' && !window.opera && document.documentElement && document.documentElement.clientWidth)w=document.documentElement.clientWidth;else if(document.body && document.body.clientWidth)w=document.body.clientWidth;else if(xDef(window.innerWidth,window.innerHeight,document.height)) {w=window.innerWidth;if(document.height>window.innerHeight) w-=16;}return w;}function xClientHeight(){var h=0;if(xOp5or6) h=window.innerHeight;else if(document.compatMode == 'CSS1Compat' && !window.opera && document.documentElement && document.documentElement.clientHeight)h=document.documentElement.clientHeight;else if(document.body && document.body.clientHeight)h=document.body.clientHeight;else if(xDef(window.innerWidth,window.innerHeight,document.width)) {h=window.innerHeight;if(document.width>window.innerWidth) h-=16;}return h;}function xAddEventListener(e,eT,eL,cap){if(!(e=xGetElementById(e))) return;eT=eT.toLowerCase();if((!xIE4Up && !xOp7 /* && !xMoz */) && e==window) {if(eT=='resize') { window.xPCW=xClientWidth(); window.xPCH=xClientHeight(); window.xREL=eL; xResizeEvent(); return; }if(eT=='scroll') { window.xPSL=xScrollLeft(); window.xPST=xScrollTop(); window.xSEL=eL; xScrollEvent(); return; }}var eh='e.on'+eT+'=eL';if(e.addEventListener) e.addEventListener(eT,eL,cap);else if(e.attachEvent) e.attachEvent('on'+eT,eL);else eval(eh);}function xResizeEvent(){if (window.xREL) setTimeout('xResizeEvent()', 250);var cw = xClientWidth(), ch = xClientHeight();if (window.xPCW != cw || window.xPCH != ch) { window.xPCW = cw; window.xPCH = ch; if (window.xREL) window.xREL(); }}function xScrollEvent(){if (window.xSEL) setTimeout('xScrollEvent()', 250);var sl = xScrollLeft(), st = xScrollTop();if (window.xPSL != sl || window.xPST != st) { window.xPSL = sl; window.xPST = st; if (window.xSEL) window.xSEL(); }}function xGetComputedStyle(oEle, sProp, bInt){var s, p = 'undefined';var dv = document.defaultView;if(dv && dv.getComputedStyle){s = dv.getComputedStyle(oEle,'');if (s) p = s.getPropertyValue(sProp);}else if(oEle.currentStyle) {var a = sProp.split('-');sProp = a[0];for (var i=1; i -1, - Gecko: ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') === -1, - MobileSafari: /Apple.*Mobile/.test(ua) - } - })(), - - BrowserFeatures: { - XPath: !!document.evaluate, - - SelectorsAPI: !!document.querySelector, - - ElementExtensions: (function() { - var constructor = window.Element || window.HTMLElement; - return !!(constructor && constructor.prototype); - })(), - SpecificElementExtensions: (function() { - if (typeof window.HTMLDivElement !== 'undefined') - return true; - - var div = document.createElement('div'), - form = document.createElement('form'), - isSupported = false; - - if (div['__proto__'] && (div['__proto__'] !== form['__proto__'])) { - isSupported = true; - } - - div = form = null; - - return isSupported; - })() - }, - - ScriptFragment: ']*>([\\S\\s]*?)<\/script\\s*>', - JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/, - - emptyFunction: function() { }, - - K: function(x) { return x } -}; - -if (Prototype.Browser.MobileSafari) - Prototype.BrowserFeatures.SpecificElementExtensions = false; -/* Based on Alex Arnell's inheritance implementation. */ - -var Class = (function() { - - var IS_DONTENUM_BUGGY = (function(){ - for (var p in { toString: 1 }) { - if (p === 'toString') return false; - } - return true; - })(); - - function subclass() {}; - function create() { - var parent = null, properties = $A(arguments); - if (Object.isFunction(properties[0])) - parent = properties.shift(); - - function klass() { - this.initialize.apply(this, arguments); - } - - Object.extend(klass, Class.Methods); - klass.superclass = parent; - klass.subclasses = []; - - if (parent) { - subclass.prototype = parent.prototype; - klass.prototype = new subclass; - parent.subclasses.push(klass); - } - - for (var i = 0, length = properties.length; i < length; i++) - klass.addMethods(properties[i]); - - if (!klass.prototype.initialize) - klass.prototype.initialize = Prototype.emptyFunction; - - klass.prototype.constructor = klass; - return klass; - } - - function addMethods(source) { - var ancestor = this.superclass && this.superclass.prototype, - properties = Object.keys(source); - - if (IS_DONTENUM_BUGGY) { - if (source.toString != Object.prototype.toString) - properties.push("toString"); - if (source.valueOf != Object.prototype.valueOf) - properties.push("valueOf"); - } - - for (var i = 0, length = properties.length; i < length; i++) { - var property = properties[i], value = source[property]; - if (ancestor && Object.isFunction(value) && - value.argumentNames()[0] == "$super") { - var method = value; - value = (function(m) { - return function() { return ancestor[m].apply(this, arguments); }; - })(property).wrap(method); - - value.valueOf = (function(method) { - return function() { return method.valueOf.call(method); }; - })(method); - - value.toString = (function(method) { - return function() { return method.toString.call(method); }; - })(method); - } - this.prototype[property] = value; - } - - return this; - } - - return { - create: create, - Methods: { - addMethods: addMethods - } - }; -})(); -(function() { - - var _toString = Object.prototype.toString, - _hasOwnProperty = Object.prototype.hasOwnProperty, - NULL_TYPE = 'Null', - UNDEFINED_TYPE = 'Undefined', - BOOLEAN_TYPE = 'Boolean', - NUMBER_TYPE = 'Number', - STRING_TYPE = 'String', - OBJECT_TYPE = 'Object', - FUNCTION_CLASS = '[object Function]', - BOOLEAN_CLASS = '[object Boolean]', - NUMBER_CLASS = '[object Number]', - STRING_CLASS = '[object String]', - ARRAY_CLASS = '[object Array]', - DATE_CLASS = '[object Date]', - NATIVE_JSON_STRINGIFY_SUPPORT = window.JSON && - typeof JSON.stringify === 'function' && - JSON.stringify(0) === '0' && - typeof JSON.stringify(Prototype.K) === 'undefined'; - - - - var DONT_ENUMS = ['toString', 'toLocaleString', 'valueOf', - 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor']; - - var IS_DONTENUM_BUGGY = (function(){ - for (var p in { toString: 1 }) { - if (p === 'toString') return false; - } - return true; - })(); - - function Type(o) { - switch(o) { - case null: return NULL_TYPE; - case (void 0): return UNDEFINED_TYPE; - } - var type = typeof o; - switch(type) { - case 'boolean': return BOOLEAN_TYPE; - case 'number': return NUMBER_TYPE; - case 'string': return STRING_TYPE; - } - return OBJECT_TYPE; - } - - function extend(destination, source) { - for (var property in source) - destination[property] = source[property]; - return destination; - } - - function inspect(object) { - try { - if (isUndefined(object)) return 'undefined'; - if (object === null) return 'null'; - return object.inspect ? object.inspect() : String(object); - } catch (e) { - if (e instanceof RangeError) return '...'; - throw e; - } - } - - function toJSON(value) { - return Str('', { '': value }, []); - } - - function Str(key, holder, stack) { - var value = holder[key]; - if (Type(value) === OBJECT_TYPE && typeof value.toJSON === 'function') { - value = value.toJSON(key); - } - - var _class = _toString.call(value); - - switch (_class) { - case NUMBER_CLASS: - case BOOLEAN_CLASS: - case STRING_CLASS: - value = value.valueOf(); - } - - switch (value) { - case null: return 'null'; - case true: return 'true'; - case false: return 'false'; - } - - var type = typeof value; - switch (type) { - case 'string': - return value.inspect(true); - case 'number': - return isFinite(value) ? String(value) : 'null'; - case 'object': - - for (var i = 0, length = stack.length; i < length; i++) { - if (stack[i] === value) { - throw new TypeError("Cyclic reference to '" + value + "' in object"); - } - } - stack.push(value); - - var partial = []; - if (_class === ARRAY_CLASS) { - for (var i = 0, length = value.length; i < length; i++) { - var str = Str(i, value, stack); - partial.push(typeof str === 'undefined' ? 'null' : str); - } - partial = '[' + partial.join(',') + ']'; - } else { - var keys = Object.keys(value); - for (var i = 0, length = keys.length; i < length; i++) { - var key = keys[i], str = Str(key, value, stack); - if (typeof str !== "undefined") { - partial.push(key.inspect(true)+ ':' + str); - } - } - partial = '{' + partial.join(',') + '}'; - } - stack.pop(); - return partial; - } - } - - function stringify(object) { - return JSON.stringify(object); - } - - function toQueryString(object) { - return $H(object).toQueryString(); - } - - function toHTML(object) { - return object && object.toHTML ? object.toHTML() : String.interpret(object); - } - - function keys(object) { - if (Type(object) !== OBJECT_TYPE) { throw new TypeError(); } - var results = []; - for (var property in object) { - if (_hasOwnProperty.call(object, property)) - results.push(property); - } - - if (IS_DONTENUM_BUGGY) { - for (var i = 0; property = DONT_ENUMS[i]; i++) { - if (_hasOwnProperty.call(object, property)) - results.push(property); - } - } - - return results; - } - - function values(object) { - var results = []; - for (var property in object) - results.push(object[property]); - return results; - } - - function clone(object) { - return extend({ }, object); - } - - function isElement(object) { - return !!(object && object.nodeType == 1); - } - - function isArray(object) { - return _toString.call(object) === ARRAY_CLASS; - } - - var hasNativeIsArray = (typeof Array.isArray == 'function') - && Array.isArray([]) && !Array.isArray({}); - - if (hasNativeIsArray) { - isArray = Array.isArray; - } - - function isHash(object) { - return object instanceof Hash; - } - - function isFunction(object) { - return _toString.call(object) === FUNCTION_CLASS; - } - - function isString(object) { - return _toString.call(object) === STRING_CLASS; - } - - function isNumber(object) { - return _toString.call(object) === NUMBER_CLASS; - } - - function isDate(object) { - return _toString.call(object) === DATE_CLASS; - } - - function isUndefined(object) { - return typeof object === "undefined"; - } - - extend(Object, { - extend: extend, - inspect: inspect, - toJSON: NATIVE_JSON_STRINGIFY_SUPPORT ? stringify : toJSON, - toQueryString: toQueryString, - toHTML: toHTML, - keys: Object.keys || keys, - values: values, - clone: clone, - isElement: isElement, - isArray: isArray, - isHash: isHash, - isFunction: isFunction, - isString: isString, - isNumber: isNumber, - isDate: isDate, - isUndefined: isUndefined - }); -})(); -Object.extend(Function.prototype, (function() { - var slice = Array.prototype.slice; - - function update(array, args) { - var arrayLength = array.length, length = args.length; - while (length--) array[arrayLength + length] = args[length]; - return array; - } - - function merge(array, args) { - array = slice.call(array, 0); - return update(array, args); - } - - function argumentNames() { - var names = this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1] - .replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g, '') - .replace(/\s+/g, '').split(','); - return names.length == 1 && !names[0] ? [] : names; - } - - - function bind(context) { - if (arguments.length < 2 && Object.isUndefined(arguments[0])) - return this; - - if (!Object.isFunction(this)) - throw new TypeError("The object is not callable."); - - var nop = function() {}; - var __method = this, args = slice.call(arguments, 1); - - var bound = function() { - var a = merge(args, arguments); - var c = this instanceof bound ? this : context; - return __method.apply(c, a); - }; - - nop.prototype = this.prototype; - bound.prototype = new nop(); - - return bound; - } - - function bindAsEventListener(context) { - var __method = this, args = slice.call(arguments, 1); - return function(event) { - var a = update([event || window.event], args); - return __method.apply(context, a); - } - } - - function curry() { - if (!arguments.length) return this; - var __method = this, args = slice.call(arguments, 0); - return function() { - var a = merge(args, arguments); - return __method.apply(this, a); - } - } - - function delay(timeout) { - var __method = this, args = slice.call(arguments, 1); - timeout = timeout * 1000; - return window.setTimeout(function() { - return __method.apply(__method, args); - }, timeout); - } - - function defer() { - var args = update([0.01], arguments); - return this.delay.apply(this, args); - } - - function wrap(wrapper) { - var __method = this; - return function() { - var a = update([__method.bind(this)], arguments); - return wrapper.apply(this, a); - } - } - - function methodize() { - if (this._methodized) return this._methodized; - var __method = this; - return this._methodized = function() { - var a = update([this], arguments); - return __method.apply(null, a); - }; - } - - var extensions = { - argumentNames: argumentNames, - bindAsEventListener: bindAsEventListener, - curry: curry, - delay: delay, - defer: defer, - wrap: wrap, - methodize: methodize - }; - - if (!Function.prototype.bind) - extensions.bind = bind; - - return extensions; -})()); - - - -(function(proto) { - - - function toISOString() { - return this.getUTCFullYear() + '-' + - (this.getUTCMonth() + 1).toPaddedString(2) + '-' + - this.getUTCDate().toPaddedString(2) + 'T' + - this.getUTCHours().toPaddedString(2) + ':' + - this.getUTCMinutes().toPaddedString(2) + ':' + - this.getUTCSeconds().toPaddedString(2) + 'Z'; - } - - - function toJSON() { - return this.toISOString(); - } - - if (!proto.toISOString) proto.toISOString = toISOString; - if (!proto.toJSON) proto.toJSON = toJSON; - -})(Date.prototype); - - -RegExp.prototype.match = RegExp.prototype.test; - -RegExp.escape = function(str) { - return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1'); -}; -var PeriodicalExecuter = Class.create({ - initialize: function(callback, frequency) { - this.callback = callback; - this.frequency = frequency; - this.currentlyExecuting = false; - - this.registerCallback(); - }, - - registerCallback: function() { - this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); - }, - - execute: function() { - this.callback(this); - }, - - stop: function() { - if (!this.timer) return; - clearInterval(this.timer); - this.timer = null; - }, - - onTimerEvent: function() { - if (!this.currentlyExecuting) { - try { - this.currentlyExecuting = true; - this.execute(); - this.currentlyExecuting = false; - } catch(e) { - this.currentlyExecuting = false; - throw e; - } - } - } -}); -Object.extend(String, { - interpret: function(value) { - return value == null ? '' : String(value); - }, - specialChar: { - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - '\\': '\\\\' - } -}); - -Object.extend(String.prototype, (function() { - var NATIVE_JSON_PARSE_SUPPORT = window.JSON && - typeof JSON.parse === 'function' && - JSON.parse('{"test": true}').test; - - function prepareReplacement(replacement) { - if (Object.isFunction(replacement)) return replacement; - var template = new Template(replacement); - return function(match) { return template.evaluate(match) }; - } - - function isNonEmptyRegExp(regexp) { - return regexp.source && regexp.source !== '(?:)'; - } - - - function gsub(pattern, replacement) { - var result = '', source = this, match; - replacement = prepareReplacement(replacement); - - if (Object.isString(pattern)) - pattern = RegExp.escape(pattern); - - if (!(pattern.length || isNonEmptyRegExp(pattern))) { - replacement = replacement(''); - return replacement + source.split('').join(replacement) + replacement; - } - - while (source.length > 0) { - match = source.match(pattern) - if (match && match[0].length > 0) { - result += source.slice(0, match.index); - result += String.interpret(replacement(match)); - source = source.slice(match.index + match[0].length); - } else { - result += source, source = ''; - } - } - return result; - } - - function sub(pattern, replacement, count) { - replacement = prepareReplacement(replacement); - count = Object.isUndefined(count) ? 1 : count; - - return this.gsub(pattern, function(match) { - if (--count < 0) return match[0]; - return replacement(match); - }); - } - - function scan(pattern, iterator) { - this.gsub(pattern, iterator); - return String(this); - } - - function truncate(length, truncation) { - length = length || 30; - truncation = Object.isUndefined(truncation) ? '...' : truncation; - return this.length > length ? - this.slice(0, length - truncation.length) + truncation : String(this); - } - - function strip() { - return this.replace(/^\s+/, '').replace(/\s+$/, ''); - } - - function stripTags() { - return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi, ''); - } - - function stripScripts() { - return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); - } - - function extractScripts() { - var matchAll = new RegExp(Prototype.ScriptFragment, 'img'), - matchOne = new RegExp(Prototype.ScriptFragment, 'im'); - return (this.match(matchAll) || []).map(function(scriptTag) { - return (scriptTag.match(matchOne) || ['', ''])[1]; - }); - } - - function evalScripts() { - return this.extractScripts().map(function(script) { return eval(script); }); - } - - function escapeHTML() { - return this.replace(/&/g,'&').replace(//g,'>'); - } - - function unescapeHTML() { - return this.stripTags().replace(/</g,'<').replace(/>/g,'>').replace(/&/g,'&'); - } - - - function toQueryParams(separator) { - var match = this.strip().match(/([^?#]*)(#.*)?$/); - if (!match) return { }; - - return match[1].split(separator || '&').inject({ }, function(hash, pair) { - if ((pair = pair.split('='))[0]) { - var key = decodeURIComponent(pair.shift()), - value = pair.length > 1 ? pair.join('=') : pair[0]; - - if (value != undefined) { - value = value.gsub('+', ' '); - value = decodeURIComponent(value); - } - - if (key in hash) { - if (!Object.isArray(hash[key])) hash[key] = [hash[key]]; - hash[key].push(value); - } - else hash[key] = value; - } - return hash; - }); - } - - function toArray() { - return this.split(''); - } - - function succ() { - return this.slice(0, this.length - 1) + - String.fromCharCode(this.charCodeAt(this.length - 1) + 1); - } - - function times(count) { - return count < 1 ? '' : new Array(count + 1).join(this); - } - - function camelize() { - return this.replace(/-+(.)?/g, function(match, chr) { - return chr ? chr.toUpperCase() : ''; - }); - } - - function capitalize() { - return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); - } - - function underscore() { - return this.replace(/::/g, '/') - .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2') - .replace(/([a-z\d])([A-Z])/g, '$1_$2') - .replace(/-/g, '_') - .toLowerCase(); - } - - function dasherize() { - return this.replace(/_/g, '-'); - } - - function inspect(useDoubleQuotes) { - var escapedString = this.replace(/[\x00-\x1f\\]/g, function(character) { - if (character in String.specialChar) { - return String.specialChar[character]; - } - return '\\u00' + character.charCodeAt().toPaddedString(2, 16); - }); - if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"'; - return "'" + escapedString.replace(/'/g, '\\\'') + "'"; - } - - function unfilterJSON(filter) { - return this.replace(filter || Prototype.JSONFilter, '$1'); - } - - function isJSON() { - var str = this; - if (str.blank()) return false; - str = str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@'); - str = str.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'); - str = str.replace(/(?:^|:|,)(?:\s*\[)+/g, ''); - return (/^[\],:{}\s]*$/).test(str); - } - - function evalJSON(sanitize) { - var json = this.unfilterJSON(), - cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; - if (cx.test(json)) { - json = json.replace(cx, function (a) { - return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }); - } - try { - if (!sanitize || json.isJSON()) return eval('(' + json + ')'); - } catch (e) { } - throw new SyntaxError('Badly formed JSON string: ' + this.inspect()); - } - - function parseJSON() { - var json = this.unfilterJSON(); - return JSON.parse(json); - } - - function include(pattern) { - return this.indexOf(pattern) > -1; - } - - function startsWith(pattern, position) { - position = Object.isNumber(position) ? position : 0; - return this.lastIndexOf(pattern, position) === position; - } - - function endsWith(pattern, position) { - pattern = String(pattern); - position = Object.isNumber(position) ? position : this.length; - if (position < 0) position = 0; - if (position > this.length) position = this.length; - var d = position - pattern.length; - return d >= 0 && this.indexOf(pattern, d) === d; - } - - function empty() { - return this == ''; - } - - function blank() { - return /^\s*$/.test(this); - } - - function interpolate(object, pattern) { - return new Template(this, pattern).evaluate(object); - } - - return { - gsub: gsub, - sub: sub, - scan: scan, - truncate: truncate, - strip: String.prototype.trim || strip, - stripTags: stripTags, - stripScripts: stripScripts, - extractScripts: extractScripts, - evalScripts: evalScripts, - escapeHTML: escapeHTML, - unescapeHTML: unescapeHTML, - toQueryParams: toQueryParams, - parseQuery: toQueryParams, - toArray: toArray, - succ: succ, - times: times, - camelize: camelize, - capitalize: capitalize, - underscore: underscore, - dasherize: dasherize, - inspect: inspect, - unfilterJSON: unfilterJSON, - isJSON: isJSON, - evalJSON: NATIVE_JSON_PARSE_SUPPORT ? parseJSON : evalJSON, - include: include, - startsWith: String.prototype.startsWith || startsWith, - endsWith: String.prototype.endsWith || endsWith, - empty: empty, - blank: blank, - interpolate: interpolate - }; -})()); - -var Template = Class.create({ - initialize: function(template, pattern) { - this.template = template.toString(); - this.pattern = pattern || Template.Pattern; - }, - - evaluate: function(object) { - if (object && Object.isFunction(object.toTemplateReplacements)) - object = object.toTemplateReplacements(); - - return this.template.gsub(this.pattern, function(match) { - if (object == null) return (match[1] + ''); - - var before = match[1] || ''; - if (before == '\\') return match[2]; - - var ctx = object, expr = match[3], - pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/; - - match = pattern.exec(expr); - if (match == null) return before; - - while (match != null) { - var comp = match[1].startsWith('[') ? match[2].replace(/\\\\]/g, ']') : match[1]; - ctx = ctx[comp]; - if (null == ctx || '' == match[3]) break; - expr = expr.substring('[' == match[3] ? match[1].length : match[0].length); - match = pattern.exec(expr); - } - - return before + String.interpret(ctx); - }); - } -}); -Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; - -var $break = { }; - -var Enumerable = (function() { - function each(iterator, context) { - try { - this._each(iterator, context); - } catch (e) { - if (e != $break) throw e; - } - return this; - } - - function eachSlice(number, iterator, context) { - var index = -number, slices = [], array = this.toArray(); - if (number < 1) return array; - while ((index += number) < array.length) - slices.push(array.slice(index, index+number)); - return slices.collect(iterator, context); - } - - function all(iterator, context) { - iterator = iterator || Prototype.K; - var result = true; - this.each(function(value, index) { - result = result && !!iterator.call(context, value, index, this); - if (!result) throw $break; - }, this); - return result; - } - - function any(iterator, context) { - iterator = iterator || Prototype.K; - var result = false; - this.each(function(value, index) { - if (result = !!iterator.call(context, value, index, this)) - throw $break; - }, this); - return result; - } - - function collect(iterator, context) { - iterator = iterator || Prototype.K; - var results = []; - this.each(function(value, index) { - results.push(iterator.call(context, value, index, this)); - }, this); - return results; - } - - function detect(iterator, context) { - var result; - this.each(function(value, index) { - if (iterator.call(context, value, index, this)) { - result = value; - throw $break; - } - }, this); - return result; - } - - function findAll(iterator, context) { - var results = []; - this.each(function(value, index) { - if (iterator.call(context, value, index, this)) - results.push(value); - }, this); - return results; - } - - function grep(filter, iterator, context) { - iterator = iterator || Prototype.K; - var results = []; - - if (Object.isString(filter)) - filter = new RegExp(RegExp.escape(filter)); - - this.each(function(value, index) { - if (filter.match(value)) - results.push(iterator.call(context, value, index, this)); - }, this); - return results; - } - - function include(object) { - if (Object.isFunction(this.indexOf) && this.indexOf(object) != -1) - return true; - - var found = false; - this.each(function(value) { - if (value == object) { - found = true; - throw $break; - } - }); - return found; - } - - function inGroupsOf(number, fillWith) { - fillWith = Object.isUndefined(fillWith) ? null : fillWith; - return this.eachSlice(number, function(slice) { - while(slice.length < number) slice.push(fillWith); - return slice; - }); - } - - function inject(memo, iterator, context) { - this.each(function(value, index) { - memo = iterator.call(context, memo, value, index, this); - }, this); - return memo; - } - - function invoke(method) { - var args = $A(arguments).slice(1); - return this.map(function(value) { - return value[method].apply(value, args); - }); - } - - function max(iterator, context) { - iterator = iterator || Prototype.K; - var result; - this.each(function(value, index) { - value = iterator.call(context, value, index, this); - if (result == null || value >= result) - result = value; - }, this); - return result; - } - - function min(iterator, context) { - iterator = iterator || Prototype.K; - var result; - this.each(function(value, index) { - value = iterator.call(context, value, index, this); - if (result == null || value < result) - result = value; - }, this); - return result; - } - - function partition(iterator, context) { - iterator = iterator || Prototype.K; - var trues = [], falses = []; - this.each(function(value, index) { - (iterator.call(context, value, index, this) ? - trues : falses).push(value); - }, this); - return [trues, falses]; - } - - function pluck(property) { - var results = []; - this.each(function(value) { - results.push(value[property]); - }); - return results; - } - - function reject(iterator, context) { - var results = []; - this.each(function(value, index) { - if (!iterator.call(context, value, index, this)) - results.push(value); - }, this); - return results; - } - - function sortBy(iterator, context) { - return this.map(function(value, index) { - return { - value: value, - criteria: iterator.call(context, value, index, this) - }; - }, this).sort(function(left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - }).pluck('value'); - } - - function toArray() { - return this.map(); - } - - function zip() { - var iterator = Prototype.K, args = $A(arguments); - if (Object.isFunction(args.last())) - iterator = args.pop(); - - var collections = [this].concat(args).map($A); - return this.map(function(value, index) { - return iterator(collections.pluck(index)); - }); - } - - function size() { - return this.toArray().length; - } - - function inspect() { - return '#'; - } - - - - - - - - - - return { - each: each, - eachSlice: eachSlice, - all: all, - every: all, - any: any, - some: any, - collect: collect, - map: collect, - detect: detect, - findAll: findAll, - select: findAll, - filter: findAll, - grep: grep, - include: include, - member: include, - inGroupsOf: inGroupsOf, - inject: inject, - invoke: invoke, - max: max, - min: min, - partition: partition, - pluck: pluck, - reject: reject, - sortBy: sortBy, - toArray: toArray, - entries: toArray, - zip: zip, - size: size, - inspect: inspect, - find: detect - }; -})(); - -function $A(iterable) { - if (!iterable) return []; - if ('toArray' in Object(iterable)) return iterable.toArray(); - var length = iterable.length || 0, results = new Array(length); - while (length--) results[length] = iterable[length]; - return results; -} - - -function $w(string) { - if (!Object.isString(string)) return []; - string = string.strip(); - return string ? string.split(/\s+/) : []; -} - -Array.from = $A; - - -(function() { - var arrayProto = Array.prototype, - slice = arrayProto.slice, - _each = arrayProto.forEach; // use native browser JS 1.6 implementation if available - - function each(iterator, context) { - for (var i = 0, length = this.length >>> 0; i < length; i++) { - if (i in this) iterator.call(context, this[i], i, this); - } - } - if (!_each) _each = each; - - function clear() { - this.length = 0; - return this; - } - - function first() { - return this[0]; - } - - function last() { - return this[this.length - 1]; - } - - function compact() { - return this.select(function(value) { - return value != null; - }); - } - - function flatten() { - return this.inject([], function(array, value) { - if (Object.isArray(value)) - return array.concat(value.flatten()); - array.push(value); - return array; - }); - } - - function without() { - var values = slice.call(arguments, 0); - return this.select(function(value) { - return !values.include(value); - }); - } - - function reverse(inline) { - return (inline === false ? this.toArray() : this)._reverse(); - } - - function uniq(sorted) { - return this.inject([], function(array, value, index) { - if (0 == index || (sorted ? array.last() != value : !array.include(value))) - array.push(value); - return array; - }); - } - - function intersect(array) { - return this.uniq().findAll(function(item) { - return array.indexOf(item) !== -1; - }); - } - - - function clone() { - return slice.call(this, 0); - } - - function size() { - return this.length; - } - - function inspect() { - return '[' + this.map(Object.inspect).join(', ') + ']'; - } - - function indexOf(item, i) { - if (this == null) throw new TypeError(); - - var array = Object(this), length = array.length >>> 0; - if (length === 0) return -1; - - i = Number(i); - if (isNaN(i)) { - i = 0; - } else if (i !== 0 && isFinite(i)) { - i = (i > 0 ? 1 : -1) * Math.floor(Math.abs(i)); - } - - if (i > length) return -1; - - var k = i >= 0 ? i : Math.max(length - Math.abs(i), 0); - for (; k < length; k++) - if (k in array && array[k] === item) return k; - return -1; - } - - - function lastIndexOf(item, i) { - if (this == null) throw new TypeError(); - - var array = Object(this), length = array.length >>> 0; - if (length === 0) return -1; - - if (!Object.isUndefined(i)) { - i = Number(i); - if (isNaN(i)) { - i = 0; - } else if (i !== 0 && isFinite(i)) { - i = (i > 0 ? 1 : -1) * Math.floor(Math.abs(i)); - } - } else { - i = length; - } - - var k = i >= 0 ? Math.min(i, length - 1) : - length - Math.abs(i); - - for (; k >= 0; k--) - if (k in array && array[k] === item) return k; - return -1; - } - - function concat(_) { - var array = [], items = slice.call(arguments, 0), item, n = 0; - items.unshift(this); - for (var i = 0, length = items.length; i < length; i++) { - item = items[i]; - if (Object.isArray(item) && !('callee' in item)) { - for (var j = 0, arrayLength = item.length; j < arrayLength; j++) { - if (j in item) array[n] = item[j]; - n++; - } - } else { - array[n++] = item; - } - } - array.length = n; - return array; - } - - - function wrapNative(method) { - return function() { - if (arguments.length === 0) { - return method.call(this, Prototype.K); - } else if (arguments[0] === undefined) { - var args = slice.call(arguments, 1); - args.unshift(Prototype.K); - return method.apply(this, args); - } else { - return method.apply(this, arguments); - } - }; - } - - - function map(iterator) { - if (this == null) throw new TypeError(); - iterator = iterator || Prototype.K; - - var object = Object(this); - var results = [], context = arguments[1], n = 0; - - for (var i = 0, length = object.length >>> 0; i < length; i++) { - if (i in object) { - results[n] = iterator.call(context, object[i], i, object); - } - n++; - } - results.length = n; - return results; - } - - if (arrayProto.map) { - map = wrapNative(Array.prototype.map); - } - - function filter(iterator) { - if (this == null || !Object.isFunction(iterator)) - throw new TypeError(); - - var object = Object(this); - var results = [], context = arguments[1], value; - - for (var i = 0, length = object.length >>> 0; i < length; i++) { - if (i in object) { - value = object[i]; - if (iterator.call(context, value, i, object)) { - results.push(value); - } - } - } - return results; - } - - if (arrayProto.filter) { - filter = Array.prototype.filter; - } - - function some(iterator) { - if (this == null) throw new TypeError(); - iterator = iterator || Prototype.K; - var context = arguments[1]; - - var object = Object(this); - for (var i = 0, length = object.length >>> 0; i < length; i++) { - if (i in object && iterator.call(context, object[i], i, object)) { - return true; - } - } - - return false; - } - - if (arrayProto.some) { - var some = wrapNative(Array.prototype.some); - } - - - function every(iterator) { - if (this == null) throw new TypeError(); - iterator = iterator || Prototype.K; - var context = arguments[1]; - - var object = Object(this); - for (var i = 0, length = object.length >>> 0; i < length; i++) { - if (i in object && !iterator.call(context, object[i], i, object)) { - return false; - } - } - - return true; - } - - if (arrayProto.every) { - var every = wrapNative(Array.prototype.every); - } - - var _reduce = arrayProto.reduce; - function inject(memo, iterator) { - iterator = iterator || Prototype.K; - var context = arguments[2]; - return _reduce.call(this, iterator.bind(context), memo); - } - - if (!arrayProto.reduce) { - var inject = Enumerable.inject; - } - - Object.extend(arrayProto, Enumerable); - - if (!arrayProto._reverse) - arrayProto._reverse = arrayProto.reverse; - - Object.extend(arrayProto, { - _each: _each, - - map: map, - collect: map, - select: filter, - filter: filter, - findAll: filter, - some: some, - any: some, - every: every, - all: every, - inject: inject, - - clear: clear, - first: first, - last: last, - compact: compact, - flatten: flatten, - without: without, - reverse: reverse, - uniq: uniq, - intersect: intersect, - clone: clone, - toArray: clone, - size: size, - inspect: inspect - }); - - var CONCAT_ARGUMENTS_BUGGY = (function() { - return [].concat(arguments)[0][0] !== 1; - })(1,2); - - if (CONCAT_ARGUMENTS_BUGGY) arrayProto.concat = concat; - - if (!arrayProto.indexOf) arrayProto.indexOf = indexOf; - if (!arrayProto.lastIndexOf) arrayProto.lastIndexOf = lastIndexOf; -})(); -function $H(object) { - return new Hash(object); -}; - -var Hash = Class.create(Enumerable, (function() { - function initialize(object) { - this._object = Object.isHash(object) ? object.toObject() : Object.clone(object); - } - - - function _each(iterator, context) { - var i = 0; - for (var key in this._object) { - var value = this._object[key], pair = [key, value]; - pair.key = key; - pair.value = value; - iterator.call(context, pair, i); - i++; - } - } - - function set(key, value) { - return this._object[key] = value; - } - - function get(key) { - if (this._object[key] !== Object.prototype[key]) - return this._object[key]; - } - - function unset(key) { - var value = this._object[key]; - delete this._object[key]; - return value; - } - - function toObject() { - return Object.clone(this._object); - } - - - - function keys() { - return this.pluck('key'); - } - - function values() { - return this.pluck('value'); - } - - function index(value) { - var match = this.detect(function(pair) { - return pair.value === value; - }); - return match && match.key; - } - - function merge(object) { - return this.clone().update(object); - } - - function update(object) { - return new Hash(object).inject(this, function(result, pair) { - result.set(pair.key, pair.value); - return result; - }); - } - - function toQueryPair(key, value) { - if (Object.isUndefined(value)) return key; - - value = String.interpret(value); - - value = value.gsub(/(\r)?\n/, '\r\n'); - value = encodeURIComponent(value); - value = value.gsub(/%20/, '+'); - return key + '=' + value; - } - - function toQueryString() { - return this.inject([], function(results, pair) { - var key = encodeURIComponent(pair.key), values = pair.value; - - if (values && typeof values == 'object') { - if (Object.isArray(values)) { - var queryValues = []; - for (var i = 0, len = values.length, value; i < len; i++) { - value = values[i]; - queryValues.push(toQueryPair(key, value)); - } - return results.concat(queryValues); - } - } else results.push(toQueryPair(key, values)); - return results; - }).join('&'); - } - - function inspect() { - return '#'; - } - - function clone() { - return new Hash(this); - } - - return { - initialize: initialize, - _each: _each, - set: set, - get: get, - unset: unset, - toObject: toObject, - toTemplateReplacements: toObject, - keys: keys, - values: values, - index: index, - merge: merge, - update: update, - toQueryString: toQueryString, - inspect: inspect, - toJSON: toObject, - clone: clone - }; -})()); - -Hash.from = $H; -Object.extend(Number.prototype, (function() { - function toColorPart() { - return this.toPaddedString(2, 16); - } - - function succ() { - return this + 1; - } - - function times(iterator, context) { - $R(0, this, true).each(iterator, context); - return this; - } - - function toPaddedString(length, radix) { - var string = this.toString(radix || 10); - return '0'.times(length - string.length) + string; - } - - function abs() { - return Math.abs(this); - } - - function round() { - return Math.round(this); - } - - function ceil() { - return Math.ceil(this); - } - - function floor() { - return Math.floor(this); - } - - return { - toColorPart: toColorPart, - succ: succ, - times: times, - toPaddedString: toPaddedString, - abs: abs, - round: round, - ceil: ceil, - floor: floor - }; -})()); - -function $R(start, end, exclusive) { - return new ObjectRange(start, end, exclusive); -} - -var ObjectRange = Class.create(Enumerable, (function() { - function initialize(start, end, exclusive) { - this.start = start; - this.end = end; - this.exclusive = exclusive; - } - - function _each(iterator, context) { - var value = this.start, i; - for (i = 0; this.include(value); i++) { - iterator.call(context, value, i); - value = value.succ(); - } - } - - function include(value) { - if (value < this.start) - return false; - if (this.exclusive) - return value < this.end; - return value <= this.end; - } - - return { - initialize: initialize, - _each: _each, - include: include - }; -})()); - - - -var Abstract = { }; - - -var Try = { - these: function() { - var returnValue; - - for (var i = 0, length = arguments.length; i < length; i++) { - var lambda = arguments[i]; - try { - returnValue = lambda(); - break; - } catch (e) { } - } - - return returnValue; - } -}; - -var Ajax = { - getTransport: function() { - return Try.these( - function() {return new XMLHttpRequest()}, - function() {return new ActiveXObject('Msxml2.XMLHTTP')}, - function() {return new ActiveXObject('Microsoft.XMLHTTP')} - ) || false; - }, - - activeRequestCount: 0 -}; - -Ajax.Responders = { - responders: [], - - _each: function(iterator, context) { - this.responders._each(iterator, context); - }, - - register: function(responder) { - if (!this.include(responder)) - this.responders.push(responder); - }, - - unregister: function(responder) { - this.responders = this.responders.without(responder); - }, - - dispatch: function(callback, request, transport, json) { - this.each(function(responder) { - if (Object.isFunction(responder[callback])) { - try { - responder[callback].apply(responder, [request, transport, json]); - } catch (e) { } - } - }); - } -}; - -Object.extend(Ajax.Responders, Enumerable); - -Ajax.Responders.register({ - onCreate: function() { Ajax.activeRequestCount++ }, - onComplete: function() { Ajax.activeRequestCount-- } -}); -Ajax.Base = Class.create({ - initialize: function(options) { - this.options = { - method: 'post', - asynchronous: true, - contentType: 'application/x-www-form-urlencoded', - encoding: 'UTF-8', - parameters: '', - evalJSON: true, - evalJS: true - }; - Object.extend(this.options, options || { }); - - this.options.method = this.options.method.toLowerCase(); - - if (Object.isHash(this.options.parameters)) - this.options.parameters = this.options.parameters.toObject(); - } -}); -Ajax.Request = Class.create(Ajax.Base, { - _complete: false, - - initialize: function($super, url, options) { - $super(options); - this.transport = Ajax.getTransport(); - this.request(url); - }, - - request: function(url) { - this.url = url; - this.method = this.options.method; - var params = Object.isString(this.options.parameters) ? - this.options.parameters : - Object.toQueryString(this.options.parameters); - - if (!['get', 'post'].include(this.method)) { - params += (params ? '&' : '') + "_method=" + this.method; - this.method = 'post'; - } - - if (params && this.method === 'get') { - this.url += (this.url.include('?') ? '&' : '?') + params; - } - - this.parameters = params.toQueryParams(); - - try { - var response = new Ajax.Response(this); - if (this.options.onCreate) this.options.onCreate(response); - Ajax.Responders.dispatch('onCreate', this, response); - - this.transport.open(this.method.toUpperCase(), this.url, - this.options.asynchronous); - - if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1); - - this.transport.onreadystatechange = this.onStateChange.bind(this); - this.setRequestHeaders(); - - this.body = this.method == 'post' ? (this.options.postBody || params) : null; - this.transport.send(this.body); - - /* Force Firefox to handle ready state 4 for synchronous requests */ - if (!this.options.asynchronous && this.transport.overrideMimeType) - this.onStateChange(); - - } - catch (e) { - this.dispatchException(e); - } - }, - - onStateChange: function() { - var readyState = this.transport.readyState; - if (readyState > 1 && !((readyState == 4) && this._complete)) - this.respondToReadyState(this.transport.readyState); - }, - - setRequestHeaders: function() { - var headers = { - 'X-Requested-With': 'XMLHttpRequest', - 'X-Prototype-Version': Prototype.Version, - 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' - }; - - if (this.method == 'post') { - headers['Content-type'] = this.options.contentType + - (this.options.encoding ? '; charset=' + this.options.encoding : ''); - - /* Force "Connection: close" for older Mozilla browsers to work - * around a bug where XMLHttpRequest sends an incorrect - * Content-length header. See Mozilla Bugzilla #246651. - */ - if (this.transport.overrideMimeType && - (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) - headers['Connection'] = 'close'; - } - - if (typeof this.options.requestHeaders == 'object') { - var extras = this.options.requestHeaders; - - if (Object.isFunction(extras.push)) - for (var i = 0, length = extras.length; i < length; i += 2) - headers[extras[i]] = extras[i+1]; - else - $H(extras).each(function(pair) { headers[pair.key] = pair.value }); - } - - for (var name in headers) - if (headers[name] != null) - this.transport.setRequestHeader(name, headers[name]); - }, - - success: function() { - var status = this.getStatus(); - return !status || (status >= 200 && status < 300) || status == 304; - }, - - getStatus: function() { - try { - if (this.transport.status === 1223) return 204; - return this.transport.status || 0; - } catch (e) { return 0 } - }, - - respondToReadyState: function(readyState) { - var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this); - - if (state == 'Complete') { - try { - this._complete = true; - (this.options['on' + response.status] - || this.options['on' + (this.success() ? 'Success' : 'Failure')] - || Prototype.emptyFunction)(response, response.headerJSON); - } catch (e) { - this.dispatchException(e); - } - - var contentType = response.getHeader('Content-type'); - if (this.options.evalJS == 'force' - || (this.options.evalJS && this.isSameOrigin() && contentType - && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))) - this.evalResponse(); - } - - try { - (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON); - Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON); - } catch (e) { - this.dispatchException(e); - } - - if (state == 'Complete') { - this.transport.onreadystatechange = Prototype.emptyFunction; - } - }, - - isSameOrigin: function() { - var m = this.url.match(/^\s*https?:\/\/[^\/]*/); - return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({ - protocol: location.protocol, - domain: document.domain, - port: location.port ? ':' + location.port : '' - })); - }, - - getHeader: function(name) { - try { - return this.transport.getResponseHeader(name) || null; - } catch (e) { return null; } - }, - - evalResponse: function() { - try { - return eval((this.transport.responseText || '').unfilterJSON()); - } catch (e) { - this.dispatchException(e); - } - }, - - dispatchException: function(exception) { - (this.options.onException || Prototype.emptyFunction)(this, exception); - Ajax.Responders.dispatch('onException', this, exception); - } -}); - -Ajax.Request.Events = - ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; - - - - - - - - -Ajax.Response = Class.create({ - initialize: function(request){ - this.request = request; - var transport = this.transport = request.transport, - readyState = this.readyState = transport.readyState; - - if ((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) { - this.status = this.getStatus(); - this.statusText = this.getStatusText(); - this.responseText = String.interpret(transport.responseText); - this.headerJSON = this._getHeaderJSON(); - } - - if (readyState == 4) { - var xml = transport.responseXML; - this.responseXML = Object.isUndefined(xml) ? null : xml; - this.responseJSON = this._getResponseJSON(); - } - }, - - status: 0, - - statusText: '', - - getStatus: Ajax.Request.prototype.getStatus, - - getStatusText: function() { - try { - return this.transport.statusText || ''; - } catch (e) { return '' } - }, - - getHeader: Ajax.Request.prototype.getHeader, - - getAllHeaders: function() { - try { - return this.getAllResponseHeaders(); - } catch (e) { return null } - }, - - getResponseHeader: function(name) { - return this.transport.getResponseHeader(name); - }, - - getAllResponseHeaders: function() { - return this.transport.getAllResponseHeaders(); - }, - - _getHeaderJSON: function() { - var json = this.getHeader('X-JSON'); - if (!json) return null; - - try { - json = decodeURIComponent(escape(json)); - } catch(e) { - } - - try { - return json.evalJSON(this.request.options.sanitizeJSON || - !this.request.isSameOrigin()); - } catch (e) { - this.request.dispatchException(e); - } - }, - - _getResponseJSON: function() { - var options = this.request.options; - if (!options.evalJSON || (options.evalJSON != 'force' && - !(this.getHeader('Content-type') || '').include('application/json')) || - this.responseText.blank()) - return null; - try { - return this.responseText.evalJSON(options.sanitizeJSON || - !this.request.isSameOrigin()); - } catch (e) { - this.request.dispatchException(e); - } - } -}); - -Ajax.Updater = Class.create(Ajax.Request, { - initialize: function($super, container, url, options) { - this.container = { - success: (container.success || container), - failure: (container.failure || (container.success ? null : container)) - }; - - options = Object.clone(options); - var onComplete = options.onComplete; - options.onComplete = (function(response, json) { - this.updateContent(response.responseText); - if (Object.isFunction(onComplete)) onComplete(response, json); - }).bind(this); - - $super(url, options); - }, - - updateContent: function(responseText) { - var receiver = this.container[this.success() ? 'success' : 'failure'], - options = this.options; - - if (!options.evalScripts) responseText = responseText.stripScripts(); - - if (receiver = $(receiver)) { - if (options.insertion) { - if (Object.isString(options.insertion)) { - var insertion = { }; insertion[options.insertion] = responseText; - receiver.insert(insertion); - } - else options.insertion(receiver, responseText); - } - else receiver.update(responseText); - } - } -}); - -Ajax.PeriodicalUpdater = Class.create(Ajax.Base, { - initialize: function($super, container, url, options) { - $super(options); - this.onComplete = this.options.onComplete; - - this.frequency = (this.options.frequency || 2); - this.decay = (this.options.decay || 1); - - this.updater = { }; - this.container = container; - this.url = url; - - this.start(); - }, - - start: function() { - this.options.onComplete = this.updateComplete.bind(this); - this.onTimerEvent(); - }, - - stop: function() { - this.updater.options.onComplete = undefined; - clearTimeout(this.timer); - (this.onComplete || Prototype.emptyFunction).apply(this, arguments); - }, - - updateComplete: function(response) { - if (this.options.decay) { - this.decay = (response.responseText == this.lastText ? - this.decay * this.options.decay : 1); - - this.lastText = response.responseText; - } - this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency); - }, - - onTimerEvent: function() { - this.updater = new Ajax.Updater(this.container, this.url, this.options); - } -}); - -(function(GLOBAL) { - - var UNDEFINED; - var SLICE = Array.prototype.slice; - - var DIV = document.createElement('div'); - - - function $(element) { - if (arguments.length > 1) { - for (var i = 0, elements = [], length = arguments.length; i < length; i++) - elements.push($(arguments[i])); - return elements; - } - - if (Object.isString(element)) - element = document.getElementById(element); - return Element.extend(element); - } - - GLOBAL.$ = $; - - - if (!GLOBAL.Node) GLOBAL.Node = {}; - - if (!GLOBAL.Node.ELEMENT_NODE) { - Object.extend(GLOBAL.Node, { - ELEMENT_NODE: 1, - ATTRIBUTE_NODE: 2, - TEXT_NODE: 3, - CDATA_SECTION_NODE: 4, - ENTITY_REFERENCE_NODE: 5, - ENTITY_NODE: 6, - PROCESSING_INSTRUCTION_NODE: 7, - COMMENT_NODE: 8, - DOCUMENT_NODE: 9, - DOCUMENT_TYPE_NODE: 10, - DOCUMENT_FRAGMENT_NODE: 11, - NOTATION_NODE: 12 - }); - } - - var ELEMENT_CACHE = {}; - - function shouldUseCreationCache(tagName, attributes) { - if (tagName === 'select') return false; - if ('type' in attributes) return false; - return true; - } - - var HAS_EXTENDED_CREATE_ELEMENT_SYNTAX = (function(){ - try { - var el = document.createElement(''); - return el.tagName.toLowerCase() === 'input' && el.name === 'x'; - } - catch(err) { - return false; - } - })(); - - - var oldElement = GLOBAL.Element; - function Element(tagName, attributes) { - attributes = attributes || {}; - tagName = tagName.toLowerCase(); - - if (HAS_EXTENDED_CREATE_ELEMENT_SYNTAX && attributes.name) { - tagName = '<' + tagName + ' name="' + attributes.name + '">'; - delete attributes.name; - return Element.writeAttribute(document.createElement(tagName), attributes); - } - - if (!ELEMENT_CACHE[tagName]) - ELEMENT_CACHE[tagName] = Element.extend(document.createElement(tagName)); - - var node = shouldUseCreationCache(tagName, attributes) ? - ELEMENT_CACHE[tagName].cloneNode(false) : document.createElement(tagName); - - return Element.writeAttribute(node, attributes); - } - - GLOBAL.Element = Element; - - Object.extend(GLOBAL.Element, oldElement || {}); - if (oldElement) GLOBAL.Element.prototype = oldElement.prototype; - - Element.Methods = { ByTag: {}, Simulated: {} }; - - var methods = {}; - - var INSPECT_ATTRIBUTES = { id: 'id', className: 'class' }; - function inspect(element) { - element = $(element); - var result = '<' + element.tagName.toLowerCase(); - - var attribute, value; - for (var property in INSPECT_ATTRIBUTES) { - attribute = INSPECT_ATTRIBUTES[property]; - value = (element[property] || '').toString(); - if (value) result += ' ' + attribute + '=' + value.inspect(true); - } - - return result + '>'; - } - - methods.inspect = inspect; - - - function visible(element) { - return $(element).style.display !== 'none'; - } - - function toggle(element, bool) { - element = $(element); - if (Object.isUndefined(bool)) - bool = !Element.visible(element); - Element[bool ? 'show' : 'hide'](element); - - return element; - } - - function hide(element) { - element = $(element); - element.style.display = 'none'; - return element; - } - - function show(element) { - element = $(element); - element.style.display = ''; - return element; - } - - - Object.extend(methods, { - visible: visible, - toggle: toggle, - hide: hide, - show: show - }); - - - function remove(element) { - element = $(element); - element.parentNode.removeChild(element); - return element; - } - - var SELECT_ELEMENT_INNERHTML_BUGGY = (function(){ - var el = document.createElement("select"), - isBuggy = true; - el.innerHTML = ""; - if (el.options && el.options[0]) { - isBuggy = el.options[0].nodeName.toUpperCase() !== "OPTION"; - } - el = null; - return isBuggy; - })(); - - var TABLE_ELEMENT_INNERHTML_BUGGY = (function(){ - try { - var el = document.createElement("table"); - if (el && el.tBodies) { - el.innerHTML = "
    "; - var isBuggy = typeof el.tBodies[0] == "undefined"; - el = null; - return isBuggy; - } - } catch (e) { - return true; - } - })(); - - var LINK_ELEMENT_INNERHTML_BUGGY = (function() { - try { - var el = document.createElement('div'); - el.innerHTML = ""; - var isBuggy = (el.childNodes.length === 0); - el = null; - return isBuggy; - } catch(e) { - return true; - } - })(); - - var ANY_INNERHTML_BUGGY = SELECT_ELEMENT_INNERHTML_BUGGY || - TABLE_ELEMENT_INNERHTML_BUGGY || LINK_ELEMENT_INNERHTML_BUGGY; - - var SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING = (function () { - var s = document.createElement("script"), - isBuggy = false; - try { - s.appendChild(document.createTextNode("")); - isBuggy = !s.firstChild || - s.firstChild && s.firstChild.nodeType !== 3; - } catch (e) { - isBuggy = true; - } - s = null; - return isBuggy; - })(); - - function update(element, content) { - element = $(element); - - var descendants = element.getElementsByTagName('*'), - i = descendants.length; - while (i--) purgeElement(descendants[i]); - - if (content && content.toElement) - content = content.toElement(); - - if (Object.isElement(content)) - return element.update().insert(content); - - - content = Object.toHTML(content); - var tagName = element.tagName.toUpperCase(); - - if (tagName === 'SCRIPT' && SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING) { - element.text = content; - return element; - } - - if (ANY_INNERHTML_BUGGY) { - if (tagName in INSERTION_TRANSLATIONS.tags) { - while (element.firstChild) - element.removeChild(element.firstChild); - - var nodes = getContentFromAnonymousElement(tagName, content.stripScripts()); - for (var i = 0, node; node = nodes[i]; i++) - element.appendChild(node); - - } else if (LINK_ELEMENT_INNERHTML_BUGGY && Object.isString(content) && content.indexOf(' -1) { - while (element.firstChild) - element.removeChild(element.firstChild); - - var nodes = getContentFromAnonymousElement(tagName, - content.stripScripts(), true); - - for (var i = 0, node; node = nodes[i]; i++) - element.appendChild(node); - } else { - element.innerHTML = content.stripScripts(); - } - } else { - element.innerHTML = content.stripScripts(); - } - - content.evalScripts.bind(content).defer(); - return element; - } - - function replace(element, content) { - element = $(element); - - if (content && content.toElement) { - content = content.toElement(); - } else if (!Object.isElement(content)) { - content = Object.toHTML(content); - var range = element.ownerDocument.createRange(); - range.selectNode(element); - content.evalScripts.bind(content).defer(); - content = range.createContextualFragment(content.stripScripts()); - } - - element.parentNode.replaceChild(content, element); - return element; - } - - var INSERTION_TRANSLATIONS = { - before: function(element, node) { - element.parentNode.insertBefore(node, element); - }, - top: function(element, node) { - element.insertBefore(node, element.firstChild); - }, - bottom: function(element, node) { - element.appendChild(node); - }, - after: function(element, node) { - element.parentNode.insertBefore(node, element.nextSibling); - }, - - tags: { - TABLE: ['
    test
    ', '
    ', 1], - TBODY: ['', '
    ', 2], - TR: ['', '
    ', 3], - TD: ['
    ', '
    ', 4], - SELECT: ['', 1] - } - }; - - var tags = INSERTION_TRANSLATIONS.tags; - - Object.extend(tags, { - THEAD: tags.TBODY, - TFOOT: tags.TBODY, - TH: tags.TD - }); - - function replace_IE(element, content) { - element = $(element); - if (content && content.toElement) - content = content.toElement(); - if (Object.isElement(content)) { - element.parentNode.replaceChild(content, element); - return element; - } - - content = Object.toHTML(content); - var parent = element.parentNode, tagName = parent.tagName.toUpperCase(); - - if (tagName in INSERTION_TRANSLATIONS.tags) { - var nextSibling = Element.next(element); - var fragments = getContentFromAnonymousElement( - tagName, content.stripScripts()); - - parent.removeChild(element); - - var iterator; - if (nextSibling) - iterator = function(node) { parent.insertBefore(node, nextSibling) }; - else - iterator = function(node) { parent.appendChild(node); } - - fragments.each(iterator); - } else { - element.outerHTML = content.stripScripts(); - } - - content.evalScripts.bind(content).defer(); - return element; - } - - if ('outerHTML' in document.documentElement) - replace = replace_IE; - - function isContent(content) { - if (Object.isUndefined(content) || content === null) return false; - - if (Object.isString(content) || Object.isNumber(content)) return true; - if (Object.isElement(content)) return true; - if (content.toElement || content.toHTML) return true; - - return false; - } - - function insertContentAt(element, content, position) { - position = position.toLowerCase(); - var method = INSERTION_TRANSLATIONS[position]; - - if (content && content.toElement) content = content.toElement(); - if (Object.isElement(content)) { - method(element, content); - return element; - } - - content = Object.toHTML(content); - var tagName = ((position === 'before' || position === 'after') ? - element.parentNode : element).tagName.toUpperCase(); - - var childNodes = getContentFromAnonymousElement(tagName, content.stripScripts()); - - if (position === 'top' || position === 'after') childNodes.reverse(); - - for (var i = 0, node; node = childNodes[i]; i++) - method(element, node); - - content.evalScripts.bind(content).defer(); - } - - function insert(element, insertions) { - element = $(element); - - if (isContent(insertions)) - insertions = { bottom: insertions }; - - for (var position in insertions) - insertContentAt(element, insertions[position], position); - - return element; - } - - function wrap(element, wrapper, attributes) { - element = $(element); - - if (Object.isElement(wrapper)) { - $(wrapper).writeAttribute(attributes || {}); - } else if (Object.isString(wrapper)) { - wrapper = new Element(wrapper, attributes); - } else { - wrapper = new Element('div', wrapper); - } - - if (element.parentNode) - element.parentNode.replaceChild(wrapper, element); - - wrapper.appendChild(element); - - return wrapper; - } - - function cleanWhitespace(element) { - element = $(element); - var node = element.firstChild; - - while (node) { - var nextNode = node.nextSibling; - if (node.nodeType === Node.TEXT_NODE && !/\S/.test(node.nodeValue)) - element.removeChild(node); - node = nextNode; - } - return element; - } - - function empty(element) { - return $(element).innerHTML.blank(); - } - - function getContentFromAnonymousElement(tagName, html, force) { - var t = INSERTION_TRANSLATIONS.tags[tagName], div = DIV; - - var workaround = !!t; - if (!workaround && force) { - workaround = true; - t = ['', '', 0]; - } - - if (workaround) { - div.innerHTML = ' ' + t[0] + html + t[1]; - div.removeChild(div.firstChild); - for (var i = t[2]; i--; ) - div = div.firstChild; - } else { - div.innerHTML = html; - } - - return $A(div.childNodes); - } - - function clone(element, deep) { - if (!(element = $(element))) return; - var clone = element.cloneNode(deep); - if (!HAS_UNIQUE_ID_PROPERTY) { - clone._prototypeUID = UNDEFINED; - if (deep) { - var descendants = Element.select(clone, '*'), - i = descendants.length; - while (i--) - descendants[i]._prototypeUID = UNDEFINED; - } - } - return Element.extend(clone); - } - - function purgeElement(element) { - var uid = getUniqueElementID(element); - if (uid) { - Element.stopObserving(element); - if (!HAS_UNIQUE_ID_PROPERTY) - element._prototypeUID = UNDEFINED; - delete Element.Storage[uid]; - } - } - - function purgeCollection(elements) { - var i = elements.length; - while (i--) - purgeElement(elements[i]); - } - - function purgeCollection_IE(elements) { - var i = elements.length, element, uid; - while (i--) { - element = elements[i]; - uid = getUniqueElementID(element); - delete Element.Storage[uid]; - delete Event.cache[uid]; - } - } - - if (HAS_UNIQUE_ID_PROPERTY) { - purgeCollection = purgeCollection_IE; - } - - - function purge(element) { - if (!(element = $(element))) return; - purgeElement(element); - - var descendants = element.getElementsByTagName('*'), - i = descendants.length; - - while (i--) purgeElement(descendants[i]); - - return null; - } - - Object.extend(methods, { - remove: remove, - update: update, - replace: replace, - insert: insert, - wrap: wrap, - cleanWhitespace: cleanWhitespace, - empty: empty, - clone: clone, - purge: purge - }); - - - - function recursivelyCollect(element, property, maximumLength) { - element = $(element); - maximumLength = maximumLength || -1; - var elements = []; - - while (element = element[property]) { - if (element.nodeType === Node.ELEMENT_NODE) - elements.push(Element.extend(element)); - - if (elements.length === maximumLength) break; - } - - return elements; - } - - - function ancestors(element) { - return recursivelyCollect(element, 'parentNode'); - } - - function descendants(element) { - return Element.select(element, '*'); - } - - function firstDescendant(element) { - element = $(element).firstChild; - while (element && element.nodeType !== Node.ELEMENT_NODE) - element = element.nextSibling; - - return $(element); - } - - function immediateDescendants(element) { - var results = [], child = $(element).firstChild; - - while (child) { - if (child.nodeType === Node.ELEMENT_NODE) - results.push(Element.extend(child)); - - child = child.nextSibling; - } - - return results; - } - - function previousSiblings(element) { - return recursivelyCollect(element, 'previousSibling'); - } - - function nextSiblings(element) { - return recursivelyCollect(element, 'nextSibling'); - } - - function siblings(element) { - element = $(element); - var previous = previousSiblings(element), - next = nextSiblings(element); - return previous.reverse().concat(next); - } - - function match(element, selector) { - element = $(element); - - if (Object.isString(selector)) - return Prototype.Selector.match(element, selector); - - return selector.match(element); - } - - - function _recursivelyFind(element, property, expression, index) { - element = $(element), expression = expression || 0, index = index || 0; - if (Object.isNumber(expression)) { - index = expression, expression = null; - } - - while (element = element[property]) { - if (element.nodeType !== 1) continue; - if (expression && !Prototype.Selector.match(element, expression)) - continue; - if (--index >= 0) continue; - - return Element.extend(element); - } - } - - - function up(element, expression, index) { - element = $(element); - - if (arguments.length === 1) return $(element.parentNode); - return _recursivelyFind(element, 'parentNode', expression, index); - } - - function down(element, expression, index) { - if (arguments.length === 1) return firstDescendant(element); - element = $(element), expression = expression || 0, index = index || 0; - - if (Object.isNumber(expression)) - index = expression, expression = '*'; - - var node = Prototype.Selector.select(expression, element)[index]; - return Element.extend(node); - } - - function previous(element, expression, index) { - return _recursivelyFind(element, 'previousSibling', expression, index); - } - - function next(element, expression, index) { - return _recursivelyFind(element, 'nextSibling', expression, index); - } - - function select(element) { - element = $(element); - var expressions = SLICE.call(arguments, 1).join(', '); - return Prototype.Selector.select(expressions, element); - } - - function adjacent(element) { - element = $(element); - var expressions = SLICE.call(arguments, 1).join(', '); - var siblings = Element.siblings(element), results = []; - for (var i = 0, sibling; sibling = siblings[i]; i++) { - if (Prototype.Selector.match(sibling, expressions)) - results.push(sibling); - } - - return results; - } - - function descendantOf_DOM(element, ancestor) { - element = $(element), ancestor = $(ancestor); - while (element = element.parentNode) - if (element === ancestor) return true; - return false; - } - - function descendantOf_contains(element, ancestor) { - element = $(element), ancestor = $(ancestor); - if (!ancestor.contains) return descendantOf_DOM(element, ancestor); - return ancestor.contains(element) && ancestor !== element; - } - - function descendantOf_compareDocumentPosition(element, ancestor) { - element = $(element), ancestor = $(ancestor); - return (element.compareDocumentPosition(ancestor) & 8) === 8; - } - - var descendantOf; - if (DIV.compareDocumentPosition) { - descendantOf = descendantOf_compareDocumentPosition; - } else if (DIV.contains) { - descendantOf = descendantOf_contains; - } else { - descendantOf = descendantOf_DOM; - } - - - Object.extend(methods, { - recursivelyCollect: recursivelyCollect, - ancestors: ancestors, - descendants: descendants, - firstDescendant: firstDescendant, - immediateDescendants: immediateDescendants, - previousSiblings: previousSiblings, - nextSiblings: nextSiblings, - siblings: siblings, - match: match, - up: up, - down: down, - previous: previous, - next: next, - select: select, - adjacent: adjacent, - descendantOf: descendantOf, - - getElementsBySelector: select, - - childElements: immediateDescendants - }); - - - var idCounter = 1; - function identify(element) { - element = $(element); - var id = Element.readAttribute(element, 'id'); - if (id) return id; - - do { id = 'anonymous_element_' + idCounter++ } while ($(id)); - - Element.writeAttribute(element, 'id', id); - return id; - } - - - function readAttribute(element, name) { - return $(element).getAttribute(name); - } - - function readAttribute_IE(element, name) { - element = $(element); - - var table = ATTRIBUTE_TRANSLATIONS.read; - if (table.values[name]) - return table.values[name](element, name); - - if (table.names[name]) name = table.names[name]; - - if (name.include(':')) { - if (!element.attributes || !element.attributes[name]) return null; - return element.attributes[name].value; - } - - return element.getAttribute(name); - } - - function readAttribute_Opera(element, name) { - if (name === 'title') return element.title; - return element.getAttribute(name); - } - - var PROBLEMATIC_ATTRIBUTE_READING = (function() { - DIV.setAttribute('onclick', []); - var value = DIV.getAttribute('onclick'); - var isFunction = Object.isArray(value); - DIV.removeAttribute('onclick'); - return isFunction; - })(); - - if (PROBLEMATIC_ATTRIBUTE_READING) { - readAttribute = readAttribute_IE; - } else if (Prototype.Browser.Opera) { - readAttribute = readAttribute_Opera; - } - - - function writeAttribute(element, name, value) { - element = $(element); - var attributes = {}, table = ATTRIBUTE_TRANSLATIONS.write; - - if (typeof name === 'object') { - attributes = name; - } else { - attributes[name] = Object.isUndefined(value) ? true : value; - } - - for (var attr in attributes) { - name = table.names[attr] || attr; - value = attributes[attr]; - if (table.values[attr]) - name = table.values[attr](element, value) || name; - if (value === false || value === null) - element.removeAttribute(name); - else if (value === true) - element.setAttribute(name, name); - else element.setAttribute(name, value); - } - - return element; - } - - var PROBLEMATIC_HAS_ATTRIBUTE_WITH_CHECKBOXES = (function () { - if (!HAS_EXTENDED_CREATE_ELEMENT_SYNTAX) { - return false; - } - var checkbox = document.createElement(''); - checkbox.checked = true; - var node = checkbox.getAttributeNode('checked'); - return !node || !node.specified; - })(); - - function hasAttribute(element, attribute) { - attribute = ATTRIBUTE_TRANSLATIONS.has[attribute] || attribute; - var node = $(element).getAttributeNode(attribute); - return !!(node && node.specified); - } - - function hasAttribute_IE(element, attribute) { - if (attribute === 'checked') { - return element.checked; - } - return hasAttribute(element, attribute); - } - - GLOBAL.Element.Methods.Simulated.hasAttribute = - PROBLEMATIC_HAS_ATTRIBUTE_WITH_CHECKBOXES ? - hasAttribute_IE : hasAttribute; - - function classNames(element) { - return new Element.ClassNames(element); - } - - var regExpCache = {}; - function getRegExpForClassName(className) { - if (regExpCache[className]) return regExpCache[className]; - - var re = new RegExp("(^|\\s+)" + className + "(\\s+|$)"); - regExpCache[className] = re; - return re; - } - - function hasClassName(element, className) { - if (!(element = $(element))) return; - - var elementClassName = element.className; - - if (elementClassName.length === 0) return false; - if (elementClassName === className) return true; - - return getRegExpForClassName(className).test(elementClassName); - } - - function addClassName(element, className) { - if (!(element = $(element))) return; - - if (!hasClassName(element, className)) - element.className += (element.className ? ' ' : '') + className; - - return element; - } - - function removeClassName(element, className) { - if (!(element = $(element))) return; - - element.className = element.className.replace( - getRegExpForClassName(className), ' ').strip(); - - return element; - } - - function toggleClassName(element, className, bool) { - if (!(element = $(element))) return; - - if (Object.isUndefined(bool)) - bool = !hasClassName(element, className); - - var method = Element[bool ? 'addClassName' : 'removeClassName']; - return method(element, className); - } - - var ATTRIBUTE_TRANSLATIONS = {}; - - var classProp = 'className', forProp = 'for'; - - DIV.setAttribute(classProp, 'x'); - if (DIV.className !== 'x') { - DIV.setAttribute('class', 'x'); - if (DIV.className === 'x') - classProp = 'class'; - } - - var LABEL = document.createElement('label'); - LABEL.setAttribute(forProp, 'x'); - if (LABEL.htmlFor !== 'x') { - LABEL.setAttribute('htmlFor', 'x'); - if (LABEL.htmlFor === 'x') - forProp = 'htmlFor'; - } - LABEL = null; - - function _getAttr(element, attribute) { - return element.getAttribute(attribute); - } - - function _getAttr2(element, attribute) { - return element.getAttribute(attribute, 2); - } - - function _getAttrNode(element, attribute) { - var node = element.getAttributeNode(attribute); - return node ? node.value : ''; - } - - function _getFlag(element, attribute) { - return $(element).hasAttribute(attribute) ? attribute : null; - } - - DIV.onclick = Prototype.emptyFunction; - var onclickValue = DIV.getAttribute('onclick'); - - var _getEv; - - if (String(onclickValue).indexOf('{') > -1) { - _getEv = function(element, attribute) { - var value = element.getAttribute(attribute); - if (!value) return null; - value = value.toString(); - value = value.split('{')[1]; - value = value.split('}')[0]; - return value.strip(); - }; - } - else if (onclickValue === '') { - _getEv = function(element, attribute) { - var value = element.getAttribute(attribute); - if (!value) return null; - return value.strip(); - }; - } - - ATTRIBUTE_TRANSLATIONS.read = { - names: { - 'class': classProp, - 'className': classProp, - 'for': forProp, - 'htmlFor': forProp - }, - - values: { - style: function(element) { - return element.style.cssText.toLowerCase(); - }, - title: function(element) { - return element.title; - } - } - }; - - ATTRIBUTE_TRANSLATIONS.write = { - names: { - className: 'class', - htmlFor: 'for', - cellpadding: 'cellPadding', - cellspacing: 'cellSpacing' - }, - - values: { - checked: function(element, value) { - element.checked = !!value; - }, - - style: function(element, value) { - element.style.cssText = value ? value : ''; - } - } - }; - - ATTRIBUTE_TRANSLATIONS.has = { names: {} }; - - Object.extend(ATTRIBUTE_TRANSLATIONS.write.names, - ATTRIBUTE_TRANSLATIONS.read.names); - - var CAMEL_CASED_ATTRIBUTE_NAMES = $w('colSpan rowSpan vAlign dateTime ' + - 'accessKey tabIndex encType maxLength readOnly longDesc frameBorder'); - - for (var i = 0, attr; attr = CAMEL_CASED_ATTRIBUTE_NAMES[i]; i++) { - ATTRIBUTE_TRANSLATIONS.write.names[attr.toLowerCase()] = attr; - ATTRIBUTE_TRANSLATIONS.has.names[attr.toLowerCase()] = attr; - } - - Object.extend(ATTRIBUTE_TRANSLATIONS.read.values, { - href: _getAttr2, - src: _getAttr2, - type: _getAttr, - action: _getAttrNode, - disabled: _getFlag, - checked: _getFlag, - readonly: _getFlag, - multiple: _getFlag, - onload: _getEv, - onunload: _getEv, - onclick: _getEv, - ondblclick: _getEv, - onmousedown: _getEv, - onmouseup: _getEv, - onmouseover: _getEv, - onmousemove: _getEv, - onmouseout: _getEv, - onfocus: _getEv, - onblur: _getEv, - onkeypress: _getEv, - onkeydown: _getEv, - onkeyup: _getEv, - onsubmit: _getEv, - onreset: _getEv, - onselect: _getEv, - onchange: _getEv - }); - - - Object.extend(methods, { - identify: identify, - readAttribute: readAttribute, - writeAttribute: writeAttribute, - classNames: classNames, - hasClassName: hasClassName, - addClassName: addClassName, - removeClassName: removeClassName, - toggleClassName: toggleClassName - }); - - - function normalizeStyleName(style) { - if (style === 'float' || style === 'styleFloat') - return 'cssFloat'; - return style.camelize(); - } - - function normalizeStyleName_IE(style) { - if (style === 'float' || style === 'cssFloat') - return 'styleFloat'; - return style.camelize(); - } - - function setStyle(element, styles) { - element = $(element); - var elementStyle = element.style, match; - - if (Object.isString(styles)) { - elementStyle.cssText += ';' + styles; - if (styles.include('opacity')) { - var opacity = styles.match(/opacity:\s*(\d?\.?\d*)/)[1]; - Element.setOpacity(element, opacity); - } - return element; - } - - for (var property in styles) { - if (property === 'opacity') { - Element.setOpacity(element, styles[property]); - } else { - var value = styles[property]; - if (property === 'float' || property === 'cssFloat') { - property = Object.isUndefined(elementStyle.styleFloat) ? - 'cssFloat' : 'styleFloat'; - } - elementStyle[property] = value; - } - } - - return element; - } - - - function getStyle(element, style) { - element = $(element); - style = normalizeStyleName(style); - - var value = element.style[style]; - if (!value || value === 'auto') { - var css = document.defaultView.getComputedStyle(element, null); - value = css ? css[style] : null; - } - - if (style === 'opacity') return value ? parseFloat(value) : 1.0; - return value === 'auto' ? null : value; - } - - function getStyle_Opera(element, style) { - switch (style) { - case 'height': case 'width': - if (!Element.visible(element)) return null; - - var dim = parseInt(getStyle(element, style), 10); - - if (dim !== element['offset' + style.capitalize()]) - return dim + 'px'; - - return Element.measure(element, style); - - default: return getStyle(element, style); - } - } - - function getStyle_IE(element, style) { - element = $(element); - style = normalizeStyleName_IE(style); - - var value = element.style[style]; - if (!value && element.currentStyle) { - value = element.currentStyle[style]; - } - - if (style === 'opacity' && !STANDARD_CSS_OPACITY_SUPPORTED) - return getOpacity_IE(element); - - if (value === 'auto') { - if ((style === 'width' || style === 'height') && Element.visible(element)) - return Element.measure(element, style) + 'px'; - return null; - } - - return value; - } - - function stripAlphaFromFilter_IE(filter) { - return (filter || '').replace(/alpha\([^\)]*\)/gi, ''); - } - - function hasLayout_IE(element) { - if (!element.currentStyle || !element.currentStyle.hasLayout) - element.style.zoom = 1; - return element; - } - - var STANDARD_CSS_OPACITY_SUPPORTED = (function() { - DIV.style.cssText = "opacity:.55"; - return /^0.55/.test(DIV.style.opacity); - })(); - - function setOpacity(element, value) { - element = $(element); - if (value == 1 || value === '') value = ''; - else if (value < 0.00001) value = 0; - element.style.opacity = value; - return element; - } - - function setOpacity_IE(element, value) { - if (STANDARD_CSS_OPACITY_SUPPORTED) - return setOpacity(element, value); - - element = hasLayout_IE($(element)); - var filter = Element.getStyle(element, 'filter'), - style = element.style; - - if (value == 1 || value === '') { - filter = stripAlphaFromFilter_IE(filter); - if (filter) style.filter = filter; - else style.removeAttribute('filter'); - return element; - } - - if (value < 0.00001) value = 0; - - style.filter = stripAlphaFromFilter_IE(filter) + - 'alpha(opacity=' + (value * 100) + ')'; - - return element; - } - - - function getOpacity(element) { - return Element.getStyle(element, 'opacity'); - } - - function getOpacity_IE(element) { - if (STANDARD_CSS_OPACITY_SUPPORTED) - return getOpacity(element); - - var filter = Element.getStyle(element, 'filter'); - if (filter.length === 0) return 1.0; - var match = (filter || '').match(/alpha\(opacity=(.*)\)/); - if (match && match[1]) return parseFloat(match[1]) / 100; - return 1.0; - } - - - Object.extend(methods, { - setStyle: setStyle, - getStyle: getStyle, - setOpacity: setOpacity, - getOpacity: getOpacity - }); - - if ('styleFloat' in DIV.style) { - methods.getStyle = getStyle_IE; - methods.setOpacity = setOpacity_IE; - methods.getOpacity = getOpacity_IE; - } - - var UID = 0; - - GLOBAL.Element.Storage = { UID: 1 }; - - function getUniqueElementID(element) { - if (element === window) return 0; - - if (typeof element._prototypeUID === 'undefined') - element._prototypeUID = Element.Storage.UID++; - return element._prototypeUID; - } - - function getUniqueElementID_IE(element) { - if (element === window) return 0; - if (element == document) return 1; - return element.uniqueID; - } - - var HAS_UNIQUE_ID_PROPERTY = ('uniqueID' in DIV); - if (HAS_UNIQUE_ID_PROPERTY) - getUniqueElementID = getUniqueElementID_IE; - - function getStorage(element) { - if (!(element = $(element))) return; - - var uid = getUniqueElementID(element); - - if (!Element.Storage[uid]) - Element.Storage[uid] = $H(); - - return Element.Storage[uid]; - } - - function store(element, key, value) { - if (!(element = $(element))) return; - var storage = getStorage(element); - if (arguments.length === 2) { - storage.update(key); - } else { - storage.set(key, value); - } - return element; - } - - function retrieve(element, key, defaultValue) { - if (!(element = $(element))) return; - var storage = getStorage(element), value = storage.get(key); - - if (Object.isUndefined(value)) { - storage.set(key, defaultValue); - value = defaultValue; - } - - return value; - } - - - Object.extend(methods, { - getStorage: getStorage, - store: store, - retrieve: retrieve - }); - - - var Methods = {}, ByTag = Element.Methods.ByTag, - F = Prototype.BrowserFeatures; - - if (!F.ElementExtensions && ('__proto__' in DIV)) { - GLOBAL.HTMLElement = {}; - GLOBAL.HTMLElement.prototype = DIV['__proto__']; - F.ElementExtensions = true; - } - - function checkElementPrototypeDeficiency(tagName) { - if (typeof window.Element === 'undefined') return false; - if (!HAS_EXTENDED_CREATE_ELEMENT_SYNTAX) return false; - var proto = window.Element.prototype; - if (proto) { - var id = '_' + (Math.random() + '').slice(2), - el = document.createElement(tagName); - proto[id] = 'x'; - var isBuggy = (el[id] !== 'x'); - delete proto[id]; - el = null; - return isBuggy; - } - - return false; - } - - var HTMLOBJECTELEMENT_PROTOTYPE_BUGGY = - checkElementPrototypeDeficiency('object'); - - function extendElementWith(element, methods) { - for (var property in methods) { - var value = methods[property]; - if (Object.isFunction(value) && !(property in element)) - element[property] = value.methodize(); - } - } - - var EXTENDED = {}; - function elementIsExtended(element) { - var uid = getUniqueElementID(element); - return (uid in EXTENDED); - } - - function extend(element) { - if (!element || elementIsExtended(element)) return element; - if (element.nodeType !== Node.ELEMENT_NODE || element == window) - return element; - - var methods = Object.clone(Methods), - tagName = element.tagName.toUpperCase(); - - if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]); - - extendElementWith(element, methods); - EXTENDED[getUniqueElementID(element)] = true; - return element; - } - - function extend_IE8(element) { - if (!element || elementIsExtended(element)) return element; - - var t = element.tagName; - if (t && (/^(?:object|applet|embed)$/i.test(t))) { - extendElementWith(element, Element.Methods); - extendElementWith(element, Element.Methods.Simulated); - extendElementWith(element, Element.Methods.ByTag[t.toUpperCase()]); - } - - return element; - } - - if (F.SpecificElementExtensions) { - extend = HTMLOBJECTELEMENT_PROTOTYPE_BUGGY ? extend_IE8 : Prototype.K; - } - - function addMethodsToTagName(tagName, methods) { - tagName = tagName.toUpperCase(); - if (!ByTag[tagName]) ByTag[tagName] = {}; - Object.extend(ByTag[tagName], methods); - } - - function mergeMethods(destination, methods, onlyIfAbsent) { - if (Object.isUndefined(onlyIfAbsent)) onlyIfAbsent = false; - for (var property in methods) { - var value = methods[property]; - if (!Object.isFunction(value)) continue; - if (!onlyIfAbsent || !(property in destination)) - destination[property] = value.methodize(); - } - } - - function findDOMClass(tagName) { - var klass; - var trans = { - "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph", - "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList", - "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading", - "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote", - "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION": - "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD": - "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR": - "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET": - "FrameSet", "IFRAME": "IFrame" - }; - if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element'; - if (window[klass]) return window[klass]; - klass = 'HTML' + tagName + 'Element'; - if (window[klass]) return window[klass]; - klass = 'HTML' + tagName.capitalize() + 'Element'; - if (window[klass]) return window[klass]; - - var element = document.createElement(tagName), - proto = element['__proto__'] || element.constructor.prototype; - - element = null; - return proto; - } - - function addMethods(methods) { - if (arguments.length === 0) addFormMethods(); - - if (arguments.length === 2) { - var tagName = methods; - methods = arguments[1]; - } - - if (!tagName) { - Object.extend(Element.Methods, methods || {}); - } else { - if (Object.isArray(tagName)) { - for (var i = 0, tag; tag = tagName[i]; i++) - addMethodsToTagName(tag, methods); - } else { - addMethodsToTagName(tagName, methods); - } - } - - var ELEMENT_PROTOTYPE = window.HTMLElement ? HTMLElement.prototype : - Element.prototype; - - if (F.ElementExtensions) { - mergeMethods(ELEMENT_PROTOTYPE, Element.Methods); - mergeMethods(ELEMENT_PROTOTYPE, Element.Methods.Simulated, true); - } - - if (F.SpecificElementExtensions) { - for (var tag in Element.Methods.ByTag) { - var klass = findDOMClass(tag); - if (Object.isUndefined(klass)) continue; - mergeMethods(klass.prototype, ByTag[tag]); - } - } - - Object.extend(Element, Element.Methods); - Object.extend(Element, Element.Methods.Simulated); - delete Element.ByTag; - delete Element.Simulated; - - Element.extend.refresh(); - - ELEMENT_CACHE = {}; - } - - Object.extend(GLOBAL.Element, { - extend: extend, - addMethods: addMethods - }); - - if (extend === Prototype.K) { - GLOBAL.Element.extend.refresh = Prototype.emptyFunction; - } else { - GLOBAL.Element.extend.refresh = function() { - if (Prototype.BrowserFeatures.ElementExtensions) return; - Object.extend(Methods, Element.Methods); - Object.extend(Methods, Element.Methods.Simulated); - - EXTENDED = {}; - }; - } - - function addFormMethods() { - Object.extend(Form, Form.Methods); - Object.extend(Form.Element, Form.Element.Methods); - Object.extend(Element.Methods.ByTag, { - "FORM": Object.clone(Form.Methods), - "INPUT": Object.clone(Form.Element.Methods), - "SELECT": Object.clone(Form.Element.Methods), - "TEXTAREA": Object.clone(Form.Element.Methods), - "BUTTON": Object.clone(Form.Element.Methods) - }); - } - - Element.addMethods(methods); - - function destroyCache_IE() { - DIV = null; - ELEMENT_CACHE = null; - } - - if (window.attachEvent) - window.attachEvent('onunload', destroyCache_IE); - -})(this); -(function() { - - function toDecimal(pctString) { - var match = pctString.match(/^(\d+)%?$/i); - if (!match) return null; - return (Number(match[1]) / 100); - } - - function getRawStyle(element, style) { - element = $(element); - - var value = element.style[style]; - if (!value || value === 'auto') { - var css = document.defaultView.getComputedStyle(element, null); - value = css ? css[style] : null; - } - - if (style === 'opacity') return value ? parseFloat(value) : 1.0; - return value === 'auto' ? null : value; - } - - function getRawStyle_IE(element, style) { - var value = element.style[style]; - if (!value && element.currentStyle) { - value = element.currentStyle[style]; - } - return value; - } - - function getContentWidth(element, context) { - var boxWidth = element.offsetWidth; - - var bl = getPixelValue(element, 'borderLeftWidth', context) || 0; - var br = getPixelValue(element, 'borderRightWidth', context) || 0; - var pl = getPixelValue(element, 'paddingLeft', context) || 0; - var pr = getPixelValue(element, 'paddingRight', context) || 0; - - return boxWidth - bl - br - pl - pr; - } - - if ('currentStyle' in document.documentElement) { - getRawStyle = getRawStyle_IE; - } - - - function getPixelValue(value, property, context) { - var element = null; - if (Object.isElement(value)) { - element = value; - value = getRawStyle(element, property); - } - - if (value === null || Object.isUndefined(value)) { - return null; - } - - if ((/^(?:-)?\d+(\.\d+)?(px)?$/i).test(value)) { - return window.parseFloat(value); - } - - var isPercentage = value.include('%'), isViewport = (context === document.viewport); - - if (/\d/.test(value) && element && element.runtimeStyle && !(isPercentage && isViewport)) { - var style = element.style.left, rStyle = element.runtimeStyle.left; - element.runtimeStyle.left = element.currentStyle.left; - element.style.left = value || 0; - value = element.style.pixelLeft; - element.style.left = style; - element.runtimeStyle.left = rStyle; - - return value; - } - - if (element && isPercentage) { - context = context || element.parentNode; - var decimal = toDecimal(value), whole = null; - - var isHorizontal = property.include('left') || property.include('right') || - property.include('width'); - - var isVertical = property.include('top') || property.include('bottom') || - property.include('height'); - - if (context === document.viewport) { - if (isHorizontal) { - whole = document.viewport.getWidth(); - } else if (isVertical) { - whole = document.viewport.getHeight(); - } - } else { - if (isHorizontal) { - whole = $(context).measure('width'); - } else if (isVertical) { - whole = $(context).measure('height'); - } - } - - return (whole === null) ? 0 : whole * decimal; - } - - return 0; - } - - function toCSSPixels(number) { - if (Object.isString(number) && number.endsWith('px')) - return number; - return number + 'px'; - } - - function isDisplayed(element) { - while (element && element.parentNode) { - var display = element.getStyle('display'); - if (display === 'none') { - return false; - } - element = $(element.parentNode); - } - return true; - } - - var hasLayout = Prototype.K; - if ('currentStyle' in document.documentElement) { - hasLayout = function(element) { - if (!element.currentStyle.hasLayout) { - element.style.zoom = 1; - } - return element; - }; - } - - function cssNameFor(key) { - if (key.include('border')) key = key + '-width'; - return key.camelize(); - } - - Element.Layout = Class.create(Hash, { - initialize: function($super, element, preCompute) { - $super(); - this.element = $(element); - - Element.Layout.PROPERTIES.each( function(property) { - this._set(property, null); - }, this); - - if (preCompute) { - this._preComputing = true; - this._begin(); - Element.Layout.PROPERTIES.each( this._compute, this ); - this._end(); - this._preComputing = false; - } - }, - - _set: function(property, value) { - return Hash.prototype.set.call(this, property, value); - }, - - set: function(property, value) { - throw "Properties of Element.Layout are read-only."; - }, - - get: function($super, property) { - var value = $super(property); - return value === null ? this._compute(property) : value; - }, - - _begin: function() { - if (this._isPrepared()) return; - - var element = this.element; - if (isDisplayed(element)) { - this._setPrepared(true); - return; - } - - - var originalStyles = { - position: element.style.position || '', - width: element.style.width || '', - visibility: element.style.visibility || '', - display: element.style.display || '' - }; - - element.store('prototype_original_styles', originalStyles); - - var position = getRawStyle(element, 'position'), width = element.offsetWidth; - - if (width === 0 || width === null) { - element.style.display = 'block'; - width = element.offsetWidth; - } - - var context = (position === 'fixed') ? document.viewport : - element.parentNode; - - var tempStyles = { - visibility: 'hidden', - display: 'block' - }; - - if (position !== 'fixed') tempStyles.position = 'absolute'; - - element.setStyle(tempStyles); - - var positionedWidth = element.offsetWidth, newWidth; - if (width && (positionedWidth === width)) { - newWidth = getContentWidth(element, context); - } else if (position === 'absolute' || position === 'fixed') { - newWidth = getContentWidth(element, context); - } else { - var parent = element.parentNode, pLayout = $(parent).getLayout(); - - newWidth = pLayout.get('width') - - this.get('margin-left') - - this.get('border-left') - - this.get('padding-left') - - this.get('padding-right') - - this.get('border-right') - - this.get('margin-right'); - } - - element.setStyle({ width: newWidth + 'px' }); - - this._setPrepared(true); - }, - - _end: function() { - var element = this.element; - var originalStyles = element.retrieve('prototype_original_styles'); - element.store('prototype_original_styles', null); - element.setStyle(originalStyles); - this._setPrepared(false); - }, - - _compute: function(property) { - var COMPUTATIONS = Element.Layout.COMPUTATIONS; - if (!(property in COMPUTATIONS)) { - throw "Property not found."; - } - - return this._set(property, COMPUTATIONS[property].call(this, this.element)); - }, - - _isPrepared: function() { - return this.element.retrieve('prototype_element_layout_prepared', false); - }, - - _setPrepared: function(bool) { - return this.element.store('prototype_element_layout_prepared', bool); - }, - - toObject: function() { - var args = $A(arguments); - var keys = (args.length === 0) ? Element.Layout.PROPERTIES : - args.join(' ').split(' '); - var obj = {}; - keys.each( function(key) { - if (!Element.Layout.PROPERTIES.include(key)) return; - var value = this.get(key); - if (value != null) obj[key] = value; - }, this); - return obj; - }, - - toHash: function() { - var obj = this.toObject.apply(this, arguments); - return new Hash(obj); - }, - - toCSS: function() { - var args = $A(arguments); - var keys = (args.length === 0) ? Element.Layout.PROPERTIES : - args.join(' ').split(' '); - var css = {}; - - keys.each( function(key) { - if (!Element.Layout.PROPERTIES.include(key)) return; - if (Element.Layout.COMPOSITE_PROPERTIES.include(key)) return; - - var value = this.get(key); - if (value != null) css[cssNameFor(key)] = value + 'px'; - }, this); - return css; - }, - - inspect: function() { - return "#"; - } - }); - - Object.extend(Element.Layout, { - PROPERTIES: $w('height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height'), - - COMPOSITE_PROPERTIES: $w('padding-box-width padding-box-height margin-box-width margin-box-height border-box-width border-box-height'), - - COMPUTATIONS: { - 'height': function(element) { - if (!this._preComputing) this._begin(); - - var bHeight = this.get('border-box-height'); - if (bHeight <= 0) { - if (!this._preComputing) this._end(); - return 0; - } - - var bTop = this.get('border-top'), - bBottom = this.get('border-bottom'); - - var pTop = this.get('padding-top'), - pBottom = this.get('padding-bottom'); - - if (!this._preComputing) this._end(); - - return bHeight - bTop - bBottom - pTop - pBottom; - }, - - 'width': function(element) { - if (!this._preComputing) this._begin(); - - var bWidth = this.get('border-box-width'); - if (bWidth <= 0) { - if (!this._preComputing) this._end(); - return 0; - } - - var bLeft = this.get('border-left'), - bRight = this.get('border-right'); - - var pLeft = this.get('padding-left'), - pRight = this.get('padding-right'); - - if (!this._preComputing) this._end(); - return bWidth - bLeft - bRight - pLeft - pRight; - }, - - 'padding-box-height': function(element) { - var height = this.get('height'), - pTop = this.get('padding-top'), - pBottom = this.get('padding-bottom'); - - return height + pTop + pBottom; - }, - - 'padding-box-width': function(element) { - var width = this.get('width'), - pLeft = this.get('padding-left'), - pRight = this.get('padding-right'); - - return width + pLeft + pRight; - }, - - 'border-box-height': function(element) { - if (!this._preComputing) this._begin(); - var height = element.offsetHeight; - if (!this._preComputing) this._end(); - return height; - }, - - 'border-box-width': function(element) { - if (!this._preComputing) this._begin(); - var width = element.offsetWidth; - if (!this._preComputing) this._end(); - return width; - }, - - 'margin-box-height': function(element) { - var bHeight = this.get('border-box-height'), - mTop = this.get('margin-top'), - mBottom = this.get('margin-bottom'); - - if (bHeight <= 0) return 0; - - return bHeight + mTop + mBottom; - }, - - 'margin-box-width': function(element) { - var bWidth = this.get('border-box-width'), - mLeft = this.get('margin-left'), - mRight = this.get('margin-right'); - - if (bWidth <= 0) return 0; - - return bWidth + mLeft + mRight; - }, - - 'top': function(element) { - var offset = element.positionedOffset(); - return offset.top; - }, - - 'bottom': function(element) { - var offset = element.positionedOffset(), - parent = element.getOffsetParent(), - pHeight = parent.measure('height'); - - var mHeight = this.get('border-box-height'); - - return pHeight - mHeight - offset.top; - }, - - 'left': function(element) { - var offset = element.positionedOffset(); - return offset.left; - }, - - 'right': function(element) { - var offset = element.positionedOffset(), - parent = element.getOffsetParent(), - pWidth = parent.measure('width'); - - var mWidth = this.get('border-box-width'); - - return pWidth - mWidth - offset.left; - }, - - 'padding-top': function(element) { - return getPixelValue(element, 'paddingTop'); - }, - - 'padding-bottom': function(element) { - return getPixelValue(element, 'paddingBottom'); - }, - - 'padding-left': function(element) { - return getPixelValue(element, 'paddingLeft'); - }, - - 'padding-right': function(element) { - return getPixelValue(element, 'paddingRight'); - }, - - 'border-top': function(element) { - return getPixelValue(element, 'borderTopWidth'); - }, - - 'border-bottom': function(element) { - return getPixelValue(element, 'borderBottomWidth'); - }, - - 'border-left': function(element) { - return getPixelValue(element, 'borderLeftWidth'); - }, - - 'border-right': function(element) { - return getPixelValue(element, 'borderRightWidth'); - }, - - 'margin-top': function(element) { - return getPixelValue(element, 'marginTop'); - }, - - 'margin-bottom': function(element) { - return getPixelValue(element, 'marginBottom'); - }, - - 'margin-left': function(element) { - return getPixelValue(element, 'marginLeft'); - }, - - 'margin-right': function(element) { - return getPixelValue(element, 'marginRight'); - } - } - }); - - if ('getBoundingClientRect' in document.documentElement) { - Object.extend(Element.Layout.COMPUTATIONS, { - 'right': function(element) { - var parent = hasLayout(element.getOffsetParent()); - var rect = element.getBoundingClientRect(), - pRect = parent.getBoundingClientRect(); - - return (pRect.right - rect.right).round(); - }, - - 'bottom': function(element) { - var parent = hasLayout(element.getOffsetParent()); - var rect = element.getBoundingClientRect(), - pRect = parent.getBoundingClientRect(); - - return (pRect.bottom - rect.bottom).round(); - } - }); - } - - Element.Offset = Class.create({ - initialize: function(left, top) { - this.left = left.round(); - this.top = top.round(); - - this[0] = this.left; - this[1] = this.top; - }, - - relativeTo: function(offset) { - return new Element.Offset( - this.left - offset.left, - this.top - offset.top - ); - }, - - inspect: function() { - return "#".interpolate(this); - }, - - toString: function() { - return "[#{left}, #{top}]".interpolate(this); - }, - - toArray: function() { - return [this.left, this.top]; - } - }); - - function getLayout(element, preCompute) { - return new Element.Layout(element, preCompute); - } - - function measure(element, property) { - return $(element).getLayout().get(property); - } - - function getHeight(element) { - return Element.getDimensions(element).height; - } - - function getWidth(element) { - return Element.getDimensions(element).width; - } - - function getDimensions(element) { - element = $(element); - var display = Element.getStyle(element, 'display'); - - if (display && display !== 'none') { - return { width: element.offsetWidth, height: element.offsetHeight }; - } - - var style = element.style; - var originalStyles = { - visibility: style.visibility, - position: style.position, - display: style.display - }; - - var newStyles = { - visibility: 'hidden', - display: 'block' - }; - - if (originalStyles.position !== 'fixed') - newStyles.position = 'absolute'; - - Element.setStyle(element, newStyles); - - var dimensions = { - width: element.offsetWidth, - height: element.offsetHeight - }; - - Element.setStyle(element, originalStyles); - - return dimensions; - } - - function getOffsetParent(element) { - element = $(element); - - if (isDocument(element) || isDetached(element) || isBody(element) || isHtml(element)) - return $(document.body); - - var isInline = (Element.getStyle(element, 'display') === 'inline'); - if (!isInline && element.offsetParent) return $(element.offsetParent); - - while ((element = element.parentNode) && element !== document.body) { - if (Element.getStyle(element, 'position') !== 'static') { - return isHtml(element) ? $(document.body) : $(element); - } - } - - return $(document.body); - } - - - function cumulativeOffset(element) { - element = $(element); - var valueT = 0, valueL = 0; - if (element.parentNode) { - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - element = element.offsetParent; - } while (element); - } - return new Element.Offset(valueL, valueT); - } - - function positionedOffset(element) { - element = $(element); - - var layout = element.getLayout(); - - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - element = element.offsetParent; - if (element) { - if (isBody(element)) break; - var p = Element.getStyle(element, 'position'); - if (p !== 'static') break; - } - } while (element); - - valueL -= layout.get('margin-top'); - valueT -= layout.get('margin-left'); - - return new Element.Offset(valueL, valueT); - } - - function cumulativeScrollOffset(element) { - var valueT = 0, valueL = 0; - do { - if (element === document.body) { - var bodyScrollNode = document.documentElement || document.body.parentNode || document.body; - valueT += !Object.isUndefined(window.pageYOffset) ? window.pageYOffset : bodyScrollNode.scrollTop || 0; - valueL += !Object.isUndefined(window.pageXOffset) ? window.pageXOffset : bodyScrollNode.scrollLeft || 0; - break; - } else { - valueT += element.scrollTop || 0; - valueL += element.scrollLeft || 0; - element = element.parentNode; - } - } while (element); - return new Element.Offset(valueL, valueT); - } - - function viewportOffset(forElement) { - var valueT = 0, valueL = 0, docBody = document.body; - - forElement = $(forElement); - var element = forElement; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - if (element.offsetParent == docBody && - Element.getStyle(element, 'position') == 'absolute') break; - } while (element = element.offsetParent); - - element = forElement; - do { - if (element != docBody) { - valueT -= element.scrollTop || 0; - valueL -= element.scrollLeft || 0; - } - } while (element = element.parentNode); - return new Element.Offset(valueL, valueT); - } - - function absolutize(element) { - element = $(element); - - if (Element.getStyle(element, 'position') === 'absolute') { - return element; - } - - var offsetParent = getOffsetParent(element); - var eOffset = element.viewportOffset(), - pOffset = offsetParent.viewportOffset(); - - var offset = eOffset.relativeTo(pOffset); - var layout = element.getLayout(); - - element.store('prototype_absolutize_original_styles', { - position: element.getStyle('position'), - left: element.getStyle('left'), - top: element.getStyle('top'), - width: element.getStyle('width'), - height: element.getStyle('height') - }); - - element.setStyle({ - position: 'absolute', - top: offset.top + 'px', - left: offset.left + 'px', - width: layout.get('width') + 'px', - height: layout.get('height') + 'px' - }); - - return element; - } - - function relativize(element) { - element = $(element); - if (Element.getStyle(element, 'position') === 'relative') { - return element; - } - - var originalStyles = - element.retrieve('prototype_absolutize_original_styles'); - - if (originalStyles) element.setStyle(originalStyles); - return element; - } - - - function scrollTo(element) { - element = $(element); - var pos = Element.cumulativeOffset(element); - window.scrollTo(pos.left, pos.top); - return element; - } - - - function makePositioned(element) { - element = $(element); - var position = Element.getStyle(element, 'position'), styles = {}; - if (position === 'static' || !position) { - styles.position = 'relative'; - if (Prototype.Browser.Opera) { - styles.top = 0; - styles.left = 0; - } - Element.setStyle(element, styles); - Element.store(element, 'prototype_made_positioned', true); - } - return element; - } - - function undoPositioned(element) { - element = $(element); - var storage = Element.getStorage(element), - madePositioned = storage.get('prototype_made_positioned'); - - if (madePositioned) { - storage.unset('prototype_made_positioned'); - Element.setStyle(element, { - position: '', - top: '', - bottom: '', - left: '', - right: '' - }); - } - return element; - } - - function makeClipping(element) { - element = $(element); - - var storage = Element.getStorage(element), - madeClipping = storage.get('prototype_made_clipping'); - - if (Object.isUndefined(madeClipping)) { - var overflow = Element.getStyle(element, 'overflow'); - storage.set('prototype_made_clipping', overflow); - if (overflow !== 'hidden') - element.style.overflow = 'hidden'; - } - - return element; - } - - function undoClipping(element) { - element = $(element); - var storage = Element.getStorage(element), - overflow = storage.get('prototype_made_clipping'); - - if (!Object.isUndefined(overflow)) { - storage.unset('prototype_made_clipping'); - element.style.overflow = overflow || ''; - } - - return element; - } - - function clonePosition(element, source, options) { - options = Object.extend({ - setLeft: true, - setTop: true, - setWidth: true, - setHeight: true, - offsetTop: 0, - offsetLeft: 0 - }, options || {}); - - source = $(source); - element = $(element); - var p, delta, layout, styles = {}; - - if (options.setLeft || options.setTop) { - p = Element.viewportOffset(source); - delta = [0, 0]; - if (Element.getStyle(element, 'position') === 'absolute') { - var parent = Element.getOffsetParent(element); - if (parent !== document.body) delta = Element.viewportOffset(parent); - } - } - - if (options.setWidth || options.setHeight) { - layout = Element.getLayout(source); - } - - if (options.setLeft) - styles.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; - if (options.setTop) - styles.top = (p[1] - delta[1] + options.offsetTop) + 'px'; - - if (options.setWidth) - styles.width = layout.get('border-box-width') + 'px'; - if (options.setHeight) - styles.height = layout.get('border-box-height') + 'px'; - - return Element.setStyle(element, styles); - } - - - if (Prototype.Browser.IE) { - getOffsetParent = getOffsetParent.wrap( - function(proceed, element) { - element = $(element); - - if (isDocument(element) || isDetached(element) || isBody(element) || isHtml(element)) - return $(document.body); - - var position = element.getStyle('position'); - if (position !== 'static') return proceed(element); - - element.setStyle({ position: 'relative' }); - var value = proceed(element); - element.setStyle({ position: position }); - return value; - } - ); - - positionedOffset = positionedOffset.wrap(function(proceed, element) { - element = $(element); - if (!element.parentNode) return new Element.Offset(0, 0); - var position = element.getStyle('position'); - if (position !== 'static') return proceed(element); - - var offsetParent = element.getOffsetParent(); - if (offsetParent && offsetParent.getStyle('position') === 'fixed') - hasLayout(offsetParent); - - element.setStyle({ position: 'relative' }); - var value = proceed(element); - element.setStyle({ position: position }); - return value; - }); - } else if (Prototype.Browser.Webkit) { - cumulativeOffset = function(element) { - element = $(element); - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - if (element.offsetParent == document.body) { - if (Element.getStyle(element, 'position') == 'absolute') break; - } - - element = element.offsetParent; - } while (element); - - return new Element.Offset(valueL, valueT); - }; - } - - - Element.addMethods({ - getLayout: getLayout, - measure: measure, - getWidth: getWidth, - getHeight: getHeight, - getDimensions: getDimensions, - getOffsetParent: getOffsetParent, - cumulativeOffset: cumulativeOffset, - positionedOffset: positionedOffset, - cumulativeScrollOffset: cumulativeScrollOffset, - viewportOffset: viewportOffset, - absolutize: absolutize, - relativize: relativize, - scrollTo: scrollTo, - makePositioned: makePositioned, - undoPositioned: undoPositioned, - makeClipping: makeClipping, - undoClipping: undoClipping, - clonePosition: clonePosition - }); - - function isBody(element) { - return element.nodeName.toUpperCase() === 'BODY'; - } - - function isHtml(element) { - return element.nodeName.toUpperCase() === 'HTML'; - } - - function isDocument(element) { - return element.nodeType === Node.DOCUMENT_NODE; - } - - function isDetached(element) { - return element !== document.body && - !Element.descendantOf(element, document.body); - } - - if ('getBoundingClientRect' in document.documentElement) { - Element.addMethods({ - viewportOffset: function(element) { - element = $(element); - if (isDetached(element)) return new Element.Offset(0, 0); - - var rect = element.getBoundingClientRect(), - docEl = document.documentElement; - return new Element.Offset(rect.left - docEl.clientLeft, - rect.top - docEl.clientTop); - } - }); - } - - -})(); - -(function() { - - var IS_OLD_OPERA = Prototype.Browser.Opera && - (window.parseFloat(window.opera.version()) < 9.5); - var ROOT = null; - function getRootElement() { - if (ROOT) return ROOT; - ROOT = IS_OLD_OPERA ? document.body : document.documentElement; - return ROOT; - } - - function getDimensions() { - return { width: this.getWidth(), height: this.getHeight() }; - } - - function getWidth() { - return getRootElement().clientWidth; - } - - function getHeight() { - return getRootElement().clientHeight; - } - - function getScrollOffsets() { - var x = window.pageXOffset || document.documentElement.scrollLeft || - document.body.scrollLeft; - var y = window.pageYOffset || document.documentElement.scrollTop || - document.body.scrollTop; - - return new Element.Offset(x, y); - } - - document.viewport = { - getDimensions: getDimensions, - getWidth: getWidth, - getHeight: getHeight, - getScrollOffsets: getScrollOffsets - }; - -})(); -window.$$ = function() { - var expression = $A(arguments).join(', '); - return Prototype.Selector.select(expression, document); -}; - -Prototype.Selector = (function() { - - function select() { - throw new Error('Method "Prototype.Selector.select" must be defined.'); - } - - function match() { - throw new Error('Method "Prototype.Selector.match" must be defined.'); - } - - function find(elements, expression, index) { - index = index || 0; - var match = Prototype.Selector.match, length = elements.length, matchIndex = 0, i; - - for (i = 0; i < length; i++) { - if (match(elements[i], expression) && index == matchIndex++) { - return Element.extend(elements[i]); - } - } - } - - function extendElements(elements) { - for (var i = 0, length = elements.length; i < length; i++) { - Element.extend(elements[i]); - } - return elements; - } - - - var K = Prototype.K; - - return { - select: select, - match: match, - find: find, - extendElements: (Element.extend === K) ? K : extendElements, - extendElement: Element.extend - }; -})(); -Prototype._original_property = window.Sizzle; -/*! - * Sizzle CSS Selector Engine v@VERSION - * http://sizzlejs.com/ - * - * Copyright 2013 jQuery Foundation, Inc. and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: @DATE - */ -(function( window ) { - -var i, - support, - Expr, - getText, - isXML, - compile, - select, - outermostContext, - sortInput, - hasDuplicate, - - setDocument, - document, - docElem, - documentIsHTML, - rbuggyQSA, - rbuggyMatches, - matches, - contains, - - expando = "sizzle" + -(new Date()), - preferredDoc = window.document, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - } - return 0; - }, - - strundefined = typeof undefined, - MAX_NEGATIVE = 1 << 31, - - hasOwn = ({}).hasOwnProperty, - arr = [], - pop = arr.pop, - push_native = arr.push, - push = arr.push, - slice = arr.slice, - indexOf = arr.indexOf || function( elem ) { - var i = 0, - len = this.length; - for ( ; i < len; i++ ) { - if ( this[i] === elem ) { - return i; - } - } - return -1; - }, - - booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", - - - whitespace = "[\\x20\\t\\r\\n\\f]", - characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", - - identifier = characterEncoding.replace( "w", "w#" ), - - attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + - "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", - - pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", - - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), - - rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), - - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), - - matchExpr = { - "ID": new RegExp( "^#(" + characterEncoding + ")" ), - "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), - "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + - "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + - "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), - "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + - whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, - - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - - rnative = /^[^{]+\{\s*\[native \w/, - - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - - rsibling = /[+~]/, - rescape = /'|\\/g, - - runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), - funescape = function( _, escaped, escapedWhitespace ) { - var high = "0x" + escaped - 0x10000; - return high !== high || escapedWhitespace ? - escaped : - high < 0 ? - String.fromCharCode( high + 0x10000 ) : - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }; - -try { - push.apply( - (arr = slice.call( preferredDoc.childNodes )), - preferredDoc.childNodes - ); - arr[ preferredDoc.childNodes.length ].nodeType; -} catch ( e ) { - push = { apply: arr.length ? - - function( target, els ) { - push_native.apply( target, slice.call(els) ); - } : - - function( target, els ) { - var j = target.length, - i = 0; - while ( (target[j++] = els[i++]) ) {} - target.length = j - 1; - } - }; -} - -function Sizzle( selector, context, results, seed ) { - var match, elem, m, nodeType, - i, groups, old, nid, newContext, newSelector; - - if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { - setDocument( context ); - } - - context = context || document; - results = results || []; - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { - return []; - } - - if ( documentIsHTML && !seed ) { - - if ( (match = rquickExpr.exec( selector )) ) { - if ( (m = match[1]) ) { - if ( nodeType === 9 ) { - elem = context.getElementById( m ); - if ( elem && elem.parentNode ) { - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - } else { - if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && - contains( context, elem ) && elem.id === m ) { - results.push( elem ); - return results; - } - } - - } else if ( match[2] ) { - push.apply( results, context.getElementsByTagName( selector ) ); - return results; - - } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { - push.apply( results, context.getElementsByClassName( m ) ); - return results; - } - } - - if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { - nid = old = expando; - newContext = context; - newSelector = nodeType === 9 && selector; - - if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - groups = tokenize( selector ); - - if ( (old = context.getAttribute("id")) ) { - nid = old.replace( rescape, "\\$&" ); - } else { - context.setAttribute( "id", nid ); - } - nid = "[id='" + nid + "'] "; - - i = groups.length; - while ( i-- ) { - groups[i] = nid + toSelector( groups[i] ); - } - newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; - newSelector = groups.join(","); - } - - if ( newSelector ) { - try { - push.apply( results, - newContext.querySelectorAll( newSelector ) - ); - return results; - } catch(qsaError) { - } finally { - if ( !old ) { - context.removeAttribute("id"); - } - } - } - } - } - - return select( selector.replace( rtrim, "$1" ), context, results, seed ); -} - -/** - * Create key-value caches of limited size - * @returns {Function(string, Object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var keys = []; - - function cache( key, value ) { - if ( keys.push( key + " " ) > Expr.cacheLength ) { - delete cache[ keys.shift() ]; - } - return (cache[ key + " " ] = value); - } - return cache; -} - -/** - * Mark a function for special use by Sizzle - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created div and expects a boolean result - */ -function assert( fn ) { - var div = document.createElement("div"); - - try { - return !!fn( div ); - } catch (e) { - return false; - } finally { - if ( div.parentNode ) { - div.parentNode.removeChild( div ); - } - div = null; - } -} - -/** - * Adds the same handler for all of the specified attrs - * @param {String} attrs Pipe-separated list of attributes - * @param {Function} handler The method that will be applied - */ -function addHandle( attrs, handler ) { - var arr = attrs.split("|"), - i = attrs.length; - - while ( i-- ) { - Expr.attrHandle[ arr[i] ] = handler; - } -} - -/** - * Checks document order of two siblings - * @param {Element} a - * @param {Element} b - * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b - */ -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && a.nodeType === 1 && b.nodeType === 1 && - ( ~b.sourceIndex || MAX_NEGATIVE ) - - ( ~a.sourceIndex || MAX_NEGATIVE ); - - if ( diff ) { - return diff; - } - - if ( cur ) { - while ( (cur = cur.nextSibling) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - -/** - * Returns a function to use in pseudos for input types - * @param {String} type - */ -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for buttons - * @param {String} type - */ -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for positionals - * @param {Function} fn - */ -function createPositionalPseudo( fn ) { - return markFunction(function( argument ) { - argument = +argument; - return markFunction(function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - while ( i-- ) { - if ( seed[ (j = matchIndexes[i]) ] ) { - seed[j] = !(matches[j] = seed[j]); - } - } - }); - }); -} - -/** - * Checks a node for validity as a Sizzle context - * @param {Element|Object=} context - * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value - */ -function testContext( context ) { - return context && typeof context.getElementsByTagName !== strundefined && context; -} - -support = Sizzle.support = {}; - -/** - * Detects XML nodes - * @param {Element|Object} elem An element or a document - * @returns {Boolean} True iff elem is a non-HTML XML node - */ -isXML = Sizzle.isXML = function( elem ) { - var documentElement = elem && (elem.ownerDocument || elem).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -/** - * Sets document-related variables once based on the current document - * @param {Element|Object} [doc] An element or document object to use to set the document - * @returns {Object} Returns the current document - */ -setDocument = Sizzle.setDocument = function( node ) { - var hasCompare, - doc = node ? node.ownerDocument || node : preferredDoc, - parent = doc.defaultView; - - if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { - return document; - } - - document = doc; - docElem = doc.documentElement; - - documentIsHTML = !isXML( doc ); - - if ( parent && parent !== parent.top ) { - if ( parent.addEventListener ) { - parent.addEventListener( "unload", function() { - setDocument(); - }, false ); - } else if ( parent.attachEvent ) { - parent.attachEvent( "onunload", function() { - setDocument(); - }); - } - } - - /* Attributes - ---------------------------------------------------------------------- */ - - support.attributes = assert(function( div ) { - div.className = "i"; - return !div.getAttribute("className"); - }); - - /* getElement(s)By* - ---------------------------------------------------------------------- */ - - support.getElementsByTagName = assert(function( div ) { - div.appendChild( doc.createComment("") ); - return !div.getElementsByTagName("*").length; - }); - - support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) { - div.innerHTML = "
    "; - - div.firstChild.className = "i"; - return div.getElementsByClassName("i").length === 2; - }); - - support.getById = assert(function( div ) { - docElem.appendChild( div ).id = expando; - return !doc.getElementsByName || !doc.getElementsByName( expando ).length; - }); - - if ( support.getById ) { - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== strundefined && documentIsHTML ) { - var m = context.getElementById( id ); - return m && m.parentNode ? [m] : []; - } - }; - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - return elem.getAttribute("id") === attrId; - }; - }; - } else { - delete Expr.find["ID"]; - - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); - return node && node.value === attrId; - }; - }; - } - - Expr.find["TAG"] = support.getElementsByTagName ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== strundefined ) { - return context.getElementsByTagName( tag ); - } - } : - function( tag, context ) { - var elem, - tmp = [], - i = 0, - results = context.getElementsByTagName( tag ); - - if ( tag === "*" ) { - while ( (elem = results[i++]) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; - - Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { - if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { - return context.getElementsByClassName( className ); - } - }; - - /* QSA/matchesSelector - ---------------------------------------------------------------------- */ - - - rbuggyMatches = []; - - rbuggyQSA = []; - - if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { - assert(function( div ) { - div.innerHTML = ""; - - if ( div.querySelectorAll("[t^='']").length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); - } - - if ( !div.querySelectorAll("[selected]").length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); - } - - if ( !div.querySelectorAll(":checked").length ) { - rbuggyQSA.push(":checked"); - } - }); - - assert(function( div ) { - var input = doc.createElement("input"); - input.setAttribute( "type", "hidden" ); - div.appendChild( input ).setAttribute( "name", "D" ); - - if ( div.querySelectorAll("[name=d]").length ) { - rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); - } - - if ( !div.querySelectorAll(":enabled").length ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - div.querySelectorAll("*,:x"); - rbuggyQSA.push(",.*:"); - }); - } - - if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector || - docElem.mozMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector) )) ) { - - assert(function( div ) { - support.disconnectedMatch = matches.call( div, "div" ); - - matches.call( div, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - }); - } - - rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); - rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); - - /* Contains - ---------------------------------------------------------------------- */ - hasCompare = rnative.test( docElem.compareDocumentPosition ); - - contains = hasCompare || rnative.test( docElem.contains ) ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - )); - } : - function( a, b ) { - if ( b ) { - while ( (b = b.parentNode) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; - - /* Sorting - ---------------------------------------------------------------------- */ - - sortOrder = hasCompare ? - function( a, b ) { - - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; - if ( compare ) { - return compare; - } - - compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? - a.compareDocumentPosition( b ) : - - 1; - - if ( compare & 1 || - (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { - - if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { - return -1; - } - if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { - return 1; - } - - return sortInput ? - ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : - 0; - } - - return compare & 4 ? -1 : 1; - } : - function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - if ( !aup || !bup ) { - return a === doc ? -1 : - b === doc ? 1 : - aup ? -1 : - bup ? 1 : - sortInput ? - ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : - 0; - - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - cur = a; - while ( (cur = cur.parentNode) ) { - ap.unshift( cur ); - } - cur = b; - while ( (cur = cur.parentNode) ) { - bp.unshift( cur ); - } - - while ( ap[i] === bp[i] ) { - i++; - } - - return i ? - siblingCheck( ap[i], bp[i] ) : - - ap[i] === preferredDoc ? -1 : - bp[i] === preferredDoc ? 1 : - 0; - }; - - return doc; -}; - -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; - -Sizzle.matchesSelector = function( elem, expr ) { - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - expr = expr.replace( rattributeQuotes, "='$1']" ); - - if ( support.matchesSelector && documentIsHTML && - ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && - ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { - - try { - var ret = matches.call( elem, expr ); - - if ( ret || support.disconnectedMatch || - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch(e) {} - } - - return Sizzle( expr, document, null, [elem] ).length > 0; -}; - -Sizzle.contains = function( context, elem ) { - if ( ( context.ownerDocument || context ) !== document ) { - setDocument( context ); - } - return contains( context, elem ); -}; - -Sizzle.attr = function( elem, name ) { - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - var fn = Expr.attrHandle[ name.toLowerCase() ], - val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? - fn( elem, name, !documentIsHTML ) : - undefined; - - return val !== undefined ? - val : - support.attributes || !documentIsHTML ? - elem.getAttribute( name ) : - (val = elem.getAttributeNode(name)) && val.specified ? - val.value : - null; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Document sorting and removing duplicates - * @param {ArrayLike} results - */ -Sizzle.uniqueSort = function( results ) { - var elem, - duplicates = [], - j = 0, - i = 0; - - hasDuplicate = !support.detectDuplicates; - sortInput = !support.sortStable && results.slice( 0 ); - results.sort( sortOrder ); - - if ( hasDuplicate ) { - while ( (elem = results[i++]) ) { - if ( elem === results[ i ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } - - sortInput = null; - - return results; -}; - -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - while ( (node = elem[i++]) ) { - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - - return ret; -}; - -Expr = Sizzle.selectors = { - - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - attrHandle: {}, - - find: {}, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[1] = match[1].replace( runescape, funescape ); - - match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); - - if ( match[2] === "~=" ) { - match[3] = " " + match[3] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 what (child|of-type) - 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 4 xn-component of xn+y argument ([+-]?\d*n|) - 5 sign of xn-component - 6 x of xn-component - 7 sign of y-component - 8 y of y-component - */ - match[1] = match[1].toLowerCase(); - - if ( match[1].slice( 0, 3 ) === "nth" ) { - if ( !match[3] ) { - Sizzle.error( match[0] ); - } - - match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); - match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); - - } else if ( match[3] ) { - Sizzle.error( match[0] ); - } - - return match; - }, - - "PSEUDO": function( match ) { - var excess, - unquoted = !match[5] && match[2]; - - if ( matchExpr["CHILD"].test( match[0] ) ) { - return null; - } - - if ( match[3] && match[4] !== undefined ) { - match[2] = match[4]; - - } else if ( unquoted && rpseudo.test( unquoted ) && - (excess = tokenize( unquoted, true )) && - (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { - - match[0] = match[0].slice( 0, excess ); - match[2] = unquoted.slice( 0, excess ); - } - - return match.slice( 0, 3 ); - } - }, - - filter: { - - "TAG": function( nodeNameSelector ) { - var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); - return nodeNameSelector === "*" ? - function() { return true; } : - function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ className + " " ]; - - return pattern || - (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && - classCache( className, function( elem ) { - return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" ); - }); - }, - - "ATTR": function( name, operator, check ) { - return function( elem ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - }; - }, - - "CHILD": function( type, what, argument, first, last ) { - var simple = type.slice( 0, 3 ) !== "nth", - forward = type.slice( -4 ) !== "last", - ofType = what === "of-type"; - - return first === 1 && last === 0 ? - - function( elem ) { - return !!elem.parentNode; - } : - - function( elem, context, xml ) { - var cache, outerCache, node, diff, nodeIndex, start, - dir = simple !== forward ? "nextSibling" : "previousSibling", - parent = elem.parentNode, - name = ofType && elem.nodeName.toLowerCase(), - useCache = !xml && !ofType; - - if ( parent ) { - - if ( simple ) { - while ( dir ) { - node = elem; - while ( (node = node[ dir ]) ) { - if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { - return false; - } - } - start = dir = type === "only" && !start && "nextSibling"; - } - return true; - } - - start = [ forward ? parent.firstChild : parent.lastChild ]; - - if ( forward && useCache ) { - outerCache = parent[ expando ] || (parent[ expando ] = {}); - cache = outerCache[ type ] || []; - nodeIndex = cache[0] === dirruns && cache[1]; - diff = cache[0] === dirruns && cache[2]; - node = nodeIndex && parent.childNodes[ nodeIndex ]; - - while ( (node = ++nodeIndex && node && node[ dir ] || - - (diff = nodeIndex = 0) || start.pop()) ) { - - if ( node.nodeType === 1 && ++diff && node === elem ) { - outerCache[ type ] = [ dirruns, nodeIndex, diff ]; - break; - } - } - - } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { - diff = cache[1]; - - } else { - while ( (node = ++nodeIndex && node && node[ dir ] || - (diff = nodeIndex = 0) || start.pop()) ) { - - if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { - if ( useCache ) { - (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; - } - - if ( node === elem ) { - break; - } - } - } - } - - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - if ( fn[ expando ] ) { - return fn( argument ); - } - - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction(function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf.call( seed, matched[i] ); - seed[ idx ] = !( matches[ idx ] = matched[i] ); - } - }) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - "not": markFunction(function( selector ) { - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction(function( seed, matches, context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - while ( i-- ) { - if ( (elem = unmatched[i]) ) { - seed[i] = !(matches[i] = elem); - } - } - }) : - function( elem, context, xml ) { - input[0] = elem; - matcher( input, null, xml, results ); - return !results.pop(); - }; - }), - - "has": markFunction(function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - }), - - "contains": markFunction(function( text ) { - return function( elem ) { - return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; - }; - }), - - "lang": markFunction( function( lang ) { - if ( !ridentifier.test(lang || "") ) { - Sizzle.error( "unsupported lang: " + lang ); - } - lang = lang.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - var elemLang; - do { - if ( (elemLang = documentIsHTML ? - elem.lang : - elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { - - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; - } - } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); - return false; - }; - }), - - "target": function( elem ) { - var hash = window.location && window.location.hash; - return hash && hash.slice( 1 ) === elem.id; - }, - - "root": function( elem ) { - return elem === docElem; - }, - - "focus": function( elem ) { - return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); - }, - - "enabled": function( elem ) { - return elem.disabled === false; - }, - - "disabled": function( elem ) { - return elem.disabled === true; - }, - - "checked": function( elem ) { - var nodeName = elem.nodeName.toLowerCase(); - return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); - }, - - "selected": function( elem ) { - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - "empty": function( elem ) { - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeType < 6 ) { - return false; - } - } - return true; - }, - - "parent": function( elem ) { - return !Expr.pseudos["empty"]( elem ); - }, - - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "text": function( elem ) { - var attr; - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && - - ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); - }, - - "first": createPositionalPseudo(function() { - return [ 0 ]; - }), - - "last": createPositionalPseudo(function( matchIndexes, length ) { - return [ length - 1 ]; - }), - - "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - }), - - "even": createPositionalPseudo(function( matchIndexes, length ) { - var i = 0; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "odd": createPositionalPseudo(function( matchIndexes, length ) { - var i = 1; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }) - } -}; - -Expr.pseudos["nth"] = Expr.pseudos["eq"]; - -for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { - Expr.pseudos[ i ] = createInputPseudo( i ); -} -for ( i in { submit: true, reset: true } ) { - Expr.pseudos[ i ] = createButtonPseudo( i ); -} - -function setFilters() {} -setFilters.prototype = Expr.filters = Expr.pseudos; -Expr.setFilters = new setFilters(); - -function tokenize( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ selector + " " ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - if ( !matched || (match = rcomma.exec( soFar )) ) { - if ( match ) { - soFar = soFar.slice( match[0].length ) || soFar; - } - groups.push( (tokens = []) ); - } - - matched = false; - - if ( (match = rcombinators.exec( soFar )) ) { - matched = match.shift(); - tokens.push({ - value: matched, - type: match[0].replace( rtrim, " " ) - }); - soFar = soFar.slice( matched.length ); - } - - for ( type in Expr.filter ) { - if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || - (match = preFilters[ type ]( match ))) ) { - matched = match.shift(); - tokens.push({ - value: matched, - type: type, - matches: match - }); - soFar = soFar.slice( matched.length ); - } - } - - if ( !matched ) { - break; - } - } - - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - tokenCache( selector, groups ).slice( 0 ); -} - -function toSelector( tokens ) { - var i = 0, - len = tokens.length, - selector = ""; - for ( ; i < len; i++ ) { - selector += tokens[i].value; - } - return selector; -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - checkNonElements = base && dir === "parentNode", - doneName = done++; - - return combinator.first ? - function( elem, context, xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - return matcher( elem, context, xml ); - } - } - } : - - function( elem, context, xml ) { - var oldCache, outerCache, - newCache = [ dirruns, doneName ]; - - if ( xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - if ( matcher( elem, context, xml ) ) { - return true; - } - } - } - } else { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - outerCache = elem[ expando ] || (elem[ expando ] = {}); - if ( (oldCache = outerCache[ dir ]) && - oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { - - return (newCache[ 2 ] = oldCache[ 2 ]); - } else { - outerCache[ dir ] = newCache; - - if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { - return true; - } - } - } - } - } - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[i]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[0]; -} - -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[i], results ); - } - return results; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( (elem = unmatched[i]) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction(function( seed, results, context, xml ) { - var temp, i, elem, - preMap = [], - postMap = [], - preexisting = results.length, - - elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), - - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, - - matcherOut = matcher ? - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - [] : - - results : - matcherIn; - - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); - - i = temp.length; - while ( i-- ) { - if ( (elem = temp[i]) ) { - matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); - } - } - } - - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) ) { - temp.push( (matcherIn[i] = elem) ); - } - } - postFinder( null, (matcherOut = []), temp, xml ); - } - - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) && - (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { - - seed[temp] = !(results[temp] = elem); - } - } - } - - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - }); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[0].type ], - implicitRelative = leadingRelative || Expr.relative[" "], - i = leadingRelative ? 1 : 0, - - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf.call( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - (checkContext = context).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - } ]; - - for ( ; i < len; i++ ) { - if ( (matcher = Expr.relative[ tokens[i].type ]) ) { - matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; - } else { - matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); - - if ( matcher[ expando ] ) { - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[j].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( - tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) - ).replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), - j < len && toSelector( tokens ) - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - var bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, outermost ) { - var elem, j, matcher, - matchedCount = 0, - i = "0", - unmatched = seed && [], - setMatched = [], - contextBackup = outermostContext, - elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), - dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), - len = elems.length; - - if ( outermost ) { - outermostContext = context !== document && context; - } - - for ( ; i !== len && (elem = elems[i]) != null; i++ ) { - if ( byElement && elem ) { - j = 0; - while ( (matcher = elementMatchers[j++]) ) { - if ( matcher( elem, context, xml ) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - } - } - - if ( bySet ) { - if ( (elem = !matcher && elem) ) { - matchedCount--; - } - - if ( seed ) { - unmatched.push( elem ); - } - } - } - - matchedCount += i; - if ( bySet && i !== matchedCount ) { - j = 0; - while ( (matcher = setMatchers[j++]) ) { - matcher( unmatched, setMatched, context, xml ); - } - - if ( seed ) { - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !(unmatched[i] || setMatched[i]) ) { - setMatched[i] = pop.call( results ); - } - } - } - - setMatched = condense( setMatched ); - } - - push.apply( results, setMatched ); - - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { - - Sizzle.uniqueSort( results ); - } - } - - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - - return unmatched; - }; - - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} - -compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ selector + " " ]; - - if ( !cached ) { - if ( !match ) { - match = tokenize( selector ); - } - i = match.length; - while ( i-- ) { - cached = matcherFromTokens( match[i] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } - - cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); - - cached.selector = selector; - } - return cached; -}; - -/** - * A low-level selection function that works with Sizzle's compiled - * selector functions - * @param {String|Function} selector A selector or a pre-compiled - * selector function built with Sizzle.compile - * @param {Element} context - * @param {Array} [results] - * @param {Array} [seed] A set of elements to match against - */ -select = Sizzle.select = function( selector, context, results, seed ) { - var i, tokens, token, type, find, - compiled = typeof selector === "function" && selector, - match = !seed && tokenize( (selector = compiled.selector || selector) ); - - results = results || []; - - if ( match.length === 1 ) { - - tokens = match[0] = match[0].slice( 0 ); - if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && - support.getById && context.nodeType === 9 && documentIsHTML && - Expr.relative[ tokens[1].type ] ) { - - context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; - if ( !context ) { - return results; - - } else if ( compiled ) { - context = context.parentNode; - } - - selector = selector.slice( tokens.shift().value.length ); - } - - i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[i]; - - if ( Expr.relative[ (type = token.type) ] ) { - break; - } - if ( (find = Expr.find[ type ]) ) { - if ( (seed = find( - token.matches[0].replace( runescape, funescape ), - rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context - )) ) { - - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, seed ); - return results; - } - - break; - } - } - } - } - - ( compiled || compile( selector, match ) )( - seed, - context, - !documentIsHTML, - results, - rsibling.test( selector ) && testContext( context.parentNode ) || context - ); - return results; -}; - - -support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; - -support.detectDuplicates = !!hasDuplicate; - -setDocument(); - -support.sortDetached = assert(function( div1 ) { - return div1.compareDocumentPosition( document.createElement("div") ) & 1; -}); - -if ( !assert(function( div ) { - div.innerHTML = ""; - return div.firstChild.getAttribute("href") === "#" ; -}) ) { - addHandle( "type|href|height|width", function( elem, name, isXML ) { - if ( !isXML ) { - return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); - } - }); -} - -if ( !support.attributes || !assert(function( div ) { - div.innerHTML = ""; - div.firstChild.setAttribute( "value", "" ); - return div.firstChild.getAttribute( "value" ) === ""; -}) ) { - addHandle( "value", function( elem, name, isXML ) { - if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { - return elem.defaultValue; - } - }); -} - -if ( !assert(function( div ) { - return div.getAttribute("disabled") == null; -}) ) { - addHandle( booleans, function( elem, name, isXML ) { - var val; - if ( !isXML ) { - return elem[ name ] === true ? name.toLowerCase() : - (val = elem.getAttributeNode( name )) && val.specified ? - val.value : - null; - } - }); -} - -if ( typeof define === "function" && define.amd ) { - define(function() { return Sizzle; }); -} else if ( typeof module !== "undefined" && module.exports ) { - module.exports = Sizzle; -} else { - window.Sizzle = Sizzle; -} - -})( window ); - -;(function(engine) { - var extendElements = Prototype.Selector.extendElements; - - function select(selector, scope) { - return extendElements(engine(selector, scope || document)); - } - - function match(element, selector) { - return engine.matches(selector, [element]).length == 1; - } - - Prototype.Selector.engine = engine; - Prototype.Selector.select = select; - Prototype.Selector.match = match; -})(Sizzle); - -window.Sizzle = Prototype._original_property; -delete Prototype._original_property; - -var Form = { - reset: function(form) { - form = $(form); - form.reset(); - return form; - }, - - serializeElements: function(elements, options) { - if (typeof options != 'object') options = { hash: !!options }; - else if (Object.isUndefined(options.hash)) options.hash = true; - var key, value, submitted = false, submit = options.submit, accumulator, initial; - - if (options.hash) { - initial = {}; - accumulator = function(result, key, value) { - if (key in result) { - if (!Object.isArray(result[key])) result[key] = [result[key]]; - result[key] = result[key].concat(value); - } else result[key] = value; - return result; - }; - } else { - initial = ''; - accumulator = function(result, key, values) { - if (!Object.isArray(values)) {values = [values];} - if (!values.length) {return result;} - var encodedKey = encodeURIComponent(key).gsub(/%20/, '+'); - return result + (result ? "&" : "") + values.map(function (value) { - value = value.gsub(/(\r)?\n/, '\r\n'); - value = encodeURIComponent(value); - value = value.gsub(/%20/, '+'); - return encodedKey + "=" + value; - }).join("&"); - }; - } - - return elements.inject(initial, function(result, element) { - if (!element.disabled && element.name) { - key = element.name; value = $(element).getValue(); - if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted && - submit !== false && (!submit || key == submit) && (submitted = true)))) { - result = accumulator(result, key, value); - } - } - return result; - }); - } -}; - -Form.Methods = { - serialize: function(form, options) { - return Form.serializeElements(Form.getElements(form), options); - }, - - - getElements: function(form) { - var elements = $(form).getElementsByTagName('*'); - var element, results = [], serializers = Form.Element.Serializers; - - for (var i = 0; element = elements[i]; i++) { - if (serializers[element.tagName.toLowerCase()]) - results.push(Element.extend(element)); - } - return results; - }, - - getInputs: function(form, typeName, name) { - form = $(form); - var inputs = form.getElementsByTagName('input'); - - if (!typeName && !name) return $A(inputs).map(Element.extend); - - for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) { - var input = inputs[i]; - if ((typeName && input.type != typeName) || (name && input.name != name)) - continue; - matchingInputs.push(Element.extend(input)); - } - - return matchingInputs; - }, - - disable: function(form) { - form = $(form); - Form.getElements(form).invoke('disable'); - return form; - }, - - enable: function(form) { - form = $(form); - Form.getElements(form).invoke('enable'); - return form; - }, - - findFirstElement: function(form) { - var elements = $(form).getElements().findAll(function(element) { - return 'hidden' != element.type && !element.disabled; - }); - var firstByIndex = elements.findAll(function(element) { - return element.hasAttribute('tabIndex') && element.tabIndex >= 0; - }).sortBy(function(element) { return element.tabIndex }).first(); - - return firstByIndex ? firstByIndex : elements.find(function(element) { - return /^(?:input|select|textarea)$/i.test(element.tagName); - }); - }, - - focusFirstElement: function(form) { - form = $(form); - var element = form.findFirstElement(); - if (element) element.activate(); - return form; - }, - - request: function(form, options) { - form = $(form), options = Object.clone(options || { }); - - var params = options.parameters, action = form.readAttribute('action') || ''; - if (action.blank()) action = window.location.href; - options.parameters = form.serialize(true); - - if (params) { - if (Object.isString(params)) params = params.toQueryParams(); - Object.extend(options.parameters, params); - } - - if (form.hasAttribute('method') && !options.method) - options.method = form.method; - - return new Ajax.Request(action, options); - } -}; - -/*--------------------------------------------------------------------------*/ - - -Form.Element = { - focus: function(element) { - $(element).focus(); - return element; - }, - - select: function(element) { - $(element).select(); - return element; - } -}; - -Form.Element.Methods = { - - serialize: function(element) { - element = $(element); - if (!element.disabled && element.name) { - var value = element.getValue(); - if (value != undefined) { - var pair = { }; - pair[element.name] = value; - return Object.toQueryString(pair); - } - } - return ''; - }, - - getValue: function(element) { - element = $(element); - var method = element.tagName.toLowerCase(); - return Form.Element.Serializers[method](element); - }, - - setValue: function(element, value) { - element = $(element); - var method = element.tagName.toLowerCase(); - Form.Element.Serializers[method](element, value); - return element; - }, - - clear: function(element) { - $(element).value = ''; - return element; - }, - - present: function(element) { - return $(element).value != ''; - }, - - activate: function(element) { - element = $(element); - try { - element.focus(); - if (element.select && (element.tagName.toLowerCase() != 'input' || - !(/^(?:button|reset|submit)$/i.test(element.type)))) - element.select(); - } catch (e) { } - return element; - }, - - disable: function(element) { - element = $(element); - element.disabled = true; - return element; - }, - - enable: function(element) { - element = $(element); - element.disabled = false; - return element; - } -}; - -/*--------------------------------------------------------------------------*/ - -var Field = Form.Element; - -var $F = Form.Element.Methods.getValue; - -/*--------------------------------------------------------------------------*/ - -Form.Element.Serializers = (function() { - function input(element, value) { - switch (element.type.toLowerCase()) { - case 'checkbox': - case 'radio': - return inputSelector(element, value); - default: - return valueSelector(element, value); - } - } - - function inputSelector(element, value) { - if (Object.isUndefined(value)) - return element.checked ? element.value : null; - else element.checked = !!value; - } - - function valueSelector(element, value) { - if (Object.isUndefined(value)) return element.value; - else element.value = value; - } - - function select(element, value) { - if (Object.isUndefined(value)) - return (element.type === 'select-one' ? selectOne : selectMany)(element); - - var opt, currentValue, single = !Object.isArray(value); - for (var i = 0, length = element.length; i < length; i++) { - opt = element.options[i]; - currentValue = this.optionValue(opt); - if (single) { - if (currentValue == value) { - opt.selected = true; - return; - } - } - else opt.selected = value.include(currentValue); - } - } - - function selectOne(element) { - var index = element.selectedIndex; - return index >= 0 ? optionValue(element.options[index]) : null; - } - - function selectMany(element) { - var values, length = element.length; - if (!length) return null; - - for (var i = 0, values = []; i < length; i++) { - var opt = element.options[i]; - if (opt.selected) values.push(optionValue(opt)); - } - return values; - } - - function optionValue(opt) { - return Element.hasAttribute(opt, 'value') ? opt.value : opt.text; - } - - return { - input: input, - inputSelector: inputSelector, - textarea: valueSelector, - select: select, - selectOne: selectOne, - selectMany: selectMany, - optionValue: optionValue, - button: valueSelector - }; -})(); - -/*--------------------------------------------------------------------------*/ - - -Abstract.TimedObserver = Class.create(PeriodicalExecuter, { - initialize: function($super, element, frequency, callback) { - $super(callback, frequency); - this.element = $(element); - this.lastValue = this.getValue(); - }, - - execute: function() { - var value = this.getValue(); - if (Object.isString(this.lastValue) && Object.isString(value) ? - this.lastValue != value : String(this.lastValue) != String(value)) { - this.callback(this.element, value); - this.lastValue = value; - } - } -}); - -Form.Element.Observer = Class.create(Abstract.TimedObserver, { - getValue: function() { - return Form.Element.getValue(this.element); - } -}); - -Form.Observer = Class.create(Abstract.TimedObserver, { - getValue: function() { - return Form.serialize(this.element); - } -}); - -/*--------------------------------------------------------------------------*/ - -Abstract.EventObserver = Class.create({ - initialize: function(element, callback) { - this.element = $(element); - this.callback = callback; - - this.lastValue = this.getValue(); - if (this.element.tagName.toLowerCase() == 'form') - this.registerFormCallbacks(); - else - this.registerCallback(this.element); - }, - - onElementEvent: function() { - var value = this.getValue(); - if (this.lastValue != value) { - this.callback(this.element, value); - this.lastValue = value; - } - }, - - registerFormCallbacks: function() { - Form.getElements(this.element).each(this.registerCallback, this); - }, - - registerCallback: function(element) { - if (element.type) { - switch (element.type.toLowerCase()) { - case 'checkbox': - case 'radio': - Event.observe(element, 'click', this.onElementEvent.bind(this)); - break; - default: - Event.observe(element, 'change', this.onElementEvent.bind(this)); - break; - } - } - } -}); - -Form.Element.EventObserver = Class.create(Abstract.EventObserver, { - getValue: function() { - return Form.Element.getValue(this.element); - } -}); - -Form.EventObserver = Class.create(Abstract.EventObserver, { - getValue: function() { - return Form.serialize(this.element); - } -}); -(function(GLOBAL) { - var DIV = document.createElement('div'); - var docEl = document.documentElement; - var MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED = 'onmouseenter' in docEl - && 'onmouseleave' in docEl; - - var Event = { - KEY_BACKSPACE: 8, - KEY_TAB: 9, - KEY_RETURN: 13, - KEY_ESC: 27, - KEY_LEFT: 37, - KEY_UP: 38, - KEY_RIGHT: 39, - KEY_DOWN: 40, - KEY_DELETE: 46, - KEY_HOME: 36, - KEY_END: 35, - KEY_PAGEUP: 33, - KEY_PAGEDOWN: 34, - KEY_INSERT: 45 - }; - - - var isIELegacyEvent = function(event) { return false; }; - - if (window.attachEvent) { - if (window.addEventListener) { - isIELegacyEvent = function(event) { - return !(event instanceof window.Event); - }; - } else { - isIELegacyEvent = function(event) { return true; }; - } - } - - var _isButton; - - function _isButtonForDOMEvents(event, code) { - return event.which ? (event.which === code + 1) : (event.button === code); - } - - var legacyButtonMap = { 0: 1, 1: 4, 2: 2 }; - function _isButtonForLegacyEvents(event, code) { - return event.button === legacyButtonMap[code]; - } - - function _isButtonForWebKit(event, code) { - switch (code) { - case 0: return event.which == 1 && !event.metaKey; - case 1: return event.which == 2 || (event.which == 1 && event.metaKey); - case 2: return event.which == 3; - default: return false; - } - } - - if (window.attachEvent) { - if (!window.addEventListener) { - _isButton = _isButtonForLegacyEvents; - } else { - _isButton = function(event, code) { - return isIELegacyEvent(event) ? _isButtonForLegacyEvents(event, code) : - _isButtonForDOMEvents(event, code); - } - } - } else if (Prototype.Browser.WebKit) { - _isButton = _isButtonForWebKit; - } else { - _isButton = _isButtonForDOMEvents; - } - - function isLeftClick(event) { return _isButton(event, 0) } - - function isMiddleClick(event) { return _isButton(event, 1) } - - function isRightClick(event) { return _isButton(event, 2) } - - function element(event) { - return Element.extend(_element(event)); - } - - function _element(event) { - event = Event.extend(event); - - var node = event.target, type = event.type, - currentTarget = event.currentTarget; - - if (currentTarget && currentTarget.tagName) { - if (type === 'load' || type === 'error' || - (type === 'click' && currentTarget.tagName.toLowerCase() === 'input' - && currentTarget.type === 'radio')) - node = currentTarget; - } - - return node.nodeType == Node.TEXT_NODE ? node.parentNode : node; - } - - function findElement(event, expression) { - var element = _element(event), selector = Prototype.Selector; - if (!expression) return Element.extend(element); - while (element) { - if (Object.isElement(element) && selector.match(element, expression)) - return Element.extend(element); - element = element.parentNode; - } - } - - function pointer(event) { - return { x: pointerX(event), y: pointerY(event) }; - } - - function pointerX(event) { - var docElement = document.documentElement, - body = document.body || { scrollLeft: 0 }; - - return event.pageX || (event.clientX + - (docElement.scrollLeft || body.scrollLeft) - - (docElement.clientLeft || 0)); - } - - function pointerY(event) { - var docElement = document.documentElement, - body = document.body || { scrollTop: 0 }; - - return event.pageY || (event.clientY + - (docElement.scrollTop || body.scrollTop) - - (docElement.clientTop || 0)); - } - - - function stop(event) { - Event.extend(event); - event.preventDefault(); - event.stopPropagation(); - - event.stopped = true; - } - - - Event.Methods = { - isLeftClick: isLeftClick, - isMiddleClick: isMiddleClick, - isRightClick: isRightClick, - - element: element, - findElement: findElement, - - pointer: pointer, - pointerX: pointerX, - pointerY: pointerY, - - stop: stop - }; - - var methods = Object.keys(Event.Methods).inject({ }, function(m, name) { - m[name] = Event.Methods[name].methodize(); - return m; - }); - - if (window.attachEvent) { - function _relatedTarget(event) { - var element; - switch (event.type) { - case 'mouseover': - case 'mouseenter': - element = event.fromElement; - break; - case 'mouseout': - case 'mouseleave': - element = event.toElement; - break; - default: - return null; - } - return Element.extend(element); - } - - var additionalMethods = { - stopPropagation: function() { this.cancelBubble = true }, - preventDefault: function() { this.returnValue = false }, - inspect: function() { return '[object Event]' } - }; - - Event.extend = function(event, element) { - if (!event) return false; - - if (!isIELegacyEvent(event)) return event; - - if (event._extendedByPrototype) return event; - event._extendedByPrototype = Prototype.emptyFunction; - - var pointer = Event.pointer(event); - - Object.extend(event, { - target: event.srcElement || element, - relatedTarget: _relatedTarget(event), - pageX: pointer.x, - pageY: pointer.y - }); - - Object.extend(event, methods); - Object.extend(event, additionalMethods); - - return event; - }; - } else { - Event.extend = Prototype.K; - } - - if (window.addEventListener) { - Event.prototype = window.Event.prototype || document.createEvent('HTMLEvents').__proto__; - Object.extend(Event.prototype, methods); - } - - var EVENT_TRANSLATIONS = { - mouseenter: 'mouseover', - mouseleave: 'mouseout' - }; - - function getDOMEventName(eventName) { - return EVENT_TRANSLATIONS[eventName] || eventName; - } - - if (MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED) - getDOMEventName = Prototype.K; - - function getUniqueElementID(element) { - if (element === window) return 0; - - if (typeof element._prototypeUID === 'undefined') - element._prototypeUID = Element.Storage.UID++; - return element._prototypeUID; - } - - function getUniqueElementID_IE(element) { - if (element === window) return 0; - if (element == document) return 1; - return element.uniqueID; - } - - if ('uniqueID' in DIV) - getUniqueElementID = getUniqueElementID_IE; - - function isCustomEvent(eventName) { - return eventName.include(':'); - } - - Event._isCustomEvent = isCustomEvent; - - function getRegistryForElement(element, uid) { - var CACHE = GLOBAL.Event.cache; - if (Object.isUndefined(uid)) - uid = getUniqueElementID(element); - if (!CACHE[uid]) CACHE[uid] = { element: element }; - return CACHE[uid]; - } - - function destroyRegistryForElement(element, uid) { - if (Object.isUndefined(uid)) - uid = getUniqueElementID(element); - delete GLOBAL.Event.cache[uid]; - } - - - function register(element, eventName, handler) { - var registry = getRegistryForElement(element); - if (!registry[eventName]) registry[eventName] = []; - var entries = registry[eventName]; - - var i = entries.length; - while (i--) - if (entries[i].handler === handler) return null; - - var uid = getUniqueElementID(element); - var responder = GLOBAL.Event._createResponder(uid, eventName, handler); - var entry = { - responder: responder, - handler: handler - }; - - entries.push(entry); - return entry; - } - - function unregister(element, eventName, handler) { - var registry = getRegistryForElement(element); - var entries = registry[eventName]; - if (!entries) return; - - var i = entries.length, entry; - while (i--) { - if (entries[i].handler === handler) { - entry = entries[i]; - break; - } - } - - if (!entry) return; - - var index = entries.indexOf(entry); - entries.splice(index, 1); - - return entry; - } - - - function observe(element, eventName, handler) { - element = $(element); - var entry = register(element, eventName, handler); - - if (entry === null) return element; - - var responder = entry.responder; - if (isCustomEvent(eventName)) - observeCustomEvent(element, eventName, responder); - else - observeStandardEvent(element, eventName, responder); - - return element; - } - - function observeStandardEvent(element, eventName, responder) { - var actualEventName = getDOMEventName(eventName); - if (element.addEventListener) { - element.addEventListener(actualEventName, responder, false); - } else { - element.attachEvent('on' + actualEventName, responder); - } - } - - function observeCustomEvent(element, eventName, responder) { - if (element.addEventListener) { - element.addEventListener('dataavailable', responder, false); - } else { - element.attachEvent('ondataavailable', responder); - element.attachEvent('onlosecapture', responder); - } - } - - function stopObserving(element, eventName, handler) { - element = $(element); - var handlerGiven = !Object.isUndefined(handler), - eventNameGiven = !Object.isUndefined(eventName); - - if (!eventNameGiven && !handlerGiven) { - stopObservingElement(element); - return element; - } - - if (!handlerGiven) { - stopObservingEventName(element, eventName); - return element; - } - - var entry = unregister(element, eventName, handler); - - if (!entry) return element; - removeEvent(element, eventName, entry.responder); - return element; - } - - function stopObservingStandardEvent(element, eventName, responder) { - var actualEventName = getDOMEventName(eventName); - if (element.removeEventListener) { - element.removeEventListener(actualEventName, responder, false); - } else { - element.detachEvent('on' + actualEventName, responder); - } - } - - function stopObservingCustomEvent(element, eventName, responder) { - if (element.removeEventListener) { - element.removeEventListener('dataavailable', responder, false); - } else { - element.detachEvent('ondataavailable', responder); - element.detachEvent('onlosecapture', responder); - } - } - - - - function stopObservingElement(element) { - var uid = getUniqueElementID(element), registry = GLOBAL.Event.cache[uid]; - if (!registry) return; - - destroyRegistryForElement(element, uid); - - var entries, i; - for (var eventName in registry) { - if (eventName === 'element') continue; - - entries = registry[eventName]; - i = entries.length; - while (i--) - removeEvent(element, eventName, entries[i].responder); - } - } - - function stopObservingEventName(element, eventName) { - var registry = getRegistryForElement(element); - var entries = registry[eventName]; - if (!entries) return; - delete registry[eventName]; - - var i = entries.length; - while (i--) - removeEvent(element, eventName, entries[i].responder); - } - - - function removeEvent(element, eventName, handler) { - if (isCustomEvent(eventName)) - stopObservingCustomEvent(element, eventName, handler); - else - stopObservingStandardEvent(element, eventName, handler); - } - - - - function getFireTarget(element) { - if (element !== document) return element; - if (document.createEvent && !element.dispatchEvent) - return document.documentElement; - return element; - } - - function fire(element, eventName, memo, bubble) { - element = getFireTarget($(element)); - if (Object.isUndefined(bubble)) bubble = true; - memo = memo || {}; - - var event = fireEvent(element, eventName, memo, bubble); - return Event.extend(event); - } - - function fireEvent_DOM(element, eventName, memo, bubble) { - var event = document.createEvent('HTMLEvents'); - event.initEvent('dataavailable', bubble, true); - - event.eventName = eventName; - event.memo = memo; - - element.dispatchEvent(event); - return event; - } - - function fireEvent_IE(element, eventName, memo, bubble) { - var event = document.createEventObject(); - event.eventType = bubble ? 'ondataavailable' : 'onlosecapture'; - - event.eventName = eventName; - event.memo = memo; - - element.fireEvent(event.eventType, event); - return event; - } - - var fireEvent = document.createEvent ? fireEvent_DOM : fireEvent_IE; - - - - Event.Handler = Class.create({ - initialize: function(element, eventName, selector, callback) { - this.element = $(element); - this.eventName = eventName; - this.selector = selector; - this.callback = callback; - this.handler = this.handleEvent.bind(this); - }, - - - start: function() { - Event.observe(this.element, this.eventName, this.handler); - return this; - }, - - stop: function() { - Event.stopObserving(this.element, this.eventName, this.handler); - return this; - }, - - handleEvent: function(event) { - var element = Event.findElement(event, this.selector); - if (element) this.callback.call(this.element, event, element); - } - }); - - function on(element, eventName, selector, callback) { - element = $(element); - if (Object.isFunction(selector) && Object.isUndefined(callback)) { - callback = selector, selector = null; - } - - return new Event.Handler(element, eventName, selector, callback).start(); - } - - Object.extend(Event, Event.Methods); - - Object.extend(Event, { - fire: fire, - observe: observe, - stopObserving: stopObserving, - on: on - }); - - Element.addMethods({ - fire: fire, - - observe: observe, - - stopObserving: stopObserving, - - on: on - }); - - Object.extend(document, { - fire: fire.methodize(), - - observe: observe.methodize(), - - stopObserving: stopObserving.methodize(), - - on: on.methodize(), - - loaded: false - }); - - if (GLOBAL.Event) Object.extend(window.Event, Event); - else GLOBAL.Event = Event; - - GLOBAL.Event.cache = {}; - - function destroyCache_IE() { - GLOBAL.Event.cache = null; - } - - if (window.attachEvent) - window.attachEvent('onunload', destroyCache_IE); - - DIV = null; - docEl = null; -})(this); - -(function(GLOBAL) { - /* Code for creating leak-free event responders is based on work by - John-David Dalton. */ - - var docEl = document.documentElement; - var MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED = 'onmouseenter' in docEl - && 'onmouseleave' in docEl; - - function isSimulatedMouseEnterLeaveEvent(eventName) { - return !MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED && - (eventName === 'mouseenter' || eventName === 'mouseleave'); - } - - function createResponder(uid, eventName, handler) { - if (Event._isCustomEvent(eventName)) - return createResponderForCustomEvent(uid, eventName, handler); - if (isSimulatedMouseEnterLeaveEvent(eventName)) - return createMouseEnterLeaveResponder(uid, eventName, handler); - - return function(event) { - if (!Event.cache) return; - - var element = Event.cache[uid].element; - Event.extend(event, element); - handler.call(element, event); - }; - } - - function createResponderForCustomEvent(uid, eventName, handler) { - return function(event) { - var element = Event.cache[uid].element; - - if (Object.isUndefined(event.eventName)) - return false; - - if (event.eventName !== eventName) - return false; - - Event.extend(event, element); - handler.call(element, event); - }; - } - - function createMouseEnterLeaveResponder(uid, eventName, handler) { - return function(event) { - var element = Event.cache[uid].element; - - Event.extend(event, element); - var parent = event.relatedTarget; - - while (parent && parent !== element) { - try { parent = parent.parentNode; } - catch(e) { parent = element; } - } - - if (parent === element) return; - handler.call(element, event); - } - } - - GLOBAL.Event._createResponder = createResponder; - docEl = null; -})(this); - -(function(GLOBAL) { - /* Support for the DOMContentLoaded event is based on work by Dan Webb, - Matthias Miller, Dean Edwards, John Resig, and Diego Perini. */ - - var TIMER; - - function fireContentLoadedEvent() { - if (document.loaded) return; - if (TIMER) window.clearTimeout(TIMER); - document.loaded = true; - document.fire('dom:loaded'); - } - - function checkReadyState() { - if (document.readyState === 'complete') { - document.detachEvent('onreadystatechange', checkReadyState); - fireContentLoadedEvent(); - } - } - - function pollDoScroll() { - try { - document.documentElement.doScroll('left'); - } catch (e) { - TIMER = pollDoScroll.defer(); - return; - } - - fireContentLoadedEvent(); - } - - - if (document.readyState === 'complete') { - fireContentLoadedEvent(); - return; - } - - if (document.addEventListener) { - document.addEventListener('DOMContentLoaded', fireContentLoadedEvent, false); - } else { - document.attachEvent('onreadystatechange', checkReadyState); - if (window == top) TIMER = pollDoScroll.defer(); - } - - Event.observe(window, 'load', fireContentLoadedEvent); -})(this); - - -Element.addMethods(); -/*------------------------------- DEPRECATED -------------------------------*/ - -Hash.toQueryString = Object.toQueryString; - -var Toggle = { display: Element.toggle }; - -Element.Methods.childOf = Element.Methods.descendantOf; - -var Insertion = { - Before: function(element, content) { - return Element.insert(element, {before:content}); - }, - - Top: function(element, content) { - return Element.insert(element, {top:content}); - }, - - Bottom: function(element, content) { - return Element.insert(element, {bottom:content}); - }, - - After: function(element, content) { - return Element.insert(element, {after:content}); - } -}; - -var $continue = new Error('"throw $continue" is deprecated, use "return" instead'); - -var Position = { - includeScrollOffsets: false, - - prepare: function() { - this.deltaX = window.pageXOffset - || document.documentElement.scrollLeft - || document.body.scrollLeft - || 0; - this.deltaY = window.pageYOffset - || document.documentElement.scrollTop - || document.body.scrollTop - || 0; - }, - - within: function(element, x, y) { - if (this.includeScrollOffsets) - return this.withinIncludingScrolloffsets(element, x, y); - this.xcomp = x; - this.ycomp = y; - this.offset = Element.cumulativeOffset(element); - - return (y >= this.offset[1] && - y < this.offset[1] + element.offsetHeight && - x >= this.offset[0] && - x < this.offset[0] + element.offsetWidth); - }, - - withinIncludingScrolloffsets: function(element, x, y) { - var offsetcache = Element.cumulativeScrollOffset(element); - - this.xcomp = x + offsetcache[0] - this.deltaX; - this.ycomp = y + offsetcache[1] - this.deltaY; - this.offset = Element.cumulativeOffset(element); - - return (this.ycomp >= this.offset[1] && - this.ycomp < this.offset[1] + element.offsetHeight && - this.xcomp >= this.offset[0] && - this.xcomp < this.offset[0] + element.offsetWidth); - }, - - overlap: function(mode, element) { - if (!mode) return 0; - if (mode == 'vertical') - return ((this.offset[1] + element.offsetHeight) - this.ycomp) / - element.offsetHeight; - if (mode == 'horizontal') - return ((this.offset[0] + element.offsetWidth) - this.xcomp) / - element.offsetWidth; - }, - - - cumulativeOffset: Element.Methods.cumulativeOffset, - - positionedOffset: Element.Methods.positionedOffset, - - absolutize: function(element) { - Position.prepare(); - return Element.absolutize(element); - }, - - relativize: function(element) { - Position.prepare(); - return Element.relativize(element); - }, - - realOffset: Element.Methods.cumulativeScrollOffset, - - offsetParent: Element.Methods.getOffsetParent, - - page: Element.Methods.viewportOffset, - - clone: function(source, target, options) { - options = options || { }; - return Element.clonePosition(target, source, options); - } -}; - -/*--------------------------------------------------------------------------*/ - -if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){ - function iter(name) { - return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]"; - } - - instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ? - function(element, className) { - className = className.toString().strip(); - var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className); - return cond ? document._getElementsByXPath('.//*' + cond, element) : []; - } : function(element, className) { - className = className.toString().strip(); - var elements = [], classNames = (/\s/.test(className) ? $w(className) : null); - if (!classNames && !className) return elements; - - var nodes = $(element).getElementsByTagName('*'); - className = ' ' + className + ' '; - - for (var i = 0, child, cn; child = nodes[i]; i++) { - if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) || - (classNames && classNames.all(function(name) { - return !name.toString().blank() && cn.include(' ' + name + ' '); - })))) - elements.push(Element.extend(child)); - } - return elements; - }; - - return function(className, parentElement) { - return $(parentElement || document.body).getElementsByClassName(className); - }; -}(Element.Methods); - -/*--------------------------------------------------------------------------*/ - -Element.ClassNames = Class.create(); -Element.ClassNames.prototype = { - initialize: function(element) { - this.element = $(element); - }, - - _each: function(iterator, context) { - this.element.className.split(/\s+/).select(function(name) { - return name.length > 0; - })._each(iterator, context); - }, - - set: function(className) { - this.element.className = className; - }, - - add: function(classNameToAdd) { - if (this.include(classNameToAdd)) return; - this.set($A(this).concat(classNameToAdd).join(' ')); - }, - - remove: function(classNameToRemove) { - if (!this.include(classNameToRemove)) return; - this.set($A(this).without(classNameToRemove).join(' ')); - }, - - toString: function() { - return $A(this).join(' '); - } -}; - -Object.extend(Element.ClassNames.prototype, Enumerable); - -/*--------------------------------------------------------------------------*/ - -(function() { - window.Selector = Class.create({ - initialize: function(expression) { - this.expression = expression.strip(); - }, - - findElements: function(rootElement) { - return Prototype.Selector.select(this.expression, rootElement); - }, - - match: function(element) { - return Prototype.Selector.match(element, this.expression); - }, - - toString: function() { - return this.expression; - }, - - inspect: function() { - return "#"; - } - }); - - Object.extend(Selector, { - matchElements: function(elements, expression) { - var match = Prototype.Selector.match, - results = []; - - for (var i = 0, length = elements.length; i < length; i++) { - var element = elements[i]; - if (match(element, expression)) { - results.push(Element.extend(element)); - } - } - return results; - }, - - findElement: function(elements, expression, index) { - index = index || 0; - var matchIndex = 0, element; - for (var i = 0, length = elements.length; i < length; i++) { - element = elements[i]; - if (Prototype.Selector.match(element, expression) && index === matchIndex++) { - return Element.extend(element); - } - } - }, - - findChildElements: function(element, expressions) { - var selector = expressions.toArray().join(', '); - return Prototype.Selector.select(selector, element || document); - } - }); -})(); diff --git a/UI/WebServerResources/quota-level-alert.png b/UI/WebServerResources/quota-level-alert.png deleted file mode 100644 index 5ac2167b7..000000000 Binary files a/UI/WebServerResources/quota-level-alert.png and /dev/null differ diff --git a/UI/WebServerResources/quota-level-ok.png b/UI/WebServerResources/quota-level-ok.png deleted file mode 100644 index b9ae3ae38..000000000 Binary files a/UI/WebServerResources/quota-level-ok.png and /dev/null differ diff --git a/UI/WebServerResources/quota-level-warn.png b/UI/WebServerResources/quota-level-warn.png deleted file mode 100644 index 793091a8b..000000000 Binary files a/UI/WebServerResources/quota-level-warn.png and /dev/null differ diff --git a/UI/WebServerResources/quota-level.png b/UI/WebServerResources/quota-level.png deleted file mode 100644 index c242fbb8e..000000000 Binary files a/UI/WebServerResources/quota-level.png and /dev/null differ diff --git a/UI/WebServerResources/read-messages.png b/UI/WebServerResources/read-messages.png deleted file mode 100644 index 35ecce1c6..000000000 Binary files a/UI/WebServerResources/read-messages.png and /dev/null differ diff --git a/UI/WebServerResources/remote-addrbook.png b/UI/WebServerResources/remote-addrbook.png deleted file mode 100644 index 56750b722..000000000 Binary files a/UI/WebServerResources/remote-addrbook.png and /dev/null differ diff --git a/UI/WebServerResources/remove-addressbook.png b/UI/WebServerResources/remove-addressbook.png deleted file mode 100644 index 53bad2982..000000000 Binary files a/UI/WebServerResources/remove-addressbook.png and /dev/null differ diff --git a/UI/WebServerResources/remove-calendar.png b/UI/WebServerResources/remove-calendar.png deleted file mode 100644 index c60dcebd5..000000000 Binary files a/UI/WebServerResources/remove-calendar.png and /dev/null differ diff --git a/UI/WebServerResources/remove-contact.gif b/UI/WebServerResources/remove-contact.gif deleted file mode 100644 index c2754711b..000000000 Binary files a/UI/WebServerResources/remove-contact.gif and /dev/null differ diff --git a/UI/WebServerResources/remove-icon.png b/UI/WebServerResources/remove-icon.png deleted file mode 100644 index 105e25905..000000000 Binary files a/UI/WebServerResources/remove-icon.png and /dev/null differ diff --git a/UI/WebServerResources/search-messages.png b/UI/WebServerResources/search-messages.png deleted file mode 100644 index a85b0130f..000000000 Binary files a/UI/WebServerResources/search-messages.png and /dev/null differ diff --git a/UI/WebServerResources/signature-not-ok.png b/UI/WebServerResources/signature-not-ok.png deleted file mode 100644 index 34df3bffd..000000000 Binary files a/UI/WebServerResources/signature-not-ok.png and /dev/null differ diff --git a/UI/WebServerResources/signature-ok.png b/UI/WebServerResources/signature-ok.png deleted file mode 100644 index 03ec5ecf0..000000000 Binary files a/UI/WebServerResources/signature-ok.png and /dev/null differ diff --git a/UI/WebServerResources/slider_handle.gif b/UI/WebServerResources/slider_handle.gif deleted file mode 100644 index 28de71905..000000000 Binary files a/UI/WebServerResources/slider_handle.gif and /dev/null differ diff --git a/UI/WebServerResources/smalltoolbarbtn_a_bg.png b/UI/WebServerResources/smalltoolbarbtn_a_bg.png deleted file mode 100644 index fff491ce3..000000000 Binary files a/UI/WebServerResources/smalltoolbarbtn_a_bg.png and /dev/null differ diff --git a/UI/WebServerResources/smalltoolbarbtn_span_bg.png b/UI/WebServerResources/smalltoolbarbtn_span_bg.png deleted file mode 100644 index cb69e6057..000000000 Binary files a/UI/WebServerResources/smalltoolbarbtn_span_bg.png and /dev/null differ diff --git a/UI/WebServerResources/sogo-logo.png b/UI/WebServerResources/sogo-logo.png deleted file mode 100644 index 542c0b920..000000000 Binary files a/UI/WebServerResources/sogo-logo.png and /dev/null differ diff --git a/UI/WebServerResources/sogo.ico b/UI/WebServerResources/sogo.ico deleted file mode 100644 index 4d5cb322f..000000000 Binary files a/UI/WebServerResources/sogo.ico and /dev/null differ diff --git a/UI/WebServerResources/status.vacation-msg.png b/UI/WebServerResources/status.vacation-msg.png deleted file mode 100644 index 5648fc392..000000000 Binary files a/UI/WebServerResources/status.vacation-msg.png and /dev/null differ diff --git a/UI/WebServerResources/submenu-active.gif b/UI/WebServerResources/submenu-active.gif deleted file mode 100644 index 123c9f8e6..000000000 Binary files a/UI/WebServerResources/submenu-active.gif and /dev/null differ diff --git a/UI/WebServerResources/submenu-disabled.gif b/UI/WebServerResources/submenu-disabled.gif deleted file mode 100644 index f24a802f0..000000000 Binary files a/UI/WebServerResources/submenu-disabled.gif and /dev/null differ diff --git a/UI/WebServerResources/submenu.gif b/UI/WebServerResources/submenu.gif deleted file mode 100644 index c5f8fcaaa..000000000 Binary files a/UI/WebServerResources/submenu.gif and /dev/null differ diff --git a/UI/WebServerResources/tab_a_active_bg.png b/UI/WebServerResources/tab_a_active_bg.png deleted file mode 100644 index 0cf4c9b05..000000000 Binary files a/UI/WebServerResources/tab_a_active_bg.png and /dev/null differ diff --git a/UI/WebServerResources/tab_a_inactive_bg.png b/UI/WebServerResources/tab_a_inactive_bg.png deleted file mode 100644 index ad0453c5f..000000000 Binary files a/UI/WebServerResources/tab_a_inactive_bg.png and /dev/null differ diff --git a/UI/WebServerResources/tab_left_active.gif b/UI/WebServerResources/tab_left_active.gif deleted file mode 100644 index 888f608fc..000000000 Binary files a/UI/WebServerResources/tab_left_active.gif and /dev/null differ diff --git a/UI/WebServerResources/tab_left_inactive.gif b/UI/WebServerResources/tab_left_inactive.gif deleted file mode 100644 index c03796560..000000000 Binary files a/UI/WebServerResources/tab_left_inactive.gif and /dev/null differ diff --git a/UI/WebServerResources/tab_right_active.gif b/UI/WebServerResources/tab_right_active.gif deleted file mode 100644 index 7dedbc891..000000000 Binary files a/UI/WebServerResources/tab_right_active.gif and /dev/null differ diff --git a/UI/WebServerResources/tab_right_inactive.gif b/UI/WebServerResources/tab_right_inactive.gif deleted file mode 100644 index a64c7e4a9..000000000 Binary files a/UI/WebServerResources/tab_right_inactive.gif and /dev/null differ diff --git a/UI/WebServerResources/tab_span_active_bg.png b/UI/WebServerResources/tab_span_active_bg.png deleted file mode 100644 index 7b0f79996..000000000 Binary files a/UI/WebServerResources/tab_span_active_bg.png and /dev/null differ diff --git a/UI/WebServerResources/tab_span_inactive_bg.png b/UI/WebServerResources/tab_span_inactive_bg.png deleted file mode 100644 index 675e43ea8..000000000 Binary files a/UI/WebServerResources/tab_span_inactive_bg.png and /dev/null differ diff --git a/UI/WebServerResources/tablekit-sogo.js b/UI/WebServerResources/tablekit-sogo.js deleted file mode 100644 index f50ae3382..000000000 --- a/UI/WebServerResources/tablekit-sogo.js +++ /dev/null @@ -1,13 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -Object.extend(TableKit, { - getHeaderCells : function(table, cell) { - if(!table) { table = $(cell).up('table'); } - var id = table.id; - if(!TableKit.tables[id].dom.head) { - // If there are tHead parts, use the first part, not the last one. - TableKit.tables[id].dom.head = $A((table.tHead && table.tHead.rows.length > 0) ? table.tHead.rows[0].cells : table.rows[0].cells); - } - return TableKit.tables[id].dom.head; - } - }); diff --git a/UI/WebServerResources/tablekit-trueresize.js b/UI/WebServerResources/tablekit-trueresize.js deleted file mode 100644 index 3370834ad..000000000 --- a/UI/WebServerResources/tablekit-trueresize.js +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/** - * 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'}); - } - } - } -}); \ No newline at end of file diff --git a/UI/WebServerResources/tablekit.js b/UI/WebServerResources/tablekit.js deleted file mode 100644 index 4287e17fc..000000000 --- a/UI/WebServerResources/tablekit.js +++ /dev/null @@ -1,945 +0,0 @@ -/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* -* -* Copyright (c) 2007 Andrew Tetlaw & Millstream Web Software -* http://www.millstream.com.au/view/code/tablekit/ -* Version: 1.3b 2008-03-23 -* Modified and improved by Inverse inc. -* -* 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.tables[id].dom.rows) { - TableKit.tables[id].dom.rows = (table.tHead && table.tHead.rows.length > 0) ? $A(table.tBodies[0].rows) : $A(table.rows).without(table.rows[0]); - } - return TableKit.tables[id].dom.rows; - }, - getHeaderCells : function(table, cell) { - if(!table) { table = $(cell).up('table'); } - var id = table.id; - if(!TableKit.tables[id].dom.head) { - TableKit.tables[id].dom.head = $A((table.tHead && table.tHead.rows.length > 0) ? table.tHead.rows[table.tHead.rows.length-1].cells : table.rows[0].cells); - } - return TableKit.tables[id].dom.head; - }, - 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 ""; } - var data = TableKit.getCellData(cell); - if(refresh || data.refresh || !data.textContent) { - data.textContent = cell.textContent ? cell.textContent : cell.innerText; - data.refresh = false; - } - return data.textContent; - }, - getCellData : function(cell) { - var t = null; - if(!cell.id) { - t = $(cell).up('table'); - cell.id = t.id + "-cell-" + TableKit._getc(); - } - var tblid = t ? t.id : cell.id.match(/(.*)-cell.*/)[1]; - if(!TableKit.tables[tblid].dom.cells[cell.id]) { - TableKit.tables[tblid].dom.cells[cell.id] = {textContent : '', htmlContent : '', active : false}; - } - return TableKit.tables[tblid].dom.cells[cell.id]; - }, - register : function(table, options) { - if(!table.id) { - table.id = "tablekit-table-" + TableKit._getc(); - } - var id = table.id; - TableKit.tables[id] = TableKit.tables[id] ? - Object.extend(TableKit.tables[id], options || {}) : - Object.extend( - {dom : {head:null,rows:null,cells:{}},sortable:false,resizable:false,editable:false}, - options || {} - ); - }, - notify : function(eventName, table, event) { - if(TableKit.tables[table.id] && TableKit.tables[table.id].observers && TableKit.tables[table.id].observers[eventName]) { - TableKit.tables[table.id].observers[eventName](table, event); - } - TableKit.options.observers[eventName](table, event)(); - }, - 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 : {}, - options : { - autoLoad : true, - stripe : true, - sortable : true, - resizable : true, - editable : true, - rowEvenClass : 'roweven', - rowOddClass : 'rowodd', - sortableSelector : ['table.sortable'], - columnClass : 'sortcol', - descendingClass : 'sortdesc', - ascendingClass : 'sortasc', - defaultSortDirection : 1, - 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 : {}, - observers : { - 'onSortStart' : function(){}, - 'onSort' : function(){}, - 'onSortEnd' : function(){}, - 'onResizeStart' : function(){}, - 'onResize' : function(){}, - 'onResizeEnd' : function(){}, - 'onEditStart' : function(){}, - 'onEdit' : function(){}, - 'onEditEnd' : function(){} - } - }, - _c : 0, - _getc : function() {return TableKit._c += 1;}, - unloadTable : function(table){ - table = $(table); - if(!TableKit.tables[table.id]) {return;} //if not an existing registered table return - var cells = TableKit.getHeaderCells(table); - var op = TableKit.option('sortable resizable editable noSortClass descendingClass ascendingClass columnClass sortFirstAscendingClass sortFirstDecendingClass', table.id); - //unregister all the sorting and resizing events - cells.each(function(c){ - c = $(c); - if(op.sortable) { - if(!c.hasClassName(op.noSortClass)) { - Event.stopObserving(c, 'mousedown', TableKit.Sortable._sort); - c.removeClassName(op.columnClass); - c.removeClassName(op.sortFirstAscendingClass); - c.removeClassName(op.sortFirstDecendingClass); - //ensure that if table reloaded current sort is remembered via sort first class name - if(c.hasClassName(op.ascendingClass)) { - c.removeClassName(op.ascendingClass); - c.addClassName(op.sortFirstAscendingClass) - } else if (c.hasClassName(op.descendingClass)) { - c.removeClassName(op.descendingClass); - c.addClassName(op.sortFirstDecendingClass) - } - } - } - if(op.resizable) { - Event.stopObserving(c, 'mouseover', TableKit.Resizable.initDetect); - Event.stopObserving(c, 'mouseout', TableKit.Resizable.killDetect); - } - }); - //unregister the editing events and cancel any open editors - if(op.editable) { - Event.stopObserving(table.tBodies[0], 'click', TableKit.Editable._editCell); - for(var c in TableKit.tables[table.id].dom.cells) { - if(TableKit.tables[table.id].dom.cells[c].active) { - var cell = $(c); - var editor = TableKit.Editable.getCellEditor(cell); - editor.cancel(cell); - } - } - } - //delete the cache - TableKit.tables[table.id].dom = {head:null,rows:null,cells:{}}; // TODO: watch this for mem leaks - }, - reloadTable : function(table){ - table = $(table); - TableKit.unloadTable(table); - var op = TableKit.option('sortable resizable editable', table.id); - if(op.sortable) {TableKit.Sortable.init(table);} - if(op.resizable) {TableKit.Resizable.init(table);} - if(op.editable) {TableKit.Editable.init(table);} - }, - reloadSortableTable : function(table){ - table = $(table); - TableKit.unloadTable(table); - var op = TableKit.option('sortable', table.id); - if(op.sortable) {TableKit.Sortable.init(table);} - }, - reload : function() { - for(var k in TableKit.tables) { - TableKit.reloadTable(k); - } - }, - 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 = e.element(); - 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 defaultSortDirection', table.id); - - if(cell.hasClassName(op.noSortClass)) {return;} - //TableKit.notify('onSortStart', table); - order = order ? order : op.defaultSortDirection; - 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. - order = cell.hasClassName(op.descendingClass) ? 1 : -1; - } 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.addClassName(op.ascendingClass); - } else { - 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 = false; - // first look for a data type id on the heading row cell - if(cell.id && TableKit.Sortable.types[cell.id]) { - t = cell.id - } - if(!t) { - t = $w(cell.className).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]) { - var chr = parseInt(r[4],10); - if(r[7].toLowerCase().indexOf('p') !== -1) { - hr_num = chr < 12 ? chr + 12 : chr; - } else if(r[7].toLowerCase().indexOf('a') !== -1) { - hr_num = chr < 12 ? chr : 0; - } - } - 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]) { - var chr = parseInt(r[4],10); - if(r[7].toLowerCase().indexOf('p') !== -1) { - hr_num = chr < 12 ? chr + 12 : chr; - } else if(r[7].toLowerCase().indexOf('a') !== -1) { - hr_num = chr < 12 ? chr : 0; - } - } - 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); - Event.observe(c, 'mouseover', TableKit.Resizable.initDetect); - Event.observe(c, 'mouseout', TableKit.Resizable.killDetect); - }); - }, - 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) { - var cell = e.element(); - if (cell.tagName != "TD") {return;} - Event.observe(cell, 'mousemove', TableKit.Resizable.detectHandle); - Event.observe(cell, 'mousedown', TableKit.Resizable.startResize); - }, - detectHandle : function(e) { - e = TableKit.e(e); - var cell = e.element(); - 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) { - TableKit.Resizable._onHandle = false; - var cell = e.element(); - 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) { - if(!TableKit.Resizable._onHandle) {return;} - var cell = e.element(); - 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' : cell.cumulativeOffset()[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; - if (!cell) {return;} - TableKit.Resizable.resize(null, cell, (Event.pointerX(e) - cell.cumulativeOffset()[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) - TableKit.Resizable._cell.cumulativeOffset()[0])); - } catch(e) {} - } else { - TableKit.Resizable._handle.setStyle({'left' : Event.pointerX(e) + 'px'}); - } - return false; - }, - pointerPos : function(element, x, y) { - var offset = $(element).cumulativeOffset(); - 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'); - if(cell) { - TableKit.Editable.editCell(null, cell, null, e); - } else { - return false; - } - }, - editCell : function(table, index, cindex, event) { - 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 = $(event ? Event.findElement(event, 'td') : 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;} - - var data = TableKit.getCellData(cell); - if(data.active) {return;} - data.htmlContent = cell.innerHTML; - var ftype = TableKit.Editable.getCellEditor(null,null,head); - ftype.edit(cell, event); - data.active = true; - }, - getCellEditor : function(cell, table, head) { - var head = head ? head : $(TableKit.getHeaderCells(table, cell)[TableKit.getCellIndex(cell)]); - var ftype = TableKit.Editable.types['text-input']; - if(head.id && TableKit.Editable.types[head.id]) { - ftype = TableKit.Editable.types[head.id]; - } else { - var n = $w(head.className).detect(function(n){ - return (TableKit.Editable.types[n]) ? true : false; - }); - ftype = n ? TableKit.Editable.types[n] : ftype; - } - return ftype; - }, - 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.getCellData(cell); - 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.getCellData(cell); - 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 = []; - } -} */ - -document.observe("dom:loaded", TableKit.load); diff --git a/UI/WebServerResources/tb-ab-properties-flat-24x24.png b/UI/WebServerResources/tb-ab-properties-flat-24x24.png deleted file mode 100644 index 72f233c98..000000000 Binary files a/UI/WebServerResources/tb-ab-properties-flat-24x24.png and /dev/null differ diff --git a/UI/WebServerResources/tb-compose-attach-flat-24x24.png b/UI/WebServerResources/tb-compose-attach-flat-24x24.png deleted file mode 100644 index f7b8001f9..000000000 Binary files a/UI/WebServerResources/tb-compose-attach-flat-24x24.png and /dev/null differ diff --git a/UI/WebServerResources/tb-compose-contacts-flat-24x24.png b/UI/WebServerResources/tb-compose-contacts-flat-24x24.png deleted file mode 100644 index 71542c1ce..000000000 Binary files a/UI/WebServerResources/tb-compose-contacts-flat-24x24.png and /dev/null differ diff --git a/UI/WebServerResources/tb-compose-save-flat-24x24.png b/UI/WebServerResources/tb-compose-save-flat-24x24.png deleted file mode 100644 index b07507363..000000000 Binary files a/UI/WebServerResources/tb-compose-save-flat-24x24.png and /dev/null differ diff --git a/UI/WebServerResources/tb-compose-security-flat-24x24.png b/UI/WebServerResources/tb-compose-security-flat-24x24.png deleted file mode 100644 index a6a1fbd9e..000000000 Binary files a/UI/WebServerResources/tb-compose-security-flat-24x24.png and /dev/null differ diff --git a/UI/WebServerResources/tb-compose-send-flat-24x24.png b/UI/WebServerResources/tb-compose-send-flat-24x24.png deleted file mode 100644 index fa2bb538e..000000000 Binary files a/UI/WebServerResources/tb-compose-send-flat-24x24.png and /dev/null differ diff --git a/UI/WebServerResources/tb-mail-addressbook-flat-16x16.png b/UI/WebServerResources/tb-mail-addressbook-flat-16x16.png deleted file mode 100644 index 6691dbbb4..000000000 Binary files a/UI/WebServerResources/tb-mail-addressbook-flat-16x16.png and /dev/null differ diff --git a/UI/WebServerResources/tb-mail-addressbook-flat-24x24.png b/UI/WebServerResources/tb-mail-addressbook-flat-24x24.png deleted file mode 100644 index 5077f39d5..000000000 Binary files a/UI/WebServerResources/tb-mail-addressbook-flat-24x24.png and /dev/null differ diff --git a/UI/WebServerResources/tb-mail-delete-flat-24x24.png b/UI/WebServerResources/tb-mail-delete-flat-24x24.png deleted file mode 100644 index 2ab7ade9f..000000000 Binary files a/UI/WebServerResources/tb-mail-delete-flat-24x24.png and /dev/null differ diff --git a/UI/WebServerResources/tb-mail-file-flat-24x24.png b/UI/WebServerResources/tb-mail-file-flat-24x24.png deleted file mode 100644 index b07507363..000000000 Binary files a/UI/WebServerResources/tb-mail-file-flat-24x24.png and /dev/null differ diff --git a/UI/WebServerResources/tb-mail-forward-flat-24x24.png b/UI/WebServerResources/tb-mail-forward-flat-24x24.png deleted file mode 100644 index db1c40611..000000000 Binary files a/UI/WebServerResources/tb-mail-forward-flat-24x24.png and /dev/null differ diff --git a/UI/WebServerResources/tb-mail-getmail-flat-24x24.png b/UI/WebServerResources/tb-mail-getmail-flat-24x24.png deleted file mode 100644 index 9c3ba60cf..000000000 Binary files a/UI/WebServerResources/tb-mail-getmail-flat-24x24.png and /dev/null differ diff --git a/UI/WebServerResources/tb-mail-junk-flat-24x24.png b/UI/WebServerResources/tb-mail-junk-flat-24x24.png deleted file mode 100644 index 24ace63e8..000000000 Binary files a/UI/WebServerResources/tb-mail-junk-flat-24x24.png and /dev/null differ diff --git a/UI/WebServerResources/tb-mail-print-flat-24x24.png b/UI/WebServerResources/tb-mail-print-flat-24x24.png deleted file mode 100644 index 5d6e6b39b..000000000 Binary files a/UI/WebServerResources/tb-mail-print-flat-24x24.png and /dev/null differ diff --git a/UI/WebServerResources/tb-mail-reply-flat-24x24.png b/UI/WebServerResources/tb-mail-reply-flat-24x24.png deleted file mode 100644 index f00375b3a..000000000 Binary files a/UI/WebServerResources/tb-mail-reply-flat-24x24.png and /dev/null differ diff --git a/UI/WebServerResources/tb-mail-replyall-flat-24x24.png b/UI/WebServerResources/tb-mail-replyall-flat-24x24.png deleted file mode 100644 index 70e74243a..000000000 Binary files a/UI/WebServerResources/tb-mail-replyall-flat-24x24.png and /dev/null differ diff --git a/UI/WebServerResources/tb-mail-stop-flat-24x24.png b/UI/WebServerResources/tb-mail-stop-flat-24x24.png deleted file mode 100644 index bc6e96b94..000000000 Binary files a/UI/WebServerResources/tb-mail-stop-flat-24x24.png and /dev/null differ diff --git a/UI/WebServerResources/tb-mail-write-flat-24x24.png b/UI/WebServerResources/tb-mail-write-flat-24x24.png deleted file mode 100644 index a2b1b34f4..000000000 Binary files a/UI/WebServerResources/tb-mail-write-flat-24x24.png and /dev/null differ diff --git a/UI/WebServerResources/tbtv_account_17x17.png b/UI/WebServerResources/tbtv_account_17x17.png deleted file mode 100644 index b072992f1..000000000 Binary files a/UI/WebServerResources/tbtv_account_17x17.png and /dev/null differ diff --git a/UI/WebServerResources/tbtv_corner_17x22.png b/UI/WebServerResources/tbtv_corner_17x22.png deleted file mode 100644 index 14eb35934..000000000 Binary files a/UI/WebServerResources/tbtv_corner_17x22.png and /dev/null differ diff --git a/UI/WebServerResources/tbtv_corner_minus_17x22.png b/UI/WebServerResources/tbtv_corner_minus_17x22.png deleted file mode 100644 index 466061731..000000000 Binary files a/UI/WebServerResources/tbtv_corner_minus_17x22.png and /dev/null differ diff --git a/UI/WebServerResources/tbtv_corner_plus_17x22.png b/UI/WebServerResources/tbtv_corner_plus_17x22.png deleted file mode 100644 index d11437976..000000000 Binary files a/UI/WebServerResources/tbtv_corner_plus_17x22.png and /dev/null differ diff --git a/UI/WebServerResources/tbtv_drafts_17x17.png b/UI/WebServerResources/tbtv_drafts_17x17.png deleted file mode 100644 index 4b96d581a..000000000 Binary files a/UI/WebServerResources/tbtv_drafts_17x17.png and /dev/null differ diff --git a/UI/WebServerResources/tbtv_inbox_17x17.png b/UI/WebServerResources/tbtv_inbox_17x17.png deleted file mode 100644 index c5c15c4fd..000000000 Binary files a/UI/WebServerResources/tbtv_inbox_17x17.png and /dev/null differ diff --git a/UI/WebServerResources/tbtv_junction_17x22.png b/UI/WebServerResources/tbtv_junction_17x22.png deleted file mode 100644 index 7dd6816be..000000000 Binary files a/UI/WebServerResources/tbtv_junction_17x22.png and /dev/null differ diff --git a/UI/WebServerResources/tbtv_leaf_corner_17x17.png b/UI/WebServerResources/tbtv_leaf_corner_17x17.png deleted file mode 100644 index 25f883369..000000000 Binary files a/UI/WebServerResources/tbtv_leaf_corner_17x17.png and /dev/null differ diff --git a/UI/WebServerResources/tbtv_line_17x22.png b/UI/WebServerResources/tbtv_line_17x22.png deleted file mode 100644 index 19504b49c..000000000 Binary files a/UI/WebServerResources/tbtv_line_17x22.png and /dev/null differ diff --git a/UI/WebServerResources/tbtv_minus_17x22.png b/UI/WebServerResources/tbtv_minus_17x22.png deleted file mode 100644 index 2c8d61cc4..000000000 Binary files a/UI/WebServerResources/tbtv_minus_17x22.png and /dev/null differ diff --git a/UI/WebServerResources/tbtv_plus_17x22.png b/UI/WebServerResources/tbtv_plus_17x22.png deleted file mode 100644 index 386dcf2a5..000000000 Binary files a/UI/WebServerResources/tbtv_plus_17x22.png and /dev/null differ diff --git a/UI/WebServerResources/tbtv_sent_17x17.png b/UI/WebServerResources/tbtv_sent_17x17.png deleted file mode 100644 index c28a77e63..000000000 Binary files a/UI/WebServerResources/tbtv_sent_17x17.png and /dev/null differ diff --git a/UI/WebServerResources/tbtv_trash_17x17.png b/UI/WebServerResources/tbtv_trash_17x17.png deleted file mode 100644 index 954479b65..000000000 Binary files a/UI/WebServerResources/tbtv_trash_17x17.png and /dev/null differ diff --git a/UI/WebServerResources/tentative.png b/UI/WebServerResources/tentative.png deleted file mode 100644 index 717936496..000000000 Binary files a/UI/WebServerResources/tentative.png and /dev/null differ diff --git a/UI/WebServerResources/thead_bg.png b/UI/WebServerResources/thead_bg.png deleted file mode 100644 index 5feb85045..000000000 Binary files a/UI/WebServerResources/thead_bg.png and /dev/null differ diff --git a/UI/WebServerResources/title_attachment_14x14.png b/UI/WebServerResources/title_attachment_14x14.png deleted file mode 100644 index b9e466753..000000000 Binary files a/UI/WebServerResources/title_attachment_14x14.png and /dev/null differ diff --git a/UI/WebServerResources/title_read_14x14.png b/UI/WebServerResources/title_read_14x14.png deleted file mode 100644 index 1c3e45cf7..000000000 Binary files a/UI/WebServerResources/title_read_14x14.png and /dev/null differ diff --git a/UI/WebServerResources/title_sortdown_12x12.png b/UI/WebServerResources/title_sortdown_12x12.png deleted file mode 100644 index 30ff16f85..000000000 Binary files a/UI/WebServerResources/title_sortdown_12x12.png and /dev/null differ diff --git a/UI/WebServerResources/title_sortup_12x12.png b/UI/WebServerResources/title_sortup_12x12.png deleted file mode 100644 index 404d527d1..000000000 Binary files a/UI/WebServerResources/title_sortup_12x12.png and /dev/null differ diff --git a/UI/WebServerResources/toolbarbtn_a_bg.png b/UI/WebServerResources/toolbarbtn_a_bg.png deleted file mode 100644 index 73cea5d60..000000000 Binary files a/UI/WebServerResources/toolbarbtn_a_bg.png and /dev/null differ diff --git a/UI/WebServerResources/toolbarbtn_span_bg.png b/UI/WebServerResources/toolbarbtn_span_bg.png deleted file mode 100644 index 7971b08b5..000000000 Binary files a/UI/WebServerResources/toolbarbtn_span_bg.png and /dev/null differ diff --git a/UI/WebServerResources/unread.png b/UI/WebServerResources/unread.png deleted file mode 100644 index 680487853..000000000 Binary files a/UI/WebServerResources/unread.png and /dev/null differ diff --git a/UI/WebServerResources/up-icon.png b/UI/WebServerResources/up-icon.png deleted file mode 100644 index 0800973ed..000000000 Binary files a/UI/WebServerResources/up-icon.png and /dev/null differ diff --git a/UI/WebServerResources/upload_document.png b/UI/WebServerResources/upload_document.png deleted file mode 100644 index 95bc045c2..000000000 Binary files a/UI/WebServerResources/upload_document.png and /dev/null differ diff --git a/UI/WebServerResources/week-view.png b/UI/WebServerResources/week-view.png deleted file mode 100644 index 4f3e7fa17..000000000 Binary files a/UI/WebServerResources/week-view.png and /dev/null differ diff --git a/UI/WebServerResources/write-message.png b/UI/WebServerResources/write-message.png deleted file mode 100644 index fd47c76ce..000000000 Binary files a/UI/WebServerResources/write-message.png and /dev/null differ diff --git a/UI/WebServerResources/write.png b/UI/WebServerResources/write.png deleted file mode 100644 index fd47c76ce..000000000 Binary files a/UI/WebServerResources/write.png and /dev/null differ