From e9a0b933957d9a620011c43aa37f4c5ee5a74c2e Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 22 Sep 2014 09:27:15 -0700 Subject: [PATCH] DD-19 : WIP : Tweak Validation messages as required by producer --- .../newview/llfloatermarketplacelistings.cpp | 2 +- indra/newview/llinventoryfunctions.cpp | 136 +++++++++++------- indra/newview/llinventoryfunctions.h | 2 +- .../newview/skins/default/xui/en/strings.xml | 11 +- 4 files changed, 89 insertions(+), 62 deletions(-) diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index fb6e92165b..7784ec597c 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -671,7 +671,7 @@ void LLFloaterMarketplaceValidation::onOpen(const LLSD& key) if (marketplacelistings_id.notNull()) { LLViewerInventoryCategory* cat = gInventory.getCategory(marketplacelistings_id); - validate_marketplacelistings(cat,boost::bind(&LLFloaterMarketplaceValidation::appendMessage, this, _1, _2)); + validate_marketplacelistings(cat, boost::bind(&LLFloaterMarketplaceValidation::appendMessage, this, _1, _2), false); } } diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index ab370d6a63..dca8cabc73 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -1375,7 +1375,7 @@ bool sort_alpha(const LLViewerInventoryCategory* cat1, const LLViewerInventoryCa return cat1->getName().compare(cat2->getName()) < 0; } -bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_t cb) +bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_t cb, bool fix_hierarchy) { // Folder is valid unless issue is raised bool result = true; @@ -1391,46 +1391,51 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_ return result; } - if (depth == 1) - { - if (cb) - { - std::string message = cat->getName() + LLTrans::getString("Marketplace Validation Intro"); - cb(message,LLError::LEVEL_INFO); - } - std::string message; - if (!can_move_folder_to_marketplace(cat, cat, cat, message, 0)) - { - result = false; - if (cb) - { - message = cat->getName() + LLTrans::getString("Marketplace Validation Error") + message; - cb(message,LLError::LEVEL_ERROR); - } - } - } - std::string indent; for (int i = 1; i < depth; i++) { indent += " "; } + if (depth == 1) + { + if (cb) + { + std::string message = indent + cat->getName() + LLTrans::getString("Marketplace Validation Intro"); + cb(message,LLError::LEVEL_INFO); + } + } + else if (depth == 2) + { + std::string message; + if (!can_move_folder_to_marketplace(cat, cat, cat, message, 0)) + { + result = false; + if (cb) + { + message = indent + cat->getName() + LLTrans::getString("Marketplace Validation Error") + message; + cb(message,LLError::LEVEL_ERROR); + } + } + } + if ((folder_type == LLFolderType::FT_MARKETPLACE_STOCK) && (depth <= 2)) { - // Nest the stock folder one level deeper in a normal folder and restart from there - //LLUUID parent_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false); - LLUUID parent_uuid = cat->getParentUUID(); - LLUUID folder_uuid = gInventory.createNewCategory(parent_uuid, LLFolderType::FT_NONE, cat->getName()); if (cb) { std::string message = indent + cat->getName() + LLTrans::getString("Marketplace Validation Warning Stock"); cb(message,LLError::LEVEL_WARN); } - LLInventoryCategory* new_cat = gInventory.getCategory(folder_uuid); - gInventory.changeCategoryParent(viewer_cat, folder_uuid, false); - result &= validate_marketplacelistings(new_cat, cb); - return result; + if (fix_hierarchy) + { + // Nest the stock folder one level deeper in a normal folder and restart from there + LLUUID parent_uuid = cat->getParentUUID(); + LLUUID folder_uuid = gInventory.createNewCategory(parent_uuid, LLFolderType::FT_NONE, cat->getName()); + LLInventoryCategory* new_cat = gInventory.getCategory(folder_uuid); + gInventory.changeCategoryParent(viewer_cat, folder_uuid, false); + result &= validate_marketplacelistings(new_cat, cb, fix_hierarchy); + return result; + } } LLInventoryModel::cat_array_t* cat_array; @@ -1535,39 +1540,60 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_ { if (!items_vector[i].empty()) { - // Create a new folder - LLUUID parent_uuid = (depth > 2 ? viewer_cat->getParentUUID() : viewer_cat->getUUID()); - LLViewerInventoryItem* viewer_inv_item = items_vector[i].back(); - std::string folder_name = (depth > 1 ? viewer_cat->getName() : viewer_inv_item->getName()); - LLFolderType::EType new_folder_type = (i == LLInventoryType::IT_COUNT ? LLFolderType::FT_NONE : LLFolderType::FT_MARKETPLACE_STOCK); - if (cb) - { - std::string message = ""; - if (new_folder_type == LLFolderType::FT_MARKETPLACE_STOCK) - { - message = indent + folder_name + LLTrans::getString("Marketplace Validation Warning Create Stock"); - } - else - { - message = indent + folder_name + LLTrans::getString("Marketplace Validation Warning Create Version"); - } - cb(message,LLError::LEVEL_WARN); - } - LLUUID folder_uuid = gInventory.createNewCategory(parent_uuid, new_folder_type, folder_name); - // Move each item to the new folder - while (!items_vector[i].empty()) + if (fix_hierarchy) { + // Create a new folder + LLUUID parent_uuid = (depth > 2 ? viewer_cat->getParentUUID() : viewer_cat->getUUID()); LLViewerInventoryItem* viewer_inv_item = items_vector[i].back(); + std::string folder_name = (depth > 1 ? viewer_cat->getName() : viewer_inv_item->getName()); + LLFolderType::EType new_folder_type = (i == LLInventoryType::IT_COUNT ? LLFolderType::FT_NONE : LLFolderType::FT_MARKETPLACE_STOCK); if (cb) { - std::string message = indent + viewer_inv_item->getName() + LLTrans::getString("Marketplace Validation Warning Move"); + std::string message = ""; + if (new_folder_type == LLFolderType::FT_MARKETPLACE_STOCK) + { + message = indent + folder_name + LLTrans::getString("Marketplace Validation Warning Create Stock"); + } + else + { + message = indent + folder_name + LLTrans::getString("Marketplace Validation Warning Create Version"); + } cb(message,LLError::LEVEL_WARN); } - gInventory.changeItemParent(viewer_inv_item, folder_uuid, true); - items_vector[i].pop_back(); + LLUUID folder_uuid = gInventory.createNewCategory(parent_uuid, new_folder_type, folder_name); + // Move each item to the new folder + while (!items_vector[i].empty()) + { + LLViewerInventoryItem* viewer_inv_item = items_vector[i].back(); + if (cb) + { + std::string message = indent + viewer_inv_item->getName() + LLTrans::getString("Marketplace Validation Warning Move"); + cb(message,LLError::LEVEL_WARN); + } + gInventory.changeItemParent(viewer_inv_item, folder_uuid, true); + items_vector[i].pop_back(); + } + update_marketplace_category(folder_uuid); + gInventory.notifyObservers(); + } + else if (i != LLInventoryType::IT_COUNT) + { + // Report about misplaced no-copy items + while (!items_vector[i].empty()) + { + LLViewerInventoryItem* viewer_inv_item = items_vector[i].back(); + if (cb) + { + std::string message = indent + viewer_inv_item->getName() + LLTrans::getString("Marketplace Validation Warning Stock Item"); + cb(message,LLError::LEVEL_WARN); + } + items_vector[i].pop_back(); + } +// LLStringUtil::format_map_t args; +// U32 amount = gSavedSettings.getU32("InventoryOutboxMaxFolderDepth"); +// args["[AMOUNT]"] = llformat("%d",amount); +// tooltip_msg = LLTrans::getString("TooltipOutboxFolderLevels", args); } - update_marketplace_category(folder_uuid); - gInventory.notifyObservers(); } } // Clean up @@ -1599,7 +1625,7 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_ for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) { LLInventoryCategory* category = *iter; - result &= validate_marketplacelistings(category, cb); + result &= validate_marketplacelistings(category, cb, fix_hierarchy); } return result; diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index 76f2120415..b1ac1413cf 100755 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -80,7 +80,7 @@ bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInve bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLInventoryCategory* dest_folder, LLInventoryCategory* inv_cat, std::string& tooltip_msg, S32 bundle_size = 1); 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 validate_marketplacelistings(LLInventoryCategory* inv_cat, validation_callback_t cb = NULL); +bool validate_marketplacelistings(LLInventoryCategory* inv_cat, validation_callback_t cb = NULL, bool fix_hierarchy = true); S32 depth_nesting_in_marketplace(LLUUID cur_uuid); LLUUID nested_parent_id(LLUUID cur_uuid, S32 depth); S32 compute_stock_count(LLUUID cat_uuid); diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 99d64412c3..ea8b223a98 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -242,8 +242,8 @@ Please try logging in again in a minute. You can not put linked items or folders on the marketplace You can not put calling cards on the marketplace Depth of nested folders exceeds [AMOUNT] - Subfolders count exceeds [AMOUNT] - Items count exceeds [AMOUNT] + Subfolder count exceeds [AMOUNT] + Item count exceeds [AMOUNT] You can't move an active listed listing You can't drop items on filtered tabs root You can't move the marketplace listings root folder @@ -2294,15 +2294,16 @@ The [[MARKETPLACE_CREATE_STORE_URL] Marketplace store] is returning errors. - : Warning: creating wrapping folder for stock folder + : Warning: stock folder must be contained by a version folder : Warning: folder doesn't contain any item : Warning: creating stock folder : Warning: creating version folder : Warning : moving items : Warning: folder content transfered to stock folder, removing empty folder + : Warning: no-copy item must be contained by a stock folder : Error: - : Error: cannot list empty version folder - : Error: cannot list empty stock folder + : Error: version folder must contain at least 1 item + : Error: stock folder must contain at least 1 item No errors Error: Before sending items to the Marketplace you will need to set yourself up as a merchant (free of charge).