Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Modify A Resource

Quote Reply
Modify A Resource
I would have expected that after a user logs in and clicks Modify a Resource, that they would be presented with a list of their links and simply choose the one to modify. As it is they have have to remember the exact URL, which some do not type correctly thus generating e-mail that must be delt with.

Quote Reply
Re: Modify A Resource In reply to
I noticed this, too.

It would be nice to have the option like DBMAN to select links from a list to modify. I have this working in Links SQL v.1.11 and I don't think I will upgrade until this type of feature is implemented in the NEXT GENERATION version.

Regards,

Eliot Lee
Quote Reply
Re: Modify A Resource In reply to
This actually shouldn't be too hard to add.

I will be updating the editor/password log in to add the missing features from this 1.1x mod to the 2.0 version. I think the only parts that need to be moved are the changes to the templates, and a subroutine to select the links owned by the current log-in user.



PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ


Quote Reply
Re: Modify A Resource In reply to
I worship the ground you walk on! Thanks!

Quote Reply
Re: Modify A Resource In reply to
I actually hacked something together. It's not perfect, but all it requires is a change to modify.cgi and to the templates.

It's based on the modify.html template in the editor_logon mod I made before. The only change is <%Links%> is now <%User_Links%>, and the columns are different in the output table(and you can change those by editing the routines).


This is the template part of the code, including the "error" handler.

Code:
<%if User_Links%>
<p>Select the link you would like to modify:</p>
<table cellpadding="1" cellspacing="0" border="0">
<tr bgcolor="#000000">
<td>

<table width="100%" cellpadding="5" cellspacing="0" border="0" BGCOLOR="WHITE">
<tr bgcolor="#0066cc" valign="middle">
<td><font face="verdana, arial" color="#ffffff" size="1"><b>ID</b></font></td>
<td align="center"><font face="verdana, arial" color="#ffffff" size="1"><b>Name</b></font></td>
<td align="center"><font face="verdana, arial" color="#ffffff" size="1"><b>Hits</b></font></td>
<td align="center"><font face="verdana, arial" color="#ffffff" size="1"><b>Add Date</b></font></td>
<td align="center"><font face="verdana, arial" color="#ffffff" size="1"><b>Rating</b></font></td>
</tr>
<%User_Links%>
</table>
</td>
</tr>
</table>
<p>
<%if span%>
<%span%>
<%endif%>
</p>
<%endif%>

<%ifnot User_Links%>
<%ifnot ID%>
No Links to Modify!
<%endif%>
<%endif%>

<%if error%>
<%error%>
<%endif%>
You need to make two changes to modify.cgi:

Right after the user authentication, add:

Code:
## generate the page with the users links. If no LinkID is passed in, generate the form.
## at this point we do have a logged in user.
if (!$link_id ) {
my $results = &get_user_links();
print $IN->header();
print Links::SiteHTML::display('modify', { User_Links => $results} );
return;
}
Then, where you have the subroutines.

Code:
sub get_user_links {
# --------------------------------------------------------
# generate the list of users links
#
my $dbh = $DB->table ('Links');
my $results = '' ;
my $links = $dbh->select ({ LinkOwner => $USER->{'Username'} });

($links->rows ) || return ( {error => 'No Links To Modify'} );

while (my $link = $links->fetchrow_hashref){
## $results .= Links::SiteHTML::display ('link', $link);
my $id = $link->{'ID'};
$results .= qq|<TR>
<TD><A HREF=$CFG->{'db_cgi_url'}/modify.cgi?LinkID=$id> $id </A></TD>
<TD>$link->{'Title'}</TD>
<TD>$link->{'Hits'}</TD>
<TD>$link->{'Add_Date'}</TD>
<TD>$link->{'Rating'}</TD>
</TR>
|;
}
return ($results);
}
This isn't complete, or completly debugged, and there are a few things that would be nice to have. Also, while it includes the span pages tags, that is from the old mod, and is not in this one yet.

But, let me know if you get it to work.

I'll probably flesh it out a bit in the next few days.

PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://pugdog.com/FAQ


Quote Reply
Re: Modify A Resource In reply to
This is one feature I would love to have as well. It looks like it didn't get done either. ;(

Quote Reply
Re: Modify A Resource In reply to
I must be missing something.

When a user logs in, they are prompted with a list of their links to modify, or a message saying "No links to modify."

You might need to make sure your templates are all up to date. Make sure you aren't missing any.

Also, unless a link has a LinkOwner listed, it won't be shown.

The system isn't perfect, but if you have people log-in before they can enter links, then when they log in, and click "Modify" they are presented with a list of all their links.



PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum
Quote Reply
Re: Modify A Resource In reply to
If they're using version 2.0.3 (?), I had the same problem with it not displaying the users links, and instead defaulting to stardard modify page.

I just altered this small piece of code at the top of modify.cgi, and now it brings up the list of links for that user fine. I don't know if it's technically correct, but it seems to work. :)

