[Notice] Announcing the End of Demo Server [Read me]

HIVE-190 adding posts and issues view page for site admin
@e1c87ce2a79897fcbd7ec93c193f206dae525da5
--- app/controllers/SiteApp.java
+++ app/controllers/SiteApp.java
... | ... | @@ -1,37 +1,23 @@ |
1 | 1 |
package controllers; |
2 | 2 |
|
3 |
-import java.util.ArrayList; |
|
4 |
-import java.util.List; |
|
5 |
-import java.util.Map; |
|
6 |
-import java.util.Set; |
|
7 |
-import java.util.HashSet; |
|
8 |
- |
|
9 |
-import models.ProjectUser; |
|
10 |
-import org.apache.commons.mail.*; |
|
11 |
- |
|
12 |
-import models.Project; |
|
13 |
-import models.User; |
|
3 |
+import com.avaje.ebean.Page; |
|
4 |
+import info.schleichardt.play2.mailplugin.Mailer; |
|
5 |
+import models.*; |
|
6 |
+import org.apache.commons.mail.EmailException; |
|
14 | 7 |
import org.apache.commons.mail.SimpleEmail; |
15 |
-import org.codehaus.jackson.JsonNode; |
|
16 | 8 |
import play.Configuration; |
17 | 9 |
import play.Logger; |
10 |
+import play.i18n.Messages; |
|
18 | 11 |
import play.mvc.Controller; |
19 | 12 |
import play.mvc.Http; |
20 | 13 |
import play.mvc.Result; |
21 | 14 |
import utils.Constants; |
15 |
+import views.html.site.*; |
|
22 | 16 |
|
23 |
-import views.html.site.setting; |
|
24 |
-import views.html.site.mail; |
|
25 |
-import views.html.site.massMail; |
|
26 |
-import views.html.site.userList; |
|
27 |
-import views.html.site.projectList; |
|
17 |
+import java.util.*; |
|
28 | 18 |
|
29 |
-import com.avaje.ebean.Page; |
|
30 | 19 |
import static play.data.Form.form; |
31 | 20 |
import static play.libs.Json.toJson; |
32 |
-import play.i18n.Messages; |
|
33 |
- |
|
34 |
-import info.schleichardt.play2.mailplugin.Mailer; |
|
35 | 21 |
|
36 | 22 |
public class SiteApp extends Controller { |
37 | 23 |
public static Result sendMail() throws EmailException{ |
... | ... | @@ -86,16 +72,26 @@ |
86 | 72 |
public static Result setting() { |
87 | 73 |
return ok(setting.render("title.siteSetting")); |
88 | 74 |
} |
89 |
- |
|
75 |
+ |
|
90 | 76 |
public static Result userList(int pageNum, String loginId) { |
91 | 77 |
return ok(userList.render("title.siteSetting", User.findUsers(pageNum, loginId))); |
92 | 78 |
} |
93 |
- |
|
79 |
+ |
|
80 |
+ public static Result postList(int pageNum) { |
|
81 |
+ Page<Posting> page = Posting.finder.order("createdDate DESC").findPagingList(30).getPage(pageNum - 1); |
|
82 |
+ return ok(postList.render("title.siteSetting", page)); |
|
83 |
+ } |
|
84 |
+ |
|
85 |
+ public static Result issueList(int pageNum) { |
|
86 |
+ Page<Issue> page = Issue.finder.order("createdDate DESC").findPagingList(30).getPage(pageNum - 1); |
|
87 |
+ return ok(issueList.render("title.siteSetting", page)); |
|
88 |
+ } |
|
89 |
+ |
|
94 | 90 |
public static Result searchUser() { |
95 | 91 |
String loginId = form(User.class).bindFromRequest().get().loginId; |
96 | 92 |
return redirect(routes.SiteApp.userList(0, loginId)); |
97 | 93 |
} |
98 |
- |
|
94 |
+ |
|
99 | 95 |
public static Result deleteUser(Long userId) { |
100 | 96 |
if( User.findByLoginId(session().get("loginId")).isSiteManager() ){ |
101 | 97 |
if(Project.isOnlyManager(userId).size() == 0) |
... | ... | @@ -108,12 +104,12 @@ |
108 | 104 |
|
109 | 105 |
return redirect(routes.SiteApp.userList(0, null)); |
110 | 106 |
} |
111 |
- |
|
107 |
+ |
|
112 | 108 |
public static Result projectList(String filter) { |
113 | 109 |
Page<Project> projects = Project.findByName(filter, 25, 0); |
114 | 110 |
return ok(projectList.render("title.projectList", projects, filter)); |
115 | 111 |
} |
116 |
- |
|
112 |
+ |
|
117 | 113 |
public static Result deleteProject(Long projectId){ |
118 | 114 |
if( User.findByLoginId(session().get("loginId")).isSiteManager() ){ |
119 | 115 |
Project.find.byId(projectId).delete(); |
... | ... | @@ -122,7 +118,7 @@ |
122 | 118 |
} |
123 | 119 |
return redirect(routes.SiteApp.projectList("")); |
124 | 120 |
} |
125 |
- |
|
121 |
+ |
|
126 | 122 |
public static Result softwareMap() { |
127 | 123 |
return TODO; |
128 | 124 |
} |
--- app/models/Attachment.java
+++ app/models/Attachment.java
... | ... | @@ -88,6 +88,12 @@ |
88 | 88 |
.eq("containerId", containerId).findList(); |
89 | 89 |
} |
90 | 90 |
|
91 |
+ public static int countByContainer(ResourceType containerType, Long containerId) { |
|
92 |
+ return find.where() |
|
93 |
+ .eq("containerType", containerType) |
|
94 |
+ .eq("containerId", containerId).findRowCount(); |
|
95 |
+ } |
|
96 |
+ |
|
91 | 97 |
public static List<Attachment> findByContainer(Resource resource) { |
92 | 98 |
return findByContainer(resource.getType(), resource.getId()); |
93 | 99 |
} |
+++ app/views/site/issueList.scala.html
... | ... | @@ -0,0 +1,40 @@ |
1 | +@(message: String, currentPage: com.avaje.ebean.Page[Issue]) | |
2 | + | |
3 | +@siteMngMain(message) { | |
4 | + <h2>@Messages("site.sidebar.issueList")</h2> | |
5 | + | |
6 | + <div class="row-fluid"> | |
7 | + <table class="table table-striped table-condensed"> | |
8 | + <thead> | |
9 | + <tr> | |
10 | + <th>@Messages("project.name")</th> | |
11 | + <th>@Messages("issue.author")</th> | |
12 | + <th>@Messages("issue.title")</th> | |
13 | + <th>@Messages("issue.createdDate")</th> | |
14 | + <th>@Messages("issue.attachment")</th> | |
15 | + <th>@Messages("issue.numOfComments")</th> | |
16 | + </tr> | |
17 | + </thead> | |
18 | + <tbody> | |
19 | + @for(issue <- currentPage.getList()) { | |
20 | + @issuelisting(issue) | |
21 | + } | |
22 | + </tbody> | |
23 | + </table> | |
24 | + </div> | |
25 | + | |
26 | + <div class="row-fluid"> | |
27 | + <center>@pagination(currentPage, 5, "pagination", "/sites/issueList")</center> | |
28 | + </div> | |
29 | +} | |
30 | + | |
31 | +@issuelisting(issue: models.Issue) = { | |
32 | + <tr> | |
33 | + <td>@issue.project.name</td> | |
34 | + <td>@issue.authorName</td> | |
35 | + <td><a href="@routes.BoardApp.post(issue.project.owner, issue.project.name, issue.id)">@issue.title</a></td> | |
36 | + <td>@utils.TemplateHelper.agoString(issue.ago())</td> | |
37 | + <td>@models.Attachment.countByContainer(models.enumeration.ResourceType.ISSUE_POST, issue.id)</td> | |
38 | + <td>@issue.numOfComments</td> | |
39 | + </tr> | |
40 | +}(파일 끝에 줄바꿈 문자 없음) |
+++ app/views/site/pagination.scala.html
... | ... | @@ -0,0 +1,46 @@ |
1 | +@(page:com.avaje.ebean.Page[_ <: play.db.ebean.Model], pageNum:Int, divId:String, listUrl:String) | |
2 | + | |
3 | +@{ | |
4 | + var currentPageNum = page.getPageIndex + 1 | |
5 | + var lastPageNum = page.getTotalPageCount() | |
6 | + var str = "" | |
7 | + | |
8 | + if(currentPageNum <= pageNum/2) { | |
9 | + currentPageNum = pageNum/2 +1 | |
10 | + } else if(currentPageNum > lastPageNum - pageNum/2) { | |
11 | + currentPageNum = lastPageNum - pageNum/2 - 1 | |
12 | + } | |
13 | + makeList(currentPageNum) | |
14 | +} | |
15 | +@makeList(currentPageNum:Int) = { | |
16 | + <div class='pagination' id="@divId"><ul> | |
17 | + @if(page.hasPrev){ | |
18 | + @makeLink("Prev", page.getPageIndex) | |
19 | + } else { | |
20 | + <li class="disabled"><a>Prev</a></li> | |
21 | + } | |
22 | + | |
23 | + @if(page.getTotalPageCount() < pageNum) { | |
24 | + @for(x <- (1 to page.getTotalPageCount())){ | |
25 | + @makeLink(x + "", x) | |
26 | + } | |
27 | + } else { | |
28 | + @for( x <- (currentPageNum - pageNum/2 to currentPageNum + pageNum/2)){ | |
29 | + @makeLink(x + "", x) | |
30 | + } | |
31 | + } | |
32 | + | |
33 | + | |
34 | + @if(page.hasNext) { | |
35 | + @makeLink("Next",page.getPageIndex + 2) | |
36 | + } else { | |
37 | + <li class="disabled"><a>Next</a></li> | |
38 | + } | |
39 | + | |
40 | + </ul></div> | |
41 | +} | |
42 | +@makeLink(title:String, index:Int) = { | |
43 | + <li class="@if((page.getPageIndex + 1).equals(index)){active}"> | |
44 | + <a href="@(listUrl + "?pageNum=" + index)" pageNum="@index">@title</a> | |
45 | + </li> | |
46 | +}(파일 끝에 줄바꿈 문자 없음) |
+++ app/views/site/postList.scala.html
... | ... | @@ -0,0 +1,40 @@ |
1 | +@(message: String, currentPage: com.avaje.ebean.Page[Posting]) | |
2 | + | |
3 | +@siteMngMain(message) { | |
4 | + <h2>@Messages("site.sidebar.postList")</h2> | |
5 | + | |
6 | + <div class="row-fluid"> | |
7 | + <table class="table table-striped table-condensed"> | |
8 | + <thead> | |
9 | + <tr> | |
10 | + <th>@Messages("project.name")</th> | |
11 | + <th>@Messages("post.author")</th> | |
12 | + <th>@Messages("post.title")</th> | |
13 | + <th>@Messages("post.createdDate")</th> | |
14 | + <th>@Messages("post.attachment")</th> | |
15 | + <th>@Messages("post.numOfComments")</th> | |
16 | + </tr> | |
17 | + </thead> | |
18 | + <tbody> | |
19 | + @for(post <- currentPage.getList()) { | |
20 | + @postlisting(post) | |
21 | + } | |
22 | + </tbody> | |
23 | + </table> | |
24 | + </div> | |
25 | + | |
26 | + <div class="row-fluid"> | |
27 | + <center>@pagination(currentPage, 5, "pagination", "/sites/postList")</center> | |
28 | + </div> | |
29 | +} | |
30 | + | |
31 | +@postlisting(post: models.Posting) = { | |
32 | + <tr> | |
33 | + <td>@post.project.name</td> | |
34 | + <td>@post.authorName</td> | |
35 | + <td><a href="@routes.BoardApp.post(post.project.owner, post.project.name, post.id)">@post.title</a></td> | |
36 | + <td>@utils.TemplateHelper.agoString(post.ago())</td> | |
37 | + <td>@models.Attachment.countByContainer(models.enumeration.ResourceType.BOARD_POST, post.id)</td> | |
38 | + <td>@post.numOfComments</td> | |
39 | + </tr> | |
40 | +}(파일 끝에 줄바꿈 문자 없음) |
--- app/views/site/projectList.scala.html
+++ app/views/site/projectList.scala.html
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 |
<button type="submit" class="btn">검색</button> |
8 | 8 |
</form> |
9 | 9 |
</div> |
10 |
- |
|
10 |
+ |
|
11 | 11 |
<div class="row-fluid"> |
12 | 12 |
<table class="table table-striped table-condensed"> |
13 | 13 |
<thead> |
... | ... | @@ -24,9 +24,9 @@ |
24 | 24 |
<td>@project.owner</td> |
25 | 25 |
<td> |
26 | 26 |
<a class="btn btn-danger" data-toggle="modal" href="#alertDeletion@project.id">@Messages("button.delete")</a> |
27 |
- </td> |
|
27 |
+ </td> |
|
28 | 28 |
</tr> |
29 |
- |
|
29 |
+ |
|
30 | 30 |
<div class="modal hide" id="alertDeletion@project.id"> |
31 | 31 |
<div class="modal-header"> |
32 | 32 |
<button type="button" class="close" data-dismiss="modal">×</button> |
... | ... | @@ -44,7 +44,7 @@ |
44 | 44 |
</tbody> |
45 | 45 |
</table> |
46 | 46 |
</div> |
47 |
- |
|
47 |
+ |
|
48 | 48 |
<div class="row-fluid"> |
49 | 49 |
<center>@paginationForUserList(currentPage, 5, "pagination")</center> |
50 | 50 |
</div> |
--- conf/messages.en
+++ conf/messages.en
... | ... | @@ -62,7 +62,7 @@ |
62 | 62 |
label.confirm.delete = Are you Sure? |
63 | 63 |
label.select = Select Label |
64 | 64 |
label.error.duplicated = Failed to create new label. It might be same label exists already. |
65 |
-label.error.creationFailed = Failed to create new label. It might be server error or your request is invalid. |
|
65 |
+label.error.creationFailed = Failed to create new label. It might be server error or your request is invalid. |
|
66 | 66 |
|
67 | 67 |
order.all = All |
68 | 68 |
order.date = Date |
... | ... | @@ -116,7 +116,7 @@ |
116 | 116 |
milestone.form.dueDate = Choose due date |
117 | 117 |
milestone.error.title = Title is required |
118 | 118 |
milestone.error.content = Description is required |
119 |
-milestone.error.duedateFormat = Invalid format of due date (YYYY-MM-DD) |
|
119 |
+milestone.error.duedateFormat = Invalid format of due date (YYYY-MM-DD) |
|
120 | 120 |
|
121 | 121 |
#Issue |
122 | 122 |
issue.state.unit = issues |
... | ... | @@ -192,7 +192,11 @@ |
192 | 192 |
issue.downloadAsExcel = Download as Excel |
193 | 193 |
issue.search = SEARCH |
194 | 194 |
issue.error.emptyTitle = Title of this issue is required |
195 |
-issue.error.emptyBody = Description about this issue is required |
|
195 |
+issue.error.emptyBody = Description about this issue is required |
|
196 |
+issue.title = Title |
|
197 |
+issue.createdDate = Created Date |
|
198 |
+issue.attachment = Attachment |
|
199 |
+issue.numOfComments = Comment Count |
|
196 | 200 |
|
197 | 201 |
#Post |
198 | 202 |
post.new = New |
... | ... | @@ -210,6 +214,10 @@ |
210 | 214 |
post.popup.fileAttach.contents = Please, select file to attach |
211 | 215 |
post.edit.rejectNotAuthor = You don't have permisstion to access. |
212 | 216 |
post.update.error = Errors on Input Value |
217 |
+post.title = Title |
|
218 |
+post.createdDate = Created Date |
|
219 |
+post.attachment = Attachment |
|
220 |
+post.numOfComments = Comment Count |
|
213 | 221 |
|
214 | 222 |
#Project |
215 | 223 |
project.myproject = MY PROJECTS |
... | ... | @@ -278,6 +286,8 @@ |
278 | 286 |
site.sidebar = Site Management |
279 | 287 |
site.sidebar.setting = Site Setting |
280 | 288 |
site.sidebar.userList = Users |
289 |
+site.sidebar.postList = Posts |
|
290 |
+site.sidebar.issueList = Issues |
|
281 | 291 |
site.sidebar.projectList = Projects |
282 | 292 |
site.sidebar.softwareMap = Software Map |
283 | 293 |
site.sidebar.mailSend = Send a Email |
... | ... | @@ -398,7 +408,7 @@ |
398 | 408 |
none = None |
399 | 409 |
comment = Comment |
400 | 410 |
noAssignee = No Assignee |
401 |
-noMilestone = No Milestone |
|
411 |
+noMilestone = No Milestone |
|
402 | 412 |
|
403 | 413 |
#validation |
404 | 414 |
validation.tooShortPassword = The password field must be at least 4 characters in length. |
--- conf/messages.ko
+++ conf/messages.ko
... | ... | @@ -64,7 +64,7 @@ |
64 | 64 |
label.confirm.delete = 라벨을 삭제하면 이슈에 지정한 라벨도 함께 제거됩니다. 정말 삭제하시겠습니까? |
65 | 65 |
label.select = 라벨 선택 |
66 | 66 |
label.error.duplicated = 라벨 생성에 실패했습니다.\n이미 동일한 라벨이 존재할지도 모릅니다. |
67 |
-label.error.creationFailed = 라벨 생성에 실패했습니다.\n서버에 문제가 있거나 올바른 요청이 아닐 수 있습니다. |
|
67 |
+label.error.creationFailed = 라벨 생성에 실패했습니다.\n서버에 문제가 있거나 올바른 요청이 아닐 수 있습니다. |
|
68 | 68 |
|
69 | 69 |
order.all = 전체 |
70 | 70 |
order.date = 날짜순 |
... | ... | @@ -121,7 +121,7 @@ |
121 | 121 |
milestone.form.dueDate = 완료일을 선택하세요 |
122 | 122 |
milestone.error.title = 마일스톤 제목을 입력해주세요 |
123 | 123 |
milestone.error.content = 마일스톤 내용을 입력해주세요 |
124 |
-milestone.error.duedateFormat = 완료일 형식이 잘못되었습니다. YYYY-MM-DD 형식으로 입력해주세요. |
|
124 |
+milestone.error.duedateFormat = 완료일 형식이 잘못되었습니다. YYYY-MM-DD 형식으로 입력해주세요. |
|
125 | 125 |
|
126 | 126 |
#Issue |
127 | 127 |
issue.state.unit = 이슈 |
... | ... | @@ -198,7 +198,11 @@ |
198 | 198 |
issue.downloadAsExcel = 엑셀파일로 다운받기 |
199 | 199 |
issue.search = 검색 |
200 | 200 |
issue.error.emptyTitle = 이슈 제목을 입력해주세요 |
201 |
-issue.error.emptyBody = 이슈 내용을 입력해주세요 |
|
201 |
+issue.error.emptyBody = 이슈 내용을 입력해주세요 |
|
202 |
+issue.title = 제목 |
|
203 |
+issue.createdDate = 작성일 |
|
204 |
+issue.attachment = 첨부파일 |
|
205 |
+issue.numOfComments = 댓글개수 |
|
202 | 206 |
|
203 | 207 |
#Post |
204 | 208 |
post.new = 새글 |
... | ... | @@ -216,6 +220,10 @@ |
216 | 220 |
post.popup.fileAttach.contents = 첨부할 파일을 선택해주세요. |
217 | 221 |
post.edit.rejectNotAuthor = 글쓴이가 아닙니다. |
218 | 222 |
post.update.error = 입력값 오류 |
223 |
+post.title = 제목 |
|
224 |
+post.createdDate = 작성일 |
|
225 |
+post.attachment = 첨부파일 |
|
226 |
+post.numOfComments = 댓글개수 |
|
219 | 227 |
|
220 | 228 |
#Project |
221 | 229 |
project.myproject = 내 프로젝트 |
... | ... | @@ -284,7 +292,9 @@ |
284 | 292 |
#Site |
285 | 293 |
site.sidebar = 사이트 관리 |
286 | 294 |
site.sidebar.setting = 설정 |
287 |
-site.sidebar.userList = 유저 관리 |
|
295 |
+site.sidebar.userList = 유저 |
|
296 |
+site.sidebar.postList = 게시물 |
|
297 |
+site.sidebar.issueList = 이슈 |
|
288 | 298 |
site.sidebar.projectList = 프로젝트 설정 |
289 | 299 |
site.sidebar.softwareMap = 소프트웨어 맵 |
290 | 300 |
site.sidebar.mailSend = 메일 발송 |
... | ... | @@ -406,7 +416,7 @@ |
406 | 416 |
none = 없음 |
407 | 417 |
comment = 댓글 |
408 | 418 |
noAssignee = 담당자 없음 |
409 |
-noMilestone = 마일스톤 없음 |
|
419 |
+noMilestone = 마일스톤 없음 |
|
410 | 420 |
|
411 | 421 |
#validation |
412 | 422 |
validation.tooShortPassword = 비밀번호를 4자 이상으로 만들어 주세요! |
--- conf/routes
+++ conf/routes
... | ... | @@ -47,6 +47,9 @@ |
47 | 47 |
POST /lostPassword controllers.PasswordResetApp.requestResetPasswordEmail() |
48 | 48 |
GET /resetPassword controllers.PasswordResetApp.resetPasswordForm(s:String) |
49 | 49 |
POST /resetPassword controllers.PasswordResetApp.resetPassword() |
50 |
+GET /sites/postList controllers.SiteApp.postList(pageNum: Int ?= 1) |
|
51 |
+GET /sites/issueList controllers.SiteApp.issueList(pageNum: Int ?= 1) |
|
52 |
+ |
|
50 | 53 |
|
51 | 54 |
# Attachments |
52 | 55 |
GET /files controllers.AttachmentApp.getFileList() |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?