ef0ede16b03bdb7569399af045520196478cba1a
6 * The following functions are utility functions for this template. Do not
7 * echo output in those functions.
10 function calcMessageListColumnWidth($aOrder) {
12 * Width of the displayed columns
22 SQM_COL_ATTACHMENT
=> 1,
23 SQM_COL_INT_DATE
=> 10,
30 * Calculate the width of the subject column based on the
31 * widths of the other columns
33 if (isset($aOrder[SQM_COL_SUBJ
])) {
34 foreach($aOrder as $iCol) {
35 if ($iCol != SQM_COL_SUBJ
) {
36 $aWidthTpl[SQM_COL_SUBJ
] -= $aWidthTpl[$iCol];
40 foreach($aOrder as $iCol) {
41 $aWidth[$iCol] = $aWidthTpl[$iCol];
44 $iCheckTotalWidth = $iTotalWidth = 0;
45 foreach($aOrder as $iCol) { $iTotalWidth +
= $aWidth[$iCol];}
47 $iTotalWidth = ($iTotalWidth) ?
$iTotalWidth : 100; // divide by zero check. shouldn't be needed
48 // correct the width to 100%
49 foreach($aOrder as $iCol) {
50 $aWidth[$iCol] = round( (100 / $iTotalWidth) * $aWidth[$iCol] , 0);
51 $iCheckTotalWidth +
= $aWidth[$iCol];
53 if ($iCheckTotalWidth > 100) { // correction needed
54 $iCol = array_search(max($aWidth),$aWidth);
55 $aWidth[$iCol] -= $iCheckTotalWidth-100;
61 * Function to retrieve the correct flag icon belonging to the set of
64 * @param array $aFlags associative array with seen,deleted,anwered and flag keys.
65 * @param string $sImageLocation directory location of flagicons
66 * @return string $sFlags string with the correct img html tag
67 * @author Marc Groot Koerkamp
69 function getFlagIcon($aFlags, $sImageLocation) {
79 * 6 = answered deleted
80 * 7 = answered deleted seen
83 * 10 = flagged deleted
84 * 11 = flagged deleted seen
85 * 12 = flagged answered
86 * 13 = flagged aswered seen
87 * 14 = flagged answered deleted
88 * 15 = flagged anserwed deleted seen
92 * Use static vars to avoid initialisation of the array on each displayed row
94 static $aFlagImages, $aFlagValues;
95 if (!isset($aFlagImages)) {
97 array('msg_new.png','('._("New").')'),
98 array('msg_read.png','('._("Read").')'),
99 array('msg_new_deleted.png','('._("Deleted").')'),
100 array('msg_read_deleted.png','('._("Deleted").')'),
101 array('msg_new_reply.png','('._("Answered").')'),
102 array('msg_read_reply.png','('._("Answered").')'),
103 array('msg_read_deleted_reply.png','('._("Answered").')'),
104 array('flagged.png', '('._("Flagged").')'),
105 array('flagged.png', '('._("Flagged").')'),
106 array('flagged.png', '('._("Flagged").')'),
107 array('flagged.png', '('._("Flagged").')'),
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 ); // as you see the list is not completed yet.
114 $aFlagValues = array('seen' => 1,
122 * The flags entry contain all items displayed in the flag column.
125 foreach ($aFlags as $flag => $flagvalue) {
126 /* FIX ME, we should use separate templates for icons */
131 case 'flagged': if ($flagvalue) $iFlagIndx+
=$aFlagValues[$flag]; break;
135 if (isset($aFlagImages[$iFlagIndx])) {
136 $aFlagEntry = $aFlagImages[$iFlagIndx];
138 $aFlagEntry = end($aFlagImages);
141 $sFlags = '<img src="' . $sImageLocation . $aFlagEntry[0].'"'.
142 ' border="0" alt="'.$aFlagEntry[1].'" title="'. $aFlagEntry[1] .'" height="12" width="18" />' ;
143 if (!$sFlags) { $sFlags = ' '; }
148 * Function to retrieve the correct flag text belonging to the set of
151 * @param array $aFlags associative array with seen,deleted,anwered and flag keys.
152 * @return string $sFlags string with the correct flag text
153 * @author Marc Groot Koerkamp
155 function getFlagText($aFlags) {
165 * 6 = answered deleted
166 * 7 = answered deleted seen
169 * 10 = flagged deleted
170 * 11 = flagged deleted seen
171 * 12 = flagged answered
172 * 13 = flagged aswered seen
173 * 14 = flagged answered deleted
174 * 15 = flagged anserwed deleted seen
177 * Use static vars to avoid initialisation of the array on each displayed row
179 static $aFlagText, $aFlagValues;
180 if (!isset($aFlagText)) {
182 array(' ', '('._("New").')'),
183 array(' ', '('._("Read").')'),
184 array(_("D") , '('._("Deleted").')'),
185 array(_("D") , '('._("Deleted").')'),
186 array(_("A") , '('._("Answered").')'),
187 array(_("A") , '('._("Answered").')'),
188 array(_("D") , '('._("Answered").')'),
189 array(_("F") , '('._("Flagged").')'),
190 array(_("F") , '('._("Flagged").')'),
191 array(_("F") , '('._("Flagged").')'),
192 array(_("F") , '('._("Flagged").')'),
193 array(_("F") , '('._("Flagged").')'),
194 array(_("F") , '('._("Flagged").')'),
195 array(_("F") , '('._("Flagged").')'),
196 array(_("F") , '('._("Flagged").')'),
197 array(_("F") , '('._("Flagged").')')
198 ); // as you see the list is not completed yet.
199 $aFlagValues = array('seen' => 1,
207 * The flags entry contain all items displayed in the flag column.
210 foreach ($aFlags as $flag => $flagvalue) {
211 /* FIX ME, we should use separate templates for icons */
216 case 'flagged': if ($flagvalue) $iFlagIndx+
=$aFlagValues[$flag]; break;
220 if (isset($aFlagText[$iFlagIndx])) {
221 $sFlags = $aFlagText[$iFlagIndx][0];
223 $aLast = end($aFlagText);
226 if (!$sFlags) { $sFlags = ' '; }