Dear all,
I have added a new field to advanced search called "topics" by adding some codes to searchcontroller.js, lucene.xsl and searchForm.html. It works fine but I want to also add a drop down list of topics to this field same as the keyword and Contact for the resource fields in advanced search. These drop down menu options are defined in searchcontroller.js for advanced search fields. However I do not know how to make this drop down list (topicCatoptions) for topic category? Should I define a for loop on codelists.xml elements in my searchcontroller.js javascript file? How?
Best,
Samin
Hi,
Add here a section to load topiccats:
https://github.com/geonetwork/core-geonetwork/blob/develop/web/src/main/webapp/xslt/base-layout-cssjs-loader.xsl#L196
gnSearchSettings.gnStores = {
'topicCat': [['', '<xsl:value-of select="/root/gui/strings/any"/>']<xsl:
apply-templates select="
/root/gui/schemas/iso19139/codelists/codelist[@name='gmd:MD_TopicCategoryCode']/entry
" mode="js-translations-topicCat"/>]
};
Then in your controller something like
// data store for topic category
if (gnSearchSettings.gnStores) {
var topicCats = gnSearchSettings.gnStores.topicCat;
angular.forEach(topicCats, function(cat, i) {
topicCats[i] = {
id: cat[0],
name: cat[1],
hierarchy: cat[0].indexOf('_') > 0 ? 'second' : 'main'
};
});
$scope.topicCatsOptions = {
mode: 'local',
data: topicCats,
config: {
templates: {
suggestion: Handlebars.compile(
'<p class="topiccat-{{hierarchy}}">{{name}}</p>')
}
}
};
}
Cheers,
On Mon, May 22, 2017 at 12:50 PM, Samin Payrosangari <s6sapayr@anonymised.com>
wrote:
Dear all,
I have added a new field to advanced search called
"topics" by adding some codes to searchcontroller.js,
lucene.xsl and searchForm.html. It works fine but I want
to also add a drop down list of topics to this field same
as the keyword and Contact for the resource fields in
advanced search. These drop down menu options are defined
in searchcontroller.js for advanced search fields. However
I do not know how to make this drop down list
(topicCatoptions) for topic category? Should I define a
for loop on codelists.xml elements in my
searchcontroller.js javascript file? How?
Best,
Samin
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
geonetwork-users List Signup and Options
GeoNetwork OpenSource is maintained at http://sourceforge.net/
projects/geonetwork
--
*camptocamp*
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS
*Florent Gravin*
0479444492
Hi,
It does not still work. Actually, I found out that it does not enter the if statement at the beginning. It seems that there is a problem with gnSearchSettings.gnStores which is added to base-layout-cssjs-loader.xsl. By the way, I am using Geonetwork 3.2.1. Any Idea ?
Best,
Samin
On Mon, 22 May 2017 13:01:22 +0200
Florent Gravin <florent.gravin@anonymised.com> wrote:
Hi,
Add here a section to load topiccats:
https://github.com/geonetwork/core-geonetwork/blob/develop/web/src/main/webapp/xslt/base-layout-cssjs-loader.xsl#L196
gnSearchSettings.gnStores = {
'topicCat': [['', '<xsl:value-of select="/root/gui/strings/any"/>']<xsl:
apply-templates select="
/root/gui/schemas/iso19139/codelists/codelist[@name='gmd:MD_TopicCategoryCode']/entry
" mode="js-translations-topicCat"/>]
};
Then in your controller something like
// data store for topic category
if (gnSearchSettings.gnStores) {
var topicCats = gnSearchSettings.gnStores.topicCat;
angular.forEach(topicCats, function(cat, i) {
topicCats[i] = {
id: cat[0],
name: cat[1],
hierarchy: cat[0].indexOf('_') > 0 ? 'second' : 'main'
};
});
$scope.topicCatsOptions = {
mode: 'local',
data: topicCats,
config: {
templates: {
suggestion: Handlebars.compile(
'<p class="topiccat-{{hierarchy}}">{{name}}</p>')
}
};
}
Cheers,
On Mon, May 22, 2017 at 12:50 PM, Samin Payrosangari <s6sapayr@anonymised.com>
wrote:
Dear all,
I have added a new field to advanced search called
"topics" by adding some codes to searchcontroller.js,
lucene.xsl and searchForm.html. It works fine but I want
to also add a drop down list of topics to this field same
as the keyword and Contact for the resource fields in
advanced search. These drop down menu options are defined
in searchcontroller.js for advanced search fields. However
I do not know how to make this drop down list
(topicCatoptions) for topic category? Should I define a
for loop on codelists.xml elements in my
searchcontroller.js javascript file? How?
Best,
Samin
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at http://sourceforge.net/
projects/geonetwork
--
*camptocamp*
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS
*Florent Gravin*
0479444492