/usr/share/horde/turba/lib/Form/EditContactGroup.php is in php-horde-turba 4.1.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | <?php
/**
* @package Turba
*/
class Turba_Form_EditContactGroup extends Turba_Form_EditContact
{
public function __construct($vars, $contact)
{
$this->addHidden('', 'objectkeys', 'text', false);
$this->addHidden('', 'original_source', 'text', false);
$action = $this->addHidden('', 'actionID', 'text', false);
$action->setDefault('groupedit');
parent::__construct($vars, $contact);
$vars->set('actionID', 'groupedit');
$objectkeys = $vars->get('objectkeys');
$source = $vars->get('source');
$key = $vars->get('key');
if (count($objectkeys) == 1) {
/* Only one contact. */
$this->setButtons(_("Finish"));
} elseif ($source . ':' . $key == $objectkeys[0]) {
/* First contact */
$this->setButtons(_("Next"));
$this->appendButtons(_("Finish"));
} elseif ($source . ':' . $key == $objectkeys[count($objectkeys) - 1]) {
/* Last contact */
$this->setButtons(_("Previous"));
$this->appendButtons(_("Finish"));
} else {
/* In between */
$this->setButtons(_("Previous"));
$this->appendButtons(_("Next"));
$this->appendButtons(_("Finish"));
}
}
public function renderActive($renderer, $vars, $action, $method)
{
parent::renderActive($renderer, $vars, $action, $method);
$results = new Turba_List($vars->get('objectkeys'));
/* Don't show listview if only 1 entry. */
if (count($results) > 1) {
/* Read the columns to display from the preferences. */
$source = $vars->get('source');
$sources = Turba::getColumns();
$listView = new Turba_View_List(
$results,
array(
'Group' => true
),
isset($sources[$source]) ? $sources[$source] : array()
);
echo '<br />' . $listView->getPage($numDisplayed);
}
}
public function execute()
{
parent::execute();
$this->getInfo($this->_vars, $info);
$next_page = Horde::url('edit.php', true)->add(array(
'source' => $info['source'],
'original_source' => $info['original_source'],
'objectkeys' => $info['objectkeys'],
'url' => $info['url'],
'actionID' => 'groupedit'
));
$objectkey = array_search($info['source'] . ':' . $info['key'], $info['objectkeys']);
$submitbutton = $this->_vars->get('submitbutton');
if ($submitbutton == _("Finish")) {
$next_page = Horde::url('browse.php', true);
if ($info['original_source'] == '**search') {
$next_page->add('key', $info['original_source']);
} else {
$next_page->add('source', $info['original_source']);
}
} elseif ($submitbutton == _("Previous") && $info['source'] . ':' . $info['key'] != $info['objectkeys'][0]) {
/* Previous contact */
list(, $previous_key) = explode(':', $info['objectkeys'][$objectkey - 1]);
$next_page->add('key', $previous_key);
if ($this->getOpenSection()) {
$next_page->add('__formOpenSection', $this->getOpenSection());
}
} elseif ($submitbutton == _("Next") &&
$info['source'] . ':' . $info['key'] != $info['objectkeys'][count($info['objectkeys']) - 1]) {
/* Next contact */
list(, $next_key) = explode(':', $info['objectkeys'][$objectkey + 1]);
$next_page->add('key', $next_key);
if ($this->getOpenSection()) {
$next_page->add('__formOpenSection', $this->getOpenSection());
}
}
$next_page->redirect();
}
}
|