using System.Collections;
using System.ComponentModel;
using System.Security.Permissions;
+using System.Web.Util;
namespace System.Web.UI.WebControls {
#endif
{
#if NET_2_0
- [MonoTODO]
protected internal override void OnInit (EventArgs e)
{
base.OnInit(e);
Hashtable ht = null;
if (ad_file != "" && ad_file != null) {
- ReadAdsFromFile (Page.MapPath (ad_file));
+ ReadAdsFromFile (
+#if NET_2_0
+ GetPhysicalFilePath (ad_file)
+#else
+ Page.MapPath (ad_file)
+#endif
+ );
ht = ChooseAd ();
}
}
#if NET_2_0
- [MonoTODO]
+ [MonoTODO ("Not implemented")]
protected internal override void PerformDataBinding (IEnumerable data)
{
throw new NotImplementedException ();
}
- [MonoTODO]
+ [MonoTODO ("Not implemented")]
protected override void PerformSelect ()
{
throw new NotImplementedException ();
AdCreatedEventArgs e = createdargs;
base.AddAttributesToRender (w);
-
- if (e.NavigateUrl != null)
- w.AddAttribute (HtmlTextWriterAttribute.Href, ResolveUrl (e.NavigateUrl));
- w.AddAttribute (HtmlTextWriterAttribute.Target, Target);
+
+ if (e.NavigateUrl != null && e.NavigateUrl.Length > 0)
+ w.AddAttribute (HtmlTextWriterAttribute.Href, ResolveAdUrl (e.NavigateUrl));
+ if (Target != null && Target.Length > 0)
+ w.AddAttribute (HtmlTextWriterAttribute.Target, Target);
w.RenderBeginTag (HtmlTextWriterTag.A);
- if (e.NavigateUrl != null)
- w.AddAttribute (HtmlTextWriterAttribute.Src, ResolveUrl (e.ImageUrl));
-
+ if (e.ImageUrl != null && e.ImageUrl.Length > 0)
+ w.AddAttribute (HtmlTextWriterAttribute.Src, ResolveAdUrl (e.ImageUrl));
+
w.AddAttribute (HtmlTextWriterAttribute.Alt, e.AlternateText == null ? "" : e.AlternateText);
- w.AddAttribute (HtmlTextWriterAttribute.Border, "0");
+ w.AddAttribute (HtmlTextWriterAttribute.Border, "0", false);
w.RenderBeginTag (HtmlTextWriterTag.Img);
w.RenderEndTag (); // img
w.RenderEndTag (); // a
}
+ string ResolveAdUrl (string url)
+ {
+ string path = url;
+
+ if (AdvertisementFile != null && AdvertisementFile.Length > 0 && path [0] != '/' && path [0] != '~')
+ try {
+ new Uri (path);
+ }
+ catch {
+ return UrlUtils.Combine (UrlUtils.GetDirectory (ResolveUrl (AdvertisementFile)), path);
+ }
+
+ return ResolveUrl (path);
+ }
+
//
// We take all the ads in the ad file and add up their
// impression weight. We then take a random number [0,
[DefaultValue ("AlternateText")]
[WebSysDescriptionAttribute ("")]
[WebCategoryAttribute ("Behavior")]
- [MonoTODO]
+ [MonoTODO ("Not implemented")]
public string AlternateTextField
{
get {
#if NET_2_0
[DefaultValue ("ImageUrl")]
- [MonoTODO]
+ [MonoTODO ("Not implemented")]
[WebSysDescriptionAttribute ("")]
[WebCategoryAttribute ("Behavior")]
public string ImageUrlField
#if NET_2_0
[DefaultValue ("NavigateUrl")]
- [MonoTODO]
+ [MonoTODO ("Not implemented")]
[WebSysDescriptionAttribute ("")]
[WebCategoryAttribute ("Behavior")]
public string NavigateUrlField
#if NET_2_0
/* all these are listed in corcompare */
- [MonoTODO]
public override string UniqueID
{
get {
}
}
- [MonoTODO]
protected override HtmlTextWriterTag TagKey
{
get {