home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2004 April
/
CMCD0404.ISO
/
Software
/
Freeware
/
Programare
/
groupoffice-com-2.01
/
modules
/
addressbook
/
edit_company.inc
< prev
next >
Wrap
Text File
|
2004-03-08
|
5KB
|
192 lines
<?php if (isset($feedback)) echo $feedback; ?>
<table border=0 cellpadding="2" cellspacing="0">
<tr>
<td valign="top">
<table border="0" cellpadding="0" cellspacing="3">
<tr>
<td align="right" nowrap>
<?php echo $strName; ?>*:
</td>
<td>
<input type="text" class="textbox" name="name" size="40" value="<?php echo $company['name']; ?>" maxlength="50">
</td>
</tr>
<tr>
<td align="right" nowrap>
<?php echo $strAddress; ?>:
</td>
<td>
<input type="text" class="textbox" name="address" size="40" value="<?php echo $company['address']; ?>" maxlength="100">
</td>
</tr>
<tr>
<td align="right" nowrap>
<?php echo $strZip; ?>:
</td>
<td>
<input type="text" class="textbox" name="zip" size="40" value="<?php echo $company['zip']; ?>" maxlength="10">
</td>
</tr>
<tr>
<td align="right" nowrap>
<?php echo $strCity; ?>:
</td>
<td>
<input type="text" class="textbox" name="city" size="40" value="<?php echo $company['city']; ?>" maxlength="50">
</td>
</tr>
<tr>
<td align="right" nowrap>
<?php echo $strState; ?>:
</td>
<td>
<input type="text" class="textbox" name="state" size="40" value="<?php echo $company['state']; ?>" maxlength="50">
</td>
</tr>
<tr>
<td align="right" nowrap>
<?php echo $strCountry; ?>:
</td>
<td>
<input type="text" class="textbox" name="country" size="40" value="<?php echo $company['country']; ?>" maxlength="50">
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td align="right" nowrap>
<?php echo $strPhone; ?>:
</td>
<td>
<input type="text" class="textbox" name="phone" size="40" value="<?php echo $company['phone']; ?>" maxlength="20">
</td>
</tr>
<tr>
<td align="right" nowrap>
<?php echo $strFax; ?>:
</td>
<td>
<input type="text" class="textbox" name="fax" size="40" value="<?php echo $company['fax']; ?>" maxlength="20">
</td>
</tr>
<tr>
<td align="right" nowrap>
<?php echo $strEmail; ?>:
</td>
<td>
<input type="text" class="textbox" name="email" size="40" value="<?php echo $company['email']; ?>" maxlength="75">
</td>
</tr>
<tr>
<td align="right" nowrap>
<?php echo $strHomepage; ?>:
</td>
<td>
<input type="text" class="textbox" name="homepage" size="40" value="<?php echo $company['homepage'] ?>" maxlength="100">
</td>
</tr>
<tr>
<td align="right" nowrap>
<?php echo $ab_bank_no; ?>:
</td>
<td>
<input type="text" class="textbox" name="bank_no" size="40" value="<?php echo $company['bank_no'] ?>" maxlength="20">
</td>
</tr>
<tr>
<td align="right" nowrap>
<?php echo $ab_vat_no; ?>:
</td>
<td>
<input type="text" class="textbox" name="vat_no" size="40" value="<?php echo $company['vat_no'] ?>" maxlength="30">
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<?php
//get all writable user addressbooks and add them to a dropdownbox
$ab->get_subscribed_addressbooks($GO_SECURITY->user_id);
$subscribed_addressbooks = new dropbox();
while ($ab->next_record())
{
if ($GO_SECURITY->has_permission($GO_SECURITY->user_id, $ab->f('acl_write')))
{
//remember the first ab that is writable
if(!isset($first_writable_ab))
{
$first_writable_ab = $ab->f('id');
}
$subscribed_addressbooks->add_value($ab->f('id'), $ab->f('name'));
}
}
//get the given addressbook_id
if ($addressbook_id > 0)
{
$addressbook = $ab->get_addressbook($addressbook_id);
}
//if there was no or a read only addressbook given then change to the first writable
if (!isset($addressbook) || !$GO_SECURITY->has_permission($GO_SECURITY->user_id, $addressbook['acl_write']))
{
//there is no writable addressbook so add one
if (!isset($first_writable_ab))
{
$ab_name = $_SESSION['GO_SESSION']['name'];
$new_ab_name = $ab_name;
$x = 1;
while($ab->get_addressbook_by_name($new_ab_name))
{
$new_ab_name = $ab_name.' ('.$x.')';
$x++;
}
$addressbook_id = $ab->add_addressbook($GO_SECURITY->user_id, $new_ab_name);
$subscribed_addressbooks->add_value($addressbook_id, $new_ab_name);
}else
{
$addressbook_id = $first_writable_ab;
}
}
//print the writable addressbooks
echo '<tr><td align="right">'.$ab_addressbook.':</td><td>';
$subscribed_addressbooks->print_dropbox('addressbook_id', $addressbook_id);
echo '</td></tr>';
?>
</table>
</td>
</tr>
<tr heigth="25">
<td colspan="2">
<br />
<?php
$button = new button($cmdOk, "javascript:_save('save_company','true')");
echo ' ';
$button = new button($cmdApply, "javascript:_save('save_company','false')");
echo ' ';
$button = new button($cmdClose, "javascript:document.location='".$return_to."'");
?>
</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
document.forms[0].name.focus();
function _save(task, close)
{
document.forms[0].task.value = task;
document.forms[0].close.value = close;
document.forms[0].submit();
}
</script>