Skip to content

Commit 4232f50

Browse files
committed
Fixed issue when an entity is edited directly
1 parent 45ab2a7 commit 4232f50

4 files changed

Lines changed: 18 additions & 13 deletions

File tree

EditContentGroup.ascx.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,19 +106,23 @@ public int? ContentGroupID
106106
}
107107
}
108108

109+
110+
private int? _attributeSetId;
109111
/// <summary>
110112
/// Returns the ContentGroupID from QueryString
111113
/// </summary>
112114
public int? AttributeSetId
113115
{
114116
get
115117
{
116-
string attributeSetIdString = Request.QueryString[SexyContent.AttributeSetIDString];
117-
118-
if (!String.IsNullOrEmpty(attributeSetIdString))
119-
return int.Parse(attributeSetIdString);
118+
if (_attributeSetId == null)
119+
{
120+
string attributeSetName = Request.QueryString["AttributeSetName"];
120121

121-
return new int?();
122+
if (!String.IsNullOrEmpty(attributeSetName))
123+
_attributeSetId = Sexy.ContentContext.GetAllAttributeSets().FirstOrDefault(p => p.Name == attributeSetName || p.StaticName == attributeSetName).AttributeSetID;
124+
}
125+
return _attributeSetId;
122126
}
123127
}
124128

@@ -190,7 +194,7 @@ protected void Page_Load(object sender, EventArgs e)
190194

191195
btnDelete.OnClientClick = "return confirm('" + LocalizeString("btnDelete.Confirm") + "')";
192196
btnDelete.Text = Items.Count(p => p.ItemType == ContentGroupItemType.Content) > 1 ? LocalizeString("btnDelete.ListText") : LocalizeString("btnDelete.Text");
193-
btnDelete.Visible = !NewMode;
197+
btnDelete.Visible = !NewMode && ContentGroupID.HasValue;
194198

195199
// If there is something to edit
196200
if (CurrentlyEditedItems.Any())

Js/2sxc.api.manage.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $2sxc.getManageController = function(id) {
1515
config: config,
1616

1717
getLink: function (settings) {
18-
settings = $.extend(config, settings);
18+
settings = $.extend({}, config, settings);
1919

2020
var dialogParams = {
2121
//tabid: settings.tabId,
@@ -30,9 +30,10 @@ $2sxc.getManageController = function(id) {
3030
if (settings.action == 'new')
3131
dialogParams.editMode = "New";
3232

33-
if (settings.AttributeSetId) {
34-
dialogParams.entityId = settings.entityId;
35-
dialogParams.attributeSetId = settings.AttributeSetId;
33+
if (settings.attributeSetName) {
34+
if(settings.action != 'new')
35+
dialogParams.entityId = settings.entityId;
36+
dialogParams.attributeSetName = settings.attributeSetName;
3637
dialogParams.contentGroupId = "";
3738
}
3839

@@ -70,7 +71,7 @@ $2sxc.getManageController = function(id) {
7071

7172
getButton: function (settings) {
7273

73-
settings = $.extend(config, settings);
74+
settings = $.extend({}, config, settings);
7475
var button = $('<a />', {
7576
'class': 'sc-' + settings.action,
7677
'href': 'javascript:$2sxc(' + settings.moduleId + ').manage.action(' + JSON.stringify(settings) + ')'

View.ascx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected void Page_Load(object sender, EventArgs e)
5656
returnUrl = Request.RawUrl,
5757
appPath = AppId.HasValue ? Sexy.App.Path : null,
5858
cultureDimension = Sexy.GetCurrentLanguageID(),
59-
attributeSetGuid = Template != null ? Sexy.ContentContext.GetAttributeSet(Template.AttributeSetID).StaticName : null,
59+
attributeSetName = Template != null ? Sexy.ContentContext.GetAttributeSet(Template.AttributeSetID).StaticName : null,
6060
isList = Template != null && Template.UseForList
6161
}
6262
}

ViewApp.ascx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ protected void Page_Load(object sender, EventArgs e)
5555
returnUrl = Request.RawUrl,
5656
appPath = AppId.HasValue ? Sexy.App.Path : null,
5757
cultureDimension = Sexy.GetCurrentLanguageID(),
58-
attributeSetGuid = Template != null ? Sexy.ContentContext.GetAttributeSet(Template.AttributeSetID).StaticName : null,
58+
attributeSetName = Template != null ? Sexy.ContentContext.GetAttributeSet(Template.AttributeSetID).StaticName : null,
5959
isList = Template != null && Template.UseForList
6060
}
6161
}

0 commit comments

Comments
 (0)