<%-- Document : import_users Created on : Mar 13, 2008, 11:06:36 AM Author : aili --%> <%@page contentType="text/html" pageEncoding="UTF-8" import="java.util.*, java.io.File, org.apache.commons.fileupload.*" %> <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%> <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <% if(FileUpload.isMultipartContent(request)) { DiskFileUpload fileUpload= new DiskFileUpload(); List items = fileUpload.parseRequest(request); if (items.size()>0){ String role = ""; ArrayList schools_list = new ArrayList(); String group = ""; String checkbox_val = null; FileItem item = null; FileItem usersFile = null; Iterator iter = items.iterator(); while (iter.hasNext()) { item = (FileItem) iter.next(); if (item.isFormField()) { if (item.getFieldName().equals("role")) role = item.getString(); if (item.getFieldName().equals("schools")) schools_list.add(item.getString()); if (item.getFieldName().equals("registrations:subgroup")) group = item.getString(); if (item.getFieldName().equals("has_school")) checkbox_val = item.getString(); } if (!item.isFormField()) { if(item.getSize()>0){ usersFile = item; } } } // convert schools arraylist to string array String[] schools =(String[])schools_list.toArray(new String[schools_list.size()]); if (checkbox_val == null) schools=null; Integer user_id = sess.getLoggedInUserId(); Integer success = ejb.importUsers(role, schools, group, usersFile, user_id); if (success == 1) { response.sendRedirect(request.getContextPath() + "/auth/admin/users/users_management.faces"); } else if (success == 2) { response.sendRedirect(request.getContextPath() + "/auth/admin/users/registration_result.faces"); } else if (success == 3) { response.sendRedirect(request.getContextPath() + "/auth/admin/users/users_management.faces?msg=success"); } } } %> <%@ include file ="../../../WEB-INF/jspf/Header.jspf" %> <%@ include file="../../../WEB-INF/jspf/UserMenu.jspf" %> <%@ include file="../../../WEB-INF/jspf/Heading.jspf" %>












" /> " onClick="window.location.href='users_management.faces'" /> <%@ include file ="../../../WEB-INF/jspf/Footer.jspf" %>