protected void Page_Load(object sender, EventArgs e)
    {
        if (QueryHelper.ValidateHash("hash", "eventid") && (Parameters != null))
        {
            CheckPermissions(true);

            // Get the ORDER BY column and starting event ID
            string orderBy = ValidationHelper.GetString(Parameters["orderby"], "EventID DESC");
            if ((orderBy == string.Empty) || (orderBy.IndexOfCSafe(';') >= 0))
            {
                orderBy = "EventID DESC"; // ORDER BY with semicolon is considered to be dangerous
            }
            string whereCondition = ValidationHelper.GetString(Parameters["where"], string.Empty);

            eventId = QueryHelper.GetInteger("eventid", 0);

            if (!RequestHelper.IsPostBack())
            {
                // Get EventID value
                LoadData();
            }

            lnkExport.Visible     = true;
            lnkExport.Text        = GetString("EventLogDetails.Export");
            lnkExport.NavigateUrl = ResolveUrl("GetEventDetail.aspx?eventid=" + eventId);

            if (SiteID > 0)
            {
                lnkExport.NavigateUrl = URLHelper.AddParameterToUrl(lnkExport.NavigateUrl, "siteid", SiteID.ToString());
            }

            lnkExport.Target = "_blank";

            // Initialize next/previous buttons
            int[] prevNext = eventProvider.GetPreviousNext(eventId, whereCondition, orderBy);
            if (prevNext != null)
            {
                prevId = prevNext[0];
                nextId = prevNext[1];

                btnPrevious.Enabled = (prevId != 0);
                btnNext.Enabled     = (nextId != 0);

                btnPrevious.Click += btnPrevious_Click;
                btnNext.Click     += btnNext_Click;
            }

            // Set button caption
            btnNext.Text     = GetString("general.next") + " >";
            btnPrevious.Text = "< " + GetString("general.back");

            RegisterModalPageScripts();
            RegisterEscScript();
        }
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (QueryHelper.ValidateHash("hash", "eventid"))
        {
            CheckPermissions(true);

            if (EventInfo != null)
            {
                // Get EventID value
                LoadData();

                var url = ResolveUrl("GetEventDetail.aspx?eventid=" + EventInfo.EventID);
                if (SiteID > 0)
                {
                    url = URLHelper.AddParameterToUrl(url, "siteid", SiteID.ToString());
                }
                btnExport.OnClientClick = "window.open('" + url + "');";
                btnExport.Visible       = true;

                // Show report bug button for global administrator if event is warning or error
                if (CurrentUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Admin) && ((EventInfo.EventType == "W") || (EventInfo.EventType == "E")))
                {
                    btnReportBug.Visible     = true;
                    btnReportBug.NavigateUrl = ApplicationUIHelper.REPORT_BUG_URL;
                }

                if (Parameters != null)
                {
                    // Get the ORDER BY column and starting event ID
                    string orderBy = ValidationHelper.GetString(Parameters["orderby"], "EventID DESC");

                    // ORDER BY with semicolon is considered to be dangerous
                    if ((orderBy == string.Empty) || (orderBy.IndexOfCSafe(';') >= 0))
                    {
                        orderBy = "EventID DESC";
                    }
                    string whereCondition = ValidationHelper.GetString(Parameters["where"], string.Empty);

                    // Initialize next/previous buttons
                    int[] prevNext = EventLogProvider.GetPreviousNext(EventInfo.EventID, whereCondition, orderBy);
                    if (prevNext != null)
                    {
                        prevId = prevNext[0];
                        nextId = prevNext[1];

                        btnPrevious.Enabled = (prevId != 0);
                        btnNext.Enabled     = (nextId != 0);

                        btnPrevious.Click += btnPrevious_Click;
                        btnNext.Click     += btnNext_Click;
                    }
                }
                else
                {
                    btnNext.Visible     = false;
                    btnPrevious.Visible = false;
                }
            }

            RegisterModalPageScripts();
            RegisterEscScript();
        }
    }