From 09964ec6ede2c9dba5954448bff6b2da2dc179af Mon Sep 17 00:00:00 2001 From: dolphin Date: Tue, 24 Sep 2013 19:10:43 -0700 Subject: Created an experience specific permissions dialog. --- indra/newview/llfloaterexperienceprofile.cpp | 4 +- indra/newview/llviewermessage.cpp | 79 ++++++++++++++++++---- .../default/xui/en/floater_experienceprofile.xml | 4 +- .../newview/skins/default/xui/en/notifications.xml | 34 ++++++++++ indra/newview/skins/default/xui/en/strings.xml | 4 +- 5 files changed, 105 insertions(+), 20 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index 01af6b1cab..f99e20f7e0 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -417,7 +417,9 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) if(properties & LLExperienceCache::PROPERTY_GRID) { topPanel->setVisible(TRUE); - getChild(TF_GRID_WIDE)->setVisible(TRUE); + child=getChild(TF_GRID_WIDE); + child->setVisible(TRUE); + child->setText(LLTrans::getString("GRID_WIDE")); } value=experience[LLExperienceCache::METADATA].asString(); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index e3335c9cd8..9be5de3433 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -115,6 +115,7 @@ #include #include "llnotificationmanager.h" // +#include "llexperiencecache.h" #if LL_MSVC // disable boost::lexical_cast warning @@ -6354,6 +6355,26 @@ bool script_question_cb(const LLSD& notification, const LLSD& response) if ( response["Mute"] ) // mute { script_question_mute(task_id,notification["payload"]["object_name"].asString()); + } + + if ( response["BlockExperience"] ) + { + if(notification["payload"].has("experience")) + { + LLViewerRegion* region = gAgent.getRegion(); + if (!region) + return false; + + std::string lookup_url=region->getCapability("ExperiencePreferences"); + if(lookup_url.empty()) + return false; + LLSD permission; + LLSD data; + permission["permission"]="Block"; + + data[notification["payload"]["experience"].asString()]=permission; + LLHTTPClient::put(lookup_url, data, NULL); + } } return false; @@ -6388,8 +6409,26 @@ void script_question_mute(const LLUUID& task_id, const std::string& object_name) static LLNotificationFunctorRegistration script_question_cb_reg_1("ScriptQuestion", script_question_cb); static LLNotificationFunctorRegistration script_question_cb_reg_2("ScriptQuestionCaution", script_question_cb); +static LLNotificationFunctorRegistration script_question_cb_reg_3("ScriptQuestionExperience", script_question_cb); static LLNotificationFunctorRegistration unknown_script_question_cb_reg("UnknownScriptQuestion", unknown_script_question_cb); + +void process_script_experience_details(const LLSD& experience_details, LLSD args, LLSD payload) +{ + if(experience_details[LLExperienceCache::PROPERTIES].asInteger() & LLExperienceCache::PROPERTY_GRID) + { + args["GRID_WIDE"] = LLTrans::getString("GRID_WIDE")+ " "; + } + else + { + args["GRID_WIDE"] = ""; + } + args["EXPERIENCE"] = LLSLURL("experience", experience_details[LLExperienceCache::EXPERIENCE_ID].asUUID(), "profile").getSLURLString(); + + LLNotificationsUtil::add("ScriptQuestionExperience", args, payload); +} + + void process_script_question(LLMessageSystem *msg, void **user_data) { // *TODO: Translate owner name -> [FIRST] [LAST] @@ -6401,6 +6440,9 @@ void process_script_question(LLMessageSystem *msg, void **user_data) S32 questions; std::string object_name; std::string owner_name; + LLUUID experienceid; + + // taskid -> object key of object requesting permissions msg->getUUIDFast(_PREHASH_Data, _PREHASH_TaskID, taskid ); @@ -6410,6 +6452,11 @@ void process_script_question(LLMessageSystem *msg, void **user_data) msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectOwner, owner_name); msg->getS32Fast(_PREHASH_Data, _PREHASH_Questions, questions ); + if(msg->has(_PREHASH_Experience)) + { + msg->getUUIDFast(_PREHASH_Experience, _PREHASH_ExperienceID, experienceid); + } + // Special case. If the objects are owned by this agent, throttle per-object instead // of per-owner. It's common for residents to reset a ton of scripts that re-request // permissions, as with tier boxes. UUIDs can't be valid agent names and vice-versa, @@ -6495,26 +6542,28 @@ void process_script_question(LLMessageSystem *msg, void **user_data) payload["object_name"] = object_name; payload["owner_name"] = owner_name; - // check whether cautions are even enabled or not - if (gSavedSettings.getBOOL("PermissionsCautionEnabled")) - { - if (caution) - { - args["FOOTERTEXT"] = (count > 1) ? LLTrans::getString("AdditionalPermissionsRequestHeader") + "\n\n" + script_question : ""; - } - // display the caution permissions prompt - LLNotificationsUtil::add(caution ? "ScriptQuestionCaution" : "ScriptQuestion", args, payload); - } - else - { - // fall back to default behavior if cautions are entirely disabled - LLNotificationsUtil::add("ScriptQuestion", args, payload); - } + + const char* notification = "ScriptQuestion"; + + if(caution && gSavedSettings.getBOOL("PermissionsCautionEnabled")) + { + args["FOOTERTEXT"] = (count > 1) ? LLTrans::getString("AdditionalPermissionsRequestHeader") + "\n\n" + script_question : ""; + notification = "ScriptQuestionCaution"; + } + else if(experienceid.notNull()) + { + payload["experience"]=experienceid; + LLExperienceCache::get(experienceid, boost::bind(process_script_experience_details, _1, args, payload)); + return; + } + + LLNotificationsUtil::add(notification, args, payload); } } } + void process_derez_container(LLMessageSystem *msg, void**) { LL_WARNS("Messaging") << "call to deprecated process_derez_container" << LL_ENDL; diff --git a/indra/newview/skins/default/xui/en/floater_experienceprofile.xml b/indra/newview/skins/default/xui/en/floater_experienceprofile.xml index a3408c5e58..ca9469474c 100644 --- a/indra/newview/skins/default/xui/en/floater_experienceprofile.xml +++ b/indra/newview/skins/default/xui/en/floater_experienceprofile.xml @@ -103,9 +103,7 @@ left="10" right="-123" visible="false" - name="grid_wide"> - Grid-wide - + name="grid_wide"/>