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 @@
this.canBranding = settings["canBranding"];
this.isAutosaveEnable = settings["isAutosaveEnable"];
this.AutosaveMinInterval = settings["AutosaveMinInterval"];
}
else {
} else {
this.canEdit = true;
this.canDownload = true;
this.canCoAuthoring = true;
......@@ -42,7 +41,7 @@
return this;
}
asc_CAscEditorPermissions.prototype = {
asc_CAscEditorPermissions.prototype = {
constructor: asc_CAscEditorPermissions,
asc_getCanEdit: function(){ return this.canEdit; },
asc_getCanDownload: function(){ return this.canDownload; },
......@@ -77,6 +76,56 @@
prot["asc_getIsAutosaveEnable"] = prot.asc_getIsAutosaveEnable;
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 для работы с цветами
* -----------------------------------------------------------------------------
......
......@@ -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_user = asc.asc_CUser;
var asc_CAscEditorPermissions = asc.asc_CAscEditorPermissions;
var asc_CAscLicense = asc.asc_CAscLicense;
var asc_CTrackFile = asc.CTrackFile;
var prot;
......@@ -531,24 +532,28 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
},
asc_getEditorPermissions : function(){
if (this.DocInfo &&
this.DocInfo["Id"] &&
this.DocInfo["Url"])
{
if (this.DocInfo && this.DocInfo["Id"] && this.DocInfo["Url"]) {
var t = this;
var v = {};
v["c"] = "getsettings";
v["id"] = this.DocInfo["Id"];
v["format"] = this.DocInfo["Format"];
v["vkey"] = this.DocInfo["VKey"];
v["editorid"] = c_oEditorId.Excel;
this._asc_sendCommand(function (response) {t._onGetEditorPermissions(response);}, v);
}
else
{
var rdata = {
"c" : "getsettings",
"id" : this.DocInfo["Id"],
"format" : this.DocInfo["Format"],
"vkey" : this.DocInfo["VKey"],
"editorid" : c_oEditorId.Speadsheet
};
this._asc_sendCommand(function (response) {t._onGetEditorPermissions(response);}, rdata);
} else {
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
if (undefined != window['appBridge']) {
......@@ -1140,6 +1145,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
* asc_onWorkbookLocked (result) - эвент залочена ли работа с листами или нет
* asc_onWorksheetLocked (index, result) - эвент залочен ли лист или нет
* asc_onGetEditorPermissions (permission) - эвент о правах редактора.
* asc_onGetLicense (license) - эвент о лицензии.
*/
asc_StartAction: function (type, id) {
......@@ -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.setDocId(this.DocInfo.Id);
this.TrackFile.setUserId(this.DocInfo.UserId);
this.TrackFile.setDocId(this.DocInfo["Id"]);
this.TrackFile.setUserId(this.DocInfo["UserId"]);
var oThis = this;
var _sendTrack = function(callback, url, data){
......@@ -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() {
//Инициализируем контрол для совместного редактирования
......@@ -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_setLocale"] = prot.asc_setLocale;
prot["asc_getEditorPermissions"] = prot.asc_getEditorPermissions;
prot["asc_getLicense"] = prot.asc_getLicense;
prot["asc_LoadDocument"] = prot.asc_LoadDocument;
prot["asc_LoadEmptyDocument"] = prot.asc_LoadEmptyDocument;
prot["asc_DownloadAs"] = prot.asc_DownloadAs;
......
......@@ -716,23 +716,29 @@ asc_docs_api.prototype.Init = function()
}
asc_docs_api.prototype.asc_getEditorPermissions = function()
{
if(this.DocInfo && this.DocInfo.get_Id())
{
var rData = {};
rData["c"] = "getsettings";
rData["id"] = this.DocInfo.get_Id();
rData["format"] = this.DocInfo.get_Format();
rData["vkey"] = this.DocInfo.get_VKey();
rData["editorid"] = c_oEditorId.Presentation;
if (this.DocInfo && this.DocInfo.get_Id()) {
var rData = {
"c" : "getsettings",
"id" : this.DocInfo.get_Id(),
"format" : this.DocInfo.get_Format(),
"vkey" : this.DocInfo.get_VKey(),
"editorid" : c_oEditorId.Presentation
};
sendCommand( this, this.asc_getEditorPermissionsCallback, rData );
}
else
{
} else {
var asc_CAscEditorPermissions = window["Asc"].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)
{
......@@ -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)
{
if(c_DocInfo)
......
......@@ -850,23 +850,29 @@ asc_docs_api.prototype.Init = function()
}
asc_docs_api.prototype.asc_getEditorPermissions = function()
{
if(this.DocInfo && this.DocInfo.get_Id())
{
var rData = {};
rData["c"] = "getsettings";
rData["id"] = this.DocInfo.get_Id();
rData["format"] = this.DocInfo.get_Format();
rData["vkey"] = this.DocInfo.get_VKey();
rData["editorid"] = c_oEditorId.Word;
if (this.DocInfo && this.DocInfo.get_Id()) {
var rData = {
"c" : "getsettings",
"id" : this.DocInfo.get_Id(),
"format" : this.DocInfo.get_Format(),
"vkey" : this.DocInfo.get_VKey(),
"editorid" : c_oEditorId.Word
};
sendCommand( this, this.asc_getEditorPermissionsCallback, rData );
}
else
{
sendCommand( this, this.asc_getEditorPermissionsCallback, rData );
} else {
var asc_CAscEditorPermissions = window["Asc"].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)
{
......@@ -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)
{
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