From ea1bfae838c59e24ec1a962f7d015d609b63d083 Mon Sep 17 00:00:00 2001
From: Steven Bennetts <steve@lindenlab.com>
Date: Mon, 19 Oct 2009 02:17:01 +0000
Subject: [PATCH] Merging revisions 2070-2084 of
 https://svn.aws.productengine.com/secondlife/pe/stable-2 into
 P:\svn\viewer-2.0.0, respecting ancestry * Bugs: EXT-792 EXT-1519 EXT-1514
 EXT-1245 EXT-1600 EXT-1535 EXT-1174 EXT-1241 * Dev: EXT-1271 EXT-1601
 EXT-1154

---
 indra/newview/app_settings/settings.xml       |  33 +
 indra/newview/llcallingcard.cpp               |   5 +-
 indra/newview/llpanelgroup.cpp                |  23 +-
 indra/newview/llpanellandmarks.cpp            |  67 +-
 indra/newview/llpanellandmarks.h              |   6 +-
 indra/newview/llpanelpeople.cpp               | 109 ++-
 indra/newview/llpanelpeople.h                 |  11 +
 indra/newview/llpanelpick.cpp                 | 639 ++++++++----------
 indra/newview/llpanelpick.h                   | 227 +++++--
 indra/newview/llpanelpicks.cpp                | 165 +++--
 indra/newview/llpanelpicks.h                  |  32 +-
 indra/newview/llpanelplaceinfo.cpp            |  14 +-
 indra/newview/llpanelplaceinfo.h              |   4 +-
 indra/newview/llpanelplaces.cpp               |   9 +-
 indra/newview/llpanelplaces.h                 |   4 +-
 indra/newview/llpanelprofile.cpp              |  48 +-
 indra/newview/llpanelprofile.h                |   4 +
 indra/newview/llpanelteleporthistory.cpp      |  38 +-
 indra/newview/llpanelteleporthistory.h        |   4 +-
 indra/newview/llplacesinventorybridge.cpp     |  20 +-
 indra/newview/llviewermessage.cpp             |   7 +
 indra/newview/skins/default/colors.xml        |   2 +-
 .../xui/en/menu_people_friends_view_sort.xml  |  26 +-
 .../xui/en/menu_people_recent_view_sort.xml   |  26 +-
 .../xui/en/menu_places_gear_folder.xml        | 163 +++--
 .../xui/en/menu_places_gear_landmark.xml      | 204 ++++--
 .../skins/default/xui/en/panel_edit_pick.xml  |   3 +-
 .../default/xui/en/panel_group_general.xml    |  14 -
 .../xui/en/panel_group_info_sidetray.xml      |  22 +-
 .../skins/default/xui/en/panel_pick_info.xml  |   4 +-
 30 files changed, 1253 insertions(+), 680 deletions(-)

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 467e1e8342e..2da0e293938 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -7687,6 +7687,39 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
+    <key>FriendsSortOrder</key>
+    <map>
+      <key>Comment</key>
+      <string>Specifies sort order for friends (0 = by name, 1 = by online status)</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>U32</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
+    <key>NearbyPeopleSortOrder</key>
+    <map>
+      <key>Comment</key>
+      <string>Specifies sort order for nearby people (0 = by name, 2 = by most recent)</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>U32</string>
+      <key>Value</key>
+      <integer>2</integer>
+    </map>
+    <key>RecentPeopleSortOrder</key>
+    <map>
+      <key>Comment</key>
+      <string>Specifies sort order for recent people (0 = by name, 2 = by most recent)</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>U32</string>
+      <key>Value</key>
+      <integer>2</integer>
+    </map>
     <key>ShowPGSearchAll</key>    
     <map>
       <key>Comment</key>
diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp
index 359bb23f051..7a81d0c4a1d 100644
--- a/indra/newview/llcallingcard.cpp
+++ b/indra/newview/llcallingcard.cpp
@@ -726,10 +726,11 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online)
 				if (!notifyMsg.empty())
 				{
 					floater->addHistoryLine(notifyMsg,LLUIColorTable::instance().getColor("SystemChatColor"));
-
-					LLIMModel::getInstance()->addMessage(session_id, SYSTEM_FROM, LLUUID::null, notifyMsg);
 				}
 			}
+
+			//*TODO instead of adding IM message about online/offline status
+			//do something like graying avatar icon on messages from a user that went offline, and  make it colored when online.
 		}
 
 		mModifyMask |= LLFriendObserver::ONLINE;
diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp
index 5ed7821b1b0..4708d7ba364 100644
--- a/indra/newview/llpanelgroup.cpp
+++ b/indra/newview/llpanelgroup.cpp
@@ -309,18 +309,31 @@ void LLPanelGroup::update(LLGroupChange gc)
 	{
 		childSetValue("group_name", gdatap->mName);
 
+		LLButton* btn_join = getChild<LLButton>("btn_join");
+		LLUICtrl* join_text = getChild<LLUICtrl>("join_cost_text");
+
 		LLGroupData agent_gdatap;
 		bool is_member = gAgent.getGroupData(mID,agent_gdatap);
-		LLButton* btn_join = getChild<LLButton>("btn_join");
 		bool join_btn_visible = !is_member && gdatap->mOpenEnrollment;
+		
 		btn_join->setVisible(join_btn_visible);
+		join_text->setVisible(join_btn_visible);
+
 		if(join_btn_visible)
 		{
 			LLStringUtil::format_map_t string_args;
-			string_args["[AMOUNT]"] = llformat("%d", gdatap->mMembershipFee);
-			std::string fee_buff = getString("group_join_btn", string_args);
-			btn_join->setLabelSelected(fee_buff);
-			btn_join->setLabelUnselected(fee_buff);
+			std::string fee_buff;
+			if(gdatap->mMembershipFee)
+			{
+				string_args["[AMOUNT]"] = llformat("%d", gdatap->mMembershipFee);
+				fee_buff = getString("group_join_btn", string_args);
+				
+			}
+			else
+			{
+				fee_buff = getString("group_join_free", string_args);
+			}
+			childSetValue("join_cost_text",fee_buff);
 		}
 	}
 }
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index 5f96407d7d1..2cbd80a72d8 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -89,6 +89,8 @@ BOOL LLLandmarksPanel::postBuild()
 	// mast be called before any other initXXX methods to init Gear menu
 	initListCommandsHandlers();
 
+	U32 sort_order = gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER);
+	mSortByDate = sort_order & LLInventoryFilter::SO_DATE;
 	initFavoritesInventroyPanel();
 	initLandmarksInventroyPanel();
 	initMyInventroyPanel();
@@ -227,6 +229,21 @@ LLFolderViewItem* LLLandmarksPanel::getCurSelectedItem () const
 	return mCurrentSelectedList ?  mCurrentSelectedList->getRootFolder()->getCurSelectedItem() : NULL;
 }
 
+void LLLandmarksPanel::updateSortOrder(LLInventoryPanel* panel, bool byDate)
+{
+	if(!panel) return; 
+
+	U32 order = panel->getSortOrder();
+	if (byDate)
+	{
+		panel->setSortOrder( order | LLInventoryFilter::SO_DATE );
+	}
+	else 
+	{
+		panel->setSortOrder( order & ~LLInventoryFilter::SO_DATE );
+	}
+}
+
 // virtual
 void LLLandmarksPanel::processParcelInfo(const LLParcelData& parcel_data)
 {
@@ -240,20 +257,27 @@ void LLLandmarksPanel::processParcelInfo(const LLParcelData& parcel_data)
 		LLInventoryItem* inv_item =  mCurrentSelectedList->getModel()->getItem(id);
 		if(landmark)
 		{
-			LLPanelPick* panel_pick = new LLPanelPick(TRUE);
-			LLSD params;
+			LLPanelPickEdit* panel_pick = LLPanelPickEdit::create();
 			LLVector3d landmark_global_pos;
 			landmark->getGlobalPos(landmark_global_pos);
-			panel_pick->prepareNewPick(landmark_global_pos,cur_item->getName(),inv_item->getDescription(),
-			parcel_data.snapshot_id,parcel_data.parcel_id);
-			// by default save button should be enabled
-			panel_pick->childSetEnabled("save_changes_btn", TRUE);
+
 			// let's toggle pick panel into  panel places
 			LLPanel* panel_places =  LLSideTray::getInstance()->getChild<LLPanel>("panel_places");//-> sidebar_places
 			panel_places->addChild(panel_pick);
 			LLRect paren_rect(panel_places->getRect());
 			panel_pick->reshape(paren_rect.getWidth(),paren_rect.getHeight(), TRUE);
 			panel_pick->setRect(paren_rect);
+			panel_pick->onOpen(LLSD());
+
+			LLPickData data;
+			data.pos_global = landmark_global_pos;
+			data.name = cur_item->getName();
+			data.desc = inv_item->getDescription();
+			data.snapshot_id = parcel_data.snapshot_id;
+			data.parcel_id = parcel_data.parcel_id;
+			panel_pick->setPickData(&data);
+
+			LLSD params;
 			params["parcel_id"] =parcel_data.parcel_id;
 			/* set exit callback to get back onto panel places  
 			 in callback we will make cleaning up( delete pick_panel instance, 
@@ -261,6 +285,8 @@ void LLLandmarksPanel::processParcelInfo(const LLParcelData& parcel_data)
 			*/ 
 			panel_pick->setExitCallback(boost::bind(&LLLandmarksPanel::onPickPanelExit,this,
 					panel_pick, panel_places,params));
+			panel_pick->setSaveCallback(boost::bind(&LLLandmarksPanel::onPickPanelExit,this,
+				panel_pick, panel_places,params));
 		}
 	}
 }
@@ -343,6 +369,7 @@ void LLLandmarksPanel::initLandmarksPanel(LLInventorySubTreePanel* inventory_lis
 	inventory_list->setSelectCallback(boost::bind(&LLLandmarksPanel::onSelectionChange, this, inventory_list, _1, _2));
 
 	inventory_list->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
+	updateSortOrder(inventory_list, mSortByDate);
 
 	LLPlacesFolderView* root_folder = dynamic_cast<LLPlacesFolderView*>(inventory_list->getRootFolder());
 	if (root_folder)
@@ -552,7 +579,7 @@ void LLLandmarksPanel::onCopyPasteAction(const LLSD& userdata) const
 	}
 }
 
-void LLLandmarksPanel::onFoldingAction(const LLSD& userdata) const
+void LLLandmarksPanel::onFoldingAction(const LLSD& userdata)
 {
 	if(!mCurrentSelectedList) return;
 
@@ -568,6 +595,14 @@ void LLLandmarksPanel::onFoldingAction(const LLSD& userdata) const
 	{
 		root_folder->closeAllFolders();
 	}
+	else if ( "sort_by_date" == command_name)
+	{
+		mSortByDate = !mSortByDate;
+		updateSortOrder(mFavoritesInventoryPanel, mSortByDate);
+		updateSortOrder(mLandmarksInventoryPanel, mSortByDate);
+		updateSortOrder(mMyInventoryPanel, mSortByDate);
+		updateSortOrder(mLibraryInventoryPanel, mSortByDate);
+	}
 	else
 	{
 		root_folder->doToSelected(&gInventory, userdata);
@@ -585,6 +620,22 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
 	{
 		return mCurrentSelectedList ? mCurrentSelectedList->getRootFolder()->canPaste() : false;
 	}
+	else if ( "sort_by_date" == command_name)
+	{
+		return  mSortByDate;
+	}
+	// do not allow teleport and more info for multi-selections
+	else if ("teleport" == command_name || "more_info" == command_name)
+	{
+		return mCurrentSelectedList ?
+			static_cast<LLPlacesFolderView*>(mCurrentSelectedList->getRootFolder())->getSelectedCount() == 1 : false;
+	}
+	// we can add folder, or change item/folder only in Landmarks Accordion
+	else if ("add_folder" == command_name || "rename" == command_name || "delete" == command_name)
+	{
+		return mLandmarksInventoryPanel == mCurrentSelectedList;
+	}
+
 	return true;
 }
 
@@ -647,7 +698,7 @@ void LLLandmarksPanel::onCustomAction(const LLSD& userdata)
 	}
 }
 
-void LLLandmarksPanel::onPickPanelExit( LLPanelPick* pick_panel, LLView* owner, const LLSD& params)
+void LLLandmarksPanel::onPickPanelExit( LLPanelPickEdit* pick_panel, LLView* owner, const LLSD& params)
 {
 	pick_panel->setVisible(FALSE);
 	owner->removeChild(pick_panel);
diff --git a/indra/newview/llpanellandmarks.h b/indra/newview/llpanellandmarks.h
index e74a7fdc885..389a04a76fb 100644
--- a/indra/newview/llpanellandmarks.h
+++ b/indra/newview/llpanellandmarks.h
@@ -68,6 +68,7 @@ class LLLandmarksPanel : public LLPanelPlacesTab, LLRemoteParcelInfoObserver
 	bool isLandmarkSelected() const;
 	LLLandmark* getCurSelectedLandmark() const;
 	LLFolderViewItem* getCurSelectedItem () const;
+	void updateSortOrder(LLInventoryPanel* panel, bool byDate);
 
 	//LLRemoteParcelInfoObserver interface
 	/*virtual*/ void processParcelInfo(const LLParcelData& parcel_data);
@@ -93,10 +94,10 @@ class LLLandmarksPanel : public LLPanelPlacesTab, LLRemoteParcelInfoObserver
 	void onTrashButtonClick() const;
 	void onAddAction(const LLSD& command_name) const;
 	void onCopyPasteAction(const LLSD& command_name) const;
-	void onFoldingAction(const LLSD& command_name) const;
+	void onFoldingAction(const LLSD& command_name);
 	bool isActionEnabled(const LLSD& command_name) const;
 	void onCustomAction(const LLSD& command_name);
-	void onPickPanelExit( LLPanelPick* pick_panel, LLView* owner, const LLSD& params);
+	void onPickPanelExit( LLPanelPickEdit* pick_panel, LLView* owner, const LLSD& params);
 
 private:
 	LLInventorySubTreePanel*	mFavoritesInventoryPanel;
@@ -108,6 +109,7 @@ class LLLandmarksPanel : public LLPanelPlacesTab, LLRemoteParcelInfoObserver
 	LLInventorySubTreePanel*	mCurrentSelectedList;
 
 	LLPanel*					mListCommands;
+	bool 						mSortByDate;
 };
 
 #endif //LL_LLPANELLANDMARKS_H
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index c94c38983d9..9dc80c05155 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -87,7 +87,39 @@ class LLAvatarItemRecentComparator : public LLAvatarItemComparator
 	}
 };
 
