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