Compare commits

...

4 Commits

Author SHA1 Message Date
0ae117891d Merge branch release/v7.3.0 into master 2023-01-31 08:01:17 +00:00
77cad58384 [oform] Fix field count in case of complex forms 2023-01-27 02:27:31 +05:00
a908a16e95 [oform] Add event to handle undo/redo 2023-01-19 19:59:29 +05:00
72139c5780 Fix bug #60651
Add translation for default role
2023-01-19 18:40:36 +05:00
4 changed files with 47 additions and 4 deletions

View File

@ -170,7 +170,22 @@
if (this.Roles.length <= 1
&& this.Roles[roleIndex].getUserMaster() === this.Format.getDefaultUserMaster()
&& -1 === delegateIndex)
{
let defaultUserMaster = this.Format.getDefaultUserMaster();
if (!defaultUserMaster.isDefaultUserProps())
{
if (!this.startAction(AscDFH.historydescription_OForm_RemoveRole))
return false;
defaultUserMaster.initDefaultUser();
this.NeedRedraw = true;
this.endAction();
return true;
}
return false;
}
if (!this.startAction(AscDFH.historydescription_OForm_RemoveRole))
return false;
@ -445,7 +460,7 @@
{
if (!this.NeedUpdateRoles)
return;
this.NeedUpdateRoles = false;
this.Roles = [];
@ -537,6 +552,11 @@
this.updateRoles();
this.checkRedraw();
};
OForm.prototype.onUndoRedo = function()
{
this.updateRoles();
this.checkRedraw();
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Private area
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -149,8 +149,11 @@
let fields = [];
for (let fieldIndex = 0, fieldCount = this.Fields.length; fieldIndex < fieldCount; ++fieldIndex)
{
if (this.Fields[fieldIndex].isUseInDocument())
if (this.Fields[fieldIndex].isUseInDocument()
&& this.Fields[fieldIndex].isMainField())
{
fields.push(this.Fields[fieldIndex]);
}
}
if (this.Users.length && this.Parent)
@ -160,8 +163,12 @@
let userFields = this.Parent.getAllFieldsByUserMaster(this.Users[index]);
for (let fieldIndex = 0, fieldCount = userFields.length; fieldIndex < fieldCount; ++fieldIndex)
{
if (-1 === fields.indexOf(userFields[fieldIndex]) && userFields[fieldIndex].isUseInDocument())
if (-1 === fields.indexOf(userFields[fieldIndex])
&& userFields[fieldIndex].isUseInDocument()
&& userFields[fieldIndex].isMainField())
{
fields.push(userFields[fieldIndex]);
}
}
}
}

View File

@ -178,6 +178,10 @@
&& this.Field.IsUseInDocument()
&& this === this.Field.GetFieldMaster());
};
CFieldMaster.prototype.isMainField = function()
{
return (this.Field && this.Field.IsMainForm());
};
CFieldMaster.prototype.toXml = function(writer)
{
let context = writer.context;

View File

@ -102,7 +102,7 @@
CUserMaster.prototype.initDefaultUser = function()
{
// TODO: Возможно стоит придумать уникальный id общий для дефолтовой роли
this.setRole("Anyone");
this.setRole(AscCommon.translateManager.getValue("Anyone"));
this.setColor(255, 239, 191);
};
CUserMaster.prototype.compare = function(user)
@ -142,6 +142,18 @@
{
return (0 === this.compare(user));
};
CUserMaster.prototype.isDefaultUserProps = function()
{
let result = false;
let u = this;
AscCommon.ExecuteNoHistory(function()
{
let defaultUser = new CUserMaster();
defaultUser.initDefaultUser();
result = defaultUser.isEqual(u);
});
return result;
};
CUserMaster.prototype.onChange = function()
{
if (!this.Parent)