Beispiel #1
0
String CommentableObjectViewer::getCreatePostLink(const EntityID &quoted_object)
{
	ordered_map<std::wstring, std::wstring> params;
	params.set(OS_URL_PARAM_ACTION, conversions::to_wstring<uint32>(actCreatePost));

	if(quoted_object.empty() == false)
		params.set(OS_URL_PARAM_QUOTE, quoted_object.toWide());

	return getPortal()->getViewObjectLink(getEntityID(), params);
}
Beispiel #2
0
String OMLQuote::quoteObject(const EntityID &id, const String &content)
{
	OS_ASSERT(id.empty() == false);
	return String::format(_S("[quote id=%S]%S[/quote]").c_str(), id.toUTF16().c_str(), content.c_str());
}
Beispiel #3
0
bool OsirisLink::isValid() const
{
	bool valid = true;
	
	if(getParam("type") == OS_OSIRISLINK_TYPE_PORTAL)
	{
		if(hasParam("portal") == false)
			return false;
		
		PortalID portal = static_cast<String>(getParam("portal")).to_ascii();
		if(portal.validate(false) == false)
			return false;

#ifdef OS_OSIRIS_VERSION_RAZOR
		if(hasParam("pov") == false)
			return false;

		PovID pov = static_cast<String>(getParam("pov")).to_ascii();
		if(pov.empty())
			return false;		
#endif
	}
	else if(getParam("type") == OS_OSIRISLINK_TYPE_ISIS)
	{
		if(hasParam("portal") == false)
			return false;
		
		PortalID portal = static_cast<String>(getParam("portal")).to_ascii();
		if(portal.validate(false) == false)
			return false;

#ifdef OS_OSIRIS_VERSION_RAZOR
		if(hasParam("pov") == false)
			return false;

		PovID pov = static_cast<String>(getParam("pov")).to_ascii();
		if(pov.empty())
			return false;		
#endif

		if(hasParam("name") == false)
			return false;		

		if(hasParam("url") == false)
			return false;

		// TODO: check if is a url.
	}
	else if(getParam("type") == OS_OSIRISLINK_TYPE_FILE)
	{
		if(hasParam("id") == false)
			return false;		

		EntityID id = static_cast<String>(getParam("id")).to_ascii();
		if(id.empty())
			return false;
				
		if(hasParam("portal"))
		{
			PortalID portal = static_cast<String>(getParam("portal")).to_ascii();
			if(portal.validate(false) == false)
				return false;
		}

#ifdef OS_OSIRIS_VERSION_RAZOR
		if(hasParam("pov"))
		{
			PovID pov = static_cast<String>(getParam("pov")).to_ascii();
			if(pov.empty())
				return false;		
		}
#endif	
	}
	else if(getParam("type") == OS_OSIRISLINK_TYPE_URL)
	{
		if(hasParam("url") == false)
			return false;		

		// TODO: check if is a url	
	}
	else if(getParam("type") == OS_OSIRISLINK_TYPE_RES)
	{
		if(hasParam("path") == false)
			return false;

		// We don't check if is a path.
	}
	else
		return false;

	return true;
}