- 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
maint-2.0.2
Wolfgang Sourdeau 2006-07-07 21:27:12 +00:00
parent b50401f2e7
commit 2d5c068ee8
2 changed files with 89 additions and 0 deletions

View File

@ -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.

View File

@ -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);
}
}
}