+/** Compares avatar items by online status, then by name */
+class LLAvatarItemStatusComparator : public LLAvatarItemComparator
+{
+public:
+	LLAvatarItemStatusComparator() {};
+
+protected:
+	/**
+	 * @return true if item1 < item2, false otherwise
+	 */
+	virtual bool doCompare(const LLAvatarListItem* item1, const LLAvatarListItem* item2) const
+	{
+		LLAvatarTracker& at = LLAvatarTracker::instance();
+		bool online1 = at.isBuddyOnline(item1->getAvatarId());
+		bool online2 = at.isBuddyOnline(item2->getAvatarId());
+
+		if (online1 == online2)
+		{
+			std::string name1 = item1->getAvatarName();
+			std::string name2 = item2->getAvatarName();
+
+			LLStringUtil::toUpper(name1);
+			LLStringUtil::toUpper(name2);
+
+			return name1 < name2;
+		}
+		
+		return online1 > online2; 
+	}
+};
+
 static const LLAvatarItemRecentComparator RECENT_COMPARATOR;
+static const LLAvatarItemStatusComparator STATUS_COMPARATOR;
 
 static LLRegisterPanelClassWrapper<LLPanelPeople> t_people("panel_people");
 
@@ -395,7 +427,8 @@ BOOL LLPanelPeople::postBuild()
 	mNearbyList->setContextMenu(&LLPanelPeopleMenus::gNearbyMenu);
 	mRecentList->setContextMenu(&LLPanelPeopleMenus::gNearbyMenu);
 
-	mRecentList->setComparator(&RECENT_COMPARATOR);
+	setSortOrder(mRecentList,		(ESortOrder)gSavedSettings.getU32("RecentPeopleSortOrder"),	false);
+	setSortOrder(mAllFriendList,	(ESortOrder)gSavedSettings.getU32("FriendsSortOrder"),		false);
 
 	LLPanel* groups_panel = getChild<LLPanel>(GROUP_TAB_NAME);
 	groups_panel->childSetAction("activate_btn", boost::bind(&LLPanelPeople::onActivateButtonClicked,	this));
@@ -446,12 +479,16 @@ BOOL LLPanelPeople::postBuild()
 
 	// Create menus.
 	LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+	LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
 	
 	registrar.add("People.Group.Plus.Action",  boost::bind(&LLPanelPeople::onGroupPlusMenuItemClicked,  this, _2));
 	registrar.add("People.Friends.ViewSort.Action",  boost::bind(&LLPanelPeople::onFriendsViewSortMenuItemClicked,  this, _2));
 	registrar.add("People.Nearby.ViewSort.Action",  boost::bind(&LLPanelPeople::onNearbyViewSortMenuItemClicked,  this, _2));
 	registrar.add("People.Groups.ViewSort.Action",  boost::bind(&LLPanelPeople::onGroupsViewSortMenuItemClicked,  this, _2));
 	registrar.add("People.Recent.ViewSort.Action",  boost::bind(&LLPanelPeople::onRecentViewSortMenuItemClicked,  this, _2));
+
+	enable_registrar.add("People.Friends.ViewSort.CheckItem",	boost::bind(&LLPanelPeople::onFriendsViewSortMenuItemCheck,	this, _2));
+	enable_registrar.add("People.Recent.ViewSort.CheckItem",	boost::bind(&LLPanelPeople::onRecentViewSortMenuItemCheck,	this, _2));
 	
 	LLMenuGL* plus_menu  = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_group_plus.xml",  gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 	mGroupPlusMenuHandle  = plus_menu->getHandle();
@@ -672,6 +709,42 @@ void LLPanelPeople::showGroupMenu(LLMenuGL* menu)
 	LLMenuGL::showPopup(parent_panel, menu, menu_x, menu_y);
 }
 
