aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2011-07-15 15:23:51 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2011-07-15 15:23:51 +0000
commitff7042aba4ba6a98b98b7a4435417d63374f2d69 (patch)
tree8949f0b7bbb36ef70492694371f4977321a4e2ba /h-source/Application
parent8e1a6083cf4be6b0fb2d31863e409dfcb4705261 (diff)
added view file for permanently deleted devices
Diffstat (limited to 'h-source/Application')
-rw-r--r--h-source/Application/Controllers/GenericController.php26
-rw-r--r--h-source/Application/Controllers/HistoryController.php2
-rw-r--r--h-source/Application/Include/languages.php1
-rw-r--r--h-source/Application/Models/HardwareModel.php19
-rw-r--r--h-source/Application/Views/cleared.php28
-rw-r--r--h-source/Application/Views/dialog.php10
6 files changed, 78 insertions, 8 deletions
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() . " &raquo; " . $this->getViewLink($data['id_hard'],$data['ne_name'])." &raquo; " . $this->getHistoryLink($data['id_hard']) . " &raquo; <span class='last_tree_element'>revision</span>";
@@ -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() . " &raquo; " . $this->getViewLink($clean['id_hard'],$data['ne_name'])." &raquo; <span class='last_tree_element'>talk</span>";
$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 @@
+<?php if (!defined('EG')) die('Direct access not allowed!'); ?>
+
+<?php
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This file is part of h-source
+//
+// h-source is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// h-source is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with h-source. If not, see <http://www.gnu.org/licenses/>.
+?>
+
+
+ <div class="notebooks_viewall">
+ <div class="revision_alert">
+ <?php echo gtext('This page has been permanently deleted by an administrator of the website');?>
+ </div>
+ </div>
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 @@
</form>
</div>
-<div id="notice_dialog" title="Notice:">
- <div class="notice_dialog_inner">
+<div id="n_dialog" title="Notice:">
+ <div class="n_dialog_inner">
</div>
</div> \ No newline at end of file