Example #1
0
        private void PostExamToBoard(Exam exam, string message)
        {
            var post = new Post()
            {
                Message = $"Exam: {exam.Code.ToString().Substring(0,6).ToUpper()}.<br/>" +
                          $"{message}",
                By = exam.Unit?.Lecturer?.Profile
            };

            post = _repos.Posts.Create(post);

            // get unit board
            var board = _repos.DiscussionBoards
                        .ListWith("Unit", "Posts")
                        .FirstOrDefault(x => x?.Unit.Id == exam.Unit.Id);

            if (board == null)
            {
                board = new DiscussionBoard()
                {
                    Name = "Default Board",
                    Unit = exam.Unit
                };

                board = _repos.DiscussionBoards.Create(board);
            }

            if (board.Posts == null)
            {
                board.Posts = new List <Post>();
            }

            board.Posts.Add(post);
        }
Example #2
0
        public IHttpActionResult PutDiscussionBoard(int id, DiscussionBoard discussionBoard)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != discussionBoard.ID)
            {
                return(BadRequest());
            }

            db.Entry(discussionBoard).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DiscussionBoardExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public void Delete(int id)
        {
            DiscussionBoard board = db.DiscussionBoards.Where(d => d.ID == id).SingleOrDefault();

            db.DiscussionBoards.Remove(board);
            db.SaveChanges();
        }
Example #4
0
        public void OnNewUnit(Unit unit)
        {
            // create
            var board = new DiscussionBoard()
            {
                Name = "Welcome Discussion Board",
                Unit = unit
            };

            _repos.DiscussionBoards.Create(board);
            _repos.Commit();
        }
 public DiscussionBoard Create(DiscussionBoard discussionBoard)
 {
     db.DiscussionBoards.Add(new DiscussionBoard
     {
         ID        = discussionBoard.ID,
         Title     = discussionBoard.Title,
         Content   = discussionBoard.Content,
         CreatedAt = DateTime.Now,
         MemberID  = 1
     });
     db.SaveChanges();
     return(discussionBoard);
 }
Example #6
0
        public IActionResult Create(int unitId, string name)
        {
            var board = new DiscussionBoard()
            {
                Name   = name,
                UnitId = unitId
            };

            board = _repos.DiscussionBoards.Create(board);
            _repos.Commit();

            return(Ok("Board created successfully!"));
        }
Example #7
0
        private void PostContentToBoard(Content content)
        {
            var post = new Post()
            {
                Message = $"Uploaded content: {content.Title}",
            };

            if (content.UploadedBy != null)
            {
                if (content.UploadedBy.Profile != null)
                {
                    post.By = content.UploadedBy.Profile;
                }
            }

            post.Medias = new List <Content>
            {
                content
            };
            post = _repos.Posts.Create(post);

            // get unit board
            var board = _repos.DiscussionBoards
                        .ListWith("Unit", "Posts")
                        .FirstOrDefault(x => x.UnitId == content.Unit.Id);

            if (board == null)
            {
                board = new DiscussionBoard()
                {
                    Name = "Default Board",
                    Unit = content.Unit
                };

                board = _repos.DiscussionBoards.Create(board);
            }

            _repos.Commit();
            if (board.Posts == null)
            {
                board.Posts = new List <Post>();
            }
            board.Posts.Add(post);
            board = _repos.DiscussionBoards.Update(board);
        }
Example #8
0
 public IHttpActionResult PostDiscussionBoard(DiscussionBoard discussionBoard)
 {
     repository.Create(discussionBoard);
     return(Content(HttpStatusCode.OK, discussionBoard));
 }
