protected void Page_Load(object sender, EventArgs e) { if (FileHelper.FileExists(controlPath)) { // Load the group selector ctrl = LoadUserControl(controlPath) as FormEngineUserControl; ctrl.ID = "groupSelector"; plcGroupSelector.Controls.Add(ctrl); UniSelector usGroups = ctrl.GetValue("CurrentSelector") as UniSelector; if (usGroups != null) { usGroups.ReturnColumnName = "GroupID"; } usGroups.UseUniSelectorAutocomplete = false; mSiteId = QueryHelper.GetInteger("siteid", 0); mNodeId = QueryHelper.GetInteger("nodeid", 0); mGroupId = QueryHelper.GetInteger("groupid", 0); if (!RequestHelper.IsPostBack()) { ctrl.Value = mGroupId; } ctrl.IsLiveSite = false; ctrl.SetValue("DisplayCurrentGroup", false); ctrl.SetValue("DisplayNoneValue", true); ctrl.SetValue("SiteID", mSiteId); ctrl.SetValue("CurrentSelector", usGroups); } }
/// <summary> /// Initializes item selector form control based on selected conversion definition. /// </summary> /// <param name="force">Forces reload of the selector if <c>true</c></param> private void InitializeItemSelector(bool force) { var conversionDefinition = ABTestConversionDefinitionRegister.Instance.Get(SelectedConversion); var controlName = conversionDefinition?.FormControlDefinition?.FormControlName; var formControlType = conversionDefinition?.FormControlDefinition?.FormControlType; if (force) { plcItemControl.Controls.Clear(); mItemSelector = null; } var formUserControl = FormUserControlInfoProvider.GetFormUserControlInfo(controlName); if (formUserControl == null && formControlType == null) { return; } mItemSelector = formControlType != null ? (FormEngineUserControl)Activator.CreateInstance(formControlType) : FormUserControlLoader.LoadFormControl(Page, controlName, "", loadDefaultProperties: false); if (mItemSelector != null) { mItemSelector.ID = "item" + SelectedConversion; mItemSelector.IsLiveSite = false; var controlParameters = FormHelper.GetFormControlParameters(controlName, formUserControl?.UserControlMergedParameters, false); if (controlParameters != null) { mItemSelector.LoadDefaultProperties(controlParameters); } var parameters = conversionDefinition?.FormControlDefinition?.FormControlParameters; if (parameters != null) { foreach (var parameter in parameters) { mItemSelector.SetValue(parameter.Key, parameter.Value); } } plcItemControl.Controls.Clear(); plcItemControl.Controls.Add(mItemSelector); lblItem.AssociatedControlID = mItemSelector.ID; SetItemSelectorCaption(conversionDefinition?.FormControlDefinition?.FormControlCaption); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); FormEngineUserControl categoryCaptionControl = (FormEngineUserControl)txtCategoryCaption.NestedControl; // Disable autosave on LocalizableTextBox controls categoryCaptionControl?.SetValue("AutoSave", false); txtCategoryCaption.ResolverName = ResolverName; chkCollapsible.ResolverName = ResolverName; chkCollapsedByDefault.ResolverName = ResolverName; chkVisible.ResolverName = ResolverName; }
protected override void OnInit(EventArgs e) { // Culture independent data SplitModeAllwaysRefresh = true; // Non-versioned data are modified DocumentManager.UseDocumentHelper = false; base.OnInit(e); // Check UI element permission if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.Content", "Properties.General")) { RedirectToUIElementAccessDenied("CMS.Content", "Properties.General"); } // Redirect to information page when no UI elements displayed if (pnlUIAdvanced.IsHidden && pnlUICache.IsHidden && pnlUIDesign.IsHidden && pnlUIOther.IsHidden && pnlUIOwner.IsHidden) { RedirectToUINotAvailable(); } // Init document manager events DocumentManager.OnSaveData += DocumentManager_OnSaveData; DocumentManager.OnAfterAction += DocumentManager_OnAfterAction; EnableSplitMode = true; // Set user control properties usrOwner = Page.LoadUserControl("~/CMSModules/Membership/FormControls/Users/selectuser.ascx") as FormEngineUserControl; if (usrOwner != null) { usrOwner.ID = "ctrlUsrOwner"; usrOwner.IsLiveSite = false; usrOwner.SetValue("ShowSiteFilter", false); usrOwner.StopProcessing = pnlUIOwner.IsHidden; plcUsrOwner.Controls.Add(usrOwner); } }
/// <summary> /// Loads group selector control to the page. /// </summary> /// <param name="siteId">Site ID</param> /// <returns>Returns true if site contains group and group selector was loaded</returns> private bool AddGroupSelector(int siteId) { SiteInfo si = SiteInfoProvider.GetSiteInfo(siteId); if ((si != null) && (ModuleCommands.CommunitySiteHasGroup(si.SiteID))) { groupsControl = Page.LoadUserControl("~/CMSModules/Groups/FormControls/MultipleGroupSelector.ascx") as FormEngineUserControl; if (groupsControl != null) { groupsControl.FormControlParameter = siteId; groupsControl.IsLiveSite = false; groupsControl.ID = "selectgroups"; groupsControl.ShortID = "sg"; groupsControl.SetValue("ReturnColumnName", "GroupID"); plcGroupSelector.Controls.Add(groupsControl); return(true); } } return(false); }
/// <summary> /// OnInit event. /// </summary> protected override void OnInit(EventArgs e) { int querySiteID = QueryHelper.GetInteger("siteid", 0); // Do not allow other than current site ID out of global scope. var uiContext = UIContextHelper.GetUIContext(this); SiteID = ApplicationUIHelper.IsInGlobalApplicationScope(uiContext.UIElement) ? querySiteID : SiteContext.CurrentSiteID; if (ModuleEntryManager.IsModuleLoaded(ModuleName.COMMUNITY)) { Control ctrl = LoadUserControl(GROUP_SELECTOR_PATH); if (ctrl != null) { mSelectInGroups = ctrl as FormEngineUserControl; ctrl.ID = "selGroups"; ctrl = LoadUserControl(GROUP_SELECTOR_PATH); mSelectNotInGroups = ctrl as FormEngineUserControl; ctrl.ID = "selNoGroups"; plcGroups.Visible = true; plcSelectInGroups.Controls.Add(mSelectInGroups); plcSelectNotInGroups.Controls.Add(mSelectNotInGroups); mSelectNotInGroups.SetValue("UseFriendlyMode", true); mSelectInGroups.IsLiveSite = false; mSelectInGroups.SetValue("UseFriendlyMode", true); mSelectNotInGroups.IsLiveSite = false; } } if (DisplayScore && SettingsKeyInfoProvider.GetBoolValue(SiteContext.CurrentSiteName + ".CMSEnableOnlineMarketing")) { Control ctrl = LoadUserControl(SCORE_SELECTOR_PATH); if (ctrl != null) { ctrl.ID = "selectScore"; mScoreSelector = ctrl as FormEngineUserControl; if (mScoreSelector != null) { plcUpdateContent.Controls.Add(mScoreSelector); mScoreSelector.SetValue("AllowAll", false); mScoreSelector.SetValue("AllowEmpty", true); } } } else { plcScore.Visible = false; lblScore.AssociatedControlID = null; } InitializeDropDownLists(); base.OnInit(e); plcDisplayAnonymous.Visible = ContactManagementPermission && SessionManager.StoreOnlineUsersInDatabase && EnableDisplayingGuests; if (!RequestHelper.IsPostBack()) { chkDisplayAnonymous.Checked = DisplayGuestsByDefault; } siteSelector.DropDownSingleSelect.AutoPostBack = true; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); // Module forums is not available if (!(ModuleManager.IsModuleLoaded(ModuleName.FORUMS))) { return; } selForum = LoadUserControl("~/CMSModules/Forums/FormControls/ForumSelector.ascx") as FormEngineUserControl; if (selForum != null) { // Set default vaules for forum selector selForum.IsLiveSite = false; selForum.SetValue("selectionmode", SelectionModeEnum.MultipleTextBox); selForum.SetValue("DisplayAdHocOption", false); plcForumSelector.Controls.Add(selForum); } // Set events and default values for site selector selSite.AllowAll = false; selSite.UseCodeNameForSelection = true; selSite.DropDownSingleSelect.AutoPostBack = true; selSite.UniSelector.OnSelectionChanged += UniSelector_OnSelectionChanged; LoadControls(); if (ItemType == SearchIndexSettingsInfo.TYPE_ALLOWED) { selSite.AllowAll = true; } var siteIDs = SearchIndexSiteInfoProvider.GetIndexSiteBindings(ItemID).Select(x => x.IndexSiteID).ToList(); if (siteIDs.Any()) { // Preselect current site if it is assigned to index var sisiId = QueryHelper.GetGuid("guid", Guid.Empty); var isNew = sisiId == Guid.Empty; if (!RequestHelper.IsPostBack() && isNew && siteIDs.Contains(SiteContext.CurrentSiteID)) { selSite.Value = SiteContext.CurrentSiteName; } selSite.UniSelector.WhereCondition = SqlHelper.GetWhereInCondition("SiteID", siteIDs, false, false); } else { selSite.Enabled = false; selForum.Enabled = false; btnOk.Enabled = false; ShowError(GetString("srch.index.nositeselected")); } selSite.Reload(true); selForum.SetValue("SiteName", Convert.ToString(selSite.Value)); // Init controls if (!RequestHelper.IsPostBack()) { SetControlsStatus(); } }
/// <summary> /// Configures selectors. /// </summary> private void SetupSelectors() { // Setup role selector selectRole.CurrentSelector.SelectionMode = SelectionModeEnum.MultipleButton; selectRole.CurrentSelector.OnItemsSelected += RolesSelector_OnItemsSelected; selectRole.CurrentSelector.ReturnColumnName = "RoleID"; selectRole.CurrentSelector.ButtonImage = GetImageUrl("Objects/CMS_Role/add.png"); selectRole.CurrentSelector.DialogLink.CssClass = "MenuItemEdit Pad"; selectRole.ShowSiteFilter = false; selectRole.CurrentSelector.ResourcePrefix = "addroles"; selectRole.CurrentSelector.DialogButton.CssClass = "LongButton"; selectRole.IsLiveSite = false; selectRole.UseCodeNameForSelection = false; selectRole.GlobalRoles = false; // Setup user selector selectUser.SelectionMode = SelectionModeEnum.MultipleButton; selectUser.UniSelector.OnItemsSelected += UserSelector_OnItemsSelected; selectUser.UniSelector.ReturnColumnName = "UserID"; selectUser.UniSelector.DisplayNameFormat = "{%FullName%} ({%Email%})"; selectUser.UniSelector.ButtonImage = GetImageUrl("Objects/CMS_User/add.png"); selectUser.UniSelector.AdditionalSearchColumns = "UserName, Email"; selectUser.UniSelector.DialogLink.CssClass = "MenuItemEdit Pad"; selectUser.ShowSiteFilter = false; selectUser.ResourcePrefix = "newsletteraddusers"; selectUser.UniSelector.DialogButton.CssClass = "LongButton"; selectUser.IsLiveSite = false; // Setup subscriber selector selectSubscriber.UniSelector.SelectionMode = SelectionModeEnum.MultipleButton; selectSubscriber.UniSelector.OnItemsSelected += SubscriberSelector_OnItemsSelected; selectSubscriber.UniSelector.ReturnColumnName = "SubscriberID"; selectSubscriber.UniSelector.ButtonImage = GetImageUrl("Objects/Newsletter_Subscriber/add.png"); selectSubscriber.UniSelector.DialogLink.CssClass = "MenuItemEdit Pad"; selectSubscriber.ShowSiteFilter = false; selectSubscriber.UniSelector.DialogButton.CssClass = "LongButton"; selectSubscriber.IsLiveSite = false; selectSubscriber.UniSelector.RemoveMultipleCommas = true; // Setup contact group and contact selectors if (ModuleEntry.IsModuleLoaded(ModuleEntry.ONLINEMARKETING) && LicenseHelper.CheckFeature(URLHelper.GetCurrentDomain(), FeatureEnum.ContactManagement)) { plcSelectCG.Controls.Clear(); // Check read permission for contact groups if (CMSContext.CurrentUser.IsAuthorizedPerResource(ModuleEntry.CONTACTMANAGEMENT, "ReadContactGroups")) { // Load selector control and initialize it cgSelector = (FormEngineUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/FormControls/ContactGroupSelector.ascx"); if (cgSelector != null) { cgSelector.ID = "selectCG"; cgSelector.ShortID = "scg"; // Get inner uniselector control UniSelector selector = (UniSelector)cgSelector.GetValue("uniselector"); if (selector != null) { // Bind an event handler on 'items selected' event selector.OnItemsSelected += CGSelector_OnItemsSelected; selector.ResourcePrefix = "contactgroupsubscriber"; } // Insert selector to the header plcSelectCG.Controls.Add(cgSelector); } } // Check read permission for contacts if (CMSContext.CurrentUser.IsAuthorizedPerResource(ModuleEntry.CONTACTMANAGEMENT, "ReadContacts")) { // Load selector control and initialize it cSelector = (FormEngineUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/FormControls/ContactSelector.ascx"); if (cSelector != null) { cSelector.ID = "slContact"; cSelector.ShortID = "sc"; // Set where condition to filter contacts with email addresses cSelector.SetValue("wherecondition", "NOT (ContactEmail IS NULL OR ContactEmail LIKE '')"); // Set site ID cSelector.SetValue("siteid", CMSContext.CurrentSiteID); // Get inner uniselector control UniSelector selector = (UniSelector)cSelector.GetValue("uniselector"); if (selector != null) { // Bind an event handler on 'items selected' event selector.OnItemsSelected += ContactSelector_OnItemsSelected; selector.SelectionMode = SelectionModeEnum.MultipleButton; selector.ResourcePrefix = "contactsubscriber"; selector.ButtonImage = GetImageUrl("/Objects/OM_Contact/add.png"); selector.DisplayNameFormat = "{%ContactFirstName%} {%ContactLastName%} ({%ContactEmail%})"; selector.AdditionalSearchColumns = "ContactFirstName,ContactMiddleName,ContactEmail"; } // Insert selector to the header plcSelectCG.Controls.Add(cSelector); } } } // Initialize mass actions if (drpActions.Items.Count == 0) { drpActions.Items.Add(new ListItem(GetString("general.selectaction"), SELECT)); drpActions.Items.Add(new ListItem(GetString("newsletter.unsubscribelink"), UNSUBSCRIBE)); drpActions.Items.Add(new ListItem(GetString("newsletter.renewsubscription"), SUBSCRIBE)); drpActions.Items.Add(new ListItem(GetString("newsletter.approvesubscription"), APPROVE)); drpActions.Items.Add(new ListItem(GetString("newsletter.rejectsubscription"), REJECT)); drpActions.Items.Add(new ListItem(GetString("newsletter.deletesubscription"), REMOVE)); } }
protected void Page_Load(object sender, EventArgs e) { // Check license if (DataHelper.GetNotEmpty(URLHelper.GetCurrentDomain(), "") != "") { LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetCurrentDomain(), FeatureEnum.WebAnalytics); } // If deletion is in progress if (StatisticsInfoProvider.DataDeleterIsRunning) { timeRefresh.Enabled = true; ViewState["DeleterStarted"] = true; EnableControls(false); ReloadInfoPanel(); } // If deletion has just end - add close script else if (ValidationHelper.GetBoolean(ViewState["DeleterStarted"], false)) { ScriptHelper.RegisterStartupScript(this, typeof(string), "CloseScript", ScriptHelper.GetScript("window.close(); wopener.RefreshPage(); ")); } ucABTests = LoadControl("~/CMSModules/OnlineMarketing/FormControls/SelectABTest.ascx") as FormEngineUserControl; ucMVTests = LoadControl("~/CMSModules/OnlineMarketing/FormControls/SelectMVTest.ascx") as FormEngineUserControl; if (ucABTests != null) { ucABTests.ID = "abTestSelector"; pnlABTests.Controls.Add(ucABTests); } if (ucMVTests != null) { ucMVTests.ID = "mvtSelector"; pnlMVTests.Controls.Add(ucMVTests); } // Configure dynamic selectors if (!RequestHelper.IsPostBack() && (ucABTests != null) && (ucMVTests != null)) { string[,] fields = new string[2, 2]; fields[0, 0] = GetString("general.pleaseselect"); fields[0, 1] = "pleaseselect"; fields[1, 0] = "(" + GetString("general.all") + ")"; fields[1, 1] = ValidationHelper.GetString(ucABTests.GetValue("AllRecordValue"), String.Empty); ucABTests.SetValue("SpecialFields", fields); ucABTests.Value = "pleaseselect"; ucABTests.SetValue("AllowEmpty", false); ucABTests.SetValue("ReturnColumnName", "ABTestName"); ucMVTests.SetValue("SpecialFields", fields); ucMVTests.Value = "pleaseselect"; ucMVTests.SetValue("AllowEmpty", false); ucMVTests.SetValue("ReturnColumnName", "MVTestName"); usCampaigns.UniSelector.SpecialFields = fields; usCampaigns.Value = "pleaseselect"; } CurrentUserInfo user = CMSContext.CurrentUser; // Check permissions for CMS Desk -> Tools -> Web analytics tab if (!user.IsAuthorizedPerUIElement("CMS.Tools", "WebAnalytics")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Tools", "WebAnalytics"); } // Check 'Read' permission if (!user.IsAuthorizedPerResource("CMS.WebAnalytics", "Read")) { RedirectToCMSDeskAccessDenied("CMS.WebAnalytics", "Read"); } string title = GetString("AnayticsManageData.ManageData"); this.Page.Title = title; this.CurrentMaster.Title.TitleText = title; this.CurrentMaster.Title.TitleImage = GetImageUrl("CMSModules/CMS_Reporting/managedata.png"); // Confirmation message for deleting string deleteFromToMessage = ScriptHelper.GetString(GetString("webanal.deletefromtomsg")); deleteFromToMessage = deleteFromToMessage.Replace("##FROM##", "' + elemFromStr + '"); deleteFromToMessage = deleteFromToMessage.Replace("##TO##", "' + elemToStr + '"); string script = " var elemTo = document.getElementById('" + pickerTo.ClientID + "_txtDateTime'); " + " var elemFrom = document.getElementById('" + pickerFrom.ClientID + "_txtDateTime'); " + " var elemToStr = " + ScriptHelper.GetString(GetString("webanal.now")) + "; " + " var elemFromStr = " + ScriptHelper.GetString(GetString("webanal.beginning")) + "; " + " var deleteAll = 1; " + " if (elemTo.value != '') { deleteAll = 0; elemToStr = elemTo.value; }; " + " if (elemFrom.value != '') { deleteAll = 0; elemFromStr = elemFrom.value; }; " + " if (deleteAll == 1) { return confirm(" + ScriptHelper.GetString(GetString("webanal.deleteall")) + "); } " + " else { return confirm(" + deleteFromToMessage + "); }; "; btnDelete.OnClientClick = script + "; return false;"; statCodeName = QueryHelper.GetString("statCodeName", String.Empty); if (statCodeName == "abtest") { pnlABTestSelector.Visible = true; } if (statCodeName == "mvtest") { pnlMVTSelector.Visible = true; } if (statCodeName == "campaigns") { pnlCampaigns.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { bool displayNone = false; bool currentIsCustomizedOfInstalled = false; elementInfo = UIContext.EditedObject as UIElementInfo; if (elementInfo != null && elementInfo.ElementID > 0) { ParentID = elementInfo.ElementParentID; EditForm.FieldControls["ElementPageTemplateID"].SetValue("ItemGuid", elementInfo.ElementGUID); EditForm.FieldControls["ElementPageTemplateID"].SetValue("ItemName", elementInfo.ElementDisplayName); // Exclude current element and children from dropdown list EditForm.FieldControls["ElementParentID"].SetValue("WhereCondition", "ElementIDPath NOT LIKE N'" + elementInfo.ElementIDPath + "%'"); // Enable editing only for current module. Disable for root EditForm.Enabled = ((!UIElementInfoProvider.AllowEditOnlyCurrentModule || (ResourceID == elementInfo.ElementResourceID) && elementInfo.ElementIsCustom) && (elementInfo.ElementParentID != 0)); // Allow global application checkbox only for applications if (!elementInfo.IsApplication && !elementInfo.ElementIsGlobalApplication) { EditForm.FieldsToHide.Add("ElementIsGlobalApplication"); EditForm.FieldsToHide.Add(nameof(UIElementInfo.ElementRequiresGlobalAdminPriviligeLevel)); } // Show info for customized elements ResourceInfo ri = ResourceInfoProvider.GetResourceInfo(elementInfo.ElementResourceID); if (ri != null) { if (elementInfo.ElementIsCustom && !ri.ResourceIsInDevelopment) { currentIsCustomizedOfInstalled = true; ShowInformation(GetString("module.customeleminfo")); } } } // New item else { isNew = true; if (!RequestHelper.IsPostBack()) { EditForm.FieldControls["ElementFromVersion"].Value = CMSVersion.GetVersion(true, true, false, false); } // Predefine current resource if is in development ResourceInfo ri = CurrentResourceInfo; if ((ri != null) && ri.ResourceIsInDevelopment) { EditForm.FieldControls["ElementResourceID"].Value = ResourceID; } // Display none if is under not-development resource else { displayNone = true; } EditForm.FieldControls["ElementParentID"].Value = ParentID; EditForm.FieldsToHide.Add("ElementParentID"); var parent = UIElementInfoProvider.GetUIElementInfo(ParentID); if ((parent == null) || (parent.ElementLevel != 2) || !parent.IsInAdministrationScope) { EditForm.FieldsToHide.Add("ElementIsGlobalApplication"); EditForm.FieldsToHide.Add(nameof(UIElementInfo.ElementRequiresGlobalAdminPriviligeLevel)); } } // Allow only modules in development mode FormEngineUserControl resourceCtrl = EditForm.FieldControls["ElementResourceID"]; if (resourceCtrl != null) { resourceCtrl.SetValue("DisplayOnlyModulesInDevelopmentMode", true); } // Disable form and add customize button if element is not custom and not development mode if (!SystemContext.DevelopmentMode && (elementInfo != null) && (ResourceID == elementInfo.ElementResourceID) && !elementInfo.ElementIsCustom && (elementInfo.ElementParentID != 0)) { ICMSMasterPage master = Page.Master as ICMSMasterPage; if (master != null) { master.HeaderActions.AddAction(new HeaderAction { Text = GetString("general.customize"), CommandName = "customize", OnClientClick = "if (!confirm(" + ScriptHelper.GetString(ResHelper.GetString("module.customizeconfirm")) + ")) { return false; }" }); master.HeaderActions.ActionPerformed += HeaderActions_ActionPerformed; } EditForm.Enabled = false; } if (resourceCtrl != null) { // Display all modules in disabled UI if (!EditForm.Enabled) { resourceCtrl.SetValue("DisplayOnlyModulesInDevelopmentMode", false); } // Display all modules in customized element but do not allow change the module else if (currentIsCustomizedOfInstalled) { resourceCtrl.SetValue("DisplayOnlyModulesInDevelopmentMode", false); resourceCtrl.Enabled = false; } // Display none if needed resourceCtrl.SetValue("DisplayNone", displayNone); } }
/// <summary> /// Configures selectors. /// </summary> private void SetupSelectors() { // Setup role selector selectRole.CurrentSelector.SelectionMode = SelectionModeEnum.MultipleButton; selectRole.CurrentSelector.OnItemsSelected += RolesSelector_OnItemsSelected; selectRole.CurrentSelector.ReturnColumnName = "RoleID"; selectRole.ShowSiteFilter = false; selectRole.CurrentSelector.ResourcePrefix = "addroles"; selectRole.IsLiveSite = false; selectRole.UseCodeNameForSelection = false; selectRole.GlobalRoles = false; // Setup user selector selectUser.SelectionMode = SelectionModeEnum.MultipleButton; selectUser.UniSelector.OnItemsSelected += UserSelector_OnItemsSelected; selectUser.UniSelector.ReturnColumnName = "UserID"; selectUser.UniSelector.DisplayNameFormat = "{%FullName%} ({%Email%})"; selectUser.UniSelector.AdditionalSearchColumns = "UserName, Email"; selectUser.ShowSiteFilter = false; selectUser.ResourcePrefix = "newsletteraddusers"; selectUser.IsLiveSite = false; // Setup subscriber selector selectSubscriber.UniSelector.SelectionMode = SelectionModeEnum.MultipleButton; selectSubscriber.UniSelector.OnItemsSelected += SubscriberSelector_OnItemsSelected; selectSubscriber.UniSelector.ReturnColumnName = "SubscriberID"; selectSubscriber.ShowSiteFilter = false; selectSubscriber.IsLiveSite = false; selectSubscriber.UniSelector.RemoveMultipleCommas = true; // Setup contact group and contact selectors if (ModuleEntryManager.IsModuleLoaded(ModuleName.ONLINEMARKETING) && LicenseHelper.CheckFeature(RequestContext.CurrentDomain, FeatureEnum.ContactManagement)) { plcSelectCG.Controls.Clear(); // Check read permission for contact groups if (MembershipContext.AuthenticatedUser.IsAuthorizedPerResource(ModuleName.CONTACTMANAGEMENT, "ReadContactGroups")) { // Load selector control and initialize it cgSelector = (FormEngineUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/FormControls/ContactGroupSelector.ascx"); if (cgSelector != null) { cgSelector.ID = "selectCG"; cgSelector.ShortID = "scg"; // Get inner uniselector control UniSelector selector = (UniSelector)cgSelector.GetValue("uniselector"); if (selector != null) { // Bind an event handler on 'items selected' event selector.OnItemsSelected += CGSelector_OnItemsSelected; selector.ResourcePrefix = "contactgroupsubscriber"; } // Insert selector to the header plcSelectCG.Controls.Add(cgSelector); } } // Check read permission for contacts if (MembershipContext.AuthenticatedUser.IsAuthorizedPerResource(ModuleName.CONTACTMANAGEMENT, "ReadContacts")) { // Load selector control and initialize it cSelector = (FormEngineUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/FormControls/ContactSelector.ascx"); if (cSelector != null) { cSelector.ID = "slContact"; cSelector.ShortID = "sc"; // Set where condition to filter contacts with email addresses cSelector.SetValue("wherecondition", "NOT (ContactEmail IS NULL OR ContactEmail LIKE '')"); // Set site ID cSelector.SetValue("siteid", SiteContext.CurrentSiteID); // Get inner uniselector control UniSelector selector = (UniSelector)cSelector.GetValue("uniselector"); if (selector != null) { // Bind an event handler on 'items selected' event selector.OnItemsSelected += ContactSelector_OnItemsSelected; selector.SelectionMode = SelectionModeEnum.MultipleButton; selector.ResourcePrefix = "contactsubscriber"; selector.DisplayNameFormat = "{%ContactFirstName%} {%ContactLastName%} ({%ContactEmail%})"; selector.AdditionalSearchColumns = "ContactFirstName,ContactMiddleName,ContactEmail"; } // Insert selector to the header plcSelectCG.Controls.Add(cSelector); } } } // Setup persona selectors if (ModuleEntryManager.IsModuleLoaded(ModuleName.PERSONAS) && LicenseHelper.CheckFeature(RequestContext.CurrentDomain, FeatureEnum.Personas)) { // Check read permission for contact groups if (MembershipContext.AuthenticatedUser.IsAuthorizedPerResource(ModuleName.PERSONAS, "Read")) { // Load selector control and initialize it personaSelector = (UniSelector)Page.LoadUserControl("~/CMSAdminControls/UI/Uniselector/Uniselector.ascx"); if (personaSelector != null) { personaSelector.ID = "personaSelector"; personaSelector.ShortID = "ps"; personaSelector.ObjectType = PredefinedObjectType.PERSONA; personaSelector.ReturnColumnName = "PersonaID"; personaSelector.WhereCondition = "PersonaSiteID = " + SiteContext.CurrentSiteID; personaSelector.SelectionMode = SelectionModeEnum.MultipleButton; personaSelector.DisplayNameFormat = "{%PersonaDisplayName%}"; personaSelector.ResourcePrefix = "personasubscriber"; personaSelector.IsLiveSite = false; // Bind an event handler on 'items selected' event personaSelector.OnItemsSelected += PersonaSelector_OnItemsSelected; // Add selector to the header plcSelectCG.Controls.Add(personaSelector); } } } // Initialize mass actions if (drpActions.Items.Count == 0) { drpActions.Items.Add(new ListItem(GetString("general.selectaction"), SELECT)); drpActions.Items.Add(new ListItem(GetString("newsletter.unsubscribelink"), UNSUBSCRIBE)); drpActions.Items.Add(new ListItem(GetString("newsletter.renewsubscription"), SUBSCRIBE)); drpActions.Items.Add(new ListItem(GetString("newsletter.approvesubscription"), APPROVE)); drpActions.Items.Add(new ListItem(GetString("newsletter.deletesubscription"), REMOVE)); } }
protected void Page_Load(object sender, EventArgs e) { ci = (ContactInfo)EditedObject; this.CheckReadPermission(ci.ContactSiteID); globalContact = (ci.ContactSiteID <= 0); mergedContact = (ci.ContactMergedWithContactID > 0); modifyAllowed = ContactHelper.AuthorizedModifyContact(ci.ContactSiteID, false); contactId = QueryHelper.GetInteger("contactid", 0); string where = null; // Filter only site members in CMSDesk (for global contacts) if (!this.IsSiteManager && globalContact && AuthorizedForSiteContacts) { where += " (ContactSiteID IS NULL OR ContactSiteID=" + CMSContext.CurrentSiteID + ")"; } fltElem.ShowContactNameFilter = globalContact; fltElem.ShowSiteFilter = this.IsSiteManager && globalContact; // Choose correct object ("query") according to type of contact if (globalContact) { gridElem.ObjectType = OnlineMarketingObjectType.MEMBERSHIPGLOBALCUSTOMERLIST; } else if (mergedContact) { gridElem.ObjectType = OnlineMarketingObjectType.MEMBERSHIPMERGEDCUSTOMERLIST; } else { gridElem.ObjectType = OnlineMarketingObjectType.MEMBERSHIPCUSTOMERLIST; } // Query parameters QueryDataParameters parameters = new QueryDataParameters(); parameters.Add("@ContactId", contactId); where = SqlHelperClass.AddWhereCondition(where, fltElem.WhereCondition); gridElem.WhereCondition = where; gridElem.QueryParameters = parameters; gridElem.OnAction += new OnActionEventHandler(gridElem_OnAction); gridElem.OnExternalDataBound += new OnExternalDataBoundEventHandler(gridElem_OnExternalDataBound); // Hide header actions for global contact this.CurrentMaster.HeaderActionsPlaceHolder.Visible = modifyAllowed && !globalContact && !mergedContact; // Setup customer selector try { ucSelectCustomer = (FormEngineUserControl)this.Page.LoadControl("~/CMSModules/Ecommerce/FormControls/CustomerSelector.ascx"); ucSelectCustomer.SetValue("Mode", "OnlineMarketing"); ucSelectCustomer.SetValue("SiteID", ci.ContactSiteID); ucSelectCustomer.Changed += new EventHandler(ucSelectCustomer_Changed); ucSelectCustomer.IsLiveSite = false; pnlSelectCustomer.Controls.Clear(); pnlSelectCustomer.Controls.Add(ucSelectCustomer); } catch { } }
protected void Page_Load(object sender, EventArgs e) { // Check license if (DataHelper.GetNotEmpty(URLHelper.GetCurrentDomain(), "") != "") { LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetCurrentDomain(), FeatureEnum.WebAnalytics); } ucABTests = LoadControl("~/CMSModules/OnlineMarketing/FormControls/SelectABTest.ascx") as FormEngineUserControl; ucMVTests = LoadControl("~/CMSModules/OnlineMarketing/FormControls/SelectMVTest.ascx") as FormEngineUserControl; if (ucABTests != null) { ucABTests.ID = "abTestSelector"; pnlABTests.Controls.Add(ucABTests); } if (ucMVTests != null) { ucMVTests.ID = "mvtSelector"; pnlMVTests.Controls.Add(ucMVTests); } if (!RequestHelper.IsPostBack() && (ucABTests != null) && (ucMVTests != null)) { string[,] fields = new string[2, 2]; fields[0, 0] = GetString("general.pleaseselect"); fields[0, 1] = "pleaseselect"; fields[1, 0] = "(" + GetString("general.all") + ")"; fields[1, 1] = ValidationHelper.GetString(ucABTests.GetValue("AllRecordValue"), String.Empty); ucABTests.SetValue("SpecialFields", fields); ucABTests.Value = "pleaseselect"; ucABTests.SetValue("AllowEmpty", false); ucABTests.SetValue("ReturnColumnName", "ABTestName"); ucMVTests.SetValue("SpecialFields", fields); ucMVTests.Value = "pleaseselect"; ucMVTests.SetValue("AllowEmpty", false); ucMVTests.SetValue("ReturnColumnName", "MVTestName"); usCampaigns.UniSelector.SpecialFields = fields; usCampaigns.Value = "pleaseselect"; } CurrentUserInfo user = CMSContext.CurrentUser; // Check permissions for CMS Desk -> Tools -> Web analytics tab if (!user.IsAuthorizedPerUIElement("CMS.Tools", "WebAnalytics")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Tools", "WebAnalytics"); } // Check 'Read' permission if (!user.IsAuthorizedPerResource("CMS.WebAnalytics", "Read")) { RedirectToCMSDeskAccessDenied("CMS.WebAnalytics", "Read"); } string title = GetString("AnayticsManageData.ManageData"); this.Page.Title = title; this.CurrentMaster.Title.TitleText = title; this.CurrentMaster.Title.TitleImage = GetImageUrl("CMSModules/CMS_Reporting/managedata.png"); // Confirmation message for deleting string deleteFromToMessage = ScriptHelper.GetString(GetString("webanal.deletefromtomsg")); deleteFromToMessage = deleteFromToMessage.Replace("##FROM##", "' + elemFromStr + '"); deleteFromToMessage = deleteFromToMessage.Replace("##TO##", "' + elemToStr + '"); string script = " var elemTo = document.getElementById('" + pickerTo.ClientID + "_txtDateTime'); " + " var elemFrom = document.getElementById('" + pickerFrom.ClientID + "_txtDateTime'); " + " var elemToStr = " + ScriptHelper.GetString(GetString("webanal.now")) + "; " + " var elemFromStr = " + ScriptHelper.GetString(GetString("webanal.beginning")) + "; " + " var deleteAll = 1; " + " if (elemTo.value != '') { deleteAll = 0; elemToStr = elemTo.value; }; " + " if (elemFrom.value != '') { deleteAll = 0; elemFromStr = elemFrom.value; }; " + " if (deleteAll == 1) { return confirm(" + ScriptHelper.GetString(GetString("webanal.deleteall")) + "); } " + " else { return confirm(" + deleteFromToMessage + "); }; "; btnDelete.OnClientClick = script + "; return false;"; statCodeName = QueryHelper.GetString("statCodeName", String.Empty); if (statCodeName == "abtest") { pnlABTestSelector.Visible = true; } if (statCodeName == "mvtest") { pnlMVTSelector.Visible = true; } if (statCodeName == "campaigns") { pnlCampaigns.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { CheckUIElementAccessHierarchical(ModuleName.ONLINEMARKETING, "ContactMembership.Customers"); ci = (ContactInfo)EditedObject; if (ci == null) { RedirectToAccessDenied(GetString("general.invalidparameters")); } CheckReadPermission(ci.ContactSiteID); globalContact = (ci.ContactSiteID <= 0); mergedContact = (ci.ContactMergedWithContactID > 0); modifyAllowed = ContactHelper.AuthorizedModifyContact(ci.ContactSiteID, false); contactId = QueryHelper.GetInteger("contactid", 0); string where = null; // Filter only site members in CMSDesk (for global contacts) if (!IsSiteManager && globalContact && AuthorizedForSiteContacts) { where += " (ContactSiteID IS NULL OR ContactSiteID=" + SiteContext.CurrentSiteID + ")"; } // Choose correct object ("query") according to type of contact if (globalContact) { gridElem.ObjectType = ContactMembershipGlobalCustomerListInfo.OBJECT_TYPE; } else if (mergedContact) { gridElem.ObjectType = ContactMembershipMergedCustomerListInfo.OBJECT_TYPE; } else { gridElem.ObjectType = ContactMembershipCustomerListInfo.OBJECT_TYPE; } // Query parameters QueryDataParameters parameters = new QueryDataParameters(); parameters.Add("@ContactId", contactId); gridElem.WhereCondition = where; gridElem.QueryParameters = parameters; gridElem.OnAction += gridElem_OnAction; gridElem.OnExternalDataBound += gridElem_OnExternalDataBound; // Hide header actions for global contact or merged contact. CurrentMaster.HeaderActionsPlaceHolder.Visible = modifyAllowed && !globalContact && !mergedContact; // Setup customer selector try { ucSelectCustomer = (FormEngineUserControl)Page.LoadUserControl("~/CMSModules/Ecommerce/FormControls/CustomerSelector.ascx"); ucSelectCustomer.SetValue("Mode", "OnlineMarketing"); ucSelectCustomer.SetValue("SiteID", ci.ContactSiteID); ucSelectCustomer.Changed += ucSelectCustomer_Changed; ucSelectCustomer.IsLiveSite = false; pnlSelectCustomer.Controls.Clear(); pnlSelectCustomer.Controls.Add(ucSelectCustomer); } catch { } }
/// <summary> /// Displays contact relation which has more than 1 role. /// </summary> private int DisplayRoleCollisions(int contactID, DataSet relations) { DataRow[] drs = relations.Tables[0].Select("ContactID = " + contactID + " AND ContactRoleID > 0", "ContactRoleID"); // Contact is specified more than once if ((drs != null) && (drs.Length > 1)) { // Find out if contact roles are different ArrayList roleIDs = new ArrayList(); int id; roleIDs.Add(ValidationHelper.GetInteger(drs[0]["ContactRoleID"], 0)); roles.Add(drs[0]["ContactID"], drs[0]["ContactRoleID"]); foreach (DataRow dr in drs) { id = ValidationHelper.GetInteger(dr["ContactRoleID"], 0); if (!roleIDs.Contains(id)) { roleIDs.Add(id); } } // Display relation only for contacts with more roles if (roleIDs.Count > 1) { // Display table first part Literal ltl = new Literal(); string contactName = drs[0]["ContactFirstName"] + " " + drs[0]["ContactMiddleName"]; contactName = contactName.Trim() + " " + drs[0]["ContactLastName"]; ltl.Text = "<tr class=\"CollisionRow\"><td>" + contactName.Trim() + "</td>"; ltl.Text += "<td class=\"ComboBoxColumn\"><div class=\"ComboBox\">"; plcAccountContact.Controls.Add(ltl); // Display role selector FormEngineUserControl roleSelector = Page.LoadControl("~/CMSModules/ContactManagement/FormControls/ContactRoleSelector.ascx") as FormEngineUserControl; roleSelector.SetValue("siteid", parentAccount.AccountSiteID); plcAccountContact.Controls.Add(roleSelector); roleControls.Add(drs[0]["ContactID"], roleSelector); // Display table middle part Literal ltlMiddle = new Literal(); ltlMiddle.Text = "</div></td><td>"; plcAccountContact.Controls.Add(ltlMiddle); // Display icon with tooltip Image imgTooltip = new Image(); AccountContactTooltip(imgTooltip, roleIDs); imgTooltip.ImageUrl = GetImageUrl("CMSModules/CMS_ContactManagement/collision.png"); imgTooltip.Style.Add("cursor", "help"); ScriptHelper.AppendTooltip(imgTooltip, imgTooltip.ToolTip, "help"); plcAccountContact.Controls.Add(imgTooltip); // Display table last part Literal ltlLast = new Literal(); ltlLast.Text = "</td></tr>"; plcAccountContact.Controls.Add(ltlLast); return(1); } } return(0); }
/// <summary> /// Configures selectors. /// </summary> private void SetupSelectors() { // Setup role selector selectRole.CurrentSelector.SelectionMode = SelectionModeEnum.MultipleButton; selectRole.CurrentSelector.OnItemsSelected += RolesSelector_OnItemsSelected; selectRole.CurrentSelector.ReturnColumnName = "RoleID"; selectRole.CurrentSelector.ZeroRowsText = string.Format(GetString("newsletter.subscribers.addroles.nodata"), URLHelper.ResolveUrl(UIContextHelper.GetApplicationUrl("CMS.Roles", "Administration.Roles"))); selectRole.ShowSiteFilter = false; selectRole.CurrentSelector.ResourcePrefix = "addroles"; selectRole.IsLiveSite = false; selectRole.UseCodeNameForSelection = false; selectRole.GlobalRoles = false; // Setup user selector selectUser.SelectionMode = SelectionModeEnum.MultipleButton; selectUser.UniSelector.OnItemsSelected += UserSelector_OnItemsSelected; selectUser.UniSelector.ReturnColumnName = "UserID"; selectUser.UniSelector.DisplayNameFormat = "{%FullName%} ({%Email%})"; selectUser.UniSelector.AdditionalSearchColumns = "UserName, Email"; selectUser.UniSelector.ZeroRowsText = string.Format(GetString("newsletter.subscribers.addusers.nodata"), URLHelper.ResolveUrl(UIContextHelper.GetApplicationUrl("CMS.Users", "Administration.Users"))); selectUser.WhereCondition = new WhereCondition().WhereNotEmpty("Email").ToString(true); selectUser.ShowSiteFilter = false; selectUser.ResourcePrefix = "newsletteraddusers"; selectUser.IsLiveSite = false; // Setup subscriber selector selectSubscriber.UniSelector.SelectionMode = SelectionModeEnum.MultipleButton; selectSubscriber.UniSelector.OnItemsSelected += SubscriberSelector_OnItemsSelected; selectSubscriber.UniSelector.ReturnColumnName = "SubscriberID"; selectSubscriber.UniSelector.ZeroRowsText = string.Format(GetString("newsletter.subscribers.addsubscribers.nodata"), URLHelper.ResolveUrl(UIContextHelper.GetApplicationUrl(ModuleName.NEWSLETTER, "Newsletter", "?tabname=AllSubscribers"))); selectSubscriber.ShowSiteFilter = false; selectSubscriber.IsLiveSite = false; selectSubscriber.UniSelector.RemoveMultipleCommas = true; // Setup contact group and contact selectors if (ModuleEntryManager.IsModuleLoaded(ModuleName.ONLINEMARKETING) && LicenseHelper.CheckFeature(RequestContext.CurrentDomain, FeatureEnum.ContactManagement)) { plcSelectCG.Controls.Clear(); // Check read permission for contact groups if (MembershipContext.AuthenticatedUser.IsAuthorizedPerResource(ModuleName.CONTACTMANAGEMENT, "ReadContactGroups")) { // Load selector control and initialize it cgSelector = (FormEngineUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/FormControls/ContactGroupSelector.ascx"); if (cgSelector != null) { cgSelector.ID = "selectCG"; cgSelector.ShortID = "scg"; // Get inner uniselector control UniSelector selector = (UniSelector)cgSelector.GetValue("uniselector"); if (selector != null) { // Bind an event handler on 'items selected' event selector.OnItemsSelected += CGSelector_OnItemsSelected; selector.ResourcePrefix = "contactgroupsubscriber"; selector.ZeroRowsText = string.Format(GetString("newsletter.subscribers.addcontactgroups.nodata"), URLHelper.ResolveUrl(UIContextHelper.GetApplicationUrl(ModuleName.ONLINEMARKETING, "ContactGroups"))); } // Insert selector to the header plcSelectCG.Controls.Add(cgSelector); } } // Check read permission for contacts if (MembershipContext.AuthenticatedUser.IsAuthorizedPerResource(ModuleName.CONTACTMANAGEMENT, "ReadContacts")) { // Load selector control and initialize it cSelector = (FormEngineUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/FormControls/ContactSelector.ascx"); if (cSelector != null) { cSelector.ID = "slContact"; cSelector.ShortID = "sc"; // Set where condition to filter contacts with email addresses cSelector.SetValue("wherecondition", "NOT (ContactEmail IS NULL OR ContactEmail LIKE '')"); // Set site ID cSelector.SetValue("siteid", SiteContext.CurrentSiteID); // Get inner uniselector control UniSelector selector = (UniSelector)cSelector.GetValue("uniselector"); if (selector != null) { // Bind an event handler on 'items selected' event selector.OnItemsSelected += ContactSelector_OnItemsSelected; selector.SelectionMode = SelectionModeEnum.MultipleButton; selector.ResourcePrefix = "contactsubscriber"; selector.DisplayNameFormat = "{%ContactFirstName%} {%ContactLastName%} ({%ContactEmail%})"; selector.AdditionalSearchColumns = "ContactFirstName,ContactMiddleName,ContactEmail"; selector.ZeroRowsText = string.Format(GetString("newsletter.subscribers.addcontacts.nodata"), URLHelper.ResolveUrl(UIContextHelper.GetApplicationUrl(ModuleName.ONLINEMARKETING, "ContactsFrameset", "?tabname=contacts"))); } // Insert selector to the header plcSelectCG.Controls.Add(cSelector); } } } // Setup persona selectors if (ModuleEntryManager.IsModuleLoaded(ModuleName.PERSONAS) && LicenseHelper.CheckFeature(RequestContext.CurrentDomain, FeatureEnum.Personas)) { // Check read permission for contact groups if (MembershipContext.AuthenticatedUser.IsAuthorizedPerResource(ModuleName.PERSONAS, "Read")) { // Load selector control and initialize it personaSelector = (UniSelector)Page.LoadUserControl("~/CMSAdminControls/UI/Uniselector/Uniselector.ascx"); if (personaSelector != null) { personaSelector.ID = "personaSelector"; personaSelector.ShortID = "ps"; personaSelector.ObjectType = PredefinedObjectType.PERSONA; personaSelector.ReturnColumnName = "PersonaID"; personaSelector.WhereCondition = "PersonaSiteID = " + SiteContext.CurrentSiteID; personaSelector.SelectionMode = SelectionModeEnum.MultipleButton; personaSelector.DisplayNameFormat = "{%PersonaDisplayName%}"; personaSelector.ResourcePrefix = "personasubscriber"; personaSelector.IsLiveSite = false; personaSelector.ZeroRowsText = string.Format(GetString("newsletter.subscribers.addpersonas.nodata"), URLHelper.ResolveUrl(UIContextHelper.GetApplicationUrl(ModuleName.PERSONAS, "Personas"))); // Bind an event handler on 'items selected' event personaSelector.OnItemsSelected += PersonaSelector_OnItemsSelected; // Add selector to the header plcSelectCG.Controls.Add(personaSelector); } } } // Initialize mass actions if (drpActions.Items.Count == 0) { drpActions.Items.Add(new ListItem(GetString("general.selectaction"), SELECT)); drpActions.Items.Add(new ListItem(GetString("newsletter.approvesubscription"), APPROVE)); drpActions.Items.Add(new ListItem(GetString("newsletter.deletesubscription"), REMOVE)); } }
/// <summary> /// Gets FormEngineUserControl instance for the input SettingsKeyInfo object. /// </summary> /// <param name="key">SettingsKeyInfo</param> /// <param name="groupNo">Number representing index of the processing settings group</param> /// <param name="keyNo">Number representing index of the processing SettingsKeyInfo</param> private FormEngineUserControl GetFormEngineUserControl(SettingsKeyInfo key, int groupNo, int keyNo) { if (string.IsNullOrEmpty(key.KeyEditingControlPath)) { return(null); } // Try to get form control by its name FormEngineUserControl control = null; var formUserControl = FormUserControlInfoProvider.GetFormUserControlInfo(key.KeyEditingControlPath); if (formUserControl != null) { var fileName = ""; var formProperties = ""; if (formUserControl.UserControlParentID > 0) { // Get parent user control var parentFormUserControl = FormUserControlInfoProvider.GetFormUserControlInfo(formUserControl.UserControlParentID); if (parentFormUserControl != null) { fileName = parentFormUserControl.UserControlFileName; formProperties = formUserControl.UserControlMergedParameters; } } else { // Current user control info fileName = formUserControl.UserControlFileName; formProperties = formUserControl.UserControlParameters; } // Create FormInfo and load control control = Page.LoadUserControl(fileName) as FormEngineUserControl; if (control != null) { FormInfo fi = FormHelper.GetFormControlParameters(formUserControl.UserControlCodeName, formProperties, true); control.LoadDefaultProperties(fi); if (!string.IsNullOrEmpty(key.KeyFormControlSettings)) { control.FieldInfo = FormHelper.GetFormControlSettingsFromXML(key.KeyFormControlSettings); control.LoadControlFromFFI(); } } } else { // Try to load the control try { control = Page.LoadUserControl(key.KeyEditingControlPath) as FormEngineUserControl; } catch { } } if (control == null) { return(null); } control.ID = string.Format(@"key{0}{1}", groupNo, keyNo); control.IsLiveSite = false; if (string.IsNullOrEmpty(key.KeyEditingControlPath)) { return(control); } // Set properties to the specific controls switch (key.KeyEditingControlPath.ToLowerCSafe()) { // Class names selectors case "~/cmsformcontrols/classes/selectclassnames.ascx": control.SetValue("SiteID", 0); break; } return(control); }
protected void Page_Load(object sender, EventArgs e) { CheckUIElementAccessHierarchical(ModuleName.ONLINEMARKETING, "ContactMembership.Customers"); ci = (ContactInfo)EditedObject; if (ci == null) { RedirectToAccessDenied(GetString("general.invalidparameters")); } CheckReadPermission(ci.ContactSiteID); globalContact = (ci.ContactSiteID <= 0); mergedContact = (ci.ContactMergedWithContactID > 0); modifyAllowed = ContactHelper.AuthorizedModifyContact(ci.ContactSiteID, false); contactId = QueryHelper.GetInteger("contactid", 0); string where = null; // Filter only site members in CMSDesk (for global contacts) if (!IsSiteManager && globalContact && AuthorizedForSiteContacts) { where += " (ContactSiteID IS NULL OR ContactSiteID=" + SiteContext.CurrentSiteID + ")"; } // Choose correct object ("query") according to type of contact if (globalContact) { gridElem.ObjectType = ContactMembershipGlobalCustomerListInfo.OBJECT_TYPE; } else if (mergedContact) { gridElem.ObjectType = ContactMembershipMergedCustomerListInfo.OBJECT_TYPE; } else { gridElem.ObjectType = ContactMembershipCustomerListInfo.OBJECT_TYPE; } // Query parameters QueryDataParameters parameters = new QueryDataParameters(); parameters.Add("@ContactId", contactId); gridElem.WhereCondition = where; gridElem.QueryParameters = parameters; gridElem.OnAction += gridElem_OnAction; gridElem.OnExternalDataBound += gridElem_OnExternalDataBound; // Hide header actions for global contact or merged contact. CurrentMaster.HeaderActionsPlaceHolder.Visible = modifyAllowed && !globalContact && !mergedContact; // Setup customer selector try { ucSelectCustomer = (FormEngineUserControl)Page.LoadUserControl("~/CMSModules/Ecommerce/FormControls/CustomerSelector.ascx"); ucSelectCustomer.SetValue("Mode", "OnlineMarketing"); ucSelectCustomer.SetValue("SiteID", ci.ContactSiteID); ucSelectCustomer.Changed += ucSelectCustomer_Changed; ucSelectCustomer.IsLiveSite = false; pnlSelectCustomer.Controls.Clear(); pnlSelectCustomer.Controls.Add(ucSelectCustomer); } catch { } }
protected void Page_Load(object sender, EventArgs e) { // Required field validator error messages initialization rfvAnswerText.ErrorMessage = GetString("Polls_Answer_Edit.AnswerTextError"); // Controls initializations lblAnswerText.Text = GetString("Polls_Answer_Edit.AnswerTextLabel"); lblVotes.Text = GetString("Polls_Answer_Edit.Votes"); // Set if it is live site txtAnswerText.IsLiveSite = IsLiveSite; // Load BizForm selector if BizForms module is available if (ModuleEntry.IsModuleLoaded(ModuleEntry.BIZFORM) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleEntry.BIZFORM, CMSContext.CurrentSiteName)) { bizFormElem = (FormEngineUserControl)Page.LoadUserControl("~/CMSModules/BizForms/FormControls/SelectBizForm.ascx"); bizFormElem.ShortID = "bizFormElem"; bizFormElem.SetValue("ShowSiteFilter", false); plcBizFormSelector.Controls.Add(bizFormElem); bizFormElem.Visible = true; UniSelector uniSelector = bizFormElem.GetValue("UniSelector") as UniSelector; if (uniSelector != null) { uniSelector.OnSelectionChanged += new EventHandler(BizFormSelector_OnSelectionChanged); } } if (!RequestHelper.IsPostBack() && !IsLiveSite) { LoadData(); } }
/// <summary> /// Adds new row into result table. /// </summary> private void AddRow(bool isDefaultCulture, ref int rowCount, TableRow row, TableCell cellText, TableCell cellValue, FormEngineUserControl control, Control c, DataRow dr) { string cultureName = HTMLHelper.HTMLEncode(ValidationHelper.GetString(dr["UICultureName"], null)); string cultureCode = ValidationHelper.GetString(dr["UICultureCode"], null); if ((cultureCode.ToLowerCSafe() != CultureHelper.DefaultUICulture) || isDefaultCulture) { // Create new row row = new TableRow(); row.CssClass = (rowCount % 2 == 0) ? "OddRow" : "EvenRow"; rowCount++; // Create cell with culture name cellText = new TableCell(); cellText.Text = "<img class=\"Image16\" style=\"vertical-align:middle;\" src=\"" + UIHelper.GetFlagIconUrl(Page, ValidationHelper.GetString(dr["UICultureCode"], null), "16x16") + "\" alt=\"" + cultureName + "\" /> " + cultureName; if (isDefaultCulture) { cellText.Text += " " + GetString("general.defaultchoice"); } row.Cells.Add(cellText); // Create cell with translation text cellValue = new TableCell(); control = null; c = Page.LoadUserControl("~/CMSFormControls/Inputs/LargeTextArea.ascx"); cellValue.Controls.Add(c); row.Cells.Add(cellValue); tblGrid.Rows.Add(row); c.ID = cultureCode; if (c.ID == CultureHelper.DefaultUICulture) { defaultCultureName = cellText.Text; } if (c is FormEngineUserControl) { control = (FormEngineUserControl)c; control.Value = ValidationHelper.GetString(dr["TranslationText"], null); if (!isDefaultCulture) { control.SetValue("AllowTranslationServices", true); control.SetValue("TranslationSourceLanguage", CultureHelper.DefaultUICulture); control.SetValue("TranslationTargetLanguage", cultureCode); control.SetValue("TranslationSourceText", ResHelper.GetString(ValidationHelper.GetString(dr["StringKey"], ""), CultureHelper.DefaultUICulture)); } translations[dr["UICultureCode"]] = control; } } }
protected void Page_Load(object sender, EventArgs e) { // Register the scripts ScriptHelper.RegisterProgress(this.Page); ScriptHelper.RegisterTooltip(this.Page); ScriptHelper.RegisterDialogScript(this); // Set user control properties usrOwner = this.Page.LoadControl("~/CMSModules/Membership/FormControls/Users/selectuser.ascx") as FormEngineUserControl; usrOwner.ID = "ctrlUsrOwner"; usrOwner.IsLiveSite = false; usrOwner.SetValue("ShowSiteFilter", false); usrOwner.StopProcessing = this.pnlUIOwner.IsHidden; plcUsrOwner.Controls.Add(usrOwner); UIContext.PropertyTab = PropertyTabEnum.General; nodeId = QueryHelper.GetInteger("nodeid", 0); // Init strings pnlDesign.GroupingText = GetString("GeneralProperties.DesignGroup"); pnlCache.GroupingText = GetString("GeneralProperties.CacheGroup"); pnlOther.GroupingText = GetString("GeneralProperties.OtherGroup"); pnlAdvanced.GroupingText = GetString("GeneralProperties.AdvancedGroup"); pnlOwner.GroupingText = GetString("GeneralProperties.OwnerGroup"); // Advanced section mEditableContent = GetString("GeneralProperties.EditableContent"); mForums = GetString("PageProperties.AdHocForum"); mMessageBoards = GetString("PageProperties.MessageBoards"); lnkEditableContent.OnClientClick = "ShowEditableContent(); return false;"; lnkMessageBoards.OnClientClick = "ShowMessageBoards(); return false;"; lnkForums.OnClientClick = "ShowForums(); return false;"; imgEditableContent.ImageUrl = GetImageUrl("CMSModules/CMS_Content/EditableContent/editablecontent.png"); imgMessageBoards.ImageUrl = GetImageUrl("CMSModules/CMS_MessageBoards/module.png"); imgForums.ImageUrl = GetImageUrl("CMSModules/CMS_Forums/module.png"); // Get strings for radio buttons radInherit.Text = GetString("GeneralProperties.radInherit"); radYes.Text = GetString("general.yes"); radNo.Text = GetString("general.no"); lblCacheMinutes.Text = GetString("GeneralProperties.cacheMinutes"); // Get strings for labels lblNameTitle.Text = GetString("GeneralProperties.Name"); lblNamePathTitle.Text = GetString("GeneralProperties.NamePath"); lblAliasPathTitle.Text = GetString("GeneralProperties.AliasPath"); lblTypeTitle.Text = GetString("GeneralProperties.Type"); lblNodeIDTitle.Text = GetString("GeneralProperties.NodeID"); lblLastModifiedByTitle.Text = GetString("GeneralProperties.LastModifiedBy"); lblLastModifiedTitle.Text = GetString("GeneralProperties.LastModified"); lblLiveURLTitle.Text = GetString("GeneralProperties.LiveURL"); lblPreviewURLTitle.Text = GetString("GeneralProperties.PreviewURL"); lblGUIDTitle.Text = GetString("GeneralProperties.GUID"); lblDocGUIDTitle.Text = GetString("GeneralProperties.DocumentGUID"); lblDocIDTitle.Text = GetString("GeneralProperties.DocumentID"); lblCultureTitle.Text = GetString("GeneralProperties.Culture"); lblCreatedByTitle.Text = GetString("GeneralProperties.CreatedBy"); lblCreatedTitle.Text = GetString("GeneralProperties.Created"); lblOwnerTitle.Text = GetString("GeneralProperties.Owner"); lblCssStyle.Text = GetString("PageProperties.CssStyle"); lblPublishedTitle.Text = GetString("PageProperties.Published"); chkExcludeFromSearch.Text = GetString("GeneralProperties.ExcludeFromSearch"); chkCssStyle.Text = GetString("Metadata.Inherit"); pnlOnlineMarketing.GroupingText = GetString("general.onlinemarketing"); // Set default item value string defaultStyleSheet = "-1"; CssStylesheetInfo cssInfo = CMSContext.CurrentSiteStylesheet; // If current site default stylesheet defined, choose it if (cssInfo != null) { defaultStyleSheet = "default"; } ctrlSiteSelectStyleSheet.CurrentSelector.SpecialFields = new string[1, 2] { { GetString("general.defaultchoice"), defaultStyleSheet } }; ctrlSiteSelectStyleSheet.ReturnColumnName = "StyleSheetID"; ctrlSiteSelectStyleSheet.SiteId = CMSContext.CurrentSiteID; if (CMSContext.CurrentSite != null) { usrOwner.SetValue("SiteID", CMSContext.CurrentSite.SiteID); } // Initialize Save button imgSave.ImageUrl = GetImageUrl("CMSModules/CMS_Content/EditMenu/save.png"); mSave = GetString("general.save"); int documentId = 0; // Get the document TreeProvider tree = new TreeProvider(CMSContext.CurrentUser); node = tree.SelectSingleNode(nodeId, CMSContext.PreferredCultureCode, false); // Redirect to page 'New culture version' in split mode. It must be before setting EditedDocument. if ((node == null) && displaySplitMode) { URLHelper.Redirect("~/CMSModules/Content/CMSDesk/New/NewCultureVersion.aspx" + URLHelper.Url.Query); } // Set edited document EditedDocument = node; if (node != null) { documentId = node.DocumentID; canEditOwner = (CMSContext.CurrentUser.IsAuthorizedPerDocument(node, NodePermissionsEnum.ModifyPermissions) == AuthorizationResultEnum.Allowed); ReloadData(); } // Generate executive script string script = "function ShowEditableContent() { modalDialog('" + ResolveUrl("Advanced/EditableContent/default.aspx") + "?nodeid=" + nodeId + "', 'EditableContent', 1015, 700); } \n"; if (hasAdHocBoard) { plcAdHocBoards.Visible = true; script += "function ShowMessageBoards() { modalDialog('" + ResolveUrl("~/CMSModules/MessageBoards/Content/Properties/default.aspx") + "?documentid=" + documentId + "', 'MessageBoards', 1020, 680); } \n"; } if (hasAdHocForum) { plcAdHocForums.Visible = true; script += "function ShowForums() { modalDialog('" + ResolveUrl("~/CMSModules/Forums/Content/Properties/default.aspx") + "?documentid=" + documentId + "', 'Forums', 1130, 680); } \n"; } ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ModalDialogsToAdvancedSection", ScriptHelper.GetScript(script)); // Register js synchronization script for split mode if (displaySplitMode) { RegisterSplitModeSync(true, false); } }
/// <summary> /// OnInit event. /// </summary> protected override void OnInit(EventArgs e) { int querySiteID = QueryHelper.GetInteger("siteid", 0); // Do not allow other than current site ID out of global scope. SiteID = UIContextHelper.IsInGlobalApplicationScope(UIContext.UIElement) ? querySiteID : SiteContext.CurrentSiteID; if (File.Exists(HttpContext.Current.Request.MapPath(ResolveUrl(pathToGroupselector)))) { Control ctrl = LoadUserControl(pathToGroupselector); if (ctrl != null) { selectInGroups = ctrl as FormEngineUserControl; ctrl.ID = "selGroups"; ctrl = LoadUserControl(pathToGroupselector); selectNotInGroups = ctrl as FormEngineUserControl; ctrl.ID = "selNoGroups"; plcGroups.Visible = true; plcSelectInGroups.Controls.Add(selectInGroups); plcSelectNotInGroups.Controls.Add(selectNotInGroups); selectNotInGroups.SetValue("UseFriendlyMode", true); selectInGroups.IsLiveSite = false; selectInGroups.SetValue("UseFriendlyMode", true); selectNotInGroups.IsLiveSite = false; } } if (DisplayScore && SettingsKeyInfoProvider.GetBoolValue(SiteContext.CurrentSiteName + ".CMSEnableOnlineMarketing")) { Control ctrl = LoadUserControl(pathToScoreSelector); if (ctrl != null) { ctrl.ID = "selectScore"; scoreSelector = ctrl as FormEngineUserControl; if (scoreSelector != null) { plcUpdateContent.Controls.Add(scoreSelector); scoreSelector.SetValue("AllowAll", false); scoreSelector.SetValue("AllowEmpty", true); } } } else { plcScore.Visible = false; lblScore.AssociatedControlID = null; } // Initialize advanced filter dropdownlists if (!RequestHelper.IsPostBack()) { InitAllAnyDropDown(drpTypeSelectInRoles); InitAllAnyDropDown(drpTypeSelectNotInRoles); InitAllAnyDropDown(drpTypeSelectInGroups); InitAllAnyDropDown(drpTypeSelectNotInGroups); // Init lock account reason DDL drpLockReason.Items.Add(new ListItem(GetString("General.selectall"), "")); ControlsHelper.FillListControlWithEnum <UserAccountLockEnum>(drpLockReason, "userlist.account"); } base.OnInit(e); plcDisplayAnonymous.Visible = ContactManagementPermission && SessionManager.StoreOnlineUsersInDatabase && EnableDisplayingGuests; if (!RequestHelper.IsPostBack()) { chkDisplayAnonymous.Checked = DisplayGuestsByDefault; } siteSelector.DropDownSingleSelect.AutoPostBack = true; }
protected void Page_Load(object sender, EventArgs e) { ci = (ContactInfo)EditedObject; this.CheckReadPermission(ci.ContactSiteID); globalContact = (ci.ContactSiteID <= 0); mergedContact = (ci.ContactMergedWithContactID > 0); modifyAllowed = ContactHelper.AuthorizedModifyContact(ci.ContactSiteID, false); contactId = QueryHelper.GetInteger("contactid", 0); string where = null; // Filter only site members in CMSDesk (for global contacts) if (!this.IsSiteManager && globalContact && AuthorizedForSiteContacts) { where += " (ContactSiteID IS NULL OR ContactSiteID=" + CMSContext.CurrentSiteID + ")"; } fltElem.ShowContactNameFilter = globalContact; fltElem.ShowSiteFilter = this.IsSiteManager && globalContact; // Choose correct object ("query") according to type of contact if (globalContact) { gridElem.ObjectType = OnlineMarketingObjectType.MEMBERSHIPGLOBALCUSTOMERLIST; } else if (mergedContact) { gridElem.ObjectType = OnlineMarketingObjectType.MEMBERSHIPMERGEDCUSTOMERLIST; } else { gridElem.ObjectType = OnlineMarketingObjectType.MEMBERSHIPCUSTOMERLIST; } // Query parameters QueryDataParameters parameters = new QueryDataParameters(); parameters.Add("@ContactId", contactId); where = SqlHelperClass.AddWhereCondition(where, fltElem.WhereCondition); gridElem.WhereCondition = where; gridElem.QueryParameters = parameters; gridElem.OnAction += new OnActionEventHandler(gridElem_OnAction); gridElem.OnExternalDataBound += new OnExternalDataBoundEventHandler(gridElem_OnExternalDataBound); // Hide header actions for global contact this.CurrentMaster.HeaderActionsPlaceHolder.Visible = modifyAllowed && !globalContact && !mergedContact; // Setup customer selector try { ucSelectCustomer = (FormEngineUserControl)this.Page.LoadControl("~/CMSModules/Ecommerce/FormControls/CustomerSelector.ascx"); ucSelectCustomer.SetValue("Mode", "OnlineMarketing"); ucSelectCustomer.SetValue("SiteID", ci.ContactSiteID); ucSelectCustomer.Changed += new EventHandler(ucSelectCustomer_Changed); ucSelectCustomer.IsLiveSite = false; pnlSelectCustomer.Controls.Clear(); pnlSelectCustomer.Controls.Add(ucSelectCustomer); } catch { } }
/// <summary> /// Initializes group selector. /// </summary> private void InitializeGroupSelector() { if (groupsSelector == null) { try { groupsSelector = LoadControl(controlPath) as FormEngineUserControl; // Set up selector groupsSelector.ID = "dialogsGroupSelector"; groupsSelector.SetValue("DisplayCurrentGroup", false); groupsSelector.SetValue("SiteID", 0); groupsSelector.IsLiveSite = IsLiveSite; groupsSelector.Changed += groupSelector_Changed; // Get uniselector and set it up UniSelector us = groupsSelector.GetValue("CurrentSelector") as UniSelector; if (us != null) { us.ReturnColumnName = "GroupID"; } // Get dropdownlist and set it up DropDownList drpGroups = groupsSelector.GetValue("CurrentDropDown") as DropDownList; if (drpGroups != null) { drpGroups.AutoPostBack = true; } // Add control to panel pnlGroupSelector.Controls.Add(groupsSelector); } catch(HttpException) { // Couldn't load the control plcGroupSelector.Visible = false; } } }
/// <summary> /// OnInit event. /// </summary> protected override void OnInit(EventArgs e) { SiteID = QueryHelper.GetInteger("siteid", 0); if (File.Exists(HttpContext.Current.Request.MapPath(ResolveUrl(pathToGroupselector)))) { Control ctrl = LoadUserControl(pathToGroupselector); if (ctrl != null) { selectInGroups = ctrl as FormEngineUserControl; ctrl.ID = "selGroups"; ctrl = LoadUserControl(pathToGroupselector); selectNotInGroups = ctrl as FormEngineUserControl; ctrl.ID = "selNoGroups"; plcGroups.Visible = true; plcSelectInGroups.Controls.Add(selectInGroups); plcSelectNotInGroups.Controls.Add(selectNotInGroups); selectNotInGroups.SetValue("UseFriendlyMode", true); selectInGroups.IsLiveSite = false; selectInGroups.SetValue("UseFriendlyMode", true); selectNotInGroups.IsLiveSite = false; } } if (DisplayScore && SettingsKeyInfoProvider.GetBoolValue(SiteContext.CurrentSiteName + ".CMSEnableOnlineMarketing")) { Control ctrl = LoadUserControl(pathToScoreSelector); if (ctrl != null) { ctrl.ID = "selectScore"; scoreSelector = ctrl as FormEngineUserControl; if (scoreSelector != null) { plcUpdateContent.Controls.Add(scoreSelector); scoreSelector.SetValue("AllowAll", false); scoreSelector.SetValue("AllowEmpty", true); } } } else { plcScore.Visible = false; lblScore.AssociatedControlID = null; } // Initialize advanced filter dropdownlists if (!RequestHelper.IsPostBack()) { InitAllAnyDropDown(drpTypeSelectInRoles); InitAllAnyDropDown(drpTypeSelectNotInRoles); InitAllAnyDropDown(drpTypeSelectInGroups); InitAllAnyDropDown(drpTypeSelectNotInGroups); // Init lock account reason DDL drpLockReason.Items.Add(new ListItem(GetString("General.selectall"), "")); ControlsHelper.FillListControlWithEnum<UserAccountLockEnum>(drpLockReason, "userlist.account"); } base.OnInit(e); plcDisplayAnonymous.Visible = ContactManagementPermission && SessionManager.StoreOnlineUsersInDatabase && EnableDisplayingGuests; if (!RequestHelper.IsPostBack()) { chkDisplayAnonymous.Checked = DisplayGuestsByDefault; } siteSelector.DropDownSingleSelect.AutoPostBack = true; }
protected override void OnInit(EventArgs e) { SiteID = QueryHelper.GetInteger("siteid", 0); if (File.Exists(HttpContext.Current.Request.MapPath(ResolveUrl(pathToGroupselector)))) { Control ctrl = this.LoadUserControl(pathToGroupselector); if (ctrl != null) { selectInGroups = ctrl as FormEngineUserControl; ctrl.ID = "selGroups"; ctrl = this.LoadUserControl(pathToGroupselector); selectNotInGroups = ctrl as FormEngineUserControl; ctrl.ID = "selNoGroups"; plcGroups.Visible = true; plcSelectInGroups.Controls.Add(selectInGroups); plcSelectNotInGroups.Controls.Add(selectNotInGroups); selectNotInGroups.SetValue("UseFriendlyMode", true); selectInGroups.IsLiveSite = false; selectInGroups.SetValue("UseFriendlyMode", true); selectNotInGroups.IsLiveSite = false; } } if (LicenseHelper.CheckFeature(URLHelper.GetCurrentDomain(), FeatureEnum.LeadScoring) && ResourceSiteInfoProvider.IsResourceOnSite("CMS.Scoring", CMSContext.CurrentSiteName) && SettingsKeyProvider.GetBoolValue(CMSContext.CurrentSiteName + ".CMSEnableOnlineMarketing")) { Control ctrl = this.LoadUserControl(pathToScoreSelector); if (ctrl != null) { ctrl.ID = "selectScore"; scoreSelector = ctrl as FormEngineUserControl; if (scoreSelector != null) { plcUpdateContent.Controls.Add(scoreSelector); scoreSelector.SetValue("AllowAll", false); scoreSelector.SetValue("AllowEmpty", true); } } } else { plcScore.Visible = false; lblScore.AssociatedControlID = null; } CMSUsersPage usersPage = (CMSUsersPage)Page; if (usersPage != null) { CurrentMode = usersPage.FilterMode; EnableDisplayingGuests = usersPage.EnableDisplayingGuests; if (CurrentMode == "online" && usersPage.DisplayContacts) { if (usersPage.DisplayScore && (scoreSelector != null)) { plcScore.Visible = true; } } } // Initialize advanced filter dropdownlists if (!RequestHelper.IsPostBack()) { InitAllAnyDropDown(drpTypeSelectInRoles); InitAllAnyDropDown(drpTypeSelectNotInRoles); InitAllAnyDropDown(drpTypeSelectInGroups); InitAllAnyDropDown(drpTypeSelectNotInGroups); // Init lock account reason DDL drpLockReason.Items.Add(new ListItem(GetString("General.selectall"), "")); DataHelper.FillListControlWithEnum(typeof(UserAccountLockEnum), drpLockReason, "userlist.account.", null); } base.OnInit(e); plcDisplayAnonymous.Visible = ContactManagementPermission && SessionManager.StoreOnlineUsersInDatabase && EnableDisplayingGuests; if (!RequestHelper.IsPostBack()) { chkDisplayAnonymous.Checked = DisplayGuestsByDefault; } siteSelector.DropDownSingleSelect.AutoPostBack = true; }
protected void Page_Load(object sender, EventArgs e) { UIContext.PropertyTab = PropertyTabEnum.General; // Register the scripts ScriptHelper.RegisterProgress(Page); ScriptHelper.RegisterTooltip(Page); ScriptHelper.RegisterDialogScript(this); // Set user control properties usrOwner = Page.LoadUserControl("~/CMSModules/Membership/FormControls/Users/selectuser.ascx") as FormEngineUserControl; if (usrOwner != null) { usrOwner.ID = "ctrlUsrOwner"; usrOwner.IsLiveSite = false; usrOwner.SetValue("ShowSiteFilter", false); usrOwner.StopProcessing = pnlUIOwner.IsHidden; plcUsrOwner.Controls.Add(usrOwner); } // Init strings pnlDesign.GroupingText = GetString("GeneralProperties.DesignGroup"); pnlCache.GroupingText = GetString("GeneralProperties.CacheGroup"); pnlOther.GroupingText = GetString("GeneralProperties.OtherGroup"); pnlAdvanced.GroupingText = GetString("GeneralProperties.AdvancedGroup"); pnlOwner.GroupingText = GetString("GeneralProperties.OwnerGroup"); // Advanced section mEditableContent = GetString("GeneralProperties.EditableContent"); mForums = GetString("PageProperties.AdHocForum"); mMessageBoards = GetString("PageProperties.MessageBoards"); lnkEditableContent.OnClientClick = "ShowEditableContent(); return false;"; lnkMessageBoards.OnClientClick = "ShowMessageBoards(); return false;"; lnkForums.OnClientClick = "ShowForums(); return false;"; imgEditableContent.ImageUrl = GetImageUrl("CMSModules/CMS_Content/EditableContent/editablecontent.png"); imgMessageBoards.ImageUrl = GetImageUrl("CMSModules/CMS_MessageBoards/module.png"); imgForums.ImageUrl = GetImageUrl("CMSModules/CMS_Forums/module.png"); // Get strings for radio buttons lblCacheMinutes.Text = GetString("GeneralProperties.cacheMinutes"); // Get strings for labels lblNameTitle.Text = GetString("GeneralProperties.Name"); lblNamePathTitle.Text = GetString("GeneralProperties.NamePath"); lblAliasPathTitle.Text = GetString("GeneralProperties.AliasPath"); lblTypeTitle.Text = GetString("GeneralProperties.Type"); lblNodeIDTitle.Text = GetString("GeneralProperties.NodeID"); lblLastModifiedByTitle.Text = GetString("GeneralProperties.LastModifiedBy"); lblLastModifiedTitle.Text = GetString("GeneralProperties.LastModified"); lblLiveURLTitle.Text = GetString("GeneralProperties.LiveURL"); lblPreviewURLTitle.Text = GetString("GeneralProperties.PreviewURL"); lblGUIDTitle.Text = GetString("GeneralProperties.GUID"); lblDocGUIDTitle.Text = GetString("GeneralProperties.DocumentGUID"); lblDocIDTitle.Text = GetString("GeneralProperties.DocumentID"); lblCultureTitle.Text = GetString("GeneralProperties.Culture"); lblCreatedByTitle.Text = GetString("GeneralProperties.CreatedBy"); lblCreatedTitle.Text = GetString("GeneralProperties.Created"); lblOwnerTitle.Text = GetString("GeneralProperties.Owner"); lblCssStyle.Text = GetString("PageProperties.CssStyle"); lblPublishedTitle.Text = GetString("PageProperties.Published"); chkCssStyle.Text = GetString("Metadata.Inherit"); pnlOnlineMarketing.GroupingText = GetString("general.onlinemarketing"); // Set default item value string defaultStyleSheet = "-1"; CssStylesheetInfo cssInfo = CMSContext.CurrentSiteStylesheet; // If current site default style sheet defined, choose it if (cssInfo != null) { defaultStyleSheet = "default"; } ctrlSiteSelectStyleSheet.CurrentSelector.SpecialFields = new string[,] { { GetString("general.defaultchoice"), defaultStyleSheet } }; ctrlSiteSelectStyleSheet.ReturnColumnName = "StyleSheetID"; ctrlSiteSelectStyleSheet.SiteId = CMSContext.CurrentSiteID; if ((CMSContext.CurrentSite != null) && (usrOwner != null)) { usrOwner.SetValue("SiteID", CMSContext.CurrentSite.SiteID); } int documentId = 0; string script = null; TreeNode node = Node; if (node != null) { // Create wireframe option if (node.NodeWireframeTemplateID <= 0) { mWireframe = GetString("Wireframe.Create"); string createUrl = URLHelper.ResolveUrl(String.Format("~/CMSModules/Content/CMSDesk/Properties/CreateWireframe.aspx?nodeid={0}&culture={1}", node.NodeID, node.DocumentCulture)); lnkWireframe.OnClientClick = "parent.location.replace('" + createUrl + "'); return false;"; imgWireframe.ImageUrl = GetImageUrl("CMSModules/CMS_Content/EditMenu/createwireframe.png"); } else { mWireframe = GetString("Wireframe.Remove"); imgWireframe.ImageUrl = GetImageUrl("CMSModules/CMS_Content/EditMenu/removewireframe.png"); lnkWireframe.OnClientClick = "return confirm('" + GetString("Wireframe.ConfirmRemove") + "')"; lnkWireframe.Click += new EventHandler(lnkWireframe_Click); } plcWireframe.Visible = PortalHelper.IsWireframingEnabled(CMSContext.CurrentSiteName); documentId = node.DocumentID; canEditOwner = (CMSContext.CurrentUser.IsAuthorizedPerDocument(Node, NodePermissionsEnum.ModifyPermissions) == AuthorizationResultEnum.Allowed); ctrlSiteSelectStyleSheet.AliasPath = node.NodeAliasPath; ReloadData(); // Check ad-hoc forum counts hasAdHocForum = (ModuleCommands.ForumsGetDocumentForumsCount(node.DocumentID) > 0); // Ad-Hoc message boards check hasAdHocBoard = (ModuleCommands.MessageBoardGetDocumentBoardsCount(node.DocumentID) > 0); script += "function ShowEditableContent() { modalDialog('" + ResolveUrl("Advanced/EditableContent/default.aspx") + "?nodeid=" + node.NodeID + "', 'EditableContent', 1015, 700); } \n"; } // Generate executive script if (hasAdHocBoard) { plcAdHocBoards.Visible = true; script += "function ShowMessageBoards() { modalDialog('" + ResolveUrl("~/CMSModules/MessageBoards/Content/Properties/default.aspx") + "?documentid=" + documentId + "', 'MessageBoards', 1020, 680); } \n"; } if (hasAdHocForum) { plcAdHocForums.Visible = true; script += "function ShowForums() { modalDialog('" + ResolveUrl("~/CMSModules/Forums/Content/Properties/default.aspx") + "?documentid=" + documentId + "', 'Forums', 1130, 680); } \n"; } ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ModalDialogsToAdvancedSection", ScriptHelper.GetScript(script)); // Reflect processing action pnlContent.Enabled = DocumentManager.AllowSave; if (chkCssStyle.Checked) { // Enable the edit button ctrlSiteSelectStyleSheet.ButtonEditEnabled = true; } }
private void ReloadData() { if (Node != null) { // Hide parts which are not relevant to content only nodes if (ShowContentOnlyProperties) { pnlUIAdvanced.Visible = false; pnlUICache.Visible = false; pnlUIDesign.Visible = false; plcPermanent.Visible = false; pnlUIOnlineMarketing.Visible = false; } // Log activities checkboxes if (!RequestHelper.IsPostBack()) { bool?logVisit = Node.DocumentLogVisitActivity; chkLogPageVisit.Checked = (logVisit == true); if (Node.NodeParentID > 0) // Init "inherit" option for child nodes (and hide option for root) { chkPageVisitInherit.Checked = (logVisit == null); if (logVisit == null) { chkPageVisitInherit_CheckedChanged(null, EventArgs.Empty); } } chkLogPageVisit.Enabled = !chkPageVisitInherit.Checked; } // Check modify permission canEdit = (MembershipContext.AuthenticatedUser.IsAuthorizedPerDocument(Node, NodePermissionsEnum.Modify) != AuthorizationResultEnum.Denied); // Show document group owner selector if (ModuleEntryManager.IsModuleLoaded(ModuleName.COMMUNITY) && canEditOwner && LicenseHelper.CheckFeature(RequestContext.CurrentDomain, FeatureEnum.Groups)) { plcOwnerGroup.Controls.Clear(); // Initialize panel content Panel rowWrapperPanel = new Panel(); rowWrapperPanel.CssClass = "form-group"; Panel lblPanel = new Panel(); lblPanel.CssClass = "editing-form-label-cell"; Panel ctrlPanel = new Panel(); ctrlPanel.CssClass = "editing-form-value-cell"; // Initialize caption LocalizedLabel lblOwnerGroup = new LocalizedLabel(); lblOwnerGroup.EnableViewState = false; lblOwnerGroup.ResourceString = "community.group.documentowner"; lblOwnerGroup.ID = "lblOwnerGroup"; lblOwnerGroup.CssClass = "control-label"; lblPanel.Controls.Add(lblOwnerGroup); // Initialize selector fcDocumentGroupSelector = (FormEngineUserControl)Page.LoadUserControl("~/CMSAdminControls/UI/Selectors/DocumentGroupSelector.ascx"); fcDocumentGroupSelector.ID = "fcDocumentGroupSelector"; fcDocumentGroupSelector.StopProcessing = pnlUIOwner.IsHidden; ctrlPanel.Controls.Add(fcDocumentGroupSelector); fcDocumentGroupSelector.Value = ValidationHelper.GetInteger(Node.GetValue("NodeGroupID"), 0); fcDocumentGroupSelector.SetValue("siteid", SiteContext.CurrentSiteID); fcDocumentGroupSelector.SetValue("nodeid", Node.NodeID); // Add controls to containers rowWrapperPanel.Controls.Add(lblPanel); rowWrapperPanel.Controls.Add(ctrlPanel); plcOwnerGroup.Controls.Add(rowWrapperPanel); plcOwnerGroup.Visible = true; } // Show owner editing only when authorized to change the permissions if (canEditOwner) { lblOwner.Visible = false; usrOwner.Visible = true; usrOwner.SetValue("AdditionalUsers", new[] { Node.NodeOwner }); } else { usrOwner.Visible = false; } if (!RequestHelper.IsPostBack()) { if (canEditOwner) { usrOwner.Value = Node.GetValue("NodeOwner"); } } // Load the data lblName.Text = HttpUtility.HtmlEncode(Node.GetDocumentName()); lblNamePath.Text = HttpUtility.HtmlEncode(Convert.ToString(Node.GetValue("DocumentNamePath"))); lblAliasPath.Text = Convert.ToString(Node.NodeAliasPath); string typeName = DataClassInfoProvider.GetDataClassInfo(Node.NodeClassName).ClassDisplayName; lblType.Text = HttpUtility.HtmlEncode(ResHelper.LocalizeString(typeName)); lblNodeID.Text = Convert.ToString(Node.NodeID); // Modifier SetUserLabel(lblLastModifiedBy, "DocumentModifiedByUserId"); // Get modified time TimeZoneInfo usedTimeZone; DateTime lastModified = ValidationHelper.GetDateTime(Node.GetValue("DocumentModifiedWhen"), DateTimeHelper.ZERO_TIME); lblLastModified.Text = TimeZoneHelper.GetCurrentTimeZoneDateTimeString(lastModified, MembershipContext.AuthenticatedUser, SiteContext.CurrentSite, out usedTimeZone); ScriptHelper.AppendTooltip(lblLastModified, TimeZoneHelper.GetUTCLongStringOffset(usedTimeZone), "help"); if (!canEditOwner) { // Owner SetUserLabel(lblOwner, "NodeOwner"); } // Creator SetUserLabel(lblCreatedBy, "DocumentCreatedByUserId"); DateTime createdWhen = ValidationHelper.GetDateTime(Node.GetValue("DocumentCreatedWhen"), DateTimeHelper.ZERO_TIME); lblCreated.Text = TimeZoneHelper.GetCurrentTimeZoneDateTimeString(createdWhen, MembershipContext.AuthenticatedUser, SiteContext.CurrentSite, out usedTimeZone); ScriptHelper.AppendTooltip(lblCreated, TimeZoneHelper.GetUTCLongStringOffset(usedTimeZone), "help"); // URL if (plcPermanent.Visible) { string permanentUrl = DocumentURLProvider.GetPermanentDocUrl(Node.NodeGUID, Node.NodeAlias, Node.NodeSiteName, extension: ".aspx"); permanentUrl = URLHelper.ResolveUrl(permanentUrl); lnkPermanentURL.HRef = permanentUrl; lnkPermanentURL.InnerText = permanentUrl; } string liveUrl = DocumentURLProvider.GetAbsoluteLiveSiteURL(Node); lnkLiveURL.HRef = liveUrl; lnkLiveURL.InnerText = liveUrl; bool isRoot = Node.IsRoot(); // Hide preview URL for root node if (!isRoot) { plcPreview.Visible = true; btnResetPreviewGuid.ToolTip = GetString("GeneralProperties.InvalidatePreviewURL"); btnResetPreviewGuid.Click += btnResetPreviewGuid_Click; btnResetPreviewGuid.OnClientClick = "if(!confirm(" + ScriptHelper.GetLocalizedString("GeneralProperties.GeneratePreviewURLConf") + ")){return false;}"; InitPreviewUrl(); } lblGUID.Text = Convert.ToString(Node.NodeGUID); lblDocGUID.Text = (Node.DocumentGUID == Guid.Empty) ? ResHelper.Dash : Node.DocumentGUID.ToString(); lblDocID.Text = Convert.ToString(Node.DocumentID); // Culture CultureInfo ci = CultureInfoProvider.GetCultureInfo(Node.DocumentCulture); lblCulture.Text = ((ci != null) ? ResHelper.LocalizeString(ci.CultureName) : Node.DocumentCulture); if (Node.IsPublished) { lblPublished.Text = GetString("General.Yes"); lblPublished.CssClass += " DocumentPublishedYes"; } else { lblPublished.CssClass += " DocumentPublishedNo"; lblPublished.Text = GetString("General.No"); } // Load page info for inherited cache settings currentPage = PageInfoProvider.GetPageInfo(Node.NodeSiteName, Node.NodeAliasPath, Node.DocumentCulture, null, Node.NodeID, false); if (!RequestHelper.IsPostBack()) { // Init radio buttons for cache settings if (isRoot) { radInherit.Visible = false; radFSInherit.Visible = false; chkCssStyle.Visible = false; } else { // Show what is inherited value radInherit.Text = GetString("GeneralProperties.radInherit") + " (" + GetInheritedCacheCaption("NodeCacheMinutes") + ")"; radFSInherit.Text = GetString("GeneralProperties.radInherit") + " (" + GetInheritedCacheCaption("NodeAllowCacheInFileSystem") + ")"; } string cacheMinutes = ""; switch (Node.NodeCacheMinutes) { case null: // Cache setting is inherited { radNo.Checked = true; radYes.Checked = false; radInherit.Checked = false; if (!isRoot) { radInherit.Checked = true; radNo.Checked = false; if ((currentPage != null) && (currentPage.NodeCacheMinutes > 0)) { cacheMinutes = currentPage.NodeCacheMinutes.ToString(); } } } break; case 0: // Cache is off radNo.Checked = true; radYes.Checked = false; radInherit.Checked = false; break; default: // Cache is enabled radNo.Checked = false; radYes.Checked = true; radInherit.Checked = false; cacheMinutes = Node.NodeCacheMinutes.ToString(); break; } // Set secured radio buttons switch (Node.NodeAllowCacheInFileSystem) { case false: radFSNo.Checked = true; break; case true: radFSYes.Checked = true; break; default: if (!isRoot) { radFSInherit.Checked = true; } else { radFSYes.Checked = true; } break; } txtCacheMinutes.Text = cacheMinutes; if (!radYes.Checked) { txtCacheMinutes.Enabled = false; } var defaultStylesheet = GetDefaultStylesheet(); if (Node.DocumentInheritsStylesheet && !isRoot) { chkCssStyle.Checked = true; // Get stylesheet from the parent node string value = GetStylesheetParentValue(); ctrlSiteSelectStyleSheet.Value = String.IsNullOrEmpty(value) ? defaultStylesheet : value; } else { // Get stylesheet from the current node var stylesheetId = Node.DocumentStylesheetID; ctrlSiteSelectStyleSheet.Value = (stylesheetId == 0) ? defaultStylesheet : stylesheetId.ToString(); } } // Disable new button if document inherit stylesheet bool disableCssSelector = (!isRoot && chkCssStyle.Checked); ctrlSiteSelectStyleSheet.Enabled = !disableCssSelector; ctrlSiteSelectStyleSheet.ButtonNewEnabled = !disableCssSelector; // Initialize Rating control RefreshCntRatingResult(); double rating = 0.0f; if (Node.DocumentRatings > 0) { rating = Node.DocumentRatingValue / Node.DocumentRatings; } ratingControl.MaxRating = 10; ratingControl.CurrentRating = rating; ratingControl.Visible = true; ratingControl.Enabled = false; // Initialize Reset button for rating btnResetRating.OnClientClick = "if (!confirm(" + ScriptHelper.GetString(GetString("GeneralProperties.ResetRatingConfirmation")) + ")) return false;"; object[] param = new object[1]; param[0] = Node.DocumentID; plcAdHocForums.Visible = hasAdHocForum; plcAdHocBoards.Visible = hasAdHocBoard; if (!canEdit) { // Disable form editing DisableFormEditing(); } } else { btnResetRating.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { InitializeForm(); drpLockReason.Enabled = chkEnabled.Checked; // Show alphabet filter if enabled if (pnlAlphabet.Visible) { pnlAlphabet.Controls.Add(CreateAlphabetTable()); } if (scoreSelector != null) { int siteId = QueryHelper.GetInteger("siteid", 0); scoreSelector.Enabled = (siteId > 0) || ((siteId == 0) && (siteSelector.SiteID > 0)); if (siteId == 0) { scoreSelector.SetValue("SiteID", siteSelector.SiteID); } } // Show correct filter panel EnsureFilterMode(); pnlAdvancedFilter.Visible = isAdvancedMode; pnlSimpleFilter.Visible = !isAdvancedMode; // Set reset link button UniGrid grid = FilteredControl as UniGrid; if (grid != null && grid.RememberState) { if (isAdvancedMode) { btnAdvancedReset.Text = GetString("general.reset"); btnAdvancedReset.Click += btnReset_Click; } else { btnReset.Text = GetString("general.reset"); btnReset.Click += btnReset_Click; } } else { if (isAdvancedMode) { btnAdvancedReset.Visible = false; } else { btnReset.Visible = false; } } // Show group filter only if enabled if (SiteID > 0) { SiteInfo si = SiteInfoProvider.GetSiteInfo(SiteID); if ((si != null) && isAdvancedMode) { showGroups = ModuleCommands.CommunitySiteHasGroup(si.SiteID); } } // Setup role selector selectNotInRole.SiteID = SiteID; selectRoleElem.SiteID = SiteID; selectRoleElem.CurrentSelector.ResourcePrefix = "addroles"; selectNotInRole.CurrentSelector.ResourcePrefix = "addroles"; selectRoleElem.UseFriendlyMode = true; selectNotInRole.UseFriendlyMode = true; // Setup groups selectors plcGroups.Visible = showGroups; if (selectInGroups != null) { selectInGroups.StopProcessing = !showGroups; selectInGroups.FormControlParameter = SiteID; } if (selectNotInGroups != null) { selectNotInGroups.StopProcessing = !showGroups; selectNotInGroups.FormControlParameter = SiteID; } if (SessionInsteadOfUser && DisplayGuestsByDefault) { plcNickName.Visible = false; plcUserName.Visible = false; } if (grid != null) { string argument = ValidationHelper.GetString(Request.Params["__EVENTARGUMENT"], String.Empty); if (argument == "Alphabet") { grid.ApplyFilter(null, null); } } if (QueryHelper.GetBoolean("isonlinemarketing", false)) { // Set disabled modules info (only on On-line marketing tab) ucDisabledModule.SettingsKeys = "CMSSessionUseDBRepository;CMSEnableOnlineMarketing"; ucDisabledModule.InfoTexts.Add(GetString("administration.users.usedbrepository.disabled") + "<br/>"); ucDisabledModule.InfoTexts.Add(GetString("om.onlinemarketing.disabled")); ucDisabledModule.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { // Register the scripts ScriptHelper.RegisterProgress(this.Page); ScriptHelper.RegisterTooltip(this.Page); ScriptHelper.RegisterDialogScript(this); // Set user control properties usrOwner = this.Page.LoadControl("~/CMSModules/Membership/FormControls/Users/selectuser.ascx") as FormEngineUserControl; usrOwner.ID = "ctrlUsrOwner"; usrOwner.IsLiveSite = false; usrOwner.SetValue("ShowSiteFilter", false); usrOwner.StopProcessing = this.pnlUIOwner.IsHidden; plcUsrOwner.Controls.Add(usrOwner); UIContext.PropertyTab = PropertyTabEnum.General; nodeId = QueryHelper.GetInteger("nodeid", 0); // Init strings pnlDesign.GroupingText = GetString("GeneralProperties.DesignGroup"); pnlCache.GroupingText = GetString("GeneralProperties.CacheGroup"); pnlOther.GroupingText = GetString("GeneralProperties.OtherGroup"); pnlAdvanced.GroupingText = GetString("GeneralProperties.AdvancedGroup"); pnlOwner.GroupingText = GetString("GeneralProperties.OwnerGroup"); // Advanced section mEditableContent = GetString("GeneralProperties.EditableContent"); mForums = GetString("PageProperties.AdHocForum"); mMessageBoards = GetString("PageProperties.MessageBoards"); lnkEditableContent.OnClientClick = "ShowEditableContent(); return false;"; lnkMessageBoards.OnClientClick = "ShowMessageBoards(); return false;"; lnkForums.OnClientClick = "ShowForums(); return false;"; imgEditableContent.ImageUrl = GetImageUrl("CMSModules/CMS_Content/EditableContent/editablecontent.png"); imgMessageBoards.ImageUrl = GetImageUrl("CMSModules/CMS_MessageBoards/module.png"); imgForums.ImageUrl = GetImageUrl("CMSModules/CMS_Forums/module.png"); // Get strings for radio buttons radInherit.Text = GetString("GeneralProperties.radInherit"); radYes.Text = GetString("general.yes"); radNo.Text = GetString("general.no"); lblCacheMinutes.Text = GetString("GeneralProperties.cacheMinutes"); // Get strings for labels lblNameTitle.Text = GetString("GeneralProperties.Name"); lblNamePathTitle.Text = GetString("GeneralProperties.NamePath"); lblAliasPathTitle.Text = GetString("GeneralProperties.AliasPath"); lblTypeTitle.Text = GetString("GeneralProperties.Type"); lblNodeIDTitle.Text = GetString("GeneralProperties.NodeID"); lblLastModifiedByTitle.Text = GetString("GeneralProperties.LastModifiedBy"); lblLastModifiedTitle.Text = GetString("GeneralProperties.LastModified"); lblLiveURLTitle.Text = GetString("GeneralProperties.LiveURL"); lblPreviewURLTitle.Text = GetString("GeneralProperties.PreviewURL"); lblGUIDTitle.Text = GetString("GeneralProperties.GUID"); lblDocGUIDTitle.Text = GetString("GeneralProperties.DocumentGUID"); lblDocIDTitle.Text = GetString("GeneralProperties.DocumentID"); lblCultureTitle.Text = GetString("GeneralProperties.Culture"); lblCreatedByTitle.Text = GetString("GeneralProperties.CreatedBy"); lblCreatedTitle.Text = GetString("GeneralProperties.Created"); lblOwnerTitle.Text = GetString("GeneralProperties.Owner"); lblCssStyle.Text = GetString("PageProperties.CssStyle"); lblPublishedTitle.Text = GetString("PageProperties.Published"); chkExcludeFromSearch.Text = GetString("GeneralProperties.ExcludeFromSearch"); chkCssStyle.Text = GetString("Metadata.Inherit"); pnlOnlineMarketing.GroupingText = GetString("general.onlinemarketing"); // Set default item value string defaultStyleSheet = "-1"; CssStylesheetInfo cssInfo = CMSContext.CurrentSiteStylesheet; // If current site default stylesheet defined, choose it if (cssInfo != null) { defaultStyleSheet = "default"; } ctrlSiteSelectStyleSheet.CurrentSelector.SpecialFields = new string[1, 2] { { GetString("general.defaultchoice"), defaultStyleSheet } }; ctrlSiteSelectStyleSheet.ReturnColumnName = "StyleSheetID"; ctrlSiteSelectStyleSheet.SiteId = CMSContext.CurrentSiteID; if (CMSContext.CurrentSite != null) { usrOwner.SetValue("SiteID", CMSContext.CurrentSite.SiteID); } // Initialize Save button imgSave.ImageUrl = GetImageUrl("CMSModules/CMS_Content/EditMenu/save.png"); mSave = GetString("general.save"); int documentId = 0; // Get the document TreeProvider tree = new TreeProvider(CMSContext.CurrentUser); node = tree.SelectSingleNode(nodeId, CMSContext.PreferredCultureCode, false); // Redirect to page 'New culture version' in split mode. It must be before setting EditedDocument. if ((node == null) && displaySplitMode) { URLHelper.Redirect("~/CMSModules/Content/CMSDesk/New/NewCultureVersion.aspx" + URLHelper.Url.Query); } // Set edited document EditedDocument = node; if (node != null) { documentId = node.DocumentID; canEditOwner = (CMSContext.CurrentUser.IsAuthorizedPerDocument(node, NodePermissionsEnum.ModifyPermissions) == AuthorizationResultEnum.Allowed); ReloadData(); } // Generate executive script string script = "function ShowEditableContent() { modalDialog('" + ResolveUrl("Advanced/EditableContent/default.aspx") + "?nodeid=" + nodeId + "', 'EditableContent', 1015, 700); } \n"; if (hasAdHocBoard) { plcAdHocBoards.Visible = true; script += "function ShowMessageBoards() { modalDialog('" + ResolveUrl("~/CMSModules/MessageBoards/Content/Properties/default.aspx") + "?documentid=" + documentId + "', 'MessageBoards', 1020, 680); } \n"; } if (hasAdHocForum) { plcAdHocForums.Visible = true; script += "function ShowForums() { modalDialog('" + ResolveUrl("~/CMSModules/Forums/Content/Properties/default.aspx") + "?documentid=" + documentId + "', 'Forums', 1130, 680); } \n"; } ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ModalDialogsToAdvancedSection", ScriptHelper.GetScript(script)); // Register js synchronization script for split mode if (displaySplitMode) { RegisterSplitModeSync(true, false); } }
protected void Page_Load(object sender, EventArgs e) { SetPropertyTab(TAB_GENERAL); // Register the scripts ScriptHelper.RegisterLoader(Page); ScriptHelper.RegisterTooltip(Page); ScriptHelper.RegisterDialogScript(this); btnEditableContent.OnClientClick = "ShowEditableContent(); return false;"; btnMessageBoards.OnClientClick = "ShowMessageBoards(); return false;"; btnForums.OnClientClick = "ShowForums(); return false;"; // Get strings for radio buttons lblCacheMinutes.Text = GetString("GeneralProperties.cacheMinutes"); // Get strings for labels lblNameTitle.Text = GetString("GeneralProperties.Name"); lblNamePathTitle.Text = GetString("GeneralProperties.NamePath"); lblAliasPathTitle.Text = GetString("GeneralProperties.AliasPath"); lblTypeTitle.Text = GetString("GeneralProperties.Type"); lblNodeIDTitle.Text = GetString("GeneralProperties.NodeID"); lblLastModifiedByTitle.Text = GetString("GeneralProperties.LastModifiedBy"); lblLastModifiedTitle.Text = GetString("GeneralProperties.LastModified"); lblLiveURLTitle.Text = GetString("GeneralProperties.LiveURL"); lblPreviewURLTitle.Text = GetString("GeneralProperties.PreviewURL"); lblGUIDTitle.Text = GetString("GeneralProperties.GUID"); lblDocGUIDTitle.Text = GetString("GeneralProperties.DocumentGUID"); lblDocIDTitle.Text = GetString("GeneralProperties.DocumentID"); lblCultureTitle.Text = GetString("GeneralProperties.Culture"); lblCreatedByTitle.Text = GetString("GeneralProperties.CreatedBy"); lblCreatedTitle.Text = GetString("GeneralProperties.Created"); lblOwnerTitle.Text = GetString("GeneralProperties.Owner"); lblCssStyle.Text = GetString("PageProperties.CssStyle"); lblPublishedTitle.Text = GetString("PageProperties.Published"); // Set default item value ctrlSiteSelectStyleSheet.AddDefaultRecord = false; ctrlSiteSelectStyleSheet.CurrentSelector.SpecialFields.AllowDuplicates = true; ctrlSiteSelectStyleSheet.CurrentSelector.SpecialFields.Add(new SpecialField { Text = GetString("general.defaultchoice"), Value = GetDefaultStylesheet() }); ctrlSiteSelectStyleSheet.ReturnColumnName = "StyleSheetID"; ctrlSiteSelectStyleSheet.SiteId = SiteContext.CurrentSiteID; if ((SiteContext.CurrentSite != null) && (usrOwner != null)) { usrOwner.SetValue("SiteID", SiteContext.CurrentSite.SiteID); } int documentId = 0; StringBuilder script = new StringBuilder(); TreeNode node = Node; if (node != null) { if (PortalContext.CurrentSiteStylesheet != null) { script.Append(@" var currentStyleSheetId; // Function raised before opening the Edit dialog of the CSS style sheet control. When 'default' style sheet is chosen, translate this value to the default site style sheet id. function US_GetEditedItemId_", ctrlSiteSelectStyleSheet.ValueElementID, @"(selectedValue) { currentStyleSheetId = selectedValue; if (selectedValue == ""default"") { return ", PortalContext.CurrentSiteStylesheet.StylesheetID, @"; } return selectedValue; } // Function raised from New/Edit dialog after save action. When 'default' style is used, the new/edit dialog will try to choose a real style sheet id (which was edited), but it is necessary keep the selected value to be 'default'. function US_GetNewItemId_", ctrlSiteSelectStyleSheet.ValueElementID, @"(newStyleSheetId) { if ((currentStyleSheetId == ""default"") && (newStyleSheetId == ", PortalContext.CurrentSiteStylesheet.StylesheetID, @")) { return currentStyleSheetId; } return newStyleSheetId; } " ); } // Create wireframe option if (node.NodeWireframeTemplateID <= 0) { btnWireframe.ResourceString = "Wireframe.Create"; string createUrl = URLHelper.ResolveUrl(String.Format("~/CMSModules/Content/CMSDesk/Properties/CreateWireframe.aspx?nodeid={0}&culture={1}", node.NodeID, node.DocumentCulture)); btnWireframe.OnClientClick = "parent.location.replace('" + createUrl + "'); return false;"; } else { btnWireframe.ResourceString = "Wireframe.Remove"; btnWireframe.OnClientClick = "return confirm(" + ScriptHelper.GetLocalizedString("Wireframe.ConfirmRemove") + ")"; btnWireframe.Click += lnkWireframe_Click; } plcWireframe.Visible = PortalHelper.IsWireframingEnabled(SiteContext.CurrentSiteName); documentId = node.DocumentID; canEditOwner = (MembershipContext.AuthenticatedUser.IsAuthorizedPerDocument(Node, NodePermissionsEnum.ModifyPermissions) == AuthorizationResultEnum.Allowed); ctrlSiteSelectStyleSheet.AliasPath = node.NodeAliasPath; ReloadData(); // Check ad-hoc forum counts hasAdHocForum = (ModuleCommands.ForumsGetDocumentForumsCount(node.DocumentID) > 0); // Ad-Hoc message boards check hasAdHocBoard = (ModuleCommands.MessageBoardGetDocumentBoardsCount(node.DocumentID) > 0); script.Append("function ShowEditableContent() { modalDialog('", ResolveUrl("Advanced/EditableContent/default.aspx"), "?nodeid=", node.NodeID, "', 'EditableContent', '95%', '95%'); } \n"); } // Generate executive script if (hasAdHocBoard) { plcAdHocBoards.Visible = true; script.Append("function ShowMessageBoards() { modalDialog('", ResolveUrl("~/CMSModules/MessageBoards/Content/Properties/default.aspx"), "?documentid=", documentId, "', 'MessageBoards', '95%', '95%'); } \n"); } if (hasAdHocForum) { plcAdHocForums.Visible = true; script.Append("function ShowForums() { modalDialog('", ResolveUrl("~/CMSModules/Forums/Content/Properties/default.aspx"), "?documentid=", documentId, "', 'Forums', '95%', '95%'); } \n"); } ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ModalDialogsToAdvancedSection", script.ToString(), true); // Reflect processing action pnlContent.Enabled = DocumentManager.AllowSave; if (chkCssStyle.Checked && (PortalContext.CurrentSiteStylesheet != null)) { // Enable the edit button ctrlSiteSelectStyleSheet.ButtonEditEnabled = true; } }
protected override void OnInit(EventArgs e) { // Culture independent data SplitModeAllwaysRefresh = true; // Non-versioned data are modified DocumentManager.UseDocumentHelper = false; base.OnInit(e); // Check UI element permission if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.Content", "Properties.General")) { RedirectToUIElementAccessDenied("CMS.Content", "Properties.General"); } // Redirect to information page when no UI elements displayed if (pnlUIAdvanced.IsHidden && pnlUICache.IsHidden && pnlUIDesign.IsHidden && pnlUIOther.IsHidden && pnlUIOwner.IsHidden) { RedirectToUINotAvailable(); } // Init document manager events DocumentManager.OnSaveData += DocumentManager_OnSaveData; DocumentManager.OnAfterAction += DocumentManager_OnAfterAction; EnableSplitMode = true; // Set user control properties usrOwner = Page.LoadUserControl("~/CMSModules/Membership/FormControls/Users/selectuser.ascx") as FormEngineUserControl; if (usrOwner != null) { usrOwner.ID = "ctrlUsrOwner"; usrOwner.IsLiveSite = false; usrOwner.SetValue("ShowSiteFilter", false); usrOwner.StopProcessing = pnlUIOwner.IsHidden; plcUsrOwner.Controls.Add(usrOwner); } }
protected void Page_Load(object sender, EventArgs e) { // Register the scripts ScriptHelper.RegisterLoader(Page); ScriptHelper.RegisterTooltip(Page); ScriptHelper.RegisterDialogScript(this); btnEditableContent.OnClientClick = "ShowEditableContent(); return false;"; btnMessageBoards.OnClientClick = "ShowMessageBoards(); return false;"; btnForums.OnClientClick = "ShowForums(); return false;"; // Set default item value ctrlSiteSelectStyleSheet.AddDefaultRecord = false; ctrlSiteSelectStyleSheet.CurrentSelector.SpecialFields.AllowDuplicates = true; if (PortalContext.CurrentSiteStylesheet != null) { ctrlSiteSelectStyleSheet.CurrentSelector.SpecialFields.Add(new SpecialField { Text = GetString("general.defaultchoice"), Value = GetDefaultStylesheet() }); } else { ctrlSiteSelectStyleSheet.CurrentSelector.AllowEmpty = true; } ctrlSiteSelectStyleSheet.ReturnColumnName = "StyleSheetID"; ctrlSiteSelectStyleSheet.SiteId = SiteContext.CurrentSiteID; if ((SiteContext.CurrentSite != null) && (usrOwner != null)) { usrOwner.SetValue("SiteID", SiteContext.CurrentSite.SiteID); } int documentId = 0; StringBuilder script = new StringBuilder(); TreeNode node = Node; if (node != null) { // Redirect to information page when no UI elements displayed if (((pnlUIAdvanced.IsHidden && pnlUICache.IsHidden && pnlUIDesign.IsHidden) || ShowContentOnlyProperties) && pnlUIOther.IsHidden && pnlUIOwner.IsHidden) { RedirectToUINotAvailable(); } // Get strings for headings headOtherProperties.Text = ShowContentOnlyProperties ? GetString("content.ui.properties") : GetString("GeneralProperties.OtherGroup"); if (PortalContext.CurrentSiteStylesheet != null) { script.Append(@" var currentStyleSheetId; // Function raised before opening the Edit dialog of the CSS style sheet control. When 'default' style sheet is chosen, translate this value to the default site style sheet id. function US_GetEditedItemId_", ctrlSiteSelectStyleSheet.ValueElementID, @"(selectedValue) { currentStyleSheetId = selectedValue; if (selectedValue == ""default"") { return ", PortalContext.CurrentSiteStylesheet.StylesheetID, @"; } return selectedValue; } // Function raised from New/Edit dialog after save action. When 'default' style is used, the new/edit dialog will try to choose a real style sheet id (which was edited), but it is necessary keep the selected value to be 'default'. function US_GetNewItemId_", ctrlSiteSelectStyleSheet.ValueElementID, @"(newStyleSheetId) { if ((currentStyleSheetId == ""default"") && (newStyleSheetId == ", PortalContext.CurrentSiteStylesheet.StylesheetID, @")) { return currentStyleSheetId; } return newStyleSheetId; }"); } documentId = node.DocumentID; canEditOwner = (MembershipContext.AuthenticatedUser.IsAuthorizedPerDocument(Node, NodePermissionsEnum.ModifyPermissions) == AuthorizationResultEnum.Allowed); ctrlSiteSelectStyleSheet.AliasPath = node.NodeAliasPath; ReloadData(); // Check ad-hoc forum counts hasAdHocForum = (ModuleCommands.ForumsGetDocumentForumsCount(node.DocumentID) > 0); // Ad-Hoc message boards check hasAdHocBoard = (ModuleCommands.MessageBoardGetDocumentBoardsCount(node.DocumentID) > 0); script.Append("function ShowEditableContent() { modalDialog('", ResolveUrl("Advanced/EditableContent/default.aspx"), "?nodeid=", node.NodeID, "', 'EditableContent', '95%', '95%'); } \n"); } // Generate executive script if (hasAdHocBoard) { plcAdHocBoards.Visible = true; script.Append("function ShowMessageBoards() { modalDialog('", ResolveUrl("~/CMSModules/MessageBoards/Content/Properties/default.aspx"), "?documentid=", documentId, "', 'MessageBoards', '95%', '95%'); } \n"); } if (hasAdHocForum) { plcAdHocForums.Visible = true; script.Append("function ShowForums() { modalDialog('", ResolveUrl("~/CMSModules/Forums/Content/Properties/default.aspx"), "?documentid=", documentId, "', 'Forums', '95%', '95%'); } \n"); } ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ModalDialogsToAdvancedSection", script.ToString(), true); // Reflect processing action pnlContent.Enabled = DocumentManager.AllowSave; if (chkCssStyle.Checked && (PortalContext.CurrentSiteStylesheet != null)) { // Enable the edit button ctrlSiteSelectStyleSheet.ButtonEditEnabled = true; } }
private void ReloadData() { if (Node != null) { // Log activities checkboxes if (!RequestHelper.IsPostBack()) { bool? logVisit = Node.DocumentLogVisitActivity; chkLogPageVisit.Checked = (logVisit == true); if (Node.NodeParentID > 0) // Init "inherit" option for child nodes (and hide option for root) { chkPageVisitInherit.Checked = (logVisit == null); if (logVisit == null) { chkPageVisitInherit_CheckedChanged(null, EventArgs.Empty); } } chkLogPageVisit.Enabled = !chkPageVisitInherit.Checked; } // Check modify permission canEdit = (MembershipContext.AuthenticatedUser.IsAuthorizedPerDocument(Node, NodePermissionsEnum.Modify) != AuthorizationResultEnum.Denied); // Show document group owner selector if (ModuleEntryManager.IsModuleLoaded(ModuleName.COMMUNITY) && canEditOwner && LicenseHelper.CheckFeature(RequestContext.CurrentDomain, FeatureEnum.Groups)) { plcOwnerGroup.Controls.Clear(); // Initialize panel content Panel rowWrapperPanel = new Panel(); rowWrapperPanel.CssClass = "form-group"; Panel lblPanel = new Panel(); lblPanel.CssClass = "editing-form-label-cell"; Panel ctrlPanel = new Panel(); ctrlPanel.CssClass = "editing-form-value-cell"; // Initialize caption LocalizedLabel lblOwnerGroup = new LocalizedLabel(); lblOwnerGroup.EnableViewState = false; lblOwnerGroup.ResourceString = "community.group.documentowner"; lblOwnerGroup.ID = "lblOwnerGroup"; lblOwnerGroup.CssClass = "control-label"; lblPanel.Controls.Add(lblOwnerGroup); // Initialize selector fcDocumentGroupSelector = (FormEngineUserControl)Page.LoadUserControl("~/CMSAdminControls/UI/Selectors/DocumentGroupSelector.ascx"); fcDocumentGroupSelector.ID = "fcDocumentGroupSelector"; fcDocumentGroupSelector.StopProcessing = pnlUIOwner.IsHidden; ctrlPanel.Controls.Add(fcDocumentGroupSelector); fcDocumentGroupSelector.Value = ValidationHelper.GetInteger(Node.GetValue("NodeGroupID"), 0); fcDocumentGroupSelector.SetValue("siteid", SiteContext.CurrentSiteID); fcDocumentGroupSelector.SetValue("nodeid", Node.NodeID); // Add controls to containers rowWrapperPanel.Controls.Add(lblPanel); rowWrapperPanel.Controls.Add(ctrlPanel); plcOwnerGroup.Controls.Add(rowWrapperPanel); plcOwnerGroup.Visible = true; } // Show owner editing only when authorized to change the permissions if (canEditOwner) { lblOwner.Visible = false; usrOwner.Visible = true; usrOwner.SetValue("AdditionalUsers", new[] { Node.NodeOwner }); } else { usrOwner.Visible = false; } if (!RequestHelper.IsPostBack()) { if (canEditOwner) { usrOwner.Value = Node.GetValue("NodeOwner"); } } // Load the data lblName.Text = HttpUtility.HtmlEncode(Node.GetDocumentName()); lblNamePath.Text = HttpUtility.HtmlEncode(Convert.ToString(Node.GetValue("DocumentNamePath"))); lblAliasPath.Text = Convert.ToString(Node.NodeAliasPath); string typeName = DataClassInfoProvider.GetDataClassInfo(Node.NodeClassName).ClassDisplayName; lblType.Text = HttpUtility.HtmlEncode(ResHelper.LocalizeString(typeName)); lblNodeID.Text = Convert.ToString(Node.NodeID); // Modifier SetUserLabel(lblLastModifiedBy, "DocumentModifiedByUserId"); // Get modified time TimeZoneInfo usedTimeZone; DateTime lastModified = ValidationHelper.GetDateTime(Node.GetValue("DocumentModifiedWhen"), DateTimeHelper.ZERO_TIME); lblLastModified.Text = TimeZoneHelper.GetCurrentTimeZoneDateTimeString(lastModified, MembershipContext.AuthenticatedUser, SiteContext.CurrentSite, out usedTimeZone); ScriptHelper.AppendTooltip(lblLastModified, TimeZoneHelper.GetUTCLongStringOffset(usedTimeZone), "help"); if (!canEditOwner) { // Owner SetUserLabel(lblOwner, "NodeOwner"); } // Creator SetUserLabel(lblCreatedBy, "DocumentCreatedByUserId"); DateTime createdWhen = ValidationHelper.GetDateTime(Node.GetValue("DocumentCreatedWhen"), DateTimeHelper.ZERO_TIME); lblCreated.Text = TimeZoneHelper.GetCurrentTimeZoneDateTimeString(createdWhen, MembershipContext.AuthenticatedUser, SiteContext.CurrentSite, out usedTimeZone); ScriptHelper.AppendTooltip(lblCreated, TimeZoneHelper.GetUTCLongStringOffset(usedTimeZone), "help"); // URL string liveUrl = Node.IsLink ? DocumentURLProvider.GetUrl(Node.NodeAliasPath) : DocumentURLProvider.GetUrl(Node.NodeAliasPath, Node.DocumentUrlPath); lnkLiveURL.Text = URLHelper.ResolveUrl(liveUrl); lnkLiveURL.NavigateUrl = URLHelper.ResolveUrl(liveUrl); string permanentUrl = DocumentURLProvider.GetPermanentDocUrl(Node.NodeGUID, Node.NodeAlias, Node.NodeSiteName, PageInfoProvider.PREFIX_CMS_GETDOC, ".aspx"); lnkPermanentUrl.Text = URLHelper.ResolveUrl(permanentUrl); lnkPermanentUrl.NavigateUrl = URLHelper.ResolveUrl(permanentUrl); bool isRoot = (Node.NodeClassName.ToLowerCSafe() == "cms.root"); // Preview URL if (!isRoot) { plcPreview.Visible = true; btnResetPreviewGuid.ToolTip = GetString("GeneralProperties.InvalidatePreviewURL"); btnResetPreviewGuid.Click += btnResetPreviewGuid_Click; btnResetPreviewGuid.OnClientClick = "if(!confirm(" + ScriptHelper.GetLocalizedString("GeneralProperties.GeneratePreviewURLConf") + ")){return false;}"; InitPreviewUrl(); } lblGUID.Text = Convert.ToString(Node.NodeGUID); lblDocGUID.Text = (Node.DocumentGUID == Guid.Empty) ? ResHelper.Dash : Node.DocumentGUID.ToString(); lblDocID.Text = Convert.ToString(Node.DocumentID); // Culture CultureInfo ci = CultureInfoProvider.GetCultureInfo(Node.DocumentCulture); lblCulture.Text = ((ci != null) ? ResHelper.LocalizeString(ci.CultureName) : Node.DocumentCulture); lblPublished.Text = (Node.IsPublished ? "<span class=\"DocumentPublishedYes\">" + GetString("General.Yes") + "</span>" : "<span class=\"DocumentPublishedNo\">" + GetString("General.No") + "</span>"); // Load page info for inherited cache settings currentPage = PageInfoProvider.GetPageInfo(Node.DocumentGUID); if (!RequestHelper.IsPostBack()) { // Init radio buttons for cache settings if (isRoot) { radInherit.Visible = false; radFSInherit.Visible = false; chkCssStyle.Visible = false; } else { // Show what is inherited value radInherit.Text = GetString("GeneralProperties.radInherit") + " (" + GetInheritedCacheCaption("NodeCacheMinutes") + ")"; radFSInherit.Text = GetString("GeneralProperties.radInherit") + " (" + GetInheritedCacheCaption("NodeAllowCacheInFileSystem") + ")"; } string cacheMinutes = ""; switch (Node.NodeCacheMinutes) { case -1: // Cache setting is inherited { radNo.Checked = true; radYes.Checked = false; radInherit.Checked = false; if (!isRoot) { radInherit.Checked = true; radNo.Checked = false; if ((currentPage != null) && (currentPage.NodeCacheMinutes > 0)) { cacheMinutes = currentPage.NodeCacheMinutes.ToString(); } } } break; case 0: // Cache is off radNo.Checked = true; radYes.Checked = false; radInherit.Checked = false; break; default: // Cache is enabled radNo.Checked = false; radYes.Checked = true; radInherit.Checked = false; cacheMinutes = Node.NodeCacheMinutes.ToString(); break; } // Set secured radio buttons switch (Node.NodeAllowCacheInFileSystem) { case 0: radFSNo.Checked = true; break; case 1: radFSYes.Checked = true; break; default: if (!isRoot) { radFSInherit.Checked = true; } else { radFSYes.Checked = true; } break; } txtCacheMinutes.Text = cacheMinutes; if (!radYes.Checked) { txtCacheMinutes.Enabled = false; } if (Node.GetValue("DocumentStylesheetID") == null) { ctrlSiteSelectStyleSheet.Value = GetDefaultStylesheet(); } else { // If stylesheet is inherited from parent document if (ValidationHelper.GetInteger(Node.GetValue("DocumentStylesheetID"), 0) == -1) { if (!isRoot) { chkCssStyle.Checked = true; // Get parent stylesheet string value = GetParentProperty(); ctrlSiteSelectStyleSheet.Value = String.IsNullOrEmpty(value) ? GetDefaultStylesheet() : value; } } else { ctrlSiteSelectStyleSheet.Value = Node.GetValue("DocumentStylesheetID"); } } } // Disable new button if document inherit stylesheet bool disableCssSelector = (!isRoot && chkCssStyle.Checked); ctrlSiteSelectStyleSheet.Enabled = !disableCssSelector; ctrlSiteSelectStyleSheet.ButtonNewEnabled = !disableCssSelector; // Initialize Rating control RefreshCntRatingResult(); double rating = 0.0f; if (Node.DocumentRatings > 0) { rating = Node.DocumentRatingValue / Node.DocumentRatings; } ratingControl.MaxRating = 10; ratingControl.CurrentRating = rating; ratingControl.Visible = true; ratingControl.Enabled = false; // Initialize Reset button for rating btnResetRating.Text = GetString("general.reset"); btnResetRating.OnClientClick = "if (!confirm(" + ScriptHelper.GetString(GetString("GeneralProperties.ResetRatingConfirmation")) + ")) return false;"; object[] param = new object[1]; param[0] = Node.DocumentID; plcAdHocForums.Visible = hasAdHocForum; plcAdHocBoards.Visible = hasAdHocBoard; if (!canEdit) { // Disable form editing DisableFormEditing(); } } else { btnResetRating.Visible = false; } }
/// <summary> /// Initializes group selector. /// </summary> private void HandleGroupsSelection() { // Display group selector only when group module is present if (ModuleEntry.IsModuleRegistered(ModuleEntry.COMMUNITY) && ModuleEntry.IsModuleLoaded(ModuleEntry.COMMUNITY) && (groupsSelector != null)) { // Global libraries item into group selector if (GlobalLibraries != AvailableLibrariesEnum.None) { // Add special item groupsSelector.SetValue("UseDisplayNames", true); groupsSelector.SetValue("DisplayGlobalValue", true); groupsSelector.SetValue("SiteID", SiteID); groupsSelector.SetValue("GlobalValueText", GetString("dialogs.media.globallibraries")); groupsSelector.IsLiveSite = IsLiveSite; } else { groupsSelector.SetValue("DisplayGlobalValue", false); } // If all groups should be displayed switch (Groups) { case AvailableGroupsEnum.All: // Set condition to load only groups realted to the current site groupsSelector.SetValue("WhereCondition", String.Format("(GroupSiteID={0})", SiteID)); break; case AvailableGroupsEnum.OnlyCurrentGroup: // Load only current group and disable control int groupId = ModuleCommands.CommunityGetCurrentGroupID(); groupsSelector.SetValue("WhereCondition", String.Format("(GroupID={0})", groupId)); break; case AvailableGroupsEnum.OnlySingleGroup: if (!string.IsNullOrEmpty(GroupName)) { groupsSelector.SetValue("WhereCondition", String.Format("(GroupName = N'{0}' AND GroupSiteID={1})", SqlHelperClass.GetSafeQueryString(GroupName, false), SiteID)); } break; case AvailableGroupsEnum.None: // Just '(none)' displayed in the selection if (GlobalLibraries == AvailableLibrariesEnum.None) { groupsSelector.SetValue("DisplayNoneWhenEmpty", true); groupsSelector.SetValue("EnabledGroups", false); } groupsSelector.SetValue("WhereCondition", String.Format("({0})", SqlHelperClass.NO_DATA_WHERE)); break; } // Reload group selector based on recently passed settings ((IDataUserControl)groupsSelector).ReloadData(true); } else { plcGroupSelector.Visible = false; } }
private void ReloadData() { if (Node != null) { // Log activities checkboxes if (!RequestHelper.IsPostBack()) { bool?logVisit = Node.DocumentLogVisitActivity; chkLogPageVisit.Checked = (logVisit == true); if (Node.NodeParentID > 0) // Init "inherit" option for child nodes (and hide option for root) { chkPageVisitInherit.Checked = (logVisit == null); if (logVisit == null) { chkPageVisitInherit_CheckedChanged(null, EventArgs.Empty); } } chkLogPageVisit.Enabled = !chkPageVisitInherit.Checked; } // Check modify permission canEdit = (CMSContext.CurrentUser.IsAuthorizedPerDocument(Node, NodePermissionsEnum.Modify) != AuthorizationResultEnum.Denied); // Show document group owner selector if (ModuleEntry.IsModuleLoaded(ModuleEntry.COMMUNITY) && canEditOwner && LicenseHelper.CheckFeature(URLHelper.GetCurrentDomain(), FeatureEnum.Groups)) { plcOwnerGroup.Controls.Clear(); // Initialize table TableRow rowOwner = new TableRow(); TableCell cellTitle = new TableCell(); TableCell cellSelector = new TableCell(); // Initialize caption LocalizedLabel lblOwnerGroup = new LocalizedLabel(); lblOwnerGroup.EnableViewState = false; lblOwnerGroup.ResourceString = "community.group.documentowner"; lblOwnerGroup.ID = "lblOwnerGroup"; cellTitle.Controls.Add(lblOwnerGroup); // Initialize selector fcDocumentGroupSelector = (FormEngineUserControl)Page.LoadUserControl("~/CMSAdminControls/UI/Selectors/DocumentGroupSelector.ascx"); fcDocumentGroupSelector.ID = "fcDocumentGroupSelector"; fcDocumentGroupSelector.StopProcessing = pnlUIOwner.IsHidden; cellSelector.Controls.Add(fcDocumentGroupSelector); fcDocumentGroupSelector.Value = ValidationHelper.GetInteger(Node.GetValue("NodeGroupID"), 0); fcDocumentGroupSelector.SetValue("siteid", CMSContext.CurrentSiteID); fcDocumentGroupSelector.SetValue("nodeid", Node.NodeID); // Add controls to containers rowOwner.Cells.Add(cellTitle); rowOwner.Cells.Add(cellSelector); plcOwnerGroup.Controls.Add(rowOwner); plcOwnerGroup.Visible = true; } // Show owner editing only when authorized to change the permissions if (canEditOwner) { lblOwner.Visible = false; usrOwner.Visible = true; usrOwner.SetValue("AdditionalUsers", new int[] { Node.NodeOwner }); } else { usrOwner.Visible = false; } if (!RequestHelper.IsPostBack()) { if (canEditOwner) { usrOwner.Value = Node.GetValue("NodeOwner"); } } // Load the data lblName.Text = HttpUtility.HtmlEncode(Node.GetDocumentName()); lblNamePath.Text = HttpUtility.HtmlEncode(Convert.ToString(Node.GetValue("DocumentNamePath"))); lblAliasPath.Text = Convert.ToString(Node.NodeAliasPath); string typeName = DataClassInfoProvider.GetDataClass(Node.NodeClassName).ClassDisplayName; lblType.Text = HttpUtility.HtmlEncode(ResHelper.LocalizeString(typeName)); lblNodeID.Text = Convert.ToString(Node.NodeID); // Modifier SetUserLabel(lblLastModifiedBy, "DocumentModifiedByUserId"); // Get modified time TimeZoneInfo usedTimeZone = null; DateTime lastModified = ValidationHelper.GetDateTime(Node.GetValue("DocumentModifiedWhen"), DateTimeHelper.ZERO_TIME); lblLastModified.Text = TimeZoneHelper.GetCurrentTimeZoneDateTimeString(lastModified, CMSContext.CurrentUser, CMSContext.CurrentSite, out usedTimeZone); ScriptHelper.AppendTooltip(lblLastModified, TimeZoneHelper.GetGMTLongStringOffset(usedTimeZone), "help"); if (!canEditOwner) { // Owner SetUserLabel(lblOwner, "NodeOwner"); } // Creator SetUserLabel(lblCreatedBy, "DocumentCreatedByUserId"); DateTime createdWhen = ValidationHelper.GetDateTime(Node.GetValue("DocumentCreatedWhen"), DateTimeHelper.ZERO_TIME); lblCreated.Text = TimeZoneHelper.GetCurrentTimeZoneDateTimeString(createdWhen, CMSContext.CurrentUser, CMSContext.CurrentSite, out usedTimeZone); ScriptHelper.AppendTooltip(lblCreated, TimeZoneHelper.GetGMTLongStringOffset(usedTimeZone), "help"); // URL string liveUrl = Node.IsLink ? CMSContext.GetUrl(Node.NodeAliasPath, null) : CMSContext.GetUrl(Node.NodeAliasPath, Node.DocumentUrlPath); lnkLiveURL.Text = URLHelper.ResolveUrl(liveUrl, true, false); lnkLiveURL.NavigateUrl = URLHelper.ResolveUrl(liveUrl); bool isRoot = (Node.NodeClassName.ToLowerCSafe() == "cms.root"); // Preview URL if (!isRoot) { plcPreview.Visible = true; string path = canEdit ? "/CMSModules/CMS_Content/Properties/resetlink.png" : "/CMSModules/CMS_Content/Properties/resetlinkdisabled.png"; btnResetPreviewGuid.ImageUrl = GetImageUrl(path); btnResetPreviewGuid.ToolTip = GetString("GeneralProperties.InvalidatePreviewURL"); btnResetPreviewGuid.ImageAlign = ImageAlign.AbsBottom; btnResetPreviewGuid.Click += btnResetPreviewGuid_Click; btnResetPreviewGuid.OnClientClick = "if(!confirm('" + GetString("GeneralProperties.GeneratePreviewURLConf") + "')){return false;}"; InitPreviewUrl(); } lblGUID.Text = Convert.ToString(Node.NodeGUID); lblDocGUID.Text = (Node.DocumentGUID == Guid.Empty) ? ResHelper.Dash : Node.DocumentGUID.ToString(); lblDocID.Text = Convert.ToString(Node.DocumentID); // Culture CultureInfo ci = CultureInfoProvider.GetCultureInfo(Node.DocumentCulture); lblCulture.Text = ((ci != null) ? ResHelper.LocalizeString(ci.CultureName) : Node.DocumentCulture); lblPublished.Text = (Node.IsPublished ? "<span class=\"DocumentPublishedYes\">" + GetString("General.Yes") + "</span>" : "<span class=\"DocumentPublishedNo\">" + GetString("General.No") + "</span>"); if (!RequestHelper.IsPostBack()) { // Init radio buttons for cache settings if (isRoot) { radInherit.Visible = false; radFSInherit.Visible = false; chkCssStyle.Visible = false; } string cacheMinutes = ""; switch (Node.NodeCacheMinutes) { case -1: // Cache is off { radNo.Checked = true; radYes.Checked = false; radInherit.Checked = false; if (!isRoot) { radInherit.Checked = true; radNo.Checked = false; } } break; case 0: // Cache is off radNo.Checked = true; radYes.Checked = false; radInherit.Checked = false; break; default: // Cache is enabled radNo.Checked = false; radYes.Checked = true; radInherit.Checked = false; cacheMinutes = Node.NodeCacheMinutes.ToString(); break; } // Set secured radio buttons switch (Node.NodeAllowCacheInFileSystem) { case 0: radFSNo.Checked = true; break; case 1: radFSYes.Checked = true; break; default: if (!isRoot) { radFSInherit.Checked = true; } else { radFSYes.Checked = true; } break; } txtCacheMinutes.Text = cacheMinutes; if (!radYes.Checked) { txtCacheMinutes.Enabled = false; } if (Node.GetValue("DocumentStylesheetID") == null) { // If default site not exist edit is set to -1 - disabled if (CMSContext.CurrentSiteStylesheet != null) { ctrlSiteSelectStyleSheet.Value = "default"; } else { ctrlSiteSelectStyleSheet.Value = -1; } } else { // If stylesheet is inherited from parent document if (ValidationHelper.GetInteger(Node.GetValue("DocumentStylesheetID"), 0) == -1) { if (!isRoot) { chkCssStyle.Checked = true; // Get parent stylesheet string value = PageInfoProvider.GetParentProperty(CMSContext.CurrentSite.SiteID, Node.NodeAliasPath, "(DocumentStylesheetID <> -1 OR DocumentStylesheetID IS NULL) AND DocumentCulture = N'" + SqlHelperClass.GetSafeQueryString(Node.DocumentCulture, false) + "'", "DocumentStylesheetID"); if (String.IsNullOrEmpty(value)) { // If default site stylesheet not exist edit is set to -1 - disabled if (CMSContext.CurrentSiteStylesheet != null) { ctrlSiteSelectStyleSheet.Value = "default"; } else { ctrlSiteSelectStyleSheet.Value = -1; } } else { // Set parent stylesheet to current document ctrlSiteSelectStyleSheet.Value = value; } } } else { ctrlSiteSelectStyleSheet.Value = Node.GetValue("DocumentStylesheetID"); } } } // Disable new button if document inherit stylesheet bool disableCssSelector = (!isRoot && chkCssStyle.Checked); ctrlSiteSelectStyleSheet.Enabled = !disableCssSelector; ctrlSiteSelectStyleSheet.ButtonNewEnabled = !disableCssSelector; // Initialize Rating control RefreshCntRatingResult(); double rating = 0.0f; if (Node.DocumentRatings > 0) { rating = Node.DocumentRatingValue / Node.DocumentRatings; } ratingControl.MaxRating = 10; ratingControl.CurrentRating = rating; ratingControl.Visible = true; ratingControl.Enabled = false; // Initialize Reset button for rating btnResetRating.Text = GetString("general.reset"); btnResetRating.OnClientClick = "if (!confirm(" + ScriptHelper.GetString(GetString("GeneralProperties.ResetRatingConfirmation")) + ")) return false;"; object[] param = new object[1]; param[0] = Node.DocumentID; plcAdHocForums.Visible = hasAdHocForum; plcAdHocBoards.Visible = hasAdHocBoard; if (!canEdit) { // Disable form editing DisableFormEditing(); } } else { btnResetRating.Visible = false; } }
/// <summary> /// Load event. /// </summary> protected void Page_Load(object sender, EventArgs e) { InitializeForm(); // Score selector is not null only if DisplayScore is true if (mScoreSelector != null) { if ((CurrentMode == "online") && DisplayContacts) { plcScore.Visible = true; int siteId = QueryHelper.GetInteger("siteid", 0); mScoreSelector.Enabled = (siteId > 0) || ((siteId == 0) && (siteSelector.SiteID > 0)); if (siteId == 0) { mScoreSelector.SetValue("SiteID", siteSelector.SiteID); } } else { // Disable loading not visible control mScoreSelector.StopProcessing = true; } } // Show correct filter panel SetCorrectFilterMode(); // Set reset link button UniGrid grid = FilteredControl as UniGrid; if (grid != null && grid.RememberState) { if (mIsAdvancedMode) { btnAdvancedReset.Click += btnReset_Click; } else { btnReset.Click += btnReset_Click; } } else { if (mIsAdvancedMode) { btnAdvancedReset.Visible = false; } else { btnReset.Visible = false; } } // Set privilege level filter if (ShowPrivilegeLevelFilter(grid)) { plcPrivilegeLevel.Visible = true; mShowPrivilegeFilter = true; } else { mShowPrivilegeFilter = false; } // Show group filter only if enabled if (SiteID > 0) { SiteInfo si = SiteInfoProvider.GetSiteInfo(SiteID); if ((si != null) && mIsAdvancedMode) { mShowGroups = ModuleCommands.CommunitySiteHasGroup(si.SiteID); } } // Setup role selector selectNotInRole.SiteID = SiteID; selectRoleElem.SiteID = SiteID; selectRoleElem.CurrentSelector.ResourcePrefix = "addroles"; selectNotInRole.CurrentSelector.ResourcePrefix = "addroles"; selectRoleElem.UseFriendlyMode = true; selectNotInRole.UseFriendlyMode = true; // Setup groups selectors plcGroups.Visible = mShowGroups; if (mSelectInGroups != null) { mSelectInGroups.StopProcessing = !mShowGroups; mSelectInGroups.FormControlParameter = SiteID; } if (mSelectNotInGroups != null) { mSelectNotInGroups.StopProcessing = !mShowGroups; mSelectNotInGroups.FormControlParameter = SiteID; } if (SessionInsteadOfUser && DisplayGuestsByDefault) { plcNickName.Visible = false; plcUserName.Visible = false; } if (QueryHelper.GetBoolean("isonlinemarketing", false)) { // Set disabled modules info (only on On-line marketing tab) ucDisabledModule.TestSettingKeys = "CMSSessionUseDBRepository;CMSEnableOnlineMarketing"; ucDisabledModule.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { UIContext.PropertyTab = PropertyTabEnum.General; // Register the scripts ScriptHelper.RegisterProgress(Page); ScriptHelper.RegisterTooltip(Page); ScriptHelper.RegisterDialogScript(this); // Set user control properties usrOwner = Page.LoadUserControl("~/CMSModules/Membership/FormControls/Users/selectuser.ascx") as FormEngineUserControl; if (usrOwner != null) { usrOwner.ID = "ctrlUsrOwner"; usrOwner.IsLiveSite = false; usrOwner.SetValue("ShowSiteFilter", false); usrOwner.StopProcessing = pnlUIOwner.IsHidden; plcUsrOwner.Controls.Add(usrOwner); } // Init strings pnlDesign.GroupingText = GetString("GeneralProperties.DesignGroup"); pnlCache.GroupingText = GetString("GeneralProperties.CacheGroup"); pnlOther.GroupingText = GetString("GeneralProperties.OtherGroup"); pnlAdvanced.GroupingText = GetString("GeneralProperties.AdvancedGroup"); pnlOwner.GroupingText = GetString("GeneralProperties.OwnerGroup"); // Advanced section mEditableContent = GetString("GeneralProperties.EditableContent"); mForums = GetString("PageProperties.AdHocForum"); mMessageBoards = GetString("PageProperties.MessageBoards"); lnkEditableContent.OnClientClick = "ShowEditableContent(); return false;"; lnkMessageBoards.OnClientClick = "ShowMessageBoards(); return false;"; lnkForums.OnClientClick = "ShowForums(); return false;"; imgEditableContent.ImageUrl = GetImageUrl("CMSModules/CMS_Content/EditableContent/editablecontent.png"); imgMessageBoards.ImageUrl = GetImageUrl("CMSModules/CMS_MessageBoards/module.png"); imgForums.ImageUrl = GetImageUrl("CMSModules/CMS_Forums/module.png"); // Get strings for radio buttons lblCacheMinutes.Text = GetString("GeneralProperties.cacheMinutes"); // Get strings for labels lblNameTitle.Text = GetString("GeneralProperties.Name"); lblNamePathTitle.Text = GetString("GeneralProperties.NamePath"); lblAliasPathTitle.Text = GetString("GeneralProperties.AliasPath"); lblTypeTitle.Text = GetString("GeneralProperties.Type"); lblNodeIDTitle.Text = GetString("GeneralProperties.NodeID"); lblLastModifiedByTitle.Text = GetString("GeneralProperties.LastModifiedBy"); lblLastModifiedTitle.Text = GetString("GeneralProperties.LastModified"); lblLiveURLTitle.Text = GetString("GeneralProperties.LiveURL"); lblPreviewURLTitle.Text = GetString("GeneralProperties.PreviewURL"); lblGUIDTitle.Text = GetString("GeneralProperties.GUID"); lblDocGUIDTitle.Text = GetString("GeneralProperties.DocumentGUID"); lblDocIDTitle.Text = GetString("GeneralProperties.DocumentID"); lblCultureTitle.Text = GetString("GeneralProperties.Culture"); lblCreatedByTitle.Text = GetString("GeneralProperties.CreatedBy"); lblCreatedTitle.Text = GetString("GeneralProperties.Created"); lblOwnerTitle.Text = GetString("GeneralProperties.Owner"); lblCssStyle.Text = GetString("PageProperties.CssStyle"); lblPublishedTitle.Text = GetString("PageProperties.Published"); chkCssStyle.Text = GetString("Metadata.Inherit"); pnlOnlineMarketing.GroupingText = GetString("general.onlinemarketing"); // Set default item value string defaultStyleSheet = "-1"; CssStylesheetInfo cssInfo = CMSContext.CurrentSiteStylesheet; // If current site default style sheet defined, choose it if (cssInfo != null) { defaultStyleSheet = "default"; } ctrlSiteSelectStyleSheet.CurrentSelector.SpecialFields = new string[, ] { { GetString("general.defaultchoice"), defaultStyleSheet } }; ctrlSiteSelectStyleSheet.ReturnColumnName = "StyleSheetID"; ctrlSiteSelectStyleSheet.SiteId = CMSContext.CurrentSiteID; if ((CMSContext.CurrentSite != null) && (usrOwner != null)) { usrOwner.SetValue("SiteID", CMSContext.CurrentSite.SiteID); } int documentId = 0; string script = null; TreeNode node = Node; if (node != null) { // Create wireframe option if (node.NodeWireframeTemplateID <= 0) { mWireframe = GetString("Wireframe.Create"); string createUrl = URLHelper.ResolveUrl(String.Format("~/CMSModules/Content/CMSDesk/Properties/CreateWireframe.aspx?nodeid={0}&culture={1}", node.NodeID, node.DocumentCulture)); lnkWireframe.OnClientClick = "parent.location.replace('" + createUrl + "'); return false;"; imgWireframe.ImageUrl = GetImageUrl("CMSModules/CMS_Content/EditMenu/createwireframe.png"); } else { mWireframe = GetString("Wireframe.Remove"); imgWireframe.ImageUrl = GetImageUrl("CMSModules/CMS_Content/EditMenu/removewireframe.png"); lnkWireframe.OnClientClick = "return confirm('" + GetString("Wireframe.ConfirmRemove") + "')"; lnkWireframe.Click += new EventHandler(lnkWireframe_Click); } plcWireframe.Visible = PortalHelper.IsWireframingEnabled(CMSContext.CurrentSiteName); documentId = node.DocumentID; canEditOwner = (CMSContext.CurrentUser.IsAuthorizedPerDocument(Node, NodePermissionsEnum.ModifyPermissions) == AuthorizationResultEnum.Allowed); ctrlSiteSelectStyleSheet.AliasPath = node.NodeAliasPath; ReloadData(); // Check ad-hoc forum counts hasAdHocForum = (ModuleCommands.ForumsGetDocumentForumsCount(node.DocumentID) > 0); // Ad-Hoc message boards check hasAdHocBoard = (ModuleCommands.MessageBoardGetDocumentBoardsCount(node.DocumentID) > 0); script += "function ShowEditableContent() { modalDialog('" + ResolveUrl("Advanced/EditableContent/default.aspx") + "?nodeid=" + node.NodeID + "', 'EditableContent', 1015, 700); } \n"; } // Generate executive script if (hasAdHocBoard) { plcAdHocBoards.Visible = true; script += "function ShowMessageBoards() { modalDialog('" + ResolveUrl("~/CMSModules/MessageBoards/Content/Properties/default.aspx") + "?documentid=" + documentId + "', 'MessageBoards', 1020, 680); } \n"; } if (hasAdHocForum) { plcAdHocForums.Visible = true; script += "function ShowForums() { modalDialog('" + ResolveUrl("~/CMSModules/Forums/Content/Properties/default.aspx") + "?documentid=" + documentId + "', 'Forums', 1130, 680); } \n"; } ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ModalDialogsToAdvancedSection", ScriptHelper.GetScript(script)); // Reflect processing action pnlContent.Enabled = DocumentManager.AllowSave; if (chkCssStyle.Checked) { // Enable the edit button ctrlSiteSelectStyleSheet.ButtonEditEnabled = true; } }
/// <summary> /// Loads group selector control to the page. /// </summary> /// <param name="siteId">Site ID</param> /// <returns>Returns true if site contains group and group selector was loaded</returns> private bool AddGroupSelector(int siteId) { SiteInfo si = SiteInfoProvider.GetSiteInfo(siteId); if ((si != null) && (ModuleCommands.CommunitySiteHasGroup(si.SiteID))) { groupsControl = Page.LoadUserControl("~/CMSModules/Groups/FormControls/MultipleGroupSelector.ascx") as FormEngineUserControl; if (groupsControl != null) { groupsControl.FormControlParameter = siteId; groupsControl.IsLiveSite = false; groupsControl.ID = "selectgroups"; groupsControl.ShortID = "sg"; groupsControl.SetValue("ReturnColumnName", "GroupID"); plcGroupSelector.Controls.Add(groupsControl); return true; } } return false; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); // Show panel with message how to enable indexing ucDisabledModule.SettingsKeys = "CMSSearchIndexingEnabled"; ucDisabledModule.InfoText = GetString("srch.searchdisabledinfo"); // Module forums is not available if (!(ModuleManager.IsModuleLoaded(ModuleName.FORUMS))) { return; } selForum = LoadUserControl("~/CMSModules/Forums/FormControls/ForumSelector.ascx") as FormEngineUserControl; if (selForum != null) { // Set default vaules for forum selector selForum.IsLiveSite = false; selForum.SetValue("selectionmode", SelectionModeEnum.MultipleTextBox); selForum.SetValue("DisplayAdHocOption", false); plcForumSelector.Controls.Add(selForum); } // Set events and default values for site selector selSite.AllowAll = false; selSite.UseCodeNameForSelection = true; selSite.DropDownSingleSelect.AutoPostBack = true; selSite.UniSelector.OnSelectionChanged += UniSelector_OnSelectionChanged; LoadControls(); if (ItemType == SearchIndexSettingsInfo.TYPE_ALLOWED) { selSite.AllowAll = true; } var siteIDs = SearchIndexSiteInfoProvider.GetIndexSiteBindings(ItemID).Column("IndexSiteID").Select(X => X.IndexSiteID.ToString()).ToList(); if (siteIDs.Count > 0) { var siteWhere = SqlHelper.GetWhereCondition<string>("SiteID", siteIDs, false); // Preselect current site if it is assigned to index var sisiId = QueryHelper.GetGuid("guid", Guid.Empty); var isNew = sisiId == Guid.Empty; if (!RequestHelper.IsPostBack() && isNew && siteIDs.Contains(SiteContext.CurrentSiteID.ToString())) { selSite.Value = SiteContext.CurrentSiteName; } selSite.UniSelector.WhereCondition = siteWhere; } else { selSite.Enabled = false; selForum.Enabled = false; btnOk.Enabled = false; ShowError(GetString("srch.index.nositeselected")); } selSite.Reload(true); selForum.SetValue("SiteName", Convert.ToString(selSite.Value)); // Init controls if (!RequestHelper.IsPostBack()) { SetControlsStatus(); } }
protected void Page_Load(object sender, EventArgs e) { // Show panel with message how to enable indexing ucDisabledModule.SettingsKeys = "CMSSearchIndexingEnabled"; ucDisabledModule.InfoText = GetString("srch.searchdisabledinfo"); // Module forums is not available if (!(ModuleEntry.IsModuleRegistered(ModuleEntry.FORUMS) && ModuleEntry.IsModuleLoaded(ModuleEntry.FORUMS))) { return; } selForum = this.LoadUserControl("~/CMSModules/Forums/FormControls/ForumSelector.ascx") as FormEngineUserControl; if (selForum != null) { selForum.IsLiveSite = false; plcForumSelector.Controls.Add(selForum); } selSite.AllowAll = false; selSite.UseCodeNameForSelection = true; string siteWhere = String.Empty; DataSet ds = SearchIndexSiteInfoProvider.GetIndexSites("SiteID", "IndexID = " + ItemID, null, 0); if (!DataHelper.DataSourceIsEmpty(ds)) { foreach (DataRow dr in ds.Tables[0].Rows) { siteWhere += dr["SiteID"] + ","; } siteWhere = "," + siteWhere; // Preselect current site if it is assigned to index if (!RequestHelper.IsPostBack() && siteWhere.Contains("," + CMSContext.CurrentSiteID + ",")) { selSite.Value = CMSContext.CurrentSiteName; } siteWhere = siteWhere.Trim(','); siteWhere = "SiteID IN (" + siteWhere + ")"; selSite.UniSelector.WhereCondition = siteWhere; } else { selSite.Enabled = false; selForum.Enabled = false; btnOk.Enabled = false; ShowError(GetString("srch.index.nositeselected")); } // Set default vaules for forum selector selForum.SetValue("selectionmode", SelectionModeEnum.MultipleTextBox); selForum.SetValue("DisplayAdHocOption", false); selForum.SetValue("SiteName", Convert.ToString(selSite.Value)); // Set events and default values for site selector selSite.UniSelector.OnSelectionChanged += new EventHandler(UniSelector_OnSelectionChanged); selSite.DropDownSingleSelect.AutoPostBack = true; LoadControls(); if (ItemType == SearchIndexSettingsInfo.TYPE_ALLOWED) { selSite.AllowAll = true; } // Init controls if (!RequestHelper.IsPostBack()) { selForum.Enabled = true; string siteName = ValidationHelper.GetString(selSite.Value, String.Empty); if (String.IsNullOrEmpty(siteName) || (siteName == "-1")) { selForum.Enabled = false; } else { selForum.SetValue("SiteName", siteName); SetControlsStatus(false); } } }
protected void Page_Load(object sender, EventArgs e) { // Show panel with message how to enable indexing if (!smartSearchEnabled) { pnlDisabled.Visible = true; } // Module forums is not available if (!(ModuleEntry.IsModuleRegistered(ModuleEntry.FORUMS) && ModuleEntry.IsModuleLoaded(ModuleEntry.FORUMS))) { return; } selForum = this.LoadControl("~/CMSModules/Forums/FormControls/ForumSelector.ascx") as FormEngineUserControl; if (selForum != null) { selForum.IsLiveSite = false; plcForumSelector.Controls.Add(selForum); } this.selSite.AllowAll = false; this.selSite.UseCodeNameForSelection = true; string siteWhere = String.Empty; DataSet ds = SearchIndexSiteInfoProvider.GetIndexSites("SiteID", "IndexID = " + ItemID, null, 0); if (!DataHelper.DataSourceIsEmpty(ds)) { foreach (DataRow dr in ds.Tables[0].Rows) { siteWhere += dr["SiteID"] + ","; } siteWhere = "," + siteWhere; // Preselect current site if it is assigned to index if (!RequestHelper.IsPostBack() && siteWhere.Contains("," + CMSContext.CurrentSiteID + ",")) { this.selSite.Value = CMSContext.CurrentSiteName; } siteWhere = siteWhere.Trim(','); siteWhere = "SiteID IN (" + siteWhere + ")"; this.selSite.UniSelector.WhereCondition = siteWhere; } else { selSite.Enabled = false; selForum.Enabled = false; btnOk.Enabled = false; lblInfo.Visible = true; lblInfo.Text = GetString("srch.index.nositeselected"); } // Set default vaules for forum selector this.selForum.SetValue("selectionmode", SelectionModeEnum.MultipleTextBox); this.selForum.SetValue("DisplayAdHocOption", false); this.selForum.SetValue("SiteName", Convert.ToString(selSite.Value)); // Set events and default values for site selector this.selSite.UniSelector.OnSelectionChanged += new EventHandler(UniSelector_OnSelectionChanged); this.selSite.DropDownSingleSelect.AutoPostBack = true; this.LoadControls(); if (ItemType == SearchIndexSettingsInfo.TYPE_ALLOWED) { this.selSite.AllowAll = true; } // Init controls if (!RequestHelper.IsPostBack()) { selForum.Enabled = true; string siteName = ValidationHelper.GetString(selSite.Value, String.Empty); if (String.IsNullOrEmpty(siteName) || (siteName == "-1")) { selForum.Enabled = false; } else { selForum.SetValue("SiteName", siteName); SetControlsStatus(false); } } }
private void ReloadData() { if (node != null) { // Check read permissions if (CMSContext.CurrentUser.IsAuthorizedPerDocument(node, NodePermissionsEnum.Read) == AuthorizationResultEnum.Denied) { RedirectToAccessDenied(String.Format(GetString("cmsdesk.notauthorizedtoreaddocument"), node.NodeAliasPath)); } else { // Log activities checkboxes if (!RequestHelper.IsPostBack()) { bool? logVisit = node.DocumentLogVisitActivity; chkLogPageVisit.Checked = (logVisit == true); chkPageVisitInherit.Checked = (logVisit == null); chkLogPageVisit.Enabled = !chkPageVisitInherit.Checked; if (logVisit == null) { chkPageVisitInherit_CheckedChanged(null, EventArgs.Empty); } } // Show document group owner selector if (ModuleEntry.IsModuleLoaded(ModuleEntry.COMMUNITY) && canEditOwner && LicenseHelper.CheckFeature(URLHelper.GetCurrentDomain(), FeatureEnum.Groups)) { plcOwnerGroup.Controls.Clear(); // Initialize table TableRow rowOwner = new TableRow(); TableCell cellTitle = new TableCell(); TableCell cellSelector = new TableCell(); // Initialize caption LocalizedLabel lblOwnerGroup = new LocalizedLabel(); lblOwnerGroup.EnableViewState = false; lblOwnerGroup.ResourceString = "community.group.documentowner"; lblOwnerGroup.ID = "lblOwnerGroup"; cellTitle.Controls.Add(lblOwnerGroup); // Initialize selector fcDocumentGroupSelector = (FormEngineUserControl)Page.LoadControl("~/CMSAdminControls/UI/Selectors/DocumentGroupSelector.ascx"); fcDocumentGroupSelector.ID = "fcDocumentGroupSelector"; fcDocumentGroupSelector.StopProcessing = this.pnlUIOwner.IsHidden; cellSelector.Controls.Add(fcDocumentGroupSelector); fcDocumentGroupSelector.Value = ValidationHelper.GetInteger(node.GetValue("NodeGroupID"), 0); fcDocumentGroupSelector.SetValue("siteid", CMSContext.CurrentSiteID); fcDocumentGroupSelector.SetValue("nodeid", nodeId); // Add controls to containers rowOwner.Cells.Add(cellTitle); rowOwner.Cells.Add(cellSelector); plcOwnerGroup.Controls.Add(rowOwner); plcOwnerGroup.Visible = true; } // Check modify permissions if (CMSContext.CurrentUser.IsAuthorizedPerDocument(node, NodePermissionsEnum.Modify) == AuthorizationResultEnum.Denied) { // disable form editing DisableFormEditing(); // show access denied message lblInfo.Text = String.Format(GetString("cmsdesk.notauthorizedtoeditdocument"), node.NodeAliasPath); lblInfo.Visible = true; } // Show owner editing only when authorized to change the permissions if (canEditOwner) { lblOwner.Visible = false; usrOwner.Visible = true; usrOwner.SetValue("AdditionalUsers", new int[] { node.NodeOwner }); } else { usrOwner.Visible = false; } if (!RequestHelper.IsPostBack()) { if (canEditOwner) { usrOwner.Value = node.GetValue("NodeOwner"); } // Search chkExcludeFromSearch.Checked = node.DocumentSearchExcluded; } // Load the data lblName.Text = HttpUtility.HtmlEncode(node.DocumentName); lblNamePath.Text = HttpUtility.HtmlEncode(Convert.ToString(node.GetValue("DocumentNamePath"))); lblAliasPath.Text = Convert.ToString(node.NodeAliasPath); string typeName = DataClassInfoProvider.GetDataClass(node.NodeClassName).ClassDisplayName; lblType.Text = HttpUtility.HtmlEncode(ResHelper.LocalizeString(typeName)); lblNodeID.Text = Convert.ToString(node.NodeID); // Modifier SetUserLabel(lblLastModifiedBy, "DocumentModifiedByUserId"); // Get modified time TimeZoneInfo usedTimeZone = null; DateTime lastModified = ValidationHelper.GetDateTime(node.GetValue("DocumentModifiedWhen"), DateTimeHelper.ZERO_TIME); lblLastModified.Text = TimeZoneHelper.GetCurrentTimeZoneDateTimeString(lastModified, CMSContext.CurrentUser, CMSContext.CurrentSite, out usedTimeZone); ScriptHelper.AppendTooltip(lblLastModified, TimeZoneHelper.GetGMTLongStringOffset(usedTimeZone), "help"); if (!canEditOwner) { // Owner SetUserLabel(lblOwner, "NodeOwner"); } // Creator SetUserLabel(lblCreatedBy, "DocumentCreatedByUserId"); DateTime createdWhen = ValidationHelper.GetDateTime(node.GetValue("DocumentCreatedWhen"), DateTimeHelper.ZERO_TIME); lblCreated.Text = TimeZoneHelper.GetCurrentTimeZoneDateTimeString(createdWhen, CMSContext.CurrentUser, CMSContext.CurrentSite, out usedTimeZone); ScriptHelper.AppendTooltip(lblCreated, TimeZoneHelper.GetGMTLongStringOffset(usedTimeZone), "help"); // URL string liveUrl = node.IsLink ? CMSContext.GetUrl(node.NodeAliasPath, null) : CMSContext.GetUrl(node.NodeAliasPath, node.DocumentUrlPath); lnkLiveURL.Text = ResolveUrl(liveUrl); lnkLiveURL.NavigateUrl = liveUrl; bool isRoot = (node.NodeClassName.ToLower() == "cms.root"); // Preview URL if (!isRoot) { plcPreview.Visible = true; string path = canEdit ? "/CMSModules/CMS_Content/Properties/resetlink.png" : "/CMSModules/CMS_Content/Properties/resetlinkdisabled.png"; btnResetPreviewGuid.ImageUrl = GetImageUrl(path); btnResetPreviewGuid.ToolTip = GetString("GeneralProperties.InvalidatePreviewURL"); btnResetPreviewGuid.ImageAlign = ImageAlign.AbsBottom; btnResetPreviewGuid.Click += new ImageClickEventHandler(btnResetPreviewGuid_Click); btnResetPreviewGuid.OnClientClick = "if(!confirm('" + GetString("GeneralProperties.GeneratePreviewURLConf") + "')){return false;}"; InitPreviewUrl(); } lblGUID.Text = Convert.ToString(node.NodeGUID); lblDocGUID.Text = (node.DocumentGUID == Guid.Empty) ? ResHelper.Dash : node.DocumentGUID.ToString(); lblDocID.Text = Convert.ToString(node.DocumentID); // Culture CultureInfo ci = CultureInfoProvider.GetCultureInfo(node.DocumentCulture); lblCulture.Text = ((ci != null) ? ResHelper.LocalizeString(ci.CultureName) : node.DocumentCulture); lblPublished.Text = (node.IsPublished ? "<span class=\"DocumentPublishedYes\">" + GetString("General.Yes") + "</span>" : "<span class=\"DocumentPublishedNo\">" + GetString("General.No") + "</span>"); if (!RequestHelper.IsPostBack()) { // Init radio buttons for cache settings if (isRoot) { radInherit.Visible = false; chkCssStyle.Visible = false; switch (node.NodeCacheMinutes) { case -1: // Cache is off radNo.Checked = true; radYes.Checked = false; radInherit.Checked = false; txtCacheMinutes.Text = ""; break; case 0: // Cache is off radNo.Checked = true; radYes.Checked = false; radInherit.Checked = false; txtCacheMinutes.Text = ""; break; default: // Cache is enabled radNo.Checked = false; radYes.Checked = true; radInherit.Checked = false; txtCacheMinutes.Text = node.NodeCacheMinutes.ToString(); break; } } else { switch (node.NodeCacheMinutes) { case -1: // Cache setting is inherited radNo.Checked = false; radYes.Checked = false; radInherit.Checked = true; txtCacheMinutes.Text = ""; break; case 0: // Cache is off radNo.Checked = true; radYes.Checked = false; radInherit.Checked = false; txtCacheMinutes.Text = ""; break; default: // Cache is enabled radNo.Checked = false; radYes.Checked = true; radInherit.Checked = false; txtCacheMinutes.Text = node.NodeCacheMinutes.ToString(); break; } } if (!radYes.Checked) { txtCacheMinutes.Enabled = false; } } if (!RequestHelper.IsPostBack()) { if (node.GetValue("DocumentStylesheetID") == null) { // If default site not exist edit is set to -1 - disabled if (CMSContext.CurrentSiteStylesheet != null) { ctrlSiteSelectStyleSheet.Value = "default"; } else { ctrlSiteSelectStyleSheet.Value = -1; } } else { // If stylesheet is inherited from parent document if (ValidationHelper.GetInteger(node.GetValue("DocumentStylesheetID"), 0) == -1) { if (!isRoot) { chkCssStyle.Checked = true; // Get parent stylesheet string value = PageInfoProvider.GetParentProperty(CMSContext.CurrentSite.SiteID, node.NodeAliasPath, "(DocumentStylesheetID <> -1 OR DocumentStylesheetID IS NULL) AND DocumentCulture = N'" + SqlHelperClass.GetSafeQueryString(node.DocumentCulture, false) + "'", "DocumentStylesheetID"); if (String.IsNullOrEmpty(value)) { // If default site stylesheet not exist edit is set to -1 - disabled if (CMSContext.CurrentSiteStylesheet != null) { ctrlSiteSelectStyleSheet.Value = "default"; } else { ctrlSiteSelectStyleSheet.Value = -1; } } else { // Set parent stylesheet to current document ctrlSiteSelectStyleSheet.Value = value; } } } else { ctrlSiteSelectStyleSheet.Value = node.GetValue("DocumentStylesheetID"); } } } // Disable new button if document inherit stylesheet if (!isRoot && chkCssStyle.Checked) { ctrlSiteSelectStyleSheet.Enabled = false; ctrlSiteSelectStyleSheet.ButtonNew.Enabled = false; } // Initialize Rating control RefreshCntRatingResult(); double rating = 0.0f; if (node.DocumentRatings > 0) { rating = node.DocumentRatingValue / node.DocumentRatings; } ratingControl.MaxRating = 10; ratingControl.CurrentRating = rating; ratingControl.Visible = true; ratingControl.Enabled = false; // Initialize Reset button for rating btnResetRating.Text = GetString("general.reset"); btnResetRating.OnClientClick = "if (!confirm(" + ScriptHelper.GetString(GetString("GeneralProperties.ResetRatingConfirmation")) + ")) return false;"; object[] param = new object[1]; param[0] = node.DocumentID; // Check ad-hoc forum counts hasAdHocForum = (ModuleCommands.ForumsGetDocumentForumsCount(node.DocumentID) > 0); // Ad-Hoc message boards check hasAdHocBoard = (ModuleCommands.MessageBoardGetDocumentBoardsCount(node.DocumentID) > 0); plcAdHocForums.Visible = hasAdHocForum; plcAdHocBoards.Visible = hasAdHocBoard; } } else { btnResetRating.Visible = false; } }
/// <summary> /// Configures selectors. /// </summary> private void SetupSelectors() { // Setup role selector selectRole.CurrentSelector.SelectionMode = SelectionModeEnum.MultipleButton; selectRole.CurrentSelector.OnItemsSelected += RolesSelector_OnItemsSelected; selectRole.CurrentSelector.ReturnColumnName = "RoleID"; selectRole.CurrentSelector.ButtonImage = GetImageUrl("Objects/CMS_Role/add.png"); selectRole.CurrentSelector.DialogLink.CssClass = "MenuItemEdit Pad"; selectRole.ShowSiteFilter = false; selectRole.CurrentSelector.ResourcePrefix = "addroles"; selectRole.CurrentSelector.DialogButton.CssClass = "LongButton"; selectRole.IsLiveSite = false; selectRole.UseCodeNameForSelection = false; selectRole.GlobalRoles = false; // Setup user selector selectUser.SelectionMode = SelectionModeEnum.MultipleButton; selectUser.UniSelector.OnItemsSelected += UserSelector_OnItemsSelected; selectUser.UniSelector.ReturnColumnName = "UserID"; selectUser.UniSelector.DisplayNameFormat = "{%FullName%} ({%Email%})"; selectUser.UniSelector.ButtonImage = GetImageUrl("Objects/CMS_User/add.png"); selectUser.UniSelector.AdditionalSearchColumns = "UserName, Email"; selectUser.UniSelector.DialogLink.CssClass = "MenuItemEdit Pad"; selectUser.ShowSiteFilter = false; selectUser.ResourcePrefix = "newsletteraddusers"; selectUser.UniSelector.DialogButton.CssClass = "LongButton"; selectUser.IsLiveSite = false; // Setup subscriber selector selectSubscriber.UniSelector.SelectionMode = SelectionModeEnum.MultipleButton; selectSubscriber.UniSelector.OnItemsSelected += SubscriberSelector_OnItemsSelected; selectSubscriber.UniSelector.ReturnColumnName = "SubscriberID"; selectSubscriber.UniSelector.ButtonImage = GetImageUrl("Objects/Newsletter_Subscriber/add.png"); selectSubscriber.UniSelector.DialogLink.CssClass = "MenuItemEdit Pad"; selectSubscriber.ShowSiteFilter = false; selectSubscriber.UniSelector.DialogButton.CssClass = "LongButton"; selectSubscriber.IsLiveSite = false; selectSubscriber.UniSelector.RemoveMultipleCommas = true; // Setup contact group and contact selectors if (ModuleEntry.IsModuleLoaded(ModuleEntry.ONLINEMARKETING) && LicenseHelper.CheckFeature(URLHelper.GetCurrentDomain(), FeatureEnum.ContactManagement)) { plcSelectCG.Controls.Clear(); // Check read permission for contact groups if (CMSContext.CurrentUser.IsAuthorizedPerResource(ModuleEntry.CONTACTMANAGEMENT, "ReadContactGroups")) { // Load selector control and initialize it cgSelector = (FormEngineUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/FormControls/ContactGroupSelector.ascx"); if (cgSelector != null) { cgSelector.ID = "selectCG"; cgSelector.ShortID = "scg"; // Get inner uniselector control UniSelector selector = (UniSelector)cgSelector.GetValue("uniselector"); if (selector != null) { // Bind an event handler on 'items selected' event selector.OnItemsSelected += CGSelector_OnItemsSelected; selector.ResourcePrefix = "contactgroupsubscriber"; } // Insert selector to the header plcSelectCG.Controls.Add(cgSelector); } } // Check read permission for contacts if (CMSContext.CurrentUser.IsAuthorizedPerResource(ModuleEntry.CONTACTMANAGEMENT, "ReadContacts")) { // Load selector control and initialize it cSelector = (FormEngineUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/FormControls/ContactSelector.ascx"); if (cSelector != null) { cSelector.ID = "slContact"; cSelector.ShortID = "sc"; // Set where condition to filter contacts with email addresses cSelector.SetValue("wherecondition", "NOT (ContactEmail IS NULL OR ContactEmail LIKE '')"); // Set site ID cSelector.SetValue("siteid", CMSContext.CurrentSiteID); // Get inner uniselector control UniSelector selector = (UniSelector)cSelector.GetValue("uniselector"); if (selector != null) { // Bind an event handler on 'items selected' event selector.OnItemsSelected += ContactSelector_OnItemsSelected; selector.SelectionMode = SelectionModeEnum.MultipleButton; selector.ResourcePrefix = "contactsubscriber"; selector.ButtonImage = GetImageUrl("/Objects/OM_Contact/add.png"); selector.DisplayNameFormat = "{%ContactFirstName%} {%ContactLastName%} ({%ContactEmail%})"; selector.AdditionalSearchColumns = "ContactFirstName,ContactMiddleName,ContactEmail"; } // Insert selector to the header plcSelectCG.Controls.Add(cSelector); } } } // Initialize mass actions if (drpActions.Items.Count == 0) { drpActions.Items.Add(new ListItem(GetString("general.selectaction"), SELECT)); drpActions.Items.Add(new ListItem(GetString("newsletter.unsubscribelink"), UNSUBSCRIBE)); drpActions.Items.Add(new ListItem(GetString("newsletter.renewsubscription"), SUBSCRIBE)); drpActions.Items.Add(new ListItem(GetString("newsletter.approvesubscription"), APPROVE)); drpActions.Items.Add(new ListItem(GetString("newsletter.rejectsubscription"), REJECT)); drpActions.Items.Add(new ListItem(GetString("newsletter.deletesubscription"), REMOVE)); } }