Can users share collections?

<< Can client and NP hosts b ...
Back to Portfolio FAQ index
Can I nest NP sites? ... >>

As at v7.0.4, formally the answer is no but read on...

It seems you may share but this may be by accident rather than design. The trick is to use a numbered session collection rather than a named collection. I discovered from black-box testing of NP that user A can see and amend a session collection created by user B; in fact they are visible to any (authorised) user of the site. This FAQ won't go into the background detail of session vs. named collections - read the NP manual for that info. Bear in mind that what follows is not formally documented and thus may change in forthcoming versions of NP.

The weak area to this is that there is no proper control mechanism for managing session collections; for instance, the NP API gives you methods to iterate named collections (including the user default '__GLOBAL__') but has no similar mechanism for sessions. So if you create session #123 you need to remember what/who it is for. With a named collection you can do this:
[in head NP code]
<%myCollections = CollectionSet.getNamedSetAll('catalog');%>
Your Collections are:<br>
<%for (i=0;i<myCollections.length;i++) {
  if (i===0) {%>
    1: [default]<br>
  <%} else {%>
    <%=(i+1)%>: <%=myCollections[i]%><br>
<% } %>

...but there's no equivalent CollectionSet.getSession([alias], [number]) or CollectionSet.getSessionAll() etc.

Note also that you can't get the intersect of a default/named collection and a session collection as you might expect - it seems NP will return either 'named' (including '__GLOBAL__') or 'session' collections - it seems they are different sets of collections (which ties in with the above results with getSetNamedAll(). Not tested yet, but I assume sessions, like named collections as persisted for the days set a server [sic] level.

You can show, add, delete (all) and archive as per a normal collection and first use of any of those commands with a session number argument will create the collection - it being empty unless the first call is an 'add'.

So you can have shared collections but tracking is a manual job for the site owner - i.e. he/she must know session #1267 = customer XYZ, etc.

If CollectionSet duplicated the name methods for session and added a few more, below, we'd be getting somewhere. I'd suggest these are added on to the NP API:
CollectionSet.getSession([alias], [number])
CollectionSet.addSession([alias], [number])
CollectionSet.removeSession([alias], [number])

CollectionSet.issueSession() would pass the next unused session number to allow 'blind' creation of sessions by users without needing to understand/access the API. A good example would be a normal collection with a send/share link, this would add the current collection to a session via Collection.copyToSession(number) or perhaps calling Collection.copyToSession() without a number would cause a new session to be issued. The number could then for example be:
- exposed to the user (or done so hidden in automatically created link or button
- a show URL emailed to another user

So, how does a user save a shared collection they might not know how to persist? I guess we also need...

The latter and its opposite could alternatively be at CollectionSet level with an additional 'alias' argument to set focus on the correct catalogue for the collection.fdb.

A simple example you can test. Insert your domain name in the first [dummy], site name in the second and a valid item ID in the third:
"http://[domain]/netpub/[site]&catalog=catalog&[Item ID]"

Now, from another computer open this:

You should see a single item, the one added with the first line of code. So you can share collections - you just lack the tools to do it!

Question: Can users share collections? [FAQ00119.htm]
Last Update:- 01 June 2006

<< Can client and NP hosts b ...
Back to Portfolio FAQ index
Can I nest NP sites? ... >>

Quick Search of PortfolioFAQ (word, words or phase): or try the Advanced Search

User-to-User Forums  |  Report error/typo/broken link  |  Request new topic  |  Ask a question

Site and articles © Mark Anderson 2001-2007 - Visit my home page

This FAQ is created and maintained using
Friday logo
Friday - The Automatic FAQ Maker