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.question=12345
|
||||||
waf.admin.password.answer=6
|
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.runtime.jdbc_pool_size=40
|
||||||
|
|
||||||
waf.web.server=localhost\:8080
|
waf.web.server=localhost\:8080
|
||||||
|
|
|
||||||
|
|
@ -66,19 +66,25 @@
|
||||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
|
|
||||||
<!-- Content Assets -->
|
<!-- Content Assets -->
|
||||||
|
<!--
|
||||||
<ccm:application name="ccm-cms-assets-fileattachment"/>
|
<ccm:application name="ccm-cms-assets-fileattachment"/>
|
||||||
<ccm:application name="ccm-cms-assets-notes"/>
|
<ccm:application name="ccm-cms-assets-notes"/>
|
||||||
|
-->
|
||||||
<!-- Content Types -->
|
<!-- Content Types -->
|
||||||
<ccm:application name="ccm-cms-types-bookmark"/>
|
<ccm:application name="ccm-cms-types-bookmark"/>
|
||||||
|
<!--
|
||||||
<ccm:application name="ccm-cms-types-event"/>
|
<ccm:application name="ccm-cms-types-event"/>
|
||||||
<ccm:application name="ccm-cms-types-image"/>
|
<ccm:application name="ccm-cms-types-image"/>
|
||||||
<ccm:application name="ccm-cms-types-mparticle"/>
|
<ccm:application name="ccm-cms-types-mparticle"/>
|
||||||
|
-->
|
||||||
<ccm:application name="ccm-cms-types-newsitem"/>
|
<ccm:application name="ccm-cms-types-newsitem"/>
|
||||||
|
<!--
|
||||||
<ccm:application name="ccm-cms-types-person"/>
|
<ccm:application name="ccm-cms-types-person"/>
|
||||||
|
-->
|
||||||
<!-- Applications -->
|
<!-- Applications -->
|
||||||
|
<!--
|
||||||
<ccm:application name="ccm-cms-publicpersonalprofile"/>
|
<ccm:application name="ccm-cms-publicpersonalprofile"/>
|
||||||
|
-->
|
||||||
|
|
||||||
<!-- LDN extension -->
|
<!-- LDN extension -->
|
||||||
<!-- temporarily excluded because configuration issues have to be resolved
|
<!-- temporarily excluded because configuration issues have to be resolved
|
||||||
|
|
@ -117,9 +123,9 @@
|
||||||
<ccm:application name="ccm-bookmarks"/>
|
<ccm:application name="ccm-bookmarks"/>
|
||||||
<ccm:application name="ccm-docmgr"/>
|
<ccm:application name="ccm-docmgr"/>
|
||||||
<ccm:application name="ccm-docrepo"/>
|
<ccm:application name="ccm-docrepo"/>
|
||||||
-->
|
|
||||||
<ccm:application name="ccm-forum"/>
|
<ccm:application name="ccm-forum"/>
|
||||||
<ccm:application name="ccm-forum-categorised"/>
|
<ccm:application name="ccm-forum-categorised"/>
|
||||||
|
-->
|
||||||
<!--
|
<!--
|
||||||
<ccm:application name="ccm-portalserver"/>
|
<ccm:application name="ccm-portalserver"/>
|
||||||
<ccm:application name="ccm-weblog"/>
|
<ccm:application name="ccm-weblog"/>
|
||||||
|
|
@ -133,6 +139,12 @@
|
||||||
<ccm:application name="ccm-ldn-importer"/>
|
<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
|
* @see com.arsdigita.kernel.Resource
|
||||||
* @author Justin Ross <<a href="mailto:jross@redhat.com">jross@redhat.com</a>>
|
* @author Justin Ross <<a href="mailto:jross@redhat.com">jross@redhat.com</a>>
|
||||||
* @author Eric Lorenzo
|
* @author Eric Lorenzo
|
||||||
|
* @version $Id: ResourceConfigFormSection.java 287 2005-02-22 00:29:02Z sskracic $
|
||||||
*/
|
*/
|
||||||
public abstract class ResourceConfigFormSection extends FormSection {
|
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
|
private static final Logger s_log = Logger.getLogger
|
||||||
(ResourceConfigFormSection.class);
|
(ResourceConfigFormSection.class);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,6 @@ import com.arsdigita.cms.ui.authoring.TextAssetBody.PageTextForm;
|
||||||
import com.arsdigita.kernel.ResourceType;
|
import com.arsdigita.kernel.ResourceType;
|
||||||
import com.arsdigita.portalworkspace.Workspace;
|
import com.arsdigita.portalworkspace.Workspace;
|
||||||
import com.arsdigita.portalworkspace.portlet.FreeformHTMLPortlet;
|
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;
|
import com.arsdigita.portal.Portlet;
|
||||||
|
|
||||||
public class FreeformHTMLPortletEditor extends PortletConfigFormSection {
|
public class FreeformHTMLPortletEditor extends PortletConfigFormSection {
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,11 @@ import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.kernel.ResourceType;
|
import com.arsdigita.kernel.ResourceType;
|
||||||
import com.arsdigita.portalworkspace.portlet.RSSFeedPortlet;
|
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;
|
import com.arsdigita.portal.Portlet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author pb
|
* @author
|
||||||
*/
|
*/
|
||||||
public class RSSFeedPortletEditorForm extends PortletConfigFormSection {
|
public class RSSFeedPortletEditorForm extends PortletConfigFormSection {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
// author chris gilbert
|
// author chris gilbert
|
||||||
// model for a portlet that holds a list of bookmark links
|
// 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.portal.Portlet;
|
||||||
import com.arsdigita.cms.contenttypes.Link;
|
import com.arsdigita.cms.contenttypes.Link;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
|
||||||
public interface BookmarkConstants {
|
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
|
// 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 Logger s_log = Logger.getLogger(BookmarksPortlet.class);
|
||||||
|
|
||||||
public static final String BASE_DATA_OBJECT_TYPE =
|
public static final String BASE_DATA_OBJECT_TYPE =
|
||||||
"uk.gov.westsussex.portlet.BookmarksPortlet";
|
"com.arsdigita.portlet.BookmarksPortlet";
|
||||||
|
|
||||||
private static BookmarksPortletConfig s_config =
|
private static BookmarksPortletConfig s_config =
|
||||||
new BookmarksPortletConfig();
|
new BookmarksPortletConfig();
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ import com.arsdigita.util.parameter.Parameter;
|
||||||
public class BookmarksPortletConfig extends AbstractConfig {
|
public class BookmarksPortletConfig extends AbstractConfig {
|
||||||
|
|
||||||
private BooleanParameter checkPermissions = new BooleanParameter(
|
private BooleanParameter checkPermissions = new BooleanParameter(
|
||||||
"uk.gov.westsussex.portlet.bookmarks.checkPermissions",
|
"com.arsdigita.portlet.bookmarks.checkPermissions",
|
||||||
Parameter.REQUIRED, new Boolean(false));
|
Parameter.REQUIRED, new Boolean(false));
|
||||||
|
|
||||||
public BookmarksPortletConfig() {
|
public BookmarksPortletConfig() {
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ public class Initializer extends CompoundInitializer {
|
||||||
add(
|
add(
|
||||||
new PDLInitializer(
|
new PDLInitializer(
|
||||||
new ManifestSource(
|
new ManifestSource(
|
||||||
"ccm-wsx-bookmarks-portlet.pdl.mf",
|
"ccm-portlet-bookmarks.pdl.mf",
|
||||||
new NameFilter(
|
new NameFilter(
|
||||||
DbHelper.getDatabaseSuffix(database),
|
DbHelper.getDatabaseSuffix(database),
|
||||||
"pdl"))));
|
"pdl"))));
|
||||||
|
|
@ -118,6 +118,6 @@ public class Initializer extends CompoundInitializer {
|
||||||
*/
|
*/
|
||||||
PortletType.registerXSLFile(BookmarksPortlet.BASE_DATA_OBJECT_TYPE,
|
PortletType.registerXSLFile(BookmarksPortlet.BASE_DATA_OBJECT_TYPE,
|
||||||
"/packages/westsussex-portlets/xsl/bookmarks-portlet.xsl");
|
"/packages/westsussex-portlets/xsl/bookmarks-portlet.xsl");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -102,11 +102,11 @@ public class BookmarksPortletEditor
|
||||||
@Override
|
@Override
|
||||||
protected Object initialValue(PageState ps) {
|
protected Object initialValue(PageState ps) {
|
||||||
String userURL = (String) m_url.getValue(ps);
|
String userURL = (String) m_url.getValue(ps);
|
||||||
|
|
||||||
java.net.URL contextURL;
|
java.net.URL contextURL;
|
||||||
try {
|
try {
|
||||||
contextURL =
|
contextURL = new java.net.URL(Web.getRequest().getRequestURL()
|
||||||
new java.net.URL(
|
.toString());
|
||||||
Web.getRequest().getRequestURL().toString());
|
|
||||||
} catch (MalformedURLException ex) {
|
} catch (MalformedURLException ex) {
|
||||||
throw new UncheckedWrapperException(ex);
|
throw new UncheckedWrapperException(ex);
|
||||||
}
|
}
|
||||||
|
|
@ -127,11 +127,8 @@ public class BookmarksPortletEditor
|
||||||
|
|
||||||
StringTokenizer tok = new StringTokenizer(path, "/");
|
StringTokenizer tok = new StringTokenizer(path, "/");
|
||||||
if (!tok.hasMoreTokens()) {
|
if (!tok.hasMoreTokens()) {
|
||||||
s_log.info(
|
s_log.info("Couldn't find a content section for "
|
||||||
"Couldn't find a content section for "
|
+ path + " in " + userURL);
|
||||||
+ path
|
|
||||||
+ " in "
|
|
||||||
+ userURL);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -152,12 +149,8 @@ public class BookmarksPortletEditor
|
||||||
section = sections.getContentSection();
|
section = sections.getContentSection();
|
||||||
sections.close();
|
sections.close();
|
||||||
} else {
|
} else {
|
||||||
s_log.info(
|
s_log.info("Content section " + sectionPath + " in "
|
||||||
"Content section "
|
+ userURL + " doesn't exist.");
|
||||||
+ sectionPath
|
|
||||||
+ " in "
|
|
||||||
+ userURL
|
|
||||||
+ " doesn't exist.");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -177,15 +170,12 @@ public class BookmarksPortletEditor
|
||||||
|
|
||||||
SecurityManager sm = new SecurityManager(item.getContentSection());
|
SecurityManager sm = new SecurityManager(item.getContentSection());
|
||||||
|
|
||||||
boolean canRead =
|
boolean canRead = sm.canAccess(ps.getRequest(),
|
||||||
sm.canAccess(
|
|
||||||
ps.getRequest(),
|
|
||||||
SecurityManager.PUBLIC_PAGES,
|
SecurityManager.PUBLIC_PAGES,
|
||||||
item);
|
item);
|
||||||
if (!canRead) {
|
if (!canRead) {
|
||||||
s_log.debug("User not allowed access to item");
|
s_log.debug("User not allowed access to item");
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return item.getDraftVersion();
|
return item.getDraftVersion();
|
||||||
|
|
@ -219,7 +209,6 @@ public class BookmarksPortletEditor
|
||||||
|
|
||||||
m_newWindow = new CheckboxGroup(Link.TARGET_WINDOW);
|
m_newWindow = new CheckboxGroup(Link.TARGET_WINDOW);
|
||||||
m_newWindow.addOption(new Option(NEW_WINDOW_YES, NEW_WINDOW));
|
m_newWindow.addOption(new Option(NEW_WINDOW_YES, NEW_WINDOW));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
m_newWindow.addPrintListener(new PrintListener() {
|
m_newWindow.addPrintListener(new PrintListener() {
|
||||||
|
|
||||||
|
|
@ -229,7 +218,6 @@ public class BookmarksPortletEditor
|
||||||
if (m_bookmarkSelectionModel.isSelected(state)) {
|
if (m_bookmarkSelectionModel.isSelected(state)) {
|
||||||
Link link = m_bookmarkSelectionModel.getSelectedLink(state);
|
Link link = m_bookmarkSelectionModel.getSelectedLink(state);
|
||||||
newWindow.setValue(state, link.getTargetWindow());
|
newWindow.setValue(state, link.getTargetWindow());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -245,7 +233,7 @@ public class BookmarksPortletEditor
|
||||||
m_portletSelectionModel = new PortletSelectionModel(m_selectedPortlet);
|
m_portletSelectionModel = new PortletSelectionModel(m_selectedPortlet);
|
||||||
m_selectedBookmark = new BigDecimalParameter("bookmark");
|
m_selectedBookmark = new BigDecimalParameter("bookmark");
|
||||||
m_bookmarkSelectionModel = new BookmarkSelectionModel(
|
m_bookmarkSelectionModel = new BookmarkSelectionModel(
|
||||||
"uk.gov.westsussex.portlet.bookmarks.Bookmark",
|
"com.arsdigita.portlet.bookmarks.Bookmark",
|
||||||
Bookmark.BASE_DATA_OBJECT_TYPE, m_selectedBookmark);
|
Bookmark.BASE_DATA_OBJECT_TYPE, m_selectedBookmark);
|
||||||
m_existingBookmarks = new BookmarksTable(m_bookmarkSelectionModel,
|
m_existingBookmarks = new BookmarksTable(m_bookmarkSelectionModel,
|
||||||
m_portletSelectionModel);
|
m_portletSelectionModel);
|
||||||
|
|
@ -286,12 +274,12 @@ public class BookmarksPortletEditor
|
||||||
portlet.getPortletRenderer().invalidateCachedVersion(state);
|
portlet.getPortletRenderer().invalidateCachedVersion(state);
|
||||||
m_portletSelectionModel.setSelectedObject(state, portlet);
|
m_portletSelectionModel.setSelectedObject(state, portlet);
|
||||||
super.initWidgets(state, portlet);
|
super.initWidgets(state, portlet);
|
||||||
|
|
||||||
if (m_bookmarkSelectionModel.isSelected(state)) {
|
if (m_bookmarkSelectionModel.isSelected(state)) {
|
||||||
Bookmark link = m_bookmarkSelectionModel.getSelectedLink(state);
|
Bookmark link = m_bookmarkSelectionModel.getSelectedLink(state);
|
||||||
m_url.setValue(state, BookmarksPortlet.getURIForBookmark(link, state));
|
m_url.setValue(state, BookmarksPortlet.getURIForBookmark(link, state));
|
||||||
m_description.setValue(state, link.getDescription());
|
m_description.setValue(state, link.getDescription());
|
||||||
m_title.setValue(state, link.getTitle());
|
m_title.setValue(state, link.getTitle());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -321,6 +309,7 @@ public class BookmarksPortletEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* a selected bookmark
|
||||||
|
|
@ -331,7 +320,6 @@ public class BookmarksPortletEditor
|
||||||
s_log.debug("START processWidgets");
|
s_log.debug("START processWidgets");
|
||||||
super.processWidgets(state, portlet);
|
super.processWidgets(state, portlet);
|
||||||
|
|
||||||
|
|
||||||
BookmarksPortlet myportlet = (BookmarksPortlet) portlet;
|
BookmarksPortlet myportlet = (BookmarksPortlet) portlet;
|
||||||
|
|
||||||
String titleText = (String) m_title.getValue(state);
|
String titleText = (String) m_title.getValue(state);
|
||||||
|
|
@ -340,18 +328,15 @@ public class BookmarksPortletEditor
|
||||||
|
|
||||||
ContentItem item = (ContentItem) contentItem.get(state);
|
ContentItem item = (ContentItem) contentItem.get(state);
|
||||||
String[] newWindowValue = (String[]) m_newWindow.getValue(state);
|
String[] newWindowValue = (String[]) m_newWindow.getValue(state);
|
||||||
String newWindow =
|
String newWindow = newWindowValue == null ? NEW_WINDOW_NO
|
||||||
newWindowValue == null ? NEW_WINDOW_NO : NEW_WINDOW_YES;
|
: NEW_WINDOW_YES;
|
||||||
|
|
||||||
Bookmark newBookmark;
|
Bookmark newBookmark;
|
||||||
|
|
||||||
if (m_bookmarkSelectionModel.isSelected(state)) {
|
if (m_bookmarkSelectionModel.isSelected(state)) {
|
||||||
newBookmark = m_bookmarkSelectionModel.getSelectedLink(state);
|
newBookmark = m_bookmarkSelectionModel.getSelectedLink(state);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
newBookmark = new Bookmark();
|
newBookmark = new Bookmark();
|
||||||
myportlet.addBookmark(newBookmark);
|
myportlet.addBookmark(newBookmark);
|
||||||
|
|
||||||
}
|
}
|
||||||
newBookmark.setTitle(titleText);
|
newBookmark.setTitle(titleText);
|
||||||
newBookmark.setDescription(descriptionText);
|
newBookmark.setDescription(descriptionText);
|
||||||
|
|
@ -359,16 +344,14 @@ public class BookmarksPortletEditor
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
newBookmark.setTargetType(Link.EXTERNAL_LINK);
|
newBookmark.setTargetType(Link.EXTERNAL_LINK);
|
||||||
newBookmark.setTargetURI(urlText);
|
newBookmark.setTargetURI(urlText);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
newBookmark.setTargetType(Link.INTERNAL_LINK);
|
newBookmark.setTargetType(Link.INTERNAL_LINK);
|
||||||
newBookmark.setTargetItem(item);
|
newBookmark.setTargetItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
m_bookmarkSelectionModel.clearSelection(state);
|
m_bookmarkSelectionModel.clearSelection(state);
|
||||||
s_log.debug("END processWidgets");
|
s_log.debug("END processWidgets");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?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"
|
prettyName="Personalised News Portlet"
|
||||||
version="1.0.1"
|
version="1.0.1"
|
||||||
release="1"
|
release="1"
|
||||||
|
|
@ -9,6 +9,9 @@
|
||||||
|
|
||||||
<ccm:dependencies>
|
<ccm:dependencies>
|
||||||
<ccm:requires name="ccm-cms-types-newsitem" version="6.1.0"/>
|
<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-ldn-portal" version="1.4.2"/>
|
||||||
<ccm:requires name="ccm-wsx-authentication" version="1.0.1"/>
|
<ccm:requires name="ccm-wsx-authentication" version="1.0.1"/>
|
||||||
|
|
|
||||||
|
|
@ -37,16 +37,17 @@ import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Provides configuration pane for NewsPortlet.
|
||||||
*
|
*
|
||||||
* @author Chris Gilbert (cgyg9330) <chris.gilbert@westsussex.gov.uk>
|
* @author Chris Gilbert (cgyg9330) <chris.gilbert@westsussex.gov.uk>
|
||||||
* @version $Id: NewsPortletEditor.java 2005/03/07 13:48:49 cgyg9330 Exp $
|
* @version $Id: NewsPortletEditor.java 2005/03/07 13:48:49 cgyg9330 Exp $
|
||||||
*/
|
*/
|
||||||
public class NewsPortletEditor extends PortletConfigFormSection {
|
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
|
* Constructor
|
||||||
|
|
@ -69,19 +70,16 @@ public class NewsPortletEditor extends PortletConfigFormSection {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Add widgets to the form containing the configuration options.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void addWidgets() {
|
protected void addWidgets() {
|
||||||
super.addWidgets();
|
super.addWidgets();
|
||||||
|
|
||||||
m_itemCount =
|
/* Define the number of news item to display */
|
||||||
new TextField(new StringParameter(NewsPortlet.ITEM_COUNT));
|
m_itemCount = new TextField(new StringParameter(NewsPortlet.ITEM_COUNT));
|
||||||
|
|
||||||
add(new Label("Number of items:", Label.BOLD), ColumnPanel.RIGHT);
|
add(new Label("Number of items:", Label.BOLD), ColumnPanel.RIGHT);
|
||||||
|
|
||||||
m_itemCount.addValidationListener(new IntegerValidationListener());
|
m_itemCount.addValidationListener(new IntegerValidationListener());
|
||||||
|
|
||||||
add(m_itemCount);
|
add(m_itemCount);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -102,9 +100,9 @@ public class NewsPortletEditor extends PortletConfigFormSection {
|
||||||
|
|
||||||
if (portlet != null) {
|
if (portlet != null) {
|
||||||
NewsPortlet myportlet = (NewsPortlet) portlet;
|
NewsPortlet myportlet = (NewsPortlet) portlet;
|
||||||
|
|
||||||
m_itemCount.setValue(state, myportlet.getItemCount()+ "");
|
m_itemCount.setValue(state, myportlet.getItemCount()+ "");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -125,4 +123,5 @@ public class NewsPortletEditor extends PortletConfigFormSection {
|
||||||
(String) m_itemCount.getValue(state)).intValue());
|
(String) m_itemCount.getValue(state)).intValue());
|
||||||
s_log.debug("END processWidgets");
|
s_log.debug("END processWidgets");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ import org.apache.log4j.Logger;
|
||||||
public class NewsPortletRenderer extends AbstractPortletRenderer
|
public class NewsPortletRenderer extends AbstractPortletRenderer
|
||||||
implements NewsConstants {
|
implements NewsConstants {
|
||||||
|
|
||||||
|
/** Private logger instance for debugging purpose */
|
||||||
private static final Logger s_log =
|
private static final Logger s_log =
|
||||||
Logger.getLogger(NewsPortletRenderer.class);
|
Logger.getLogger(NewsPortletRenderer.class);
|
||||||
|
|
||||||
|
|
@ -67,6 +68,7 @@ public class NewsPortletRenderer extends AbstractPortletRenderer
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param portlet
|
* @param portlet
|
||||||
*/
|
*/
|
||||||
|
|
@ -83,9 +85,10 @@ public class NewsPortletRenderer extends AbstractPortletRenderer
|
||||||
protected void generateBodyXML(PageState state, Element parent) {
|
protected void generateBodyXML(PageState state, Element parent) {
|
||||||
s_log.debug("START - generateBodyXML");
|
s_log.debug("START - generateBodyXML");
|
||||||
|
|
||||||
Element newsPortlet = parent.newChildElement( MAIN_PORTLET_ELEMENT,
|
Element newsPortlet = parent.newChildElement(MAIN_PORTLET_ELEMENT,
|
||||||
PortletType.PORTLET_XML_NS);
|
PortletType.PORTLET_XML_NS);
|
||||||
DateFormat formatter = new SimpleDateFormat("dd/MM/yy");
|
DateFormat formatter = new SimpleDateFormat("dd/MM/yy");
|
||||||
|
|
||||||
User thisUser = (User) Kernel.getContext().getParty();
|
User thisUser = (User) Kernel.getContext().getParty();
|
||||||
if (null == thisUser) {
|
if (null == thisUser) {
|
||||||
thisUser = Kernel.getPublicUser();
|
thisUser = Kernel.getPublicUser();
|
||||||
|
|
@ -94,13 +97,13 @@ public class NewsPortletRenderer extends AbstractPortletRenderer
|
||||||
// Object customUser = ExternalUserFactory.getCustomUserObject(thisUser);
|
// Object customUser = ExternalUserFactory.getCustomUserObject(thisUser);
|
||||||
// if (customUser instanceof PersonalisedNewsTarget) {
|
// if (customUser instanceof PersonalisedNewsTarget) {
|
||||||
// newsPortlet.addAttribute(PERSONALISED_ATTRIBUTE, "true");
|
// newsPortlet.addAttribute(PERSONALISED_ATTRIBUTE, "true");
|
||||||
// getPersonalisedNews(
|
// getPersonalisedNews(state,
|
||||||
// state,
|
|
||||||
// newsPortlet,
|
// newsPortlet,
|
||||||
// (PersonalisedNewsTarget) customUser,
|
// (PersonalisedNewsTarget) customUser,
|
||||||
// formatter);
|
// formatter);
|
||||||
//
|
//
|
||||||
// } else {
|
// } else {
|
||||||
|
|
||||||
newsPortlet.addAttribute(PERSONALISED_ATTRIBUTE, "false");
|
newsPortlet.addAttribute(PERSONALISED_ATTRIBUTE, "false");
|
||||||
getGeneralNews(newsPortlet, formatter);
|
getGeneralNews(newsPortlet, formatter);
|
||||||
|
|
||||||
|
|
@ -113,6 +116,7 @@ public class NewsPortletRenderer extends AbstractPortletRenderer
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* @param newsPortlet
|
* @param newsPortlet
|
||||||
* @param profiledUser
|
* @param profiledUser
|
||||||
*/
|
*/
|
||||||
|
|
@ -170,14 +174,14 @@ public class NewsPortletRenderer extends AbstractPortletRenderer
|
||||||
DomainCollection rssRoots = rss.getRootTerms();
|
DomainCollection rssRoots = rss.getRootTerms();
|
||||||
rssRoots.addEqualsFilter(Term.NAME, "News");
|
rssRoots.addEqualsFilter(Term.NAME, "News");
|
||||||
Term newsTerm = null;
|
Term newsTerm = null;
|
||||||
|
|
||||||
while (rssRoots.next()) {
|
while (rssRoots.next()) {
|
||||||
newsTerm = (Term) rssRoots.getDomainObject();
|
newsTerm = (Term) rssRoots.getDomainObject();
|
||||||
s_log.debug("found the news rss feed term");
|
s_log.debug("found the news rss feed term");
|
||||||
Category cat = newsTerm.getModel();
|
Category cat = newsTerm.getModel();
|
||||||
DataCollection newsItems = SessionManager.getSession()
|
DataCollection newsItems = SessionManager.getSession()
|
||||||
.retrieve(ContentPage.BASE_DATA_OBJECT_TYPE);
|
.retrieve(ContentPage.BASE_DATA_OBJECT_TYPE);
|
||||||
newsItems.addEqualsFilter("parent.categories.id",
|
newsItems.addEqualsFilter("parent.categories.id",cat.getID());
|
||||||
cat.getID());
|
|
||||||
|
|
||||||
newsItems.addEqualsFilter(ContentItem.VERSION, ContentItem.LIVE);
|
newsItems.addEqualsFilter(ContentItem.VERSION, ContentItem.LIVE);
|
||||||
newsItems.addOrder(ContentPage.LAUNCH_DATE + " desc");
|
newsItems.addOrder(ContentPage.LAUNCH_DATE + " desc");
|
||||||
|
|
@ -185,17 +189,16 @@ public class NewsPortletRenderer extends AbstractPortletRenderer
|
||||||
// CategorizedCollection newsItems =
|
// CategorizedCollection newsItems =
|
||||||
// cat.getObjects(ContentPage.BASE_DATA_OBJECT_TYPE);
|
// cat.getObjects(ContentPage.BASE_DATA_OBJECT_TYPE);
|
||||||
s_log.debug("total items = " + newsItems.size());
|
s_log.debug("total items = " + newsItems.size());
|
||||||
newsItems.setRange(
|
newsItems.setRange(new Integer(1),
|
||||||
new Integer(1),
|
|
||||||
new Integer(m_portlet.getItemCount() + 1));
|
new Integer(m_portlet.getItemCount() + 1));
|
||||||
|
|
||||||
ContentPage newsItem = null;
|
ContentPage newsItem = null;
|
||||||
while (newsItems.next()) {
|
while (newsItems.next()) {
|
||||||
Element item =
|
Element item = main.newChildElement(NEWS_ITEM_ELEMENT, XML_NEWS_NS);
|
||||||
main.newChildElement(NEWS_ITEM_ELEMENT, XML_NEWS_NS);
|
|
||||||
//newsItem = (ContentPage) newsItems.getDomainObject();
|
//newsItem = (ContentPage) newsItems.getDomainObject();
|
||||||
newsItem = (ContentPage)DomainObjectFactory
|
newsItem = (ContentPage)DomainObjectFactory
|
||||||
.newInstance(newsItems.getDataObject());
|
.newInstance(newsItems.getDataObject());
|
||||||
|
|
||||||
Date d = newsItem.getLaunchDate();
|
Date d = newsItem.getLaunchDate();
|
||||||
String date = (d != null) ? formatter.format(d) : "";
|
String date = (d != null) ? formatter.format(d) : "";
|
||||||
item.addAttribute(DATE_ATTRIBUTE, date);
|
item.addAttribute(DATE_ATTRIBUTE, date);
|
||||||
|
|
@ -203,8 +206,7 @@ public class NewsPortletRenderer extends AbstractPortletRenderer
|
||||||
item.addAttribute(TITLE_ATTRIBUTE, newsItem.getTitle());
|
item.addAttribute(TITLE_ATTRIBUTE, newsItem.getTitle());
|
||||||
|
|
||||||
item.addAttribute(LEAD_ATTRIBUTE, newsItem.getSearchSummary());
|
item.addAttribute(LEAD_ATTRIBUTE, newsItem.getSearchSummary());
|
||||||
item.addAttribute(
|
item.addAttribute(URL_ATTRIBUTE,
|
||||||
URL_ATTRIBUTE,
|
|
||||||
Navigation.redirectURL(newsItem.getOID()));
|
Navigation.redirectURL(newsItem.getOID()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -214,39 +216,34 @@ public class NewsPortletRenderer extends AbstractPortletRenderer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public Object getCacheKey() {
|
public Object getCacheKey() {
|
||||||
|
|
||||||
if (getProfiledUser() == null) {
|
if (getProfiledUser() == null) {
|
||||||
return GENERAL_NEWS_CACHE_KEY;
|
return GENERAL_NEWS_CACHE_KEY;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
||||||
return m_portlet.getID();
|
return m_portlet.getID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// is dirty if edited, as this means the number of entries has changed.
|
// is dirty if edited, as this means the number of entries has changed.
|
||||||
// For non personalised news, dirty if homepage
|
// For non personalised news, dirty if homepage
|
||||||
// newsitems are added or edited.
|
// newsitems are added or edited.
|
||||||
// For personalised, dirty if pushed items added or edited.
|
// For personalised, dirty if pushed items added or edited.
|
||||||
|
|
||||||
public boolean isDirty() {
|
public boolean isDirty() {
|
||||||
|
|
||||||
|
|
||||||
// has it been edited? - add in this condition when response
|
// has it been edited? - add in this condition when response
|
||||||
// from Redhat about AbstractPortletRenderer
|
// from Redhat about AbstractPortletRenderer
|
||||||
|
|
||||||
// if not has news changed
|
// if not has news changed
|
||||||
if (getCacheKey().equals(GENERAL_NEWS_CACHE_KEY)) {
|
if (getCacheKey().equals(GENERAL_NEWS_CACHE_KEY)) {
|
||||||
isDirty = m_portlet.isNewNews();
|
isDirty = m_portlet.isNewNews();
|
||||||
s_log.debug("general news: dirty? " + isDirty);
|
s_log.debug("general news: dirty? " + isDirty);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// implement later
|
// implement later
|
||||||
isDirty = true;
|
isDirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return isDirty;
|
return isDirty;
|
||||||
*/
|
*/
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue