git-svn-id: svn://svn.dsv.su.se/scipro/scipro/trunk@529 73ecded7-942e-4092-bab0-0e58ef0ee984
This commit is contained in:
joha-asc 2011-03-30 11:31:31 +00:00
parent b8c0baad2f
commit 73d66ffdf8
2 changed files with 18 additions and 14 deletions
src/main/java/se/su/dsv/scipro/commentthread/panel

@ -5,29 +5,32 @@
</head>
<body>
<wicket:panel>
<h3>Comments</h3>
<div class="margin comments-border"><h3>Comments</h3></div>
<div wicket:id="container">
<table wicket:id="comment" class="comment-border" >
<tr>
<td>
<div><a href="#" wicket:id="editComment"><img src="images/icons/edit_16x16.png" class="icon-24" alt="Edit"/></a>
<a href="#" wicket:id="deleteComment"><img src="images/icons/delete_16x16.png" class="icon-24" alt="Delete"/></a></div>
<div class="smaller"><strong>Created: </strong> <span wicket:id="date"></span></div>
<div class="smaller"><strong>Last Modified: </strong> <span wicket:id="dateModified"></span></div>
<div class="smaller">
<strong>Created: </strong>
<span wicket:id="date"></span>
<span class="comment-icon"><a href="#" wicket:id="editComment"><img src="images/icons/edit_16x16.png" " alt="Edit" title="Edit"/></a>
<a href="#" wicket:id="deleteComment"><img src="images/icons/delete_16x16.png" alt="Delete" title="Delete"/></a></span>
</div>
<div class="smaller"><strong>Created by: </strong> <span wicket:id="from"></span></div>
<div wicket:id="message" class = "comment-margin"></div>
<div wicket:id="message" class = "comment-margin"></div>
</td>
</tr>
</table>
<div wicket:id="navigator"></div>
<div wicket:id="navigator" class="navigator"></div>
</div>
<form wicket:id="commentForm">
<form wicket:id="commentForm" class="write-comment-border">
<div><strong>Write comment:</strong></div>
<div><textarea wicket:id="textMessage" ></textarea></div>
<div><input type="submit" wicket:id="submitButton" /> </div>

@ -108,8 +108,6 @@ public class CommentThreadPanel extends Panel {
final Comment c = item.getModelObject();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
item.add(new Label("date", df.format(c.getDateCreated())));
item.add(new Label("dateModified", df.format(c
.getLastModified())));
item.add(new Label("from", c.getCreator().getFirstName() + " "
+ c.getCreator().getLastName()));
item.add(new MultiLineLabel("message", new Model(c.getComment())).setEnabled(false));
@ -267,9 +265,12 @@ public class CommentThreadPanel extends Panel {
Form<?> form) {
editComment = commentDao.reLoad(editComment);
User user = userDao.load(SciProSession.get().getUser().getId());
editComment.setLastModified(new Date());
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date();
editComment.setComment(((CommentThreadModel) form
.getModelObject()).getEditTextMessage() + "\n\nLast edited by: " + user.getFirstName() + " " + user.getLastName());
editComment.setLastModified(new Date());
.getModelObject()).getEditTextMessage() + "\n\nLast edited: " +df.format(date) + " by: " + user.getFirstName() + " " + user.getLastName()) ;
editComment.setLastModified(date);
commentDao.save(editComment);