/// <summary>
 /// Handles Code for getting all the community groups from CMS Database.
 /// </summary>
 private void GetCommunityGroups()
 {
     if (Page.IsPostBack)
     {
         CommunityGroupRequest cReq = new CommunityGroupRequest();
         cReq.CurrentPage = this.m_intCurrentPage;
         cReq.SearchText = this.m_strKeyWords;
         cReq.PageSize = m_refContentApi.RequestInformationRef.PagingSize;
         cgroup_list = (new Ektron.Cms.Community.CommunityGroupAPI()).GetAllCommunityGroups(cReq);
         this.m_intTotalPages = cReq.TotalPages;
     }
 }
Beispiel #2
0
    protected void ViewAllGroups()
    {
        BuildJS();
        if (Page.IsPostBack)
        {
            sSearch = Request.Form["txtSearch"];
        }
        //if (Request.QueryString["page"] != "")
        //{
        //    m_intCurrentPage = Convert.ToInt32(Request.QueryString["page"]);
        //}
        CommunityGroupData[] aCGroups = (CommunityGroupData[])Array.CreateInstance(typeof(CommunityGroupData), 0);

        panel1.Visible = true;
        SetTitleBarToMessage("lbl view all cgroups");
        if (this.m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.CommunityGroupCreate) ||
            this.m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.CommunityGroupAdmin))
        {
            bAddAccess = true;
        }
        if (bAddAccess)
        {
            base.AddButtonwithMessages(AppImgPath + "../UI/Icons/add.png", (string)("../communitygroupaddedit.aspx?action=addeditgroup&LangType=" + this.ContentLanguage), "alt add community group", "lbl add community group", "", StyleHelper.AddButtonCssClass, true);
        }
        AddSearchBox(sSearch, new ListItemCollection(), "ExecSearch");
        AddHelpButton("viewallcommunitygroups");

        CommunityGroupRequest cReq = new CommunityGroupRequest();
        cReq.CurrentPage = m_intCurrentPage;
        cReq.SearchText = sSearch;
        cReq.PageSize = this.m_refContentApi.RequestInformationRef.PagingSize;
        aCGroups = this.m_refCommunityGroupApi.GetAllCommunityGroups(cReq);

        // CommunityGroupList.Columns.Add(m_refStyle.CreateBoundField("CHECK", "<input type=""Checkbox"" name=""checkall"" onclick=""javascript:checkAll('selected_communitygroup',false);"">", "title-header", HorizontalAlign.Center, HorizontalAlign.Center, Unit.Percentage(2), Unit.Percentage(2), False, False))
        CommunityGroupList.Columns.Add(m_refStyle.CreateBoundField("TITLE", GetMessage("lbl community group name"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(30), Unit.Percentage(30), false, false));
        CommunityGroupList.Columns.Add(m_refStyle.CreateBoundField("MEMBERS", GetMessage("lbl members"), "title-header", HorizontalAlign.Right, HorizontalAlign.Right, Unit.Percentage(5), Unit.Percentage(5), false, false));
        //CommunityGroupList.Columns.Add(m_refStyle.CreateBoundField("LANGUAGE", GetMessage("generic language"), "title-header", HorizontalAlign.Center, HorizontalAlign.Center, Unit.Percentage(5), Unit.Percentage(5), False, False))
        CommunityGroupList.Columns.Add(m_refStyle.CreateBoundField("ID", GetMessage("generic ID"), "title-header", HorizontalAlign.Center, HorizontalAlign.Center, Unit.Percentage(5), Unit.Percentage(5), false, false));
        CommunityGroupList.Columns.Add(m_refStyle.CreateBoundField("ENROLL", GetMessage("lbl enrollment"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(5), Unit.Percentage(5), false, false));
        CommunityGroupList.Columns.Add(m_refStyle.CreateBoundField("DESCRIPTION", GetMessage("lbl discussionforumtitle"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(30), Unit.Percentage(30), false, false));
        CommunityGroupList.Columns.Add(m_refStyle.CreateBoundField("LOCATION", GetMessage("generic location"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(30), Unit.Percentage(30), false, false));

        DataTable dt = new DataTable();
        DataRow dr;
        // dt.Columns.Add(New DataColumn("CHECK", GetType(String)))
        dt.Columns.Add(new DataColumn("TITLE", typeof(string)));
        dt.Columns.Add(new DataColumn("MEMBERS", typeof(string)));
        dt.Columns.Add(new DataColumn("ID", typeof(string)));
        //dt.Columns.Add(New DataColumn("LANGUAGE", GetType(String)))
        dt.Columns.Add(new DataColumn("ENROLL", typeof(string)));
        dt.Columns.Add(new DataColumn("DESCRIPTION", typeof(string)));
        dt.Columns.Add(new DataColumn("LOCATION", typeof(string)));
        m_intTotalPages = cReq.TotalPages;
        PageSettings();
        if ((aCGroups != null) && aCGroups.Length > 0)
        {
            // AddDeleteIcon = True
            for (int i = 0; i <= aCGroups.Length - 1; i++)
            {
                if (m_refContentApi.RequestInformationRef.IsMembershipUser == 1)
                {
                    if (!IsUserGroupAdmin(aCGroups[0].Admins))
                    {
                        continue;
                    }
                }
                dr = dt.NewRow();
                // dr("CHECK") = "<input type=""checkbox"" name=""selected_communitygroup"" id=""selected_communitygroup"" value=""" & aCGroups(i).GroupId & """ onClick=""javascript:checkAll('selected_communitygroup',true);"">"
                //dr("TITLE") = "<a href=""groups.aspx?action=viewgroup&id=" & aCGroups(i).GroupId & "&LangType=" & aCGroups(i).GroupLanguage & """>" & aCGroups(i).GroupName & "</a>"
                dr["TITLE"] = "<a href=\"groups.aspx?action=viewgroup&id=" + aCGroups[i].GroupId + "\">" + aCGroups[i].GroupName + "</a>";
                dr["MEMBERS"] = aCGroups[i].TotalMember;
                dr["ID"] = aCGroups[i].GroupId;
                //dr("LANGUAGE") = "<img src='" & objLocalizationApi.GetFlagUrlByLanguageID(aCGroups(i).GroupLanguage) & "' border=""0"" />"
                //dr("LANGUAGE") = "<img src='" & objLocalizationApi.GetFlagUrlByLanguageID(aCGroups(i).GroupLanguage) & "' border=""0"" />"
                dr["ENROLL"] = (aCGroups[i].GroupEnroll) ? "Open" : "Closed";
                dr["DESCRIPTION"] = aCGroups[i].GroupShortDescription;
                dr["LOCATION"] = aCGroups[i].GroupLocation;
                dt.Rows.Add(dr);
            }
        }
        else
        {
            dr = dt.NewRow();
            dt.Rows.Add(dr);
            CommunityGroupList.GridLines = GridLines.None;
        }
        DataView dv = new DataView(dt);
        CommunityGroupList.DataSource = dv;
        CommunityGroupList.DataBind();
    }