From bbe2daad55777974f10f98b8a8023c7e25fbd6d2 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Tue, 2 Mar 2010 11:34:14 +0200 Subject: Fixed normal bug EXT-5856 - "Auto renew each week" checkbox is displayed in the Classified Info from other resident profile. Hide auro_renew checkbox for avatar classifieds and showing for agent classifirds. --HG-- branch : product-engine --- indra/newview/llpanelclassified.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llpanelclassified.cpp') diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index b4c13da91e..f891a9fba2 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -1292,11 +1292,13 @@ void LLPanelClassifiedInfo::resetControls() { childSetEnabled("edit_btn", TRUE); childSetVisible("edit_btn", TRUE); + childSetVisible("auto_renew", TRUE); } else { childSetEnabled("edit_btn", FALSE); childSetVisible("edit_btn", FALSE); + childSetVisible("auto_renew", FALSE); } } -- cgit v1.2.3 From bc5be41bc0266a5d74f7ac6cab608e3cc7d95913 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Tue, 2 Mar 2010 09:47:25 +0000 Subject: CID-440 Checker: UNINIT_CTOR Function: LLPanelClassifiedInfo::LLPanelClassifiedInfo() File: /indra/newview/llpanelclassified.cpp --- indra/newview/llpanelclassified.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llpanelclassified.cpp') diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index b4c13da91e..3e374acdb3 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -1155,6 +1155,8 @@ LLPanelClassifiedInfo::LLPanelClassifiedInfo() , mInfoLoaded(false) , mScrollingPanel(NULL) , mScrollContainer(NULL) + , mScrollingPanelMinHeight(0) + , mScrollingPanelWidth(0) { } -- cgit v1.2.3 From 9676448291e3faa7bbe476549b79a083945eaa7b Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Wed, 3 Mar 2010 10:32:26 +0200 Subject: Shortened code. --HG-- branch : product-engine --- indra/newview/llpanelclassified.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'indra/newview/llpanelclassified.cpp') diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index 836331b44b..68691a1408 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -1290,18 +1290,11 @@ void LLPanelClassifiedInfo::resetData() void LLPanelClassifiedInfo::resetControls() { - if(getAvatarId() == gAgent.getID()) - { - childSetEnabled("edit_btn", TRUE); - childSetVisible("edit_btn", TRUE); - childSetVisible("auto_renew", TRUE); - } - else - { - childSetEnabled("edit_btn", FALSE); - childSetVisible("edit_btn", FALSE); - childSetVisible("auto_renew", FALSE); - } + bool is_self = getAvatarId() == gAgent.getID(); + + childSetEnabled("edit_btn", is_self); + childSetVisible("edit_btn", is_self); + childSetVisible("auto_renew", is_self); } void LLPanelClassifiedInfo::setClassifiedName(const std::string& name) -- cgit v1.2.3 From 4f0a34ae7e79af29e50035e1536ae6b1d1928daf Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Wed, 3 Mar 2010 12:44:07 +0200 Subject: Update for normal bug EXT-5856 - "Auto renew each week" checkbox is displayed in the Classified Info from other resident profile. Added layout stack to auto reposition description when auto_renew is being shown or hidden. --HG-- branch : product-engine --- indra/newview/llpanelclassified.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelclassified.cpp') diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index 68691a1408..7cf27d9141 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -1294,7 +1294,7 @@ void LLPanelClassifiedInfo::resetControls() childSetEnabled("edit_btn", is_self); childSetVisible("edit_btn", is_self); - childSetVisible("auto_renew", is_self); + childSetVisible("price_layout_panel", is_self); } void LLPanelClassifiedInfo::setClassifiedName(const std::string& name) -- cgit v1.2.3 From 7b5ef7053f0e00282faa47138497b6937756faeb Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Wed, 3 Mar 2010 16:22:51 +0200 Subject: Implemented major sub task EXT-5858 - Assigned picture is stretched in the Classified Info panel. Reshape snapshot control to max possible size maintaining aspect ratio. --HG-- branch : product-engine --- indra/newview/llpanelclassified.cpp | 55 +++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'indra/newview/llpanelclassified.cpp') diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index 7cf27d9141..24cdcadb7c 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -1157,6 +1157,7 @@ LLPanelClassifiedInfo::LLPanelClassifiedInfo() , mScrollContainer(NULL) , mScrollingPanelMinHeight(0) , mScrollingPanelWidth(0) + , mSnapshotStreched(false) { } @@ -1184,6 +1185,8 @@ BOOL LLPanelClassifiedInfo::postBuild() mScrollingPanelMinHeight = mScrollContainer->getScrolledViewRect().getHeight(); mScrollingPanelWidth = mScrollingPanel->getRect().getWidth(); + mSnapshotRect = getChild("classified_snapshot")->getRect(); + return TRUE; } @@ -1215,6 +1218,8 @@ void LLPanelClassifiedInfo::reshape(S32 width, S32 height, BOOL called_from_pare { mScrollingPanel->reshape(mScrollingPanelWidth + scrollbar_size, scroll_height); } + + mSnapshotRect = getChild("classified_snapshot")->getRect(); } void LLPanelClassifiedInfo::onOpen(const LLSD& key) @@ -1325,6 +1330,21 @@ void LLPanelClassifiedInfo::setClassifiedLocation(const std::string& location) void LLPanelClassifiedInfo::setSnapshotId(const LLUUID& id) { childSetValue("classified_snapshot", id); + if(!mSnapshotStreched) + { + LLUICtrl* snapshot = getChild("classified_snapshot"); + snapshot->setRect(mSnapshotRect); + } + mSnapshotStreched = false; +} + +void LLPanelClassifiedInfo::draw() +{ + LLPanel::draw(); + + // Stretch in draw because it takes some time to load a texture, + // going to try to stretch snapshot until texture is loaded + stretchSnapshot(); } LLUUID LLPanelClassifiedInfo::getSnapshotId() @@ -1363,6 +1383,41 @@ std::string LLPanelClassifiedInfo::createLocationText( return location_text; } +void LLPanelClassifiedInfo::stretchSnapshot() +{ + // *NOTE dzaporozhan + // Could be moved to LLTextureCtrl + + LLTextureCtrl* texture_ctrl = getChild("classified_snapshot"); + LLViewerFetchedTexture* texture = texture_ctrl->getTexture(); + + if(!texture || mSnapshotStreched) + { + return; + } + + if(0 == texture->getOriginalWidth() || 0 == texture->getOriginalHeight()) + { + // looks like texture is not loaded yet + llinfos << "Missing image size" << llendl; + return; + } + + LLRect rc = mSnapshotRect; + F32 t_width = texture->getFullWidth(); + F32 t_height = texture->getFullHeight(); + + F32 ratio = llmin( (rc.getWidth() / t_width), (rc.getHeight() / t_height) ); + + t_width *= ratio; + t_height *= ratio; + + rc.setCenterAndSize(rc.getCenterX(), rc.getCenterY(), t_width, t_height); + texture_ctrl->setRect(rc); + + mSnapshotStreched = true; +} + void LLPanelClassifiedInfo::onMapClick() { LLFloaterWorldMap::getInstance()->trackLocation(getPosGlobal()); -- cgit v1.2.3 From ec0d5d93dbde7f43c62365c0c02c1fd70456f417 Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Wed, 3 Mar 2010 17:38:32 +0200 Subject: Fixed Linux build. --HG-- branch : product-engine --- indra/newview/llpanelclassified.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelclassified.cpp') diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index 24cdcadb7c..afdc27e74e 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -1412,7 +1412,7 @@ void LLPanelClassifiedInfo::stretchSnapshot() t_width *= ratio; t_height *= ratio; - rc.setCenterAndSize(rc.getCenterX(), rc.getCenterY(), t_width, t_height); + rc.setCenterAndSize(rc.getCenterX(), rc.getCenterY(), llfloor(t_width), llfloor(t_height)); texture_ctrl->setRect(rc); mSnapshotStreched = true; -- cgit v1.2.3 From dfe98202c031cd70f469d10f4a34aabc9a366375 Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Wed, 3 Mar 2010 20:10:27 +0200 Subject: WIP on EXT-5687 (Classifieds are missing the clickthrough data). Added clicks info and creation date. --HG-- branch : product-engine --- indra/newview/llpanelclassified.cpp | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelclassified.cpp') 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(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 } ////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From eabcd8e1b7a46cdaf005839aa1f524f25f3ddea0 Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Wed, 3 Mar 2010 22:07:39 +0200 Subject: Fixed bug EXT-5687 (Classifieds are missing the clickthrough data). We now take into account stats received from the so-called "new table" (for regions supporting "SearchStatRequest" capability). --HG-- branch : product-engine --- indra/newview/llpanelclassified.cpp | 86 +++++++++++++++++++++++++++++++------ 1 file changed, 73 insertions(+), 13 deletions(-) (limited to 'indra/newview/llpanelclassified.cpp') diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index a6b72c0510..6f0b7df935 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -41,6 +41,7 @@ #include "lldir.h" #include "lldispatcher.h" #include "llfloaterreg.h" +#include "llhttpclient.h" #include "llnotifications.h" #include "llnotificationsutil.h" #include "llparcel.h" @@ -74,7 +75,6 @@ #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; @@ -84,6 +84,7 @@ const S32 DECLINE_TO_STATE = 0; //static std::list LLPanelClassified::sAllPanels; +std::list LLPanelClassifiedInfo::sAllPanels; // "classifiedclickthrough" // strings[0] = classified_id @@ -105,11 +106,8 @@ public: S32 map_clicks = atoi(strings[2].c_str()); S32 profile_clicks = atoi(strings[3].c_str()); - static LLPanelClassifiedInfo* info_panel = - dynamic_cast(LLSideTray::getInstance()->getPanel("panel_classified_info")); - - if (info_panel) - info_panel->setClickThrough(classified_id, teleport_clicks, map_clicks, profile_clicks); + LLPanelClassifiedInfo::setClickThrough( + classified_id, teleport_clicks, map_clicks, profile_clicks, false); return true; } @@ -501,7 +499,7 @@ void LLPanelClassified::sendClassifiedInfoRequest() if (!url.empty()) { llinfos << "Classified stat request via capability" << llendl; - LLHTTPClient::post(url, body, new LLClassifiedStatsResponder(((LLView*)this)->getHandle(), mClassifiedID)); + LLHTTPClient::post(url, body, new LLClassifiedStatsResponder(mClassifiedID)); } } } @@ -1162,11 +1160,19 @@ LLPanelClassifiedInfo::LLPanelClassifiedInfo() , mScrollingPanelMinHeight(0) , mScrollingPanelWidth(0) , mSnapshotStreched(false) + , mTeleportClicksOld(0) + , mMapClicksOld(0) + , mProfileClicksOld(0) + , mTeleportClicksNew(0) + , mMapClicksNew(0) + , mProfileClicksNew(0) { + sAllPanels.push_back(this); } LLPanelClassifiedInfo::~LLPanelClassifiedInfo() { + sAllPanels.remove(this); } // static @@ -1252,6 +1258,18 @@ void LLPanelClassifiedInfo::onOpen(const LLSD& key) LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this); LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(getClassifiedId()); gGenericDispatcher.addHandler("classifiedclickthrough", &sClassifiedClickThrough); + + // While we're at it let's get the stats from the new table if that + // capability exists. + std::string url = gAgent.getRegion()->getCapability("SearchStatRequest"); + if (!url.empty()) + { + llinfos << "Classified stat request via capability" << llendl; + LLSD body; + body["classified_id"] = getClassifiedId(); + LLHTTPClient::post(url, body, new LLClassifiedStatsResponder(getClassifiedId())); + } + setInfoLoaded(false); } @@ -1301,6 +1319,7 @@ void LLPanelClassifiedInfo::resetData() mPosGlobal.clearVec(); childSetValue("category", LLStringUtil::null); childSetValue("content_type", LLStringUtil::null); + childSetText("click_through_text", LLStringUtil::null); } void LLPanelClassifiedInfo::resetControls() @@ -1363,19 +1382,60 @@ LLUUID LLPanelClassifiedInfo::getSnapshotId() return childGetValue("classified_snapshot").asUUID(); } +// static void LLPanelClassifiedInfo::setClickThrough( const LLUUID& classified_id, S32 teleport, S32 map, - S32 profile) + S32 profile, + bool from_new_table) { - static LLUIString ct_str = getString("click_through_text_fmt"); + llinfos << "Click-through data for classified " << classified_id << " arrived: [" + << teleport << ", " << map << ", " << profile << "] (" + << (from_new_table ? "new" : "old") << ")" << llendl; - ct_str.setArg("[TELEPORT]", llformat("%d", teleport)); - ct_str.setArg("[MAP]", llformat("%d", map)); - ct_str.setArg("[PROFILE]", llformat("%d", profile)); + for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) + { + LLPanelClassifiedInfo* self = *iter; + if (self->getClassifiedId() != classified_id) + { + continue; + } - childSetText("click_through_text", ct_str.getString()); + // *HACK: Skip LLPanelClassifiedEdit instances: they don't display clicks data. + // Those instances should not be in the list at all. + if (typeid(*self) != typeid(LLPanelClassifiedInfo)) + { + continue; + } + + llinfos << "Updating classified info panel" << llendl; + + // We need to check to see if the data came from the new stat_table + // or the old classified table. We also need to cache the data from + // the two separate sources so as to display the aggregate totals. + + if (from_new_table) + { + self->mTeleportClicksNew = teleport; + self->mMapClicksNew = map; + self->mProfileClicksNew = profile; + } + else + { + self->mTeleportClicksOld = teleport; + self->mMapClicksOld = map; + self->mProfileClicksOld = profile; + } + + static LLUIString ct_str = self->getString("click_through_text_fmt"); + + 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()); + } } // static -- cgit v1.2.3 From 5301d4189fde3332237b52ce26ab08f5c7fb0baa Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Thu, 4 Mar 2010 12:18:24 +0200 Subject: Updated major sub task EXT-5858 - Assigned picture is stretched in the Classified Info panel. Fixed reshape issues. Added stretching to edit classified panel. --HG-- branch : product-engine --- indra/newview/llpanelclassified.cpp | 64 +++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 14 deletions(-) (limited to 'indra/newview/llpanelclassified.cpp') diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index 6f0b7df935..ee722a048b 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -1166,6 +1166,7 @@ LLPanelClassifiedInfo::LLPanelClassifiedInfo() , mTeleportClicksNew(0) , mMapClicksNew(0) , mProfileClicksNew(0) + , mSnapshotCtrl(NULL) { sAllPanels.push_back(this); } @@ -1195,7 +1196,8 @@ BOOL LLPanelClassifiedInfo::postBuild() mScrollingPanelMinHeight = mScrollContainer->getScrolledViewRect().getHeight(); mScrollingPanelWidth = mScrollingPanel->getRect().getWidth(); - mSnapshotRect = getChild("classified_snapshot")->getRect(); + mSnapshotCtrl = getChild("classified_snapshot"); + mSnapshotRect = getDefaultSnapshotRect(); return TRUE; } @@ -1229,7 +1231,8 @@ void LLPanelClassifiedInfo::reshape(S32 width, S32 height, BOOL called_from_pare mScrollingPanel->reshape(mScrollingPanelWidth + scrollbar_size, scroll_height); } - mSnapshotRect = getChild("classified_snapshot")->getRect(); + mSnapshotRect = getDefaultSnapshotRect(); + stretchSnapshot(); } void LLPanelClassifiedInfo::onOpen(const LLSD& key) @@ -1359,12 +1362,7 @@ void LLPanelClassifiedInfo::setClassifiedLocation(const std::string& location) void LLPanelClassifiedInfo::setSnapshotId(const LLUUID& id) { - childSetValue("classified_snapshot", id); - if(!mSnapshotStreched) - { - LLUICtrl* snapshot = getChild("classified_snapshot"); - snapshot->setRect(mSnapshotRect); - } + mSnapshotCtrl->setValue(id); mSnapshotStreched = false; } @@ -1374,7 +1372,10 @@ void LLPanelClassifiedInfo::draw() // Stretch in draw because it takes some time to load a texture, // going to try to stretch snapshot until texture is loaded - stretchSnapshot(); + if(!mSnapshotStreched) + { + stretchSnapshot(); + } } LLUUID LLPanelClassifiedInfo::getSnapshotId() @@ -1474,10 +1475,9 @@ void LLPanelClassifiedInfo::stretchSnapshot() // *NOTE dzaporozhan // Could be moved to LLTextureCtrl - LLTextureCtrl* texture_ctrl = getChild("classified_snapshot"); - LLViewerFetchedTexture* texture = texture_ctrl->getTexture(); + LLViewerFetchedTexture* texture = mSnapshotCtrl->getTexture(); - if(!texture || mSnapshotStreched) + if(!texture) { return; } @@ -1485,11 +1485,16 @@ void LLPanelClassifiedInfo::stretchSnapshot() if(0 == texture->getOriginalWidth() || 0 == texture->getOriginalHeight()) { // looks like texture is not loaded yet - llinfos << "Missing image size" << llendl; return; } LLRect rc = mSnapshotRect; + // *HACK dzaporozhan + // LLTextureCtrl uses BTN_HEIGHT_SMALL as bottom for texture which causes + // drawn texture to be smaller than expected. (see LLTextureCtrl::draw()) + // Lets increase texture height to force texture look as expected. + rc.mBottom -= BTN_HEIGHT_SMALL; + F32 t_width = texture->getFullWidth(); F32 t_height = texture->getFullHeight(); @@ -1499,11 +1504,19 @@ void LLPanelClassifiedInfo::stretchSnapshot() t_height *= ratio; rc.setCenterAndSize(rc.getCenterX(), rc.getCenterY(), llfloor(t_width), llfloor(t_height)); - texture_ctrl->setRect(rc); + mSnapshotCtrl->setShape(rc); mSnapshotStreched = true; } +LLRect LLPanelClassifiedInfo::getDefaultSnapshotRect() +{ + // Using scroll container makes getting default rect a hard task + // because rect in postBuild() and in first reshape() is not the same. + // Using snapshot_panel makes it easier to reshape snapshot. + return getChild("snapshot_panel")->getLocalRect(); +} + void LLPanelClassifiedInfo::onMapClick() { LLFloaterWorldMap::getInstance()->trackLocation(getPosGlobal()); @@ -1587,6 +1600,8 @@ BOOL LLPanelClassifiedEdit::postBuild() childSetAction("save_changes_btn", boost::bind(&LLPanelClassifiedEdit::onSaveClick, this)); childSetAction("set_to_curr_location_btn", boost::bind(&LLPanelClassifiedEdit::onSetLocationClick, this)); + mSnapshotCtrl->setOnSelectCallback(boost::bind(&LLPanelClassifiedEdit::onTextureSelected, this)); + return TRUE; } @@ -1734,6 +1749,22 @@ bool LLPanelClassifiedEdit::canClose() return mCanClose; } +void LLPanelClassifiedEdit::draw() +{ + LLPanel::draw(); + + // Need to re-stretch on every draw because LLTextureCtrl::onSelectCallback + // does not trigger callbacks when user navigates through images. + stretchSnapshot(); +} + +void LLPanelClassifiedEdit::stretchSnapshot() +{ + LLPanelClassifiedInfo::stretchSnapshot(); + + getChild("edit_icon")->setShape(mSnapshotCtrl->getRect()); +} + void LLPanelClassifiedEdit::sendUpdate() { LLAvatarClassifiedInfo c_data; @@ -1913,4 +1944,9 @@ void LLPanelClassifiedEdit::onTexturePickerMouseLeave(LLUICtrl* ctrl) ctrl->setVisible(FALSE); } +void LLPanelClassifiedEdit::onTextureSelected() +{ + setSnapshotId(mSnapshotCtrl->getValue().asUUID()); +} + //EOF -- cgit v1.2.3 From 997e91f08e9b6afd5bb3335da235e6ea9e9c0761 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Thu, 4 Mar 2010 16:05:04 +0200 Subject: Fixed major bug EXT-5943 - Classifieds are Published and charged as soon as you hit Save. Added Publish Classified floater to confirm classified creashion and publishing. --HG-- branch : product-engine --- indra/newview/llpanelclassified.cpp | 94 +++++++++++++++++++++++++++++++++++-- 1 file changed, 91 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpanelclassified.cpp') diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index ee722a048b..0bbd850eda 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -1549,6 +1549,7 @@ LLPanelClassifiedEdit::LLPanelClassifiedEdit() : LLPanelClassifiedInfo() , mIsNew(false) , mCanClose(false) + , mPublishFloater(NULL) { } @@ -1656,6 +1657,9 @@ void LLPanelClassifiedEdit::onOpen(const LLSD& key) enableEditing(false); } + std::string save_btn_label = isNew() ? getString("publish_label") : getString("save_label"); + childSetLabelArg("save_changes_btn", "[LABEL]", save_btn_label); + resetDirty(); setInfoLoaded(false); } @@ -1724,12 +1728,12 @@ void LLPanelClassifiedEdit::resetDirty() getChild("price_for_listing")->resetDirty(); } -void LLPanelClassifiedEdit::setSaveCallback(const commit_callback_t& cb) +void LLPanelClassifiedEdit::setSaveCallback(const commit_signal_t::slot_type& cb) { - getChild("save_changes_btn")->setClickedCallback(cb); + mSaveButtonClickedSignal.connect(cb); } -void LLPanelClassifiedEdit::setCancelCallback(const commit_callback_t& cb) +void LLPanelClassifiedEdit::setCancelCallback(const commit_signal_t::slot_type& cb) { getChild("cancel_btn")->setClickedCallback(cb); } @@ -1852,6 +1856,11 @@ S32 LLPanelClassifiedEdit::getPriceForListing() return childGetValue("price_for_listing").asInteger(); } +void LLPanelClassifiedEdit::setPriceForListing(S32 price) +{ + childSetValue("price_for_listing", price); +} + void LLPanelClassifiedEdit::onSetLocationClick() { setPosGlobal(gAgent.getPositionGlobal()); @@ -1895,9 +1904,45 @@ void LLPanelClassifiedEdit::onSaveClick() } } + if(isNew()) + { + mPublishFloater = LLFloaterReg::findTypedInstance( + "publish_classified", LLSD()); + + if(!mPublishFloater) + { + mPublishFloater = LLFloaterReg::getTypedInstance( + "publish_classified", LLSD()); + + mPublishFloater->setPublishClickedCallback(boost::bind + (&LLPanelClassifiedEdit::onPublishFloaterPublishClicked, this)); + } + + // set spinner value before it has focus or value wont be set + mPublishFloater->setPrice(getPriceForListing()); + mPublishFloater->openFloater(mPublishFloater->getKey()); + mPublishFloater->center(); + } + else + { + doSave(); + } +} + +void LLPanelClassifiedEdit::doSave() +{ mCanClose = true; sendUpdate(); resetDirty(); + + mSaveButtonClickedSignal(this, LLSD()); +} + +void LLPanelClassifiedEdit::onPublishFloaterPublishClicked() +{ + setPriceForListing(mPublishFloater->getPrice()); + + doSave(); } std::string LLPanelClassifiedEdit::getLocationNotice() @@ -1949,4 +1994,47 @@ void LLPanelClassifiedEdit::onTextureSelected() setSnapshotId(mSnapshotCtrl->getValue().asUUID()); } +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// + +LLPublishClassifiedFloater::LLPublishClassifiedFloater(const LLSD& key) + : LLFloater(key) +{ +} + +LLPublishClassifiedFloater::~LLPublishClassifiedFloater() +{ +} + +BOOL LLPublishClassifiedFloater::postBuild() +{ + LLFloater::postBuild(); + + childSetAction("publish_btn", boost::bind(&LLFloater::closeFloater, this, false)); + childSetAction("cancel_btn", boost::bind(&LLFloater::closeFloater, this, false)); + + return TRUE; +} + +void LLPublishClassifiedFloater::setPrice(S32 price) +{ + childSetValue("price_for_listing", price); +} + +S32 LLPublishClassifiedFloater::getPrice() +{ + return childGetValue("price_for_listing").asInteger(); +} + +void LLPublishClassifiedFloater::setPublishClickedCallback(const commit_signal_t::slot_type& cb) +{ + getChild("publish_btn")->setClickedCallback(cb); +} + +void LLPublishClassifiedFloater::setCancelClickedCallback(const commit_signal_t::slot_type& cb) +{ + getChild("cancel_btn")->setClickedCallback(cb); +} + //EOF -- cgit v1.2.3 From a9b829f371183de408745d27c3fbabf9d4624ea2 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Thu, 4 Mar 2010 16:55:00 +0200 Subject: Fixed low bug EXT-5998 - Classified is scrolled if previos classified was scrolled. --HG-- branch : product-engine --- indra/newview/llpanelclassified.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/newview/llpanelclassified.cpp') diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index 0bbd850eda..d59a7d752e 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -1252,6 +1252,7 @@ void LLPanelClassifiedInfo::onOpen(const LLSD& key) resetData(); resetControls(); + scrollToTop(); setClassifiedId(key["classified_id"]); setClassifiedName(key["name"]); @@ -1517,6 +1518,13 @@ LLRect LLPanelClassifiedInfo::getDefaultSnapshotRect() return getChild("snapshot_panel")->getLocalRect(); } +void LLPanelClassifiedInfo::scrollToTop() +{ + LLScrollContainer* scrollContainer = findChild("profile_scroll"); + if (scrollContainer) + scrollContainer->goToTop(); +} + void LLPanelClassifiedInfo::onMapClick() { LLFloaterWorldMap::getInstance()->trackLocation(getPosGlobal()); @@ -1612,6 +1620,8 @@ void LLPanelClassifiedEdit::onOpen(const LLSD& key) mIsNew = classified_id.isNull(); + scrollToTop(); + if(mIsNew) { setAvatarId(gAgent.getID()); -- cgit v1.2.3 From eb037986bdc25488fef25763b84025be25bc9e23 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Fri, 5 Mar 2010 09:30:40 +0200 Subject: Update for normal sub task EXT-5856 - "Auto renew each week" checkbox is displayed in the Classified Info from other resident profile. Replaced auto_renew checkbox with textbox. --HG-- branch : product-engine --- indra/newview/llpanelclassified.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelclassified.cpp') diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index d59a7d752e..5138ca7c36 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -1299,7 +1299,10 @@ void LLPanelClassifiedInfo::processProperties(void* data, EAvatarProcessorType t bool mature = is_cf_mature(c_info->flags); childSetValue("content_type", mature ? mature_str : pg_str); - childSetValue("auto_renew", is_cf_auto_renew(c_info->flags)); + + std::string auto_renew_str = is_cf_auto_renew(c_info->flags) ? + getString("auto_renew_on") : getString("auto_renew_off"); + childSetValue("auto_renew", auto_renew_str); price_str.setArg("[PRICE]", llformat("%d", c_info->price_for_listing)); childSetValue("price_for_listing", LLSD(price_str)); -- cgit v1.2.3 From cc5d5f76b0d93683890e34aebe85417dafe51bba Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Fri, 5 Mar 2010 09:33:37 +0200 Subject: Updated LLPanelClassifiedInfo::resetData() with recentrly added controls. --HG-- branch : product-engine --- indra/newview/llpanelclassified.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelclassified.cpp') diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index 5138ca7c36..c4684e9827 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -1324,8 +1324,12 @@ void LLPanelClassifiedInfo::resetData() setClassifiedId(LLUUID::null); setSnapshotId(LLUUID::null); mPosGlobal.clearVec(); - childSetValue("category", LLStringUtil::null); - childSetValue("content_type", LLStringUtil::null); + childSetText("category", LLStringUtil::null); + childSetText("content_type", LLStringUtil::null); + childSetText("click_through_text", LLStringUtil::null); + childSetText("price_for_listing", LLStringUtil::null); + childSetText("auto_renew", LLStringUtil::null); + childSetText("creation_date", LLStringUtil::null); childSetText("click_through_text", LLStringUtil::null); } -- cgit v1.2.3 From 698835061bb3e4113eb6af688e05517fc50cc090 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Fri, 5 Mar 2010 17:23:41 +0200 Subject: Update for major bug EXT-5943 - Classifieds are Published and charged as soon as you hit Save. Fixed category mismatch after editing classified. Made price uneditable in edit mode because it looks like server does not support price update(same in viewer 1.23) --HG-- branch : product-engine --- indra/newview/llpanelclassified.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpanelclassified.cpp') diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index c4684e9827..9f24ddc799 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -1696,7 +1696,8 @@ void LLPanelClassifiedEdit::processProperties(void* data, EAvatarProcessorType t setPosGlobal(c_info->pos_global); setClassifiedLocation(createLocationText(c_info->parcel_name, c_info->sim_name, c_info->pos_global)); - getChild("category")->setCurrentByIndex(c_info->category + 1); + // *HACK see LLPanelClassifiedEdit::sendUpdate() + getChild("category")->setCurrentByIndex(c_info->category - 1); getChild("category")->resetDirty(); bool mature = is_cf_mature(c_info->flags); @@ -1705,6 +1706,7 @@ void LLPanelClassifiedEdit::processProperties(void* data, EAvatarProcessorType t getChild("content_type")->setCurrentByIndex(mature ? CB_ITEM_MATURE : CB_ITEM_PG); childSetValue("auto_renew", auto_renew); childSetValue("price_for_listing", c_info->price_for_listing); + childSetEnabled("price_for_listing", isNew()); resetDirty(); setInfoLoaded(true); @@ -1763,6 +1765,7 @@ void LLPanelClassifiedEdit::resetControls() getChild("content_type")->setCurrentByIndex(0); childSetValue("auto_renew", false); childSetValue("price_for_listing", MINIMUM_PRICE_FOR_LISTING); + childSetEnabled("price_for_listing", TRUE); } bool LLPanelClassifiedEdit::canClose() @@ -1799,7 +1802,9 @@ void LLPanelClassifiedEdit::sendUpdate() c_data.agent_id = gAgent.getID(); c_data.classified_id = getClassifiedId(); - c_data.category = getCategory(); + // *HACK + // Categories on server start with 1 while combo-box index starts with 0 + c_data.category = getCategory() + 1; c_data.name = getClassifiedName(); c_data.description = getDescription(); c_data.parcel_id = getParcelId(); @@ -1814,7 +1819,7 @@ void LLPanelClassifiedEdit::sendUpdate() U32 LLPanelClassifiedEdit::getCategory() { LLComboBox* cat_cb = getChild("category"); - return cat_cb->getCurrentIndex() + 1; + return cat_cb->getCurrentIndex(); } U8 LLPanelClassifiedEdit::getFlags() -- cgit v1.2.3 From eeb6e89e60df4c61c299c6ac344e32c7d3040d04 Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Fri, 5 Mar 2010 19:03:00 +0200 Subject: 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 --- indra/newview/llpanelclassified.cpp | 76 ++++++++++++++++++++++++++++++++++--- 1 file changed, 70 insertions(+), 6 deletions(-) (limited to 'indra/newview/llpanelclassified.cpp') 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()); } -- cgit v1.2.3 From b60274fad4a7cfdb1ab383bd9f822ef75caa285a Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Fri, 5 Mar 2010 19:30:31 +0200 Subject: WIP on EXT-5687 (Classifieds are missing the clickthrough data). Updating classieifed click stats when user presses "Teleport" or "Map" button in the picks/classifieds list side panel. --HG-- branch : product-engine --- indra/newview/llpanelclassified.cpp | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'indra/newview/llpanelclassified.cpp') diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index 49614348d0..03c4da93c4 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -1548,17 +1548,25 @@ void LLPanelClassifiedInfo::stretchSnapshot() mSnapshotStreched = true; } -void LLPanelClassifiedInfo::sendClickMessage(const std::string& type) +// 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"] = fromSearch(); - body["classified_id"] = getClassifiedId(); - body["parcel_id"] = getParcelId(); - body["dest_pos_global"] = getPosGlobal().getValue(); - body["region_name"] = getSimName(); + 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; @@ -1566,6 +1574,18 @@ void LLPanelClassifiedInfo::sendClickMessage(const std::string& type) 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"); -- cgit v1.2.3 From f499260782a0c94c4f164a743da9d2690240dad7 Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Sat, 6 Mar 2010 01:17:34 +0200 Subject: Implemented (EXT-4715) Add maturity icons to Classifieds - create and details. --HG-- branch : product-engine --- indra/newview/llpanelclassified.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpanelclassified.cpp') diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index 5c6636676c..115c7a1aa5 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -1325,6 +1325,8 @@ void LLPanelClassifiedInfo::processProperties(void* data, EAvatarProcessorType t bool mature = is_cf_mature(c_info->flags); childSetValue("content_type", mature ? mature_str : pg_str); + getChild("content_type_moderate")->setVisible(mature); + getChild("content_type_general")->setVisible(!mature); std::string auto_renew_str = is_cf_auto_renew(c_info->flags) ? getString("auto_renew_on") : getString("auto_renew_off"); @@ -1369,6 +1371,8 @@ void LLPanelClassifiedInfo::resetData() childSetText("auto_renew", LLStringUtil::null); childSetText("creation_date", LLStringUtil::null); childSetText("click_through_text", LLStringUtil::null); + getChild("content_type_moderate")->setVisible(FALSE); + getChild("content_type_general")->setVisible(FALSE); } void LLPanelClassifiedInfo::resetControls() @@ -1787,7 +1791,7 @@ void LLPanelClassifiedEdit::processProperties(void* data, EAvatarProcessorType t bool mature = is_cf_mature(c_info->flags); bool auto_renew = is_cf_auto_renew(c_info->flags); - getChild("content_type")->setCurrentByIndex(mature ? CB_ITEM_MATURE : CB_ITEM_PG); + getChild("content_type")->setCurrentByIndex(mature ? CB_ITEM_MATURE : CB_ITEM_PG); childSetValue("auto_renew", auto_renew); childSetValue("price_for_listing", c_info->price_for_listing); childSetEnabled("price_for_listing", isNew()); @@ -1846,7 +1850,7 @@ void LLPanelClassifiedEdit::resetControls() LLPanelClassifiedInfo::resetControls(); getChild("category")->setCurrentByIndex(0); - getChild("content_type")->setCurrentByIndex(0); + getChild("content_type")->setCurrentByIndex(0); childSetValue("auto_renew", false); childSetValue("price_for_listing", MINIMUM_PRICE_FOR_LISTING); childSetEnabled("price_for_listing", TRUE); @@ -1910,7 +1914,7 @@ U8 LLPanelClassifiedEdit::getFlags() { bool auto_renew = childGetValue("auto_renew").asBoolean(); - LLComboBox* content_cb = getChild("content_type"); + LLComboBox* content_cb = getChild("content_type"); bool mature = content_cb->getCurrentIndex() == CB_ITEM_MATURE; return pack_classified_flags_request(auto_renew, false, mature, false); -- cgit v1.2.3 From 2197304984f8e32d8b8fcddf7271188a98259c64 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Wed, 10 Mar 2010 10:21:19 +0200 Subject: Fixed major bug EXT-5942 - Entering a Classified with a banned keyword doesn't publish, and doesn't let you edit. Changed the way panels handle classified publishing - each classified panel will keep listening to callbacks and will know when classified is published successfuly. If publish failed, panel will allow user to edit classified and try publishing again. All unpublished classifieds will be lost on Viewer restart. --HG-- branch : product-engine --- indra/newview/llpanelclassified.cpp | 131 +++++++++++++++++++++++++++--------- 1 file changed, 101 insertions(+), 30 deletions(-) (limited to 'indra/newview/llpanelclassified.cpp') diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index 115c7a1aa5..021e1f5159 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -1410,6 +1410,11 @@ void LLPanelClassifiedInfo::setClassifiedLocation(const std::string& location) childSetValue("classified_location", location); } +std::string LLPanelClassifiedInfo::getClassifiedLocation() +{ + return childGetValue("classified_location").asString(); +} + void LLPanelClassifiedInfo::setSnapshotId(const LLUUID& id) { mSnapshotCtrl->setValue(id); @@ -1651,6 +1656,7 @@ static const S32 CB_ITEM_PG = 1; LLPanelClassifiedEdit::LLPanelClassifiedEdit() : LLPanelClassifiedInfo() , mIsNew(false) + , mIsNewWithErrors(false) , mCanClose(false) , mPublishFloater(NULL) { @@ -1709,21 +1715,12 @@ BOOL LLPanelClassifiedEdit::postBuild() return TRUE; } -void LLPanelClassifiedEdit::onOpen(const LLSD& key) +void LLPanelClassifiedEdit::fillIn(const LLSD& key) { - LLUUID classified_id = key["classified_id"]; + setAvatarId(gAgent.getID()); - mIsNew = classified_id.isNull(); - - scrollToTop(); - - if(mIsNew) + if(key.isUndefined()) { - setAvatarId(gAgent.getID()); - - resetData(); - resetControls(); - setPosGlobal(gAgent.getPositionGlobal()); LLUUID snapshot_id = LLUUID::null; @@ -1746,25 +1743,55 @@ void LLPanelClassifiedEdit::onOpen(const LLSD& key) childSetValue("classified_name", makeClassifiedName()); childSetValue("classified_desc", desc); setSnapshotId(snapshot_id); - setClassifiedLocation(createLocationText(getLocationNotice(), region_name, getPosGlobal())); - // server will set valid parcel id setParcelId(LLUUID::null); + } + else + { + setClassifiedId(key["classified_id"]); + setClassifiedName(key["name"]); + setDescription(key["desc"]); + setSnapshotId(key["snapshot_id"]); + setCategory((U32)key["category"].asInteger()); + setContentType((U32)key["content_type"].asInteger()); + setClassifiedLocation(key["location_text"]); + childSetValue("auto_renew", key["auto_renew"]); + childSetValue("price_for_listing", key["price_for_listing"].asInteger()); + } +} + +void LLPanelClassifiedEdit::onOpen(const LLSD& key) +{ + mIsNew = key.isUndefined(); + + scrollToTop(); + + // classified is not created yet + bool is_new = isNew() || isNewWithErrors(); + + if(is_new) + { + resetData(); + resetControls(); + + fillIn(key); - enableVerbs(true); - enableEditing(true); + if(isNew()) + { + LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this); + } } else { LLPanelClassifiedInfo::onOpen(key); - enableVerbs(false); - enableEditing(false); } - std::string save_btn_label = isNew() ? getString("publish_label") : getString("save_label"); + std::string save_btn_label = is_new ? getString("publish_label") : getString("save_label"); childSetLabelArg("save_changes_btn", "[LABEL]", save_btn_label); + enableVerbs(is_new); + enableEditing(is_new); resetDirty(); setInfoLoaded(false); } @@ -1776,6 +1803,14 @@ void LLPanelClassifiedEdit::processProperties(void* data, EAvatarProcessorType t LLAvatarClassifiedInfo* c_info = static_cast(data); if(c_info && getClassifiedId() == c_info->classified_id) { + // see LLPanelClassifiedEdit::sendUpdate() for notes + mIsNewWithErrors = false; + // for just created classified - panel will probably be closed when we get here. + if(!getVisible()) + { + return; + } + enableEditing(true); setClassifiedName(c_info->name); @@ -1785,19 +1820,22 @@ void LLPanelClassifiedEdit::processProperties(void* data, EAvatarProcessorType t setClassifiedLocation(createLocationText(c_info->parcel_name, c_info->sim_name, c_info->pos_global)); // *HACK see LLPanelClassifiedEdit::sendUpdate() - getChild("category")->setCurrentByIndex(c_info->category - 1); - getChild("category")->resetDirty(); + setCategory(c_info->category - 1); bool mature = is_cf_mature(c_info->flags); bool auto_renew = is_cf_auto_renew(c_info->flags); - getChild("content_type")->setCurrentByIndex(mature ? CB_ITEM_MATURE : CB_ITEM_PG); + setContentType(mature ? CB_ITEM_MATURE : CB_ITEM_PG); childSetValue("auto_renew", auto_renew); childSetValue("price_for_listing", c_info->price_for_listing); childSetEnabled("price_for_listing", isNew()); resetDirty(); setInfoLoaded(true); + enableVerbs(false); + + // for just created classified - in case user opened edit panel before processProperties() callback + childSetLabelArg("save_changes_btn", "[LABEL]", getString("save_label")); } } } @@ -1828,7 +1866,12 @@ void LLPanelClassifiedEdit::resetDirty() LLPanelClassifiedInfo::resetDirty(); getChild("classified_snapshot")->resetDirty(); getChild("classified_name")->resetDirty(); - getChild("classified_desc")->resetDirty(); + + LLTextEditor* desc = getChild("classified_desc"); + // call blockUndo() to really reset dirty(and make isDirty work as intended) + desc->blockUndo(); + desc->resetDirty(); + getChild("category")->resetDirty(); getChild("content_type")->resetDirty(); getChild("auto_renew")->resetDirty(); @@ -1877,15 +1920,31 @@ void LLPanelClassifiedEdit::stretchSnapshot() getChild("edit_icon")->setShape(mSnapshotCtrl->getRect()); } +U32 LLPanelClassifiedEdit::getContentType() +{ + LLComboBox* ct_cb = getChild("content_type"); + return ct_cb->getCurrentIndex(); +} + +void LLPanelClassifiedEdit::setContentType(U32 content_type) +{ + LLIconsComboBox* ct_cb = getChild("content_type"); + ct_cb->setCurrentByIndex(content_type); + ct_cb->resetDirty(); +} + +bool LLPanelClassifiedEdit::getAutoRenew() +{ + return childGetValue("auto_renew").asBoolean(); +} + void LLPanelClassifiedEdit::sendUpdate() { LLAvatarClassifiedInfo c_data; if(getClassifiedId().isNull()) { - LLUUID id; - id.generate(); - setClassifiedId(id); + setClassifiedId(LLUUID::generateNewID()); } c_data.agent_id = gAgent.getID(); @@ -1902,6 +1961,14 @@ void LLPanelClassifiedEdit::sendUpdate() c_data.price_for_listing = getPriceForListing(); LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoUpdate(&c_data); + + if(isNew()) + { + // Lets assume there will be some error. + // Successful sendClassifiedInfoUpdate will trigger processProperties and + // let us know there was no error. + mIsNewWithErrors = true; + } } U32 LLPanelClassifiedEdit::getCategory() @@ -1910,6 +1977,13 @@ U32 LLPanelClassifiedEdit::getCategory() return cat_cb->getCurrentIndex(); } +void LLPanelClassifiedEdit::setCategory(U32 category) +{ + LLComboBox* cat_cb = getChild("category"); + cat_cb->setCurrentByIndex(category); + cat_cb->resetDirty(); +} + U8 LLPanelClassifiedEdit::getFlags() { bool auto_renew = childGetValue("auto_renew").asBoolean(); @@ -2005,17 +2079,14 @@ void LLPanelClassifiedEdit::onSaveClick() notifyInvalidName(); return; } - if(isNew()) + if(isNew() || isNewWithErrors()) { if(gStatusBar->getBalance() < getPriceForListing()) { LLNotificationsUtil::add("ClassifiedInsufficientFunds"); return; } - } - if(isNew()) - { mPublishFloater = LLFloaterReg::findTypedInstance( "publish_classified", LLSD()); -- cgit v1.2.3