summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Zaporozhan <dzaporozhan@productengine.com>2010-03-04 16:05:04 +0200
committerDmitry Zaporozhan <dzaporozhan@productengine.com>2010-03-04 16:05:04 +0200
commit997e91f08e9b6afd5bb3335da235e6ea9e9c0761 (patch)
tree5f2babebd0e32c568ccadd443e4b97eb89f7e68f
parent929129482d798db3eaf1e0bbf6a9f49444e85e72 (diff)
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
-rw-r--r--indra/newview/llpanelclassified.cpp94
-rw-r--r--indra/newview/llpanelclassified.h31
-rw-r--r--indra/newview/llviewerfloaterreg.cpp2
-rw-r--r--indra/newview/skins/default/xui/en/floater_publish_classified.xml82
-rw-r--r--indra/newview/skins/default/xui/en/panel_edit_classified.xml8
5 files changed, 211 insertions, 6 deletions
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<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
diff --git a/indra/newview/llpanelclassified.h b/indra/newview/llpanelclassified.h
index 3df3a2255b..1b5b5e54d8 100644
--- a/indra/newview/llpanelclassified.h
+++ b/indra/newview/llpanelclassified.h
@@ -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
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp
index 8370c98470..65e9d8971a 100644
--- a/indra/newview/llviewerfloaterreg.cpp
+++ b/indra/newview/llviewerfloaterreg.cpp
@@ -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",
diff --git a/indra/newview/skins/default/xui/en/floater_publish_classified.xml b/indra/newview/skins/default/xui/en/floater_publish_classified.xml
new file mode 100644
index 0000000000..3225843d09
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/floater_publish_classified.xml
@@ -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>
diff --git a/indra/newview/skins/default/xui/en/panel_edit_classified.xml b/indra/newview/skins/default/xui/en/panel_edit_classified.xml
index 4fba0e5d90..c1b352031f 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_classified.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_classified.xml
@@ -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"