Changeset 1025

Show
Ignore:
Timestamp:
04/27/06 15:08:58 (7 years ago)
Author:
lokkju
Message:

Attempt at resolving Ticket #87.
Added ability for nodes to be display as a Filterable, Sortable, table.

filtertable.js is unobtrusive javascript for filtering tables.
sorttable.js is unobtrusive javascript for sorting tables, modified to
enable zebra stripes.

Location:
trunk/wifidog-auth/wifidog
Files:
2 added
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/wifidog/admin/generic_object_admin.php

    r1009 r1025  
    256256    case "Node": 
    257257        $newLongText = $addLongText; 
    258         $objectSelector = Node::getSelectNodeUI('object_id'); 
     258        $objectSelector = Node::getSelectNodeUI('object_id',null,"table"); 
     259        $displayEditButton = false; 
    259260        break; 
    260261 
  • trunk/wifidog-auth/wifidog/classes/Node.php

    r1013 r1025  
    230230        * @return html markup 
    231231        */ 
    232         public static function getSelectNodeUI($user_prefix, $sql_additional_where = null) 
     232        public static function getSelectNodeUI($user_prefix, $sql_additional_where = null,$type_interface = "select") 
    233233        { 
    234234                global $db; 
    235235                $html = ''; 
    236236                $name = "{$user_prefix}"; 
    237                 $html .= _("Node: "); 
    238                 $sql = "SELECT node_id, name from nodes WHERE 1=1 $sql_additional_where ORDER BY node_id"; 
     237                $sql = "SELECT node_id, name, node_deployment_status, is_splash_only_node from nodes WHERE 1=1 $sql_additional_where ORDER BY node_id"; 
    239238                $node_rows = null; 
    240239                $db->execSql($sql, $node_rows, false); 
    241240                if ($node_rows != null) 
    242241                { 
    243                         // Naturally-sorting by node_id 
    244242                        Utils :: natsort2d($node_rows, "node_id"); 
    245                         $i = 0; 
    246                         foreach ($node_rows as $node_row) 
    247                         { 
    248                                 $tab[$i][0] = $node_row['node_id']; 
    249                                 $tab[$i][1] = $node_row['node_id'].": ".$node_row['name']; 
    250                                 $i ++; 
    251                         } 
    252                         $html .= FormSelectGenerator :: generateFromArray($tab, null, $name, null, false); 
     243                        if ($type_interface != "table") { 
     244                                $html .= _("Node"); 
     245                                $html .=  ": "; 
     246                                // Naturally-sorting by node_id 
     247                                $i = 0; 
     248                                foreach ($node_rows as $node_row) 
     249                                { 
     250                                        $tab[$i][0] = $node_row['node_id']; 
     251                                        $tab[$i][1] = $node_row['node_id'].": ".$node_row['name']; 
     252                                        $i ++; 
     253                                } 
     254                                $html .= FormSelectGenerator :: generateFromArray($tab, null, $name, null, false); 
     255                        } else { 
     256                                $html .= "<fieldset class='pretty_fieldset'>\n\t<legend>Node List</legend>\n"; 
     257                                $html .= "\t<span class='node_admin'>Filter: <input type='text' maxlength='40' size='40' id='nodes_list_filter' name='nodes_list_filter' /></span>\n\t<br/>\n"; 
     258                                $html .= "\t<!--[if IE]><style type='text/css'>#node_list_div table.scrollable>tbody { height: 15px; }</style><![endif]-->\n"; 
     259                                $html .= "\t<script src='" . BASE_URL_PATH . "js/filtertable.js' type='text/javascript' language='javascript' charset='utf-8'></script>\n"; 
     260                                $html .= "\t<script src='" . BASE_URL_PATH . "js/sorttable.js' type='text/javascript' language='javascript' charset='utf-8'></script>\n"; 
     261                                $html .= "\t<div id='node_list_div' class='node_admin tableContainer'>\n"; 
     262                                $html .= "\t\t<table id='nodes_list' class='node_admin filterable scrollable sortable'>\n\n"; 
     263                                $html .= "\t\t\t<thead class='fixedHeader'>\n\t\t\t\t<tr class='nofilter'>\n\t\t\t\t\t<th>Node Name</th>\n\t\t\t\t\t<th>Node ID</th>\n\t\t\t\t\t<th>Deployment Status</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>"; 
     264                                 
     265                                $i = 0; 
     266                                foreach ($node_rows as $node_row) 
     267                                { 
     268                                        $href = GENERIC_OBJECT_ADMIN_ABS_HREF."?object_id={$node_row['node_id']}&object_class=Node&action=edit"; 
     269                                        $html .= "\t\t\t\t<tr class='row' onclick=\"javascript:location.href='{$href}'\">\n\t\t\t\t\t<td>{$node_row['name']}<noscript>(<a href='{$href}'>edit</a>)</noscript></td>\n\t\t\t\t\t<td>{$node_row['node_id']}</td>\n\t\t\t\t\t<td>{$node_row['node_deployment_status']}</td>\n\t\t\t\t</tr>\n"; 
     270                                } 
     271                                $html .= "\t\t\t</tbody>\n\t\t</table>\n"; 
     272                                $html .= "\t</div>\n"; 
     273                                $html .= "</fieldset>\n"; 
     274                                 
     275                        } 
     276                } else { 
     277                        $html .= "<div class='warningmsg'>"._("Sorry, no nodes available in the database")."</div>\n"; 
    253278                } 
    254279                return $html; 
    255280        } 
     281         
    256282 
    257283        /** Get the selected Network object. 
  • trunk/wifidog-auth/wifidog/local_content/common/stylesheet.css

    r1012 r1025  
    315315 
    316316.admin_section_list { /* list of elements inside a section */ 
    317 display: compact; 
     317        display: compact; 
    318318} 
    319319/*.admin_section_list_item { display: inline; }*/ 
     
    555555.flickr_tags li a { 
    556556    color: white; 
    557     font-size: normal; 
     557    /* font-size: normal; - invalid? */ 
    558558    text-decoration: none; 
    559559} 
     
    737737} 
    738738/********** End Google map section **********/ 
     739 
     740/********** Scrollable Table Section ********/ 
     741#node_list_div { 
     742        background: inherit; 
     743        overflow: auto; 
     744        height: 400px; 
     745        width: 97%; 
     746        min-width: 500px; 
     747        text-align: center; 
     748        border: 1px solid blue; 
     749} 
     750#node_list_div table.scrollable>tbody { 
     751        /* child selector syntax which IE6 and older do not support */ 
     752        overflow: auto; 
     753        height: 378px; 
     754        width: 100%; 
     755} 
     756\html div.tableContainer table/* */ { 
     757        margin: 0 -16px 0 0 
     758} 
     759\html div.tableContainer/* */ { 
     760        padding: 0 16px 0 0; 
     761} 
     762table.scrollable thead tr { 
     763        position: relative; 
     764} 
     765html>body thead tr { 
     766        width: 100%; 
     767} 
     768table.scrollable { 
     769    width: 99%; 
     770    border-collapse: collapse; 
     771    border-spacing: 0px; 
     772} 
     773table.scrollable thead th { 
     774    display:inline-block; 
     775    font-weight: bold; 
     776    text-align: center; 
     777    border-top: solid 2px #000000; 
     778    border-bottom: solid 2px #000000; 
     779    background-color: #CCC; 
     780    color: #000099; 
     781    width: 200px; 
     782} 
     783table.scrollable tr.row:hover,tr.hover{ 
     784        background-color: #2175bc; 
     785        color: #ff0000; 
     786} 
     787table.scrollable tr { 
     788        cursor: pointer; 
     789} 
     790table.scrollable td { 
     791    color: #000000; 
     792    padding-left: 5px; 
     793    font-size: 12px; 
     794    text-align: left; 
     795} 
     796table.scrollable thead td:last-child { padding-right: 25px; } 
     797 
     798table.scrollable thead th:last-child { padding-right: 25px; } 
     799 
     800/******* End Scrollable Table Section ********/ 
     801 
     802/********** Sortable Table Section ***********/ 
     803 
     804table.sortable a.sortheader { 
     805    background-color:#CCC; 
     806    color:#000099; 
     807    font-weight: bold; 
     808    text-decoration: none; 
     809    display: block; 
     810    font-size: 12px; 
     811} 
     812table.sortable span.sortarrow { 
     813    color: black; 
     814    text-decoration: none; 
     815} 
     816table.sortable tr.odd { 
     817        background-color: #eee; 
     818} 
     819table.sortable tr.even { 
     820        background-color: #fff; 
     821} 
     822 
     823 
     824/****** End Sortable Table Section ***********/