I changed this...

$CFG->{user_required} or $USER and do { _list_owned_links(); last CASE; };

to this...

$USER and do { _list_owned_links(); last CASE; };

Regan.


Quote Reply
Re: Modify A Resource In reply to
What do you suppose causes that?

Quote Reply
Re: Modify A Resource In reply to
I've got NO idea :)

I know just enough to be dangerous. It seemed to be calling the require user call twice in this version. Perhaps Alex could shed some light on this?

Regan.

Quote Reply
Re: Modify A Resource In reply to
By the way.. that seemed to work well. Thank you very much.

Quote Reply
Re: Modify A Resource In reply to
Check your templates 'very carefully' - I know the AV template codes work alright ...

What you are asking seems to work straight out of the box without any hacking etc.

The secret is ... a person must be logged on .. and in the form.txt you use:-

<%if URL%<%URL%<%endif%

etc...

There are also some hidden codes there (in particular %URL%) ones that I missed in the changeover ... but now it is working perfectly.

Regards,


Clint.

--------------------------
http://www.AffiliatesDirectory.com - Affiliate Programs Directory
Quote Reply
Re: Modify A Resource In reply to
Mine was a stock standard fresh install and it didn't work - I installed it 3 times just to make sure.

R

Quote Reply
Re: Modify A Resource In reply to
If we are talking about the modify_select.html template, where after a user logs in they can hit 'modify links' and be presented with a list of their links, I had a similar problem. It turned out that my old template was missing this new line of code:

<table border=0>
<%loop link_results%><tr><td>
<input type=radio name=LinkID value="<%ID%>">
</td></tr><%include link.html%>
<%endloop%>
</table>

Once I put that in, it worked fine.

Bryan

Quote Reply
Re: Modify A Resource In reply to
Call me crazy but why would any directory owner want to convey onto an unknown user the privilege of ownership to a link that he/she happened to submit? Who's to say that they authored the content in the link they submitted? And why would anyone want to expose themselves to having to mediate disputes over true ownership?

In a perfect world this might not be an issue but this is the real world. Think long and hard about choosing to relinquish ownership of links in your directory. It can turn around and bite you.

IMHO

Mark Brasche
http://SurfSafely.com/
Quote Reply
Re: Modify A Resource In reply to
I let the owners of web sites submit links becuase...

A. They fill in more detailed descriptions and treat it more as a marketing exercise which makes the directory more credible.
B. It builds a mailing list of people who 'want' to be there and are potential buyers for other products.
C. It makes them have an afinity with my web site, as they come back to see/change their link and tell others about it.
D. They keep the links up to date and relevant themselves, I just approve or deny them.
E. If a stranger registers a site, and the owner then contacts me, I hand it straight over to the owner - this is a condition on the submission page.

In my limited experience, I have found that the person submitting the link usually has an affinity with the site they're submitting in some way.

But thats just my site, yours may be different.

Cheers

R.

Quote Reply
Re: Modify A Resource In reply to
I hadn't really thought about it, but I intend to give ownership of the site to the person whose email address appears on the site.

Most of my links will be individuals, and I want them to be able to update their own links and descriptions. I feel that they will also be able to categorize themselves better than I can.

I do see your point though, and I think I will make sure that I have some kind of checks in place to prevent fraudelent ownership of links.

Bryan

Quote Reply
Re: Modify A Resource In reply to
Yip, checking their email address is the way I do it usually - I can usually tell straight away as the person who's submitting has an email address that matches the sites domain name. And if you validate the submissions, it only takes a few seconds longer to find it.

R.

Quote Reply
Re: Modify A Resource In reply to
Working solution for Links SQL 2.0.3 (works for me very fine, if you have any bugs respond here)

YOU DON'T NEED to change any cgi-files for giving user a chance to select links before modifying.
Thanks to BrianL - his code is working fine, only you need to modify some things more:
1) This is what you need to place in modify_select.html:

<%if error%>
<%error%>
<%endif%>

<%if next%>
<p align=right><small>Pages: <%next%></small></p>
<%endif%>

<form action="<%db_cgi_url%>/modify.cgi" method=post>
<table border=1 cellpadding=2 cellspacing=0 width=100%>
<%loop link_results%>
<tr><td>
<input type=radio name=LinkID value="<%ID%>"> Check to modify this link:
<%include link_modify.html%>
<%endloop%>
</td></tr>
</table>
<input type=submit value="Modify selected link">
</form>

Of course, + headers +footers and so on... but above is necessary thing.

2) You need to create link_modify.html so modify_select includes not usual link.html file (because "popular", "updated" and "new!" marks are not working correctly with that. In another words, you need to delete all un-usable things from link.html and copy it as link_modify.html.

3) Please, correct the language.txt after that, the 'MODIFY_NOLINKS' vairable. In 2.0.3., it is saying "Sorry, but you do have any links to modify."; in this case, type "Sorry, but you don\'t have any links to modify."

Hope this helps.