diff options
author | Merov Linden <merov@lindenlab.com> | 2014-04-16 16:56:01 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2014-04-16 16:56:01 -0700 |
commit | a4f6fc8ee1a4231d2b81d28035b21b8f8b3fd8fd (patch) | |
tree | e7eddbb8207ddc673899fd3bc7ae86d654c86ea2 /indra/newview/llmarketplacefunctions.cpp | |
parent | 8bc5a7919b23bec4c1f3caf9847b4eef6b5bd793 (diff) |
DD-11 : Implement getListingURL() and parametrize it correctly. Change Show Listing to Edit Listing.
Diffstat (limited to 'indra/newview/llmarketplacefunctions.cpp')
-rwxr-xr-x | indra/newview/llmarketplacefunctions.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index b7c84dc714..4a3abe5f22 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -617,6 +617,18 @@ std::string LLMarketplaceData::getListingID(const LLUUID& folder_id) return (it == mMarketplaceItems.end() ? "" : (it->second).mListingId); } +std::string LLMarketplaceData::getListingName(const LLUUID& folder_id) +{ + std::string listing_name = ""; + marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); + if (it != mMarketplaceItems.end()) + { + // *TODO : Call the MKT API to get the name of a listing + llinfos << "Merov : Marketplace warning : No API to get Listing name for : " << folder_id << llendl; + } + return listing_name; +} + LLUUID LLMarketplaceData::getVersionFolderID(const LLUUID& folder_id) { marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id); @@ -643,6 +655,24 @@ bool LLMarketplaceData::isVersionFolder(const LLUUID& folder_id) return false; } +std::string LLMarketplaceData::getListingURL(const LLUUID& folder_id) +{ + // Get the listing id (i.e. go up the hierarchy to find the listing folder + // URL format will be something like : https://marketplace.secondlife.com/p/<listing_name>/<listing_id> + std::string marketplace_url = getMarketplaceURL("MarketplaceURL"); + + S32 depth = depth_nesting_in_marketplace(folder_id); + LLUUID listing_uuid = nested_parent_id(folder_id, depth); + std::string listing_name = getListingName(listing_uuid); + std::string listing_id = getListingID(listing_uuid); + + if (!listing_name.empty() && !listing_id.empty()) + { + marketplace_url += "p/" + listing_name + "/" + listing_id; + } + return marketplace_url; +} + // Modifiers bool LLMarketplaceData::setListingID(const LLUUID& folder_id, std::string listing_id) { |