From ff7042aba4ba6a98b98b7a4435417d63374f2d69 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Fri, 15 Jul 2011 15:23:51 +0000 Subject: added view file for permanently deleted devices --- .../Application/Controllers/GenericController.php | 26 ++++++++++++++++++++ .../Application/Controllers/HistoryController.php | 2 +- h-source/Application/Include/languages.php | 1 + h-source/Application/Models/HardwareModel.php | 19 +++++++++++++-- h-source/Application/Views/cleared.php | 28 ++++++++++++++++++++++ h-source/Application/Views/dialog.php | 10 ++++---- h-source/Config/Route.php | 1 + 7 files changed, 79 insertions(+), 8 deletions(-) create mode 100644 h-source/Application/Views/cleared.php diff --git a/h-source/Application/Controllers/GenericController.php b/h-source/Application/Controllers/GenericController.php index 2e7a45b..ed36952 100644 --- a/h-source/Application/Controllers/GenericController.php +++ b/h-source/Application/Controllers/GenericController.php @@ -236,6 +236,8 @@ class GenericController extends BaseController if (!$this->s['registered']->checkCsrf($clean['token'])) $this->redirect($this->controller.'/catalogue/'.$this->lang,2,'wrong token..'); if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..'); + + if ($this->m['HardwareModel']->isCleared($clean['id_hard'])) $this->redirect('generic/cleared/'.$this->lang,0); $deleted = $this->m['HardwareModel']->select("hardware.deleted")->where(array("id_hard"=>$clean['id_hard']))->limit(1)->toList('deleted')->send(); @@ -472,6 +474,17 @@ class GenericController extends BaseController $this->append($data); } + public function cleared($lang = 'en') + { + $data['title'] = 'page permanently deleted - '.Website::$generalName; + + $data['tree'] = "device page permanently deleted"; + + $this->append($data); + + $this->loadViewAll('cleared'); + } + protected function view($lang = 'en', $id_hard = 0, $name = null) { $this->shift(3); @@ -488,6 +501,8 @@ class GenericController extends BaseController $data['isDeleted'] = false; $data['md_javascript'] = "moderator_dialog(\"devicehide\",\"device\");moderator_dialog(\"deviceshow\",\"device\");moderator_dialog(\"deviceapprove\",\"device_app\");moderator_dialog(\"deviceclear\",\"device_cl\");"; + + if ($this->m['HardwareModel']->isCleared($clean['id_hard'])) $this->redirect('generic/cleared/'.$this->lang,0); if ($this->mod->checkType($clean['id_hard'])) { @@ -542,6 +557,8 @@ class GenericController extends BaseController $data['title'] = 'history - '.Website::$generalName; $data['isDeleted'] = $this->m['HardwareModel']->isDeleted($clean['id']); + + if ($this->m['HardwareModel']->isCleared($clean['id'])) $this->redirect('generic/cleared/'.$this->lang,0); //get the first revision $res = $this->m['RevisionsModel']->db->select('revisions','id_rev','id_hard='.$clean['id'],null,'id_rev',1); @@ -595,6 +612,9 @@ class GenericController extends BaseController if (count($data['table']) > 0) { $data['id_hard'] = (int)$data['table'][0]['revisions']['id_hard']; + + if ($this->m['HardwareModel']->isCleared($data['id_hard'])) $this->redirect('generic/cleared/'.$this->lang,0); + $data['ne_name'] = $this->m['HardwareModel']->getTheModelName($data['id_hard']); $data['name'] = encodeUrl($data['ne_name']); $data['tree'] = $this->getSpecHardLink() . " » " . $this->getViewLink($data['id_hard'],$data['ne_name'])." » " . $this->getHistoryLink($data['id_hard']) . " » revision"; @@ -627,6 +647,8 @@ class GenericController extends BaseController $data['showDiff'] = false; $diffArray = array(); + + if ($this->m['HardwareModel']->isCleared($clean['id_hard'])) $this->redirect('generic/cleared/'.$this->lang,0); if (strcmp($clean['id_hard'],0) !== 0 and strcmp($clean['id_rev'],0) !== 0) { @@ -692,6 +714,8 @@ class GenericController extends BaseController $clean['id_rev'] = (int)$id_rev; $clean['id_hard'] = (int)$this->m['RevisionsModel']->getIdHard($clean['id_rev']); + + if ($this->m['HardwareModel']->isCleared($clean['id_hard'])) $this->redirect('generic/cleared/'.$this->lang,0); if ($clean['id_hard'] !== 0) { @@ -751,6 +775,8 @@ class GenericController extends BaseController $data['tree'] = $this->getSpecHardLink() . " » " . $this->getViewLink($clean['id_hard'],$data['ne_name'])." » talk"; $data['isDeleted'] = $this->m['HardwareModel']->isDeleted($clean['id_hard']); + + if ($this->m['HardwareModel']->isCleared($clean['id_hard'])) $this->redirect('generic/cleared/'.$this->lang,0); if (isset($_POST['insertAction'])) { diff --git a/h-source/Application/Controllers/HistoryController.php b/h-source/Application/Controllers/HistoryController.php index ee68381..8c14bb0 100644 --- a/h-source/Application/Controllers/HistoryController.php +++ b/h-source/Application/Controllers/HistoryController.php @@ -195,7 +195,7 @@ class HistoryController extends BaseController 'to_status' => 'yes', 'exec_string' => 'The device page has been permanently deleted. Just reload the page', 'error_string' => 'Error: the device page has already been permanently deleted', -// 'method' => 'oupdate', + 'method' => 'permanentlyDelete', ), ); diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php index 37d88ad..e169c6d 100644 --- a/h-source/Application/Include/languages.php +++ b/h-source/Application/Include/languages.php @@ -243,6 +243,7 @@ class Lang /*0205*/"Device pages that have to be approved" => "Pagine di dispositivi da approvare", /*0206*/"The device page has to be approved by an administrator of the website" => "La pagina del dispositivo deve essere approvata da un amministratore del sito", /*0207*/"permanently delete the device page" => "cancella definitivamente la pagina", + /*0208*/"This page has been permanently deleted by an administrator of the website" => "Questa pagina รจ stata definitivamente cancellata da un amministratore del sito", ), 'es' => array ( diff --git a/h-source/Application/Models/HardwareModel.php b/h-source/Application/Models/HardwareModel.php index a1aa01b..1c552c0 100644 --- a/h-source/Application/Models/HardwareModel.php +++ b/h-source/Application/Models/HardwareModel.php @@ -72,9 +72,13 @@ class HardwareModel extends Model_Map { parent::__construct(); } - public function oupdate($id) + public function permanentlyDelete($id) { - return $this->pUpdate($id); + $this->values['deleted'] = 'no'; + $this->values['approved'] = 'yes'; + $this->values['pci_id'] = ''; + + return parent::update($id); } public function pUpdate($id) @@ -284,5 +288,16 @@ class HardwareModel extends Model_Map { } return false; } + + public function isCleared($id) + { + $clean['id'] = (int)$id; + $res = $this->select('hardware.cleared')->where(array('id_hard'=>$clean['id']))->send(); + if ( count($res) > 0 ) + { + return strcmp($res[0]['hardware']['cleared'],'no') === 0 ? false : true; + } + return false; + } } \ No newline at end of file diff --git a/h-source/Application/Views/cleared.php b/h-source/Application/Views/cleared.php new file mode 100644 index 0000000..ef1cfb3 --- /dev/null +++ b/h-source/Application/Views/cleared.php @@ -0,0 +1,28 @@ + + +. +?> + + +
+
+ +
+
diff --git a/h-source/Application/Views/dialog.php b/h-source/Application/Views/dialog.php index 788bf21..bbbe1ae 100644 --- a/h-source/Application/Views/dialog.php +++ b/h-source/Application/Views/dialog.php @@ -26,7 +26,7 @@ $("#dialog-form").css("display","block"); - $('#notice_dialog').dialog({ + $('#n_dialog').dialog({ autoOpen: false, width: 500 }); @@ -51,8 +51,8 @@ cache:false, dataType: "html", success: function(html){ - $(".notice_dialog_inner").text(html); - $('#notice_dialog').dialog('open'); + $(".n_dialog_inner").text(html); + $('#n_dialog').dialog('open'); } }); @@ -95,8 +95,8 @@ -
-
+
+
\ No newline at end of file diff --git a/h-source/Config/Route.php b/h-source/Config/Route.php index f490a1d..6eb88f1 100644 --- a/h-source/Config/Route.php +++ b/h-source/Config/Route.php @@ -104,6 +104,7 @@ class Route 'search,pciid', 'search,lspci', 'generic,del', + 'generic,cleared', 'news,index', 'download,index', 'download,all', -- cgit v1.2.3