-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat(TIP integration): Create tip embedded module
- Loading branch information
Showing
11 changed files
with
358 additions
and
14 deletions.
There are no files selected for viewing
105 changes: 105 additions & 0 deletions
105
...eb/src/main/java/org/cgiar/ccafs/marlo/action/json/tip/TipDinamicUrlGenerationAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/***************************************************************** | ||
* This file is part of Managing Agricultural Research for Learning & | ||
* Outcomes Platform (MARLO). | ||
* MARLO is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* at your option) any later version. | ||
* MARLO is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with MARLO. If not, see <http://www.gnu.org/licenses/>. | ||
*****************************************************************/ | ||
|
||
package org.cgiar.ccafs.marlo.action.json.tip; | ||
|
||
import org.cgiar.ccafs.marlo.action.BaseAction; | ||
import org.cgiar.ccafs.marlo.data.manager.TipParametersManager; | ||
import org.cgiar.ccafs.marlo.data.model.TipParameters; | ||
|
||
import java.util.List; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class TipDinamicUrlGenerationAction extends BaseAction { | ||
|
||
private static final long serialVersionUID = 3229622720197560976L; | ||
private static final Logger LOG = LoggerFactory.getLogger(TipDinamicUrlGenerationAction.class); | ||
|
||
// Front-end | ||
private String dinamicTipURL; | ||
|
||
@Inject | ||
private TipParametersManager tipParametersManager; | ||
|
||
@Inject | ||
public TipDinamicUrlGenerationAction() { | ||
|
||
} | ||
|
||
public String createDinamicURL() { | ||
String tipURL = null; | ||
boolean isCGIARUser = true; | ||
|
||
try { | ||
String userEmail = "", token = "", loginService = ""; | ||
if (this.getCurrentUser() != null && this.getCurrentUser().getEmail() != null) { | ||
userEmail = this.getCurrentUser().getEmail(); | ||
if (this.getCurrentUser().isCgiarUser() == true) { | ||
isCGIARUser = true; | ||
} else { | ||
isCGIARUser = false; | ||
} | ||
} | ||
|
||
List<TipParameters> tipParameters = tipParametersManager.findAll(); | ||
if (isCGIARUser) { | ||
if (tipParameters != null && !tipParameters.isEmpty() && tipParameters.get(0) != null) { | ||
if (tipParameters.get(0).getTipTokenService() != null) { | ||
token = tipParameters.get(0).getTokenValue(); | ||
} | ||
if (tipParameters.get(0).getTipLoginService() != null) { | ||
loginService = tipParameters.get(0).getTipLoginService(); | ||
} | ||
} | ||
tipURL = loginService + "/" + token + "/staff/" + userEmail; | ||
} else { | ||
// Not CGIAR User | ||
if (tipParameters != null && tipParameters.get(0) != null && tipParameters.get(0).getTipBaseUrl() != null) { | ||
tipURL = tipParameters.get(0).getTipBaseUrl(); | ||
} | ||
} | ||
} catch (NumberFormatException e) { | ||
LOG.error("Error getting tip URL: " + e); | ||
} | ||
|
||
return tipURL; | ||
} | ||
|
||
@Override | ||
public String execute() throws Exception { | ||
|
||
if (this.createDinamicURL() != null) { | ||
this.dinamicTipURL = this.createDinamicURL(); | ||
return SUCCESS; | ||
} | ||
return ERROR; | ||
} | ||
|
||
public String getDinamicTipURL() { | ||
return dinamicTipURL; | ||
} | ||
|
||
@Override | ||
public void prepare() throws Exception { | ||
} | ||
|
||
public void setDinamicTipURL(String dinamicTipURL) { | ||
this.dinamicTipURL = dinamicTipURL; | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
marlo-web/src/main/java/org/cgiar/ccafs/marlo/action/tip/TIPEmbeddedAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/***************************************************************** | ||
* This file is part of Managing Agricultural Research for Learning & | ||
* Outcomes Platform (MARLO). | ||
* MARLO is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* at your option) any later version. | ||
* MARLO is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with MARLO. If not, see <http://www.gnu.org/licenses/>. | ||
*****************************************************************/ | ||
|
||
package org.cgiar.ccafs.marlo.action.tip; | ||
|
||
import org.cgiar.ccafs.marlo.action.BaseAction; | ||
import org.cgiar.ccafs.marlo.data.manager.BiParametersManager; | ||
import org.cgiar.ccafs.marlo.data.manager.BiReportsManager; | ||
import org.cgiar.ccafs.marlo.data.model.BiParameters; | ||
import org.cgiar.ccafs.marlo.data.model.BiReports; | ||
import org.cgiar.ccafs.marlo.utils.APConfig; | ||
|
||
import java.util.List; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class TIPEmbeddedAction extends BaseAction { | ||
|
||
private static final long serialVersionUID = 1329042468240291639L; | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(TIPEmbeddedAction.class); | ||
|
||
// Managers | ||
private BiReportsManager biReportsManager; | ||
private BiParametersManager biParametersManager; | ||
|
||
// Front-end | ||
private List<BiReports> biReports; | ||
private List<BiParameters> biParameters; | ||
|
||
@Inject | ||
public TIPEmbeddedAction(APConfig config, BiReportsManager biReportsManager, | ||
BiParametersManager biParametersManager) { | ||
super(config); | ||
this.biReportsManager = biReportsManager; | ||
this.biParametersManager = biParametersManager; | ||
} | ||
|
||
public List<BiParameters> getBiParameters() { | ||
return biParameters; | ||
} | ||
|
||
|
||
public List<BiReports> getBiReports() { | ||
return biReports; | ||
} | ||
|
||
|
||
@Override | ||
public void prepare() { | ||
biReports = biReportsManager.findAll(); | ||
biParameters = biParametersManager.findAll(); | ||
} | ||
|
||
|
||
public void setBiParameters(List<BiParameters> biParameters) { | ||
this.biParameters = biParameters; | ||
} | ||
|
||
|
||
public void setBiReports(List<BiReports> biReports) { | ||
this.biReports = biReports; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE struts PUBLIC | ||
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN" | ||
"http://struts.apache.org/dtds/struts-2.5.dtd"> | ||
<struts> | ||
<!-- Add addition packages and configuration here. --> | ||
<package name="tip" namespace="/tip" | ||
extends="marlo-default"> | ||
|
||
<action name="{crp}/tip" | ||
class="org.cgiar.ccafs.marlo.action.tip.TIPEmbeddedAction"> | ||
<!-- interceptor-ref name="autoLogin" / --> | ||
<interceptor-ref name="homeStack" /> | ||
<result name="input">/WEB-INF/crp/views/tip/tipEmbedded.ftl | ||
</result> | ||
</action> | ||
|
||
</package> | ||
|
||
</struts> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
marlo-web/src/main/webapp/WEB-INF/crp/views/tip/tipEmbedded.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[#ftl] | ||
[#assign title = "TIP" /] | ||
[#assign currentSectionString = "${actionName?replace('/','-')}-phase-${(actualPhase.id)!}" /] | ||
[#assign customJS = ["${baseUrlMedia}/js/tip/tipEmbedded.js?20240306"] /] | ||
[#assign customCSS = [ | ||
"${baseUrl}/crp/css/tip/tipEmbedded.css?20240306", "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" | ||
] | ||
/] | ||
[#assign currentSection = "tip" /] | ||
|
||
[#include "/WEB-INF/global/pages/header.ftl" /] | ||
[#include "/WEB-INF/global/pages/main-menu.ftl" /] | ||
|
||
[#import "/WEB-INF/global/macros/utils.ftl" as utils /] | ||
|
||
<section class="container"> | ||
<h4 class="sectionTitle sectionTitle-tip">Deliverable Dissemination</h4> | ||
<div id="tip"> | ||
Our main goal is to continuously improve the planning and reporting process for our users in the system. Taking into account the above and working in line with OneCGIAR, we have integrated with the TIP tool of the Alliance, which will allow users to disseminate publications in CGSpace and Harvard Datavers for the AICCRA project collections.</br> | ||
With this new tool, we will have a more efficient process when putting our publications online | ||
</div> | ||
</br> | ||
</br> | ||
|
||
<div id="embeddedPage"></div> | ||
</section> | ||
|
||
[#include "/WEB-INF/global/pages/footer.ftl"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.fullscreen-button { | ||
position: absolute; | ||
top: -10x; | ||
right: 17px; | ||
} | ||
|
||
.timeline-phases { | ||
display: none; | ||
} | ||
|
||
.sectionTitle-tip{ | ||
margin-top:10px; | ||
} |
Oops, something went wrong.