Admin Media Search

From TNG_Wiki
Jump to navigation Jump to search
Admin Media Search
Summary Adds numerous features to Admin>>Media>>Search, including new run-time search and display option. Perhaps most significantly, it adds hyperlinks to all objects shown in the "Links To" (i.e. medialinks) column.
Mod Updated 17 Nov 2023
Download link
TNG 14.0
See the Revision History for older versions
Download stats
Author(s) Robin Richmond
Homepage this page
Mod Support My Mod Support form
Contact Developer My Mod Support form
Latest Mod
Min TNG V 10.1
Max TNG V 14.0.4
Files modified
admin_media.php, English cust_text.php, admin_genconfig.php, admin_updateconfig.php
Installs: js/rradminmediasearch_config.js, rradminmediasearch_config.php
Related Mods
Depends on Mod_Settings_Blocks

Purpose of the Mod

This distinctly complex mod is intended to make the Admin>>Media>>Search form more powerful and useful. To a significant degree, you can think of this mod as turning the search form into a report generator. The mod implements many features. (The features listed here are flagged with ‡ if they can be controlled by mod settings.)

  • In the search form:
    1. The search string can be a regular expression.
    2. You can control which database fields to search.‡
    3. You can select several optional columns for the results table.‡
    4. There are results table sort options.‡
    5. You can control the number of results per page.
  • In the search results
    1. The Tree name is shown in a new column when more than one tree is searched (as in other Admin programs).
    2. When there is a thumbnail path value, but the file is missing, the message "(missing)" is displayed in the thumbnmail column.
[More Features]

More Features

  • Search form:
    1. An HTML fieldset border is drawn around the search form to help distinguish the search form from the action buttons below the form.
    2. The "File Ext" text field has been changed to a "File Type" drop-down list.
    3. New search options include:
      • Radio buttons that limit the search to media items with thumbnails, or without them.
      • A checkbox that limits the search to items that have bodytext.‡
      • Checkboxes to select optional result values: Geocodes, the file path, the MediaID, and/or the Mediakey.‡
    4. Some fields utilize single-character "field button" shortcuts, but only if the Field Buttons mod is installed.
  • Search results
    1. The geocodes and file path are displayed in their own columns if they are selected in the search form.‡
    2. (In TNGv12 only) When the file path has not been selected for display, the file extension (the 'FORM' attribute) is displayed in the "Title,Description" column.‡ (In TNGv13, the native TNG code shows the entire file path in the "Title,Description" column)
    3. The mediaid and mediakey share a column when they are selected in the search form.
      • Invalid image filename
      • Missing file
      • The filename extension (well, really, the 'FORM' attribute) for non-images (based on a mod option)
  • Other features
    1. The TNG "Inner Menu" (just below the tab menu) now contains a drop-down menu that provides handy links to information about the mod and a direct link to the mod settings editor. I call this menu an Inner Mod Menu, and most of my mods now add Inner Mod Menus to the programs that they alter significantly.

Finer Details:

  1. The "Linked to" column is allowed to wrap, thus allowing the "Title,Description" column to wrap less.
  2. Long mediakey values such as filenames are displayed as short links that pop up the full value.
  3. When the Geocodes column is displayed, it uses abbreviations so that it is narrower than the native Geocoordinates column.
  4. Under the assumption that, when you print the Admin>>Media>>Search page, you are focusing on the search results, several parts of the web page are omitted when the Admin>>Media>>Search page is sent to a printer. Among the areas excluded from printing are the search form, the Action and Select columns, the page navigation buttons, and the action buttons above the results table. To print these parts of the page, you can do a screen capture and print the resulting screenshot image.
  5. The reset button resets all of the new search form options to the values they had when the page was loaded, not to the defaults they would have in a new browser session.
[Hide details]

Mod Options

This mod's customizable settings are defined and edited in a Mod Settings Block at Admin>>Setup>>General Settings, in the subform Mod Settings Blocks. The settings and their effects are described and shown here.

[ See Details ]
The mod's settings are organized into groups that allow you to ignore a group or change all of the settings in that group at once:
Admin media search-modoptionsblock14.jpg
(Colored borders help you keep track of the groups as they jump around on the screen a bit when you open and close the groups.)

You can easily ignore each group, change all of its settings at once (in a couple of ways), or edit individual settings.

I'll focus on group 1 to illustrate details.

Here's what you see if you click both the "See Native Behavior" and "See Recommended Behavior" buttons.
Admin media search-optionsgroup1-behavior.jpg

The descriptions give you a glimpse of how the settings would affect the Admin>>Media>>Search behavior, without requiring you to look at and make decisions about each option. If you just want to make sure that the program takes on the native or recommended behavior, you still don't have to deal with the the detailed HTML form. Instead, you can just click "Apply" and ignore those details.

Here are the form fields for group 1, after they are opened by by the 'Show Settings' button.
Admin media search-optionsgroup1-settings.jpg
Unfortunately, the Mod Settings Block program cannot tell you whether the option values are set to the native settings, to the recommended settings, or to custom settings. (I've looked into doing that, but it would probably take too much time to implement.) But still, the point is that you don't have to deal with all of the settings individually. Instead, you can say, in effect, 'Don't bother me with the details".
[Hide mod settings 14]

Other Mods


This mod is fully compatible with the only other mods that affect admin_media.php - Unused Media, Private Media Mod, and Admin Media Predefined Search.

Related Mods

  1. The Mod Settings Blocks mod packages this mod's options into what I call a "Mod Settings Block", which is a set of form fields that formatted and labeled so that it stands out among other options in an Admin>>Setting form. Mod Settings Blocks is a prerequisite for this mod; it must be installed before this mod can be installed.
  2. Admin Media Predefined Search, is dependent on this mod. When Admin Media Predefined Search is installed Admin Media Search generates an intentional "Bad target" error in the Mod Manager, with a note saying that Admin Media Predefined Search must be installed first.
  3. Media Bodytext (which may no be published yet) Changes some features of admin_editmedia.php and showmedia.php - especially with respect to BodyText values.

Files Installed

  1. rradminmediasearch_config.php - An Include file containing bulk of the code for this mod's Mod Options Block.
  2. js/rradminmediasearch_config.js - Javascript for this mod's Mod Options Block


This mod does not use standard cust_text.php files for language strings. Instead, it stores languages strings in the mod's subfolder, and pages modified by this mod load language strings directly from files in the mod's languages/ subfolder. Read more about this technique and its procedure for handling site-specific language string overrides.

[Show Standard Installation Process]


  • A working TNG installation.
  • An installed current version of the Mod Manager.
  • You should backup files listed in the panel on the right.


  1. Remove and delete previous version of this mod.
  2. Backup the files updated by this mod. They are listed in the panel at the upper right.
  3. Download the .zip file, Extract its .cfg file to the mods folder.
  4. Follow the normal automated installation for Mod Manager, as shown in the example Mod Manager - Installing Config Files.


  1. Try using the Mod Manager Remove capability
  2. Contact me through My Mod Support form.
[Hide Details]


1. Admin>>Media>>Search BEFORE
Admin media-before-v12.jpg
  • There is no "Tree" column, even though "All Trees" has been selected.
  • In the results table, the thumbnail in the 3rd row looks exactly like the one in the first row, because it is the same file. In this case, the third media item has an invalid thumbpath value. Sometimes (I don't know why it doesn't always happen), the program displays the very first thumbnail in the thumbnails folder when it encounters a invalid path.
  • In the second and fourth rows, we don't know whether the thumbnail cell is blank because there is no thumbnail path value, or because the file is missing.
  • The "Linked to" column is wider than it needs to be, because it has a fixed width. The data in that column is also not allowed to wrap. The links are hyperlinks in browsemedia.php, but not in admin_media.php
2. Admin>>Media>>Search AFTER, with most of the run-time display options unchecked, and with the options that display extra information in the thumbnail column unchecked.
Admin media-after1-v12.jpg
  1. "Mod Information" is the label for the Inner Mod Menu, which is visible only if the optional Inner Mod Menus mod is installed. Its contents are shown in a visualization below.
  2. Three features tied to the search string field
    1. The placeholder text notes that the search string can now be a regular expression.
    2. The shaded block next to the search string represents two "Field Buttons" that are shaded out because of the status of the search string field in this screenshot.
      • The "X" button is shaded out here because the field is already empty. It is visible in Screenshots 3 and 4 below.
      • The "R" button (which restores the initial value of the field) is shaded out here because the field has not been changed since the page was loaded.
    3. The information icon pops up a message about the new features in the search string. The pop-up message is shown in Visualization 4.
      • The popup notes that the search string can be a regular expression, and gives a couple of examples.
  3. The row of "Search fields" has been added by this mod. It determines which database fields are searched by a Media search.
    • Mod options control which database fields are shown here, and whether they are checked by default.
    • A mod option can suppress the entire "Search fields" row. If the search field options are suppressed, the searches look at the Title and Description fields.
    • (As you may know, in Admin>>Media>>Search, the field identified as "Title" is really the database field "description", and the field identified as "Description" is really the database field "notes".)
  4. The "Search Criteria" row exists (with different labels) in the native search form. Here, all options are new or changed, except for the "Unlinked Only" checkbox.
    • The native form has a "File Ext" text box, which this mod replaces with a "File Type" selection box. The new selection box accomplishes the same thing as the old text field; it just lets you select file types (i.e. file extensions) from a list, and prevents you from entering a file extension that does not exist in the database. The selection box also has a "no file" option for media items that have BodyText but no file.
    • Three radio buttons determine if the search will focus on media items with or without a thumbnail path value.
    • The presence of the "Has Body Text" checkbox is controlled by a mod option. (Note that "Has Body Text" could be implemented with three radio buttons, like the thumbnails buttons, but the single box seemed sufficient.)
  5. The "Display options" row of options is added by this mod.
    • Mod options control which optional columns are shown here, and whether they are checked by default. All of the checkboxes can be suppressed, in which case the results table will always have the Geocoordinates column that is shown by the native Admin>>Media>>Search page. (But the Geocoordinates column will be abbreviated, as described in item 7 below.
    • The "Results per page" field overrides the TNG system value. This field has three field buttons:
      • The "R" button, as with the search string field, restores the value the field had when the page first loaded,
      • The "D" field button next to the field applies the default value - the TNG system value called maxsearchresults, and
      • The "A" shows "All" results. If you want to print all results using the maxsearchresults value, you would have to print the media items page-by-page, where each web page would leave wasted space on a printed page. But with the "A" setting, you'll get appropriate printed page breaks.
  6. The "Sort By" row is also created by the mod. Mod options control which (if any) sort options are available. When the sort options are suppressed, the "Sort By" row is eliminated, and the page uses the native Title, Description sort.
  7. Changes to the result table columns:
    • The "Title,Description" column is "Title,Description,FileExtension" here because - under the control of a mod option - the mod adds the media item's FORM attribute in this column when the the file path column is omitted.
    • The "Geocoordinates" column heading and the "Latitude" and "Longitude" labels have been abbreviated so that the column takes up less horizontal space.
  8. The "Linked to" column:
    • The mod defines a minimum width larger than the native fixed width. This generally causes the results table to use less vertical space.
    • (TNGv14 has implemented the feature natively) Since "Linked to" is about "links", the mod generates hyperlinks to every object that the media item is linked to.
    • The Tree column is not native to the Admin>>Media>>Search page, though it is native to most TNG search pages. It is shown by the mod only when the search covers multiple trees.
3. Admin>>Media>>Search AFTER, with a few run-time options.
Admin media-after2-v13.jpg
  • In the search form, as indicated by the red outlines:
    • This search was done on a one-tree site, so there is no Tree prompt:
    • A single tree has been selected and a search string has been entered.
    • Note that the "X" field button is now visible, since there is a value that can be cleared.
    • The search focuses on Histories
    • "MediaID" and "File Path" have been selected for display, so both are present in the results table.
    • The "Results per page" value is not the system default, so both the "D" and the "A" buttons are visible. The "R" button is still shaded out because the value has not been changed since the page was loaded.
  • The site administrator has set the the mod option to display the FORM attribute or flag BodyText-only media items flag when there is no thumbnail value. Thus, in the Thumbnail column:
    1. Even though the first media item is an external link, the file extension PDF is shown
    2. "BodyText" is shown in for media items that have a BodyText value and no file.
    3. The third row displays a thumbnail.
  • In the fourth row of the thumbnail column, the message "(Missing)" indicates that there is a thumbnail value but the thumbnail file is missing. If there were no thumbnail value, then (given the mod option setting mentioned above), the value "JPG" would be displayed.
  • In the File Path Column:
    • In external URLs and actual file paths, the mod adds zero-length space entities to the path value to allow the file path to wrap as necessary.
    • When there is a BodyText value, and no file, the size of the BodyText is shown.
4. Admin>>Media>>Search AFTER, with a few other options.
Admin media-after3-v12a.jpg

In the search form, as indicated by the red outlines

  1. This search uses a regular expression to find media items that contain "Francis Billingsly" OR "ClarenceSR"
  2. The mediaID joins the mediakey in their shared column, and the Geocodes column is displayed.

In the results table, as indicated by the green outlines

  • In the MediaID & MediaKey column, the MediaID comes first, though if both values have been selected, and results are sorted by MediaKey, the MediaKey will be listed first.
  • The Geocodes column uses abbreviations and rounds the latitude and longitude to three digits so that the column doesn't take up much space.
  • The pop-up message from the information icon next to the search string is shown at the bottom of the screen clip. If the Field Buttons mod is not installed, the description of the field buttons is not displayed.
5. The Inner Mod Menu in the Admin Media Search page
Admin media search-innermodmenu-v13.jpg

This shows the Inner Mod Menu when two mods that affect Admin>>Media>>Search have been installed - Admin Media Search and its companion mod Admin Media Predefined Search. For both mods, the Inner Mod Menu provides hyperlinks to

  1. The mod's Wiki article (via the Wiki logo),
  2. The Mod Options section of the Wiki article, and
  3. The Mod Options editor (see the next visualization)

The Admin Media Search menu also links to a popup summary of what the mod does. That popup is shown in this screenshot.

6. Mod Options

This mod has quite a few options. Its Mod Settings Block tries to simplify the process of managing the mods settings by defining two group of setting. Each group applies to a particular aspect of the Admin Search Pag, and fr each group, you can

  1. See a description of settings that would produce the native behavior for that aspect of the Admin Search page.
    • From there, you can apply all of those settings at once
  2. See a description of recommended settings.
    • From there, you can apply all of those settings at once
  3. See the HTML that lets you change the settings individually.

Admin media search-modoptionsblock14.jpg
See detailed descriptions and visualizations in the Mod Options section of this article.


[Show details]
[Hide Details]

My mods generally do not add style rules to genstyle.css because

  1. genstyle.css has SO MANY rules already,
  2. The rules added by most mods affect only one or two programs, and just take up space in genstyle.css for other programs, and
  3. Keeping mod-generated rules separate helps to avoid classname conflicts between mods.

Some of my mods define stand-alone .css files, but most of my mods (like this one) define an inline style sheet. If you want to override any of these rules, you can add supplemental rules to your template's mytngstyle.css file, or to the bottom of your genstyle.css. The mod implements a JQuery document.ready trick to allow you to override my inline style rules this way. That trick is described in a Technical Note in my TNG Wiki home page. (Note that it is easy to miss the minor "Internal Style Sheets" heading that is the destination of this link, since the content of the section is hidden, and it is immediately followed by a major heading.)

[Hide details]

Language Strings

This mod includes a typical mod subfolder, with the same base name as the mod's .cfg file. The subfolder is atypical in that no files in it are installed to working TNG folders. However, it does contain critical files that contain the mod's language strings, which the mod does not add to standard cust_text.php files. Instead, the PHP code modified by this mod loads the language strings from files in the mod's languages/ subfolder. Read more about this technique.

Revision History

Mod Version TNG Version Date Note
[[|] 14.* 21 Mar 2024 Accommodated a change in TNGv14.0.4. The change is backward compatible for TNGv14.* 14.* 17 Nov 2023 Adds new search features, Adds columns , Adds hyperlinks to media linked Places,Allows the medialink hyperlinks to go to object viewers, And more! 13 30 Nov 2020 Very minor update - Added whitespace to the search form 20 Nov 2020
  1. People linked to directly and through a citation were showing up twice in the "Linked to" column
  2. Cleaned up some undefined variable and subscript references 13 3 Oct 2020
[Show details]
[Hide details]
  1. Fixed another typo.

v13.0.0.14a 1 Oct 2020

  1. Fixed a typo.

v13.0.0.14 20 Sep 2020

  1. TNGv13 has its own sorting in the 'Title,Description' and 'Last Modified' columns. The mod has
    • Removed the TNGv13 sorting columns ('Title,Description' and 'Last Modified') in favor of the mod's existing Search form sort options
    • Made the 'Last Modified' column optional, and added it to the list of sortable columns
    • Handled an underlying change from $text to $admtext.
  2. TNGv13 omits the Geocode column. The mod reinserts it as an optional field, and thus adds the media geocodes to the main query.
  3. TNGv13 adds the label "Citation" in the LinkedTo column before people and families linked through citation medialinks. This mod removes that label.
  4. TNGv13 puts the file path in the Description,Title column in a different format from the ways this mod did. This mod now uses, with modification, the TNGv13 format, and still removes the filename from the Description,Title column when the optional FilePath column is displayed.
  5. Removed two complex features of the mod:
    • Sources and Event tags associated with citation medialinks
    • Error messages in the thumbnail column, though the new mod keeps the separate option to display the word "missing' when the thumbnail file is defined bu missing.
[Hide details]
[See TNGv9 (2014) - TNGv12 (2020)]
[Hide details]
Mod Version TNG Version Date Note 14 17 Nov 2023 Adds new search features, Adds columns , Adds hyperlinks to media linked Places,Allows the medialink hyperlinks to go to object viewers, And more! 12.2 - 12.3 25 Jul 2020
  • Fixed the Edit Options link in Mod Manager.
  • Made the disabled sort options more obviously disabled by greying out the labels and adding title text.
  • If none of the display options that drive sort option (e.g. mediaid, mediakey, file path) are offered as display options, then we know that we'll sort by title/description, so the Sort By row in the search form is not displayed at all.
  • Added zero-length spaces next to slashes and underscores in the Media Item note to allow URLs and file paths to wrap. 12.2 - 12.3 17 Jul 2020 No functional changes in the behavior of the search page, except that some features can now be disabled. This update is essentially all about the mod options. It simplifies (I hope) the editing of options by allowing groups of options to be set at once. 12.2 - 12.3 25Feb2020 No Functional Changes.
  • Simplified the mod by removing a conditional location that handled TNGv12.0-1 vs TNGv12.2 (and now TNGv12.3).
    • As a result, there are two version of TNGv12* - v12.0.0.12c, and v12.2.0.12c,
  • Fixed a missing %end:% tag, which TNGv12.3 does not tolerate.
  • Uses version 4 of the shared mod libraries
  • Mod v12c1 fixes a function call that changed between v3 and v4 of a shared mod library. 12.0 - 12.2 15Dec2019 No Functional Changes. Just upgraded to version 3 of the shared mod libraries and fixed a bug that was using the media item tree instead of a medialink tree. (They are rarely different, but they can be.) 12.0 - 12.2 30Oct2019
  • Fixed a problem with regex searches. There is no practical way to validate them, and invalid regex expressions in SQL can crash PHP. Then, when you run the search program again, it uses the searchstring cookie to repeat the broken search. My solution is not to save regex searches in the cookie.
  • Found and dealt with a citation medialink use-case that I hadn't been aware of.
  • Improved the handling of the new information in the thumbnail column, and added mod options to suppress that information.

(See also the revision notes for v12.0.0.12 and v12.0.0.11, which were pretty short-lived.) 12.0 - 12.2 24Oct2019 This version needed immediate repair by version 12a, so it cannot be downloaded.
  • Handles citation medialinks differently from both the native TNGv12.2 code and version 11 of this mod. In particular, this version displays the tag names of events supported by citation medialinks
  • Mod options control whether the event tags are visible or hidden as the page loads, and whether there is a button in the LinkedTo column that toggles the display citation medialinks the event tags.
  • Added (under control of an option) the ability to display the media item's FORM attribute when there is no thumbpath.
  • Under control of an option, several error messages are displayed in the thumbnail column if there is no thumbpath.
[Minor changes]

Small presentation enhancements:

  • Fixed a bug that prevented the searchstring ID and info icon from being defined when the field buttons mod is not installed.
  • Added "File type" to the Title/Description column in the results table when those values are in the that column. (The mod has always placed the file type in that column when the full file path is not being displayed in the results table.)
  • Styled radio buttons and checkboxes to move the labels and buttons closer to each other.
  • Changed the order of the display option checkboxes to match their positions in the results table.
  • Added the label "File type" before the file type selection box.
  • Sorted the file type selection options in alphabetical order.
  • Uses version 2 of the shared InnerModMenu and ModSettingsBlocks Include files..
[Hide details] 12.0 - 12.1 30Sep2019 (This version was pretty short-lived. Several of its new features are handled much better in version, which is also more fault-tolerant.)
  1. Handles Citation Medialinks, which are new in TNGv12. (Mod version 12a does a MUCH better job of this.)
  2. Added my new Inner Mod Menu, which provides very convenient access to the mod options.
  3. The options for this mod are presented in a Mod Settings Block in the new subform Robin's Mods.
[Less significant changes]
  1. In the Thumbnail column of the results table, when a thumbnail file is missing, the program now displays a message saying "Thumbnail missing", with the thumnail path in title text (in effect, in a tool tip).
  2. Added Field Buttons
  3. Makes sure that at least one search field is checked
  4. (There is a new mod option whose meaning is not at all clear, but I made up for that by never actually using that option in admin_media.php.)
[Hide details] 12.0+ 4May2018 No functional changes; made compatible with TNGv12. 10.1 - 11.1.2 17Dec2017

- Added the size of the Bodytext field to the filepath column if it is being displayed, and to the "Title, Description" column otherwise
- Rather than say "Thumbnail specified but missing", shows the thumbnail filepath.
- Moved the embedded style sheet to css/genstyle.css 10.1 - 11.1+ 10May2017
  1. Added the ability to sort by description, filepath, mediaID, or mediaKey, selected through checkboxes on the search form.
  2. Made ShowModNames optional and pulled the .rrnoprinter style class into an embedded style sheet to remove a mod dependency. download 10.1 - 10.1.3 21 Feb 2016 Added thumnbnail search option, and missing thumbnail message. Displays media key.

Also now depends on Show Mod Names v2+. 10.1 - 10.1.1 12Jul2015 Made this mod compatible with Rick Bisbee's new Showfolio Mod by tweaking a code fragment. No other changes. 10.1 - 10.1.1 5Jun2015 Made this mod compatible with Chris Moss's new Private Media Mod. No changes other than the inclusion of the new Private Media flag created by Private Media Mod. 10.1 - 10.1.1 11May2015 - Added showfilename and showgeocode parameters to display or suppress columns
- Added abbreviations for latitude and longitude.
- Added tree column
- Added hyperlinks to all linked objects, including places
- Added no-space breaks in the filename column to allow the path to wrap a bit.
- Allowed the linked object names to wrap, but specified a minimum column width. 10.1 30Dec2014 No functional changes, just changed database references for TNG v10.1 compatibility. download 9.0.0 - 26 Dec 2014 Fixed a bug that was preventing the program from recognizing when the collection was changes, and from changing the collection Add/Edit buttons and fields in response. 9.0.0 - 11Dec2014 No functional changes; no visualization changes. Cleaned up mod directives for the TNGv10.3 alpha release. Added better annotation to the code changes. Eliminated a duplicate checkbox in the search. Places cust_text insertions at the end of cust_text.php instead of at the beginning. 9.0.0 - 08 May 2014 Initial release.
[Hide old history]

Sites using this mod

If you download and install this mod, please add your site to the table below.

URL User Note Mod Version TNG Version User language
Robin Richmond's Genealogy Database Robin Richmond Mod developer 14.0.3 English
Total Family History Scott Bennett Private Site (For right now) V9.0.0.1 TNG 10.0.1 - 11.1.2 EN
Wortelboer Genealogy Bernard Wortelboer Public site 11.0.0 NL/EN
De Zoethouten van Woudsend John Zoethout Public site 10.1.0 Dutch/English
Hooley Family Links Rick Hooley Public/Private See Here See Here EN
DJCM.DK Claus Martinussen Private Site (For right now) 13.0.4 DA/EN
Bisbee Family Connection Rick Bisbee Public site 10.1.2 English
Adler-Wien Herbert Fischer Public site 14.0 DE
Stamboom Jongman Roel Jongman Public/Private site 10.1.3 NL, DE, EN
Our Family History Paul Barrett Public/Private site 11.1.2 EN
The Cole / Tanner Family Tree David Cole Public/Private see here see here EN, DE, FR, ES, NL
Joseph Oran Holtz Genealogy Pages Jim Holt Private See Here See Here EN