diff --git a/ccm-cms/src/ccm-cms.config b/ccm-cms/src/ccm-cms.config index ac4b7438b..6a9c17e5c 100755 --- a/ccm-cms/src/ccm-cms.config +++ b/ccm-cms/src/ccm-cms.config @@ -1,6 +1,6 @@ - diff --git a/ccm-cms/src/com/arsdigita/cms/ContentSectionConfig.java b/ccm-cms/src/com/arsdigita/cms/CMSConfig.java similarity index 97% rename from ccm-cms/src/com/arsdigita/cms/ContentSectionConfig.java rename to ccm-cms/src/com/arsdigita/cms/CMSConfig.java index 77b74e2fe..db57dbfe6 100755 --- a/ccm-cms/src/com/arsdigita/cms/ContentSectionConfig.java +++ b/ccm-cms/src/com/arsdigita/cms/CMSConfig.java @@ -41,16 +41,36 @@ import com.arsdigita.cms.publishToFile.PublishToFileConfig; import com.arsdigita.cms.ui.authoring.ItemCategoryExtension; import com.arsdigita.cms.ui.authoring.ItemCategoryForm; import com.arsdigita.runtime.AbstractConfig; +// URL resource: protocol handler removal: START +// remove +// import com.arsdigita.util.UncheckedWrapperException; +// URL resource: protocol handler removal: END import com.arsdigita.util.parameter.BooleanParameter; import com.arsdigita.util.parameter.EnumerationParameter; import com.arsdigita.util.parameter.ErrorList; import com.arsdigita.util.parameter.IntegerParameter; import com.arsdigita.util.parameter.Parameter; +// import com.arsdigita.util.parameter.ParameterError; +// URL resource: protocol handler removal: START +// new: import: import com.arsdigita.util.parameter.ResourceParameter; +// URL resource: protocol handler removal: END import com.arsdigita.util.parameter.SpecificClassParameter; import com.arsdigita.util.parameter.StringArrayParameter; import com.arsdigita.util.parameter.StringParameter; +// URL resource: protocol handler removal: START +// remove: +// import com.arsdigita.util.parameter.URLParameter; +// new: import: import com.arsdigita.util.StringUtils; +// URL resource: protocol handler removal: END + +// URL resource: protocol handler removal: START +// remove: +// import java.io.IOException; +// import java.net.MalformedURLException; +// import java.net.URL; +// URL resource: protocol handler removal: END import java.io.InputStream; import java.util.Collection; import java.util.HashMap; @@ -71,11 +91,11 @@ import org.apache.log4j.Logger; * @see ContentSection#getConfig() * * @author Justin Ross <jross@redhat.com> - * @version $Id: ContentSectionConfig.java 2070 2010-01-28 08:47:41Z pboy $ + * @version $Id: CMSConfig.java 2070 2010-01-28 08:47:41Z pboy $ */ -public final class ContentSectionConfig extends AbstractConfig { +public final class CMSConfig extends AbstractConfig { - private static final Logger s_log = Logger.getLogger(ContentSectionConfig.class); + private static final Logger s_log = Logger.getLogger(CMSConfig.class); private static Map s_skipAssetSteps = null; @@ -139,7 +159,7 @@ public final class ContentSectionConfig extends AbstractConfig { * * @see ContentSection#getConfig() **/ - public ContentSectionConfig() { + public CMSConfig() { m_defaultItemTemplatePath = new StringParameter ("com.arsdigita.cms.default_item_template_path", diff --git a/ccm-cms/src/com/arsdigita/cms/ContentSectionConfig_parameter.properties b/ccm-cms/src/com/arsdigita/cms/CMSConfig_parameter.properties similarity index 100% rename from ccm-cms/src/com/arsdigita/cms/ContentSectionConfig_parameter.properties rename to ccm-cms/src/com/arsdigita/cms/CMSConfig_parameter.properties diff --git a/ccm-cms/src/com/arsdigita/cms/CMSResources.properties b/ccm-cms/src/com/arsdigita/cms/CMSResources.properties index 514fd7da6..d3a35f311 100755 --- a/ccm-cms/src/com/arsdigita/cms/CMSResources.properties +++ b/ccm-cms/src/com/arsdigita/cms/CMSResources.properties @@ -1,14 +1,29 @@ +# Package com.arsdigita.cms +# ========================= cms.attributeset_is_already_locked=AttributeSet is already locked cms.attributeset_is_locked=AttributeSet is locked cms.cannot_create_xml_document=Cannot create XML document cms.cant_promote_folders=Can't promote folders cms.classnotfoundexception=ClassNotFoundException: cms.illegalaccessexception=IllegalAccessException: -cms.instantiationexception=InstantiationException: -cms.nosuchmethodexception=NoSuchMethodException: + +cms.image.erroneous_jpeg_marker_length=Erroneous JPEG marker length +cms.image.expected_soi_marker_first=Expected SOI marker first +cms.image.not_a_jpeg_file=Not a JPEG file + +cms.instantiationexception=Instantiation Exception: +cms.nosuchmethodexception=No-Such-Method Exception: cms.templates=Templates cms.title=Title +no=No +yes=Yes +mime_type_jsp=JSP +mime_type_xsl=XSL +cms.contentassets.ui.description=Description + +# Package com.arsdigita.cms.contenttypes +# ====================================== cms.contenttypes.contact=Contact: cms.contenttypes.contact_details=Contact Details: cms.contenttypes.contact_information=Contact Information: @@ -53,6 +68,21 @@ cms.contenttypes.subjectitems=SubjectItems: cms.contenttypes.summary=Description: cms.contenttypes.title=Title: + +cms.contenttypes.template.body_text.title=Body text +cms.contenttypes.template.body_text.description=Edit the body text +cms.contenttypes.shared.assign_categories.title=Assign Categories +cms.contenttypes.shared.assign_categories.description=Assign Categories +cms.contenttypes.shared.attach_files.title=Attach Files +cms.contenttypes.shared.attach_files.description=Attach Files +cms.contenttypes.shared.basic_properties.description=Edit Basic Properties +cms.contenttypes.shared.basic_properties.title=Basic Properties +cms.contenttypes.shared.body_text.title=Body Text +cms.contenttypes.shared.body_text.description=Edit the Body Text + + +# Package com.arsdigita.cms.contenttypes.ui +# ========================================= cms.contenttypes.ui.action_item=Action Item: cms.contenttypes.ui.address=Address: cms.contenttypes.ui.agenda_date=Agenda Date: @@ -105,6 +135,9 @@ cms.contenttypes.ui.there_are_no_events=There are no events cms.contenttypes.ui.title=Title: cms.contenttypes.ui.view_image=view image + +# Package com.arsdigita.cms.dispatcher +# ===================================== cms.dispatcher.cannot_find_domain_object=cannot find domain object cms.dispatcher.could_not_find_imageasset=Could not find ImageAsset: cms.dispatcher.failed_to_retrieve_imageasset=Failed to retrieve ImageAsset: @@ -112,16 +145,18 @@ cms.dispatcher.no_permission_to_access_resource=no permission to access resource cms.dispatcher.not_implemented=not implemented cms.dispatcher.unknown_context=Unknown context: + +# Package com.arsdigita.cms.formbuilder +# ===================================== cms.formbuilder.cannot_create_acsobject=cannot create ACSObject cms.formbuilder.cannot_instantiate_object=cannot instantiate object cms.formbuilder.no_such_form=no such form cms.formbuilder.roll_me_back=Roll me back cms.formbuilder.css=Cascading Style Sheet (CSS) Class Attribute - -cms.image.erroneous_jpeg_marker_length=Erroneous JPEG marker length -cms.image.expected_soi_marker_first=Expected SOI marker first -cms.image.not_a_jpeg_file=Not a JPEG file + +# Package com.arsdigita.cms.installer +# ===================================== cms.installer.approval=Approval cms.installer.article=Article cms.installer.authoring=Authoring @@ -143,9 +178,14 @@ cms.installer.template=Template cms.installer.formbuilder.form=Form cms.installer.formbuilder.form_section=Form Section + +# Package com.arsdigita.cms.lifecycle +# =================================== cms.lifecycle.could_not_fetch_lifecycle=Could not fetch lifecycle: cms.lifecycle.could_not_fetch_phase=Could not fetch phase: +# Package com.arsdigita.cms.publishToFile +# ======================================= cms.publishToFile.cannot_find_file=cannot find file cms.publishToFile.cannot_find_item_class=cannot find item class cms.publishToFile.cannot_find_server=cannot find server @@ -190,76 +230,15 @@ cms.tasks.ui.title=Title cms.tasks.ui.workflow=Workflow -cms.ui.Authoring=Authoring -cms.ui.History=History -cms.ui.Lifecycle=Lifecycle -cms.ui.Publishing=Publishing -cms.ui.Summary=Summary -cms.ui.template=Template -cms.ui.Templates=Templates + +# Package com.arsdigita.cms.ui +# ============================ cms.ui.action=Action cms.ui.actions=Actions cms.ui.all_items=All Items cms.ui.assigned_categories=Assigned Categories: cms.ui.attention=Attention -cms.ui.file=File: - -cms.ui.authoring.an_item_with_this_name_already_exists=An item with this name already exists -cms.ui.authoring.bad_getblob_datatype=Bad getBlob datatype -cms.ui.authoring.bad_getclob_datatype=Bad getClob datatype -cms.ui.authoring.body=Body: -cms.ui.authoring.caption=Caption: -cms.ui.authoring.content_type=Content Type: -cms.ui.authoring.couldnt_create_contentpage=Couldn't create ContentPage -cms.ui.authoring.edit_body_text=Edit Body Text: -cms.ui.authoring.edit_caption=Edit caption -cms.ui.authoring.file_action=File Action -cms.ui.authoring.image_action=Image Action -cms.ui.authoring.invalid_create_component=Creation component for parent content type is invalid. -cms.ui.authoring.missing_content_type=Missing content type -cms.ui.authoring.missing_item_id=Missing item id -cms.ui.authoring.name=Name: -cms.ui.authoring.name_url=Name (URL): -cms.ui.authoring.no_asset=No asset -cms.ui.authoring.no_content_types_were_found=No content types were found -cms.ui.authoring.no_current_wizard=No current wizard -cms.ui.authoring.not_implemented=Not Implemented -cms.ui.authoring.page_launch_date=Launch Date: -cms.ui.authoring.page_title=Page Title: -cms.ui.authoring.remove_image=Remove image -cms.ui.authoring.select_an_existing_image=Select an existing image -cms.ui.authoring.sql_error_in_getting_byte_content=SQL Error in getting byte content! -cms.ui.authoring.sqle=SQLE -cms.ui.authoring.steps=Authoring steps -cms.ui.authoring.submission_cancelled=Submission Cancelled -cms.ui.authoring.text_type=Text Type: -cms.ui.authoring.this_article_does_not_have_an_image=This article does not have an image. -cms.ui.authoring.title=Title: -cms.ui.authoring.unable_to_load_file=Unable to load file: -cms.ui.authoring.upload_a_new_image=Upload a new image -cms.ui.authoring.upload_image=Upload Image: -cms.ui.authoring.upload_image=Upload Image: -cms.ui.authoring.file_upload.auto_detect=(Auto-detect) -cms.ui.authoring.file_upload.file_type=File Type: -cms.ui.authoring.none=none -cms.ui.authoring.workflow=Select a Workflow -cms.ui.authoring_kit_has_more_than_one_step=This authoring kit has more than one step: -cms.ui.authoring_kit_has_no_steps=This authoring kit has no steps: -cms.ui.authoringkit.authoring_kit_for=Authoring Kit for -cms.ui.authoringkit.component=Component: -cms.ui.authoringkit.content_type_id=Content Type ID# -cms.ui.authoringkit.create_component=Create Component: -cms.ui.authoringkit.createcomponent=CreateComponent: -cms.ui.authoringkit.current_row_does_not_exists=Current row does not exists -cms.ui.authoringkit.description=Description: -cms.ui.authoringkit.description_bundle=Description Bundle -cms.ui.authoringkit.description_key=Description Key -cms.ui.authoringkit.do_you_really_want_to_delete_this_authoring_step=Do you really want to delete this authoring step? -cms.ui.authoringkit.label=Label: -cms.ui.authoringkit.label_bundle=Label Bundle -cms.ui.authoringkit.label_key=Label Key -cms.ui.authoringkit.ordering=Ordering: -cms.ui.authoringkit.submission_cancelled=Submission Cancelled +cms.ui.Authoring=Authoring cms.ui.available_categories=Available Categories: cms.ui.browse=Browse cms.ui.browse_items_by_category=Browse items by category @@ -268,98 +247,12 @@ cms.ui.cancel_hit=Cancel hit cms.ui.cancelled=cancelled cms.ui.cannot_assign_groups_to_owner=cannot assign groups to owner cms.ui.categories=Categories - -cms.ui.category._back= (back)  -cms.ui.category.add=Add category -cms.ui.category.add_index_item=Set index item -cms.ui.category.add_use_context=Add Use Context -cms.ui.category.assigned_purposes=Assigned Purposes: -cms.ui.category.available_purposes=Available Purposes: -cms.ui.category.batch_categorized_objects=Batch Order Items in This Category -cms.ui.category.batch_order_objects_order=Priority -cms.ui.category.batch_order_objects_title=Title -cms.ui.category.categorized_objects=Order Live Objects in This Category -# ## cms.ui.category.category.current=Current category -cms.ui.category.category_current=Current category -cms.ui.category.change_index_item=Change index item -cms.ui.category.edit_index_item=Edit index item -cms.ui.category.content_item=Content Item -cms.ui.category.delete=Delete category -cms.ui.category.delete_prompt=Are you sure you want to delete this category? -cms.ui.category.descriptionn=Description:\n -cms.ui.category.details=Category details -cms.ui.category.edit=Edit category -cms.ui.categoryLocalization.edit=Edit category -cms.ui.category.edit_a_category=Edit a Category -cms.ui.category.edit_purposes=Edit purposes -cms.ui.category.index_item.select=Select an index item for this category -cms.ui.category.index_item=Index item -cms.ui.category.intro=Select a category -cms.ui.category.is_abstract=Is abstract? -cms.ui.category.is_enabled=Is enabled? -cms.ui.category.is_not_abstract=Can you place objects in this category? -cms.ui.category.item.none=There are no items in this category -cms.ui.category.item=Categorized item -cms.ui.category.labeln=Label:\n -cms.ui.category.localizations=Category Localizations - -cms.ui.category.localization_action=Action -cms.ui.category.localization_add=Add localization -cms.ui.category.localization_confirm_delete=Delete this localization? -cms.ui.category.localization_description=Description -cms.ui.category.localization_edit=Edit -cms.ui.category.localization_error_locale=Please select a locale -cms.ui.category.localization_locale=Language -cms.ui.category.localization_name=Name -cms.ui.category.localization_none=This category has no localizations -cms.ui.category.localization_url=URL - -cms.ui.category.linked=Linked categories -cms.ui.category.linked_add=Add or remove linked categories -cms.ui.category.linked.add=Add or remove linked categories -cms.ui.category.linked.none=This category has no linked categories -cms.ui.category.linked_none=This category has no linked categories - -cms.ui.category.name_not_unique=There is already a category with this name -cms.ui.category.no_categorized_objects=There are no categorized objects -cms.ui.category.no_category_purposes=No Category Purposes -cms.ui.category.no_linked_categories=No linked categories -cms.ui.category.no_subcategories=No subcategories - -cms.ui.category.purpose.add=Add or remove category purposes -cms.ui.category.purpose.assigned=Assigned purposes -cms.ui.category.purpose.available=Available purposes -cms.ui.category.purpose.none=This category has no assigned purposes -cms.ui.category.purposes=Category purposes - -cms.ui.category.return=Return -cms.ui.category.select_index_item=Select index item for category -cms.ui.category.subcategories=Subcategories -cms.ui.category.subcategory.none=This category has no subcategories -cms.ui.category.templates=Category templates -cms.ui.category.templates.assigned=Assigned templates -cms.ui.category.there_are_no_items_in_this_category=There are no items in this category -cms.ui.category.url=URL -cms.ui.category.use_context=Use Context -cms.ui.category.use_contexts=Use Contexts -cms.ui.category.use_context_must_be_unique=Use context must be unique within a Content Section. -cms.ui.category.view_index_item=View index item - cms.ui.choose_target_folder=Choose target folder cms.ui.content_center=Content center cms.ui.content_item=Content item cms.ui.content_section=Content section cms.ui.content_section_configuration=

Content Section Configuration

cms.ui.content_types=Content types -cms.ui.cse=Soon Expired -cms.ui.cse.authorName=Author -cms.ui.cse.itemName=Name -cms.ui.cse.view=View -cms.ui.cse.viewLink=view -cms.ui.cse.edit=Edit -cms.ui.cse.editLink=edit -cms.ui.cse.endDateTime=Live Until -cms.ui.user_admin=User administration cms.ui.contents_of=Contents of cms.ui.create=Create cms.ui.default_locale=Default Locale: @@ -379,27 +272,260 @@ cms.ui.failed_to_generate_new_id=Failed to generate a new sequence ID. cms.ui.failed_to_instantiate_authoring_component=Failed to instantiate this authoring step component: cms.ui.failed_to_retrieve=Failed to retrieve: cms.ui.failed_to_validate_title_uniqueness=Failed to validate title uniqueness +cms.ui.file=File: cms.ui.finish=Finish -cms.ui.folder.cancelled=cancelled -cms.ui.folder.cannot_find_a_root_folder=Cannot find a root folder. -cms.ui.folder.na=N/A -cms.ui.folder.no_source_items_specified=No source items specified. -cms.ui.folder.parent=Parent Folder -cms.ui.folder.rename -cms.ui.folder_browser=Folder Browser cms.ui.for=for -cms.ui.formbuilder.description=Description: -cms.ui.formbuilder.name=Name: -cms.ui.formbuilder.oh_no_you_dont=Oh no you don't -cms.ui.formbuilder.title=Title: cms.ui.help=Help +cms.ui.History=History cms.ui.history.history=History cms.ui.history.no_history=No History cms.ui.history.preview=Preview cms.ui.history.rollback=Rollback cms.ui.insufficient_privileges=Insufficient Privileges cms.ui.invalid_item_id=Invalid item id:{0} +cms.ui.label=Label +cms.ui.label_prompt=Label: +cms.ui.language.field=Language: +cms.ui.language.header=Language +cms.ui.language_instance.change=Change the language +cms.ui.language_instance.new=New Language Instance +cms.ui.language_instances=Language Instances +cms.ui.Lifecycle=Lifecycle +cms.ui.locales=Locales: +cms.ui.logout_failed=Logout failed +cms.ui.matches=Matches +cms.ui.max_launch=Maximum Launch Date +cms.ui.min_launch=Minimum Launch Date +cms.ui.my_workspace=My Portal +cms.ui.name=Name +cms.ui.name_prompt=Name: +cms.ui.need_category_map_privilege=Need categorize items privilege on that category +cms.ui.new_folder=Create new folder +cms.ui.new_item=New Item +cms.ui.no=No +cms.ui.no_content_section_for_page=No content section for page +cms.ui.no_items_matched_the_search=No items matched the search +cms.ui.none=None +cms.ui.parent=Parent +cms.ui.preview=Preview +cms.ui.primary_instance=Primary Instance +cms.ui.Publishing=Publishing +cms.ui.remove=Remove +cms.ui.restore_default_permissions=Restore Default Permissions +cms.ui.save=Save +cms.ui.search=Search +cms.ui.search_prompt=Search to add new members +cms.ui.search_to_add_new_members=Search to Add New Members +cms.ui.search_errors.empty_terms=Please enter some search terms +cms.ui.search_errors.bad_terms=Your search terms contain illegal words or characters +cms.ui.select_one=--select one-- +cms.ui.sign_out=Sign out +cms.ui.Summary=Summary +cms.ui.template=Template +cms.ui.Templates=Templates +cms.ui.the_model_is_empty=The model is empty +cms.ui.there_are_no_items=There are no items. +cms.ui.there_was_no_one_matching_the_search_criteria=There was no one matching the search criteria. +cms.ui.this_should_never_happen=This should never happen + +cms.ui.unknown=unknown +cms.ui.upload_new_content=Upload new content +cms.ui.use_custom_permissions=Use Custom Permissions +cms.ui.user=User +cms.ui.user_admin=User administration +cms.ui.user_not_found=User not found +cms.ui.util.=  +cms.ui.view_all_enabled_tasks=View all enabled tasks +cms.ui.view_all_enabled_tasks=View all {0} enabled tasks +cms.ui.view_tasks_sorted_by_due_date=View tasks sorted by due date +cms.ui.viewers=Viewers +cms.ui.welcome=Welcome CMS USER +cms.ui.workflow_profile_exists_on_selected_folder=Workflow Profile exists on selected folder +cms.ui.yes=Yes +cms.ui.you_do_not_have_sufficient_privileges_to_access_this_page=You do not have sufficient privileges to access this page. + + + +# Package com.arsdigita.cms.ui.authoring +# ====================================== +cms.ui.authoring.an_item_with_this_name_already_exists=An item with this name already exists +cms.ui.authoring.bad_getblob_datatype=Bad getBlob datatype +cms.ui.authoring.bad_getclob_datatype=Bad getClob datatype +cms.ui.authoring.body=Body: +cms.ui.authoring.caption=Caption: +cms.ui.authoring.content_type=Content Type: +cms.ui.authoring.couldnt_create_contentpage=Couldn't create ContentPage +cms.ui.authoring.edit_body_text=Edit Body Text: +cms.ui.authoring.edit_caption=Edit caption +cms.ui.authoring.file_action=File Action +cms.ui.authoring.file_upload.auto_detect=(Auto-detect) +cms.ui.authoring.file_upload.file_type=File Type: +cms.ui.authoring.image_action=Image Action +cms.ui.authoring.invalid_create_component=Creation component for parent content type is invalid. +cms.ui.authoring.missing_content_type=Missing content type +cms.ui.authoring.missing_item_id=Missing item id +cms.ui.authoring.name=Name: +cms.ui.authoring.name_url=Name (URL): +cms.ui.authoring.no_asset=No asset +cms.ui.authoring.no_content_types_were_found=No content types were found +cms.ui.authoring.no_current_wizard=No current wizard +cms.ui.authoring.none=none +cms.ui.authoring.not_implemented=Not Implemented +cms.ui.authoring.page_launch_date=Launch Date: +cms.ui.authoring.page_title=Page Title: +cms.ui.authoring.remove_image=Remove image +cms.ui.authoring.select_an_existing_image=Select an existing image +cms.ui.authoring.sql_error_in_getting_byte_content=SQL Error in getting byte content! +cms.ui.authoring.sqle=SQLE +cms.ui.authoring.steps=Authoring steps +cms.ui.authoring.submission_cancelled=Submission Cancelled +cms.ui.authoring.text_type=Text Type: +cms.ui.authoring.this_article_does_not_have_an_image=This article does not have an image. +cms.ui.authoring.title=Title: +cms.ui.authoring.unable_to_load_file=Unable to load file: +cms.ui.authoring.upload_a_new_image=Upload a new image +cms.ui.authoring.upload_image=Upload Image: +cms.ui.authoring.upload_image=Upload Image: +cms.ui.authoring.workflow=Select a Workflow + + +# Package com.arsdigita.cms.ui.authoringkit +# ========================================= +cms.ui.authoringkit.authoring_kit_for=Authoring Kit for +cms.ui.authoringkit.authoring_kit_has_more_than_one_step=This authoring kit has more than one step: +cms.ui.authoringkit.authoring_kit_has_no_steps=This authoring kit has no steps: +cms.ui.authoringkit.component=Component: +cms.ui.authoringkit.content_type_id=Content Type ID# +cms.ui.authoringkit.create_component=Create Component: +cms.ui.authoringkit.createcomponent=CreateComponent: +cms.ui.authoringkit.current_row_does_not_exists=Current row does not exists +cms.ui.authoringkit.description=Description: +cms.ui.authoringkit.description_bundle=Description Bundle +cms.ui.authoringkit.description_key=Description Key +cms.ui.authoringkit.do_you_really_want_to_delete_this_authoring_step=Do you really want to delete this authoring step? +cms.ui.authoringkit.label=Label: +cms.ui.authoringkit.label_bundle=Label Bundle +cms.ui.authoringkit.label_key=Label Key +cms.ui.authoringkit.ordering=Ordering: +cms.ui.authoringkit.submission_cancelled=Submission Cancelled + + +# Package com.arsdigita.cms.ui.category +# ===================================== +cms.ui.category.add=Add category +cms.ui.category.add_index_item=Set index item +cms.ui.category.add_use_context=Add Use Context +cms.ui.category.assigned_purposes=Assigned Purposes: +cms.ui.category.available_purposes=Available Purposes: +cms.ui.category.back= (back)  +cms.ui.category.batch_categorized_objects=Batch Order Items in This Category +cms.ui.category.batch_order_objects_order=Priority +cms.ui.category.batch_order_objects_title=Title +cms.ui.category.categorized_objects=Order Live Objects in This Category +cms.ui.category.category_current=Current category +cms.ui.category.change_index_item=Change index item +cms.ui.category.content_item=Content Item +cms.ui.category.delete=Delete category +cms.ui.category.delete_prompt=Are you sure you want to delete this category? +cms.ui.category.descriptionn=Description:\n +cms.ui.category.details=Category details +cms.ui.category.edit=Edit category +cms.ui.category.edit_index_item=Edit index item +cms.ui.category.edit_a_category=Edit a Category +cms.ui.category.edit_purposes=Edit purposes +cms.ui.category.index_item.select=Select an index item for this category +cms.ui.category.index_item=Index item +cms.ui.category.intro=Select a category +cms.ui.category.is_abstract=Is abstract? +cms.ui.category.is_enabled=Is enabled? +cms.ui.category.is_not_abstract=Can you place objects in this category? +cms.ui.category.item.none=There are no items in this category +cms.ui.category.item=Categorized item +cms.ui.category.labeln=Label:\n + +cms.ui.category.linked=Linked categories +cms.ui.category.linked_add=Add or remove linked categories +cms.ui.category.linked.add=Add or remove linked categories +cms.ui.category.linked.none=This category has no linked categories +cms.ui.category.linked_none=This category has no linked categories + +cms.ui.category.localizations=Category Localizations +cms.ui.category.localization_action=Action +cms.ui.category.localization_add=Add localization +cms.ui.category.localization_confirm_delete=Delete this localization? +cms.ui.category.localization_description=Description +cms.ui.category.localization_edit=Edit +cms.ui.category.localization_error_locale=Please select a locale +cms.ui.category.localization_locale=Language +cms.ui.category.localization_name=Name +cms.ui.category.localization_none=This category has no localizations +cms.ui.category.localization_url=URL + +cms.ui.category.name_not_unique=There is already a category with this name +cms.ui.category.no_categorized_objects=There are no categorized objects +cms.ui.category.no_category_purposes=No Category Purposes +cms.ui.category.no_linked_categories=No linked categories +cms.ui.category.no_subcategories=No subcategories + +cms.ui.category.purpose.add=Add or remove category purposes +cms.ui.category.purpose_add=Add or remove category purposes +cms.ui.category.purpose.assigned=Assigned purposes +cms.ui.category.purpose_assigned=Assigned purposes +cms.ui.category.purpose.available=Available purposes +cms.ui.category.purpose_available=Available purposes +cms.ui.category.purpose.none=This category has no assigned purposes +cms.ui.category.purpose_none=This category has no assigned purposes +cms.ui.category.purposes=Category purposes + +cms.ui.category.return=Return +cms.ui.category.select_index_item=Select index item for category +cms.ui.category.subcategories=Subcategories +cms.ui.category.subcategory.none=This category has no subcategories +cms.ui.category.templates=Category templates +cms.ui.category.templates.assigned=Assigned templates +cms.ui.category.there_are_no_items_in_this_category=There are no items in this category +cms.ui.category.url=URL +cms.ui.category.use_context=Use Context +cms.ui.category.use_contexts=Use Contexts +cms.ui.category.use_context_must_be_unique=Use context must be unique within a Content Section. +cms.ui.category.view_index_item=View index item + + +# Package com.arsdigita.cms.ui.cse +# ================================ +cms.ui.cse=Soon Expired +cms.ui.cse.authorName=Author +cms.ui.cse.itemName=Name +cms.ui.cse.view=View +cms.ui.cse.viewLink=view +cms.ui.cse.edit=Edit +cms.ui.cse.editLink=edit +cms.ui.cse.endDateTime=Live Until + + +# Package com.arsdigita.cms.ui.folder +# =================================== +cms.ui.folder.cancelled=cancelled +cms.ui.folder.cannot_find_a_root_folder=Cannot find a root folder. +cms.ui.folder.na=N/A +cms.ui.folder.no_source_items_specified=No source items specified. +cms.ui.folder.parent=Parent Folder +cms.ui.folder.rename +cms.ui.folder_browser=Folder Browser + + +# Package com.arsdigita.cms.ui.formbuilder +# ======================================== +cms.ui.formbuilder.description=Description: +cms.ui.formbuilder.name=Name: +cms.ui.formbuilder.oh_no_you_dont=Oh no you don't +cms.ui.formbuilder.title=Title: + + +# Package com.arsdigita.cms.ui.item +# ================================= cms.ui.item=Content item + cms.ui.item.access_denied=Access denied. cms.ui.item.apply_a_lifecycle=Apply a Lifecycle cms.ui.item.authoring=Authoring @@ -474,13 +600,13 @@ cms.ui.item.lifecycle.start_date_in_past=The start date must not be in the past cms.ui.item.lifecycle.end_date_before_start_date=The end date must not be before the start date cms.ui.item_name_already_in_folder=That title is already in use by another item in this folder: -cms.ui.label=Label -cms.ui.label_prompt=Label: -cms.ui.language.field=Language: -cms.ui.language.header=Language -cms.ui.language_instance.change=Change the language -cms.ui.language_instance.new=New Language Instance -cms.ui.language_instances=Language Instances + + +# Package com.arsdigita.cms.ui.lifecycle +# ====================================== +cms.ui.lifecycle_date_error_msg=The lifecycle start date must come before the lifecycle end date. +cms.ui.lifecycles=Lifecycles + cms.ui.lifecycle.add=Add lifecycle cms.ui.lifecycle.add=Create new lifecycle cms.ui.lifecycle.add_a_phase=Add a Phase @@ -524,24 +650,12 @@ cms.ui.lifecycle.phase_edit=Edit phase cms.ui.lifecycle.phase_name=Name cms.ui.lifecycle.phases=Phases cms.ui.lifecycle.start_delay=Start Delay: -cms.ui.lifecycle_date_error_msg=The lifecycle start date must come before the lifecycle end date. -cms.ui.lifecycles=Lifecycles -cms.ui.locales=Locales: -cms.ui.logout_failed=Logout failed -cms.ui.matches=Matches -cms.ui.max_launch=Maximum Launch Date -cms.ui.min_launch=Minimum Launch Date -cms.ui.my_workspace=My Portal -cms.ui.name=Name -cms.ui.name_prompt=Name: -cms.ui.need_category_map_privilege=Need categorize items privilege on that category -cms.ui.new_folder=Create new folder -cms.ui.new_item=New Item -cms.ui.no=No -cms.ui.no_content_section_for_page=No content section for page -cms.ui.no_items_matched_the_search=No items matched the search -cms.ui.none=None -cms.ui.parent=Parent + + +# Package com.arsdigita.cms.ui.permissions +# ======================================== +cms.ui.permissions=Permissions + cms.ui.permissions.add_administrator=Add administrator cms.ui.permissions.cannot_add_user=cannot add user cms.ui.permissions.cannot_retrieve_party=Cannot retrieve party @@ -555,11 +669,27 @@ cms.ui.permissions.remove=remove cms.ui.permissions.return_to_object_info=Return to object info cms.ui.permissions.these_are_the_current_permissions_for_this_folder=These are the current permissions for this folder. cms.ui.permissions.these_are_the_custom_permissions_that_have_been_granted_on_this_object=These are the custom permissions that have been granted on this object. -cms.ui.permissions=Permissions -cms.ui.preview=Preview -cms.ui.primary_instance=Primary Instance -cms.ui.remove=Remove -cms.ui.restore_default_permissions=Restore Default Permissions + + +# Package com.arsdigita.cms.ui.reports +# ==================================== +cms.ui.reports=Reports + +cms.ui.reports.header=Reports +cms.ui.reports.intro=Please select a report. +# Columns for ContentSectionSummary report +cms.ui.reports.css.emptyResult=No matching content items found. +cms.ui.reports.css.reportName=Content Section Summary +cms.ui.reports.css.contentSection=Content Section +cms.ui.reports.css.folder=Folder +cms.ui.reports.css.subfolderCount=Subfolders +cms.ui.reports.css.contentType=Content Type +cms.ui.reports.css.draft=Draft +cms.ui.reports.css.live=Live + +# Package com.arsdigita.cms.ui.role +# ================================= +cms.ui.roles=Roles cms.ui.role.add=Add role cms.ui.role.admin.add=Add administrator cms.ui.role.admin.email=Email @@ -587,15 +717,9 @@ cms.ui.role.staff.add=Add a staff role cms.ui.role.staff=Staff roles cms.ui.role.viewer.add=Add a viewer role cms.ui.role.viewers=Viewer roles -cms.ui.roles=Roles -cms.ui.save=Save -cms.ui.search=Search -cms.ui.search_prompt=Search to add new members -cms.ui.search_to_add_new_members=Search to Add New Members -cms.ui.search_errors.empty_terms=Please enter some search terms -cms.ui.search_errors.bad_terms=Your search terms contain illegal words or characters -cms.ui.select_one=--select one-- -cms.ui.sign_out=Sign out + +# Package com.arsdigita.cms.ui.staff +# ================================== cms.ui.staff.add_member=Add member cms.ui.staff.add_role=Create new role cms.ui.staff.create_a_role=Create a role @@ -614,7 +738,11 @@ cms.ui.staff.role_members=Role members cms.ui.staff.role_name=Name cms.ui.staff.roles=Roles cms.ui.staff.there_are_no_administrators_for_this_role=There are no administrators for this role + cms.ui.submission_cancelled=Submission Cancelled + +# Package com.arsdigita.cms.ui.templates +# ====================================== cms.ui.templates.assign_a_template_to=Assign a template to cms.ui.templates.assign_template=Assign Template cms.ui.templates.assign_this_template=Assign this template @@ -629,10 +757,11 @@ cms.ui.templates.preview=Preview cms.ui.templates.remove=Remove cms.ui.templates.set_as_default=Set as Default cms.ui.templates.use_context=Use Context: -cms.ui.the_model_is_empty=The model is empty -cms.ui.there_are_no_items=There are no items. -cms.ui.there_was_no_one_matching_the_search_criteria=There was no one matching the search criteria. -cms.ui.this_should_never_happen=This should never happen + +# Package com.arsdigita.cms.ui.type +# ================================= +cms.ui.types=Content types + cms.ui.type.add=Add content type cms.ui.type.authoringkit=Authoring kit details cms.ui.type.select=Select Content Type @@ -677,18 +806,13 @@ cms.ui.type.year_range_not_balanced=One of the years in the range is missing cms.ui.type.year_range_too_great=The range specified is too great cms.ui.type.year_range_wrong_order=The years in the range are out of order cms.ui.type.year_too_anachronistic=The range dates appear abnormal -cms.ui.types=Content types -cms.ui.unknown=unknown -cms.ui.upload_new_content=Upload new content -cms.ui.use_custom_permissions=Use Custom Permissions -cms.ui.user=User -cms.ui.user_not_found=User not found -cms.ui.util.=  -cms.ui.view_all_enabled_tasks=View all enabled tasks -cms.ui.view_all_enabled_tasks=View all {0} enabled tasks -cms.ui.view_tasks_sorted_by_due_date=View tasks sorted by due date -cms.ui.viewers=Viewers -cms.ui.welcome=Welcome CMS USER + + +# Package com.arsdigita.cms.ui.worfklow +# ===================================== +cms.ui.workflow=Workflow +cms.ui.workflows=Workflows + cms.ui.worfklow.task_roles=Assigned roles cms.ui.workflow.add=Add workflow cms.ui.workflow.add_a_new_task_to=Add a new Task to @@ -753,25 +877,8 @@ cms.ui.workflow.task.item_title=Item Title cms.ui.workflow.task.locking_user=Locking User cms.ui.workflow.unlock_tasks=Unlock my tasks for this content item cms.ui.workflow.your_tasks=Your assigned tasks -cms.ui.workflow=Workflow -cms.ui.workflow_profile_exists_on_selected_folder=Workflow Profile exists on selected folder -cms.ui.workflows=Workflows -cms.ui.yes=Yes -cms.ui.you_do_not_have_sufficient_privileges_to_access_this_page=You do not have sufficient privileges to access this page. -cms.contenttypes.template.body_text.title=Body text -cms.contenttypes.template.body_text.description=Edit the body text -cms.contenttypes.shared.assign_categories.title=Assign Categories -cms.contenttypes.shared.assign_categories.description=Assign Categories -cms.contenttypes.shared.attach_files.title=Attach Files -cms.contenttypes.shared.attach_files.description=Attach Files -cms.contenttypes.shared.basic_properties.description=Edit Basic Properties -cms.contenttypes.shared.basic_properties.title=Basic Properties -cms.contenttypes.shared.body_text.title=Body Text -cms.contenttypes.shared.body_text.description=Edit the Body Text -no=No -yes=Yes -mime_type_jsp=JSP -mime_type_xsl=XSL + + # For all subject and body email text below, the substitutions are as follows: # {0}: Item title (display name) # {1}: a numeric value identifying the type of Task that was completed: 1 for authoring, 2 for approval, 3 for publishing @@ -834,6 +941,7 @@ If you have any questions, please contact the system adminstrator at {4}.\n\ Thank you for using {3}.\n # Subject and body for the Unfinished Task emails +# =============================================== cms.ui.workflow.email.subject.unfinished={1,choice,1#Authoring|2#Approval|3#Deployment} of "{0}" is unfinished cms.ui.workflow.email.body.unfinished=\ "{0}" is {1,choice,1#ready for authoring|2#waiting for approval|3#waiting for deployment} on {3}. \n\ @@ -845,21 +953,10 @@ You can complete this task by opening this link in your web browser:\n\ \n\ If you have any questions, please contact the system adminstrator at {4}.\n\ Thank you for using {3}.\n -cms.contentassets.ui.description=Description + + +# Subject and body for the Content check emails +# =============================================== cms.ui.content_check_alert.subject=Content Check Alert cms.ui.content_check_alert.body=Dear Author\n\nYou are listed as the Content Owner for the following {0} web page(s). Please check if they need amending or updating in any way:\n\n{1}\nIf you have any amendments or questions please email the appropriate web editor:\n\nsally.editor@aplaws.org (Council & Democracy, Environment, Education)\njohn.editor@aplaws.org (Community & Living, Business, Social Care)\nfrank.editor@aplaws.org (Council & Democracy, Environment, Education)\n\nYou can contact webmanager@aplaws.org with any questions about this email\n -# -# Reports section -# -cms.ui.reports=Reports -cms.ui.reports.header=Reports -cms.ui.reports.intro=Please select a report. -# Columns for ContentSectionSummary report -cms.ui.reports.css.emptyResult=No matching content items found. -cms.ui.reports.css.reportName=Content Section Summary -cms.ui.reports.css.contentSection=Content Section -cms.ui.reports.css.folder=Folder -cms.ui.reports.css.subfolderCount=Subfolders -cms.ui.reports.css.contentType=Content Type -cms.ui.reports.css.draft=Draft -cms.ui.reports.css.live=Live + diff --git a/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties b/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties index 0864d35e8..5eb2ea93c 100755 --- a/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties +++ b/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties @@ -843,3 +843,4 @@ cms.ui.category.localization_none=Diese Kaegorie hat keine Sprachversionen cms.ui.category.localization_url=URL cms.ui.category.linked_add=Verk\u00FCpfte Kategorie l\u00F6schen oder hinzuf\u00FCgen cms.ui.category.linked_none=cms.ui.category.linked.add=Add or remove linked categories\n +cms.ui.reports=Berichte diff --git a/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties b/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties index 2133d90ea..a748f0dbf 100755 --- a/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties +++ b/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties @@ -1,2 +1,3 @@ cms.tasks.ui.content_center=Content Centre -cms.ui.content_center=Content Centre \ No newline at end of file +cms.ui.content_center=Content Centre +cms.ui.lifecycles=Lifecycles diff --git a/ccm-cms/src/com/arsdigita/cms/ContentSection.java b/ccm-cms/src/com/arsdigita/cms/ContentSection.java index ec4f589de..fe00ddde1 100755 --- a/ccm-cms/src/com/arsdigita/cms/ContentSection.java +++ b/ccm-cms/src/com/arsdigita/cms/ContentSection.java @@ -27,7 +27,7 @@ import com.arsdigita.cms.dispatcher.ResourceMapping; import com.arsdigita.cms.dispatcher.ResourceType; import com.arsdigita.cms.dispatcher.TemplateResolver; import com.arsdigita.cms.dispatcher.XMLGenerator; -// import com.arsdigita.cms.ContentSectionConfig; +// import com.arsdigita.cms.CMSConfig; import com.arsdigita.cms.lifecycle.LifecycleDefinition; import com.arsdigita.cms.lifecycle.LifecycleDefinitionCollection; import com.arsdigita.cms.util.GlobalizationUtil; @@ -126,7 +126,7 @@ public class ContentSection extends Application { private final static String ITEM_QUERY = "com.arsdigita.cms.ItemsInSection"; private final static String SECTION_ID = "sectionId"; - private static final ContentSectionConfig s_config = new ContentSectionConfig(); + private static final CMSConfig s_config = new CMSConfig(); static { s_config.load(); @@ -160,7 +160,7 @@ public class ContentSection extends Application { super(new OID(BASE_DATA_OBJECT_TYPE, id)); } - public static ContentSectionConfig getConfig() { + public static CMSConfig getConfig() { return s_config; } @@ -1036,15 +1036,16 @@ public class ContentSection extends Application { String irc, String xgc) { return ContentSection.create( - name, - folder, - category, - staff, - prc, - irc, - xgc, - "com.arsdigita.cms.dispatcher.DefaultTemplateResolver"); - } + name, + folder, + category, + staff, + prc, + irc, + xgc, + "com.arsdigita.cms.dispatcher.DefaultTemplateResolver" + ); + } /** * Create a new content section. This method is called automatically when a @@ -1108,19 +1109,17 @@ public class ContentSection extends Application { */ public static ContentSection create(final String name) { - Group staff = createStaffGroup(name); - Folder folder = createRootFolder(name); - Category category = createRootCategory(name); + Group staff = createStaffGroup(name); + Folder folder = createRootFolder(name); + Category category = createRootCategory(name); - // Some default classes for a content section. - String prc = "com.arsdigita.cms.dispatcher.SimplePageResolver"; - String irc = "com.arsdigita.cms.dispatcher.MultilingualItemResolver"; - String xgc = "com.arsdigita.cms.dispatcher.SimpleXMLGenerator"; - String trc = - "com.arsdigita.cms.dispatcher.DefaultTemplateResolver"; + // Some default classes for a content section. + String prc = "com.arsdigita.cms.dispatcher.SimplePageResolver"; + String irc = "com.arsdigita.cms.dispatcher.MultilingualItemResolver"; + String xgc = "com.arsdigita.cms.dispatcher.SimpleXMLGenerator"; + String trc = "com.arsdigita.cms.dispatcher.DefaultTemplateResolver"; - ContentSection section = - ContentSection.create( + ContentSection section = ContentSection.create( name, folder, category, @@ -1130,17 +1129,17 @@ public class ContentSection extends Application { xgc, trc); - // Set the default context on the root folder to - // the content section - PermissionService.setContext(folder.getOID(), section.getOID()); - createDefaultResources(section); + // Set the default context on the root folder to + // the content section + PermissionService.setContext(folder.getOID(), section.getOID()); + createDefaultResources(section); // } // }; // rootExcursion.run(); //now retrieve the created content section and return it // return (ContentSection) Application.retrieveApplicationForPath("/" + name + "/"); - return section; + return section; } /** diff --git a/ccm-cms/src/com/arsdigita/cms/Initializer.java b/ccm-cms/src/com/arsdigita/cms/Initializer.java index 533ede116..d64e94aa1 100755 --- a/ccm-cms/src/com/arsdigita/cms/Initializer.java +++ b/ccm-cms/src/com/arsdigita/cms/Initializer.java @@ -88,6 +88,9 @@ import com.arsdigita.kernel.Kernel; */ public class Initializer extends CompoundInitializer { + /** + * Constructor + */ public Initializer() { final String url = RuntimeConfig.getConfig().getJDBCURL(); final int database = DbHelper.getDatabaseFromURL(url); @@ -97,13 +100,30 @@ public class Initializer extends CompoundInitializer { ("ccm-cms.pdl.mf", new NameFilter(DbHelper.getDatabaseSuffix(database), "pdl")))); - // add(new LegacyInitializer("com/arsdigita/cms/publishToFile/enterprise.init")); + add(new com.arsdigita.cms.installer.Initializer()); + + // Experimental: Moved into c.ad.cms.loader + add(new LegacyInitializer("com/arsdigita/cms/contentsection/enterprise.init")); + // add(new com.arsdigita.cms.contentsection.Initializer()); add(new com.arsdigita.cms.publishToFile.Initializer()); add(new com.arsdigita.cms.lifecycle.Initializer()); + add(new com.arsdigita.cms.portlet.Initializer()); + // add(new LegacyInitializer("com/arsdigita/cms/enterprise.init")); + // Replaced by c.ad.cms.installer.Initializer() (NEW initializer!) + // add(new LegacyInitializer("com/arsdigita/cms/installer/enterprise.init")); + + // Moved into c.ad.cms.loader + // add(new LegacyInitializer("com/arsdigita/cms/installer/xml/enterprise.init")); + + + // now used to initialize the forms in ccm-core only! + // Can be replaced in ccm after ccm-core is migrated to new initializer. add(new LegacyInitializer("com/arsdigita/cms/enterprise.init")); } + + /** * Initializes domain-coupling machinery, usually consisting of * registering object instantiators and observers. @@ -192,10 +212,11 @@ public class Initializer extends CompoundInitializer { MetadataProviderRegistry.registerAdapter( FileAsset.BASE_DATA_OBJECT_TYPE, new AssetMetadataProvider()); - } + } // END init(DomainInitEvent e) + /** - * Registers stylesheet pattern generators + * Helper Method, registers stylesheet pattern generators */ private void registerPatternGenerators() { PatternStylesheetResolver.registerPatternGenerator( diff --git a/ccm-cms/src/com/arsdigita/cms/Loader.java b/ccm-cms/src/com/arsdigita/cms/Loader.java index 18e054fad..d62153502 100755 --- a/ccm-cms/src/com/arsdigita/cms/Loader.java +++ b/ccm-cms/src/com/arsdigita/cms/Loader.java @@ -18,8 +18,22 @@ */ package com.arsdigita.cms; +import com.arsdigita.kernel.Kernel; +import com.arsdigita.kernel.KernelExcursion; import com.arsdigita.loader.PackageLoader; import com.arsdigita.runtime.ScriptContext; + +import com.arsdigita.cms.installer.ContentCenterSetup; +import com.arsdigita.cms.installer.xml.XMLContentTypeHandler; +//import com.arsdigita.cms.portlet.ContentDirectoryPortlet; +import com.arsdigita.cms.portlet.ContentItemPortlet; +//import com.arsdigita.cms.portlet.ContentSectionsPortlet; +import com.arsdigita.cms.portlet.TaskPortlet; +import com.arsdigita.xml.XML; + +import java.util.Iterator; +import java.util.List; + import org.apache.log4j.Logger; /** @@ -30,10 +44,65 @@ import org.apache.log4j.Logger; */ public class Loader extends PackageLoader { + /** Private logger instance */ private static final Logger s_log = Logger.getLogger(Loader.class); + // Load main CMS configuration file + private static final LoaderConfig s_conf = new LoaderConfig(); + + + /** + * Constructor + */ + public Loader() { + + } + + public void run(final ScriptContext ctx) { // XXX: Should move on demand initialization stuff here. + new KernelExcursion() { + public void excurse() { + setEffectiveParty(Kernel.getSystemParty()); + + // //////////////////////////////// + // Experimental: + // Put ContentCenterSetup in Loader + // //////////////////////////////// +// final String workspaceURL = s_conf.getWorkspaceURL(); +// final String contentCenterMap = s_conf.getContentCenterMap(); +// ContentCenterSetup centerSetup = new ContentCenterSetup( +// workspaceURL, +// contentCenterMap); +// +// centerSetup.run(); + + // //////////////////////// + // Loading content type definitions + // Used to be step 2 in former enterprise.init file + // //////////////////////////////// + List contentTypes = s_conf.getCTDefFiles(); + if ( contentTypes != null) { + Iterator i = contentTypes.iterator(); + while (i.hasNext()) { + String xmlFile = (String)i.next(); + s_log.debug("Processing contentTypes in: " + xmlFile); + XML.parseResource(xmlFile, new XMLContentTypeHandler()); + } + } + + + // /////////////////////////////////////////////////////// + // Loading CMS portlets + // Used to be step 5 (last step) in former enterprise.init + // /////////////////////////////////////////////////////// + //ContentDirectoryPortlet.loadPortletType(); + ContentItemPortlet.loadPortletType(); + //ContentSectionsPortlet.loadPortletType(); + TaskPortlet.loadPortletType(); + + } + }.run(); } } diff --git a/ccm-cms/src/com/arsdigita/cms/LoaderConfig.java b/ccm-cms/src/com/arsdigita/cms/LoaderConfig.java new file mode 100644 index 000000000..3b18c1430 --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/LoaderConfig.java @@ -0,0 +1,655 @@ +/* + * Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License along + * with this library; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +// ***************************************************************************** + +// Stand: +// Alle Parameter aus SectionInitializer und enterprise.init hierhin übertragen. +// Noch zu klären, welche gehören tatsächlich hier hin? +// In Loader gehören nur solche, die in der Datenbank eingetragen werden (persisted). +// Alles, was zur Laufzeit eingestellt wird, muss in Initializer configuration. + +// ***************************************************************************** + + + +package com.arsdigita.cms; + +//import com.arsdigita.kernel.permissions.PrivilegeDescriptor; +import com.arsdigita.runtime.AbstractConfig; +import com.arsdigita.util.parameter.BooleanParameter; +import com.arsdigita.util.parameter.IntegerParameter; +import com.arsdigita.util.parameter.Parameter; +import com.arsdigita.util.parameter.StringArrayParameter; +import com.arsdigita.util.parameter.StringParameter; +// import com.arsdigita.util.parameter.ResourceParameter; +// import com.arsdigita.util.parameter.URLParameter; + +// import java.io.InputStream; +import java.util.Arrays; +import java.util.List; +import java.util.ArrayList; + +import org.apache.log4j.Logger; + +/** + * Module enables administrators to configure some features of the CMS application + * at install time. It is read in and processed only once and configuration is + * persisted in database. Currently there is no way to alter these features + * later after the installation step. + * + * @author pb + */ +public final class LoaderConfig extends AbstractConfig { + + private static final Logger s_log = Logger.getLogger(LoaderConfig.class); + + // //////////////////////////////////////////////// + // The following two (three) parameters are used by + // com.arsdigita.cms.installer.Initializer + // //////////////////////////////////////////////// + + /** + * The name of the workspace package instance, i.e. URL of the workspace, + * where authors, editors and publishers are working and from which they + * can select a content-section to create and edit documents. + * Usually you won't modify it! + */ + private StringParameter + m_workspaceURL = new StringParameter( + "com.arsdigita.cms.loader.workspace_url", + Parameter.REQUIRED, + "content-center"); + + /** + * XML Mapping of the content center tabs to URLs, see + * {@link ContentCenterDispatcher} + */ + private final StringParameter + m_contentCenterMap = new StringParameter( + "com.arsdigita.cms.loader.content_center_map", + Parameter.REQUIRED, + "/WEB-INF/resources/content-center-map.xml"); + + // Update master object if upgrading from old versioning + // XXX: shouldn't we just gut this section (and + // VersioningUpgrader)? It is an upgrade fix from 5.1 or + // earlier, and relying on VersionedACSObject is + // deprecated + // (pboy): Default value is false and this value didn't change for + // a very long period. Class can be excluded from source. + // final boolean updateMaster = + // ((Boolean)m_conf.getParameter(UPDATE_MASTER)).booleanValue(); + // if (updateMaster) { + // VersioningUpgrader.updateMasterObject(); + // } + + // XXX: ItemDispatcher is no longer used. Is the following + // still a valid enterprise.init parameter? Do we need to + // set ContentSectionServlet.s_cacheItems instead of the + // below (which is currently always true), or does this go + // away entirely? + // final boolean cacheItems = + // ((Boolean)m_conf.getParameter(CACHE_ITEMS)).booleanValue(); + // s_log.debug("Set cache items to " + cacheItems); + // ItemDispatcher.setCacheItems(cacheItems); + + // ///////////////////////////////////////////////////// + // Following parameter is used by c.ad.cms.installer.xml + // to load definition(s) of content types to database. + // (Definitions describe sections to be included in + // authoring steps). + // ///////////////////////////////////////////////////// + + /** + * List of Paths to XML files that contain content type definition(s). + * Example: + * contentTypeDefinitions = { "/WEB-INF/content-types/Template.xml" }; + * List currently contains only one path/filename. + */ + private final Parameter + m_ctDefFiles = new StringArrayParameter( + "com.arsdigita.cms.loader.contenttype_definition_files", + Parameter.REQUIRED, + // Generic*.xml added by Quasi in enterprise.init fot + // new generic Basetypes in addition to article + new String[] {"/WEB-INF/content-types/GenericAddress.xml", + "/WEB-INF/content-types/GenericArticle.xml", + "/WEB-INF/content-types/GenericContact.xml", + "/WEB-INF/content-types/GenericPerson.xml", + "/WEB-INF/content-types/Template.xml"} + ); + + + // /////////////////////////////////////////////////////////////////////// + // + // Parameters for creating a default content section at installation time. + // In enterprise.init used by com.arsdigita.cms.installer.SectionInitializer + // We list all information here, the code needs to create a section. + // + // /////////////////////////////////////////////////////////////////////// + + + /** + * The name of the content section, the default value used for initial + * setup. + */ + private final Parameter + m_contentSectionName = new StringParameter( + "com.arsdigita.cms.loader.content_section_name", + Parameter.REQUIRED, + "content"); + //"public"); + + // Root Folder, set autonomously by ContentSection.create() method + + // Template Folder, set autonomously by ContentSection.create() method + + /** + * Staff Group + * Contains roles and associated privileges. In loading step a complete + * default configuration is persisted in database, immutable at this point. + * See contentsection.ContentSectionSetup.registerRoles() + * In enterprise.init: name roles, List of roles to create. + * + * Not implemented yet! We need a new parameter type "list" which must have + * multidimensional capabilities. + */ +// private final StringParameter +// m_staffGroup = new StringParameter( +// "com.arsdigita.cms.loader.section_staff_group", +// Parameter.REQUIRED, +// null); + private List m_staffGroup; + + + // Viewer group, set autonomously by ContentSection.create() method. We can + // here specify, whether the first ( probalby only) content section should + // have a public viewer, i.e. without registration and login. + /** + * Whether to make content viewable to 'The Public', ie non-registered users. + * + * Parameter name in the old initializer code: PUBLIC. Default true. + */ + private final BooleanParameter + m_isPublic = new BooleanParameter( + "com.arsdigita.cms.loader.section_is_public", + Parameter.REQUIRED, + true); + + // Page Resolver Class, set autonomously by ContentSection.create() method. + + // Item Resolver Class, configurable. + /** + * Name of the item resolver class to use for the section (defaults to + *
com.arsdigita.cms.dispatcher.MultilingualItemResolver
). + * + * Default value (site-wide) is handled via the parameter + *
com.arsdigita.cms.default_item_resolver_class
. + * Section-specific override can be added here. Only do so if you are + * changing from the default for a specific content section. The class + * must implement
com.arsdigita.cms.dispatcher.ItemResolver
. + * + * Parameter name ITEM_RESOLVER_CLASS in the old initializer system. + * Description: The ItemResolver class to use for the section + * (defaults to MultilingualItemResolver) + */ + private final Parameter + m_itemResolverClass = new StringParameter( + "com.arsdigita.cms.loader.item_resolver_class", + Parameter.OPTIONAL, null ); + // , "com.arsdigita.cms.dispatcher.MultilingualItemResolver" + + + // Template Resolver Class, configurable. + /** + * Name of the template resolver class to use for the section + * (defaults to
com.arsdigita.cms.dispatcher.DefaultTemplateResolver
) + * + * Default value (site-wide) is handled via the parameter + *
com.arsdigita.cms.default_template_resolver_class
. + * Section-specific override can be added here. Only do so if you are + * changing from the default for a specific content section. The class + * must implement
com.arsdigita.cms.dispatcher.TemplateResolver
. + * + * Parameter name TEMPLATE_RESOLVER_CLASS in the old initializer system. + */ + private final Parameter + m_templateResolverClass = new StringParameter( + "com.arsdigita.cms.loader.template_resolver_class", + Parameter.OPTIONAL, + null ); + // "com.arsdigita.cms.dispatcher.DefaultTemplateResolver" ); + + + // XML Generator Class, set autonomously by ContentSection.create() method. + + + // Additional Parameters + + /** + * List of content types to register in the given content-section. + * + * Example: + * { + * "com.arsdigita.cms.contenttypes.Address", + * "com.arsdigita.cms.contenttypes.Article", + * "com.arsdigita.cms.contenttypes.Contact" + * } + * + * Parameter name "TYPES" in the old initializer code, empty by default in + * the former enterprise.init file. + * When the list is empty and the first default content section is created, + * all installed content types will get registered. This behaviour should + * not be altered without very good reasons. + */ + private final Parameter + m_contentTypeList = new StringArrayParameter( + "com.arsdigita.cms.loader.ctypes_include_list", + Parameter.REQUIRED, + new String[] {} ); + + /** + * Determins weather to use section specific category tree(s). Defaults to + * false, so standard navigation is used. + * If set to true loader loads the categories from file(s) specified in the + * next parameter ( m_categoryFileList ) + */ + private final Parameter + m_useSectionCategories = new BooleanParameter + ("com.arsdigita.cms.loader.use_section_categories", + Parameter.REQUIRED, new Boolean(false)); + + /** + * XML file containing the category tree to load for this content section. + * Usually not loaded {@see m_useSectionCategories). The files listed as + * default values are demo material and must be replaced in a production + * environment. + */ + private final Parameter + m_categoryFileList = new StringArrayParameter( + "com.arsdigita.cms.loader.section_categories_toload", + Parameter.REQUIRED, + new String[] {"/WEB-INF/resources/article-categories.xml", + "/WEB-INF/resources/navigation-categories.xml"} ); + // Category tree to load + // categories = { "/WEB-INF/resources/article-categories.xml", + // "/WEB-INF/resources/navigation-categories.xml" }; + // m_conf.initParameter(CATEGORIES, + // "XML file containing the category tree", + // List.class, + // Collections.EMPTY_LIST); + + + /** + * A list of workflow tasks, and the associated events for which alerts + * have to be sent. + * Parameter name TASK_ALERTS in the old initializer system / enterprise.init + * Specifies when to generate email alerts: by default, generate email alerts + * on enable, finish, and rollback (happens on rejection) changes. + * There are four action types for each task type: enable, disable, finish, + * and rollback. + * Example: + * (Note that the values below are based on the task labels, and as such are + * not globalized.) + *
+     * taskAlerts = {
+     *      { "Authoring",
+     *        { "enable", "finish", "rollback" }
+     *      },
+     *      { "Approval",
+     *        { "enable", "finish", "rollback" }
+     *      },
+     *      { "Deploy",
+     *        { "enable", "finish", "rollback" }
+     *      }
+     *  };
+     * 
+ * + * Default value (site-wide) is handled via the parameter + *
com.arsdigita.cms.default_task_alerts
. + * Section-specific override can be added here. Only do so if you are + * changing for a good reason from the default for a specific content section. + */ + private final Parameter + m_taskAlerts = new StringArrayParameter( + "com.arsdigita.cms.loader.section_task_alerts", + Parameter.REQUIRED, + null ); + // new String[] {} ); + + + // Parameters controlling Overdue Task alerts: + + + /** + * sendOverdueAlerts: Should we send alerts about overdue tasks at all? + */ + private final Parameter + m_sendOverdueAlerts = new BooleanParameter( + "com.arsdigita.cms.loader.send_overdue_alerts", + Parameter.REQUIRED, + new Boolean(false) ); + + /** + * taskDuration: The time between when a task is enabled (it is made + * available for completion) and when it is + * considered overdue (in HOURS) + */ + private final Parameter + m_taskDuration = new IntegerParameter( + "com.arsdigita.cms.loader.task_duration", + Parameter.REQUIRED, + new Integer(96) ); + + /** + * alertInterval: The time to wait between sending successive alerts on + * the same overdue task (in HOURS) + */ + private final Parameter + m_overdueAlertInterval = new IntegerParameter( + "com.arsdigita.cms.loader.overdue_alert_interval", + Parameter.REQUIRED, + new Integer(24) ); + + /** + * maxAlerts: The maximum number of alerts to send about any one + * overdue task + */ + private final Parameter + m_maxAlerts = new IntegerParameter( + "com.arsdigita.cms.loader.mas_alerts", + Parameter.REQUIRED, + new Integer(5) ); + + /** + * Standard Constructor. + */ + public LoaderConfig() { + + register(m_workspaceURL); + register(m_contentCenterMap); + register(m_ctDefFiles); + + // Parameters for creating a content section + register(m_contentSectionName); + register(m_isPublic); + register(m_itemResolverClass); + register(m_templateResolverClass); + + register(m_contentTypeList); + register(m_useSectionCategories); + register(m_categoryFileList); + register(m_taskAlerts); + + // Parameters controlling Overdue Task alerts: + register(m_sendOverdueAlerts); + register(m_taskDuration); + register(m_overdueAlertInterval); + register(m_maxAlerts); + + + + + // loadInfo(); + + } + + // ////////////////////////// + // + // Getter Methods + // + // ////////////////////////// + + /** + * Fetch name (URL) of the workspace package instance, e.g. content-center + * @return (URL) of the workspace package instance + */ + public String getWorkspaceURL() { + return (String) get(m_workspaceURL); + } + + /** + * Fetch the file name contaning XML Mapping of the content center tabs + * to URLs + * @return String containig file name including path component. + */ + public String getContentCenterMap() { + return (String) get(m_contentCenterMap); + } + + public List getCTDefFiles() { + String[] ctDefFiles = (String[]) get(m_ctDefFiles); + return Arrays.asList(ctDefFiles); + } + + + /** + * Retrieve the name of the content-section + */ + public String getContentSectionName() { + return (String) get(m_contentSectionName); + } + + + /** + * Retrieve the STAFF GROUP, i.e. a set of roles (author, editor, publisher, + * manager) and associated privileges for the content section to be created + * (m_contentSectionName). + * + * In loading step a complete default configuration is persisted in database, + * immutable at this point. + * See contentsection.ContentSectionSetup.registerRoles() + * In enterprise.init: name roles, List of roles to create. + * + * Set consists of a set of roles, for each role first field is the role name, + * second is the description, third is a list of privileges, and (optional) + * fourth is the workflow task to assign to. + * + * The set of roles constructed here is a complete set which reflects all + * functions of CMS and forms a necessary base for operations. When the first + * content section is created and loaded into database (during installation) + * this set is created, immutable by installer / administrator. Additional + * content section may be created using a subset. For a very special purpose + * a developer may alter the set. + * + * This method is typically used to construct the initial content section + * during installation. + * + * Not really implemented yet! We need a new parameter type "list" which + * must have multidimensional capabilities. + * + * As a temporary measure a constant list is retrieved. Until now the list + * was burried in enterprise.init and not user available for configuration. + * So it may turn into a permanent solution. + */ + public List getStuffGroup() { + + final List AUTH_PRIVS = Arrays.asList( + "new_item","read_item", "preview_item", "edit_item", + "categorize_items"); + final List EDIT_PRIVS = Arrays.asList( + "new_item","read_item", "preview_item", "edit_item", + "categorize_items", "delete_item", "approve_item" ); + final List PUBL_PRIVS = Arrays.asList( + "new_item","read_item", "preview_item", "edit_item", + "categorize_items", "delete_item", "approve_item", + "publish"); + final List MNGR_PRIVS = Arrays.asList( + "new_item","read_item", "preview_item", "edit_item", + "categorize_items", "delete_item", "approve_item", + "publish", + "staff_admin", "content_type_admin", "lifecycle_admin", + "workflow_admin", "category_admin"); + + m_staffGroup = new ArrayList(); + + m_staffGroup.add + ( new ArrayList() {{ add("Author"); + add("Creates new content"); + add(AUTH_PRIVS); + add("Authoring"); + }} + ); + m_staffGroup.add + ( new ArrayList() {{ add("Editor"); + add("Reviews and approves the author's work"); + add(EDIT_PRIVS); + add("Approval"); + }} + ); + m_staffGroup.add + ( new ArrayList() {{ add("Publisher"); + add("Deploys the content to the web site"); + add(PUBL_PRIVS); + add("Publishing"); + }} + ); + m_staffGroup.add + ( new ArrayList() {{ add("Manager"); + add("Manages the overall content section"); + add(MNGR_PRIVS); + // NB, manager doesn't have any assigned + // task for workflow - (as usual) + }} + ); + + return (List) m_staffGroup ; + + } + + /** + * Retrieve whether the content-section is publicly viewable (i.e. without + * registration and login) + */ + public Boolean isPubliclyViewable() { + return ((Boolean) get(m_isPublic)).booleanValue(); + } + + /** + * Retrieve the item resolver class + */ + public String getItemResolverClass() { + return (String) get(m_itemResolverClass); + } + + /** + * Retrieve the template resolver class + */ + public String getTemplateResolverClass() { + return (String) get(m_templateResolverClass); + } + + + /** + * Retrieve weather to use section specific categories. If true they are + * loaded using the next parameters file list {@see getUseSectionCategories()} + * + * Default value is false, so standard navigation is used. + * @return + */ + public final boolean getUseSectionCategories() { + return ((Boolean) get(m_useSectionCategories)).booleanValue(); + } + + /** + * Retrieve the list of files containing categories to load. + * In old Initialiser: Parameter name: CATEGORIES + * Deskr. "XML file containing the category tree" + */ + public List getCategoryFileList() { + String[] catFiles = (String[]) get(m_categoryFileList); + return Arrays.asList(catFiles); + } + + /** + * Retrieve the + */ + public List getContentSectionsContentTypes() { + String[] taskAlerts = (String[]) get(m_contentTypeList); + return Arrays.asList(taskAlerts); + } + + /** + * Retrieve the list of workflow tasks and events for each tasks which + * should receive overdue notification alerts + */ + public List getTaskAlerts() { + String[] ctTypes = (String[]) get(m_contentTypeList); + return Arrays.asList(ctTypes); + } + + + // Parameters controlling Overdue Task alerts: + + + /** + * getSendOverdueAlerts: Retrieve wether we should send alerts about + * overdue tasks at all? + */ + public final boolean getSendOverdueAlerts() { + return ((Boolean) get(m_sendOverdueAlerts)).booleanValue(); } + + /** + * getTaskDuration: Retrieve the time between when a task is enabled + * (it is made available for completion) and when it is considered + * overdue (in HOURS) + */ + public final Integer getTaskDuration() { + return ((Integer) get(m_taskDuration)); } + + /** + * getAlertInterval: Retrieve the time to wait between sending successive + * alerts on the same overdue task (in HOURS) + */ + public final Integer getOverdueAlertInterval() { + return ((Integer) get(m_overdueAlertInterval)); } + + /** + * maxAlerts: Retrieve the maximum number of alerts to send about any one + * overdue task + */ + public final Integer getMaxAlerts() { + return ((Integer) get(m_maxAlerts)); } + + +// InputStream getTraversalAdapters() { +// return (InputStream) get(m_adapters); +// } + +// public String getDefaultLayout() { +// return (String) get(m_defaultLayout); +// } + +// public boolean getCreateUserWorkspaces() { +// return ((Boolean) get(m_createUserWorkspaces)).booleanValue(); +// } + +// public List getExcludedPortletTypes() { +// String[] excludedTypes = (String[]) get(m_excludedPortletTypes); +// return Arrays.asList(excludedTypes); +// } + +// public List getAdminPortletTypes() { +// String[] adminTypes = (String[]) get(m_adminPortletTypes); +// return Arrays.asList(adminTypes); +// } + + +} diff --git a/ccm-cms/src/com/arsdigita/cms/LoaderConfig_parameter.properties b/ccm-cms/src/com/arsdigita/cms/LoaderConfig_parameter.properties new file mode 100644 index 000000000..254b59cf1 --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/LoaderConfig_parameter.properties @@ -0,0 +1,9 @@ +com.arsdigita.cms.loader.workspace_url.title=Delay +com.arsdigita.cms.loader.workspace_url.purpose=How long to wait (in seconds) after system startup before start lifecycle processing A value of 0 disables LC background thread.. +com.arsdigita.cms.loader.workspace_url.example=60 +com.arsdigita.cms.loader.workspace_url.format=[integer] + +com.arsdigita.cms.loader.content_center_map.title=Frequency +com.arsdigita.cms.loader.content_center_map.purpose=How often (in seconds) does the system look for pending items to make them live and live items to expire. +com.arsdigita.cms.loader.content_center_map.example=600 +com.arsdigita.cms.loader.content_center_map.format=[integer] diff --git a/ccm-cms/src/com/arsdigita/cms/contentsection/ContentSectionConfig.java b/ccm-cms/src/com/arsdigita/cms/contentsection/ContentSectionConfig.java new file mode 100644 index 000000000..d2e891d75 --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/contentsection/ContentSectionConfig.java @@ -0,0 +1,215 @@ +/* + * Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package com.arsdigita.cms.contentsection; + +//import com.arsdigita.kernel.permissions.PrivilegeDescriptor; +import com.arsdigita.runtime.AbstractConfig; +import com.arsdigita.util.parameter.BooleanParameter; +//import com.arsdigita.util.parameter.ErrorList; +import com.arsdigita.util.parameter.IntegerParameter; +import com.arsdigita.util.parameter.Parameter; +//import com.arsdigita.util.parameter.ParameterError; +//import com.arsdigita.util.parameter.StringArrayParameter; +import com.arsdigita.util.parameter.StringParameter; +// import com.arsdigita.util.parameter.ResourceParameter; +// import com.arsdigita.util.parameter.URLParameter; +//import com.arsdigita.util.StringUtils; + +// import java.io.InputStream; +//import java.util.Arrays; +//import java.util.List; +//import java.util.ArrayList; + +import org.apache.log4j.Logger; + +/** + * Configuration parameter to configure a content section during startup. + * + * Configures parameter which are not persisted in the database and may be + * changes during each startup of the system. + * @author pb + */ +public final class ContentSectionConfig extends AbstractConfig { + + /** Private Logger instance. */ + private static final Logger s_log = + Logger.getLogger(ContentSectionConfig.class); + + + +// /////////////////////////////////////////////////////// +// +// Set of parameters which specify a new content section +// to be created during next startup of the system. If +// the section already exists (created during previous +// startups) parameters are ignored and not processed. +// +// /////////////////////////////////////////////////////// + + /** + * The name of a new content section to be create during next boot of the + * system. During subsequent startups, when the section to be created + * already exists, the parameter is ignored and processing skipped. + * + * Empty by default so no processing will take place. + */ + private final Parameter + m_newContentSectionName = new StringParameter( + "com.arsdigita.cms.contentsection.new_section_name", + Parameter.REQUIRED, + null); + + + // Parameters controlling Overdue Task alerts: + + + /** + * Should we send alerts about overdue tasks at all? + * Send alerts when a task is overdue (has remained in the \"enabled\" state + * for a long time) + * Parameter SEND_OVERDUE_ALERTS in the old initializer system, default false + */ + private final Parameter + m_sendOverdueAlerts = new BooleanParameter( + "com.arsdigita.cms.contentsection.send_overdue_alerts", + Parameter.REQUIRED, + false ); + + + /** + * The time between when a task is enabled (i.e. it is made available for + * completion) and when it is considered overdue (in HOURS). + */ + // XXX Once the Duration of a Task can actually be maintained (in the UI, + // or initialization parameters), we should use the value in the DB, and + // get rid of this + // Parameter name TASK_DURATION in the old initializer system. + // Description: How long a task can remain \"enabled\" before it is + // considered overdue (in hours) + private final Parameter + m_taskDuration = new IntegerParameter( + "com.arsdigita.cms.contentsection.task_duration", + Parameter.REQUIRED, + new Integer(96) ); + + + /** + * The time to wait between sending successive alerts on the same + * overdue task (in HOURS). + * Parameter name OVERDUE_ALERT_INTERVAL in old initializer system + * Description: Time to wait between sending overdue notifications on the + * same task (in hours) + */ + private final Parameter + m_alertInterval = new IntegerParameter( + "com.arsdigita.cms.contentsection.alert_interval", + Parameter.REQUIRED, + new Integer(24) ); + + + /** + * The maximum number of alerts to send about any one overdue task. + * Parameter name MAX_ALERTS in old initializer system. + * Description: The maximum number of alerts to send that a single task is + * overdue + */ + private final Parameter + m_maxAlerts = new IntegerParameter( + "com.arsdigita.cms.contentsection.max_alerts", + Parameter.REQUIRED, + new Integer(5) ); + + + /** + * Constructor, do not instantiate this class directly! + * + * @see ContentSection#getConfig() + **/ + public ContentSectionConfig() { + + register(m_newContentSectionName); + + register(m_sendOverdueAlerts); + register(m_taskDuration); + register(m_alertInterval); + register(m_maxAlerts); + } + + +// /////////////////////////////////////////////////////// +// +// Processing of parameters which specify a new content +// section to be created during (next) startup of the +// system. The initializer has to check if it already +// exists and skip processing. +// +// /////////////////////////////////////////////////////// + + + /** + * Retrieve the name of a new content-section to create. + * + * The initializer has to check if it already exists and skip processing. + */ + public String getNewContentSectionName() { + return (String) get(m_newContentSectionName); + } + + +// /////////////////////////////////////////////////////// +// +// Processing of parameters which handle the timing +// of overdue notification +// +// /////////////////////////////////////////////////////// + + + /** + * Retrieve whether to send overdue information for unfinished tasks. + */ + public Boolean getSendOverdueAlerts() { + return ((Boolean) get(m_sendOverdueAlerts)).booleanValue(); + } + + /** + * Retrieve time between when a task is enabled and when it is considered + * overdue. + */ + public Integer getTaskDuration() { + return ((Integer) get(m_taskDuration)).intValue(); + } + + /** + * Retrieve the time to wait between sending successive alerts on the same + * overdue task (in HOURS). + */ + public Integer getAlertInterval() { + return (Integer) get(m_alertInterval); + } + + /** + * Retrieve the maximum number of alerts to send that a single task is + * overdue + */ + public Integer getMaxAlerts() { + return (Integer) get(m_maxAlerts); + } + +} diff --git a/ccm-cms/src/com/arsdigita/cms/contentsection/ContentSectionConfig_parameter.properties b/ccm-cms/src/com/arsdigita/cms/contentsection/ContentSectionConfig_parameter.properties new file mode 100755 index 000000000..3c2425d79 --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/contentsection/ContentSectionConfig_parameter.properties @@ -0,0 +1,11 @@ +com.arsdigita.cms.contentsection.new_section_name.title=Name of a new content section to be created during next ccm startup. +com.arsdigita.cms.contentsection.new_section_name.purpose=Name of a new content section to be created during next ccm startup. Will be ignored if it already exists. +com.arsdigita.cms.contentsection.new_section_name.example=content +com.arsdigita.cms.contentsection.new_section_name.format=[string] + +com.arsdigita.cms.contentsection.xxx.title= +com.arsdigita.cms.contentsection.xxx.purpose= +com.arsdigita.cms.contentsection.xxx.example=/default/item.jsp +com.arsdigita.cms.contentsection.xxx.format=[string] + + diff --git a/ccm-cms/src/com/arsdigita/cms/contentsection/Initializer.java b/ccm-cms/src/com/arsdigita/cms/contentsection/Initializer.java new file mode 100644 index 000000000..5808610f5 --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/contentsection/Initializer.java @@ -0,0 +1,226 @@ +/* + * Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +package com.arsdigita.cms.contentsection; + +import com.arsdigita.cms.ContentSection; +import com.arsdigita.cms.LoaderConfig; +import com.arsdigita.cms.installer.ContentSectionSetup; +import com.arsdigita.cms.installer.Util; +import com.arsdigita.cms.util.GlobalizationUtil; +import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.kernel.SiteNode; +import com.arsdigita.persistence.SessionManager; +import com.arsdigita.persistence.TransactionContext; +import com.arsdigita.runtime.CompoundInitializer; +import com.arsdigita.runtime.ConfigError; +// import com.arsdigita.runtime.DataInitEvent; +import com.arsdigita.runtime.DomainInitEvent; +import com.arsdigita.util.Assert; +import com.arsdigita.web.Application; + +import java.math.BigDecimal; +import java.util.Iterator; +import java.util.Timer; + +import org.apache.log4j.Logger; + + +// CURRENT STATUS: +// (Simple) Migration of the Old Initializer code of this package to the new +// initializer system. Current goal is a pure replacement with as less code +// changes as possible. +// In a second step a restructure of the code will be done. + + +/** + * XXX Reformulate according to the code development! + *

Initializes a content section, registering a default workflow, lifecycle & + * roles and adding the content types. + * + *

The initialization process takes several configuration + * parameters. The name is the name of the content + * section, the types is a list of content types + * to register + * + * @author Daniel Berrange (berrange@redhat.com) + * @author Michael Pih + * @author pb + * @version $Id: $ + */ +public class Initializer extends CompoundInitializer { + + + /** Creates a s_logging category with name = to the full name of class */ + private static Logger s_log = Logger.getLogger(Initializer.class); + + /** Local configuration object LoaderConfig containing immutable parameters + after installation. */ + // private static final LoaderConfig s_conf = LoaderConfig.getConfig(); + private static final LoaderConfig s_conf = new LoaderConfig(); + + /** The Timer used to send Unfinished notifications */ + private static Timer s_unfinishedTimer; + + + public Initializer() { + //final String url = RuntimeConfig.getConfig().getJDBCURL(); + //final int database = DbHelper.getDatabaseFromURL(url); + } + +// /** +// * An empty implementation of {@link Initializer#init(DataInitEvent)}. +// * +// * @param evt The data init event. +// */ +// public void init(DataInitEvent evt) { +// } + /** + * Initializes domain-coupling machinery, usually consisting of + * registering object instantiators and observers. + * + */ + public void init(DomainInitEvent evt) { + s_log.debug("CMS.installer.Initializer.init(DomainInitEvent) invoked"); + + // Recursive invokation of init, is it really necessary?? + // On the other hand: + // An empty implementations prevents this initializer from being executed. + // A missing implementations causes the super class method to be executed, + // which invokes the above added LegacyInitializer. + // If super is not invoked, various other cms sub-initializer may not run. + super.init(evt); + + // Create and mount the demo content section if it does not exist. + // String name = (String) m_conf.getParameter(NAME); + String name = s_conf.getContentSectionName(); + + TransactionContext txn = + SessionManager.getSession().getTransactionContext(); + txn.beginTxn(); + ContentSectionSetup.setupContentSectionAppType(); + + Util.validateURLParameter("name", name); + + String sitemapEntry = "/" + name + "/"; + if (Application.isInstalled(ContentSection.BASE_DATA_OBJECT_TYPE, + sitemapEntry)) { + s_log.info("skipping " + name + + " because it is already installed"); + } else { + s_log.info("Installing " + name + " at " + + sitemapEntry); + createSection(name); + } + + ContentSection section = retrieveContentSection(name); + Assert.exists(section, ContentSection.class); + ContentSectionSetup setup = new ContentSectionSetup(section); + + setup.loadAlertPrefs( s_conf.getTaskAlerts()); + + s_unfinishedTimer = setup.startNotifierTask + (s_conf.getSendOverdueAlerts(), + s_conf.getTaskDuration(), + s_conf.getOverdueAlertInterval(), + s_conf.getMaxAlerts()); + + txn.commitTxn(); + + s_log.debug("CMS.installer.Initializer.init(DomainInitEvent) completed"); + } + + + /** + * + * @param name + * @return + */ + private ContentSection retrieveContentSection(String name) { + BigDecimal rootNodeID = SiteNode.getRootSiteNode().getID(); + SiteNode node = null; + try { + node = SiteNode.getSiteNode("/" + name); + } catch (DataObjectNotFoundException ex) { + throw new ConfigError( + (String) GlobalizationUtil.globalize( + "cms.installer.root_site_node_missing").localize() + ex ); + } + ContentSection section = null; + if ( rootNodeID.equals(node.getID()) ) { + // This instance does not exist yet. + section = createSection(name); + } else { + try { + section = ContentSection.getSectionFromNode(node); + } catch (DataObjectNotFoundException de) { + throw new ConfigError( + (String) GlobalizationUtil.globalize( + "cms.installer.could_not_load_section", + new Object[] {name}).localize() + de ); + } + } + return section; + } + /** + * Install the CMS Demo. + */ + private ContentSection createSection(String name) { + + s_log.info("Creating content section on /" + name); + + + ContentSection section = ContentSection.create(name); + + ContentSectionSetup setup = new ContentSectionSetup(section); + + // Setup the access controls + + // section specific categories, usually not used. + // During initial load at install time nor used at all! + if (ContentSection.getConfig().getUseSectionCategories()) { + // Iterator files = ((List) m_conf.getParameter(CATEGORIES)).iterator(); + Iterator files = s_conf.getCategoryFileList().iterator(); + while ( files.hasNext() ) { + setup.registerCategories((String) files.next()); + } + } + + // setup.registerRoles((List)m_conf.getParameter(ROLES)); + setup.registerRoles(s_conf.getStuffGroup()); + // setup.registerViewers((Boolean)m_conf.getParameter(PUBLIC)); + setup.registerViewers(s_conf.isPubliclyViewable()); + setup.registerAlerts(); + setup.registerPublicationCycles(); + setup.registerWorkflowTemplates(); + // setup.registerContentTypes((List)m_conf.getParameter(TYPES)); + setup.registerContentTypes(s_conf.getContentSectionsContentTypes()); + // setup.registerResolvers + // ((String) m_conf.getParameter(ITEM_RESOLVER_CLASS), + // (String) m_conf.getParameter(TEMPLATE_RESOLVER_CLASS)); + setup.registerResolvers + (s_conf.getItemResolverClass(), + s_conf.getTemplateResolverClass()); + section.save(); + + return section; + } + +} diff --git a/ccm-cms/src/com/arsdigita/cms/contentsection/enterprise.init b/ccm-cms/src/com/arsdigita/cms/contentsection/enterprise.init new file mode 100644 index 000000000..4d29ab737 --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/contentsection/enterprise.init @@ -0,0 +1,10 @@ +// CMS initialization file +// +// $Id: enterprise.init 2070 2010-01-28 08:47:41Z pboy $ +// +// Migration status: Config parameters in new cms/LoaderConfig for initial (invariant) +// configuration during installation. See initialization / loading of ccm-ldn-portal. +// In parallel options are in new contentsection/ContentSectionConfig for +// additional content-sections during a system startup. +// All config options are replaced by new config +init com.arsdigita.cms.installer.SectionLegacyInitializer { } diff --git a/ccm-cms/src/com/arsdigita/cms/enterprise.init b/ccm-cms/src/com/arsdigita/cms/enterprise.init index dec46a07d..4501aa484 100755 --- a/ccm-cms/src/com/arsdigita/cms/enterprise.init +++ b/ccm-cms/src/com/arsdigita/cms/enterprise.init @@ -3,26 +3,48 @@ // $Id: enterprise.init 2070 2010-01-28 08:47:41Z pboy $ // -init com.arsdigita.cms.installer.Initializer { - updateMasterObject = false; - workspace = "content-center"; - contentCenterMap = "/WEB-INF/resources/content-center-map.xml"; -} -init com.arsdigita.cms.installer.xml.ContentTypeInitializer { - contentTypes = { - "/WEB-INF/content-types/GenericAddress.xml", - "/WEB-INF/content-types/GenericArticle.xml", - "/WEB-INF/content-types/GenericContact.xml", - "/WEB-INF/content-types/GenericPerson.xml", - "/WEB-INF/content-types/Template.xml" - }; -} +// Migration status: Config parameters in cms/LoaderConfig (these options are to +// be used only once during installation). +// Config options in Initializer replaced by the new Config. +// Invoking the Initializer rewritten to a separate enterprise.init in +// c.ad.cms.installer and modified in c.ad.cms.initializer + +// init com.arsdigita.cms.installer.Initializer { +// updateMasterObject = false; +// workspace = "content-center"; +// contentCenterMap = "/WEB-INF/resources/content-center-map.xml"; +// } + + +// Migration status: Config parameter in cms/CoaderConfig (this option is to be +// used only once during installation). +// Config option replaced by new Config. +// Moved into loader because it is a typical loader task (load some configuration +// parameters into database) + +// init com.arsdigita.cms.installer.xml.ContentTypeInitializer { +// contentTypes = { +// "/WEB-INF/content-types/GenericAddress.xml", // added in r450 +// "/WEB-INF/content-types/GenericArticle.xml", // added in r450 +// "/WEB-INF/content-types/GenericContact.xml", // added in r450 +// "/WEB-INF/content-types/GenericPerson.xml", // added in r450 +// "/WEB-INF/content-types/Template.xml" +// }; +// } -init com.arsdigita.cms.installer.SectionInitializer { +// Migration status: Config parameters in new cms/LoaderConfig for initial (invariant) +// configuration during installation. See initialization / loading of ccm-ldn-portal. +// In parallel options are in new contentsection/ContentSectionConfig for +// additional content-sections during a system startup. +// All config options are replaced by new config +// Invoking the Initializer rewritten to a separate enterprise.init in +// c.ad.cms.contentsection and modified in c.ad.cms.initializer +// init com.arsdigita.cms.installer.SectionInitializer { +// // Name of the content section. This is used as the URL // so it must contain only characters that are allowed in URLs e.g., // no spaces. @@ -31,41 +53,41 @@ init com.arsdigita.cms.installer.SectionInitializer { // - Parameter waf.pagemap.login_redirect=content/content-center-redirect.jsp // in integrations.properties of the respective bundle // - registerDomain(navigationKey, "/content/", null); in ldn.aplaws.Loader - name = "content"; - +// name = "content"; +// // List of roles to create. First field is role name, // second is the description, third is a list of // privileges, and (optional) fourth is the workflow // task to assign to - roles = { - { - "Author", "Creates new content", - { "new_item", "read_item", "preview_item", "edit_item", - "categorize_items" }, - "Authoring" - }, - { - "Editor", "Approves the author's work", - { "edit_item", "new_item", "delete_item", "approve_item", - "read_item", "preview_item", "categorize_items" }, - "Approval" - }, - { - "Publisher", "Deploys the content to the web site", - { "edit_item", "new_item", "delete_item", - "publish", "read_item", "preview_item", "categorize_items" }, - "Publishing" - }, - { - "Manager", "Manages the overall content section", - { "delete_item", "edit_item", "new_item", - "staff_admin", "content_type_admin", "lifecycle_admin", - "workflow_admin", "category_admin", "publish", - "read_item", "preview_item", "categorize_items" } +// roles = { +// { +// "Author", "Creates new content", +// { "new_item", "read_item", "preview_item", "edit_item", +// "categorize_items" }, +// "Authoring" +// }, +// { +// "Editor", "Approves the author's work", +// { "edit_item", "new_item", "delete_item", "approve_item", +// "read_item", "preview_item", "categorize_items" }, +// "Approval" +// }, +// { +// "Publisher", "Deploys the content to the web site", +// { "edit_item", "new_item", "delete_item", +// "publish", "read_item", "preview_item", "categorize_items" }, +// "Publishing" +// }, +// { +// "Manager", "Manages the overall content section", +// { "delete_item", "edit_item", "new_item", +// "staff_admin", "content_type_admin", "lifecycle_admin", +// "workflow_admin", "category_admin", "publish", +// "read_item", "preview_item", "categorize_items" } // NB, manager doesn't have any assigned task for workflow - } - }; - +// } +// }; +// // List of content types to register // Example: @@ -77,8 +99,8 @@ init com.arsdigita.cms.installer.SectionInitializer { // The types are registered when the content-section is created. Later // modifications have no effect. - types = { - }; +// types = { +// }; //-- types = { //-- "com.arsdigita.cms.contenttypes.Address", //-- "com.arsdigita.cms.contenttypes.Article", @@ -86,10 +108,10 @@ init com.arsdigita.cms.installer.SectionInitializer { //-- }; // Category tree to load - categories = { "/WEB-INF/resources/article-categories.xml", "/WEB-INF/resources/navigation-categories.xml" }; +// categories = { "/WEB-INF/resources/article-categories.xml", "/WEB-INF/resources/navigation-categories.xml" }; // Wether to make content viewable to 'The Public', ie non-registered users - public = true; +// public = true; // When to generate email alerts: by default, generate email alerts // on enable, finish, and rollback (happens on rejection) @@ -122,10 +144,10 @@ init com.arsdigita.cms.installer.SectionInitializer { // overdue task (in HOURS) // maxAlerts: The maximum number of alerts to send about any one // overdue task - sendOverdueAlerts = false; - taskDuration = 96; - alertInterval = 24; - maxAlerts = 5; +// sendOverdueAlerts = false; +// taskDuration = 96; +// alertInterval = 24; +// maxAlerts = 5; // default value (site-wide) is handled via the parameter // com.arsdigita.cms.default_item_resolver_class. @@ -140,7 +162,7 @@ init com.arsdigita.cms.installer.SectionInitializer { // you are changing from the default for a specific content section // Name of the template resolver class. This class must implement com.arsdigita.cms.dispatcher.TemplateResolver. //templateResolverClass = "com.arsdigita.cms.dispatcher.DefaultTemplateResolver"; -} +// } init com.arsdigita.formbuilder.installer.Initializer { @@ -224,7 +246,7 @@ init com.arsdigita.formbuilder.installer.Initializer { //Used when running CMS in conjunction with a Portal -init com.arsdigita.cms.installer.portlet.Initializer {} +// init com.arsdigita.cms.installer.portlet.Initializer {} @@ -359,7 +381,7 @@ init com.arsdigita.cms.installer.portlet.Initializer {} // } -// This is mot needed for a longtime. +// This is not needed for a longtime. // It has been commented out since revision 473 (Aug. 2005) or earlier // Had been active in initial aplaws checkin (at rev. 8 about 2004) // Modified in r473 as a svn:merge of 319-431 diff --git a/ccm-cms/src/com/arsdigita/cms/installer/ContentCenterSetup.java b/ccm-cms/src/com/arsdigita/cms/installer/ContentCenterSetup.java index 8fd53f2c6..de6f8d060 100755 --- a/ccm-cms/src/com/arsdigita/cms/installer/ContentCenterSetup.java +++ b/ccm-cms/src/com/arsdigita/cms/installer/ContentCenterSetup.java @@ -45,17 +45,18 @@ import org.xml.sax.SAXException; */ public final class ContentCenterSetup { + + /** URL to access the CMS Workspace, by default content-center */ final String m_workspaceURL; - - /** - * Map of URL stubs and resource handler classes for - * ContentCenterDispatcher to use nasakai@redhat.com - */ - + /** Map of URL stubs and resource handler classes for ContentCenterDispatcher + * to use */ final String m_contentCenterMap; + /** Contains mapping of URL (key) to resource handler*/ private static HashMap s_pageClasses = new HashMap(); + + /** Contains mapping of resource(key) to resource handler */ private static HashMap s_pageURLs = new HashMap(); @@ -69,22 +70,26 @@ public final class ContentCenterSetup { private static Logger s_log = Logger.getLogger(ContentSectionSetup.class); - public ContentCenterSetup( - String workspaceURL, - String contentCenterMap) { - m_contentCenterMap = contentCenterMap; + /** + * Constructor + * @param workspaceURL + * @param contentCenterMap + */ + public ContentCenterSetup( String workspaceURL, + String contentCenterMap) { + m_contentCenterMap = contentCenterMap; m_workspaceURL = workspaceURL; } - /** Gives you a mappting of URL (key) to resource handler + /** Gives you a mapping of URL (key) to resource handler * Use the returned map like so: map.get("search"); */ public static HashMap getURLToClassMap() { return s_pageClasses; } - /** Gives you a mappting of resource(key) to resource handler + /** Gives you a mapping of resource(key) to resource handler * Use the returned map like so: map.get("com.arsdigita.cms.ui.WorkspacePage"); */ public static HashMap getClassToURLMap() { diff --git a/ccm-cms/src/com/arsdigita/cms/installer/ContentSectionSetup.java b/ccm-cms/src/com/arsdigita/cms/installer/ContentSectionSetup.java index 366d694f2..f998b3014 100755 --- a/ccm-cms/src/com/arsdigita/cms/installer/ContentSectionSetup.java +++ b/ccm-cms/src/com/arsdigita/cms/installer/ContentSectionSetup.java @@ -43,6 +43,8 @@ import com.arsdigita.kernel.Role; import com.arsdigita.kernel.permissions.PermissionService; import com.arsdigita.kernel.permissions.PrivilegeDescriptor; import com.arsdigita.persistence.DataObject; +import com.arsdigita.runtime.AbstractConfig; +import com.arsdigita.cms.LoaderConfig; import com.arsdigita.util.Assert; import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.web.ApplicationSetup; @@ -76,37 +78,57 @@ import org.xml.sax.helpers.DefaultHandler; public final class ContentSectionSetup { + private static Logger s_log = Logger.getLogger(ContentSectionSetup.class); private final static String STYLESHEET = "/packages/content-section/xsl/cms.xsl"; - - private static Logger s_log = Logger.getLogger(ContentSectionSetup.class); private HashMap m_tasks = new HashMap(); private LifecycleDefinition m_lcd; private WorkflowTemplate m_wf; final ContentSection m_section; + + // Load main CMS configuration file + private static final LoaderConfig s_conf = new LoaderConfig(); + + /** + * Constructor + * @param section + */ public ContentSectionSetup(ContentSection section) { Assert.exists(section, ContentSection.class); m_section = section; } - public void run() { +// public void run() { +// +// // 4) Mount content sections. +// +// } - // 4) Mount content sections. - - } /** - * setup content section app type + * Setup content section app type */ + // Nach bisherigen Erkenntnissen: Braucht nur einmal aufgerufen zu werden, + // um den Typ in die Datenbank einzutragen, d.h. letztlich den Klassennamen + // mit zugehörien Support Klassen zu registrieren. Damit kann die Klasse + // noch nicht benutzt oder angesprochen werden. Dazu muss zumindest eine + // Instanz des Typs erstellt werden, (d.h. eine content section, z.B. die + // default section 'content'. Für einen Typ können im Prinzip mehrere + // Instanzen geschaffen werden, die sich vor allem durch den Namen, d.h. die + // URL, unter der sie angesprochen werden, unterscheiden. public static void setupContentSectionAppType() { + + // Install application type using new application classes ApplicationSetup setup = new ApplicationSetup(s_log); setup.setApplicationObjectType(ContentSection.BASE_DATA_OBJECT_TYPE); - setup.setKey(ContentSection.PACKAGE_TYPE); + setup.setKey(ContentSection.PACKAGE_TYPE); // by default: content-section setup.setTitle("CMS Content Section"); setup.setDescription("A CMS Content Section"); setup.setPortalApplication(false); //setup.setDispatcherClass(ContentItemDispatcher.class.getName()); - setup.setStylesheet(STYLESHEET); + setup.setStylesheet(STYLESHEET); // by default: /pack./c-s/xml/cms.xml + // contains the xsl to generate the page + setup.setInstantiator(new ACSObjectInstantiator() { public DomainObject doNewInstance(DataObject dataObject) { return new ContentSection(dataObject); @@ -117,6 +139,59 @@ public final class ContentSectionSetup { } + /** + * setup content section app instance + */ + public static void setupContentSectionAppInstance(String name, + List categoryFileList, + List staffGroup, + Boolean isPubliclyViewable) { + + s_log.info("Creating content section on /" + name); + + + ContentSection section = ContentSection.create(name); + + ContentSectionSetup setup = new ContentSectionSetup(section); + + // Setup the access controls + + // section specific categories, usually not used. + // During initial load at install time nor used at all! + if (ContentSection.getConfig().getUseSectionCategories()) { + // Iterator files = ((List) m_conf.getParameter(CATEGORIES)).iterator(); + // Iterator files = s_conf.getCategoryFileList().iterator(); + Iterator files = categoryFileList.iterator(); + while ( files.hasNext() ) { + setup.registerCategories((String) files.next()); + } + } + + setup.registerRoles(staffGroup); + // setup.registerViewers((Boolean)m_conf.getParameter(PUBLIC)); + setup.registerViewers(isPubliclyViewable); + setup.registerAlerts(); + setup.registerPublicationCycles(); + setup.registerWorkflowTemplates(); + // setup.registerContentTypes((List)m_conf.getParameter(TYPES)); + setup.registerContentTypes(s_conf.getContentSectionsContentTypes()); + // setup.registerResolvers + // ((String) m_conf.getParameter(ITEM_RESOLVER_CLASS), + // (String) m_conf.getParameter(TEMPLATE_RESOLVER_CLASS)); + setup.registerResolvers + (s_conf.getItemResolverClass(), + s_conf.getTemplateResolverClass()); + section.save(); + + // return section; + + } + + + /** + * + * @param filename + */ public void registerCategories(String filename) { if (filename == null) { diff --git a/ccm-cms/src/com/arsdigita/cms/installer/Initializer.java b/ccm-cms/src/com/arsdigita/cms/installer/Initializer.java index 661872773..116659326 100755 --- a/ccm-cms/src/com/arsdigita/cms/installer/Initializer.java +++ b/ccm-cms/src/com/arsdigita/cms/installer/Initializer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved. + * Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -16,26 +16,27 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ + package com.arsdigita.cms.installer; -import com.arsdigita.auditing.BasicAuditTrail; -import com.arsdigita.cms.dispatcher.ContentCenterDispatcher; -import com.arsdigita.cms.dispatcher.ItemDispatcher; -import com.arsdigita.domain.DomainObject; -import com.arsdigita.domain.DomainObjectFactory; -import com.arsdigita.domain.DomainObjectInstantiator; -import com.arsdigita.initializer.Configuration; -import com.arsdigita.initializer.InitializationException; -import com.arsdigita.persistence.DataObject; -import com.arsdigita.persistence.SessionManager; -import com.arsdigita.persistence.TransactionContext; +import com.arsdigita.cms.LoaderConfig; +import com.arsdigita.runtime.CompoundInitializer; +// import com.arsdigita.runtime.DataInitEvent; +import com.arsdigita.runtime.DomainInitEvent; import org.apache.log4j.Logger; - - +// CURRENT STATUS: +// (Simple) Migration of the Old Initializer code of this package to the new +// initializer system. Current goal is a pure replacement with as less code +// changes as possible. +// In a second step a restructure of the code will be done. /** + * XXX Reformulate according to the code development! + * + * Initializes the CMS package. + * *

The main initializer for the Content Management System.

* *

Initializes the Content Management System, including the Content Center @@ -43,55 +44,61 @@ import org.apache.log4j.Logger; * optionally initializes user-defined content types and user-defined content * sections.

* - * @author Michael Pih (pihman@arsdigita.com) - * @version $Revision: #47 $ $Date: 2004/08/17 $ - * @since ACS 5.0 + * + * @author Peter Boy (pboy@barkhof.uni-bremen.de) + * @version $Id: $ + * */ -public class Initializer extends com.arsdigita.kernel.BaseInitializer { +public class Initializer extends CompoundInitializer { + + /** Creates a s_logging category with name = to the full name of class */ private static Logger s_log = Logger.getLogger(Initializer.class); - private final static String CACHE_ITEMS - = "cacheItems"; - private static final String UPDATE_MASTER - = "updateMasterObject"; - private final static String CONTENT_CENTER_MAP - = "contentCenterMap"; - private final static String WORKSPACE - = "workspace"; - // Init script parameters - private Configuration m_conf = new Configuration(); + // private static PublishToFileConfig s_conf= PublishToFileConfig.getConfig(); + private static final LoaderConfig s_conf = new LoaderConfig(); +// LoaderConfig conf = LoaderConfig.getConfig(); +// As an example +// private static final ContentSectionConfig s_config = new ContentSectionConfig(); + +// static { +// s_config.load(); +// } + + public Initializer() { + //final String url = RuntimeConfig.getConfig().getJDBCURL(); + //final int database = DbHelper.getDatabaseFromURL(url); - public Initializer() throws InitializationException { - m_conf.initParameter - (WORKSPACE, "The name of the workspace package instance", - String.class); - m_conf.initParameter - (CACHE_ITEMS, - "Enable caching of content items", - Boolean.class, - Boolean.TRUE); - m_conf.initParameter - (UPDATE_MASTER, - "If true, attempts to recursively set the correct master object for " + - "all content items within the system.", - Boolean.class, - Boolean.FALSE); - m_conf.initParameter - (CONTENT_CENTER_MAP, - "XML Mapping of the content center tabs to " + - "URLs, see ContentCenterDispatcher", - String.class, - ContentCenterDispatcher.DEFAULT_MAP_FILE); - } - - public Configuration getConfiguration() { - return m_conf; } +// /** +// * An empty implementation of {@link Initializer#init(DataInitEvent)}. +// * +// * @param evt The data init event. +// */ +// public void init(DataInitEvent evt) { +// } /** + * Initializes domain-coupling machinery, usually consisting of + * registering object instantiators and observers. + * + */ + public void init(DomainInitEvent evt) { + s_log.debug("CMS.installer.Initializer.init(DomainInitEvent) invoked"); + + // Recursive invokation of init, is it really necessary?? + // On the other hand: + // An empty implementations prevents this initializer from being executed. + // A missing implementations causes the super class method to be executed, + // which invokes the above added LegacyInitializer. + // If super is not invoked, various other cms sub-initializer may not run. + super.init(evt); + + /* + * Imported from LegacyInitializer: + * TASK: * Check if CMS package type exists. If not, then: * *
    @@ -100,54 +107,45 @@ public class Initializer extends com.arsdigita.kernel.BaseInitializer { *
  1. create CMS Service package type and instance
  2. *
*/ - protected void doStartup() { - TransactionContext txn = - SessionManager.getSession().getTransactionContext(); - txn.beginTxn(); - - try { - - final String workspaceURL = (String) m_conf - .getParameter(WORKSPACE); - final String contentCenterMap = (String)m_conf - .getParameter(CONTENT_CENTER_MAP); // Update master object if upgrading from old versioning // XXX: shouldn't we just gut this section (and // VersioningUpgrader)? It is an upgrade fix from 5.1 or // earlier, and relying on VersionedACSObject is - // deprecated - final boolean updateMaster = - ((Boolean)m_conf.getParameter(UPDATE_MASTER)).booleanValue(); - if (updateMaster) { - VersioningUpgrader.updateMasterObject(); - } + // deprecated + // pb: But see: ContentItem.java, l. 1650 ff. (setVersion Recursively) + // VersionUptrader is used by lifecycle. + // pb begin + // final boolean updateMaster = + // ((Boolean)m_conf.getParameter(UPDATE_MASTER)).booleanValue(); + // if (updateMaster) { + // VersioningUpgrader.updateMasterObject(); + // } + // pb end + // From comment in original enterprise.init file: // XXX: ItemDispatcher is no longer used. Is the following - // still a valid enterprise.init parameter? Do we need t - // oset ContentSectionServlet.s_cacheItems instead of the + // still a valid enterprise.init parameter? Do we need to + // set ContentSectionServlet.s_cacheItems instead of the // below (which is currently always true), or does this go // away entirely? - final boolean cacheItems = - ((Boolean)m_conf.getParameter(CACHE_ITEMS)).booleanValue(); - s_log.debug("Set cache items to " + cacheItems); - ItemDispatcher.setCacheItems(cacheItems); + // NB. true is default for ItemDispatcher! + // This would be a typical domain init initialization task. + // final boolean cacheItems = + // s_conf. + // s_log.debug("Set cache items to " + cacheItems); + // ItemDispatcher.setCacheItems(cacheItems); + final String workspaceURL = s_conf.getWorkspaceURL(); + final String contentCenterMap = s_conf.getContentCenterMap(); ContentCenterSetup centerSetup = new ContentCenterSetup( workspaceURL, contentCenterMap); centerSetup.run(); - } finally { - txn.commitTxn(); - } + s_log.debug("CMS.installer.Initializer.init(DomainInitEvent) completed"); } - - protected void doShutdown() {} - - - } diff --git a/ccm-cms/src/com/arsdigita/cms/installer/LegacyInitializer.java b/ccm-cms/src/com/arsdigita/cms/installer/LegacyInitializer.java new file mode 100755 index 000000000..f5d373721 --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/installer/LegacyInitializer.java @@ -0,0 +1,172 @@ +/* + * Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.cms.installer; + +// unused import com.arsdigita.auditing.BasicAuditTrail; +import com.arsdigita.cms.LoaderConfig; +import com.arsdigita.cms.dispatcher.ContentCenterDispatcher; +import com.arsdigita.cms.dispatcher.ItemDispatcher; +// unused import com.arsdigita.domain.DomainObject; +// unused import com.arsdigita.domain.DomainObjectFactory; +// unused import com.arsdigita.domain.DomainObjectInstantiator; +import com.arsdigita.initializer.Configuration; +import com.arsdigita.initializer.InitializationException; +// unused import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.SessionManager; +import com.arsdigita.persistence.TransactionContext; + +import org.apache.log4j.Logger; + + + + +/** + *

The main initializer for the Content Management System.

+ * + *

Initializes the Content Management System, including the Content Center + * and CMS Service applications and CMS Mime Types service. This class also + * optionally initializes user-defined content types and user-defined content + * sections.

+ * + * @author Michael Pih (pihman@arsdigita.com) + * @version $Revision: #47 $ $Date: 2004/08/17 $ + * @since ACS 5.0 + */ +public class LegacyInitializer extends com.arsdigita.kernel.BaseInitializer { + + private static Logger s_log = Logger.getLogger(Initializer.class); + + private final static String CACHE_ITEMS + = "cacheItems"; + private static final String UPDATE_MASTER + = "updateMasterObject"; + private final static String CONTENT_CENTER_MAP + = "contentCenterMap"; + private final static String WORKSPACE + = "workspace"; + // Init script parameters + private Configuration m_conf = new Configuration(); + + // Temporär: Einbinden des neuen Parameter Systems + private static final LoaderConfig s_conf = new LoaderConfig(); +// LoaderConfig conf = LoaderConfig.getConfig(); + +// As an example +// private static final ContentSectionConfig s_config = new ContentSectionConfig(); + +// static { +// s_config.load(); +// } + + + + public LegacyInitializer() throws InitializationException { + m_conf.initParameter + (WORKSPACE, "The name of the workspace package instance", + String.class); + m_conf.initParameter + (CACHE_ITEMS, + "Enable caching of content items", + Boolean.class, + Boolean.TRUE); + m_conf.initParameter + (UPDATE_MASTER, + "If true, attempts to recursively set the correct master object for " + + "all content items within the system.", + Boolean.class, + Boolean.FALSE); + m_conf.initParameter + (CONTENT_CENTER_MAP, + "XML Mapping of the content center tabs to " + + "URLs, see ContentCenterDispatcher", + String.class, + ContentCenterDispatcher.DEFAULT_MAP_FILE); + } + + public Configuration getConfiguration() { + return m_conf; + } + + + /** + * Check if CMS package type exists. If not, then: + * + *
    + *
  1. create CMS package type
  2. + *
  3. create Workspace package type and instance
  4. + *
  5. create CMS Service package type and instance
  6. + *
+ */ + protected void doStartup() { + + TransactionContext txn = + SessionManager.getSession().getTransactionContext(); + txn.beginTxn(); + + try { + + //final String workspaceURL = (String) m_conf + // .getParameter(WORKSPACE); + //final String contentCenterMap = (String)m_conf + // .getParameter(CONTENT_CENTER_MAP); + + // Update master object if upgrading from old versioning + // XXX: shouldn't we just gut this section (and + // VersioningUpgrader)? It is an upgrade fix from 5.1 or + // earlier, and relying on VersionedACSObject is + // deprecated + // pb: But see: ContentItem.java, l. 1650 ff. (setVersion Recursively) + // VersionUptrader is used by lifecycle. + // pb begin + // final boolean updateMaster = + // ((Boolean)m_conf.getParameter(UPDATE_MASTER)).booleanValue(); + // if (updateMaster) { + // VersioningUpgrader.updateMasterObject(); + // } + // pb end + + // XXX: ItemDispatcher is no longer used. Is the following + // still a valid enterprise.init parameter? Do we need to + // set ContentSectionServlet.s_cacheItems instead of the + // below (which is currently always true), or does this go + // away entirely? + final boolean cacheItems = + ((Boolean)m_conf.getParameter(CACHE_ITEMS)).booleanValue(); + s_log.debug("Set cache items to " + cacheItems); + ItemDispatcher.setCacheItems(cacheItems); + + final String workspaceURL = s_conf.getWorkspaceURL(); + final String contentCenterMap = s_conf.getContentCenterMap(); + ContentCenterSetup centerSetup = new ContentCenterSetup( + workspaceURL, + contentCenterMap); + + centerSetup.run(); + + } finally { + txn.commitTxn(); + } + + } + + protected void doShutdown() {} + + + +} diff --git a/ccm-cms/src/com/arsdigita/cms/installer/SectionInitializer.java b/ccm-cms/src/com/arsdigita/cms/installer/SectionLegacyInitializer.java similarity index 52% rename from ccm-cms/src/com/arsdigita/cms/installer/SectionInitializer.java rename to ccm-cms/src/com/arsdigita/cms/installer/SectionLegacyInitializer.java index 2683f2ce6..fe0db4445 100755 --- a/ccm-cms/src/com/arsdigita/cms/installer/SectionInitializer.java +++ b/ccm-cms/src/com/arsdigita/cms/installer/SectionLegacyInitializer.java @@ -19,6 +19,7 @@ package com.arsdigita.cms.installer; import com.arsdigita.cms.ContentSection; +import com.arsdigita.cms.LoaderConfig; import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.initializer.Configuration; @@ -30,9 +31,9 @@ import com.arsdigita.util.Assert; import com.arsdigita.web.Application; import java.math.BigDecimal; -import java.util.Collections; +// import java.util.Collections; import java.util.Iterator; -import java.util.List; +// import java.util.List; import java.util.Timer; /** @@ -51,91 +52,110 @@ import java.util.Timer; * * @author Daniel Berrange (berrange@redhat.com) * @author Michael Pih - * @version $Id: SectionInitializer.java 287 2005-02-22 00:29:02Z sskracic $ + * @version $Id: SectionLegacyInitializer.java 287 2005-02-22 00:29:02Z sskracic $ */ -public class SectionInitializer extends com.arsdigita.kernel.BaseInitializer { +public class SectionLegacyInitializer extends com.arsdigita.kernel.BaseInitializer { private static org.apache.log4j.Logger s_log = - org.apache.log4j.Logger.getLogger(SectionInitializer.class); + org.apache.log4j.Logger.getLogger(SectionLegacyInitializer.class); - private static final String NAME = "name"; - private static final String TYPES = "types"; - private static final String ROLES = "roles"; - private static final String PUBLIC = "public"; - private static final String CATEGORIES = "categories"; - private static final String TASK_ALERTS = "taskAlerts"; - private static final String SEND_OVERDUE_ALERTS = "sendOverdueAlerts"; - private static final String TASK_DURATION = "taskDuration"; - private static final String OVERDUE_ALERT_INTERVAL = "alertInterval"; - private static final String MAX_ALERTS = "maxAlerts"; - private static final String ITEM_RESOLVER_CLASS = "itemResolverClass"; - private static final String TEMPLATE_RESOLVER_CLASS = "templateResolverClass"; +// private static final String NAME = "name"; +// private static final String TYPES = "types"; +// private static final String ROLES = "roles"; +// private static final String PUBLIC = "public"; +// private static final String CATEGORIES = "categories"; +// private static final String TASK_ALERTS = "taskAlerts"; +// private static final String SEND_OVERDUE_ALERTS = "sendOverdueAlerts"; +// private static final String TASK_DURATION = "taskDuration"; +// private static final String OVERDUE_ALERT_INTERVAL = "alertInterval"; +// private static final String MAX_ALERTS = "maxAlerts"; +// private static final String ITEM_RESOLVER_CLASS = "itemResolverClass"; +// private static final String TEMPLATE_RESOLVER_CLASS = "templateResolverClass"; - private Configuration m_conf = new Configuration(); +// private Configuration m_conf = new Configuration(); + + // Temporär: Einbinden des neuen Parameter Systems + private static final LoaderConfig s_conf = new LoaderConfig(); +// LoaderConfig conf = LoaderConfig.getConfig(); + +// As an example +// private static final ContentSectionConfig s_config = new ContentSectionConfig(); + + // Required to actually load the parameter file. + // Aktuell: wenn man das aktiviert, gibt's einen Fehler: Kontext existiert + // nicht, offensichtlich keine aktuelle Datei zugeordnet. +// static { +// s_conf.load(); +// } // the Timer used to send Unfinished notifications private static Timer s_unfinishedTimer; - public SectionInitializer() throws InitializationException { - m_conf.initParameter(NAME, - "The name of the content section", - String.class); - m_conf.initParameter(TYPES, - "The content types to register", - List.class); - m_conf.initParameter(ROLES, - "The roles to create", - List.class); - m_conf.initParameter(PUBLIC, - "Whether to make published content available to non-registered users", - Boolean.class); - m_conf.initParameter(CATEGORIES, - "XML file containing the category tree", - List.class, - Collections.EMPTY_LIST); - m_conf.initParameter(TASK_ALERTS, - "A list of workflow tasks, and the events for which alerts are sent", - List.class); - m_conf.initParameter(SEND_OVERDUE_ALERTS, - "Send alerts when a task is overdue (has remained in the \"enabled\" state for a long time)", - Boolean.class, - Boolean.FALSE); + public SectionLegacyInitializer() throws InitializationException { +// m_conf.initParameter(NAME, +// "The name of the content section", +// String.class); +// m_conf.initParameter(TYPES, +// "The content types to register", +// List.class); +// m_conf.initParameter(ROLES, +// "The roles to create", +// List.class); +// m_conf.initParameter(PUBLIC, +// "Whether to make published content available to non-registered users", +// Boolean.class); +// m_conf.initParameter(CATEGORIES, +// "XML file containing the category tree", +// List.class, +// Collections.EMPTY_LIST); +// m_conf.initParameter(TASK_ALERTS, +// "A list of workflow tasks, and the events for which alerts are sent", +// List.class); +// m_conf.initParameter(SEND_OVERDUE_ALERTS, +// "Send alerts when a task is overdue (has remained in the \"enabled\" state for a long time)", +// Boolean.class, +// Boolean.FALSE); // XXX Once the Duration of a Task can actually be maintained (in the UI, or initialization parameters), // we should use the value in the DB, and get rid of this - m_conf.initParameter(TASK_DURATION, - "How long a task can remain \"enabled\" before it is considered overdue (in hours)", - Integer.class); - m_conf.initParameter(OVERDUE_ALERT_INTERVAL, - "Time to wait between sending overdue notifications on the same task (in hours)", - Integer.class); - m_conf.initParameter(MAX_ALERTS, - "The maximum number of alerts to send that a single task is overdue", - Integer.class); - m_conf.initParameter(ITEM_RESOLVER_CLASS, - "The ItemResolver class to use for the section (defaults to MultilingualItemResolver)", - String.class); - m_conf.initParameter(TEMPLATE_RESOLVER_CLASS, - "The TemplateResolver class to use for the section (defaults to DefaultTemplateResolver)", - String.class); +// m_conf.initParameter(TASK_DURATION, +// "How long a task can remain \"enabled\" before it is considered overdue (in hours)", +// Integer.class); +// m_conf.initParameter(OVERDUE_ALERT_INTERVAL, +// "Time to wait between sending overdue notifications on the same task (in hours)", +// Integer.class); +// m_conf.initParameter(MAX_ALERTS, +// "The maximum number of alerts to send that a single task is overdue", +// Integer.class); +// m_conf.initParameter(ITEM_RESOLVER_CLASS, +// "The ItemResolver class to use for the section (defaults to MultilingualItemResolver)", +// String.class); +// m_conf.initParameter(TEMPLATE_RESOLVER_CLASS, +// "The TemplateResolver class to use for the section (defaults to DefaultTemplateResolver)", +// String.class); } + // required by parent class. public Configuration getConfiguration() { - return m_conf; +// return m_conf; + return null; } protected void doStartup() { // Create and mount the demo content section if it does not exist. - String name = (String) m_conf.getParameter(NAME); + // String name = (String) m_conf.getParameter(NAME); + String name = s_conf.getContentSectionName(); TransactionContext txn = SessionManager.getSession().getTransactionContext(); txn.beginTxn(); + + // Setup application type content-section first so that concrete + // content-section can be created. ContentSectionSetup.setupContentSectionAppType(); Util.validateURLParameter("name", name); - String sitemapEntry = "/" + name + "/"; if (Application.isInstalled(ContentSection.BASE_DATA_OBJECT_TYPE, sitemapEntry)) { @@ -151,17 +171,28 @@ public class SectionInitializer extends com.arsdigita.kernel.BaseInitializer { Assert.exists(section, ContentSection.class); ContentSectionSetup setup = new ContentSectionSetup(section); - setup.loadAlertPrefs((List) m_conf.getParameter(TASK_ALERTS)); + // setup.loadAlertPrefs((List) m_conf.getParameter(TASK_ALERTS)); + setup.loadAlertPrefs( s_conf.getTaskAlerts()); +// s_unfinishedTimer = setup.startNotifierTask +// ((Boolean) m_conf.getParameter(SEND_OVERDUE_ALERTS), +// (Integer) m_conf.getParameter(TASK_DURATION), +// (Integer) m_conf.getParameter(OVERDUE_ALERT_INTERVAL), +// (Integer) m_conf.getParameter(MAX_ALERTS)); s_unfinishedTimer = setup.startNotifierTask - ((Boolean) m_conf.getParameter(SEND_OVERDUE_ALERTS), - (Integer) m_conf.getParameter(TASK_DURATION), - (Integer) m_conf.getParameter(OVERDUE_ALERT_INTERVAL), - (Integer) m_conf.getParameter(MAX_ALERTS)); + (s_conf.getSendOverdueAlerts(), + s_conf.getTaskDuration(), + s_conf.getOverdueAlertInterval(), + s_conf.getMaxAlerts()); txn.commitTxn(); } + /** + * + * @param name + * @return + */ private ContentSection retrieveContentSection(String name) { BigDecimal rootNodeID = SiteNode.getRootSiteNode().getID(); SiteNode node = null; @@ -210,22 +241,31 @@ public class SectionInitializer extends com.arsdigita.kernel.BaseInitializer { // Setup the access controls + // section specific categories, usually not used. + // During initial load at install time nor used at all! if (ContentSection.getConfig().getUseSectionCategories()) { - Iterator files = ((List) m_conf.getParameter(CATEGORIES)).iterator(); + // Iterator files = ((List) m_conf.getParameter(CATEGORIES)).iterator(); + Iterator files = s_conf.getCategoryFileList().iterator(); while ( files.hasNext() ) { setup.registerCategories((String) files.next()); } } - setup.registerRoles((List)m_conf.getParameter(ROLES)); - setup.registerViewers((Boolean)m_conf.getParameter(PUBLIC)); + // setup.registerRoles((List)m_conf.getParameter(ROLES)); + setup.registerRoles(s_conf.getStuffGroup()); + // setup.registerViewers((Boolean)m_conf.getParameter(PUBLIC)); + setup.registerViewers(s_conf.isPubliclyViewable()); setup.registerAlerts(); setup.registerPublicationCycles(); setup.registerWorkflowTemplates(); - setup.registerContentTypes((List)m_conf.getParameter(TYPES)); + // setup.registerContentTypes((List)m_conf.getParameter(TYPES)); + setup.registerContentTypes(s_conf.getContentSectionsContentTypes()); + // setup.registerResolvers + // ((String) m_conf.getParameter(ITEM_RESOLVER_CLASS), + // (String) m_conf.getParameter(TEMPLATE_RESOLVER_CLASS)); setup.registerResolvers - ((String) m_conf.getParameter(ITEM_RESOLVER_CLASS), - (String) m_conf.getParameter(TEMPLATE_RESOLVER_CLASS)); + (s_conf.getItemResolverClass(), + s_conf.getTemplateResolverClass()); section.save(); return section; diff --git a/ccm-cms/src/com/arsdigita/cms/installer/enterprise.init b/ccm-cms/src/com/arsdigita/cms/installer/enterprise.init new file mode 100644 index 000000000..bd88869e7 --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/installer/enterprise.init @@ -0,0 +1,15 @@ +// CMS initialization file +// +// $Id: enterprise.init 2070 2010-01-28 08:47:41Z pboy $ +// + +// Migration status: Config parameters in cms/LoaderConfig (these options are to +// be used only once during installation). +// Config options in Initializer replaced by the new Config. +init com.arsdigita.cms.installer.LegacyInitializer { + updateMasterObject = false; + workspace = "content-center"; + contentCenterMap = "/WEB-INF/resources/content-center-map.xml"; +} + + diff --git a/ccm-cms/src/com/arsdigita/cms/installer/portlet/Initializer.java b/ccm-cms/src/com/arsdigita/cms/installer/portlet/Initializer.java index 428018c01..66fd6a4c7 100755 --- a/ccm-cms/src/com/arsdigita/cms/installer/portlet/Initializer.java +++ b/ccm-cms/src/com/arsdigita/cms/installer/portlet/Initializer.java @@ -52,6 +52,10 @@ public class Initializer private Configuration m_conf = new Configuration(); + /** + * Empty Constructor! + * @throws InitializationException + */ public Initializer() throws InitializationException { } diff --git a/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentTypeHelper.java b/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentTypeHelper.java index 8915b3def..d1f356423 100755 --- a/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentTypeHelper.java +++ b/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentTypeHelper.java @@ -65,6 +65,7 @@ public interface ContentTypeHelper { */ public void setDescriptionKey(String descriptionKey); public String getDescriptionKey(); + public void setObjectType(String objType); public String getObjectType() ; public void setClassName(String classname) ; diff --git a/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentTypeInitializer.java b/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentTypeLegacyInitializer.java similarity index 77% rename from ccm-cms/src/com/arsdigita/cms/installer/xml/ContentTypeInitializer.java rename to ccm-cms/src/com/arsdigita/cms/installer/xml/ContentTypeLegacyInitializer.java index 4d57f96bc..cc5a3bf49 100755 --- a/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentTypeInitializer.java +++ b/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentTypeLegacyInitializer.java @@ -19,6 +19,7 @@ package com.arsdigita.cms.installer.xml; +import com.arsdigita.cms.LoaderConfig; import com.arsdigita.initializer.Configuration; import com.arsdigita.initializer.InitializationException; import com.arsdigita.kernel.BaseInitializer; @@ -29,8 +30,11 @@ import com.arsdigita.xml.XML; import java.util.Iterator; import java.util.List; +// This initializer loads definitions into the database and is a +// LOADER TASK! (pboy) -/** Parses XML file definition of content types and loads them to the +/** + * Parses XML file definition of content types and loads them to the * database. The XML config looks like the example below, the * "parentType" and "name" attributes are optional, and only required * for creating User Defined ContentTypes. Label corresponds to @@ -67,23 +71,28 @@ import java.util.List; * @author Nobuko Asakai * @see XMLContentTypeHandler */ -public class ContentTypeInitializer extends BaseInitializer { - public static final String CONTENT_TYPES = "contentTypes"; +public class ContentTypeLegacyInitializer extends BaseInitializer { - private Configuration m_conf = new Configuration(); private static org.apache.log4j.Logger s_log = - org.apache.log4j.Logger.getLogger(ContentTypeInitializer.class); + org.apache.log4j.Logger.getLogger(ContentTypeLegacyInitializer.class); - public ContentTypeInitializer() { + // Load main CMS configuration file + private static final LoaderConfig s_conf = new LoaderConfig(); + +// public static final String CONTENT_TYPES = "contentTypes"; +// private Configuration m_conf = new Configuration(); + + public ContentTypeLegacyInitializer() { // Could make this a list later... - m_conf.initParameter - (CONTENT_TYPES, - "Path to XML files that contains content type definition", - List.class); +// m_conf.initParameter +// (CONTENT_TYPES, +// "Path to XML files that contains content type definition", +// List.class); } public Configuration getConfiguration() { - return m_conf; + // return m_conf; + return null; } protected void doShutdown() { @@ -91,7 +100,8 @@ public class ContentTypeInitializer extends BaseInitializer { } protected void doStartup() throws InitializationException { - List contentTypes = (List)m_conf.getParameter(CONTENT_TYPES); + // List contentTypes = (List)m_conf.getParameter(CONTENT_TYPES); + List contentTypes = s_conf.getCTDefFiles(); if ( contentTypes != null) { Iterator i = contentTypes.iterator(); diff --git a/ccm-cms/src/com/arsdigita/cms/installer/xml/XMLContentTypeHandler.java b/ccm-cms/src/com/arsdigita/cms/installer/xml/XMLContentTypeHandler.java index cb1eaea09..adf71f951 100755 --- a/ccm-cms/src/com/arsdigita/cms/installer/xml/XMLContentTypeHandler.java +++ b/ccm-cms/src/com/arsdigita/cms/installer/xml/XMLContentTypeHandler.java @@ -32,7 +32,8 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; -/** Parses XML file definition of content types and loads them to the +/** + * Parses XML file definition of content types and loads them to the * database. * * @see ContentTypeInitializer diff --git a/ccm-cms/src/com/arsdigita/cms/installer/xml/enterprise.init b/ccm-cms/src/com/arsdigita/cms/installer/xml/enterprise.init new file mode 100644 index 000000000..c9f9c0ddc --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/installer/xml/enterprise.init @@ -0,0 +1,12 @@ +// CMS initialization file +// +// $Id: enterprise.init 2070 2010-01-28 08:47:41Z pboy $ +// +// init com.arsdigita.cms.installer.xml.ContentTypeLegacyInitializer { +// contentTypes = { +// "/WEB-INF/content-types/Template.xml" +// }; +// } + +// ContentTypeLegacyInitializer uses new config to get parameters +init com.arsdigita.cms.installer.xml.ContentTypeLegacyInitializer {} diff --git a/ccm-cms/src/com/arsdigita/cms/portlet/ContentDirectoryPortlet.java b/ccm-cms/src/com/arsdigita/cms/portlet/ContentDirectoryPortlet.java index 204002d01..a0001fb93 100755 --- a/ccm-cms/src/com/arsdigita/cms/portlet/ContentDirectoryPortlet.java +++ b/ccm-cms/src/com/arsdigita/cms/portlet/ContentDirectoryPortlet.java @@ -19,13 +19,31 @@ package com.arsdigita.cms.portlet; import com.arsdigita.bebop.portal.AbstractPortletRenderer; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.kernel.ACSObjectInstantiator; import com.arsdigita.cms.ui.portlet.ContentDirectoryPortletRenderer; import com.arsdigita.persistence.DataObject; import com.arsdigita.portal.Portlet; +import com.arsdigita.portal.PortletType; +import org.apache.log4j.Logger; +// +// CURRENTLY NOT USED. +// XXX: Portlet of same name is part of ccm-ldn-portlet. +// + +/** + * + * + */ public class ContentDirectoryPortlet extends Portlet { + /** Private logger instance for this class. */ + private static final Logger s_log = Logger.getLogger(ContentDirectoryPortlet.class); + + /** Data object type for this class (i.e. full qualified class name */ public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.portlet.ContentDirectoryPortlet"; @@ -40,4 +58,65 @@ public class ContentDirectoryPortlet extends Portlet { protected AbstractPortletRenderer doGetPortletRenderer() { return new ContentDirectoryPortletRenderer(this); } + + /** + * Load the portlet type into database. Part of the non-recurring loader + * step as part of the installation. + * + * Usage: in loader.run(final ScriptContext ctx): + * ContentDirectoryPortlet.loadPortletType(); + */ + public static void loadPortletType() + { + PortletType type = PortletType + .createPortletType("Content Directory", + PortletType.WIDE_PROFILE, + ContentDirectoryPortlet.BASE_DATA_OBJECT_TYPE); + type.setDescription("Displays the content directory categories"); + s_log.info("Loading portlet type " + type); + } + + /** + * Reccurring initialization of the portlet each time ccm starts. + * + * It registers an object instantiator with the portal infrastructure. + * Usage: in initialize.init(domainInitEvent): + * ContentDirectoryPortlet.initPortlet(); + */ + public static void initPortlet() + { + // register Instantiator + DomainObjectFactory.registerInstantiator(BASE_DATA_OBJECT_TYPE, + new ACSObjectInstantiator() + { + public DomainObject doNewInstance(DataObject dataObject) + { + return new ContentDirectoryPortlet(dataObject); + } + }); + } + +// Alternative way to load and initialize a portlet using class PortletSetup. +// It performs the loading step as well as the registerInstantiator step in +// one class and can be used by the loader as well as the initializer. Was +// especially useful in the old initializer system where the loading step and +// the recurring initialization step were not separated. +// +// private void loadContentDirectoryPortlet() { +// +// PortletSetup setup = new PortletSetup(s_log); +// setup.setPortletObjectType(ContentDirectoryPortlet.BASE_DATA_OBJECT_TYPE); +// setup.setTitle("Content Directory"); +// setup.setDescription("Displays the content directory categories"); +// setup.setProfile(PortletType.WIDE_PROFILE); +// +// setup.setInstantiator(new ACSObjectInstantiator() { +// protected DomainObject doNewInstance(DataObject dataObject) { +// return new ContentDirectoryPortlet(dataObject); +// } +// }); +// setup.run(); +// } + + } diff --git a/ccm-cms/src/com/arsdigita/cms/portlet/ContentItemPortlet.java b/ccm-cms/src/com/arsdigita/cms/portlet/ContentItemPortlet.java index 3a45c3580..741256708 100755 --- a/ccm-cms/src/com/arsdigita/cms/portlet/ContentItemPortlet.java +++ b/ccm-cms/src/com/arsdigita/cms/portlet/ContentItemPortlet.java @@ -18,16 +18,29 @@ */ package com.arsdigita.cms.portlet; +import com.arsdigita.bebop.RequestLocal; import com.arsdigita.bebop.portal.AbstractPortletRenderer; import com.arsdigita.cms.ContentItem; +import com.arsdigita.cms.ui.portlet.ContentItemPortletEditor; import com.arsdigita.cms.ui.portlet.ContentItemPortletRenderer; +import com.arsdigita.domain.DomainObject; import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.kernel.ACSObjectInstantiator; +import com.arsdigita.kernel.ResourceType; +import com.arsdigita.kernel.ResourceTypeConfig; +import com.arsdigita.kernel.ui.ResourceConfigFormSection; import com.arsdigita.persistence.DataObject; import com.arsdigita.portal.Portlet; +import com.arsdigita.portal.PortletType; + +import org.apache.log4j.Logger; public class ContentItemPortlet extends Portlet { + /** Private logger instance for this class. */ + private static final Logger s_log = Logger.getLogger(ContentItemPortlet.class); + public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.portlet.ContentItemPortlet"; @@ -53,4 +66,105 @@ public class ContentItemPortlet extends Portlet { public AbstractPortletRenderer doGetPortletRenderer() { return new ContentItemPortletRenderer(this); } + + + /** + * Load the portlet type into database. Part of the non-recurring loader + * step as part of the installation. + * + * Usage: in loader.run(final ScriptContext ctx): + * ContentItemPortlet.loadPortletType(); + */ + public static void loadPortletType() + { + PortletType type = PortletType + .createPortletType("Content Item", + PortletType.WIDE_PROFILE, + ContentItemPortlet.BASE_DATA_OBJECT_TYPE); + type.setDescription("Displays the body of a content item"); + s_log.info("Loading portlet type " + type); + } + + /** + * Reccurring initialization of the portlet each time ccm starts. + * + * It registers an object instantiator with the portal infrastructure. + * Usage: in initialize.init(domainInitEvent): + * ContentItemPortlet.initPortlet(); + */ + public static void initPortlet() + { + // register instantiator + DomainObjectFactory.registerInstantiator(BASE_DATA_OBJECT_TYPE, + new ACSObjectInstantiator() + { + public DomainObject doNewInstance(DataObject dataObject) + { + return new ContentItemPortlet(dataObject); + } + }); + + new ResourceTypeConfig(BASE_DATA_OBJECT_TYPE) + { + public ResourceConfigFormSection getCreateFormSection( + final ResourceType resType, + final RequestLocal parentAppRL) + { + return new ContentItemPortletEditor(resType, parentAppRL); + } + + public ResourceConfigFormSection getModifyFormSection( + final RequestLocal application) + { + return new ContentItemPortletEditor(application); + } + }; + + + } + + +// Alternative way to load and initialize a portlet using class PortletSetup. +// It performs the loading step as well as the registerInstantiator step in +// one class and can be used by the loader as well as the initializer. Was +// especially useful in the old initializer system where the loading step and +// the recurring initialization step were not separated. +// +// private void loadContentItemPortlet() { +// +// PortletSetup setup = new PortletSetup(s_log); +// setup.setPortletObjectType(ContentItemPortlet.BASE_DATA_OBJECT_TYPE); +// setup.setTitle("Content Item"); +// setup.setDescription("Displays the body of a content item"); +// setup.setProfile(PortletType.WIDE_PROFILE); +// +// setup.setInstantiator(new ACSObjectInstantiator() { +// protected DomainObject doNewInstance(DataObject dataObject) { +// return new ContentItemPortlet(dataObject); +// } +// }); +// setup.run(); +// +// new ResourceTypeConfig(ContentItemPortlet.BASE_DATA_OBJECT_TYPE) { +// public ResourceConfigFormSection getCreateFormSection +// (final ResourceType resType, final RequestLocal parentAppRL) { +// final ResourceConfigFormSection config = +// new ContentItemPortletEditor(resType, parentAppRL); +// +// return config; +// } +// +// public ResourceConfigFormSection getModifyFormSection +// (final RequestLocal application) { +// final ContentItemPortletEditor config = +// new ContentItemPortletEditor(application); +// +// return config; +// } +// }; +// +// } + + + } diff --git a/ccm-cms/src/com/arsdigita/cms/portlet/ContentSectionsPortlet.java b/ccm-cms/src/com/arsdigita/cms/portlet/ContentSectionsPortlet.java index c881584ad..031da4778 100755 --- a/ccm-cms/src/com/arsdigita/cms/portlet/ContentSectionsPortlet.java +++ b/ccm-cms/src/com/arsdigita/cms/portlet/ContentSectionsPortlet.java @@ -19,25 +19,111 @@ package com.arsdigita.cms.portlet; import com.arsdigita.bebop.portal.AbstractPortletRenderer; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.kernel.ACSObjectInstantiator; import com.arsdigita.cms.ui.portlet.ContentSectionsPortletRenderer; import com.arsdigita.persistence.DataObject; import com.arsdigita.portal.Portlet; +import com.arsdigita.portal.PortletSetup; +import com.arsdigita.portal.PortletType; + +import org.apache.log4j.Logger; public class ContentSectionsPortlet extends Portlet { + /** Private logger instance for this class. */ + private static final Logger s_log = Logger.getLogger(ContentSectionsPortlet.class); + public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.portlet.ContentSectionsPortlet"; + /** + * Constructor, retrieves a portlet from the database store + * based on the data object. + * @param dataObject + */ public ContentSectionsPortlet(DataObject dataObject) { super(dataObject); } + /** + * Retrieve the base data object type (i.e. fully qualified class name). + * @return + */ protected String getBaseDataObjectType() { return BASE_DATA_OBJECT_TYPE; } + /** + * + * @return + */ protected AbstractPortletRenderer doGetPortletRenderer() { return new ContentSectionsPortletRenderer(this); } + + + /** + * Load the portlet type into database. Part of the non-recurring loader + * step as part of the installation. + * + * Usage: in loader.run(final ScriptContext ctx): + * ContentSectionsPortlet.loadPortletType(); + */ + public static void loadPortletType() + { + PortletType type = PortletType + .createPortletType("Content Sections", + PortletType.WIDE_PROFILE, + ContentSectionsPortlet.BASE_DATA_OBJECT_TYPE); + type.setDescription("Displays a list of content sections"); + s_log.info("Loading portlet type " + type); + } + + /** + * Reccurring initialization of the portlet each time ccm starts. + * + * It registers an object instantiator with the portal infrastructure. + * Usage: in initialize.init(domainInitEvent): + * ContentSectionsPortlet.initPortlet(); + */ + public static void initPortlet() + { + // register instantiator + DomainObjectFactory.registerInstantiator(BASE_DATA_OBJECT_TYPE, + new ACSObjectInstantiator() + { + public DomainObject doNewInstance(DataObject dataObject) + { + return new ContentItemPortlet(dataObject); + } + }); + } + + +// Alternative way to load and initialize a portlet using class PortletSetup. +// It performs the loading step as well as the registerInstantiator step in +// one class and can be used by the loader as well as the initializer. Was +// especially useful in the old initializer system where the loading step and +// the recurring initialization step were not separated. +// + private void loadContentSectionsPortlet() { + + PortletSetup setup = new PortletSetup(s_log); + setup.setPortletObjectType(ContentSectionsPortlet.BASE_DATA_OBJECT_TYPE); + setup.setTitle("Content Sections"); + setup.setDescription("Displays a list of content sections"); + setup.setProfile(PortletType.WIDE_PROFILE); + + setup.setInstantiator(new ACSObjectInstantiator() { + protected DomainObject doNewInstance(DataObject dataObject) { + return new ContentSectionsPortlet(dataObject); + } + }); + setup.run(); + } + + } diff --git a/ccm-cms/src/com/arsdigita/cms/portlet/Initializer.java b/ccm-cms/src/com/arsdigita/cms/portlet/Initializer.java new file mode 100644 index 000000000..e49795f1d --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/portlet/Initializer.java @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package com.arsdigita.cms.portlet; + +import com.arsdigita.cms.ContentSection; +import com.arsdigita.cms.Template; +import com.arsdigita.db.DbHelper; + +import com.arsdigita.domain.DomainObject; +// import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.domain.DomainObjectInstantiator; + +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.metadata.MetadataRoot; +import com.arsdigita.persistence.metadata.ObjectType; +import com.arsdigita.runtime.CCMResourceManager; +import com.arsdigita.runtime.CompoundInitializer; +import com.arsdigita.runtime.ConfigError; +import com.arsdigita.runtime.ContextCloseEvent; +import com.arsdigita.runtime.ContextInitEvent; +// import com.arsdigita.runtime.DataInitEvent; +import com.arsdigita.runtime.DomainInitEvent; +// import com.arsdigita.runtime.LegacyInitEvent; +import com.arsdigita.runtime.LegacyInitializer; +import com.arsdigita.runtime.RuntimeConfig; +import com.arsdigita.util.UncheckedWrapperException; + +import java.io.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Iterator; + +import org.apache.log4j.Logger; + +/** + * The CMS portlet initializer. + * + * Initializer is invoked by the add-method in the CMS initializer. + * + * @author Justin Ross <jross@redhat.com> + * @author Peter Boy <pb@zes.uni-bremen.de> + * @version $Id: $ + */ +public class Initializer extends CompoundInitializer { + + /** Creates a s_logging category with name = to the full name of class */ + private static Logger s_log = Logger.getLogger(Initializer.class); + + // Currently no configuration options for portlets available + //private static PortalConfig s_conf= PortalConfig.getConfig(); + + public Initializer() { + final String url = RuntimeConfig.getConfig().getJDBCURL(); + final int database = DbHelper.getDatabaseFromURL(url); + + } + +// /** +// * An empty implementation of {@link Initializer#init(DataInitEvent)}. +// * +// * @param evt The data init event. +// */ +// public void init(DataInitEvent evt) { +// } + + /** + * Initializes domain-coupling machinery, usually consisting of + * registering object instantiators and observers. + * + */ + public void init(DomainInitEvent e) { + s_log.debug("publishToFile.Initializer.init(DomainInitEvent) invoked"); + + // Recursive invokation of init, is it really necessary?? + // On the other hand: + // An empty implementations prevents this initializer from being executed. + // A missing implementations causes the super class method to be executed, + // which invokes the above added LegacyInitializer. + // If super is not invoked, various other cms sub-initializer may not run. + super.init(e); + + // ContentDirectoryPortlet, currently not used. + // Portlet of the same name is active in ccm-ldn-portal + //loadContentDirectoryPortlet(); + //ContentDirectoryPortlet.initPortlet(); + + // ContentItemPortlet + ContentItemPortlet.initPortlet(); + + // ContentSectionsPortlet + //ContentSectionsPortlet.initPortlet(); + + // TaskPortlet + TaskPortlet.initPortlet(); + + } + +} diff --git a/ccm-cms/src/com/arsdigita/cms/portlet/TaskPortlet.java b/ccm-cms/src/com/arsdigita/cms/portlet/TaskPortlet.java index 2ffac83b6..86b7e03ca 100755 --- a/ccm-cms/src/com/arsdigita/cms/portlet/TaskPortlet.java +++ b/ccm-cms/src/com/arsdigita/cms/portlet/TaskPortlet.java @@ -18,10 +18,22 @@ */ package com.arsdigita.cms.portlet; +import com.arsdigita.bebop.RequestLocal; import com.arsdigita.bebop.portal.AbstractPortletRenderer; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.kernel.ACSObjectInstantiator; +import com.arsdigita.kernel.ResourceType; +import com.arsdigita.kernel.ResourceTypeConfig; +import com.arsdigita.kernel.ui.ResourceConfigFormSection; +import com.arsdigita.cms.ui.portlet.TaskPortletEditor; import com.arsdigita.cms.ui.portlet.TaskPortletRenderer; import com.arsdigita.persistence.DataObject; import com.arsdigita.portal.Portlet; +import com.arsdigita.portal.PortletSetup; +import com.arsdigita.portal.PortletType; + +import org.apache.log4j.Logger; /** * A portlet that displays a list of user tasks. This portlet @@ -31,6 +43,9 @@ import com.arsdigita.portal.Portlet; */ public class TaskPortlet extends Portlet { + /** Private logger instance for this class. */ + private static final Logger s_log = Logger.getLogger(TaskPortlet.class); + public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.portlet.TaskPortlet"; @@ -55,4 +70,102 @@ public class TaskPortlet extends Portlet { return new TaskPortletRenderer(this); } + + /** + * Load the portlet type into database. Part of the non-recurring loader + * step as part of the installation. + * + * Usage: in loader.run(final ScriptContext ctx): + * TaskPortlet.loadPortletType(); + */ + public static void loadPortletType() + { + PortletType type = PortletType + .createPortletType("Task Portlet", + PortletType.WIDE_PROFILE, + TaskPortlet.BASE_DATA_OBJECT_TYPE); + type.setDescription("Displays a Task List"); + s_log.info("Loading portlet type " + type); + } + + /** + * Reccurring initialization of the portlet each time ccm starts. + * + * It registers an object instantiator with the portal infrastructure. + * Usage: in initialize.init(domainInitEvent): + * TaskPortlet.initPortlet(); + */ + public static void initPortlet() + { + DomainObjectFactory.registerInstantiator(BASE_DATA_OBJECT_TYPE, + new ACSObjectInstantiator() + { + public DomainObject doNewInstance(DataObject dataObject) + { + return new TaskPortlet(dataObject); + } + }); + + new ResourceTypeConfig(BASE_DATA_OBJECT_TYPE) + { + public ResourceConfigFormSection getCreateFormSection( + final ResourceType resType, + final RequestLocal parentAppRL) + { + return new TaskPortletEditor(resType, parentAppRL); + } + + public ResourceConfigFormSection getModifyFormSection( + final RequestLocal application) + { + return new TaskPortletEditor(application); + } + }; + + } + + + + + +// Alternative way to load and initialize a portlet using class PortletSetup. +// It performs the loading step as well as the registerInstantiator step in +// one class and can be used by the loader as well as the initializer. Was +// especially useful in the old initializer system where the loading step and +// the recurring initialization step were not separated. +// + public void loadTaskPortlet() { + + PortletSetup setup = new PortletSetup(s_log); + setup.setPortletObjectType(TaskPortlet.BASE_DATA_OBJECT_TYPE); + setup.setTitle("Task Portlet"); + setup.setDescription("Displays a Task List"); + setup.setProfile(PortletType.WIDE_PROFILE); + setup.setInstantiator(new ACSObjectInstantiator() { + protected DomainObject doNewInstance(DataObject dataObject) { + return new TaskPortlet(dataObject); + } + }); + setup.run(); + + new ResourceTypeConfig(TaskPortlet.BASE_DATA_OBJECT_TYPE) { + public ResourceConfigFormSection getCreateFormSection + (final ResourceType resType, final RequestLocal parentAppRL) { + final ResourceConfigFormSection config = + new TaskPortletEditor(resType, parentAppRL); + + return config; + } + + public ResourceConfigFormSection getModifyFormSection + (final RequestLocal application) { + final TaskPortletEditor config = + new TaskPortletEditor(application); + + return config; + } + }; + + } + } diff --git a/ccm-cms/src/com/arsdigita/cms/publishToFile/Initializer.java b/ccm-cms/src/com/arsdigita/cms/publishToFile/Initializer.java index b9675f389..d1491a8ba 100755 --- a/ccm-cms/src/com/arsdigita/cms/publishToFile/Initializer.java +++ b/ccm-cms/src/com/arsdigita/cms/publishToFile/Initializer.java @@ -37,7 +37,7 @@ import com.arsdigita.runtime.ContextInitEvent; // import com.arsdigita.runtime.DataInitEvent; import com.arsdigita.runtime.DomainInitEvent; // import com.arsdigita.runtime.LegacyInitEvent; -import com.arsdigita.runtime.LegacyInitializer; +// import com.arsdigita.runtime.LegacyInitializer; import com.arsdigita.runtime.RuntimeConfig; import com.arsdigita.util.UncheckedWrapperException; diff --git a/ccm-cms/src/com/arsdigita/cms/ui/authoring/TextAssetBody.java b/ccm-cms/src/com/arsdigita/cms/ui/authoring/TextAssetBody.java index aeae6e894..6c1931b9f 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/authoring/TextAssetBody.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/authoring/TextAssetBody.java @@ -50,7 +50,7 @@ import com.arsdigita.bebop.parameters.NotNullValidationListener; import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.cms.Asset; import com.arsdigita.cms.ContentSection; -import com.arsdigita.cms.ContentSectionConfig; +import com.arsdigita.cms.CMSConfig; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.TextAsset; import com.arsdigita.cms.ui.CMSDHTMLEditor; @@ -102,7 +102,7 @@ public abstract class TextAssetBody extends SecurityPropertyEditor private static final String STREAMLINED = "_streamlined"; private static final String STREAMLINED_DONE = "1"; - private static final ContentSectionConfig s_config = new ContentSectionConfig(); + private static final CMSConfig s_config = new CMSConfig(); static { s_config.load(); } diff --git a/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryItemPane.java b/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryItemPane.java index 256c6b336..b56d3db97 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryItemPane.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryItemPane.java @@ -139,7 +139,7 @@ class CategoryItemPane extends BaseItemPane { // Quasimodo: BEGIN // Localizations ActionLink addCategoryLocalizationLink = new ActionLink(new Label(gz( - "cms.ui.category.localization.add"))) { + "cms.ui.category.localization_add"))) { @Override public boolean isVisible(PageState state) { // Only show addLanguage button, if there are langauges to add @@ -171,7 +171,7 @@ class CategoryItemPane extends BaseItemPane { // Linked categories final ActionLink linkAddLink = new ActionLink - (new Label(gz("cms.ui.category.linked.add"))); + (new Label(gz("cms.ui.category.linked_add"))); final Form linkForm = new LinkForm(m_category); add(linkForm); diff --git a/ccm-cms/src/com/arsdigita/cms/util/CMSResourceBundle.java b/ccm-cms/src/com/arsdigita/cms/util/CMSResourceBundle.java index 046b064ef..fb41cbe2a 100755 --- a/ccm-cms/src/com/arsdigita/cms/util/CMSResourceBundle.java +++ b/ccm-cms/src/com/arsdigita/cms/util/CMSResourceBundle.java @@ -26,7 +26,8 @@ import com.arsdigita.cms.CMSGlobalized; * Main ResourceBundle for CMS UI. * Can be extended using: * - addBundle - to add new keys - * - putBundle - to override keys already in CMSResources e.g. to customize notification email text + * - putBundle - to override keys already in CMSResources e.g. to customize + * notification email text **/ public class CMSResourceBundle extends ChainedResourceBundle implements CMSGlobalized {