Simple Machines Community Forum

SMF Development => Feature Requests => Topic started by: davidhs on December 19, 2017, 01:18:02 PM

Title: Add url of copyright to credits tag in package-info.xml
Post by: davidhs on December 19, 2017, 01:18:02 PM
With SMF 2.1 Beta 1 was added credits tag :)
Code: [Select]
<credits url="..." license="..." copyright="..." title="..." />
And this was shown in credits page:
Code: [Select]
<a href="URL">TITLE OR MODNAME: MODVERSION</a> | LICENSE | COPYRIGHT

With SMF 2.1 Beta 3 was added url of license :D
Code: [Select]
<credits url="..." license="..." licenseurl="..." copyright="..." title="..." />
And this was shown in credits page:
Code: [Select]
<a href="URL">TITLE OR MODNAME: MODVERSION</a> | <a href="LICENSEURL">LICENSE</a> | COPYRIGHT

And now... can be added url of copyright?
Code: [Select]
<credits url="..." license="..." licenseurl="..." copyright="..." copyrighturl="..." title="..." />
And this will be shown in credits page:
Code: [Select]
<a href="URL">TITLE OR MODNAME: MODVERSION</a> | <a href="LICENSEURL">LICENSE</a> | <a href="COPYRIGHTURL">COPYRIGHT</a>

For example, I could add url to my mods https://custom.simplemachines.org/mods/index.php?action=search;author=242014 or another personal webpage.

This require to increase size of the field credits of table smf_log_packages in database (now is varchar(255)).
If my credits in package-info.xml is
Code: [Select]
<credits url="https://custom.simplemachines.org/mods/index.php?mod=2507" license="Creative Commons Attribution 3.0 Unported License" licenseurl="https://creativecommons.org/licenses/by/3.0/" copyright="2010-2017, davidhs" />
the content of field credits of table smf_log_packages is
Code: [Select]
{"url":"https:\/\/custom.simplemachines.org\/mods\/index.php?mod=2507","license":"Creative Commons Attribution 3.0 Unported License","licenseurl":"https:\/\/creativecommons.org\/licenses\/by\/3.0\/","copyright":"2010-2017, davidhs","title":""}
243 characters! And I do not use title... and my nick is small!
Title: Re: Add url of copyright to credits tag in package-info.xml
Post by: Suki on December 19, 2017, 01:25:32 PM
Yep, forgot about the length bit.  Tracked (https://github.com/SimpleMachines/SMF2.1/issues/4414). Thanks :)
Title: Re: Add url of copyright to credits tag in package-info.xml
Post by: albertlast on December 19, 2017, 02:33:49 PM
Changed the credit field from varchar to text,
please had in mind that you had to change this field manuel on your side(no update process availeble).
Title: Re: Add url of copyright to credits tag in package-info.xml
Post by: davidhs on December 19, 2017, 03:06:53 PM
Changed the credit field from varchar to text,
please had in mind that you had to change this field manuel on your side(no update process availeble).
Thanks! I do not use SMF 2.1 Beta in my forum (and I am not a beta tester), I only add support to 2.1 Beta in my own mods. ;)

And about url of copyright?
Title: Re: Add url of copyright to credits tag in package-info.xml
Post by: Suki on December 19, 2017, 04:35:48 PM
The license has a separate url type because I wanted to have a list of commonly used licenses, kinda like github has it, fetch them if no license url were provided and the license matches one in the list. Never got to do that, sadly.

That and because having a single "fit it all" copyright type offers mod authors some more freedom.
Title: Re: Add url of copyright to credits tag in package-info.xml
Post by: davidhs on April 05, 2019, 07:46:55 AM
I write here instead of in new topic because the main request of this topic is unsolved still. :(

[...] having a single "fit it all" copyright type offers mod authors some more freedom.
Ok, I am agree with this. Now SMF 2.1 RC1 and RC2 allows a longer text in copyright of credits but I can not add an url because copyright attribute of credits tag does not allow HTML/BBC tags. ??? Or maybe I do something wrong?

For example:
- I want add this credit:
Quote from: Credits page
Enhancements to purge inactive members: Versión 1.3.8 | License: Creative Commons Attribution 3.0 Unported License | Copyrights © 2010-2019, davidhs

- With only text (with no url :(, like SMF 2.1 Beta 2), works:
Code: (package-info.xml) [Select]
<credits url="https://custom.simplemachines.org/mods/index.php?mod=2569" license="Creative Commons Attribution 3.0 Unported License" licenseurl="https://creativecommons.org/licenses/by/3.0/" copyright="2010-2019, davidhs" />
Code: (Database (smf_log_packages.credits)) [Select]
{"url":"https:\/\/custom.simplemachines.org\/mods\/index.php?mod=2569","license":"Creative Commons Attribution 3.0 Unported License","licenseurl":"https:\/\/creativecommons.org\/licenses\/by\/3.0\/","copyright":"2010-2019, davidhs","title":""}
Quote from: Credits page
Enhancements to purge inactive members: Versión 1.3.8 | License: Creative Commons Attribution 3.0 Unported License | Copyrights © 2010-2019, davidhs

- With HTML does not work (show nothing):
Code: (package-info.xml) [Select]
<credits url="https://custom.simplemachines.org/mods/index.php?mod=2569" license="Creative Commons Attribution 3.0 Unported License" licenseurl="https://creativecommons.org/licenses/by/3.0/" copyright="2010-2019, <a href=https://custom.simplemachines.org/mods/index.php?action=search;author=242014>davidhs</a>" />
or
<credits url="https://custom.simplemachines.org/mods/index.php?mod=2569" license="Creative Commons Attribution 3.0 Unported License" licenseurl="https://creativecommons.org/licenses/by/3.0/" copyright="2010-2019, <a href='https://custom.simplemachines.org/mods/index.php?action=search;author=242014'>davidhs</a>" />
or
<credits url="https://custom.simplemachines.org/mods/index.php?mod=2569" license="Creative Commons Attribution 3.0 Unported License" licenseurl="https://creativecommons.org/licenses/by/3.0/" copyright="2010-2019, <a href=&quot;https://custom.simplemachines.org/mods/index.php?action=search;author=242014&quot;>davidhs</a>" />
Code: (Database (smf_log_packages.credits)) [Select]
{"url":"","license":"","licenseurl":"","copyright":"","title":""}
Quote from: Credits page
Enhancements to purge inactive members: Versión 1.3.8

- With all HTML entities does not work (show entities):
Code: (package-info.xml) [Select]
<credits url="https://custom.simplemachines.org/mods/index.php?mod=2569" license="Creative Commons Attribution 3.0 Unported License" licenseurl="https://creativecommons.org/licenses/by/3.0/" copyright="2010-2019, &lt;a href=&quot;https://custom.simplemachines.org/mods/index.php?action=search;author=242014&quot;&gt;davidhs&lt;/a&gt;" />
Code: (Database (smf_log_packages.credits)) [Select]
{"url":"https:\/\/custom.simplemachines.org\/mods\/index.php?mod=2569","license":"Creative Commons Attribution 3.0 Unported License","licenseurl":"https:\/\/creativecommons.org\/licenses\/by\/3.0\/","copyright":"2010-2019, &lt;a href=&quot;https:\/\/custom.simplemachines.org\/mods\/index.php?action=search;author=242014&quot;&gt;davidhs&lt;\/a&gt;","title":""}
Quote from: Credits page
Enhancements to purge inactive members: Versión 1.3.8 | License: Creative Commons Attribution 3.0 Unported License | Copyrights © 2010-2019, &lt;a href=&quot;https://custom.simplemachines.org/mods/index.php?action=search;author=242014&quot;&gt;davidhs&lt;/a&gt;

- With BBC does not work (show BBC without parse):
Code: (package-info.xml) [Select]
<credits url="https://custom.simplemachines.org/mods/index.php?mod=2569" license="Creative Commons Attribution 3.0 Unported License" licenseurl="https://creativecommons.org/licenses/by/3.0/" copyright="2010-2019, [url=https://custom.simplemachines.org/mods/index.php?action=search;author=242014]davidhs[/url]" />
Code: (Database (smf_log_packages.credits)) [Select]
{"url":"https:\/\/custom.simplemachines.org\/mods\/index.php?mod=2569","license":"Creative Commons Attribution 3.0 Unported License","licenseurl":"https:\/\/creativecommons.org\/licenses\/by\/3.0\/","copyright":"2010-2019, [url=https:\/\/custom.simplemachines.org\/mods\/index.php?action=search;author=242014]davidhs[\/url]","title":""}
Quote from: Credits page
Enhancements to purge inactive members: Versión 1.3.8 | License: Creative Commons Attribution 3.0 Unported License | Copyrights © 2010-2019, [url=https://custom.simplemachines.org/mods/index.php?action=search;author=242014]davidhs[/url]
Title: Re: Add url of copyright to credits tag in package-info.xml
Post by: vbgamer45 on April 05, 2019, 11:47:03 AM
Hmm I would think at least bbc should work.
If you think it is an issue I would file a github bug report.
Title: Re: Add url of copyright to credits tag in package-info.xml
Post by: Suki on April 05, 2019, 12:28:50 PM
https://github.com/SimpleMachines/SMF2.1/blob/release-2.1/Sources/Packages.php#L1018

Those are the tags you can use inside the credits node, heres an example:  https://github.com/MissAllSunday/OharaYouTubeEmbed/blob/master/package-info.xml#L22
Title: Re: Add url of copyright to credits tag in package-info.xml
Post by: davidhs on April 05, 2019, 01:06:12 PM
Hmm I would think at least bbc should work.
If you think it is an issue I would file a github bug report.
Yes, please. I tested several times (in RC1 and RC2) with the previous examples and it does not work.

Solution can be modify Source/Who.php file:
Code: (Search (line 854)) [Select]
<php?

$copyright = empty($credit_info['copyright']) ? '' : $txt['credits_copyright'] . ' © ' . $smcFunc['htmlspecialchars']($credit_info['copyright']);

?>
Code: (Replace by) [Select]
<php?

$copyright = empty($credit_info['copyright']) ? '' : $txt['credits_copyright'] . ' © ' . parse_bbc($smcFunc['htmlspecialchars']($credit_info['copyright']));

?>

But link of copyright is written as
Code: [Select]
...<a href="..." class="bbc_link" target="_blank" rel="noopener">...</a>...
instead of equal to other links of credits
Code: [Select]
...<a href="...">...</a>...
and all links on the credits page should have same style.



https://github.com/SimpleMachines/SMF2.1/blob/release-2.1/Sources/Packages.php#L1018

Those are the tags you can use inside the credits node, heres an example:  https://github.com/MissAllSunday/OharaYouTubeEmbed/blob/master/package-info.xml#L22
Ok, the syntax of credits tag is
Code: [Select]
<credits url="MOD_URL" license="LICENSE_TEXT" copyright="COPYRIGHT_TEXT" licenseurl="LICENSE_URL">TITLE</credits>
I know default TITLE is the mod name, but I did not know could write other TITLE between open-close tags. :)

But I want add url (with BBC or HTML) to COPYRIGHT_TEXT.
Title: Re: Add url of copyright to credits tag in package-info.xml
Post by: Kindred on April 05, 2019, 01:53:30 PM
I believe that may have purposefully been disallowed...

you get to specify the license URL and a URL for the mod...     
Title: Re: Add url of copyright to credits tag in package-info.xml
Post by: Suki on April 05, 2019, 06:10:28 PM
Yes, it was completely deliberated,  the credits node only allows two urls, one for the mod and another one for the license, this is to prevent link abuse.
Title: Re: Add url of copyright to credits tag in package-info.xml
Post by: Sesquipedalian on April 06, 2019, 09:34:52 AM
It may be worth noting that mods can also add copyright info using the integrate_credits hook, which allows more freedom to the mod author.