<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>WPKG Client Package Status Report</title>
<style type="text/css">
   body                    { font-family: arial, sans-serif; font-size: 14px; }
   table.pkgTable          { background-color: #CCCCCC; }
   .pkgTable th            { padding: 5px; }
   .pkgTable td            { padding: 5px; }
   .colHostname            { text-align: left; }
   .colPkgId               { text-align: left; }
   .colPkgName             { text-align: left; }
   .colPkgRev              { text-align: right; }
   .colPkgState            { text-align: center; }
   .colLastMod             { text-align: right; }
   .selRight               { text-align: right; }
   .pkgTable th            { background-color: #C4FFF3; }
   tr.oddRow               { background-color: #EFEFEF; }
   tr.evenRow              { background-color: #D6D6D6; }
   tr.pkgStateUpgrade      { background-color: yellow; }
   tr.pkgStateDowngrade    { background-color: orange; }
   tr.pkgStateRemove       { background-color: red; }
   tr.pkgStateInstall      { background-color: green; }
</style>
<script type="text/javascript" language="JavaScript">
<!--
    var pkgStateOk        = 0;
    var pkgStateInstall   = 1;
    var pkgStateUpgrade   = 2;
    var pkgStateDowngrade = 3;
    var pkgStateRemove    = 4;
    
    var evenRow = false;
    
    function LoadOptions() {
        var TRarray = document.getElementsByTagName('tr');
        var oldHostname = "";
        
        for ( var i = 2; i < TRarray.length; i++ ) {
            var TDarray = document.getElementById('wpkgTable').rows[i].cells;

            for ( var j = 0; j < TDarray.length; j++ ) {
                var TDclass = TDarray[j].className;
                var TDvalue = TDarray[j].innerHTML;
                
                if ( TDclass.match(/col(Hostname|PkgId|PkgName|PkgRev|LastMod)/) ) {
                    var oSelect = document.getElementById(TDclass);
                    
                    var AddItem = false;
                    
                    if ( TDclass == "colHostname" ) {
                        if ( TDvalue != oldHostname ) {
                            AddItem = true;
                            oldHostname = TDvalue;
                        }
                    } else {
                        if ( TDclass == "colLastMod" ) TDvalue = TDvalue.split(" ", 1);
                        
                        AddItem = true;
                        
                        for ( var k = 0; k < oSelect.length; k++) {
                            if ( oSelect.options[k].text == TDvalue ) {
                                AddItem = false;
                                break;
                            }
                        }
                    }
            
                    if ( AddItem ) {
                        var eOption = document.createElement('option');
                        
                        eOption.text = TDvalue;
                        try {
                            oSelect.add(eOption, null);
                        } catch(e) {
                            /* IE only */
                            oSelect.add(eOption);
                        }
                    }
                }
            }
        }
    }
    
    function ShowHide(oRow, bState) {
        if ( bState ) {
            oRow.style.visibility = "visible";
            
            if ( evenRow ) {
                oRow.className = oRow.className.replace(/oddRow/, "evenRow");
            } else {
                oRow.className = oRow.className.replace(/evenRow/, "oddRow");
            }
            
            evenRow = (! evenRow);
        } else {
            if ( navigator.appName.match(/Microsoft Internet Explorer/) ) {
                oRow.style.visibility = "hidden";
            } else {
                oRow.style.visibility = "collapse";
            }
        }
    }

    function HideState(StateArray) {
        var TRarray = document.getElementsByTagName('tr');
        
        for ( var i = 2; i < TRarray.length; i++ ) {
            if ( TRarray[i].className.match(/pkgState/) ) {
                var StateClass = TRarray[i].className.replace(/oddRow /, "");
                var StateClass = StateClass.replace(/evenRow /, "");
                
                ShowHide(TRarray[i], StateArray[eval(StateClass)]);
            }
        }
    }
    
    function HideRow(ClassName, ItemText) {
        var TRarray = document.getElementsByTagName('tr');
        
        for ( var i = 2; i < TRarray.length; i++ ) {
            var show = false;
            
            if ( ItemText == "All" ) {
                show = true;
            } else {
                var TDarray = document.getElementById('wpkgTable').rows[i].cells;

                for ( var j = 0; j < TDarray.length; j++ ) {
                    if ( ClassName == "colLastMod" ) {
                        if ( TDarray[j].className == ClassName && TDarray[j].innerHTML.match(ItemText) ) show = true;
                    } else {
                        if ( TDarray[j].className == ClassName && TDarray[j].innerHTML == ItemText ) show = true;
                    }
                }
            }
                
            ShowHide(TRarray[i], show);
        }
    }
    
    function FilterColumn(ColumnClass) {
        evenRow = false;
        
        if ( ColumnClass == "colPkgState" ) {
            var CheckState = document.getElementsByName('StateCheck');
            var CheckStates = new Array();
        
            for ( var i = 0; i < CheckState.length; i++ ) {
                CheckStates[eval(CheckState[i].value)] = CheckState[i].checked;
            }
            
            HideState(CheckStates);
        } else {
            var oSelect = document.getElementById(ColumnClass);
            var i = oSelect.selectedIndex;
            var sText = oSelect.options[i].text;

            HideRow(ColumnClass, sText);
        }
    }
// -->
</script>
</head>
<body onload="LoadOptions()">
<table id="wpkgTable" class="pkgTable">
<tr class="oddRow">
<td valign="bottom" align="center">
<select id="colHostname">
    <option>All</option>
</select> <br/> <br/>
<input type="button" value="Apply Filter" onclick="FilterColumn('colHostname')"/>
</td>
<td valign="bottom" align="center">
<select id="colPkgId">
    <option>All</option>
</select> <br/> <br/>
<input type="button" value="Apply Filter" onclick="FilterColumn('colPkgId')"/>
</td>
<td valign="bottom" align="center">
<select id="colPkgName">
    <option>All</option>
</select> <br/> <br/>
<input type="button" value="Apply Filter" onclick="FilterColumn('colPkgName')"/>
</td>
<td valign="bottom" align="center">
<select id="colPkgRev" class="selRight">
    <option>All</option>
</select> <br/> <br/>
<input type="button" value="Apply Filter" onclick="FilterColumn('colPkgRev')"/>
</td>
<td>
<input type="checkbox" checked="checked" name="StateCheck" value="pkgStateOk"/> OK <br/>
<input type="checkbox" checked="checked" name="StateCheck" value="pkgStateInstall"/> Install <br/>
<input type="checkbox" checked="checked" name="StateCheck" value="pkgStateUpgrade"/> Upgrade <br/>
<input type="checkbox" checked="checked" name="StateCheck" value="pkgStateDowngrade"/> Downgrade <br/>
<input type="checkbox" checked="checked" name="StateCheck" value="pkgStateRemove"/> Remove <br/> <br/>
<center><input type="button" value="Apply Filter" onclick="FilterColumn('colPkgState')"/></center>
</td>
<td valign="bottom" align="center">
<select id="colLastMod">
    <option>All</option>
</select> <br/> <br/>
<input type="button" value="Apply Filter" onclick="FilterColumn('colLastMod')"/>
</td>
</tr>
<wpkg:pkgTable>
</table>
</body>
</html>