Skip to content

Commit

Permalink
[14] Add function for fast-set status in admin-mode.
Browse files Browse the repository at this point in the history
Users can choose to show the progress bar or not.

Signed-off-by: Ivan <Dfyztimy@list.ru>
  • Loading branch information
Hantet committed Jul 6, 2010
1 parent 6d11d9e commit 6fc9284
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 73 deletions.
6 changes: 4 additions & 2 deletions config.php
Expand Up @@ -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=",
Expand All @@ -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'));

Expand Down
2 changes: 2 additions & 0 deletions lib/classes.php
Expand Up @@ -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");
Expand Down
16 changes: 13 additions & 3 deletions lib/create.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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.= '<option '.$attr.' value="'.$row['id'].'">'.$row['name'].'</option>';
}
return $text;
Expand Down
131 changes: 76 additions & 55 deletions lib/html.php
Expand Up @@ -170,65 +170,82 @@ public function detail($int)
$this->block($this->viewdate($all));
$this->block($this->progress($all));
echo '<script>detail_view=true;</script>';
echo '
<table border="1" id="t1" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="400px" class="block"><div class="pad">Сейчас так:</div>
<textarea class="textarea" id="area1" style="height:80px;" READONLY>'.$all['text_1'].'</textarea><div class="pad">А должно быть так:</div>
<textarea class="textarea" id="area2" style="height:80px;" READONLY>'.$all['text_2'].'</textarea><div class="pad">Пояснение:</div>
<textarea class="textarea" id="area3" READONLY>'.$all['text_2'].'</textarea>
</td>
<td class="block">
<table class="t2" id="t2" border="0" cellpadding="0" cellspacing="0" align="center">
<tr style="display:none;">
<td class="block2">Персонаж: </td>
<td align="right">
<select id="player"></select>
</td>
</tr>
<tr id="var1" style="display:none;">
<td class="block2">Тип: </td>
<td align="right">
<select class="input" onchange="next(1)" id="type"><option DISABLED SELECTED>--</option>';$main->LoadSection();echo '</select>
</td>
</tr>
<tr id="var2" style="display:none;">
<td class="block2">Местность: </td>
<td align="right">
<select class="input" onchange="ChangeZones(this.options[this.selectedIndex].value);next(2)" id="map"><option DISABLED SELECTED>--</option>';$main->LoadMap();echo '</select>
</td>
</tr>
<tr id="var3" style="display:none;">
<td class="block2">Зона: </td>
<td align="right">
<select class="input" onchange="next(3)" id="zone"></select>
</td>
</tr>
<tr id="var4" style="display:none;">
<td class="block2">Название: </td>
<td align="right">
<input id="name" onFocus="this.style.backgroundColor=\'#CCC\'" onBlur="this.style.backgroundColor=\'#FFF\'" class="input" type="text">
</td>
</tr>
<tr id="var5" style="display:none;">
<td class="block2">Wowhead ссылка: </td>
<td align="right">
<input id="db" onFocus="this.style.backgroundColor=\'#CCC\'" onBlur="this.style.backgroundColor=\'#FFF\'" class="input" type="text">
</td>
</tr>
</table>
<div align="right"><div id="var6" class="butt" style="display:none;" onClick="tolink()"><span id="retype">Добавить</span></div></div>';
$main->LoadView($opt);echo '
</td>
</tr>
</table>';
echo '
<table border="1" id="t1" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="400px" class="block"><div class="pad">Сейчас так:</div>
<textarea class="textarea" id="area1" style="height:80px;" READONLY>'.$all['text_1'].'</textarea><div class="pad">А должно быть так:</div>
<textarea class="textarea" id="area2" style="height:80px;" READONLY>'.$all['text_2'].'</textarea><div class="pad">Пояснение:</div>
<textarea class="textarea" id="area3" READONLY>'.$all['text_2'].'</textarea>
</td>
<td class="block">
<table class="t2" id="t2" border="0" cellpadding="0" cellspacing="0" align="center">
<tr style="display:none;">
<td class="block2">Персонаж: </td>
<td align="right">
<select id="player"></select>
</td>
</tr>
<tr id="var1" style="display:none;">
<td class="block2">Тип: </td>
<td align="right">
<select class="input" onchange="next(1)" id="type"><option DISABLED SELECTED>--</option>';$main->LoadSection();echo '</select>
</td>
</tr>
<tr id="var2" style="display:none;">
<td class="block2">Местность: </td>
<td align="right">
<select class="input" onchange="ChangeZones(this.options[this.selectedIndex].value);next(2)" id="map"><option DISABLED SELECTED>--</option>';$main->LoadMap();echo '</select>
</td>
</tr>
<tr id="var3" style="display:none;">
<td class="block2">Зона: </td>
<td align="right">
<select class="input" onchange="next(3)" id="zone"></select>
</td>
</tr>
<tr id="var4" style="display:none;">
<td class="block2">Название: </td>
<td align="right">
<input id="name" onFocus="this.style.backgroundColor=\'#CCC\'" onBlur="this.style.backgroundColor=\'#FFF\'" class="input" type="text">
</td>
</tr>
<tr id="var5" style="display:none;">
<td class="block2">Wowhead ссылка: </td>
<td align="right">
<input id="db" onFocus="this.style.backgroundColor=\'#CCC\'" onBlur="this.style.backgroundColor=\'#FFF\'" class="input" type="text">
</td>
</tr>
</table>
<div align="right"><div id="var6" class="butt" style="display:none;" onClick="tolink()"><span id="retype">Добавить</span></div></div>';
$main->LoadView($opt);echo '
</td>
</tr>
</table>';

