Show
Ignore:
Timestamp:
02/11/10 17:34:27 (2 years ago)
Author:
gbastien
Message:

* Merged recent changes in the trunk into this branch
* New token architecture not yet fully functional, nor tested, but ...

  • can now edit token templates for different context of tokens (from the edit netork interface at the bottom of page)
  • Users connected through a wifidog gateway can view their connection token information
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/newtoken/wifidog/classes/MainUI.php

    r1435 r1446  
    329329        // Get all network content and node "everywhere" content 
    330330        $content_rows = null; 
    331         $network_id = $db->escapeString(Network :: getCurrentNetwork()->getId()); 
    332         $sql_network = "(SELECT content_id, display_area, display_order, subscribe_timestamp FROM network_has_content WHERE network_id='$network_id'  AND display_page='everywhere') "; 
    333331        $node = Node :: getCurrentNode(); 
    334         $sql_node = null; 
     332        // Get all the parent objects of the node 
    335333        if ($node) { 
    336             // Get all node content 
    337             $node_id = $db->escapeString($node->getId()); 
    338             $sql_node = "UNION (SELECT content_id, display_area, display_order, subscribe_timestamp FROM node_has_content WHERE node_id='$node_id'  AND display_page='everywhere')"; 
    339         } 
    340         $sql = "SELECT * FROM ($sql_network $sql_node) AS content_everywhere ORDER BY display_area, display_order, subscribe_timestamp DESC"; 
    341  
     334            $parents = HotspotGraph::getAllParents($node); 
     335        } else { 
     336            $parents = array(Network :: getCurrentNetwork()->getHgeId()); 
     337        } 
     338         
     339        $first = $db->escapeString(array_shift($parents)); 
     340        $sql_from = "(SELECT content_id, display_area, display_order, subscribe_timestamp  
     341                                FROM hotspot_graph_element_has_content hgehc  
     342                                WHERE hotspot_graph_element_id='$first' AND display_page='everywhere')"; 
     343         
     344        // Get the contents for all elements parents of and including the node, but exclude user subscribed content if user is known 
     345        foreach($parents as $parentid) { 
     346            $parent_id = $db->escapeString($parentid); 
     347            $sql_from .= " UNION (SELECT content_id, display_area, display_order, subscribe_timestamp  
     348                                FROM hotspot_graph_element_has_content hgehc  
     349                                WHERE hotspot_graph_element_id='$parent_id' AND display_page='everywhere')"; 
     350        } 
     351        $sql = "SELECT * FROM ($sql_from) AS content_everywhere ORDER BY display_area, display_order, subscribe_timestamp DESC"; 
    342352        $db->execSql($sql, $content_rows, false); 
    343353        if ($content_rows) {