SJPPLOG - Scotts jQuery PPLOG

A home for all kinds of Puppy related projects
Message
Author
User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

SJPPLOG - Scotts jQuery PPLOG

#1 Post by sc0ttman »

SJPPLOG - a jQuery enabled PPLOG

- Homepage and demo: http://pplog.scottjarvis.com (with more info, guides)
- Download: sjpplog.zip (221kb)

-------------------------------

I have added jQuery to PPLOG, including code syntax highlighting and lightboxes.

See http://pplog.scottjarvis.com for more info

-------------------------------

This is more or less finished, its working nicely on my local monkey webserver (in my Puppy), and also on my main website server as well.. There are a few config options to setup on initial installation, and the paths you need will depend on how you setup your web server.. and more specifically, where your cgi-bin is, in relation to your webserver root.

Sorry to post this here, didn't know where to put it.
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#2 Post by sc0ttman »

I've updated this, to 1.2c.

version 1.2c:

- added a password protected upload page, for site admin only (no jquery needed)

- it can upload to /blog/images, /blog/thumbs/, /blog/css/
- you can only upload one file at a time,

- you can turn the upload page on and off, by setting the variable $config_enableUploadPage to 1 or 0 in the main script itself, which will be /root/webserver/cgi-bin/pup_pplog.cgi.

- if $config_enableUploadPage = 1, the upload page is enabled, and a link called 'Upload' will appear in the left menu, under 'New Entry'.

See screenshot.

NOTE: You may need to move the contents of the webserver directroy into another folder, if you keep your webserver www root elsewhere...
Attachments
example.png
(53.64 KiB) Downloaded 2302 times
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#3 Post by sc0ttman »

Here is a diff file, adding the ability to add anchor tags to all comments created in pplog...

This diff file applies to the regular pplog!

This means, you can link straight to a specific comment, and if you click on any 'latest comment' then you'll be taken down the page to that comment, not just to the page its on, then left to find it...

(It adds `date+time` to the end (5th field) of the $content strings that are added to the comment files in /blog/comments/ ... this is then read as $anchor and used later in the href url#anchor ... )

example URL straight to a comment (from 'Latest comments' list): http://localhost/cgi-bin/pup_pplog.pl?v ... 0302220922[/b]

Code: Select all

--- /initrd/pup_ro2/root/webserver/cgi-bin/pup_pplog.pl	2013-02-21 10:31:13.000000000 +0000
+++ ./pup_pplog1.pl	2013-03-02 22:38:22.024822293 +0000
@@ -25,6 +25,7 @@
 use CGI::Carp qw/fatalsToBrowser/;	# This is optional
 use CGI':all';
 use POSIX qw(ceil floor);
+use POSIX qw/strftime/; #020313
 use strict;							# This is also optional
 
 # Main PPLOG Configuration (Perl Powered Blog). Please note, in some cases where the answer is Yes or No...0 = No, 1 = Yes.
@@ -476,7 +477,7 @@
 		if($i <= $config_showLatestCommentsLimit)
 		{
 			my @entry = split(/"/, $_);
-			print '<a href="?viewDetailed='.$entry[4].'" title="Posted by '.$entry[1].'">'.$entry[0].'</a>';
+			print '<a href="?viewDetailed='.$entry[4].'#'.$entry[5].'" title="Posted by '.$entry[1].'">'.$entry[0].'</a>'; #020313
 			$i++;
 		}
 	}
@@ -1133,7 +1134,8 @@
 				my $author = $comment[1];
 				my $content = $comment[2];
 				my $date = $comment[3];
-				print 'Posted on <b>'.$date.'</b> by <b>'.$author.'</b><br /><i>'.$title.'</i><br />';
+				my $anchor = $comment[5]; #020313
+				print '<a id="anchor" name="'.$anchor.'"></a>Posted on <b>'.$date.'</b> by <b>'.$author.'</b><br /><i>'.$title.'</i><br />'; #020313
 				if($config_bbCodeOnCommentaries == 0)
 				{
 					print txt2html($content);
@@ -1228,6 +1230,7 @@
 	my $content = r('content');
 	my $pass = r('pass');
 	my $date = getdate($config_gmt);
+	my $anchor = strftime "%Y%m%d%H%M%S", localtime; #020313
 	my $do = 1;
 	my $triedAsAdmin = 0;
 	
@@ -1330,7 +1333,7 @@
 			}
 			else
 			{
-				my $content = $title.'"'.$author.'"'.$content.'"'.$date.'"'.$fileName."'";
+				my $content = $title.'"'.$author.'"'.$content.'"'.$date.'"'.$fileName.'"'.$anchor."'"; #020313
 				
 				# Add comment
 				open(FILE, ">>$config_commentsDatabaseFolder/$fileName.$config_dbFilesExtension");
EDIT: to get a clickable link icon to each comment, above each comment (like we do on this forum), you can add

#anchor { background-image: url(file.gif); background-repaet: no-repeat; padding-right:14px; }

to your CSS file...

Example: Image


OR.. to make the date, in the header of each comment, a clickable link to that comment (useful for getting the url of a comment, to repost a link to it, etc), change:

Code: Select all

print '<a id="anchor" name="'.$anchor.'"></a>Posted on <b>'.$date.'</b> by <b>'.$author.'</b><br /><i>'.$title.'</i><br />'; #020313
to

Code: Select all

print 'Posted on <a id="anchor" name="'.$anchor.'" href="?viewDetailed='.$fileName.'#'.$anchor.'">'.$date.'</a> by <b>'.$author.'</b><br /><i>'.$title.'</i><br />'; #020313
You must apply these changes to pplog, then start adding comments to see it working.. it might break exisitng stuff, use it on a fresh pplog install if possible...

-------------------------
These changes will be in the next sjpplog.. I have also added an option to load jQuery from a content delivery network (CDN), so that jquery wont need to be installed locally in the /blog/js folder..
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#4 Post by sc0ttman »

SJPPLOG updated to 1.3

Summary: No need to have any of the jquery stuff installed locally. Better comment linking.

Changes:

- all jquery related js scripts can now be optionally loaded from an external source - a content delivery network (CDN)
- all jquery scripts loaded from CDN by default
- all jquery js scripts therefore moved into a sjpplog_DEV pkg
- added anchor tags to comments, latest comments links now go straight to the comment
- updated default stylesheet, creates clickable Image icon next to comment headers, so users can ge the url for that specific comment
- removed additional stylesheets
Attachments
sjpplog-1.3-akita.pet
contains the blog itself, inc an example image (~40kb)
(85.92 KiB) Downloaded 899 times
sjpplog_DEV-1.3-akita.pet
contains the jQuery scripts: jquery 141, prettify, prettyphoto, jquery-syntaxhighlighter (not required)
(67.99 KiB) Downloaded 897 times
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#5 Post by jamesbond »

Thank you for the update :D
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

efiabruni
Posts: 69
Joined: Tue 18 Oct 2011, 15:55

file path problems

#6 Post by efiabruni »

Hey,
I downloaded the latest version of the log and installed it in my xampp installation, but I can't figure out how to set the file paths for images, thumbs and the js folder. the index.pl (and other pl files) are in /opt/lampp/htdocs and the above mentioned folder are in /opt/lampp/blog. My plog entries and comments are in the same folder and setting the path for them worked.

I also left a comment on your blog, but I don't know if you actually check those.

I really like the new features, I use the blog as a travelblog so the JQuery stuff would be cool for pictures.

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

Re: file path problems

#7 Post by sc0ttman »

efiabruni wrote:I can't figure out how to set the file paths for images, thumbs and the js folder. the index.pl (and other pl files) are in /opt/lampp/htdocs and the above mentioned folder are in /opt/lampp/blog.
In the package is a test.pl script, this will tell you the paths you need, with a little playing around... You will need to open up index.pl, and change the values in there, $config_imgFilesFolder etc - you might need to pre-append the $config_wwwFolder as is done with $config_postsDatabaseFolder etc...

Keep playing with the paths, i know its a pain, but you will get there..
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

efiabruni
Posts: 69
Joined: Tue 18 Oct 2011, 15:55

path

#8 Post by efiabruni »

in the end all that was missing was a / at the beginning, I'm stupid sometimes... There is something weird going on with the archive, it mixes up the months. This was already happening in the old PPlog and I haven't found a way to fix it yet, but I'm also not that advanced in Perl...
I'm working on it though and if I find a fix, I will let you know.
But it might take time....

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#9 Post by jamesbond »

Mr. Scott, I have a problem to report.

It seems that the blog doesn't quote single quote (') properly, anyone entering words like this as comments, for example -- It isn't right -- will make the comment split in two.

Do you have the same problem, or is it only me? This is for the latest version of sjpplog (1.3).
In any way, thanks for your excellent improvement over pplog Image.

cheers!
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#10 Post by sc0ttman »

jamesbond wrote:Mr. Scott, I have a problem to report.

It seems that the blog doesn't quote single quote (') properly, anyone entering words like this as comments, for example -- It isn't right -- will make the comment split in two.

Do you have the same problem, or is it only me? This is for the latest version of sjpplog (1.3).
In any way, thanks for your excellent improvement over pplog Image.

cheers!
I thought that was the monkey webserver! I failed to track it down, and found the original pplog did the same, i assumed it was opera and/ monkey webserver, and so switched to mongoose (cheers ;) ) ... The problem seemed to go away.. I'll have to double (triple??) check... But you will know *at least* as much as me about PERL, I promise you that!!

And I also thought I added the date correction fix!!!

So yes I was aware of these issues, but thought I fixed both! :roll: Damn it..
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#11 Post by jamesbond »

Well I'm not aware of the date correction fix, and you give me too much credit for my perl knowledge (as kirk often says, "I only know enough to be dangerous :lol: ").

Anyway, I thought I'd take a stab at it, and here goes nothing ...

cheers!
Attachments
quote-fix.patch.gz
This is a real gzip file, gunzip first to use. Patch for index.pl of sjpplog 1.3
(572 Bytes) Downloaded 804 times
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

efiabruni
Posts: 69
Joined: Tue 18 Oct 2011, 15:55

the quote problem

#12 Post by efiabruni »

I cannot open the gz file all I get is an error, so if what I say is related to your fix ignore it.
The problem is, that the blog uses a ' to distinguish between the different entries, like this:
my @comments = split(/'/, $content);

the ' used to get encoded in it's ASCII number, in the old pplog, which did not use UTF-8, but know it is printed as a ' so perl thinks this entry is done and a new one starts.

As I don't know shit about encoding or perl I just replaces the ' in the code to # as this is used less, doing
my @comments = split(/#/, $content);

there are several places in the script where this happens, I will find them and list them here in an hour or so .

Oh and the archive is mixed up as the months are used as hash keys, but hashes do not have an order, which means the order of the months depends how perl feels like printing them. Once I find out how to fix it, I will post it here. But again, i am just learning perl, so it might not be soon..

efiabruni
Posts: 69
Joined: Tue 18 Oct 2011, 15:55

Nevermind

#13 Post by efiabruni »

I managed to open the patch. :)

efiabruni
Posts: 69
Joined: Tue 18 Oct 2011, 15:55

archive and categories

#14 Post by efiabruni »

As I said before, the archive was not displaying the months in the correct order, here is my patch for the archive
For my own use I included the possibility to assign more than one category to a post. Use a ' such as: category1'category2 and no space.

If anyone feels this is useful, the two patches are attached, but no guarantees!
Attachments
categories.patch.gz
(1.09 KiB) Downloaded 682 times
archive.patch.gz
(1.32 KiB) Downloaded 675 times

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

SJPPLOG 1.4

#15 Post by sc0ttman »

SJPPLOG 1.4 - thanks guys!

changes:

- fixed order of posts in archive page
- fixed single quote errors in comments
- added multiple categories for each post
- added tooltip about adding categories, in the new post page
- updated layout of new posts page
- updated default stylesheet - links go red when you hover over them
Attachments
sjpplog-1.4-akita.pet
bugfixes and new features (thanks to efiabruni and jamesbond)
(86.6 KiB) Downloaded 675 times
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#16 Post by jamesbond »

Thanks Scott for the update.

Apology, my earlier patch for apostrophe and quotes were half-assed.
Instead of s/'/&apos;/; one should have s/'/&apos;/g; (note the extra "g").
Same with quotes, instead of s/"/"/; one should have s/"/"/g; (note the extra "g").

The archiving doesn't work for me (it says "no post in archive"), I made it work by replacing
my @dates = map { split(/"/, $_); @_[2].'|'.@_[4].'|'.@_[0]; } @entries;
with
my @dates = map { my @stuff = split(/"/, $_); @stuff[2].'|'.@stuff[4].'|'.@stuff[0]; } @entries;.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

efiabruni
Posts: 69
Joined: Tue 18 Oct 2011, 15:55

contact me page

#17 Post by efiabruni »

I wrote a contact me page for the pe_pplog, which can also be used in this blog. It looks like this. It uses the email address from $config_sendMailWithNewCommentMail and mailto has to be installed. $config_contactAddress is added to the $config vars for the contact info and a "Contact me" link in the main menu.
Attachments
contactpage.patch.gz
gunzip to use
(1.3 KiB) Downloaded 372 times

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

Re: contact me page

#18 Post by sc0ttman »

efiabruni wrote:I wrote a contact me page for the pe_pplog, which can also be used in this blog. It looks like this. It uses the email address from $config_sendMailWithNewCommentMail and mailto has to be installed. $config_contactAddress is added to the $config vars for the contact info and a "Contact me" link in the main menu.
That's awesome :), great.. Also, have you tested the changes above by jamesbond? Do you they work for you too? If so, I'm gonna add them into 1.5 when its done (with your contact page too)..

:D
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

efiabruni
Posts: 69
Joined: Tue 18 Oct 2011, 15:55

bugfixes

#19 Post by efiabruni »

jamesbonds bugfixes are working for me, I actually never had a problem with the map{} in the archive, I guess it depends on the version of perl?

I noticed that the wysiwyg editor (niceedit) isn't working, apparently it should be:

Code: Select all

<script src="http://js.nicedit.com/nicEdit-latest.js" type="text/javascript"></script>
instead of:

Code: Select all

 <script src="http://js.nicedit.com/nicEdit.js" type="text/javascript"></script>
according to http://niceedit.com

I took it out of my blog completely, so I cannot really test if that is true...

I'm also atm creating a style sheet for mobile devices, would you be interested in that? It does need some more testing, though.

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#20 Post by jamesbond »

Yeah, it could be. Mine is perl 5.14.2 and 5.10.1.

Nicedit works for me. Actually I forgot about it totally and is about to ask whether someone could create bbcode for "colour" and "fontsize", then I saw this post :) Perhaps I should re-activate the html editor, but I still want to the bbcode for the lightbox and and code :( (which is gone once I turned on the html editor).

I created a simple stat like the one in here: https://planet.gnome.org/ ==> scroll to the bottom of the page and you'll see a world map showing where the visits come from. Let me know if any of you are interested. The web server must have "gd" library installed, also "netpbm", and you must have at least 50MB to hold the geocode database in your webspace as the IP address geocoding is done locally - there is no external queries to third party geocoding services :D

EDIT: Need to pull out my above comment about nicedit. It works, yes you can edit and enter text, but the resulting post is not right. That's because of the aggresive quote transformation (" change the " etc). The quote transformation should be disabled when nicedit is used. I'm not sure however how it will impact the field splitting if the transformation is disabled, because a single quote in the blog post can screw up the field numbering ... :cry:
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

Post Reply