Gossamer Forum
Home : Products : Links 2.0 : Customization :

Another ADMIN URL VIEW MOD

Quote Reply
Another ADMIN URL VIEW MOD
Here is another mod for browsing URL's in the Admin Center:

Find sub build_html_record in db_utils_pl :

Origin Version of sub build_html_record
Code:
sub build_html_record {
# --------------------------------------------------------

my (%rec) = @_;
my ($output, $field);

$output = "<p><table border=0 cellpadding=3 cellspacing=1 width=500>\n";
foreach $field (@db_cols) {
next if ($db_form_len{$field} == -1);
$output .= qq~
<tr><td align=right valign=top width=20% bgcolor=#F0F0F0><$font>$field:</font></td>
<td width=80% bgcolor=#F0F0F0><$font>$rec{$field}</font></td></tr>
~;
}
$output .= "</table></p>\n";
return $output;
}


Modified Version :
Code:
sub build_html_record {
# --------------------------------------------------------

my (%rec) = @_;
my ($output, $field);

$output = "<p><table border=0 cellpadding=3 cellspacing=1 width=500>\n";
foreach $field (@db_cols) {
next if ($db_form_len{$field} == -1);

if ($field eq "DownloadURL" or $field eq "Image" ) {
$output .= qq~
<tr><td align=right valign=top width=20% bgcolor="#F0F0F0"><$font><a href="$rec{$field}" target="_blank">$field:</a></font></td>
<td width=80% bgcolor="#F0F0F0"><$font>$rec{$field}</font></td></tr>
~; }

else { $output .= qq~
<tr><td align=right valign=top width=20% bgcolor=#F0F0F0><$font>$field:</font></td>
<td width=80% bgcolor=#F0F0F0><$font>$rec{$field}</font></td></tr>
~; }





}
$output .= "</table></p>\n";
return $output;
}

Explanation:
See attachement - links.def

DownloadURL : contains an url
Image : contains an url (screenshot)

You must modify the code to your requirements.
(English users: I hope the last sentence does not sound not like "Broken English" ... )
(German users: Ihr müsst den Code Schnipsel nur noch an eure Bedürfnisse anpassen)


I know it`s only a small mod - but I hope it is useful.



.


Andreas

Dr.Windows
Supernature Forum







Last edited by:

SevenSpirits: Oct 23, 2007, 4:12 PM
Quote Reply
Re: [SevenSpirits] Another ADMIN URL VIEW MOD In reply to
Here is the modified Code for : sub build_html_record_form in db_utils.pl :

Simply replace the existing subroutine and modify the code to your requirements.


Code:
sub build_html_record_form {
# ---------------------------------------------------------

my ($output, $field, $multiple, $name);
($_[0] eq "multiple") and ($multiple = 1) and shift;
my (%rec) = @_;

$output = "<p><table border=0 cellpadding=3 cellspacing=1 width=500>";


if ($in{'db'} eq 'links') {
exists $db_select_fields{$db_cols[$db_category]}
or ($db_select_fields{$db_cols[$db_category]} = join (",", &category_list));
}
else {
$db_select_fields{'AehnlicheKategorie'} or
($db_select_fields{'AehnlicheKategorie'} = $db_select_fields{'Mult-AehnlicheKategorie'} = join ",", &category_list);
}

foreach $field (@db_cols) {

$multiple ? ($name = "$field-$rec{$db_key}") : ($name = $field);
if ($db_select_fields{"Mult-$field"}) { $output .= "<tr><td align=right valign=top width=20% bgcolor=#F0F0F0><$font>$field:</font></td><td width=80% bgcolor=#F0F0F0><$font>" . &build_select_field($field, $rec{$field}, $name, "MULTIPLE SIZE=7") . "</td></tr>\n"; }
elsif ($db_select_fields{$field}) { $output .= "<tr><td align=right valign=top width=20% bgcolor=#F0F0F0><$font>$field:</font></td><td width=80% bgcolor=#F0F0F0><$font>" . &build_select_field($field, $rec{$field}, $name) . "</td></tr>\n"; }
elsif ($db_radio_fields{$field}) { $output .= "<tr><td align=right valign=top width=20% bgcolor=#F0F0F0><$font>$field:</font></td><td width=80% bgcolor=#F0F0F0><$font>" . &build_radio_field($field, $rec{$field}, $name) . "</td></tr>\n"; }
elsif ($db_checkbox_fields{$field}) { $output .= "<tr><td align=right valign=top width=20% bgcolor=#F0F0F0><$font>$field:</font></td><td width=80% bgcolor=#F0F0F0><$font>" . &build_checkbox_field ($field, $rec{$field}, $name) . "</td></tr>\n"; }
elsif ($db_form_len{$field} =~
/(\d+)x(\d+)/) { $output .= qq~<tr><td align=right valign=top width=20% bgcolor=#F0F0F0><$font>$field:</font></td><td width=80% bgcolor=#F0F0F0><textarea wrap="virtual" name="$name" cols="$1" rows="$2">$rec{$field}</textarea></td></tr>\n~; }
elsif ($db_form_len{$field} == -1) { $output = qq~<input type=hidden name="$field" value="$rec{$field}">\n$output~; }

elsif ($field eq "DownloadURL" or $field eq "Image" ) {
$output .= qq~
<tr><td align=right valign=top width=20% bgcolor="#F0F0F0"><$font><a href="$rec{$field}" target="_blank">$field:</a></font></td>
<td width=80% bgcolor="#F0F0F0"><input type=text name="$name" value="$rec{$field}" size="$db_form_len{$field}" maxlength="$db_lengths{$field}"></td></tr>\n~;
}
else { $output .= qq~<tr><td align=right valign=top width=20% bgcolor="#F0F0F0"><$font>$field:</font></td><td width=80% bgcolor="#F0F0F0"><input type=text name="$name" value="$rec{$field}" size="$db_form_len{$field}" maxlength="$db_lengths{$field}"></td></tr>\n~; }
}
$output .= "</table></p>\n";
return $output;
}


.


Andreas

Dr.Windows
Supernature Forum