Example #9
0
    protected override void Page_Load(object sender, System.EventArgs e)
    {
        try
        {
            base.Page_Load(sender, e);
            if (!usesModal)
            {
                ShowDropUploader(false);
            }

            if (Request.QueryString["catid"] != "")
            {
                _CategoryId = Convert.ToInt64(Request.QueryString["catid"]);
            }
            if (Request.QueryString["groupId"] != "")
            {
                _GroupID = Convert.ToInt64(Request.QueryString["groupId"]);
            }
            if (!(Page.IsPostBack))
            {
                ltr_adb_ra.Text = m_refMsg.GetMessage("lbl require authentication");
                ltr_adb_mc.Text = m_refMsg.GetMessage("lbl moderate comments");
                if (m_sPageAction == "editprop")
                {
                    _editMode = true;

                    if (_EkContentRef.RequestInformation.IsMembershipUser == 1 && _EkContentRef.IsAllowed(m_iID, 0, "folder", "EditFolders", 0) == false)
                    {
                        throw (new Exception(base.GetMessage("com: user does not have permission")));
                    }
                    base.SetTitleBarToMessage("edit board prop title");

                    if (!usesModal)
                    {
                        base.AddBackButton((string)("addeditboard.aspx?action=View&id=" + m_iID.ToString()));
                    }

                    base.AddButtonwithMessages(m_refContentApi.AppPath + "images/UI/Icons/save.png", "#", "lbl alt edit board", "lbl save board", " onclick=\"javascript:return CheckDiscussionBoardParameters();\" ", StyleHelper.SaveButtonCssClass, true);
                    if (usesModal)
                    {
                        base.AddButtonwithMessages(AppImgPath + "../UI/Icons/cancel.png", "#", "generic cancel", "generic cancel", " onclick=\"self.parent.ektb_remove();\" ", StyleHelper.RemoveButtonCssClass);
                    }

                    base.AddHelpButton("EditBoard");

                    _DiscussionBoard = _EkContentRef.GetBoardbyID(m_iID.ToString());
                    _Categories = _DiscussionBoard.Categories;

                    txt_adb_boardname.Text = _DiscussionBoard.Name;
                    hdn_adb_boardname.Value = _DiscussionBoard.Name;
                    ltr_boardid_data.Text = _DiscussionBoard.Id.ToString();
                    txt_adb_title.Text = _DiscussionBoard.Description;
                    ltr_acceptedhtml.Text = base.GetMessage("lbl acceptedhtml");
                    txt_acceptedhtml.Text = _DiscussionBoard.AcceptedHTML;
                    ltr_acceptedextensions.Text = base.GetMessage("lbl acceptedextensions");
                    txt_acceptedextensions.Text = _DiscussionBoard.AcceptedExtensions;
                    chk_adb_mc.Checked = _DiscussionBoard.ModerateComments;
                    chk_adb_ra.Checked = _DiscussionBoard.RequireAuthentication;
                    chk_lock_board.Checked = _DiscussionBoard.LockBoard;
                    txt_adb_stylesheet.Text = _DiscussionBoard.StyleSheet;
                    ltr_sitepath.Text = m_refContentApi.SitePath;
                    ltr_maxfilesize.Text = base.GetMessage("lbl max file size");
                    txt_maxfilesize.Text = _DiscussionBoard.MaxFileSize.ToString();
                    ltr_bytes.Text = base.GetMessage("lbl bytes");
                    ltr_comma_ext.Text = base.GetMessage("lbl comma sep");
                    ltr_comma_html.Text = base.GetMessage("lbl comma sep");
                    drp_theme.Attributes.Add("onchange", "javascript:updatetheme();");

                    _PermissionData = m_refContentApi.LoadPermissions(m_iID, "folder", 0);
                    _Editor.ID = "content_html";
                    _Editor.FolderId = m_iID;
                    _Editor.SetPermissions(_PermissionData);
                    _Editor.AllowFonts = true;
                    _Editor.Content = _DiscussionBoard.TermsAndConditions;
                    _Editor.Visible = true;
                    pnlTerms.Controls.Add(_Editor);

                    hdn_adf_folderid.Value = m_iID.ToString();
                    hdn_adb_action.Value = "prop";
                    SetLabels("prop");
                    ShowCategories();
                    SetCSSdropdown(_DiscussionBoard.StyleSheet);
                    Display_DiscussionBoardJS("");
                    lit_ef_templatedata.Text = "<input type=\"hidden\" id=\"language\" value=\"" + this.ContentLanguage + "\" /><input type=\"hidden\" maxlength=\"255\" size=\"" + (75 - m_refContentApi.SitePath.Length) + "\" value=\"\" name=\"templatefilename\" id=\"templatefilename\">";
                    DrawContentTemplatesTable("edit");
                    DrawFolderTaxonomyTable();
                    DisplaySitemapPath();
                }
                else if (m_sPageAction == "viewcat")
                {
                    _DiscussionBoard = _EkContentRef.GetBoardbyID(m_iID.ToString());
                    _Categories = _DiscussionBoard.Categories;

                    base.SetTitleBarToMessage("view board subject title");

                    if (usesModal)
                    {
                        base.AddBackButton("addeditboard.aspx?action=editprop&id=" + m_iID.ToString() + "&thickbox=true");
                    }
                    else
                    {
                        base.AddBackButton("addeditboard.aspx?action=View&id=" + m_iID.ToString());
                    }

                    base.AddButtonwithMessages(m_refContentApi.AppPath + "images/UI/Icons/contentEdit.png", (string)("addeditboard.aspx?LangType=" + this.ContentLanguage.ToString() + "&action=editcat&id=" + m_iID.ToString() + "&catid=" + _CategoryId.ToString()), "lbl alt edit board subject", "edit board subject title", "", StyleHelper.EditButtonCssClass, true);
                    if (_Categories.Length > 1) // do not allow delete if this is the only category in the board
                    {
                        base.AddButtonwithMessages(m_refContentApi.AppPath + "images/UI/Icons/delete.png", (string)("addeditboard.aspx?LangType=" + this.ContentLanguage.ToString() + "&action=delcat&id=" + m_iID.ToString() + "&catid=" + _CategoryId.ToString()), "lbl alt delete board subject", "delete board subject title", "", StyleHelper.DeleteButtonCssClass);
                    }

                    base.AddHelpButton("ViewBoardCategories");

                    for (int i = 0; i <= (_Categories.Length - 1); i++)
                    {
                        if (_Categories[i].CategoryID == _CategoryId)
                        {
                            txt_catname.Text = _Categories[i].Name;
                            lbl_catid.Text = _Categories[i].CategoryID.ToString();
                            txt_catsort.Text = _Categories[i].SortOrder.ToString();
                        }
                    }

                    txt_catname.Enabled = false;
                    txt_catsort.Enabled = false;

                    hdn_adf_folderid.Value = m_iID.ToString();
                    hdn_adb_action.Value = "cat";
                    SetLabels("cat");
                    ShowCategories();
                    Display_EditCatJS();
                }
                else if (m_sPageAction == "editcat")
                {
                    base.SetTitleBarToMessage("edit board subject title");

                    if (usesModal)
                    {
                        base.AddBackButton("addeditboard.aspx?LangType=" + this.ContentLanguage.ToString() + "&action=editprop&id=" + m_iID.ToString() + "&thickbox=true");
                    }
                    else
                    {
                        base.AddBackButton("addeditboard.aspx?LangType=" + this.ContentLanguage.ToString() + "&action=Viewcat&id=" + m_iID.ToString() + "&catid=" + _CategoryId.ToString());
                    }

                    base.AddButtonwithMessages(m_refContentApi.AppPath + "images/UI/Icons/save.png", "#", "lbl alt save board subject", "lbl save board subject", " onclick=\"javascript:return CheckBoardCatParameters();\" ", StyleHelper.SaveButtonCssClass, true);

                    base.AddHelpButton("EditBoardCategories");

                    _DiscussionBoard = _EkContentRef.GetBoardbyID(m_iID.ToString());
                    _Categories = _DiscussionBoard.Categories;

                    for (int i = 0; i <= (_Categories.Length - 1); i++)
                    {
                        if (_Categories[i].CategoryID == _CategoryId)
                        {
                            txt_catname.Text = _Categories[i].Name;
                            ltr_catid.Text = _Categories[i].CategoryID.ToString();
                            txt_catsort.Text = _Categories[i].SortOrder.ToString();
                        }
                    }

                    txt_adb_boardname.Text = _DiscussionBoard.Name;
                    txt_adb_title.Text = _DiscussionBoard.Description;
                    chk_adb_mc.Checked = _DiscussionBoard.ModerateComments;
                    chk_adb_ra.Checked = _DiscussionBoard.RequireAuthentication;
                    chk_lock_board.Checked = _DiscussionBoard.LockBoard;
                    txt_adb_stylesheet.Text = _DiscussionBoard.StyleSheet;
                    ltr_sitepath.Text = m_refContentApi.SitePath;

                    hdn_adf_folderid.Value = m_iID.ToString();
                    hdn_adb_action.Value = "cat";
                    SetLabels("cat");
                    ShowCategories();
                    Display_EditCatJS();
                }
                else if (m_sPageAction == "delcat")
                {
                    int removeid = 0;
                    base.SetTitleBarToMessage("delete board subject title");

                    base.AddBackButton((string)("addeditboard.aspx?LangType=" + this.ContentLanguage.ToString() + "&action=viewcat&id=" + m_iID.ToString() + "&catid=" + _CategoryId.ToString()));

                    base.AddButtonwithMessages(m_refContentApi.AppPath + "images/UI/Icons/delete.png", "#", "lbl alt delete board", "delete board subject title", " onclick=\"javascript:return CheckDelete();\" ", StyleHelper.DeleteButtonCssClass, true);

                    base.AddHelpButton("DeleteBoardCategories");

                    _DiscussionBoard = _EkContentRef.GetBoardbyID(m_iID.ToString());
                    _Categories = _DiscussionBoard.Categories;

                    for (int i = 0; i <= (_Categories.Length - 1); i++)
                    {
                        if (_Categories[i].CategoryID == _CategoryId)
                        {
                            ltr_delcatnamedata.Text = _Categories[i].Name;
                            removeid = i;
                            break;
                        }
                    }
                    drp_movecat.DataSource = _Categories;
                    drp_movecat.DataTextField = "Name";
                    drp_movecat.DataValueField = "CategoryID";
                    drp_movecat.DataBind();
                    drp_movecat.Items.RemoveAt(removeid);
                    drp_movecat.SelectedIndex = 0;

                    hdn_adf_folderid.Value = m_iID.ToString();
                    hdn_adb_action.Value = "delcat";
                    SetLabels("delcat");
                    //ShowCategories()
                    Display_DeleteCatJS();
                }
                else if (m_sPageAction == "addcat")
                {
                    base.SetTitleBarToMessage("add board subject title");

                    base.AddBackButton((string)("../content.aspx?action=ViewContentByCategory&id=" + m_iID.ToString()));

                    base.AddButtonwithMessages(m_refContentApi.AppPath + "images/UI/Icons/save.png", "#", "lbl alt save board subject", "lbl save board subject", " onclick=\"javascript:return CheckBoardCatParameters();\" ", StyleHelper.SaveButtonCssClass, true);

                    base.AddHelpButton("AddBoardCategories");

                    _DiscussionBoard = _EkContentRef.GetBoardbyID(m_iID.ToString());
                    _Categories = _DiscussionBoard.Categories;

                    txt_catname.Text = "";
                    txt_catsort.Text = "1";
                    tr_catid.Visible = false;

                    hdn_adf_folderid.Value = m_iID.ToString();
                    hdn_adb_action.Value = "addcat";
                    SetLabels("cat");
                    ShowCategories();
                    Display_EditCatJS();
                }
                else //view
                {
                    base.Version8TabsImplemented = true;
                    base.SetTitleBarToMessage("view board prop title");

                    //MyBase.AddButtonwithMessages(m_refContentApi.AppImgPath & "btn_EventTypes-nm.gif", "addeditboard.aspx?LangType=" & m_refContentApi.ContentLanguage & "&action=editcat&id=" & m_iID.ToString(), "alt editboard cat", "lbl editboard cat", "")
                    if (usesModal)
                    {
                        base.AddButtonwithMessages(m_refContentApi.AppPath + "images/UI/Icons/contentEdit.png", (string)("addeditboard.aspx?LangType=" + m_refContentApi.ContentLanguage + "&action=editprop&id=" + m_iID.ToString() + "&thickbox=true"), "alt editboard prop", "lbl editboard prop", "", StyleHelper.EditButtonCssClass, true);
                        base.AddButtonwithMessages(AppImgPath + "../UI/Icons/cancel.png", "#", "generic cancel", "generic cancel", " onclick=\"self.parent.ektb_remove();\" ", StyleHelper.RemoveButtonCssClass);
                    }
                    else
                    {
                        base.AddBackButton("../content.aspx?action=ViewContentByCategory&id=" + m_iID.ToString());
                        base.AddButtonwithMessages(m_refContentApi.AppPath + "images/UI/Icons/contentEdit.png", (string)("addeditboard.aspx?LangType=" + m_refContentApi.ContentLanguage + "&action=editprop&id=" + m_iID.ToString()), "alt editboard prop", "lbl editboard prop", "", StyleHelper.EditButtonCssClass, true);
                    }

                    base.AddHelpButton("ViewBoardProp");

                    _DiscussionBoard = _EkContentRef.GetBoardbyID(m_iID.ToString());
                    _Categories = _DiscussionBoard.Categories;

                    txt_adb_boardname.Text = _DiscussionBoard.Name;
                    txt_adb_title.Text = _DiscussionBoard.Description;
                    ltr_acceptedhtml.Text = base.GetMessage("lbl acceptedhtml");
                    txt_acceptedhtml.Text = _DiscussionBoard.AcceptedHTML;
                    ltr_acceptedextensions.Text = base.GetMessage("lbl acceptedextensions");
                    txt_acceptedextensions.Text = _DiscussionBoard.AcceptedExtensions;
                    ltr_boardid_data.Text = _DiscussionBoard.Id.ToString();
                    chk_adb_mc.Checked = _DiscussionBoard.ModerateComments;
                    chk_adb_ra.Checked = _DiscussionBoard.RequireAuthentication;
                    chk_lock_board.Checked = _DiscussionBoard.LockBoard;
                    txt_adb_stylesheet.Text = _DiscussionBoard.StyleSheet;
                    ltr_sitepath.Text = m_refContentApi.SitePath;
                    chkInheritSitemapPath.Checked = Convert.ToBoolean(_DiscussionBoard.SitemapInherited);

                    Literal termsText = new Literal();
                    termsText.Text = _DiscussionBoard.TermsAndConditions;
                    pnlTerms.Controls.Add(termsText);

                    ltr_maxfilesize.Text = base.GetMessage("lbl max file size");
                    txt_maxfilesize.Text = _DiscussionBoard.MaxFileSize.ToString();
                    ltr_bytes.Text = base.GetMessage("lbl bytes");
                    ltr_comma_ext.Text = base.GetMessage("lbl comma sep");
                    ltr_comma_html.Text = base.GetMessage("lbl comma sep");

                    Display_DiscussionBoardJS("view");

                    hdn_adf_folderid.Value = m_iID.ToString();
                    SetLabels("");
                    ShowCategories();
                    SetCSSdropdown(_DiscussionBoard.StyleSheet);
                    SetDisabled();
                    lit_ef_templatedata.Text = "<input type=\"hidden\" maxlength=\"255\" size=\"" + (75 - m_refContentApi.SitePath.Length) + "\" value=\"\" name=\"templatefilename\" id=\"templatefilename\">";
                    DrawContentTemplatesTable("view");
                    DrawFolderTaxonomyTable();
                    ViewSitemapPath();
                }
            }
            else
            {
                Process_DoUpdate();
            }
        }
        catch (Exception ex)
        {
            Utilities.ShowError(ex.Message);
        }
    }
