Jump to content
TNG Community
Jan Suhr

Note and sources marked as PRIVATE

Recommended Posts

Michel KIRSCH

If a private person is in your original gedcom marked by :

1 PRIV

Just replace this 1 PRIV by

1 _PRIVATE Y

And it's all ! (same for notes, sources, etc.)

Share this post


Link to post
Share on other sites
Michel KIRSCH

Send me a little gedcom with private sources, notes, persons, families...

Michel => genealogie@mkirsch.be

 

Share this post


Link to post
Share on other sites
Jan Suhr

OK I'll try with a search and replace  on my Gedcom and see what happens.

I'll already have a Node.js script that to some search and replace on my Gedcom to get it to look better for the places. My Gedcom don't have any spaces after the commas in the PLAC string. Some empty commas as well. All of that is cleaned up wit this script. It is easy to add the PRIV fix to that Node.js script.

Share this post


Link to post
Share on other sites
Jan Suhr

I did try this and the notes and sources that are marked as 1 PRIV still shows up in TNG as if they weren't PRIV i.e. they are not hidden.

So my question remains, where should the ~ be placed and then to recognized by TNG during import?

 

 

Thanks

 

Share this post


Link to post
Share on other sites
Michel KIRSCH
15 hours ago, Michel KIRSCH said:

If a private person is in your original gedcom marked by :

1 PRIV

Just replace this 1 PRIV by

1 _PRIVATE Y

And it's all ! (same for notes, sources, etc.)

Marking private for tng is _PRIVATE (don't forget the underscore...)

Try this little gedcom (10 persons, 2 families) and you'll see that TNG import it with private notes and individuals

Michel

PHIL(8).ged

Share this post


Link to post
Share on other sites
Jan Suhr

Ok, I did import your file.

I'm not sure that we are talking about the same thing here.
For example, Francois Emmanuel  PPPHILIPPART in your file has a note marked as 2 _PRIVATE Y. If I understand you correct this means that TNG will see this as a note marked as PRIVATE. It does show up as normal on the page for Francois and when I look that note up in the Admin area it is not marked as Private.

What I want is that my notes and sources that are marked as Private in MFT and had the 1 PRIV tag in the GEDCOM becomes hidden in TNG.

Share this post


Link to post
Share on other sites
Michel KIRSCH
5 hours ago, Jan Suhr said:

I'm not sure that we are talking about the same thing here.

...and yes, we are talking about the same thing.

...and yes, you're right : something goes wrong... with TNG.

The person is well imported as private, but the note doesn't.

I think maybe it's an issue.

Wiil speak with Darrin about that.

I'll keep you informed

Michel

Share this post


Link to post
Share on other sites
Michel KIRSCH

Finally, this is an omission in TNG.

Darrin will works on this as soon as possible (probably for the next upgrade..)

Michel

Share this post


Link to post
Share on other sites
Michel KIRSCH

Jan

If you want  to import your private notes,

in your gedcom file, replace the text of your private notes as below :

1 NOTE This is a private note

With

1 NOTE ~This is a private note

In TNG set the Setup>>Import Settings>> Prefix for private notes: as ~

That do the job...

Michel

 

Share this post


Link to post
Share on other sites
Jan Suhr

Thanks,

 

That was what I was waiting for. 😃

Share this post


Link to post
Share on other sites
Jan Suhr

OK now it works for Notes.

But Sources are still visible, I can't see any setting for them to set them to be private. How ever a note that is associated with a Source gets hidden if it is Private

Share this post


Link to post
Share on other sites
Jan Suhr

I did a manual change in  personlib.php to hide sources with ~ and replace them with a text saying that this source is private.

This works for me

Snag_a4c7a7.png

Share this post


Link to post
Share on other sites
Michel KIRSCH

👍

Share this post


Link to post
Share on other sites
Ken Roy
6 hours ago, Jan Suhr said:

I did a manual change in  personlib.php to hide sources with ~ and replace them with a text saying that this source is private.

Jim,

Just remember to keep good notes, or better yet, create yourself a %private: mod for this change, so that you can re-install it on an upgrade.

The reason that setting the prefix for private information did not work for sources is that there is no secret or private flag for notes.

Share this post


Link to post
Share on other sites
Michel KIRSCH
12 minutes ago, Ken Roy said:

did not work for sources is that there is no secret or private flag for notes.

no flag for sources.

Share this post


Link to post
Share on other sites
Jan Suhr
15 minutes ago, Ken Roy said:

Jim,

Just remember to keep good notes, or better yet, create yourself a %private: mod for this change, so that you can re-install it on an upgrade.

The reason that setting the prefix for private information did not work for sources is that there is no secret or private flag for notes.

Yes I saw that it didn't have that functionality. Since my MFT can export the GEDCOM sources with 1 PRIV tags this worked for me.

And yes I keep note on everything I do, learned the hard way

Now that this works Diedrich Hesmer who has the excellent GEDCOM-tool  http://ofb.hesmer.name/gedserpro_e.html will fix a small special program that will modify my Gedcoms and change the Notes and Sources who have a 1 PRIV tag and add the ~ to the title in those tags so that it will work with TNG.

Share this post


Link to post
Share on other sites
Jan Suhr

Diedrich asked if TNG support the  tag  "n RESN xxx"  where xxx can be  confidential | locked | privacy

 

I didn't see anything about that in the Wiki on Gedcom. I'm not sure if that would work in the  Custom Event Types as it is, I guess it would need some code to work.

Share this post


Link to post
Share on other sites
Ken Roy

Jan,

I don't think it does and until a flag is added to the sources table to make it as restricted or private, it would not make any difference

Share this post


Link to post
Share on other sites
Jan Suhr

This is how I did it in personlib.php

I posted the whole function that I edited since there are small changes in a few places besides the first bigger change at the start of the While loop

As you see I do a RegExp match after the ~ and then a few If-statements if that ~ is found or not.
As it is in this example I haven't yet added the replacement text as a language variable.
 

function getCitations( $persfamID, $shortcite = 1 ) {
	global $sources_table, $text, $tree, $citations_table, $citations, $citationsctr, $citedisplay, $cms, $showsource_url;

	$actualtext = $shortcite ? "" : ", actualtext";
	$citquery = "SELECT citationID, title, shorttitle, author, other, publisher, callnum, page, quay, citedate, citetext, $citations_table.note as note, $citations_table.sourceID, description, eventID{$actualtext}
		FROM $citations_table LEFT JOIN $sources_table on $citations_table.sourceID = $sources_table.sourceID AND $sources_table.gedcom = $citations_table.gedcom
		WHERE persfamID = \"$persfamID\" AND $citations_table.gedcom = \"$tree\" ORDER BY ordernum, citationID";
	$citresult = tng_query($citquery) or die ($text['cannotexecutequery'] . ": $citquery");

	
	while( $citrow = tng_fetch_assoc($citresult) ) {
		$hidePrivateSource = preg_match("/(~.*)/", $citrow['title']);
		if($hidePrivateSource == true){
			$source = $citrow['sourceID'] ? "" : "";
			$newstring = $source ? "" : "This source is private";
			$key = $persfamID . "_" . "";
		}
		else{
			$source = $citrow['sourceID'] ? "[<a href=\"$showsource_url" . "sourceID={$citrow['sourceID']}&amp;tree=$tree\">{$citrow['sourceID']}</a>] " : "";
			$newstring = $source ? "" : $citrow['description'];
			$key = $persfamID . "_" . $citrow['eventID'];
		}
		$citationsctr++;
		$citations[$key] = isset($citations[$key]) ? $citations[$key].",$citationsctr" : $citationsctr;
		
		$citmedia = getMedia($citrow,"C");
		$mediaoutput = "";
		if($citmedia) {
			$mediaoutput .= "<table cellspacing=\"4\">";
			foreach( $citmedia as $item ) {
				$mediaoutput .= "<tr>\n";
				if( $item['imgsrc'] )
					$mediaoutput .= "<td>{$item['imgsrc']}</td>\n";
				else
					$mediaoutput .= "<td></td>";
				$mediaoutput .= "<td valign=\"top\">{$item['name']}<br />" . nl2br($item['description']) . "</td>\n";
				$mediaoutput .= "</tr>\n";
			}
			$mediaoutput .= "</table>";
		}

		if( $citrow['shorttitle'] ) {
			if( $newstring ) $newstring .= ", ";
			$newstring .= $citrow['shorttitle'];
		}
		else if( $citrow['title'] ) {
			if($hidePrivateSource == true){
				$newstring .= "";
			}
			else{
				if( $newstring ) $newstring .= ", ";
				$newstring .= $citrow['title'];
			}
		}
		if( $citrow['author'] ) {
			if( $newstring ) $newstring .= ", ";
			$newstring .= $citrow['author'];
		}
		if( $citrow['publisher'] ) {
			if( $newstring ) $newstring .= ", ";
			$newstring .= "({$citrow['publisher']})";
		}
		if( $citrow['callnum'] ) {
			if( $newstring ) $newstring .= ", ";
			$newstring .= $citrow['callnum'] . ".";
		}
		if( $citrow['other'] ) {
			if( $newstring ) $newstring .= ", ";
			$newstring .= $citrow['other'];
		}
		if( $citrow['page'] ) {
			if( $newstring ) $newstring .= ", ";
			$newstring .= nl2br(insertLinks($citrow['page']));
		}
		if( $citrow['quay'] != "" ) {
			if($hidePrivateSource == true){
				$newstring .= "";
			}
			else{
				if( $newstring ) $newstring .= " ";
				$newstring .= "({$text['reliability']}: {$citrow['quay']})";
			}
		}
		if( $citrow['citedate'] ) {
			if( $newstring ) $newstring .= ", ";
			$newstring .= displayDate($citrow['citedate']);
		}
		$newstring .= substr( $newstring, -1) == "." ?  "" :".";
		if( $citrow['citetext'] ) {
			if( $newstring ) $newstring .= "<br />\n";
			$newstring .= nl2br(insertLinks($citrow['citetext']));
		}
		if( $citrow['note'] ) {
			if( $newstring ) $newstring .= "<br />\n";
			$xarr = checkXNote($citrow['note']);
			$citrow['note'] = insertLinks($xarr[0]);
			$newstring .= nl2br($citrow['note']);
		}
		if( !$shortcite && $citrow['actualtext'] ) {
			if( $newstring ) $newstring .= "\n\n";
			$newstring .= insertLinks($citrow['actualtext']);
		}
		$citedisplay[$citationsctr] = "$source $newstring $mediaoutput";
	}
	tng_free_result($citresult);
}

 

Share this post


Link to post
Share on other sites
Jan Suhr

I have one question regarding my code above.

Since this is more or less hard coded I need to change it depending on permissions. As it is now it is hidden for public view but I want it to be visible in when logged in as Admin. I don't give access to visitors to login on my site.

I found a variable named $rights . If I echo $rights['both'] I get nothing. So what is the way to reach the admin permissions if I am logged in as Admin?

 

Thanks

 

 

Share this post


Link to post
Share on other sites
Ken Roy

The correct way to check for the TNG Administrator login is

if( $allow_edit && $allow_add && $allow_delete && !$assignedtree)

If you have no users that can edit, add, or delete, there is also the $allow_admin variable, but that one is set for anyone who can access admin applications for any reason.

Share this post


Link to post
Share on other sites
Jan Suhr

Thanks Ken, I try that

Share this post


Link to post
Share on other sites
Jan Suhr

It seems like that isn't accessible inside of the getCitation function.

If I place this inside the function I get no response but outside of the function it shows up.
 

if( $allow_edit && $allow_add && $allow_delete && !$assignedtree){
	echo "We are now in Admin mode";
}

 

Share this post


Link to post
Share on other sites
Ken Roy

Sorry, I don't have the time to look at the code and help you program it, but you may need to add global statements within the function that you are changing

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×