-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(ui) : select your group in Project page by grid
- Loading branch information
Kouki Hama
committed
Jun 27, 2022
1 parent
4678016
commit e45905d
Showing
16 changed files
with
469 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
...tend/sw360-portlet/src/main/java/org/eclipse/sw360/portal/tags/DisplayDepartmentEdit.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/** | ||
* Copyright TOSHIBA CORPORATION, 2022. Part of the SW360 Portal Project. | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
|
||
package org.eclipse.sw360.portal.tags; | ||
|
||
import java.util.ResourceBundle; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.jsp.JspException; | ||
import javax.servlet.jsp.JspWriter; | ||
|
||
import org.apache.commons.lang.StringUtils; | ||
|
||
import com.liferay.portal.kernel.language.LanguageUtil; | ||
import com.liferay.portal.kernel.util.ResourceBundleUtil; | ||
|
||
/** | ||
* This displays a department field that can be used as extension point for a department | ||
* search dialog via onclick listeners (see also | ||
* src/main/webapp/js/components/includes/departments/searchDepartment.js) | ||
*/ | ||
public class DisplayDepartmentEdit extends NameSpaceAwareTag { | ||
|
||
private String namespace; | ||
private String id; | ||
private String departmentId = ""; | ||
private String label = ""; | ||
|
||
|
||
public int doStartTag() throws JspException { | ||
JspWriter jspWriter = pageContext.getOut(); | ||
|
||
namespace = getNamespace(); | ||
StringBuilder display = new StringBuilder(); | ||
try { | ||
if (StringUtils.isNotEmpty(departmentId)) { | ||
printFullDepartment(display); | ||
}else { | ||
printEmptyDepartment(display); | ||
} | ||
jspWriter.print(display.toString()); | ||
} catch (Exception e) { | ||
throw new JspException(e); | ||
} | ||
return SKIP_BODY; | ||
} | ||
|
||
private void printEmptyDepartment(StringBuilder display) { | ||
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); | ||
ResourceBundle resourceBundle = ResourceBundleUtil.getBundle("content.Language", request.getLocale(), getClass()); | ||
|
||
display.append("<div class=\"form-group\">"); | ||
printLabel(display); | ||
display.append(String.format("<input type=\"hidden\" value=\"\" id=\"%s\" name=\"%s%s\"/>", id, namespace, id)) | ||
.append("<div class=\"form-group has-feedback\">") | ||
.append(String.format( | ||
"<input type=\"text\" class=\"form-control edit-department clickable\" placeholder=\"" + LanguageUtil.get(resourceBundle, "click.to.set.department") + "\" id=\"%sDisplay\" required=\"\"/>", | ||
id)) | ||
.append("<span class=\"glyphicon glyphicon-remove-circle form-control-feedback clearSelection\" id=\"clearDepartment\"/>") | ||
.append("</div>"); | ||
display.append("</div>"); | ||
} | ||
|
||
private void printFullDepartment(StringBuilder display) { | ||
display.append("<div class=\"form-group\">"); | ||
printLabel(display); | ||
display.append(String.format("<input type=\"hidden\" value=\"%s\" id=\"%s\" name=\"%s%s\"/>", departmentId, id, namespace, id)) | ||
.append("<div class=\"form-group has-feedback\">") | ||
.append(String.format( | ||
"<input type=\"text\" class=\"form-control edit-department clickable\" value=\"%s\" id=\"%sDisplay\" required=\"\"/>", | ||
departmentId, id)) | ||
.append("<span class=\"glyphicon glyphicon-remove-circle form-control-feedback clearSelection\" id=\"clearDepartment\"/>") | ||
.append("</div>"); | ||
display.append("</div>"); | ||
} | ||
|
||
private void printLabel(StringBuilder display) { | ||
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); | ||
ResourceBundle resourceBundle = ResourceBundleUtil.getBundle("content.Language", request.getLocale(), getClass()); | ||
|
||
if (StringUtils.isNotEmpty(label)) { | ||
display.append( | ||
String.format("<label class=\"mandatory\" for=\"group\" >%s</label>", LanguageUtil.get(resourceBundle,label))); | ||
} | ||
} | ||
|
||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
public void setDepartmentId(String departmentId) { | ||
this.departmentId = departmentId; | ||
} | ||
|
||
public void setLabel(String label) { | ||
this.label = label; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,3 +122,11 @@ form { | |
} | ||
} | ||
} | ||
|
||
|
||
input#departmentsearchinputform{ | ||
margin-left:auto; | ||
width:60% | ||
} | ||
|
||
|
37 changes: 37 additions & 0 deletions
37
...0-portlet/src/main/resources/META-INF/resources/html/components/ajax/departmentSearch.jsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<%-- | ||
~ Copyright TOSHIBA CORPORATION, 2022. Part of the SW360 Portal Project. | ||
~ | ||
~ This program and the accompanying materials are made | ||
~ available under the terms of the Eclipse Public License 2.0 | ||
~ which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
~ | ||
~ SPDX-License-Identifier: EPL-2.0 | ||
--%> | ||
|
||
<%@include file="/html/init.jsp"%> | ||
|
||
<portlet:defineObjects /> | ||
<liferay-theme:defineObjects /> | ||
|
||
<jsp:useBean id="primaryDepartment" type="java.lang.String" scope="request" /> | ||
<jsp:useBean id="secondaryDepartmentList" type="java.util.List<java.lang.String>" scope="request" /> | ||
|
||
<tr> | ||
<td> | ||
<input type="radio" data-name="department" name="<portlet:namespace/>departmentId" value="<sw360:out value="${primaryDepartment},${primaryDepartment}"/>"> | ||
</td> | ||
<td><sw360:out value="${primaryDepartment}"/></td> | ||
<td>PRIMARY</td> | ||
</tr> | ||
|
||
<core_rt:if test="${secondaryDepartmentList.size()>0}" > | ||
<core_rt:forEach items="${secondaryDepartmentList}" var="secondaryDepartment"> | ||
<tr> | ||
<td> | ||
<input type="radio" data-name="department" name="<portlet:namespace/>departmentId" value="<sw360:out value="${secondaryDepartment},${secondaryDepartment}"/>"> | ||
</td> | ||
<td><sw360:out value="${secondaryDepartment}"/></td> | ||
<td>SECONDARY</td> | ||
</tr> | ||
</core_rt:forEach> | ||
</core_rt:if> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.