Commit 0b2b4a90 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Перенес проверку лицензии в Private

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@64954 954022d7-b5bf-4e40-9824-e11837661b57
parent 998b29ad
......@@ -4,7 +4,7 @@ var g_sLicenseDefaultUrl = "/license";
var g_sPublicRSAKey = '-----BEGIN CERTIFICATE-----MIIBvTCCASYCCQD55fNzc0WF7TANBgkqhkiG9w0BAQUFADAjMQswCQYDVQQGEwJKUDEUMBIGA1UEChMLMDAtVEVTVC1SU0EwHhcNMTAwNTI4MDIwODUxWhcNMjAwNTI1MDIwODUxWjAjMQswCQYDVQQGEwJKUDEUMBIGA1UEChMLMDAtVEVTVC1SU0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANGEYXtfgDRlWUSDn3haY4NVVQiKI9CzThoua9+DxJuiseyzmBBe7Roh1RPqdvmtOHmEPbJ+kXZYhbozzPRbFGHCJyBfCLzQfVos9/qUQ88u83b0SFA2MGmQWQAlRtLy66EkR4rDRwTj2DzR4EEXgEKpIvo8VBs/3+sHLF3ESgAhAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAEZ6mXFFq3AzfaqWHmCy1ARjlauYAa8ZmUFnLm0emg9dkVBJ63aEqARhtok6bDQDzSJxiLpCEF6G4b/Nv/M/MLyhP+OoOTmETMegAVQMq71choVJyOFE5BtQa6M/lCHEOya5QUfoRF2HF9EjRF44K3OK+u3ivTSj3zwjtpudY5Xo=-----END CERTIFICATE-----';
var g_sAESKey = '7f3d2338390c1e3e154c21005f51010e065b0f1a1e101600202473150c022a11';
function CheckLicense(licenseUrl, callback) {
function CheckLicense(licenseUrl, userId, callback) {
licenseUrl = licenseUrl ? licenseUrl : g_sLicenseDefaultUrl;
require('jsziputils').getBinaryContent(licenseUrl, function(err, data) {
if (err) {
......
......@@ -132,10 +132,6 @@ DocumentUrls.prototype = {
};
var g_oDocumentUrls = new DocumentUrls();
function CheckLicense(licenseUrl, callback) {
callback(false, false);
}
function OpenFileResult () {
this.bSerFormat = false;
this.data = null;
......
......@@ -5,27 +5,50 @@
* Author: Alexander.Trofimov@avsmedia.net
* Date: Apr 23, 2015
*/
(
/**
* @param {jQuery} $
* @param {Window} window
* @param {undefined} undefined
*/
function ($, window, undefined) {
(/**
* @param {jQuery} $
* @param {Window} window
* @param {undefined} undefined
*/
function($, window, undefined) {
var asc = window["Asc"];
var prot;
var asc = window["Asc"];
var prot;
asc['spreadsheet_api'].prototype.asc_addComment = function(oComment) {
if (oComment.bDocument) {
this.wb.cellCommentator.asc_addComment(oComment);
} else {
var ws = this.wb.getWorksheet();
ws.cellCommentator.asc_addComment(oComment);
}
};
asc['spreadsheet_api'].prototype.asc_addComment = function (oComment) {
if (oComment.bDocument)
this.wb.cellCommentator.asc_addComment(oComment);
else {
var ws = this.wb.getWorksheet();
ws.cellCommentator.asc_addComment(oComment);
}
};
asc['spreadsheet_api'].prototype.asc_getEditorPermissions = function(licenseUrl) {
var t = this;
if (this.DocInfo && this.DocInfo["Id"] && this.DocInfo["Url"]) {
CheckLicense(licenseUrl, this.DocInfo["UserId"], function(err, res) {
t._onCheckLicenseEnd(err, res);
});
} else {
// Фиктивный вызов
this._onCheckLicenseEnd(true, false);
}
this._coAuthoringInit();
};
asc['spreadsheet_api'].prototype._onCheckLicenseEnd = function(err, res) {
this.licenseResult = {err: err, res: res};
this._onEndPermissions();
};
asc['spreadsheet_api'].prototype._onEndPermissions = function() {
if (null !== this.licenseResult && this.isOnFirstConnectEnd) {
var oResult = new asc.asc_CAscEditorPermissions();
oResult.asc_setCanLicense(this.licenseResult.res);
this.handlers.trigger('asc_onGetEditorPermissions', oResult);
}
};
prot = asc['spreadsheet_api'].prototype;
prot['asc_addComment'] = prot.asc_addComment;
}
)(jQuery, window);
prot = asc['spreadsheet_api'].prototype;
prot['asc_addComment'] = prot.asc_addComment;
prot['asc_getEditorPermissions'] = prot.asc_getEditorPermissions;
})(jQuery, window);
......@@ -15,7 +15,6 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
var asc_applyFunction = asc.applyFunction;
var asc_CCollaborativeEditing = asc.CCollaborativeEditing;
var asc_CAdjustPrint = asc.asc_CAdjustPrint;
var asc_CAscEditorPermissions = asc.asc_CAscEditorPermissions;
var prot;
var CDocsCoApi = window["CDocsCoApi"];
......@@ -535,27 +534,12 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
CHART_STYLE_MANAGER = new CChartStyleManager();
};
spreadsheet_api.prototype.asc_getEditorPermissions = function(licenseUrl) {
var t = this;
if (this.DocInfo && this.DocInfo["Id"] && this.DocInfo["Url"]) {
CheckLicense(licenseUrl, function (err, res) {
t._onCheckLicenseEnd(err, res);
});
} else {
// Фиктивный вызов
this._onCheckLicenseEnd(true, false);
}
spreadsheet_api.prototype.asc_getEditorPermissions = function() {
this._coAuthoringInit();
};
spreadsheet_api.prototype._onCheckLicenseEnd = function(err, res) {
this.licenseResult = {err: err, res: res};
this._sendLicenseInfo();
};
spreadsheet_api.prototype._sendLicenseInfo = function() {
if (null !== this.licenseResult && this.isOnFirstConnectEnd) {
var oResult = asc_CAscEditorPermissions();
oResult.asc_setCanLicense(this.licenseResult.res);
this.handlers.trigger('asc_onGetEditorPermissions', oResult);
spreadsheet_api.prototype._onEndPermissions = function() {
if (this.isOnFirstConnectEnd) {
this.handlers.trigger('asc_onGetEditorPermissions', new asc.asc_CAscEditorPermissions());
}
};
......@@ -1568,7 +1552,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
};
this.CoAuthoringApi.onFirstConnect = function() {
t.isOnFirstConnectEnd = true;
t._sendLicenseInfo();
t._onEndPermissions();
};
/**
* Event об отсоединении от сервера
......
"use strict";
asc_docs_api.prototype.asc_addComment = function(AscCommentData)
{
//if ( true === CollaborativeEditing.Get_GlobalLock() )
// return;
asc_docs_api.prototype.asc_addComment = function(AscCommentData) {
//if ( true === CollaborativeEditing.Get_GlobalLock() )
// return;
if (null == this.WordControl.m_oLogicDocument)
return;
if (null == this.WordControl.m_oLogicDocument) {
return;
}
var CommentData = new CCommentData();
CommentData.Read_FromAscCommentData(AscCommentData);
var CommentData = new CCommentData();
CommentData.Read_FromAscCommentData(AscCommentData);
var Comment = this.WordControl.m_oLogicDocument.Add_Comment( CommentData );
if (Comment )
return Comment.Get_Id();
var Comment = this.WordControl.m_oLogicDocument.Add_Comment(CommentData);
if (Comment) {
return Comment.Get_Id();
}
};
asc_docs_api.prototype.asc_getEditorPermissions = function(licenseUrl) {
var t = this;
if (this.DocInfo && this.DocInfo.get_Id()) {
CheckLicense(licenseUrl, this.DocInfo.get_UserId(), function(err, res) {
t._onCheckLicenseEnd(err, res);
});
} else {
// Фиктивный вызов
this._onCheckLicenseEnd(true, false);
}
this._coAuthoringInit();
};
asc_docs_api.prototype._onCheckLicenseEnd = function(err, res) {
this.licenseResult = {err: err, res: res};
this._onEndPermissions();
};
asc_docs_api.prototype._onEndPermissions = function() {
if (null !== this.licenseResult && this.isOnFirstConnectEnd) {
var oResult = new window['Asc'].asc_CAscEditorPermissions();
oResult.asc_setCanLicense(this.licenseResult.res);
this.asc_fireCallback('asc_onGetEditorPermissions', oResult);
}
};
\ No newline at end of file
......@@ -466,7 +466,7 @@ asc_docs_api.prototype._coAuthoringInit = function () {
};
this.CoAuthoringApi.onFirstConnect = function() {
t.isOnFirstConnectEnd = true;
t._sendLicenseInfo();
t._onEndPermissions();
};
/**
* Event об отсоединении от сервера
......@@ -694,77 +694,62 @@ asc_docs_api.prototype.sync_ChangeLastSelectedElement = function(type, obj)
}
};
asc_docs_api.prototype.Init = function()
{
this.WordControl.Init();
asc_docs_api.prototype.Init = function() {
this.WordControl.Init();
};
asc_docs_api.prototype.asc_getEditorPermissions = function(licenseUrl) {
var t = this;
if (this.DocInfo && this.DocInfo.get_Id()) {
CheckLicense(licenseUrl, function (err, res) {
t._onCheckLicenseEnd(err, res);
});
} else {
// Фиктивный вызов
this._onCheckLicenseEnd(true, false);
}
asc_docs_api.prototype.asc_getEditorPermissions = function() {
this._coAuthoringInit();
};
asc_docs_api.prototype._onCheckLicenseEnd = function(err, res) {
this.licenseResult = {err: err, res: res};
this._sendLicenseInfo();
};
asc_docs_api.prototype._sendLicenseInfo = function() {
if (null !== this.licenseResult && this.isOnFirstConnectEnd) {
var oResult = new window['Asc'].asc_CAscEditorPermissions();
oResult.asc_setCanLicense(this.licenseResult.res);
this.asc_fireCallback('asc_onGetEditorPermissions', oResult);
asc_docs_api.prototype._onEndPermissions = function() {
if (this.isOnFirstConnectEnd) {
this.asc_fireCallback('asc_onGetEditorPermissions', new window['Asc'].asc_CAscEditorPermissions());
}
};
asc_docs_api.prototype.asc_setDocInfo = function(c_DocInfo)
{
if(c_DocInfo)
this.DocInfo = c_DocInfo;
if(this.DocInfo){
documentId = this.DocInfo.get_Id();
documentUserId = this.DocInfo.get_UserId();
documentUrl = this.DocInfo.get_Url();
documentTitle = this.DocInfo.get_Title();
documentFormat = this.DocInfo.get_Format();
documentCallbackUrl = this.DocInfo.get_CallbackUrl();
var nIndex = -1;
if(documentTitle)
nIndex = documentTitle.lastIndexOf(".");
if(-1 != nIndex)
documentTitleWithoutExtention = documentTitle.substring(0, nIndex);
else
documentTitleWithoutExtention = documentTitle;
documentVKey = this.DocInfo.get_VKey();
// documentOrigin = this.DocInfo.get_Origin();
var sProtocol = window.location.protocol;
var sHost = window.location.host;
documentOrigin = "";
if(sProtocol && "" != sProtocol)
documentOrigin = sProtocol + "//" + sHost;
else
documentOrigin = sHost;
asc_docs_api.prototype.asc_setDocInfo = function(c_DocInfo) {
if (c_DocInfo) {
this.DocInfo = c_DocInfo;
}
this.User = new Asc.asc_CUser();
this.User.asc_setId(this.DocInfo.get_UserId());
this.User.asc_setUserName(this.DocInfo.get_UserName());
if (this.DocInfo) {
documentId = this.DocInfo.get_Id();
documentUserId = this.DocInfo.get_UserId();
documentUrl = this.DocInfo.get_Url();
documentTitle = this.DocInfo.get_Title();
documentFormat = this.DocInfo.get_Format();
documentCallbackUrl = this.DocInfo.get_CallbackUrl();
var nIndex = -1;
if (documentTitle) {
nIndex = documentTitle.lastIndexOf(".");
}
if (-1 != nIndex) {
documentTitleWithoutExtention = documentTitle.substring(0, nIndex);
} else {
documentTitleWithoutExtention = documentTitle;
}
this.DocumentName = documentTitle;
if (undefined !== window["AscDesktopEditor"])
{
window["AscDesktopEditor"]["SetDocumentName"](this.DocumentName);
documentVKey = this.DocInfo.get_VKey();
// documentOrigin = this.DocInfo.get_Origin();
var sProtocol = window.location.protocol;
var sHost = window.location.host;
documentOrigin = "";
if (sProtocol && "" != sProtocol) {
documentOrigin = sProtocol + "//" + sHost;
} else {
documentOrigin = sHost;
}
this.User = new Asc.asc_CUser();
this.User.asc_setId(this.DocInfo.get_UserId());
this.User.asc_setUserName(this.DocInfo.get_UserName());
}
this.DocumentName = documentTitle;
if (undefined !== window["AscDesktopEditor"]) {
window["AscDesktopEditor"]["SetDocumentName"](this.DocumentName);
}
};
asc_docs_api.prototype.asc_setLocale = function(val)
{
asc_docs_api.prototype.asc_setLocale = function(val) {
};
asc_docs_api.prototype.LoadDocument = function() {
this.CoAuthoringApi.auth(this.isViewMode);
......
"use strict";
asc_docs_api.prototype.asc_addComment = function(AscCommentData)
{
if (true === CollaborativeEditing.Get_GlobalLock())
return;
asc_docs_api.prototype.asc_addComment = function(AscCommentData) {
if (true === CollaborativeEditing.Get_GlobalLock()) {
return;
}
if (null == this.WordControl.m_oLogicDocument)
return;
if (null == this.WordControl.m_oLogicDocument) {
return;
}
// Комментарий без цитаты позволяем добавить всегда
if (true !== this.can_AddQuotedComment() || false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content))
{
var CommentData = new CCommentData();
CommentData.Read_FromAscCommentData(AscCommentData);
// Комментарий без цитаты позволяем добавить всегда
if (true !== this.can_AddQuotedComment() || false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content)) {
var CommentData = new CCommentData();
CommentData.Read_FromAscCommentData(AscCommentData);
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(historydescription_Document_AddComment);
var Comment = this.WordControl.m_oLogicDocument.Add_Comment(CommentData);
if (null != Comment)
this.sync_AddComment(Comment.Get_Id(), CommentData);
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(historydescription_Document_AddComment);
var Comment = this.WordControl.m_oLogicDocument.Add_Comment(CommentData);
if (null != Comment) {
this.sync_AddComment(Comment.Get_Id(), CommentData);
}
return Comment.Get_Id();
}
return Comment.Get_Id();
}
};
asc_docs_api.prototype.asc_getEditorPermissions = function(licenseUrl) {
var t = this;
if (this.DocInfo && this.DocInfo.get_Id()) {
CheckLicense(licenseUrl, this.DocInfo.get_UserId(), function(err, res) {
t._onCheckLicenseEnd(err, res);
});
} else {
// Фиктивный вызов
this._onCheckLicenseEnd(true, false);
}
this._coAuthoringInit();
};
asc_docs_api.prototype._onCheckLicenseEnd = function(err, res) {
this.licenseResult = {err: err, res: res};
this._onEndPermissions();
};
asc_docs_api.prototype._onEndPermissions = function() {
if (null !== this.licenseResult && this.isOnFirstConnectEnd) {
var oResult = new window['Asc'].asc_CAscEditorPermissions();
oResult.asc_setCanLicense(this.licenseResult.res);
this.asc_fireCallback('asc_onGetEditorPermissions', oResult);
}
};
\ No newline at end of file
......@@ -719,29 +719,13 @@ asc_docs_api.prototype.Init = function()
{
this.WordControl.Init();
};
asc_docs_api.prototype.asc_getEditorPermissions = function(licenseUrl) {
var t = this;
if (this.DocInfo && this.DocInfo.get_Id()) {
CheckLicense(licenseUrl, function (err, res) {
t._onCheckLicenseEnd(err, res);
});
} else {
// Фиктивный вызов
this._onCheckLicenseEnd(true, false);
}
asc_docs_api.prototype.asc_getEditorPermissions = function() {
this._coAuthoringInit();
};
asc_docs_api.prototype._onCheckLicenseEnd = function(err, res) {
this.licenseResult = {err: err, res: res};
this._sendLicenseInfo();
};
asc_docs_api.prototype._sendLicenseInfo = function() {
if (null !== this.licenseResult && this.isOnFirstConnectEnd) {
var oResult = new window['Asc'].asc_CAscEditorPermissions();
oResult.asc_setCanLicense(this.licenseResult.res);
this.asc_fireCallback('asc_onGetEditorPermissions', oResult);
asc_docs_api.prototype._onEndPermissions = function() {
if (this.isOnFirstConnectEnd) {
this.asc_fireCallback('asc_onGetEditorPermissions', new window['Asc'].asc_CAscEditorPermissions());
}
};
......@@ -1339,7 +1323,7 @@ asc_docs_api.prototype._coAuthoringInit = function()
};
this.CoAuthoringApi.onFirstConnect = function() {
t.isOnFirstConnectEnd = true;
t._sendLicenseInfo();
t._onEndPermissions();
};
/**
* Event об отсоединении от сервера
......
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