aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2011-07-13 15:28:30 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2011-07-13 15:28:30 +0000
commitd8e1f81df2e40574c0e685910bf99407f7e66017 (patch)
treea69b5a96dff0f22a37db460d5fb2d88ff49650ec
parentbe1d2d6c4c5623c6af59cf72e74e0335d1aa6cb5 (diff)
administrators can permanently delete a device page - part 1
-rw-r--r--h-source/Application/Controllers/BaseController.php6
-rw-r--r--h-source/Application/Controllers/GenericController.php2
-rw-r--r--h-source/Application/Controllers/HistoryController.php57
-rw-r--r--h-source/Application/Controllers/SpecialController.php2
-rw-r--r--h-source/Application/Include/languages.php3
-rw-r--r--h-source/Application/Include/myFunctions.php4
-rw-r--r--h-source/Application/Models/HardwareModel.php5
-rw-r--r--h-source/Application/Models/HistoryModel.php1
-rw-r--r--h-source/Application/Views/top_left.php24
-rw-r--r--h-source/Config/Route.php1
-rw-r--r--h-source/Public/Css/main.css13
-rwxr-xr-xh-source/Public/Img/Crystal/clear.pngbin0 -> 1120 bytes
-rw-r--r--h-source/tables.sql2
13 files changed, 95 insertions, 25 deletions
diff --git a/h-source/Application/Controllers/BaseController.php b/h-source/Application/Controllers/BaseController.php
index 02db21d..f40d45f 100644
--- a/h-source/Application/Controllers/BaseController.php
+++ b/h-source/Application/Controllers/BaseController.php
@@ -135,14 +135,14 @@ class BaseController extends Controller
$data['language_links'] = $this->buildLanguageLinks($this->lang);
$data['lastModif'] = $this->m['HistoryModel']
- ->select()
+ ->clear()->select()
->inner('hardware')
->on('hardware.id_hard=history.id')
- ->where(array('type'=>'hardware','gr'=>'registered','approved'=>'yes'))
+ ->where(array('type'=>'hardware','gr'=>'registered','deleted'=>'no'))
->orderBy('id_history desc')
->limit(5)
->send();
-
+
$this->append($data);
$this->load('right');
}
diff --git a/h-source/Application/Controllers/GenericController.php b/h-source/Application/Controllers/GenericController.php
index a5dd24c..2e7a45b 100644
--- a/h-source/Application/Controllers/GenericController.php
+++ b/h-source/Application/Controllers/GenericController.php
@@ -487,7 +487,7 @@ class GenericController extends BaseController
$data['tree'] = null;
$data['isDeleted'] = false;
- $data['md_javascript'] = "moderator_dialog(\"devicehide\",\"device\");moderator_dialog(\"deviceshow\",\"device\");moderator_dialog(\"deviceapprove\",\"device_app\");";
+ $data['md_javascript'] = "moderator_dialog(\"devicehide\",\"device\");moderator_dialog(\"deviceshow\",\"device\");moderator_dialog(\"deviceapprove\",\"device_app\");moderator_dialog(\"deviceclear\",\"device_cl\");";
if ($this->mod->checkType($clean['id_hard']))
{
diff --git a/h-source/Application/Controllers/HistoryController.php b/h-source/Application/Controllers/HistoryController.php
index 3b6e1d2..a3421a9 100644
--- a/h-source/Application/Controllers/HistoryController.php
+++ b/h-source/Application/Controllers/HistoryController.php
@@ -32,7 +32,8 @@ class HistoryController extends BaseController
'page' => 'wiki page',
'page_del' => 'wiki page',
'device' => 'device page',
- 'device_app' => 'device page',
+ 'device_app' => 'device page',
+ 'device_cl' => 'device page',
);
public static $actionTable = array(
@@ -49,6 +50,7 @@ class HistoryController extends BaseController
'devicehide' => 'hide',
'deviceshow' => 'show',
'deviceapprove' => 'approve',
+ 'deviceclear' => 'perm deleted',
);
protected $strings = array(
@@ -182,7 +184,17 @@ class HistoryController extends BaseController
'error_string' => 'Error: the device page is already approved',
),
-
+
+ 'deviceclear' => array(
+
+ 'action' => 'deviceclear',
+ 'check_status' => 'no',
+ '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',
+
+ ),
);
protected $types = array(
@@ -266,7 +278,7 @@ class HistoryController extends BaseController
),
- //page blocked or not
+ //device page blocked or not
'device' => array(
'clean_type' => 'device',
@@ -275,11 +287,11 @@ class HistoryController extends BaseController
'field_name' => '-deleted',
'actions' => array('devicehide','deviceshow'),
'group' => 'admin',
- 'types_to_show' => 'device_app,device',
+ 'types_to_show' => 'device_app,device,device_cl',
),
- //page blocked or not
+ //device page approved
'device_app' => array(
'clean_type' => 'device_app',
@@ -290,7 +302,18 @@ class HistoryController extends BaseController
'group' => 'admin',
),
-
+
+ //device page cleared
+ 'device_cl' => array(
+
+ 'clean_type' => 'device_cl',
+ 'model_name' => 'HardwareModel',
+ 'id_name' => 'id_hard',
+ 'field_name' => 'cleared',
+ 'actions' => array('deviceclear'),
+ 'group' => 'admin',
+
+ ),
);
public function __construct($model, $controller, $queryString)
@@ -366,6 +389,11 @@ class HistoryController extends BaseController
{
$this->generic($lang, $token, 'deviceapprove');
}
+
+ public function deviceclear($lang = 'en', $token = '')
+ {
+ $this->generic($lang, $token, 'deviceclear');
+ }
protected function generic($lang = 'en', $token = '', $action = 'hide')
{
@@ -389,7 +417,7 @@ class HistoryController extends BaseController
$message = $this->request->post('message','');
$modelName = 'error';
-
+
if (array_key_exists($type,$this->types))
{
if (in_array($action,$this->types[$type]['actions']))
@@ -406,8 +434,10 @@ class HistoryController extends BaseController
$this->model($modelName);
$model = $this->m[$modelName];
- $count = $model->select()->where(array($clean['id_name'] => $clean['id'],$clean['field_name'] => $this->strings[$action]['check_status']))->rowNumber();
+ $model->select()->where(array($clean['id_name'] => $clean['id'],$clean['field_name'] => $this->strings[$action]['check_status']));
+ $count = $model->rowNumber();
+
if ($count > 0)
{
if (eg_strlen($message) < 500)
@@ -417,7 +447,15 @@ class HistoryController extends BaseController
//hide the message
$model->values = array($clean['field_name'] => $this->strings[$action]['to_status']);
- $model->pUpdate($clean['id']);
+
+ if (isset($this->strings[$action]['method']))
+ {
+ call_user_func(array($model, $this->strings[$action]['method']),$clean['id']);
+ }
+ else
+ {
+ $model->pUpdate($clean['id']);
+ }
if ($model->queryResult)
{
@@ -533,6 +571,7 @@ class HistoryController extends BaseController
'devicehide' => 'hidden',
'deviceshow' => 'restored',
'deviceapprove' => 'approved',
+ 'deviceclear' => 'permanently deleted',
);
$this->append($data);
diff --git a/h-source/Application/Controllers/SpecialController.php b/h-source/Application/Controllers/SpecialController.php
index 6ef632a..db3975b 100644
--- a/h-source/Application/Controllers/SpecialController.php
+++ b/h-source/Application/Controllers/SpecialController.php
@@ -104,7 +104,7 @@ class SpecialController extends BaseController
$whereClauseArray = array(
'gr' => 'registered',
'type' => 'hardware',
- 'approved' => 'yes',
+ 'deleted' => 'no',
);
$this->helper('Pages','special/'.$this->action.'/'.$this->lang,'page');
diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php
index 2dd8d1c..37d88ad 100644
--- a/h-source/Application/Include/languages.php
+++ b/h-source/Application/Include/languages.php
@@ -241,7 +241,8 @@ class Lang
/*0203*/"approve the device page" => "approva la pagina del dispositivo",
/*0204*/"This device page has not been approved yet" => "La pagina del dispositivo non รจ ancora stata approvata",
/*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"
+ /*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",
),
'es' => array
(
diff --git a/h-source/Application/Include/myFunctions.php b/h-source/Application/Include/myFunctions.php
index 4876676..1505512 100644
--- a/h-source/Application/Include/myFunctions.php
+++ b/h-source/Application/Include/myFunctions.php
@@ -4712,6 +4712,10 @@ function goToModeratedItem( $row = array() )
$hardInfo = getHardwareInfoFromId($row['id']);
$url = $hardInfo['controller'].'/view/'.Lang::$current.'/'.$row['id'].'/'.encodeUrl($hardInfo['model']);
break;
+ case 'device_cl':
+ $hardInfo = getHardwareInfoFromId($row['id']);
+ $url = $hardInfo['controller'].'/view/'.Lang::$current.'/'.$row['id'].'/'.encodeUrl($hardInfo['model']);
+ break;
}
return 'http://'.DOMAIN_NAME.'/'.$url;
}
diff --git a/h-source/Application/Models/HardwareModel.php b/h-source/Application/Models/HardwareModel.php
index d19cfbd..a1aa01b 100644
--- a/h-source/Application/Models/HardwareModel.php
+++ b/h-source/Application/Models/HardwareModel.php
@@ -72,6 +72,11 @@ class HardwareModel extends Model_Map {
parent::__construct();
}
+ public function oupdate($id)
+ {
+ return $this->pUpdate($id);
+ }
+
public function pUpdate($id)
{
if (isset($this->values['approved']))
diff --git a/h-source/Application/Models/HistoryModel.php b/h-source/Application/Models/HistoryModel.php
index daeda1f..4e345ed 100644
--- a/h-source/Application/Models/HistoryModel.php
+++ b/h-source/Application/Models/HistoryModel.php
@@ -28,6 +28,7 @@ class HistoryModel extends Model_Tree {
$this->_where=array(
'approved' => 'hardware',
+ 'deleted' => 'hardware',
);
$this->orderBy = 'history.id_history';
diff --git a/h-source/Application/Views/top_left.php b/h-source/Application/Views/top_left.php
index 73e8f80..08674c8 100644
--- a/h-source/Application/Views/top_left.php
+++ b/h-source/Application/Views/top_left.php
@@ -31,22 +31,30 @@
<!--delete the page-->
<?php if ($isadmin) { ?>
<div class="moderator_box_deleted clear_right">
- <?php if ($isDeleted and $isApproved) { ?>
- <?php echo gtext('This device page has been hidden'); ?>
-
- <a id="<?php echo $id_hard;?>" class="deviceshow_device block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/button_ok.png"><?php echo gtext('restore the device page'); ?></a>
-
- <?php } else if ($isDeleted and !$isApproved) { ?>
- <?php echo gtext("This device page has not been approved yet");?>
+ <?php if ($isDeleted) { ?>
+
+ <?php if ($isApproved) { ?>
- <a id="<?php echo $id_hard;?>" class="deviceapprove_device_app block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/button_ok.png"><?php echo gtext('approve the device page'); ?></a>
+ <?php echo gtext('This device page has been hidden'); ?>
+
+ <a id="<?php echo $id_hard;?>" class="deviceshow_device block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/button_ok.png"><?php echo gtext('restore the device page'); ?></a>
+
+ <?php } else { ?>
+ <?php echo gtext("This device page has not been approved yet");?>
+
+ <a id="<?php echo $id_hard;?>" class="deviceapprove_device_app block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/button_ok.png"><?php echo gtext('approve the device page'); ?></a>
+
+ <?php } ?>
+
<?php } else { ?>
<a id="<?php echo $id_hard;?>" class="devicehide_device block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/button_cancel.png"><?php echo gtext('hide the device page'); ?></a>
<?php } ?>
+ <a id="<?php echo $id_hard;?>" class="deviceclear_device_cl block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/clear.png"><?php echo gtext('permanently delete the device page'); ?></a>
+
<!--view details-->
<div class="show_hidden_box_ext">
<div class="md_type">device</div>
diff --git a/h-source/Config/Route.php b/h-source/Config/Route.php
index 5362ae0..f490a1d 100644
--- a/h-source/Config/Route.php
+++ b/h-source/Config/Route.php
@@ -132,6 +132,7 @@ class Route
'history,devicehide',
'history,deviceshow',
'history,deviceapprove',
+ 'history,deviceclear',
'threegcards,catalogue',
'threegcards,view',
'threegcards,history',
diff --git a/h-source/Public/Css/main.css b/h-source/Public/Css/main.css
index 2f15a7f..be0c737 100644
--- a/h-source/Public/Css/main.css
+++ b/h-source/Public/Css/main.css
@@ -1392,11 +1392,14 @@ ins
.hide_general, .block_general
{
+ clear:right;
float:right;
margin-left:10px;
- font-weight:normal;
+ font-weight:bold;
text-decoration:none;
- color:black;
+ color:#000;
+ font-size:13px;
+ padding-bottom:4px;
}
.hide_general img
{
@@ -1809,6 +1812,12 @@ span.entry_label_small
display:none;
}
+.moderation_details_box
+{
+ clear:right;
+ margin-top:5px;
+}
+
/*
Start - temporarily added due to transformation of help pages
2011-05-29 joeko
diff --git a/h-source/Public/Img/Crystal/clear.png b/h-source/Public/Img/Crystal/clear.png
new file mode 100755
index 0000000..4ad6a58
--- /dev/null
+++ b/h-source/Public/Img/Crystal/clear.png
Binary files differ
diff --git a/h-source/tables.sql b/h-source/tables.sql
index b6914c9..ba40d5c 100644
--- a/h-source/tables.sql
+++ b/h-source/tables.sql
@@ -90,6 +90,7 @@ create table hardware (
ask_for_del char(4) not null default 'no',
deleted char(4) not null default 'no',
approved char(4) not null default 'yes',
+ cleared char(3) not null default 'no',
pci_id char(10) not null,
driver varchar(50) not null,
interface char(15) not null default 'not-specified',
@@ -134,6 +135,7 @@ create table revisions (
architecture char(15) not null default 'not-specified',
other_names text CHARACTER SET utf8 not null,
approved char(4) not null default 'yes',
+ cleared char(3) not null default 'no',
id_hard INT UNSIGNED NOT NULL
)engine=innodb;