+void LLPanelPeople::setSortOrder(LLAvatarList* list, ESortOrder order, bool save)
+{
+	switch (order)
+	{
+	case E_SORT_BY_NAME:
+		list->sortByName();
+		break;
+	case E_SORT_BY_STATUS:
+		list->setComparator(&STATUS_COMPARATOR);
+		list->sort();
+		break;
+	case E_SORT_BY_MOST_RECENT:
+		list->setComparator(&RECENT_COMPARATOR);
+		list->sort();
+		break;
+	default:
+		llwarns << "Unrecognized people sort order for " << list->getName() << llendl;
+		return;
+	}
+
+	if (save)
+	{
+		std::string setting;
+
+		if (list == mAllFriendList || list == mOnlineFriendList)
+			setting = "FriendsSortOrder";
+		else if (list == mRecentList)
+			setting = "RecentPeopleSortOrder";
+		else if (list == mNearbyList)
+			setting = "NearbyPeopleSortOrder"; // *TODO: unused by current implementation
+
+		if (!setting.empty())
+			gSavedSettings.setU32(setting, order);
+	}
+}
+
 void LLPanelPeople::onVisibilityChange(const LLSD& new_visibility)
 {
 	if (new_visibility.asBoolean() == FALSE)
@@ -854,9 +927,11 @@ void LLPanelPeople::onFriendsViewSortMenuItemClicked(const LLSD& userdata)
 
 	if (chosen_item == "sort_name")
 	{
+		setSortOrder(mAllFriendList, E_SORT_BY_NAME);
 	}
 	else if (chosen_item == "sort_status")
 	{
+		setSortOrder(mAllFriendList, E_SORT_BY_STATUS);
 	}
 	else if (chosen_item == "view_icons")
 	{
@@ -900,18 +975,44 @@ void LLPanelPeople::onRecentViewSortMenuItemClicked(const LLSD& userdata)
 
 	if (chosen_item == "sort_recent")
 	{
-		mRecentList->setComparator(&RECENT_COMPARATOR);
-		mRecentList->sort();
+		setSortOrder(mRecentList, E_SORT_BY_MOST_RECENT);
 	} 
 	else if (chosen_item == "sort_name")
 	{
-		mRecentList->sortByName();
+		setSortOrder(mRecentList, E_SORT_BY_NAME);
 	}
 	else if (chosen_item == "view_icons")
 	{
+		// *TODO: implement showing/hiding icons
 	}
 }
 
+bool LLPanelPeople::onFriendsViewSortMenuItemCheck(const LLSD& userdata) 
+{
+	std::string item = userdata.asString();
+	U32 sort_order = gSavedSettings.getU32("FriendsSortOrder");
+
+	if (item == "sort_name") 
+		return sort_order == E_SORT_BY_NAME;
+	if (item == "sort_status")
+		return sort_order == E_SORT_BY_STATUS;
+
+	return false;
+}
+
+bool LLPanelPeople::onRecentViewSortMenuItemCheck(const LLSD& userdata) 
+{
+	std::string item = userdata.asString();
+	U32 sort_order = gSavedSettings.getU32("RecentPeopleSortOrder");
+
+	if (item == "sort_recent")
+		return sort_order == E_SORT_BY_MOST_RECENT;
+	if (item == "sort_name") 
+		return sort_order == E_SORT_BY_NAME;
+
+	return false;
+}
+
 void LLPanelPeople::onCallButtonClicked()
 {
 	// *TODO: not implemented yet
diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h
index 03802015ceb..aa78080d7e5 100644
--- a/indra/newview/llpanelpeople.h
+++ b/indra/newview/llpanelpeople.h
@@ -57,6 +57,13 @@ class LLPanelPeople : public LLPanel
 	class Updater;
 
 private:
+
+	typedef enum e_sort_oder {
+		E_SORT_BY_NAME = 0,
+		E_SORT_BY_STATUS = 1,
+		E_SORT_BY_MOST_RECENT = 2,
+	} ESortOrder;
+
 	// methods indirectly called by the updaters
 	void					updateFriendList();
 	void					updateNearbyList();
@@ -69,6 +76,7 @@ class LLPanelPeople : public LLPanel
 	void					buttonSetEnabled(const std::string& btn_name, bool enabled);
 	void					buttonSetAction(const std::string& btn_name, const commit_signal_t::slot_type& cb);
 	void					showGroupMenu(LLMenuGL* menu);
+	void					setSortOrder(LLAvatarList* list, ESortOrder order, bool save = true);
 
 	void					onVisibilityChange( const LLSD& new_visibility);
 
@@ -104,6 +112,9 @@ class LLPanelPeople : public LLPanel
 	void					onGroupsViewSortMenuItemClicked(const LLSD& userdata);
 	void					onRecentViewSortMenuItemClicked(const LLSD& userdata);
 
+	bool					onFriendsViewSortMenuItemCheck(const LLSD& userdata);
+	bool					onRecentViewSortMenuItemCheck(const LLSD& userdata);
+
 	// misc callbacks
 	static void				onAvatarPicked(
 								const std::vector<std::string>& names,
diff --git a/indra/newview/llpanelpick.cpp b/indra/newview/llpanelpick.cpp
index 424e453a2fc..664ebfd7a44 100644
--- a/indra/newview/llpanelpick.cpp
+++ b/indra/newview/llpanelpick.cpp
@@ -68,265 +68,161 @@
 
 std::string SET_LOCATION_NOTICE("(will update after save)");
 
-LLPanelPick::LLPanelPick(BOOL edit_mode/* = FALSE */)
-:	LLPanel(), LLAvatarPropertiesObserver(), LLRemoteParcelInfoObserver(),
-	mEditMode(edit_mode),
-	mSnapshotCtrl(NULL),
-	mPickId(LLUUID::null),
-	mCreatorId(LLUUID::null),
-	mDataReceived(FALSE),
-	mIsPickNew(false),
-	mLocationChanged(false)
-{
-	if (edit_mode)
-	{
-		LLUICtrlFactory::getInstance()->buildPanel(this, XML_PANEL_EDIT_PICK);
-		LLAvatarPropertiesProcessor::instance().addObserver(gAgentID, this);
-	}
-	else
-	{
-		LLUICtrlFactory::getInstance()->buildPanel(this, XML_PANEL_PICK_INFO);
-	}
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
 
+//static
+LLPanelPickInfo* LLPanelPickInfo::create()
+{
+	LLPanelPickInfo* panel = new LLPanelPickInfo();
+	LLUICtrlFactory::getInstance()->buildPanel(panel, XML_PANEL_PICK_INFO);
+	return panel;
 }
 
-LLPanelPick::~LLPanelPick()
+LLPanelPickInfo::LLPanelPickInfo()
+ : LLPanel()
+ , LLAvatarPropertiesObserver()
+ , LLRemoteParcelInfoObserver()
+ , mAvatarId(LLUUID::null)
+ , mSnapshotCtrl(NULL)
+ , mPickId(LLUUID::null)
 {
-	if (mCreatorId.notNull()) 	LLAvatarPropertiesProcessor::instance().removeObserver(mCreatorId, this);
 }
 
-void LLPanelPick::reset()
+LLPanelPickInfo::~LLPanelPickInfo()
 {
-	setEditMode(FALSE);
-	
-	mPickId.setNull();
-	mCreatorId.setNull();
-	mParcelId.setNull();
-	
-	setPickName("");
-	setPickDesc("");
-	setPickLocation("");
-	mSnapshotCtrl->setImageAssetID(LLUUID::null);
-
-	//*HACK just setting asset id to NULL not enough to clear 
-	//the texture controls, w/o setValid(FALSE) it continues to 
-	//draw the previously set image
-	mSnapshotCtrl->setValid(FALSE);
-
-	mDataReceived = FALSE;
-
-	mPosGlobal.clearVec();
-
-	childSetValue("maturity", "");
+	LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(), this);
 }
 
-BOOL LLPanelPick::postBuild()
+void LLPanelPickInfo::onOpen(const LLSD& key)
 {
-	mSnapshotCtrl = getChild<LLTextureCtrl>(XML_SNAPSHOT);
-
-	if (mEditMode)
-	{
-		enableSaveButton(FALSE);
-
-		mSnapshotCtrl->setOnSelectCallback(boost::bind(&LLPanelPick::onPickChanged, this, _1));
-
-		LLLineEditor* line_edit = getChild<LLLineEditor>("pick_name");
-		line_edit->setKeystrokeCallback(boost::bind(&LLPanelPick::onPickChanged, this, _1), NULL);
-		
-		LLTextEditor* text_edit = getChild<LLTextEditor>("pick_desc");
-		text_edit->setKeystrokeCallback(boost::bind(&LLPanelPick::onPickChanged, this, _1));
-
-		childSetAction("cancel_btn", boost::bind(&LLPanelPick::onClickCancel, this));
-		childSetAction("set_to_curr_location_btn", boost::bind(&LLPanelPick::onClickSet, this));
-		childSetAction(XML_BTN_SAVE, boost::bind(&LLPanelPick::onClickSave, this));
-
-		mSnapshotCtrl->setMouseEnterCallback(boost::bind(&LLPanelPick::childSetVisible, this, "edit_icon", true));
-		mSnapshotCtrl->setMouseLeaveCallback(boost::bind(&LLPanelPick::childSetVisible, this, "edit_icon", false));
-	}
-	else
+	LLUUID avatar_id = key["avatar_id"];
+	if(avatar_id.isNull())
 	{
-		childSetAction("edit_btn", boost::bind(&LLPanelPick::onClickEdit, this));
-		childSetAction("teleport_btn", boost::bind(&LLPanelPick::onClickTeleport, this));
-		childSetAction("show_on_map_btn", boost::bind(&LLPanelPick::onClickMap, this));
-
+		return;
 	}
 
-	// EXT-822. We have to process "Back" button click in both Edit & View Modes
-	if (!mBackCb.empty())
+	if(getAvatarId().notNull())
 	{
-		LLButton* button = findChild<LLButton>("back_btn");
-		if (button) button->setClickedCallback(mBackCb);
+		LLAvatarPropertiesProcessor::getInstance()->removeObserver(
+			getAvatarId(), this);
 	}
 
-	return TRUE;
-}
-
-void LLPanelPick::init(LLUUID creator_id, LLUUID pick_id)
-{
-	mCreatorId = creator_id;
-	mPickId = pick_id;
-
-	//*TODO consider removing this, already called by setEditMode()
-	updateButtons();
-
-	requestData();
-}
-
-void LLPanelPick::requestData()
-{
-	mDataReceived = FALSE;
-	LLAvatarPropertiesProcessor::instance().addObserver(mCreatorId, this);
-	LLAvatarPropertiesProcessor::instance().sendPickInfoRequest(mCreatorId, mPickId);
-}
-
-void LLPanelPick::init(LLPickData *pick_data)
-{
-	mPickId = pick_data->pick_id;
-	mCreatorId = pick_data->creator_id;
+	setAvatarId(avatar_id);
 
-	setPickName(pick_data->name);
-	setPickDesc(pick_data->desc);
-	
-	mSnapshotCtrl->setImageAssetID(pick_data->snapshot_id);
+	resetData();
+	resetControls();
 
-	//*HACK see reset() where the texture control was set to FALSE
-	mSnapshotCtrl->setValid(TRUE);
+	setPickId(key["pick_id"]);
+	setPickName(key["pick_name"]);
+	setPickDesc(key["pick_desc"]);
+	setSnapshotId(key["snapshot_id"]);
 
-	mPosGlobal = pick_data->pos_global;
-	mSimName = pick_data->sim_name;
-	mParcelId = pick_data->parcel_id;
-
-	setPickLocation(createLocationText(pick_data->user_name, pick_data->original_name,
-		pick_data->sim_name, pick_data->pos_global));
+	LLAvatarPropertiesProcessor::getInstance()->addObserver(
+		getAvatarId(), this);
+	LLAvatarPropertiesProcessor::getInstance()->sendPickInfoRequest(
+		getAvatarId(), getPickId());
 }
 
-void LLPanelPick::prepareNewPick(const LLVector3d pos_global,
-								const std::string& name,
-								const std::string& desc,
-								const LLUUID& snapshot_id,
-								const LLUUID& parcel_id)
+BOOL LLPanelPickInfo::postBuild()
 {
-	mPickId.generate();
-	mCreatorId = gAgent.getID();
-	mPosGlobal = pos_global;
-	setPickName(name);
-	setPickDesc(desc);
-	mSnapshotCtrl->setImageAssetID(snapshot_id);
-	mParcelId = parcel_id;
-
-	setPickLocation(createLocationText(std::string(""), SET_LOCATION_NOTICE, name, pos_global));
+	mSnapshotCtrl = getChild<LLTextureCtrl>(XML_SNAPSHOT);
 
 	childSetLabelArg(XML_BTN_SAVE, SAVE_BTN_LABEL, std::string("Pick"));
 
-	mIsPickNew = true;
+	childSetAction("teleport_btn", boost::bind(&LLPanelPickInfo::onClickTeleport, this));
+	childSetAction("show_on_map_btn", boost::bind(&LLPanelPickInfo::onClickMap, this));
+	childSetAction("back_btn", boost::bind(&LLPanelPickInfo::onClickBack, this));
+
+	return TRUE;
 }
 
-// Fill in some reasonable defaults for a new pick.
-void LLPanelPick::prepareNewPick()
+void LLPanelPickInfo::processProperties(void* data, EAvatarProcessorType type)
 {
-	// Try to fill in the current parcel
-	LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
-	if (parcel)
+	if(APT_PICK_INFO != type)
 	{
-		prepareNewPick(gAgent.getPositionGlobal(),
-					  parcel->getName(),
-					  parcel->getDesc(),
-					  parcel->getSnapshotID(),
-					  parcel->getID());
+		return;
 	}
-}
-
-/*virtual*/ void LLPanelPick::processProperties(void* data, EAvatarProcessorType type)
-{
-	if (APT_PICK_INFO != type) return;
-	if (!data) return;
-
-	LLPickData* pick_data = static_cast<LLPickData *>(data);
-	if (!pick_data) return;
-	if (mPickId != pick_data->pick_id) return;
-
-	init(pick_data);
-	mDataReceived = TRUE;
-	LLAvatarPropertiesProcessor::instance().removeObserver(mCreatorId, this);
-
-	if (!mEditMode) 
+	LLPickData* pick_info = static_cast<LLPickData*>(data);
+	if(!pick_info 
+		|| pick_info->creator_id != getAvatarId() 
+		|| pick_info->pick_id != getPickId())
 	{
-		LLRemoteParcelInfoProcessor::getInstance()->addObserver(pick_data->parcel_id, this);
-		LLRemoteParcelInfoProcessor::getInstance()->sendParcelInfoRequest(pick_data->parcel_id);
+		return;
 	}
-}
 
+	setSnapshotId(pick_info->snapshot_id);
+	setPickName(pick_info->name);
+	setPickDesc(pick_info->desc);
+	setPosGlobal(pick_info->pos_global);
+	setPickLocation(createLocationText(pick_info->user_name, pick_info->original_name, 
+		pick_info->sim_name, pick_info->pos_global));
 
-void LLPanelPick::setEditMode( BOOL edit_mode )
-{
-	if (mEditMode == edit_mode) return;
-	mEditMode = edit_mode;
-
-	// preserve data before killing controls
-	LLUUID snapshot_id = mSnapshotCtrl->getImageAssetID();
-	LLRect old_rect = getRect();
-
-	deleteAllChildren();
+	// *NOTE dzaporozhan
+	// We want to keep listening to APT_PICK_INFO because user may 
+	// edit the Pick and we have to update Pick info panel.
+	// revomeObserver is called from onClickBack
+}
 
-	// *WORKAROUND: for EXT-931. Children are created for both XML_PANEL_EDIT_PICK & XML_PANEL_PICK_INFO files
-	// The reason is in LLPanel::initPanelXML called from the LLUICtrlFactory::buildPanel().
-	// It creates children from the xml file stored while previous initializing in the "mXMLFilename" member
-	// and then in creates children from the parameters passed from the LLUICtrlFactory::buildPanel().
-	// Xml filename is stored after LLPanel::initPanelXML is called (added with export-from-ll/viewer-2-0, r1594 into LLUICtrlFactory::buildPanel & LLUICtrlFactory::buildFloater)
-	// In case panel creates children from the different xml files they appear from both files.
-	// So, let clear xml filename related to this instance.
-	setXMLFilename("");
+void LLPanelPickInfo::setExitCallback(const commit_callback_t& cb)
+{
+	getChild<LLButton>("back_btn")->setClickedCallback(cb);
+}
 
-	if (edit_mode)
+void LLPanelPickInfo::processParcelInfo(const LLParcelData& parcel_data)
+{
+	// HACK: Flag 0x2 == adult region,
+	// Flag 0x1 == mature region, otherwise assume PG
+	std::string rating_icon = "icon_event.tga";
+	if (parcel_data.flags & 0x2)
 	{
-		LLUICtrlFactory::getInstance()->buildPanel(this, XML_PANEL_EDIT_PICK);
+		rating_icon = "icon_event_adult.tga";
 	}
-	else
+	else if (parcel_data.flags & 0x1)
 	{
-		LLUICtrlFactory::getInstance()->buildPanel(this, XML_PANEL_PICK_INFO);
+		rating_icon = "icon_event_mature.tga";
 	}
 
-	//*NOTE this code is from LLPanelMeProfile.togglePanel()... doubt this is a right way to do things
-	reshape(old_rect.getWidth(), old_rect.getHeight());
-	old_rect.setLeftTopAndSize(0, old_rect.getHeight(), old_rect.getWidth(), old_rect.getHeight());
-	setRect(old_rect);
-
-	// time to restore data
-	setPickName(mName);
-	setPickDesc(mDesc);
-	setPickLocation(mLocation);
-	mSnapshotCtrl->setImageAssetID(snapshot_id);
+	childSetValue("maturity", rating_icon);
 
-	updateButtons();
+	//*NOTE we don't removeObserver(...) ourselves cause LLRemoveParcelProcessor does it for us
 }
 
-void LLPanelPick::onPickChanged(LLUICtrl* ctrl)
+void LLPanelPickInfo::setEditPickCallback(const commit_callback_t& cb)
 {
-	if(mLocationChanged)
-	{
-		// Pick was enabled in onClickSet
-		return;
-	}
+	getChild<LLButton>("edit_btn")->setClickedCallback(cb);
+}
 
-	if( mSnapshotCtrl->isDirty()
-		|| getChild<LLLineEditor>("pick_name")->isDirty()
-		|| getChild<LLTextEditor>("pick_desc")->isDirty() )
+// PROTECTED AREA
+
+void LLPanelPickInfo::resetControls()
+{
+	if(getAvatarId() == gAgent.getID())
 	{
-		enableSaveButton(TRUE);
+		childSetEnabled("edit_btn", TRUE);
+		childSetVisible("edit_btn", TRUE);
 	}
 	else
 	{
-		enableSaveButton(FALSE);
+		childSetEnabled("edit_btn", FALSE);
+		childSetVisible("edit_btn", FALSE);
 	}
 }
 
-//////////////////////////////////////////////////////////////////////////
-// PROTECTED AREA
-//////////////////////////////////////////////////////////////////////////
+void LLPanelPickInfo::resetData()
+{
+	setPickName(LLStringUtil::null);
+	setPickDesc(LLStringUtil::null);
+	setPickLocation(LLStringUtil::null);
+	setPickId(LLUUID::null);
+	setSnapshotId(LLUUID::null);
+	mPosGlobal.clearVec();
+	childSetValue("maturity", LLStringUtil::null);
+}
 
-//static
-std::string LLPanelPick::createLocationText(const std::string& owner_name, const std::string& original_name,
-												 const std::string& sim_name, const LLVector3d& pos_global)
+// static
+std::string LLPanelPickInfo::createLocationText(const std::string& owner_name, const std::string& original_name, const std::string& sim_name, const LLVector3d& pos_global)
 {
 	std::string location_text;
 	location_text.append(owner_name);
@@ -354,23 +250,23 @@ std::string LLPanelPick::createLocationText(const std::string& owner_name, const
 	return location_text;
 }
 
-void LLPanelPick::setPickName(std::string name)
+void LLPanelPickInfo::setSnapshotId(const LLUUID& id) 
+{ 
+	mSnapshotCtrl->setImageAssetID(id);
+	mSnapshotCtrl->setValid(TRUE);
+}
+
+void LLPanelPickInfo::setPickName(const std::string& name)
 {
 	childSetValue(XML_NAME, name);
-	
-	//preserving non-wrapped text for info/edit modes switching
-	mName = name;
 }
 
-void LLPanelPick::setPickDesc(std::string desc)
+void LLPanelPickInfo::setPickDesc(const std::string& desc)
 {
 	childSetValue(XML_DESC, desc);
-
-	//preserving non-wrapped text for info/edit modes switching
-	mDesc = desc;
 }
 
-void LLPanelPick::setPickLocation(const std::string& location)
+void LLPanelPickInfo::setPickLocation(const std::string& location)
 {
 	childSetValue(XML_LOCATION, location);
 
@@ -378,208 +274,253 @@ void LLPanelPick::setPickLocation(const std::string& location)
 	mLocation = location;
 }
 
-std::string LLPanelPick::getPickName()
+void LLPanelPickInfo::onClickMap()
 {
-	return childGetValue(XML_NAME).asString();
+	LLFloaterWorldMap::getInstance()->trackLocation(getPosGlobal());
+	LLFloaterReg::showInstance("world_map", "center");
 }
 
-std::string LLPanelPick::getPickDesc()
+void LLPanelPickInfo::onClickTeleport()
 {
-	return childGetValue(XML_DESC).asString();
+	if (!getPosGlobal().isExactlyZero())
+	{
+		gAgent.teleportViaLocation(getPosGlobal());
+		LLFloaterWorldMap::getInstance()->trackLocation(getPosGlobal());
+	}
 }
 
-std::string LLPanelPick::getPickLocation()
+void LLPanelPickInfo::onClickBack()
 {
-	return childGetValue(XML_LOCATION).asString();
+	LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(), this);
 }
 
-void LLPanelPick::sendUpdate()
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+
+//static
+LLPanelPickEdit* LLPanelPickEdit::create()
 {
-	LLPickData pick_data;
+	LLPanelPickEdit* panel = new LLPanelPickEdit();
+	LLUICtrlFactory::getInstance()->buildPanel(panel, XML_PANEL_EDIT_PICK);
+	return panel;
+}
 
-	// If we don't have a pick id yet, we'll need to generate one,
-	// otherwise we'll keep overwriting pick_id 00000 in the database.
-	if (mPickId.isNull()) mPickId.generate();
+LLPanelPickEdit::LLPanelPickEdit()
+ : LLPanelPickInfo()
+ , mLocationChanged(false)
+ , mNeedData(true)
+{
+}
 
-	pick_data.agent_id = gAgent.getID();
-	pick_data.session_id = gAgent.getSessionID();
-	pick_data.pick_id = mPickId;
-	pick_data.creator_id = gAgentID;
+LLPanelPickEdit::~LLPanelPickEdit()
+{
+}
 
-	//legacy var  need to be deleted
-	pick_data.top_pick = FALSE; 
-	pick_data.parcel_id = mParcelId;
-	pick_data.name = getPickName();
-	pick_data.desc = getPickDesc();
-	pick_data.snapshot_id = mSnapshotCtrl->getImageAssetID();
-	pick_data.pos_global = mPosGlobal;
-	pick_data.sort_order = 0;
-	pick_data.enabled = TRUE;
+void LLPanelPickEdit::onOpen(const LLSD& key)
+{
+	LLUUID pick_id = key["pick_id"];
+	mNeedData = true;
 
-	mDataReceived = FALSE;
-	LLAvatarPropertiesProcessor::instance().addObserver(gAgentID, this);
+	// creating new Pick
+	if(pick_id.isNull())
+	{
+		setAvatarId(gAgent.getID());
 
-	LLAvatarPropertiesProcessor::instance().sendPickInfoUpdate(&pick_data);
-}
+		resetData();
+		resetControls();
 
+		setPosGlobal(gAgent.getPositionGlobal());
 
-//-----------------------------------------
-// "PICK INFO" (VIEW MODE) BUTTON HANDLERS
-//-----------------------------------------
+		LLUUID parcel_id = LLUUID::null, snapshot_id = LLUUID::null;
+		std::string pick_name, pick_desc;
 
-//static
-void LLPanelPick::onClickEdit()
-{
-	if (mEditMode) return;
-	if (!mDataReceived) return;
-	setEditMode(TRUE);
+		LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+		if(parcel)
+		{
+			parcel_id = parcel->getID();
+			pick_name = parcel->getName();
+			pick_desc = parcel->getDesc();
+			snapshot_id = parcel->getSnapshotID();
+		}
+
+		setParcelID(parcel_id);
+		childSetValue("pick_name", pick_name);
+		childSetValue("pick_desc", pick_desc);
+		setSnapshotId(snapshot_id);
+		setPickLocation(createLocationText(LLStringUtil::null, SET_LOCATION_NOTICE, 
+			pick_name, getPosGlobal()));
+
+		enableSaveButton(true);
+	}
+	// editing existing pick
+	else
+	{
+		LLPanelPickInfo::onOpen(key);
+
+		enableSaveButton(false);
+	}
+
+	resetDirty();
 }
 
-//static
-void LLPanelPick::onClickTeleport()
+void LLPanelPickEdit::setPickData(const LLPickData* pick_data)
 {
-	teleport(mPosGlobal);
+	if(!pick_data)
+	{
+		return;
+	}
+
+	mNeedData = false;
+
+	setParcelID(pick_data->parcel_id);
+	childSetValue("pick_name", pick_data->name);
+	childSetValue("pick_desc", pick_data->desc);
+	setSnapshotId(pick_data->snapshot_id);
+	setPickLocation(createLocationText(pick_data->user_name, pick_data->original_name, /*pick_data->sim_name,*/ 
+		pick_data->name, pick_data->pos_global));
 }
 
-//static
-void LLPanelPick::onClickMap()
+BOOL LLPanelPickEdit::postBuild()
 {
-	showOnMap(mPosGlobal);
-}
+	LLPanelPickInfo::postBuild();
 
+	mSnapshotCtrl->setOnSelectCallback(boost::bind(&LLPanelPickEdit::onPickChanged, this, _1));
+	mSnapshotCtrl->setMouseEnterCallback(boost::bind(&LLPanelPickEdit::childSetVisible, this, "edit_icon", true));
+	mSnapshotCtrl->setMouseLeaveCallback(boost::bind(&LLPanelPickEdit::childSetVisible, this, "edit_icon", false));
 
-//-----------------------------------------
-// "EDIT PICK" (EDIT MODE) BUTTON HANDLERS
-//-----------------------------------------
+	LLLineEditor* line_edit = getChild<LLLineEditor>("pick_name");
+	line_edit->setKeystrokeCallback(boost::bind(&LLPanelPickEdit::onPickChanged, this, _1), NULL);
 
-//static
-void LLPanelPick::onClickCancel()
+	LLTextEditor* text_edit = getChild<LLTextEditor>("pick_desc");
+	text_edit->setKeystrokeCallback(boost::bind(&LLPanelPickEdit::onPickChanged, this, _1));
+
+	childSetAction(XML_BTN_SAVE, boost::bind(&LLPanelPickEdit::onClickSave, this));
+	childSetAction("set_to_curr_location_btn", boost::bind(&LLPanelPickEdit::onClickSetLocation, this));
+
+	return TRUE;
+}
+
+void LLPanelPickEdit::setSaveCallback(const commit_callback_t& cb)
 {
-	if (!mEditMode) return;
-	
-	if (mIsPickNew)
-	{
-		mBackCb(this, LLSD());
-		return;
-	}
+	getChild<LLButton>("save_changes_btn")->setClickedCallback(cb);
+}
 
-	LLUUID pick_id = mPickId;
-	LLUUID creator_id = mCreatorId;
-	reset();
-	init(creator_id, pick_id);
+void LLPanelPickEdit::setCancelCallback(const commit_callback_t& cb)
+{
+	getChild<LLButton>("cancel_btn")->setClickedCallback(cb);
 }
 
-// static
-void LLPanelPick::onClickSet()
+void LLPanelPickEdit::resetDirty()
 {
-	if (!mEditMode) return;
-	if (!mIsPickNew && !mDataReceived) return;
+	LLPanelPickInfo::resetDirty();
 
-	// Save location for later.
-	mPosGlobal = gAgent.getPositionGlobal();
+	getChild<LLLineEditor>("pick_name")->resetDirty();
+	getChild<LLTextEditor>("pick_desc")->resetDirty();
+	mSnapshotCtrl->resetDirty();
+	mLocationChanged = false;
+}
 
-	LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
-	if (parcel)
+BOOL LLPanelPickEdit::isDirty() const
+{
+	if( LLPanelPickInfo::isDirty()
+		|| mLocationChanged
+		|| mSnapshotCtrl->isDirty()
+		|| getChild<LLLineEditor>("pick_name")->isDirty()
+		|| getChild<LLTextEditor>("pick_desc")->isDirty())
 	{
-		mParcelId = parcel->getID();
-		mSimName = parcel->getName();
+		return TRUE;
 	}
-	setPickLocation(createLocationText(std::string(""), SET_LOCATION_NOTICE, mSimName, mPosGlobal));
-
-	mLocationChanged = true;
-	enableSaveButton(TRUE);
+	return FALSE;
 }
 
-// static
-void LLPanelPick::onClickSave()
+// PROTECTED AREA
+
+void LLPanelPickEdit::sendUpdate()
 {
-	if (!mEditMode) return;
-	if (!mIsPickNew && !mDataReceived) return;
+	LLPickData pick_data;
 
-	sendUpdate();
-	
-	if (mIsPickNew)
+	// If we don't have a pick id yet, we'll need to generate one,
+	// otherwise we'll keep overwriting pick_id 00000 in the database.
+	if (getPickId().isNull()) 
 	{
-		mBackCb(this, LLSD());
-		return;
+		getPickId().generate();
 	}
 
-	setEditMode(FALSE);
+	pick_data.agent_id = gAgent.getID();
+	pick_data.session_id = gAgent.getSessionID();
+	pick_data.pick_id = getPickId();
+	pick_data.creator_id = gAgent.getID();;
+
+	//legacy var  need to be deleted
+	pick_data.top_pick = FALSE; 
+	pick_data.parcel_id = mParcelId;
+	pick_data.name = childGetValue(XML_NAME).asString();
+	pick_data.desc = childGetValue(XML_DESC).asString();
+	pick_data.snapshot_id = mSnapshotCtrl->getImageAssetID();
+	pick_data.pos_global = getPosGlobal();
+	pick_data.sort_order = 0;
+	pick_data.enabled = TRUE;
+
+	LLAvatarPropertiesProcessor::instance().sendPickInfoUpdate(&pick_data);
 }
 
-void LLPanelPick::updateButtons()
+void LLPanelPickEdit::onPickChanged(LLUICtrl* ctrl)
 {
-
-	// on Pick Info panel (for non-Agent picks) edit_btn should be invisible
-	if (mEditMode)
+	if(isDirty())
 	{
-		childSetLabelArg(XML_BTN_SAVE, SAVE_BTN_LABEL, std::string("Changes"));
+		enableSaveButton(true);
 	}
-	else 
+	else
 	{
-		if (mCreatorId != gAgentID)
-		{
-			childSetEnabled("edit_btn", FALSE);
-			childSetVisible("edit_btn", FALSE);
-		}
-		else 
-		{
-			childSetEnabled("edit_btn", TRUE);
-			childSetVisible("edit_btn", TRUE);
-		}
+		enableSaveButton(false);
 	}
 }
 
-void LLPanelPick::setExitCallback(commit_callback_t cb)
+void LLPanelPickEdit::resetData()
 {
-	mBackCb = cb;
-	LLButton* button = findChild<LLButton>("back_btn");
-	if (button) button->setClickedCallback(mBackCb);
+	LLPanelPickInfo::resetData();
+	mLocationChanged = false;
 }
 
-//static
-void LLPanelPick::teleport(const LLVector3d& position)
+void LLPanelPickEdit::enableSaveButton(bool enable)
 {
-	if (!position.isExactlyZero())
-	{
-		gAgent.teleportViaLocation(position);
-		LLFloaterWorldMap::getInstance()->trackLocation(position);
-	}
+	childSetEnabled(XML_BTN_SAVE, enable);
 }
 
-//static
-void LLPanelPick::showOnMap(const LLVector3d& position)
+void LLPanelPickEdit::onClickSetLocation()
 {
-	LLFloaterWorldMap::getInstance()->trackLocation(position);
-	LLFloaterReg::showInstance("world_map", "center");
+	// Save location for later use.
+	setPosGlobal(gAgent.getPositionGlobal());
+
+	LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+	if (parcel)
+	{
+		mParcelId = parcel->getID();
+		mSimName = parcel->getName();
+	}
+	setPickLocation(createLocationText(
+		LLStringUtil::null, SET_LOCATION_NOTICE, mSimName, getPosGlobal()));
+
+	mLocationChanged = true;
+	enableSaveButton(TRUE);
 }
 
-void LLPanelPick::processParcelInfo(const LLParcelData& parcel_data)
+void LLPanelPickEdit::onClickSave()
 {
-	if (mEditMode) return;
+	sendUpdate();
 
-	// HACK: Flag 0x2 == adult region,
-	// Flag 0x1 == mature region, otherwise assume PG
-	std::string rating_icon = "icon_event.tga";
-	if (parcel_data.flags & 0x2)
-	{
-		rating_icon = "icon_event_adult.tga";
-	}
-	else if (parcel_data.flags & 0x1)
-	{
-		rating_icon = "icon_event_mature.tga";
-	}
-	
-	childSetValue("maturity", rating_icon);
+	mLocationChanged = false;
 
-	//*NOTE we don't removeObserver(...) ourselves cause LLRemoveParcelProcessor does it for us
+	LLSD params;
+	params["action"] = "save_new_pick";
+	notifyParent(params);
 }
 
-void LLPanelPick::enableSaveButton(bool enable)
+void LLPanelPickEdit::processProperties(void* data, EAvatarProcessorType type)
 {
-	if(!mEditMode)
+	if(mNeedData)
 	{
-		return;
+		LLPanelPickInfo::processProperties(data, type);
 	}
-	childSetEnabled(XML_BTN_SAVE, enable);
 }
diff --git a/indra/newview/llpanelpick.h b/indra/newview/llpanelpick.h
index 7cc2a04c535..c5b13c69eaf 100644
--- a/indra/newview/llpanelpick.h
+++ b/indra/newview/llpanelpick.h
@@ -45,48 +45,40 @@ class LLTextureCtrl;
 class LLMessageSystem;
 class LLAvatarPropertiesObserver;
 
-class LLPanelPick : public LLPanel, public LLAvatarPropertiesObserver, LLRemoteParcelInfoObserver
+/**
+ * Panel for displaying Pick Information - snapshot, name, description, etc.
+ */
+class LLPanelPickInfo : public LLPanel, public LLAvatarPropertiesObserver, LLRemoteParcelInfoObserver
 {
-	LOG_CLASS(LLPanelPick);
+	LOG_CLASS(LLPanelPickInfo);
 public:
-	LLPanelPick(BOOL edit_mode = FALSE);
-	/*virtual*/ ~LLPanelPick();
-
-	// switches the panel to the VIEW mode and resets controls
-	void reset();
+	
+	// Creates new panel
+	static LLPanelPickInfo* create();
 
-	/*virtual*/ BOOL postBuild();
+	virtual ~LLPanelPickInfo();
 
-	// Prepares a new pick, including creating an id, giving a sane
-	// initial position, etc (saved on clicking Save Pick button - onClickSave callback).
-	void prepareNewPick();
-	void prepareNewPick(const LLVector3d pos_global,
-					   const std::string& name,
-					   const std::string& desc,
-					   const LLUUID& snapshot_id,
-					   const LLUUID& parcel_id);
+	/**
+	 * Initializes panel properties
+	 *
+	 * By default Pick will be created for current Agent location.
+	 * Use setPickData to change Pick properties.
+	 */
+	/*virtual*/ void onOpen(const LLSD& key);
 
-	//initializes the panel with data of the pick with id = pick_id 
-	//owned by the avatar with id = creator_id
-	void init(LLUUID creator_id, LLUUID pick_id);
+	/*virtual*/ BOOL postBuild();
 
 	/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
 
-	// switches the panel to either View or Edit mode
-	void setEditMode(BOOL edit_mode);
-
-	void onPickChanged(LLUICtrl* ctrl);
-
-	// because this panel works in two modes (edit/view) we are  
-	// free from managing two panel for editing and viewing picks and so
-	// are free from controlling switching between them in the parent panel (e.g. Me Profile)
-	// but that causes such a complication that we cannot set a callback for a "Back" button
-	// from the parent panel only once, so we have to preserve that callback
-	// in the pick panel and set it for the back button everytime postBuild() is called.
-	void setExitCallback(commit_callback_t cb);
+	/**
+	 * Sets "Back" button click callback
+	 */
+	virtual void setExitCallback(const commit_callback_t& cb);
 
-	static void teleport(const LLVector3d& position);
-	static void showOnMap(const LLVector3d& position);
+	/**
+	 * Sets "Edit" button click callback
+	 */
+	virtual void setEditPickCallback(const commit_callback_t& cb);
 
 	//This stuff we got from LLRemoteParcelObserver, in the last two we intentionally do nothing
 	/*virtual*/ void processParcelInfo(const LLParcelData& parcel_data);
@@ -95,63 +87,154 @@ class LLPanelPick : public LLPanel, public LLAvatarPropertiesObserver, LLRemoteP
 
 protected:
 
+	LLPanelPickInfo();
+	
+	/**
+	 * Resets Pick information
+	 */
+	virtual void resetData();
+
+	/**
+	 * Resets UI controls (visibility, values)
+	 */
+	virtual void resetControls();
+
 	/** 
 	* "Location text" is actually the owner name, the original
 	* name that owner gave the parcel, and the location.
 	*/
-	static std::string createLocationText(const std::string& owner_name, const std::string& original_name,
-		const std::string& sim_name, const LLVector3d& pos_global);
+	static std::string createLocationText(
+		const std::string& owner_name, 
+		const std::string& original_name,
+		const std::string& sim_name, 
+		const LLVector3d& pos_global);
+
+	virtual void setAvatarId(const LLUUID& avatar_id) { mAvatarId = avatar_id; }
+	virtual LLUUID& getAvatarId() { return mAvatarId; }
+
+	/**
+	 * Sets snapshot id.
+	 *
+	 * Will mark snapshot control as valid if id is not null.
+	 * Will mark snapshot control as invalid if id is null. If null id is a valid value,
+	 * you have to manually mark snapshot is valid.
+	 */
+	virtual void setSnapshotId(const LLUUID& id);
+	
+	virtual void setPickId(const LLUUID& id) { mPickId = id; }
+	virtual LLUUID& getPickId() { return mPickId; }
+	
+	virtual void setPickName(const std::string& name);
+	
+	virtual void setPickDesc(const std::string& desc);
+	
+	virtual void setPickLocation(const std::string& location);
+	
+	virtual void setPosGlobal(const LLVector3d& pos) { mPosGlobal = pos; }
+	virtual LLVector3d& getPosGlobal() { return mPosGlobal; }
+
+	/**
+	 * Callback for "Map" button, opens Map
+	 */
+	void onClickMap();
 
-	void setPickName(std::string name);
-	void setPickDesc(std::string desc);
-	void setPickLocation(const std::string& location);
+	/**
+	 * Callback for "Teleport" button, teleports user to Pick location.
+	 */
+	void onClickTeleport();
 
-	std::string getPickName();
-	std::string getPickDesc();
-	std::string getPickLocation();
+	void onClickBack();
 
-	void sendUpdate();
-	void requestData();
+protected:
 
-	void init(LLPickData *pick_data);
+	LLTextureCtrl* mSnapshotCtrl;
 
-	void updateButtons();
+	LLUUID mAvatarId;
+	LLVector3d mPosGlobal;
+	LLUUID mParcelId;
+	LLUUID mPickId;
+	std::string mSimName;
+	std::string mLocation;
+};
 
-	//-----------------------------------------
-	// "PICK INFO" (VIEW MODE) BUTTON HANDLERS
-	//-----------------------------------------
-	void onClickEdit();
-	void onClickTeleport();
-	void onClickMap();
+/**
+ * Panel for creating/editing Pick.
+ */
+class LLPanelPickEdit : public LLPanelPickInfo
+{
+	LOG_CLASS(LLPanelPickEdit);
+public:
 
-	//-----------------------------------------
-	// "EDIT PICK" (EDIT MODE) BUTTON HANDLERS
-	//-----------------------------------------
-	void onClickSet();
-	void onClickSave();
-	void onClickCancel();
+	/**
+	 * Creates new panel
+	 */
+	static LLPanelPickEdit* create();
 
-	void enableSaveButton(bool enable);
+	/*virtual*/ ~LLPanelPickEdit();
+
+	/*virtual*/ void onOpen(const LLSD& key);
+
+	virtual void setPickData(const LLPickData* pick_data);
+
+	/*virtual*/ BOOL postBuild();
+
+	/**
+	 * Sets "Save" button click callback
+	 */
+	virtual void setSaveCallback(const commit_callback_t& cb);
+
+	/**
+	 * Sets "Cancel" button click callback
+	 */
+	virtual void setCancelCallback(const commit_callback_t& cb);
+
+	/**
+	 * Resets panel and all cantrols to unedited state
+	 */
+	/*virtual*/ void resetDirty();
+
+	/**
+	 * Returns true if any of Pick properties was changed by user.
+	 */
+	/*virtual*/ BOOL isDirty() const;
+
+	/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
 
 protected:
-	BOOL mEditMode;
-	LLTextureCtrl*	mSnapshotCtrl;
-	BOOL mDataReceived;
-	bool mIsPickNew;
 
-	LLUUID mPickId;
-	LLUUID mCreatorId;
-	LLVector3d mPosGlobal;
-	LLUUID mParcelId;
-	std::string mSimName;
+	LLPanelPickEdit();
 
-	//These strings are used to keep non-wrapped text
-	std::string mName;
-	std::string mDesc;
-	std::string mLocation;
+	/**
+	 * Sends Pick properties to server.
+	 */
+	void sendUpdate();
+
+	/**
+	 * Callback for Pick snapshot, name and description changed event.
+	 */
+	void onPickChanged(LLUICtrl* ctrl);
+
+	/*virtual*/ void resetData();
+
+	/**
+	 * Enables/disables "Save" button
+	 */
+	void enableSaveButton(bool enable);
+
+	/**
+	 * Callback for "Set Location" button click
+	 */
+	void onClickSetLocation();
+
+	/**
+	 * Callback for "Save" button click
+	 */
+	void onClickSave();
+
+protected:
 
-	commit_callback_t mBackCb;
 	bool mLocationChanged;
+	bool mNeedData;
 };
 
 #endif // LL_LLPANELPICK_H
diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp
index 979e9618da9..073da5cc06b 100644
--- a/indra/newview/llpanelpicks.cpp
+++ b/indra/newview/llpanelpicks.cpp
@@ -35,6 +35,8 @@
 #include "llagent.h"
 #include "llavatarconstants.h"
 #include "llflatlistview.h"
+#include "llfloaterreg.h"
+#include "llfloaterworldmap.h"
 #include "lltexturectrl.h"
 #include "llviewergenericmessage.h"	// send_generic_message
 #include "llmenugl.h"
@@ -69,6 +71,8 @@ LLPanelPicks::LLPanelPicks()
 	mProfilePanel(NULL),
 	mPickPanel(NULL),
 	mPicksList(NULL)
+	, mPanelPickInfo(NULL)
+	, mPanelPickEdit(NULL)
 {
 }
 
@@ -197,7 +201,7 @@ void LLPanelPicks::onOpen(const LLSD& key)
 		mPopupMenu->setItemVisible("pick_separator", TRUE);
 	}
 
-	if(getAvatarId() != key.asUUID())
+	if(getAvatarId() != id)
 	{
 		mPicksList->goToTop();
 	}
@@ -247,7 +251,13 @@ void LLPanelPicks::onClickTeleport()
 {
 	LLPickItem* pick_item = getSelectedPickItem();
 	if (!pick_item) return;
-	LLPanelPick::teleport(pick_item->getPosGlobal());
+
+	LLVector3d pos = pick_item->getPosGlobal();
+	if (!pos.isExactlyZero())
+	{
+		gAgent.teleportViaLocation(pos);
+		LLFloaterWorldMap::getInstance()->trackLocation(pos);
+	}
 }
 
 //static
@@ -255,7 +265,9 @@ void LLPanelPicks::onClickMap()
 {
 	LLPickItem* pick_item = getSelectedPickItem();
 	if (!pick_item) return;
-	LLPanelPick::showOnMap(pick_item->getPosGlobal());
+
+	LLFloaterWorldMap::getInstance()->trackLocation(pick_item->getPosGlobal());
+	LLFloaterReg::showInstance("world_map", "center");
 }
 
 
@@ -308,19 +320,18 @@ void LLPanelPicks::setProfilePanel(LLPanelProfile* profile_panel)
 
 void LLPanelPicks::buildPickPanel()
 {
-	if (mPickPanel == NULL)
-	{
-		mPickPanel = new LLPanelPick();
-		mPickPanel->setExitCallback(boost::bind(&LLPanelPicks::onClickBack, this));
-	}
+// 	if (mPickPanel == NULL)
+// 	{
+// 		mPickPanel = new LLPanelPick();
+// 		mPickPanel->setExitCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, NULL));
+// 	}
 }
 
 void LLPanelPicks::onClickNew()
 {
-	buildPickPanel();
-	mPickPanel->setEditMode(TRUE);
-	mPickPanel->prepareNewPick();
-	getProfilePanel()->togglePanel(mPickPanel);
+	createPickEditPanel();
+
+	getProfilePanel()->openPanel(mPanelPickEdit, LLSD());
 }
 
 void LLPanelPicks::onClickInfo()
@@ -328,28 +339,98 @@ void LLPanelPicks::onClickInfo()
 	LLSD selected_value = mPicksList->getSelectedValue();
 	if (selected_value.isUndefined()) return;
 
-	buildPickPanel();
-	mPickPanel->reset();
-	mPickPanel->init(selected_value[PICK_CREATOR_ID], selected_value[PICK_ID]);
-	getProfilePanel()->togglePanel(mPickPanel);
+	LLPickItem* pick = (LLPickItem*)mPicksList->getSelectedItem();
+
+	createPickInfoPanel();
+
+	LLSD params;
+	params["pick_id"] = pick->getPickId();
+	params["avatar_id"] = pick->getCreatorId();
+	params["snapshot_id"] = pick->getSnapshotId();
+	params["pick_name"] = pick->getPickName();
+	params["pick_desc"] = pick->getPickDesc();
+
+	getProfilePanel()->openPanel(mPanelPickInfo, params);
 }
 
