Code

Moved addressbook
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 16 Jan 2008 13:30:50 +0000 (13:30 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 16 Jan 2008 13:30:50 +0000 (13:30 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8391 594d385d-05f5-0310-b6e9-bd551577e9d8

14 files changed:
gosa-core/plugins/addons/addressbook/address_edit.tpl [deleted file]
gosa-core/plugins/addons/addressbook/address_info.tpl [deleted file]
gosa-core/plugins/addons/addressbook/class_addressbook.inc [deleted file]
gosa-core/plugins/addons/addressbook/contents.tpl [deleted file]
gosa-core/plugins/addons/addressbook/dial.tpl [deleted file]
gosa-core/plugins/addons/addressbook/main.inc [deleted file]
gosa-core/plugins/addons/addressbook/remove.tpl [deleted file]
gosa-plugins/addressbook/address_edit.tpl [new file with mode: 0644]
gosa-plugins/addressbook/address_info.tpl [new file with mode: 0644]
gosa-plugins/addressbook/class_addressbook.inc [new file with mode: 0644]
gosa-plugins/addressbook/contents.tpl [new file with mode: 0644]
gosa-plugins/addressbook/dial.tpl [new file with mode: 0644]
gosa-plugins/addressbook/main.inc [new file with mode: 0644]
gosa-plugins/addressbook/remove.tpl [new file with mode: 0644]

diff --git a/gosa-core/plugins/addons/addressbook/address_edit.tpl b/gosa-core/plugins/addons/addressbook/address_edit.tpl
deleted file mode 100644 (file)
index 8b51230..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;" cellpadding=4 cellspacing=0 border=0>
-       <tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
-               <td align=left width="100%">
-                       <LABEL for="storage_base">
-                               {$storage_info}
-                       </LABEL>
-                       <select id="storage_base" name="storage_base" size="1" title="{t}Choose the department to store entry in{/t}">
-                               {html_options options=$deplist selected=$storage_base}
-                       </select>
-               </td>
-               <td>
-                       <a href="{$url}">
-                               X
-                       </a>
-               </td>
-       </tr>
-       <tr style="background-color: white">
-               <td colspan=2>
-                       <table summary="" width="100%" cellspacing=2 cellpadding=4>
-                               <tr>
-                                       <td style="width:50%; vertical-align:top; background-color: #F0F0F0">
-                                               <h2>
-                                                       <img class="center" alt="" src="{$personal_image}" align=middle>
-                                                               &nbsp;{t}Personal{/t}
-                                               </h2>
-                                               <table summary="" width="100%">
-                                                       <tr>
-                                                               <td>
-                                                                       <LABEL for="sn">
-                                                                               {t}Last name{/t}{$must}
-                                                                       </LABEL>, 
-                                                                       <LABEL for="givenName">
-                                                                               {t}First name{/t}{$must}
-                                                                       </LABEL>
-                                                               </td>
-                                                               <td>
-{render acl=$snACL}    
-                                                                       <input id="sn" name="sn" size=10 maxlength=60 value="{$info_sn}">, 
-{/render}
-{render acl=$givenNameACL}
-                                                                       <input id="givenName" name="givenName" size=10 maxlength=60 value="{$info_givenName}">
-{/render}
-                                                               <td>
-                                                       </tr>
-                                                       <tr>
-                                                               <td>
-                                                                       <LABEL for="initials">
-                                                                               {t}Initials{/t}
-                                                                       </LABEL>
-                                                               </td>
-                                                               <td>
-{render acl=$initialsACL}
-                                                                       <input id="initials" name="initials" size=5 maxlength=20 value="{$info_initials}">
-{/render}
-                                                               </td>
-                                                       </tr>
-                                                       <tr>
-                                                               <td>
-                                                                       <LABEL for="title">
-                                                                               {t}Personal title{/t}
-                                                                       </LABEL>
-                                                               </td>
-                                                               <td>
-{render acl=$titleACL}
-                                                                       <input id="title" name="title" size=10 maxlength=20 value="{$info_title}">
-{/render}
-                                                               </td>
-                                                       </tr>
-                                               </table>
-                                       </td>
-                                       <td style="width:50%; vertical-align:top;background-color:#E8E8E8">
-                                               <h2>
-                                                       <img class="center" alt="" src="{$home_image}" align=middle>
-                                                       &nbsp;{t}Private{/t}
-                                               </h2>
-                                               <table summary="" width="100%">
-                                                       <tr>
-                                                               <td>
-                                                                       <LABEL for="homePostalAddress">
-                                                                               {t}Address{/t}
-                                                                       </LABEL>
-                                                               <br>
-                                                               <br>
-                                                               </td>
-                                                               <td style="vertical-align:top;">
-{render acl=$homePostalAddressACL}
-                                                                       <textarea id="homePostalAddress" name="homePostalAddress" rows=1 cols=20>{$info_homePostalAddress}</textarea>
-{/render}
-                                                               </td>
-                                                       </tr>
-                                                       <tr>
-                                                               <td>
-                                                                       <LABEL for="homePhone">
-                                                                               {t}Phone{/t}
-                                                                       </LABEL>
-                                                               </td>
-                                                               <td>
-{render acl=$homePhoneACL}
-                                                                       <input id="homePhone" name="homePhone" size=15 maxlength=60 value="{$info_homePhone}">
-{/render}
-                                                               </td>
-                                                       </tr>
-                                                       <tr>
-                                                               <td>
-                                                                       <LABEL for="mobile">
-                                                                               {t}Mobile{/t}
-                                                                       </LABEL>
-                                                               </td>
-                                                               <td>
-{render acl=$mobileACL}
-                                                                       <input id="mobile" name="mobile" size=15 maxlength=60 value="{$info_mobile}">
-{/render}
-                                                               </td>
-                                                       </tr>
-                                                       <tr>
-                                                               <td>
-                                                                       <LABEL for="mail">
-                                                                               {t}Email{/t}
-                                                                       </LABEL>
-                                                               </td>
-                                                               <td>
-{render acl=$mailACL}
-                                                                       <input id="mail" name="mail" size=15 maxlength=60 value="{$info_mail}">
-{/render}
-                                                               </td>
-                                                       </tr>
-                                                </table>
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td style="width:100%; vertical-align:top; background-color: #E4E4E4" colspan=2>
-                                               <h2>
-                                                       <img class="center" alt="" src="{$company_image}" align=middle>
-                                                       &nbsp;{t}Organizational{/t}
-                                               </h2>
-                                               <table summary="" width="100%">
-                                                       <tr>
-                                                               <td>
-                                                                       <table summary="" width="100%">
-                                                                               <tr>
-                                                                                       <td>
-                                                                                               <LABEL for="">  
-                                                                                                       {t}Company{/t}
-                                                                                               </LABEL>
-                                                                                       </td>
-                                                                                       <td>
-{render acl=$oACL}
-                                                                                               <input id="o" name="o" size=15 maxlength=60 value="{$info_o}">
-{/render}
-                                                                                       </td>
-                                                                               </tr>
-                                                                               <tr>
-                                                                                       <td>
-                                                                                               <LABEL for="">
-                                                                                                       {t}Department{/t}
-                                                                                               </LABEL>
-                                                                                       </td>
-                                                                                       <td>
-{render acl=$ouACL}
-                                                                                               <input id="ou" name="ou" size=15 maxlength=60 value="{$info_ou}">
-{/render}
-                                                                                       </td>
-                                                                               </tr>
-                                                                               <tr>
-                                                                                       <td>
-                                                                                               <LABEL for="">
-                                                                                                       {t}City{/t}
-                                                                                               </LABEL>
-                                                                                       </td>
-                                                                                       <td>
-{render acl=$lACL}
-                                                                                               <input id="l" name="l" size=15 maxlength=60 value="{$info_l}">
-{/render}
-                                                                                       </td>
-                                                                               </tr>
-                                                                               <tr>
-                                                                                       <td>
-                                                                                               <LABEL for="">
-                                                                                                       {t}Postal code{/t}
-                                                                                               </LABEL>
-                                                                                       </td>
-                                                                                       <td>
-{render acl=$postalCodeACL}
-                                                                                               <input id="postalCode" name="postalCode" size=15 maxlength=60 value="{$info_postalCode}">
-{/render}
-                                                                                       </td>
-                                                                               </tr>
-                                                                               <tr>
-                                                                                       <td>
-                                                                                               <LABEL for="">
-                                                                                                       {t}Country{/t}
-                                                                                               </LABEL>
-                                                                                       </td>
-                                                                                       <td>
-{render acl=$stACL}
-                                                                                               <input id="st" name="st" size=15 maxlength=60 value="{$info_st}">
-{/render}
-                                                                                       </td>
-                                                                               </tr>
-                                                                       </table>
-                                                                       </td>
-                                                                       <td style="vertical-align:top">
-                                                                       <table summary="" width="100%">
-                                                                               <tr>
-                                                                                       <td>
-                                                                                               <LABEL for="">
-                                                                                                       {t}Address{/t}
-                                                                                               </LABEL>
-                                                                                               <br>
-                                                                                               <br>
-                                                                                       </td>
-                                                                                       <td style="vertical-align:top;">
-{render acl=$postalAddressACL}
-                                                                                               <textarea id="postalAddress" name="postalAddress" rows=1 cols=20 >{$info_postalAddress}</textarea>
-{/render}
-                                                                                       </td>
-                                                                               </tr>
-                                                                               <tr>
-                                                                                       <td>
-                                                                                               <LABEL for="">
-                                                                                                       {t}Phone{/t}    
-                                                                                               </LABEL>
-                                                                                       </td>
-                                                                                       <td>
-{render acl=$telephoneNumberACL}
-                                                                                               <input id="telephoneNumber" name="telephoneNumber" size=15 maxlength=60 value="{$info_telephoneNumber}">
-{/render}
-                                                                                       </td>
-                                                                               </tr>
-                                                                               <tr>
-                                                                                       <td>
-                                                                                               <LABEL for="">
-                                                                                                       {t}FAX{/t}
-                                                                                               </LABEL>
-                                                                                       </td>
-                                                                                       <td>
-{render acl=$facsimileTelephoneNumberACL}
-                                                                                               <input id="facsimileTelephoneNumber" name="facsimileTelephoneNumber"
-                                                                                                       size=15 maxlength=60 value="{$info_facsimileTelephoneNumber}">
-{/render}
-                                                                                       </td>
-                                                                               </tr>
-                                                                               <tr>
-                                                                                       <td>
-                                                                                               <LABEL for="">
-                                                                                                       {t}Pager{/t}
-                                                                                               </LABEL>
-                                                                                       </td>
-                                                                                       <td>
-{render acl=$pagerACL}
-                                                                                               <input id="pager" name="pager" size=15 maxlength=60 value="{$info_pager}">
-{/render}
-                                                                                       </td>
-                                                                               </tr>
-                                                                       </table>
-                                                               </td>
-                                                       </tr>
-                                               </table>
-                                       </td>
-                               </tr>
-                       </table>
-
-                       <p align=right>
-                       <input type="submit" name="save" value="{t}Save{/t}">
-                       <input type="submit" name="cancel" value="{t}Cancel{/t}">
-                       </p>
-
-               </td>
-       </tr>
-</table>
-
-<!--
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
--->
diff --git a/gosa-core/plugins/addons/addressbook/address_info.tpl b/gosa-core/plugins/addons/addressbook/address_info.tpl
deleted file mode 100644 (file)
index 3bb3a22..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;" cellpadding=4 cellspacing=0 border=0>
- <tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
-  <td align=left width="100%">{$storage_info}
-  </td>
-  <td>
-   <a href="{$url}">X</a>
-  </td>
- </tr>
-
- <tr style="background-color: white">
-  <td colspan=2>
-
-   <table summary="" width="100%" cellspacing=2 cellpadding=4>
-    <tr>
-     <td style="width:50%; vertical-align:top; background-color: #F0F0F0">
-      <h2>
-       <img class="center" alt="" src="{$personal_image}" align=middle> 
-       {t}Personal{/t}
-      </h2>
-      <table summary="" width="100%">
-       <tr>
-        <td style='width:40%;'>
-         {t}Name{/t}
-        </td> 
-        <td>
-         <i>{$info_sn}, {$info_givenName}</i>
-        </td>
-       </tr>
-       <tr>
-        <td>
-         {t}Initials{/t}
-        </td> 
-        <td>
-         <i>{$info_initials}</i>
-        </td>
-       </tr>
-       <tr>
-        <td>
-         {t}Personal title{/t}
-        </td>
-        <td>
-         <i>{$info_title}</i>
-        </td>
-       </tr>
-      </table>
-
-     </td>
-     <td style="vertical-align:top; background-color: #E8E8E8">
-
-      <h2>
-       <img class="center" alt="" src="{$home_image}" align=middle> 
-       {t}Private{/t}
-      </h2>
-
-      <table summary="" width="100%">
-        <tr>
-         <td style='vertical-align:top; width: 40%;'>
-          {t}Address{/t}
-         </td>
-         <td style="vertical-align:top;">
-          <i>{$info_homePostalAddress}</i>
-         </td>
-        </tr>
-        <tr>
-         <td>
-          {t}Phone{/t}
-         </td>
-         <td>
-          <i>{$info_homePhone}</i>
-         </td>
-        </tr>
-        <tr>
-         <td>
-          {t}Mobile{/t}
-         </td>
-         <td>
-          <i>{$info_mobile}</i>
-         </td>
-        </tr>
-        <tr>
-         <td>
-          {t}Email{/t}
-         </td>
-         <td>
-          <i><a href="mailto:{$info_givenName}%20{$info_sn}%20%3C{$info_mail}%3E">{$info_mail}</a></i>
-         </td>
-        </tr>
-       </table>
-
-      </td>
-     </tr>
-
-     <tr>
-      <td style="vertical-align:top; background-color: #E4E4E4" colspan=2>
-
-       <h2>
-        <img class="center" alt="" src="{$company_image}" align=middle> 
-        {t}Organizational{/t}
-       </h2>
-
-       <table summary="" width="100%">
-        <tr>
-         <td width='50%'>
-  
-          <table summary="" width="100%">
-           <tr>
-            <td style='width:40%;'>
-             {t}Company{/t}
-            </td>
-            <td>
-             <i>{$info_o}</i>
-            </td>
-           </tr>
-           <tr>
-            <td>
-             {t}Department{/t}
-            </td>
-            <td>
-             <i>{$info_ou}</i>
-            </td>
-           </tr>
-           <tr>
-            <td> 
-             {t}City{/t}
-            </td>
-            <td>
-             <i>{$info_l}</i>
-            </td>
-           </tr>
-           <tr>
-            <td>
-             {t}Postal code{/t}
-            </td>
-            <td>
-             <i>{$info_postalCode}</i>
-            </td>
-           </tr>
-           <tr>
-            <td>
-             {t}Country{/t}
-            </td>
-            <td>
-             <i>{$info_st}</i>
-            </td>
-           </tr>
-          </table>
-
-         </td>
-         <td style="vertical-align:top">
-
-          <table summary="" width="100%">
-           <tr>
-            <td style='vertical_align:top; width:40%;'>
-             {t}Address{/t}
-            </td>
-            <td style="vertical-align:top;">
-             <i>{$info_postalAddress}</i>
-            </td>
-           </tr>
-           <tr>
-            <td>
-             {t}Phone{/t}
-            </td>
-            <td>
-             <i>{$info_telephoneNumber}</i>
-            </td>
-           </tr>
-           <tr>
-            <td>
-             {t}FAX{/t}
-            </td>
-            <td>
-             <i>{$info_facsimileTelephoneNumber}</i>
-            </td>
-           </tr>
-           <tr>
-            <td>
-             {t}Pager{/t}
-            </td>
-            <td>
-             <i>{$info_pager}</i>
-            </td>
-           </tr>
-          </table>
-         </td>
-        </tr>
-       </table>
-
-      </td> 
-     </tr>
-    </table>
-
-   </td>
- </tr>
-</table>
diff --git a/gosa-core/plugins/addons/addressbook/class_addressbook.inc b/gosa-core/plugins/addons/addressbook/class_addressbook.inc
deleted file mode 100644 (file)
index eddfcdf..0000000
+++ /dev/null
@@ -1,835 +0,0 @@
-<?php
-
-class addressbook extends plugin
-{
-       /* Definitions */
-       var $plHeadline   = "Addressbook";
-       var $plDescription= "This does something";
-
-  /* Generic */
-  var $ui;  
-
-       /* Phonelist attributes */
-       var $telephone_list   = array();
-       var $new_dn           = "";
-       var $orig_cn          = "";
-       var $storage_base     = "";
-       var $orig_storage_base= "";
-
-  /* Filter attributes */
-       var $start            = 0;
-       var $search_for       = "*";
-       var $search_base      = "";
-       var $search_type      = "";
-       var $range            = 20;
-
-  /* Currently edited/added entry attributes */
-       var $sn                       = "";
-       var $cn                       = "";
-       var $givenName                = "";
-       var $mail                     = "";
-       var $title                    = "";
-       var $personalTitle            = "";
-       var $initials                 = "";
-       var $homePostalAddress        = "";
-       var $homePhone                = "";
-       var $mobile                   = "";
-       var $o                        = "";
-       var $postalAddress            = "";
-       var $l                        = "";
-       var $postalCode               = "";
-       var $st                       = "";
-       var $ou                       = "";
-       var $telephoneNumber          = "";
-       var $facsimileTelephoneNumber = "";
-       var $pager                    = "";
-  var $view_logged              = FALSE;
-
-       /* attribute list for save action */
-       var $attributes= array("sn", "givenName", "mail", "title",
-                       "initials", "homePostalAddress", "displayName",
-                       "homePhone", "mobile", "o", "postalAddress", "l",
-                       "postalCode", "st", "ou", "telephoneNumber",
-                       "facsimileTelephoneNumber", "pager");
-
-       var $objectclasses= array("top", "person", "organizationalPerson", "inetOrgPerson");
-
-       var $abobjectclass= "dc=addressbook";
-
-  function addressbook (&$config, $dn= NULL)
-  {
-    /* Include config object */
-    $this->config= &$config;
-
-    /* Check if there is a special ldap-sub-tree specified, instead of dc=addressbook, */
-    $aoc = $this->config->search("addressbook", "LDAP_OBJECT_CLASS",array('menu'));
-    if ($aoc != ""){
-      $this->abobjectclass  = $aoc;
-    }
-
-    /* Get global filter config */
-    if (!session::is_set("phonefilter")){
-      $ui         = get_userinfo();
-      $base       = get_base_from_people($ui->dn);
-      $phonefilter= array(
-          "search_base"       => $base,
-          "organizational"    => "checked",
-          "global"            => "checked",
-          "search_for"        => "*",
-          "object_type"       => "*");
-      session::set("phonefilter", $phonefilter);
-    }
-     
-    $this->ui = get_userinfo();
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    $smarty= get_smarty();
-
-    /* Prevent empty variables for smarty */
-    foreach($this->attributes as $atr) {
-      $smarty->assign($atr,"");
-    }
-
-    /* Save formular information */
-    $phonefilter= session::get("phonefilter");
-    foreach( array("search_for", "search_base", "object_type") as $type){
-      if (isset($_POST[$type])){
-        $phonefilter[$type]= $_POST[$type];
-      }
-      $this->$type= $phonefilter[$type];
-    }
-    if (isset($_POST['search_base'])){
-      foreach( array("organizational", "global") as $type){
-        if (isset($_POST[$type])){
-          $phonefilter[$type]= "checked";
-        } else {
-          $phonefilter[$type]= "";
-        }
-      }
-    }
-
-    /* Search string */
-    $s= $phonefilter['search_for'];
-    if ($s == "") {
-      $s= "*";
-    }
-    if (isset($_GET['search'])){
-      $s= validate(mb_substr($_GET['search'], 0, 1, "UTF8"))."*";
-      if ($s == "**"){
-        $s= "*";
-      }
-      $this->search_for= $s;
-      $phonefilter['search_for']= $s;
-    }
-    session::set("phonefilter", $phonefilter);
-
-    /* Assign create acl */
-    $acl = $this->get_entry_acls($this->abobjectclass.",".$phonefilter['search_base']);
-    $smarty->assign("internal_createable", preg_match("/c/",$acl));
-    $smarty->assign("internal_removeable", preg_match("/d/",$acl));
-    $smarty->assign("internal_editable",   preg_match("/w/",$acl));
-
-    /* Perform actions with CTI hook */
-    if (isset($_GET['target'])
-        && isset($_GET['dial'])
-        && isset($this->config->current['CTIHOOK'])){
-
-      $dialmode= $_GET['dial'];
-      if ($dialmode == "telephoneNumber" ||
-          $dialmode == "mobile" ||
-          $dialmode == "homePhone"){
-
-        /* Get target */
-        $ldap= $this->config->get_ldap_link();
-        $ldap->cat(base64_decode($_GET['target']), array('telephoneNumber', 'mobile', 'homePhone'));
-        $attrs= $ldap->fetch();
-        if (isset($attrs["$dialmode"])){
-          $target= $attrs[$dialmode][0];
-        } else {
-          $target= "";
-        }
-
-        /* Get source */
-        $ui= get_userinfo();
-        $ldap->cat($ui->dn, array('telephoneNumber'));
-        $attrs= $ldap->fetch();
-        if (isset($attrs["telephoneNumber"])){
-          $source= $attrs['telephoneNumber'][0];
-        } else {
-          $source= "";
-        }
-
-        /* Save to session */
-        session::set('source',$source);
-        session::set('target',$target);
-
-        /* Perform call */
-        if ($target != "" && $source != ""){
-          $smarty->assign("phone_image", get_template_path('images/phone.png'));
-          $smarty->assign("dial_info", sprintf(_("Dial from %s to %s now?"), "<b style='font-size:22px; color:red'>".$source."</b>", "<b style='font-size:22px;color:red'>".$target."</b>"));
-          return($smarty->fetch(get_template_path('dial.tpl', TRUE)));
-          return;
-        } else {
-         msg_dialog::display(_("Error"), _("You need to set your personal phone number in order to perform direct dials."), ERROR_DIALOG);
-        }
-      }
-
-    }
-
-    /* Finally dial */
-    if (isset($_POST['dial']) && session::is_set('source') && session::is_set('target')){
-      exec ($this->config->current['CTIHOOK']." '".session::get('source')."' '".session::get('target')."'", $dummy, $retval);
-      session::un_set('source');
-      session::un_set('target');
-    }
-
-
-    /* Delete entry? */
-    if (isset($_POST['delete_entry_confirm'])){
-
-      /* Some nice guy may send this as POST, so we've to check
-         for the permissions again. */
-      
-      $acl = $this->get_entry_acls($this->dn);
-      if(preg_match("/d/",$acl)){
-
-        /* Delete request is permitted, perform LDAP action */
-        $ldap= $this->config->get_ldap_link();
-        $ldap->rmdir ($this->dn);
-        new log("remove","addressbook/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-        show_ldap_error($ldap->get_error(), sprintf(_("Removing of addressbook entry '%s' failed."),$this->dn));
-        new log("remove","addressbook/".get_class($this),$this->dn,array(),"Address book object'".$this->dn."' has been removed");
-  
-      } else {
-
-        /* Normally this shouldn't be reached, send some extra
-           logs to notify the administrator */
-       msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG);
-        new log("remove","addressbook/".get_class($this),$this->dn,array(),"Warning: '".$this->ui->uid."' tried to trick address book deletion.");
-      }
-
-      /* Remove lock file after successfull deletion */
-      del_lock ($this->dn);
-
-      /* Clean up */
-      if (session::is_set('saved_start')){
-        $_GET['start']= session::get('saved_start');
-      }
-      session::un_set('show_info');
-      session::un_set('saved_start');
-    }
-
-
-    /* Delete entry? */
-    if (isset($_POST['delete_cancel'])){
-      del_lock ($this->dn);
-    }
-
-
-    /* Save address entry? */
-    if (isset($_POST['save'])){
-      $this->save_object();
-      $this->storage_base= $_POST['storage_base'];
-
-      /* Perform checks */
-      $message= $this->check ();
-
-      /* No errors, save object */
-      if (count ($message) == 0){
-        $this->save();
-
-        /* Clean up */
-        if (session::is_set('saved_start')){
-          $_GET['start']= session::get('saved_start');
-        }
-        session::set('show_info',$this->dn);
-        session::un_set('saved_start');
-      } else {
-        /* Errors found, show message */
-        show_errors ($message);
-      }
-    }
-
-
-    /* Close info window */
-    if (isset($_GET['close']) || isset($_POST['cancel'])){
-      if (session::is_set('saved_start')){
-        $_GET['start']= session::get('saved_start');
-      }
-      session::un_set('show_info');
-      session::un_set('saved_start');
-    }
-
-
-    /* Start address book edit mode? */
-    if (isset($_GET['global'])){
-      if (!session::is_set('saved_start') && isset($_GET['start'])){
-        session::set('saved_start',$_GET['start']);
-      }
-      switch ($_GET['global']){
-        case "add":
-          $this->dn= "new";
-        $this->orig_cn= "";
-
-        /* Clean values */
-        foreach ($this->attributes as $name){
-          $this->$name= "";
-        }
-        $this->saved_attributes= array();
-        $this->storage_base= $this->config->current["BASE"];
-        break;
-
-        case "edit":
-          /* Clean values */
-          foreach ($this->attributes as $name){
-            $this->$name= "";
-          }
-        $this->dn= session::get('show_info'); 
-        $this->load();
-        $this->orig_cn= $this->cn;
-        break;
-        case "remove":
-          $this->dn= session::get('show_info'); 
-        $this->load();
-
-        /* Load permissions for selected 'dn' and check if
-           we're allowed to remove this 'dn' */
-        $acl = $this->get_entry_acls($this->dn);
-        if(preg_match("/d/",$acl)){
-
-          /* Check locking, save current plugin in 'back_plugin', so
-             the dialog knows where to return. */
-          if (($user= get_lock($this->dn)) != ""){
-            return(gen_locked_message ($user, $this->dn));
-          }
-
-          /* Lock the current entry, so nobody will edit it during deletion */
-          $ui= get_userinfo();
-          add_lock ($this->dn, $ui->dn);
-          $smarty->assign("info", sprintf(_("You're about to delete the entry %s."), $this->dn));
-          return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-        } else {
-
-          /* Obviously the user isn't allowed to delete. Show message and
-             clean session. */
-         msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG);
-        }
-      }
-      session::set('show_info',"ADD");
-    }
-
-
-    /* Open info window */
-    if (isset($_GET['show'])){
-      if (!session::is_set('saved_start')){
-        session::set('saved_start',$_GET['start']);
-      }
-      $this->dn = base64_decode($_GET['show']);
-      $this->view_logged =FALSE;
-      if(!$this->view_logged){
-        $this->view_logged = TRUE;
-        new log("view","addressbook/".get_class($this),$this->dn);
-      }
-      session::set('show_info',base64_decode($_GET['show']));
-    }
-
-
-    /* Get ldap link / build filter */
-    $ldap= $this->config->get_ldap_link();
-    $this->telephone_list= array ();
-
-
-    /* Assemble bases 
-        (Depending on checkboxes, we search for organisational entries or seperated 
-        adressbook entries within dc=adressbook, ) */
-    $bases= array();
-    $filter= "";
-    if ($phonefilter['global'] == "checked"){
-      $bases[]= preg_replace("/".$this->config->current['BASE']."/", $this->abobjectclass.",".$this->config->current['BASE'], $this->search_base);
-    } else {
-      $filter= '(objectClass=gosaAccount)';
-    }
-    if ($phonefilter['organizational'] == "checked"){
-      $bases[]= $this->search_base;
-    }
-
-
-    /* Only display those entries that have at least on of this attributes set */
-    $must_have_this = array("telephoneNumber","facsimileTelephoneNumber","mobile","homePhone","mail");
-
-    /* Requested attributes in ldap search */
-    $attributes = array("sn", "givenName", "telephoneNumber", "facsimileTelephoneNumber", "mobile", "homePhone", "uid", "mail", "cn");
-
-    /* Create attribute filter part */
-    $attribute_filter = "";
-    foreach($attributes as $att){
-      $attribute_filter .= "(".$att."=".$s.")";
-    }
-
-    /* Walk through bases an check for usable entries */
-    foreach ($bases as $base){
-
-      $ldap->cd ($base);
-
-      if ($phonefilter['object_type'] == '*'){
-        $ldap->search (
-            "(&(objectClass=person)$filter(!(objectClass=gosaUserTemplate))".   // Skip templates etc ..
-            "(!(uid=*$))".                                                      // Skip entries with ...$ as uid 
-            "(|".$attribute_filter."))"                                         
-          ,$attributes); 
-      } else {
-        $ldap->search ("(&$filter(!(uid=*$))(!(objectClass=gosaUserTemplate))".                     //array
-            "(".$phonefilter['object_type']."=$s))", $attributes);
-      }
-
-      /* Walk through LDAP results */
-      while ($attrs= $ldap->fetch()){
-
-        /* prevent empty vaiables */
-        foreach($this->attributes as $atr)          {
-          if(!isset($attrs[$atr][0])) {
-            $attrs[$atr][0] = "";
-          }
-        }
-
-        /* Check if page number was posted */
-        if(!isset($_GET['start'])) {
-          $_GET['start']="";
-        }
-
-        /* Check if at least one attribute is specified */
-        $skip = false;
-
-        foreach($must_have_this as $attr)      {
-          if(isset($attrs[$attr][0]) && !empty($attrs[$attr][0])){
-            $skip =false;
-            break;
-          }
-        }
-
-        /* Skip all attributes that we are not allowed to read */
-        $any = false;
-        foreach($attributes as $attr){
-    
-          $acls = $this->get_entry_acls($attrs['dn'],$attr);  
-          if(!preg_match("/r/",$acls)){
-            $attrs[$attr][0] = "";
-          }else{
-            $any = true;
-          }
-        }
-        /* Only show lines that have set any mail or phone informations */
-        if(!$skip && $any){      
-  
-          $this->telephone_list[$attrs['sn'][0].$attrs['dn']]=
-
-            "<td class=\"phonelist\" title=\"".$attrs['sn'][0].", ".$attrs['givenName'][0].
-              "\"onClick='location.href=\"main.php?plug=".validate($_GET['plug']).
-                          "&amp;start=".validate($_GET['start']).
-                          "&amp;show=".urlencode(base64_encode($attrs['dn']))."\"'>
-              <a style='vertical-align:middle;' href=\"main.php?plug=".validate($_GET['plug']).
-                          "&amp;start=".validate($_GET['start']).
-                          "&amp;show=".urlencode(base64_encode($attrs['dn']))."\">".
-               $attrs['sn'][0].", ".$attrs['givenName'][0].
-            "</a>
-            &nbsp;</td>
-            <td class=\"phonelist\" title=\""._("Dial")." ".$attrs['telephoneNumber'][0]."\">
-            <a style='vertical-align:middle;' href=\"main.php?plug=".validate($_GET['plug'])."&amp;dial=telephoneNumber&amp;start=".validate($_GET['start'])."&amp;target=".base64_encode($attrs['dn'])."\">".$attrs['telephoneNumber'][0]."
-            </a>
-            &nbsp;</td>
-            <td class=\"phonelist\" title=\"".$attrs['facsimileTelephoneNumber'][0]."\">
-            ".$attrs['facsimileTelephoneNumber'][0]."
-            &nbsp;</td>
-            <td class=\"phonelist\" title=\""._("Dial")." ".$attrs['mobile'][0]."\">
-            <a style='vertical-align:middle;' href=\"main.php?plug=".validate($_GET['plug'])."&amp;dial=mobile&amp;start=".validate($_GET['start'])."&amp;target=".base64_encode($attrs['dn'])."\">".$attrs['mobile'][0]."
-            </a>
-            &nbsp;</td>
-            <td class=\"phonelist\" title=\""._("Dial")." ".$attrs['homePhone'][0]."\">
-            <a style='vertical-align:middle;' href=\"main.php?plug=".validate($_GET['plug'])."&amp;dial=homePhone&amp;start=".validate($_GET['start'])."&amp;target=".base64_encode($attrs['dn'])."\">".$attrs['homePhone'][0]."
-            </a>
-            &nbsp;</td>
-            <td>
-            <a href=\"getvcard.php?dn=".base64_encode($attrs['dn'])."\">
-            <img align=\"top\" border=0 src=\"images/save.png\" alt=\"vcf\" title=\"".sprintf(_("Save contact for %s as vcard"), $attrs['givenName'][0]." ".$attrs['sn'][0])."\">
-            </a>";
-
-
-          if(preg_match("/r/",$this->get_entry_acls($attrs['dn'],"mail"))){
-            if (isset($attrs['mail'][0]) && !empty($attrs['mail'][0])){
-              $dest= sprintf(_("Send mail to %s"), $attrs['mail'][0]);
-              $this->telephone_list[$attrs['sn'][0].$attrs['dn']].=
-
-                "<a href=\"mailto:".htmlentities($attrs['mail'][0])."\">".
-                "<img  align=\"top\" border=0 src=\"images/mailto.png\" alt=\"vcf\" title=\"$dest\"></a>";
-            }
-          }
-          $this->telephone_list[$attrs['sn'][0].$attrs['dn']].= "&nbsp;</td>";
-        }
-      }
-      error_reporting(E_ALL | E_STRICT);
-    }
-
-    /* Sort up list */
-    ksort ($this->telephone_list);
-    reset ($this->telephone_list);
-
-    /* Fill template variables */
-    $smarty->assign("search_for", $this->search_for);
-    $smarty->assign("object_type", $this->object_type);
-
-    $this->base = $phonefilter['search_base'];
-    $smarty->assign("deplist", $this->get_allowed_bases());
-    $smarty->assign("depselect", $this->search_base);
-    $smarty->assign("global", $phonefilter['global']);
-    $smarty->assign("organizational", $phonefilter['organizational']);
-    $smarty->assign("search_image", get_template_path('images/search.png'));
-    $smarty->assign("obj_image", get_template_path('images/list_ogroup.png'));
-    $smarty->assign("tree_image", get_template_path('images/tree.png'));
-    $smarty->assign("infoimage", get_template_path('images/info.png'));
-    $smarty->assign("actionimage", get_template_path('images/action.png'));
-    $smarty->assign("launchimage", get_template_path('images/launch.png'));
-
-    /* Generate alphabet */
-    $alphabet= generate_alphabet();
-
-    /* Build list output */
-    $output= "";
-    $mod= 0;
-
-
-    /* View detailed infos */
-    $smarty->assign("show_info", "");
-    if (session::is_set('show_info')){
-
-      $range= 4;
-      $smarty->assign("show_info", "1");
-      $smarty->assign("url", "main.php?plug=".validate($_GET['plug'])."&amp;close=1");
-
-      $tmp = $this->plInfo();
-
-      if(isset($_POST['storage_base'])){
-        $this->storage_base = $_POST['storage_base'];  
-      }
-
-      switch (session::get('show_info')){
-
-        case "ADD":
-
-          $a_bases = $this->get_allowed_bases();
-  
-          if(!isset($a_bases[$this->storage_base])){
-            $base = key($this->get_allowed_bases());
-            $this->storage_base = $base;
-          } 
-
-          $smarty->assign ('storage_base', $this->storage_base);
-          $smarty->assign ('address_info', get_template_path('address_edit.tpl', TRUE));
-
-          foreach($tmp['plProvidedAcls'] as $name => $translated){
-            $smarty->assign($name."ACL",$this->get_entry_acls($this->abobjectclass.",".$base,$name));
-          }
-        break;
-
-        default:
-          $smarty->assign ('address_info', get_template_path('address_info.tpl', TRUE));
-          foreach($tmp['plProvidedAcls'] as $name => $translated){
-            $smarty->assign($name."ACL",$this->get_entry_acls($this->dn,$name));
-          }
-        break;
-      }
-
-      /* Fill variables from LDAP */
-      if (session::get('show_info') != "ADD"){
-        $ldap->cat(session::get('show_info'), $this->attributes);
-        $info= $ldap->fetch();
-      }
-      foreach ($this->attributes as $name){
-
-        /* Skip entries we are not allowed to read */
-        if(!preg_match("/r/",$this->get_entry_acls($this->dn,$name))){
-          $smarty->assign("info_$name", "");
-        }else
-
-        if (session::get('show_info') != "ADD" && isset($info["$name"][0])){
-          error_reporting(0);
-          /* Special treatment for phone attributes */
-          if ($name == "mobile" ||
-              $name == "homePhone" ||
-              $name == "telephoneNumber"){
-            $smarty->assign("info_$name",
-                "<a title=\""._("Dial")." ".$info["$name"][0]."\" href=\"main.php?plug=".validate($_GET['plug'])."&amp;dial=$name&amp;start=".validate($_GET['start'])."&amp;target=".base64_encode(session::get('show_info'))."\">".$info["$name"][0]."</a>");
-          } else {
-            $smarty->assign("info_$name", preg_replace("/\n/", "<br>", $info["$name"][0]));
-          }
-          error_reporting(E_ALL | E_STRICT);
-        } elseif (session::get('show_info') == "ADD" && isset($this->$name)) {
-          $smarty->assign("info_$name", $this->$name);
-        } else {
-          $smarty->assign("info_$name", "-");
-        }
-      }
-      if (preg_match("/,".$this->abobjectclass.",/", session::get('show_info'))){
-        $storage= _("global addressbook");
-        $smarty->assign("internal", 0);
-      } else {
-        $storage= _("user database");
-        $smarty->assign("internal", 1);
-      }
-      if (session::get('show_info') != "ADD"){
-        $smarty->assign("storage_info", sprintf(_("Contact stored in '%s'"), $storage));
-      } else {
-        $smarty->assign("storage_info", _("Creating new entry in"));
-      }
-    } else {
-
-
-      if(isset($_POST['EntryPerPage'])){
-        $this->range = $_POST['EntryPerPage'];
-      }
-      $range = $this->range;   
-      $smarty->assign("internal", 1);
-    }
-    if (isset($_GET['start'])){
-      $this->start= validate($_GET['start']);
-    }
-    foreach ($this->telephone_list as $val){
-      if ($mod < $this->start) {
-        $mod++;
-        continue;
-      }
-      if ($mod >= ($this->start + $range)){
-        $mod++;
-        break;
-      }
-      if ( ($mod++) & 1){
-        $col= "style=\"background-color: #ECECEC;\"";
-      } else {
-        $col= "style=\"background-color: #F5F5F5;\"";
-      }
-      $output.= "<tr $col>\n$val</tr>\n";
-    }
-
-    $smarty->assign("search_result", $output);
-    $smarty->assign("apply", apply_filter());
-    $smarty->assign("alphabet", $alphabet);
-    if($range < 20){
-      $smarty->assign("range_selector", range_selector(count($this->telephone_list), $this->start, $range));
-    }else{
-      $smarty->assign("range_selector", range_selector(count($this->telephone_list), $this->start, $range, "EntryPerPage"));
-    }
-    $tmp= array("*" => _("All"), "sn" => _("Name"), "givenName" => _("Given name"),
-        "telephoneNumber" => _("Work phone"), "mobile" => _("Cell phone"),
-        "homePhone" => _("Home phone"), "uid" => _("User ID"));
-    natsort($tmp);
-    $smarty->assign("objlist", $tmp);
-
-    /* Show main page */
-    $smarty->assign ('personal_image', get_template_path('images/addr_personal.png'));
-    $smarty->assign ('home_image', get_template_path('images/addr_home.png'));
-    $smarty->assign ('company_image', get_template_path('images/addr_company.png'));
-    $smarty->assign ('add_image', get_template_path('images/editpaste.png'));
-    $smarty->assign ('edit_image', get_template_path('images/edit.png'));
-    $smarty->assign ('delete_image', get_template_path('images/editdelete.png'));
-    return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
-  }
-
-  function save_object()
-  {
-    plugin::save_object();
-    foreach($this->attributes as $attr){
-
-      /* save attributes depending on acls */
-      $acl = $this->get_entry_acls($this->dn,$attr);
-
-      if(preg_match("/w/",$acl)){
-        if(isset($_POST[$attr])){
-          $this->$attr = $_POST[$attr];
-        }
-      }
-
-    }
-  }
-
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    /* must: sn, givenName */
-    if ($this->sn == ""){
-      $message[]= _("The required field 'Name' is not set.");
-      return ($message);
-    }
-    if ($this->givenName == ""){
-      $message[]= _("The required field 'Given name' is not set.");
-      return ($message);
-    }
-
-    /* Check for valid name definition */
-    if (preg_match ("/[\\\\]/", $this->sn)){
-      $message[]= _("The field 'Name' contains invalid characters.");
-    }
-    if (preg_match ("/[\\\\]/", $this->givenName)){
-      $message[]= _("The field 'Given name' contains invalid characters.");
-    }
-
-    /* Check phone numbers */
-    if (!tests::is_phone_nr($this->homePhone)){
-      $message[]= _("The field 'Phone' contains an invalid phone number.");
-    }
-    if (!tests::is_phone_nr($this->telephoneNumber)){
-      $message[]= _("The field 'Phone' contains an invalid phone number.");
-    }
-    if (!tests::is_phone_nr($this->facsimileTelephoneNumber)){
-      $message[]= _("The field 'Fax' contains an invalid phone number.");
-    }
-    if (!tests::is_phone_nr($this->mobile)){
-      $message[]= _("The field 'Mobile' contains an invalid phone number.");
-    }
-    if (!tests::is_phone_nr($this->pager)){
-      $message[]= _("The field 'Pager' contains an invalid phone number.");
-    }
-
-    /* Check for reserved characers */
-    if (preg_match ('/[,+"<>;]/', $this->givenName)){
-      $message[]= _("The field 'Given name' contains invalid characters.");
-  }
-  if (preg_match ('/[,+"<>;]/', $this->sn)){
-    $message[]= _("The field 'Name' contains invalid characters.");
-  }
-
-  /* Check mail */
-  if (!tests::is_email($this->mail)){
-    $message[]= _("Please enter a valid email address in 'Primary address' field.");
-  }
-
-  /* Assemble cn/dn */
-  $this->cn= $this->givenName." ".$this->sn;
-  if ($this->orig_cn != $this->cn || $this->storage_base != $this->orig_storage_base){
-    $this->new_dn= $this->create_unique_dn("cn", preg_replace("/,*".$this->config->current['BASE']."$/", "", $this->storage_base).",".$this->abobjectclass.",".$this->config->current['BASE']);
-    if ($this->new_dn == "none"){
-      $message[]= _("Cannot create a unique DN for your entry. Please fill more formular fields.");
-      return ($message);
-    }
-  } else {
-    $this->new_dn= $this->dn;
-  }
-
-  return ($message);
-  }
-
-
-  function load()
-  {
-    /* Load base attributes */
-    plugin::plugin ($this->config, $this->dn);
-    $this->view_logged = FALSE;
-    $this->storage_base= preg_replace('/^[^,]+,/', '', preg_replace('/'.$this->abobjectclass.',/', '', $this->dn));
-  }
-
-
-  function save()
-  {
-    /* First use parents methods to do some basic fillup in $this->attrs */
-    plugin::save ();
-
-    $this->attrs['cn']= $this->cn;
-    $this->attrs['displayName']= $this->givenName." ".$this->sn;
-
-    /* Move entry if it got another name... */
-    if ($this->dn != "new" && $this->dn != $this->new_dn){
-      $this->move($this->dn, $this->new_dn);
-    }
-    $this->dn= $this->new_dn;
-
-    /* Save data. Using 'modify' implies that the entry is already present, use 'add' for
-       new entries. So do a check first... */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cat ($this->dn,array('dn'));
-    if ($ldap->fetch()){
-      $mode= "modify";
-    } else {
-      $mode= "add";
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
-    }
-
-    /* Finally write data with selected 'mode' */
-    $ldap->cd ($this->dn);
-    $this->cleanup();
-    $ldap->$mode ($this->attrs);
-    if (show_ldap_error($ldap->get_error(), sprintf(_("Removing of addressbook entry '%s' failed."),$this->dn))){
-      return (1);
-    }
-
-    if($mode == "add"){
-      new log("create","addressbook/".get_class($this),$this->dn, array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("modify","addressbook/".get_class($this),$this->dn, array_keys($this->attrs),$ldap->get_error());
-    }
-  }
-
-  
-  /* Return entry acls */
-  function get_entry_acls($dn,$attr = "")
-  {
-    $acls = "";
-  
-    /* Use addressbook acls */
-    if(preg_match("/".normalizePreg($this->abobjectclass)."/",$dn))  {
-      $dn = preg_replace("/".normalizePreg($this->abobjectclass).",/","",$dn);
-      $acls = $this->ui->get_permissions($dn,"addressbook/addressbook",$attr);
-    }
-    
-    /* Use Organizational Person acls */
-    else{
-      $acls = $this->ui->get_permissions($dn,"users/user",$attr);
-    }
-
-    return($acls);
-  }
-
-
-  /* Return plugin informations for acl handling  */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName" => _("Addressbook"),
-          "plDescription" => _("Addressbook entry acls"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 0,
-          "plSection"     => array("addons" => _("Addons")),
-          "plCategory"    => array("addressbook" => array("objectClass" => "inetOrgPerson", "description" => _("Addressbook"))),
-
-          "plProvidedAcls"    => array(
-            "sn"                        => _("Surename"),         
-            "givenName"                 => _("Given name"), 
-            "telephoneNumber"           => _("Telefon number"), 
-            "facsimileTelephoneNumber"  => _("Fax number"), 
-            "mobile"                    => _("Mobile number"), 
-            "homePhone"                 => _("Home phone number"), 
-            "uid"                       => _("User identification"), 
-            "mail"                      => _("Mail address"), 
-            "pager"                     => _("Pager"),
-            "o"                         => _("Organization"),
-            "ou"                        => _("Department"),
-            "l"                         => _("Location"),
-            "postalAddress"             => _("Postal address"),
-            "postalCode"                => _("Postal address"),
-            "st"                        => _("State"),
-            "initials"                  => _("Initials"), 
-            "title"                     => _("Title"), 
-            "homePostalAddress"         => _("Home postal address"), 
-            "cn"                        => _("Common name"))
-            ));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/addons/addressbook/contents.tpl b/gosa-core/plugins/addons/addressbook/contents.tpl
deleted file mode 100644 (file)
index 004e3d2..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-<table summary="" style="table-layout:fixed; width:100%; vertical-align:top; text-align:left; table-layout:auto;" cellpadding="4" border="0">
-<tr>
-  <td style="vertical-align:top;">
-   <table summary="" style="border:1px solid #B0B0B0; width:100%; vertical-align:top; text-align:left;"  cellpadding="4" cellspacing="0">
-    <colgroup>
-        <col width="32%">
-        <col width="14%">
-        <col width="14%">
-        <col width="14%">
-        <col width="14%">
-        <col width="8%">
-    </colgroup>
-    <tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
-     <td class="tbhead">{t}Name{/t}</td><td class="tbhead">{t}Phone{/t}</td><td class="tbhead">{t}Fax{/t}</td>
-     <td class="tbhead">{t}Mobile{/t}</td><td class="tbhead">{t}Private{/t}</td><td class="tbrhead">{t}Contact{/t}</td>
-    </tr>
-    {$search_result}
-   </table>
-
-   <table summary="" style="vertical-align:top; text-align:center; width:100%;" cellpadding="4" cellspacing="0" border="0">
-    <tr>
-     <td>{$range_selector}</td>
-    </tr>
-   </table>
-
-   {if $show_info eq 1}
-    {include file=$address_info}
-   {/if}
-
-  </td>
-  <td style="vertical-align:top; width:270px;">
-   <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;">
-    <p class="contentboxh"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
-   </div>
-   <div class="contentboxb">
-    <p class="contentboxb">
-     {t}The telephone list plugin provides list and search facilities for the people in your site. You may want to specify the asterisk [*] like in 'Go*us' to find 'Gonicus'. Use the filters below to narrow down your search.{/t}
-    </p>
-   </div>
-   <br>
-   <div class="contentboxh">
-    <p class="contentboxh" style="vertical-align:middle;"><img src="{$actionimage}" style="vertical-align:middle;" align="right" alt="[a]">{t}Actions{/t}</p>
-   </div>
-   <div class="contentboxb">
-    <p class="contentboxb" style="vertical-align:middle;">
-{if $internal_createable}
-     <img class="center" alt="" src="{$add_image}">&nbsp;
-     <a href="main.php{$plug}&amp;global=add" style="text-align:center;vertical-align:middle;">{t}Add entry{/t}</a><br>
-{/if}
-
-{if $internal eq 0}
- {if $internal_editable}
-     <img alt="" src="{$edit_image}" class="center">&nbsp;
-     <a href="main.php{$plug}&amp;global=edit">{t}Edit entry{/t}</a><br>
- {/if}
- {if $internal_removeable}
-            <img alt="" src="{$delete_image}" class="center">&nbsp;
-            <a href="main.php{$plug}&amp;global=remove" style="vertical-align:middle;">{t}Remove entry{/t}</a><br>
- {/if}
-{/if}
-    </p>
-   </div>
-   <br>
-   <div class="contentboxh">
-    <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
-   </div>
-   <div class="contentboxb">
-    <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
-     {$alphabet}
-    </table>
-    
-<table summary=""  style="width:100%;border-top:1px solid #B0B0B0;">
-       <tr>
-               <td>
-<input type="checkbox" name="organizational" value="1" {$organizational} onClick="mainform.submit()" title="{t}Select to see regular users{/t}">{t}Show organizational entries{/t}<br>
-    <input type="checkbox" name="global" value="1" {$global} onClick="mainform.submit()" title="{t}Select to see users in addressbook{/t}">{t}Show addressbook entries{/t}<br>
-               </td>
-       </tr>
-</table>
-
-<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
-       <tr>
-               <td>
-                       <label for="search_base"><img class="center" alt="" src="{$tree_image}" align=middle title='{t}Display results for department{/t}'></label>
-               </td>
-       <td>
-                       <select name="search_base" style='width:220px' onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
-                       {html_options options=$deplist selected=$depselect}
-                               <option disabled>&nbsp;</option>
-               </select>
-               </td>
-       </tr>
-</table>
-<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
-       <tr>
-               <td>
-                       <label for="object_type"><img class="center" alt="" src="{$obj_image}" align=middle title='{t}Match object{/t}'></label>
-               </td>
-           <td>
-                       <select id="object_type" style='width:220px' name="object_type" onChange="mainform.submit()" title="{t}Choose the object that will be searched in{/t}">
-                       {html_options options=$objlist selected=$object_type}
-                               <option disabled>&nbsp;</option>
-               </select>
-           </td>
-       </tr>
-</table>
-<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
-       <tr>
-               <td><label for="search_for"><img class="center" alt="" src="{$search_image}" style="text-align:center;" title='{t}Search for{/t}'></label>
-               </td>
-           <td>
-                       <input id="search_for" style='width:99%' type='text' name='search_for' maxlength='20' value='{$search_for}' title='{t}Search string{/t}' onChange="mainform.submit()">
-               </td>
-       </tr>
-</table>
-   {$apply}
-   </div>
-  </td>
-</tr>
-</table>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('search_for');
-  -->
-</script>
diff --git a/gosa-core/plugins/addons/addressbook/dial.tpl b/gosa-core/plugins/addons/addressbook/dial.tpl
deleted file mode 100644 (file)
index b10b8db..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;" cellpadding=4 cellspacing=0 border=0>
-<tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
-<td align=left width="100%"><LABEL for="dial">{t}Dial connection...{/t}</LABEL></td>
-</tr>
-<tr style="background-color: white">
-<td style="text-align:center;">
- <div style="height:50px;">&nbsp;</div>
- <a style="font-size:22px"><img alt="" src="{$phone_image}" align=middle>{$dial_info}</a>
- <div style="height:60px;">&nbsp;</div>
- <input type='submit' name='dial' id="dial" value='{t}Dial{/t}'>&nbsp;<input type='submit' name='cancel' value='{t}Cancel{/t}'>
-
-</td>
-
-</tr>
-</table>
diff --git a/gosa-core/plugins/addons/addressbook/main.inc b/gosa-core/plugins/addons/addressbook/main.inc
deleted file mode 100644 (file)
index faa5ee5..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-/*
-  This code is part of GOsa (https://gosa.gonicus.de)
-  Copyright (C) 2003  Cajus Pollmeier
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-if (!$remove_lock){
-       /* Create phonelist object on demand */
-       if (!session::is_set('addressbook') || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-               $addressbook = new addressbook ($config);
-               $addressbook -> set_acl_base($ui->dn);
-               $addressbook -> set_acl_category("addressbook");        
-               session::set('addressbook',$addressbook);
-               session::un_set('show_info');
-       }
-       $addressbook= session::get('addressbook');
-
-       /* Execute formular */
-       $display= $addressbook->execute ();
-       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-
-       /* Page header*/
-       $display= print_header(get_template_path('images/addressbook.png'), _("Address book")).$display;
-
-       /* Store changes  in session */
-       session::set('addressbook',$addressbook);
-}
-?>
diff --git a/gosa-core/plugins/addons/addressbook/remove.tpl b/gosa-core/plugins/addons/addressbook/remove.tpl
deleted file mode 100644 (file)
index ba37685..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<div style="font-size:18px;">
- <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
-<p>
-  {$info}
-  {t}This includes all addressbook data in this entry. Please double check if your really want to do this since there is no way for GOsa to get your data back.{/t}
-</p>
-
-<p>
- {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
-</p>
-
-<p class="plugbottom">
-  <input type=submit name="delete_entry_confirm" value="{t}Delete{/t}">
-  &nbsp;
-  <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
-</p>
-
diff --git a/gosa-plugins/addressbook/address_edit.tpl b/gosa-plugins/addressbook/address_edit.tpl
new file mode 100644 (file)
index 0000000..8b51230
--- /dev/null
@@ -0,0 +1,274 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;" cellpadding=4 cellspacing=0 border=0>
+       <tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
+               <td align=left width="100%">
+                       <LABEL for="storage_base">
+                               {$storage_info}
+                       </LABEL>
+                       <select id="storage_base" name="storage_base" size="1" title="{t}Choose the department to store entry in{/t}">
+                               {html_options options=$deplist selected=$storage_base}
+                       </select>
+               </td>
+               <td>
+                       <a href="{$url}">
+                               X
+                       </a>
+               </td>
+       </tr>
+       <tr style="background-color: white">
+               <td colspan=2>
+                       <table summary="" width="100%" cellspacing=2 cellpadding=4>
+                               <tr>
+                                       <td style="width:50%; vertical-align:top; background-color: #F0F0F0">
+                                               <h2>
+                                                       <img class="center" alt="" src="{$personal_image}" align=middle>
+                                                               &nbsp;{t}Personal{/t}
+                                               </h2>
+                                               <table summary="" width="100%">
+                                                       <tr>
+                                                               <td>
+                                                                       <LABEL for="sn">
+                                                                               {t}Last name{/t}{$must}
+                                                                       </LABEL>, 
+                                                                       <LABEL for="givenName">
+                                                                               {t}First name{/t}{$must}
+                                                                       </LABEL>
+                                                               </td>
+                                                               <td>
+{render acl=$snACL}    
+                                                                       <input id="sn" name="sn" size=10 maxlength=60 value="{$info_sn}">, 
+{/render}
+{render acl=$givenNameACL}
+                                                                       <input id="givenName" name="givenName" size=10 maxlength=60 value="{$info_givenName}">
+{/render}
+                                                               <td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>
+                                                                       <LABEL for="initials">
+                                                                               {t}Initials{/t}
+                                                                       </LABEL>
+                                                               </td>
+                                                               <td>
+{render acl=$initialsACL}
+                                                                       <input id="initials" name="initials" size=5 maxlength=20 value="{$info_initials}">
+{/render}
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>
+                                                                       <LABEL for="title">
+                                                                               {t}Personal title{/t}
+                                                                       </LABEL>
+                                                               </td>
+                                                               <td>
+{render acl=$titleACL}
+                                                                       <input id="title" name="title" size=10 maxlength=20 value="{$info_title}">
+{/render}
+                                                               </td>
+                                                       </tr>
+                                               </table>
+                                       </td>
+                                       <td style="width:50%; vertical-align:top;background-color:#E8E8E8">
+                                               <h2>
+                                                       <img class="center" alt="" src="{$home_image}" align=middle>
+                                                       &nbsp;{t}Private{/t}
+                                               </h2>
+                                               <table summary="" width="100%">
+                                                       <tr>
+                                                               <td>
+                                                                       <LABEL for="homePostalAddress">
+                                                                               {t}Address{/t}
+                                                                       </LABEL>
+                                                               <br>
+                                                               <br>
+                                                               </td>
+                                                               <td style="vertical-align:top;">
+{render acl=$homePostalAddressACL}
+                                                                       <textarea id="homePostalAddress" name="homePostalAddress" rows=1 cols=20>{$info_homePostalAddress}</textarea>
+{/render}
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>
+                                                                       <LABEL for="homePhone">
+                                                                               {t}Phone{/t}
+                                                                       </LABEL>
+                                                               </td>
+                                                               <td>
+{render acl=$homePhoneACL}
+                                                                       <input id="homePhone" name="homePhone" size=15 maxlength=60 value="{$info_homePhone}">
+{/render}
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>
+                                                                       <LABEL for="mobile">
+                                                                               {t}Mobile{/t}
+                                                                       </LABEL>
+                                                               </td>
+                                                               <td>
+{render acl=$mobileACL}
+                                                                       <input id="mobile" name="mobile" size=15 maxlength=60 value="{$info_mobile}">
+{/render}
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>
+                                                                       <LABEL for="mail">
+                                                                               {t}Email{/t}
+                                                                       </LABEL>
+                                                               </td>
+                                                               <td>
+{render acl=$mailACL}
+                                                                       <input id="mail" name="mail" size=15 maxlength=60 value="{$info_mail}">
+{/render}
+                                                               </td>
+                                                       </tr>
+                                                </table>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td style="width:100%; vertical-align:top; background-color: #E4E4E4" colspan=2>
+                                               <h2>
+                                                       <img class="center" alt="" src="{$company_image}" align=middle>
+                                                       &nbsp;{t}Organizational{/t}
+                                               </h2>
+                                               <table summary="" width="100%">
+                                                       <tr>
+                                                               <td>
+                                                                       <table summary="" width="100%">
+                                                                               <tr>
+                                                                                       <td>
+                                                                                               <LABEL for="">  
+                                                                                                       {t}Company{/t}
+                                                                                               </LABEL>
+                                                                                       </td>
+                                                                                       <td>
+{render acl=$oACL}
+                                                                                               <input id="o" name="o" size=15 maxlength=60 value="{$info_o}">
+{/render}
+                                                                                       </td>
+                                                                               </tr>
+                                                                               <tr>
+                                                                                       <td>
+                                                                                               <LABEL for="">
+                                                                                                       {t}Department{/t}
+                                                                                               </LABEL>
+                                                                                       </td>
+                                                                                       <td>
+{render acl=$ouACL}
+                                                                                               <input id="ou" name="ou" size=15 maxlength=60 value="{$info_ou}">
+{/render}
+                                                                                       </td>
+                                                                               </tr>
+                                                                               <tr>
+                                                                                       <td>
+                                                                                               <LABEL for="">
+                                                                                                       {t}City{/t}
+                                                                                               </LABEL>
+                                                                                       </td>
+                                                                                       <td>
+{render acl=$lACL}
+                                                                                               <input id="l" name="l" size=15 maxlength=60 value="{$info_l}">
+{/render}
+                                                                                       </td>
+                                                                               </tr>
+                                                                               <tr>
+                                                                                       <td>
+                                                                                               <LABEL for="">
+                                                                                                       {t}Postal code{/t}
+                                                                                               </LABEL>
+                                                                                       </td>
+                                                                                       <td>
+{render acl=$postalCodeACL}
+                                                                                               <input id="postalCode" name="postalCode" size=15 maxlength=60 value="{$info_postalCode}">
+{/render}
+                                                                                       </td>
+                                                                               </tr>
+                                                                               <tr>
+                                                                                       <td>
+                                                                                               <LABEL for="">
+                                                                                                       {t}Country{/t}
+                                                                                               </LABEL>
+                                                                                       </td>
+                                                                                       <td>
+{render acl=$stACL}
+                                                                                               <input id="st" name="st" size=15 maxlength=60 value="{$info_st}">
+{/render}
+                                                                                       </td>
+                                                                               </tr>
+                                                                       </table>
+                                                                       </td>
+                                                                       <td style="vertical-align:top">
+                                                                       <table summary="" width="100%">
+                                                                               <tr>
+                                                                                       <td>
+                                                                                               <LABEL for="">
+                                                                                                       {t}Address{/t}
+                                                                                               </LABEL>
+                                                                                               <br>
+                                                                                               <br>
+                                                                                       </td>
+                                                                                       <td style="vertical-align:top;">
+{render acl=$postalAddressACL}
+                                                                                               <textarea id="postalAddress" name="postalAddress" rows=1 cols=20 >{$info_postalAddress}</textarea>
+{/render}
+                                                                                       </td>
+                                                                               </tr>
+                                                                               <tr>
+                                                                                       <td>
+                                                                                               <LABEL for="">
+                                                                                                       {t}Phone{/t}    
+                                                                                               </LABEL>
+                                                                                       </td>
+                                                                                       <td>
+{render acl=$telephoneNumberACL}
+                                                                                               <input id="telephoneNumber" name="telephoneNumber" size=15 maxlength=60 value="{$info_telephoneNumber}">
+{/render}
+                                                                                       </td>
+                                                                               </tr>
+                                                                               <tr>
+                                                                                       <td>
+                                                                                               <LABEL for="">
+                                                                                                       {t}FAX{/t}
+                                                                                               </LABEL>
+                                                                                       </td>
+                                                                                       <td>
+{render acl=$facsimileTelephoneNumberACL}
+                                                                                               <input id="facsimileTelephoneNumber" name="facsimileTelephoneNumber"
+                                                                                                       size=15 maxlength=60 value="{$info_facsimileTelephoneNumber}">
+{/render}
+                                                                                       </td>
+                                                                               </tr>
+                                                                               <tr>
+                                                                                       <td>
+                                                                                               <LABEL for="">
+                                                                                                       {t}Pager{/t}
+                                                                                               </LABEL>
+                                                                                       </td>
+                                                                                       <td>
+{render acl=$pagerACL}
+                                                                                               <input id="pager" name="pager" size=15 maxlength=60 value="{$info_pager}">
+{/render}
+                                                                                       </td>
+                                                                               </tr>
+                                                                       </table>
+                                                               </td>
+                                                       </tr>
+                                               </table>
+                                       </td>
+                               </tr>
+                       </table>
+
+                       <p align=right>
+                       <input type="submit" name="save" value="{t}Save{/t}">
+                       <input type="submit" name="cancel" value="{t}Cancel{/t}">
+                       </p>
+
+               </td>
+       </tr>
+</table>
+
+<!--
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+-->
diff --git a/gosa-plugins/addressbook/address_info.tpl b/gosa-plugins/addressbook/address_info.tpl
new file mode 100644 (file)
index 0000000..3bb3a22
--- /dev/null
@@ -0,0 +1,196 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;" cellpadding=4 cellspacing=0 border=0>
+ <tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
+  <td align=left width="100%">{$storage_info}
+  </td>
+  <td>
+   <a href="{$url}">X</a>
+  </td>
+ </tr>
+
+ <tr style="background-color: white">
+  <td colspan=2>
+
+   <table summary="" width="100%" cellspacing=2 cellpadding=4>
+    <tr>
+     <td style="width:50%; vertical-align:top; background-color: #F0F0F0">
+      <h2>
+       <img class="center" alt="" src="{$personal_image}" align=middle> 
+       {t}Personal{/t}
+      </h2>
+      <table summary="" width="100%">
+       <tr>
+        <td style='width:40%;'>
+         {t}Name{/t}
+        </td> 
+        <td>
+         <i>{$info_sn}, {$info_givenName}</i>
+        </td>
+       </tr>
+       <tr>
+        <td>
+         {t}Initials{/t}
+        </td> 
+        <td>
+         <i>{$info_initials}</i>
+        </td>
+       </tr>
+       <tr>
+        <td>
+         {t}Personal title{/t}
+        </td>
+        <td>
+         <i>{$info_title}</i>
+        </td>
+       </tr>
+      </table>
+
+     </td>
+     <td style="vertical-align:top; background-color: #E8E8E8">
+
+      <h2>
+       <img class="center" alt="" src="{$home_image}" align=middle> 
+       {t}Private{/t}
+      </h2>
+
+      <table summary="" width="100%">
+        <tr>
+         <td style='vertical-align:top; width: 40%;'>
+          {t}Address{/t}
+         </td>
+         <td style="vertical-align:top;">
+          <i>{$info_homePostalAddress}</i>
+         </td>
+        </tr>
+        <tr>
+         <td>
+          {t}Phone{/t}
+         </td>
+         <td>
+          <i>{$info_homePhone}</i>
+         </td>
+        </tr>
+        <tr>
+         <td>
+          {t}Mobile{/t}
+         </td>
+         <td>
+          <i>{$info_mobile}</i>
+         </td>
+        </tr>
+        <tr>
+         <td>
+          {t}Email{/t}
+         </td>
+         <td>
+          <i><a href="mailto:{$info_givenName}%20{$info_sn}%20%3C{$info_mail}%3E">{$info_mail}</a></i>
+         </td>
+        </tr>
+       </table>
+
+      </td>
+     </tr>
+
+     <tr>
+      <td style="vertical-align:top; background-color: #E4E4E4" colspan=2>
+
+       <h2>
+        <img class="center" alt="" src="{$company_image}" align=middle> 
+        {t}Organizational{/t}
+       </h2>
+
+       <table summary="" width="100%">
+        <tr>
+         <td width='50%'>
+  
+          <table summary="" width="100%">
+           <tr>
+            <td style='width:40%;'>
+             {t}Company{/t}
+            </td>
+            <td>
+             <i>{$info_o}</i>
+            </td>
+           </tr>
+           <tr>
+            <td>
+             {t}Department{/t}
+            </td>
+            <td>
+             <i>{$info_ou}</i>
+            </td>
+           </tr>
+           <tr>
+            <td> 
+             {t}City{/t}
+            </td>
+            <td>
+             <i>{$info_l}</i>
+            </td>
+           </tr>
+           <tr>
+            <td>
+             {t}Postal code{/t}
+            </td>
+            <td>
+             <i>{$info_postalCode}</i>
+            </td>
+           </tr>
+           <tr>
+            <td>
+             {t}Country{/t}
+            </td>
+            <td>
+             <i>{$info_st}</i>
+            </td>
+           </tr>
+          </table>
+
+         </td>
+         <td style="vertical-align:top">
+
+          <table summary="" width="100%">
+           <tr>
+            <td style='vertical_align:top; width:40%;'>
+             {t}Address{/t}
+            </td>
+            <td style="vertical-align:top;">
+             <i>{$info_postalAddress}</i>
+            </td>
+           </tr>
+           <tr>
+            <td>
+             {t}Phone{/t}
+            </td>
+            <td>
+             <i>{$info_telephoneNumber}</i>
+            </td>
+           </tr>
+           <tr>
+            <td>
+             {t}FAX{/t}
+            </td>
+            <td>
+             <i>{$info_facsimileTelephoneNumber}</i>
+            </td>
+           </tr>
+           <tr>
+            <td>
+             {t}Pager{/t}
+            </td>
+            <td>
+             <i>{$info_pager}</i>
+            </td>
+           </tr>
+          </table>
+         </td>
+        </tr>
+       </table>
+
+      </td> 
+     </tr>
+    </table>
+
+   </td>
+ </tr>
+</table>
diff --git a/gosa-plugins/addressbook/class_addressbook.inc b/gosa-plugins/addressbook/class_addressbook.inc
new file mode 100644 (file)
index 0000000..eddfcdf
--- /dev/null
@@ -0,0 +1,835 @@
+<?php
+
+class addressbook extends plugin
+{
+       /* Definitions */
+       var $plHeadline   = "Addressbook";
+       var $plDescription= "This does something";
+
+  /* Generic */
+  var $ui;  
+
+       /* Phonelist attributes */
+       var $telephone_list   = array();
+       var $new_dn           = "";
+       var $orig_cn          = "";
+       var $storage_base     = "";
+       var $orig_storage_base= "";
+
+  /* Filter attributes */
+       var $start            = 0;
+       var $search_for       = "*";
+       var $search_base      = "";
+       var $search_type      = "";
+       var $range            = 20;
+
+  /* Currently edited/added entry attributes */
+       var $sn                       = "";
+       var $cn                       = "";
+       var $givenName                = "";
+       var $mail                     = "";
+       var $title                    = "";
+       var $personalTitle            = "";
+       var $initials                 = "";
+       var $homePostalAddress        = "";
+       var $homePhone                = "";
+       var $mobile                   = "";
+       var $o                        = "";
+       var $postalAddress            = "";
+       var $l                        = "";
+       var $postalCode               = "";
+       var $st                       = "";
+       var $ou                       = "";
+       var $telephoneNumber          = "";
+       var $facsimileTelephoneNumber = "";
+       var $pager                    = "";
+  var $view_logged              = FALSE;
+
+       /* attribute list for save action */
+       var $attributes= array("sn", "givenName", "mail", "title",
+                       "initials", "homePostalAddress", "displayName",
+                       "homePhone", "mobile", "o", "postalAddress", "l",
+                       "postalCode", "st", "ou", "telephoneNumber",
+                       "facsimileTelephoneNumber", "pager");
+
+       var $objectclasses= array("top", "person", "organizationalPerson", "inetOrgPerson");
+
+       var $abobjectclass= "dc=addressbook";
+
+  function addressbook (&$config, $dn= NULL)
+  {
+    /* Include config object */
+    $this->config= &$config;
+
+    /* Check if there is a special ldap-sub-tree specified, instead of dc=addressbook, */
+    $aoc = $this->config->search("addressbook", "LDAP_OBJECT_CLASS",array('menu'));
+    if ($aoc != ""){
+      $this->abobjectclass  = $aoc;
+    }
+
+    /* Get global filter config */
+    if (!session::is_set("phonefilter")){
+      $ui         = get_userinfo();
+      $base       = get_base_from_people($ui->dn);
+      $phonefilter= array(
+          "search_base"       => $base,
+          "organizational"    => "checked",
+          "global"            => "checked",
+          "search_for"        => "*",
+          "object_type"       => "*");
+      session::set("phonefilter", $phonefilter);
+    }
+     
+    $this->ui = get_userinfo();
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    $smarty= get_smarty();
+
+    /* Prevent empty variables for smarty */
+    foreach($this->attributes as $atr) {
+      $smarty->assign($atr,"");
+    }
+
+    /* Save formular information */
+    $phonefilter= session::get("phonefilter");
+    foreach( array("search_for", "search_base", "object_type") as $type){
+      if (isset($_POST[$type])){
+        $phonefilter[$type]= $_POST[$type];
+      }
+      $this->$type= $phonefilter[$type];
+    }
+    if (isset($_POST['search_base'])){
+      foreach( array("organizational", "global") as $type){
+        if (isset($_POST[$type])){
+          $phonefilter[$type]= "checked";
+        } else {
+          $phonefilter[$type]= "";
+        }
+      }
+    }
+
+    /* Search string */
+    $s= $phonefilter['search_for'];
+    if ($s == "") {
+      $s= "*";
+    }
+    if (isset($_GET['search'])){
+      $s= validate(mb_substr($_GET['search'], 0, 1, "UTF8"))."*";
+      if ($s == "**"){
+        $s= "*";
+      }
+      $this->search_for= $s;
+      $phonefilter['search_for']= $s;
+    }
+    session::set("phonefilter", $phonefilter);
+
+    /* Assign create acl */
+    $acl = $this->get_entry_acls($this->abobjectclass.",".$phonefilter['search_base']);
+    $smarty->assign("internal_createable", preg_match("/c/",$acl));
+    $smarty->assign("internal_removeable", preg_match("/d/",$acl));
+    $smarty->assign("internal_editable",   preg_match("/w/",$acl));
+
+    /* Perform actions with CTI hook */
+    if (isset($_GET['target'])
+        && isset($_GET['dial'])
+        && isset($this->config->current['CTIHOOK'])){
+
+      $dialmode= $_GET['dial'];
+      if ($dialmode == "telephoneNumber" ||
+          $dialmode == "mobile" ||
+          $dialmode == "homePhone"){
+
+        /* Get target */
+        $ldap= $this->config->get_ldap_link();
+        $ldap->cat(base64_decode($_GET['target']), array('telephoneNumber', 'mobile', 'homePhone'));
+        $attrs= $ldap->fetch();
+        if (isset($attrs["$dialmode"])){
+          $target= $attrs[$dialmode][0];
+        } else {
+          $target= "";
+        }
+
+        /* Get source */
+        $ui= get_userinfo();
+        $ldap->cat($ui->dn, array('telephoneNumber'));
+        $attrs= $ldap->fetch();
+        if (isset($attrs["telephoneNumber"])){
+          $source= $attrs['telephoneNumber'][0];
+        } else {
+          $source= "";
+        }
+
+        /* Save to session */
+        session::set('source',$source);
+        session::set('target',$target);
+
+        /* Perform call */
+        if ($target != "" && $source != ""){
+          $smarty->assign("phone_image", get_template_path('images/phone.png'));
+          $smarty->assign("dial_info", sprintf(_("Dial from %s to %s now?"), "<b style='font-size:22px; color:red'>".$source."</b>", "<b style='font-size:22px;color:red'>".$target."</b>"));
+          return($smarty->fetch(get_template_path('dial.tpl', TRUE)));
+          return;
+        } else {
+         msg_dialog::display(_("Error"), _("You need to set your personal phone number in order to perform direct dials."), ERROR_DIALOG);
+        }
+      }
+
+    }
+
+    /* Finally dial */
+    if (isset($_POST['dial']) && session::is_set('source') && session::is_set('target')){
+      exec ($this->config->current['CTIHOOK']." '".session::get('source')."' '".session::get('target')."'", $dummy, $retval);
+      session::un_set('source');
+      session::un_set('target');
+    }
+
+
+    /* Delete entry? */
+    if (isset($_POST['delete_entry_confirm'])){
+
+      /* Some nice guy may send this as POST, so we've to check
+         for the permissions again. */
+      
+      $acl = $this->get_entry_acls($this->dn);
+      if(preg_match("/d/",$acl)){
+
+        /* Delete request is permitted, perform LDAP action */
+        $ldap= $this->config->get_ldap_link();
+        $ldap->rmdir ($this->dn);
+        new log("remove","addressbook/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+        show_ldap_error($ldap->get_error(), sprintf(_("Removing of addressbook entry '%s' failed."),$this->dn));
+        new log("remove","addressbook/".get_class($this),$this->dn,array(),"Address book object'".$this->dn."' has been removed");
+  
+      } else {
+
+        /* Normally this shouldn't be reached, send some extra
+           logs to notify the administrator */
+       msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG);
+        new log("remove","addressbook/".get_class($this),$this->dn,array(),"Warning: '".$this->ui->uid."' tried to trick address book deletion.");
+      }
+
+      /* Remove lock file after successfull deletion */
+      del_lock ($this->dn);
+
+      /* Clean up */
+      if (session::is_set('saved_start')){
+        $_GET['start']= session::get('saved_start');
+      }
+      session::un_set('show_info');
+      session::un_set('saved_start');
+    }
+
+
+    /* Delete entry? */
+    if (isset($_POST['delete_cancel'])){
+      del_lock ($this->dn);
+    }
+
+
+    /* Save address entry? */
+    if (isset($_POST['save'])){
+      $this->save_object();
+      $this->storage_base= $_POST['storage_base'];
+
+      /* Perform checks */
+      $message= $this->check ();
+
+      /* No errors, save object */
+      if (count ($message) == 0){
+        $this->save();
+
+        /* Clean up */
+        if (session::is_set('saved_start')){
+          $_GET['start']= session::get('saved_start');
+        }
+        session::set('show_info',$this->dn);
+        session::un_set('saved_start');
+      } else {
+        /* Errors found, show message */
+        show_errors ($message);
+      }
+    }
+
+
+    /* Close info window */
+    if (isset($_GET['close']) || isset($_POST['cancel'])){
+      if (session::is_set('saved_start')){
+        $_GET['start']= session::get('saved_start');
+      }
+      session::un_set('show_info');
+      session::un_set('saved_start');
+    }
+
+
+    /* Start address book edit mode? */
+    if (isset($_GET['global'])){
+      if (!session::is_set('saved_start') && isset($_GET['start'])){
+        session::set('saved_start',$_GET['start']);
+      }
+      switch ($_GET['global']){
+        case "add":
+          $this->dn= "new";
+        $this->orig_cn= "";
+
+        /* Clean values */
+        foreach ($this->attributes as $name){
+          $this->$name= "";
+        }
+        $this->saved_attributes= array();
+        $this->storage_base= $this->config->current["BASE"];
+        break;
+
+        case "edit":
+          /* Clean values */
+          foreach ($this->attributes as $name){
+            $this->$name= "";
+          }
+        $this->dn= session::get('show_info'); 
+        $this->load();
+        $this->orig_cn= $this->cn;
+        break;
+        case "remove":
+          $this->dn= session::get('show_info'); 
+        $this->load();
+
+        /* Load permissions for selected 'dn' and check if
+           we're allowed to remove this 'dn' */
+        $acl = $this->get_entry_acls($this->dn);
+        if(preg_match("/d/",$acl)){
+
+          /* Check locking, save current plugin in 'back_plugin', so
+             the dialog knows where to return. */
+          if (($user= get_lock($this->dn)) != ""){
+            return(gen_locked_message ($user, $this->dn));
+          }
+
+          /* Lock the current entry, so nobody will edit it during deletion */
+          $ui= get_userinfo();
+          add_lock ($this->dn, $ui->dn);
+          $smarty->assign("info", sprintf(_("You're about to delete the entry %s."), $this->dn));
+          return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+        } else {
+
+          /* Obviously the user isn't allowed to delete. Show message and
+             clean session. */
+         msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG);
+        }
+      }
+      session::set('show_info',"ADD");
+    }
+
+
+    /* Open info window */
+    if (isset($_GET['show'])){
+      if (!session::is_set('saved_start')){
+        session::set('saved_start',$_GET['start']);
+      }
+      $this->dn = base64_decode($_GET['show']);
+      $this->view_logged =FALSE;
+      if(!$this->view_logged){
+        $this->view_logged = TRUE;
+        new log("view","addressbook/".get_class($this),$this->dn);
+      }
+      session::set('show_info',base64_decode($_GET['show']));
+    }
+
+
+    /* Get ldap link / build filter */
+    $ldap= $this->config->get_ldap_link();
+    $this->telephone_list= array ();
+
+
+    /* Assemble bases 
+        (Depending on checkboxes, we search for organisational entries or seperated 
+        adressbook entries within dc=adressbook, ) */
+    $bases= array();
+    $filter= "";
+    if ($phonefilter['global'] == "checked"){
+      $bases[]= preg_replace("/".$this->config->current['BASE']."/", $this->abobjectclass.",".$this->config->current['BASE'], $this->search_base);
+    } else {
+      $filter= '(objectClass=gosaAccount)';
+    }
+    if ($phonefilter['organizational'] == "checked"){
+      $bases[]= $this->search_base;
+    }
+
+
+    /* Only display those entries that have at least on of this attributes set */
+    $must_have_this = array("telephoneNumber","facsimileTelephoneNumber","mobile","homePhone","mail");
+
+    /* Requested attributes in ldap search */
+    $attributes = array("sn", "givenName", "telephoneNumber", "facsimileTelephoneNumber", "mobile", "homePhone", "uid", "mail", "cn");
+
+    /* Create attribute filter part */
+    $attribute_filter = "";
+    foreach($attributes as $att){
+      $attribute_filter .= "(".$att."=".$s.")";
+    }
+
+    /* Walk through bases an check for usable entries */
+    foreach ($bases as $base){
+
+      $ldap->cd ($base);
+
+      if ($phonefilter['object_type'] == '*'){
+        $ldap->search (
+            "(&(objectClass=person)$filter(!(objectClass=gosaUserTemplate))".   // Skip templates etc ..
+            "(!(uid=*$))".                                                      // Skip entries with ...$ as uid 
+            "(|".$attribute_filter."))"                                         
+          ,$attributes); 
+      } else {
+        $ldap->search ("(&$filter(!(uid=*$))(!(objectClass=gosaUserTemplate))".                     //array
+            "(".$phonefilter['object_type']."=$s))", $attributes);
+      }
+
+      /* Walk through LDAP results */
+      while ($attrs= $ldap->fetch()){
+
+        /* prevent empty vaiables */
+        foreach($this->attributes as $atr)          {
+          if(!isset($attrs[$atr][0])) {
+            $attrs[$atr][0] = "";
+          }
+        }
+
+        /* Check if page number was posted */
+        if(!isset($_GET['start'])) {
+          $_GET['start']="";
+        }
+
+        /* Check if at least one attribute is specified */
+        $skip = false;
+
+        foreach($must_have_this as $attr)      {
+          if(isset($attrs[$attr][0]) && !empty($attrs[$attr][0])){
+            $skip =false;
+            break;
+          }
+        }
+
+        /* Skip all attributes that we are not allowed to read */
+        $any = false;
+        foreach($attributes as $attr){
+    
+          $acls = $this->get_entry_acls($attrs['dn'],$attr);  
+          if(!preg_match("/r/",$acls)){
+            $attrs[$attr][0] = "";
+          }else{
+            $any = true;
+          }
+        }
+        /* Only show lines that have set any mail or phone informations */
+        if(!$skip && $any){      
+  
+          $this->telephone_list[$attrs['sn'][0].$attrs['dn']]=
+
+            "<td class=\"phonelist\" title=\"".$attrs['sn'][0].", ".$attrs['givenName'][0].
+              "\"onClick='location.href=\"main.php?plug=".validate($_GET['plug']).
+                          "&amp;start=".validate($_GET['start']).
+                          "&amp;show=".urlencode(base64_encode($attrs['dn']))."\"'>
+              <a style='vertical-align:middle;' href=\"main.php?plug=".validate($_GET['plug']).
+                          "&amp;start=".validate($_GET['start']).
+                          "&amp;show=".urlencode(base64_encode($attrs['dn']))."\">".
+               $attrs['sn'][0].", ".$attrs['givenName'][0].
+            "</a>
+            &nbsp;</td>
+            <td class=\"phonelist\" title=\""._("Dial")." ".$attrs['telephoneNumber'][0]."\">
+            <a style='vertical-align:middle;' href=\"main.php?plug=".validate($_GET['plug'])."&amp;dial=telephoneNumber&amp;start=".validate($_GET['start'])."&amp;target=".base64_encode($attrs['dn'])."\">".$attrs['telephoneNumber'][0]."
+            </a>
+            &nbsp;</td>
+            <td class=\"phonelist\" title=\"".$attrs['facsimileTelephoneNumber'][0]."\">
+            ".$attrs['facsimileTelephoneNumber'][0]."
+            &nbsp;</td>
+            <td class=\"phonelist\" title=\""._("Dial")." ".$attrs['mobile'][0]."\">
+            <a style='vertical-align:middle;' href=\"main.php?plug=".validate($_GET['plug'])."&amp;dial=mobile&amp;start=".validate($_GET['start'])."&amp;target=".base64_encode($attrs['dn'])."\">".$attrs['mobile'][0]."
+            </a>
+            &nbsp;</td>
+            <td class=\"phonelist\" title=\""._("Dial")." ".$attrs['homePhone'][0]."\">
+            <a style='vertical-align:middle;' href=\"main.php?plug=".validate($_GET['plug'])."&amp;dial=homePhone&amp;start=".validate($_GET['start'])."&amp;target=".base64_encode($attrs['dn'])."\">".$attrs['homePhone'][0]."
+            </a>
+            &nbsp;</td>
+            <td>
+            <a href=\"getvcard.php?dn=".base64_encode($attrs['dn'])."\">
+            <img align=\"top\" border=0 src=\"images/save.png\" alt=\"vcf\" title=\"".sprintf(_("Save contact for %s as vcard"), $attrs['givenName'][0]." ".$attrs['sn'][0])."\">
+            </a>";
+
+
+          if(preg_match("/r/",$this->get_entry_acls($attrs['dn'],"mail"))){
+            if (isset($attrs['mail'][0]) && !empty($attrs['mail'][0])){
+              $dest= sprintf(_("Send mail to %s"), $attrs['mail'][0]);
+              $this->telephone_list[$attrs['sn'][0].$attrs['dn']].=
+
+                "<a href=\"mailto:".htmlentities($attrs['mail'][0])."\">".
+                "<img  align=\"top\" border=0 src=\"images/mailto.png\" alt=\"vcf\" title=\"$dest\"></a>";
+            }
+          }
+          $this->telephone_list[$attrs['sn'][0].$attrs['dn']].= "&nbsp;</td>";
+        }
+      }
+      error_reporting(E_ALL | E_STRICT);
+    }
+
+    /* Sort up list */
+    ksort ($this->telephone_list);
+    reset ($this->telephone_list);
+
+    /* Fill template variables */
+    $smarty->assign("search_for", $this->search_for);
+    $smarty->assign("object_type", $this->object_type);
+
+    $this->base = $phonefilter['search_base'];
+    $smarty->assign("deplist", $this->get_allowed_bases());
+    $smarty->assign("depselect", $this->search_base);
+    $smarty->assign("global", $phonefilter['global']);
+    $smarty->assign("organizational", $phonefilter['organizational']);
+    $smarty->assign("search_image", get_template_path('images/search.png'));
+    $smarty->assign("obj_image", get_template_path('images/list_ogroup.png'));
+    $smarty->assign("tree_image", get_template_path('images/tree.png'));
+    $smarty->assign("infoimage", get_template_path('images/info.png'));
+    $smarty->assign("actionimage", get_template_path('images/action.png'));
+    $smarty->assign("launchimage", get_template_path('images/launch.png'));
+
+    /* Generate alphabet */
+    $alphabet= generate_alphabet();
+
+    /* Build list output */
+    $output= "";
+    $mod= 0;
+
+
+    /* View detailed infos */
+    $smarty->assign("show_info", "");
+    if (session::is_set('show_info')){
+
+      $range= 4;
+      $smarty->assign("show_info", "1");
+      $smarty->assign("url", "main.php?plug=".validate($_GET['plug'])."&amp;close=1");
+
+      $tmp = $this->plInfo();
+
+      if(isset($_POST['storage_base'])){
+        $this->storage_base = $_POST['storage_base'];  
+      }
+
+      switch (session::get('show_info')){
+
+        case "ADD":
+
+          $a_bases = $this->get_allowed_bases();
+  
+          if(!isset($a_bases[$this->storage_base])){
+            $base = key($this->get_allowed_bases());
+            $this->storage_base = $base;
+          } 
+
+          $smarty->assign ('storage_base', $this->storage_base);
+          $smarty->assign ('address_info', get_template_path('address_edit.tpl', TRUE));
+
+          foreach($tmp['plProvidedAcls'] as $name => $translated){
+            $smarty->assign($name."ACL",$this->get_entry_acls($this->abobjectclass.",".$base,$name));
+          }
+        break;
+
+        default:
+          $smarty->assign ('address_info', get_template_path('address_info.tpl', TRUE));
+          foreach($tmp['plProvidedAcls'] as $name => $translated){
+            $smarty->assign($name."ACL",$this->get_entry_acls($this->dn,$name));
+          }
+        break;
+      }
+
+      /* Fill variables from LDAP */
+      if (session::get('show_info') != "ADD"){
+        $ldap->cat(session::get('show_info'), $this->attributes);
+        $info= $ldap->fetch();
+      }
+      foreach ($this->attributes as $name){
+
+        /* Skip entries we are not allowed to read */
+        if(!preg_match("/r/",$this->get_entry_acls($this->dn,$name))){
+          $smarty->assign("info_$name", "");
+        }else
+
+        if (session::get('show_info') != "ADD" && isset($info["$name"][0])){
+          error_reporting(0);
+          /* Special treatment for phone attributes */
+          if ($name == "mobile" ||
+              $name == "homePhone" ||
+              $name == "telephoneNumber"){
+            $smarty->assign("info_$name",
+                "<a title=\""._("Dial")." ".$info["$name"][0]."\" href=\"main.php?plug=".validate($_GET['plug'])."&amp;dial=$name&amp;start=".validate($_GET['start'])."&amp;target=".base64_encode(session::get('show_info'))."\">".$info["$name"][0]."</a>");
+          } else {
+            $smarty->assign("info_$name", preg_replace("/\n/", "<br>", $info["$name"][0]));
+          }
+          error_reporting(E_ALL | E_STRICT);
+        } elseif (session::get('show_info') == "ADD" && isset($this->$name)) {
+          $smarty->assign("info_$name", $this->$name);
+        } else {
+          $smarty->assign("info_$name", "-");
+        }
+      }
+      if (preg_match("/,".$this->abobjectclass.",/", session::get('show_info'))){
+        $storage= _("global addressbook");
+        $smarty->assign("internal", 0);
+      } else {
+        $storage= _("user database");
+        $smarty->assign("internal", 1);
+      }
+      if (session::get('show_info') != "ADD"){
+        $smarty->assign("storage_info", sprintf(_("Contact stored in '%s'"), $storage));
+      } else {
+        $smarty->assign("storage_info", _("Creating new entry in"));
+      }
+    } else {
+
+
+      if(isset($_POST['EntryPerPage'])){
+        $this->range = $_POST['EntryPerPage'];
+      }
+      $range = $this->range;   
+      $smarty->assign("internal", 1);
+    }
+    if (isset($_GET['start'])){
+      $this->start= validate($_GET['start']);
+    }
+    foreach ($this->telephone_list as $val){
+      if ($mod < $this->start) {
+        $mod++;
+        continue;
+      }
+      if ($mod >= ($this->start + $range)){
+        $mod++;
+        break;
+      }
+      if ( ($mod++) & 1){
+        $col= "style=\"background-color: #ECECEC;\"";
+      } else {
+        $col= "style=\"background-color: #F5F5F5;\"";
+      }
+      $output.= "<tr $col>\n$val</tr>\n";
+    }
+
+    $smarty->assign("search_result", $output);
+    $smarty->assign("apply", apply_filter());
+    $smarty->assign("alphabet", $alphabet);
+    if($range < 20){
+      $smarty->assign("range_selector", range_selector(count($this->telephone_list), $this->start, $range));
+    }else{
+      $smarty->assign("range_selector", range_selector(count($this->telephone_list), $this->start, $range, "EntryPerPage"));
+    }
+    $tmp= array("*" => _("All"), "sn" => _("Name"), "givenName" => _("Given name"),
+        "telephoneNumber" => _("Work phone"), "mobile" => _("Cell phone"),
+        "homePhone" => _("Home phone"), "uid" => _("User ID"));
+    natsort($tmp);
+    $smarty->assign("objlist", $tmp);
+
+    /* Show main page */
+    $smarty->assign ('personal_image', get_template_path('images/addr_personal.png'));
+    $smarty->assign ('home_image', get_template_path('images/addr_home.png'));
+    $smarty->assign ('company_image', get_template_path('images/addr_company.png'));
+    $smarty->assign ('add_image', get_template_path('images/editpaste.png'));
+    $smarty->assign ('edit_image', get_template_path('images/edit.png'));
+    $smarty->assign ('delete_image', get_template_path('images/editdelete.png'));
+    return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+  }
+
+  function save_object()
+  {
+    plugin::save_object();
+    foreach($this->attributes as $attr){
+
+      /* save attributes depending on acls */
+      $acl = $this->get_entry_acls($this->dn,$attr);
+
+      if(preg_match("/w/",$acl)){
+        if(isset($_POST[$attr])){
+          $this->$attr = $_POST[$attr];
+        }
+      }
+
+    }
+  }
+
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    /* must: sn, givenName */
+    if ($this->sn == ""){
+      $message[]= _("The required field 'Name' is not set.");
+      return ($message);
+    }
+    if ($this->givenName == ""){
+      $message[]= _("The required field 'Given name' is not set.");
+      return ($message);
+    }
+
+    /* Check for valid name definition */
+    if (preg_match ("/[\\\\]/", $this->sn)){
+      $message[]= _("The field 'Name' contains invalid characters.");
+    }
+    if (preg_match ("/[\\\\]/", $this->givenName)){
+      $message[]= _("The field 'Given name' contains invalid characters.");
+    }
+
+    /* Check phone numbers */
+    if (!tests::is_phone_nr($this->homePhone)){
+      $message[]= _("The field 'Phone' contains an invalid phone number.");
+    }
+    if (!tests::is_phone_nr($this->telephoneNumber)){
+      $message[]= _("The field 'Phone' contains an invalid phone number.");
+    }
+    if (!tests::is_phone_nr($this->facsimileTelephoneNumber)){
+      $message[]= _("The field 'Fax' contains an invalid phone number.");
+    }
+    if (!tests::is_phone_nr($this->mobile)){
+      $message[]= _("The field 'Mobile' contains an invalid phone number.");
+    }
+    if (!tests::is_phone_nr($this->pager)){
+      $message[]= _("The field 'Pager' contains an invalid phone number.");
+    }
+
+    /* Check for reserved characers */
+    if (preg_match ('/[,+"<>;]/', $this->givenName)){
+      $message[]= _("The field 'Given name' contains invalid characters.");
+  }
+  if (preg_match ('/[,+"<>;]/', $this->sn)){
+    $message[]= _("The field 'Name' contains invalid characters.");
+  }
+
+  /* Check mail */
+  if (!tests::is_email($this->mail)){
+    $message[]= _("Please enter a valid email address in 'Primary address' field.");
+  }
+
+  /* Assemble cn/dn */
+  $this->cn= $this->givenName." ".$this->sn;
+  if ($this->orig_cn != $this->cn || $this->storage_base != $this->orig_storage_base){
+    $this->new_dn= $this->create_unique_dn("cn", preg_replace("/,*".$this->config->current['BASE']."$/", "", $this->storage_base).",".$this->abobjectclass.",".$this->config->current['BASE']);
+    if ($this->new_dn == "none"){
+      $message[]= _("Cannot create a unique DN for your entry. Please fill more formular fields.");
+      return ($message);
+    }
+  } else {
+    $this->new_dn= $this->dn;
+  }
+
+  return ($message);
+  }
+
+
+  function load()
+  {
+    /* Load base attributes */
+    plugin::plugin ($this->config, $this->dn);
+    $this->view_logged = FALSE;
+    $this->storage_base= preg_replace('/^[^,]+,/', '', preg_replace('/'.$this->abobjectclass.',/', '', $this->dn));
+  }
+
+
+  function save()
+  {
+    /* First use parents methods to do some basic fillup in $this->attrs */
+    plugin::save ();
+
+    $this->attrs['cn']= $this->cn;
+    $this->attrs['displayName']= $this->givenName." ".$this->sn;
+
+    /* Move entry if it got another name... */
+    if ($this->dn != "new" && $this->dn != $this->new_dn){
+      $this->move($this->dn, $this->new_dn);
+    }
+    $this->dn= $this->new_dn;
+
+    /* Save data. Using 'modify' implies that the entry is already present, use 'add' for
+       new entries. So do a check first... */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cat ($this->dn,array('dn'));
+    if ($ldap->fetch()){
+      $mode= "modify";
+    } else {
+      $mode= "add";
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+    }
+
+    /* Finally write data with selected 'mode' */
+    $ldap->cd ($this->dn);
+    $this->cleanup();
+    $ldap->$mode ($this->attrs);
+    if (show_ldap_error($ldap->get_error(), sprintf(_("Removing of addressbook entry '%s' failed."),$this->dn))){
+      return (1);
+    }
+
+    if($mode == "add"){
+      new log("create","addressbook/".get_class($this),$this->dn, array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("modify","addressbook/".get_class($this),$this->dn, array_keys($this->attrs),$ldap->get_error());
+    }
+  }
+
+  
+  /* Return entry acls */
+  function get_entry_acls($dn,$attr = "")
+  {
+    $acls = "";
+  
+    /* Use addressbook acls */
+    if(preg_match("/".normalizePreg($this->abobjectclass)."/",$dn))  {
+      $dn = preg_replace("/".normalizePreg($this->abobjectclass).",/","",$dn);
+      $acls = $this->ui->get_permissions($dn,"addressbook/addressbook",$attr);
+    }
+    
+    /* Use Organizational Person acls */
+    else{
+      $acls = $this->ui->get_permissions($dn,"users/user",$attr);
+    }
+
+    return($acls);
+  }
+
+
+  /* Return plugin informations for acl handling  */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName" => _("Addressbook"),
+          "plDescription" => _("Addressbook entry acls"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("addons" => _("Addons")),
+          "plCategory"    => array("addressbook" => array("objectClass" => "inetOrgPerson", "description" => _("Addressbook"))),
+
+          "plProvidedAcls"    => array(
+            "sn"                        => _("Surename"),         
+            "givenName"                 => _("Given name"), 
+            "telephoneNumber"           => _("Telefon number"), 
+            "facsimileTelephoneNumber"  => _("Fax number"), 
+            "mobile"                    => _("Mobile number"), 
+            "homePhone"                 => _("Home phone number"), 
+            "uid"                       => _("User identification"), 
+            "mail"                      => _("Mail address"), 
+            "pager"                     => _("Pager"),
+            "o"                         => _("Organization"),
+            "ou"                        => _("Department"),
+            "l"                         => _("Location"),
+            "postalAddress"             => _("Postal address"),
+            "postalCode"                => _("Postal address"),
+            "st"                        => _("State"),
+            "initials"                  => _("Initials"), 
+            "title"                     => _("Title"), 
+            "homePostalAddress"         => _("Home postal address"), 
+            "cn"                        => _("Common name"))
+            ));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/addressbook/contents.tpl b/gosa-plugins/addressbook/contents.tpl
new file mode 100644 (file)
index 0000000..004e3d2
--- /dev/null
@@ -0,0 +1,127 @@
+<table summary="" style="table-layout:fixed; width:100%; vertical-align:top; text-align:left; table-layout:auto;" cellpadding="4" border="0">
+<tr>
+  <td style="vertical-align:top;">
+   <table summary="" style="border:1px solid #B0B0B0; width:100%; vertical-align:top; text-align:left;"  cellpadding="4" cellspacing="0">
+    <colgroup>
+        <col width="32%">
+        <col width="14%">
+        <col width="14%">
+        <col width="14%">
+        <col width="14%">
+        <col width="8%">
+    </colgroup>
+    <tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
+     <td class="tbhead">{t}Name{/t}</td><td class="tbhead">{t}Phone{/t}</td><td class="tbhead">{t}Fax{/t}</td>
+     <td class="tbhead">{t}Mobile{/t}</td><td class="tbhead">{t}Private{/t}</td><td class="tbrhead">{t}Contact{/t}</td>
+    </tr>
+    {$search_result}
+   </table>
+
+   <table summary="" style="vertical-align:top; text-align:center; width:100%;" cellpadding="4" cellspacing="0" border="0">
+    <tr>
+     <td>{$range_selector}</td>
+    </tr>
+   </table>
+
+   {if $show_info eq 1}
+    {include file=$address_info}
+   {/if}
+
+  </td>
+  <td style="vertical-align:top; width:270px;">
+   <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;">
+    <p class="contentboxh"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
+   </div>
+   <div class="contentboxb">
+    <p class="contentboxb">
+     {t}The telephone list plugin provides list and search facilities for the people in your site. You may want to specify the asterisk [*] like in 'Go*us' to find 'Gonicus'. Use the filters below to narrow down your search.{/t}
+    </p>
+   </div>
+   <br>
+   <div class="contentboxh">
+    <p class="contentboxh" style="vertical-align:middle;"><img src="{$actionimage}" style="vertical-align:middle;" align="right" alt="[a]">{t}Actions{/t}</p>
+   </div>
+   <div class="contentboxb">
+    <p class="contentboxb" style="vertical-align:middle;">
+{if $internal_createable}
+     <img class="center" alt="" src="{$add_image}">&nbsp;
+     <a href="main.php{$plug}&amp;global=add" style="text-align:center;vertical-align:middle;">{t}Add entry{/t}</a><br>
+{/if}
+
+{if $internal eq 0}
+ {if $internal_editable}
+     <img alt="" src="{$edit_image}" class="center">&nbsp;
+     <a href="main.php{$plug}&amp;global=edit">{t}Edit entry{/t}</a><br>
+ {/if}
+ {if $internal_removeable}
+            <img alt="" src="{$delete_image}" class="center">&nbsp;
+            <a href="main.php{$plug}&amp;global=remove" style="vertical-align:middle;">{t}Remove entry{/t}</a><br>
+ {/if}
+{/if}
+    </p>
+   </div>
+   <br>
+   <div class="contentboxh">
+    <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
+   </div>
+   <div class="contentboxb">
+    <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+     {$alphabet}
+    </table>
+    
+<table summary=""  style="width:100%;border-top:1px solid #B0B0B0;">
+       <tr>
+               <td>
+<input type="checkbox" name="organizational" value="1" {$organizational} onClick="mainform.submit()" title="{t}Select to see regular users{/t}">{t}Show organizational entries{/t}<br>
+    <input type="checkbox" name="global" value="1" {$global} onClick="mainform.submit()" title="{t}Select to see users in addressbook{/t}">{t}Show addressbook entries{/t}<br>
+               </td>
+       </tr>
+</table>
+
+<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+       <tr>
+               <td>
+                       <label for="search_base"><img class="center" alt="" src="{$tree_image}" align=middle title='{t}Display results for department{/t}'></label>
+               </td>
+       <td>
+                       <select name="search_base" style='width:220px' onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
+                       {html_options options=$deplist selected=$depselect}
+                               <option disabled>&nbsp;</option>
+               </select>
+               </td>
+       </tr>
+</table>
+<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+       <tr>
+               <td>
+                       <label for="object_type"><img class="center" alt="" src="{$obj_image}" align=middle title='{t}Match object{/t}'></label>
+               </td>
+           <td>
+                       <select id="object_type" style='width:220px' name="object_type" onChange="mainform.submit()" title="{t}Choose the object that will be searched in{/t}">
+                       {html_options options=$objlist selected=$object_type}
+                               <option disabled>&nbsp;</option>
+               </select>
+           </td>
+       </tr>
+</table>
+<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+       <tr>
+               <td><label for="search_for"><img class="center" alt="" src="{$search_image}" style="text-align:center;" title='{t}Search for{/t}'></label>
+               </td>
+           <td>
+                       <input id="search_for" style='width:99%' type='text' name='search_for' maxlength='20' value='{$search_for}' title='{t}Search string{/t}' onChange="mainform.submit()">
+               </td>
+       </tr>
+</table>
+   {$apply}
+   </div>
+  </td>
+</tr>
+</table>
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('search_for');
+  -->
+</script>
diff --git a/gosa-plugins/addressbook/dial.tpl b/gosa-plugins/addressbook/dial.tpl
new file mode 100644 (file)
index 0000000..b10b8db
--- /dev/null
@@ -0,0 +1,15 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;" cellpadding=4 cellspacing=0 border=0>
+<tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
+<td align=left width="100%"><LABEL for="dial">{t}Dial connection...{/t}</LABEL></td>
+</tr>
+<tr style="background-color: white">
+<td style="text-align:center;">
+ <div style="height:50px;">&nbsp;</div>
+ <a style="font-size:22px"><img alt="" src="{$phone_image}" align=middle>{$dial_info}</a>
+ <div style="height:60px;">&nbsp;</div>
+ <input type='submit' name='dial' id="dial" value='{t}Dial{/t}'>&nbsp;<input type='submit' name='cancel' value='{t}Cancel{/t}'>
+
+</td>
+
+</tr>
+</table>
diff --git a/gosa-plugins/addressbook/main.inc b/gosa-plugins/addressbook/main.inc
new file mode 100644 (file)
index 0000000..faa5ee5
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+/*
+  This code is part of GOsa (https://gosa.gonicus.de)
+  Copyright (C) 2003  Cajus Pollmeier
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+if (!$remove_lock){
+       /* Create phonelist object on demand */
+       if (!session::is_set('addressbook') || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+               $addressbook = new addressbook ($config);
+               $addressbook -> set_acl_base($ui->dn);
+               $addressbook -> set_acl_category("addressbook");        
+               session::set('addressbook',$addressbook);
+               session::un_set('show_info');
+       }
+       $addressbook= session::get('addressbook');
+
+       /* Execute formular */
+       $display= $addressbook->execute ();
+       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+
+       /* Page header*/
+       $display= print_header(get_template_path('images/addressbook.png'), _("Address book")).$display;
+
+       /* Store changes  in session */
+       session::set('addressbook',$addressbook);
+}
+?>
diff --git a/gosa-plugins/addressbook/remove.tpl b/gosa-plugins/addressbook/remove.tpl
new file mode 100644 (file)
index 0000000..ba37685
--- /dev/null
@@ -0,0 +1,18 @@
+<div style="font-size:18px;">
+ <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+<p>
+  {$info}
+  {t}This includes all addressbook data in this entry. Please double check if your really want to do this since there is no way for GOsa to get your data back.{/t}
+</p>
+
+<p>
+ {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+  <input type=submit name="delete_entry_confirm" value="{t}Delete{/t}">
+  &nbsp;
+  <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+</p>
+