diff options
-rwxr-xr-x | indra/newview/llfloatermarketplacelistings.cpp | 87 | ||||
-rwxr-xr-x | indra/newview/llfloatermarketplacelistings.h | 16 | ||||
-rwxr-xr-x | indra/newview/llinventorybridge.cpp | 13 | ||||
-rwxr-xr-x | indra/newview/llinventorybridge.h | 2 | ||||
-rwxr-xr-x | indra/newview/llinventoryfunctions.cpp | 36 | ||||
-rwxr-xr-x | indra/newview/llinventoryfunctions.h | 2 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/strings.xml | 1 |
7 files changed, 119 insertions, 38 deletions
diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index f9bfb606c5..229bf0b0b1 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -733,8 +733,8 @@ void LLFloaterMarketplaceValidation::draw() void LLFloaterMarketplaceValidation::onOpen(const LLSD& key) { - // Clear the text panel - mEditor->setValue(LLSD()); + // Clear the messages + clearMessages(); // Get the folder UUID to validate. Use the whole marketplace listing if none provided. LLUUID cat_id(key.asUUID()); @@ -747,8 +747,42 @@ void LLFloaterMarketplaceValidation::onOpen(const LLSD& key) if (cat_id.notNull()) { LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); - validate_marketplacelistings(cat, boost::bind(&LLFloaterMarketplaceValidation::appendMessage, this, _1, _2), false); + validate_marketplacelistings(cat, boost::bind(&LLFloaterMarketplaceValidation::appendMessage, this, _1, _2, _3), false); + } + + // Handle the listing folder being processed + handleCurrentListing(); + + // Dump result to the editor panel + if (mEditor) + { + mEditor->setValue(LLSD()); + if (mMessages.empty()) + { + // Display a no error message + mEditor->appendText(LLTrans::getString("Marketplace Validation No Error"), false); + } + else + { + // Print out all the messages to the panel + message_list_t::iterator mCurrentLine = mMessages.begin(); + bool new_line = false; + while (mCurrentLine != mMessages.end()) + { + // Errors are printed in bold, other messages in normal font + LLStyle::Params style; + LLFontDescriptor new_desc(mEditor->getFont()->getFontDesc()); + new_desc.setStyle(mCurrentLine->mErrorLevel == LLError::LEVEL_ERROR ? LLFontGL::BOLD : LLFontGL::NORMAL); + LLFontGL* new_font = LLFontGL::getFont(new_desc); + style.font = new_font; + mEditor->appendText(mCurrentLine->mMessage, new_line, style); + new_line = true; + mCurrentLine++; + } + } } + // We don't need the messages anymore + clearMessages(); } // static @@ -756,21 +790,50 @@ void LLFloaterMarketplaceValidation::onOK( void* userdata ) { // destroys this object LLFloaterMarketplaceValidation* self = (LLFloaterMarketplaceValidation*) userdata; + self->clearMessages(); self->closeFloater(); } -void LLFloaterMarketplaceValidation::appendMessage(std::string& message, LLError::ELevel log_level) +void LLFloaterMarketplaceValidation::appendMessage(std::string& message, S32 depth, LLError::ELevel log_level) { - if (mEditor) + // Dump previous listing messages if we're starting a new listing + if (depth == 1) { - // Errors are printed in bold, other messages in normal font - LLStyle::Params style; - LLFontDescriptor new_desc(mEditor->getFont()->getFontDesc()); - new_desc.setStyle(log_level == LLError::LEVEL_ERROR ? LLFontGL::BOLD : LLFontGL::NORMAL); - LLFontGL* new_font = LLFontGL::getFont(new_desc); - style.font = new_font; - mEditor->appendText(message, true, style); + handleCurrentListing(); } + + // Store the message in the current listing message list + Message current_message; + current_message.mErrorLevel = log_level; + current_message.mMessage = message; + mCurrentListingMessages.push_back(current_message); + mCurrentListingErrorLevel = (mCurrentListingErrorLevel < log_level ? log_level : mCurrentListingErrorLevel); +} + +// Move the current listing messages to the general list if needs be and reset the current listing data +void LLFloaterMarketplaceValidation::handleCurrentListing() +{ + // Dump the current folder messages to the general message list if level warrants it + if (mCurrentListingErrorLevel > LLError::LEVEL_INFO) + { + message_list_t::iterator mCurrentLine = mCurrentListingMessages.begin(); + while (mCurrentLine != mCurrentListingMessages.end()) + { + mMessages.push_back(*mCurrentLine); + mCurrentLine++; + } + } + + // Reset the current listing + mCurrentListingMessages.clear(); + mCurrentListingErrorLevel = LLError::LEVEL_INFO; +} + +void LLFloaterMarketplaceValidation::clearMessages() +{ + mMessages.clear(); + mCurrentListingMessages.clear(); + mCurrentListingErrorLevel = LLError::LEVEL_INFO; } //----------------------------------------------------------------------------- diff --git a/indra/newview/llfloatermarketplacelistings.h b/indra/newview/llfloatermarketplacelistings.h index c5c8043593..9249347877 100755 --- a/indra/newview/llfloatermarketplacelistings.h +++ b/indra/newview/llfloatermarketplacelistings.h @@ -179,10 +179,24 @@ public: virtual void draw(); virtual void onOpen(const LLSD& key); - void appendMessage(std::string& message, LLError::ELevel log_level); + void clearMessages(); + void appendMessage(std::string& message, S32 depth, LLError::ELevel log_level); static void onOK( void* userdata ); private: + struct Message { + LLError::ELevel mErrorLevel; + std::string mMessage; + }; + typedef std::vector<Message> message_list_t; + + void handleCurrentListing(); + + message_list_t mCurrentListingMessages; + LLError::ELevel mCurrentListingErrorLevel; + + message_list_t mMessages; + LLTextEditor* mEditor; }; diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index a157460ad5..c19ed57f2a 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -898,11 +898,13 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, items.push_back(std::string("Marketplace Check Listing")); items.push_back(std::string("Marketplace List")); items.push_back(std::string("Marketplace Unlist")); - if (LLMarketplaceData::instance().isUpdating(mUUID)) + if (LLMarketplaceData::instance().isUpdating(mUUID) || ((flags & FIRST_SELECTED_ITEM) == 0)) { // During SLM update, disable all marketplace related options + // Also disable all if multiple selected items disabled_items.push_back(std::string("Marketplace Create Listing")); disabled_items.push_back(std::string("Marketplace Associate Listing")); + disabled_items.push_back(std::string("Marketplace Check Listing")); disabled_items.push_back(std::string("Marketplace List")); disabled_items.push_back(std::string("Marketplace Unlist")); } @@ -952,9 +954,10 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, { items.push_back(std::string("Marketplace Activate")); items.push_back(std::string("Marketplace Deactivate")); - if (LLMarketplaceData::instance().isUpdating(mUUID)) + if (LLMarketplaceData::instance().isUpdating(mUUID) || ((flags & FIRST_SELECTED_ITEM) == 0)) { // During SLM update, disable all marketplace related options + // Also disable all if multiple selected items disabled_items.push_back(std::string("Marketplace Activate")); disabled_items.push_back(std::string("Marketplace Deactivate")); } @@ -3051,7 +3054,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) LLUUID version_folder_id = LLMarketplaceData::instance().getVersionFolder(mUUID); LLViewerInventoryCategory* cat = gInventory.getCategory(version_folder_id); mMessage = ""; - if (!validate_marketplacelistings(cat,boost::bind(&LLFolderBridge::gatherMessage, this, _1, _2))) + if (!validate_marketplacelistings(cat,boost::bind(&LLFolderBridge::gatherMessage, this, _1, _2, _3))) { LLSD subs; subs["[ERROR_CODE]"] = mMessage; @@ -3151,14 +3154,14 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) } } -void LLFolderBridge::gatherMessage(std::string& message, LLError::ELevel log_level) +void LLFolderBridge::gatherMessage(std::string& message, S32 depth, LLError::ELevel log_level) { if (log_level >= LLError::LEVEL_ERROR) { if (!mMessage.empty()) { // Currently, we do not gather all messages as it creates very long alerts - // Users can get to the whole list of errors on a listing using the "Check for Errors" audit button + // Users can get to the whole list of errors on a listing using the "Check for Errors" audit button or "Check listing" right click menu //mMessage += "\n"; return; } diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 641d30040b..82cabf43db 100755 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -365,7 +365,7 @@ public: protected: void callback_pasteFromClipboard(const LLSD& notification, const LLSD& response); void perform_pasteFromClipboard(); - void gatherMessage(std::string& message, LLError::ELevel log_level); + void gatherMessage(std::string& message, S32 depth, LLError::ELevel log_level); LLUIImagePtr getFolderIcon(BOOL is_open) const; bool mCallingCards; diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index eab9e027b4..cb41111b6f 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -1513,7 +1513,7 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_ if (cb) { message = indent + cat->getName() + LLTrans::getString("Marketplace Validation Error") + " " + message; - cb(message,LLError::LEVEL_ERROR); + cb(message,depth,LLError::LEVEL_ERROR); } } } @@ -1526,7 +1526,7 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_ if (cb) { std::string message = indent + cat->getName() + LLTrans::getString("Marketplace Validation Warning") + " " + LLTrans::getString("Marketplace Validation Warning Stock"); - cb(message,LLError::LEVEL_WARN); + cb(message,depth,LLError::LEVEL_WARN); } // Nest the stock folder one level deeper in a normal folder and restart from there LLUUID parent_uuid = cat->getParentUUID(); @@ -1542,7 +1542,7 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_ if (cb) { std::string message = indent + cat->getName() + LLTrans::getString("Marketplace Validation Error") + " " + LLTrans::getString("Marketplace Validation Warning Stock"); - cb(message,LLError::LEVEL_ERROR); + cb(message,depth,LLError::LEVEL_ERROR); } } } @@ -1576,7 +1576,7 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_ if (cb && fix_hierarchy) { std::string message = indent + viewer_inv_item->getName() + LLTrans::getString("Marketplace Validation Error") + " " + error_msg; - cb(message,LLError::LEVEL_ERROR); + cb(message,depth,LLError::LEVEL_ERROR); } continue; } @@ -1613,7 +1613,7 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_ if (cb) { std::string message = indent + cat->getName() + LLTrans::getString("Marketplace Validation Error Empty Version"); - cb(message,LLError::LEVEL_WARN); + cb(message,depth,LLError::LEVEL_WARN); } } else if ((folder_type == LLFolderType::FT_MARKETPLACE_STOCK) && (depth > 2)) @@ -1622,14 +1622,14 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_ if (cb) { std::string message = indent + cat->getName() + LLTrans::getString("Marketplace Validation Error Empty Stock"); - cb(message,LLError::LEVEL_WARN); + cb(message,depth,LLError::LEVEL_WARN); } } else if (cb) { // We warn if there's nothing in a regular folder (may be it's an under construction listing) std::string message = indent + cat->getName() + LLTrans::getString("Marketplace Validation Warning Empty"); - cb(message,LLError::LEVEL_WARN); + cb(message,depth,LLError::LEVEL_WARN); } } else @@ -1638,7 +1638,7 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_ if (cb && result && (depth >= 1)) { std::string message = indent + cat->getName() + LLTrans::getString("Marketplace Validation Log"); - cb(message,LLError::LEVEL_INFO); + cb(message,depth,LLError::LEVEL_INFO); } } } @@ -1649,7 +1649,7 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_ if (cb && result && (depth >= 1)) { std::string message = indent + cat->getName() + LLTrans::getString("Marketplace Validation Log"); - cb(message,LLError::LEVEL_INFO); + cb(message,depth,LLError::LEVEL_INFO); } } else @@ -1677,7 +1677,7 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_ { message = indent + folder_name + LLTrans::getString("Marketplace Validation Warning Create Version"); } - cb(message,LLError::LEVEL_WARN); + cb(message,depth,LLError::LEVEL_WARN); } LLUUID folder_uuid = gInventory.createNewCategory(parent_uuid, new_folder_type, folder_name); // Move each item to the new folder @@ -1687,7 +1687,7 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_ if (cb) { std::string message = indent + viewer_inv_item->getName() + LLTrans::getString("Marketplace Validation Warning Move"); - cb(message,LLError::LEVEL_WARN); + cb(message,depth,LLError::LEVEL_WARN); } gInventory.changeItemParent(viewer_inv_item, folder_uuid, true); items_vector[i].pop_back(); @@ -1720,20 +1720,20 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_ // Report if a stock folder contains a mix of items result = false; std::string message = indent + cat->getName() + LLTrans::getString("Marketplace Validation Error Mixed Stock"); - cb(message,LLError::LEVEL_ERROR); + cb(message,depth,LLError::LEVEL_ERROR); } else if ((folder_type == LLFolderType::FT_MARKETPLACE_STOCK) && (cat_array->size() != 0)) { // Report if a stock folder contains subfolders result = false; std::string message = indent + cat->getName() + LLTrans::getString("Marketplace Validation Error Subfolder In Stock"); - cb(message,LLError::LEVEL_ERROR); + cb(message,depth,LLError::LEVEL_ERROR); } else { // Simply print the folder name std::string message = indent + cat->getName() + LLTrans::getString("Marketplace Validation Log"); - cb(message,LLError::LEVEL_INFO); + cb(message,depth,LLError::LEVEL_INFO); } } // Scan each item and report if there's a problem @@ -1748,20 +1748,20 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_ // Report items that shouldn't be there to start with result = false; std::string message = indent + " " + viewer_inv_item->getName() + LLTrans::getString("Marketplace Validation Error") + " " + error_msg; - cb(message,LLError::LEVEL_ERROR); + cb(message,depth,LLError::LEVEL_ERROR); } else if ((!viewer_inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) && (folder_type != LLFolderType::FT_MARKETPLACE_STOCK)) { // Report stock items that are misplaced result = false; std::string message = indent + " " + viewer_inv_item->getName() + LLTrans::getString("Marketplace Validation Error Stock Item"); - cb(message,LLError::LEVEL_ERROR); + cb(message,depth,LLError::LEVEL_ERROR); } else if (depth == 1) { // Report items not wrapped in version folder std::string message = indent + " " + viewer_inv_item->getName() + LLTrans::getString("Marketplace Validation Warning Unwrapped Item"); - cb(message,LLError::LEVEL_WARN); + cb(message,depth,LLError::LEVEL_WARN); } } } @@ -1773,7 +1773,7 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_ if (cb) { std::string message = indent + viewer_cat->getName() + LLTrans::getString("Marketplace Validation Warning Delete"); - cb(message,LLError::LEVEL_WARN); + cb(message,depth,LLError::LEVEL_WARN); } gInventory.removeCategory(cat->getUUID()); gInventory.notifyObservers(); diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index b2497fb055..ef6d76dfdd 100755 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -74,7 +74,7 @@ void copy_item_to_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, const LL void move_item_within_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, S32 operation_id); void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, const LLUUID& top_level_folder, S32 operation_id); -typedef boost::function<void(std::string& validation_message, LLError::ELevel log_level)> validation_callback_t; +typedef boost::function<void(std::string& validation_message, S32 depth, LLError::ELevel log_level)> validation_callback_t; bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInventoryCategory* dest_folder, LLInventoryItem* inv_item, std::string& tooltip_msg, S32 bundle_size = 1, bool from_paste = false); 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 check_items = true, bool from_paste = false); diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 6e4ab3067c..fe2112728d 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2313,6 +2313,7 @@ This feature is currently in Beta. Please add your name to this [http://goo.gl/f <string name="Marketplace Validation Warning">: Warning: </string> <string name="Marketplace Validation Error Empty Version">: Warning: version folder must contain at least 1 item</string> <string name="Marketplace Validation Error Empty Stock">: Warning: stock folder must contain at least 1 item</string> + <string name="Marketplace Validation No Error">No error or warning to report</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> |