From 7a7f68fb3c09c187f5b6fd333d0292a3fbfbc9df Mon Sep 17 00:00:00 2001
From: maxim_productengine <mnikolenko@productengine.com>
Date: Fri, 27 Sep 2019 16:58:54 +0300
Subject: [PATCH] SL-12024 [EEP] UI should indicate that the Environment tab is
 an estate-wide setting.

---
 indra/newview/llfloaterregioninfo.cpp         | 33 ++++++++++++++-
 indra/newview/llfloaterregioninfo.h           |  3 ++
 indra/newview/llviewermessage.cpp             |  3 +-
 .../skins/default/xui/en/notifications.xml    |  2 +-
 .../xui/en/panel_region_environment.xml       | 42 ++++++++++++++++++-
 5 files changed, 78 insertions(+), 5 deletions(-)

diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 83215a7fec8..816ef68093c 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -200,6 +200,8 @@ class LLPanelRegionEnvironment : public LLPanelEnvironmentInfo
 
     virtual S32         getParcelId() override { return INVALID_PARCEL_ID; }
 
+    static void         updateEstateName(const std::string& name);
+
 protected:
     static const U32    DIRTY_FLAG_OVERRIDE;
 
@@ -572,6 +574,16 @@ LLPanelRegionGeneralInfo* LLFloaterRegionInfo::getPanelGeneral()
 	return panel;
 }
 
+// static
+LLPanelRegionEnvironment* LLFloaterRegionInfo::getPanelEnvironment()
+{
+	LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
+	if (!floater) return NULL;
+	LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels");
+	LLPanelRegionEnvironment* panel = (LLPanelRegionEnvironment*)tab->getChild<LLPanel>("panel_env_info");
+	return panel;
+}
+
 // static
 LLPanelRegionTerrainInfo* LLFloaterRegionInfo::getPanelRegionTerrain()
 {
@@ -597,6 +609,13 @@ LLPanelRegionExperiences* LLFloaterRegionInfo::getPanelExperiences()
 	return (LLPanelRegionExperiences*)tab->getChild<LLPanel>("Experiences");
 }
 
+void LLFloaterRegionInfo::updateEstateName(const std::string& estate_name)
+{
+	LLPanelEstateCovenant::updateEstateName(estate_name);
+	LLPanelEstateInfo::updateEstateName(estate_name);
+	LLPanelRegionEnvironment::updateEstateName(estate_name);
+}
+
 void LLFloaterRegionInfo::disableTabCtrls()
 {
 	LLTabContainer* tab = getChild<LLTabContainer>("region_panels");
@@ -3813,6 +3832,15 @@ bool LLPanelRegionEnvironment::confirmUpdateEstateEnvironment(const LLSD& notifi
     return false;
 }
 
+void LLPanelRegionEnvironment::updateEstateName(const std::string& name)
+{
+	LLPanelRegionEnvironment* panelp = LLFloaterRegionInfo::getPanelEnvironment();
+	if (panelp)
+	{
+		panelp->getChildRef<LLTextBox>("estate_name").setText(name);
+	}
+}
+
 void LLPanelRegionEnvironment::onChkAllowOverride(bool value)
 {
     setDirtyFlag(DIRTY_FLAG_OVERRIDE);
@@ -3824,7 +3852,10 @@ void LLPanelRegionEnvironment::onChkAllowOverride(bool value)
     if (LLPanelEstateInfo::isLindenEstate())
         notification = "ChangeLindenEstate";
 
-    LLNotification::Params params(notification);
+	LLSD args;
+	args["ESTATENAME"] = LLEstateInfoModel::instance().getName();
+	LLNotification::Params params(notification);
+	params.substitutions(args);
     params.functor.function([this](const LLSD& notification, const LLSD& response) { confirmUpdateEstateEnvironment(notification, response); });
 
     if (!value || LLPanelEstateInfo::isLindenEstate())
diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h
index 0dda13cdc51..61aa0778ef6 100644
--- a/indra/newview/llfloaterregioninfo.h
+++ b/indra/newview/llfloaterregioninfo.h
@@ -96,6 +96,7 @@ class LLFloaterRegionInfo : public LLFloater
 	static LLPanelRegionTerrainInfo* getPanelRegionTerrain();
 	static LLPanelRegionExperiences* getPanelExperiences();
 	static LLPanelRegionGeneralInfo* getPanelGeneral();
+	static LLPanelRegionEnvironment* getPanelEnvironment();
 
 	// from LLPanel
 	virtual void refresh();
@@ -106,6 +107,8 @@ class LLFloaterRegionInfo : public LLFloater
 	void enableTopButtons();
 	void disableTopButtons();
 
+	static void updateEstateName(const std::string& estate_name);
+
 private:
 	
 	LLFloaterRegionInfo(const LLSD& seed);
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index a0935628d79..296289de09d 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -6714,9 +6714,8 @@ void process_covenant_reply(LLMessageSystem* msg, void**)
 	msg->getString("Data", "EstateName", estate_name);
 	msg->getUUID("Data", "EstateOwnerID", estate_owner_id);
 
-	LLPanelEstateCovenant::updateEstateName(estate_name);
 	LLPanelLandCovenant::updateEstateName(estate_name);
-	LLPanelEstateInfo::updateEstateName(estate_name);
+	LLFloaterRegionInfo::updateEstateName(estate_name);
 	LLFloaterBuyLand::updateEstateName(estate_name);
 
 	std::string owner_name =
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 228c50bb6d9..35c51dbc52b 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -4896,7 +4896,7 @@ Unchecking this option may remove restrictions that parcel owners have added to
    icon="alertmodal.tga"
    name="EstateParcelEnvironmentOverride"
    type="alertmodal">
-Unchecking this option will remove any custom environments that parcel owners have added to their parcels. Please discuss with your parcel owners as needed.
+(Estate-wide change: [ESTATENAME]) Unchecking this option will remove any custom environments that parcel owners have added to their parcels. Please discuss with your parcel owners as needed.
 Do you wish to proceed?
     <tag>confirm</tag>
     <usetemplate
diff --git a/indra/newview/skins/default/xui/en/panel_region_environment.xml b/indra/newview/skins/default/xui/en/panel_region_environment.xml
index f2f2d73a06c..bc0d59bcc7e 100644
--- a/indra/newview/skins/default/xui/en/panel_region_environment.xml
+++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml
@@ -19,11 +19,51 @@
     <string name="str_too_small">The parcel must be at least 128 square meters to support an environment.</string>
     <string name="str_empty">(empty)</string>
     <string name="str_region_env">(region environment)</string>
+    <text
+      type="string"
+      length="1"
+      follows="left|top"
+      height="32"
+      layout="topleft"
+      left="10"
+      name="env_help_text"
+      top="14"
+      word_wrap="true">
+       Changes to settings on this tab will affect all regions in the estate.
+    </text>
+    <text
+     type="string"
+     length="1"
+     follows="left|top"
+     font="SansSerif"
+     height="20"
+     layout="topleft"
+     right="160"
+     name="estate_text"
+     top_pad="2"
+     halign="right"
+     width="140">
+        Estate:
+    </text>
+    <text
+     type="string"
+     length="1"
+     follows="left|top"
+     font="SansSerif"
+     height="20"
+     layout="topleft"
+     top_delta="0"
+     name="estate_name"
+     left_pad="6"
+     width="150">
+        (unknown)
+    </text>
     <layout_stack 
             width="530"
-            height="367"
+            height="400"
             follows="all"
             layout="topleft"
+						left="0"
             animate="false"
             orientation="vertical">
         <layout_panel
-- 
GitLab