Changeset 1257

Show
Ignore:
Timestamp:
07/16/07 22:45:59 (6 years ago)
Author:
benoitg
Message:
  • Fix display of wifidog uptime in node list
Location:
trunk/wifidog-auth
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/CHANGELOG

    r1256 r1257  
    22 
    332007-06-16  Benoit Grégoire  <bock@step.polymtl.ca> 
     4        * Fix display of wifidog uptime in node list 
    45        * Preliminary skinning of the menu 
    56        * Network::getNumOnlineUsers():  Fix #40 by counting active connexion tokens, not distinct user id's.  That way users logged in twice (splash-only, or username if allowed in network config) will be counted twice.  
  • trunk/wifidog-auth/wifidog/include/schema_validate.php

    r1253 r1257  
    12561256        $sql .= "INSERT into roles (role_id, stakeholder_type_id) VALUES ('NODE_OWNER', 'Node');\n"; 
    12571257        $db->execSql("SELECT * FROM node_stakeholders WHERE is_owner = true", $results, false); 
    1258         foreach ($results as $row) { 
    1259             $sql .= "INSERT into node_stakeholders (user_id, role_id, object_id) VALUES ('{$row['user_id']}', 'NODE_OWNER', '{$row['node_id']}');\n"; 
     1258        if($results) { 
     1259            foreach ($results as $row) { 
     1260                $sql .= "INSERT into node_stakeholders (user_id, role_id, object_id) VALUES ('{$row['user_id']}', 'NODE_OWNER', '{$row['node_id']}');\n"; 
     1261            } 
    12601262        } 
    12611263        $sql .= "INSERT into roles (role_id, stakeholder_type_id) VALUES ('NODE_TECH_OFFICER', 'Node');\n"; 
    12621264        $db->execSql("SELECT * FROM node_stakeholders WHERE is_tech_officer = true", $results, false); 
    1263         foreach ($results as $row) { 
    1264             $sql .= "INSERT into node_stakeholders (user_id, role_id, object_id) VALUES ('{$row['user_id']}', 'NODE_TECH_OFFICER', '{$row['node_id']}');\n"; 
     1265        if($results) { 
     1266            foreach ($results as $row) { 
     1267                $sql .= "INSERT into node_stakeholders (user_id, role_id, object_id) VALUES ('{$row['user_id']}', 'NODE_TECH_OFFICER', '{$row['node_id']}');\n"; 
     1268            } 
    12651269        } 
    12661270 
  • trunk/wifidog-auth/wifidog/node_list.php

    r1249 r1257  
    9898        $sort_by_param_sql = $sort_by_param; 
    9999    } 
    100     $sql = "SELECT node_id, gw_id, name, last_heartbeat_user_agent, (CURRENT_TIMESTAMP-last_heartbeat_timestamp) AS since_last_heartbeat, last_heartbeat_ip, CASE WHEN ((CURRENT_TIMESTAMP-last_heartbeat_timestamp) < interval '5 minutes') THEN true ELSE false END AS online, creation_date, node_deployment_status FROM nodes WHERE node_deployment_status != 'PERMANENTLY_CLOSED' ORDER BY {$sort_by_param_sql}"; 
     100    $sql = "SELECT node_id, gw_id, name, last_heartbeat_user_agent, (CURRENT_TIMESTAMP-last_heartbeat_timestamp) AS since_last_heartbeat, last_heartbeat_ip, CASE WHEN ((CURRENT_TIMESTAMP-last_heartbeat_timestamp) < interval '5 minutes') THEN true ELSE false END AS online, creation_date, node_deployment_status, last_heartbeat_wifidog_uptime FROM nodes WHERE node_deployment_status != 'PERMANENTLY_CLOSED' ORDER BY {$sort_by_param_sql}"; 
    101101} 
    102102else { 
    103     $sql = "SELECT node_id, gw_id, name, last_heartbeat_user_agent, (CURRENT_TIMESTAMP-last_heartbeat_timestamp) AS since_last_heartbeat, last_heartbeat_ip, CASE WHEN ((CURRENT_TIMESTAMP-last_heartbeat_timestamp) < interval '5 minutes') THEN true ELSE false END AS online, creation_date, node_deployment_status FROM nodes WHERE node_deployment_status != 'PERMANENTLY_CLOSED' ORDER BY " . DEFAULT_SORT_BY_PARAM; 
     103    $sql = "SELECT node_id, gw_id, name, last_heartbeat_user_agent, (CURRENT_TIMESTAMP-last_heartbeat_timestamp) AS since_last_heartbeat, last_heartbeat_ip, CASE WHEN ((CURRENT_TIMESTAMP-last_heartbeat_timestamp) < interval '5 minutes') THEN true ELSE false END AS online, creation_date, node_deployment_status, last_heartbeat_wifidog_uptime FROM nodes WHERE node_deployment_status != 'PERMANENTLY_CLOSED' ORDER BY " . DEFAULT_SORT_BY_PARAM; 
    104104} 
    105105$nodes_results = null; 
     
    117117    $node = Node :: getObject($node_row['node_id']); 
    118118    $node_row['duration'] = $db->GetDurationArrayFromIntervalStr($node_row['since_last_heartbeat']); 
     119    if($node_row['last_heartbeat_wifidog_uptime']) { 
     120    $node_row['wifidog_uptime'] = $db->GetDurationArrayFromIntervalStr($node_row['last_heartbeat_wifidog_uptime'].' seconds'); 
     121    } 
    119122    $node_row['num_online_users'] = $node->getNumOnlineUsers(); 
    120123    $nodeDeploymentStatus = $node_row['node_deployment_status']; 
  • trunk/wifidog-auth/wifidog/templates/node_list.html

    r1253 r1257  
    3636                    {if $nodes[node].online == 't'} 
    3737                    <img src='{$common_images_url}HotspotStatus/up.gif'> 
    38                         {if $nodes[node].last_heartbeat_wifidog_uptime != ''} 
    39                                 {$nodes[node].last_heartbeat_wifidog_uptime.days} {"days"|_} {$nodes[node].last_heartbeat_wifidog_uptime.hours}{"h"|_} {$nodes[node].last_heartbeat_wifidog_uptime.minutes}{"min"|_}<br /> 
     38                        {if $nodes[node].wifidog_uptime != ''} 
     39                                {$nodes[node].wifidog_uptime.days} {"days"|_} {$nodes[node].wifidog_uptime.hours}{"h"|_} {$nodes[node].wifidog_uptime.minutes}{"min"|_}<br /> 
    4040                        {/if} 
    4141                    {else}