Ignore:
Timestamp:
Jan 21, 2009, 11:23:54 PM (16 years ago)
Author:
jazz
Message:
  • Main.js
    • add click event to menu button to show/hide menu
    • add checked event to deepsea checkbox to show XML data
  • Main.widgets.js
    • modified layout
Location:
oceandb/webapproot/pages/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • oceandb/webapproot/pages/Main/Main.js

    r49 r50  
     1var map;            // map 物件必須是全域變數,才能讓每個圖層存取
    12dojo.declare("Main", wm.Page, {
    23  start: function() {
    34    if (GBrowserIsCompatible()) {
    4      var map = new GMap2(dojo.byId(this.map).domNode);    // 透過 Dojo 取得 DOM 中,名稱為 map 的元件
    5      map.addControl(new GLargeMapControl());          // 加入左上角比例尺規控制列
    6      map.addControl(new GScaleControl());            // 加入左下角比例尺狀態列
    7      map.addControl(new GMapTypeControl());           // 加入右上角"地圖","衛星","混合地圖"按鈕
    8      map.setCenter(new GLatLng(23.8,121), 7);         // 設定預設經緯度北緯 23.8, 東經 121, 預設比例尺 100 公里(7)
    9      map.setMapType(G_SATELLITE_MAP);              // 設定預設底圖為"衛星"
     5     map = new GMap2(dojo.byId(this.map).domNode);      // 透過 Dojo 取得 DOM 中,名稱為 map 的元件
     6     map.addControl(new GLargeMapControl());    // 加入左上角比例尺規控制列
     7     map.addControl(new GScaleControl());   // 加入左下角比例尺狀態列
     8     map.addControl(new GMapTypeControl());   // 加入右上角"地圖","衛星","混合地圖"按鈕
     9     map.setCenter(new GLatLng(23.8,121), 7);   // 設定預設經緯度北緯 23.8, 東經 121, 預設比例尺 100 公里(7)
     10     map.setMapType(G_SATELLITE_MAP);     // 設定預設底圖為"衛星"
    1011    }
    11     var request = GXmlHttp.create();                      // 產生一個非同步的 AJAX XMLHttp 物件
     12  },
     13  deepseaChange: function(inSender, inDisplayValue, inDataValue) {
     14   if(this.deepsea.dataValue)
     15   {
     16    var request = GXmlHttp.create();                    // 產生一個非同步的 AJAX XMLHttp 物件
    1217    var GetDataXml="getdeepstaxml.xml";
    13     request.open("GET",GetDataXml, true);                    // 用 XMLHttp 物件去開啟 http://deepsea.biodiv.tw/getdeepstaxml.asp
    14     request.onreadystatechange = function() {                 // 定義 XMLHttp 有狀態改變的事件處理函數 callback function
     18    request.open("GET",GetDataXml, true);               // 用 XMLHttp 物件去開啟 http://deepsea.biodiv.tw/getdeepstaxml.asp
     19    request.onreadystatechange = function() {           // 定義 XMLHttp 有狀態改變的事件處理函數 callback function
    1520     if (request.readyState == 4) {                     // XMLHttp 的狀態是 Ready (4) 繼續處理 Server 傳回的 XML 資料
    16       var xmlDoc = request.responseXML;                   // xmlDoc = 回傳的 XML 資料
     21      var xmlDoc = request.responseXML;                 // xmlDoc = 回傳的 XML 資料
    1722      var markers = xmlDoc.documentElement.getElementsByTagName("marker");  // 取出名稱為 marker 的 xml 元件, 結果是陣列
    1823      for (var i = 0; i < markers.length; i++) {
    19        var points2 = [];                          // 宣告一個空的陣列 point2 來存起始與結束座標點
     24       var points2 = [];        // 宣告一個空的陣列 point2 來存起始與結束座標點
    2025       // 把 lat1 跟 lng1 塞進起始座標點 GLatLng 物件
    2126       points2.push(new GLatLng(parseFloat(markers[i].getAttribute("lat1")),parseFloat(markers[i].getAttribute("lng1"))));
     
    3035     }
    3136    }
    32     request.send(null);                                      // 送出 XMLHttp 物件的要求
     37    request.send(null);         // 送出 XMLHttp 物件的要求   
     38   }
     39  },
     40  showmenuClick: function(inSender, inEvent) {
     41   this.menu.getValue("showing") ? this.menu.setValue("showing",false) : this.menu.setValue("showing",true);
     42   map.setCenter(new GLatLng(23.8,121), 7);   // 設定預設經緯度北緯 23.8, 東經 121, 預設比例尺 100 公里(7)
    3343  },
    3444  _end: 0
  • oceandb/webapproot/pages/Main/Main.widgets.js

    r48 r50  
    11Main.widgets = {
    22  layoutBox1: ["wm.Layout", {box: "v", height: "1flex"}, {}, {
    3     template1: ["wm.Template", {height: "96px"}, {}, {
    4       header: ["wm.Panel", {_classes: {domNode: ["wm_Padding_8px", "wm_SilverBlueTheme_LightBlueInsetPanel"]}, box: "h", height: "78px", boxPosition: "topLeft"}, {}, {
    5         panel4: ["wm.Panel", {box: "v", width: "1flex"}, {}, {
    6           chineseheader: ["wm.Label", {_classes: {domNode: ["wm_FontFamily_Verdana", "wm_FontSize_300percent"]}, caption: "台灣海洋資訊資料庫聯盟網", link: "http://oceandb.info", height: "48px"}, {}, {
    7             format: ["wm.DataFormatter", {}, {}]
     3    template2: ["wm.Template", {height: "1flex"}, {}, {
     4      toolbar: ["wm.Panel", {_classes: {domNode: ["wm_SilverBlueTheme_LightBlueOutsetPanel", "wm_Padding_4px"]}, box: "h", height: "22px"}, {}, {
     5        home: ["wm.Button", {_classes: {domNode: ["wm_TextDecoration_Bold", "wm_FontSize_120percent", "wm_FontFamily_Verdana", "wm_TextAlign_Center"]}, width: "63px", autoSize: false, caption: "HOME", hint: "台灣海洋資訊資料庫聯盟網 Taiwan Ocean Informatioan Database"}, {}],
     6        spacer1: ["wm.Spacer", {width: "10px"}, {}],
     7        showmenu: ["wm.Button", {_classes: {domNode: ["wm_FontFamily_Verdana", "wm_TextDecoration_Bold", "wm_FontSize_120percent"]}, width: "61px", autoSize: false, caption: "MENU", height: "18px"}, {onclick: "showmenuClick"}],
     8        spacer2: ["wm.Spacer", {width: "10px"}, {}],
     9        news: ["wm.Button", {_classes: {domNode: ["wm_FontFamily_Verdana", "wm_FontSize_120percent", "wm_TextDecoration_Bold", "wm_TextAlign_Center"]}, width: "62px", autoSize: false, caption: "NEWS"}, {}],
     10        spacer: ["wm.Spacer", {width: "10px"}, {}],
     11        about: ["wm.Button", {_classes: {domNode: ["wm_TextAlign_Center", "wm_TextDecoration_Bold", "wm_FontSize_120percent", "wm_FontFamily_Verdana"]}, width: "69px", autoSize: false, caption: "ABOUT"}, {}],
     12        spacer3: ["wm.Spacer", {width: "96px"}, {}],
     13        title: ["wm.Label", {_classes: {domNode: ["wm_FontFamily_Verdana", "wm_TextDecoration_Bold", "wm_TextAlign_Right", "wm_FontSize_150percent"]}, caption: "台灣海洋資訊資料庫聯盟網 Taiwan Ocean Informatioan Database", link: "http://oceandb.info", width: "1flex"}, {}, {
     14          format: ["wm.DataFormatter", {}, {}]
     15        }]
     16      }],
     17      main: ["wm.Panel", {box: "h", height: "1flex"}, {}, {
     18        menu: ["wm.Panel", {_classes: {domNode: ["wm_SilverBlueTheme_LightBlueInsetPanel"]}, box: "v", width: "246px"}, {}, {
     19          deepsea: ["wm.CheckBoxEditor", {emptyValue: "null", caption: "台灣深海生物分佈資料庫", captionSize: "180px", captionAlign: "left", captionPosition: "right", height: "20px"}, {onchange: "deepseaChange"}, {
     20            editor: ["wm._CheckBoxEditor", {dataType: "boolean"}, {}]
    821          }],
    9           englishheader: ["wm.Label", {_classes: {domNode: ["wm_FontFamily_Verdana", "wm_FontSize_150percent", "wm_TextDecoration_Bold", "wm_TextDecoration_Underline", "wm_FontColor_LightGray"]}, caption: "Taiwan Ocean Informatioan Database", height: "16px"}, {}, {
    10             format: ["wm.DataFormatter", {}, {}]
     22          boat: ["wm.CheckBoxEditor", {caption: "航行軌跡", captionSize: "180px", captionAlign: "left", captionPosition: "right", height: "20px"}, {}, {
     23            editor: ["wm._CheckBoxEditor", {dataType: "boolean"}, {}]
    1124          }]
    1225        }],
    13         logo: ["wm.Picture", {source: "http://www.tori.narl.org.tw/images/tori_logo.png", aspect: "v", link: "http://www.tori.narl.org.tw", autoSize: true}, {}]
    14       }]
    15     }],
    16     template2: ["wm.Template", {height: "1flex"}, {}, {
    17       toolbar: ["wm.Panel", {_classes: {domNode: ["wm_SilverBlueTheme_ToolBar"]}, box: "h", height: "26px"}, {}, {
    18         home: ["wm.Button", {_classes: {domNode: ["wm_TextDecoration_Bold", "wm_FontSize_120percent", "wm_FontFamily_Verdana", "wm_TextAlign_Center"]}, width: "63px", caption: "HOME"}, {}],
    19         spacer1: ["wm.Spacer", {width: "10px"}, {}],
    20         news: ["wm.Button", {_classes: {domNode: ["wm_FontFamily_Verdana", "wm_FontSize_120percent", "wm_TextDecoration_Bold", "wm_TextAlign_Center"]}, width: "62px", caption: "NEWS"}, {}],
    21         spacer2: ["wm.Spacer", {width: "10px"}, {}],
    22         about: ["wm.Button", {_classes: {domNode: ["wm_TextAlign_Center", "wm_TextDecoration_Bold", "wm_FontSize_120percent", "wm_FontFamily_Verdana"]}, width: "69px", caption: "ABOUT"}, {}]
    23       }],
    24       main: ["wm.Panel", {box: "h", height: "1flex"}, {}, {
    25         menu: ["wm.Panel", {_classes: {domNode: ["wm_SilverBlueTheme_LightBlueInsetPanel"]}, box: "v", width: "246px"}, {}],
    26         splitter1: ["wm.Splitter", {width: "6px"}, {}],
    27         map: ["wm.Panel", {_classes: {domNode: ["wm_SilverBlueTheme_MainInsetPanel"]}, box: "v", width: "1flex"}, {}]
     26        MapPanel: ["wm.Panel", {_classes: {domNode: ["wm_SilverBlueTheme_MainInsetPanel", "height:500px"]}, box: "v", width: "1flex", boxPosition: "topLeft"}, {}, {
     27          map: ["wm.Html", {height: "1flex"}, {}]
     28        }]
    2829      }]
    2930    }],
    3031    template3: ["wm.Template", {height: "29px"}, {}, {
    31       footer: ["wm.Panel", {_classes: {domNode: ["wm_SilverBlueTheme_LightBlueInsetPanel"]}, box: "h", height: "20px", boxPosition: "center"}, {}, {
    32         footerLabel: ["wm.Label", {_classes: {domNode: ["wm_FontColor_Blue", "wm_TextDecoration_Bold", "wm_FontSize_120percent", "wm_FontFamily_Verdana"]}, caption: "Copyright 2008 TORI & NCHC, NARL, Taiwan", width: "315px", height: "", autoSize: true}, {}, {
     32      footer: ["wm.Panel", {_classes: {domNode: ["wm_SilverBlueTheme_LightBlueInsetPanel", "wm_Padding_2px"]}, box: "h", lock: true, height: "42px", boxPosition: "center"}, {}, {
     33        footerLabel: ["wm.Label", {_classes: {domNode: ["wm_FontColor_Blue", "wm_TextDecoration_Bold", "wm_FontSize_120percent", "wm_FontFamily_Verdana"]}, caption: "Copyright 2008 <a href='http://www.tori.narl.org.tw'>TORI</a> & <a href='http://www.nchc.org.tw'>NCHC</a>, <a href='http://www.narl.org.tw'>NARL</a>, Taiwan", width: "315px", height: "", autoSize: true}, {}, {
    3334          format: ["wm.DataFormatter", {}, {}]
    34         }]
     35        }],
     36        spacer4: ["wm.Spacer", {width: "1flex"}, {}],
     37        tori: ["wm.Picture", {height: "", source: "http://www.tori.narl.org.tw/images/tori_logo.png", link: "http://www.tori.narl.org.tw", width: "140px", aspect: "v"}, {}],
     38        spacer5: ["wm.Spacer", {width: "10px"}, {}],
     39        nchc: ["wm.Picture", {source: "http://www.nchc.org.tw/web_images/tw/header/logo.jpg", link: "http://www.nchc.org.tw", width: "140px", aspect: "v"}, {}]
    3540      }]
    3641    }]
Note: See TracChangeset for help on using the changeset viewer.