mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-02-17 07:33:57 +00:00
- see ChangeLog;
Monotone-Parent: 7baf484eb57aa68904091d6b53bc95986c669875 Monotone-Revision: cbf9de1ff6c0a47ce98d4c8b87c0a25450017ee7 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-07-07T21:27:12 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
2006-07-07 Wsourdeau Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/WebServerResources/generic.js: added code to manage
|
||||
selections within HTML containers.
|
||||
|
||||
* UI/Common/UIxPageFrame.m ([UIxPageFrame -productJavaScriptURL]):
|
||||
added method to determine the possible URL for a product-specific
|
||||
javascript filename of the forme <productname>.js.
|
||||
|
||||
@@ -166,3 +166,89 @@ function triggerOpenerCallback() {
|
||||
window.opener.location.href = cburl;
|
||||
}
|
||||
}
|
||||
|
||||
/* selection mechanism */
|
||||
|
||||
function selectNode(node) {
|
||||
var classStr = '' + node.getAttribute('class');
|
||||
|
||||
position = classStr.indexOf('_selected', 0);
|
||||
if (position < 0) {
|
||||
classStr = classStr + ' _selected';
|
||||
node.setAttribute('class', classStr);
|
||||
}
|
||||
}
|
||||
|
||||
function deselectNode(node) {
|
||||
var classStr = '' + node.getAttribute('class');
|
||||
|
||||
position = classStr.indexOf('_selected', 0);
|
||||
while (position > -1) {
|
||||
classStr1 = classStr.substring(0, position);
|
||||
classStr2 = classStr.substring(position + 10, classStr.length);
|
||||
classStr = classStr1 + classStr2;
|
||||
position = classStr.indexOf('_selected', 0);
|
||||
}
|
||||
|
||||
node.setAttribute('class', classStr);
|
||||
}
|
||||
|
||||
function deselectAll(parent) {
|
||||
for (var i = 0; i < parent.childNodes.length; i++) {
|
||||
var node = parent.childNodes.item(i);
|
||||
if (node.nodeType == 1) {
|
||||
deselectNode(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isNodeSelected(node) {
|
||||
var classStr = '' + node.getAttribute('class');
|
||||
var position = classStr.indexOf('_selected', 0);
|
||||
|
||||
return (position > -1);
|
||||
}
|
||||
|
||||
function acceptMultiSelect(node) {
|
||||
var accept = ('' + node.getAttribute('multiselect')).toLowerCase();
|
||||
|
||||
return (accept == 'yes');
|
||||
}
|
||||
|
||||
function getSelection(parentNode) {
|
||||
var selArray = new Array();
|
||||
|
||||
for (var i = 0; i < parentNode.childNodes.length; i++) {
|
||||
node = parentNode.childNodes.item(i);
|
||||
if (node.nodeType == 1
|
||||
&& isNodeSelected(node)) {
|
||||
selArray.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
return selArray.join('|');
|
||||
}
|
||||
|
||||
function onRowClick(node, event) {
|
||||
var text = document.getElementById('list');
|
||||
text.innerHTML = '';
|
||||
|
||||
var startSelection = getSelection(node.parentNode);
|
||||
if (event.shiftKey == 1
|
||||
&& acceptMultiSelect(node.parentNode)) {
|
||||
if (isNodeSelected(node) == true) {
|
||||
deselectNode(node);
|
||||
} else {
|
||||
selectNode(node);
|
||||
}
|
||||
} else {
|
||||
deselectAll(node.parentNode);
|
||||
selectNode(node);
|
||||
}
|
||||
if (startSelection != getSelection(node.parentNode)) {
|
||||
var code = '' + node.parentNode.getAttribute('onselectionchange');
|
||||
if (code.length > 0) {
|
||||
node.eval(code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user