Пример #1
0
    protected void LoadToolBar()
    {
        UserAPI m_refUserApi = new UserAPI();
            string AppImgPath = m_refUserApi.AppImgPath;
            ContentAPI refContentAPI = new ContentAPI();
            string AppPath = refContentAPI.AppPath;

            System.Text.StringBuilder result = new System.Text.StringBuilder();
            try
            {
                divTitleBar.InnerHtml = m_refStyle.GetTitleBar(GetMessage("lbl messages"));
                result.Append("<table><tr>");

                // Back button
                result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/back.png", (string)("CommunityMessaging.aspx?action=" + (SentMode ? "viewallsent" : "viewall")), GetMessage("btn back"), GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true));

                if (m_sentMode == false)
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/emailAdd.png", "CommunityMessaging.aspx?action=editmsg", GetMessage("lbl compose a message"), GetMessage("lbl compose a message"), "", StyleHelper.AddEmailButtonCssClass, true));
                    result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/emailDelete.png", (string) ("CommunityMessaging.aspx?action=" + (SentMode ? "viewsentmsg" : "viewmsg") + "&mode=del&id=" + m_id), GetMessage("btn delete"), GetMessage("btn delete"), "", StyleHelper.DeleteEmailButtonCssClass));
                    if (m_bCanReply)
                    {
                        result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/emailReply.png", (string) ("CommunityMessaging.aspx?action=editmsg&id=" + m_id), GetMessage("lbl reply message"), GetMessage("lbl reply message"), "", StyleHelper.ReplyToEmailButtonCssClass));
                    }
                }
                else
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/emailDelete.png", (string) ("CommunityMessaging.aspx?action=" + (SentMode ? "viewsentmsg" : "viewmsg") + "&mode=del&id=" + m_id), GetMessage("btn delete"), GetMessage("btn delete"), "", StyleHelper.DeleteEmailButtonCssClass, true));
                }

                result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/emailForward.png", (string) ("CommunityMessaging.aspx?action=editmsg&mode=fwd&id=" + m_id + "&userid=" + m_msgUserId), GetMessage("lbl forward message"), GetMessage("lbl forward message"), "", StyleHelper.ForwardEmailButtonCssClass));

                long previousMsgID = 0;
                long nextMsgID = 0;
                refContentAPI.GetAjacentPrivateMessagesForCurrentUser(Convert.ToInt64(m_id), System.Convert.ToBoolean(!(SentMode)), ref previousMsgID, ref nextMsgID);
                if (previousMsgID > 0)
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/arrowLeft.png", (string) ("CommunityMessaging.aspx?action=" + (SentMode ? "viewsentmsg" : "viewmsg") + "&id=" + previousMsgID.ToString() + "&userid=" + m_msgUserId.ToString()), GetMessage("lbl previous message"), GetMessage("lbl previous message"), "", StyleHelper.PreviousButtonCssClass));
                }
                else
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/arrowLeftOff.png", "#", GetMessage("lbl previous message"), GetMessage("lbl previous message"), "", StyleHelper.PreviousDisabledButtonCssClass));
                }

                if (nextMsgID > 0)
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/arrowRight.png", (string) ("CommunityMessaging.aspx?action=" + (SentMode ? "viewsentmsg" : "viewmsg") + "&id=" + nextMsgID.ToString() + "&userid=" + m_msgUserId.ToString()), GetMessage("lbl next message"), GetMessage("lbl next message"), "", StyleHelper.NextButtonCssClass));
                }
                else
                {
                    result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/arrowRightOff.png", "#", GetMessage("lbl next message"), GetMessage("lbl next message"), "", StyleHelper.NextDisabledButtonCssClass));
                }

                //CommunityMessaging.aspx?action=" + IIf(SentMode, "viewsentmsg", "viewmsg") + "&id=" + aMessages(idx).ID.ToString()

                result.Append(m_refStyle.GetButtonEventsWCaption(AppPath + "images/ui/icons/print.png", "javascript:window.print();", GetMessage("lbl print message"), GetMessage("lbl print message"), "", StyleHelper.PrintButtonCssClass));
                result.Append(StyleHelper.ActionBarDivider);
                result.Append("<td>");
                if (SentMode)
                {
                    result.Append(m_refStyle.GetHelpButton("view_sent_msg", ""));
                }
                else
                {
                    result.Append(m_refStyle.GetHelpButton("view_msg", ""));
                }
                result.Append("</td>");
                result.Append("</tr></table>");

                divToolBar.InnerHtml = result.ToString();
                result = null;
            }
            catch (Exception ex)
            {
                Utilities.ShowError(ex.Message);
            }
            finally
            {
                refContentAPI = null;
            }
    }