summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterland.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterland.cpp')
-rw-r--r--indra/newview/llfloaterland.cpp75
1 files changed, 55 insertions, 20 deletions
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index eeb1c17f4b..450f2d6ff1 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -46,6 +46,7 @@
#include "llfloaterreg.h"
#include "llfloateravatarpicker.h"
#include "llfloaterauction.h"
+#include "llfloaterbanduration.h"
#include "llfloatergroups.h"
#include "llfloaterscriptlimits.h"
#include "llavataractions.h"
@@ -2546,33 +2547,49 @@ void LLPanelLandAccess::refresh()
cit != parcel->mBanList.end(); ++cit)
{
const LLAccessEntry& entry = (*cit).second;
- std::string prefix;
+ std::string duration;
if (entry.mTime != 0)
{
LLStringUtil::format_map_t args;
S32 now = time(NULL);
- S32 seconds = entry.mTime - now;
+ S32 seconds = entry.mTime - now;
if (seconds < 0) seconds = 0;
- prefix.assign(" (");
- if (seconds >= 120)
+
+ if (seconds >= 7200)
{
- args["[MINUTES]"] = llformat("%d", (seconds/60));
- std::string buf = parent_floater->getString ("Minutes", args);
- prefix.append(buf);
+ args["[HOURS]"] = llformat("%d", (seconds / 3600));
+ duration = parent_floater->getString("Hours", args);
+ }
+ else if (seconds >= 3600)
+ {
+ duration = "1 " + parent_floater->getString("Hour");
+ }
+ else if (seconds >= 120)
+ {
+ args["[MINUTES]"] = llformat("%d", (seconds / 60));
+ duration = parent_floater->getString("Minutes", args);
}
else if (seconds >= 60)
{
- prefix.append("1 " + parent_floater->getString("Minute"));
+ duration = "1 " + parent_floater->getString("Minute");
}
else
{
args["[SECONDS]"] = llformat("%d", seconds);
- std::string buf = parent_floater->getString ("Seconds", args);
- prefix.append(buf);
+ duration = parent_floater->getString("Seconds", args);
}
- prefix.append(" " + parent_floater->getString("Remaining") + ") ");
}
- mListBanned->addNameItem(entry.mID, ADD_DEFAULT, TRUE, "", prefix);
+ else
+ {
+ duration = parent_floater->getString("Always");
+ }
+ LLSD item;
+ item["id"] = entry.mID;
+ LLSD& columns = item["columns"];
+ columns[0]["column"] = "name"; // to be populated later
+ columns[1]["column"] = "duration";
+ columns[1]["value"] = duration;
+ mListBanned->addElement(item);
}
mListBanned->sortByName(TRUE);
}
@@ -2924,7 +2941,7 @@ void LLPanelLandAccess::onClickAddBanned()
LLView * button = findChild<LLButton>("add_banned");
LLFloater * root_floater = gFloaterView->getParentFloater(this);
LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(
- boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1), FALSE, FALSE, FALSE, root_floater->getName(), button);
+ boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1), TRUE, FALSE, FALSE, root_floater->getName(), button);
if (picker)
{
root_floater->addDependentFloater(picker);
@@ -2934,23 +2951,41 @@ void LLPanelLandAccess::onClickAddBanned()
// static
void LLPanelLandAccess::callbackAvatarCBBanned(const uuid_vec_t& ids)
{
- if (!ids.empty())
+ LLFloater * root_floater = gFloaterView->getParentFloater(this);
+ LLFloaterBanDuration* duration_floater = LLFloaterBanDuration::show(
+ boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned2, this, _1, _2), ids);
+ if (duration_floater)
{
- LLUUID id = ids[0];
- LLParcel* parcel = mParcel->getParcel();
- if (parcel && parcel->addToBanList(id, 0))
+ root_floater->addDependentFloater(duration_floater);
+ }
+}
+
+void LLPanelLandAccess::callbackAvatarCBBanned2(const uuid_vec_t& ids, S32 duration)
+{
+ LLParcel* parcel = mParcel->getParcel();
+ if (!parcel) return;
+
+ U32 lists_to_update = 0;
+
+ for (uuid_vec_t::const_iterator it = ids.begin(); it < ids.end(); it++)
+ {
+ LLUUID id = *it;
+ if (parcel->addToBanList(id, duration))
{
- U32 lists_to_update = AL_BAN;
+ lists_to_update |= AL_BAN;
// agent was successfully added to ban list
// but we also need to check access list to ensure that agent will not be in two lists simultaneously
if (parcel->removeFromAccessList(id))
{
lists_to_update |= AL_ACCESS;
}
- LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(lists_to_update);
- refresh();
}
}
+ if (lists_to_update > 0)
+ {
+ LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(lists_to_update);
+ refresh();
+ }
}
// static