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
master
Dmitry Zaporozhan 2010-03-04 16:05:04 +02:00
parent 929129482d
commit 997e91f08e
5 changed files with 211 additions and 6 deletions

View File

@ -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<LLUICtrl>("price_for_listing")->resetDirty();
}
void LLPanelClassifiedEdit::setSaveCallback(const commit_callback_t& cb)
void LLPanelClassifiedEdit::setSaveCallback(const commit_signal_t::slot_type& cb)
{
getChild<LLButton>("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<LLButton>("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<LLPublishClassifiedFloater>(
"publish_classified", LLSD());
if(!mPublishFloater)
{
mPublishFloater = LLFloaterReg::getTypedInstance<LLPublishClassifiedFloater>(
"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<LLButton>("publish_btn")->setClickedCallback(cb);
}
void LLPublishClassifiedFloater::setCancelClickedCallback(const commit_signal_t::slot_type& cb)
{
getChild<LLButton>("cancel_btn")->setClickedCallback(cb);
}
//EOF

View File

@ -202,6 +202,23 @@ private:
void* mUserData;
};
class LLPublishClassifiedFloater : public LLFloater
{
public:
LLPublishClassifiedFloater(const LLSD& key);
virtual ~LLPublishClassifiedFloater();
/*virtual*/ BOOL postBuild();
void setPrice(S32 price);
S32 getPrice();
void setPublishClickedCallback(const commit_signal_t::slot_type& cb);
void setCancelClickedCallback(const commit_signal_t::slot_type& cb);
private:
};
class LLPanelClassifiedInfo : public LLPanel, public LLAvatarPropertiesObserver
{
public:
@ -334,9 +351,9 @@ public:
/*virtual*/ void resetDirty();
void setSaveCallback(const commit_callback_t& cb);
void setSaveCallback(const commit_signal_t::slot_type& cb);
void setCancelCallback(const commit_callback_t& cb);
void setCancelCallback(const commit_signal_t::slot_type& cb);
/*virtual*/ void resetControls();
@ -364,6 +381,8 @@ protected:
S32 getPriceForListing();
void setPriceForListing(S32 price);
U8 getFlags();
std::string getLocationNotice();
@ -376,6 +395,10 @@ protected:
void onChange();
void onSaveClick();
void doSave();
void onPublishFloaterPublishClicked();
void onTexturePickerMouseEnter(LLUICtrl* ctrl);
void onTexturePickerMouseLeave(LLUICtrl* ctrl);
@ -384,6 +407,10 @@ protected:
private:
bool mIsNew;
bool mCanClose;
LLPublishClassifiedFloater* mPublishFloater;
commit_signal_t mSaveButtonClickedSignal;
};
#endif // LL_LLPANELCLASSIFIED_H

View File

@ -117,6 +117,7 @@
#include "llmoveview.h"
#include "llnearbychat.h"
#include "llpanelblockedlist.h"
#include "llpanelclassified.h"
#include "llpreviewanim.h"
#include "llpreviewgesture.h"
#include "llpreviewnotecard.h"
@ -219,6 +220,7 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("preview_sound", "floater_preview_sound.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPreviewSound>, "preview");
LLFloaterReg::add("preview_texture", "floater_preview_texture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPreviewTexture>, "preview");
LLFloaterReg::add("properties", "floater_inventory_item_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterProperties>);
LLFloaterReg::add("publish_classified", "floater_publish_classified.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPublishClassifiedFloater>);
LLFloaterReg::add("telehubs", "floater_telehub.xml",&LLFloaterReg::build<LLFloaterTelehub>);
LLFloaterReg::add("test_inspectors", "floater_test_inspectors.xml",

View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater
legacy_header_height="18"
can_minimize="false"
height="200"
layout="topleft"
name="publish_classified"
help_topic="price_for_listing"
title="Publishing Classified"
width="320">
<text
top="20"
follows="top|left"
font="SansSerif"
height="60"
layout="topleft"
left="15"
word_wrap="true"
name="explanation_text">
Your classified ad will run for one week from the date it is published.
Remember, Classified fees are non-refundable.
</text>
<spinner
decimal_digits="0"
follows="left|top"
halign="left"
height="23"
increment="1"
label_width="70"
label="Price for Ad: "
v_pad="10"
layout="topleft"
left="15"
value="50"
min_val="50"
max_val="99999"
name="price_for_listing"
top_pad="10"
tool_tip="Price for listing."
width="150" />
<text
follows="top|left"
font="SansSerif"
height="60"
layout="topleft"
left_pad="5"
top_delta="0"
word_wrap="true"
value="L$"
name="l$_text" />
<text
follows="top|right"
font="SansSerif"
height="20"
layout="topleft"
left="15"
name="more_info_text"
top_pad="-20"
width="300">
More info (link to classified help)
</text>
<button
follows="top|left"
height="22"
label="Publish"
layout="topleft"
left="105"
name="publish_btn"
top="160"
width="100" />
<button
follows="top|left"
height="22"
label="Cancel"
layout="topleft"
left_pad="5"
name="cancel_btn"
width="100" />
</floater>

View File

@ -16,6 +16,12 @@
name="location_notice">
(will update after save)
</panel.string>
<string name="publish_label">
Publish
</string>
<string name="save_label">
Save
</string>
<button
follows="top|right"
height="23"
@ -281,7 +287,7 @@
<button
follows="bottom|left"
height="23"
label="Save"
label="[LABEL]"
layout="topleft"
name="save_changes_btn"
left="0"