From 2a6ce118882b7ac4ce533dcd3c74f582e01bdb29 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 21 May 2014 16:40:23 -0700 Subject: DD-91, DD-84 : WIP : Verify restrictions when moving things to marketplace, provide clear alert for errors, parametrize alerts and tooltips correctly --- indra/newview/llinventorybridge.cpp | 113 +++++++-------------- indra/newview/llinventoryfunctions.cpp | 28 +++-- indra/newview/llinventoryfunctions.h | 4 +- .../skins/default/xui/en/menu_inventory.xml | 8 -- .../newview/skins/default/xui/en/notifications.xml | 13 +++ indra/newview/skins/default/xui/en/strings.xml | 7 +- 6 files changed, 78 insertions(+), 95 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 83403c53f5..bbd3f383eb 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -80,10 +80,6 @@ void copy_slurl_to_clipboard_callback_inv(const std::string& slurl); -// Marketplace outbox current disabled -#define ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU 1 -#define ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU 0 - typedef std::pair two_uuids_t; typedef std::list two_uuids_list_t; @@ -839,19 +835,6 @@ void LLInvFVBridge::addOutboxContextMenuOptions(U32 flags, { disabled_items.push_back(std::string("Rename")); } - -#if ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU - if (isOutboxFolderDirectParent()) - { - items.push_back(std::string("Marketplace Separator")); - items.push_back(std::string("Marketplace Send")); - - if ((flags & FIRST_SELECTED_ITEM) == 0) - { - disabled_items.push_back(std::string("Marketplace Send")); - } - } -#endif // ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU } void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, @@ -1324,8 +1307,6 @@ bool LLInvFVBridge::canShare() const bool LLInvFVBridge::canListOnMarketplace() const { -#if ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU - LLInventoryModel * model = getInventoryModel(); const LLViewerInventoryCategory * cat = model->getCategory(mUUID); @@ -1364,16 +1345,10 @@ bool LLInvFVBridge::canListOnMarketplace() const } return true; - -#else - return false; -#endif } bool LLInvFVBridge::canListOnMarketplaceNow() const { -#if ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU - bool can_list = true; // Do not allow listing while import is in progress @@ -1419,10 +1394,6 @@ bool LLInvFVBridge::canListOnMarketplaceNow() const } return can_list; - -#else - return false; -#endif } LLToolDragAndDrop::ESource LLInvFVBridge::getDragSource() const @@ -2540,13 +2511,21 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } } } - if (is_movable && move_is_into_outbox) + if (is_movable && move_is_into_marketplacelistings) + { + // One cannot move a folder into a stock folder + is_movable = (getPreferredType() != LLFolderType::FT_MARKETPLACE_STOCK); + } + if (is_movable && (move_is_into_outbox || move_is_into_marketplacelistings)) { - const int nested_folder_levels = get_folder_path_length(outbox_id, mUUID) + get_folder_levels(inv_cat); + const int nested_folder_levels = get_folder_path_length(outbox_id, mUUID) + get_folder_levels(inv_cat); if (nested_folder_levels > gSavedSettings.getU32("InventoryOutboxMaxFolderDepth")) { - tooltip_msg = LLTrans::getString("TooltipOutboxFolderLevels"); + LLStringUtil::format_map_t args; + U32 amount = gSavedSettings.getU32("InventoryOutboxMaxFolderDepth"); + args["[AMOUNT]"] = llformat("%d",amount); + tooltip_msg = LLTrans::getString("TooltipOutboxFolderLevels", args); is_movable = FALSE; } else @@ -2605,12 +2584,18 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, if (nested_folder_count > gSavedSettings.getU32("InventoryOutboxMaxFolderCount")) { - tooltip_msg = LLTrans::getString("TooltipOutboxTooManyFolders"); + LLStringUtil::format_map_t args; + U32 amount = gSavedSettings.getU32("InventoryOutboxMaxFolderCount"); + args["[AMOUNT]"] = llformat("%d",amount); + tooltip_msg = LLTrans::getString("TooltipOutboxTooManyFolders", args); is_movable = FALSE; } else if (nested_item_count > gSavedSettings.getU32("InventoryOutboxMaxItemCount")) { - tooltip_msg = LLTrans::getString("TooltipOutboxTooManyObjects"); + LLStringUtil::format_map_t args; + U32 amount = gSavedSettings.getU32("InventoryOutboxMaxItemCount"); + args["[AMOUNT]"] = llformat("%d",amount); + tooltip_msg = LLTrans::getString("TooltipOutboxTooManyObjects", args); is_movable = FALSE; } @@ -2628,24 +2613,6 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } } } - if (is_movable && move_is_into_marketplacelistings) - { - // One cannot move a folder into a stock folder - is_movable = (getPreferredType() != LLFolderType::FT_MARKETPLACE_STOCK); - // *TODO : Merov : Add case if (nesting depth source + depth destination) > marketplace limit -> FALSE - if (is_movable) - { - for (S32 i = 0; i < descendent_items.count(); ++i) - { - LLInventoryItem* item = descendent_items[i]; - if (!can_move_to_marketplace(item, tooltip_msg)) - { - is_movable = FALSE; - break; - } - } - } - } if (is_movable) { @@ -3271,17 +3238,6 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) const LLUUID outbox_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); copy_folder_to_outbox(cat, outbox_id, cat->getUUID(), LLToolDragAndDrop::getOperationId()); } -#if ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU - else if (isMarketplaceSendAction(action)) - { - llinfos << "Send to marketplace action!" << llendl; - - LLInventoryCategory * cat = gInventory.getCategory(mUUID); - if (!cat) return; - - send_to_marketplace(cat); - } -#endif // ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU } void LLFolderBridge::openItem() @@ -3575,7 +3531,11 @@ void LLFolderBridge::pasteFromClipboard() { if (move_is_into_marketplacelistings) { - move_item_to_marketplacelistings(viitem, parent_id); + if (!move_item_to_marketplacelistings(viitem, parent_id)) + { + // Stop pasting into the marketplace as soon as we get an error + break; + } } else { @@ -3612,7 +3572,11 @@ void LLFolderBridge::pasteFromClipboard() { if (move_is_into_marketplacelistings) { - move_item_to_marketplacelistings(viitem, parent_id, true); + if (!move_item_to_marketplacelistings(viitem, parent_id, true)) + { + // Stop pasting into the marketplace as soon as we get an error + break; + } } else { @@ -4405,9 +4369,12 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, { accept = can_move_to_landmarks(inv_item); } - else if (move_is_into_outbox) + else if (move_is_into_outbox || move_is_into_marketplacelistings) { - accept = can_move_to_marketplace(inv_item, tooltip_msg); + // Check stock folder type matches item type in marketplace listings + accept = (!move_is_into_marketplacelistings || (getCategory() && getCategory()->acceptItem(inv_item))); + + accept &= can_move_to_marketplace(inv_item, tooltip_msg); if (accept) { @@ -4427,18 +4394,14 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, if (existing_item_count > gSavedSettings.getU32("InventoryOutboxMaxItemCount")) { - tooltip_msg = LLTrans::getString("TooltipOutboxTooManyObjects"); + LLStringUtil::format_map_t args; + U32 amount = gSavedSettings.getU32("InventoryOutboxMaxItemCount"); + args["[AMOUNT]"] = llformat("%d",amount); + tooltip_msg = LLTrans::getString("TooltipOutboxTooManyObjects", args); accept = FALSE; } } } - else if (move_is_into_marketplacelistings) - { - // Check stock folder type matches item type - accept = (getCategory() && getCategory()->acceptItem(inv_item)); - // Check that the object can move into marketplace listings - accept &= can_move_to_marketplace(inv_item, tooltip_msg); - } LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE); diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index a31edfe183..8652c94407 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -914,14 +914,17 @@ S32 compute_stock_count(LLUUID cat_uuid) return curr_count; } -void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy) +bool move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy) { // Get the marketplace listings depth of the destination folder, exit with error if not under marketplace S32 depth = depth_nesting_in_marketplace(dest_folder); if (depth < 0) { llinfos << "Merov : Marketplace error : There is no marketplace listings folder -> move aborted!" << llendl; - return; + LLSD subs; + subs["[ERROR_CODE]"] = LLTrans::getString("Marketplace Error Not Merchant"); + LLNotificationsUtil::add("MerchantPasteFailed", subs); + return false; } // We will collapse links into items/folders @@ -931,7 +934,7 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol if (linked_category != NULL) { // Move the linked folder directly - move_folder_to_marketplacelistings(linked_category, dest_folder, copy); + return move_folder_to_marketplacelistings(linked_category, dest_folder, copy); } else { @@ -970,7 +973,10 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol if (!dest_cat->acceptItem(viewer_inv_item)) { llinfos << "Merov : Marketplace error : Cannot move item in that folder -> move aborted!" << llendl; - return; + LLSD subs; + subs["[ERROR_CODE]"] = LLTrans::getString("Marketplace Error Not Accepted"); + LLNotificationsUtil::add("MerchantPasteFailed", subs); + return false; } // Get the parent folder of the moved item : we may have to update it @@ -1001,13 +1007,17 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol } else { - // *TODO : signal an error to the user (UI for this TBD) llinfos << "Merov : Marketplace error : User doesn't have the correct permission to put this item on sale -> move aborted!" << llendl; + LLSD subs; + subs["[ERROR_CODE]"] = LLTrans::getString("Marketplace Error Unsellable Item"); + LLNotificationsUtil::add("MerchantPasteFailed", subs); + return false; } } + return true; } -void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, bool copy) +bool move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, bool copy) { // Check that we have adequate permission on all items being moved. Proceed if we do. if (has_correct_permissions_for_sale(inv_cat)) @@ -1019,7 +1029,10 @@ void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU if (dest_cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK) { llinfos << "Merov : Marketplace error : Cannot move folder in stock folder -> move aborted!" << llendl; - return; + LLSD subs; + subs["[ERROR_CODE]"] = LLTrans::getString("Marketplace Error Not Accepted"); + LLNotificationsUtil::add("MerchantPasteFailed", subs); + return false; } // Get the parent folder of the moved item : we may have to update it @@ -1045,6 +1058,7 @@ void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU update_marketplace_category(dest_folder); gInventory.notifyObservers(); } + return true; } // Returns true if all items within the argument folder are fit for sale, false otherwise diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index aecbe816c4..c3ace9d914 100755 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -76,8 +76,8 @@ void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_fold typedef boost::function validation_callback_t; -void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy = false); -void move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, bool copy = false); +bool move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy = false); +bool move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, bool copy = false); bool has_correct_permissions_for_sale(LLInventoryCategory* cat); void validate_marketplacelistings(LLInventoryCategory* inv_cat, validation_callback_t cb = NULL); S32 depth_nesting_in_marketplace(LLUUID cur_uuid); diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index 231e03b1bb..5e67cdf501 100755 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -793,14 +793,6 @@ parameter="copy_to_outbox" /> - - - diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 370a2af5e0..dcf53c8804 100755 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -292,6 +292,19 @@ Initialization with the Marketplace failed because of a system or network error. name="okbutton" yestext="OK"/> + + + Copy or move to Marketplace Listings failed with error : + + '[ERROR_CODE]' + + + You can only put items from your inventory on the marketplace You can not put items you are wearing on the marketplace You can not put calling cards on the marketplace - Depth of nested folders exceeds 3 - Subfolder count in top-level folder exceeds 20 - Item count in top-level folder exceeds 200 + Depth of nested folders exceeds [AMOUNT] + Subfolder count in top-level folder exceeds [AMOUNT] + Item count in top-level folder exceeds [AMOUNT] You can't move a folder into its child You can't move a folder into itself @@ -2264,6 +2264,7 @@ The [[MARKETPLACE_CREATE_STORE_URL] Marketplace store] is returning errors. No errors Error: Before sending items to the Marketplace you will need to set yourself up as a merchant (free of charge). Error: This folder has no contents. + Error: Cannot move item in that folder. Error: This item failed to upload because your merchant account has too many items unassociated with products. To fix this error, log in to the marketplace website and reduce your unassociated item count. Error: This item contains too many objects. Fix this error by placing objects together in boxes to reduce the total count to less than 200. -- cgit v1.2.3