DD-58 : Forced listing ID to be an integer throughout. Verify we get an integer when using the associate UI.

meow-7.2.2
Merov Linden 2014-04-22 20:57:49 -07:00
parent 277539e562
commit d22944da00
4 changed files with 24 additions and 21 deletions

View File

@ -563,8 +563,11 @@ void LLFloaterAssociateListing::apply()
{
if (mUUID.notNull())
{
const std::string& id = getChild<LLUICtrl>("listing_id")->getValue().asString();
LLMarketplaceData::instance().associateListing(mUUID,id);
S32 id = (S32)getChild<LLUICtrl>("listing_id")->getValue().asInteger();
if (id > 0)
{
LLMarketplaceData::instance().associateListing(mUUID,id);
}
}
closeFloater();
}

View File

@ -2057,7 +2057,7 @@ std::string LLFolderBridge::getLabelSuffix() const
// Listing folder case
if (LLMarketplaceData::instance().isListed(getUUID()))
{
suffix = LLMarketplaceData::instance().getListingID(getUUID());
suffix = llformat("%d",LLMarketplaceData::instance().getListingID(getUUID()));
if (suffix.empty())
{
suffix = LLTrans::getString("MarketplaceNoID");

View File

@ -549,7 +549,7 @@ void LLMarketplaceInventoryImporter::updateImport()
// Tuple == Item
LLMarketplaceTuple::LLMarketplaceTuple() :
mListingFolderId(),
mListingId(""),
mListingId(0),
mVersionFolderId(),
mIsActive(false)
{
@ -557,13 +557,13 @@ LLMarketplaceTuple::LLMarketplaceTuple() :
LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id) :
mListingFolderId(folder_id),
mListingId(""),
mListingId(0),
mVersionFolderId(),
mIsActive(false)
{
}
LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id, std::string listing_id, const LLUUID& version_id, bool is_listed) :
LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, bool is_listed) :
mListingFolderId(folder_id),
mListingId(listing_id),
mVersionFolderId(version_id),
@ -590,14 +590,14 @@ bool LLMarketplaceData::addListing(const LLUUID& folder_id)
// *TODO : Create the listing on SLM and get the ID (blocking?)
// For the moment, we use that wonky test ID generator...
std::string listing_id = llformat ("%d", LLMarketplaceData::instance().getTestMarketplaceID());
S32 listing_id = LLMarketplaceData::instance().getTestMarketplaceID();
setListingID(folder_id,listing_id);
update_marketplace_category(folder_id);
return true;
}
bool LLMarketplaceData::associateListing(const LLUUID& folder_id, std::string listing_id)
bool LLMarketplaceData::associateListing(const LLUUID& folder_id, S32 listing_id)
{
if (isListed(folder_id))
{
@ -653,10 +653,10 @@ bool LLMarketplaceData::getActivationState(const LLUUID& folder_id)
return false;
}
std::string LLMarketplaceData::getListingID(const LLUUID& folder_id)
S32 LLMarketplaceData::getListingID(const LLUUID& folder_id)
{
marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id);
return (it == mMarketplaceItems.end() ? "" : (it->second).mListingId);
return (it == mMarketplaceItems.end() ? 0 : (it->second).mListingId);
}
LLUUID LLMarketplaceData::getVersionFolderID(const LLUUID& folder_id)
@ -666,7 +666,7 @@ LLUUID LLMarketplaceData::getVersionFolderID(const LLUUID& folder_id)
}
// Reverse lookup : find the listing folder id from the listing id
LLUUID LLMarketplaceData::getListingFolder(std::string listing_id)
LLUUID LLMarketplaceData::getListingFolder(S32 listing_id)
{
marketplace_items_list_t::iterator it = mMarketplaceItems.begin();
while (it != mMarketplaceItems.end())
@ -708,17 +708,17 @@ std::string LLMarketplaceData::getListingURL(const LLUUID& folder_id)
S32 depth = depth_nesting_in_marketplace(folder_id);
LLUUID listing_uuid = nested_parent_id(folder_id, depth);
std::string listing_id = getListingID(listing_uuid);
S32 listing_id = getListingID(listing_uuid);
if (!listing_id.empty())
if (listing_id != 0)
{
marketplace_url += "p/listing/" + listing_id;
marketplace_url += llformat("p/listing/%d",listing_id);
}
return marketplace_url;
}
// Modifiers
bool LLMarketplaceData::setListingID(const LLUUID& folder_id, std::string listing_id)
bool LLMarketplaceData::setListingID(const LLUUID& folder_id, S32 listing_id)
{
marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id);
if (it == mMarketplaceItems.end())

View File

@ -125,12 +125,12 @@ public:
LLMarketplaceTuple();
LLMarketplaceTuple(const LLUUID& folder_id);
LLMarketplaceTuple(const LLUUID& folder_id, std::string listing_id, const LLUUID& version_id, bool is_listed = false);
LLMarketplaceTuple(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, bool is_listed = false);
private:
// Representation of a marketplace item in the Marketplace DB (well, what we know of it...)
LLUUID mListingFolderId;
std::string mListingId;
S32 mListingId;
LLUUID mVersionFolderId;
bool mIsActive;
};
@ -153,18 +153,18 @@ public:
// Create/Delete Marketplace data set : each method returns true if the function succeeds, false if error
bool addListing(const LLUUID& folder_id);
bool associateListing(const LLUUID& folder_id, std::string listing_id);
bool associateListing(const LLUUID& folder_id, S32 listing_id);
bool deleteListing(const LLUUID& folder_id);
// Access Marketplace data set : each method returns a default value if the folder_id can't be found
bool getActivationState(const LLUUID& folder_id);
std::string getListingID(const LLUUID& folder_id);
S32 getListingID(const LLUUID& folder_id);
LLUUID getVersionFolderID(const LLUUID& folder_id);
std::string getListingURL(const LLUUID& folder_id);
LLUUID getListingFolder(std::string listing_id);
LLUUID getListingFolder(S32 listing_id);
// Modify Marketplace data set : each method returns true if the function succeeds, false if error
bool setListingID(const LLUUID& folder_id, std::string listing_id);
bool setListingID(const LLUUID& folder_id, S32 listing_id);
bool setVersionFolderID(const LLUUID& folder_id, const LLUUID& version_id);
bool setActivation(const LLUUID& folder_id, bool activate);