From dd1b70f712849b7d0c96f0720e28453121b2bf1e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 20 Oct 2010 17:03:36 -0400 Subject: SOCIAL-84, SOCIAL-85 WIP --- indra/newview/llpanelpicks.cpp | 75 +++++++++++++++++++++++++++++++++++------- 1 file changed, 63 insertions(+), 12 deletions(-) mode change 100644 => 100755 indra/newview/llpanelpicks.cpp (limited to 'indra/newview/llpanelpicks.cpp') diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp old mode 100644 new mode 100755 index 27787ac211..e70c7be728 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -70,6 +70,39 @@ static const std::string CLASSIFIED_NAME("classified_name"); static LLRegisterPanelClassWrapper t_panel_picks("panel_picks"); +class LLPickHandler : public LLCommandHandler +{ +public: + // requires trusted browser to trigger + LLPickHandler() : LLCommandHandler("pick", UNTRUSTED_THROTTLE) { } + + bool handle(const LLSD& params, const LLSD& query_map, + LLMediaCtrl* web) + { + if (params.size() < 1) return false; + const std::string verb = params[0]; + + if (verb == "create") + { + // Open "create pick" in side tab. + } + else if (verb == "edit") + { + // How to identify the pick? + llwarns << "how to identify pick?" << llendl; + } + else + { + llwarns << "unknown verb " << verb << llendl; + return false; + } + + return true; + } +}; + +LLPickHandler gPickHandler; + class LLClassifiedHandler : public LLCommandHandler, public LLAvatarPropertiesObserver @@ -80,6 +113,8 @@ public: std::set mClassifiedIds; + std::string mRequestVerb; + bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) { // handle app/classified/create urls first @@ -107,6 +142,15 @@ public: const std::string verb = params[1].asString(); if (verb == "about") { + mRequestVerb = verb; + mClassifiedIds.insert(classified_id); + LLAvatarPropertiesProcessor::getInstance()->addObserver(LLUUID(), this); + LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(classified_id); + return true; + } + else if (verb == "edit") + { + mRequestVerb = verb; mClassifiedIds.insert(classified_id); LLAvatarPropertiesProcessor::getInstance()->addObserver(LLUUID(), this); LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(classified_id); @@ -128,18 +172,25 @@ public: void openClassified(LLAvatarClassifiedInfo* c_info) { - // open the classified info panel on the Me > Picks sidetray - LLSD params; - params["id"] = c_info->creator_id; - params["open_tab_name"] = "panel_picks"; - params["show_tab_panel"] = "classified_details"; - params["classified_id"] = c_info->classified_id; - params["classified_creator_id"] = c_info->creator_id; - params["classified_snapshot_id"] = c_info->snapshot_id; - params["classified_name"] = c_info->name; - params["classified_desc"] = c_info->description; - params["from_search"] = true; - LLSideTray::getInstance()->showPanel("panel_profile_view", params); + if (mRequestVerb == "about") + { + // open the classified info panel on the Me > Picks sidetray + LLSD params; + params["id"] = c_info->creator_id; + params["open_tab_name"] = "panel_picks"; + params["show_tab_panel"] = "classified_details"; + params["classified_id"] = c_info->classified_id; + params["classified_creator_id"] = c_info->creator_id; + params["classified_snapshot_id"] = c_info->snapshot_id; + params["classified_name"] = c_info->name; + params["classified_desc"] = c_info->description; + params["from_search"] = true; + LLSideTray::getInstance()->showPanel("panel_profile_view", params); + } + else if (mRequestVerb == "edit") + { + llwarns << "edit in progress" << llendl; + } } /*virtual*/ void processProperties(void* data, EAvatarProcessorType type) -- cgit v1.2.3 From 53eeee7b70a80e718b8331bde66848fdfbe77355 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 21 Oct 2010 14:41:42 -0400 Subject: support for edit classified slapp --- indra/newview/llpanelpicks.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'indra/newview/llpanelpicks.cpp') diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index e70c7be728..941bf6e98d 100755 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -190,6 +190,13 @@ public: else if (mRequestVerb == "edit") { llwarns << "edit in progress" << llendl; + // open the new classified panel on the Me > Picks sidetray + LLSD params; + params["id"] = gAgent.getID(); + params["open_tab_name"] = "panel_picks"; + params["show_tab_panel"] = "edit_classified"; + params["classified_id"] = c_info->classified_id; + LLSideTray::getInstance()->showPanel("panel_me", params); } } @@ -822,6 +829,13 @@ void LLPanelPicks::openClassifiedInfo(const LLSD ¶ms) getProfilePanel()->openPanel(mPanelClassifiedInfo, params); } +void LLPanelPicks::openClassifiedEdit(const LLSD& params) +{ + LLUUID classified_id = params["classified_id"].asUUID();; + llinfos << "opening classified " << classified_id << " for edit" << llendl; + editClassified(classified_id); +} + void LLPanelPicks::showAccordion(const std::string& name, bool show) { LLAccordionCtrlTab* tab = getChild(name); @@ -1024,6 +1038,29 @@ void LLPanelPicks::onPanelClassifiedEdit() { return; } + editClassified(c_item->getClassifiedId()); +} + +void LLPanelPicks::editClassified(const LLUUID& classified_id) +{ + // HACK - find item by classified id. Should be a better way. + std::vector items; + mClassifiedsList->getItems(items); + LLClassifiedItem* c_item = NULL; + for(std::vector::iterator it = items.begin(); it != items.end(); ++it) + { + LLClassifiedItem *test_item = dynamic_cast(*it); + if (test_item && test_item->getClassifiedId() == classified_id) + { + c_item = test_item; + break; + } + } + if (!c_item) + { + llwarns << "item not found for classified_id " << classified_id << llendl; + return; + } LLSD params; params["classified_id"] = c_item->getClassifiedId(); -- cgit v1.2.3 From 7b1dd1c84ea781992532a9aa65029928f32f3f4f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 22 Oct 2010 11:35:58 -0400 Subject: SOCIAL-84 FIX, SOCIAL-85 FIX - new slapps for edit classified, create and edit pick --- indra/newview/llpanelpicks.cpp | 104 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 92 insertions(+), 12 deletions(-) (limited to 'indra/newview/llpanelpicks.cpp') diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index 941bf6e98d..9fc31305ca 100755 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -70,34 +70,99 @@ static const std::string CLASSIFIED_NAME("classified_name"); static LLRegisterPanelClassWrapper t_panel_picks("panel_picks"); -class LLPickHandler : public LLCommandHandler +class LLPickHandler : public LLCommandHandler, + public LLAvatarPropertiesObserver { public: + + std::set mPickIds; + // requires trusted browser to trigger LLPickHandler() : LLCommandHandler("pick", UNTRUSTED_THROTTLE) { } bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) { - if (params.size() < 1) return false; - const std::string verb = params[0]; + // handle app/classified/create urls first + if (params.size() == 1 && params[0].asString() == "create") + { + createPick(); + return true; + } - if (verb == "create") + // then handle the general app/pick/{UUID}/{CMD} urls + if (params.size() < 2) { - // Open "create pick" in side tab. + return false; } - else if (verb == "edit") + + // get the ID for the pick_id + LLUUID pick_id; + if (!pick_id.set(params[0], FALSE)) { - // How to identify the pick? - llwarns << "how to identify pick?" << llendl; + return false; + } + + // edit the pick in the side tray. + // need to ask the server for more info first though... + const std::string verb = params[1].asString(); + if (verb == "edit") + { + mPickIds.insert(pick_id); + LLAvatarPropertiesProcessor::getInstance()->addObserver(LLUUID(), this); + LLAvatarPropertiesProcessor::getInstance()->sendPickInfoRequest(gAgent.getID(),pick_id); + return true; } else { llwarns << "unknown verb " << verb << llendl; return false; } - - return true; + } + + void createPick() + { + LLSD params; + params["id"] = gAgent.getID(); + params["open_tab_name"] = "panel_picks"; + params["show_tab_panel"] = "create_pick"; + LLSideTray::getInstance()->showPanel("panel_me", params); + } + + void editPick(LLPickData* pick_info) + { + LLSD params; + params["open_tab_name"] = "panel_picks"; + params["show_tab_panel"] = "edit_pick"; + params["pick_id"] = pick_info->pick_id; + params["avatar_id"] = pick_info->creator_id; + params["snapshot_id"] = pick_info->snapshot_id; + params["pick_name"] = pick_info->name; + params["pick_desc"] = pick_info->desc; + + LLSideTray::getInstance()->showPanel("panel_me", params); + } + + /*virtual*/ void processProperties(void* data, EAvatarProcessorType type) + { + if (APT_PICK_INFO != type) + { + return; + } + + // is this the pick that we asked for? + LLPickData* pick_info = static_cast(data); + if (!pick_info || mPickIds.find(pick_info->pick_id) == mPickIds.end()) + { + return; + } + + // open the edit side tray for this pick + editPick(pick_info); + + // remove our observer now that we're done + mPickIds.erase(pick_info->pick_id); + LLAvatarPropertiesProcessor::getInstance()->removeObserver(LLUUID(), this); } }; @@ -356,7 +421,10 @@ void LLPanelPicks::processProperties(void* data, EAvatarProcessorType type) pick_value.insert(CLASSIFIED_ID, c_data.classified_id); pick_value.insert(CLASSIFIED_NAME, c_data.name); - mClassifiedsList->addItem(c_item, pick_value); + if (!findClassifiedById(c_data.classified_id)) + { + mClassifiedsList->addItem(c_item, pick_value); + } c_item->setDoubleClickCallback(boost::bind(&LLPanelPicks::onDoubleClickClassifiedItem, this, _1)); c_item->setRightMouseUpCallback(boost::bind(&LLPanelPicks::onRightMouseUpItem, this, _1, _2, _3, _4)); @@ -1005,6 +1073,12 @@ void LLPanelPicks::createPickEditPanel() // getProfilePanel()->openPanel(mPanelPickInfo, params); // } +void LLPanelPicks::openPickEdit(const LLSD& params) +{ + createPickEditPanel(); + getProfilePanel()->openPanel(mPanelPickEdit, params); +} + void LLPanelPicks::onPanelPickEdit() { LLSD selected_value = mPicksList->getSelectedValue(); @@ -1041,7 +1115,7 @@ void LLPanelPicks::onPanelClassifiedEdit() editClassified(c_item->getClassifiedId()); } -void LLPanelPicks::editClassified(const LLUUID& classified_id) +LLClassifiedItem *LLPanelPicks::findClassifiedById(const LLUUID& classified_id) { // HACK - find item by classified id. Should be a better way. std::vector items; @@ -1056,6 +1130,12 @@ void LLPanelPicks::editClassified(const LLUUID& classified_id) break; } } + return c_item; +} + +void LLPanelPicks::editClassified(const LLUUID& classified_id) +{ + LLClassifiedItem* c_item = findClassifiedById(classified_id); if (!c_item) { llwarns << "item not found for classified_id " << classified_id << llendl; -- cgit v1.2.3 From 8d2c4369dadc59e83a759f8e5fd62e823ca36a23 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 6 Jan 2011 16:31:27 -0500 Subject: Validation check for edit classified and edit pick slapps --- indra/newview/llpanelpicks.cpp | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'indra/newview/llpanelpicks.cpp') diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index 597ecc0589..c4f3866cad 100755 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -158,7 +158,14 @@ public: } // open the edit side tray for this pick - editPick(pick_info); + if (pick_info->creator_id == gAgent.getID()) + { + editPick(pick_info); + } + else + { + llwarns << "Can't edit a pick you did not create" << llendl; + } // remove our observer now that we're done mPickIds.erase(pick_info->pick_id); @@ -254,14 +261,21 @@ public: } else if (mRequestVerb == "edit") { - llwarns << "edit in progress" << llendl; - // open the new classified panel on the Me > Picks sidetray - LLSD params; - params["id"] = gAgent.getID(); - params["open_tab_name"] = "panel_picks"; - params["show_tab_panel"] = "edit_classified"; - params["classified_id"] = c_info->classified_id; - LLSideTray::getInstance()->showPanel("panel_me", params); + if (c_info->creator_id == gAgent.getID()) + { + llwarns << "edit in progress" << llendl; + // open the new classified panel on the Me > Picks sidetray + LLSD params; + params["id"] = gAgent.getID(); + params["open_tab_name"] = "panel_picks"; + params["show_tab_panel"] = "edit_classified"; + params["classified_id"] = c_info->classified_id; + LLSideTray::getInstance()->showPanel("panel_me", params); + } + else + { + llwarns << "Can't edit a classified you did not create" << llendl; + } } } -- cgit v1.2.3