Beispiel #1
0
    public void Display_Add()
    {
        m_cGroup = this.m_refCommunityGroupApi.GetCommunityGroupByID(this.m_iID);

        Packages.EktronCoreJS.Register(this);
        JavaScript.Create(this.m_refContentApi.ApplicationPath + "java/plugins/inputLabel/ektron.inputLabel.js").Register(this);

        ltr_search.Text = "<br/>&#160;" + GetMessage("lbl select users") + ":<br/>";
        ltr_search.Text += "&#160;" + "<input type=text size=25 id=\"txtSearch\" name=\"txtSearch\" value=\"" + m_strKeyWords + "\" onkeydown=\"CheckForReturn(event)\">";
        ltr_search.Text += "&#160;";
        ltr_search.Text += "<select id=\"searchlist\" name=\"searchlist\">";
        ltr_search.Text += "<option value=\"-1\" " + IsSelected("-1") + ">" + GetMessage("display name label") + "</option>";
        ltr_search.Text += "<option value=\"last_name\"" + IsSelected("last_name") + ">" + GetMessage("lbl last name") + "</option>";
        ltr_search.Text += "<option value=\"first_name\"" + IsSelected("first_name") + ">" + GetMessage("lbl first name") + "</option>";
        ltr_search.Text += "<option value=\"user_name\"" + IsSelected("user_name") + ">" + GetMessage("generic username") + "</option>";
        // ltr_search.Text &= "<option value=""all"" " & IsSelected("all") & ">" & GetMessage("generic all") & "</option>"
        ltr_search.Text += "</select>";
        ltr_search.Text += "&#160;";
        ltr_search.Text += "<input type=button value=\"Search\" id=\"btnSearch\" name=\"btnSearch\" onclick=\"searchuser();\" title=\"Search Users\">";

        if (Page.IsPostBack)
        {
            SiteAPI m_refSiteApi = new SiteAPI();
            setting_data = m_refSiteApi.GetSiteVariables(m_refSiteApi.UserId);

            CommunityGroupObjectRequest request = new CommunityGroupObjectRequest();
            request.CurrentPage = m_intCurrentPage;
            request.PageSize = System.Convert.ToInt32(m_PageSize > 0 ? m_PageSize : 0);
            request.GroupId = this.m_iID;
            request.SearchText = m_strKeyWords;
            switch (m_strSelectedItem)
            {
                case "last_name":
                    request.SearchField = "last_name";
                    break;
                case "first_name":
                    request.SearchField = "first_name";
                    break;
                case "user_name":
                    request.SearchField = "user_name";
                    break;
                default: // "-1"
                    request.SearchField = "display_name";
                    break;
            }
            request.ObjectId = this.m_refContentApi.UserId;
            request.ObjectType = Ektron.Cms.Common.EkEnumeration.TaxonomyItemType.User;
            request.ObjectStatus = Ektron.Cms.Common.EkEnumeration.DirectoryItemStatus.All;
            m_aUsers = this.m_refCommunityGroupApi.GetAllUnassignedCommunityGroupUsers(ref request);
            if ((m_aUsers != null) && m_aUsers.Length > 0)
            {
                m_bAllowAdd = true;
            }
            m_intTotalPages = request.TotalPages;
            Populate_ViewCommunityMembersGrid(m_aUsers);
        }
        else
        {
            PageSettings(); // to suppress the paging stuff
        }
    }
Beispiel #2
0
    public void Display_View()
    {
        SiteAPI m_refSiteApi = new SiteAPI();
        int totalUsers = 0;
        setting_data = m_refSiteApi.GetSiteVariables(m_refSiteApi.UserId);

        m_cGroup = this.m_refCommunityGroupApi.GetCommunityGroupByID(this.m_iID);
        int totalPending = 0;
        if (Page.IsPostBack && Request.Form["isSearchPostData"] != "")
        {
            m_aUsers = this.m_refCommunityGroupApi.GetCommunityGroupUsers(this.m_iID, this.m_strKeyWords, "display_name", m_intCurrentPage, System.Convert.ToInt32(m_PageSize > 0 ? m_PageSize : 0), ref m_intTotalPages, ref totalUsers, ref totalPending);
        }
        else
        {
            m_aUsers = this.m_refCommunityGroupApi.GetCommunityGroupUsers(this.m_iID, m_intCurrentPage, System.Convert.ToInt32(m_PageSize > 0 ? m_PageSize : 0), ref m_intTotalPages, ref totalUsers, ref totalPending);
        }
        Populate_ViewCommunityMembersGrid(m_aUsers);
    }
Beispiel #3
0
    public void SetLabels()
    {
        m_cGroup = this.m_refCommunityGroupApi.GetCommunityGroupByID(this.m_iID);
        string url = string.Empty;
        switch (this.m_sPageAction)
        {
            case "adduser":
                this.AddBackButton((string)("groupmembers.aspx?&id=" + this.m_iID + "&LangType=" + this.ContentLanguage));
                if (m_bAllowAdd && (m_refContentApi.IsAdmin() || IsUserGroupAdmin(m_cGroup.Admins) || m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.CommunityGroupAdmin)))
                {
                    this.AddButtonwithMessages(m_refContentApi.AppPath + "images/ui/icons/add.png", "#", "alt add sel users to cgroup", "btn add sel users to cgroup", " onclick=\"return CheckAdd();\" ", StyleHelper.AddButtonCssClass, true);
                }
                this.AddHelpButton("addcommunitygroupmembers");
                this.SetTitleBarToString(string.Format(GetMessage("btn add cgroup members for"), EkFunctions.HtmlEncode(this.m_cGroup.GroupName)));
                break;

            case "pending":
                url = (string)("groupmembers.aspx?id=" + this.m_iID);
                anchorCurrent.Attributes.Add("onclick", "window.location.href =\'" + url + "\'");
                anchorPending.Attributes.Add("onclick", "");
                this.AddBackButton((string)("groupmembers.aspx?id=" + this.m_iID + "&LangType=" + this.ContentLanguage));
                if (m_refContentApi.IsAdmin() || IsUserGroupAdmin(m_cGroup.Admins) || m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.CommunityGroupAdmin))
                {
                    this.AddButtonwithMessages(m_refContentApi.AppPath + "images/UI/Icons/approvals.png", "#", "alt approve pending users for cgroup", "btn approve pending users for cgroup", " onclick=\"return CheckPendingApprove();\" ", StyleHelper.ApproveButtonCssClass, true);
                    this.AddButtonwithMessages(m_refContentApi.AppPath + "images/UI/Icons/remove.png", "#", "alt remove pending users from cgroup", "btn remove pending users from cgroup", " onclick=\"return CheckPendingDelete();\" ", StyleHelper.RemoveButtonCssClass);
                }
                this.AddHelpButton("viewpendingcommunitygroupmembers");
                this.SetTitleBarToString(string.Format(GetMessage("btn view pending cgroup members for"), EkFunctions.HtmlEncode(this.m_cGroup.GroupName)));
                break;

            default: // "viewall"
                url = (string)("groupmembers.aspx?action=pending&id=" + this.m_iID);
                anchorPending.Attributes.Add("onclick", "window.location.href =\'" + url + "\'");
                anchorCurrent.Attributes.Add("onclick", "");
                this.AddBackButton((string)("groups.aspx?action=viewgroup&id=" + this.m_iID + "&LangType=" + this.ContentLanguage));
                if (m_refContentApi.IsAdmin() || IsUserGroupAdmin(m_cGroup.Admins) || m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.CommunityGroupAdmin))
                {
                    this.AddButtonwithMessages(m_refContentApi.AppPath + "images/UI/Icons/add.png", (string)("groupmembers.aspx?action=adduser&LangType=" + this.ContentLanguage + "&id=" + this.m_iID), "alt add users to cgroup", "btn add users to cgroup", "", StyleHelper.AddButtonCssClass, true);
                    this.AddButtonwithMessages(m_refContentApi.AppPath + "images/UI/Icons/remove.png", "#", "alt remove users from cgroup", "btn remove users from cgroup", " onclick=\"return CheckDelete();\" ", StyleHelper.RemoveButtonCssClass);
                }

                this.AddSearchBox(this.m_strKeyWords, new ListItemCollection(), "ExecSearch");
                this.AddHelpButton("viewcommunitygroupmembers");
                this.SetTitleBarToString(string.Format(GetMessage("btn view cgroup members for"), EkFunctions.HtmlEncode(this.m_cGroup.GroupName)));
                break;
        }
    }
Beispiel #4
0
    protected void ViewGroup()
    {
        DirectoryData[] m_aCategories = (DirectoryData[])Array.CreateInstance(typeof(Ektron.Cms.DirectoryData), 0);
        Ektron.Cms.Community.CommunityGroup communityGroup;
        communityGroup = new Ektron.Cms.Community.CommunityGroup(m_refContentApi.RequestInformationRef);
        List<Ektron.Cms.UserData> groupAdmins = new List<UserData>();

        cgGroup = this.m_refCommunityGroupApi.GetCommunityGroupByID(this.m_iID);
        groupAdmins = communityGroup.GetAllCommunityGroupAdmins(this.m_iID);

        if (m_refContentApi.RequestInformationRef.IsMembershipUser == 1 && !IsUserGroupAdmin(groupAdmins))
        {
            return;
        }
        panel3.Visible = true;
        SetLabels();
        m_aCategories = this.m_refContentApi.EkContentRef.GetAllAssignedDirectory(this.m_iID, Ektron.Cms.Common.EkEnumeration.TaxonomyItemType.Group);
        lbl_id.Text = cgGroup.GroupId.ToString();
        lbl_id.ToolTip = lbl_id.Text;
        SetTitleBarToMessage("lbl view cgroup");
        PopulateData(cgGroup,groupAdmins, m_aCategories);
        TD_personalTags.InnerHtml = GetGroupTags();
        bAccess = System.Convert.ToBoolean(this.m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.CommunityGroupAdmin) || IsUserGroupAdmin(groupAdmins));
        // buttons
        base.AddBackButton("groups.aspx");
        if (this.bAccess == true)
        {
            base.AddButtonwithMessages(m_refContentApi.AppPath + "images/UI/Icons/contentEdit.png", (string)("../communitygroupaddedit.aspx?action=addeditgroup&LangType=" + this.ContentLanguage + "&id=" + cgGroup.GroupId.ToString()), "alt edit community group", "lbl edit community group", "", StyleHelper.EditButtonCssClass, true);
            // MyBase.AddButtonwithMessages(AppImgPath & "menu/folders.gif", "workspace.aspx?groupid=" & Me.m_iID & "&LangType=" & ContentLanguage, "alt view group directory", "btn view group directory", "")
            base.AddButtonwithMessages(m_refContentApi.AppPath + "images/ui/icons/usersMemberGroups.png", (string)("groupmembers.aspx?action=viewallusers&LangType=" + ContentLanguage + "&id=" + this.m_iID), "alt view cgroup members", "btn view cgroup members", "", StyleHelper.ViewGroupMembersButtonCssClass);
            base.AddButtonwithMessages(m_refContentApi.AppPath + "images/UI/Icons/delete.png", (string)("groups.aspx?action=delete&id=" + cgGroup.GroupId.ToString()), "alt del community group", "lbl del community group", " onclick=\"javascript:return confirm(\'" + GetMessage("js confirm del community group") + "\');\" ", StyleHelper.DeleteButtonCssClass);
        }
        SetAlias(this.m_iID);
        AddHelpButton("viewcommunitygroup");
    }
Beispiel #5
0
    public void Display_PendingView()
    {
        SiteAPI m_refSiteApi = new SiteAPI();
        int totalUsers = 0;
        setting_data = m_refSiteApi.GetSiteVariables(m_refSiteApi.UserId);

        m_cGroup = this.m_refCommunityGroupApi.GetCommunityGroupByID(this.m_iID);
        if (Page.IsPostBack)
        {
            m_aUsers = this.m_refCommunityGroupApi.GetPendingCommunityGroupUsers(this.m_iID, m_intCurrentPage, System.Convert.ToInt32(m_PageSize > 0 ? m_PageSize : 0), ref m_intTotalPages, ref totalUsers);
        }
        else
        {
            m_aUsers = this.m_refCommunityGroupApi.GetPendingCommunityGroupUsers(this.m_iID, m_intCurrentPage, System.Convert.ToInt32(m_PageSize > 0 ? m_PageSize : 0), ref m_intTotalPages, ref totalUsers);
        }
        Populate_ViewCommunityMembersGrid(m_aUsers);
    }
Beispiel #6
0
    protected void Process_DeleteGroup()
    {
        cgGroup = this.m_refCommunityGroupApi.GetCommunityGroupByID(this.m_iID);
        bAccess = System.Convert.ToBoolean(this.m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.CommunityGroupAdmin) || IsUserGroupAdmin(cgGroup.Admins));
        if (bAccess)
        {
            this.m_refCommunityGroupApi.DeleteCommunityGroupByID(this.m_iID);

            Response.Redirect("groups.aspx", false);
        }
        else
        {
            throw (new Exception(GetMessage("err no perm del cgroup")));
        }
    }
Beispiel #7
0
    protected void Process_EditGroup()
    {
        if (m_iID > 0)
        {
            cgGroup = this.m_refCommunityGroupApi.GetCommunityGroupByID(this.m_iID);
        }
        else
        {
            cgGroup = new CommunityGroupData();
        }
        if (this.m_iID > 0)
        {
            bAccess = System.Convert.ToBoolean(this.m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.CommunityGroupAdmin) || IsUserGroupAdmin(cgGroup.Admins));
        }
        else
        {
            bAccess = System.Convert.ToBoolean(this.m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.CommunityGroupCreate));
        }
        if (bAccess)
        {
            cgGroup.GroupName = (string)this.GroupName_TB.Text;
            cgGroup.GroupShortDescription = (string)this.ShortDescription_TB.Text;
            cgGroup.GroupLongDescription = (string)this.Description_TB.Text;
            if (this.PublicJoinHidden_RB.Checked)
            {
                cgGroup.GroupHidden = true;
                cgGroup.GroupEnroll = false;
            }
            else
            {
                cgGroup.GroupEnroll = System.Convert.ToBoolean(this.PublicJoinYes_RB.Checked);
            }
            cgGroup.GroupLocation = (string)this.Location_TB.Text;
            cgGroup.GroupEnableDistributeToSite = System.Convert.ToBoolean(this.EnableDistributeToSite_CB.Checked);
            cgGroup.AllowMembersToManageFolders = System.Convert.ToBoolean(this.AllowMembersToManageFolders_CB.Checked);

            if (m_iID > 0)
            {
                m_refCommunityGroupApi.UpdateCommunityGroup(cgGroup);
                Response.Redirect("groups.aspx", false);
            }
            else
            {
                m_iID = m_refCommunityGroupApi.AddCommunityGroup(cgGroup);
                if (m_iID > 0)
                {
                    Response.Redirect("groups.aspx", false);
                }
                else
                {
                    EditGroup();
                    errmsg.InnerHtml = "Error occured while adding this group.  verify the group name is unique and try again, for more details check eventviewer.";
                    errmsg.Attributes.Add("class", "exception");
                    GroupName_TB.Attributes.Add("onkeypress", "ClearErr();");
                    GroupName_TB.Focus();
                }
            }
        }
        else
        {
            throw (new Exception(GetMessage("err no perm add cgroup")));
        }
    }
Beispiel #8
0
 protected void EditGroup()
 {
     BuildJS();
     SetLabels();
     panel3.Visible = true;
     if (this.m_iID > 0)
     {
         cgGroup = this.m_refCommunityGroupApi.GetCommunityGroupByID(this.m_iID);
         lbl_id.Text = cgGroup.GroupId.ToString();
         lbl_id.ToolTip = lbl_id.Text;
         SetTitleBarToMessage("lbl edit cgroup");
         AddBackButton("groups.aspx?action=viewgroup&id=" + cgGroup.GroupId.ToString() + "");
         // PopulateData(cgGroup)
         base.AddButtonwithMessages(m_refContentApi.AppImgPath + "../UI/Icons/save.png", "#", "lbl alt save", "btn save", " onclick=\"javascript: SubmitForm(); return false;\" ", StyleHelper.SaveButtonCssClass, true);
         // AddBackButton("groups.aspx?action=viewgroup&id=" & cgGroup.GroupId.ToString() & "&LangType=" & cgGroup.GroupLanguage & "")
         AddHelpButton("editcommunitygroup");
         SetAlias(this.m_iID);
     }
     else
     {
         this.PublicJoinYes_RB.Checked = true;
         tr_ID.Visible = false;
         this.cmd_browse.Visible = false;
         SetTitleBarToMessage("lbl add cgroup");
         AddBackButton("groups.aspx");
         base.AddButtonwithMessages(m_refContentApi.AppImgPath + "../UI/Icons/save.png", "#", "lbl alt save", "btn save", " onclick=\"javascript: SubmitForm(); return false;\" ", StyleHelper.SaveButtonCssClass, true);
         AddHelpButton("addcommunitygroup");
     }
 }
Beispiel #9
0
    protected void PopulateData(CommunityGroupData cGrp, List<UserData> groupAdmins, DirectoryData[] aCategories)
    {
        int groupAdminCount = 0;
        this.GroupName_TB.Text = cGrp.GroupName;
        this.ShortDescription_TB.Text = cGrp.GroupShortDescription;
        this.Description_TB.Text = cGrp.GroupLongDescription;
        if (cGrp.GroupHidden)
        {
            this.PublicJoinHidden_RB.Checked = true;
        }
        else
        {
            this.PublicJoinYes_RB.Checked = cGrp.GroupEnroll;
            this.PublicJoinNo_RB.Checked = !(cGrp.GroupEnroll);
        }
        this.Location_TB.Text = cGrp.GroupLocation;
        if (groupAdmins.Count == 0)
        {
            ltr_admin_name.Text = cGrp.GroupAdmin.DisplayName.ToString();
        }
        else
        {
            int order = 0;
            for (groupAdminCount = 0; groupAdminCount < groupAdmins.Count; groupAdminCount++)
            {
                if (order != 0)
                    this.ltr_admin_name.Text += ", ";
                if (groupAdmins[groupAdminCount].DisplayName != "")
                    this.ltr_admin_name.Text += groupAdmins[groupAdminCount].DisplayName;
                else
                    this.ltr_admin_name.Text += groupAdmins[groupAdminCount].FirstName;
                order += 1;
            }
        }

        //this.ltr_admin_name.Text=        this.ltr_admin_name.Text.ToString().Remove(this.ltr_admin_name.Text.ToString().LastIndexOf(","), 1);
        this.GroupAvatar_TB.Text = cGrp.GroupImage;
        this.cmd_browse.Attributes.Add("onclick", "javascript:return false;");
        this.cmd_browse.Visible = false;
        this.EnableDistributeToSite_CB.Checked = cGrp.GroupEnableDistributeToSite;
        this.AllowMembersToManageFolders_CB.Checked = cGrp.AllowMembersToManageFolders;

        this.chkEnableDocumentNotifications.Checked = cGrp.EnableDocumentsInNotifications;
        this.chkEnableEmail.Checked = cGrp.EnableGroupEmail;
        this.lblEmailAccountValue.Text = cGrp.EmailAccountName;
        this.lblEmailAddressValue.Text = cGrp.EmailAddress;
        MailServerData mailServer = GetNotificationEmailServer();
        this.lblEmailServerPortValue.Text = mailServer.POPPort.ToString();
        this.lblEmailServerValue.Text = mailServer.POPServer;
        this.chkUseSsl.Checked = mailServer.POPSSL;
        ucEktronGroupEmailSetting.Visible = cGrp.EnableGroupEmail;

        this.ltr_avatarpath.Text = "";
        List<string> cat_list = new List<string>();
        string TaxonomyList = string.Empty;
        if ((aCategories != null) && aCategories.Length > 0)
        {
            for (int i = 0; i <= (aCategories.Length - 1); i++)
            {
                cat_list.Add(("<li>" + aCategories[i].DirectoryPath.Remove(0, 1).Replace("\\", " > ") + "</li>"));
            }
            TaxonomyList = string.Join(string.Empty, cat_list.ToArray());
        }
        else
        {
            TaxonomyList = GetMessage("lbl cgroup no cat");
        }
        ltr_cat.Text += TaxonomyList;
        calendardata = _CalendarApi.GetPublicCalendar(Ektron.Cms.Common.EkEnumeration.WorkSpace.Group, cGrp.GroupId);
        if (calendardata != null)
        {
            this.FeaturesCalendar_CB.Checked = true;
        }
        _doesForumExists = m_refCommunityGroupApi.DoesCommunityGroupForumExists(Ektron.Cms.Common.EkEnumeration.WorkSpace.Group, cGrp.GroupId);
        if (_doesForumExists != 0)
        {
            this.FeaturesForum_CB.Checked = true;
        }

        var todoList = GetGroupTodoList();
        if (todoList != null)
        {
            FeaturesTodo_CB.Enabled = false;
            FeaturesTodo_CB.Checked = true;
        }

        if (this.m_sPageAction == "viewgroup")
        {
            this.GroupName_TB.Enabled = false;
            this.ShortDescription_TB.Enabled = false;
            this.Description_TB.Enabled = false;
            this.PublicJoinYes_RB.Enabled = false;
            this.PublicJoinNo_RB.Enabled = false;
            this.PublicJoinHidden_RB.Enabled  = false;
            this.Location_TB.Enabled = false;
            this.GroupAvatar_TB.Enabled = false;
            this.EnableDistributeToSite_CB.Enabled = false;
            this.AllowMembersToManageFolders_CB.Enabled = false;
            this.FeaturesCalendar_CB.Enabled = false;
            this.FeaturesForum_CB.Enabled = false;
            this.FeaturesTodo_CB.Enabled = false;
        }
        else if (this.m_sPageAction == "addeditgroup")
        {
            if (this.m_refContentApi.IsAdmin() == false)
            {
                this.AllowMembersToManageFolders_CB.Enabled = false;
            }
        }
    }
Beispiel #10
0
    private void Populate_ViewCommunityGroupsGrid(CommunityGroupData[] data)
    {
        System.Web.UI.WebControls.BoundColumn colBound;

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "CHECKL";
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.HeaderStyle.Width = Unit.Percentage(5);
        colBound.ItemStyle.Width = Unit.Percentage(5);
        GroupGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "LEFT";
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.Width = Unit.Percentage(45);
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        GroupGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "CHECKR";
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.Width = Unit.Percentage(5);
        GroupGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "RIGHT";
        colBound.ItemStyle.Width = Unit.Percentage(45);
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.Wrap = false;
        GroupGrid.Columns.Add(colBound);

        PageSettings();

        DataTable dt = new DataTable();
        DataRow dr;
        dt.Columns.Add(new DataColumn("CHECKL", typeof(string)));
        dt.Columns.Add(new DataColumn("LEFT", typeof(string)));
        dt.Columns.Add(new DataColumn("CHECKR", typeof(string)));
        dt.Columns.Add(new DataColumn("RIGHT", typeof(string)));
        int i = 0;

        if (!(data == null))
        {
            // add select all row.
            dr = dt.NewRow();
            dr["CHECKL"] = "<input type=\"checkbox\" name=\"checkall\" id=\"req_deleted_users\" onClick=\"javascript:checkAll(\'\');\">";
            dr["LEFT"] = GetMessage("generic select all msg") + "<br/><br/>";
            dt.Rows.Add(dr);
            dr = dt.NewRow();
            dr["CHECKL"] = "&#160;";
            dr["LEFT"] = "&#160;";
            dt.Rows.Add(dr);

            for (i = 0; i <= data.Length - 1; i++)
            {
                dr = dt.NewRow();
                if (data[i].GroupAdmin.Id == this.m_refContentApi.UserId)
                {
                    dr["CHECKL"] = "&#160;";
                }
                else
                {
                    dr["CHECKL"] = "<input type=\"checkbox\" name=\"req_deleted_users\" id=\"req_deleted_users\" value=\"" + data[i].GroupId + "\" onClick=\"javascript:checkAll(\'req_deleted_users\');\">";
                }
                dr["LEFT"] = "<img align=\"left\" src=\"" + this.m_refContentApi.AppImgPath + "group.gif" + "\" width=\"32\" height=\"32\"/>" + data[i].GroupName;
                if (i < (data.Length - 1))
                {
                    i++;
                    if (data[i].GroupAdmin.Id == this.m_refContentApi.UserId)
                    {
                        dr["CHECKR"] = "&#160;";
                    }
                    else
                    {
                        dr["CHECKR"] = "<input type=\"checkbox\" name=\"req_deleted_users\" id=\"req_deleted_users\" value=\"" + data[i].GroupId + "\" onClick=\"javascript:checkAll(\'req_deleted_users\');\">";
                    }
                    dr["RIGHT"] = "<img align=\"left\" src=\"" + this.m_refContentApi.AppImgPath + "group.gif" + "\"/>" + data[i].GroupName;
                }
                dt.Rows.Add(dr);
            }
        }

        DataView dv = new DataView(dt);
        GroupGrid.DataSource = dv;
        GroupGrid.DataBind();
    }
    protected void PopulateData(CommunityGroupData cGrp, List<UserData> groupAdmins)
    {
        int i = 0;
        StringBuilder sBuilder = new StringBuilder();

        this.GroupName_TB.Text = cGrp.GroupName;
        this.ShortDescription_TB.Text = cGrp.GroupShortDescription;
        this.Description_TB.Text = cGrp.GroupLongDescription;
        this.PublicJoinYes_RB.Checked = cGrp.GroupEnroll;
        this.PublicJoinNo_RB.Checked = !(cGrp.GroupEnroll);
        this.PublicJoinHidden_RB.Checked = cGrp.GroupHidden;
        this.Location_TB.Text = cGrp.GroupLocation;
        this.GroupAvatar_TB.Text = cGrp.GroupImage;
        this.EnableDistributeToSite_CB.Checked = cGrp.GroupEnableDistributeToSite;
        this.AllowMembersToManageFolders_CB.Checked = cGrp.AllowMembersToManageFolders;
        this.ltr_avatarpath.Text = "";
        // Me.tb_admin_name.Text = cGrp.GroupAdmin.DisplayName
        groupMessageBoardModerate = _MessageBoardApi.IsModerated(this.m_iID, Ektron.Cms.Common.EkEnumeration.MessageBoardObjectType.CommunityGroup);
        this.chkMsgBoardModeration.Checked = groupMessageBoardModerate;

        //ekpmsgto__Page.Value = cGrp.GroupAdmin.DisplayName;
        if (groupAdmins.Count > 0)
        {
            sBuilder.Append("arGroupAdmins = new Array(");
            int order = 0;
            for (i = 0; i < groupAdmins.Count; i++)
            {
                if(order!=0)
                    sBuilder.Append(",");
                if (groupAdmins[i].DisplayName != "")
                sBuilder.Append("new groupAdmin('" + groupAdmins[i].DisplayName + "','" + groupAdmins[i].Id + "')");
                else
                    sBuilder.Append("new groupAdmin('" + groupAdmins[i].FirstName  + "','" + groupAdmins[i].Id + "')");

                order += 1;
            }
            sBuilder.AppendLine(")");
            sBuilder.AppendLine("renderGroupAdmins(" + cGrp.GroupId + ");");
        }
        Page.ClientScript.RegisterStartupScript(this.GetType(), "renderGroupAdmins", sBuilder.ToString(), true);

        ektouserid__Page.Value = cGrp.GroupAdmin.Id.ToString();

        this.chkEnableDocumentNotifications.Checked = cGrp.EnableDocumentsInNotifications;
        this.chkEnableEmail.Checked = cGrp.EnableGroupEmail;
        this.chkEnableEmail.Enabled = _activityApi.IsActivityEmailReplyEnabled;
        this.txtEmailAccount.Text = EkFunctions.HtmlDecode(cGrp.EmailAccountName);
        this.txtEmailAddressValue.Text = EkFunctions.HtmlDecode(cGrp.EmailAddress);

        if (!string.IsNullOrEmpty(cGrp.EmailPassword))
        {
            this.txtEmailPassword.Text = "*****";
            this.txtEmailPassword.Attributes.Add("value", "*****");
        }
        ucEktronGroupEmailSetting.Attributes.Add("style", "display:none;");
        if (cGrp.EnableGroupEmail)
        {
            ucEktronGroupEmailSetting.Attributes.Add("style", "display:block;");
            ucEktronGroupEmailSetting.Visible = cGrp.EnableGroupEmail;
        }

        txtEmailReplyServer.Value = mailServer.POPServer;
        txtEmailReplyServerPort.Value = mailServer.POPPort.ToString();
        this.lblEmailServerPortValue.Text = mailServer.POPPort.ToString();
        this.lblEmailServerValue.Text = mailServer.POPServer;
        this.chkUseSsl.Checked = mailServer.POPSSL;
        chkUseSsl.Checked = mailServer.POPSSL;

        calendardata = _CalendarApi.GetPublicCalendar(Ektron.Cms.Common.EkEnumeration.WorkSpace.Group, this.m_iID);
        if (calendardata != null)
        {
            FeaturesCalendar_CB.Enabled = false;
            FeaturesCalendar_CB.Checked = true;
        }
        _doesForumExists = m_refCommunityGroupApi.DoesCommunityGroupForumExists(Ektron.Cms.Common.EkEnumeration.WorkSpace.Group, this.m_iID);
        if (_doesForumExists > 0)
        {
            FeaturesForum_CB.Enabled = false;
            FeaturesForum_CB.Checked = true;
        }

        var todoList = GetGroupTodoList();
        if (todoList != null)
        {
            FeaturesTodo_CB.Enabled = false;
            FeaturesTodo_CB.Checked = true;
        }

        if (this.m_sPageAction == "viewgroup")
        {
            this.GroupName_TB.Enabled = false;
            this.ShortDescription_TB.Enabled = false;
            this.Description_TB.Enabled = false;
            this.PublicJoinYes_RB.Enabled = false;
            this.PublicJoinNo_RB.Enabled = false;
            this.PublicJoinHidden_RB.Enabled = false;
            this.Location_TB.Enabled = false;
            this.EnableDistributeToSite_CB.Enabled = false;
            this.AllowMembersToManageFolders_CB.Enabled = false;
        }
    }
    protected void EditGroup()
    {
        CommonApi refCommonAPI = new CommonApi();

        BuildJS();
        if (this.m_iID > 0)
        {
            cgGroup = m_refCommunityGroupApi.GetCommunityGroupByID(this.m_iID);
            lbl_id.Text = cgGroup.GroupId.ToString();
            List<Ektron.Cms.UserData> groupAdmins = new List<UserData>();
            //groupAdmins = commGroup.GetAllCommunityGroupAdmins(this.m_iID);
            commGroup = new Ektron.Cms.Community.CommunityGroup(m_refContentApi.RequestInformationRef);
            groupAdmins = commGroup.GetAllCommunityGroupAdmins(m_iID);
            PopulateData(cgGroup, groupAdmins);
        }
        else
        {
            this.PublicJoinYes_RB.Checked = true;
            if (!Ektron.Cms.DataIO.LicenseManager.LicenseManager.IsFeatureEnable(m_refContentApi.RequestInformationRef, Ektron.Cms.DataIO.LicenseManager.Feature.MembershipUsers))
            {
                this.FeaturesCalendar_CB.Checked = true;
                this.FeaturesForum_CB.Checked = true;
                this.EnableDistributeToSite_CB.Checked = true;
            }
            tr_ID.Visible = false;
            ucEktronGroupEmailSetting.Attributes.Add("style", "display:none;");
            ektouserid__Page.Value = m_refCommunityGroupApi.RequestInformationRef.CallerId.ToString();

        }
        TD_GroupTags.InnerHtml = GetGroupTags();
        txtEmailReplyServer.Value = mailServer.POPServer;
        txtEmailReplyServerPort.Value = mailServer.POPPort.ToString();
        chkUseSsl.Checked = mailServer.POPSSL;
        this.chkEnableEmail.Enabled = _activityApi.IsActivityEmailReplyEnabled || cgGroup.EnableGroupEmail;
        this.lblEmailServerPortValue.Text = mailServer.POPPort.ToString();
        this.lblEmailServerValue.Text = mailServer.POPServer;
    }
    protected void Process_EditGroup()
    {
        string adminUsersValue = hdnAdminUsers.Value.ToString();

        if (!String.IsNullOrEmpty(adminUsersValue))
        {
            // An admin was selected, tidy and split into array
            if (hdnAdminUsers.Value.ToString().IndexOf(",") == 0)
            {
                hdnAdminUsers.Value = hdnAdminUsers.Value.ToString().Substring(1);
            }
            hdnAdminUsers.Value = hdnAdminUsers.Value.ToString().Replace(",,", ",");
            if (hdnAdminUsers.Value.ToString().Substring(hdnAdminUsers.Value.ToString().Length - 1) == ",")
            {
                hdnAdminUsers.Value = hdnAdminUsers.Value.ToString().Remove(hdnAdminUsers.Value.ToString().Length - 1);
            }

            char[] delimiter = new char[] { ',' };
            strAdminUsers = hdnAdminUsers.Value.ToString().Split(delimiter);
        }
        else
        {
            // Admin not selected, current user becomes admin
            strAdminUsers = new string[1]{ m_userId.ToString() };
        }

        if (bAccess)
        {
            if (m_iID > 0)
            {
                cgGroup = this.m_refCommunityGroupApi.GetCommunityGroupByID(this.m_iID);
                groupMessageBoardModerate = _MessageBoardApi.IsModerated(m_iID, Ektron.Cms.Common.EkEnumeration.MessageBoardObjectType.CommunityGroup);
                if (groupMessageBoardModerate != false || chkMsgBoardModeration.Checked != false)
                {
                    _MessageBoardApi.Moderate(m_iID, Ektron.Cms.Common.EkEnumeration.MessageBoardObjectType.CommunityGroup, m_userId, System.Convert.ToBoolean(this.chkMsgBoardModeration.Checked));
                }
            }
            else
            {
                cgGroup = new CommunityGroupData();
            }

            cgGroup.GroupName = (string)(this.GroupName_TB.Text.Trim());
            calendardata.Name = "ekCalendar";
            calendardata.Description = "";
            if (Request.Form["ektouserid__Page"] != "" && Information.IsNumeric(Request.Form["ektouserid__Page"]) && Convert.ToInt64(Request.Form["ektouserid__Page"]) > 0)
            {
                if (m_iID > 0)
                {
                    Ektron.Cms.Common.Cache.ApplicationCache.Invalidate((string)("GroupAccess_" + m_iID.ToString() + "_" + cgGroup.GroupAdmin.Id.ToString())); // old
                }
                cgGroup.GroupAdmin.Id = Convert.ToInt64(Request.Form["ektouserid__Page"]);
                if (m_iID > 0)
                {
                    Ektron.Cms.Common.Cache.ApplicationCache.Invalidate((string)("GroupAccess_" + m_iID.ToString() + "_" + cgGroup.GroupAdmin.Id.ToString())); // new
                }
            }
            cgGroup.GroupShortDescription = (string)this.ShortDescription_TB.Text;
            cgGroup.GroupLongDescription = (string)this.Description_TB.Text;
            if (m_iID > 0 && !(cgGroup.GroupEnroll == this.PublicJoinYes_RB.Checked))
            {
                Ektron.Cms.Common.Cache.ApplicationCache.Invalidate((string)("GroupEnroll_" + m_iID.ToString()));
            }
            cgGroup.GroupEnroll = System.Convert.ToBoolean(this.PublicJoinYes_RB.Checked);
            cgGroup.GroupLocation = (string)this.Location_TB.Text;
            cgGroup.GroupHidden = System.Convert.ToBoolean(this.PublicJoinHidden_RB.Checked);
            cgGroup.GroupEnableDistributeToSite = System.Convert.ToBoolean(this.EnableDistributeToSite_CB.Checked);
            cgGroup.AllowMembersToManageFolders = System.Convert.ToBoolean(this.AllowMembersToManageFolders_CB.Checked);

            cgGroup.EnableDocumentsInNotifications = System.Convert.ToBoolean(this.chkEnableDocumentNotifications.Checked);
            cgGroup.EnableGroupEmail = System.Convert.ToBoolean(this.chkEnableEmail.Checked);
            cgGroup.EmailAccountName = EkFunctions.HtmlEncode(this.txtEmailAccount.Text);
            cgGroup.EmailAddress = EkFunctions.HtmlEncode(this.txtEmailAddressValue.Text);

            if (this.txtEmailPassword.Text != "*****")
            {
                cgGroup.EmailPassword = (string)this.txtEmailPassword.Text;
            }

            // taxonomy
            TaxonomyTreeIdList = Request.Form[taxonomyselectedtree.UniqueID];
            if (TaxonomyTreeIdList.Trim().EndsWith(","))
            {
                TaxonomyTreeIdList = TaxonomyTreeIdList.Substring(0, TaxonomyTreeIdList.Length - 1);
            }
            TaxonomyRequest tax_request = new TaxonomyRequest();
            tax_request.TaxonomyIdList = TaxonomyTreeIdList;
            cgGroup.GroupCategory = TaxonomyTreeIdList;
            // taxonomy
            // file
            string sfileloc = "";
            if (fileupload1.PostedFile != null && fileupload1.PostedFile.FileName != "") //Check to make sure we actually have a file to upload
            {
                string strLongFilePath = (string)fileupload1.PostedFile.FileName;
                string[] aNameArray = Strings.Split((string)fileupload1.PostedFile.FileName, "\\", -1, 0);
                string strFileName = "";
                if (aNameArray.Length > 0)
                {
                    strFileName = aNameArray[(aNameArray.Length - 1)];
                }
                strFileName = (string)((System.Guid.NewGuid().ToString()).Substring(0, 5) + "_g_" + strFileName);
                if ((((string)fileupload1.PostedFile.ContentType == "image/pjpeg") || ((string)fileupload1.PostedFile.ContentType == "image/jpeg")) || ((string)fileupload1.PostedFile.ContentType == "image/gif")) //Make sure we are getting a valid JPG/gif image
                {
                    fileupload1.PostedFile.SaveAs(Server.MapPath(m_refCommunityGroupApi.SitePath + "uploadedimages/" + strFileName));
                    lbStatus.Text = string.Format(m_refCommunityGroupApi.EkMsgRef.GetMessage("lbl success avatar uploaded"), strFileName, m_refCommunityGroupApi.SitePath + "uploadedimages/" + strFileName);
                    Utilities.ProcessThumbnail(Server.MapPath(m_refCommunityGroupApi.SitePath + "uploadedimages/"), strFileName);
                }
                else
                {
                    //Not a valid jpeg/gif image
                    lbStatus.Text = m_refCommunityGroupApi.EkMsgRef.GetMessage("lbl err avatar not valid extension");
                }
                sfileloc = m_refCommunityGroupApi.SitePath + "uploadedimages/thumb_" + Utilities.GetCorrectThumbnailFileWithExtn(strFileName);
                cgGroup.GroupImage = sfileloc;
            }
            else
            {
                cgGroup.GroupImage = (string)this.GroupAvatar_TB.Text;
            }
            // file
            if (m_iID > 0)
            {
                m_refCommunityGroupApi.UpdateCommunityGroup(cgGroup);
                UpdateGroupTags(false);
                InitiateProcessAction();
                RemoveCurrentAdminUsers();//Need to remove all admins then re-added
                AddMultipleGroupAdmins(strAdminUsers);
            }
            else
            {
                UserManager Usermanager = new UserManager();
                UserData userBaseData = null;
                List<UserData> userlist = new List<UserData>();
                long longUserId;
                foreach (string userId in strAdminUsers)
                {
                    if (long.TryParse(userId, out longUserId) && longUserId > 0)
                        userBaseData = Usermanager.GetItem(longUserId);
                    if (userBaseData != null && userBaseData.Id > 0)
                        userlist.Add(userBaseData);
                }
                cgGroup.Admins = userlist;
                m_iID = m_refCommunityGroupApi.AddCommunityGroup(cgGroup);

                //ADDTAXONOMYITEM to Group eIntranet
                if (!(string.IsNullOrEmpty(TaxonomyTreeIdList)))
                {
                    TaxonomyTreeIdList = TaxonomyTreeIdList + ",";
                }
                else
                {
                    TaxonomyTreeIdList = "";
                }
                if (profileTaxonomyId > 0)
                {
                    m_refCommunityGroupApi.EkContentRef.AddDirectoryItem(TaxonomyTreeIdList + profileTaxonomyId.ToString(), m_iID.ToString(), Ektron.Cms.Common.EkEnumeration.TaxonomyItemType.Group);
                }
                else
                {
                    profileTaxonomyId = m_refCommunityGroupApi.EkContentRef.GetTaxonomyIdByPath("\\" + m_refCommunityGroupApi.UserId + "\\Groups", 1);
                    m_refCommunityGroupApi.EkContentRef.AddDirectoryItem(TaxonomyTreeIdList + profileTaxonomyId.ToString(), m_iID.ToString(), Ektron.Cms.Common.EkEnumeration.TaxonomyItemType.Group);
                }

                groupMessageBoardModerate = _MessageBoardApi.IsModerated(m_iID, Ektron.Cms.Common.EkEnumeration.MessageBoardObjectType.CommunityGroup);
                if (groupMessageBoardModerate != false || chkMsgBoardModeration.Checked != false)
                {
                    _MessageBoardApi.Moderate(m_iID, Ektron.Cms.Common.EkEnumeration.MessageBoardObjectType.CommunityGroup, m_userId, System.Convert.ToBoolean(chkMsgBoardModeration.Checked));
                }

                if (cgGroup.GroupCategory != "")
                {
                    TaxonomyId = 0;
                }
                if (m_iID > 0)
                {
                    UpdateGroupTags(true);
                    InitiateProcessAction();
                }
                else
                {
                    EmitJavascript();
                    RenderRecipientSelect();
                    EditGroup();
                    SetTaxonomy(this.m_iID);
                    SetAlias(this.m_iID);
                    errmsg.InnerHtml = "Error occured while adding this group. Please verify the group name is unique and try again.";
                    errmsg.Attributes.Add("class", "excpt");
                    // GroupName_TB.Attributes.Add("onkeypress", "ClearErr();")
                    GroupName_TB.Focus();
                }
            }
            if (FeaturesCalendar_CB.Checked == true)
            {
                _CalendarApi.Add(calendardata, Ektron.Cms.Common.EkEnumeration.WorkSpace.Group, m_iID);
            }
            if (FeaturesForum_CB.Checked == true && FeaturesForum_CB.Enabled != false)
            {
                m_refCommunityGroupApi.AddCommunityGroupForum(Ektron.Cms.Common.EkEnumeration.WorkSpace.Group, m_iID);
            }

            if (FeaturesTodo_CB.Checked == true)
            {
                AddGroupTodoList();
            }

        }
        else
        {
            throw (new Exception(GetMessage("err no perm add cgroup")));
        }
    }
    protected void Process_DeleteGroup()
    {
        cgGroup = this.m_refCommunityGroupApi.GetCommunityGroupByID(this.m_iID);
        if (cgGroup.GroupId > 0 && bAccess)
        {
            this.m_refCommunityGroupApi.DeleteCommunityGroupByID(this.m_iID);

            js_taxon.Text = "var __TaxonomyOverrideId=\"" + TaxonomyOverrideId + "\".split(\",\");" + Environment.NewLine;
            Ektron.Cms.API.JS.RegisterJSBlock(this, "self.parent.location.reload(true); self.parent.ektb_remove();", "EktronSelfParentLocationReloadJS");
        }
        else
        {
            throw (new Exception(GetMessage("err no perm del cgroup")));
        }
    }