diff --git a/application/controllers/RequestController.php b/application/controllers/RequestController.php index 772c8c0f9149b53960ce76b36f4c734151b56473..f36e7dcdeaa06b0b7467519a90cd23d184f24f71 100755 --- a/application/controllers/RequestController.php +++ b/application/controllers/RequestController.php @@ -261,6 +261,7 @@ class RequestController extends Nmc_Controller_Action } $view = new Application_View(); + $view->selectedCommentTab = Nmc_Registry_Session::getInstance('comments')->selectedTab; $view->page = 'request/view'; $view->request = $request; $view->currentGeneration = $currentGeneration; @@ -276,6 +277,13 @@ class RequestController extends Nmc_Controller_Action $out->setBody($view->render('unlModernWrapper.xhtml')); } + public function setCommentTabAction() + { + $in = $this->getRequest(); + $tab = $in->getParam(0); + Nmc_Registry_Session::getInstance('comments')->selectedTab = $tab; + } + public function addCommentAction() { $in = $this->getRequest(); diff --git a/application/views/request/view.xhtml b/application/views/request/view.xhtml index cc00dd0a35e86490060c9a34c51b71e0ce80899e..0769e0f1c5a98a357bee6a6efa45061ed17334a9 100644 --- a/application/views/request/view.xhtml +++ b/application/views/request/view.xhtml @@ -120,15 +120,21 @@ </form> <?php } else { ?> + <?php + if (!in_array($this->selectedCommentTab, array('commentsTab', 'editorsCommentsTab', 'privateCommentsTab'))) { + $this->selectedCommentTab = 'commentsTab'; + } + ?> + <div id="comments"> <div class="tabBar"> - <a href="#" id="commentsTab" class="selected">Comments</a> - <a href="#" id="editorCommentsTab">Editor Comments</a> - <a href="#" id="privateCommentsTab">Private Comments</a> + <a href="#" id="commentsTab"<?php if ($this->selectedCommentTab == 'commentsTab') { ?> class="selected"<?php } ?>>Comments</a> + <a href="#" id="editorCommentsTab"<?php if ($this->selectedCommentTab == 'editorCommentsTab') { ?> class="selected"<?php } ?>>Editor Comments</a> + <a href="#" id="privateCommentsTab"<?php if ($this->selectedCommentTab == 'privateCommentsTab') { ?> class="selected"<?php } ?>>Private Comments</a> </div> - <div class="tabContent" id="commentsContent"> + <div class="tabContent<?php if ($this->selectedCommentTab == 'commentsTab') { ?> selected<?php } ?>" id="commentsContent"> <table class="comments"> <tr> <th class="who">Who</th> @@ -155,7 +161,7 @@ </div> - <div class="tabContent" id="editorCommentsContent"> + <div class="tabContent<?php if ($this->selectedCommentTab == 'editorCommentsTab') { ?> selected<?php } ?>" id="editorCommentsContent"> <table class="comments"> <tr> <th class="who">Who</th> @@ -182,7 +188,7 @@ </div> - <div class="tabContent" id="privateCommentsContent"> + <div class="tabContent<?php if ($this->selectedCommentTab == 'privateCommentsTab') { ?> selected<?php } ?>" id="privateCommentsContent"> <table class="comments"> <tr> <th class="who">Who</th> diff --git a/document_root/css/request/view.oss b/document_root/css/request/view.oss index 099f22d2bd2c3292d78a43f4ff1d6b6a8dd20c5a..5c186abc4cf153bcec436fda8be39981eaf4bd0f 100644 --- a/document_root/css/request/view.oss +++ b/document_root/css/request/view.oss @@ -82,6 +82,7 @@ div#comments { } .tabContent { + display: none; clear: both; padding: 5px; background-color: #ddd; @@ -93,6 +94,10 @@ div#comments { } } + .tabContent.selected { + display: block + } + table.comments { width: 100%; @@ -122,11 +127,6 @@ div#comments { } } - - #editorCommentsContent, - #privateCommentsContent { - display: none; - } } #prevRequestLink { diff --git a/document_root/javascript/request/view.js b/document_root/javascript/request/view.js index f458b12db20e6fd753ac160c405f074e49e44e83..1789a4e1d03de49a3133e95d852126c4b14e1a39 100644 --- a/document_root/javascript/request/view.js +++ b/document_root/javascript/request/view.js @@ -30,6 +30,8 @@ function viewRequestSelectTab() privateCommentsTab.className = ''; this.className = 'selected'; + var ajax = new AjaxClient(); + ajax.sendRequest('/Request/SetCommentTab/' + this.id); if (this.id == 'commentsTab') { commentsContent.style.display = 'block';