aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application/Controllers
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2011-02-16 18:15:20 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2011-02-16 18:15:20 +0000
commitc91a070738a9e46008209c4afe596ff56cfaa777 (patch)
treee1e996423b9d73a9e09e0c024bf464f349c83876 /h-source/Application/Controllers
parent4a27b517fc52dde60e5c1837860e4785317490a6 (diff)
improved wiki
Diffstat (limited to 'h-source/Application/Controllers')
-rw-r--r--h-source/Application/Controllers/HistoryController.php50
-rw-r--r--h-source/Application/Controllers/WikiController.php80
2 files changed, 86 insertions, 44 deletions
diff --git a/h-source/Application/Controllers/HistoryController.php b/h-source/Application/Controllers/HistoryController.php
index 2154a0e..13d3b3a 100644
--- a/h-source/Application/Controllers/HistoryController.php
+++ b/h-source/Application/Controllers/HistoryController.php
@@ -104,7 +104,26 @@ class HistoryController extends BaseController
'error_string' => 'Error: the wiki page is already un-blocked',
),
-
+
+ 'pagehide' => array(
+
+ 'action' => 'pagehide',
+ 'check_status' => 'no',
+ 'to_status' => 'yes',
+ 'exec_string' => 'The wiki page has been hidden. Just reload the page',
+ 'error_string' => 'Error: the wiki page is already hidden',
+
+ ),
+
+ 'pageshow' => array(
+
+ 'action' => 'pageshow',
+ 'check_status' => 'yes',
+ 'to_status' => 'no',
+ 'exec_string' => 'The wiki page is no more hidden. Just reload the page',
+ 'error_string' => 'Error: the wiki page is already visible',
+
+ ),
);
protected $types = array(
@@ -164,6 +183,7 @@ class HistoryController extends BaseController
),
+ //page blocked or not
'page' => array(
'clean_type' => 'page',
@@ -174,6 +194,18 @@ class HistoryController extends BaseController
'group' => 'admin',
),
+
+ //page deleted or not
+ 'page_del' => array(
+
+ 'clean_type' => 'page_del',
+ 'model_name' => 'WikiModel',
+ 'id_name' => 'id_wiki',
+ 'field_name' => 'deleted',
+ 'actions' => array('pagehide','pageshow'),
+ 'group' => 'admin',
+
+ ),
);
public function __construct($model, $controller, $queryString)
@@ -224,6 +256,16 @@ class HistoryController extends BaseController
{
$this->generic($lang, $token, 'pageunblock');
}
+
+ public function pagehide($lang = 'en', $token = '')
+ {
+ $this->generic($lang, $token, 'pagehide');
+ }
+
+ public function pageshow($lang = 'en', $token = '')
+ {
+ $this->generic($lang, $token, 'pageshow');
+ }
protected function generic($lang = 'en', $token = '', $action = 'hide')
{
@@ -333,6 +375,10 @@ class HistoryController extends BaseController
$data['object'] = 'wiki 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';
+ break;
case 'issue':
$data['object'] = 'issue';
$data['box_class'] = 'details_of_actions_inner_user';
@@ -354,6 +400,8 @@ class HistoryController extends BaseController
'close' => 'closed',
'pageblock' => 'blocked',
'pageunblock' => 'un-blocked',
+ 'pagehide' => 'hidden',
+ 'pageshow' => 'restored',
);
$this->append($data);
diff --git a/h-source/Application/Controllers/WikiController.php b/h-source/Application/Controllers/WikiController.php
index 65a615a..cc0c922 100644
--- a/h-source/Application/Controllers/WikiController.php
+++ b/h-source/Application/Controllers/WikiController.php
@@ -102,39 +102,34 @@ class WikiController extends BaseController
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['WikiModel']->isBlocked($clean['id_wiki'])) $this->redirect('wiki/page/'.$this->lang,2,'this page has been blocked..');
+
+ if ($this->m['WikiModel']->isDeleted($clean['id_wiki'])) $this->redirect('wiki/page/'.$this->lang,2,'this page has been deleted..');
$deleted = $this->m['WikiModel']->select("wiki.deleted")->where(array("id_wiki"=>$clean['id_wiki']))->limit(1)->toList('wiki.deleted')->send();
- if (strcmp($deleted[0],'no') === 0)
+ $data['tree_name'] = $title;
+
+ if (isset($_POST['updateAction']))
{
- $data['tree_name'] = $title;
+ //carry out the update database action
+ $this->m['WikiModel']->updateTable('update');
- if (isset($_POST['updateAction']))
- {
- //carry out the update database action
- $this->m['WikiModel']->updateTable('update');
+ $this->viewRedirect($this->m['WikiModel']->lastTitleClean);
+ }
- $this->viewRedirect($this->m['WikiModel']->lastTitleClean);
- }
-
- $data['notice'] = $this->m['WikiModel']->notice;
-
- $data['id_wiki'] = $clean['id_wiki'];
- $data['submitName'] = "updateAction";
+ $data['notice'] = $this->m['WikiModel']->notice;
- $data['values'] = $this->m['WikiModel']->getFormValues('update','sanitizeHtml');
- $data['hiddenInput'] = "<input type='hidden' name='id_wiki' value='".$clean['id_wiki']."'>\n";
-
- $this->append($data);
+ $data['id_wiki'] = $clean['id_wiki'];
+ $data['submitName'] = "updateAction";
- $this->load('form');
- $this->load('bottom_left');
- $this->right();
- }
- else
- {
- $this->redirect($this->controller.'/page/'.$this->lang,2,'deleted..');
- }
+ $data['values'] = $this->m['WikiModel']->getFormValues('update','sanitizeHtml');
+ $data['hiddenInput'] = "<input type='hidden' name='id_wiki' value='".$clean['id_wiki']."'>\n";
+
+ $this->append($data);
+
+ $this->load('form');
+ $this->load('bottom_left');
+ $this->right();
}
else
{
@@ -162,7 +157,7 @@ class WikiController extends BaseController
$data['title'] = 'main page - '.Website::$generalName;
$clean['title_clean'] = sanitizeAll($title_clean);
- $data['isDeleted'] = 'no';
+ $data['isDeleted'] = false;
$data['isBlocked'] = false;
if (isset($title_clean))
@@ -174,7 +169,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'] = $res[0]['wiki']['deleted'];
+ $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 )
@@ -233,6 +228,7 @@ class WikiController extends BaseController
$data['id'] = $clean['id'];
$data['tree_name'] = $this->m['WikiModel']->getTheModelName($clean['id']);
$data['isBlocked'] = $this->m['WikiModel']->isBlocked($clean['id']);
+ $data['isDeleted'] = $this->m['WikiModel']->isDeleted($clean['id']);
$data['title'] = 'history - '.Website::$generalName;
@@ -288,7 +284,7 @@ class WikiController extends BaseController
$data['tree'] = null;
$data['tree'] = null;
$data['title'] = 'revision - '.Website::$generalName;
- $data['isDeleted'] = 'no';
+ $data['isDeleted'] = false;
if (count($data['table']) > 0)
{
@@ -394,9 +390,8 @@ class WikiController extends BaseController
if ($clean['id_wiki'] !== 0)
{
- $deleted = $this->m['WikiModel']->select("wiki.deleted")->where(array("id_wiki"=>$clean['id_wiki']))->limit(1)->toList('wiki.deleted')->send();
-
- $data['isDeleted'] = $deleted[0];
+
+ $data['isDeleted'] = $this->m['WikiModel']->isDeleted($clean['id_wiki']);
$data['id_rev'] = $clean['id_rev'];
$data['id_wiki'] = $clean['id_wiki'];
@@ -412,21 +407,16 @@ class WikiController extends BaseController
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['WikiModel']->isBlocked($clean['id_wiki'])) $this->redirect('wiki/page/'.$this->lang,2,'this page has been blocked..');
+
+ if ($this->m['WikiModel']->isDeleted($clean['id_wiki'])) $this->redirect('wiki/page/'.$this->lang,2,'this page has been deleted..');
if (isset($_POST['confirmAction']))
{
- if (strcmp($deleted[0],'no') === 0)
- {
- $this->m['WikiModel']->makeCurrent($clean['id_rev']);
-
- $this->viewRedirect($this->m['WikiModel']->lastTitleClean);
-
- $data['notice'] = $this->m['WikiModel']->notice;
- }
- else
- {
- $this->redirect($this->controller.'/page/'.$this->lang,2,'deleted..');
- }
+ $this->m['WikiModel']->makeCurrent($clean['id_rev']);
+
+ $this->viewRedirect($this->m['WikiModel']->lastTitleClean);
+
+ $data['notice'] = $this->m['WikiModel']->notice;
}
$this->append($data);
@@ -453,6 +443,8 @@ class WikiController extends BaseController
$data['id_wiki'] = $clean['id_wiki'];
$data['tree_name'] = $this->m['WikiModel']->getTheModelName($clean['id_wiki']);
$data['isBlocked'] = $this->m['WikiModel']->isBlocked($clean['id_wiki']);
+ $data['isDeleted'] = $this->m['WikiModel']->isDeleted($clean['id_wiki']);
+
$data['tree'] = $this->getSpecPageLink() . " &raquo; " . $this->getViewLink($data['tree_name'])." &raquo; ".gtext('Talk');
if (isset($_POST['insertAction']))
@@ -462,6 +454,8 @@ class WikiController extends BaseController
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['WikiModel']->isBlocked($clean['id_wiki'])) $this->redirect('wiki/page/'.$this->lang,2,'this page has been blocked..');
+
+ if ($this->m['WikiModel']->isDeleted($clean['id_wiki'])) $this->redirect('wiki/page/'.$this->lang,2,'this page has been deleted..');
$this->m['WikitalkModel']->values['created_by'] = $this->s['registered']->status['id_user'];
$this->m['WikitalkModel']->values['id_wiki'] = $clean['id_wiki'];