From 8c287999487883a54271ae5e91bbb79b4fd15826 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Tue, 15 Feb 2011 01:11:53 +0000 Subject: added wiki - part 2 --- .../Application/Controllers/HistoryController.php | 11 ++++++ .../Application/Controllers/UsersController.php | 10 +---- .../Application/Controllers/WikiController.php | 5 ++- h-source/Application/Include/myFunctions.php | 15 +++++++- h-source/Application/Models/WikitalkModel.php | 2 +- h-source/Application/Views/Issues/view.php | 2 +- h-source/Application/Views/Issues/viewall.php | 2 +- h-source/Application/Views/Wiki/talk.php | 44 +++++++++++++++++++++- h-source/Application/Views/header.php | 1 + h-source/Application/Views/right.php | 2 - h-source/Application/Views/talk.php | 2 +- 11 files changed, 76 insertions(+), 20 deletions(-) (limited to 'h-source') diff --git a/h-source/Application/Controllers/HistoryController.php b/h-source/Application/Controllers/HistoryController.php index f5ae1a2..cc4b3d0 100644 --- a/h-source/Application/Controllers/HistoryController.php +++ b/h-source/Application/Controllers/HistoryController.php @@ -132,6 +132,17 @@ class HistoryController extends BaseController 'group' => 'moderator', ), + + 'wiki_talk' => array( + + 'clean_type' => 'wiki_talk', + 'model_name' => 'WikitalkModel', + 'id_name' => 'id_talk', + 'field_name' => 'deleted', + 'actions' => array('hide','show'), + 'group' => 'moderator', + + ), ); diff --git a/h-source/Application/Controllers/UsersController.php b/h-source/Application/Controllers/UsersController.php index 7f42a2a..4fa078b 100644 --- a/h-source/Application/Controllers/UsersController.php +++ b/h-source/Application/Controllers/UsersController.php @@ -107,15 +107,7 @@ class UsersController extends BaseController } else if ($res === 'was-logged') { - $redirect = $this->request->get('redirect','','sanitizeAll'); - if (strcmp($redirect,'') !== 0) - { - $this->redirect($redirect,0); - } - else - { - $this->redirect('home/index/'.Lang::$current,0); - } + $this->redirect('home/index/'.Lang::$current,0); } else if ($res === 'error') { diff --git a/h-source/Application/Controllers/WikiController.php b/h-source/Application/Controllers/WikiController.php index 33647ef..2ddc54d 100644 --- a/h-source/Application/Controllers/WikiController.php +++ b/h-source/Application/Controllers/WikiController.php @@ -448,11 +448,12 @@ class WikiController extends BaseController $data['notice'] = $this->m['WikitalkModel']->notice; // javascript for moderator -// $data['md_javascript'] = "moderator_dialog(\"hide\",\"talk\");moderator_dialog(\"show\",\"talk\");"; -// $data['go_to'] = $this->currPage."/".$this->lang."/".$clean['id_wiki']; + $data['md_javascript'] = "moderator_dialog(\"hide\",\"wiki_talk\");moderator_dialog(\"show\",\"wiki_talk\");"; + $data['go_to'] = $this->currPage."/".$this->lang."/".$clean['id_wiki']; $this->append($data); $this->load('talk'); + $this->load('moderator_dialog'); $this->right(); // $this->loadViewAll('talk,moderator_dialog'); } diff --git a/h-source/Application/Include/myFunctions.php b/h-source/Application/Include/myFunctions.php index 0f87893..d494eb6 100644 --- a/h-source/Application/Include/myFunctions.php +++ b/h-source/Application/Include/myFunctions.php @@ -444,6 +444,15 @@ function getHardwareInfoFromTalkId($id = 0) return $res[0]['hardware']; } +//get the wiki page info from the talk id +function getWikiPageInfoFromTalkId($id = 0) +{ + $clean['id'] = (int)$id; + $talk = new WikitalkModel(); + $res = $talk->select('wiki.id_wiki')->from('wiki inner join wiki_talk')->using('id_wiki')->where(array('id_talk'=>$clean['id']))->send(); + return $res[0]['wiki']['id_wiki']; +} + //get the issue info from the message id function getIssueNumberFromMessageId($id = 0) { @@ -465,7 +474,7 @@ function goToModeratedItem( $row = array() ) break; case 'talk': $hardInfo = getHardwareInfoFromTalkId($row['id']); - $controller = MyStrings::$reverse[$hardInfo['type']]; + $controller = Hardware::$typeToController[$hardInfo['type']]; $url = $controller.'/talk/'.Lang::$current.'/'.$hardInfo['id_hard'].'#talk-'.$row['id']; break; case 'user': @@ -474,6 +483,10 @@ function goToModeratedItem( $row = array() ) case 'issue': $url = 'issues/view/'.Lang::$current.'/'.$row['id']; break; + case 'wiki_talk': + $url = 'wiki/talk/'.Lang::$current.'/'.getWikiPageInfoFromTalkId($row['id']).'#wiki-talk-'.$row['id']; + break; + } return 'http://'.DOMAIN_NAME.'/'.$url; } diff --git a/h-source/Application/Models/WikitalkModel.php b/h-source/Application/Models/WikitalkModel.php index 2de10ba..608fbae 100644 --- a/h-source/Application/Models/WikitalkModel.php +++ b/h-source/Application/Models/WikitalkModel.php @@ -27,7 +27,7 @@ class WikitalkModel extends Model_Tree $this->_tables = 'wiki_talk'; $this->_idFields = 'id_talk'; - $this->orderBy = 'talk.id_talk'; + $this->orderBy = 'wiki_talk.id_talk'; $this->strongConditions['insert'] = array( "checkLength|99" => 'title', diff --git a/h-source/Application/Views/Issues/view.php b/h-source/Application/Views/Issues/view.php index 0af4780..bcd0265 100644 --- a/h-source/Application/Views/Issues/view.php +++ b/h-source/Application/Views/Issues/view.php @@ -223,7 +223,7 @@
- action.$queryString;?>">login + login
diff --git a/h-source/Application/Views/Issues/viewall.php b/h-source/Application/Views/Issues/viewall.php index 0374fc7..e31a7f3 100644 --- a/h-source/Application/Views/Issues/viewall.php +++ b/h-source/Application/Views/Issues/viewall.php @@ -110,7 +110,7 @@
- action.$queryString;?>">login + login
diff --git a/h-source/Application/Views/Wiki/talk.php b/h-source/Application/Views/Wiki/talk.php index 67ecbeb..9835f04 100644 --- a/h-source/Application/Views/Wiki/talk.php +++ b/h-source/Application/Views/Wiki/talk.php @@ -54,7 +54,10 @@
- + + ">hide + +
@@ -68,11 +71,48 @@
+ + +
+
wiki_talk
+ ">view details +
+
+ +
+ + +
+ this message has been deleted + + ">make visible + + +
+
wiki_talk
+ ">view details + +
+
+
+ submitted by getUser($message['wiki_talk']['created_by']));?>, +
+
+ +
+
+
+
+
+ + +
+ @@ -114,7 +154,7 @@
- action.$queryString;?>">login + login
diff --git a/h-source/Application/Views/header.php b/h-source/Application/Views/header.php index 266d97a..8686221 100644 --- a/h-source/Application/Views/header.php +++ b/h-source/Application/Views/header.php @@ -24,6 +24,7 @@ $u = new UsersModel(); $hw = new HardwareModel(); $translations = array('insert'=>'inserted','update'=>'updated'); +$currPos = $querySanitized ? $this->controller."/".$this->action : 'home/index'; ?> diff --git a/h-source/Application/Views/right.php b/h-source/Application/Views/right.php index b931151..a6c7950 100644 --- a/h-source/Application/Views/right.php +++ b/h-source/Application/Views/right.php @@ -30,8 +30,6 @@
- controller."/".$this->action : 'home/index'; ?> -