From 6fc928400092daf0d39ab035703c956e4d1074b7 Mon Sep 17 00:00:00 2001 From: Ivan Date: Tue, 6 Jul 2010 04:07:40 +0400 Subject: [PATCH] [14] Add function for fast-set status in admin-mode. Users can choose to show the progress bar or not. Signed-off-by: Ivan --- config.php | 6 ++- lib/classes.php | 2 + lib/create.php | 16 ++++-- lib/html.php | 131 ++++++++++++++++++++++++++++-------------------- lib/main.js | 7 +++ send.php | 19 +++---- 6 files changed, 108 insertions(+), 73 deletions(-) diff --git a/config.php b/config.php index d980f02..ddb7cc0 100644 --- a/config.php +++ b/config.php @@ -23,14 +23,16 @@ function get($id) ## mingm: Minimum security level for access in adminpanel. ## pagepath: Folder on a site where there are executing files. ## main: IP-address or domain name of site. + ## progressbar: Display progress bar in list-page (boolean). ## 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. ##################################################################################################*/ "title" => "Баг-трекер", - "mingm" => "3", + "mingm" => 3, "pagepath" => "pages/", "main" => "http://localhost", + "progressbar" => true, "anim" => false, "LinkAccount" => "http://localhost/admin/account.php?id=", "LinkPlayer" => "http://localhost/admin/player.php?guid=", @@ -42,7 +44,7 @@ function get($id) ## defaultdate: Current php time-zone of server. ##################################################################################################*/ "CheckVersion" => false, - "version" => "13", + "version" => 13, "checkdiff" => 2, "defaultdate" => date_default_timezone_set('Europe/Moscow')); diff --git a/lib/classes.php b/lib/classes.php index c28288c..0a4a66c 100644 --- a/lib/classes.php +++ b/lib/classes.php @@ -19,6 +19,8 @@ public function GetPercent($id,$one=false); public function GetPriority($id,$one=false); public function GetStatus($id,$one=false); + public function SetStatus($statusid=-1,$id=-1); + public function LoadZones(); public function LoadChar($acc); public function LoadStatus($id="0"); diff --git a/lib/create.php b/lib/create.php index 7764eab..219958a 100644 --- a/lib/create.php +++ b/lib/create.php @@ -87,6 +87,14 @@ public function GetStatus($all,$one=false) return $sql->res($cfg->get("realmd"),"SELECT `name` FROM `bt_status` WHERE `id` = '".$status."' LIMIT 1"); } + public function SetStatus($statusid=-1,$id=-1) + { + $cfg = new config; + $sql = new sql; + if($statusid != -1 && $id != -1) + return $sql->exe($cfg->get("realmd"),"UPDATE `bt_message` SET `status` = '".$statusid."' WHERE `id` = '".$id."' LIMIT 1"); + } + public function LoadZones() { $cfg = new config; @@ -138,9 +146,11 @@ public function LoadStatus($id="0",$all="0") $text = ""; while($row=$sql->fetch($query)) { - if($id > "0") - if($row['id'] == $this->GetStatus($all,true)) - $attr = "SELECTED";else $attr = ""; + if($id > 0) + if($row['id'] == $this->GetStatus($all,true)) + $attr = "SELECTED"; + else + $attr = ""; $text.= ''; } return $text; diff --git a/lib/html.php b/lib/html.php index 8920535..196b987 100644 --- a/lib/html.php +++ b/lib/html.php @@ -170,65 +170,82 @@ public function detail($int) $this->block($this->viewdate($all)); $this->block($this->progress($all)); echo ''; - echo ' - - - - - -
Сейчас так:
-
А должно быть так:
-
Пояснение:
- -
- - - - - - - - - - - - - - - - - - - - - - - - - -
Персонаж: - -
-
'; - $main->LoadView($opt);echo ' -
'; + echo ' + + + + + +
Сейчас так:
+
А должно быть так:
+
Пояснение:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Персонаж: + +
+
'; + $main->LoadView($opt);echo ' +
'; + + if($user['gmlevel'] >= $cfg->get("mingm")) + { + $text = ' +
+ Быстрый ответ: +
'; + $this->block($text); + } } public function view() { + global $user; $cfg = new config; $main = new main; if(empty($_GET['detail'])) { + if($user['gmlevel'] >= $cfg->get("mingm") && + isset($_GET['faststatus']) && + isset($_GET['changeid']) && + intval($_GET['faststatus']) > 0 && + intval($_GET['changeid']) > 0) + $main->SetStatus($_GET['faststatus'],$_GET['changeid']); + if(isset($_GET['type'])) $type = intval($_GET['type']); else @@ -260,7 +277,8 @@ public function view() '; for($i=1;$i'.$mass[$i][1].''; + if(($i == 3 && $cfg->get("progressbar")) || $i != 3) + echo ''; echo ' '; @@ -297,8 +315,11 @@ public function view() echo ' - - + '; + if($cfg->get("progressbar")) + echo ' + '; + echo ' diff --git a/lib/main.js b/lib/main.js index 44a3a7b..af7a7e7 100644 --- a/lib/main.js +++ b/lib/main.js @@ -3,6 +3,13 @@ var detail_view = false; var m_viewdiv = 0; var m_nowview = -1; +function fastchangestatus(id) +{ + var list = document.getElementById("fastchange0"); + var selected = list.options[list.selectedIndex].value; + window.location.href = "index.php?a=list&changeid="+id+"&faststatus="+selected+"&sort=1&sortto=desc&last=1"; +} + function showhide0() { if(document.getElementById("hide0").style.display == "none") diff --git a/send.php b/send.php index b165436..6e6981c 100644 --- a/send.php +++ b/send.php @@ -14,21 +14,14 @@ $main = new main; $cfg = new config; - $op = $_POST['sql']; - $a1 = $_POST['a1']; - $a2 = $_POST['a2']; - $a3 = $_POST['a3']; - $a4 = $_POST['a4']; - $a5 = $_POST['a5']; - - $area1 = htmlspecialchars(addslashes($a1), ENT_QUOTES); - $area2 = htmlspecialchars(addslashes($a2), ENT_QUOTES); - $area3 = htmlspecialchars(addslashes($a3), ENT_QUOTES); - $area4 = htmlspecialchars(addslashes($a4), ENT_QUOTES); - $area5 = htmlspecialchars(addslashes($a5), ENT_QUOTES); + $area1 = htmlspecialchars($_POST['a1'], ENT_QUOTES); + $area2 = htmlspecialchars($_POST['a2'], ENT_QUOTES); + $area3 = htmlspecialchars($_POST['a3'], ENT_QUOTES); + $area4 = htmlspecialchars($_POST['a4'], ENT_QUOTES); + $area5 = htmlspecialchars($_POST['a5'], ENT_QUOTES); $id = $main->GetNewId(); - $opt = explode("*",$op); + $opt = explode("*",$_POST['sql']); $i=0; $t1 = true; $t2 = true;
'.$mass[$i][1].'Заголовок
'.$row['id'].''.$main->GetNameByGUID(intval($row['sender'])).''.$img.''.$main->GetNameByGUID(intval($row['sender'])).''.$img.''.$main->GetStatus($all).' '.$main->GetPriority($all).'
'.$title.'