~ubuntu-branches/ubuntu/natty/ntop/natty

« back to all changes in this revision

Viewing changes to html/functions.js

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2005-01-30 21:59:13 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050130215913-xc3ke963bw49b3k4
Tags: 2:3.0-5
* Updated README.Debian file so users will understand what to do at
  install, closes: #291794, #287802.
* Updated ntop init script to give better output.
* Also changed log directory from /var/lib/ntop to /var/log/ntop,
  closes: #252352.
* Quoted the interface list to allow whitespace, closes: #267248.
* Added a couple of logcheck ignores, closes: #269321, #269319.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * Sets/unsets the pointer in browse mode
 
3
 *
 
4
 * @param   object   the table row
 
5
 * @param   object   the color to use for this row
 
6
 * @param   object   the background color
 
7
 *
 
8
 * @return  boolean  whether pointer is set or not
 
9
 */
 
10
function setPointer(theRow, thePointerColor, theNormalBgColor)
 
11
{
 
12
    var theCells = null;
 
13
 
 
14
    if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
 
15
        return false;
 
16
    }
 
17
    if (typeof(document.getElementsByTagName) != 'undefined') {
 
18
        theCells = theRow.getElementsByTagName('th');
 
19
    }
 
20
    else if (typeof(theRow.cells) != 'undefined') {
 
21
        theCells = theRow.cells;
 
22
    }
 
23
    else {
 
24
        return false;
 
25
    }
 
26
 
 
27
    var rowCellsCnt  = theCells.length;
 
28
    var currentColor = null;
 
29
    var newColor     = null;
 
30
    // Opera does not return valid values with "getAttribute"
 
31
    if (typeof(window.opera) == 'undefined'
 
32
        && typeof(theCells[0].getAttribute) != 'undefined' && typeof(theCells[0].getAttribute) != 'undefined') {
 
33
        currentColor = theCells[0].getAttribute('bgcolor');
 
34
        newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
 
35
                     ? theNormalBgColor
 
36
                     : thePointerColor;
 
37
        for (var c = 0; c < rowCellsCnt; c++) {
 
38
            theCells[c].setAttribute('bgcolor', newColor, 0);
 
39
        } // end for
 
40
    }
 
41
    else {
 
42
        currentColor = theCells[0].style.backgroundColor;
 
43
        newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
 
44
                     ? theNormalBgColor
 
45
                     : thePointerColor;
 
46
        for (var c = 0; c < rowCellsCnt; c++) {
 
47
            theCells[c].style.backgroundColor = newColor;
 
48
        }
 
49
    }
 
50
 
 
51
    // --------------------
 
52
 if (typeof(document.getElementsByTagName) != 'undefined') {
 
53
        theCells = theRow.getElementsByTagName('td');
 
54
    }
 
55
    else if (typeof(theRow.cells) != 'undefined') {
 
56
        theCells = theRow.cells;
 
57
    }
 
58
    else {
 
59
        return false;
 
60
    }
 
61
 
 
62
    var rowCellsCnt  = theCells.length;
 
63
    var currentColor = null;
 
64
    var newColor     = null;
 
65
    // Opera does not return valid values with "getAttribute"
 
66
    if (typeof(window.opera) == 'undefined'
 
67
        && typeof(theCells[0].getAttribute) != 'undefined' && typeof(theCells[0].getAttribute) != 'undefined') {
 
68
        currentColor = theCells[0].getAttribute('bgcolor');
 
69
        newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
 
70
                     ? theNormalBgColor
 
71
                     : thePointerColor;
 
72
        for (var c = 0; c < rowCellsCnt; c++) {
 
73
            theCells[c].setAttribute('bgcolor', newColor, 0);
 
74
        } // end for
 
75
    }
 
76
    else {
 
77
        currentColor = theCells[0].style.backgroundColor;
 
78
        newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
 
79
                     ? theNormalBgColor
 
80
                     : thePointerColor;
 
81
        for (var c = 0; c < rowCellsCnt; c++) {
 
82
            theCells[c].style.backgroundColor = newColor;
 
83
        }
 
84
    }
 
85
 
 
86
    return true;
 
87
} // end of the 'setPointer()' function
 
88
 
 
89
 
 
90
function popUp(url) {
 
91
                sealWin=window.open(url,"win",'toolbar=no,width=570,height=200');
 
92
                sealWin.focus();
 
93
}