How to remove search engines from toolbar.
Step 1. Find the dropdown that has the search engines, like below
<pw:ToolbarDropDownList HorizontalAlign="Right" ID="m_SearchEngines" runat="server" TabIndex="6" />
Take a note of the ID, in this case “m_SearchEngines.” Then make the element not visible by adding Visible=”false” to the element.
Step 2. Find all instances of that ID in the toolbar scripts. Remove them, leaving valid code. For instance, you might find something like:
var newUrl = '<%= ResolveUrl("~/PortalSearchResults.aspx") %>?q=' + document.getElementById('<%=m_SearchQuery.ClientID %>').value + '&searchoptions=' + document.getElementById('<%=m_SearchEngines.ClientID %>').options[document.getElementById('<%=m_SearchEngines.ClientID %>').selectedIndex].value;
After removing all instances of m_SearchEngines, you would be left with
var newUrl = '<%= ResolveUrl("~/PortalSearchResults.aspx") %>?q=' + document.getElementById('<%=m_SearchQuery.ClientID %>').value;
Similarly, the following code
void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
try
{
SignOutAction.Text = "false";
if (PWSettings.CloseBrowserOnSignOut)
{
SignOutAction.Text = "true";
}
System.Collections.Generic.List<Passageways.Search.SearchItem> searchItems = new System.Collections.Generic.List<Passageways.Search.SearchItem>();
foreach (PWModule module in PWModule.Get())
{
foreach (SearchItem searchItem in module.SearchItems)
{
if (searchItem.Visible)
{
int index = searchItems.BinarySearch(searchItem, new Comparer()); if(index < 0)
{
index = ~index;
}
searchItems.Insert(index, searchItem);
ListItem engineOption = new ListItem();
engineOption.Text = searchItem.Title;
engineOption.Value = Server.UrlEncode(module.ID + "/" + searchItem.FileName);
engines.Items.Insert(index, engineOption);
}
}
}
ListItem allItem = new ListItem();
allItem.Text = "All Portal Resources";
allItem.Value = "all";
engines.Items.Insert(0, allItem);
}
catch (Exception exc)
{
PWLog.LogEvent("Error loading Custom Toolbar.", exc);
}
}
}
Would become
void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
try
{
SignOutAction.Text = "false";
if (PWSettings.CloseBrowserOnSignOut)
{
SignOutAction.Text = "true";
}
}
catch (Exception exc)
{
PWLog.LogEvent("Error loading Custom Toolbar.", exc);
}
}
}
Comments
0 comments
Please sign in to leave a comment.