From e0ef35a8a7e70838d3dfce61443e6e54b50b092e Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Tue, 9 Apr 2019 08:24:45 +0000 Subject: [PATCH] Initial import. git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/branches/portlets/user/PerformFISH-Apps/1.3@178929 82a268e6-3cf1-43bd-a215-b396298e98cf --- .classpath | 33 - .project | 38 - .settings/.jsdtscope | 13 - .settings/org.eclipse.core.resources.prefs | 5 - .settings/org.eclipse.jdt.core.prefs | 14 - .settings/org.eclipse.jst.jsp.core.prefs | 3 - .settings/org.eclipse.m2e.core.prefs | 4 - .settings/org.eclipse.wst.common.component | 10 - ...se.wst.common.project.facet.core.prefs.xml | 7 - ....eclipse.wst.common.project.facet.core.xml | 9 - ...rg.eclipse.wst.jsdt.ui.superType.container | 1 - .../org.eclipse.wst.jsdt.ui.superType.name | 1 - .settings/org.eclipse.wst.validation.prefs | 2 - .tern-project | 23 - distro/LICENSE | 1 - distro/README | 62 - distro/changelog.xml | 10 - distro/descriptor.xml | 31 - distro/profile.xml | 25 - pom.xml | 239 ---- .../AddNewCompanyOrAssociation.java | 152 --- .../AssociateCompaniesToAssociation.java | 102 -- .../performfish/AssociateUsersToCompany.java | 126 -- .../performfish/AssociateUsersToFarm.java | 110 -- .../performfish/AssociationDashboard.java | 71 -- .../performfish/CompanyFarmRepository.java | 477 -------- ...panyFarmRepositoryConfigurationAction.java | 30 - .../performfish/CompanyPrivateRepository.java | 195 --- .../EmptyFormsConfigurationAction.java | 30 - .../EmptyFormsDocumentsDisplay.java | 220 ---- .../user/performfish/ManageAssociations.java | 71 -- .../user/performfish/ManageCompanies.java | 111 -- .../user/performfish/ManageCompanyAdmins.java | 139 --- .../user/performfish/ManageCompanyUsers.java | 160 --- .../performfish/ManageFarmAdministrators.java | 130 -- .../user/performfish/ManageFarmUsers.java | 134 -- .../user/performfish/ManageFarms.java | 277 ----- .../PromoteCompanyAdministrators.java | 81 -- .../PromoteFarmAdministrators.java | 92 -- .../SetCompanyAdministratorsSuperUser.java | 131 -- .../performfish/SetFarmAdministrators.java | 90 -- .../performfish/SubmittedFormValidation.java | 334 ----- .../user/performfish/bean/Association.java | 99 -- .../user/performfish/bean/Company.java | 77 -- .../user/performfish/bean/CompanyMember.java | 90 -- .../portlets/user/performfish/bean/Farm.java | 126 -- .../bean/PublishAnonymisedJob.java | 89 -- .../user/performfish/bean/SubmittedForm.java | 98 -- .../util/ImportedBatchChecker.java | 182 --- .../user/performfish/util/PFISHConstants.java | 85 -- .../portlets/user/performfish/util/Utils.java | 1077 ----------------- .../performfish/util/ValidationResult.java | 35 - .../comparators/AssociationComparator.java | 14 - .../util/comparators/CompanyComparator.java | 14 - .../comparators/CompanyMemberComparator.java | 14 - .../util/comparators/FarmComparator.java | 14 - .../comparators/FileVersionComparator.java | 14 - .../comparators/GenericFileComparator.java | 12 - .../util/comparators/TeamComparator.java | 14 - .../util/comparators/UserComparator.java | 14 - .../util/comparators/WSItemComparator.java | 20 - .../user/performfish/util/db/DBUtil.java | 361 ------ .../performfish/util/db/DB_Credentials.java | 70 -- .../util/db/DatabaseConnection.java | 101 -- src/main/webapp/WEB-INF/liferay-display.xml | 27 - .../WEB-INF/liferay-plugin-package.properties | 9 - src/main/webapp/WEB-INF/liferay-portlet.xml | 257 ---- src/main/webapp/WEB-INF/portlet.xml | 492 -------- src/main/webapp/WEB-INF/web.xml | 2 - src/main/webapp/css/loading_result.gif | Bin 11468 -> 0 bytes src/main/webapp/css/main.css | 185 --- src/main/webapp/css/table.css | 42 - src/main/webapp/css/up_img.png | Bin 3364 -> 0 bytes .../addnewcompany_or_assoc/AddNewCompany.jsp | 117 -- .../adduserstocompany/add_users_toCompany.jsp | 118 -- .../adduserstocompany/add_users_toFarm.jsp | 119 -- .../promote_company_administrators.jsp | 118 -- .../promote_farm_administrators.jsp | 119 -- .../companies_to_ass_view.jsp | 106 -- .../association_dashboard.jsp | 62 - .../company_private_repository.jsp | 125 -- .../show_all_versions.jsp | 92 -- .../editcompanyusers/edit_admin_users.jsp | 107 -- .../editcompanyusers/edit_company_users.jsp | 107 -- .../html/editfarmusers/edit_farm_users.jsp | 85 -- .../editfarmusers/edit_farmadmin_users.jsp | 91 -- .../empty_forms_config.jsp | 47 - .../empty_forms_fileupload_display.jsp | 146 --- .../html/error_pages/NotACompanyAdmin.jsp | 8 - .../webapp/html/error_pages/NotAFarmAdmin.jsp | 8 - .../NotBelongingToAnyAssociation.jsp | 8 - .../error_pages/NotBelongingToAnyCompany.jsp | 8 - .../error_pages/NotBelongingToAnyFarm.jsp | 8 - .../TooManyBelongingAssociation.jsp | 9 - .../error_pages/TooManyBelongingCompany.jsp | 8 - .../html/error_pages/TooManyBelongingFarm.jsp | 9 - .../error_pages/farmname_exists_already.jsp | 29 - .../html/error_pages/operation-error.jsp | 29 - .../farmrepository/SelectBelongingFarm.jsp | 44 - .../webapp/html/farmrepository/config.jsp | 27 - .../html/farmrepository/show_all_versions.jsp | 89 -- .../farmrepository/view_farm_repository.jsp | 232 ---- src/main/webapp/html/init.jsp | 76 -- .../manageassociations/edit_associations.jsp | 81 -- .../manage_associations_view.jsp | 107 -- .../html/managecompanies/edit_companies.jsp | 86 -- .../html/managecompanies/manage_companies.jsp | 84 -- .../managecompanyadmins/company_admins.jsp | 78 -- .../html/managecompanyusers/company_users.jsp | 78 -- .../managefarmadministratos/farm_admins.jsp | 95 -- .../html/managefarms/managefarms_view.jsp | 226 ---- .../manage_farm_users_view.jsp | 81 -- .../set_company_admin.jsp | 136 --- .../setfarmadministrators/set_farm_admin.jsp | 142 --- .../submittedformvalidation/validation.jsp | 39 - src/main/webapp/icon.png | Bin 467 -> 0 bytes src/main/webapp/js/jquery.min.js | 5 - src/main/webapp/js/jquery.uploadfile.min.js | 8 - src/main/webapp/js/main.js | 148 --- 119 files changed, 10973 deletions(-) delete mode 100644 .classpath delete mode 100644 .project delete mode 100644 .settings/.jsdtscope delete mode 100644 .settings/org.eclipse.core.resources.prefs delete mode 100644 .settings/org.eclipse.jdt.core.prefs delete mode 100644 .settings/org.eclipse.jst.jsp.core.prefs delete mode 100644 .settings/org.eclipse.m2e.core.prefs delete mode 100644 .settings/org.eclipse.wst.common.component delete mode 100644 .settings/org.eclipse.wst.common.project.facet.core.prefs.xml delete mode 100644 .settings/org.eclipse.wst.common.project.facet.core.xml delete mode 100644 .settings/org.eclipse.wst.jsdt.ui.superType.container delete mode 100644 .settings/org.eclipse.wst.jsdt.ui.superType.name delete mode 100644 .settings/org.eclipse.wst.validation.prefs delete mode 100644 .tern-project delete mode 100644 distro/LICENSE delete mode 100644 distro/README delete mode 100644 distro/changelog.xml delete mode 100644 distro/descriptor.xml delete mode 100644 distro/profile.xml delete mode 100644 pom.xml delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/AddNewCompanyOrAssociation.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/AssociateCompaniesToAssociation.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/AssociateUsersToCompany.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/AssociateUsersToFarm.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/AssociationDashboard.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/CompanyFarmRepository.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/CompanyFarmRepositoryConfigurationAction.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/CompanyPrivateRepository.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/EmptyFormsConfigurationAction.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/EmptyFormsDocumentsDisplay.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/ManageAssociations.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/ManageCompanies.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/ManageCompanyAdmins.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/ManageCompanyUsers.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/ManageFarmAdministrators.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/ManageFarmUsers.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/ManageFarms.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/PromoteCompanyAdministrators.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/PromoteFarmAdministrators.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/SetCompanyAdministratorsSuperUser.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/SetFarmAdministrators.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/SubmittedFormValidation.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/bean/Association.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/bean/Company.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/bean/CompanyMember.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/bean/Farm.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/bean/PublishAnonymisedJob.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/bean/SubmittedForm.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/util/ImportedBatchChecker.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/util/PFISHConstants.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/util/Utils.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/util/ValidationResult.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/util/comparators/AssociationComparator.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/util/comparators/CompanyComparator.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/util/comparators/CompanyMemberComparator.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/util/comparators/FarmComparator.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/util/comparators/FileVersionComparator.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/util/comparators/GenericFileComparator.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/util/comparators/TeamComparator.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/util/comparators/UserComparator.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/util/comparators/WSItemComparator.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/util/db/DBUtil.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/util/db/DB_Credentials.java delete mode 100644 src/main/java/org/gcube/portlets/user/performfish/util/db/DatabaseConnection.java delete mode 100644 src/main/webapp/WEB-INF/liferay-display.xml delete mode 100644 src/main/webapp/WEB-INF/liferay-plugin-package.properties delete mode 100644 src/main/webapp/WEB-INF/liferay-portlet.xml delete mode 100644 src/main/webapp/WEB-INF/portlet.xml delete mode 100644 src/main/webapp/WEB-INF/web.xml delete mode 100644 src/main/webapp/css/loading_result.gif delete mode 100644 src/main/webapp/css/main.css delete mode 100644 src/main/webapp/css/table.css delete mode 100644 src/main/webapp/css/up_img.png delete mode 100644 src/main/webapp/html/addnewcompany_or_assoc/AddNewCompany.jsp delete mode 100644 src/main/webapp/html/adduserstocompany/add_users_toCompany.jsp delete mode 100644 src/main/webapp/html/adduserstocompany/add_users_toFarm.jsp delete mode 100644 src/main/webapp/html/adduserstocompany/promote_company_administrators.jsp delete mode 100644 src/main/webapp/html/adduserstocompany/promote_farm_administrators.jsp delete mode 100644 src/main/webapp/html/associatecompaniestoassociation/companies_to_ass_view.jsp delete mode 100644 src/main/webapp/html/associationdashboard/association_dashboard.jsp delete mode 100644 src/main/webapp/html/companyprivaterepository/company_private_repository.jsp delete mode 100644 src/main/webapp/html/companyprivaterepository/show_all_versions.jsp delete mode 100644 src/main/webapp/html/editcompanyusers/edit_admin_users.jsp delete mode 100644 src/main/webapp/html/editcompanyusers/edit_company_users.jsp delete mode 100644 src/main/webapp/html/editfarmusers/edit_farm_users.jsp delete mode 100644 src/main/webapp/html/editfarmusers/edit_farmadmin_users.jsp delete mode 100644 src/main/webapp/html/emptyformsdocumentsdisplay/empty_forms_config.jsp delete mode 100644 src/main/webapp/html/emptyformsdocumentsdisplay/empty_forms_fileupload_display.jsp delete mode 100644 src/main/webapp/html/error_pages/NotACompanyAdmin.jsp delete mode 100644 src/main/webapp/html/error_pages/NotAFarmAdmin.jsp delete mode 100644 src/main/webapp/html/error_pages/NotBelongingToAnyAssociation.jsp delete mode 100644 src/main/webapp/html/error_pages/NotBelongingToAnyCompany.jsp delete mode 100644 src/main/webapp/html/error_pages/NotBelongingToAnyFarm.jsp delete mode 100644 src/main/webapp/html/error_pages/TooManyBelongingAssociation.jsp delete mode 100644 src/main/webapp/html/error_pages/TooManyBelongingCompany.jsp delete mode 100644 src/main/webapp/html/error_pages/TooManyBelongingFarm.jsp delete mode 100644 src/main/webapp/html/error_pages/farmname_exists_already.jsp delete mode 100644 src/main/webapp/html/error_pages/operation-error.jsp delete mode 100644 src/main/webapp/html/farmrepository/SelectBelongingFarm.jsp delete mode 100644 src/main/webapp/html/farmrepository/config.jsp delete mode 100644 src/main/webapp/html/farmrepository/show_all_versions.jsp delete mode 100644 src/main/webapp/html/farmrepository/view_farm_repository.jsp delete mode 100644 src/main/webapp/html/init.jsp delete mode 100644 src/main/webapp/html/manageassociations/edit_associations.jsp delete mode 100644 src/main/webapp/html/manageassociations/manage_associations_view.jsp delete mode 100644 src/main/webapp/html/managecompanies/edit_companies.jsp delete mode 100644 src/main/webapp/html/managecompanies/manage_companies.jsp delete mode 100644 src/main/webapp/html/managecompanyadmins/company_admins.jsp delete mode 100644 src/main/webapp/html/managecompanyusers/company_users.jsp delete mode 100644 src/main/webapp/html/managefarmadministratos/farm_admins.jsp delete mode 100644 src/main/webapp/html/managefarms/managefarms_view.jsp delete mode 100644 src/main/webapp/html/managefarmusers/manage_farm_users_view.jsp delete mode 100644 src/main/webapp/html/setcompanyadministratorssuperuser/set_company_admin.jsp delete mode 100644 src/main/webapp/html/setfarmadministrators/set_farm_admin.jsp delete mode 100644 src/main/webapp/html/submittedformvalidation/validation.jsp delete mode 100644 src/main/webapp/icon.png delete mode 100644 src/main/webapp/js/jquery.min.js delete mode 100644 src/main/webapp/js/jquery.uploadfile.min.js delete mode 100644 src/main/webapp/js/main.js diff --git a/.classpath b/.classpath deleted file mode 100644 index 04023d0..0000000 --- a/.classpath +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.project b/.project deleted file mode 100644 index ea84070..0000000 --- a/.project +++ /dev/null @@ -1,38 +0,0 @@ - - - PerformFISH-Apps - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - 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 - com.liferay.ide.core.liferayNature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/.settings/.jsdtscope b/.settings/.jsdtscope deleted file mode 100644 index f179e11..0000000 --- a/.settings/.jsdtscope +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 839d647..0000000 --- a/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 91ca62e..0000000 --- a/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,14 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -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.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/.settings/org.eclipse.jst.jsp.core.prefs b/.settings/org.eclipse.jst.jsp.core.prefs deleted file mode 100644 index 3a5c98d..0000000 --- a/.settings/org.eclipse.jst.jsp.core.prefs +++ /dev/null @@ -1,3 +0,0 @@ -eclipse.preferences.version=1 -validateFragments=false -validation.use-project-settings=true diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index e6f7678..0000000 --- a/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles=Liferay-v6.2-CE-(Tomcat-7)-(2) -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 4d9f513..0000000 --- a/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml deleted file mode 100644 index cc81385..0000000 --- a/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index 7a1ffac..0000000 --- a/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.container b/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a..0000000 --- a/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.name b/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b..0000000 --- a/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/.settings/org.eclipse.wst.validation.prefs b/.settings/org.eclipse.wst.validation.prefs deleted file mode 100644 index 04cad8c..0000000 --- a/.settings/org.eclipse.wst.validation.prefs +++ /dev/null @@ -1,2 +0,0 @@ -disabled=06target -eclipse.preferences.version=1 diff --git a/.tern-project b/.tern-project deleted file mode 100644 index d7fbf24..0000000 --- a/.tern-project +++ /dev/null @@ -1,23 +0,0 @@ -{ - "plugins": { - "guess-types": { - - }, - "outline": { - - }, - "liferay": { - - }, - "yui3": { - - }, - "aui2.0.x": { - - } - }, - "libs": [ - "ecma5", - "browser" - ] -} \ No newline at end of file diff --git a/distro/LICENSE b/distro/LICENSE deleted file mode 100644 index 2d9616a..0000000 --- a/distro/LICENSE +++ /dev/null @@ -1 +0,0 @@ -${gcube.license} \ No newline at end of file diff --git a/distro/README b/distro/README deleted file mode 100644 index b13a32d..0000000 --- a/distro/README +++ /dev/null @@ -1,62 +0,0 @@ -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 --------------------------------------------------- - -* Massimiliano Assante (massimiliano.assante@isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy). - -Maintainers ------------ - -* Massimiliano Assante (massimiliano.assante@isti.cnr.it), 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} - -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/distro/changelog.xml b/distro/changelog.xml deleted file mode 100644 index 6847af4..0000000 --- a/distro/changelog.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - UUID Field Valorisation upon new Association, Company and Farms creation - - - First Release - - diff --git a/distro/descriptor.xml b/distro/descriptor.xml deleted file mode 100644 index b3f5628..0000000 --- a/distro/descriptor.xml +++ /dev/null @@ -1,31 +0,0 @@ - - servicearchive - - tar.gz - - / - - - ${distroDirectory} - / - true - - README - LICENSE - changelog.xml - profile.xml - - 755 - true - - - - - target/${build.finalName}.${project.packaging} - /${artifactId} - - - \ No newline at end of file diff --git a/distro/profile.xml b/distro/profile.xml deleted file mode 100644 index f66180c..0000000 --- a/distro/profile.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - Service - - ${Description} - PortletUser - ${artifactId} - ${version} - - - ${artifactId} - ${version} - - ${groupId} - ${artifactId} - ${version} - - - target/${build.finalName}.war - - - - - diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 98e0b24..0000000 --- a/pom.xml +++ /dev/null @@ -1,239 +0,0 @@ - - - - 4.0.0 - - maven-parent - org.gcube.tools - 1.0.0 - - - org.gcube.portlets.user.performfish - PerformFISH-Apps-portlet - war - PerformFISH-Apps Portlet - 1.3.0-SNAPSHOT - - PerformFISH Apps is a set of portlet for the implementation of the Form Submission useful to calculate KPIs - - - scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId} - scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId} - http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId} - - - - Liferay-v6.2-CE-(Tomcat-7)-(2) - - distro - 1.8 - 1.8 - 6.2.5 - 6.2.10.12 - /Users/massi/portal/liferay-portal-6.2-ce-ga6/deploy - /Users/massi/portal/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/webapps - /Users/massi/portal/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/lib/ext - /Users/massi/portal/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/webapps/ROOT - - - - - - - org.gcube.distribution - maven-portal-bom - LATEST - pom - import - - - - - - org.gcube.resources.discovery - ic-client - - - org.gcube.resources - registry-publisher - - - org.apache.httpcomponents - httpclient - 4.5.3 - - - org.gcube.portal - storagehub-icons-library - - - org.gcube.dvos - usermanagement-core - provided - - - org.gcube.portal - storagehub-icons-library - - - org.gcube.common.portal - portal-manager - provided - - - commons-beanutils - commons-beanutils - provided - - - org.gcube.common - storagehub-client-library - - - org.gcube.core - common-scope-maps - compile - - - org.gcube.common - home-library - provided - - - org.gcube.common - home-library-jcr - provided - - - org.gcube.common - home-library-model - provided - - - org.gcube.common - authorization-client - provided - - - org.gcube.common - common-authorization - provided - - - org.postgresql - postgresql - 9.3-1102-jdbc41 - - - com.liferay.portal - portal-service - ${liferay.version} - provided - - - com.liferay.portal - util-bridges - ${liferay.version} - provided - - - com.liferay.portal - util-taglib - ${liferay.version} - provided - - - com.liferay.portal - util-java - ${liferay.version} - provided - - - javax.portlet - portlet-api - 2.0 - provided - - - javax.servlet - servlet-api - 2.4 - provided - - - javax.servlet.jsp - jsp-api - 2.0 - provided - - - javax.servlet - jstl - 1.2 - - - - - - com.liferay.maven.plugins - liferay-maven-plugin - ${liferay.maven.plugin.version} - - - generate-sources - - build-css - - - - - ${liferay.auto.deploy.dir} - ${liferay.app.server.deploy.dir} - ${liferay.app.server.lib.global.dir} - ${liferay.app.server.portal.dir} - ${liferay.version} - portlet - - - - maven-compiler-plugin - 2.5 - - UTF-8 - 1.8 - 1.8 - - - - maven-resources-plugin - 2.5 - - UTF-8 - - - - - org.apache.maven.plugins - maven-assembly-plugin - 2.2 - - - ${distroDirectory}/descriptor.xml - - - - - servicearchive - install - - single - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/performfish/AddNewCompanyOrAssociation.java b/src/main/java/org/gcube/portlets/user/performfish/AddNewCompanyOrAssociation.java deleted file mode 100644 index 9a1fc11..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/AddNewCompanyOrAssociation.java +++ /dev/null @@ -1,152 +0,0 @@ -package org.gcube.portlets.user.performfish; - -import java.io.IOException; -import java.sql.Connection; -import java.util.ArrayList; -import java.util.List; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.PortletException; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; - -import org.gcube.portlets.user.performfish.bean.Association; -import org.gcube.portlets.user.performfish.bean.Company; -import org.gcube.portlets.user.performfish.bean.Farm; -import org.gcube.portlets.user.performfish.util.Utils; -import org.gcube.portlets.user.performfish.util.db.DBUtil; -import org.gcube.portlets.user.performfish.util.db.DatabaseConnection; -import org.gcube.vomanagement.usermanagement.RoleManager; -import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager; -import org.gcube.vomanagement.usermanagement.model.GCubeTeam; - -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.servlet.SessionErrors; -import com.liferay.portal.kernel.util.ParamUtil; -import com.liferay.portal.service.GroupLocalServiceUtil; -import com.liferay.portal.util.PortalUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; - -/** - * Portlet implementation class AddNewCompanyOrAssociation - */ -public class AddNewCompanyOrAssociation extends MVCPortlet { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(AssociateUsersToCompany.class); - @Override - public void render(RenderRequest request, RenderResponse response) - throws PortletException, IOException { - _log.info(" This is render method of AddNewCompanyOrAssociation"); - try { - long groupId = PortalUtil.getScopeGroupId(request); - String vreName = GroupLocalServiceUtil.getGroup(groupId).getName(); - request.setAttribute("vreName", vreName); - List allTeams = getAllTeams(request); - List availableTeams = new ArrayList<>(); - Connection conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - List companies = DBUtil.getCompanies(conn); - List farms = DBUtil.getAllFarms(conn); - List associations = DBUtil.getAllAssociations(conn); - for (GCubeTeam gCubeTeam : allTeams) { - boolean found = false; - for (Company c : companies) { - if (gCubeTeam.getTeamId() == c.getCompanyId()) { - found = true; - break; - } - } - for (Farm f : farms) { - if (gCubeTeam.getTeamId() == f.getFarmId()) { - found = true; - break; - } - } - for (Association a : associations) { - if (gCubeTeam.getTeamId() == a.getAssociationId()) { - found = true; - break; - } - } - if (!found) - availableTeams.add(gCubeTeam); - } - request.setAttribute("availableTeams", availableTeams); - super.render(request, response); - - } catch (Exception e) { - e.printStackTrace(); - } - } - - private List getAllTeams(RenderRequest request) throws Exception { - long groupId = PortalUtil.getScopeGroupId(request); - RoleManager rm = new LiferayRoleManager(); - return rm.listTeamsByGroup(groupId); - } - /** - * - * @param actionRequest - * @param actionResponse - * @throws Exception - */ - public void makeCompanies(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception { - _log.info("makeCompanies action request ..."); - long groupId = ParamUtil.getLong(actionRequest, "groupId"); - Connection conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - try { - String[] companyIdsToAdd = ParamUtil.getParameterValues(actionRequest, "selectedTeamIds"); - String currentUsername = ParamUtil.getString(actionRequest, "currentUsername", "unknown"); - if (companyIdsToAdd.length > 0) { - _log.info("associateCompanies writing to DB now ..."); - boolean result = DBUtil.addCompany(conn, companyIdsToAdd, currentUsername); - if (!result) { - SessionErrors.add(actionRequest.getPortletSession(), "operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - } - } - else { - SessionErrors.add(actionRequest.getPortletSession(), "operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - } - } - catch (Exception e) { - SessionErrors.add(actionRequest.getPortletSession(),"operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - e.printStackTrace(); - } - - } - /** - * - * @param actionRequest - * @param actionResponse - * @throws Exception - */ - public void makeAssociations(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception { - _log.info("makeAssociations action request ..."); - long groupId = ParamUtil.getLong(actionRequest, "groupId"); - Connection conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - try { - String[] associationsIdsToAdd = ParamUtil.getParameterValues(actionRequest, "selectedTeamIds"); - String currentUsername = ParamUtil.getString(actionRequest, "currentUsername", "unknown"); - if (associationsIdsToAdd.length > 0) { - _log.info("associateCompanies writing to DB now ..."); - boolean result = DBUtil.addAssociation(conn, associationsIdsToAdd, currentUsername); - if (!result) { - SessionErrors.add(actionRequest.getPortletSession(), "operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - } - } - else { - SessionErrors.add(actionRequest.getPortletSession(), "operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - } - } - catch (Exception e) { - SessionErrors.add(actionRequest.getPortletSession(),"operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - e.printStackTrace(); - } - - } -} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/performfish/AssociateCompaniesToAssociation.java b/src/main/java/org/gcube/portlets/user/performfish/AssociateCompaniesToAssociation.java deleted file mode 100644 index f66e8fa..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/AssociateCompaniesToAssociation.java +++ /dev/null @@ -1,102 +0,0 @@ -package org.gcube.portlets.user.performfish; - -import java.io.IOException; -import java.sql.Connection; -import java.util.List; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.PortletException; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; -import javax.servlet.http.HttpServletRequest; - -import org.gcube.portlets.user.performfish.bean.Company; -import org.gcube.portlets.user.performfish.util.Utils; -import org.gcube.portlets.user.performfish.util.db.DBUtil; -import org.gcube.portlets.user.performfish.util.db.DatabaseConnection; - -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.servlet.SessionErrors; -import com.liferay.portal.kernel.util.ParamUtil; -import com.liferay.portal.model.Team; -import com.liferay.portal.service.GroupLocalServiceUtil; -import com.liferay.portal.service.TeamLocalServiceUtil; -import com.liferay.portal.util.PortalUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; - -/** - * Portlet implementation class AssociateCompaniesToAssociation - */ -public class AssociateCompaniesToAssociation extends MVCPortlet { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(AssociateCompaniesToAssociation.class); - @Override - public void render(RenderRequest request, RenderResponse response) - throws PortletException, IOException { - _log.info(" This is render method of AssociateCompaniesToAssociation"); - try { - long groupId = PortalUtil.getScopeGroupId(request); - HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(request)); - long[] associationIds = ParamUtil.getLongValues(httpReq, "associationId"); - if (associationIds.length > 0) { //super user mode - String vreName = GroupLocalServiceUtil.getGroup(groupId).getName(); - Connection conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - List companies = DBUtil.listCompaniesNotAssociatedToAssociations(conn); - for (Company company : companies) { - company.setName(TeamLocalServiceUtil.getTeam(company.getCompanyId()).getName()); - company.setImageUrl(Utils.getCompanyLogoURL(company.getName(), groupId, request)); - } - - Team theAssociation = TeamLocalServiceUtil.getTeam(associationIds[0]); - request.setAttribute("companies", companies); - request.setAttribute("selectedAssociation", theAssociation); - request.setAttribute("vreName", vreName); - request.setAttribute("operationFinished", false); - } else { - request.setAttribute("operationFinished", true); - super.render(request, response); - } - - super.render(request, response); - - } catch (Exception e) { - e.printStackTrace(); - } - } - - - /** - * - * @param actionRequest - * @param actionResponse - * @throws Exception - */ - public void associateCompanies(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception { - String currentUsername = ParamUtil.getString(actionRequest, "currentUsername", "unknown"); - _log.info("associateCompanies action request from " + currentUsername); - long groupId = ParamUtil.getLong(actionRequest, "groupId"); - long selectedAssociationId = ParamUtil.getLong(actionRequest, "selectedAssociationId"); - Connection conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - try { - long[] companyIdsToAssociate = ParamUtil.getLongValues(actionRequest, "associateCompanyIds"); - if (companyIdsToAssociate.length > 0) { - _log.info("associateCompanyIds writing to DB now ... \nselectedAssociationId="+selectedAssociationId+"\n companyIdsToAssociate="+companyIdsToAssociate.toString()); - boolean result = DBUtil.associateCompaniesToAssociation(conn, selectedAssociationId, companyIdsToAssociate); - if (!result) { - SessionErrors.add(actionRequest.getPortletSession(), "operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - } - } - else { - SessionErrors.add(actionRequest.getPortletSession(), "operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - } - } - catch (Exception e) { - SessionErrors.add(actionRequest.getPortletSession(),"operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - e.printStackTrace(); - } - - } -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/AssociateUsersToCompany.java b/src/main/java/org/gcube/portlets/user/performfish/AssociateUsersToCompany.java deleted file mode 100644 index 9fe8222..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/AssociateUsersToCompany.java +++ /dev/null @@ -1,126 +0,0 @@ -package org.gcube.portlets.user.performfish; - -import java.io.IOException; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.PortletException; -import javax.portlet.PortletRequestDispatcher; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; - -import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder; -import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder; -import org.gcube.common.homelibrary.home.workspace.accessmanager.ACLType; -import org.gcube.portlets.user.performfish.bean.CompanyMember; -import org.gcube.portlets.user.performfish.util.Utils; -import org.gcube.portlets.user.performfish.util.comparators.CompanyMemberComparator; -import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager; -import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager; -import org.gcube.vomanagement.usermanagement.model.GCubeTeam; - -import com.liferay.portal.kernel.cache.CacheRegistryUtil; -import com.liferay.portal.kernel.cache.MultiVMPoolUtil; -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.servlet.SessionErrors; -import com.liferay.portal.kernel.util.ParamUtil; -import com.liferay.portal.kernel.webcache.WebCachePoolUtil; -import com.liferay.portal.model.Team; -import com.liferay.portal.service.TeamLocalServiceUtil; -import com.liferay.portal.util.PortalUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; - -/** - * Portlet implementation class AssociateUsersToCompany - */ -public class AssociateUsersToCompany extends MVCPortlet { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(AssociateUsersToCompany.class); - @Override - public void render(RenderRequest request, RenderResponse response) - throws PortletException, IOException { - _log.info(" This is render method of AssociateUsersToCompany"); - try { - long groupId = PortalUtil.getScopeGroupId(request); - GCubeTeam theTeam = Utils.checkBelongingToOneCompanyOnly(request, response, this); - request.setAttribute("theTeam", TeamLocalServiceUtil.getTeam(theTeam.getTeamId())); - if (theTeam == null || !Utils.isCompanyAdmin(Utils.getCurrentUser(request), groupId, theTeam)) { //check is Admin - _log.error("Some error occurred"); - PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(Utils.NOT_ADMIN_PAGE_PATH); - dispatcher.include(request, response); - } else { - List companyMembers = Utils.getRegularCompanyMembers(theTeam.getTeamId(), theTeam.getGroupId()); - Collections.sort(companyMembers, new CompanyMemberComparator()); - request.setAttribute("companyMembers", companyMembers); //pass to the JSP - String imageUrl = Utils.getCompanyLogoURL(theTeam.getTeamName(), groupId, request); - request.setAttribute("companyLogoURL", imageUrl); //pass to logo URL to the JSP - super.render(request, response); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - /** - * - * @param actionRequest - * @param actionResponse - * @throws Exception - */ - public void associateCompanyUsers(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception { - try { - String[] usernamesToAssociateToCompany = ParamUtil.getParameterValues(actionRequest, "addUserIds"); - long teamId = ParamUtil.getLong(actionRequest, "teamId"); - String currentUsername = ParamUtil.getString(actionRequest, "currentUsername"); - long currentGroupId = ParamUtil.getLong(actionRequest, "currentGroupId"); - String context = Utils.getCurrentContext(currentGroupId); - _log.info(currentUsername + " has requested the association of some user(s) to the company having id="+teamId + " in context="+context); - LiferayRoleManager rm = new LiferayRoleManager(); - LiferayUserManager um = new LiferayUserManager(); - GCubeTeam team = rm.getTeam(teamId); - WorkspaceFolder wsFolder = Utils.getWSCompanyFolder(currentUsername, context, team); - if (wsFolder.isShared()) { - WorkspaceSharedFolder sharedFolder = (WorkspaceSharedFolder) wsFolder; - List usersToShareWith = Arrays.asList(usernamesToAssociateToCompany); - _log.info("Sharing with users =>"+usersToShareWith.toString()); - sharedFolder.share(usersToShareWith); - sharedFolder.setACL(usersToShareWith, ACLType.WRITE_ALL); - for (int i = 0; i < usernamesToAssociateToCompany.length; i++) { - _log.info("sharing OK associateing user to team =>"+usernamesToAssociateToCompany[i]); - long userId = um.getUserByUsername(usernamesToAssociateToCompany[i]).getUserId(); - List currentTeams = TeamLocalServiceUtil.getUserTeams(userId, currentGroupId); - long[] teamIds = null; - if (currentTeams != null && !currentTeams.isEmpty()) { - teamIds = new long[currentTeams.size()+1]; - int j = 0; - for (Team t : currentTeams) { - teamIds[j] = t.getTeamId(); - j++; - } - teamIds[j] = teamId; - TeamLocalServiceUtil.setUserTeams(userId, teamIds); - } else { - teamIds = new long[1]; - teamIds[0] = teamId; - TeamLocalServiceUtil.setUserTeams(userId, teamIds); - } - CacheRegistryUtil.clear(); - MultiVMPoolUtil.clear(); - WebCachePoolUtil.clear(); - _log.info("added user to team Done"); - } - } - else { - SessionErrors.add(actionRequest.getPortletSession(), "operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - } - } - catch (Exception e) { - SessionErrors.add(actionRequest.getPortletSession(),"operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - e.printStackTrace(); - } - - } -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/AssociateUsersToFarm.java b/src/main/java/org/gcube/portlets/user/performfish/AssociateUsersToFarm.java deleted file mode 100644 index 10af833..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/AssociateUsersToFarm.java +++ /dev/null @@ -1,110 +0,0 @@ -package org.gcube.portlets.user.performfish; - -import java.io.IOException; -import java.util.Collections; -import java.util.List; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.PortletException; -import javax.portlet.PortletRequestDispatcher; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; -import javax.servlet.http.HttpServletRequest; - -import org.gcube.portlets.user.performfish.util.Utils; -import org.gcube.portlets.user.performfish.util.comparators.UserComparator; -import org.gcube.vomanagement.usermanagement.RoleManager; -import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager; -import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager; -import org.gcube.vomanagement.usermanagement.model.GCubeTeam; -import org.gcube.vomanagement.usermanagement.model.GCubeUser; - -import com.liferay.portal.kernel.cache.CacheRegistryUtil; -import com.liferay.portal.kernel.cache.MultiVMPoolUtil; -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.servlet.SessionErrors; -import com.liferay.portal.kernel.util.ParamUtil; -import com.liferay.portal.kernel.webcache.WebCachePoolUtil; -import com.liferay.portal.service.TeamLocalServiceUtil; -import com.liferay.portal.util.PortalUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; - -/** - * Portlet implementation class AssociateUsersToFarm - */ -public class AssociateUsersToFarm extends MVCPortlet { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(AssociateUsersToFarm.class); - private static RoleManager RM = new LiferayRoleManager(); - @Override - public void render(RenderRequest request, RenderResponse response) - throws PortletException, IOException { - _log.info(" This is render method of AssociateUsersToFarm"); - try { - long groupId = PortalUtil.getScopeGroupId(request); - GCubeTeam theCompany = Utils.checkBelongingToOneCompanyOnly(request, response, this); - HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(request)); - String[] farmIds = ParamUtil.getParameterValues(httpReq, Utils.ENCODED_FARM_PARAM); - - GCubeTeam theFarm = null; - if (farmIds != null && farmIds.length > 0) { - long selectedFarmId = Utils.unmaskId(farmIds[0]); - theFarm = RM.getTeam(selectedFarmId); - request.getPortletSession().setAttribute("theFarm", theFarm); - } else { - theFarm = (GCubeTeam) request.getPortletSession().getAttribute("theFarm"); - } - request.setAttribute("theTeam", TeamLocalServiceUtil.getTeam(theFarm.getTeamId())); - if (theFarm == null || !Utils.isFarmAdmin(Utils.getCurrentUser(request), groupId, theFarm)) { //check is Admin - _log.error("Some error occurred"); - PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(Utils.NOT_FARM_ADMIN_PAGE_PATH); - dispatcher.include(request, response); - } else { - List nonFarmMembers = Utils.getAvailableFarmMembersToAssociate(theFarm.getTeamId(), theCompany.getTeamId(), theCompany.getGroupId()); - Collections.sort(nonFarmMembers, new UserComparator()); - request.setAttribute("nonFarmMembers", nonFarmMembers); //pass to the JSP - String imageUrl = Utils.getCompanyLogoURL(theCompany.getTeamName(), groupId, request); - request.setAttribute("companyLogoURL", imageUrl); //pass to logo URL to the JSP - super.render(request, response); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - /** - * - * @param actionRequest - * @param actionResponse - * @throws Exception - */ - //TODO: yiou have to manage the workspace folder still ... - public void associateFarmUsers(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception { - try { - String[] usernamesToAssociateToFarm = ParamUtil.getParameterValues(actionRequest, "addUserIds"); - long teamId = ParamUtil.getLong(actionRequest, "teamId"); - String currentUsername = ParamUtil.getString(actionRequest, "currentUsername"); - long currentGroupId = ParamUtil.getLong(actionRequest, "currentGroupId"); - String context = Utils.getCurrentContext(currentGroupId); - _log.info(currentUsername + " has requested the association of some user(s) to the farm having id="+teamId + " in context="+context); - LiferayRoleManager rm = new LiferayRoleManager(); - LiferayUserManager um = new LiferayUserManager(); - - for (int i = 0; i < usernamesToAssociateToFarm.length; i++) { - _log.info("sharing OK associating user to team =>"+usernamesToAssociateToFarm[i]); - long userId = um.getUserByUsername(usernamesToAssociateToFarm[i]).getUserId(); - rm.assignTeamToUser(userId, teamId); - _log.info("added user to farm Done"); - CacheRegistryUtil.clear(); - MultiVMPoolUtil.clear(); - WebCachePoolUtil.clear(); - } - } - catch (Exception e) { - SessionErrors.add(actionRequest.getPortletSession(),"operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - e.printStackTrace(); - } - - } - -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/AssociationDashboard.java b/src/main/java/org/gcube/portlets/user/performfish/AssociationDashboard.java deleted file mode 100644 index d1b7666..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/AssociationDashboard.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.gcube.portlets.user.performfish; - -import java.io.IOException; -import java.sql.Connection; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; - -import javax.portlet.PortletException; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; - -import org.gcube.portlets.user.performfish.bean.Company; -import org.gcube.portlets.user.performfish.bean.Farm; -import org.gcube.portlets.user.performfish.util.Utils; -import org.gcube.portlets.user.performfish.util.db.DBUtil; -import org.gcube.portlets.user.performfish.util.db.DatabaseConnection; -import org.gcube.vomanagement.usermanagement.model.GCubeTeam; - -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.model.Team; -import com.liferay.portal.service.TeamLocalServiceUtil; -import com.liferay.portal.util.PortalUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; - -/** - * Portlet implementation class AssociationDashboard - */ -public class AssociationDashboard extends MVCPortlet { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(AssociationDashboard.class); - - @Override - public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException { - try { - long groupId = PortalUtil.getScopeGroupId(request); - GCubeTeam theAsso = Utils.checkBelongingToOneAssociationOnly(request, response, this); - request.setAttribute("theAssociation", theAsso); - - if (theAsso != null) { - Connection conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - _log.debug("Association name =" + theAsso.getTeamName()); - String imageUrl = Utils.getCompanyLogoURL(theAsso.getTeamName(), groupId, request); - request.setAttribute("associationLogoURL", imageUrl); //pass to logo URL to the JSP - - _log.debug("Featching companies and farms =" + theAsso.getTeamName()); - LinkedHashMap> associationCompanies = new LinkedHashMap<>(); - List companIds = DBUtil.getCompaniesIdsByAssociation(conn, theAsso.getTeamId()); - for (Long companId : companIds) { - Team theCompany = TeamLocalServiceUtil.getTeam(companId); - Company toPut = new Company(companId, theAsso.getTeamId(), false); - toPut.setName(theCompany.getName()); - toPut.setImageUrl(Utils.getCompanyLogoURL(theCompany.getName(), groupId, request)); - List companyFarms = DBUtil.listFarmsByCompanyId(conn, companId); - for (Farm farm : companyFarms) { - String farmName = TeamLocalServiceUtil.getTeam(farm.getFarmId()).getName(); - farm.setName(farmName); - } - associationCompanies.put(toPut, companyFarms); - request.setAttribute("associationCompanies", associationCompanies); - } - //display the view.jsp - super.render(request, response); - } - - } catch (Exception e) { - e.printStackTrace(); - } - } - - -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/CompanyFarmRepository.java b/src/main/java/org/gcube/portlets/user/performfish/CompanyFarmRepository.java deleted file mode 100644 index 3fb1d2b..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/CompanyFarmRepository.java +++ /dev/null @@ -1,477 +0,0 @@ -package org.gcube.portlets.user.performfish; - -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.net.URL; -import java.net.URLEncoder; -import java.security.KeyManagementException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSession; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.PortletException; -import javax.portlet.PortletPreferences; -import javax.portlet.PortletRequestDispatcher; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; -import javax.portlet.ResourceRequest; -import javax.portlet.ResourceResponse; -import javax.portlet.WindowState; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.io.IOUtils; -import org.gcube.common.authorization.library.provider.SecurityTokenProvider; -import org.gcube.common.homelibary.model.versioning.WorkspaceVersion; -import org.gcube.common.homelibrary.home.exceptions.InternalErrorException; -import org.gcube.common.homelibrary.home.workspace.Workspace; -import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder; -import org.gcube.common.homelibrary.home.workspace.WorkspaceItem; -import org.gcube.common.homelibrary.home.workspace.exceptions.ItemNotFoundException; -import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile; -import org.gcube.common.storagehub.client.StreamDescriptor; -import org.gcube.common.storagehub.client.dsl.StorageHubClient; -import org.gcube.common.storagehub.client.plugins.AbstractPlugin; -import org.gcube.common.storagehub.client.proxies.ItemManagerClient; -import org.gcube.common.storagehub.model.items.Item; -import org.gcube.common.storagehub.model.service.Version; -import org.gcube.portlets.user.performfish.bean.PublishAnonymisedJob; -import org.gcube.portlets.user.performfish.bean.SubmittedForm; -import org.gcube.portlets.user.performfish.util.ImportedBatchChecker; -import org.gcube.portlets.user.performfish.util.PFISHConstants; -import org.gcube.portlets.user.performfish.util.Utils; -import org.gcube.portlets.user.performfish.util.comparators.WSItemComparator; -import org.gcube.vomanagement.usermanagement.RoleManager; -import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager; -import org.gcube.vomanagement.usermanagement.model.GCubeTeam; -import org.gcube.vomanagement.usermanagement.model.GCubeUser; - -import com.liferay.portal.kernel.json.JSONArray; -import com.liferay.portal.kernel.json.JSONFactoryUtil; -import com.liferay.portal.kernel.json.JSONObject; -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.servlet.ServletResponseUtil; -import com.liferay.portal.kernel.servlet.SessionErrors; -import com.liferay.portal.kernel.util.GetterUtil; -import com.liferay.portal.kernel.util.ParamUtil; -import com.liferay.portal.kernel.util.StringPool; -import com.liferay.portal.util.PortalUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; - -/** - * - * @author M. Assante CNR-ISTI - */ -public class CompanyFarmRepository extends MVCPortlet { - public static final String PHASE_PREFERENCE_ATTR_NAME = "phase"; - - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(CompanyFarmRepository.class); - - private static RoleManager RM = new LiferayRoleManager(); - - @Override - public void render(RenderRequest request, RenderResponse response) - throws PortletException, IOException { - _log.info(" This is render method of CompanyFarmRepository"); - - try { - GCubeTeam theFarm = null; - HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(request)); - String[] farmIds = ParamUtil.getParameterValues(httpReq, Utils.ENCODED_FARM_PARAM); - String selectedItemId = (String) request.getAttribute("itemId"); - if (selectedItemId == null) {//this handles when show version is clicked - if (farmIds == null || farmIds.length == 0) { - List theFarms = Utils.getUserFarms(request, response, this); //if pass here only one farm is returned otherswise ir renders Utils.SELECT_FARM_PAGE_PATH - if (theFarms != null && ! theFarms.isEmpty()) { - theFarm = theFarms.get(0); - request.setAttribute("theFarm", theFarms.get(0)); //pass to the JSP - } - } - else { //the farmId is passed via param on the query string - long selectedFarmId = Utils.unmaskId(farmIds[0]); - theFarm = RM.getTeam(selectedFarmId); - if ( Utils.checkBelongsToTeam(PortalUtil.getUserId(request), theFarm.getTeamId(), PortalUtil.getScopeGroupId(request)) ) //check that the user belong ot the farm - request.setAttribute("theFarm", theFarm); //pass to the JSP - else { - PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(Utils.NOT_BELONGING_ANY_FARM_PAGE_PATH); - dispatcher.include(request, response); - } - } - _log.info(" initialise of CompanyFarmRepository Page done"); - long groupId = PortalUtil.getScopeGroupId(request); - GCubeTeam theCompany = Utils.checkBelongingToOneCompanyOnly(request, response, this); - request.setAttribute("theCompany", theCompany); - - String context = Utils.getCurrentContext(request); - String username = Utils.getCurrentUser(request).getUsername(); - if (theFarm != null ) { - //check folder exists - WorkspaceFolder sharedFolder = Utils.getWSFarmFolder( - username, - context, - theCompany, theFarm); - - List companyFiles = sharedFolder.getChildren(true); - Collections.sort(companyFiles, new WSItemComparator()); - List filteredFiles = new ArrayList<>(); - PortletPreferences portletPreferences = request.getPreferences(); - String selectedPhase = GetterUtil.getString(portletPreferences.getValue(PHASE_PREFERENCE_ATTR_NAME, StringPool.BLANK)); - _log.debug("selectedPhase: "+selectedPhase); - String adjustedPhaseName = selectedPhase; - if (selectedPhase.compareTo("Pre") == 0) - adjustedPhaseName = "Pre-grow"; - if (selectedPhase.compareTo(PFISHConstants.SHOW_ALL_PHASES) != 0) { - for (WorkspaceItem workspaceItem : companyFiles) { - if (workspaceItem.getName().contains(adjustedPhaseName) || - ((selectedPhase.compareTo("Grow") == 0) && workspaceItem.getName().contains("Farm Data")) ) { - if (workspaceItem instanceof ExternalFile) { - ExternalFile file = (ExternalFile) workspaceItem; - filteredFiles.add(file); - } - } - } - } - else { - for (WorkspaceItem workspaceItem : companyFiles) { - if (workspaceItem instanceof ExternalFile) { - ExternalFile file = (ExternalFile) workspaceItem; - filteredFiles.add(file); - } - } - } - - //TODO - List submittedFormsWithPublishStatus= getSubmittedFormPublishAndAnonimStatus(request, context, theFarm.getTeamId(), filteredFiles); - request.setAttribute("submittedFormsWithPublishStatus", submittedFormsWithPublishStatus); //pass to the JSP - String imageUrl = Utils.getCompanyLogoURL(theCompany.getTeamName(), groupId, request); - request.setAttribute("companyLogoURL", imageUrl); //pass to logo URL to the JSP - } - } - super.render(request, response); - } catch (Exception e) { - e.printStackTrace(); - } - } - - private List getSubmittedFormPublishAndAnonimStatus(RenderRequest renderRequest, String context, long farmId, List filteredFiles) throws Exception { - List toReturn = new ArrayList<>(); - - String authorizationToken = Utils.getCurrentUserToken(context, Utils.getCurrentUser(renderRequest).getUsername()); - String analyticalToolkitServiceURL = Utils.getAnalyticalToolkitEndpoint(context) ; - SecurityTokenProvider.instance.set(authorizationToken); - StringBuilder sb = new StringBuilder(analyticalToolkitServiceURL) - .append("/import/") - .append(farmId).append("?gcube-token="+authorizationToken); - String request = sb.toString(); - fixUntrustCertificate() ; - URL url= new URL(request); - HttpsURLConnection conn= (HttpsURLConnection) url.openConnection(); - conn.setDoOutput( true ); - conn.setInstanceFollowRedirects( false ); - conn.setRequestMethod( "GET" ); - conn.setRequestProperty( "Content-Type", "application/json"); - conn.setRequestProperty( "charset", "utf-8"); - conn.setUseCaches( false ); - - InputStream in = conn.getInputStream(); - String encoding = conn.getContentEncoding(); - encoding = encoding == null ? "UTF-8" : encoding; - String body = IOUtils.toString(in, encoding); - - JSONArray jsArray = JSONFactoryUtil.createJSONArray(body); - Map jobs = new HashMap<>(); - System.out.println("*** Processing list, no of items = "+jsArray.length()); - for (int i = 0; i < jsArray.length(); i++) { - JSONObject cData = jsArray.getJSONObject(i); - PublishAnonymisedJob toPut = new PublishAnonymisedJob(cData); - String sourceUrl = toPut.getSourceUrl(); //theKey - if (jobs.containsKey(sourceUrl)) { - PublishAnonymisedJob toCompare = jobs.get(sourceUrl); - if (toPut.getEndTimeEpochSecond() > toCompare.getEndTimeEpochSecond()) { //if the current (toPut) is more recent than the one in the map (toCompare) we replace it - jobs.put(sourceUrl, toPut); - } - } - else - jobs.put(sourceUrl, new PublishAnonymisedJob(cData)); - } - /*here we have the list of the most recent jobs per type (GROW_OUT_INDIVIDUAL, PRE_ONGROWING etc) - * with their STATUS (COMPLETE, FAILED, IN PROGRESS) - * - */ - _log.debug("*** List Processed, no of items = "+jobs.keySet().size()); - for (String key : jobs.keySet()) { - System.out.println(jobs.get(key)); - } - // - StorageHubClient shub = new StorageHubClient(); - for (ExternalFile externalFile : filteredFiles) { - String publicURL = shub.open(externalFile.getId()).asFile().getPublicLink().toString(); - PublishAnonymisedJob job = jobs.get(publicURL); - if (job != null) { - long endTimeInMillis = job.getEndTimeEpochSecond()*1000; - toReturn.add(new SubmittedForm(externalFile, job.getStatus(), job.getSubmitterIdentity(), endTimeInMillis)); - } else - toReturn.add(new SubmittedForm(externalFile)); - } - return toReturn; - } - - public void displayVersions(ActionRequest request, ActionResponse response) throws Exception { - System.out.println("**** displayVersionsdisplayVersionsdisplayVersionsdisplayVersions"); - String itemId = ParamUtil.getString(request, "fileItem"); - long farmId = ParamUtil.getLong(request, "farmId"); - - if (itemId == null || itemId.compareTo("")==0) { - SessionErrors.add(request.getPortletSession(),"form-error"); - return; - } - HttpServletRequest httpReq = PortalUtil.getHttpServletRequest(request); - GCubeUser currentUser = Utils.getCurrentUser(httpReq); - String context = Utils.getCurrentContext(httpReq); - Workspace ws = Utils.getWS(currentUser.getUsername(), context) ; - WorkspaceItem theItem = ws.getItem(itemId); - if (theItem instanceof ExternalFile) { - ExternalFile file = (ExternalFile) theItem; - List versions = file.getVersionHistory(); - request.setAttribute("versions", versions); //pass to the JSP - } else { - response.setRenderParameter("jspPage", PFISHConstants.OPERATION_ERROR_PATH); - } - request.setAttribute("farmId", farmId); - request.setAttribute("itemId", itemId); - request.setAttribute("itemName", theItem.getName()); - response.setWindowState(WindowState.MAXIMIZED); - response.setRenderParameter("jspPage", "/html/farmrepository/show_all_versions.jsp"); - } - - - public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException, PortletException { - //if download file - String fileToDownloadId = ParamUtil.getString(resourceRequest, "fileToDownloadId", null); - //if download version - String versionDownloadItemId = ParamUtil.getString(resourceRequest, "versionDownloadItemId", null); - String versionDownloadName = ParamUtil.getString(resourceRequest, "versionDownloadName", null); - - String fileToPublishId = ParamUtil.getString(resourceRequest, "fileToPublishId", null); - String farmIdString = ParamUtil.getString(resourceRequest, "farmId", null); - - String authToken = setAuthorizationToken(resourceRequest); - //check if is a file download - if (fileToDownloadId != null) { - String selectedItemId = fileToDownloadId; - try { - ItemManagerClient client = AbstractPlugin.item().build(); - StreamDescriptor streamDescr = client.download(selectedItemId); - HttpServletResponse httpRes = PortalUtil.getHttpServletResponse(resourceResponse); - HttpServletRequest httpReq = PortalUtil.getHttpServletRequest(resourceRequest); - ServletResponseUtil.sendFile(httpReq,httpRes, streamDescr.getFileName(), streamDescr.getStream(), "application/download"); - streamDescr.getStream().close(); - } - catch (Exception e) { - e.printStackTrace(); - } - } - else if (versionDownloadItemId != null && versionDownloadName != null) { //check if download version - GCubeUser currentUser = Utils.getCurrentUser(resourceRequest); - String context = Utils.getCurrentContext(resourceRequest); - Workspace ws = Utils.getWS(currentUser.getUsername(), context) ; - WorkspaceItem theItem; - try { - theItem = ws.getItem(versionDownloadItemId); - if (theItem instanceof ExternalFile) { - ExternalFile file = (ExternalFile) theItem; - InputStream is = file.downloadVersion(versionDownloadName); - HttpServletResponse httpRes = PortalUtil.getHttpServletResponse(resourceResponse); - HttpServletRequest httpReq = PortalUtil.getHttpServletRequest(resourceRequest); - ServletResponseUtil.sendFile(httpReq,httpRes, versionDownloadName+"_"+file.getName(), is, "application/download"); - } - } catch (ItemNotFoundException | InternalErrorException e) { - e.printStackTrace(); - } - } - else if (fileToPublishId != null && farmIdString != null) { //check if is publish and anonimyse - long farmId = Long.parseLong(farmIdString); - try { - ItemManagerClient client = AbstractPlugin.item().build(); - Item selectedForm = client.get(fileToPublishId, "hl:accounting"); - - String publicLink = client.getPublickLink(fileToPublishId).toString(); - List versions = client.getFileVersions(fileToPublishId); - String theVersion = "1.0"; - for (Version version : versions) { - if (version.isCurrent()) - theVersion = version.getName(); - } - _log.debug("Publish and Anonymise " + selectedForm.getName()); - String batchType = Utils.getBatchTypeName(Utils.getPhaseByFileName(selectedForm.getName()), selectedForm.getName()); - - String result = submitPublishAndAnonymise(resourceRequest, farmId, publicLink, theVersion, batchType, authToken); - JSONObject fileObject = JSONFactoryUtil.createJSONObject(); - fileObject.put("success", result); - resourceResponse.getWriter().println(fileObject); - } - catch (Exception e) { - e.printStackTrace(); - } - } - else { - String batchType = ParamUtil.getString(resourceRequest, "batchType", null); - String farmIdStr = ParamUtil.getString(resourceRequest, "farmId", null); - String context = Utils.getCurrentContext(resourceRequest); - long farmId = Long.parseLong(farmIdStr); - boolean analyisisEnabled = false; - try { - analyisisEnabled = ImportedBatchChecker.checkAnalysisAvailability(farmId, batchType, context); - } - catch (Exception e) { - JSONObject fileObject = JSONFactoryUtil.createJSONObject(); - fileObject.put("success", "NOK"); - fileObject.put("message", " There was an error on the server, please report this issue"); - resourceResponse.getWriter().println(fileObject); - } - if (analyisisEnabled) { - JSONObject fileObject = JSONFactoryUtil.createJSONObject(); - fileObject.put("success", "OK"); - resourceResponse.getWriter().println(fileObject); - } else { - JSONObject fileObject = JSONFactoryUtil.createJSONObject(); - fileObject.put("success", "NOK"); - fileObject.put("message", " Low number of batches"); - resourceResponse.getWriter().println(fileObject); - } - - } - - } - - /** - * set the authorization token in Thread local and return the current {@link AuthorizedUser} instance - * @param request - * @return - */ - private String setAuthorizationToken(ResourceRequest request) { - GCubeUser currentUser = Utils.getCurrentUser(request); - String scope = Utils.getCurrentContext(request); - String authorizationToken = Utils.getCurrentUserToken(scope, currentUser.getUsername()); - SecurityTokenProvider.instance.set(authorizationToken); - return authorizationToken; - } - - private static String submitPublishAndAnonymise(ResourceRequest request, long farmId, String publicLink, String version, String batchType, String token) { - String encodedURL = publicLink; - try { - encodedURL = URLEncoder.encode(publicLink, "UTF-8"); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - _log.debug("farmId " + farmId); - _log.debug("item URL encoded " + encodedURL); - _log.debug("version " + version); - _log.debug("batchType " + batchType); - Map params = new HashMap<>(); - params.put("batch_type", batchType); - params.put("farmid", ""+farmId); - params.put("source", encodedURL); - params.put("source_version", version); - params.put("gcube-token", token); - - String urlParameters = "batch_type="+batchType+"&farmid="+farmId+"&source="+encodedURL+"&source_version="+version+"&gcube-token="+token; - - String context = Utils.getCurrentContext(request); - String analyticalToolkitServiceURL = Utils.getAnalyticalToolkitEndpoint(context) ; - - return doPOSTRequest(analyticalToolkitServiceURL, params, urlParameters); - } - - private static String doPOSTRequest(String analyticalToolkitServiceURL, Map params, String urlParameters) { - - StringBuilder sb = new StringBuilder(analyticalToolkitServiceURL) - .append("/import?") - .append(urlParameters); - String request = sb.toString(); - _log.info("Performing POST to: " + request); - int status = -1; - try { - fixUntrustCertificate() ; - URL url= new URL(request); - HttpsURLConnection conn= (HttpsURLConnection) url.openConnection(); - conn.setDoOutput( true ); - conn.setInstanceFollowRedirects( false ); - conn.setRequestMethod( "POST" ); - conn.setRequestProperty( "Content-Type", "application/x-www-form-urlencoded"); - conn.setRequestProperty( "charset", "utf-8"); - conn.setUseCaches( false ); - System.out.println("Posted with code "+ conn.getResponseCode() +" Response: " + conn.getResponseMessage()); - System.out.println("Parameters:" + params.toString()); - //responseMessage = conn.getResponseMessage(); - status = conn.getResponseCode(); - - InputStream in = conn.getInputStream(); - String encoding = conn.getContentEncoding(); - encoding = encoding == null ? "UTF-8" : encoding; - String body = IOUtils.toString(in, encoding); - System.out.println("Response Body:"); - System.out.println(body); - - if (status >= 200 && status <= 300) { - return "OK"; - } - else - return "KO"; - } - catch (Exception e) { - e.printStackTrace(); - return "KO"; - } - } - - - - private static void fixUntrustCertificate() throws KeyManagementException, NoSuchAlgorithmException{ - TrustManager[] trustAllCerts = new TrustManager[]{ - new X509TrustManager() { - public java.security.cert.X509Certificate[] getAcceptedIssuers() { - return null; - } - @Override - public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) - throws CertificateException { - } - - @Override - public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) - throws CertificateException { - } - - } - }; - - SSLContext sc = SSLContext.getInstance("SSL"); - sc.init(null, trustAllCerts, new java.security.SecureRandom()); - HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); - - HostnameVerifier allHostsValid = new HostnameVerifier() { - public boolean verify(String hostname, SSLSession session) { - return true; - } - }; - - // set the allTrusting verifier - HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid); - } - - -} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/performfish/CompanyFarmRepositoryConfigurationAction.java b/src/main/java/org/gcube/portlets/user/performfish/CompanyFarmRepositoryConfigurationAction.java deleted file mode 100644 index 2787af2..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/CompanyFarmRepositoryConfigurationAction.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.gcube.portlets.user.performfish; -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.PortletConfig; -import javax.portlet.PortletPreferences; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; - -import com.liferay.portal.kernel.log.Log; -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.portlet.DefaultConfigurationAction; - -public class CompanyFarmRepositoryConfigurationAction extends DefaultConfigurationAction { - private static Log _log = LogFactoryUtil.getLog(CompanyFarmRepositoryConfigurationAction.class); - @Override - public void processAction(PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { - super.processAction(portletConfig, actionRequest, actionResponse); - PortletPreferences prefs = actionRequest.getPreferences(); - String phaseValue = prefs.getValue("phase", ""); - _log.info("selected phase = " + phaseValue + " in ConfigurationAction.processAction() saved correctly"); - } - - @Override - public String render(PortletConfig portletConfig, - RenderRequest renderRequest, RenderResponse renderResponse) - throws Exception { - return "/html/farmrepository/config.jsp"; - } - -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/CompanyPrivateRepository.java b/src/main/java/org/gcube/portlets/user/performfish/CompanyPrivateRepository.java deleted file mode 100644 index 01fd50d..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/CompanyPrivateRepository.java +++ /dev/null @@ -1,195 +0,0 @@ -package org.gcube.portlets.user.performfish; - -import java.io.IOException; -import java.io.InputStream; -import java.sql.Connection; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.List; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.PortletException; -import javax.portlet.PortletRequestDispatcher; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; -import javax.portlet.ResourceRequest; -import javax.portlet.ResourceResponse; -import javax.portlet.WindowState; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.gcube.common.authorization.library.provider.SecurityTokenProvider; -import org.gcube.common.homelibary.model.versioning.WorkspaceVersion; -import org.gcube.common.homelibrary.home.exceptions.InternalErrorException; -import org.gcube.common.homelibrary.home.workspace.Workspace; -import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder; -import org.gcube.common.homelibrary.home.workspace.WorkspaceItem; -import org.gcube.common.homelibrary.home.workspace.exceptions.ItemNotFoundException; -import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile; -import org.gcube.common.storagehub.client.StreamDescriptor; -import org.gcube.common.storagehub.client.plugins.AbstractPlugin; -import org.gcube.common.storagehub.client.proxies.ItemManagerClient; -import org.gcube.portlets.user.performfish.bean.Farm; -import org.gcube.portlets.user.performfish.util.PFISHConstants; -import org.gcube.portlets.user.performfish.util.Utils; -import org.gcube.portlets.user.performfish.util.comparators.WSItemComparator; -import org.gcube.portlets.user.performfish.util.db.DBUtil; -import org.gcube.portlets.user.performfish.util.db.DatabaseConnection; -import org.gcube.vomanagement.usermanagement.RoleManager; -import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager; -import org.gcube.vomanagement.usermanagement.model.GCubeTeam; -import org.gcube.vomanagement.usermanagement.model.GCubeUser; - -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.servlet.ServletResponseUtil; -import com.liferay.portal.kernel.servlet.SessionErrors; -import com.liferay.portal.kernel.util.ParamUtil; -import com.liferay.portal.util.PortalUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; - -/** - * Portlet implementation class CompanyPrivateRepository - */ -public class CompanyPrivateRepository extends MVCPortlet { - - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(CompanyFarmRepository.class); - @Override - public void render(RenderRequest request, RenderResponse response) - throws PortletException, IOException { - _log.info(" This is render method of CompanyPrivateRepository"); - - try { - _log.info(" initialise of CompanyPrivateRepository done"); - - long groupId = PortalUtil.getScopeGroupId(request); - GCubeTeam theCompany = Utils.checkBelongingToOneCompanyOnly(request, response, this); - boolean isCompanyAdmin = Utils.isCompanyAdmin( Utils.getCurrentUser(request), groupId, theCompany); - if (theCompany != null && isCompanyAdmin) { //check is Admin - request.setAttribute("theCompany", theCompany); - String currentContext = Utils.getCurrentContext(request); - GCubeUser currentUser = Utils.getCurrentUser(request); - RoleManager rm = new LiferayRoleManager(); - //check folder exists - Utils.getWSCompanyFolder(currentUser.getUsername(), currentContext, theCompany); - //look for company farms - Connection conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - List companyFarms = DBUtil.listFarmsByCompanyId(conn, theCompany.getTeamId()); - LinkedHashMap> theFiles = new LinkedHashMap<>(); - for (Farm farm : companyFarms) { - GCubeTeam theFarm = rm.getTeam(farm.getFarmId()); - farm.setName(theFarm.getTeamName()); - WorkspaceFolder farmFolder = Utils.getWSFarmFolder( - currentUser.getUsername(), - currentContext, - theCompany, theFarm); - List farmItems = farmFolder.getChildren(true); - Collections.sort(farmItems, new WSItemComparator()); - List farmFiles = new ArrayList<>(); - for (WorkspaceItem workspaceItem : farmItems) { - if (workspaceItem instanceof ExternalFile) { - ExternalFile file = (ExternalFile) workspaceItem; - farmFiles.add(file); - } - } - theFiles.put(farm, farmFiles); - } - request.setAttribute("companyPrivateFiles", theFiles); //pass to the JSP - String imageUrl = Utils.getCompanyLogoURL(theCompany.getTeamName(), groupId, request); - request.setAttribute("companyLogoURL", imageUrl); //pass to logo URL to the JSP - //display the view.jsp - super.render(request, response); - } - else { - PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(Utils.NOT_ADMIN_PAGE_PATH); - dispatcher.include(request, response); - } - - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void displayVersions(ActionRequest request, ActionResponse response) throws Exception { - String itemId = ParamUtil.getString(request, "fileItem"); - if (itemId == null || itemId.compareTo("")==0) { - SessionErrors.add(request.getPortletSession(),"form-error"); - return; - } - HttpServletRequest httpReq = PortalUtil.getHttpServletRequest(request); - GCubeUser currentUser = Utils.getCurrentUser(httpReq); - String context = Utils.getCurrentContext(httpReq); - Workspace ws = Utils.getWS(currentUser.getUsername(), context) ; - WorkspaceItem theItem = ws.getItem(itemId); - if (theItem instanceof ExternalFile) { - ExternalFile file = (ExternalFile) theItem; - List versions = file.getVersionHistory(); - request.setAttribute("versions", versions); //pass to the JSP - } else { - response.setRenderParameter("jspPage", PFISHConstants.OPERATION_ERROR_PATH); - } - request.setAttribute("itemId", itemId); - request.setAttribute("itemName", theItem.getName()); - response.setWindowState(WindowState.MAXIMIZED); - response.setRenderParameter("jspPage", "/html/farmrepository/show_all_versions.jsp"); - } - - - public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException, PortletException { - //if download file - String fileToDownloadId = ParamUtil.getString(resourceRequest, "fileToDownloadId", null); - //if download version - String versionDownloadItemId = ParamUtil.getString(resourceRequest, "versionDownloadItemId", null); - String versionDownloadName = ParamUtil.getString(resourceRequest, "versionDownloadName", null); - - setAuthorizationToken(resourceRequest); - //check if is a file download - if (fileToDownloadId != null) { - String selectedItemId = fileToDownloadId; - try { - ItemManagerClient client = AbstractPlugin.item().build(); - StreamDescriptor streamDescr = client.download(selectedItemId); - HttpServletResponse httpRes = PortalUtil.getHttpServletResponse(resourceResponse); - HttpServletRequest httpReq = PortalUtil.getHttpServletRequest(resourceRequest); - ServletResponseUtil.sendFile(httpReq,httpRes, streamDescr.getFileName(), streamDescr.getStream(), "application/download"); - streamDescr.getStream().close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - else if (versionDownloadItemId != null && versionDownloadName != null) { //check if download version - GCubeUser currentUser = Utils.getCurrentUser(resourceRequest); - String context = Utils.getCurrentContext(resourceRequest); - Workspace ws = Utils.getWS(currentUser.getUsername(), context) ; - WorkspaceItem theItem; - try { - theItem = ws.getItem(versionDownloadItemId); - if (theItem instanceof ExternalFile) { - ExternalFile file = (ExternalFile) theItem; - InputStream is = file.downloadVersion(versionDownloadName); - HttpServletResponse httpRes = PortalUtil.getHttpServletResponse(resourceResponse); - HttpServletRequest httpReq = PortalUtil.getHttpServletRequest(resourceRequest); - ServletResponseUtil.sendFile(httpReq,httpRes, versionDownloadName+"_"+file.getName(), is, "application/download"); - } - } catch (ItemNotFoundException | InternalErrorException e) { - e.printStackTrace(); - } - - } - - } - - /** - * set the authorization token in Thread local and return the current {@link AuthorizedUser} instance - * @param request - * @return - */ - private void setAuthorizationToken(ResourceRequest request) { - GCubeUser currentUser = Utils.getCurrentUser(request); - String scope = Utils.getCurrentContext(request); - String authorizationToken = Utils.getCurrentUserToken(scope, currentUser.getUsername()); - SecurityTokenProvider.instance.set(authorizationToken); - } - -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/EmptyFormsConfigurationAction.java b/src/main/java/org/gcube/portlets/user/performfish/EmptyFormsConfigurationAction.java deleted file mode 100644 index c9098b6..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/EmptyFormsConfigurationAction.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.gcube.portlets.user.performfish; -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.PortletConfig; -import javax.portlet.PortletPreferences; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; - -import com.liferay.portal.kernel.log.Log; -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.portlet.DefaultConfigurationAction; - -public class EmptyFormsConfigurationAction extends DefaultConfigurationAction { - private static Log _log = LogFactoryUtil.getLog(EmptyFormsConfigurationAction.class); - @Override - public void processAction(PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { - super.processAction(portletConfig, actionRequest, actionResponse); - PortletPreferences prefs = actionRequest.getPreferences(); - String phaseValue = prefs.getValue("phase", ""); - _log.info("selected phase to display= " + phaseValue + " in EmptyFormsConfigurationAction.processAction() saved correctly"); - } - - @Override - public String render(PortletConfig portletConfig, - RenderRequest renderRequest, RenderResponse renderResponse) - throws Exception { - return "/html/emptyformsdocumentsdisplay/empty_forms_config.jsp"; - } - -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/EmptyFormsDocumentsDisplay.java b/src/main/java/org/gcube/portlets/user/performfish/EmptyFormsDocumentsDisplay.java deleted file mode 100644 index 713bc05..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/EmptyFormsDocumentsDisplay.java +++ /dev/null @@ -1,220 +0,0 @@ -package org.gcube.portlets.user.performfish; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import javax.portlet.PortletException; -import javax.portlet.PortletPreferences; -import javax.portlet.PortletRequestDispatcher; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; -import javax.portlet.ResourceRequest; -import javax.portlet.ResourceResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.gcube.common.authorization.library.provider.SecurityTokenProvider; -import org.gcube.common.homelibrary.home.exceptions.InternalErrorException; -import org.gcube.common.homelibrary.home.workspace.Workspace; -import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder; -import org.gcube.common.homelibrary.home.workspace.WorkspaceItem; -import org.gcube.common.homelibrary.home.workspace.exceptions.ItemNotFoundException; -import org.gcube.common.homelibrary.home.workspace.folder.FolderItem; -import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile; -import org.gcube.common.homelibrary.util.WorkspaceUtil; -import org.gcube.common.scope.api.ScopeProvider; -import org.gcube.portlets.user.performfish.util.PFISHConstants; -import org.gcube.portlets.user.performfish.util.Utils; -import org.gcube.vomanagement.usermanagement.RoleManager; -import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager; -import org.gcube.vomanagement.usermanagement.model.GCubeTeam; - -import com.liferay.portal.kernel.json.JSONFactoryUtil; -import com.liferay.portal.kernel.json.JSONObject; -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.servlet.ServletResponseUtil; -import com.liferay.portal.kernel.upload.FileItem; -import com.liferay.portal.kernel.upload.UploadPortletRequest; -import com.liferay.portal.kernel.util.FileUtil; -import com.liferay.portal.kernel.util.GetterUtil; -import com.liferay.portal.kernel.util.ParamUtil; -import com.liferay.portal.kernel.util.StringPool; -import com.liferay.portal.util.PortalUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; - -/** - * Portlet implementation class EmptyFormsDocumentsDisplay - */ -public class EmptyFormsDocumentsDisplay extends MVCPortlet { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(EmptyFormsDocumentsDisplay.class); - - public static final String FOLDERID_PREFERENCE_ATTR_NAME = "folderId"; - private final static String RESOURCE_URL_ID = "uploadFiles"; - private final static String UPLOADED_FILE_ATTR_NAME = "myfile"; - private static String XLS_MIMETYPE = "application/vnd.ms-excel"; - private static String XLSX_MIMETYPE = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; - public static final String ATTACHMENT_FOLDER ="_uploaded_forms"; - private static RoleManager RM = new LiferayRoleManager(); - @Override - public void render(RenderRequest request, RenderResponse response) - throws PortletException, IOException { - _log.info(" This is render method of EmptyFormsDocumentsDisplay"); - try { - HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(request)); - String[] farmIds = ParamUtil.getParameterValues(httpReq, Utils.ENCODED_FARM_PARAM); - GCubeTeam theFarm = null; - if (farmIds == null || farmIds.length == 0 ) { - if (Utils.getUserFarmsNumber(request, response, this) < 2) { - theFarm = Utils.checkBelongingToOneFarmOnly(request, response, this); - request.setAttribute("theFarm", theFarm); //pass to the JSP - } - } - else { //the farmId is passed via param on the query string - long selectedFarmId = Utils.unmaskId(farmIds[0]); - theFarm = RM.getTeam(selectedFarmId); - if (Utils.checkBelongsToTeam(PortalUtil.getUserId(request), theFarm.getTeamId(), PortalUtil.getScopeGroupId(request)) ) {//check that the user belong ot the farm - request.setAttribute("theFarm", theFarm); //pass to the JSP - } - else { - PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(Utils.NOT_BELONGING_ANY_FARM_PAGE_PATH); - dispatcher.include(request, response); - } - } - if (theFarm != null) { - setGuestAuthorizationToken(request); - PortletPreferences portletPreferences = request.getPreferences(); - String folderId = GetterUtil.getString(portletPreferences.getValue(FOLDERID_PREFERENCE_ATTR_NAME, StringPool.BLANK)); - if (folderId != null && !folderId.equals("")) { - String context = Utils.getCurrentContext(request); - Workspace ws = Utils.getWS("guest", context) ; - String selectedPhase = GetterUtil.getString(portletPreferences.getValue(PFISHConstants.PHASE_PREFERENCE_ATTR_NAME, StringPool.BLANK)); - //in theChildren expected to find 3 subfolders: Utils.SHOW_HATCHERY, SHOW_PRE_ONGROWING .. - for (WorkspaceItem item : ws.getItem(folderId).getChildren()) { - if (item.getName().equalsIgnoreCase(selectedPhase)) { - List thefiles = item.getChildren(); - List theSheets = new ArrayList<>(); - List theInstructions = new ArrayList<>(); - ListtheSheetNames = new ArrayList<>(); - //separate from instructions - for (WorkspaceItem workspaceItem : thefiles) { - if (workspaceItem instanceof ExternalFile) { - ExternalFile file = (ExternalFile) workspaceItem; - if (file.getMimeType().equals(XLS_MIMETYPE) || file.getMimeType().equals(XLSX_MIMETYPE)) { //is a form - theSheets.add(file); - theSheetNames.add("'"+file.getName()+"'"); //serializing for Javascript - } - else - theInstructions.add(file); - } - } - request.setAttribute("theSheetNames", theSheetNames); //pass to the JSP - request.setAttribute("theSheets", theSheets); //pass to the JSP - request.setAttribute("theInstructions", theInstructions); //pass to the JSP - break; - } - } - } - super.render(request, response); - } - else { - PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(Utils.TOO_MANY_FARM_PAGE_PATH); - dispatcher.include(request, response); - } - - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException, PortletException { - _log.debug("serveResource ..."); - String resourceID = resourceRequest.getResourceID(); - if (resourceID != null && resourceID.equals(RESOURCE_URL_ID)) { - _log.debug("Upload File"); - UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(resourceRequest); - File multipartFile = uploadRequest.getFile(UPLOADED_FILE_ATTR_NAME); - - FileItem[] items = uploadRequest.getMultipartParameterMap().get(UPLOADED_FILE_ATTR_NAME); - String fileName = ""; - String contentType = ""; - for (int i = 0; i < items.length; i++) { - fileName = items[i].getFileName(); - contentType = items[i].getContentType(); - _log.debug(fileName); - _log.debug(contentType); - } - JSONObject fileObject = JSONFactoryUtil.createJSONObject(); - try { - String context = Utils.getCurrentContext(resourceRequest); - _log.debug("upload file, context="+context); - String username = Utils.getCurrentUser(resourceRequest).getUsername(); - String authorizationToken = Utils.getCurrentUserToken(context, username ); - SecurityTokenProvider.instance.set(authorizationToken); - ScopeProvider.instance.set(context); - Workspace workspace = Utils.getWS(username, context) ; - String wsItemId = uploadToUserWorkspace(workspace, fileName, contentType, new ByteArrayInputStream(FileUtil.getBytes(multipartFile))); - String toReturn = workspace.getItem(wsItemId).getPublicLink(false); - fileObject.put("fileName", fileName); - fileObject.put("urlEncoded", URLEncoder.encode(toReturn, "UTF-8")); - } catch (Exception e) { - _log.error("There was an error uploading the file " + fileName, e); - } - - resourceResponse.getWriter().println(fileObject); - } - else { - _log.debug("Download Original File"); - //if download file - String fileToDownloadId = ParamUtil.getString(resourceRequest, "fileToDownloadId", null); - String context = Utils.getCurrentContext(resourceRequest); - Workspace ws = Utils.getWS("guest", context) ; - WorkspaceItem theItem; - try { - theItem = ws.getItem(fileToDownloadId); - if (theItem instanceof ExternalFile) { - ExternalFile file = (ExternalFile) theItem; - InputStream is = file.getData(); - HttpServletResponse httpRes = PortalUtil.getHttpServletResponse(resourceResponse); - HttpServletRequest httpReq = PortalUtil.getHttpServletRequest(resourceRequest); - ServletResponseUtil.sendFile(httpReq,httpRes, file.getName(), is, "application/download"); - } - } catch (ItemNotFoundException | InternalErrorException e) { - e.printStackTrace(); - } - } - - - } - /** - * set the authorization token in Thread local and return the current {@link AuthorizedUser} instance - * @param request - * @return - */ - private void setGuestAuthorizationToken(RenderRequest request) { - String scope = Utils.getCurrentContext(request); - String authorizationToken = Utils.getCurrentUserToken(scope, "guest"); - SecurityTokenProvider.instance.set(authorizationToken); - } - - private String uploadToUserWorkspace(Workspace ownerWS, String fileName, String mimeType,InputStream fileData) throws Exception { - WorkspaceFolder attachmentDirectory = null; - try{ - attachmentDirectory = (WorkspaceFolder) ownerWS.getItemByPath(ownerWS.getRoot().getPath() + "/" + ATTACHMENT_FOLDER); - } catch (ItemNotFoundException e) { - _log.info(ATTACHMENT_FOLDER + " Workspace Folder does not exists, creating it "); - attachmentDirectory = ownerWS.getRoot().createFolder(ATTACHMENT_FOLDER, "Folder created automatically by the System"); - } - System.out.println("attachmentDirectory="+attachmentDirectory); - String itemName = WorkspaceUtil.getUniqueName(fileName, attachmentDirectory); - FolderItem item = WorkspaceUtil.createExternalFile(attachmentDirectory, itemName, "System created upon user form submission " + new Date(), mimeType, fileData); - String toReturn = item.getId(); - _log.debug("Uploaded " + item.getName() + " - Returned Workspace id=" +toReturn); - return toReturn; - } -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/ManageAssociations.java b/src/main/java/org/gcube/portlets/user/performfish/ManageAssociations.java deleted file mode 100644 index 88574e6..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/ManageAssociations.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.gcube.portlets.user.performfish; - -import java.io.IOException; -import java.sql.Connection; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; - -import javax.portlet.PortletException; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; - -import org.gcube.portlets.user.performfish.bean.Association; -import org.gcube.portlets.user.performfish.bean.Company; -import org.gcube.portlets.user.performfish.util.Utils; -import org.gcube.portlets.user.performfish.util.db.DBUtil; -import org.gcube.portlets.user.performfish.util.db.DatabaseConnection; - -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.model.Team; -import com.liferay.portal.service.GroupLocalServiceUtil; -import com.liferay.portal.service.TeamLocalServiceUtil; -import com.liferay.portal.util.PortalUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; - -/** - * Portlet implementation class ManageAssociations - */ -public class ManageAssociations extends MVCPortlet { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(ManageCompanies.class); - - @Override - public void render(RenderRequest request, RenderResponse response) - throws PortletException, IOException { - _log.info(" This is render method of ManageAssociations"); - try { - long groupId = PortalUtil.getScopeGroupId(request); - String vreName = GroupLocalServiceUtil.getGroup(groupId).getName(); - Connection conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - List associations = DBUtil.getAllAssociations(conn); - LinkedHashMap> associationCompanies = new LinkedHashMap<>(); - - for (Association ass : associations) { - Team theTeam = TeamLocalServiceUtil.getTeam(ass.getAssociationId()); - ass.setShortName(theTeam.getName()); - ass.setFullName(theTeam.getDescription()); - ass.setImageUrl(Utils.getCompanyLogoURL(ass.getShortName(), groupId, request)); - List companIds = DBUtil.getCompaniesIdsByAssociation(conn, ass.getAssociationId()); - List children = new ArrayList<>(); - for (Long companId : companIds) { - Team theCompany = TeamLocalServiceUtil.getTeam(companId); - Company toAdd = new Company(companId, ass.getAssociationId(), false); - toAdd.setName(theCompany.getName()); - toAdd.setImageUrl(Utils.getCompanyLogoURL(theCompany.getName(), groupId, request)); - children.add(toAdd); - } - associationCompanies.put(ass, children); - } - request.setAttribute("associations", associations); - request.setAttribute("associationCompanies", associationCompanies); - request.setAttribute("vreName", vreName); - - - super.render(request, response); - - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/ManageCompanies.java b/src/main/java/org/gcube/portlets/user/performfish/ManageCompanies.java deleted file mode 100644 index 27b6193..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/ManageCompanies.java +++ /dev/null @@ -1,111 +0,0 @@ -package org.gcube.portlets.user.performfish; - -import java.io.IOException; -import java.sql.Connection; -import java.util.List; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.PortletException; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; - -import org.gcube.portlets.user.performfish.bean.Company; -import org.gcube.portlets.user.performfish.util.Utils; -import org.gcube.portlets.user.performfish.util.db.DBUtil; -import org.gcube.portlets.user.performfish.util.db.DatabaseConnection; - -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.servlet.SessionErrors; -import com.liferay.portal.kernel.util.ParamUtil; -import com.liferay.portal.service.GroupLocalServiceUtil; -import com.liferay.portal.service.TeamLocalServiceUtil; -import com.liferay.portal.util.PortalUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; - -/** - * Portlet implementation class ManageCompanies - */ -public class ManageCompanies extends MVCPortlet { - - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(ManageCompanies.class); - - @Override - public void render(RenderRequest request, RenderResponse response) - throws PortletException, IOException { - _log.info(" This is render method of ManageCompanies"); - try { - long groupId = PortalUtil.getScopeGroupId(request); - String vreName = GroupLocalServiceUtil.getGroup(groupId).getName(); - Connection conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - List companies = DBUtil.getCompanies(conn); - for (Company company : companies) { - company.setName(TeamLocalServiceUtil.getTeam(company.getCompanyId()).getName()); - company.setImageUrl(Utils.getCompanyLogoURL(company.getName(), groupId, request)); - } - request.setAttribute("companies", companies); - request.setAttribute("vreName", vreName); - - - super.render(request, response); - - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * - * @param actionRequest - * @param actionResponse - * @throws Exception - */ - public void removeCompanies(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception { - String currentUsername = ParamUtil.getString(actionRequest, "currentUsername", "unknown"); - _log.info("removeCompanies action request from " + currentUsername); - long groupId = ParamUtil.getLong(actionRequest, "groupId"); - Connection conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - try { - String[] companyIdsToRemove = ParamUtil.getParameterValues(actionRequest, "removeCompanyIds"); - if (companyIdsToRemove.length > 0) { - _log.info("removeCompanyIds writing to DB now ..."); - boolean result = DBUtil.removeCompany(conn, companyIdsToRemove); - if (!result) { - SessionErrors.add(actionRequest.getPortletSession(), "operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - } - } - else { - SessionErrors.add(actionRequest.getPortletSession(), "operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - } - } - catch (Exception e) { - SessionErrors.add(actionRequest.getPortletSession(),"operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - e.printStackTrace(); - } - - } - - /** - * - * @param actionRequest - * @param actionResponse - * @throws Exception - */ - public void manageCompanyFarms(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception { - String currentUsername = ParamUtil.getString(actionRequest, "currentUsername", "unknown"); - _log.info("manageCompanyFarms action request from " + currentUsername); - String[] companyIdsToManage = ParamUtil.getParameterValues(actionRequest, "companyIds"); - if (companyIdsToManage.length == 1) { - System.out.println("tutto ok"); - } - else { - SessionErrors.add(actionRequest.getPortletSession(), "operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - } - } - - -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/ManageCompanyAdmins.java b/src/main/java/org/gcube/portlets/user/performfish/ManageCompanyAdmins.java deleted file mode 100644 index 12e2f01..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/ManageCompanyAdmins.java +++ /dev/null @@ -1,139 +0,0 @@ -package org.gcube.portlets.user.performfish; - -import java.io.IOException; -import java.util.List; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.PortletException; -import javax.portlet.PortletRequestDispatcher; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; - -import org.gcube.portlets.user.performfish.bean.CompanyMember; -import org.gcube.portlets.user.performfish.bean.Farm; -import org.gcube.portlets.user.performfish.util.PFISHConstants; -import org.gcube.portlets.user.performfish.util.Utils; -import org.gcube.vomanagement.usermanagement.RoleManager; -import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager; -import org.gcube.vomanagement.usermanagement.model.GCubeRole; -import org.gcube.vomanagement.usermanagement.model.GCubeTeam; - -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.servlet.SessionErrors; -import com.liferay.portal.kernel.util.ParamUtil; -import com.liferay.portal.model.Team; -import com.liferay.portal.service.TeamLocalServiceUtil; -import com.liferay.portal.util.PortalUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; - -/** - * Portlet implementation class ManageCompanyAdmins - */ -public class ManageCompanyAdmins extends MVCPortlet { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(ManageCompanyAdmins.class); - - @Override - public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException { - try { - long groupId = PortalUtil.getScopeGroupId(request); - GCubeTeam theTeam = Utils.checkBelongingToOneCompanyOnly(request, response, this); - request.setAttribute("theTeam", TeamLocalServiceUtil.getTeam(theTeam.getTeamId())); - RoleManager rm = new LiferayRoleManager(); - if (theTeam != null && Utils.isCompanyAdmin(Utils.getCurrentUser(request), groupId, theTeam)) { //check is Admin - //check folder exists - Utils.getWSCompanyFolder(Utils.getCurrentUser(request).getUsername(), Utils.getCurrentContext(request), theTeam); - - List companyAdmins = Utils.getCompanyAdminTeamMembers(theTeam.getTeamId(), theTeam.getGroupId()); - for (CompanyMember member : companyAdmins) { //anonymising email - member.setEmail(member.getUser().getEmail()); - List theFarms = Utils.getFarmsByUserId(member.getUserId(), theTeam.getTeamId(), groupId); - if (theFarms != null && !theFarms.isEmpty()) { - GCubeTeam theFarmTeam = rm.getTeam(theFarms.get(0).getFarmId()); - member.setAssociatedFarms(theFarms); - member.setAdmin(Utils.isFarmAdmin(member.getUser(), groupId, theFarmTeam)); - } - } - - request.setAttribute("companyAdmins", companyAdmins); //pass to the JSP - - String imageUrl = Utils.getCompanyLogoURL(theTeam.getTeamName(), groupId, request); - request.setAttribute("companyLogoURL", imageUrl); //pass to logo URL to the JSP - //display the view.jsp - super.render(request, response); - } - else { - PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(Utils.NOT_ADMIN_PAGE_PATH); - dispatcher.include(request, response); - } - - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * - * @param actionRequest - * @param actionResponse - * @throws Exception - */ - public void removeAdministratorRoleFromUsers(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception { - try { - long[] userIdsToRemoveFromCompanyAdmins = ParamUtil.getLongValues(actionRequest, "removeUserIds"); - long teamId = ParamUtil.getLong(actionRequest, "teamId"); - String currentUsername = ParamUtil.getString(actionRequest, "currentUsername"); - long currentGroupId = ParamUtil.getLong(actionRequest, "currentGroupId"); - _log.info(currentUsername + " has requested the deletion of some user(s) from company administrator having id="+teamId ); - LiferayRoleManager rm = new LiferayRoleManager(); - GCubeRole adminRole = new LiferayRoleManager().getRole(PFISHConstants.COMPANY_ADMIN_SITE_ROLE, currentGroupId); - for (int i = 0; i < userIdsToRemoveFromCompanyAdmins.length; i++) { - rm.removeRoleFromUser(userIdsToRemoveFromCompanyAdmins[i], currentGroupId, adminRole.getRoleId()); - _log.info("removing role from user with id " + userIdsToRemoveFromCompanyAdmins[i] + " done"); - } - } - catch (Exception e) { - SessionErrors.add(actionRequest.getPortletSession(),"operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - e.printStackTrace(); - } - } - - /** - * - * @param actionRequest - * @param actionResponse - * @throws Exception - */ - public void removeFarmUsers(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception { - try { - String currentUsername = ParamUtil.getString(actionRequest, "currentUsername"); - long currentGroupId = ParamUtil.getLong(actionRequest, "currentGroupId"); - long companyUserId = ParamUtil.getLong(actionRequest, "companyUserId"); - long companyId = ParamUtil.getLong(actionRequest, "companyId"); - String context = Utils.getCurrentContext(currentGroupId); - _log.info(currentUsername + " has requested the deletion of userid " + companyUserId + " from farms in context="+context); - List theUserFarms = Utils.getFarmsByUserId(companyUserId, companyId, currentGroupId); - for (Farm farm : theUserFarms) { - removeFromFarm(farm.getFarmId(), currentGroupId, companyUserId); - } - } - catch (Exception e) { - SessionErrors.add(actionRequest.getPortletSession(),"operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - e.printStackTrace(); - } - } - - private boolean removeFromFarm(long farmId, long currentGroupId, long companyUserId) throws Exception { - Team team = TeamLocalServiceUtil.getTeam(farmId);//check that the farm is real - TeamLocalServiceUtil.deleteUserTeam(companyUserId, team.getTeamId()); - _log.info("removing user from farm Done"); - LiferayRoleManager rm = new LiferayRoleManager(); - GCubeRole adminRole = new LiferayRoleManager().getRole(PFISHConstants.FARM_ADMIN_SITE_ROLE, currentGroupId); - _log.info("removing role from user with id " + companyUserId); - return rm.removeRoleFromUser(companyUserId, currentGroupId, adminRole.getRoleId()); - } - - -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/ManageCompanyUsers.java b/src/main/java/org/gcube/portlets/user/performfish/ManageCompanyUsers.java deleted file mode 100644 index 49c6b28..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/ManageCompanyUsers.java +++ /dev/null @@ -1,160 +0,0 @@ -package org.gcube.portlets.user.performfish; - -import java.io.IOException; -import java.util.Collections; -import java.util.List; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.PortletException; -import javax.portlet.PortletRequestDispatcher; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; - -import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder; -import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder; -import org.gcube.portlets.user.performfish.bean.CompanyMember; -import org.gcube.portlets.user.performfish.bean.Farm; -import org.gcube.portlets.user.performfish.util.PFISHConstants; -import org.gcube.portlets.user.performfish.util.Utils; -import org.gcube.portlets.user.performfish.util.comparators.CompanyMemberComparator; -import org.gcube.vomanagement.usermanagement.RoleManager; -import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager; -import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager; -import org.gcube.vomanagement.usermanagement.model.GCubeRole; -import org.gcube.vomanagement.usermanagement.model.GCubeTeam; - -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.servlet.SessionErrors; -import com.liferay.portal.kernel.util.ParamUtil; -import com.liferay.portal.model.Team; -import com.liferay.portal.service.TeamLocalServiceUtil; -import com.liferay.portal.util.PortalUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; - -/** - * Portlet implementation class ManageCompanyUsers - */ -public class ManageCompanyUsers extends MVCPortlet { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(ManageCompanyUsers.class); - @Override - public void render(RenderRequest request, RenderResponse response) - throws PortletException, IOException { - _log.info(" This is render method of ManageCompanyusers"); - try { - long groupId = PortalUtil.getScopeGroupId(request); - GCubeTeam theTeam = Utils.checkBelongingToOneCompanyOnly(request, response, this); - request.setAttribute("theTeam", TeamLocalServiceUtil.getTeam(theTeam.getTeamId())); - RoleManager rm = new LiferayRoleManager(); - if (theTeam != null && Utils.isCompanyAdmin(Utils.getCurrentUser(request), groupId, theTeam)) { //check is Admin - //check folder exists - Utils.getWSCompanyFolder(Utils.getCurrentUser(request).getUsername(), Utils.getCurrentContext(request), theTeam); - List companyMembers = Utils.getRegularCompanyMembers(theTeam.getTeamId(), theTeam.getGroupId()); - for (CompanyMember member : companyMembers) { //anonymising email - member.setEmail(member.getUser().getEmail()); - List theFarms = Utils.getFarmsByUserId(member.getUserId(), theTeam.getTeamId(), groupId); - if (theFarms != null && !theFarms.isEmpty()) { - GCubeTeam theFarmTeam = rm.getTeam(theFarms.get(0).getFarmId()); - member.setAssociatedFarms(theFarms); - member.setAdmin(Utils.isFarmAdmin(member.getUser(), groupId, theFarmTeam)); - } - } - Collections.sort(companyMembers, new CompanyMemberComparator()); - request.setAttribute("companyMembers", companyMembers); //pass to the JSP - String imageUrl = Utils.getCompanyLogoURL(theTeam.getTeamName(), groupId, request); - request.setAttribute("companyLogoURL", imageUrl); //pass to logo URL to the JSP - //display the view.jsp - super.render(request, response); - } - else { - PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(Utils.NOT_ADMIN_PAGE_PATH); - dispatcher.include(request, response); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - /** - * - * @param actionRequest - * @param actionResponse - * @throws Exception - */ - public void removeCompanUsers(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception { - try { - String[] usernamesToRemoveFromCompany = ParamUtil.getParameterValues(actionRequest, "removeUserIds"); - long teamId = ParamUtil.getLong(actionRequest, "teamId"); - String currentUsername = ParamUtil.getString(actionRequest, "currentUsername"); - long currentGroupId = ParamUtil.getLong(actionRequest, "currentGroupId"); - String context = Utils.getCurrentContext(currentGroupId); - _log.info(currentUsername + " has requested the deletion of some user(s) from company having id="+teamId + " in context="+context); - LiferayRoleManager rm = new LiferayRoleManager(); - LiferayUserManager um = new LiferayUserManager(); - GCubeTeam team = rm.getTeam(teamId); - WorkspaceFolder wsFolder = Utils.getWSCompanyFolder(currentUsername, context, team); - if (wsFolder.isShared()) { - WorkspaceSharedFolder sharedFolder = (WorkspaceSharedFolder) wsFolder; - for (int i = 0; i < usernamesToRemoveFromCompany.length; i++) { - _log.info("Unsharing user =>"+usernamesToRemoveFromCompany[i]); - sharedFolder.unShare(usernamesToRemoveFromCompany[i]); - _log.info("Unsharing OK removing user from team =>"+usernamesToRemoveFromCompany[i]); - long userId = um.getUserByUsername(usernamesToRemoveFromCompany[i]).getUserId(); - TeamLocalServiceUtil.deleteUserTeam(userId, team.getTeamId()); - List thePossibleFarms = Utils.getFarmsByUserId(userId, teamId, currentGroupId); - if (thePossibleFarms != null && !thePossibleFarms.isEmpty()) { - for (Farm farm : thePossibleFarms) { - removeFromFarm(farm.getFarmId(), currentGroupId, userId); - } - } - _log.info("removing user from team Done"); - } - } - else { - SessionErrors.add(actionRequest.getPortletSession(), "operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - } - } - catch (Exception e) { - SessionErrors.add(actionRequest.getPortletSession(),"operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - e.printStackTrace(); - } - } - - - /** - * - * @param actionRequest - * @param actionResponse - * @throws Exception - */ - public void removeFarmUsers(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception { - try { - String currentUsername = ParamUtil.getString(actionRequest, "currentUsername"); - long currentGroupId = ParamUtil.getLong(actionRequest, "currentGroupId"); - long companyUserId = ParamUtil.getLong(actionRequest, "companyUserId"); - long companyId = ParamUtil.getLong(actionRequest, "companyId"); - String context = Utils.getCurrentContext(currentGroupId); - _log.info(currentUsername + " has requested the deletion of userid " + companyUserId + " from farms in context="+context); - List theUserFarms = Utils.getFarmsByUserId(companyUserId, companyId, currentGroupId); - for (Farm farm : theUserFarms) { - removeFromFarm(farm.getFarmId(), currentGroupId, companyUserId); - } - } - catch (Exception e) { - SessionErrors.add(actionRequest.getPortletSession(),"operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - e.printStackTrace(); - } - } - - private boolean removeFromFarm(long farmId, long currentGroupId, long companyUserId) throws Exception { - Team team = TeamLocalServiceUtil.getTeam(farmId);//check that the farm is real - TeamLocalServiceUtil.deleteUserTeam(companyUserId, team.getTeamId()); - _log.info("removing user from farm Done"); - LiferayRoleManager rm = new LiferayRoleManager(); - GCubeRole adminRole = new LiferayRoleManager().getRole(PFISHConstants.FARM_ADMIN_SITE_ROLE, currentGroupId); - _log.info("removing role from user with id " + companyUserId); - return rm.removeRoleFromUser(companyUserId, currentGroupId, adminRole.getRoleId()); - } -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/ManageFarmAdministrators.java b/src/main/java/org/gcube/portlets/user/performfish/ManageFarmAdministrators.java deleted file mode 100644 index 5ac752b..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/ManageFarmAdministrators.java +++ /dev/null @@ -1,130 +0,0 @@ -package org.gcube.portlets.user.performfish; - -import java.io.IOException; -import java.util.List; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.PortletException; -import javax.portlet.PortletMode; -import javax.portlet.PortletRequestDispatcher; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; -import javax.portlet.WindowState; -import javax.servlet.http.HttpServletRequest; - -import org.gcube.portlets.user.performfish.util.PFISHConstants; -import org.gcube.portlets.user.performfish.util.Utils; -import org.gcube.vomanagement.usermanagement.RoleManager; -import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager; -import org.gcube.vomanagement.usermanagement.model.GCubeRole; -import org.gcube.vomanagement.usermanagement.model.GCubeTeam; -import org.gcube.vomanagement.usermanagement.model.GCubeUser; - -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.servlet.SessionErrors; -import com.liferay.portal.kernel.util.ParamUtil; -import com.liferay.portal.service.TeamLocalServiceUtil; -import com.liferay.portal.util.PortalUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; - -/** - * Portlet implementation class ManageFarmAdministrators - */ -public class ManageFarmAdministrators extends MVCPortlet { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(ManageFarmAdministrators.class); - private static RoleManager RM = new LiferayRoleManager(); - @Override - public void render(RenderRequest request, RenderResponse response) - throws PortletException, IOException { - _log.info(" This is render method of ManageFarmAdministrators"); - try { - HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(request)); - String[] farmIds = ParamUtil.getParameterValues(httpReq, Utils.ENCODED_FARM_PARAM); - long[] farmIds2 = ParamUtil.getLongValues(httpReq, "farmId"); - GCubeTeam theFarm = null; - if ((farmIds == null || farmIds.length == 0) && (farmIds2 == null || farmIds2.length == 0)) { - if (Utils.getUserFarmsNumber(request, response, this) < 2) { - theFarm = Utils.checkBelongingToOneFarmOnly(request, response, this); - request.setAttribute("theFarm", theFarm); //pass to the JSP - } - } - else { //the farmId (encrypted) or farmId2 (not encrypted) is passed via param on the query string - long selectedFarmId = 0; - if (farmIds != null && farmIds.length > 0) { - selectedFarmId = Utils.unmaskId(farmIds[0]); - } else - selectedFarmId = farmIds2[0]; - theFarm = RM.getTeam(selectedFarmId); - if (Utils.checkBelongsToTeam(PortalUtil.getUserId(request), theFarm.getTeamId(), PortalUtil.getScopeGroupId(request)) ) {//check that the user belong ot the farm - request.setAttribute("theFarm", theFarm); //pass to the JSP - } - else { - PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(Utils.NOT_BELONGING_ANY_FARM_PAGE_PATH); - dispatcher.include(request, response); - } - } - long groupId = PortalUtil.getScopeGroupId(request); - GCubeTeam theCompany = Utils.checkBelongingToOneCompanyOnly(request, response, this); - if (theCompany != null && theFarm !=null) { - request.setAttribute("theCompany", theCompany); - request.setAttribute("theFarm", TeamLocalServiceUtil.getTeam(theFarm.getTeamId())); - if (theCompany != null && Utils.isFarmAdmin(Utils.getCurrentUser(request), groupId, theCompany)) { //check is Admin - Boolean isCompanyAdministrator = Utils.isCompanyAdmin(Utils.getCurrentUser(request), groupId, theCompany); - request.setAttribute("isCompanyAdministrator", isCompanyAdministrator); - //check folder exists - Utils.getWSCompanyFolder(Utils.getCurrentUser(request).getUsername(), Utils.getCurrentContext(request), theCompany); - - List farmAdmins = Utils.getFarmAdminTeamMembers(theCompany, theFarm); - request.setAttribute("farmAdmins", farmAdmins); //pass to the JSP - - String imageUrl = Utils.getCompanyLogoURL(theCompany.getTeamName(), groupId, request); - request.setAttribute("companyLogoURL", imageUrl); //pass to logo URL to the JSP - //display the view.jsp - super.render(request, response); - } - else { - PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(Utils.NOT_FARM_ADMIN_PAGE_PATH); - dispatcher.include(request, response); - } - } - else { - PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(Utils.TOO_MANY_FARM_PAGE_PATH); - dispatcher.include(request, response); - } - } catch (Exception e) { - e.printStackTrace(); - PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(Utils.NOT_FARM_ADMIN_PAGE_PATH); - dispatcher.include(request, response); - } - } - - /** - * - * @param actionRequest - * @param actionResponse - * @throws Exception - */ - public void removeAdministratorRoleFromUsers(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception { - try { - long[] userIdsToRemoveFromCompanyAdmins = ParamUtil.getLongValues(actionRequest, "removeUserIds"); - long teamId = ParamUtil.getLong(actionRequest, "teamId"); - String currentUsername = ParamUtil.getString(actionRequest, "currentUsername"); - long currentGroupId = ParamUtil.getLong(actionRequest, "currentGroupId"); - _log.info(currentUsername + " has requested the deletion of some user(s) from company administrator having id="+teamId ); - LiferayRoleManager rm = new LiferayRoleManager(); - GCubeRole adminRole = new LiferayRoleManager().getRole(PFISHConstants.FARM_ADMIN_SITE_ROLE, currentGroupId); - for (int i = 0; i < userIdsToRemoveFromCompanyAdmins.length; i++) { - rm.removeRoleFromUser(userIdsToRemoveFromCompanyAdmins[i], currentGroupId, adminRole.getRoleId()); - _log.info("removing role from user with id " + userIdsToRemoveFromCompanyAdmins[i] + " done"); - } - actionResponse.setPortletMode(PortletMode.VIEW); - actionResponse.setWindowState(WindowState.NORMAL); - } - catch (Exception e) { - SessionErrors.add(actionRequest.getPortletSession(),"operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - e.printStackTrace(); - } - } -} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/performfish/ManageFarmUsers.java b/src/main/java/org/gcube/portlets/user/performfish/ManageFarmUsers.java deleted file mode 100644 index 9aa4977..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/ManageFarmUsers.java +++ /dev/null @@ -1,134 +0,0 @@ -package org.gcube.portlets.user.performfish; - -import java.io.IOException; -import java.util.Collections; -import java.util.List; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.PortletException; -import javax.portlet.PortletMode; -import javax.portlet.PortletRequestDispatcher; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; -import javax.portlet.WindowState; -import javax.servlet.http.HttpServletRequest; - -import org.gcube.portlets.user.performfish.util.Utils; -import org.gcube.portlets.user.performfish.util.comparators.UserComparator; -import org.gcube.vomanagement.usermanagement.RoleManager; -import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager; -import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager; -import org.gcube.vomanagement.usermanagement.model.GCubeTeam; -import org.gcube.vomanagement.usermanagement.model.GCubeUser; - -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.servlet.SessionErrors; -import com.liferay.portal.kernel.util.ParamUtil; -import com.liferay.portal.service.TeamLocalServiceUtil; -import com.liferay.portal.util.PortalUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; - -/** - * Portlet implementation class ManageFarmUsers - */ -public class ManageFarmUsers extends MVCPortlet { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(ManageFarmUsers.class); - private static RoleManager RM = new LiferayRoleManager(); - @Override - public void render(RenderRequest request, RenderResponse response) - throws PortletException, IOException { - _log.info(" This is render method of ManageFarmUsers"); - try { - HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(request)); - String[] farmIds = ParamUtil.getParameterValues(httpReq, Utils.ENCODED_FARM_PARAM); - long[] farmIds2 = ParamUtil.getLongValues(httpReq, "farmId"); - GCubeTeam theFarm = null; - if ((farmIds == null || farmIds.length == 0) && (farmIds2 == null || farmIds2.length == 0)) { - if (Utils.getUserFarmsNumber(request, response, this) < 2) { - theFarm = Utils.checkBelongingToOneFarmOnly(request, response, this); - request.setAttribute("theFarm", theFarm); //pass to the JSP - } - } - else { //the farmId (encrypted) or farmId2 (not encrypted) is passed via param on the query string - long selectedFarmId = 0; - if (farmIds != null && farmIds.length > 0) { - selectedFarmId = Utils.unmaskId(farmIds[0]); - } else - selectedFarmId = farmIds2[0]; - theFarm = RM.getTeam(selectedFarmId); - if (Utils.checkBelongsToTeam(PortalUtil.getUserId(request), theFarm.getTeamId(), PortalUtil.getScopeGroupId(request)) ) {//check that the user belong ot the farm - request.setAttribute("theFarm", theFarm); //pass to the JSP - } - else { - PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(Utils.NOT_BELONGING_ANY_FARM_PAGE_PATH); - dispatcher.include(request, response); - } - } - long groupId = PortalUtil.getScopeGroupId(request); - GCubeTeam theCompany = Utils.checkBelongingToOneCompanyOnly(request, response, this); - if (theCompany != null && theFarm !=null) { - request.setAttribute("theCompany", theCompany); - if (theFarm != null && Utils.isFarmAdmin(Utils.getCurrentUser(request), groupId, theFarm)) { //check is Admin - request.setAttribute("theFarm", TeamLocalServiceUtil.getTeam(theFarm.getTeamId())); - //check folder exists - Utils.getWSCompanyFolder(Utils.getCurrentUser(request).getUsername(), Utils.getCurrentContext(request), theCompany); - List farmMembers = Utils.getRegularFarmMembers(theFarm.getTeamId(), theFarm.getGroupId()); - for (GCubeUser member : farmMembers) { //anonymising email - int n = member.getEmail().indexOf("@"); - member.setEmail("********"+member.getEmail().substring(n)); - } - Collections.sort(farmMembers, new UserComparator()); - request.setAttribute("farmMembers", farmMembers); //pass to the JSP - String imageUrl = Utils.getCompanyLogoURL(theCompany.getTeamName(), groupId, request); - request.setAttribute("companyLogoURL", imageUrl); //pass to logo URL to the JSP - //display the view.jsp - super.render(request, response); - } - else { - PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(Utils.NOT_FARM_ADMIN_PAGE_PATH); - dispatcher.include(request, response); - } - } - else { - PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(Utils.TOO_MANY_FARM_PAGE_PATH); - dispatcher.include(request, response); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - /** - * - * @param actionRequest - * @param actionResponse - * @throws Exception - */ - public void removeFarmUsers(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception { - try { - String[] usernamesToRemoveFromCompany = ParamUtil.getParameterValues(actionRequest, "removeUserIds"); - long farmId = ParamUtil.getLong(actionRequest, "farmId"); - String currentUsername = ParamUtil.getString(actionRequest, "currentUsername"); - long currentGroupId = ParamUtil.getLong(actionRequest, "currentGroupId"); - String context = Utils.getCurrentContext(currentGroupId); - _log.info(currentUsername + " has requested the deletion of some user(s) from farm having id="+farmId + " in context="+context); - LiferayRoleManager rm = new LiferayRoleManager(); - LiferayUserManager um = new LiferayUserManager(); - GCubeTeam team = rm.getTeam(farmId); - for (int i = 0; i < usernamesToRemoveFromCompany.length; i++) { - _log.info("removing user from farm =>"+usernamesToRemoveFromCompany[i]); - long userId = um.getUserByUsername(usernamesToRemoveFromCompany[i]).getUserId(); - TeamLocalServiceUtil.deleteUserTeam(userId, team.getTeamId()); - _log.info("removing user from farm Done"); - } - actionResponse.setPortletMode(PortletMode.VIEW); - actionResponse.setWindowState(WindowState.NORMAL); - } - catch (Exception e) { - SessionErrors.add(actionRequest.getPortletSession(),"operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - e.printStackTrace(); - } - } - -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/ManageFarms.java b/src/main/java/org/gcube/portlets/user/performfish/ManageFarms.java deleted file mode 100644 index 8b0442b..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/ManageFarms.java +++ /dev/null @@ -1,277 +0,0 @@ -package org.gcube.portlets.user.performfish; - -import java.io.IOException; -import java.sql.Connection; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.PortletException; -import javax.portlet.PortletRequestDispatcher; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; - -import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder; -import org.gcube.portlets.user.performfish.bean.Farm; -import org.gcube.portlets.user.performfish.util.PFISHConstants; -import org.gcube.portlets.user.performfish.util.Utils; -import org.gcube.portlets.user.performfish.util.comparators.FarmComparator; -import org.gcube.portlets.user.performfish.util.db.DBUtil; -import org.gcube.portlets.user.performfish.util.db.DatabaseConnection; -import org.gcube.vomanagement.usermanagement.RoleManager; -import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager; -import org.gcube.vomanagement.usermanagement.model.GCubeTeam; -import org.gcube.vomanagement.usermanagement.model.GCubeUser; - -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.servlet.SessionErrors; -import com.liferay.portal.kernel.util.ParamUtil; -import com.liferay.portal.model.Layout; -import com.liferay.portal.model.ResourceConstants; -import com.liferay.portal.model.ResourcePermission; -import com.liferay.portal.model.Role; -import com.liferay.portal.security.permission.ActionKeys; -import com.liferay.portal.service.LayoutServiceUtil; -import com.liferay.portal.service.ResourcePermissionLocalServiceUtil; -import com.liferay.portal.service.RoleLocalServiceUtil; -import com.liferay.portal.service.TeamLocalServiceUtil; -import com.liferay.portal.util.PortalUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; - -/** - * Portlet implementation class ManageFarms - */ -public class ManageFarms extends MVCPortlet { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(ManageCompanies.class); - private static RoleManager RM = new LiferayRoleManager(); - @Override - public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException { - try { - long groupId = PortalUtil.getScopeGroupId(request); - - GCubeTeam theCompany = Utils.checkBelongingToOneCompanyOnly(request, response, this); - if (theCompany != null && Utils.isCompanyAdmin(Utils.getCurrentUser(request), groupId, theCompany)) { //check is Admin - Connection conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - List farms = DBUtil.listFarmsByCompanyId(conn, theCompany.getTeamId()); - for (Farm farm : farms) { - GCubeTeam theFarm = RM.getTeam(farm.getFarmId()); - farm.setName(theFarm.getTeamName()); - farm.setDateCreated(theFarm.getCreatedate()); - farm.setImageUrl(Utils.getCompanyLogoURL(theCompany.getTeamName(), groupId, request)); - List farmAdmins = Utils.getFarmAdminTeamMembers(theCompany, theFarm); - farm.setAdministrators(farmAdmins); - } - Collections.sort(farms, new FarmComparator()); - request.setAttribute("farms", farms); - request.setAttribute("company", theCompany); - super.render(request, response); - } - else { - PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(Utils.NOT_ADMIN_PAGE_PATH); - dispatcher.include(request, response); - } - - } catch (Exception e) { - e.printStackTrace(); - } - } - - - /** - * Delete FARM - * @param actionRequest - * @param actionResponse - * @throws Exception - */ - public void deleteFarm(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception { - _log.info("deleteFarm ActionRequest="); - long groupId = ParamUtil.getLong(actionRequest, "currentGroupId"); - long companyId = ParamUtil.getLong(actionRequest, "CompanyId"); - long farmId = ParamUtil.getLong(actionRequest, "FarmId"); - try { - Connection conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - if (groupId > 0 && companyId > 0 && farmId > 0) { - long userId = PortalUtil.getUserId(actionRequest); - String username = Utils.getCurrentUser(userId).getUsername(); - String context = Utils.getCurrentContext(groupId); - GCubeTeam theFarm = RM.getTeam(farmId); - GCubeTeam theCompany = RM.getTeam(companyId); - _log.info("Trying Delete Farm with name " + theFarm.getTeamName() + " of Company: " + theCompany.getTeamName()); - WorkspaceFolder farmFolder = Utils.getWSFarmFolder(username, context, theCompany, theFarm); - Utils.getWS(username, context).removeItem(farmFolder.getId()); - _log.info(username + " Deleted Farm Folder with Id = "+farmId + " deleting farm row DB now "); - boolean resultDeleteFarmDB = DBUtil.deleteFarm(conn, farmId); - if (!resultDeleteFarmDB) { - renderErrorPage(actionRequest, actionResponse); - } - TeamLocalServiceUtil.deleteTeam(farmId); - } - else - renderErrorPage(actionRequest, actionResponse); - } catch (Exception e) { - e.printStackTrace(); - renderErrorPage(actionRequest, actionResponse); - } - } - /** - * Edit FARM - * @param actionRequest - * @param actionResponse - * @throws Exception - */ - public void editFarm(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception { - long groupId = ParamUtil.getLong(actionRequest, "currentGroupId"); - long companyId = ParamUtil.getLong(actionRequest, "CompanyId"); - long farmId = ParamUtil.getLong(actionRequest, "FarmId"); - String farmName = ParamUtil.getString(actionRequest, "farmName"); - String farmLocation = ParamUtil.getString(actionRequest, "Location", ""); - try { - Connection dbConnection = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - if (groupId > 0 && companyId > 0 && !farmName.equals("")) { - //edit the team first - String companyName = TeamLocalServiceUtil.getTeam(companyId).getName(); - String theNewFarmName = farmName.trim(); - GCubeTeam editedFarm = null; - try { - editedFarm = new LiferayRoleManager().updateTeam(farmId, theNewFarmName, theNewFarmName + " is a farm belonging to " + companyName); - } - catch (Exception e) { - _log.error("editFarm error ... farm team name may exists already"); - renderErrorPageFarmExistAlready(actionRequest, actionResponse); - return; - } - if (editedFarm != null) { - _log.info("editedFarm writing to DB now ... farm team edited with id="+editedFarm.getTeamId()); - boolean resultUpdate = DBUtil.editFarm(dbConnection, editedFarm.getTeamId(), theNewFarmName, farmLocation); - if (!resultUpdate) { - renderErrorPage(actionRequest, actionResponse); - } - } - else { - renderErrorPage(actionRequest, actionResponse); - } - } - else - renderErrorPage(actionRequest, actionResponse); - } catch (Exception e) { - e.printStackTrace(); - renderErrorPage(actionRequest, actionResponse); - } - } - - - /** - * ADD FARM - * @param actionRequest - * @param actionResponse - * @throws Exception - */ - public void addFarm(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception { - long groupId = ParamUtil.getLong(actionRequest, "currentGroupId"); - long companyId = ParamUtil.getLong(actionRequest, "CompanyId"); - String farmName = ParamUtil.getString(actionRequest, "farmName"); - String farmLocation = ParamUtil.getString(actionRequest, "Location", ""); - String theCreatorFullName = ParamUtil.getString(actionRequest, "theCreatorFullName", ""); - try { - Connection dbConnection = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - if (groupId > 0 && companyId > 0 && !farmName.equals("")) { - //create the team first - String companyName = TeamLocalServiceUtil.getTeam(companyId).getName(); - String theFarmName = farmName.trim(); - GCubeTeam newFarm = null; - try { - newFarm = new LiferayRoleManager().createTeam(groupId, theFarmName, farmName + " is a farm belonging to " + companyName); - } - catch (Exception e) { - _log.error("addFarm error ... farm team name may exists already"); - renderErrorPageFarmExistAlready(actionRequest, actionResponse); - return; - } - if (newFarm != null) { - _log.info("addFarm writing to DB now ... farm team created with id="+newFarm.getTeamId()); - boolean resultInsert = DBUtil.addFarm(dbConnection, newFarm.getTeamId(), companyId, theFarmName, farmLocation, theCreatorFullName); - boolean resultAssignPermissions = assignToFarmTheCompanyPermissions(groupId, companyId, newFarm.getTeamId()); - if (! (resultInsert && resultAssignPermissions) ) { - renderErrorPage(actionRequest, actionResponse); - } - } - else - renderErrorPage(actionRequest, actionResponse); - } - else - renderErrorPage(actionRequest, actionResponse); - } catch (Exception e) { - e.printStackTrace(); - renderErrorPage(actionRequest, actionResponse); - } - } - /** - * - * @param groupId - * @return the layout objects of the pages for the phases enabled for a given company (e.g. phases: Hatchery, Growout) - * @throws Exception - */ - private List getCompanyEnabledPhasesLayout(long groupId, long companyTeamId) throws Exception { - - List toReturn = new ArrayList<>(); - List all3phases = new ArrayList<>(); - List pages = LayoutServiceUtil.getLayouts(groupId, true); - for (Layout layout : pages) { - if (layout.getFriendlyURL().equalsIgnoreCase(PFISHConstants.GROWOUT_PAGE_LAYOUT_FRIENDLY_URL) || - layout.getFriendlyURL().equalsIgnoreCase(PFISHConstants.HATCHERY_PAGE_LAYOUT_FRIENDLY_URL) || - layout.getFriendlyURL().equalsIgnoreCase(PFISHConstants.PREGROW_PAGE_LAYOUT_FRIENDLY_URL)) { - all3phases.add(layout); - } - } - final long defaultCompanyId = PortalUtil.getDefaultCompanyId(); - Role teamRoleCompany = RoleLocalServiceUtil.getTeamRole(defaultCompanyId, companyTeamId); - List rPermissions = ResourcePermissionLocalServiceUtil.getRoleResourcePermissions(teamRoleCompany.getRoleId()); - - for (Layout layout : all3phases) { - for (ResourcePermission rp : rPermissions) { - if (layout.getPrimaryKey() == Long.parseLong(rp.getPrimKey()) && rp.getActionIds() == 1) { //tha actiondId has to be 1 - toReturn.add(layout); - } - } - } - return toReturn; - } - - /** - * - * @param groupId - * @param companyTeamId - * @param farmTeamId - * @return - */ - private boolean assignToFarmTheCompanyPermissions(long groupId, long companyTeamId, long farmTeamId) { - try { - final long defaultCompanyId = PortalUtil.getDefaultCompanyId(); - List layoutCompanyPhases = getCompanyEnabledPhasesLayout(groupId, companyTeamId); - Role teamRoleFarm = RoleLocalServiceUtil.getTeamRole(defaultCompanyId, farmTeamId); - - for (Layout phase : layoutCompanyPhases) { - _log.info("setting Resource Permissions for farm with id = " + farmTeamId); - ResourcePermissionLocalServiceUtil.setResourcePermissions( - defaultCompanyId, Layout.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(phase.getPrimaryKey()), teamRoleFarm.getRoleId(), - new String[] { ActionKeys.VIEW }); - } - return true; - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - - private void renderErrorPage(ActionRequest actionRequest, ActionResponse actionResponse) { - SessionErrors.add(actionRequest.getPortletSession(),"operation-error"); - actionResponse.setRenderParameter("mvcPath", PFISHConstants.OPERATION_ERROR_PATH); - } - - private void renderErrorPageFarmExistAlready(ActionRequest actionRequest, ActionResponse actionResponse) { - SessionErrors.add(actionRequest.getPortletSession(),"operation-error"); - actionResponse.setRenderParameter("mvcPath", PFISHConstants.FARM_NAME_ALREADY_EXIST_ERROR_PATH); - } -} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/performfish/PromoteCompanyAdministrators.java b/src/main/java/org/gcube/portlets/user/performfish/PromoteCompanyAdministrators.java deleted file mode 100644 index 6041ac4..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/PromoteCompanyAdministrators.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.gcube.portlets.user.performfish; - -import java.io.IOException; -import java.util.List; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.PortletException; -import javax.portlet.PortletRequestDispatcher; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; - -import org.gcube.portlets.user.performfish.bean.CompanyMember; -import org.gcube.portlets.user.performfish.util.PFISHConstants; -import org.gcube.portlets.user.performfish.util.Utils; -import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager; -import org.gcube.vomanagement.usermanagement.model.GCubeRole; -import org.gcube.vomanagement.usermanagement.model.GCubeTeam; -import org.gcube.vomanagement.usermanagement.model.GCubeUser; - -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.servlet.SessionErrors; -import com.liferay.portal.kernel.util.ParamUtil; -import com.liferay.portal.service.TeamLocalServiceUtil; -import com.liferay.portal.util.PortalUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; - -/** - * Portlet implementation class PromoteCompanyAdministrators - */ -public class PromoteCompanyAdministrators extends MVCPortlet { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(PromoteCompanyAdministrators.class); - - @Override - public void render(RenderRequest request, RenderResponse response) - throws PortletException, IOException { - _log.debug(" This is render method of PromoteCompanyAdministrators"); - try { - long groupId = PortalUtil.getScopeGroupId(request); - GCubeTeam theTeam = Utils.checkBelongingToOneCompanyOnly(request, response, this); - request.setAttribute("theTeam", TeamLocalServiceUtil.getTeam(theTeam.getTeamId())); - if (theTeam != null && Utils.isCompanyAdmin(Utils.getCurrentUser(request), groupId, theTeam)) { //check is Admin - //check folder exists - Utils.getWSCompanyFolder(Utils.getCurrentUser(request).getUsername(), Utils.getCurrentContext(request), theTeam); - - List companyAdmins = Utils.getCompanyAdminTeamMembers(theTeam.getTeamId(), theTeam.getGroupId()); - request.setAttribute("companyAdmins", companyAdmins); //pass to the JSP - - String imageUrl = Utils.getCompanyLogoURL(theTeam.getTeamName(), groupId, request); - request.setAttribute("companyLogoURL", imageUrl); //pass to logo URL to the JSP - //display the view.jsp - super.render(request, response); - } - else { - PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(Utils.NOT_ADMIN_PAGE_PATH); - dispatcher.include(request, response); - } - - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void promoteAdminUsers(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception { - try { - long[] userIdsToPromoteAdmins = ParamUtil.getLongValues(actionRequest, "addUserIds"); - long currentGroupId = ParamUtil.getLong(actionRequest, "currentGroupId"); - LiferayRoleManager rm = new LiferayRoleManager(); - GCubeRole adminRole = new LiferayRoleManager().getRole(PFISHConstants.COMPANY_ADMIN_SITE_ROLE, currentGroupId); - for (int i = 0; i < userIdsToPromoteAdmins.length; i++) { - rm.assignRoleToUser(userIdsToPromoteAdmins[i], currentGroupId, adminRole.getRoleId()); - _log.info("Associating Admin role to user with id " + userIdsToPromoteAdmins[i] + " done"); - } - } - catch (Exception e) { - SessionErrors.add(actionRequest.getPortletSession(),"operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - e.printStackTrace(); - } - } -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/PromoteFarmAdministrators.java b/src/main/java/org/gcube/portlets/user/performfish/PromoteFarmAdministrators.java deleted file mode 100644 index e9e3ab6..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/PromoteFarmAdministrators.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.gcube.portlets.user.performfish; - -import java.io.IOException; -import java.util.List; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.PortletException; -import javax.portlet.PortletRequestDispatcher; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; -import javax.servlet.http.HttpServletRequest; - -import org.gcube.portlets.user.performfish.util.PFISHConstants; -import org.gcube.portlets.user.performfish.util.Utils; -import org.gcube.vomanagement.usermanagement.RoleManager; -import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager; -import org.gcube.vomanagement.usermanagement.model.GCubeRole; -import org.gcube.vomanagement.usermanagement.model.GCubeTeam; -import org.gcube.vomanagement.usermanagement.model.GCubeUser; - -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.servlet.SessionErrors; -import com.liferay.portal.kernel.util.ParamUtil; -import com.liferay.portal.util.PortalUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; - -/** - * Portlet implementation class PromoteFarmAdministrators - */ -public class PromoteFarmAdministrators extends MVCPortlet { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(PromoteFarmAdministrators.class); - private static RoleManager RM = new LiferayRoleManager(); - @Override - public void render(RenderRequest request, RenderResponse response) - throws PortletException, IOException { - _log.debug(" This is render method of PromoteFarmAdministrators"); - try { - long groupId = PortalUtil.getScopeGroupId(request); - GCubeTeam theCompany = Utils.checkBelongingToOneCompanyOnly(request, response, this); - HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(request)); - //long[] farmIds = ParamUtil.getLongValues(httpReq, "farmId"); - String[] farmIds = ParamUtil.getParameterValues(httpReq, Utils.ENCODED_FARM_PARAM); - - GCubeTeam theFarm = null; - if (farmIds != null && farmIds.length > 0) { - long selectedFarmId = Utils.unmaskId(farmIds[0]); - theFarm = RM.getTeam(selectedFarmId); - request.getPortletSession().setAttribute("theFarm", theFarm); - } else { - theFarm = (GCubeTeam) request.getPortletSession().getAttribute("theFarm"); - } - if (theFarm != null && Utils.isFarmAdmin(Utils.getCurrentUser(request), groupId, theFarm)) { //check is a Farm Admin - //check folder exists - Utils.getWSCompanyFolder(Utils.getCurrentUser(request).getUsername(), Utils.getCurrentContext(request), theFarm); - - List companyAdmins = Utils.getFarmAdminTeamMembers(theCompany, theFarm); - request.setAttribute("companyAdmins", companyAdmins); //pass to the JSP - request.setAttribute("theFarm", theFarm); //pass to the JSP - String imageUrl = Utils.getCompanyLogoURL(theCompany.getTeamName(), groupId, request); - request.setAttribute("companyLogoURL", imageUrl); //pass to logo URL to the JSP - //display the view.jsp - super.render(request, response); - } - else { - PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(Utils.NOT_FARM_ADMIN_PAGE_PATH); - dispatcher.include(request, response); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void promoteAdminUsers(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception { - try { - long[] userIdsToPromoteAdmins = ParamUtil.getLongValues(actionRequest, "addUserIds"); - long currentGroupId = ParamUtil.getLong(actionRequest, "currentGroupId"); - LiferayRoleManager rm = new LiferayRoleManager(); - GCubeRole adminRole = new LiferayRoleManager().getRole(PFISHConstants.FARM_ADMIN_SITE_ROLE, currentGroupId); - for (int i = 0; i < userIdsToPromoteAdmins.length; i++) { - rm.assignRoleToUser(userIdsToPromoteAdmins[i], currentGroupId, adminRole.getRoleId()); - _log.info("Associating Admin role to user with id " + userIdsToPromoteAdmins[i] + " done"); - } - } - catch (Exception e) { - SessionErrors.add(actionRequest.getPortletSession(),"operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - e.printStackTrace(); - } - } - -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/SetCompanyAdministratorsSuperUser.java b/src/main/java/org/gcube/portlets/user/performfish/SetCompanyAdministratorsSuperUser.java deleted file mode 100644 index 26fc2db..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/SetCompanyAdministratorsSuperUser.java +++ /dev/null @@ -1,131 +0,0 @@ -package org.gcube.portlets.user.performfish; - -import java.io.IOException; -import java.sql.Connection; -import java.util.List; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.PortletException; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; -import javax.servlet.http.HttpServletRequest; - -import org.gcube.portlets.user.performfish.bean.Company; -import org.gcube.portlets.user.performfish.util.PFISHConstants; -import org.gcube.portlets.user.performfish.util.Utils; -import org.gcube.portlets.user.performfish.util.db.DBUtil; -import org.gcube.portlets.user.performfish.util.db.DatabaseConnection; -import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager; -import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager; -import org.gcube.vomanagement.usermanagement.model.GCubeRole; -import org.gcube.vomanagement.usermanagement.model.GCubeUser; - -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.servlet.SessionErrors; -import com.liferay.portal.kernel.util.ParamUtil; -import com.liferay.portal.model.Team; -import com.liferay.portal.service.TeamLocalServiceUtil; -import com.liferay.portal.service.UserLocalServiceUtil; -import com.liferay.portal.util.PortalUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; -//TODO check why it gives error when the company administrator is set -/** - * Portlet implementation class SetCompanyAdministratorsSuperUser - */ -public class SetCompanyAdministratorsSuperUser extends MVCPortlet { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(PromoteCompanyAdministrators.class); - - @Override - public void render(RenderRequest request, RenderResponse response) - throws PortletException, IOException { - _log.debug(" This is render method of SetCompanyAdministratorsSuperUser"); - - try { - long groupId = PortalUtil.getScopeGroupId(request); - HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(request)); - long[] companyIds = ParamUtil.getLongValues(httpReq, "companyId"); - if (companyIds.length > 0) { //super user mode - - Team theTeam = TeamLocalServiceUtil.getTeam(companyIds[0]); - request.setAttribute("theTeam", theTeam); - - List availableUsers = Utils.listVREUsersNotAssociatedToAnyCompany(theTeam.getTeamId(), theTeam.getGroupId()); - request.setAttribute("availableUsers", availableUsers); //pass to the JSP - - String imageUrl = Utils.getCompanyLogoURL(theTeam.getName(), groupId, request); - request.setAttribute("companyLogoURL", imageUrl); //pass to logo URL to the JSP - request.setAttribute("operationFinished", false); - - //display the view.jsp - super.render(request, response); - } else { - request.setAttribute("operationFinished", true); - super.render(request, response); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void promoteAdminUsers(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception { - try { - long[] userIdsToPromoteAdmins = ParamUtil.getLongValues(actionRequest, "addUserIds"); - long currentGroupId = ParamUtil.getLong(actionRequest, "currentGroupId"); - long companyId = ParamUtil.getLong(actionRequest, "companyId"); - LiferayRoleManager rm = new LiferayRoleManager(); - GCubeRole adminRole = new LiferayRoleManager().getRole(PFISHConstants.COMPANY_ADMIN_SITE_ROLE, currentGroupId); - for (int i = 0; i < userIdsToPromoteAdmins.length; i++) { - rm.assignRoleToUser(userIdsToPromoteAdmins[i], currentGroupId, adminRole.getRoleId()); - _log.info("Associating Admin role to user with id " + userIdsToPromoteAdmins[i] + " done"); - rm.assignTeamToUser(userIdsToPromoteAdmins[i], companyId); //add the Admin to the Company - } - - } - catch (Exception e) { - SessionErrors.add(actionRequest.getPortletSession(),"operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - e.printStackTrace(); - } - } -// /** -// * -// * @param actionRequest -// * @param actionResponse -// * @throws Exception -// */ -// public void associateCompanyUsers(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception { -// try { -// long[] userIdsToPromoteAdmins = ParamUtil.getLongValues(actionRequest, "addUserIds"); -// System.out.println("userIdsToPromoteAdmins length=" + userIdsToPromoteAdmins.length); -// String[] usernamesToAssociateToCompany = new String[userIdsToPromoteAdmins.length]; -// _log.debug("converting userIds in usernames"); -// for (int i = 0; i < userIdsToPromoteAdmins.length; i++) { -// usernamesToAssociateToCompany[i] = UserLocalServiceUtil.getUser(userIdsToPromoteAdmins[i]).getScreenName(); -// } -// long companyId = ParamUtil.getLong(actionRequest, "companyId"); -// String currentUsername = ParamUtil.getString(actionRequest, "currentUsername"); -// long currentGroupId = ParamUtil.getLong(actionRequest, "currentGroupId"); -// String context = Utils.getCurrentContext(currentGroupId); -// _log.info("Super User: " + currentUsername + " has requested the association of some user(s) to the company having id="+companyId + " in context="+context); -// LiferayRoleManager rm = new LiferayRoleManager(); -// LiferayUserManager um = new LiferayUserManager(); -// long firstUserId = um.getUserByUsername(usernamesToAssociateToCompany[0]).getUserId(); -// rm.setUserTeams(firstUserId, new long[]{companyId}); //add the admin to the company -// if (usernamesToAssociateToCompany.length > 1) { //more than one admin was selected -// String[] remainingUsersToShare = new String[usernamesToAssociateToCompany.length-1]; -// for (int i = 1; i < usernamesToAssociateToCompany.length; i++) { -// remainingUsersToShare[i-1] = usernamesToAssociateToCompany[i]; -// } -// -// } -// } -// catch (Exception e) { -// SessionErrors.add(actionRequest.getPortletSession(),"operation-error"); -// actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); -// e.printStackTrace(); -// } -// -// } - -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/SetFarmAdministrators.java b/src/main/java/org/gcube/portlets/user/performfish/SetFarmAdministrators.java deleted file mode 100644 index 01c67cd..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/SetFarmAdministrators.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.gcube.portlets.user.performfish; - -import java.io.IOException; -import java.util.List; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.PortletException; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; -import javax.servlet.http.HttpServletRequest; - -import org.gcube.portlets.user.performfish.util.PFISHConstants; -import org.gcube.portlets.user.performfish.util.Utils; -import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager; -import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager; -import org.gcube.vomanagement.usermanagement.model.GCubeRole; -import org.gcube.vomanagement.usermanagement.model.GCubeUser; - -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.servlet.SessionErrors; -import com.liferay.portal.kernel.util.ParamUtil; -import com.liferay.portal.model.Team; -import com.liferay.portal.service.TeamLocalServiceUtil; -import com.liferay.portal.service.UserLocalServiceUtil; -import com.liferay.portal.util.PortalUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; - -/** - * Portlet implementation class SetFarmAdministrators - */ -public class SetFarmAdministrators extends MVCPortlet { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(SetFarmAdministrators.class); - - @Override - public void render(RenderRequest request, RenderResponse response) - throws PortletException, IOException { - _log.debug(" This is render method of SetFarmAdministrators"); - try { - long groupId = PortalUtil.getScopeGroupId(request); - HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(request)); - long[] companyIds = ParamUtil.getLongValues(httpReq, "companyId"); - long[] farmIds = ParamUtil.getLongValues(httpReq, "farmId"); - if (companyIds.length > 0 && farmIds.length > 0) { //super user mode - - Team theCompany = TeamLocalServiceUtil.getTeam(companyIds[0]); - Team theFarm = TeamLocalServiceUtil.getTeam(farmIds[0]); - request.setAttribute("theCompany", theCompany); - request.setAttribute("theFarm", theFarm); - List availableUsers = Utils.getAvailableFarmMembersToAssociate(theFarm.getTeamId(), theCompany.getTeamId(), theCompany.getGroupId()); - request.setAttribute("availableUsers", availableUsers); //pass to the JSP - - String imageUrl = Utils.getCompanyLogoURL(theCompany.getName(), groupId, request); - request.setAttribute("companyLogoURL", imageUrl); //pass to logo URL to the JSP - request.setAttribute("operationFinished", false); - - //display the view.jsp - super.render(request, response); - } else { - request.setAttribute("operationFinished", true); - super.render(request, response); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void promoteAdminUsers(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception { - try { - long[] userIdsToPromoteAdmins = ParamUtil.getLongValues(actionRequest, "addUserIds"); - long currentGroupId = ParamUtil.getLong(actionRequest, "currentGroupId"); - long farmId = ParamUtil.getLong(actionRequest, "farmId"); - Team theFarm = TeamLocalServiceUtil.getTeam(farmId); - LiferayRoleManager rm = new LiferayRoleManager(); - GCubeRole adminRole = new LiferayRoleManager().getRole(PFISHConstants.FARM_ADMIN_SITE_ROLE, currentGroupId); - for (int i = 0; i < userIdsToPromoteAdmins.length; i++) { - rm.assignRoleToUser(userIdsToPromoteAdmins[i], currentGroupId, adminRole.getRoleId()); - _log.info("Associating Farm Admin role to user with id " + userIdsToPromoteAdmins[i] + " done"); - rm.assignTeamToUser(userIdsToPromoteAdmins[i], theFarm.getTeamId()); //add the Admin to the farm - _log.info("Associating user with id " + userIdsToPromoteAdmins[i] + " to Farm done"); - } - - } - catch (Exception e) { - SessionErrors.add(actionRequest.getPortletSession(),"operation-error"); - actionResponse.setRenderParameter("mvcPath", "/html/error_pages/operation-error.jsp"); - e.printStackTrace(); - } - } -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/SubmittedFormValidation.java b/src/main/java/org/gcube/portlets/user/performfish/SubmittedFormValidation.java deleted file mode 100644 index 79ec6a8..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/SubmittedFormValidation.java +++ /dev/null @@ -1,334 +0,0 @@ -package org.gcube.portlets.user.performfish; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringReader; -import java.net.URL; -import java.sql.Connection; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import javax.portlet.PortletException; -import javax.portlet.PortletRequestDispatcher; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; -import javax.portlet.ResourceRequest; -import javax.portlet.ResourceResponse; -import javax.servlet.http.HttpServletRequest; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.gcube.common.homelibrary.home.workspace.Workspace; -import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder; -import org.gcube.common.homelibrary.home.workspace.WorkspaceItem; -import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile; -import org.gcube.common.resources.gcore.ServiceEndpoint; -import org.gcube.common.resources.gcore.utils.XPathHelper; -import org.gcube.portlets.user.performfish.util.Utils; -import org.gcube.portlets.user.performfish.util.ValidationResult; -import org.gcube.portlets.user.performfish.util.db.DBUtil; -import org.gcube.portlets.user.performfish.util.db.DatabaseConnection; -import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager; -import org.gcube.vomanagement.usermanagement.model.GCubeTeam; -import org.w3c.dom.Node; -import org.xml.sax.InputSource; - -import com.liferay.portal.kernel.json.JSONFactoryUtil; -import com.liferay.portal.kernel.json.JSONObject; -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.util.ParamUtil; -import com.liferay.portal.service.TeamLocalServiceUtil; -import com.liferay.portal.util.PortalUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; - -/** - * Portlet implementation class SubmittedFormValidation - */ -public class SubmittedFormValidation extends MVCPortlet { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(SubmittedFormValidation.class); - - private final static String XSLX_MIME = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; - - private static final int RETRY_NO = 3; - private static String XML_RESULT_ROOT_EXCEPTION = "ExceptionReport"; - private static final String USER_AGENT = "Mozilla/5.0"; - - public static final String VALIDATOR_METHOD_ID = "org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.PERFORMFISH_DATA_VALIDATOR_V2"; - - public void render(RenderRequest request, RenderResponse response) { - GCubeTeam theCompany; - try { - HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(request)); - String[] farmIds = ParamUtil.getParameterValues(httpReq, Utils.ENCODED_FARM_PARAM); - - GCubeTeam theFarm = null; - theCompany = Utils.checkBelongingToOneCompanyOnly(request, response, this); - if (farmIds == null || farmIds.length == 0) { - System.out.println("farmIds == null || farmIds.length == 0"); - if (Utils.getUserFarmsNumber(request, response, this) < 2) { - theFarm = Utils.checkBelongingToOneFarmOnly(request, response, this); - request.setAttribute("theFarm", theFarm); //pass to the JSP - } - } - else { //the farmId is passed via param on the query string - long selectedFarmId = Utils.unmaskId(farmIds[0]); - theFarm = new LiferayRoleManager().getTeam(selectedFarmId); - if (Utils.checkBelongsToTeam(PortalUtil.getUserId(request), theFarm.getTeamId(), PortalUtil.getScopeGroupId(request)) ) {//check that the user belong ot the farm - request.setAttribute("theFarm", theFarm); //pass to the JSP - } - else { - PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(Utils.NOT_BELONGING_ANY_FARM_PAGE_PATH); - dispatcher.include(request, response); - } - } - if (theFarm != null) { - request.setAttribute("theCompany", TeamLocalServiceUtil.getTeam(theCompany.getTeamId())); - request.setAttribute("theFarm", theFarm); - super.render(request, response); - } else { - _log.warn("theFarm is null"); - super.render(request, response); - } - } catch (Exception e) { - e.printStackTrace(); - PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(Utils.NOT_BELONGING_ANY_FARM_PAGE_PATH); - try { - dispatcher.include(request, response); - } catch (PortletException | IOException e1) { - e1.printStackTrace(); - } - } - } - - - public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException, PortletException { - long companyId = ParamUtil.getLong(resourceRequest, "companyId"); - long farmId = ParamUtil.getLong(resourceRequest, "farmId"); - long userId = ParamUtil.getLong(resourceRequest, "userId"); - long groupId = ParamUtil.getLong(resourceRequest, "groupId"); - String encodedURI = ParamUtil.getString(resourceRequest, "encodedURI", null); - String fileName = ParamUtil.getString(resourceRequest, "fileName", null); - String username = Utils.getCurrentUser(userId).getUsername(); - String phase = ParamUtil.getString(resourceRequest, "phase", null); - _log.debug("companyId: " + companyId); - _log.debug("farmId: " + farmId); - _log.debug("userId: " + userId); - _log.debug("groupId: " + groupId); - _log.debug("encodedURI: " + encodedURI); - _log.debug("phase: " + phase); - _log.debug("fileName: " + fileName); - - - String inputFileLink = encodedURI; - String template = Utils.getBatchTypeName(phase, fileName); - String context = Utils.getCurrentContext(groupId); - String token = Utils.getCurrentUserToken(context, username); - - _log.debug("context: " + context); - _log.debug("token: " + token); - _log.debug("template: " + template); - - ValidationResult result = doWPSCallToDataMiner(inputFileLink, context, token, template); - _log.debug("RESULT:\n"+result); - - if (result.isSuccess()) { - try { - String decodedURL = new java.net.URI(inputFileLink).getPath(); - uploadToCompanyRepository(username, context, companyId, farmId, fileName, new URL(decodedURL).openConnection().getInputStream()); - Connection conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - java.sql.Date lastActivity = new java.sql.Date(new Date().getTime()); - DBUtil.updateFarmLastSubmissionActivity(conn, farmId, lastActivity); - } catch (Exception e) { - result.setComment("The file is valid but we could not upload it in the company repository, please report this issue at support.d4science.org"); - e.printStackTrace(); - } - } - JSONObject fileObject = JSONFactoryUtil.createJSONObject(); - fileObject.put("success", result.isSuccess()); - fileObject.put("comment", result.getComment()); - resourceResponse.getWriter().println(fileObject); - } - - private String uploadToCompanyRepository(String username, String context, long companyId, long farmId, String fileName, InputStream fileData) throws Exception { - GCubeTeam theCompany = new LiferayRoleManager().getTeam(companyId); - GCubeTeam theFarm = new LiferayRoleManager().getTeam(farmId); - Workspace ws = Utils.getWS(username, context); - WorkspaceFolder companyRepoFolder = Utils.getWSFarmFolder(username, context, theCompany, theFarm); - WorkspaceItem overwriteItem = ws.find(fileName, companyRepoFolder.getId()); - - String toReturn = ""; - if (overwriteItem == null) { - ExternalFile item = companyRepoFolder.createExternalFileItem(fileName, "User form submission on " + new Date(), XSLX_MIME, fileData); - toReturn = item.getId(); - } - else { - ws.updateItem(overwriteItem.getId(), fileData); - toReturn = overwriteItem.getId(); - _log.debug("updateItem with id: "+overwriteItem.getId()+ ", is completed"); - } - _log.info("Uploaded " + fileName + " - Returned Workspace id=" +toReturn); - - return toReturn; - } - - /** - * performs tha actual call to the service - * @param peer session - * @param entry authEntry - * @param token token - * @param username username - * @param inputText - * @param options - * @return - */ - private ValidationResult doWPSCallToDataMiner(String inputFileLink, String context, String token, String template) { - _log.info("doWPSCallToDataMiner"); - ValidationResult toReturn = null; - List dms = null; - try { - dms = Utils.getDataMinerInstance(context); - if (dms == null || dms.isEmpty()) { - return new ValidationResult(false, "Error, no DataMiner cluster in this VRE, please report this issue at www.d4science.org/contact-us"); - } - ServiceEndpoint se = dms.get(0); - ServiceEndpoint.AccessPoint ap = se.profile().accessPoints().asCollection().iterator().next(); - _log.info("got DataMiner instance="+ap.address()); - - String apAddress = ap.address(); - _log.info("inputFileLink at: " + inputFileLink); - String wpsParams = getWPSCallURLParameters(token, inputFileLink, template); - String responseXML = sendGet(apAddress, wpsParams, token); - String resultFileURL = parseResult(responseXML); - _log.info("PARSED OK resultFileURL: " + resultFileURL); - - InputStream is = new URL(resultFileURL).openConnection().getInputStream(); - BufferedReader reader = new BufferedReader(new InputStreamReader(is)); - String line; - List resultLines = new ArrayList<>(); - while ((line = reader.readLine()) != null) { - if (line.split("=").length > 1) - resultLines.add(line.split("=")[1]); //if the split fails it means there is no comment - else - resultLines.add("Validation is successful"); - } - reader.close(); - for (int i = 0; i < resultLines.size(); i++) { - _log.debug("Line " + i + ": " + resultLines.get(i)); - } - toReturn = new ValidationResult(resultLines.get(0).equalsIgnoreCase("OK"), resultLines.get(1)); - } catch (Exception e) { - e.printStackTrace(); - return new ValidationResult(false, "There was a problem contacting the DataMiner cluster in this VRE (" - + context+ ")" - + "), please report this issue at http://support.d4science.org"); - } - return toReturn; - } - - - - private String parseResult(String xml) throws Exception { - String elem = removeXmlStringNamespaceAndPreamble(xml); - DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - Node node = docBuilder.parse(new InputSource(new StringReader(elem))).getDocumentElement(); - String rootElement = node.getNodeName(); - XPathHelper helper = new XPathHelper(node); - List currValue = null; - if (rootElement.compareTo(XML_RESULT_ROOT_EXCEPTION) == 0) { - currValue = helper.evaluate("/ExceptionReport"); - if (currValue != null && currValue.size() > 0) - return currValue.get(0); - } - else { - currValue = helper.evaluate("//ProcessOutputs/Output/Data/ComplexData/FeatureCollection/featureMember/Result/Data/text()"); - if (currValue != null && currValue.size() > 1) - return currValue.get(1); - } - return null; - } - - //this remove all the namespaces causing parsing errors as i don't have time to deal with this. - private static String removeXmlStringNamespaceAndPreamble(String xmlString) { - return xmlString.replaceAll("(<\\?[^<]*\\?>)?", "") /* remove preamble */ - .replaceAll("xmlns.*?(\"|\').*?(\"|\')", "") /* remove xmlns declaration */ - .replaceAll("(<)(\\w+:)(.*?>)", "$1$3") /* remove opening tag prefix */ - .replaceAll("()", "$1$3") - .replaceAll("wps:", "") - .replaceAll("xsi:", "") - .replaceAll("ogr:",""); /* remove closing tags prefix */ - } - - // HTTP request - private String sendGet(String url, String urlParameters, String token) { - StringBuilder toReturn = new StringBuilder(); - try { - int i = 1; - while (i <= RETRY_NO) { - CloseableHttpClient client = HttpClients.createDefault(); - HttpGet request = new HttpGet(url+"?"+urlParameters); - _log.info("request to="+request.toString()); - // add header - request.setHeader("User-Agent", USER_AGENT); - request.setHeader("Accept-Encoding","UTF-8"); - request.setHeader("Accept-Charset","UTF-8"); - request.setHeader("Content-Encoding","UTF-8"); - - HttpResponse response = client.execute(request); - - // Get the response - BufferedReader rd = new BufferedReader - (new InputStreamReader( - response.getEntity().getContent())); - - String line = ""; - while ((line = rd.readLine()) != null) { - toReturn.append(line); - } - i++; - if (toReturn.toString().compareTo("") == 0 || toReturn.toString().startsWith("Error")) { - _log.warn("response from Dataminer is empty or an error occurred, retry tentative: " + i + " of " + RETRY_NO); - _log.error("here is the faulty response from Dataminer="+toReturn.toString()); - } else { - _log.debug("response from Dataminer="+toReturn.toString()); - break; - } - } - } - catch (Exception e) { - e.printStackTrace(); - } - return toReturn.toString(); - } - /** - * - * @param token the token - * @param inputFileLink the http of the input file - * @param options - * @return the url paramters for WPS Call to perform - */ - private String getWPSCallURLParameters(String token, String inputFileLink, String template) { - StringBuilder sb = new StringBuilder("request=Execute&service=WPS&Version=1.0.0&gcube-token=") - .append(token) - .append("&lang=en-US&Identifier=") - .append(VALIDATOR_METHOD_ID) - .append("&DataInputs=CompanyData=") - .append(inputFileLink) - .append(";Template=") - .append(template) - .append(";") - .append("Overwrite=false;LatestCompanyData=") - .append(inputFileLink) - .append(";"); - return sb.toString(); - } - - - -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/bean/Association.java b/src/main/java/org/gcube/portlets/user/performfish/bean/Association.java deleted file mode 100644 index 60d412e..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/bean/Association.java +++ /dev/null @@ -1,99 +0,0 @@ -package org.gcube.portlets.user.performfish.bean; - -import java.util.Date; - -public class Association { - - private long associationId; - private String shortName; - private String fullName; - private String imageUrl; - private Date dateCreated; - private String createdBy; - - public Association(long associationId, String createdBy) { - super(); - this.associationId = associationId; - this.createdBy = createdBy; - } - - public Association() { - super(); - } - - - public String getShortName() { - return shortName; - } - - public void setShortName(String shortName) { - this.shortName = shortName; - } - - public String getFullName() { - return fullName; - } - - public void setFullName(String fullName) { - this.fullName = fullName; - } - - public String getImageUrl() { - return imageUrl; - } - - public void setImageUrl(String imageUrl) { - this.imageUrl = imageUrl; - } - - public Date getDateCreated() { - return dateCreated; - } - - public void setDateCreated(Date dateCreated) { - this.dateCreated = dateCreated; - } - - - - public String getCreatedBy() { - return createdBy; - } - - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - public long getAssociationId() { - return associationId; - } - - public void setAssociationId(long associationId) { - this.associationId = associationId; - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("Association [associationId="); - builder.append(associationId); - builder.append(", shortName="); - builder.append(shortName); - builder.append(", fullName="); - builder.append(fullName); - builder.append(", imageUrl="); - builder.append(imageUrl); - builder.append(", dateCreated="); - builder.append(dateCreated); - builder.append(", createdBy="); - builder.append(createdBy); - builder.append("]"); - return builder.toString(); - } - - - - - - -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/bean/Company.java b/src/main/java/org/gcube/portlets/user/performfish/bean/Company.java deleted file mode 100644 index ae86963..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/bean/Company.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.gcube.portlets.user.performfish.bean; - -public class Company { - - private long companyId; - private String name; - private long associatationId; - private String imageUrl; - private boolean staged; - - public Company(long companyId, long associatationId, boolean staged) { - super(); - this.companyId = companyId; - this.associatationId = associatationId; - this.staged = staged; - } - - public String getImageUrl() { - return imageUrl; - } - - public void setImageUrl(String imageUrl) { - this.imageUrl = imageUrl; - } - - public long getCompanyId() { - return companyId; - } - - public void setCompanyId(long companyId) { - this.companyId = companyId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public long getAssociatationId() { - return associatationId; - } - - public void setAssociatationId(long associatationId) { - this.associatationId = associatationId; - } - - public boolean isStaged() { - return staged; - } - - public void setStaged(boolean staged) { - this.staged = staged; - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("Company [companyId="); - builder.append(companyId); - builder.append(", name="); - builder.append(name); - builder.append(", associatationId="); - builder.append(associatationId); - builder.append(", imageUrl="); - builder.append(imageUrl); - builder.append(", staged="); - builder.append(staged); - builder.append("]"); - return builder.toString(); - } - - - -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/bean/CompanyMember.java b/src/main/java/org/gcube/portlets/user/performfish/bean/CompanyMember.java deleted file mode 100644 index 00c34ce..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/bean/CompanyMember.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.gcube.portlets.user.performfish.bean; - -import java.util.ArrayList; -import java.util.List; - -import org.gcube.vomanagement.usermanagement.model.GCubeUser; - -public class CompanyMember { - private GCubeUser user; - private List associatedFarms = new ArrayList<>(); - private boolean isAdmin; - public CompanyMember(GCubeUser user) { - super(); - this.user = user; - } - - public boolean isAdmin() { - return isAdmin; - } - - public void setAdmin(boolean isAdmin) { - this.isAdmin = isAdmin; - } - - public GCubeUser getUser() { - return user; - } - public void setUser(GCubeUser user) { - this.user = user; - } - - - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("CompanyMember [user="); - builder.append(user); - builder.append(", associatedFarms="); - builder.append(associatedFarms); - builder.append(", isAdmin="); - builder.append(isAdmin); - builder.append("]"); - return builder.toString(); - } - - public List getAssociatedFarms() { - return associatedFarms; - } - - public String getAssociatedFarmNames() { - String toReturn = ""; - for (Farm farm : associatedFarms) { - toReturn += " " + farm.getName(); - } - return toReturn; - } - - public void setAssociatedFarms(List associatedFarms) { - this.associatedFarms = associatedFarms; - } - - public String getUserAvatarURL() { - return this.user.getUserAvatarURL(); - } - - public String getjobTitle() { - return this.user.getJobTitle(); - } - - public String getFullname() { - return this.user.getFullname(); - } - public long getUserId() { - return this.user.getUserId(); - } - - public String getUsername() { - return this.user.getUsername(); - } - - public String getEmail() { - return this.user.getEmail(); - } - - public void setEmail(String email) { - this.user.setEmail(email); - } - -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/bean/Farm.java b/src/main/java/org/gcube/portlets/user/performfish/bean/Farm.java deleted file mode 100644 index 303b70e..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/bean/Farm.java +++ /dev/null @@ -1,126 +0,0 @@ -package org.gcube.portlets.user.performfish.bean; - -import java.util.Date; -import java.util.List; - -import org.gcube.vomanagement.usermanagement.model.GCubeUser; - -public class Farm { - - private long farmId; - private String name; - private long companyId; - private String creatorFullname; - private String imageUrl; - private String location; - private Date dateCreated; - private Date dateLastActivity; - private List administrators; - - public Farm(long farmId, String location, long companyId, String creatorFullname) { - super(); - this.farmId = farmId; - this.location = location; - this.companyId = companyId; - this.creatorFullname = creatorFullname; - } - - public Date getDateCreated() { - return dateCreated; - } - - public void setDateCreated(Date dateCreated) { - this.dateCreated = dateCreated; - } - - public String getCreatorFullname() { - return creatorFullname; - } - - public void setCreatorFullname(String creatorFullname) { - this.creatorFullname = creatorFullname; - } - - public String getLocation() { - return location; - } - - public void setLocation(String location) { - this.location = location; - } - - public long getFarmId() { - return farmId; - } - - public void setFarmId(long farmId) { - this.farmId = farmId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public long getCompanyId() { - return companyId; - } - - public void setCompanyId(long companyId) { - this.companyId = companyId; - } - - public String getImageUrl() { - return imageUrl; - } - - public void setImageUrl(String imageUrl) { - this.imageUrl = imageUrl; - } - - public List getAdministrators() { - return administrators; - } - - public void setAdministrators(List administrators) { - this.administrators = administrators; - } - - public Date getDateLastActivity() { - return dateLastActivity; - } - - public void setDateLastActivity(Date dateLastActivity) { - this.dateLastActivity = dateLastActivity; - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("Farm [farmId="); - builder.append(farmId); - builder.append(", name="); - builder.append(name); - builder.append(", companyId="); - builder.append(companyId); - builder.append(", creatorFullname="); - builder.append(creatorFullname); - builder.append(", imageUrl="); - builder.append(imageUrl); - builder.append(", location="); - builder.append(location); - builder.append(", dateCreated="); - builder.append(dateCreated); - builder.append(", dateLastActivity="); - builder.append(dateLastActivity); - builder.append(", administrators="); - builder.append(administrators); - builder.append("]"); - return builder.toString(); - } - - -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/bean/PublishAnonymisedJob.java b/src/main/java/org/gcube/portlets/user/performfish/bean/PublishAnonymisedJob.java deleted file mode 100644 index 61a3383..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/bean/PublishAnonymisedJob.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.gcube.portlets.user.performfish.bean; - -import com.liferay.portal.kernel.json.JSONObject; - -public class PublishAnonymisedJob { - //STATUSES ACCEPTED, RUNNING, COMPLETE, FAILED, CANCELLED - public static Long EPOCH_TIME_JOB_NOTFINISHED = 3050596467L; //September 1, 2066, Likely retired or dead by then - - private String jobId; - private String farmId; - private String batch_type; - private String sourceUrl; - private String status; - private String submitterIdentity; - private Long endTimeepochSecond; - - - public PublishAnonymisedJob(JSONObject cData) { - this.jobId=cData.getString("id"); - this.farmId=cData.getString("farmId"); - this.batch_type=cData.getString("batch_type"); - this.sourceUrl=cData.getString("sourceUrl"); - this.status=cData.getString("status"); - this.submitterIdentity=cData.getString("submitterIdentity"); - if (cData.getJSONObject("endTime") != null) //if there is no end time the status is not COMPLETE - this.endTimeepochSecond=cData.getJSONObject("endTime").getLong("epochSecond"); - else - this.endTimeepochSecond = EPOCH_TIME_JOB_NOTFINISHED; - } - - - public String getJobId() { - return jobId; - } - - - public String getFarmId() { - return farmId; - } - - - public String getBatch_type() { - return batch_type; - } - - - public String getSourceUrl() { - return sourceUrl; - } - - - public String getStatus() { - return status; - } - - - public String getSubmitterIdentity() { - return submitterIdentity; - } - - - public Long getEndTimeEpochSecond() { - return endTimeepochSecond; - } - - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("PublishAnonymisedJob [jobId="); - builder.append(jobId); - builder.append(", farmId="); - builder.append(farmId); - builder.append(", batch_type="); - builder.append(batch_type); - builder.append(", sourceUrl="); - builder.append(sourceUrl); - builder.append(", status="); - builder.append(status); - builder.append(", submitterIdentity="); - builder.append(submitterIdentity); - builder.append(", endTime="); - builder.append(endTimeepochSecond); - builder.append("]"); - return builder.toString(); - } - - -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/bean/SubmittedForm.java b/src/main/java/org/gcube/portlets/user/performfish/bean/SubmittedForm.java deleted file mode 100644 index 19de396..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/bean/SubmittedForm.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.gcube.portlets.user.performfish.bean; - -import java.io.Serializable; - -import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile; -import org.gcube.portlets.user.performfish.util.Utils; - -@SuppressWarnings("serial") -public class SubmittedForm implements Serializable { - public static String NOT_YET_PUBLISHER = "No one"; - private static String UNPUBLISHED_LABEL = "Unpublished"; - private static String SUBMITTER_NONE = null; - - private ExternalFile file; - private String status; - private String submitterIdentity; - private long endTimeinMillis = -1; - - public SubmittedForm() { - this.status = UNPUBLISHED_LABEL; - this.submitterIdentity = SUBMITTER_NONE; - } - - public SubmittedForm(ExternalFile file, String status, String submitterIdentity, long endTimeinMillis) { - super(); - this.file = file; - this.status = status; - this.submitterIdentity = submitterIdentity; - this.endTimeinMillis = endTimeinMillis; - } - - public SubmittedForm(ExternalFile file) { - super(); - this.file = file; - this.status = UNPUBLISHED_LABEL; - this.submitterIdentity = SUBMITTER_NONE; - this.endTimeinMillis = -1; - } - - public String getBatchType() { - String batchType = "unknown"; - try { - batchType = Utils.getBatchTypeName(Utils.getPhaseByFileName(this.file.getName()), this.file.getName()); - } catch (Exception e) { - e.printStackTrace(); - } - return batchType; - } - - public ExternalFile getFormFile() { - return file; - } - - public void setFormFile(ExternalFile file) { - this.file = file; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getSubmitterIdentity() { - return submitterIdentity; - } - - public void setSubmitterIdentity(String submitterIdentity) { - this.submitterIdentity = submitterIdentity; - } - - public long getEndTimeinMillis() { - return endTimeinMillis; - } - - public void setEndTimeinMillis(long endTimeinMillis) { - this.endTimeinMillis = endTimeinMillis; - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("SubmittedForm [file="); - builder.append(file); - builder.append(", status="); - builder.append(status); - builder.append(", submitterIdentity="); - builder.append(submitterIdentity); - builder.append(", endTimeinMillis="); - builder.append(endTimeinMillis); - builder.append("]"); - return builder.toString(); - } - - -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/util/ImportedBatchChecker.java b/src/main/java/org/gcube/portlets/user/performfish/util/ImportedBatchChecker.java deleted file mode 100644 index 27c3d1e..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/util/ImportedBatchChecker.java +++ /dev/null @@ -1,182 +0,0 @@ -package org.gcube.portlets.user.performfish.util; - -import static org.gcube.resources.discovery.icclient.ICFactory.clientFor; -import static org.gcube.resources.discovery.icclient.ICFactory.queryFor; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringReader; -import java.net.HttpURLConnection; -import java.net.URL; -import java.security.KeyManagementException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateException; -import java.util.List; - -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSession; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; - -import org.apache.commons.io.IOUtils; -import org.gcube.common.authorization.library.provider.SecurityTokenProvider; -import org.gcube.common.resources.gcore.GCoreEndpoint; -import org.gcube.common.resources.gcore.GenericResource; -import org.gcube.resources.discovery.client.api.DiscoveryClient; -import org.gcube.resources.discovery.client.queries.api.SimpleQuery; -import org.json.JSONException; -import org.json.JSONObject; -import org.xml.sax.InputSource; - -import com.liferay.portal.kernel.log.LogFactoryUtil; - -/** - * - * @author F. Sinibaldi CNR-ISTI - * @author M. Assante CNR-ISTI - */ -public class ImportedBatchChecker { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(ImportedBatchChecker.class); - - private static String ANALYTICAL_TOOLKIT_SERVICE_GCORE_ENDPOINT_NAME = "perform-service"; - private static String ANALYTICAL_TOOLKIT_SERVICE_GCORE_ENDPOINT_CLASS = "Application"; - private static String CONFIGURATION_RESOURCE_SECONDARY_TYPE="ApplicationConfiguration"; - private static String CONFIGURATION_RESOURCE_NAME="PerformFishConfiguration"; - private static final int N_BATCHES_THRESHOLD_FALLBACK = 4; - - - public static boolean checkAnalysisAvailability(long farmid,String batchType, String context) throws JSONException, IOException, KeyManagementException, NoSuchAlgorithmException, NumberFormatException, XPathExpressionException { - fixUntrustCertificate(); - String servicecall=formServiceCall(batchType,farmid, context); - JSONObject jsonObject=readFromURL(servicecall); - String csvUrl=jsonObject.getString("BatchesTable_internal"); - long csvLines=readCSVLines(csvUrl); - return csvLines-1>getThresholdFromIS(); - } - - - private static int getThresholdFromIS() throws NumberFormatException, XPathExpressionException { - try { - SimpleQuery query = queryFor(GenericResource.class); - query.addCondition("$resource/Profile/SecondaryType/text() eq '"+ CONFIGURATION_RESOURCE_SECONDARY_TYPE+"'"); - query.addCondition("$resource/Profile/Name/text() eq '"+ CONFIGURATION_RESOURCE_NAME+"'"); - DiscoveryClient client = clientFor(GenericResource.class); - String xmlConfiguration=client.submit(query).get(0).profile().bodyAsString(); - - InputSource source = new InputSource(new StringReader(xmlConfiguration)); - XPathFactory xpathFactory = XPathFactory.newInstance(); - XPath xpath = xpathFactory.newXPath(); - - return Integer.parseInt(xpath.evaluate("//config/analysis_threshold/text()", source)); - } - catch (Exception e) { - _log.error("There was an error contacting the IS for reading the Batch threshold, returning fallback value="+N_BATCHES_THRESHOLD_FALLBACK, e); - return N_BATCHES_THRESHOLD_FALLBACK; - } - - } - - private static String formServiceCall(String batchtype, long farmid, String context) { - return new StringBuilder(Utils.getAnalyticalToolkitEndpoint(context)) - .append("/performance") - .append("?") - .append("batch_type=").append(batchtype) - .append("&gcube-token="+SecurityTokenProvider.instance.get()) - .append("&farmid=").append(farmid).toString(); - } - - - private static long readCSVLines(String csvUrl) throws IOException { - URL url= new URL(csvUrl); - HttpURLConnection conn= (HttpURLConnection) url.openConnection(); - conn.setDoOutput( true ); - conn.setInstanceFollowRedirects( true ); - conn.setRequestMethod( "GET" ); - - BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); - int lines = 0; - while (reader.readLine() != null) lines++; - reader.close(); - return lines; - } - - private static JSONObject readFromURL(String request) throws IOException, JSONException { - URL url= new URL(request); - HttpsURLConnection conn= (HttpsURLConnection) url.openConnection(); - conn.setDoOutput( true ); - conn.setInstanceFollowRedirects( false ); - conn.setRequestMethod( "GET" ); - conn.setRequestProperty( "Content-Type", "application/json"); - conn.setRequestProperty( "charset", "utf-8"); - conn.setUseCaches( false ); - - InputStream in = conn.getInputStream(); - String encoding = conn.getContentEncoding(); - encoding = encoding == null ? "UTF-8" : encoding; - String body = IOUtils.toString(in, encoding); - - return new JSONObject(body); - } - - - private static void fixUntrustCertificate() throws KeyManagementException, NoSuchAlgorithmException{ - TrustManager[] trustAllCerts = new TrustManager[]{ - new X509TrustManager() { - public java.security.cert.X509Certificate[] getAcceptedIssuers() { - return null; - } - @Override - public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) - throws CertificateException { - } - - @Override - public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) - throws CertificateException { - } - - } - }; - - SSLContext sc = SSLContext.getInstance("SSL"); - sc.init(null, trustAllCerts, new java.security.SecureRandom()); - HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); - - HostnameVerifier allHostsValid = new HostnameVerifier() { - public boolean verify(String hostname, SSLSession session) { - return true; - } - }; - - // set the allTrusting verifier - HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid); - } - - - - public static List getAnalyticalToolkitServiceInstance() throws Exception { - SimpleQuery query = queryFor(GCoreEndpoint.class); - query.addCondition("$resource/Profile/ServiceClass/text() eq '"+ ANALYTICAL_TOOLKIT_SERVICE_GCORE_ENDPOINT_CLASS +"'"); - query.addCondition("$resource/Profile/ServiceName/text() eq '"+ ANALYTICAL_TOOLKIT_SERVICE_GCORE_ENDPOINT_NAME +"'"); - DiscoveryClient client = clientFor(GCoreEndpoint.class); - List toReturn = client.submit(query); - return toReturn; - } - - - // public static void main(String[] args) throws JSONException, IOException, KeyManagementException, NoSuchAlgorithmException, NumberFormatException, XPathExpressionException { - // //SecurityTokenProvider.instance.set("****"); - // ScopeProvider.instance.set("/gcube/preprod/preVRE"); - // String batchtype="GROW_OUT_INDIVIDUAL"; - // long farmid=12682549; - // - // System.out.println("IS ANALYSIS AVAILABLE : "+checkAnalysisAvailability(farmid, batchtype)); - // } -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/util/PFISHConstants.java b/src/main/java/org/gcube/portlets/user/performfish/util/PFISHConstants.java deleted file mode 100644 index f814ade..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/util/PFISHConstants.java +++ /dev/null @@ -1,85 +0,0 @@ -package org.gcube.portlets.user.performfish.util; - -public class PFISHConstants { - /** - * set to true if the private company repo should not appear in the workspace (portlet) of the company users - */ - public static final boolean HIDE_COMPANY_SHARED_FOLDER = true; - /** - * - */ - public static final String SET_COMPANY_ADMINISTRATOR_PORTLETID = "setcompanyadministratorssuperuser_WAR_PerformFISHAppsportlet"; - public static final String SET_FARM_ADMINISTRATOR_PORTLETID = "setfarmadministrators_WAR_PerformFISHAppsportlet"; - public static final String ASSOCIATE_COMPANIES_TO_ASSOC_PORTLETID = "associatecompaniestoassociation_WAR_PerformFISHAppsportlet"; - /** - * The URL (relative) of the Company Dashboard - */ - public static final String COMPANY_DASHBOARD_URL = "company-dashboard"; - /** - * The URL (relative) of the Company Farms Dashboard - */ - public static final String FARMS_DASHBOARD_URL = "farm-dashboard"; - /** - * The URL (relative) of the From submission pages - */ - public static final String HATCHERY_PAGE_LAYOUT_FRIENDLY_URL = "/hatchery"; - public static final String PREGROW_PAGE_LAYOUT_FRIENDLY_URL = "/pre-grow"; - public static final String GROWOUT_PAGE_LAYOUT_FRIENDLY_URL = "/grow-out"; - /** - * This is the role a company Administrator should have to be interpreted as Administrator by this application - */ - public static final String COMPANY_ADMIN_SITE_ROLE = "Infrastructure-Manager"; - /** - * This is the role a company farm Administrator should have to be interpreted as Administrator by this application - */ - public static final String FARM_ADMIN_SITE_ROLE = "Data-Manager"; - /** - * These are the 2 coordinates for the Database containing the logic of the app - */ - public static final String PF_DB_SERVICE_ENDPOINT_NAME = "PF_DB"; - public static final String PF_DB_SERVICE_ENDPOINT_CATEGORY = "Database"; - /** - * used to call the display of a user profile - */ - public static final String USER_PROFILE_OID = "userIdentificationParameter"; - /** - * this is the default role of the authorization service - */ - public final static String DEFAULT_ROLE = "OrganizationMember"; - /** - * The hidden ws folder suffix automatically created by in the workspace for the compani repositories - */ - public static final String COMPANY_WS_FOLDER_SUFFIX = "_PerformFISH_Data"; - /** - * The name of the folder containing the logo of the companies - */ - public static final String LOGO_FOLDER_NAME = "Logo"; - /** - * The attribute name for the portlet preference that indicates which phase is displaying - */ - public static final String PHASE_PREFERENCE_ATTR_NAME = "phase"; - /** - * And these 4 are the possible values for the attribute above (PHASE_PREFERENCE_ATTR_NAME) - */ - public static final String SHOW_ALL_PHASES = "All"; - public static final String SHOW_HATCHERY = "Hatchery"; - public static final String SHOW_PRE_ONGROWING = "Pre"; - public static final String SHOW_GROW_OUT = "Grow"; - /** - * waringin or error pages paths - */ - public static final String OPERATION_ERROR_PATH = "/html/error_pages/operation-error.jsp"; - public static final String FARM_NAME_ALREADY_EXIST_ERROR_PATH = "/html/error_pages/farmname_exists_already.jsp"; - - public static final String TEMPLATE_HATCHERY_INDIVIDUAL = "HATCHERY_INDIVIDUAL"; - public static final String TEMPLATE_HATCHERY_AGGREGATED = "HATCHERY_AGGREGATED"; - public static final String TEMPLATE_HATCHERY_INDIVIDUAL_CLOSED = "HATCHERY_INDIVIDUAL_CLOSED_BATCHES"; - public static final String TEMPLATE_HATCHERY_AGGREGATED_CLOSED = "HATCHERY_AGGREGATED_CLOSED_BATCHES"; - public static final String TEMPLATE_PRE_ONGROWING = "PRE_ONGROWING"; - public static final String TEMPLATE_PRE_ONGROWING_CLOSED = "PRE_ONGROWING_CLOSED_BATCHES"; - public static final String TEMPLATE_GROWOUT_INDIVIDUAL = "GROW_OUT_INDIVIDUAL"; - public static final String TEMPLATE_GROWOUT_AGGREGATED = "GROW_OUT_AGGREGATED"; - public static final String TEMPLATE_GROWOUT_INDIVIDUAL_CLOSED = "GROW_OUT_INDIVIDUAL_CLOSED_BATCHES"; - public static final String TEMPLATE_GROWOUT_AGGREGATED_CLOSED = "GROW_OUT_AGGREGATED_CLOSED_BATCHES"; - -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/util/Utils.java b/src/main/java/org/gcube/portlets/user/performfish/util/Utils.java deleted file mode 100644 index 9f4fd98..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/util/Utils.java +++ /dev/null @@ -1,1077 +0,0 @@ -package org.gcube.portlets.user.performfish.util; - -import static org.gcube.common.authorization.client.Constants.authorizationService; -import static org.gcube.resources.discovery.icclient.ICFactory.clientFor; -import static org.gcube.resources.discovery.icclient.ICFactory.queryFor; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URLEncoder; -import java.sql.Connection; -import java.util.ArrayList; -import java.util.Base64; -import java.util.Collection; -import java.util.List; - -import javax.portlet.PortletException; -import javax.portlet.PortletRequestDispatcher; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; -import javax.portlet.ResourceRequest; -import javax.servlet.http.HttpServletRequest; - -import org.gcube.common.authorization.client.exceptions.ObjectNotFound; -import org.gcube.common.authorization.library.provider.SecurityTokenProvider; -import org.gcube.common.authorization.library.provider.UserInfo; -import org.gcube.common.homelibrary.home.HomeLibrary; -import org.gcube.common.homelibrary.home.workspace.Workspace; -import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder; -import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder; -import org.gcube.common.homelibrary.home.workspace.accessmanager.ACLType; -import org.gcube.common.portal.PortalContext; -import org.gcube.common.resources.gcore.GCoreEndpoint; -import org.gcube.common.resources.gcore.ServiceEndpoint; -import org.gcube.common.resources.gcore.GCoreEndpoint.Profile.Endpoint; -import org.gcube.common.scope.api.ScopeProvider; -import org.gcube.portlets.user.performfish.bean.Association; -import org.gcube.portlets.user.performfish.bean.Company; -import org.gcube.portlets.user.performfish.bean.CompanyMember; -import org.gcube.portlets.user.performfish.bean.Farm; -import org.gcube.portlets.user.performfish.util.db.DBUtil; -import org.gcube.portlets.user.performfish.util.db.DatabaseConnection; -import org.gcube.resources.discovery.client.api.DiscoveryClient; -import org.gcube.resources.discovery.client.queries.api.SimpleQuery; -import org.gcube.vomanagement.usermanagement.RoleManager; -import org.gcube.vomanagement.usermanagement.UserManager; -import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault; -import org.gcube.vomanagement.usermanagement.exception.RoleRetrievalFault; -import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault; -import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager; -import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager; -import org.gcube.vomanagement.usermanagement.model.GCubeRole; -import org.gcube.vomanagement.usermanagement.model.GCubeTeam; -import org.gcube.vomanagement.usermanagement.model.GCubeUser; - -import com.liferay.portal.kernel.exception.PortalException; -import com.liferay.portal.kernel.exception.SystemException; -import com.liferay.portal.kernel.log.Log; -import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.kernel.repository.model.Folder; -import com.liferay.portal.util.PortalUtil; -import com.liferay.portlet.documentlibrary.model.DLFileEntry; -import com.liferay.portlet.documentlibrary.model.DLFolderConstants; -import com.liferay.portlet.documentlibrary.service.DLAppServiceUtil; -import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; -/** - * - * @author M. Assante CNR-ISTI - */ -public class Utils { - private static Log _log = LogFactoryUtil.getLog(Utils.class); - - private static String SERVICE_ENDPOINT_CATEGORY = "DataAnalysis"; - private static String SERVICE_ENDPOINT_NAME = "DataMiner"; - public static final String ENCODED_FARM_PARAM = "ZmFybUlk"; - public static String ANALYTICAL_TOOLKIT_PORTLET_ENDPOINT = "performfish-analysis"; - private static String ANALYTICAL_TOOLKIT_SERVICE_GCORE_ENDPOINT_NAME = "perform-service"; - private static String ANALYTICAL_TOOLKIT_SERVICE_GCORE_ENDPOINT_CLASS = "Application"; - public static String ANALYTICAL_TOOLKIT_SERVICE_INTERFACE_NAME = "org.gcube.application.perform.service.PerformService"; - - public static final String NOT_ADMIN_PAGE_PATH = "/html/error_pages/NotACompanyAdmin.jsp"; - public static final String NOT_FARM_ADMIN_PAGE_PATH = "/html/error_pages/NotAFarmAdmin.jsp"; - public static final String NOT_BELONGING_PAGE_PATH = "/html/error_pages/NotBelongingToAnyCompany.jsp"; - public static final String NOT_BELONGING_ANY_FARM_PAGE_PATH = "/html/error_pages/NotBelongingToAnyFarm.jsp"; - public static final String NOT_BELONGING_ANY_ASSO_PAGE_PATH = "/html/error_pages/NotBelongingToAnyAssociation.jsp"; - public static final String TOO_MANY_BELONGING_PAGE_PATH = "/html/error_pages/TooManyBelongingCompany.jsp"; - public static final String TOO_MANY_FARM_PAGE_PATH = "/html/error_pages/TooManyBelongingFarm.jsp"; - public static final String TOO_MANY_ASSO_PAGE_PATH = "/html/error_pages/TooManyBelongingAssociation.jsp"; - public static final String SELECT_FARM_PAGE_PATH = "/html/farmrepository/SelectBelongingFarm.jsp"; - - private static UserManager UM = new LiferayUserManager(); - private static RoleManager RM = new LiferayRoleManager(); - - - /** - * For being a Company admin in PerformFISHKPIs VRE you should have the Site Role defined in COMPANY_ADMIN_SITE_ROLE constant. - * The company the user belongs to instead is defined by the Team (VRE Group) to which the user belongs to. A user must belong to one Team only. - * @param currentUser - * @return the GCubeTeam to which the user belongs to, or null oterwise - * @throws GroupRetrievalFault - * @throws UserRetrievalFault - */ - public static GCubeTeam checkBelongingToOneCompanyOnly(RenderRequest request, RenderResponse response, MVCPortlet instance) throws PortletException, IOException { - - GCubeUser currentUser = getCurrentUser(request); - long groupId = -1; - try { - groupId = PortalUtil.getScopeGroupId(request); - } catch (PortalException | SystemException e) { - e.printStackTrace(); - } - _log.debug("user is" + currentUser); - List teams = new ArrayList<>(); - try { - teams = new LiferayRoleManager().listTeamsByUserAndGroup(currentUser.getUserId(), groupId); - } catch (UserRetrievalFault | GroupRetrievalFault e) { - e.printStackTrace(); - } - - if (teams.isEmpty()) { - _log.info("NOT BELONGING TO ANY TEAM"); - PortletRequestDispatcher dispatcher = instance.getPortletContext().getRequestDispatcher(NOT_BELONGING_PAGE_PATH); - dispatcher.include(request, response); - return null; - } - List companiesChecker = new ArrayList<>(); //this at then end must be length 1 - if (teams.size() > 0) { - _log.info("Checking company ..."); - Connection conn; - try { - conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - List companies = DBUtil.getCompanies(conn); - for (GCubeTeam team : teams) { - for (Company company : companies) { - if (team.getTeamId() == company.getCompanyId()) { - _log.info(currentUser.getUsername() + " belongs to company ..." + team.getTeamName()); - companiesChecker.add(team); - } - } - } - } catch (Exception e) { - PortletRequestDispatcher dispatcher = instance.getPortletContext().getRequestDispatcher("/html/error_pages/operation-error.jsp"); - dispatcher.include(request, response); - e.printStackTrace(); - } - } - if (companiesChecker.isEmpty()) { - PortletRequestDispatcher dispatcher = instance.getPortletContext().getRequestDispatcher(NOT_BELONGING_PAGE_PATH); - dispatcher.include(request, response); - return null; - } else if (companiesChecker.size() > 1) { - PortletRequestDispatcher dispatcher = instance.getPortletContext().getRequestDispatcher(TOO_MANY_BELONGING_PAGE_PATH); - dispatcher.include(request, response); - return null; - } else - return companiesChecker.get(0); - } - /** - * - * @param request - * @param response - * @param instance - * @return - * @throws PortletException - * @throws IOException - */ - public static GCubeTeam checkBelongingToOneAssociationOnly(RenderRequest request, RenderResponse response, MVCPortlet instance) throws PortletException, IOException { - - GCubeUser currentUser = getCurrentUser(request); - long groupId = -1; - try { - groupId = PortalUtil.getScopeGroupId(request); - } catch (PortalException | SystemException e) { - e.printStackTrace(); - } - _log.debug("user is" + currentUser); - List teams = new ArrayList<>(); - try { - teams = new LiferayRoleManager().listTeamsByUserAndGroup(currentUser.getUserId(), groupId); - } catch (UserRetrievalFault | GroupRetrievalFault e) { - e.printStackTrace(); - } - - if (teams.isEmpty()) { - _log.info("NOT BELONGING TO ANY TEAM"); - PortletRequestDispatcher dispatcher = instance.getPortletContext().getRequestDispatcher(NOT_BELONGING_PAGE_PATH); - dispatcher.include(request, response); - return null; - } - List associationChecker = new ArrayList<>(); //this at then end must be length 1 - if (teams.size() > 0) { - _log.info("Checking association ..."); - Connection conn; - try { - conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - List associations = DBUtil.getAllAssociations(conn); - for (GCubeTeam team : teams) { - for (Association ass : associations) { - if (team.getTeamId() == ass.getAssociationId()) { - _log.info(currentUser.getUsername() + " belongs to association ..." + team.getTeamName()); - associationChecker.add(team); - } - } - } - } catch (Exception e) { - PortletRequestDispatcher dispatcher = instance.getPortletContext().getRequestDispatcher("/html/error_pages/operation-error.jsp"); - dispatcher.include(request, response); - e.printStackTrace(); - } - } - if (associationChecker.isEmpty()) { - PortletRequestDispatcher dispatcher = instance.getPortletContext().getRequestDispatcher(NOT_BELONGING_ANY_ASSO_PAGE_PATH); - dispatcher.include(request, response); - return null; - } else if (associationChecker.size() > 1) { - PortletRequestDispatcher dispatcher = instance.getPortletContext().getRequestDispatcher(TOO_MANY_ASSO_PAGE_PATH); - dispatcher.include(request, response); - return null; - } else - return associationChecker.get(0); - - } - - /** - * For being a Company FARM admin in PerformFISHKPIs VRE you should have the Site Role defined in FARM_ADMIN_SITE_ROLE constant. - * The farm the user belongs to instead is defined by the Team (VRE Group) to which the user belongs to. A user must belong to one Farm only. - * @param currentUser - * @return the GCubeTeam to which the user belongs to, or null oterwise - * @throws GroupRetrievalFault - * @throws UserRetrievalFault - */ - public static GCubeTeam checkBelongingToOneFarmOnly(RenderRequest request, RenderResponse response, MVCPortlet instance) throws PortletException, IOException { - - GCubeUser currentUser = getCurrentUser(request); - long groupId = -1; - try { - groupId = PortalUtil.getScopeGroupId(request); - } catch (PortalException | SystemException e) { - e.printStackTrace(); - } - _log.debug("user is" + currentUser); - List teams = new ArrayList<>(); - try { - teams = new LiferayRoleManager().listTeamsByUserAndGroup(currentUser.getUserId(), groupId); - } catch (UserRetrievalFault | GroupRetrievalFault e) { - e.printStackTrace(); - } - - if (teams.isEmpty()) { - _log.info("NOT BELONGING TO ANY TEAM"); - PortletRequestDispatcher dispatcher = instance.getPortletContext().getRequestDispatcher(NOT_BELONGING_ANY_FARM_PAGE_PATH); - dispatcher.include(request, response); - return null; - } - GCubeTeam theuserCompany = checkBelongingToOneCompanyOnly(request, response, instance); - List farmsChecker = new ArrayList<>(); //this at then end must be length 1 - if (teams.size() > 0) { - _log.info("Checking farms ..."); - Connection conn; - try { - conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - List farms = DBUtil.listFarmsByCompanyId(conn, theuserCompany.getTeamId()); - for (GCubeTeam team : teams) { - for (Farm farm : farms) { - if (team.getTeamId() == farm.getFarmId()) { - _log.info(currentUser.getUsername() + " belongs to farm ..." + team.getTeamName()); - farmsChecker.add(team); - } - } - } - } catch (Exception e) { - PortletRequestDispatcher dispatcher = instance.getPortletContext().getRequestDispatcher("/html/error_pages/operation-error.jsp"); - dispatcher.include(request, response); - e.printStackTrace(); - } - } - if (farmsChecker.isEmpty()) { - PortletRequestDispatcher dispatcher = instance.getPortletContext().getRequestDispatcher(NOT_BELONGING_ANY_FARM_PAGE_PATH); - dispatcher.include(request, response); - return null; - } else if (farmsChecker.size() > 1) { - PortletRequestDispatcher dispatcher = instance.getPortletContext().getRequestDispatcher(TOO_MANY_FARM_PAGE_PATH); - dispatcher.include(request, response); - return null; - } else - return farmsChecker.get(0); - } - - public static boolean checkBelongsToTeam(long userId, long farmId, long groupid) throws Exception { - List teams = new LiferayRoleManager().listTeamsByUserAndGroup(userId, groupid); - for (GCubeTeam farm : teams) { - if (farm.getTeamId() == farmId) - return true; - } - return false; - } - - - public static List getUserFarms(RenderRequest request, RenderResponse response, MVCPortlet instance) throws PortletException, IOException { - - GCubeUser currentUser = getCurrentUser(request); - long groupId = -1; - try { - groupId = PortalUtil.getScopeGroupId(request); - } catch (PortalException | SystemException e) { - e.printStackTrace(); - } - _log.info("user is" + currentUser); - List teams = new ArrayList<>(); - try { - teams = new LiferayRoleManager().listTeamsByUserAndGroup(currentUser.getUserId(), groupId); - } catch (UserRetrievalFault | GroupRetrievalFault e) { - e.printStackTrace(); - } - - if (teams.isEmpty()) { - _log.info("NOT BELONGING TO ANY TEAM"); - PortletRequestDispatcher dispatcher = instance.getPortletContext().getRequestDispatcher(NOT_BELONGING_ANY_FARM_PAGE_PATH); - dispatcher.include(request, response); - return null; - } - GCubeTeam theuserCompany = checkBelongingToOneCompanyOnly(request, response, instance); - List farmsChecker = new ArrayList<>(); - if (teams.size() > 0) { - _log.info("Checking farms ..."); - Connection conn; - try { - conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - List farms = DBUtil.listFarmsByCompanyId(conn, theuserCompany.getTeamId()); - for (GCubeTeam team : teams) { - for (Farm farm : farms) { - if (team.getTeamId() == farm.getFarmId()) { - _log.info(currentUser.getUsername() + " belongs to farm ..." + team.getTeamName()); - farmsChecker.add(team); - } - } - } - } catch (Exception e) { - PortletRequestDispatcher dispatcher = instance.getPortletContext().getRequestDispatcher("/html/error_pages/operation-error.jsp"); - dispatcher.include(request, response); - e.printStackTrace(); - } - } - if (farmsChecker.isEmpty()) { - PortletRequestDispatcher dispatcher = instance.getPortletContext().getRequestDispatcher(NOT_BELONGING_ANY_FARM_PAGE_PATH); - dispatcher.include(request, response); - return null; - } else if (farmsChecker.size() > 1) { //executed when more than one farm exist per user - request.setAttribute("theFarms", farmsChecker); //pass to the JSP - PortletRequestDispatcher dispatcher = instance.getPortletContext().getRequestDispatcher(SELECT_FARM_PAGE_PATH); - dispatcher.include(request, response); - return null; - } else - return farmsChecker; - } - - public static int getUserFarmsNumber(RenderRequest request, RenderResponse response, MVCPortlet instance) throws PortletException, IOException { - - GCubeUser currentUser = getCurrentUser(request); - long groupId = -1; - try { - groupId = PortalUtil.getScopeGroupId(request); - } catch (PortalException | SystemException e) { - e.printStackTrace(); - } - _log.debug("user is" + currentUser); - List teams = new ArrayList<>(); - try { - teams = new LiferayRoleManager().listTeamsByUserAndGroup(currentUser.getUserId(), groupId); - } catch (UserRetrievalFault | GroupRetrievalFault e) { - e.printStackTrace(); - } - - if (teams.isEmpty()) { - _log.info("NOT BELONGING TO ANY TEAM"); - PortletRequestDispatcher dispatcher = instance.getPortletContext().getRequestDispatcher(NOT_BELONGING_ANY_FARM_PAGE_PATH); - dispatcher.include(request, response); - return 0; - } - GCubeTeam theuserCompany = checkBelongingToOneCompanyOnly(request, response, instance); - List farmsChecker = new ArrayList<>(); - if (teams.size() > 0) { - _log.info("Checking farms ..."); - Connection conn; - try { - conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - List farms = DBUtil.listFarmsByCompanyId(conn, theuserCompany.getTeamId()); - for (GCubeTeam team : teams) { - for (Farm farm : farms) { - if (team.getTeamId() == farm.getFarmId()) { - _log.info(currentUser.getUsername() + " belongs to farm ..." + team.getTeamName()); - farmsChecker.add(team); - } - } - } - } catch (Exception e) { - PortletRequestDispatcher dispatcher = instance.getPortletContext().getRequestDispatcher("/html/error_pages/operation-error.jsp"); - dispatcher.include(request, response); - e.printStackTrace(); - } - } - if (farmsChecker.isEmpty()) { - PortletRequestDispatcher dispatcher = instance.getPortletContext().getRequestDispatcher(NOT_BELONGING_ANY_FARM_PAGE_PATH); - dispatcher.include(request, response); - return 0; - } else - return farmsChecker.size(); - } - - - /** - * - * @param theTeam - * @param groupId - * @param request - * @return - * @throws PortalException - * @throws SystemException - */ - public static String getCompanyLogoURL(String companyName, long groupId, RenderRequest request) { - String imageUrl = ""; - String fileName = companyName+".png"; - try { - Folder folder = DLAppServiceUtil.getFolder(groupId,DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, PFISHConstants.LOGO_FOLDER_NAME); - DLFileEntry image = DLFileEntryLocalServiceUtil.getFileEntry(groupId, folder.getFolderId(), fileName); - - if (image != null) { - imageUrl = - PortalUtil.getPortalURL(request) + "/documents/" + image.getGroupId() + "/" + - image.getFolderId() + "/" + image.getTitle() + "/" + image.getUuid() + "?t=" + - System.currentTimeMillis(); - } - } catch (Exception e) { - _log.warn("No Logo URL found for this Comany in the Site Logo folder, file expected to find: " + fileName); - } - return imageUrl; - } - /** - * - * @param team - * @return - * @throws GroupRetrievalFault - * @throws RoleRetrievalFault - */ - public static List getCompanyAdminTeamMembers(long teamId, long groupId) throws Exception { - List toReturn = new ArrayList<>(); - GCubeRole adminRole = RM.getRole(PFISHConstants.COMPANY_ADMIN_SITE_ROLE, groupId); - List companyUsers = UM.listUsersByTeam(teamId); - for (GCubeUser member : companyUsers) { - if (RM.hasRole(member.getUserId(), groupId, adminRole.getRoleId())) { - toReturn.add(new CompanyMember(member)); - } - } - return toReturn; - } - /** - * - * @param team - * @return - * @throws GroupRetrievalFault - * @throws RoleRetrievalFault - */ - public static List getFarmAdminTeamMembers(GCubeTeam theCompany, GCubeTeam theFarm) throws Exception { - long teamId = theFarm.getTeamId(); - List toReturn = new ArrayList<>(); - List farmUsers = UM.listUsersByTeam(teamId); - for (GCubeUser member : farmUsers) { - if (isFarmAdmin(member, theFarm.getGroupId(), theFarm)) - toReturn.add(member); - } - return toReturn; - } - /** - * - * @param team - * @return - * @throws GroupRetrievalFault - * @throws RoleRetrievalFault - */ - public static List getRegularCompanyMembers(long teamId, long groupId) throws Exception { - List toReturn = new ArrayList<>(); - - GCubeRole adminRole = RM.getRole(PFISHConstants.COMPANY_ADMIN_SITE_ROLE, groupId); - List companyUsers = UM.listUsersByTeam(teamId); - for (GCubeUser member : companyUsers) { - if (!RM.hasRole(member.getUserId(), groupId, adminRole.getRoleId())) { - toReturn.add(new CompanyMember(member)); - } - } - return toReturn; - } - /** - * - * @param team - * @return - * @throws GroupRetrievalFault - * @throws RoleRetrievalFault - */ - public static List getRegularFarmMembers(long farmId, long groupId) throws Exception { - List toReturn = new ArrayList<>(); - - //check that the user belongs to the company first - Connection conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - long companyId = DBUtil.getCompanyByFarmId(conn, farmId); - List companyMembers = UM.listUsersByTeam(companyId); - - GCubeRole adminRole = RM.getRole(PFISHConstants.FARM_ADMIN_SITE_ROLE, groupId); - List farmUsers = UM.listUsersByTeam(farmId); - for (GCubeUser member : farmUsers) { - if (!RM.hasRole(member.getUserId(), groupId, adminRole.getRoleId()) && companyMembers.contains(member)) { - toReturn.add(member); - } - } - return toReturn; - } - /** - * - * @param teamId - * @param groupId - * @return the list of the company users eligible to become a farm members, eligible means they belong the company but not to this farm - * @throws Exception - */ - public static List getAvailableFarmMembersToAssociate(long farmId, long companyId, long groupId) throws Exception { - List toReturn = new ArrayList(); - List companyUsers = UM.listUsersByTeam(companyId); - List farmUsers = UM.listUsersByTeam(farmId); - for (GCubeUser user : companyUsers) { - boolean found = false; - if (farmUsers.contains(user)) { - found = true; - } - if (!found) - toReturn.add(user); - } - return toReturn; - } - /** - * - * @param team - * @return - * @throws GroupRetrievalFault - * @throws RoleRetrievalFault - */ - public static List listVREUsersNotAssociatedToAnyCompany(long teamId, long groupId) throws Exception { - List toReturn = new ArrayList<>(); - List vreUsers = UM.listUsersByGroup(groupId); - Connection conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - List allCompanies = DBUtil.getCompanies(conn); - for (GCubeUser vreUser : vreUsers) { - boolean found = false; - for (Company company : allCompanies) { - List companyUsers = UM.listUsersByTeam(company.getCompanyId()); - if (companyUsers.contains(vreUser)) { - found = true; - break; - } - } - if (!found) - toReturn.add(vreUser); - } - return toReturn; - } - /** - * - * @param companyId - * @param groupId - * @return list of Company Users Not Associated To Any Farm of the company - * @throws Exception - */ - public static List listCompanyUsersNotAssociatedToAnyFarm(long companyId, long groupId) throws Exception { - List toReturn = new ArrayList<>(); - List companyUsers = UM.listUsersByTeam(companyId); - Connection conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - List allFarms = DBUtil.listFarmsByCompanyId(conn, companyId); - for (GCubeUser companyUser : companyUsers) { - boolean found = false; - for (Farm farm : allFarms) { - List farmUsers = UM.listUsersByTeam(farm.getFarmId()); - if (farmUsers.contains(companyUser)) { - found = true; - break; - } - } - if (!found) - toReturn.add(companyUser); - } - return toReturn; - } - /** - * - * @param teamToExclude - * @return the list of the user of the current Site withour the members of the team passes as paremeter - */ - public static List getAvailableSiteMembersToAssociate(long teamId, long groupId) throws Exception { - List toReturn = new ArrayList(); - List companyUsers = UM.listUsersByTeam(teamId); - List siteUsers = UM.listUsersByGroup(groupId, false); - for (GCubeUser siteUser : siteUsers) { - if (!companyUsers.contains(siteUser)) - toReturn.add(siteUser); - } - return toReturn; - } - - public static String getUserProfileLink(String username) { - return "profile?"+ new String(Base64.getEncoder().encode(PFISHConstants.USER_PROFILE_OID.getBytes()))+"="+new String(Base64.getEncoder().encode(username.getBytes())); - } - /** - * - * @param currentUser - * @param groupId the site id - * @param team the Team to which the user belongs to - * @return - * @throws Exception - */ - public static boolean isCompanyAdmin(GCubeUser currentUser, long groupId, GCubeTeam team) throws Exception { - // instanciate the interface - - long teamId = team.getTeamId(); - List companyUsers = UM.listUsersByTeam(teamId); - //the team must be defined in the current group and the user must be part of the team - if (team.getGroupId() == groupId && companyUsers.contains(currentUser)) { - _log.info(currentUser.getUsername() + " belongs to " + team.getTeamName() + " checking Admin rights ..."); - GCubeRole adminRole = RM.getRole(PFISHConstants.COMPANY_ADMIN_SITE_ROLE, groupId); - boolean isAdmin = RM.hasRole(currentUser.getUserId(), groupId, adminRole.getRoleId()); - _log.info(currentUser.getUsername() + " is Admin of Company " + team.getTeamName() + "? " + isAdmin); - return isAdmin; - } - return false; - } - - /** - * - * @param userId - * @param companyId - * @param groupId - * @return the farm instance or null if any - * @throws Exception - */ - public static List getFarmsByUserId(long userId, long companyId, long groupId) throws Exception { - _log.debug("user is" + userId); - List teams = new ArrayList<>(); - List toReturn = new ArrayList<>(); - try { - teams = new LiferayRoleManager().listTeamsByUserAndGroup(userId, groupId); - } catch (UserRetrievalFault | GroupRetrievalFault e) { - e.printStackTrace(); - } - Connection conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection(); - List allFarms = DBUtil.listFarmsByCompanyId(conn, companyId); - for (Farm farm : allFarms) { - for (GCubeTeam team : teams) { - if (farm.getFarmId() == team.getTeamId()) { - farm.setName(team.getTeamName()); - toReturn.add(farm); - } - } - } - return toReturn; - } - - /** - * - * @param theUser - * @param groupId the site id - * @param theFarm the Team to which the user belongs to - * @return - * @throws Exception - */ - public static boolean isFarmAdmin(GCubeUser theUser, long groupId, GCubeTeam theFarm) throws Exception { - // instanciate the interface - - long teamId = theFarm.getTeamId(); - List farmUsers = UM.listUsersByTeam(teamId); - //the team must be defined in the current group and the user must be part of the team - if (theFarm.getGroupId() == groupId && farmUsers.contains(theUser)) { - _log.info(theUser.getUsername() + " belongs to " + theFarm.getTeamName() + " checking Admin rights ..."); - GCubeRole adminRole = RM.getRole(PFISHConstants.FARM_ADMIN_SITE_ROLE, groupId); - boolean isAdmin = RM.hasRole(theUser.getUserId(), groupId, adminRole.getRoleId()); - _log.info(theUser.getUsername() + " is Admin of FARM " + theFarm.getTeamName() + "? " + isAdmin); - return isAdmin; - } - return false; - } - - public static Workspace getWS(String currentUsername, String context) { - String username = currentUsername; - String authorizationToken = PortalContext.getConfiguration().getCurrentUserToken(context, username); - SecurityTokenProvider.instance.set(authorizationToken); - ScopeProvider.instance.set(context); - try { - return HomeLibrary.getUserWorkspace(username); - } - catch (Exception e) { - e.printStackTrace(); - return null; - } - } - /** - * check whether the company folder exists and it creates it when not. - * @param currentUsername - * @param context - * @return - */ - public static synchronized WorkspaceFolder getWSCompanyFolder(String currentUsername, String context, GCubeTeam team) { - String username = currentUsername; - String authorizationToken = PortalContext.getConfiguration().getCurrentUserToken(context, username); - SecurityTokenProvider.instance.set(authorizationToken); - ScopeProvider.instance.set(context); - Workspace ws = null; - WorkspaceFolder folder = null; - String companyName = team.getTeamName(); - try { - ws = HomeLibrary.getUserWorkspace(username); - String destinationFolderId = ws.getRoot().getId(); - String name = companyName+PFISHConstants.COMPANY_WS_FOLDER_SUFFIX; - String description = "Data belonging to " + companyName; - - if (!ws.exists(name, destinationFolderId)) { - _log.info(companyName + " company folder does not exists, triggering creation ... "); - folder = ws.createFolder(name, description, destinationFolderId); - folder.setHidden(PFISHConstants.HIDE_COMPANY_SHARED_FOLDER); - _log.info("Company folder created succesfully for " + companyName + " adding other company users (if any)"); - List users = new ArrayList<>(); - for (GCubeUser member : UM.listUsersByTeam(team.getTeamId())) { - users.add(member.getUsername()); - } - WorkspaceSharedFolder sharedFolder = folder.share(users); - try { - Thread.sleep(5000); - } catch (InterruptedException ex) {} - if (sharedFolder.isShared()) { - sharedFolder.setACL(users, ACLType.WRITE_ALL); - _log.info("ACL Set correctly ..."); - } else { - while (!sharedFolder.isShared()) { - _log.info("Trying to Set ACL ..."); - try { - Thread.sleep(5000); - } catch (InterruptedException ex) {} - if (sharedFolder.isShared()) { - sharedFolder.setACL(users, ACLType.WRITE_ALL); - _log.info("ACL Set correctly after at least one attempt..."); - } - } - } - } - else { - _log.info(companyName + " company folder exists, returning id ... "); - folder = (WorkspaceFolder) ws.find(name, destinationFolderId); - folder.setHidden(PFISHConstants.HIDE_COMPANY_SHARED_FOLDER); - } - } - catch (Exception e) { - e.printStackTrace(); - return null; - } - return folder; - } - - /** - * check whether the farm folder exists and it creates it when not. - * @param currentUsername - * @param context - * @return - */ - public static synchronized WorkspaceFolder getWSFarmFolder(String currentUsername, String context, GCubeTeam company, GCubeTeam farm) { - String username = currentUsername; - String authorizationToken = PortalContext.getConfiguration().getCurrentUserToken(context, username); - SecurityTokenProvider.instance.set(authorizationToken); - ScopeProvider.instance.set(context); - - Workspace ws = null; - WorkspaceFolder folder = null; - String companyName = company.getTeamName(); - try { - WorkspaceFolder companyFolder = getWSCompanyFolder(currentUsername, context, company); - ws = HomeLibrary.getUserWorkspace(username); - String destinationFolderId = companyFolder.getId(); - String name = Long.toString(farm.getTeamId()); //the farm folder is the unique id of the farm - String description = new StringBuilder("Forms submitted by farm ") - .append(farm.getTeamName()) - .append(" belonging to company ").append(companyName).toString(); - if (!ws.exists(name, destinationFolderId)) { - _log.info(companyName + " farm folder does not exists, triggering creation ... "); - folder = ws.createFolder(name, description, destinationFolderId); - folder.setHidden(PFISHConstants.HIDE_COMPANY_SHARED_FOLDER); - _log.info("Farm folder created succesfully for " + companyName); - } - else { - _log.info(farm.getTeamName() + " farm folder exists, returning id ... "); - SecurityTokenProvider.instance.set(authorizationToken); - ScopeProvider.instance.set(context); - folder = (WorkspaceFolder) ws.find(name, destinationFolderId); - folder.setHidden(PFISHConstants.HIDE_COMPANY_SHARED_FOLDER); - _log.info(farm.getTeamName() + " farm folder id = " + folder.getId()); - } - } - catch (Exception e) { - e.printStackTrace(); - return null; - } - return folder; - } - - public static GCubeUser getCurrentUser(RenderRequest request) { - long userId; - try { - userId = PortalUtil.getUser(request).getUserId(); - return getCurrentUser(userId); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - public static GCubeUser getCurrentUser(HttpServletRequest request) { - long userId; - try { - userId = PortalUtil.getUser(request).getUserId(); - return getCurrentUser(userId); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - public static GCubeUser getCurrentUser(ResourceRequest request) { - long userId; - try { - userId = PortalUtil.getUser(request).getUserId(); - return getCurrentUser(userId); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - - public static GCubeUser getUserByUsername(String username) { - try { - return new LiferayUserManager().getUserByUsername(username); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - public static GCubeUser getCurrentUser(long userId) { - try { - return new LiferayUserManager().getUserById(userId); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - public static String getCurrentContext(ResourceRequest request) { - long groupId = -1; - try { - groupId = PortalUtil.getScopeGroupId(request); - return getCurrentContext(groupId); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - public static String getCurrentContext(RenderRequest request) { - long groupId = -1; - try { - groupId = PortalUtil.getScopeGroupId(request); - return getCurrentContext(groupId); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - public static String getCurrentContext(HttpServletRequest request) { - long groupId = -1; - try { - groupId = PortalUtil.getScopeGroupId(request); - return getCurrentContext(groupId); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - public static String getCurrentContext(long groupId) { - try { - PortalContext pContext = PortalContext.getConfiguration(); - return pContext.getCurrentScope(""+groupId); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - /** - *

- * Returns the gCube authorisation token for the given user - *

- * @param scope infrastrucure context (scope) - * @param username the GCubeUser username @see {@link GCubeUser} - * @return the Token for the user in the context, or null if a token for this user could not be found - */ - public static String getCurrentUserToken(String scope, String username) { - String userToken = null; - - try { - ScopeProvider.instance.set(scope); - userToken = authorizationService().resolveTokenByUserAndContext(username, scope); - SecurityTokenProvider.instance.set(userToken); - } - catch (ObjectNotFound ex) { - userToken = generateAuthorizationToken(username, scope); - SecurityTokenProvider.instance.set(userToken); - _log.debug("generateAuthorizationToken OK for " + username + " in scope " + scope); - } - catch (Exception e) { - _log.error("Error while trying to generate token for user " + username + "in scope " + scope); - e.printStackTrace(); - return null; - } - - return userToken; - } - - public static String maskId(long idToMask) { - String toMask = ""+idToMask; - try { - return URLEncoder.encode(Base64.getEncoder().encodeToString(toMask.getBytes("utf-8")), "UTF-8"); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - return null; - } - - public static String maskId(String toMask) { - try { - return URLEncoder.encode(Base64.getEncoder().encodeToString(toMask.getBytes("utf-8")), "UTF-8"); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - return null; - } - - public static long unmaskId(String idToUnmask) { - String unmasked = new String(Base64.getDecoder().decode(idToUnmask)); - return Long.parseLong(unmasked); - } - - - public static List getAnalyticalToolkitServiceInstance(String context) throws Exception { - String currScope = ScopeProvider.instance.get(); - ScopeProvider.instance.set(context); - SimpleQuery query = queryFor(GCoreEndpoint.class); - query.addCondition("$resource/Profile/ServiceClass/text() eq '"+ ANALYTICAL_TOOLKIT_SERVICE_GCORE_ENDPOINT_CLASS +"'"); - query.addCondition("$resource/Profile/ServiceName/text() eq '"+ ANALYTICAL_TOOLKIT_SERVICE_GCORE_ENDPOINT_NAME +"'"); - DiscoveryClient client = clientFor(GCoreEndpoint.class); - List toReturn = client.submit(query); - ScopeProvider.instance.set(currScope); - return toReturn; - } - - public static String getAnalyticalToolkitEndpoint(String context) { - List analyticalServices = null; - try { - analyticalServices = getAnalyticalToolkitServiceInstance(context); - if (analyticalServices == null || analyticalServices.isEmpty()) { - return "Cound not find Analytical Toolkit service"; - } - GCoreEndpoint endpoint = analyticalServices.get(0); - Collection list = endpoint.profile().endpoints().asCollection(); - - URI theURI = null; - for (Endpoint ep : list) { - if (ep.name().equals(Utils.ANALYTICAL_TOOLKIT_SERVICE_INTERFACE_NAME)) { - _log.info("Analytical Toolkit GCoreEndpoint: "+ep.uri()); - theURI = ep.uri(); - } - } - String endpointSSL = "https://"+theURI.getHost()+theURI.getPath(); - return endpointSSL; - - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - public static List getDataMinerInstance(String scope) throws Exception { - String currScope = ScopeProvider.instance.get(); - ScopeProvider.instance.set(scope); - SimpleQuery query = queryFor(ServiceEndpoint.class); - query.addCondition("$resource/Profile/Category/text() eq '"+ SERVICE_ENDPOINT_CATEGORY +"'"); - query.addCondition("$resource/Profile/Name/text() eq '"+ SERVICE_ENDPOINT_NAME +"'"); - DiscoveryClient client = clientFor(ServiceEndpoint.class); - List toReturn = client.submit(query); - ScopeProvider.instance.set(currScope); - return toReturn; - } - - /** - * - * @param username - * @param scope - * @throws Exception - */ - private static String generateAuthorizationToken(String username, String scope) { - List userRoles = new ArrayList<>(); - userRoles.add(PFISHConstants.DEFAULT_ROLE); - String token; - try { - token = authorizationService().generateUserToken(new UserInfo(username, userRoles), scope); - } catch (Exception e) { - e.printStackTrace(); - return null; - } - return token; - } - - public static String getPhaseByFileName(String fileName) { - if (fileName.contains(PFISHConstants.SHOW_HATCHERY)) { - return PFISHConstants.SHOW_HATCHERY; - } - else if (fileName.contains(PFISHConstants.SHOW_PRE_ONGROWING)) { - return PFISHConstants.SHOW_PRE_ONGROWING; - } - else - return PFISHConstants.SHOW_GROW_OUT; - } - - public static String getBatchTypeName(String phase, String fileName) { - switch (phase) { - case PFISHConstants.SHOW_PRE_ONGROWING: - if (fileName.toLowerCase().contains("close")) - return PFISHConstants.TEMPLATE_PRE_ONGROWING_CLOSED; - else - return PFISHConstants.TEMPLATE_PRE_ONGROWING; - case PFISHConstants.SHOW_HATCHERY: { - if (fileName.toLowerCase().contains("aggregated")) { - if (fileName.toLowerCase().contains("close")) - return PFISHConstants.TEMPLATE_HATCHERY_AGGREGATED_CLOSED; - else - return PFISHConstants.TEMPLATE_HATCHERY_AGGREGATED; - } - else { - if (fileName.toLowerCase().contains("close")) - return PFISHConstants.TEMPLATE_HATCHERY_INDIVIDUAL_CLOSED; - else - return PFISHConstants.TEMPLATE_HATCHERY_INDIVIDUAL; - } - } - case PFISHConstants.SHOW_GROW_OUT: { - if (fileName.toLowerCase().contains("individual")){ - if (fileName.toLowerCase().contains("close")) - return PFISHConstants.TEMPLATE_GROWOUT_INDIVIDUAL_CLOSED; - else - return PFISHConstants.TEMPLATE_GROWOUT_INDIVIDUAL; - } - else { - if (fileName.toLowerCase().contains("close")) - return PFISHConstants.TEMPLATE_GROWOUT_AGGREGATED_CLOSED; - else - return PFISHConstants.TEMPLATE_GROWOUT_AGGREGATED; - } - } - default: - return null; - } - } - -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/util/ValidationResult.java b/src/main/java/org/gcube/portlets/user/performfish/util/ValidationResult.java deleted file mode 100644 index d1c448a..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/util/ValidationResult.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.gcube.portlets.user.performfish.util; - -public class ValidationResult { - boolean success; - String comment; - public boolean isSuccess() { - return success; - } - public void setSuccess(boolean success) { - this.success = success; - } - public String getComment() { - return comment; - } - public void setComment(String comment) { - this.comment = comment; - } - public ValidationResult(boolean success, String comment) { - super(); - this.success = success; - this.comment = comment; - } - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("ValidationResult [success="); - builder.append(success); - builder.append(", comment="); - builder.append(comment); - builder.append("]"); - return builder.toString(); - } - - -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/util/comparators/AssociationComparator.java b/src/main/java/org/gcube/portlets/user/performfish/util/comparators/AssociationComparator.java deleted file mode 100644 index e192b61..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/util/comparators/AssociationComparator.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.gcube.portlets.user.performfish.util.comparators; - -import java.util.Comparator; - -import org.gcube.portlets.user.performfish.bean.Association; - - public class AssociationComparator implements Comparator { - @Override - public int compare(Association o1, Association o2) { - return o1.getShortName().compareTo(o2.getShortName()); - } - } - - diff --git a/src/main/java/org/gcube/portlets/user/performfish/util/comparators/CompanyComparator.java b/src/main/java/org/gcube/portlets/user/performfish/util/comparators/CompanyComparator.java deleted file mode 100644 index ca9b69d..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/util/comparators/CompanyComparator.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.gcube.portlets.user.performfish.util.comparators; - -import java.util.Comparator; - -import org.gcube.portlets.user.performfish.bean.Company; - - public class CompanyComparator implements Comparator { - @Override - public int compare(Company o1, Company o2) { - return o1.getName().compareTo(o2.getName()); - } - } - - diff --git a/src/main/java/org/gcube/portlets/user/performfish/util/comparators/CompanyMemberComparator.java b/src/main/java/org/gcube/portlets/user/performfish/util/comparators/CompanyMemberComparator.java deleted file mode 100644 index 345ad99..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/util/comparators/CompanyMemberComparator.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.gcube.portlets.user.performfish.util.comparators; - -import java.util.Comparator; - -import org.gcube.portlets.user.performfish.bean.CompanyMember; - - public class CompanyMemberComparator implements Comparator { - @Override - public int compare(CompanyMember o1, CompanyMember o2) { - return o1.getUser().getFullname().compareTo(o2.getUser().getFullname()); - } - } - - diff --git a/src/main/java/org/gcube/portlets/user/performfish/util/comparators/FarmComparator.java b/src/main/java/org/gcube/portlets/user/performfish/util/comparators/FarmComparator.java deleted file mode 100644 index 5f570c4..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/util/comparators/FarmComparator.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.gcube.portlets.user.performfish.util.comparators; - -import java.util.Comparator; - -import org.gcube.portlets.user.performfish.bean.Farm; - - public class FarmComparator implements Comparator { - @Override - public int compare(Farm o1, Farm o2) { - return o1.getName().compareTo(o2.getName()); - } - } - - diff --git a/src/main/java/org/gcube/portlets/user/performfish/util/comparators/FileVersionComparator.java b/src/main/java/org/gcube/portlets/user/performfish/util/comparators/FileVersionComparator.java deleted file mode 100644 index c64d01e..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/util/comparators/FileVersionComparator.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.gcube.portlets.user.performfish.util.comparators; - -import java.util.Comparator; - -import org.gcube.common.homelibary.model.versioning.WorkspaceVersion; - - public class FileVersionComparator implements Comparator { - @Override - public int compare(WorkspaceVersion o1, WorkspaceVersion o2) { - return o1.getName().compareTo(o2.getName()); - } - } - - diff --git a/src/main/java/org/gcube/portlets/user/performfish/util/comparators/GenericFileComparator.java b/src/main/java/org/gcube/portlets/user/performfish/util/comparators/GenericFileComparator.java deleted file mode 100644 index 8100e31..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/util/comparators/GenericFileComparator.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.gcube.portlets.user.performfish.util.comparators; - -import java.util.Comparator; - -import org.gcube.common.storagehub.model.items.GenericFileItem; - -public class GenericFileComparator implements Comparator { - @Override - public int compare(GenericFileItem o1, GenericFileItem o2) { - return o1.getName().compareTo(o2.getName()); - } -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/util/comparators/TeamComparator.java b/src/main/java/org/gcube/portlets/user/performfish/util/comparators/TeamComparator.java deleted file mode 100644 index 4a684ce..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/util/comparators/TeamComparator.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.gcube.portlets.user.performfish.util.comparators; - -import java.util.Comparator; - -import org.gcube.vomanagement.usermanagement.model.GCubeTeam; - - public class TeamComparator implements Comparator { - @Override - public int compare(GCubeTeam o1, GCubeTeam o2) { - return o1.getTeamName().compareTo(o2.getTeamName()); - } - } - - diff --git a/src/main/java/org/gcube/portlets/user/performfish/util/comparators/UserComparator.java b/src/main/java/org/gcube/portlets/user/performfish/util/comparators/UserComparator.java deleted file mode 100644 index f0f1568..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/util/comparators/UserComparator.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.gcube.portlets.user.performfish.util.comparators; - -import java.util.Comparator; - -import org.gcube.vomanagement.usermanagement.model.GCubeUser; - - public class UserComparator implements Comparator { - @Override - public int compare(GCubeUser o1, GCubeUser o2) { - return o1.getFullname().compareTo(o2.getFullname()); - } - } - - diff --git a/src/main/java/org/gcube/portlets/user/performfish/util/comparators/WSItemComparator.java b/src/main/java/org/gcube/portlets/user/performfish/util/comparators/WSItemComparator.java deleted file mode 100644 index 8beda88..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/util/comparators/WSItemComparator.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.gcube.portlets.user.performfish.util.comparators; - -import java.util.Comparator; - -import org.gcube.common.homelibrary.home.exceptions.InternalErrorException; -import org.gcube.common.homelibrary.home.workspace.WorkspaceItem; - - public class WSItemComparator implements Comparator { - @Override - public int compare(WorkspaceItem o1, WorkspaceItem o2) { - try { - return o1.getName().compareTo(o2.getName()); - } catch (InternalErrorException e) { - e.printStackTrace(); - } - return 0; - } - } - - diff --git a/src/main/java/org/gcube/portlets/user/performfish/util/db/DBUtil.java b/src/main/java/org/gcube/portlets/user/performfish/util/db/DBUtil.java deleted file mode 100644 index 1229948..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/util/db/DBUtil.java +++ /dev/null @@ -1,361 +0,0 @@ -package org.gcube.portlets.user.performfish.util.db; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.UUID; - -import org.gcube.portlets.user.performfish.bean.Association; -import org.gcube.portlets.user.performfish.bean.Company; -import org.gcube.portlets.user.performfish.bean.Farm; -import org.postgresql.util.PGobject; - -import com.liferay.portal.kernel.log.Log; -import com.liferay.portal.kernel.log.LogFactoryUtil; - -public class DBUtil { - private static Log _log = LogFactoryUtil.getLog(DBUtil.class); - - public static List getCompanies(Connection conn) throws Exception { - _log.debug("getting Companies "); - List toReturn = new ArrayList<>(); - String selectSQL = "SELECT * FROM companies"; - PreparedStatement preparedStatement = conn.prepareStatement(selectSQL); - ResultSet rs = preparedStatement.executeQuery(); - while (rs.next()) { - Long companyId = rs.getLong("companyid"); - Long associationid = rs.getLong("associationid"); - boolean staged = rs.getBoolean("isstaged"); - Company toAdd = new Company(companyId, associationid, staged); - _log.debug("Adding " + toAdd); - toReturn.add(toAdd); - } - return toReturn; - } - - public static List getAllFarms(Connection conn) throws Exception { - _log.debug("getting Farms "); - List toReturn = new ArrayList<>(); - String selectSQL = "SELECT * FROM Farms"; - PreparedStatement preparedStatement = conn.prepareStatement(selectSQL); - ResultSet rs = preparedStatement.executeQuery(); - while (rs.next()) { - Long farmid = rs.getLong("farmid"); - String location = rs.getString("opt1"); - Long companyid = rs.getLong("companyid"); - String creator = rs.getString("opt2"); - Farm toAdd = new Farm(farmid, location, companyid, creator); - Date dateLastActivity = rs.getDate("dateLastActivity"); - toAdd.setDateLastActivity(dateLastActivity); - _log.debug("Adding " + toAdd); - toReturn.add(toAdd); - } - return toReturn; - } - - public static List getAllAssociations(Connection conn) throws Exception { - _log.debug("getting Associations "); - List toReturn = new ArrayList<>(); - String selectSQL = "SELECT * FROM Associations"; - PreparedStatement preparedStatement = conn.prepareStatement(selectSQL); - ResultSet rs = preparedStatement.executeQuery(); - while (rs.next()) { - Long associationid = rs.getLong("associationid"); - String createdBy = rs.getString("opt1"); - Association toAdd = new Association(associationid, createdBy); - _log.debug("Adding " + toAdd); - toReturn.add(toAdd); - } - return toReturn; - } - - public static List listCompaniesNotAssociatedToAssociations(Connection conn) throws Exception { - _log.debug("getting Companies not associated "); - List toReturn = new ArrayList<>(); - String selectSQL = "SELECT * FROM companies where companyid NOT IN (SELECT C.companyid FROM companies as C, associations as A WHERE C.associationid = A.associationid)"; - PreparedStatement preparedStatement = conn.prepareStatement(selectSQL); - ResultSet rs = preparedStatement.executeQuery(); - while (rs.next()) { - Long companyId = rs.getLong("companyid"); - Long associationid = rs.getLong("associationid"); - boolean staged = rs.getBoolean("isstaged"); - Company toAdd = new Company(companyId, associationid, staged); - _log.debug("Adding " + toAdd); - toReturn.add(toAdd); - } - return toReturn; - } - - public static List getCompaniesIdsByAssociation(Connection conn, long associationId) throws Exception { - _log.debug("getting Companies of association with id = " +associationId); - List toReturn = new ArrayList<>(); - String selectSQL = "SELECT companyId FROM Associations as A, Companies as C WHERE A.associationId = C.associationId and A.associationId = ?"; - PreparedStatement preparedStatement = conn.prepareStatement(selectSQL); - preparedStatement.setLong(1, associationId); - ResultSet rs = preparedStatement.executeQuery(); - while (rs.next()) { - Long companyid = rs.getLong("companyid"); - toReturn.add(companyid); - } - return toReturn; - } - - public static List listFarmsByCompanyId(Connection conn, long companyId) throws Exception { - _log.debug("getting Farms of company with id = " +companyId); - List toReturn = new ArrayList<>(); - String selectSQL = "SELECT farmid, F.opt1, F.opt2, F.dateLastActivity, F.companyid FROM Farms as F, Companies as C WHERE C.companyid = F.companyid and F.companyId = ?"; - PreparedStatement preparedStatement = conn.prepareStatement(selectSQL); - preparedStatement.setLong(1, companyId); - ResultSet rs = preparedStatement.executeQuery(); - while (rs.next()) { - Long farmid = rs.getLong("farmid"); - String location = rs.getString("opt1"); - Long companyid = rs.getLong("companyid"); - String creator = rs.getString("opt2"); - Farm toAdd = new Farm(farmid, location, companyid, creator); - Date dateLastActivity = rs.getDate("dateLastActivity"); - toAdd.setDateLastActivity(dateLastActivity); - _log.debug("Adding " + toAdd); - toReturn.add(toAdd); - } - return toReturn; - } - - public static long getCompanyByFarmId(Connection conn, long farmId) throws Exception { - _log.debug("getting company of farm with id = " +farmId); - long toReturn = -1; - String selectSQL = "SELECT C.companyid FROM Farms as F, Companies as C WHERE C.companyid = F.companyid and F.farmId = ?"; - PreparedStatement preparedStatement = conn.prepareStatement(selectSQL); - preparedStatement.setLong(1, farmId); - ResultSet rs = preparedStatement.executeQuery(); - while (rs.next()) { - Long companyid = rs.getLong("companyid"); - toReturn = companyid; - } - return toReturn; - } - - - public static boolean addCompany(Connection conn, String[] companyIdsToAdd, String username) { - String insertTableSQL = "INSERT INTO companies" - + "(companyid, opt1, uuid) VALUES" - + "(?,?,?)"; - try { - PreparedStatement preparedStatement = conn.prepareStatement(insertTableSQL); - for (int i = 0; i < companyIdsToAdd.length; i++) { - PGobject toInsertUUID = new PGobject(); - toInsertUUID.setType("uuid"); - toInsertUUID.setValue(UUID.randomUUID().toString()); - - preparedStatement.setLong(1, Long.parseLong(companyIdsToAdd[i])); - preparedStatement.setString(2, "Created by: "+username); - preparedStatement.setObject(3,toInsertUUID); - // execute insert SQL stetement - preparedStatement .executeUpdate(); - } - } catch (SQLException e) { - e.printStackTrace(); - return false; - } - return true; - } - - public static boolean addAssociation(Connection conn, String[] associationsIdsToAdd, String username) { - String insertTableSQL = "INSERT INTO associations" - + "(associationid, opt1, uuid) VALUES" - + "(?,?,?)"; - try { - PreparedStatement preparedStatement = conn.prepareStatement(insertTableSQL); - for (int i = 0; i < associationsIdsToAdd.length; i++) { - - PGobject toInsertUUID = new PGobject(); - toInsertUUID.setType("uuid"); - toInsertUUID.setValue(UUID.randomUUID().toString()); - - preparedStatement.setLong(1, Long.parseLong(associationsIdsToAdd[i])); - preparedStatement.setString(2, "Created by: "+username); - preparedStatement.setObject(3,toInsertUUID); - // execute insert SQL stetement - preparedStatement .executeUpdate(); - } - } catch (SQLException e) { - e.printStackTrace(); - return false; - } - return true; - } - - public static boolean associateCompaniesToAssociation(Connection conn, long associationId, long[] companiesId) { - String updateTableSQL = "UPDATE Companies SET associationid = ? WHERE companyId = ?"; - for (int i = 0; i < companiesId.length; i++) { - try { - PreparedStatement preparedStatement = conn.prepareStatement(updateTableSQL); - preparedStatement.setLong(1, associationId); - preparedStatement.setLong(2, companiesId[i]); - preparedStatement .executeUpdate(); - }catch (SQLException e) { - e.printStackTrace(); - return false; - } - } - return true; - } - - public static boolean deleteFarm(Connection conn, long farmId) { - String updateTableSQL = "DELETE FROM Farms WHERE farmId = ?"; - try { - PreparedStatement preparedStatement = conn.prepareStatement(updateTableSQL); - preparedStatement.setLong(1, farmId); - // execute insert SQL stetement - preparedStatement .executeUpdate(); - - } catch (SQLException e) { - e.printStackTrace(); - return false; - } - return true; - } - - public static boolean editFarm(Connection conn, long farmId, String name, String farmLocation) { - String updateTableSQL = "Update Farms set name = ?, opt1 = ? WHERE farmId = ?"; - try { - PreparedStatement preparedStatement = conn.prepareStatement(updateTableSQL); - preparedStatement.setString(1, name); - preparedStatement.setString(2, farmLocation); - preparedStatement.setLong(3, farmId); - // execute insert SQL stetement - preparedStatement .executeUpdate(); - - } catch (SQLException e) { - e.printStackTrace(); - return false; - } - return true; - } - - public static boolean updateFarmLastSubmissionActivity(Connection conn, long farmId, java.sql.Date lastActivity) { - String updateTableSQL = "Update Farms set datelastactivity = ? WHERE farmId = ?"; - try { - PreparedStatement preparedStatement = conn.prepareStatement(updateTableSQL); - preparedStatement.setDate(1, lastActivity); - preparedStatement.setLong(2, farmId); - // execute insert SQL stetement - preparedStatement .executeUpdate(); - - } catch (SQLException e) { - e.printStackTrace(); - return false; - } - return true; - } - - public static boolean addFarm(Connection conn, long farmId, long companyId, String farmName, String farmLocation, String usernameCreator) { - String insertTableSQL = "INSERT INTO Farms" - + "(farmid, opt1, companyid, opt2, uuid, name) VALUES" - + "(?,?,?,?,?,?)"; - try { - PGobject toInsertUUID = new PGobject(); - toInsertUUID.setType("uuid"); - toInsertUUID.setValue(UUID.randomUUID().toString()); - - - PreparedStatement preparedStatement = conn.prepareStatement(insertTableSQL); - preparedStatement.setLong(1, farmId); - preparedStatement.setString(2, farmLocation); - preparedStatement.setLong(3, companyId); - preparedStatement.setString(4, usernameCreator); - preparedStatement.setObject(5,toInsertUUID); - preparedStatement.setObject(6,farmName); - // execute insert SQL stetement - preparedStatement.executeUpdate(); - - } catch (SQLException e) { - e.printStackTrace(); - return false; - } - return true; - } - - public static boolean removeCompany(Connection conn, String[] companyIdsToRemove) { - String insertTableSQL = "DELETE FROM companies WHERE companyId = ?"; - try { - PreparedStatement preparedStatement = conn.prepareStatement(insertTableSQL); - for (int i = 0; i < companyIdsToRemove.length; i++) { - preparedStatement.setLong(1, Long.parseLong(companyIdsToRemove[i])); - // execute insert SQL stetement - preparedStatement .executeUpdate(); - } - } catch (SQLException e) { - e.printStackTrace(); - return false; - } - return true; - } - - public static boolean setCompanyStaged(Connection conn, long companyId) { - String insertTableSQL = "UPDATE companies SET isStaged = true WHERE companyId = ?"; - try { - PreparedStatement preparedStatement = conn.prepareStatement(insertTableSQL); - preparedStatement.setLong(1, companyId); - // execute insert SQL stetement - preparedStatement .executeUpdate(); - } catch (SQLException e) { - e.printStackTrace(); - return false; - } - return true; - } - - public static Company getCompanyById(Connection conn, long companyId) throws Exception { - _log.debug("getting Companies "); - Company toReturn = null; - String selectSQL = "SELECT companyid, associationid, isStaged FROM companies WHERE companyId = ?"; - PreparedStatement preparedStatement = conn.prepareStatement(selectSQL); - preparedStatement.setLong(1, companyId); - ResultSet rs = preparedStatement.executeQuery(); - while (rs.next()) { - Long associationid = rs.getLong("associationid"); - boolean staged = rs.getBoolean("isStaged"); - toReturn = new Company(companyId, associationid, staged); - } - return toReturn; - } - /** - * - * @param conn - * @throws SQLException - */ - protected static void initializeTablesIfNotExist(Connection conn) throws SQLException { - String assTable = "CREATE TABLE IF NOT EXISTS Associations (" - + "AssociationId bigint PRIMARY KEY NOT NULL, " - + "Opt1 text, " - + "Opt2 text, " - + "dateCreated date)"; - - - String companyTable = "CREATE TABLE IF NOT EXISTS Companies (" - + "CompanyId bigint PRIMARY KEY NOT NULL, " - + "isStaged boolean NOT NULL DEFAULT FALSE, " - + "Opt1 text, " - + "Opt2 text, " - + "AssociationId bigint, " - + "FOREIGN KEY(AssociationId) REFERENCES Associations(AssociationId))"; - - String farmTable = "CREATE TABLE IF NOT EXISTS Farms (" - + "FarmId bigint PRIMARY KEY NOT NULL, " - + "Opt1 text, " - + "Opt2 text, " - + "dateLastActivity date, " - + "CompanyId bigint, " - + "FOREIGN KEY(CompanyId) REFERENCES Companies(CompanyId))"; - Statement stmt = conn.createStatement(); - stmt.execute(assTable); - stmt.execute(companyTable); - stmt.execute(farmTable); - } -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/util/db/DB_Credentials.java b/src/main/java/org/gcube/portlets/user/performfish/util/db/DB_Credentials.java deleted file mode 100644 index 95b0498..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/util/db/DB_Credentials.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.gcube.portlets.user.performfish.util.db; - -public class DB_Credentials { - - private String DBURL, DBName, user, pwd; - - public DB_Credentials(String DBURL, String DBName, String user, String pwd) { - super(); - this.DBURL = DBURL; - this.DBName = DBName; - this.user = user; - this.pwd = pwd; - } - - public DB_Credentials() { - // TODO Auto-generated constructor stub - } - - public String getJDBCURL() { - return new StringBuilder("jdbc:postgresql://").append(DBURL).append("/").append(DBName).append("?user=").append(this.user).toString(); - } - - public String getDBURL() { - return DBURL; - } - - public void setDBURL(String dBURL) { - DBURL = dBURL; - } - - public String getDBName() { - return DBName; - } - - public void setDBName(String dBName) { - DBName = dBName; - } - - public String getUser() { - return user; - } - - public void setUser(String user) { - this.user = user; - } - - public String getPwd() { - return pwd; - } - - public void setPwd(String pwd) { - this.pwd = pwd; - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("DB_Credentials [DBURL="); - builder.append(DBURL); - builder.append(", DBName="); - builder.append(DBName); - builder.append(", user="); - builder.append(user); - builder.append(", pwd="); - builder.append(pwd); - builder.append("]"); - return builder.toString(); - } - -} diff --git a/src/main/java/org/gcube/portlets/user/performfish/util/db/DatabaseConnection.java b/src/main/java/org/gcube/portlets/user/performfish/util/db/DatabaseConnection.java deleted file mode 100644 index 7319feb..0000000 --- a/src/main/java/org/gcube/portlets/user/performfish/util/db/DatabaseConnection.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.gcube.portlets.user.performfish.util.db; -import static org.gcube.resources.discovery.icclient.ICFactory.clientFor; -import static org.gcube.resources.discovery.icclient.ICFactory.queryFor; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.util.List; - -import org.gcube.common.encryption.StringEncrypter; -import org.gcube.common.resources.gcore.ServiceEndpoint; -import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint; -import org.gcube.common.scope.api.ScopeProvider; -import org.gcube.portlets.user.performfish.util.PFISHConstants; -import org.gcube.resources.discovery.client.api.DiscoveryClient; -import org.gcube.resources.discovery.client.queries.api.SimpleQuery; - -import com.liferay.portal.kernel.log.Log; -import com.liferay.portal.kernel.log.LogFactoryUtil; - - -public class DatabaseConnection { - private static Log _log = LogFactoryUtil.getLog(DatabaseConnection.class); - - private static DatabaseConnection instance; - private Connection connection; - - private DatabaseConnection(DB_Credentials dbparams) throws SQLException { - try { - Class.forName("org.postgresql.Driver"); - this.connection = DriverManager.getConnection(dbparams.getJDBCURL(), dbparams.getUser(), dbparams.getPwd()); - DBUtil.initializeTablesIfNotExist(connection); - } catch (ClassNotFoundException ex) { - _log.error("Database Connection Creation Failed : " + ex.getMessage()); - } - } - - public Connection getConnection() { - return connection; - } - - public static DatabaseConnection getInstance(String context) throws Exception { - if (instance == null || instance.getConnection().isClosed()) { - DB_Credentials cred = getDBCredentials(context); - - instance = new DatabaseConnection(cred); - _log.info("Database Connection acquired for : " + cred.getJDBCURL()); - } - return instance; - } - /** - * - * @param request - * @param response - * @param instance - * @return the credentails, and if the db is empty created the schema - * @throws Exception - */ - private static DB_Credentials getDBCredentials(String currContext) throws Exception { - AccessPoint ac = getDBAccessPoint(currContext); - DB_Credentials toReturn = new DB_Credentials(); - _log.debug("Got AccessPoint:" + ac.toString()); - String dbAddress = ac.address(); //"localhost:5432"; // - toReturn.setDBURL(dbAddress); - _log.debug("DB address: "+ dbAddress); - String dbName = ac.name(); - toReturn.setDBName(dbName); - _log.debug("DB name: "+ dbName); - String dbUser = ac.username(); - toReturn.setUser(dbUser); - _log.debug("DB user: " + dbUser); - String jdbcURL = new StringBuffer("jdbc:postgresql://").append(dbAddress).append("/").append(dbName).toString(); - _log.debug("jdbc.url: "+jdbcURL); - ScopeProvider.instance.set(currContext); - String pwd = StringEncrypter.getEncrypter().decrypt(ac.password()); - toReturn.setPwd(pwd); - _log.debug("Decrypted Password OK"); - - return toReturn; - } - /** - * Gets the survey DB access point. - * - * @return the survey DB access point - */ - private static AccessPoint getDBAccessPoint(String currContext) { - //set the context for this resource - ScopeProvider.instance.set(currContext); - //construct the xquery - SimpleQuery query = queryFor(ServiceEndpoint.class); - query.addCondition("$resource/Profile/Name/text() eq '"+ PFISHConstants.PF_DB_SERVICE_ENDPOINT_NAME +"'"); - query.addCondition("$resource/Profile/Category/text() eq '"+ PFISHConstants.PF_DB_SERVICE_ENDPOINT_CATEGORY +"'"); - - DiscoveryClient client = clientFor(ServiceEndpoint.class); - List conf = client.submit(query); - ServiceEndpoint res = conf.get(0); - - return res.profile().accessPoints().iterator().next(); - } - -} diff --git a/src/main/webapp/WEB-INF/liferay-display.xml b/src/main/webapp/WEB-INF/liferay-display.xml deleted file mode 100644 index 9fef571..0000000 --- a/src/main/webapp/WEB-INF/liferay-display.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/liferay-plugin-package.properties b/src/main/webapp/WEB-INF/liferay-plugin-package.properties deleted file mode 100644 index 21cb963..0000000 --- a/src/main/webapp/WEB-INF/liferay-plugin-package.properties +++ /dev/null @@ -1,9 +0,0 @@ -name=PerformFISH-Apps -module-group-id=liferay -module-incremental-version=8 -tags= -short-description= -change-log= -page-url=http://www.gcube-system.org -author=M. Assante, CNR-ISTI -licenses=EUPL diff --git a/src/main/webapp/WEB-INF/liferay-portlet.xml b/src/main/webapp/WEB-INF/liferay-portlet.xml deleted file mode 100644 index 23226d2..0000000 --- a/src/main/webapp/WEB-INF/liferay-portlet.xml +++ /dev/null @@ -1,257 +0,0 @@ - - - - - - manage-company-users - /icon.png - false - true - /css/main.css - - /js/main.js - - - manage-company-users-portlet - - - - manage-company-admins - /icon.png - false - true - /css/main.css - - /js/main.js - - - manage-company-admins-portlet - - - - company-repository - /icon.png - org.gcube.portlets.user.performfish.CompanyFarmRepositoryConfigurationAction - false - true - /css/main.css - - /js/main.js - - - company-repository-portlet - - - - associate-users-to-company - /icon.png - false - /css/main.css - - /js/main.js - - - associate-users-to-company-portlet - - - - promote-administrators - /icon.png - false - /css/main.css - - /js/main.js - - - promote-administrators-portlet - - - - empty-forms-documents-display - /icon.png - org.gcube.portlets.user.performfish.EmptyFormsConfigurationAction - false - /css/main.css - /js/jquery.min.js - - /js/main.js - - - empty-forms-documents-display-portlet - - - - submitted-form-validation - /icon.png - false - /css/main.css - - /js/main.js - - - submitted-form-validation-portlet - - - - manage-companies - /icon.png - false - /css/main.css - - /js/main.js - - manage-companies-portlet - - - add-new-company - /icon.png - false - /css/main.css - - /js/main.js - - add-new-company-portlet - - - manage-farms - /icon.png - false - /css/main.css - - /js/main.js - - manage-farms-portlet - - - manage-farm-administratos - /icon.png - false - /css/main.css - - /js/main.js - - - manage-farm-administratos-portlet - - - - promote-farm-administrators - /icon.png - false - /css/main.css - - /js/main.js - - - promote-farm-administrators-portlet - - - - manage-farm-users - /icon.png - false - /css/main.css - - /js/main.js - - manage-farm-users-portlet - - - associate-users-to-farm - /icon.png - false - /css/main.css - - /js/main.js - - - associate-users-to-farm-portlet - - - - - set-company-administrators-super-user - - /icon.png - false - true - /css/main.css - - /js/main.js - - - set-company-administrators-super-user-portlet - - true - - - set-farm-administrators - /icon.png - false - /css/main.css - - /js/main.js - - - set-farm-administrators-portlet - - true - - - company-private-repository - /icon.png - false - true - /css/main.css - - /js/main.js - - - company-private-repository-portlet - - - - manage-associations - /icon.png - false - true - /css/main.css - - /js/main.js - - - manage-associations-portlet - - - - associate-companies-to-association - /icon.png - false - true - /css/main.css - - /js/main.js - - - associate-companies-to-association-portlet - - true - - - association-dashboard - /icon.png - false - true - /css/table.css - - /js/main.js - - - association-dashboard-portlet - - - - administrator - Administrator - - \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/portlet.xml b/src/main/webapp/WEB-INF/portlet.xml deleted file mode 100644 index 86eb025..0000000 --- a/src/main/webapp/WEB-INF/portlet.xml +++ /dev/null @@ -1,492 +0,0 @@ - - - - - manage-company-users - Manage Company Users - org.gcube.portlets.user.performfish.ManageCompanyUsers - - view-template - /html/managecompanyusers/company_users.jsp - - 0 - - text/html - view - - - Manage Company Regular Users - Manage Company Users - - - - administrator - - - - manage-company-admins - Manage Company Admins - - org.gcube.portlets.user.performfish.ManageCompanyAdmins - - - view-template - /html/managecompanyadmins/company_admins.jsp - - 0 - - text/html - view - - - Manage Company Administrators - Manage Company Admins - - - - administrator - - - - company-repository - Company Farm Repository - org.gcube.portlets.user.performfish.CompanyFarmRepository - - view-template - /html/farmrepository/view_farm_repository.jsp - - - config-template - /html/farmrepository/config.jsp - - - add-process-action-success-action - false - - 0 - - text/html - view - config - - - Company Farm Repository - Company Farm Repository - - - - administrator - - - - associate-users-to-company - Associate Users To Company - - org.gcube.portlets.user.performfish.AssociateUsersToCompany - - view-template - /html/adduserstocompany/add_users_toCompany.jsp - - 0 - - text/html - view - - - Associate Users To Company - Associate Users To Company - - - - administrator - - - - promote-administrators - Promote Company Administrators - - org.gcube.portlets.user.performfish.PromoteCompanyAdministrators - - view-template - /html/adduserstocompany/promote_company_administrators.jsp - - 0 - - text/html - view - - - Promote Company Administrators - Promote Company Administrators - - - - administrator - - - - empty-forms-documents-display - Empty Forms Documents Display - - org.gcube.portlets.user.performfish.EmptyFormsDocumentsDisplay - - view-template - /html/emptyformsdocumentsdisplay/empty_forms_fileupload_display.jsp - - - config-template - /html/emptyformsdocumentsdisplay/empty_forms_config.jsp - - 0 - - text/html - view - config - - - Documents for initials submission with instructions and new - submissions - Empty Forms Documents Display - - - - administrator - - - - submitted-form-validation - Submitted form validation - - org.gcube.portlets.user.performfish.SubmittedFormValidation - - view-template - /html/submittedformvalidation/validation.jsp - - 0 - - text/html - view - - - Submitted Form Validation - Submitted Form Validation - - - - - portletSetupShowBorders - false - - - - administrator - - - - manage-companies - Manage Companies - org.gcube.portlets.user.performfish.ManageCompanies - - view-template - /html/managecompanies/manage_companies.jsp - - 0 - - text/html - view - - - Manage Companies - Manage Companies - - - - administrator - - - - add-new-company - Add New Company or Association - org.gcube.portlets.user.performfish.AddNewCompanyOrAssociation - - view-template - /html/addnewcompany_or_assoc/AddNewCompany.jsp - - 0 - - text/html - view - - - Add New Company or Association - Add New Company - - - - administrator - - - - manage-farms - Manage Company Farms - org.gcube.portlets.user.performfish.ManageFarms - - view-template - /html/managefarms/managefarms_view.jsp - - 0 - - text/html - view - - - Manage Company Farms - Manage Farms - - - - administrator - - - - manage-farm-administratos - Manage Farm Administrators - - org.gcube.portlets.user.performfish.ManageFarmAdministrators - - view-template - /html/managefarmadministratos/farm_admins.jsp - - 0 - - text/html - view - - - Manage Farm Administrators - Manage Farm Administrators - - - - administrator - - - - promote-farm-administrators - Promote Farm Administrators - - org.gcube.portlets.user.performfish.PromoteFarmAdministrators - - view-template - /html/adduserstocompany/promote_farm_administrators.jsp - - 0 - - text/html - view - - - Promote Farm Administrators - Promote Farm Administrators - - - - administrator - - - - manage-farm-users - Manage Farm Users - org.gcube.portlets.user.performfish.ManageFarmUsers - - view-template - /html/managefarmusers/manage_farm_users_view.jsp - - 0 - - text/html - view - - - Manage Farm Users - Manage Farm Users - - - - administrator - - - - associate-users-to-farm - Associate Users To Farm - - org.gcube.portlets.user.performfish.AssociateUsersToFarm - - view-template - /html/adduserstocompany/add_users_toFarm.jsp - - 0 - - text/html - view - - - Associate Users To Farm - Associate Users To Farm - - - - administrator - - - - set-company-administrators-super-user - Set Company Administrators Super User - - org.gcube.portlets.user.performfish.SetCompanyAdministratorsSuperUser - - view-template - /html/setcompanyadministratorssuperuser/set_company_admin.jsp - - 0 - - text/html - view - - - Set Company Administrators Super User - Set Company Administrators Super User - - - - administrator - - - - set-farm-administrators - Set Farm Administrators - - org.gcube.portlets.user.performfish.SetFarmAdministrators - - - view-template - /html/setfarmadministrators/set_farm_admin.jsp - - 0 - - text/html - view - - - Set Farm Administrators - Set Farm Administrators - - - - administrator - - - - company-private-repository - Company Private Repository - - org.gcube.portlets.user.performfish.CompanyPrivateRepository - - - view-template - /html/companyprivaterepository/company_private_repository.jsp - - 0 - - text/html - view - - - Company Private Repository - Company Private Repository - - - - administrator - - - - manage-associations - Manage Associations - - org.gcube.portlets.user.performfish.ManageAssociations - - - view-template - /html/manageassociations/manage_associations_view.jsp - - 0 - - text/html - view - - - Manage Associations - Manage Associations - - - - administrator - - - - associate-companies-to-association - Associate Companies To Association - - org.gcube.portlets.user.performfish.AssociateCompaniesToAssociation - - - view-template - - /html/associatecompaniestoassociation/companies_to_ass_view.jsp - - - 0 - - text/html - view - - - Associate Companies To Association - - Associate Companies To Association - - - - - administrator - - - - association-dashboard - Association Dashboard - - org.gcube.portlets.user.performfish.AssociationDashboard - - - view-template - /html/associationdashboard/association_dashboard.jsp - - 0 - - text/html - view - - - Association Dashboard - Association Dashboard - - - - administrator - - - \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 077c985..0000000 --- a/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/src/main/webapp/css/loading_result.gif b/src/main/webapp/css/loading_result.gif deleted file mode 100644 index 5b943d2045ca4a0e5b0f37e2891094045acd5f71..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11468 zcmdto`CC)>+Ai?5R#rwJtRw^igph;`pr`>+ai}}PVw7M&5S+sx1_i_sP{frGARua( z1ELHviHJC(wHgo=6)h^YPNk?g(-!O0Y1pfu2r5)&Q_JX+}+D$mElm3l9_(HF`yQ@2u>7`{T*QRGk|W z{*Xy|c*v_;GWlW8j`t>H7Cn6}N=|S{@>}Ka=$eJsDZvEx4m2O7k!>OJP9@$dfnx~H zQ#fY1hVKsGB@p>#4d^xq>e#QwB@hk)jRL-{t*bW5u`~e6NtBlhnveCaJ1?NJ&KeSM zYc@s7`L0`)w4oaUvek1JXn;>lfUh3@{20_)fqww?pb+c1)$#lMhh2S8z*i?ztvESsJpF;} zL!OP*)M$x$lI|prW}okMxy6Gkqj9Y}pFPl&F8;>n+_Z;vk++S4)OZpXR*1A8<19@s^!L zN$TkZUfI;$e3i(#=#AtIEJa4IER>XY`?%248DT`?wYYj`|*KqB$ zBZ(#HuTvPjtQ^a}%5T)=Qv0SzQ_(H!^ea^pPm+7!CdQghn zxK;tDj&>PRkm_FiwIIH#g1zp}XJ`-3#z(~@yM-W-n2*&;@i$Oa$@KNK!{On%z?PG)F?=n)PI5UxzA*nUqnX@v9%EChQS1N9TXs(LjMbjq}GT* zpWa6W6DY5=Ic_89HRpm}he#Z?&j-~<&Yq{uS+)IU5JVlh=%)8PQwbC@dmZk=HZW#W zx%y0tbZaNs_%s_WL{`w4OId>~$8;c}z;E=@O`N@Vb_JBdm)exArWApNl(zSQVDk5A zdLzntwXA&27N;kn)w-}Q68_2C`3#Eno#%+hgD3iiGwrdO%1#*k{bMfv-yidwf3R#( zJjQvf~;7`^#JNO5w{UJxd(Mqqh(;)F^a*TqGGvZ2=1e`{Y8M#Xi?{wtXDcx+G zal*=F`v}fP;z1?bUc)$^C1w~|rVZ>%{wthq+U3MGyU5l%?Lz6BQ9EM3GTp|0bC7Ec z-5ztkkJ5$wJ~0__LR_xa!CxT18ES)pb>ZLazUrg-kD*E=Y)cm&{WN6 zpls%LK1X0@RQDq|m^+YN%hg?C5V)oCwJ%{%YEAFl&jso}$Z@W7XGHJo(vefF2q>v_ zs0bH2y6K%K?Wh5!5e=dJ8S?Hqd^XA27~8+%^J2ZgbF?;Gn3Io}6`<}9_j}Xdj%?^! zyCLQDQj~5TsoGzt-M4XbVo+Hl8f!MbER2@Ku6=x^%!5(=rd|K^^V+{S`>G!Ri8ov3 zE<&c}XGfem*f=gic~|$%jm`zl%uAc&SDz}KG>rYp&;27{XVKnOiu7Mz z?Wej`x@Rh)mID`*?LQSpP1%MaPsF~_QhTdBn9uldz>NpuUsFR6S&YyV zsE8u>#~@kZk?OC4XfQGalRO1_*i9vcqR{7~Z-BJr+XYa1fMHq;z$2LvvK_+B0ZPAE ztC~A$jY^j^@|+>hp!!O>qhb;}FOc~m^XF{kukr2K^5ZAiEkp>j0P=lW476<`1$+eM zoD>x=S$_TPb;xdbo*wk%o0k+VmftDK!FNp#vwOY-1ISjX=R}6tvgR;%p^>X8lk8AE zj-ecLD1c!jW=>ETI;6X*xdLgKF~62aUPe~O)7X7))sC`abrZ6AVHqF~ez#T#&6z^q zOKa!(ykKZ3cgMBXoT;m+kLt`_5xLJ^Am3qh9F49sO(eIiKOg-5a{1LzI{dp`kN?>2 zSPon4{zDXh1p2Si*y7kC*y6i-PxbGy+|*zZY;pW23AWfR{b+aIj`I&cMl5IUZxPG5 zQRiJ2u@id!MdgsSQ-fPsVuBoHvCZd2#u+^1x!`mbl_&TMXq zOf0Lz@ag=i`aX5N+Xots8O})sWG)mN&+Y6V6d?vJamEJkRP)uqa^U+X+uf)0>c61d zG^BI6vW9DfX-`9>uVkEHDDprPA~Abnlj>%nNYyt5S|}{zg3EfSOKU4UXadZb{NXai z;kLuwRQus8XH}ZPzRK4pf*7F&jn1@b>J6 za=G+5Gr#wN!(D8?jlFa6jR|*#b57)U2DuNHrGnb^bkowR`xyg|(>!jsxFsW`pSIxx zZ$!hU`<}tNoVXC69!kEDSe-rd#{89@f>ISk87VS6opB-ON2}b)3&%bG{>GSj|x2&yOvb7 z&>d^hW3f9{q%E;)Y0(z67TXrCmM;A#iT$IATiWq&v8&`7n#N+6(V&&o+iDU^#Q^}X98NSU{i{@9ZCjO<8~Z}DM;DKvAnQQa>2pC z;1~j{c&Spb1-0VxLNn|$cd6wJn{3KmlnuIA`3XR(jaxrTpeIIgd!itgi-aWU=0Vxk zjx0?pz?b4O_@y*jm{}nb4EshK2c%!YAcF7*xM8F`I+aZT!sIS_;r0{Na8H4Dye}P1 z@Rdrx`tTX)dncb~O-f8(?tjgzR?-9LaC}>MG%;SDL$jSn=Z1yeJcY+Mgdkd3GjVhD zY@J5(c^7mrEkv)XeT{4MW>17w8RM+-vPl`?2jYR2?BcopBi2}F1$jU2n-0ax&b5t1 zNRo$iI38JXt=_t!^hDax=K#sSg(K6xeeorXMgr1Lk0;-Aap(4b!hiei*9YRFs(Z_)vNx!{o0UxJtG2NY zT_pSLCoA3)M#!jno#8@ge3WjB1F6=UNKUU<0&VbYsRWqmUk0VW%vZ^$J|10BOA}mp zb1`!IV~@NCF1*{~ZalNIbU~IV!nk0<(3+-8Fxf}!%6C9~{b`K!cQM-`Lzy(8l=tio zjyxE*j0_Z;9k+=zfdpbDenAk4lr$Lyi4-dN9DUT?^7uTO7} zTd_PME|}@a>XNZJAM&<5ap0?tURWWDHzCWvW+?^_eTplT1a?0jwLbF zUV^n0QgEs7n*F`xh5QDfK_V+ArQ2~At4ww0atai)NJiG79#Z=EbT1EWs0$(LXO#)8 z>p1rT!(R=bXpVwpzN_6(5++9V4Rnt=qa$XnBBz$1Gj`a-p+K2$*8AD5T^0Vm}d^3!gTQ1GdLBA+GTd0zR84G7c7flWb zHJ?1P;&YRY3nDvpH1Vd;Ud@%o9$R^XYmh23_#0#)rsiB!0cf+Sj zUJqX7YVp@T->s(P6wVR;AW(JImOm;GSryP1XL&R-)1WLYmPp8-qq+J2UQzNjgA97Uk$sE?R z;atCTDQ}99qM8rA&3}{+IQozP-1L3%HLQSP1K-ti2d}BDxXfHbAowWmY>)lM7u|u> z#y{EVpFSidooCtc@G^OABO+@u6>BrfuP?2cu`+zQV)l;cphZmkq9!rnA(2Bt`MnW! zkM_k6?ZwUT__~2`C|whu{(TUPM;qD@8442yEj3-#!cW+ zt~>F(`H-=70rDSp;jv8pKf1L<=D&>9F}jv6JeI6~Hr+qEurL7o7^r2xb>V}}^wyws zU(-eXn-{Z8NYl9@%0!O4oh&D_Ek30D{AqV`=1!QvvfaEsC0#`JPx2S*2+6sAkUdEl zrzk|3ZY%<+Sm_F}s3iL8sVOhXG+1g>Za$uTC+$$%9y500yTP{U zY+tX_zONpgS5)rP6K!5U{gglF{WiygXP>*$rRjlrm;s`;PMa-TB)#M9HOFz*{Zs)DqSOIkkN$1zDsw=ti)>U-t=9BL)&! z-vR)JQ?M~9ks6Aa7kWfU2NUlgufUY#OHBmO8R(Y^#3~h*#h0k%-mcaD-NEl~KT$$^ zgI;L~KoSB5KDjW2;RC8c&iN|)5u5H3}x*10#_QE=eTBh*+P z<4w+WI4&i88Q!5+6hqn4?$JZG86X8S-UNLgTa0oum^51-kM4~84Lf z|7dGt*0+rX^#_!*UL-OqL!B?TJiPu#@CyIy;Qi;NvZWONb0hwjldPo<7No-@>R)xbl3*umnog>GfD&PNX&AO zO2s!Q-B#FFt;!NQk!)-zN0f9y#$rWvsi4@kDmp9_ze1zfvLjV{AppOAC-<<@mbYnr z;cg+FS8R75b>cBLe*;-I(O2bp6#JAfWN#0N74Oe!pbAA0i=*N5s4 zA|rx`RJGX*;atzy6iMV}`KEh!X;#-M3&_a9*kg?Aui|jvh#@er1L^sITYcYu+2jfTr|1`_-Fdzw4{p3af6xD(YYsU6eUg| zPx1U_)4YmrC1rbF-g-T_!$Z9ZfbVs#emPa8M!);|O!lv$Mj8CHuh%P2(^owZbH?=< zA^RuBXc1yPQJ=)F*n^#qqIjyMS=hXAdT%J+EB4?uI$2~CpOvoW9X`0_(UG(%FznSN zmAK*Q$N(*dC|B6=_* zD5qQ+>eP9hW#I2Q0_d&c-$;qLjlkflM_k;h*k2Z>VOU58}?#f*Z;%5*s^mPV`|wO{n3yA`TS!+X&GGq zVcYa)C+yhl`p3SwzNr3V&eDTE?wk&?X|LT?g~$DIPk$OF!S#m@Et;}6P_HjdDvf}R zJ+y~-hEibXwr;&&0v}q5E?E|%C1vHHLJeOp&rDX(DRu%%v65~;iVBOES^=R>NkB9e zncH{KNCN0UJ-LIqjZ!6s1gQn_VWD~XiU{>;EkBe{As6!7lxZ33jx3^!>`2)GbbH=) zG@*lhL9rnHcG4oD;KXf|j_^P#>B4u2x=fR%D<;hmpW1Dd=uA0$`mRjzT$x!AVn#51=zi3oAcBW#7A73_k%}oEC0yr@Gl)dFTD}!Q@N1Ul}E7 ztD=YB4fdb`Gu}`U!Sc7&3k~_;gqP925`P^=9h{;cy2=){Wxw~$>@{ljMS!&g!)Cg9 zj@}2Xq6Gyq#|Hu!4*>nxBq9cMlf>=_mvH)V-7zeU6D_?u)9X?gO2)?nW}KYeZ_cq= zVp%L#6h6e#aK5VI8BoW%9vFyM0aKY%F&-WCHd>(~-)3;Lc-KlU%-_mfv{n{@4k zdxg0u#tb`Jt0IbymrKmRqaVt!Ndaw}(8b%QdLLU_dc}V?}h>ipZ*F#hSK8f6fKbab*U1`4+`F@dbA#Bs`lN z43XRAi-Mz$MG@PqvJ~}ndm*fUfv82#N{>|bq?^kgFp4Ox!O>EcPCs6M*=(Ht%pYJR zi#T;NQspsZnBMVr?PN$-HiJ{n%0@J7ijUBa&y~1u%Yzfm)w>)D3O_09c&lQI`y~#*5Z(ek??{HGJJ6-v2#ljm_5`*eDg^i_OgpXg()QCXBhr=5+5L@V5p-l&531Hqp03Sm~{IHoSu4EHDYW26=Yk(2C39soG&c&wZ3{3BWm_z;m)_S(x!4ogV@+}uSBt29e- zyra3@IgVM6qi>WQv!F z2LF;LTU}!V?8W)9PX&Q4{MstKWFu0xJDtjt!Z>$TtL&L0cO&MK*ZjAd31&&`qlpv9H{vG`kM`&%gkPw9c6&{JEt#;3(N1187ij3Bv_y;q^*~TCwj_=+^i)bq7)Li} zz$y_8{_vdGT($&q=MqgJB3=%S^(wYd5rXKjLS@p@!z-Pv3Yjv8vAF@vwu`%CfM_lC;fMxo*#K~q2G8;|2v+g0^Yyp$=t4_ry&2D zC;c~`NYQpervJ8FLqQ~TW<#-`X>XE_^uG2omJDSYfoe7h71;&&J(H_9Y zsa z1o8ATeQs}m?M9%17O1MV9GhaGqpMbsy7a5&gi!)NUVH4r8Llh$&qn6xaheUN5qa(P zel4AnbonK6x{F}7+&AR5*{my~fgE?%;h+;+%Hk5{e2(ynbT+umemt3|=9&{h-%)H5 z+cfI3`V5(8Cj30zxDz3$C1wKcYm(Ls64~w`+13{eqY(;g*2Bum|T{D8b`!5_LD?n%lVp2derDVF)ohje8h0YPLMkD%x8r zPgTVN#Hn4{HU1&D8zSU|l}(7KC*b}H_IhAQ!?E{WF~`n#$eg)nJ1_(~?2&RS6$WG( zkiVxJEOAEE`sxj+R9Mp-h?xn_Y|L6a^YS`Tb#utTaE-z^+67K_s>5{iy_W-^Gu&_8 zbQa60i4>wvVnX3%w>^oct8N+gcWh+-?dbFW52_XIjy%Je+q&&CSpXgKXNZp~1dfh8HgtzU^2cdi)zTTtPz~w98X0*u z&0Fu|y(;EI(*lPp>PjqDN+66nv3|Z2FZY`q`gsr&?ad~WeG+Gk=AXxz)}3$L?S<6F z&6>2p=QBI2d^Fpdej~;U5mipy;D8_tpMKN6Y^G=&%<=3@RYQAj?T+s2^oqk-@#pNB zRhccGzM~=G+G(l$>F0YCX~(S-yZyAyb4$2=cT@2_jdNMQEsyVRT~}dm?A_5+n8olN z>c?J|Fer8nKdmyuL@LhL6te5IUS}0CsX_zn?j(!05voN;>B!*j&R+kAAn5h(k{^HjlUU3)%(iGB2%r|i&LxmD&tpyC1k0+ zQ((|(Mr|+|9Ck<7kxc6Qa~(?ay1kg}RPJ12f2W$l(HZL0U$q2u<8R$=)W;-@1$;*{8+bSv+nzjT51IT&Ax^o`97T^W)m(g6OWC{pqT1a4pBH)njKu zS_PPN^76~loEKAj4&9*34~S&|Ff%bFK72uVd{Ur1A!>YdTvCkOR}#2dvrw~e(z@_T o3w>fD*9EJl1q6j;_=iW04_dHr<)$^h8b9CARsKG6R!t56U*PxCyZ`_I diff --git a/src/main/webapp/css/main.css b/src/main/webapp/css/main.css deleted file mode 100644 index b5fa139..0000000 --- a/src/main/webapp/css/main.css +++ /dev/null @@ -1,185 +0,0 @@ -/* hides submitted-form-validation-portlet */ - -.portlet-icon-back { - display: none; -} -div#vloader { - width: 100%; - height: 100px; - background: url("loading_result.gif") no-repeat center top; -} - -div.submitted-form-validation-portlet { - display: none; -} - -.no-padding { - padding-left: 0 !important; -} - -.logo-circular{ - width: 32px; - height: 32px; - display: block; - border: 1px solid #AAA; - border-radius: 32px; - -webkit-border-radius: 16px; - -moz-border-radius: 16px; - background-position: 50% 50%; -} - -/* file upload css */ -.ajax-file-upload-error { - color: red; -} - -.ajax-file-upload-statusbar { - border: 1px solid #0ba1b5; - margin-top: 10px; - width: 420px; - margin-right: 10px; - margin: 5px; - -moz-border-radius: 4px; - -webkit-border-radius: 4px; - border-radius: 4px; - padding: 5px 5px 5px 15px -} - -.ajax-file-upload-filename { - width: 300px; - height: auto; - margin: 0 5px 5px 0px; -} - -.ajax-file-upload-filesize { - width: 50px; - height: auto; - margin: 0 5px 5px 0px; - display: inline-block; - vertical-align: middle; -} - -.ajax-file-upload-progress { - margin: 5px 10px 5px 0px; - position: relative; - width: 250px; - border: 1px solid #ddd; - padding: 1px; - border-radius: 3px; - display: inline-block; - color: #FFFFFF; -} - -.ajax-file-upload-bar { - background-color: #0ba1b5; - width: 0; - height: 20px; - border-radius: 3px; - color: #FFFFFF; -} - -.ajax-file-upload-percent { - position: absolute; - display: inline-block; - top: 3px; - left: 48% -} - -.ajax-file-upload-red { - -moz-box-shadow: inset 0 39px 0 -24px #e67a73; - -webkit-box-shadow: inset 0 39px 0 -24px #e67a73; - box-shadow: inset 0 39px 0 -24px #e67a73; - background-color: #e4685d; - -moz-border-radius: 4px; - -webkit-border-radius: 4px; - border-radius: 4px; - display: inline-block; - color: #fff; - font-family: arial; - font-size: 13px; - font-weight: normal; - padding: 4px 15px; - text-decoration: none; - text-shadow: 0 1px 0 #b23e35; - cursor: pointer; - vertical-align: top; - margin: 5px 10px 5px 0px; -} - -.ajax-file-upload-green { - background-color: #77b55a; - -moz-border-radius: 4px; - -webkit-border-radius: 4px; - border-radius: 4px; - margin: 0; - padding: 0; - display: inline-block; - color: #fff; - font-family: arial; - font-size: 13px; - font-weight: normal; - padding: 4px 15px; - text-decoration: none; - cursor: pointer; - text-shadow: 0 1px 0 #5b8a3c; - vertical-align: top; - margin: 5px 10px 5px 0px; -} - -.ajax-file-upload { - font-family: Arial, Helvetica, sans-serif; - font-size: 16px; - font-weight: bold; - padding: 15px 20px; - cursor: pointer; - line-height: 20px; - height: 25px; - margin: 0 10px 10px 0; - display: inline-block; - background: #fff; - border: 1px solid #e8e8e8; - color: #888; - text-decoration: none; - border-radius: 3px; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - -moz-box-shadow: 0 2px 0 0 #e8e8e8; - -webkit-box-shadow: 0 2px 0 0 #e8e8e8; - box-shadow: 0 2px 0 0 #e8e8e8; - padding: 6px 10px 4px 10px; - color: #fff; - background: #2f8ab9; - border: none; - -moz-box-shadow: 0 2px 0 0 #13648d; - -webkit-box-shadow: 0 2px 0 0 #13648d; - box-shadow: 0 2px 0 0 #13648d; - vertical-align: middle; -} - -.ajax-file-upload:hover { - background: #3396c9; - -moz-box-shadow: 0 2px 0 0 #15719f; - -webkit-box-shadow: 0 2px 0 0 #15719f; - box-shadow: 0 2px 0 0 #15719f; -} - -.ajax-upload-dragdrop { - background: url("up_img.png") no-repeat 50%; - border: 2px dotted #A5A5C7; - width: 90% !important; - height: 180px; - color: #DADCE3; - text-align: left; - vertical-align: middle; - padding: 10px 10px 0px 10px; -} - -.state-hover { - border: 2px solid #A5A5C7; -} - -.ajax-file-upload-container { - margin: -52px 0px 20px 10px; - width: 90%; - background-color: white; -} \ No newline at end of file diff --git a/src/main/webapp/css/table.css b/src/main/webapp/css/table.css deleted file mode 100644 index ceb91e5..0000000 --- a/src/main/webapp/css/table.css +++ /dev/null @@ -1,42 +0,0 @@ -table.paleBlueRows { - font-family: Tahoma, Geneva, sans-serif; - border: 1px solid #FFFFFF; - width: 100%; - text-align: left; - border-collapse: collapse; -} -table.paleBlueRows td, table.paleBlueRows th { - border: 1px solid #FFFFFF; - padding: 3px 5px; -} -table.paleBlueRows tbody td { - font-size: 13px; -} -table.paleBlueRows tr:nth-child(even) { - background: #D0E4F5; -} -table.paleBlueRows thead { - background: #0B6FA4; - border-bottom: 5px solid #FFFFFF; -} -table.paleBlueRows thead th { - font-size: 15px; - font-weight: bold; - color: #FFFFFF; - text-align: left; - border-left: 2px solid #FFFFFF; -} -table.paleBlueRows thead th:first-child { - border-left: none; -} - -table.paleBlueRows tfoot { - font-size: 14px; - font-weight: bold; - color: #333333; - background: #D0E4F5; - border-top: 3px solid #444444; -} -table.paleBlueRows tfoot td { - font-size: 14px; -} \ No newline at end of file diff --git a/src/main/webapp/css/up_img.png b/src/main/webapp/css/up_img.png deleted file mode 100644 index 64875a9be180f2093464f9eaaebf5cab90ba3774..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3364 zcmbVPcQhMr_fI0!Y`+nEg@~=FQB|!yOVu7hjjBQ0?~hk zmgZvrqTe&PU01VK-0tCFx;Q#;_yY;oy%|mm3V#8B; zgED#uq`)Jr{!>VLQ;2X;TBBZ;u~do4R7r3heaxK2q?Kfsu46wlQxaPEBO49LD8MaN zU%x4nUj;;oxl(OznqOE(ZCz*KzGEUeCWYXLU=<+FDr1BM`UZY(2T%lO3tC9?1GBmd zJ+liWf(l`VL_rZlnoo|r+8t#$7-`}<{(tylibmSU;KK+=&CO5y5udZI*LeiWg+{H? z-BmeG0oGuV%pcX_yiYcMCG3FF4r|kY6#UJ-4uxu=SOI{Q87KLd@yLr}6kVo+WfFG` zk6=k&EV;#vXYJ(j?AMwXm5*>E6CjRYg`Z^vYWVr(wG5^pDcOpFmg$-{`6jFg*G5a6 zy8)2VUL>+(kH1WOQg(k2@qlgxEEcWrR{qmWaeoBypia{Ipl%To;}Nv#&?kV7 zy6h;O@cYYAURGWBWf-s(pk}G@#`erh$19vE@$4!s33}j+ekO4;7FQg2xY8I9T~t+y z_234U`_&zVF8%^7FRy;pE^Z$PDcew_UoKs+gsF>R59igi-iWREgRZb&uGC4cO> zNk57dn3CtM^(pw>Du~0^ZNjfzmHJy&8Yr!hIeNq?+}8B`h32Gwp5&E!ja8J)%n13| z4$$O+vi)VI-|54S6h{L?TzOxeWp`v*k3_+n0%a%nwd6L^__FNpEw*%6v)3~qs*2f- zNT@t7o!dzDesJ|@#<=C8D)ade`+BP(QFl)XRgiVaNlrfaCVMUg@=kcYuAY|@eIutx zRk228FxD0l_@b<}xZ~wgpVgv-*^1r2TPsxUV}lX3YQz)s-Enui*3XvbZR55sHZ_}L zj9c;1qoFBf1i7=%xaU=D-Pkf)lRPDV1oa{`tGtKbj#J!5b%uSGe(^yC9%(9n3X#b? zye{f=Z%TML9M{{#qLl7BiIc4KN4DMuqe7+(pDVPag)(WqGyoQ$~{cO~F*od;0Sx%(Uq=M4PbzT;(ur64`G zR$i^fC?dZpf`O#C=}kb6Zf|kxeNaqyNfWHQtTU*&gP<+?<42l*N-m3eN9QD%+fq-rI z6t9NA(c{XYPmEAbra%L z_5+fiC~99l*e`w%4FA?NFXCMolGtn5*S)C1+9uc6n8<*RCnje77Ur!n%i_3qoBrJ( zL~u7g&gQXZyxE4ZACT6`yHl-J^+zUlV9a`B6Tjy;CH!Q!cu7bK0FQjwxp)$!kkrF;AxY^l{CvY&aw=X6{XMyLVWK{0^)b=w!zFYJ_$|50F){}V(v~vyIg_9LL zBaCww`GKa2ja}?2iYjSHDNjx#@w+l_(tp|is4r6Ozg-3ur$|sFAxptJ*g&8!v z7VqKV#3joizqR3iFX;$E&Rb)p&!y>4$t@y=+;mC!2rsr?I`l`gl`X9l${idx-Vt*%%VORY!keuaQNHKs1V0Sk zdWT2a1TpZ-EzJRSiZL4COJnr&t*_pg*QIx)O$Sh|op6$~tw(tOT*GZ`Y}^?WLdTdy z3u+Qr8&0%90DH^C7ZnwKOEz^DvboS(o$XCd%5?TBO@k?f> zV{eAK$>W7S4^t7yViwCZd!XGOofJSVZ4&`uY?58~tX4#cq<%3ZHYf7jvsBp^dgMc$ zK(jou(odJYa+^0h0>Ix`(xNURleVm%v~n9n=N;T7p%wd~>-fDsK>GJiq`a44Nm`=a z(D}qt73+XORN`f5hf5`ijz+smbM-lEWvaO|yE9K%*%C(GkSmOkkb zCwT99*PnY3N))l(%XTT+`5MVm8enCkEtSOeFdQd;$YvOoXvEy%vzPEtcS;NY=F2$s zzHJ>qc1Ox_%~-Ye7Gd^IBo3)s;W%;;O&wmHq7*{4H+nt9P#X5+D1-rPRR=KlH5t>m zLJ`xITaBJmF~?GvdEv1b1L6-6r|g0L@d$i0_#Ywz4DUWOv{#WCq3vT*e;EQ4D{M+w z#q(G&pw+4pxz;~Cij>Eg2@&kFRaLiVr%K_p=qXf^b>&xMO$oL8d@6Use#6R+MtJad zFW$=}Ux%98_ED z_2JasUD8ayTJ$$}F}N{#B)<6XrN_$XM=l=hrNo8BCTc_mg&E5qtM(wXEX>0|{x#rKrDTkaXumeI;q<_Zrt zJoA>7w%RX60x-T&)FUJfspHms^7lulh&!L5%Hq%S;}cNaoVO;mtk(11`4eNg{mjp4 zd(%YCT)w8sM%U+-_8rPdbKZSB{te&w&`*JS_|OR|7U_AdC3Qj`#!p)=O(m;%@+!v4 z%`z;nvdc;^(?AD<8OAsIjV_()h9WZ)2HYLz>N5j8w>$fiQ4W`?#du!DFzn5s_^QU; zBrYaH+Ic!9^II^lEe?KLw&gx2!NvDp@27S9sYkg`cg(3$g5i*o^ET^Fu1Vm}7m?c`jRG&y(E0rz42f->Hp%ekT~rig3~hY=}f z(I28VklfZBHNSw>%4<7zbQE3L?XAttUGMjXD3{>Y_vcCEw*b-LwE$u+JuahUyQ?7V zV-*cT7P`8E1%%5@JNF|m88BO!{qWj-iW#D;-pucf~{Grs$jFX_$@P|eM>=;KI z;+4akx4x=AjBb9tLPfX5n!|Uf3I;b=Qsh085=BARHEEw*)@)MTs zt#DIqw+fI$oZg3#vlcA-o0y+_6=VORFjo)<(~YFy9Ts$%WwSrjz?Z4i=hoq5I}-!^ z*zKQ442V=uA+ht393&H?6nDB_N=LI*&dVU?|7bMop%v4Ik=2ZteAqxKVsqFpfra`8 zXid|2Zs^GZ?e~IGZ{lMN`LnfdP`I#qODp(#_Unk76T>PTz(6G(fPD%??ac%5@aq4d j{#R1)e}usRO#sPTYL!QAbI)JU9Du&IkyfRKW9)wbBb`!n diff --git a/src/main/webapp/html/addnewcompany_or_assoc/AddNewCompany.jsp b/src/main/webapp/html/addnewcompany_or_assoc/AddNewCompany.jsp deleted file mode 100644 index c57ebe2..0000000 --- a/src/main/webapp/html/addnewcompany_or_assoc/AddNewCompany.jsp +++ /dev/null @@ -1,117 +0,0 @@ -<%@include file="../init.jsp"%> -<% - String portletURLString = PortalUtil.getCurrentURL(request); - RowChecker rowChecker = new RowChecker(renderResponse); - String currentUsername = Utils.getCurrentUser(request).getUsername(); - String vreName = (String) renderRequest.getAttribute("vreName"); - pageContext.setAttribute("vreName", vreName); - Group group = (Group) GroupLocalServiceUtil.getGroup(PortalUtil.getScopeGroupId(request)); - long currentGroupId = group.getGroupId(); - String currentURL = PortalUtil.getCurrentURL(request); - //this is the list to be working on manage - List availableTeams = (List) request.getAttribute("availableTeams"); -%> - - Back to manage companies - -

Available teams to promote as Company or Association in ${vreName }:

- - - - - -<% - String orderByCol = ParamUtil.getString(request, "orderByCol"); - String orderByType = ParamUtil.getString(request, "orderByType"); - String sortingOrder = orderByType; - - //Logic for toggle asc and desc - if (orderByType.equals("desc")) - orderByType = "asc"; - else - orderByType = "desc"; - if (Validator.isNull(orderByType)) { - orderByType = "asc"; - } -%> - - - - - - - <% - int totalteams = availableTeams.size(); - List sortableTeams = ListUtil.subList(availableTeams, searchContainer.getStart(), - searchContainer.getEnd()); - - if (Validator.isNotNull(orderByCol)) { - Collections.sort(sortableTeams, new TeamComparator()); - if (sortingOrder.equalsIgnoreCase("desc")) - Collections.reverse(sortableTeams); - } - pageContext.setAttribute("results", sortableTeams); - pageContext.setAttribute("total", totalteams); - %> - - - - ${item.teamName} - ${item.teamId} - ${item.description} - - - - - - - - - - - Liferay.provide( - window, - 'makeCompanies', - function() { - var selectedTeamIds = Liferay.Util.listCheckedExcept(document.fm, 'allRowIds'); - - if (selectedTeamIds && confirm("Are you sure to make the selected team a Company? Cannot be undone via GUI")) { - document.fm.selectedTeamIds.value = selectedTeamIds; - - submitForm(document.fm, ''); - } else { - - } - }, - ['liferay-util-list-fields'] - ); - Liferay.provide( - window, - 'makeAssociations', - function() { - var selectedTeamIds = Liferay.Util.listCheckedExcept(document.fm, 'allRowIds'); - - if (selectedTeamIds && confirm("Are you sure to make the selected team an Association? Cannot be undone via GUI")) { - document.fm.selectedTeamIds.value = selectedTeamIds; - - submitForm(document.fm, ''); - } else { - - } - }, - ['liferay-util-list-fields'] - ); - \ No newline at end of file diff --git a/src/main/webapp/html/adduserstocompany/add_users_toCompany.jsp b/src/main/webapp/html/adduserstocompany/add_users_toCompany.jsp deleted file mode 100644 index 0863c68..0000000 --- a/src/main/webapp/html/adduserstocompany/add_users_toCompany.jsp +++ /dev/null @@ -1,118 +0,0 @@ -<%@include file="../init.jsp"%> -<% - String portletURLString = PortalUtil.getCurrentURL(request); - RowChecker rowChecker = new RowChecker(renderResponse); - String currentUsername = Utils.getCurrentUser(request).getUsername(); - Team team = (Team) request.getAttribute("theTeam"); - Group group = (Group) GroupLocalServiceUtil.getGroup(PortalUtil.getScopeGroupId(request)); - long currentGroupId = group.getGroupId(); - String currentURL = PortalUtil.getCurrentURL(request); - List siteUsers = Utils.listVREUsersNotAssociatedToAnyCompany(team.getTeamId(), group.getGroupId()); - pageContext.setAttribute("logoURL", renderRequest.getAttribute("companyLogoURL")); - pageContext.setAttribute("companyName", team.getName()); -%> - - Back to manage company users - -
- - - - - - - - -
-
-

${companyName} -

-
-

Available users to associate to <%= team.getName() %>:

- - - - - -<% - String orderByCol = ParamUtil.getString(request, "orderByCol"); - String orderByType = ParamUtil.getString(request, "orderByType"); - String sortingOrder = orderByType; - - //Logic for toggle asc and desc - if (orderByType.equals("desc")) - orderByType = "asc"; - else - orderByType = "desc"; - if (Validator.isNull(orderByType)) { - orderByType = "asc"; - } -%> - - - - - - - <% - int totalUsers = siteUsers.size(); - List sortableUsers = ListUtil.subList(siteUsers, searchContainer.getStart(), - searchContainer.getEnd()); - - if (Validator.isNotNull(orderByCol)) { - Collections.sort(sortableUsers, new UserComparator()); - if (sortingOrder.equalsIgnoreCase("desc")) - Collections.reverse(sortableUsers); - } - pageContext.setAttribute("results", sortableUsers); - pageContext.setAttribute("total", totalUsers); - %> - - - - ${item.fullname} - ${item.email} - ${item.jobTitle} - - - - - - - - - - - - - Liferay.provide( - window, - 'associateCompanyUsers', - function() { - var addUserIds = Liferay.Util.listCheckedExcept(document.fm, 'allRowIds'); - - if (addUserIds && confirm("Are you sure you want to associate the selected users to this company?")) { - document.fm.addUserIds.value = addUserIds; - - submitForm(document.fm, ''); - } else { - - } - }, - ['liferay-util-list-fields'] - ); - \ No newline at end of file diff --git a/src/main/webapp/html/adduserstocompany/add_users_toFarm.jsp b/src/main/webapp/html/adduserstocompany/add_users_toFarm.jsp deleted file mode 100644 index 70590ff..0000000 --- a/src/main/webapp/html/adduserstocompany/add_users_toFarm.jsp +++ /dev/null @@ -1,119 +0,0 @@ -<%@include file="../init.jsp"%> -<% - String portletURLString = PortalUtil.getCurrentURL(request); - RowChecker rowChecker = new RowChecker(renderResponse); - String currentUsername = Utils.getCurrentUser(request).getUsername(); - Team team = (Team) request.getAttribute("theTeam"); - Group group = (Group) GroupLocalServiceUtil.getGroup(PortalUtil.getScopeGroupId(request)); - long currentGroupId = group.getGroupId(); - String currentURL = PortalUtil.getCurrentURL(request); - //this is the list to be working on manage - List nonFarmMembers = (List) request.getAttribute("nonFarmMembers"); - pageContext.setAttribute("logoURL", renderRequest.getAttribute("companyLogoURL")); - pageContext.setAttribute("farmName", team.getName()); -%> - - Back to manage farm users - -
- - - - - - - - -
-
-

${farmName} -

-
-

Available company users to associate to ${farmName}:

- - - - - -<% - String orderByCol = ParamUtil.getString(request, "orderByCol"); - String orderByType = ParamUtil.getString(request, "orderByType"); - String sortingOrder = orderByType; - - //Logic for toggle asc and desc - if (orderByType.equals("desc")) - orderByType = "asc"; - else - orderByType = "desc"; - if (Validator.isNull(orderByType)) { - orderByType = "asc"; - } -%> - - - - - - - <% - int totalUsers = nonFarmMembers.size(); - List sortableUsers = ListUtil.subList(nonFarmMembers, searchContainer.getStart(), - searchContainer.getEnd()); - - if (Validator.isNotNull(orderByCol)) { - Collections.sort(sortableUsers, new UserComparator()); - if (sortingOrder.equalsIgnoreCase("desc")) - Collections.reverse(sortableUsers); - } - pageContext.setAttribute("results", sortableUsers); - pageContext.setAttribute("total", totalUsers); - %> - - - - ${item.fullname} - ${item.email} - ${item.jobTitle} - - - - - - - - - - - - - Liferay.provide( - window, - 'associateFarmUsers', - function() { - var addUserIds = Liferay.Util.listCheckedExcept(document.fm, 'allRowIds'); - - if (addUserIds && confirm("Are you sure you want to associate the selected users to this farm?")) { - document.fm.addUserIds.value = addUserIds; - - submitForm(document.fm, ''); - } else { - - } - }, - ['liferay-util-list-fields'] - ); - \ No newline at end of file diff --git a/src/main/webapp/html/adduserstocompany/promote_company_administrators.jsp b/src/main/webapp/html/adduserstocompany/promote_company_administrators.jsp deleted file mode 100644 index 15e0f18..0000000 --- a/src/main/webapp/html/adduserstocompany/promote_company_administrators.jsp +++ /dev/null @@ -1,118 +0,0 @@ -<%@include file="../init.jsp"%> -<% - String portletURLString = PortalUtil.getCurrentURL(request); - RowChecker rowChecker = new RowChecker(renderResponse); - String currentUsername = Utils.getCurrentUser(request).getUsername(); - Team team = (Team) request.getAttribute("theTeam"); - Group group = (Group) GroupLocalServiceUtil.getGroup(PortalUtil.getScopeGroupId(request)); - long currentGroupId = group.getGroupId(); - String currentURL = PortalUtil.getCurrentURL(request); - //this is the list to be working on manage - List siteUsers = Utils.getRegularCompanyMembers(team.getTeamId(), team.getGroupId()); - pageContext.setAttribute("logoURL", renderRequest.getAttribute("companyLogoURL")); - pageContext.setAttribute("companyName", team.getName()); - %> - - - Back to manage company Administrators - -
- - - - - - - - -
-
-

${companyName} -

-
-

Users currently associated to <%= team.getName() %> that can be promoted as Administrators:

- - - - - -<% - String orderByCol = ParamUtil.getString(request, "orderByCol"); - String orderByType = ParamUtil.getString(request, "orderByType"); - String sortingOrder = orderByType; - - //Logic for toggle asc and desc - if (orderByType.equals("desc")) - orderByType = "asc"; - else - orderByType = "desc"; - if (Validator.isNull(orderByType)) { - orderByType = "asc"; - } -%> - - - - - - - <% - int totalUsers = siteUsers.size(); - List sortableUsers = ListUtil.subList(siteUsers, searchContainer.getStart(), - searchContainer.getEnd()); - - if (Validator.isNotNull(orderByCol)) { - Collections.sort(sortableUsers, new org.gcube.portlets.user.performfish.util.comparators.CompanyMemberComparator()); - if (sortingOrder.equalsIgnoreCase("desc")) - Collections.reverse(sortableUsers); - } - pageContext.setAttribute("results", sortableUsers); - pageContext.setAttribute("total", totalUsers); - %> - - - - ${item.fullname} - ${item.email} - ${item.jobTitle} - - - - - - - - - - - - Liferay.provide( - window, - 'promoteAdminUsers', - function() { - var addUserIds = Liferay.Util.listCheckedExcept(document.fm, 'allRowIds'); - if (addUserIds && confirm("Are you sure you want to promote Administrator to the selected user(s)?")) { - document.fm.addUserIds.value = addUserIds; - - submitForm(document.fm, ''); - } else { - - } - }, - ['liferay-util-list-fields'] - ); - \ No newline at end of file diff --git a/src/main/webapp/html/adduserstocompany/promote_farm_administrators.jsp b/src/main/webapp/html/adduserstocompany/promote_farm_administrators.jsp deleted file mode 100644 index a910862..0000000 --- a/src/main/webapp/html/adduserstocompany/promote_farm_administrators.jsp +++ /dev/null @@ -1,119 +0,0 @@ -<%@include file="../init.jsp"%> -<% - String portletURLString = PortalUtil.getCurrentURL(request); - RowChecker rowChecker = new RowChecker(renderResponse); - String currentUsername = Utils.getCurrentUser(request).getUsername(); - GCubeTeam theFarm = (GCubeTeam) request.getAttribute("theFarm"); - pageContext.setAttribute("theFarm", theFarm); - Group group = (Group) GroupLocalServiceUtil.getGroup(PortalUtil.getScopeGroupId(request)); - long currentGroupId = group.getGroupId(); - String currentURL = PortalUtil.getCurrentURL(request); - //this is the list to be working on manage - List siteUsers = Utils.getRegularFarmMembers(theFarm.getTeamId(), theFarm.getGroupId()); - pageContext.setAttribute("logoURL", renderRequest.getAttribute("companyLogoURL")); - pageContext.setAttribute("theFarmName", theFarm.getTeamName()); - %> - - - Back to manage Farm Administrators - -
- - - - - - - - -
-
-

${theFarmName} -

-
-

Users currently associated to ${theFarmName} that can be promoted as Administrators:

- - - - - -<% - String orderByCol = ParamUtil.getString(request, "orderByCol"); - String orderByType = ParamUtil.getString(request, "orderByType"); - String sortingOrder = orderByType; - - //Logic for toggle asc and desc - if (orderByType.equals("desc")) - orderByType = "asc"; - else - orderByType = "desc"; - if (Validator.isNull(orderByType)) { - orderByType = "asc"; - } -%> - - - - - - - <% - int totalUsers = siteUsers.size(); - List sortableUsers = ListUtil.subList(siteUsers, searchContainer.getStart(), - searchContainer.getEnd()); - - if (Validator.isNotNull(orderByCol)) { - Collections.sort(sortableUsers, new UserComparator()); - if (sortingOrder.equalsIgnoreCase("desc")) - Collections.reverse(sortableUsers); - } - pageContext.setAttribute("results", sortableUsers); - pageContext.setAttribute("total", totalUsers); - %> - - - - ${item.fullname} - ${item.email} - ${item.jobTitle} - - - - - - - - - - - - Liferay.provide( - window, - 'promoteAdminUsers', - function() { - var addUserIds = Liferay.Util.listCheckedExcept(document.fm, 'allRowIds'); - if (addUserIds && confirm("Are you sure you want to promote Administrator to the selected user(s)?")) { - document.fm.addUserIds.value = addUserIds; - - submitForm(document.fm, ''); - } else { - - } - }, - ['liferay-util-list-fields'] - ); - \ No newline at end of file diff --git a/src/main/webapp/html/associatecompaniestoassociation/companies_to_ass_view.jsp b/src/main/webapp/html/associatecompaniestoassociation/companies_to_ass_view.jsp deleted file mode 100644 index ca72a85..0000000 --- a/src/main/webapp/html/associatecompaniestoassociation/companies_to_ass_view.jsp +++ /dev/null @@ -1,106 +0,0 @@ -<%@include file="../init.jsp"%> -<% -Boolean operationFinished = (Boolean) request.getAttribute("operationFinished"); -if (!operationFinished) { - Team selectedAssociation = (Team) renderRequest.getAttribute("selectedAssociation"); - pageContext.setAttribute("selectedAssociation", selectedAssociation); - List companies = (List ) renderRequest.getAttribute("companies"); - pageContext.setAttribute("companies", companies); - String vreName = (String) renderRequest.getAttribute("vreName"); - pageContext.setAttribute("vreName", vreName); - RowChecker rowChecker = new RowChecker(renderResponse); - String portletURLString = PortalUtil.getCurrentURL(request); - String currentGroupId = PortalUtil.getScopeGroupId(request)+""; -%> - -

- Select the companies to associate to ${selectedAssociation.name} (${selectedAssociation.description}): -

- - - - - -<% - String orderByCol = ParamUtil.getString(request, "orderByCol"); - String orderByType = ParamUtil.getString(request, "orderByType"); - String sortingOrder = orderByType; - - //Logic for toggle asc and desc - if (orderByType.equals("desc")) - orderByType = "asc"; - else - orderByType = "desc"; - if (Validator.isNull(orderByType)) { - orderByType = "asc"; - } -%> - - - - - - - <% - int totalCompanies = companies.size(); - List sortableCompanies = ListUtil.subList(companies, searchContainer.getStart(), - searchContainer.getEnd()); - - if (Validator.isNotNull(orderByCol)) { - Collections.sort(sortableCompanies, new CompanyComparator()); - if (sortingOrder.equalsIgnoreCase("desc")) - Collections.reverse(sortableCompanies); - } - pageContext.setAttribute("results", sortableCompanies); - pageContext.setAttribute("total", totalCompanies); - %> - - - - ${item.name} - ${item.companyId} - - - - - - - - - - - - Liferay.provide( - window, - 'associateCompanies', - function() { - var associateCompanyIds = Liferay.Util.listCheckedExcept(document.fm, 'allRowIds'); - - if (associateCompanyIds && confirm("Are you sure you want to associate the selected company(ies) to ${selectedAssociation.name}?")) { - document.fm.associateCompanyIds.value = associateCompanyIds; - - submitForm(document.fm, ''); - } else { - - } - }, - ['liferay-util-list-fields'] - ); - -<% } //end if (operationOK != null && operationOK.compareTo("") != 0) { -else { -%> -<% if (operationFinished) { - out.println("Operation performed correctly."); -}%> -<% } %> \ No newline at end of file diff --git a/src/main/webapp/html/associationdashboard/association_dashboard.jsp b/src/main/webapp/html/associationdashboard/association_dashboard.jsp deleted file mode 100644 index 3759353..0000000 --- a/src/main/webapp/html/associationdashboard/association_dashboard.jsp +++ /dev/null @@ -1,62 +0,0 @@ -<%@include file="../init.jsp"%> -<% - GCubeTeam asso = (GCubeTeam) renderRequest.getAttribute("theAssociation"); - pageContext.setAttribute("theAssociation", asso); - String associationLogoURL = (String) renderRequest.getAttribute("associationLogoURL"); - pageContext.setAttribute("logoURL", associationLogoURL); - - LinkedHashMap> associationCompanies = (LinkedHashMap>) renderRequest - .getAttribute("associationCompanies"); - pageContext.setAttribute("associationCompanies", associationCompanies); -%> -
-
-
- - - -

${theAssociation.teamName}

-
-
-

${theAssociation.description}

-
-
-
- -
- - - - - - - -
${company.key.name}
-
- - - - - - - - - - - - - - - - - - -
Farm nameFarm locationLast form submitted
${farm.name}${farm.location}
-
-
-
-
\ No newline at end of file diff --git a/src/main/webapp/html/companyprivaterepository/company_private_repository.jsp b/src/main/webapp/html/companyprivaterepository/company_private_repository.jsp deleted file mode 100644 index 8b2b130..0000000 --- a/src/main/webapp/html/companyprivaterepository/company_private_repository.jsp +++ /dev/null @@ -1,125 +0,0 @@ -<%@include file="../init.jsp"%> - -<% - LinkedHashMap> companyFiles = (LinkedHashMap>) renderRequest - .getAttribute("companyPrivateFiles"); - pageContext.setAttribute("companyFiles", companyFiles); - pageContext.setAttribute("logoURL", renderRequest.getAttribute("companyLogoURL")); - String portletURLString = PortalUtil.getCurrentURL(request); - RowChecker rowChecker = new RowChecker(renderResponse); - String currentUsername = Utils.getCurrentUser(request).getUsername(); - GCubeTeam theCompany = (GCubeTeam) request.getAttribute("theCompany"); - pageContext.setAttribute("theCompanyName", theCompany.getTeamName()); - - Group group = (Group) GroupLocalServiceUtil.getGroup(PortalUtil.getScopeGroupId(request)); - long currentGroupId = group.getGroupId(); - String currentURL = PortalUtil.getCurrentURL(request); -%> - - - - -
- - - - - - - -
-
-

${theCompanyName} - Private Repository Content

-
-
- - - -

The - repository is empty at the moment.

-
- - -
- -

- Repository of - -

- - - - - - - - - - - - - - - - - <% - ExternalFile item = (ExternalFile) pageContext.getAttribute("file"); - String iconHTML = IconsManager.getMDIconTextualName(item.getName()).getHtml(); - String fullName = Utils.getUserByUsername(item.getLastUpdatedBy()).getFullname(); - String userProfileLink = Utils.getUserProfileLink(item.getLastUpdatedBy()); - Date lastUpdated = new Date(item.getLastModificationTime().getTimeInMillis()); - pageContext.setAttribute("lastUpdated", lastUpdated); - %> - - - - - - - - -
Sel.NameUploaded - byLast - Updated (UTC)
<%=iconHTML%>${file.name}<%=fullName%>
-
- -

The - repository of ${farm.key.name} is empty at the moment.

-
-
-
- - - - - - -
-
-
-
-
- - - diff --git a/src/main/webapp/html/companyprivaterepository/show_all_versions.jsp b/src/main/webapp/html/companyprivaterepository/show_all_versions.jsp deleted file mode 100644 index e521da1..0000000 --- a/src/main/webapp/html/companyprivaterepository/show_all_versions.jsp +++ /dev/null @@ -1,92 +0,0 @@ -<%@include file="../init.jsp"%> - -<% - String selectedItemId = (String) request.getAttribute("itemId"); - String selectedItemName = (String) request.getAttribute("itemName"); - pageContext.setAttribute("selectedItemName",selectedItemName); - pageContext.setAttribute("selectedItemId",selectedItemId); - Group group = (Group) GroupLocalServiceUtil.getGroup(PortalUtil.getScopeGroupId(request)); - long currentGroupId = group.getGroupId(); - String currentURL = PortalUtil.getCurrentURL(request); - pageContext.setAttribute("currentURL",currentURL); - List fileVersions = (List) renderRequest.getAttribute("versions"); - if (fileVersions != null) - Collections.reverse(fileVersions); - pageContext.setAttribute("fileVersions", fileVersions); - String portletURLString = PortalUtil.getCurrentURL(request); - RowChecker rowChecker = new RowChecker(renderResponse); - String currentUsername = Utils.getCurrentUser(request).getUsername(); - PortletURL portletURL = renderResponse.createRenderURL(); - String iconHTML = IconsManager.getMDIconTextualName(selectedItemName).getHtml(); -%> - Back to Private Repository Content -

Available versions for: ${selectedItemName}

- - - - - - - - - - - - <% - WorkspaceVersion version = (WorkspaceVersion) pageContext.getAttribute("file"); - Date created = new Date(version.getCreated().getTimeInMillis()); - pageContext.setAttribute("created", created); - String fullName = ""; - String userProfileLink = ""; - if (version.getUser() != null) { - fullName = Utils.getUserByUsername(version.getUser()).getFullname(); - userProfileLink = Utils.getUserProfileLink(version.getUser()); - } - pageContext.setAttribute("fullName", fullName); - pageContext.setAttribute("userProfileLink", userProfileLink); - %> - - - - - - - - - - - - -
- Version NumberCreated by - Created date (UTC)Current
<%=iconHTML%>${file.name}<%=fullName%>${file.currentVersion}
- - - - - - Liferay.provide( - window, - 'associateCompanyUsers', - function() { - var addUserIds = Liferay.Util.listCheckedExcept(document.fm, 'allRowIds'); - - if (addUserIds && confirm("Are you sure you want to associate the selected users to this company?")) { - document.fm.addUserIds.value = addUserIds; - - submitForm(document.fm, ''); - } else { - - } - }, - ['liferay-util-list-fields'] - ); - \ No newline at end of file diff --git a/src/main/webapp/html/editcompanyusers/edit_admin_users.jsp b/src/main/webapp/html/editcompanyusers/edit_admin_users.jsp deleted file mode 100644 index d18b574..0000000 --- a/src/main/webapp/html/editcompanyusers/edit_admin_users.jsp +++ /dev/null @@ -1,107 +0,0 @@ -<%@page import="org.apache.tika.sax.ToTextContentHandler"%> -<%@include file="../init.jsp"%> - -

Administrators currently associated to <%= team.getName() %>:

- - - - - -<% - String orderByCol = ParamUtil.getString(request, "orderByCol"); - String orderByType = ParamUtil.getString(request, "orderByType"); - String sortingOrder = orderByType; - - //Logic for toggle asc and desc - if (orderByType.equals("desc")) - orderByType = "asc"; - else - orderByType = "desc"; - if (Validator.isNull(orderByType)) { - orderByType = "asc"; - } -%> - - - - - - - <% - int totalUsers = admins.size(); - List sortableUsers = ListUtil.subList(admins, searchContainer.getStart(), - searchContainer.getEnd()); - - if (Validator.isNotNull(orderByCol)) { - Collections.sort(sortableUsers, new CompanyMemberComparator()); - if (sortingOrder.equalsIgnoreCase("desc")) - Collections.reverse(sortableUsers); - } - pageContext.setAttribute("results", sortableUsers); - pageContext.setAttribute("total", totalUsers); - %> - - - - ${item.fullname} - ${item.email} - ${item.jobTitle} - - - (Farm Administrator) - - ${item.associatedFarmNames} ${FarmAdministrator} - - - - - - - <% - final String hrefFix = "location.href='" + removeFarmUsersURL .toString()+"'"; - %> - - - - - - - - - - - - - - Liferay.provide( - window, - 'removeAdministratorRoleFromUsers', - function() { - var removeUserIds = Liferay.Util.listCheckedExcept(document.fm, 'allRowIds'); - var array = removeUserIds.split(','); - var totalUsers = document.getElementById('totalUsers'); - - if (array.length == totalUsers.value) { - alert("Forbidden: You are trying removing the role from all the users of the company, at least one must have it.") - return; - } - if (removeUserIds && confirm("Are you sure you want to remove the Administrator role from the selected users?")) { - document.fm.removeUserIds.value = removeUserIds; - - submitForm(document.fm, ''); - } else { - - } - }, - ['liferay-util-list-fields'] - ); - \ No newline at end of file diff --git a/src/main/webapp/html/editcompanyusers/edit_company_users.jsp b/src/main/webapp/html/editcompanyusers/edit_company_users.jsp deleted file mode 100644 index e20d51b..0000000 --- a/src/main/webapp/html/editcompanyusers/edit_company_users.jsp +++ /dev/null @@ -1,107 +0,0 @@ -<%@include file="../init.jsp"%> - -

- Users currently associated to - <%= team.getName() %>: -

- - - - - -<% - String orderByCol = ParamUtil.getString(request, "orderByCol"); - String orderByType = ParamUtil.getString(request, "orderByType"); - String sortingOrder = orderByType; - - //Logic for toggle asc and desc - if (orderByType.equals("desc")) - orderByType = "asc"; - else - orderByType = "desc"; - if (Validator.isNull(orderByType)) { - orderByType = "asc"; - } -%> - -<%=currentGroupId %> - - - - - - - <% - int totalUsers = teamUsers.size(); - List sortableUsers = ListUtil.subList(teamUsers, searchContainer.getStart(), - searchContainer.getEnd()); - - if (Validator.isNotNull(orderByCol)) { - Collections.sort(sortableUsers, new CompanyMemberComparator()); - if (sortingOrder.equalsIgnoreCase("desc")) - Collections.reverse(sortableUsers); - } - pageContext.setAttribute("results", sortableUsers); - pageContext.setAttribute("total", totalUsers); - %> - - - - ${item.fullname} - ${item.email} - - - (Farm Administrator) - - ${item.associatedFarmNames} ${FarmAdministrator} - - - - - - - <% - final String hrefFix = "location.href='" + removeFarmUsersURL .toString()+"'"; - %> - - - - - - - - - - - - - - Liferay.provide( - window, - 'removeCompanUsers', - function() { - var removeUserIds = Liferay.Util.listCheckedExcept(document.fm, 'allRowIds'); - - if (removeUserIds && confirm("Are you sure you want to remove the selected users from this company?")) { - document.fm.removeUserIds.value = removeUserIds; - - submitForm(document.fm, ''); - } else { - - } - }, - ['liferay-util-list-fields'] - ); - \ No newline at end of file diff --git a/src/main/webapp/html/editfarmusers/edit_farm_users.jsp b/src/main/webapp/html/editfarmusers/edit_farm_users.jsp deleted file mode 100644 index 2cfa4c4..0000000 --- a/src/main/webapp/html/editfarmusers/edit_farm_users.jsp +++ /dev/null @@ -1,85 +0,0 @@ -<%@include file="../init.jsp"%> - -

Users currently associated to <%= farm.getName() %>:

- - - - - -<% - String orderByCol = ParamUtil.getString(request, "orderByCol"); - String orderByType = ParamUtil.getString(request, "orderByType"); - String sortingOrder = orderByType; - - //Logic for toggle asc and desc - if (orderByType.equals("desc")) - orderByType = "asc"; - else - orderByType = "desc"; - if (Validator.isNull(orderByType)) { - orderByType = "asc"; - } -%> - - - - - - - <% - int totalUsers = teamUsers.size(); - List sortableUsers = ListUtil.subList(teamUsers, searchContainer.getStart(), - searchContainer.getEnd()); - - if (Validator.isNotNull(orderByCol)) { - Collections.sort(sortableUsers, new UserComparator()); - if (sortingOrder.equalsIgnoreCase("desc")) - Collections.reverse(sortableUsers); - } - pageContext.setAttribute("results", sortableUsers); - pageContext.setAttribute("total", totalUsers); - %> - - - - ${item.fullname} - ${item.email} - ${item.jobTitle} - - - - - - - - - - - - - Liferay.provide( - window, - 'removeFarmUsers', - function() { - var removeUserIds = Liferay.Util.listCheckedExcept(document.fm, 'allRowIds'); - - if (removeUserIds && confirm("Are you sure you want to remove the selected users from this Farm?")) { - document.fm.removeUserIds.value = removeUserIds; - - submitForm(document.fm, ''); - } else { - - } - }, - ['liferay-util-list-fields'] - ); - \ No newline at end of file diff --git a/src/main/webapp/html/editfarmusers/edit_farmadmin_users.jsp b/src/main/webapp/html/editfarmusers/edit_farmadmin_users.jsp deleted file mode 100644 index 7e1d2f8..0000000 --- a/src/main/webapp/html/editfarmusers/edit_farmadmin_users.jsp +++ /dev/null @@ -1,91 +0,0 @@ -<%@page import="org.apache.tika.sax.ToTextContentHandler"%> -<%@include file="../init.jsp"%> - -

Administrators currently associated to <%= theFarm.getName() %>:

- - - - - -<% - String orderByCol = ParamUtil.getString(request, "orderByCol"); - String orderByType = ParamUtil.getString(request, "orderByType"); - String sortingOrder = orderByType; - - //Logic for toggle asc and desc - if (orderByType.equals("desc")) - orderByType = "asc"; - else - orderByType = "desc"; - if (Validator.isNull(orderByType)) { - orderByType = "asc"; - } -%> - - - - - - - <% - int totalUsers = admins.size(); - List sortableUsers = ListUtil.subList(admins, searchContainer.getStart(), - searchContainer.getEnd()); - - if (Validator.isNotNull(orderByCol)) { - Collections.sort(sortableUsers, new UserComparator()); - if (sortingOrder.equalsIgnoreCase("desc")) - Collections.reverse(sortableUsers); - } - pageContext.setAttribute("results", sortableUsers); - pageContext.setAttribute("total", totalUsers); - %> - - - - ${item.fullname} - ${item.email} - ${item.jobTitle} - - - - - - - - - - - - - Liferay.provide( - window, - 'removeAdministratorRoleFromUsers', - function() { - var removeUserIds = Liferay.Util.listCheckedExcept(document.fm, 'allRowIds'); - var array = removeUserIds.split(','); - var totalUsers = document.getElementById('totalUsers'); - - if (array.length == totalUsers.value) { - alert("Forbidden: You are trying removing the role from all the users of the company, at least one must have it.") - return; - } - if (removeUserIds && confirm("Are you sure you want to remove the Administrator role from the selected users?")) { - document.fm.removeUserIds.value = removeUserIds; - - submitForm(document.fm, ''); - } else { - - } - }, - ['liferay-util-list-fields'] - ); - \ No newline at end of file diff --git a/src/main/webapp/html/emptyformsdocumentsdisplay/empty_forms_config.jsp b/src/main/webapp/html/emptyformsdocumentsdisplay/empty_forms_config.jsp deleted file mode 100644 index 7193f56..0000000 --- a/src/main/webapp/html/emptyformsdocumentsdisplay/empty_forms_config.jsp +++ /dev/null @@ -1,47 +0,0 @@ -<%@include file="../init.jsp"%> -<%@ page import="com.liferay.portal.kernel.util.Constants"%> -<%@ page import="org.gcube.portlets.user.performfish.EmptyFormsDocumentsDisplay"%> - - - -

Here you should enter the FolderId of the shared folder where the documents are located and whether it shows - Hatchery, Pre-ongrowing or Grow out documents.

-<% - String selectedPhase = GetterUtil.getString(portletPreferences.getValue(PFISHConstants.PHASE_PREFERENCE_ATTR_NAME, StringPool.BLANK)); - - String folderId = GetterUtil.getString(portletPreferences.getValue(EmptyFormsDocumentsDisplay.FOLDERID_PREFERENCE_ATTR_NAME, StringPool.BLANK)); - - pageContext.setAttribute("SHOW_HATCHERY", PFISHConstants.SHOW_HATCHERY); - pageContext.setAttribute("SHOW_PRE_ONGROWING", PFISHConstants.SHOW_PRE_ONGROWING); - pageContext.setAttribute("SHOW_GROW_OUT", PFISHConstants.SHOW_GROW_OUT); -%> - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/webapp/html/emptyformsdocumentsdisplay/empty_forms_fileupload_display.jsp b/src/main/webapp/html/emptyformsdocumentsdisplay/empty_forms_fileupload_display.jsp deleted file mode 100644 index 84b8394..0000000 --- a/src/main/webapp/html/emptyformsdocumentsdisplay/empty_forms_fileupload_display.jsp +++ /dev/null @@ -1,146 +0,0 @@ -<%@include file="../init.jsp"%> - -<% - List theSheets = (List) renderRequest.getAttribute("thefiles"); - List theSheetNames = (List) renderRequest.getAttribute("theSheetNames"); - pageContext.setAttribute("theSheetNames", theSheetNames); - pageContext.setAttribute("theSheets", theSheets); - List theInstructions = (List) renderRequest.getAttribute("theInstructions"); - pageContext.setAttribute("theInstructions", theInstructions); - String selectedPhase = GetterUtil.getString(portletPreferences.getValue(PFISHConstants.PHASE_PREFERENCE_ATTR_NAME, StringPool.BLANK)); - pageContext.setAttribute("selectedPhase", selectedPhase); - GCubeTeam theFarm = (GCubeTeam) request.getAttribute("theFarm"); - pageContext.setAttribute("theFarm", theFarm); -%> - -
-
-
-

Empty - forms (Click on the file names to download)

- - -

The - empty forms repository is empty at the moment. Please contact the - Managers

-
- - - - - - - - - <% - WorkspaceItem item = (WorkspaceItem) pageContext.getAttribute("file"); - String iconHTML = IconsManager.getMDIconTextualName(item.getName()).getHtml(); - %> - - - - - - -
<%=iconHTML%>${file.name}Download
-
-
-
-
-

Instructions:

- - -

There - are no instructions at the moment. Please contact the Managers

-
- - - - - - - - - <% - WorkspaceItem item = (WorkspaceItem) pageContext.getAttribute("file"); - String iconHTML = IconsManager.getMDIconTextualName(item.getName()).getHtml(); - %> - - - - - - -
<%=iconHTML%>${file.name}Download
-
-
-
-
-
- - - - -
Select file to attach
-
Note: - files having different name from the original will not be accepted for submission.
- - - -
-
-
\ No newline at end of file diff --git a/src/main/webapp/html/error_pages/NotACompanyAdmin.jsp b/src/main/webapp/html/error_pages/NotACompanyAdmin.jsp deleted file mode 100644 index fa9c957..0000000 --- a/src/main/webapp/html/error_pages/NotACompanyAdmin.jsp +++ /dev/null @@ -1,8 +0,0 @@ -<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> - - - -
-

You are not authorised

- It seems you don't have the permission to use this application. You must be an Administrator of this company to use this application. -
diff --git a/src/main/webapp/html/error_pages/NotAFarmAdmin.jsp b/src/main/webapp/html/error_pages/NotAFarmAdmin.jsp deleted file mode 100644 index 0fecb32..0000000 --- a/src/main/webapp/html/error_pages/NotAFarmAdmin.jsp +++ /dev/null @@ -1,8 +0,0 @@ -<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> - - - -
-

You are not authorised

- It seems you don't have the permission to use this application. You must be an Administrator of this farm to use this application. -
diff --git a/src/main/webapp/html/error_pages/NotBelongingToAnyAssociation.jsp b/src/main/webapp/html/error_pages/NotBelongingToAnyAssociation.jsp deleted file mode 100644 index 49ee11f..0000000 --- a/src/main/webapp/html/error_pages/NotBelongingToAnyAssociation.jsp +++ /dev/null @@ -1,8 +0,0 @@ -<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> - - - -
-

You are not authorised

- It seems you don't have the permission to use this application. You must belong to one association to use this application. -
diff --git a/src/main/webapp/html/error_pages/NotBelongingToAnyCompany.jsp b/src/main/webapp/html/error_pages/NotBelongingToAnyCompany.jsp deleted file mode 100644 index d243f8e..0000000 --- a/src/main/webapp/html/error_pages/NotBelongingToAnyCompany.jsp +++ /dev/null @@ -1,8 +0,0 @@ -<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> - - - -
-

You are not authorised

- It seems you don't have the permission to use this application. You must belong to one company to use this application. -
diff --git a/src/main/webapp/html/error_pages/NotBelongingToAnyFarm.jsp b/src/main/webapp/html/error_pages/NotBelongingToAnyFarm.jsp deleted file mode 100644 index 0e0516a..0000000 --- a/src/main/webapp/html/error_pages/NotBelongingToAnyFarm.jsp +++ /dev/null @@ -1,8 +0,0 @@ -<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> - - - -
-

You are not authorised

- It seems you don't have the permission to use this application. You are not associated to any farm of the company. -
diff --git a/src/main/webapp/html/error_pages/TooManyBelongingAssociation.jsp b/src/main/webapp/html/error_pages/TooManyBelongingAssociation.jsp deleted file mode 100644 index 1b9f32d..0000000 --- a/src/main/webapp/html/error_pages/TooManyBelongingAssociation.jsp +++ /dev/null @@ -1,9 +0,0 @@ -<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> - - - -
-

Please select the farm you wish to operate

- You are assigned to more than one company - Farm. You can work on one farm at a time. -
\ No newline at end of file diff --git a/src/main/webapp/html/error_pages/TooManyBelongingCompany.jsp b/src/main/webapp/html/error_pages/TooManyBelongingCompany.jsp deleted file mode 100644 index 422b30a..0000000 --- a/src/main/webapp/html/error_pages/TooManyBelongingCompany.jsp +++ /dev/null @@ -1,8 +0,0 @@ -<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> - - - -
-

There is an issue in your autorisations

- It seems you belong to more than one company. You must belong to one company only to use this application. -
diff --git a/src/main/webapp/html/error_pages/TooManyBelongingFarm.jsp b/src/main/webapp/html/error_pages/TooManyBelongingFarm.jsp deleted file mode 100644 index 1b9f32d..0000000 --- a/src/main/webapp/html/error_pages/TooManyBelongingFarm.jsp +++ /dev/null @@ -1,9 +0,0 @@ -<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> - - - -
-

Please select the farm you wish to operate

- You are assigned to more than one company - Farm. You can work on one farm at a time. -
\ No newline at end of file diff --git a/src/main/webapp/html/error_pages/farmname_exists_already.jsp b/src/main/webapp/html/error_pages/farmname_exists_already.jsp deleted file mode 100644 index 7da9e86..0000000 --- a/src/main/webapp/html/error_pages/farmname_exists_already.jsp +++ /dev/null @@ -1,29 +0,0 @@ -<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui"%> -<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui"%> -<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme"%> -<%@page import="com.liferay.portal.kernel.portlet.LiferayWindowState"%> -<%@page import="com.liferay.portal.kernel.servlet.SessionErrors"%> -<%@page import="com.liferay.portal.kernel.servlet.SessionMessages"%> -<%@page import="com.liferay.portal.model.User"%> -<%@page import="com.liferay.portal.kernel.util.WebKeys"%> - - - -<% -User currentUser = (User) request.getAttribute(WebKeys.USER); -%> - - - -

- We're sorry - <%=currentUser.getFirstName()%>. There was an error performing this operation. A Farm with the entered name may exists already, please choose antoher name or request support at https://support.d4science.org -

- - - Close -
-<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui"%> -<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui"%> -<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme"%> -<%@page import="com.liferay.portal.kernel.portlet.LiferayWindowState"%> -<%@page import="com.liferay.portal.kernel.servlet.SessionErrors"%> -<%@page import="com.liferay.portal.kernel.servlet.SessionMessages"%> -<%@page import="com.liferay.portal.model.User"%> -<%@page import="com.liferay.portal.kernel.util.WebKeys"%> - - - -<% -User currentUser = (User) request.getAttribute(WebKeys.USER); -%> - - - -

- We're sorry - <%=currentUser.getFirstName()%>. There was an error performing this operation. Try again, if the error occurs again please report this issue to https://support.d4science.org -

- - - Close -
-<%@include file="../init.jsp"%> - -<% - List theFarms = (List) request.getAttribute("theFarms"); - pageContext.setAttribute("theFarms", theFarms); -%> - -
- - - - - - - - - <% - GCubeTeam theFarm = (GCubeTeam) pageContext.getAttribute("farm"); - String encodedFarmId = Utils.maskId(theFarm.getTeamId()); - pageContext.setAttribute("encodedFarmId", encodedFarmId); - %> - - - - - - - - -
SelectFarm - NameCreation - Date (UTC)
${farm.teamName}
-
\ No newline at end of file diff --git a/src/main/webapp/html/farmrepository/config.jsp b/src/main/webapp/html/farmrepository/config.jsp deleted file mode 100644 index 6b55dac..0000000 --- a/src/main/webapp/html/farmrepository/config.jsp +++ /dev/null @@ -1,27 +0,0 @@ -<%@include file="../init.jsp"%> -<%@ page import="com.liferay.portal.kernel.util.Constants" %> - - - -

Here you can customise the documents (whether - Hatchery, Pre-ongrowing, Grow out or all three) this portlet will have - to show.

-<% - String selectedPhase = GetterUtil.getString(portletPreferences.getValue("phase", StringPool.BLANK)); - - pageContext.setAttribute("SHOW_ALL_PHASES", PFISHConstants.SHOW_ALL_PHASES); - pageContext.setAttribute("SHOW_HATCHERY", PFISHConstants.SHOW_HATCHERY); - pageContext.setAttribute("SHOW_PRE_ONGROWING", PFISHConstants.SHOW_PRE_ONGROWING); - pageContext.setAttribute("SHOW_GROW_OUT", PFISHConstants.SHOW_GROW_OUT); -%> - - - - - - - - - \ No newline at end of file diff --git a/src/main/webapp/html/farmrepository/show_all_versions.jsp b/src/main/webapp/html/farmrepository/show_all_versions.jsp deleted file mode 100644 index a84c309..0000000 --- a/src/main/webapp/html/farmrepository/show_all_versions.jsp +++ /dev/null @@ -1,89 +0,0 @@ -<%@include file="../init.jsp"%> - -<% - String selectedItemId = (String) request.getAttribute("itemId"); - String selectedItemName = (String) request.getAttribute("itemName"); - pageContext.setAttribute("selectedItemName",selectedItemName); - pageContext.setAttribute("selectedItemId",selectedItemId); - Group group = (Group) GroupLocalServiceUtil.getGroup(PortalUtil.getScopeGroupId(request)); - long currentGroupId = group.getGroupId(); - String currentURL = PortalUtil.getCurrentURL(request); - pageContext.setAttribute("currentURL",currentURL); - List fileVersions = (List) renderRequest.getAttribute("versions"); - if (fileVersions != null) - Collections.reverse(fileVersions); - pageContext.setAttribute("fileVersions", fileVersions); - String currentUsername = Utils.getCurrentUser(request).getUsername(); - String iconHTML = IconsManager.getMDIconTextualName(selectedItemName).getHtml(); -%> - Back to Private Repository Content -

Available versions for: ${selectedItemName}

- - - - - - - - - - - - <% - WorkspaceVersion version = (WorkspaceVersion) pageContext.getAttribute("file"); - Date created = new Date(version.getCreated().getTimeInMillis()); - pageContext.setAttribute("created", created); - String fullName = ""; - String userProfileLink = ""; - if (version.getUser() != null) { - fullName = Utils.getUserByUsername(version.getUser()).getFullname(); - userProfileLink = Utils.getUserProfileLink(version.getUser()); - } - pageContext.setAttribute("fullName", fullName); - pageContext.setAttribute("userProfileLink", userProfileLink); - %> - - - - - - - - - - - - -
- Version NumberCreated by - Created date (UTC)Current
<%=iconHTML%>${file.name}<%=fullName%>${file.currentVersion}
- - - - - - Liferay.provide( - window, - 'associateCompanyUsers', - function() { - var addUserIds = Liferay.Util.listCheckedExcept(document.fm, 'allRowIds'); - - if (addUserIds && confirm("Are you sure you want to associate the selected users to this company?")) { - document.fm.addUserIds.value = addUserIds; - - submitForm(document.fm, ''); - } else { - - } - }, - ['liferay-util-list-fields'] - ); - \ No newline at end of file diff --git a/src/main/webapp/html/farmrepository/view_farm_repository.jsp b/src/main/webapp/html/farmrepository/view_farm_repository.jsp deleted file mode 100644 index 4acba56..0000000 --- a/src/main/webapp/html/farmrepository/view_farm_repository.jsp +++ /dev/null @@ -1,232 +0,0 @@ -<%@include file="../init.jsp"%> - - -<% - List submittedFormsWithPublishStatus = (List) renderRequest.getAttribute("submittedFormsWithPublishStatus"); - pageContext.setAttribute("submittedFormsWithPublishStatus", submittedFormsWithPublishStatus); - pageContext.setAttribute("logoURL", renderRequest.getAttribute("companyLogoURL")); - String portletURLString = PortalUtil.getCurrentURL(request); - RowChecker rowChecker = new RowChecker(renderResponse); - String currentUsername = Utils.getCurrentUser(request).getUsername(); - GCubeTeam theCompany = (GCubeTeam) request.getAttribute("theCompany"); - pageContext.setAttribute("theCompanyName", theCompany.getTeamName()); - GCubeTeam theFarm = (GCubeTeam) request.getAttribute("theFarm"); - if (theFarm != null) { - pageContext.setAttribute("farmyName", theFarm.getTeamName()); - pageContext.setAttribute("farmId", theFarm.getTeamId()); - } - Group group = (Group) GroupLocalServiceUtil.getGroup(PortalUtil.getScopeGroupId(request)); - long currentGroupId = group.getGroupId(); - String currentURL = PortalUtil.getCurrentURL(request); - pageContext.setAttribute("AnalyticalToolkitPortletEndpoint", Utils.ANALYTICAL_TOOLKIT_PORTLET_ENDPOINT); - pageContext.setAttribute("farmIdParamEncoded", Utils.maskId("farmid")); - pageContext.setAttribute("batchTypeParamEncoded", Utils.maskId("batchtype")); -%> - - - - - - - -
- - - - - - - -
-
-

${theCompanyName} - ${farmyName} Private Repository Content

-
-
- - - -

The - repository is empty at the moment. You can submit files via the dedicated pages in the VRE (Hatchery, Pre-ongrowing and Grow out)

-
- -
- - - - - - - - - - - - - <% - SubmittedForm submittedForm = (SubmittedForm) pageContext.getAttribute("form"); - ExternalFile item = submittedForm.getFormFile(); - String iconHTML = IconsManager.getMDIconTextualName(item.getName()).getHtml(); - String fullName = Utils.getUserByUsername(item.getLastUpdatedBy()).getFullname(); - String userProfileLink = Utils.getUserProfileLink(item.getLastUpdatedBy()); - Date lastUpdated = new Date(item.getLastModificationTime().getTimeInMillis()); - pageContext.setAttribute("lastUpdated", lastUpdated); - String fullNamePublisher = SubmittedForm.NOT_YET_PUBLISHER; - String userProfileLinkPublisher = ""; - pageContext.setAttribute("rowBgColor", "#FFF"); - pageContext.setAttribute("buttonCheckProgressStyle", "display: none;"); - - pageContext.setAttribute("farmIdEncoded", Utils.maskId(theFarm.getTeamId())); - pageContext.setAttribute("batchTypeEncoded", Utils.maskId(submittedForm.getBatchType())); - if (submittedForm.getSubmitterIdentity() != null) { - fullNamePublisher = Utils.getUserByUsername(submittedForm.getSubmitterIdentity()).getFullname(); - pageContext.setAttribute("fullNamePublisher", fullNamePublisher); - userProfileLinkPublisher = Utils.getUserProfileLink(submittedForm.getSubmitterIdentity()); - if (submittedForm.getEndTimeinMillis() != PublishAnonymisedJob.EPOCH_TIME_JOB_NOTFINISHED*1000) { - Date jobEndTime = new Date(submittedForm.getEndTimeinMillis()); - pageContext.setAttribute("jobEndTime", jobEndTime); - } - else { - pageContext.setAttribute("jobEndTime", ""); - pageContext.setAttribute("fullNamePublisher", ""); - pageContext.setAttribute("rowBgColor", "rgb(228, 223, 0)"); - pageContext.setAttribute("buttonCheckProgressStyle", "display: visible;"); - } - } else { - pageContext.setAttribute("fullNamePublisher", ""); //reset the field - pageContext.setAttribute("jobEndTime", "");//reset the field - } - %> - - - - - - - - - - - - - - -
Sel.NameUploaded - by (UTC)Published by (UTC)Publishing Status
<%=iconHTML%>${form.formFile.name}
-
-
${form.status} - - - - - - -
- -
-
-
-
-
-
- - - - - - - - -
-
-
-
-
- - -
- - diff --git a/src/main/webapp/html/init.jsp b/src/main/webapp/html/init.jsp deleted file mode 100644 index 829655e..0000000 --- a/src/main/webapp/html/init.jsp +++ /dev/null @@ -1,76 +0,0 @@ -<%@page import="com.liferay.portal.model.Layout"%> -<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> -<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> - -<%@ taglib uri="http://alloy.liferay.com/tld/aui" prefix="aui" %> -<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %> -<%@ taglib uri="http://liferay.com/tld/security" prefix="liferay-security" %> -<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %> -<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %> -<%@ taglib uri="http://liferay.com/tld/util" prefix="liferay-util" %> - -<%@page import="com.liferay.util.portlet.PortletRequestUtil"%> -<%@page import="com.liferay.portal.kernel.servlet.SessionErrors"%> -<%@ page import="com.liferay.portal.util.PortalUtil" %> -<%@ page import="com.liferay.portal.kernel.util.StringUtil" %> -<%@ page import="com.liferay.portal.kernel.util.Validator"%> -<%@ page import="com.liferay.portal.kernel.util.StringPool" %> -<%@ page import="com.liferay.portal.kernel.util.HtmlUtil" %> -<%@ page import="com.liferay.portal.kernel.util.ParamUtil" %> -<%@ page import="com.liferay.portal.kernel.util.ListUtil" %> -<%@ page import="com.liferay.portal.kernel.util.Validator" %> -<%@ page import="com.liferay.portal.kernel.util.WebKeys" %> -<%@ page import="com.liferay.portal.kernel.bean.BeanParamUtil" %> -<%@ page import="com.liferay.portal.kernel.language.LanguageUtil"%> -<%@page import="com.liferay.portal.kernel.util.GetterUtil"%> -<%@ page import="com.liferay.portal.service.permission.PortalPermissionUtil" %> -<%@ page import="com.liferay.portal.service.permission.PortletPermissionUtil" %> -<%@ page import="com.liferay.portal.kernel.portlet.LiferayWindowState"%> -<%@ page import="com.liferay.portal.kernel.portlet.LiferayPortletMode"%> -<%@ page import="javax.portlet.PortletURL" %> -<%@ page import="java.util.List" %> -<%@ page import="java.net.URLEncoder" %> -<%@ page import="java.util.ArrayList" %> -<%@ page import="java.util.Map" %> -<%@ page import="java.util.LinkedHashMap" %> -<%@page import="com.liferay.portal.kernel.dao.search.RowChecker"%> -<%@ page import="java.util.Calendar" %> -<%@ page import="java.util.Collections" %> -<%@page import="java.util.Date"%> -<%@page import="java.util.Base64"%> -<%@ page import="java.text.SimpleDateFormat"%> -<%@ page import="java.text.DateFormat"%> -<%@page import="com.liferay.portal.kernel.workflow.WorkflowConstants"%> -<%@page import="com.liferay.portlet.journal.model.JournalArticle"%> -<%@page import="com.liferay.portlet.dynamicdatamapping.model.DDMTemplate"%> -<%@page import="com.liferay.portlet.dynamicdatamapping.model.DDMStructure"%> -<%@page import="com.liferay.portal.security.permission.ActionKeys"%> -<%@page import="javax.portlet.PortletSession"%> -<%@page import="org.gcube.vomanagement.usermanagement.model.GCubeUser"%> -<%@page import="org.gcube.vomanagement.usermanagement.model.GCubeTeam"%> -<%@page import="com.liferay.portal.model.Team"%> -<%@page import="com.liferay.portal.model.Group"%> -<%@page import="com.liferay.portal.service.UserLocalServiceUtil"%> -<%@page import="com.liferay.portal.service.GroupLocalServiceUtil"%> -<%@page import="org.gcube.portlets.user.performfish.util.comparators.*"%> -<%@page import="org.gcube.portlets.user.performfish.util.*"%> -<%@page import="org.gcube.portlets.user.performfish.util.db.DBUtil"%> -<%@page import="org.gcube.portlets.user.performfish.util.PFISHConstants"%> -<%@page import=" org.gcube.portlets.user.performfish.bean.*"%> -<%@page import="org.gcube.common.homelibrary.home.workspace.WorkspaceItem"%> -<%@page import="org.gcube.common.homelibary.model.versioning.WorkspaceVersion"%> -<%@page import="org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile"%> -<%@page import="org.gcube.portal.stohubicons.IconsManager"%> -<%@page import="org.gcube.common.storagehub.model.items.GenericFileItem"%> - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/webapp/html/manageassociations/edit_associations.jsp b/src/main/webapp/html/manageassociations/edit_associations.jsp deleted file mode 100644 index 72d1d1b..0000000 --- a/src/main/webapp/html/manageassociations/edit_associations.jsp +++ /dev/null @@ -1,81 +0,0 @@ -<%@include file="../init.jsp"%> - -

- Current associations in - <%=vreName%>: -

- - - - - -<% - String orderByCol = ParamUtil.getString(request, "orderByCol"); - String orderByType = ParamUtil.getString(request, "orderByType"); - String sortingOrder = orderByType; - - //Logic for toggle asc and desc - if (orderByType.equals("desc")) - orderByType = "asc"; - else - orderByType = "desc"; - if (Validator.isNull(orderByType)) { - orderByType = "asc"; - } -%> - - - - - - - <% - int totalAssociations = associations.size(); - List sortableAssociations = ListUtil.subList(associations, searchContainer.getStart(), - searchContainer.getEnd()); - - if (Validator.isNotNull(orderByCol)) { - Collections.sort(sortableAssociations, new AssociationComparator()); - if (sortingOrder.equalsIgnoreCase("desc")) - Collections.reverse(sortableAssociations); - } - pageContext.setAttribute("results", sortableAssociations); - pageContext.setAttribute("total", totalAssociations); - %> - - - - ${item.shortName} - ${item.associationId} - - - - - - - - - Liferay.provide( - window, - 'removeCompanies', - function() { - var removeCompanyIds = Liferay.Util.listCheckedExcept(document.fm, 'allRowIds'); - - if (removeCompanyIds && confirm("Are you sure you want to remove the selected company(ies)?" + - "This action will remove also all the Farms and the Members associated to the company")) { - document.fm.removeCompanyIds.value = removeCompanyIds; - - submitForm(document.fm, ''); - } else { - - } - }, - ['liferay-util-list-fields'] - ); - \ No newline at end of file diff --git a/src/main/webapp/html/manageassociations/manage_associations_view.jsp b/src/main/webapp/html/manageassociations/manage_associations_view.jsp deleted file mode 100644 index 74ffae0..0000000 --- a/src/main/webapp/html/manageassociations/manage_associations_view.jsp +++ /dev/null @@ -1,107 +0,0 @@ -<%@include file="../init.jsp"%> - -<% - LinkedHashMap> associationCompanies = (LinkedHashMap>) renderRequest - .getAttribute("associationCompanies"); - pageContext.setAttribute("associationCompanies", associationCompanies); - List associations = (List) renderRequest.getAttribute("associations"); - pageContext.setAttribute("associations", associations); - String vreName = (String) renderRequest.getAttribute("vreName"); - pageContext.setAttribute("vreName", vreName); - RowChecker rowChecker = new RowChecker(renderResponse); - String portletURLString = PortalUtil.getCurrentURL(request); - String currentGroupId = PortalUtil.getScopeGroupId(request) + ""; -%> - - - - - - - - - - - -
- -
- - - - - - - - - - -
Association:${association.key.shortName}(${association.key.associationId})
-
- - - - - - - - - - -
${company.name}(${company.companyId})
-
-
-
- -
-
- -  Back to Control Centre - - - <%@include file="/html/manageassociations/edit_associations.jsp"%> - -
- - diff --git a/src/main/webapp/html/managecompanies/edit_companies.jsp b/src/main/webapp/html/managecompanies/edit_companies.jsp deleted file mode 100644 index c5630d5..0000000 --- a/src/main/webapp/html/managecompanies/edit_companies.jsp +++ /dev/null @@ -1,86 +0,0 @@ -<%@include file="../init.jsp"%> - -

- Registered companies in - <%=vreName%>: -

- - - - - -<% - String orderByCol = ParamUtil.getString(request, "orderByCol"); - String orderByType = ParamUtil.getString(request, "orderByType"); - String sortingOrder = orderByType; - - //Logic for toggle asc and desc - if (orderByType.equals("desc")) - orderByType = "asc"; - else - orderByType = "desc"; - if (Validator.isNull(orderByType)) { - orderByType = "asc"; - } -%> - - - - - - - <% - int totalCompanies = companies.size(); - List sortableCompanies = ListUtil.subList(companies, searchContainer.getStart(), - searchContainer.getEnd()); - - if (Validator.isNotNull(orderByCol)) { - Collections.sort(sortableCompanies, new CompanyComparator()); - if (sortingOrder.equalsIgnoreCase("desc")) - Collections.reverse(sortableCompanies); - } - pageContext.setAttribute("results", sortableCompanies); - pageContext.setAttribute("total", totalCompanies); - %> - - - - ${item.name} - ${item.companyId} - - - - - - - - - - - Liferay.provide( - window, - 'removeCompanies', - function() { - var removeCompanyIds = Liferay.Util.listCheckedExcept(document.fm, 'allRowIds'); - - if (removeCompanyIds && confirm("Are you sure you want to remove the selected company(ies)?" + - "This action will remove also all the Farms and the Members associated to the company")) { - document.fm.removeCompanyIds.value = removeCompanyIds; - - submitForm(document.fm, ''); - } else { - - } - }, - ['liferay-util-list-fields'] - ); - \ No newline at end of file diff --git a/src/main/webapp/html/managecompanies/manage_companies.jsp b/src/main/webapp/html/managecompanies/manage_companies.jsp deleted file mode 100644 index 149c33f..0000000 --- a/src/main/webapp/html/managecompanies/manage_companies.jsp +++ /dev/null @@ -1,84 +0,0 @@ -<%@include file="../init.jsp"%> - -<% - List companies = (List ) renderRequest.getAttribute("companies"); - pageContext.setAttribute("companies", companies); - String vreName = (String) renderRequest.getAttribute("vreName"); - pageContext.setAttribute("vreName", vreName); - RowChecker rowChecker = new RowChecker(renderResponse); - String portletURLString = PortalUtil.getCurrentURL(request); - String currentGroupId = PortalUtil.getScopeGroupId(request)+""; -%> - - - - - - - - - - -
- - - - - - - - - - -
${company.name}(${company.companyId})
- -
-
- -  Back to Control Centre - - - <%@include file="/html/managecompanies/edit_companies.jsp"%> - -
- - diff --git a/src/main/webapp/html/managecompanyadmins/company_admins.jsp b/src/main/webapp/html/managecompanyadmins/company_admins.jsp deleted file mode 100644 index 1babb96..0000000 --- a/src/main/webapp/html/managecompanyadmins/company_admins.jsp +++ /dev/null @@ -1,78 +0,0 @@ -<%@include file="../init.jsp"%> - -<% - List admins = (List) renderRequest.getAttribute("companyAdmins"); - pageContext.setAttribute("adminMembers", admins); - pageContext.setAttribute("logoURL", renderRequest.getAttribute("companyLogoURL")); - - String portletURLString = PortalUtil.getCurrentURL(request); - RowChecker rowChecker = new RowChecker(renderResponse); - String currentUsername = Utils.getCurrentUser(request).getUsername(); - Team team = (Team) request.getAttribute("theTeam"); - pageContext.setAttribute("companyName", team.getName()); - Group group = (Group) GroupLocalServiceUtil.getGroup(PortalUtil.getScopeGroupId(request)); - long currentGroupId = group.getGroupId(); - pageContext.setAttribute("currentGroupId", currentGroupId); - String currentURL = PortalUtil.getCurrentURL(request); -%> - - - - - -
- - - - - - - - -
-
-

${companyName} - Administrators

-
- - -
- - - - - - <% - CompanyMember theUser = (CompanyMember) pageContext.getAttribute("member"); - String userProfileLink = Utils.getUserProfileLink(theUser.getUsername()); - %> - - - - - -
${member.fullname}
- - - -  Back to Dashboard - -  Promote New Administrators - - <%@include file="/html/editcompanyusers/edit_admin_users.jsp"%> - - - - diff --git a/src/main/webapp/html/managecompanyusers/company_users.jsp b/src/main/webapp/html/managecompanyusers/company_users.jsp deleted file mode 100644 index ebc69ed..0000000 --- a/src/main/webapp/html/managecompanyusers/company_users.jsp +++ /dev/null @@ -1,78 +0,0 @@ -<%@include file="../init.jsp"%> - -<% - List members = (List) renderRequest.getAttribute("companyMembers"); - pageContext.setAttribute("companyMembers", members); - pageContext.setAttribute("logoURL", renderRequest.getAttribute("companyLogoURL")); - String portletURLString = PortalUtil.getCurrentURL(request); - RowChecker rowChecker = new RowChecker(renderResponse); - String currentUsername = Utils.getCurrentUser(request).getUsername(); - Team team = (Team) request.getAttribute("theTeam"); - pageContext.setAttribute("companyName", team.getName()); - Group group = (Group) GroupLocalServiceUtil.getGroup(PortalUtil.getScopeGroupId(request)); - long currentGroupId = group.getGroupId(); - String currentURL = PortalUtil.getCurrentURL(request); - //this is the list to be working on manage - List teamUsers = members; -%> - - - - - -
- - - - - - - -
-
-

${companyName} - Users

-
- - -
- - - - <% - CompanyMember theUser = (CompanyMember) pageContext.getAttribute("member"); - String userProfileLink = Utils.getUserProfileLink(theUser.getUsername()); - %> - - - - - - -
${member.fullname}
- -
-
- -  Back to Dashboard -  Associate new users to the - Company - - <%@include file="/html/editcompanyusers/edit_company_users.jsp"%> - -
- - diff --git a/src/main/webapp/html/managefarmadministratos/farm_admins.jsp b/src/main/webapp/html/managefarmadministratos/farm_admins.jsp deleted file mode 100644 index 3e5398f..0000000 --- a/src/main/webapp/html/managefarmadministratos/farm_admins.jsp +++ /dev/null @@ -1,95 +0,0 @@ -<%@include file="../init.jsp"%> - -<% - Boolean isCompanyAdministrator = false; - isCompanyAdministrator = (Boolean) renderRequest.getAttribute("isCompanyAdministrator"); - pageContext.setAttribute("isCompanyAdministrator", isCompanyAdministrator); - List admins = (List) renderRequest.getAttribute("farmAdmins"); - pageContext.setAttribute("adminMembers", admins); - pageContext.setAttribute("logoURL", renderRequest.getAttribute("companyLogoURL")); - - String portletURLString = PortalUtil.getCurrentURL(request); - RowChecker rowChecker = new RowChecker(renderResponse); - String currentUsername = Utils.getCurrentUser(request).getUsername(); - GCubeTeam theCompany = (GCubeTeam) request.getAttribute("theCompany"); - pageContext.setAttribute("theCompanyName", theCompany.getTeamName()); - - Team theFarm = (Team) request.getAttribute("theFarm"); - pageContext.setAttribute("farmName", theFarm.getName()); - pageContext.setAttribute("theFarmId", theFarm.getTeamId()); - - long currentGroupId = PortalUtil.getScopeGroupId(request); - String currentURL = PortalUtil.getCurrentURL(request); -%> - - - - - -
- - - - - - - - -
-
-

${theCompanyName} - ${farmName} - Administrators

-
- - -
- - - - - - <% - GCubeUser theUser = (GCubeUser) pageContext.getAttribute("member"); - String userProfileLink = Utils.getUserProfileLink(theUser.getUsername()); - %> - - - - - - -
${member.fullname}
- - - -  Back to Dashboard - <% - String encodedFarmId = Utils.maskId(theFarm.getTeamId()); - pageContext.setAttribute("encodedFarmId", encodedFarmId);%> -  Promote New Farm Administrators - - <%@include file="/html/editfarmusers/edit_farmadmin_users.jsp"%> - - - - diff --git a/src/main/webapp/html/managefarms/managefarms_view.jsp b/src/main/webapp/html/managefarms/managefarms_view.jsp deleted file mode 100644 index 957611f..0000000 --- a/src/main/webapp/html/managefarms/managefarms_view.jsp +++ /dev/null @@ -1,226 +0,0 @@ -<%@include file="../init.jsp"%> - -<% - List farms = (List) renderRequest.getAttribute("farms"); - pageContext.setAttribute("farms", farms); - GCubeTeam theCompany = (GCubeTeam) renderRequest.getAttribute("company"); - pageContext.setAttribute("theCompany", theCompany); - RowChecker rowChecker = new RowChecker(renderResponse); - String portletURLString = PortalUtil.getCurrentURL(request); - String currentGroupId = PortalUtil.getScopeGroupId(request) + ""; - String fullName = PortalUtil.getUser(request).getFullName(); - pageContext.setAttribute("theCreator", fullName); -%> - - - - - - - - - - - - - - -Liferay.provide( - window, - 'closePopup', - function(dialogId) { - var dialog = Liferay.Util.getWindow(dialogId); - Liferay.fire('closeWindow', { - id:'dialog' - }); - var theURLToLoad = window.location.protocol + "//" + window.location.host + "/" + window.location.pathname; - window.location.href = theURLToLoad; - },['aui-base','liferay-util-window'] -); - -
- - - - - - - - - - - - - <% - Farm theFarm = (Farm) pageContext.getAttribute("farm"); - if (theFarm.getAdministrators() == null || theFarm.getAdministrators().isEmpty()) - pageContext.setAttribute("admins", "Missing! Assign one"); - else { - String adminsToString = ""; - int i = 1; - for (GCubeUser admin : theFarm.getAdministrators()) { - adminsToString += admin.getFullname(); - if (i < theFarm.getAdministrators().size()) - adminsToString += ", "; - i++; - } - pageContext.setAttribute("admins", adminsToString); - } - %> - - - - - - - - - - - -
Sel.NameLocation - Created - by Created (UTC)Administrator(s)
${farm.name}${farm.location}${farm.creatorFullname}${admins}
-
- - - -<%-- --%> -<%-- --%> -<%-- --%> -<%-- --%> - - - -
- - - -
- - - diff --git a/src/main/webapp/html/managefarmusers/manage_farm_users_view.jsp b/src/main/webapp/html/managefarmusers/manage_farm_users_view.jsp deleted file mode 100644 index 6ec7abb..0000000 --- a/src/main/webapp/html/managefarmusers/manage_farm_users_view.jsp +++ /dev/null @@ -1,81 +0,0 @@ -<%@include file="../init.jsp"%> - -<% - List members = (List) renderRequest.getAttribute("farmMembers"); - pageContext.setAttribute("farmMembers", members); - pageContext.setAttribute("logoURL", renderRequest.getAttribute("companyLogoURL")); - String portletURLString = PortalUtil.getCurrentURL(request); - RowChecker rowChecker = new RowChecker(renderResponse); - String currentUsername = Utils.getCurrentUser(request).getUsername(); - Team farm = (Team) request.getAttribute("theFarm"); - pageContext.setAttribute("farmName", farm.getName()); - pageContext.setAttribute("theFarmId", farm.getTeamId()); - GCubeTeam theCompany = (GCubeTeam) request.getAttribute("theCompany"); - pageContext.setAttribute("theCompanyName", theCompany.getTeamName()); - - long currentGroupId = PortalUtil.getScopeGroupId(request); - String currentURL = PortalUtil.getCurrentURL(request); - //this is the list to be working on manage - List teamUsers = members; -%> - - - - - -
- - - - - - - -
-
-

${theCompanyName} - ${farmName} Users

-
- - -
- - - - <% - GCubeUser theUser = (GCubeUser) pageContext.getAttribute("member"); - String userProfileLink = Utils.getUserProfileLink(theUser.getUsername()); - %> - - - - - - -
${member.fullname}
- -
-
- -  Back to Dashboard - <% - String encodedFarmId = Utils.maskId(farm.getTeamId()); - pageContext.setAttribute("encodedFarmId", encodedFarmId);%> -  Associate new users to the - Farm - - <%@include file="/html/editfarmusers/edit_farm_users.jsp"%> - -
- - diff --git a/src/main/webapp/html/setcompanyadministratorssuperuser/set_company_admin.jsp b/src/main/webapp/html/setcompanyadministratorssuperuser/set_company_admin.jsp deleted file mode 100644 index 6830ccd..0000000 --- a/src/main/webapp/html/setcompanyadministratorssuperuser/set_company_admin.jsp +++ /dev/null @@ -1,136 +0,0 @@ -<%@include file="../init.jsp"%> -<% - Boolean operationFinished = (Boolean) request.getAttribute("operationFinished"); - // - -if (!operationFinished) { - - String portletURLString = PortalUtil.getCurrentURL(request); - RowChecker rowChecker = new RowChecker(renderResponse); - String currentUsername = Utils.getCurrentUser(request).getUsername(); - Team team = (Team) request.getAttribute("theTeam"); - Group group = (Group) GroupLocalServiceUtil.getGroup(PortalUtil.getScopeGroupId(request)); - long currentGroupId = group.getGroupId(); - String currentURL = PortalUtil.getCurrentURL(request); - //this is the list to be working on manage - List siteUsers = (List) request.getAttribute("availableUsers"); - pageContext.setAttribute("logoURL", renderRequest.getAttribute("companyLogoURL")); - pageContext.setAttribute("companyName", team.getName()); -%> - - -
- - - - - - - - -
-
-

${companyName} -

-
-

- Users currently associated to - <%=group.getName()%> - that can be set as Company Administrators (They do not belong to any - other company yet): -

- - - - - -<% - String orderByCol = ParamUtil.getString(request, "orderByCol"); - String orderByType = ParamUtil.getString(request, "orderByType"); - String sortingOrder = orderByType; - - //Logic for toggle asc and desc - if (orderByType.equals("desc")) - orderByType = "asc"; - else - orderByType = "desc"; - if (Validator.isNull(orderByType)) { - orderByType = "asc"; - } -%> - - - - - - - <% - int totalUsers = siteUsers.size(); - List sortableUsers = ListUtil.subList(siteUsers, searchContainer.getStart(), - searchContainer.getEnd()); - - if (Validator.isNotNull(orderByCol)) { - Collections.sort(sortableUsers, new org.gcube.portlets.user.performfish.util.comparators.UserComparator()); - if (sortingOrder.equalsIgnoreCase("desc")) - Collections.reverse(sortableUsers); - } - pageContext.setAttribute("results", sortableUsers); - pageContext.setAttribute("total", totalUsers); - %> - - - - ${item.fullname} - ${item.email} - ${item.jobTitle} - - - - - - - - - - - - - Liferay.provide( - window, - 'promoteAdminUsers', - function() { - var addUserIds = Liferay.Util.listCheckedExcept(document.fm, 'allRowIds'); - if (addUserIds && confirm("Are you sure you want to promote ${companyName} Administrator the selected user(s)?")) { - document.fm.addUserIds.value = addUserIds; - - submitForm(document.fm, ''); - } else { - - } - }, - ['liferay-util-list-fields'] - ); - -<% } //enf if (operationOK != null && operationOK.compareTo("") != 0) { -else { -%> -<% if (operationFinished) { - out.println("Company admin(s) set correctly."); -}%> -<% } %> \ No newline at end of file diff --git a/src/main/webapp/html/setfarmadministrators/set_farm_admin.jsp b/src/main/webapp/html/setfarmadministrators/set_farm_admin.jsp deleted file mode 100644 index 122829f..0000000 --- a/src/main/webapp/html/setfarmadministrators/set_farm_admin.jsp +++ /dev/null @@ -1,142 +0,0 @@ -<%@include file="../init.jsp"%> -<%@page import="com.liferay.portal.kernel.portlet.LiferayWindowState"%> -<% - Boolean operationFinished = (Boolean) request.getAttribute("operationFinished"); - // - -if (!operationFinished) { - - String portletURLString = PortalUtil.getCurrentURL(request); - RowChecker rowChecker = new RowChecker(renderResponse); - String currentUsername = Utils.getCurrentUser(request).getUsername(); - Team theCompany = (Team) request.getAttribute("theCompany"); - Team theFarm = (Team) request.getAttribute("theFarm"); - Group group = (Group) GroupLocalServiceUtil.getGroup(PortalUtil.getScopeGroupId(request)); - long currentGroupId = group.getGroupId(); - String currentURL = PortalUtil.getCurrentURL(request); - //this is the list to be working on manage - List siteUsers = (List) request.getAttribute("availableUsers"); - pageContext.setAttribute("logoURL", renderRequest.getAttribute("companyLogoURL")); - pageContext.setAttribute("companyName", theCompany.getName()); - pageContext.setAttribute("farmName", theFarm.getName()); -%> - - -
- - - - - - - - -
-
-

${companyName} -

-
-

List of ${companyName} users not associated already to ${farmName}

- - - - - -<% - String orderByCol = ParamUtil.getString(request, "orderByCol"); - String orderByType = ParamUtil.getString(request, "orderByType"); - String sortingOrder = orderByType; - - //Logic for toggle asc and desc - if (orderByType.equals("desc")) - orderByType = "asc"; - else - orderByType = "desc"; - if (Validator.isNull(orderByType)) { - orderByType = "asc"; - } -%> - - - - - <% - int totalUsers = siteUsers.size(); - List sortableUsers = ListUtil.subList(siteUsers, searchContainer.getStart(), - searchContainer.getEnd()); - - if (Validator.isNotNull(orderByCol)) { - Collections.sort(sortableUsers, new UserComparator()); - if (sortingOrder.equalsIgnoreCase("desc")) - Collections.reverse(sortableUsers); - } - pageContext.setAttribute("results", sortableUsers); - pageContext.setAttribute("total", totalUsers); - %> - - - - ${item.fullname} - ${item.email} - ${item.jobTitle} - - - - -
-

Please note, Farm Administrator role is company global:

- The Farm Administrator role applies to all the farms a user is assigned to. -
- - - - - - -
- - - Liferay.provide( - window, - 'promoteAdminUsers', - function() { - var addUserIds = Liferay.Util.listCheckedExcept(document.fm, 'allRowIds'); - if (addUserIds && confirm("Are you sure you want to promote ${farmName} Administrator the selected user(s)?")) { - document.fm.addUserIds.value = addUserIds; - - submitForm(document.fm, ''); - } else { - - } - }, - ['liferay-util-list-fields'] - ); - -<% } //enf if (operationOK != null && operationOK.compareTo("") != 0) { -else { -%> -<% if (operationFinished) { %> -

Farm admin(s) set correctly

- - - - - A.one('#closeDialog').on('click', function(event) { - Liferay.Util.getOpener().closePopup('dialog'); - }); - -<%}%> -<% } %> \ No newline at end of file diff --git a/src/main/webapp/html/submittedformvalidation/validation.jsp b/src/main/webapp/html/submittedformvalidation/validation.jsp deleted file mode 100644 index 97de961..0000000 --- a/src/main/webapp/html/submittedformvalidation/validation.jsp +++ /dev/null @@ -1,39 +0,0 @@ -<%@include file="../init.jsp"%> -<% - -Team theCompany = (Team) request.getAttribute("theCompany"); -pageContext.setAttribute("companyId", theCompany.getTeamId()); -GCubeTeam theFarm = (GCubeTeam) request.getAttribute("theFarm"); -pageContext.setAttribute("farmId", theFarm.getTeamId()); - -%> - - - - - -
-
-

- Submitted form validation () in progress, please wait few - seconds ... -

-
-
-
- \ No newline at end of file diff --git a/src/main/webapp/icon.png b/src/main/webapp/icon.png deleted file mode 100644 index 807b862cfc087b70dcdd971af3ac92688484e998..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 467 zcmV;^0WAKBP)4nWfMy23V#h*$3p-!?D%AI~T5+JJ;5Qi)|`;Y?)XOj2U`VS70o zp1%L~Y4f1;U-b7MEOk38OU$EtImvzCpiEkKCg)@3^{;h@nc_6NuOBn7?ZF9Ev4w3+ zWiSxI_v2&k@_b{1R8kdeGLx;rFK&F@c}mqZ4YwJO$7q^VC6&nL^Y#-6g9F*zM-oa= z70W0^1X#=%!t{DQE-wCJ^Pd1r08&yFDUlL$EtoM3e+;?Hv-Nc(QI%=il9}v$`OS^N z)(TbAG~DLw><`m+N>!Xf5_@kR0j83~eKLh5sv-%=fC#``TU}jaG#UW`VS>Ph2!jLJ zROR&N$x3B;J002ov JPDHLkV1im=zq)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;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 b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.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(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.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?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},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||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.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||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},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:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.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 f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.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?b.extend(e,r):r}},i={};return r.pipe=r.then,b.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=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.createElement("div");if(d.setAttribute("className","t"),d.innerHTML="
a",n=d.getElementsByTagName("*"),r=d.getElementsByTagName("a")[0],!n||!r||!n.length)return{};s=o.createElement("select"),l=s.appendChild(o.createElement("option")),a=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==d.className,leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:"/a"===r.getAttribute("href"),opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!a.value,optSelected:l.selected,enctype:!!o.createElement("form").enctype,html5Clone:"<:nav>"!==o.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===o.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}a=o.createElement("input"),a.setAttribute("value",""),t.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),t.radioValue="t"===a.value,a.setAttribute("checked","t"),a.setAttribute("name","t"),u=o.createDocumentFragment(),u.appendChild(a),t.appendChecked=a.checked,t.checkClone=u.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;return d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip,b(function(){var n,r,a,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(d),d.innerHTML="
t
",a=d.getElementsByTagName("td"),a[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===a[0].offsetHeight,a[0].style.display="",a[1].style.display="none",t.reliableHiddenOffsets=p&&0===a[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=4===d.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==u.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(o.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="
",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(u.style.zoom=1)),u.removeChild(n),n=d=a=r=null)}),n=s=u=l=r=a=null,t}();var O=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,B=/([A-Z])/g;function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==typeof n,l=e.nodeType,p=l?b.cache:e,f=l?e[s]:e[s]&&s;if(f&&p[f]&&(i||p[f].data)||!u||r!==t)return f||(l?e[s]=f=c.pop()||b.guid++:f=s),p[f]||(p[f]={},l||(p[f].toJSON=b.noop)),("object"==typeof n||"function"==typeof n)&&(i?p[f]=b.extend(p[f],n):p[f].data=b.extend(p[f].data,n)),o=p[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[b.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[b.camelCase(n)])):a=o,a}}function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache:e,u=a?e[b.expando]:b.expando;if(s[u]){if(t&&(o=n?s[u]:s[u].data)){b.isArray(t)?t=t.concat(b.map(t,b.camelCase)):t in o?t=[t]:(t=b.camelCase(t),t=t in o?[t]:t.split(" "));for(r=0,i=t.length;i>r;r++)delete o[t[r]];if(!(n?$:b.isEmptyObject)(o))return}(n||(delete s[u].data,$(s[u])))&&(a?b.cleanData([e],!0):b.support.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}b.extend({cache:{},expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?b.cache[e[b.expando]]:e[b.expando],!!e&&!$(e)},data:function(e,t,n){return P(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return P(e,t,n,!0)},_removeData:function(e,t){return R(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&b.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],a=0,s=null;if(e===t){if(this.length&&(s=b.data(o),1===o.nodeType&&!b._data(o,"parsedAttrs"))){for(r=o.attributes;r.length>a;a++)i=r[a].name,i.indexOf("data-")||(i=b.camelCase(i.slice(5)),W(o,i,s[i]));b._data(o,"parsedAttrs",!0)}return s}return"object"==typeof e?this.each(function(){b.data(this,e)}):b.access(this,function(n){return n===t?o?W(o,e,b.data(o,e)):null:(this.each(function(){b.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:O.test(r)?b.parseJSON(r):r}catch(o){}b.data(e,n,r)}else r=t}return r}function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}b.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=b._data(e,n),r&&(!i||b.isArray(r)?i=b._data(e,n,b.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t),a=function(){b.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return b._data(e,n)||b._data(e,n,{empty:b.Callbacks("once memory").add(function(){b._removeData(e,t+"queue"),b._removeData(e,n)})})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?b.queue(this[0],e):n===t?this:this.each(function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(e,t){return e=b.fx?b.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=b._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var I,z,X=/[\t\r\n]/g,U=/\r/g,V=/^(?:input|select|textarea|button|object)$/i,Y=/^(?:a|area)$/i,J=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,G=/^(?:checked|selected)$/i,Q=b.support.getSetAttribute,K=b.support.input;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return e=b.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return b.isFunction(e)?this.each(function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=b(this),u=t,l=e.match(w)||[];while(o=l[a++])u=r?u:!s.hasClass(o),s[u?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&b._data(this,"__className__",this.className),this.className=this.className||e===!1?"":b._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(X," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=b.isFunction(e),this.each(function(n){var o,a=b(this);1===this.nodeType&&(o=i?e.call(this,n,a.val()):e,null==o?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,function(e){return null==e?"":e+""})),r=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(U,""):null==n?"":n)}}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;for(;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(b.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n=b.makeArray(t);return b(e).find("option").each(function(){this.selected=b.inArray(b(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var o,a,s,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return typeof e.getAttribute===i?b.prop(e,n,r):(a=1!==u||!b.isXMLDoc(e),a&&(n=n.toLowerCase(),o=b.attrHooks[n]||(J.test(n)?z:I)),r===t?o&&a&&"get"in o&&null!==(s=o.get(e,n))?s:(typeof e.getAttribute!==i&&(s=e.getAttribute(n)),null==s?t:s):null!==r?o&&a&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):(b.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=b.propFix[n]||n,J.test(n)?!Q&&G.test(n)?e[b.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:b.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!b.isXMLDoc(e),a&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):V.test(e.nodeName)||Y.test(e.nodeName)&&e.href?0:t}}}}),z={get:function(e,n){var r=b.prop(e,n),i="boolean"==typeof r&&e.getAttribute(n),o="boolean"==typeof r?K&&Q?null!=i:G.test(n)?e[b.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return o&&o.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?b.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&b.propFix[n]||n,n):e[b.camelCase("default-"+n)]=e[n]=!0,n}},K&&Q||(b.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return b.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t},set:function(e,n,r){return b.nodeName(e,"input")?(e.defaultValue=n,t):I&&I.set(e,n,r)}}),Q||(I=b.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&("id"===n||"name"===n||"coords"===n?""!==r.value:r.specified)?r.value:t},set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},b.attrHooks.contenteditable={get:I.get,set:function(e,t,n){I.set(e,""===t?!1:t,n)}},b.each(["width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})})),b.support.hrefNormalized||(b.each(["href","src","width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null==r?t:r}})}),b.each(["href","src"],function(e,t){b.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),b.support.style||(b.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),b.support.optSelected||(b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),b.support.enctype||(b.propFix.enctype="encoding"),b.support.checkOn||b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,n){return b.isArray(n)?e.checked=b.inArray(b(e).val(),n)>=0:t}})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}b.event={global:{},add:function(e,n,r,o,a){var s,u,l,c,p,f,d,h,g,m,y,v=b._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=b.guid++),(u=v.events)||(u=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(w)||[""],l=n.length;while(l--)s=rt.exec(n[l])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),p=b.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=b.event.special[g]||{},d=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&b.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=u[g])||(h=u[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),b.event.global[g]=!0;e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,p,f,d,h,g,m=b.hasData(e)&&b._data(e);if(m&&(c=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(s=rt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=b.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));u&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||b.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(c)&&(delete m.handle,b._removeData(e,"events"))}},trigger:function(n,r,i,a){var s,u,l,c,p,f,d,h=[i||o],g=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];if(l=f=i=i||o,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),u=0>g.indexOf(":")&&"on"+g,n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n),n.isTrigger=!0,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),p=b.event.special[g]||{},a||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!a&&!p.noBubble&&!b.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(l=l.parentNode);l;l=l.parentNode)h.push(l),f=l;f===(i.ownerDocument||o)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((l=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(b._data(l,"events")||{})[n.type]&&b._data(l,"handle"),s&&s.apply(l,r),s=u&&l[u],s&&b.acceptData(l)&&s.apply&&s.apply(l,r)===!1&&n.preventDefault();if(n.type=g,!(a||n.isDefaultPrevented()||p._default&&p._default.apply(i.ownerDocument,r)!==!1||"click"===g&&b.nodeName(i,"a")||!b.acceptData(i)||!u||!i[g]||b.isWindow(i))){f=i[u],f&&(i[u]=null),b.event.triggered=g;try{i[g]()}catch(v){}b.event.triggered=t,f&&(i[u]=f)}return n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,a,s=[],u=h.call(arguments),l=(b._data(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=b.event.handlers.call(this,e,l),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((b.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(o=[],a=0;u>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?b(r,this).index(l)>=0:b.find(r,this,null,[l]).length),o[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return n.length>u&&s.push({elem:this,handlers:n.slice(u)}),s},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,a=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new b.Event(a),t=r.length;while(t--)n=r[t],e[n]=a[n];return e.target||(e.target=a.srcElement||o),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,a):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,a,s=n.button,u=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||o,a=i.documentElement,r=i.body,e.pageX=n.clientX+(a&&a.scrollLeft||r&&r.scrollLeft||0)-(a&&a.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(a&&a.scrollTop||r&&r.scrollTop||0)-(a&&a.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return b.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==o.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===o.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=o.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},b.Event=function(e,n){return this instanceof b.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&b.extend(this,n),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0,t):new b.Event(e,n)},b.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj; -return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&b.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return b.nodeName(this,"form")?!1:(b.event.remove(this,"._submit"),t)}}),b.support.changeBubbles||(b.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(b.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),b.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),b.event.simulate("change",this,e,!0)})),!1):(b.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!b._data(t,"changeBubbles")&&(b.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||b.event.simulate("change",this.parentNode,e,!0)}),b._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return b.event.remove(this,"._change"),!Z.test(this.nodeName)}}),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),b.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each(function(){b.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){b.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){b.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?b.event.trigger(e,n,r,!0):t}}),function(e,t){var n,r,i,o,a,s,u,l,c,p,f,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T={},N=0,C=0,k=it(),E=it(),S=it(),A=typeof t,j=1<<31,D=[],L=D.pop,H=D.push,q=D.slice,M=D.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},_="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=F.replace("w","w#"),B="([*^$|!~]?=)",P="\\["+_+"*("+F+")"+_+"*(?:"+B+_+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+O+")|)|)"+_+"*\\]",R=":("+F+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+P.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+_+"+|((?:^|[^\\\\])(?:\\\\.)*)"+_+"+$","g"),$=RegExp("^"+_+"*,"+_+"*"),I=RegExp("^"+_+"*([\\x20\\t\\r\\n\\f>+~])"+_+"*"),z=RegExp(R),X=RegExp("^"+O+"$"),U={ID:RegExp("^#("+F+")"),CLASS:RegExp("^\\.("+F+")"),NAME:RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:RegExp("^("+F.replace("w","w*")+")"),ATTR:RegExp("^"+P),PSEUDO:RegExp("^"+R),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+_+"*(even|odd|(([+-]|)(\\d*)n|)"+_+"*(?:([+-]|)"+_+"*(\\d+)|))"+_+"*\\)|)","i"),needsContext:RegExp("^"+_+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+_+"*((?:-\\d)?\\d*)"+_+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,Y=/^[^{]+\{\s*\[native code/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{q.call(w.documentElement.childNodes,0)[0].nodeType}catch(nt){q=function(e){var t,n=[];while(t=this[e++])n.push(t);return n}}function rt(e){return Y.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i.cacheLength&&delete e[t.shift()],e[n]=r}}function ot(e){return e[x]=!0,e}function at(e){var t=p.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)!==p&&c(t),t=t||p,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(!d&&!r){if(i=J.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&y(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return H.apply(n,q.call(t.getElementsByTagName(e),0)),n;if((a=i[3])&&T.getByClassName&&t.getElementsByClassName)return H.apply(n,q.call(t.getElementsByClassName(a),0)),n}if(T.qsa&&!h.test(e)){if(f=!0,g=x,m=t,v=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){l=ft(e),(f=t.getAttribute("id"))?g=f.replace(K,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=l.length;while(u--)l[u]=g+dt(l[u]);m=V.test(e)&&t.parentNode||t,v=l.join(",")}if(v)try{return H.apply(n,q.call(m.querySelectorAll(v),0)),n}catch(b){}finally{f||t.removeAttribute("id")}}}return wt(e.replace(W,"$1"),t,n,r)}a=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},c=st.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==p&&9===n.nodeType&&n.documentElement?(p=n,f=n.documentElement,d=a(n),T.tagNameNoComments=at(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),T.attributes=at(function(e){e.innerHTML="";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),T.getByClassName=at(function(e){return e.innerHTML="",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),T.getByName=at(function(e){e.id=x+0,e.innerHTML="
",f.insertBefore(e,f.firstChild);var t=n.getElementsByName&&n.getElementsByName(x).length===2+n.getElementsByName(x+0).length;return T.getIdNotName=!n.getElementById(x),f.removeChild(e),t}),i.attrHandle=at(function(e){return e.innerHTML="",e.firstChild&&typeof e.firstChild.getAttribute!==A&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},T.getIdNotName?(i.find.ID=function(e,t){if(typeof t.getElementById!==A&&!d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){return e.getAttribute("id")===t}}):(i.find.ID=function(e,n){if(typeof n.getElementById!==A&&!d){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==A&&r.getAttributeNode("id").value===e?[r]:t:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=T.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==A?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},i.find.NAME=T.getByName&&function(e,n){return typeof n.getElementsByName!==A?n.getElementsByName(name):t},i.find.CLASS=T.getByClassName&&function(e,n){return typeof n.getElementsByClassName===A||d?t:n.getElementsByClassName(e)},g=[],h=[":focus"],(T.qsa=rt(n.querySelectorAll))&&(at(function(e){e.innerHTML="",e.querySelectorAll("[selected]").length||h.push("\\["+_+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){e.innerHTML="",e.querySelectorAll("[i^='']").length&&h.push("[*^$]="+_+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(T.matchesSelector=rt(m=f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){T.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",R)}),h=RegExp(h.join("|")),g=RegExp(g.join("|")),y=rt(f.contains)||f.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},v=f.compareDocumentPosition?function(e,t){var r;return e===t?(u=!0,0):(r=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&r||e.parentNode&&11===e.parentNode.nodeType?e===n||y(w,e)?-1:t===n||y(w,t)?1:0:4&r?-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 u=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:0;if(o===a)return ut(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?ut(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},u=!1,[0,0].sort(v),T.detectDuplicates=u,p):p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Z,"='$1']"),!(!T.matchesSelector||d||g&&g.test(t)||h.test(t)))try{var n=m.call(e,t);if(n||T.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},st.attr=function(e,t){var n;return(e.ownerDocument||e)!==p&&c(e),d||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):d||T.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},st.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,n=[],r=1,i=0;if(u=!T.detectDuplicates,e.sort(v),u){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e};function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pt(e){return ot(function(t){return t=+t,ot(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]))})})}o=st.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+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=st.selectors={cacheLength:50,createPseudo:ot,match:U,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(et,tt),e[3]=(e[4]||e[5]||"").replace(et,tt),"~="===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]||st.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]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return U.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&z.test(n)&&(t=ft(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(et,tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[e+" "];return t||(t=RegExp("(^|"+_+")"+e+"("+_+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.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,u){var l,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!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[x]||(m[x]={}),l=c[e]||[],d=l[0]===N&&l[1],f=l[0]===N&&l[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]=[N,d,f];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===N)f=l[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[x]||(p[x]={}))[e]=[N,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?ot(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=M.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ot(function(e){var t=[],n=[],r=s(e.replace(W,"$1"));return r[x]?ot(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:ot(function(e){return function(t){return st(e,t).length>0}}),contains:ot(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:ot(function(e){return X.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(et,tt).toLowerCase(),function(t){var n;do if(n=d?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.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===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.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!i.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return G.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:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[0>n?n+t:n]}),even:pt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(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})i.pseudos[n]=lt(n);for(n in{submit:!0,reset:!0})i.pseudos[n]=ct(n);function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=i.preFilter;while(s){(!n||(r=$.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(o=[])),n=!1,(r=I.exec(s))&&(n=r.shift(),o.push({value:n,type:r[0].replace(W," ")}),s=s.slice(n.length));for(a in i.filter)!(r=U[a].exec(s))||l[a]&&!(r=l[a](r))||(n=r.shift(),o.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?st.error(e):E(e,u).slice(0)}function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,s){var u,l,c,p=N+" "+a;if(s){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[x]||(t[x]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,s)||r,l[1]===!0)return!0}}function gt(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 mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)),ot(function(o,a,s,u){var l,c,p,f=[],d=[],h=a.length,g=o||xt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:mt(g,f,e,s,u),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,u),r){l=mt(y,d),r(l,[],s,u),c=l.length;while(c--)(p=l[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?M.call(o,p):f[c])>-1&&(o[l]=!(a[l]=p))}}else y=mt(y===a?y.splice(h,y.length):y),i?i(null,a,y,u):H.apply(a,y)})}function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relative[" "],u=a?1:0,c=ht(function(e){return e===t},s,!0),p=ht(function(e){return M.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>u;u++)if(n=i.relative[e[u].type])f=[ht(gt(f),n)];else{if(n=i.filter[e[u].type].apply(null,e[u].matches),n[x]){for(r=++u;o>r;r++)if(i.relative[e[r].type])break;return yt(u>1&>(f),u>1&&dt(e.slice(0,u-1)).replace(W,"$1"),n,r>u&&vt(e.slice(u,r)),o>r&&vt(e=e.slice(r)),o>r&&dt(e))}f.push(n)}return gt(f)}function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,T=l,C=s||a&&i.find.TAG("*",d&&u.parentNode||u),k=N+=null==T?1:Math.random()||.1;for(w&&(l=u!==p&&u,r=n);null!=(h=C[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,u,c)){f.push(h);break}w&&(N=k,r=++n)}o&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,o&&b!==v){g=0;while(m=t[g++])m(x,y,u,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=L.call(f));y=mt(y)}H.apply(f,y),w&&!s&&y.length>0&&v+t.length>1&&st.uniqueSort(f)}return w&&(N=k,l=T),x};return o?ot(s):s}s=st.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=ft(e)),n=t.length;while(n--)o=vt(t[n]),o[x]?r.push(o):i.push(o);o=S(e,bt(i,r))}return o};function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&!d&&i.relative[a[1].type]){if(t=i.find.ID(u.matches[0].replace(et,tt),t)[0],!t)return n;e=e.slice(a.shift().value.length)}o=U.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],i.relative[l=u.type])break;if((c=i.find[l])&&(r=c(u.matches[0].replace(et,tt),V.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=r.length&&dt(a),!e)return H.apply(n,q.call(r,0)),n;break}}}return s(e,p)(r,t,d,n,V.test(e)),n}i.pseudos.nth=i.pseudos.eq;function Tt(){}i.filters=Tt.prototype=i.pseudos,i.setFilters=new Tt,c(),st.attr=b.attr,b.find=st,b.expr=st.selectors,b.expr[":"]=b.expr.pseudos,b.unique=st.uniqueSort,b.text=st.getText,b.isXMLDoc=st.isXML,b.contains=st.contains}(e);var at=/Until$/,st=/^(?:parents|prev(?:Until|All))/,ut=/^.[^:#\[\.,]*$/,lt=b.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return r=this,this.pushStack(b(e).filter(function(){for(t=0;i>t;t++)if(b.contains(r[t],this))return!0}));for(n=[],t=0;i>t;t++)b.find(e,this[t],n);return n=this.pushStack(i>1?b.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=b(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(b.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1))},filter:function(e){return this.pushStack(ft(this,e,!0))},is:function(e){return!!e&&("string"==typeof e?lt.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],a=lt.test(e)||"string"!=typeof e?b(e,t||this.context):0;for(;i>r;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&11!==n.nodeType){if(a?a.index(n)>-1:b.find.matchesSelector(n,e)){o.push(n);break}n=n.parentNode}}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?b.inArray(this[0],b(e)):b.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.fn.andSelf=b.fn.addBack;function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.merge([],e.childNodes)}},function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return at.test(e)||(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),i=this.length>1&&!ct[e]?b.unique(i):i,this.length>1&&st.test(e)&&(i=i.reverse()),this.pushStack(i)}}),b.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?b.find.matchesSelector(t[0],e)?[t[0]]:[]:b.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!b(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(t=t||0,b.isFunction(t))return b.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return b.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=b.grep(e,function(e){return 1===e.nodeType});if(ut.test(t))return b.filter(t,r,!n);t=b.filter(t,r)}return b.grep(e,function(e){return b.inArray(e,t)>=0===n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/\s*$/g,At={option:[1,""],legend:[1,"
","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:b.support.htmlSerialize?[0,"",""]:[1,"X
","
"]},jt=dt(o),Dt=jt.appendChild(o.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,b.fn.extend({text:function(e){return b.access(this,function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(b.isFunction(e))return this.each(function(t){b(this).wrapAll(e.call(this,t))});if(this[0]){var t=b(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return b.isFunction(e)?this.each(function(t){b(this).wrapInner(e.call(this,t))}):this.each(function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=b.isFunction(e);return this.each(function(n){b(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=0;for(;null!=(n=this[r]);r++)(!e||b.filter(e,[n]).length>0)&&(t||1!==n.nodeType||b.cleanData(Ot(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&Mt(Ot(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&b.cleanData(Ot(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&b.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return b.clone(this,e,t)})},html:function(e){return b.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!b.support.htmlSerialize&&mt.test(e)||!b.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(b.cleanData(Ot(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=b.isFunction(e);return t||"string"==typeof e||(e=b(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;n&&(b(this).remove(),n.insertBefore(e,t))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=f.apply([],e);var i,o,a,s,u,l,c=0,p=this.length,d=this,h=p-1,g=e[0],m=b.isFunction(g);if(m||!(1>=p||"string"!=typeof g||b.support.checkClone)&&Ct.test(g))return this.each(function(i){var o=d.eq(i);m&&(e[0]=g.call(this,i,n?o.html():t)),o.domManip(e,n,r)});if(p&&(l=b.buildFragment(e,this[0].ownerDocument,!1,this),i=l.firstChild,1===l.childNodes.length&&(l=i),i)){for(n=n&&b.nodeName(i,"tr"),s=b.map(Ot(l,"script"),Ht),a=s.length;p>c;c++)o=l,c!==h&&(o=b.clone(o,!0,!0),a&&b.merge(s,Ot(o,"script"))),r.call(n&&b.nodeName(this[c],"table")?Lt(this[c],"tbody"):this[c],o,c);if(a)for(u=s[s.length-1].ownerDocument,b.map(s,qt),c=0;a>c;c++)o=s[c],kt.test(o.type||"")&&!b._data(o,"globalEval")&&b.contains(u,o)&&(o.src?b.ajax({url:o.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):b.globalEval((o.text||o.textContent||o.innerHTML||"").replace(St,"")));l=i=null}return this}});function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval",!t||b._data(t[r],"globalEval"))}function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e),a=b._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)b.event.add(t,n,s[n][r])}a.data&&(a.data=b.extend({},a.data))}}function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!b.support.noCloneEvent&&t[b.expando]){i=b._data(t);for(r in i.events)b.removeEvent(t,r,i.handle);t.removeAttribute(b.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),b.support.html5Clone&&e.innerHTML&&!b.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Nt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){b.fn[e]=function(e){var n,r=0,i=[],o=b(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),b(o[r])[t](n),d.apply(i,n.get());return this.pushStack(i)}});function Ot(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||b.nodeName(o,n)?s.push(o):b.merge(s,Ot(o,n));return n===t||n&&b.nodeName(e,n)?b.merge([e],s):s}function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}b.extend({clone:function(e,t,n){var r,i,o,a,s,u=b.contains(e.ownerDocument,e);if(b.support.html5Clone||b.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(b.support.noCloneEvent&&b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(r=Ot(o),s=Ot(e),a=0;null!=(i=s[a]);++a)r[a]&&Ft(i,r[a]);if(t)if(n)for(s=s||Ot(e),r=r||Ot(o),a=0;null!=(i=s[a]);a++)_t(i,r[a]);else _t(e,o);return r=Ot(o,"script"),r.length>0&&Mt(r,!u&&Ot(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,u,l,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===b.type(o))b.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),u=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[u]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!b.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!b.support.tbody){o="table"!==u||xt.test(o)?""!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)b.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l) -}b.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b.event.special;for(;null!=(n=e[s]);s++)if((t||b.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?b.event.remove(n,r):b.removeEvent(n,r,a.handle);l[o]&&(delete l[o],p?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,c.push(o))}}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+x+")(.*)$","i"),Yt=RegExp("^("+x+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+x+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=b._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=b._data(r,"olddisplay",un(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&b._data(r,"olddisplay",i?n:b.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}b.fn.extend({css:function(e,n){return b.access(this,function(e,n,r){var i,o,a={},s=0;if(b.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=b.css(e,n[s],!1,o);return a}return r!==t?b.style(e,n,r):b.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?b(this).show():b(this).hide()})}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=tn(l,u)),s=b.cssHooks[n]||b.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=tn(e.style,u)),s=b.cssHooks[n]||b.cssHooks[u],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||b.isNumeric(o)?o||0:a):a},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}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),Yt.test(u)&&Ut.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):o.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Yt.test(u)&&!zt.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=b.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=b.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=b.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=b.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=b.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(Pt||b("