protected void Page_Load(object sender, EventArgs e) { btnSignOut.OnClientClick = SignOutScriptHelper.GetSignOutOnClickScript(this); string title = GetString("CMSDesk.AccessDenied"); string message = GetString("CMSMessages.AccessDenied"); GetTexts(ref message, ref title); lblMessage.Text = message; titleElem.TitleText = title; // Display SignOut button if (AuthenticationHelper.IsAuthenticated()) { if (!AuthenticationMode.IsWindowsAuthentication()) { btnSignOut.Visible = true; } } else { btnLogin.Visible = true; } }
/// <summary> /// Checks Sign out link settings. /// </summary> private bool EnsureSignOut() { if (AuthenticationMode.IsWindowsAuthentication()) { // Hide sign out link lnkSignOut.Visible = false; return(false); } // Get third party providers' logout scripts string logoutScript = SignOutScriptHelper.GetSignOutOnClickScript(Page); if (!String.IsNullOrEmpty(logoutScript)) { // If a script was provided, check changes first, before executing it logoutScript = "if (CheckChanges()) { " + logoutScript + " } return false; "; } else { // If no javascript logout was registered, just check changes logoutScript = "return CheckChanges();"; } lnkSignOut.OnClientClick = logoutScript; return(true); }
/// <summary> /// Checks Sign out link settings. /// </summary> private bool EnsureSignOut() { if (AuthenticationMode.IsWindowsAuthentication()) { // Hide sign out link lnkSignOut.Visible = false; return(false); } lnkSignOut.OnClientClick = "return CheckChanges();"; return(true); }
/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (StopProcessing) { // Do not process } else { // Show only desired button btnSignOut.Visible = !ShowAsLink; btnSignOutLink.Visible = ShowAsLink; if (!MembershipContext.AuthenticatedUser.IsPublic()) { // Hide for windows authentication if (AuthenticationMode.IsWindowsAuthentication()) { Visible = false; } else { // Set signout text btnSignOutLink.Text = SignOutText; btnSignOut.Text = SignOutText; // Set logout scripts string logOutScript = SignOutScriptHelper.GetSignOutOnClickScript(Page); btnSignOutLink.OnClientClick = logOutScript; btnSignOut.OnClientClick = logOutScript; } } else { // Set signin text btnSignOutLink.Text = SignInText; btnSignOut.Text = SignInText; } } if (!StandAlone && (PageCycle < PageCycleEnum.Initialized) && (ValidationHelper.GetString(Page.StyleSheetTheme, "") == "")) { btnSignOut.SkinID = SkinID; } // if user is not authenticated and ShowOnlyWhenAuthenticated is set if (MembershipContext.AuthenticatedUser.IsPublic() && ShowOnlyWhenAuthenticated) { Visible = false; } }
/// <summary> /// Page load event. /// </summary> protected void Page_Load(object sender, EventArgs e) { var enabled = SecurityHelper.IsScreenLockEnabled(SiteContext.CurrentSiteName); Visible = enabled; if (!enabled) { return; } // Set title text and image screenLockTitle.TitleText = GetString("settingscategory.cmsscreenlock"); lblInstructions.Text = GetString("screenlock.instruction"); var user = GetUserForAuthentication(); txtUserName.Text = user.UserName; // Set account locked information if (AuthenticationHelper.DisplayAccountLockInformation(SiteContext.CurrentSiteName)) { lblScreenLockWarningLogonAttempts.Text = GetString("invalidlogonattempts.unlockaccount.accountlocked"); } else { lblScreenLockWarningLogonAttempts.Text = GetString("screenlock.loginfailure"); } lblScreenLockWarningLogonAttempts.Text += " " + GetString("screenlock.loggedout"); // Hide password field for Active directory users when Windows authentication is used if (user.UserIsDomain && AuthenticationMode.IsWindowsAuthentication()) { lblPassword.Visible = false; txtScreenLockDialogPassword.Visible = false; btnScreenLockSignOut.Visible = false; } else { lblInstructions.Text += " " + GetString("screenlock.instruction.part2"); } ScriptHelper.RegisterJQueryDialog(Page); }
protected void Page_Load(object sender, EventArgs e) { CurrentMaster.Title.HideTitle = false; btnSignOut.OnClientClick = SignOutScriptHelper.GetSignOutOnClickScript(this); // Setup page title text and image string title = GetString("CMSDesk.AccessDenied"); string message = GetString("CMSDesk.IsNotEditorMsg"); bool hideLinks = GetTexts(ref message, ref title); lblMessage.Text = message; hdnPermission.Text = PageTitle.TitleText = title; // hide signout button for not authenticated users if (!AuthenticationHelper.IsAuthenticated()) { btnSignOut.Visible = false; } if (!hideLinks) { lnkGoBack.Text = GetString("CMSDesk.GoBack"); // Hide for windows authentication if (AuthenticationMode.IsWindowsAuthentication()) { btnSignOut.Visible = false; } } else { btnSignOut.Style.Add("display", "none"); lnkGoBack.Visible = false; } // Handle dialog CMSDialogHelper.RegisterDialogHelper(this); var script = String.Format("HandleAspxPageDialog('{0}');", CurrentMaster.PanelHeader.ClientID); ScriptHelper.RegisterStartupScript(this, typeof(string), "HandleAspxPageDialog", script, true); }
/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (StopProcessing) { // Do nothing } else { plcOther.Controls.Clear(); if (AuthenticationHelper.IsAuthenticated()) { // Set the layout of tab menu tabMenu.TabControlLayout = BasicTabControl.GetTabMenuLayout(TabControlLayout); // Remove 'saved' parameter from query string string absoluteUri = URLHelper.RemoveParameterFromUrl(RequestContext.CurrentURL, "saved"); var currentUser = MembershipContext.AuthenticatedUser; // Get customer info GeneralizedInfo customer = null; int customerId = 0; var emptyCustomer = ModuleManager.GetReadOnlyObject(PredefinedObjectType.CUSTOMER); if (emptyCustomer != null) { var q = emptyCustomer.Generalized.GetDataQuery( true, s => s .WhereEquals("CustomerUserID", currentUser.UserID) .OrderBy("CustomerCreated") .TopN(1), false ); var result = q.Result; if (!DataHelper.DataSourceIsEmpty(result)) { customer = ModuleManager.GetObject(result.Tables[0].Rows[0], PredefinedObjectType.CUSTOMER); customerId = customer.ObjectID; } } // Selected page URL string selectedPage = string.Empty; // Menu initialization tabMenu.UrlTarget = "_self"; ArrayList activeTabs = new ArrayList(); // Handle 'Notifications' tab displaying bool showNotificationsTab = (DisplayMyNotifications && LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.Notifications, ModuleName.NOTIFICATIONS)); bool isWindowsAuthentication = AuthenticationMode.IsWindowsAuthentication(); string tabName; // Personal tab if (DisplayMyPersonalSettings) { tabName = personalTab; activeTabs.Add(tabName); tabMenu.TabItems.Add(new TabItem() { Text = GetString("MyAccount.MyPersonalSettings"), RedirectUrl = URLHelper.AddParameterToUrl(absoluteUri, ParameterName, personalTab) }); if (currentUser != null) { selectedPage = tabName; } } // These items can be displayed only for customer if ((customer != null) && ModuleEntryManager.IsModuleLoaded(ModuleName.ECOMMERCE)) { if (DisplayMyDetails) { // Try to load the control dynamically (if available) ucMyDetails = Page.LoadUserControl("~/CMSModules/Ecommerce/Controls/MyDetails/MyDetails.ascx") as CMSAdminControl; if (ucMyDetails != null) { ucMyDetails.ID = "ucMyDetails"; plcOther.Controls.Add(ucMyDetails); // Set new tab tabName = detailsTab; activeTabs.Add(tabName); tabMenu.TabItems.Add(new TabItem() { Text = GetString("MyAccount.MyDetails"), RedirectUrl = URLHelper.AddParameterToUrl(absoluteUri, ParameterName, detailsTab) }); if (selectedPage == string.Empty) { selectedPage = tabName; } } } if (DisplayMyAddresses) { // Try to load the control dynamically (if available) ucMyAddresses = Page.LoadUserControl("~/CMSModules/Ecommerce/Controls/MyDetails/MyAddresses.ascx") as CMSAdminControl; if (ucMyAddresses != null) { ucMyAddresses.ID = "ucMyAddresses"; plcOther.Controls.Add(ucMyAddresses); // Set new tab tabName = addressesTab; activeTabs.Add(tabName); tabMenu.TabItems.Add(new TabItem() { Text = GetString("MyAccount.MyAddresses"), RedirectUrl = URLHelper.AddParameterToUrl(absoluteUri, ParameterName, addressesTab) }); if (selectedPage == string.Empty) { selectedPage = tabName; } } } if (DisplayMyOrders) { // Try to load the control dynamically (if available) ucMyOrders = Page.LoadUserControl("~/CMSModules/Ecommerce/Controls/MyDetails/MyOrders.ascx") as CMSAdminControl; if (ucMyOrders != null) { ucMyOrders.ID = "ucMyOrders"; plcOther.Controls.Add(ucMyOrders); // Set new tab tabName = ordersTab; activeTabs.Add(tabName); tabMenu.TabItems.Add(new TabItem() { Text = GetString("MyAccount.MyOrders"), RedirectUrl = URLHelper.AddParameterToUrl(absoluteUri, ParameterName, ordersTab) }); if (selectedPage == string.Empty) { selectedPage = tabName; } } } if (DisplayMyCredits) { // Try to load the control dynamically (if available) ucMyCredit = Page.LoadUserControl("~/CMSModules/Ecommerce/Controls/MyDetails/MyCredit.ascx") as CMSAdminControl; if (ucMyCredit != null) { ucMyCredit.ID = "ucMyCredit"; plcOther.Controls.Add(ucMyCredit); // Set new tab tabName = creditTab; activeTabs.Add(tabName); tabMenu.TabItems.Add(new TabItem() { Text = GetString("MyAccount.MyCredit"), RedirectUrl = URLHelper.AddParameterToUrl(absoluteUri, ParameterName, creditTab) }); if (selectedPage == string.Empty) { selectedPage = tabName; } } } } if (DisplayChangePassword && !currentUser.IsExternal && !isWindowsAuthentication) { // Set new tab tabName = passwordTab; activeTabs.Add(tabName); tabMenu.TabItems.Add(new TabItem() { Text = GetString("MyAccount.ChangePassword"), RedirectUrl = URLHelper.AddParameterToUrl(absoluteUri, ParameterName, passwordTab) }); if (selectedPage == string.Empty) { selectedPage = tabName; } } if ((ucMyNotifications == null) && showNotificationsTab) { // Try to load the control dynamically (if available) ucMyNotifications = Page.LoadUserControl("~/CMSModules/Notifications/Controls/UserNotifications.ascx") as CMSAdminControl; if (ucMyNotifications != null) { ucMyNotifications.ID = "ucMyNotifications"; plcOther.Controls.Add(ucMyNotifications); // Set new tab tabName = notificationsTab; activeTabs.Add(tabName); tabMenu.TabItems.Add(new TabItem() { Text = GetString("MyAccount.MyNotifications"), RedirectUrl = URLHelper.AddParameterToUrl(absoluteUri, ParameterName, notificationsTab) }); if (selectedPage == string.Empty) { selectedPage = tabName; } } } if ((ucMyAllSubscriptions == null) && DisplayMySubscriptions) { // Try to load the control dynamically (if available) ucMyAllSubscriptions = Page.LoadUserControl("~/CMSModules/Membership/Controls/Subscriptions.ascx") as CMSAdminControl; if (ucMyAllSubscriptions != null) { // Set control ucMyAllSubscriptions.Visible = false; ucMyAllSubscriptions.SetValue("ShowBlogs", DisplayBlogs); ucMyAllSubscriptions.SetValue("ShowMessageBoards", DisplayMessageBoards); ucMyAllSubscriptions.SetValue("ShowNewsletters", DisplayNewsletters); ucMyAllSubscriptions.SetValue("ShowForums", DisplayForums); ucMyAllSubscriptions.SetValue("ShowReports", DisplayReports); ucMyAllSubscriptions.SetValue("sendconfirmationemail", SendConfirmationEmails); ucMyAllSubscriptions.ID = "ucMyAllSubscriptions"; plcOther.Controls.Add(ucMyAllSubscriptions); // Set new tab tabName = subscriptionsTab; activeTabs.Add(tabName); tabMenu.TabItems.Add(new TabItem() { Text = GetString("MyAccount.MyAllSubscriptions"), RedirectUrl = URLHelper.AddParameterToUrl(absoluteUri, ParameterName, subscriptionsTab) }); if (selectedPage == string.Empty) { selectedPage = tabName; } } } // My memberships if ((ucMyMemberships == null) && DisplayMyMemberships) { // Try to load the control dynamically ucMyMemberships = Page.LoadUserControl("~/CMSModules/Membership/Controls/MyMemberships.ascx") as CMSAdminControl; if (ucMyMemberships != null) { ucMyMemberships.SetValue("UserID", currentUser.UserID); if (!String.IsNullOrEmpty(MembershipsPagePath)) { ucMyMemberships.SetValue("BuyMembershipURL", DocumentURLProvider.GetUrl(MembershipsPagePath)); } plcOther.Controls.Add(ucMyMemberships); // Set new tab tabName = membershipsTab; activeTabs.Add(tabName); tabMenu.TabItems.Add(new TabItem() { Text = GetString("myaccount.mymemberships"), RedirectUrl = URLHelper.AddParameterToUrl(absoluteUri, ParameterName, membershipsTab) }); if (selectedPage == String.Empty) { selectedPage = tabName; } } } if ((ucMyCategories == null) && DisplayMyCategories) { // Try to load the control dynamically (if available) ucMyCategories = Page.LoadUserControl("~/CMSModules/Categories/Controls/Categories.ascx") as CMSAdminControl; if (ucMyCategories != null) { ucMyCategories.Visible = false; ucMyCategories.SetValue("DisplaySiteCategories", false); ucMyCategories.SetValue("DisplaySiteSelector", false); ucMyCategories.ID = "ucMyCategories"; plcOther.Controls.Add(ucMyCategories); // Set new tab tabName = categoriesTab; activeTabs.Add(tabName); tabMenu.TabItems.Add(new TabItem() { Text = GetString("MyAccount.MyCategories"), RedirectUrl = URLHelper.AddParameterToUrl(absoluteUri, ParameterName, categoriesTab) }); if (selectedPage == string.Empty) { selectedPage = tabName; } } } // Set CSS class pnlBody.CssClass = CssClass; // Get page URL page = QueryHelper.GetString(ParameterName, selectedPage); // Set controls visibility ucChangePassword.Visible = false; ucChangePassword.StopProcessing = true; if (ucMyAddresses != null) { ucMyAddresses.Visible = false; ucMyAddresses.StopProcessing = true; } if (ucMyOrders != null) { ucMyOrders.Visible = false; ucMyOrders.StopProcessing = true; } if (ucMyDetails != null) { ucMyDetails.Visible = false; ucMyDetails.StopProcessing = true; } if (ucMyCredit != null) { ucMyCredit.Visible = false; ucMyCredit.StopProcessing = true; } if (ucMyAllSubscriptions != null) { ucMyAllSubscriptions.Visible = false; ucMyAllSubscriptions.StopProcessing = true; ucMyAllSubscriptions.SetValue("CacheMinutes", CacheMinutes); } if (ucMyNotifications != null) { ucMyNotifications.Visible = false; ucMyNotifications.StopProcessing = true; } if (ucMyMemberships != null) { ucMyMemberships.Visible = false; ucMyMemberships.StopProcessing = true; } if (ucMyCategories != null) { ucMyCategories.Visible = false; ucMyCategories.StopProcessing = true; } tabMenu.SelectedTab = activeTabs.IndexOf(page); // Select current page switch (page) { case personalTab: if (myProfile != null) { // Get alternative form info AlternativeFormInfo afi = AlternativeFormInfoProvider.GetAlternativeFormInfo(AlternativeFormName); if (afi != null) { myProfile.StopProcessing = false; myProfile.Visible = true; myProfile.AllowEditVisibility = AllowEditVisibility; myProfile.AlternativeFormName = AlternativeFormName; myProfile.SubmitButtonResourceString = "general.submit"; } else { lblError.Text = String.Format(GetString("altform.formdoesntexists"), AlternativeFormName); lblError.Visible = true; myProfile.Visible = false; } } break; // My details tab case detailsTab: if (ucMyDetails != null) { ucMyDetails.Visible = true; ucMyDetails.StopProcessing = false; ucMyDetails.SetValue("Customer", customer); } break; // My addresses tab case addressesTab: if (ucMyAddresses != null) { ucMyAddresses.Visible = true; ucMyAddresses.StopProcessing = false; ucMyAddresses.SetValue("CustomerId", customerId); } break; // My orders tab case ordersTab: if (ucMyOrders != null) { ucMyOrders.Visible = true; ucMyOrders.StopProcessing = false; ucMyOrders.SetValue("CustomerId", customerId); ucMyOrders.SetValue("ShowOrderTrackingNumber", ShowOrderTrackingNumber); ucMyOrders.SetValue("ShowOrderToShoppingCart", ShowOrderToShoppingCart); } break; // My credit tab case creditTab: if (ucMyCredit != null) { ucMyCredit.Visible = true; ucMyCredit.StopProcessing = false; ucMyCredit.SetValue("CustomerId", customerId); } break; // Password tab case passwordTab: ucChangePassword.Visible = true; ucChangePassword.StopProcessing = false; ucChangePassword.AllowEmptyPassword = AllowEmptyPassword; break; // Notification tab case notificationsTab: if (ucMyNotifications != null) { ucMyNotifications.Visible = true; ucMyNotifications.StopProcessing = false; ucMyNotifications.SetValue("UserId", currentUser.UserID); ucMyNotifications.SetValue("UnigridImageDirectory", UnigridImageDirectory); } break; // My subscriptions tab case subscriptionsTab: if (ucMyAllSubscriptions != null) { ucMyAllSubscriptions.Visible = true; ucMyAllSubscriptions.StopProcessing = false; ucMyAllSubscriptions.SetValue("userid", currentUser.UserID); ucMyAllSubscriptions.SetValue("siteid", SiteContext.CurrentSiteID); } break; // My memberships tab case membershipsTab: if (ucMyMemberships != null) { ucMyMemberships.Visible = true; ucMyMemberships.StopProcessing = false; } break; // My categories tab case categoriesTab: if (ucMyCategories != null) { ucMyCategories.Visible = true; ucMyCategories.StopProcessing = false; } break; } } else { // Hide control if current user is not authenticated Visible = false; } } }
/// <summary> /// Prepares the callback result. /// </summary> public string GetCallbackResult() { var user = GetUserForAuthentication(); if (!user.Enabled) { return("accountLocked"); } if (userValidates) { if (AuthenticationMode.IsWindowsAuthentication()) { return(UnlockScreen()); } // User wants to revalidate his session if (UserInfoProvider.IsUserPasswordDifferent(user, validatePassword)) { // Password is invalid AuthenticationHelper.CheckInvalidPasswordAttempts(user, SiteContext.CurrentSiteName); if (!user.Enabled) { return("accountLocked"); } return("valbad"); } if (userWaitingForPasscode) { return(GeneratePasscode(user)); } // Password is correct return(UnlockScreen()); } if (passcValidates) { var membershipProvider = new CMSMembershipProvider(); if (membershipProvider.MFValidatePasscode(user, validatePasscode, false)) { return(UnlockScreen()); } if (!user.Enabled) { return("accountLocked"); } return("wrongPassc|" + GetString("mfauthentication.passcode.wrong")); } if (CMSPage.IsScreenLocked) { if (userAsksForState) { // Screen is locked return("isLocked|True"); } if (!userIsLoggingOut) { return(""); } // User wants to logout string signOutUrl = UIHelper.GetSignOutUrl(SiteContext.CurrentSite); if (IsCMSDesk) { // LiveID sign out URL is set if this LiveID session AuthenticationHelper.SignOut(ref signOutUrl); } else { AuthenticationHelper.SignOut(); } return("logout|" + signOutUrl); } // Check if ScreenLock is active if (!SecurityHelper.IsScreenLockEnabled(SiteContext.CurrentSiteName)) { return("disabled"); } // User is canceling countdown and wants to stay active if (userCanceling) { SecurityHelper.LogScreenLockAction(); return("cancelOk|" + SecurityHelper.GetSecondsToShowScreenLockAction(SiteContext.CurrentSiteName)); } if ((int)timeLeft.TotalSeconds <= 0) { // User was inactive too long - lock screen CMSPage.IsScreenLocked = true; return("lockScreen"); } if ((int)timeLeft.TotalSeconds <= secondsToWarning) { // Lock screen timeout is close - display warning return("showWarning|" + ((int)timeLeft.TotalSeconds).ToString()); } // User is active - hide warning and lock screen (if opened) return("hideWarning|" + ((int)timeLeft.TotalSeconds - secondsToWarning).ToString()); }
/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (StopProcessing) { // Do nothing } else { // Initialize properties string script = ""; // Set current user currentUser = MembershipContext.AuthenticatedUser; // Initialize strings lnkSignIn.Text = SignInText; lnkJoinCommunity.Text = JoinCommunityText; lnkMyProfile.Text = MyProfileText; lnkEditMyProfile.Text = EditMyProfileText; btnSignOut.Text = SignOutText; lnkCreateNewGroup.Text = CreateNewGroupText; lnkCreateNewBlog.Text = CreateNewBlogText; lnkJoinGroup.Text = JoinGroupText; lnkLeaveGroup.Text = LeaveGroupText; lnkInviteToGroup.Text = InviteGroupText; lnkManageGroup.Text = ManageGroupText; lnkMyInvitations.Text = MyInvitationsText; // If current user is public... if (currentUser.IsPublic()) { // Display Sign In link if set so if (DisplaySignIn) { // SignInPath returns URL - because of settings value lnkSignIn.NavigateUrl = MacroResolver.ResolveCurrentPath(SignInPath); pnlSignIn.Visible = true; pnlSignInOut.Visible = true; } // Display Join the community link if set so if (DisplayJoinCommunity) { lnkJoinCommunity.NavigateUrl = GetUrl(JoinCommunityPath); pnlJoinCommunity.Visible = true; pnlPersonalLinks.Visible = true; } } // If user is logged in else { // Display Sign out link if set so if (DisplaySignOut && !AuthenticationMode.IsWindowsAuthentication()) { pnlSignOut.Visible = true; pnlSignInOut.Visible = true; } // Display Edit my profile link if set so if (DisplayEditMyProfileLink) { lnkEditMyProfile.NavigateUrl = UrlResolver.ResolveUrl(DocumentURLProvider.GetUrl(GroupMemberInfoProvider.GetMemberManagementPath(currentUser.UserName, SiteContext.CurrentSiteName))); pnlEditMyProfile.Visible = true; pnlProfileLinks.Visible = true; } // Display My profile link if set so if (DisplayMyProfileLink) { lnkMyProfile.NavigateUrl = UrlResolver.ResolveUrl(DocumentURLProvider.GetUrl(GroupMemberInfoProvider.GetMemberProfilePath(currentUser.UserName, SiteContext.CurrentSiteName))); pnlMyProfile.Visible = true; pnlProfileLinks.Visible = true; } // Display Create new group link if set so if (DisplayCreateNewGroup) { lnkCreateNewGroup.NavigateUrl = GetUrl(CreateNewGroupPath); pnlCreateNewGroup.Visible = true; pnlGroupLinks.Visible = true; } // Display Create new blog link if set so if (DisplayCreateNewBlog) { // Check that Community Module is present var entry = ModuleManager.GetModule(ModuleName.BLOGS); if (entry != null) { lnkCreateNewBlog.NavigateUrl = GetUrl(CreateNewBlogPath); pnlCreateNewBlog.Visible = true; pnlBlogLinks.Visible = true; } } // Display My invitations link if (DisplayMyInvitations) { lnkMyInvitations.NavigateUrl = GetUrl(MyInvitationsPath); pnlMyInvitations.Visible = true; pnlPersonalLinks.Visible = true; } GroupMemberInfo gmi = null; if (CommunityContext.CurrentGroup != null) { // Get group info from community context GroupInfo currentGroup = CommunityContext.CurrentGroup; if (DisplayGroupLinks) { // Display Join group link if set so and user is visiting a group page gmi = GetGroupMember(MembershipContext.AuthenticatedUser.UserID, currentGroup.GroupID); if (gmi == null) { if (String.IsNullOrEmpty(JoinGroupPath)) { script += "function JoinToGroupRequest() {\n" + "modalDialog('" + ApplicationUrlHelper.ResolveDialogUrl("~/CMSModules/Groups/CMSPages/JoinTheGroup.aspx") + "?groupid=" + currentGroup.GroupID + "','requestJoinToGroup', 500, 180); \n" + " } \n"; lnkJoinGroup.Attributes.Add("onclick", "JoinToGroupRequest();return false;"); lnkJoinGroup.NavigateUrl = RequestContext.CurrentURL; } else { lnkJoinGroup.NavigateUrl = GetUrl(JoinGroupPath); } pnlJoinGroup.Visible = true; pnlGroupLinks.Visible = true; } else if ((gmi.MemberStatus == GroupMemberStatus.Approved) || (MembershipContext.AuthenticatedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Admin))) // Display Leave the group link if user is the group member { if (String.IsNullOrEmpty(LeaveGroupPath)) { script += "function LeaveTheGroupRequest() {\n" + "modalDialog('" + ApplicationUrlHelper.ResolveDialogUrl("~/CMSModules/Groups/CMSPages/LeaveTheGroup.aspx") + "?groupid=" + currentGroup.GroupID + "','requestLeaveThGroup', 500, 180); \n" + " } \n"; lnkLeaveGroup.Attributes.Add("onclick", "LeaveTheGroupRequest();return false;"); lnkLeaveGroup.NavigateUrl = RequestContext.CurrentURL; } else { lnkLeaveGroup.NavigateUrl = GetUrl(LeaveGroupPath); } pnlLeaveGroup.Visible = true; pnlGroupLinks.Visible = true; } } // Display Manage the group link if set so and user is logged as group administrator and user is visiting a group page if (DisplayManageGroup && (currentUser.IsGroupAdministrator(currentGroup.GroupID) || (currentUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Admin)))) { lnkManageGroup.NavigateUrl = ResolveUrl(DocumentURLProvider.GetUrl(GroupInfoProvider.GetGroupManagementPath(currentGroup.GroupName, SiteContext.CurrentSiteName))); pnlManageGroup.Visible = true; pnlGroupLinks.Visible = true; } } // Get user info from site context UserInfo siteContextUser = MembershipContext.CurrentUserProfile; if (DisplayInviteToGroup) { // Get group info from community context GroupInfo currentGroup = CommunityContext.CurrentGroup; // Display invite to group link for user who is visiting a group page if (currentGroup != null) { // Get group user if (gmi == null) { gmi = GetGroupMember(MembershipContext.AuthenticatedUser.UserID, currentGroup.GroupID); } if (((gmi != null) && (gmi.MemberStatus == GroupMemberStatus.Approved)) || (MembershipContext.AuthenticatedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Admin))) { pnlInviteToGroup.Visible = true; if (String.IsNullOrEmpty(InviteGroupPath)) { script += "function InviteToGroup() {\n modalDialog('" + ApplicationUrlHelper.ResolveDialogUrl("~/CMSModules/Groups/CMSPages/InviteToGroup.aspx") + "?groupid=" + currentGroup.GroupID + "','inviteToGroup', 800, 450); \n } \n"; lnkInviteToGroup.Attributes.Add("onclick", "InviteToGroup();return false;"); lnkInviteToGroup.NavigateUrl = RequestContext.CurrentURL; } else { lnkInviteToGroup.NavigateUrl = GetUrl(InviteGroupPath); } } } // Display invite to group link for user who is visiting another user's page else if ((siteContextUser != null) && (siteContextUser.UserName != currentUser.UserName) && (GroupInfoProvider.GetUserGroupsCount(currentUser, SiteContext.CurrentSite) != 0)) { pnlInviteToGroup.Visible = true; if (String.IsNullOrEmpty(InviteGroupPath)) { script += "function InviteToGroup() {\n modalDialog('" + ApplicationUrlHelper.ResolveDialogUrl("~/CMSModules/Groups/CMSPages/InviteToGroup.aspx") + "?invitedid=" + siteContextUser.UserID + "','inviteToGroup', 700, 400); \n } \n"; lnkInviteToGroup.Attributes.Add("onclick", "InviteToGroup();return false;"); lnkInviteToGroup.NavigateUrl = RequestContext.CurrentURL; } else { lnkInviteToGroup.NavigateUrl = GetUrl(InviteGroupPath); } } } } // Register menu management scripts ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "Shortcuts_" + ClientID, ScriptHelper.GetScript(script)); // Register the dialog script ScriptHelper.RegisterDialogScript(Page); } }