0170d22f199007a1fbebd7a0afec8b0888bf3be0
6 * The following functions are utility functions for this template. Do not
7 * echo output in those functions.
9 * @copyright © 2005-2006 The SquirrelMail Project Team
10 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
12 * @package squirrelmail
16 * @param array $aOrder
19 function calcMessageListColumnWidth($aOrder) {
21 * Width of the displayed columns
31 SQM_COL_ATTACHMENT
=> 1,
32 SQM_COL_INT_DATE
=> 10,
39 * Calculate the width of the subject column based on the
40 * widths of the other columns
42 if (isset($aOrder[SQM_COL_SUBJ
])) {
43 foreach($aOrder as $iCol) {
44 if ($iCol != SQM_COL_SUBJ
) {
45 $aWidthTpl[SQM_COL_SUBJ
] -= $aWidthTpl[$iCol];
49 foreach($aOrder as $iCol) {
50 $aWidth[$iCol] = $aWidthTpl[$iCol];
53 $iCheckTotalWidth = $iTotalWidth = 0;
54 foreach($aOrder as $iCol) { $iTotalWidth +
= $aWidth[$iCol];}
56 $iTotalWidth = ($iTotalWidth) ?
$iTotalWidth : 100; // divide by zero check. shouldn't be needed
57 // correct the width to 100%
58 foreach($aOrder as $iCol) {
59 $aWidth[$iCol] = round( (100 / $iTotalWidth) * $aWidth[$iCol] , 0);
60 $iCheckTotalWidth +
= $aWidth[$iCol];
62 if ($iCheckTotalWidth > 100) { // correction needed
63 $iCol = array_search(max($aWidth),$aWidth);
64 $aWidth[$iCol] -= $iCheckTotalWidth-100;
70 * Function to retrieve the correct flag icon belonging to the set of
73 * @param array $aFlags associative array with seen,deleted,anwered and flag keys.
74 * @param string $sImageLocation directory location of flagicons
75 * @return string $sFlags string with the correct img html tag
76 * @author Marc Groot Koerkamp
78 function getFlagIcon($aFlags, $sImageLocation) {
88 * 6 = answered deleted
89 * 7 = answered deleted seen
92 * 10 = flagged deleted
93 * 11 = flagged deleted seen
94 * 12 = flagged answered
95 * 13 = flagged aswered seen
96 * 14 = flagged answered deleted
97 * 15 = flagged anserwed deleted seen
101 * Use static vars to avoid initialisation of the array on each displayed row
103 static $aFlagImages, $aFlagValues;
104 if (!isset($aFlagImages)) {
105 $aFlagImages = array(
106 array('msg_new.png','('._("New").')'),
107 array('msg_read.png','('._("Read").')'),
108 array('msg_new_deleted.png','('._("Deleted").')'),
109 array('msg_read_deleted.png','('._("Deleted").')'),
110 array('msg_new_reply.png','('._("Answered").')'),
111 array('msg_read_reply.png','('._("Answered").')'),
112 array('msg_read_deleted_reply.png','('._("Answered").')'),
113 array('flagged.png', '('._("Flagged").')'),
114 array('flagged.png', '('._("Flagged").')'),
115 array('flagged.png', '('._("Flagged").')'),
116 array('flagged.png', '('._("Flagged").')'),
117 array('flagged.png', '('._("Flagged").')'),
118 array('flagged.png', '('._("Flagged").')'),
119 array('flagged.png', '('._("Flagged").')'),
120 array('flagged.png', '('._("Flagged").')'),
121 array('flagged.png', '('._("Flagged").')')
122 ); // as you see the list is not completed yet.
123 $aFlagValues = array('seen' => 1,
131 * The flags entry contain all items displayed in the flag column.
134 foreach ($aFlags as $flag => $flagvalue) {
135 /* FIX ME, we should use separate templates for icons */
140 case 'flagged': if ($flagvalue) $iFlagIndx+
=$aFlagValues[$flag]; break;
144 if (isset($aFlagImages[$iFlagIndx])) {
145 $aFlagEntry = $aFlagImages[$iFlagIndx];
147 $aFlagEntry = end($aFlagImages);
150 $sFlags = '<img src="' . $sImageLocation . $aFlagEntry[0].'"'.
151 ' border="0" alt="'.$aFlagEntry[1].'" title="'. $aFlagEntry[1] .'" height="12" width="18" />' ;
152 if (!$sFlags) { $sFlags = ' '; }
157 * Function to retrieve the correct flag text belonging to the set of
160 * @param array $aFlags associative array with seen,deleted,anwered and flag keys.
161 * @return string $sFlags string with the correct flag text
162 * @author Marc Groot Koerkamp
164 function getFlagText($aFlags) {
174 * 6 = answered deleted
175 * 7 = answered deleted seen
178 * 10 = flagged deleted
179 * 11 = flagged deleted seen
180 * 12 = flagged answered
181 * 13 = flagged aswered seen
182 * 14 = flagged answered deleted
183 * 15 = flagged anserwed deleted seen
186 * Use static vars to avoid initialisation of the array on each displayed row
188 static $aFlagText, $aFlagValues;
189 if (!isset($aFlagText)) {
191 array(' ', '('._("New").')'),
192 array(' ', '('._("Read").')'),
193 array(_("D") , '('._("Deleted").')'),
194 array(_("D") , '('._("Deleted").')'),
195 array(_("A") , '('._("Answered").')'),
196 array(_("A") , '('._("Answered").')'),
197 array(_("D") , '('._("Answered").')'),
198 array(_("F") , '('._("Flagged").')'),
199 array(_("F") , '('._("Flagged").')'),
200 array(_("F") , '('._("Flagged").')'),
201 array(_("F") , '('._("Flagged").')'),
202 array(_("F") , '('._("Flagged").')'),
203 array(_("F") , '('._("Flagged").')'),
204 array(_("F") , '('._("Flagged").')'),
205 array(_("F") , '('._("Flagged").')'),
206 array(_("F") , '('._("Flagged").')')
207 ); // as you see the list is not completed yet.
208 $aFlagValues = array('seen' => 1,
216 * The flags entry contain all items displayed in the flag column.
219 foreach ($aFlags as $flag => $flagvalue) {
220 /* FIX ME, we should use separate templates for icons */
225 case 'flagged': if ($flagvalue) $iFlagIndx+
=$aFlagValues[$flag]; break;
229 if (isset($aFlagText[$iFlagIndx])) {
230 $sFlags = $aFlagText[$iFlagIndx][0];
232 $aLast = end($aFlagText);
235 if (!$sFlags) { $sFlags = ' '; }