Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Series of plugin help questions

Quote Reply
Series of plugin help questions
1) During validation the validation form seems to be printed via Tools.pm, is there a way to make it use the template and call a hook? I have written a plugin, it has a foreign key called VersionID to table called Version, rather than display the VersionID in the validate form I would like to display a drop down of all the versions with the current value selected.

2) I have a hook registered to interrupt jump.cgi and display a page of my own. The problem I have is that it doesn't display the page I want it to. I use the same code elsewhere, the only difference is that one part is called from within the admin dir and the second that doesn't work is called from outside. It 'use's the same files, and seems to have no problems finding them. I can display all the keys and values of the hash ref that I use with a print to the screen but the rest doesn't display.

Here is the basic code:

if($IN->param('ID')) {
# doing stuff in here to the hash ref
# all works fine
}

print $IN->header;
print Links::SiteHTML::display ('detailed', { %$link });

GT::Plugins->action(STOP);

Any help appreciated.

Thanks,

Tommy
Quote Reply
Re: [tommyfotak] Series of plugin help questions In reply to
I'm not sure that I'm fully understanding the problems but

1. The validate form template is validate_form.html

I think that you can use a global rather than a plugin for this.

2. Try print Links::SiteHTML::display ('detailed', $link);

Laura.
The UK High Street

Last edited by:

afinlr: Jul 16, 2002, 12:08 PM
Quote Reply
Re: [afinlr] Series of plugin help questions In reply to
>>
2. Try print Links::SiteHTML::display ('detailed', $link);
<<

You'll just need to add:

require Links::SiteHTML;

...above that I think....and make sure $link is defined.
Quote Reply
Re: [afinlr] Series of plugin help questions In reply to
Answer to 1) I've edited the template, but it doesn't use it, the form is generated in a method within Tools.pm, sub validate_links to be exact.

Maybe it's a config setting somewhere?

On install I do a regex already to edit a line in that file, this is dodgy as I want to keep as much of the original code as possible, so I don't want to directly hack the file if possible. The template is the answer, if only I could make it use it, oh the injustice ...

Will attempt the suggestion for 2.
Quote Reply
Re: [tommyfotak] Series of plugin help questions In reply to
Oh - validate links - I knew I was missing something!

The validate_form template is for the validation of users.

The validate links is done in admin so there wont be a template. I think that its very difficult to change things in admin as there aren't any hooks to tap into. But maybe someone else has an idea.

Sorry I can't help.

Laura.
The UK High Street

Last edited by:

afinlr: Jul 16, 2002, 12:51 PM
Quote Reply
Re: [Paul] Series of plugin help questions In reply to
$link is defined, I can print all the values in it to the screen.

I've tried calling it sending it as $link rather than %$link, doesn't seem to make a difference.

Have used require Links::SiteHTML aswell, still no difference. Will keep investigating. Thanks for all the help.
Quote Reply
Re: [tommyfotak] Series of plugin help questions In reply to
1) you might be able to use the hook "form_link" for this.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Series of plugin help questions In reply to
Isn't it jump_link for jump.cgi?
Quote Reply
Re: [Paul] Series of plugin help questions In reply to
shouldn't it be

use Links::SiteHTML;

rather than require?
The UK High Street
Quote Reply
Re: [afinlr] Series of plugin help questions In reply to
No you'll want to require in a global.
Quote Reply
Re: [Paul] Series of plugin help questions In reply to
Sorry - thought it was a plugin as he was using a hook.
The UK High Street
Quote Reply
Re: [afinlr] Series of plugin help questions In reply to
We were both right :)

I was thinking of your comment in post 2:

>>
I think that you can use a global rather than a plugin for this.
<<
Quote Reply
Re: [Paul] Series of plugin help questions In reply to
Ahh yes, a global, I didn't think of that.
Will try that next.

Thanks people, will let you all know how it goes.
Quote Reply
slowly going insane In reply to
1) how do I call a global? From within scripts and within a template? Can it be done within a template?

2) I have some code registered to run on the delete_link hook, but for the life of me I can't get anything out of the hash. e.g I am doing something like this

sub myFunction {
my($dontcare, $link) = @_;
# want to use $link in here but I can't seem to access anything. eg $link->{ID} doesn't give me anything.
}
Quote Reply
Re: [tommyfotak] slowly going insane In reply to
Hi,

1. Globals are only accessed from within templates, not from within a script.

2. try this, to see what is passed to your sub:
Code:
sub MyFunction {
my (@args) = @_;
use GT::Dumper;
print $IN->header;
print Dumper(\@args);
return @args;
}

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] slowly going insane In reply to
Thanks Yogi.

Now that I see it again I remembe reading about GT::Dumper in the docs.

RTFM Tommy, RTFM.