Gossamer Forum
Home : Products : DBMan : Customization :

Work Around / Admin - Help!!

(Page 3 of 4)
> > > >
Quote Reply
Re: Now this is wierd... Problem In reply to
 
Hi Mark,

Thanks for quick response but I'm confused with the code you've given me. I need the "inquire" button turned into an image
and the "delete" button turned into an image. How can I do both of them without them both affecting each other. The procedure is shown below. I took out some of the code so it doesn't make this thread even longer!!

sub html_admin_display {
# --------------------------------------------------------
# The displays the list of current users.

my ($message, $user_list, $password, $permissions, $IMVDARef, $CompanyName, $PhysicalAddress, $PostalAddress, $Region, $Phone, $Fax, $CellPhone, $Email, $Website) = @_;

$page_title = "User Management";
# &html_page_top;

$submit_button = "Change Password";

print qq|

<script language="javascript">

function deletedealer(formname) {

if (count == "0") {
alert("The Membership Number must be verified. Please click 'Get Details'")
count = 0;
return false;
}

if (window.document.formname.password.value == "") {
alert("The IMVDA Membership Number must be verified. Please click 'Get Details'")
count = 0;
return false;
}
else {

if (confirm("Are you sure you want to delete: $CompanyName? Doing so will remove all $CompanyName 's records!"))
{
if(confirm("Are you really sure? Once you've done this $CompanyName 's data will be lost for good!"))
{
return true;
}
else
{
return false;
}
}
else {
return false;
}
}

}

function count() {

var count = 0;
count = 1;


}

</script>

<html>
<title></title>
<body bgcolor="#000000" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FF0000">
<div align="center">
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td height="10" align="right">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="bottom">
<td width="16"><a href=""><img src="images/b_login_ta.gif" width="16" height="16" name="bd_login" border="0"></a>

<img src="images/transparent.gif" width="16" height="2" name="spacer"></td>
<td><a href=""><img src="images/b_logoff_t.gif" width="162" height="7" name="b_login" border="0"></a>

<img src="images/transparent.gif" width="100" height="3" name="spacer"></td>
<td align="right"><img src="images/inx_welcome.gif" width="294" height="7" name="welcome">

<img src="images/transparent.gif" width="294" height="3" name="spacer"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><img src="images/white.gif" width="600" height="1" name="line_1"></td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0" background="images/h_main.jpg" height="49">
<tr>
<td width="82%" valign="bottom"><img src="images/t_deletedealer.gif" width="230" height="20"></td>
<td align="right" nowrap width="18%"><img src="images/logo.gif" width="109" height="40" name="logo"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><img src="images/white.gif" width="600" height="1" name="line_2"></td>
</tr>
<tr>
<td> <img src="images/transparent.gif" width="599" height="7" name="spacer"><img src="images/white.gif" width="1" height="7">

<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="100%">
<div align="justify">
<form action="$db_script_url" method="POST" name="formname">
<input type=hidden name="db" value="$db_setup">
<input type=hidden name="uid" value="$db_uid">
<input type=hidden name="admin_display" value="1">

<font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="red"><b>$message</b></font>

<font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">
Select a dealer to delete:</font>
<font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">




<table>

<tr>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">Dealer Username Listing:</td>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">$user_list</td>
</tr>

<tr>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">Membership #:</td>
<td><input type="type" name="password" value="$password" size="14">
<input type=submit name=inquire value="Get Details" onclick="return count()"></td>
</tr>

</table>




<table>

<tr>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">Company Name:</td>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">$CompanyName</td>
</tr>

<tr>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">Physical Address:</td>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">$PhysicalAddress</td>
</tr>

<tr>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">Postal Address:</td>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">$PostalAddress</td>
</tr>

<tr>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">Region:</td>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">$Region</td>
</tr>

<tr>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">Phone:</td>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">$Phone</td>
</tr>

<tr>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">Fax:</td>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">$Fax</td>
</tr>

<tr>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">CellPhone:</td>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">$CellPhone</td>
</tr>

<tr>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">Email:</td>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">$Email</td>
</tr>

<tr>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">Website:</td>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">$Website</td>
</tr>

</table>


<table>

<tr>

<td>
<a href="#" onClick="deletedealer('delete');"><img src="b_delete.gif" border="0"></a>
</td>



</form>

Quote Reply
Re: Now this is wierd... Problem In reply to
Ok, ok... we can work this... Smile

The code given enables you to use an image as a submit form. The problem with the admin form is we have 3 very different "submit" buttons that do separate things.

Depending on which button we press, a certain value has to be passed to DBMan, which we can't do using the current method.

You tried using a TYPE="hidden" field, which works, but now "Delete" is always set to true, which is why it deletes the user no matter what you press.

Sooooooo, taking the code I posted earlier, tweak the variable, add some hiddens to the form, and hopefully we'll be set:
Code:

<script language="javascript">
<!--
function deletedealer(formfield) {
if ((formfield == 'inquire') \|\| (confirm("Are you sure you want to delete: $CompanyName?
Doing so will remove all $CompanyName's records!"))) {
if((formfield == 'inquire') \|\| (confirm("Are you really sure? Once you've done this
$CompanyName's data will be lost for good!"))) {
document.admin[formfield].value = "1";
document.forms["admin"].submit();

} else {
return false;
}
} else {
return false;
}
}
//-->
</script>

<form name="admin" etc...>
... form...
<input type="hidden" name="delete" value="">
<input type="hidden" name="inquire" value="">
<a href="#" onClick="deletedealer('delete');">
<img src="images/b_delete.gif" border="0"></a>
<a href="#" onClick="deletedealer('inquire');">
<img src="images/b_inquire.gif" border="0"></a>

... form ...
</form>
So, now when we click an image, we set the appropriate field (inquire or delete) to true, then submit the form.
(I hope Smile)

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: Now this is wierd... Problem In reply to
In Reply To:
Ok, ok... we can work this...
Cool

In Reply To:
You tried using a TYPE="hidden" field, which works, but now "Delete" is always set to true, which is why it deletes the user no matter what you press.
Oh ok. I thought it might be something like that.

In Reply To:
So, now when we click an image, we set the appropriate field (inquire or delete) to true, then submit the form. (I hope )
Great. I don't have access to my script until first thing Monday so I'll try out the code then.

One question though what is formfield?

Thanks again Mark!!!! Smile





Quote Reply
Re: Now this is wierd... Problem In reply to
It's just what I called the JavaScript variable.

When you click a link, it assigns whatever you put in onClick="deletedealer('HERE'); to "formfield", which is then used by the script.

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: Now this is wierd... Problem In reply to
Ok then.

Thanks Smile

Quote Reply
Re: Now this is wierd... Problem In reply to
It still won't work Mark Frown. It just brings up the "delete" confirm boxes as soon
as you click the "inquire" image instead of bringing up the "company name", etc.

I noticed that the code you gave me doesn't include anything about the inquire function in the javascript procedure? Is there something that needs to be included there?

Any further ideas?

The updated code is shown in the post below:

Quote Reply
Re: Now this is wierd... Problem In reply to
The code can be viewed here: http://server5.hypermart.net/philipclark/admin.txt
Quote Reply
Re: Now this is wierd... Problem In reply to
D'OH, forgot about that Smile

It should still work, you'll just have to confirm each time...
annoying I know, so I've updated my code above Wink

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: Now this is wierd... Problem In reply to
Ok thanks Mark Smile

I'll try the code out in the morning and let you know. Smile

Quote Reply
Re: Now this is wierd... Problem In reply to
The code http://server5.hypermart.net/philipclark/admin1.txt
still won't work. It brings up the following error:

CGI ERROR
==========================================
Error Message : Error loading required libraries.
Check that they exist, permissions are set correctly and that they compile.
Reason: syntax error at ./item_html.pl line 7164, near ")) "
Can't use subscript on constant item at ./item_html.pl line 7168, near ""admin"]"
syntax error at ./item_html.pl line 7170, near "else"

With your latest code where is the section for "delete"?

Seems as though we're nearly there though Smile

Quote Reply
Re: Now this is wierd... Problem In reply to
It's those damn pipes I'll bet... Mad

Try escaping the pipes in the javascript "or" ("||") statement.

(code updated above...)

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: Now this is wierd... Problem In reply to
Thanks for bearing with me Mark Smile

I'll try the code out in the morning and let you know.

I didn't think this would be that hard Shocked

Quote Reply
Re: Now this is wierd... Problem In reply to
In Reply To:
Thanks for bearing with me Mark
No, thank *you* for bearing with *me* Wink

In Reply To:
I didn't think this would be that hard
Normally it wouldn't be, but the admin form in DBMan is a special case.
(As I talked about in my post with the JS code)

Ahh well, slow and steady wins the race Smile

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: Now this is wierd... Problem In reply to
Cheers

Ok.

BREW, BREW, BREW... WINS THE MELBOURNE CUP!!!

Quote Reply
Re: Now this is wierd... Problem In reply to
Quote Reply
Re: Now this is wierd... Problem In reply to
 

Quote Reply
Re: Now this is wierd... Problem In reply to
 

Quote Reply
Re: Now this is wierd... Problem In reply to
Quote Reply
Re: Now this is wierd... Problem In reply to
 

Quote Reply
Re: Linking problem between default.pass/users.cfg In reply to
I'm running into problems with this modification Mark in terms of when you created it, you told me that a link was needed between "default.pass" and "users.cfg" and I gave you the "password" field and the "ref number" field as the two linking fields.

Well where I'm having problems is that it's now impossible to change the password or the ref number because if I do it will break the link between the two files thus not allowing you to remove the dealer.

Can we change this modification to have the link as a simple Autonumber sort of thing, i.e. a PasswordID value that sits in "default.pass" and "users.cfg" and it creates the link between the two files ... It would then allow my users to change their password and change their Reference number without me not being able to delete them later.

Can you help me solve this please Mark?

If you need any more information or need to have a look at any of my files please let me know.

Quote Reply
Re: Linking problem between default.pass/users.cfg In reply to
Hi Mark,

Can you please, pretty please help me with this.

Quote Reply
Re: Linking problem between default.pass/users.cfg In reply to
Hey Philip,

I think at one point we were talking about changing the password in both files, but an ID field would be the way to go.

The code we put together should'nt be to difficuly to change over either.

If you'd like to set up the ID, I'd be happy to help change the code over.

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: Linking problem between default.pass/users.cfg In reply to
Hi Mark,

Thanks for responding. Smile

Should I setup a field in "users.cfg" called "PasswordID" that we can use?

Quote Reply
Re: Linking problem between default.pass/users.cfg In reply to
I've just created a "PasswordID" field in "users.cfg" which is shown below:


%db_def = (

'PasswordID' => [0, 'alpha', 20, 255, 1, '', ''],
'UserID' => [1, 'alpha', 20, 255, 1, '', ''],
'IMVDAMembershipNumber' => [2, 'alpha', 20, 30, 1, '', ''], 'CompanyName' => [3, 'alpha', 20, 50, 1, '', ''],
'PhysicalAddress' => [4, 'alpha', 40x3, 255, 0, '', ''],
'PostalAddress' => [5, 'alpha', 40x3, 255, 0, '', ''],
'Region' => [6, 'alpha', 20, 255, 1, '', ''],
'DealerDescription' => [7, 'alpha', 40x3, 255, 0, '', ''],
'Phone' => [8, 'alpha', 20, 15, 0, '', ''],
'Fax' => [9, 'alpha', 20, 15, 0, '', ''],
'CellPhone' => [10, 'alpha', 20, 15, 0, '', ''],
'Email' => [11, 'alpha', 20, 60, 0, '', '.+@.+..+'],
'Website' => [12, 'alpha', 20, 60, 0, 'http://', ''],
'DealerFilename' => [13, 'alpha', 0, 255, 0, '', ''],
'DealerGraphic' => [14, 'alpha', 0, 3, 0, '', 'Yes']
);


Is that what you needed?

Quote Reply
Re: Linking problem between default.pass/users.cfg In reply to
If you could spend a little of your time helping me fixing this up over the next 2 days I'd really appreciate it as I'm going away early next week.

If not well it isn't a huge big deal but it would be nice Smile



> > > >