[dw-free] site search widget for homepage
[commit: http://hg.dwscoalition.org/dw-free/rev/c1ab80df65e0]
http://bugs.dwscoalition.org/show_bug.cgi?id=1961
Add new site search widget to the home page.
Patch by
denise.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1961
Add new site search widget to the home page.
Patch by
![[staff profile]](https://www.dreamwidth.org/img/silk/identity/user_staff.png)
Files modified:
- bin/upgrading/en.dat
- cgi-bin/DW/Panel.pm
- cgi-bin/DW/Widget/SiteSearch.pm
-------------------------------------------------------------------------------- diff -r abc7f70e22fd -r c1ab80df65e0 bin/upgrading/en.dat --- a/bin/upgrading/en.dat Mon Oct 26 02:03:20 2009 +0000 +++ b/bin/upgrading/en.dat Mon Oct 26 02:07:27 2009 +0000 @@ -4739,6 +4739,10 @@ widget.shopitemoptions.price.seed=Foreve widget.sitemessages.title=[[sitename]] Plugs In +widget.sitesearch.desc=Search for entries containing: + +widget.sitesearch.title=Search [[sitename]] + widget.support.submit.button=Submit Request widget.support.submit.captcha=Prove You're Human diff -r abc7f70e22fd -r c1ab80df65e0 cgi-bin/DW/Panel.pm --- a/cgi-bin/DW/Panel.pm Mon Oct 26 02:03:20 2009 +0000 +++ b/cgi-bin/DW/Panel.pm Mon Oct 26 02:07:27 2009 +0000 @@ -59,6 +59,7 @@ sub init { ]; $ret->{secondary} = [ + "DW::Widget::SiteSearch", "DW::Widget::ReadingList", "LJ::Widget::FriendBirthdays", "DW::Widget::AccountStatistics", diff -r abc7f70e22fd -r c1ab80df65e0 cgi-bin/DW/Widget/SiteSearch.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cgi-bin/DW/Widget/SiteSearch.pm Mon Oct 26 02:07:27 2009 +0000 @@ -0,0 +1,40 @@ +#!/usr/bin/perl +# +# DW::Widget::SiteSearch +# +# Simple site-search module (global search only). +# +# Authors: +# Denise Paolucci <denise@dreamwidth.org> +# +# Copyright (c) 2009 by Dreamwidth Studios, LLC. +# +# This program is free software; you may redistribute it and/or modify it under +# the same terms as Perl itself. For a copy of the license, please reference +# 'perldoc perlartistic' or 'perldoc perlgpl'. +# + +package DW::Widget::SiteSearch; + +use strict; +use base qw/ LJ::Widget /; + +sub render_body { + + my ( $class, %opts ) = @_; + + my $remote = LJ::get_remote() + or return; + + my $ret = "<h2>" . $class->ml( 'widget.sitesearch.title', { sitename => $LJ::SITENAMESHORT } ) . "</h2>"; + $ret .= "<p>" . $class->ml( 'widget.sitesearch.desc' ) . "</p>"; + + $ret .= "<form method='post' action='$LJ::SITEROOT/search'>" . LJ::form_auth(); + $ret .= "<input type='text' name='query' maxlength='255' size='30'>"; + $ret .= "<input type='submit' value='Search'></form>"; + + return $ret; + +}; + +1; --------------------------------------------------------------------------------