From 3ab345f42c45e27061e1e3a0bacc3aaeb4890681 Mon Sep 17 00:00:00 2001 From: Ivan Date: Sat, 10 Jul 2010 20:05:57 +0400 Subject: [PATCH] [31] Fixed display on page list. Fixed menu search and viewing page. Signed-off-by: Ivan --- config.php | 2 +- lib/classes.php | 2 +- lib/create.php | 33 +++++++++++++++++++++++++++------ lib/html.php | 16 ++++++++++------ lib/main.js | 2 +- lib/style.css | 6 ------ saveset.php | 28 +++++++++++++++++----------- 7 files changed, 57 insertions(+), 32 deletions(-) diff --git a/config.php b/config.php index 5c23be8..3ea5b12 100644 --- a/config.php +++ b/config.php @@ -50,7 +50,7 @@ function get($id) ## installquery: Count of query for install. Do not change! ##################################################################################################*/ "CheckVersion" => false, - "version" => 30, + "version" => 31, "checkdiff" => 2, "installquery" => 214, /*################################################################################################## diff --git a/lib/classes.php b/lib/classes.php index c4c5c7e..831ee63 100644 --- a/lib/classes.php +++ b/lib/classes.php @@ -34,7 +34,7 @@ function LoadSection(); function LoadMap(); function LoadList($status="all"); function LoadPriority($id = "0"); - function LoadView($id,$type); + function LoadView($id); function LoadSubType(); function LoadComment($id); function DeleteComment($id); diff --git a/lib/create.php b/lib/create.php index 51fb3e2..ceb5d01 100644 --- a/lib/create.php +++ b/lib/create.php @@ -365,7 +365,7 @@ public function LoadSubType() return $txt; } - public function LoadView($opt,$type) + public function LoadView($opt) { $cfg = new config; $sql = new sql; @@ -373,13 +373,34 @@ public function LoadView($opt,$type) $text = ''; while($row=$sql->fetch($opt)) { - switch($type) + $exp2 = @explode($cfg->get("wd_quest"),$row['link']); + $exp3 = @explode($cfg->get("wd_item"),$row['link']); + $exp4 = @explode($cfg->get("wd_npc"),$row['link']); + $exp5 = @explode($cfg->get("wd_object"),$row['link']); + + if(isset($exp2[1])) + { + if($cfg->get("lang") == 8){$tbl = 'locales_quest';$field = 'Title_loc8';}else{$tbl = 'quest_template';$field = 'Title';} + $tblt = $cfg->get("wd_quest"); + } + else if(isset($exp3[1])) + { + if($cfg->get("lang") == 8){$tbl = 'locales_item';$field = 'name_loc8';}else{$tbl = 'item_template';$field = 'name';} + $tblt = $cfg->get("wd_item"); + } + else if(isset($exp4[1])) { - case 2: $tbl = $cfg->get("lang") == 8 ? 'locales_quest' : 'quest_template';$field = 'Title_loc8';$tblt = $cfg->get("wd_quest");break; - case 3: $tbl = $cfg->get("lang") == 8 ? 'locales_item' : 'item_template';$field = 'name_loc8';$tblt = $cfg->get("wd_item");break; - case 4: $tbl = $cfg->get("lang") == 8 ? 'locales_creature' : 'creature_template';$field = 'name_loc8';$tblt = $cfg->get("wd_npc");break; - case 5: $tbl = $cfg->get("lang") == 8 ? 'locales_gameobject' : 'gameobject_template';$field = 'name_loc8';$tblt = $cfg->get("wd_object");break; + if($cfg->get("lang") == 8){$tbl = 'locales_creature';$field = 'name_loc8';}else{$tbl = 'creature_template';$field = 'name';} + $tblt = $cfg->get("wd_npc"); } + else if(isset($exp5[1])) + { + if($cfg->get("lang") == 8){$tbl = 'locales_gameobject';$field = 'name_loc8';}else{$tbl = 'gameobject_template';$field = 'name';} + $tblt = $cfg->get("wd_object"); + } + else + return; + $id = explode($tblt,$row['link']); $name = $sql->res($cfg->get("mangos"),"SELECT `".$field."` FROM `".$tbl."` WHERE `entry` = '".$id[1]."'"); $text.= ''.$name.'
'; diff --git a/lib/html.php b/lib/html.php index febdef1..c400448 100644 --- a/lib/html.php +++ b/lib/html.php @@ -44,10 +44,6 @@ public function send() Заголовок: - - Название: - -
Отправить
@@ -55,6 +51,14 @@ public function send() + + Тип ссылки: + + + + Поиск: + +
Ссылки:

