Create rules for lock
This commit is contained in:
parent
a7b08559a2
commit
2407152424
|
@ -2387,13 +2387,7 @@ define([
|
|||
this.toolbar.createDelayedElements();
|
||||
this.attachUIEvents(this.toolbar);
|
||||
},
|
||||
setTrantitTab:function (el){
|
||||
/* var $panel = this.getApplication().getController('Transitions').createToolbarPanel();
|
||||
if ( $panel ) {
|
||||
el.find('#transitions-panel').replaceWith($panel);
|
||||
}*/
|
||||
// var $panel = this.getApplication().getController('Transitions').createToolbarPanel()
|
||||
},
|
||||
|
||||
onAppShowed: function (config) {
|
||||
var me = this;
|
||||
|
||||
|
@ -2419,7 +2413,7 @@ define([
|
|||
me.toolbar.setMode(config);
|
||||
|
||||
var transitController = me.getApplication().getController('Transitions');
|
||||
transitController.setApi(me.api).setConfig({toolbar: me.toolbar,mode:config}).createToolbarPanel();
|
||||
transitController.setApi(me.api).setConfig({toolbar: me,mode:config}).createToolbarPanel();
|
||||
|
||||
me.toolbar.btnSave.on('disabled', _.bind(me.onBtnChangeState, me, 'save:disabled'));
|
||||
|
||||
|
|
|
@ -88,20 +88,29 @@ define([
|
|||
toolbar: config.toolbar,
|
||||
mode: config.mode
|
||||
});
|
||||
|
||||
this.applyLayout();
|
||||
return this;
|
||||
},
|
||||
applyLayout: function () {
|
||||
this.lockToolbar(PE.enumLock.disableOnStart, true);
|
||||
},
|
||||
|
||||
setApi: function (api) {
|
||||
this.api = api;
|
||||
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onFocusObject, this));
|
||||
this.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(this.onDocumentContentReady, this));
|
||||
return this;
|
||||
},
|
||||
|
||||
setMode: function(mode) {
|
||||
onDocumentContentReady: function ()
|
||||
{
|
||||
this.lockToolbar(PE.enumLock.disableOnStart, false);
|
||||
this._state.activated = true;
|
||||
},
|
||||
/*setMode: function(mode) {
|
||||
this.appConfig = mode;
|
||||
//this.view = this.createView('PE.Views.Transitions', { mode: mode });
|
||||
return this;
|
||||
},
|
||||
},*/
|
||||
|
||||
loadDocument: function(data) {
|
||||
this.document = data.doc;
|
||||
|
@ -205,18 +214,54 @@ define([
|
|||
|
||||
},
|
||||
onFocusObject:function(selectedObjects){
|
||||
var me = this,
|
||||
slides_none=me.view.toolbar._state.no_slides;
|
||||
if(slides_note!=undefined && me._state.no_slides!== slides_none) {
|
||||
me.lockToolbar(PE.enumLock.noSlides, slides_none);
|
||||
me._state.no_slides!== slides_none;
|
||||
//me.view.setDisabled(slides_note);
|
||||
}
|
||||
for (var i=0; i<selectedObjects.length; i++) {
|
||||
|
||||
|
||||
var eltype = selectedObjects[i].get_ObjectType();
|
||||
|
||||
if (eltype === undefined)
|
||||
continue;
|
||||
|
||||
if (eltype == Asc.c_oAscTypeSelectElement.Slide) {
|
||||
this.changeSettings(selectedObjects[i].get_ObjectValue());
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
var slide_deleted = undefined,
|
||||
slide_layout_lock = undefined,
|
||||
locked_transition = undefined,
|
||||
pr;
|
||||
me._state.activated=me.view.toolbar.activated;
|
||||
pr=selectedObjects[i].get_ObjectValue();
|
||||
slide_deleted = pr.get_LockDelete();
|
||||
slide_layout_lock = pr.get_LockLayout();
|
||||
//locked_transition = pr.get_LockTransition();
|
||||
|
||||
if (slide_deleted !== undefined && me._state.slidecontrolsdisable !== slide_deleted) {
|
||||
if (me._state.activated) me._state.slidecontrolsdisable = slide_deleted;
|
||||
me.lockToolbar(PE.enumLock.slideDeleted, slide_deleted);
|
||||
}
|
||||
if (slide_layout_lock !== undefined && me._state.slidelayoutdisable !== slide_layout_lock ) {
|
||||
if (me._state.activated) me._state.slidelayoutdisable = slide_layout_lock;
|
||||
me.lockToolbar(PE.enumLock.slideLock, slide_layout_lock);
|
||||
}
|
||||
/*if (locked_transition !== undefined && me._state.lockedtransition !== locked_transition ) {
|
||||
if (me._state.activated) me._state.lockedtransition = locked_transition;
|
||||
me.lockToolbar(PE.enumLock.slideLock, locked_transition);
|
||||
}*/
|
||||
|
||||
}
|
||||
this.changeSettings(pr);
|
||||
}
|
||||
|
||||
},
|
||||
lockToolbar: function (causes, lock, opts) {
|
||||
Common.Utils.lockControls(causes, lock, opts, this.view.lockedControls);
|
||||
},
|
||||
changeSettings:function (props){
|
||||
var me=this.view;
|
||||
|
||||
|
|
|
@ -113,12 +113,13 @@ define([
|
|||
options: {},
|
||||
|
||||
initialize: function (options) {
|
||||
this.toolbar = options.toolbar;
|
||||
this.appConfig = options.mode;
|
||||
this.$el=options.toolbar.$el.find('#transitions-panel');
|
||||
|
||||
Common.UI.BaseView.prototype.initialize.call(this, options);
|
||||
this.toolbar=options.toolbar;
|
||||
this.appConfig = options.mode;
|
||||
this.$el=this.toolbar.toolbar.$el.find('#transitions-panel');
|
||||
var _set=PE.enumLock;
|
||||
this.lockedControls=[];
|
||||
|
||||
this._arrEffectName = [
|
||||
{title: this.textNone, imageUrl:"btn-text", value: Asc.c_oAscSlideTransitionTypes.None, id: Common.UI.getId()},
|
||||
|
@ -137,7 +138,8 @@ define([
|
|||
itemWidth: 87,
|
||||
itemHeight: 40,
|
||||
enableKeyEvents: true,
|
||||
//lock:[_set.slideDeleted],
|
||||
disabled:true,
|
||||
lock:[_set.slideDeleted,_set.slideLock,_set.disableOnStart],
|
||||
beforeOpenHandler: function (e) {
|
||||
var cmp = this,
|
||||
menu = cmp.openButton.menu//,
|
||||
|
@ -163,6 +165,7 @@ define([
|
|||
cmp.removeTips();
|
||||
}
|
||||
});
|
||||
this.lockedControls.push(this.listEffects);
|
||||
this.listEffects.menuPicker.store.add(this._arrEffectName);
|
||||
|
||||
this.listEffects.fieldPicker.itemTemplate = _.template([
|
||||
|
@ -179,22 +182,31 @@ define([
|
|||
cls: 'btn-toolbar ',// x-huge icon-top',
|
||||
caption: this.txtPreview,
|
||||
split: false,
|
||||
iconCls: 'toolbar__icon btn-preview'
|
||||
disabled:true,
|
||||
iconCls: 'toolbar__icon btn-preview',
|
||||
lock:[_set.slideDeleted,_set.slideLock,_set.disableOnStart]
|
||||
});
|
||||
this.lockedControls.push(this.btnPreview);
|
||||
|
||||
this.btnParametrs = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
caption: this.txtParametrs,
|
||||
iconCls: 'toolbar__icon icon btn-insertshape',
|
||||
menu: new Common.UI.Menu({items: this.createParametrsMenuItems()})
|
||||
disabled:true,
|
||||
menu: new Common.UI.Menu({items: this.createParametrsMenuItems()}),
|
||||
lock:[_set.slideDeleted,_set.slideLock,_set.disableOnStart]
|
||||
});
|
||||
this.lockedControls.push(this.btnParametrs);
|
||||
|
||||
this.btnApplyToAll = new Common.UI.Button({
|
||||
cls: 'btn-toolbar',
|
||||
caption: this.txtApplyToAll,
|
||||
split: true,
|
||||
iconCls: 'toolbar__icon btn-changeslide'
|
||||
disabled:true,
|
||||
iconCls: 'toolbar__icon btn-changeslide',
|
||||
lock:[_set.slideDeleted,_set.slideLock,_set.disableOnStart]
|
||||
});
|
||||
this.lockedControls.push(this.btnApplyToAll);
|
||||
|
||||
this.numDuration = new Common.UI.MetricSpinner({
|
||||
el: this.$el.find('#transit-spin-duration'),
|
||||
|
@ -204,8 +216,10 @@ define([
|
|||
defaultUnit : this.txtSec,
|
||||
maxValue: 300,
|
||||
minValue: 0,
|
||||
disabled: false
|
||||
disabled: true,
|
||||
lock:[_set.slideDeleted,_set.slideLock,_set.disableOnStart]
|
||||
});
|
||||
this.lockedControls.push(this.numDuration);
|
||||
|
||||
this.numDelay = new Common.UI.MetricSpinner({
|
||||
el: this.$el.find('#transit-spin-delay'),
|
||||
|
@ -215,17 +229,27 @@ define([
|
|||
defaultUnit : this.txtSec,
|
||||
maxValue: 300,
|
||||
minValue: 0,
|
||||
disabled: false
|
||||
disabled: true,
|
||||
lock:[_set.slideDeleted,_set.slideLock,_set.disableOnStart]
|
||||
});
|
||||
this.lockedControls.push(this.numDelay);
|
||||
|
||||
this.chStartOnClick = new Common.UI.CheckBox({
|
||||
el: this.$el.find('#transit-checkbox-startonclick'),
|
||||
labelText: this.strStartOnClick
|
||||
});
|
||||
labelText: this.strStartOnClick,
|
||||
disabled:true,
|
||||
lock:[_set.slideDeleted,_set.slideLock,_set.disableOnStart]
|
||||
})
|
||||
this.lockedControls.push(this.chStartOnClick);
|
||||
|
||||
this.chDelay = new Common.UI.CheckBox({
|
||||
el: this.$el.find('#transit-checkbox-delay'),
|
||||
labelText: this.strDelay
|
||||
labelText: this.strDelay,
|
||||
disabled:true,
|
||||
lock:[_set.slideDeleted,_set.slideLock,_set.disableOnStart]
|
||||
});
|
||||
this.lockedControls.push(this.chDelay);
|
||||
|
||||
this.$el.find('#transit-duration').text(this.strDuration);
|
||||
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
||||
},
|
||||
|
@ -307,9 +331,15 @@ define([
|
|||
this.fireEvent('show', this);
|
||||
},
|
||||
|
||||
|
||||
SetDisabled: function (state, langs) {
|
||||
|
||||
getButtons: function (type){
|
||||
if (type===undefined)
|
||||
return this.lockedControls;
|
||||
return [];
|
||||
},
|
||||
setDisabled: function (state) {
|
||||
this.lockedControls && this.lockedControls.forEach(function (button){
|
||||
button.setDisabled(state);
|
||||
},this);
|
||||
},
|
||||
|
||||
setMenuParametrs:function (effect,value)
|
||||
|
@ -358,9 +388,12 @@ define([
|
|||
if(effect!=Asc.c_oAscSlideTransitionTypes.None)
|
||||
selectedElement.setChecked(true);
|
||||
|
||||
if(!this.listEffects.isDisabled()) {
|
||||
this.numDelay.setDisabled(this.chDelay.getValue()!=='checked');
|
||||
this.btnParametrs.setDisabled(effect === Asc.c_oAscSlideTransitionTypes.None);
|
||||
this.btnPreview.setDisabled(effect === Asc.c_oAscSlideTransitionTypes.None);
|
||||
this.numDuration.setDisabled(effect === Asc.c_oAscSlideTransitionTypes.None);
|
||||
}
|
||||
return selectedElement;
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue