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