public override void Write_Main_Viewer_Section(TextWriter Output, Custom_Tracer Tracer)
{
if (Tracer != null)
{
Tracer.Add_Trace("Restricted_ItemViewer.Write_Main_Viewer_Section", "");
}
// Check to see if this is IP restricted
string restriction_message = "This item is not restricted";
if (BriefItem.Behaviors.Dark_Flag)
{
restriction_message = "<table style=\"width:100%;\"> <tr style=\"text-align:center\"><td style=\"font-size:1.8em; font-weight: bold; color:white\"><br />This item is set to be DARK and resource files cannot be displayed<br /><br /></td></tr></table>";
}
else if (BriefItem.Behaviors.IP_Restriction_Membership > 0)
{
if (HttpContext.Current != null)
{
int user_mask = (int)HttpContext.Current.Session["IP_Range_Membership"];
int comparison = BriefItem.Behaviors.IP_Restriction_Membership & user_mask;
if (comparison == 0)
{
int restriction = BriefItem.Behaviors.IP_Restriction_Membership;
int restriction_counter = 1;
while (restriction % 2 != 1)
{
restriction = restriction >> 1;
restriction_counter++;
}
if (Engine_ApplicationCache_Gateway.IP_Restrictions[restriction_counter] != null)
restriction_message = Engine_ApplicationCache_Gateway.IP_Restrictions[restriction_counter].Item_Restricted_Statement;
else
restriction_message = "Restricted Item";
}
}
}
// Replace item URL in the restricted message
CurrentRequest.ViewerCode = string.Empty;
string msg = restriction_message.Replace("<%ITEMURL%>", UrlWriterHelper.Redirect_URL(CurrentRequest));
Output.WriteLine("<td style=\"text-align:left;\" id=\"sbkRes_MainArea\">" + msg + "</td>");
}