Commit acd4a83e authored by Anastasios Kalogeropoulos's avatar Anastasios Kalogeropoulos
Browse files

edit ideas bug fixed

parent 98b39f9a
......@@ -287,50 +287,44 @@ public class IdeaInputBean implements Serializable {
try {
Ideas idea = ideasLocalService.getIdeas(ideasId);
User user = userLocalService.getUserById(Long.parseLong(FacesContext.getCurrentInstance().getExternalContext().getRemoteUser()));
if(user.getPrimaryKey() == idea.getUserId()){
nullfyInputFields();
this.currentIdeasId = idea.getPrimaryKey();
this.selectedTags = ideasLocalService.getTagsForIdea(ideasId);
this.title = idea.getTitle();
this.solution = idea.getSolution();
this.goal = idea.getGoal();
this.importance = idea.getImportance();
this.targetAudience = idea.getTargetAudience();
this.lat = idea.getLatitude();
this.lng = idea.getLongitude();
this.pitch = idea.getPitch();
this.titleImgUrl1 = ideasLocalService.getPictureUrlByIdeasRefAndPosition(ideasId, 0);
this.selectedUserName = idea.getUserName();
// Load the Video if available
if (idea.getVideoUrl() != null && !idea.getVideoUrl().equals("")) {
String[] split = idea.getVideoUrl().split(",");
if (split.length > 1) {
for (int j = 0; j < split.length; j++) {
if (FilenameUtils.getExtension(split[j]).equals("mp4")) {
this.videoPreviewUrl = split[j];
}
nullfyInputFields();
this.currentIdeasId = idea.getPrimaryKey();
this.selectedTags = ideasLocalService.getTagsForIdea(ideasId);
this.title = idea.getTitle();
this.solution = idea.getSolution();
this.goal = idea.getGoal();
this.importance = idea.getImportance();
this.targetAudience = idea.getTargetAudience();
this.lat = idea.getLatitude();
this.lng = idea.getLongitude();
this.pitch = idea.getPitch();
this.titleImgUrl1 = ideasLocalService.getPictureUrlByIdeasRefAndPosition(ideasId, 0);
this.selectedUserName = idea.getUserName();
// Load the Video if available
if (idea.getVideoUrl() != null && !idea.getVideoUrl().equals("")) {
String[] split = idea.getVideoUrl().split(",");
if (split.length > 1) {
for (int j = 0; j < split.length; j++) {
if (FilenameUtils.getExtension(split[j]).equals("mp4")) {
this.videoPreviewUrl = split[j];
}
} else {
this.videoPreviewUrl = idea.getVideoUrl();
}
} else {
this.videoPreviewUrl = idea.getVideoUrl();
}
}
this.titleImgUrl2 = ideasLocalService.getPictureUrlByIdeasRefAndPosition(ideasId, 1);
this.titleImgUrl3 = ideasLocalService.getPictureUrlByIdeasRefAndPosition(ideasId, 2);
this.titleImgUrl2 = ideasLocalService.getPictureUrlByIdeasRefAndPosition(ideasId, 1);
this.titleImgUrl3 = ideasLocalService.getPictureUrlByIdeasRefAndPosition(ideasId, 2);
updateMainBody();
logger.info("Loaded Idea with primary key " + ideasId + " successfully");
updateMainBody();
logger.info("Loaded Idea with primary key " + ideasId + " successfully");
}
else{
//if a user tries to edit another users idea nullify all input fields
this.nullfyInputFields();
}
} catch (PortalException e) {
logger.error("Could not load Idea from DB", e);
}
......@@ -1369,6 +1363,9 @@ public class IdeaInputBean implements Serializable {
public boolean showPicsOverview(){
//all images empty
if(this.titleImgUrl1 == null && this.titleImgUrl2 == null && this.titleImgUrl3 == null){
return false;
}
if(this.titleImgUrl1.equals("/") && this.titleImgUrl2.equals("/") && this.titleImgUrl3.equals("/")){
return false;
}
......
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