diff --git a/1.0/.classpath b/1.0/.classpath
new file mode 100644
index 0000000..9ace2b1
--- /dev/null
+++ b/1.0/.classpath
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/1.0/.gwt/.gwt-log b/1.0/.gwt/.gwt-log
new file mode 100644
index 0000000..e69de29
diff --git a/1.0/.project b/1.0/.project
new file mode 100644
index 0000000..190a7fc
--- /dev/null
+++ b/1.0/.project
@@ -0,0 +1,53 @@
+
+
+ create-users
+
+
+
+
+
+ org.eclipse.wst.jsdt.core.javascriptValidator
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.wst.common.project.facet.core.builder
+
+
+
+
+ org.eclipse.wst.validation.validationbuilder
+
+
+
+
+ com.google.gdt.eclipse.core.webAppProjectValidator
+
+
+
+
+ com.google.gwt.eclipse.core.gwtProjectValidator
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+
+ org.eclipse.jem.workbench.JavaEMFNature
+ org.eclipse.wst.common.modulecore.ModuleCoreNature
+ org.eclipse.jdt.core.javanature
+ org.eclipse.m2e.core.maven2Nature
+ org.eclipse.wst.common.project.facet.core.nature
+ org.eclipse.wst.jsdt.core.jsNature
+ com.google.gwt.eclipse.core.gwtNature
+
+
diff --git a/1.0/.settings/.jsdtscope b/1.0/.settings/.jsdtscope
new file mode 100644
index 0000000..b72a6a4
--- /dev/null
+++ b/1.0/.settings/.jsdtscope
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/1.0/.settings/com.google.appengine.eclipse.core.prefs b/1.0/.settings/com.google.appengine.eclipse.core.prefs
new file mode 100644
index 0000000..82c36af
--- /dev/null
+++ b/1.0/.settings/com.google.appengine.eclipse.core.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+filesCopiedToWebInfLib=
diff --git a/1.0/.settings/com.google.gdt.eclipse.core.prefs b/1.0/.settings/com.google.gdt.eclipse.core.prefs
new file mode 100644
index 0000000..d83ef36
--- /dev/null
+++ b/1.0/.settings/com.google.gdt.eclipse.core.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+lastWarOutDir=/home/costantino/workspace/create-users/target/create-users-1.0.0-SNAPSHOT
+warSrcDir=src/main/webapp
+warSrcDirIsOutput=false
diff --git a/1.0/.settings/com.google.gwt.eclipse.core.prefs b/1.0/.settings/com.google.gwt.eclipse.core.prefs
new file mode 100644
index 0000000..f23a752
--- /dev/null
+++ b/1.0/.settings/com.google.gwt.eclipse.core.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+entryPointModules=
diff --git a/1.0/.settings/org.eclipse.core.resources.prefs b/1.0/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..29abf99
--- /dev/null
+++ b/1.0/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,6 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/main/resources=UTF-8
+encoding//src/test/java=UTF-8
+encoding//src/test/resources=UTF-8
+encoding/=UTF-8
diff --git a/1.0/.settings/org.eclipse.jdt.core.prefs b/1.0/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..443e085
--- /dev/null
+++ b/1.0/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/1.0/.settings/org.eclipse.jst.jsp.core.prefs b/1.0/.settings/org.eclipse.jst.jsp.core.prefs
new file mode 100644
index 0000000..3a5c98d
--- /dev/null
+++ b/1.0/.settings/org.eclipse.jst.jsp.core.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+validateFragments=false
+validation.use-project-settings=true
diff --git a/1.0/.settings/org.eclipse.m2e.core.prefs b/1.0/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/1.0/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/1.0/.settings/org.eclipse.wst.common.component b/1.0/.settings/org.eclipse.wst.common.component
new file mode 100644
index 0000000..4b7cda2
--- /dev/null
+++ b/1.0/.settings/org.eclipse.wst.common.component
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/1.0/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/1.0/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
new file mode 100644
index 0000000..cc81385
--- /dev/null
+++ b/1.0/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/1.0/.settings/org.eclipse.wst.common.project.facet.core.xml b/1.0/.settings/org.eclipse.wst.common.project.facet.core.xml
new file mode 100644
index 0000000..0777079
--- /dev/null
+++ b/1.0/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/1.0/.settings/org.eclipse.wst.jsdt.ui.superType.container b/1.0/.settings/org.eclipse.wst.jsdt.ui.superType.container
new file mode 100644
index 0000000..3bd5d0a
--- /dev/null
+++ b/1.0/.settings/org.eclipse.wst.jsdt.ui.superType.container
@@ -0,0 +1 @@
+org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
diff --git a/1.0/.settings/org.eclipse.wst.jsdt.ui.superType.name b/1.0/.settings/org.eclipse.wst.jsdt.ui.superType.name
new file mode 100644
index 0000000..05bd71b
--- /dev/null
+++ b/1.0/.settings/org.eclipse.wst.jsdt.ui.superType.name
@@ -0,0 +1 @@
+Window
\ No newline at end of file
diff --git a/1.0/.settings/org.eclipse.wst.validation.prefs b/1.0/.settings/org.eclipse.wst.validation.prefs
new file mode 100644
index 0000000..04cad8c
--- /dev/null
+++ b/1.0/.settings/org.eclipse.wst.validation.prefs
@@ -0,0 +1,2 @@
+disabled=06target
+eclipse.preferences.version=1
diff --git a/1.0/distro/LICENSE b/1.0/distro/LICENSE
new file mode 100644
index 0000000..7bca8c8
--- /dev/null
+++ b/1.0/distro/LICENSE
@@ -0,0 +1,2 @@
+${gcube.license}
+
diff --git a/1.0/distro/README b/1.0/distro/README
new file mode 100644
index 0000000..65b75d6
--- /dev/null
+++ b/1.0/distro/README
@@ -0,0 +1,63 @@
+The gCube System - ${name}
+--------------------------------------------------
+
+${description}
+
+
+${gcube.description}
+
+${gcube.funding}
+
+
+Version
+--------------------------------------------------
+
+${version} (${buildDate})
+
+Please see the file named "changelog.xml" in this directory for the release notes.
+
+
+Authors
+--------------------------------------------------
+
+* Costantino Perciante at ISTI-CNR(Pisa), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
+
+Maintainers
+-----------
+
+* Costantino Perciante at ISTI-CNR(Pisa), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
+
+Download information
+--------------------------------------------------
+
+Source code is available from SVN:
+ ${scm.url}
+
+Binaries can be downloaded from the gCube website:
+ ${gcube.website}
+
+
+Installation
+--------------------------------------------------
+
+Installation documentation is available on-line in the gCube Wiki:
+ ${gcube.wikiRoot}
+
+Documentation
+--------------------------------------------------
+
+Documentation is available on-line in the gCube Wiki:
+ ${gcube.wikiRoot}
+ ${gcube.wikiRoot}
+
+Support
+--------------------------------------------------
+
+Bugs and support requests can be reported in the gCube issue tracking tool:
+ ${gcube.issueTracking}
+
+
+Licensing
+--------------------------------------------------
+
+This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
\ No newline at end of file
diff --git a/1.0/distro/changelog.xml b/1.0/distro/changelog.xml
new file mode 100644
index 0000000..08f83d2
--- /dev/null
+++ b/1.0/distro/changelog.xml
@@ -0,0 +1,6 @@
+
+
+ First Release
+
+
diff --git a/1.0/distro/descriptor.xml b/1.0/distro/descriptor.xml
new file mode 100644
index 0000000..5e80428
--- /dev/null
+++ b/1.0/distro/descriptor.xml
@@ -0,0 +1,32 @@
+
+ servicearchive
+
+ tar.gz
+
+ /
+
+
+ ${distroDirectory}
+ /
+ true
+
+ README
+ LICENSE
+ changelog.xml
+ profile.xml
+
+ 755
+ true
+
+
+
+
+
+ /${artifactId}
+
+
+
+
\ No newline at end of file
diff --git a/1.0/distro/profile.xml b/1.0/distro/profile.xml
new file mode 100644
index 0000000..51c3b6b
--- /dev/null
+++ b/1.0/distro/profile.xml
@@ -0,0 +1,25 @@
+
+
+
+ Service
+
+ ${description}
+ PortletUser
+ ${artifactId}
+ ${version}
+
+
+ ${artifactId}
+ ${version}
+
+ ${groupId}
+ ${artifactId}
+ ${version}
+
+
+ target/${build.finalName}.war
+
+
+
+
+
diff --git a/1.0/pom.xml b/1.0/pom.xml
new file mode 100644
index 0000000..e3bd4f9
--- /dev/null
+++ b/1.0/pom.xml
@@ -0,0 +1,245 @@
+
+
+
+ 4.0.0
+
+ maven-parent
+ org.gcube.tools
+ 1.0.0
+
+
+
+ org.gcube.portlets.admin
+ create-users
+ war
+ 1.0.0-SNAPSHOT
+ Create users portlet
+
+ Create users portlet allows a VRE-Manager to enter user's personal data and automatically register he/she in the portal.
+ The portlet also sends a temporary password to the just registered user.
+
+
+
+ scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/${project.artifactId}
+ scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/${project.artifactId}
+ http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/${project.artifactId}
+
+
+
+
+ 2.7.0
+ 6.0.6
+
+ 1.7
+ 1.7
+
+ ${project.build.directory}/${project.build.finalName}
+ UTF-8
+ UTF-8
+
+
+
+
+
+ com.google.gwt
+ gwt
+ ${gwtVersion}
+ pom
+ import
+
+
+ org.gcube.distribution
+ maven-portal-bom
+ LATEST
+ pom
+ import
+
+
+
+
+
+
+ org.gcube.common.portal
+ portal-manager
+ provided
+
+
+ com.sun.mail
+ javax.mail
+ provided
+
+
+ com.google.gwt
+ gwt-servlet
+ provided
+ ${gwtVersion}
+
+
+ com.google.gwt
+ gwt-user
+ provided
+ ${gwtVersion}
+
+
+ com.google.gwt
+ gwt-dev
+ provided
+ ${gwtVersion}
+
+
+ org.gcube.portal
+ custom-portal-handler
+
+
+ com.github.gwtbootstrap
+ gwt-bootstrap
+ 2.3.2.0
+
+
+ org.gcube.dvos
+ usermanagement-core
+ provided
+
+
+ com.liferay.portal
+ portal-service
+ ${liferayVersion}
+ provided
+
+
+ org.gcube.applicationsupportlayer
+ aslcore
+
+
+ commons-codec
+ commons-codec
+ compile
+
+
+ org.gcube.core
+ common-scope-maps
+ compile
+
+
+ javax.portlet
+ portlet-api
+ provided
+
+
+ org.gcube.portal
+ social-networking-library
+ provided
+
+
+ org.gcube.common
+ home-library-model
+ provided
+
+
+ org.gcube.common
+ home-library
+ provided
+
+
+ asm-all
+ asm
+
+
+
+
+ org.gcube.common
+ home-library-jcr
+ provided
+
+
+ junit
+ junit
+ 4.11
+ test
+
+
+
+
+
+ ${webappDirectory}/WEB-INF/classes
+
+
+
+
+
+ org.codehaus.mojo
+ gwt-maven-plugin
+ ${gwtVersion}
+
+
+
+ compile
+
+
+
+
+
+
+
+ Statistics.html
+ ${webappDirectory}
+
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ 2.1.1
+
+
+ compile
+
+ exploded
+
+
+
+
+ ${webappDirectory}
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+ 2.2
+
+
+ ${distroDirectory}/descriptor.xml
+
+
+
+
+ servicearchive
+ install
+
+ single
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 2.3.2
+
+
+ 1.7
+
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+ 2.5
+
+
+
+
+
diff --git a/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/CreateUsers.java b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/CreateUsers.java
new file mode 100644
index 0000000..9c2c658
--- /dev/null
+++ b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/CreateUsers.java
@@ -0,0 +1,19 @@
+package org.gcube.portlets.admin.createusers.client;
+
+import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.user.client.ui.RootPanel;
+
+
+/**
+ * The main module that contains the entry point of the portlet.
+ * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
+ */
+public class CreateUsers implements EntryPoint {
+
+ @Override
+ public void onModuleLoad() {
+
+ RootPanel.get("create-users-container").add(new CreateUsersPanel());
+
+ }
+}
\ No newline at end of file
diff --git a/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/CreateUsersPanel.java b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/CreateUsersPanel.java
new file mode 100644
index 0000000..8de69e4
--- /dev/null
+++ b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/CreateUsersPanel.java
@@ -0,0 +1,124 @@
+package org.gcube.portlets.admin.createusers.client;
+import java.util.List;
+
+import org.gcube.portlets.admin.createusers.client.ui.AddUserForm;
+import org.gcube.portlets.admin.createusers.client.ui.LoadingText;
+import org.gcube.portlets.admin.createusers.client.ui.RegisteredUsersTable;
+import org.gcube.portlets.admin.createusers.shared.VreUserBean;
+
+import com.github.gwtbootstrap.client.ui.AlertBlock;
+import com.github.gwtbootstrap.client.ui.TabPane;
+import com.github.gwtbootstrap.client.ui.TabPanel;
+import com.github.gwtbootstrap.client.ui.constants.AlertType;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.shared.HandlerManager;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.VerticalPanel;
+
+/**
+ * The panel that contains the list of users already registered and the form to add new ones.
+ * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
+ */
+public class CreateUsersPanel extends Composite {
+
+ // main vertical panel
+ private VerticalPanel mainPanel = new VerticalPanel();
+
+ // Tab panel
+ private TabPanel navTabs = new TabPanel();
+
+ // add user subpanel
+ private TabPane addUserSubPanel = new TabPane("Create New User");
+
+ // registered users subpanel
+ private TabPane registeredUsersSubPanel = new TabPane("Already Created Users") ;
+
+ // Create a remote service proxy to talk to the server-side user manager service.
+ private final HandleUsersServiceAsync userServices = GWT.create(HandleUsersService.class);
+
+ // table of registered users
+ private RegisteredUsersTable registeredUsersTable;
+
+ // event bus
+ private final HandlerManager eventBus = new HandlerManager(null);
+
+ public CreateUsersPanel(){
+
+ super();
+ initWidget(mainPanel);
+
+ // form panel
+ AddUserForm addUserForm = new AddUserForm(userServices, eventBus, this);
+ addUserSubPanel.add(addUserForm);
+
+ // add temporary loader for registered users table
+ LoadingText loader = new LoadingText();
+ loader.setVisible(true);
+ registeredUsersSubPanel.add(loader);
+
+ // add stuff to the main panel
+ navTabs.add(addUserSubPanel);
+ navTabs.add(registeredUsersSubPanel);
+ mainPanel.add(navTabs);
+
+ // select add user form tab
+ navTabs.selectTab(0);
+
+ // enlarge navTabs
+ mainPanel.setWidth("100%");
+
+ // squeeze the form panel
+ addUserSubPanel.setWidth("50%");
+
+ // require already registered users
+ userServices.getAlreadyRegisterdUsers(new AsyncCallback>() {
+
+ @Override
+ public void onSuccess(List result) {
+
+ if(result == null){
+ showProblemsRetrievingList();
+ return;
+ }
+
+ GWT.log("List of registered users received!");
+ registeredUsersTable = new RegisteredUsersTable(result, eventBus, userServices);
+ registeredUsersSubPanel.clear();
+ registeredUsersSubPanel.add(registeredUsersTable);
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+
+ GWT.log("Unable to retrieve list of registered users!" + caught.toString());
+ showProblemsRetrievingList();
+
+ }
+ });
+ }
+
+ /**
+ * Show error block if retrieving registered data fails.
+ */
+ private void showProblemsRetrievingList() {
+
+ registeredUsersSubPanel.clear();
+ AlertBlock error = new AlertBlock(AlertType.ERROR);
+ error.setText("It is not possible to retrieve the requested data at the moment. Retry later...");
+ error.setAnimation(true);
+ error.setClose(false);
+ registeredUsersSubPanel.add(error);
+
+ }
+
+ /**
+ * Determine if a user with this email has been already registered
+ * @param actualEmail
+ * @return
+ */
+ public boolean isUserPresent(String actualEmail) {
+ return registeredUsersTable.isUserPresent(actualEmail);
+ }
+
+}
diff --git a/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/HandleUsersService.java b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/HandleUsersService.java
new file mode 100644
index 0000000..c2d4bb4
--- /dev/null
+++ b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/HandleUsersService.java
@@ -0,0 +1,45 @@
+package org.gcube.portlets.admin.createusers.client;
+
+import java.util.List;
+
+import org.gcube.portlets.admin.createusers.shared.VreUserBean;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
+/**
+ * The client side stub for the RPC service.
+ */
+@RemoteServiceRelativePath("usersservice")
+public interface HandleUsersService extends RemoteService {
+
+ /**
+ * Register this user to the current vre.
+ * @param name
+ * @param surname
+ * @param institution/organization
+ * @param email
+ * @param sendEmail
+ * @param isMale
+ * @return the registered user information or null if the registration failed
+ */
+ VreUserBean register(String name, String surname, String institution, String email, boolean sendEmail, boolean isMale);
+
+ /**
+ * Retrieve the list of already registered users.
+ * @return a list of already registered users or null in case of error
+ */
+ List getAlreadyRegisterdUsers();
+
+ /**
+ * Delete an already invited user that didn't change his password.
+ * @param email
+ */
+ public boolean deleteInvitedUser(String email);
+
+ /**
+ * Send the registration email to this user
+ * @param email
+ */
+ public void sendEmailToUser(String email);
+
+}
diff --git a/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/HandleUsersServiceAsync.java b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/HandleUsersServiceAsync.java
new file mode 100644
index 0000000..b8896cb
--- /dev/null
+++ b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/HandleUsersServiceAsync.java
@@ -0,0 +1,23 @@
+package org.gcube.portlets.admin.createusers.client;
+
+import java.util.List;
+
+import org.gcube.portlets.admin.createusers.shared.VreUserBean;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+/**
+ * Async version of the service for the client.
+ * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
+ */
+public interface HandleUsersServiceAsync {
+
+ void getAlreadyRegisterdUsers(AsyncCallback> callback);
+
+ void register(String name, String surname, String institution, String email,
+ boolean sendEmail, boolean isMale, AsyncCallback callback);
+
+ void deleteInvitedUser(String email, AsyncCallback callback);
+
+ void sendEmailToUser(String email, AsyncCallback callback);
+}
diff --git a/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/event/AddUserEvent.java b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/event/AddUserEvent.java
new file mode 100644
index 0000000..d6a0fa2
--- /dev/null
+++ b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/event/AddUserEvent.java
@@ -0,0 +1,29 @@
+package org.gcube.portlets.admin.createusers.client.event;
+import org.gcube.portlets.admin.createusers.shared.VreUserBean;
+
+import com.google.gwt.event.shared.GwtEvent;
+
+
+public class AddUserEvent extends GwtEvent {
+ public static Type TYPE = new Type();
+
+ private VreUserBean addedUserBean;
+
+ public AddUserEvent(VreUserBean addedUserBean) {
+ this.addedUserBean = addedUserBean;
+ }
+
+ public VreUserBean getAddedUserBean() {
+ return addedUserBean;
+ }
+
+ @Override
+ public Type getAssociatedType() {
+ return TYPE;
+ }
+
+ @Override
+ protected void dispatch(AddUserEventHandler handler) {
+ handler.onAddUser(this);
+ }
+}
diff --git a/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/event/AddUserEventHandler.java b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/event/AddUserEventHandler.java
new file mode 100644
index 0000000..1062950
--- /dev/null
+++ b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/event/AddUserEventHandler.java
@@ -0,0 +1,7 @@
+package org.gcube.portlets.admin.createusers.client.event;
+
+import com.google.gwt.event.shared.EventHandler;
+
+public interface AddUserEventHandler extends EventHandler {
+ void onAddUser(AddUserEvent event);
+}
diff --git a/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/ui/AddUserForm.java b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/ui/AddUserForm.java
new file mode 100644
index 0000000..d5734c0
--- /dev/null
+++ b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/ui/AddUserForm.java
@@ -0,0 +1,271 @@
+package org.gcube.portlets.admin.createusers.client.ui;
+
+import org.gcube.portlets.admin.createusers.client.CreateUsersPanel;
+import org.gcube.portlets.admin.createusers.client.HandleUsersServiceAsync;
+import org.gcube.portlets.admin.createusers.client.event.AddUserEvent;
+import org.gcube.portlets.admin.createusers.shared.VreUserBean;
+
+import com.github.gwtbootstrap.client.ui.AlertBlock;
+import com.github.gwtbootstrap.client.ui.Button;
+import com.github.gwtbootstrap.client.ui.CheckBox;
+import com.github.gwtbootstrap.client.ui.Form;
+import com.github.gwtbootstrap.client.ui.Image;
+import com.github.gwtbootstrap.client.ui.TextBox;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.Scheduler;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.KeyUpEvent;
+import com.google.gwt.event.shared.HandlerManager;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.uibinder.client.UiHandler;
+import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Form to add new user to the vre.
+ * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
+ */
+public class AddUserForm extends Composite{
+
+ private static AddUserFormUiBinder uiBinder = GWT
+ .create(AddUserFormUiBinder.class);
+
+ /**
+ * Path of the image to be shown during loading
+ */
+ public static final String imagePath = GWT.getModuleBaseURL() + "../images/loader.gif";
+
+ interface AddUserFormUiBinder extends UiBinder {
+ }
+
+ @UiField
+ Form form;
+
+ @UiField
+ Button submit;
+
+ @UiField
+ CheckBox sendMailCheckbox;
+
+ @UiField
+ Image performingRequest;
+
+ @UiField
+ TextBox emailTextbox;
+
+ @UiField
+ TextBox nameTextbox;
+
+ @UiField
+ TextBox surnameTextbox;
+
+ @UiField
+ TextBox companyTextbox;
+
+ @UiField
+ AlertBlock errorBlock;
+
+ @UiField
+ AlertBlock successBlock;
+
+ private static final String NAME_SURNAME_PATTERN = "^[a-zA-Z\\s]*$";
+
+ private static final String EMAIL_PATTERN =
+ "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
+ + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
+
+ private static final int HIDE_AFTER_MILLISECONDS = 10000;
+
+ private final HandleUsersServiceAsync registrationService;
+
+ private final HandlerManager eventBus;
+
+ private final CreateUsersPanel parent;
+
+ public AddUserForm(HandleUsersServiceAsync userServices, HandlerManager eventBus, CreateUsersPanel parent) {
+ initWidget(uiBinder.createAndBindUi(this));
+ this.registrationService = userServices;
+ this.eventBus = eventBus;
+ this.parent = parent;
+
+ // set loader url
+ performingRequest.setUrl(imagePath);
+ }
+
+
+ @Override
+ protected void onAttach() {
+ super.onAttach();
+ Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand () {
+ public void execute () {
+ GWT.log("Setting focus");
+ emailTextbox.getElement().focus();
+ }
+ });
+ }
+
+
+ @UiHandler("submit")
+ void onClick(ClickEvent e) {
+
+ // input validation
+ String actualName = nameTextbox.getText();
+ String actualSurname = surnameTextbox.getText();
+ String actualEmail = emailTextbox.getText();
+ String actualCompany = companyTextbox.getText();
+
+ if(actualEmail.isEmpty() || !actualEmail.matches(EMAIL_PATTERN)){
+
+ showError("Wrong or empty Email field");
+ return;
+
+ }
+
+ if(actualName.isEmpty() || !actualName.matches(NAME_SURNAME_PATTERN)){
+
+ showError("Wrong or empty Name field");
+ return;
+
+ }
+
+ if(actualSurname.isEmpty() || !actualSurname.matches(NAME_SURNAME_PATTERN)){
+
+ showError("Wrong or empty Surname field");
+ return;
+
+ }
+
+ // check if this user is already present among the people added with this portlet
+ boolean presentTable = parent.isUserPresent(actualEmail);
+
+ if(presentTable){
+
+ showAlertBlockThenHide(
+ errorBlock,
+ "Please note that a user with this email already exists",
+ HIDE_AFTER_MILLISECONDS
+ );
+
+ }else{
+
+ // show loading image
+ performingRequest.setVisible(true);
+
+ // disable add button
+ submit.setEnabled(false);
+
+ // remote service invocation
+ registrationService.register(
+ actualName,
+ actualSurname,
+ actualCompany,
+ actualEmail,
+ sendMailCheckbox.getValue(),
+ // maleCheckbox.getValue(),
+ true,
+ new AsyncCallback() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+
+ GWT.log("There was an error while adding the new user.", caught);
+ showAlertBlockThenHide(
+ errorBlock,
+ "It is not possible to add this user at the moment, retry later.",
+ HIDE_AFTER_MILLISECONDS);
+ }
+
+ @Override
+ public void onSuccess(VreUserBean result) {
+
+ if(result == null){
+
+ GWT.log("There was an error while adding the new user."
+ + " Are you sure he/she is not already present?");
+
+ showAlertBlockThenHide(
+ errorBlock,
+ "It is not possible to add this user at the moment, retry later."
+ + " Also check that he/she was not already registered in the portal.",
+ HIDE_AFTER_MILLISECONDS);
+
+ }else{
+
+ showAlertBlockThenHide(
+ successBlock,
+ "User correctly added to this VRE",
+ HIDE_AFTER_MILLISECONDS);
+
+ // append to the list of registered users
+ eventBus.fireEvent(new AddUserEvent(result));
+
+ }
+
+ }
+ });
+ }
+
+ // reset form
+ form.reset();
+ }
+
+ private void showAlertBlockThenHide(final AlertBlock alert, String msg, int hideAfterMs){
+
+ // hide loading image
+ performingRequest.setVisible(false);
+
+ // enable button again
+ submit.setEnabled(true);
+
+ // set text
+ alert.setText(msg);
+ alert.setVisible(true);
+
+ // hide after a while
+ Timer t = new Timer() {
+ @Override
+ public void run() {
+ alert.setVisible(false);
+ }
+ };
+ t.schedule(hideAfterMs);
+
+ }
+
+ private void showError(String msg) {
+
+ errorBlock.setText(msg);
+ errorBlock.setVisible(true);
+
+ }
+
+ private void hideAlertBlocks(){
+
+ errorBlock.setVisible(false);
+ successBlock.setVisible(false);
+ }
+
+ @UiHandler("emailTextbox")
+ void onChangeEmailTextbox(KeyUpEvent event){
+ hideAlertBlocks();
+ }
+
+ @UiHandler("nameTextbox")
+ void onChangeNameTextbox(KeyUpEvent event){
+ hideAlertBlocks();
+ }
+
+ @UiHandler("surnameTextbox")
+ void onChangeSurnameTextbox(KeyUpEvent event){
+ hideAlertBlocks();
+ }
+
+ @UiHandler("companyTextbox")
+ void onChangeCompanyTextbox(KeyUpEvent event){
+ hideAlertBlocks();
+ }
+
+}
diff --git a/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/ui/AddUserForm.ui.xml b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/ui/AddUserForm.ui.xml
new file mode 100644
index 0000000..a64e045
--- /dev/null
+++ b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/ui/AddUserForm.ui.xml
@@ -0,0 +1,120 @@
+
+
+
+ .form-main-style {
+ margin-left: 10px;
+ }
+
+ .fieldset-border-style {
+ border: 1px groove #444;
+ -webkit-box-shadow: 0px 0px 0px 0px #000;
+ box-shadow: 0px 0px 0px 0px #000;
+ padding: 10px;
+ }
+
+ .legend-style {
+ width: auto;
+ padding: 10px;
+ margin-bottom: 0px;
+ }
+
+ @external .form-horizontal .control-label;
+ .form-horizontal .control-label {
+ margin-bottom: 15px;
+ text-align: left;
+ }
+
+ @external .form-horizontal .input-large;
+ .form-horizontal .input-large {
+ width: 95%;
+ margin-bottom: 15px;
+ }
+
+ .block-alert-style {
+ margin-top: 10px;
+ padding: 10px;
+ }
+
+
+
+
+
+
+ Insert User Information
+ * is required
+
+
+
+
+
+ *
+ E-mail:
+
+
+
+
+
+
+ *
+ Name:
+
+
+
+
+
+
+ *
+ Surname:
+
+
+
+
+
+ Institution/Organization:
+
+
+
+
+ Send mail:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Add
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/ui/LoadingText.java b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/ui/LoadingText.java
new file mode 100644
index 0000000..a543721
--- /dev/null
+++ b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/ui/LoadingText.java
@@ -0,0 +1,19 @@
+package org.gcube.portlets.admin.createusers.client.ui;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.Widget;
+
+public class LoadingText extends Composite {
+
+ private static LoadingTextUiBinder uiBinder = GWT
+ .create(LoadingTextUiBinder.class);
+
+ interface LoadingTextUiBinder extends UiBinder {
+ }
+
+ public LoadingText() {
+ initWidget(uiBinder.createAndBindUi(this));
+ }
+}
diff --git a/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/ui/LoadingText.ui.xml b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/ui/LoadingText.ui.xml
new file mode 100644
index 0000000..2055b1b
--- /dev/null
+++ b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/ui/LoadingText.ui.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+ Please wait
+
+ Contacting database...
+
+
+
+
\ No newline at end of file
diff --git a/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/ui/RegisteredUsersTable.java b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/ui/RegisteredUsersTable.java
new file mode 100644
index 0000000..fa210e8
--- /dev/null
+++ b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/ui/RegisteredUsersTable.java
@@ -0,0 +1,432 @@
+package org.gcube.portlets.admin.createusers.client.ui;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+
+import org.gcube.portlets.admin.createusers.client.HandleUsersServiceAsync;
+import org.gcube.portlets.admin.createusers.client.event.AddUserEvent;
+import org.gcube.portlets.admin.createusers.client.event.AddUserEventHandler;
+import org.gcube.portlets.admin.createusers.shared.VreUserBean;
+
+import com.github.gwtbootstrap.client.ui.CellTable;
+import com.google.gwt.cell.client.ButtonCell;
+import com.google.gwt.cell.client.Cell;
+import com.google.gwt.cell.client.TextCell;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.EventTarget;
+import com.google.gwt.dom.client.NativeEvent;
+import com.google.gwt.event.shared.HandlerManager;
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
+import com.google.gwt.user.cellview.client.Column;
+import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.view.client.ListDataProvider;
+import com.google.gwt.view.client.Range;
+
+/**
+ * Show already registered users list.
+ * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
+ */
+public class RegisteredUsersTable extends Composite {
+
+ //CellTable custom UI resource
+ private CellTable.Resources tableRes = GWT.create(TableResources.class);
+ protected ListDataProvider dataProvider = new ListDataProvider();
+ private CellTable table = new CellTable(1, tableRes);
+ private final HandlerManager eventBus;
+
+ public RegisteredUsersTable(List registeredUsers, HandlerManager eventBus, final HandleUsersServiceAsync userServices) {
+
+ super();
+ initWidget(table);
+
+ // bind event
+ this.eventBus = eventBus;
+ bind();
+
+ dataProvider.setList(registeredUsers);
+ dataProvider.addDataDisplay(table);
+ table.setStriped(true);
+ table.setWidth("95%", false);
+ table.addStyleName("table-style");
+ table.setVisibleRange(new Range(0, registeredUsers.size()));
+ table.setBordered(true);
+ table.setRowCount(registeredUsers.size(), true);
+
+ // column for mail and sorting handler
+ Column emailCol = getColumn(new TextCell(), new GetValue() {
+ @Override
+ public String getValue(VreUserBean user) {
+ return user.getEmail();
+ }
+ });
+
+ ListHandler emailColHandler = new ListHandler(dataProvider.getList());
+ emailColHandler.setComparator(emailCol, new Comparator() {
+ @Override
+ public int compare(VreUserBean o1, VreUserBean o2) {
+
+ return o1.getEmail().compareTo(o2.getEmail());
+
+ }
+ });
+ emailCol.setSortable(true);
+ emailCol.setDefaultSortAscending(false);
+ table.addColumnSortHandler(emailColHandler);
+
+ // name column plus handler for sorting
+ Column nameCol = getColumn(new TextCell(), new GetValue() {
+ @Override
+ public String getValue(VreUserBean user) {
+ return user.getName();
+ }
+ });
+
+ ListHandler nameColHandler = new ListHandler(dataProvider.getList());
+ nameColHandler.setComparator(nameCol, new Comparator() {
+ @Override
+ public int compare(VreUserBean o1, VreUserBean o2) {
+
+ return o1.getName().compareTo(o2.getName());
+
+ }
+ });
+ nameCol.setSortable(true);
+ nameCol.setDefaultSortAscending(false);
+ table.addColumnSortHandler(nameColHandler);
+
+ // surname column plus handler for sorting
+ Column surnameCol = getColumn(new TextCell(), new GetValue() {
+ @Override
+ public String getValue(VreUserBean user) {
+ return user.getSurname();
+ }
+ });
+
+ ListHandler surnameColHandler = new ListHandler(dataProvider.getList());
+ nameColHandler.setComparator(surnameCol, new Comparator() {
+ @Override
+ public int compare(VreUserBean o1, VreUserBean o2) {
+
+ return o1.getSurname().compareTo(o2.getSurname());
+
+ }
+ });
+ surnameCol.setSortable(true);
+ surnameCol.setDefaultSortAscending(false);
+ table.addColumnSortHandler(surnameColHandler);
+
+ // institution/organization and handler for sorting
+ Column institutionCol = getColumn(new TextCell(), new GetValue() {
+ @Override
+ public String getValue(VreUserBean user) {
+ return user.getInstitution();
+ }
+ });
+
+ ListHandler institutionColHandler = new ListHandler(dataProvider.getList());
+ institutionColHandler.setComparator(institutionCol, new Comparator() {
+ @Override
+ public int compare(VreUserBean o1, VreUserBean o2) {
+
+ return o1.getInstitution().compareTo(o2.getInstitution());
+
+ }
+ });
+ institutionCol.setSortable(true);
+ institutionCol.setDefaultSortAscending(false);
+ table.addColumnSortHandler(institutionColHandler);
+
+ // password and handler for sorting
+ Column passwordChanged = getColumn(new TextCell(), new GetValue() {
+ @Override
+ public String getValue(VreUserBean user) {
+ return (user.isPasswordChanged() ? "True" : "False");
+ }
+ });
+
+ ListHandler passwordChangedColHandler = new ListHandler(dataProvider.getList());
+ passwordChangedColHandler.setComparator(passwordChanged, new Comparator() {
+ @Override
+ public int compare(VreUserBean o1, VreUserBean o2) {
+
+ String o1PasswordChangedString = o1.isPasswordChanged() ? "True" : "False";
+ String o2PasswordChangedString = o2.isPasswordChanged() ? "True" : "False";
+ return o1PasswordChangedString.compareTo(o2PasswordChangedString);
+
+ }
+ });
+ passwordChanged.setSortable(true);
+ passwordChanged.setDefaultSortAscending(false);
+ table.addColumnSortHandler(passwordChangedColHandler);
+
+ // registration column plus handler for sorting
+ Column registrationDate = getColumn(new TextCell(), new GetValue() {
+ @Override
+ public String getValue(VreUserBean user) {
+ return DateTimeFormat.getShortDateFormat().format(new Date(user.getRegisrationDate()));
+ }
+ });
+
+ ListHandler registrationDateColHandler = new ListHandler(dataProvider.getList());
+ registrationDateColHandler.setComparator(registrationDate, new Comparator() {
+ @Override
+ public int compare(VreUserBean o1, VreUserBean o2) {
+ return new Long(o1.getRegisrationDate()).compareTo(new Long(o2.getRegisrationDate()));
+
+ }
+ });
+ registrationDate.setDefaultSortAscending(false);
+ registrationDate.setSortable(true);
+ table.addColumnSortHandler(registrationDateColHandler);
+ table.getColumnSortList().push(registrationDate);
+
+ // delete option
+ Column deleteUser = new Column(new ButtonCell()) {
+
+ @Override
+ public String getValue(VreUserBean object) {
+ return object.isPasswordChanged() ? "True" : "False"; // useless
+ }
+
+ @Override
+ public void render(Cell.Context context, VreUserBean value, SafeHtmlBuilder sb){
+
+ if(value == null)
+ return;
+
+ if(!value.isPasswordChanged())
+ sb.appendHtmlConstant("");
+ else
+ sb.appendHtmlConstant("");
+
+ }
+
+ @Override
+ public void onBrowserEvent(Cell.Context context, final Element parent, final VreUserBean user, NativeEvent event) {
+ event.preventDefault();
+
+ if(!"click".equals(event.getType()))
+ return;
+
+ EventTarget eventTarget = event.getEventTarget();
+
+ if(parent.getFirstChildElement().isOrHasChild(Element.as(eventTarget))){
+
+ // get the button and disable it
+ parent.getFirstChildElement().setPropertyBoolean("disabled", true);
+
+ userServices.deleteInvitedUser(user.getEmail(), new AsyncCallback() {
+
+ @Override
+ public void onSuccess(Boolean result) {
+
+ // delete this row too
+ if(result){
+
+ dataProvider.getList().remove(user);
+ table.setVisibleRange(new Range(0, dataProvider.getList().size()));
+ table.setRowCount(dataProvider.getList().size(), true);
+ dataProvider.refresh();
+
+ Window.alert("Deleted user with email " + user.getEmail());
+
+ }else
+ Window.alert("Unable to delete this user, sorry!");
+
+ // enable the button again
+ parent.getFirstChildElement().setPropertyBoolean("disabled", false);
+
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+
+ Window.alert("Unable to delete this user, sorry!");
+
+ // enable the button again
+ parent.getFirstChildElement().setPropertyBoolean("disabled", false);
+
+ }
+ });
+ }
+ };
+ };
+
+ // send email option
+ Column sendWelcomeMessage = new Column(new ButtonCell()) {
+
+ @Override
+ public String getValue(VreUserBean object) {
+ return "Send Welcome"; // useless
+ }
+
+ @Override
+ public void render(Cell.Context context, VreUserBean value, SafeHtmlBuilder sb){
+
+ if(value == null)
+ return;
+
+ sb.appendHtmlConstant("");
+
+ }
+
+ @Override
+ public void onBrowserEvent(Cell.Context context, final Element parent, final VreUserBean user, NativeEvent event) {
+ event.preventDefault();
+
+ if(!"click".equals(event.getType()))
+ return;
+
+ EventTarget eventTarget = event.getEventTarget();
+
+ if(parent.getFirstChildElement().isOrHasChild(Element.as(eventTarget))){
+
+ // get the button and disable it
+ parent.getFirstChildElement().setPropertyBoolean("disabled", true);
+
+ userServices.sendEmailToUser(user.getEmail(), new AsyncCallback() {
+
+ @Override
+ public void onSuccess(Void result) {
+
+ Window.alert("Welcome message sent to " + user.getEmail());
+
+ // get the button and enable it
+ parent.getFirstChildElement().setPropertyBoolean("disabled", false);
+
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+
+ Window.alert("Unable to send the welcome message to " + user.getEmail());
+
+ // get the button and enable it
+ parent.getFirstChildElement().setPropertyBoolean("disabled", false);
+
+ }
+ });
+ }
+ }
+ };
+
+
+ // add columns
+ SafeHtmlBuilder builder = new SafeHtmlBuilder();
+ builder.appendHtmlConstant("");
+ builder.appendEscaped("Email");
+ builder.appendHtmlConstant("");
+ table.addColumn(emailCol, builder.toSafeHtml());
+ builder = new SafeHtmlBuilder();
+ builder.appendHtmlConstant("");
+ builder.appendEscaped("Name");
+ builder.appendHtmlConstant("");
+ table.addColumn(nameCol, builder.toSafeHtml());
+ builder = new SafeHtmlBuilder();
+ builder.appendHtmlConstant("");
+ builder.appendEscaped("Surname");
+ builder.appendHtmlConstant("");
+ table.addColumn(surnameCol, builder.toSafeHtml());
+ builder = new SafeHtmlBuilder();
+ builder.appendHtmlConstant("");
+ builder.appendEscaped("Institution / Organisation");
+ builder.appendHtmlConstant("");
+ table.addColumn(institutionCol, builder.toSafeHtml());
+ builder = new SafeHtmlBuilder();
+ builder.appendHtmlConstant("");
+ builder.appendEscaped("Password Changed");
+ builder.appendHtmlConstant("");
+ table.addColumn(passwordChanged, builder.toSafeHtml());
+ builder = new SafeHtmlBuilder();
+ builder.appendHtmlConstant("");
+ builder.appendEscaped("Registration date");
+ builder.appendHtmlConstant("");
+ table.addColumn(registrationDate, builder.toSafeHtml());
+ builder = new SafeHtmlBuilder();
+ builder.appendHtmlConstant("");
+ builder.appendEscaped("Delete");
+ builder.appendHtmlConstant("");
+ table.addColumn(deleteUser, builder.toSafeHtml());
+ builder = new SafeHtmlBuilder();
+ builder.appendHtmlConstant("");
+ builder.appendEscaped("Send Welcome");
+ builder.appendHtmlConstant("");
+ table.addColumn(sendWelcomeMessage, builder.toSafeHtml());
+ }
+
+ /**
+ * events binder
+ */
+ private void bind() {
+ eventBus.addHandler(AddUserEvent.TYPE, new AddUserEventHandler() {
+
+ @Override
+ public void onAddUser(AddUserEvent user) {
+
+ addUserToTable(user);
+
+ }
+ });
+ }
+
+ /**
+ * Update the list of registered users
+ * @param event
+ */
+ private void addUserToTable(AddUserEvent event) {
+
+ VreUserBean userToAdd = event.getAddedUserBean();
+ GWT.log("Adding " + userToAdd);
+ dataProvider.getList().add(userToAdd);
+ table.setVisibleRange(new Range(0, dataProvider.getList().size()));
+ table.setRowCount(dataProvider.getList().size(), true);
+ dataProvider.refresh();
+
+ }
+
+ /**
+ * Check if a user whit this email already exists
+ * @param actualEmail
+ * @return
+ */
+ public boolean isUserPresent(String actualEmail) {
+ List users = dataProvider.getList();
+
+ for (VreUserBean vreUserBean : users) {
+ if(vreUserBean.getEmail().equals(actualEmail))
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Interface for getting a cell value
+ * @param
+ */
+ private static interface GetValue {
+ C getValue(VreUserBean user);
+ }
+
+ /**
+ * get a column
+ *
+ * @param the cell type
+ * @param cell the cell used to render the column
+ * @param getter the value getter for the cell
+ */
+ private Column getColumn(Cell cell, final GetValue getter) {
+ Column column = new Column(cell) {
+ @Override
+ public C getValue(VreUserBean object) {
+ return getter.getValue(object);
+ }
+ };
+ return column;
+ }
+}
diff --git a/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/ui/Table.css b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/ui/Table.css
new file mode 100644
index 0000000..2f4eb08
--- /dev/null
+++ b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/ui/Table.css
@@ -0,0 +1,65 @@
+.cellTableHeader {
+/* padding: 0px; */
+/* color: #545454; */
+/* text-align: center !important; */
+/* font-size: 13px; */
+/* background-image: none; */
+/* background-color: #cfcfcf; */
+/* height: 25px; */
+ vertical-align: bottom!important;
+ font-weight: bold;
+/* text-shadow: 0 1px 1px rgba(255, 255, 255, .7); */
+/* border: 2px solid #999999; */
+}
+
+.cellTableFirstColumnHeader {
+}
+
+.cellTableLastColumnHeader {
+
+}
+
+.cellTableCell {
+ padding: 4px;
+/* text-align: center !important; */
+ vertical-align: middle !important;
+ overflow: hidden;
+ font-size: 12px;
+/* border: 1px dotted #999999; */
+}
+
+.cellTableEvenRow {
+
+}
+
+.cellTableOddRow {
+
+}
+
+.cellTableSelectedRow {
+ background: #628cd5;
+}
+
+.cellTableSelectedRowCell {
+
+}
+
+.cellTableHoveredRow {
+
+}
+
+.cellTableHoveredRowCell {
+
+}
+
+.cellTableKeyboardSelectedRow {
+ background: #c9c9c1;
+}
+
+.cellTableKeyboardSelectedRowCell {
+ border: none;
+}
+
+.cellTableKeyboardSelectedCell {
+ border: none;
+}
\ No newline at end of file
diff --git a/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/ui/TableResources.java b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/ui/TableResources.java
new file mode 100644
index 0000000..b8d0feb
--- /dev/null
+++ b/1.0/src/main/java/org/gcube/portlets/admin/createusers/client/ui/TableResources.java
@@ -0,0 +1,11 @@
+package org.gcube.portlets.admin.createusers.client.ui;
+
+import com.github.gwtbootstrap.client.ui.CellTable;
+
+public interface TableResources extends CellTable.Resources{
+
+ @Source({CellTable.Style.DEFAULT_CSS, "org/gcube/portlets/admin/createusers/client/ui/Table.css"})
+ TableStyle cellTableStyle();
+
+ interface TableStyle extends CellTable.Style {}
+}
diff --git a/1.0/src/main/java/org/gcube/portlets/admin/createusers/server/CreateUsersImpl.java b/1.0/src/main/java/org/gcube/portlets/admin/createusers/server/CreateUsersImpl.java
new file mode 100644
index 0000000..8b7f3e3
--- /dev/null
+++ b/1.0/src/main/java/org/gcube/portlets/admin/createusers/server/CreateUsersImpl.java
@@ -0,0 +1,551 @@
+package org.gcube.portlets.admin.createusers.server;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.mail.internet.InternetAddress;
+
+import org.gcube.application.framework.core.session.ASLSession;
+import org.gcube.application.framework.core.session.SessionManager;
+import org.gcube.common.homelibrary.home.HomeLibrary;
+import org.gcube.common.portal.PortalContext;
+import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
+import org.gcube.portlets.admin.createusers.client.HandleUsersService;
+import org.gcube.portlets.admin.createusers.shared.VreUserBean;
+import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
+import org.gcube.vomanagement.usermanagement.exception.UserManagementPortalException;
+import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
+import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayGroupManager;
+import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayUserManager;
+import org.gcube.vomanagement.usermanagement.model.GCubeUser;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.gwt.user.server.rpc.RemoteServiceServlet;
+import com.liferay.mail.service.MailServiceUtil;
+import com.liferay.portal.kernel.dao.jdbc.DataAccess;
+import com.liferay.portal.kernel.exception.PortalException;
+import com.liferay.portal.kernel.exception.SystemException;
+import com.liferay.portal.kernel.mail.MailMessage;
+import com.liferay.portal.kernel.util.GetterUtil;
+import com.liferay.portal.kernel.util.PropsUtil;
+import com.liferay.portal.model.Company;
+import com.liferay.portal.service.CompanyLocalServiceUtil;
+import com.liferay.portal.service.UserLocalServiceUtil;
+import com.liferay.portal.util.PortalUtil;
+
+/**
+ * The server side implementation of the RPC service.
+ * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
+ */
+public class CreateUsersImpl extends RemoteServiceServlet implements HandleUsersService{
+
+ private final static Logger logger = LoggerFactory.getLogger(CreateUsersImpl.class);
+ private static final long serialVersionUID = -3124676000683430170L;
+ private static final String REGISTERED_USERS_TABLE = "registered_users";
+
+ //dev user
+ public static final String userid = "test.user";
+
+ //dev vre
+ private static final String vreID = "/gcube/devsec/devVRE";
+
+ // SQL TABLE FIELDS
+ private static final String FIELD_EMAIL = "email";
+ private static final String FIELD_NAME = "name";
+ private static final String FIELD_SURNAME = "surname";
+ private static final String FIELD_INSTITUTION = "institution_organization";
+ private static final String FIELD_REGISTRATION_DATE = "registration_date";
+ private static final String FIELD_VRE = "vre";
+
+ public static final String DEFAULT_COMPANY_WEB_ID = "liferay.com";
+
+ @Override
+ public void init(){
+
+ logger.debug("Trying to get connect to liferay's DB from API");
+ try {
+
+ Connection con = DataAccess.getConnection();
+ logger.debug("Connected!");
+
+ // check if the table already exists
+ boolean exists = tableExists(con);
+
+ if(exists){
+ logger.debug("Table " + REGISTERED_USERS_TABLE + " already exists.");
+ }
+ else{
+ initializeTable(con);
+ }
+ } catch (Exception e) {
+ logger.error("Failed to connect to liferay's DB");
+ return;
+ }
+ }
+
+ /**
+ * check if tables exist in the database
+ * @param conn .
+ * @throws SQLException
+ */
+ private boolean tableExists(Connection con) throws SQLException {
+ logger.debug("Looking for " + REGISTERED_USERS_TABLE + " table");
+ Statement s = con.createStatement();
+ ResultSet rs = s.executeQuery("SELECT * FROM pg_tables where schemaname='public' and tablename = '" + REGISTERED_USERS_TABLE +"' ");
+ boolean toReturn = rs.next();
+ if (toReturn)
+ logger.debug("Auxiliary Table Found! Returning ... ");
+ return toReturn;
+ }
+
+ /**
+ * create the table REGISTERED_USERS_TABLE
+ * @throws SQLException
+ */
+ private void initializeTable(Connection con) {
+ try {
+
+ logger.debug("Creating table " + REGISTERED_USERS_TABLE);
+ Statement s = con.createStatement();
+
+ s.execute("CREATE TABLE " + REGISTERED_USERS_TABLE
+ + " (id serial primary key, " // like autoincrement
+ + "email varchar(255) NOT NULL, "
+ + "name" + " varchar(255) NOT NULL, "
+ + "surname" + " varchar(255) NOT NULL, "
+ + "institution_organization" + " varchar(255) DEFAULT NULL, "
+ + "vre" + " varchar(255) NOT NULL, "
+ + "registration_date" + " TIMESTAMP NOT NULL)");
+
+ logger.debug(REGISTERED_USERS_TABLE + " created");
+
+ } catch (SQLException e) {
+ logger.error("Error while creating table", e);
+ }
+ try {
+ con.close();
+ } catch (SQLException e1) {
+ logger.error("Error while closing connection", e1);
+ }
+ }
+
+
+ /**
+ * the current ASLSession
+ * @return the session
+ */
+ private ASLSession getASLSession() {
+
+ String sessionID = this.getThreadLocalRequest().getSession().getId();
+ String user = (String) this.getThreadLocalRequest().getSession().getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
+
+ if (user == null) {
+
+ logger.warn("USER IS NULL setting " + userid + " and Running OUTSIDE PORTAL");
+ user = getDevelopmentUser();
+ SessionManager.getInstance().getASLSession(sessionID, user).setScope(vreID);
+
+ }
+
+ return SessionManager.getInstance().getASLSession(sessionID, user);
+ }
+
+ /**
+ * Online or in development mode?
+ * @return true if you're running into the portal, false if in development
+ */
+ private boolean isWithinPortal() {
+ try {
+ UserLocalServiceUtil.getService();
+ return true;
+ }
+ catch (com.liferay.portal.kernel.bean.BeanLocatorException ex) {
+ logger.trace("Development Mode ON");
+ return false;
+ }
+ }
+
+ /**
+ * when packaging test will fail if the user is not set to test.user
+ * @return .
+ */
+ public String getDevelopmentUser() {
+ String user = userid;
+ // user = "costantino.perciante";
+ return user;
+ }
+
+ @Override
+ public boolean deleteInvitedUser(String email) {
+
+ // if in dev mode return some samples
+ if (!isWithinPortal()) {
+
+ logger.debug("In dev mode.");
+ return false;
+
+ }else{
+
+ try{
+
+ Connection con = DataAccess.getConnection();
+ boolean deletedLiferay = deleteUserFromLiferay(email);
+ boolean deletedTable = deleteUserFromTable(email, con);
+ return deletedLiferay && deletedTable;
+
+ }catch(SQLException e){
+ logger.debug("Error while trying to delete user with email = " + email, e);
+ }
+
+ return false;
+ }
+ }
+
+ @Override
+ public void sendEmailToUser(String email) {
+
+ logger.debug("Sending welcome message to user with email " + email);
+ try{
+
+ PortalContext context = PortalContext.getConfiguration();
+ String gatewayName = context.getGatewayName();
+ String emailSender = context.getSenderEmail();
+
+ InternetAddress to = new InternetAddress(email);
+ InternetAddress from = new InternetAddress(emailSender);
+
+ LiferayUserManager userManager = new LiferayUserManager();
+ String portalUrl = PortalUtil.getPortalURL(getCompany().getVirtualHost(), 443, true);
+ String username = userManager.getFullNameFromEmail(email);
+
+ MailMessage mailMessage = new MailMessage();
+ mailMessage.setFrom(from);
+ mailMessage.setTo(to);
+
+ String body = "
Dear " + username + ", " + " " +
+ "Welcome! You recently created an account at " + portalUrl + ". Your password is not sent by email for security purposes. " +
+ " " + "Sincerely, " +
+ gatewayName + " " +
+ emailSender + " " + portalUrl;
+ String subject = portalUrl + ": Your New Account was created successfully!";
+
+ mailMessage.setBody(body);
+ mailMessage.setSubject(subject);
+ mailMessage.setHTMLFormat(true);
+ MailServiceUtil.sendEmail(mailMessage);
+ }catch(Exception e){
+ logger.error("Error while sending email to user " + email, e);
+ }
+
+ }
+
+
+ @Override
+ public VreUserBean register(String name, String surname, String institution,
+ String email, boolean sendEmail, boolean isMale) {
+
+ // if in dev mode return ok
+ if (!isWithinPortal()) {
+
+ logger.debug("In dev mode.");
+ return new VreUserBean(name, surname, institution, email, false, System.currentTimeMillis(), isMale);
+
+ }else{
+
+ ASLSession session = getASLSession();
+ String userName = session.getUsername();
+
+ //in case the portal is restarted and you have the social home open it will get test.user (no callback to set session info)
+ //this check just return nothing if that happens
+ if (userName.compareTo("test.user") == 0) {
+ logger.debug("Found " + userName + " returning nothing");
+ return null;
+ }
+
+ String vre = session.getScopeName();
+ long timestamp = System.currentTimeMillis();
+
+ //checking if the user has been already registered or is already in the portal
+ LiferayUserManager userManager = new LiferayUserManager();
+ boolean exists = userManager.userExistsByEmail(email);
+
+ if(exists){
+
+ logger.debug("User with this email already present in the portal.");
+ return null;
+
+ }
+ else{
+
+ logger.debug("Trying to add user: " + name + ", " + surname + ", " + email + ", " + institution);
+ Connection con = null;
+ try{
+
+ con = DataAccess.getConnection();
+ String insert = "INSERT into " + REGISTERED_USERS_TABLE +
+ "("+ FIELD_EMAIL + ","
+ + FIELD_NAME +","
+ + FIELD_SURNAME + ","
+ + FIELD_INSTITUTION + ","
+ + FIELD_REGISTRATION_DATE + ","
+ + FIELD_VRE
+ + ") values(?, ?, ?, ?, ?, ?)";
+
+ PreparedStatement statement = con.prepareStatement(insert);
+
+ statement.setString(1, email);
+ statement.setString(2, name);
+ statement.setString(3, surname);
+ statement.setString(4, institution);
+ statement.setTimestamp(5, new Timestamp(timestamp));
+ statement.setString(6, vre);
+ int res = statement.executeUpdate();
+
+ if(res != 0){
+
+ logger.debug("User added in " + REGISTERED_USERS_TABLE);
+
+ // add in liferay too
+ try{
+ GCubeUser user = userManager.createUser(
+ true,
+ "",
+ email,
+ name,
+ "",
+ surname,
+ institution,
+ "",
+ isMale,
+ null,
+ null,
+ sendEmail, // determine if we need to send him/her an email
+ true); // force the password reset
+
+ // adding to the current VRE
+ userManager.assignUserToGroup(getCurrentGroupID(), userManager.getUserId(user.getUsername()));
+
+ //adding to the HL
+ addUserToHLGroup(user.getUsername(), session.getScope());
+
+ }catch(Exception e){
+
+ // unable to create.. we need to delete it from the list of users
+ logger.error("Unable to create the user " + email + " in liferay. Removing he/she from the table " +
+ REGISTERED_USERS_TABLE, e);
+
+ deleteUserFromTable(email, con);
+ return null;
+ }
+ }
+ else{
+
+ logger.debug("User NOT added in " + REGISTERED_USERS_TABLE);
+ return null;
+ }
+ }catch(Exception e){
+ logger.error("Unable to add user, sorry..", e);
+ return null;
+ }finally{
+ try {
+ if(con != null)
+ con.close();
+ } catch (SQLException e) {
+ logger.error("Unable to close connection to the DB");
+ }
+ }
+
+ return new VreUserBean(name, surname, institution, email, false, timestamp, isMale);
+ }
+ }
+ }
+
+ @Override
+ public List getAlreadyRegisterdUsers() {
+
+ List toReturn = new ArrayList();
+
+ // if in dev mode return some samples
+ if (!isWithinPortal()) {
+
+ logger.debug("In dev mode.");
+ toReturn.add(new VreUserBean("Dylan", "Dog", "ISTI-CNR", "dylan.dog@gmail.com", true, System.currentTimeMillis(), true));
+ toReturn.add(new VreUserBean("Costantino", "Perciante", "ISTI-CNR", "costantino8@gmail.com", false, System.currentTimeMillis(), true));
+ return toReturn;
+
+ }else{
+
+ LiferayUserManager userManager = new LiferayUserManager();
+ ASLSession session = getASLSession();
+ String userName = session.getUsername();
+
+ //in case the portal is restarted and you have the social home open it will get test.user (no callback to set session info)
+ //this check just return nothing if that happens
+ if (userName.compareTo("test.user") == 0) {
+ logger.debug("Found " + userName + " returning nothing");
+ return null;
+ }
+
+ // evaluate current vre
+ String vre = session.getScopeName();
+
+ Connection con = null;
+ try{
+
+ con = DataAccess.getConnection();
+ Statement stmt = con.createStatement();
+
+ String sql = "SELECT * FROM " + REGISTERED_USERS_TABLE + " WHERE " + FIELD_VRE + "='" + vre + "';";
+ ResultSet rs = stmt.executeQuery(sql);
+
+ while(rs.next()){
+
+ String name = rs.getString(FIELD_NAME);
+ String surname = rs.getString(FIELD_SURNAME);
+ String institution = rs.getString(FIELD_INSTITUTION);
+ String email = rs.getString(FIELD_EMAIL);
+ long registrationDate = rs.getTimestamp(FIELD_REGISTRATION_DATE).getTime();
+
+ // check if the password has been changed or not wrt the default one
+ boolean passwordChanged = userManager.isPasswordChanged(email);
+
+
+ toReturn.add(new VreUserBean(name, surname, institution, email, passwordChanged, registrationDate, false));
+
+ }
+
+ // now, make sure these users are still on portal
+ Iterator iterator = toReturn.iterator();
+ while (iterator.hasNext()) {
+ VreUserBean user = (VreUserBean) iterator.next();
+
+ if(!userManager.userExistsByEmail(user.getEmail())){
+
+ // remove from the table
+ deleteUserFromTable(user.getEmail(), con);
+
+ // remove from this collection
+ iterator.remove();
+
+ }
+ }
+
+ }catch(Exception e){
+ logger.error("Unable to retrieve users list, sorry...", e);
+ return null;
+ }finally{
+ try {
+ if(con != null)
+ con.close();
+ } catch (SQLException e) {
+ logger.error("Unable to close connection to the DB");
+ }
+ }
+
+ return toReturn;
+ }
+ }
+
+ /**
+ * Remove a row from the table of the registered users
+ * @param email
+ * @param con
+ */
+ private boolean deleteUserFromTable(String email, Connection con) {
+
+ try{
+
+ logger.debug("Going to delete user with email " + email + " from the table of registered users");
+
+ String remove = "DELETE FROM " + REGISTERED_USERS_TABLE + " WHERE " + FIELD_EMAIL + "= ?";
+ PreparedStatement statementDelete = con.prepareStatement(remove);
+ statementDelete.setString(1, email);
+ int res = statementDelete.executeUpdate();
+
+ if(res == 1)
+ return true;
+
+ }catch(Exception e){
+
+ logger.error("Error while deleting user=" + email + "from the table");
+ }
+
+ return false;
+ }
+
+ /**
+ * Delete user from liferay
+ * @param email
+ */
+ private boolean deleteUserFromLiferay(String email) {
+
+ LiferayUserManager userManager = new LiferayUserManager();
+ try {
+ userManager.deleteUserByEMail(email);
+ return true;
+ } catch (PortalException | SystemException
+ | UserManagementSystemException | UserManagementPortalException e) {
+ logger.error("Unable to delete user from liferay", e);
+ }
+
+ return false;
+ }
+
+ /**
+ * Add user to Home Library Group
+ * @param username
+ * @param group
+ */
+ private void addUserToHLGroup(String username, String group) {
+ try {
+ org.gcube.common.homelibrary.home.workspace.usermanager.UserManager um = HomeLibrary.getHomeManagerFactory().getUserManager();
+ um.associateUserToGroup(group, username);
+ } catch (Exception e) {
+ logger.error("Failed to get the usermanager from HL. Could not add user to the HL group");
+ }
+ }
+
+ /**
+ * Get the current group ID
+ *
+ * @return the current group ID or null if an exception is thrown
+ * @throws Exception
+ */
+ private String getCurrentGroupID() {
+ ASLSession session = getASLSession();
+ logger.debug("The current group NAME is --> " + session.getGroupName());
+ String toReturn = null;
+ try {
+ toReturn = new LiferayGroupManager().getGroupId(session.getGroupName());
+ } catch (UserManagementSystemException | GroupRetrievalFault e) {
+ logger.error("Unable to retrieve id for group " + session.getGroupName());
+ }
+ return toReturn;
+ }
+
+ public static Company getCompany() throws PortalException, SystemException {
+ return CompanyLocalServiceUtil.getCompanyByWebId(getDefaultCompanyWebId());
+ }
+ /**
+ *
+ * @return the default company web-id (e.g. iMarine.eu)
+ */
+ public static String getDefaultCompanyWebId() {
+ String defaultWebId = "";
+ try {
+ defaultWebId = GetterUtil.getString(PropsUtil.get("company.default.web.id"));
+ }
+ catch (NullPointerException e) {
+ logger.error("Cound not find property company.default.web.id in portal.ext file returning default web id: " + DEFAULT_COMPANY_WEB_ID);
+ return DEFAULT_COMPANY_WEB_ID;
+ }
+ return defaultWebId;
+ }
+}
diff --git a/1.0/src/main/java/org/gcube/portlets/admin/createusers/server/portlet/CreateUsersPortlet.java b/1.0/src/main/java/org/gcube/portlets/admin/createusers/server/portlet/CreateUsersPortlet.java
new file mode 100644
index 0000000..88b296a
--- /dev/null
+++ b/1.0/src/main/java/org/gcube/portlets/admin/createusers/server/portlet/CreateUsersPortlet.java
@@ -0,0 +1,28 @@
+
+package org.gcube.portlets.admin.createusers.server.portlet;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.ActionRequest;
+import javax.portlet.RenderRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import java.io.IOException;
+import javax.portlet.PortletRequestDispatcher;
+import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
+
+/**
+ * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
+ */
+ public class CreateUsersPortlet extends GenericPortlet {
+ public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
+ response.setContentType("text/html");
+ ScopeHelper.setContext(request);
+ PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/CreateUsers_view.jsp");
+ dispatcher.include(request, response);
+ }
+
+ public void processAction(ActionRequest request, ActionResponse response)
+ throws PortletException, IOException {
+ }
+}
diff --git a/1.0/src/main/java/org/gcube/portlets/admin/createusers/shared/VreUserBean.java b/1.0/src/main/java/org/gcube/portlets/admin/createusers/shared/VreUserBean.java
new file mode 100644
index 0000000..95b1ec1
--- /dev/null
+++ b/1.0/src/main/java/org/gcube/portlets/admin/createusers/shared/VreUserBean.java
@@ -0,0 +1,115 @@
+package org.gcube.portlets.admin.createusers.shared;
+
+import java.io.Serializable;
+
+/**
+ * Information of an already registered user to the VRE.
+ * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
+ */
+public class VreUserBean implements Serializable{
+
+ private static final long serialVersionUID = -8674087530839002999L;
+
+ private String name;
+ private String surname;
+ private String institution;
+ private String email;
+ private boolean passwordChanged;
+ private long regisrationDate;
+ private boolean isMale;
+
+ /**
+ * Build a default user bean object.
+ */
+ public VreUserBean(){
+ super();
+ }
+
+ /**
+ * Build a user bean object.
+ * @param name
+ * @param surname
+ * @param institution
+ * @param email
+ * @param passwordChanged
+ * @param registrationDate
+ * @param isMale
+ */
+ public VreUserBean(String name, String surname, String institution,
+ String email, boolean passwordChanged, long registrationDate, boolean isMale) {
+ super();
+ this.name = name;
+ this.surname = surname;
+ this.institution = institution;
+ this.email = email;
+ this.passwordChanged = passwordChanged;
+ this.regisrationDate = registrationDate;
+ this.isMale = isMale;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getSurname() {
+ return surname;
+ }
+
+ public void setSurname(String surname) {
+ this.surname = surname;
+ }
+
+ public String getInstitution() {
+ return institution;
+ }
+
+ public void setInstitution(String institution) {
+ this.institution = institution;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public boolean isPasswordChanged() {
+ return passwordChanged;
+ }
+
+ public void setPasswordChanged(boolean passwordChanged) {
+ this.passwordChanged = passwordChanged;
+ }
+
+
+ public long getRegisrationDate() {
+ return regisrationDate;
+ }
+
+ public void setRegisrationDate(long regisrationDate) {
+ this.regisrationDate = regisrationDate;
+ }
+
+
+ public boolean isMale() {
+ return isMale;
+ }
+
+ public void setMale(boolean isMale) {
+ this.isMale = isMale;
+ }
+
+ @Override
+ public String toString() {
+ return "VreUserBean [name=" + name + ", surname=" + surname
+ + ", institution=" + institution + ", email=" + email
+ + ", passwordChanged=" + passwordChanged + ", regisrationDate="
+ + regisrationDate + ", isMale=" + isMale + "]";
+ }
+}
diff --git a/1.0/src/main/resources/clientlog4j.properties b/1.0/src/main/resources/clientlog4j.properties
new file mode 100644
index 0000000..4a2e1cd
--- /dev/null
+++ b/1.0/src/main/resources/clientlog4j.properties
@@ -0,0 +1,12 @@
+log4j.rootLogger=DEBUG, A1
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+
+# Print the date in ISO 8601 format
+log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
+
+# Print only messages of level TRACE or above in the package org.gcube
+log4j.logger.org.gcube=TRACE
+log4j.logger.org.gcube.application.framework.core.session=INFO
+log4j.logger.org.gcube.common.scope.impl.DefaultScopeProvider=ERROR
+log4j.logger.com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor=ERROR
\ No newline at end of file
diff --git a/1.0/src/main/resources/org/gcube/portlets/admin/createusers/CreateUsers.gwt.xml b/1.0/src/main/resources/org/gcube/portlets/admin/createusers/CreateUsers.gwt.xml
new file mode 100644
index 0000000..e2598b2
--- /dev/null
+++ b/1.0/src/main/resources/org/gcube/portlets/admin/createusers/CreateUsers.gwt.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/1.0/src/main/webapp/CreateUsers.css b/1.0/src/main/webapp/CreateUsers.css
new file mode 100644
index 0000000..4f112f8
--- /dev/null
+++ b/1.0/src/main/webapp/CreateUsers.css
@@ -0,0 +1,12 @@
+/** Add css rules here for your application. */
+.portlet-title-style {
+ display: block;
+ font-size: 16px;
+ color: #555;
+ font-weight: bolder;
+ margin-bottom: 10px;
+}
+
+.table-style {
+ margin-left: 10px;
+}
\ No newline at end of file
diff --git a/1.0/src/main/webapp/CreateUsers.html b/1.0/src/main/webapp/CreateUsers.html
new file mode 100644
index 0000000..fbb7962
--- /dev/null
+++ b/1.0/src/main/webapp/CreateUsers.html
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Create users portlet
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/1.0/src/main/webapp/WEB-INF/js/jquery.autosize.js b/1.0/src/main/webapp/WEB-INF/js/jquery.autosize.js
new file mode 100644
index 0000000..370279e
--- /dev/null
+++ b/1.0/src/main/webapp/WEB-INF/js/jquery.autosize.js
@@ -0,0 +1,187 @@
+/*!
+ jQuery Autosize v1.16.12
+ (c) 2013 Jack Moore - jacklmoore.com
+ updated: 2013-05-31
+ license: http://www.opensource.org/licenses/mit-license.php
+*/
+
+(function ($) {
+ var
+ defaults = {
+ className: 'autosizejs',
+ append: '',
+ callback: false
+ },
+ hidden = 'hidden',
+ borderBox = 'border-box',
+ lineHeight = 'lineHeight',
+
+ // border:0 is unnecessary, but avoids a bug in FireFox on OSX
+ copy = '',
+
+ // line-height is conditionally included because IE7/IE8/old Opera do not return the correct value.
+ copyStyle = [
+ 'fontFamily',
+ 'fontSize',
+ 'fontWeight',
+ 'fontStyle',
+ 'letterSpacing',
+ 'textTransform',
+ 'wordSpacing',
+ 'textIndent'
+ ],
+ oninput = 'oninput',
+ onpropertychange = 'onpropertychange',
+
+ // to keep track which textarea is being mirrored when adjust() is called.
+ mirrored,
+
+ // the mirror element, which is used to calculate what size the mirrored element should be.
+ mirror = $(copy).data('autosize', true)[0];
+
+ // test that line-height can be accurately copied.
+ mirror.style.lineHeight = '99px';
+ if ($(mirror).css(lineHeight) === '99px') {
+ copyStyle.push(lineHeight);
+ }
+ mirror.style.lineHeight = '';
+
+ $.fn.autosize = function (options) {
+ options = $.extend({}, defaults, options || {});
+
+ if (mirror.parentNode !== document.body) {
+ $(document.body).append(mirror);
+ }
+
+ return this.each(function () {
+ var
+ ta = this,
+ $ta = $(ta),
+ minHeight,
+ maxHeight,
+ resize,
+ boxOffset = 0,
+ callback = $.isFunction(options.callback);
+
+ if ($ta.data('autosize')) {
+ // exit if autosize has already been applied, or if the textarea is the mirror element.
+ return;
+ }
+
+ if ($ta.css('box-sizing') === borderBox || $ta.css('-moz-box-sizing') === borderBox || $ta.css('-webkit-box-sizing') === borderBox){
+ boxOffset = $ta.outerHeight() - $ta.height();
+ }
+
+ // IE8 and lower return 'auto', which parses to NaN, if no min-height is set.
+ minHeight = Math.max(parseInt($ta.css('minHeight'), 10) - boxOffset || 0, $ta.height());
+
+ resize = ($ta.css('resize') === 'none' || $ta.css('resize') === 'vertical') ? 'none' : 'horizontal';
+
+ $ta.css({
+ overflow: hidden,
+ overflowY: hidden,
+ wordWrap: 'break-word',
+ resize: resize
+ }).data('autosize', true);
+
+ function initMirror() {
+ mirrored = ta;
+ mirror.className = options.className;
+ maxHeight = parseInt($ta.css('maxHeight'), 10);
+
+ // mirror is a duplicate textarea located off-screen that
+ // is automatically updated to contain the same text as the
+ // original textarea. mirror always has a height of 0.
+ // This gives a cross-browser supported way getting the actual
+ // height of the text, through the scrollTop property.
+ $.each(copyStyle, function(i, val){
+ mirror.style[val] = $ta.css(val);
+ });
+
+ // The textarea overflow is probably now hidden, but Chrome doesn't reflow the text to account for the
+ // new space made available by removing the scrollbars. This workaround causes Chrome to reflow the text.
+ if (oninput in ta) {
+ var value = ta.value;
+ ta.value = '';
+ ta.value = value;
+ }
+ }
+
+ // Using mainly bare JS in this function because it is going
+ // to fire very often while typing, and needs to very efficient.
+ function adjust() {
+ var height, overflow, original;
+
+ if (mirrored !== ta) {
+ initMirror();
+ }
+
+ mirror.value = ta.value + options.append;
+ mirror.style.overflowY = ta.style.overflowY;
+ original = parseInt(ta.style.height,10);
+
+ // Update the width in case the original textarea width has changed
+ // A floor of 0 is needed because IE8 returns a negative value for hidden textareas, raising an error.
+ mirror.style.width = Math.max($ta.width(), 0) + 'px';
+
+ // Needed for IE8 and lower to reliably return the correct scrollTop
+ mirror.scrollTop = 0;
+
+ mirror.scrollTop = 9e4;
+
+ // Using scrollTop rather than scrollHeight because scrollHeight is non-standard and includes padding.
+ height = mirror.scrollTop;
+
+ if (maxHeight && height > maxHeight) {
+ height = maxHeight;
+ overflow = 'scroll';
+ } else if (height < minHeight) {
+ height = minHeight;
+ }
+
+ height += boxOffset;
+ ta.style.overflowY = overflow || hidden;
+
+ if (original !== height) {
+ ta.style.height = height + 'px';
+ if (callback) {
+ options.callback.call(ta,ta);
+ }
+ }
+ }
+
+ if (onpropertychange in ta) {
+ if (oninput in ta) {
+ // Detects IE9. IE9 does not fire onpropertychange or oninput for deletions,
+ // so binding to onkeyup to catch most of those occassions. There is no way that I
+ // know of to detect something like 'cut' in IE9.
+ ta[oninput] = ta.onkeyup = adjust;
+ } else {
+ // IE7 / IE8
+ ta[onpropertychange] = function(){
+ if(event.propertyName === 'value'){
+ adjust();
+ }
+ };
+ }
+ } else {
+ // Modern Browsers
+ ta[oninput] = adjust;
+ }
+
+ $(window).on('resize', function(){
+ active = false;
+ adjust();
+ });
+
+ // Allow for manual triggering if needed.
+ $ta.on('autosize', function(){
+ active = false;
+ adjust();
+ });
+
+ // Call adjust in case the textarea already contains text.
+ adjust();
+ });
+ };
+}(window.jQuery || window.Zepto));
diff --git a/1.0/src/main/webapp/WEB-INF/js/jquery.min.js b/1.0/src/main/webapp/WEB-INF/js/jquery.min.js
new file mode 100644
index 0000000..aab8994
--- /dev/null
+++ b/1.0/src/main/webapp/WEB-INF/js/jquery.min.js
@@ -0,0 +1,6 @@
+/*! jQuery v1.10.0 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
+//@ sourceMappingURL=jquery.min.map
+*/
+(function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.0",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n))for(i in n)x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++)if(null!=(o=arguments[l]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body)return setTimeout(x.ready);x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!v.call(e,"constructor")&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(x.support.ownLast)for(n in e)return v.call(e,n);for(n in e);return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||x.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m)return m.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r)x.access(e,n,l,r[l],!0,a,s)}else if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(x(e),n)})),n))for(;u>l;l++)n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)));return o?e:c?n.call(e):u?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),x.ready.promise=function(t){if(!n)if(n=x.Deferred(),"complete"===a.readyState)setTimeout(x.ready);else if(a.addEventListener)a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1);else{a.attachEvent("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}return n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=lt(),k=lt(),E=lt(),S=!1,A=function(){return 0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t){_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e)return n;if(1!==(l=t.nodeType)&&9!==l)return[];if(h&&!i){if(o=Z.exec(e))if(s=o[1]){if(9===l){if(a=t.getElementById(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return M.apply(n,t.getElementsByTagName(e)),n;if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName)return M.apply(n,t.getElementsByClassName(s)),n}if(r.qsa&&(!g||!g.test(e))){if(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=bt(e),(d=t.getAttribute("id"))?m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--)c[u]=m+xt(c[u]);y=V.test(e)&&t.parentNode||t,x=c.join(",")}if(x)try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||t.removeAttribute("id")}}}return At(e.replace(z,"$1"),t,n,i)}function st(e){return K.test(e+"")}function lt(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function ut(e){return e[b]=!0,e}function ct(e){var t=f.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function pt(e,t,n){e=e.split("|");var r,i=e.length,a=n?null:t;while(i--)(r=o.attrHandle[e[i]])&&r!==t||(o.attrHandle[e[i]]=a)}function ft(e,t){var n=e.getAttributeNode(t);return n&&n.specified?n.value:e[t]===!0?t.toLowerCase():null}function dt(e,t){return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}function ht(e){return"input"===e.nodeName.toLowerCase()?e.defaultValue:t}function gt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function mt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function yt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function vt(e){return ut(function(t){return t=+t,ut(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s(n),r.attributes=ct(function(e){return e.innerHTML="",pt("type|href|height|width",dt,"#"===e.firstChild.getAttribute("href")),pt(B,ft,null==e.getAttribute("disabled")),e.className="i",!e.getAttribute("className")}),r.input=ct(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")}),pt("value",ht,r.attributes&&r.input),r.getElementsByTagName=ct(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ct(function(e){return e.innerHTML="",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ct(function(e){return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=st(n.querySelectorAll))&&(ct(function(e){e.innerHTML="",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ct(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=st(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ct(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=st(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},r.sortDetached=ct(function(e){return 1&e.compareDocumentPosition(n.createElement("div"))}),A=d.compareDocumentPosition?function(e,t){if(e===t)return S=!0,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return S=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:c?F.call(c,e)-F.call(c,t):0;if(o===a)return gt(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?gt(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||g&&g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(i){}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++])t===e[o]&&(i=n.push(o));while(i--)e.splice(n[i],1)}return e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=a(t);return n},o=at.selectors={cacheLength:50,createPseudo:ut,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=bt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]={}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}else if(v&&(u=(t[b]||(t[b]={}))[e])&&u[0]===T)f=u[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?ut(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=F.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ut(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r[b]?ut(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:ut(function(e){return function(t){return at(e,t).length>0}}),contains:ut(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:ut(function(e){return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:vt(function(){return[0]}),last:vt(function(e,t){return[t-1]}),eq:vt(function(e,t,n){return[0>n?n+t:n]}),even:vt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:vt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:vt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:vt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=mt(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=yt(n);function bt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in o.filter)!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?at.error(e):k(e,l).slice(0)}function xt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function wt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while(t=t[r])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||o)if(c=t[b]||(t[b]={}),(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i)return l===!0}else if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0)return!0}}function Tt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function Ct(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),u&&t.push(s));return a}function Nt(e,t,n,r,i,o){return r&&!r[b]&&(r=Nt(r)),i&&!i[b]&&(i=Nt(i,o)),ut(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||St(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:Ct(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=Ct(y,d),r(u,[],s,l),c=u.length;while(c--)(p=u[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){u=[],c=y.length;while(c--)(p=y[c])&&u.push(m[c]=p);i(null,y=[],u,l)}c=y.length;while(c--)(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}else y=Ct(y===a?y.splice(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)})}function kt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],l=a?1:0,c=wt(function(e){return e===t},s,!0),p=wt(function(e){return F.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++)if(n=o.relative[e[l].type])f=[wt(Tt(f),n)];else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++)if(o.relative[e[r].type])break;return Nt(l>1&&Tt(f),l>1&&xt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&kt(e.slice(l,r)),i>r&&kt(e=e.slice(r)),i>r&&xt(e))}f.push(n)}return Tt(f)}function Et(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||.1;for(w&&(u=l!==f&&l,i=n);null!=(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,l,c)){p.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++])m(x,y,l,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=q.call(p));y=Ct(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&(T=k,u=C),x};return r?ut(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=bt(e)),n=t.length;while(n--)o=kt(t[n]),o[b]?r.push(o):i.push(o);o=E(e,Et(i,r))}return o};function St(e,t,n){var r=0,i=t.length;for(;i>r;r++)at(e,t[r],n);return n}function At(e,t,n,i){var a,s,u,c,p,f=bt(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t)return n;e=e.slice(s.shift().value.length)}a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type])break;if((p=o.find[c])&&(i=p(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&xt(s),!e)return M.apply(n,i),n;break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}o.pseudos.nth=o.pseudos.eq;function jt(){}jt.prototype=o.filters=o.pseudos,o.setFilters=new jt,r.sortStable=b.split("").sort(A).join("")===b,p(),[0,0].sort(A),r.detectDuplicates=S,x.find=at,x.expr=at.selectors,x.expr[":"]=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++)if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1)l.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return!l},lock:function(){return u=t,r||p.disable(),this},locked:function(){return!u},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!l||i&&!u||(n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1)for(s=Array(r),l=Array(r),u=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail(o.reject).progress(a(t,l,s)):--i;return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML="
a",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="