示例#1
0
        /// <summary>
        /// Update the annnouncement
        /// </summary>
        public bool Update(Announcement announce)
        {
            //Check permission
            Authorize(announce.CourseID, Permission.COURSE, "updateannou", announce.CourseID, null);

            announce.Description = HTMLWizard.LineBreakToBR(announce.Description);
            return(m_dp.UpdateAnnouncement(announce));
        }
示例#2
0
        public string FormatLine(int lineindex)
        {
            int    index = 0, t, lindex, sindex, eindex;
            string nline = "", kcolor = m_prefs.KeywordColor, ccolor = m_prefs.CommentColor;

            if (lineindex >= m_lines.Count)
            {
                return("");
            }

            string line = (string)m_lines[lineindex];

            line = HTMLWizard.ConvertAngles(line);
            line = HTMLWizard.ConvertSpaces(line);

            while (index < line.Length)
            {
                lindex = (0 > (t = line.IndexOf("//", index, line.Length - index))) ? line.Length + 1 : t;
                sindex = (0 > (t = line.IndexOf("/*", index, line.Length - index))) ? line.Length + 1 : t;
                eindex = (0 > (t = line.IndexOf("*/", index, line.Length - index))) ? line.Length + 1 : t;

                if (lindex < Math.Min(sindex, eindex))
                {
                    string ncpart = line.Substring(index, lindex - index);
                    string cpart  = line.Substring(lindex, line.Length - lindex);
                    nline += ApplyFormatting(ncpart, kcolor, ccolor) + MakeComment(cpart, ccolor);
                    index  = line.Length;
                }
                else if (sindex < Math.Min(lindex, eindex))
                {
                    string ncpart = line.Substring(index, sindex - index);
                    nline      += ApplyFormatting(ncpart, kcolor, ccolor) + MakeComment("/*", ccolor);
                    m_incomment = true;
                    index       = sindex + 2;
                }
                else if (eindex < Math.Min(lindex, sindex))
                {
                    string cpart = line.Substring(index, eindex - index);
                    m_incomment = false;

                    nline += MakeComment(cpart + "*/", ccolor);
                    index  = eindex + 2;
                }
                else
                {
                    string leftover = line.Substring(index, line.Length - index);
                    nline += ApplyFormatting(leftover, kcolor, ccolor);
                    index  = line.Length;
                }
            }

            nline = HTMLWizard.ConvertControls(nline);
            return(nline);
        }
示例#3
0
        private void BindData(int annID)
        {
            Announcement ann =
                new Announcements(Globals.CurrentIdentity).GetInfo(annID);

            txtTitle.Text    = ann.Title;
            txtDesc.Text     = HTMLWizard.BRToLineBreak(ann.Description);
            lblCourseID.Text = ann.CourseID.ToString();

            lblDate.Text    = "Post Date: " + ann.Created;
            lblPoster.Text  = "Poster: <b>" + ann.Poster + "</b>";
            lblPreview.Text = ann.Description;
        }
示例#4
0
        /// <summary>
        /// Create a new announcement
        /// </summary>
        public bool Create(string poster, string title, string desc, int courseid)
        {
            //Check permission
            Authorize(courseid, Permission.COURSE, "createannou", courseid, null);

            Announcement annou = new Announcement();

            annou.Description = desc;
            annou.Poster      = poster;
            annou.CourseID    = courseid;
            annou.Title       = title;

            //HTMLize the desc
            annou.Description = HTMLWizard.LineBreakToBR(annou.Description);

            return(m_dp.CreateAnnouncement(annou));
        }