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