Changeset 70


Ignore:
Timestamp:
Mar 5, 2009, 4:09:03 PM (16 years ago)
Author:
jazz
Message:
  • get_data.php
    • 加入 website 資訊
  • 加入開啟 InforWindow? 視窗的程式
Location:
oceandb/jQuery_Prototype
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • oceandb/jQuery_Prototype/data/get_data.php

    r68 r70  
    11<?
    22  require_once('../db-config/connect-mysql.php');
    3   $query = "SELECT data_type.serial AS type_id, maincase_new.owner_org, maincase_new.loc1_lon, maincase_new.loc1_lat FROM data_type, maincase_new, maincase_detail WHERE maincase_detail.maincase_id = maincase_new.serial AND maincase_detail.type_id = data_type.serial AND type_id =" . $_GET['type_id'] . " AND owner_org = '" . $_GET['owner_org'] . "' ORDER BY loc1_lon, loc1_lat";
     3  $query = "SELECT data_type.serial AS type_id, maincase_new.owner_org, maincase_new.loc1_lon, maincase_new.loc1_lat, maincase_new.description, maincase_new.website FROM data_type, maincase_new, maincase_detail WHERE maincase_detail.maincase_id = maincase_new.serial AND maincase_detail.type_id = data_type.serial AND type_id =" . $_GET['type_id'] . " AND owner_org = '" . $_GET['owner_org'] . "' ORDER BY loc1_lon, loc1_lat";
    44  if ($database_connect) mysql_select_db($database_connect) or die('USE '.$database_connect.' failed!');
    55  $result = mysql_query($query) or die("Query failed! $query");
     
    1111    {
    1212      $col= mysql_fetch_row($result);
    13       echo "{ \"type_id\" : " . $col[0] . ", \"owner_org\" : \"" . $col[1] . "\", \"loc1_lon\" : \"" . $col[2] . "\", \"loc1_lat\" : \"" . $col[3] . "\"},\n";
     13      echo "{ \"type_id\" : " . $col[0] . ", \"owner_org\" : \"" . $col[1] . "\", \"loc1_lon\" : \"" . $col[2] . "\", \"loc1_lat\" : \"" . $col[3] . "\", \"description\" : \"" . $col[4] . "\", \"website\" : \"" . $col[5] . "\"},\n";
    1414    }
    1515    echo "]";
  • oceandb/jQuery_Prototype/script/oceandb.js

    r68 r70  
    4343      }
    4444      // 根據 type_id 逐一加入 owner_org
    45       $("#map-menu-" + item.type_id).append("<li><input type='checkbox' id='map-menu-"
    46          + item.type_id + "-" + count +"'>"
     45      $("#map-menu-" + item.type_id).append("<li><input type='checkbox' "
     46         + "id='map-menu-" + item.type_id + "-" + count +"'>"
    4747         + item.owner_org + "</input></li>");
    4848
     
    6060      $.each(json,function(i,item){
    6161        if(checked) {
    62     map.addOverlay(new GMarker(new GLatLng(item.loc1_lat, item.loc1_lon)));
     62    var latlon = new GLatLng(item.loc1_lat, item.loc1_lon);
     63    var marker = new GMarker(latlon);
     64    GEvent.addListener(marker, 'click', function() {
     65      map.openInfoWindowHtml(latlon, "參考連結:<a href='"
     66      + item.website + "' target='_NEW'>" + item.website + "</a>"
     67      + "<iframe width='640' height='300' src='"
     68      + item.website + "'/>");
     69    });
     70    map.addOverlay(marker);
    6371        } else {
    6472    map.clearOverlays();
     73    map.closeInfoWindow();
    6574        }
    6675      });
Note: See TracChangeset for help on using the changeset viewer.