diff options
Diffstat (limited to 'linden/indra/newview/llpanelclassified.cpp')
-rw-r--r-- | linden/indra/newview/llpanelclassified.cpp | 62 |
1 files changed, 52 insertions, 10 deletions
diff --git a/linden/indra/newview/llpanelclassified.cpp b/linden/indra/newview/llpanelclassified.cpp index 04fb54b..c2f6593 100644 --- a/linden/indra/newview/llpanelclassified.cpp +++ b/linden/indra/newview/llpanelclassified.cpp | |||
@@ -48,6 +48,7 @@ | |||
48 | #include "llcheckboxctrl.h" | 48 | #include "llcheckboxctrl.h" |
49 | #include "llclassifiedflags.h" | 49 | #include "llclassifiedflags.h" |
50 | #include "llclassifiedstatsresponder.h" | 50 | #include "llclassifiedstatsresponder.h" |
51 | #include "llcommandhandler.h" // for classified HTML detail page click tracking | ||
51 | #include "llviewercontrol.h" | 52 | #include "llviewercontrol.h" |
52 | #include "lllineeditor.h" | 53 | #include "lllineeditor.h" |
53 | #include "llfloateravatarinfo.h" | 54 | #include "llfloateravatarinfo.h" |
@@ -58,6 +59,7 @@ | |||
58 | #include "llviewertexteditor.h" | 59 | #include "llviewertexteditor.h" |
59 | #include "lltexturectrl.h" | 60 | #include "lltexturectrl.h" |
60 | #include "lluiconstants.h" | 61 | #include "lluiconstants.h" |
62 | #include "llurldispatcher.h" // for classified HTML detail click teleports | ||
61 | #include "llvieweruictrlfactory.h" | 63 | #include "llvieweruictrlfactory.h" |
62 | #include "llviewerparcelmgr.h" | 64 | #include "llviewerparcelmgr.h" |
63 | #include "llviewerwindow.h" | 65 | #include "llviewerwindow.h" |
@@ -70,6 +72,9 @@ | |||
70 | 72 | ||
71 | const S32 MINIMUM_PRICE_FOR_LISTING = 50; // L$ | 73 | const S32 MINIMUM_PRICE_FOR_LISTING = 50; // L$ |
72 | 74 | ||
75 | //static | ||
76 | std::list<LLPanelClassified*> LLPanelClassified::sAllPanels; | ||
77 | |||
73 | // "classifiedclickthrough" | 78 | // "classifiedclickthrough" |
74 | // strings[0] = classified_id | 79 | // strings[0] = classified_id |
75 | // strings[1] = teleport_clicks | 80 | // strings[1] = teleport_clicks |
@@ -96,11 +101,45 @@ public: | |||
96 | return true; | 101 | return true; |
97 | } | 102 | } |
98 | }; | 103 | }; |
99 | |||
100 | static LLDispatchClassifiedClickThrough sClassifiedClickThrough; | 104 | static LLDispatchClassifiedClickThrough sClassifiedClickThrough; |
101 | 105 | ||
102 | //static | 106 | |
103 | std::list<LLPanelClassified*> LLPanelClassified::sAllPanels; | 107 | // We need to count classified teleport clicks from the search HTML detail pages, |
108 | // so we need have a teleport that also sends a click count message. | ||
109 | class LLClassifiedTeleportHandler : public LLCommandHandler | ||
110 | { | ||
111 | public: | ||
112 | // Inform the system you handle commands starting | ||
113 | // with "foo" | ||
114 | LLClassifiedTeleportHandler() : LLCommandHandler("classifiedteleport") { } | ||
115 | |||
116 | bool handle(const LLSD& tokens, const LLSD& queryMap) | ||
117 | { | ||
118 | // Need at least classified id and region name, so 2 params | ||
119 | if (tokens.size() < 2) return false; | ||
120 | LLUUID classified_id = tokens[0].asUUID(); | ||
121 | if (classified_id.isNull()) return false; | ||
122 | // *HACK: construct a SLURL to do the teleport | ||
123 | std::string url("secondlife:///app/teleport/"); | ||
124 | // skip the uuid we took off above, rebuild URL | ||
125 | // separated by slashes. | ||
126 | for (S32 i = 1; i < tokens.size(); ++i) | ||
127 | { | ||
128 | url += tokens[i].asString(); | ||
129 | url += "/"; | ||
130 | } | ||
131 | llinfos << "classified teleport to " << url << llendl; | ||
132 | // *TODO: separately track old search, sidebar, and new search | ||
133 | // Right now detail HTML pages count as new search. | ||
134 | const bool from_search = true; | ||
135 | LLPanelClassified::sendClassifiedClickMessage(classified_id, "teleport", from_search); | ||
136 | // Invoke teleport | ||
137 | return LLURLDispatcher::dispatch(url); | ||
138 | } | ||
139 | }; | ||
140 | // Creating the object registers with the dispatcher. | ||
141 | LLClassifiedTeleportHandler gClassifiedTeleportHandler; | ||
142 | |||
104 | 143 | ||
105 | LLPanelClassified::LLPanelClassified(BOOL in_finder, bool from_search) | 144 | LLPanelClassified::LLPanelClassified(BOOL in_finder, bool from_search) |
106 | : LLPanel("Classified Panel"), | 145 | : LLPanel("Classified Panel"), |
@@ -838,7 +877,7 @@ void LLPanelClassified::onClickTeleport(void* data) | |||
838 | gAgent.teleportViaLocation(self->mPosGlobal); | 877 | gAgent.teleportViaLocation(self->mPosGlobal); |
839 | gFloaterWorldMap->trackLocation(self->mPosGlobal); | 878 | gFloaterWorldMap->trackLocation(self->mPosGlobal); |
840 | 879 | ||
841 | self->sendClassifiedClickMessage("teleport"); | 880 | sendClassifiedClickMessage(self->mClassifiedID, "teleport", self->mFromSearch); |
842 | } | 881 | } |
843 | } | 882 | } |
844 | 883 | ||
@@ -850,7 +889,7 @@ void LLPanelClassified::onClickMap(void* data) | |||
850 | gFloaterWorldMap->trackLocation(self->mPosGlobal); | 889 | gFloaterWorldMap->trackLocation(self->mPosGlobal); |
851 | LLFloaterWorldMap::show(NULL, TRUE); | 890 | LLFloaterWorldMap::show(NULL, TRUE); |
852 | 891 | ||
853 | self->sendClassifiedClickMessage("map"); | 892 | sendClassifiedClickMessage(self->mClassifiedID, "map", self->mFromSearch); |
854 | } | 893 | } |
855 | 894 | ||
856 | // static | 895 | // static |
@@ -858,7 +897,7 @@ void LLPanelClassified::onClickProfile(void* data) | |||
858 | { | 897 | { |
859 | LLPanelClassified* self = (LLPanelClassified*)data; | 898 | LLPanelClassified* self = (LLPanelClassified*)data; |
860 | LLFloaterAvatarInfo::showFromDirectory(self->mCreatorID); | 899 | LLFloaterAvatarInfo::showFromDirectory(self->mCreatorID); |
861 | self->sendClassifiedClickMessage("profile"); | 900 | sendClassifiedClickMessage(self->mClassifiedID, "profile", self->mFromSearch); |
862 | } | 901 | } |
863 | 902 | ||
864 | // static | 903 | // static |
@@ -932,20 +971,23 @@ void LLPanelClassified::onFocusReceived(LLUICtrl* ctrl, void* data) | |||
932 | } | 971 | } |
933 | 972 | ||
934 | 973 | ||
935 | void LLPanelClassified::sendClassifiedClickMessage(const char* type) | 974 | // static |
975 | void LLPanelClassified::sendClassifiedClickMessage(const LLUUID& classified_id, | ||
976 | const char* type, | ||
977 | bool from_search) | ||
936 | { | 978 | { |
937 | // You're allowed to click on your own ads to reassure yourself | 979 | // You're allowed to click on your own ads to reassure yourself |
938 | // that the system is working. | 980 | // that the system is working. |
939 | std::vector<std::string> strings; | 981 | std::vector<std::string> strings; |
940 | strings.push_back(mClassifiedID.asString()); | 982 | strings.push_back(classified_id.asString()); |
941 | strings.push_back(type); | 983 | strings.push_back(type); |
942 | LLUUID no_invoice; | 984 | LLUUID no_invoice; |
943 | 985 | ||
944 | // New classified click-through handling | 986 | // New classified click-through handling |
945 | LLSD body; | 987 | LLSD body; |
946 | body["type"] = type; | 988 | body["type"] = type; |
947 | body["from_search"] = mFromSearch; | 989 | body["from_search"] = from_search; |
948 | body["classified_id"] = mClassifiedID; | 990 | body["classified_id"] = classified_id; |
949 | std::string url = gAgent.getRegion()->getCapability("SearchStatTracking"); | 991 | std::string url = gAgent.getRegion()->getCapability("SearchStatTracking"); |
950 | 992 | ||
951 | // If the capability exists send to the new database, otherwise send to the old one. | 993 | // If the capability exists send to the new database, otherwise send to the old one. |