Changeset 1444

Show
Ignore:
Timestamp:
02/04/10 13:22:09 (3 years ago)
Author:
gbastien
Message:

* Bug fix: when creating new nodes and node groups, they are now automatically added as children of the network in the new hierarchy structure.

Location:
trunk/wifidog-auth/wifidog
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/wifidog/classes/HotspotGraph.php

    r1436 r1444  
    5656{ 
    5757 
     58    /** 
     59     * Adds a relation to the hotspot graph 
     60     * @param parentId the id of the parent 
     61     * @param childId the id of the child 
     62     */ 
     63    public static function addRelation($parentId, $childId) { 
     64        $db = AbstractDb :: getObject(); 
     65        $parentIdStr = $db->escapeString($parentId); 
     66        $childIdStr = $db->escapeString($childId); 
     67        $sql = "INSERT INTO hotspot_graph (child_element_id, parent_element_id) VALUES ('{$childIdStr}', '{$parentIdStr}');"; 
     68        $db->execSqlUpdate($sql, false); 
     69    } 
     70     
    5871    /** 
    5972     * Gets recursively all parents of the given object 
  • trunk/wifidog-auth/wifidog/classes/HotspotGraphElement.php

    r1436 r1444  
    116116     * @access public 
    117117     */ 
    118     public static function createNewObject($element_id, $element_type) 
     118    public static function createNewObject($element_id, $element_type, $parent_element = null) 
    119119    { 
    120120        $db = AbstractDb::getObject(); 
     
    130130        } 
    131131        $object = self::getObject($element_id, $element_type); 
     132         
     133        if (!is_null($parent_element)) { 
     134            if (method_exists($parent_element, 'getHgeId')) { 
     135                $parentid = $parent_element->getHgeId(); 
     136                $childid = $object->getHgeId(); 
     137                HotspotGraph::addRelation($parentid, $childid); 
     138            } 
     139        } 
     140         
    132141        return $object; 
    133142    } 
  • trunk/wifidog-auth/wifidog/classes/Node.php

    r1440 r1444  
    281281        } 
    282282 
    283         HotspotGraphElement::createNewObject($node_id, 'Node'); 
     283        HotspotGraphElement::createNewObject($node_id, 'Node', $network); 
    284284         
    285285        $object = self::getObject($node_id); 
  • trunk/wifidog-auth/wifidog/classes/NodeGroup.php

    r1440 r1444  
    170170        } 
    171171         
    172         HotspotGraphElement::createNewObject($node_group_id, 'NodeGroup'); 
     172        HotspotGraphElement::createNewObject($node_group_id, 'NodeGroup', $network); 
    173173 
    174174        $object = self::getObject($node_group_id); 
  • trunk/wifidog-auth/wifidog/ws/index.php

    r1439 r1444  
    112112set_exception_handler('wifidog_exception_handler'); 
    113113 
    114 throw (new WSException(_("The Wifidog API module is not fit for production yet.  The source code has been released to share ideas and help development, but it has not been thoroughly tested yet and may represent a security issue for now.  If you'd like to test the module, you can do so by commenting this line in the auth server's source code.  But it is highly not advised to do so in a production environment for now.  Please stay tuned for more development"))); 
     114//throw (new WSException(_("The Wifidog API module is not fit for production yet.  The source code has been released to share ideas and help development, but it has not been thoroughly tested yet and may represent a security issue for now.  If you'd like to test the module, you can do so by commenting this line in the auth server's source code.  But it is highly not advised to do so in a production environment for now.  Please stay tuned for more development"))); 
    115115 
    116116$service->setParams($_GET);