1: <?php
2: 3: 4: 5: 6: 7: 8:
9: class Turba_View_DeleteContact
10: {
11: 12: 13: 14:
15: public $contact;
16:
17: 18: 19:
20: public function __construct(Turba_Object $contact)
21: {
22: $this->contact = $contact;
23: }
24:
25: public function getTitle()
26: {
27: return $this->contact
28: ? sprintf($this->contact->isGroup() ? _("Delete Group \"%s\"") : _("Delete \"%s\""), $this->contact->getValue('name'))
29: : _("Not Found");
30: }
31:
32: public function html($active = true)
33: {
34: global $conf, $prefs;
35:
36: if (!$this->contact) {
37: echo '<h3>' . _("The requested contact was not found.") . '</h3>';
38: return;
39: }
40:
41: if (!$this->contact->hasPermission(Horde_Perms::DELETE)) {
42: if (!$this->contact->hasPermission(Horde_Perms::READ)) {
43: echo '<h3>' . _("You do not have permission to view this contact.") . '</h3>';
44: return;
45: } else {
46: echo '<h3>' . _("You only have permission to view this contact.") . '</h3>';
47: return;
48: }
49: }
50:
51: echo '<div id="DeleteContact"' . ($active ? '' : ' style="display:none"') . '>';
52: ?>
53: <form action="<?php echo Horde::url('delete.php') ?>" method="post">
54: <?php echo Horde_Util::formInput() ?>
55: <input type="hidden" name="url" value="<?php echo htmlspecialchars(Horde_Util::getFormData('url')) ?>" />
56: <input type="hidden" name="source" value="<?php echo htmlspecialchars($this->contact->driver->getName()) ?>" />
57: <input type="hidden" name="key" value="<?php echo htmlspecialchars($this->contact->getValue('__key')) ?>" />
58: <div class="headerbox" style="padding: 8px">
59: <p><?php echo _("Permanently delete this contact?") ?></p>
60: <input type="submit" class="button" name="delete" value="<?php echo _("Delete") ?>" />
61: </div>
62: </form>
63: </div>
64: <?php
65: if ($active && $GLOBALS['browser']->hasFeature('dom')) {
66: if ($this->contact->hasPermission(Horde_Perms::READ)) {
67: $view = new Turba_View_Contact($this->contact);
68: $view->html(false);
69: }
70: if ($this->contact->hasPermission(Horde_Perms::EDIT)) {
71: $delete = new Turba_View_EditContact($this->contact);
72: $delete->html(false);
73: }
74: }
75: }
76:
77: }
78: