Re: [greenstone-users] Displaying multiple metadata values individually?

From Chaitra Rao
DateWed, 17 Aug 2005 19:30:52 +0530 (IST)
Subject Re: [greenstone-users] Displaying multiple metadata values individually?
In-Reply-To (41F94E93-40308-atp-rub-de)
Hi Axel,
I tried out your solution. It doesn't seem to be working fine for me. I
think there's something I've missed out.
First, I used the format stattement options wit the relevant metadata
names (I've created my own metadata set). Next, I edited the document.dm
file and inserted the following lines("cropsample" is the coll name):

_textheader_ [c=cropsample] {
GSDL Error
<center>
<table width=537><tr><td align=right>
_icontab__javalinks_</td></tr></table>
</center>
}

After that I placed the above lines in extra.dm and also the
foll javascript:
### Self-made Javascript functions
{
function ExtractCommNames() {
var res;
a = CommName.outerText.split(";");
resolver = a[0]+ "&q=";
b = a[1].split("+%3b+");
c = a[2].split("_");
res = "";
for (i = 0; i < b.length ;i++)
{
res = res + "<a href=" + resolver + b[i]+ "&h=daa&t=1>" + c[i] +
"&w=utf-8" +"</a><br/>";
}
CommName.outerHTML = res;
}

After I built the collection, I can see the long url but no hyperlink,
which I guess the javascript is supposed to generate. I think there's some
mistake somewhere. It'll be nice if you can help me :) Let me know if you
want more details about the collection.

Thanks and Regards,
Chaitra

On Thu, 27 Jan 2005, schild wrote:

> Hi everyone again,
>
> I figured out a way how to solve the problem myself by now. It is maybe
> a quick and dirty solution, but it works by using simple Javascript
> functions. For the ones that are interested and want to do the same
> thing as me: here is how I did it:
>
> The inital problem first again: Instead of displaying an html version of
> the documents of my collection, I display a bibliographical record of
> all the assigned metadata elements. The values of these metadata
> elements are hyperlinked, such that clicking on a string starts a search
> query for this value in the corresponding index across the whole
> collection. An example to clarify the problem: all of my documetns have
> authors assigned as metadata. When clicking on the display document
> button the mentioned bibliographic record for that specific document
> appears. Imagine this document has two authors, "A" and "B". Clicking on
> the hyperlinked "A" string of the bib. record will execute a search
> across the whole document collection for "A" in the "author" index. The
> produced and displayed search results include all other documents
> created by "A".
> The problem with multiple assigned metadata values (e.g. multiple
> authors) is that you can either access the complete string (all values)
> or just the first one. If you use the statement [siblings(All";
> ")dc.creator], it will return a string off all values, with each value
> separated by a semicolon (in the example this produces the string "A;
> B"). On the contrary [dc.creator] only displays the first value (which
> is "A"). For a hyperlink connect to each value individually you can do
> the following (this is how I did it)
>
> Use the format string below in the collect.cfg file (for my collection I
> put this string in "format DocumentText" statement)
>
> {If}{[dc.Creator],
> <tr>
> <td align=right valign=top><b>Authors:</b></td>
> <td align=left valign=bottom><label name=AuthorField id=AuthorField>
> /gsdlmod?e=d-00000-00---off-0gsarch--00-0----0-10-0---0---0direct-10---4-----dfr--0-1l--11-en-50---20-about-Laurent+Birba--00-0-1-00-0--4----0-0-11-10-0utfZz-8-00&a=q;[cgisafe:sibling(All:' ;
> '):dc.Creator];[sibling(All:'_'):dc.Creator]</label></td>
> </tr>}
>
> Notice, that statement includes a label definition with the name
> "AuthorField". "/gsdlmod?e=d-00000-00---off-0gsarch--00-0----0-10-0---0---0direct-10---4-----dfr--0-1l--11-en-50---20-about-Laurent+Birba--00-0-1-00-0--4----0-0-11-10-0utfZz-8-00&a=q" is a macro which resolves into the
> http-address of query page of the collection. "[cgisafe:sibling(All:' ;
> '):dc.Creator]" will be evaluated to the string as mentioned above with
> the exception, that cgisafe is a cgiscript, which will replace all
> special characters with UTF-8 encoding, such that it can be used within
> a web address. [sibling(All:'_'):dc.Creator] produces a similar string
> without replaced special characters. Notice the different separation
> symbols, these are needed later on.
>
> Additional changes have to be made in order to make this whole thing
> work. You further need to change the GSDL Error

or _textheader_ macro in
> the package of the page, the format string will be displayed in (in my
> case the document package). The change is that _htmlhead has to be
> parametrized with
>
> GSDL Error , where ExtractAuthors(); is a
> Javascipt function, which is called on loading the corresponding page
> (the document display page). Since you do not want to mess in the
> standard macro files, create your one extra.dm file and override the
> chosen macro with a collection specific macro. In my example this is
> done by the code sequence
>
> package document
>
> ###document display
>
> ###HTML-Page Header
> _textheader_ [c=exacol] {
> GSDL Error
> <center>
> <table width=537><tr><td align=right>
> _icontab__javalinks_</td></tr></table>
> </center>
> }
>
> Now all that is missing is the Javascript function which has to be
> included into the macro of the same package. Copy this
> macro out of the corresponding standard macro file and paste it into
> your extra.dm file. Make the neccessary modification which is in my case
>
> ### Self-made Javascript functions
> {
> function ExtractAuthors() {
> var res;
> a = AuthorField.outerText.split(";");
> resolver = a[0]+"&q=";
> b = a[1].split("+%3b+");
> c = a[2].split("_");
> res = "";
> for (i = 0; i < b.length ;i++)
> {
> res = res + "<a href=" + resolver + b[i]+ "&h=dd0&t=0>" + c[i] +
> "</a><br/>";
> }
> AuthorField.outerHTML = res;
> }
>
> You see the included Javascript function, which evaluates the string of
> the defined label, splits it into serveral strings and composes a string
> out of thoses values, which is then set to the "outerHTML" element of
> the label. This will actually work (believe it or not!). As I said, it
> is probably not the most efficient and the cleanest way of achieve this
> functionality, but who cares.
>
> Well, time to leave
>
> Axel Schild
>
>
> schild schrieb:
>
> > Hi everyone,
> >
> > I am fairly new to the Greenstone community, so I do not know whether
> > this question has been asked before... (although I did some extensive
> > research on the postings in the mailing list). I am in the process of
> > constructing my first Greenstone demo collection. At the moment I am
> > trying to figure out some customizing features of the software and ran
> > across the following problem:
> >
> > I assigned multiple values to various metadata fields, as for instance
> > "dc.creator". Now I found out from the FAQ section that it is possible
> > to display the first entry using just [dc.creator] or all of them
> > using [(sibling(All):dc.creator]. I wonder whether it is possible to
> > display all of them individually. The reason for me wanting to do this
> > is the following:
> >
> > In my collection I would like to display a bibliographical record of
> > each document first, in which metadata elements hyperlinked.
> > It should be possible to initiate a search for other documents of a
> > specific author, by just clicking on the authors name, that is
> > displayed in the bibliographical record. An example is for this is
> > given below
> >
> > *Creator:* E. Kerrigan
> > A. Bemporad
> > D. Mignone
> > M. Morari
> > J. Maciejowski
> > <gsdl?e=d-0-00-hyconexa--00-0-0--0prompt-10---4------0-1l--1-en-50---20-about---00031-001-1-0utfZz-8-00&a=q&q=E%2e+KerriganA%2e+BemporadD%2e+MignoneM%2e+MorariJ%2e+Maciejowski&h=dd0&t=1>
> >
> > *Rights:* Public
> >
> >
> > Does anyone know a solution to my problem (basically how to access
> > metadata field individually)?
> >
> > Thanks in advance and keep up the outstanding development of
> > Greenstone :-),
> >
> > Axel Schild
> >
> >
>
>
> --
> ----------------------------------------------
>
> Dipl.-Ing. Axel Schild
> Automatisierungstechnik und Prozessinformatik
> Ruhr-Universitaet Bochum IC-3/151
> D-44780 Bochum, Germany
>
> Tel: +49 234 32 25203
> Fax: +49 234 32 14101
> E-mail: schild@atp.rub.de
>
>
> _______________________________________________
> greenstone-users mailing list
> greenstone-users@list.scms.waikato.ac.nz
> https://list.scms.waikato.ac.nz/mailman/listinfo/greenstone-users
>