Added edit capabilities to forums

Disabled forums functionality
Changed version number back to 1.1.1
Added support for next/previous item navigation

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2033 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2005-12-13 12:44:00 +00:00
parent d1563e19c9
commit 145f72a6e7
14 changed files with 969 additions and 38 deletions

View File

@@ -18,11 +18,17 @@
package org.alfresco.web.bean.wizard;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import org.alfresco.model.ContentModel;
import org.alfresco.model.ForumModel;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.util.GUID;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.ui.common.Utils;
import org.springframework.util.StringUtils;
/**
* Backing bean for posting forum articles.
@@ -39,28 +45,91 @@ public class NewPostWizard extends CreateContentWizard
{
super.init();
// set up for creating a post instead of HTML
this.createType = CONTENT_TEXT;
// set up for creating a post
this.objectType = ForumModel.TYPE_POST.toString();
}
/**
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#startWizardForEdit(javax.faces.event.ActionEvent)
*/
@Override
public void startWizardForEdit(ActionEvent event)
{
// TODO: Allow action link to have multiple action listeners
// then we wouldn't need to have this coupling in here
// we need to setup the content in the browse bean first
this.browseBean.setupContentAction(event);
super.startWizardForEdit(event);
}
/**
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#populate()
*/
@Override
public void populate()
{
super.populate();
// we need to remove the <br> tags and replace with carriage returns
// and then setup the content member variable
Node currentDocument = this.browseBean.getDocument();
ContentReader reader = this.contentService.getReader(currentDocument.getNodeRef(),
ContentModel.PROP_CONTENT);
if (reader != null)
{
String htmlContent = reader.getContentString();
if (htmlContent != null)
{
this.content = StringUtils.replace(htmlContent, "<br/>", "\r\n");
}
}
}
/**
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#finish()
*/
@Override
public String finish()
{
// create appropriate values for filename, title and content type
this.fileName = GUID.generate() + ".txt";
this.contentType = Repository.getMimeTypeForFileName(
FacesContext.getCurrentInstance(), this.fileName);
this.title = this.fileName;
// remove link breaks and replace with <br/>
this.content = Utils.replaceLineBreaks(this.content);
if (this.editMode)
{
// remove the line breaks before the save
this.content = Utils.replaceLineBreaks(this.content);
}
else
{
// create appropriate values for filename, title and content type
this.fileName = GUID.generate() + ".html";
this.contentType = Repository.getMimeTypeForFileName(
FacesContext.getCurrentInstance(), this.fileName);
this.title = this.fileName;
// remove link breaks and replace with <br/>
this.content = Utils.replaceLineBreaks(this.content);
}
return super.finish();
}
/**
* @see org.alfresco.web.bean.wizard.BaseContentWizard#performCustomProcessing()
*/
@Override
protected void performCustomProcessing()
{
// update the content
Node currentDocument = this.browseBean.getDocument();
ContentWriter writer = this.contentService.getWriter(currentDocument.getNodeRef(),
ContentModel.PROP_CONTENT, true);
if (writer != null)
{
writer.putContent(this.content);
}
}
}