We have an insurance customer, who required a contracr repository. WSS 3.0
fits on their base requirements, but they had some special needs as well: First
of all, at the end of contracts' lifecycle, after signing them, we have to save
several attachments, for example scanned copies or some appendixes. In one word,
every contracts contain a main document and some attached documents, so we need
document libraries with ability to attach files to documents. The second special
need is a custom field, which manages the contract elements' permissions.
Document library with ability to attach files
In WSS 3.0 we don't have any out-of-the-box feature to manage attachments in
document libraries, so we have a little trick. Our steps were the
followings:
- Create the base document library, which stores the contracts.
- Create a secondary document library, which will store the attachments. This
library have to contain a lookup column to the base document library – we store
here a reference to the bace contract for every attachment. - Insert special commands to base library's element menu with a little
javascript added to a Content Editor webpart on AllItems.aspx: one for Add new
attachment, and the other one for View attachments:<script language="javascript">// Add a custom menu items into the menufunction Custom_AddDocLibMenuItems(m, ctx){ var strDisplayText = "Add new Attachment"; var strAction = "window.open('http://myserver/insurance/Attachments/Forms/Upload.aspx?&RelatedDocumentID="+currentItemID+"');"; var strImagePath = "/_layouts/images/attach.gif"; // Add our new menu item CAMOpt(m, strDisplayText, strAction, strImagePath); var strDisplayText2 = "View Attachments"; var strAction2 = "window.open('http://myserver/insurance/Attachments/Forms/AttachmentForContract.aspx?&ID="+currentItemID+"');"; var strImagePath2 = "/_layouts/images/attach.gif"; // Add our new menu item CAMOpt(m, strDisplayText2, strAction2, strImagePath2); // add a separator to the menu CAMSep(m); // false means that the standard menu items should also rendered return false; }</script>
- In the attachment library we have a lookup column to the base document
library, so we have to set a default value to the base contract. This contract's
ID is passed by ID parametet. - That's all
The AttachmentForContract.aspx is a custom list of contracts
filtered by ID parameter. If the user click to View attachments menu, he/she
will be redirected to this page, and he/she can see the attachments for base
contract passed by ID parameter.
In the next part, I'll show you how you can develop a custom field, which is
responsible for rights management on a list item or a document.