Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Preview Post

Quote Reply
Preview Post
Has anyone found a way to preview posts before they are submitted?
Quote Reply
Re: [jgkiefer] Preview Post In reply to
I also wanted users to be able to preview and make changes as they were submitting new links, and before I had a chance to validate them. The way I did it isn't very elegant, but it works for me.

I added a new field to my Links database called 'Active' and set the default value as 'Yes'. Then in modify.pm, in the section: sub _list_owned_links {

I changed:

Code:
my $sth = $link_db->select ( { LinkOwner => $USER->{Username}, isValidated => 'Yes' });


to

Code:
my $sth = $link_db->select ( { LinkOwner => $USER->{Username}, Active => 'Yes' });


This just allows users to modify their links, even if they aren't validated yet.

Then on the modify_success.html and add_success.html templates I include the tags similar to the link.html template, so that it would preview for them how the link would actually look on the directory, and I also include a link to the modify.cgi in case they want to make immediate changes.

That way, after a user submits a new link, they will see how it looks on the add_success.html page. Then if they want to make a change (eventhough it hasn't been validated yet), they can click on the link to modify, and they can then make the changes, and see how it looks on the modify_success.html page.

I'm sure there must be a way to change modify.pm without having to add the field 'Active', but whenever I tried, it would no longer work for me. There's probably a much better or easier way to do this, but I'm just including this in case it's helpful.

--Frank
Quote Reply
Re: [jgkiefer] Preview Post In reply to
Posts?

Do you mean link submissions?

I think there is a plugin somehwere for this.
Quote Reply
Re: [Paul] Preview Post In reply to
In Reply To:
Posts?

Do you mean link submissions?

I think there is a plugin somehwere for this.


yes link submissions. A plugin? I must have overlooked it. Could anyone direct me to this plugin?
Quote Reply
Re: [FrankM] Preview Post In reply to
In Reply To:

I'm sure there must be a way to change modify.pm without having to add the field 'Active', but whenever I tried, it would no longer work for me. There's probably a much better or easier way to do this, but I'm just including this in case it's helpful.

--Frank


Thanks Frank, I will give it a try if I can't find the plugin.
Quote Reply
Re: [jgkiefer] Preview Post In reply to
I have a plugin for this, but it's not quite ready yet.

The main problem is that there are two things to be previewed: how a link looks on the category page, and how a detailed page.

If you have detailed pages, you might want to open the preview in a different window, which complicates things...

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [jgkiefer] Preview Post In reply to
My Xtended Add.Modify.Delete plugin (XAMD) has the preview feature implemented already.
The only problem is, that the plugin will be not released for a while... Read more about release plans in the mentioned thread.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Preview Post In reply to
Excellent. I'll refer to the thread started in Aug 2002. I don't know how much longer I can keep the adrenaline pumping around my frail body as I wait for the latest news of these plugins!!!
Quote Reply
Re: [yogi] Preview Post In reply to
Hi Yogi,

Why not simply print on the same preview page how the link looks on the category page (on the top of the preview page) and how it look on detailed page (on the bottom of the preview page)? It would be simple and do the job.

When do you plan to release your plugin? I really need this one... Unsure

Thank you.

François
Post deleted by Franco In reply to

Last edited by:

Franco: Aug 23, 2003, 9:20 AM
Quote Reply
Re: [jgkiefer] Preview Post In reply to
This is a bit dusty, but if you want a preview plugin, I think I have one.

All you need to do is offer preview/submit options, and if preview, you simply take the information, and return it to the page, and give the author a chance to preview or submit.

I actually simply changed the code in add.pm to allow this, and changed the template to allow a preview mode and edit or a submit. The only complexity was really getting the <%IF%> tags in the templates to work right.

It's *NOT* hard, and many people have had something like this implemented since Links SQL 1.1

Do you still need this?

I did not allow preview of the detailed page, but I can probably set up a link that will allow detail_page.cgi to display a dummy detail_page in a pop up window.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [Franco] Preview Post In reply to
Hi,

To preview link.html and detailed.html inside another page, you need to make some code changes, and not only get some variables yourself, but you need to us a different template to get rid of the extra <html> and <head> tags, and such, which can really destroy some browsers.

If you use a modular format, and include your blocks of code into main templates, this shouldn't be too hard or error prone, but you still need to edit add.cgi/pm to get some variables that are only availabel on the detailed or link page.

Simply previewing the data a user types in, with a chance to re-edit it, is [almost] trivial as posted in the previous note.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [FrankM] Preview Post In reply to
Well it only took be how long to finally get around to adding this... six months or so Tongue.

Thank you FrankM. This little hack isn't pretty, but it works very well and it was relatively easy to setup.

The preview post function should be written into the LSQL core program. IMOP.
Quote Reply
Re: [FrankM] Preview Post In reply to
Code:
I'm sure there must be a way to change modify.pm without having to add the field 'Active', but whenever I tried, it would no longer work for me. There's probably a much better or easier way to do this, but I'm just including this in case it's helpful.

my $sth = $link_db->select ( { LinkOwner => $USER->{Username} } );

Should work.

But, using the field "Active" gives you a way of "blocking" links if you want to at some point, if you want to.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Preview Post In reply to
Thanks very much pugdog. I was leaving out an '}' which was causing the problem for me. Didn't realize the obvious until I saw your post.

-Frank
Quote Reply
Re: [jgkiefer] Preview Post In reply to
Has anyone made a plugin for this yet? If not will this method still work for v3?
Quote Reply
Re: [jgkiefer] Preview Post In reply to
If I change:
Code:
my $sth = $link_db->select ( { LinkOwner => $USER->{Username}, isValidated => 'Yes' });
to
Code:
my $sth = $link_db->select ( { LinkOwner => $USER->{Username}, Active => 'Yes' });

Auto-update will overwrite the changed file anyone have a solution for this?