Example #10
0
    private void Process_DoUpdate()
    {
        string sTerms = "";
        if (Request.Form[hdn_adb_action.UniqueID] == "prop")
        {

            this._OldTemplateName = m_refContentApi.GetTemplatesByFolderId(m_iID).FileName;
            _DiscussionBoard.Id = m_iID;
            _DiscussionBoard.Name = (string)(Request.Form[txt_adb_boardname.UniqueID].Trim(".".ToCharArray()));
            _DiscussionBoard.Title = Request.Form[txt_adb_title.UniqueID];

            //BreadCrumb/SiteMapPath update.
            if ((Request.Form["hdnInheritSitemap"] != null) && (Request.Form["hdnInheritSitemap"].ToString().ToLower() == "true"))
            {
                _DiscussionBoard.SitemapInherited = Convert.ToInt32(true);
            }
            else
            {
                _DiscussionBoard.SitemapInherited = Convert.ToInt32(false);
                _DiscussionBoard.SitemapPath = Utilities.DeserializeSitemapPath(Request.Form, this.ContentLanguage);
            }

            _DiscussionBoard.AcceptedHTML = this.ProcessCSV(Request.Form[txt_acceptedhtml.UniqueID], "html");
            _DiscussionBoard.AcceptedExtensions = this.ProcessCSV(Request.Form[txt_acceptedextensions.UniqueID], "ext");

            if (Request.Form[chk_adb_mc.UniqueID] != null && Request.Form[chk_adb_mc.UniqueID] != "")
            {
                _DiscussionBoard.ModerateComments = true;
            }
            else
            {
                _DiscussionBoard.ModerateComments = false;
            }
            if (Request.Form[chk_adb_ra.UniqueID] != null && Request.Form[chk_adb_ra.UniqueID] != "")
            {
                _DiscussionBoard.RequireAuthentication = true;
            }
            else
            {
                _DiscussionBoard.RequireAuthentication = false;
            }
            if (Request.Form[chk_lock_board.UniqueID] != null && Request.Form[chk_lock_board.UniqueID] != "")
            {
                _DiscussionBoard.LockBoard = true;
            }
            else
            {
                _DiscussionBoard.LockBoard = false;
            }
            // handle dynamic replication properties
            if ((Request.Form[chk_repl.UniqueID] != null && Request.Form[chk_repl.UniqueID] != "") || (Request.Form["EnableReplication"] != null && Request.Form["EnableReplication"] == "1"))
            {
                _DiscussionBoard.ReplicationMethod = 1;
            }
            else
            {
                _DiscussionBoard.ReplicationMethod = 0;
            }
            sTerms = (string)_Editor.Content;
            if (!(Request.Form["content_html_action"] == null))
            {
                sTerms = Context.Server.HtmlDecode(sTerms);
            }
            _DiscussionBoard.TermsAndConditions = sTerms;
            _DiscussionBoard.StyleSheet = Request.Form[txt_adb_stylesheet.UniqueID];
            if (Information.IsNumeric(Request.Form[txt_maxfilesize.UniqueID]) && Convert.ToInt32(Request.Form[txt_maxfilesize.UniqueID]) > 0)
            {
                _DiscussionBoard.MaxFileSize = Convert.ToInt32(Request.Form[txt_maxfilesize.UniqueID]);
            }
            else
            {
                _DiscussionBoard.MaxFileSize = 0;
            }

            _DiscussionBoard.TaxonomyInherited = false;

            if ((Request.Form["CategoryRequired"] != null) && Request.Form["CategoryRequired"].ToString().ToLower() == "on")
            {
                _DiscussionBoard.CategoryRequired = true;
            }
            else
            {
                _DiscussionBoard.CategoryRequired = Convert.ToBoolean(Convert.ToInt32(Request.Form[parent_category_required.UniqueID]));
            }

            if (Request.Form["taxlist"] == null || Request.Form["taxlist"].Trim().Length == 0)
            {
                _DiscussionBoard.CategoryRequired = false;
            }

            string IdRequests = "";
            if ((Request.Form["taxlist"] != null) && Request.Form["taxlist"] != "")
            {
                IdRequests = Request.Form["taxlist"];
            }

            //dbBoard.TaxonomyInheritedFrom = Convert.ToInt32(Request.Form(inherit_taxonomy_from.UniqueID))
            if (_GroupID != -1)
            {
                _EkContentRef.UpdateBoard(_DiscussionBoard, _GroupID);
            }
            else
            {
                _DiscussionBoard = _EkContentRef.UpdateBoard(_DiscussionBoard);

            }

            FolderRequest folder_request = new FolderRequest();
            _FolderData = m_refContentApi.GetFolderById(m_iID);

            //@folderid int,
            //@foldername nvarchar(75),
            //@folderdescription nvarchar(255),
            //@stylesheet nvarchar(255),
            //@inheritmeta int,
            //@inheritmetafrom int,
            //@replicationflag int,
            //@productionhost nvarchar(510)='',
            //@staginghost nvarchar(510)='',
            //@inheritmetadata int,
            //@inheritmetadatafrom int,
            //@inherittaxonomy bit=0,
            //@inherittaxonomyfrom int=0,
            //@categoryrequired bit=0,
            //@catlanguage int=1033, ??
            //@catlist varchar(4000)=''

            folder_request.FolderId = _FolderData.Id;
            folder_request.FolderName = _FolderData.Name;
            folder_request.FolderDescription = _FolderData.Description;
            folder_request.StyleSheet = _FolderData.StyleSheet;
            folder_request.MetaInherited = _FolderData.MetaInherited;
            folder_request.MetaInheritedFrom = _FolderData.MetaInheritedFrom;
            //folder_request.EnableReplication = ??
            folder_request.DomainProduction = _FolderData.DomainProduction;
            folder_request.DomainStaging = _FolderData.DomainStaging;
            folder_request.MetaInherited = _FolderData.MetaInherited;
            folder_request.TaxonomyInherited = false;
            folder_request.TaxonomyInheritedFrom = _FolderData.MetaInheritedFrom;
            folder_request.CategoryRequired = _FolderData.CategoryRequired;

            //Updating Board folder with Sitemap information.
            folder_request.SiteMapPath = _DiscussionBoard.SitemapPath;
            folder_request.SiteMapPathInherit = System.Convert.ToBoolean(_DiscussionBoard.SitemapInherited);
            //catlanguage ??
            folder_request.TaxonomyIdList = IdRequests;
            if (_GroupID != -1)
            {
                m_refContentApi.UpdateBoardForumFolder(folder_request, _GroupID);
            }
            else
            {
                m_refContentApi.UpdateFolder(folder_request);
            }

            ProcessContentTemplatesPostBack();
            if (usesModal)
            {
                Response.Redirect(m_refContentApi.ApplicationPath + "CloseThickbox.aspx", false);
            }
            else if (Request.Form[hdn_adb_boardname.UniqueID] == Request.Form[txt_adb_boardname.UniqueID])
            {
                Response.Redirect((string)("addeditboard.aspx?action=View&id=" + _DiscussionBoard.Id.ToString()), false);
            }
            else
            {
                Response.Redirect("../content.aspx?TreeUpdated=1&LangType=" + ContentLanguage + "&action=ViewBoard&id=" + m_iID.ToString() + "&reloadtrees=Forms,Content,Library", false);
            }

            //If Not (Request.Form("suppress_notification") <> "") Then
            //    m_refcontent.UpdateSubscriptionPropertiesForFolder(m_intFolderId, sub_prop_data)
            //    m_refcontent.UpdateSubscriptionsForFolder(m_intFolderId, page_subscription_data)
            //End If

        }
        else if (Request.Form[hdn_adb_action.UniqueID] == "cat")
        {
            Ektron.Cms.DiscussionCategory[] acCat = new DiscussionCategory[1];
            acCat[0] = new Ektron.Cms.DiscussionCategory();
            acCat[0].BoardID = m_iID;
            acCat[0].CategoryID = _CategoryId;
            acCat[0].Name = Request.Form[txt_catname.UniqueID];
            acCat[0].SetSortOrder(Convert.ToInt32(Request.Form[txt_catsort.UniqueID]));

            _EkContentRef.UpdateCategory(acCat);

            if (usesModal)
            {
                Response.Redirect("addeditboard.aspx?action=View&id=" + m_iID.ToString() + "&thickbox=true", false);
            }
            else
            {
                Response.Redirect("addeditboard.aspx?action=View&id=" + m_iID.ToString(), false);
            }

        }
        else if (Request.Form[hdn_adb_action.UniqueID] == "addcat")
        {
            Ektron.Cms.DiscussionCategory[] acCat = new DiscussionCategory[1];
            acCat[0] = new Ektron.Cms.DiscussionCategory();
            acCat[0].BoardID = m_iID;
            acCat[0].CategoryID = 0;
            acCat[0].Name = Request.Form[txt_catname.UniqueID];
            acCat[0].SetSortOrder(Convert.ToInt32(Request.Form[txt_catsort.UniqueID]));

            _EkContentRef.AddCategoryforBoard(acCat);

            Response.Redirect((string)("../content.aspx?action=ViewContentByCategory&id=" + m_iID.ToString()), false);
        }
        else if (Request.Form[hdn_adb_action.UniqueID] == "delcat")
        {
            _EkContentRef.DeleteBoardCategory(_CategoryId, Convert.ToInt64(Request.Form[drp_movecat.UniqueID]));
            Response.Redirect((string)("addeditboard.aspx?action=View&id=" + m_iID.ToString()), false);
        }
    }
Example #11
0
 private void Process_Add()
 {
     string strContent = "";
     if (m_refContentApi.RequestInformationRef.ContentLanguage > 0)
     {
         m_reftask.ContentLanguage = m_refContentApi.RequestInformationRef.ContentLanguage;
         m_reftask.LanguageID = m_refContentApi.RequestInformationRef.ContentLanguage;
     }
     else
     {
         m_reftask.ContentLanguage = m_refContentApi.RequestInformationRef.DefaultContentLanguage;
         m_reftask.LanguageID = m_refContentApi.RequestInformationRef.DefaultContentLanguage;
     }
     m_reftask.ContentID = m_iTopicID;
     _Board = m_refContent.GetTopicbyIDForEdit(this.m_iTopicID.ToString());
     m_reftask.AssignedByUserID = m_refContentApi.RequestInformationRef.UserId.ToString();
     m_reftask.CreatedByUserID = m_refContentApi.RequestInformationRef.UserId;
     m_reftask.DateCreated = (string)(DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString());
     m_reftask.TaskTypeID = Convert.ToInt64(EkEnumeration.TaskType.TopicReply);
     if (!string.IsNullOrEmpty(Request.Form[drp_state.UniqueID]))
     {
         m_reftask.State = Request.Form[drp_state.UniqueID];
         m_reftask.ParentID = m_iID;
     }
     else
     {
         m_reftask.State = Request.Form["replystate"];
         if (m_reftask.State == "5")
         {
             if (m_iID == 0)
             {
                 m_reftask.ParentID = -1;
             }
             else
             {
                 m_reftask.ParentID = m_iID * -1;
             }
         }
         else
         {
             m_reftask.ParentID = m_iID;
         }
     }
     strContent = (string)ctlEditor.Content;
     if (strContent == "")
     {
         throw (new Exception(base.GetMessage("js: null text message") + "."));
     }
     else
     {
         strContent = this.m_refContentApi.ReplaceWordsForBoardPosts(strContent, _Board.Id);
         m_reftask.Description = strContent;
         m_reftask.TaskTitle = "TopicReply";
         m_reftask.ImpersonateUser = true;
         m_reftask.CommentDisplayName = ""; //m_refContentApi.RequestInformationRef.LoggedInUsername
         m_reftask.CommentEmail = "";
         m_reftask.CommentURI = Request.ServerVariables["REMOTE_ADDR"];
         m_reftask.HostURL = Request.ServerVariables["HTTP_HOST"];
         m_reftask.URLpath = this.m_refContentApi.SitePath + _Board.TemplateFileName;
         m_reftask.AddTask();
         if (closeOnFinish == true)
         {
             Response.Redirect("../close.aspx", false);
         }
         else
         {
             Response.Redirect((string)("../content.aspx?id=" + m_iForumID.ToString() + "&action=ViewContentByCategory&LangType=" + m_refContentApi.RequestInformationRef.ContentLanguage.ToString() + "&ContType=" + Convert.ToInt64(EkEnumeration.TaskType.TopicReply) + "&contentid=" + m_iTopicID.ToString()), false);
         }
     }
 }
Example #12
0
 protected void Page_PreLoad(object sender, System.EventArgs e)
 {
     if ((Request.QueryString["b"] != null) && (Request.QueryString["fid"] != null))
     {
         iboardid = Convert.ToInt64(Request.QueryString["b"]);
         iforumid = Convert.ToInt64(Request.QueryString["fid"]);
         if (Request.QueryString["t"] != null)
         {
             itopicid = Convert.ToInt64(Request.QueryString["t"]);
         }
         if (itopicid != 0)
         {
             _board = m_refContentApi.GetTopic(itopicid);
             iforumid = _board.Forums[0].Id;
         }
         else
         {
             _board = m_refContentApi.GetForum(iforumid);
         }
         ltr_allowedext.Text = m_refMsg.GetMessage("lbl allowed extensions") + "&nbsp;" + "&nbsp;" + _board.AcceptedExtensions.Replace(",", " ");
     }
     else
     {
         // exception out
     }
     security_data = this.m_refContentApi.LoadPermissions(iboardid, "folder", 0);
     if (!(security_data.IsAdmin == true || security_data.CanAddToFileLib == true))
     {
         Utilities.ShowError("You do not have permission.");
     }
 }
Example #13
0
    private void Display_Add()
    {
        bool bModerate = false;
        //If security_data.CanAdd = False Then
        //    Throw New Exception("User does not have permission")
        //End If
        if (this.m_iTopicID == 0)
        {
            this.m_iTopicID = m_iID;
            m_iID = 0;
        }

        if (this.m_iTopicID != 0 && this.m_iTopicID != -1)
        {
            _Board = m_refContent.GetTopicbyIDForEdit(this.m_iTopicID.ToString());
            security_data = m_refContentApi.LoadPermissions(this.m_iTopicID, "folder", 0);
            if (!(_Board == null) && _Board.Forums.Length > 0 && !(_Board.Forums[0].Topics == null) && (_Board.Forums[0].Topics.Length > 0))
            {
                bModerate = System.Convert.ToBoolean(_Board.Forums[0].ModerateComments);
                _Topic = _Board.Forums[0].Topics[0];
                ltr_topic_data.Text = "(" + this.m_iTopicID.ToString() + ") " + _Topic.Title;
            }
            else
            {
                throw (new Exception(base.GetMessage("error: content does not exist") + " \"" + this.m_iTopicID + "\"."));
            }
        }
        base.SetTitleBarToMessage("atl btn add reply");

        if (closeOnFinish != true)
        {
            base.AddBackButton((string)("../content.aspx?action=ViewContentByCategory&id=" + m_iForumID.ToString() + "&LangType=" + m_refContentApi.RequestInformationRef.ContentLanguage + "&ContType=" + Convert.ToInt64(Ektron.Cms.Common.EkEnumeration.TaskType.TopicReply) + "&contentid=" + m_iTopicID));
        }

        base.AddButtonwithMessages(AppImgPath + "../UI/Icons/save.png", "#", "alt save button text (content)", "btn save", "OnClick=\"javascript:SubmitForm();return false;\"", StyleHelper.SaveButtonCssClass, true);

        base.AddHelpButton("AddReply");

        tr_createdBy.Visible = false;
        tr_createdDate.Visible = false;

        SetLabels();
        if (bModerate == true && (security_data.IsAdmin == false && security_data.CanAddToImageLib == false))
        {
            drp_state.SelectedIndex = 0; // pending
            this.drp_state.Enabled = false;
            pnl_message_editor.Controls.Add(new LiteralControl("<input type=\"hidden\" name=\"replystate\" value=\"5\" />"));
        }
        else if (bModerate == false && (security_data.IsAdmin == false && security_data.CanAddToImageLib == false))
        {
            drp_state.SelectedIndex = 1; // approved
            this.drp_state.Enabled = false;
            pnl_message_editor.Controls.Add(new LiteralControl("<input type=\"hidden\" name=\"replystate\" value=\"7\" />"));
        }
        else
        {
            drp_state.SelectedIndex = 1; // approved
        }

        _Board = m_refContent.GetTopicbyIDForEdit(m_iTopicID.ToString());

        ctlEditor.FolderId = m_iForumID;
        ctlEditor.SetPermissions(security_data);
        ctlEditor.AllowFonts = true;
        if (_Board != null && _Board.StyleSheet.Length > 0)
        {
            ctlEditor.Stylesheet = m_refContentApi.SitePath + _Board.StyleSheet;
        }
        ctlEditor.Visible = true;
        RenderJS();
        SuppressTitle();
    }
