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
"; 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
"; unset($medialist[$key]); } } else { if (!$found1 || !$found2) { // echo "removing $key - AND
"; 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 '

', $controller->getPageTitle(), '

'; 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 ?>
'; echo WT_I18N::translate('Sort order'); echo ''; } else { echo ''; echo ''; } ?>
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 '
'; //} else echo $MEDIA_DIRECTORY, ''; ?>
'; echo ''; echo '  
checked="checked" />



checked="checked" />
   
$ct) $count = $ct-$start; } else { $ct = '0'; } echo '
', WT_I18N::translate('Media Objects found'), ' ', $ct, '

'; if ($ct>0) { $currentPage = ((int) ($start / $max)) + 1; $lastPage = (int) (($ct + $max - 1) / $max); $IconRarrow = ''; $IconLarrow = ''; $IconRDarrow = ''; $IconLDarrow = ''; echo ''; // echo page back, page number, page forward controls echo ''; echo ''; 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 ''; if ($columns == '1') echo ''; if (($columns == '2') && ($i%2 == 1 && $i < ($count-1))) echo ''; } // end media loop echo ''; // echo page back, page number, page forward controls echo ''; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; if ($TEXT_DIRECTION=='ltr') { if ($ct>$max) { if ($currentPage > 1) { echo '', $IconLDarrow, ''; } if ($start>0) { $newstart = $start-$max; if ($start<0) $start = 0; echo '', $IconLarrow, ''; } } } else { if ($ct>$max) { if ($currentPage < $lastPage) { $lastStart = ((int) ($ct / $max)) * $max; echo '', $IconRDarrow, ''; } if ($start+$max < $ct) { $newstart = $start+$count; if ($start<0) $start = 0; echo '', $IconRarrow, ''; } } } echo '', WT_I18N::translate('Page %s of %s', $currentPage, $lastPage), ''; if ($TEXT_DIRECTION=='ltr') { if ($ct>$max) { if ($start+$max < $ct) { $newstart = $start+$count; if ($start<0) $start = 0; echo '', $IconRarrow, ''; } if ($currentPage < $lastPage) { $lastStart = ((int) ($ct / $max)) * $max; echo '', $IconRDarrow, ''; } } } else { if ($ct>$max) { if ($start>0) { $newstart = $start-$max; if ($start<0) $start = 0; echo '', $IconLarrow, ''; } if ($currentPage > 1) { $lastStart = ((int) ($ct / $max)) * $max; echo '', $IconLDarrow, ''; } } } echo '
'; if ($columns == '2') echo ''; echo '
'; //-- Thumbnail field if ($show_thumbnail) { echo $mediaobject->displayMedia(array()); echo ''; if (WT_USE_LIGHTBOX) { if (WT_USER_CAN_EDIT) { echo ''; // ---------- Edit Media -------------------- echo ''; // ---------- Link Media to person, family or source --------------- echo ''; // ---------- View Media Details (mediaviewer) -------------------- echo ''; echo '
'; echo "getXref()."&linktoid=', '_blank', 'top=50, left=50, width=600, height=600, resizable=1, scrollbars=1');\">"; echo '   '; echo '
'; echo WT_I18N::translate('Edit Details') ; echo '
'; echo '
'; require WT_ROOT.WT_MODULES_DIR.'lightbox/functions/lb_link.php'; echo ''; echo ''; echo '   '; echo '
'; echo WT_I18N::translate('View Details') ; echo '
'; echo '
'; // ------------ Linespace --------------------- echo '
'; } } } // If sorting by title, highlight the title. If sorting by filename, highlight the filename if ($sortby=='title') { echo '

'; echo $mediaobject->getFullName(); echo '

'; } else { echo '

'; echo basename($mediaobject->getFilename()); echo '

'; 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 '

', /* I18N: %s is a filename */ WT_I18N::translate('The file ā€œ%sā€ does not exist.', $mediaobject->getLocalFilename()), '

'; } } echo '
'; echo '
'; print_fact_sources($mediaobject->getGedcomRecord(), 1); print_fact_notes($mediaobject->getGedcomRecord(), 1); echo '
'; echo $mediaobject->printLinkedRecords('small'); echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; if ($TEXT_DIRECTION=='ltr') { if ($ct>$max) { if ($currentPage > 1) { echo '', $IconLDarrow, ''; } if ($start>0) { $newstart = $start-$max; if ($start<0) $start = 0; echo '', $IconLarrow, ''; } } } else { if ($ct>$max) { if ($currentPage < $lastPage) { $lastStart = ((int) ($ct / $max)) * $max; echo '', $IconRDarrow, ''; } if ($start+$max < $ct) { $newstart = $start+$count; if ($start<0) $start = 0; echo '', $IconRarrow, ''; } } } echo '', WT_I18N::translate('Page %s of %s', $currentPage, $lastPage), ''; if ($TEXT_DIRECTION=='ltr') { if ($ct>$max) { if ($start+$max < $ct) { $newstart = $start+$count; if ($start<0) $start = 0; echo '', $IconRarrow, ''; } if ($currentPage < $lastPage) { $lastStart = ((int) ($ct / $max)) * $max; echo '', $IconRDarrow, ''; } } } else { if ($ct>$max) { if ($start>0) { $newstart = $start-$max; if ($start<0) $start = 0; echo '', $IconLarrow, ''; } if ($currentPage > 1) { $lastStart = ((int) ($ct / $max)) * $max; echo '', $IconLDarrow, ''; } } } echo '

'; } echo '
'; }