[greenstone-users] Classifier macros

From Belanger, Arthur
DateTue Oct 13 08:00:02 2009
Subject [greenstone-users] Classifier macros
Hi.

I am trying to find a way to test in a classifier format statement (e.g. CL2Vlist) which level the current node is in. I have used [numleafdocs] to determine whether the current node is a document or a node but that is insufficient.

The only way that I have figured out thus far is to parse _cgiargcl_.

Are there any macros that can be used to tell me where in the classifier list the current node is? That is, if _cgiargcl_ is CL2.3.10, the macro should tell me that I am at level 3 (or 2 depending on how you count). Similarly, if _cgiargcl_ is CL2.3, it should return 2 (or 1 dependiong on how you count). I haven't been able to identify such a macro.

So, I have written a javascript function to parse _cgiargcl_ and return the right number but I haven't been able to test against the value though I can display the value on the page. I have put the script in _pagescriptextra_ in the collection's extra.dm file. I call it in a macro (_Classifiernode_) but I can't test against it. I am not a javascript programmer so I am probably missing something rather simple.

Here is the javascript:

function CLfoot(CLstr) \{
var classnode = new String(CLstr);
var classifier = classnode.split(".");
document.write (classifier.length);
\}

Here is the macro:

_classifierNode_ {
<SCRIPT LANGUAGE="JavaScript" TYPE="TEXT/JAVASCRIPT">
CLnode("_cgiargcl_");
</SCRIPT>
}

My format statement includes:

{if}{_classifierNode_ == 2,Second Level,Third Level)
_classifierNode_

Thus, if _cgiargdl_ = CL2.4, _classifierNode should be 2 and "Second Level" should be displayed.
If _cgiargcl_ = CL2.4.7, _classifierNode_ should be 3 and "Third Level" should be displayed

The _classifierNode_ line does produce the correct number but it is not actually the value of the macro.

So, what I would like is to have _classifierNode_ be either 2 or 3 as:
_classifierNode_ {2} or _classifierNode_ {3}

I suspect that the document.write statement is not the proper way to pass a value back and/or Greenstone does not support such dynamically generated macros.

Any help would be greatly appreciated. Thanks.

Thanks.

Arthur Belanger
Medical Library System Manager
ITS Academic Media & Technology
Yale University
PO Box 208065
New Haven, CT 06520-8065

(203) 785-6928
(203) 737-2859, fax

mailto:Arthur.Belanger@Yale.Edu
http://www.yale.edu/its/about/amt
http://info.med.yale.edu/library


NOTE: Yale ITS will NEVER request passwords or other personal information via email. Messages requesting such information are fraudulent and should be deleted.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://list.scms.waikato.ac.nz/mailman/private/greenstone-users/attachments/20091012/dacf9055/attachment-0001.html