// static
void LLFloaterReporter::onClickSend(void *userdata)
{
	LLFloaterReporter *self = (LLFloaterReporter *)userdata;
	
	if (self->mPicking)
	{
		closePickTool(self);
	}

	if(self->validateReport())
	{
		// only show copyright alert for abuse reports
		if ( self->mReportType != BUG_REPORT )
		{
			if ( ! self->mCopyrightWarningSeen )
			{
				std::string details_lc = self->childGetText("details_edit");
				LLStringUtil::toLower( details_lc );
				std::string summary_lc = self->childGetText("summary_edit");
				LLStringUtil::toLower( summary_lc );
				if ( details_lc.find( "copyright" ) != std::string::npos ||
					summary_lc.find( "copyright" ) != std::string::npos )
				{
					gViewerWindow->alertXml("HelpReportAbuseContainsCopyright");
					self->mCopyrightWarningSeen = TRUE;
					return;
				};
			};
		};

		LLUploadDialog::modalUploadDialog("Uploading...\n\nReport");
		// *TODO don't upload image if checkbox isn't checked
		std::string url = gAgent.getRegion()->getCapability("SendUserReport");
		std::string sshot_url = gAgent.getRegion()->getCapability("SendUserReportWithScreenshot");
		if(!url.empty() || !sshot_url.empty())
		{
			self->sendReportViaCaps(url, sshot_url, self->gatherReport());
			self->close();
		}
		else
		{
			if(self->childGetValue("screen_check"))
			{
				self->childDisable("send_btn");
				self->childDisable("cancel_btn");
				// the callback from uploading the image calls sendReportViaLegacy()
				self->uploadImage();
			}
			else
			{
				self->sendReportViaLegacy(self->gatherReport());
				LLUploadDialog::modalUploadFinished();
				self->close();
			}
		}
	}
}
// static
void LLFloaterReporter::onClickSend(void *userdata)
{
	LLFloaterReporter *self = (LLFloaterReporter *)userdata;
	
	if (self->mPicking)
	{
		closePickTool(self);
	}

	if(self->validateReport())
	{
		// only show copyright alert for abuse reports
		if ( self->mReportType != BUG_REPORT )
		{
			const int IP_CONTENT_REMOVAL = 66;
			const int IP_PERMISSONS_EXPLOIT = 37;
			LLComboBox* combo = self->getChild<LLComboBox>( "category_combo");
			int category_value = combo->getSelectedValue().asInteger(); 

			if ( ! self->mCopyrightWarningSeen )
			{

				std::string details_lc = self->childGetText("details_edit");
				LLStringUtil::toLower( details_lc );
				std::string summary_lc = self->childGetText("summary_edit");
				LLStringUtil::toLower( summary_lc );
				if ( details_lc.find( "copyright" ) != std::string::npos ||
					summary_lc.find( "copyright" ) != std::string::npos  ||
					category_value == IP_CONTENT_REMOVAL ||
					category_value == IP_PERMISSONS_EXPLOIT)
				{
					LLNotifications::instance().add("HelpReportAbuseContainsCopyright");
					self->mCopyrightWarningSeen = TRUE;
					return;
				}
			}
			else if (category_value == IP_CONTENT_REMOVAL)
			{
				// IP_CONTENT_REMOVAL *always* shows the dialog - 
				// ergo you can never send that abuse report type.
				LLNotifications::instance().add("HelpReportAbuseContainsCopyright");
				return;
			}
		}

		LLUploadDialog::modalUploadDialog("Uploading...\n\nReport");
		// *TODO don't upload image if checkbox isn't checked
		std::string url = gAgent.getRegion()->getCapability("SendUserReport");
		std::string sshot_url = gAgent.getRegion()->getCapability("SendUserReportWithScreenshot");
		if(!url.empty() || !sshot_url.empty())
		{
			self->sendReportViaCaps(url, sshot_url, self->gatherReport());
			self->close();
		}
		else
		{
			if(self->childGetValue("screen_check"))
			{
				self->childDisable("send_btn");
				self->childDisable("cancel_btn");
				// the callback from uploading the image calls sendReportViaLegacy()
				self->uploadImage();
			}
			else
			{
				self->sendReportViaLegacy(self->gatherReport());
				LLUploadDialog::modalUploadFinished();
				self->close();
			}
		}
	}
}