Skip to content
Snippets Groups Projects
Commit df1f587d authored by Tim Steiner's avatar Tim Steiner
Browse files

Comment system updates: editor and private comments now functional.

parent 69d21caf
No related branches found
No related tags found
No related merge requests found
......@@ -45,6 +45,7 @@ class RequestComments extends Nmc_Db_Table
$where = array();
$where[] = $db->quoteInto('request = ?', $request->getPrimaryKey());
$where[] = $db->quoteInto('postTime > ?', $time->getTimestamp());
$where[] = $db->quoteInto('visibility = ?', 'global');
$where = implode(' AND ', $where);
$rowset = $this->fetchAll($where, $order, $count, $offset);
return $rowset;
......
......@@ -92,11 +92,13 @@
<div class="tabBar">
<a href="#" id="commentsTab">Comments</a>
<a href="#" id="editorCommentsTab">Editor Comments</a>
<a href="#" id="privateCommentsTab">Private Comments</a>
</div>
<div class="tabContent" id="commentsContent">
<?php foreach ($this->comments as $comment) {
if ($comment->visibility == 'global' ||
$comment->user->getPrimaryKey() == Nmc_User::getInstance()->getUser()->getPrimaryKey()) { ?>
if ($comment->visibility == 'global') { ?>
<div class="comment">
<h3>Text:</h3>
<div><?php echo $comment->comment; ?></div>
......@@ -105,19 +107,50 @@
<form method="post" action="/Request/AddComment/<?php echo $this->request->getPrimaryKey(); ?>">
<div>
<?php echo $this->formTextarea('comment'); ?>
<textarea name="comment"></textarea>
</div>
<?php echo $this->formHidden('visibility', 'global'); ?>
<?php echo $this->formSubmit('submit', 'Add Comment'); ?>
</form>
</div>
<div class="tabContent" id="editorCommentsContent">
<?php foreach ($this->comments as $comment) {
if ($comment->visibility == 'editorial') { ?>
<div class="comment">
<h3>Text:</h3>
<div><?php echo $comment->comment; ?></div>
</div>
<?php }} ?>
<form method="post" action="/Request/AddComment/<?php echo $this->request->getPrimaryKey(); ?>">
<div>
<h3>Visibility</h3>
<?php echo $this->formRadio('visibility', null, null, array('self' => 'Self only', 'global' => 'Global')); ?>
<textarea name="comment"></textarea>
</div>
<div>
<?php echo $this->formHidden('visibility', 'editorial'); ?>
<?php echo $this->formSubmit('submit', 'Add Comment'); ?>
</div>
</form>
</div>
<div class="tabContent" id="editorCommentsContent">
EDITOR COMMENTS!
<div class="tabContent" id="privateCommentsContent">
<?php foreach ($this->comments as $comment) {
if ($comment->visibility == 'self' &&
$comment->user->getPrimaryKey() == Nmc_User::getInstance()->getUser()->getPrimaryKey()) { ?>
<div class="comment">
<h3>Text:</h3>
<div><?php echo $comment->comment; ?></div>
</div>
<?php }} ?>
<form method="post" action="/Request/AddComment/<?php echo $this->request->getPrimaryKey(); ?>">
<div>
<textarea name="comment"></textarea>
</div>
<?php echo $this->formHidden('visibility', 'self'); ?>
<?php echo $this->formSubmit('submit', 'Add Comment'); ?>
</form>
</div>
</div>
<?php } ?>
......
......@@ -77,9 +77,15 @@ div#comments {
padding: 5px;
background-color: #ddd;
border: 1px solid #888;
textarea {
width: 95%;
height: 3em;
}
}
#editorCommentsContent {
#editorCommentsContent,
#privateCommentsContent {
display: none;
}
}
......@@ -15,14 +15,18 @@ function viewRequestSelectTab()
{
var commentsContent = document.getElementById('commentsContent');
var editorCommentsContent = document.getElementById('editorCommentsContent');
var privateCommentsContent = document.getElementById('privateCommentsContent');
commentsContent.style.display = 'none';
editorCommentsContent.style.display = 'none';
privateCommentsContent.style.display = 'none';
if (this.id == 'commentsTab') {
commentsContent.style.display = 'block';
} else if (this.id == 'editorCommentsTab') {
editorCommentsContent.style.display = 'block';
} else if (this.id == 'privateCommentsTab') {
privateCommentsContent.style.display = 'block';
}
return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment