Skip to content
Open
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
012e455
Added logo upload and theme color settings in site settings
milospp Jan 14, 2025
c531be0
Typo fix
milospp Jan 14, 2025
32efbb0
Fixed referred loop problem in siteStore
milospp Jan 16, 2025
0fc26bb
Allowed hide advanced option and modified deafult colors for wilma theme
milospp Jan 18, 2025
70dab40
Added styles for Vitro theme
milospp Jan 18, 2025
2364306
Implemented styles for Tenderfoot
milospp Jan 19, 2025
cf10b34
Added reset all buton and refactored code
milospp Jan 19, 2025
5ceb8ee
Added color config support for nemo theme
milospp Jan 19, 2025
fb2563f
Added support for small version of logo
milospp Jan 20, 2025
7d3ba4b
Added different crop aspect ratio for Small and regular logo
milospp Jan 20, 2025
57c0c7b
Implemented transparent logo crop
milospp Jan 21, 2025
c83c4f2
Changed theme branding colors save to dispaly model
milospp Mar 6, 2025
e71f22f
Removed theme colors from application bean
milospp Mar 7, 2025
6501ef8
Added refferer helper from css upload PR
milospp Apr 15, 2025
7dbc4f1
Added simple cache and created component for uploading logo
milospp Apr 15, 2025
917e346
Fixed bug in code (missing set theme in application bean)
milospp May 12, 2025
85eeaa0
Removed theme specific config into json files
milospp May 14, 2025
ba0b449
Fixed css for login
milospp May 16, 2025
3cc3421
Fixed branding color cache after theme dir change
milospp May 19, 2025
129eea5
Fixed branding styles (script loading, small bugs)
milospp May 19, 2025
21c49fd
Removed console.log
milospp May 19, 2025
2bfc0c1
Fixed openning editor in firefox
milospp May 22, 2025
cff6d15
Reordered alert on submit and addedd save on submit
milospp May 23, 2025
45c24c8
Fixed alert on save and redirect
milospp May 23, 2025
17d9168
Add chain icon
milospp May 23, 2025
78d703c
Fixed chains for firefox
milospp May 23, 2025
b05aee5
usd ?has_content instead of two check in .ftl
milospp Jun 10, 2025
9b62067
Removed theme variable from brandinColors.js
milospp Jun 10, 2025
e186b09
Fixed checkstyle
milospp Jun 10, 2025
37e6d70
Added en localization
milospp Jun 10, 2025
1aacf14
Reverted unused changes for image crop
milospp Jun 11, 2025
92b51b2
Reverted unused changes for image crop 2
milospp Jun 11, 2025
e3533cb
Updated upload button style
milospp Jun 11, 2025
76f69b3
Fixed lang typo
milospp Jun 11, 2025
d131f02
Updated ignore referer
milospp Jun 12, 2025
91c32d3
Fixed typo in RefererHelper
milospp Jun 12, 2025
f48ba3f
Moved LogoUpload to SiteInfomration page, removed RefererHelper
milospp Jun 17, 2025
514841d
Removed image processor
milospp Jun 25, 2025
cc5a248
Removed unused CSS
milospp Jun 25, 2025
c4dfc80
Fixed Branding permissions
milospp Aug 5, 2025
a735918
Fixed typo in UiLabel.ttl
milospp Sep 9, 2025
c8410ae
Replaced inline styles with classes
milospp Sep 16, 2025
759a458
Removed individualUri
milospp Oct 14, 2025
7a194de
Merge branch 'main' into feature/site-branding
milospp Oct 21, 2025
4e61b56
Updated code to accept generic branding colors for themes
milospp Dec 3, 2025
ff4e87a
Added lighter shade for secondary color in wilma and added support fo…
milospp Dec 4, 2025
60ccb0d
Fixed palette typo
milospp Dec 4, 2025
33df68b
Added check before loading script
milospp Dec 23, 2025
4cc35a0
Fixed custom logo
milospp Jan 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
import edu.cornell.mannlib.vitro.webapp.auth.checks.UserOnThread;
import edu.cornell.mannlib.vitro.webapp.auth.policy.EntityPolicyController;
import edu.cornell.mannlib.vitro.webapp.auth.policy.PolicyLoader;
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
import edu.cornell.mannlib.vitro.webapp.beans.PermissionSet;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.SiteBrandingController;
import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess;
import org.apache.commons.lang3.EnumUtils;
import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -155,6 +157,10 @@ public void doPost (HttpServletRequest request, HttpServletResponse response) {

notifyChangeListeners(epo, action);

if (newObj instanceof ApplicationBean) {
SiteBrandingController.updateThemeBrandingCache(((ApplicationBean) newObj).getThemeDir());
}

/* send the user somewhere */
switch (action) {
case "insert":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public class ApplicationBean {

// Default initializations, which may be overwritten in the AppBeanMapper
// but are otherwise not changed there
private String individualUri;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is the individualUri used?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently, this is no longer in use. This PR has gone through significant design changes.
If I recall correctly, site settings (such as the site name) are stored in a triplet, where the subject is the application instance named “...portal.” Because of that approach, I initially stored this site setting in the same way, as it was more convenient to access from my controllers. It is certainly no longer in use since we moved to a display model. Thank you for noticing, it will be removed.


private boolean initialized = false;
private String sessionIdStr = null;
private String applicationName = DEFAULT_APPLICATION_NAME;
Expand Down Expand Up @@ -64,6 +66,10 @@ public String toString() {

/*************************** SET functions ****************************/

public void setIndividualUri( String string_val ) {
individualUri = string_val;
}

public void setSessionIdStr( String string_val ) {
sessionIdStr = string_val;
}
Expand Down Expand Up @@ -118,6 +124,10 @@ public void setThemeDir(String string_val) {

/*************************** GET functions ****************************/

public String getIndividualUri() {
return individualUri;
}

public String getSessionIdStr() {
return sessionIdStr;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import edu.cornell.mannlib.vitro.webapp.controller.freemarker.SiteBrandingLogoController;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
import edu.cornell.mannlib.vitro.webapp.utils.JSPPageHandler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Expand All @@ -24,6 +26,7 @@
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.dao.ApplicationDao;
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;

public class ApplicationBeanRetryController extends BaseEditController {

Expand Down Expand Up @@ -89,6 +92,13 @@ public void doPost (HttpServletRequest req, HttpServletResponse response) {
request.setAttribute("title","Site Information");
request.setAttribute("_action",action);
request.setAttribute("unqualifiedClassName","ApplicationBean");
request.setAttribute("i18n", I18n.bundle(request));

request.setAttribute("actionLogoUploadUrl", SiteBrandingLogoController.getLogoUploadUrlString());
request.setAttribute("logoUrl", SiteBrandingLogoController.getLogoUrlCache());
request.setAttribute("logoSmallUrl", SiteBrandingLogoController.getMobileLogoUrlCache());

request.setAttribute("updateLogoUrl", UrlBuilder.getUrl("site-branding-logo"));
setRequestAttributes(request,epo);

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.auth.checks.QueryResultsMapCache;
import edu.cornell.mannlib.vitro.webapp.auth.permissions.SimplePermission;
import edu.cornell.mannlib.vitro.webapp.auth.policy.PolicyHelper;
Expand Down Expand Up @@ -51,6 +48,9 @@
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
import freemarker.template.utility.DeepUnwrap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class FreemarkerHttpServlet extends VitroHttpServlet {

Expand Down Expand Up @@ -452,6 +452,8 @@ protected Map<String, Object> getPageTemplateValues(VitroRequest vreq) {

map.put("siteName", vreq.getAppBean().getApplicationName());

map.putAll(SiteBrandingController.getThemeBrandingCache(vreq.getAppBean().getThemeDir()));

map.put("urls", buildRequestUrls(vreq));

map.put("menu", getDisplayModelMenu(vreq));
Expand All @@ -476,6 +478,10 @@ protected Map<String, Object> getPageTemplateValues(VitroRequest vreq) {
map.put("headScripts", new Tags().wrap());
map.put("metaTags", new Tags().wrap());


map.put("logoUrl", SiteBrandingLogoController.getLogoUrlCache());
map.put("logoSmallUrl", SiteBrandingLogoController.getMobileLogoUrlCache());

return map;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,17 @@ private static Map<String, String> createNonStandardMimeTypesMap() {
* if there is no file, if it is empty, or if it is not an image
* file.
*/
FileItem validateImageFromRequest(VitroRequest vreq)
FileItem validateImageFromRequest(VitroRequest vreq, String fieldName)
throws UserMistakeException {
Map<String, List<FileItem>> map = vreq.getFiles();
if (map == null) {
throw new IllegalStateException(ERROR_CODE_BAD_MULTIPART_REQUEST);
}

List<FileItem> list = map.get(PARAMETER_UPLOADED_FILE);
List<FileItem> list = map.get(fieldName);
if ((list == null) || list.isEmpty()) {
throw new UserMistakeException(ERROR_CODE_FORM_FIELD_MISSING,
PARAMETER_UPLOADED_FILE);
fieldName);
}

FileItem file = list.get(0);
Expand All @@ -144,14 +144,18 @@ FileItem validateImageFromRequest(VitroRequest vreq)
return file;
}

FileItem validateImageFromRequest(VitroRequest vreq) throws UserMistakeException {
return validateImageFromRequest(vreq, PARAMETER_UPLOADED_FILE);
}

/**
* The user has uploaded a new main image, but we're not ready to assign it
* to them.
*
* Put it into the file storage system, and attach it as a temp file on the
* session until we need it.
*/
FileInfo storeNewImage(FileItem fileItem, VitroRequest vreq) {
FileInfo storeNewImage(FileItem fileItem, VitroRequest vreq, boolean storeTemp) {
InputStream inputStream = null;
try {
inputStream = fileItem.getInputStream();
Expand All @@ -160,8 +164,10 @@ FileInfo storeNewImage(FileItem fileItem, VitroRequest vreq) {
FileInfo fileInfo = uploadedFileHelper.createFile(filename,
mimeType, inputStream);

TempFileHolder.attach(vreq.getSession(), ATTRIBUTE_TEMP_FILE,
fileInfo);
if (storeTemp) {
TempFileHolder.attach(vreq.getSession(), ATTRIBUTE_TEMP_FILE,
fileInfo);
}

return fileInfo;
} catch (IOException e) {
Expand All @@ -178,6 +184,10 @@ FileInfo storeNewImage(FileItem fileItem, VitroRequest vreq) {
}
}

FileInfo storeNewImage(FileItem fileItem, VitroRequest vreq) {
return this.storeNewImage(fileItem, vreq, true);
}

/**
* Find out how big this image is.
*
Expand Down
Loading