[SSE mobile] Additional options for open CSV.

This commit is contained in:
Alexander Yuzhin 2016-12-25 16:45:53 +03:00
parent e19908f21f
commit 6b12e7e012
5 changed files with 164 additions and 59 deletions

View file

@ -315,7 +315,7 @@ define([
} else { } else {
_.delay(function () { _.delay(function () {
$(me.loadMask).hasClass('modal-in') && uiApp.closeModal(me.loadMask); $(me.loadMask).hasClass('modal-in') && uiApp.closeModal(me.loadMask);
}, 200); }, 300);
} }
if (id==Asc.c_oAscAsyncAction['Save'] && (!me._state.fastCoauth || me._state.usersCount<2)) { if (id==Asc.c_oAscAsyncAction['Save'] && (!me._state.fastCoauth || me._state.usersCount<2)) {
@ -324,98 +324,102 @@ define([
}, },
setLongActionView: function(action) { setLongActionView: function(action) {
var title = '', var me = this,
title = '',
text = ''; text = '';
switch (action.id) { switch (action.id) {
case Asc.c_oAscAsyncAction['Open']: case Asc.c_oAscAsyncAction['Open']:
title = this.openTitleText; title = me.openTitleText;
text = this.openTextText; text = me.openTextText;
break; break;
case Asc.c_oAscAsyncAction['Save']: case Asc.c_oAscAsyncAction['Save']:
this._state.isSaving = new Date(); me._state.isSaving = new Date();
title = this.saveTitleText; title = me.saveTitleText;
text = this.saveTextText; text = me.saveTextText;
break; break;
case Asc.c_oAscAsyncAction['LoadDocumentFonts']: case Asc.c_oAscAsyncAction['LoadDocumentFonts']:
title = this.loadFontsTitleText; title = me.loadFontsTitleText;
text = this.loadFontsTextText; text = me.loadFontsTextText;
break; break;
case Asc.c_oAscAsyncAction['LoadDocumentImages']: case Asc.c_oAscAsyncAction['LoadDocumentImages']:
title = this.loadImagesTitleText; title = me.loadImagesTitleText;
text = this.loadImagesTextText; text = me.loadImagesTextText;
break; break;
case Asc.c_oAscAsyncAction['LoadFont']: case Asc.c_oAscAsyncAction['LoadFont']:
title = this.loadFontTitleText; title = me.loadFontTitleText;
text = this.loadFontTextText; text = me.loadFontTextText;
break; break;
case Asc.c_oAscAsyncAction['LoadImage']: case Asc.c_oAscAsyncAction['LoadImage']:
title = this.loadImageTitleText; title = me.loadImageTitleText;
text = this.loadImageTextText; text = me.loadImageTextText;
break; break;
case Asc.c_oAscAsyncAction['DownloadAs']: case Asc.c_oAscAsyncAction['DownloadAs']:
title = this.downloadTitleText; title = me.downloadTitleText;
text = this.downloadTextText; text = me.downloadTextText;
break; break;
case Asc.c_oAscAsyncAction['Print']: case Asc.c_oAscAsyncAction['Print']:
title = this.printTitleText; title = me.printTitleText;
text = this.printTextText; text = me.printTextText;
break; break;
case Asc.c_oAscAsyncAction['UploadImage']: case Asc.c_oAscAsyncAction['UploadImage']:
title = this.uploadImageTitleText; title = me.uploadImageTitleText;
text = this.uploadImageTextText; text = me.uploadImageTextText;
break; break;
case Asc.c_oAscAsyncAction['ApplyChanges']: case Asc.c_oAscAsyncAction['ApplyChanges']:
title = this.applyChangesTitleText; title = me.applyChangesTitleText;
text = this.applyChangesTextText; text = me.applyChangesTextText;
break; break;
case Asc.c_oAscAsyncAction['PrepareToSave']: case Asc.c_oAscAsyncAction['PrepareToSave']:
title = this.savePreparingText; title = me.savePreparingText;
text = this.savePreparingTitle; text = me.savePreparingTitle;
break; break;
case Asc.c_oAscAsyncAction['MailMergeLoadFile']: case Asc.c_oAscAsyncAction['MailMergeLoadFile']:
title = this.mailMergeLoadFileText; title = me.mailMergeLoadFileText;
text = this.mailMergeLoadFileTitle; text = me.mailMergeLoadFileTitle;
break; break;
case Asc.c_oAscAsyncAction['DownloadMerge']: case Asc.c_oAscAsyncAction['DownloadMerge']:
title = this.downloadMergeTitle; title = me.downloadMergeTitle;
text = this.downloadMergeText; text = me.downloadMergeText;
break; break;
case Asc.c_oAscAsyncAction['SendMailMerge']: case Asc.c_oAscAsyncAction['SendMailMerge']:
title = this.sendMergeTitle; title = me.sendMergeTitle;
text = this.sendMergeText; text = me.sendMergeText;
break; break;
case ApplyEditRights: case ApplyEditRights:
title = this.txtEditingMode; title = me.txtEditingMode;
text = this.txtEditingMode; text = me.txtEditingMode;
break; break;
case LoadingDocument: case LoadingDocument:
title = this.loadingDocumentTitleText; title = me.loadingDocumentTitleText;
text = this.loadingDocumentTextText; text = me.loadingDocumentTextText;
break; break;
} }
if (action.type == Asc.c_oAscAsyncActionType['BlockInteraction']) { if (action.type == Asc.c_oAscAsyncActionType.BlockInteraction) {
if (!this.loadMask) if (me.loadMask && $(me.loadMask).hasClass('modal-in')) {
this.loadMask = uiApp.showPreloader(title); $$(me.loadMask).find('.modal-title').text(title);
} else {
me.loadMask = uiApp.showPreloader(title);
}
} }
else { else {
// this.getApplication().getController('Statusbar').setStatusCaption(text); // me.getApplication().getController('Statusbar').setStatusCaption(text);
} }
}, },
@ -428,7 +432,7 @@ define([
// data.requestrights = true; // data.requestrights = true;
// this.appOptions.isEdit= true; // this.appOptions.isEdit= true;
// //
// this.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'],ApplyEditRights); // this.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,ApplyEditRights);
// //
// var me = this; // var me = this;
// setTimeout(function(){ // setTimeout(function(){
@ -497,7 +501,7 @@ define([
// me.api.asc_cleanSelection(); // me.api.asc_cleanSelection();
me.hidePreloader(); me.hidePreloader();
me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); me.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument);
value = (this.appOptions.isEditMailMerge || this.appOptions.isEditDiagram) ? 100 : Common.localStorage.getItem("sse-settings-zoom"); value = (this.appOptions.isEditMailMerge || this.appOptions.isEditDiagram) ? 100 : Common.localStorage.getItem("sse-settings-zoom");
var zf = (value!==null) ? parseInt(value)/100 : (this.appOptions.customization && this.appOptions.customization.zoom ? parseInt(this.appOptions.customization.zoom)/100 : 1); var zf = (value!==null) ? parseInt(value)/100 : (this.appOptions.customization && this.appOptions.customization.zoom ? parseInt(this.appOptions.customization.zoom)/100 : 1);
@ -710,11 +714,11 @@ define([
if (me.appOptions.isEditDiagram) if (me.appOptions.isEditDiagram)
me.api.asc_registerCallback('asc_onSelectionChanged', _.bind(me.onSelectionChanged, me)); me.api.asc_registerCallback('asc_onSelectionChanged', _.bind(me.onSelectionChanged, me));
if (me.stackLongActions.exist({id: ApplyEditRights, type: Asc.c_oAscAsyncActionType['BlockInteraction']})) { if (me.stackLongActions.exist({id: ApplyEditRights, type: Asc.c_oAscAsyncActionType.BlockInteraction})) {
me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], ApplyEditRights); me.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction, ApplyEditRights);
} else if (!this._isDocReady) { } else if (!this._isDocReady) {
me.hidePreloader(); me.hidePreloader();
me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); me.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument);
} }
// Message on window close // Message on window close
@ -737,7 +741,7 @@ define([
onError: function(id, level, errData) { onError: function(id, level, errData) {
this.hidePreloader(); this.hidePreloader();
this.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument);
var config = { var config = {
closable: false closable: false
@ -1085,7 +1089,7 @@ define([
onUpdateVersion: function(callback) { onUpdateVersion: function(callback) {
var me = this; var me = this;
me.needToUpdateVersion = true; me.needToUpdateVersion = true;
me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); me.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument);
uiApp.alert( uiApp.alert(
me.errorUpdateVersion, me.errorUpdateVersion,
@ -1098,7 +1102,7 @@ define([
callback.call(me); callback.call(me);
} }
me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); me.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument);
}) })
}); });
}, },
@ -1138,7 +1142,76 @@ define([
var type = advOptions.asc_getOptionId(), var type = advOptions.asc_getOptionId(),
me = this, modal; me = this, modal;
if (type == Asc.c_oAscAdvancedOptionsID.CSV) { if (type == Asc.c_oAscAdvancedOptionsID.CSV) {
// TODO: Fix Open CSV var picker,
pages = [],
pagesName = [];
_.each(advOptions.asc_getOptions().asc_getCodePages(), function(page) {
pages.push(page.asc_getCodePage());
pagesName.push(page.asc_getCodePageName());
});
$(me.loadMask).hasClass('modal-in') && uiApp.closeModal(me.loadMask);
me.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument);
modal = uiApp.modal({
title: me.advCSVOptions,
text: '',
afterText:
'<div class="content-block small-picker" style="padding: 0; margin: 20px 0 0;">' +
'<div class="row">' +
'<div class="col-50" style="text-align: left;">' + me.txtEncoding + '</div>' +
'<div class="col-50" style="text-align: right;">' + me.txtDelimiter + '</div>' +
'</div>' +
'<div id="txt-encoding" class="small"></div>' +
'</div>',
buttons: [
{
text: 'OK',
bold: true,
onClick: function() {
var encoding = picker.cols[0].value,
delimiter = picker.cols[1].value;
if (me.api) {
me.api.asc_setAdvancedOptions(type, new Asc.asc_CCSVAdvancedOptions(encoding, delimiter));
if (!me._isDocReady) {
me.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument);
}
}
}
}
]
});
var recommendedSettings = advOptions.asc_getOptions().asc_getRecommendedSettings();
picker = uiApp.picker({
container: '#txt-encoding',
toolbar: false,
rotateEffect: true,
value: [
recommendedSettings && recommendedSettings.asc_getCodePage(),
(recommendedSettings && recommendedSettings.asc_getDelimiter()) ? recommendedSettings.asc_getDelimiter() : 4
],
cols: [{
textAlign: 'left',
values: pages,
displayValues: pagesName
},{
textAlign: 'right',
width: 120,
values: [4, 2, 3, 1, 5],
displayValues: [',', ';', ':', this.txtTab, this.txtSpace]
}]
});
// Vertical align
$$(modal).css({
marginTop: - Math.round($$(modal).outerHeight() / 2) + 'px'
});
} else if (type == Asc.c_oAscAdvancedOptionsID.DRM) { } else if (type == Asc.c_oAscAdvancedOptionsID.DRM) {
modal = uiApp.modal({ modal = uiApp.modal({
title: me.advDRMOptions, title: me.advDRMOptions,
@ -1153,7 +1226,7 @@ define([
me.api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(password)); me.api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(password));
if (!me._isDocReady) { if (!me._isDocReady) {
me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); me.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument);
} }
} }
} }
@ -1324,7 +1397,15 @@ define([
warnLicenseExp: 'Your license has expired.<br>Please update your license and refresh the page.', warnLicenseExp: 'Your license has expired.<br>Please update your license and refresh the page.',
titleLicenseExp: 'License expired', titleLicenseExp: 'License expired',
openErrorText: 'An error has occurred while opening the file', openErrorText: 'An error has occurred while opening the file',
saveErrorText: 'An error has occurred while saving the file' saveErrorText: 'An error has occurred while saving the file',
txtEncoding: 'Encoding',
txtDelimiter: 'Delimiter',
txtSpace: 'Space',
txtTab: 'Tab',
advCSVOptions: 'Choose CSV Options',
advDRMOptions: 'Protected File',
advDRMEnterPassword: 'You password please:',
advDRMPassword: 'Password'
} }
})(), SSE.Controllers.Main || {})) })(), SSE.Controllers.Main || {}))
}); });

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -41,4 +41,11 @@
height: 22px; height: 22px;
background-image: url(../img/docinfo.png); background-image: url(../img/docinfo.png);
background-size: contain; background-size: contain;
}
.small-picker {
.picker-item {
font-size: 14px;
padding: 0;
}
} }

View file

@ -56,7 +56,7 @@
padding: 0 4px; padding: 0 4px;
border: 0 none; border: 0 none;
line-height: 30px; line-height: 30px;
font-size: 17px; //font-size: 17px;
text-align: center; text-align: center;
&[disabled] { &[disabled] {