Commit bfdeaf68 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Реализовал чтение новой информации о лицензии с сервера.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@68619 954022d7-b5bf-4e40-9824-e11837661b57
parent 2a5691e5
...@@ -162,7 +162,6 @@ ...@@ -162,7 +162,6 @@
"../../Common/apiBase.js", "../../Common/apiBase.js",
"../../Excel/api.js", "../../Excel/api.js",
"../../Common/Private/license.js", "../../Common/Private/license.js",
"../../Excel/Private/license.js",
"../../Excel/Private/comments.js" "../../Excel/Private/comments.js"
], ],
"dst": "../../Excel/sdk-all.js", "dst": "../../Excel/sdk-all.js",
......
...@@ -135,7 +135,6 @@ ...@@ -135,7 +135,6 @@
"../../Common/apiBase.js", "../../Common/apiBase.js",
"../../PowerPoint/api.js", "../../PowerPoint/api.js",
"../../Common/Private/license.js", "../../Common/Private/license.js",
"../../PowerPoint/Private/license.js",
"../../PowerPoint/Private/comments.js", "../../PowerPoint/Private/comments.js",
"../../PowerPoint/apiCommon.js", "../../PowerPoint/apiCommon.js",
"../../Word/apiCommon.js", "../../Word/apiCommon.js",
......
...@@ -122,7 +122,6 @@ ...@@ -122,7 +122,6 @@
"../../Common/apiBase.js", "../../Common/apiBase.js",
"../../Word/api.js", "../../Word/api.js",
"../../Common/Private/license.js", "../../Common/Private/license.js",
"../../Word/Private/license.js",
"../../Common/Private/versionHistory.js", "../../Common/Private/versionHistory.js",
"../../Word/Private/comments.js", "../../Word/Private/comments.js",
"../../Word/Private/StyleManager.js", "../../Word/Private/StyleManager.js",
......
...@@ -162,7 +162,6 @@ ...@@ -162,7 +162,6 @@
"../../Common/apiBase.js", "../../Common/apiBase.js",
"../../Excel/api.js", "../../Excel/api.js",
"../../Common/Private/license.js", "../../Common/Private/license.js",
"../../Excel/Private/license.js",
"../../Excel/Private/comments.js", "../../Excel/Private/comments.js",
"../../Common/Local/common.js", "../../Common/Local/common.js",
"../../Excel/Local/api.js" "../../Excel/Local/api.js"
......
...@@ -135,7 +135,6 @@ ...@@ -135,7 +135,6 @@
"../../Common/apiBase.js", "../../Common/apiBase.js",
"../../PowerPoint/api.js", "../../PowerPoint/api.js",
"../../Common/Private/license.js", "../../Common/Private/license.js",
"../../PowerPoint/Private/license.js",
"../../PowerPoint/Private/comments.js", "../../PowerPoint/Private/comments.js",
"../../PowerPoint/apiCommon.js", "../../PowerPoint/apiCommon.js",
"../../Word/apiCommon.js", "../../Word/apiCommon.js",
......
...@@ -122,7 +122,6 @@ ...@@ -122,7 +122,6 @@
"../../Common/apiBase.js", "../../Common/apiBase.js",
"../../Word/api.js", "../../Word/api.js",
"../../Common/Private/license.js", "../../Common/Private/license.js",
"../../Word/Private/license.js",
"../../Common/Private/versionHistory.js", "../../Common/Private/versionHistory.js",
"../../Word/Private/comments.js", "../../Word/Private/comments.js",
"../../Word/Private/StyleManager.js", "../../Word/Private/StyleManager.js",
......
...@@ -81,10 +81,12 @@ baseEditorsApi.prototype._onCheckLicenseEnd = function(err, res) { ...@@ -81,10 +81,12 @@ baseEditorsApi.prototype._onCheckLicenseEnd = function(err, res) {
this._onEndPermissions(); this._onEndPermissions();
}; };
baseEditorsApi.prototype._onEndPermissions = function() { baseEditorsApi.prototype._onEndPermissions = function() {
if (null !== this.licenseResult && this.isOnFirstConnectEnd) { if (this.isOnFirstConnectEnd && this.isOnLoadLicense) {
var oResult = new window['Asc'].asc_CAscEditorPermissions(); var oResult = new window['Asc'].asc_CAscEditorPermissions();
oResult.asc_setCanLicense(g_oLicenseResult.Success === this.licenseResult.res); if (null !== this.licenseResult) {
oResult.asc_setCanBranding(g_oLicenseResult.Error !== this.licenseResult.res); // Для тех, у кого есть лицензия, branding доступен oResult.asc_setCanLicense(g_oLicenseResult.Success === this.licenseResult);
oResult.asc_setCanBranding(g_oLicenseResult.Error !== this.licenseResult); // Для тех, у кого есть лицензия, branding доступен
}
this.sendEvent('asc_onGetEditorPermissions', oResult); this.sendEvent('asc_onGetEditorPermissions', oResult);
} }
}; };
\ No newline at end of file
...@@ -77,6 +77,8 @@ function baseEditorsApi(name) { ...@@ -77,6 +77,8 @@ function baseEditorsApi(name) {
this.licenseResult = null; this.licenseResult = null;
// Подключились ли уже к серверу // Подключились ли уже к серверу
this.isOnFirstConnectEnd = false; this.isOnFirstConnectEnd = false;
// Получили ли лицензию
this.isOnLoadLicense = false;
this.canSave = true; // Флаг нужен чтобы не происходило сохранение пока не завершится предыдущее сохранение this.canSave = true; // Флаг нужен чтобы не происходило сохранение пока не завершится предыдущее сохранение
this.IsUserSave = false; // Флаг, контролирующий сохранение было сделано пользователем или нет (по умолчанию - нет) this.IsUserSave = false; // Флаг, контролирующий сохранение было сделано пользователем или нет (по умолчанию - нет)
...@@ -354,7 +356,7 @@ baseEditorsApi.prototype.asc_getEditorPermissions = function() { ...@@ -354,7 +356,7 @@ baseEditorsApi.prototype.asc_getEditorPermissions = function() {
this._coAuthoringInit(); this._coAuthoringInit();
}; };
baseEditorsApi.prototype._onEndPermissions = function() { baseEditorsApi.prototype._onEndPermissions = function() {
if (this.isOnFirstConnectEnd) { if (this.isOnFirstConnectEnd && this.isOnLoadLicense) {
this.sendEvent('asc_onGetEditorPermissions', new window['Asc'].asc_CAscEditorPermissions()); this.sendEvent('asc_onGetEditorPermissions', new window['Asc'].asc_CAscEditorPermissions());
} }
}; };
...@@ -396,6 +398,11 @@ baseEditorsApi.prototype._coAuthoringInit = function() { ...@@ -396,6 +398,11 @@ baseEditorsApi.prototype._coAuthoringInit = function() {
t.isOnFirstConnectEnd = true; t.isOnFirstConnectEnd = true;
t._onEndPermissions(); t._onEndPermissions();
}; };
this.CoAuthoringApi.onLicense = function(res) {
t.licenseResult = res;
t.isOnLoadLicense = true;
t._onEndPermissions();
};
this.CoAuthoringApi.onWarning = function(e) { this.CoAuthoringApi.onWarning = function(e) {
t.sendEvent('asc_onError', c_oAscError.ID.Warning, c_oAscError.Level.NoCritical); t.sendEvent('asc_onError', c_oAscError.ID.Warning, c_oAscError.Level.NoCritical);
}; };
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
this.onRecalcLocks = options.onRecalcLocks; this.onRecalcLocks = options.onRecalcLocks;
this.onDocumentOpen = options.onDocumentOpen; this.onDocumentOpen = options.onDocumentOpen;
this.onFirstConnect = options.onFirstConnect; this.onFirstConnect = options.onFirstConnect;
this.onLicense = options.onLicense;
} }
} }
...@@ -99,12 +100,16 @@ ...@@ -99,12 +100,16 @@
this._CoAuthoringApi.onFirstConnect = function() { this._CoAuthoringApi.onFirstConnect = function() {
t.callback_OnFirstConnect(); t.callback_OnFirstConnect();
}; };
this._CoAuthoringApi.onLicense = function(res) {
t.callback_OnLicense(res);
};
this._CoAuthoringApi.init(user, docid, documentCallbackUrl, token, editorType, documentFormatSave); this._CoAuthoringApi.init(user, docid, documentCallbackUrl, token, editorType, documentFormatSave);
this._onlineWork = true; this._onlineWork = true;
} else { } else {
// Фиктивные вызовы // Фиктивные вызовы
this.onFirstConnect(); this.onFirstConnect();
this.onLicense();
} }
}; };
...@@ -376,6 +381,11 @@ ...@@ -376,6 +381,11 @@
this.onFirstConnect(); this.onFirstConnect();
} }
}; };
CDocsCoApi.prototype.callback_OnLicense = function(res) {
if (this.onLicense) {
this.onLicense(res);
}
};
function LockBufferElement(arrayBlockId, callback) { function LockBufferElement(arrayBlockId, callback) {
this._arrayBlockId = arrayBlockId; this._arrayBlockId = arrayBlockId;
...@@ -403,6 +413,7 @@ ...@@ -403,6 +413,7 @@
this.onRecalcLocks = options.onRecalcLocks; this.onRecalcLocks = options.onRecalcLocks;
this.onDocumentOpen = options.onDocumentOpen; this.onDocumentOpen = options.onDocumentOpen;
this.onFirstConnect = options.onFirstConnect; this.onFirstConnect = options.onFirstConnect;
this.onLicense = options.onLicense;
} }
this._state = ConnectionState.None; this._state = ConnectionState.None;
// Online-пользователи в документе // Online-пользователи в документе
...@@ -410,6 +421,7 @@ ...@@ -410,6 +421,7 @@
this._countEditUsers = 0; this._countEditUsers = 0;
this._countUsers = 0; this._countUsers = 0;
this.isLicenseInit = false;
this.isAuthInit = false; this.isAuthInit = false;
this._locks = {}; this._locks = {};
this._msgBuffer = []; this._msgBuffer = [];
...@@ -1045,6 +1057,13 @@ ...@@ -1045,6 +1057,13 @@
this.onWarning(data ? data['description'] : ''); this.onWarning(data ? data['description'] : '');
}; };
DocsCoApi.prototype._onLicense = function(data) {
if (!this.isLicenseInit) {
this.isLicenseInit = true;
this.onLicense(data['license']);
}
};
DocsCoApi.prototype._onAuth = function(data) { DocsCoApi.prototype._onAuth = function(data) {
var t = this; var t = this;
if (true === this._isAuth) { if (true === this._isAuth) {
...@@ -1197,7 +1216,7 @@ ...@@ -1197,7 +1216,7 @@
//TODO: add checks and error handling //TODO: add checks and error handling
//Get data type //Get data type
var dataObject = JSON.parse(e.data); var dataObject = JSON.parse(e.data);
var type = dataObject.type; var type = dataObject['type'];
switch (type) { switch (type) {
case 'auth' : case 'auth' :
t._onAuth(dataObject); t._onAuth(dataObject);
...@@ -1243,6 +1262,8 @@ ...@@ -1243,6 +1262,8 @@
case 'warning': case 'warning':
t._onWarning(dataObject); t._onWarning(dataObject);
break; break;
case 'license':
t._onLicense(dataObject);
} }
}; };
sockjs.onclose = function(evt) { sockjs.onclose = function(evt) {
......
"use strict";
/* license.js
*
* Author: Alexander.Trofimov@avsmedia.net
* Date: Apr 23, 2015
*/
(/**
* @param {jQuery} $
* @param {Window} window
* @param {undefined} undefined
*/
function($, window, undefined) {
var asc = window["Asc"];
var prot;
asc['spreadsheet_api'].prototype.asc_getEditorPermissions = function(licenseUrl, customerId) {
var t = this;
if (this.DocInfo && this.DocInfo.asc_getId() && this.DocInfo.asc_getUrl()) {
var sUserFirstName = null, sUserLastName = null;
var oUserInfo = this.DocInfo.get_UserInfo();
if (oUserInfo) {
sUserFirstName = oUserInfo.get_FirstName();
sUserLastName = oUserInfo.get_LastName();
}
CheckLicense(licenseUrl, customerId, this.DocInfo.asc_getUserId(), sUserFirstName, sUserLastName, function(err, res) {
t._onCheckLicenseEnd(err, res);
});
} else {
// Фиктивный вызов
this._onCheckLicenseEnd(true, g_oLicenseResult.Error);
}
this._coAuthoringInit();
};
prot = asc['spreadsheet_api'].prototype;
prot['asc_getEditorPermissions'] = prot.asc_getEditorPermissions;
})(jQuery, window);
...@@ -111,7 +111,6 @@ ...@@ -111,7 +111,6 @@
<script type="text/javascript" src="../Common/apiBase.js"></script> <script type="text/javascript" src="../Common/apiBase.js"></script>
<script type="text/javascript" src="api.js"></script> <script type="text/javascript" src="api.js"></script>
<script type="text/javascript" src="../Common/Private/license.js"></script> <script type="text/javascript" src="../Common/Private/license.js"></script>
<script type="text/javascript" src="Private/license.js"></script>
<script type="text/javascript" src="Private/comments.js"></script> <script type="text/javascript" src="Private/comments.js"></script>
<script type="text/javascript" src="menu/menu.js"></script> <script type="text/javascript" src="menu/menu.js"></script>
......
...@@ -314,7 +314,6 @@ ...@@ -314,7 +314,6 @@
<script type="text/javascript" src="../../../../OfficeWeb/Common/apiBase.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/Common/apiBase.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Excel/api.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/Excel/api.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Common/Private/license.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/Common/Private/license.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Excel/Private/license.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Excel/Private/comments.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/Excel/Private/comments.js"></script>
<!--for theme--> <!--for theme-->
......
...@@ -281,7 +281,6 @@ ...@@ -281,7 +281,6 @@
<script type="text/javascript" src="../../../../OfficeWeb/Common/apiBase.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/Common/apiBase.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Excel/api.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/Excel/api.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Common/Private/license.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/Common/Private/license.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Excel/Private/license.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Excel/Private/comments.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/Excel/Private/comments.js"></script>
<!--for theme--> <!--for theme-->
......
"use strict";
asc_docs_api.prototype.asc_getEditorPermissions = function(licenseUrl, customerId) {
var t = this;
if (this.DocInfo && this.DocInfo.get_Id()) {
var sUserFirstName = null, sUserLastName = null;
var oUserInfo = this.DocInfo.get_UserInfo();
if (oUserInfo) {
sUserFirstName = oUserInfo.get_FirstName();
sUserLastName = oUserInfo.get_LastName();
}
CheckLicense(licenseUrl, customerId, this.DocInfo.get_UserId(), sUserFirstName, sUserLastName, function(err, res) {
t._onCheckLicenseEnd(err, res);
});
} else {
// Фиктивный вызов
this._onCheckLicenseEnd(true, g_oLicenseResult.Error);
}
this._coAuthoringInit();
};
\ No newline at end of file
...@@ -358,7 +358,6 @@ ...@@ -358,7 +358,6 @@
<script type="text/javascript" src="../../../../OfficeWeb/Common/apiBase.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/Common/apiBase.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/PowerPoint/api.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/PowerPoint/api.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Common/Private/license.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/Common/Private/license.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/PowerPoint/Private/license.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/PowerPoint/Private/comments.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/PowerPoint/Private/comments.js"></script>
......
"use strict";
asc_docs_api.prototype.asc_getEditorPermissions = function(licenseUrl, customerId) {
var t = this;
if (this.DocInfo && this.DocInfo.get_Id()) {
var sUserFirstName = null, sUserLastName = null;
var oUserInfo = this.DocInfo.get_UserInfo();
if (oUserInfo) {
sUserFirstName = oUserInfo.get_FirstName();
sUserLastName = oUserInfo.get_LastName();
}
CheckLicense(licenseUrl, customerId, this.DocInfo.get_UserId(), sUserFirstName, sUserLastName, function(err, res) {
t._onCheckLicenseEnd(err, res);
});
} else {
// Фиктивный вызов
this._onCheckLicenseEnd(true, g_oLicenseResult.Error);
}
this._coAuthoringInit();
};
\ No newline at end of file
...@@ -419,7 +419,6 @@ ...@@ -419,7 +419,6 @@
<script type="text/javascript" src="../../../../OfficeWeb/OfflineDocuments/ApplyDocumentChanges.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/OfflineDocuments/ApplyDocumentChanges.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Common/Private/license.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/Common/Private/license.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Word/Private/license.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Common/Private/versionHistory.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/Common/Private/versionHistory.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Word/Private/comments.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/Word/Private/comments.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Word/Private/StyleManager.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/Word/Private/StyleManager.js"></script>
......
...@@ -171,7 +171,6 @@ ...@@ -171,7 +171,6 @@
<script type="text/javascript" src="../../../../OfficeWeb/Common/apiBase.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/Common/apiBase.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Word/api.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/Word/api.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Common/Private/license.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/Common/Private/license.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Word/Private/license.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Common/Private/versionHistory.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/Common/Private/versionHistory.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Word/Private/comments.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/Word/Private/comments.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Word/document/empty.js"></script> <script type="text/javascript" src="../../../../OfficeWeb/Word/document/empty.js"></script>
......
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