wikinfo plugin and URL

18 views
Skip to first unread message

Tony Brian Albers (XTOAL)

unread,
Jan 16, 2023, 3:41:28 PM1/16/23
to trac-...@googlegroups.com
Hi guys,

I finally managed to join this group(which is not so easy when you don't have a google account).

So, I'm using the wikinfo plugin to have a small table at the bottom of specific pages so that when they're exported to i.e. pdf, you can see what version of the trac page the pdf was made from.

The code looks like this:
{{{
||= Page info =|| ||
|| Page URL: || !https://tracker.jobjob.dk/si/wiki/BaseReplacement/svcs/sshd ||
|| Page version: || [[Wikinfo(version)]] ||
|| Page last changed by: || [[Wikinfo(changed_by)]] ||
|| Page last changed: || [[Wikinfo(changed_ts)]] ||
}}}

And that's all fine and dandy. However, I'd like to somehow auto-populate the URL row with the specific full URL of the page. Right now I have to do it manually, and that's quite annoying.

Does anyone know of a way to do this? (apart from adding the functionality to the plugin)

Thanks,

/tony

--
Tony Albers - SCSA, SCNA, EMCIE, EMCBA, RHCSA
Transition Manager - FIT/TMS Delivery Team - Signalling Integrations
Banedanmark, Signalling Systems
Carsten Niebuhrs Gade 43, 1577 Copenhagen V

Jun Omae

unread,
Jan 17, 2023, 2:20:03 AM1/17/23
to trac-...@googlegroups.com
Hi,

On 2023/01/16 22:24, 'Tony Brian Albers (XTOAL)' via Trac Users wrote:
> Hi guys,
>
> I finally managed to join this group(which is not so easy when you don't have a google account).
>
> So, I'm using the wikinfo plugin to have a small table at the bottom of specific pages so that when they're exported to i.e. pdf, you can see what version of the trac page the pdf was made from.
>
> The code looks like this:
> {{{
> ||= Page info =|| ||
> || Page URL: || !https://tracker.jobjob.dk/si/wiki/BaseReplacement/svcs/sshd ||
> || Page version: || [[Wikinfo(version)]] ||
> || Page last changed by: || [[Wikinfo(changed_by)]] ||
> || Page last changed: || [[Wikinfo(changed_ts)]] ||
> }}}
>
> And that's all fine and dandy. However, I'd like to somehow auto-populate the URL row with the specific full URL of the page. Right now I have to do it manually, and that's quite annoying.
>
> Does anyone know of a way to do this? (apart from adding the functionality to the plugin)

One of solutions is to add the contents using /wiki_render by javascript on
loading wiki pages, and add the javascript to site_footer.html template.

Example: $ENV/templates/site_footer.html
==========
# if page and not action:
<script>
jQuery(function($) {
if ($('#wikipage').length == 0 || $('.trac-modifiedby').length == 0)
return;
var url = ${to_json(req.href('wiki_render'))|safe};
var text = [
'||= Page info =||= ||',
'|| Page URL: || ' + ${to_json(abs_url_of(page.resource))|safe} + ' ||',
'|| Page version: || [[Wikinfo(version)]] ||',
'|| Page last changed by: || [[Wikinfo(changed_by)]] ||',
'|| Page last changed: || [[Wikinfo(changed_ts)]] ||',
''];
var data = {realm: 'wiki', id: ${to_json(page.name)|safe},
text: text.join('\n'),
__FORM_TOKEN: ${to_json(req.form_token)|safe}};
$.post(url, data, function(response) {
var element = $('<div>').html(response);
$('.trac-modifiedby').before(element);
});
});
</script>
# endif
==========

--
Jun Omae <jun...@gmail.com> (大前 潤)

Kris Deugau

unread,
Jan 17, 2023, 2:36:21 PM1/17/23
to trac-...@googlegroups.com
'Tony Brian Albers (XTOAL)' via Trac Users wrote:
> I finally managed to join this group(which is not so easy when you don't have a google account).

Expect unsubscribing to be worse, if and when the time comes.

I've seen a trickle of groups created for spam (there's no way certain
role addresses could have legitimately subscribed, especially without a
Google account), and it's functionally impossible to either unsubscribe
OR report the group for abuse, at least for those groups, without going
down the rabbit hole of creating a Google account for the address.

-kgd
Reply all
Reply to author
Forward
0 new messages