/// <summary>
    /// Gets and bulk updates forums. Called when the "Get and bulk update forums" button is pressed.
    /// Expects the CreateForum method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateForums()
    {
        // Prepare the parameters
        string where = "ForumName LIKE N'MyNewForum%'";
        string orderBy = "";
        string columns = "";
        int    topN    = 10;

        // Get the data
        DataSet forums = ForumInfoProvider.GetForums(where, orderBy, topN, columns);

        if (!DataHelper.DataSourceIsEmpty(forums))
        {
            // Loop through the individual items
            foreach (DataRow forumDr in forums.Tables[0].Rows)
            {
                // Create object from DataRow
                ForumInfo modifyForum = new ForumInfo(forumDr);

                // Update the properties
                modifyForum.ForumDisplayName = modifyForum.ForumDisplayName.ToUpper();

                // Save the changes
                ForumInfoProvider.SetForumInfo(modifyForum);
            }

            return(true);
        }

        return(false);
    }
    /// <summary>
    /// Creates forum. Called when the "Create forum" button is pressed.
    /// </summary>
    private bool CreateForum()
    {
        // Get the forum group
        ForumGroupInfo group = ForumGroupInfoProvider.GetForumGroupInfo("MyNewGroup", CMSContext.CurrentSiteID);

        if (group != null)
        {
            // Create new forum object
            ForumInfo newForum = new ForumInfo();

            // Set the properties
            newForum.ForumDisplayName = "My new forum";
            newForum.ForumName        = "MyNewForum";
            newForum.ForumGroupID     = group.GroupID;
            newForum.ForumSiteID      = group.GroupSiteID;
            newForum.AllowAccess      = SecurityAccessEnum.AllUsers;
            newForum.AllowAttachFiles = SecurityAccessEnum.AuthenticatedUsers;
            newForum.AllowPost        = SecurityAccessEnum.AllUsers;
            newForum.AllowReply       = SecurityAccessEnum.AllUsers;
            newForum.AllowSubscribe   = SecurityAccessEnum.AllUsers;
            newForum.ForumOpen        = true;
            newForum.ForumModerated   = false;
            newForum.ForumThreads     = 0;
            newForum.ForumPosts       = 0;


            // Save the forum
            ForumInfoProvider.SetForumInfo(newForum);

            return(true);
        }

        return(false);
    }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string currentForumPost = "";

        string[] post = QueryHelper.GetString("postid", "").Split(';');
        postId = ValidationHelper.GetInteger(post[0], 0);
        ForumContext.CheckSite(0, 0, postId);

        if (post.Length >= 2)
        {
            forumId = ValidationHelper.GetInteger(post[1], 0);
            this.postListing.ForumId = forumId;
        }

        // Show current post
        postInfo = ForumPostInfoProvider.GetForumPostInfo(postId);
        if (postInfo != null)
        {
            currentForumPost          = HTMLHelper.HTMLEncode(postInfo.PostSubject);
            this.postListing.PostInfo = postInfo;
        }
        // If not post, show current forum
        else if (forumId > 0)
        {
            ForumInfo fi = ForumInfoProvider.GetForumInfo(forumId);
            if (fi != null)
            {
                currentForumPost = fi.ForumDisplayName;
            }
        }

        this.postListing.IsLiveSite = false;

        this.InitializeMasterPage(currentForumPost);
    }
    /// <summary>
    /// OnExterna databound.
    /// </summary>
    /// <param name="sender">Sender</param>
    /// <param name="sourceName">Source name</param>
    /// <param name="parameter">Parameter</param>
    private object gridApprove_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        switch (sourceName.ToLowerCSafe())
        {
        case "forum":
            ForumInfo fi = ForumInfoProvider.GetForumInfo(ValidationHelper.GetInteger(parameter, 0));
            if (fi != null)
            {
                return(HTMLHelper.HTMLEncode(fi.ForumDisplayName));
            }
            break;

        case "content":
            DataRowView dr = parameter as DataRowView;
            if (dr != null)
            {
                string toReturn = "<strong>" + HTMLHelper.HTMLEncode(ValidationHelper.GetString(dr["PostUserName"], "")) + ":</strong> ";
                toReturn += HTMLHelper.HTMLEncode(ValidationHelper.GetString(dr["PostSubject"], "")) + "<br />";
                toReturn += TextHelper.LimitLength(HTMLHelper.HTMLEncode(ValidationHelper.GetString(dr["PostText"], "")), 150);
                return(toReturn);
            }
            break;
        }

        return("");
    }
Esempio n. 5
0
    /// <summary>
    /// Upload click handler.
    /// </summary>
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        if (!CheckPermissions("cms.forums", PERMISSION_MODIFY))
        {
            return;
        }

        if ((upload.HasFile) && (PostInfo != null))
        {
            // Check attachment extension
            if (!ForumAttachmentInfoProvider.IsExtensionAllowed(upload.FileName, SiteContext.CurrentSiteName))
            {
                ShowError(GetString("ForumAttachment.AttachmentIsNotAllowed"));
                return;
            }

            ForumInfo fi = ForumInfoProvider.GetForumInfo(PostInfo.PostForumID);
            if (fi != null)
            {
                ForumGroupInfo fgi = ForumGroupInfoProvider.GetForumGroupInfo(fi.ForumGroupID);
                if (fgi != null)
                {
                    ForumAttachmentInfo fai = new ForumAttachmentInfo(upload.PostedFile, 0, 0, fi.ForumImageMaxSideSize);
                    fai.AttachmentPostID = PostInfo.PostId;
                    fai.AttachmentSiteID = fgi.GroupSiteID;
                    ForumAttachmentInfoProvider.SetForumAttachmentInfo(fai);

                    ReloadAttachmentData(PostInfo.PostId);
                    UniGrid.ReloadData();
                }
            }
        }
    }
Esempio n. 6
0
    /// <summary>
    /// Upload click hadler.
    /// </summary>
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        if (!CheckPermissions("cms.forums", CMSAdminControl.PERMISSION_MODIFY))
        {
            return;
        }

        if ((upload.HasFile) && (this.PostInfo != null))
        {
            // Check attachment extension
            if (!ForumAttachmentInfoProvider.IsExtensionAllowed(upload.FileName, CMSContext.CurrentSiteName))
            {
                lblError.Visible = true;
                lblError.Text    = GetString("ForumAttachment.AttachmentIsNotAllowed");
                return;
            }

            ForumInfo fi = ForumInfoProvider.GetForumInfo(this.PostInfo.PostForumID);
            if (fi != null)
            {
                ForumGroupInfo fgi = ForumGroupInfoProvider.GetForumGroupInfo(fi.ForumGroupID);
                if (fgi != null)
                {
                    ForumAttachmentInfo fai = new ForumAttachmentInfo(upload.PostedFile, 0, 0, 0);
                    fai.AttachmentPostID = this.PostInfo.PostId;
                    fai.AttachmentSiteID = fgi.GroupSiteID;
                    ForumAttachmentInfoProvider.SetForumAttachmentInfo(fai);

                    ReloadAttachmentData(this.PostInfo.PostId);
                    UniGrid.ReloadData();
                }
            }
        }
    }
    /// <summary>
    /// Handles the UniGrids's OnAction event.
    /// </summary>
    /// <param name="actionName">Name of item (button) that throws event</param>
    /// <param name="actionArgument">ID (value of Primary key) of corresponding data row</param>
    protected void gridElem_OnAction(string actionName, object actionArgument)
    {
        switch (actionName.ToLowerCSafe())
        {
        case "delete":
        case "up":
        case "down":
            if (!CheckPermissions("cms.forums", PERMISSION_MODIFY))
            {
                return;
            }
            break;
        }

        switch (actionName.ToLowerCSafe())
        {
        case "delete":
            ForumInfoProvider.DeleteForumInfo(Convert.ToInt32(actionArgument));
            break;

        case "up":
            ForumInfoProvider.MoveForumUp(Convert.ToInt32(actionArgument));
            break;

        case "down":
            ForumInfoProvider.MoveForumDown(Convert.ToInt32(actionArgument));
            break;
        }

        RaiseOnAction(actionName, actionArgument);
    }
Esempio n. 8
0
    void forumSecurity_OnCheckPermissions(string permissionType, CMSAdminControl sender)
    {
        int       groupId = 0;
        ForumInfo fi      = ForumInfoProvider.GetForumInfo(ValidationHelper.GetInteger(Request.QueryString["forumid"], 0));

        if (fi != null)
        {
            ForumGroupInfo fgi = ForumGroupInfoProvider.GetForumGroupInfo(fi.ForumGroupID);
            if (fgi != null)
            {
                groupId = fgi.GroupGroupID;
            }
        }

        // Check permissions
        if (!CMSContext.CurrentUser.IsGroupAdministrator(groupId))
        {
            // Check permissions
            if (!CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.Groups", permissionType))
            {
                this.forumSecurity.StopProcessing = true;

                // Redirect only if permission READ is check
                if (permissionType == CMSAdminControl.PERMISSION_READ)
                {
                    RedirectToCMSDeskAccessDenied("CMS.Groups", permissionType);
                }
            }
        }
    }
Esempio n. 9
0
    /// <summary>
    /// Initializes the breadcrumbs.
    /// </summary>
    private void InitializeBreadcrumbs()
    {
        lnkBackHidden.Click += lnkBackHidden_Click;

        ucBreadcrumbs.Items.Clear();
        ucBreadcrumbsNewForum.Items.Clear();

        ucBreadcrumbs.AddBreadcrumb(new BreadcrumbItem {
            Text          = GetString("forum_list.headercaption"),
            OnClientClick = ControlsHelper.GetPostBackEventReference(lnkBackHidden) + "; return false;"
        });

        int       forumId = ValidationHelper.GetInteger(ViewState["ForumID"], 0);
        ForumInfo fi      = ForumInfoProvider.GetForumInfo(forumId);

        ucBreadcrumbs.AddBreadcrumb(new BreadcrumbItem {
            Text = (fi != null) ? fi.ForumDisplayName : "",
        });

        ucBreadcrumbsNewForum.AddBreadcrumb(new BreadcrumbItem {
            Text          = GetString("forum_list.headercaption"),
            OnClientClick = ControlsHelper.GetPostBackEventReference(lnkBackHidden) + "; return false;"
        });

        ucBreadcrumbsNewForum.AddBreadcrumb(new BreadcrumbItem {
            Text = GetString("Forum_Edit.NewForum"),
        });
    }
    /// <summary>
    /// Returns link the the forum.
    /// </summary>
    /// <param name="favoritePostId">Pots id</param>
    /// <param name="favoriteForumId">Forum id</param>
    protected string GetFavoriteLink(object favoritePostId, object favoriteForumId, object postForumID, object postIDPath)
    {
        int    postId      = ValidationHelper.GetInteger(favoritePostId, 0);
        int    forumId     = ValidationHelper.GetInteger(favoriteForumId, 0);
        int    postForumId = ValidationHelper.GetInteger(postForumID, forumId);
        string postIdPath  = ValidationHelper.GetString(postIDPath, "");

        string link = "#";

        // Post favorite
        if (postId > 0)
        {
            ForumInfo forumInfo = ForumInfoProvider.GetForumInfo(postForumId);
            if (forumInfo != null)
            {
                // If forum URL is not set, try to use base forum url
                string forumUrl = (ForumUrl == String.Empty) ? forumInfo.ForumBaseUrl : ForumUrl;
                int    threadId = ForumPostInfoProvider.GetPostRootFromIDPath(postIdPath);

                if (String.IsNullOrEmpty(forumUrl))
                {
                    forumUrl = RequestContext.CurrentURL;
                }

                link = URLHelper.UpdateParameterInUrl(ResolveUrl(forumUrl), "forumid", postForumId.ToString());
                link = URLHelper.UpdateParameterInUrl(link, "threadid", threadId.ToString());
                link = URLHelper.RemoveParameterFromUrl(link, "thread");
                link = URLHelper.RemoveParameterFromUrl(link, "mode");
                link = URLHelper.RemoveParameterFromUrl(link, "postid");
                link = URLHelper.RemoveParameterFromUrl(link, "replyto");
                link = URLHelper.RemoveParameterFromUrl(link, "subscribeto");
            }
        }

        // Forum favorite
        else if (forumId > 0)
        {
            ForumInfo forumInfo = ForumInfoProvider.GetForumInfo(forumId);
            if (forumInfo != null)
            {
                // If forum URL is not set, try to use base forum url
                string forumUrl = (ForumUrl == String.Empty) ? forumInfo.ForumBaseUrl : ForumUrl;

                if (String.IsNullOrEmpty(forumUrl))
                {
                    forumUrl = RequestContext.CurrentURL;
                }

                link = URLHelper.UpdateParameterInUrl(ResolveUrl(forumUrl), "forumid", forumId.ToString());
                link = URLHelper.RemoveParameterFromUrl(link, "threadid");
                link = URLHelper.RemoveParameterFromUrl(link, "thread");
                link = URLHelper.RemoveParameterFromUrl(link, "mode");
                link = URLHelper.RemoveParameterFromUrl(link, "postid");
                link = URLHelper.RemoveParameterFromUrl(link, "replyto");
                link = URLHelper.RemoveParameterFromUrl(link, "subscribeto");
            }
        }

        return(HTMLHelper.EncodeLinkReference(link));
    }
    private void forumSecurity_OnCheckPermissions(string permissionType, CMSAdminControl sender)
    {
        int       groupId = 0;
        ForumInfo fi      = ForumInfoProvider.GetForumInfo(QueryHelper.GetInteger("forumid", 0));

        if (fi != null)
        {
            ForumGroupInfo fgi = ForumGroupInfoProvider.GetForumGroupInfo(fi.ForumGroupID);
            if (fgi != null)
            {
                groupId = fgi.GroupGroupID;
            }
        }

        // Check permissions
        if (!MembershipContext.AuthenticatedUser.IsGroupAdministrator(groupId))
        {
            // Check permissions
            if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.Groups", permissionType))
            {
                forumSecurity.StopProcessing = true;

                // Redirect only if permission READ is check
                if (permissionType == CMSAdminControl.PERMISSION_READ)
                {
                    RedirectToAccessDenied("CMS.Groups", permissionType);
                }
            }
        }
    }
Esempio n. 12
0
    /// <summary>
    /// Edit forum action.
    /// </summary>
    protected void forumList_OnAction(object sender, CommandEventArgs e)
    {
        switch (e.CommandName.ToString())
        {
        case "edit":

            int forumId = ValidationHelper.GetInteger(e.CommandArgument, 0);
            ViewState["ForumID"] = forumId;

            ForumInfo fi = ForumInfoProvider.GetForumInfo(forumId);
            if (fi != null)
            {
                ucBreadcrumbs.Items[1].Text = fi.ForumDisplayName;
            }

            forumEdit.ForumID = forumId;
            DisplayControl("edit");

            break;

        default:
            DisplayControl("list");
            break;
        }
    }
Esempio n. 13
0
    /// <summary>
    /// Edit forum action.
    /// </summary>
    protected void forumList_OnAction(object sender, CommandEventArgs e)
    {
        switch (e.CommandName.ToString())
        {
        case "edit":

            int forumId = ValidationHelper.GetInteger(e.CommandArgument, 0);
            ViewState["ForumID"] = forumId;

            ForumInfo fi = ForumInfoProvider.GetForumInfo(forumId);
            if (fi != null)
            {
                this.lblEditBack.Text = breadCrumbsSeparator + HTMLHelper.HTMLEncode(fi.ForumDisplayName);
            }

            this.forumEdit.ForumID = forumId;
            DisplayControl("edit");

            break;

        default:
            DisplayControl("list");
            break;
        }
    }
Esempio n. 14
0
    public void RaisePostBackEvent(string eventArgument)
    {
        if (!CheckPermissions("cms.forums", CMSAdminControl.PERMISSION_MODIFY))
        {
            return;
        }

        string[] args = eventArgument.Split(';');
        if (args.Length == 2)
        {
            // Get info on currently selected item
            int permission = Convert.ToInt32(args[0]);
            int access     = Convert.ToInt32(args[1]);

            if (forum != null)
            {
                // Update forum permission access information
                switch (permission)
                {
                case 0:
                    // Set 'AllowAccess' permission to specified access
                    forum.AllowAccess = (SecurityAccessEnum)access;
                    break;

                case 1:
                    // Set 'AttachFiles' permission to specified access
                    forum.AllowAttachFiles = ((SecurityAccessEnum)access);
                    break;

                case 2:
                    // Set 'MarkAsAnswer' permission to specified access
                    forum.AllowMarkAsAnswer = (SecurityAccessEnum)access;
                    break;

                case 3:
                    // Set 'Post' permission to specified access
                    forum.AllowPost = ((SecurityAccessEnum)access);
                    break;

                case 4:
                    // Set 'Reply' permission to specified access
                    forum.AllowReply = (SecurityAccessEnum)access;
                    break;

                case 5:
                    // Set 'Subscribe' permission to specified access
                    forum.AllowSubscribe = (SecurityAccessEnum)access;
                    break;

                default:
                    break;
                }

                // Save changes to the forum
                ForumInfoProvider.SetForumInfo(forum);

                createMatrix = true;
            }
        }
    }
Esempio n. 15
0
    /// <summary>
    /// Creates forum post. Called when the "Create post" button is pressed.
    /// </summary>
    private bool CreateForumPost()
    {
        // Get the forum
        ForumInfo forum = ForumInfoProvider.GetForumInfo("MyNewForum", CMSContext.CurrentSiteID);

        if (forum != null)
        {
            // Create new forum post object
            ForumPostInfo newPost = new ForumPostInfo();

            // Set the properties
            newPost.PostUserID   = CMSContext.CurrentUser.UserID;
            newPost.PostUserMail = CMSContext.CurrentUser.Email;
            newPost.PostUserName = CMSContext.CurrentUser.UserName;
            newPost.PostForumID  = forum.ForumID;
            newPost.PostTime     = DateTime.Now;
            newPost.PostApproved = true;
            newPost.PostText     = "This is my new post";
            newPost.PostSubject  = "My new post";

            // Save the forum post
            ForumPostInfoProvider.SetForumPostInfo(newPost);

            return(true);
        }

        return(false);
    }
Esempio n. 16
0
    /// <summary>
    /// Loads the data.
    /// </summary>
    private void LoadData()
    {
        // Get the forum post
        ForumPostInfo fpi = ForumPostInfoProvider.GetForumPostInfo(ValidationHelper.GetInteger(PostID, 0));
        ForumInfo     fi  = null;

        if (fpi != null)
        {
            fi = ForumInfoProvider.GetForumInfo(fpi.PostForumID);
        }
        else
        {
            return;
        }

        if (fi.ForumEnableAdvancedImage)
        {
            ltrText.AllowedControls = ControlsHelper.ALLOWED_FORUM_CONTROLS;
        }
        else
        {
            ltrText.AllowedControls = "none";
        }

        // Display converted datetime for live site
        lblDate.Text = CMSContext.ConvertDateTime(ValidationHelper.GetDateTime(fpi.PostTime, DateTimeHelper.ZERO_TIME), this).ToString();

        lblUser.Text    = HTMLHelper.HTMLEncode(fpi.PostUserName);
        lblSubject.Text = HTMLHelper.HTMLEncode(fpi.PostSubject);

        DiscussionMacroHelper dmh = new DiscussionMacroHelper();

        dmh.EnableBold          = fi.ForumEnableFontBold;
        dmh.EnableItalics       = fi.ForumEnableFontItalics;
        dmh.EnableStrikeThrough = fi.ForumEnableFontStrike;
        dmh.EnableUnderline     = fi.ForumEnableFontUnderline;
        dmh.EnableCode          = fi.ForumEnableCodeSnippet;
        dmh.EnableColor         = fi.ForumEnableFontColor;
        dmh.EnableImage         = fi.ForumEnableImage || fi.ForumEnableAdvancedImage;
        dmh.EnableQuote         = fi.ForumEnableQuote;
        dmh.EnableURL           = fi.ForumEnableURL || fi.ForumEnableAdvancedURL;
        dmh.MaxImageSideSize    = fi.ForumImageMaxSideSize;
        dmh.QuotePostText       = GetString("DiscussionMacroResolver.QuotePostText");

        if (fi.ForumHTMLEditor)
        {
            dmh.EncodeText = false;
            dmh.ConvertLineBreaksToHTML = false;
        }
        else
        {
            dmh.EncodeText = true;
            dmh.ConvertLineBreaksToHTML = true;
        }

        // Resolve the macros and display the post text
        ltrText.Text = dmh.ResolveMacros(fpi.PostText);
    }
Esempio n. 17
0
    /// <summary>
    /// Reloads the data of the editing forum.
    /// </summary>
    public override void ReloadData()
    {
        ForumInfo forumObj = ForumInfoProvider.GetForumInfo(mForumId);

        if (forumObj != null)
        {
            ReloadData(forumObj);
        }
    }
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get query keys
        bool saved      = QueryHelper.GetBoolean("saved", false);
        bool chkChecked = QueryHelper.GetBoolean("checked", true);

        // Get resource strings
        rfvSubscriptionEmail.ErrorMessage = GetString("ForumSubscription_Edit.EnterSomeEmail");
        btnOk.Text = GetString("General.OK");

        // Check whether the forum still exists
        if ((ForumID > 0) && (ForumInfoProvider.GetForumInfo(ForumID) == null))
        {
            RedirectToInformation("editedobject.notexists");
        }

        EditedObject = SubscriptionObj;

        // Set edited object
        if (SubscriptionID > 0)
        {
            pnlSendConfirmationEmail.Visible = false;
        }

        bool process = true;

        if (!Visible || StopProcessing)
        {
            EnableViewState = false;
            process         = false;
        }

        if (!IsLiveSite && !RequestHelper.IsPostBack() && process)
        {
            ReloadData();
        }

        if (!RequestHelper.IsPostBack())
        {
            chkSendConfirmationEmail.Checked = true;
        }

        if (!chkChecked)
        {
            chkSendConfirmationEmail.Checked = false;
        }

        if (saved && !RequestHelper.IsPostBack())
        {
            ShowChangesSaved();
        }

        txtSubscriptionEmail
        .EnableClientSideEmailFormatValidation(errorMessageResourceString: "ForumSubscription_Edit.emailErrorMsg")
        .RegisterCustomValidator(rfvSubscriptionEmail);
    }
Esempio n. 19
0
    /// <summary>
    /// Deletes forum. Called when the "Delete forum" button is pressed.
    /// Expects the CreateForum method to be run first.
    /// </summary>
    private bool DeleteForum()
    {
        // Get the forum
        ForumInfo deleteForum = ForumInfoProvider.GetForumInfo("MyNewForum", CMSContext.CurrentSiteID);

        // Delete the forum
        ForumInfoProvider.DeleteForumInfo(deleteForum);

        return(deleteForum != null);
    }
Esempio n. 20
0
    /// <summary>
    /// Actions handler.
    /// </summary>
    void btnDelete_Click(object sender, EventArgs e)
    {
        if (!CheckPermissions("cms.forums", CMSAdminControl.PERMISSION_MODIFY))
        {
            return;
        }

        ForumInfoProvider.DeleteForumInfo(ValidationHelper.GetInteger(hdnForumId.Value, 0));
        ltlScript.Text += ScriptHelper.GetScript("parent.frames['main'].location.href = '" + ResolveUrl("~/CMSPages/blank.htm") + "'");
        ltlScript.Text += ScriptHelper.GetScript("window.location.replace(window.location);");
    }
Esempio n. 21
0
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get query keys
        bool saved      = QueryHelper.GetBoolean("saved", false);
        bool chkChecked = QueryHelper.GetBoolean("checked", true);

        // Get resource strings
        this.rfvEmail.ErrorMessage = GetString("ForumSubscription_Edit.emailErrorMsg");
        this.btnOk.Text            = GetString("General.OK");

        // Check whether the forum still exists
        if ((ForumID > 0) && (ForumInfoProvider.GetForumInfo(ForumID) == null))
        {
            RedirectToInformation("editedobject.notexists");
        }

        // Set edited object
        if (SubscriptionID > 0)
        {
            EditedObject = SubscriptionObj;
        }

        bool process = true;

        if (!this.Visible || StopProcessing)
        {
            this.EnableViewState = false;
            process = false;
        }

        this.rfvSubscriptionEmail.ErrorMessage = GetString("ForumSubscription_Edit.EnterSomeEmail");
        this.rfvEmail.ValidationExpression     = @"^([a-zA-Z0-9_\-\+]+(\.[a-zA-Z0-9_\-\+]+)*@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+)*$";

        if (!this.IsLiveSite && !RequestHelper.IsPostBack() && process)
        {
            ReloadData();
        }

        if (!RequestHelper.IsPostBack())
        {
            chkSendConfirmationEmail.Checked = true;
        }

        if (!chkChecked)
        {
            chkSendConfirmationEmail.Checked = false;
        }

        if (saved)
        {
            lblInfo.Visible = true;
            lblInfo.Text    = GetString("General.ChangesSaved");
        }
    }
Esempio n. 22
0
 protected void forumEdit_OnSaved(object sender, EventArgs e)
 {
     // Refresh tree if external parent
     if (changeMaster)
     {
         ForumInfo fi = ForumInfoProvider.GetForumInfo(mForumId);
         if (fi != null)
         {
             ltlScript.Text += ScriptHelper.GetScript("window.parent.parent.frames['tree'].RefreshNode(" + ScriptHelper.GetString(fi.ForumDisplayName) + ", '" + mForumId + "');");
         }
     }
 }
Esempio n. 23
0
    /// <summary>
    /// Returns ID of users who are moderators to this forum.
    /// </summary>
    protected string GetModerators()
    {
        // Get all message board moderators
        DataSet ds = ForumInfoProvider.GetModerators(mForumId);

        if (!DataHelper.DataSourceIsEmpty(ds))
        {
            return(TextHelper.Join(";", DataHelper.GetStringValues(ds.Tables[0], "UserID")));
        }

        return(String.Empty);
    }
Esempio n. 24
0
    /// <summary>
    /// Change name checkbox handler.
    /// </summary>
    protected void chkChangeName_CheckedChanged(object sender, EventArgs e)
    {
        if (!CheckPermissions("cms.forums", CMSAdminControl.PERMISSION_MODIFY))
        {
            return;
        }

        if (forum != null)
        {
            forum.ForumAllowChangeName = this.chkChangeName.Checked;
            ForumInfoProvider.SetForumInfo(forum);
        }
    }
    private DataSet forumSubscriptions_OnDataReload(string completeWhere, string currentOrder, int currentTopN, string columns, int currentOffset, int currentPageSize, ref int totalRecords)
    {
        string where = "ForumID IN (SELECT SubscriptionForumID FROM Forums_ForumSubscription WHERE (SubscriptionUserID = " + UserID + ") AND (ISNULL(SubscriptionApproved, 1) = 1) AND (SubscriptionPostID IS NULL))";
        if (!String.IsNullOrEmpty(completeWhere))
        {
            where += " AND (" + completeWhere + ")";
        }

        DataSet ds = ForumInfoProvider.GetForums().Where(where).OrderBy("ForumDisplayName").Columns("ForumId, ForumDisplayName").TypedResult;

        totalRecords = DataHelper.GetItemsCount(ds);
        return(ds);
    }
