Using Telligent.Glow to create popup containing the search control

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

Top 10 Contributor
Male
Posts 2,364
Points 15,695
MVPs
Dave Posted: Mon, Aug 13 2007 7:04 AM

I've implemented the drop down navigation like CS.org and would like to add a drop down panel containing controls rather than links to one of my menu links. This would be so that when you hover over one of the horizontal menu item 'Search' it display the search control, is this possible with Telligent.Glow? I see there is a TWC:PopupPanel control, should I be looking at this?

Also, I wanted my menu which is inside #CommonNavigation to have a margin-top:8px so I added 

 #CommonNavigation .CommonContextMenuGroup
{
    margin-top: 8px;
}

but this doesn't seem to work, any ideas why? I can't put it directly into .CommonContextMenuGroup as this is used elsewhere where the top margin is not required.

  • | Post Points: 20
Top 10 Contributor
Posts 3,424
Points 65,565
CS Developers
Ben Tiedt replied on Tue, Aug 14 2007 12:09 AM

Dave:
I've implemented the drop down navigation like CS.org and would like to add a drop down panel containing controls rather than links to one of my menu links. This would be so that when you hover over one of the horizontal menu item 'Search' it display the search control, is this possible with Telligent.Glow? I see there is a TWC:PopupPanel control, should I be looking at this?

I'd suggest looking at the PopupPanel control (on which the PopupMenu is based)... this *should* be possible, but I haven't tried it.  I can look into it more if you'd like.

Dave:

Also, I wanted my menu which is inside #CommonNavigation to have a margin-top:8px so I added 

 #CommonNavigation .CommonContextMenuGroup
{
    margin-top: 8px;
}

but this doesn't seem to work, any ideas why?

I'd suggest using a seperate class name for the menu.  The menu is always rendered within the <body> tag -- so this style rule would not apply to it.

Ben Tiedt's Blog

  • | Post Points: 20
Top 10 Contributor
Male
Posts 2,364
Points 15,695
MVPs
Dave replied on Tue, Aug 14 2007 8:36 AM

Ben Tiedt:

I'd suggest looking at the PopupPanel control (on which the PopupMenu is based)... this *should* be possible, but I haven't tried it.  I can look into it more if you'd like.

Yes please if you have time. The InlineTagEditor does what I want actually, does that use the PopupPanel?

 

  • | Post Points: 35
Top 10 Contributor
Posts 3,424
Points 65,565
CS Developers
Ben Tiedt replied on Tue, Aug 14 2007 10:44 AM

Dave:
The InlineTagEditor does what I want actually, does that use the PopupPanel?

Yes, via the InlineEditorPanel Telligent.Glow control.  I'll have an example for you by this coming weekend.

Ben Tiedt's Blog

  • | Post Points: 5
Top 10 Contributor
Posts 3,424
Points 65,565
CS Developers
Ben Tiedt replied on Tue, Aug 14 2007 1:45 PM

Dave:
Yes please if you have time.

Unfortunately, the PopupPanel renders its contents outside of the <form> tag (which we should probably change).  However, you can perform a simple search using the following:

<a href="http://communityserver.org/forums/AddPost.aspx?ReplyToPostID=595722&Quote=False#" onclick="<%= SearchPanel.ClientID %>.ShowAtElement(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>

Ben Tiedt's Blog

  • | Post Points: 5
Top 10 Contributor
Posts 3,424
Points 65,565
CS Developers
Ben Tiedt replied on Tue, Aug 14 2007 1:49 PM

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 Tiedt's Blog

  • | Post Points: 35
Top 10 Contributor
Male
Posts 2,364
Points 15,695
MVPs
Dave replied on Tue, Aug 14 2007 2:26 PM

That's great Big Smile  I need to get it integrated into my NavigationList control so i'll spend a couple of hours figuring it out and come back if I get stuck.

  • | Post Points: 5
Top 10 Contributor
Male
Posts 2,364
Points 15,695
MVPs
Dave replied on Tue, Aug 14 2007 3:15 PM

Looking good so far.

Any chance of a CloseOnMouseOut property on the PopupPanel like there is on the PopupMenu? Also, there is a lot of whitespace in the NavigationControl, can that be removed?

I added a navigation_showPanel funtion to show the PopupPanel as it uses ShowAtElement instead of OpenAtElement

<script type="text/javascript">
// <![CDATA[
var navigation_popup = null;
function navigation_showPanel(panel, element) { panel.ShowAtElement(element); return false; }
function navigation_showPopup(popup, element) { if (popup && !popup.IsOpen()) { navigation_hidePopup(); popup.OpenAtElement(element); navigation_popup = popup; } }
function navigation_hidePopup() { if (navigation_popup) { navigation_popup.Close(); navigation_popup = null; } }
// ]]>
</script>

can this be reworked so it works like  navigation_showPopup, ie at the moment when I hover over items with PopupMenu's the PopupPanel remains.

  • | Post Points: 20
Top 10 Contributor
Male
Posts 2,364
Points 15,695
MVPs
Dave replied on Fri, Aug 17 2007 5:23 AM

