diff options
-rwxr-xr-x | indra/newview/llinventorybridge.cpp | 13 | ||||
-rwxr-xr-x | indra/newview/llmarketplacefunctions.cpp | 30 | ||||
-rwxr-xr-x | indra/newview/llmarketplacefunctions.h | 2 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/menu_inventory.xml | 2 |
4 files changed, 39 insertions, 8 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 374d09ce98..128f0e1b91 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1546,6 +1546,11 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action) { doActionOnCurSelectedLandmark(boost::bind(&LLItemBridge::doShowOnMap, this, _1)); } + else if ("marketplace_show_listing" == action) + { + std::string url = LLMarketplaceData::instance().getListingURL(mUUID); + LLUrlAction::openURL(url); + } } void LLItemBridge::doActionOnCurSelectedLandmark(LLLandmarkList::loaded_callback_t cb) @@ -3191,13 +3196,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) } else if ("marketplace_show_listing" == action) { - // *TODO : Need to show a browser window with the info for the listing - // Get the listing id (i.e. go up the hierarchy to find the listing folder - // Show the listing folder in a browser window - // https://marketplace.secondlife.com/p/Nounours/4438852 - // https://marketplace.secondlife.com/p/Un-autre-nounours/4447997?preview=true - // https://marketplace.secondlife.com/p/<listing_name>/<listing_id>?preview=true - std::string url("https://marketplace.secondlife.com/p/Un-autre-nounours/4447997?preview=true"); + std::string url = LLMarketplaceData::instance().getListingURL(mUUID); LLUrlAction::openURL(url); return; } 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) { diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index 0b1066a558..68f5dafbbd 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -158,7 +158,9 @@ public: // 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); + std::string getListingName(const LLUUID& folder_id); LLUUID getVersionFolderID(const LLUUID& folder_id); + std::string getListingURL(const LLUUID& folder_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); diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index 0be5509333..78418909e8 100755 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -29,7 +29,7 @@ parameter="marketplace_disassociate_listing" /> </menu_item_call> <menu_item_call - label="Show Listing" + label="Edit Listing" layout="topleft" name="Marketplace Show Listing"> <menu_item_call.on_click |