示例#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)
    {
        if (!$this->contact) {
            echo '<h3>' . _("The requested contact was not found.") . '</h3>';
            return;
        }
        if (!$this->contact->hasPermission(Horde_Perms::DELETE)) {
            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="DeleteContact"' . ($active ? '' : ' style="display:none"') . '>';
        ?>
        <form action="<?php 
        echo Horde::url('delete.php');
        ?>
" method="post">
        <?php 
        echo Horde_Util::formInput();
        ?>
        <input type="hidden" name="url" value="<?php 
        echo htmlspecialchars(Horde_Util::getFormData('url'));
        ?>
" />
        <input type="hidden" name="source" value="<?php 
        echo htmlspecialchars($this->contact->driver->getName());
        ?>
" />
        <input type="hidden" name="key" value="<?php 
        echo htmlspecialchars($this->contact->getValue('__key'));
        ?>
" />
        <div class="headerbox" style="padding: 8px">
         <p><?php 
        echo _("Permanently delete this contact?");
        ?>
</p>
         <input type="submit" class="horde-delete" name="delete" value="<?php 
        echo _("Delete");
        ?>
" />
        </div>
        </form>
        </div>
        <?php 
        if ($active && $GLOBALS['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::EDIT)) {
                $delete = new Turba_View_EditContact($this->contact);
                $delete->html(false);
            }
        }
    }