Author: kevinshen
Date: 2010-02-08 10:34:49 +0100 (Mon, 08 Feb 2010)
New Revision: 40889
Added:
CMSContainer/trunk/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/forms/UserBulkDeleteAction.java
Modified:
CMSContainer/trunk/CMSContainer_Modules/community/resources/cmsc-community.properties
CMSContainer/trunk/CMSContainer_Modules/community/resources/cmsc-community_nl.properties
CMSContainer/trunk/CMSContainer_Modules/community/resources/cmsc-community_zh.properties
CMSContainer/trunk/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/forms/SearchConditionalUserAction.java
CMSContainer/trunk/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/forms/SearchForm.java
CMSContainer/trunk/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/person/PersonHibernateService.java
CMSContainer/trunk/CMSContainer_Modules/community/src/webapp/WEB-INF/struts-community.xml
CMSContainer/trunk/CMSContainer_Modules/community/src/webapp/editors/community/listUsers.jsp
CMSContainer/trunk/CMSContainer_Modules/community/src/webapp/editors/community/search_user_form_table.jspf
CMSContainer/trunk/CMSContainer_Modules/community/src/webapp/editors/community/userlist_table.jspf
Log:
CMSC-1636 Community: add sort on status, select all, delete options
Modified:
CMSContainer/trunk/CMSContainer_Modules/community/resources/cmsc-community.properties
===================================================================
---
CMSContainer/trunk/CMSContainer_Modules/community/resources/cmsc-community.properties
2010-02-08 09:33:26 UTC (rev 40888)
+++
CMSContainer/trunk/CMSContainer_Modules/community/resources/cmsc-community.properties
2010-02-08 09:34:49 UTC (rev 40889)
@@ -134,4 +134,8 @@
datafile.invalid = Error happened when importing file. Please check the data
of the imported file and be sure they are right.
datafile.unsupport = The file should have the extension CSV or XML.
datafile.import.success = {0} users are added or overwritten successfully
-datafile.import.success.title = Import Data
\ No newline at end of file
+datafile.import.success.title = Import Data
+
+community.search.state.all = All
+community.selectall = Select all
+community.bulkdelete = Delete
\ No newline at end of file
Modified:
CMSContainer/trunk/CMSContainer_Modules/community/resources/cmsc-community_nl.properties
===================================================================
---
CMSContainer/trunk/CMSContainer_Modules/community/resources/cmsc-community_nl.properties
2010-02-08 09:33:26 UTC (rev 40888)
+++
CMSContainer/trunk/CMSContainer_Modules/community/resources/cmsc-community_nl.properties
2010-02-08 09:34:49 UTC (rev 40889)
@@ -133,4 +133,8 @@
datafile.invalid = Er is een fout gebeurd tijdens het importeren. Controleer
of de data correct is en in het juiste formaat.
datafile.unsupport = Het bestand moet de extensie CSV of XML hebben.
datafile.import.success = {0} leden zijn succesvol toegevoegd of overschreven
-datafile.import.success.title = Importeer data
\ No newline at end of file
+datafile.import.success.title = Importeer data
+
+community.search.state.all = Alle
+community.selectall = Selecteer alles
+community.bulkdelete = Verwijderen
\ No newline at end of file
Modified:
CMSContainer/trunk/CMSContainer_Modules/community/resources/cmsc-community_zh.properties
===================================================================
---
CMSContainer/trunk/CMSContainer_Modules/community/resources/cmsc-community_zh.properties
2010-02-08 09:33:26 UTC (rev 40888)
+++
CMSContainer/trunk/CMSContainer_Modules/community/resources/cmsc-community_zh.properties
2010-02-08 09:34:49 UTC (rev 40889)
@@ -135,4 +135,8 @@
datafile.invalid = 导入文件时发生错误.
datafile.unsupport = 导入支持 CSV 和 XML.
datafile.import.success = {0} 用户被导入
-datafile.import.success.title =数据导入
\ No newline at end of file
+datafile.import.success.title =数据导入
+
+community.search.state.all = 全部
+community.selectall = 全选
+community.bulkdelete = 删除
\ No newline at end of file
Modified:
CMSContainer/trunk/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/forms/SearchConditionalUserAction.java
===================================================================
---
CMSContainer/trunk/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/forms/SearchConditionalUserAction.java
2010-02-08 09:33:26 UTC (rev 40888)
+++
CMSContainer/trunk/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/forms/SearchConditionalUserAction.java
2010-02-08 09:34:49 UTC (rev 40889)
@@ -63,11 +63,13 @@
setPagingInformation(request);
Map < String , String > map = getParameterMap(actionForm);
- String active=request.getParameter("state");
+ String active=request.getParameter("active");
if(null!=active){
String authId=request.getParameter("authid");
- Long authenticationId=Long.parseLong(authId);
- personService.changeStateByAuthenticationId(authenticationId,active);
+ if (authId != null) {
+ Long authenticationId=Long.parseLong(authId);
+
personService.changeStateByAuthenticationId(authenticationId,active);
+ }
}
List < Person > persons = personService.getAssociatedPersons(map);
int totalCount = personService.getAssociatedPersonsNum(map);
@@ -188,7 +190,7 @@
private Map < String , String > getParameterMap(ActionForm actionForm) {
Map < String , String > map =
ParameterMapper.wrap(actionForm).map("fullname", "fullName").map("username",
- "userName").map("email", "emailAddr").map("group",
"groups").map("group", "groupName").getMap();
+ "userName").map("email", "emailAddr").map("group",
"groups").map("group", "groupName").map("state", "state").getMap();
return map;
}
Modified:
CMSContainer/trunk/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/forms/SearchForm.java
===================================================================
---
CMSContainer/trunk/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/forms/SearchForm.java
2010-02-08 09:33:26 UTC (rev 40888)
+++
CMSContainer/trunk/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/forms/SearchForm.java
2010-02-08 09:34:49 UTC (rev 40889)
@@ -21,7 +21,17 @@
private String group;
private String option;
+
+ private String state;
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
public String getOption() {
return option;
}
Added:
CMSContainer/trunk/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/forms/UserBulkDeleteAction.java
===================================================================
---
CMSContainer/trunk/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/forms/UserBulkDeleteAction.java
(rev 0)
+++
CMSContainer/trunk/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/forms/UserBulkDeleteAction.java
2010-02-08 09:34:49 UTC (rev 40889)
@@ -0,0 +1,27 @@
+package com.finalist.cmsc.community.forms;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+public class UserBulkDeleteAction extends AbstractCommunityAction{
+
+ @Override
+ public ActionForward execute(ActionMapping actionMapping, ActionForm
actionForm, HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ SearchForm searchform = (SearchForm) actionForm;
+
+ // no conditions search
+ // need authId from the last jsp
+ if (searchform.getChk_() != null) {
+ for (String authId : searchform.getChk_()) {
+
getAuthenticationService().deleteAuthentication(Long.parseLong(authId));
+ }
// string[]
+ }
+ return actionMapping.findForward("success");
+
+ }
+}
Modified:
CMSContainer/trunk/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/person/PersonHibernateService.java
===================================================================
---
CMSContainer/trunk/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/person/PersonHibernateService.java
2010-02-08 09:33:26 UTC (rev 40888)
+++
CMSContainer/trunk/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/person/PersonHibernateService.java
2010-02-08 09:34:49 UTC (rev 40889)
@@ -344,7 +344,12 @@
+ "%')");
}
}
-
+ if (conditions.containsKey("state")) {
+ String state = conditions.get("state").toString();
+ if (!"all".equalsIgnoreCase(state)) {
+ strb.append(" and lower(person.active) =
'"+state.toLowerCase()+"'");
+ }
+ }
strb.append(condition("and upper(authentication.userId) like '%...@%'",
"username", conditions));
strb.append(condition("and upper(person.email) like '%...@%'", "email",
conditions));
Modified:
CMSContainer/trunk/CMSContainer_Modules/community/src/webapp/WEB-INF/struts-community.xml
===================================================================
---
CMSContainer/trunk/CMSContainer_Modules/community/src/webapp/WEB-INF/struts-community.xml
2010-02-08 09:33:26 UTC (rev 40888)
+++
CMSContainer/trunk/CMSContainer_Modules/community/src/webapp/WEB-INF/struts-community.xml
2010-02-08 09:34:49 UTC (rev 40889)
@@ -74,6 +74,10 @@
unknown="false" validate="false" name="searchForm">
<forward name="success" path="/editors/community/addUserToGroup.jsp"
redirect="false" />
</action>
+ <action path="/editors/community/UserBulkDelete"
type="com.finalist.cmsc.community.forms.UserBulkDeleteAction"
+ unknown="false" validate="false" name="searchForm">
+ <forward name="success"
path="/editors/community/SearchConditionalUser.do" redirect="false" />
+ </action>
<!-- ==========select user add to group ============-->
<action path="/editors/community/AddUserToGroup"
type="com.finalist.cmsc.community.forms.AddUserToGroupAction"
unknown="false" validate="false" name="searchForm" scope="request">
Modified:
CMSContainer/trunk/CMSContainer_Modules/community/src/webapp/editors/community/listUsers.jsp
===================================================================
---
CMSContainer/trunk/CMSContainer_Modules/community/src/webapp/editors/community/listUsers.jsp
2010-02-08 09:33:26 UTC (rev 40888)
+++
CMSContainer/trunk/CMSContainer_Modules/community/src/webapp/editors/community/listUsers.jsp
2010-02-08 09:34:49 UTC (rev 40889)
@@ -2,6 +2,7 @@
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<mm:content type="text/html" encoding="UTF-8" expires="0">
+ <c:url var="buldDeleteUrl" value="/editors/community/UserBulkDelete.do"/>
<cmscedit:head title="community.title">
<script type="text/javascript" src="<cmsc:staticurl
page='/js/prototype.js'/>"></script>
<script type="text/javascript" src="js/formcheck.js"></script>
@@ -21,7 +22,22 @@
}
return true;
}
-
+ function bulkDelete(){
+ var checkboxs = document.forms[1].getElementsByTagName("input");
+ document.selectform.action = '${buldDeleteUrl}';
+ var selected = false;
+ for(i = 0; i < checkboxs.length; i++) {
+ if(checkboxs[i].type == 'checkbox' &&
checkboxs[i].name.indexOf('chk_') == 0 && checkboxs[i].checked) {
+ selected = true;
+ break;
+ }
+ }
+ if(!selected){
+ alert("<fmt:message key="community.search.promptuser"/>");
+ return false;
+ }
+ return true;
+ }
</script>
</cmscedit:head>
@@ -61,6 +77,7 @@
<form action="${addGroup}" method="post" name="selectform"
id="selectform">
<input type="submit" value="<fmt:message
key="community.search.addUser"/>" name="submitButton" onclick="return
addToGroup()"/>
+ <input type="submit" value="<fmt:message
key="community.bulkdelete"/>" name="deleteButton" onclick="return
bulkDelete()"/>
<%@ include file="userlist_table.jspf" %>
</form>
</div>
Modified:
CMSContainer/trunk/CMSContainer_Modules/community/src/webapp/editors/community/search_user_form_table.jspf
===================================================================
---
CMSContainer/trunk/CMSContainer_Modules/community/src/webapp/editors/community/search_user_form_table.jspf
2010-02-08 09:33:26 UTC (rev 40888)
+++
CMSContainer/trunk/CMSContainer_Modules/community/src/webapp/editors/community/search_user_form_table.jspf
2010-02-08 09:34:49 UTC (rev 40889)
@@ -17,6 +17,17 @@
<td><html:text style="width: 200px" property="groups"/></td>
</tr>
<tr>
+ <td style="width:116px"><fmt:message
key="community.search.state"/></td>
+ <td>
+ <html:select property="state">
+ <html:option value="All"><fmt:message
key="community.search.state.all"/></html:option>
+ <html:option value="Unconfirmed"><fmt:message
key="community.search.state.unconfirmed"/></html:option>
+ <html:option value="Active"><fmt:message
key="community.search.state.active"/></html:option>
+ <html:option value="Blocked"><fmt:message
key="community.search.state.blocked"/></html:option>
+ </html:select>
+ </td>
+ </tr>
+ <tr>
<td style="width:116px"></td>
<td><input type="submit" value="<fmt:message
key="community.search.searchbatton"/>" name="submitButton"/></td>
</tr>
Modified:
CMSContainer/trunk/CMSContainer_Modules/community/src/webapp/editors/community/userlist_table.jspf
===================================================================
---
CMSContainer/trunk/CMSContainer_Modules/community/src/webapp/editors/community/userlist_table.jspf
2010-02-08 09:33:26 UTC (rev 40888)
+++
CMSContainer/trunk/CMSContainer_Modules/community/src/webapp/editors/community/userlist_table.jspf
2010-02-08 09:34:49 UTC (rev 40889)
@@ -1,7 +1,7 @@
<edit:ui-table items="${personForShow}" var="person" size="${totalCount}"
requestURI="/editors/community/SearchConditionalUser.do"
bulkbox="true">
- <edit:ui-tcolumn title="" width="62px">
- <input type="checkbox" name="chk_" value="${person.authId}"/>
+ <edit:ui-tcolumn title="" width="70px" checkboxlabel="community.selectall">
+ <input type="checkbox" name="chk_" value="${person.authId}"/>
<c:if test="${not hiddenOperation}">
<a href="${pageContext.request.contextPath
}/editors/community/userAddInitAction.do?authid=${person.authId}&&group=${groupName},${option}">
<img src="<cmsc:staticurl page='/editors/gfx/icons/edit.png'/>"
width="16" height="16" title="<fmt:message key="community.search.edit"/>"></a>
@@ -32,7 +32,7 @@
<edit:ui-tcolumn titlekey="community.search.memberOf">
${person.groups}
</edit:ui-tcolumn>
- <edit:ui-tcolumn titlekey="community.search.state">
+ <edit:ui-tcolumn titlekey="community.search.state" sort="person.active">
<select
onchange="selectState('${pageContext.request.contextPath
}/editors/community/SearchConditionalUser.do?page=${page}&sortby=${param.sortby}&dir=${param.dir}&authid=${person.authId}',this)"
>
<option
value="${person.active}">${person.active}</option>
<option value="Unconfirmed"><fmt:message
key="community.search.state.unconfirmed"/> </option>
@@ -60,7 +60,7 @@
}
})();
function selectState(url,ele){
- surl=url+"&state="+ele.value
+ surl=url+"&active="+ele.value
// alert(surl);
window.location.href =surl;
}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs