Implemented major task EXT-2251 - Implement panels for creating, editing and viewing Classifieds.

--HG--
branch : product-engine
master
Dmitry Zaporozhan 2009-11-09 15:54:54 +02:00
parent cd32884110
commit 148a29ea1e
9 changed files with 1226 additions and 6 deletions

View File

@ -554,6 +554,36 @@ void LLAvatarPropertiesProcessor::sendPickInfoUpdate(const LLPickData* new_pick)
LLAgentPicksInfo::getInstance()->requestNumberOfPicks();
}
void LLAvatarPropertiesProcessor::sendClassifiedInfoUpdate(const LLAvatarClassifiedInfo* c_data)
{
if(!c_data)
{
return;
}
LLMessageSystem* msg = gMessageSystem;
msg->newMessage(_PREHASH_ClassifiedInfoUpdate);
msg->nextBlock(_PREHASH_AgentData);
msg->addUUID(_PREHASH_AgentID, gAgent.getID());
msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlock(_PREHASH_Data);
msg->addUUID(_PREHASH_ClassifiedID, c_data->classified_id);
msg->addU32(_PREHASH_Category, c_data->category);
msg->addString(_PREHASH_Name, c_data->name);
msg->addString(_PREHASH_Desc, c_data->description);
msg->addUUID(_PREHASH_ParcelID, c_data->parcel_id);
msg->addU32(_PREHASH_ParentEstate, 0);
msg->addUUID(_PREHASH_SnapshotID, c_data->snapshot_id);
msg->addVector3d(_PREHASH_PosGlobal, c_data->pos_global);
msg->addU8(_PREHASH_ClassifiedFlags, c_data->flags);
msg->addS32(_PREHASH_PriceForListing, c_data->price_for_listing);
gAgent.sendReliableMessage();
}
void LLAvatarPropertiesProcessor::sendPickInfoRequest(const LLUUID& creator_id, const LLUUID& pick_id)
{
// Must ask for a pick based on the creator id because

View File

@ -212,6 +212,8 @@ public:
void sendPickInfoUpdate(const LLPickData* new_pick);
void sendClassifiedInfoUpdate(const LLAvatarClassifiedInfo* c_data);
void sendFriendRights(const LLUUID& avatar_id, S32 rights);
void sendNotes(const LLUUID& avatar_id, const std::string notes);

View File

@ -1142,3 +1142,493 @@ void LLPanelClassified::setDefaultAccessCombo()
break;
}
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
std::string SET_LOCATION_NOTICE1("(will update after save)");
LLPanelClassifiedInfo::LLPanelClassifiedInfo()
: LLPanel()
{
}
LLPanelClassifiedInfo::~LLPanelClassifiedInfo()
{
}
// static
LLPanelClassifiedInfo* LLPanelClassifiedInfo::create()
{
LLPanelClassifiedInfo* panel = new LLPanelClassifiedInfo();
LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_classified_info.xml");
return panel;
}
BOOL LLPanelClassifiedInfo::postBuild()
{
childSetAction("back_btn", boost::bind(&LLPanelClassifiedInfo::onExit, this), NULL);
return TRUE;
}
void LLPanelClassifiedInfo::setExitCallback(const commit_callback_t& cb)
{
getChild<LLButton>("back_btn")->setClickedCallback(cb);
}
void LLPanelClassifiedInfo::onOpen(const LLSD& key)
{
LLUUID avatar_id = key["avatar_id"];
if(avatar_id.isNull())
{
return;
}
if(getAvatarId().notNull())
{
LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(), this);
}
setAvatarId(avatar_id);
resetData();
resetControls();
setClassifiedId(key["classified_id"]);
setClassifiedName(key["name"]);
setDescription(key["desc"]);
setSnapshotId(key["snapshot_id"]);
LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this);
LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(getClassifiedId());
}
void LLPanelClassifiedInfo::processProperties(void* data, EAvatarProcessorType type)
{
if(APT_CLASSIFIED_INFO == type)
{
LLAvatarClassifiedInfo* c_info = static_cast<LLAvatarClassifiedInfo*>(data);
if(data && getClassifiedId() == c_info->classified_id)
{
setClassifiedName(c_info->name);
setDescription(c_info->description);
setSnapshotId(c_info->snapshot_id);
setClassifiedLocation(createLocationText(c_info->parcel_name, c_info->sim_name, c_info->pos_global));
childSetValue("category", LLClassifiedInfo::sCategories[c_info->category]);
bool mature = is_cf_mature(c_info->flags);
childSetValue("content_type", mature ? "Mature" : "PG Content");
childSetValue("auto_renew", is_cf_auto_renew(c_info->flags));
childSetTextArg("price_for_listing", "[PRICE]", llformat("%d", c_info->price_for_listing));
}
}
}
void LLPanelClassifiedInfo::resetData()
{
setClassifiedName(LLStringUtil::null);
setDescription(LLStringUtil::null);
setClassifiedLocation(LLStringUtil::null);
setClassifiedId(LLUUID::null);
setSnapshotId(LLUUID::null);
mPosGlobal.clearVec();
}
void LLPanelClassifiedInfo::resetControls()
{
if(getAvatarId() == gAgent.getID())
{
childSetEnabled("edit_btn", TRUE);
childSetVisible("edit_btn", TRUE);
}
else
{
childSetEnabled("edit_btn", FALSE);
childSetVisible("edit_btn", FALSE);
}
}
void LLPanelClassifiedInfo::setClassifiedName(const std::string& name)
{
childSetValue("classified_name", name);
}
std::string LLPanelClassifiedInfo::getClassifiedName()
{
return childGetValue("classified_name").asString();
}
void LLPanelClassifiedInfo::setDescription(const std::string& desc)
{
childSetValue("classified_desc", desc);
}
std::string LLPanelClassifiedInfo::getDescription()
{
return childGetValue("classified_desc").asString();
}
void LLPanelClassifiedInfo::setClassifiedLocation(const std::string& location)
{
childSetValue("classified_location", location);
}
void LLPanelClassifiedInfo::setSnapshotId(const LLUUID& id)
{
childSetValue("classified_snapshot", id);
}
LLUUID LLPanelClassifiedInfo::getSnapshotId()
{
return childGetValue("classified_snapshot").asUUID();
}
// static
std::string LLPanelClassifiedInfo::createLocationText(
const std::string& original_name,
const std::string& sim_name,
const LLVector3d& pos_global)
{
std::string location_text;
location_text.append(original_name);
if (!sim_name.empty())
{
if (!location_text.empty())
location_text.append(", ");
location_text.append(sim_name);
}
if (!location_text.empty())
location_text.append(" ");
if (!pos_global.isNull())
{
S32 region_x = llround((F32)pos_global.mdV[VX]) % REGION_WIDTH_UNITS;
S32 region_y = llround((F32)pos_global.mdV[VY]) % REGION_WIDTH_UNITS;
S32 region_z = llround((F32)pos_global.mdV[VZ]);
location_text.append(llformat(" (%d, %d, %d)", region_x, region_y, region_z));
}
return location_text;
}
void LLPanelClassifiedInfo::onExit()
{
LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(), this);
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
LLPanelClassifiedEdit::LLPanelClassifiedEdit()
: LLPanelClassifiedInfo()
, mSnapshotCtrl(NULL)
, mNewClassified(false)
{
}
LLPanelClassifiedEdit::~LLPanelClassifiedEdit()
{
}
//static
LLPanelClassifiedEdit* LLPanelClassifiedEdit::create()
{
LLPanelClassifiedEdit* panel = new LLPanelClassifiedEdit();
LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_edit_classified.xml");
return panel;
}
BOOL LLPanelClassifiedEdit::postBuild()
{
LLPanelClassifiedInfo::postBuild();
mSnapshotCtrl = getChild<LLTextureCtrl>("classified_snapshot");
mSnapshotCtrl->setOnSelectCallback(boost::bind(&LLPanelClassifiedEdit::onSnapshotChanged, this, _1));
LLLineEditor* line_edit = getChild<LLLineEditor>("classified_name");
line_edit->setKeystrokeCallback(boost::bind(&LLPanelClassifiedEdit::onClassifiedChanged, this), NULL);
LLTextEditor* text_edit = getChild<LLTextEditor>("classified_desc");
text_edit->setKeystrokeCallback(boost::bind(&LLPanelClassifiedEdit::onClassifiedChanged, this));
LLComboBox* combobox = getChild<LLComboBox>( "category");
LLClassifiedInfo::cat_map::iterator iter;
for (iter = LLClassifiedInfo::sCategories.begin();
iter != LLClassifiedInfo::sCategories.end();
iter++)
{
combobox->add(LLTrans::getString(iter->second), (void *)((intptr_t)iter->first), ADD_BOTTOM);
}
combobox->setCurrentByIndex(0);
combobox->setCommitCallback(boost::bind(&LLPanelClassifiedEdit::onClassifiedChanged, this));
combobox = getChild<LLComboBox>("content_type");
combobox->setCommitCallback(boost::bind(&LLPanelClassifiedEdit::onClassifiedChanged, this));
childSetCommitCallback("price_for_listing", boost::bind(&LLPanelClassifiedEdit::onClassifiedChanged, this), NULL);
childSetCommitCallback("auto_renew", boost::bind(&LLPanelClassifiedEdit::onClassifiedChanged, this), NULL);
childSetAction("save_changes_btn", boost::bind(&LLPanelClassifiedEdit::onClickSave, this));
childSetAction("set_to_curr_location_btn", boost::bind(&LLPanelClassifiedEdit::onClickSetLocation, this));
return TRUE;
}
void LLPanelClassifiedEdit::onOpen(const LLSD& key)
{
LLUUID classified_id = key["classified_id"];
if(classified_id.isNull())
{
mNewClassified = true;
setAvatarId(gAgent.getID());
resetData();
resetControls();
setPosGlobal(gAgent.getPositionGlobal());
LLUUID snapshot_id = LLUUID::null;
std::string desc;
LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
if(parcel)
{
desc = parcel->getDesc();
snapshot_id = parcel->getSnapshotID();
}
std::string region_name = LLTrans::getString("ClassifiedUpdateAfterPublish");
LLViewerRegion* region = gAgent.getRegion();
if (region)
{
region_name = region->getName();
}
childSetValue("classified_name", makeClassifiedName());
childSetValue("classified_desc", desc);
setSnapshotId(snapshot_id);
setClassifiedLocation(createLocationText(region_name, LLStringUtil::null, getPosGlobal()));
setParcelId(LLUUID::null);
enableSaveButton(true);
}
else
{
mNewClassified = false;
LLPanelClassifiedInfo::onOpen(key);
enableSaveButton(false);
}
resetDirty();
}
void LLPanelClassifiedEdit::processProperties(void* data, EAvatarProcessorType type)
{
if(APT_CLASSIFIED_INFO == type)
{
LLAvatarClassifiedInfo* c_info = static_cast<LLAvatarClassifiedInfo*>(data);
if(data && getClassifiedId() == c_info->classified_id)
{
setClassifiedName(c_info->name);
setDescription(c_info->description);
setSnapshotId(c_info->snapshot_id);
setClassifiedLocation(createLocationText(c_info->parcel_name, c_info->sim_name, c_info->pos_global));
getChild<LLComboBox>("category")->setCurrentByIndex(c_info->category + 1);
getChild<LLComboBox>("category")->resetDirty();
bool mature = is_cf_mature(c_info->flags);
bool auto_renew = is_cf_auto_renew(c_info->flags);
getChild<LLComboBox>("content_type")->setCurrentByIndex(mature ? 0 : 1);
childSetValue("auto_renew", auto_renew);
childSetValue("price_for_listing", c_info->price_for_listing);
resetDirty();
}
}
}
BOOL LLPanelClassifiedEdit::isDirty() const
{
if(mNewClassified)
return TRUE;
BOOL dirty = false;
dirty |= LLPanelClassifiedInfo::isDirty();
dirty |= mSnapshotCtrl->isDirty();
dirty |= getChild<LLLineEditor>("classified_name")->isDirty();
dirty |= getChild<LLTextEditor>("classified_desc")->isDirty();
dirty |= getChild<LLComboBox>("category")->isDirty();
dirty |= getChild<LLComboBox>("content_type")->isDirty();
dirty |= getChild<LLUICtrl>("auto_renew")->isDirty();
dirty |= getChild<LLUICtrl>("price_for_listing")->isDirty();
return dirty;
}
void LLPanelClassifiedEdit::resetDirty()
{
LLPanelClassifiedInfo::resetDirty();
mSnapshotCtrl->resetDirty();
getChild<LLUICtrl>("classified_name")->resetDirty();
getChild<LLUICtrl>("classified_desc")->resetDirty();
getChild<LLUICtrl>("category")->resetDirty();
getChild<LLUICtrl>("content_type")->resetDirty();
getChild<LLUICtrl>("auto_renew")->resetDirty();
getChild<LLUICtrl>("price_for_listing")->resetDirty();
}
void LLPanelClassifiedEdit::setSaveCallback(const commit_callback_t& cb)
{
getChild<LLButton>("save_changes_btn")->setClickedCallback(cb);
}
void LLPanelClassifiedEdit::setCancelCallback(const commit_callback_t& cb)
{
getChild<LLButton>("cancel_btn")->setClickedCallback(cb);
}
void LLPanelClassifiedEdit::resetControls()
{
LLPanelClassifiedInfo::resetControls();
getChild<LLComboBox>("category")->setCurrentByIndex(0);
getChild<LLComboBox>("content_type")->setCurrentByIndex(0);
childSetValue("auto_renew", false);
childSetValue("price_for_listing", MINIMUM_PRICE_FOR_LISTING);
}
void LLPanelClassifiedEdit::sendUpdate()
{
LLAvatarClassifiedInfo c_data;
if(getClassifiedId().isNull())
{
LLUUID id = getClassifiedId();
id.generate();
setClassifiedId(id);
}
c_data.agent_id = gAgent.getID();
c_data.classified_id = getClassifiedId();
c_data.category = getCategory();
c_data.name = getClassifiedName();
c_data.description = getDescription();
c_data.parcel_id = getParcelId();
c_data.snapshot_id = getSnapshotId();
c_data.pos_global = getPosGlobal();
c_data.flags = getClassifiedFlags();
c_data.price_for_listing = getPriceForListing();
LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoUpdate(&c_data);
}
U32 LLPanelClassifiedEdit::getCategory()
{
LLComboBox* cat_cb = getChild<LLComboBox>("category");
return cat_cb->getCurrentIndex() + 1;
}
U8 LLPanelClassifiedEdit::getClassifiedFlags()
{
bool auto_renew = childGetValue("auto_renew").asBoolean();
LLComboBox* content_cb = getChild<LLComboBox>("content_type");
bool mature = content_cb->getCurrentIndex() == 0;
return pack_classified_flags_request(auto_renew, false, mature, false);;
}
void LLPanelClassifiedEdit::enableSaveButton(bool enable)
{
childSetEnabled("save_changes_btn", enable);
}
std::string LLPanelClassifiedEdit::makeClassifiedName()
{
std::string name;
LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
if(parcel)
{
name = parcel->getName();
}
if(!name.empty())
return name;
LLViewerRegion* region = gAgent.getRegion();
if(region)
{
name = region->getName();
}
return name;
}
S32 LLPanelClassifiedEdit::getPriceForListing()
{
return childGetValue("price_for_listing").asInteger();
}
void LLPanelClassifiedEdit::onClickSetLocation()
{
setPosGlobal(gAgent.getPositionGlobal());
setParcelId(LLUUID::null);
std::string region_name = LLTrans::getString("ClassifiedUpdateAfterPublish");
LLViewerRegion* region = gAgent.getRegion();
if (region)
{
region_name = region->getName();
}
setClassifiedLocation(createLocationText(region_name, LLStringUtil::null, getPosGlobal()));
// mark classified as dirty
setValue(LLSD());
onClassifiedChanged();
}
void LLPanelClassifiedEdit::onSnapshotChanged(LLUICtrl* ctrl)
{
}
void LLPanelClassifiedEdit::onClassifiedChanged()
{
if(isDirty())
{
enableSaveButton(true);
}
else
{
enableSaveButton(false);
}
}
void LLPanelClassifiedEdit::onClickSave()
{
sendUpdate();
// LLAvatarPropertiesProcessor::getInstance()->sendAvatarClassifiedsRequest(getAvatarId());
LLSD params;
params["action"] = "save_classified";
notifyParent(params);
}
//EOF

View File

@ -198,5 +198,131 @@ private:
void* mUserData;
};
#include "llavatarpropertiesprocessor.h"
class LLPanelClassifiedInfo : public LLPanel, public LLAvatarPropertiesObserver
{
public:
static LLPanelClassifiedInfo* create();
virtual ~LLPanelClassifiedInfo();
virtual void setExitCallback(const commit_callback_t& cb);
/*virtual*/ void onOpen(const LLSD& key);
/*virtual*/ BOOL postBuild();
/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
virtual void setAvatarId(const LLUUID& avatar_id) { mAvatarId = avatar_id; }
LLUUID& getAvatarId() { return mAvatarId; }
virtual void setSnapshotId(const LLUUID& id);
virtual LLUUID getSnapshotId();
virtual void setClassifiedId(const LLUUID& id) { mClassifiedId = id; }
virtual LLUUID& getClassifiedId() { return mClassifiedId; }
virtual void setClassifiedName(const std::string& name);
virtual std::string getClassifiedName();
virtual void setDescription(const std::string& desc);
virtual std::string getDescription();
virtual void setClassifiedLocation(const std::string& location);
virtual void setPosGlobal(const LLVector3d& pos) { mPosGlobal = pos; }
virtual LLVector3d& getPosGlobal() { return mPosGlobal; }
protected:
LLPanelClassifiedInfo();
virtual void resetData();
virtual void resetControls();
static std::string createLocationText(
const std::string& original_name,
const std::string& sim_name,
const LLVector3d& pos_global);
void onClickMap();
void onClickTeleport();
void onClickBack();
void onExit();
private:
LLUUID mAvatarId;
LLUUID mClassifiedId;
LLVector3d mPosGlobal;
};
class LLPanelClassifiedEdit : public LLPanelClassifiedInfo
{
public:
static LLPanelClassifiedEdit* create();
virtual ~LLPanelClassifiedEdit();
BOOL postBuild();
void onOpen(const LLSD& key);
void processProperties(void* data, EAvatarProcessorType type);
BOOL isDirty() const;
void resetDirty();
void setSaveCallback(const commit_callback_t& cb);
void setCancelCallback(const commit_callback_t& cb);
void resetControls();
virtual bool isNewClassified() { return mNewClassified; }
protected:
LLPanelClassifiedEdit();
void sendUpdate();
U32 getCategory();
void enableSaveButton(bool enable);
std::string makeClassifiedName();
void setParcelId(const LLUUID& id) { mParcelId = id; }
LLUUID getParcelId() { return mParcelId; }
S32 getPriceForListing();
U8 getClassifiedFlags();
void onClickSetLocation();
void onSnapshotChanged(LLUICtrl* ctrl);
void onClassifiedChanged();
void onClickSave();
private:
LLTextureCtrl* mSnapshotCtrl;
LLUUID mParcelId;
bool mNewClassified;
};
#endif // LL_LLPANELCLASSIFIED_H

View File

@ -52,6 +52,7 @@
#include "llpanelavatar.h"
#include "llpanelprofile.h"
#include "llpanelpick.h"
#include "llpanelclassified.h"
static const std::string XML_BTN_NEW = "new_btn";
static const std::string XML_BTN_DELETE = "trash_btn";
@ -70,6 +71,33 @@ static const std::string CLASSIFIED_NAME("classified_name");
static LLRegisterPanelClassWrapper<LLPanelPicks> t_panel_picks("panel_picks");
//////////////////////////////////////////////////////////////////////////
class LLClassifiedClickThrough : public LLDispatchHandler
{
public:
virtual bool operator()(
const LLDispatcher* dispatcher,
const std::string& key,
const LLUUID& invoice,
const sparam_t& strings)
{
if (strings.size() != 4)
return false;
// LLUUID classified_id(strings[0]);
// 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);
return true;
}
};
//-----------------------------------------------------------------------------
// LLPanelPicks
//-----------------------------------------------------------------------------
@ -85,8 +113,12 @@ LLPanelPicks::LLPanelPicks()
mOverflowMenu(NULL),
mPlusMenu(NULL),
mPicksAccTab(NULL),
mClassifiedsAccTab(NULL)
mClassifiedsAccTab(NULL),
mPanelClassifiedInfo(NULL),
mPanelClassifiedEdit(NULL)
{
gGenericDispatcher.addHandler("classifiedclickthrough",
new LLClassifiedClickThrough());
}
LLPanelPicks::~LLPanelPicks()
@ -574,7 +606,9 @@ void LLPanelPicks::createNewPick()
void LLPanelPicks::createNewClassified()
{
LLNotifications::instance().add("ClickUnimplemented");
createClassifiedEditPanel();
getProfilePanel()->openPanel(mPanelClassifiedEdit, LLSD());
}
void LLPanelPicks::onClickInfo()
@ -610,7 +644,21 @@ void LLPanelPicks::openPickInfo()
void LLPanelPicks::openClassifiedInfo()
{
LLNotifications::instance().add("ClickUnimplemented");
LLSD selected_value = mClassifiedsList->getSelectedValue();
if (selected_value.isUndefined()) return;
LLClassifiedItem* c_item = getSelectedClassifiedItem();
createClassifiedInfoPanel();
LLSD params;
params["classified_id"] = c_item->getClassifiedId();
params["avatar_id"] = c_item->getAvatarId();
params["snapshot_id"] = c_item->getSnapshotId();
params["name"] = c_item->getClassifiedName();
params["desc"] = c_item->getDescription();
getProfilePanel()->openPanel(mPanelClassifiedInfo, params);
}
void LLPanelPicks::showAccordion(const std::string& name, bool show)
@ -632,6 +680,49 @@ void LLPanelPicks::onPanelPickSave(LLPanel* panel)
updateButtons();
}
void LLPanelPicks::onPanelClassifiedSave(LLPanelClassifiedEdit* panel)
{
if(panel->isNewClassified())
{
LLClassifiedItem* c_item = new LLClassifiedItem(getAvatarId(), panel->getClassifiedId());
c_item->setClassifiedName(panel->getClassifiedName());
c_item->setDescription(panel->getDescription());
c_item->setSnapshotId(panel->getSnapshotId());
LLSD c_value;
c_value.insert(CLASSIFIED_ID, c_item->getClassifiedId());
c_value.insert(CLASSIFIED_NAME, c_item->getClassifiedName());
mClassifiedsList->addItem(c_item, c_value);
c_item->setDoubleClickCallback(boost::bind(&LLPanelPicks::onDoubleClickClassifiedItem, this, _1));
c_item->setRightMouseUpCallback(boost::bind(&LLPanelPicks::onRightMouseUpItem, this, _1, _2, _3, _4));
c_item->setMouseUpCallback(boost::bind(&LLPanelPicks::updateButtons, this));
c_item->childSetAction("info_chevron", boost::bind(&LLPanelPicks::onClickInfo, this));
}
else
{
std::vector<LLSD> values;
mClassifiedsList->getValues(values);
for(size_t n = 0; n < values.size(); ++n)
{
LLUUID c_id = values[n][CLASSIFIED_ID].asUUID();
if(panel->getClassifiedId() == c_id)
{
LLClassifiedItem* c_item = dynamic_cast<LLClassifiedItem*>(
mClassifiedsList->getItemByValue(values[n]));
c_item->setClassifiedName(panel->getClassifiedName());
c_item->setDescription(panel->getDescription());
c_item->setSnapshotId(panel->getSnapshotId());
}
}
}
onPanelPickClose(panel);
updateButtons();
}
void LLPanelPicks::createPickInfoPanel()
{
if(!mPanelPickInfo)
@ -643,6 +734,28 @@ void LLPanelPicks::createPickInfoPanel()
}
}
void LLPanelPicks::createClassifiedInfoPanel()
{
if(!mPanelClassifiedInfo)
{
mPanelClassifiedInfo = LLPanelClassifiedInfo::create();
mPanelClassifiedInfo->setExitCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelClassifiedInfo));
mPanelClassifiedInfo->setVisible(FALSE);
}
}
void LLPanelPicks::createClassifiedEditPanel()
{
if(!mPanelClassifiedEdit)
{
mPanelClassifiedEdit = LLPanelClassifiedEdit::create();
mPanelClassifiedEdit->setExitCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelClassifiedEdit));
mPanelClassifiedEdit->setSaveCallback(boost::bind(&LLPanelPicks::onPanelClassifiedSave, this, mPanelClassifiedEdit));
mPanelClassifiedEdit->setCancelCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelClassifiedEdit));
mPanelClassifiedEdit->setVisible(FALSE);
}
}
void LLPanelPicks::createPickEditPanel()
{
if(!mPanelPickEdit)
@ -702,6 +815,28 @@ void LLPanelPicks::onPanelPickEdit()
getProfilePanel()->openPanel(mPanelPickEdit, params);
}
void LLPanelPicks::onPanelClassifiedEdit()
{
LLSD selected_value = mClassifiedsList->getSelectedValue();
if (selected_value.isUndefined())
{
return;
}
LLClassifiedItem* c_item = dynamic_cast<LLClassifiedItem*>(mClassifiedsList->getSelectedItem());
createClassifiedEditPanel();
LLSD params;
params["classified_id"] = c_item->getClassifiedId();
params["avatar_id"] = c_item->getAvatarId();
params["snapshot_id"] = c_item->getSnapshotId();
params["name"] = c_item->getClassifiedName();
params["desc"] = c_item->getDescription();
getProfilePanel()->openPanel(mPanelClassifiedEdit, params);
}
void LLPanelPicks::onClickMenuEdit()
{
if(getSelectedPickItem())
@ -710,7 +845,7 @@ void LLPanelPicks::onClickMenuEdit()
}
else if(getSelectedClassifiedItem())
{
LLNotifications::instance().add("ClickUnimplemented");
onPanelClassifiedEdit();
}
}

View File

@ -53,6 +53,8 @@ class LLFlatListView;
class LLPanelPickInfo;
class LLPanelPickEdit;
class LLToggleableMenu;
class LLPanelClassifiedInfo;
class LLPanelClassifiedEdit;
class LLPanelPicks
: public LLPanelProfileTab
@ -98,7 +100,9 @@ private:
void onClickInfo();
void onPanelPickClose(LLPanel* panel);
void onPanelPickSave(LLPanel* panel);
void onPanelClassifiedSave(LLPanelClassifiedEdit* panel);
void onPanelPickEdit();
void onPanelClassifiedEdit();
void onClickMenuEdit();
void createNewPick();
@ -125,8 +129,8 @@ private:
void createPickInfoPanel();
void createPickEditPanel();
// void openPickEditPanel(LLPickItem* pick);
// void openPickInfoPanel(LLPickItem* pick);
void createClassifiedInfoPanel();
void createClassifiedEditPanel();
LLMenuGL* mPopupMenu;
LLPanelProfile* mProfilePanel;
@ -134,6 +138,8 @@ private:
LLFlatListView* mPicksList;
LLFlatListView* mClassifiedsList;
LLPanelPickInfo* mPanelPickInfo;
LLPanelClassifiedInfo* mPanelClassifiedInfo;
LLPanelClassifiedEdit* mPanelClassifiedEdit;
LLPanelPickEdit* mPanelPickEdit;
LLToggleableMenu* mOverflowMenu;
LLToggleableMenu* mPlusMenu;

