// protected
void LLPanelDirBrowser::updateResultCount()
{
	LLScrollListCtrl* list = findChild<LLScrollListCtrl>("results");
	if (!list) return;

	S32 result_count = list->getItemCount();
	std::string result_text;

	if (!mHaveSearchResults) result_count = 0;

	if (childIsVisible("Next >")) 
	{
		// Item count be off by a few if bogus items sent from database
		// Just use the number of results per page. JC
		result_text = llformat(">%d found", mResultsPerPage);
	}
	else 
	{
		result_text = llformat("%d found", result_count);
	}
	
	childSetValue("result_text", result_text);
	
	if (result_count == 0)
	{
		// add none found response
		if (list->getItemCount() == 0)
		{
			list->setCommentText(LLTrans::getString("NoneFound"));
			list->operateOnAll(LLCtrlListInterface::OP_DESELECT);
		}
	}
	else
	{
		list->setEnabled(true);
	}
}
//static
void LLFloaterTeleportHistory::saveFile(const std::string &file_name)
{
    LLFloaterTeleportHistory *pFloaterHistory = LLFloaterTeleportHistory::findInstance();
    if(!pFloaterHistory)
        return;

    std::string temp_str = gDirUtilp->getLindenUserDir(true);
    if( temp_str.empty() )
    {
        LL_INFOS() << "Can't save teleport history - no user directory set yet." << LL_ENDL;
        return;
    }
    temp_str += gDirUtilp->getDirDelimiter() + file_name;
    llofstream export_file(temp_str);
    if (!export_file.good())
    {
        LL_WARNS() << "Unable to open " << file_name << " for output." << LL_ENDL;
        return;
    }
    LL_INFOS() << "Writing "<< file_name << " file at " << temp_str << LL_ENDL;

    LLSD elements;
    LLScrollListCtrl* pScrollList = pFloaterHistory->mPlacesList;
    if (pScrollList)
    {
        std::vector<LLScrollListItem*> data_list = pScrollList->getAllData();
        std::sort(data_list.begin(),data_list.end(),SortByAge());//Re-sort. Column sorting may have mucked the list up. Newer entries in front.
        for (std::vector<LLScrollListItem*>::iterator itr = data_list.begin(); itr != data_list.end(); ++itr)
        {
            //Pack into LLSD mimicing one passed to addElement
            LLSD data_entry;
            //id is actually reverse of the indexing of the element LLSD. Higher id = newer.
            data_entry["id"] = pScrollList->getItemCount() - elements.size() - 1;
            for(S32 i = 0; i < (*itr)->getNumColumns(); ++i)
            {
                data_entry["columns"][i]["column"]=pScrollList->getColumn(i)->mName;
                data_entry["columns"][i]["value"]=(*itr)->getColumn(i)->getValue();
            }
            elements.append(data_entry);
        }
    }
    LLSDSerialize::toXML(elements, export_file);
    export_file.close();
}
//static
void LLFloaterTeleportHistory::loadFile(const std::string &file_name)
{
    LLFloaterTeleportHistory *pFloaterHistory = LLFloaterTeleportHistory::findInstance();
    if(!pFloaterHistory)
        return;

    LLScrollListCtrl* pScrollList = pFloaterHistory->mPlacesList;
    if(!pScrollList)
        return;

    std::string temp_str(gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + file_name);

    llifstream file(temp_str);

    if (file.is_open())
    {
        LL_INFOS() << "Loading "<< file_name << " file at " << temp_str << LL_ENDL;
        LLSD data;
        LLSDSerialize::fromXML(data, file);
        if (data.isUndefined())
        {
            LL_INFOS() << "file missing, ill-formed, "
                       "or simply undefined; not reading the"
                       " file" << LL_ENDL;
        }
        else
        {
            const S32 max_entries = gSavedSettings.getS32("TeleportHistoryMaxEntries");
            const S32 num_entries = llmin(max_entries,(const S32)data.size());
            pScrollList->clear();
            for(S32 i = 0; i < num_entries; i++) //Lower entry = newer
            {
                pScrollList->addElement(data[i], ADD_BOTTOM);
            }
            pScrollList->deselectAllItems(TRUE);
            pFloaterHistory->mID = pScrollList->getItemCount();
            pFloaterHistory->setButtonsEnabled(FALSE);
        }
    }
}
void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data)
{
	U32 request_flags;
	U32 total_count;

	msg->getU32Fast(_PREHASH_RequestData, _PREHASH_RequestFlags, request_flags);
	msg->getU32Fast(_PREHASH_RequestData, _PREHASH_TotalObjectCount, total_count);
	msg->getU32Fast(_PREHASH_RequestData, _PREHASH_ReportType, mCurrentMode);

	LLScrollListCtrl *list = getChild<LLScrollListCtrl>("objects_list");

	S32 block_count = msg->getNumberOfBlocks("ReportData");
	for (S32 block = 0; block < block_count; ++block)
	{
		U32 task_local_id;
		U32 time_stamp = 0;
		LLUUID task_id;
		F32 location_x, location_y, location_z;
		F32 score;
		std::string name_buf;
		std::string owner_buf;
		F32 mono_score = 0.f;
		bool have_extended_data = false;
		S32 public_urls = 0;

		msg->getU32Fast(_PREHASH_ReportData, _PREHASH_TaskLocalID, task_local_id, block);
		msg->getUUIDFast(_PREHASH_ReportData, _PREHASH_TaskID, task_id, block);
		msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationX, location_x, block);
		msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationY, location_y, block);
		msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationZ, location_z, block);
		msg->getF32Fast(_PREHASH_ReportData, _PREHASH_Score, score, block);
		msg->getStringFast(_PREHASH_ReportData, _PREHASH_TaskName, name_buf, block);
		msg->getStringFast(_PREHASH_ReportData, _PREHASH_OwnerName, owner_buf, block);
		if(msg->has("DataExtended"))
		{
			have_extended_data = true;
			msg->getU32("DataExtended", "TimeStamp", time_stamp, block);
			msg->getF32("DataExtended", "MonoScore", mono_score, block);
			msg->getS32(_PREHASH_ReportData,"PublicURLs",public_urls,block);
		}

		LLSD element;

		element["id"] = task_id;

		LLSD columns;
		columns[0]["column"] = "score";
		columns[0]["value"] = llformat("%0.3f", score);
		columns[0]["font"] = "SANSSERIF";
		
		columns[1]["column"] = "name";
		columns[1]["value"] = name_buf;
		columns[1]["font"] = "SANSSERIF";
		
		// Owner names can have trailing spaces sent from server
		LLStringUtil::trim(owner_buf);
		
		if (LLAvatarNameCache::useDisplayNames())
		{
			// ...convert hard-coded name from server to a username
			// *TODO: Send owner_id from server and look up display name
			owner_buf = LLCacheName::buildUsername(owner_buf);
		}
		else
		{
			// ...just strip out legacy "Resident" name
			owner_buf = LLCacheName::cleanFullName(owner_buf);
		}
		columns[2]["column"] = "owner";
		columns[2]["value"] = owner_buf;
		columns[2]["font"] = "SANSSERIF";

		columns[3]["column"] = "location";
		columns[3]["value"] = llformat("<%0.1f,%0.1f,%0.1f>", location_x, location_y, location_z);
		columns[3]["font"] = "SANSSERIF";
		columns[4]["column"] = "time";
		columns[4]["value"] = formatted_time((time_t)time_stamp);
		columns[4]["font"] = "SANSSERIF";

		if (mCurrentMode == STAT_REPORT_TOP_SCRIPTS
			&& have_extended_data)
		{
			columns[5]["column"] = "mono_time";
			columns[5]["value"] = llformat("%0.3f", mono_score);
			columns[5]["font"] = "SANSSERIF";

			columns[6]["column"] = "URLs";
			columns[6]["value"] = llformat("%d", public_urls);
			columns[6]["font"] = "SANSSERIF";
		}
		element["columns"] = columns;
		list->addElement(element);
		
		mObjectListData.append(element);
		mObjectListIDs.push_back(task_id);

		mtotalScore += score;
	}

	if (total_count == 0 && list->getItemCount() == 0)
	{
		list->setCommentText(getString("none_descriptor"));
	}
	else
	{
		list->selectFirstItem();
	}

	if (mCurrentMode == STAT_REPORT_TOP_SCRIPTS)
	{
		setTitle(getString("top_scripts_title"));
		list->setColumnLabel("score", getString("scripts_score_label"));
		list->setColumnLabel("mono_time", getString("scripts_mono_time_label"));
		
		LLUIString format = getString("top_scripts_text");
		format.setArg("[COUNT]", llformat("%d", total_count));
		format.setArg("[TIME]", llformat("%0.1f", mtotalScore));
		getChild<LLUICtrl>("title_text")->setValue(LLSD(format));
	}
	else
	{
		setTitle(getString("top_colliders_title"));
		list->setColumnLabel("score", getString("colliders_score_label"));
		list->setColumnLabel("mono_time", "");
		LLUIString format = getString("top_colliders_text");
		format.setArg("[COUNT]", llformat("%d", total_count));
		getChild<LLUICtrl>("title_text")->setValue(LLSD(format));
	}
}
// static
void LLFloaterMessageLog::conditionalLog(LLFloaterMessageLogItem item)
{	
	if(!sBusyApplyingFilter)
		sInstance->childSetText("log_status_text", llformat("Showing %d messages from %d", sFloaterMessageLogItems.size(), sMessageLogEntries.size()));
	std::string find_name = item.mName;
	LLStringUtil::toLower(find_name);
	if(sMessageLogFilter.mPositiveNames.size())
		if(std::find(sMessageLogFilter.mPositiveNames.begin(), sMessageLogFilter.mPositiveNames.end(), find_name) == sMessageLogFilter.mPositiveNames.end())
			return;
	if(std::find(sMessageLogFilter.mNegativeNames.begin(), sMessageLogFilter.mNegativeNames.end(), find_name) != sMessageLogFilter.mNegativeNames.end())
		return;
	sFloaterMessageLogItems.push_back(item); // moved from beginning...
	BOOL outgoing = item.isOutgoing();
	std::string net_name("\?\?\?");
	if(item.mType == LLFloaterMessageLogItem::TEMPLATE)
	{
		LLHost find_host = outgoing ? item.mToHost : item.mFromHost;
		net_name = find_host.getIPandPort();
		std::list<LLNetListItem*>::iterator end = sNetListItems.end();
		for(std::list<LLNetListItem*>::iterator iter = sNetListItems.begin(); iter != end; ++iter)
		{
			if((*iter)->mCircuitData->getHost() == find_host)
			{
				net_name = (*iter)->mName;
				break;
			}
		}
	}
	LLSD element;
	element["id"] = item.mID;
	LLSD& sequence_column = element["columns"][0];
	sequence_column["column"] = "sequence";
	sequence_column["value"] = llformat("%u", item.mSequenceID);
	LLSD& type_column = element["columns"][1];
	type_column["column"] = "type";
	type_column["value"] = item.mType == LLFloaterMessageLogItem::TEMPLATE ? "UDP" : "\?\?\?";
	LLSD& direction_column = element["columns"][2];
	direction_column["column"] = "direction";
	direction_column["value"] = outgoing ? "to" : "from";
	LLSD& net_column = element["columns"][3];
	net_column["column"] = "net";
	net_column["value"] = net_name;
	LLSD& name_column = element["columns"][4];
	name_column["column"] = "name";
	name_column["value"] = item.mName;
	/*
	LLSD& zer_column = element["columns"][5];
	zer_column["column"] = "flag_zer";
	zer_column["type"] = "icon";
	zer_column["value"] = (item.mFlags & LL_ZERO_CODE_FLAG) ? "flag_zer.tga" : "";
	LLSD& rel_column = element["columns"][6];
	rel_column["column"] = "flag_rel";
	rel_column["type"] = "icon";
	rel_column["value"] = (item.mFlags & LL_RELIABLE_FLAG) ? "flag_rel.tga" : "";
	LLSD& rsd_column = element["columns"][7];
	rsd_column["column"] = "flag_rsd";
	rsd_column["type"] = "icon";
	rsd_column["value"] = (item.mFlags & LL_RESENT_FLAG) ? "flag_rsd.tga" : "";
	LLSD& ack_column = element["columns"][8];
	ack_column["column"] = "flag_ack";
	ack_column["type"] = "icon";
	ack_column["value"] = (item.mFlags & LL_ACK_FLAG) ? "flag_ack.tga" : "";
	*/
	LLSD& summary_column = element["columns"][5];
	summary_column["column"] = "summary";
	summary_column["value"] = item.mSummary;
	LLScrollListCtrl* scrollp = sInstance->getChild<LLScrollListCtrl>("message_log");
	S32 scroll_pos = scrollp->getScrollPos();
	scrollp->addElement(element);
	if(scroll_pos > scrollp->getItemCount() - scrollp->getPageLines() - 4)
		scrollp->setScrollPos(scrollp->getItemCount());
}
void LLFloaterMessageLog::refreshNetList()
{
	LLScrollListCtrl* scrollp = getChild<LLScrollListCtrl>("net_list");
	// Update circuit data of net list items
	std::vector<LLCircuitData*> circuits = gMessageSystem->mCircuitInfo.getCircuitDataList();
	std::vector<LLCircuitData*>::iterator circuits_end = circuits.end();
	for(std::vector<LLCircuitData*>::iterator iter = circuits.begin(); iter != circuits_end; ++iter)
	{
		LLNetListItem* itemp = findNetListItem((*iter)->getHost());
		if(!itemp)
		{
			LLUUID id; id.generate();
			itemp = new LLNetListItem(id);
			sNetListItems.push_back(itemp);
		}
		itemp->mCircuitData = (*iter);
	}
	// Clear circuit data of items whose circuits are gone
	std::list<LLNetListItem*>::iterator items_end = sNetListItems.end();
	for(std::list<LLNetListItem*>::iterator iter = sNetListItems.begin(); iter != items_end; ++iter)
	{
		if(std::find(circuits.begin(), circuits.end(), (*iter)->mCircuitData) == circuits.end())
			(*iter)->mCircuitData = NULL;
	}
	// Remove net list items that are totally useless now
	for(std::list<LLNetListItem*>::iterator iter = sNetListItems.begin(); iter != sNetListItems.end();)
	{
		if((*iter)->mCircuitData == NULL)
			iter = sNetListItems.erase(iter);
		else ++iter;
	}
	// Update names of net list items
	items_end = sNetListItems.end();
	for(std::list<LLNetListItem*>::iterator iter = sNetListItems.begin(); iter != items_end; ++iter)
	{
		LLNetListItem* itemp = (*iter);
		if(itemp->mAutoName)
		{
			if(itemp->mCircuitData)
			{
				LLViewerRegion* regionp = LLWorld::getInstance()->getRegion(itemp->mCircuitData->getHost());
				if(regionp)
				{
					std::string name = regionp->getName();
					if(name == "") name = llformat("%s (awaiting region name)", itemp->mCircuitData->getHost().getString().c_str());
					itemp->mName = name;
					itemp->mPreviousRegionName = name;
				}
				else
				{
					itemp->mName = itemp->mCircuitData->getHost().getString();
					if(itemp->mPreviousRegionName != "")
						itemp->mName.append(llformat(" (was %s)", itemp->mPreviousRegionName.c_str()));
				}
			}
			else
			{
				// an item just for an event queue, not handled yet
				itemp->mName = "Something else";
			}
		}
	}
	// Rebuild scroll list from scratch
	LLUUID selected_id = scrollp->getFirstSelected() ? scrollp->getFirstSelected()->getUUID() : LLUUID::null;
	S32 scroll_pos = scrollp->getScrollPos();
	scrollp->clearRows();
	for(std::list<LLNetListItem*>::iterator iter = sNetListItems.begin(); iter != items_end; ++iter)
	{
		LLNetListItem* itemp = (*iter);
		LLSD element;
		element["id"] = itemp->mID;
		LLSD& text_column = element["columns"][0];
		text_column["column"] = "text";
		text_column["value"] = itemp->mName + (itemp->mCircuitData->getHost() == gAgent.getRegionHost() ? " (main)" : "");
		for(int i = 0; i < 2; i++)
		{
			LLSD& icon_column = element["columns"][i + 1];
			icon_column["column"] = llformat("icon%d", i);
			icon_column["type"] = "icon";
			icon_column["value"] = "";
		}
		LLScrollListItem* scroll_itemp = scrollp->addElement(element);
		BOOL has_live_circuit = itemp->mCircuitData && itemp->mCircuitData->isAlive();
		if(has_live_circuit)
		{
			LLScrollListIcon* icon = (LLScrollListIcon*)scroll_itemp->getColumn(1);
			icon->setValue("icon_net_close_circuit.tga");
			icon->setClickCallback(boost::bind(&LLFloaterMessageLog::onClickCloseCircuit, itemp));
		}
		else
		{
			LLScrollListIcon* icon = (LLScrollListIcon*)scroll_itemp->getColumn(1);
			icon->setValue("icon_net_close_circuit_gray.tga");
			//icon->setClickCallback(NULL);
		}
		// Event queue isn't even supported yet... FIXME
		LLScrollListIcon* icon = (LLScrollListIcon*)scroll_itemp->getColumn(2);
		icon->setValue("icon_net_close_eventpoll_gray.tga");
		//icon->setClickCallback(NULL);
	}
	if(selected_id.notNull()) scrollp->selectByID(selected_id);
	if(scroll_pos < scrollp->getItemCount()) scrollp->setScrollPos(scroll_pos);
}
void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data)
{
	U32 request_flags;
	U32 total_count;

	msg->getU32Fast(_PREHASH_RequestData, _PREHASH_RequestFlags, request_flags);
	msg->getU32Fast(_PREHASH_RequestData, _PREHASH_TotalObjectCount, total_count);
	msg->getU32Fast(_PREHASH_RequestData, _PREHASH_ReportType, mCurrentMode);

	LLScrollListCtrl *list = getChild<LLScrollListCtrl>("objects_list");
	
	S32 block_count = msg->getNumberOfBlocks("ReportData");
	for (S32 block = 0; block < block_count; ++block)
	{
		U32 task_local_id;
		U32 time_stamp = 0;
		LLUUID task_id;
		F32 location_x, location_y, location_z;
		F32 score;
		std::string name_buf;
		std::string owner_buf;
		F32 mono_score = 0.f;
		bool have_extended_data = false;
		S32 public_urls = 0;

		msg->getU32Fast(_PREHASH_ReportData, _PREHASH_TaskLocalID, task_local_id, block);
		msg->getUUIDFast(_PREHASH_ReportData, _PREHASH_TaskID, task_id, block);
		msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationX, location_x, block);
		msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationY, location_y, block);
		msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationZ, location_z, block);
		msg->getF32Fast(_PREHASH_ReportData, _PREHASH_Score, score, block);
		msg->getStringFast(_PREHASH_ReportData, _PREHASH_TaskName, name_buf, block);
		msg->getStringFast(_PREHASH_ReportData, _PREHASH_OwnerName, owner_buf, block);
		if(msg->has("DataExtended"))
		{
			have_extended_data = true;
			msg->getU32("DataExtended", "TimeStamp", time_stamp, block);
			msg->getF32("DataExtended", "MonoScore", mono_score, block);
			msg->getS32(_PREHASH_ReportData,"PublicURLs",public_urls,block);
		}

		LLSD element;

		element["id"] = task_id;
		element["object_name"] = name_buf;
		element["owner_name"] = owner_buf;
		element["columns"][0]["column"] = "score";
		element["columns"][0]["value"] = llformat("%0.3f", score);
		element["columns"][0]["font"] = "SANSSERIF";
		
		element["columns"][1]["column"] = "name";
		element["columns"][1]["value"] = name_buf;
		element["columns"][1]["font"] = "SANSSERIF";
		element["columns"][2]["column"] = "owner";
		element["columns"][2]["value"] = owner_buf;
		element["columns"][2]["font"] = "SANSSERIF";
		element["columns"][3]["column"] = "location";
		element["columns"][3]["value"] = llformat("<%0.1f,%0.1f,%0.1f>", location_x, location_y, location_z);
		element["columns"][3]["font"] = "SANSSERIF";
		element["columns"][4]["column"] = "time";
		element["columns"][4]["value"] = formatted_time((time_t)time_stamp);
		element["columns"][4]["font"] = "SANSSERIF";

		if (mCurrentMode == STAT_REPORT_TOP_SCRIPTS
			&& have_extended_data)
		{
			element["columns"][5]["column"] = "mono_time";
			element["columns"][5]["value"] = llformat("%0.3f", mono_score);
			element["columns"][5]["font"] = "SANSSERIF";

			element["columns"][6]["column"] = "URLs";
			element["columns"][6]["value"] = llformat("%d", public_urls);
			element["columns"][6]["font"] = "SANSSERIF";
		}
		
		list->addElement(element);
		
		mObjectListData.append(element);
		mObjectListIDs.push_back(task_id);

		mtotalScore += score;
	}

	if (total_count == 0 && list->getItemCount() == 0)
	{
		list->addCommentText(getString("none_descriptor"));
	}
	else
	{
		list->selectFirstItem();
	}

	if (mCurrentMode == STAT_REPORT_TOP_SCRIPTS)
	{
		setTitle(getString("top_scripts_title"));
		list->setColumnLabel("score", getString("scripts_score_label"));
		list->setColumnLabel("mono_time", getString("scripts_mono_time_label"));
		
		LLUIString format = getString("top_scripts_text");
		format.setArg("[COUNT]", llformat("%d", total_count));
		format.setArg("[TIME]", llformat("%0.1f", mtotalScore));
		childSetValue("title_text", LLSD(format));
	}
	else
	{
		setTitle(getString("top_colliders_title"));
		list->setColumnLabel("score", getString("colliders_score_label"));
		list->setColumnLabel("mono_time", "");
		LLUIString format = getString("top_colliders_text");
		format.setArg("[COUNT]", llformat("%d", total_count));
		childSetValue("title_text", LLSD(format));
	}
}
Esempio n. 8
0
void FloaterGridManager::refreshGrids()
{
	LLScrollListCtrl *grids = FloaterGridManager::getInstance()->getChild<LLScrollListCtrl>("grid_selector");
	std::string lastSelectedItem;
	LLSD element;

	if (grids->getFirstSelected())
	{
		lastSelectedItem = grids->getFirstSelected()->getValue().asString();
	}

	grids->deleteAllItems();

	for (HippoGridManager::GridIterator it = gHippoGridManager->beginGrid(); it != gHippoGridManager->endGrid(); ++it) 
	{
		std::string grid_nick = it->second->getGridNick();
		// There's no reason why empty grids nicks should be in this list, ugh
		if (!grid_nick.empty() && grid_nick != gHippoGridManager->getCurrentGridNick()) 
		{
			element["id"] = grid_nick;
			element["columns"][0]["column"] = "grid";
			element["columns"][0]["type"] = "text";
			element["columns"][0]["value"] = grid_nick;
			grids->addElement(element, ADD_BOTTOM);
		}
	}

	// Setting the default needs to be rethought. 
	// Right now, we just use the last-selected grid,
	// but leaving this as the current behavior for now
	if (!gHippoGridManager->getCurrentGridNick().empty()) 
	{
		element["id"] = gHippoGridManager->getCurrentGridNick();
		element["columns"][0]["column"] = "grid";
		element["columns"][0]["type"] = "text";
		element["columns"][0]["font-style"] = "BOLD";
		element["columns"][0]["value"] = gHippoGridManager->getCurrentGridNick();
		grids->addElement(element, ADD_TOP);
	}

	// Reselect the item if we had one selected
	if (lastSelectedItem.empty())
	{
		grids->selectItemByLabel(gHippoGridManager->getCurrentGridNick());
	}
	else
	{
		grids->selectItemByLabel(lastSelectedItem);
	}

	// TODO: get rid of all this state junk
	if ((FloaterGridManager::getInstance()->getState() == ADD_NEW) || (FloaterGridManager::getInstance()->getState() == ADD_COPY)) 
	{
		grids->addElement("<new>", ADD_BOTTOM);
	}

	//if (selectIndex >= 0) 
	//{
	//	grids->setCurrentByIndex(selectIndex);
	//} 
	//else 
	//{
	//	grids->setLabel(LLStringExplicit(""));  // LLComboBox::removeall() does not clear the label
	//}
			
	// FloaterGridManager::getInstance()->childSetTextArg("default_grid", "[DEFAULT]", (defaultGrid != "")? defaultGrid: " ");

	FloaterGridManager::getInstance()->childSetEnabled("btn_delete", grids->getItemCount() > 0);

	FloaterGridManager::getInstance()->childSetEnabled("btn_copy", (FloaterGridManager::getInstance()->getState() == NORMAL) && (grids->getItemCount() > 0));
	// FloaterGridManager::getInstance()->childSetEnabled("set_default", (FloaterGridManager::getInstance()->getState() == NORMAL) && (grids->getItemCount() > 0));
	FloaterGridManager::getInstance()->childSetEnabled("gridnick", (FloaterGridManager::getInstance()->getState() == ADD_NEW) || (FloaterGridManager::getInstance()->getState() == ADD_COPY));

	if (FloaterGridManager::getInstance()->getState() == NORMAL) 
	{
		HippoGridInfo *gridInfo = gHippoGridManager->getGrid(FloaterGridManager::getInstance()->getCurGrid());
		if (gridInfo) 
		{
			FloaterGridManager::getInstance()->childSetText("gridnick", gridInfo->getGridNick());
			//FloaterGridManager::getInstance()->childSetText("grid_name", gridInfo->getGridName());
			FloaterGridManager::getInstance()->childSetText("loginuri", gridInfo->getLoginUri());
			FloaterGridManager::getInstance()->childSetText("loginpage", gridInfo->getLoginPage());
			FloaterGridManager::getInstance()->childSetText("helperuri", gridInfo->getHelperUri());
			FloaterGridManager::getInstance()->childSetText("website", gridInfo->getWebSite());
			FloaterGridManager::getInstance()->childSetText("support", gridInfo->getSupportUrl());
			FloaterGridManager::getInstance()->childSetText("register", gridInfo->getRegisterUrl());
			FloaterGridManager::getInstance()->childSetText("password", gridInfo->getPasswordUrl());

			FloaterGridManager::getInstance()->childSetText("first_name", gridInfo->getFirstName());
			FloaterGridManager::getInstance()->childSetText("last_name", gridInfo->getLastName());
			if(gridInfo->getAvatarPassword().length() == 32)
				FloaterGridManager::getInstance()->childSetText("avatar_password", std::string(PASSWORD_FILLER));
			else if(gridInfo->getPasswordUrl().empty())
			 	FloaterGridManager::getInstance()->childSetText("avatar_password", std::string(""));

			 if (gridInfo->getPlatform() == HippoGridInfo::PLATFORM_SECONDLIFE) 
			 {
			 	FloaterGridManager::getInstance()->childSetEnabled("search", false);
				FloaterGridManager::getInstance()->childSetText("search", LLStringUtil::null);
			 	//childSetEnabled("render_compat", false);
			 	//childSetValue("render_compat", false);
			 } 
			 else 
			 {
			 	FloaterGridManager::getInstance()->childSetEnabled("search", true);
			 	FloaterGridManager::getInstance()->childSetText("search", gridInfo->getSearchUrl());
			 	//childSetEnabled("render_compat", true);
			 	//childSetValue("render_compat", gridInfo->isRenderCompat());
			 }

		}	
		else 
		{
			FloaterGridManager::getInstance()->childSetText("gridnick", LLStringUtil::null);
			FloaterGridManager::getInstance()->childSetText("gridname", LLStringUtil::null);
			FloaterGridManager::getInstance()->childSetText("loginuri", LLStringUtil::null);
			FloaterGridManager::getInstance()->childSetText("loginpage", LLStringUtil::null);
			FloaterGridManager::getInstance()->childSetText("helperuri", LLStringUtil::null);
			FloaterGridManager::getInstance()->childSetText("website", LLStringUtil::null);
			FloaterGridManager::getInstance()->childSetText("support", LLStringUtil::null);
			FloaterGridManager::getInstance()->childSetText("register", LLStringUtil::null);
			FloaterGridManager::getInstance()->childSetText("password", LLStringUtil::null);
			FloaterGridManager::getInstance()->childSetText("first_name", LLStringUtil::null);
			FloaterGridManager::getInstance()->childSetText("last_name", LLStringUtil::null);
			FloaterGridManager::getInstance()->childSetText("avatar_password", LLStringUtil::null);
			FloaterGridManager::getInstance()->childSetText("search", LLStringUtil::null);
		}
	} 
	else if (FloaterGridManager::getInstance()->getState() == ADD_NEW) 
	{
		llinfos << "mState == ADD_NEW" << llendl;
		std::string required = "<required>";
		FloaterGridManager::getInstance()->childSetText("gridnick", required);
		FloaterGridManager::getInstance()->childSetText("gridname", LLStringUtil::null);
		FloaterGridManager::getInstance()->childSetText("loginuri", required);
		FloaterGridManager::getInstance()->childSetText("loginpage", LLStringUtil::null);
		FloaterGridManager::getInstance()->childSetText("helperuri", LLStringUtil::null);
		FloaterGridManager::getInstance()->childSetText("website", LLStringUtil::null);
		FloaterGridManager::getInstance()->childSetText("support", LLStringUtil::null);
		FloaterGridManager::getInstance()->childSetText("register", LLStringUtil::null);
		FloaterGridManager::getInstance()->childSetText("password", LLStringUtil::null);
		FloaterGridManager::getInstance()->childSetText("first_name", LLStringUtil::null);
		FloaterGridManager::getInstance()->childSetText("last_name", LLStringUtil::null);
		FloaterGridManager::getInstance()->childSetText("avatar_password", LLStringUtil::null);
		// childSetEnabled("search", true);
		FloaterGridManager::getInstance()->childSetText("search", LLStringUtil::null);
	} 
	else if (FloaterGridManager::getInstance()->getState() == ADD_COPY) 
	{
		llinfos << "mState == ADD_COPY" << llendl;
		FloaterGridManager::getInstance()->childSetText("gridnick", LLStringExplicit("<required>"));
	} 
	else 
	{
		llwarns << "Illegal state " << FloaterGridManager::getInstance()->getState() << llendl; 	
	}
	return;
}
void LLFloaterMessageLog::conditionalLog(LogPayload entry)
{	
	if(!mMessageLogFilterApply)
		childSetText("log_status_text", llformat("Showing %d messages of %d", mFloaterMessageLogItems.size(), mMessagesLogged));

	FloaterMessageItem item = new LLEasyMessageLogEntry(entry, mEasyMessageReader);


	std::set<std::string>::const_iterator end_msg_name = item->mNames.end();
	std::set<std::string>::iterator iter_msg_name = item->mNames.begin();

	bool have_positive = false;

	for(; iter_msg_name != end_msg_name; ++iter_msg_name)
	{
		std::string find_name = *iter_msg_name;
		LLStringUtil::toLower(find_name);

		//keep the message if we allowed its name so long as one of its other names hasn't been blacklisted
		if(!have_positive && !mMessageLogFilter.mPositiveNames.empty())
		{
			if(std::find(mMessageLogFilter.mPositiveNames.begin(), mMessageLogFilter.mPositiveNames.end(), find_name) != mMessageLogFilter.mPositiveNames.end())
				have_positive = true;
		}
		if(!mMessageLogFilter.mNegativeNames.empty())
		{
			if(std::find(mMessageLogFilter.mNegativeNames.begin(), mMessageLogFilter.mNegativeNames.end(), find_name) != mMessageLogFilter.mNegativeNames.end())
			{
				delete item;
			return;
			}
		}
		//we don't have any negative filters and we have a positive match
		else if(have_positive)
			break;
	}

	//we had a positive filter but no positive matches
	if(!mMessageLogFilter.mPositiveNames.empty() && !have_positive)
	{
		delete item;
		return;
	}

	mFloaterMessageLogItems.push_back(item); // moved from beginning...

	if(item->mType == LLEasyMessageLogEntry::HTTP_REQUEST)
	{
		mIncompleteHTTPConvos.insert(HTTPConvoMap::value_type(item->mRequestID, item));
	}

	std::string net_name("\?\?\?");
	BOOL outgoing = item->isOutgoing();
	switch(item->mType)
	{
	case LLEasyMessageLogEntry::TEMPLATE:
		{
			LLHost find_host = outgoing ? item->mToHost : item->mFromHost;
			net_name = find_host.getIPandPort();
			std::list<LLNetListItem*>::iterator end = sNetListItems.end();
			for(std::list<LLNetListItem*>::iterator iter = sNetListItems.begin(); iter != end; ++iter)
			{
				if((*iter)->mCircuitData->getHost() == find_host)
				{
					net_name = (*iter)->mName;
					break;
				}
			}
		}
		break;
	case LLEasyMessageLogEntry::HTTP_REQUEST:
		{
			std::string url = get_base_url(item->mURL);
			std::list<LLNetListItem*>::iterator end = sNetListItems.end();
			for(std::list<LLNetListItem*>::iterator iter = sNetListItems.begin(); iter != end; ++iter)
			{
				LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromHandle((*iter)->mHandle); //TODO: Find a better way to do this.
				if(regionp && regionp->getCapURLNames(url).size())
				{
					net_name = (*iter)->mName;
					break;
				}
			}
		}
		break;
	default:
		break;
	}
	//add the message to the messagelog scroller
	LLSD element;
	element["id"] = item->mID;
	LLSD& sequence_column = element["columns"][0];
	sequence_column["column"] = "sequence";
	sequence_column["value"] = llformat("%u", item->mSequenceID);

	LLSD& type_column = element["columns"][1];
	type_column["column"] = "type";
	switch(item->mType)
	{
	case LLEasyMessageLogEntry::TEMPLATE:
		type_column["value"] = "UDP";
		break;
	case LLEasyMessageLogEntry::HTTP_REQUEST:
		type_column["value"] = "HTTP";
		break;
	default:
		type_column["value"] = "\?\?\?";
	}

	LLSD& direction_column = element["columns"][2];
	direction_column["column"] = "direction";
	if(item->mType == LLEasyMessageLogEntry::TEMPLATE)
		direction_column["value"] = outgoing ? "to" : "from";
	else if(item->mType == LLEasyMessageLogEntry::HTTP_REQUEST)
		direction_column["value"] = "both";

	LLSD& net_column = element["columns"][3];
	net_column["column"] = "net";
	net_column["value"] = net_name;

	LLSD& name_column = element["columns"][4];
	name_column["column"] = "name";
	name_column["value"] = item->getName();

	LLSD& summary_column = element["columns"][5];
	summary_column["column"] = "summary";
	summary_column["value"] = item->mSummary;
	LLScrollListCtrl* scrollp = getChild<LLScrollListCtrl>("message_log");

	S32 scroll_pos = scrollp->getScrollPos();
	scrollp->addElement(element, ADD_BOTTOM);

	if(scroll_pos > scrollp->getItemCount() - scrollp->getPageLines() - 4)
		scrollp->setScrollPos(scrollp->getItemCount());
}