protected void Page_Load(object sender, EventArgs e) { if (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.Ecommerce", "Products.Documents")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Ecommerce", "Products.Documents"); } int productId = QueryHelper.GetInteger("productId", 0); if (productId > 0) { SKUInfo sku = SKUInfoProvider.GetSKUInfo(productId); EditedObject = sku; if (sku != null) { string errorMessage = CMSContentProductPage.CheckProductDepartmentPermissions(sku); if (!String.IsNullOrEmpty(errorMessage)) { // Disable form editing DisableFormEditing(); // Show access denied message lblError.Text = errorMessage; } productDocuments.ProductID = productId; } } }
protected override void OnInit(EventArgs e) { base.OnInit(e); if (QueryHelper.GetInteger("categoryid", 0) > 0) { if (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.Ecommerce", "ProductOptions.Options.CustomFields")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Ecommerce", "ProductOptions.Options.CustomFields"); } } else { if (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.Ecommerce", "Products.CustomFields")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Ecommerce", "Products.CustomFields"); } } // Set edit mode productId = QueryHelper.GetInteger("productId", 0); if (productId > 0) { SKUInfo sku = SKUInfoProvider.GetSKUInfo(productId); EditedObject = sku; if (sku != null) { editedSiteId = sku.SKUSiteID; // Check product site id CheckEditedObjectSiteID(editedSiteId); string errorMessage = CMSContentProductPage.CheckProductDepartmentPermissions(sku); if (!String.IsNullOrEmpty(errorMessage)) { // Disable form editing DisableFormEditing(); // Show access denied message lblError.Text = errorMessage; } formProductCustomFields.Info = SKUInfoProvider.GetSKUInfo(productId); EditedObject = formProductCustomFields.Info; formProductCustomFields.OnBeforeSave += formProductCustomFields_OnBeforeSave; formProductCustomFields.OnAfterSave += formProductCustomFields_OnAfterSave; } } else { DisableFormEditing(); } }
protected void Page_Load(object sender, EventArgs e) { if (QueryHelper.GetInteger("categoryid", 0) > 0) { if (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.Ecommerce", "ProductOptions.Options.General")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Ecommerce", "ProductOptions.Options.General"); } } else { if (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.Ecommerce", "Products.General")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Ecommerce", "Products.General"); } } this.productEditElem.ProductSiteID = ConfiguredSiteID; this.productEditElem.ProductSaved += new EventHandler(productEditElem_ProductSaved); int productId = QueryHelper.GetInteger("productId", 0); if (productId > 0) { SKUInfo sku = SKUInfoProvider.GetSKUInfo(productId); EditedObject = sku; if (sku != null) { // Check product site id CheckEditedObjectSiteID(sku.SKUSiteID); string errorMessage = CMSContentProductPage.CheckProductDepartmentPermissions(sku); if (!String.IsNullOrEmpty(errorMessage)) { // Disable form editing DisableFormEditing(); // Show access denied message lblError.Text = errorMessage; } productEditElem.ProductID = productId; productEditElem.ProductSiteID = sku.SKUSiteID; } } // Set header actions string[,] actions = new string[1, 10]; actions[0, 0] = HeaderActions.TYPE_SAVEBUTTON; actions[0, 1] = this.GetString("Header.Settings.SaveChanged"); actions[0, 2] = String.Empty; actions[0, 3] = String.Empty; actions[0, 4] = String.Empty; actions[0, 5] = this.productEditElem.FormEnabled ? this.GetImageUrl("CMSModules/CMS_Content/EditMenu/save.png") : this.GetImageUrl("CMSModules/CMS_Content/EditMenu/savedisabled.png"); actions[0, 6] = "save"; // command name actions[0, 7] = String.Empty; // command argument actions[0, 8] = this.productEditElem.FormEnabled.ToString(); // register shortcut action actions[0, 9] = this.productEditElem.FormEnabled.ToString(); // enabled this.CurrentMaster.HeaderActions.Actions = actions; this.CurrentMaster.HeaderActions.ActionPerformed += this.HeaderActions_ActionPerformed; }