Commit 62535a2e authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

вместе с изменениями в меню Menu Revision: 7676 для унификации открытия файлов

_coAuthoringInit add callback

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@64622 954022d7-b5bf-4e40-9824-e11837661b57
parent a2a657b6
......@@ -59,6 +59,7 @@
// Фиктивные вызовы
this.callback_OnSetIndexUser ("123");
this.onFirstLoadChangesEnd ();
callback();
}
};
......
......@@ -523,12 +523,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this._onUpdateAfterApplyChanges();
}
};
spreadsheet_api.prototype.asc_LoadDocument = function (c_DocInfo) {
spreadsheet_api.prototype.asc_LoadDocument = function () {
var t = this;
if(!this.DocInfo && c_DocInfo)
this.asc_setDocInfo(c_DocInfo);
if (this.DocInfo["OfflineApp"] && (true == this.DocInfo["OfflineApp"])) {
this.isCoAuthoringEnable = false;
......@@ -582,25 +579,26 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
};
spreadsheet_api.prototype.asc_getEditorPermissions = function(){
this._coAuthoringInit();
if (this.DocInfo && this.DocInfo["Id"] && this.DocInfo["Url"]) {
var t = this;
var rdata = {
"c" : "getsettings",
"id" : this.DocInfo["Id"],
"userid" : this.DocInfo["UserId"],
"format" : this.DocInfo["Format"],
"vkey" : this.DocInfo["VKey"],
"editorid" : c_oEditorId.Spreadsheet
};
this.advancedOptionsAction = c_oAscAdvancedOptionsAction.Perm;
sendCommand2(this, null, rdata);
} else {
this.handlers.trigger("asc_onGetEditorPermissions", new asc_CAscEditorPermissions());
// Фиктивно инициализируем
this.CoAuthoringUrl = window['g_cAscCoAuthoringUrl'] ? window['g_cAscCoAuthoringUrl'] : '';
this.SpellCheckUrl = window['g_cAscSpellCheckUrl'] ? window['g_cAscSpellCheckUrl'] : '';
}
var t = this;
this._coAuthoringInit(function(){
if (t.DocInfo && t.DocInfo["Id"] && t.DocInfo["Url"]) {
var rdata = {
"c" : "getsettings",
"id" : t.DocInfo["Id"],
"userid" : t.DocInfo["UserId"],
"format" : t.DocInfo["Format"],
"vkey" : t.DocInfo["VKey"],
"editorid" : c_oEditorId.Spreadsheet
};
t.advancedOptionsAction = c_oAscAdvancedOptionsAction.Perm;
sendCommand2(t, null, rdata);
} else {
t.handlers.trigger("asc_onGetEditorPermissions", new asc_CAscEditorPermissions());
// Фиктивно инициализируем
t.CoAuthoringUrl = window['g_cAscCoAuthoringUrl'] ? window['g_cAscCoAuthoringUrl'] : '';
t.SpellCheckUrl = window['g_cAscSpellCheckUrl'] ? window['g_cAscSpellCheckUrl'] : '';
}
});
};
spreadsheet_api.prototype.asc_getLicense = function () {
......@@ -1484,7 +1482,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
/////////////////////////////////////////////////////////////////////////
///////////////////CoAuthoring and Chat api//////////////////////////////
/////////////////////////////////////////////////////////////////////////
spreadsheet_api.prototype._coAuthoringInit = function() {
spreadsheet_api.prototype._coAuthoringInit = function(fCallback) {
var t = this;
if (!this.isCoAuthoringEnable)
......@@ -1518,6 +1516,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
if (!this.CoAuthoringApi) {
this.asyncServerIdEndLoaded ();
fCallback();
return; // Error
}
this.CoAuthoringApi.onParticipantsChanged = function (e, count) { t.handlers.trigger("asc_onParticipantsChanged", e, count); };
......@@ -1750,7 +1749,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this._coAuthoringSetServerUrl(null);
}
this.CoAuthoringApi.init(t.User, t.documentId, t.documentCallbackUrl, 'fghhfgsjdgfjs',
function(){}, c_oEditorId.Spreadsheet, t.documentFormatSave, t.asc_getViewerMode());
fCallback, c_oEditorId.Spreadsheet, t.documentFormatSave, t.asc_getViewerMode());
};
// Set CoAuthoring server url
......@@ -3655,7 +3654,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}
g_oIdCounter.Set_Load(false);
this._coAuthoringInit();
this._coAuthoringInit(function(){});
this.wb = new asc.WorkbookView(
this.wbModel,
this.controller,
......
......@@ -574,8 +574,10 @@
};
}
api.asc_setDocInfo(c_DocInfo);
api.asc_registerCallback('asc_onGetEditorPermissions', function(){
api.asc_LoadDocument();
});
api.asc_getEditorPermissions();
api.asc_LoadDocument();
$("#enableKE").data("state", true).click(function(){
var $this = $(this), s = $this.data("state");
......
......@@ -235,10 +235,11 @@ CChatMessage.prototype.get_Message = function() { return this.Message; };
ToDo Register Callback OnCoAuthoringDisconnectUser возвращается userId
*/
// Init CoAuthoring
asc_docs_api.prototype._coAuthoringInit = function () {
asc_docs_api.prototype._coAuthoringInit = function (fCallback) {
if (!this.CoAuthoringApi) {
g_oIdCounter.Set_Load(false);
this.asyncServerIdEndLoaded ();
fCallback();
return; // Error
}
......@@ -558,7 +559,7 @@ asc_docs_api.prototype._coAuthoringInit = function () {
if(!(window["NATIVE_EDITOR_ENJINE"] || !documentId)){
this.CoAuthoringApi.set_url(null);
}
this.CoAuthoringApi.init(this.User, documentId, documentCallbackUrl, 'fghhfgsjdgfjs', function(){}, c_oEditorId.Presentation,
this.CoAuthoringApi.init(this.User, documentId, documentCallbackUrl, 'fghhfgsjdgfjs', fCallback, c_oEditorId.Presentation,
documentFormatSave, this.isViewMode);
// ToDo init other callbacks
......@@ -750,27 +751,28 @@ asc_docs_api.prototype.Init = function()
this.WordControl.Init();
};
asc_docs_api.prototype.asc_getEditorPermissions = function() {
this._coAuthoringInit();
if (this.DocInfo && this.DocInfo.get_Id()) {
var rData = {
"c": "getsettings",
"id": this.DocInfo.get_Id(),
"userid": this.DocInfo.get_UserId(),
"format": this.DocInfo.get_Format(),
"vkey": this.DocInfo.get_VKey(),
"editorid": c_oEditorId.Presentation
};
var t = this;
this._coAuthoringInit(function(){
if (t.DocInfo && t.DocInfo.get_Id()) {
var rData = {
"c": "getsettings",
"id": t.DocInfo.get_Id(),
"userid": t.DocInfo.get_UserId(),
"format": t.DocInfo.get_Format(),
"vkey": t.DocInfo.get_VKey(),
"editorid": c_oEditorId.Presentation
};
var t = this;
this.advancedOptionsAction = c_oAscAdvancedOptionsAction.Perm;
sendCommand2(this, null, rData);
} else {
var asc_CAscEditorPermissions = window["Asc"].asc_CAscEditorPermissions;
this.asc_fireCallback("asc_onGetEditorPermissions", new asc_CAscEditorPermissions());
// Фиктивно инициализируем
this.CoAuthoringUrl = window['g_cAscCoAuthoringUrl'] ? window['g_cAscCoAuthoringUrl'] : '';
this.SpellCheckUrl = window['g_cAscSpellCheckUrl'] ? window['g_cAscSpellCheckUrl'] : '';
}
t.advancedOptionsAction = c_oAscAdvancedOptionsAction.Perm;
sendCommand2(t, null, rData);
} else {
var asc_CAscEditorPermissions = window["Asc"].asc_CAscEditorPermissions;
t.asc_fireCallback("asc_onGetEditorPermissions", new asc_CAscEditorPermissions());
// Фиктивно инициализируем
t.CoAuthoringUrl = window['g_cAscCoAuthoringUrl'] ? window['g_cAscCoAuthoringUrl'] : '';
t.SpellCheckUrl = window['g_cAscSpellCheckUrl'] ? window['g_cAscSpellCheckUrl'] : '';
}
});
};
asc_docs_api.prototype.asc_getLicense = function () {
......@@ -862,10 +864,8 @@ asc_docs_api.prototype.asc_setDocInfo = function(c_DocInfo)
asc_docs_api.prototype.asc_setLocale = function(val)
{
};
asc_docs_api.prototype.LoadDocument = function(c_DocInfo)
asc_docs_api.prototype.LoadDocument = function()
{
if(!this.DocInfo && c_DocInfo)
this.asc_setDocInfo(c_DocInfo);
this.WordControl.m_oDrawingDocument.m_bIsOpeningDocument = true;
......
......@@ -725,32 +725,33 @@ asc_docs_api.prototype.Init = function()
this.WordControl.Init();
};
asc_docs_api.prototype.asc_getEditorPermissions = function() {
var t = this;
if (undefined != window['qtDocBridge']) {
// set permissions
//var asc_CAscEditorPermissions = window["Asc"].asc_CAscEditorPermissions;
//editor.asc_fireCallback("asc_onGetEditorPermissions", new asc_CAscEditorPermissions());
} else {
this._coAuthoringInit();
if (this.DocInfo && this.DocInfo.get_Id()) {
var rData = {
"c": "getsettings",
"id": this.DocInfo.get_Id(),
"userid": this.DocInfo.get_UserId(),
"format": this.DocInfo.get_Format(),
"vkey": this.DocInfo.get_VKey(),
"editorid": c_oEditorId.Word
};
var t = this;
this.advancedOptionsAction = c_oAscAdvancedOptionsAction.Perm;
sendCommand2(this, null, rData);
} else {
var asc_CAscEditorPermissions = window["Asc"].asc_CAscEditorPermissions;
this.asc_fireCallback("asc_onGetEditorPermissions", new asc_CAscEditorPermissions());
// Фиктивно инициализируем
this.CoAuthoringUrl = window['g_cAscCoAuthoringUrl'] ? window['g_cAscCoAuthoringUrl'] : '';
this.SpellCheckUrl = window['g_cAscSpellCheckUrl'] ? window['g_cAscSpellCheckUrl'] : '';
}
this._coAuthoringInit(function() {
if (t.DocInfo && t.DocInfo.get_Id()) {
var rData = {
"c": "getsettings",
"id": t.DocInfo.get_Id(),
"userid": t.DocInfo.get_UserId(),
"format": t.DocInfo.get_Format(),
"vkey": t.DocInfo.get_VKey(),
"editorid": c_oEditorId.Word
};
t.advancedOptionsAction = c_oAscAdvancedOptionsAction.Perm;
sendCommand2(t, null, rData);
} else {
var asc_CAscEditorPermissions = window["Asc"].asc_CAscEditorPermissions;
t.asc_fireCallback("asc_onGetEditorPermissions", new asc_CAscEditorPermissions());
// Фиктивно инициализируем
t.CoAuthoringUrl = window['g_cAscCoAuthoringUrl'] ? window['g_cAscCoAuthoringUrl'] : '';
t.SpellCheckUrl = window['g_cAscSpellCheckUrl'] ? window['g_cAscSpellCheckUrl'] : '';
}
});
}
};
......@@ -869,10 +870,8 @@ asc_docs_api.prototype.asc_setLocale = function(val)
{
this.InterfaceLocale = val;
};
asc_docs_api.prototype.LoadDocument = function(c_DocInfo)
asc_docs_api.prototype.LoadDocument = function()
{
if(!this.DocInfo && c_DocInfo)
this.asc_setDocInfo(c_DocInfo);
this.WordControl.m_oDrawingDocument.m_bIsOpeningDocument = true;
// Меняем тип состояния (на открытие)
......@@ -1320,11 +1319,12 @@ asc_docs_api.prototype._coAuthoringSetChanges = function(e, oColor)
this._coAuthoringSetChange(e[Index], oColor);
};
asc_docs_api.prototype._coAuthoringInit = function()
asc_docs_api.prototype._coAuthoringInit = function(fCallback)
{
if (!this.CoAuthoringApi) {
g_oIdCounter.Set_Load(false);
this.asyncServerIdEndLoaded ();
fCallback();
return; // Error
}
......@@ -1537,7 +1537,7 @@ asc_docs_api.prototype._coAuthoringInit = function()
if(!(window["NATIVE_EDITOR_ENJINE"] || !documentId)){
this.CoAuthoringApi.set_url(null);
}
this.CoAuthoringApi.init(this.User, documentId, documentCallbackUrl, 'fghhfgsjdgfjs', function(){},
this.CoAuthoringApi.init(this.User, documentId, documentCallbackUrl, 'fghhfgsjdgfjs', fCallback,
c_oEditorId.Word, documentFormatSave, this.isViewMode);
// ToDo init other callbacks
......
......@@ -4384,8 +4384,10 @@ $(".colorWatch").mouseover(function(){
var isViewMode = "true" == getURLParameter("isViewMode");
editor.SetViewMode(isViewMode);
editor.asc_setDocInfo(c_DocInfo);
editor.asc_registerCallback('asc_onGetEditorPermissions', function(){
editor.LoadDocument();
});
editor.asc_getEditorPermissions();
editor.LoadDocument();
$(".mathList").click(function(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