Jump to content
TNG Community
Jan Bastiaanssen

****SOLVED**** admin_media.php

Recommended Posts

Jan Bastiaanssen

Using admin_media.php, I get  the standard report.

I would like a extra column Owner/Source  between Linked to and  Last modified.

Is that posssible;    if yes how can i realize that.

 

Thanks,

Jan

Screenshot_2.jpg

Share this post


Link to post
Share on other sites
Michel KIRSCH

Jan,

to make what you want, you must do 3 things :

1) modify the $query to "import" the owner from the table

2) Add a column and it's title to the table

3) insert the data imported in the new column

In admin_media.php :

1) Modifying the $query :

modify this block :

$query = "SELECT $media_table.mediaID as mediaID, $medialinkID description, notes, path, thumbpath, mediatypeID, abspath, mediakey, usecollfolder, $media_table.gedcom, form, changedby, DATE_FORMAT(changedate,\"%d %b %Y\") as changedatef
	FROM $media_table $join $wherestr
	ORDER BY $orderstr LIMIT $newoffset" . $maxsearchresults;

in :

$query = "SELECT $media_table.mediaID as mediaID, $medialinkID description, notes, owner, path, thumbpath, mediatypeID, abspath, mediakey, usecollfolder, $media_table.gedcom, form, changedby, DATE_FORMAT(changedate,\"%d %b %Y\") as changedatef
    FROM $media_table $join $wherestr
    ORDER BY $orderstr LIMIT $newoffset" . $maxsearchresults;

2) Add a column : After this line,

			<td class="fieldnameback fieldname"><nobr> <b><?php echo $admtext['linkedto']; ?></b> </nobr></td>

insert :

			<td class="fieldnameback fieldname"><nobr>&nbsp;<b><?php echo "Your column name here"; ?></b>&nbsp;</nobr></td>

 

3) add the data : after this block :

			$medialinktext = $medialinktext ? "<ul>\n$medialinktext\n</ul>\n" : "&nbsp;";
			echo "<td nowrap class=\"lightback normal\" valign=\"top\">$medialinktext</td>\n";

Add this line :

			echo "<td nowrap class=\"lightback normal\" valign=\"top\">{$row['owner']}</td>\n";

Tested. Don't forget to make it permanent with a Mod !

Michel

Share this post


Link to post
Share on other sites
Jan Bastiaanssen

Thanks a lot Michel,

I will try this tonight.

Thanks, Jan

Share this post


Link to post
Share on other sites
Jan Bastiaanssen

Michel,

I followed your lines and that worked like a charm.

THANKS A LOT.

For maintenance reasons I tried to  make that column selectable bit that is not realy work.

Do you have  time to look at it ?

Attached is the  cfg-file.

 

Screenshot_1.jpg

Xtra Media Column.cfg

Share this post


Link to post
Share on other sites
Rob Severijns

Jan, Michel,

Nice modification. I'm interested in the working cfg file too.

Rob

Share this post


Link to post
Share on other sites
Michel KIRSCH

Jan, the mod can not install because your location 1 already contains the ", owner" field !

 

Share this post


Link to post
Share on other sites
Michel KIRSCH

To make the check box functionning, you must

1 - define the $admtext['noowner'] in your customconfig.php file (best is a $text['noowner'] = "Geen eigenaar"; in $text and not in $admtext)

2.- when the box is checked, you have to modify the sql string with

if($noowner){
    $wherestr .= $wherestr ? " AND owner = \"\"" : "owner = \"\"";
}    

after

if( $nothumb ) {
    $wherestr .= $wherestr ? " AND thumbpath = \"\"" : "thumbpath = \"\"";
}

Not tested but i think it will works...

Michel

PS : to have more facility to retrieve your modified code, please indicate it with a string like "// Xtra column Mod "

Replacing the entire $query string is not a good practice : if another mod must work on the same part, it cannot install after your mod and vice-versa.

The best is to look if your owner field is not already in the $query string and if not, add it.

if (!stristr(", owner", $query))
   $query = str_replace("notes, ","notes, owner, ",$query);

 

 

Share this post


Link to post
Share on other sites
Michel KIRSCH

When you've finished, compare your mod with this version...

Michel

 

 

Xtra Media Column_v13.0.3.1.cfg

Share this post


Link to post
Share on other sites
Jan Bastiaanssen

Michel,

my new version (attached), runs into an error which i can't get away.

Your version runs, but selection is not working.

 

 

Thanks, Jan

Xtra Media ColumnJAN.cfg

Share this post


Link to post
Share on other sites
Michel KIRSCH

What's the error Jan?

I've tested my version : it runs fine...

Send me your admin_media.php file. I think there are some code snippets staying in it

or replace your admin_media.php with a fresh version (be sure that no others mods are modifying it !)

Michel

Share this post


Link to post
Share on other sites
Michel KIRSCH

I find youe error :

you will replace the $query striing, but you indicate

$query = "SELECT $media_table.mediaID as mediaID, $medialinkID description, notes, path, thumbpath, mediatypeID, abspath, mediakey, usecollfolder, $media_table.gedcom, form, changedby, DATE_FORMAT(changedate,\"%d %b %Y\") as changedatef


this is not the entire query...

Share this post


Link to post
Share on other sites
Michel KIRSCH

and the second error is :

if($noowner){
    $wherestr .= $wherestr ? " AND noowner = \"\"" : "noowner = \"\"";
}

but the field noowner doesn't exists in the table.

The field name is owner. noowner is the name of your field on the screen(the checkbox)

so :

if($noowner){
    $wherestr .= $wherestr ? " AND owner = \"\"" : "owner = \"\"";
}

Share this post


Link to post
Share on other sites
Michel KIRSCH
8 hours ago, Rob Severijns said:

I'm interested in the working cfg file too

Rob, do you try my version?

Share this post


Link to post
Share on other sites
Rob Severijns

Michel,

Yes, I have installed it. Seems to work just fine.

Rob

Share this post


Link to post
Share on other sites
Michel KIRSCH
2 minutes ago, Rob Severijns said:

Yes, I have installed it.

Thx.

Michel

Share this post


Link to post
Share on other sites
Rob Severijns

Share this post


Link to post
Share on other sites
Jan Bastiaanssen

Michel,

I don't know what i did wrong, but your version works like a charme now.

Thanks very much.

Jan

Share this post


Link to post
Share on other sites
Jan Bastiaanssen

Michel & Rob,

For your interest:

Xtra Media Column V13.0.3.1.cfg is not working together with admin_media_search V13.0.0.14d.cfg from Robin Richmond.

So we have to choose.

Jan

Share this post


Link to post
Share on other sites
Michel KIRSCH

So long Jan !

Share this post


Link to post
Share on other sites
Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×