Minor fixes, added documentation, improved formatting.
git-svn-id: https://svn.libreccm.org/ccm/trunk@2072 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
18196e775a
commit
91c2b394a5
|
|
@ -228,7 +228,7 @@ waf.admin.password=lib2000
|
|||
waf.admin.password.question=12345
|
||||
waf.admin.password.answer=6
|
||||
|
||||
waf.runtime.jdbc_url=jdbc\:postgresql\://localhost/openccm?user\=ccm&password\=ccm42web
|
||||
waf.runtime.jdbc_url=jdbc\:postgresql\://localhost/ccm?user\=ccm&password\=ccm42web
|
||||
waf.runtime.jdbc_pool_size=40
|
||||
|
||||
waf.web.server=localhost\:8080
|
||||
|
|
|
|||
|
|
@ -66,19 +66,25 @@
|
|||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||
|
||||
<!-- Content Assets -->
|
||||
<!--
|
||||
<ccm:application name="ccm-cms-assets-fileattachment"/>
|
||||
<ccm:application name="ccm-cms-assets-notes"/>
|
||||
|
||||
-->
|
||||
<!-- Content Types -->
|
||||
<ccm:application name="ccm-cms-types-bookmark"/>
|
||||
<!--
|
||||
<ccm:application name="ccm-cms-types-event"/>
|
||||
<ccm:application name="ccm-cms-types-image"/>
|
||||
<ccm:application name="ccm-cms-types-mparticle"/>
|
||||
-->
|
||||
<ccm:application name="ccm-cms-types-newsitem"/>
|
||||
<!--
|
||||
<ccm:application name="ccm-cms-types-person"/>
|
||||
|
||||
-->
|
||||
<!-- Applications -->
|
||||
<!--
|
||||
<ccm:application name="ccm-cms-publicpersonalprofile"/>
|
||||
-->
|
||||
|
||||
<!-- LDN extension -->
|
||||
<!-- temporarily excluded because configuration issues have to be resolved
|
||||
|
|
@ -117,9 +123,9 @@
|
|||
<ccm:application name="ccm-bookmarks"/>
|
||||
<ccm:application name="ccm-docmgr"/>
|
||||
<ccm:application name="ccm-docrepo"/>
|
||||
-->
|
||||
<ccm:application name="ccm-forum"/>
|
||||
<ccm:application name="ccm-forum-categorised"/>
|
||||
-->
|
||||
<!--
|
||||
<ccm:application name="ccm-portalserver"/>
|
||||
<ccm:application name="ccm-weblog"/>
|
||||
|
|
@ -133,6 +139,12 @@
|
|||
<ccm:application name="ccm-ldn-importer"/>
|
||||
-->
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||
<!-- Libre CMS modules under development -->
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||
<ccm:application name="ccm-portlet-bookmarks"/>
|
||||
<ccm:application name="ccm-portlet-latestnews"/>
|
||||
|
||||
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||
|
|
|
|||
|
|
@ -34,13 +34,11 @@ import org.apache.log4j.Logger;
|
|||
* @see com.arsdigita.kernel.Resource
|
||||
* @author Justin Ross <<a href="mailto:jross@redhat.com">jross@redhat.com</a>>
|
||||
* @author Eric Lorenzo
|
||||
* @version $Id: ResourceConfigFormSection.java 287 2005-02-22 00:29:02Z sskracic $
|
||||
*/
|
||||
public abstract class ResourceConfigFormSection extends FormSection {
|
||||
public static final String versionId =
|
||||
"$Id: ResourceConfigFormSection.java 287 2005-02-22 00:29:02Z sskracic $" +
|
||||
"$Author: sskracic $" +
|
||||
"$DateTime: 2004/08/16 18:10:38 $";
|
||||
|
||||
/** Private logger instance for debugging purpose */
|
||||
private static final Logger s_log = Logger.getLogger
|
||||
(ResourceConfigFormSection.class);
|
||||
|
||||
|
|
|
|||
|
|
@ -34,8 +34,6 @@ import com.arsdigita.cms.ui.authoring.TextAssetBody.PageTextForm;
|
|||
import com.arsdigita.kernel.ResourceType;
|
||||
import com.arsdigita.portalworkspace.Workspace;
|
||||
import com.arsdigita.portalworkspace.portlet.FreeformHTMLPortlet;
|
||||
// @deprecated use com.arsdigita.bebop.portal.PortletConfigFormSection
|
||||
// import com.arsdigita.london.portal.ui.PortletConfigFormSection;
|
||||
import com.arsdigita.portal.Portlet;
|
||||
|
||||
public class FreeformHTMLPortletEditor extends PortletConfigFormSection {
|
||||
|
|
|
|||
|
|
@ -28,13 +28,11 @@ import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
|
|||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.kernel.ResourceType;
|
||||
import com.arsdigita.portalworkspace.portlet.RSSFeedPortlet;
|
||||
// @deprecated use com.arsdigita.bebop.portal.PortletConfigFormSection
|
||||
// import com.arsdigita.london.portal.ui.PortletConfigFormSection;
|
||||
import com.arsdigita.portal.Portlet;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author pb
|
||||
* @author
|
||||
*/
|
||||
public class RSSFeedPortletEditorForm extends PortletConfigFormSection {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
// author chris gilbert
|
||||
// model for a portlet that holds a list of bookmark links
|
||||
|
||||
model uk.gov.westsussex.portlet;
|
||||
// model uk.gov.westsussex.portlet;
|
||||
model com.arsdigita.portlet;
|
||||
|
||||
import com.arsdigita.portal.Portlet;
|
||||
import com.arsdigita.cms.contenttypes.Link;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import com.arsdigita.globalization.GlobalizedMessage;
|
|||
|
||||
public interface BookmarkConstants {
|
||||
|
||||
public static final String BUNDLE_NAME = "uk.gov.westsussex.portlet.bookmarks.ui.BookmarkResources";
|
||||
public static final String BUNDLE_NAME = "com.arsdigita.portlet.bookmarks.ui.BookmarkResources";
|
||||
|
||||
|
||||
// bookmark portlet attributes
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class BookmarksPortlet extends Portlet implements BookmarkConstants {
|
|||
public static final Logger s_log = Logger.getLogger(BookmarksPortlet.class);
|
||||
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"uk.gov.westsussex.portlet.BookmarksPortlet";
|
||||
"com.arsdigita.portlet.BookmarksPortlet";
|
||||
|
||||
private static BookmarksPortletConfig s_config =
|
||||
new BookmarksPortletConfig();
|
||||
|
|
@ -103,15 +103,15 @@ public class BookmarksPortlet extends Portlet implements BookmarkConstants {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a url for an internal or external link - used for displaying
|
||||
/**
|
||||
* Return a url for an internal or external link - used for displaying
|
||||
* the link in edit view (we don't want to just display an item id
|
||||
* when the link is internal as that doesn't mean anything to non authors)
|
||||
*
|
||||
* @param link
|
||||
* @param state
|
||||
* @return
|
||||
*/
|
||||
* @param link
|
||||
* @param state
|
||||
* @return
|
||||
*/
|
||||
public static String getURIForBookmark(Bookmark bookmark, PageState state) {
|
||||
|
||||
String url = null;
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ import com.arsdigita.util.parameter.Parameter;
|
|||
*/
|
||||
public class BookmarksPortletConfig extends AbstractConfig {
|
||||
|
||||
private BooleanParameter checkPermissions = new BooleanParameter(
|
||||
"uk.gov.westsussex.portlet.bookmarks.checkPermissions",
|
||||
Parameter.REQUIRED, new Boolean(false));
|
||||
private BooleanParameter checkPermissions = new BooleanParameter(
|
||||
"com.arsdigita.portlet.bookmarks.checkPermissions",
|
||||
Parameter.REQUIRED, new Boolean(false));
|
||||
|
||||
public BookmarksPortletConfig() {
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public class Initializer extends CompoundInitializer {
|
|||
add(
|
||||
new PDLInitializer(
|
||||
new ManifestSource(
|
||||
"ccm-wsx-bookmarks-portlet.pdl.mf",
|
||||
"ccm-portlet-bookmarks.pdl.mf",
|
||||
new NameFilter(
|
||||
DbHelper.getDatabaseSuffix(database),
|
||||
"pdl"))));
|
||||
|
|
@ -110,14 +110,14 @@ public class Initializer extends CompoundInitializer {
|
|||
return config;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* implementation of framework that allows portlets to be bundled up
|
||||
* as discrete applications
|
||||
*/
|
||||
PortletType.registerXSLFile(BookmarksPortlet.BASE_DATA_OBJECT_TYPE,
|
||||
"/packages/westsussex-portlets/xsl/bookmarks-portlet.xsl");
|
||||
|
||||
|
||||
/**
|
||||
* implementation of framework that allows portlets to be bundled up
|
||||
* as discrete applications
|
||||
*/
|
||||
PortletType.registerXSLFile(BookmarksPortlet.BASE_DATA_OBJECT_TYPE,
|
||||
"/packages/westsussex-portlets/xsl/bookmarks-portlet.xsl");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -92,283 +92,266 @@ public class BookmarksPortletEditor
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* store item in requestlocal for access by various methods
|
||||
*
|
||||
* code copied from content item portlet - > may be problems when items
|
||||
* unpublished - check
|
||||
*/
|
||||
private RequestLocal contentItem = new RequestLocal() {
|
||||
/**
|
||||
* store item in requestlocal for access by various methods
|
||||
*
|
||||
* code copied from content item portlet - > may be problems when items
|
||||
* unpublished - check
|
||||
*/
|
||||
private RequestLocal contentItem = new RequestLocal() {
|
||||
@Override
|
||||
protected Object initialValue(PageState ps) {
|
||||
String userURL = (String) m_url.getValue(ps);
|
||||
java.net.URL contextURL;
|
||||
try {
|
||||
contextURL =
|
||||
new java.net.URL(
|
||||
Web.getRequest().getRequestURL().toString());
|
||||
} catch (MalformedURLException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
protected Object initialValue(PageState ps) {
|
||||
String userURL = (String) m_url.getValue(ps);
|
||||
|
||||
java.net.URL url;
|
||||
try {
|
||||
url = new java.net.URL(contextURL, userURL);
|
||||
} catch (MalformedURLException ex) {
|
||||
s_log.info("Malformed URL " + userURL);
|
||||
return null;
|
||||
}
|
||||
java.net.URL contextURL;
|
||||
try {
|
||||
contextURL = new java.net.URL(Web.getRequest().getRequestURL()
|
||||
.toString());
|
||||
} catch (MalformedURLException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
|
||||
String dp = URL.getDispatcherPath();
|
||||
String path = url.getPath();
|
||||
if (path.startsWith(dp)) {
|
||||
path = path.substring(dp.length());
|
||||
}
|
||||
java.net.URL url;
|
||||
try {
|
||||
url = new java.net.URL(contextURL, userURL);
|
||||
} catch (MalformedURLException ex) {
|
||||
s_log.info("Malformed URL " + userURL);
|
||||
return null;
|
||||
}
|
||||
|
||||
StringTokenizer tok = new StringTokenizer(path, "/");
|
||||
if (!tok.hasMoreTokens()) {
|
||||
s_log.info(
|
||||
"Couldn't find a content section for "
|
||||
+ path
|
||||
+ " in "
|
||||
+ userURL);
|
||||
return null;
|
||||
}
|
||||
String dp = URL.getDispatcherPath();
|
||||
String path = url.getPath();
|
||||
if (path.startsWith(dp)) {
|
||||
path = path.substring(dp.length());
|
||||
}
|
||||
|
||||
String sectionPath = '/' + tok.nextToken() + '/';
|
||||
StringTokenizer tok = new StringTokenizer(path, "/");
|
||||
if (!tok.hasMoreTokens()) {
|
||||
s_log.info("Couldn't find a content section for "
|
||||
+ path + " in " + userURL);
|
||||
return null;
|
||||
}
|
||||
|
||||
String context = ContentItem.LIVE;
|
||||
if (tok.hasMoreTokens()
|
||||
&& CMSDispatcher.PREVIEW.equals(tok.nextToken())) {
|
||||
String sectionPath = '/' + tok.nextToken() + '/';
|
||||
|
||||
context = CMSDispatcher.PREVIEW;
|
||||
}
|
||||
String context = ContentItem.LIVE;
|
||||
if (tok.hasMoreTokens()
|
||||
&& CMSDispatcher.PREVIEW.equals(tok.nextToken())) {
|
||||
|
||||
ContentSectionCollection sections = ContentSection.getAllSections();
|
||||
sections.addEqualsFilter(Application.PRIMARY_URL, sectionPath);
|
||||
context = CMSDispatcher.PREVIEW;
|
||||
}
|
||||
|
||||
ContentSection section;
|
||||
if (sections.next()) {
|
||||
section = sections.getContentSection();
|
||||
sections.close();
|
||||
} else {
|
||||
s_log.info(
|
||||
"Content section "
|
||||
+ sectionPath
|
||||
+ " in "
|
||||
+ userURL
|
||||
+ " doesn't exist.");
|
||||
return null;
|
||||
}
|
||||
ContentSectionCollection sections = ContentSection.getAllSections();
|
||||
sections.addEqualsFilter(Application.PRIMARY_URL, sectionPath);
|
||||
|
||||
ItemResolver resolver = section.getItemResolver();
|
||||
ContentSection section;
|
||||
if (sections.next()) {
|
||||
section = sections.getContentSection();
|
||||
sections.close();
|
||||
} else {
|
||||
s_log.info("Content section " + sectionPath + " in "
|
||||
+ userURL + " doesn't exist.");
|
||||
return null;
|
||||
}
|
||||
|
||||
path = path.substring(sectionPath.length());
|
||||
ItemResolver resolver = section.getItemResolver();
|
||||
|
||||
if (path.endsWith(".jsp")) {
|
||||
path = path.substring(0, path.length() - 4);
|
||||
}
|
||||
path = path.substring(sectionPath.length());
|
||||
|
||||
ContentItem item = resolver.getItem(section, path, context);
|
||||
if (item == null) {
|
||||
s_log.debug("Couldn't resolve item " + path);
|
||||
return null;
|
||||
}
|
||||
if (path.endsWith(".jsp")) {
|
||||
path = path.substring(0, path.length() - 4);
|
||||
}
|
||||
|
||||
SecurityManager sm = new SecurityManager(item.getContentSection());
|
||||
ContentItem item = resolver.getItem(section, path, context);
|
||||
if (item == null) {
|
||||
s_log.debug("Couldn't resolve item " + path);
|
||||
return null;
|
||||
}
|
||||
|
||||
boolean canRead =
|
||||
sm.canAccess(
|
||||
ps.getRequest(),
|
||||
SecurityManager.PUBLIC_PAGES,
|
||||
item);
|
||||
if (!canRead) {
|
||||
s_log.debug("User not allowed access to item");
|
||||
return null;
|
||||
SecurityManager sm = new SecurityManager(item.getContentSection());
|
||||
|
||||
}
|
||||
boolean canRead = sm.canAccess(ps.getRequest(),
|
||||
SecurityManager.PUBLIC_PAGES,
|
||||
item);
|
||||
if (!canRead) {
|
||||
s_log.debug("User not allowed access to item");
|
||||
return null;
|
||||
}
|
||||
|
||||
return item.getDraftVersion();
|
||||
}
|
||||
};
|
||||
return item.getDraftVersion();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* register the parameter that records the current selected bookmark
|
||||
*/
|
||||
/**
|
||||
* register the parameter that records the current selected bookmark
|
||||
*/
|
||||
@Override
|
||||
public void register (Page p) {
|
||||
super.register(p);
|
||||
p.addComponentStateParam(this, m_selectedBookmark);
|
||||
p.addComponentStateParam(this, m_selectedPortlet);
|
||||
}
|
||||
public void register (Page p) {
|
||||
super.register(p);
|
||||
p.addComponentStateParam(this, m_selectedBookmark);
|
||||
p.addComponentStateParam(this, m_selectedPortlet);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void addWidgets() {
|
||||
// create widgets
|
||||
m_url = new TextField(new StringParameter(Link.TARGET_URI));
|
||||
m_url.addValidationListener(new NotNullValidationListener());
|
||||
|
||||
m_title = new TextField(new StringParameter(Link.DISPLAY_NAME));
|
||||
m_title.addValidationListener(new NotNullValidationListener());
|
||||
|
||||
m_description = new TextField(new StringParameter(Link.DESCRIPTION));
|
||||
|
||||
m_newWindow = new CheckboxGroup(Link.TARGET_WINDOW);
|
||||
m_newWindow.addOption(new Option(NEW_WINDOW_YES, NEW_WINDOW));
|
||||
|
||||
try {
|
||||
m_newWindow.addPrintListener(new PrintListener() {
|
||||
|
||||
public void prepare(PrintEvent e) {
|
||||
PageState state = e.getPageState();
|
||||
CheckboxGroup newWindow = (CheckboxGroup)e.getTarget();
|
||||
if (m_bookmarkSelectionModel.isSelected(state)) {
|
||||
Link link = m_bookmarkSelectionModel.getSelectedLink(state);
|
||||
newWindow.setValue(state, link.getTargetWindow());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
} catch (IllegalArgumentException e) {
|
||||
s_log.warn("exception when trying to set checkbox value", e);
|
||||
} catch (TooManyListenersException e) {
|
||||
s_log.warn("exception when trying to set checkbox value", e);
|
||||
}
|
||||
|
||||
|
||||
m_selectedPortlet = new BigDecimalParameter("bookmark_portlet");
|
||||
m_portletSelectionModel = new PortletSelectionModel(m_selectedPortlet);
|
||||
m_selectedBookmark = new BigDecimalParameter("bookmark");
|
||||
m_bookmarkSelectionModel = new BookmarkSelectionModel(
|
||||
"uk.gov.westsussex.portlet.bookmarks.Bookmark",
|
||||
protected void addWidgets() {
|
||||
// create widgets
|
||||
m_url = new TextField(new StringParameter(Link.TARGET_URI));
|
||||
m_url.addValidationListener(new NotNullValidationListener());
|
||||
|
||||
m_title = new TextField(new StringParameter(Link.DISPLAY_NAME));
|
||||
m_title.addValidationListener(new NotNullValidationListener());
|
||||
|
||||
m_description = new TextField(new StringParameter(Link.DESCRIPTION));
|
||||
|
||||
m_newWindow = new CheckboxGroup(Link.TARGET_WINDOW);
|
||||
m_newWindow.addOption(new Option(NEW_WINDOW_YES, NEW_WINDOW));
|
||||
try {
|
||||
m_newWindow.addPrintListener(new PrintListener() {
|
||||
|
||||
public void prepare(PrintEvent e) {
|
||||
PageState state = e.getPageState();
|
||||
CheckboxGroup newWindow = (CheckboxGroup)e.getTarget();
|
||||
if (m_bookmarkSelectionModel.isSelected(state)) {
|
||||
Link link = m_bookmarkSelectionModel.getSelectedLink(state);
|
||||
newWindow.setValue(state, link.getTargetWindow());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
} catch (IllegalArgumentException e) {
|
||||
s_log.warn("exception when trying to set checkbox value", e);
|
||||
} catch (TooManyListenersException e) {
|
||||
s_log.warn("exception when trying to set checkbox value", e);
|
||||
}
|
||||
|
||||
|
||||
m_selectedPortlet = new BigDecimalParameter("bookmark_portlet");
|
||||
m_portletSelectionModel = new PortletSelectionModel(m_selectedPortlet);
|
||||
m_selectedBookmark = new BigDecimalParameter("bookmark");
|
||||
m_bookmarkSelectionModel = new BookmarkSelectionModel(
|
||||
"com.arsdigita.portlet.bookmarks.Bookmark",
|
||||
Bookmark.BASE_DATA_OBJECT_TYPE, m_selectedBookmark);
|
||||
m_existingBookmarks = new BookmarksTable(m_bookmarkSelectionModel,
|
||||
m_portletSelectionModel);
|
||||
|
||||
super.addWidgets();
|
||||
|
||||
add(new HorizontalLine(), ColumnPanel.FULL_WIDTH);
|
||||
m_existingBookmarks = new BookmarksTable(m_bookmarkSelectionModel,
|
||||
m_portletSelectionModel);
|
||||
|
||||
|
||||
add(m_existingBookmarks, ColumnPanel.FULL_WIDTH);
|
||||
add(new HorizontalLine(), ColumnPanel.FULL_WIDTH);
|
||||
super.addWidgets();
|
||||
|
||||
add(ADD_NEW_BOOKMARK_LABEL, ColumnPanel.FULL_WIDTH);
|
||||
add(TITLE_LABEL, ColumnPanel.RIGHT);
|
||||
add(m_title);
|
||||
add(DESCRIPTION_LABEL, ColumnPanel.RIGHT);
|
||||
add(m_description);
|
||||
|
||||
|
||||
add(URL_LABEL, ColumnPanel.RIGHT);
|
||||
add(m_url);
|
||||
add(new Label("")); // fill up the left hand column
|
||||
add(m_newWindow);
|
||||
add(new HorizontalLine(), ColumnPanel.FULL_WIDTH);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* specify current portlet for reference by table
|
||||
*
|
||||
* fill in values if user has selected edit on an existing bookmark
|
||||
*/
|
||||
add(m_existingBookmarks, ColumnPanel.FULL_WIDTH);
|
||||
add(new HorizontalLine(), ColumnPanel.FULL_WIDTH);
|
||||
|
||||
add(ADD_NEW_BOOKMARK_LABEL, ColumnPanel.FULL_WIDTH);
|
||||
add(TITLE_LABEL, ColumnPanel.RIGHT);
|
||||
add(m_title);
|
||||
add(DESCRIPTION_LABEL, ColumnPanel.RIGHT);
|
||||
add(m_description);
|
||||
|
||||
|
||||
add(URL_LABEL, ColumnPanel.RIGHT);
|
||||
add(m_url);
|
||||
add(new Label("")); // fill up the left hand column
|
||||
add(m_newWindow);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* specify current portlet for reference by table
|
||||
*
|
||||
* fill in values if user has selected edit on an existing bookmark
|
||||
*/
|
||||
@Override
|
||||
protected void initWidgets(PageState state, Portlet portlet)
|
||||
throws FormProcessException {
|
||||
s_log.debug("init widgets - set selected portlet to " + portlet.getOID());
|
||||
// set cached version as dirty here rather than during process
|
||||
protected void initWidgets(PageState state, Portlet portlet)
|
||||
throws FormProcessException {
|
||||
s_log.debug("init widgets - set selected portlet to " + portlet.getOID());
|
||||
// set cached version as dirty here rather than during process
|
||||
// in case an action link is pressed (eg to move links up/down)
|
||||
portlet.getPortletRenderer().invalidateCachedVersion(state);
|
||||
m_portletSelectionModel.setSelectedObject(state, portlet);
|
||||
super.initWidgets(state, portlet);
|
||||
if (m_bookmarkSelectionModel.isSelected(state)) {
|
||||
Bookmark link = m_bookmarkSelectionModel.getSelectedLink(state);
|
||||
m_url.setValue(state, BookmarksPortlet.getURIForBookmark(link, state));
|
||||
m_description.setValue(state, link.getDescription());
|
||||
m_title.setValue(state, link.getTitle());
|
||||
|
||||
}
|
||||
}
|
||||
portlet.getPortletRenderer().invalidateCachedVersion(state);
|
||||
m_portletSelectionModel.setSelectedObject(state, portlet);
|
||||
super.initWidgets(state, portlet);
|
||||
|
||||
/**
|
||||
* Validates url if it looks like it is trying to be a content item
|
||||
if (m_bookmarkSelectionModel.isSelected(state)) {
|
||||
Bookmark link = m_bookmarkSelectionModel.getSelectedLink(state);
|
||||
m_url.setValue(state, BookmarksPortlet.getURIForBookmark(link, state));
|
||||
m_description.setValue(state, link.getDescription());
|
||||
m_title.setValue(state, link.getTitle());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates url if it looks like it is trying to be a content item
|
||||
* but is failing
|
||||
*/
|
||||
*/
|
||||
@Override
|
||||
public void validateWidgets(PageState state, Portlet portlet)
|
||||
throws FormProcessException {
|
||||
// m_selectedPortlet.set(state, portlet);
|
||||
super.validateWidgets(state, portlet);
|
||||
public void validateWidgets(PageState state, Portlet portlet)
|
||||
throws FormProcessException {
|
||||
// m_selectedPortlet.set(state, portlet);
|
||||
super.validateWidgets(state, portlet);
|
||||
|
||||
String fullUrl = (String) m_url.getValue(state);
|
||||
s_log.debug("fullURL = " + fullUrl);
|
||||
|
||||
Object item = contentItem.get(state);
|
||||
URL here = URL.here(state.getRequest(), null);
|
||||
String thisSite = here.getServerURI();
|
||||
s_log.debug("This site is " + thisSite);
|
||||
String fullUrl = (String) m_url.getValue(state);
|
||||
s_log.debug("fullURL = " + fullUrl);
|
||||
|
||||
Object item = contentItem.get(state);
|
||||
URL here = URL.here(state.getRequest(), null);
|
||||
String thisSite = here.getServerURI();
|
||||
s_log.debug("This site is " + thisSite);
|
||||
if (item == null && fullUrl.indexOf(thisSite) != -1
|
||||
&& fullUrl.indexOf("/ccm/") != -1
|
||||
&& fullUrl.indexOf("/content/") != -1 ) {
|
||||
// not watertight, but is reasonable check that user is trying
|
||||
// to specify a content item on this site
|
||||
throw new FormProcessException(CONTENT_ITEM_NOT_FOUND);
|
||||
}
|
||||
throw new FormProcessException(CONTENT_ITEM_NOT_FOUND);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* add new bookmark to portlet, or amend existing one if we are editing
|
||||
}
|
||||
|
||||
/**
|
||||
* add new bookmark to portlet, or amend existing one if we are editing
|
||||
* a selected bookmark
|
||||
*/
|
||||
*/
|
||||
@Override
|
||||
protected void processWidgets(PageState state, Portlet portlet)
|
||||
throws FormProcessException {
|
||||
s_log.debug("START processWidgets");
|
||||
super.processWidgets(state, portlet);
|
||||
|
||||
|
||||
BookmarksPortlet myportlet = (BookmarksPortlet) portlet;
|
||||
|
||||
String titleText = (String) m_title.getValue(state);
|
||||
String urlText = (String) m_url.getValue(state);
|
||||
String descriptionText = (String)m_description.getValue(state);
|
||||
protected void processWidgets(PageState state, Portlet portlet)
|
||||
throws FormProcessException {
|
||||
s_log.debug("START processWidgets");
|
||||
super.processWidgets(state, portlet);
|
||||
|
||||
ContentItem item = (ContentItem) contentItem.get(state);
|
||||
String[] newWindowValue = (String[]) m_newWindow.getValue(state);
|
||||
String newWindow =
|
||||
newWindowValue == null ? NEW_WINDOW_NO : NEW_WINDOW_YES;
|
||||
BookmarksPortlet myportlet = (BookmarksPortlet) portlet;
|
||||
|
||||
Bookmark newBookmark;
|
||||
|
||||
if (m_bookmarkSelectionModel.isSelected(state)) {
|
||||
newBookmark = m_bookmarkSelectionModel.getSelectedLink(state);
|
||||
|
||||
} else {
|
||||
newBookmark = new Bookmark();
|
||||
myportlet.addBookmark(newBookmark);
|
||||
|
||||
}
|
||||
newBookmark.setTitle(titleText);
|
||||
newBookmark.setDescription(descriptionText);
|
||||
newBookmark.setTargetWindow(newWindow);
|
||||
if (item == null) {
|
||||
newBookmark.setTargetType(Link.EXTERNAL_LINK);
|
||||
newBookmark.setTargetURI(urlText);
|
||||
|
||||
} else {
|
||||
newBookmark.setTargetType(Link.INTERNAL_LINK);
|
||||
newBookmark.setTargetItem(item);
|
||||
}
|
||||
|
||||
|
||||
m_bookmarkSelectionModel.clearSelection(state);
|
||||
s_log.debug("END processWidgets");
|
||||
}
|
||||
String titleText = (String) m_title.getValue(state);
|
||||
String urlText = (String) m_url.getValue(state);
|
||||
String descriptionText = (String)m_description.getValue(state);
|
||||
|
||||
ContentItem item = (ContentItem) contentItem.get(state);
|
||||
String[] newWindowValue = (String[]) m_newWindow.getValue(state);
|
||||
String newWindow = newWindowValue == null ? NEW_WINDOW_NO
|
||||
: NEW_WINDOW_YES;
|
||||
|
||||
Bookmark newBookmark;
|
||||
if (m_bookmarkSelectionModel.isSelected(state)) {
|
||||
newBookmark = m_bookmarkSelectionModel.getSelectedLink(state);
|
||||
} else {
|
||||
newBookmark = new Bookmark();
|
||||
myportlet.addBookmark(newBookmark);
|
||||
}
|
||||
newBookmark.setTitle(titleText);
|
||||
newBookmark.setDescription(descriptionText);
|
||||
newBookmark.setTargetWindow(newWindow);
|
||||
if (item == null) {
|
||||
newBookmark.setTargetType(Link.EXTERNAL_LINK);
|
||||
newBookmark.setTargetURI(urlText);
|
||||
} else {
|
||||
newBookmark.setTargetType(Link.INTERNAL_LINK);
|
||||
newBookmark.setTargetItem(item);
|
||||
}
|
||||
|
||||
m_bookmarkSelectionModel.clearSelection(state);
|
||||
s_log.debug("END processWidgets");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<ccm:application name="ccm-wsx-news-portlet"
|
||||
<ccm:application name="ccm-portlet-latestnews"
|
||||
prettyName="Personalised News Portlet"
|
||||
version="1.0.1"
|
||||
release="1"
|
||||
|
|
@ -9,6 +9,9 @@
|
|||
|
||||
<ccm:dependencies>
|
||||
<ccm:requires name="ccm-cms-types-newsitem" version="6.1.0"/>
|
||||
<ccm:requires name="ccm-navigation" version="6.6.0"/>
|
||||
<ccm:requires name="ccm-ldn-terms" version="6.6.0"/>
|
||||
|
||||
<!--
|
||||
<ccm:requires name="ccm-ldn-portal" version="1.4.2"/>
|
||||
<ccm:requires name="ccm-wsx-authentication" version="1.0.1"/>
|
||||
|
|
|
|||
|
|
@ -37,54 +37,52 @@ import org.apache.log4j.Logger;
|
|||
|
||||
|
||||
/**
|
||||
*
|
||||
* Provides configuration pane for NewsPortlet.
|
||||
*
|
||||
* @author Chris Gilbert (cgyg9330) <chris.gilbert@westsussex.gov.uk>
|
||||
* @version $Id: NewsPortletEditor.java 2005/03/07 13:48:49 cgyg9330 Exp $
|
||||
*/
|
||||
public class NewsPortletEditor extends PortletConfigFormSection {
|
||||
|
||||
private TextField m_itemCount;
|
||||
private static final Logger s_log = Logger.getLogger(NewsPortletEditor.class);
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(NewsPortletEditor.class);
|
||||
|
||||
private TextField m_itemCount;
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param resType
|
||||
* @param parentAppRL
|
||||
*/
|
||||
public NewsPortletEditor(ResourceType resType, RequestLocal parentAppRL) {
|
||||
super(resType, parentAppRL);
|
||||
}
|
||||
super(resType, parentAppRL);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param application
|
||||
*/
|
||||
public NewsPortletEditor(RequestLocal application) {
|
||||
super(application);
|
||||
}
|
||||
super(application);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Add widgets to the form containing the configuration options.
|
||||
*/
|
||||
@Override
|
||||
protected void addWidgets() {
|
||||
super.addWidgets();
|
||||
protected void addWidgets() {
|
||||
super.addWidgets();
|
||||
|
||||
m_itemCount =
|
||||
new TextField(new StringParameter(NewsPortlet.ITEM_COUNT));
|
||||
/* Define the number of news item to display */
|
||||
m_itemCount = new TextField(new StringParameter(NewsPortlet.ITEM_COUNT));
|
||||
add(new Label("Number of items:", Label.BOLD), ColumnPanel.RIGHT);
|
||||
m_itemCount.addValidationListener(new IntegerValidationListener());
|
||||
add(m_itemCount);
|
||||
|
||||
add(new Label("Number of items:", Label.BOLD), ColumnPanel.RIGHT);
|
||||
|
||||
m_itemCount.addValidationListener(new IntegerValidationListener());
|
||||
|
||||
add(m_itemCount);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -96,16 +94,16 @@ public class NewsPortletEditor extends PortletConfigFormSection {
|
|||
* TODO: add validation or set up drop down list with contents of Static folder?
|
||||
*/
|
||||
@Override
|
||||
protected void initWidgets(PageState state, Portlet portlet)
|
||||
throws FormProcessException {
|
||||
super.initWidgets(state, portlet);
|
||||
protected void initWidgets(PageState state, Portlet portlet)
|
||||
throws FormProcessException {
|
||||
super.initWidgets(state, portlet);
|
||||
|
||||
if (portlet != null) {
|
||||
NewsPortlet myportlet = (NewsPortlet) portlet;
|
||||
if (portlet != null) {
|
||||
NewsPortlet myportlet = (NewsPortlet) portlet;
|
||||
m_itemCount.setValue(state, myportlet.getItemCount()+ "");
|
||||
}
|
||||
|
||||
m_itemCount.setValue(state, myportlet.getItemCount()+ "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -115,14 +113,15 @@ public class NewsPortletEditor extends PortletConfigFormSection {
|
|||
* @throws FormProcessException
|
||||
*/
|
||||
@Override
|
||||
protected void processWidgets(PageState state, Portlet portlet)
|
||||
throws FormProcessException {
|
||||
s_log.debug("START processWidgets");
|
||||
super.processWidgets(state, portlet);
|
||||
protected void processWidgets(PageState state, Portlet portlet)
|
||||
throws FormProcessException {
|
||||
s_log.debug("START processWidgets");
|
||||
super.processWidgets(state, portlet);
|
||||
|
||||
NewsPortlet myportlet = (NewsPortlet) portlet;
|
||||
myportlet.setItemCount(new Integer(
|
||||
(String) m_itemCount.getValue(state)).intValue());
|
||||
s_log.debug("END processWidgets");
|
||||
}
|
||||
|
||||
NewsPortlet myportlet = (NewsPortlet) portlet;
|
||||
myportlet.setItemCount(new Integer(
|
||||
(String) m_itemCount.getValue(state)).intValue());
|
||||
s_log.debug("END processWidgets");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,15 +58,17 @@ import org.apache.log4j.Logger;
|
|||
* @version $Id: NewsPortletRenderer.java 2005/03/07 13:48:49 cgyg9330 Exp $
|
||||
*/
|
||||
public class NewsPortletRenderer extends AbstractPortletRenderer
|
||||
implements NewsConstants {
|
||||
implements NewsConstants {
|
||||
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(NewsPortletRenderer.class);
|
||||
/** Private logger instance for debugging purpose */
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(NewsPortletRenderer.class);
|
||||
|
||||
private NewsPortlet m_portlet;
|
||||
private NewsPortlet m_portlet;
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param portlet
|
||||
*/
|
||||
|
|
@ -74,48 +76,50 @@ public class NewsPortletRenderer extends AbstractPortletRenderer
|
|||
m_portlet = portlet;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see
|
||||
/* (non-Javadoc)
|
||||
* @see
|
||||
* com.arsdigita.bebop.portal.AbstractPortletRenderer#generateBodyXML(
|
||||
* com.arsdigita.bebop.PageState,
|
||||
* com.arsdigita.xml.Element)
|
||||
*/
|
||||
*/
|
||||
protected void generateBodyXML(PageState state, Element parent) {
|
||||
s_log.debug("START - generateBodyXML");
|
||||
|
||||
Element newsPortlet = parent.newChildElement( MAIN_PORTLET_ELEMENT,
|
||||
PortletType.PORTLET_XML_NS);
|
||||
Element newsPortlet = parent.newChildElement(MAIN_PORTLET_ELEMENT,
|
||||
PortletType.PORTLET_XML_NS);
|
||||
DateFormat formatter = new SimpleDateFormat("dd/MM/yy");
|
||||
|
||||
User thisUser = (User) Kernel.getContext().getParty();
|
||||
if (null == thisUser) {
|
||||
thisUser = Kernel.getPublicUser();
|
||||
}
|
||||
|
||||
// Object customUser = ExternalUserFactory.getCustomUserObject(thisUser);
|
||||
// if (customUser instanceof PersonalisedNewsTarget) {
|
||||
// newsPortlet.addAttribute(PERSONALISED_ATTRIBUTE, "true");
|
||||
// getPersonalisedNews(
|
||||
// state,
|
||||
// newsPortlet,
|
||||
// (PersonalisedNewsTarget) customUser,
|
||||
// formatter);
|
||||
// Object customUser = ExternalUserFactory.getCustomUserObject(thisUser);
|
||||
// if (customUser instanceof PersonalisedNewsTarget) {
|
||||
// newsPortlet.addAttribute(PERSONALISED_ATTRIBUTE, "true");
|
||||
// getPersonalisedNews(state,
|
||||
// newsPortlet,
|
||||
// (PersonalisedNewsTarget) customUser,
|
||||
// formatter);
|
||||
//
|
||||
// } else {
|
||||
newsPortlet.addAttribute(PERSONALISED_ATTRIBUTE, "false");
|
||||
getGeneralNews(newsPortlet, formatter);
|
||||
// } else {
|
||||
|
||||
// }
|
||||
newsPortlet.addAttribute(PERSONALISED_ATTRIBUTE, "false");
|
||||
getGeneralNews(newsPortlet, formatter);
|
||||
|
||||
newsPortlet.addAttribute(NEWS_ROOM_ATTRIBUTE,
|
||||
NewsPortlet.getConfig().getNewsroomShortcut());
|
||||
// }
|
||||
|
||||
s_log.debug("FINISH - generateBodyXML");
|
||||
}
|
||||
newsPortlet.addAttribute(NEWS_ROOM_ATTRIBUTE,
|
||||
NewsPortlet.getConfig().getNewsroomShortcut());
|
||||
|
||||
/**
|
||||
* @param newsPortlet
|
||||
* @param profiledUser
|
||||
*/
|
||||
s_log.debug("FINISH - generateBodyXML");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param newsPortlet
|
||||
* @param profiledUser
|
||||
*/
|
||||
/* CURRENTLY NOT AVAILABLE
|
||||
private void getPersonalisedNews( PageState state,
|
||||
Element main,
|
||||
|
|
@ -124,24 +128,24 @@ public class NewsPortletRenderer extends AbstractPortletRenderer
|
|||
s_log.debug("START - getPersonalisedNews");
|
||||
|
||||
DomainCollection myNews = profiledUser.getMyNews();
|
||||
if (myNews == null) {
|
||||
// method in personalised user class has been implemented to just return null
|
||||
getGeneralNews(main, formatter);
|
||||
return;
|
||||
}
|
||||
if (myNews == null) {
|
||||
// method in personalised user class has been implemented to just return null
|
||||
getGeneralNews(main, formatter);
|
||||
return;
|
||||
}
|
||||
|
||||
myNews.addOrder(ContentPage.LAUNCH_DATE + " desc");
|
||||
myNews.addOrder(ContentPage.LAUNCH_DATE + " desc");
|
||||
|
||||
PermissionService.filterObjects(
|
||||
PermissionService.filterObjects(
|
||||
myNews,
|
||||
PrivilegeDescriptor.get(SecurityManager.CMS_READ_ITEM),
|
||||
Kernel.getContext().getParty().getOID());
|
||||
|
||||
myNews.setRange(
|
||||
myNews.setRange(
|
||||
new Integer(1),
|
||||
new Integer(m_portlet.getItemCount() + 1));
|
||||
|
||||
while (myNews.next()) {
|
||||
while (myNews.next()) {
|
||||
ContentPage page = (ContentPage) myNews.getDomainObject();
|
||||
|
||||
Element item = main.newChildElement(NEWS_ITEM_ELEMENT, XML_NEWS_NS);
|
||||
|
|
@ -155,57 +159,55 @@ public class NewsPortletRenderer extends AbstractPortletRenderer
|
|||
URL_ATTRIBUTE,
|
||||
Navigation.redirectURL(page.getOID()));
|
||||
|
||||
}
|
||||
s_log.debug("END - getPersonalisedNews");
|
||||
}
|
||||
s_log.debug("END - getPersonalisedNews");
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
private void getGeneralNews(Element main, DateFormat formatter) {
|
||||
s_log.debug("START - getGeneralNews");
|
||||
|
||||
// this is the default key - maybe should parametrise
|
||||
Domain rss = Domain.retrieve("APLAWS-RSS");
|
||||
DomainCollection rssRoots = rss.getRootTerms();
|
||||
rssRoots.addEqualsFilter(Term.NAME, "News");
|
||||
Term newsTerm = null;
|
||||
while (rssRoots.next()) {
|
||||
newsTerm = (Term) rssRoots.getDomainObject();
|
||||
s_log.debug("found the news rss feed term");
|
||||
Category cat = newsTerm.getModel();
|
||||
DataCollection newsItems = SessionManager.getSession()
|
||||
.retrieve(ContentPage.BASE_DATA_OBJECT_TYPE);
|
||||
newsItems.addEqualsFilter("parent.categories.id",
|
||||
cat.getID());
|
||||
|
||||
|
||||
// this is the default key - maybe should parametrise
|
||||
Domain rss = Domain.retrieve("APLAWS-RSS");
|
||||
DomainCollection rssRoots = rss.getRootTerms();
|
||||
rssRoots.addEqualsFilter(Term.NAME, "News");
|
||||
Term newsTerm = null;
|
||||
|
||||
while (rssRoots.next()) {
|
||||
newsTerm = (Term) rssRoots.getDomainObject();
|
||||
s_log.debug("found the news rss feed term");
|
||||
Category cat = newsTerm.getModel();
|
||||
DataCollection newsItems = SessionManager.getSession()
|
||||
.retrieve(ContentPage.BASE_DATA_OBJECT_TYPE);
|
||||
newsItems.addEqualsFilter("parent.categories.id",cat.getID());
|
||||
|
||||
newsItems.addEqualsFilter(ContentItem.VERSION, ContentItem.LIVE);
|
||||
newsItems.addOrder(ContentPage.LAUNCH_DATE + " desc");
|
||||
newsItems.addOrder(ContentPage.LAUNCH_DATE + " desc");
|
||||
|
||||
// CategorizedCollection newsItems =
|
||||
// cat.getObjects(ContentPage.BASE_DATA_OBJECT_TYPE);
|
||||
s_log.debug("total items = " + newsItems.size());
|
||||
newsItems.setRange(
|
||||
new Integer(1),
|
||||
new Integer(m_portlet.getItemCount() + 1));
|
||||
// CategorizedCollection newsItems =
|
||||
// cat.getObjects(ContentPage.BASE_DATA_OBJECT_TYPE);
|
||||
s_log.debug("total items = " + newsItems.size());
|
||||
newsItems.setRange(new Integer(1),
|
||||
new Integer(m_portlet.getItemCount() + 1));
|
||||
|
||||
ContentPage newsItem = null;
|
||||
ContentPage newsItem = null;
|
||||
while (newsItems.next()) {
|
||||
Element item =
|
||||
main.newChildElement(NEWS_ITEM_ELEMENT, XML_NEWS_NS);
|
||||
//newsItem = (ContentPage) newsItems.getDomainObject();
|
||||
newsItem = (ContentPage)DomainObjectFactory
|
||||
.newInstance(newsItems.getDataObject());
|
||||
Date d = newsItem.getLaunchDate();
|
||||
String date = (d != null) ? formatter.format(d) : "";
|
||||
item.addAttribute(DATE_ATTRIBUTE, date);
|
||||
Element item = main.newChildElement(NEWS_ITEM_ELEMENT, XML_NEWS_NS);
|
||||
//newsItem = (ContentPage) newsItems.getDomainObject();
|
||||
newsItem = (ContentPage)DomainObjectFactory
|
||||
.newInstance(newsItems.getDataObject());
|
||||
|
||||
item.addAttribute(TITLE_ATTRIBUTE, newsItem.getTitle());
|
||||
Date d = newsItem.getLaunchDate();
|
||||
String date = (d != null) ? formatter.format(d) : "";
|
||||
item.addAttribute(DATE_ATTRIBUTE, date);
|
||||
|
||||
item.addAttribute(TITLE_ATTRIBUTE, newsItem.getTitle());
|
||||
|
||||
item.addAttribute(LEAD_ATTRIBUTE, newsItem.getSearchSummary());
|
||||
item.addAttribute(
|
||||
URL_ATTRIBUTE,
|
||||
Navigation.redirectURL(newsItem.getOID()));
|
||||
item.addAttribute(URL_ATTRIBUTE,
|
||||
Navigation.redirectURL(newsItem.getOID()));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -213,40 +215,35 @@ public class NewsPortletRenderer extends AbstractPortletRenderer
|
|||
s_log.debug("END - getGeneralNews");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
public Object getCacheKey() {
|
||||
|
||||
if (getProfiledUser() == null) {
|
||||
return GENERAL_NEWS_CACHE_KEY;
|
||||
} else {
|
||||
|
||||
|
||||
return m_portlet.getID();
|
||||
}
|
||||
}
|
||||
|
||||
// is dirty if edited, as this means the number of entries has changed.
|
||||
// For non personalised news, dirty if homepage
|
||||
// newsitems are added or edited.
|
||||
// For personalised, dirty if pushed items added or edited.
|
||||
|
||||
public boolean isDirty() {
|
||||
|
||||
|
||||
// has it been edited? - add in this condition when response
|
||||
|
||||
/*
|
||||
public Object getCacheKey() {
|
||||
|
||||
if (getProfiledUser() == null) {
|
||||
return GENERAL_NEWS_CACHE_KEY;
|
||||
} else {
|
||||
return m_portlet.getID();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// is dirty if edited, as this means the number of entries has changed.
|
||||
// For non personalised news, dirty if homepage
|
||||
// newsitems are added or edited.
|
||||
// For personalised, dirty if pushed items added or edited.
|
||||
public boolean isDirty() {
|
||||
// has it been edited? - add in this condition when response
|
||||
// from Redhat about AbstractPortletRenderer
|
||||
|
||||
// if not has news changed
|
||||
if (getCacheKey().equals(GENERAL_NEWS_CACHE_KEY)) {
|
||||
isDirty = m_portlet.isNewNews();
|
||||
s_log.debug("general news: dirty? " + isDirty);
|
||||
|
||||
} else {
|
||||
// implement later
|
||||
isDirty = true;
|
||||
}
|
||||
}
|
||||
return isDirty;
|
||||
*/
|
||||
}
|
||||
// if not has news changed
|
||||
if (getCacheKey().equals(GENERAL_NEWS_CACHE_KEY)) {
|
||||
isDirty = m_portlet.isNewNews();
|
||||
s_log.debug("general news: dirty? " + isDirty);
|
||||
} else {
|
||||
// implement later
|
||||
isDirty = true;
|
||||
}
|
||||
}
|
||||
return isDirty;
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue