Well, if there's really a need for such behavior you could give this procedure a shot:
Note: This can only be done if you have the source code...
Project: AspDotNetStorefrontCommon
Class: Parser.cs
Method: BuildPageDynamicTokens
Add the highlighted part:
Code:
if (AppLogic.AppConfigBool("Polls.Enabled"))
{
String PollString = String.Empty;
int CategoryID = CommonLogic.QueryStringUSInt("categoryid");
int SectionID = CommonLogic.QueryStringUSInt("sectionid");
// polls are assigned to specific categories or sections via Admin > Misc > More > Manage Polls
// they are not displayed on non-category or non-section pages. These include product, topic, home, and checkout pages.
if (CategoryID != 0 || SectionID != 0)
{
PollString = AppLogic.GetPollBox(ThisCustomer.CustomerID, ThisCustomer.IsRegistered, SkinID, 0, CategoryID, SectionID, false, ThisCustomer.LocaleSetting);
}
else
{
PollString = AppLogic.GetPollBoxForAllPages(ThisCustomer.CustomerID, ThisCustomer.IsRegistered, SkinID, 0, false, ThisCustomer.LocaleSetting);
}
m_DynamicTokens.Add("(!POLL!)", PollString);
Project: AspDotNetStorefrontCommon
Class: AppLogic
Method (customized) :
Code:
public static String GetPollBoxForAllPages(int CustomerID, bool IsRegistered, int SkinID, int PollID, bool large, String LocaleSetting)
{
StringBuilder tmpS = new StringBuilder(10000);
tmpS.Append(
"<table width=\"100%\" cellpadding=\"2\" cellspacing=\"0\" border=\"0\" style=\"border-style: solid; border-width: 0px; border-color: #" +
AppConfig("HeaderBGColor") + "\">\n");
tmpS.Append("<tr><td align=\"left\" valign=\"top\">\n");
tmpS.Append("<img src=\"" +
LocateImageURL("skins/Skin_" + SkinID.ToString() + "/images/" +
CommonLogic.IIF(large, "poll.gif", "todayspoll.gif")) +
"\" border=\"0\" /><br />");
tmpS.Append("<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\" style=\"" +
AppConfig("BoxFrameStyle") + "\">\n");
tmpS.Append("<tr><td align=\"left\" valign=\"top\">\n");
if (PollID == 0)
{
// try to find an active poll this user hasn't voted on yet:
StringBuilder sql = new StringBuilder(1024);
sql.AppendFormat(
"select PollID from poll with (NOLOCK) where AnonsCanVote in ({1}) and published=1 and ExpiresOn>=getdate() and deleted=0 and pollid not in (select distinct pollid from pollvotingrecord with (NOLOCK) where customerid={0}) order by CreatedOn desc, DisplayOrder, Name",
CustomerID.ToString(), CommonLogic.IIF(IsRegistered, "0,1", "0"));
using (SqlConnection con = new SqlConnection(DB.GetDBConn()))
{
con.Open();
using (IDataReader rs = DB.GetRS(sql.ToString(), con))
{
if (rs.Read())
{
PollID = DB.RSFieldInt(rs, "PollID");
}
}
}
}
bool anyFound = false;
if (PollID != 0)
{
anyFound = true;
Poll p = new Poll(PollID, SkinID, LocaleSetting);
tmpS.Append(p.Display(CustomerID, !large));
p = null;
}
tmpS.Append("</td></tr>\n");
tmpS.Append("</table>\n");
tmpS.Append("</td></tr>\n");
tmpS.Append("</table>\n");
return CommonLogic.IIF(anyFound, tmpS.ToString(), String.Empty);
}
Comment out the following though:
Code:
static public String GetPollBox(int CustomerID, bool IsRegistered, int SkinID, int PollID, bool large, String LocaleSetting)
{
return GetPollBox(CustomerID, IsRegistered, SkinID, PollID, 0, 0, large, LocaleSetting);
}
See if this works for you...