diff --git a/ccm-forum/src/com/arsdigita/forum/ui/ForumResources.properties b/ccm-forum/src/com/arsdigita/forum/ForumResources.properties similarity index 100% rename from ccm-forum/src/com/arsdigita/forum/ui/ForumResources.properties rename to ccm-forum/src/com/arsdigita/forum/ForumResources.properties diff --git a/ccm-forum/src/com/arsdigita/forum/ui/ForumResources_de.properties b/ccm-forum/src/com/arsdigita/forum/ForumResources_de.properties similarity index 100% rename from ccm-forum/src/com/arsdigita/forum/ui/ForumResources_de.properties rename to ccm-forum/src/com/arsdigita/forum/ForumResources_de.properties diff --git a/ccm-forum/src/com/arsdigita/forum/ui/ForumResources_fr.properties b/ccm-forum/src/com/arsdigita/forum/ForumResources_fr.properties similarity index 100% rename from ccm-forum/src/com/arsdigita/forum/ui/ForumResources_fr.properties rename to ccm-forum/src/com/arsdigita/forum/ForumResources_fr.properties diff --git a/ccm-forum/src/com/arsdigita/forum/ThreadPageBuilder.java b/ccm-forum/src/com/arsdigita/forum/ThreadPageBuilder.java index 508cedfc3..f8c34fe92 100644 --- a/ccm-forum/src/com/arsdigita/forum/ThreadPageBuilder.java +++ b/ccm-forum/src/com/arsdigita/forum/ThreadPageBuilder.java @@ -54,7 +54,7 @@ public class ThreadPageBuilder implements PageBuilder, Constants { Page threadPage = PageFactory.buildPage(Constants.FORUM_XML_PREFIX, "Threads", "forumThreadPage"); - //Output the title in an easy to find place + //Output the forum title and introduction test in an easy to find place threadPage.add(new SimpleComponent(){ @Override diff --git a/ccm-forum/src/com/arsdigita/forum/ui/AttachedFilesStep.java b/ccm-forum/src/com/arsdigita/forum/ui/AttachedFilesStep.java index a4dc24d64..c7cb800fd 100644 --- a/ccm-forum/src/com/arsdigita/forum/ui/AttachedFilesStep.java +++ b/ccm-forum/src/com/arsdigita/forum/ui/AttachedFilesStep.java @@ -18,6 +18,7 @@ */ package com.arsdigita.forum.ui; +import com.arsdigita.forum.util.GlobalizationUtil; import java.io.File; import java.math.BigDecimal; import java.util.ArrayList; @@ -63,13 +64,14 @@ import com.arsdigita.util.Assert; import com.arsdigita.xml.Element; /** - * @author Chris Gilbert chris.gilbert@westsussex.gov.uk - * - * Wizard step to attach files to a post. This step may be bypassed - * if a forum administrator changes the forum settings on the UI + * Wizard step to attach files to a post. This step may be bypassed if a forum + * administrator changes the forum settings on the UI. * * nb - a simpler reuseable generic wizard file attachments step has been created - * forum will be refactored to use it in the future. see ccm-wsx-wizard-steps in contrib + * forum will be refactored to use it in the future. + * see ccm-wsx-wizard-steps in contrib + * + * @author Chris Gilbert chris.gilbert@westsussex.gov.uk */ public class AttachedFilesStep extends FormStep @@ -104,7 +106,7 @@ public class AttachedFilesStep m_upload = new FileUpload("file", true); m_upload.addValidationListener(new NotEmptyValidationListener( - Text + GlobalizationUtil .gz("forum.ui.validation.file_null")) { public void validate(ParameterEvent e) { // don't fire validation if the next or previous button of the wizard has been pressed @@ -121,12 +123,10 @@ public class AttachedFilesStep m_description = new TextArea("fileDescription"); m_description.setCols(20); m_description.setRows(5); - - m_description - .addValidationListener(new StringInRangeValidationListener( + m_description.addValidationListener(new StringInRangeValidationListener( 0, 4000, - Text.gz("forum.ui.validation.file_description_too_long")) { + GlobalizationUtil.gz("forum.ui.validation.file_description_too_long")) { public void validate(ParameterEvent e) throws FormProcessException { // don't fire validation if the next or previous button of the wizard has been pressed @@ -209,9 +209,8 @@ public class AttachedFilesStep if (!m_addFile.isSelected(state) && StringUtils.isNotBlank((String) m_upload.getValue(state))) { throw new FormProcessException( - (String) Text - .gz("forum.ui.validation.file_not_uploaded") - .localize()); + (String) GlobalizationUtil.gzAsStr( + "forum.ui.validation.file_not_uploaded")); } } @@ -304,6 +303,7 @@ public class AttachedFilesStep } + @Override public void register(Page p) { super.register(p); diff --git a/ccm-forum/src/com/arsdigita/forum/ui/CategoryWidget.java b/ccm-forum/src/com/arsdigita/forum/ui/CategoryWidget.java index b1e4b9ff8..b6be6626e 100755 --- a/ccm-forum/src/com/arsdigita/forum/ui/CategoryWidget.java +++ b/ccm-forum/src/com/arsdigita/forum/ui/CategoryWidget.java @@ -18,6 +18,7 @@ */ package com.arsdigita.forum.ui; +import com.arsdigita.forum.util.GlobalizationUtil; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.Label; import com.arsdigita.bebop.event.PrintEvent; @@ -58,7 +59,7 @@ public class CategoryWidget extends SingleSelect implements Constants { if (forum.noCategoryPostsAllowed()) { target.addOption(new Option( TOPIC_NONE.toString(), - new Label(Text.gz("forum.ui.topic.none")))); + new Label(GlobalizationUtil.gz("forum.ui.topic.none")))); } final Category root = forum.getRootCategory(); if (root != null) { diff --git a/ccm-forum/src/com/arsdigita/forum/ui/DiscussionThreadSimpleView.java b/ccm-forum/src/com/arsdigita/forum/ui/DiscussionThreadSimpleView.java index 093618c09..a569db89b 100755 --- a/ccm-forum/src/com/arsdigita/forum/ui/DiscussionThreadSimpleView.java +++ b/ccm-forum/src/com/arsdigita/forum/ui/DiscussionThreadSimpleView.java @@ -18,6 +18,7 @@ */ package com.arsdigita.forum.ui; +import com.arsdigita.forum.util.GlobalizationUtil; import com.arsdigita.forum.ForumContext; import com.arsdigita.forum.Post; import com.arsdigita.forum.ThreadSubscription; @@ -81,7 +82,7 @@ public class DiscussionThreadSimpleView extends ModalContainer implements Consta private ACSObjectSelectionModel m_postModel; /** - * Default Constructor creates the component of the discussio view. + * Default Constructor creates the component of the discussion view. * The discussion page contains three components: a MessageList, * a ThreadEdit component, and a ThreadReply component. * @@ -94,7 +95,7 @@ public class DiscussionThreadSimpleView extends ModalContainer implements Consta } /** - * Internal helper method for constructor + * Internal helper method for constructor. * Add the thread components to the modal container and maintain * references for event manipulation purposes. */ @@ -117,7 +118,8 @@ public class DiscussionThreadSimpleView extends ModalContainer implements Consta Constants.FORUM_XML_NS); // Offer links to return to index or control alerts. - Link returnLink = new Link(new Label(Text.gz("forum.ui.thread.viewAll")), + Link returnLink = new Link(new Label(GlobalizationUtil.gz( + "forum.ui.thread.viewAll")), "index.jsp"); returnLink.setClassAttr("actionLink"); linksPanel.add(returnLink); @@ -166,7 +168,6 @@ public class DiscussionThreadSimpleView extends ModalContainer implements Consta /** * Creates the component for viewing a thread. */ - private final void addForm(final Form form) { add(form); form.addCompletionListener(new ActionListener() { @@ -190,9 +191,13 @@ public class DiscussionThreadSimpleView extends ModalContainer implements Consta + /** + * + * @return + */ private Component createThreadSubscribeLink() { ActionLink subscribeLink = new ActionLink( - new Label(Text.gz("forum.ui.thread.subscribe"))) { + new Label(GlobalizationUtil.gz("forum.ui.thread.subscribe"))) { public boolean isVisible(PageState s) { Party party = Kernel.getContext().getParty(); @@ -223,9 +228,13 @@ public class DiscussionThreadSimpleView extends ModalContainer implements Consta return subscribeLink; } + /** + * + * @return + */ private Component createThreadUnsubscribeLink() { ActionLink unsubscribeLink = new ActionLink( - new Label(Text.gz("forum.ui.thread.unsubscribe"))) { + new Label(GlobalizationUtil.gz("forum.ui.thread.unsubscribe"))) { @Override public boolean isVisible(PageState s) { Party party = Kernel.getContext().getParty(); @@ -259,10 +268,19 @@ public class DiscussionThreadSimpleView extends ModalContainer implements Consta return unsubscribeLink; } + /** + * + * @return + */ private final ACSObjectSelectionModel getPostModel() { return m_postModel; } + /** + * + * @param state + * @return + */ private MessageThread getCurrentMessage(PageState state) { return ForumContext.getContext(state).getMessageThread(); } diff --git a/ccm-forum/src/com/arsdigita/forum/ui/ForumAlertsView.java b/ccm-forum/src/com/arsdigita/forum/ui/ForumAlertsView.java index 018ba0c75..74e81e839 100755 --- a/ccm-forum/src/com/arsdigita/forum/ui/ForumAlertsView.java +++ b/ccm-forum/src/com/arsdigita/forum/ui/ForumAlertsView.java @@ -19,6 +19,7 @@ package com.arsdigita.forum.ui; +import com.arsdigita.forum.util.GlobalizationUtil; import com.arsdigita.bebop.ColumnPanel; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Form; @@ -85,19 +86,19 @@ class ForumAlertsView extends SimpleContainer implements Constants { Form alertsForm = new Form("instantAlerts", new ColumnPanel(2)); final RadioGroup instant = new RadioGroup("instant"); - instant.addOption(new Option(Text.gzAsStr("forum.ui.yes"))); - instant.addOption(new Option(Text.gzAsStr("forum.ui.no"))); - alertsForm.add(new Label(Text.gz("forum.ui.receive_instant_alerts"))); + instant.addOption(new Option(GlobalizationUtil.gzAsStr("forum.ui.yes"))); + instant.addOption(new Option(GlobalizationUtil.gzAsStr("forum.ui.no"))); + alertsForm.add(new Label(GlobalizationUtil.gz("forum.ui.receive_instant_alerts"))); alertsForm.add(instant); final RadioGroup daily = new RadioGroup("daily"); - daily.addOption(new Option(Text.gzAsStr("forum.ui.yes"))); - daily.addOption(new Option(Text.gzAsStr("forum.ui.no"))); - alertsForm.add(new Label(Text.gz("forum.ui.receive_daily_summary"))); + daily.addOption(new Option(GlobalizationUtil.gzAsStr("forum.ui.yes"))); + daily.addOption(new Option(GlobalizationUtil.gzAsStr("forum.ui.no"))); + alertsForm.add(new Label(GlobalizationUtil.gz("forum.ui.receive_daily_summary"))); alertsForm.add(daily); alertsForm.add(new Label("")); - alertsForm.add(new Submit(Text.gz("forum.ui.save"))); + alertsForm.add(new Submit(GlobalizationUtil.gz("forum.ui.save"))); alertsForm.addInitListener(new FormInitListener() { public void init(FormSectionEvent e) { @@ -109,17 +110,17 @@ class ForumAlertsView extends SimpleContainer implements Constants { ForumSubscription fSub = ForumSubscription.getFromForum(forum); if (fSub.isSubscribed(party)) { - instant.setValue(s,Text.gzAsStr("forum.ui.yes")); + instant.setValue(s,GlobalizationUtil.gzAsStr("forum.ui.yes")); } else { - instant.setValue(s, Text.gzAsStr("forum.ui.no")); + instant.setValue(s, GlobalizationUtil.gzAsStr("forum.ui.no")); } DailySubscription dSub = (DailySubscription) DailySubscription.getFromForum(forum); if (dSub.isSubscribed(party)) { - daily.setValue(s,Text.gzAsStr("forum.ui.yes")); + daily.setValue(s,GlobalizationUtil.gzAsStr("forum.ui.yes")); } else { - daily.setValue(s, Text.gzAsStr("forum.ui.no")); + daily.setValue(s, GlobalizationUtil.gzAsStr("forum.ui.no")); } } }); @@ -138,9 +139,9 @@ class ForumAlertsView extends SimpleContainer implements Constants { DailySubscription dSub = (DailySubscription) DailySubscription.getFromForum(forum); - if (data.get("instant").equals(Text.gzAsStr("forum.ui.yes"))) { + if (data.get("instant").equals(GlobalizationUtil.gzAsStr("forum.ui.yes"))) { fSub.subscribe(party); - } else if (data.get("instant").equals(Text.gzAsStr("forum.ui.no"))) { + } else if (data.get("instant").equals(GlobalizationUtil.gzAsStr("forum.ui.no"))) { fSub.unsubscribe(party); } else { throw new FormProcessException( @@ -149,9 +150,9 @@ class ForumAlertsView extends SimpleContainer implements Constants { } fSub.save(); - if (data.get("daily").equals(Text.gzAsStr("forum.ui.yes"))) { + if (data.get("daily").equals(GlobalizationUtil.gzAsStr("forum.ui.yes"))) { dSub.subscribe(party); - } else if (data.get("daily").equals(Text.gzAsStr("forum.ui.no"))) { + } else if (data.get("daily").equals(GlobalizationUtil.gzAsStr("forum.ui.no"))) { dSub.unsubscribe(party); } else { throw new FormProcessException( @@ -180,7 +181,7 @@ class ForumAlertsView extends SimpleContainer implements Constants { new ArrayParameter(new BigDecimalParameter("delete"))); form.add(boxes); - form.add(new Submit(Text.gz("forum.ui.delete")), + form.add(new Submit(GlobalizationUtil.gz("forum.ui.delete")), FULL_WIDTH | RIGHT); form.addProcessListener(new DeleteProcesser()); diff --git a/ccm-forum/src/com/arsdigita/forum/ui/ForumUserCompactView.java b/ccm-forum/src/com/arsdigita/forum/ui/ForumUserCompactView.java index eeba660b9..45a5af81c 100755 --- a/ccm-forum/src/com/arsdigita/forum/ui/ForumUserCompactView.java +++ b/ccm-forum/src/com/arsdigita/forum/ui/ForumUserCompactView.java @@ -18,6 +18,7 @@ */ package com.arsdigita.forum.ui; +import com.arsdigita.forum.util.GlobalizationUtil; import java.io.IOException; import javax.servlet.ServletException; @@ -265,42 +266,42 @@ public class ForumUserCompactView extends ModalContainer implements Constants { // jensp 2011-10-02: Additional logic added if (forum.isPublic()) { generateModeXML(state, content, MODE_THREADS, - Text.gz("forum.ui.modeThreads")); + GlobalizationUtil.gz("forum.ui.modeThreads")); } else { if (PermissionService.checkPermission(readPermission)) { generateModeXML(state, content, MODE_THREADS, - Text.gz("forum.ui.modeThreads")); + GlobalizationUtil.gz("forum.ui.modeThreads")); } } // topics panel is always shown as well if not restricted to admins. if (!Forum.getConfig().topicCreationByAdminOnly()) { generateModeXML(state, content, MODE_TOPICS, - Text.gz("forum.ui.modeTopics")); + GlobalizationUtil.gz("forum.ui.modeTopics")); } // alerts panel is always shown as well, no private read access avail. generateModeXML(state, content, MODE_ALERTS, - Text.gz("forum.ui.modeAlerts")); + GlobalizationUtil.gz("forum.ui.modeAlerts")); // admin section if (PermissionService.checkPermission(adminPermission)) { // generateModeXML(state, content, MODE_MODERATION, -// Text.gz("forum.ui.modeAlerts")); +// GlobalizationUtil.gz("forum.ui.modeAlerts")); if (Forum.getConfig().showNewTabs()) { generateModeXML(state, content, MODE_SETUP, - Text.gz("forum.ui.modeSetup")); + GlobalizationUtil.gz("forum.ui.modeSetup")); generateModeXML(state, content, MODE_PERMISSIONS, - Text.gz("forum.ui.modePermissions")); + GlobalizationUtil.gz("forum.ui.modePermissions")); } else { // Generate old moderation panel instead of setup generateModeXML(state, content, MODE_MODERATION, - Text.gz("forum.ui.modeAlerts")); + GlobalizationUtil.gz("forum.ui.modeAlerts")); } // In case topic creation is bound to admin (and therefore not // created above) we must create xml here. if (Forum.getConfig().topicCreationByAdminOnly()) { generateModeXML(state, content, MODE_TOPICS, - Text.gz("forum.ui.modeTopics")); + GlobalizationUtil.gz("forum.ui.modeTopics")); } } } diff --git a/ccm-forum/src/com/arsdigita/forum/ui/ImagesStep.java b/ccm-forum/src/com/arsdigita/forum/ui/ImagesStep.java index 4dbca4eae..dee96c42b 100644 --- a/ccm-forum/src/com/arsdigita/forum/ui/ImagesStep.java +++ b/ccm-forum/src/com/arsdigita/forum/ui/ImagesStep.java @@ -18,6 +18,7 @@ */ package com.arsdigita.forum.ui; +import com.arsdigita.forum.util.GlobalizationUtil; import java.io.File; import java.math.BigDecimal; import java.util.ArrayList; @@ -101,7 +102,7 @@ public class ImagesStep m_upload = new FileUpload("image", true); m_upload .addValidationListener(new NotEmptyValidationListener( - Text + GlobalizationUtil .gz("forum.ui.validation.image_file_null")) { public void validate(ParameterEvent e) { if (m_addImage.isSelected(e.getPageState())) { @@ -126,7 +127,7 @@ public class ImagesStep m_description.setRows(5); m_description .addValidationListener(new NotEmptyValidationListener( - Text + GlobalizationUtil .gz("forum.ui.validation.image_description_null")) { public void validate(ParameterEvent e) { if (m_addImage.isSelected(e.getPageState())) { @@ -138,7 +139,7 @@ public class ImagesStep .addValidationListener(new StringInRangeValidationListener( 0, 4000, - Text.gz("forum.ui.validation.image_description_too_long")) { + GlobalizationUtil.gz("forum.ui.validation.image_description_too_long")) { public void validate(ParameterEvent e) throws FormProcessException { if (m_addImage.isSelected(e.getPageState())) { @@ -218,7 +219,7 @@ public class ImagesStep if (!m_addImage.isSelected(state) && StringUtils.isNotBlank((String) m_upload.getValue(state))) { throw new FormProcessException( - (String) Text + (String) GlobalizationUtil .gz("forum.ui.validation.image_not_uploaded") .localize()); } diff --git a/ccm-forum/src/com/arsdigita/forum/ui/PostTextStep.java b/ccm-forum/src/com/arsdigita/forum/ui/PostTextStep.java index a7f4f71a6..de5f7e45b 100644 --- a/ccm-forum/src/com/arsdigita/forum/ui/PostTextStep.java +++ b/ccm-forum/src/com/arsdigita/forum/ui/PostTextStep.java @@ -18,6 +18,7 @@ */ package com.arsdigita.forum.ui; +import com.arsdigita.forum.util.GlobalizationUtil; import java.text.DateFormat; import java.util.Date; @@ -81,7 +82,7 @@ public abstract class PostTextStep extends FormStep implements Constants { m_subject = new TextField(new StringParameter("subject")); m_subject.addValidationListener( new NotEmptyValidationListener( - Text.gz("forum.ui.validation.subject_null"))); + GlobalizationUtil.gz("forum.ui.validation.subject_null"))); m_subject.setMaxLength(250); m_subject.setSize(60); add(m_subject); @@ -114,7 +115,7 @@ public abstract class PostTextStep extends FormStep implements Constants { m_body.addValidationListener( new NotEmptyValidationListener( - Text.gz("forum.ui.validation.body_null"))); + GlobalizationUtil.gz("forum.ui.validation.body_null"))); add(m_body); diff --git a/ccm-forum/src/com/arsdigita/forum/ui/ThreadsPanel.java b/ccm-forum/src/com/arsdigita/forum/ui/ThreadsPanel.java index f286f8a93..b346dcfff 100755 --- a/ccm-forum/src/com/arsdigita/forum/ui/ThreadsPanel.java +++ b/ccm-forum/src/com/arsdigita/forum/ui/ThreadsPanel.java @@ -18,6 +18,7 @@ */ package com.arsdigita.forum.ui; +import com.arsdigita.forum.util.GlobalizationUtil; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Container; // import com.arsdigita.bebop.Form; @@ -143,7 +144,7 @@ public class ThreadsPanel extends SimpleContainer Container forumOptions = new SimpleContainer( FORUM_XML_PREFIX + ":forumOptions", Constants.FORUM_XML_NS); // XXX APLAWS standard theme currently (2010-09) does not use the label! - m_newThreadLink = new ToggleLink(new Label(Text.gz("forum.ui.thread.newPost"))); + m_newThreadLink = new ToggleLink(new Label(GlobalizationUtil.gz("forum.ui.thread.newPost"))); m_newThreadLink.setClassAttr("actionLink"); // chris.gilbert@westsussex.gov.uk - security container added diff --git a/ccm-forum/src/com/arsdigita/forum/ui/TopicAddForm.java b/ccm-forum/src/com/arsdigita/forum/ui/TopicAddForm.java index b8b689071..5aa4cbeba 100755 --- a/ccm-forum/src/com/arsdigita/forum/ui/TopicAddForm.java +++ b/ccm-forum/src/com/arsdigita/forum/ui/TopicAddForm.java @@ -20,6 +20,7 @@ package com.arsdigita.forum.ui; +import com.arsdigita.forum.util.GlobalizationUtil; import com.arsdigita.bebop.Form; import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormProcessException; @@ -72,12 +73,12 @@ public class TopicAddForm extends Form { super("categoryAdd"); setRedirecting(true); // clear form and redirect back - add(new Label(Text.gz("forum.ui.topic.name"))); + add(new Label(GlobalizationUtil.gz("forum.ui.topic.name"))); m_name = new TextField("name"); m_name.addValidationListener(new NotNullValidationListener()); add(m_name); - add(new Label(Text.gz("forum.ui.topic.description"))); + add(new Label(GlobalizationUtil.gz("forum.ui.topic.description"))); m_description = new TextArea("description"); m_description.setRows(5); m_description.setCols(60); @@ -87,8 +88,8 @@ public class TopicAddForm extends Form { // Cancel button added cg // Would have used a saveCancel section but this would make existing // stylesheets for legacy forums miss the buttons - Submit submit = new Submit(Text.gz("forum.ui.topic.save")); - final Submit cancel = new Submit(Text.gz("forum.ui.cancel")); + Submit submit = new Submit(GlobalizationUtil.gz("forum.ui.topic.save")); + final Submit cancel = new Submit(GlobalizationUtil.gz("forum.ui.cancel")); add(submit); add(cancel); addSubmissionListener(new FormSubmissionListener(){ diff --git a/ccm-forum/src/com/arsdigita/forum/ui/TopicsPanel.java b/ccm-forum/src/com/arsdigita/forum/ui/TopicsPanel.java index 8eecf5bca..3ee1fcd4a 100755 --- a/ccm-forum/src/com/arsdigita/forum/ui/TopicsPanel.java +++ b/ccm-forum/src/com/arsdigita/forum/ui/TopicsPanel.java @@ -18,6 +18,7 @@ */ package com.arsdigita.forum.ui; +import com.arsdigita.forum.util.GlobalizationUtil; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Container; import com.arsdigita.bebop.Form; @@ -131,7 +132,7 @@ public class TopicsPanel extends SimpleContainer Constants.FORUM_XML_PREFIX + ":topicOptions", Constants.FORUM_XML_NS); m_addNewTopicLink = new ToggleLink( - new Label(Text.gz("forum.ui.topic.newTopic"))); + new Label(GlobalizationUtil.gz("forum.ui.topic.newTopic"))); m_addNewTopicLink.setClassAttr("actionLink"); linksPanel.add(m_addNewTopicLink); // add to component diff --git a/ccm-forum/src/com/arsdigita/forum/ui/admin/ModerationFormSection.java b/ccm-forum/src/com/arsdigita/forum/ui/admin/ModerationFormSection.java index 002287d8d..e13a59c6d 100755 --- a/ccm-forum/src/com/arsdigita/forum/ui/admin/ModerationFormSection.java +++ b/ccm-forum/src/com/arsdigita/forum/ui/admin/ModerationFormSection.java @@ -31,7 +31,7 @@ import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.forum.Forum; import com.arsdigita.forum.ForumContext; -import com.arsdigita.forum.ui.Text; +import com.arsdigita.forum.util.GlobalizationUtil; import org.apache.log4j.Logger; @@ -59,24 +59,24 @@ public class ModerationFormSection extends FormSection { public void addWidgets() { add(new Label( - Text.gz("forum.ui.moderate.label"))); + GlobalizationUtil.gz("forum.ui.moderate.label"))); m_statusOn = new Label( - Text.gz("forum.ui.moderate.status.on")); + GlobalizationUtil.gz("forum.ui.moderate.status.on")); m_statusOff = new Label( - Text.gz("forum.ui.moderate.status.off")); + GlobalizationUtil.gz("forum.ui.moderate.status.off")); add(m_statusOn); add(m_statusOff); m_switchOn = new Submit( - Text.gz("forum.ui.moderate.switch.on")); + GlobalizationUtil.gz("forum.ui.moderate.switch.on")); m_switchOff = new Submit( - Text.gz("forum.ui.moderate.switch.off")); + GlobalizationUtil.gz("forum.ui.moderate.switch.off")); add(m_switchOn); add(m_switchOff); m_warning = new Label( - Text.gz("forum.ui.moderate.warning")); + GlobalizationUtil.gz("forum.ui.moderate.warning")); add(m_warning, ColumnPanel.FULL_WIDTH); } diff --git a/ccm-forum/src/com/arsdigita/forum/ui/admin/NoticeboardFormSection.java b/ccm-forum/src/com/arsdigita/forum/ui/admin/NoticeboardFormSection.java index 2614946b4..87babc5c9 100755 --- a/ccm-forum/src/com/arsdigita/forum/ui/admin/NoticeboardFormSection.java +++ b/ccm-forum/src/com/arsdigita/forum/ui/admin/NoticeboardFormSection.java @@ -31,7 +31,7 @@ import com.arsdigita.bebop.form.TextField; import com.arsdigita.bebop.parameters.IntegerParameter; import com.arsdigita.forum.Forum; import com.arsdigita.forum.ForumContext; -import com.arsdigita.forum.ui.Text; +import com.arsdigita.forum.util.GlobalizationUtil; import org.apache.log4j.Logger; /** @@ -60,27 +60,27 @@ public class NoticeboardFormSection extends FormSection { public void addWidgets() { add(new Label( - Text.gz("forum.ui.noticeboard.label"))); + GlobalizationUtil.gz("forum.ui.noticeboard.label"))); m_statusOn = new Label( - Text.gz("forum.ui.noticeboard.status.on")); + GlobalizationUtil.gz("forum.ui.noticeboard.status.on")); m_statusOff = new Label( - Text.gz("forum.ui.noticeboard.status.off")); + GlobalizationUtil.gz("forum.ui.noticeboard.status.off")); add(m_statusOn); add(m_statusOff); m_switchOn = new Submit( - Text.gz("forum.ui.noticeboard.switch.on")); + GlobalizationUtil.gz("forum.ui.noticeboard.switch.on")); m_switchOff = new Submit( - Text.gz("forum.ui.noticeboard.switch.off")); + GlobalizationUtil.gz("forum.ui.noticeboard.switch.off")); add(m_switchOn); add(m_switchOff); m_expiryLabel = new Label( - Text.gz("forum.ui.noticeboard.expiry_after")); + GlobalizationUtil.gz("forum.ui.noticeboard.expiry_after")); m_expiry = new TextField(new IntegerParameter("expiry")); m_changeExpiry = new Submit( - Text.gz("forum.ui.noticeboard.change_expiry")); + GlobalizationUtil.gz("forum.ui.noticeboard.change_expiry")); add(m_expiryLabel); add(m_expiry); add(m_changeExpiry); diff --git a/ccm-forum/src/com/arsdigita/forum/ui/admin/SetupView.java b/ccm-forum/src/com/arsdigita/forum/ui/admin/SetupView.java index ebad9277e..34c9549e9 100644 --- a/ccm-forum/src/com/arsdigita/forum/ui/admin/SetupView.java +++ b/ccm-forum/src/com/arsdigita/forum/ui/admin/SetupView.java @@ -45,19 +45,18 @@ import com.arsdigita.bebop.parameters.StringInRangeValidationListener; import com.arsdigita.forum.Forum; import com.arsdigita.forum.ForumContext; import com.arsdigita.forum.ui.Constants; -import com.arsdigita.forum.ui.Text; +import com.arsdigita.forum.util.GlobalizationUtil; import com.arsdigita.web.Application; import org.apache.log4j.Logger; /** - * form that allows forum admin to set options + * Form that allows forum admin to set options * that apply to this forum instance */ -public class SetupView - extends Form - implements FormInitListener, FormSubmissionListener, FormProcessListener, - Constants { +public class SetupView extends Form + implements FormInitListener, FormSubmissionListener, + FormProcessListener, Constants { private static final Logger s_log = Logger.getLogger(SetupView.class); // values for checkboxes @@ -69,65 +68,84 @@ public class SetupView private static final String AUTOSUBSCRIBE_THREAD_STARTERS = "autosubscribe"; private static final String NO_CATEGORY_POSTS_ALLOWED = "nocategory"; private static final String ANONYMOUS_POSTS_ALLOWED = "anonymous"; + private CheckboxGroup m_settings; private TextField m_expiry; private SaveCancelSection m_saveCancel; private TextArea m_introduction; private TextField m_title; + /** + * Constructor to create the setup panel. + */ public SetupView() { super("setupForm", new SimpleContainer("forum:setup", FORUM_XML_NS)); + + // preliminary step 1: Create a group of options to determine various + // properties of this forum m_settings = new CheckboxGroup("settings"); - m_settings.addOption( - new Option( - MODERATED, - (String) Text.gz("forum.ui.settings.moderated").localize())); - m_settings.addOption( - new Option(PUBLIC, - (String) Text.gz("forum.ui.settings.public").localize())); - m_settings.addOption( - new Option( - NOTICEBOARD, - (String) Text.gz("forum.ui.settings.noticeboard"). - localize())); - m_settings.addOption( - new Option( - ALLOW_FILES, - (String) Text.gz("forum.ui.settings.allowFiles").localize())); - m_settings.addOption( - new Option( - ALLOW_IMAGES, - (String) Text.gz("forum.ui.settings.allowImages").localize())); - m_settings.addOption( - new Option( - AUTOSUBSCRIBE_THREAD_STARTERS, - (String) Text.gz("forum.ui.settings.autosubscribe").localize())); - - m_settings.addOption( - new Option( - NO_CATEGORY_POSTS_ALLOWED, - (String) Text.gz("forum.ui.settings.noCategoryPosts").localize())); - m_settings.addOption( - new Option( - ANONYMOUS_POSTS_ALLOWED, - (String) Text.gz("forum.ui.settings.anonymousPosts").localize())); + m_settings.addOption(new Option(MODERATED, + new Label(GlobalizationUtil.gz( + "forum.ui.settings.moderated")) + )); + m_settings.addOption(new Option(PUBLIC, + new Label( GlobalizationUtil.gz( + "forum.ui.settings.public")) + )); + m_settings.addOption(new Option(NOTICEBOARD, + new Label(GlobalizationUtil.gz( + "forum.ui.settings.noticeboard")) + )); + m_settings.addOption(new Option(ALLOW_FILES, + new Label(GlobalizationUtil.gz( + "forum.ui.settings.allowFiles")) + )); + m_settings.addOption(new Option(ALLOW_IMAGES, + new Label(GlobalizationUtil.gz( + "forum.ui.settings.allowImages")) + )); + m_settings.addOption(new Option(AUTOSUBSCRIBE_THREAD_STARTERS, + new Label(GlobalizationUtil.gz( + "forum.ui.settings.autosubscribe")) + )); + m_settings.addOption(new Option(NO_CATEGORY_POSTS_ALLOWED, + new Label(GlobalizationUtil.gz( + "forum.ui.settings.noCategoryPosts")) + )); + m_settings.addOption(new Option(ANONYMOUS_POSTS_ALLOWED, + new Label(GlobalizationUtil.gz( + "forum.ui.settings.anonymousPosts")) + )); + // preliminary step 2: Create a widget to determin the expiration limit + // for the forum GUI m_expiry = new TextField(new IntegerParameter("expiry")); - m_expiry.setMetaDataAttribute("label", (String) Text.gz( + m_expiry.setMetaDataAttribute("label", (String) GlobalizationUtil.gz( "forum.ui.noticeboard.expiry_after").localize()); + + // preliminary step 3: Create a Save - Discard widget for the pane m_saveCancel = new SaveCancelSection(); - m_saveCancel.getSaveButton().setButtonLabel(Text.gz( + m_saveCancel.getSaveButton().setButtonLabel(GlobalizationUtil.gz( "forum.ui.settings.save")); + + // //////////////////////////////////////////////////////////////////// + // Create the pane + // //////////////////////////////////////////////////////////////////// + + /* Introductory text fiel */ m_introduction = new TextArea("introduction", 8, 60, TextArea.SOFT); - m_introduction.addValidationListener(new StringInRangeValidationListener( - 0, 4000, Text.gz("forum.ui.validation.introduction_too_long"))); - m_introduction.setMetaDataAttribute("label", (String) Text.gz( + m_introduction.addValidationListener( + new StringInRangeValidationListener(0, 4000, + GlobalizationUtil.gz( + "forum.ui.validation.introduction_too_long") + )); + m_introduction.setMetaDataAttribute("label", (String) GlobalizationUtil.gz( "forum.ui.settings.introduction").localize()); m_title = new TextField("title"); - m_title.setMetaDataAttribute("label", (String) Text.gz( + m_title.setMetaDataAttribute("label", (String) GlobalizationUtil.gz( "forum.ui.settings.title").localize()); m_title.setSize(70); diff --git a/ccm-forum/src/com/arsdigita/forum/ui/Text.java b/ccm-forum/src/com/arsdigita/forum/util/GlobalizationUtil.java similarity index 59% rename from ccm-forum/src/com/arsdigita/forum/ui/Text.java rename to ccm-forum/src/com/arsdigita/forum/util/GlobalizationUtil.java index 2d757bf27..cf6532cd1 100755 --- a/ccm-forum/src/com/arsdigita/forum/ui/Text.java +++ b/ccm-forum/src/com/arsdigita/forum/util/GlobalizationUtil.java @@ -16,28 +16,45 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -package com.arsdigita.forum.ui; +package com.arsdigita.forum.util; import com.arsdigita.globalization.GlobalizedMessage; /** - * Contains methods to simplify globalizing keys. + * Compilation of methods to simplify the handling of globalizing keys. + * Basically it adds the name of package's resource bundle files to the + * globalize methods and forwards to GlobalizedMessage, shortening the + * method invocation in the various application classes. + * * * @author Daniel Berrange */ -public class Text { +public class GlobalizationUtil { + /** Name of Java resource files to handle Forum's globalisation. */ private static final String BUNDLE_NAME = - "com.arsdigita.forum.ui.ForumResources"; + "com.arsdigita.forum.ForumResources"; + /** + * Returns a globalized message using the appropriate bundle. + */ public static GlobalizedMessage gz(String key) { return new GlobalizedMessage(key, BUNDLE_NAME); } + /** + * Returns a String, aplying the loclize() method on the globalized message + * using the appropriate bundle. + */ public static String gzAsStr(String key) { return (String) new GlobalizedMessage(key, BUNDLE_NAME).localize(); } + /** + * Returns a globalized message object, using the approprate bundle, + * takeing in an Object[] of arguments to interpolate into the retrieved + * message using the MessageFormat class. + */ public static GlobalizedMessage gz(String key, Object[] args) { return new GlobalizedMessage(key, BUNDLE_NAME, args); }