1 (edited by FlashT 2010-05-18 12:23)

Topic: [MOD] Select ALL in search category box

http://zycie.org/mark.png

Maybe it could be done prettier, but heres a solution to add select all from forum category on search box...

Add this to search.php (somewhere in code):

<script type="text/javascript">
function checkall(ca) {
    var cboxes=document.getElementById(ca).getElementsByTagName('input');
    for (j=0; j<cboxes.length; j++) {
        cboxes[j].checked=true;
    }
}
function uncheckall(ca) {
    var cboxes=document.getElementById(ca).getElementsByTagName('input');
    for (j=0; j<cboxes.length; j++) {
        cboxes[j].checked=false;
    }
}
</script>

And modify some lines of search.php... find "A new category since last iteration" and below should be something like:

echo "\t\t\t\t\t\t\t".'<fieldset ...

Change whole line to:

            echo "\t\t\t\t\t\t\t".'<fieldset id="fs'.$cur_forum['cid'].'" style="padding-bottom:8px;">'."\n\t\t\t\t\t\t\t\t".'<legend><span style="border-top:1px dotted #ccc;">'.forum_htmlencode($cur_forum['cat_name']).':</span><br><span style="border-bottom:1px dotted #ccc;"><a href="#" onclick="javascript:checkall(\'fs'.$cur_forum['cid'].'\');" style="text-decoration:none;font-weight:normal;">check all</a> | <a href="#" onclick="javascript:uncheckall(\'fs'.$cur_forum['cid'].'\');" style="text-decoration:none;font-weight:normal;">uncheck all</a></span></legend>'."\n";

Re: [MOD] Select ALL in search category box

To make it w3c valid, just put the scripts in /include/js/common.js and replace <br> with <br />