From 5b43f45c342f205bc0e99ad0df397f7246253311 Mon Sep 17 00:00:00 2001 From: koda Date: Sun, 10 May 2015 10:57:04 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=87=E3=83=BC=E3=82=BF=E3=81=AE=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E5=85=88=E3=82=92=E5=A4=89=E6=9B=B4=20#32=20=20=20=20?= =?UTF-8?q?->=20.knowledge=E3=83=87=E3=82=A3=E3=83=AC=E3=82=AF=E3=83=88?= =?UTF-8?q?=E3=83=AA=E3=81=A7=E3=81=AF=E3=81=AA=E3=81=8F=E3=80=81=E7=92=B0?= =?UTF-8?q?=E5=A2=83=E5=A4=89=E6=95=B0=E3=81=AE=E7=9B=B4=E4=B8=8B=E3=81=AB?= =?UTF-8?q?=E3=83=87=E3=83=BC=E3=82=BF=E3=82=92=E6=A0=BC=E7=B4=8D=20GitHub?= =?UTF-8?q?=E3=81=AE=E7=B5=B5=E6=96=87=E5=AD=97=E3=81=AB=E5=AF=BE=E5=BF=9C?= =?UTF-8?q?=E3=81=97=E3=81=A6=E3=82=82=E3=82=89=E3=81=88=E3=82=8B=E3=81=A8?= =?UTF-8?q?=E5=AC=89=E3=81=97=E3=81=84=20#33=20=E3=82=B3=E3=83=A1=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=81=A7=E3=82=82markdown=E3=82=92=E4=BD=BF=E3=81=88?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=99=E3=82=8B=20#37=20?= =?UTF-8?q?=E3=83=97=E3=83=AC=E3=83=93=E3=83=A5=E3=83=BC=E6=99=82=E3=81=A8?= =?UTF-8?q?=E5=AE=9F=E9=9A=9B=E3=81=AE=E8=A1=A8=E7=A4=BA=E3=81=8C=E7=95=B0?= =?UTF-8?q?=E3=81=AA=E3=82=8B=20#20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bower.json | 3 ++- .../project/knowledge/dao/TagsDao.java | 4 ++++ .../project/knowledge/logic/DiffLogic.java | 6 ++++-- .../project/knowledge/logic/TagLogic.java | 16 +++++++++++++- src/main/resources/appresource.properties | 2 +- src/main/resources/appresource_ja.properties | 2 +- src/main/webapp/WEB-INF/views/index/index.jsp | 1 + .../WEB-INF/views/open/knowledge/view.jsp | 1 + .../views/protect/knowledge/view_add.jsp | 1 + .../views/protect/knowledge/view_edit.jsp | 1 + src/main/webapp/css/markdown.css | 5 +++++ src/main/webapp/js/knowledge-edit.js | 9 +++++--- src/main/webapp/js/knowledge-view.js | 21 ++++++++++++++++++- 13 files changed, 62 insertions(+), 10 deletions(-) diff --git a/bower.json b/bower.json index 2eab390ae..a42e7a063 100644 --- a/bower.json +++ b/bower.json @@ -13,7 +13,8 @@ "jquery-file-upload": "9.8.1", "teambox.free-file-icons": "teambox/Free-file-icons", "echojs": "1.6.0", - "notify.js": "1.2.5" + "notify.js": "1.2.5", + "emoji-parser": "0.1.1" }, "devDependencies": {} } diff --git a/src/main/java/org/support/project/knowledge/dao/TagsDao.java b/src/main/java/org/support/project/knowledge/dao/TagsDao.java index 167daed23..a79b2b3fd 100644 --- a/src/main/java/org/support/project/knowledge/dao/TagsDao.java +++ b/src/main/java/org/support/project/knowledge/dao/TagsDao.java @@ -93,6 +93,7 @@ public List selectTagsWithCount(int offset, int limit) { * @param offset * @param limit * @return + * @deprecated */ public List selectTagsWithCountOnUser(int userid, int offset, int limit) { String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/TagsDao/TagsDao_selectTagsWithCountOnUser.sql"); @@ -111,6 +112,9 @@ public List selectWithKnowledgeCount(int userId, List StringJoinBuilder builder = new StringJoinBuilder(); List params = new ArrayList<>(); params.add(new Integer(userId)); + + builder.append("?"); + params.add(-1); for (GroupsEntity group : groups) { builder.append("?"); params.add(group.getGroupId()); diff --git a/src/main/java/org/support/project/knowledge/logic/DiffLogic.java b/src/main/java/org/support/project/knowledge/logic/DiffLogic.java index 2e97d538d..87ce1ccca 100644 --- a/src/main/java/org/support/project/knowledge/logic/DiffLogic.java +++ b/src/main/java/org/support/project/knowledge/logic/DiffLogic.java @@ -27,7 +27,7 @@ public List diff(String content, String content2) { Patch patch = DiffUtils.diff(oldLines, newLines); for (Delta delta : patch.getDeltas()) { StringBuilder builder = new StringBuilder(); - builder.append(String.format("[History (%d)]", delta.getOriginal().getPosition() + 1)); + builder.append(String.format("[History line-(%d)]", delta.getOriginal().getPosition() + 1)); builder.append("\n"); for (Object line : delta.getOriginal().getLines()) { builder.append(line); @@ -38,12 +38,14 @@ public List diff(String content, String content2) { builder.append("↓"); builder.append("\n"); - builder.append(String.format("[Now (%d)]", delta.getRevised().getPosition() + 1)); + builder.append(String.format("[Now line-(%d)]", delta.getRevised().getPosition() + 1)); builder.append("\n"); for (Object line : delta.getRevised().getLines()) { builder.append(line); builder.append("\n"); } + builder.append("\n\n"); // 次の差分表示までの間に2行あける + changes.add(builder.toString()); } return changes; diff --git a/src/main/java/org/support/project/knowledge/logic/TagLogic.java b/src/main/java/org/support/project/knowledge/logic/TagLogic.java index 0f20b7915..57f1d7aa5 100644 --- a/src/main/java/org/support/project/knowledge/logic/TagLogic.java +++ b/src/main/java/org/support/project/knowledge/logic/TagLogic.java @@ -1,5 +1,6 @@ package org.support.project.knowledge.logic; +import java.util.ArrayList; import java.util.List; import org.support.project.common.log.Log; @@ -8,6 +9,7 @@ import org.support.project.knowledge.dao.TagsDao; import org.support.project.knowledge.entity.TagsEntity; import org.support.project.web.bean.LoginedUser; +import org.support.project.web.entity.GroupsEntity; public class TagLogic { /** ログ */ @@ -33,7 +35,19 @@ public List selectTagsWithCount(LoginedUser loginedUser, int offset, if (loginedUser != null) { userid = loginedUser.getUserId(); } - return tagsDao.selectTagsWithCountOnUser(userid, offset, limit); + List groups = new ArrayList(); + if (loginedUser != null && loginedUser.getGroups() != null) { + groups = loginedUser.getGroups(); + } + + TagsDao tagsDao = TagsDao.get(); + List tags; + if (loginedUser != null && loginedUser.isAdmin()) { + tags = tagsDao.selectWithKnowledgeCountAdmin(offset, limit); + } else { + tags = tagsDao.selectWithKnowledgeCount(userid, groups, offset * offset, limit); + } + return tags; } diff --git a/src/main/resources/appresource.properties b/src/main/resources/appresource.properties index b16b7e62a..886e31422 100644 --- a/src/main/resources/appresource.properties +++ b/src/main/resources/appresource.properties @@ -53,7 +53,7 @@ message.allready.updated=Allready updated. message.allready.started=Allready started. # Common Label -label.version=0.5.1 pre1 +label.version=0.5.1 pre2 label.login=Sign in label.previous = Previous label.next=Next diff --git a/src/main/resources/appresource_ja.properties b/src/main/resources/appresource_ja.properties index 7edf3846a..190f70cd3 100644 --- a/src/main/resources/appresource_ja.properties +++ b/src/main/resources/appresource_ja.properties @@ -53,7 +53,7 @@ message.allready.updated=すでに更新されています message.allready.started=すでに開始済です # Common Label -label.version=0.5.1 pre1 +label.version=0.5.1 pre2 label.login=サインイン label.previous = 前へ label.next = 次へ diff --git a/src/main/webapp/WEB-INF/views/index/index.jsp b/src/main/webapp/WEB-INF/views/index/index.jsp index 6c306332b..db2e1ca22 100644 --- a/src/main/webapp/WEB-INF/views/index/index.jsp +++ b/src/main/webapp/WEB-INF/views/index/index.jsp @@ -29,6 +29,7 @@ +" /> <%=jspUtil.label("knowledge.title")%> diff --git a/src/main/webapp/WEB-INF/views/open/knowledge/view.jsp b/src/main/webapp/WEB-INF/views/open/knowledge/view.jsp index 111ab50dc..7d4b8ef6e 100644 --- a/src/main/webapp/WEB-INF/views/open/knowledge/view.jsp +++ b/src/main/webapp/WEB-INF/views/open/knowledge/view.jsp @@ -21,6 +21,7 @@ + + +