View File

@ -199,5 +199,10 @@ void LLPanelProfile::notifyParent(const LLSD& info)
onOpen(info);
return;
}
else if("save_classified" == action)
{
// onOpen(info);
return;
}
LLPanel::notifyParent(info);
}

View File

@ -0,0 +1,175 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel
background_visible="true"
follows="all"
height="570"
layout="topleft"
left="0"
min_height="350"
name="panel_classified_info"
top="0"
width="333">
<button
follows="top|right"
height="23"
image_overlay="BackArrow_Off"
layout="topleft"
name="back_btn"
picture_style="true"
left="10"
tab_stop="false"
top="2"
width="23" />
<text
follows="top|left|right"
font="SansSerifHugeBold"
height="26"
layout="topleft"
left_pad="10"
name="title"
text_color="white"
top="0"
value="Classified Info"
use_ellipses="true"
width="275" />
<scroll_container
color="DkGray2"
opaque="true"
follows="all"
height="500"
layout="topleft"
left="10"
top_pad="10"
name="profile_scroll"
reserve_scroll_corner="false"
width="313">
<panel
name="scroll_content_panel"
follows="left|top"
min_height="300"
layout="topleft"
top="0"
background_visible="false"
height="500"
left="0"
width="295">
<texture_picker
enabled="false"
follows="left|top"
height="197"
layout="topleft"
left="10"
name="classified_snapshot"
top="20"
width="290" />
<text
follows="left|top|right"
height="35"
width="290"
layout="topleft"
font="SansSerifBig"
font.style="BOLD"
left="10"
top_pad="10"
name="classified_name"
text_color="white"
value="[name]"
use_ellipses="true" />
<text
follows="left|top"
height="25"
layout="topleft"
left="10"
name="classified_location"
width="290"
word_wrap="true"
value="[loading...]" />
<text
follows="left|top|right"
height="18"
layout="topleft"
left="10"
name="content_type"
width="290"
top_pad="5"
value="[content type]" />
<text
follows="left|top|right"
height="18"
layout="topleft"
left="10"
name="category"
width="290"
top_pad="5"
value="[category]" />
<check_box
enabled="false"
height="16"
label="Auto renew each week"
layout="topleft"
left="10"
name="auto_renew"
top_pad="5"
width="290" />
<text
follows="left|top"
halign="left"
height="16"
layout="topleft"
left="10"
name="price_for_listing"
top_pad="5"
tool_tip="Price for listing."
width="105">
L$[PRICE]
</text>
<text
follows="left|top|right"
height="200"
layout="topleft"
left="10"
name="classified_desc"
width="290"
value="[description]"
word_wrap="true" />
</panel>
</scroll_container>
<panel
follows="left|right|bottom"
height="20"
layout="topleft"
top_pad="8"
left="10"
name="buttons">
<button
follows="bottom|left"
font="SansSerifSmall"
height="19"
label="Teleport"
layout="topleft"
left="0"
name="teleport_btn"
top="0"
width="90" />
<button
follows="bottom|left"
font="SansSerifSmall"
height="19"
label="Map"
layout="topleft"
left_pad="10"
name="show_on_map_btn"
top="0"
width="90" />
<button
follows="bottom|left"
font="SansSerifSmall"
height="19"
label="Edit"
layout="topleft"
right="-1"
name="edit_btn"
top="0"
width="90" />
</panel>
</panel>

