[GeoNetwork-devel] Angular JS whitelist

Hi All,

We've been doing some work for a GeoNetwork 3.10 customer to add
tracking links to related URLs in metadata records. I'm adding a class
and an id attribute to all related record URLs, where the id relates
to the type of link being clicked on. This works fine for links like
wms or wfs, as I can adjust the html code directly in (eg) en-search
json, https://github.com/geonetwork/core-geonetwork/blob/3.10.x/web-ui/src/main/resources/catalog/locales/en-search.json#L60

However for generic links the code is handled directly in
https://github.com/geonetwork/core-geonetwork/blob/3.10.x/web-ui/src/main/resources/catalog/components/metadataactions/partials/related.html#L176

I can pass linky a class and an id, using the form:

<span ng-bind-html="r.url | gnLocalized: lang |
linky:'_blank':{class:'relatedURL',id:'generic'}"></span>

However the id is not passed through. Having done some research this
appears to be fixed in a later version of AngularJS, but also possible
in earlier versions by adding the id to the Angular whitelist (see
https://github.com/textAngular/textAngular/issues/355). I don't know
which version of AngularJS we're using in GeoNetwork though.

Does this seem like the correct approach to you or is there a method
that doesn't involve making this change?

Is this the correct place to add it:
https://github.com/geonetwork/core-geonetwork/blob/3.10.x/web-ui/src/main/resources/catalog/lib/angular/angular-sanitize.js#L264

Are there likely to be any problems with adding it there?

Thanks

Jo

--
Jo Cook
t:+44 7930 524 155/twitter:@archaeogeek
Please note that currently I do not work on Friday afternoons. For
urgent responses at that time, please visit
support.astuntechnology.com or phone our office on 01372 744009

--
--
*Sign up to our mailing list
<https://astuntechnology.com/company/#email-updates&gt; for updates on news,
products, conferences, events and training*
*
*

Astun Technology Ltd,
Epsom Square Centre, 6-7 The Derby Square, Epsom, Surrey, KT19 8AG, UK

t:+44 1372 744 009 w: astuntechnology.com <http://astuntechnology.com/&gt;
twitter:@astuntech <https://twitter.com/astuntech&gt;

iShare - enterprise
geographic intelligence platform <https://astuntechnology.com/ishare/&gt;

GeoServer, PostGIS and QGIS training
<https://astuntechnology.com/training-courses/&gt;
Helpdesk and customer
portal
<https://astuntech.atlassian.net/wiki/spaces/ISHAREHELP/pages/364970043/Astun+Technology+Support+Portal&gt;

Company registration no. 5410695. Registered in England and Wales.
Registered office: 120 Manor Green Road, Epsom, Surrey, KT19 8LN VAT no.
864201149.

Hi Jo

GeoNetwork is using AngularJs 1.5.2, Probably should work the change you indicate, but requires to check if can cause any security issues.

Regards,
Jose García

···

Vriendelijke groeten / Kind regards,

Jose García


Veenderweg 13
6721 WD Bennekom
The Netherlands
T: +31 (0)318 416664

Please consider the environment before printing this email.

Hi Jose,

I’ve tried it but it doesn’t seem to get through to the page, even in debug mode and having reloaded the cache (I can see the change in the javascript file though). Maybe I’m doing something wrong anyhow?

Jo

···

Jo Cook
t:+44 7930 524 155/twitter:@archaeogeek
Please note that currently I do not work on Friday afternoons. For urgent responses at that time, please visit support.astuntechnology.com or phone our office on 01372 744009

Hi Jo

I would debug this code to check if enters there for the id attribute:

https://github.com/geonetwork/core-geonetwork/blob/3.10.x/web-ui/src/main/resources/catalog/lib/angular/angular-sanitize.js#L452

Regards,
Jose García

···

Vriendelijke groeten / Kind regards,

Jose García


Veenderweg 13
6721 WD Bennekom
The Netherlands
T: +31 (0)318 416664

Please consider the environment before printing this email.

Hi Jose,

It all works OK when I am in debug mode, and I can use a console.log statement and see that it’s passed through, but I assume my changes are not being included in the minified js. Do I need to delete the minified file in order to get it re-generated- I don’t think using the clear cache options in the admin console is doing it.

Thanks

Jo

···

Jo Cook
t:+44 7930 524 155/twitter:@archaeogeek
Please note that currently I do not work on Friday afternoons. For urgent responses at that time, please visit support.astuntechnology.com or phone our office on 01372 744009

Hi Jo,

Clear the cache in the admin console should trigger a new build of the javascript. So it will take your changes, if you have done them directly on the server.
Cheers

···

camptocamp
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

Florent Gravin
Technical Leader - Architect
+33 4 58 48 20 36