From 1ca7d3a57e7185f56ba78b3e00c4f41f1e568746 Mon Sep 17 00:00:00 2001
From: "simon@Simon-PC.lindenlab.com" <simon@Simon-PC.lindenlab.com>
Date: Wed, 27 Jun 2012 13:58:37 -0700
Subject: [PATCH] MAINT-1173 : Top Scripts: Break down usage by parcel. 
 Follow-on code to add per-parcel filtering.  Reviewed by Kelly

---
 indra/llcommon/indra_constants.h              |  1 +
 indra/newview/llfloatertopobjects.cpp         | 28 +++++++--------
 indra/newview/llfloatertopobjects.h           |  4 +--
 .../default/xui/en/floater_top_objects.xml    | 34 ++++++++++++++++++-
 4 files changed, 47 insertions(+), 20 deletions(-)

diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h
index 0745696ef3e..0da83720bd5 100644
--- a/indra/llcommon/indra_constants.h
+++ b/indra/llcommon/indra_constants.h
@@ -62,6 +62,7 @@ enum LAND_STAT_FLAGS
 	STAT_FILTER_BY_PARCEL	= 0x00000001,
 	STAT_FILTER_BY_OWNER	= 0x00000002,
 	STAT_FILTER_BY_OBJECT	= 0x00000004,
+	STAT_FILTER_BY_PARCEL_NAME	= 0x00000008,
 	STAT_REQUEST_LAST_ENTRY	= 0x80000000,
 };
 
diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp
index 08997d58cbe..2d91a61b545 100644
--- a/indra/newview/llfloatertopobjects.cpp
+++ b/indra/newview/llfloatertopobjects.cpp
@@ -82,6 +82,7 @@ LLFloaterTopObjects::LLFloaterTopObjects(const LLSD& key)
 	mCommitCallbackRegistrar.add("TopObjects.Refresh",			boost::bind(&LLFloaterTopObjects::onRefresh, this));
 	mCommitCallbackRegistrar.add("TopObjects.GetByObjectName",	boost::bind(&LLFloaterTopObjects::onGetByObjectName, this));
 	mCommitCallbackRegistrar.add("TopObjects.GetByOwnerName",	boost::bind(&LLFloaterTopObjects::onGetByOwnerName, this));
+	mCommitCallbackRegistrar.add("TopObjects.GetByParcelName",	boost::bind(&LLFloaterTopObjects::onGetByParcelName, this));
 	mCommitCallbackRegistrar.add("TopObjects.CommitObjectsList",boost::bind(&LLFloaterTopObjects::onCommitObjectsList, this));
 }
 
@@ -99,21 +100,6 @@ BOOL LLFloaterTopObjects::postBuild()
 
 	setDefaultBtn("show_beacon_btn");
 
-	/*
-	LLLineEditor* line_editor = getChild<LLLineEditor>("owner_name_editor");
-	if (line_editor)
-	{
-		line_editor->setCommitOnFocusLost(FALSE);
-		line_editor->setCommitCallback(onGetByOwnerName, this);
-	}
-
-	line_editor = getChild<LLLineEditor>("object_name_editor");
-	if (line_editor)
-	{
-		line_editor->setCommitOnFocusLost(FALSE);
-		line_editor->setCommitCallback(onGetByObjectName, this);
-	}*/
-
 	mCurrentMode = STAT_REPORT_TOP_SCRIPTS;
 	mFlags = 0;
 	mFilter.clear();
@@ -277,7 +263,7 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data)
 		
 		LLUIString format = getString("top_scripts_text");
 		format.setArg("[COUNT]", llformat("%d", total_count));
-		format.setArg("[TIME]", llformat("%0.1f", mtotalScore));
+		format.setArg("[TIME]", llformat("%0.3f", mtotalScore));
 		getChild<LLUICtrl>("title_text")->setValue(LLSD(format));
 	}
 	else
@@ -315,6 +301,7 @@ void LLFloaterTopObjects::updateSelectionInfo()
 	{
 		getChild<LLUICtrl>("object_name_editor")->setValue(sli->getColumn(1)->getValue().asString());
 		getChild<LLUICtrl>("owner_name_editor")->setValue(sli->getColumn(2)->getValue().asString());
+		getChild<LLUICtrl>("parcel_name_editor")->setValue(sli->getColumn(4)->getValue().asString());
 	}
 }
 
@@ -494,6 +481,15 @@ void LLFloaterTopObjects::onGetByOwnerName()
 	onRefresh();
 }
 
+
+void LLFloaterTopObjects::onGetByParcelName()
+{
+	mFlags  = STAT_FILTER_BY_PARCEL_NAME;
+	mFilter = getChild<LLUICtrl>("parcel_name_editor")->getValue().asString();
+	onRefresh();
+}
+
+
 void LLFloaterTopObjects::showBeacon()
 {
 	LLScrollListCtrl* list = getChild<LLScrollListCtrl>("objects_list");
diff --git a/indra/newview/llfloatertopobjects.h b/indra/newview/llfloatertopobjects.h
index a608ca20f16..6edc46cf799 100644
--- a/indra/newview/llfloatertopobjects.h
+++ b/indra/newview/llfloatertopobjects.h
@@ -73,9 +73,7 @@ class LLFloaterTopObjects : public LLFloater
 
 	void onGetByOwnerName();
 	void onGetByObjectName();
-
-//	static void onGetByOwnerNameClicked(void* data)  { onGetByOwnerName(NULL, data); };
-//	static void onGetByObjectNameClicked(void* data) { onGetByObjectName(NULL, data); };
+	void onGetByParcelName();
 
 	void showBeacon();
 
diff --git a/indra/newview/skins/default/xui/en/floater_top_objects.xml b/indra/newview/skins/default/xui/en/floater_top_objects.xml
index 1e4224d3f2a..0b711773453 100644
--- a/indra/newview/skins/default/xui/en/floater_top_objects.xml
+++ b/indra/newview/skins/default/xui/en/floater_top_objects.xml
@@ -2,7 +2,7 @@
 <floater
  legacy_header_height="18"
  can_resize="true"
- height="350"
+ height="372"
  layout="topleft"
  min_height="300"
  min_width="450"
@@ -193,6 +193,38 @@
       <button.commit_callback
           function="TopObjects.GetByOwnerName" />
     </button>
+    <text
+     type="string"
+     length="1"
+     follows="left|bottom"
+     height="20"
+     layout="topleft"
+     left="10"
+     top_pad="5"
+     name="parcel_name_text"
+     width="107">
+        Parcel:
+    </text>
+    <line_editor
+     follows="left|bottom|right"
+     height="20"
+     layout="topleft"
+     left_pad="3"
+     name="parcel_name_editor"
+     top_delta="-3"
+     width="568" />
+    <button
+     follows="bottom|right"
+     height="23"
+     label="Filter"
+     layout="topleft"
+     left_pad="5"
+     name="filter_parcel_btn"
+     top_delta="0"
+     width="100">
+      <button.commit_callback
+          function="TopObjects.GetByParcelName" />
+    </button>
     <button
      follows="bottom|right"
      height="22"
-- 
GitLab