aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2011-02-15 01:11:53 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2011-02-15 01:11:53 +0000
commit8c287999487883a54271ae5e91bbb79b4fd15826 (patch)
tree27b2a78bf6cb9ffde0bd649ca97df36dc06f917b
parent1854075a62c6ca0422040b4e5ebf89088b0d02b2 (diff)
added wiki - part 2
-rw-r--r--h-source/Application/Controllers/HistoryController.php11
-rw-r--r--h-source/Application/Controllers/UsersController.php10
-rw-r--r--h-source/Application/Controllers/WikiController.php5
-rw-r--r--h-source/Application/Include/myFunctions.php15
-rw-r--r--h-source/Application/Models/WikitalkModel.php2
-rw-r--r--h-source/Application/Views/Issues/view.php2
-rw-r--r--h-source/Application/Views/Issues/viewall.php2
-rw-r--r--h-source/Application/Views/Wiki/talk.php44
-rw-r--r--h-source/Application/Views/header.php1
-rw-r--r--h-source/Application/Views/right.php2
-rw-r--r--h-source/Application/Views/talk.php2
11 files changed, 76 insertions, 20 deletions
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 @@
<?php } else { ?>
<div class="talk_login_notice">
- <a name="form"><?php echo gtext("You have to");?> <a href="<?php echo $this->baseUrl."/users/login/$lang?redirect=".$this->controller."/".$this->action.$queryString;?>">login</a> <?php echo gtext("in order to submit a message to this issue");?></a>
+ <a name="form"><?php echo gtext("You have to");?> <a href="<?php echo $this->baseUrl."/users/login/$lang?redirect=".$currPos.$queryString;?>">login</a> <?php echo gtext("in order to submit a message to this issue");?></a>
</div>
<?php } ?>
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 @@
<?php } else { ?>
<div class="talk_login_notice">
- <a name="form"><?php echo gtext("You have to");?> <a href="<?php echo $this->baseUrl."/users/login/$lang?redirect=".$this->controller."/".$this->action.$queryString;?>">login</a> <?php echo gtext("in order to submit an issue");?></a>
+ <a name="form"><?php echo gtext("You have to");?> <a href="<?php echo $this->baseUrl."/users/login/$lang?redirect=".$currPos.$queryString;?>">login</a> <?php echo gtext("in order to submit an issue");?></a>
</div>
<?php } ?>
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 @@
<div class="talk_message_item">
<div class="talk_message_item_title_date">
-
+ <?php if ($ismoderator) { ?>
+ <a id="<?php echo $message['wiki_talk']['id_talk'];?>" class="hide_wiki_talk hide_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/button_cancel.png">hide</a>
+ <?php } ?>
+
<div class="talk_message_item_title">
<?php echo $message['wiki_talk']['title'];?>
</div>
@@ -68,11 +71,48 @@
<?php echo decodeWikiText($message['wiki_talk']['message']);?>
</div>
+ <?php if ($ismoderator) { ?>
+ <!--view details-->
+ <div class="show_hidden_box_ext">
+ <div class="md_type">wiki_talk</div>
+ <a id="<?php echo $message['wiki_talk']['id_talk'];?>" class="hidden_message_view_details" href="<?php echo $this->baseUrl."/home/index/$lang";?>">view details</a>
+ <div class="moderation_details_box"></div>
+ </div>
+ <?php } ?>
+
</div>
<?php } else { ?>
+ <?php if ($ismoderator) { ?>
+ <a name="wiki-talk-<?php echo $message['wiki_talk']['id_talk'];?>"></a>
+ <div class="talk_message_item_hidden">
+ this message has been deleted
+
+ <a id="<?php echo $message['wiki_talk']['id_talk'];?>" class="show_wiki_talk hide_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/button_ok.png">make visible</a>
+
+ <!--view details-->
+ <div class="show_hidden_box_ext">
+ <div class="md_type">wiki_talk</div>
+ <a id="<?php echo $message['wiki_talk']['id_talk'];?>" class="hidden_message_view_details" href="<?php echo $this->baseUrl."/home/index/$lang";?>">view details</a>
+
+ <div class="details_of_hidden_message">
+ <div class="details_of_hidden_message_inner">
+ <div class="talk_message_item_date">
+ submitted by <?php echo getLinkToUser($u->getUser($message['wiki_talk']['created_by']));?>, <?php echo smartDate($message['wiki_talk']['creation_date']);?>
+ </div>
+ <div class="message_view_description_hidden">
+ <?php echo decodeWikiText($message['wiki_talk']['message']);?>
+ </div>
+ </div>
+ <div class="moderation_details_box"></div>
+ </div>
+ </div>
+
+
+ </div>
+ <?php } ?>
<?php } ?>
@@ -114,7 +154,7 @@
<?php } else { ?>
<div class="talk_login_notice">
- <a name="form"><?php echo gtext("You have to");?> <a href="<?php echo $this->baseUrl."/users/login/$lang?redirect=".$this->controller."/".$this->action.$queryString;?>">login</a> <?php echo gtext("in order to add a message");?></a>
+ <a name="form"><?php echo gtext("You have to");?> <a href="<?php echo $this->baseUrl."/users/login/$lang?redirect=".$currPos.$queryString;?>">login</a> <?php echo gtext("in order to add a message");?></a>
</div>
<?php } ?>
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';
?>
<head>
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 @@
<div class="login_table_box">
- <?php $currPos = $querySanitized ? $this->controller."/".$this->action : 'home/index'; ?>
-
<?php if ($islogged === 'yes') { ?>
<div class="login_box_logged">
<div class="who_you_are_and_logout">
diff --git a/h-source/Application/Views/talk.php b/h-source/Application/Views/talk.php
index a5de7d9..f578f8e 100644
--- a/h-source/Application/Views/talk.php
+++ b/h-source/Application/Views/talk.php
@@ -140,7 +140,7 @@
<?php } else { ?>
<div class="talk_login_notice">
- <a name="form"><?php echo gtext("You have to");?> <a href="<?php echo $this->baseUrl."/users/login/$lang?redirect=".$this->controller."/".$this->action.$queryString;?>">login</a> <?php echo gtext("in order to add a message");?></a>
+ <a name="form"><?php echo gtext("You have to");?> <a href="<?php echo $this->baseUrl."/users/login/$lang?redirect=".$currPos.$queryString;?>">login</a> <?php echo gtext("in order to add a message");?></a>
</div>
<?php } ?> \ No newline at end of file