Changeset 15502

Show
Ignore:
Timestamp:
03/11/08 18:27:11 (7 months ago)
Author:
bergie
Message:

Enable manual zoom levels with maps and some bulletproofing

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midcom/midcom.helper.datamanager2/widget/position.php

    r14990 r15502  
    431431 
    432432        $orp_map = new org_routamc_positioning_map("{$this->_element_id}_map"); 
    433         $html .= $orp_map->show(420,300,false); 
     433        $html .= $orp_map->show(420, 300, null, false); 
    434434 
    435435        $html .= "\n</div><!-- tab_content_map ends -->\n"; 
  • trunk/midcom/org.routamc.positioning/map.php

    r14773 r15502  
    222222    /** 
    223223     * Display the map 
    224      */ 
    225     function show($width = 300, $height = 200, $echo_output=true) 
     224     * 
     225     * @param integer $width Width of the map in pixels 
     226     * @param integer $height Height of the map in pixels 
     227     * @param integer $zoom_level Zoom level of the map. Leave to NULL for autozoom 
     228     */ 
     229    function show($width = 300, $height = 200, $zoom_level = null, $echo_output = true) 
    226230    { 
    227231        $html = ''; 
     
    261265        $script .= "    mapstraction_{$this->id}.addSmallControls();\n"; 
    262266        $script .= "    mapstraction_{$this->id}.autoCenterAndZoom();\n"; 
    263         $script .= "}\n";         
     267        $script .= "}\n"; 
     268         
     269        if (!is_null($zoom_level)) 
     270        { 
     271            $script .= "    mapstraction_{$this->id}.setZoom({$zoom_level});\n"; 
     272        } 
     273         
    264274        if ($echo_output) 
    265275        { 
     
    267277        } 
    268278         
    269         if ($echo_output == true) 
    270         { 
    271             $output = $html.$script; 
    272             echo $output; 
    273         } 
    274         else 
     279        if (!$echo_output) 
    275280        { 
    276281            $_MIDCOM->add_jquery_state_script($script); 
    277282            return $html; 
    278         } 
     283        }       
     284         
     285        echo "{$html}{$script}"; 
    279286    } 
    280287     
  • trunk/midcom/org.routamc.positioning/object.php

    r14084 r15502  
    138138        ); 
    139139 
    140         if (   is_a($this->_object, 'midcom_baseclasses_database_person') 
    141             || is_a($this->_object, 'org_openpsa_contacts_person')) 
     140        if (   is_a($this->_object, 'midgard_person') 
     141            || is_a($this->_object, 'org_openpsa_person')) 
    142142        { 
    143143            // This is a person record. Seek log 
     
    158158        // Check if the object has a location set 
    159159        $location = $this->seek_location_object(); 
    160         if (is_object($location)) 
     160        if (   is_object($location) 
     161            && $location->guid) 
    161162        { 
    162163            $coordinates['latitude'] = $location->latitude;