Update of 
/var/cvs/contributions/CMSContainer_Modules/community/src/webapp/editors/community
In directory james.mmbase.org:/tmp/cvs-serv11949

Modified Files:
        userlist_addusertogroup.jsp 
Log Message:
CMSC-996,User and Group lists in Editors,improve userlist_addusertogroup.jsp


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Modules/community/src/webapp/editors/community
See also: http://www.mmbase.org/jira/browse/CMSC-996


Index: userlist_addusertogroup.jsp
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Modules/community/src/webapp/editors/community/userlist_addusertogroup.jsp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- userlist_addusertogroup.jsp 1 Aug 2008 07:43:36 -0000       1.4
+++ userlist_addusertogroup.jsp 4 Aug 2008 06:58:26 -0000       1.5
@@ -6,12 +6,27 @@
                        src="<cmsc:staticurl 
page='/js/prototype.js'/>"></script>
                <script type="text/javascript" src="js/formcheck.js"></script>
                <script type="text/javascript">
-         window.onload = function ()
-         {
-            Event.observe("selectform", "submit", function(e) {
-               addToGroup("chk_", "<fmt:message 
key="community.search.promptuser"/>", e)
-            })
+      function addToGroup(){
+      var checkboxs = document.forms[1].getElementsByTagName("input");
+      var objectnumbers = '';
+      for(i = 0; i < checkboxs.length; i++) {
+         if(checkboxs[i].type == 'checkbox' && 
checkboxs[i].name.indexOf('chk_') == 0 && checkboxs[i].checked) {
+            objectnumbers += checkboxs[i].value;
+         }
+      }
+      if(objectnumbers == ''){
+         alert("<fmt:message key="community.search.promptuser"/>");
+         return false;
+      }
+      //document.getElementById("option").value ="add";
+      return true;
+      }
+      
+      function selectOtherUsers(){
+      document.getElementById("option").value ="select";
+      return true;
          }
+         
          function removeFromGroup(){
       var checkboxs = document.forms[1].getElementsByTagName("input");
       var objectnumbers = '';
@@ -27,7 +42,7 @@
          return false;
       }
      if(confirm("<fmt:message 
key="community.search.option"><fmt:param>"+j+"</fmt:param></fmt:message>")){
-      //document.getElementById("option").value ="remove";
+      document.getElementById("option").value ="remove";
       return true;
         }
         return false;
@@ -36,6 +51,7 @@
        </cmscedit:head>
 
        <body>
+
                <mm:cloud jspvar="cloud" rank="basic user" 
loginpage="../../login.jsp">
                        <edit:ui-tabs>
                                <edit:ui-tab key="community.search.users" />
@@ -51,14 +67,16 @@
                        </edit:ui-tabs>
 
                        <div class="editor">
+
                                <div style="padding-left:10px;">
                                        <p>
-                                               <a href="userAddInitAction.do"
-                                                       style=" 
padding-left:20px; background: url(<cmsc:staticurl 
page='/editors/gfx/icons/new.png'/>) left center no-repeat">
-                                                       <fmt:message 
key="view.new.user" /> </a>
+                                               &nbsp;
                                        <p>
-                                               <html:form 
action="/editors/community/SearchConditionalUser.do"
-                                                       method="post">
+                                               <html:form
+                                                       
action="/editors/community/SearchConditionalUser.do?method=listGroupMembers&&groupName=${groupName}"
 method="post">
+                                               <c:if test="${option}">
+                                                   <input type="hidden" 
id="option" name="option" value="select"/>
+                                               </c:if>
                                                        <[EMAIL PROTECTED] 
file="search_user_form_table.jspf"%>
                                                </html:form>
                                </div>
@@ -78,13 +96,26 @@
                                                <c:param name="groupName" 
value="${groupName}" />
                                                <c:param name="method" 
value="listGroupMembers" />
                                        </c:url>
-                                       <form action="${editGroup}" 
method="post" id="selectform">
+                                       <c:choose>
+                                               <c:when test="${empty option}">
+                                                       <form 
action="${userActionUrl}" method="post" id="selectform">
+                                                               <input 
type="hidden" id="option" name="option" />
                                                <input type="submit"
-                                                       value="<fmt:message 
key="community.search.addUser" />"
-                                                       name="submitButton" 
onclick="return addToGroup()" />
+                                                                       
value="<fmt:message key="community.search.selectUser" 
><fmt:param>${groupName}</fmt:param></fmt:message>"
+                                                                       
name="submitButton" onclick="return selectOtherUsers()" />
                                                <input type="submit" 
name="submitButton2"
                                                        value="<fmt:message 
key="community.search.removeUser" />"
                                                        onclick="return 
removeFromGroup()" />
+                                               </c:when>
+                                               <c:otherwise>
+                                                       <form
+                                                               
action="${pageContext.request.contextPath}/editors/community/AddUserToGroup.do?groupName=${groupName}"
+                                                               method="post" 
id="selectform">
+                                                               <input 
type="submit"
+                                                                       
value="<fmt:message 
key="community.search.addUserToGroup"><fmt:param>${groupName}</fmt:param></fmt:message>"
+                                                                       
name="submitButton" onclick="return addToGroup()" />
+                                               </c:otherwise>
+                                       </c:choose>
                                                <%@ include 
file="userlist_table.jspf"%>
                                        </form>
                                </div>
_______________________________________________
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to