[turba] Adding Contacts from Global Address Book

Rob Wiltbank chade at hopi.dtcc.edu
Mon Aug 11 13:46:09 PDT 2003


Just whipped this up...  think I covered everything -- thoughts?

addobject.php
Below includes:
//
// Adds contact from global list.
//
// As long as we're at *least* sent and
// email address we can build an entry.
//
if (isset($_GET['incEmail'])) {
   $incoming['Name']       = $_GET['incName'];
   $incoming['Fullname']   = $_GET['incFullname'];
   $incoming['Department'] = $_GET['incDepartment'];
   $incoming['Givenname']  = $_GET['incGivenname'];
   $incoming['Surname']    = $_GET['incSurname'];
   list($incoming['Email'], $null) = split('[?]', $_GET['incEmail']); 
//Clean up the email address.
}


templates/add/add.inc
Around line 44:
    else:
// (commented)       $value = htmlspecialchars($this->object->getValue($key));
//
// Populate form with global addressbook data.
//
       switch($key) {
          case "fullname":
             $value = $incoming['Fullname'];
             break;
          case "email":
             $value = $incoming['Email'];
             break;
          case "name":
             $value = $incoming['Name'];
             break;
          case "department":
             $value = $incoming['Department'];
             break;
          case "surname":
             $value = $incoming['Surname'];
             break;
          case "givenname":
             $value = $incoming['Givenname'];
             break;
          default:
              $value = htmlspecialchars($this->object->getValue($key));
              break;
       }

displayobject.php
Around line 37:
   change: $view->display(); to $view->display(NULL);

templates/display/display.inc
Around line 92:
        switch($key) {
           case "name":
              $incName = $value;
              break;
           case "fullname":
              $incFullname = $value;
              break;
           case "department":
              $incDepartment = $value;
              break;
           case "surname":
              $incSurname = $value;
              break;
           case "givenname":
              $incGivenname = $value;
              break;
        }

templates/display/display.inc
Around line 125 (under endif):
<?php if (!($this->object->isEditable())):
   $incEmail = $mailbox_host[0] . "@" . $mailbox_host[1];
   $strLink = 
"addobject.php?incName=$incName&incFullname=$incFullname&incDepartment=$incDepartment&incSurname=$incSurname&incGivenname=$incGivenname&incEmail=$incEmail";
?>
<tr>
    <td colspan="2" class="header" align="right"><span 
class="smallheader">
       <?php echo Horde::link(Horde::applicationUrl($strLink . $url), _("Add"), 'menuitem') . _("Add"); ?></a>
    </span></td>
</tr>
<?php endif ?>

lib/ObjectView.php
Around line 44:
   Change function display() to function display($incoming)

-- 

*******************************************************************
*    Rob Wiltbank        * Delaware Technical & Community College *
* Application Specialist *      Computer Services Department      * 
*  chade at hopi.dtcc.edu   *          Wilmington Campus             *
*     302.571.5398       *            Lackey @ Large              *
*******************************************************************



More information about the turba mailing list