Happy 2017
[squirrelmail.git] / templates / default / edit_list_widget_list_style.tpl
CommitLineData
52639d23 1<?php
2
3/**
4 * edit_list_widget_list_style.tpl
5 *
6 * Template for constructing an edit list using a list-format layout.
7 *
8 * The following variables are available in this template:
9 *
b6a08d2d 10 * string $name The name of the edit list
11 * string $input_widget A preconstructed input text box used
12 * for adding new elements to the edit list
13 * boolean $use_input_widget Whether or not to present the $input_widget
de4c101c 14 * boolean $use_delete_widget Whether or not to present the $checkbox_widget
15 * string $select_widget A preconstructed select widget containing
16 * all the elements in the list
17 * string $checkbox_widget A preconstructed checkbox used for deleting
18 * elements from the edit list
b6a08d2d 19 * string $trailing_text Any text given by the caller to be displayed
20 * after the edit list input
21 * array $possible_values The original list of options in the edit list,
22 * for use constructing layouts alternative to
23 * the select widget
282f8e7c 24 * mixed $current_value The currently selected value(s)
52639d23 25 *
22387c8d 26 * @copyright 1999-2017 The SquirrelMail Project Team
52639d23 27 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
01144ffd 28 * @version $Id$
52639d23 29 * @package squirrelmail
30 * @subpackage templates
31 */
32
33
34// retrieve the template vars
35//
36extract($t);
37
38
b6a08d2d 39echo '<table class="table2" cellspacing="0"><tr><td>';
40
41if ($use_input_widget)
42 echo _("Add") . '&nbsp;' . $input_widget . '<br />';
43
44echo '<table class="table_messageList" cellspacing="0">';
52639d23 45
46$class = 'even';
47$index = 0;
48
282f8e7c 49if (is_array($current_value))
50 $selected = $current_value;
51else
52 $selected = array($current_value);
53
52639d23 54foreach ($possible_values as $key => $value) {
55
56 if ($class == 'even') $class = 'odd';
57 else $class = 'even';
58
59 echo '<tr class="' . $class . '">'
282f8e7c 60 . '<td class="col_check" style="width:1%"><input type="checkbox" name="new_' . $name . '[' . ($index++) . ']" id="' . $name . '_list_item_' . $key . '" value="' . $value;
61
62 // having a selected item in the edit list doesn't have
63 // any meaning, but maybe someone will think of a way to
64 // use it, so we might as well put the code in
65 //
66 foreach ($selected as $default) {
67 if ((string)$default == (string)$value) {
68 echo '" checked="checked';
69 break;
70 }
71 }
72
73 echo '"></td>'
52639d23 74 . '<td><label for="' . $name . '_list_item_' . $key . '">' . $value . '</label></td>'
75 . "</tr>\n";
76
77}
78
79echo '</table>';
80
de4c101c 81if (!empty($possible_values) && $use_delete_widget)
52639d23 82 echo $checkbox_widget . '&nbsp;<label for="delete_' . $name . '">'
83 . _("Delete Selected") . '</label>';
84
85echo '</td></tr></table>';