View File

@ -0,0 +1,251 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel
background_visible="true"
bevel_style="in"
follows="left|top|right|bottom"
height="570"
label="Edit Classified"
layout="topleft"
left="0"
min_height="350"
name="panel_edit_classified"
top="0"
width="333">
<button
follows="top|right"
height="23"
image_overlay="BackArrow_Off"
layout="topleft"
name="back_btn"
picture_style="true"
left="10"
tab_stop="false"
top="2"
width="23" />
<text
type="string"
length="1"
follows="top"
font="SansSerifHuge"
height="15"
layout="topleft"
left_pad="10"
name="title"
text_color="white"
top="5"
width="250">
Edit Classified
</text>
<scroll_container
color="DkGray2"
follows="all"
height="510"
layout="topleft"
left="10"
top_pad="10"
name="profile_scroll"
reserve_scroll_corner="false"
opaque="true"
width="313">
<panel
name="scroll_content_panel"
follows="left|top"
min_height="300"
layout="topleft"
top="0"
background_visible="false"
height="600"
left="0"
width="295">
<texture_picker
follows="left|top|right"
height="197"
width="290"
layout="topleft"
top="20"
left="10"
name="classified_snapshot" />
<button
height="18"
image_overlay="AddItem_Off"
layout="topleft"
right="-5"
name="edit_icon"
label=""
tool_tip="Click to select an image"
top="27"
width="18" />
<text
type="string"
length="1"
follows="left|top"
height="15"
font="SansSerifSmall"
font.style="BOLD"
layout="topleft"
left="10"
top="215"
name="Name:"
text_color="white"
width="290">
Title:
</text>
<line_editor
follows="left|top|right"
font="SansSerif"
height="20"
layout="topleft"
left="10"
top_pad="2"
max_length="63"
name="classified_name"
text_color="black"
width="290" />
<text
type="string"
length="1"
follows="left|top"
height="15"
font="SansSerifSmall"
font.style="BOLD"
layout="topleft"
left="10"
top_pad="20"
name="description_label"
text_color="white"
width="290">
Description:
</text>
<text_editor
follows="left|top|right"
height="100"
width="290"
hide_scrollbar="false"
layout="topleft"
left="10"
top_pad="2"
max_length="1023"
name="classified_desc"
text_color="black"
word_wrap="true" />
<text
type="string"
length="1"
font="SansSerifSmall"
font.style="BOLD"
follows="left|top"
height="15"
layout="topleft"
left="10"
name="location_label"
text_color="white"
top_pad="20"
width="290">
Location:
</text>
<text
type="string"
length="1"
follows="left|top"
height="50"
layout="topleft"
left="10"
name="classified_location"
right="-10"
top_pad="2"
width="290"
word_wrap="true">
loading...
</text>
<button
follows="left|top"
height="20"
label="Set to Current Location"
layout="topleft"
left="8"
top_pad="5"
name="set_to_curr_location_btn"
width="200" />
<combo_box
follows="left|top"
height="18"
label=""
left="10"
name="category"
top_pad="5"
width="200" />
<combo_box
allow_text_entry="false"
follows="left|top"
height="18"
left="10"
name="content_type"
top_pad="5"
width="200">
<combo_item
name="mature_ci"
value="Mature">
Mature Content
</combo_item>
<combo_item
name="pg_ci"
value="PG">
PG Content
</combo_item>
</combo_box>
<spinner
decimal_digits="0"
follows="left|top"
halign="left"
height="16"
increment="1"
label_width="20"
label="L$"
layout="topleft"
left="10"
value="50"
min_val="50"
max_val="99999"
name="price_for_listing"
top_pad="5"
tool_tip="Price for listing."
width="105" />
<check_box
height="16"
label="Auto renew each week"
layout="topleft"
left="10"
name="auto_renew"
top_pad="5"
width="250" />
</panel>
</scroll_container>
<panel
follows="left|right|bottom"
height="20"
label="bottom_panel"
layout="topleft"
left="10"
name="bottom_panel"
top_pad="5"
width="303">
<button
follows="bottom|left"
height="19"
label="Save"
layout="topleft"
name="save_changes_btn"
left="0"
top="0"
width="130" />
<button
follows="bottom|left"
height="19"
label="Cancel"
layout="topleft"
name="cancel_btn"
left_pad="5"
right="-1"
width="130" />
</panel>
</panel>