-void LLPanelPicks::onClickBack()
+void LLPanelPicks::onPanelPickClose(LLPanel* panel)
 {
-	getProfilePanel()->togglePanel(mPickPanel);
+	panel->setVisible(FALSE);
 }
 
-void LLPanelPicks::onClickMenuEdit()
+void LLPanelPicks::createPickInfoPanel()
+{
+	if(!mPanelPickInfo)
+	{
+		mPanelPickInfo = LLPanelPickInfo::create();
+		mPanelPickInfo->setExitCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelPickInfo));
+		mPanelPickInfo->setEditPickCallback(boost::bind(&LLPanelPicks::onPanelPickEdit, this));
+		mPanelPickInfo->setVisible(FALSE);
+	}
+}
+
+void LLPanelPicks::createPickEditPanel()
+{
+	if(!mPanelPickEdit)
+	{
+		mPanelPickEdit = LLPanelPickEdit::create();
+		mPanelPickEdit->setExitCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelPickEdit));
+		mPanelPickEdit->setSaveCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelPickEdit));
+		mPanelPickEdit->setCancelCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelPickEdit));
+		mPanelPickEdit->setVisible(FALSE);
+	}
+}
+
+// void LLPanelPicks::openPickEditPanel(LLPickItem* pick)
+// {
+// 	if(!pick)
+// 	{
+// 		return;
+// 	}
+// }
+
+// void LLPanelPicks::openPickInfoPanel(LLPickItem* pick)
+// {
+// 	if(!mPanelPickInfo)
+// 	{
+// 		mPanelPickInfo = LLPanelPickInfo::create();
+// 		mPanelPickInfo->setExitCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelPickInfo));
+// 		mPanelPickInfo->setEditPickCallback(boost::bind(&LLPanelPicks::onPanelPickEdit, this));
+// 		mPanelPickInfo->setVisible(FALSE);
+// 	}
+// 
+// 	LLSD params;
+// 	params["pick_id"] = pick->getPickId();
+// 	params["avatar_id"] = pick->getCreatorId();
+// 	params["snapshot_id"] = pick->getSnapshotId();
+// 	params["pick_name"] = pick->getPickName();
+// 	params["pick_desc"] = pick->getPickDesc();
+// 
+// 	getProfilePanel()->openPanel(mPanelPickInfo, params);
+// }
+
+void LLPanelPicks::onPanelPickEdit()
 {
-	//*TODO, refactor - most of that is similar to onClickInfo
 	LLSD selected_value = mPicksList->getSelectedValue();
 	if (selected_value.isUndefined()) return;
 
-	buildPickPanel();
-	mPickPanel->reset();
-	mPickPanel->init(selected_value[PICK_CREATOR_ID], selected_value[PICK_ID]);
-	mPickPanel->setEditMode(TRUE);
-	getProfilePanel()->togglePanel(mPickPanel);
+	LLPickItem* pick = dynamic_cast<LLPickItem*>(mPicksList->getSelectedItem());
+	
+	createPickEditPanel();
+
+	LLSD params;
+	params["pick_id"] = pick->getPickId();
+	params["avatar_id"] = pick->getCreatorId();
+	params["snapshot_id"] = pick->getSnapshotId();
+	params["pick_name"] = pick->getPickName();
+	params["pick_desc"] = pick->getPickDesc();
+
+	getProfilePanel()->openPanel(mPanelPickEdit, params);
+}
+
+void LLPanelPicks::onClickMenuEdit()
+{
+	onPanelPickEdit();
 }
 
 inline LLPanelProfile* LLPanelPicks::getProfilePanel()
@@ -391,6 +472,10 @@ void LLPickItem::init(LLPickData* pick_data)
 	setPickDesc(pick_data->desc);
 	setSnapshotId(pick_data->snapshot_id);
 	mPosGlobal = pick_data->pos_global;
+	mSimName = pick_data->sim_name;
+	mPickDescription = pick_data->desc;
+	mUserName = pick_data->user_name;
+	mOriginalName = pick_data->original_name;
 
 	LLTextureCtrl* picture = getChild<LLTextureCtrl>("picture");
 	picture->setImageAssetID(pick_data->snapshot_id);
@@ -445,38 +530,32 @@ const std::string LLPickItem::getDescription()
 
 void LLPickItem::update()
 {
-	mNeedData = true;
+	setNeedData(true);
 	LLAvatarPropertiesProcessor::instance().sendPickInfoRequest(mCreatorID, mPickID);
-	mNeedData = false;
 }
 
 void LLPickItem::processProperties(void *data, EAvatarProcessorType type)
 {
-	if (APT_PICK_INFO != type) return;
-	if (!data) return;
+	if (APT_PICK_INFO != type) 
+	{
+		return;
+	}
 
 	LLPickData* pick_data = static_cast<LLPickData *>(data);
-	if (!pick_data) return;
-	if (mPickID != pick_data->pick_id) return;
+	if (!pick_data || mPickID != pick_data->pick_id) 
+	{
+		return;
+	}
 
 	init(pick_data);
+	setNeedData(false);
 	LLAvatarPropertiesProcessor::instance().removeObserver(mCreatorID, this);
 }
 
