From c8b2d511dba61edf08853fcaebc1a8dce44a6553 Mon Sep 17 00:00:00 2001 From: Ivan Date: Tue, 6 Jul 2010 11:47:58 +0400 Subject: [PATCH] [17] Function of search now is tested. Please, use stable version: 16 Signed-off-by: Ivan --- config.php | 6 +++- lib/html.php | 2 +- lib/main.js | 59 +++++++++++++++++++++++++++++++++++++++ search.php | 40 ++++++++++++++++++++++++++ sql/realmd_bugtracker.sql | 2 +- 5 files changed, 106 insertions(+), 3 deletions(-) create mode 100644 search.php diff --git a/config.php b/config.php index bdb7e8c..8ed689d 100644 --- a/config.php +++ b/config.php @@ -9,12 +9,14 @@ function get($id) ## dbhost: IP-address or domain name where is started server MySQL. ## dbuser: Username for connect to server MySQL. ## dbpass: Password for connect to server MySQL. + ## mangos: Name database of world. ## realmd: Name database of account. ## characters: Name database of characters. ##################################################################################################*/ "dbhost" => "localhost", "dbuser" => "mangos", "dbpass" => "mangos", + "mangos" => "mangos" "realmd" => "realmd", "characters" => "characters", /*################################################################################################## @@ -27,6 +29,7 @@ function get($id) ## anim: Animation progress-bar in list-page (boolean). ## LinkAccount: Link to page on deatil view account or false if it is not necessary. ## LinkPlayer: Link to page on deatil view character or false if it is not necessary. + ## searchlimit: Limit of query for search (query, creature, item, etc). ##################################################################################################*/ "title" => "Баг-трекер", "mingm" => 3, @@ -36,6 +39,7 @@ function get($id) "anim" => false, "LinkAccount" => "http://localhost/admin/account.php?id=", "LinkPlayer" => "http://localhost/admin/player.php?guid=", + "searchlimit" => 10, /*################################################################################################## ## Announce of updates ## CheckVersion: Check new version in git page of project (boolean). @@ -43,7 +47,7 @@ function get($id) ## checkdiff: Different in days for recheck updates. ##################################################################################################*/ "CheckVersion" => false, - "version" => 16, + "version" => 17, "checkdiff" => 2 ); diff --git a/lib/html.php b/lib/html.php index 2ee684e..3c10a6f 100644 --- a/lib/html.php +++ b/lib/html.php @@ -55,7 +55,7 @@ public function send() Название: - + diff --git a/lib/main.js b/lib/main.js index af7a7e7..1c76801 100644 --- a/lib/main.js +++ b/lib/main.js @@ -3,6 +3,65 @@ var detail_view = false; var m_viewdiv = 0; var m_nowview = -1; +function searchresult(id) +{ + var tmp = document.getElementById("type"); + var type = tmp.options[tmp.selectedIndex].value; + var link; + switch(type) + { + case "2": + link = "http://ru.wowhead.com/quest="; + break; + case "3": + link = "http://ru.wowhead.com/item="; + break; + case "4": + link = "http://ru.wowhead.com/npc="; + break; + case "5": + link = "http://ru.wowhead.com/object="; + break; + default: + return; + } + document.getElementById("db").value = link+id; +} + +function searchfor(val) +{ + var tmp = document.getElementById("type"); + var type = tmp.options[tmp.selectedIndex].value; + var table; + switch(type) + { + case "2": + table = "quest"; + break; + case "3": + table = "item"; + break; + case "4": + table = "creature"; + break; + case "5": + table = "gameobject"; + break; + default: + return; + } + $.ajax({ + type: "POST", + data: "table="+table+"&string="+type, + url: "search.php", + cache: false, + success: function(html) + { + alert(html); + } + }); +} + function fastchangestatus(id) { var list = document.getElementById("fastchange0"); diff --git a/search.php b/search.php new file mode 100644 index 0000000..02c4146 --- /dev/null +++ b/search.php @@ -0,0 +1,40 @@ +exe($cfg->get("mangos"),$query." LIMIT ".$cfg->get("searchlimit")); + $text = ''; + while($row=$sql->fetch($result)) + { + $text.= ''; + } + echo $text; +} +?> \ No newline at end of file diff --git a/sql/realmd_bugtracker.sql b/sql/realmd_bugtracker.sql index edc72fb..67317c0 100644 --- a/sql/realmd_bugtracker.sql +++ b/sql/realmd_bugtracker.sql @@ -1,4 +1,4 @@ -SET FOREIGN_KEY_CHECKS=0; +SET FOREIGN_KEY_CHECKS=0; DROP TABLE IF EXISTS `bt_map_id`; CREATE TABLE `bt_map_id` (