diff --git a/addtype.php b/addtype.php new file mode 100644 index 0000000..fcd240f --- /dev/null +++ b/addtype.php @@ -0,0 +1,123 @@ +GetPreviousElement($type,$change); + switch($type) + { + case 1: + $upd = "UPDATE `bt_message` SET `priority` = '".$id."' WHERE `priority` = '".$change."'"; + break; + case 2: + $upd = "UPDATE `bt_options` SET `type` = '".$id."' WHERE `type` = '".$change."'"; + break; + case 3: + $upd = "UPDATE `bt_options` SET `subtype` = '".$id."' WHERE `subtype` = '".$change."'"; + break; + case 4: + $upd = "UPDATE `bt_message` SET `status` = '".$id."' WHERE `status` = '".$change."'"; + break; + default: + $upd = false; + } + if($upd) + { + if(!$sql->exe($cfg->get("realmd"),$upd)) + echo 'Ошибка переноса! MySQL код некорректен!'; + } + else + echo 'Ошибка! Тип '.$type.' не опознан!'; + } + if($sql->exe($cfg->get("realmd"),$query)) + echo 1; + else + echo 'Ошибка! MySQL код некорректен!'; + } + else + echo 'Ошибка! Тип '.$type.' не опознан!'; +} +else + echo 'Параметры не переданы!'; +?> \ No newline at end of file diff --git a/config.php b/config.php index 7aca4d0..665ea76 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" => 23, + "version" => 24, "checkdiff" => 2, "installquery" => 212 ); diff --git a/img/Thumbs.db b/img/Thumbs.db new file mode 100644 index 0000000..ba9fbb6 Binary files /dev/null and b/img/Thumbs.db differ diff --git a/img/cancel.png b/img/cancel.png new file mode 100644 index 0000000..03e3433 Binary files /dev/null and b/img/cancel.png differ diff --git a/img/check_mark.png b/img/check_mark.png new file mode 100644 index 0000000..f109a56 Binary files /dev/null and b/img/check_mark.png differ diff --git a/img/noadd.png b/img/noadd.png new file mode 100644 index 0000000..3a428c6 Binary files /dev/null and b/img/noadd.png differ diff --git a/img/nocancel.png b/img/nocancel.png new file mode 100644 index 0000000..d6edecb Binary files /dev/null and b/img/nocancel.png differ diff --git a/img/nocheck_mark.png b/img/nocheck_mark.png new file mode 100644 index 0000000..386caa0 Binary files /dev/null and b/img/nocheck_mark.png differ diff --git a/img/nolens.png b/img/nolens.png new file mode 100644 index 0000000..a5fd215 Binary files /dev/null and b/img/nolens.png differ diff --git a/img/noscissors.png b/img/noscissors.png new file mode 100644 index 0000000..513bf21 Binary files /dev/null and b/img/noscissors.png differ diff --git a/img/notrash.png b/img/notrash.png new file mode 100644 index 0000000..635f4c5 Binary files /dev/null and b/img/notrash.png differ diff --git a/img/onadd.png b/img/onadd.png new file mode 100644 index 0000000..17c79a7 Binary files /dev/null and b/img/onadd.png differ diff --git a/img/oncancel.png b/img/oncancel.png new file mode 100644 index 0000000..ec4e9a2 Binary files /dev/null and b/img/oncancel.png differ diff --git a/img/oncheck_mark.png b/img/oncheck_mark.png new file mode 100644 index 0000000..7f31cbe Binary files /dev/null and b/img/oncheck_mark.png differ diff --git a/img/onlens.png b/img/onlens.png new file mode 100644 index 0000000..8bd80fc Binary files /dev/null and b/img/onlens.png differ diff --git a/img/onscissors.png b/img/onscissors.png new file mode 100644 index 0000000..3b27a7e Binary files /dev/null and b/img/onscissors.png differ diff --git a/img/ontrash.png b/img/ontrash.png new file mode 100644 index 0000000..5592a00 Binary files /dev/null and b/img/ontrash.png differ diff --git a/img/scissors.png b/img/scissors.png new file mode 100644 index 0000000..c280cdb Binary files /dev/null and b/img/scissors.png differ diff --git a/lib/classes.php b/lib/classes.php index a8c5342..72c7758 100644 --- a/lib/classes.php +++ b/lib/classes.php @@ -9,34 +9,34 @@ function num_rows($query); interface create { - public function SelectMessage($id); - public function SelectOptions($id); - public function GetNewId(); - public function GetNameByGUID($guid); - public function GetAccountNameById($id); - public function GetSections(); - public function GetPercent($id,$one=false); - public function GetPriority($id,$one=false); - public function GetStatus($id,$one=false); - public function GetDate($format); + function SelectMessage($id); + function SelectOptions($id); + function GetNewId(); + function GetNameByGUID($guid); + function GetAccountNameById($id); + function GetSections(); + function GetPercent($id,$one=false); + function GetPriority($id,$one=false); + function GetStatus($id,$one=false); + function GetDate($format); + function GetPreviousElement($type,$change); + function SetStatus($statusid=-1,$id=-1); - public function SetStatus($statusid=-1,$id=-1); + function LoadZones(); + function LoadChar($acc); + function LoadStatus($id="0"); + function LoadSection(); + function LoadMap(); + function LoadList($status="all"); + function LoadPriority($id = "0"); + function LoadView($id); + function LoadSubType(); - public function LoadZones(); - public function LoadChar($acc); - public function LoadStatus($id="0"); - public function LoadSection(); - public function LoadMap(); - public function LoadList($status="all"); - public function LoadPriority($id = "0"); - public function LoadView($id); - public function LoadSubType(); - - public function login($login,$pass); - public function cookies($login,$pass); - public function AccountRepass($acc,$code); - public function isValidSection($id); - public function PercentList($id=0); + function login($login,$pass); + function cookies($login,$pass); + function AccountRepass($acc,$code); + function isValidSection($id); + function PercentList($id=0); } interface html @@ -57,6 +57,7 @@ function login(); function success(); function inc($content); function admin(); + function adminconfig(); function CheckVersion(); function adminpanel(); function authorization($login,$pass); diff --git a/lib/create.php b/lib/create.php index 358f10d..f5fde3e 100644 --- a/lib/create.php +++ b/lib/create.php @@ -95,7 +95,29 @@ public function GetDate($format) return date($format); } } - + + public function GetPreviousElement($type,$change) + { + $cfg = new config; + $sql = new sql; + switch($type) + { + case 1: $table='bt_priority';break; + case 2: $table='bt_section';break; + case 3: $table='bt_subtype';break; + case 4: $table='bt_status';break; + default: return; + } + $id = $sql->res($cfg->get("realmd"),"SELECT `id` FROM `".$table."` WHERE `id` < '".$change."' ORDER BY `id` DESC LIMIT 1"); + if($id != -1) + return $id; + else + $id = $sql->res($cfg->get("realmd"),"SELECT `id` FROM `".$table."` WHERE `id` > '".$change."' ORDER BY `id` ASC LIMIT 1"); + if($id != -1) + return $id; + return false; + } + public function SetStatus($statusid=-1,$id=-1) { $cfg = new config; @@ -155,11 +177,10 @@ public function LoadStatus($id="0",$all="0") $text = ""; while($row=$sql->fetch($query)) { - if($id > 0) + $attr = ""; + if($id > "0") if($row['id'] == $this->GetStatus($all,true)) $attr = "SELECTED"; - else - $attr = ""; $text.= ''; } return $text; @@ -170,10 +191,12 @@ public function LoadSection() $cfg = new config; $sql = new sql; $query = $sql->exe($cfg->get("realmd"),"SELECT `id`,`name` FROM `bt_section` ORDER BY `id` ASC"); + $text = ''; while($row=mysql_fetch_array($query)) { - echo ''; + $text.= ''; } + return $text; } public function LoadMap() @@ -239,30 +262,35 @@ public function LoadList($status="all",$sort='') return $sql->exe($cfg->get("realmd"),$query); } - public function LoadPriority($id="0",$all="0") + public function LoadPriority($id="0",$all="0",$color="0") { $cfg = new config; $sql = new sql; - $query = $sql->exe($cfg->get("realmd"),"SELECT `id`,`name` FROM `bt_priority` ORDER BY `id` ASC"); + $query = $sql->exe($cfg->get("realmd"),"SELECT `id`,`name`,`color` FROM `bt_priority` ORDER BY `id` ASC"); $txt=""; - while($row=mysql_fetch_array($query)) + + if($color == "color") + $clr = ''; + echo $clr; + } + return $txt; } public function LoadSubType() @@ -275,7 +303,7 @@ public function LoadSubType() { $txt.= ''; } - echo $txt; + return $txt; } public function LoadView($opt) diff --git a/lib/html.php b/lib/html.php index 48ff8f5..772eaf4 100644 --- a/lib/html.php +++ b/lib/html.php @@ -7,6 +7,8 @@ public function send() $cfg = new config; $main = new main; $main->LoadZones(); + $sections = $main->LoadSection(); + $subtype = $main->LoadSubType(); if($user['id'] > "-1") { echo ' @@ -37,13 +39,13 @@ public function send() Тип: - + Подтип: - + @@ -383,38 +385,46 @@ public function edit($id,$text) if($cfg->get("LinkPlayer"))$charname = ''.$charname.''; $text = ' - +
- + + - + + - + + - + + - + + + - + + - + +
Заголовок:
Приоритет:Приоритет:
Статус:Статус:
Прогресс:Прогресс:
Удалить?Удалить?
Сохранить

