Mercurial > hg > mgallery
comparison mgallery.php @ 19:59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 14 Sep 2015 12:49:56 +0300 |
parents | 3f7bc4202df3 |
children | 12916fcdb8b8 |
comparison
equal
deleted
inserted
replaced
18:8c1599a30120 | 19:59075f5e7a62 |
---|---|
123 } | 123 } |
124 | 124 |
125 | 125 |
126 function mgPrintTable($class, &$galEntries, &$galIndex, $start, $limit) | 126 function mgPrintTable($class, &$galEntries, &$galIndex, $start, $limit) |
127 { | 127 { |
128 global $galAlbumIcon, $galPath, $galTNPath, $galImageURL, $galUseCoverImages; | 128 global $galAlbumIcon, $galPath, $galTNPath, $galImageURL, $galUseCoverImages, $galUseTables; |
129 | 129 |
130 $galCount = count($galIndex); | 130 $galCount = count($galIndex); |
131 if ($start >= $galCount) | 131 if ($start >= $galCount) |
132 return $start; | 132 return $start; |
133 | 133 |
135 if ($end > $galCount) $end = $galCount; | 135 if ($end > $galCount) $end = $galCount; |
136 | 136 |
137 $rowLimit = mgGetSetting("album_row_limit"); | 137 $rowLimit = mgGetSetting("album_row_limit"); |
138 $n = 0; | 138 $n = 0; |
139 | 139 |
140 echo "<table class=\"".$class."\">\n"; | 140 if ($galUseTables) |
141 echo "<table class=\"".$class."\">\n"; | |
142 | |
141 for ($index = $start; $index < $end; $index++) | 143 for ($index = $start; $index < $end; $index++) |
142 { | 144 { |
143 $filename = &$galIndex[$index]; | 145 $filename = &$galIndex[$index]; |
144 $data = &$galEntries[$filename]; | 146 $data = &$galEntries[$filename]; |
145 | 147 |
146 if ($n == 0) echo " <tr>\n"; | 148 if ($galUseTables && $n == 0) echo " <tr>\n"; |
147 | 149 |
148 echo | 150 if ($galUseTables) |
149 " <td id=\"cd".$data["base"]."\">\n"; | 151 echo " <td id=\"cd".$data["base"]."\">\n"; |
152 else | |
153 echo " <div class=\"albumEntry\">\n"; | |
150 | 154 |
151 if ($data["type"] == 0) | 155 if ($data["type"] == 0) |
152 { | 156 { |
153 echo | 157 echo |
154 "<div class=\"imageBox\"><a href=\"".mgGetURL($galPath, $filename)."\">". | 158 "<div class=\"imageBox\"><a href=\"".mgGetURL($galPath, $filename)."\">". |
179 " <a href=\"".mgGetURL(mgCleanPath(TRUE, $galPath, $filename), FALSE)."\">". | 183 " <a href=\"".mgGetURL(mgCleanPath(TRUE, $galPath, $filename), FALSE)."\">". |
180 "<img class=\"albumIcon\" src=\"".$atmp."\" alt=\"".chentities($data["caption"])."\" />\n". | 184 "<img class=\"albumIcon\" src=\"".$atmp."\" alt=\"".chentities($data["caption"])."\" />\n". |
181 "<div class=\"albumTitle\">".chentities($data["caption"])."</div></a>\n"; | 185 "<div class=\"albumTitle\">".chentities($data["caption"])."</div></a>\n"; |
182 } | 186 } |
183 | 187 |
184 echo | 188 if ($galUseTables) |
185 " </td>\n"; | |
186 | |
187 if (++$n >= $rowLimit) | |
188 { | 189 { |
190 echo " </td>\n"; | |
191 if (++$n >= $rowLimit) | |
192 { | |
193 echo " </tr>\n"; | |
194 $n = 0; | |
195 } | |
196 } | |
197 else | |
198 echo " </div>\n"; | |
199 } | |
200 | |
201 if ($galUseTables) | |
202 { | |
203 if ($n > 0) | |
204 { | |
205 while ($n++ < $rowLimit) | |
206 echo " <td></td>\n"; | |
189 echo " </tr>\n"; | 207 echo " </tr>\n"; |
190 $n = 0; | |
191 } | 208 } |
192 } | 209 echo "</table>\n"; |
193 if ($n > 0) | 210 } |
194 { | |
195 while ($n++ < $rowLimit) | |
196 echo " <td></td>\n"; | |
197 echo " </tr>\n"; | |
198 } | |
199 echo "</table>\n"; | |
200 return $index; | 211 return $index; |
201 } | 212 } |
202 | 213 |
203 | 214 |
204 function mgTimeStr($str) | 215 function mgTimeStr($str) |
249 $galBasePath = mgGetSetting("base_path"); | 260 $galBasePath = mgGetSetting("base_path"); |
250 $galBaseURL = mgGetSetting("base_url"); | 261 $galBaseURL = mgGetSetting("base_url"); |
251 $galImageURL = mgGetSetting("image_url", mgGetSetting("base_url")); | 262 $galImageURL = mgGetSetting("image_url", mgGetSetting("base_url")); |
252 | 263 |
253 $galUseCoverImages = mgGetSetting("cover_images"); | 264 $galUseCoverImages = mgGetSetting("cover_images"); |
265 $galUseTables = mgGetSetting("use_tables"); | |
254 | 266 |
255 $galAlbumIcon = mgGetSetting("album_icon"); | 267 $galAlbumIcon = mgGetSetting("album_icon"); |
256 $galCleanURLS = mgGetSetting("clean_urls"); | 268 $galCleanURLS = mgGetSetting("clean_urls"); |
257 $galTNPath = mgGetSetting("tn_path"); | 269 $galTNPath = mgGetSetting("tn_path"); |
258 $galMedSuffix = mgGetSetting("med_suffix"); | 270 $galMedSuffix = mgGetSetting("med_suffix"); |