Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Re: [Gypsypup] Javascript and Links

Quote Reply
Re: [Gypsypup] Javascript and Links In reply to
Gypsypup, as requested.

1 st Visit the Web Site listed in the above post, read the installation FAQ and download the script and sample template.
2 nd back up all files you are going to modify.
3 rd back up all files you are going to modify.

Then

In add.html put the following between <head> </head> tags.
<SCRIPT src="http://whereyourfilterlistresides.com/filterlist.js" type=text/javascript>
</SCRIPT>

Also in add.html change:
<form action="<%db_cgi_url%>/add.cgi" enctype="multipart/form-data" method="POST"> to
<form name="usersform" action="<%db_cgi_url%>/add.cgi" enctype="multipart/form-data" method="POST">

Then

Line 195 in Links/User/add.pm
Change:
$category = $html->get_all_categories(\@ids, 'CatLinks.CategoryID', 5);

Then

In the include_form.html
Delete <%Category%> and replace with the following:

Please Note:This does not need changing at this stage.

<!-------------------- START Filter List -------------------------->
<table width="100%">
<tr><td>
<!-- Message for filtered results -->
<DIV id=filtertext> </DIV>
</td></tr>
<tr><td><%Category%></td></tr>
</table>
<SCRIPT type=text/javascript>
//<![CDATA[
<!--
var filter = new filterlist(document.usersform.elements['CatLinks.CategoryID']);

filter.hook = function() {

if (document.getElementById) {
var id = document.getElementById("filtertext");
if (typeof id.innerHTML != 'undefined') {
if (this.selectobj.length == this.optionscopy.length) {
id.innerHTML = "&nbsp;";
} else {
id.innerHTML = "Showing " +
this.selectobj.length + " of " +
this.optionscopy.length + " items";
}
}
}
}

function dofilter(regexp)
{document.usersform.regexp.value = regexp;
filter.set(regexp);
}
//-->
//]]>
</SCRIPT>

<table width="100%">
<tr><td>
<A title="Show all items" href="javascript:dofilter('')">[ List All ]</A>Alpha List
<A title="Show items starting with A" href="javascript:dofilter('^A')">A</A>
<A title="Show items starting with B" href="javascript:dofilter('^B')">B</A>
<A title="Show items starting with C" href="javascript:dofilter('^C')">C</A>
<A title="Show items starting with D" href="javascript:dofilter('^D')">D</A>
<A title="Show items starting with E" href="javascript:dofilter('^E')">E</A>
<A title="Show items starting with F" href="javascript:dofilter('^F')">F</A>
<A title="Show items starting with G" href="javascript:dofilter('^G')">G</A>
<A title="Show items starting with H" href="javascript:dofilter('^H')">H</A>
<A title="Show items starting with I" href="javascript:dofilter('^I')">I</A>
<A title="Show items starting with J" href="javascript:dofilter('^J')">J</A>
<A title="Show items starting with K" href="javascript:dofilter('^K')">K</A>
<A title="Show items starting with L" href="javascript:dofilter('^L')">L</A>
<A title="Show items starting with M" href="javascript:dofilter('^M')">M</A>
<A title="Show items starting with N" href="javascript:dofilter('^N')">N</A>
<A title="Show items starting with O" href="javascript:dofilter('^O')">O</A>
<A title="Show items starting with P" href="javascript:dofilter('^P')">P</A>
<A title="Show items starting with Q" href="javascript:dofilter('^Q')">Q</A>
<A title="Show items starting with R" href="javascript:dofilter('^R')">R</A>
<A title="Show items starting with S" href="javascript:dofilter('^S')">S</A>
<A title="Show items starting with T" href="javascript:dofilter('^T')">T</A>
<A title="Show items starting with U" href="javascript:dofilter('^U')">U</A>
<A title="Show items starting with V" href="javascript:dofilter('^V')">V</A>
<A title="Show items starting with W" href="javascript:dofilter('^W')">W</A>
<A title="Show items starting with X" href="javascript:dofilter('^X')">X</A>
<A title="Show items starting with Y" href="javascript:dofilter('^Y')">Y</A>
<A title="Show items starting with Z" href="javascript:dofilter('^Z')">Z</A>
</td></tr><tr><td>
Keyword Search:
<INPUT name=regexp>
<INPUT onclick=filter.set(this.form.regexp.value) type=button value=Search>
<INPUT onclick="filter.reset();this.form.regexp.value=''" type=button value=List_All>
</td></tr></table>
<!--------------- END Filter List ----------------------------->

Do not make any changes to the above code until you have it working, then make changes to suit.

Then
Make sure you have followed steps 2 and 3 at the start of this post.
Copy all files to the relevant directories, including the filterlist.js
( The filterlist.js does not need changing )

You may get an error message in the add_success.html confirmation page.
You could delete the following from add_success.html and it should go away.
<tr><td><%body_font%>Category:</td><td><b><%Category%></b></font></td></tr>

It will just mean the user does not see the categories that they listed in on the success page, no big deal.

Check the details when you validate and all should be OK.

Please Note: This has only been tested on a development site, not a live site.

Good luck.

PS I removed the "real time" filtering, if you need it just replace:

<input name=regexp> with
<input onkeyup=myfilter.set(this.value)name=regexp>

but not until you have it working.

Regards

minesite
Subject Author Views Date
Thread Javascript and Links minesite 2463 Mar 1, 2004, 8:28 AM
Thread Re: [minesite] Javascript and Links
Andy 2388 Mar 1, 2004, 8:55 AM
Thread Re: [Andy] Javascript and Links
minesite 2370 Mar 1, 2004, 7:18 PM
Thread Re: [minesite] Javascript and Links
Gypsypup 2364 Mar 1, 2004, 8:11 PM
Post Re: [Gypsypup] Javascript and Links
minesite 2359 Mar 1, 2004, 9:14 PM