diff --git a/application/models/tables/RequestComments.php b/application/models/tables/RequestComments.php index 0ab512e63d5a00f0c9af2c34daefeb5e11c3c867..e28538286b5236eabeb778ec080a0cb0a08b046d 100644 --- a/application/models/tables/RequestComments.php +++ b/application/models/tables/RequestComments.php @@ -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; diff --git a/application/views/request/view.xhtml b/application/views/request/view.xhtml index 0c2bb23dcf16e0f65b0318a8748c45498c56d6c2..9e22c6cc616e93107071cad3406061b1cd24cd45 100644 --- a/application/views/request/view.xhtml +++ b/application/views/request/view.xhtml @@ -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 } ?> diff --git a/document_root/css/request/view.oss b/document_root/css/request/view.oss index b8d7678a433fdd5672fd9b793ff86b7ccd574835..0e197dda1e3d232ab4b8b83f61f80cad8964e8d6 100644 --- a/document_root/css/request/view.oss +++ b/document_root/css/request/view.oss @@ -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; } } diff --git a/document_root/javascript/request/view.js b/document_root/javascript/request/view.js index b0b88f81719bf2a42adf7c6ae67f5bbebd2987ba..b0d01824750ec0b3622268c745c1fb30fb79f584 100644 --- a/document_root/javascript/request/view.js +++ b/document_root/javascript/request/view.js @@ -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;