protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            int curr_campaign_id = 0;

            if (campaign_id > 0)
                curr_campaign_id = campaign_id;

            if (campaign_id == 0)
                curr_campaign_id = Convert.ToInt32(Request.QueryString["campaignID"]);

            if (curr_campaign_id > 0)
                Session["CampaignID"] = curr_campaign_id;

            if (curr_campaign_id == 0)
                curr_campaign_id = Convert.ToInt32(Session["CampaignID"]);

            int curr_user_id = Convert.ToInt32(Context.Items["UserID"]);

            bool available_actions = false;

            if (curr_campaign_id > 0)
            {
                var actions = qSoc_CampaignAction.GetCampaignActions(campaign_id);

                if (actions != null)
                {
                    if (actions.Count > 0)
                    {
                        available_actions = true;
                        int i = 1;
                        foreach (var a in actions)
                        {
                            Literal action = new Literal();

                            int curr_feed_id = 0;
                            string keyword_title = string.Empty;
                            string activity_type = string.Empty;
                            if (a.FeedID == 0)
                            {
                                keyword_title = a.ActionName;
                                qSoc_ContentType c_type = new qSoc_ContentType(a.ContentTypeID);
                                activity_type = c_type.Name.ToLower();
                            }
                            else
                            {
                                qSoc_Feed feed = new qSoc_Feed(a.FeedID);
                                if (!String.IsNullOrEmpty(feed.Title))
                                    keyword_title = feed.Title.Replace("'", "");
                                curr_feed_id = feed.FeedID;
                                activity_type = feed.Type;
                            }
                            if (!String.IsNullOrEmpty(keyword_title))
                            {
                                keyword_title = Uri.EscapeDataString(keyword_title).Replace("'", @"\'").Replace(@"""", @"\""");
                                keyword_title = keyword_title.Replace("%2C", "");
                            }
                            else
                            {
                                keyword_title = "Activity";
                            }

                            string action_html = "<tr>";

                            action_html += "<td><font color=\"gray\">" + i + ") " + a.ActionName + "</font></td>";
                            action_html += "<td class=\"hidden-1024\">" + a.ActionType + "</td>";
                            action_html += "<td class=\"hidden-480\">" + a.Points + "</td>";
                            action_html += "</tr>";

                            action.Text = action_html;

                            pnlActivities.Controls.Add(action);
                            i++;
                        }
                    }
                }
            }

            // if no actions then add empty table
            if (available_actions == false)
            {
                Literal no_action = new Literal();
                no_action.Text = "<tr><td>No activities available</td><td></td><td></td></tr>";
                pnlActivities.Controls.Add(no_action);
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {

            if (!String.IsNullOrEmpty(Request.QueryString["commentID"]))
            {
                comment_id = Convert.ToInt32(Request.QueryString["commentID"]);
                ViewState.Add("vsCommentID", comment_id);

                populateKeywords(comment_id, (int)qSoc_ContentType.Types.Tip);

                qSoc_Comment2 comment = new qSoc_Comment2(comment_id);
                qSoc_ContentType content = new qSoc_ContentType((int)qSoc_ContentType.Types.Shout);
                qPtl_User posted_by = new qPtl_User(comment.ActorID);

                lblTitle.Text = "Edit Thought (ID: " + comment.CommentID + ")";
                lblPostedBy.Text = posted_by.UserName;
                txtComment.Text = comment.Comment;

                rblAvailable.SelectedValue = comment.Available;

                // see if in feed
                qSoc_Feed feed = new qSoc_Feed((int)qSoc_ContentType.Types.Shout, comment_id);

                if (feed != null)
                {
                    if (feed.FeedID > 0 && feed.Available == "Yes")
                    {
                        btnMakeAvailableCampaigns.Visible = false;
                        lblExistsFeed.Text = "<i class=\"icon-check\"></i> This training is available for use in campaigns";
                    }
                }
            }
        }

        if (String.IsNullOrEmpty(Convert.ToString(comment_id)))
            comment_id = (Int32)ViewState["vsCommentID"];
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {

            if (Request.QueryString["source"] == "tasks")
            {
                hplBackTop.NavigateUrl = "~/qPtl/task-list.aspx?searchType=open";
                hplBackTop.Text = "<img src=\"../images/PagingPrev.gif\" border=\"0\">&nbsp;&nbsp;Back to Task List";
                hplBackBottom.NavigateUrl = "~/qPtl/task-list.aspx?searchType=open";
                hplBackBottom.Text = "<img src=\"../images/PagingPrev.gif\" border=\"0\">&nbsp;&nbsp;Back to Task List";
            }
            else if (!String.IsNullOrEmpty(Request.QueryString["status"]))
            {
                hplBackTop.NavigateUrl = "warnings-list.aspx?status=" + Request.QueryString["status"];
                hplBackBottom.NavigateUrl = "warnings-list.aspx?status=" + Request.QueryString["status"];
            }
            else
            {
                hplBackTop.NavigateUrl = "warnings-list.aspx";
                hplBackBottom.NavigateUrl = "warnings-list.aspx";
            }

            hplRefreshBottom.NavigateUrl = Request.Url.ToString();
            hplRefreshTop.NavigateUrl = Request.Url.ToString();

            if (!String.IsNullOrEmpty(Request.QueryString["warningID"]))
            {
                warning_id = Convert.ToInt32(Request.QueryString["warningID"]);
                qSoc_Warning warning = new qSoc_Warning(warning_id);
                if (!String.IsNullOrEmpty(warning.BannedWords))
                {
                    plhBannedWord.Visible = true;
                    lblBannedWords.Text = warning.BannedWords;
                    qSoc_ContentType content = new qSoc_ContentType(warning.ContentTypeID);
                    lblWarningType.Text = warning.Message;
                    ddlStatus.SelectedValue = warning.Status;

                    lblContent.Text = content.Name;
                    string content_info = content.Name;
                    if (content.ContentTypeID == 6 && warning.ReferenceID > 0)
                    {
                        qSoc_Blog2 blog = new qSoc_Blog2(warning.ReferenceID);
                        lblFullText.Text = blog.Text;
                    }
                    else if (content.ContentTypeID == 8 && warning.ReferenceID > 0)
                    {
                        // message reply
                        //qCom_MessageReplies m_reply = new qCom_MessageReplies(warning.ReferenceID);
                        //lblFullText.Text = m_reply.post;
                    }
                    else if (content.ContentTypeID == 9 && warning.ReferenceID > 0)
                    {
                        // message thread
                        qCom_MessageThreads m_thread = new qCom_MessageThreads(warning.ReferenceID);
                        lblFullText.Text = m_thread.subject;
                    }
                    else if (content.ContentTypeID == 10 && warning.ReferenceID > 0)
                    {
                        // forum thread
                        qCom_ForumThread f_thread = new qCom_ForumThread(warning.ReferenceID);
                        lblFullText.Text = f_thread.Subject;
                    }
                    else if (content.ContentTypeID == 11 && warning.ReferenceID > 0)
                    {
                        // forum reply
                        qCom_ForumPost f_post = new qCom_ForumPost(warning.ReferenceID);
                        lblFullText.Text = f_post.Post;
                    }
                    else if (content.ContentTypeID == 31 && warning.ReferenceID > 0)
                    {
                        // shout
                        qSoc_Comment shout = new qSoc_Comment(warning.ReferenceID);
                        lblFullText.Text = shout.Comment;
                    }
                    else if (content.ContentTypeID == 33 && warning.ReferenceID > 0)
                    {
                        // comment
                        qSoc_Comment shout = new qSoc_Comment(warning.ReferenceID);
                        lblFullText.Text = shout.Comment;
                    }
                    else if (content.ContentTypeID == 40 && warning.ReferenceID > 0)
                    {
                        // status update
                        qSoc_Comment shout = new qSoc_Comment(warning.ReferenceID);
                        lblFullText.Text = shout.Comment;
                    }
                }
                else
                    plhBannedWord.Visible = false;

                lblPostedTime.Text = Convert.ToString(warning.Created);
                lblTitle.Text = "Edit Warning (ID: " + warning.WarningID + ")";

                qPtl_User user = new qPtl_User(warning.ActorID);
                actor_id = user.UserID;
                actor = user.UserName;

                if (actor_id != warning.LastModifiedBy && warning.LastModifiedBy > 0)
                {
                    qPtl_User reviewed_by = new qPtl_User(warning.LastModifiedBy);
                    lblReviewedBy.Text = "Reviewed by " + reviewed_by.UserName + " at " + warning.LastModified;
                }
                else
                    lblReviewedBy.Visible = false;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            populateThemes();
            populateAuthors();

            if (!String.IsNullOrEmpty(Request.QueryString["articleID"]))
            {
                article_id = Convert.ToInt32(Request.QueryString["articleID"]);
                ViewState.Add("vsArticleID", article_id);
                reContent.ImageManager.MaxUploadFileSize = 4194304;

                populateKeywords(article_id, (int)qSoc_ContentType.Types.Article);
                populateTopics(article_id, (int)qSoc_ContentType.Types.Article);

                qLrn_Article article = new qLrn_Article(article_id);
                qSoc_ContentType content = new qSoc_ContentType((int)qSoc_ContentType.Types.Article);

                qPtl_User posted_by = new qPtl_User(article.CreatedBy);
                owner = posted_by.UserName;
                ViewState.Add("vsOwner", owner);
                owner_id = article.CreatedBy;
                ViewState.Add("vsOwnerID", owner_id);
                lblPostedTime.Text = " at " + article.Created;

                lblTitle.Text = "Edit Article (ID: " + article.ArticleID + ")";
                txtTitle.Text = article.Title;
                txtSummary.Text = article.Description;
                reContent.Content = article.Body;
                if (!String.IsNullOrEmpty(Convert.ToString(article.AuthorID)))
                    ddlAuthor.SelectedValue = Convert.ToString(article.AuthorID);
                if (!String.IsNullOrEmpty(Convert.ToString(article.ThemeID)))
                    ddlTheme.SelectedValue = Convert.ToString(article.ThemeID);
                ddlArticleType.SelectedValue = article.ArticleType;
                if (!String.IsNullOrEmpty(article.Language))
                    ddlLanguage.SelectedValue = article.Language;
                else
                    ddlLanguage.SelectedValue = "en";

                rblAvailable.SelectedValue = article.Available;
                plhPostedBy.Visible = true;
                hplPreviewArticle.Visible = true;
                hplPreviewArticle.NavigateUrl = "/social/learning/article-details.aspx?articleID=" + article.ArticleID;
                hplPreviewArticle.Target = "_blank";

                if (!String.IsNullOrEmpty(Request.QueryString["location"]))
                {
                    if (Request.QueryString["location"] == "my-health-care")
                        plhArticleType.Visible = true;
                }

                if (Convert.ToString(Request.QueryString["mode"]) == "add-successful")
                {
                    lblMessage.Text = "*** Record Successfully Added ***";
                }

                // see if in feed
                qSoc_Feed feed = new qSoc_Feed((int)qSoc_ContentType.Types.Article, article_id);
                plhExistingFeedItem.Visible = false;

                if (feed != null)
                {
                    if (feed.FeedID > 0 && feed.MarkAsDelete == 0 && feed.VisibleFeed == true)
                    {
                        chkDisplayInFeed.Checked = true;
                        plhExistingFeedItem.Visible = true;
                    }
                    if (feed.FeedID > 0 && feed.MarkAsDelete == 0 && feed.VisibleExplore == true)
                    {
                        chkDisplayInExplore.Checked = true;
                    }
                    string reserved_keywords = string.Empty;
                    if (!string.IsNullOrEmpty(feed.ReservedKeywords))
                    {
                        reserved_keywords = feed.ReservedKeywords;
                    }
                }
            }

            else
            {
                lblTitle.Text = "New Article";
                btnDelete.Visible = false;
                populateKeywords(0, (int)qSoc_ContentType.Types.Article);
                plhPostedBy.Visible = false;
                rblAvailable.SelectedValue = "Yes";
                plhTools.Visible = false;
            }
        }

        if (!String.IsNullOrEmpty(health_active))
            if (health_active == "true")
                plhArticleType.Visible = true;

        if (String.IsNullOrEmpty(Convert.ToString(article_id)))
            article_id = (Int32)ViewState["vsArticleID"];
        if (String.IsNullOrEmpty(Convert.ToString(owner_id)))
            owner_id = (Int32)ViewState["vsOwnerID"];
        if (String.IsNullOrEmpty(owner))
            owner = (String)ViewState["vsOwner"];
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            populateThemes();

            if (!String.IsNullOrEmpty(Request.QueryString["tipID"]))
            {
                tip_id = Convert.ToInt32(Request.QueryString["tipID"]);
                ViewState.Add("vsTipID", tip_id);

                populateKeywords(tip_id, (int)qSoc_ContentType.Types.Tip);
                populateTopics(tip_id, (int)qSoc_ContentType.Types.Tip);

                qSoc_Tip tip = new qSoc_Tip(tip_id);
                qSoc_ContentType content = new qSoc_ContentType((int)qSoc_ContentType.Types.Tip);

                lblTitle.Text = "Edit Tip (ID: " + tip.TipID + ")";
                txtTitle.Text = tip.Name;
                txtSummary.Text = tip.Summary;
                txtTip.Text = tip.Text;
                txtURL.Text = tip.LearnMoreURL;
                txtAuthor.Text = tip.Author;
                ddlTipType.SelectedValue = tip.Type;
                if (!String.IsNullOrEmpty(Convert.ToString(tip.ThemeID)))
                    ddlTheme.SelectedValue = Convert.ToString(tip.ThemeID);

                rblAvailable.SelectedValue = tip.Available;

                if (Convert.ToString(Request.QueryString["mode"]) == "add-successful")
                {
                    lblMessage.Text = "*** Record Successfully Added ***";
                }

                // see if in feed
                qSoc_Feed feed = new qSoc_Feed((int)qSoc_ContentType.Types.Tip, tip_id);
                plhExistingFeedItem.Visible = false;

                if (feed != null)
                {
                    if (feed.FeedID > 0 && feed.MarkAsDelete == 0 && feed.VisibleFeed == true)
                    {
                        chkDisplayInFeed.Checked = true;
                        plhExistingFeedItem.Visible = true;
                    }
                    if (feed.FeedID > 0 && feed.MarkAsDelete == 0 && feed.VisibleExplore == true)
                    {
                        chkDisplayInExplore.Checked = true;
                    }
                    string reserved_keywords = string.Empty;
                    if (!string.IsNullOrEmpty(feed.ReservedKeywords))
                    {
                        reserved_keywords = feed.ReservedKeywords;
                    }
                }
            }

            else
            {
                lblTitle.Text = "New Article";
                btnDelete.Visible = false;
                populateKeywords(0, (int)qSoc_ContentType.Types.Article);
                rblAvailable.SelectedValue = "Yes";
                plhTools.Visible = false;
            }
        }

        if (String.IsNullOrEmpty(Convert.ToString(tip_id)))
            tip_id = (Int32)ViewState["vsTipID"];
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            rblType.Enabled = false;

            if (Request.QueryString["type"] == "story")
            {
                //litBackTop.Text = "tst";    //<a href="\blogs-list.aspx?type=story\" class=\"btn\"><i class=\"icon-circle-arrow-left\"></i>&nbsp;&nbsp;Back to Stories</a>";
                btnSave_top.Text = "SAVE STORY";
                btnSave.Text = "SAVE STORY";
            }
            else if (Request.QueryString["type"] == "blog")
            {
                //litBackTop.Text = "";
                btnSave_top.Text = "SAVE BLOG";
                btnSave.Text = "SAVE BLOG";
            }
            else
            {
                btnSave_top.Text = "SAVE BLOG";
                btnSave.Text = "SAVE BLOG";
            }

            populateThemes();
            populateAuthors();

            // load styles for this project
            string css_text_file = string.Empty;
            if (!String.IsNullOrEmpty(ConfigurationManager.AppSettings["CmsTextCSS"]))
                css_text_file = Convert.ToString(ConfigurationManager.AppSettings["CmsTextCSS"]);

            reContent.CssFiles.Add(css_text_file);

            if (!String.IsNullOrEmpty(Request.QueryString["BlogID"]))
            {

                blog_id = Convert.ToInt32(Request.QueryString["BlogID"]);
                ViewState.Add("vsBlogID", blog_id);

                populateKeywords(blog_id, (int)qSoc_ContentType.Types.Story);
                populateTopics(blog_id, (int)qSoc_ContentType.Types.Story);

                qSoc_Blog2 blog = new qSoc_Blog2(blog_id);
                qSoc_ContentType content = new qSoc_ContentType((int)qSoc_ContentType.Types.Story);

                qPtl_User posted_by = new qPtl_User(blog.UserID);
                owner = posted_by.UserName;
                ViewState.Add("vsOwner", owner);
                owner_id = blog.CreatedBy;
                ViewState.Add("vsOwnerID", owner_id);
                lblPostedTime.Text = " at " + blog.Created;
                ddlStatus.SelectedValue = blog.ApprovedStatus;

                qPtl_User approved_by = new qPtl_User(blog.ApprovedBy);
                lblApprovedBy.Text = "Approved by " + approved_by.UserName + " at " + blog.Approved;
                lblPostedTime.Text = " at " + blog.Created;

                if (Request.QueryString["type"] == "story")
                    lblTitle.Text = "Edit Story (ID: " + blog.BlogID + ")";
                else
                    lblTitle.Text = "Edit Blog (ID: " + blog.BlogID + ")";

                txtTitle.Text = blog.Title;
                txtSummary.Text = blog.Summary;
                reContent.Content = blog.Text;
                if (!String.IsNullOrEmpty(Convert.ToString(blog.AuthorID)))
                    ddlAuthor.SelectedValue = Convert.ToString(blog.AuthorID);
                if (!String.IsNullOrEmpty(Convert.ToString(blog.ThemeID)))
                    ddlTheme.SelectedValue = Convert.ToString(blog.ThemeID);

                rblAvailable.SelectedValue = blog.Available;
                rblType.SelectedValue = blog.Type;

                plhPostedBy.Visible = true;
                hplPreviewArticle.Visible = false;
                hplPreviewArticle.Target = "_blank";

                if (Convert.ToString(Request.QueryString["mode"]) == "add-successful")
                {
                    lblMessage.Text = "*** Record Successfully Added ***";
                }

                // see if in feed
                qSoc_Feed feed = new qSoc_Feed((int)qSoc_ContentType.Types.Story, blog_id);
                plhExistingFeedItem.Visible = false;

                if (feed != null)
                {
                    if (feed.FeedID > 0 && feed.MarkAsDelete == 0 && feed.VisibleFeed == true)
                    {
                        chkDisplayInFeed.Checked = true;
                        plhExistingFeedItem.Visible = true;
                    }
                    if (feed.FeedID > 0 && feed.MarkAsDelete == 0 && feed.VisibleExplore == true)
                    {
                        chkDisplayInExplore.Checked = true;
                    }
                    string reserved_keywords = string.Empty;
                    if (!string.IsNullOrEmpty(feed.ReservedKeywords))
                    {
                        reserved_keywords = feed.ReservedKeywords;
                    }
                }
            }
            else
            {
                if (Request.QueryString["type"] == "story")
                {
                    lblTitle.Text = "New Story";
                    rblType.SelectedValue = "story";
                }
                else
                {
                    lblTitle.Text = "New Blog";
                    rblType.SelectedValue = "blog";
                }
                btnDelete.Visible = false;
                populateKeywords(0, (int)qSoc_ContentType.Types.Story);
                plhPostedBy.Visible = false;
                rblAvailable.SelectedValue = "Yes";
                ddlStatus.SelectedValue = "Approved";
                plhTools.Visible = false;
            }
        }

        var highlighted_item = qSoc_Blog2.GetHighlightedBlog();

        if (highlighted_item != null)
        {
            if (highlighted_item.BlogID == blog_id)
            {
                chkHighlightedItem.Checked = true;
                lblHighlightedMessage.Text = "This is the current highlighted blog ID: " + highlighted_item.BlogID;
            }
            else
                lblHighlightedMessage.Text = "Check to set as the highlighted blog";
        }
        else
            lblHighlightedMessage.Text = "Check to set as the highlighted blog";

        if (String.IsNullOrEmpty(Convert.ToString(blog_id)))
            blog_id = (Int32)ViewState["vsBlogID"];
        if (String.IsNullOrEmpty(Convert.ToString(owner_id)))
            owner_id = (Int32)ViewState["vsOwnerID"];
        if (String.IsNullOrEmpty(owner))
            owner = (String)ViewState["vsOwner"];
    }