protected void ProcessView()
        {
            EditItemControl = (ItemForm)LoadControl(System.IO.Path.Combine(TemplateSourceDirectory, "SexyContent/EAV/Controls/ItemForm.ascx"));
            EditItemControl.DefaultCultureDimension = DefaultLanguageID != 0 ? DefaultLanguageID : new int?();
            EditItemControl.IsDialog = false;
            EditItemControl.HideNavigationButtons  = true;
            EditItemControl.PreventRedirect        = true;
            EditItemControl.AttributeSetId         = AttributeSetID;
            EditItemControl.AssignmentObjectTypeId = SexyContent.AssignmentObjectTypeIDDefault;
            EditItemControl.ZoneId = ZoneId;
            EditItemControl.AppId  = AppId;
            EditItemControl.AddClientScriptAndCss = false;
            EditItemControl.ItemHistoryUrl        = "";

            var newItemUrl = EditUrl(this.TabID, SexyContent.ControlKeys.EditContentGroup, true, new string[] {});

            EditItemControl.NewItemUrl = newItemUrl + (newItemUrl.Contains("?") ? "&" : "?") + "AppID=" + AppId.ToString() + "&mid=" + ModuleID.ToString() + "&AttributeSetId=[AttributeSetId]&EditMode=New&CultureDimension=" + this.LanguageID;

            // If ContentGroupItem has Entity, edit that; else create new Entity
            if (Item != null && Item.EntityID.HasValue)
            {
                EditItemControl.Updated += EditItem_OnEdited;
                EditItemControl.EntityId = Item.EntityID.Value;
                EditItemControl.InitForm(FormViewMode.Edit);

                hlkHistory.Visible     = true;
                hlkHistory.NavigateUrl = EditUrl("", "", SexyContent.ControlKeys.EavManagement, new string[] { "AppID", AppId.ToString(), "ManagementMode", "ItemHistory", "EntityId", Item.EntityID.Value.ToString(), "mid", ModuleID.ToString() });
            }
            // Create a new Entity
            else
            {
                EditItemControl.Inserted += NewItem_OnInserted;
                EditItemControl.Visible   = false;

                if (ItemType == ContentGroupItemType.Content || ItemType == ContentGroupItemType.ListContent)
                {
                    EditItemControl.Visible = true;
                }
                else
                {
                    pnlReferenced.Visible = true;
                }

                EditItemControl.InitForm(FormViewMode.Insert);
            }

            phNewOrEditItem.Controls.Add(EditItemControl);
        }
        protected void ProcessView()
        {
            var attributeSet = DataSource.GetCache(ZoneId, AppId).GetContentType(AttributeSetStaticName);

            EditItemControl = (ItemForm)LoadControl(Path.Combine(TemplateSourceDirectory, "SexyContent/EAV/Controls/ItemForm.ascx"));
            EditItemControl.DefaultCultureDimension = DefaultLanguageID != 0 ? DefaultLanguageID : new int?();
            EditItemControl.IsDialog = false;
            EditItemControl.HideNavigationButtons = true;
            EditItemControl.PreventRedirect = true;
            EditItemControl.AttributeSetId = attributeSet.AttributeSetId;
            EditItemControl.AssignmentObjectTypeId = SexyContent.AssignmentObjectTypeIDDefault;
            EditItemControl.ZoneId = ZoneId;
            EditItemControl.AppId = AppId;
            EditItemControl.AddClientScriptAndCss = false;
            EditItemControl.ItemHistoryUrl = "";

            var newItemUrl = EditUrl(TabID, SexyContent.ControlKeys.EditContentGroup, true, new string[] {});
            EditItemControl.NewItemUrl = newItemUrl + (newItemUrl.Contains("?") ? "&" : "?") + "AppID=" + AppId + "&mid=" + ModuleID + "&AttributeSetId=[AttributeSetId]&EditMode=New&CultureDimension=" + LanguageID;

            // If ContentGroupItem has Entity, edit that; else create new Entity
            if (!NewMode && Entity != null)
            {
                EditItemControl.Updated += EditItem_OnEdited;
                EditItemControl.EntityId = Entity.EntityId;
                EditItemControl.InitForm(FormViewMode.Edit);

                hlkHistory.Visible = true;
                hlkHistory.NavigateUrl = EditUrl("", "", SexyContent.ControlKeys.EavManagement, new[] { "AppID", AppId.ToString(), "ManagementMode", "ItemHistory", "EntityId", Entity.EntityId.ToString(), "mid", ModuleID.ToString() });
            }
            // Create a new Entity
            else
            {
                EditItemControl.Inserted += NewItem_OnInserted;
                EditItemControl.Visible = false;

                if (ItemType == "Content" || ItemType == "ListContent")
                    EditItemControl.Visible = true;
                else
                    pnlReferenced.Visible = true;

                EditItemControl.InitForm(FormViewMode.Insert);
            }

            phNewOrEditItem.Controls.Add(EditItemControl);
        }
Example #3
0
        protected void ProcessView()
        {
            EditItemControl = (ItemForm)LoadControl(Path.Combine(TemplateSourceDirectory, "SexyContent/EAV/Controls/ItemForm.ascx"));
            EditItemControl.DefaultCultureDimension = DefaultLanguageID != 0 ? DefaultLanguageID : new int?();
            EditItemControl.IsDialog = false;
            EditItemControl.HideNavigationButtons = true;
            EditItemControl.PreventRedirect = true;
            EditItemControl.AttributeSetId = AttributeSetID;
            EditItemControl.AssignmentObjectTypeId = AssignmentObjectTypeId;
            EditItemControl.KeyNumber = KeyNumber;
            EditItemControl.KeyGuid = KeyGuid;
            EditItemControl.ZoneId = ZoneId;
            EditItemControl.ReturnUrl = "";
            EditItemControl.AppId = AppId;
            EditItemControl.AddClientScriptAndCss = false;
            EditItemControl.ItemHistoryUrl = "";
            EditItemControl.PreventRedirect = Request.QueryString["PreventRedirect"] == "true";

            var newItemUrl = EditUrl(TabID, SexyContent.ControlKeys.EditContentGroup, true, new string[] { });
            EditItemControl.NewItemUrl = newItemUrl + (newItemUrl.Contains("?") ? "&" : "?") + "AppID=" + AppId + "&mid=" + ModuleID + "&AttributeSetId=[AttributeSetId]&EditMode=New&CultureDimension=" + LanguageID;

            // If ContentGroupItem has Entity, edit that; else create new Entity
            if (EntityId.HasValue)
            {
                EditItemControl.Updated += EditItem_OnEdited;
                EditItemControl.EntityId = EntityId.Value;
                EditItemControl.InitForm(FormViewMode.Edit);

                hlkHistory.Visible = true;
                hlkHistory.NavigateUrl = EditUrl("", "", SexyContent.ControlKeys.EavManagement, new[] { "AppID", AppId.ToString(), "ManagementMode", "ItemHistory", "EntityId", EntityId.Value.ToString(), "mid", ModuleID.ToString() });
            }
            // Create a new Entity
            else
            {
                EditItemControl.Inserted += NewItem_OnInserted;
                EditItemControl.Visible = true;
                EditItemControl.InitForm(FormViewMode.Insert);
            }

            phNewOrEditItem.Controls.Add(EditItemControl);
        }