Commit 4bbc8b5d authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

(1.0.0.118): FileConverterUtils2

для send mail merge

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@62342 954022d7-b5bf-4e40-9824-e11837661b57
parent b25aa0e3
...@@ -7,6 +7,7 @@ var c_oAscMaxRowHeight = 409; ...@@ -7,6 +7,7 @@ var c_oAscMaxRowHeight = 409;
//files type for Saving & DownloadAs //files type for Saving & DownloadAs
var c_oAscFileType = { var c_oAscFileType = {
UNKNOWN : 0,
PDF : 0x0201, PDF : 0x0201,
HTML : 0x0803, HTML : 0x0803,
...@@ -52,7 +53,8 @@ var c_oAscAsyncAction = { ...@@ -52,7 +53,8 @@ var c_oAscAsyncAction = {
SlowOperation : 11, // медленная операция SlowOperation : 11, // медленная операция
LoadTheme : 12, // загрузка темы LoadTheme : 12, // загрузка темы
MailMergeLoadFile : 13, // загрузка файла для mail merge MailMergeLoadFile : 13, // загрузка файла для mail merge
DownloadMerge : 14 // cкачать файл с mail merge DownloadMerge : 14, // cкачать файл с mail merge
SendMailMerge : 15 // рассылка mail merge по почте
}; };
// Режимы отрисовки // Режимы отрисовки
...@@ -589,6 +591,10 @@ var c_oAscLineBeginSize = { ...@@ -589,6 +591,10 @@ var c_oAscLineBeginSize = {
large_mid : 7, large_mid : 7,
large_large : 8 large_large : 8
}; };
var c_oAscMailMergeMailFormat = {
html : 0,
attach : 1
};
var c_oAscMaxTooltipLength = 256; var c_oAscMaxTooltipLength = 256;
var c_oAscMaxCellOrCommentLength = 32767; // По идее должно быть 32768, но видимо сравнение идеть на меньше (а не меньше либо равно) var c_oAscMaxCellOrCommentLength = 32767; // По идее должно быть 32768, но видимо сравнение идеть на меньше (а не меньше либо равно)
\ No newline at end of file
...@@ -286,6 +286,68 @@ var DocumentPageSize = new function() { ...@@ -286,6 +286,68 @@ var DocumentPageSize = new function() {
}; };
}; };
function CMailMergeSendData (obj){
if(obj){
if (typeof obj.from != 'undefined'){
this.from = obj.from;
}
if (typeof obj.to != 'undefined'){
this.to = obj.to;
}
if (typeof obj.subject != 'undefined'){
this.subject = obj.subject;
}
if (typeof obj.mailFormat != 'undefined'){
this.mailFormat = obj.mailFormat;
}
if (typeof obj.fileName != 'undefined'){
this.fileName = obj.fileName;
}
if (typeof obj.message != 'undefined'){
this.message = obj.message;
}
if (typeof obj.recordFrom != 'undefined'){
this.recordFrom = obj.recordFrom;
}
if (typeof obj.recordTo != 'undefined'){
this.recordTo = obj.recordTo;
}
if (typeof obj.jsonKey != 'undefined'){
this.jsonKey = obj.jsonKey;
}
}
else
{
this.from = null;
this.to = null;
this.subject = null;
this.mailFormat = null;
this.fileName = null;
this.message = null;
this.recordFrom = null;
this.recordTo = null;
this.jsonKey = null;
}
}
CMailMergeSendData.prototype.get_From = function(){return this.from};
CMailMergeSendData.prototype.put_From = function(v){this.from = v;};
CMailMergeSendData.prototype.get_To = function(){return this.to};
CMailMergeSendData.prototype.put_To = function(v){this.to = v;};
CMailMergeSendData.prototype.get_Subject = function(){return this.subject};
CMailMergeSendData.prototype.put_Subject = function(v){this.subject = v;};
CMailMergeSendData.prototype.get_MailFormat = function(){return this.mailFormat};
CMailMergeSendData.prototype.put_MailFormat = function(v){this.mailFormat = v;};
CMailMergeSendData.prototype.get_FileName = function(){return this.fileName};
CMailMergeSendData.prototype.put_FileName = function(v){this.fileName = v;};
CMailMergeSendData.prototype.get_Message = function(){return this.message};
CMailMergeSendData.prototype.put_Message = function(v){this.message = v;};
CMailMergeSendData.prototype.get_RecordFrom = function(){return this.recordFrom};
CMailMergeSendData.prototype.put_RecordFrom = function(v){this.recordFrom = v;};
CMailMergeSendData.prototype.get_RecordTo = function(){return this.recordTo};
CMailMergeSendData.prototype.put_RecordTo = function(v){this.recordTo = v;};
CMailMergeSendData.prototype.get_JsonKey = function(){return this.jsonKey};
CMailMergeSendData.prototype.put_JsonKey = function(v){this.jsonKey = v;};
// пользоваться так: // пользоваться так:
// подрубить его последним из скриптов к страничке // подрубить его последним из скриптов к страничке
// и вызвать, после подгрузки (конец метода OnInit <- Drawing/HtmlPage.js) // и вызвать, после подгрузки (конец метода OnInit <- Drawing/HtmlPage.js)
...@@ -348,7 +410,10 @@ function asc_docs_api(name) ...@@ -348,7 +410,10 @@ function asc_docs_api(name)
this.isApplyChangesOnOpenEnabled = true; this.isApplyChangesOnOpenEnabled = true;
this.mailMergeFileData = null; this.mailMergeFileData = null;
this.mailMergeFileKey = null;
this.mailMergeSendData = null;
this.mailMergeSendTimeout = null;
// CoAuthoring and Chat // CoAuthoring and Chat
this.User = undefined; this.User = undefined;
this.CoAuthoringApi = new CDocsCoApi(); this.CoAuthoringApi = new CDocsCoApi();
...@@ -1445,7 +1510,20 @@ asc_docs_api.prototype._coAuthoringInit = function() ...@@ -1445,7 +1510,20 @@ asc_docs_api.prototype._coAuthoringInit = function()
} }
}; };
this.CoAuthoringApi.onMailMerge = function (isSuccess) { this.CoAuthoringApi.onMailMerge = function (isSuccess) {
// ToDo обработать результат isSuccess = true/false var oMailMergeSendData = t.mailMergeSendData;
t.mailMergeSendData = null;
oMailMergeSendData.put_JsonKey(t.mailMergeFileKey);
if(null != t.mailMergeSendTimeout)
clearTimeout(t.mailMergeSendTimeout);
if(isSuccess){
_downloadAs(t, "sendmm", null, oMailMergeSendData, c_oAscFileType.UNKNOWN, function(incomeObject){
t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.SendMailMerge);
});
}
else{
// ToDo обработать результат isSuccess = true/false
t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.SendMailMerge);
}
}; };
this.CoAuthoringApi.init(this.User, documentId, documentCallbackUrl, 'fghhfgsjdgfjs', function(){}, this.CoAuthoringApi.init(this.User, documentId, documentCallbackUrl, 'fghhfgsjdgfjs', function(){},
...@@ -2204,7 +2282,7 @@ asc_docs_api.prototype.asc_Print = function() ...@@ -2204,7 +2282,7 @@ asc_docs_api.prototype.asc_Print = function()
editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Print);}, rData); editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Print);}, rData);
} }
else else
_downloadAs(this, null, c_oAscFileType.PDF, function(incomeObject){ _downloadAs(this, "save", null, null, c_oAscFileType.PDF, function(incomeObject){
if(null != incomeObject && "save" == incomeObject["type"]) if(null != incomeObject && "save" == incomeObject["type"])
editor.processSavedFile(incomeObject["data"], false); editor.processSavedFile(incomeObject["data"], false);
else{ else{
...@@ -2370,7 +2448,7 @@ asc_docs_api.prototype.asc_DownloadAs = function(typeFile) {//передаем ...@@ -2370,7 +2448,7 @@ asc_docs_api.prototype.asc_DownloadAs = function(typeFile) {//передаем
var actionType = this.mailMergeFileData ? c_oAscAsyncAction.MailMergeLoadFile : c_oAscAsyncAction.DownloadAs; var actionType = this.mailMergeFileData ? c_oAscAsyncAction.MailMergeLoadFile : c_oAscAsyncAction.DownloadAs;
this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, actionType); this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, actionType);
var t = this; var t = this;
_downloadAs(this, null, typeFile, function (incomeObject) { _downloadAs(this, "save", null, null, typeFile, function (incomeObject) {
if (null != incomeObject && "save" == incomeObject["type"]) if (null != incomeObject && "save" == incomeObject["type"])
t.processSavedFile(incomeObject["data"], false); t.processSavedFile(incomeObject["data"], false);
else{ else{
...@@ -2389,7 +2467,7 @@ asc_docs_api.prototype.asc_DownloadAsMailMerge = function(typeFile, StartIndex, ...@@ -2389,7 +2467,7 @@ asc_docs_api.prototype.asc_DownloadAsMailMerge = function(typeFile, StartIndex,
if(bIsDownload) if(bIsDownload)
this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, actionType); this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, actionType);
var t = this; var t = this;
_downloadAs(this, oDocumentMailMerge, typeFile, function (incomeObject) { _downloadAs(this, "save", oDocumentMailMerge, null, typeFile, function (incomeObject) {
if(bIsDownload){ if(bIsDownload){
if (null != incomeObject && "save" == incomeObject["type"]) if (null != incomeObject && "save" == incomeObject["type"])
t.processSavedFile(incomeObject["data"], false); t.processSavedFile(incomeObject["data"], false);
...@@ -7016,6 +7094,10 @@ function sendCommand(editor, fCallback, rdata){ ...@@ -7016,6 +7094,10 @@ function sendCommand(editor, fCallback, rdata){
break; break;
case "waitsave": case "waitsave":
{ {
if( c_oAscFileType.JSON == rdata["outputformat"]){
var waitSaveData = JSON.parse(incomeObject["data"]);
editor.mailMergeFileKey = waitSaveData["key"] + "/output.json";
}
rData = { rData = {
"id":documentId, "id":documentId,
"userid": documentUserId, "userid": documentUserId,
...@@ -7100,14 +7182,16 @@ function _onOpenCommand(fCallback, incomeObject) { ...@@ -7100,14 +7182,16 @@ function _onOpenCommand(fCallback, incomeObject) {
} }
}); });
} }
function _downloadAs(editor, oDocumentMailMerge, filetype, fCallback) { function _downloadAs(editor, command, oDocumentMailMerge, oMailMergeSendData, filetype, fCallback) {
var oAdditionalData = {}; var oAdditionalData = {};
oAdditionalData["c"] = "save"; oAdditionalData["c"] = command;
oAdditionalData["id"] = documentId; oAdditionalData["id"] = documentId;
oAdditionalData["userid"] = documentUserId; oAdditionalData["userid"] = documentUserId;
oAdditionalData["vkey"] = documentVKey; oAdditionalData["vkey"] = documentVKey;
oAdditionalData["outputformat"] = filetype; oAdditionalData["outputformat"] = filetype;
oAdditionalData["savetype"] = c_oAscSaveTypes.CompleteAll; oAdditionalData["savetype"] = c_oAscSaveTypes.CompleteAll;
if(null != oMailMergeSendData)
oAdditionalData["mailmergesend"] = oMailMergeSendData;
if (null == oDocumentMailMerge && c_oAscFileType.PDF === filetype) { if (null == oDocumentMailMerge && c_oAscFileType.PDF === filetype) {
var dd = editor.WordControl.m_oDrawingDocument; var dd = editor.WordControl.m_oDrawingDocument;
oAdditionalData["data"] = dd.ToRendererPart(); oAdditionalData["data"] = dd.ToRendererPart();
...@@ -7462,6 +7546,20 @@ asc_docs_api.prototype.asc_setMailMergeData = function(aList) ...@@ -7462,6 +7546,20 @@ asc_docs_api.prototype.asc_setMailMergeData = function(aList)
{ {
this.asc_StartMailMergeByList(aList); this.asc_StartMailMergeByList(aList);
}; };
asc_docs_api.prototype.asc_sendMailMergeData = function(oData)
{
var oThis = this;
var actionType = c_oAscAsyncAction.SendMailMerge;
this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, actionType);
this.mailMergeSendData = oData;
this.mailMergeSendTimeout = setTimeout(function () {
if(null != oThis.mailMergeSendData){
oThis.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, actionType);
oThis.mailMergeSendData = null;
this.mailMergeSendTimeout = null;
}
}, 10000);
};
asc_docs_api.prototype.asc_stopSaving = function () { asc_docs_api.prototype.asc_stopSaving = function () {
this.waitSave = true; this.waitSave = true;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment