Skip to content

Commit

Permalink
Merge pull request #252 from support-project/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
koda-masaru committed Jan 19, 2016
2 parents a8a9b90 + eb20109 commit f2639fa
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>org.support-project</groupId>
<artifactId>knowledge</artifactId>
<packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version>
<version>1.0.0</version>
<name>webapp for knowledge</name>
<url>https://support-project.org/</url>

Expand All @@ -16,7 +16,7 @@
<dependency>
<groupId>org.support-project</groupId>
<artifactId>web</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.0.0</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public static void main(String[] args) throws Exception {


private void start() throws Exception {
super.dbInit();
SystemConfigsEntity entity = SystemConfigsDao.get().selectOnKey(SystemConfig.DATA_EXPORT, AppConfig.get().getSystemName());
if (entity == null) {
send("[Fail] create fail. please try again.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.support.project.knowledge.entity.TagsEntity;
import org.support.project.knowledge.entity.TemplateItemsEntity;
import org.support.project.knowledge.entity.TemplateMastersEntity;
import org.support.project.knowledge.logic.GroupLogic;
import org.support.project.knowledge.logic.KnowledgeLogic;
import org.support.project.knowledge.logic.TargetLogic;
import org.support.project.knowledge.logic.UploadedFileLogic;
Expand All @@ -43,6 +44,7 @@
import org.support.project.web.config.MessageStatus;
import org.support.project.web.control.service.Get;
import org.support.project.web.control.service.Post;
import org.support.project.web.entity.GroupsEntity;
import org.support.project.web.exception.InvalidParamException;

@DI(instance=Instance.Prototype)
Expand Down Expand Up @@ -75,6 +77,21 @@ public Boundary view_add() {
setAttribute("templates", templates);

setAttribute("typeId", KnowledgeLogic.TEMPLATE_TYPE_KNOWLEDGE);

// グループが指定されてる場合はデフォルトで公開範囲と共同編集者を選択済みにする
String groupId = super.getParam("group", String.class);
if (StringUtils.isNotEmpty(groupId)) {
GroupsEntity group = GroupLogic.get().getGroup(new Integer(groupId), getLoginedUser());
if (group == null) {
return sendError(HttpStatus.SC_403_FORBIDDEN, "");
}

String[] groupIds = { TargetLogic.ID_PREFIX_GROUP + groupId };
List<LabelValue> targets = TargetLogic.get().selectTargets(groupIds);
setAttribute("publicFlag", KnowledgeLogic.PUBLIC_FLAG_PROTECT);
setAttribute("groups", targets);
setAttribute("editors", targets);
}

return forward("view_add.jsp");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ public GroupsEntity getGroup(Integer groupId, LoginedUser loginedUser) {
group = groupsDao.selectAccessAbleGroup(groupId, loginedUser);
}

setGroupStatus(group, loginedUser);
if (group != null) {
setGroupStatus(group, loginedUser);
}
return group;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/appresource.properties
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ message.allready.started=Allready started.
message.confirm.delete=Are you sure you want to delete?

# Common Label
label.version=v1.0.0 pre2
label.version=v1.0.0
label.login=Sign in
label.previous = Previous
label.next=Next
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/appresource_ja.properties
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ message.allready.started=すでに開始済です
message.confirm.delete=本当に削除しますか?

# Common Label
label.version=v1.0.0 pre2
label.version=v1.0.0
label.login=サインイン
label.previous = 前へ
label.next = 次へ
Expand Down
8 changes: 4 additions & 4 deletions src/main/webapp/WEB-INF/views/protect/knowledge/view_add.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ var _SET_IMAGE_LABEL= '<%= jspUtil.label("knowledge.edit.set.image.path") %>';
var _LABEL_UPDATE = '<%= jspUtil.label("label.update") %>';
var _UPDATE_TITLE = '<%= jspUtil.label("knowledge.edit.title") %>';
<c:forEach var="group" items="${groups}" varStatus="status">
selectedGroups.push({label: '<%= jspUtil.out("group.label") %>', value: '<%= jspUtil.out("group.value") %>'});
<c:forEach var="selectedGroup" items="${groups}" varStatus="status">
selectedGroups.push({label: '<%= jspUtil.out("selectedGroup.label") %>', value: '<%= jspUtil.out("selectedGroup.value") %>'});
</c:forEach>
<c:forEach var="editor" items="${editors}" varStatus="status">
selectedEditors.push({label: '<%= jspUtil.out("editor.label") %>', value: '<%= jspUtil.out("editor.value") %>'});
<c:forEach var="selectedEditor" items="${editors}" varStatus="status">
selectedEditors.push({label: '<%= jspUtil.out("selectedEditor.label") %>', value: '<%= jspUtil.out("selectedEditor.value") %>'});
</c:forEach>
var _TAGS = [];
Expand Down

0 comments on commit f2639fa

Please sign in to comment.