xpages display the document history - xpages

In some 'old' lotus notes applications, we created a history of each document: who created the doc, every person which edited it + the respective dates. The code contained several libraries in lotusScript.
For xpages, is there any snippet / sample working example which I could use? I found this but I couldn't download any example ...

ValueChangeListeners allow you to capture changes to specific components. I've used them to create audit trails in customer applications before.
Tony McGuckin has an XSnippet for it:
http://openntf.org/XSnippets.nsf/snippet.xsp?id=server-side-value-change-events-listeners
Declan Lynch covered it in a blog post:
http://www.qtzar.com/using-a-valuechangelistener-to-build-an-audit-trail/
Don McNally has also done a blog post:
http://dmcnally.blogspot.co.uk/2013/02/xpages-detecting-and-logging-field.html

I don't know of any pre-done snippet yet. But this becomes a lot easier in XPages especially if expand into Java. When I create an application these days I basically convert the document to a Java object. I don't do this yet but it would be easy to store in the object a Map of all the fields and their current values and then on save, look for differences and then write them out to a log document.
this could be done without java of course. Create an map object in scope. Populate it on loading of the document and on save do the compare and write.

Something went wrong with that project on OpenNTF (don't ever use an ampersand in the name). I'm the original author of that custom control. AFter some digging I found a direct url to the project here.

Related

How to display data from document to XPage?

I am new to Lotus notes. Till now I am able to add data from XPage to the document and display it into a view. Now I want to display data into the fields on a XPage. Please suggest me how to do that And any good tutorial that suggest step by step development of an application on Notes.
In your custom control, bind the control to a document, drag a field (like a text field or computed field), and one of the panes will let you bind it to a field on the document.
There is a lot to this, you can look at Declan Lynch's blog posts (a bit old, but a great start) http://www.qtzar.com/learning-xpages/
You may want to pay for a class, I've taken some from TLCC and they are great: https://www.tlcc.com/ (I am not associated with TLCC, just a happy customer).
I know links out are not the greatest here, but part of this question was to point to tutorials.
There are many hours of free video tips and tutorials on XPages over at the NotesIn9 Screencast. notesin9.com. Since the blog makes it difficult to find older shows, which still have value I have them indexed at XPages.TV as well. There's also a site at XPagesCheatSheet.com with some intro cheatsheets.
Also you can use Mastering XPages book.

Export list of Sitecore items as Excel (or other formats)

I noticed that sitecore has the option of exporting users in an Excel format.
I need to have similar functionality for exporting 'participations', (a users can enlist to take part in an 'event', and if their entry is approved via a sitecore workflow, a 'participation' item is created in the content tree)
Since mostly everything in Sitecore is in essence based on items, and I want to export items to Excel, my question is - what are some of the best ways of doing this?
Questions:
Is there a way to re-use this functionality for regular items?
Would it be a good idea to create a custom admin page (any tips on doing this?) which has some custom code that reads the items from the database using the API?
are there sitecore plugins/shared source projects that can help me achieve this?
Or does anyone have a better idea? - would it be better to just store the participations in SQL? I'm mostly doing it this way because I want to make use of the 'free' functionality offers, for example workflow, but if that leads to me using anti-patterns please shoot me ;)
Link is different now: https://marketplace.sitecore.net/en/Modules/Advanced_System_Reporter.aspx
P.S. Couldn't leave a comment to original answer as I don't have enough reputation. Oh well :)
Found a most excellent shared source module which does exactly this (and much more)!
Basically it allows you to configure (and easily extend, if you need to) any kind of table based report on 'items'.
The report module shows up as an application in the sitecore menu (like the user manager tool) and comes with features such as xml,csv, xls export. It's also really easy to set up, once you get the hang of it.
http://trac.sitecore.net/AdvancedSystemReporter

Programmatically Updating a document library in Sharepoint

Im quite new to SHarepoint. I have a requirement like, i need to move some documents from different document libraries to a document library named "Region". So that each time a document is updated in these document libraries , the document should be updated in the library "Region" as well.
I wrote a c# function in a class library,to copy the documents to the library and added the dll to that sites Bin folder.Function is working fine. But Im stuck up , Im n ot sure where to call this function.In which event should i write it, so that each time any of these documents are modified, that change has to be reflected in the "Region" library .
You have to create a SharePoint event handler and attach it to all the document libraries where you change the documents. You will then override the ItemAdded and ItemUpdated methods to perform the copying.
See more info in this StackOverflow discussion: SharePoint running a method when item added to a library
Using an event handler is probably the best way to go as mentioned by naivists. Alternatively, if the work you are carrying out is part of a larger whole, e.g. a Workflow, then you may want to consider creating a Visual Studio Workflow, which may be quite complex to get started with, or use a simple tool like the Workflow Power Pack that allows simple C# snippets to be added directly to SharePoint Designer Workflows.
Have a look at these articles. More info can be found here.
Note that I worked on the Power Pack so I am biased. Having said that it works great ;-)

Change template html in sharepoint discussion reply box

I have a wss 3.0 install which needs an "anonymous" discussion board. I can modify the view so no usernames are displayed, however when I click on "reply", the message I'm replying to shows up in the rich text box with the username of the previous poster.
Is there a way to remove that username? or Remove the previous posted text altogether? I've found the schema.xml file with lots of relevant info under the ..12\TEMPLATE\FEATURES\DiscussionsList\Discuss folder, but not sure if this is the easiest way to adjust this setting.
Any comments appreciated.
Best practice says that you should always create a custom list definition instead of trying to modify the OOB assets.
The easiest way to do this is take a copy of the 12\TEMPLATE\FEATURES\DiscussionsList\Discuss folder, modify the feature Ids and names so that its unique. Then your free to change the schema render template (i.e view schema) and modify the edit and display forms.
If you need to modfify the actual entry form you may consider a custom control template : http://msdn.microsoft.com/en-us/library/aa543922.aspx
Custom list definition : http://msdn.microsoft.com/en-us/library/ms466023.aspx
Agrothe,
I have a similar requirement (hide or mask the author inside the reply thread.). What exactly inside of schema.xml do you think will allow you to do accomplish that?
Not sure if the list forms are exposed to xslt. If so, then perhaps this is another approach.
FWIW, the other solutions I have investigated:
(1) A custom event handler. Unfortunately, I can't pinpoint which event fires when someone click reply.
(2) Anonymous blog comments (http://blogs.msdn.com/sharepoint/archive/2007/08/06/anonymous-comment-feature-for-sharepoint-blog-now-available-on-codeplex.aspx).
(3) the other thing I am considering, is to introduce a global anonymous active directory login, which users can use to post anonymously. Not ideal, but for the amount of time I have spent researching a solution, might be my last hope.

How can commenting be added to news articles in an existing Sharepoint 2007 news site?

A client is asking to incorporate commenting on their news articles. They're using the Sharepoint news site template for their news publishing, etc. They want a simple commenting system, much like what is available on most blog engines, only they want it at the bottom of each news article.
I just thought I would ask around about an out of the box solution before I go quoting a custom dev solution. Thanks in advance!
I struggled with this a while back and the solution we found was to use a discussion borad list (out of the box) and we created a custom web part that we added to the page layout for news.
We had to do som trickery to add support for anonymous comments, but on the whole it works good and wasen't to much code.
The Community Kit for SharePoint does the whole commenting thing for blogs.
you may have to cut out the commenting part of it to get it to work with your news section however.
The commenting section of the Enhanced Blog Edition of CKS does to approval of comments and spam checking.
I had the same request. I didn't find an existing solution, so I did it by copying from the standard Blog site template, plus custom coding.
From the template: Copy the definition for the blog comments list. Remove the lookup fields, and use a feature to create the list on all publishing sites.
Custom code: Add a feature receiver to the comments feature, and use it to add the lookup fields for page id and title, (using the pages list as destination). This needs to be done in code because you can't configure the destination list for lookup fields in XML, (or at least I don't know how).
Write controls for querying the comments list and adding to it, and place on the page layout.
Simpler approach: Don't use the standard blog comments list, just create your own, where the page reference is just a number and not a lookup field. Pro: Less work. Con: You miss out on the views that come with the standard list.

Resources