DD-11 : Implement getListingURL() and parametrize it correctly. Change Show Listing to Edit Listing.
parent
8bc5a7919b
commit
a4f6fc8ee1
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue