protected void Page_Load(object sender, EventArgs e) { // Check license LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetCurrentDomain(), FeatureEnum.ContactManagement); // Init header actions string[,] actions = new string[1, 11]; actions[0, 0] = HeaderActions.TYPE_SAVEBUTTON; actions[0, 1] = GetString("General.Save"); actions[0, 5] = GetImageUrl("CMSModules/CMS_Content/EditMenu/save.png"); actions[0, 6] = "save"; actions[0, 8] = "true"; CurrentMaster.HeaderActions.LinkCssClass = "ContentSaveLinkButton"; CurrentMaster.HeaderActions.ActionPerformed += HeaderActions_ActionPerformed; CurrentMaster.HeaderActions.Actions = actions; // Get data class info DataClassInfo classInfo = (DataClassInfo)EditedObject; if (classInfo == null) { return; } // Load mapping dialog control and initialize it plcMapping.Controls.Clear(); mapControl = (CMSUserControl)Page.LoadControl("~/CMSModules/ContactManagement/Controls/UI/Contact/MappingDialog.ascx"); if (mapControl != null) { mapControl.ID = "ctrlMapping"; mapControl.SetValue("classname", classInfo.ClassName); mapControl.SetValue("allowoverwrite", classInfo.ClassContactOverwriteEnabled); plcMapping.Controls.Add(mapControl); } }
protected void Page_Load(object sender, EventArgs e) { CurrentMaster.HeaderActions.ActionPerformed += HeaderActions_ActionPerformed; // Get form info BizFormInfo formInfo = EditedObject as BizFormInfo; if (formInfo == null) { return; } // Get class of the form DataClassInfo classInfo = DataClassInfoProvider.GetDataClassInfo(formInfo.FormClassID); // Load mapping dialog control and initialize it plcMapping.Controls.Clear(); mapControl = (CMSUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/Controls/UI/Contact/MappingDialog.ascx"); if (mapControl != null) { mapControl.ID = "ctrlMapping"; mapControl.SetValue("classname", classInfo.ClassName); mapControl.SetValue("allowoverwrite", classInfo.ClassContactOverwriteEnabled); plcMapping.Controls.Add(mapControl); } if (!RequestHelper.IsPostBack()) { // Initialize checkbox value and mapping dialog visibility chkLogActivity.Checked = formInfo.FormLogActivity; } }
protected void Page_Load(object sender, EventArgs e) { // Check license LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetCurrentDomain(), FeatureEnum.ContactManagement); // Check if current user is authorised to read either site or global contacts if (!CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.ContactManagement", "ModifyContacts")) { RedirectToCMSDeskAccessDenied("CMS.ContactManagement", "ModifyContacts"); } // Init header actions string[,] actions = new string[1, 11]; actions[0, 0] = HeaderActions.TYPE_SAVEBUTTON; actions[0, 1] = GetString("General.Save"); actions[0, 5] = GetImageUrl("CMSModules/CMS_Content/EditMenu/save.png"); actions[0, 6] = "save"; actions[0, 8] = "true"; CurrentMaster.HeaderActions.LinkCssClass = "ContentSaveLinkButton"; CurrentMaster.HeaderActions.ActionPerformed += HeaderActions_ActionPerformed; CurrentMaster.HeaderActions.Actions = actions; // Get form info BizFormInfo formInfo = (BizFormInfo)EditedObject; if (formInfo == null) { return; } // Get class of the form DataClassInfo classInfo = DataClassInfoProvider.GetDataClass(formInfo.FormClassID); // Load mapping dialog control and initialize it plcMapping.Controls.Clear(); mapControl = (CMSUserControl)Page.LoadControl("~/CMSModules/ContactManagement/Controls/UI/Contact/MappingDialog.ascx"); if (mapControl != null) { mapControl.ID = "ctrlMapping"; mapControl.SetValue("classname", classInfo.ClassName); mapControl.SetValue("allowoverwrite", classInfo.ClassContactOverwriteEnabled); plcMapping.Controls.Add(mapControl); } if (!RequestHelper.IsPostBack()) { // Initialize checkbox value and mapping dialog visibility plcMapping.Visible = chkLogActivity.Checked = formInfo.FormLogActivity; } }
protected void Page_Load(object sender, EventArgs e) { ucAttachments = Page.LoadUserControl("~/CMSModules/Content/Controls/Attachments/AttachmentLightboxGallery.ascx") as CMSUserControl; ucAttachments.ID = "ctrlAttachments"; plcAttachmentLightBox.Controls.Add(ucAttachments); TreeNode currentDocument = DocumentContext.CurrentDocument; if (currentDocument != null) { // Get document type transformation string transformationName = currentDocument.NodeClassName + ".AttachmentLightbox"; string selectedTransformationName = currentDocument.NodeClassName + ".AttachmentLightboxDetail"; TransformationInfo ti = TransformationInfoProvider.GetTransformation(transformationName); // If transformation not present, use default from the Root document type if (ti == null) { transformationName = "cms.root.AttachmentLightbox"; ti = TransformationInfoProvider.GetTransformation(transformationName); } if (ti == null) { throw new Exception("[DocumentAttachments]: Default transformation '" + transformationName + "' doesn't exist!"); } ti = TransformationInfoProvider.GetTransformation(selectedTransformationName); // If transformation not present, use default from the Root document type if (ti == null) { selectedTransformationName = "cms.root.AttachmentLightboxDetail"; ti = TransformationInfoProvider.GetTransformation(selectedTransformationName); } if (ti == null) { throw new Exception("[DocumentAttachments]: Default transformation '" + selectedTransformationName + "' doesn't exist!"); } ucAttachments.SetValue("TransformationName", transformationName); ucAttachments.SetValue("SelectedItemTransformationName", selectedTransformationName); ucAttachments.SetValue("SiteName", SiteContext.CurrentSiteName); ucAttachments.SetValue("Path", currentDocument.NodeAliasPath); ucAttachments.SetValue("CultureCode", currentDocument.DocumentCulture); ucAttachments.SetValue("OrderBy", "AttachmentOrder, AttachmentName"); ucAttachments.SetValue("PageSize", 0); ucAttachments.SetValue("GetBinary", false); ucAttachments.SetValue("CacheMinutes", SettingsKeyInfoProvider.GetIntValue(SiteContext.CurrentSite + ".CMSCacheMinutes")); } }
protected void Page_Load(object sender, EventArgs e) { ucAttachments = this.Page.LoadControl("~/CMSModules/Content/Controls/Attachments/AttachmentLightboxGallery.ascx") as CMSUserControl; ucAttachments.ID = "ctrlAttachments"; plcAttachmentLightBox.Controls.Add(ucAttachments); TreeNode currentDocument = CMSContext.CurrentDocument; if (currentDocument != null) { // Get document type transformation string transformationName = currentDocument.NodeClassName + ".AttachmentLightbox"; string selectedTransformationName = currentDocument.NodeClassName + ".AttachmentLightboxDetail"; TransformationInfo ti = TransformationInfoProvider.GetTransformation(transformationName); // If transformation not present, use default from the Root document type if (ti == null) { transformationName = "cms.root.AttachmentLightbox"; ti = TransformationInfoProvider.GetTransformation(transformationName); } if (ti == null) { throw new Exception("[DocumentAttachments]: Default transformation '" + transformationName + "' doesn't exist!"); } ti = TransformationInfoProvider.GetTransformation(selectedTransformationName); // If transformation not present, use default from the Root document type if (ti == null) { selectedTransformationName = "cms.root.AttachmentLightboxDetail"; ti = TransformationInfoProvider.GetTransformation(selectedTransformationName); } if (ti == null) { throw new Exception("[DocumentAttachments]: Default transformation '" + selectedTransformationName + "' doesn't exist!"); } ucAttachments.SetValue("TransformationName", transformationName); ucAttachments.SetValue("SelectedItemTransformationName", selectedTransformationName); ucAttachments.SetValue("SiteName", CMSContext.CurrentSiteName); ucAttachments.SetValue("Path", currentDocument.NodeAliasPath); ucAttachments.SetValue("CultureCode", currentDocument.DocumentCulture); ucAttachments.SetValue("OrderBy", "AttachmentOrder, AttachmentName"); ucAttachments.SetValue("PageSize", 0); ucAttachments.SetValue("GetBinary", false); ucAttachments.SetValue("CacheMinutes", SettingsKeyProvider.GetIntValue(CMSContext.CurrentSite + ".CMSCacheMinutes")); } }
protected void Page_Load(object sender, EventArgs e) { // Check license LicenseHelper.CheckFeatureAndRedirect(RequestContext.CurrentDomain, FeatureEnum.ContactManagement); // Init header actions CurrentMaster.HeaderActions.ActionsList.Add(new SaveAction(Page)); // Register event for save action ComponentEvents.RequestEvents.RegisterForEvent(ComponentEvents.SAVE, SaveButton_Click); // Get data class info if (ClassInfo == null) { return; } // Load mapping dialog control and initialize it plcMapping.Controls.Clear(); mapControl = (CMSUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/Controls/UI/Contact/MappingDialog.ascx"); mapControl.ID = "ctrlMapping"; mapControl.SetValue("classname", ClassInfo.ClassName); mapControl.SetValue("allowoverwrite", ClassInfo.ClassContactOverwriteEnabled); mapControl.IsLiveSite = false; plcMapping.Controls.Add(mapControl); ResourceInfo resource = ResourceInfoProvider.GetResourceInfo(QueryHelper.GetInteger("moduleid", 0)); if (!SystemContext.DevelopmentMode && (resource != null) && !resource.ResourceIsInDevelopment) { pnlCustomization.MessagesPlaceHolder = MessagesPlaceHolder; pnlCustomization.Columns = new string[] { "ClassContactMapping", "ClassContactOverwriteEnabled" }; pnlCustomization.HeaderActions = HeaderActions; } else { pnlCustomization.StopProcessing = true; } }
/// <summary> /// Generates where condition. /// </summary> private string GenerateWhereCondition() { if (!uniSelector.HasData) { return(SqlHelper.NO_DATA_WHERE); } var classId = ValidationHelper.GetInteger(uniSelector.Value, 0); if (classId <= 0) { return(SqlHelper.NO_DATA_WHERE); } // Only results for specific class var mode = string.Empty; if (mFilteredUserControl != null) { mode = ValidationHelper.GetString(mFilteredUserControl.GetValue("FilterMode"), ""); // Set the prefix for the item var className = DataClassInfoProvider.GetClassName(classId); mFilteredUserControl.SetValue("ItemPrefix", className + "."); } var id = ValidationHelper.GetInteger(uniSelector.Value, 0); switch (mode.ToLowerInvariant()) { case TransformationInfo.OBJECT_TYPE: return($"(TransformationClassID = {id})"); default: return($"(ClassID = {id})"); } }
/// <summary> /// Generates where condition. /// </summary> private string GenerateWhereCondition() { if (!uniSelector.HasData) { return("0=1"); } // Get the class ID int classId = ValidationHelper.GetInteger(uniSelector.Value, 0); if (classId <= 0) { // No results return("0=1"); } // Only results for specific class string mode = string.Empty; if (filteredControl != null) { mode = ValidationHelper.GetString(filteredControl.GetValue("FilterMode"), ""); // Set the prefix for the item var className = DataClassInfoProvider.GetClassName(classId); filteredControl.SetValue("ItemPrefix", className + "."); } switch (mode.ToLowerCSafe()) { case TransformationInfo.OBJECT_TYPE: return(string.Concat("(TransformationClassID = ", ValidationHelper.GetInteger(uniSelector.Value, 0), ")")); default: return(string.Concat("(ClassID = ", ValidationHelper.GetInteger(uniSelector.Value, 0), ")")); } }
/// <summary> /// Generates where condition. /// </summary> protected string GenerateWhereCondition(int siteId) { switch (FilterMode) { case "user": { // If some site selected filter users if (siteId > 0) { return("UserID IN (SELECT UserID FROM CMS_UserSite WHERE SiteID = " + siteId + ")"); } } break; case "role": { // If some site selected filter users if (siteId > 0) { return("SiteID = " + siteId); } if (siteId.ToString() == siteSelector.GlobalRecordValue) { return("SiteID IS NULL"); } } break; case "subscriber": { // If some site filters subscribers if (siteId > 0) { return("SubscriberSiteID = " + siteId); } } break; case "cultures": { if (siteId > 0) { return("CultureID IN (SELECT CultureID FROM CMS_SiteCulture WHERE SiteID = " + siteId + ")"); } } break; case "bizform": { if (siteId > 0) { return("FormSiteID = " + siteId); } } break; case "notificationtemplate": case "notificationtemplateglobal": { string where; // Set the prefix for the item SiteInfo si = SiteInfoProvider.GetSiteInfo(siteId); if (si != null) { filteredControl.SetValue("ItemPrefix", si.SiteName + "."); where = "TemplateSiteID = " + siteId; } // Add global templates else { filteredControl.SetValue("ItemPrefix", null); where = "TemplateSiteID IS NULL"; } return(where); } case "department": { // If some site selected filter departments if (siteId > 0) { return("DepartmentSiteID = " + siteId); } if (siteId.ToString() == siteSelector.GlobalRecordValue) { return("DepartmentSiteID IS NULL"); } } break; default: { // Automatic filtering mode if ((siteId > 0) || (siteId == UniSelector.US_GLOBAL_RECORD)) { IObjectTypeDriven filtered = FilteredControl as IObjectTypeDriven; if (filtered != null) { BaseInfo infoObj = ModuleManager.GetReadOnlyObject(filtered.ObjectType); return(infoObj.TypeInfo.GetSiteWhereCondition(siteId, false).ToString(true)); } } } break; } return(String.Empty); }
protected void Page_Load(object sender, EventArgs e) { CurrentMaster.HeaderActions.ActionPerformed += HeaderActions_ActionPerformed; // Get form info BizFormInfo formInfo = EditedObject as BizFormInfo; if (formInfo == null) { return; } // Get class of the form DataClassInfo classInfo = DataClassInfoProvider.GetDataClassInfo(formInfo.FormClassID); // Load mapping dialog control and initialize it plcMapping.Controls.Clear(); mapControl = (CMSUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/Controls/UI/Contact/MappingDialog.ascx"); if (mapControl != null) { mapControl.ID = "ctrlMapping"; mapControl.SetValue("classname", classInfo.ClassName); mapControl.SetValue("allowoverwrite", classInfo.ClassContactOverwriteEnabled); plcMapping.Controls.Add(mapControl); } if (!RequestHelper.IsPostBack()) { // Initialize checkbox value and mapping dialog visibility plcMapping.Visible = chkLogActivity.Checked = formInfo.FormLogActivity; } }
protected void Page_Load(object sender, EventArgs e) { // Check license LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetCurrentDomain(), FeatureEnum.ContactManagement); // Check if current user is authorised to read either site or global contacts if (!CMSContext.CurrentUser.IsAuthorizedPerResource(ModuleEntry.CONTACTMANAGEMENT, "ModifyContacts")) { RedirectToCMSDeskAccessDenied(ModuleEntry.CONTACTMANAGEMENT, "ModifyContacts"); } // Init header actions string[,] actions = new string[1,11]; actions[0, 0] = HeaderActions.TYPE_SAVEBUTTON; actions[0, 1] = GetString("General.Save"); actions[0, 5] = GetImageUrl("CMSModules/CMS_Content/EditMenu/save.png"); actions[0, 6] = "save"; actions[0, 8] = "true"; CurrentMaster.HeaderActions.ActionPerformed += HeaderActions_ActionPerformed; CurrentMaster.HeaderActions.Actions = actions; // Get form info BizFormInfo formInfo = (BizFormInfo)EditedObject; if (formInfo == null) { return; } // Get class of the form DataClassInfo classInfo = DataClassInfoProvider.GetDataClass(formInfo.FormClassID); // Load mapping dialog control and initialize it plcMapping.Controls.Clear(); mapControl = (CMSUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/Controls/UI/Contact/MappingDialog.ascx"); if (mapControl != null) { mapControl.ID = "ctrlMapping"; mapControl.SetValue("classname", classInfo.ClassName); mapControl.SetValue("allowoverwrite", classInfo.ClassContactOverwriteEnabled); plcMapping.Controls.Add(mapControl); } if (!RequestHelper.IsPostBack()) { // Initialize checkbox value and mapping dialog visibility plcMapping.Visible = chkLogActivity.Checked = formInfo.FormLogActivity; } }
protected void Page_Load(object sender, EventArgs e) { // Initialize menu DataSet siteCulturesDS = CultureInfoProvider.GetSiteCultures(CMSContext.CurrentSiteName); Group content = new Group { Caption = GetString("ContentMenu.ContentManagement"), ControlPath = "~/CMSAdminControls/UI/UniMenu/Content/ContentMenu.ascx", CssClass = "ContentMenuGroup" }; contentMenu.Groups.Add(content); CMSUserControl modeMenu = Page.LoadUserControl("~/CMSAdminControls/UI/UniMenu/Content/ModeMenu.ascx") as CMSUserControl; if (modeMenu != null) { modeMenu.ID = "grpMode"; modeMenu.SetValue("SelectedMode", SelectedMode); Group view = new Group { Caption = GetString("ContentMenu.ViewMode"), Control = modeMenu, CssClass = "ContentMenuGroup" }; contentMenu.Groups.Add(view); } if (DeviceProfileInfoProvider.IsDeviceProfilesEnabled(CMSContext.CurrentSiteName)) { CMSUserControl devicesMenu = Page.LoadUserControl("~/CMSModules/DeviceProfile/Controls/ProfilesMenuControl.ascx") as CMSUserControl; if (devicesMenu != null) { devicesMenu.ID = "grpDevices"; devicesMenu.SetValue("SelectedDevice", SelectedDevice); Group view = new Group { Caption = GetString("ContentMenu.Device"), Control = devicesMenu, CssClass = "ContentMenuGroup" }; contentMenu.Groups.Add(view); } } // Do not display language menu if (!DataHelper.DataSourceIsEmpty(siteCulturesDS) && (siteCulturesDS.Tables[0].Rows.Count > 1)) { CMSUserControl langMenu = Page.LoadUserControl("~/CMSModules/Content/Controls/LanguageMenu.ascx") as CMSUserControl; if (langMenu != null) { langMenu.ID = "grpLang"; langMenu.SetValue("SelectedCulture", SelectedCulture); Group lang = new Group { Control = langMenu, Caption = GetString("contentmenu.language"), CssClass = "ContentMenuGroup" }; contentMenu.Groups.Add(lang); } } Group other = new Group { Caption = GetString("contentmenu.other"), ControlPath = "~/CMSAdminControls/UI/UniMenu/Content/OtherMenu.ascx", CssClass = "ContentMenuGroup" }; contentMenu.Groups.Add(other); }
/// <summary> /// Generates where condition. /// </summary> protected string GenerateWhereCondition(int siteId) { if (!String.IsNullOrEmpty(FilterMode)) { switch (FilterMode) { case "user": { // If some site selected filter users if (siteId > 0) { return("UserID IN (SELECT UserID FROM CMS_UserSite WHERE SiteID = " + siteId + ")"); } } break; case "role": { // If some site selected filter users if (siteId > 0) { return("SiteID = " + siteId); } if (siteId.ToString() == siteSelector.GlobalRecordValue) { return("SiteID IS NULL"); } } break; case "subscriber": { // If some site filters subscibers if (siteId > 0) { return("SubscriberSiteID = " + siteId); } } break; case "cultures": { if (siteId > 0) { return("CultureID IN (SELECT CultureID FROM CMS_SiteCulture WHERE SiteID = " + siteId + ")"); } } break; case "bizform": { if (siteId > 0) { return("FormSiteID = " + siteId); } } break; case "notificationtemplate": case "notificationtemplateglobal": { string where = ""; // Set the prefix for the item SiteInfo si = SiteInfoProvider.GetSiteInfo(siteId); if (si != null) { filteredControl.SetValue("ItemPrefix", si.SiteName + "."); where = "TemplateSiteID = " + siteId; } // Add global templates else { filteredControl.SetValue("ItemPrefix", null); where = "TemplateSiteID IS NULL"; } return(where); } case "department": { // If some site selected filter departments if (siteId > 0) { return("DepartmentSiteID = " + siteId); } if (siteId.ToString() == siteSelector.GlobalRecordValue) { return("DepartmentSiteID IS NULL"); } } break; } } return(String.Empty); }