WIP on EXT-5687 (Classifieds are missing the clickthrough data).

Added clicks info and creation date.

--HG--
branch : product-engine
master
Vadim Savchuk 2010-03-03 20:10:27 +02:00
parent 8516ed1dac
commit dfe98202c0
3 changed files with 110 additions and 4 deletions

View File

@ -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
}
//////////////////////////////////////////////////////////////////////////

View File

@ -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);

View File

@ -21,6 +21,14 @@
<panel.string
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"
@ -170,6 +178,33 @@
top_pad="-10"
v_pad="0"
value="[category]" />
<text
follows="left|top"
font.style="BOLD"
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"
@ -207,6 +242,44 @@
top_pad="0"
width="290"
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"