From eebee9b7c13f877f8d94ef4ca272d8915393b493 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Sat, 14 Jun 2014 15:32:50 -0400 Subject: [PATCH] [STORM-68b] Default permissions floater overhaul Adds separated default permissions for Objects, Uploads, Scripts, Notecards, Gestures and Wearables. Compatible with Export Permission Backwards compatible with default permissions for objects on regions where AgentPreferences capability is not available (opensim users rejoice!) These changes to llfloaterperms are made available under lgpl, if there's a v3 that wants to adopt default export permission for opensim. --- indra/llmessage/aihttptimeoutpolicy.cpp | 1 + indra/newview/app_settings/settings.xml | 474 ++++++++++++++---- .../app_settings/settings_per_account.xml | 77 +++ indra/newview/ascentprefssys.cpp | 28 +- indra/newview/importtracker.cpp | 18 +- indra/newview/llagentwearables.cpp | 53 +- indra/newview/llfloaterbvhpreview.cpp | 2 +- indra/newview/llfloatergesture.cpp | 53 +- indra/newview/llfloaternamedesc.cpp | 5 +- indra/newview/llfloaterperms.cpp | 382 +++++++++----- indra/newview/llfloaterperms.h | 54 +- indra/newview/llfloatersnapshot.cpp | 4 +- indra/newview/llinventoryactions.cpp | 6 +- indra/newview/llmenucommands.cpp | 2 +- indra/newview/llmeshrepository.cpp | 6 +- indra/newview/llpanelcontents.cpp | 8 +- indra/newview/llpreviewscript.cpp | 2 +- indra/newview/llstartup.cpp | 27 + indra/newview/llviewerinventory.cpp | 135 +++-- indra/newview/llviewermenufile.cpp | 31 +- indra/newview/llviewerobject.cpp | 1 + indra/newview/llviewerobjectbackup.cpp | 4 +- indra/newview/llviewerregion.cpp | 4 + .../skins/default/xui/de/notifications.xml | 2 - .../default/xui/en-us/floater_perm_prefs.xml | 76 ++- .../skins/default/xui/en-us/notifications.xml | 18 +- .../en-us/panel_preferences_ascent_system.xml | 12 +- .../skins/default/xui/es/notifications.xml | 4 - .../skins/default/xui/fr/notifications.xml | 4 - .../skins/default/xui/it/notifications.xml | 3 - .../skins/default/xui/pt/notifications.xml | 4 - 31 files changed, 1119 insertions(+), 381 deletions(-) diff --git a/indra/llmessage/aihttptimeoutpolicy.cpp b/indra/llmessage/aihttptimeoutpolicy.cpp index b9052f12f..804b7405b 100644 --- a/indra/llmessage/aihttptimeoutpolicy.cpp +++ b/indra/llmessage/aihttptimeoutpolicy.cpp @@ -934,6 +934,7 @@ P(fetchScriptLimitsRegionDetailsResponder); P(fetchScriptLimitsRegionInfoResponder); P(fetchScriptLimitsRegionSummaryResponder); P(fnPtrResponder); +P(floaterPermsResponder); P2(gamingDataReceived, transfer_22s_connect_10s); P2(groupMemberDataResponder, transfer_300s); P2(groupProposalBallotResponder, transfer_300s); diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index e24759e76..c4d084bfb 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6553,17 +6553,6 @@ This should be as low as possible, but too low may break functionality Value 175 - EveryoneCopy - - Comment - Everyone can copy the newly created objects - Persist - 1 - Type - Boolean - Value - 0 - FPSLogFrequency Comment @@ -10861,39 +10850,6 @@ This should be as low as possible, but too low may break functionality Value 20 - NextOwnerCopy - - Comment - Newly created objects can be copied by next owner - Persist - 1 - Type - Boolean - Value - 0 - - NextOwnerModify - - Comment - Newly created objects can be modified by next owner - Persist - 1 - Type - Boolean - Value - 0 - - NextOwnerTransfer - - Comment - Newly created objects can be resold or given away by next owner - Persist - 1 - Type - Boolean - Value - 1 - NewCacheLocation Comment @@ -14549,39 +14505,6 @@ This should be as low as possible, but too low may break functionality Value 0 - ScriptNextOwnerCopy - - Comment - Newly created scripts can be copied by next owner - Persist - 1 - Type - Boolean - Value - 0 - - ScriptNextOwnerModify - - Comment - Newly created scripts can be modified by next owner - Persist - 1 - Type - Boolean - Value - 0 - - ScriptNextOwnerTransfer - - Comment - Newly created scripts can be resold or given away by next owner - Persist - 1 - Type - Boolean - Value - 1 - SearchURLDefault Comment @@ -14744,17 +14667,6 @@ This should be as low as possible, but too low may break functionality Value 0 - ShareWithGroup - - Comment - Newly created objects are shared with the currently active group - Persist - 1 - Type - Boolean - Value - 0 - ShowActiveSpeakers Comment @@ -17991,6 +17903,336 @@ This should be as low as possible, but too low may break functionality 0 + ObjectsNextOwnerCopy + + Comment + Newly created objects can be copied by next owner + Persist + 1 + Type + Boolean + Value + 0 + + ObjectsNextOwnerModify + + Comment + Newly created objects can be modified by next owner + Persist + 1 + Type + Boolean + Value + 0 + + ObjectsNextOwnerTransfer + + Comment + Newly created objects can be resold or given away by next owner + Persist + 1 + Type + Boolean + Value + 1 + + ObjectsEveryoneCopy + + Comment + Everyone can copy the newly created object + Persist + 1 + Type + Boolean + Value + 0 + + ObjectsShareWithGroup + + Comment + Newly created objects are shared with the currently active group + Persist + 1 + Type + Boolean + Value + 0 + + UploadsNextOwnerCopy + + Comment + Newly uploaded items can be copied by next owner + Persist + 1 + Type + Boolean + Value + 0 + + UploadsNextOwnerModify + + Comment + Newly uploaded items can be modified by next owner + Persist + 1 + Type + Boolean + Value + 0 + + UploadsNextOwnerTransfer + + Comment + Newly uploaded items can be resold or given away by next owner + Persist + 1 + Type + Boolean + Value + 1 + + UploadsEveryoneCopy + + Comment + Everyone can copy the newly uploaded item + Persist + 1 + Type + Boolean + Value + 0 + + UploadsShareWithGroup + + Comment + Newly uploaded items are shared with the currently active group + Persist + 1 + Type + Boolean + Value + 0 + + ScriptsNextOwnerCopy + + Comment + Newly created scripts can be copied by next owner + Persist + 1 + Type + Boolean + Value + 0 + + ScriptsNextOwnerModify + + Comment + Newly created scripts can be modified by next owner + Persist + 1 + Type + Boolean + Value + 0 + + ScriptsNextOwnerTransfer + + Comment + Newly created scripts can be resold or given away by next owner + Persist + 1 + Type + Boolean + Value + 1 + + ScriptsEveryoneCopy + + Comment + Everyone can copy the newly created script + Persist + 1 + Type + Boolean + Value + 0 + + ScriptsShareWithGroup + + Comment + Newly created scripts are shared with the currently active group + Persist + 1 + Type + Boolean + Value + 0 + + NotecardsNextOwnerCopy + + Comment + Newly created notecards can be copied by next owner + Persist + 1 + Type + Boolean + Value + 1 + + NotecardsNextOwnerModify + + Comment + Newly created notecards can be modified by next owner + Persist + 1 + Type + Boolean + Value + 1 + + NotecardsNextOwnerTransfer + + Comment + Newly created notecards can be resold or given away by next owner + Persist + 1 + Type + Boolean + Value + 1 + + NotecardsEveryoneCopy + + Comment + Everyone can copy the newly created notecard + Persist + 1 + Type + Boolean + Value + 0 + + NotecardsShareWithGroup + + Comment + Newly created scripts are shared with the currently active group + Persist + 1 + Type + Boolean + Value + 0 + + GesturesNextOwnerCopy + + Comment + Newly created gestures can be copied by next owner + Persist + 1 + Type + Boolean + Value + 1 + + GesturesNextOwnerModify + + Comment + Newly created gestures can be modified by next owner + Persist + 1 + Type + Boolean + Value + 1 + + GesturesNextOwnerTransfer + + Comment + Newly created gestures can be resold or given away by next owner + Persist + 1 + Type + Boolean + Value + 1 + + GesturesEveryoneCopy + + Comment + Everyone can copy the newly created gesture + Persist + 1 + Type + Boolean + Value + 0 + + GesturesShareWithGroup + + Comment + Newly created gestures are shared with the currently active group + Persist + 1 + Type + Boolean + Value + 0 + + WearablesNextOwnerCopy + + Comment + Newly created clothing or body part can be copied by next owner + Persist + 1 + Type + Boolean + Value + 0 + + WearablesNextOwnerModify + + Comment + Newly created clothing or body part can be modified by next owner + Persist + 1 + Type + Boolean + Value + 0 + + WearablesNextOwnerTransfer + + Comment + Newly created clothing or body part can be resold or given away by next owner + Persist + 1 + Type + Boolean + Value + 1 + + WearablesEveryoneCopy + + Comment + Everyone can copy the newly created clothing or body part + Persist + 1 + Type + Boolean + Value + 0 + + WearablesShareWithGroup + + Comment + Newly created clothing or body part is shared with the currently active group + Persist + 1 + Type + Boolean + Value + 0 + SimulateFBOFailure Comment @@ -18263,6 +18505,62 @@ This should be as low as possible, but too low may break functionality Value 0 + + EveryoneCopy + + Comment + (obsolete) Everyone can copy the newly created objects + Persist + 1 + Type + Boolean + Value + 0 + + NextOwnerCopy + + Comment + (obsolete) Newly created objects can be copied by next owner + Persist + 1 + Type + Boolean + Value + 0 + + NextOwnerModify + + Comment + (obsolete) Newly created objects can be modified by next owner + Persist + 1 + Type + Boolean + Value + 0 + + NextOwnerTransfer + + Comment + (obsolete) Newly created objects can be resold or given away by next owner + Persist + 1 + Type + Boolean + Value + 1 + + ShareWithGroup + + Comment + (obsolete) Newly created objects are shared with the currently active group + Persist + 1 + Type + Boolean + Value + 0 + diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index 232dabe52..d5c721237 100644 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -463,7 +463,40 @@ + DefaultUploadPermissionsConverted + + Comment + Default upload permissions have been converted to default creation permissions + Persist + 1 + Type + Boolean + Value + 0 + EveryoneExport + + Comment + (obsolete) Whether content you upload has exportability permission by default + Persist + 1 + Type + Boolean + Value + 0 + + ObjectsEveryoneExport + + Comment + Whether objects you create have exportability permission by default + Persist + 1 + Type + Boolean + Value + 0 + + UploadsEveryoneExport Comment Whether content you upload has exportability permission by default @@ -474,6 +507,50 @@ Value 0 + ScriptsEveryoneExport + + Comment + Whether scripts you make have exportability permission by default + Persist + 1 + Type + Boolean + Value + 0 + + NotecardsEveryoneExport + + Comment + Whether notecards you make have exportability permission by default + Persist + 1 + Type + Boolean + Value + 0 + + GesturesEveryoneExport + + Comment + Whether gestures you make have exportability permission by default + Persist + 1 + Type + Boolean + Value + 0 + + WearablesEveryoneExport + + Comment + Whether wearables you make have exportability permission by default + Persist + 1 + Type + Boolean + Value + 0 + RLVaLoginLastLocation Comment diff --git a/indra/newview/ascentprefssys.cpp b/indra/newview/ascentprefssys.cpp index 47a58591e..2170d0824 100644 --- a/indra/newview/ascentprefssys.cpp +++ b/indra/newview/ascentprefssys.cpp @@ -121,11 +121,11 @@ void LLPrefsAscentSys::onCommitCheckBox(LLUICtrl* ctrl, const LLSD& value) } else if (name == "next_owner_copy") { - if (!enabled) gSavedSettings.setBOOL("NextOwnerTransfer", true); + if (!enabled) gSavedSettings.setBOOL("ObjectsNextOwnerTransfer", true); } else if (name == "script_next_owner_copy") { - if (!enabled) gSavedSettings.setBOOL("ScriptNextOwnerTransfer", true); + if (!enabled) gSavedSettings.setBOOL("ScriptsNextOwnerTransfer", true); } } @@ -214,12 +214,12 @@ void LLPrefsAscentSys::refreshValues() mGlow = gSavedSettings.getF32("EmeraldBuildPrefs_Glow"); mItem = gSavedPerAccountSettings.getString("EmeraldBuildPrefs_Item"); mMaterial = gSavedSettings.getString("BuildPrefs_Material"); - mNextCopy = gSavedSettings.getBOOL("NextOwnerCopy"); - mNextMod = gSavedSettings.getBOOL("NextOwnerModify"); - mNextTrans = gSavedSettings.getBOOL("NextOwnerTransfer"); - mScriptNextCopy = gSavedSettings.getBOOL("ScriptNextOwnerCopy"); - mScriptNextMod = gSavedSettings.getBOOL("ScriptNextOwnerModify"); - mScriptNextTrans = gSavedSettings.getBOOL("ScriptNextOwnerTransfer"); + mNextCopy = gSavedSettings.getBOOL("ObjectsNextOwnerCopy"); + mNextMod = gSavedSettings.getBOOL("ObjectsNextOwnerModify"); + mNextTrans = gSavedSettings.getBOOL("ObjectsNextOwnerTransfer"); + mScriptNextCopy = gSavedSettings.getBOOL("ScriptsNextOwnerCopy"); + mScriptNextMod = gSavedSettings.getBOOL("ScriptsNextOwnerModify"); + mScriptNextTrans = gSavedSettings.getBOOL("ScriptsNextOwnerTransfer"); mShiny = gSavedSettings.getString("EmeraldBuildPrefs_Shiny"); mTemporary = gSavedSettings.getBOOL("EmeraldBuildPrefs_Temporary"); mTexture = gSavedSettings.getString("EmeraldBuildPrefs_Texture"); @@ -356,12 +356,12 @@ void LLPrefsAscentSys::cancel() gSavedSettings.setF32("EmeraldBuildPrefs_Glow", mGlow); gSavedPerAccountSettings.setString("EmeraldBuildPrefs_Item", mItem); gSavedSettings.setString("BuildPrefs_Material", mMaterial); - gSavedSettings.setBOOL("NextOwnerCopy", mNextCopy); - gSavedSettings.setBOOL("NextOwnerModify", mNextMod); - gSavedSettings.setBOOL("NextOwnerTransfer", mNextTrans); - gSavedSettings.setBOOL("ScriptNextOwnerCopy", mScriptNextCopy); - gSavedSettings.setBOOL("ScriptNextOwnerModify", mScriptNextMod); - gSavedSettings.setBOOL("ScriptNextOwnerTransfer", mScriptNextTrans); + gSavedSettings.setBOOL("ObjectsNextOwnerCopy", mNextCopy); + gSavedSettings.setBOOL("ObjectsNextOwnerModify", mNextMod); + gSavedSettings.setBOOL("ObjectsNextOwnerTransfer", mNextTrans); + gSavedSettings.setBOOL("ScriptsNextOwnerCopy", mScriptNextCopy); + gSavedSettings.setBOOL("ScriptsNextOwnerModify", mScriptNextMod); + gSavedSettings.setBOOL("ScriptsNextOwnerTransfer", mScriptNextTrans); gSavedSettings.setBOOL("EmeraldBuildPrefs_Phantom", mPhantom); gSavedSettings.setBOOL("EmeraldBuildPrefs_Physical", mPhysical); gSavedSettings.setString("EmeraldBuildPrefs_Shiny", mShiny); diff --git a/indra/newview/importtracker.cpp b/indra/newview/importtracker.cpp index f66a952ef..4b8a7e843 100644 --- a/indra/newview/importtracker.cpp +++ b/indra/newview/importtracker.cpp @@ -226,7 +226,9 @@ void ImportTracker::get_update(S32 newid, BOOL justCreated, BOOL createSelected) } } } - + + // Anything below here must be permissions!!! + if (gAgent.getRegion()->getCapability("AgentPreferences").empty()) break; // This cap automates perm setting on the server msg->newMessageFast(_PREHASH_ObjectPermissions); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); @@ -238,16 +240,16 @@ void ImportTracker::get_update(S32 newid, BOOL justCreated, BOOL createSelected) msg->addU8Fast(_PREHASH_Field, PERM_NEXT_OWNER); msg->addU8Fast(_PREHASH_Set, PERM_SET_TRUE); U32 flags = 0; - if ( gSavedSettings.getBOOL("NextOwnerCopy") ) + if ( gSavedSettings.getBOOL("ObjectsNextOwnerCopy") ) { flags |= PERM_COPY; } - if ( gSavedSettings.getBOOL("NextOwnerModify") ) + if ( gSavedSettings.getBOOL("ObjectsNextOwnerModify") ) { flags |= PERM_MODIFY; } bool next_owner_trans; - if ( next_owner_trans = gSavedSettings.getBOOL("NextOwnerTransfer") ) + if ( next_owner_trans = gSavedSettings.getBOOL("ObjectsNextOwnerTransfer") ) { flags |= PERM_TRANSFER; } @@ -399,7 +401,7 @@ public: create_inventory_item(gAgent.getID(), gAgent.getSessionID(), gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH), data->tid, data->name, data->description, data->type, LLInventoryType::defaultForAssetType(data->type), data->wear_type, - LLFloaterPerms::getNextOwnerPerms(), + LLFloaterPerms::getNextOwnerPerms("Uploads"), cb); } @@ -542,7 +544,7 @@ void JCImportInventorycallback(const LLUUID& uuid, void* user_data, S32 result, create_inventory_item(gAgent.getID(), gAgent.getSessionID(), gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH), data->tid, data->name, data->description, data->type, LLInventoryType::defaultForAssetType(data->type), data->wear_type, - LLFloaterPerms::getNextOwnerPerms(), + LLFloaterPerms::getNextOwnerPerms("Uploads"), cb); }else cmdline_printchat("err: "+std::string(LLAssetStorage::getErrorString(result))); } @@ -690,7 +692,7 @@ void ImportTracker::send_inventory(LLSD& prim) create_inventory_item(gAgent.getID(), gAgent.getSessionID(), gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH), data->tid, data->name, data->description, data->type, LLInventoryType::defaultForAssetType(data->type), data->wear_type, - LLFloaterPerms::getNextOwnerPerms(), + LLFloaterPerms::getNextOwnerPerms("Notecards"), cb); } break; @@ -702,7 +704,7 @@ void ImportTracker::send_inventory(LLSD& prim) create_inventory_item(gAgent.getID(), gAgent.getSessionID(), gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH), data->tid, data->name, data->description, data->type, LLInventoryType::defaultForAssetType(data->type), data->wear_type, - LLFloaterPerms::getNextOwnerPerms(), + LLFloaterPerms::getNextOwnerPerms("Scripts"), cb); } break; diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 9b0132be7..c91147d8f 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -50,6 +50,7 @@ #include "llwearablelist.h" #include "llfloatercustomize.h" +#include "llfloaterperms.h" // [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1) @@ -77,7 +78,20 @@ using namespace LLAvatarAppearanceDefines; void wear_and_edit_cb(const LLUUID& inv_item) { if (inv_item.isNull()) return; - + + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + if (!item) return; + + LLPermissions perm = item->getPermissions(); + perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Wearables")); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Wearables")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Wearables")); + item->setPermissions(perm); + + item->updateServer(FALSE); + gInventory.updateItem(item); + gInventory.notifyObservers(); + // Request editing the item after it gets worn. gAgentWearables.requestEditingWearable(inv_item); @@ -85,6 +99,26 @@ void wear_and_edit_cb(const LLUUID& inv_item) LLAppearanceMgr::instance().wearItemOnAvatar(inv_item); } +void wear_cb(const LLUUID& inv_item) +{ + if (!inv_item.isNull()) + { + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + if (item) + { + LLPermissions perm = item->getPermissions(); + perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Wearables")); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Wearables")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Wearables")); + item->setPermissions(perm); + + item->updateServer(FALSE); + gInventory.updateItem(item); + gInventory.notifyObservers(); + } + } +} + /////////////////////////////////////////////////////////////////////////////// // HACK: For EXT-3923: Pants item shows in inventory with skin icon and messes with "current look" @@ -502,6 +536,7 @@ LLViewerWearable* LLAgentWearables::saveWearableAs(const LLWearableType::EType t old_wearable, trunc_name, trunc_description); + LLPointer cb = new addWearableToAgentInventoryCallback( LLPointer(NULL), @@ -1976,7 +2011,7 @@ void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, con LLViewerWearable* wearable = LLWearableList::instance().createNewWearable(type, gAgentAvatarp); LLAssetType::EType asset_type = wearable->getAssetType(); LLInventoryType::EType inv_type = LLInventoryType::IT_WEARABLE; - LLPointer cb = wear ? new LLBoostFuncInventoryCallback(wear_and_edit_cb) : NULL; + LLPointer cb = new LLBoostFuncInventoryCallback(wear ? wear_and_edit_cb : wear_cb); LLUUID folder_id; if (parent_id.notNull()) @@ -1989,10 +2024,16 @@ void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, con folder_id = gInventory.findCategoryUUIDForType(folder_type); } - create_inventory_item(gAgent.getID(), gAgent.getSessionID(), - folder_id, wearable->getTransactionID(), wearable->getName(), - wearable->getDescription(), asset_type, inv_type, wearable->getType(), - wearable->getPermissions().getMaskNextOwner(), + create_inventory_item(gAgent.getID(), + gAgent.getSessionID(), + folder_id, + wearable->getTransactionID(), + wearable->getName(), + wearable->getDescription(), + asset_type, + inv_type, + wearable->getType(), + LLFloaterPerms::getNextOwnerPerms("Wearables"), cb); } diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index 251397fa6..f4f1ceec6 100644 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -1269,7 +1269,7 @@ void LLFloaterBvhPreview::onBtnOK(void* userdata) 0, LLFolderType::FT_NONE, LLInventoryType::IT_ANIMATION, - LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), + LLFloaterPerms::getNextOwnerPerms("Uploads"), LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), name, callback, expected_upload_cost, userdata); } diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index 7e2ad97c3..bd5cf9d07 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -34,32 +34,24 @@ #include "llfloatergesture.h" -#include "lldir.h" #include "llinventory.h" #include "llmultigesture.h" #include "llagent.h" -#include "llviewerwindow.h" -#include "llbutton.h" -#include "llcombobox.h" -#include "llgesturemgr.h" #include "llfloaterinventory.h" +#include "llfloaterperms.h" +#include "llgesturemgr.h" #include "llinventorymodel.h" #include "llinventorypanel.h" #include "llkeyboard.h" -#include "lllineeditor.h" #include "llpreviewgesture.h" -#include "llresizehandle.h" -#include "llscrollbar.h" -#include "llscrollcontainer.h" #include "llscrolllistctrl.h" -#include "lltextbox.h" #include "lluictrlfactory.h" #include "llviewergesture.h" -#include "llviewertexturelist.h" #include "llviewerinventory.h" +#include "llviewertexturelist.h" +#include "llviewerwindow.h" #include "llvoavatar.h" -#include "llviewercontrol.h" // static LLFloaterGesture* LLFloaterGesture::sInstance = NULL; @@ -367,27 +359,38 @@ void LLFloaterGesture::onClickPlay(void* data) class GestureShowCallback : public LLInventoryCallback { public: - GestureShowCallback(std::string &title) - { - mTitle = title; - } void fire(const LLUUID &inv_item) { - LLPreviewGesture::show(mTitle, inv_item, LLUUID::null); + LLPreviewGesture::show("Gesture: New Gesture", inv_item, LLUUID::null); + + LLInventoryItem* item = gInventory.getItem(inv_item); + if (item) + { + LLPermissions perm = item->getPermissions(); + perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Gestures")); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Gestures")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Gestures")); + item->setPermissions(perm); + item->updateServer(FALSE); + } } -private: - std::string mTitle; }; // static void LLFloaterGesture::onClickNew(void* data) { - std::string title("Gesture: "); - title.append("New Gesture"); - LLPointer cb = new GestureShowCallback(title); - create_inventory_item(gAgent.getID(), gAgent.getSessionID(), - LLUUID::null, LLTransactionID::tnull, "New Gesture", "", LLAssetType::AT_GESTURE, - LLInventoryType::IT_GESTURE, NOT_WEARABLE, PERM_MOVE | PERM_TRANSFER, cb); + LLPointer cb = new GestureShowCallback(); + create_inventory_item(gAgent.getID(), + gAgent.getSessionID(), + LLUUID::null, + LLTransactionID::tnull, + "New Gesture", + "", + LLAssetType::AT_GESTURE, + LLInventoryType::IT_GESTURE, + NOT_WEARABLE, + LLFloaterPerms::getNextOwnerPerms("Gestures"), + cb); } diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index 3d0645b7c..465b7d376 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -176,11 +176,14 @@ void LLFloaterNameDesc::onBtnOK() S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass). void *nruserdata = NULL; std::string display_name = LLStringUtil::null; + upload_new_resource(mFilenameAndPath, // file getChild("name_form")->getValue().asString(), getChild("description_form")->getValue().asString(), 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, - LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), + LLFloaterPerms::getNextOwnerPerms("Uploads"), + LLFloaterPerms::getGroupPerms("Uploads"), + LLFloaterPerms::getEveryonePerms("Uploads"), display_name, callback, expected_upload_cost, nruserdata); close(false); } diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index a85abb1a6..8638bc529 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -1,7 +1,7 @@ /** * @file llfloaterperms.cpp * @brief Asset creation permission preferences. - * @author Coco + * @author Jonathan Yap * * $LicenseInfo:firstyear=2001&license=viewergpl$ * @@ -33,152 +33,57 @@ #include "llviewerprecompiledheaders.h" #include "lfsimfeaturehandler.h" +#include "llagent.h" #include "llcheckboxctrl.h" #include "llfloaterperms.h" #include "llnotificationsutil.h" #include "llviewercontrol.h" +#include "llviewerregion.h" #include "llviewerwindow.h" #include "lluictrlfactory.h" #include "llpermissions.h" #include "hippogridmanager.h" -namespace -{ - bool everyone_export; - void handle_checkboxes(LLUICtrl* ctrl, const LLSD& value) - { - LLPanel* view = static_cast(ctrl->getParent()); - if (ctrl->getName() == "everyone_export") - { - view->childSetEnabled("next_owner_copy", !value); - view->childSetEnabled("next_owner_modify", !value); - view->childSetEnabled("next_owner_transfer", !value); - } - else - { - if (ctrl->getName() == "next_owner_copy") - { - if (!value) // Implements fair use - gSavedSettings.setBOOL("NextOwnerTransfer", true); - view->childSetEnabled("next_owner_transfer", value); - } - if (!value) // If any of these are unchecked, export can no longer be checked. - view->childSetEnabled("everyone_export", false); - else - view->childSetEnabled("everyone_export", LFSimFeatureHandler::instance().simSupportsExport() && (LLFloaterPerms::getNextOwnerPerms() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED); - } - } -} +extern class AIHTTPTimeoutPolicy floaterPermsResponder_timeout; -LLFloaterPerms::LLFloaterPerms(const LLSD& seed) -{ - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_perm_prefs.xml"); -} - -BOOL LLFloaterPerms::postBuild() -{ - //handle_checkboxes - { - bool export_support = LFSimFeatureHandler::instance().simSupportsExport(); - const U32 next_owner_perms = getNextOwnerPerms(); - childSetEnabled("everyone_export", export_support && (next_owner_perms & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED); - if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) - childSetVisible("everyone_export", false); - - if (!(next_owner_perms & PERM_COPY)) - { - childSetEnabled("next_owner_transfer", false); - } - else if (export_support) - { - bool export_off = !gSavedPerAccountSettings.getBOOL("EveryoneExport"); - childSetEnabled("next_owner_copy", export_off); - childSetEnabled("next_owner_modify", export_off); - childSetEnabled("next_owner_transfer", export_off); - } - else // Set EveryoneExport false, just in case. - gSavedPerAccountSettings.setBOOL("EveryoneExport", false); - } - childSetAction("help", onClickHelp, this); - childSetAction("ok", onClickOK, this); - childSetAction("cancel", onClickCancel, this); - getChild("next_owner_copy")->setCommitCallback(handle_checkboxes); - getChild("next_owner_modify")->setCommitCallback(handle_checkboxes); - getChild("next_owner_transfer")->setCommitCallback(handle_checkboxes); - getChild("everyone_export")->setCommitCallback(handle_checkboxes); - - refresh(); - - return TRUE; -} - -//static -void LLFloaterPerms::onClickOK(void* data) -{ - LLFloaterPerms* self = static_cast(data); - self->ok(); - self->close(); -} - -//static -void LLFloaterPerms::onClickCancel(void* data) -{ - LLFloaterPerms* self = static_cast(data); - self->cancel(); - self->close(); -} - -void LLFloaterPerms::ok() -{ - refresh(); // Changes were already applied to saved settings. Refreshing internal values makes it official. -} - -void LLFloaterPerms::cancel() -{ - gSavedSettings.setBOOL("ShareWithGroup", mShareWithGroup); - gSavedSettings.setBOOL("EveryoneCopy", mEveryoneCopy); - gSavedSettings.setBOOL("NextOwnerCopy", mNextOwnerCopy); - gSavedSettings.setBOOL("NextOwnerModify", mNextOwnerModify); - gSavedSettings.setBOOL("NextOwnerTransfer", mNextOwnerTransfer); - gSavedPerAccountSettings.setBOOL("EveryoneExport", everyone_export); -} - -void LLFloaterPerms::refresh() -{ - mShareWithGroup = gSavedSettings.getBOOL("ShareWithGroup"); - mEveryoneCopy = gSavedSettings.getBOOL("EveryoneCopy"); - mNextOwnerCopy = gSavedSettings.getBOOL("NextOwnerCopy"); - mNextOwnerModify = gSavedSettings.getBOOL("NextOwnerModify"); - mNextOwnerTransfer = gSavedSettings.getBOOL("NextOwnerTransfer"); - everyone_export = gSavedPerAccountSettings.getBOOL("EveryoneExport"); -} - -void LLFloaterPerms::onClose(bool app_quitting) -{ - // Cancel any unsaved changes before closing. - // Note: when closed due to the OK button this amounts to a no-op. - cancel(); - LLFloater::onClose(app_quitting); -} - -//static +//static U32 LLFloaterPerms::getGroupPerms(std::string prefix) -{ - return gSavedSettings.getBOOL(prefix+"ShareWithGroup") ? PERM_COPY : PERM_NONE; +{ + return gSavedSettings.getBOOL(prefix+"ShareWithGroup") ? PERM_COPY | PERM_MOVE | PERM_MODIFY : PERM_NONE; } -//static +//static U32 LLFloaterPerms::getEveryonePerms(std::string prefix) { U32 flags = PERM_NONE; - if (LFSimFeatureHandler::instance().simSupportsExport() && prefix.empty() && gSavedPerAccountSettings.getBOOL("EveryoneExport")) // TODO: Bulk enable export? + if (prefix != "Bulk" && LFSimFeatureHandler::instance().simSupportsExport() && prefix.empty() && gSavedPerAccountSettings.getBOOL(prefix+"EveryoneExport")) // Singu TODO: Bulk? flags |= PERM_EXPORT; if (gSavedSettings.getBOOL(prefix+"EveryoneCopy")) flags |= PERM_COPY; return flags; } -//static +//static +U32 LLFloaterPerms::getNextOwnerPermsInverted(std::string prefix) +{ + // Sets bits for permissions that are off + U32 flags = PERM_MOVE; + if (!gSavedSettings.getBOOL(prefix+"NextOwnerCopy")) + { + flags |= PERM_COPY; + } + if (!gSavedSettings.getBOOL(prefix+"NextOwnerModify")) + { + flags |= PERM_MODIFY; + } + if (!gSavedSettings.getBOOL(prefix+"NextOwnerTransfer")) + { + flags |= PERM_TRANSFER; + } + return flags; +} + +//static U32 LLFloaterPerms::getNextOwnerPerms(std::string prefix) { U32 flags = PERM_MOVE; @@ -197,9 +102,228 @@ U32 LLFloaterPerms::getNextOwnerPerms(std::string prefix) return flags; } - -//static -void LLFloaterPerms::onClickHelp(void* data) +namespace { - LLNotificationsUtil::add("ClickUploadHelpPermissions"); + bool everyone_export; + void handle_checkboxes(LLView* view, const std::string& ctrl_name, const LLSD& value, const std::string& type) + { + if (ctrl_name == type+"everyone_export") + { + view->getChildView(type+"next_owner_copy")->setEnabled(!value); + view->getChildView(type+"next_owner_modify")->setEnabled(!value); + view->getChildView(type+"next_owner_transfer")->setEnabled(!value); + } + else + { + if (ctrl_name == type+"next_owner_copy") + { + if (!value) // Implements fair use + gSavedSettings.setBOOL(type+"NextOwnerTransfer", true); + view->getChildView(type+"next_owner_transfer")->setEnabled(value); + } + if (!value) // If any of these are unchecked, export can no longer be checked. + view->getChildView(type+"everyone_export")->setEnabled(false); + else + view->getChildView(type+"everyone_export")->setEnabled(LFSimFeatureHandler::instance().simSupportsExport() && LLFloaterPerms::getNextOwnerPerms(type) == PERM_ITEM_UNRESTRICTED); + } + } +} + +static bool mCapSent = false; + +LLFloaterPermsDefault::LLFloaterPermsDefault(const LLSD& seed) + : LLFloater() +{ + mCommitCallbackRegistrar.add("PermsDefault.OK", boost::bind(&LLFloaterPermsDefault::onClickOK, this)); + mCommitCallbackRegistrar.add("PermsDefault.Cancel", boost::bind(&LLFloaterPermsDefault::onClickCancel, this)); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_perm_prefs.xml"); +} + +// String equivalents of enum Categories - initialization order must match enum order! +const std::string LLFloaterPermsDefault::sCategoryNames[CAT_LAST] = +{ + "Objects", + "Uploads", + "Scripts", + "Notecards", + "Gestures", + "Wearables" +}; + +void LLFloaterPermsDefault::initCheckboxes(bool export_support, const std::string& type) +{ + const U32 next_owner_perms = LLFloaterPerms::getNextOwnerPerms(type); + getChildView(type + "everyone_export")->setEnabled(export_support && next_owner_perms == PERM_ITEM_UNRESTRICTED); + + if (!(next_owner_perms & PERM_COPY)) + { + getChildView(type + "next_owner_transfer")->setEnabled(false); + } + else if (export_support) + { + bool export_off = !gSavedPerAccountSettings.getBOOL(type+"EveryoneExport"); + getChildView(type + "next_owner_copy")->setEnabled(export_off); + getChildView(type + "next_owner_modify")->setEnabled(export_off); + getChildView(type + "next_owner_transfer")->setEnabled(export_off); + } + else // Set type+EveryoneExport false, just in case. + gSavedPerAccountSettings.setBOOL(type+"EveryoneExport", false); +} + +BOOL LLFloaterPermsDefault::postBuild() +{ + //handle_checkboxes + bool export_support = LFSimFeatureHandler::instance().simSupportsExport(); + bool is_sl = gHippoGridManager->getCurrentGrid()->isSecondLife(); + for (S32 i = 0; i < CAT_LAST; ++i) + { + const std::string& type(sCategoryNames[i]); + initCheckboxes(export_support, type); + commit_callback_t handle_checks(boost::bind(handle_checkboxes, this, boost::bind(&LLView::getName, _1), _2, type)); + getChild(type + "next_owner_copy")->setCommitCallback(handle_checks); + getChild(type + "next_owner_modify")->setCommitCallback(handle_checks); + getChild(type + "next_owner_transfer")->setCommitCallback(handle_checks); + if (is_sl) + getChildView(type + "everyone_export")->setVisible(false); + else + getChild(type + "everyone_export")->setCommitCallback(handle_checks); + } + if (is_sl) + { + LLView* view(getChildView("ExportationLabel")); + S32 shift(view->getRect().getWidth()); // Determine size of export area + LLRect rect(getRect()); + rect.mRight -= shift; + setRect(rect); // Cut off the export side + view->setVisible(false); // Hide label + // Move bottom buttons over so they look nice. + shift /= -2; + view = getChildView("ok"); + rect = view->getRect(); + rect.translate(shift, 0); + view->setRect(rect); + view = getChildView("cancel"); + rect = view->getRect(); + rect.translate(shift, 0); + view->setRect(rect); + } + + refresh(); + + return TRUE; +} + +void LLFloaterPermsDefault::onClickOK() +{ + ok(); + close(); +} + +void LLFloaterPermsDefault::onClickCancel() +{ + cancel(); + close(); +} + +class LLFloaterPermsResponder : public LLHTTPClient::ResponderWithResult +{ +public: + LLFloaterPermsResponder() : LLHTTPClient::ResponderWithResult() {} +private: + static std::string sPreviousReason; + + void error(U32 status, const std::string& reason) + { + // Do not display the same error more than once in a row + if (reason != sPreviousReason) + { + sPreviousReason = reason; + LLSD args; + args["REASON"] = reason; + LLNotificationsUtil::add("DefaultObjectPermissions", args); + } + } + void result(const LLSD& content) + { + // Since we have had a successful POST call be sure to display the next error message + // even if it is the same as a previous one. + sPreviousReason = ""; + mCapSent = true; + LL_INFOS("FloaterPermsResponder") << "Sent default permissions to simulator" << LL_ENDL; + } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy() const { return floaterPermsResponder_timeout; } + /*virtual*/ char const* getName() const { return "LLFloaterPermsResponder"; } +}; + +std::string LLFloaterPermsResponder::sPreviousReason; + +void LLFloaterPermsDefault::sendInitialPerms() +{ + if (!mCapSent) + { + updateCap(); + } +} + +void LLFloaterPermsDefault::updateCap() +{ + std::string object_url = gAgent.getRegion()->getCapability("AgentPreferences"); + + if (!object_url.empty()) + { + LLSD report = LLSD::emptyMap(); + report["default_object_perm_masks"]["Group"] = + (LLSD::Integer)LLFloaterPerms::getGroupPerms(sCategoryNames[CAT_OBJECTS]); + report["default_object_perm_masks"]["Everyone"] = + (LLSD::Integer)LLFloaterPerms::getEveryonePerms(sCategoryNames[CAT_OBJECTS]); + report["default_object_perm_masks"]["NextOwner"] = + (LLSD::Integer)LLFloaterPerms::getNextOwnerPerms(sCategoryNames[CAT_OBJECTS]); + + LLHTTPClient::post(object_url, report, new LLFloaterPermsResponder()); + } +} + +void LLFloaterPermsDefault::ok() +{ + // Changes were already applied to saved settings. + // Refreshing internal values makes it official. + refresh(); + + // We know some setting has changed but not which one. Just in case it was a setting for + // object permissions tell the server what the values are. + updateCap(); +} + +void LLFloaterPermsDefault::cancel() +{ + for (U32 iter = CAT_OBJECTS; iter < CAT_LAST; iter++) + { + gSavedSettings.setBOOL(sCategoryNames[iter]+"ShareWithGroup", mShareWithGroup[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"EveryoneCopy", mEveryoneCopy[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"NextOwnerCopy", mNextOwnerCopy[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"NextOwnerModify", mNextOwnerModify[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"NextOwnerTransfer", mNextOwnerTransfer[iter]); + gSavedPerAccountSettings.setBOOL(sCategoryNames[iter]+"EveryoneExport", mEveryoneExport[iter]); + } +} + +void LLFloaterPermsDefault::refresh() +{ + for (U32 iter = CAT_OBJECTS; iter < CAT_LAST; iter++) + { + mShareWithGroup[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"ShareWithGroup"); + mEveryoneCopy[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"EveryoneCopy"); + mNextOwnerCopy[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"NextOwnerCopy"); + mNextOwnerModify[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"NextOwnerModify"); + mNextOwnerTransfer[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"NextOwnerTransfer"); + mEveryoneExport[iter] = gSavedPerAccountSettings.getBOOL(sCategoryNames[iter]+"EveryoneExport"); + } +} + +void LLFloaterPermsDefault::onClose(bool app_quitting) +{ + // Cancel any unsaved changes before closing. + // Note: when closed due to the OK button this amounts to a no-op. + cancel(); + LLFloater::onClose(app_quitting); } diff --git a/indra/newview/llfloaterperms.h b/indra/newview/llfloaterperms.h index 9193b5983..52c3159d2 100644 --- a/indra/newview/llfloaterperms.h +++ b/indra/newview/llfloaterperms.h @@ -36,35 +36,55 @@ #include "llfloater.h" -class LLFloaterPerms : public LLFloater, public LLFloaterSingleton +namespace LLFloaterPerms { - friend class LLUISingleton >; + // Convenience methods to get current permission preference bitfields from saved settings: + U32 getEveryonePerms(std::string prefix=""); // prefix + "EveryoneCopy" + U32 getGroupPerms(std::string prefix=""); // prefix + "ShareWithGroup" + U32 getNextOwnerPerms(std::string prefix=""); // bitfield for prefix + "NextOwner" + "Copy", "Modify", and "Transfer" + U32 getNextOwnerPermsInverted(std::string prefix=""); +} + +class LLFloaterPermsDefault : public LLFloater, public LLFloaterSingleton +{ + friend class LLUISingleton >; public: /*virtual*/ void onClose(bool app_quitting = false); /*virtual*/ BOOL postBuild(); + void initCheckboxes(bool export_support, const std::string& type); void ok(); void cancel(); - static void onClickOK(void*); - static void onClickCancel(void*); - // Convenience methods to get current permission preference bitfields from saved settings: - static U32 getEveryonePerms(std::string prefix=""); // prefix + "EveryoneCopy" - static U32 getGroupPerms(std::string prefix=""); // prefix + "ShareWithGroup" - static U32 getNextOwnerPerms(std::string prefix=""); // bitfield for prefix + "NextOwner" + "Copy", "Modify", and "Transfer" + void onClickOK(); + void onClickCancel(); + static void sendInitialPerms(); + static void updateCap(); + + // Update instantiation of sCategoryNames in the .cpp file to match if you change this! + enum Categories + { + CAT_OBJECTS, + CAT_UPLOADS, + CAT_SCRIPTS, + CAT_NOTECARDS, + CAT_GESTURES, + CAT_WEARABLES, + CAT_LAST + }; private: - LLFloaterPerms(const LLSD& seed); + LLFloaterPermsDefault(const LLSD& seed); void refresh(); - /// callback for the menus help button - static void onClickHelp(void* data); + static const std::string sCategoryNames[CAT_LAST]; - BOOL // cached values only for implementing cancel. - mShareWithGroup, - mEveryoneCopy, - mNextOwnerCopy, - mNextOwnerModify, - mNextOwnerTransfer; + // cached values only for implementing cancel. + bool mShareWithGroup[CAT_LAST]; + bool mEveryoneCopy[CAT_LAST]; + bool mEveryoneExport[CAT_LAST]; + bool mNextOwnerCopy[CAT_LAST]; + bool mNextOwnerModify[CAT_LAST]; + bool mNextOwnerTransfer[CAT_LAST]; }; #endif diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index bb0874e43..266beb7ce 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -1434,8 +1434,8 @@ void LLSnapshotLivePreview::saveTexture() LLFolderType::FT_SNAPSHOT_CATEGORY, LLInventoryType::IT_SNAPSHOT, PERM_ALL, // Note: Snapshots to inventory is a special case of content upload - LLFloaterPerms::getGroupPerms(), // that is more permissive than other uploads - LLFloaterPerms::getEveryonePerms(), + LLFloaterPerms::getGroupPerms("Uploads"), // that is more permissive than other uploads + LLFloaterPerms::getEveryonePerms("Uploads"), "Snapshot : " + pos_string, callback, expected_upload_cost, user_data, &LLSnapshotLivePreview::saveTextureDone2)) { diff --git a/indra/newview/llinventoryactions.cpp b/indra/newview/llinventoryactions.cpp index b78e4a4f1..5e2729820 100644 --- a/indra/newview/llinventoryactions.cpp +++ b/indra/newview/llinventoryactions.cpp @@ -305,7 +305,7 @@ void do_create(LLInventoryModel *model, LLInventoryPanel *ptr, std::string type, parent_id, LLAssetType::AT_LSL_TEXT, LLInventoryType::IT_LSL, - LLFloaterPerms::getNextOwnerPerms("Script")); + LLFloaterPerms::getNextOwnerPerms("Scripts")); } else if ("notecard" == type) { @@ -314,7 +314,7 @@ void do_create(LLInventoryModel *model, LLInventoryPanel *ptr, std::string type, parent_id, LLAssetType::AT_NOTECARD, LLInventoryType::IT_NOTECARD, - PERM_ALL); + LLFloaterPerms::getNextOwnerPerms("Notecards")); } else if ("gesture" == type) { @@ -323,7 +323,7 @@ void do_create(LLInventoryModel *model, LLInventoryPanel *ptr, std::string type, parent_id, LLAssetType::AT_GESTURE, LLInventoryType::IT_GESTURE, - PERM_ALL); + LLFloaterPerms::getNextOwnerPerms("Gestures")); } else if ("outfit" == type || ("update outfit" == type && !LLAppearanceMgr::getInstance()->updateBaseOutfit())) // If updateBaseOutfit fails, prompt to make a new outfit { diff --git a/indra/newview/llmenucommands.cpp b/indra/newview/llmenucommands.cpp index 666ced2af..6df1d8717 100644 --- a/indra/newview/llmenucommands.cpp +++ b/indra/newview/llmenucommands.cpp @@ -237,7 +237,7 @@ struct MenuFloaterDict : public LLSingleton registerFloater ("outbox"); registerFloater ("pathfinding_characters"); registerFloater ("pathfinding_linksets"); - registerFloater ("perm prefs"); + registerFloater ("perm prefs"); registerFloater ("radar"); registerFloater ("script info"); registerFloater ("stat bar"); diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index bb82041fa..252df6ca7 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1544,9 +1544,9 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) result["asset_type"] = "mesh"; result["inventory_type"] = "object"; result["description"] = "(No Description)"; - result["next_owner_mask"] = LLSD::Integer(LLFloaterPerms::getNextOwnerPerms()); - result["group_mask"] = LLSD::Integer(LLFloaterPerms::getGroupPerms()); - result["everyone_mask"] = LLSD::Integer(LLFloaterPerms::getEveryonePerms()); + result["next_owner_mask"] = LLSD::Integer(LLFloaterPerms::getNextOwnerPerms("Uploads")); + result["group_mask"] = LLSD::Integer(LLFloaterPerms::getGroupPerms("Uploads")); + result["everyone_mask"] = LLSD::Integer(LLFloaterPerms::getEveryonePerms("Uploads")); res["mesh_list"] = LLSD::emptyArray(); res["texture_list"] = LLSD::emptyArray(); diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp index 15d6324a6..af7855ca3 100644 --- a/indra/newview/llpanelcontents.cpp +++ b/indra/newview/llpanelcontents.cpp @@ -181,12 +181,14 @@ void LLPanelContents::onClickNewScript(void *userdata) LLPermissions perm; perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null); + + // Parameters are base, owner, everyone, group, next perm.initMasks( PERM_ALL, PERM_ALL, - PERM_NONE, - PERM_NONE, - LLFloaterPerms::getNextOwnerPerms("Script")); + LLFloaterPerms::getEveryonePerms("Scripts"), + LLFloaterPerms::getGroupPerms("Scripts"), + LLFloaterPerms::getNextOwnerPerms("Scripts")); std::string desc; LLViewerAssetType::generateDescriptionFor(LLAssetType::AT_LSL_TEXT, desc); LLPointer new_item = diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 2e120d850..e79838767 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1904,7 +1904,7 @@ void LLLiveLSLEditor::loadAsset() mScriptEd->enableSave(FALSE); LLPermissions perm; perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, gAgent.getGroupID()); - perm.initMasks(PERM_ALL, PERM_ALL, PERM_NONE, PERM_NONE, LLFloaterPerms::getNextOwnerPerms("Script")); + perm.initMasks(PERM_ALL, PERM_ALL, LLFloaterPerms::getEveryonePerms("Scripts"), LLFloaterPerms::getGroupPerms("Scripts"), LLFloaterPerms::getNextOwnerPerms("Scripts")); mItem = new LLViewerInventoryItem(mItemUUID, mObjectUUID, perm, diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index cc2cc300c..ae94920d5 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -374,6 +374,30 @@ void hooked_process_sound_trigger(LLMessageSystem *msg, void **) LLFloaterAvatarList::sound_trigger_hook(msg,NULL); } +void convert_legacy_settings() +{ + // Convert legacy settings to new ones here. + if (!gSavedPerAccountSettings.getBOOL("DefaultUploadPermissionsConverted")) + { + gSavedSettings.setBOOL("UploadsEveryoneCopy", gSavedSettings.getBOOL("EveryoneCopy")); + bool val = gSavedPerAccountSettings.getBOOL("EveryoneExport"); + gSavedPerAccountSettings.setBOOL("UploadsEveryoneExport", val); + gSavedPerAccountSettings.setBOOL("ObjectsEveryoneExport", val); + val = gSavedSettings.getBOOL("NextOwnerCopy"); + gSavedSettings.setBOOL("UploadsNextOwnerCopy", val); + gSavedSettings.setBOOL("ObjectsNextOwnerCopy", val); + val = gSavedSettings.getBOOL("NextOwnerModify"); + gSavedSettings.setBOOL("UploadsNextOwnerModify", val); + gSavedSettings.setBOOL("ObjectsNextOwnerModify", val); + val = gSavedSettings.getBOOL("NextOwnerTransfer"); + gSavedSettings.setBOOL("UploadsNextOwnerTransfer", val); + gSavedSettings.setBOOL("ObjectsNextOwnerTransfer", val); + val = gSavedSettings.getBOOL("NextOwnerTransfer"); + gSavedSettings.setBOOL("UploadsShareWithGroup", gSavedSettings.getBOOL("ShareWithGroup")); + gSavedPerAccountSettings.setBOOL("DefaultUploadPermissionsConverted", true); + } +} + void init_audio() { if (FALSE == gSavedSettings.getBOOL("NoAudio")) @@ -1039,6 +1063,8 @@ bool idle_startup() gSavedPerAccountSettings.setU32("LastLogoff", time_corrected()); } + convert_legacy_settings(); + //Default the path if one isn't set. if (gSavedPerAccountSettings.getString("InstantMessageLogPath").empty()) { @@ -1554,6 +1580,7 @@ bool idle_startup() } if (gSavedSettings.getBOOL("LiruGridInTitle")) gWindowTitle += "- " + gHippoGridManager->getCurrentGrid()->getGridName() + " "; gViewerWindow->getWindow()->setTitle(gWindowTitle += "- " + name); + // Pass the user information to the voice chat server interface. LLVoiceClient::getInstance()->userAuthorized(name, gAgentID); // create the default proximal channel diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 7194711a6..4455b4d11 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -47,6 +47,7 @@ #include "llinventorybridge.h" #include "llinventorypanel.h" #include "llfloaterinventory.h" +#include "llfloaterperms.h" #include "lllandmark.h" #include "llviewerassettype.h" @@ -950,23 +951,72 @@ void activate_gesture_cb(const LLUUID& inv_item) LLGestureMgr::instance().activateGesture(inv_item); } +void create_script_cb(const LLUUID& inv_item) +{ + if (!inv_item.isNull()) + { + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + if (item) + { + LLPermissions perm = item->getPermissions(); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Scripts")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Scripts")); + + item->setPermissions(perm); + + item->updateServer(FALSE); + gInventory.updateItem(item); + gInventory.notifyObservers(); + } + } +} + void create_gesture_cb(const LLUUID& inv_item) { - if (inv_item.isNull()) - return; - - LLGestureMgr::instance().activateGesture(inv_item); - - LLViewerInventoryItem* item = gInventory.getItem(inv_item); - if (!item) return; - gInventory.updateItem(item); - gInventory.notifyObservers(); - - if(!LLPreview::show(inv_item,FALSE)) + if (!inv_item.isNull()) { - LLPreviewGesture* preview = LLPreviewGesture::show(std::string("Gesture: ") + item->getName(), inv_item, LLUUID::null); - // Force to be entirely onscreen. - gFloaterView->adjustToFitScreen(preview, FALSE); + LLGestureMgr::instance().activateGesture(inv_item); + + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + if (item) + { + LLPermissions perm = item->getPermissions(); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Gestures")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Gestures")); + + item->setPermissions(perm); + + item->updateServer(FALSE); + gInventory.updateItem(item); + gInventory.notifyObservers(); + + if (!LLPreview::show(inv_item,FALSE)) + { + LLPreviewGesture* preview = LLPreviewGesture::show(std::string("Gesture: ") + item->getName(), inv_item, LLUUID::null); + // Force to be entirely onscreen. + gFloaterView->adjustToFitScreen(preview, FALSE); + } + } + } +} + +void create_notecard_cb(const LLUUID& inv_item) +{ + if (!inv_item.isNull()) + { + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + if (item) + { + LLPermissions perm = item->getPermissions(); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Notecards")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Notecards")); + + item->setPermissions(perm); + + item->updateServer(FALSE); + gInventory.updateItem(item); + gInventory.notifyObservers(); + } } } @@ -1225,22 +1275,45 @@ void create_new_item(const std::string& name, LLViewerAssetType::generateDescriptionFor(asset_type, desc); next_owner_perm = (next_owner_perm) ? next_owner_perm : PERM_MOVE | PERM_TRANSFER; - - if (inv_type == LLInventoryType::IT_GESTURE) + LLPointer cb = NULL; + + switch(inv_type) { - LLPointer cb = new LLBoostFuncInventoryCallback(create_gesture_cb); - create_inventory_item(gAgent.getID(), gAgent.getSessionID(), - parent_id, LLTransactionID::tnull, name, desc, asset_type, inv_type, - NOT_WEARABLE, next_owner_perm, cb); + case LLInventoryType::IT_LSL: + { + cb = new LLBoostFuncInventoryCallback(create_script_cb); + next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Scripts"); + break; + } + + case LLInventoryType::IT_GESTURE: + { + cb = new LLBoostFuncInventoryCallback(create_gesture_cb); + next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Gestures"); + break; + } + + case LLInventoryType::IT_NOTECARD: + { + cb = new LLBoostFuncInventoryCallback(create_notecard_cb); + next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Notecards"); + break; + } + default: + break; } - else - { - LLPointer cb = NULL; - create_inventory_item(gAgent.getID(), gAgent.getSessionID(), - parent_id, LLTransactionID::tnull, name, desc, asset_type, inv_type, - NOT_WEARABLE, next_owner_perm, cb); - } - + + create_inventory_item(gAgent.getID(), + gAgent.getSessionID(), + parent_id, + LLTransactionID::tnull, + name, + desc, + asset_type, + inv_type, + NOT_WEARABLE, + next_owner_perm, + cb); } const std::string NEW_LSL_NAME = "New Script"; // *TODO:Translate? (probably not) @@ -1281,7 +1354,7 @@ const std::string NEW_GESTURE_NAME = "New Gesture"; // *TODO:Translate? (probabl parent_id, LLAssetType::AT_LSL_TEXT, LLInventoryType::IT_LSL, - PERM_MOVE | PERM_TRANSFER); + PERM_MOVE | PERM_TRANSFER); // overridden in create_new_item } else if ("notecard" == type_name) { @@ -1290,7 +1363,7 @@ const std::string NEW_GESTURE_NAME = "New Gesture"; // *TODO:Translate? (probabl parent_id, LLAssetType::AT_NOTECARD, LLInventoryType::IT_NOTECARD, - PERM_ALL); + PERM_ALL); // overridden in create_new_item } else if ("gesture" == type_name) { @@ -1299,7 +1372,7 @@ const std::string NEW_GESTURE_NAME = "New Gesture"; // *TODO:Translate? (probabl parent_id, LLAssetType::AT_GESTURE, LLInventoryType::IT_GESTURE, - PERM_ALL); + PERM_ALL); // overridden in create_new_item } else { diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 483b80ab9..52506852a 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -440,9 +440,20 @@ class LLFileUploadBulk : public view_listener_t S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); void *userdata = NULL; gSavedSettings.setBOOL("TemporaryUpload", enabled); - upload_new_resource(filename, asset_name, asset_name, 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, - LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), - display_name, callback, expected_upload_cost, userdata); + upload_new_resource( + filename, + asset_name, + asset_name, + 0, + LLFolderType::FT_NONE, + LLInventoryType::IT_NONE, + LLFloaterPerms::getNextOwnerPerms("Uploads"), + LLFloaterPerms::getGroupPerms("Uploads"), + LLFloaterPerms::getEveryonePerms("Uploads"), + display_name, + callback, + expected_upload_cost, + userdata); } } @@ -925,7 +936,7 @@ void upload_new_resource(const std::string& src_filename, std::string name, if(exten == "lsl" || exten == "gesture" || exten == "notecard") // added notecard Oct 15 2009 { LLInventoryType::EType inv_type = LLInventoryType::IT_GESTURE; - if(exten == "lsl") inv_type = LLInventoryType::IT_LSL; + if (exten == "lsl") inv_type = LLInventoryType::IT_LSL; else if(exten == "gesture") inv_type = LLInventoryType::IT_GESTURE; else if(exten == "notecard") inv_type = LLInventoryType::IT_NOTECARD; create_inventory_item( gAgent.getID(), @@ -1374,6 +1385,18 @@ void NewResourceItemCallback::fire(const LLUUID& new_item_id) LLUUID vfile_id = LLUUID(new_item->getDescription()); if(vfile_id.isNull()) return; new_item->setDescription("(No Description)"); + std::string type("Uploads"); + switch(new_item->getInventoryType()) + { + case LLInventoryType::IT_LSL: type = "Scripts"; break; + case LLInventoryType::IT_GESTURE: type = "Gestures"; break; + case LLInventoryType::IT_NOTECARD: type = "Notecard"; break; + } + LLPermissions perms = new_item->getPermissions(); + perms.setMaskNext(LLFloaterPerms::getNextOwnerPerms(type)); + perms.setMaskGroup(LLFloaterPerms::getGroupPerms(type)); + perms.setMaskEveryone(LLFloaterPerms::getEveryonePerms(type)); + new_item->setPermissions(perms); new_item->updateServer(FALSE); gInventory.updateItem(new_item); gInventory.notifyObservers(); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 6dac791b4..ee9bdf4ba 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2622,6 +2622,7 @@ void LLViewerObject::saveScript( * interaction with doUpdateInventory() called below. */ lldebugs << "LLViewerObject::saveScript() " << item->getUUID() << " " << item->getAssetUUID() << llendl; + LLPointer task_item = new LLViewerInventoryItem(item->getUUID(), mID, item->getPermissions(), item->getAssetUUID(), item->getType(), diff --git a/indra/newview/llviewerobjectbackup.cpp b/indra/newview/llviewerobjectbackup.cpp index e19e58afd..a24a8b231 100644 --- a/indra/newview/llviewerobjectbackup.cpp +++ b/indra/newview/llviewerobjectbackup.cpp @@ -967,8 +967,8 @@ void LLObjectBackup::importObject_continued(AIFilePicker* filepicker) // User canceled save. return; } - - std::string file_name = filepicker->getFilename(); + + std::string file_name = filepicker->getFilename(); mFolder = gDirUtilp->getDirName(file_name); llifstream import_file(file_name); LLSDSerialize::fromXML(mLLSD, import_file); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 4ba3da375..bc66ba69b 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -58,6 +58,7 @@ #include "lldir.h" #include "lleventpoll.h" #include "llfloatergodtools.h" +#include "llfloaterperms.h" #include "llfloaterreporter.h" #include "llfloaterregioninfo.h" #include "llhttpnode.h" @@ -1694,6 +1695,7 @@ void LLViewerRegion::unpackRegionHandshake() void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) { + capabilityNames.append("AgentPreferences"); capabilityNames.append("AgentState"); capabilityNames.append("AttachmentResources"); //capabilityNames.append("AvatarPickerSearch"); //Display name/SLID lookup (llfloateravatarpicker.cpp) @@ -1998,6 +2000,8 @@ void LLViewerRegion::setCapabilitiesReceived(bool received) { mCapabilitiesReceivedSignal(getRegionID()); + LLFloaterPermsDefault::sendInitialPerms(); + // This is a single-shot signal. Forget callbacks to save resources. mCapabilitiesReceivedSignal.disconnect_all_slots(); diff --git a/indra/newview/skins/default/xui/de/notifications.xml b/indra/newview/skins/default/xui/de/notifications.xml index 6fb3958a4..6c1b455f5 100644 --- a/indra/newview/skins/default/xui/de/notifications.xml +++ b/indra/newview/skins/default/xui/de/notifications.xml @@ -210,8 +210,6 @@ Dieses Kontrollkästchen zeigt Folgendes an: Die Second Life Website für weitere Informationen über Partnerschaften öffnen? - Ihre Standardberechtigung funktionieren in älteren Regionen möglicherweise nicht. - Wenn dieser Einwohner einen Webprofil-URL angegeben hat, können Sie: * Auf „Laden“ klicken und die Seite in dieser Web-Registerkarte anzeigen. * Auf Laden > „In externem Browser“ klicken und die Seite im Standard-Browser anzeigen. diff --git a/indra/newview/skins/default/xui/en-us/floater_perm_prefs.xml b/indra/newview/skins/default/xui/en-us/floater_perm_prefs.xml index f80937110..03ce82ec4 100644 --- a/indra/newview/skins/default/xui/en-us/floater_perm_prefs.xml +++ b/indra/newview/skins/default/xui/en-us/floater_perm_prefs.xml @@ -1,15 +1,67 @@ - - - + diff --git a/indra/newview/skins/default/xui/en-us/notifications.xml b/indra/newview/skins/default/xui/en-us/notifications.xml index f015201e7..eadbfe982 100644 --- a/indra/newview/skins/default/xui/en-us/notifications.xml +++ b/indra/newview/skins/default/xui/en-us/notifications.xml @@ -693,13 +693,6 @@ Go to the [SECOND_LIFE] web site for more information on partnering? yestext="Go to Page"/> - -Your default permissions may not work in older regions. - - + +There was a problem saving the default permissions due to the following reason: [REASON]. Please try setting the default permissions later. + fail + + + diff --git a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_system.xml b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_system.xml index 597200310..3f0c796a6 100644 --- a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_system.xml +++ b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_system.xml @@ -137,13 +137,13 @@ Next Owner Perms Objects - - - + + + Scripts - - - + + + diff --git a/indra/newview/skins/default/xui/es/notifications.xml b/indra/newview/skins/default/xui/es/notifications.xml index c5f1bc36a..710397a8e 100644 --- a/indra/newview/skins/default/xui/es/notifications.xml +++ b/indra/newview/skins/default/xui/es/notifications.xml @@ -372,10 +372,6 @@ Marcando este ítem, se mostrará: - - Tus permisos por defecto no funcionarán en regiones antiguas. - - Si este residente ha indicado una URL para mostrar un perfil en la web, tu puedes: * Pulsar 'Cargar' para ver la página en esta pestaña web. diff --git a/indra/newview/skins/default/xui/fr/notifications.xml b/indra/newview/skins/default/xui/fr/notifications.xml index a55d8f093..da9e27ee7 100644 --- a/indra/newview/skins/default/xui/fr/notifications.xml +++ b/indra/newview/skins/default/xui/fr/notifications.xml @@ -244,10 +244,6 @@ Aller sur le site de [SECOND_LIFE_GRID] pour avoir plus d'informations sur les p - - Il est possible que vos droits par défaut ne fonctionnent pas dans les anciennes régions. - - Si ce résident a défini une URL de profil web, vous pouvez: * Cliquer sur Charger pour afficher la page dans cet onglet; diff --git a/indra/newview/skins/default/xui/it/notifications.xml b/indra/newview/skins/default/xui/it/notifications.xml index 026ffca53..9b850e302 100644 --- a/indra/newview/skins/default/xui/it/notifications.xml +++ b/indra/newview/skins/default/xui/it/notifications.xml @@ -235,9 +235,6 @@ Marcando questo campo si mostrerà: Vai al sito web di Second Life per ulteriori informazioni sulla partnership? - - I tuoi permessi di base possono non funzionare nelle regioni più vecchie. - Se questo/a residente ha impostato una URL nel suo profilo puoi: * Cliccare 'Carica' per vedere la pagina in questa finestra web. diff --git a/indra/newview/skins/default/xui/pt/notifications.xml b/indra/newview/skins/default/xui/pt/notifications.xml index 33d07ff22..ce77ba87c 100644 --- a/indra/newview/skins/default/xui/pt/notifications.xml +++ b/indra/newview/skins/default/xui/pt/notifications.xml @@ -300,10 +300,6 @@ Ir para o site do [SECOND_LIFE] para mais informações sobre parceria? - - Suas permissões padrão podem não funcionar em regiões antigas. - - Se este Residente definiu uma URL de perfil na web, então você pode: * Clicar em 'Carregar' para ver a página na aba Web.