Enhanced Search Box and other questions

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
12/30/2009 1:52:00 PM
Gravatar
Total Posts 72

Enhanced Search Box and other questions

Hi,

The search box used on this site has a drop down for the various areas of content. Is there an option to enable the dropdown in mojoPortal, or more specifically set the search context?

I would like to create wrap the search box up as a feature that can be used within any page and where the search context can be set.

While I am posting I have a few other questions.

1. How would you go about using a HTMLContent feature within layout.master. The slideshow features offer everything required for a nice banner on the master page and would give the user an easy way of adding new banners (using the feature editor).

2. Can the theme for the tabs used in the admin area (YUI?) be changed? Are there some alternative themes included with mojoPortal like they're with jQuery.

3. In a few areas of the site I am using some page level javascript to apply some UI behaviour (simple hover effects etc.). What's the best way of embedding these within a page. I am currently using another HTMLContent feature to add my scripts but wondered whether a better option would be to create a custom feature that uses the asp.net ClientScript object to register the scripts properly?

4. I've posted in another thread about how I would like to override the css classes of the content columns on a page (e.g. adjust the width of left, center and right columns). Rather than creating three new page settings (left column css class, center column css class etc.) I thought it would be useful to have just one setting that can be used to perform css overrides (thus supporting more than three columns if required). The idea would be that I could specify the div container id "leftcol" and then a list of classes to apply "span-12 colborder". So my question is really, since I will need to persist this setting back to the database, have you got a list (or point me in the right direction) of the classes I will need to update (presume there will be at least a business layer, data access and data access provider class that will need to be updated).

Thanks,


Ben

1/1/2010 1:46:43 PM
Gravatar
Total Posts 72

Re: Enhanced Search Box and other questions

I will answer a few questions myself (now I have read the documentation )

Regarding search feature - Set the following in user config:

<add key="DisableSearchFeatureFilters" value="false" />
<add key="SearchUseBackwardCompatibilityMode" value="false" />
<add key="EnableSearchResultsHighlighting" value="true" />
<add key="SearchIncludeModuleRoleFilters" value="true" />

Other questions:

1. http://www.mojoportal.com/same-content-on-all-pages.aspx - this can be used to display a content feature on the master page.

1/2/2010 5:14:53 AM
Gravatar
Total Posts 18439

Re: Enhanced Search Box and other questions

Hi Ben,

1. While it is possible in some cases to add content features right into the layout.master, it can be problem prone because most features really need to be connected directly to a specific page in order to enforce page level security. You can add a slide show directly in the layout.master as illustrated in andreasvicklund_02alt1 skin. It is also possible to develop whatever functionality you need in a UserControl and just add the UserControl into layout.master.

2. I am looking into doing away with the YUI tabs and switching to YUI tabs in the admin and edit pages. Mainly I want to make this change because there are more themese for the jquery and because I would like to just use all jquery and move away from using both jquery and YUI. However, I need to do a lot of testing first, when I attempted this change once before I ran into trouble with nested tabs in jquery and there may also be issues with using the wysiwyg editors inside jquery tabs whereas they work fine in the YUI tabs. I seem to recall there being issues with this in the jquery tabs when I tried it before.

3. Whatever gets the job done. You can definitely create a custom feature and register custom scripts from code. Or you could make a UserControl that registers your scripts and put it in layout.master. Inside the control you can have logic to decide whether to register the scripts based on url or whatever you like.

Hope it helps,

Joe

1/3/2010 10:49:52 AM
Gravatar
Total Posts 72

Re: Enhanced Search Box and other questions

Joe,

Thanks again for the reply.

I am pleased to say that I have come up with solutions for most of these now.

Regarding the search box, I created a new feature to allow users to add a search box to any page. They can choose to search all content or set the feature guid for the search scope (basically adds the "f" querystring on the redirection to searchresults.aspx).

One thing I couldn't work out on the standard Search Input control is that you are setting the search buttons PostBackUrl and have a click handler that does the redirection. However, when I tried something similar, the click event would never fire due to the PostBackUrl being set. I resolved by removing the PostBackUrl and only using the click event to do the redirect.

Since this is the first commercial site we have built using mojoPortal I hope to blog about the process we went through for skinning and customizing mojoPortal - which I have to say was a pleasant experience. I will post the links to the blog post and site once it goes live.

Thanks,

Ben

1/7/2010 5:44:52 AM
Gravatar
Total Posts 18439

Re: Enhanced Search Box and other questions

Hi Ben,

Look forward to seeing your site and blog post.

When using a PostbackUrl, of course the click event on the current page cannot fire because it doesn't post back to the current page, the postbackurl page receives the post instead.

Now the receiving page, in this case SearchResults.aspx has to know what to expect in the post in order to be able to handle it correctly. So in this case what it does is get a reference to the page that posted and it looks for the specific id of the search input from the master page of the posting page like this:

SearchInput previousPageSearchInput = (SearchInput)Page.PreviousPage.Master.FindControl("SearchInput1");

note that first it must check whether Page.PreviousPage is null or not, this is how it knows if it is receiving a cross page postback.

To make it work from a control that is not in the master page I would have to add an additional attempt to find the control in the PreviousPage itself instead of the master page of the previous page like this:

if (previousPageSearchInput == null) { previousPageSearchInput = (SearchInput)PreviousPage.FindControl("SearchInput1"); }

I just added this to my copy actually. However it still requires that your search textbox have the id "SearchInput1" in order to be able to find it.

Or actually it is looking for a control of type SearchInput not a TextBox so probably the way you did it with a redirect is more simple and reliable.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.