📄 myqueuehandler.java
字号:
emailCc = ((TextboxFieldData)ccFld).getText();
}
if(!sentDateFld.isEmpty()){
sentDate = ((DateFieldData)sentDateFld).getFormatedDate();
}
if(!subjectFld.isEmpty()){
oldSubject = ((TextboxFieldData)subjectFld).getText();
}
String newBody = "<br><hr><b>From: </b>"+senderMail+"<br><b>Sent: </b>"+sentDate+
"<br><b>To: </b>"+emailTo+"<br><b>Cc: </b>"+emailCc+
"<br><b>Subject: </b>"+oldSubject+"<br>";
if(!messageFld.isEmpty()) {
String oldBody = ((MemoFieldData) messageFld).getText();
if(!StringUtil.isStringEmpty(oldBody)) {
if(!HtmlEditFrame.isHTML(oldBody)) {
newBody = "\n------------- Original message -------------" +
StringUtil.htmlToText(newBody);
}
newBody += oldBody;
} else {
newBody += HtmlEditFrame.HTML_INDICATOR;
}
} else {
newBody += HtmlEditFrame.HTML_INDICATOR;
}
AccountReplyEmailAsyncCallback callback;
switch(answerType){
case REPLY_TYPE:
String newSubject = "";
if(objTypeFld.isEmpty() || objIdFld.isEmpty()){
DialogHelper.showModalMessageDialog("Can't proceed message with empty object id or object type.");
return;
}
int objectType = (int)((ListboxFieldData)objTypeFld).getItemsSelected().getSelectedIDs()[0];
long objectId = Long.parseLong( ((TextboxFieldData)objIdFld).getText() );
if(objectType == OperationsHelper.TICKET_OBJECT_TYPE) {
newSubject = TICKET_ID_CAPTION + objectId;
} else if(objectType == OperationsHelper.INTERACTION_OBJECT_TYPE) {
newSubject = INTERACTION_ID_CAPTION + objectId;
}
newSubject = ("RE: QueWeb "+newSubject+" : "+oldSubject).substring(0,255);
initVals.put(EmailComposeHelper.TO_MAP_FIELD, senderMail);
initVals.put(EmailComposeHelper.SUBJECT_MAP_FIELD, newSubject);
initVals.put(EmailComposeHelper.BODY_MAP_FIELD, newBody);
if(replyDialog == null){
replyDialog = new ReplyComposeDialog();
}
callback = new AccountReplyEmailAsyncCallback(objectType, objectId);
break;
case FORWARD_TYPE:
initVals.put(EmailComposeHelper.SUBJECT_MAP_FIELD,"FW: "+oldSubject);
initVals.put(EmailComposeHelper.BODY_MAP_FIELD, newBody);
if(forwardDialog == null){
forwardDialog = new EmailComposeDialog("Forward Compose Form", false, true);
}
callback = new AccountReplyEmailAsyncCallback();
break;
default:
DialogHelper.showModalMessageDialog("Unsupported answer type.");
return;
}
if(!accountIdFld.isEmpty()){
Long accId = ((EntityReferenceData)accountIdFld).getSelectedRowID();
if(accId != null ){
CustomRPC.getCustomRPC().getAccountReplyEmail(accId, callback);
}
}
}
public void forwardClick(FamgMeta.Index form) {
composeAnswer(FORWARD_TYPE, form);
}
public void replyClick(FamgMeta.Index form) {
composeAnswer(REPLY_TYPE, form);
/*initVals = new HashMap();
QFormModel qFormModel = form.getModel();
FieldData senderMailFld = qFormModel.getElementData(INBOX_MSG_SENDER_EMAIL_FIELD);
FieldData toFld = qFormModel.getElementData(INBOX_EMAIL_TO_FIELD);
FieldData ccFld = qFormModel.getElementData(INBOX_EMAIL_CC_FIELD);
FieldData subjectFld = qFormModel.getElementData(INBOX_SUBJCT_FIELD);
FieldData messageFld = qFormModel.getElementData(INBOX_MESSAGE_FIELD);
FieldData sentDateFld = qFormModel.getElementData(INBOX_SENT_DATE_FIELD);
FieldData objTypeFld = qFormModel.getElementData(INBOX_OBJ_TYPE_FIELD);
FieldData objIdFld = qFormModel.getElementData(INBOX_OBJ_ID_FIELD);
FieldData accountIdFld = qFormModel.getElementData(INBOX_ACCOUNT_ID_FIELD);
if(objTypeFld.isEmpty() || objIdFld.isEmpty()){
DialogHelper.showModalMessageDialog("Can't send reply with empty object id or object type.");
return EMPTY_BREAK_RESPONSE;
}
int objectType = (int)((ListboxFieldData)objTypeFld).getItemsSelected().getSelectedIDs()[0];
long objectId = Long.parseLong( ((TextboxFieldData)objIdFld).getText() );
String senderMail = "";
if(!senderMailFld.isEmpty()){
senderMail = ((TextboxFieldData)senderMailFld).getText();
initVals.put(EmailComposeHelper.TO_MAP_FIELD, senderMail);
}
String emailTo = "";
String emailCc = "";
String sentDate = "";
String oldSubject = "";
if(!toFld.isEmpty()){
emailTo = ((TextboxFieldData)toFld).getText();
}
if(!ccFld.isEmpty()){
emailCc = ((TextboxFieldData)ccFld).getText();
}
if(!sentDateFld.isEmpty()){
sentDate = ((DateFieldData)sentDateFld).getFormatedDate();
}
if(!subjectFld.isEmpty()){
oldSubject = ((TextboxFieldData)subjectFld).getText();
}
String newSubject = "";
if(objectType == HandlerHelper.TICKET_OBJECT_TYPE)
newSubject = HandlerHelper.TICKET_ID_CAPTION + objectId;
else if(objectType == HandlerHelper.INTERACTION_OBJECT_TYPE)
newSubject = HandlerHelper.INTERACTION_ID_CAPTION + objectId;
newSubject = ("RE: QueWeb "+newSubject+" : "+oldSubject).substring(0,255);
initVals.put(EmailComposeHelper.SUBJECT_MAP_FIELD, newSubject);
String newBody = "<br><hr><b>From: </b>"+senderMail+"<br><b>Sent: </b>"+sentDate+
"<br><b>To: </b>"+emailTo+"<br><b>Cc: </b>"+emailCc+
"<br><b>Subject: </b>"+oldSubject+"<br>";
if(!messageFld.isEmpty()){
String oldBody = ((MemoFieldData)messageFld).getText();
if(!StringUtil.isStringEmpty(oldBody)){
if(!HtmlEditFrame.isHTML(oldBody))
newBody = "\n------------- Original message -------------"+
StringUtil.htmlToText(newBody);
newBody += oldBody;
}
else
newBody += HtmlEditFrame.HTML_INDICATOR;
}
else
newBody += HtmlEditFrame.HTML_INDICATOR;
initVals.put(EmailComposeHelper.BODY_MAP_FIELD, newBody);
if(replyDialog == null){
replyDialog = new ReplyComposeDialog();
}
if(!accountIdFld.isEmpty()){
Long accId = ((EntityReferenceData)accountIdFld).getSelectedRowID();
if(accId != null ){
AccountReplyEmailAsyncCallback callback = new AccountReplyEmailAsyncCallback(objectType, objectId);
CustomRPC.getCustomRPC().getAccountReplyEmail(accId, callback);
}
}*/
//return EMPTY_CONTINUE_RESPONSE;
}
private class AccountReplyEmailAsyncCallback extends RPC.QAsyncCallback {
int objectType = -1;
long objectId = -1;
int answerType;
public AccountReplyEmailAsyncCallback(int objType, long objId) {
objectType = objType;
objectId = objId;
answerType = REPLY_TYPE;
}
public AccountReplyEmailAsyncCallback() {
answerType = FORWARD_TYPE;
}
public void onRequestEnded(boolean success, Object result) {
if(success) {
if(result == null || ((String) result).trim().length() == 0) {
DialogHelper.showModalMessageDialog(
"Can't get account reply email. Message can't be sent.");
return;
}
String fromAdr = (String) result;
initVals.put(EmailComposeHelper.FROM_MAP_FIELD, fromAdr);
switch(answerType) {
case REPLY_TYPE:
replyDialog.setInitialDataMap(initVals);
replyDialog.setObjectType(objectType);
replyDialog.setObjectId(objectId);
replyDialog.show(true);
break;
case FORWARD_TYPE:
forwardDialog.setInitialDataMap(initVals);
forwardDialog.show(true);
break;
default:
DialogHelper.showModalMessageDialog(
"Unsupported answer type.");
}
} else {
DialogHelper.showModalMessageDialog(
"RPC call failed. Message can't be sent.");
}
}
}
protected class CreateDeleteAsyncCallback extends RPC.QAsyncCallback {
private FamgMeta.Index form;
CreateDeleteAsyncCallback(FamgMeta.Index form) {
this.form = form;
}
public void onRequestEnded(boolean success, Object result) {
if (success) {
Boolean rv = (Boolean) result;
if (rv.booleanValue()) {
DialogHelper.showModalMessageDialog("Record(s) deleted");
FormOperations context = getOperationContext().getFormOperations();
context.turnFormToState(form, FormState.SEARCH_STATE);
context.clearForm(form, false);
getOperationContext().performOperation(OperationTypes.SEARCH_RECORDS, form);
} else {
DialogHelper.showModalMessageDialog("Record cannot delete");
}
} else {
DialogHelper.showModalMessageDialog("RPC call failed.");
}
}
}
public void setTicketFormId(String ticketFormId) {
this.ticketFormId = ticketFormId;
}
public void setInterFormId(String interFormId) {
this.interFormId = interFormId;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -