Skip to main content.
home | support | download

Back to List Archive

Re: [swish-e] "Select All" check box for swish.cgi

From: Troy Wical <troy(at)not-real.wical.com>
Date: Fri Jul 09 2010 - 12:58:32 GMT
On Jun 29, 2010, at 8:13 PM, Peter Karman wrote:

> Troy Wical wrote on 6/25/10 12:57 AM:
>> On Jun 24, 2010, at 6:43 PM, Peter Karman wrote:
>>> 
>>> I don't use swish.cgi myself, but my reading of it suggests that if you
>>> configure it correctly (c.f. lines 380-400 or so) the "search all" is the
>>> default if no index is selected.
>>> 
>>> How have you configured it?

Ok, here is my solution, which involves a small piece of java. In our environment here, it's been put through the paces without any reports of issues. Hopefully this helps out others.

Peace, Troy


1: Edit /usr/lib/swish-e/perl/SWISH/TemplateDefault.pm (or whatever template your using)
   My entires are surrounded by *****************
   ALSO add name="myform"  to the form. Look for it below.

######################################################
##################  BEGIN CODE   #####################
######################################################

    my $hidden = !$extra ? ''
                 : join "\n", map { $q->hidden($_) } @$extra;



    return <<EOF;

************************************************
******************  BEGIN  *********************
************************************************
<SCRIPT LANGUAGE="JavaScript">
function checkAll(field)
{
for (i = 0; i < field.length; i++)
        field[i].checked = true ;
}

function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
        field[i].checked = false ;
}
</script>
************************************************
******************** END ***********************
************************************************

    <form method="get" name="myform" action="$form" enctype="application/x-www-form-urlencoded" class="form">
        <input maxlength="200" value="$query" size="80" type="text" name="query"/>
        $hidden
        <input value="Search!" type="submit" name="submit"/><br>
<small>200 character limit</small>
<br>
<br>
        $advanced_form


************************************************
******************  BEGIN  *********************
************************************************
<br>
<input type="button" name="CheckAll" value="Check All"
onClick="checkAll(document.myform.si)">
<input type="button" name="UnCheckAll" value="Uncheck All"
onClick="uncheckAll(document.myform.si)">
************************************************
******************** END ***********************
************************************************

    </form>
EOF
}


#=====================================================================
# This routine creates the results header display
# and navigation bar

######################################################
####################### END CODE #####################
######################################################
_______________________________________________
Users mailing list
Users@lists.swish-e.org
http://lists.swish-e.org/listinfo/users
Received on Fri Jul 9 08:58:36 2010