Commit 5cad5cde authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

sendTrack вынес в общую функцию в Common/editorscommon.js

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@63211 954022d7-b5bf-4e40-9824-e11837661b57
parent 595f5833
...@@ -131,6 +131,20 @@ function sendCommand2 (fCallback, callback, rdata) { ...@@ -131,6 +131,20 @@ function sendCommand2 (fCallback, callback, rdata) {
dataType: 'text' dataType: 'text'
}); });
} }
function sendTrack (fCallback, url, rdata) {
asc_ajax({
type: 'POST',
url: url,
data: rdata,
contentType: "application/json",
error: function() {
if (fCallback) fCallback();
},
success: function(msg){
if (fCallback) fCallback((!msg || msg.length < 1) ? null : JSON.parse(msg));
},
dataType: "text"});
}
function g_fMapAscServerErrorToAscError (nServerError) { function g_fMapAscServerErrorToAscError (nServerError) {
var nRes = c_oAscError.ID.Unknown; var nRes = c_oAscError.ID.Unknown;
......
...@@ -1011,29 +1011,6 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -1011,29 +1011,6 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
} }
}; };
spreadsheet_api.prototype._asc_sendTrack = function (callback, url, rdata) {
asc_ajax({
type: 'POST',
url: url,
data: rdata,
contentType: "application/json",
error: function() {
if (callback)
callback({returnCode: c_oAscError.Level.Critical, val:c_oAscError.ID.Unknown});
},
success: function(msg){
if (!msg || msg.length < 1) {
if (callback)
callback({returnCode: c_oAscError.Level.Critical, val:c_oAscError.ID.Unknown});
} else {
var incomeObject = JSON.parse(msg);
if (callback)
callback(incomeObject);
}
},
dataType: "text"});
};
spreadsheet_api.prototype._onOpenCommand = function (callback, data) { spreadsheet_api.prototype._onOpenCommand = function (callback, data) {
var t = this; var t = this;
g_fOpenFileCommand(data, this.documentUrlChanges, Asc.c_oSerFormat.Signature, function (error, result) { g_fOpenFileCommand(data, this.documentUrlChanges, Asc.c_oSerFormat.Signature, function (error, result) {
...@@ -1456,19 +1433,14 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -1456,19 +1433,14 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.handlers.trigger("asc_onGetEditorPermissions", oEditorPermissions); this.handlers.trigger("asc_onGetEditorPermissions", oEditorPermissions);
if (undefined != oSettings['trackingInfo'] && null != oSettings['trackingInfo'] && oEditorPermissions.asc_getCanEdit()) { if (null != oSettings['trackingInfo'] && oEditorPermissions.asc_getCanEdit()) {
this.TrackFile = new asc_CTrackFile(oSettings['trackingInfo']); this.TrackFile = new asc_CTrackFile(oSettings['trackingInfo']);
this.TrackFile.setDocId(this.DocInfo["Id"]); this.TrackFile.setDocId(this.DocInfo["Id"]);
this.TrackFile.setUserId(this.DocInfo["UserId"]); this.TrackFile.setUserId(this.DocInfo["UserId"]);
this.TrackFile.setTrackFunc(sendTrack);
var oThis = this; if (null != oSettings['TrackingInterval'])
var _sendTrack = function (callback, url, data) {
return oThis._asc_sendTrack(callback, url, data);
};
this.TrackFile.setTrackFunc(_sendTrack);
if (undefined != oSettings['TrackingInterval'] && null != oSettings['TrackingInterval'])
this.TrackFile.setInterval(oSettings['TrackingInterval']); this.TrackFile.setInterval(oSettings['TrackingInterval']);
this.TrackFile.Start(); this.TrackFile.Start();
......
...@@ -773,7 +773,7 @@ asc_docs_api.prototype.asc_getEditorPermissionsCallback = function(response) { ...@@ -773,7 +773,7 @@ asc_docs_api.prototype.asc_getEditorPermissionsCallback = function(response) {
var oEditorPermissions = new asc_CAscEditorPermissions(oSettings); var oEditorPermissions = new asc_CAscEditorPermissions(oSettings);
this.asc_fireCallback("asc_onGetEditorPermissions", oEditorPermissions); this.asc_fireCallback("asc_onGetEditorPermissions", oEditorPermissions);
if (undefined != oSettings['trackingInfo'] && null != oSettings['trackingInfo'] && oEditorPermissions.asc_getCanEdit()) { if (null != oSettings['trackingInfo'] && oEditorPermissions.asc_getCanEdit()) {
var asc_CTrackFile = window["Asc"].CTrackFile; var asc_CTrackFile = window["Asc"].CTrackFile;
this.TrackFile = new asc_CTrackFile(oSettings['trackingInfo']); this.TrackFile = new asc_CTrackFile(oSettings['trackingInfo']);
...@@ -781,7 +781,7 @@ asc_docs_api.prototype.asc_getEditorPermissionsCallback = function(response) { ...@@ -781,7 +781,7 @@ asc_docs_api.prototype.asc_getEditorPermissionsCallback = function(response) {
this.TrackFile.setUserId(this.DocInfo.get_UserId()); this.TrackFile.setUserId(this.DocInfo.get_UserId());
this.TrackFile.setTrackFunc(sendTrack); this.TrackFile.setTrackFunc(sendTrack);
if (undefined != oSettings['TrackingInterval'] && null != oSettings['TrackingInterval']) if (null != oSettings['TrackingInterval'])
this.TrackFile.setInterval(oSettings['TrackingInterval']); this.TrackFile.setInterval(oSettings['TrackingInterval']);
this.TrackFile.Start(); this.TrackFile.Start();
...@@ -5176,23 +5176,6 @@ function _sendCommandCallback (fCallback, error, result) { ...@@ -5176,23 +5176,6 @@ function _sendCommandCallback (fCallback, error, result) {
break; break;
} }
} }
function sendTrack(fCallback, url, rdata){
asc_ajax({
type: 'POST',
url: url,
data: rdata,
contentType: "application/json",
error: function(){
if(fCallback)
fCallback();
},
success: function(msg){
var incomeObject = JSON.parse(msg);
if(fCallback)
fCallback(incomeObject);
}
})
}
function _onOpenCommand(fCallback, incomeObject) { function _onOpenCommand(fCallback, incomeObject) {
g_fOpenFileCommand(incomeObject["data"], documentUrlChanges, c_oSerFormat.Signature, function (error, result) { g_fOpenFileCommand(incomeObject["data"], documentUrlChanges, c_oSerFormat.Signature, function (error, result) {
if (error || !result.bSerFormat) { if (error || !result.bSerFormat) {
......
...@@ -804,7 +804,7 @@ asc_docs_api.prototype.asc_getEditorPermissionsCallback = function(response) { ...@@ -804,7 +804,7 @@ asc_docs_api.prototype.asc_getEditorPermissionsCallback = function(response) {
var oEditorPermissions = new asc_CAscEditorPermissions(oSettings); var oEditorPermissions = new asc_CAscEditorPermissions(oSettings);
this.asc_fireCallback("asc_onGetEditorPermissions", oEditorPermissions); this.asc_fireCallback("asc_onGetEditorPermissions", oEditorPermissions);
if (undefined != oSettings['trackingInfo'] && null != oSettings['trackingInfo'] && oEditorPermissions.asc_getCanEdit()) { if (null != oSettings['trackingInfo'] && oEditorPermissions.asc_getCanEdit()) {
var asc_CTrackFile = window["Asc"].CTrackFile; var asc_CTrackFile = window["Asc"].CTrackFile;
this.TrackFile = new asc_CTrackFile(oSettings['trackingInfo']); this.TrackFile = new asc_CTrackFile(oSettings['trackingInfo']);
...@@ -812,7 +812,7 @@ asc_docs_api.prototype.asc_getEditorPermissionsCallback = function(response) { ...@@ -812,7 +812,7 @@ asc_docs_api.prototype.asc_getEditorPermissionsCallback = function(response) {
this.TrackFile.setUserId(this.DocInfo.get_UserId()); this.TrackFile.setUserId(this.DocInfo.get_UserId());
this.TrackFile.setTrackFunc(sendTrack); this.TrackFile.setTrackFunc(sendTrack);
if (undefined != oSettings['TrackingInterval'] && null != oSettings['TrackingInterval']) if (null != oSettings['TrackingInterval'])
this.TrackFile.setInterval(oSettings['TrackingInterval']); this.TrackFile.setInterval(oSettings['TrackingInterval']);
this.TrackFile.Start(); this.TrackFile.Start();
...@@ -7105,23 +7105,6 @@ function _sendCommandCallback (fCallback, error, result) { ...@@ -7105,23 +7105,6 @@ function _sendCommandCallback (fCallback, error, result) {
} }
} }
function sendTrack(fCallback, url, rdata){
asc_ajax({
type: 'POST',
url: url,
data: rdata,
contentType: "application/json",
error: function(){
if(fCallback)
fCallback();
},
success: function(msg){
var incomeObject = JSON.parse(msg);
if(fCallback)
fCallback(incomeObject);
}
})
}
function _onOpenCommand(fCallback, incomeObject) { function _onOpenCommand(fCallback, incomeObject) {
g_fOpenFileCommand(incomeObject["data"], documentUrlChanges, c_oSerFormat.Signature, function (error, result) { g_fOpenFileCommand(incomeObject["data"], documentUrlChanges, c_oSerFormat.Signature, function (error, result) {
if (error) { if (error) {
......
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