Ejemplo n.º 1
0
		public void ForumInfo_Load(object o, System.EventArgs e)
		{
			if (!CurrentForumCheck)
				return;

			PanelThreadDescTypeNone.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.None);
			PanelThreadDescTypeEvent.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Event);
			PanelThreadDescTypeVenue.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Venue);
			PanelThreadDescTypePlace.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Place);
			PanelThreadDescTypeCountry.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Country);
			PanelThreadDescTypeArticle.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Article);
			PanelThreadDescTypeBrand.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Brand);
			PanelThreadDescTypeGroup.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Group);
			PanelThreadDescRelatedPanel.Visible = false;
			PanelThreadDescGroupBrandPanel.Visible = false;
			PanelThreadDescBrandPanel.Visible = false;
			FavouriteGroupPanel.Visible = (ThreadParentType.Equals(Model.Entities.ObjectType.Group) && CurrentGroupUsr != null && CurrentGroupUsr.IsMember);

			SetPageTitle("General discussions");

			if (ThreadParentType.Equals(Model.Entities.ObjectType.None))
			{
				ThreadDescWorldwideHomeCountryLink.InnerText = ThreadDescWorldwideHomeCountryLink.InnerText.Replace("???", Country.Current.FriendlyName);
				ThreadDescWorldwideHomeCountryLink.HRef = Country.Current.UrlDiscussion();
			}
			if (ThreadParentType.Equals(Model.Entities.ObjectType.Event))
			{
				Event ev = new Event(ObjectK);
				ThreadDescEventEventLink.InnerText = ev.Name;
				ThreadDescEventEventLink.HRef = ev.Url();

				ThreadDescEventVenueLink.InnerText = ev.Venue.Name;
				ThreadDescEventVenueLink.HRef = ev.Venue.Url();

				ThreadDescEventPlaceLink.InnerText = ev.Venue.Place.Name;
				ThreadDescEventPlaceLink.HRef = ev.Venue.Place.Url();

				ThreadDescEventDateLabel.Text = ev.FriendlyDate(false);

				PanelThreadDescRelatedPanel.Visible = ev.Brands.Count > 0;
				string brandsHtml = "";
				for (int i = 0; i < ev.Brands.Count; i++)
				{
					brandsHtml += (i == 0 ? "" : (i == (ev.Brands.Count - 1) ? " or " : ", ")) + "the <b><a href=\"" + ev.Brands[i].UrlDiscussion() + "\">" + ev.Brands[i].Name + " forum</a></b>";
				}
				PanelThreadDescRelatedPh.Controls.Add(new LiteralControl(brandsHtml));

				SetPageTitle(ev.Name + " discussions");


			}
			if (ThreadParentType.Equals(Model.Entities.ObjectType.Venue))
			{
				Venue v = new Venue(ObjectK);

				ThreadDescVenueVenueLink.InnerText = v.Name;
				ThreadDescVenueVenueLink.HRef = v.Url();

				ThreadDescVenuePlaceLink.InnerText = v.Place.Name;
				ThreadDescVenuePlaceLink.HRef = v.Place.Url();
				SetPageTitle(v.Name + " discussions");
			}
			if (ThreadParentType.Equals(Model.Entities.ObjectType.Place))
			{
				Place t = new Place(ObjectK);

				ThreadDescPlacePlaceLink.InnerText = t.Name;
				ThreadDescPlacePlaceLink.HRef = t.Url();
				SetPageTitle(t.Name + " discussions");
			}
			if (ThreadParentType.Equals(Model.Entities.ObjectType.Country))
			{
				Country c = new Country(ObjectK);

				ThreadDescCountryLabel.Text = c.FriendlyName;
				ThreadDescCountryLink.HRef = c.Url();
				SetPageTitle(c.FriendlyName + " discussions");
			}
			if (ThreadParentType.Equals(Model.Entities.ObjectType.Article))
			{
				Article a = new Article(ObjectK);
				ThreadDescArticleArticleLink.InnerText = a.Title;
				ThreadDescArticleArticleLink.HRef = a.Url();
				SetPageTitle(a.Title + " discussions");
			}
			if (ThreadParentType.Equals(Model.Entities.ObjectType.Brand))
			{
				Brand b = new Brand(ObjectK);
				ThreadDescBrandBrandLink.InnerText = b.Name;
				ThreadDescBrandBrandLink.HRef = b.Url();
				SetPageTitle(b.Name + " discussions");
				if (b.Group.TotalComments > 0)
				{
					PanelThreadDescBrandPanel.Visible = true;
					PanelThreadDescBrandGroupChatAnchor.InnerText = b.Group.FriendlyName + " group chat";
					PanelThreadDescBrandGroupChatAnchor.HRef = b.Group.UrlDiscussion();
					PanelThreadDescBrandGroupChatCommentsLabel.Text = b.Group.TotalComments.ToString("#,##0") + " comment" + (b.Group.TotalComments == 1 ? "" : "s");
				}
			}
			if (ThreadParentType.Equals(Model.Entities.ObjectType.Group))
			{
				ThreadDescGroupGroupLink.InnerText = CurrentGroup.FriendlyName + " group";
				ThreadDescGroupGroupLink.HRef = CurrentGroup.Url();
				SetPageTitle(CurrentGroup.FriendlyName + " discussions");
				if (CurrentGroup.BrandK > 0)
				{
					PanelThreadDescGroupBrandPanel.Visible = true;
					PanelThreadDescGroupBrandAnchor.HRef = CurrentGroup.Brand.UrlDiscussion();
					PanelThreadDescGroupBrandAnchor.InnerText = CurrentGroup.Brand.Name + " public chat";
					PanelThreadDescGroupBrandCommentsLabel.Text = CurrentGroup.Brand.TotalComments.ToString("#,##0") + " comment" + (CurrentGroup.Brand.TotalComments == 1 ? "" : "s");
				}
			}
		}
