From 462205f92e81b6d9a4ad0ba79c607cce26357cd8 Mon Sep 17 00:00:00 2001 From: Banana Date: Wed, 15 Feb 2012 10:54:49 +0100 Subject: [PATCH] newer and older link at top of listing page --- AUTHORS | 2 +- ChangeLog | 16 +++--- VERSION | 2 +- lib/Insipid/Main.pm | 118 +++++++++++++++++++++++--------------------- 4 files changed, 74 insertions(+), 64 deletions(-) diff --git a/AUTHORS b/AUTHORS index 1e2328f..0af9b46 100755 --- a/AUTHORS +++ b/AUTHORS @@ -1,4 +1,4 @@ -current development: +current development starting from 2011: https://github.com/jumpin-banana/insipid creator: diff --git a/ChangeLog b/ChangeLog index 303b745..f6cc586 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +version 1.1 + * duplicate / potential match url search + * older and newer link at the top no working + version 1.0 () + jumpin.banana * tag suggest was not working correctly. @@ -11,7 +15,7 @@ version 1.0 () This is not needed. Since we use the charset info to determine utf, we need this information * Insert SQL more save now - + Tue Jul 14 21:38 EST 2009 Luke Reeve * Fix the option "proxy_host" not being saved correctly. @@ -37,7 +41,7 @@ Tue Mar 21 19:34 EST 2006 Luke Reeves Tue Feb 21 12:30 EST 2006 Luke Reeves - * Fix up database connectivity for newer PostgreSQL + * Fix up database connectivity for newer PostgreSQL libraries * Incorporate patch from Paul Boin that allows importing of regular del.icio.us backups (as opposed to only @@ -48,12 +52,12 @@ Mon Nov 21 12:41 EST 2005 Luke Reeves * Fixed some of the cleanup process for snapshot deletion * Added a "Fetch Related" function, so that the snapshot tool can grab related objects - * Work on the tag tools - delete and rename tags + * Work on the tag tools - delete and rename tags Fri Nov 04 09:00 EST 2005 Luke Reeves * Database fix (thanks to Jutta Horstmann) - * Remove export and import to server-side files, since the + * Remove export and import to server-side files, since the standalone tools can easily accomplish that Fri Sep 23 07:35 EST 2005 Luke Reeves @@ -88,7 +92,7 @@ Fri Sep 16 12:30 EST 2005 Luke Reeves systems. Mon Sep 05 22:28 EST 2005 Luke Reeves - + * Major code cleanup (splitting the main CGI file into multiple, more maintainable ones inside of the lib/Insipid directory) * Bugfix for adding duplicate items not being flagged as such @@ -109,7 +113,7 @@ Thu Jul 21 21:35 EST 2005 Luke Reeves as well as other bug fixes. Sun Jul 17 15:19 EST 2005 Luke Reeves - + * Added the page cache feature, so a user can take snapshots of pages that have been bookmarked. diff --git a/VERSION b/VERSION index 9f8e9b6..9459d4b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0 \ No newline at end of file +1.1 diff --git a/lib/Insipid/Main.pm b/lib/Insipid/Main.pm index 04f55b7..52ce984 100755 --- a/lib/Insipid/Main.pm +++ b/lib/Insipid/Main.pm @@ -250,11 +250,11 @@ DOC do_import(); } else { print <This allows you to import either - Insipid or +

This allows you to import either + Insipid or del.icio.us backups. For del.icio.us, you must first use their API to export your bookmarks to an XML file. To do this, - access the URL "http://username:password\@del.icio.us/api/posts/all?" + access the URL "http://username:password\@del.icio.us/api/posts/all?" (using your username and password). You can then upload that XML file here.


@@ -295,7 +295,7 @@ IFORM print "URL or Title can not be empty"; exit; } - + if(!is_uri($url)) { print "This is not a valid URL"; exit; @@ -437,14 +437,14 @@ FORM if (param('op') eq 'bookmarklets') { print <This bookmarklet provides a fast way to add your browser's -current page to this Insipid installation. Either drag the -following link to your bookmarks toolbar or right-click on it -and choose "Bookmark This Link..." to create a bookmarklet. -Then when you're on a page you'd like to save, click on your -new "Add to Insipid" button and you'll be brought to a page -that allows you to fill out the tags for the bookmark and save -it. Once you've clicked Save you'll be brought back to the +

This bookmarklet provides a fast way to add your browser's +current page to this Insipid installation. Either drag the +following link to your bookmarks toolbar or right-click on it +and choose "Bookmark This Link..." to create a bookmarklet. +Then when you're on a page you'd like to save, click on your +new "Add to Insipid" button and you'll be brought to a page +that allows you to fill out the tags for the bookmark and save +it. Once you've clicked Save you'll be brought back to the page.

DESC my $ad = <
"; if (param('save')) { - my $sql = "update $tbl_options set value=? + my $sql = "update $tbl_options set value=? where (name = ?)"; my $sth = $dbh->prepare($sql); @@ -532,21 +532,27 @@ sub show_options { print ""; } -sub show_footer { +sub show_pageLinks { my $older = 2; + my $newer = 2; + my $returnstr; + my $currentPage; + if (defined(url_param('page'))) { - $older = url_param('page') + 1; + $currentPage = url_param('page'); + $older = $currentPage + 1; + $newer = $currentPage - 1; } + $returnstr = " | "; + if($older >= 2 && $currentPage > 1) { + $returnstr .= "« newer"; + } if ($last_page eq 0) { - if ($query ne "") { - print " | More Results"; - } else { - print " | older"; - } + $returnstr .= " older »"; } + + print $returnstr; } sub do_import { @@ -824,9 +830,9 @@ sub delete_bookmark { check_access(); # Check for cached version to delete. - $sql = "select $tbl_pagecache.md5 from $tbl_pagecache - inner join $tbl_bookmarks on - ($tbl_pagecache.md5 = $tbl_bookmarks.md5) + $sql = "select $tbl_pagecache.md5 from $tbl_pagecache + inner join $tbl_bookmarks on + ($tbl_pagecache.md5 = $tbl_bookmarks.md5) where ($tbl_bookmarks.id = ?)"; $sth = $dbh->prepare($sql); $sth->execute($id); @@ -863,12 +869,12 @@ sub show_bookmarks { # Join the tag tables only when necessary if(url_param('tag') eq "empty") { - + # allow this action only for logged in users check_access(); - - $sql = $sql." left join $tbl_bookmark_tags on - ($tbl_bookmarks.id = + + $sql = $sql." left join $tbl_bookmark_tags on + ($tbl_bookmarks.id = $tbl_bookmark_tags.bookmark_id) WHERE $tbl_bookmark_tags.bookmark_id IS NULL"; } @@ -878,22 +884,22 @@ sub show_bookmarks { foreach (@tags) { push(@parms, $_); - $sql = "$sql inner join $tbl_bookmark_tags - as bt$icount on - ($tbl_bookmarks.id = + $sql = "$sql inner join $tbl_bookmark_tags + as bt$icount on + ($tbl_bookmarks.id = bt$icount.bookmark_id) - inner join $tbl_tags as t$icount on - (t$icount.id = bt$icount.tag_id + inner join $tbl_tags as t$icount on + (t$icount.id = bt$icount.tag_id and t$icount.name = ?) "; $icount++; } } else { - $sql = "$sql - left join $tbl_bookmark_tags on - ($tbl_bookmarks.id = - $tbl_bookmark_tags.bookmark_id) - inner join $tbl_tags on - ($tbl_tags.id = $tbl_bookmark_tags.tag_id) + $sql = "$sql + left join $tbl_bookmark_tags on + ($tbl_bookmarks.id = + $tbl_bookmark_tags.bookmark_id) + inner join $tbl_tags on + ($tbl_tags.id = $tbl_bookmark_tags.tag_id) where ($tbl_tags.name = ?)"; push(@parms, url_param('tag')); } @@ -948,20 +954,20 @@ sub show_bookmarks { @parms = (); @wheres = (); - $sql = "select - $tbl_bookmarks.id, - $tbl_bookmarks.title, - $tbl_bookmarks.description, + $sql = "select + $tbl_bookmarks.id, + $tbl_bookmarks.title, + $tbl_bookmarks.description, $tbl_bookmarks.access_level, $tbl_bookmarks.url, $tbl_tags.name, $tbl_bookmarks.date, $tbl_pagecache.date as cache_date, $tbl_bookmarks.md5 - from $tbl_bookmarks - left join $tbl_bookmark_tags on + from $tbl_bookmarks + left join $tbl_bookmark_tags on ($tbl_bookmarks.id = $tbl_bookmark_tags.bookmark_id) - left join $tbl_tags on + left join $tbl_tags on ($tbl_tags.id = $tbl_bookmark_tags.tag_id) left join $tbl_pagecache on ($tbl_bookmarks.md5 = $tbl_pagecache.md5)"; @@ -1024,7 +1030,7 @@ sub show_bookmarks { } print "$title"; - show_footer(); + show_pageLinks(); print '

'; print ""; @@ -1152,7 +1158,7 @@ sub get_bookmark_id { my ($url) = (@_); # Lookup the URL id first. - my $sql = "select $tbl_bookmarks.id from + my $sql = "select $tbl_bookmarks.id from $tbl_bookmarks where ($tbl_bookmarks.md5 = ?)"; my $sth = $dbh->prepare($sql); @@ -1169,12 +1175,12 @@ sub get_bookmark_id { sub get_bookmark { my ($id) = (@_); - my $sql = "select - $tbl_bookmarks.title, - $tbl_bookmarks.description, + my $sql = "select + $tbl_bookmarks.title, + $tbl_bookmarks.description, $tbl_bookmarks.url, - $tbl_bookmarks.access_level - from $tbl_bookmarks + $tbl_bookmarks.access_level + from $tbl_bookmarks where ($tbl_bookmarks.id = ?)"; my $sth = $dbh->prepare($sql); $sth->execute($id); @@ -1187,8 +1193,8 @@ sub update_bookmark { check_access(); - my $sql = "update $tbl_bookmarks - set url = ?, md5 = ?, title = ?, description = ?, + my $sql = "update $tbl_bookmarks + set url = ?, md5 = ?, title = ?, description = ?, access_level = ? where (id = ?)"; my $sth = $dbh->prepare($sql); $sth->execute($url, md5_hex("$url"), $title, $description, $access_level, -- 2.39.5