[DE] Add new form with last selected role or the last role in list
This commit is contained in:
parent
a5cf901aa0
commit
a58534687a
|
@ -59,7 +59,10 @@ define([
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
},
|
},
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
this._state = {};
|
this._state = {
|
||||||
|
lastViewRole: undefined, // last selected role in the preview mode
|
||||||
|
lastRoleInList: undefined // last role in the roles list
|
||||||
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
setApi: function (api) {
|
setApi: function (api) {
|
||||||
|
@ -177,6 +180,7 @@ define([
|
||||||
|
|
||||||
var oPr,
|
var oPr,
|
||||||
oFormPr = new AscCommon.CSdtFormPr();
|
oFormPr = new AscCommon.CSdtFormPr();
|
||||||
|
oFormPr.put_Role(Common.Utils.InternalSettings.get('de-last-form-role') || this._state.lastRoleInList);
|
||||||
this.toolbar.toolbar.fireEvent('insertcontrol', this.toolbar.toolbar);
|
this.toolbar.toolbar.fireEvent('insertcontrol', this.toolbar.toolbar);
|
||||||
if (type == 'picture')
|
if (type == 'picture')
|
||||||
this.api.asc_AddContentControlPicture(oFormPr);
|
this.api.asc_AddContentControlPicture(oFormPr);
|
||||||
|
@ -213,14 +217,14 @@ define([
|
||||||
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||||
},
|
},
|
||||||
|
|
||||||
onModeClick: function(state, lastRole) {
|
onModeClick: function(state, lastViewRole) {
|
||||||
if (this.api) {
|
if (this.api) {
|
||||||
this.disableEditing(state);
|
this.disableEditing(state);
|
||||||
this.view && this.view.setPreviewMode(state); // sent role name - lastRole
|
this.view && this.view.setPreviewMode(state); // send role name - lastViewRole
|
||||||
this.api.asc_setRestriction(state ? Asc.c_oAscRestrictionType.OnlyForms : Asc.c_oAscRestrictionType.None);
|
this.api.asc_setRestriction(state ? Asc.c_oAscRestrictionType.OnlyForms : Asc.c_oAscRestrictionType.None);
|
||||||
this.api.asc_SetPerformContentControlActionByClick(state);
|
this.api.asc_SetPerformContentControlActionByClick(state);
|
||||||
this.api.asc_SetHighlightRequiredFields(state);
|
this.api.asc_SetHighlightRequiredFields(state);
|
||||||
state && (this._state.lastRole = lastRole);
|
state && (this._state.lastViewRole = lastViewRole);
|
||||||
}
|
}
|
||||||
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||||
},
|
},
|
||||||
|
@ -395,13 +399,7 @@ define([
|
||||||
// me.view.btnHighlight.currentColor = clr;
|
// me.view.btnHighlight.currentColor = clr;
|
||||||
// }
|
// }
|
||||||
config.isEdit && config.canFeatureContentControl && config.isFormCreator && me.showCreateFormTip(); // show tip only when create form in docxf
|
config.isEdit && config.canFeatureContentControl && config.isFormCreator && me.showCreateFormTip(); // show tip only when create form in docxf
|
||||||
// change to event asc_onRefreshRolesList
|
|
||||||
me.onRefreshRolesList();
|
me.onRefreshRolesList();
|
||||||
// me.onRefreshRolesList([
|
|
||||||
// {name: 'employee 1', color: Common.Utils.ThemeColor.getRgbColor('ff0000'), fields: 5},
|
|
||||||
// {name: 'employee 2', color: Common.Utils.ThemeColor.getRgbColor('00ff00'), fields: 1},
|
|
||||||
// {name: 'manager', color: null, fields: 10}
|
|
||||||
// ]);
|
|
||||||
me.onChangeProtectDocument();
|
me.onChangeProtectDocument();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -457,7 +455,8 @@ define([
|
||||||
var oform = this.api.asc_GetOForm();
|
var oform = this.api.asc_GetOForm();
|
||||||
oform && (roles = oform.asc_getAllRoles());
|
oform && (roles = oform.asc_getAllRoles());
|
||||||
}
|
}
|
||||||
this.view && this.view.fillRolesMenu(roles, this._state.lastRole);
|
this._state.lastRoleInList = (roles && roles.length>0) ? roles[roles.length-1].asc_getSettings().asc_getName() : undefined;
|
||||||
|
this.view && this.view.fillRolesMenu(roles, this._state.lastViewRole);
|
||||||
},
|
},
|
||||||
|
|
||||||
onManagerClick: function() {
|
onManagerClick: function() {
|
||||||
|
@ -465,12 +464,8 @@ define([
|
||||||
this.api.asc_GetOForm() && (new DE.Views.RolesManagerDlg({
|
this.api.asc_GetOForm() && (new DE.Views.RolesManagerDlg({
|
||||||
api: me.api,
|
api: me.api,
|
||||||
handler: function(result, settings) {
|
handler: function(result, settings) {
|
||||||
// me.roles = settings;
|
|
||||||
// me.onRefreshRolesList(me.roles);
|
|
||||||
// Common.component.Analytics.trackEvent('ToolBar', 'Roles Manager');
|
|
||||||
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
|
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
|
||||||
},
|
},
|
||||||
// roles: me.roles,
|
|
||||||
props : undefined
|
props : undefined
|
||||||
})).on('close', function(win){
|
})).on('close', function(win){
|
||||||
}).show();
|
}).show();
|
||||||
|
|
|
@ -1620,6 +1620,7 @@ define([
|
||||||
formPr.put_Role(record.value);
|
formPr.put_Role(record.value);
|
||||||
props.put_FormPr(formPr);
|
props.put_FormPr(formPr);
|
||||||
this.api.asc_SetContentControlProperties(props, this.internalId);
|
this.api.asc_SetContentControlProperties(props, this.internalId);
|
||||||
|
Common.Utils.InternalSettings.set('de-last-form-role', record.value)
|
||||||
this.fireEvent('editcomplete', this);
|
this.fireEvent('editcomplete', this);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -510,15 +510,15 @@ define([
|
||||||
return this.$el;
|
return this.$el;
|
||||||
},
|
},
|
||||||
|
|
||||||
fillRolesMenu: function(roles, lastRole) {
|
fillRolesMenu: function(roles, lastViewRole) {
|
||||||
if (!(this.btnViewFormRoles && this.btnViewFormRoles.menu && this.btnViewFormRoles.menu.isVisible())) {
|
if (!(this.btnViewFormRoles && this.btnViewFormRoles.menu && this.btnViewFormRoles.menu.isVisible())) {
|
||||||
this._state.roles = roles;
|
this._state.roles = roles;
|
||||||
this._state.lastRole = lastRole;
|
this._state.lastViewRole = lastViewRole;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
roles = roles || this._state.roles;
|
roles = roles || this._state.roles;
|
||||||
lastRole = lastRole || this._state.lastRole;
|
lastViewRole = lastViewRole || this._state.lastViewRole;
|
||||||
this._state.roles = this._state.lastRole = undefined;
|
this._state.roles = this._state.lastViewRole = undefined;
|
||||||
|
|
||||||
if (!roles) return;
|
if (!roles) return;
|
||||||
|
|
||||||
|
@ -530,7 +530,7 @@ define([
|
||||||
roles && roles.forEach(function(item, index) {
|
roles && roles.forEach(function(item, index) {
|
||||||
var role = item.asc_getSettings(),
|
var role = item.asc_getSettings(),
|
||||||
color = role.asc_getColor();
|
color = role.asc_getColor();
|
||||||
if (role.asc_getName()===lastRole)
|
if (role.asc_getName()===lastViewRole)
|
||||||
checkedIndex = index;
|
checkedIndex = index;
|
||||||
me.btnViewFormRoles.menu.addItem(new Common.UI.MenuItem({
|
me.btnViewFormRoles.menu.addItem(new Common.UI.MenuItem({
|
||||||
caption: role.asc_getName() || me.textAnyone,
|
caption: role.asc_getName() || me.textAnyone,
|
||||||
|
|
Loading…
Reference in a new issue