From ec57776a23f36a9df02ee614c4f0ef20fcea0c7c Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Wed, 15 Sep 2010 15:40:29 -0700 Subject: Add role action to allow hosting of events on group land --- indra/llcommon/roles_constants.h | 3 ++- indra/newview/skins/default/xui/en/role_actions.xml | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/indra/llcommon/roles_constants.h b/indra/llcommon/roles_constants.h index 70bca821c7..effd15ea72 100644 --- a/indra/llcommon/roles_constants.h +++ b/indra/llcommon/roles_constants.h @@ -52,7 +52,6 @@ enum LLRoleChangeType // // KNOWN HOLES: use these for any single bit powers you need -// bit 0x1 << 41 // bit 0x1 << 46 // bit 0x1 << 49 and above @@ -103,6 +102,8 @@ const U64 GP_LAND_ALLOW_FLY = 0x1 << 24; // Bypass Fly Restriction const U64 GP_LAND_ALLOW_CREATE = 0x1 << 25; // Bypass Create/Edit Objects Restriction const U64 GP_LAND_ALLOW_LANDMARK = 0x1 << 26; // Bypass Landmark Restriction const U64 GP_LAND_ALLOW_SET_HOME = 0x1 << 28; // Bypass Set Home Point Restriction +const U64 GP_LAND_ALLOW_HOLD_EVENT = 0x1LL << 41; // Allowed to hold events on group-owned land + // Parcel Access const U64 GP_LAND_MANAGE_ALLOWED = 0x1 << 29; // Manage Allowed List diff --git a/indra/newview/skins/default/xui/en/role_actions.xml b/indra/newview/skins/default/xui/en/role_actions.xml index a6036f8b78..89aef57cca 100644 --- a/indra/newview/skins/default/xui/en/role_actions.xml +++ b/indra/newview/skins/default/xui/en/role_actions.xml @@ -108,6 +108,9 @@ + Date: Tue, 12 Oct 2010 17:49:36 -0700 Subject: EVE-47 - Event formatting should appear in "Profile" window EVE-74 - Change in-viewer support for 'notify me' to be maintainable via app slurl EVE-72 - Modify viewer to make the event profile window be an html control This is basically a reworking of the event profile display to remove all in-viewer specific event display rendering, in preparation for richtext descriptions. Most was removal of code. --- indra/newview/CMakeLists.txt | 2 - indra/newview/app_settings/settings.xml | 11 + indra/newview/lleventinfo.cpp | 98 ------ indra/newview/lleventinfo.h | 74 ----- indra/newview/lleventnotifier.cpp | 336 +++++++++------------ indra/newview/lleventnotifier.h | 29 +- indra/newview/llfloaterevent.cpp | 291 ++---------------- indra/newview/llfloaterevent.h | 46 +-- indra/newview/llfloaterworldmap.h | 1 - indra/newview/llstartup.cpp | 11 +- .../newview/skins/default/xui/da/floater_event.xml | 107 +++---- .../newview/skins/default/xui/da/notifications.xml | 3 +- .../newview/skins/default/xui/de/floater_event.xml | 104 +++---- .../newview/skins/default/xui/de/notifications.xml | 3 +- .../newview/skins/default/xui/en/floater_event.xml | 330 ++------------------ .../newview/skins/default/xui/en/notifications.xml | 8 +- .../newview/skins/default/xui/es/floater_event.xml | 107 +++---- .../newview/skins/default/xui/es/notifications.xml | 3 +- .../newview/skins/default/xui/fr/floater_event.xml | 104 +++---- .../newview/skins/default/xui/fr/notifications.xml | 3 +- .../newview/skins/default/xui/it/floater_event.xml | 107 +++---- .../newview/skins/default/xui/it/notifications.xml | 3 +- .../newview/skins/default/xui/ja/floater_event.xml | 104 +++---- .../newview/skins/default/xui/ja/notifications.xml | 3 +- .../newview/skins/default/xui/nl/notifications.xml | 3 +- .../newview/skins/default/xui/pl/floater_event.xml | 107 +++---- .../newview/skins/default/xui/pl/notifications.xml | 3 +- .../newview/skins/default/xui/pt/floater_event.xml | 107 +++---- .../newview/skins/default/xui/pt/notifications.xml | 3 +- 29 files changed, 555 insertions(+), 1556 deletions(-) delete mode 100644 indra/newview/lleventinfo.cpp delete mode 100644 indra/newview/lleventinfo.h diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index d685e6ae36..e15cc368e6 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -139,7 +139,6 @@ set(viewer_SOURCE_FILES lldriverparam.cpp lldynamictexture.cpp llemote.cpp - lleventinfo.cpp lleventnotifier.cpp lleventpoll.cpp llexpandabletextbox.cpp @@ -667,7 +666,6 @@ set(viewer_HEADER_FILES lldriverparam.h lldynamictexture.h llemote.h - lleventinfo.h lleventnotifier.h lleventpoll.h llexpandabletextbox.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 0bed37b96a..a3c43cb21a 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2875,6 +2875,17 @@ Value 175 + EventURL + + Comment + URL for Event website, displayed in the event floater + Persist + 0 + Type + String + Value + http://search.secondlife.com/viewer/embed/event/ + EveryoneCopy Comment diff --git a/indra/newview/lleventinfo.cpp b/indra/newview/lleventinfo.cpp deleted file mode 100644 index b7b4e10b17..0000000000 --- a/indra/newview/lleventinfo.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/** - * @file lleventinfo.cpp - * @brief LLEventInfo class implementation - * - * $LicenseInfo:firstyear=2004&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" -#include "lleventinfo.h" - -#include "lluuid.h" -#include "message.h" - -LLEventInfo::cat_map LLEventInfo::sCategories; - -void LLEventInfo::unpack(LLMessageSystem *msg) -{ - U32 event_id; - msg->getU32("EventData", "EventID", event_id); - mID = event_id; - - msg->getString("EventData", "Name", mName); - - msg->getString("EventData", "Category", mCategoryStr); - - msg->getString("EventData", "Date", mTimeStr); - - U32 duration; - msg->getU32("EventData","Duration",duration); - mDuration = duration; - - U32 date; - msg->getU32("EventData", "DateUTC", date); - mUnixTime = date; - - msg->getString("EventData", "Desc", mDesc); - - std::string buffer; - msg->getString("EventData", "Creator", buffer); - mRunByID = LLUUID(buffer); - - U32 foo; - msg->getU32("EventData", "Cover", foo); - - mHasCover = foo ? TRUE : FALSE; - if (mHasCover) - { - U32 cover; - msg->getU32("EventData", "Amount", cover); - mCover = cover; - } - - msg->getString("EventData", "SimName", mSimName); - - msg->getVector3d("EventData", "GlobalPos", mPosGlobal); - - // Mature content - U32 event_flags; - msg->getU32("EventData", "EventFlags", event_flags); - mEventFlags = event_flags; -} - -// static -void LLEventInfo::loadCategories(const LLSD& options) -{ - for(LLSD::array_const_iterator resp_it = options.beginArray(), - end = options.endArray(); resp_it != end; ++resp_it) - { - LLSD name = (*resp_it)["category_name"]; - if(name.isDefined()) - { - LLSD id = (*resp_it)["category_id"]; - if(id.isDefined()) - { - LLEventInfo::sCategories[id.asInteger()] = name.asString(); - } - } - } -} diff --git a/indra/newview/lleventinfo.h b/indra/newview/lleventinfo.h deleted file mode 100644 index 958a276fbf..0000000000 --- a/indra/newview/lleventinfo.h +++ /dev/null @@ -1,74 +0,0 @@ -/** - * @file lleventinfo.h - * @brief LLEventInfo class definition - * - * $LicenseInfo:firstyear=2004&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLEVENTINFO_H -#define LL_LLEVENTINFO_H - -#include - -#include "v3dmath.h" -#include "lluuid.h" - -class LLMessageSystem; - -class LLEventInfo -{ -public: - LLEventInfo() : - mID(0), - mDuration(0), - mUnixTime(0), - mHasCover(FALSE), - mCover(0), - mEventFlags(0), - mSelected(FALSE) - {} - - void unpack(LLMessageSystem *msg); - - static void loadCategories(const LLSD& options); - -public: - std::string mName; - U32 mID; - std::string mDesc; - std::string mCategoryStr; - U32 mDuration; - std::string mTimeStr; - LLUUID mRunByID; - std::string mSimName; - LLVector3d mPosGlobal; - time_t mUnixTime; // seconds from 1970 - BOOL mHasCover; - U32 mCover; - U32 mEventFlags; - BOOL mSelected; - - typedef std::map cat_map; - static cat_map sCategories; -}; - -#endif // LL_LLEVENTINFO_H diff --git a/indra/newview/lleventnotifier.cpp b/indra/newview/lleventnotifier.cpp index 68559a4236..bedab75f98 100644 --- a/indra/newview/lleventnotifier.cpp +++ b/indra/newview/lleventnotifier.cpp @@ -31,10 +31,63 @@ #include "llnotificationsutil.h" #include "message.h" -#include "lleventinfo.h" #include "llfloaterreg.h" #include "llfloaterworldmap.h" +#include "llfloaterevent.h" #include "llagent.h" +#include "llcommandhandler.h" // secondlife:///app/... support + +class LLEventHandler : public LLCommandHandler +{ +public: + // requires trusted browser to trigger + LLEventHandler() : LLCommandHandler("event", UNTRUSTED_THROTTLE) { } + bool handle(const LLSD& params, const LLSD& query_map, + LLMediaCtrl* web) + { + if (params.size() < 2) + { + return false; + } + std::string event_command = params[1].asString(); + S32 event_id = params[0].asInteger(); + if(event_command == "details") + { + LLFloaterEvent* floater = LLFloaterReg::getTypedInstance("event"); + if (floater) + { + floater->setEventID(event_id); + LLFloaterReg::showTypedInstance("event"); + return true; + } + } + else if(event_command == "notify") + { + // we're adding or removing a notification, so grab the date, name and notification bool + if (params.size() < 3) + { + return false; + } + if(params[2].asString() == "enable") + { + gEventNotifier.add(event_id); + // tell the server to modify the database as this was a slurl event notification command + gEventNotifier.serverPushRequest(event_id, true); + + } + else + { + gEventNotifier.remove(event_id); + } + return true; + } + + + return false; + } +}; +LLEventHandler gEventHandler; + LLEventNotifier gEventNotifier; @@ -63,31 +116,102 @@ void LLEventNotifier::update() // Check our notifications again and send out updates // if they happen. - time_t alert_time = time_corrected() + 5 * 60; + F64 alert_time = LLDate::now().secondsSinceEpoch() + 5 * 60; en_map::iterator iter; for (iter = mEventNotifications.begin(); iter != mEventNotifications.end();) { LLEventNotification *np = iter->second; - if (np->getEventDate() < (alert_time)) + iter++; + if (np->getEventDateEpoch() < alert_time) { LLSD args; args["NAME"] = np->getEventName(); + args["DATE"] = np->getEventDateStr(); LLNotificationsUtil::add("EventNotification", args, LLSD(), - boost::bind(&LLEventNotification::handleResponse, np, _1, _2)); - mEventNotifications.erase(iter++); + boost::bind(&LLEventNotifier::handleResponse, this, np->getEventID(), _1, _2)); + remove(np->getEventID()); + } - else + } + mNotificationTimer.reset(); + } +} + + + +bool LLEventNotifier::handleResponse(U32 eventId, const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + switch (option) + { + case 0: + { + LLFloaterEvent* floater = LLFloaterReg::getTypedInstance("event"); + if (floater) { - iter++; + floater->setEventID(eventId); + LLFloaterReg::showTypedInstance("event"); } + break; } - mNotificationTimer.reset(); + case 1: + break; } + return true; } +bool LLEventNotifier::add(U32 eventId, F64 eventEpoch, const std::string& eventDateStr, const std::string &eventName) +{ + LLEventNotification *new_enp = new LLEventNotification(eventId, eventEpoch, eventDateStr, eventName); + + llinfos << "Add event " << eventName << " id " << eventId << " date " << eventDateStr << llendl; + if(!new_enp->isValid()) + { + delete new_enp; + return false; + } + + mEventNotifications[new_enp->getEventID()] = new_enp; + return true; + +} + +void LLEventNotifier::add(U32 eventId) +{ + + gMessageSystem->newMessageFast(_PREHASH_EventInfoRequest); + gMessageSystem->nextBlockFast(_PREHASH_AgentData); + gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); + gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() ); + gMessageSystem->nextBlockFast(_PREHASH_EventData); + gMessageSystem->addU32Fast(_PREHASH_EventID, eventId); + gAgent.sendReliableMessage(); + +} + +//static +void LLEventNotifier::processEventInfoReply(LLMessageSystem *msg, void **) +{ + // extract the agent id + LLUUID agent_id; + U32 event_id; + std::string event_name; + std::string eventd_date; + U32 event_time_utc; + + msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); + msg->getU32("EventData", "EventID", event_id); + msg->getString("EventData", "Name", event_name); + msg->getString("EventData", "Date", eventd_date); + msg->getU32("EventData", "DateUTC", event_time_utc); + + gEventNotifier.add(event_id, (F64)event_time_utc, eventd_date, event_name); +} + + void LLEventNotifier::load(const LLSD& event_options) { for(LLSD::array_const_iterator resp_it = event_options.beginArray(), @@ -95,15 +219,7 @@ void LLEventNotifier::load(const LLSD& event_options) { LLSD response = *resp_it; - LLEventNotification *new_enp = new LLEventNotification(); - - if(!new_enp->load(response)) - { - delete new_enp; - continue; - } - - mEventNotifications[new_enp->getEventID()] = new_enp; + add(response["event_id"].asInteger(), response["event_date_ut"], response["event_date"].asString(), response["event_name"].asString()); } } @@ -117,32 +233,6 @@ BOOL LLEventNotifier::hasNotification(const U32 event_id) return FALSE; } - -void LLEventNotifier::add(LLEventInfo &event_info) -{ - // We need to tell the simulator that we want to pay attention to - // this event, as well as add it to our list. - - if (mEventNotifications.find(event_info.mID) != mEventNotifications.end()) - { - // We already have a notification for this event, don't bother. - return; - } - - // Push up a message to tell the server we have this notification. - gMessageSystem->newMessage("EventNotificationAddRequest"); - gMessageSystem->nextBlockFast(_PREHASH_AgentData); - gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); - gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - gMessageSystem->nextBlock("EventData"); - gMessageSystem->addU32("EventID", event_info.mID); - gAgent.sendReliableMessage(); - - LLEventNotification *enp = new LLEventNotification; - enp->load(event_info); - mEventNotifications[event_info.mID] = enp; -} - void LLEventNotifier::remove(const U32 event_id) { en_map::iterator iter; @@ -153,164 +243,36 @@ void LLEventNotifier::remove(const U32 event_id) return; } - // Push up a message to tell the server to remove this notification. - gMessageSystem->newMessage("EventNotificationRemoveRequest"); + serverPushRequest(event_id, false); + delete iter->second; + mEventNotifications.erase(iter); +} + + +void LLEventNotifier::serverPushRequest(U32 event_id, bool add) +{ + // Push up a message to tell the server we have this notification. + gMessageSystem->newMessage(add?"EventNotificationAddRequest":"EventNotificationRemoveRequest"); gMessageSystem->nextBlockFast(_PREHASH_AgentData); gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); gMessageSystem->nextBlock("EventData"); gMessageSystem->addU32("EventID", event_id); gAgent.sendReliableMessage(); - - delete iter->second; - mEventNotifications.erase(iter); -} - -LLEventNotification::LLEventNotification() : - mEventID(0), - mEventDate(0), - mEventName("") -{ } -LLEventNotification::~LLEventNotification() +LLEventNotification::LLEventNotification(U32 eventId, F64 eventEpoch, const std::string& eventDateStr, const std::string &eventName) : + mEventID(eventId), + mEventName(eventName), + mEventDateEpoch(eventEpoch), + mEventDateStr(eventDateStr) { + } -bool LLEventNotification::handleResponse(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - switch (option) - { - case 0: - { - gAgent.teleportViaLocation(getEventPosGlobal()); - LLFloaterWorldMap* floater_world_map = LLFloaterWorldMap::getInstance(); - if(floater_world_map) floater_world_map->trackLocation(getEventPosGlobal()); - break; - } - case 1: - LLFloaterReg::showInstance("search", LLSD().with("category", "events").with("id", S32(getEventID()))); - break; - case 2: - break; - } - // We could clean up the notification on the server now if we really wanted to. - return false; -} -BOOL LLEventNotification::load(const LLSD& response) -{ - BOOL event_ok = TRUE; - LLSD option = response.get("event_id"); - if (option.isDefined()) - { - mEventID = option.asInteger(); - } - else - { - event_ok = FALSE; - } - option = response.get("event_name"); - if (option.isDefined()) - { - llinfos << "Event: " << option.asString() << llendl; - mEventName = option.asString(); - } - else - { - event_ok = FALSE; - } - option = response.get("event_date"); - if (option.isDefined()) - { - llinfos << "EventDate: " << option.asString() << llendl; - mEventDateStr = option.asString(); - } - else - { - event_ok = FALSE; - } - - option = response.get("event_date_ut"); - if (option.isDefined()) - { - llinfos << "EventDate: " << option.asString() << llendl; - mEventDate = strtoul(option.asString().c_str(), NULL, 10); - } - else - { - event_ok = FALSE; - } - - S32 grid_x = 0; - S32 grid_y = 0; - S32 x_region = 0; - S32 y_region = 0; - - option = response.get("grid_x"); - if (option.isDefined()) - { - llinfos << "GridX: " << option.asInteger() << llendl; - grid_x= option.asInteger(); - } - else - { - event_ok = FALSE; - } - - option = response.get("grid_y"); - if (option.isDefined()) - { - llinfos << "GridY: " << option.asInteger() << llendl; - grid_y = option.asInteger(); - } - else - { - event_ok = FALSE; - } - - option = response.get("x_region"); - if (option.isDefined()) - { - llinfos << "RegionX: " << option.asInteger() << llendl; - x_region = option.asInteger(); - } - else - { - event_ok = FALSE; - } - - option = response.get("y_region"); - if (option.isDefined()) - { - llinfos << "RegionY: " << option.asInteger() << llendl; - y_region = option.asInteger(); - } - else - { - event_ok = FALSE; - } - - mEventPosGlobal.mdV[VX] = grid_x * 256 + x_region; - mEventPosGlobal.mdV[VY] = grid_y * 256 + y_region; - mEventPosGlobal.mdV[VZ] = 0.f; - - return event_ok; -} - -BOOL LLEventNotification::load(const LLEventInfo &event_info) -{ - - mEventID = event_info.mID; - mEventName = event_info.mName; - mEventDateStr = event_info.mTimeStr; - mEventDate = event_info.mUnixTime; - mEventPosGlobal = event_info.mPosGlobal; - return TRUE; -} diff --git a/indra/newview/lleventnotifier.h b/indra/newview/lleventnotifier.h index 0367fc47b0..697a708762 100644 --- a/indra/newview/lleventnotifier.h +++ b/indra/newview/lleventnotifier.h @@ -30,7 +30,6 @@ #include "llframetimer.h" #include "v3dmath.h" -class LLEventInfo; class LLEventNotification; @@ -41,15 +40,21 @@ public: virtual ~LLEventNotifier(); void update(); // Notify the user of the event if it's coming up + bool add(U32 eventId, F64 eventEpoch, const std::string& eventDateStr, const std::string &eventName); + void add(U32 eventId); + void load(const LLSD& event_options); // In the format that it comes in from login - void add(LLEventInfo &event_info); // Add a new notification for an event void remove(U32 event_id); BOOL hasNotification(const U32 event_id); + void serverPushRequest(U32 event_id, bool add); typedef std::map en_map; + bool handleResponse(U32 eventId, const LLSD& notification, const LLSD& response); + static void processEventInfoReply(LLMessageSystem *msg, void **); + protected: en_map mEventNotifications; LLFrameTimer mNotificationTimer; @@ -59,25 +64,21 @@ protected: class LLEventNotification { public: - LLEventNotification(); - virtual ~LLEventNotification(); + LLEventNotification(U32 eventId, F64 eventEpoch, const std::string& eventDateStr, const std::string &eventName); + - BOOL load(const LLSD& en); // In the format it comes in from login - BOOL load(const LLEventInfo &event_info); // From existing event_info on the viewer. - //void setEventID(const U32 event_id); - //void setEventName(std::string &event_name); U32 getEventID() const { return mEventID; } const std::string &getEventName() const { return mEventName; } - time_t getEventDate() const { return mEventDate; } - const std::string &getEventDateStr() const { return mEventDateStr; } - LLVector3d getEventPosGlobal() const { return mEventPosGlobal; } - bool handleResponse(const LLSD& notification, const LLSD& payload); + bool isValid() const { return mEventID > 0 && mEventDateEpoch != 0 && mEventName.size() > 0; } + const F64 &getEventDateEpoch() const { return mEventDateEpoch; } + const std::string &getEventDateStr() const { return mEventDateStr; } + + protected: U32 mEventID; // EventID for this event std::string mEventName; + F64 mEventDateEpoch; std::string mEventDateStr; - time_t mEventDate; - LLVector3d mEventPosGlobal; }; extern LLEventNotifier gEventNotifier; diff --git a/indra/newview/llfloaterevent.cpp b/indra/newview/llfloaterevent.cpp index ee2ba2ba54..0513146e8c 100644 --- a/indra/newview/llfloaterevent.cpp +++ b/indra/newview/llfloaterevent.cpp @@ -38,10 +38,11 @@ #include "llcachename.h" #include "llcommandhandler.h" // secondlife:///app/chat/ support #include "lleventflags.h" -#include "lleventnotifier.h" +#include "llmediactrl.h" #include "llexpandabletextbox.h" #include "llfloater.h" #include "llfloaterreg.h" +#include "llmediactrl.h" #include "llfloaterworldmap.h" #include "llinventorymodel.h" #include "llsecondlifeurls.h" @@ -57,35 +58,10 @@ #include "lltrans.h" -class LLEventHandler : public LLCommandHandler -{ -public: - // requires trusted browser to trigger - LLEventHandler() : LLCommandHandler("event", UNTRUSTED_THROTTLE) { } - bool handle(const LLSD& params, const LLSD& query_map, - LLMediaCtrl* web) - { - if (params.size() < 1) - { - return false; - } - - LLFloaterEvent* floater = LLFloaterReg::getTypedInstance("event"); - if (floater) - { - floater->setEventID(params[0].asInteger()); - LLFloaterReg::showTypedInstance("event"); - return true; - } - - return false; - } -}; -LLEventHandler gEventHandler; - LLFloaterEvent::LLFloaterEvent(const LLSD& key) : LLFloater(key), - + LLViewerMediaObserver(), + mBrowser(NULL), mEventID(0) { } @@ -98,253 +74,52 @@ LLFloaterEvent::~LLFloaterEvent() BOOL LLFloaterEvent::postBuild() { - mTBName = getChild("event_name"); - - mTBCategory = getChild("event_category"); - - mTBDate = getChild("event_date"); - - mTBDuration = getChild("event_duration"); - - mTBDesc = getChild("event_desc"); - - mTBRunBy = getChild("event_runby"); - mTBLocation = getChild("event_location"); - mTBCover = getChild("event_cover"); - - mTeleportBtn = getChild( "teleport_btn"); - mTeleportBtn->setClickedCallback(onClickTeleport, this); - - mMapBtn = getChild( "map_btn"); - mMapBtn->setClickedCallback(onClickMap, this); - - mNotifyBtn = getChild( "notify_btn"); - mNotifyBtn->setClickedCallback(onClickNotify, this); - - mCreateEventBtn = getChild( "create_event_btn"); - mCreateEventBtn->setClickedCallback(onClickCreateEvent, this); - - mGodDeleteEventBtn = getChild( "god_delete_event_btn"); - mGodDeleteEventBtn->setClickedCallback(boost::bind(&LLFloaterEvent::onClickDeleteEvent, this)); - - return TRUE; -} - -void LLFloaterEvent::setEventID(const U32 event_id) -{ - mEventID = event_id; - // Should reset all of the panel state here - resetInfo(); - - if (event_id != 0) + mBrowser = getChild("browser"); + if (mBrowser) { - sendEventInfoRequest(); + mBrowser->addObserver(this); + mBrowser->setTrusted(true); } -} - -void LLFloaterEvent::onClickDeleteEvent() -{ - LLMessageSystem* msg = gMessageSystem; - - msg->newMessageFast(_PREHASH_EventGodDelete); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - - msg->nextBlockFast(_PREHASH_EventData); - msg->addU32Fast(_PREHASH_EventID, mEventID); - gAgent.sendReliableMessage(); -} - -void LLFloaterEvent::sendEventInfoRequest() -{ - LLMessageSystem *msg = gMessageSystem; - - msg->newMessageFast(_PREHASH_EventInfoRequest); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() ); - msg->nextBlockFast(_PREHASH_EventData); - msg->addU32Fast(_PREHASH_EventID, mEventID); - gAgent.sendReliableMessage(); + return TRUE; } -//static -void LLFloaterEvent::processEventInfoReply(LLMessageSystem *msg, void **) +void LLFloaterEvent::handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event) { - // extract the agent id - LLUUID agent_id; - msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); - - LLFloaterEvent* floater = LLFloaterReg::getTypedInstance("event"); - - if(floater) + switch (event) { - floater->mEventInfo.unpack(msg); - floater->mTBName->setText(floater->mEventInfo.mName); - floater->mTBCategory->setText(floater->mEventInfo.mCategoryStr); - floater->mTBDate->setText(floater->mEventInfo.mTimeStr); - floater->mTBDesc->setText(floater->mEventInfo.mDesc); - floater->mTBRunBy->setText(LLSLURL("agent", floater->mEventInfo.mRunByID, "inspect").getSLURLString()); - - floater->mTBDuration->setText(llformat("%d:%.2d", floater->mEventInfo.mDuration / 60, floater->mEventInfo.mDuration % 60)); - - if (!floater->mEventInfo.mHasCover) - { - floater->mTBCover->setText(floater->getString("none")); - } - else - { - floater->mTBCover->setText(llformat("%d", floater->mEventInfo.mCover)); - } - - F32 global_x = (F32)floater->mEventInfo.mPosGlobal.mdV[VX]; - F32 global_y = (F32)floater->mEventInfo.mPosGlobal.mdV[VY]; - - S32 region_x = llround(global_x) % REGION_WIDTH_UNITS; - S32 region_y = llround(global_y) % REGION_WIDTH_UNITS; - S32 region_z = llround((F32)floater->mEventInfo.mPosGlobal.mdV[VZ]); - - std::string desc = floater->mEventInfo.mSimName + llformat(" (%d, %d, %d)", region_x, region_y, region_z); - floater->mTBLocation->setText(desc); - - floater->getChildView("rating_icon_m")->setVisible( FALSE); - floater->getChildView("rating_icon_r")->setVisible( FALSE); - floater->getChildView("rating_icon_pg")->setVisible( FALSE); - floater->getChild("rating_value")->setValue(floater->getString("unknown")); - - //for some reason there's not adult flags for now, so see if region is adult and then - //set flags - LLWorldMapMessage::url_callback_t cb = boost::bind( ®ionInfoCallback, floater->mEventInfo.mID, _1); - LLWorldMapMessage::getInstance()->sendNamedRegionRequest(floater->mEventInfo.mSimName, cb, std::string("unused"), false); - - if (floater->mEventInfo.mUnixTime < time_corrected()) - { - floater->mNotifyBtn->setEnabled(FALSE); - } - else - { - floater->mNotifyBtn->setEnabled(TRUE); - } - - if (gEventNotifier.hasNotification(floater->mEventInfo.mID)) - { - floater->mNotifyBtn->setLabel(floater->getString("dont_notify")); - } - else - { - floater->mNotifyBtn->setLabel(floater->getString("notify")); - } - - floater->mMapBtn->setEnabled(TRUE); - floater->mTeleportBtn->setEnabled(TRUE); + case MEDIA_EVENT_NAVIGATE_BEGIN: + getChild("status_text")->setValue(getString("loading_text")); + break; + + case MEDIA_EVENT_NAVIGATE_COMPLETE: + getChild("status_text")->setValue(getString("done_text")); + break; + + default: + break; } } -//static -void LLFloaterEvent::regionInfoCallback(U32 event_id, U64 region_handle) +void LLFloaterEvent::setEventID(const U32 event_id) { - LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromHandle(region_handle); - LLFloaterEvent* floater = LLFloaterReg::getTypedInstance("event"); + mEventID = event_id; - if (sim_info && floater && (event_id == floater->getEventID())) + if (event_id != 0) { - // update the event with the maturity info - if (sim_info->isAdult()) - { - floater->getChildView("rating_icon_m")->setVisible( FALSE); - floater->getChildView("rating_icon_r")->setVisible( TRUE); - floater->getChildView("rating_icon_pg")->setVisible( FALSE); - floater->getChild("rating_value")->setValue(floater->getString("adult")); - - } - else if (floater->mEventInfo.mEventFlags & EVENT_FLAG_MATURE) - { - floater->getChildView("rating_icon_m")->setVisible( TRUE); - floater->getChildView("rating_icon_r")->setVisible( FALSE); - floater->getChildView("rating_icon_pg")->setVisible( FALSE); - floater->getChild("rating_value")->setValue(floater->getString("moderate")); - } - else - { - floater->getChildView("rating_icon_m")->setVisible( FALSE); - floater->getChildView("rating_icon_r")->setVisible( FALSE); - floater->getChildView("rating_icon_pg")->setVisible( TRUE); - floater->getChild("rating_value")->setValue(floater->getString("general")); - } + LLSD subs; + subs["EVENT_ID"] = (S32)event_id; + // get the search URL and expand all of the substitutions + // (also adds things like [LANGUAGE], [VERSION], [OS], etc.) + std::ostringstream url; + url << gSavedSettings.getString("EventURL") << event_id << "/" << std::endl; + // and load the URL in the web view + mBrowser->navigateTo(url.str()); + } } void LLFloaterEvent::draw() { - mGodDeleteEventBtn->setVisible(gAgent.isGodlike()); - LLPanel::draw(); } - -void LLFloaterEvent::resetInfo() -{ - mTBName->setText(LLStringUtil::null); - mTBCategory->setText(LLStringUtil::null); - mTBDate->setText(LLStringUtil::null); - mTBDesc->setText(LLStringUtil::null); - mTBDuration->setText(LLStringUtil::null); - mTBCover->setText(LLStringUtil::null); - mTBLocation->setText(LLStringUtil::null); - mTBRunBy->setText(LLStringUtil::null); - mNotifyBtn->setEnabled(FALSE); - mMapBtn->setEnabled(FALSE); - mTeleportBtn->setEnabled(FALSE); -} - -// static -void LLFloaterEvent::onClickTeleport(void* data) -{ - LLFloaterEvent* self = (LLFloaterEvent*)data; - LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance(); - if (!self->mEventInfo.mPosGlobal.isExactlyZero()&&worldmap_instance) - { - gAgent.teleportViaLocation(self->mEventInfo.mPosGlobal); - worldmap_instance->trackLocation(self->mEventInfo.mPosGlobal); - } -} - - -// static -void LLFloaterEvent::onClickMap(void* data) -{ - LLFloaterEvent* self = (LLFloaterEvent*)data; - LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance(); - - if (!self->mEventInfo.mPosGlobal.isExactlyZero()&&worldmap_instance) - { - worldmap_instance->trackLocation(self->mEventInfo.mPosGlobal); - LLFloaterReg::showInstance("world_map", "center"); - } -} - - -// static -void LLFloaterEvent::onClickCreateEvent(void* data) -{ - LLNotificationsUtil::add("PromptGoToEventsPage");//, LLSD(), LLSD(), callbackCreateEventWebPage); -} - - -// static -void LLFloaterEvent::onClickNotify(void *data) -{ - LLFloaterEvent* self = (LLFloaterEvent*)data; - - if (!gEventNotifier.hasNotification(self->mEventID)) - { - gEventNotifier.add(self->mEventInfo); - self->mNotifyBtn->setLabel(self->getString("dont_notify")); - } - else - { - gEventNotifier.remove(self->mEventInfo.mID); - self->mNotifyBtn->setLabel(self->getString("notify")); - } -} diff --git a/indra/newview/llfloaterevent.h b/indra/newview/llfloaterevent.h index bfed2f259b..b1963309da 100644 --- a/indra/newview/llfloaterevent.h +++ b/indra/newview/llfloaterevent.h @@ -28,17 +28,15 @@ #define LL_LLFLOATEREVENT_H #include "llfloater.h" -#include "lleventinfo.h" -#include "lluuid.h" -#include "v3dmath.h" +#include "llviewermediaobserver.h" -class LLTextBox; -class LLTextEditor; + +class LLMediaCtrl; class LLButton; -class LLExpandableTextBox; -class LLMessageSystem; -class LLFloaterEvent : public LLFloater +class LLFloaterEvent : public LLFloater, + public LLViewerMediaObserver + { public: LLFloaterEvent(const LLSD& key); @@ -48,44 +46,18 @@ public: /*virtual*/ void draw(); void setEventID(const U32 event_id); - void sendEventInfoRequest(); - - static void processEventInfoReply(LLMessageSystem *msg, void **); U32 getEventID() { return mEventID; } -protected: - void resetInfo(); - - static void onClickTeleport(void*); - static void onClickMap(void*); - //static void onClickLandmark(void*); - static void onClickCreateEvent(void*); - static void onClickNotify(void*); - void onClickDeleteEvent(); - - static void regionInfoCallback(U32 event_id, U64 region_handle); protected: + /*virtual*/ void handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event); + U32 mEventID; - LLEventInfo mEventInfo; - - LLTextBox* mTBName; - LLTextBox* mTBCategory; - LLTextBox* mTBDate; - LLTextBox* mTBDuration; - LLExpandableTextBox* mTBDesc; - LLTextBox* mTBRunBy; - LLTextBox* mTBLocation; - LLTextBox* mTBCover; + LLMediaCtrl* mBrowser; - LLButton* mTeleportBtn; - LLButton* mMapBtn; - LLButton* mCreateEventBtn; - LLButton* mGodDeleteEventBtn; - LLButton* mNotifyBtn; }; #endif // LL_LLFLOATEREVENT_H diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h index 6327039b7f..1628a421ec 100644 --- a/indra/newview/llfloaterworldmap.h +++ b/indra/newview/llfloaterworldmap.h @@ -39,7 +39,6 @@ #include "lltracker.h" #include "llslurl.h" -class LLEventInfo; class LLFriendObserver; class LLInventoryModel; class LLInventoryObserver; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 975d1f9f32..6bbddd9b2e 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -118,7 +118,6 @@ #include "llpanellogin.h" #include "llmutelist.h" #include "llavatarpropertiesprocessor.h" -#include "llfloaterevent.h" #include "llpanelclassified.h" #include "llpanelpick.h" #include "llpanelgrouplandmoney.h" @@ -1612,12 +1611,6 @@ bool idle_startup() LLFloaterReg::showInstance("hud", LLSD(), FALSE); } - LLSD event_categories = response["event_categories"]; - if(event_categories.isDefined()) - { - LLEventInfo::loadCategories(event_categories); - } - LLSD event_notifications = response["event_notifications"]; if(event_notifications.isDefined()) { @@ -2329,8 +2322,8 @@ void register_viewer_callbacks(LLMessageSystem* msg) msg->setHandlerFunc("MapBlockReply", LLWorldMapMessage::processMapBlockReply); msg->setHandlerFunc("MapItemReply", LLWorldMapMessage::processMapItemReply); - - msg->setHandlerFunc("EventInfoReply", LLFloaterEvent::processEventInfoReply); + msg->setHandlerFunc("EventInfoReply", LLEventNotifier::processEventInfoReply); + msg->setHandlerFunc("PickInfoReply", &LLAvatarPropertiesProcessor::processPickInfoReply); // msg->setHandlerFunc("ClassifiedInfoReply", LLPanelClassified::processClassifiedInfoReply); msg->setHandlerFunc("ClassifiedInfoReply", LLAvatarPropertiesProcessor::processClassifiedInfoReply); diff --git a/indra/newview/skins/default/xui/da/floater_event.xml b/indra/newview/skins/default/xui/da/floater_event.xml index 1816144b45..1d16c942dd 100644 --- a/indra/newview/skins/default/xui/da/floater_event.xml +++ b/indra/newview/skins/default/xui/da/floater_event.xml @@ -1,72 +1,39 @@ - - - - ingen + + + + Henter... - - Meddel - - - Meddel ikke - - - Moderat - - - Voksent - - - Generelt - - - Ukendt - - - - - Event uden navn. - - - (ingen kategori) - - - Afholdt af: - - - - Dato: - - - 10/10/2010 - - - Varighed: - - - 1 time - - - Pris: - - - Gratis - - - Lokation: - - - - - - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. - - - -