# ================================================================== # Gossamer Links - enhanced directory management system # # Website : http://gossamer-threads.com/ # Support : http://gossamer-threads.com/scripts/support/ # CVS Info : 087,071,086,086,085 # Revision : $Id: Users.pm,v 1.4 2007/03/22 22:05:44 brewt Exp $ # # Copyright (c) 2001 Gossamer Threads Inc. All Rights Reserved. # Redistribution in part or in whole strictly prohibited. Please # see LICENSE file for full details. # ================================================================== package Links::HTML::Users; # ================================================================== # Handles displaying of forms and HTML. # use strict; use vars qw/@ISA/; use Links qw/:objects/; use GT::SQL::Display::HTML::Table; @ISA = qw/GT::SQL::Display::HTML::Table/; sub display { # ------------------------------------------------------------------- # Displays a link, but passes through the plugin system. # my $self = shift; my $p = ref $_[0] eq 'HASH' ? shift : {@_}; $PLG->dispatch('display_user', sub { $self->SUPER::display(@_) }, $p); } sub form { # ------------------------------------------------------------------- # Displays a user form, but passes through the plugin system. # my $self = shift; my $p = (ref $_[0] eq 'HASH') ? shift : {@_}; $PLG->dispatch('form_user', sub { return $self->SUPER::form(@_) }, $p); } sub _display { # ------------------------------------------------------------------- # Adds on a box with quick links to the users links. # my ($self, $opts) = @_; my $user = $opts->{values}->{Username}; my $output = ''; # If we are modifying, then add a hidden field for the original record. if ($opts->{mode} eq 'modify_form') { $opts->{code}->{Username} ||= \&disp_username; my $user_q = GT::CGI->html_escape($user); $output .= qq~~; } else { delete $self->{code}->{Username}; } $output .= $self->SUPER::_display($opts); if ($user) { my $link_db = $DB->table('Links'); my $count = $link_db->count({ LinkOwner => $user }); my $url = GT::CGI->url({ query_string => 0 }); my $user_q = GT::CGI->escape($user); $output .= <
Links ($count): View | Modify | Delete
HTML } return $output; } sub disp_username { # ------------------------------------------------------------------- # Display the username with links to edit. # my ($self, $col, $rec) = @_; my $val = $rec->{Username}; my $val_e = GT::CGI->html_escape($val); my $font = $self->{font}; return < Username HTML } 1;