-
Notifications
You must be signed in to change notification settings - Fork 490
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 3578-widgets-file-pg
- Loading branch information
Showing
19 changed files
with
598 additions
and
90 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
...nx-guides/source/_static/installation/files/var/www/dataverse/branding/custom-footer.html
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,38 @@ | ||
<style> | ||
/* NOTE: You can use the custom CSS configuration to move this CSS your own stylesheet. */ | ||
|
||
/* Overwrite default footer styles to make room at the bottom of the browser page for our custom footer... */ | ||
html, body { | ||
height: 100%; | ||
} | ||
#content.container { | ||
min-height: calc(100% - 210px); | ||
margin-bottom: -142px; | ||
} | ||
#content.container:after { | ||
content: ""; | ||
display: block; | ||
} | ||
#footer { | ||
color: #a9a9a9; margin-top:0px; padding-bottom:0px; bottom:-150px; position: relative; | ||
} | ||
|
||
/* Place custom footer just above default footer at the bottom of the page... */ | ||
#custom-footer, #content.container:after { | ||
height: 142px; | ||
} | ||
#custom-footer { | ||
background: #414141; color: #a9a9a9; min-height: 100px; padding: 1.25em 0 100px 0; | ||
} | ||
#custom-footer a { | ||
color: #fff; | ||
} | ||
</style> | ||
<div id="custom-footer"> | ||
<div class="container"> | ||
<p>SAMPLE FOOTER TEXT</p> | ||
<p class="small"> | ||
<a href="https://dataverse.org" title="SAMPLE LINK" target="_blank">SAMPLE LINK</a> | ||
</p> | ||
</div> | ||
</div> |
35 changes: 35 additions & 0 deletions
35
...nx-guides/source/_static/installation/files/var/www/dataverse/branding/custom-header.html
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,35 @@ | ||
<style> | ||
/* NOTE: You can use the custom CSS configuration to move this CSS your own stylesheet... */ | ||
|
||
/* Overwrite default navbar styles to make room at the top of the browser page for our custom header... */ | ||
.navbar-fixed-top { | ||
top:50px !important; | ||
} | ||
#dataverse-header-block { | ||
padding-top: 150px; | ||
} | ||
|
||
/* Place narrow custom header at the top of the page... */ | ||
#custom-header { | ||
background: #414141; | ||
min-height: 44px; | ||
position: fixed; | ||
right: 0; | ||
left: 0; | ||
z-index: 930; | ||
padding-top: 8px; | ||
} | ||
#custom-header a.cst-hdr-link { | ||
line-height: 32px; | ||
color: #BAC5C6; | ||
font-weight: bold; | ||
} | ||
</style> | ||
<div id="custom-header"> | ||
<div class="container"> | ||
<p class="text-right"> | ||
<a class="pull-left" href="https://dataverse.org" title="SAMPLE IMAGE LINK" target="_blank"><img src="/var/www/dataverse/branding/sample.png" alt="SAMPLE IMAGE"/></a> | ||
<a class="cst-hdr-link" href="https://dataverse.org" title="SAMPLE HEADER LINK" target="_blank">SAMPLE HEADER LINK</a> | ||
</p> | ||
</div> | ||
</div> |
13 changes: 13 additions & 0 deletions
13
...-guides/source/_static/installation/files/var/www/dataverse/branding/custom-homepage.html
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 @@ | ||
|
||
<style> | ||
/* NOTE: You can use the custom CSS configuration to move this CSS your own stylesheet... */ | ||
|
||
/* Custom CSS for the custom homepage... */ | ||
div.jumbotron h1 {color:#C55B28;} | ||
</style> | ||
|
||
<div class="jumbotron"> | ||
<h1>Hello, world!</h1> | ||
<p>Welcome to our Dataverse.</p> | ||
<p><a class="btn btn-primary btn-lg" href="/dataverse/root" role="button">Browse Data</a></p> | ||
</div> |
6 changes: 6 additions & 0 deletions
6
...guides/source/_static/installation/files/var/www/dataverse/branding/custom-stylesheet.css
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,6 @@ | ||
/* Add any CSS necessary for your custom content */ | ||
|
||
.navbar-default { | ||
background-color: gold; | ||
background-image: none; | ||
} |
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
160 changes: 160 additions & 0 deletions
160
src/main/java/edu/harvard/iq/dataverse/CustomizationFilesServlet.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,160 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package edu.harvard.iq.dataverse; | ||
|
||
import edu.harvard.iq.dataverse.customization.CustomizationConstants; | ||
import java.io.BufferedReader; | ||
import java.io.File; | ||
import java.io.FileInputStream; | ||
import java.io.IOException; | ||
import java.io.InputStreamReader; | ||
import java.io.PrintWriter; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.annotation.WebServlet; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import edu.harvard.iq.dataverse.settings.SettingsServiceBean; | ||
import javax.ejb.EJB; | ||
|
||
/** | ||
* | ||
* @author skraffmi | ||
*/ | ||
@WebServlet(name = "CustomizationFilesServlet", urlPatterns = {"/CustomizationFilesServlet"}) | ||
public class CustomizationFilesServlet extends HttpServlet { | ||
|
||
@EJB | ||
SettingsServiceBean settingsService; | ||
|
||
|
||
/** | ||
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> | ||
* methods. | ||
* | ||
* @param request servlet request | ||
* @param response servlet response | ||
* @throws ServletException if a servlet-specific error occurs | ||
* @throws IOException if an I/O error occurs | ||
*/ | ||
protected void processRequest(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
response.setContentType("text/html;charset=UTF-8"); | ||
|
||
String customFileType = request.getParameter("customFileType"); | ||
String filePath = getFilePath(customFileType); | ||
|
||
Path physicalPath = Paths.get(filePath); | ||
try { | ||
File fileIn = physicalPath.toFile(); | ||
if (fileIn != null) { | ||
FileInputStream inputStream = new FileInputStream(fileIn); | ||
|
||
BufferedReader in = new BufferedReader(new InputStreamReader(inputStream)); | ||
String line; | ||
|
||
StringBuilder responseData = new StringBuilder(); | ||
try (PrintWriter out = response.getWriter()) { | ||
|
||
while ((line = in.readLine()) != null) { | ||
responseData.append(line); | ||
out.println(line); | ||
} | ||
} | ||
|
||
inputStream.close(); | ||
|
||
|
||
} else { | ||
/* | ||
If the file doesn't exist or it is unreadable we don't care | ||
*/ | ||
} | ||
|
||
} catch (Exception e) { | ||
/* | ||
If the file doesn't exist or it is unreadable we don't care | ||
*/ | ||
} | ||
|
||
} | ||
|
||
private String getFilePath(String fileTypeParam){ | ||
|
||
String nonNullDefaultIfKeyNotFound = ""; | ||
|
||
if (fileTypeParam.equals(CustomizationConstants.fileTypeHomePage)) { | ||
|
||
// Homepage | ||
return settingsService.getValueForKey(SettingsServiceBean.Key.HomePageCustomizationFile, nonNullDefaultIfKeyNotFound); | ||
|
||
} else if (fileTypeParam.equals(CustomizationConstants.fileTypeHeader)) { | ||
|
||
// Header | ||
return settingsService.getValueForKey(SettingsServiceBean.Key.HeaderCustomizationFile, nonNullDefaultIfKeyNotFound); | ||
|
||
} else if (fileTypeParam.equals(CustomizationConstants.fileTypeFooter)) { | ||
|
||
// Footer | ||
return settingsService.getValueForKey(SettingsServiceBean.Key.FooterCustomizationFile, nonNullDefaultIfKeyNotFound); | ||
|
||
} else if (fileTypeParam.equals(CustomizationConstants.fileTypeStyle)) { | ||
|
||
// Style (css) | ||
return settingsService.getValueForKey(SettingsServiceBean.Key.StyleCustomizationFile, nonNullDefaultIfKeyNotFound); | ||
|
||
} else if (fileTypeParam.equals(CustomizationConstants.fileTypeLogo)) { | ||
|
||
// Logo for installation - appears in header | ||
return settingsService.getValueForKey(SettingsServiceBean.Key.LogoCustomizationFile, nonNullDefaultIfKeyNotFound); | ||
} | ||
|
||
|
||
return ""; | ||
} | ||
|
||
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> | ||
/** | ||
* Handles the HTTP <code>GET</code> method. | ||
* | ||
* @param request servlet request | ||
* @param response servlet response | ||
* @throws ServletException if a servlet-specific error occurs | ||
* @throws IOException if an I/O error occurs | ||
*/ | ||
@Override | ||
protected void doGet(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
processRequest(request, response); | ||
} | ||
|
||
/** | ||
* Handles the HTTP <code>POST</code> method. | ||
* | ||
* @param request servlet request | ||
* @param response servlet response | ||
* @throws ServletException if a servlet-specific error occurs | ||
* @throws IOException if an I/O error occurs | ||
*/ | ||
@Override | ||
protected void doPost(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
processRequest(request, response); | ||
} | ||
|
||
/** | ||
* Returns a short description of the servlet. | ||
* | ||
* @return a String containing servlet description | ||
*/ | ||
@Override | ||
public String getServletInfo() { | ||
return "Short description"; | ||
}// </editor-fold> | ||
|
||
} |
Oops, something went wrong.