/usr/share/horde/turba/lib/Prefs/Special/Columnselect.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 107 108 109 110 111 112 113 114 115 116 117 118 | <?php
/**
* Special prefs handling for the 'columnselect' preference.
*
* Copyright 2012-2013 Horde LLC (http://www.horde.org/)
*
* See the enclosed file LICENSE for license information (ASL). If you did
* did not receive this file, see http://www.horde.org/licenses/apache.
*
* @author Michael Slusarz <slusarz@horde.org>
* @category Horde
* @license http://www.horde.org/licenses/apache ASL
* @package Turba
*/
class Turba_Prefs_Special_Columnselect implements Horde_Core_Prefs_Ui_Special
{
/**
*/
public function init(Horde_Core_Prefs_Ui $ui)
{
}
/**
*/
public function display(Horde_Core_Prefs_Ui $ui)
{
global $attributes, $cfgSources, $injector, $page_output, $prefs;
$page_output->addScriptFile('scriptaculous/effects.js', 'horde');
$page_output->addScriptFile('scriptaculous/dragdrop.js', 'horde');
$page_output->addScriptFile('columnprefs.js');
$sources = Turba::getColumns();
$t = $injector->createInstance('Horde_Template');
$t->setOption('gettext', true);
$t->set('columns', htmlspecialchars($prefs->getValue('columns')));
$col_list = $cols = array();
foreach ($cfgSources as $source => $info) {
$col_list[] = array(
'first' => empty($col_list),
'source' => htmlspecialchars($source),
'title' => htmlspecialchars($info['title'])
);
// First the selected columns in their current order.
$i = 0;
$inputs = array();
if (isset($sources[$source])) {
$selected = array_flip($sources[$source]);
foreach ($sources[$source] as $column) {
if ((substr($column, 0, 2) == '__') ||
($column == 'name')) {
continue;
}
$inputs[] = array(
'checked' => isset($selected[$column]),
'column' => htmlspecialchars($column),
'i' => $i++,
'label' => htmlspecialchars($attributes[$column]['label'])
);
}
} else {
// Need to unset this for the loop below, otherwise
// selected columns from another source could interfere
unset($selected);
}
// Then the unselected columns in source order.
foreach (array_keys($info['map']) as $column) {
if ((substr($column, 0, 2) == '__') ||
($column == 'name') ||
isset($selected[$column])) {
continue;
}
$inputs[] = array(
'checked' => isset($selected[$column]),
'column' => htmlspecialchars($column),
'i' => $i++,
'label' => htmlspecialchars($attributes[$column]['label'])
);
}
$cols[] = array(
'first' => empty($cols),
'inputs' => $inputs,
'source' => htmlspecialchars($source)
);
}
if (!empty($col_list)) {
$t->set('col_list', $col_list);
$t->set('cols', $cols);
}
return $t->fetch(TURBA_TEMPLATES . '/prefs/column.html');
}
/**
*/
public function update(Horde_Core_Prefs_Ui $ui)
{
global $prefs;
if (!isset($ui->vars->columns)) {
return false;
}
$prefs->setValue('columns', $ui->vars->columns);
return true;
}
}
|