Аккаунт:Аккаунт: '.$username.'
Персонаж:Персонаж: '.$charname.'
'; @@ -502,7 +512,7 @@ public function admin() else $id = "0"; echo '
'; - echo 'Новых: '.$main->GetSections("new").' | Панель управления'; + echo 'Новых: '.$main->GetSections("new").' | Управление БД | Поиск и сортировка'; if(isset($_GET['a']) && $_GET['a'] == "list" && $main->GetSections("all") > "0") echo ' | Изменить'; @@ -580,6 +590,82 @@ public function adminpanel() $text = addslashes($_GET['edit']); $this->edit($id,$text); } + else + { + $this->adminconfig(); + } + } + public function adminconfig() + { + global $user; + $cfg = new config; + $main = new main; + $text = ' + + + + + + + + + + + + + + + + + + + + + +
Приоритет: +
+ +
+ +
Тип: +
+ +
+ +
Подтип: +
+ +
+ +
Статус: +
+ +
+ +
'; + + $this->block($text); } public function authorization($login,$pass) { diff --git a/lib/main.js b/lib/main.js index 5ae9af0..23feaef 100644 --- a/lib/main.js +++ b/lib/main.js @@ -3,6 +3,128 @@ var detail_view = false; var m_viewdiv = 0; var m_nowview = -1; +function GetSelectName(id) +{ + switch(id) + { + case 1: return "priority"; + case 2: return "type"; + case 3: return "subtype"; + case 4: return "status"; + default: return; + } +} + +function ViewImgOptions(id) +{ + for(var i=1;i<5;i++) + { + document.getElementById("img_"+i).style.display = "none"; + if(i != id) + document.getElementById("tr"+i).style.display = "none"; + } + + var parent = document.getElementById(GetSelectName(id)); + var curval = parent.options[parent.selectedIndex].value; + var curtext = parent.options[parent.selectedIndex].text; + var current = document.getElementById("img_"+id); + var select = document.getElementById("select_"+id); + var enter = document.getElementById("enter_"+id); + + if(curval == "-1") + { + select.style.display = "none"; + document.getElementById("input_11").value = "Цвет"; + enter.style.display = "block"; + current.innerHTML = ''; + current.innerHTML += ''; + current.style.display = "block"; + } + else if(curval > "0") + { + current.innerHTML = ''; + current.innerHTML += ''; + current.innerHTML += ''; + current.style.display = "block"; + } +} + +function GetColorPriorityById(position) +{ + var color = document.getElementById("PriorityColor").innerHTML.split('^'); + return color[position]; +} + +function ViewInput(id) +{ + var parent = document.getElementById(GetSelectName(id)); + var curtext = parent.options[parent.selectedIndex].text; + var curid = parent.options[parent.selectedIndex].value; + document.getElementById("input_"+id).value = curtext; + var curimg = document.getElementById("img_"+id); + curimg.innerHTML = ''; + curimg.innerHTML += ''; + curimg.innerHTML += ''; + if(id == 1) + { + var position = parent.selectedIndex - 2; + document.getElementById("input_11").value = GetColorPriorityById(position); + } + document.getElementById("select_"+id).style.display = "none"; + document.getElementById("enter_"+id).style.display = "block"; +} + +function SaveInput(id,change,del) +{ + var input1 = document.getElementById("input_"+id).value; + var input2 = "-1"; + var href = "type="+id+"&input1="+input1; + if(id == 1) + { + input2 = document.getElementById("input_11").value; + href = "type="+id+"&input1="+input1+"&input2="+input2; + } + if(change != -1) + href += "&change="+change; + + if(del) + href += "&delete=1"; + + if((input1 != "" && input1 != "Название" && input2 != "" && input2 != "Цвет") || del) + { + $.ajax({ + type: "POST", + data: href, + url: "addtype.php", + cache: false, + success: function(html) + { + if(html == 1) + window.location.href = "index.php?a=admin"; + else + alert(html); + } + }); + } + else + alert("Необходимо заполнить все поля!"); +} + +function ViewCancel(id) +{ + document.getElementById("enter_"+id).style.display = "none"; + document.getElementById("select_"+id).style.display = "block"; + document.getElementById("img_"+id).style.display = "none"; + document.getElementById("input_"+id).value = "Название"; + if(id == 1) + document.getElementById("input_11").value = "Цвет"; + for(var i=1;i<5;i++) + { + document.getElementById(GetSelectName(id)).selectedIndex = 1; + document.getElementById("tr"+i).style.display = ""; + } +} + function searchresult(id) { var tmp = document.getElementById("type"); diff --git a/lib/style.css b/lib/style.css index a802350..d8eaa07 100644 --- a/lib/style.css +++ b/lib/style.css @@ -21,6 +21,10 @@ text-decoration: underline; img { border: 0; } +span { +padding: 0; +margin: 0; +} form { padding: 0; margin: 0; diff --git a/search.php b/search.php index 6c5dec0..1b14f0e 100644 --- a/search.php +++ b/search.php @@ -51,7 +51,7 @@ $entry = $row[1]; $text.= ' -
+
'; $i++; diff --git a/sql/updates/realmd_revision_24.sql b/sql/updates/realmd_revision_24.sql new file mode 100644 index 0000000..00f1430 --- /dev/null +++ b/sql/updates/realmd_revision_24.sql @@ -0,0 +1,2 @@ +ALTER TABLE `bt_status` MODIFY COLUMN `id` int(3) NOT NULL AUTO_INCREMENT FIRST; +ALTER TABLE `bt_subtype` MODIFY COLUMN `id` int(11) NOT NULL AUTO_INCREMENT FIRST; \ No newline at end of file