cancel
Showing results for 
Search instead for 
Did you mean: 

Print all the topics/discussions on a forum

dbrunner
Champ in-the-making
Champ in-the-making
Is it possible in an easy way to print out all the topics/discussions on a specific file? As it is possible to print all the discussions of a topic (via the print function of the navigator), it is not possible in on click to print all the topics (inculded the discussions) on a specific file.

A nice solution would be to be able to generate a PDF file for doing that.

Any idea ?
3 REPLIES 3

alexander
Champ in-the-making
Champ in-the-making
I guess it is possible to create a template, that will iterate through all topics and render it in a form of HTML file, including posts.

Then one may create custom action to show this template.

dbrunner
Champ in-the-making
Champ in-the-making
Yes, but do you know (or even better, do you have a small example) how to access every topic/discussions on a document through fdl/javascript ?

wiggum
Champ in-the-making
Champ in-the-making
We're executing the javascript below to iterate through all the posts in a discussion, then send out an email with the thread to the creator of the document.


var docCreator = document.properties.creator;
var docCreatorMail = people.getPerson(docCreator).properties["cm:email"];

var childList = new Array(30);
var childList = document.children;

try {
   var grandchildList = new Array(30);
   var grandchildList = childList[0].children;

   var greatgrandchildList = new Array(30);
   var greatgrandchildList = grandchildList[0].children;

   var docDiscussion = childList[0].properties;
   var docTopic = childList[0].properties["fm:topic"];
   var docPost = childList[0].properties["fm:post"];
}
catch (ex) {
   var isPostMessage = "false";
}

var mail = actions.create("mail");
mail.parameters.to = docCreatorMail;
mail.parameters.subject = "Rejected Document:  " + document.properties.name;
mail.parameters.from = "axl@gnr.com";
mail.parameters.text = "Document '" + document.properties.name + "' has been rejected.  ";

// check if there's a discussion thread for this item, and display appropriately
if ("false" == isPostMessage) {
   mail.parameters.text += "There is no discussion thread for this item.";
}
else {
   mail.parameters.text += "The discussion thread is below.\n\n";
   mail.parameters.text += "Topic: " + grandchildList[0].name + "\n\n";

   var i;
   var tmptxt;
   for (i=greatgrandchildList.length-1; i >= 0 ; i–)
   {
      tmptxt = greatgrandchildList[i].name;
      // transform the html to text
      tmptxt = greatgrandchildList[i].transformDocument('text/plain');
      mail.parameters.text += "Message " + (i+1) + ": " + tmptxt.content + "\n";
      // remove the temp file
      tmptxt.remove();
   }

}

mail.execute(document);