[EP-tech] Re: Using a user metafield to control eprint workflow

John Salter J.Salter at leeds.ac.uk
Thu Oct 4 10:33:47 BST 2012


Thanks for the suggestion - I couldn't see any mention of it on http://wiki.eprints.org/w/EPScript :o\, so I did a bit more digging and have the answer :o)
Your suggestion results in
<option value="ARRAY(0x7f5a5b5e3e60)">["collections_typename_ARRAY(0x7f5a5b5e3e60)" not defined]</option>

The solution is to use 'join' (also not covered in the EPScript page): 
<component><field ref="collection" options="{join($item{userid}.as_item(){collection},',')}"/></component>

There's a wealth of undocumented functions in  ~/perl_lib/EPrints/Script/Compiled.pm (I think some are kind-of documented in the version release notes - but that's not where I think of looking for these things).

I've added a note to the top of the EPScript page...

Cheers,
John

-----Original Message-----
From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of Florian Heß
Sent: 04 October 2012 08:20
To: eprints-tech at ecs.soton.ac.uk
Subject: [EP-tech] Re: Using a user metafield to control eprint workflow

Am 03.10.2012 17:30, schrieb John Salter:
> So, I've got  bit further with this, but still not quite there...
> In the workflow, I can get the *rendered* values into a select box using the following:
>    <component><field ref="collection" options="{$current_user{collection}}"/></component>
> -or-
>    <component><field ref="collection" options="{$item{userid}.as_item(){collection}}"/></component>

Just a notion: Try $current_user{collection}.as_string()
Method as_string() has got me the id before.

Kind regards,
F Heß

> (first one gets current user's collections, second one gets user-that-owns-the-eprint's collections)
> Which results in:
> <option value="">UNSPECIFIED</option>
> <option value="Collection 1">["collections_typename_Collection 1" not defined]</option>
> <option value="Collection 3">["collections_typename_Collection 3" not defined]</option>
>   - the value should be e.g. "collection1", not "Collection 1".
>
> Is there a trick with EPScript to get the value of the namedset, rather than the rendered-value?
>
> Cheers,
> John
>
> -----Original Message-----
> From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of John Salter
> Sent: 02 October 2012 16:02
> To: 'eprints-tech at ecs.soton.ac.uk'
> Subject: [EP-tech] Using a user metafield to control eprint workflow
>
> In our archive, we have a namedset for 'collections':
> collection1
> collection2
> collection3
> ...
>
> This is used in an eprint to show which primary collection an item belongs to.
> I also want to use the same namedset in the user configuration to control which collections someone can deposit into:
> E.g. User has 'collection1' and 'collection3' selected in their profile, the first stage of the eprint workflow would be:
> Which collection?
> [] Collection 1
> [] Collection 3
>
> If a user only has access to one collection, this stage is skipped (as the field is set in the eprint_defaults.pl file).
>
> What is the best way to control the options available in the workflow based on the depositing user?
> It's similar to the 'user_review_scope.pl' - but at the depositing end of the process...
>
> I'm probably overlooking something very simple!
>
> Cheers,
> john
>
> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: http://www.eprints.org/tech.php/
> *** EPrints community wiki: http://wiki.eprints.org/
>
> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: http://www.eprints.org/tech.php/
> *** EPrints community wiki: http://wiki.eprints.org/
>


-- 
UB Heidelberg (Altstadt)
Plöck 107-109, 69117 HD
- Informationstechnik
- WWW-Redaktion
Tel. 06221 / 54 3550
http://www.ub.uni-heidelberg.de/

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/



More information about the Eprints-tech mailing list