Esempio n. 26
0
 object postSubscription_OnExternalDataBound(object sender, string sourceName, object parameter)
 {
     switch (sourceName.ToLowerCSafe())
     {
     case "forumname":
         ForumInfo fi = ForumInfoProvider.GetForumInfo(ValidationHelper.GetInteger(parameter, 0));
         if (fi != null)
         {
             return(HTMLHelper.HTMLEncode(fi.ForumDisplayName));
         }
         break;
     }
     return(parameter);
 }
    private int GetGroupIdFromForum(int forumId)
    {
        var forum = ForumInfoProvider.GetForumInfo(forumId);

        if (forum != null)
        {
            var forumGroup = ForumGroupInfoProvider.GetForumGroupInfo(forum.ForumGroupID);
            if (forumGroup != null)
            {
                return(forumGroup.GroupGroupID);
            }
        }

        return(0);
    }
    private void subscriptionList_OnCheckPermissions(string permissionType, CMSAdminControl sender)
    {
        int       groupId = 0;
        ForumInfo fi      = ForumInfoProvider.GetForumInfo(subscriptionList.ForumID);

        if (fi != null)
        {
            ForumGroupInfo fgi = ForumGroupInfoProvider.GetForumGroupInfo(fi.ForumGroupID);
            if (fgi != null)
            {
                groupId = fgi.GroupGroupID;
            }
        }
        // Check permissions
        CheckPermissions(groupId, CMSAdminControl.PERMISSION_MANAGE);
    }
Esempio n. 29
0
    /// <summary>
    /// Actions handler.
    /// </summary>
    protected void HeaderActions_ActionPerformed(object sender, CommandEventArgs e)
    {
        switch (e.CommandName.ToLowerCSafe())
        {
        case "delete":
            if (!CheckPermissions("cms.forums", CMSAdminControl.PERMISSION_MODIFY))
            {
                return;
            }

            ForumInfoProvider.DeleteForumInfo(ValidationHelper.GetInteger(hdnForumId.Value, 0));
            ltlScript.Text += ScriptHelper.GetScript("parent.frames['main'].location.href = '" + ResolveUrl("~/CMSPages/blank.htm") + "'");
            ltlScript.Text += ScriptHelper.GetScript("window.location.replace(window.location);");
            break;
        }
    }
Esempio n. 30
0
    /// <summary>
    /// Topic move action handler.
    /// </summary>
    protected void btnMove_Click(object sender, EventArgs e)
    {
        int forumId = ValidationHelper.GetInteger(this.drpMoveToForum.SelectedValue, 0);

        if (forumId > 0)
        {
            ForumPostInfo fpi = ForumContext.CurrentThread;
            if ((fpi == null) && (this.CurrentThread > 0))
            {
                fpi = ForumPostInfoProvider.GetForumPostInfo(this.CurrentThread);
            }

            if (fpi != null)
            {
                // Move the thread
                ForumPostInfoProvider.MoveThread(fpi, forumId);

                this.plcMoveInner.Visible = false;

                // Generate back button
                this.ltlMoveBack.Text = GetLink(null, GetString("general.back"), "ActionLink", ForumActionType.Thread);

                string    targetForumName = this.drpMoveToForum.SelectedItem.Text.TrimStart(' ');
                ForumInfo fi = ForumInfoProvider.GetForumInfo(forumId);
                if (fi != null)
                {
                    targetForumName = HTMLHelper.HTMLEncode(fi.ForumDisplayName);
                }

                // Display info
                this.lblMoveInfo.Text    = String.Format(GetString("forum.thread.topicmoved"), targetForumName);
                this.lblMoveInfo.Visible = true;

                this.SetValue("TopicMoved", true);

                if (TopicMoved != null)
                {
                    TopicMoved(this, null);
                }
            }
        }
        else
        {
            this.lblMoveError.Text    = GetString("forum.thread.movetopic.selectforum");
            this.lblMoveError.Visible = true;
        }
    }