Coming Home widget stopped working

5 views
Skip to first unread message

Walter McGinnis

unread,
May 21, 2009, 8:47:25 PM5/21/09
to digi...@googlegroups.com
Hi,

I just noticed that the Coming Home widget stopped working on one of my client's sites. I thought this was likely my fault and some bit of code was being "sanitized" out of the widget's source, but I'm not so sure about that. Here's what comes back from DNZ in place of the widget:

"Sorry, something is preventing this widget from displaying.

The most likely reason for this is that something’s gone wrong when you copied and pasted the embed code from the DigitalNZ website. Please try going back to the DigitalNZ Widget Gallery and try copying and pasting the code again.

Still not working? Sometimes blogging software like Blogger and Wordpress won’t accept the embed code when you paste it into a post. In these cases, you can try pasting the code into a widget or gadget on your sidebar (choose the HTML/Javascript option).

At the moment, you can only have one DigitalNZ widget embedded on a page. If you have more than one they will all break. In these cases, you should choose the widget you want to use the most, and delete all the others. We’re working on this problem."

I grabbed the "pre-sanitized" code and checked it against viewing source on the page with the message and I couldn't see any difference. However, I couldn't absolutely find the DNZ provided code because it doesn't appear to be in the widget-gallery anymore.

Here's what I have for the code:

<div style="width: 200px;"> <div id="dnz_search"> <h3>Search Digital New Zealand: <span id="dnz_search_title">Content from WW1 and after</span></h3> <form action="http://search.digitalnz.org/cominghome/1/search" id="dnz_search_form" method="get"> <p id="dnz_fields"><input id="dnz_search_field" name="search_text" type="text" /><input id="dnz_search_submit" type="submit" value="Go" /></p> </form><img style="margin-top: 12px;" src="http://www.digitalnz.org/images/search/powered.gif" alt="Powered by Digital NZ" /></div> <script src="http://www.digitalnz.org/javascripts/search/dnz_search_widget.js" type="text/javascript"><!-- </script ( 'http://www.digitalnz.org/javascripts/search/dnz_search_widget.js" )> <script type="text/javascript"> function DNZOptions() { DNZSearch.serverRoot = 'http://www.digitalnz.org/'; DNZSearch.APIDomain = 'http://api.digitalnz.org/'; DNZSearch.hostedDomain = 'http://search.digitalnz.org/'; DNZSearch.searchSlug = 'cominghome'; DNZSearch.APIKey = '2288c852c37ff96859bfea3567af7446'; DNZSearch.stylesheet = 'http://www.digitalnz.org/stylesheets/search/coming_home.css'; DNZSearch.numberOfResults = 4; DNZSearch.logo = 'http://www.digitalnz.org/images/search/coming_home/logo.gif'; } // --></script> </div>

I stuck that in a plain HTML page and got the same behavior; the search box appears for a split second and then is updated with the error message.

It is the only instance of the widget on the page.

Any clues?

Cheers,
Walter

Joe Mahoney

unread,
May 21, 2009, 9:26:37 PM5/21/09
to digi...@googlegroups.com
Hey Walter

Could you please post (or send to me off list if you prefer) the URL
for the broken widget?

Cheers

Joe

--
Joe Mahoney
Senior Developer, 3months <http://3months.com/>
ph: (04) 498 3478 ext 17
mob:021 783 936
gtalk: j...@3months.com

Recent successes - www.DigitalNZ.org, www.NZonScreen.com and
www.CreativeNZ.govt.nz

Walter McGinnis

unread,
May 21, 2009, 10:00:16 PM5/21/09
to digi...@googlegroups.com

Joe Mahoney

unread,
May 21, 2009, 10:52:50 PM5/21/09
to digi...@googlegroups.com
Thanks Walter

This bit doesn't look right to me:


<script src="http://www.digitalnz.org/javascripts/search/dnz_search_widget.js" type="text/javascript"><!--
</script ( 'http://www.digitalnz.org/javascripts/search/dnz_search_widget.js" )> <script type="text/javascript"> function DNZOptions() { DNZSearch.serverRoot = 'http://www.digitalnz.org/'; DNZSearch.APIDomain = 'http://api.digitalnz.org/'; DNZSearch.hostedDomain = 'http://search.digitalnz.org/'; DNZSearch.searchSlug = 'cominghome'; DNZSearch.APIKey = '2288c852c37ff96859bfea3567af7446'; DNZSearch.stylesheet = 'http://www.digitalnz.org/stylesheets/search/coming_home.css'; DNZSearch.numberOfResults = 4; DNZSearch.logo = 'http://www.digitalnz.org/images/search/coming_home/logo.gif'; }
// --></script>

It should look like:

<script type="text/javascript" src="http://www.digitalnz.org/javascripts/search/dnz_search_widget.js"></script>
<script type="text/javascript"> function DNZOptions() { DNZSearch.serverRoot = 'http://www.digitalnz.org/'; DNZSearch.APIDomain = 'http://api.digitalnz.org/'; DNZSearch.hostedDomain = 'http://search.digitalnz.org/'; DNZSearch.searchSlug = 'cominghome'; DNZSearch.APIKey = '2288c852c37ff96859bfea3567af7446'; DNZSearch.stylesheet = 'http://www.digitalnz.org/stylesheets/search/coming_home.css'; DNZSearch.numberOfResults = 4; DNZSearch.logo = 'http://www.digitalnz.org/images/search/coming_home/logo.gif'; } </script>


Can you give that a crack?

Some background. The snippet contains the DNZOptions function that sets a few variables. That function can get munged for various reasons e.g. Blogger will append <BR> tags to every line break even if you're using the raw html mode.

We got quite a few reports of the widget failing to render correctly when it was first released and 90% of the time it was because DNZOptions was undefined or had thrown an error. So we put in a check in the server side JS to see if it thinks DNZOptions() is valid. If not, we abort right away and show that message.


--
Joe Mahoney
Senior Developer, 3months <http://3months.com/>
ph: (04) 498 3478 ext 17
gtalk: j...@3months.com



Walter McGinnis

unread,
May 21, 2009, 11:05:18 PM5/21/09
to digi...@googlegroups.com
Great.  Updating to that code worked:



It might be that the version of the code dated before y'all updated your version.  Not sure.

At any rate, it is good to see it works with Kete's latest filtering.  We only allow site administrators to submit content that has javascript and/or forms to avoid security issues and this works within that context.

Cheers,
Walter

Walter McGinnis

unread,
May 21, 2009, 11:10:44 PM5/21/09
to digi...@googlegroups.com
Oh, and thanks for the help!

Joe Mahoney

unread,
May 21, 2009, 11:17:10 PM5/21/09
to digi...@googlegroups.com
On Fri, May 22, 2009 at 3:05 PM, Walter McGinnis <walter....@gmail.com> wrote:
Great.  Updating to that code worked:
It might be that the version of the code dated before y'all updated your version.  Not sure.


Sweet, glad it works. There was an updated version on the DigitalNZ site last time I looked but yeah, it's not there now.
 

At any rate, it is good to see it works with Kete's latest filtering.  We only allow site administrators to submit content that has javascript and/or forms to avoid security issues and this works within that context.

I haven't had a chance to play with Kete yet., but am keen to give it a whirl.

Walter McGinnis

unread,
May 22, 2009, 12:14:29 AM5/22/09
to digi...@googlegroups.com
Here's the latest Kete news:


Kete 1.2 released. I met James Robertson from 3months awhile back.  He mentioned that y'all were a PostgreSQL shop.  Would be great to have someone take on testing Kete with PG and helping us iron out any non-db agnostic code that has snuck in.  Shouldn't be much, but we don't have any PG users to test for us yet.

Feel free to contact me offlist about it.  Or you can just go to github and fork to your hearts content and submit push requests.

Cheers,
Walter

P.S. - some wicked cool stuff already developed for the 1.3 release that will take advantage of DNZ among other things. I expect further DNZ related functionality in 1.4, too.
Reply all
Reply to author
Forward
0 new messages