Re: [greenstone-users] Remove Hierarchy Levels

From Michael Dewsnip
DateTue, 31 May 2005 11:06:57 +1200
Subject Re: [greenstone-users] Remove Hierarchy Levels
In-Reply-To (00df01c562b1$a8aef960$ccaffea9-IOTRemote2)
Hi Nathan,

>Yeah, I can do the perl side of things. Need to get back into it for
>another project anyways. Other than going to Perl, is there no way to
>see what's at the next level down within the format statements?
>
>
No, I don't think so (one problem is that there could be many children
of a node, not just one).

>I even tried doing something like:
>Value1|Value2|PRESET VALUE
>
>In this case, I would want Value2 to not have an icon beside it. Only
>problem is that I don't know I'm one level away from PRESET VALUE until
>I'm actually AT "PRESET VALUE", and by then it's too late. The other
>issue is that there's not a set amount of levels. I could have up to 4.
>
>
Yes. We've added functionality to the format statements on an "as
needed" basis, so I don't think we've ever needed to do anything like
this before.

>I'm assuming I'd have to modify the Hierarchy.pm file?
>
>
Yes, that's right. I had a quick look to give you some hints about where
to start, and then I had to try it just to make sure I wasn't going to
mislead you! In Hierarchy.pm, starting on line 261 there is:

# if this key has documents, add them
if (@doc_list) {
$has_content = 1;
foreach $d(@doc_list) {
push (@{$entry->{'contains'}}, {'OID'=>$d});
}
}

Since what (I think) you want is the hierarchy structure without the
documents, you can just comment out the loop that adds the documents:

# if this key has documents, add them
if (@doc_list) {
$has_content = 1;
# foreach $d(@doc_list) {
# push (@{$entry->{'contains'}}, {'OID'=>$d});
# }
}

If this does what you want then you should put this inside an if
statement and add a new option to prevent it from being executed. Search
for occurrences of "suppresslastlevel" to see what you need to add an
option.

Hope this helps,

Michael

>Thanks.
>
>-- Nathan
>
>-----Original Message-----
>From: greenstone-users-bounces@list.scms.waikato.ac.nz
>[mailto:greenstone-users-bounces@list.scms.waikato.ac.nz] On Behalf Of
>Michael Dewsnip
>Sent: Friday, May 27, 2005 12:55 AM
>To: Nathan Einwechter
>Cc: greenstone-users@list.scms.waikato.ac.nz
>Subject: Re: [greenstone-users] Remove Hierarchy Levels
>
>Hi Nathan,
>
>Hmmm... I can't think of any way of doing this without writing some code
>or editing the metadata. Unfortunately format statements don't seem to
>be powerful enough in this case, because you can't determine when you're
>at the last folder. I guess we've never considered building classifiers
>and not showing the documents!
>
>I don't think it would take too much work to add an option to the
>classifer to get the effect you're after. You'd need to know a bit of
>Perl and have some time to spare though.
>
>The low-tech solution is to split the metadata between two elements:
>"Value1|Value2" and "Value3", build the classifier on the first element,
>and display the second element's value for the documents (without the
>link). Whether this is feasible depends on how much metadata you've got,
>and what else you use this metadata value for.
>
>All the best,
>
>Michael
>
>
>
>Nathan Einwechter wrote:
>
>
>
>>I've got a number of hierarchies setup by placing
>>
>>Value1|value2|value3
>>
>>Into a specific metadata value. My issue is that I don't want the icon
>>to display on the final value (thus preventing us from getting down to
>>the last level which shows the document.) I can remove the document
>>name and icon no problem, but I want to get rid of that last bookshelf
>>as well to prevent people from clicking on it just to find an empty
>>next level.
>>
>>Anyone know how I might be able to do this?
>>
>>Thanks!
>>
>>-- Nathan
>>
>>-----------------------------------------------------------------------
>>
>>
>-
>
>
>>_______________________________________________
>>greenstone-users mailing list
>>greenstone-users@list.scms.waikato.ac.nz
>>https://list.scms.waikato.ac.nz/mailman/listinfo/greenstone-users
>>
>>
>>
>>
>
>
>_______________________________________________
>greenstone-users mailing list
>greenstone-users@list.scms.waikato.ac.nz
>https://list.scms.waikato.ac.nz/mailman/listinfo/greenstone-users
>
>
>
>