@@ -171,7 +175,7 @@ public function detail($int) -
Ссылки:
'.$main->LoadView($opt,$all['type']).'
+
Ссылки:
'.$main->LoadView($opt).'
@@ -292,7 +296,7 @@ public function view()
'.$row['id'].'
-
'.$title.'
+
'.$title.'
'.$main->GetNameByGUID(intval($row['sender'])).'
'; diff --git a/lib/main.js b/lib/main.js index ddb6baf..5d692a5 100644 --- a/lib/main.js +++ b/lib/main.js @@ -225,7 +225,7 @@ function searchfor(val) return; } - var tmp = document.getElementById("type"); + var tmp = document.getElementById("typelink"); var type = tmp.options[tmp.selectedIndex].value; $.ajax({ type: "POST", diff --git a/lib/style.css b/lib/style.css index 7fd4c30..6e5d757 100644 --- a/lib/style.css +++ b/lib/style.css @@ -155,12 +155,6 @@ color: #FFF; .pad2 { padding: 5px; } -#namelimit1 { -position: relative; -width: 175px; -height: 19px; -overflow: hidden; -} #searchblock { text-align: left; } \ No newline at end of file diff --git a/saveset.php b/saveset.php index 90cc2f3..d046c1f 100644 --- a/saveset.php +++ b/saveset.php @@ -3,7 +3,9 @@ { require_once("config.php"); require_once("lib/classes.php"); - + $sql = new sql; + $cfg = new config; + if($_POST['del'] == "0") { $listid = $_POST['lis']; @@ -18,19 +20,23 @@ $status = htmlspecialchars(addslashes($status), ENT_QUOTES); $progress = htmlspecialchars(addslashes($progress), ENT_QUOTES); - $query = "UPDATE `bt_message` SET `title` = '".$title."', `status` = '".$status."', `percentage` = '".$progress."', `priority` = '".$priority."' WHERE `id` = '".$listid."'"; + if($sql->exe($cfg->get("realmd"),"UPDATE `bt_message` SET `title` = '".$title."', `status` = '".$status."', `percentage` = '".$progress."', `priority` = '".$priority."' WHERE `id` = '".$listid."'")) + echo 1; + else + echo 'Ошибка! Таблица `bt_message` недоступна или повреждена!'; } else { - $query = "DELETE FROM `bt_message` WHERE `id` = '".$_POST['lis']."'"; + if($sql->exe($cfg->get("realmd"),"DELETE FROM `bt_message` WHERE `id` = '".$_POST['lis']."'")) + $m1 = 1; + if($sql->exe($cfg->get("realmd"),"DELETE FROM `bt_options` WHERE `id` = '".$_POST['lis']."'")) + $m2 = 1; + if($sql->exe($cfg->get("realmd"),"DELETE FROM `bt_comment` WHERE `entry` = '".$_POST['lis']."'")) + $m3 = 1; + if($m1 == 1 && $m2 == 1 && $m3 == 1) + echo 1; + else + echo 'Ошибка! Таблица `bt_message` и/или `bt_options` недоступна или повреждена!'; } - - $sql = new sql; - $cfg = new config; - - if($sql->exe($cfg->get("realmd"),$query)) - echo 1; - else - echo 'Ошибка! Таблица `bt_message` недоступна или повреждена!'; } ?> \ No newline at end of file