Пример #1
0
 public function html($active = true)
 {
     global $browser, $vars;
     if (!$this->contact) {
         echo '<h3>' . _("The requested contact was not found.") . '</h3>';
         return;
     }
     if (!$this->contact->hasPermission(Horde_Perms::EDIT)) {
         if (!$this->contact->hasPermission(Horde_Perms::READ)) {
             echo '<h3>' . _("You do not have permission to view this contact.") . '</h3>';
             return;
         } else {
             echo '<h3>' . _("You only have permission to view this contact.") . '</h3>';
             return;
         }
     }
     echo '<div id="EditContact"' . ($active ? '' : ' style="display:none"') . '>';
     $form = new Turba_Form_EditContact($vars, $this->contact);
     $form->renderActive($form->getRenderer(), $vars, Horde::url('edit.php'), 'post');
     echo '</div>';
     if ($active && $browser->hasFeature('dom')) {
         if ($this->contact->hasPermission(Horde_Perms::READ)) {
             $view = new Turba_View_Contact($this->contact);
             $view->html(false);
         }
         if ($this->contact->hasPermission(Horde_Perms::DELETE)) {
             $delete = new Turba_View_DeleteContact($this->contact);
             $delete->html(false);
         }
     }
 }
Пример #2
0
 public function html($active = true)
 {
     global $browser, $conf, $registry;
     if (!$this->contact || !$this->contact->hasPermission(Horde_Perms::READ)) {
         echo '<h3>' . _("The requested contact was not found.") . '</h3>';
         return;
     }
     $vars = new Horde_Variables();
     $form = new Turba_Form_Contact($vars, $this->contact);
     $form->setOpenSection(Horde_Util::getFormData('section', 0));
     /* Get the contact's history. */
     $history = $this->contact->getHistory();
     foreach ($history as $what => $when) {
         $v = $form->addVariable($what == 'created' ? _("Created") : _("Last Modified"), 'object[__' . $what . ']', 'text', false, false);
         $v->disable();
         $vars->set('object[__' . $what . ']', $when);
     }
     echo '<div id="Contact"' . ($active ? '' : ' style="display:none"') . '>';
     $form->renderInactive($form->getRenderer(), $vars);
     /* Comments. */
     if (!empty($conf['comments']['allow']) && $registry->hasMethod('forums/doComments')) {
         try {
             $comments = $registry->call('forums/doComments', array('turba', $this->contact->driver->getName() . '.' . $this->contact->getValue('__key'), 'commentCallback'));
         } catch (Horde_Exception $e) {
             Horde::log($e, 'DEBUG');
             $comments = array();
         }
     }
     if (!empty($comments['threads'])) {
         echo '<br />' . $comments['threads'];
     }
     if (!empty($comments['comments'])) {
         echo '<br />' . $comments['comments'];
     }
     echo '</div>';
     if ($active && $browser->hasFeature('dom')) {
         if ($this->contact->hasPermission(Horde_Perms::EDIT)) {
             $edit = new Turba_View_EditContact($this->contact);
             $edit->html(false);
         }
         if ($this->contact->hasPermission(Horde_Perms::DELETE)) {
             $delete = new Turba_View_DeleteContact($this->contact);
             $delete->html(false);
         }
     }
 }
Пример #3
0
    $notification->push(_("This contact has been marked as your own."), 'horde.success');
}
// Get view.
$viewName = Horde_Util::getFormData('view', 'Contact');
switch ($viewName) {
    case 'Contact':
        $view = new Turba_View_Contact($contact);
        if (!$vars->get('url')) {
            $vars->set('url', $contact->url(null, true));
        }
        break;
    case 'EditContact':
        $view = new Turba_View_EditContact($contact);
        break;
    case 'DeleteContact':
        $view = new Turba_View_DeleteContact($contact);
        break;
}
// Get tabs.
$url = $contact->url();
$tabs = new Horde_Core_Ui_Tabs('view', $vars);
$tabs->addTab(_("_View"), $url, array('tabname' => 'Contact', 'id' => 'tabContact', 'class' => 'horde-icon', 'onclick' => 'return TurbaTabs.showTab(\'Contact\');'));
if ($contact->hasPermission(Horde_Perms::EDIT)) {
    $tabs->addTab(_("_Edit"), $url, array('tabname' => 'EditContact', 'id' => 'tabEditContact', 'class' => 'horde-icon', 'onclick' => 'return TurbaTabs.showTab(\'EditContact\');'));
}
if ($contact->hasPermission(Horde_Perms::DELETE)) {
    $tabs->addTab(_("De_lete"), $url, array('tabname' => 'DeleteContact', 'id' => 'tabDeleteContact', 'class' => 'horde-icon', 'onclick' => 'return TurbaTabs.showTab(\'DeleteContact\');'));
}
$owner = explode(';', $prefs->getValue('own_contact'));
if (count($owner) == 2 && $owner[0] == $source && $owner[1] == $contact->getValue('__key')) {
    $own_icon = ' ' . Horde_Themes_Image::tag('user.png', array('alt' => _("Your own contact"), 'attr' => array('title' => _("Your own contact"))));