Commit 3d536247 authored by Alexey.Musinov's avatar Alexey.Musinov

open documents with password (ios)

parent 83d09cb5
......@@ -300,7 +300,7 @@ function setTimeout(func, interval) {
var id = window["native"]["GenerateTimeoutId"](interval);
window.NativeTimeoutObject["" + id] = {"func": func, repeat: false};
return id;
}
......@@ -318,7 +318,7 @@ function setInterval(func, interval) {
var id = window["native"]["GenerateTimeoutId"](interval);
window.NativeTimeoutObject["" + id] = {func: func, repeat: true, interval: interval};
return id;
}
function clearInterval(id) {
......@@ -334,26 +334,26 @@ function offline_timeoutFire(id) {
return;
var prop = "" + id;
if (undefined === window.NativeTimeoutObject[prop]) {
return;
}
var func = window.NativeTimeoutObject[prop].func;
var repeat = window.NativeTimeoutObject[prop].repeat;
var interval = window.NativeTimeoutObject[prop].interval;
window.NativeTimeoutObject[prop] = undefined;
if (!func)
return;
func.call(null);
if (repeat) {
setInterval(func, interval);
}
func = null;
}
......@@ -363,7 +363,7 @@ window.clearInterval = clearInterval;
window.setInterval = setInterval;
var console = {
log : function(param) { window.native.consoleLog(param); },
log : function(param) { window["native"]["consoleLog"](param); },
time : function (param) {},
timeEnd : function (param) {}
};
......
......@@ -3887,6 +3887,8 @@ function OfflineEditor () {
var docInfo = new Asc.asc_CDocInfo();
docInfo.put_Id(this.initSettings["docKey"]);
docInfo.put_Url(this.initSettings["docURL"]);
docInfo.put_Format("xlsx");
docInfo.put_UserInfo(userInfo);
_api.asc_setDocInfo(docInfo);
......@@ -3904,7 +3906,7 @@ function OfflineEditor () {
this.asc_WriteAllWorksheets(true);
_api.sendColorThemes(_api.wbModel.theme);
_api.sendColorThemes(_api.wbModel.theme);
_api.asc_ApplyColorScheme(false);
_api._applyFirstLoadChanges();
......@@ -3914,8 +3916,8 @@ function OfflineEditor () {
ws._fixSelectionOfMergedCells();
if (ws.topLeftFrozenCell) {
this.row0 = ws.topLeftFrozenCell.getRow0();
this.col0 = ws.topLeftFrozenCell.getCol0();
this.row0 = ws.topLeftFrozenCell.getRow0();
this.col0 = ws.topLeftFrozenCell.getCol0();
}
// TODO: Implement frozen places
......@@ -4077,6 +4079,13 @@ function OfflineEditor () {
me.needToUpdateVersion = true;
if (callback) callback.call(me);
});
_api.asc_registerCallback("asc_onAdvancedOptions", function(options) {
var stream = global_memory_stream_menu;
stream["ClearNoAttack"]();
stream["WriteLong"](options.asc_getOptionId());
window["native"]["OnCallMenuEvent"](22000, stream); // ASC_MENU_EVENT_TYPE_ADVANCED_OPTIONS
});
};
this.updateFrozen = function () {
var ws = _api.wb.getWorksheet();
......@@ -7362,60 +7371,66 @@ window["native"]["offline_apply_event"] = function(type,params) {
// console.log("JS - " + dataObject['type']);
switch (dataObject['type']) {
case 'auth' :
t._onAuth(dataObject);
break;
case 'message' :
t._onMessages(dataObject, false);
break;
case 'cursor' :
t._onCursor(dataObject);
break;
case 'meta' :
t._onMeta(dataObject);
break;
case 'getLock' :
t._onGetLock(dataObject);
break;
case 'releaseLock' :
t._onReleaseLock(dataObject);
break;
case 'connectState' :
t._onConnectionStateChanged(dataObject);
break;
case 'saveChanges' :
t._onSaveChanges(dataObject);
break;
case 'saveLock' :
t._onSaveLock(dataObject);
break;
case 'unSaveLock' :
t._onUnSaveLock(dataObject);
break;
case 'savePartChanges' :
t._onSavePartChanges(dataObject);
break;
case 'drop' :
t._onDrop(dataObject);
break;
case 'waitAuth' : /*Ждем, когда придет auth, документ залочен*/
break;
case 'error' : /*Старая версия sdk*/
t._onDrop(dataObject);
break;
case 'documentOpen' :
t._documentOpen(dataObject);
break;
case 'warning':
t._onWarning(dataObject);
break;
case 'license':
t._onLicense(dataObject);
break;
case 'session' :
t._onSession(dataObject);
break;
}
case 'auth' :
t._onAuth(dataObject);
break;
case 'message' :
t._onMessages(dataObject, false);
break;
case 'cursor' :
t._onCursor(dataObject);
break;
case 'meta' :
t._onMeta(dataObject);
break;
case 'getLock' :
t._onGetLock(dataObject);
break;
case 'releaseLock' :
t._onReleaseLock(dataObject);
break;
case 'connectState' :
t._onConnectionStateChanged(dataObject);
break;
case 'saveChanges' :
t._onSaveChanges(dataObject);
break;
case 'saveLock' :
t._onSaveLock(dataObject);
break;
case 'unSaveLock' :
t._onUnSaveLock(dataObject);
break;
case 'savePartChanges' :
t._onSavePartChanges(dataObject);
break;
case 'drop' :
t._onDrop(dataObject);
break;
case 'waitAuth' : /*Ждем, когда придет auth, документ залочен*/
break;
case 'error' : /*Старая версия sdk*/
t._onDrop(dataObject);
break;
case 'documentOpen' :
t._documentOpen(dataObject);
break;
case 'warning':
t._onWarning(dataObject);
break;
case 'license':
t._onLicense(dataObject);
break;
case 'session' :
t._onSession(dataObject);
break;
case 'refreshToken' :
t._onRefreshToken(dataObject["messages"]);
break;
case 'expiredToken' :
t._onExpiredToken();
break;
}
break;
}
......@@ -7451,6 +7466,12 @@ window["native"]["offline_apply_event"] = function(type,params) {
break;
}
case 22001: // ASC_MENU_EVENT_TYPE_SET_PASSWORD
{
_api.asc_setDocumentPassword(params[0]);
break;
}
default:
break;
}
......@@ -7458,6 +7479,22 @@ window["native"]["offline_apply_event"] = function(type,params) {
return _return;
}
window["Asc"]["spreadsheet_api"].prototype.asc_setDocumentPassword = function(password)
{
var v = {
"id": this.documentId,
"userid": this.documentUserId,
"format": this.documentFormat,
"c": "reopen",
"url": this.documentUrl,
"title": this.documentTitle,
"embeddedfonts": this.isUseEmbeddedCutFonts,
"password": password
};
AscCommon.sendCommand(this, null, v);
};
function testLockedObjects () {
var ws = _api.wb.getWorksheet();
......
......@@ -2202,60 +2202,66 @@ Asc['asc_docs_api'].prototype["Call_Menu_Event"] = function(type, _params)
// console.log("JS - " + dataObject['type']);
switch (dataObject['type']) {
case 'auth' :
t._onAuth(dataObject);
break;
case 'message' :
t._onMessages(dataObject, false);
break;
case 'cursor' :
t._onCursor(dataObject);
break;
case 'meta' :
t._onMeta(dataObject);
break;
case 'getLock' :
t._onGetLock(dataObject);
break;
case 'releaseLock' :
t._onReleaseLock(dataObject);
break;
case 'connectState' :
t._onConnectionStateChanged(dataObject);
break;
case 'saveChanges' :
t._onSaveChanges(dataObject);
break;
case 'saveLock' :
t._onSaveLock(dataObject);
break;
case 'unSaveLock' :
t._onUnSaveLock(dataObject);
break;
case 'savePartChanges' :
t._onSavePartChanges(dataObject);
break;
case 'drop' :
t._onDrop(dataObject);
break;
case 'waitAuth' : /*Ждем, когда придет auth, документ залочен*/
break;
case 'error' : /*Старая версия sdk*/
t._onDrop(dataObject);
break;
case 'documentOpen' :
t._documentOpen(dataObject);
break;
case 'warning':
t._onWarning(dataObject);
break;
case 'license':
t._onLicense(dataObject);
break;
case 'session' :
t._onSession(dataObject);
break;
}
case 'auth' :
t._onAuth(dataObject);
break;
case 'message' :
t._onMessages(dataObject, false);
break;
case 'cursor' :
t._onCursor(dataObject);
break;
case 'meta' :
t._onMeta(dataObject);
break;
case 'getLock' :
t._onGetLock(dataObject);
break;
case 'releaseLock' :
t._onReleaseLock(dataObject);
break;
case 'connectState' :
t._onConnectionStateChanged(dataObject);
break;
case 'saveChanges' :
t._onSaveChanges(dataObject);
break;
case 'saveLock' :
t._onSaveLock(dataObject);
break;
case 'unSaveLock' :
t._onUnSaveLock(dataObject);
break;
case 'savePartChanges' :
t._onSavePartChanges(dataObject);
break;
case 'drop' :
t._onDrop(dataObject);
break;
case 'waitAuth' : /*Ждем, когда придет auth, документ залочен*/
break;
case 'error' : /*Старая версия sdk*/
t._onDrop(dataObject);
break;
case 'documentOpen' :
t._documentOpen(dataObject);
break;
case 'warning':
t._onWarning(dataObject);
break;
case 'license':
t._onLicense(dataObject);
break;
case 'session' :
t._onSession(dataObject);
break;
case 'refreshToken' :
t._onRefreshToken(dataObject["messages"]);
break;
case 'expiredToken' :
t._onExpiredToken();
break;
}
break;
}
......@@ -2294,12 +2300,42 @@ Asc['asc_docs_api'].prototype["Call_Menu_Event"] = function(type, _params)
break;
}
case 21001: // ASC_COAUTH_EVENT_TYPE_LOAD_URL_IMAGE
{
_api.WordControl.m_oDrawingDocument.ClearCachePages();
_api.WordControl.m_oDrawingDocument.FirePaint();
break;
}
case 22001: // ASC_MENU_EVENT_TYPE_SET_PASSWORD
{
_api.asc_setDocumentPassword(_params[0]);
break;
}
default:
break;
}
return _return;
};
Asc['asc_docs_api'].prototype.asc_setDocumentPassword = function(password)
{
var v = {
"id": this.documentId,
"userid": this.documentUserId,
"format": this.documentFormat,
"c": "reopen",
"url": this.documentUrl,
"title": this.documentTitle,
"embeddedfonts": this.isUseEmbeddedCutFonts,
"password": password
};
AscCommon.sendCommand(this, null, v);
};
function asc_menu_WriteHeaderFooterPr(_hdrftrPr, _stream)
{
if (_hdrftrPr.Type !== undefined && _hdrftrPr.Type !== null)
......@@ -5787,10 +5823,19 @@ function NativeOpenFile3(_params, documentInfo)
var docInfo = new Asc.asc_CDocInfo();
docInfo.put_Id(window.documentInfo["docKey"]);
docInfo.put_Url(window.documentInfo["docURL"]);
docInfo.put_Format("docx");
docInfo.put_UserInfo(userInfo);
_api.asc_setDocInfo(docInfo);
_api.asc_registerCallback("asc_onAdvancedOptions", function(options) {
var stream = global_memory_stream_menu;
stream["ClearNoAttack"]();
stream["WriteLong"](options.asc_getOptionId());
window["native"]["OnCallMenuEvent"](22000, stream); // ASC_MENU_EVENT_TYPE_ADVANCED_OPTIONS
});
if (window.documentInfo["iscoauthoring"]) {
_api.isSpellCheckEnable = false;
......@@ -6000,7 +6045,6 @@ Asc['asc_docs_api'].prototype.openDocument = function(sData)
};
window["AscCommon"].getFullImageSrc2 = function (src) {
var start = src.slice(0, 6);
if (0 === start.indexOf('theme') && editor.ThemeLoader){
return editor.ThemeLoader.ThemesUrlAbs + src;
......
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