Using Telligent.Glow to create popup containing the search control

rated by 0 users
This post has 22 Replies | 1 Follower

Top 10 Contributor
Posts 2,352
Points 15,500
MVPs
Dave replied on Fri, Aug 31 2007 4:57 AM

You can see it in action here

 

<script type="text/javascript">
// <![CDATA[
var menu = document.getElementById('searchPanel'Wink;
if (menu)
menu.onmouseover = new Function('navigation_showPanel(ctl00_ctl00_bhcr_Navigation_SearchPanel, this);'Wink;
ctl00_ctl00_bhcr_Navigation_SearchPanel.OnPanelOutFunction = navigation_hidePopup;
// ]]>
</script>
<script type="text/javascript">
// <![CDATA[
window.ctl00_ctl00_bhcr_Navigation_SearchPanel = new Telligent_PopupPanel('ctl00_ctl00_bhcr_Navigation_SearchPanel','CommonContextMenuGroup CommonContextPanel','updown',101,null,null,false,' \r\n <input type="text" style="border:1px solid #000;margin-bottom:2px;padding:2px" id="popupSearchQuery" />\r\n <input type="button" style="border:1px solid #000" value="Go" onclick="window.location = \'/search/SearchResults.aspx?q=999999\'.replace(\'999999\', encodeURIComponent(document.getElementById(\'popupSearchQuery\'Wink.value)); return false;" />\r\n <input type="button" style="border:1px solid #000" value="Cancel" onclick="ctl00_ctl00_bhcr_Navigation_SearchPanel.Hide(); return false;" />\r\n'Wink;
// ]]>
</script

 

  • | Post Points: 20
Top 10 Contributor
Posts 3,399
Points 65,060
CS Developers
Ben Tiedt replied on Fri, Aug 31 2007 10:10 AM

Add OnMouseOutClientFunction="navigation_hidePopup" to the <TWC:PopupPanel /> control that contains the search form and remove the existing OnPanelOutFunction = navigation_hidePopup; line from your javascript.

The PopupPanel doesn't exist on the page when that script is executed (resulting in an error).  Specifying the function on the control will allow the control to assign the event handler itself when it initializes.

Ben Tiedt's Blog

  • | Post Points: 35
Top 10 Contributor
Posts 2,352
Points 15,500
MVPs
Top 10 Contributor
Posts 2,352
Points 15,500
MVPs
Dave replied on Sat, Sep 1 2007 5:41 PM

Ben Tiedt:

Add OnMouseOutClientFunction="navigation_hidePopup" to the <TWC:PopupPanel /> control that contains the search form and remove the existing OnPanelOutFunction = navigation_hidePopup; line from your javascript.

The PopupPanel doesn't exist on the page when that script is executed (resulting in an error).  Specifying the function on the control will allow the control to assign the event handler itself when it initializes.

 

Tried that an still no luck. 

  • | Post Points: 20
Top 10 Contributor
Posts 3,399
Points 65,060
CS Developers
Ben Tiedt replied on Tue, Sep 4 2007 11:00 AM

I'm sorry this is taking to long to figure out!  It turns out that the OnMouseOutClientFunction property isn't wired up property in the CS2007 version of Telligent.Glow (but is in CS2008).  Additionally, using this function results in greedy pop-up closing, so I've implemented logic similar to Telligent.Glow.PopupMenu's CloseOnMouseOut feature...

The following scripts implement support for opening (navigation_showPanel), closing (navigation_hidePopup) and automatically hiding the popup-panel...

 <script type="text/javascript">
// <![CDATA[
var navigation_panel = null;
var navigation_panelCloseTimeout = null;
function navigation_showPanel(panel, element) { if (panel && !panel.IsShown()) { navigation_hidePopup(); panel.ShowAtElement(element); navigation_panel = panel; navigation_panel.OnMouseOutFunction = navigation_hidePopupTimeout; navigation_panel.OnMouseOverFunction = navigation_hidePopupReset; navigation_panelCloseTimeout= null } }
function navigation_hidePopup() { if (navigation_panel) { navigation_panel.Hide(); navigation_panel = null; } }
function navigation_hidePopupTimeout() { if (navigation_panelCloseTimeout) { clearTimeout(navigation_panelCloseTimeout); } navigation_panelCloseTimeout = setTimeout(navigation_hidePopup, 249); }
function navigation_hidePopupReset() { if (navigation_panelCloseTimeout) { clearTimeout(navigation_panelCloseTimeout); } }
// ]]>
</script>

And the following is the required markup...

<a href="#" mce_href="#" onclick="navigation_showPanel(<%= CSControlUtility.Instance().FindControl(this, "SearchPanel" ).ClientID %>, this); return false;">Search</a>
<TWC:PopupPanel ID="SearchPanel" runat="server" HideOnDocumentClick="false" ZIndex="101" CssClass="CommonContextMenuGroup">
    <input type="text" id="popupSearchQuery" />
    <input type="button" value="Go" onclick="window.location = '<%= CommunityServer.Components.SiteUrls.Instance().SearchForText("q=999999" ) %>'.replace('999999', encodeURIComponent(document.getElementById('popupSearchQuery' ).value)); return false;" <input type="button" value="Cancel" onclick="<%# CommunityServer.Controls.CSControlUtility.Instance().FindControl(this, "SearchPanel" ).ClientID %>.Hide(); return false;" />
    <input type="button" value="Cancel" onclick="<%= CommunityServer.Controls.CSControlUtility.Instance().FindControl(this, "SearchPanel" ).ClientID %>.Hide(); return false;" />
</TWC:PopupPanel>

Using this script and markup in CS2007 will result in a link that, when clicked, opens a pop-up containing a simple search form.  If the mouse enters and then exists the pop-up, the pop-up will be automatically closed (similar to pop-up menus on cs.org).

Ben Tiedt's Blog

  • | Post Points: 20
Top 10 Contributor
Posts 2,352
Points 15,500
MVPs
Top 10 Contributor
Posts 2,352
Points 15,500
MVPs
Dave replied on Wed, Feb 27 2008 8:42 AM

Ben Tiedt:

Ben Tiedt:
Unfortunately, the PopupPanel renders its contents outside of the <form> tag (which we should probably change). 

I've logged this issue as #GLOW-2019.

Ben, was this fixed in CS2007.1?


  • | Post Points: 20
Top 10 Contributor
Posts 3,399
Points 65,060
CS Developers
Ben Tiedt replied on Wed, Feb 27 2008 8:53 AM

Dave:
Ben, was this fixed in CS2007.1?
 

This was a pretty significant change, so it was applied to CS2008 only.

Ben Tiedt's Blog

  • | Post Points: 5
Page 2 of 2 (23 items) < Previous 1 2 | RSS
Powered by Community Server (Commercial Edition), by Telligent Systems

Copyright© 2008 Telligent Systems Inc. All rights reserved
CommunityServer.com  •  Telligent.com