5 * The following functions are utility functions for this template. Do not
6 * echo output in those functions.
7 * @package squirrelmail
11 * @param array $aOrder
14 function calcMessageListColumnWidth($aOrder) {
16 * Width of the displayed columns
26 SQM_COL_ATTACHMENT
=> 1,
27 SQM_COL_INT_DATE
=> 10,
34 * Calculate the width of the subject column based on the
35 * widths of the other columns
37 if (isset($aOrder[SQM_COL_SUBJ
])) {
38 foreach($aOrder as $iCol) {
39 if ($iCol != SQM_COL_SUBJ
) {
40 $aWidthTpl[SQM_COL_SUBJ
] -= $aWidthTpl[$iCol];
44 foreach($aOrder as $iCol) {
45 $aWidth[$iCol] = $aWidthTpl[$iCol];
48 $iCheckTotalWidth = $iTotalWidth = 0;
49 foreach($aOrder as $iCol) { $iTotalWidth +
= $aWidth[$iCol];}
51 $iTotalWidth = ($iTotalWidth) ?
$iTotalWidth : 100; // divide by zero check. shouldn't be needed
52 // correct the width to 100%
53 foreach($aOrder as $iCol) {
54 $aWidth[$iCol] = round( (100 / $iTotalWidth) * $aWidth[$iCol] , 0);
55 $iCheckTotalWidth +
= $aWidth[$iCol];
57 if ($iCheckTotalWidth > 100) { // correction needed
58 $iCol = array_search(max($aWidth),$aWidth);
59 $aWidth[$iCol] -= $iCheckTotalWidth-100;
65 * Function to retrieve the correct flag icon belonging to the set of
68 * @param array $aFlags associative array with seen,deleted,anwered and flag keys.
69 * @param string $sImageLocation directory location of flagicons
70 * @return string $sFlags string with the correct img html tag
71 * @author Marc Groot Koerkamp
73 function getFlagIcon($aFlags, $sImageLocation) {
83 * 6 = answered deleted
84 * 7 = answered deleted seen
87 * 10 = flagged deleted
88 * 11 = flagged deleted seen
89 * 12 = flagged answered
90 * 13 = flagged aswered seen
91 * 14 = flagged answered deleted
92 * 15 = flagged anserwed deleted seen
96 * Use static vars to avoid initialisation of the array on each displayed row
98 static $aFlagImages, $aFlagValues;
99 if (!isset($aFlagImages)) {
100 $aFlagImages = array(
101 array('msg_new.png','('._("New").')'),
102 array('msg_read.png','('._("Read").')'),
103 array('msg_new_deleted.png','('._("Deleted").')'),
104 array('msg_read_deleted.png','('._("Deleted").')'),
105 array('msg_new_reply.png','('._("Answered").')'),
106 array('msg_read_reply.png','('._("Answered").')'),
107 array('msg_read_deleted_reply.png','('._("Answered").')'),
108 array('flagged.png', '('._("Flagged").')'),
109 array('flagged.png', '('._("Flagged").')'),
110 array('flagged.png', '('._("Flagged").')'),
111 array('flagged.png', '('._("Flagged").')'),
112 array('flagged.png', '('._("Flagged").')'),
113 array('flagged.png', '('._("Flagged").')'),
114 array('flagged.png', '('._("Flagged").')'),
115 array('flagged.png', '('._("Flagged").')'),
116 array('flagged.png', '('._("Flagged").')')
117 ); // as you see the list is not completed yet.
118 $aFlagValues = array('seen' => 1,
126 * The flags entry contain all items displayed in the flag column.
129 foreach ($aFlags as $flag => $flagvalue) {
130 /* FIX ME, we should use separate templates for icons */
135 case 'flagged': if ($flagvalue) $iFlagIndx+
=$aFlagValues[$flag]; break;
139 if (isset($aFlagImages[$iFlagIndx])) {
140 $aFlagEntry = $aFlagImages[$iFlagIndx];
142 $aFlagEntry = end($aFlagImages);
145 $sFlags = '<img src="' . $sImageLocation . $aFlagEntry[0].'"'.
146 ' border="0" alt="'.$aFlagEntry[1].'" title="'. $aFlagEntry[1] .'" height="12" width="18" />' ;
147 if (!$sFlags) { $sFlags = ' '; }
152 * Function to retrieve the correct flag text belonging to the set of
155 * @param array $aFlags associative array with seen,deleted,anwered and flag keys.
156 * @return string $sFlags string with the correct flag text
157 * @author Marc Groot Koerkamp
159 function getFlagText($aFlags) {
169 * 6 = answered deleted
170 * 7 = answered deleted seen
173 * 10 = flagged deleted
174 * 11 = flagged deleted seen
175 * 12 = flagged answered
176 * 13 = flagged aswered seen
177 * 14 = flagged answered deleted
178 * 15 = flagged anserwed deleted seen
181 * Use static vars to avoid initialisation of the array on each displayed row
183 static $aFlagText, $aFlagValues;
184 if (!isset($aFlagText)) {
186 array(' ', '('._("New").')'),
187 array(' ', '('._("Read").')'),
188 array(_("D") , '('._("Deleted").')'),
189 array(_("D") , '('._("Deleted").')'),
190 array(_("A") , '('._("Answered").')'),
191 array(_("A") , '('._("Answered").')'),
192 array(_("D") , '('._("Answered").')'),
193 array(_("F") , '('._("Flagged").')'),
194 array(_("F") , '('._("Flagged").')'),
195 array(_("F") , '('._("Flagged").')'),
196 array(_("F") , '('._("Flagged").')'),
197 array(_("F") , '('._("Flagged").')'),
198 array(_("F") , '('._("Flagged").')'),
199 array(_("F") , '('._("Flagged").')'),
200 array(_("F") , '('._("Flagged").')'),
201 array(_("F") , '('._("Flagged").')')
202 ); // as you see the list is not completed yet.
203 $aFlagValues = array('seen' => 1,
211 * The flags entry contain all items displayed in the flag column.
214 foreach ($aFlags as $flag => $flagvalue) {
215 /* FIX ME, we should use separate templates for icons */
220 case 'flagged': if ($flagvalue) $iFlagIndx+
=$aFlagValues[$flag]; break;
224 if (isset($aFlagText[$iFlagIndx])) {
225 $sFlags = $aFlagText[$iFlagIndx][0];
227 $aLast = end($aFlagText);
230 if (!$sFlags) { $sFlags = ' '; }