diff options
author | Vadim Savchuk <vsavchuk@productengine.com> | 2010-03-03 20:10:27 +0200 |
---|---|---|
committer | Vadim Savchuk <vsavchuk@productengine.com> | 2010-03-03 20:10:27 +0200 |
commit | dfe98202c031cd70f469d10f4a34aabc9a366375 (patch) | |
tree | 2f74800207f6149c00585afc0aadd401b8afd1b7 | |
parent | 8516ed1dac36c55863062488bac558cd8faec2f2 (diff) |
WIP on EXT-5687 (Classifieds are missing the clickthrough data).
Added clicks info and creation date.
--HG--
branch : product-engine
-rw-r--r-- | indra/newview/llpanelclassified.cpp | 35 | ||||
-rw-r--r-- | indra/newview/llpanelclassified.h | 6 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_classified_info.xml | 73 |
3 files changed, 110 insertions, 4 deletions
diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index afdc27e74e..a6b72c0510 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -74,6 +74,7 @@ #include "lltrans.h" #include "llscrollcontainer.h" #include "llstatusbar.h" +#include "llsidetray.h" const S32 MINIMUM_PRICE_FOR_LISTING = 50; // L$ const S32 MATURE_UNDEFINED = -1; @@ -103,10 +104,13 @@ public: S32 teleport_clicks = atoi(strings[1].c_str()); S32 map_clicks = atoi(strings[2].c_str()); S32 profile_clicks = atoi(strings[3].c_str()); - LLPanelClassified::setClickThrough(classified_id, teleport_clicks, - map_clicks, - profile_clicks, - false); + + static LLPanelClassifiedInfo* info_panel = + dynamic_cast<LLPanelClassifiedInfo*>(LLSideTray::getInstance()->getPanel("panel_classified_info")); + + if (info_panel) + info_panel->setClickThrough(classified_id, teleport_clicks, map_clicks, profile_clicks); + return true; } }; @@ -1247,6 +1251,7 @@ void LLPanelClassifiedInfo::onOpen(const LLSD& key) LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this); LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(getClassifiedId()); + gGenericDispatcher.addHandler("classifiedclickthrough", &sClassifiedClickThrough); setInfoLoaded(false); } @@ -1268,6 +1273,7 @@ void LLPanelClassifiedInfo::processProperties(void* data, EAvatarProcessorType t static std::string mature_str = getString("type_mature"); static std::string pg_str = getString("type_pg"); static LLUIString price_str = getString("l$_price"); + static std::string date_fmt = getString("date_fmt"); bool mature = is_cf_mature(c_info->flags); childSetValue("content_type", mature ? mature_str : pg_str); @@ -1276,6 +1282,10 @@ void LLPanelClassifiedInfo::processProperties(void* data, EAvatarProcessorType t price_str.setArg("[PRICE]", llformat("%d", c_info->price_for_listing)); childSetValue("price_for_listing", LLSD(price_str)); + std::string date_str = date_fmt; + LLStringUtil::format(date_str, LLSD().with("datetime", (S32) c_info->creation_date)); + childSetText("creation_date", date_str); + setInfoLoaded(true); } } @@ -1300,6 +1310,7 @@ void LLPanelClassifiedInfo::resetControls() childSetEnabled("edit_btn", is_self); childSetVisible("edit_btn", is_self); childSetVisible("price_layout_panel", is_self); + childSetVisible("clickthrough_layout_panel", is_self); } void LLPanelClassifiedInfo::setClassifiedName(const std::string& name) @@ -1352,6 +1363,21 @@ LLUUID LLPanelClassifiedInfo::getSnapshotId() return childGetValue("classified_snapshot").asUUID(); } +void LLPanelClassifiedInfo::setClickThrough( + const LLUUID& classified_id, + S32 teleport, + S32 map, + S32 profile) +{ + static LLUIString ct_str = getString("click_through_text_fmt"); + + ct_str.setArg("[TELEPORT]", llformat("%d", teleport)); + ct_str.setArg("[MAP]", llformat("%d", map)); + ct_str.setArg("[PROFILE]", llformat("%d", profile)); + + childSetText("click_through_text", ct_str.getString()); +} + // static std::string LLPanelClassifiedInfo::createLocationText( const std::string& original_name, @@ -1436,6 +1462,7 @@ void LLPanelClassifiedInfo::onTeleportClick() void LLPanelClassifiedInfo::onExit() { LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(), this); + gGenericDispatcher.addHandler("classifiedclickthrough", NULL); // deregister our handler } ////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llpanelclassified.h b/indra/newview/llpanelclassified.h index 1942eb5365..0922150b74 100644 --- a/indra/newview/llpanelclassified.h +++ b/indra/newview/llpanelclassified.h @@ -250,6 +250,12 @@ public: void setInfoLoaded(bool loaded) { mInfoLoaded = loaded; } + void setClickThrough( + const LLUUID& classified_id, + S32 teleport, + S32 map, + S32 profile); + void setExitCallback(const commit_callback_t& cb); void setEditClassifiedCallback(const commit_callback_t& cb); 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 e374ee5f71..869a05f27d 100644 --- a/indra/newview/skins/default/xui/en/panel_classified_info.xml +++ b/indra/newview/skins/default/xui/en/panel_classified_info.xml @@ -22,6 +22,14 @@ name="l$_price"> L$[PRICE] </panel.string> +<panel.string + name="click_through_text_fmt"> + [TELEPORT] teleport, [MAP] map, [MAP] profile + </panel.string> + <panel.string + name="date_fmt"> + [mthnum,datetime,slt]/[day,datetime,slt]/[year,datetime,slt] + </panel.string> <button follows="top|right" height="23" @@ -176,6 +184,33 @@ height="10" layout="topleft" left="10" + name="creation_date_label" + text_color="white" + top_pad="0" + value="Creation date:" + width="140" /> + <text_editor + allow_scroll="false" + bg_visible="false" + follows="left|top" + h_pad="0" + halign="left" + height="16" + layout="topleft" + left_pad="0" + name="creation_date" + read_only="true" + top_pad="-10" + tool_tip="Creation date" + v_pad="0" + value="[date]" + width="150" /> + <text + follows="left|top" + font.style="BOLD" + height="10" + layout="topleft" + left="10" name="price_for_listing_label" text_color="white" top_pad="0" @@ -209,6 +244,44 @@ height="250"> <layout_panel auto_resize="false" + name="clickthrough_layout_panel" + layout="topleft" + follows="top|left" + left="0" + top="0" + width="290" + height="26" + user_resize="false"> + <text + follows="left|top" + font.style="BOLD" + height="10" + layout="topleft" + left="0" + name="click_through_label" + text_color="white" + top_pad="0" + value="Clicks:" + width="140" /> + <text_editor + allow_scroll="false" + bg_visible="false" + follows="left|top" + h_pad="0" + halign="left" + height="16" + layout="topleft" + left_pad="0" + name="click_through_text" + read_only="true" + top_pad="-10" + tool_tip="Click through data" + v_pad="0" + value="[clicks]" + width="150" /> + </layout_panel> + <layout_panel + auto_resize="false" name="price_layout_panel" layout="topleft" follows="top|left" |