if($user['gmlevel'] >= $cfg->get("mingm"))
{
$text = '
<div align="right">
Быстрый ответ: <select id="fastchange0" onchange="fastchangestatus('.$all['id'].')">'.$main->LoadStatus(1,$all).'</select>
</div>';
$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
Expand Down Expand Up @@ -260,7 +277,8 @@ public function view()
<table border="1" id="t1" cellpadding="0" cellspacing="0" align="center">
<tr>';
for($i=1;$i<count($mass)+1;$i++)
echo '<td class="view" style="width:'.$mass[$i][0].';" onClick="window.location.href=\''.$href.'&sort='.$i.'&sortto='.$sortto.'&last='.$sort.'\';" onMouseover="this.style.cursor=\'pointer\';this.style.backgroundColor=\'#777\';" onMouseout="this.style.cursor=\'default\';this.style.backgroundColor=\'#666\';"><b>'.$mass[$i][1].'</b></td>';
if(($i == 3 && $cfg->get("progressbar")) || $i != 3)
echo '<td class="view" style="width:'.$mass[$i][0].';" onClick="window.location.href=\''.$href.'&sort='.$i.'&sortto='.$sortto.'&last='.$sort.'\';" onMouseover="this.style.cursor=\'pointer\';this.style.backgroundColor=\'#777\';" onMouseout="this.style.cursor=\'default\';this.style.backgroundColor=\'#666\';"><b>'.$mass[$i][1].'</b></td>';
echo '
<td class="view"><b>Заголовок</b></td>
</tr>';
Expand Down Expand Up @@ -297,8 +315,11 @@ public function view()
echo '
<tr onClick="if(tr_select)window.location.href=\'index.php?a=admin&edit='.$row['id'].'\';else window.location.href=\'index.php?a=list&detail='.$row['id'].'\';" onMouseover="this.style.cursor=\'pointer\';this.style.backgroundColor=\'#888\';" onMouseout="this.style.cursor=\'default\';this.style.backgroundColor=\'#666\';">
<td class="view">'.$row['id'].'</td>
<td class="view">'.$main->GetNameByGUID(intval($row['sender'])).'</td>
<td class="view" style="padding:0;margin:0;">'.$img.'</td>
<td class="view">'.$main->GetNameByGUID(intval($row['sender'])).'</td>';
if($cfg->get("progressbar"))
echo '
<td class="view" style="padding:0;margin:0;">'.$img.'</td>';
echo '
<td class="view">'.$main->GetStatus($all).'</td>
<td class="view">'.$main->GetPriority($all).'</td>
<td class="view"><div id="namelimit1" title="'.$title.'"><div style="position:absolute;">'.$title.'</div></div></td>
Expand Down
7 changes: 7 additions & 0 deletions lib/main.js
Expand Up @@ -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")
Expand Down
19 changes: 6 additions & 13 deletions send.php
Expand Up @@ -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;
Expand Down

0 comments on commit 6fc9284

Please sign in to comment.