DD-19 : WIP : Tweak Validation messages as required by producer

meow-7.2.2
Merov Linden 2014-09-22 09:27:15 -07:00
parent 406ba92fe2
commit e9a0b93395
4 changed files with 89 additions and 62 deletions

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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);

View File

@ -242,8 +242,8 @@ Please try logging in again in a minute.</string>
<string name="TooltipOutboxLinked">You can not put linked items or folders on the marketplace</string>
<string name="TooltipOutboxCallingCard">You can not put calling cards on the marketplace</string>
<string name="TooltipOutboxFolderLevels">Depth of nested folders exceeds [AMOUNT]</string>
<string name="TooltipOutboxTooManyFolders">Subfolders count exceeds [AMOUNT]</string>
<string name="TooltipOutboxTooManyObjects">Items count exceeds [AMOUNT]</string>
<string name="TooltipOutboxTooManyFolders">Subfolder count exceeds [AMOUNT]</string>
<string name="TooltipOutboxTooManyObjects">Item count exceeds [AMOUNT]</string>
<string name="TooltipOutboxDragActive">You can't move an active listed listing</string>
<string name="TooltipOutboxCannotDropOnRoot">You can't drop items on filtered tabs root</string>
<string name="TooltipOutboxCannotMoveRoot">You can't move the marketplace listings root folder</string>
@ -2294,15 +2294,16 @@ The [[MARKETPLACE_CREATE_STORE_URL] Marketplace store] is returning errors.
<string name="Marketplace Validation Intro"></string>
<string name="Marketplace Validation Log"></string>
<string name="Marketplace Validation Warning Stock">: Warning: creating wrapping folder for stock folder</string>
<string name="Marketplace Validation Warning Stock">: Warning: stock folder must be contained by a version folder</string>
<string name="Marketplace Validation Warning Empty">: Warning: folder doesn't contain any item</string>
<string name="Marketplace Validation Warning Create Stock">: Warning: creating stock folder</string>
<string name="Marketplace Validation Warning Create Version">: Warning: creating version folder</string>
<string name="Marketplace Validation Warning Move">: Warning : moving items</string>
<string name="Marketplace Validation Warning Delete">: Warning: folder content transfered to stock folder, removing empty folder</string>
<string name="Marketplace Validation Warning Stock Item">: Warning: no-copy item must be contained by a stock folder</string>
<string name="Marketplace Validation Error">: Error: </string>
<string name="Marketplace Validation Error Empty Version">: Error: cannot list empty version folder</string>
<string name="Marketplace Validation Error Empty Stock">: Error: cannot list empty stock folder</string>
<string name="Marketplace Validation Error Empty Version">: Error: version folder must contain at least 1 item</string>
<string name="Marketplace Validation Error Empty Stock">: Error: stock folder must contain at least 1 item</string>
<string name="Marketplace Error None">No errors</string>
<string name="Marketplace Error Prefix">Error: </string>
<string name="Marketplace Error Not Merchant">Before sending items to the Marketplace you will need to set yourself up as a merchant (free of charge).</string>