mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-25 08:23:28 +00:00
@@ -6,8 +6,8 @@ var usersRightsWindowWidth = 450;
|
||||
|
||||
/* ACLs module */
|
||||
|
||||
function onSearchFormSubmit() {
|
||||
var searchValue = $("searchValue");
|
||||
function onSearchFormSubmit(panel) {
|
||||
var searchValue = panel.down('[name="search"]');
|
||||
var encodedValue = encodeURI(searchValue.value);
|
||||
|
||||
if (encodedValue.blank()) {
|
||||
@@ -61,20 +61,18 @@ function buildUsersTree(treeDiv, response) {
|
||||
var isUserDialog = false;
|
||||
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.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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,7 +218,7 @@ function initAdministration() {
|
||||
$("helpDialog").hide();
|
||||
});
|
||||
|
||||
var searchValue = $("searchValue");
|
||||
var searchValue = $$('[data-search="admin"] [name="search"]').first();
|
||||
searchValue.focus();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@ function openContactsFolder(contactsFolder, reload, idx) {
|
||||
var url = URLForFolderID(Contact.currentAddressBook, "Contacts") +
|
||||
"/view?noframe=1";
|
||||
|
||||
var searchValue = search["value"];
|
||||
var searchValue = search["contacts"]["value"];
|
||||
if (searchValue && searchValue.length > 0)
|
||||
url += ("&search=" + search["criteria"]
|
||||
url += ("&search=" + search["contacts"]["criteria"]
|
||||
+ "&value=" + escape(searchValue.utf8encode()));
|
||||
var sortAttribute = sorting["attribute"];
|
||||
if (sortAttribute && sortAttribute.length > 0)
|
||||
@@ -613,7 +613,7 @@ function onFolderSelectionChange(event) {
|
||||
}
|
||||
else {
|
||||
search = {};
|
||||
$("searchValue").value = "";
|
||||
$$('[name="search"]').each(function(input) { input.value = "" });
|
||||
initCriteria();
|
||||
openContactsFolder(nodes[0].getAttribute("id"));
|
||||
}
|
||||
|
||||
@@ -784,9 +784,9 @@ function openMailbox(mailbox, reload) {
|
||||
lastClickedRow = -1; // from generic.js
|
||||
}
|
||||
|
||||
var searchValue = search["value"];
|
||||
var searchValue = search["mail"]["value"];
|
||||
if (searchValue && searchValue.length > 0) {
|
||||
urlParams.set("search", search["criteria"]);
|
||||
urlParams.set("search", search["mail"]["criteria"]);
|
||||
urlParams.set("value", escape(searchValue.utf8encode()));
|
||||
}
|
||||
var sortAttribute = sorting["attribute"];
|
||||
|
||||
@@ -277,11 +277,11 @@ TABLE#eventsList THEAD TD:last-child,
|
||||
TABLE#tasksList THEAD TD:last-child
|
||||
{ border-right: 0px; }
|
||||
|
||||
#filterPanel,
|
||||
.filterPanel,
|
||||
#schedulerTabs .tab label
|
||||
{ display: block;
|
||||
margin: 0;
|
||||
padding: 5px;
|
||||
padding: 0 0 5px 5px;
|
||||
background-color: #eee;
|
||||
background-color: #E6E7E6; }
|
||||
|
||||
|
||||
@@ -2169,14 +2169,17 @@ function onHeaderClick(event) {
|
||||
Event.stop(event);
|
||||
}
|
||||
|
||||
function refreshCurrentFolder() {
|
||||
refreshEvents();
|
||||
function refreshCurrentFolder(id) {
|
||||
if (id == 'tasks')
|
||||
refreshTasks();
|
||||
else
|
||||
refreshEvents();
|
||||
}
|
||||
|
||||
/* refreshes the "unifinder" list */
|
||||
function refreshEvents() {
|
||||
var titleSearch;
|
||||
var value = search["value"];
|
||||
var value = search["events"]["value"];
|
||||
|
||||
if (value && value.length)
|
||||
titleSearch = "&search=" + escape(value.utf8encode());
|
||||
@@ -2193,7 +2196,15 @@ function refreshEvents() {
|
||||
}
|
||||
|
||||
function refreshTasks(setUserDefault) {
|
||||
var titleSearch;
|
||||
var value = search["tasks"]["value"];
|
||||
var setud;
|
||||
|
||||
if (value && value.length)
|
||||
titleSearch = "&search=" + escape(value.utf8encode());
|
||||
else
|
||||
titleSearch = "";
|
||||
|
||||
/* TODO: the logic behind this should be reimplemented properly:
|
||||
the "taskslist" method should save the status when the 'show-completed'
|
||||
is set to true and revert to the current status when that parameter is
|
||||
@@ -2201,10 +2212,13 @@ function refreshTasks(setUserDefault) {
|
||||
setud = "";
|
||||
if (setUserDefault == 1)
|
||||
setud = "&setud=1";
|
||||
|
||||
refreshAlarms();
|
||||
|
||||
return _loadTasksHref("taskslist?show-completed=" + showCompletedTasks
|
||||
+ "&asc=" + sorting["task-ascending"]
|
||||
+ "&sort=" + sorting["task-attribute"]);
|
||||
+ "&sort=" + sorting["task-attribute"]
|
||||
+ titleSearch);
|
||||
}
|
||||
|
||||
function refreshEventsAndDisplay() {
|
||||
@@ -2700,11 +2714,12 @@ function getMenus() {
|
||||
onCalendarNew, onCalendarRemove,
|
||||
"-", onCalendarExport, onCalendarImport,
|
||||
null, "-", null, "-", onMenuSharing);
|
||||
menus["searchMenu"] = new Array(setSearchCriteria);
|
||||
menus["eventSearchMenu"] = new Array(setSearchCriteria);
|
||||
|
||||
menus["tasksListMenu"] = new Array (editEvent, newTask, "-",
|
||||
marksTasksAsCompleted, deleteEvent, "-",
|
||||
onMenuRawTask);
|
||||
menus["taskSearchMenu"] = new Array(setSearchCriteria);
|
||||
|
||||
var calendarsMenu = $("calendarsMenu");
|
||||
if (calendarsMenu)
|
||||
@@ -3361,4 +3376,4 @@ function initScheduler() {
|
||||
Event.observe(window, "resize", onWindowResize);
|
||||
}
|
||||
|
||||
document.observe("dom:loaded", initScheduler);
|
||||
document.observe("generic:loaded", initScheduler);
|
||||
|
||||
@@ -443,7 +443,7 @@ DIV.dragHandle:active
|
||||
{ background-color: #99a; }
|
||||
|
||||
/* search fields */
|
||||
DIV#filterPanel
|
||||
DIV.filterPanel
|
||||
{ height: 2em;
|
||||
vertical-align: middle;
|
||||
width: 100%;
|
||||
@@ -770,7 +770,7 @@ BUTTON.comboBoxButton:active
|
||||
background-color: #d6d7d6;
|
||||
}
|
||||
|
||||
INPUT#searchValue
|
||||
INPUT[name="search"]
|
||||
{ margin-right: 1em;
|
||||
width: 20em;
|
||||
padding-left: 24px;
|
||||
|
||||
@@ -1073,14 +1073,15 @@ function popupSearchMenu(event) {
|
||||
}
|
||||
|
||||
function setSearchCriteria(event) {
|
||||
var searchValue = $("searchValue");
|
||||
var searchCriteria = $("searchCriteria");
|
||||
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.getAttribute('id');
|
||||
searchCriteria.value = this.readAttribute('data-option');
|
||||
|
||||
if (this.parentNode.chosenNode)
|
||||
this.parentNode.chosenNode.removeClassName("_chosen");
|
||||
@@ -1092,20 +1093,18 @@ function setSearchCriteria(event) {
|
||||
searchValue.lastSearch = "";
|
||||
this.parentNode.chosenNode = this;
|
||||
|
||||
onSearchFormSubmit();
|
||||
onSearchFormSubmit(panel);
|
||||
}
|
||||
}
|
||||
|
||||
function configureSearchField() {
|
||||
var searchValue = $("searchValue");
|
||||
|
||||
if (searchValue) {
|
||||
searchValue.observe("click", popupSearchMenu);
|
||||
searchValue.observe("blur", onSearchBlur);
|
||||
searchValue.observe("focus", onSearchFocus);
|
||||
searchValue.observe("keydown", onSearchKeyDown);
|
||||
searchValue.observe("mousedown", onSearchMouseDown);
|
||||
}
|
||||
$$('.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) {
|
||||
@@ -1118,7 +1117,7 @@ function onSearchMouseDown(event) {
|
||||
}
|
||||
|
||||
function onSearchFocus(event) {
|
||||
ghostPhrase = this.ghostPhrase;
|
||||
var ghostPhrase = this.ghostPhrase;
|
||||
if (this.value == ghostPhrase) {
|
||||
this.value = "";
|
||||
this.setAttribute("modified", "");
|
||||
@@ -1130,15 +1129,16 @@ function onSearchFocus(event) {
|
||||
|
||||
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["value"] = "";
|
||||
search[id]["value"] = "";
|
||||
if (this.lastSearch != "") {
|
||||
this.lastSearch = "";
|
||||
refreshCurrentFolder();
|
||||
refreshCurrentFolder(id);
|
||||
}
|
||||
} else if (this.value == this.ghostPhrase) {
|
||||
this.setAttribute("modified", "");
|
||||
@@ -1160,43 +1160,47 @@ function IsCharacterKey(keyCode) {
|
||||
|
||||
function onSearchKeyDown(event) {
|
||||
if (event.keyCode == Event.KEY_RETURN) {
|
||||
var panel = $(this).up('.filterPanel');
|
||||
if (this.timer)
|
||||
clearTimeout(this.timer);
|
||||
onSearchFormSubmit();
|
||||
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 = setTimeout("onSearchFormSubmit()", 500);
|
||||
this.timer = onSearchFormSubmit.delay(0.5, panel);
|
||||
}
|
||||
}
|
||||
|
||||
function onSearchFormSubmit(event) {
|
||||
var searchValue = $("searchValue");
|
||||
var searchCriteria = $("searchCriteria");
|
||||
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() == "." ))) {
|
||||
search["criteria"] = searchCriteria.value;
|
||||
search["value"] = searchValue.value;
|
||||
search[id]["criteria"] = searchCriteria.value;
|
||||
search[id]["value"] = searchValue.value;
|
||||
searchValue.lastSearch = searchValue.value;
|
||||
refreshCurrentFolder();
|
||||
refreshCurrentFolder(id);
|
||||
}
|
||||
}
|
||||
|
||||
function initCriteria() {
|
||||
var searchCriteria = $("searchCriteria");
|
||||
var searchValue = $("searchValue");
|
||||
var searchOptions = $("searchOptions");
|
||||
|
||||
if (searchValue && searchOptions) {
|
||||
$$('[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.getAttribute('id');
|
||||
searchCriteria.value = firstOption.readAttribute('data-option');
|
||||
searchValue.ghostPhrase = firstOption.innerHTML;
|
||||
searchValue.lastSearch = "";
|
||||
if (searchValue.value == '') {
|
||||
@@ -1209,9 +1213,11 @@ function initCriteria() {
|
||||
searchOptions.chosenNode.removeClassName("_chosen");
|
||||
firstOption.addClassName("_chosen");
|
||||
searchOptions.chosenNode = firstOption;
|
||||
// Initialize global array
|
||||
search[id] = {};
|
||||
}
|
||||
searchValue.blur();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* toolbar buttons */
|
||||
@@ -1657,6 +1663,9 @@ function onLoadHandler(event) {
|
||||
progressImage.parentNode.removeChild(progressImage);
|
||||
$(document.body).observe("contextmenu", onBodyClickContextMenu);
|
||||
|
||||
// Some module are initialized only once this method is completed
|
||||
document.fire('generic:loaded');
|
||||
|
||||
onFinalLoadHandler();
|
||||
}
|
||||
|
||||
@@ -1862,7 +1871,7 @@ function parent$(element) {
|
||||
}
|
||||
|
||||
/* stubs */
|
||||
function refreshCurrentFolder() {
|
||||
function refreshCurrentFolder(id) {
|
||||
}
|
||||
|
||||
function configureDragHandles() {
|
||||
|
||||
Reference in New Issue
Block a user