Ah, it's Hide() instead of Close() for the PopupPanel. What's the the equivalent to popup.IsOpen() for the PopupPanel?

  • | Post Points: 20
Top 10 Contributor
Posts 3,424
Points 65,565
CS Developers
Ben Tiedt replied on Fri, Aug 17 2007 1:20 PM

Dave:
What's the the equivalent to popup.IsOpen() for the PopupPanel?

popupPanel.IsShown()

Ben Tiedt's Blog

  • | Post Points: 5
Top 10 Contributor
Posts 3,424
Points 65,565
CS Developers
Ben Tiedt replied on Fri, Aug 17 2007 1:26 PM

Dave:
Any chance of a CloseOnMouseOut property on the PopupPanel like there is on the PopupMenu?
 

CloseOnMouseOut is implemented using the OnPanelOverFunction and OnPanelOutFunction -- if you want it to always close when the mouse leaves the pop-up panel, you can set the OnPanelOutFunction to something like:

popupPanel.OnPanelOutFunction = new Function('popupPanel.Hide();');

Dave:
Also, there is a lot of whitespace in the NavigationControl, can that be removed?

Not sure what you're referring to... the <CSControl:NavigationList /> renders as a <ul> list by default.  You can update the styles as neccessary to decrease spacing.

Dave:
can this be reworked so it works like  navigation_showPopup

<script type="text/javascript">
// <![CDATA[
var navigation_popup = null;
var navigation_panel = null;
function navigation_showPanel(panel, element) { if (panel && !panel.IsShown()) { navigation_hidePopup(); panel.ShowAtElement(element); navigation_panel = panel; }
function navigation_showPopup(popup, element) { if (popup && !popup.IsOpen()) { navigation_hidePopup(); popup.OpenAtElement(element); navigation_popup = popup; } }
function navigation_hidePopup() { if (navigation_popup) { navigation_popup.Close(); navigation_popup = null; } if (navigation_panel) { navigation_panel.Hide(); navigation_panel = null; } }
// ]]>
</script>

Ben Tiedt's Blog

  • | Post Points: 20
Top 10 Contributor
Male
Posts 2,364
Points 15,695
MVPs
Dave replied on Fri, Aug 17 2007 4:57 PM

Thanks, the new functions work fine. I can't get the onpaneloutfunction to work though, is this correct?

Telligent.Glow.PopupPanel searchPanel = CSControlUtility.Instance().FindControl(this, "SearchPanel") as Telligent.Glow.PopupPanel;
        if (searchPanel != null)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "searchPanel", @"
                <script type=""text/javascript"">
                // <![CDATA[
                var menu = document.getElementById('searchPanel');
                if (menu)
                    menu.onmouseover = new Function('navigation_showPanel(" + searchPanel.ClientID + @", this);');
                var panel = document.getElementById('" + searchPanel.ClientID + @"');
                if (panel)
                    panel.OnPanelOutFunction = new Function('navigation_hidePopup();');
                // ]]>
                </" + "script>", false);
        }

 
Re whitespace, view the source of dev.uk-mkivs.net and you'll see alot of whitespace rendered within the <ul> tags
 

  • | Post Points: 20
Top 10 Contributor
Posts 3,424
Points 65,565
CS Developers
Ben Tiedt replied on Wed, Aug 22 2007 9:09 AM

Dave:
I can't get the onpaneloutfunction to work though, is this correct?

Change

var panel = document.getElementById('" + searchPanel.ClientID + @"');
if (panel)
  panel.OnPanelOutFunction = new Function('navigation_hidePopup();');

to

" + searchPanel.ClientID + @".OnPanelOutFunction = navigation_hidePopup;

Dave:
Re whitespace, view the source of dev.uk-mkivs.net and you'll see alot of whitespace rendered within the <ul> tags

Your common.css stylesheet defines a rule for #CommonNavigation ul li that is adding a 32px margin to the right of each LI -- is that the whitespace you want to remove?

Ben Tiedt's Blog

  • | Post Points: 20
Top 10 Contributor
Male
Posts 2,364
Points 15,695
MVPs
Dave replied on Thu, Aug 30 2007 2:59 PM

Ben Tiedt:

Dave:
I can't get the onpaneloutfunction to work though, is this correct?

Change

var panel = document.getElementById('" + searchPanel.ClientID + @"'Wink;
if (panel)
  panel.OnPanelOutFunction = new Function('navigation_hidePopup();'Wink;

to

" + searchPanel.ClientID + @".OnPanelOutFunction = navigation_hidePopup;

Just tried that and it doesn't seem to work 

  • | Post Points: 20
Top 10 Contributor
Posts 3,424
Points 65,565
CS Developers
Ben Tiedt replied on Thu, Aug 30 2007 3:20 PM

Dave:
Just tried that and it doesn't seem to work 

Could you post your script and markup related to this feature?  Then I can better see what's going on.

Ben Tiedt's Blog

  • | Post Points: 20
Page 1 of 2 (23 items) 1 2 Next > | RSS
Powered by Community Server (Commercial Edition), by Telligent Systems

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