home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 February / Chip_2003-02_cd1.bin / tema / tipy / shocart.mht / tms_scripts.php < prev    next >
Encoding:
Text File  |  2003-01-06  |  5.1 KB  |  160 lines

  1. // Copyright 2000 T-Mapy spol. s r. o. All rights reserved.
  2.  
  3. root_script = 'http://shocart.tmapserver.cz/tms/shocart';
  4. w_left = 50;
  5. w_top = 50;
  6. w_width = 710;
  7. w_height = 515;
  8. w_features = ',menubar';
  9. strange_opener = 1;
  10. map_window = null;
  11.  
  12. isN = false;
  13. isIE = false;
  14. version = 0;
  15. if (navigator.appName == "Netscape") {
  16.   isN = true;
  17.   if (navigator.appVersion.search("5.0") == -1)
  18.     version = 4;
  19.   else version = 5;
  20. }
  21. else isIE = true;
  22.  
  23. function Map() {
  24.   newwindow = window.open(root_script+'/index.php?client_type=shocart&client_lang=cz&strange_opener=1', 'TMapServer','status,width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+w_features);
  25.   newwindow.focus();
  26. }
  27.  
  28. function MapScript(script) {
  29.   newwindow = window.open(script, 'TMapServer','status,width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+w_features);
  30.   newwindow.focus();
  31. }
  32.  
  33. function MapScriptWindow(script, width, height) {
  34.   newwindow = window.open(script, 'TMapServer','status,width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+w_features);
  35.   newwindow.focus();
  36. }
  37.  
  38. function GetUrl(l) {
  39.   var script = l.pathname;
  40.   var arr = script.split('/');
  41.   arr.length = arr.length-1;
  42.   script = arr.join('/');
  43.   return l.protocol + '//' + l.host + script;
  44. }
  45.  
  46. function MapExist() {
  47.   var exist = false;
  48.   if (strange_opener !=1) {
  49.     if (parent.opener != null) { 
  50.       if (!parent.opener.closed) { 
  51.         if (parent.opener.name == 'map_panel') {
  52.           exist = true;
  53.           map_window = parent.opener.top;
  54.         }
  55.       }
  56.     }  
  57.     if (!exist) {
  58.       if (parent.name == 'map_db') {
  59.         if (parent.map_window != null) {
  60.           if (!parent.map_window.closed) { 
  61.             map_window = parent.map_window;
  62.             exist = true;
  63.           }
  64.         }
  65.       }
  66.     }  
  67.     if (!exist) {
  68.       if (map_window != null) { if (!map_window.closed) exist = true; }
  69.     }
  70.     //alert('map_window');
  71.   }
  72.   return exist;
  73. }
  74.  
  75. function SetMap(map_exist, str) {
  76.   if (top.map_interface != null) {
  77.     top.map_interface.location.href = GetUrl(top.map_interface.location) + '/db_interface.php?' + str;
  78.   }
  79.   else {
  80.     if (map_exist && (strange_opener != 1)) {
  81.       map_window.map_interface.location.href = GetUrl(map_window.map_interface.location) + '/db_interface.php?' + str;
  82.       map_window.focus();
  83.     }
  84.     else {
  85.       var script = root_script + '/index.php?client_type=shocart&strange_opener=1&interface=tmv&' + str;
  86.       var win_feature = 'status,width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+w_features;
  87.       map_window = window.open('','TMapServer',win_feature);
  88.       if (map_window.map_interface != null && strange_opener != 1) map_window.map_interface.location.href = GetUrl(map_window.map_interface.location) + '/db_interface.php?' + str;
  89.       else map_window.location.href = script;
  90.       if (strange_opener !=1) {
  91.         if (parent.name == 'map_db') parent.map_window = map_window;
  92.       }  
  93.       map_window.focus();
  94.     }
  95.   }
  96. }
  97.  
  98. function ShowMap(theme,field,code,zoom,lang) {
  99.   var str = 'Theme='+theme+'&Command=SelByFld&Field='+field+'&Values='+code+'&Zoom='+zoom+'&Percent=110&client_lang='+lang+'&strange_opener=1&Project=TMS_SHOCART&cacheID=';
  100.   str = str + (new Date).getTime();
  101.  
  102.   SetMap(MapExist(), str);
  103. }
  104.  
  105. function ShowMapEx(parameters,lang) {
  106.   var str = parameters + '&Project=TMS_SHOCART&strange_opener=1&client_lang='+lang + '&cacheID=' + (new Date).getTime();
  107.  
  108.   SetMap(MapExist(), str);
  109. }
  110.  
  111. function DynamicMap(id) {
  112.     var code = id.split("_");
  113.     ShowMap('spot','ID',code[0],'ToScale','cz');
  114. }
  115.  
  116. map_db=null;
  117.  
  118. function NTM_SearchField(mapa,formular,agenda_path,db_win,server_name,select_field) {
  119.           var exist=false;
  120.     if (!mapa) mapa="TMS_MAPA_CR";
  121.     if (!server_name) server_name='http://shocart.tmapserver.cz';
  122.     if (!db_win) db_win="map_db";
  123.     if (!formular) formular=document.search_form;
  124.     if (!agenda_path) agenda_path='.';
  125.     if (!select_field) select_field='NAZEV1';
  126.     if (map_db != null) {if (!map_db.closed) exist=true;}
  127.     if (isN) {
  128.       if (formular.search_select.selectedIndex == null) {
  129.         var name=formular.search_select.value;
  130.       } else {
  131.         var index = formular.search_select.selectedIndex;
  132.         var name=formular.search_select.options[index].value;
  133.       }
  134.     }
  135.     else
  136.       var name=formular.search_select.value;
  137.     if (name!="nosearch") {
  138.       var fld="NAZEV";
  139. //        var script='http://shocart.tmapserver.cz'+ agenda_path +name+'/brow.php?MAP='+mapa+'&cacheId=1&client_type=shocart&client_lang=cz&strange_opener=1&NAZEV1=';
  140.            var script=server_name + agenda_path +name+'/brow.php?MAP='+mapa+'&cacheId=1&client_type=shocart&client_lang=cz&strange_opener=1&'+select_field+'=';
  141.         if (formular.NAZEV.value != '') {
  142.         script=script+formular.NAZEV.value;
  143.           if ((select_field == 'NAZEV') || (select_field == 'NAZEV1')) script=script;
  144.             if (exist) {
  145.                 map_db.location.href=script;
  146.                 map_db.focus();
  147.             }
  148.             else {
  149.   //            var db=map.window.db;
  150.                 map_db=window.open(script, db_win,"scrollbars,width=500,height=250,left=0,top=0,resizable");
  151.                 map_db.focus();
  152.             }
  153.         }
  154.         else alert('Nelze zadat prßzdn² v²b∞r !');
  155.     }
  156.     else alert('Nelze zadat prßzdn² v²b∞r !');
  157. //    return false;
  158. }
  159.  
  160.