From c91a070738a9e46008209c4afe596ff56cfaa777 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Wed, 16 Feb 2011 18:15:20 +0000 Subject: improved wiki --- .../Application/Controllers/HistoryController.php | 50 +++++- .../Application/Controllers/WikiController.php | 80 +++++----- h-source/Application/Include/hardware.php | 3 +- h-source/Application/Include/languages.php | 2 +- h-source/Application/Include/myFunctions.php | 1 + h-source/Application/Models/WikiModel.php | 4 +- .../Application/Views/Videocards/catalogue.php | 2 +- h-source/Application/Views/Videocards/page.php | 2 +- h-source/Application/Views/Wiki/climb.php | 44 +++--- h-source/Application/Views/Wiki/differences.php | 57 +++---- h-source/Application/Views/Wiki/history.php | 86 ++++++----- h-source/Application/Views/Wiki/page.php | 34 +++-- h-source/Application/Views/Wiki/talk.php | 170 +++++++++++---------- h-source/Config/Route.php | 2 + 14 files changed, 300 insertions(+), 237 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'] = "\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'] = "\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() . " » " . $this->getViewLink($data['tree_name'])." » ".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']; diff --git a/h-source/Application/Include/hardware.php b/h-source/Application/Include/hardware.php index 42cce0b..f10993b 100644 --- a/h-source/Application/Include/hardware.php +++ b/h-source/Application/Include/hardware.php @@ -249,7 +249,8 @@ class Videocard extends Hardware "ATI" => "ATI", "NVIDIA" => "NVIDIA", "Intel" => "Intel", - "SiS" => "SiS", + "Silicon Integrated Systems Corp" => "Silicon-Integrated-Systems-Corp", + "VIA Technologies, Inc" => "VIA-Technologies-Inc", ); public static $videoSelect = array( diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php index 0a8a728..6a9d9ec 100644 --- a/h-source/Application/Include/languages.php +++ b/h-source/Application/Include/languages.php @@ -190,7 +190,7 @@ class Lang "I want to make this revision the current revision" => "Voglio che questa revisione diventi quella corrente", "Confirm" => "Conferma", "Make this revision the current revision of the page" => "Rendi questa revisione la revisione corrente della pagina", - "This wiki page has been hidden" => "Questa pagina della wiki è stata nascosta", + "This wiki page has been deleted" => "Questa pagina della wiki è stata cancellata", "Talk" => "Discussione", "Talk page of the wiki page" => "Pagina di discussione della pagina della wiki", "a page with the same title already exists" => "esiste già una pagina con questo titolo", diff --git a/h-source/Application/Include/myFunctions.php b/h-source/Application/Include/myFunctions.php index d2b54e7..d731062 100644 --- a/h-source/Application/Include/myFunctions.php +++ b/h-source/Application/Include/myFunctions.php @@ -444,6 +444,7 @@ function betterVendor($string) "iMicro-Electronics" => "iMicro Electronics", "Active-Pixel" => "Active Pixel", "Microdia-Ltd" => "Microdia Ltd", + "Silicon-Integrated-Systems-Corp" => "Silicon Integrated Systems Corp", ); return (array_key_exists($string,$names)) ? $names[$string] : $string; diff --git a/h-source/Application/Models/WikiModel.php b/h-source/Application/Models/WikiModel.php index 6cdc632..2ee7505 100644 --- a/h-source/Application/Models/WikiModel.php +++ b/h-source/Application/Models/WikiModel.php @@ -267,9 +267,9 @@ class WikiModel extends Model_Map { $res = $this->select('wiki.deleted')->where(array('id_wiki'=>$clean['id']))->send(); if ( count($res) > 0 ) { - return $res[0]['wiki']['deleted']; + return strcmp($res[0]['wiki']['deleted'],'no') === 0 ? false : true; } - return 'no'; + return false; } public function isBlocked($id) diff --git a/h-source/Application/Views/Videocards/catalogue.php b/h-source/Application/Views/Videocards/catalogue.php index ff9b7fd..3f77e15 100644 --- a/h-source/Application/Views/Videocards/catalogue.php +++ b/h-source/Application/Views/Videocards/catalogue.php @@ -50,7 +50,7 @@
:
-
+
diff --git a/h-source/Application/Views/Videocards/page.php b/h-source/Application/Views/Videocards/page.php index 68612ad..a9a9b3d 100644 --- a/h-source/Application/Views/Videocards/page.php +++ b/h-source/Application/Views/Videocards/page.php @@ -45,7 +45,7 @@
:
-
+
diff --git a/h-source/Application/Views/Wiki/climb.php b/h-source/Application/Views/Wiki/climb.php index bd502d1..c648e7f 100644 --- a/h-source/Application/Views/Wiki/climb.php +++ b/h-source/Application/Views/Wiki/climb.php @@ -21,30 +21,32 @@ ?>
-
- ">Home » -
- -
- -
- - + -
+
+ ">Home » +
- +
+ +
-
+ - -
" method="POST"> - : -
- +
-
+ -
\ No newline at end of file +
+ +
" method="POST"> + : +
+ +
+ +
+ + \ No newline at end of file diff --git a/h-source/Application/Views/Wiki/differences.php b/h-source/Application/Views/Wiki/differences.php index 1709cbf..ee7a795 100644 --- a/h-source/Application/Views/Wiki/differences.php +++ b/h-source/Application/Views/Wiki/differences.php @@ -21,41 +21,44 @@ ?>
- -
- ">Home » -
- - -
- Differences between the revision of , created by getUser($created_by));?>, and the revision of -
- - - + + -
+
+ ">Home » +
-
- Notice: the text in red has been deleted from the previous revision, the text in green has been added in this revision and the text in gray has not been changed. + +
+ Differences between the revision of , created by getUser($created_by));?>, and the revision of
+ - $text) { ?> + -
+
-
- : +
+ Notice: the text in red has been deleted from the previous revision, the text in green has been added in this revision and the text in gray has not been changed.
-
- -
+ $text) { ?> -
+
- +
+ : +
+ +
+ +
+ +
-
+ + +
+ diff --git a/h-source/Application/Views/Wiki/history.php b/h-source/Application/Views/Wiki/history.php index ec394f4..b2e2ab5 100644 --- a/h-source/Application/Views/Wiki/history.php +++ b/h-source/Application/Views/Wiki/history.php @@ -22,49 +22,53 @@
-
- ">Home » ">Wiki » "> » -
- -
- -
- - + -
- - + +
+ +
+ : +
-
- -
- : -
+ diff --git a/h-source/Application/Views/Wiki/page.php b/h-source/Application/Views/Wiki/page.php index d386704..1580d67 100644 --- a/h-source/Application/Views/Wiki/page.php +++ b/h-source/Application/Views/Wiki/page.php @@ -57,16 +57,18 @@ - - - + + + + + - +
controller."/update/$lang";?>" method="POST"> @@ -76,10 +78,12 @@
- - + + + + action,'revision') === 0 ) { ?>
@@ -98,15 +102,15 @@
- +
- +
- + action,'revision') === 0) { ?> diff --git a/h-source/Application/Views/Wiki/talk.php b/h-source/Application/Views/Wiki/talk.php index 724b273..3e26527 100644 --- a/h-source/Application/Views/Wiki/talk.php +++ b/h-source/Application/Views/Wiki/talk.php @@ -44,126 +44,130 @@ controller."/page/$lang/".encodeUrl($tree_name);?>">
- - -
+ + - +
- + - -
+ -
- - ">hide - + +
+ +
+ + ">hide + + +
+ +
-
- +
+ by getUser($message['wiki_talk']['created_by']));?>, +
-
- by getUser($message['wiki_talk']['created_by']));?>, +
+
-
-
- -
+ + +
+
wiki_talk
+ ">view details +
+
+ - - -
-
wiki_talk
- ">view details -
- - -
- - - - - -
- this message has been deleted - ">make visible + - -
-
wiki_talk
- - ">view details - -
-
-
- submitted by getUser($message['wiki_talk']['created_by']));?>, -
-
- + + +
+ this message has been deleted + + ">make visible + + +
+
wiki_talk
+ + ">view details + +
+
+
+ submitted by getUser($message['wiki_talk']['created_by']));?>, +
+
+ +
+
-
-
-
+
+ + +
- -
+ - +
+ -
- + - +
+ controller."/talk/$lang/$id_wiki";?>#form" method="POST"> -
- controller."/talk/$lang/$id_wiki";?>#form" method="POST"> +
-
+
+ + +
-
- - -
+
+ + +
+ + -
- -
- + +
+
-
+ - + -
- + - \ No newline at end of file diff --git a/h-source/Config/Route.php b/h-source/Config/Route.php index 31a5238..5d65567 100644 --- a/h-source/Config/Route.php +++ b/h-source/Config/Route.php @@ -108,6 +108,8 @@ class Route 'history,pageblock', 'history,pageunblock', 'history,viewall', + 'history,pagehide', + 'history,pageshow', 'threegcards,catalogue', 'threegcards,view', 'threegcards,history', -- cgit v1.2.3