Commit 8e36657c authored by Anastasios Kalogeropoulos's avatar Anastasios Kalogeropoulos
Browse files

Merge branch 'bug/no-image-in-overview'

parents e1ad0a6e b1301a7a
......@@ -543,33 +543,33 @@ public class IdeaInputBean implements Serializable {
trackClick(SECOND_BUTTON_CONTINUE);
if(this.dataUrl1 == null || this.dataUrl1.equals("")){
return;
}
File tmpFile = null;
try {
tmpFile = convertDataUrlToFile(this.dataUrl1);
} catch (IOException e1) {
return;
}
IdeasLocalService ideasLocalService = ideasLocalServiceTracker.getService();
ThemeDisplay themeDisplay = (ThemeDisplay) FacesContext.getCurrentInstance().getExternalContext()
.getRequestMap().get(WebKeys.THEME_DISPLAY);
FileEntry createdEntry = null;
if (tmpFile != null && dataUrl1 != null) {
File tmpFile = null;
if (this.dataUrl1 != null && !this.dataUrl1.equals("")) {
try {
createdEntry = saveFile(tmpFile, this.IDEAS_PICTURE_FOLDER, this.IDEAS_PICTURE_QUALIFIER);
} catch (PortalException | IOException e) {
logger.error("Could not upload a picture", e);
tmpFile = convertDataUrlToFile(this.dataUrl1);
} catch (IOException e1) {
return;
}
IdeasLocalService ideasLocalService = ideasLocalServiceTracker.getService();
FileEntry createdEntry = null;
if (tmpFile != null && dataUrl1 != null) {
try {
createdEntry = saveFile(tmpFile, this.IDEAS_PICTURE_FOLDER, this.IDEAS_PICTURE_QUALIFIER);
} catch (PortalException | IOException e) {
logger.error("Could not upload a picture", e);
}
String titleImgRef = getFullyQualifiedUrlForFileEntry(themeDisplay, createdEntry);
titleImgUrl1 = titleImgRef;
long picPrimaryKey = createdEntry.getPrimaryKey();
ideasLocalService.addPictureToExistingIdea(currentIdeasId, picPrimaryKey, titleImgRef,0);
logger.info("Added Picture to Idea with primary key " + currentIdeasId);
}
String titleImgRef = getFullyQualifiedUrlForFileEntry(themeDisplay, createdEntry);
titleImgUrl1 = titleImgRef;
long picPrimaryKey = createdEntry.getPrimaryKey();
ideasLocalService.addPictureToExistingIdea(currentIdeasId, picPrimaryKey, titleImgRef,0);
logger.info("Added Picture to Idea with primary key " + currentIdeasId);
}
if(this.dataUrl2 != null && !this.dataUrl2.equals("")){
......@@ -581,7 +581,8 @@ public class IdeaInputBean implements Serializable {
}
RequestContext.getCurrentInstance().update("_JSFIdeaBoard_WAR_JSFIdeaBoard_:mainBodyOverview");
tmpFile.delete();
if(tmpFile != null)
tmpFile.delete();
}
/**
* the user can upload a picture in this step
......@@ -1367,7 +1368,8 @@ public class IdeaInputBean implements Serializable {
}
public boolean showPicsOverview(){
if(this.titleImgUrl1.equals("/")){
//all images empty
if(this.titleImgUrl1.equals("/") && this.titleImgUrl2.equals("/") && this.titleImgUrl3.equals("/")){
return false;
}
return true;
......
......@@ -169,7 +169,7 @@
<div class="overview-column">
<h3 style="margin-left:5px;">Bilder</h3>
<p:graphicImage style="width:100%;" url="#{ideaInputBean.titleImgUrl1}"/>
<p:graphicImage rendered="#{ideaInputBean.titleImgUrl1 != null}" style="width:100%;" url="#{ideaInputBean.titleImgUrl1}"/>
<ui:fragment rendered="#{ideaInputBean.titleImgUrl2 != null}">
<p:graphicImage style="width:100%;" url="#{ideaInputBean.titleImgUrl2}"/>
</ui:fragment>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment