I believe just a model window.
We have a file called ImageEdit.jsp, hope you don't mind me including
the source here:
<%@ page import="com.sap.km.image.upload.bean.ImageBean" %>
<%@ page import="com.sap.km.image.upload.bean.Message" %>
<%@ page import="java.util.List" %>
<%@ page import="com.sapportals.htmlb.MessageBar" %>
<%@ page import="com.sap.km.image.util.ApplicationUtil" %>
<%@ page import="java.util.ResourceBundle" %>
<%@ taglib uri="tagLib" prefix="hbj" %>
<%
// storing ids from different controls
String formId = "";
String coordx1 = "";
String coordy1 = "";
String width = "";
String height = "";
// get the resource
ResourceBundle res = componentRequest.getResourceBundle();
// include required javascript files
ApplicationUtil.includeJS(pageContext,"scripts/lib/
prototype.js",componentRequest);
ApplicationUtil.includeJS(pageContext,"scripts/lib/
scriptaculous.js",componentRequest);
ApplicationUtil.includeJS(pageContext,"scripts/
cropper.js",componentRequest);
%>
<hbj:content
id="myContext">
<hbj:page
title="PageTitle">
<jsp:useBean
id="imageBean"
scope="session"
class="com.sap.km.image.upload.bean.ImageBean" />
<style type="text/css">
label {
clear: left;
margin-left: 50px;
float: left;
width: 5em;
}
#testWrap {
width: 200px;
float: left;
margin: 20px 0 0 50px;
}
#previewArea {
margin: 20px; 0 0 20px;
float: left;
}
</style>
<hbj:group
id="headlineGroup"
design="SAPCOLOR"
width="20%">
<%
headlineGroup.setTitle(res.getString("image.edit.image_edit"));
headlineGroup.setTooltip(res.getString("image.edit.image_edit"));
%>
<hbj:groupBody>
<hbj:form id="myForm">
<%
// get the id of the form
//formId = myContext.getParamIdForComponent(myForm);
formId = myContext.getCurrentFormId();
if(imageBean.hasMessages()){
List msgList = imageBean.getMessages();
for(int i = 0; i < msgList.size(); i++){
Message msg = (Message)msgList.get(i);
MessageBar msgBar = new MessageBar("msgBar" + i);
msgBar.setMessageType(msg.getType());
msgBar.setMessageText(msg.getText());
myForm.setMessageBar(msgBar);
msgBar.render(myContext);
}
}
%>
<table border=0>
<tr>
<td>
<div id="testWrap" style="height:<%=imageBean.getHeight()
%>px;">
<img src="<%=imageBean.getImageUrl()%>" alt="<
%=res.getString("image.edit.uploaded_image")%>" id="testImage" width="<
%=imageBean.getWidth()%>" height="<%=imageBean.getHeight()%>" />
</div>
</td>
<td>
<div id="previewArea"></div>
</td>
</tr>
<tr>
</tr>
<tr>
<td colspan="2">
<hbj:button
id="editFinishButton"
onClick="onEditFinish"
width="100"
design="EMPHASIZED">
<%
editFinishButton.setText(res.getString("image.edit.image_edit_finish"));
editFinishButton.setTooltip(res.getString("image.edit.image_edit_finish"));
%>
</hbj:button>
<hbj:button
id="editCancelButton"
onClick="onEditCancel"
width="100">
<%
editCancelButton.setText(res.getString("image.edit.image_edit_cancel"));
editCancelButton.setTooltip(res.getString("image.edit.image_edit_cancel"));
%>
</hbj:button>
</td>
</tr>
</table>
<hbj:inputField id="x1" visible="false" type="string"
jsObjectNeeded="true">
<% coordx1 = myContext.getParamIdForComponent(x1); %>
</hbj:inputField>
<hbj:inputField id="y1" visible="false" type="string"
jsObjectNeeded="true">
<% coordy1 = myContext.getParamIdForComponent(y1); %>
</hbj:inputField>
<hbj:inputField id="imageWidth" visible="false" type="string"
jsObjectNeeded="true">
<% width = myContext.getParamIdForComponent(imageWidth); %>
</hbj:inputField>
<hbj:inputField id="imageHeight" visible="false" type="string"
jsObjectNeeded="true">
<% height = myContext.getParamIdForComponent(imageHeight); %>
</hbj:inputField>
</hbj:form>
</hbj:groupBody>
</hbj:group>
</hbj:page>
</hbj:content>
<script type="text/javascript" charset="utf-8">
function onEndCrop( coords, dimensions ) {
<%=formId%>['<%=coordx1%>'].value = coords.x1;
<%=formId%>['<%=coordy1%>'].value = coords.y1;
<%=formId%>['<%=width%>'].value = dimensions.width;
<%=formId%>['<%=height%>'].value = dimensions.height;
}
// example with a preview of crop results, must have minimumm
dimensions
Event.observe(
window,
'load',
function() {
new Cropper.ImgWithPreview(
'testImage',
{
minWidth: 100,
minHeight: 130,
ratioDim: { x: 100, y: 130 },
onEndCrop: onEndCrop,
previewWrap: 'previewArea'
}
)
}
);
</script>
> >
http://picasaweb.google.com/lh/photo/NXZfvW1yz90iRmwo4cOZ_EZAIpBaSoZR...- Hide quoted text -
>
> - Show quoted text -