Commit d98b0b37 authored by Alexey.Golubev's avatar Alexey.Golubev Committed by Alexander.Trofimov

Добавлен метод для получения разрешений с сервера.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48524 954022d7-b5bf-4e40-9824-e11837661b57
parent 1602fc29
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
"concat_api": { "concat_api": {
"../Word/api-all.js": [ "../Word/api-all.js": [
"../Word/api.js", "../Word/api.js",
"../Word/apiCommon.js" "../Word/apiCommon.js",
"../Common/apiCommon.js"
] ]
}, },
"extract_api": { "extract_api": {
...@@ -201,7 +202,8 @@ ...@@ -201,7 +202,8 @@
"files": { "files": {
"<%= pkg.menu_path %>/Common/": [ "<%= pkg.menu_path %>/Common/": [
"../Common/docscoapisettings.js", "../Common/docscoapisettings.js",
"../Common/commonDefines.js" "../Common/commonDefines.js",
"../Common/apiCommon.js"
] ]
} }
}, },
......
function CAscEditorPermissions()
{
this.canEdit = true;
this.canDownload = true;
this.canCoAuthoring = true;
this.canReaderMode = true;
this.isAutosaveEnable = true;
this.AutosaveMinInterval = 300;
}
CAscEditorPermissions.prototype.asc_getCanEdit = function(){ return this.canEdit; }
CAscEditorPermissions.prototype.asc_getCanDownload = function(){ return this.canDownload; }
CAscEditorPermissions.prototype.asc_getCanCoAuthoring = function(){ return this.canCoAuthoring; }
CAscEditorPermissions.prototype.asc_getCanReaderMode = function(){ return this.canReaderMode; }
CAscEditorPermissions.prototype.asc_getIsAutosaveEnable = function(){ return this.isAutosaveEnable; }
CAscEditorPermissions.prototype.asc_getAutosaveMinInterval = function(){ return this.AutosaveMinInterval; }
CAscEditorPermissions.prototype.asc_setCanEdit = function(v){ this.canEdit = v; }
CAscEditorPermissions.prototype.asc_setCanDownload = function(v){ this.canDownload = v; }
CAscEditorPermissions.prototype.asc_setCanCoAuthoring = function(v){ this.canCoAuthoring = v; }
CAscEditorPermissions.prototype.asc_setCanReaderMode = function(v){ this.canReaderMode = v; }
CAscEditorPermissions.prototype.asc_setIsAutosaveEnable = function(v){ this.isAutosaveEnable = v; }
CAscEditorPermissions.prototype.asc_setAutosaveMinInterval = function(v){ this.AutosaveMinInterval = v; }
\ No newline at end of file
...@@ -83,6 +83,9 @@ ...@@ -83,6 +83,9 @@
<script src="../Common/FontsFreeType/FontFile.js"></script> <script src="../Common/FontsFreeType/FontFile.js"></script>
<script src="../Common/FontsFreeType/FontManager.js"></script> <script src="../Common/FontsFreeType/FontManager.js"></script>
<script src="../Common/apiCommon.js"></script>
<script src="Drawing/Externals.js"></script> <script src="Drawing/Externals.js"></script>
<script src="Drawing/AllFonts.js"></script> <script src="Drawing/AllFonts.js"></script>
<script src="Drawing/GlobalLoaders.js"></script> <script src="Drawing/GlobalLoaders.js"></script>
......
...@@ -514,6 +514,7 @@ function asc_docs_api(name) ...@@ -514,6 +514,7 @@ function asc_docs_api(name)
this.DocumentUrl = ""; this.DocumentUrl = "";
this.DocumentName = ""; this.DocumentName = "";
this.DocInfo = null;
this.ShowParaMarks = false; this.ShowParaMarks = false;
this.isAddSpaceBetweenPrg = false; this.isAddSpaceBetweenPrg = false;
...@@ -715,19 +716,64 @@ asc_docs_api.prototype.Init = function() ...@@ -715,19 +716,64 @@ asc_docs_api.prototype.Init = function()
} }
this.WordControl.Init(); this.WordControl.Init();
} }
asc_docs_api.prototype.asc_getEditorPermissions = function()
{
if(this.DocInfo && this.DocInfo.get_Id())
{
var rData = {};
rData["c"] = "getsettings";
rData["format"] = this.DocInfo.get_Format();
rData["vkey"] = this.DocInfo.get_VKey();
rData["editorid"] = c_oEditorId.Word;
sendCommand( this, this.asc_getEditorPermissionsCallback, JSON.stringify(rData) );
}
else
{
editor.asc_fireCallback("asc_onGetEditorPermissions", new CAscEditorPermissions());
}
}
asc_docs_api.prototype.asc_getEditorPermissionsCallback = function(incomeObject)
{
if(null != incomeObject && "getsettings" == incomeObject.type){
var oSettings = JSON.parse(incomeObject.data);
//Set up coauthoring and spellcheker service
window.g_cAscCoAuthoringUrl = oSettings['g_cAscCoAuthoringUrl'];
window.g_cAscSpellCheckUrl = oSettings['g_cAscSpellCheckUrl'];
var oEditorPermissions = new CAscEditorPermissions();
oEditorPermissions.asc_setCanEdit(oSettings["canEdit"]);
oEditorPermissions.asc_setCanDownload(oSettings["canDownload"]);
oEditorPermissions.asc_setCanCoAuthoring(oSettings["canCoAuthoring"]);
oEditorPermissions.asc_setCanReaderMode(oSettings["canReaderMode"]);
oEditorPermissions.asc_setIsAutosaveEnable(oSettings["isAutosaveEnable"]);
oEditorPermissions.asc_setAutosaveMinInterval(oSettings["AutosaveMinInterval"]);
editor.asc_fireCallback("asc_onGetEditorPermissions", oEditorPermissions);
}
}
asc_docs_api.prototype.asc_setDocInfo = function(c_DocInfo)
{
if(c_DocInfo)
this.DocInfo = c_DocInfo;
}
asc_docs_api.prototype.LoadDocument = function(c_DocInfo) asc_docs_api.prototype.LoadDocument = function(c_DocInfo)
{ {
this.asc_setDocInfo(c_DocInfo);
this.WordControl.m_oDrawingDocument.m_bIsOpeningDocument = true; this.WordControl.m_oDrawingDocument.m_bIsOpeningDocument = true;
if(c_DocInfo){ if(this.DocInfo){
documentId = c_DocInfo.get_Id(); documentId = this.DocInfo.get_Id();
documentUrl = c_DocInfo.get_Url(); documentUrl = this.DocInfo.get_Url();
documentTitle = c_DocInfo.get_Title(); documentTitle = this.DocInfo.get_Title();
documentFormat = c_DocInfo.get_Format(); documentFormat = this.DocInfo.get_Format();
documentVKey = c_DocInfo.get_VKey(); documentVKey = this.DocInfo.get_VKey();
// documentOrigin = c_DocInfo.get_Origin(); // documentOrigin = this.DocInfo.get_Origin();
var sProtocol = window.location.protocol; var sProtocol = window.location.protocol;
var sHost = window.location.host; var sHost = window.location.host;
documentOrigin = ""; documentOrigin = "";
...@@ -738,14 +784,14 @@ asc_docs_api.prototype.LoadDocument = function(c_DocInfo) ...@@ -738,14 +784,14 @@ asc_docs_api.prototype.LoadDocument = function(c_DocInfo)
var asc_user = window["Asc"].asc_CUser; var asc_user = window["Asc"].asc_CUser;
this.User = new asc_user(); this.User = new asc_user();
this.User.asc_setId(c_DocInfo.get_UserId()); this.User.asc_setId(this.DocInfo.get_UserId());
this.User.asc_setUserName(c_DocInfo.get_UserName()); this.User.asc_setUserName(this.DocInfo.get_UserName());
} }
this.DocumentName = documentTitle; this.DocumentName = documentTitle;
var oThis = this; var oThis = this;
if (c_DocInfo.get_OfflineApp() === true) if (this.DocInfo.get_OfflineApp() === true)
{ {
this.OfflineAppDocumentStartLoad(); this.OfflineAppDocumentStartLoad();
return; return;
...@@ -761,7 +807,7 @@ asc_docs_api.prototype.LoadDocument = function(c_DocInfo) ...@@ -761,7 +807,7 @@ asc_docs_api.prototype.LoadDocument = function(c_DocInfo)
else else
{ {
documentUrl = this.FontLoader.fontFilesPath + "../Word/document/"; documentUrl = this.FontLoader.fontFilesPath + "../Word/document/";
c_DocInfo.put_OfflineApp(true); this.DocInfo.put_OfflineApp(true);
// For test create unique id // For test create unique id
documentId = "0123456789"; documentId = "0123456789";
...@@ -6426,6 +6472,10 @@ function sendCommand(editor, fCallback, rdata){ ...@@ -6426,6 +6472,10 @@ function sendCommand(editor, fCallback, rdata){
if(fCallback) if(fCallback)
fCallback(incomeObject); fCallback(incomeObject);
break; break;
case "getsettings":
if(fCallback)
fCallback(incomeObject);
break;
case "err": case "err":
editor.asc_fireCallback("asc_onError", _mapAscServerErrorToAscError(parseInt(incomeObject.data)), c_oAscError.Level.Critical); editor.asc_fireCallback("asc_onError", _mapAscServerErrorToAscError(parseInt(incomeObject.data)), c_oAscError.Level.Critical);
if(fCallback) if(fCallback)
......
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