aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application/Controllers
diff options
context:
space:
mode:
Diffstat (limited to 'h-source/Application/Controllers')
-rw-r--r--h-source/Application/Controllers/GenericController.php42
-rw-r--r--h-source/Application/Controllers/HistoryController.php71
-rw-r--r--h-source/Application/Controllers/WikiController.php2
3 files changed, 86 insertions, 29 deletions
diff --git a/h-source/Application/Controllers/GenericController.php b/h-source/Application/Controllers/GenericController.php
index 9cbaeee..da2f87a 100644
--- a/h-source/Application/Controllers/GenericController.php
+++ b/h-source/Application/Controllers/GenericController.php
@@ -470,8 +470,10 @@ class GenericController extends BaseController
$data['ne_name'] = null;
$data['name'] = null;
$data['tree'] = null;
- $data['isDeleted'] = 'no';
+ $data['isDeleted'] = false;
+ $data['md_javascript'] = "moderator_dialog(\"devicehide\",\"device\");moderator_dialog(\"deviceshow\",\"device\");";
+
if ($this->mod->checkType($clean['id_hard']))
{
$this->mod->setWhereQueryClause(array("id_hard" => $clean['id_hard']));
@@ -486,9 +488,9 @@ class GenericController extends BaseController
$data['name'] = encodeUrl($data['ne_name']);
$data['title'] = $data['ne_name'].' - '.Website::$generalName;
$data['tree'] = $this->getSpecHardLink() . " &raquo; <span class='last_tree_element'>".$data['ne_name']."</span>";
- $data['isDeleted'] = $data['table'][0]['hardware']['deleted'];
+ $data['isDeleted'] = $this->m['HardwareModel']->isDeleted($clean['id_hard']);
- if (strcmp($data['isDeleted'],'yes') === 0)
+ if ($data['isDeleted'])
{
$deletion = new DeletionModel();
$data['deletion'] = $deletion->select()->where(array('id_hard'=>$clean['id_hard']))->send();
@@ -527,6 +529,8 @@ class GenericController extends BaseController
$data['tree'] = $this->getSpecHardLink() . " &raquo; " . $this->getViewLink($clean['id'],$data['ne_name'])." &raquo; <span class='last_tree_element'>history</span>";
$data['title'] = 'history - '.Website::$generalName;
+
+ $data['isDeleted'] = $this->m['HardwareModel']->isDeleted($clean['id']);
//get the first revision
$res = $this->m['RevisionsModel']->db->select('revisions','id_rev','id_hard='.$clean['id'],null,'id_rev',1);
@@ -572,7 +576,7 @@ class GenericController extends BaseController
$data['name'] = null;
$data['ne_name'] = null;
$data['tree'] = null;
- $data['isDeleted'] = 'no';
+ $data['isDeleted'] = false;
$data['title'] = 'revision - '.Website::$generalName;
if (count($data['table']) > 0)
@@ -584,6 +588,8 @@ class GenericController extends BaseController
$data['updated_by'] = $data['table'][0]['revisions']['updated_by'];
$data['update_date'] = $data['table'][0]['revisions']['update_date'];
+
+ $data['isDeleted'] = $this->m['HardwareModel']->isDeleted($data['id_hard']);
}
$this->append($data);
@@ -603,7 +609,8 @@ class GenericController extends BaseController
$ne_name = $this->m['HardwareModel']->getTheModelName((int)$data['id_hard']);
$data['name'] = encodeUrl($ne_name);
$data['tree'] = $this->getSpecHardLink() . " &raquo; " . $this->getViewLink($data['id_hard'],$ne_name)." &raquo; " . $this->getHistoryLink($clean['id_hard']) . " &raquo; <span class='last_tree_element'>differences</span>";
-
+
+ $data['isDeleted'] = $this->m['HardwareModel']->isDeleted($clean['id_hard']);
$data['showDiff'] = false;
$diffArray = array();
@@ -677,7 +684,7 @@ class GenericController extends BaseController
{
$deleted = $this->m['HardwareModel']->select("hardware.deleted")->where(array("id_hard"=>$clean['id_hard']))->limit(1)->toList('deleted')->send();
- $data['isDeleted'] = $deleted[0];
+ $data['isDeleted'] = $this->m['HardwareModel']->isDeleted($clean['id_hard']);
$data['id_rev'] = $clean['id_rev'];
$data['id_hard'] = $clean['id_hard'];
@@ -693,21 +700,16 @@ 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']->isDeleted($clean['id_hard'])) $this->redirect($this->controller.'/catalogue/'.$this->lang,2,'this device page has been deleted..');
if (isset($_POST['confirmAction']))
{
- if (strcmp($deleted[0],'no') === 0)
- {
- $this->m['HardwareModel']->makeCurrent($clean['id_rev']);
-
- $this->viewRedirect($this->m['HardwareModel']->lastId);
-
- $data['notice'] = $this->m['HardwareModel']->notice;
- }
- else
- {
- $this->redirect($this->controller.'/catalogue/'.$this->lang,2,'deleted..');
- }
+ $this->m['HardwareModel']->makeCurrent($clean['id_rev']);
+
+ $this->viewRedirect($this->m['HardwareModel']->lastId);
+
+ $data['notice'] = $this->m['HardwareModel']->notice;
}
$this->append($data);
@@ -734,6 +736,8 @@ class GenericController extends BaseController
$data['ne_name'] = $this->m['HardwareModel']->getTheModelName($clean['id_hard']);
$data['name'] = encodeUrl($data['ne_name']);
$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 (isset($_POST['insertAction']))
{
@@ -742,6 +746,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']->isDeleted($clean['id_hard'])) $this->redirect($this->controller.'/catalogue/'.$this->lang,2,'this device page has been deleted..');
$this->m['TalkModel']->values['created_by'] = $this->s['registered']->status['id_user'];
$this->m['TalkModel']->values['id_hard'] = $clean['id_hard'];
diff --git a/h-source/Application/Controllers/HistoryController.php b/h-source/Application/Controllers/HistoryController.php
index e44ce79..71055fc 100644
--- a/h-source/Application/Controllers/HistoryController.php
+++ b/h-source/Application/Controllers/HistoryController.php
@@ -31,6 +31,7 @@ class HistoryController extends BaseController
'wiki_talk' => 'wiki talk',
'page' => 'wiki page',
'page_del' => 'wiki page',
+ 'device' => 'device page',
);
public static $actionTable = array(
@@ -44,6 +45,8 @@ class HistoryController extends BaseController
'pageunblock' => 'unblock',
'pagehide' => 'hide',
'pageshow' => 'show',
+ 'devicehide' => 'hide',
+ 'deviceshow' => 'show',
);
protected $strings = array(
@@ -147,6 +150,26 @@ class HistoryController extends BaseController
'error_string' => 'Error: the wiki page is already visible',
),
+
+ 'devicehide' => array(
+
+ 'action' => 'devicehide',
+ 'check_status' => 'no',
+ 'to_status' => 'yes',
+ 'exec_string' => 'The device page has been hidden. Just reload the page',
+ 'error_string' => 'Error: the device page is already hidden',
+
+ ),
+
+ 'deviceshow' => array(
+
+ 'action' => 'deviceshow',
+ 'check_status' => 'yes',
+ 'to_status' => 'no',
+ 'exec_string' => 'The device page is no more hidden. Just reload the page',
+ 'error_string' => 'Error: the device page is already visible',
+
+ ),
);
protected $types = array(
@@ -229,6 +252,18 @@ class HistoryController extends BaseController
'group' => 'admin',
),
+
+ //page blocked or not
+ 'device' => array(
+
+ 'clean_type' => 'device',
+ 'model_name' => 'HardwareModel',
+ 'id_name' => 'id_hard',
+ 'field_name' => '-deleted',
+ 'actions' => array('devicehide','deviceshow'),
+ 'group' => 'moderator',
+
+ ),
);
public function __construct($model, $controller, $queryString)
@@ -289,6 +324,16 @@ class HistoryController extends BaseController
{
$this->generic($lang, $token, 'pageshow');
}
+
+ public function devicehide($lang = 'en', $token = '')
+ {
+ $this->generic($lang, $token, 'devicehide');
+ }
+
+ public function deviceshow($lang = 'en', $token = '')
+ {
+ $this->generic($lang, $token, 'deviceshow');
+ }
protected function generic($lang = 'en', $token = '', $action = 'hide')
{
@@ -401,6 +446,10 @@ class HistoryController extends BaseController
$data['object'] = 'wiki page';
$data['box_class'] = 'details_of_actions_inner_user';
break;
+ case 'device':
+ $data['object'] = 'device page';
+ $data['box_class'] = 'details_of_actions_inner_user';
+ break;
case 'page_del':
$data['object'] = 'wiki page';
$data['box_class'] = 'details_of_actions_inner_user';
@@ -418,16 +467,18 @@ class HistoryController extends BaseController
$data['res'] = $this->m['HistoryModel']->select()->where(array('id'=>$clean['id'],'type'=>$clean['type'],'gr'=>$clean['group']))->send();
$data['md_action'] = array(
- 'hide' => 'hidden',
- 'show' => 'restored',
- 'block' => 'blocked',
- 'unblock' => 'un-blocked',
- 'open' => 'opened again',
- 'close' => 'closed',
- 'pageblock' => 'blocked',
- 'pageunblock' => 'un-blocked',
- 'pagehide' => 'hidden',
- 'pageshow' => 'restored',
+ 'hide' => 'hidden',
+ 'show' => 'restored',
+ 'block' => 'blocked',
+ 'unblock' => 'un-blocked',
+ 'open' => 'opened again',
+ 'close' => 'closed',
+ 'pageblock' => 'blocked',
+ 'pageunblock' => 'un-blocked',
+ 'pagehide' => 'hidden',
+ 'pageshow' => 'restored',
+ 'devicehide' => 'hidden',
+ 'deviceshow' => 'restored',
);
$this->append($data);
diff --git a/h-source/Application/Controllers/WikiController.php b/h-source/Application/Controllers/WikiController.php
index 9815055..7b5c7ba 100644
--- a/h-source/Application/Controllers/WikiController.php
+++ b/h-source/Application/Controllers/WikiController.php
@@ -189,7 +189,7 @@ class WikiController extends BaseController
$data['table'] = $res;
$data['tree_name'] = $res[0]['wiki']['title'];
$data['title'] = $res[0]['wiki']['title'] . ' - ' . Website::$generalName;
- $data['isDeleted'] = $this->m['WikiModel']->isDeleted($res[0]['wiki']['id_wiki']);;
+ $data['isDeleted'] = $this->m['WikiModel']->isDeleted($res[0]['wiki']['id_wiki']);
$data['isBlocked'] = $this->m['WikiModel']->isBlocked($res[0]['wiki']['id_wiki']);
if ( count($res) < 2 )