-// virtual
-void LLPanelPicks::onClosePanel()
-{
-	// Toggle off Pick Info panel if it is visible.
-	if(mPickPanel && mPickPanel->getVisible())
-	{
-		getProfilePanel()->togglePanel(mPickPanel);
-	}
-}
-
 BOOL LLPickItem::postBuild()
 {
-	setMouseEnterCallback(boost::bind(&LLPanelPick::childSetVisible, this, "hovered_icon", true));
-	setMouseLeaveCallback(boost::bind(&LLPanelPick::childSetVisible, this, "hovered_icon", false));
+	setMouseEnterCallback(boost::bind(&LLPanelPickInfo::childSetVisible, this, "hovered_icon", true));
+	setMouseLeaveCallback(boost::bind(&LLPanelPickInfo::childSetVisible, this, "hovered_icon", false));
 	return TRUE;
 }
 
diff --git a/indra/newview/llpanelpicks.h b/indra/newview/llpanelpicks.h
index 18c571c7353..6264a19318b 100644
--- a/indra/newview/llpanelpicks.h
+++ b/indra/newview/llpanelpicks.h
@@ -44,11 +44,12 @@ class LLPanelProfile;
 class LLMessageSystem;
 class LLVector3d;
 class LLPanelProfileTab;
-class LLPanelPick;
 class LLAgent;
 class LLMenuGL;
 class LLPickItem;
 class LLFlatListView;
+class LLPanelPickInfo;
+class LLPanelPickEdit;
 
 class LLPanelPicks 
 	: public LLPanelProfileTab
@@ -74,11 +75,6 @@ class LLPanelPicks
 	// parent panels failed to work (picks related code was in me profile panel)
 	void setProfilePanel(LLPanelProfile* profile_panel);
 
-	/**
-	 * Closes LLPanelPick if it is visible.
-	 */
-	/*virtual*/ void onClosePanel();
-
 private:
 	void onClickDelete();
 	void onClickTeleport();
@@ -89,7 +85,8 @@ class LLPanelPicks
 	//------------------------------------------------
 	void onClickNew();
 	void onClickInfo();
-	void onClickBack();
+	void onPanelPickClose(LLPanel* panel);
+	void onPanelPickEdit();
 	void onClickMenuEdit();
 
 	void buildPickPanel();
@@ -104,10 +101,17 @@ class LLPanelPicks
 
 	LLPanelProfile* getProfilePanel();
 
+	void createPickInfoPanel();
+	void createPickEditPanel();
+// 	void openPickEditPanel(LLPickItem* pick);
+// 	void openPickInfoPanel(LLPickItem* pick);
+
 	LLMenuGL* mPopupMenu;
 	LLPanelProfile* mProfilePanel;
-	LLPanelPick* mPickPanel;
+	LLPanelPickInfo* mPickPanel;
 	LLFlatListView* mPicksList;
+	LLPanelPickInfo* mPanelPickInfo;
+	LLPanelPickEdit* mPanelPickEdit;
 };
 
 class LLPickItem : public LLPanel, public LLAvatarPropertiesObserver
@@ -144,6 +148,14 @@ class LLPickItem : public LLPanel, public LLAvatarPropertiesObserver
 
 	const std::string getDescription();
 
+	const std::string& getSimName() { return mSimName; }
+
+	const std::string& getUserName() { return mUserName; }
+
+	const std::string& getOriginalName() { return mOriginalName; }
+
+	const std::string& getPickDesc() { return mPickDescription; }
+
 	/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
 
 	void update();
@@ -165,6 +177,10 @@ class LLPickItem : public LLPanel, public LLAvatarPropertiesObserver
 	bool mNeedData;
 
 	std::string mPickName;
+	std::string mUserName;
+	std::string mOriginalName;
+	std::string mPickDescription;
+	std::string mSimName;
 };
 
 #endif // LL_LLPANELPICKS_H
diff --git a/indra/newview/llpanelplaceinfo.cpp b/indra/newview/llpanelplaceinfo.cpp
index 39055e4732e..2372063fbd8 100644
--- a/indra/newview/llpanelplaceinfo.cpp
+++ b/indra/newview/llpanelplaceinfo.cpp
@@ -908,7 +908,7 @@ void LLPanelPlaceInfo::createLandmark(const LLUUID& folder_id)
 		folder_id.notNull() ? folder_id : gInventory.findCategoryUUIDForType(LLAssetType::AT_LANDMARK));
 }
 
-void LLPanelPlaceInfo::createPick(const LLVector3d& pos_global, LLPanelPick* pick_panel)
+void LLPanelPlaceInfo::createPick(const LLVector3d& pos_global, LLPanelPickEdit* pick_panel)
 {
 	std::string name = mParcelName->getText();
 	if (name.empty())
@@ -916,11 +916,13 @@ void LLPanelPlaceInfo::createPick(const LLVector3d& pos_global, LLPanelPick* pic
 		name = mRegionName->getText();
 	}
 
-	pick_panel->prepareNewPick(pos_global,
-							  name,
-							  mDescEditor->getText(),
-							  mSnapshotCtrl->getImageAssetID(),
-							  mParcelID);
+	LLPickData data;
+	data.pos_global = pos_global;
+	data.name = name;
+	data.desc = mDescEditor->getText();
+	data.snapshot_id = mSnapshotCtrl->getImageAssetID();
+	data.parcel_id = mParcelID;
+	pick_panel->setPickData(&data);
 }
 
 // virtual
diff --git a/indra/newview/llpanelplaceinfo.h b/indra/newview/llpanelplaceinfo.h
index 3e8344ff121..06fee2224e9 100644
--- a/indra/newview/llpanelplaceinfo.h
+++ b/indra/newview/llpanelplaceinfo.h
@@ -45,7 +45,7 @@ class LLButton;
 class LLComboBox;
 class LLInventoryItem;
 class LLLineEditor;
-class LLPanelPick;
+class LLPanelPickEdit;
 class LLParcel;
 class LLIconCtrl;
 class LLTextBox;
@@ -89,7 +89,7 @@ class LLPanelPlaceInfo : public LLPanel, LLRemoteParcelInfoObserver
 	
 	// Create a pick for the location specified
 	// by global_pos.
-	void createPick(const LLVector3d& pos_global, LLPanelPick* pick_panel);
+	void createPick(const LLVector3d& pos_global, LLPanelPickEdit* pick_panel);
 
 	BOOL isMediaPanelVisible();
 	void toggleMediaPanel(BOOL visible);
diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp
index b2541ac1b08..f30bb1a0a6d 100644
--- a/indra/newview/llpanelplaces.cpp
+++ b/indra/newview/llpanelplaces.cpp
@@ -635,20 +635,21 @@ void LLPanelPlaces::onOverflowMenuItemClicked(const LLSD& param)
 
 		if (mPickPanel == NULL)
 		{
-			mPickPanel = new LLPanelPick();
+			mPickPanel = LLPanelPickEdit::create();
 			addChild(mPickPanel);
 
 			mPickPanel->setExitCallback(boost::bind(&LLPanelPlaces::togglePickPanel, this, FALSE));
+			mPickPanel->setCancelCallback(boost::bind(&LLPanelPlaces::togglePickPanel, this, FALSE));
+			mPickPanel->setSaveCallback(boost::bind(&LLPanelPlaces::togglePickPanel, this, FALSE));
 		}
 
 		togglePickPanel(TRUE);
+		mPickPanel->onOpen(LLSD());
+		mPlaceInfo->createPick(mPosGlobal, mPickPanel);
 
 		LLRect rect = getRect();
 		mPickPanel->reshape(rect.getWidth(), rect.getHeight());
 		mPickPanel->setRect(rect);
-		mPickPanel->setEditMode(TRUE);
-
-		mPlaceInfo->createPick(mPosGlobal, mPickPanel);
 	}
     else if (item == "add_to_favbar")
     {
diff --git a/indra/newview/llpanelplaces.h b/indra/newview/llpanelplaces.h
index ce20ffdc91d..70c50b20587 100644
--- a/indra/newview/llpanelplaces.h
+++ b/indra/newview/llpanelplaces.h
@@ -37,7 +37,7 @@
 class LLInventoryItem;
 class LLFilterEditor;
 class LLLandmark;
-class LLPanelPick;
+class LLPanelPickEdit;
 class LLPanelPlaceInfo;
 class LLPanelPlacesTab;
 class LLParcelSelection;
@@ -91,7 +91,7 @@ class LLPanelPlaces : public LLPanel
 	LLPanelPlacesTab*			mActivePanel;
 	LLTabContainer*				mTabContainer;
 	LLPanelPlaceInfo*			mPlaceInfo;
-	LLPanelPick*				mPickPanel;
+	LLPanelPickEdit*			mPickPanel;
 	LLToggleableMenu*			mPlaceMenu;
 	LLToggleableMenu*			mLandmarkMenu;
 
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index cda7942c1d1..08d2baf6cd8 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -117,25 +117,21 @@ void LLPanelProfile::onOpen(const LLSD& key)
 void LLPanelProfile::togglePanel(LLPanel* panel)
 {
 	// TRUE - we need to open/expand "panel"
-	bool expand = getChildList()->back() != panel;  // mTabCtrl->getVisible();
+	bool expand = getChildList()->front() != panel;  // mTabCtrl->getVisible();
 
 	if (expand)
 	{
-		//*NOTE on view profile panel along with tabcontainer there is 
-		// a backbutton that will be shown when there will be a panel over it even 
-		//if that panel has visible backgroud
-		setAllChildrenVisible(FALSE);
-		
-		panel->setVisible(TRUE);
 		if (panel->getParent() != this)
 		{
-			addChildInBack(panel);
+			addChild(panel);
 		}
 		else
 		{
-			sendChildToBack(panel);
+			sendChildToFront(panel);
 		}
 
+		panel->setVisible(TRUE);
+
 		LLRect new_rect = getRect();
 		panel->reshape(new_rect.getWidth(), new_rect.getHeight());
 		new_rect.setLeftTopAndSize(0, new_rect.getHeight(), new_rect.getWidth(), new_rect.getHeight());
@@ -143,13 +139,12 @@ void LLPanelProfile::togglePanel(LLPanel* panel)
 	}
 	else 
 	{
-		this->setAllChildrenVisible(TRUE);
 		panel->setVisible(FALSE);
 		if (panel->getParent() == this) 
 		{
 			removeChild(panel);
 		}
-		sendChildToBack(getTabCtrl());
+
 		getTabCtrl()->getCurrentPanel()->onOpen(getAvatarId());
 	}
 }
@@ -174,3 +169,34 @@ void LLPanelProfile::setAllChildrenVisible(BOOL visible)
 	}
 }
 
+void LLPanelProfile::openPanel(LLPanel* panel, const LLSD& params)
+{
+	if (panel->getParent() != this)
+	{
+		addChild(panel);
+	}
+	else
+	{
+		sendChildToFront(panel);
+	}
+
+	panel->setVisible(TRUE);
+
+	panel->onOpen(params);
+
+	LLRect new_rect = getRect();
+	panel->reshape(new_rect.getWidth(), new_rect.getHeight());
+	new_rect.setLeftTopAndSize(0, new_rect.getHeight(), new_rect.getWidth(), new_rect.getHeight());
+	panel->setRect(new_rect);
+}
+
+void LLPanelProfile::notifyParent(const LLSD& info)
+{
+	// lets update Picks list after Pick was saved
+	if("save_new_pick" == info["action"])
+	{
+		onOpen(info);
+		return;
+	}
+	LLPanel::notifyParent(info);
+}
diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h
index bb893f257aa..e0b827c9865 100644
--- a/indra/newview/llpanelprofile.h
+++ b/indra/newview/llpanelprofile.h
@@ -53,6 +53,10 @@ class LLPanelProfile : public LLPanel
 
 	virtual void togglePanel(LLPanel*);
 
+	virtual void openPanel(LLPanel* panel, const LLSD& params);
+
+	void notifyParent(const LLSD& info);
+
 protected:
 
 	LLPanelProfile();
diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp
index 96efb885ddb..207ed723b2b 100644
--- a/indra/newview/llpanelteleporthistory.cpp
+++ b/indra/newview/llpanelteleporthistory.cpp
@@ -221,7 +221,8 @@ LLTeleportHistoryPanel::LLTeleportHistoryPanel()
 		mTeleportHistory(NULL),
 		mHistoryAccordion(NULL),
 		mAccordionTabMenu(NULL),
-		mLastSelectedScrollList(NULL)
+		mLastSelectedFlatlList(NULL),
+		mLastSelectedItemIndex(-1)
 {
 	LLUICtrlFactory::getInstance()->buildPanel(this, "panel_teleport_history.xml");
 }
@@ -236,7 +237,7 @@ BOOL LLTeleportHistoryPanel::postBuild()
 	mTeleportHistory = LLTeleportHistoryStorage::getInstance();
 	if (mTeleportHistory)
 	{
-		mTeleportHistory->setHistoryChangedCallback(boost::bind(&LLTeleportHistoryPanel::showTeleportHistory, this));
+		mTeleportHistory->setHistoryChangedCallback(boost::bind(&LLTeleportHistoryPanel::onTeleportHistoryChange, this));
 	}
 
 	mHistoryAccordion = getChild<LLAccordionCtrl>("history_accordion");
@@ -308,10 +309,10 @@ void LLTeleportHistoryPanel::onSearchEdit(const std::string& string)
 // virtual
 void LLTeleportHistoryPanel::onShowOnMap()
 {
-	if (!mLastSelectedScrollList)
+	if (!mLastSelectedFlatlList)
 		return;
 
-	LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedScrollList->getSelectedItem());
+	LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
 
 	if(!itemp)
 		return;
@@ -328,10 +329,10 @@ void LLTeleportHistoryPanel::onShowOnMap()
 // virtual
 void LLTeleportHistoryPanel::onTeleport()
 {
-	if (!mLastSelectedScrollList)
+	if (!mLastSelectedFlatlList)
 		return;
 
-	LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedScrollList->getSelectedItem());
+	LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
 	if(!itemp)
 		return;
 
@@ -369,14 +370,14 @@ void LLTeleportHistoryPanel::updateVerbs()
 	if (!isTabVisible())
 		return;
 
-	if (!mLastSelectedScrollList)
+	if (!mLastSelectedFlatlList)
 	{
 		mTeleportBtn->setEnabled(false);
 		mShowOnMapBtn->setEnabled(false);
 		return;
 	}
 
