[DE embed] Translate embedded viewer. Bug 31297
This commit is contained in:
parent
b936eb54c2
commit
b3cf3b6193
|
@ -61,10 +61,10 @@ common.view.modals = new(function() {
|
|||
'</div>';
|
||||
|
||||
var _tplbody_embed = '<div class="size-manual">' +
|
||||
'<span class="caption">Width:</span>' +
|
||||
'<span class="caption">{width}:</span>' +
|
||||
'<input id="txt-embed-width" class="form-control input-xs" type="text" value="400px">' +
|
||||
'<input id="txt-embed-height" class="form-control input-xs right" type="text" value="600px">' +
|
||||
'<span class="right caption">Height:</span>' +
|
||||
'<span class="right caption">{height}:</span>' +
|
||||
'</div>' +
|
||||
'<textarea id="txt-embed-url" rows="4" class="form-control" readonly></textarea>';
|
||||
|
||||
|
@ -75,22 +75,29 @@ common.view.modals = new(function() {
|
|||
var _$dlg;
|
||||
if (name == 'share') {
|
||||
_$dlg = $(tplDialog
|
||||
.replace(/\{title}/, 'Share Link')
|
||||
.replace(/\{title}/, this.txtShare)
|
||||
.replace(/\{body}/, _tplbody_share)
|
||||
.replace(/\{footer}/, '<button id="btn-copyshort" type="button" class="btn">Copy to clipboard</button>'))
|
||||
.replace(/\{footer}/, '<button id="btn-copyshort" type="button" class="btn">' + this.txtCopy + '</button>'))
|
||||
.appendTo(parent)
|
||||
.attr('id', 'dlg-share');
|
||||
} else
|
||||
if (name == 'embed') {
|
||||
_$dlg = $(tplDialog
|
||||
.replace(/\{title}/, 'Embed')
|
||||
.replace(/\{title}/, this.txtEmbed)
|
||||
.replace(/\{body}/, _tplbody_embed)
|
||||
.replace(/\{footer}/, '<button id="btn-copyembed" type="button" class="btn">Copy to clipboard</button>'))
|
||||
.replace(/\{width}/, this.txtWidth)
|
||||
.replace(/\{height}/, this.txtHeight)
|
||||
.replace(/\{footer}/, '<button id="btn-copyembed" type="button" class="btn">' + this.txtCopy + '</button>'))
|
||||
.appendTo(parent)
|
||||
.attr('id', 'dlg-embed');
|
||||
}
|
||||
|
||||
return _$dlg;
|
||||
}
|
||||
},
|
||||
txtWidth: 'Width',
|
||||
txtHeight: 'Height',
|
||||
txtShare: 'Share Link',
|
||||
txtCopy: 'Copy to clipboard',
|
||||
txtEmbed: 'Embed'
|
||||
};
|
||||
})();
|
||||
|
|
|
@ -330,6 +330,7 @@
|
|||
</script>
|
||||
|
||||
<!--application-->
|
||||
<script type="text/javascript" src="../../common/locale.js"></script>
|
||||
<script type="text/javascript" src="../../common/Gateway.js"></script>
|
||||
<script type="text/javascript" src="../../common/Analytics.js"></script>
|
||||
<script type="text/javascript" src="../../common/embed/lib/util/utils.js"></script>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
var ApplicationController = new(function(){
|
||||
DE.ApplicationController = new(function(){
|
||||
var me,
|
||||
api,
|
||||
config = {},
|
||||
|
@ -51,7 +51,7 @@ var ApplicationController = new(function(){
|
|||
// -------------------------
|
||||
|
||||
if (typeof isBrowserSupported !== 'undefined' && !isBrowserSupported()){
|
||||
Common.Gateway.reportError(undefined, 'Your browser is not supported.');
|
||||
Common.Gateway.reportError(undefined, this.unsupportedBrowserErrorText);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ var ApplicationController = new(function(){
|
|||
|
||||
function onCountPages(count) {
|
||||
maxPages = count;
|
||||
$('#pages').text('of ' + count);
|
||||
$('#pages').text(me.textOf + " " + count);
|
||||
}
|
||||
|
||||
function onCurrentPage(number) {
|
||||
|
@ -134,10 +134,10 @@ var ApplicationController = new(function(){
|
|||
switch (id)
|
||||
{
|
||||
case Asc.c_oAscAsyncAction['Print']:
|
||||
text = 'Downloading document...';
|
||||
text = me.downloadTextText;
|
||||
break;
|
||||
default:
|
||||
text = 'Please wait...';
|
||||
text = me.waitText;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -248,12 +248,12 @@ var ApplicationController = new(function(){
|
|||
Common.Gateway.on('processmouse', onProcessMouse);
|
||||
Common.Gateway.on('downloadas', onDownloadAs);
|
||||
|
||||
ApplicationView.tools.get('#idt-fullscreen')
|
||||
DE.ApplicationView.tools.get('#idt-fullscreen')
|
||||
.on('click', function(){
|
||||
common.utils.openLink(embedConfig.fullscreenUrl);
|
||||
});
|
||||
|
||||
ApplicationView.tools.get('#idt-download')
|
||||
DE.ApplicationView.tools.get('#idt-download')
|
||||
.on('click', function(){
|
||||
if ( !!embedConfig.saveUrl ){
|
||||
common.utils.openLink(embedConfig.saveUrl);
|
||||
|
@ -354,14 +354,14 @@ var ApplicationController = new(function(){
|
|||
|
||||
function onOpenDocument(progress) {
|
||||
var proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount());
|
||||
$('#loadmask-text').html('Loading document: ' + Math.min(Math.round(proc * 100), 100) + '%');
|
||||
$('#loadmask-text').html(me.textLoadingDocument + ': ' + + Math.min(Math.round(proc * 100), 100) + '%');
|
||||
}
|
||||
|
||||
function onError(id, level, errData) {
|
||||
if (id == Asc.c_oAscError.ID.LoadingScriptError) {
|
||||
$('#id-critical-error-title').text(me.criticalErrorTitle);
|
||||
$('#id-critical-error-message').text(me.scriptLoadError);
|
||||
$('#id-critical-error-close').off().on('click', function(){
|
||||
$('#id-critical-error-close').text(me.txtClose).off().on('click', function(){
|
||||
window.location.reload();
|
||||
});
|
||||
$('#id-critical-error-dialog').css('z-index', 20002).modal('show');
|
||||
|
@ -410,8 +410,7 @@ var ApplicationController = new(function(){
|
|||
|
||||
$('#id-critical-error-title').text(me.criticalErrorTitle);
|
||||
$('#id-critical-error-message').text(message);
|
||||
$('#id-critical-error-close').off();
|
||||
$('#id-critical-error-close').on('click', function(){
|
||||
$('#id-critical-error-close').text(me.txtClose).off().on('click', function(){
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
|
@ -420,8 +419,7 @@ var ApplicationController = new(function(){
|
|||
|
||||
$('#id-critical-error-title').text(me.notcriticalErrorTitle);
|
||||
$('#id-critical-error-message').text(message);
|
||||
$('#id-critical-error-close').off();
|
||||
$('#id-critical-error-close').on('click', function(){
|
||||
$('#id-critical-error-close').text(me.txtClose).off().on('click', function(){
|
||||
$('#id-critical-error-dialog').modal('hide');
|
||||
});
|
||||
}
|
||||
|
@ -434,7 +432,7 @@ var ApplicationController = new(function(){
|
|||
function onExternalMessage(error) {
|
||||
if (error) {
|
||||
hidePreloader();
|
||||
$('#id-error-mask-title').text('Error');
|
||||
$('#id-error-mask-title').text(me.criticalErrorTitle);
|
||||
$('#id-error-mask-text').text(error.msg);
|
||||
$('#id-error-mask').css('display', 'block');
|
||||
|
||||
|
@ -549,6 +547,12 @@ var ApplicationController = new(function(){
|
|||
scriptLoadError: 'The connection is too slow, some of the components could not be loaded. Please reload the page.',
|
||||
errorFilePassProtect: 'The file is password protected and cannot be opened.',
|
||||
errorAccessDeny: 'You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.',
|
||||
errorUserDrop: 'The file cannot be accessed right now.'
|
||||
errorUserDrop: 'The file cannot be accessed right now.',
|
||||
unsupportedBrowserErrorText: 'Your browser is not supported.',
|
||||
textOf: 'of',
|
||||
downloadTextText: 'Downloading document...',
|
||||
waitText: 'Please, wait...',
|
||||
textLoadingDocument: 'Loading document',
|
||||
txtClose: 'Close'
|
||||
}
|
||||
})();
|
|
@ -30,7 +30,11 @@
|
|||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
var ApplicationView = new(function(){
|
||||
if (DE === undefined) {
|
||||
var DE = {};
|
||||
}
|
||||
|
||||
DE.ApplicationView = new(function(){
|
||||
var $btnTools;
|
||||
|
||||
// Initialize view
|
||||
|
@ -41,10 +45,10 @@ var ApplicationView = new(function(){
|
|||
$btnTools.addClass('dropdown-toggle').attr('data-toggle', 'dropdown').attr('aria-expanded', 'true');
|
||||
$btnTools.parent().append(
|
||||
'<ul class="dropdown-menu">' +
|
||||
'<li><a id="idt-download"><span class="mi-icon svg-icon download"></span>Download</a></li>' +
|
||||
'<li><a id="idt-share" data-toggle="modal"><span class="mi-icon svg-icon share"></span>Share</a></li>' +
|
||||
'<li><a id="idt-embed" data-toggle="modal"><span class="mi-icon svg-icon embed"></span>Embed</a></li>' +
|
||||
'<li><a id="idt-fullscreen"><span class="mi-icon svg-icon fullscr"></span>Full Screen</a></li>' +
|
||||
'<li><a id="idt-download"><span class="mi-icon svg-icon download"></span>' + this.txtDownload + '</a></li>' +
|
||||
'<li><a id="idt-share" data-toggle="modal"><span class="mi-icon svg-icon share"></span>' + this.txtShare + '</a></li>' +
|
||||
'<li><a id="idt-embed" data-toggle="modal"><span class="mi-icon svg-icon embed"></span>' + this.txtEmbed + '</a></li>' +
|
||||
'<li><a id="idt-fullscreen"><span class="mi-icon svg-icon fullscr"></span>' + this.txtFullScreen + '</a></li>' +
|
||||
'</ul>');
|
||||
}
|
||||
|
||||
|
@ -56,6 +60,11 @@ var ApplicationView = new(function(){
|
|||
create: createView
|
||||
, tools: {
|
||||
get: getTools
|
||||
}
|
||||
},
|
||||
|
||||
txtDownload: 'Download',
|
||||
txtShare: 'Share',
|
||||
txtEmbed: 'Embed',
|
||||
txtFullScreen: 'Full Screen'
|
||||
}
|
||||
})();
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
*
|
||||
*/
|
||||
+function ($) {
|
||||
ApplicationView.create();
|
||||
ApplicationController.create();
|
||||
Common.Locale.apply();
|
||||
DE.ApplicationView.create();
|
||||
DE.ApplicationController.create();
|
||||
}();
|
||||
|
|
26
apps/documenteditor/embed/locale/en.json
Normal file
26
apps/documenteditor/embed/locale/en.json
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"common.view.modals.txtWidth": "Width",
|
||||
"common.view.modals.txtHeight": "Height",
|
||||
"common.view.modals.txtShare": "Share Link",
|
||||
"common.view.modals.txtCopy": "Copy to clipboard",
|
||||
"common.view.modals.txtEmbed": "Embed",
|
||||
"DE.ApplicationView.txtDownload": "Download",
|
||||
"DE.ApplicationView.txtShare": "Share",
|
||||
"DE.ApplicationView.txtEmbed": "Embed",
|
||||
"DE.ApplicationView.txtFullScreen": "Full Screen",
|
||||
"DE.ApplicationController.errorDefaultMessage": "Error code: %1",
|
||||
"DE.ApplicationController.unknownErrorText": "Unknown error.",
|
||||
"DE.ApplicationController.convertationTimeoutText": "Convertation timeout exceeded.",
|
||||
"DE.ApplicationController.convertationErrorText": "Convertation failed.",
|
||||
"DE.ApplicationController.downloadErrorText": "Download failed.",
|
||||
"DE.ApplicationController.criticalErrorTitle": "Error",
|
||||
"DE.ApplicationController.notcriticalErrorTitle": "Warning",
|
||||
"DE.ApplicationController.scriptLoadError": "The connection is too slow, some of the components could not be loaded. Please reload the page.",
|
||||
"DE.ApplicationController.errorFilePassProtect": "The file is password protected and cannot be opened.",
|
||||
"DE.ApplicationController.errorAccessDeny": "You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.",
|
||||
"DE.ApplicationController.errorUserDrop": "The file cannot be accessed right now.",
|
||||
"DE.ApplicationController.textOf": "of",
|
||||
"DE.ApplicationController.unsupportedBrowserErrorText": "Your browser is not supported.",
|
||||
"DE.ApplicationController.textLoadingDocument": "Loading document",
|
||||
"DE.ApplicationController.txtClose": "Close"
|
||||
}
|
25
apps/documenteditor/embed/locale/ru.json
Normal file
25
apps/documenteditor/embed/locale/ru.json
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"common.view.modals.txtWidth": "Ширина",
|
||||
"common.view.modals.txtHeight": "Высота",
|
||||
"common.view.modals.txtShare": "Поделиться ссылкой",
|
||||
"common.view.modals.txtCopy": "Скопировать в буфер",
|
||||
"common.view.modals.txtEmbed": "Встроить",
|
||||
"DE.ApplicationView.txtDownload": "Скачать файл",
|
||||
"DE.ApplicationView.txtShare": "Поделиться",
|
||||
"DE.ApplicationView.txtEmbed": "Встроить",
|
||||
"DE.ApplicationView.txtFullScreen": "Во весь экран",
|
||||
"DE.ApplicationController.errorDefaultMessage": "Код ошибки: %1",
|
||||
"DE.ApplicationController.unknownErrorText": "Неизвестная ошибка.",
|
||||
"DE.ApplicationController.convertationTimeoutText": "Превышено время ожидания конвертации.",
|
||||
"DE.ApplicationController.convertationErrorText": "Конвертация не удалась.",
|
||||
"DE.ApplicationController.downloadErrorText": "Загрузка не удалась.",
|
||||
"DE.ApplicationController.criticalErrorTitle": "Ошибка",
|
||||
"DE.ApplicationController.notcriticalErrorTitle": "Внимание",
|
||||
"DE.ApplicationController.scriptLoadError": "Слишком медленное подключение, некоторые компоненты не удалось загрузить. Пожалуйста, обновите страницу.",
|
||||
"DE.ApplicationController.errorFilePassProtect": "Файл защищен паролем и не может быть открыт.",
|
||||
"DE.ApplicationController.errorAccessDeny": "Вы пытаетесь выполнить действие, на которое у вас нет прав.<br>Пожалуйста, обратитесь к администратору Сервера документов.",
|
||||
"DE.ApplicationController.errorUserDrop": "В настоящий момент файл недоступен.",
|
||||
"DE.ApplicationController.textOf": "из",
|
||||
"DE.ApplicationController.textLoadingDocument": "Загрузка документа",
|
||||
"DE.ApplicationController.txtClose": "Закрыть"
|
||||
}
|
|
@ -404,6 +404,9 @@ module.exports = function(grunt) {
|
|||
},
|
||||
|
||||
copy: {
|
||||
localization: {
|
||||
files: packageFile['embed']['copy']['localization']
|
||||
},
|
||||
'index-page': {
|
||||
files: packageFile['embed']['copy']['index-page']
|
||||
},
|
||||
|
|
|
@ -368,6 +368,7 @@
|
|||
},
|
||||
"js": {
|
||||
"src": [
|
||||
"../apps/common/locale.js",
|
||||
"../apps/common/Gateway.js",
|
||||
"../apps/common/Analytics.js",
|
||||
"../apps/common/embed/lib/util/utils.js",
|
||||
|
@ -386,6 +387,14 @@
|
|||
}
|
||||
},
|
||||
"copy": {
|
||||
"localization": [
|
||||
{
|
||||
"expand": true,
|
||||
"cwd": "../apps/documenteditor/embed/locale/",
|
||||
"src": "*",
|
||||
"dest": "../deploy/web-apps/apps/documenteditor/embed/locale/"
|
||||
}
|
||||
],
|
||||
"index-page": {
|
||||
"../deploy/web-apps/apps/documenteditor/embed/index.html": "../apps/documenteditor/embed/index.html.deploy"
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue