private void agRanks_Callback(object sender, Modules.ActiveForums.Controls.CallBackEventArgs e)
 {
     agRanks.Datasource = DataProvider.Instance().Ranks_List(PortalId, ModuleId);
     agRanks.Refresh(e.Output);
 }
Beispiel #2
0
        private void BindForums()
        {
            IDataReader dr = DataProvider.Instance().Forums_List(PortalId, ModuleId, -1, -1, false);
            DataTable   dt = new DataTable("Forums");

            dt.Load(dr);
            int    totalGroups     = GetGroupCount(dt);
            int    totalGroupForum = 0;
            string tmpGroup        = string.Empty;
            int    i          = 0;
            int    groupCount = 0;
            int    forumCount = 0;

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append("<table width=\"95%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
            foreach (DataRow row in dt.Rows)
            {
                if (tmpGroup != row["ForumGroupId"].ToString())
                {
                    if (groupCount < Globals.GroupCount)
                    {
                        string sGroupName = row["GroupName"].ToString();
                        if (groupCount > 0)
                        {
                            sb.Append("<tr><td colspan=\"8\" width=\"100%\">" + RenderSpacer(5, 100) + "</td></tr>");
                        }
                        sb.Append("<tr class=\"afgroupback\"><td class=\"afgroupback_left\">" + RenderSpacer(1, 4) + "</td><td colspan=\"3\" width=\"100%\" onmouseover=\"this.className='agrowedit'\" onmouseout=\"this.className=''\" onclick=\"LoadView('manageforums_forumeditor','" + row["ForumGroupId"].ToString() + "|G');\">");
                        sb.Append(sGroupName);
                        sb.Append("</td><td><div class=\"af16icon\" onmouseover=\"this.className='af16icon_over';\" onmouseout=\"this.className='af16icon';\" onclick=\"LoadView('manageforums_forumeditor','" + row["ForumGroupId"].ToString() + "|G');\">" + edit + "</div></td><td>");
                        if (groupCount > 0)
                        {
                            sb.Append("<div class=\"af16icon\" onmouseover=\"this.className='af16icon_over';\" onmouseout=\"this.className='af16icon';\" onclick=\"groupMove(" + row["ForumGroupId"].ToString() + ",-1);\">" + arrowUp + "</div>");
                        }
                        groupCount += 1;
                        sb.Append("</td><td>");
                        if (groupCount < totalGroups)
                        {
                            sb.Append("<div class=\"af16icon\" onmouseover=\"this.className='af16icon_over';\" onmouseout=\"this.className='af16icon';\" onclick=\"groupMove(" + row["ForumGroupId"].ToString() + ",1);\">" + arrowDown + "</div>");
                        }
                        sb.Append("</td><td class=\"afgroupback_right\">" + RenderSpacer(1, 4) + "</td></tr>");
                        forumCount      = 0;
                        totalGroupForum = GetGroupForumCount(dt, Convert.ToInt32(row["ForumGroupId"]));
                        tmpGroup        = row["ForumGroupId"].ToString();
                    }
                }
                i += 1;
                if (Convert.ToInt32(row["ParentForumId"]) == 0)
                {
                    if (forumCount < Globals.ForumCount)
                    {
                        string sForumName = row["ForumName"].ToString();
                        sb.Append("<tr class=\"afforumback\"><td class=\"afforumback_left\">" + RenderSpacer(1, 4) + "</td><td style=\"width:15px;\" width=\"15\">" + RenderSpacer(5, 15) + "</td><td colspan=\"2\" width=\"100%\" onmouseover=\"this.className='afrowedit'\" onmouseout=\"this.className=''\" onclick=\"LoadView('manageforums_forumeditor','" + row["ForumId"].ToString() + "|F');\">");
                        sb.Append(sForumName);
                        sb.Append("</td><td><div class=\"af16icon\" onmouseover=\"this.className='af16icon_over';\" onmouseout=\"this.className='af16icon';\" onclick=\"LoadView('manageforums_forumeditor','" + row["ForumId"].ToString() + "|F');\">" + edit + "</div></td><td>");
                        if (forumCount > 0)
                        {
                            sb.Append("<div class=\"af16icon\" onmouseover=\"this.className='af16icon_over';\" onmouseout=\"this.className='af16icon';\" onclick=\"forumMove(" + row["ForumId"].ToString() + ",-1);\">" + arrowUp + "</div>");
                        }
                        forumCount += 1;
                        sb.Append("</td><td>");
                        if (forumCount < totalGroupForum)
                        {
                            sb.Append("<div class=\"af16icon\" onmouseover=\"this.className='af16icon_over';\" onmouseout=\"this.className='af16icon';\" onclick=\"forumMove(" + row["ForumId"].ToString() + ",1);\">" + arrowDown + "</div>");
                        }
                        sb.Append("</td><td class=\"afforumback_right\">" + RenderSpacer(1, 4) + "</td></tr>");


                        if (HasSubForums(Convert.ToInt32(row["ForumId"]), dt) > 0)
                        {
                            sb.Append(AddSubForums(dt, row));
                        }
                    }
                }
            }

            if (!dr.IsClosed)
            {
                dr.Close();
            }
            sb.Append("<tr><td></td><td></td><td></td><td width=\"100%\"></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td width=\"100%\" colspan=\"2\"></td><td></td><td></td><td></td><td></td></tr></table>");
            litForums.Text = sb.ToString();
        }
Beispiel #3
0
        private string BuildRSS(int PortalId, int TabId, int ModuleId, int intPosts, int ForumID, bool IngnoreSecurity, bool IncludeBody)
        {
            DotNetNuke.Entities.Portals.PortalController pc = new DotNetNuke.Entities.Portals.PortalController();
            DotNetNuke.Entities.Portals.PortalSettings   ps = DotNetNuke.Entities.Portals.PortalController.GetCurrentPortalSettings();
            DotNetNuke.Entities.Users.UserInfo           ou = DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo();
            UserController uc = new UserController();
            User           u  = uc.GetUser(PortalId, ModuleId);

            DataSet ds = DataProvider.Instance().UI_TopicsView(PortalId, ModuleId, ForumID, ou.UserID, 0, 20, ou.IsSuperUser, SortColumns.ReplyCreated);

            if (ds.Tables.Count > 0)
            {
                offSet = ps.TimeZoneOffset;
                if (ds.Tables[0].Rows.Count == 0)
                {
                    return(string.Empty);
                }
                drForum = ds.Tables[0].Rows[0];

                drSecurity = ds.Tables[1].Rows[0];
                dtTopics   = ds.Tables[3];
                if (dtTopics.Rows.Count == 0)
                {
                    return(string.Empty);
                }
                bView = Permissions.HasPerm(drSecurity["CanView"].ToString(), u.UserRoles);
                bRead = Permissions.HasPerm(drSecurity["CanRead"].ToString(), u.UserRoles);
                StringBuilder sb = new StringBuilder(1024);
                if (bRead)
                {
                    ForumName        = drForum["ForumName"].ToString();
                    GroupName        = drForum["GroupName"].ToString();
                    ForumDescription = drForum["ForumDesc"].ToString();
                    //TopicsTemplateId = CInt(drForum("TopicsTemplateId"))
                    bAllowRSS = Convert.ToBoolean(drForum["AllowRSS"]);
                    if (bAllowRSS)
                    {
                        sb.Append("<?xml version=\"1.0\" ?>" + System.Environment.NewLine);
                        sb.Append("<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\" xmlns:cf=\"http://www.microsoft.com/schemas/rss/core/2005\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:slash=\"http://purl.org/rss/1.0/modules/slash/\">" + System.Environment.NewLine);
                        string[] Params = { ParamKeys.ForumId + "=" + ForumID, ParamKeys.ViewType + "=" + Views.Topics };
                        string   URL    = string.Empty;
                        if (Request.QueryString["asg"] == null)
                        {
                            URL = DotNetNuke.Common.Globals.NavigateURL(TabId, "", Params);
                        }
                        else if (SimulateIsNumeric.IsNumeric(Request.QueryString["asg"]))
                        {
                            Params = new string[] { "asg=" + Request.QueryString["asg"], ParamKeys.ForumId + "=" + ForumID, ParamKeys.ViewType + "=" + Views.Topics };
                            URL    = DotNetNuke.Common.Globals.NavigateURL(TabId, "", Params);
                        }

                        if (URL.IndexOf(Request.Url.Host) == -1)
                        {
                            URL = DotNetNuke.Common.Globals.AddHTTP(Request.Url.Host) + URL;
                        }
                        // build channel
                        sb.Append(WriteElement("channel", 1));
                        sb.Append(WriteElement("title", HttpUtility.HtmlEncode(ps.PortalName) + " " + ForumName, 2));
                        sb.Append(WriteElement("link", URL, 2));
                        sb.Append(WriteElement("description", ForumDescription, 2));
                        sb.Append(WriteElement("language", PortalSettings.DefaultLanguage, 2));
                        sb.Append(WriteElement("generator", "ActiveForums  5.0", 2));
                        sb.Append(WriteElement("copyright", PortalSettings.FooterText, 2));
                        sb.Append(WriteElement("lastBuildDate", "[LASTBUILDDATE]", 2));
                        if (!(ps.LogoFile == string.Empty))
                        {
                            string sLogo = "<image><url>http://" + Request.Url.Host + ps.HomeDirectory + ps.LogoFile + "</url>";
                            sLogo += "<title>" + ps.PortalName + " " + ForumName + "</title>";
                            sLogo += "<link>" + URL + "</link></image>";
                            sb.Append(sLogo);
                        }
                        foreach (DataRow dr in dtTopics.Rows)
                        {
                            if (DotNetNuke.Security.PortalSecurity.IsInRoles(PortalSettings.ActiveTab.AuthorizedRoles))
                            {
                                //objModule = objModules.GetModule(ModuleId, TabId)
                                //If DotNetNuke.Security.PortalSecurity.IsInRoles(objModule.AuthorizedViewRoles) = True Then
                                //    sb.Append(BuildItem(dr, TabId, 2, IncludeBody, PortalId))
                                //End If
                                sb.Append(BuildItem(dr, TabId, 2, IncludeBody, PortalId));
                            }
                        }
                        sb.Append("<atom:link href=\"http://" + Request.Url.Host + HttpUtility.HtmlEncode(Request.RawUrl) + "\" rel=\"self\" type=\"application/rss+xml\" />");
                        sb.Append(WriteElement("/channel", 1));
                        sb.Replace("[LASTBUILDDATE]", LastBuildDate.ToString("r"));
                        sb.Append("</rss>");
                        //Cache.Insert("RSS" & ModuleId & ForumID, sb.ToString, Nothing, DateTime.Now.AddMinutes(dblCacheTimeOut), TimeSpan.Zero)
                        return(sb.ToString());
                    }
                }
            }


            return(string.Empty);
        }
Beispiel #4
0
 private List <TemplateInfo> GetTemplateList(int PortalId, int ModuleId, Templates.TemplateTypes TemplateType)
 {
     try
     {
         var         tl = new List <TemplateInfo>();
         IDataReader dr = TemplateType == Templates.TemplateTypes.All ? DataProvider.Instance().Templates_List(PortalId, ModuleId, -1) : DataProvider.Instance().Templates_List(PortalId, ModuleId, (int)TemplateType);
         dr.Read();
         dr.NextResult();
         while (dr.Read())
         {
             var ti = new TemplateInfo
             {
                 DateCreated = dr.IsDBNull(8) ? Utilities.NullDate() : Convert.ToDateTime(dr["DateCreated"]),
                 DateUpdated = dr.IsDBNull(9) ? Utilities.NullDate() : Convert.ToDateTime(dr["DateUpdated"]),
                 IsSystem    = Convert.ToBoolean(dr["IsSystem"]),
                 ModuleId    = Convert.ToInt32(dr["ModuleID"]),
                 PortalId    = Convert.ToInt32(dr["PortalId"]),
                 Subject     = Convert.ToString(dr["Subject"]),
                 Template    = Convert.ToString(dr["Template"])
             };
             ti.TemplateHTML = GetHTML(ti.Template);
             ti.TemplateId   = Convert.ToInt32(dr["TemplateId"]);
             ti.TemplateText = GetText(ti.Template);
             ti.TemplateType = (Templates.TemplateTypes)(dr["TemplateType"]);
             ti.Title        = Convert.ToString(dr["Title"]);
             tl.Add(ti);
         }
         dr.Close();
         return(tl);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Beispiel #5
0
 public void Template_Delete(int TemplateId, int PortalId, int ModuleId)
 {
     DataProvider.Instance().Templates_Delete(TemplateId, PortalId, ModuleId);
 }
Beispiel #6
0
 //'<summary>
 //'Function to save template.</summary>
 //'<param name="info">TemplateInfo object</param>
 public int Template_Save(TemplateInfo info)
 {
     return(Convert.ToInt32(DataProvider.Instance().Templates_Save(info.TemplateId, info.PortalId, info.ModuleId, (int)info.TemplateType, info.IsSystem, info.Title, info.Subject, info.Template)));
 }
Beispiel #7
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            SocialGroupId = -1;
            if (Request.QueryString["GroupId"] != null && SimulateIsNumeric.IsNumeric(Request.QueryString["GroupId"]))
            {
                SocialGroupId = Convert.ToInt32(Request.QueryString["GroupId"]);
            }

            SetupPage();

            try
            {
                if (MainSettings != null && MainSettings.InstallDate > Utilities.NullDate())
                {
                    if (Request.IsAuthenticated && UserLastAccess == Utilities.NullDate())
                    {
                        if (ForumUser != null)
                        {
                            DateTime dtLastAccess = DateTime.Now;
                            if (!(ForumUser.Profile.DateLastActivity == Utilities.NullDate()))
                            {
                                dtLastAccess = ForumUser.Profile.DateLastActivity;
                            }
                            UserLastAccess = dtLastAccess;
                        }
                    }
                    if (ForumModuleId < 1)
                    {
                        ForumModuleId = ModuleId;
                    }

                    string ctl  = DefaultView;
                    string opts = string.Empty;
                    if (Request.Params[ParamKeys.ViewType] != null)
                    {
                        ctl = Request.Params[ParamKeys.ViewType];
                    }
                    else if (Request.Params["view"] != null)
                    {
                        ctl = Request.Params["view"];
                    }
                    else if (Request.Params[ParamKeys.ViewType] == null & ForumId > 0 & TopicId <= 0)
                    {
                        ctl = Views.Topics;
                    }
                    else if (Request.Params[ParamKeys.ViewType] == null && Request.Params["view"] == null & TopicId > 0)
                    {
                        ctl = Views.Topic;
                    }
                    else if (Settings["amafDefaultView"] != null)
                    {
                        ctl = Settings["amafDefaultView"].ToString();
                    }
                    //ctl = "advanced"
                    // If Not cbLoader.IsCallback Then
                    if (Request.QueryString[ParamKeys.PageJumpId] != null)
                    {
                        opts = "PageId=" + Request.QueryString[ParamKeys.PageJumpId];
                    }
                    //End If
                    currView = ctl;
                    GetControl(ctl, opts);

                    if (Request.IsAuthenticated)
                    {
                        if (MainSettings.UsersOnlineEnabled)
                        {
                            DataProvider.Instance().Profiles_UpdateActivity(PortalId, ForumModuleId, UserId);
                        }
                    }
                }
                else
                {
                    string    ctlPath    = "~/DesktopModules/activeforums/controls/_default.ascx";
                    ForumBase ctlDefault = (ForumBase)(LoadControl(ctlPath));
                    ctlDefault.ID = "ctlConfig";
                    ctlDefault.ModuleConfiguration = this.ModuleConfiguration;
                    plhLoader.Controls.Clear();
                    plhLoader.Controls.Add(ctlDefault);
                }
            }
            catch (Exception ex)
            {
                //Response.Write(ex.Message)
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, ex);
            }
        }