Fixed picture upload (upgrade). Cleanup to follow.
This commit is contained in:
parent
68462514db
commit
5083086ff4
|
@ -1063,19 +1063,19 @@ public class RecipeDetailBean implements Serializable {
|
|||
|
||||
// ***
|
||||
|
||||
Part imageFile = null;
|
||||
UploadedFile imageFile = null;
|
||||
|
||||
/**
|
||||
* @return the imageFile set by the image upload control
|
||||
*/
|
||||
public Part getImageFile() {
|
||||
public UploadedFile getImageFile() {
|
||||
return imageFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param imageFile the imageFile to set
|
||||
*/
|
||||
public void setImageFile(Part imageFile) {
|
||||
public void setImageFile(UploadedFile imageFile) {
|
||||
this.imageFile = imageFile;
|
||||
}
|
||||
|
||||
|
@ -1085,9 +1085,7 @@ public class RecipeDetailBean implements Serializable {
|
|||
* @param event PrimeFaces file upload event object
|
||||
*/
|
||||
public void ajaxUploadImage(FileUploadEvent event) {
|
||||
UploadedFile foo = event.getFile();
|
||||
|
||||
PictureController.importImage(recipe, foo.getContent());
|
||||
PictureController.importImage(recipe, event.getFile().getContent());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,7 +53,7 @@ public class SpringPrimeFacesApplication {
|
|||
"com.sun.el.ExpressionFactoryImpl");
|
||||
servletContext.setInitParameter(
|
||||
"primefaces.UPLOADER", "native");
|
||||
////servletContext.addListener(IMAGE_IIO_PROVIDER_CONTEXT_LISTENER);
|
||||
//servletContext.addListener(IMAGE_IIO_PROVIDER_CONTEXT_LISTENER);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -124,6 +124,7 @@ public class UserSession implements Serializable {
|
|||
|
||||
/**
|
||||
* @param searchType the searchType to set
|
||||
* @deprecated. Use CookieBean TODO
|
||||
*/
|
||||
public void setSearchType(RecipeSearchType searchType) {
|
||||
this.searchType = searchType;
|
||||
|
|
|
@ -180,7 +180,7 @@ public class PictureController {
|
|||
|
||||
/**
|
||||
* Take imageFile input and store it as image for recipe.
|
||||
* Generate thumnail
|
||||
* Generate thumbnail
|
||||
*
|
||||
* @param recipe Recipe to store into.
|
||||
* @param bs Info about uploaded data.
|
||||
|
|
|
@ -14,6 +14,14 @@
|
|||
<ui:define name="content">
|
||||
<h:outputScript name="js/scrolltable.js" />
|
||||
<style>
|
||||
.deDescl {
|
||||
width: 15em;
|
||||
text-align: left;
|
||||
|
||||
}
|
||||
.deDescr {
|
||||
text-align: left;
|
||||
}
|
||||
.ingSel {
|
||||
width: 3em;
|
||||
text-align: center;
|
||||
|
@ -46,7 +54,7 @@
|
|||
<p:tab id="overviewTab"
|
||||
title="Description"
|
||||
>
|
||||
<p:panelGrid columns="2">
|
||||
<p:panelGrid columns="2" columnClasses="deDescl, deDescr">
|
||||
<f:facet name="header">Description</f:facet>
|
||||
<p:outputLabel for="@next"
|
||||
value="Title"
|
||||
|
@ -148,14 +156,15 @@
|
|||
</p:panel>
|
||||
<p:fileUpload id="ctlUpload"
|
||||
label="Upload Image"
|
||||
fileUploadListener="#{recipeDetailBean.ajaxUploadImage}"
|
||||
value="#{recipeDetailBean.imageFile}"
|
||||
listener="#{recipeDetailBean.ajaxUploadImage}"
|
||||
global="true" mode="advanced"
|
||||
multiple="false"
|
||||
update=":messages picPanel"
|
||||
auto="true"
|
||||
sizeLimit="1000000"
|
||||
allowTypes="/(\.|\/)(gif|jpe?g|png|webp)$/"
|
||||
/>
|
||||
/>
|
||||
<p:commandButton id="ctlDelImg"
|
||||
value="Delete Image"
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue
Block a user