Today I have making some changes to the SmallSearchInputBox delegate control in SharePoint 2007 to customise the planned Wiki Pages sites for the Cheshire Record Office.
This control is a ‘Delegate control’ – that is, you can create features to override the currently used control. What I wanted todo was not display the ‘Scope’ drop down list, the Advanced Search link, and to include prompt text (something like ‘Search:’).
A quick dig into the FEATURES folder in 12 Hive showed that the control had a number of properties. (default: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\OSearchBasicFeature and OSearchEnhancedFeature) is an xml file called SearchArea.xml.
By modifying the contents of this file you are able to change immediately and consistantly the appearance of the search box control within SharePoint.
There are several different properties which you can use to define this, and for the full list it is worth checking out the control definition at Microsoft. I am going to highlight a few of note though, which I think are most useful.
The property DropDownMode defines how the dropdown box should be displayed. ShowDD displays the dropdown with all scopes. HideDD_useDefaultScope displays no dropdown, however will search on the default scope for the page. For a list of all possible values there is a list located here.
For styling there is some great properties like DropDownWidth for defining the width of the dropdown, TextBoxWidth for the width of the search box and SearchBoxTableClass which defines the style class for the table that the search box will be wrapped in. The property TextBeforeDropDown is a property which allows you to add text which appears to the left of the dropdown, while TextBeforeTextBox displays the text to the left of the search box itself. ShowAdvancedSearch is a simple boolean to define whether or not the advanced search is available, while AdvancedSearchPageURL is the link that the Advanced Search link should point to.
Here is a sample implementation of a search control:
This control is then simply added into the master page by using a delegate control. Firstly, for the Record Office wiki site, I moved this control to the left column by amending the default.master page.
The ControlId in this control matches the Id of the control in the XML. You can add multiple control definitions in the XML, provided each has it’s own unique Id. The appropriate control can then be displayed within the masterpage by referencing the correct control.
Dont forget, once changes have applied, you may need to perform an iisreset before they take effect.