Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 21 Dec 2014, 19:24
All times are UTC - 4
 Forum index » Advanced Topics » Puppy Projects
SJPPLOG - Scotts jQuery PPLOG
Moderators: Flash, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 3 Posts_count   Goto page: 1, 2, 3 Next
Author Message
sc0ttman


Joined: 16 Sep 2009
Posts: 2387
Location: UK

PostPosted: Fri 04 Mar 2011, 19:24    Post_subject:  SJPPLOG - Scotts jQuery PPLOG
Sub_title: an updated, pretty blog script
 

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.

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search
Back to top
View user's profile Send_private_message 
sc0ttman


Joined: 16 Sep 2009
Posts: 2387
Location: UK

PostPosted: Wed 20 Feb 2013, 17:20    Post_subject:  

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...
example.png
 Description   
 Filesize   53.64 KB
 Viewed   1714 Time(s)

example.png

sjpplog-1.2c-akita.pet
Description 
pet

 Download 
Filename  sjpplog-1.2c-akita.pet 
Filesize  225.79 KB 
Downloaded  507 Time(s) 

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search
Back to top
View user's profile Send_private_message 
sc0ttman


Joined: 16 Sep 2009
Posts: 2387
Location: UK

PostPosted: Sat 02 Mar 2013, 18:45    Post_subject:  

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?viewDetailed=00000#20130302220922


Code:
--- /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:


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:
print '<a id="anchor" name="'.$anchor.'"></a>Posted on <b>'.$date.'</b> by <b>'.$author.'</b><br /><i>'.$title.'</i><br />'; #020313
to
Code:
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..

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search
Back to top
View user's profile Send_private_message 
sc0ttman


Joined: 16 Sep 2009
Posts: 2387
Location: UK

PostPosted: Sun 03 Mar 2013, 05:06    Post_subject:  

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 icon next to comment headers, so users can ge the url for that specific comment
- removed additional stylesheets
sjpplog-1.3-akita.pet
Description  contains the blog itself, inc an example image (~40kb)
pet

 Download 
Filename  sjpplog-1.3-akita.pet 
Filesize  85.92 KB 
Downloaded  480 Time(s) 
sjpplog_DEV-1.3-akita.pet
Description  contains the jQuery scripts: jquery 141, prettify, prettyphoto, jquery-syntaxhighlighter (not required)
pet

 Download 
Filename  sjpplog_DEV-1.3-akita.pet 
Filesize  67.99 KB 
Downloaded  472 Time(s) 

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search
Back to top
View user's profile Send_private_message 
jamesbond

Joined: 26 Feb 2007
Posts: 2232
Location: The Blue Marble

PostPosted: Sun 03 Mar 2013, 21:57    Post_subject:  

Thank you for the update Very Happy
_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send_private_message 
efiabruni

Joined: 18 Oct 2011
Posts: 69

PostPosted: Tue 05 Mar 2013, 21:23    Post_subject: file path problems
Sub_title: problem with defining file paths for images, thumbnails and jQuery stuff
 

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.
Back to top
View user's profile Send_private_message 
sc0ttman


Joined: 16 Sep 2009
Posts: 2387
Location: UK

PostPosted: Thu 07 Mar 2013, 14:50    Post_subject: Re: file path problems
Sub_title: problem with defining file paths for images, thumbnails and jQuery stuff
 

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..

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search
Back to top
View user's profile Send_private_message 
efiabruni

Joined: 18 Oct 2011
Posts: 69

PostPosted: Wed 13 Mar 2013, 19:02    Post_subject: path
Sub_title: worked
 

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....
Back to top
View user's profile Send_private_message 
jamesbond

Joined: 26 Feb 2007
Posts: 2232
Location: The Blue Marble

PostPosted: Fri 22 Mar 2013, 04:53    Post_subject:  

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 .

cheers!

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send_private_message 
sc0ttman


Joined: 16 Sep 2009
Posts: 2387
Location: UK

PostPosted: Fri 22 Mar 2013, 06:27    Post_subject:  

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 .

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 Wink ) ... 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! Rolling Eyes Damn it..

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search
Back to top
View user's profile Send_private_message 
jamesbond

Joined: 26 Feb 2007
Posts: 2232
Location: The Blue Marble

PostPosted: Sat 23 Mar 2013, 01:58    Post_subject:  

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 Laughing ").

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

cheers!
quote-fix.patch.gz
Description  This is a real gzip file, gunzip first to use. Patch for index.pl of sjpplog 1.3
gz

 Download 
Filename  quote-fix.patch.gz 
Filesize  572 Bytes 
Downloaded  392 Time(s) 

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send_private_message 
efiabruni

Joined: 18 Oct 2011
Posts: 69

PostPosted: Sun 24 Mar 2013, 21:42    Post_subject: the quote problem
Sub_title: split(/'/, $_);
 

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..
Back to top
View user's profile Send_private_message 
efiabruni

Joined: 18 Oct 2011
Posts: 69

PostPosted: Sun 24 Mar 2013, 22:30    Post_subject: Nevermind  

I managed to open the patch. Smile
Back to top
View user's profile Send_private_message 
efiabruni

Joined: 18 Oct 2011
Posts: 69

PostPosted: Mon 13 May 2013, 14:46    Post_subject: archive and categories  

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!
categories.patch.gz
Description 
gz

 Download 
Filename  categories.patch.gz 
Filesize  1.09 KB 
Downloaded  322 Time(s) 
archive.patch.gz
Description 
gz

 Download 
Filename  archive.patch.gz 
Filesize  1.32 KB 
Downloaded  302 Time(s) 
Back to top
View user's profile Send_private_message 
sc0ttman


Joined: 16 Sep 2009
Posts: 2387
Location: UK

PostPosted: Mon 20 May 2013, 13:44    Post_subject: SJPPLOG 1.4  

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
sjpplog-1.4-akita.pet
Description  bugfixes and new features (thanks to efiabruni and jamesbond)
pet

 Download 
Filename  sjpplog-1.4-akita.pet 
Filesize  86.6 KB 
Downloaded  298 Time(s) 

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 3 Posts_count   Goto page: 1, 2, 3 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Puppy Projects
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1036s ][ Queries: 13 (0.0059s) ][ GZIP on ]