1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
|
<?php
// Displays a list of the media objects
//
// webtrees: Web based Family History software
// Copyright (C) 2011 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2002 to 2010 PGV Development Team. All rights reserved.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// $Id$
define('WT_SCRIPT_NAME', 'medialist.php');
require './includes/session.php';
require_once WT_ROOT.'includes/functions/functions_print_facts.php';
$controller=new WT_Controller_Base();
$controller->setPageTitle(WT_I18N::translate('Media objects'));
$action = safe_GET('action');
$search = safe_GET('search');
$sortby = safe_GET('sortby', 'file', 'title');
if (!WT_USER_CAN_EDIT && !WT_USER_CAN_ACCEPT) {
$sortby='title';
}
$max = safe_GET('max', array('10', '20', '30', '40', '50', '75', '100', '125', '150', '200'), '20');
$folder = safe_GET('folder');
$show = 'no';
$build = 'no';
$reset = safe_GET('reset');
$apply_filter = safe_GET('apply_filter');
$filter1 = safe_GET('filter1');
$filter1 = stripLRMRLM($filter1);
$filter2 = safe_GET('filter2');
$filter2 = stripLRMRLM($filter2);
$or = WT_I18N::translate('or');
$and = WT_I18N::translate('and');
$filter_type = safe_GET('filter_type', array($or, $and), $or);
$columns = safe_GET('columns', array('1', '2'), '2');
$subdirs = safe_GET('subdirs');
$thumbnail = safe_GET('thumbnail');
$currentdironly = ($subdirs=='on') ? false : true;
$show_thumbnail = ($thumbnail=='on') ? true : false;
// reset all variables
if ($reset == 'Reset') {
$sortby = 'title';
$max = '20';
$folder = '';
$filter_type = $or;
$columns = '2';
$currentdironly = true;
$show_thumbnail = true;
$filter1 = '';
$filter2 = '';
$action = '';
unset($WT_SESSION->Medialist);
}
// If the $folder is empty this is a new visit, a return, or a reset
if (empty($folder)) {
$folder = $MEDIA_DIRECTORY; // default setting
$show_thumbnail = true; // default setting
}
// re-build if anything changed
if (
($WT_SESSION->Medialist_ged != WT_GEDCOM)
|| ($WT_SESSION->Medialist_user != WT_USER_ID) // if an anonymous user logged in, get the data again
|| ($filter1 != $WT_SESSION->Medialist_filter1)
|| ($filter2 != $WT_SESSION->Medialist_filter2)
|| ($filter_type != $WT_SESSION->Medialist_filter_type)
|| ($sortby != $WT_SESSION->Medialist_sortby)
|| ($folder != $WT_SESSION->Medialist_folder)
|| ($currentdironly != $WT_SESSION->Medialist_currentdironly)
) {
$build = 'yes';
unset($WT_SESSION->Medialist);
}
// If SESSION_medialist then it's a return
if (isset($WT_SESSION->Medialist)) {
$show = 'yes';
$search = 'yes';
$action = false;
$medialist = $WT_SESSION->Medialist;
} else {
if ($action == 'filter') {
// This is the first visit to the medialist page
$build = 'yes';
$show = 'yes';
} else {
// must have just reset
}
}
// ************************ BEGIN = 'Build the medialist array' ************************
if ($build == 'yes') {
if ($folder == 'ALL') {
$folder = $MEDIA_DIRECTORY;
$currentdironly = false;
}
// show external links only if looking at top level directory
$showExternal = ($folder == $MEDIA_DIRECTORY) ? true : false;
$medialist=get_medialist2($currentdironly, $folder, true, false, $showExternal, $sortby);
foreach ($medialist as $key => $media) {
// remove all private media objects
$mediaobject=WT_Media::getInstance($media['XREF']);
// Display when user has Edit rights or when object belongs to current GEDCOM
$disp = WT_USER_CAN_EDIT || $mediaobject->ged_id==WT_GED_ID;
// Display when Media objects aren't restricted by global privacy
$disp &= $mediaobject->canDisplayDetails();
// Display when this Media object isn't restricted
$disp &= canDisplayFact($mediaobject->getXref(), $mediaobject->ged_id, $mediaobject->getGedcomRecord());
if (!$disp) {
// echo "removing $key - disp<br />";
unset($medialist[$key]);
continue;
}
// filter
if ($filter1 || $filter2) {
if (!$filter1 || !$filter2) $filter_type = $or;
$default=($filter_type == $or) ? false : true;
$found1=$filter1 ? filterMedia2($mediaobject, $filter1) : $default;
$found2=$filter2 ? filterMedia2($mediaobject, $filter2) : $default;
if ($filter_type == $or) {
if (!$found1 && !$found2) {
// echo "removing $key - OR<br />";
unset($medialist[$key]);
}
} else {
if (!$found1 || !$found2) {
// echo "removing $key - AND<br />";
unset($medialist[$key]);
}
}
}
}
$medialist=array_values($medialist); // Reset numbering of medialist array
// save the data into the session
$WT_SESSION->Medialist=$medialist;
$WT_SESSION->Medialist_filter_type=$filter_type;
$WT_SESSION->Medialist_filter1=$filter1;
$WT_SESSION->Medialist_filter2=$filter2;
$WT_SESSION->Medialist_folder=$folder;
$WT_SESSION->Medialist_sortby=$sortby;
$WT_SESSION->Medialist_max=$max;
$WT_SESSION->Medialist_columns=$columns;
$WT_SESSION->Medialist_currentdironly=$currentdironly;
$WT_SESSION->Medialist_thumbnail=$show_thumbnail;
$WT_SESSION->Medialist_ged=WT_GEDCOM;
$WT_SESSION->Medialist_user=WT_USER_ID;
}
$controller->pageHeader();
echo '<div id="media-list-page"><h2>', $controller->getPageTitle(), '</h2></div>';
if (WT_USE_LIGHTBOX) {
require WT_ROOT.WT_MODULES_DIR.'lightbox/functions/lb_call_js.php';
}
// ************************ BEGIN = 'Build the input form' ************************
// A form for filtering the media items
?>
<form action="medialist.php" method="get">
<input type="hidden" name="action" value="filter" />
<input type="hidden" name="search" value="yes" />
<table class="list-table center width75 <?php echo $TEXT_DIRECTION; ?>">
<!-- Build the form cells -->
<tr>
<!-- // NOTE: Row 1, left: -->
<!-- // begin select media folders -->
<td class="descriptionbox wrap width25">
<?php echo WT_I18N::translate('Media directory'), help_link('view_server_folder'); ?></td>
<td class="optionbox wrap width25">
<?php
//if ($MEDIA_DIRECTORY_LEVELS > 0) {
if (empty($folder)) {
if (!empty($WT_SESSION->upload_folder)) $folder = $WT_SESSION->upload_folder;
else $folder = 'ALL';
}
$folders = array_merge(array('ALL'), get_media_folders());
echo '<span dir="ltr"><select name="folder">';
foreach ($folders as $f) {
echo '<option value="', $f, '"';
if ($folder==$f) echo ' selected="selected"';
echo '>';
if ($f=='ALL') echo WT_I18N::translate('All');
else echo $f;
echo '</option>';
}
echo '</select></span><br />';
//} else echo $MEDIA_DIRECTORY, '<input name="folder" type="hidden" value="ALL" />';
?>
</td>
<!-- // end select media folders -->
<!-- // NOTE: Row 1 right: -->
<!-- begin sort files -->
<?php
if (WT_USER_CAN_EDIT || WT_USER_CAN_ACCEPT) {
echo '<td class="descriptionbox wrap width25">';
echo WT_I18N::translate('Sort order');
echo '</td><td class="optionbox wrap width25">';
echo '<select name="sortby">';
echo '<option value="title" ', ($sortby=='title') ? 'selected="selected"' : '', '>';
echo /* I18N: An option in a list-box */ WT_I18N::translate('sort by title');
echo '</option>';
echo '<option value="file" ', ($sortby=='file') ? 'selected="selected"' : '' , '>';
echo /* I18N: An option in a list-box */ WT_I18N::translate('sort by filename');
echo '</option>';
echo '</select>';
echo '</td>';
} else {
echo '<td class="descriptionbox wrap width25"> </td>';
echo '<td class="optionbox wrap width25"> </td>';
}
?>
<!-- //end sort files -->
</tr><tr>
<!-- // NOTE: Row 2 left:-->
<!-- // begin sub directories -->
<td class="descriptionbox wrap width25">
<?php echo WT_I18N::translate('Include subdirectories'), help_link('medialist_recursive'); ?>
</td>
<td class="optionbox wrap width25">
<input type="checkbox" id="subdirs" name="subdirs" <?php if (!$currentdironly) { ?>checked="checked"<?php } ?> />
</td>
<?php // } ?>
<!-- // end subdirectories -->
<!-- // NOTE: Row 2 right:-->
<!-- // begin media objects per page -->
<td class="descriptionbox wrap width25">
<?php echo WT_I18N::translate('Media objects per page'), help_link('media_objects_pp');; ?>
</td>
<td class="optionbox wrap width25">
<select name="max">
<?php
foreach (array('10', '20', '30', '40', '50', '75', '100', '125', '150', '200') as $selectEntry) {
echo '<option value="', $selectEntry, '"';
if ($selectEntry==$max) echo ' selected="selected"';
echo '>', $selectEntry, '</option>';
}
?>
</select>
</td>
<!-- // end media objects per page -->
</tr><tr>
<!-- // NOTE: Row 3 left:-->
<!-- // begin search filter -->
<td class="descriptionbox wrap width25">
<?php echo WT_I18N::translate('Search filters'), help_link('medialist_filters'); ?>
</td>
<td class="optionbox wrap width25">
<!-- // begin Text field for filter and "submit" button -->
<input id="filter1" name="filter1" value="<?php echo PrintReady($filter1); ?>" size="14" />
<select name="filter_type">
<?php
foreach (array($or, $and) as $selectEntry) {
echo '<option value="', $selectEntry, '"';
if ($selectEntry==$filter_type) echo ' selected="selected"';
echo '>', $selectEntry, '</option>';
}
?>
</select><br />
<input id="filter2" name="filter2" value="<?php echo PrintReady($filter2); ?>" size="14" />
</td>
<!-- // end search filter -->
<!-- // NOTE: Row 3 right:-->
<!-- // begin columns per page -->
<td class="descriptionbox wrap width25">
<?php echo WT_I18N::translate('Columns per page'), help_link('media_columns_pp'); ?>
<br />
<?php echo WT_I18N::translate('Show thumbnails'), help_link('media_thumbs'); ?>
</td>
<td class="optionbox wrap width25">
<select name="columns">
<?php
foreach (array('1', '2') as $selectEntry) {
echo '<option value="', $selectEntry, '"';
if ($selectEntry==$columns) echo ' selected="selected"';
echo '>', $selectEntry, '</option>';
}
?>
</select>
<br /><input type="checkbox" id="thumbnail" name="thumbnail"
<?php if ($show_thumbnail) { ?>checked="checked"<?php } ?> />
</td>
<!-- // end columns per page -->
</tr><tr>
<!-- // NOTE: Row 4 left:-->
<!-- // begin search buttons -->
<td class="descriptionbox wrap width25">
</td>
<td class="optionbox wrap width25">
<input type="submit" name="apply_filter" value="<?php echo WT_I18N::translate('Search'); ?>" />
<input type="submit" name="reset" value="<?php echo WT_I18N::translate('Reset'); ?>" />
</td>
<!-- // end search buttons -->
<!-- // NOTE: Row 4 right:-->
<!-- // thumbnail option -->
<td class="descriptionbox wrap width25">
</td>
<td class="optionbox wrap width25">
</td>
<!-- // end thumbnail option -->
</tr></table>
</form>
<!-- // end form for filtering the media items -->
<?php
// ************************ END = 'Build the input form' ************************
// ************************ BEGIN = 'Print the medialist array' ************************
if ($show == 'yes') {
if (!empty($medialist)) {
// Count the number of items in the medialist
$ct=count($medialist);
$start = 0;
if (isset($_GET['start'])) $start = $_GET['start'];
$count = $max;
if ($start+$count > $ct) $count = $ct-$start;
} else {
$ct = '0';
}
echo '<div align="center">', WT_I18N::translate('Media Objects found'), ' ', $ct, ' <br /><br />';
if ($ct>0) {
$currentPage = ((int) ($start / $max)) + 1;
$lastPage = (int) (($ct + $max - 1) / $max);
$IconRarrow = '<img src="'.$WT_IMAGES['rarrow'].'" width="20" height="20" alt="">';
$IconLarrow = '<img src="'.$WT_IMAGES['larrow'].'" width="20" height="20" alt="">';
$IconRDarrow = '<img src="'.$WT_IMAGES['rdarrow'].'" width="20" height="20" alt="">';
$IconLDarrow = '<img src="'.$WT_IMAGES['ldarrow'].'" width="20" height="20" alt="">';
echo '<table class="list_table">';
// echo page back, page number, page forward controls
echo '<tr><td colspan="2">';
echo '<table class="list_table width100">';
echo '<tr>';
echo '<td class="width30" align="', $TEXT_DIRECTION == 'ltr'?'left':'right', '">';
if ($TEXT_DIRECTION=='ltr') {
if ($ct>$max) {
if ($currentPage > 1) {
echo '<a href="medialist.php?action=no&search=no&folder=', rawurlencode($folder), '&sortby=', $sortby, '&subdirs=', $subdirs, '&filter1=', rawurlencode($filter1), '&filter_type=', $filter_type, '&filter2=', rawurlencode($filter2), '&columns=', $columns, '&thumbnail=', $thumbnail, '&apply_filter=', $apply_filter, '&start=0&max=', $max, '">', $IconLDarrow, '</a>';
}
if ($start>0) {
$newstart = $start-$max;
if ($start<0) $start = 0;
echo '<a href="medialist.php?action=no&search=no&folder=', rawurlencode($folder), '&sortby=', $sortby, '&subdirs=', $subdirs, '&filter1=', rawurlencode($filter1), '&filter_type=', $filter_type, '&filter2=', rawurlencode($filter2), '&columns=', $columns, '&thumbnail=', $thumbnail, '&apply_filter=', $apply_filter, '&start=', $newstart, '&max=', $max, '">', $IconLarrow, '</a>';
}
}
} else {
if ($ct>$max) {
if ($currentPage < $lastPage) {
$lastStart = ((int) ($ct / $max)) * $max;
echo '<a href="medialist.php?action=no&search=no&folder=', rawurlencode($folder), '&sortby=', $sortby, '&subdirs=', $subdirs, '&filter1=', rawurlencode($filter1), '&filter_type=', $filter_type, '&filter2=', rawurlencode($filter2), '&columns=', $columns, '&thumbnail=', $thumbnail, '&apply_filter=', $apply_filter, '&start=', $lastStart, '&max=', $max, '">', $IconRDarrow, '</a>';
}
if ($start+$max < $ct) {
$newstart = $start+$count;
if ($start<0) $start = 0;
echo '<a href="medialist.php?action=no&search=no&folder=', rawurlencode($folder), '&sortby=', $sortby, '&subdirs=', $subdirs, '&filter1=', rawurlencode($filter1), '&filter_type=', $filter_type, '&filter2=', rawurlencode($filter2), '&columns=', $columns, '&thumbnail=', $thumbnail, '&apply_filter=', $apply_filter, '&start=', $newstart, '&max=', $max, '">', $IconRarrow, '</a>';
}
}
}
echo '</td>';
echo '<td align="center">', WT_I18N::translate('Page %s of %s', $currentPage, $lastPage), '</td>';
echo '<td class="width30" align="', $TEXT_DIRECTION == 'ltr'?'right':'left', '">';
if ($TEXT_DIRECTION=='ltr') {
if ($ct>$max) {
if ($start+$max < $ct) {
$newstart = $start+$count;
if ($start<0) $start = 0;
echo '<a href="medialist.php?action=no&search=no&folder=', rawurlencode($folder), '&sortby=', $sortby, '&subdirs=', $subdirs, '&filter1=', rawurlencode($filter1), '&filter_type=', $filter_type, '&filter2=', rawurlencode($filter2), '&columns=', $columns, '&thumbnail=', $thumbnail, '&apply_filter=', $apply_filter, '&start=', $newstart, '&max=', $max, '">', $IconRarrow, '</a>';
}
if ($currentPage < $lastPage) {
$lastStart = ((int) ($ct / $max)) * $max;
echo '<a href="medialist.php?action=no&search=no&folder=', rawurlencode($folder), '&sortby=', $sortby, '&subdirs=', $subdirs, '&filter1=', rawurlencode($filter1), '&filter_type=', $filter_type, '&filter2=', rawurlencode($filter2), '&columns=', $columns, '&thumbnail=', $thumbnail, '&apply_filter=', $apply_filter, '&start=', $lastStart, '&max=', $max, '">', $IconRDarrow, '</a>';
}
}
} else {
if ($ct>$max) {
if ($start>0) {
$newstart = $start-$max;
if ($start<0) $start = 0;
echo '<a href="medialist.php?action=no&search=no&folder=', rawurlencode($folder), '&sortby=', $sortby, '&subdirs=', $subdirs, '&filter1=', rawurlencode($filter1), '&filter_type=', $filter_type, '&filter2=', rawurlencode($filter2), '&columns=', $columns, '&thumbnail=', $thumbnail, '&apply_filter=', $apply_filter, '&start=', $newstart, '&max=', $max, '">', $IconLarrow, '</a>';
}
if ($currentPage > 1) {
$lastStart = ((int) ($ct / $max)) * $max;
echo '<a href="medialist.php?action=no&search=no&folder=', rawurlencode($folder), '&sortby=', $sortby, '&subdirs=', $subdirs, '&filter1=', rawurlencode($filter1), '&filter_type=', $filter_type, '&filter2=', rawurlencode($filter2), '&columns=', $columns, '&thumbnail=', $thumbnail, '&apply_filter=', $apply_filter, '&start=0&max=', $max, '">', $IconLDarrow, '</a>';
}
}
}
echo '</td>';
echo '</tr></table></td></tr>';
echo '<tr>';
for ($i=0; $i<$count; $i++) { // begin looping through the media
$media = $medialist[$start+$i];
$mediaobject = WT_Media::getInstance($media['XREF']);
if (!$mediaobject) {
// the media object was apparently deleted after the medialist was stored in the session
continue;
}
$isExternal = $mediaobject->isExternal();
if ($columns == '1') echo '<td class="list_value_wrap" width="80%">';
if ($columns == '2') echo '<td class="list_value_wrap" width="50%">';
echo '<table class="', $TEXT_DIRECTION, '"><tr><td valign="top" style="white-space: normal;">';
//-- Thumbnail field
if ($show_thumbnail) {
echo $mediaobject->displayMedia(array());
echo '</td><td class="list_value_wrap" style="border: none;" width="100%">';
if (WT_USE_LIGHTBOX) {
if (WT_USER_CAN_EDIT) {
echo '<table border=0><tr>';
// ---------- Edit Media --------------------
echo '<td class="width33 wrap center font9" valign="top">';
echo "<a href=\"#\" title=\"" . WT_I18N::translate('Edit this Media Item\'s Details') . "\" onclick=\" return window.open('addmedia.php?action=editmedia&pid=".$mediaobject->getXref()."&linktoid=', '_blank', 'top=50, left=50, width=600, height=600, resizable=1, scrollbars=1');\">";
echo '<img src="'.WT_STATIC_URL.WT_MODULES_DIR.'lightbox/images/image_edit.gif" alt="" class="icon" title="', WT_I18N::translate('Edit this Media Item\'s Details'), '" /> ';
echo '<br />';
echo WT_I18N::translate('Edit Details') ;
echo '</a>';
echo '</td>';
// ---------- Link Media to person, family or source ---------------
echo '<td class="width33 wrap center font9" valign="top">';
require WT_ROOT.WT_MODULES_DIR.'lightbox/functions/lb_link.php';
echo '</td>';
// ---------- View Media Details (mediaviewer) --------------------
echo '<td class="width33 wrap center font9" valign="top">';
echo '<a href="'.$mediaobject->getHtmlUrl().'" title="', WT_I18N::translate('View this Media Item\'s Details
Plus other Media Options - MediaViewer page'), '">';
echo ' <img src="'.WT_STATIC_URL.WT_MODULES_DIR.'lightbox/images/image_view.gif" alt="" class="icon" title="', WT_I18N::translate('View this Media Item\'s Details
Plus other Media Options - MediaViewer page'), '" />';
echo '<br />';
echo WT_I18N::translate('View Details') ;
echo '</a>';
echo '</td>';
echo '</tr></table>';
// ------------ Linespace ---------------------
echo '<br />';
}
}
}
// If sorting by title, highlight the title. If sorting by filename, highlight the filename
if ($sortby=='title') {
echo '<p><b><a href="', $mediaobject->getHtmlUrl(), '">';
echo $mediaobject->getFullName();
echo '</a></b></p>';
} else {
echo '<p><b><a href="', $mediaobject->getHtmlUrl(), '">';
echo basename($mediaobject->getFilename());
echo '</a></b></p>';
echo WT_Gedcom_Tag::getLabelValue('TITL', $mediaobject->getFullName());
}
// Show file details
if ($isExternal) {
echo WT_Gedcom_Tag::getLabelValue('URL', $mediaobject->getLocalFilename());
} else {
if ($mediaobject->fileExists()) {
if (WT_USER_CAN_EDIT || WT_USER_CAN_ACCEPT) {
echo WT_Gedcom_Tag::getLabelValue('FILE', $mediaobject->getLocalFilename());
}
echo WT_Gedcom_Tag::getLabelValue('FORM', $mediaobject->getMediaFormat());
echo WT_Gedcom_Tag::getLabelValue('__FILE_SIZE__', $mediaobject->getFilesize());
$imgsize = $mediaobject->getImageAttributes();
if ($imgsize['WxH']) {
echo WT_Gedcom_Tag::getLabelValue('__IMAGE_SIZE__', $imgsize['WxH']);
}
} else {
echo '<p class="ui-state-error">', /* I18N: %s is a filename */ WT_I18N::translate('The file ā%sā does not exist.', $mediaobject->getLocalFilename()), '</p>';
}
}
echo '<br />';
echo '<div style="white-space: normal; width: 95%;">';
print_fact_sources($mediaobject->getGedcomRecord(), 1);
print_fact_notes($mediaobject->getGedcomRecord(), 1);
echo '</div>';
echo $mediaobject->printLinkedRecords('small');
echo '</td></tr></table>';
echo '</td>';
if ($columns == '1') echo '</tr><tr>';
if (($columns == '2') && ($i%2 == 1 && $i < ($count-1)))
echo '</tr><tr>';
} // end media loop
echo '</tr>';
// echo page back, page number, page forward controls
echo '<tr><td colspan="2">';
echo '<table class="list_table width100">';
echo '<tr>';
echo '<td class="width30" align="', $TEXT_DIRECTION == 'ltr'?'left':'right', '">';
if ($TEXT_DIRECTION=='ltr') {
if ($ct>$max) {
if ($currentPage > 1) {
echo '<a href="medialist.php?action=no&search=no&folder=', rawurlencode($folder), '&sortby=', $sortby, '&subdirs=', $subdirs, '&filter1=', rawurlencode($filter1), '&filter_type=', $filter_type, '&filter2=', rawurlencode($filter2), '&columns=', $columns, '&thumbnail=', $thumbnail, '&apply_filter=', $apply_filter, '&start=0&max=', $max, '">', $IconLDarrow, '</a>';
}
if ($start>0) {
$newstart = $start-$max;
if ($start<0) $start = 0;
echo '<a href="medialist.php?action=no&search=no&folder=', rawurlencode($folder), '&sortby=', $sortby, '&subdirs=', $subdirs, '&filter1=', rawurlencode($filter1), '&filter_type=', $filter_type, '&filter2=', rawurlencode($filter2), '&columns=', $columns, '&thumbnail=', $thumbnail, '&apply_filter=', $apply_filter, '&start=', $newstart, '&max=', $max, '">', $IconLarrow, '</a>';
}
}
} else {
if ($ct>$max) {
if ($currentPage < $lastPage) {
$lastStart = ((int) ($ct / $max)) * $max;
echo '<a href="medialist.php?action=no&search=no&folder=', rawurlencode($folder), '&sortby=', $sortby, '&subdirs=', $subdirs, '&filter1=', rawurlencode($filter1), '&filter_type=', $filter_type, '&filter2=', rawurlencode($filter2), '&columns=', $columns, '&thumbnail=', $thumbnail, '&apply_filter=', $apply_filter, '&start=', $lastStart, '&max=', $max, '">', $IconRDarrow, '</a>';
}
if ($start+$max < $ct) {
$newstart = $start+$count;
if ($start<0) $start = 0;
echo '<a href="medialist.php?action=no&search=no&folder=', rawurlencode($folder), '&sortby=', $sortby, '&subdirs=', $subdirs, '&filter1=', rawurlencode($filter1), '&filter_type=', $filter_type, '&filter2=', rawurlencode($filter2), '&columns=', $columns, '&thumbnail=', $thumbnail, '&apply_filter=', $apply_filter, '&start=', $newstart, '&max=', $max, '">', $IconRarrow, '</a>';
}
}
}
echo '</td>';
echo '<td align="center">', WT_I18N::translate('Page %s of %s', $currentPage, $lastPage), '</td>';
echo '<td class="width30" align="', $TEXT_DIRECTION == 'ltr'?'right':'left', '">';
if ($TEXT_DIRECTION=='ltr') {
if ($ct>$max) {
if ($start+$max < $ct) {
$newstart = $start+$count;
if ($start<0) $start = 0;
echo '<a href="medialist.php?action=no&search=no&folder=', rawurlencode($folder), '&sortby=', $sortby, '&subdirs=', $subdirs, '&filter1=', rawurlencode($filter1), '&filter_type=', $filter_type, '&filter2=', rawurlencode($filter2), '&columns=', $columns, '&thumbnail=', $thumbnail, '&apply_filter=', $apply_filter, '&start=', $newstart, '&max=', $max, '">', $IconRarrow, '</a>';
}
if ($currentPage < $lastPage) {
$lastStart = ((int) ($ct / $max)) * $max;
echo '<a href="medialist.php?action=no&search=no&folder=', rawurlencode($folder), '&sortby=', $sortby, '&subdirs=', $subdirs, '&filter1=', rawurlencode($filter1), '&filter_type=', $filter_type, '&filter2=', rawurlencode($filter2), '&columns=', $columns, '&thumbnail=', $thumbnail, '&apply_filter=', $apply_filter, '&start=', $lastStart, '&max=', $max, '">', $IconRDarrow, '</a>';
}
}
} else {
if ($ct>$max) {
if ($start>0) {
$newstart = $start-$max;
if ($start<0) $start = 0;
echo '<a href="medialist.php?action=no&search=no&folder=', rawurlencode($folder), '&sortby=', $sortby, '&subdirs=', $subdirs, '&filter1=', rawurlencode($filter1), '&filter_type=', $filter_type, '&filter2=', rawurlencode($filter2), '&columns=', $columns, '&thumbnail=', $thumbnail, '&apply_filter=', $apply_filter, '&start=', $newstart, '&max=', $max, '">', $IconLarrow, '</a>';
}
if ($currentPage > 1) {
$lastStart = ((int) ($ct / $max)) * $max;
echo '<a href="medialist.php?action=no&search=no&folder=', rawurlencode($folder), '&sortby=', $sortby, '&subdirs=', $subdirs, '&filter1=', rawurlencode($filter1), '&filter_type=', $filter_type, '&filter2=', rawurlencode($filter2), '&columns=', $columns, '&thumbnail=', $thumbnail, '&apply_filter=', $apply_filter, '&start=0&max=', $max, '">', $IconLDarrow, '</a>';
}
}
}
echo '</td>';
echo '</tr></table></td></tr>';
echo '</table><br />';
}
echo '</div>';
}
|