summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llpanelclassified.cpp94
-rw-r--r--indra/newview/llpanelclassified.h21
-rw-r--r--indra/newview/llpanelpicks.cpp65
-rw-r--r--indra/newview/llpanelpicks.h7
-rw-r--r--indra/newview/llpanelprofile.cpp10
-rw-r--r--indra/newview/skins/default/xui/en/panel_classified_info.xml2
6 files changed, 135 insertions, 64 deletions
diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp
index 9f24ddc799..5c6636676c 100644
--- a/indra/newview/llpanelclassified.cpp
+++ b/indra/newview/llpanelclassified.cpp
@@ -114,6 +114,23 @@ public:
};
static LLDispatchClassifiedClickThrough sClassifiedClickThrough;
+// Just to debug errors. Can be thrown away later.
+class LLClassifiedClickMessageResponder : public LLHTTPClient::Responder
+{
+ LOG_CLASS(LLClassifiedClickMessageResponder);
+
+public:
+ // If we get back an error (not found, etc...), handle it here
+ virtual void errorWithContent(
+ U32 status,
+ const std::string& reason,
+ const LLSD& content)
+ {
+ llwarns << "Sending click message failed (" << status << "): [" << reason << "]" << llendl;
+ llwarns << "Content: [" << content << "]" << llendl;
+ }
+};
+
/* Re-expose this if we need to have classified ad HTML detail
pages. JC
@@ -1237,7 +1254,7 @@ void LLPanelClassifiedInfo::reshape(S32 width, S32 height, BOOL called_from_pare
void LLPanelClassifiedInfo::onOpen(const LLSD& key)
{
- LLUUID avatar_id = key["avatar_id"];
+ LLUUID avatar_id = key["classified_creator_id"];
if(avatar_id.isNull())
{
return;
@@ -1255,9 +1272,12 @@ void LLPanelClassifiedInfo::onOpen(const LLSD& key)
scrollToTop();
setClassifiedId(key["classified_id"]);
- setClassifiedName(key["name"]);
- setDescription(key["desc"]);
- setSnapshotId(key["snapshot_id"]);
+ setClassifiedName(key["classified_name"]);
+ setDescription(key["classified_desc"]);
+ setSnapshotId(key["classified_snapshot_id"]);
+ setFromSearch(key["from_search"]);
+
+ llinfos << "Opening classified [" << getClassifiedName() << "] (" << getClassifiedId() << ")" << llendl;
LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this);
LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(getClassifiedId());
@@ -1274,6 +1294,10 @@ void LLPanelClassifiedInfo::onOpen(const LLSD& key)
LLHTTPClient::post(url, body, new LLClassifiedStatsResponder(getClassifiedId()));
}
+ // Update classified click stats.
+ // *TODO: Should we do this when opening not from search?
+ sendClickMessage("profile");
+
setInfoLoaded(false);
}
@@ -1289,6 +1313,8 @@ void LLPanelClassifiedInfo::processProperties(void* data, EAvatarProcessorType t
setSnapshotId(c_info->snapshot_id);
setParcelId(c_info->parcel_id);
setPosGlobal(c_info->pos_global);
+ setSimName(c_info->sim_name);
+
setClassifiedLocation(createLocationText(c_info->parcel_name, c_info->sim_name, c_info->pos_global));
childSetValue("category", LLClassifiedInfo::sCategories[c_info->category]);
@@ -1323,7 +1349,19 @@ void LLPanelClassifiedInfo::resetData()
setClassifiedLocation(LLStringUtil::null);
setClassifiedId(LLUUID::null);
setSnapshotId(LLUUID::null);
- mPosGlobal.clearVec();
+ setPosGlobal(LLVector3d::zero);
+ setParcelId(LLUUID::null);
+ setSimName(LLStringUtil::null);
+ setFromSearch(false);
+
+ // reset click stats
+ mTeleportClicksOld = 0;
+ mMapClicksOld = 0;
+ mProfileClicksOld = 0;
+ mTeleportClicksNew = 0;
+ mMapClicksNew = 0;
+ mProfileClicksNew = 0;
+
childSetText("category", LLStringUtil::null);
childSetText("content_type", LLStringUtil::null);
childSetText("click_through_text", LLStringUtil::null);
@@ -1444,6 +1482,13 @@ void LLPanelClassifiedInfo::setClickThrough(
ct_str.setArg("[PROFILE]", llformat("%d", self->mProfileClicksNew + self->mProfileClicksOld));
self->childSetText("click_through_text", ct_str.getString());
+ // *HACK: remove this when there is enough room for click stats in the info panel
+ self->childSetToolTip("click_through_text", ct_str.getString());
+
+ llinfos << "teleport: " << llformat("%d", self->mTeleportClicksNew + self->mTeleportClicksOld)
+ << ", map: " << llformat("%d", self->mMapClicksNew + self->mMapClicksOld)
+ << ", profile: " << llformat("%d", self->mProfileClicksNew + self->mProfileClicksOld)
+ << llendl;
}
}
@@ -1532,8 +1577,46 @@ void LLPanelClassifiedInfo::scrollToTop()
scrollContainer->goToTop();
}
+// static
+// *TODO: move out of the panel
+void LLPanelClassifiedInfo::sendClickMessage(
+ const std::string& type,
+ bool from_search,
+ const LLUUID& classified_id,
+ const LLUUID& parcel_id,
+ const LLVector3d& global_pos,
+ const std::string& sim_name)
+{
+ // You're allowed to click on your own ads to reassure yourself
+ // that the system is working.
+ LLSD body;
+ body["type"] = type;
+ body["from_search"] = from_search;
+ body["classified_id"] = classified_id;
+ body["parcel_id"] = parcel_id;
+ body["dest_pos_global"] = global_pos.getValue();
+ body["region_name"] = sim_name;
+
+ std::string url = gAgent.getRegion()->getCapability("SearchStatTracking");
+ llinfos << "Sending click msg via capability (url=" << url << ")" << llendl;
+ llinfos << "body: [" << body << "]" << llendl;
+ LLHTTPClient::post(url, body, new LLClassifiedClickMessageResponder());
+}
+
+void LLPanelClassifiedInfo::sendClickMessage(const std::string& type)
+{
+ sendClickMessage(
+ type,
+ fromSearch(),
+ getClassifiedId(),
+ getParcelId(),
+ getPosGlobal(),
+ getSimName());
+}
+
void LLPanelClassifiedInfo::onMapClick()
{
+ sendClickMessage("map");
LLFloaterWorldMap::getInstance()->trackLocation(getPosGlobal());
LLFloaterReg::showInstance("world_map", "center");
}
@@ -1542,6 +1625,7 @@ void LLPanelClassifiedInfo::onTeleportClick()
{
if (!getPosGlobal().isExactlyZero())
{
+ sendClickMessage("teleport");
gAgent.teleportViaLocation(getPosGlobal());
LLFloaterWorldMap::getInstance()->trackLocation(getPosGlobal());
}
diff --git a/indra/newview/llpanelclassified.h b/indra/newview/llpanelclassified.h
index 78f095a9bb..58e7c9a4b4 100644
--- a/indra/newview/llpanelclassified.h
+++ b/indra/newview/llpanelclassified.h
@@ -221,6 +221,7 @@ private:
class LLPanelClassifiedInfo : public LLPanel, public LLAvatarPropertiesObserver
{
+ LOG_CLASS(LLPanelClassifiedInfo);
public:
static LLPanelClassifiedInfo* create();
@@ -263,6 +264,14 @@ public:
LLUUID getParcelId() { return mParcelId; }
+ void setSimName(const std::string& sim_name) { mSimName = sim_name; }
+
+ std::string getSimName() { return mSimName; }
+
+ void setFromSearch(bool val) { mFromSearch = val; }
+
+ bool fromSearch() { return mFromSearch; }
+
bool getInfoLoaded() { return mInfoLoaded; }
void setInfoLoaded(bool loaded) { mInfoLoaded = loaded; }
@@ -274,6 +283,14 @@ public:
S32 profile,
bool from_new_table);
+ static void sendClickMessage(
+ const std::string& type,
+ bool from_search,
+ const LLUUID& classified_id,
+ const LLUUID& parcel_id,
+ const LLVector3d& global_pos,
+ const std::string& sim_name);
+
void setExitCallback(const commit_callback_t& cb);
void setEditClassifiedCallback(const commit_callback_t& cb);
@@ -296,6 +313,7 @@ protected:
const LLVector3d& pos_global);
void stretchSnapshot();
+ void sendClickMessage(const std::string& type);
LLRect getDefaultSnapshotRect();
@@ -315,6 +333,8 @@ private:
LLUUID mClassifiedId;
LLVector3d mPosGlobal;
LLUUID mParcelId;
+ std::string mSimName;
+ bool mFromSearch;
bool mInfoLoaded;
LLScrollContainer* mScrollContainer;
@@ -337,6 +357,7 @@ private:
class LLPanelClassifiedEdit : public LLPanelClassifiedInfo
{
+ LOG_CLASS(LLPanelClassifiedEdit);
public:
static LLPanelClassifiedEdit* create();
diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp
index 2ff2597f08..f0860e7027 100644
--- a/indra/newview/llpanelpicks.cpp
+++ b/indra/newview/llpanelpicks.cpp
@@ -140,10 +140,11 @@ public:
params["open_tab_name"] = "panel_picks";
params["show_tab_panel"] = "classified_details";
params["classified_id"] = c_info->classified_id;
- params["classified_avatar_id"] = c_info->creator_id;
+ params["classified_creator_id"] = c_info->creator_id;
params["classified_snapshot_id"] = c_info->snapshot_id;
params["classified_name"] = c_info->name;
params["classified_desc"] = c_info->description;
+ params["from_search"] = true;
LLSideTray::getInstance()->showPanel("panel_profile_view", params);
}
@@ -174,31 +175,6 @@ LLClassifiedHandler gClassifiedHandler;
//////////////////////////////////////////////////////////////////////////
-/**
- * Copy&Pasted from old LLPanelClassified. This class does nothing at the moment.
- * Subscribing to "classifiedclickthrough" removes a few warnings.
- */
-class LLClassifiedClickThrough : public LLDispatchHandler
-{
-public:
-
- // "classifiedclickthrough"
- // strings[0] = classified_id
- // strings[1] = teleport_clicks
- // strings[2] = map_clicks
- // strings[3] = profile_clicks
- virtual bool operator()(
- const LLDispatcher* dispatcher,
- const std::string& key,
- const LLUUID& invoice,
- const sparam_t& strings)
- {
- if (strings.size() != 4)
- return false;
-
- return true;
- }
-};
//-----------------------------------------------------------------------------
// LLPanelPicks
@@ -217,12 +193,9 @@ LLPanelPicks::LLPanelPicks()
mClassifiedsAccTab(NULL),
mPanelClassifiedInfo(NULL),
mPanelClassifiedEdit(NULL),
- mClickThroughDisp(NULL),
mNoClassifieds(false),
mNoPicks(false)
{
- mClickThroughDisp = new LLClassifiedClickThrough();
- gGenericDispatcher.addHandler("classifiedclickthrough", mClickThroughDisp);
}
LLPanelPicks::~LLPanelPicks()
@@ -231,8 +204,6 @@ LLPanelPicks::~LLPanelPicks()
{
LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this);
}
-
- delete mClickThroughDisp;
}
void* LLPanelPicks::create(void* data /* = NULL */)
@@ -607,7 +578,11 @@ void LLPanelPicks::onClickTeleport()
if(pick_item)
pos = pick_item->getPosGlobal();
else if(c_item)
+ {
pos = c_item->getPosGlobal();
+ LLPanelClassifiedInfo::sendClickMessage("teleport", false,
+ c_item->getClassifiedId(), LLUUID::null, pos, LLStringUtil::null);
+ }
if (!pos.isExactlyZero())
{
@@ -626,7 +601,11 @@ void LLPanelPicks::onClickMap()
if (pick_item)
pos = pick_item->getPosGlobal();
else if(c_item)
+ {
+ LLPanelClassifiedInfo::sendClickMessage("map", false,
+ c_item->getClassifiedId(), LLUUID::null, pos, LLStringUtil::null);
pos = c_item->getPosGlobal();
+ }
LLFloaterWorldMap::getInstance()->trackLocation(pos);
LLFloaterReg::showInstance("world_map", "center");
@@ -756,26 +735,20 @@ void LLPanelPicks::openClassifiedInfo()
if (selected_value.isUndefined()) return;
LLClassifiedItem* c_item = getSelectedClassifiedItem();
+ LLSD params;
+ params["classified_id"] = c_item->getClassifiedId();
+ params["classified_creator_id"] = c_item->getAvatarId();
+ params["classified_snapshot_id"] = c_item->getSnapshotId();
+ params["classified_name"] = c_item->getClassifiedName();
+ params["classified_desc"] = c_item->getDescription();
+ params["from_search"] = false;
- openClassifiedInfo(c_item->getClassifiedId(), c_item->getAvatarId(),
- c_item->getSnapshotId(), c_item->getClassifiedName(),
- c_item->getDescription());
+ openClassifiedInfo(params);
}
-void LLPanelPicks::openClassifiedInfo(const LLUUID &classified_id,
- const LLUUID &avatar_id,
- const LLUUID &snapshot_id,
- const std::string &name, const std::string &desc)
+void LLPanelPicks::openClassifiedInfo(const LLSD &params)
{
createClassifiedInfoPanel();
-
- LLSD params;
- params["classified_id"] = classified_id;
- params["avatar_id"] = avatar_id;
- params["snapshot_id"] = snapshot_id;
- params["name"] = name;
- params["desc"] = desc;
-
getProfilePanel()->openPanel(mPanelClassifiedInfo, params);
}
diff --git a/indra/newview/llpanelpicks.h b/indra/newview/llpanelpicks.h
index 3f757e482e..11e811275b 100644
--- a/indra/newview/llpanelpicks.h
+++ b/indra/newview/llpanelpicks.h
@@ -55,7 +55,6 @@ class LLPanelPickEdit;
class LLToggleableMenu;
class LLPanelClassifiedInfo;
class LLPanelClassifiedEdit;
-class LLClassifiedClickThrough;
// *TODO
// Panel Picks has been consolidated with Classifieds (EXT-2095), give LLPanelPicks
@@ -120,9 +119,7 @@ private:
void openPickInfo();
void openClassifiedInfo();
- void openClassifiedInfo(const LLUUID &classified_id, const LLUUID &avatar_id,
- const LLUUID &snapshot_id, const std::string &name,
- const std::string &desc);
+ void openClassifiedInfo(const LLSD& params);
friend class LLPanelProfile;
void showAccordion(const std::string& name, bool show);
@@ -159,8 +156,6 @@ private:
LLAccordionCtrlTab* mPicksAccTab;
LLAccordionCtrlTab* mClassifiedsAccTab;
- LLClassifiedClickThrough* mClickThroughDisp;
-
//true if picks list is empty after processing picks
bool mNoPicks;
//true if classifieds list is empty after processing classifieds
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index b5d85dfd4b..18da8dd48c 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -171,15 +171,13 @@ void LLPanelProfile::onOpen(const LLSD& key)
}
else if (panel == "classified_details")
{
- LLUUID classified_id = key["classified_id"].asUUID();
- LLUUID avatar_id = key["classified_avatar_id"].asUUID();
- LLUUID snapshot_id = key["classified_snapshot_id"].asUUID();
- std::string name = key["classified_name"].asString();
- std::string desc = key["classified_desc"].asString();
LLPanelPicks* picks = dynamic_cast<LLPanelPicks *>(getTabContainer()[PANEL_PICKS]);
if (picks)
{
- picks->openClassifiedInfo(classified_id, avatar_id, snapshot_id, name, desc);
+ LLSD params = key;
+ params.erase("show_tab_panel");
+ params.erase("open_tab_name");
+ picks->openClassifiedInfo(params);
}
}
}
diff --git a/indra/newview/skins/default/xui/en/panel_classified_info.xml b/indra/newview/skins/default/xui/en/panel_classified_info.xml
index 1535ce2978..e71498f2f8 100644
--- a/indra/newview/skins/default/xui/en/panel_classified_info.xml
+++ b/indra/newview/skins/default/xui/en/panel_classified_info.xml
@@ -24,7 +24,7 @@
</panel.string>
<panel.string
name="click_through_text_fmt">
- [TELEPORT] teleport, [MAP] map, [MAP] profile
+ [TELEPORT] teleport, [MAP] map, [PROFILE] profile
</panel.string>
<panel.string
name="date_fmt">