Recently I’ve been working on a user select quick search tool.

This allows contributors to search through the LDAP or Stellent users DB table and return the userID into a checkin meta field. (Tested in FF + ie6/7)

View the Demo!

Component to be released next week… in the mean time read on to find out how to create this easy to use component.


Creating the component.

Stage 1. – download required components

1. Download the Prototype js framework.
2. Download my EMc js class for Stellent.
3. Drop the files into ‘js’ folder within the weblayout folder on the server ie ‘c:/idcm1/weblayout/js/’ or ‘e:/inetpub/wwwroot/stellent/weblayout/js/’ – (you may need to create the js folder)
4. Download EMc css style sheet.
5. Drop the css into ‘css’ folder within the weblayout folder on the server.

Stage 2. – create custom component

1. Apply the prototype js framework to the resource “std”.
2. Apply EMc js class to resource “std” – Please check back for global updates!
3. Apply EMc css style sheet to resource “std” – Please check back for global updates!
4. Include Resource “std_edit_entry” and apply the id onto the input like this – id=”<$editEntryName$>”.

Stage 3. – create dynamic script (asp, jsp, .net)

1. You will need to create a dynamic script which will return JSON (JavaScript Object Notation).
Attached is an example asp page.

IMPORTANT: This dynamic file will have to sit on the same domain as stellent ie~: http://stellentserver/mydynamicscript.asp

There are 2 paramaters passed from the EMc class to the dynamic script.
user‘ and ‘type‘.

In the asp page I use ‘user’ as the search string and ‘type’ as the type of search the user has requested ie search by userid or fullname.

Here is an example of the JSON string that get the asp page to export:

http://localhost/dynamic/?user=sim&type=id

{“users”: [{
"userid": "UK\sim98j72",
"fullname": "John Sim"
},{
"userid": "UK\sim56k55",
"fullname": "Karen Simmons"
},{
"userid": "uk\sim41l69",
"fullname": "Landon Sims"
},{
"userid": "UK\sim88s20",
"fullname": "Simon Smith"
}]
}

2. Test out your dynamic script, it is important that you check the JSON structure is correct otherwise nothing will be returned in the dropdown user select list!!
If you are having problems you can use JSON classes from here.

Stage 4. – modify component

1. Go back to the component you have created.
2. include “std_checkin_submit_html” At the bottom of the resource include the following:
<script type=”text/javascript”>
EMc.app.searchUser(‘fieldId1‘);
EMc.app.searchUser(‘fieldId2‘);
</script>
Where fieldId1 & fieldId2 are the IDs of the meta fields that you require to put the user search on.
(You can add more or less as required.)

Stage 5. – Update EMc class with your dynamic url

1. Open up EMc js within the weblayout folder and search for ‘var url’. It should be in the searchUser function one of the first lines.
2. Enter the url to your dynamic script. ie var url = ‘/dynamic/userJSON.asp’;
(REMEMBER THIS SCRIPT HAS TO BE THE SAME DOMAIN AS STELLENT -
as javascript uses same domain policy)

Stage 6. – Save and enable the new component

1. If everything has gone to plan, you should now have a dynamic drop down list of users that are returned dependant on your query.

I will release a packaged component soon.

If you have any problems just drop me a msg..