summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Savchuk <vsavchuk@productengine.com>2010-03-05 19:03:00 +0200
committerVadim Savchuk <vsavchuk@productengine.com>2010-03-05 19:03:00 +0200
commiteeb6e89e60df4c61c299c6ac344e32c7d3040d04 (patch)
tree7189830b92ef16755fa3dcb25bb4a172f484b168
parent739dee86c9bd1d6853d4042aa88e6ffaeaf81229 (diff)
WIP on EXT-5687 (Classifieds are missing the clickthrough data).
Updating click stats on: * opening classified info * clicking "Map" or "Teleport" buttons in classified info * clicking "Details" in the web-based search floater --HG-- branch : product-engine
-rw-r--r--indra/newview/llpanelclassified.cpp76
-rw-r--r--indra/newview/llpanelclassified.h13
-rw-r--r--indra/newview/llpanelpicks.cpp27
-rw-r--r--indra/newview/llpanelpicks.h4
-rw-r--r--indra/newview/llpanelprofile.cpp10
5 files changed, 99 insertions, 31 deletions
diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp
index 6f0b7df935..49614348d0 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
@@ -1234,7 +1251,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;
@@ -1251,9 +1268,12 @@ void LLPanelClassifiedInfo::onOpen(const LLSD& key)
resetControls();
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());
@@ -1270,6 +1290,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);
}
@@ -1285,6 +1309,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]);
@@ -1316,7 +1342,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;
+
childSetValue("category", LLStringUtil::null);
childSetValue("content_type", LLStringUtil::null);
childSetText("click_through_text", LLStringUtil::null);
@@ -1433,8 +1471,14 @@ void LLPanelClassifiedInfo::setClickThrough(
ct_str.setArg("[TELEPORT]", llformat("%d", self->mTeleportClicksNew + self->mTeleportClicksOld));
ct_str.setArg("[MAP]", llformat("%d", self->mMapClicksNew + self->mMapClicksOld));
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;
}
}
@@ -1504,8 +1548,27 @@ void LLPanelClassifiedInfo::stretchSnapshot()
mSnapshotStreched = true;
}
+void LLPanelClassifiedInfo::sendClickMessage(const std::string& type)
+{
+ // 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"] = fromSearch();
+ body["classified_id"] = getClassifiedId();
+ body["parcel_id"] = getParcelId();
+ body["dest_pos_global"] = getPosGlobal().getValue();
+ body["region_name"] = getSimName();
+
+ 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::onMapClick()
{
+ sendClickMessage("map");
LLFloaterWorldMap::getInstance()->trackLocation(getPosGlobal());
LLFloaterReg::showInstance("world_map", "center");
}
@@ -1514,6 +1577,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 43b47d4e3e..04dea00e5f 100644
--- a/indra/newview/llpanelclassified.h
+++ b/indra/newview/llpanelclassified.h
@@ -204,6 +204,7 @@ private:
class LLPanelClassifiedInfo : public LLPanel, public LLAvatarPropertiesObserver
{
+ LOG_CLASS(LLPanelClassifiedInfo);
public:
static LLPanelClassifiedInfo* create();
@@ -246,6 +247,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; }
@@ -279,6 +288,7 @@ protected:
const LLVector3d& pos_global);
void stretchSnapshot();
+ void sendClickMessage(const std::string& type);
void onMapClick();
void onTeleportClick();
@@ -290,6 +300,8 @@ private:
LLUUID mClassifiedId;
LLVector3d mPosGlobal;
LLUUID mParcelId;
+ std::string mSimName;
+ bool mFromSearch;
bool mInfoLoaded;
bool mSnapshotStreched;
@@ -315,6 +327,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 f6fcb5a304..59642c6a67 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);
}
@@ -726,26 +727,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 b82f1f8d86..11e811275b 100644
--- a/indra/newview/llpanelpicks.h
+++ b/indra/newview/llpanelpicks.h
@@ -119,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);
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);
}
}
}