From 97d0bc774511c5a9695dcc26305eea42eb2168d5 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Wed, 19 Jun 2024 18:55:28 -0400
Subject: [PATCH] Revert "Better event floater"

This reverts commit 56af0588c2f79d36fc48e7ef3081c3d5fa6dad56.
---
 indra/newview/llfloaterevent.cpp              | 88 +++++++++++++++++--
 indra/newview/llfloaterevent.h                | 29 ++++--
 .../skins/default/xui/en/floater_event.xml    | 42 ++++++---
 3 files changed, 132 insertions(+), 27 deletions(-)

diff --git a/indra/newview/llfloaterevent.cpp b/indra/newview/llfloaterevent.cpp
index 92d762fa9cb..b07f2963b27 100644
--- a/indra/newview/llfloaterevent.cpp
+++ b/indra/newview/llfloaterevent.cpp
@@ -3,9 +3,8 @@
  * @brief Display for events in the finder
  *
  * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Alchemy Viewer Source Code
+ * Second Life Viewer Source Code
  * Copyright (C) 2010, Linden Research, Inc.
- * Copyright (C) 2014, Cinder Roxley @ Second Life
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -28,20 +27,93 @@
 #include "llviewerprecompiledheaders.h"
 
 #include "llfloaterevent.h"
-#include "llpaneleventinfo.h"
+
+#include "message.h"
+#include "llnotificationsutil.h"
+#include "llui.h"
+
+#include "llagent.h"
+#include "llviewerwindow.h"
+#include "llbutton.h"
+#include "llcachename.h"
+#include "llcommandhandler.h"   // secondlife:///app/chat/ support
+#include "lleventflags.h"
+#include "llmediactrl.h"
+#include "llexpandabletextbox.h"
+#include "llfloater.h"
+#include "llfloaterreg.h"
+#include "llmediactrl.h"
+#include "llfloaterworldmap.h"
+#include "llinventorymodel.h"
+#include "llslurl.h"
+#include "lltextbox.h"
+#include "lltexteditor.h"
+#include "lluiconstants.h"
+#include "llviewercontrol.h"
+#include "llweb.h"
+#include "llworldmap.h"
+#include "llworldmapmessage.h"
+#include "lluictrlfactory.h"
+#include "lltrans.h"
 
 
 LLFloaterEvent::LLFloaterEvent(const LLSD& key)
-:   LLFloater(key)
-,   mEventId(0)
+    : LLFloater(key),
+      LLViewerMediaObserver(),
+      mBrowser(NULL),
+      mEventID(0)
+{
+}
+
+
+LLFloaterEvent::~LLFloaterEvent()
+{
+}
+
+
+BOOL LLFloaterEvent::postBuild()
 {
+    mBrowser = getChild<LLMediaCtrl>("browser");
+    if (mBrowser)
+    {
+        mBrowser->addObserver(this);
+    }
 
+    return TRUE;
+}
+
+void LLFloaterEvent::handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event)
+{
+    switch (event)
+    {
+        case MEDIA_EVENT_NAVIGATE_BEGIN:
+            getChild<LLUICtrl>("status_text")->setValue(getString("loading_text"));
+            break;
+
+        case MEDIA_EVENT_NAVIGATE_COMPLETE:
+            getChild<LLUICtrl>("status_text")->setValue(getString("done_text"));
+            break;
+
+        default:
+            break;
+    }
 }
 
 void LLFloaterEvent::setEventID(const U32 event_id)
 {
-    mEventId = event_id;
-    if (event_id == 0) closeFloater();
+    mEventID = event_id;
+
+    if (event_id != 0)
+    {
+        LLSD subs;
+        subs["EVENT_ID"] = (S32)event_id;
+        // get the search URL and expand all of the substitutions
+        // (also adds things like [LANGUAGE], [VERSION], [OS], etc.)
+
+        std::string expanded_url = LLWeb::expandURLSubstitutions(gSavedSettings.getString("EventURL"), subs);
+
+        // and load the URL in the web view
+        mBrowser->navigateTo(expanded_url);
 
-    getChild<LLPanel>("event_panel")->onOpen(mEventId);
+    }
 }
diff --git a/indra/newview/llfloaterevent.h b/indra/newview/llfloaterevent.h
index 50eb86e07cb..169ce246ecb 100644
--- a/indra/newview/llfloaterevent.h
+++ b/indra/newview/llfloaterevent.h
@@ -3,9 +3,8 @@
  * @brief Display for events in the finder
  *
  * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Alchemy Viewer Source Code
+ * Second Life Viewer Source Code
  * Copyright (C) 2010, Linden Research, Inc.
- * Copyright (C) 2014, Cinder Roxley @ Second Life
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -29,17 +28,35 @@
 #define LL_LLFLOATEREVENT_H
 
 #include "llfloater.h"
+#include "llviewermediaobserver.h"
 
-class LLFloaterEvent final : public LLFloater
+
+class LLMediaCtrl;
+class LLButton;
+
+class LLFloaterEvent final : public LLFloater,
+                       public LLViewerMediaObserver
 
 {
 public:
     LLFloaterEvent(const LLSD& key);
-    /*virtual*/ ~LLFloaterEvent() = default;
+    /*virtual*/ ~LLFloaterEvent();
+
+    /*virtual*/ BOOL postBuild();
+
     void setEventID(const U32 event_id);
 
-private:
-    S32 mEventId;
+    U32 getEventID() { return mEventID; }
+
+
+
+protected:
+    /*virtual*/ void handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event);
+
+    U32             mEventID;
+
+    LLMediaCtrl*    mBrowser;
+
 };
 
 #endif // LL_LLFLOATEREVENT_H
diff --git a/indra/newview/skins/default/xui/en/floater_event.xml b/indra/newview/skins/default/xui/en/floater_event.xml
index 4b430877762..67eb4931e1b 100644
--- a/indra/newview/skins/default/xui/en/floater_event.xml
+++ b/indra/newview/skins/default/xui/en/floater_event.xml
@@ -1,23 +1,39 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater
- height="590"
+ height="400"
  can_resize="true"
  help_topic="event_details"
  label="Event"
  layout="topleft"
  name="Event"
+ save_rect="true"
  save_visibility="false"
- title="EVENT DETAILS"
- max_width="320"
- width="313">
-  <panel
-   follows="all"
-   name="event_panel"
-   top="0"
-   bottom="590"
-   left="0"
-   right="313"
-   class="panel_event_info"
-   filename="panel_event_info.xml" />
+ title="EVENT DETAILS" 
+ width="600">
+	<floater.string
+		name="loading_text">
+		Loading...
+	</floater.string>
+    <floater.string
+     name="done_text">
+        Done
+    </floater.string>
+  <web_browser
+     trusted_content="true" 
+     follows="left|right|top|bottom"
+     layout="topleft"
+     left="10"
+     name="browser"
+     height="365"
+     width="580"
+     top="0"/>
+	<text
+	 follows="bottom|left"
+	 height="16"
+	 layout="topleft"
+	 left_delta="0"
+	 name="status_text"
+	 top_pad="10"
+	 width="150" />	 
 </floater>
 
-- 
GitLab