Beispiel #1
0
        /// <summary>
        /// Renders the UserLink
        /// </summary>
        /// <param name="item">
        /// The item.
        /// </param>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        protected string UserLink([NotNull] PagedEventLog item)
        {
            var userLink = new UserLink
            {
                UserID      = item.UserID,
                Suspended   = item.Suspended,
                Style       = item.UserStyle,
                ReplaceName = this.PageContext.BoardSettings.EnableDisplayName ? item.DisplayName : item.Name
            };

            return(userLink.RenderToString());
        }
Beispiel #2
0
        /// <summary>
        /// Gets HTML IMG code representing given log event icon.
        /// </summary>
        /// <returns>
        /// return HTML code of event log entry image
        /// </returns>
        protected string EventIcon([NotNull] PagedEventLog item)
        {
            string cssClass, icon;

            EventLogTypes eventType;

            try
            {
                // find out of what type event log entry is
                eventType = item.Type.ToEnum <EventLogTypes>();
            }
            catch (Exception)
            {
                eventType = EventLogTypes.Information;
            }

            switch (eventType)
            {
            case EventLogTypes.Error:
                icon     = "radiation";
                cssClass = "danger";
                break;

            case EventLogTypes.Warning:
                icon     = "exclamation-triangle";
                cssClass = "warning";
                break;

            case EventLogTypes.Information:
                icon     = "exclamation";
                cssClass = "info";
                break;

            case EventLogTypes.Debug:
                icon     = "exclamation-triangle";
                cssClass = "warning";
                break;

            case EventLogTypes.Trace:
                icon     = "exclamation-triangle";
                cssClass = "warning";
                break;

            case EventLogTypes.SqlError:
                icon     = "exclamation-triangle";
                cssClass = "warning";
                break;

            case EventLogTypes.UserSuspended:
                icon     = "user-clock";
                cssClass = "warning";
                break;

            case EventLogTypes.UserUnsuspended:
                icon     = "user-check";
                cssClass = "info";
                break;

            case EventLogTypes.LoginFailure:
                icon     = "user-injured";
                cssClass = "warning";
                break;

            case EventLogTypes.UserDeleted:
                icon     = "user-alt-slash";
                cssClass = "danger";
                break;

            case EventLogTypes.IpBanSet:
                icon     = "hand-paper";
                cssClass = "warning";
                break;

            case EventLogTypes.IpBanLifted:
                icon     = "slash";
                cssClass = "success";
                break;

            case EventLogTypes.IpBanDetected:
                icon     = "hand-paper";
                cssClass = "warning";
                break;

            case EventLogTypes.SpamBotReported:
                icon     = "user-ninja";
                cssClass = "warning";
                break;

            case EventLogTypes.SpamBotDetected:
                icon     = "user-lock";
                cssClass = "warning";
                break;

            case EventLogTypes.SpamMessageReported:
                icon     = "flag";
                cssClass = "success";
                break;

            case EventLogTypes.SpamMessageDetected:
                icon     = "shield-alt";
                cssClass = "warning";
                break;

            default:
                icon     = "exclamation-circle";
                cssClass = "primary";
                break;
            }

            return($@"<i class=""fas fa-{icon} text-{cssClass}""></i>");
        }