Example #14
0
    public bool ViewContentByCategory()
    {
        _CurrentUserId = _ContentApi.UserId;
        _AppImgPath = _ContentApi.AppImgPath;
        _AppPath = _ContentApi.AppPath;
        _SitePath = _ContentApi.SitePath;
        _EnableMultilingual = _ContentApi.EnableMultilingual;

        url_action.Text = _PageAction;
        url_id.Text = _Id.ToString();

        if (_FolderData == null)
        {
            _FolderData = _ContentApi.GetFolderById(_Id);
        }
        if (_FolderData == null)
        {
            Response.Redirect((string)("reterror.aspx?info=" + _MessageHelper.GetMessage("com: folder does not exist")), true);
            return false;
        }
        else
        {
            if (_FolderData.XmlConfiguration != null)
            {
                _HasXmlConfig = true;
            }
            _PermissionData = _ContentApi.LoadPermissions(_Id, "folder", 0);
            _FolderType = _FolderData.FolderType;
        }

        //Setting JS Variable for global use through workarea.aspx page.
        pasteFolderType.Text = Convert.ToString(_FolderData.FolderType);
        pasteFolderId.Text = Convert.ToString(_FolderData.Id);
        pasteParentId.Text = Convert.ToString(_FolderData.ParentId);

        if (!string.IsNullOrEmpty(Request.QueryString["IsArchivedEvent"]))
        {
            _IsArchivedEvent = Convert.ToBoolean(Request.QueryString["IsArchivedEvent"]);
            is_archived.Text = Convert.ToString(_IsArchivedEvent);
        }

        _AssetInfoData = _ContentApi.GetAssetSupertypes();
        if ((Ektron.Cms.Common.EkConstants.CMSContentType_Content == Convert.ToInt32(_ContentTypeSelected)) || (Ektron.Cms.Common.EkConstants.CMSContentType_Archive_Content == Convert.ToInt32(_ContentTypeSelected)) || (Ektron.Cms.Common.EkConstants.CMSContentType_XmlConfig == Convert.ToInt32(_ContentTypeSelected)))
        {
            _ContentType = int.Parse(_ContentTypeSelected);
        }
        else if (Ektron.Cms.Common.EkConstants.CMSContentType_Forms == Convert.ToInt32(_ContentTypeSelected) || Ektron.Cms.Common.EkConstants.CMSContentType_Archive_Forms == Convert.ToInt32(_ContentTypeSelected))
        {
            _ContentType = int.Parse(_ContentTypeSelected);
        }
        else if (_ManagedAsset_Min <= Convert.ToInt32(_ContentTypeSelected) && Convert.ToInt32(_ContentTypeSelected) <= _ManagedAsset_Max)
        {
            if (DoesAssetSupertypeExist(_AssetInfoData, int.Parse(_ContentTypeSelected)))
            {
                _ContentType = int.Parse(_ContentTypeSelected);
            }
        }
        else if (Convert.ToInt32(_ContentTypeSelected) == _CMSContentType_AllTypes)
        {
            _ContentType = Ektron.Cms.Common.EkConstants.CMSContentType_NonLibraryForms;
        }
        else if (_IsArchivedEvent == true && (Convert.ToInt32(_ContentTypeSelected) == EkConstants.CMSContentType_Archive_ManagedFiles || Convert.ToInt32(_ContentTypeSelected) == EkConstants.CMSContentType_Archive_OfficeDoc || Convert.ToInt32(_ContentTypeSelected) == EkConstants.CMSContentType_Archive_MultiMedia || Convert.ToInt32(_ContentTypeSelected) == EkConstants.CMSContentType_Archive_Images))
        {
            _ContentType = int.Parse(_ContentTypeSelected);
        }

        _ContentTypeSelected = _ContentType.ToString();

        _PageData = new Microsoft.VisualBasic.Collection();
        _PageData.Add(_Id, "FolderID", null, null);
        if (_FolderData.FolderType == 1) //blog
        {
            _PageData.Add("BlogPost", "OrderBy", null, null);
        }
        else
        {
            _PageData.Add(_OrderBy, "OrderBy", null, null);
        }
        if (Request.QueryString["orderbydirection"] == "desc")
            direction = "desc";
        else
            direction = "asc";
        _OrderByDirection = direction;
        _PageData.Add(_OrderByDirection, "OrderByDirection", null, null);
        _PageData.Add(_ContentLanguage, "m_intContentLanguage", null, null);
        switch ((Ektron.Cms.Common.EkEnumeration.FolderType)_FolderData.FolderType)
        {
            case Ektron.Cms.Common.EkEnumeration.FolderType.Blog:
                _ContentType = Ektron.Cms.Common.EkConstants.CMSContentType_Content;
                _PageData.Add(_ContentType, "ContentType", null, null);
                break;
            case Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionForum:
                _ContentType = Ektron.Cms.Common.EkConstants.CMSContentType_Content;
                _PageData.Add(_ContentType, "ContentType", null, null);
                break;
            default:
                if (_ContentType > 0)
                {
                    _PageData.Add(_ContentType, "ContentType", null, null);
                }
                break;
        }

        if (_ContentType == 1 && _ContentSubTypeSelected != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.AllTypes)
        {
            _PageData.Add(_ContentSubTypeSelected, "ContentSubType", null, null);
        }

        if ((Ektron.Cms.Common.EkEnumeration.FolderType)(_FolderData.FolderType) == Ektron.Cms.Common.EkEnumeration.FolderType.Calendar)
        {
            calendardisplay.Visible = true;
            pnlThreadedDiscussions.Visible = false;
            if ((Request.QueryString["showAddEventForm"] != null) && Request.QueryString["showAddEventForm"] == "true")
            {
                if (ViewState["AddEventFormDisplay"] == null || System.Convert.ToBoolean(ViewState["AddEventFormDisplay"]) == false) //only show once
                {
                    ViewState.Add("AddEventFormDisplay", true);
                    DateTime startDT = DateTime.Now.Date.AddHours(8);
                    if (Request.QueryString["startDT"] != null)
                    {
                        startDT = DateTime.ParseExact(Request.QueryString["startDT"], "yyyyMMddHHmm", new System.Globalization.CultureInfo(1033));
                    }
                    calendardisplay.ShowInsertForm(startDT);
                }
            }
            if (Request.QueryString["editEvent"] != null)
            {
                if (ViewState["editEvent"] == null || System.Convert.ToBoolean(ViewState["editEvent"]) == false) //only show once
                {
                    ViewState.Add("editEvent", true);
                    calendardisplay.ShowEditForm(Request.QueryString["editEvent"]);
                }
            }

            ScriptManager.RegisterClientScriptBlock(Page, typeof(UserControl), "CalendarCleanup", "try{ window.EditorCleanup(); }catch(ex){}", true);
        }
        _PagingPageSize = _ContentApi.RequestInformationRef.PagingSize;
        if ((Ektron.Cms.Common.EkEnumeration.FolderType)(_FolderData.FolderType) == Ektron.Cms.Common.EkEnumeration.FolderType.Blog)
        {
            _BlogData = _ContentApi.BlogObject(_FolderData);
        }

        //if it's a calendar then we do it on prerender
        if ((Ektron.Cms.Common.EkEnumeration.FolderType)(_FolderData.FolderType) != Ektron.Cms.Common.EkEnumeration.FolderType.Calendar)
        {
            if (_PageAction == "viewarchivecontentbycategory")
            {
                _EkContentCol = _EkContent.GetAllViewArchiveContentInfov5_0(_PageData, _PagingCurrentPageNumber, _PagingPageSize, ref _PagingTotalPagesNumber);
                _NextActionType = "ViewContentByCategory";
            }
            else if (_PageAction == "viewcontentbycategory")
            {
                _EkContentCol = _EkContent.GetAllViewableChildContentInfoV5_0(_PageData, _PagingCurrentPageNumber, _PagingPageSize, ref _PagingTotalPagesNumber);
                _NextActionType = "ViewArchiveContentByCategory";
            }
            //paging goes here

            int i;
            for (i = 0; i <= _EkContentCol.Count - 1; i++)
            {
                if (_EkContentCol.get_Item(i).ContentStatus == "A")
                {
                    _TakeAction = true;
                    _CheckedInOrApproved = true;
                    break;
                }
                else
                {
                    if (_EkContentCol.get_Item(i).ContentStatus == "I")
                    {
                        _CheckedInOrApproved = true;
                    }
                }
            }
        }
        else
        {
            if (_PageAction == "viewarchivecontentbycategory")
            {
                _NextActionType = "ViewContentByCategory";
            }
            else if (_PageAction == "viewcontentbycategory")
            {
                _NextActionType = "ViewArchiveContentByCategory";
            }
        }

        switch ((Ektron.Cms.Common.EkEnumeration.FolderType)(_FolderData.FolderType))
        {
            case Ektron.Cms.Common.EkEnumeration.FolderType.Catalog:
                if (_PageAction == "viewarchivecontentbycategory")
                {
                    _NextActionType = "ViewContentByCategory";
                }
                else if (_PageAction == "viewcontentbycategory")
                {
                    _NextActionType = "ViewArchiveContentByCategory";
                }

                Page.ClientScript.RegisterClientScriptBlock(typeof(string), "objselnotice", "<script type=\"text/javascript\">var objSelSupertype = null;</script>");

                CatalogEntry CatalogManager = new CatalogEntry(_ContentApi.RequestInformationRef);
                System.Collections.Generic.List<EntryData> entryList = new System.Collections.Generic.List<EntryData>();
                Ektron.Cms.Common.Criteria<EntryProperty> entryCriteria = new Ektron.Cms.Common.Criteria<EntryProperty>();

                entryCriteria.AddFilter(EntryProperty.CatalogId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, _Id);
                entryCriteria.PagingInfo.CurrentPage = Convert.ToInt32(_PagingCurrentPageNumber.ToString());
                entryCriteria.PagingInfo.RecordsPerPage = _ContentApi.RequestInformationRef.PagingSize;

                if (_ContentApi.RequestInformationRef.ContentLanguage > 0)
                {
                    entryCriteria.AddFilter(EntryProperty.LanguageId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, _ContentApi.RequestInformationRef.ContentLanguage);
                }

                switch (this._ContentTypeQuerystringParam)
                {
                    case "0":
                        long[] IdList = new long[3];
                        IdList[0] = Convert.ToInt64(Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Product);
                        IdList[1] = Convert.ToInt64(Ektron.Cms.Common.EkEnumeration.CatalogEntryType.ComplexProduct);
                        entryCriteria.AddFilter(EntryProperty.EntryType, Ektron.Cms.Common.CriteriaFilterOperator.In, IdList);
                        break;
                    case "2":
                        entryCriteria.AddFilter(EntryProperty.EntryType, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Kit);
                        break;
                    case "3":
                        entryCriteria.AddFilter(EntryProperty.EntryType, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Bundle);
                        break;
                    case "4":
                        entryCriteria.AddFilter(EntryProperty.EntryType, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, Ektron.Cms.Common.EkEnumeration.CatalogEntryType.SubscriptionProduct);
                        break;
                }

                if (_PageAction == "viewarchivecontentbycategory")
                {
                    entryCriteria.AddFilter(EntryProperty.IsArchived, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, true);
                }
                else
                {
                    entryCriteria.AddFilter(EntryProperty.IsArchived, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, false);
                }
                if (Request.QueryString["orderbydirection"] == "desc")
                    direction = "desc";
                else
                    direction = "asc";
                if(direction == "desc")
                    entryCriteria.OrderByDirection = (EkEnumeration.OrderByDirection)OrderByDirection.Descending;
                else
                entryCriteria.OrderByDirection = (EkEnumeration.OrderByDirection)OrderByDirection.Ascending;

                switch (_OrderBy.ToLower())
                {
                    case "language":
                        entryCriteria.OrderByField = EntryProperty.LanguageId;
                        break;
                    case "id":
                        entryCriteria.OrderByField = EntryProperty.Id;
                        break;
                    case "status":
                        entryCriteria.OrderByField = EntryProperty.ContentStatus;
                        break;
                    case "entrytype":
                        entryCriteria.OrderByField = EntryProperty.EntryType;
                        break;
                    case "sale":
                        entryCriteria.OrderByField = EntryProperty.SalePrice;
                        break;
                    case "list":
                        entryCriteria.OrderByField = EntryProperty.ListPrice;
                        break;
                    default: //"title"
                        entryCriteria.OrderByField = EntryProperty.Title;
                        break;
                }

                entryList = CatalogManager.GetList(entryCriteria);

                for (int j = 0; j <= entryList.Count - 1; j++)
                {
                    if (entryList[j].Status == "A")
                    {
                        _TakeAction = true;
                        _CheckedInOrApproved = true;
                        break;
                    }
                    else
                    {
                        if (entryList[j].Status == "I")
                        {
                            _CheckedInOrApproved = true;
                        }
                    }
                }

                _PagingTotalPagesNumber = System.Convert.ToInt32(entryCriteria.PagingInfo.TotalPages);

                //paging goes here

                ViewCatalogToolBar(entryList.Count);
                Populate_ViewCatalogGrid(_EkContentCol, entryList);
                _ContentType = int.Parse(_ContentTypeSelected);
                break;
            case Ektron.Cms.Common.EkEnumeration.FolderType.Blog:
                _IsMyBlog = System.Convert.ToBoolean((_BlogData.Id == _ContentApi.GetUserBlog(_ContentApi.UserId)) ? true : false);
                Page.ClientScript.RegisterClientScriptBlock(typeof(string), "objselnotice", "<script type=\"text/javascript\">var objSelSupertype = null;</script>");
                if (!string.IsNullOrEmpty(Request.QueryString["ContType"]) && (Request.QueryString["ContType"] == Ektron.Cms.Common.EkConstants.CMSContentType_BlogComments.ToString()))
                {
                    _ContentType = System.Convert.ToInt32(Request.QueryString["ContType"]);
                    _Task = _ContentApi.EkTaskRef;
                    if (!string.IsNullOrEmpty(Request.QueryString["contentid"]))
                    {
                        _PostID = Convert.ToInt64(Request.QueryString["contentid"]);
                        _ContentData = _ContentApi.GetContentById(_PostID, 0);

                        Ektron.Cms.PageRequestData null_EktronCmsPageRequestData = null;
                        _Comments = _Task.GetTasks(_PostID, -1, -1, Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.CMSTaskItemType.BlogCommentItem), "postcomment", 0, ref null_EktronCmsPageRequestData, "");
                    }
                    else
                    {

                        Ektron.Cms.PageRequestData null_EktronCmsPageRequestData2 = null;
                        _Comments = _Task.GetTasks(-1, -1, -1, Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.CMSTaskItemType.BlogCommentItem), "", 0, ref null_EktronCmsPageRequestData2, "");
                    }
                    ViewBlogContentByCategoryToolBar();
                    Populate_ViewBlogCommentsByCategoryGrid(_Comments);
                }
                else
                {
                    Hashtable BlogPostCommentTally = new Hashtable();
                    BlogPostCommentTally = _EkContent.TallyCommentsForBlogPosts(_Id);
                    ViewBlogContentByCategoryToolBar();
                    Populate_ViewBlogPostsByCategoryGrid(_EkContentCol, BlogPostCommentTally);
                }
                break;
            case Ektron.Cms.Common.EkEnumeration.FolderType.Media:
                Page.ClientScript.RegisterClientScriptBlock(typeof(string), "objselnotice", "<script type=\"text/javascript\">var objSelSupertype = null;</script>");
                ViewContentByCategoryToolBar();
                Populate_ViewMediaGrid(_EkContentCol);
                break;
            case Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionBoard:
                Page.ClientScript.RegisterClientScriptBlock(typeof(string), "objselnotice", "<script type=\"text/javascript\">var objSelSupertype = null;</script>");
                ViewDiscussionBoardToolBar();
                Populate_ViewDiscussionBoardGrid();
                break;
            case Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionForum:
                Page.ClientScript.RegisterClientScriptBlock(typeof(string), "objselnotice", "<script type=\"text/javascript\">var objSelSupertype = null;</script>");
                bool bCanModerate = false;
                int itotalpages = 1;
                int icurrentpage = 1;
                if (!string.IsNullOrEmpty(Request.QueryString["ContType"]) && (Request.QueryString["ContType"] == Ektron.Cms.Common.EkConstants.CMSContentType_BlogComments.ToString()))
                {
                    _ContentType = System.Convert.ToInt32(Request.QueryString["ContType"]);
                    if (this._ContentApi.UserId > 0 && ((!(_PermissionData == null) && _PermissionData.CanAddToImageLib == true) || _PermissionData.IsAdmin))
                    {
                        bCanModerate = true;
                    }
                    _DiscussionBoard = _ContentApi.GetTopic(_ContentId, true);
                    if (_DiscussionBoard == null)
                    {
                        throw new Exception("You may not have permission to view this object or it has been deleted.");
                    }
                    _BoardID = _DiscussionBoard.Id;
                    _ContentData = (ContentData)(_DiscussionBoard.Forums[0].Topics[0]);
                    _PermissionData = _ContentApi.LoadPermissions(_ContentId, "content", ContentAPI.PermissionResultType.All);
                    ViewRepliesToolBar();
                    _Task = _ContentApi.EkTaskRef;
                    if (!string.IsNullOrEmpty(Request.QueryString["contentid"]))
                    {
                        _PostID = Convert.ToInt64(Request.QueryString["contentid"]);
                        _Comments = _Task.GetTopicReplies(_PostID, _DiscussionBoard.Id, ref icurrentpage, 0, 0, ref itotalpages, bCanModerate);
                    }
                    else
                    {

                        Ektron.Cms.PageRequestData null_EktronCmsPageRequestData3 = null;
                        _Comments = _Task.GetTasks(-1, -1, -1, Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.CMSTaskItemType.TopicReplyItem), "", 0, ref null_EktronCmsPageRequestData3, "");
                    }
                    Populate_ViewTopicRepliesGrid(_Comments);
                }
                else
                {
                    ArrayList ForumPostCommentTally = new ArrayList();
                    DiscussionBoard thisboard;
                    bool bModerator = false;
                    if (_PermissionData.IsAdmin == true || _PermissionData.CanAddToImageLib == true)
                    {
                        bModerator = true;
                    }
                    thisboard = _EkContent.GetForumbyID(_Id.ToString(), bModerator, _PagingCurrentPageNumber, ref this._PagingTotalPagesNumber, "", this._ContentApi.RequestInformationRef.PagingSize);

                    //paging here

                    ForumPostCommentTally = _EkContent.GetRepliesForTopics(_Id);
                    ViewDiscussionForumToolBar();
                    Populate_ViewForumPostsByCategoryGrid(thisboard.Forums[0].Topics, ForumPostCommentTally);
                }
                break;
            case Ektron.Cms.Common.EkEnumeration.FolderType.Calendar:
                ViewCalendarToolBar();
                break;
            default:
                ViewContentByCategoryToolBar();
                Populate_ViewContentByCategoryGrid(_EkContentCol);
                break;
        }

        Util_SetJs();
        return true;
    }
 public DiscussionBoard Put(DiscussionBoard item)
 {
     throw new NotImplementedException();
 }
Example #16
0
        //[Authorize(Roles = "Admin, Moderator, Contributor")]
        public IHttpActionResult GetDiscussionBoard(int id)
        {
            DiscussionBoard discussion = repository.GetByID(id);

            return(Ok(discussion));
        }
        public DiscussionBoard GetByID(int id)
        {
            DiscussionBoard discussion = db.DiscussionBoards.Find(id);

            return(discussion);
        }