Ejemplo n.º 2
0
		public string dsiTagReplacement(Match m)
		{
			string tagName = "dsi";
			try
			{
				//string[] arrParts = m.Groups[1].Value.Split[" "];
				//Dictionary<string, string> parts = new Dictionary<string, string>();
				SgmlReader sgml = new SgmlReader();
				string inStr = m.Groups[0].Value;
				if (inStr.StartsWith("<dsi:link"))
					inStr += "</dsi:link>";
				sgml.InputStream = new StringReader(inStr);
				sgml.DocType = "HTML";
				sgml.Read();

				tagName = sgml.Name;
				string uniqueId = Guid.NewGuid().ToString("N");

				#region Parse attributes
				Dictionary<string, string> attributes = new Dictionary<string, string>();
				while (sgml.MoveToNextAttribute())
				{
					attributes.Add(sgml.Name.ToLower(), sgml.Value);
				}
				#endregion

				string typeAtt = attributes.ContainsKey("type") ? attributes["type"] : null;
				string refAtt = attributes.ContainsKey("ref") ? attributes["ref"] : null;

				#region Parse styles
				Dictionary<string, string> style = new Dictionary<string, string>();
				if (attributes.ContainsKey("style"))
				{
					foreach (string s in attributes["style"].Split(';'))
					{
						try
						{
							if (s.Contains(":"))
								style[s.Split(':')[0].Trim()] = s.Split(':')[1].Trim();
						}
						catch
						{
						}
					}
				}
				#endregion

				#region Parse class
				List<string> classes = new List<string>();
				if (attributes.ContainsKey("class"))
				{
					foreach (string s in attributes["class"].Split(' '))
					{
						try
						{
							classes.Add(s);
						}
						catch
						{
						}
					}
				}
				#endregion

				if (tagName == "dsi:video")
				{
					#region dsi:video
					/*
					<dsi:video 
						type = [dsi | flv | youtube | google | metacafe | myspace | break | collegehumor | redtube | ebaumsworld | dailymotion] 
						ref = [dsi-photo-k | site-ref]
						src = [flv-url]
						width = [width] (optional)
						height = [height] (optional)
						nsfw = [true | false] (optional)
						/> 
					*/
					bool nsfw = attributes.ContainsKey("nsfw") ? bool.Parse(attributes["nsfw"].ToLower()) : false;
					string draw = attributes.ContainsKey("draw") ? attributes["draw"].ToLower() : "auto";
					if (typeAtt == "youtube")
					{
						#region youtube
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 425;
						int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 355;

						//<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/8VtWo8tFdPQ&rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/8VtWo8tFdPQ&rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>
						return GetFlash(uniqueId, height, width, nsfw, draw, "http://www.youtube.com/v/" + refAtt + "&rel=1");
						#endregion
					}
					else if (typeAtt == "metacafe")
					{
						#region metacafe
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 400;
						int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 345;

						//<embed src="http://www.metacafe.com/fplayer/1029494/how_to_make_fire_balls.swf" width="400" height="345" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"> </embed><br><font size = 1><a href="http://www.metacafe.com/watch/1029494/how_to_make_fire_balls/">How To Make Fire Balls</a> - <a href="http://www.metacafe.com/">The funniest videos clips are here</a></font>
						return GetFlash(uniqueId, height, width, nsfw, draw, "http://www.metacafe.com/fplayer/" + refAtt + ".swf");
						#endregion
					}
					else if (typeAtt == "google")
					{
						#region google
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 400;
						int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 326;

						//<embed style="width:400px; height:326px;" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=-7477616603879486362&hl=en-GB" flashvars=""> </embed>
						return GetFlash(uniqueId, height, width, nsfw, draw, "http://video.google.com/googleplayer.swf?docId=" + refAtt + "&hl=en-GB");
						#endregion
					}
					else if (typeAtt == "flv")
					{
						#region flv
						string flvUrl = attributes.ContainsKey("src") ? attributes["src"] : null;
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 450;
						int height = attributes.ContainsKey("height") ? (int.Parse(attributes["height"]) + 20) : 357;

						return GetFlash(uniqueId, height, width, nsfw, draw, "/misc/flvplayer.swf", "file", flvUrl, "autoStart", "0");
						#endregion
					}
					else if (typeAtt == "dsi")
					{
						#region dsi
						try
						{
							Photo p = new Photo(int.Parse(refAtt));
							if (p.MediaType != Photo.MediaTypes.Video)
							{
								return "[Invalid ref " + refAtt + " - this is not a video]";
							}
							else
							{
								if (p.ContentDisabled)
								{
									return "[Invalid ref " + refAtt + " - video disabled]";
								}
								else
								{
									if (p.Status == Photo.StatusEnum.Enabled)
									{
										//int width = p.VideoMedWidth;
										//int height = p.VideoMedHeight + 20;

										int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : p.VideoMedWidth;
										int height = attributes.ContainsKey("height") ? (int.Parse(attributes["height"]) + 20) : (p.VideoMedHeight + 20);

										return GetFlash(uniqueId, height, width, nsfw, draw, "/misc/flvplayer.swf", "file", p.VideoMedPath, "autoStart", "0", "jpg", p.WebPath);
									}
									else if (p.Status == Photo.StatusEnum.Moderate)
									{
										return "[Invalid ref " + refAtt + " - video waiting for moderation]";
									}
									else if (p.Status == Photo.StatusEnum.Processing)
									{
										return "[Invalid ref " + refAtt + " - video still processing]";
									}
								}
							}
						}
						catch
						{
							return "[Invalid ref " + refAtt + " - video not found]";
						}
						return "[Invalid ref " + refAtt + " - error]";
						#endregion
					}
					else if (typeAtt == "collegehumor")
					{
						#region collegehumor
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 450;
						int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 337;

						//<object type="application/x-shockwave-flash" data="http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=1754304&fullscreen=1" width="480" height="360" ><param name="allowfullscreen" value="true" /><param name="movie" quality="best" value="http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=1754304&fullscreen=1" /></object>
						return GetFlash(uniqueId, height, width, nsfw, draw, "http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=" + refAtt + "&fullscreen=1");
						#endregion
					}
					else if (typeAtt == "myspace")
					{
						#region myspace
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 430;
						int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 346;

						//<embed src="http://lads.myspace.com/videos/vplayer.swf" flashvars="m=25330587&v=2&type=video" type="application/x-shockwave-flash" width="430" height="346"></embed>
						return GetFlash(uniqueId, height, width, nsfw, draw, "http://lads.myspace.com/videos/vplayer.swf", "m", refAtt, "v", "2", "type", "video");
						#endregion
					}
					else if (typeAtt == "break")
					{
						#region break
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 464;
						int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 392;

						//<object width="464" height="392"><param name="movie" value="http://embed.break.com/NDMyNjg3"></param><embed src="http://embed.break.com/NDMyNjg3" type="application/x-shockwave-flash" width="464" height="392"></embed></object>
						return GetFlash(uniqueId, height, width, nsfw, draw, "http://embed.break.com/" + refAtt);
						#endregion
					}
					else if (typeAtt == "redtube")
					{
						#region redtube
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 434;
						int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 344;

						//<object height="344" width="434"><param name="movie" value="http://embed.redtube.com/player/"><param name="FlashVars" value="id=2394&style=redtube"><embed src="http://embed.redtube.com/player/?id=2394&style=redtube" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" height="344" width="434"></object>
						return GetFlash(uniqueId, height, width, true, draw, "http://embed.redtube.com/player/?id=" + refAtt + "&style=redtube", "id", refAtt, "style", "redtube");
						#endregion
					}
					else if (typeAtt == "ebaumsworld")
					{
						#region ebaumsworld
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 425;
						int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 345;

						//<embed src="http://www.ebaumsworld.com/mediaplayer.swf" flashvars="file=http://media.ebaumsworld.com/2008/01/trouble-leaving-parking-lot.flv&displayheight=321&image=http://media.ebaumsworld.com/2008/01/trouble-leaving-parking-lot.jpg" loop="false" menu="false" quality="high" bgcolor="#ffffff" width="425" height="345" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
						return GetFlash(uniqueId, height, width, nsfw, draw, "http://www.ebaumsworld.com/mediaplayer.swf", "file", "http://media.ebaumsworld.com/" + refAtt + ".flv", "displayheight", (height - 24).ToString(), "image", "http://media.ebaumsworld.com/" + refAtt + ".jpg");
						#endregion
					}
					else if (typeAtt == "dailymotion")
					{
						#region dailymotion
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 420;
						int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 331;

						//<div><object width="420" height="331"><param name="movie" value="http://www.dailymotion.com/swf/x3xmzx"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.dailymotion.com/swf/x3xmzx" type="application/x-shockwave-flash" width="420" height="331" allowFullScreen="true" allowScriptAccess="always"></embed></object><br /><b><a href="http://www.dailymotion.com/video/x3xmzx_time-attack-evo-crash-knockhill-200_auto">TIME ATTACK EVO CRASH KNOCKHILL 2007</a></b><br /><i>Uploaded by <a href="http://www.dailymotion.com/TIMEATTACKTV">TIMEATTACKTV</a></i></div>
						return GetFlash(uniqueId, height, width, nsfw, draw, "http://www.dailymotion.com/swf/" + refAtt);
						#endregion
					}
					else if (typeAtt == "veoh")
					{
						return "[Veoh videos disabled]";
						#region veoh
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 450;
						int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 365;

						//<embed src="http://www.veoh.com/videodetails2.swf?player=videodetailsembedded&type=v&permalinkId=v1644215kQ3H8PG2&id=anonymous" allowFullScreen="true" width="540" height="438" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed><br/><a href="http://www.veoh.com/">Online Videos by Veoh.com</a>
						return GetFlash(uniqueId, height, width, nsfw, draw, "http://www.veoh.com/videodetails2.swf?player=videodetailsembedded&type=v&permalinkId=" + refAtt + "&id=anonymous");
						#endregion
					}
					else
					{
						return "[Invalid type attribute]";
					}
					#endregion
				}
				else if (tagName == "dsi:audio")
				{
					#region dsi:audio
					/*
					<dsi:audio 
						type = [mp3]
						src = [mp3-url]
						nsfw = [true | false] (optional)
					/>
					*/
					if (typeAtt == "mp3")
					{
						#region mp3
						string mp3Url = attributes.ContainsKey("src") ? attributes["src"] : null;
						int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 290;
						int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 24;

						string audioPlayerSwfPath = Storage.Path(new Guid("7abb3119-f8ad-43ff-be01-764b2ae111fc"), "swf", Storage.Stores.Pix);

						return GetFlash(uniqueId, height, width, false, "load", audioPlayerSwfPath, "soundFile", mp3Url, "autoStart", "no") +
								@"<a href=""" + mp3Url + @"""><img src=""/gfx/download-button2.png"" width=""73"" height=""16"" border=""0"" /></a>";
						#endregion
					}
					else
					{
						return "[Invalid type attribute]";
					}
					#endregion
				}
				else if (tagName == "dsi:flash")
				{
					#region dsi:flash
					/*
					<dsi:flash 
						src = [swf-url]
						width = [width] 
						height = [height]
						nsfw = [true | false] (optional)
						play = [true | false] (optional)
						loop = [true | false] (optional)
						menu = [true | false] (optional)
						quality = [low | autolow | autohigh | medium | high | best] (optional)
						scale = [default | noorder | exactfit] (optional)
						align = [l | t | r | b] (optional)
						salign = [l | t | r | b | tl | tr | bl | br] (optional)
						wmode = [window | opaque | transparent] (optional)
						bgcolor = [colour] (optional)
						base = [base-url] (optional)
						flashvars = [flashvars] (optional)
						/>
					*/
					string swfUrl = attributes.ContainsKey("src") ? attributes["src"] : null;
					return getFlashAttributesFromSgml(uniqueId, swfUrl, attributes);
					#endregion
				}
				else if (tagName == "dsi:quote")
				{
					#region dsi:quote
					Usr u = null;
					try
					{
						u = new Usr(int.Parse(refAtt));
					}
					catch { }

					if (u != null)
					{
						StringBuilder sb = new StringBuilder();
						sb.Append("<div class=\"QuoteName\">");
						sb.Append(u.Link());
						sb.Append(" said:");
						sb.Append("</div>");
						sb.Append("<div class=\"QuoteBody\">");
						return sb.ToString();
					}
					else
					{
						return "<div class=\"QuoteBody\">";
					}
					#endregion
				}
				else if (tagName == "dsi:object" || tagName == "dsi:link")
				{
					#region dsi:object, dsi:link
					/*
					<dsi:object
						type = [usr | event | venue | place | group | brand | photo | misc]
						ref = [object-k]
						style = [
							content: {text* | icon | text-under-icon};   // for type=usr, event, venue, place, group, brand
							details: {none* | venue | place | country};  // for type=event, venue, place
							date: {false* | true};                       // for type=event
							snip: {number};                              // for type=event
							rollover: {true* | false}                    // for type=usr, photo
							photo: {icon* | thumb | web}                 // for type=photo
							link: {true* | false}
						]
					/>
					*/

					string app = attributes.ContainsKey("app") ? (attributes["app"] == "home" ? null : attributes["app"]) : null;
					string date = attributes.ContainsKey("date") ? attributes["date"].Replace('-', '/') : null;
					string jump = attributes.ContainsKey("jump") ? "#" + attributes["jump"] : "";
					string parStr = attributes.ContainsKey("par") ? attributes["par"] : null;
					#region Decode par array
					string[] par = null;
					if (parStr != null)
					{
						List<string> parList = new List<string>();
						foreach (string s in parStr.Split('&'))
						{
							if (s.Contains("="))
							{
								parList.Add(System.Web.HttpUtility.UrlDecode(s.Split('=')[0]));
								parList.Add(System.Web.HttpUtility.UrlDecode(s.Split('=')[1]));
							}
							else
							{
								parList.Add(System.Web.HttpUtility.UrlDecode(s));
								parList.Add("");
							}
						}
						par = parList.ToArray();
					}
					#endregion

					string styleContent = style.ContainsKey("content") ? style["content"] : "text";
					string styleDetails = style.ContainsKey("details") ? style["details"] : "none";
					bool styleDate = style.ContainsKey("date") ? bool.Parse(style["date"]) : false;
					int styleSnip = style.ContainsKey("snip") ? int.Parse(style["snip"]) : 0;
					bool styleRollover = style.ContainsKey("rollover") ? bool.Parse(style["rollover"]) : true;
					string stylePhoto = style.ContainsKey("photo") ? style["photo"] : "icon";
					bool styleLink = style.ContainsKey("link") ? bool.Parse(style["link"]) : true;

					string extraHtmlAttributes = "";
					string extraStyleAttribute = "";
					string extraStyleElements = "";
					string extraClassAttribute = "";
					string extraClassElements = "";
					foreach (string k in attributes.Keys)
					{
						if (k != "href" && k != "src" && k != "type" && k != "ref" && k != "style" && k != "app" && k != "date" && k != "par" && k != "class")
						{
							extraHtmlAttributes += " " + k + "=\"" + attributes[k] + "\"";
						}
					}

					foreach (string s in style.Keys)
					{
						if (s != "content" && s != "details" && s != "date" && s != "snip" && s != "rollover" && s != "photo" && s != "link")
						{
							extraStyleElements += s + ":" + style[s] + ";";
						}
					}
					if (extraStyleElements.Length > 0)
					{
						extraStyleAttribute = " style=\"" + extraStyleElements + "\"";
					}

					foreach (string s in classes)
					{
						extraClassElements += " " + s;
					}
					if (extraClassElements.Length > 0)
					{
						extraClassAttribute = " class=\"" + extraClassElements + "\"";
					}

					if (typeAtt == "usr")
					{
						#region Usr
						Usr u = new Usr(int.Parse(refAtt));
						string url = getObectPageUrl(u, app, date, par) + jump;

						if (tagName == "dsi:link")
							return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">";

						StringBuilder sb = new StringBuilder();

						string rolloverHtml = styleRollover ? ((styleContent == "icon" || styleContent == "text-under-icon") ? u.RolloverNoPic : u.Rollover) : "";

						if (styleContent == "icon" || styleContent == "text-under-icon")
						{
							#region Pic
							if (styleLink)
							{
								sb.Append("<a href=\"");
								sb.Append(url);
								sb.Append("\"");
								sb.Append(rolloverHtml);
								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(extraClassAttribute);
								sb.Append(">");
							}
							sb.Append("<img src=\"");
							sb.Append(u.AnyPicPath);
							sb.Append("\"");
							if (styleContent == "icon" && !styleLink)
							{
								//Just image with no link around the image... lets apply any extra html to the image tag.
								if (!attributes.ContainsKey("width"))
									sb.Append(" width=\"100\"");

								if (!attributes.ContainsKey("height"))
									sb.Append(" height=\"100\"");

								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(" class=\"BorderBlack All" + extraClassElements + "\"");
								sb.Append(" />");
							}
							else
								sb.Append(" width=\"100\" height=\"100\" class=\"BorderBlack All\" />");
							if (styleLink)
								sb.Append("</a>");
							if (styleContent == "text-under-icon")
								sb.Append("<br />");
							#endregion
						}
						if (styleContent == "text" || styleContent == "text-under-icon")
						{
							#region Nickname
							if (styleLink)
							{
								sb.Append("<a href=\"");
								sb.Append(url);
								sb.Append("\"");
								sb.Append(rolloverHtml);
								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(extraClassAttribute);
								sb.Append(">");
							}
							sb.Append(getObjectName(u.NickNameDisplay, app, styleSnip));
							if (styleLink)
								sb.Append("</a>");
							#endregion
						}
						return sb.ToString();
						#endregion
					}
					else if (typeAtt == "event")
					{
						#region Event
						Event e = new Event(int.Parse(refAtt));
						string url = getObectPageUrl(e, app, date, par) + jump;

						if (tagName == "dsi:link")
							return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">";

						StringBuilder sb = new StringBuilder();

						#region Container span
						if ((styleContent == "text" || styleContent == "text-under-icon") && !styleLink && (extraHtmlAttributes.Length > 0 || extraStyleAttribute.Length > 0 || extraClassAttribute.Length > 0) && (styleDate || styleDetails == "venue" || styleDetails == "place" || styleDetails == "country"))
						{
							sb.Append("<span");
							sb.Append(extraHtmlAttributes);
							sb.Append(extraStyleAttribute);
							sb.Append(extraClassAttribute);
							sb.Append(">");
						}
						#endregion

						if (styleContent == "icon" || styleContent == "text-under-icon")
						{
							#region Pic
							if (styleLink)
							{
								sb.Append("<a href=\"");
								sb.Append(url);
								sb.Append("\"");
								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(extraClassAttribute);
								sb.Append(">");
							}
							sb.Append("<img src=\"");
							sb.Append(e.AnyPicPath);
							sb.Append("\"");
							if (styleContent == "icon" && !styleLink)
							{
								//Just image with no link around the image... lets apply any extra html to the image tag.
								if (!attributes.ContainsKey("width"))
									sb.Append(" width=\"100\"");

								if (!attributes.ContainsKey("height"))
									sb.Append(" height=\"100\"");

								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(" class=\"BorderBlack All" + extraClassElements + "\"");
								sb.Append(" />");
							}
							else
								sb.Append(" width=\"100\" height=\"100\" class=\"BorderBlack All\" />");

							if (styleLink)
								sb.Append("</a>");

							if (styleContent == "text-under-icon")
								sb.Append("<br />");

							#endregion
						}
						if (styleContent == "text" || styleContent == "text-under-icon")
						{
							#region Event link
							if (styleLink)
							{
								sb.Append("<a href=\"");
								sb.Append(url);
								sb.Append("\"");
								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(extraClassAttribute);
								sb.Append(">");
							}

							sb.Append(getObjectName(e.Name, app, styleSnip));

							if (styleLink)
								sb.Append("</a>");
							#endregion

							#region Venue link
							if (styleDetails == "venue" || styleDetails == "place" || styleDetails == "country")
							{
								sb.Append(" @ ");
								if (styleLink)
								{
									sb.Append("<a href=\"");
									sb.Append(e.Venue.Url());
									sb.Append("\"");
									sb.Append(extraHtmlAttributes);
									sb.Append(extraStyleAttribute);
									sb.Append(extraClassAttribute);
									sb.Append(">");
								}
								sb.Append(Cambro.Misc.Utility.Snip(e.Venue.Name, styleSnip));
								if (styleLink)
									sb.Append("</a>");
							}
							#endregion

							#region Place link
							if (styleDetails == "place" || styleDetails == "country")
							{
								sb.Append(" in ");
								if (styleLink)
								{
									sb.Append("<a href=\"");
									sb.Append(e.Venue.Place.Url());
									sb.Append("\"");
									sb.Append(extraHtmlAttributes);
									sb.Append(extraStyleAttribute);
									sb.Append(extraClassAttribute);
									sb.Append(">");
								}
								if (styleDetails == "country")
								{
									sb.Append(Cambro.Misc.Utility.Snip(e.Venue.Place.Name, styleSnip));
								}
								else
								{
									sb.Append(Cambro.Misc.Utility.Snip(e.Venue.Place.NamePlain, styleSnip));
								}
								if (styleLink)
									sb.Append("</a>");

							}
							#endregion

							#region Date
							if (styleDate)
							{
								sb.Append(", ");
								sb.Append(e.FriendlyDate(false));
							}
							#endregion
						}

						#region End container span
						if ((styleContent == "text" || styleContent == "text-under-icon") && !styleLink && (extraHtmlAttributes.Length > 0 || extraStyleAttribute.Length > 0 || extraClassAttribute.Length > 0) && (styleDetails == "venue" || styleDetails == "place" || styleDetails == "country"))
						{
							sb.Append("</span>");
						}
						#endregion

						return sb.ToString();

						#endregion
					}
					else if (typeAtt == "venue")
					{
						#region Venue
						Venue v = new Venue(int.Parse(refAtt));
						string url = getObectPageUrl(v, app, date, par) + jump;

						if (tagName == "dsi:link")
							return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">";

						StringBuilder sb = new StringBuilder();

						#region Container span
						if ((styleContent == "text" || styleContent == "text-under-icon") && !styleLink && (extraHtmlAttributes.Length > 0 || extraStyleAttribute.Length > 0 || extraClassAttribute.Length > 0) && (styleDetails == "place" || styleDetails == "country"))
						{
							sb.Append("<span");
							sb.Append(extraHtmlAttributes);
							sb.Append(extraStyleAttribute);
							sb.Append(extraClassAttribute);
							sb.Append(">");
						}
						#endregion

						if (styleContent == "icon" || styleContent == "text-under-icon")
						{
							#region Pic
							if (styleLink)
							{
								sb.Append("<a href=\"");
								sb.Append(url);
								sb.Append("\"");
								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(extraClassAttribute);
								sb.Append(">");
							}
							sb.Append("<img src=\"");
							sb.Append(v.AnyPicPath);
							sb.Append("\"");
							if (styleContent == "icon" && !styleLink)
							{
								//Just image with no link around the image... lets apply any extra html to the image tag.
								if (!attributes.ContainsKey("width"))
									sb.Append(" width=\"100\"");

								if (!attributes.ContainsKey("height"))
									sb.Append(" height=\"100\"");

								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(" class=\"BorderBlack All" + extraClassElements + "\"");
								sb.Append(" />");
							}
							else
								sb.Append(" width=\"100\" height=\"100\" class=\"BorderBlack All\" />");
							if (styleLink)
								sb.Append("</a>");

							if (styleContent == "text-under-icon")
								sb.Append("<br />");
							#endregion
						}

						if (styleContent == "text" || styleContent == "text-under-icon")
						{
							#region Venue link
							if (styleLink)
							{
								sb.Append("<a href=\"");
								sb.Append(url);
								sb.Append("\"");
								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(extraClassAttribute);
								sb.Append(">");
							}

							sb.Append(getObjectName(v.Name, app, styleSnip));

							if (styleLink)
								sb.Append("</a>");
							#endregion

							#region Place link
							if (styleDetails == "place" || styleDetails == "country")
							{
								sb.Append(" in ");
								if (styleLink)
								{
									sb.Append("<a href=\"");
									sb.Append(v.Place.Url());
									sb.Append("\"");
									sb.Append(extraHtmlAttributes);
									sb.Append(extraStyleAttribute);
									sb.Append(extraClassAttribute);
									sb.Append(">");
								}
								if (styleDetails == "country")
								{
									sb.Append(Cambro.Misc.Utility.Snip(v.Place.Name, styleSnip));
								}
								else
								{
									sb.Append(Cambro.Misc.Utility.Snip(v.Place.NamePlain, styleSnip));
								}
								if (styleLink)
									sb.Append("</a>");
							}
							#endregion
						}

						#region End container span
						if ((styleContent == "text" || styleContent == "text-under-icon") && !styleLink && (extraHtmlAttributes.Length > 0 || extraStyleAttribute.Length > 0 || extraClassAttribute.Length > 0) && (styleDetails == "place" || styleDetails == "country"))
						{
							sb.Append("</span>");
						}
						#endregion

						return sb.ToString();

						#endregion
					}
					else if (typeAtt == "place")
					{
						#region Place
						Place p = new Place(int.Parse(refAtt));
						string url = getObectPageUrl(p, app, date, par) + jump;

						if (tagName == "dsi:link")
							return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">";

						StringBuilder sb = new StringBuilder();

						#region Container span
						if ((styleContent == "text" || styleContent == "text-under-icon") && !styleLink && (extraHtmlAttributes.Length > 0 || extraStyleAttribute.Length > 0 || extraClassAttribute.Length > 0))
						{
							sb.Append("<span");
							sb.Append(extraHtmlAttributes);
							sb.Append(extraStyleAttribute);
							sb.Append(extraClassAttribute);
							sb.Append(">");
						}
						#endregion

						if (styleContent == "icon" || styleContent == "text-under-icon")
						{
							#region Pic
							if (styleLink)
							{
								sb.Append("<a href=\"");
								sb.Append(url);
								sb.Append("\"");
								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(extraClassAttribute);
								sb.Append(">");
							}
							sb.Append("<img src=\"");
							sb.Append(p.AnyPicPath);
							sb.Append("\"");
							if (styleContent == "icon" && !styleLink)
							{
								//Just image with no link around the image... lets apply any extra html to the image tag.
								if (!attributes.ContainsKey("width"))
									sb.Append(" width=\"100\"");

								if (!attributes.ContainsKey("height"))
									sb.Append(" height=\"100\"");

								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								if (style.ContainsKey("border"))
								{
									sb.Append(extraClassAttribute);
								}
								else
								{
									sb.Append(" class=\"BorderBlack All" + extraClassElements + "\"");
								}
								
								sb.Append(" />");
							}
							else
								sb.Append(" width=\"100\" height=\"100\" class=\"BorderBlack All\" />");
							if (styleLink)
								sb.Append("</a>");
							if (styleContent == "text-under-icon")
								sb.Append("<br />");
							#endregion
						}

						if (styleContent == "text" || styleContent == "text-under-icon")
						{
							#region Place link
							if (styleLink)
							{
								sb.Append("<a href=\"");
								sb.Append(url);
								sb.Append("\"");
								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(extraClassAttribute);
								sb.Append(">");
							}
							if (styleDetails == "country")
							{
								sb.Append(getObjectName(p.Name, app, styleSnip));
							}
							else
							{
								sb.Append(getObjectName(p.NamePlain, app, styleSnip));
							}
							if (styleLink)
								sb.Append("</a>");
							#endregion
						}

						#region End container span
						if ((styleContent == "text" || styleContent == "text-under-icon") && !styleLink && (extraHtmlAttributes.Length > 0 || extraStyleAttribute.Length > 0 || extraClassAttribute.Length > 0))
						{
							sb.Append("</span>");
						}
						#endregion

						return sb.ToString();

						#endregion
					}
					else if (typeAtt == "group")
					{
						#region Group
						Group g = new Group(int.Parse(refAtt));
						string url = getObectPageUrl(g, app, date, par) + jump;

						if (tagName == "dsi:link")
							return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">";

						StringBuilder sb = new StringBuilder();

						#region Group link
						if (styleLink)
						{
							sb.Append("<a href=\"");
							sb.Append(url);
							sb.Append("\"");
							sb.Append(extraHtmlAttributes);
							sb.Append(extraStyleAttribute);
							sb.Append(extraClassAttribute);
							sb.Append(">");
						}
						sb.Append(getObjectName(g.FriendlyName, app, styleSnip));
						if (styleLink)
							sb.Append("</a>");
						#endregion

						return sb.ToString();

						#endregion
					}
					else if (typeAtt == "brand")
					{
						#region Brand
						Brand b = new Brand(int.Parse(refAtt));
						string url = getObectPageUrl(b, app, date, par) + jump;

						if (tagName == "dsi:link")
							return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">";

						StringBuilder sb = new StringBuilder();

						#region Brand link
						if (styleLink)
						{
							sb.Append("<a href=\"");
							sb.Append(url);
							sb.Append("\"");
							sb.Append(extraHtmlAttributes);
							sb.Append(extraStyleAttribute);
							sb.Append(extraClassAttribute);
							sb.Append(">");
						}
						sb.Append(getObjectName(b.FriendlyName, app, styleSnip));
						if (styleLink)
							sb.Append("</a>");
						#endregion

						return sb.ToString();

						#endregion
					}
					else if (typeAtt == "photo")
					{
						#region Photo
						Photo p = new Photo(int.Parse(refAtt));
						string url = getObectPageUrl(p, app, date, par) + jump;

						if (tagName == "dsi:link")
							return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">";

						StringBuilder sb = new StringBuilder();

						#region Link
						if (styleLink)
						{
							sb.Append("<a href=\"");
							sb.Append(url);
							sb.Append("\"");
							sb.Append(extraHtmlAttributes);
							sb.Append(extraStyleAttribute);
							sb.Append(extraClassAttribute);
							sb.Append(">");
						}
						#endregion

						if (app != null && app == "chat")
						{
							#region For chat app, just show the name of the parent...
							sb.Append(Cambro.Misc.Utility.Snip(((IName)p.ParentObject).Name, styleSnip) + " (chat)");
							#endregion
						}
						else
						{
							#region Image tag
							sb.Append("<img");

							#region Src attribute
							sb.Append(" src=\"");
							if (stylePhoto == "thumb")
								sb.Append(p.ThumbPath);
							else if (stylePhoto == "icon")
								sb.Append(p.IconPath);
							else if (stylePhoto == "web")
								sb.Append(p.WebPath);
							sb.Append("\"");
							#endregion

							#region Width attribute
							if (styleLink || !attributes.ContainsKey("width"))
							{
								sb.Append(" width=\"");
								if (stylePhoto == "thumb")
									sb.Append(p.ThumbWidth);
								else if (stylePhoto == "icon")
									sb.Append("100");
								else if (stylePhoto == "web")
									sb.Append(p.WebWidth);
								sb.Append("\"");
							}
							#endregion

							#region Height attribute
							if (styleLink || !attributes.ContainsKey("height"))
							{
								sb.Append(" height=\"");
								if (stylePhoto == "thumb")
									sb.Append(p.ThumbHeight);
								else if (stylePhoto == "icon")
									sb.Append("100");
								else if (stylePhoto == "web")
									sb.Append(p.WebHeight);
								sb.Append("\"");
							}
							#endregion

							#region Extra html attributes
							if (!styleLink)
							{
								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
							}
							#endregion

							#region Style attribute
							if (styleLink)
							{
								
								sb.Append(" class=\"BorderBlack All\"");
							}
							else if (style.ContainsKey("border"))
							{
								sb.Append(extraClassAttribute);
							}
							else
							{
								sb.Append(" class=\"BorderBlack All" + extraClassElements + "\"");
							}
							#endregion

							#region Rollover
							if (styleRollover && stylePhoto != "web")
							{
								sb.Append(" onmouseover=\"stm('<img src=" + p.WebPath + " width=" + p.WebWidth + " height=" + p.WebHeight + " class=Block />');\" onmouseout=\"htm();\"");
							}
							#endregion

							sb.Append(" />");
							#endregion
						}

						#region End link
						if (styleLink)
							sb.Append("</a>");
						#endregion

						return sb.ToString();

						#endregion
					}
					else if (typeAtt == "misc")
					{
						#region Misc
						Misc mi = new Misc(int.Parse(refAtt));

						if (tagName == "dsi:link")
							return "<a href=\"" + mi.Url() + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">";

						if (mi.Extention.ToLower() == "jpg" || mi.Extention.ToLower() == "jpeg" || mi.Extention.ToLower() == "gif" || mi.Extention.ToLower() == "png")
						{
							StringBuilder sb = new StringBuilder();

							#region Width and height
							int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : mi.Width;
							int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : mi.Height;
							#endregion

							#region Image tag
							sb.Append("<img src=\"");
							sb.Append(mi.Url());
							sb.Append("\" width=\"");
							sb.Append(width);
							sb.Append("\" height=\"");
							sb.Append(height);
							sb.Append("\" border=\"0\"");
							sb.Append(extraHtmlAttributes);
							sb.Append(extraStyleAttribute);
							sb.Append(extraClassAttribute);
							sb.Append(" />");
							#endregion

							return sb.ToString();

						}
						else if (mi.Extention.ToLower() == "swf")
						{
							#region Swf
							return getFlashAttributesFromSgml(uniqueId, mi.Url(), attributes);
							#endregion
						}
						#endregion
					}
					else if (typeAtt == "article")
					{
						#region Article
						Article a = new Article(int.Parse(refAtt));
						string url = getObectPageUrl(a, app, date, par) + jump;

						if (tagName == "dsi:link")
							return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">";

						StringBuilder sb = new StringBuilder();

						#region Article link
						if (styleLink)
						{
							sb.Append("<a href=\"");
							sb.Append(url);
							sb.Append("\"");
							sb.Append(extraHtmlAttributes);
							sb.Append(extraStyleAttribute);
							sb.Append(extraClassAttribute);
							sb.Append(">");
						}
						sb.Append(getObjectName(a.FriendlyName, app, styleSnip));
						if (styleLink)
							sb.Append("</a>");
						#endregion

						return sb.ToString();

						#endregion
					}
					else if (typeAtt == "url") //if (attributes.ContainsKey("href"))
					{
						#region Url
						string url = attributes.ContainsKey("href") ? attributes["href"] : "";
						#region Get name
						string name = url;
						string path = url;
						string domain = url;
						string targetAttribute = "";
						try
						{
							if (UrlRegex.IsMatch(url))
							{
								Match urlMatch = UrlRegex.Match(url);
								if (urlMatch.Groups[3].Value.StartsWith("www."))
									name = urlMatch.Groups[3].Value.Substring(4);
								else
									name = urlMatch.Groups[3].Value;

								domain = urlMatch.Groups[3].Value;
								path = urlMatch.Groups[4].Value;
								if (!domain.ToLower().EndsWith(".dontstayin.com") && !attributes.ContainsKey("target"))
									targetAttribute = " target=\"_blank\"";

							}
						}
						catch
						{ }
						#endregion

						if (tagName == "dsi:link")
							return "<a href=\"" + url + "\"" + targetAttribute + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">";

						StringBuilder sb = new StringBuilder();

						if (path.ToLower().EndsWith(".jpg") || path.ToLower().EndsWith(".jpeg") || path.ToLower().EndsWith(".gif") || path.ToLower().EndsWith(".png"))
						{
							#region Image tag
							sb.Append("<img");

							#region Src attribute
							sb.Append(" src=\"");
							sb.Append(url);
							sb.Append("\"");
							#endregion

							sb.Append(extraHtmlAttributes);

							#region Style attribute
							if (domain.EndsWith(".dontstayin.com") && !style.ContainsKey("border"))
							{
								sb.Append(" class=\"BorderBlack All" + extraClassElements + "\"");
							}
							else
							{
								sb.Append(extraClassAttribute);
							}
							#endregion

							sb.Append(extraStyleAttribute);

							sb.Append(" />");
							#endregion
						}
						else if (path.ToLower().EndsWith(".mp3") || path.ToLower().EndsWith(".wav"))
						{
							#region Audio
							int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 290;
							int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 24;
							string audioPlayerSwfPath = Storage.Path(new Guid("7abb3119-f8ad-43ff-be01-764b2ae111fc"), "swf", Storage.Stores.Pix);
							return GetFlash(uniqueId, height, width, false, "load", audioPlayerSwfPath, "soundFile", url, "autoStart", "no") +
								@"<a href=""" + url + @"""><img src=""/gfx/download-button2.png"" width=""73"" height=""16"" border=""0"" /></a>";
							#endregion
						}
						else if (path.ToLower().EndsWith(".swf"))
						{
							#region Swf
							return getFlashAttributesFromSgml(uniqueId, path, attributes);
							#endregion
						}
						else if (path.ToLower().EndsWith(".flv"))
						{
							#region Flv
							int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 450;
							int height = attributes.ContainsKey("height") ? (int.Parse(attributes["height"]) + 20) : 357;
							bool nsfw = attributes.ContainsKey("nsfw") ? bool.Parse(attributes["nsfw"].ToLower()) : false;
							string draw = attributes.ContainsKey("draw") ? attributes["draw"].ToLower() : "auto";
							return GetFlash(uniqueId, height, width, nsfw, draw, "/misc/flvplayer.swf", "file", url, "autoStart", "0");
							#endregion
						}
						else
						{
							#region Link
							if (styleLink)
							{
								sb.Append("<a href=\"");
								sb.Append(url);
								sb.Append("\"");
								sb.Append(targetAttribute);
								sb.Append(extraHtmlAttributes);
								sb.Append(extraStyleAttribute);
								sb.Append(extraClassAttribute);
								sb.Append(">");
							}
							#endregion
							#region Name
							sb.Append(name);
							#endregion
							#region End link
							if (styleLink)
								sb.Append("</a>");
							#endregion
						}

						return sb.ToString();

						#endregion
					}
					else if (typeAtt == "room")
					{
						#region Chat room
						Guid guid = refAtt.UnPackGuid();
						Chat.RoomSpec room = Chat.RoomSpec.FromGuid(guid);

						if (room == null)
							return "[Room not found]";
						
						StringBuilder sb = new StringBuilder();
						
						if (tagName == "dsi:link")
							room.LinkHtmlAppendJustStartOfAnchorTag(sb, "selected-onyellow", extraHtmlAttributes, extraStyleAttribute, extraClassAttribute);
						else
							room.LinkHtmlAppend(sb, "selected-onyellow", extraHtmlAttributes, extraStyleAttribute, extraClassAttribute);

						return sb.ToString();

						#endregion
					}
					#endregion
				}
				return "[Invalid tag " + tagName + "]";
			}
			catch (Exception ex)
			{
				if (Vars.DevEnv)
					throw ex;

				return "[Error in " + tagName + " tag]";
			}
		}
Ejemplo n.º 3
0
		public static void DailySendNewGalleryEmails()
		{
			DateTime StartDateTime = DateTime.Now;
			int UsrCount = 0;
			int FailCount = 0;
			try
			{
				Query q = new Query();
				if (Vars.DevEnv)
					q.TopRecords=100;
				q.TableElement = new TableElement(TablesEnum.Gallery);
				q.TableElement = new Join(
					q.TableElement,
					new TableElement(TablesEnum.UsrEventAttended),
					QueryJoinType.Inner,
					new And(
						new Q(Gallery.Columns.EventK, UsrEventAttended.Columns.EventK, true),
						new Q(UsrEventAttended.Columns.SendUpdate, true)
					)
				);
				q.TableElement = new Join(
					q.TableElement,
					new TableElement(new Column(UsrEventAttended.Columns.UsrK, Usr.Columns.K)),
					QueryJoinType.Inner,
					new And(
						new Q(UsrEventAttended.Columns.UsrK, new Column(UsrEventAttended.Columns.UsrK, Usr.Columns.K), true),
						new Q(new Column(UsrEventAttended.Columns.UsrK, Usr.Columns.IsSkeleton),false),
						new Q(new Column(UsrEventAttended.Columns.UsrK, Usr.Columns.IsEmailVerified),true)
					)
				);
				q.TableElement = new Join(
					q.TableElement,
					new TableElement(TablesEnum.Event),
					QueryJoinType.Inner,
					new Q(Gallery.Columns.EventK, Event.Columns.K, true)
					);
				q.TableElement = new Join(
					q.TableElement,
					new TableElement(TablesEnum.GalleryUsr),
					QueryJoinType.Left,
					new And(
						new Q(Gallery.Columns.K, GalleryUsr.Columns.GalleryK, true),
						new Q(UsrEventAttended.Columns.UsrK, GalleryUsr.Columns.UsrK, true)
					)
				);
				q.TableElement = new Join(
					q.TableElement,
					new TableElement(TablesEnum.Usr),
					QueryJoinType.Inner,
					new Q(Gallery.Columns.OwnerUsrK, Usr.Columns.K, true)
					);
				q.TableElement = new Join(
					q.TableElement,
					new TableElement(TablesEnum.Photo),
					QueryJoinType.Left,
					new Q(Gallery.Columns.MainPhotoK, Photo.Columns.K, true)
					);
				q.Columns = new ColumnSet(
						Gallery.Columns.K,
						Gallery.Columns.Name,
						Gallery.Columns.UrlFragment,
						Gallery.Columns.ArticleK,
						Gallery.Columns.MainPhotoK,
						Gallery.Columns.LivePhotos,
						Gallery.Columns.CreateDateTime, 
						Gallery.Columns.EventK, 
						Gallery.Columns.OwnerUsrK,
						Photo.Columns.K,
						Photo.Columns.Icon,
						Photo.Columns.ContentDisabled,
						Photo.Columns.Status,
						Usr.LinkColumns,
						UsrEventAttended.Columns.UsrK
					);
				int daysPast = -3;
				if (Vars.DevEnv)
					daysPast = -30;
				q.QueryCondition=new And(
					new Q(Gallery.Columns.LastLiveDateTime,QueryOperator.GreaterThan,DateTime.Now.AddDays(daysPast)),
					Gallery.ShowOnSiteQ,
					new Or(
						new Q(GalleryUsr.Columns.ViewPhotosLatest,QueryOperator.IsNull,null),
						new Q(Gallery.Columns.LivePhotos,QueryOperator.GreaterThan,GalleryUsr.Columns.ViewPhotosLatest,true)
					)
				);
				q.OrderBy=new OrderBy(
					new OrderBy(UsrEventAttended.Columns.UsrK),
					new OrderBy(Event.Columns.DateTime, OrderBy.OrderDirection.Descending),
					new OrderBy(Event.Columns.K),
					new OrderBy(Gallery.Columns.LivePhotos, OrderBy.OrderDirection.Descending),
					new OrderBy(Gallery.Columns.K)
				);
				GallerySet gs = new GallerySet(q);
				Usr CurrentUsr = null;
				Event CurrentEvent = null;
				Mailer CurrentMail = null;
				int RowCount = 0;
				int CurrentGalleryCount = 0;
				for (int count=0; count<gs.Count; count++)
				{
					try
					{
						Gallery CurrentGallery = gs[count];

						if (CurrentUsr==null || CurrentGallery.JoinedUsrEventAttend.UsrK!=CurrentUsr.K)
						{
							if (CurrentMail!=null)
							{
								Console.WriteLine(CurrentUsr.Email+" - "+CurrentGalleryCount.ToString()+", IsSkeleton="+CurrentUsr.IsSkeleton+", IsEmailVerified="+CurrentUsr.IsEmailVerified);
								CurrentGalleryCount=0;

								CurrentMail.Body+="</tr></table>";
								CurrentMail.Send();
							}

							CurrentEvent = null;
							CurrentUsr = new Usr(CurrentGallery.JoinedUsrEventAttend.UsrK);
							UsrCount++;
							
					
							CurrentMail = new Mailer();
							CurrentMail.Subject="New DontStayIn galleries "+DateTime.Today.ToString("ddddd dd MMMM yyyy");
							CurrentMail.UsrRecipient = CurrentUsr;
							CurrentMail.Body="<p>Here are some galleries you might like to check out:</p>";
							CurrentMail.Bulk=true;

						}
						if (CurrentEvent==null || CurrentGallery.EventK!=CurrentEvent.K)
						{
							if (CurrentEvent!=null)
							{
								CurrentMail.Body+="</tr></table>";
							}
							CurrentEvent = new Event(CurrentGallery.EventK);
							CurrentMail.Body+="<p style=\"margin:15px 0px 1px 0px;\"><center><a href=\"[LOGIN("+CurrentEvent.Url()+")]\" style=\"line-height:21px;font-size:18px;font-weight:bold;\">"+CurrentEvent.Name+"</a></center></p>";
							CurrentMail.Body+="<div style=\"margin:0px 0px 3px 0px;\"><center><small><a href=\"[LOGIN("+CurrentEvent.Venue.Url()+")]\">"+CurrentEvent.Venue.Name+"</a>, "+CurrentEvent.FriendlyDate(false)+", <a href=\"[LOGIN("+CurrentEvent.Url("ignore","")+")]\">click to ignore new galleries</a></small></center></div>";
							RowCount = 0;
							CurrentMail.Body+="<table cellspacing=\"0\" cellpadding=\"7\" width=\"100%\" style=\"margin:0px 0px 3px 0px;\"><tr>";
						}
						if (RowCount==3)
						{
							RowCount = 0;
							CurrentMail.Body+="</tr><tr>";
						}
						CurrentMail.Body += "<td align=\"center\" valign=\"top\" width=\"33%\"><a href=\"[LOGIN(" + CurrentGallery.Url() + ")]\"><img src=\"" + CurrentGallery.PicPathAbsolute + "\" width=\"100\" height=\"100\" class=\"BorderBlack All\" border=\"0\"><div style=\"padding:5px 0px 0px 0px;\">" + CurrentGallery.NameSafe + "</div></a><div style=\"padding:5px 0px 0px 0px;\"><small>" + CurrentGallery.LivePhotos.ToString("#,##0") + " photo" + (CurrentGallery.LivePhotos == 1 ? "" : "s") + ". Added by <a href=\"[LOGIN(" + CurrentGallery.Owner.Url() + ")]\">" + CurrentGallery.Owner.NickName + "</a></small></div></td>";
						RowCount++;
						CurrentGalleryCount++;
					}
					catch
					{
						FailCount++;
						CurrentUsr = null;
						CurrentEvent = null;
						CurrentMail = null;
					}
					gs.Kill(count);
				}
			}
			finally
			{
				string summary = "<p>Started: "+StartDateTime.ToLongTimeString()+"</p>";
				summary += "<p>Ending: "+DateTime.Now.ToLongTimeString()+"</p>";
				TimeSpan timeTaken = (DateTime.Now - StartDateTime);
				summary += "<p>Total time: "+timeTaken.TotalMinutes.ToString("0.##")+" min</p>";
				summary += "<p><b>Users with unseen galleries: "+UsrCount.ToString("#,##0")+"</b></p>";
				summary += "<p><b>Exceptions: "+FailCount.ToString("#,##0")+"</b></p>";

				Mailer smAdmin = new Mailer();
				smAdmin.TemplateType=Mailer.TemplateTypes.AdminNote;

				smAdmin.Body += "<h1>Summary</h1>";
				smAdmin.Body += summary;
			
				smAdmin.Subject="Gallery email sent "+DateTime.Now.ToString();
				smAdmin.To="*****@*****.**";
				smAdmin.Send();
			}
			
		}
Ejemplo n.º 4
0
		/// <summary>
		/// This draws event links for brand public chat
		/// </summary>
		void AppendEventLink(StringBuilder sb, bool first, Event e)
		{
			if (!first)
				sb.Append("<br>");
			sb.Append("<a href=\"");
			sb.Append(e.UrlDiscussion());
			sb.Append("\">");
			sb.Append(e.Name);
			sb.Append("</a> <small>@ ");
			sb.Append(e.Venue.Name);
			sb.Append(" in ");
			sb.Append(e.Venue.Place.Name);
			sb.Append(", ");
			sb.Append(e.FriendlyDate(false));
			sb.Append(" - ");
			sb.Append(e.TotalComments.ToString("#,##0"));
			sb.Append(" comment");
			if (e.TotalComments != 1)
				sb.Append("s");
			sb.Append("</small>");

		}