// Author:
// Ben Maurer <bmaurer@novell.com>
//
-// (c) 2005 Novell
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
using System.Xml;
using System.Collections;
using System.ComponentModel;
+using System.Security.Permissions;
+using System.Web.Util;
namespace System.Web.UI.WebControls {
+
+ // CAS
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ // attributes
[DefaultEvent("AdCreated")]
[DefaultProperty("AdvertisementFile")]
[Designer("System.Web.UI.Design.WebControls.AdRotatorDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
#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
throw new NotImplementedException ();
}
}
-
- /* listed in corcompare */
- [MonoTODO]
- public override Page Page
- {
- get {
- return base.Page;
- }
- set {
- base.Page = value;
- }
- }
#endif
[Bindable(true)]
#if NET_2_0
/* all these are listed in corcompare */
- [MonoTODO]
public override string UniqueID
{
get {
}
}
- [MonoTODO]
protected override HtmlTextWriterTag TagKey
{
get {
return base.TagKey;
}
}
-
- [MonoTODO]
- protected override StateBag ViewState
- {
- get {
- return base.ViewState;
- }
- }
#endif
protected virtual void OnAdCreated (AdCreatedEventArgs e)