summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelclassified.cpp
diff options
context:
space:
mode:
authorАдминистратор <>2009-12-21 16:13:09 +0200
committerАдминистратор <>2009-12-21 16:13:09 +0200
commitc353e640fa80a335be741dd0edfdc9952ea3cdea (patch)
tree47d9cf832dff49399f2ff805d735341e3668858c /indra/newview/llpanelclassified.cpp
parent10d20fdfe7a62087561d4a4e0ec97756ded6a986 (diff)
Fixed low bug EXT-3353 - There's an ability to create classified w/o title and description.
--HG-- branch : product-engine
Diffstat (limited to 'indra/newview/llpanelclassified.cpp')
-rw-r--r--indra/newview/llpanelclassified.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp
index 0dae667e7f..e29320ffc2 100644
--- a/indra/newview/llpanelclassified.cpp
+++ b/indra/newview/llpanelclassified.cpp
@@ -1557,6 +1557,11 @@ void LLPanelClassifiedEdit::resetControls()
childSetValue("price_for_listing", MINIMUM_PRICE_FOR_LISTING);
}
+bool LLPanelClassifiedEdit::canClose()
+{
+ return isValidName();
+}
+
void LLPanelClassifiedEdit::sendUpdate()
{
LLAvatarClassifiedInfo c_data;
@@ -1671,6 +1676,12 @@ void LLPanelClassifiedEdit::onChange()
void LLPanelClassifiedEdit::onSaveClick()
{
+ if(!isValidName())
+ {
+ notifyInvalidName();
+ return;
+ }
+
sendUpdate();
resetDirty();
}
@@ -1681,6 +1692,34 @@ std::string LLPanelClassifiedEdit::getLocationNotice()
return location_notice;
}
+bool LLPanelClassifiedEdit::isValidName()
+{
+ std::string name = getClassifiedName();
+ if (name.empty())
+ {
+ return false;
+ }
+ if (!isalnum(name[0]))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+void LLPanelClassifiedEdit::notifyInvalidName()
+{
+ std::string name = getClassifiedName();
+ if (name.empty())
+ {
+ LLNotificationsUtil::add("BlankClassifiedName");
+ }
+ else if (!isalnum(name[0]))
+ {
+ LLNotificationsUtil::add("ClassifiedMustBeAlphanumeric");
+ }
+}
+
void LLPanelClassifiedEdit::onTexturePickerMouseEnter(LLUICtrl* ctrl)
{
ctrl->setVisible(TRUE);