Re: [greenstone-users] How to use /cgi-bin/library?e=d-00000-00---off-0gsarch--00-0----0-10-0---0---0direct-10---4-----dfr--0-1l--11-en-50---20-about-alice--00-0-21-00-0-0-11----0-0-&a=q and ifl argument in format DocumentText

From Katherine Don
DateTue, 15 Aug 2006 14:36:13 +1200
Subject Re: [greenstone-users] How to use /cgi-bin/library?e=d-00000-00---off-0gsarch--00-0----0-10-0---0---0direct-10---4-----dfr--0-1l--11-en-50---20-about-alice--00-0-21-00-0-0-11----0-0-&a=q and ifl argument in format DocumentText
In-Reply-To (44D389C8-3050803-inwind-it)
Hi Ruben

There is a bug in 2.70w which menat that the ifl functionality was
broken. If you can compile the C++ code, then you can fix it (see
below), otherwise it will be fixed in the next release.

Regards,
Katherine

Fix:

in queryaction.cpp, look for the code
if (err == noError && !args["ifl"].empty()) {
// Go directly to the first matching document
ResultDocInfo_tarray::iterator thissection = response.docInfo.begin();
if (thissection != response.docInfo.end()) {
text_t& arg_d = (*thissection).OID;
text_t doc_url = "/cgi-bin/library?e=d-00000-00---off-0gsarch--00-0----0-10-0---0---0direct-10---4-----dfr--0-1l--11-en-50---20-about-alice--00-0-21-00-0-0-11----0-0-&a=d";
doc_url += "&c=" + collection;
doc_url += "&d=" + arg_d;

// location response (url may contain macros!!)
textout << outconvert << disp << "Location: " << doc_url << " ";
}

Change this to

if (err == noError && !args["ifl"].empty()) {
// Go directly to the first matching document
ResultDocInfo_tarray::iterator thissection = response.docInfo.begin();
if (thissection != response.docInfo.end()) {
// This URL must have "&" and not "&amp;"!
text_t doc_url = "/cgi-bin/library?e=d-00000-00---off-0gsarch--00-0----0-10-0---0---0direct-10---4-----dfr--0-1l--11-en-50---20-about-alice--00-0-21-00-0-0-11----0-0-&a=d&c=" + collection +
"&d=" + (*thissection).OID;

// location response (url may contain macros!!)
textout << outconvert << disp << "Location: " << doc_url << " ";
}

and recompile.

ruben pandolfi wrote:
>
> Thank you Michael,
>
> Michael Dewsnip ha scritto:
>
>
>>
>> /cgi-bin/library?e=d-00000-00---off-0gsarch--00-0----0-10-0---0---0direct-10---4-----dfr--0-1l--11-en-50---20-about-alice--00-0-21-00-0-0-11----0-0-&a=q&q=[dc.ModsRecordInfoRecordIdentifi]
>>
>> instead of
>>
>> /cgi-bin/library?e=d-00000-00---off-0gsarch--00-0----0-10-0---0---0direct-10---4-----dfr--0-1l--11-en-50---20-about-alice--00-0-21-00-0-0-11----0-0-&a=q=[dc.ModsRecordInfoRecordIdentifi]
>>
>>> 2) I would like to add ifl argument to go directly to the first record
>>> found , is this possible from format DocumentText?
>>
>>
>> The "&ifl=1" is an argument to the query action, so it can go into an
>> "/cgi-bin/library?e=d-00000-00---off-0gsarch--00-0----0-10-0---0---0direct-10---4-----dfr--0-1l--11-en-50---20-about-alice--00-0-21-00-0-0-11----0-0-&a=q" link.
>
>
>
>
> I almost resolved the query problem, but still can not get &ifl=1 to
> work. It looks OK , since I do not have errors, but simply output the
> search result and does not go to record directly.
>
> This is what I have:
>
>
> {If}{[dc.ModsExtensionHasTranslation^a], <tr><td
> valign=top><b>_Ht_:</b></td><td valign=top>
> <a
> href=\"/cgi-bin/library?e=d-00000-00---off-0gsarch--00-0----0-10-0---0---0direct-10---4-----dfr--0-1l--11-en-50---20-about-alice--00-0-21-00-0-0-11----0-0-&a=q&q=[dc.ModsExtensionHasTranslation^z]&fqf=DI&t=0&qt=0&ifl=1\">
>
> [dc.ModsExtensionHasTranslation^a]</a></td></tr>}
>
>
>
> dc.ModsExtensionHasTranslation^z contains ISBN unique identifier, and I
> make a simple search in the ISBN index. It works and give me the only
> possible result, but I would like to skip the search page and go
> directly to the document. &ifl=1 should be the perfect argument to do
> so, but is not ... you might have a try here:
>
> http://www02.unibg.it/~morin/gsdl/cgi-bin/library?a=q&r=1&hs=1&e=q-000-00---0babel3--00-1-0--0prompt-10-DN--4------0-1l--1-en-50---20-preferences-890--00031-001-0-0utfZz-8-00&fqf=DN&t=0&q=ISBN+88-88-8888-8&ifl=1
>
>
>
> that gives me the same output as:
>
> http://www02.unibg.it/~morin/gsdl/cgi-bin/library?a=q&r=1&hs=1&e=q-000-00---0babel3--00-1-0--0prompt-10-DN--4------0-1l--1-en-50---20-preferences-890--00031-001-0-0utfZz-8-00&fqf=DN&t=0&q=ISBN+88-88-8888-8
>
>
>
> 2) I have some fields that have repeatable pairs of values, and I have
> worked it out like this:
>
>
> {If}{[sibling(2):dc.ModsExtensionHasTranslation^a], <tr><td
> valign=top></td><td valign=top>
> <a
> href=\"/cgi-bin/library?e=d-00000-00---off-0gsarch--00-0----0-10-0---0---0direct-10---4-----dfr--0-1l--11-en-50---20-about-alice--00-0-21-00-0-0-11----0-0-&a=q&q=[sibling(2):dc.ModsExtensionHasTranslation^z]&fqf=DI&t=0&qt=0&ifl=1\">[sibling(2):dc.ModsExtensionHasTranslation^a]</a></td></tr>}
>
> {If}{[sibling(3):dc.ModsExtensionHasTranslation^a], <tr><td
> valign=top></td><td valign=top>
> <a
> href=\"/cgi-bin/library?e=d-00000-00---off-0gsarch--00-0----0-10-0---0---0direct-10---4-----dfr--0-1l--11-en-50---20-about-alice--00-0-21-00-0-0-11----0-0-&a=q&q=[sibling(3):dc.ModsExtensionHasTranslation^z]&fqf=DI&t=0&qt=0&ifl=1\">[sibling(3):dc.ModsExtensionHasTranslation^a]</a></td></tr>}
>
>
>
> It is a solutions, but surely not the best, since I can not determine
> how many times the field repeat, and the code is a bit bloated ...
>
>
> I've seen the Axel Schild method here:
>
> http://greenstone.sourceforge.net/wiki/index.php/Customizing_collections#How_can_I_hyperlink_individual_metadata_elements.3F
>
>
> and I might need something similar. I have tried implementing it but
> without success, since my javascript is quite poor.
>
>
> I have copied the code in format DocumentText and I have just inserted
> this in my extra.dm file:
>
>
>
> -------------------------------
> -------------------------------
> package Style
> -------------------------------
>
> ### 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;
> }
> onload="ExtractSubjects();ExtractAuthors();"
> }
>
>
> -------------------------------
>
> But it does not work.
>
> I do not really understand what I'm doing, but I just took a javascript
> manual and get back in two days :-) !
>
> My idea is to write a generic function, put it in an external javascript
> file and use it for everytime I have a repeatable metadata that need to
> be linked.
>
> Meanwhile, if you can give some help, I would appreciate,....
>
>
>> Was it this collection:
>> http://www.aladin.wrlc.org/gsdl/collect/treasure/treasure.shtml?
>>
>
> It was, thanks again!
>
> Ruben
>
>
> _______________________________________________
> greenstone-users mailing list
> greenstone-users@list.scms.waikato.ac.nz
> https://list.scms.waikato.ac.nz/mailman/listinfo/greenstone-users
>
>