Commit 456778f3 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Добавил функцию, для получения лицензии - asc_getLicense

Для получения результата нужно подписаться на asc_onGetLicense
asc_onGetLicense возвращает объект класса asc_CAscLicense с методами
asc_getCustomer
asc_getCustomerAddr
asc_getCustomerWww
asc_getCustomerMail
asc_getCustomerInfo
asc_getCustomerLogo

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53589 954022d7-b5bf-4e40-9824-e11837661b57
parent f9143b19
...@@ -29,8 +29,7 @@ ...@@ -29,8 +29,7 @@
this.canBranding = settings["canBranding"]; this.canBranding = settings["canBranding"];
this.isAutosaveEnable = settings["isAutosaveEnable"]; this.isAutosaveEnable = settings["isAutosaveEnable"];
this.AutosaveMinInterval = settings["AutosaveMinInterval"]; this.AutosaveMinInterval = settings["AutosaveMinInterval"];
} } else {
else {
this.canEdit = true; this.canEdit = true;
this.canDownload = true; this.canDownload = true;
this.canCoAuthoring = true; this.canCoAuthoring = true;
...@@ -77,6 +76,56 @@ ...@@ -77,6 +76,56 @@
prot["asc_getIsAutosaveEnable"] = prot.asc_getIsAutosaveEnable; prot["asc_getIsAutosaveEnable"] = prot.asc_getIsAutosaveEnable;
prot["asc_getAutosaveMinInterval"] = prot.asc_getAutosaveMinInterval; prot["asc_getAutosaveMinInterval"] = prot.asc_getAutosaveMinInterval;
/**
* Класс asc_CAscLicense для лицензии
* -----------------------------------------------------------------------------
*
* @constructor
* @memberOf Asc
*/
function asc_CAscLicense (settings) {
if ( !(this instanceof asc_CAscLicense) ) {
return new asc_CAscLicense();
}
if(settings) {
this.customer = settings["customer"];
this.customerAddr = settings["customer_addr"];
this.customerWww = settings["customer_www"];
this.customerMail = settings["customer_mail"];
this.customerInfo = settings["customer_info"];
this.customerLogo = settings["customer_logo"];
} else {
this.customer = settings["customer"];
this.customerAddr = settings["customer_addr"];
this.customerWww = settings["customer_www"];
this.customerMail = settings["customer_mail"];
this.customerInfo = settings["customer_info"];
this.customerLogo = settings["customer_logo"];
}
return this;
}
asc_CAscLicense.prototype.asc_getCustomer = function () {return this.customer;};
asc_CAscLicense.prototype.asc_getCustomerAddr = function () {return this.customerAddr;};
asc_CAscLicense.prototype.asc_getCustomerWww = function () {return this.customerWww;};
asc_CAscLicense.prototype.asc_getCustomerMail = function () {return this.customerMail;};
asc_CAscLicense.prototype.asc_getCustomerInfo = function () {return this.customerInfo;};
asc_CAscLicense.prototype.asc_getCustomerLogo = function () {return this.customerLogo;};
/*
* Export
* -----------------------------------------------------------------------------
*/
window["Asc"]["asc_CAscLicense"] = window["Asc"].asc_CAscLicense = asc_CAscLicense;
prot = asc_CAscLicense.prototype;
prot["asc_getCustomer"] = prot.asc_getCustomer;
prot["asc_getCustomerAddr"] = prot.asc_getCustomerAddr;
prot["asc_getCustomerWww"] = prot.asc_getCustomerWww;
prot["asc_getCustomerMail"] = prot.asc_getCustomerMail;
prot["asc_getCustomerInfo"] = prot.asc_getCustomerInfo;
prot["asc_getCustomerLogo"] = prot.asc_getCustomerLogo;
/** /**
* Класс CColor для работы с цветами * Класс CColor для работы с цветами
* ----------------------------------------------------------------------------- * -----------------------------------------------------------------------------
......
...@@ -17,6 +17,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -17,6 +17,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
var asc_CAdjustPrint = asc.asc_CAdjustPrint; var asc_CAdjustPrint = asc.asc_CAdjustPrint;
var asc_user = asc.asc_CUser; var asc_user = asc.asc_CUser;
var asc_CAscEditorPermissions = asc.asc_CAscEditorPermissions; var asc_CAscEditorPermissions = asc.asc_CAscEditorPermissions;
var asc_CAscLicense = asc.asc_CAscLicense;
var asc_CTrackFile = asc.CTrackFile; var asc_CTrackFile = asc.CTrackFile;
var prot; var prot;
...@@ -531,25 +532,29 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -531,25 +532,29 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}, },
asc_getEditorPermissions : function(){ asc_getEditorPermissions : function(){
if (this.DocInfo && if (this.DocInfo && this.DocInfo["Id"] && this.DocInfo["Url"]) {
this.DocInfo["Id"] &&
this.DocInfo["Url"])
{
var t = this; var t = this;
var v = {}; var rdata = {
v["c"] = "getsettings"; "c" : "getsettings",
v["id"] = this.DocInfo["Id"]; "id" : this.DocInfo["Id"],
v["format"] = this.DocInfo["Format"]; "format" : this.DocInfo["Format"],
v["vkey"] = this.DocInfo["VKey"]; "vkey" : this.DocInfo["VKey"],
v["editorid"] = c_oEditorId.Excel; "editorid" : c_oEditorId.Speadsheet
this._asc_sendCommand(function (response) {t._onGetEditorPermissions(response);}, v); };
} this._asc_sendCommand(function (response) {t._onGetEditorPermissions(response);}, rdata);
else } else {
{
this.handlers.trigger("asc_onGetEditorPermissions", new asc_CAscEditorPermissions()); this.handlers.trigger("asc_onGetEditorPermissions", new asc_CAscEditorPermissions());
} }
}, },
asc_getLicense : function () {
var t = this;
var rdata = {
"c" : "getlicense"
};
this._asc_sendCommand(function (response) {t._onGetLicense(response);}, rdata);
},
asc_DownloadAs : function(typeFile){//передаем число соответствующее своему формату. например c_oAscFileType.XLSX asc_DownloadAs : function(typeFile){//передаем число соответствующее своему формату. например c_oAscFileType.XLSX
if (undefined != window['appBridge']) { if (undefined != window['appBridge']) {
window['appBridge']['dummyCommandDownloadAs'] (); // TEST window['appBridge']['dummyCommandDownloadAs'] (); // TEST
...@@ -1140,6 +1145,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -1140,6 +1145,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
* asc_onWorkbookLocked (result) - эвент залочена ли работа с листами или нет * asc_onWorkbookLocked (result) - эвент залочена ли работа с листами или нет
* asc_onWorksheetLocked (index, result) - эвент залочен ли лист или нет * asc_onWorksheetLocked (index, result) - эвент залочен ли лист или нет
* asc_onGetEditorPermissions (permission) - эвент о правах редактора. * asc_onGetEditorPermissions (permission) - эвент о правах редактора.
* asc_onGetLicense (license) - эвент о лицензии.
*/ */
asc_StartAction: function (type, id) { asc_StartAction: function (type, id) {
...@@ -1324,8 +1330,8 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -1324,8 +1330,8 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
{ {
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"]);
var oThis = this; var oThis = this;
var _sendTrack = function(callback, url, data){ var _sendTrack = function(callback, url, data){
...@@ -1349,6 +1355,15 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -1349,6 +1355,15 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
} }
}, },
_onGetLicense: function (response) {
if (null != response && "getlicense" == response.type){
var oSettings = JSON.parse(response.data);
var oLicense = new asc_CAscLicense(oSettings);
this.handlers.trigger("asc_onGetLicense", oLicense);
}
},
// Стартуем соединение с сервером для совместного редактирования // Стартуем соединение с сервером для совместного редактирования
asyncServerIdStartLoaded: function() { asyncServerIdStartLoaded: function() {
//Инициализируем контрол для совместного редактирования //Инициализируем контрол для совместного редактирования
...@@ -3459,6 +3474,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -3459,6 +3474,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
prot["asc_setDocInfo"] = prot.asc_setDocInfo; prot["asc_setDocInfo"] = prot.asc_setDocInfo;
prot["asc_setLocale"] = prot.asc_setLocale; prot["asc_setLocale"] = prot.asc_setLocale;
prot["asc_getEditorPermissions"] = prot.asc_getEditorPermissions; prot["asc_getEditorPermissions"] = prot.asc_getEditorPermissions;
prot["asc_getLicense"] = prot.asc_getLicense;
prot["asc_LoadDocument"] = prot.asc_LoadDocument; prot["asc_LoadDocument"] = prot.asc_LoadDocument;
prot["asc_LoadEmptyDocument"] = prot.asc_LoadEmptyDocument; prot["asc_LoadEmptyDocument"] = prot.asc_LoadEmptyDocument;
prot["asc_DownloadAs"] = prot.asc_DownloadAs; prot["asc_DownloadAs"] = prot.asc_DownloadAs;
......
...@@ -716,23 +716,29 @@ asc_docs_api.prototype.Init = function() ...@@ -716,23 +716,29 @@ asc_docs_api.prototype.Init = function()
} }
asc_docs_api.prototype.asc_getEditorPermissions = function() asc_docs_api.prototype.asc_getEditorPermissions = function()
{ {
if(this.DocInfo && this.DocInfo.get_Id()) if (this.DocInfo && this.DocInfo.get_Id()) {
{ var rData = {
var rData = {}; "c" : "getsettings",
rData["c"] = "getsettings"; "id" : this.DocInfo.get_Id(),
rData["id"] = this.DocInfo.get_Id(); "format" : this.DocInfo.get_Format(),
rData["format"] = this.DocInfo.get_Format(); "vkey" : this.DocInfo.get_VKey(),
rData["vkey"] = this.DocInfo.get_VKey(); "editorid" : c_oEditorId.Presentation
rData["editorid"] = c_oEditorId.Presentation; };
sendCommand( this, this.asc_getEditorPermissionsCallback, rData ); sendCommand( this, this.asc_getEditorPermissionsCallback, rData );
} } else {
else
{
var asc_CAscEditorPermissions = window["Asc"].asc_CAscEditorPermissions; var asc_CAscEditorPermissions = window["Asc"].asc_CAscEditorPermissions;
editor.asc_fireCallback("asc_onGetEditorPermissions", new asc_CAscEditorPermissions()); editor.asc_fireCallback("asc_onGetEditorPermissions", new asc_CAscEditorPermissions());
} }
} };
asc_docs_api.prototype.asc_getLicense = function () {
var t = this;
var rdata = {
"c" : "getlicense"
};
sendCommand(this, function (response) {t._onGetLicense(response);}, rdata);
};
asc_docs_api.prototype.asc_getEditorPermissionsCallback = function(incomeObject) asc_docs_api.prototype.asc_getEditorPermissionsCallback = function(incomeObject)
{ {
...@@ -770,6 +776,16 @@ asc_docs_api.prototype.asc_getEditorPermissionsCallback = function(incomeObject) ...@@ -770,6 +776,16 @@ asc_docs_api.prototype.asc_getEditorPermissionsCallback = function(incomeObject)
} }
} }
} }
asc_docs_api.prototype._onGetLicense = function (response) {
if (null != response && "getlicense" == response.type){
var oSettings = JSON.parse(response.data);
var oLicense = new window["Asc"].asc_CAscLicense(oSettings);
this.asc_fireCallback("asc_onGetLicense", oLicense);
}
};
asc_docs_api.prototype.asc_setDocInfo = function(c_DocInfo) asc_docs_api.prototype.asc_setDocInfo = function(c_DocInfo)
{ {
if(c_DocInfo) if(c_DocInfo)
......
...@@ -850,23 +850,29 @@ asc_docs_api.prototype.Init = function() ...@@ -850,23 +850,29 @@ asc_docs_api.prototype.Init = function()
} }
asc_docs_api.prototype.asc_getEditorPermissions = function() asc_docs_api.prototype.asc_getEditorPermissions = function()
{ {
if(this.DocInfo && this.DocInfo.get_Id()) if (this.DocInfo && this.DocInfo.get_Id()) {
{ var rData = {
var rData = {}; "c" : "getsettings",
rData["c"] = "getsettings"; "id" : this.DocInfo.get_Id(),
rData["id"] = this.DocInfo.get_Id(); "format" : this.DocInfo.get_Format(),
rData["format"] = this.DocInfo.get_Format(); "vkey" : this.DocInfo.get_VKey(),
rData["vkey"] = this.DocInfo.get_VKey(); "editorid" : c_oEditorId.Word
rData["editorid"] = c_oEditorId.Word; };
sendCommand( this, this.asc_getEditorPermissionsCallback, rData ); sendCommand( this, this.asc_getEditorPermissionsCallback, rData );
} } else {
else
{
var asc_CAscEditorPermissions = window["Asc"].asc_CAscEditorPermissions; var asc_CAscEditorPermissions = window["Asc"].asc_CAscEditorPermissions;
editor.asc_fireCallback("asc_onGetEditorPermissions", new asc_CAscEditorPermissions()); editor.asc_fireCallback("asc_onGetEditorPermissions", new asc_CAscEditorPermissions());
} }
} };
asc_docs_api.prototype.asc_getLicense = function () {
var t = this;
var rdata = {
"c" : "getlicense"
};
sendCommand(this, function (response) {t._onGetLicense(response);}, rdata);
};
asc_docs_api.prototype.asc_getEditorPermissionsCallback = function(incomeObject) asc_docs_api.prototype.asc_getEditorPermissionsCallback = function(incomeObject)
{ {
...@@ -904,6 +910,15 @@ asc_docs_api.prototype.asc_getEditorPermissionsCallback = function(incomeObject) ...@@ -904,6 +910,15 @@ asc_docs_api.prototype.asc_getEditorPermissionsCallback = function(incomeObject)
} }
} }
} }
asc_docs_api.prototype._onGetLicense = function (response) {
if (null != response && "getlicense" == response.type){
var oSettings = JSON.parse(response.data);
var oLicense = new window["Asc"].asc_CAscLicense(oSettings);
this.asc_fireCallback("asc_onGetLicense", oLicense);
}
};
asc_docs_api.prototype.asc_setDocInfo = function(c_DocInfo) asc_docs_api.prototype.asc_setDocInfo = function(c_DocInfo)
{ {
if(c_DocInfo) if(c_DocInfo)
......
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