-	LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedScrollList->getSelectedItem());
+	LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
 
 	mTeleportBtn->setEnabled(NULL != itemp && itemp->getIndex() < (S32)mTeleportHistory->getItems().size() - 1);
 	mShowOnMapBtn->setEnabled(NULL != itemp);
@@ -480,8 +481,14 @@ void LLTeleportHistoryPanel::refresh()
 		}
 
 		if (curr_flat_view)
-			curr_flat_view->addItem(new LLTeleportHistoryFlatItem(mCurrentItem, &mContextMenu, items[mCurrentItem].mTitle));
+		{
+			LLTeleportHistoryFlatItem* item = new LLTeleportHistoryFlatItem(mCurrentItem, &mContextMenu, items[mCurrentItem].mTitle);
+			curr_flat_view->addItem(item);
 
+			if (mLastSelectedItemIndex == mCurrentItem)
+				curr_flat_view->selectItem(item, true);
+		}
+			
 		mCurrentItem--;
 
 		if (++added_items >= ADD_LIMIT)
@@ -496,6 +503,12 @@ void LLTeleportHistoryPanel::refresh()
 		mDirty = false;
 }
 
+void LLTeleportHistoryPanel::onTeleportHistoryChange()
+{
+	mLastSelectedItemIndex = -1;
+	showTeleportHistory();
+}
+
 void LLTeleportHistoryPanel::showTeleportHistory()
 {
 	mDirty = true;
@@ -516,7 +529,10 @@ void LLTeleportHistoryPanel::showTeleportHistory()
 
 void LLTeleportHistoryPanel::handleItemSelect(LLFlatListView* selected)
 {
-	mLastSelectedScrollList = selected;
+	mLastSelectedFlatlList = selected;
+	LLTeleportHistoryFlatItem* item = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
+	if (item)
+		mLastSelectedItemIndex = item->getIndex();
 
 	S32 tabs_cnt = mItemContainers.size();
 
@@ -633,8 +649,6 @@ bool LLTeleportHistoryPanel::onClearTeleportHistoryDialog(const LLSD& notificati
 		LLTeleportHistoryStorage *th = LLTeleportHistoryStorage::getInstance();
 		th->purgeItems();
 		th->save();
-
-		showTeleportHistory();
 	}
 
 	return false;
diff --git a/indra/newview/llpanelteleporthistory.h b/indra/newview/llpanelteleporthistory.h
index bc3595e66dc..49a97c5022e 100644
--- a/indra/newview/llpanelteleporthistory.h
+++ b/indra/newview/llpanelteleporthistory.h
@@ -90,6 +90,7 @@ class LLTeleportHistoryPanel : public LLPanelPlacesTab
 
 	void refresh();
 	void getNextTab(const LLDate& item_date, S32& curr_tab, LLDate& tab_date);
+	void onTeleportHistoryChange();
 	void showTeleportHistory();
 	void handleItemSelect(LLFlatListView* );
 	LLFlatListView* getFlatListViewFromTab(LLAccordionCtrlTab *);
@@ -98,7 +99,8 @@ class LLTeleportHistoryPanel : public LLPanelPlacesTab
 	LLTeleportHistoryStorage*	mTeleportHistory;
 	LLAccordionCtrl*		mHistoryAccordion;
 
-	LLFlatListView*			mLastSelectedScrollList;
+	LLFlatListView*			mLastSelectedFlatlList;
+	S32				mLastSelectedItemIndex;
 	bool				mDirty;
 	S32				mCurrentItem;
 	std::string				mFilterSubString;
diff --git a/indra/newview/llplacesinventorybridge.cpp b/indra/newview/llplacesinventorybridge.cpp
index ef02882c0d9..b3b48577278 100644
--- a/indra/newview/llplacesinventorybridge.cpp
+++ b/indra/newview/llplacesinventorybridge.cpp
@@ -79,13 +79,8 @@ void LLPlacesLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	{
 		fill_items_with_menu_items(items, menu);
 
-		// Disable "Landmark More Information" menu item for
-		// multiple landmarks selected. Only one landmark
-		// info panel can be shown at a time.
-		if ((flags & FIRST_SELECTED_ITEM) == 0)
-		{
-			disabled_items.push_back(std::string("more_info"));
-		}
+		// Disabled items are processed via LLLandmarksPanel::isActionEnabled()
+		// they should be synchronized with Places/My Landmarks/Gear menu. See EXT-1601 
 	}
 
 	hideContextEntries(menu, items, disabled_items);
@@ -101,13 +96,10 @@ void LLPlacesFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 
 		LLInventoryPanel* inv_panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
 		bool is_open = false;
-		bool disable_changing = true;
 		if (inv_panel)
 		{
 			LLFolderViewFolder* folder = dynamic_cast<LLFolderViewFolder*>(inv_panel->getRootFolder()->getItemByID(mUUID));
 			is_open = (NULL != folder) && folder->isOpen();
-
-			disable_changing = !is_landmarks_panel(inv_panel);
 		}
 
 		// collect all items' names
@@ -118,12 +110,8 @@ void LLPlacesFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 		std::vector<std::string>::iterator it = std::find(items.begin(), items.end(), collapse_expand_item_to_hide);
 		if (it != items.end())	items.erase(it);
 
-		if (disable_changing)
-		{
-			disabled_items.push_back(std::string("add_folder"));
-			disabled_items.push_back(std::string("rename"));
-			disabled_items.push_back(std::string("delete"));
-		}
+		// Disabled items are processed via LLLandmarksPanel::isActionEnabled()
+		// they should be synchronized with Places/My Landmarks/Gear menu. See EXT-1601 
 
 		// repeat parent functionality
  		sSelf = this; // necessary for "New Folder" functionality
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index aa662b713e9..b268413d363 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -95,6 +95,7 @@
 #include "llmenugl.h"
 #include "llmoveview.h"
 #include "llmutelist.h"
+#include "llnearbychat.h"
 #include "llnotifications.h"
 #include "llnotify.h"
 #include "llpanelgrouplandmoney.h"
@@ -1986,6 +1987,12 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 			// IMs from objcts don't open IM sessions.
 			chat.mSourceType = CHAT_SOURCE_OBJECT;
 			LLFloaterChat::addChat(chat, FALSE, FALSE);
+
+			// archive message in nearby chat
+			LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());
+			if(nearby_chat)
+				nearby_chat->addMessage(chat);
+
 		}
 		break;
 	case IM_FROM_TASK_AS_ALERT:
diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml
index 4d8f88c80b0..e2cc1481c4b 100644
--- a/indra/newview/skins/default/colors.xml
+++ b/indra/newview/skins/default/colors.xml
@@ -567,7 +567,7 @@
      reference="White_05" />
     <color
      name="ScrollDisabledColor"
-     reference="Unused?" />
+     reference="White_25" />
     <color
      name="ScrollHighlightedColor"
      reference="Unused?" />
diff --git a/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml
index 3c7b6dad14a..cc17e9dd4b7 100644
--- a/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml
+++ b/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml
@@ -2,12 +2,26 @@
 <menu name="menu_group_plus"
      left="0" bottom="0" visible="false"
      mouse_opaque="false" opaque="true" color="MenuDefaultBgColor" drop_shadow="false">
-  <menu_item_call name="sort_name" label="Sort by Name">
-    <menu_item_call.on_click function="People.Friends.ViewSort.Action" userdata="sort_name" />
-  </menu_item_call>
-  <menu_item_call name="sort_status" label="Sort by Status">
-    <menu_item_call.on_click function="People.Friends.ViewSort.Action" userdata="sort_status" />
-  </menu_item_call>
+  <menu_item_check
+   label="Sort by Name"
+   name="sort_name">
+      <menu_item_check.on_click
+       function="People.Friends.ViewSort.Action"
+       parameter="sort_name" />
+      <menu_item_check.on_check
+       function="People.Friends.ViewSort.CheckItem"
+       parameter="sort_name" />
+  </menu_item_check>
+  <menu_item_check
+   label="Sort by Status"
+   name="sort_status">
+      <menu_item_check.on_click
+       function="People.Friends.ViewSort.Action"
+       parameter="sort_status" />
+      <menu_item_check.on_check
+       function="People.Friends.ViewSort.CheckItem"
+       parameter="sort_status" />
+  </menu_item_check>
   <menu_item_separator layout="topleft" />
   <menu_item_call name="view_icons" label="View People Icons">
     <menu_item_call.on_click function="People.Friends.ViewSort.Action" userdata="view_icons" />
diff --git a/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml
index ed03cd467c5..d09871cff3a 100644
--- a/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml
+++ b/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml
@@ -2,12 +2,26 @@
 <menu name="menu_group_plus"
      left="0" bottom="0" visible="false"
      mouse_opaque="false" opaque="true" color="MenuDefaultBgColor" drop_shadow="false">
-  <menu_item_call name="sort_most" label="Sort by Most Recent">
-    <menu_item_call.on_click function="People.Recent.ViewSort.Action" userdata="sort_recent" />
-  </menu_item_call>
-  <menu_item_call name="sort_name" label="Sort by Name">
-    <menu_item_call.on_click function="People.Recent.ViewSort.Action" userdata="sort_name" />
-  </menu_item_call>
+  <menu_item_check
+   label="Sort by Most Recent"
+   name="sort_most">
+      <menu_item_check.on_click
+       function="People.Recent.ViewSort.Action"
+       parameter="sort_recent" />
+      <menu_item_check.on_check
+       function="People.Recent.ViewSort.CheckItem"
+       parameter="sort_recent" />
+  </menu_item_check>
+  <menu_item_check
+   label="Sort by Name"
+   name="sort_name">
+      <menu_item_check.on_click
+       function="People.Recent.ViewSort.Action"
+       parameter="sort_name" />
+      <menu_item_check.on_check
+       function="People.Recent.ViewSort.CheckItem"
+       parameter="sort_name" />
+  </menu_item_check>
   <menu_item_separator layout="topleft" />
   <menu_item_call name="view_icons" label="View People Icons">
     <menu_item_call.on_click function="People.Recent.ViewSort.Action" userdata="view_icons" />
