From 759f536ae8a94ec5cce173fd00855aa39f0dbf3a Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Thu, 19 May 2011 22:10:52 +0000 Subject: h-source:added preview button for the description entry and for the wiki pages --- .../Application/Controllers/WikiController.php | 25 ++++++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'h-source/Application/Controllers/WikiController.php') diff --git a/h-source/Application/Controllers/WikiController.php b/h-source/Application/Controllers/WikiController.php index 0e05ffd..9815055 100644 --- a/h-source/Application/Controllers/WikiController.php +++ b/h-source/Application/Controllers/WikiController.php @@ -40,6 +40,8 @@ class WikiController extends BaseController public function insert($lang = 'en') { $this->shift(1); + + $data['pagePreview'] = null; $data['title'] = 'insert a wiki page - '.Website::$generalName; @@ -64,6 +66,8 @@ class WikiController extends BaseController die(); } } + + $data['pagePreview'] = $this->getPreview(); $data['notice'] = $this->m['WikiModel']->notice; @@ -87,6 +91,8 @@ class WikiController extends BaseController { $this->shift(1); + $data['pagePreview'] = null; + $data['title'] = 'update a wiki page - '.Website::$generalName; $this->m['WikiModel']->setFields('title,page','sanitizeAll'); @@ -125,6 +131,8 @@ class WikiController extends BaseController } } + $data['pagePreview'] = $this->getPreview(); + $data['notice'] = $this->m['WikiModel']->notice; $data['id_wiki'] = $clean['id_wiki']; @@ -151,13 +159,16 @@ class WikiController extends BaseController } } -// protected function viewRedirect($titleClean) -// { -// if ($this->m['WikiModel']->queryResult) -// { -// $this->redirect($this->controller.'/page/'.$this->lang.'/'.$titleClean); -// } -// } + //get the preview of the description entry + protected function getPreview() + { + if (isset($_POST['previewAction'])) + { + $this->m['WikiModel']->result = false; + return $this->request->post('page','','sanitizeHtml'); + } + return null; + } public function page($lang = 'en', $title_clean = null) { -- cgit v1.2.3