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 >
Text File  |  2004-03-08  |  5KB  |  192 lines

  1. <?php if (isset($feedback)) echo $feedback; ?>
  2. <table border=0 cellpadding="2" cellspacing="0">
  3. <tr>
  4.     <td valign="top">
  5.     <table border="0" cellpadding="0" cellspacing="3">
  6.     <tr>
  7.         <td align="right" nowrap>
  8.         <?php echo $strName; ?>*: 
  9.         </td>
  10.         <td>
  11.         <input type="text" class="textbox"  name="name" size="40" value="<?php echo $company['name']; ?>" maxlength="50">
  12.         </td>
  13.     </tr>
  14.  
  15.     <tr>
  16.         <td align="right" nowrap>
  17.         <?php echo $strAddress; ?>: 
  18.         </td>
  19.         <td>
  20.         <input type="text" class="textbox"  name="address" size="40" value="<?php echo $company['address']; ?>" maxlength="100">
  21.         </td>
  22.     </tr>
  23.  
  24.     <tr>
  25.         <td align="right" nowrap>
  26.         <?php echo $strZip; ?>: 
  27.         </td>
  28.         <td>
  29.         <input type="text" class="textbox"  name="zip" size="40" value="<?php echo $company['zip']; ?>" maxlength="10">
  30.         </td>
  31.     </tr>
  32.     <tr>
  33.         <td align="right" nowrap>
  34.         <?php echo $strCity; ?>: 
  35.         </td>
  36.         <td>
  37.         <input type="text" class="textbox"  name="city" size="40" value="<?php echo $company['city']; ?>" maxlength="50">
  38.         </td>
  39.     </tr>
  40.  
  41.  
  42.     <tr>
  43.         <td align="right" nowrap>
  44.         <?php echo $strState; ?>: 
  45.         </td>
  46.         <td>
  47.         <input type="text" class="textbox"  name="state" size="40" value="<?php echo $company['state']; ?>" maxlength="50">
  48.         </td>
  49.     </tr>
  50.  
  51.     <tr>
  52.         <td align="right" nowrap>
  53.         <?php echo $strCountry; ?>: 
  54.         </td>
  55.         <td>
  56.         <input type="text" class="textbox"  name="country" size="40" value="<?php echo $company['country']; ?>" maxlength="50">
  57.         </td>
  58.     </tr>
  59.     <tr>
  60.         <td colspan="2"> </td>
  61.     </tr>
  62.  
  63.     <tr>
  64.         <td align="right" nowrap>
  65.         <?php echo $strPhone; ?>: 
  66.         </td>
  67.         <td>
  68.         <input type="text" class="textbox"  name="phone" size="40" value="<?php echo $company['phone']; ?>" maxlength="20">
  69.         </td>
  70.     </tr>
  71.     <tr>
  72.         <td align="right" nowrap>
  73.         <?php echo $strFax; ?>: 
  74.         </td>
  75.         <td>
  76.         <input type="text" class="textbox"  name="fax" size="40" value="<?php echo $company['fax']; ?>" maxlength="20">
  77.         </td>
  78.     </tr>
  79.     <tr>
  80.         <td align="right" nowrap>
  81.         <?php echo $strEmail; ?>: 
  82.         </td>
  83.         <td>
  84.         <input type="text" class="textbox"  name="email" size="40" value="<?php echo $company['email']; ?>" maxlength="75">
  85.         </td>
  86.     </tr>
  87.     <tr>
  88.         <td align="right" nowrap>
  89.         <?php echo $strHomepage; ?>: 
  90.         </td>
  91.         <td>
  92.         <input type="text" class="textbox"  name="homepage" size="40" value="<?php echo $company['homepage'] ?>" maxlength="100">
  93.         </td>
  94.     </tr>
  95.     <tr>
  96.         <td align="right" nowrap>
  97.         <?php echo $ab_bank_no; ?>: 
  98.         </td>
  99.         <td>
  100.         <input type="text" class="textbox"  name="bank_no" size="40" value="<?php echo $company['bank_no'] ?>" maxlength="20">
  101.         </td>
  102.     </tr>
  103.     <tr>
  104.         <td align="right" nowrap>
  105.         <?php echo $ab_vat_no; ?>: 
  106.         </td>
  107.         <td>
  108.         <input type="text" class="textbox"  name="vat_no" size="40" value="<?php echo $company['vat_no'] ?>" maxlength="30">
  109.         </td>
  110.     </tr>
  111.     <tr>
  112.         <td colspan="2"> </td>
  113.     </tr>
  114.     <?php
  115.     //get all writable user addressbooks and add them to a dropdownbox
  116.     $ab->get_subscribed_addressbooks($GO_SECURITY->user_id);
  117.     $subscribed_addressbooks = new dropbox();
  118.     while ($ab->next_record())
  119.     {
  120.         if ($GO_SECURITY->has_permission($GO_SECURITY->user_id, $ab->f('acl_write')))
  121.         {
  122.             //remember the first ab that is writable
  123.             if(!isset($first_writable_ab))
  124.             {
  125.                 $first_writable_ab = $ab->f('id');
  126.             }
  127.             $subscribed_addressbooks->add_value($ab->f('id'), $ab->f('name'));
  128.  
  129.         }
  130.     }
  131.  
  132.     //get the given addressbook_id
  133.     if ($addressbook_id > 0)
  134.     {
  135.          $addressbook = $ab->get_addressbook($addressbook_id);
  136.     }
  137.  
  138.     //if there was no or a read only addressbook given then change to the first writable
  139.     if (!isset($addressbook) || !$GO_SECURITY->has_permission($GO_SECURITY->user_id, $addressbook['acl_write']))
  140.     {
  141.         //there is no writable addressbook so add one
  142.         if (!isset($first_writable_ab))
  143.         {
  144.             $ab_name = $_SESSION['GO_SESSION']['name'];
  145.             $new_ab_name = $ab_name;
  146.             $x = 1;
  147.             while($ab->get_addressbook_by_name($new_ab_name))
  148.             {
  149.                 $new_ab_name = $ab_name.' ('.$x.')';
  150.                 $x++;
  151.             }
  152.             $addressbook_id = $ab->add_addressbook($GO_SECURITY->user_id, $new_ab_name);
  153.             $subscribed_addressbooks->add_value($addressbook_id, $new_ab_name);
  154.         }else
  155.         {
  156.             $addressbook_id = $first_writable_ab;
  157.         }
  158.     }
  159.  
  160.     //print the writable addressbooks
  161.     echo '<tr><td align="right">'.$ab_addressbook.':</td><td>';
  162.     $subscribed_addressbooks->print_dropbox('addressbook_id', $addressbook_id);
  163.     echo '</td></tr>';
  164.     ?>
  165.     </table>
  166.     </td>
  167. </tr>
  168. <tr heigth="25">
  169.     <td colspan="2">
  170.     <br />
  171.     <?php
  172.     $button = new button($cmdOk, "javascript:_save('save_company','true')");
  173.     echo '  ';
  174.     $button = new button($cmdApply, "javascript:_save('save_company','false')");
  175.     echo '  ';
  176.     $button = new button($cmdClose, "javascript:document.location='".$return_to."'");
  177.     ?>
  178.     </td>
  179. </tr>
  180. </table>
  181. <script type="text/javascript" language="javascript">
  182.  
  183. document.forms[0].name.focus();
  184.  
  185. function _save(task, close)
  186. {
  187.     document.forms[0].task.value = task;
  188.     document.forms[0].close.value = close;
  189.     document.forms[0].submit();
  190. }
  191. </script>
  192.