diff --git a/indra/newview/skins/default/xui/en/menu_places_gear_folder.xml b/indra/newview/skins/default/xui/en/menu_places_gear_folder.xml
index b31a0d88a44..c95cf32a5af 100644
--- a/indra/newview/skins/default/xui/en/menu_places_gear_folder.xml
+++ b/indra/newview/skins/default/xui/en/menu_places_gear_folder.xml
@@ -1,45 +1,118 @@
-<menu name="menu_folder_gear"
-     left="0" bottom="0" visible="false"
-     mouse_opaque="false" opaque="true" 
-     color="MenuDefaultBgColor" drop_shadow="true">
-     <menu_item_call name="add_landmark" label="Add Landmark">
-     <menu_item_call.on_click function="Places.LandmarksGear.Add.Action" userdata="add_landmark" />
-     </menu_item_call>
-     <menu_item_call name="add_folder" label="Add Folder">
-     <menu_item_call.on_click function="Places.LandmarksGear.Add.Action" userdata="category" />
-     <menu_item_call.on_enable function="Places.LandmarksGear.Enable" userdata="category" />
-     </menu_item_call>
-     <menu_item_separator layout="topleft" />
-     <menu_item_call name="cut" label="Cut">
-     <menu_item_call.on_click function="Places.LandmarksGear.CopyPaste.Action" userdata="cut" />
-     </menu_item_call>
-     <menu_item_call name="copy_folder" label="Copy">
-     <menu_item_call.on_click function="Places.LandmarksGear.CopyPaste.Action" userdata="copy" />
-     </menu_item_call>
-     <menu_item_call name="paste" label="Paste">
-     <menu_item_call.on_click function="Places.LandmarksGear.CopyPaste.Action" userdata="paste" />
-     <menu_item_call.on_enable function="Places.LandmarksGear.Enable" userdata="paste" />
-     </menu_item_call>
-     <menu_item_call name="rename" label="Rename">
-     <menu_item_call.on_click function="Places.LandmarksGear.CopyPaste.Action" userdata="rename" />
-     </menu_item_call>
-     <menu_item_call name="delete" label="Delete">
-     <menu_item_call.on_click function="Places.LandmarksGear.CopyPaste.Action" userdata="delete" />
-     </menu_item_call>
-     <menu_item_separator layout="topleft" />
-     <menu_item_call name="expand" label="Expand">
-     <menu_item_call.on_click function="Places.LandmarksGear.Folding.Action" userdata="expand" />
-     </menu_item_call>
-     <menu_item_call name="collapse" label="Collapse">
-     <menu_item_call.on_click function="Places.LandmarksGear.Folding.Action" userdata="collapse" />
-     </menu_item_call>
-     <menu_item_call name="expand_all" label="Expand all folders">
-     <menu_item_call.on_click function="Places.LandmarksGear.Folding.Action" userdata="expand_all" />
-     </menu_item_call>
-     <menu_item_call name="collapse_all" label="Collapse all folders">
-     <menu_item_call.on_click function="Places.LandmarksGear.Folding.Action" userdata="collapse_all" />
-     </menu_item_call>
-     <menu_item_call name="sort_by_date" label="Sort by Date">
-     <menu_item_call.on_click function="Places.LandmarksGear.Folding.Action" userdata="sort_by_date" />
-     </menu_item_call>
-</menu>
\ No newline at end of file
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<menu
+ bottom="806"
+ layout="topleft"
+ left="0"
+ mouse_opaque="false"
+ name="menu_folder_gear"
+ visible="false">
+    <menu_item_call
+     label="Add Landmark"
+     layout="topleft"
+     name="add_landmark">
+        <on_click
+         function="Places.LandmarksGear.Add.Action"
+         parameter="add_landmark" />
+    </menu_item_call>
+    <menu_item_call
+     label="Add Folder"
+     layout="topleft"
+     name="add_folder">
+        <on_click
+         function="Places.LandmarksGear.Add.Action"
+         parameter="category" />
+        <on_enable
+         function="Places.LandmarksGear.Enable"
+         parameter="category" />
+    </menu_item_call>
+    <menu_item_separator
+     layout="topleft" />
+    <menu_item_call
+     label="Cut"
+     layout="topleft"
+     name="cut">
+        <on_click
+         function="Places.LandmarksGear.CopyPaste.Action"
+         parameter="cut" />
+    </menu_item_call>
+    <menu_item_call
+     label="Copy"
+     layout="topleft"
+     name="copy_folder">
+        <on_click
+         function="Places.LandmarksGear.CopyPaste.Action"
+         parameter="copy" />
+    </menu_item_call>
+    <menu_item_call
+     label="Paste"
+     layout="topleft"
+     name="paste">
+        <on_click
+         function="Places.LandmarksGear.CopyPaste.Action"
+         parameter="paste" />
+        <on_enable
+         function="Places.LandmarksGear.Enable"
+         parameter="paste" />
+    </menu_item_call>
+    <menu_item_call
+     label="Rename"
+     layout="topleft"
+     name="rename">
+        <on_click
+         function="Places.LandmarksGear.CopyPaste.Action"
+         parameter="rename" />
+    </menu_item_call>
+    <menu_item_call
+     label="Delete"
+     layout="topleft"
+     name="delete">
+        <on_click
+         function="Places.LandmarksGear.CopyPaste.Action"
+         parameter="delete" />
+    </menu_item_call>
+    <menu_item_separator
+     layout="topleft" />
+    <menu_item_call
+     label="Expand"
+     layout="topleft"
+     name="expand">
+        <on_click
+         function="Places.LandmarksGear.Folding.Action"
+         parameter="expand" />
+    </menu_item_call>
+    <menu_item_call
+     label="Collapse"
+     layout="topleft"
+     name="collapse">
+        <on_click
+         function="Places.LandmarksGear.Folding.Action"
+         parameter="collapse" />
+    </menu_item_call>
+    <menu_item_call
+     label="Expand all folders"
+     layout="topleft"
+     name="expand_all">
+        <on_click
+         function="Places.LandmarksGear.Folding.Action"
+         parameter="expand_all" />
+    </menu_item_call>
+    <menu_item_call
+     label="Collapse all folders"
+     layout="topleft"
+     name="collapse_all">
+        <on_click
+         function="Places.LandmarksGear.Folding.Action"
+         parameter="collapse_all" />
+    </menu_item_call>
+    <menu_item_check
+     label="Sort by Date"
+     layout="topleft"
+     name="sort_by_date">
+        <on_check
+         function="Places.LandmarksGear.Enable"
+         parameter="sort_by_date" />
+        <on_click
+         function="Places.LandmarksGear.Folding.Action"
+         parameter="sort_by_date" />
+    </menu_item_check>
+</menu>
diff --git a/indra/newview/skins/default/xui/en/menu_places_gear_landmark.xml b/indra/newview/skins/default/xui/en/menu_places_gear_landmark.xml
index 2d8bb0dcb99..0246d775ee2 100644
--- a/indra/newview/skins/default/xui/en/menu_places_gear_landmark.xml
+++ b/indra/newview/skins/default/xui/en/menu_places_gear_landmark.xml
@@ -1,56 +1,150 @@
-<menu name="menu_ladmark_gear"
-     left="0" bottom="0" visible="false"
-     mouse_opaque="false" opaque="true" 
-     color="MenuDefaultBgColor" drop_shadow="true">
-     <menu_item_call name="teleport" label="Teleport">
-     <menu_item_call.on_click function="Places.LandmarksGear.Custom.Action" userdata="teleport" />
-     </menu_item_call>
-     <menu_item_call name="more_info" label="More Information">
-     <menu_item_call.on_click function="Places.LandmarksGear.Custom.Action" userdata="more_info" />
-     </menu_item_call>
-     <menu_item_call name="show_on_map" label="Show on Map">
-     <menu_item_call.on_click function="Places.LandmarksGear.Custom.Action" userdata="show_on_map" />
-     </menu_item_call>
-     <menu_item_separator layout="topleft" />
-     <menu_item_call name="add_landmark" label="Add Landmark">
-     <menu_item_call.on_click function="Places.LandmarksGear.Add.Action" userdata="add_landmark" />
-     </menu_item_call>
-     <menu_item_call name="add_folder" label="Add Folder">
-     <menu_item_call.on_click function="Places.LandmarksGear.Add.Action" userdata="category" />
-     <menu_item_call.on_enable function="Places.LandmarksGear.Enable" userdata="category" />
-     </menu_item_call>
-     <menu_item_separator layout="topleft" />
-     <menu_item_call name="cut" label="Cut">
-     <menu_item_call.on_click function="Places.LandmarksGear.CopyPaste.Action" userdata="cut" />
-     </menu_item_call>
-     <menu_item_call name="copy_landmark" label="Copy Landmark">
-     <menu_item_call.on_click function="Places.LandmarksGear.CopyPaste.Action" userdata="copy" />
-     </menu_item_call>
-     <menu_item_call name="copy_slurl" label="Copy SLURL">
-     <menu_item_call.on_click function="Places.LandmarksGear.CopyPaste.Action" userdata="copy_slurl" />
-     </menu_item_call>
-     <menu_item_call name="paste" label="Paste">
-     <menu_item_call.on_click function="Places.LandmarksGear.CopyPaste.Action" userdata="paste" />
-     <menu_item_call.on_enable function="Places.LandmarksGear.Enable" userdata="paste" />
-     </menu_item_call>
-     <menu_item_call name="rename" label="Rename">
-     <menu_item_call.on_click function="Places.LandmarksGear.CopyPaste.Action" userdata="rename" />
-     </menu_item_call>
-     <menu_item_call name="delete" label="Delete">
-     <menu_item_call.on_click function="Places.LandmarksGear.CopyPaste.Action" userdata="delete" />
-     </menu_item_call>
-     <menu_item_separator layout="topleft" />
-     <menu_item_call name="expand_all" label="Expand all folders">
-     <menu_item_call.on_click function="Places.LandmarksGear.Folding.Action" userdata="expand_all" />
-     </menu_item_call>
-     <menu_item_call name="collapse_all" label="Collapse all folders">
-     <menu_item_call.on_click function="Places.LandmarksGear.Folding.Action" userdata="collapse_all" />
-     </menu_item_call>
-     <menu_item_call name="sort_by_date" label="Sort by Date">
-     <menu_item_call.on_click function="Places.LandmarksGear.Folding.Action" userdata="sort_by_date" />
-     </menu_item_call>
-     <menu_item_separator layout="topleft" />
-     <menu_item_call name="create_pick" label="Create Pick">
-     <menu_item_call.on_click function="Places.LandmarksGear.Custom.Action" userdata="create_pick" />
-     </menu_item_call>
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<menu
+ bottom="806"
+ layout="topleft"
+ left="0"
+ mouse_opaque="false"
+ name="menu_ladmark_gear"
+ visible="false">
+    <menu_item_call
+     label="Teleport"
+     layout="topleft"
+     name="teleport">
+        <on_click
+         function="Places.LandmarksGear.Custom.Action"
+         parameter="teleport" />
+        <on_enable
+         function="Places.LandmarksGear.Enable"
+         parameter="teleport" />
+    </menu_item_call>
+    <menu_item_call
+     label="More Information"
+     layout="topleft"
+     name="more_info">
+        <on_click
+         function="Places.LandmarksGear.Custom.Action"
+         parameter="more_info" />
+        <on_enable
+         function="Places.LandmarksGear.Enable"
+         parameter="more_info" />
+    </menu_item_call>
+    <menu_item_call
+     label="Show on Map"
+     layout="topleft"
+     name="show_on_map">
+        <on_click
+         function="Places.LandmarksGear.Custom.Action"
+         parameter="show_on_map" />
+    </menu_item_call>
+    <menu_item_separator
+     layout="topleft" />
+    <menu_item_call
+     label="Add Landmark"
+     layout="topleft"
+     name="add_landmark">
+        <on_click
+         function="Places.LandmarksGear.Add.Action"
+         parameter="add_landmark" />
+    </menu_item_call>
+    <menu_item_call
+     label="Add Folder"
+     layout="topleft"
+     name="add_folder">
+        <on_click
+         function="Places.LandmarksGear.Add.Action"
+         parameter="category" />
+        <on_enable
+         function="Places.LandmarksGear.Enable"
+         parameter="category" />
+    </menu_item_call>
+    <menu_item_separator
+     layout="topleft" />
+    <menu_item_call
+     label="Cut"
+     layout="topleft"
+     name="cut">
+        <on_click
+         function="Places.LandmarksGear.CopyPaste.Action"
+         parameter="cut" />
+    </menu_item_call>
+    <menu_item_call
+     label="Copy Landmark"
+     layout="topleft"
+     name="copy_landmark">
+        <on_click
+         function="Places.LandmarksGear.CopyPaste.Action"
+         parameter="copy" />
+    </menu_item_call>
+    <menu_item_call
+     label="Copy SLURL"
+     layout="topleft"
+     name="copy_slurl">
+        <on_click
+         function="Places.LandmarksGear.CopyPaste.Action"
+         parameter="copy_slurl" />
+    </menu_item_call>
+    <menu_item_call
+     label="Paste"
+     layout="topleft"
+     name="paste">
+        <on_click
+         function="Places.LandmarksGear.CopyPaste.Action"
+         parameter="paste" />
+        <on_enable
+         function="Places.LandmarksGear.Enable"
+         parameter="paste" />
+    </menu_item_call>
+    <menu_item_call
+     label="Rename"
+     layout="topleft"
+     name="rename">
+        <on_click
+         function="Places.LandmarksGear.CopyPaste.Action"
+         parameter="rename" />
+    </menu_item_call>
+    <menu_item_call
+     label="Delete"
+     layout="topleft"
+     name="delete">
+        <on_click
+         function="Places.LandmarksGear.CopyPaste.Action"
+         parameter="delete" />
+    </menu_item_call>
+    <menu_item_separator
+     layout="topleft" />
+    <menu_item_call
+     label="Expand all folders"
+     layout="topleft"
+     name="expand_all">
+        <on_click
+         function="Places.LandmarksGear.Folding.Action"
+         parameter="expand_all" />
+    </menu_item_call>
+    <menu_item_call
+     label="Collapse all folders"
+     layout="topleft"
+     name="collapse_all">
+        <on_click
+         function="Places.LandmarksGear.Folding.Action"
+         parameter="collapse_all" />
+    </menu_item_call>
+    <menu_item_check
+     label="Sort by Date"
+     layout="topleft"
+     name="sort_by_date">
+        <on_check
+         function="Places.LandmarksGear.Enable"
+         parameter="sort_by_date" />
+        <on_click
+         function="Places.LandmarksGear.Folding.Action"
+         parameter="sort_by_date" />
+    </menu_item_check>
+    <menu_item_call
+     label="Create Pick"
+     layout="topleft"
+     name="create_pick">
+        <on_click
+         function="Places.LandmarksGear.Custom.Action"
+         parameter="create_pick" />
+    </menu_item_call>
 </menu>
diff --git a/indra/newview/skins/default/xui/en/panel_edit_pick.xml b/indra/newview/skins/default/xui/en/panel_edit_pick.xml
index 736a60cfe71..bac6f6e4d1b 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_pick.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_pick.xml
@@ -2,6 +2,7 @@
 <panel
  background_visible="true"
  bevel_style="in"
+ follows="left|top|right|bottom"
  height="570"
  label="Edit Pick"
  layout="topleft"
@@ -43,7 +44,7 @@
      left="10"
      top_pad="10"
      name="profile_scroll"
-     reserve_scroll_corner="true"
+     reserve_scroll_corner="false"
      opaque="true"
      width="313">
     <panel
diff --git a/indra/newview/skins/default/xui/en/panel_group_general.xml b/indra/newview/skins/default/xui/en/panel_group_general.xml
index 6f012026808..19285e8e481 100644
--- a/indra/newview/skins/default/xui/en/panel_group_general.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_general.xml
@@ -24,20 +24,6 @@ Hover your mouse over the options for more help.
      name="incomplete_member_data_str">
         Retrieving member data
     </panel.string>
-    <panel.string
-     name="group_join_btn">
-        Join (L$[AMOUNT])
-    </panel.string>
-    <!--<button
-     follows="left|top"
-     height="16"
-     label="?"
-     label_selected="?"
-     layout="topleft"
-     left="255"
-     name="help_button"
-     top="8"
-     width="20" /> -->
     <text_editor
      type="string"
      follows="left|top"
diff --git a/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml b/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml
index fb4ce436e8c..c3b277fb1dd 100644
--- a/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml
@@ -20,6 +20,10 @@
      name="group_join_btn">
         Join (L$[AMOUNT])
     </panel.string>
+    <panel.string
+     name="group_join_free">
+        Free
+    </panel.string>
     <button
      layout="topleft"
      name="back"
@@ -87,16 +91,28 @@
      top_pad="10"
      use_ellipses="true"
      width="140" />
+    <text
+     type="string"
+     follows="left|top"
+     height="16"
+     layout="topleft"
+     left_delta="0"
+     name="join_cost_text"
+     top_pad="10"
+     visible="true"
+     width="140">
+      Free
+    </text>
     <button
      follows="left|top"
      left_delta="0"
      top_pad="10"
      height="20"
-     label="Join"
-     label_selected="Join"
+     label="Join now!"
+     label_selected="Join now!"
      name="btn_join"
      visible="true"
-     width="65" />
+     width="85" />
     <button
      top="632"
      height="20"
diff --git a/indra/newview/skins/default/xui/en/panel_pick_info.xml b/indra/newview/skins/default/xui/en/panel_pick_info.xml
index 1f12a9782e2..a67ae59b4a4 100644
--- a/indra/newview/skins/default/xui/en/panel_pick_info.xml
+++ b/indra/newview/skins/default/xui/en/panel_pick_info.xml
@@ -41,7 +41,7 @@
      left="10"
      top_pad="10"
      name="profile_scroll"
-     reserve_scroll_corner="true"
+     reserve_scroll_corner="false"
      width="313">
     <panel
      name="scroll_content_panel"
@@ -74,7 +74,7 @@
          name="pick_name"
          text_color="white"
          value="[name]"
-         word_wrap="true" />
+         use_ellipses="true" />
         <text
          follows="left|top"
          height="25"
-- 
GitLab