SVGFETurbulenceElement::SVGFETurbulenceElement() : SVGElement(new PSVGFETurbulenceElement(this))
{
	AddXMLAttribute(NewXMLAttr(&m_baseFrequency, NULL, WSTR("baseFrequency")));
	AddXMLAttribute(NewXMLAttr(&m_numOctaves, NULL, WSTR("numOctaves")));
//		AddXMLAttribute(NewXMLAttr(&m_in1, L"", L"in1"));

	SetAllValues(this);	// ???
}
SVGFEPointLightElement::SVGFEPointLightElement(NamedNodeMap* attributes) : SVGElement(new PSVGFEPointLightElement(this), attributes)
{
	m_x = NULL;
	m_y = NULL;
	m_z = NULL;

	AddXMLAttribute(NewXMLAttr(&m_x, NULL, WSTR("x")));
	AddXMLAttribute(NewXMLAttr(&m_y, NULL, WSTR("y")));
	AddXMLAttribute(NewXMLAttr(&m_z, NULL, WSTR("z")));

	SetAllValues(this);	// ???
}
Пример #3
0
SVGTextPathElement::SVGTextPathElement(NamedNodeMap* attributes) : SVGTextContentElementImpl/*<SVGTextPathElement>*/(new PSVGTextPathElement(this), attributes)
{
	m_startOffset = NULL;

	AddXMLAttribute(NewXMLAttr(&m_startOffset, NULL, WSTR("startOffset")));

	SetAllValues(this);	// ???
}
SVGFESpotLightElement::SVGFESpotLightElement(NamedNodeMap* attributes) : SVGElement(NULL, attributes)
{
    ASSERT(0);

    m_x = NULL;
    m_y = NULL;
    m_z = NULL;
    m_pointsAtX = NULL;
    m_pointsAtY = NULL;
    m_pointsAtZ = NULL;
    m_specularExponent = NULL;
    m_limitingConeAngle = NULL;

    AddXMLAttribute(NewXMLAttr(&m_x, NULL, WSTR("x")));
    AddXMLAttribute(NewXMLAttr(&m_y, NULL, WSTR("y")));
    AddXMLAttribute(NewXMLAttr(&m_z, NULL, WSTR("z")));
    AddXMLAttribute(NewXMLAttr(&m_pointsAtX, NULL, WSTR("pointsAtX")));
    AddXMLAttribute(NewXMLAttr(&m_pointsAtY, NULL, WSTR("pointsAtY")));
    AddXMLAttribute(NewXMLAttr(&m_pointsAtZ, NULL, WSTR("pointsAtZ")));
    AddXMLAttribute(NewXMLAttr(&m_specularExponent, NULL, WSTR("specularExponent")));
    AddXMLAttribute(NewXMLAttr(&m_limitingConeAngle, NULL, WSTR("limitingConeAngle")));

    SetAllValues(this);	// ???
}
Пример #5
0
bool CPoll::MakePoll(const PollLink & pollLink)
{
	CTDVString sXML;
	InitialiseXMLBuilder(&sXML, NULL);

	// Open POLL tag
	if(!OpenXMLTag("POLL", true))
	{
		TDVASSERT(false, "CPoll::MakePoll() OpenXMLTag failed");
		return false;
	}

	// Add poll id
	if(!AddXMLIntAttribute("pollid", pollLink.GetPollID(), false))
	{
		TDVASSERT(false, "CPoll::MakePoll() AddXMLIntAttribute failed");
		return false;
	}

	// Add poll type
	if(!AddXMLIntAttribute("polltype", pollLink.GetPollType(), false))
	{
		TDVASSERT(false, "CPoll::MakePoll() AddXMLIntAttribute failed");
		return false;
	}

	//Poll limits 
	if ( m_nResponseMin >= 0 &&  !AddXMLIntAttribute("minresponse",m_nResponseMin,false) )
	{
		TDVASSERT(false, "CPoll::MakePoll() AddXMLIntAttribute failed");
		return false;
	}

	if ( m_nResponseMax >= 0 &&  !AddXMLIntAttribute("maxresponse",m_nResponseMax,false) )
	{
		TDVASSERT(false, "CPoll::MakePoll() AddXMLIntAttribute failed");
		return false;
	}

	if ( m_bAllowAnonymousRating == true &&  !AddXMLIntAttribute("anonymousrating", 1,false) )
	{
		TDVASSERT(false, "CPoll::MakePoll() AddXMLIntAttribute failed");
		return false;
	}

	// Add hidden attribute
	if(!AddXMLIntAttribute("hidden", pollLink.m_Hidden, true))
	{
		TDVASSERT(false, "CPoll::MakePoll() AddXMLIntAttribute failed");
		return false;
	}
	
	// Add poll results if we have any
	if(!pollLink.GetPollResults().empty())
	{
		// Open OPTION-LIST tag
		if(!OpenXMLTag("OPTION-LIST", false))
		{
			TDVASSERT(false, "CPoll::MakePoll() OpenXMLTag failed");
			return false;
		}

		// Add vote results //
		resultsMap::const_iterator itUserStatus = pollLink.GetPollResults().begin();
		//resultsMap::iterator itUserStatus = pollLink.m_PollProperties.m_Results.begin();

		while(itUserStatus != pollLink.GetPollResults().end())
		{
			// Open USERSTATUS tag
			if(!OpenXMLTag("USERSTATUS", true))
			{
				TDVASSERT(false, "CPoll::MakePoll() OpenXMLTag failed");
				return false;
			}

			// Add User Type attribute
			if(!AddXMLIntAttribute("type", itUserStatus->first, true))
			{
				TDVASSERT(false, "CPoll::MakePoll() AddXMLIntAttribute failed");
				return false;
			}

			// Add OPTION tags
			optionsMap::const_iterator itOptions = itUserStatus->second.begin();
			while(itOptions != itUserStatus->second.end())
			{
				// Open OPTION tag
				if(!OpenXMLTag("OPTION", true))
				{
					TDVASSERT(false, "CPoll::MakePoll() OpenXMLTag failed");
					return false; // cannot continue
				}
				
				// Add index attribute
				if(!AddXMLIntAttribute("index", itOptions->first, false))
				{
					TDVASSERT(false, "CPoll::MakePoll() AddXMLIntAttribute failed");
					return false;
				}

				const COptionAttributes& attr = itOptions->second;
				COptionAttributes::const_iterator attrNextIt = attr.begin();
				for (COptionAttributes::const_iterator attrIt = attr.begin();
					attrIt != attr.end(); attrIt++)
				{
					attrNextIt++;

					// Add attributes
					if(!AddXMLAttribute(attrIt->first.c_str(), 
						attrIt->second.c_str(), attrNextIt == attr.end()))
					{
						TDVASSERT(false, "CPoll::MakePoll() AddXMLIntAttribute");
						return false;
					}
				}

				// Close OPTION tag
				if(!CloseXMLTag("OPTION"))
				{
					TDVASSERT(false, "CPoll::MakePoll() CloseXMLTag failed");
					return false;
				}

				itOptions++;
			}

			// Close USERSTATUS tag
			if(!CloseXMLTag("USERSTATUS"))
			{
				TDVASSERT(false, "CPoll::MakePoll() CloseXMLTag failed");
				return false;
			}

			itUserStatus++;
		}

		// Close OPTION-LIST tag
		if(!CloseXMLTag("OPTION-LIST"))
		{
			TDVASSERT(false, "CPoll::MakePoll() CloseXMLTag failed");
			return false;
		}
	}


	// Add USER-VOTE tag which holds the currently logged on user's vote. If it is -1, it means
	// user has not voted. In that case, do not put tag. Skin will check for existence of tag to
	// determine whether user has voted or not

/*
	int nUserVote = -1;
	if(!LoadCurrentUserVote(nUserVote))
	{
		TDVASSERT(false, "CPoll::MakePoll() LoadCurrentUserVote failed");
		// Pretend that user has not voted
	}
	else 
*/

	// User Vote now comes as part of pollLink so theres no need to load it from
	// the database
	int nUserVote = pollLink.GetCurrentUserVote();
	if(nUserVote != -1)
	{
		// Open USER-VOTE tag
		if(!OpenXMLTag("USER-VOTE", true))
		{
			TDVASSERT(false, "CPoll::MakePoll() OpenXMLTag failed");
			return false;
		}
		
		// Add choice attribute
		if(!AddXMLIntAttribute("choice", nUserVote, true))
		{
			TDVASSERT(false, "CPoll::MakePoll() AddXMLIntAttribute failed");
			return false;
		}

		// Close USER-VOTE tag
		if(!CloseXMLTag("USER-VOTE"))
		{
			TDVASSERT(false, "CPoll::MakePoll() CloseXMLTag failed");
			return false;
		}
	}
	
	// Add statistics if we have any
	if(!m_Stats.empty())
	{
		// Open STATISTICS tag
		if(!OpenXMLTag("STATISTICS", true))
		{
			TDVASSERT(false, "CPoll::MakePoll() OpenXMLTag failed");
			return false;
		}

		// Add stats as attributes
		statisticsMap::const_iterator it = m_Stats.begin();
		while(it != m_Stats.end())
		{
			// Add attribute
			std::string sName = it->first;
			std::string sValue = it->second;

			if(!AddXMLAttribute(sName.c_str(), sValue.c_str(), ++it == m_Stats.end()))
			{
				TDVASSERT(false, "CPoll::MakePoll() AddXMLIntAttribute failed");
				return false;
			}
		}
	
		// Close STATISTICS tag
		if(!CloseXMLTag("STATISTICS"))
		{
			TDVASSERT(false, "CPoll::MakePoll() CloseXMLTag failed");
			return false;
		}
	}

	// Close POLL tag
	if(!CloseXMLTag("POLL"))
	{
		TDVASSERT(false, "CPoll::MakePoll() CloseXMLTag failed");
		return false;
	}
	
	// Create/Check XML
	if(!CreateFromXMLText(sXML, 0, true))
	{
		TDVASSERT(false, "CPoll::MakePoll() CreateFromXMLText failed");
		return false;
	}

	// Put error element if an error was passed on url
	if(m_InputContext.ParamExists("PollErrorCode"))
	{
		if(!AddErrorElement("POLL", (CPoll::ErrorCode)m_InputContext.GetParamInt("PollErrorCode")))
		{
			TDVASSERT(false, "CPoll::MakePoll() AddErrorElement failed");
			return false;
		}
	}

	return true;
}
Пример #6
0
/*********************************************************************************

	bool CTopic::Initialise 

		Author:		Martin R
        Created:	17/01/2005
        Inputs:		- CDBXMLBuilder& XML
        Outputs:	-
        Returns:	-
        Purpose:	- Create  Editors Pick XML 
					- Fetches Items tagged to user ( clippings )
					- Fetches items already tagged/ clipped to TextBox.
*********************************************************************************/
bool CEditorsPick::Initialise(int iTextBoxID)
{
	CTDVString sXML;
	CStoredProcedure SP;
	InitialiseXMLBuilder(&sXML,&SP);

	//CMultiStep Multi(m_InputContext,"TEXTANDIMAGE");
	//Multi.AddRequiredParam("title","");
	//Multi.AddRequiredParam("text","");

	// Process the inputs to make sure we've got all the info we require
	//Multi.ProcessInput();

	//CTDVString sMultiXML;
	//Multi.GetAsXML(sMultiXML);
	//sXML << sMultiXML;

	OpenXMLTag("LINKS");

	//keep a record of existing links.
	std::set< std::pair<int,CTDVString> > existinglinks;

	//Get existing Links for element
	if ( iTextBoxID )
	{
		m_InputContext.InitialiseStoredProcedureObject(&SP);
		SP.GetFrontPageElementLinks(iTextBoxID,true);

		//Create XML.
		CTDVString sXML;
		while( !SP.IsEOF() )
		{
			OpenXMLTag("LINK",true);

			CTDVString sType;
			SP.GetField("DestinationType",sType);
			AddXMLAttribute("Type",sType);
			
			AddXMLIntAttribute("SELECTED",1,true);
			AddDBXMLIntTag("LINKID","LinkID");
			AddDBXMLTag("Title","Title");
			AddDBXMLDateTag("DATELINKED","DateLinked",false);

			int iDestinationID = SP.GetIntField("DestinationID");
			AddXMLIntTag("DestinationID",iDestinationID);

			CloseXMLTag("LINK");
	
			existinglinks.insert( std::make_pair(iDestinationID,sType) );
			SP.MoveNext();
		}
	}

	//Get Clippings.
	if ( m_InputContext.GetCurrentUser() )
	{
		SP.GetUserLinks(m_InputContext.GetCurrentUser()->GetUserID(), "", true);

		while ( !SP.IsEOF() )
		{
			//Add Link if not already tagged to text box.
			int iDestinationID = SP.GetIntField("DESTINATIONID");
			CTDVString sType;
			SP.GetField("DestinationType", sType);
			std::set< std::pair<int,CTDVString> >::iterator iter_found = existinglinks.find(std::make_pair(iDestinationID,sType) );
			if ( iter_found == existinglinks.end() )
			{
				OpenXMLTag("LINK",true);
				AddXMLAttribute("Type",sType,true);

				AddDBXMLIntTag("LINKID","LinkID");
				AddXMLIntTag("DESTINATIONID",iDestinationID);
				AddDBXMLTag("Title","Title");
				AddDBXMLDateTag("DATELINKED","DateLinked");

				CloseXMLTag("LINK");
			}
			SP.MoveNext();
		}
	}

	CloseXMLTag("LINKS");
	
	return CreateFromXMLText(sXML);
}
Пример #7
0
/*********************************************************************************

	bool CModeratePosts::GetPosts()
	Author:		Martin Robb
	Created:	15/11/2005
	Inputs:		-
	Outputs:	-
	Returns:	true for success
	Purpose:	Retrieves ( and locks to the viewing user ) posts for moderation.
				Only posts for sites where the viewer is a superuser/moderator/referee/Host are fetched.
				XML is also filtered depending on users permissions eg usernames are not visible to moderators.
*********************************************************************************/
bool CModeratePosts::GetPosts( int iUserID, bool bAlerts, bool bReferrals, bool bLockedItems, bool bHeldItems, int iModClassId, int iPostId, int iShow, bool bFastMod )
{
	bool bSuperUser  = m_InputContext.GetCurrentUser() && m_InputContext.GetCurrentUser()->GetIsSuperuser();

	//Allow duplicate complaints only where a postId filter has been given.
	bool bDuplicateComplaints = bAlerts && iPostId > 0;

	//Get Posts for Moderation.
	CStoredProcedure SP;
	m_InputContext.InitialiseStoredProcedureObject(&SP);
	SP.GetModerationPosts( iUserID, bSuperUser, bAlerts, bReferrals, bHeldItems, bLockedItems, iModClassId, iPostId, bDuplicateComplaints, iShow, bFastMod );

	CTDVString		sXML;
	InitialiseXMLBuilder(&sXML,&SP);

	OpenXMLTag("POSTMODERATION", true );

	if ( bAlerts )
		AddXMLIntAttribute("ALERTS",1, false);
	
	if ( bReferrals )
		AddXMLIntAttribute("REFERRALS",1, false);

	if ( bLockedItems )
		AddXMLIntAttribute("LOCKEDITEMS",1, false);

	if ( bFastMod )
		AddXMLIntAttribute("FASTMOD", 1, false);

	AddXMLIntAttribute("COUNT", SP.IsEOF() ? 0 : SP.GetIntField("count"), true );

	while (!SP.IsEOF())
	{	
		OpenXMLTag("POST",true);
		AddDBXMLIntAttribute("EntryID","POSTID");
		AddDBXMLIntAttribute("ModID","MODERATIONID");

		AddDBXMLIntAttribute("ThreadId");
		AddDBXMLIntAttribute("ForumId","FORUMID");
		AddDBXMLIntAttribute("ISPREMODPOSTING","ISPREMODPOSTING",false);

		if (!(SP.IsNULL("CommentForumUrl")))
		{
			//GenerateCommentForumPostUrl
			CTDVString sCommentForumUrl;
			SP.GetField("CommentForumUrl",sCommentForumUrl);

			int iEntryID = SP.GetIntField("Entryid");
			int iCommentForumPostIndex = SP.GetIntField("PostIndex");
			
			if (iCommentForumPostIndex >= 0)
			{
				int iCommentForumDefaultShow = m_InputContext.GetDefaultShow(SP.GetIntField("siteid")); 
				int iDnaFrom = (iCommentForumPostIndex / iCommentForumDefaultShow) * iCommentForumDefaultShow; 
				int iDnaTo = iDnaFrom + iCommentForumDefaultShow - 1; 
				sCommentForumUrl << "?dnafrom=" << iDnaFrom << "&dnato=" << iDnaTo << "#P" << iEntryID; 
			}
			AddXMLAttribute("COMMENTFORUMURL", sCommentForumUrl, false);
		}

		AddDBXMLIntAttribute("Parent","INREPLYTO",false,true);

		AddDBXMLIntTag("modclassId");
		AddDBXMLIntTag("ThreadModerationStatus","MODERATION-STATUS");

		int iSiteId = SP.GetIntField("siteid");
		AddXMLIntTag("siteid",iSiteId);


		if ( !SP.IsNULL("TopicTitle") )
			AddDBXMLTag("TopicTitle");
		
		AddDBXMLTag("SUBJECT");

		if (SP.GetIntField("PostStyle") != 1)
		{
			CTDVString sText;
			SP.GetField("TEXT", sText);
			CTDVString sRawText(sText);
			CXMLObject::DoPlainTextTranslations(&sText);
			AddXMLTag("TEXT", sText);
			CXMLObject::EscapeEverything(&sRawText);
			AddXMLTag("RAWTEXT", sRawText);
		}
		else 
		{
			AddDBXMLTag("TEXT",NULL, true, false);
		}

		
		//Details of locking moderator.
		OpenXMLTag("LOCKED");
		AddDBXMLDateTag("DATELOCKED");
		OpenXMLTag("USER");
		AddDBXMLIntTag("LOCKEDBY","USERID");
		AddDBXMLTag("LOCKEDNAME","USERNAME",false);
		AddDBXMLTag("LOCKEDFIRSTNAMES", "FIRSTNAMES",false);
		AddDBXMLTag("LOCKEDLASTNAME","LASTNAME",false);
		CloseXMLTag("USER");
		CloseXMLTag("LOCKED");

        // Add Notes
        CTDVString sNotes;
        SP.GetField("Notes",sNotes);
        EscapeAllXML(&sNotes);
	    AddXMLTag("NOTES",sNotes);

		int iComplainantID = 0;
		CTDVString sComplainantName;
		CTDVString sComplainantFirstNames;
		CTDVString sComplainantLastName;
		CTDVString sComplaintText;
		int iComplainantIDViaEmail = 0;
		CTDVDateTime dDateSubmitted;
		int iComplainantUserStatus= 0;
		CTDVDateTime dComplainantUserStatusDate;
		int iComplainantUserStatusDuration = 0;
		int iComplaintCount = 0;
		if ( bAlerts )
		{
			iComplainantID = SP.GetIntField("ComplainantId");
			SP.GetField("ComplainantName",sComplainantName);
			SP.GetField("ComplainantFirstNames",sComplainantFirstNames);
			SP.GetField("ComplainantLastName", sComplainantLastName);
			iComplainantIDViaEmail = SP.GetIntField("ComplainantIDViaEmail");
			dDateSubmitted = SP.GetDateField("DateQueued");
			SP.GetField("ComplaintText",sComplaintText);

			iComplainantUserStatus = SP.GetIntField("ComplainantPrefStatus");
			if ( !SP.IsNULL("ComplainantPrefStatusChangedDate") )
            {
			    dComplainantUserStatusDate = SP.GetDateField("ComplainantPrefStatusChangedDate");
            }
			iComplainantUserStatusDuration = SP.GetIntField("ComplainantPrefStatusDuration");
			iComplaintCount = SP.GetIntField("complaintcount");
		}

		int iReferrerID;
		CTDVString sReferrerName;
		CTDVString sReferrerFirstNames;
		CTDVString sReferrerLastName;
		int iReferrerStatus;
		CTDVDateTime dDateReferred;
		if ( bReferrals )
		{
			iReferrerID = SP.GetIntField("ReferrerId");
			SP.GetField("ReferrerName",sReferrerName);
			SP.GetField("ReferrerFirstNames",sReferrerFirstNames);
			SP.GetField("ReferrerLastName", sReferrerLastName);
			iReferrerStatus = SP.GetIntField("ReferrerStatus");
			dDateReferred = SP.GetDateField("DateReferred");
		}

		//Usernames are only visible by Editors / Superusers and Hosts.
		bool bIsSiteEditor = SP.GetIntField("IsEditor") == 1;
		bool bIsReferee = SP.GetIntField("IsReferee") == 1;
		bool bIsHost = SP.GetIntField("IsHost") == 1;
		bool bIncludeAuthorXML = bIsSiteEditor || bIsReferee || bIsHost || bSuperUser;
		if ( bIncludeAuthorXML )
		{
			//User details of post editor.
			OpenXMLTag("USER");
			int iAuthorID = SP.GetIntField("userid");
			AddXMLIntTag("USERID",iAuthorID);
			AddDBXMLTag("username","USERNAME",false);
			AddDBXMLTag("firstnames","FIRSTNAMES",false);
			AddDBXMLTag("lastname","LASTNAME",false);
			
			//User Moderation Status
			if ( !SP.IsNULL("PrefStatus") )
			{
				OpenXMLTag("STATUS", true);
				AddDBXMLIntAttribute("PrefStatus", "StatusID", false, false);
				AddDBXMLIntAttribute("PrefStatusDuration", "Duration", false, true);
				AddDBXMLDateTag("PrefStatusChangedDate","StatusChangedDate", false);
				CloseXMLTag("STATUS");	
			}

			//Add Author User Groups 
			CTDVString sUserGroupsXML;
			m_InputContext.GetUserGroups(sUserGroupsXML,iAuthorID, iSiteId );
			sXML += sUserGroupsXML;
		}
		

		//Get Member Tags.
		std::set<CTDVString> usermembertags;
		std::set<CTDVString> complainantmembertags;
		int iModID = SP.GetIntField("ModID");
		while ( !SP.IsEOF() && (SP.GetIntField("ModID") == iModID) )
		{
			if ( !SP.IsNULL("UserMemberTag") ) 
			{
				CTDVString sUserMemberTag;
				SP.GetField("UserMemberTag",sUserMemberTag);
				if ( usermembertags.find(sUserMemberTag) == usermembertags.end() )
					usermembertags.insert(sUserMemberTag);
			}

			if ( !SP.IsNULL("ComplainantMemberTag") ) 
			{
				CTDVString sComplainantMemberTag;
				SP.GetField("ComplainantMemberTag",sComplainantMemberTag);
				if ( complainantmembertags.find(sComplainantMemberTag) == complainantmembertags.end() )
					complainantmembertags.insert(sComplainantMemberTag);
			}
			SP.MoveNext();
		}

		if ( !usermembertags.empty() )
		{
			OpenXMLTag("USERMEMBERTAGS");
			for ( std::set<CTDVString>::iterator iter = usermembertags.begin(); iter != usermembertags.end(); ++iter )
				AddXMLTag("USERMEMBERTAG",*iter);
			CloseXMLTag("USERMEMBERTAGS");
		}

		if ( bIncludeAuthorXML ) 
			CloseXMLTag("USER");

		//Create the XML from the gathered data.
		if ( bAlerts )
		{
			OpenXMLTag("ALERT");

			//Username only shown for editors/superusers/hosts
			OpenXMLTag("USER");
			AddXMLIntTag("USERID",iComplainantID);
			AddXMLTag("USERNAME",sComplainantName);
			AddXMLTag("FIRSTNAMES", sComplainantFirstNames);
			AddXMLTag("LASTNAME", sComplainantLastName);
			AddXMLIntTag("COMPLAINANTIDVIAEMAIL", iComplainantIDViaEmail); 
			
			//User Moderation Status
			if ( !SP.IsNULL("PrefStatus") )
			{
				OpenXMLTag("STATUS", true);
				AddXMLIntAttribute("STATUSID", iComplainantUserStatus, false);
				AddXMLIntAttribute("DURATION", iComplainantUserStatusDuration, true);
				AddXMLDateTag("STATUSCHANGEDDATE", dComplainantUserStatusDate, false);
				CloseXMLTag("STATUS");	
			}

			//Add the member tags.
			if ( !complainantmembertags.empty() ) 
			{
				OpenXMLTag("USERMEMBERTAGS");
				for ( std::set<CTDVString>::iterator iter = complainantmembertags.begin(); iter != complainantmembertags.end(); ++iter )
					AddXMLTag("USERMEMBERTAG",*iter);
				CloseXMLTag("USERMEMBERTAGS");
			}

			//Add Complainant User Groups 
			CTDVString sUserGroupsXML;
			m_InputContext.GetUserGroups(sUserGroupsXML,iComplainantID, iSiteId );
			sXML += sUserGroupsXML;
			

			CloseXMLTag("USER");

			CXMLObject::DoPlainTextTranslations(&sComplaintText);
			AddXMLTag("TEXT",sComplaintText);
			AddXMLDateTag("DATEQUEUED",dDateSubmitted);
			AddXMLIntTag("ALERTCOUNT", iComplaintCount);
			CloseXMLTag("ALERT");
		}


		if ( bReferrals )
		{
			OpenXMLTag("REFERRED");

			//Only referrees / editors / superusers can see referred items - stored procedure checks permissions.
			OpenXMLTag("USER");
			AddXMLIntTag("USERID",iReferrerID);
			AddXMLTag("USERNAME",sReferrerName);
			AddXMLTag("FIRSTNAMES", sReferrerFirstNames);
			AddXMLTag("LASTNAME", sReferrerLastName);
			AddXMLIntTag("STATUS",iReferrerStatus);
			CloseXMLTag("USER");
			AddXMLDateTag("DATEREFERRED",dDateReferred);
			CloseXMLTag("REFERRED");
		}

		CloseXMLTag("POST");
	}

	CloseXMLTag("POSTMODERATION");
	return CreateFromXMLText(sXML);
}