use of teammates.ui.pagedata.FileUploadPageData in project teammates by TEAMMATES.
the class ImageUploadAction method prepareData.
protected FileUploadPageData prepareData() {
FileUploadPageData data = new FileUploadPageData(account, sessionToken);
BlobInfo blobInfo = extractImageKey(getImageKeyParam());
if (blobInfo == null) {
data.isFileUploaded = false;
data.fileSrcUrl = null;
log.warning("Image Upload Failed");
statusToAdmin = "Image Upload Failed";
return data;
}
BlobKey blobKey = blobInfo.getBlobKey();
data.isFileUploaded = true;
AppUrl fileSrcUrl = Config.getAppUrl(Const.ActionURIs.PUBLIC_IMAGE_SERVE).withParam(Const.ParamsNames.BLOB_KEY, blobKey.getKeyString());
String absoluteFileSrcUrl = fileSrcUrl.toAbsoluteString();
data.fileSrcUrl = fileSrcUrl.toString();
log.info("New Image Uploaded : " + absoluteFileSrcUrl);
statusToAdmin = "New Image Uploaded : " + "<a href=" + data.fileSrcUrl + " target=\"_blank\">" + absoluteFileSrcUrl + "</a>";
data.ajaxStatus = "Image Successfully Uploaded to Google Cloud Storage";
return data;
}
use of teammates.ui.pagedata.FileUploadPageData in project teammates by TEAMMATES.
the class AdminEmailImageUploadAction method execute.
@Override
protected ActionResult execute() {
gateKeeper.verifyAdminPrivileges(account);
FileUploadPageData uploadPageData = prepareData();
AdminEmailComposePageData data = new AdminEmailComposePageData(account, sessionToken);
data.isFileUploaded = uploadPageData.isFileUploaded;
data.fileSrcUrl = uploadPageData.fileSrcUrl;
data.ajaxStatus = uploadPageData.ajaxStatus;
return createAjaxResult(data);
}
Aggregations