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