Jump to content
TNG Community
theKiwi

Search for Connections Mod

Recommended Posts

mjaro

I made so many changes that a new sub-release is now justified:

 - display life years below name in boxes
 - initials() function replaced by a more universal one
 - presentation and validation functions moved to separate connections-lib.php
 - fix page header to display photo and dates
 - fix bookmark and log entry for clickable connections results
 - added End Person mark on diagrams
 - (tested but finally deprecated due to unneeded conversion by Wordpress/Aple arrows in diagram in place of non-directional signs)
 - TNG custtext include added at the end of the mod custtext
 - compatibility to PHP8 improved
 - if End Person mark is not set then Start Person mark (and legend) is used in its place

Thanks to everyone for inspirations and test results (also sent in private mails)

I'm attaching the mod version 13.0.3.4f, and wait for your feedback!

Michał

Connections_v13.0.3.4f.zip

Share this post


Link to post
Share on other sites
Ken Roy
2 hours ago, mjaro said:

- fix page header to display photo and dates

Michal,

2 hours ago, mjaro said:

fix page header to display photo and dates

Why are you not using the TNG functions for displaying the photos and dates for the page heading?

2 hours ago, mjaro said:

validation functions moved to separate connections-lib.php

why are you creating your own functions instead of using the TNG functions for validating whether someone is living and whether the user is allowed to view Living persons

2 hours ago, mjaro said:

added End Person mark on diagrams

How do we override your color selection for start and end person icons?

Share this post


Link to post
Share on other sites
tngrlkrz
1 hour ago, Ken Roy said:

How do we override your color selection for start and end person icons?

In the mod's language folder, the  $text['pri'] and $text['fin'] variables in the ~custtext.php files.

Share this post


Link to post
Share on other sites
Ken Roy
1 hour ago, tngrlkrz said:

In the mod's language folder, the  $text['pri'] and $text['fin'] variables in the ~custtext.php files.

Thanks Ron,

However that means if I am using more than one language I have to override in multiple places, instead of overriding a style class definition.  :)

Share this post


Link to post
Share on other sites
mjaro
3 hours ago, Ken Roy said:
5 hours ago, mjaro said:

fix page header to display photo and dates

Why are you not using the TNG functions for displaying the photos and dates for the page heading?

I initially just cloned Relationship tab (also to use its form), but it didn't display dates well for me. Thus I added my own lifeyears display. The photo (+signature) display function is the TNG standard.

3 hours ago, Ken Roy said:
5 hours ago, mjaro said:

validation functions moved to separate connections-lib.php

why are you creating your own functions instead of using the TNG functions for validating whether someone is living and whether the user is allowed to view Living persons

For determining living/private rights I do use TNG functions. I added checking if the ID received from user is a valid one: some databases use a constant-length numeric part, and I allow the user to write "IRN" in the form (i.e., only number and not the full ID containing the prefix and possibly suffix). Then I can check if the ID represents a person in the tree.

I also added mjainitials() replacing TNG initials() because the original one cannot handle East European alphabets correctly (incl. cyryllic/greek). I posted my solution to Darrin.

Michał

Share this post


Link to post
Share on other sites
mjaro
48 minutes ago, Ken Roy said:

Thanks Ron,

However that means if I am using more than one language I have to override in multiple places, instead of overriding a style class definition.  :)

Ken, OK, I'll turn this into a class (it was such in the "e" version). This implies, however, that the mod user has to modify genstyle.css, or has to modify mytngstyle.css for every allowed templates... But if you are sure that this is more convenient way I'll do a class.

I must say I'm not happy that my styles go into genstyle.css. I would prefer to keep them in a separate file (and still allow to override them by mytngstyle.css). Why do you want me to modify genstyle ? (unless the Connections is not a part of TNG).

Michał

 

Share this post


Link to post
Share on other sites
Ken Roy
1 hour ago, mjaro said:

The photo (+signature) display function is TNG standard.

Michal,

I beg to disagree.  It used to be that way in v4aConnections_v4a_2021-04-07_110209.png

Now in the current v4f version, it does not show the gender icon, years, nor signature

Connections_v4f_2021-04-07_105841.png

 

 

 

Connections_v4f_2021-04-07_105841.png

Share this post


Link to post
Share on other sites
mjaro

Hmmm, strange... My intention was to use the default dates function but it wasn't working. Anyway, the photo+signature is the TNG default. I have to re-check what is the problem.

Share this post


Link to post
Share on other sites
Ken Roy
3 hours ago, mjaro said:

I must say I'm not happy that my styles go into genstyle.css

Michal,

If you use your own style sheet or inline styles in a mod then you may need to document how the users need to override your choices.  Since you are using your own cust_text.php files out of your mods subfolder, you already may already have to document what the user needs to do to override your choice of custom text on inline styles in text variables.

There are several articles in the How TNG Works  that explain how a user can override styles and text variables within TNG

4 hours ago, mjaro said:

mod user has to modify genstyle.css, or has to modify mytngstyle.css for every allowed templates.

Mod users only need to override the styles for the template they are using in their mytngstyle.css.  Sorry I cannot speak to WordPress users, but suspect that if they are using TNG styles without a template, their overrides would be in the mytngstyle.css in the TNG root css/ folder

Share this post


Link to post
Share on other sites
mjaro
1 hour ago, Ken Roy said:

have to document what the user needs to do to override your choice of custom text on inline styles in text variables.

Ken, I assumed that no special documentation is needed since custom texts of the mod can be overridden in the default way using languages' cust_text.php.

1 hour ago, Ken Roy said:

mjaro said: for every allowed templates

Of course you are right, I should have written "for every templates they are using".

1 hour ago, Ken Roy said:

that explain how a user can override styles

I follow the articles (I read all of them!) as well as your early advice, and thus put my styles to genstyle.css to make the styles available to every templates, to allow users to override them at the template level. Why I'm not happy is because at the still early stage of my mod (and my programming skills) I have to continuously edit the genstyle.css which is the only important global TNG file I touch (sometimes making errors).

Michał

Share this post


Link to post
Share on other sites
Ken Roy
2 hours ago, mjaro said:

custom texts of the mod can be overridden in the default way using languages' cust_text.php.

Michal,

Are you saying that I can enter the inline style overrides to your definitions in your connections/languages/English-UTF8_custtext.php

7 hours ago, tngrlkrz said:

In the mod's language folder, the  $text['pri'] and $text['fin'] variables in the ~custtext.php files.

to change your color definitions for the starting and ending points?  Will have to try that out.  Not something I ever tried before.

Share this post


Link to post
Share on other sites
mjaro
13 minutes ago, Ken Roy said:

Michal,

Are you saying that I can enter the inline style overrides to your definitions in your connections/languages/English-UTF8_custtext.php

to change your color definitions for the starting and ending points?  Will have to try that out.  Not something I ever tried before.

Ken please wait, I see that the include statement gets wrong path and will not work. I have to correct.

Share this post


Link to post
Share on other sites
Ken Roy
1 hour ago, Ken Roy said:

Are you saying that I can enter the inline style overrides to your definitions in your connections/languages/English-UTF8_custtext.php

8 hours ago, tngrlkrz said:

In the mod's language folder, the  $text['pri'] and $text['fin'] variables in the ~custtext.php files.

to change your color definitions for the starting and ending points?  Will have to try that out.  Not something I ever tried before.

Thanks Michal,

I did not realize you could do that.   So without necessarily defining a style class for your starting and ending icons, you could document that users can override the color by adding the following to their cust_text.php by manually editing the cust_text.php file(s) or creating a private mod to add the definition after the TNG v12 anchor comment.

$text['pri'] = "<span style='color:darkblue;'>&#9658;</span>&nbsp;"; #9733 big star, #9679 circle, #9658 right pointer

By the way, I did not mean to imply you had not read those articles.  I added the link to the post for other new users.

Thanks for teaching me something today.  :)

Share this post


Link to post
Share on other sites
mjaro
3 minutes ago, mjaro said:

I have to correct.

Ken, please replace the "include" line in the mod's  English_custtext.php (line 70) with

include ($rootpath . "languages/English/cust_text.php");

Similar changes are needed to other languages. I'm sorry for putting wrong paths :( 

Share this post


Link to post
Share on other sites
Ken Roy

Michal,

My overrides in English-UTF8/cust_text.php appear to have work without my making any changes

 

Share this post


Link to post
Share on other sites
tngrlkrz
10 hours ago, mjaro said:

I'm attaching the mod version 13.0.3.4f, and wait for your feedback!

Michal,

Thanks for considering some suggested changes, and making nice improvements.  You already have my feedback via private emails yesterday.  One easy change I made to preserve some modifications to the header, was to switch from 'lifeYears'  to 'getYears'  (as in v4d and earlier) , but only in the tng_DrawHeading function in connection-forms and connections.

 

Share this post


Link to post
Share on other sites
mjaro
35 minutes ago, Ken Roy said:

Michal,

My overrides in English-UTF8/cust_text.php appear to have work without my making any changes

 

Have you replaced the line 70 with

include ($rootpath . "languages/English-UTF8/cust_text.php");

???

For me this way works in any language.

Share this post


Link to post
Share on other sites
Ken Roy
1 hour ago, mjaro said:

Have you replaced the line 70 with

include ($rootpath . "languages/English-UTF8/cust_text.php");

???

For me this way works in any language.

Michal,

I made to no changes to your code except for adding the following to my private mod that changed the colors to that of Template 20

%target:languages/English-UTF8/cust_text.php%

%location:%
//Mods should put their changes before this line, local changes should come after it.
%end:%

%insert:after%
$text['pri'] = "<span style='color:darkblue;'>&#9658;</span>&nbsp;"; #9733 big star, #9679 circle, #9658 right pointer
$text['fin'] = "&thinsp;<span style='color:darkblue;'>(&#9668;)</span>"; #9668 left pointer
%end:%

 

Edited by Ken Roy
corrected wording

Share this post


Link to post
Share on other sites
tngrlkrz

*deleted*

 

Share this post


Link to post
Share on other sites
mjaro
6 minutes ago, tngrlkrz said:

*deleted*

 

👍 I had enough time to test and start answering ;)

Share this post


Link to post
Share on other sites
klooster

Hi Mjaro,

I installed your  Search Connections mod Version 4F.

After changing line 220 in connections.php as you suggested:

---------------------------------------------------

if ($bi && strlen($bi)<25 ) :# bullet strings not empty, and not too long
into
if ($bi && strlen($bi)<1000 )  :# bullet strings not empty, and not too long

-----------------------------------------------------

and some custom css it works fine! see printscreen or see for yourself the full page here:  Example Connections Mod 4F

I love the end left arrow.

Suggestion: can you make the <1000 default in the definitive version?

PS: I did not need to replace the line 70 with include ($rootpath . "languages/English-UTF8/cust_text.php");

Schermafbeelding 2021-04-09 om 12.56.38.png

Share this post


Link to post
Share on other sites
mjaro
50 minutes ago, klooster said:

works fine! see printscreen

I'm glad you like my mod!

I'll put 1000 (or other big number) as you suggest. It was a paranoic safety checking if you don't ruin the page putting a long text or even some "sql injection" or so... But it can be changed by administrator only (neither a user nor url ) and thus such checking is unnecessary.

Have you seen Ron's experiments of using arrows in the diagram in place of non-directional  /\= ascii characters? (I checked also multiple other arrows but finally decided not to use them because they can look strange if converted by WordPress or -some cases- just by the iOS browser, and for me is not easy to select proper characters for every different environments).

Regards,

Michał

Share this post


Link to post
Share on other sites
tngrlkrz

Here's the arrows I am currently testing with Connections, along with a few other legend changes.  The purple color is from adaptation of the living color mod for living individuals. 2nd and 3rd images  cropped from the first.

image.png

 

image.png

 

image.png

Share this post


Link to post
Share on other sites
klooster

Hi Ron,

How did you implement the living color into the Connections Mod?

Share this post


Link to post
Share on other sites
tngrlkrz

Cees,

For my 'custom' site, I have living color changes included with other private changes.  But for a virgin TNG 13.03 site, the following worked in my testing.  The second and third lines (with hardcoded color) were necessary in the 'compact' diagram display, because the connections-lib  'shortname' function effectively disables the living color inserted by the Living Color mod in the 'getName' function.  Otherwise only the first line insertion is needed.  These changes could be in a mod.

With the Living Color Mod installed and with your desired living color set in Edit Options, and in the following lines, insert these 3 lines to connections.php (if  Connections v.4f is installed).

  • after ~line 3:  include("tng_begin.php");
  • $lc_flag = 1;
  • after ~line 80: $logname1 = shortname($row1);
  • if( $lc_flag && $row1['living'])$logname1 = "<span style=\"color: #7f03fd;\">$logname1</span>";
  • after line ~298: $lognameX = shortname($rowX);
  • if( $lc_flag && $rowX['living'])$lognameX = "<span style=\"color: #7f03fd;\">$lognameX</span>";    

Please note:  The tooltip for the living names will show the styling code; I haven't yet cleaning that up, likely with str_replace code.  For non-compact diagrams, for my site, I have disabled the tooltip since it is redundant with the box contents.  However, the textual description will be OK.

Lastly, as the Living Color mod article states, if you use the Relationship Display mod, it must be installed before Living Color.

 

 

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...

×