Commit aefe3d4f authored by Dmitriy's avatar Dmitriy Committed by Vitaly Lipatov

[Задача 13943] Добавлено поле для указания пути POST-запроса исправления опечатки

parent 0c50efed
...@@ -78,6 +78,8 @@ class Sites extends CI_Controller { ...@@ -78,6 +78,8 @@ class Sites extends CI_Controller {
if ($oper == 'add') { // Добавление пользователя if ($oper == 'add') { // Добавление пользователя
$data['site'] = $this->input->post('site'); $data['site'] = $this->input->post('site');
$path = $this->input->post('path');
$data['path'] = $path ? $path : null;
if ($data['site'] == '') { if ($data['site'] == '') {
echo json_encode(array('message' => 'Название сайта некорректно')); echo json_encode(array('message' => 'Название сайта некорректно'));
} else { } else {
...@@ -90,6 +92,8 @@ class Sites extends CI_Controller { ...@@ -90,6 +92,8 @@ class Sites extends CI_Controller {
} else if ($oper == 'edit') { // Редактирование пользователя } else if ($oper == 'edit') { // Редактирование пользователя
$data['id_site'] = $this->input->post('id'); $data['id_site'] = $this->input->post('id');
$data['site'] = $this->input->post('site'); $data['site'] = $this->input->post('site');
$path = $this->input->post('path');
$data['path'] = $path ? $path : null;
if ($data['site'] == '') { if ($data['site'] == '') {
echo json_encode(array('message' => 'Название сайта некорректно')); echo json_encode(array('message' => 'Название сайта некорректно'));
} else { } else {
......
...@@ -366,9 +366,10 @@ private function get_site_id($DBH, $url) { ...@@ -366,9 +366,10 @@ private function get_site_id($DBH, $url) {
$this->db->from("sites as s"); $this->db->from("sites as s");
$this->db->where("s.id", $id_site); $this->db->where("s.id", $id_site);
$site = $this->db->get()->row(); $site = $this->db->get()->row();
$path = empty($site->path) ? $correctPath : $site->path;
//error_log("result: " . $site->site . "/" . $correctPath); //error_log("result: " . $site->site . "/" . $correctPath);
log_message("error", "result: " . $site->site . "/" . $correctPath); log_message("error", "result: " . $site->site . "/" . $path);
return $site->site . "/" . $correctPath; return $site->site . "/" . $path;
// Адрес на который шлем запрос исправления // Адрес на который шлем запрос исправления
//return $parsed_url["scheme"] . "://" . $parsed_url["host"] . "/" . $correctPath; //return $parsed_url["scheme"] . "://" . $parsed_url["host"] . "/" . $correctPath;
} }
......
...@@ -96,6 +96,7 @@ class Site extends CI_Model { ...@@ -96,6 +96,7 @@ class Site extends CI_Model {
$data['rows'][$id]['id'] = $row->id; $data['rows'][$id]['id'] = $row->id;
$data['rows'][$id]['cell'][] = $row->id; $data['rows'][$id]['cell'][] = $row->id;
$data['rows'][$id]['cell'][] = $row->site; $data['rows'][$id]['cell'][] = $row->site;
$data['rows'][$id]['cell'][] = $row->path;
$data['rows'][$id]['cell'][] = $row->date; $data['rows'][$id]['cell'][] = $row->date;
} }
} else if ( $table == 'users' ) { } else if ( $table == 'users' ) {
...@@ -125,6 +126,7 @@ class Site extends CI_Model { ...@@ -125,6 +126,7 @@ class Site extends CI_Model {
$data = array( $data = array(
'site' => $site['site'], 'site' => $site['site'],
'path' => $site['path'],
'date' => date("Y-m-d H:i:s", time()) 'date' => date("Y-m-d H:i:s", time())
); );
...@@ -138,6 +140,7 @@ class Site extends CI_Model { ...@@ -138,6 +140,7 @@ class Site extends CI_Model {
} }
$this->db->set("site", $data['site']); $this->db->set("site", $data['site']);
$this->db->set("path", $data['path']);
$this->db->where("id", $data['id_site']); $this->db->where("id", $data['id_site']);
$this->db->update("sites"); $this->db->update("sites");
} }
......
...@@ -16,10 +16,11 @@ jQuery("#table_sites").jqGrid({ // Привязка плагина к табли ...@@ -16,10 +16,11 @@ jQuery("#table_sites").jqGrid({ // Привязка плагина к табли
url: '<?=$base_url?>admins/sites/get_list_sites', // Скрипт - обработчик ваших запросов url: '<?=$base_url?>admins/sites/get_list_sites', // Скрипт - обработчик ваших запросов
editurl: '<?=$base_url?>admins/sites/panel_sites', editurl: '<?=$base_url?>admins/sites/panel_sites',
datatype: "json", // Формат скрипта-обработчика datatype: "json", // Формат скрипта-обработчика
colNames:['Номер', 'Сайт', 'Дата регистрации'], colNames:['Номер', 'Сайт', 'Путь' , 'Дата регистрации'],
colModel:[ colModel:[
{name:"id", index:'s.id', width:10, searchtype:"integer", align:'center'}, {name:"id", index:'s.id', width:10, searchtype:"integer", align:'center'},
{name:"site", index:'s.site', align:'center', width:20, searchtype:"string", editable:true, addtable:true, editrules:{required:true}}, {name:"site", index:'s.site', align:'center', width:20, searchtype:"string", editable:true, addtable:true, editrules:{required:true}},
{name:"path", index:'s.path', align:'center', width:20, searchtype:"string", editable:true, addtable:true},
{name:"date", index:'s.date', align:'center', width:20, searchtype:"string"}, {name:"date", index:'s.date', align:'center', width:20, searchtype:"string"},
], ],
......
/*Добавление столбца для храния произвольного пути для сайта*/
ALTER TABLE `sites` ADD `path`VARCHAR(255) NULL DEFAULT NULL AFTER `site`;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment