Mailing List Archive

wikinfo plugin and URL
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

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/VI1PR05MB6032DC97E5F8A1FE4670C7A7BDC19%40VI1PR05MB6032.eurprd05.prod.outlook.com.
Re: wikinfo plugin and URL [ In reply to ]
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 <jun66j5@gmail.com> (?? ?)

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/3da260f2-7ea1-e823-8c45-70687faeb48e%40gmail.com.