protected string GetDeleteImage(int itemID, string itemUserEmail)
 {
     if (DiscussionPermissions.HasDeletePermissions(ModuleID, itemID, itemUserEmail) == true)
     {
         return(getLocalImage("delete.gif"));
     }
     else
     {
         return(getLocalImage("1x1.gif"));
     }
 }
 protected string GetEditImage(string itemUserEmail)
 {
     if (DiscussionPermissions.HasEditPermissions(ModuleID, itemUserEmail))
     {
         return(getLocalImage("edit.gif"));
     }
     else
     {
         return(getLocalImage("1x1.gif"));
     }
 }
 protected string GetReplyImage()
 {
     if (DiscussionPermissions.HasAddPermissions(ModuleID) == true)
     {
         return(getLocalImage("reply.gif"));
     }
     else
     {
         return(getLocalImage("1x1.gif"));
     }
 }
Exemple #4
0
 /// <summary>
 /// GetReplyImage check to see whether the current user has permissions to contribute to the discussion thread
 /// Users with proper permission see an image they can click  on to post a reply, otherwise they see nothing.
 /// </summary>
 /// <returns>Returns either a 1x1 image or the reply.gif icon</returns>
 protected string GetReplyImage()
 {
     // leave next commented statement in for testing back doors
     // return "~/images/reply.gif";
     if (DiscussionPermissions.HasAddPermissions(ModuleID) == true)
     {
         return(getLocalImage("reply.gif"));
     }
     else
     {
         return(getLocalImage("1x1.gif"));
     }
 }
Exemple #5
0
        /// <summary>
        /// The Page_Load server event handler on this page is used
        /// to obtain the ModuleID and ItemID of the discussion list,
        /// and to then display the message contents.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void Page_Load(object sender, System.EventArgs e)
        {
            //Translations on the buttons, it doesn't appear there is a
            //		tra:LinkButton style supported
            submitButton.Text = Esperantus.Localize.GetString("SUBMIT");
            cancelButton.Text = Esperantus.Localize.GetString("CANCEL");

            // Populate message contents if this is the first visit to the page
            if (Page.IsPostBack == false)
            {
                DiscussionDB  discuss;
                SqlDataReader dr;

                switch (GetMode())
                {
                case "REPLY":
                    if (PortalSecurity.HasAddPermissions(ModuleID) == false)
                    {
                        PortalSecurity.AccessDeniedEdit();
                    }

                    DiscussionEditInstructions.Text = Esperantus.Localize.GetString("DS_REPLYTHISMSG");

                    // Load fields for the item that we are replying to
                    discuss = new DiscussionDB();
                    dr      = discuss.GetSingleMessage(ItemID);
                    try
                    {
                        if (dr.Read())
                        {
                            // Update labels with message contents
                            Title.Text         = (string)dr["Title"];
                            Body.Text          = (string)dr["Body"];
                            CreatedByUser.Text = (string)dr["CreatedByUser"];
                            CreatedDate.Text   = string.Format("{0:d}", dr["CreatedDate"]);
                            TitleField.Text    = string.Empty;                                          // don't give users a default subject for their reply
                            // encourage them to title their response
                            // 15/7/2004 added localization by Mario Endara [email protected]
                            if (CreatedByUser.Text == "unknown")
                            {
                                CreatedByUser.Text = Esperantus.Localize.GetString("UNKNOWN", "unknown");
                            }
                        }
                    }
                    finally
                    {
                        dr.Close();
                    }
                    break;

                case "ADD":
                    if (PortalSecurity.HasAddPermissions(ModuleID) == false)
                    {
                        PortalSecurity.AccessDeniedEdit();
                    }

                    // hide the 'previous message' controls
                    OriginalMessagePanel.Visible = false;
                    break;


                case "EDIT":
                {
                    string itemUserEmail = string.Empty;
                    // hide the 'parent message' controls
                    OriginalMessagePanel.Visible    = false;
                    DiscussionEditInstructions.Text = Esperantus.Localize.GetString("EDIT");

                    // Bind the data to the control
                    // Obtain the selected item from the Discussion table
                    discuss = new DiscussionDB();
                    dr      = discuss.GetSingleMessage(ItemID);

                    try
                    {
                        // Load first row from database
                        if (dr.Read())
                        {
                            // Update edit fields with message contents
                            TitleField.Text = (string)dr["Title"];
                            BodyField.Text  = (string)dr["Body"];
                            itemUserEmail   = (string)dr["CreatedByUser"];
                            // 15/7/2004 added localization by Mario Endara [email protected]
                            if (itemUserEmail == "unknown")
                            {
                                itemUserEmail = Esperantus.Localize.GetString("UNKNOWN", "unknown");
                            }
                        }
                    }
                    finally
                    {
                        dr.Close();
                    }

                    if (DiscussionPermissions.HasEditPermissions(ModuleID, itemUserEmail) == false)
                    {
                        PortalSecurity.AccessDeniedEdit();
                    }
                }
                break;

                /* case "DELETE":
                 *      if (PortalSecurity.HasDeletePermissions(ModuleID) == false)
                 *              PortalSecurity.AccessDeniedEdit();
                 *      break;
                 */

                default:
                    // invalid mode specified
                    PortalSecurity.AccessDeniedEdit();
                    break;
                }
            }
        }