mirror of
https://github.com/Alfresco/acs-community-packaging.git
synced 2025-09-24 14:32:14 +00:00
Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)
78438: Merged EOL (5.0/Cloud) to HEAD-BUG-FIX (5.0/Cloud) 77695: ACE-2149 - EOL AVM / WCM. Ripped WCM out of Explorer. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@82564 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -76,52 +76,6 @@
|
||||
<ref bean="DictionaryService" />
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<!-- NOTE: This references a bean in the repository Spring configuration -->
|
||||
<bean id="FormsService" class="org.alfresco.web.forms.FormsService">
|
||||
<constructor-arg>
|
||||
<ref bean="ContentService" />
|
||||
</constructor-arg>
|
||||
<constructor-arg>
|
||||
<ref bean="NodeService" />
|
||||
</constructor-arg>
|
||||
<constructor-arg>
|
||||
<ref bean="NamespaceService" />
|
||||
</constructor-arg>
|
||||
<constructor-arg>
|
||||
<ref bean="SearchService" />
|
||||
</constructor-arg>
|
||||
<constructor-arg>
|
||||
<ref bean="policyComponent" />
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<!-- NOTE: This references a bean in the repository Spring configuration -->
|
||||
<bean id="Schema2XFormsProperties" class="org.alfresco.web.forms.xforms.Schema2XFormsProperties">
|
||||
<constructor-arg>
|
||||
<ref bean="ContentService" />
|
||||
</constructor-arg>
|
||||
<constructor-arg>
|
||||
<ref bean="NamespaceService" />
|
||||
</constructor-arg>
|
||||
<constructor-arg>
|
||||
<ref bean="NodeService" />
|
||||
</constructor-arg>
|
||||
<constructor-arg>
|
||||
<ref bean="SearchService" />
|
||||
</constructor-arg>
|
||||
<property name="locations">
|
||||
<list>
|
||||
<value>alfresco:/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.content_forms.childname}/${form.name}/cm:strings</value>
|
||||
<value>alfresco:/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.content_forms.childname}/cm:strings</value>
|
||||
|
||||
<value>classpath:alfresco/messages/webclient</value>
|
||||
</list>
|
||||
</property>
|
||||
<property name="formatCaption">
|
||||
<value>${xforms.formatCaption}</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- ===================================== -->
|
||||
<!-- Web Script Beans -->
|
||||
|
@@ -486,56 +486,6 @@
|
||||
<action>wizard:createContent</action>
|
||||
</action>
|
||||
|
||||
<!-- Edit XML content type -->
|
||||
<action id="edit_form">
|
||||
<permissions>
|
||||
<permission allow="true">Write,AddChildren</permission>
|
||||
</permissions>
|
||||
<evaluator>org.alfresco.web.action.evaluator.EditFormEvaluator</evaluator>
|
||||
<label-id>edit_form</label-id>
|
||||
<image>/images/icons/edit_form.gif</image>
|
||||
<action>wizard:editForm</action>
|
||||
<action-listener>#{BrowseBean.setupSpaceAction}</action-listener>
|
||||
<params>
|
||||
<param name="id">#{actionContext.id}</param>
|
||||
</params>
|
||||
</action>
|
||||
|
||||
<!-- Create XML content type (WCM) -->
|
||||
<action id="create_web_form">
|
||||
<evaluator>org.alfresco.web.action.evaluator.CreateWebFormEvaluator</evaluator>
|
||||
<label-id>create_web_form</label-id>
|
||||
<image>/images/icons/create_form.gif</image>
|
||||
<action>wizard:createWebForm</action>
|
||||
</action>
|
||||
|
||||
<!-- Edit XML content type (WCM) -->
|
||||
<action id="edit_web_form">
|
||||
<permissions>
|
||||
<permission allow="true">Write,AddChildren</permission>
|
||||
</permissions>
|
||||
<evaluator>org.alfresco.web.action.evaluator.EditWebFormEvaluator</evaluator>
|
||||
<label-id>edit_web_form</label-id>
|
||||
<image>/images/icons/edit_form.gif</image>
|
||||
<action>wizard:editWebForm</action>
|
||||
<action-listener>#{BrowseBean.setupSpaceAction}</action-listener>
|
||||
<params>
|
||||
<param name="id">#{actionContext.id}</param>
|
||||
</params>
|
||||
</action>
|
||||
|
||||
<!-- Regenerate Renditions (WCM) -->
|
||||
<action id="regenerate_renditions">
|
||||
<evaluator>org.alfresco.web.action.evaluator.RegenerateRenditionsEvaluator</evaluator>
|
||||
<label-id>regenerate_renditions</label-id>
|
||||
<image>/images/icons/regenerate_renditions.gif</image>
|
||||
<action>wizard:regenerateRenditions</action>
|
||||
<action-listener>#{BrowseBean.setupSpaceAction}</action-listener>
|
||||
<params>
|
||||
<param name="id">#{actionContext.id}</param>
|
||||
</params>
|
||||
</action>
|
||||
|
||||
<!-- Create space -->
|
||||
<action id="create_space">
|
||||
<permissions>
|
||||
@@ -555,14 +505,6 @@
|
||||
<image>/images/icons/create_space.gif</image>
|
||||
<action>wizard:createSpace</action>
|
||||
</action>
|
||||
|
||||
<!-- Create Website Wizard -->
|
||||
<action id="create_website_wizard">
|
||||
<evaluator>org.alfresco.web.action.evaluator.CreateWebProjectEvaluator</evaluator>
|
||||
<label-id>create_website</label-id>
|
||||
<image>/images/icons/create_website.gif</image>
|
||||
<action>wizard:createWebsite</action>
|
||||
</action>
|
||||
|
||||
<!-- Manage Space Users -->
|
||||
<action id="manage_space_users">
|
||||
@@ -1042,8 +984,6 @@
|
||||
<!-- Actions Menu for Create in Browse screen -->
|
||||
<action-group id="browse_create_menu">
|
||||
<action idref="create_content" />
|
||||
<action idref="create_web_form" />
|
||||
<action idref="create_website_wizard" />
|
||||
<action idref="create_space" />
|
||||
<action idref="create_space_wizard" />
|
||||
</action-group>
|
||||
@@ -1058,7 +998,6 @@
|
||||
<action idref="import_space" />
|
||||
<action idref="manage_space_users" />
|
||||
<action idref="manage_space_rules" />
|
||||
<action idref="regenerate_renditions" />
|
||||
<!-- NOTE: now found on the User Console
|
||||
<action idref="manage_deleted_items" />-->
|
||||
</action-group>
|
||||
|
@@ -140,122 +140,14 @@
|
||||
<dialog name="reassignTask" page="/jsp/workflow/reassign-task-dialog.jsp"
|
||||
managed-bean="ReassignTaskDialog" icon="/images/icons/reassign_workflow_task_large.gif"
|
||||
title-id="reassign_task_title" description-id="reassign_task_desc" />
|
||||
|
||||
<dialog name="workflowShowFileDetails" page="/jsp/wcm/workflow-file-details.jsp" managed-bean="FileDetailsBean"
|
||||
icon="/images/icons/details_large.gif" title-id="details_of"
|
||||
description-id="file_details_desc" show-ok-button="false"
|
||||
error-message-id="empty_message"/>
|
||||
|
||||
|
||||
<!-- -->
|
||||
<!-- Other Dialogs -->
|
||||
|
||||
<!-- Definition of the create forums dialog -->
|
||||
<dialog name="emailSpaceUsers" page="/jsp/users/email-space-users.jsp" managed-bean="EmailSpaceUsersDialog"
|
||||
icon="/images/icons/email_users_large.gif" title-id="email_space_users"
|
||||
description-id="email_space_users_desc" />
|
||||
|
||||
<!-- -->
|
||||
<!-- WCM Dialogs -->
|
||||
|
||||
<dialog name="snapshotSandbox" page="/jsp/wcm/snapshot-sandbox.jsp" managed-bean="SnapshotSandboxDialog"
|
||||
icon="/images/icons/create_snapshot_large.gif" title-id="sandbox_snapshot"
|
||||
description-id="sandbox_snapshot_info" />
|
||||
|
||||
<dialog name="deleteSandbox" page="/jsp/dialog/delete.jsp" managed-bean="DeleteSandboxDialog"
|
||||
icon="/images/icons/delete_sandbox_large.gif" title-id="delete_sandbox"
|
||||
description-id="delete_sandbox_info" />
|
||||
|
||||
<dialog name="deleteAvmFile" page="/jsp/dialog/delete.jsp" managed-bean="DeleteFileDialog"
|
||||
icon="/images/icons/delete_large.gif" title-id="delete_file"
|
||||
description-id="delete_avm_file_info" />
|
||||
|
||||
<dialog name="deleteAvmFolder" page="/jsp/dialog/delete.jsp" managed-bean="DeleteFolderDialog"
|
||||
icon="/images/icons/delete_large.gif" title-id="delete_folder"
|
||||
description-id="delete_avm_folder_info" />
|
||||
|
||||
<dialog name="deleteAvmFileBrowse" page="/jsp/dialog/delete.jsp" managed-bean="DeleteFileBrowseDialog"
|
||||
icon="/images/icons/delete_large.gif" title-id="delete_file"
|
||||
description-id="delete_avm_file_info" />
|
||||
|
||||
<dialog name="deleteAvmFolderBrowse" page="/jsp/dialog/delete.jsp" managed-bean="DeleteFolderBrowseDialog"
|
||||
icon="/images/icons/delete_large.gif" title-id="delete_folder"
|
||||
description-id="delete_avm_folder_info" />
|
||||
|
||||
<dialog name="deleteLayeredFolderBrowse" page="/jsp/dialog/delete.jsp" managed-bean="DeleteLayeredFolderBrowseDialog"
|
||||
icon="/images/icons/delete_large.gif" title-id="delete_layered_folder"
|
||||
description-id="delete_layered_folder_info" />
|
||||
|
||||
<dialog name="unlockAvmFile" page="/jsp/dialog/delete.jsp" managed-bean="UnlockFileDialog"
|
||||
icon="/images/icons/unlock_large.gif" title-id="unlock_file"
|
||||
description-id="unlock_file_info" />
|
||||
|
||||
<dialog name="promptForWebForm" page="/jsp/wcm/prompt-for-web-form.jsp" managed-bean="PromptForWebFormDialog"
|
||||
icon="/images/icons/details_large.gif" title-id="prompt_for_web_form"
|
||||
description-id="prompt_for_web_form_info" />
|
||||
|
||||
<dialog name="createAvmFolder" page="/jsp/wcm/create-folder-dialog.jsp" managed-bean="CreateFolderDialog"
|
||||
icon="/images/icons/create_space_large.gif" title-id="create_folder"
|
||||
description-id="create_avm_folder_info" />
|
||||
|
||||
<dialog name="createLayeredFolder" page="/jsp/wcm/create-layered-folder-dialog.jsp"
|
||||
managed-bean="CreateLayeredFolderDialog" icon="/images/icons/create_space_large.gif"
|
||||
title-id="create_layered_folder" description-id="create_layered_folder_info" />
|
||||
|
||||
<dialog name="editAvmFile" page="/jsp/wcm/edit-file.jsp"
|
||||
managed-bean="EditAvmFileDialog" icon="/images/icons/edit_large.gif"
|
||||
title-id="title_edit_file" description-id="editfile_description"
|
||||
show-ok-button="false"/>
|
||||
|
||||
<!--
|
||||
<dialog name="updateAvmFile" page="/jsp/wcm/update-file.jsp"
|
||||
managed-bean="EditAvmFileDialog" icon="/images/icons/update_large.gif"
|
||||
title-id="title_update_file" description-id="update_avm-file_desc" />
|
||||
-->
|
||||
<dialog name="updateAvmFile" page="/jsp/wcm/update-file.jsp"
|
||||
managed-bean="AVMEditBean" icon="/images/icons/update_large.gif"
|
||||
title-id="title_update_file" description-id="update_avm_file_desc" />
|
||||
|
||||
<dialog name="editAvmFileProperties" page="/jsp/content/edit-content-properties.jsp"
|
||||
managed-bean="EditFilePropertiesDialog" icon="/images/icons/details_large.gif"
|
||||
title-id="edit_file_properties" description-id="edit_file_description" />
|
||||
|
||||
<dialog name="editAvmFolderProperties" page="/jsp/wcm/edit-folder-properties.jsp"
|
||||
managed-bean="EditFolderPropertiesDialog" icon="/images/icons/details_large.gif"
|
||||
title-id="edit_folder_properties" description-id="edit_folder_description" />
|
||||
|
||||
<dialog name="formTemplateDetails" page="/jsp/wcm/create-website-wizard/form-details.jsp" managed-bean="FormDetailsDialog"
|
||||
icon="/images/icons/webform_large.gif" title-id="form_template_details"
|
||||
description-id="form_template_details_desc" />
|
||||
|
||||
<dialog name="formTemplateTemplates" page="/jsp/wcm/create-website-wizard/form-templates.jsp" managed-bean="FormTemplatesDialog"
|
||||
icon="/images/icons/template_large.gif" title-id="form_template_templates"
|
||||
description-id="form_template_templates_desc" />
|
||||
|
||||
<dialog name="formTemplateWorkflow" page="/jsp/wcm/create-website-wizard/form-workflow.jsp" managed-bean="FormWorkflowDialog"
|
||||
icon="/images/icons/manage_workflow_task_large.gif" title-id="form_template_workflow"
|
||||
description-id="form_template_workflow_desc" />
|
||||
|
||||
<dialog name="editFormTemplateDetails" page="/jsp/wcm/create-website-wizard/form-details.jsp" managed-bean="EditFormDetailsDialog"
|
||||
icon="/images/icons/webform_large.gif" title-id="form_template_details"
|
||||
description-id="form_template_details_desc" />
|
||||
|
||||
<dialog name="importContent" page="/jsp/wcm/import-content-dialog.jsp" managed-bean="ImportWebsiteDialog"
|
||||
icon="/images/icons/import_website_large.gif" title-id="import_website_content_title"
|
||||
description-id="import_website_content_desc" show-ok-button="false">
|
||||
<buttons>
|
||||
<button id="ok-button"
|
||||
label-id="ok"
|
||||
action="#{DialogManager.finish}"
|
||||
disabled="#{DialogManager.finishButtonDisabled}"
|
||||
onclick="javascript:document.getElementById('progress').style.display='inline';" />
|
||||
</buttons>
|
||||
</dialog>
|
||||
|
||||
<dialog name="addAvmContent" page="/jsp/wcm/add-content-dialog.jsp" managed-bean="AddAvmContentDialog"
|
||||
icon="/images/icons/add_content_large.gif" title-id="add_content_dialog_title"
|
||||
description-id="add_avm_content_dialog_desc"/>
|
||||
|
||||
<dialog name="addContent" page="/jsp/content/add-content-dialog.jsp" managed-bean="AddContentDialog"
|
||||
icon="/images/icons/add_content_large.gif" title-id="add_content_dialog_title"
|
||||
description-id="add_content_dialog_desc"/>
|
||||
@@ -264,54 +156,6 @@
|
||||
icon="/images/icons/import_large.gif" title-id="import"
|
||||
description-id="import_info" />
|
||||
|
||||
<dialog name="editFormTemplateTemplates" page="/jsp/wcm/create-website-wizard/form-templates.jsp" managed-bean="EditFormTemplatesDialog"
|
||||
icon="/images/icons/template_large.gif" title-id="form_template_templates"
|
||||
description-id="form_template_templates_desc" />
|
||||
|
||||
<dialog name="editFormTemplateWorkflow" page="/jsp/wcm/create-website-wizard/form-workflow.jsp" managed-bean="EditFormWorkflowDialog"
|
||||
icon="/images/icons/manage_workflow_task_large.gif" title-id="form_template_workflow"
|
||||
description-id="form_template_workflow_desc" />
|
||||
|
||||
<dialog name="submitSandboxItems" page="/jsp/wcm/submit-dialog.jsp" managed-bean="SubmitDialog"
|
||||
icon="/images/icons/submit_large.gif" title-id="submit_items_title"
|
||||
description-id="submit_items_desc" />
|
||||
|
||||
<dialog name="submitConfigureWorkflow" page="/jsp/wcm/submit-config-workflow.jsp" managed-bean="SubmitConfigureWorkflowDialog"
|
||||
icon="/images/icons/manage_workflow_task_large.gif" title-id="submit_configure_workflow"
|
||||
description-id="submit_configure_workflow_desc" />
|
||||
|
||||
<dialog name="changeExpirationDate" page="/jsp/wcm/change-expiration-date.jsp" managed-bean="ChangeExpirationDateDialog"
|
||||
icon="/images/icons/change_expire_date_large.gif" title-id="change_expiration_date_title"
|
||||
description-id="change_expiration_date_desc" />
|
||||
|
||||
<dialog name="createWebappFolder" page="/jsp/wcm/create-webapp.jsp" managed-bean="CreateWebappDialog"
|
||||
icon="/images/icons/create_webapp_large.gif" title-id="create_webapp_title"
|
||||
description-id="create_webapp_desc" />
|
||||
|
||||
<dialog name="revertSelectedItems" page="/jsp/wcm/revert.jsp" managed-bean="RevertSelectedDialog"
|
||||
icon="/images/icons/revert_all_large.gif" title-id="revert_selected_title"
|
||||
description-id="revert_selected_desc" />
|
||||
|
||||
<dialog name="revertAllItems" page="/jsp/wcm/revert.jsp" managed-bean="RevertAllDialog"
|
||||
icon="/images/icons/revert_all_large.gif" title-id="revert_all_title"
|
||||
description-id="revert_all_desc" />
|
||||
|
||||
<dialog name="revertSnapshot" page="/jsp/wcm/revert.jsp" managed-bean="RevertSnapshotDialog"
|
||||
icon="/images/icons/revert_large.gif" title-id="revert_snapshot_title"
|
||||
description-id="revert_snapshot_desc" />
|
||||
|
||||
<dialog name="deployWebsite" page="/jsp/wcm/deploy.jsp" managed-bean="DeployWebsiteDialog"
|
||||
icon="/images/icons/deploy_large.gif" />
|
||||
|
||||
<dialog name="viewDeploymentReport" page="/jsp/wcm/deployment-report.jsp"
|
||||
managed-bean="ViewDeploymentReportDialog" icon="/images/icons/deployment_report_large.gif"
|
||||
show-ok-button="false" />
|
||||
|
||||
<dialog name="monitorDeployment" page="/jsp/wcm/monitor-deployment.jsp"
|
||||
managed-bean="MonitorDeploymentDialog"
|
||||
icon="/images/icons/deploy_large.gif" title-id="monitor_deployment_title"
|
||||
description-id="monitor_deployment_desc" show-ok-button="false" />
|
||||
|
||||
<dialog name="deleteDeploymentReports" page="/jsp/dialog/delete.jsp"
|
||||
managed-bean="DeleteDeploymentReportsDialog" icon="/images/icons/delete_deploy_reports_large.gif"
|
||||
title-id="delete_all_deploy_reports" description-id="delete_reports_info" />
|
||||
@@ -320,48 +164,6 @@
|
||||
managed-bean="ReleaseTestServerDialog" icon="/images/icons/release_server_large.gif"
|
||||
title-id="release_server_title" description-id="release_server_info" />
|
||||
|
||||
<!-- AVM Compare -->
|
||||
<dialog name="compareToCurrentSnapshot" page="/jsp/wcm/compare-to-current-snapshot.jsp"
|
||||
managed-bean="CompareToCurrentSnapshot" icon="/images/icons/comparetocurrent_large.png"
|
||||
show-ok-button="false"
|
||||
title-id="snapshot_compare_to_current" description-id="snapshot_compare_to_current_description" />
|
||||
|
||||
<!-- AVM Compare -->
|
||||
<dialog name="compareToPreviousSnapshot" page="/jsp/wcm/compare-to-current-snapshot.jsp"
|
||||
managed-bean="CompareToPreviousSnapshot" icon="/images/icons/comparetoprevious_large.png"
|
||||
show-ok-button="false"
|
||||
title-id="snapshot_compare_to_previous" description-id="snapshot_compare_to_previous_description" />
|
||||
|
||||
<!-- CompareToAnySnapshot -->
|
||||
<dialog name="compareToAnySnapshot" page="/jsp/wcm/compare-to-any-snapshot.jsp"
|
||||
managed-bean="CompareToAnySnapshot" icon="/images/icons/comparetoany_large.png"
|
||||
show-ok-button="false"
|
||||
title-id="snapshot_compare_to_any" description-id="snapshot_compare_to_any_description" />
|
||||
|
||||
<!-- manage permissions -->
|
||||
<dialog name="setPermissions" page="/jsp/wcm/set-permissions.jsp"
|
||||
managed-bean="SetPermissionsDialog" icon="/images/icons/users_large.gif"
|
||||
title-id="set_permissions_title" description-id="set_permissions_subtitle" />
|
||||
|
||||
<dialog name="removePermissions" page="/jsp/wcm/remove-permissions.jsp"
|
||||
managed-bean="RemovePermissionsDialog" icon="/images/icons/delete_large.gif"
|
||||
title-id="remove_permissions_title" />
|
||||
|
||||
<dialog name="editPermissions" page="/jsp/wcm/edit-permissions.jsp"
|
||||
managed-bean="EditPermissionsDialog" icon="/images/icons/edituser_large.gif"
|
||||
title-id="edit_permissions_title" description-id="edit_permissions_subtitle" />
|
||||
|
||||
<dialog name="managePermissions" page="/jsp/wcm/manage-permissions.jsp"
|
||||
managed-bean="ManagePermissionsDialog" icon="/images/icons/edituser_large.gif"
|
||||
actions-config-id="set_permission_menu"
|
||||
show-ok-button="false"
|
||||
title-id="view_permissions_title" description-id="manage_permissions_subtitle" />
|
||||
|
||||
<dialog name="viewPermissions" page="/jsp/wcm/manage-permissions.jsp"
|
||||
managed-bean="ManagePermissionsDialog" icon="/images/icons/user_large.gif"
|
||||
show-ok-button="false"
|
||||
title-id="view_permissions_title" description-id="view_permissions_subtitle" />
|
||||
|
||||
<dialog name="editUserDetails" page="/jsp/users/edit-user-details.jsp" managed-bean="EditUserDetailsDialog"
|
||||
icon="/images/icons/edituser_large.gif" title-id="edit_user_details"
|
||||
description-id="edit_user_details_description" />
|
||||
@@ -564,20 +366,10 @@
|
||||
icon="/images/icons/details_large.gif" title-id="details_of" description-id="documentdetails_description" show-ok-button="false"
|
||||
error-message-id="empty_message" />
|
||||
|
||||
<dialog name="showSpaceDetails" page="/jsp/spaces/space-details.jsp" managed-bean="SpaceDetailsDialog"
|
||||
<dialog name="showSpaceDetails" page="/jsp/spaces/space-details.jsp" managed-bean="SpaceDetailsDialog"
|
||||
icon="/images/icons/details_large.gif" title-id="details_of" description-id="spacedetails_description" show-ok-button="false"
|
||||
error-message-id="empty_message" />
|
||||
|
||||
<dialog name="showFileDetails" page="/jsp/wcm/file-details.jsp" managed-bean="FileDetailsBean"
|
||||
icon="/images/icons/details_large.gif" title-id="details_of"
|
||||
description-id="file_details_desc" show-ok-button="false"
|
||||
error-message-id="empty_message"/>
|
||||
|
||||
<dialog name="showFolderDetails" page="/jsp/wcm/folder-details.jsp" managed-bean="FolderDetailsBean"
|
||||
icon="/images/icons/details_large.gif" title-id="details_of"
|
||||
description-id="folder_details_desc" show-ok-button="false"
|
||||
error-message-id="empty_message"/>
|
||||
|
||||
|
||||
<dialog name="manageCategories" page="/jsp/categories/categories.jsp" managed-bean="CategoriesDialog"
|
||||
icon="/images/icons/category.gif" title-id="category_management" show-ok-button="false"
|
||||
description-id="categories_description" subtitle-id="categories"
|
||||
@@ -659,99 +451,8 @@
|
||||
description-id="delete_post_info" />
|
||||
</dialogs>
|
||||
</config>
|
||||
|
||||
<!-- WCM -->
|
||||
<config evaluator="node-type" condition="wca:webfolder">
|
||||
<dialogs>
|
||||
<dialog name="deleteSpace" page="/jsp/dialog/delete.jsp" managed-bean="DeleteWebsiteDialog"
|
||||
icon="/images/icons/delete_website_large.gif" title-id="delete_website"
|
||||
description-id="delete_website_info" />
|
||||
</dialogs>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="wcmwf:reviewTask">
|
||||
<dialogs>
|
||||
<dialog name="manageTask" page="/jsp/wcm/manage-review-task-dialog.jsp"
|
||||
managed-bean="ManageReviewTaskDialog"
|
||||
icon="/images/icons/manage_workflow_task_large.gif"
|
||||
description-id="manage_task_desc" error-message-id="empty_message" />
|
||||
</dialogs>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="wcmwf:parallelReviewTask">
|
||||
<dialogs>
|
||||
<dialog name="manageTask" page="/jsp/wcm/manage-review-task-dialog.jsp"
|
||||
managed-bean="ManageReviewTaskDialog"
|
||||
icon="/images/icons/manage_workflow_task_large.gif"
|
||||
description-id="manage_task_desc" />
|
||||
</dialogs>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="wcmwf:submittedTask">
|
||||
<dialogs>
|
||||
<dialog name="manageTask" page="/jsp/wcm/manage-task-dialog.jsp"
|
||||
managed-bean="ManageTaskDialog"
|
||||
icon="/images/icons/manage_workflow_task_large.gif"
|
||||
description-id="manage_task_desc" />
|
||||
</dialogs>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="wcmwf:rejectedTask">
|
||||
<dialogs>
|
||||
<dialog name="manageTask" page="/jsp/wcm/manage-task-dialog.jsp"
|
||||
managed-bean="ManageTaskDialog"
|
||||
icon="/images/icons/manage_workflow_task_large.gif"
|
||||
description-id="manage_task_desc" />
|
||||
</dialogs>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="wcmwf:submitpendingTask">
|
||||
<dialogs>
|
||||
<dialog name="manageTask" page="/jsp/wcm/manage-task-dialog.jsp"
|
||||
managed-bean="ManageTaskDialog"
|
||||
icon="/images/icons/manage_workflow_task_large.gif"
|
||||
description-id="manage_task_desc" />
|
||||
</dialogs>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="wcmwf:submitcancelledTask">
|
||||
<dialogs>
|
||||
<dialog name="manageTask" page="/jsp/wcm/manage-task-dialog.jsp"
|
||||
managed-bean="ManageTaskDialog"
|
||||
icon="/images/icons/manage_workflow_task_large.gif"
|
||||
description-id="manage_task_desc" />
|
||||
</dialogs>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="wcmwf:verifyBrokenLinksTask">
|
||||
<dialogs>
|
||||
<dialog name="manageTask" page="/jsp/wcm/manage-review-task-dialog.jsp"
|
||||
managed-bean="ManageReviewTaskDialog"
|
||||
icon="/images/icons/manage_workflow_task_large.gif"
|
||||
description-id="manage_task_desc" />
|
||||
</dialogs>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="wcmwf:changeRequestTask">
|
||||
<dialogs>
|
||||
<dialog name="manageTask" page="/jsp/wcm/manage-change-request-task-dialog.jsp"
|
||||
managed-bean="ManageChangeRequestTaskDialog"
|
||||
icon="/images/icons/manage_workflow_task_large.gif"
|
||||
description-id="manage_task_desc" />
|
||||
</dialogs>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="wca:webfolder">
|
||||
<dialogs>
|
||||
<dialog name="showSpaceDetails" page="/jsp/wcm/website-details.jsp"
|
||||
managed-bean="WebSiteDetailsDialog"
|
||||
icon="/images/icons/details_large.gif" title-id="details_of"
|
||||
show-ok-button="false" error-message-id="empty_message"/>
|
||||
</dialogs>
|
||||
</config>
|
||||
<!-- End WCM -->
|
||||
|
||||
<config evaluator="node-type" condition="app:filelink">
|
||||
<config evaluator="node-type" condition="app:filelink">
|
||||
<dialogs>
|
||||
<dialog name="showDocDetails" page="/jsp/content/filelink-details.jsp"
|
||||
managed-bean="DocumentLinkDetailsDialog"
|
||||
|
@@ -41,13 +41,5 @@
|
||||
<override from-outcome="finishEdit" to-view-id="/jsp/spaces/spacelink-details.jsp" />
|
||||
</navigation>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="wca:webfolder">
|
||||
<navigation>
|
||||
<override from-view-id="/jsp/browse/browse.jsp" to-view-id="/jsp/wcm/browse-website.jsp" />
|
||||
<override from-outcome="browse" to-view-id="/jsp/wcm/browse-website.jsp" />
|
||||
<override from-outcome="showSpaceDetails" to-view-id="/jsp/wcm/website-details.jsp" />
|
||||
</navigation>
|
||||
</config>
|
||||
|
||||
</alfresco-config>
|
||||
|
@@ -38,47 +38,6 @@
|
||||
ignore-if-missing="false" />
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<!-- WCM file and folder types, specified here so they appear first in the property sheet -->
|
||||
<config evaluator="node-type" condition="wcm:avmplaincontent">
|
||||
<property-sheet>
|
||||
<show-property name="name" />
|
||||
<show-property name="title" display-label-id="title"
|
||||
ignore-if-missing="false" />
|
||||
<show-property name="description" display-label-id="description"
|
||||
ignore-if-missing="false" />
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="wcm:avmlayeredcontent">
|
||||
<property-sheet>
|
||||
<show-property name="name" />
|
||||
<show-property name="title" display-label-id="title"
|
||||
ignore-if-missing="false" />
|
||||
<show-property name="description" display-label-id="description"
|
||||
ignore-if-missing="false" />
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="wcm:avmplainfolder">
|
||||
<property-sheet>
|
||||
<show-property name="name" />
|
||||
<show-property name="title" display-label-id="title"
|
||||
ignore-if-missing="false" />
|
||||
<show-property name="description" display-label-id="description"
|
||||
ignore-if-missing="false" />
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="wcm:avmlayeredfolder">
|
||||
<property-sheet>
|
||||
<show-property name="name" />
|
||||
<show-property name="title" display-label-id="title"
|
||||
ignore-if-missing="false" />
|
||||
<show-property name="description" display-label-id="description"
|
||||
ignore-if-missing="false" />
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="dictionaryModel">
|
||||
<property-sheet>
|
||||
@@ -518,163 +477,6 @@
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<!-- WCM workflow tasks -->
|
||||
|
||||
<config evaluator="node-type" condition="wcmwf:submitReviewTask" replace="true">
|
||||
<property-sheet>
|
||||
<separator name="sep1" display-label-id="wf_review_options" component-generator="HeaderSeparatorGenerator" />
|
||||
<show-property name="wcmwf:submitReviewType"/>
|
||||
<separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator" />
|
||||
<show-association name="bpm:assignees" display-label-id="wf_reviewers" />
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="wcmwf:verifyBrokenLinksTask" replace="true">
|
||||
<property-sheet>
|
||||
<separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
|
||||
<show-property name="bpm:taskId" />
|
||||
<show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
|
||||
<show-property name="wcmwf:label" read-only="true" />
|
||||
<show-property name="wcmwf:launchDate" />
|
||||
<show-property name="wcmwf:autoDeploy" />
|
||||
<show-property name="bpm:status" />
|
||||
<show-property name="bpm:comment" component-generator="TextAreaGenerator" />
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="wcmwf:reviewTask" replace="true">
|
||||
<property-sheet>
|
||||
<separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
|
||||
<show-property name="bpm:taskId" />
|
||||
<show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
|
||||
<show-property name="wcmwf:label" read-only="true" />
|
||||
<show-property name="wcmwf:launchDate" />
|
||||
<show-property name="wcmwf:autoDeploy" />
|
||||
<show-property name="bpm:status" />
|
||||
<show-property name="bpm:comment" component-generator="TextAreaGenerator" />
|
||||
<separator name="sep2" display-label-id="wf_reviewers" component-generator="HeaderSeparatorGenerator" />
|
||||
<show-property name="wcmwf:reviewType" read-only="true" />
|
||||
<show-association name="bpm:assignees" display-label-id="wf_reviewers" read-only="true"/>
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="wcmwf:parallelReviewTask" replace="true">
|
||||
<property-sheet>
|
||||
<separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
|
||||
<show-property name="bpm:taskId" />
|
||||
<show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
|
||||
<show-property name="wcmwf:label" read-only="true" />
|
||||
<show-property name="wcmwf:launchDate" />
|
||||
<show-property name="wcmwf:autoDeploy" />
|
||||
<show-property name="bpm:status" />
|
||||
<show-property name="bpm:comment" component-generator="TextAreaGenerator" />
|
||||
<separator name="sep2" display-label-id="wf_reviewers" component-generator="HeaderSeparatorGenerator" />
|
||||
<show-property name="wcmwf:reviewType" read-only="true" />
|
||||
<show-association name="bpm:assignees" display-label-id="wf_reviewers" read-only="true"/>
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="wcmwf:rejectedTask" replace="true">
|
||||
<property-sheet>
|
||||
<separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
|
||||
<show-property name="bpm:taskId" />
|
||||
<show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
|
||||
<show-property name="bpm:comment" component-generator="TextAreaGenerator" />
|
||||
<separator name="sep2" display-label-id="wf_review_status" component-generator="HeaderSeparatorGenerator" />
|
||||
<show-property name="wcmwf:reviewType" read-only="true"/>
|
||||
<show-association name="bpm:assignees" display-label-id="wf_reviewers" read-only="true"/>
|
||||
<show-property name="wcmwf:approveCnt" read-only="true"/>
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="wcmwf:submitpendingTask" replace="true">
|
||||
<property-sheet>
|
||||
<separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
|
||||
<show-property name="bpm:taskId" />
|
||||
<show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
|
||||
<show-property name="wcmwf:label" read-only="true" />
|
||||
<show-property name="wcmwf:launchDate" read-only="true"/>
|
||||
<show-property name="wcmwf:autoDeploy" />
|
||||
<show-property name="bpm:comment" component-generator="TextAreaGenerator" />
|
||||
<separator name="sep2" display-label-id="wf_review_status" component-generator="HeaderSeparatorGenerator" />
|
||||
<show-property name="wcmwf:reviewType" read-only="true"/>
|
||||
<show-association name="bpm:assignees" display-label-id="wf_reviewers" read-only="true"/>
|
||||
<show-property name="wcmwf:approveCnt" read-only="true"/>
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="wcmwf:submitcancelledTask" replace="true">
|
||||
<property-sheet>
|
||||
<separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
|
||||
<show-property name="bpm:taskId" />
|
||||
<show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
|
||||
<show-property name="wcmwf:label" read-only="true" />
|
||||
<show-property name="wcmwf:launchDate" />
|
||||
<show-property name="wcmwf:autoDeploy" />
|
||||
<show-property name="bpm:comment" component-generator="TextAreaGenerator" />
|
||||
<separator name="sep2" display-label-id="wf_review_status" component-generator="HeaderSeparatorGenerator" />
|
||||
<show-property name="wcmwf:reviewType" read-only="true"/>
|
||||
<show-association name="bpm:assignees" display-label-id="wf_reviewers" read-only="true"/>
|
||||
<show-property name="wcmwf:approveCnt" read-only="true"/>
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="wcmwf:submittedTask" replace="true">
|
||||
<property-sheet>
|
||||
<separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
|
||||
<show-property name="bpm:taskId" />
|
||||
<show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
|
||||
<show-property name="wcmwf:label" read-only="true" />
|
||||
<show-property name="wcmwf:launchDate" />
|
||||
<show-property name="wcmwf:autoDeploy" />
|
||||
<show-property name="bpm:comment" component-generator="TextAreaGenerator" />
|
||||
<separator name="sep2" display-label-id="wf_review_status" component-generator="HeaderSeparatorGenerator" />
|
||||
<show-property name="wcmwf:reviewType" read-only="true"/>
|
||||
<show-association name="bpm:assignees" display-label-id="wf_reviewers" read-only="true"/>
|
||||
<show-property name="wcmwf:approveCnt" read-only="true"/>
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<!-- NOTE: kept for backwards compatibility only - for v2.0 wcm submit process definition -->
|
||||
<config evaluator="node-type" condition="wcmwf:approvedTask" replace="true">
|
||||
<property-sheet>
|
||||
<separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
|
||||
<show-property name="bpm:taskId" />
|
||||
<show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
|
||||
<separator name="sep2" display-label-id="wf_review_status" component-generator="HeaderSeparatorGenerator" />
|
||||
<show-property name="wcmwf:reviewType" read-only="true"/>
|
||||
<show-association name="bpm:assignees" display-label-id="wf_reviewers" read-only="true"/>
|
||||
<show-property name="wcmwf:approveCnt" read-only="true"/>
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<config evaluator="node-type" condition="wcmwf:changeRequestTask" replace="true">
|
||||
<property-sheet>
|
||||
<separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
|
||||
<show-property name="bpm:taskId" />
|
||||
<show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
|
||||
<show-property name="bpm:status" />
|
||||
<show-property name="bpm:comment" component-generator="TextAreaGenerator" />
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<!-- Configuration for wcm types and aspects -->
|
||||
<config evaluator="node-type" condition="wca:webfolder">
|
||||
<property-sheet>
|
||||
<show-property name="wca:avmstore" read-only="true" />
|
||||
<show-property name="wca:defaultwebapp" read-only="true" />
|
||||
<show-property name="wca:issource" component-generator="CheckboxGenerator" read-only="true"/>
|
||||
<show-property name="wca:previewprovidername" read-only="true" />
|
||||
<show-property name="app:icon" show-in-view-mode="false" show-in-edit-mode="false" />
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<config evaluator="aspect-name" condition="wca:expires">
|
||||
<property-sheet>
|
||||
<show-property name="wca:expirationDate" read-only="true" />
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
||||
<!-- ******************************** -->
|
||||
<!-- Configuration for Email Server -->
|
||||
<!-- ******************************** -->
|
||||
|
@@ -6,120 +6,6 @@
|
||||
|
||||
<wizards>
|
||||
|
||||
<!-- Definition of a create Web Project wizard -->
|
||||
<wizard name="createWebsite" managed-bean="CreateWebsiteWizard"
|
||||
title-id="create_website_title" description-id="create_website_desc"
|
||||
icon="/images/icons/create_website_large.gif">
|
||||
<step name="details" title-id="website_details" description-id="create_website_step1_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/details.jsp"
|
||||
title-id="create_website_step1_title"
|
||||
description-id="create_website_step1_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="createfrom" title-id="website_createfrom" description-id="create_website_step2_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/create-from.jsp"
|
||||
title-id="create_website_step2_title"
|
||||
description-id="create_website_step2_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="deployment" title-id="website_deployment" description-id="create_website_step3_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/deployment.jsp"
|
||||
title-id="create_website_step3_title"
|
||||
description-id="create_website_step3_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="forms" title-id="website_forms" description-id="create_website_step4_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/forms.jsp"
|
||||
title-id="create_website_step4_title"
|
||||
description-id="create_website_step4_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="settings" title-id="website_settings" description-id="create_website_step5_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/settings.jsp"
|
||||
title-id="create_website_step5_title"
|
||||
description-id="create_website_step5_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="invite" title-id="website_invite" description-id="create_website_step6_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/invite.jsp"
|
||||
title-id="create_website_step6_title"
|
||||
description-id="create_website_step6_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="notify" title-id="website_notify" description-id="create_website_step7_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/notify.jsp"
|
||||
title-id="create_website_step7_title"
|
||||
description-id="create_website_step7_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="summary" title-id="summary" description-id="summary_step_description">
|
||||
<page path="/jsp/wcm/create-website-wizard/summary.jsp"
|
||||
title-id="summary"
|
||||
description-id="summary_desc"
|
||||
instruction-id="create_website_finish_instruction" />
|
||||
</step>
|
||||
</wizard>
|
||||
|
||||
<!-- Definition of an edit Web Project wizard -->
|
||||
<wizard name="editWebsite" managed-bean="EditWebsiteWizard"
|
||||
title-id="edit_website_title" description-id="edit_website_desc"
|
||||
icon="/images/icons/create_website_large.gif">
|
||||
<step name="details" title-id="website_details" description-id="create_website_step1_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/details.jsp"
|
||||
title-id="create_website_step1_title"
|
||||
description-id="create_website_step1_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="deployment" title-id="website_deployment" description-id="edit_website_step2_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/deployment.jsp"
|
||||
title-id="edit_website_step2_title"
|
||||
description-id="edit_website_step2_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="forms" title-id="website_forms" description-id="edit_website_step3_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/forms.jsp"
|
||||
title-id="edit_website_step3_title"
|
||||
description-id="edit_website_step3_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="settings" title-id="website_settings" description-id="edit_website_step4_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/settings.jsp"
|
||||
title-id="edit_website_step4_title"
|
||||
description-id="edit_website_step4_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="summary" title-id="summary" description-id="summary_step_description">
|
||||
<page path="/jsp/wcm/create-website-wizard/summary.jsp"
|
||||
title-id="summary"
|
||||
description-id="summary_desc"
|
||||
instruction-id="edit_website_finish_instruction" />
|
||||
</step>
|
||||
</wizard>
|
||||
|
||||
<!-- Definition of a Invite Website Users wizard -->
|
||||
<wizard name="inviteWebUsers" managed-bean="InviteWebsiteUsersWizard"
|
||||
title-id="invite_webusers_title" description-id="invite_webusers_desc"
|
||||
icon="/images/icons/users_large.gif">
|
||||
<step name="invite" title-id="website_invite" description-id="invite_webusers_step1_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/invite.jsp"
|
||||
title-id="invite_webusers_step1_title"
|
||||
description-id="invite_webusers_step1_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="notify" title-id="website_notify" description-id="invite_webusers_step2_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/notify.jsp"
|
||||
title-id="invite_webusers_step2_title"
|
||||
description-id="invite_webusers_step2_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="summary" title-id="summary" description-id="summary_step_description">
|
||||
<page path="/jsp/wizard/summary.jsp"
|
||||
title-id="summary"
|
||||
description-id="summary_desc"
|
||||
instruction-id="invite_webusers_finish_instruction" />
|
||||
</step>
|
||||
</wizard>
|
||||
|
||||
<!-- Definition of Invite Space Users wizard -->
|
||||
<wizard name="inviteSpaceUsers" managed-bean="InviteSpaceUsersWizard"
|
||||
title-id="invite_title" description-id="invite_desc"
|
||||
@@ -301,12 +187,6 @@
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="content" title-id="enter_content" description-id="create_content_step2_desc">
|
||||
<condition if="#{CreateContentWizard.formName != ''}">
|
||||
<page path="/jsp/content/create-content-wizard/create-form.jsp"
|
||||
title-id="create_content_step2_title"
|
||||
description-id="create_content_step2_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</condition>
|
||||
<condition if="#{CreateContentWizard.mimeType == 'text/xml'}">
|
||||
<page path="/jsp/content/create-content-wizard/create-xml.jsp"
|
||||
title-id="create_content_step2_title"
|
||||
@@ -340,13 +220,6 @@
|
||||
<step name="content"
|
||||
title-id="create_web_content_enter_content_title"
|
||||
description-id="create_content_step2_desc">
|
||||
<!-- JanV -->
|
||||
<condition if="#{EditContentWizard.formName != ''}">
|
||||
<page path="/jsp/content/create-content-wizard/create-form.jsp"
|
||||
title-id="create_content_step2_title"
|
||||
description-id="create_content_step2_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</condition>
|
||||
<condition if="#{EditContentWizard.mimeType == 'text/xml'}">
|
||||
<page path="/jsp/content/create-content-wizard/create-xml.jsp"
|
||||
title-id="edit_web_content_enter_content_step_title"
|
||||
@@ -379,220 +252,6 @@
|
||||
</step>
|
||||
</wizard>
|
||||
|
||||
<!-- Definition of the Create Web Content wizard -->
|
||||
<wizard name="createWebContent" managed-bean="CreateWebContentWizard"
|
||||
title-id="create_web_content_title" description-id="create_web_content_desc"
|
||||
icon="/images/icons/new_content_large.gif">
|
||||
<step name="details"
|
||||
title-id="create_web_content_details_title"
|
||||
description-id="create_content_step1_desc">
|
||||
<page path="/jsp/wcm/create-web-content-wizard/details.jsp"
|
||||
title-id="create_web_content_details_step_title"
|
||||
description-id="create_content_step1_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="content"
|
||||
title-id="create_web_content_enter_content_step_title"
|
||||
description-id="create_content_step2_desc">
|
||||
<condition if="#{CreateWebContentWizard.mimeType == 'text/html'}">
|
||||
<page path="/jsp/wcm/create-web-content-wizard/create-html.jsp"
|
||||
title-id="create_web_content_enter_content_step_title"
|
||||
description-id="create_content_step2_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</condition>
|
||||
<condition if="#{CreateWebContentWizard.mimeType == 'text/xml'}">
|
||||
<page path="/jsp/wcm/create-web-content-wizard/create-xml.jsp"
|
||||
title-id="create_web_content_enter_content_step_title"
|
||||
description-id="create_content_step2_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</condition>
|
||||
<!-- Default to the inline text editor -->
|
||||
<page path="/jsp/wcm/create-web-content-wizard/create-text.jsp"
|
||||
title-id="create_web_content_enter_content_step_title"
|
||||
description-id="create_content_step2_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="summary" title-id="summary" description-id="summary_step_description">
|
||||
<condition if="#{CreateWebContentWizard.mimeType == 'text/xml'}">
|
||||
<page path="/jsp/wcm/create-web-content-wizard/summary.jsp"
|
||||
title-id="summary"
|
||||
description-id="create_web_content_summary_desc"
|
||||
instruction-id="content_finish_instruction" />
|
||||
</condition>
|
||||
<page path="/jsp/wizard/summary.jsp"
|
||||
title-id="summary"
|
||||
description-id="summary_desc"
|
||||
instruction-id="content_finish_instruction" />
|
||||
</step>
|
||||
</wizard>
|
||||
|
||||
<!-- Definition of the Edit Web Content wizard -->
|
||||
<wizard name="editWebContent" managed-bean="EditWebContentWizard"
|
||||
title-id="edit_web_content_title" description-id="edit_web_content_desc"
|
||||
icon="/images/icons/edit_large.gif">
|
||||
<step name="content"
|
||||
title-id="create_web_content_enter_content_title"
|
||||
description-id="create_content_step2_desc">
|
||||
<condition if="#{EditWebContentWizard.mimeType == 'text/html'}">
|
||||
<page path="/jsp/wcm/create-web-content-wizard/create-html.jsp"
|
||||
title-id="edit_web_content_enter_content_step_title"
|
||||
description-id="create_content_step2_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</condition>
|
||||
<condition if="#{EditWebContentWizard.mimeType == 'text/xml'}">
|
||||
<page path="/jsp/wcm/create-web-content-wizard/create-xml.jsp"
|
||||
title-id="edit_web_content_enter_content_step_title"
|
||||
description-id="create_content_step2_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</condition>
|
||||
<!-- Default to the inline text editor -->
|
||||
<page path="/jsp/wcm/create-web-content-wizard/create-text.jsp"
|
||||
title-id="edit_web_content_enter_content_step_title"
|
||||
description-id="create_content_step2_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="summary" title-id="summary" description-id="summary_step_description">
|
||||
<condition if="#{EditWebContentWizard.mimeType == 'text/xml'}">
|
||||
<page path="/jsp/wcm/create-web-content-wizard/summary.jsp"
|
||||
title-id="summary"
|
||||
description-id="create_web_content_summary_desc"
|
||||
instruction-id="content_finish_instruction" />
|
||||
</condition>
|
||||
<page path="/jsp/wizard/summary.jsp"
|
||||
title-id="summary"
|
||||
description-id="summary_desc"
|
||||
instruction-id="content_finish_instruction" />
|
||||
</step>
|
||||
</wizard>
|
||||
|
||||
<!-- Definition of the create form wizard -->
|
||||
<wizard name="createForm" managed-bean="CreateFormWizard"
|
||||
title-id="create_form_title" description-id="create_form_desc"
|
||||
icon="/images/icons/create_form_large.gif">
|
||||
<step name="form_details" title-id="create_form_form_details_title"
|
||||
description-id="create_form_form_details_desc">
|
||||
<page path="/jsp/wcm/create-form-wizard/details.jsp"
|
||||
title-id="create_form_form_details_step_title"
|
||||
description-id="create_form_form_details_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="summary" title-id="summary" description-id="summary_step_description">
|
||||
<page path="/jsp/wcm/create-form-wizard/form-summary.jsp"
|
||||
title-id="summary"
|
||||
description-id="summary_desc"
|
||||
instruction-id="content_finish_instruction" />
|
||||
</step>
|
||||
</wizard>
|
||||
|
||||
<!-- Definition of the edit form wizard -->
|
||||
<wizard name="editForm" managed-bean="EditFormWizard"
|
||||
title-id="edit_form_title" description-id="edit_form_desc"
|
||||
icon="/images/icons/edit_form_large.gif">
|
||||
<step name="form_details" title-id="create_form_form_details_title"
|
||||
description-id="create_form_form_details_desc">
|
||||
<page path="/jsp/wcm/create-form-wizard/details.jsp"
|
||||
title-id="create_form_form_details_step_title"
|
||||
description-id="create_form_form_details_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="summary" title-id="summary" description-id="summary_step_description">
|
||||
<page path="/jsp/wcm/create-form-wizard/form-summary.jsp"
|
||||
title-id="summary"
|
||||
description-id="summary_desc"
|
||||
instruction-id="content_finish_instruction" />
|
||||
</step>
|
||||
</wizard>
|
||||
|
||||
<!-- Definition of the create web form wizard -->
|
||||
<wizard name="createWebForm" managed-bean="CreateWebFormWizard"
|
||||
title-id="create_web_form_title" description-id="create_form_desc"
|
||||
icon="/images/icons/create_form_large.gif">
|
||||
<step name="form_details" title-id="create_web_form_form_details_title"
|
||||
description-id="create_form_form_details_desc">
|
||||
<page path="/jsp/wcm/create-form-wizard/details.jsp"
|
||||
title-id="create_web_form_form_details_step_title"
|
||||
description-id="create_form_form_details_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="configure_rendering_engine_templates"
|
||||
title-id="create_form_configure_rendering_engine_templates_title"
|
||||
description-id="create_form_configure_rendering_engine_templates_desc">
|
||||
<page path="/jsp/wcm/create-form-wizard/configure-rendering-engines.jsp"
|
||||
title-id="create_form_configure_rendering_engine_templates_step_title"
|
||||
description-id="create_form_configure_rendering_engine_templates_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="select_default_workflow"
|
||||
title-id="create_form_select_default_workflow_title"
|
||||
description-id="create_form_select_default_workflow_desc">
|
||||
<page path="/jsp/wcm/create-form-wizard/select-default-workflow.jsp"
|
||||
title-id="create_form_select_default_workflow_step_title"
|
||||
description-id="create_form_select_default_workflow_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="summary" title-id="summary" description-id="summary_step_description">
|
||||
<page path="/jsp/wcm/create-form-wizard/web-form-summary.jsp"
|
||||
title-id="summary"
|
||||
description-id="summary_desc"
|
||||
instruction-id="content_finish_instruction" />
|
||||
</step>
|
||||
</wizard>
|
||||
|
||||
<!-- Definition of the edit web form wizard -->
|
||||
<wizard name="editWebForm" managed-bean="EditWebFormWizard"
|
||||
title-id="edit_web_form_title" description-id="edit_form_desc"
|
||||
icon="/images/icons/edit_form_large.gif">
|
||||
<step name="form_details" title-id="create_web_form_form_details_title"
|
||||
description-id="create_form_form_details_desc">
|
||||
<page path="/jsp/wcm/create-form-wizard/details.jsp"
|
||||
title-id="create_web_form_form_details_step_title"
|
||||
description-id="create_form_form_details_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="configure_rendering_engine_templates"
|
||||
title-id="create_form_configure_rendering_engine_templates_title"
|
||||
description-id="create_form_configure_rendering_engine_templates_desc">
|
||||
<page path="/jsp/wcm/create-form-wizard/configure-rendering-engines.jsp"
|
||||
title-id="create_form_configure_rendering_engine_templates_step_title"
|
||||
description-id="create_form_configure_rendering_engine_templates_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="select_default_workflow"
|
||||
title-id="create_form_select_default_workflow_title"
|
||||
description-id="create_form_select_default_workflow_desc">
|
||||
<page path="/jsp/wcm/create-form-wizard/select-default-workflow.jsp"
|
||||
title-id="create_form_select_default_workflow_step_title"
|
||||
description-id="create_form_select_default_workflow_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="summary" title-id="summary" description-id="summary_step_description">
|
||||
<page path="/jsp/wcm/create-form-wizard/web-form-summary.jsp"
|
||||
title-id="summary"
|
||||
description-id="summary_desc"
|
||||
instruction-id="content_finish_instruction" />
|
||||
</step>
|
||||
</wizard>
|
||||
|
||||
<!-- Definition of the regenerate renditions wizard -->
|
||||
<wizard name="regenerateRenditions" managed-bean="RegenerateRenditionsWizard"
|
||||
title-id="regenerate_renditions_title" description-id="regenerate_renditions_desc"
|
||||
icon="/images/icons/regenerate_renditions_large.gif">
|
||||
<step name="select_renditions"
|
||||
title-id="regenerate_renditions_select_renditions_title"
|
||||
description-id="regenerate_renditions_select_renditions_desc">
|
||||
<page path="/jsp/wcm/regenerate-renditions-wizard/select_renditions.jsp"
|
||||
title-id="regenerate_renditions_select_renditions_step_title"
|
||||
description-id="regenerate_renditions_select_renditions_desc"
|
||||
instruction-id="regenerate_renditions_select_renditions_instruction" />
|
||||
</step>
|
||||
<step name="summary" title-id="summary" description-id="summary_step_description">
|
||||
<page path="/jsp/wcm/regenerate-renditions-wizard/summary.jsp"
|
||||
title-id="summary"
|
||||
description-id="regenerate_renditions_summary_desc"
|
||||
instruction-id="regenerate_renditions_summary_instruction" />
|
||||
</step>
|
||||
</wizard>
|
||||
|
||||
<!-- Definition of the Dashboard Layout wizard -->
|
||||
<wizard name="configureDashboard" managed-bean="DashboardWizard"
|
||||
title-id="configure_dashboard_title" description-id="configure_dashboard_desc"
|
||||
|
@@ -19,7 +19,6 @@
|
||||
<element-reader element-name="wizards" class="org.alfresco.web.config.WizardsElementReader"/>
|
||||
<element-reader element-name="dashboards" class="org.alfresco.web.config.DashboardsElementReader"/>
|
||||
<element-reader element-name="sidebar" class="org.alfresco.web.config.SidebarElementReader"/>
|
||||
<element-reader element-name="wcm" class="org.alfresco.web.config.WCMElementReader" />
|
||||
</element-readers>
|
||||
</plug-ins>
|
||||
|
||||
@@ -303,10 +302,6 @@
|
||||
jsp="/jsp/dashboards/dashlets/myspaces-webscript.jsp" />
|
||||
<dashlet id="mytasks-webscript" label-id="mytasks-webscript_title" description-id="mytasks-webscript_desc"
|
||||
jsp="/jsp/dashboards/dashlets/mytasks-webscript.jsp" />
|
||||
<dashlet id="mywebforms-webscript" label-id="mywebforms-webscript_title" description-id="mywebforms-webscript_desc"
|
||||
jsp="/jsp/dashboards/dashlets/mywebforms-webscript.jsp" />
|
||||
<dashlet id="mywebfiles-webscript" label-id="mywebfiles-webscript_title" description-id="mywebfiles-webscript_desc"
|
||||
jsp="/jsp/dashboards/dashlets/mywebfiles-webscript.jsp" />
|
||||
</dashlets>
|
||||
|
||||
<!-- configuration of the default dashlets to display when users login for the first time -->
|
||||
@@ -449,7 +444,6 @@
|
||||
<handler name="check-in" class="org.alfresco.web.bean.actions.handlers.CheckInHandler" />
|
||||
<handler name="check-out" class="org.alfresco.web.bean.actions.handlers.CheckOutHandler" />
|
||||
<handler name="copy" class="org.alfresco.web.bean.actions.handlers.CopyHandler" />
|
||||
<handler name="copy-to-web-project" class="org.alfresco.web.bean.actions.handlers.CopyToWebProjectHandler" />
|
||||
<handler name="import" class="org.alfresco.web.bean.actions.handlers.ImportHandler" />
|
||||
<handler name="link-category" class="org.alfresco.web.bean.actions.handlers.LinkCategoryHandler" />
|
||||
<handler name="mail" class="org.alfresco.web.bean.actions.handlers.MailHandler" />
|
||||
|
5
pom.xml
5
pom.xml
@@ -80,11 +80,6 @@
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.chiba</groupId>
|
||||
<artifactId>chiba</artifactId>
|
||||
<version>1.3.0-alfresco-patched</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.james</groupId>
|
||||
<artifactId>apache-mime4j-dom</artifactId>
|
||||
|
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.Path;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.NavigationBean;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
|
||||
/**
|
||||
* UI Action Evaluator - Create Form in the Forms DataDictionary folder
|
||||
*
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public class CreateFormEvaluator extends BaseActionEvaluator
|
||||
{
|
||||
private static final long serialVersionUID = 4475319627518524432L;
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
|
||||
*/
|
||||
public boolean evaluate(Node node)
|
||||
{
|
||||
final FacesContext fc = FacesContext.getCurrentInstance();
|
||||
final ServiceRegistry services = Repository.getServiceRegistry(fc);
|
||||
final NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);
|
||||
|
||||
// get the path to the current name - compare last element with the Forms folder name
|
||||
final Path path = navigator.getCurrentNode().getNodePath();
|
||||
final Path.Element element = path.get(path.size() - 1);
|
||||
final String endPath = element.getPrefixedString(services.getNamespaceService());
|
||||
|
||||
// check we have the permission to create nodes in that Forma folder
|
||||
return (Application.getContentFormsFolderName(fc).equals(endPath) &&
|
||||
navigator.getCurrentNode().hasPermission(PermissionService.ADD_CHILDREN));
|
||||
}
|
||||
}
|
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.Path;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.NavigationBean;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
|
||||
/**
|
||||
* UI Action Evaluator - Create Project Collaboration Space in the Projects folder
|
||||
*
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public class CreateProjectEvaluator extends BaseActionEvaluator
|
||||
{
|
||||
/**
|
||||
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
|
||||
*/
|
||||
public boolean evaluate(Node node)
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
ServiceRegistry services = Repository.getServiceRegistry(fc);
|
||||
NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);
|
||||
|
||||
// get the path to the current name - compare last element with the Website folder assoc name
|
||||
Path path = navigator.getCurrentNode().getNodePath();
|
||||
Path.Element element = path.get(path.size() - 1);
|
||||
String endPath = element.getPrefixedString(services.getNamespaceService());
|
||||
|
||||
if (Application.getProjectsFolderName(fc).equals(endPath))
|
||||
{
|
||||
// check we have the permission to create nodes in the Projects folder
|
||||
return navigator.getCurrentNode().hasPermission(PermissionService.ADD_CHILDREN);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.Path;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.NavigationBean;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
|
||||
/**
|
||||
* UI Action Evaluator - Create Web Forms in the Web Forms DataDictionary folder
|
||||
*
|
||||
*/
|
||||
public class CreateWebFormEvaluator extends BaseActionEvaluator
|
||||
{
|
||||
/**
|
||||
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
|
||||
*/
|
||||
public boolean evaluate(Node node)
|
||||
{
|
||||
final FacesContext fc = FacesContext.getCurrentInstance();
|
||||
final ServiceRegistry services = Repository.getServiceRegistry(fc);
|
||||
final NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);
|
||||
|
||||
// get the path to the current name - compare last element with the Web Forms folder name
|
||||
final Path path = navigator.getCurrentNode().getNodePath();
|
||||
final Path.Element element = path.get(path.size() - 1);
|
||||
final String endPath = element.getPrefixedString(services.getNamespaceService());
|
||||
|
||||
// check we have the permission to create nodes in that Web Forms folder
|
||||
return (Application.getWebContentFormsFolderName(fc).equals(endPath) &&
|
||||
navigator.getCurrentNode().hasPermission(PermissionService.ADD_CHILDREN));
|
||||
}
|
||||
}
|
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.Path;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.NavigationBean;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
|
||||
/**
|
||||
* UI Action Evaluator - Create Web Project in the Websites folder
|
||||
*
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public class CreateWebProjectEvaluator extends BaseActionEvaluator
|
||||
{
|
||||
private static final long serialVersionUID = 9061864145360361349L;
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
|
||||
*/
|
||||
public boolean evaluate(Node node)
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
ServiceRegistry services = Repository.getServiceRegistry(fc);
|
||||
NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);
|
||||
|
||||
// get the path to the current name - compare last element with the Website folder assoc name
|
||||
Path path = navigator.getCurrentNode().getNodePath();
|
||||
Path.Element element = path.get(path.size() - 1);
|
||||
String endPath = element.getPrefixedString(services.getNamespaceService());
|
||||
|
||||
if (Application.getWebsitesFolderName(fc).equals(endPath))
|
||||
{
|
||||
// check we have the permission to create nodes in that Website folder
|
||||
return navigator.getCurrentNode().hasPermission(PermissionService.ADD_CHILDREN);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
||||
/**
|
||||
* UI Action Evaluator - Edit Form in the Forms DataDictionary folder
|
||||
*
|
||||
* @author Ariel Backenroth
|
||||
*/
|
||||
public class EditFormEvaluator extends BaseActionEvaluator
|
||||
{
|
||||
private static final long serialVersionUID = -509493291648778510L;
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
|
||||
*/
|
||||
public boolean evaluate(final Node node)
|
||||
{
|
||||
// // WCM
|
||||
// final FacesContext fc = FacesContext.getCurrentInstance();
|
||||
// final ServiceRegistry services = Repository.getServiceRegistry(fc);
|
||||
// final NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);
|
||||
//
|
||||
// // get the path to the current name - compare last element with the Forms folder name
|
||||
// final Path path = navigator.getCurrentNode().getNodePath();
|
||||
// final Path.Element element = path.get(path.size() - 1);
|
||||
// final String endPath = element.getPrefixedString(services.getNamespaceService());
|
||||
//
|
||||
// return (Application.getContentFormsFolderName(fc).equals(endPath) &&
|
||||
// node.hasAspect(WCMAppModel.ASPECT_FORM));
|
||||
return false;
|
||||
}
|
||||
}
|
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
||||
/**
|
||||
* UI Action Evaluator - Edit Web Form in the Web Forms DataDictionary folder
|
||||
*
|
||||
* @author Ariel Backenroth
|
||||
*/
|
||||
public class EditWebFormEvaluator extends BaseActionEvaluator
|
||||
{
|
||||
/**
|
||||
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
|
||||
*/
|
||||
public boolean evaluate(final Node node)
|
||||
{
|
||||
// // WCM
|
||||
// final FacesContext fc = FacesContext.getCurrentInstance();
|
||||
// final ServiceRegistry services = Repository.getServiceRegistry(fc);
|
||||
// final NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);
|
||||
//
|
||||
// // get the path to the current name - compare last element with the Web Forms folder name
|
||||
// final Path path = navigator.getCurrentNode().getNodePath();
|
||||
// final Path.Element element = path.get(path.size() - 1);
|
||||
// final String endPath = element.getPrefixedString(services.getNamespaceService());
|
||||
//
|
||||
// return (Application.getWebContentFormsFolderName(fc).equals(endPath) &&
|
||||
// node.hasAspect(WCMAppModel.ASPECT_FORM));
|
||||
return false;
|
||||
}
|
||||
}
|
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
||||
/**
|
||||
* UI Action Evaluator - Evaluates whether the change and remove permissions action should be visible.
|
||||
*
|
||||
* @author Sergey Gavrusev
|
||||
*/
|
||||
public class ManagePermissionIsMainStoreEvaluator extends BaseActionEvaluator
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 4221869509273412546L;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.alfresco.web.action.evaluator.BaseActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
|
||||
*/
|
||||
public boolean evaluate(final Node node)
|
||||
{
|
||||
boolean result = false;
|
||||
// // WCM
|
||||
// final String path = AVMNodeConverter.ToAVMVersionPath(node.getNodeRef()).getSecond();
|
||||
// if (!AVMUtil.isMainStore(AVMUtil.getStoreName(path)))
|
||||
// {
|
||||
// result = true;
|
||||
// }
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.alfresco.web.action.evaluator.BaseActionEvaluator#evaluate(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean evaluate(final Object obj)
|
||||
{
|
||||
// // WCM
|
||||
// if (obj instanceof ManagePermissionsDialog)
|
||||
// {
|
||||
// return ((ManagePermissionsDialog) obj).isRendered();
|
||||
// }
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@@ -1,91 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
||||
/**
|
||||
* UI Action Evaluator for Regenerate Renditions in the Web Forms DataDictionary folder
|
||||
*
|
||||
* @author Ariel Backenroth
|
||||
*/
|
||||
public class RegenerateRenditionsEvaluator extends BaseActionEvaluator
|
||||
{
|
||||
private static final long serialVersionUID = -3479861093052578775L;
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
|
||||
*/
|
||||
public boolean evaluate(final Node node)
|
||||
{
|
||||
// Sparta: disable/remove WCM/AVM
|
||||
return false;
|
||||
|
||||
/*
|
||||
// is the authenticated user permitted to execute the regenerate renditions action
|
||||
// against at least one web project
|
||||
boolean isUserAllowed = false;
|
||||
|
||||
final FacesContext fc = FacesContext.getCurrentInstance();
|
||||
final ServiceRegistry services = Repository.getServiceRegistry(fc);
|
||||
final PermissionService permissionService = services.getPermissionService();
|
||||
final WebProjectService webProjectService = services.getWebProjectService();
|
||||
final NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);
|
||||
|
||||
// before looking for web projects ensure the root folder is present i.e. WCM is enabled!
|
||||
if (!webProjectService.hasWebProjectsRoot())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// check that the authenticated user has CONTENT MANAGER permissions for at least one web project
|
||||
// this will ensure that the action appears only if the user is able to regenerate renditions
|
||||
// for at least one web project
|
||||
List<WebProjectInfo> wpInfos = webProjectService.listWebProjects();
|
||||
for (WebProjectInfo wpInfo : wpInfos)
|
||||
{
|
||||
if(permissionService.hasPermission(wpInfo.getNodeRef(), PermissionService.WCM_CONTENT_MANAGER) == AccessStatus.ALLOWED)
|
||||
{
|
||||
isUserAllowed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO improve how we determine whether the form supports the ability to regenerate renditions or not
|
||||
|
||||
// get the path to the current name - compare each path element with the Web Forms folder name
|
||||
final Path path = navigator.getCurrentNode().getNodePath();
|
||||
|
||||
boolean isWebFormsPath = false;
|
||||
Iterator<Path.Element> itr = path.iterator();
|
||||
while (itr.hasNext())
|
||||
{
|
||||
Path.Element element = (Path.Element)itr.next();
|
||||
String pathElement = element.getPrefixedString(services.getNamespaceService());
|
||||
if (Application.getWebContentFormsFolderName(fc).equals(pathElement))
|
||||
{
|
||||
isWebFormsPath = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (node.hasAspect(WCMAppModel.ASPECT_RENDERING_ENGINE_TEMPLATE) || isWebFormsPath) && isUserAllowed;
|
||||
*/
|
||||
}
|
||||
}
|
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
||||
/**
|
||||
* UI Action Evaluator - Evaluates whether the view permissions action should be visible.
|
||||
*
|
||||
* @author Sergey Gavrusev
|
||||
*/
|
||||
public class ViewPermissionEvaluator extends BaseActionEvaluator
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1340473144312214960L;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.alfresco.web.action.evaluator.BaseActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
|
||||
*/
|
||||
@Override
|
||||
public boolean evaluate(final Node node)
|
||||
{
|
||||
boolean result = true;
|
||||
// // WCM
|
||||
// final String path = AVMNodeConverter.ToAVMVersionPath(node.getNodeRef()).getSecond();
|
||||
// if (!AVMUtil.isMainStore(AVMUtil.getStoreName(path)))
|
||||
// {
|
||||
// result = false;
|
||||
// }
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.alfresco.web.action.evaluator.BaseActionEvaluator#evaluate(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean evaluate(Object obj)
|
||||
{
|
||||
// // WCM
|
||||
// if (obj instanceof ManagePermissionsDialog)
|
||||
// {
|
||||
// return !((ManagePermissionsDialog) obj).isRendered();
|
||||
// }
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@@ -28,7 +28,6 @@ import java.util.ResourceBundle;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
@@ -641,70 +640,6 @@ public class Application
|
||||
return getGuestHomeFolderName(FacesContextUtils.getRequiredWebApplicationContext(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Websites folder name
|
||||
*/
|
||||
public static String getWebsitesFolderName(ServletContext context)
|
||||
{
|
||||
return getWebsitesFolderName(WebApplicationContextUtils.getRequiredWebApplicationContext(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Websites folder name
|
||||
*/
|
||||
public static String getWebsitesFolderName(FacesContext context)
|
||||
{
|
||||
return getWebsitesFolderName(FacesContextUtils.getRequiredWebApplicationContext(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the WCM Content Forms folder name
|
||||
*/
|
||||
public static String getWebContentFormsFolderName(ServletContext context)
|
||||
{
|
||||
return getWebContentFormsFolderName(WebApplicationContextUtils.getRequiredWebApplicationContext(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the WCM Content Forms folder name
|
||||
*/
|
||||
public static String getWebContentFormsFolderName(FacesContext context)
|
||||
{
|
||||
return getWebContentFormsFolderName(FacesContextUtils.getRequiredWebApplicationContext(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Content Forms folder name
|
||||
*/
|
||||
public static String getContentFormsFolderName(ServletContext context)
|
||||
{
|
||||
return getContentFormsFolderName(WebApplicationContextUtils.getRequiredWebApplicationContext(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Content Forms folder name
|
||||
*/
|
||||
public static String getContentFormsFolderName(FacesContext context)
|
||||
{
|
||||
return getContentFormsFolderName(FacesContextUtils.getRequiredWebApplicationContext(context));
|
||||
}
|
||||
|
||||
/**
|
||||
<<<<<<< .working
|
||||
* @return the Projects folder name
|
||||
*/
|
||||
public static String getProjectsFolderName(ServletContext context)
|
||||
{
|
||||
return getProjectsFolderName(WebApplicationContextUtils.getRequiredWebApplicationContext(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Projects folder name
|
||||
*/
|
||||
public static String getProjectsFolderName(FacesContext context)
|
||||
{
|
||||
return getProjectsFolderName(FacesContextUtils.getRequiredWebApplicationContext(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the language locale for the current user context
|
||||
@@ -1259,78 +1194,6 @@ public class Application
|
||||
return guestHomeFolderName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Websites folder name
|
||||
*
|
||||
* @param context The Spring context
|
||||
* @return The Websites folder name
|
||||
*/
|
||||
private static String getWebsitesFolderName(WebApplicationContext context)
|
||||
{
|
||||
if (websitesFolderName == null)
|
||||
{
|
||||
ImporterBootstrap bootstrap = (ImporterBootstrap)context.getBean(BEAN_IMPORTER_BOOTSTRAP);
|
||||
Properties configuration = bootstrap.getConfiguration();
|
||||
websitesFolderName = configuration.getProperty("spaces.wcm.childname");
|
||||
}
|
||||
|
||||
return websitesFolderName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Projects folder name
|
||||
*
|
||||
* @param context The Spring context
|
||||
* @return The Projects folder name
|
||||
*/
|
||||
private static String getProjectsFolderName(WebApplicationContext context)
|
||||
{
|
||||
if (projectsFolderName == null)
|
||||
{
|
||||
ImporterBootstrap bootstrap = (ImporterBootstrap)context.getBean(BEAN_IMPORTER_BOOTSTRAP);
|
||||
Properties configuration = bootstrap.getConfiguration();
|
||||
projectsFolderName = configuration.getProperty("spaces.projects.childname");
|
||||
}
|
||||
|
||||
return projectsFolderName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the WCM Content Forms folder name
|
||||
*
|
||||
* @param context The Spring context
|
||||
* @return The WCM Content Forms folder name
|
||||
*/
|
||||
private static String getWebContentFormsFolderName(WebApplicationContext context)
|
||||
{
|
||||
if (webContentFormsFolderName == null)
|
||||
{
|
||||
ImporterBootstrap bootstrap = (ImporterBootstrap)context.getBean(BEAN_IMPORTER_BOOTSTRAP);
|
||||
Properties configuration = bootstrap.getConfiguration();
|
||||
webContentFormsFolderName = configuration.getProperty("spaces.wcm_content_forms.childname");
|
||||
}
|
||||
|
||||
return webContentFormsFolderName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Content Forms folder name
|
||||
*
|
||||
* @param context The Spring context
|
||||
* @return The WCM Content Forms folder name
|
||||
*/
|
||||
private static String getContentFormsFolderName(WebApplicationContext context)
|
||||
{
|
||||
if (contentFormsFolderName == null)
|
||||
{
|
||||
ImporterBootstrap bootstrap = (ImporterBootstrap)context.getBean(BEAN_IMPORTER_BOOTSTRAP);
|
||||
Properties configuration = bootstrap.getConfiguration();
|
||||
contentFormsFolderName = configuration.getProperty("spaces.content_forms.childname");
|
||||
}
|
||||
|
||||
return contentFormsFolderName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the configured error page for the application
|
||||
*
|
||||
|
@@ -1,98 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.web.app.servlet.command;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.web.app.servlet.BaseServlet;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.NavigationBean;
|
||||
import org.springframework.extensions.surf.util.ParameterCheck;
|
||||
|
||||
/**
|
||||
* Command to execute the Edit Web Content (xforms) wizard via url.
|
||||
* <p>
|
||||
* Arguments: webproject = the GUID of the webproject to create the content in
|
||||
* sandbox = the sandbox to create the content in
|
||||
* path = path to the form instance data for edit
|
||||
*
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public class EditWebContentCommand extends BaseUIActionCommand
|
||||
{
|
||||
public static final String PROP_WEBPROJECTID = "webproject";
|
||||
public static final String PROP_SANDBOX = "sandbox";
|
||||
public static final String PROP_PATH = "path";
|
||||
|
||||
private static final String[] PROPERTIES = new String[] {
|
||||
PROP_SERVLETCONTEXT, PROP_REQUEST, PROP_RESPONSE, PROP_WEBPROJECTID, PROP_SANDBOX, PROP_PATH};
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.app.servlet.command.Command#execute(org.alfresco.service.ServiceRegistry, java.util.Map)
|
||||
*/
|
||||
public Object execute(ServiceRegistry serviceRegistry, Map<String, Object> properties)
|
||||
{
|
||||
ServletContext sc = (ServletContext)properties.get(PROP_SERVLETCONTEXT);
|
||||
ServletRequest req = (ServletRequest)properties.get(PROP_REQUEST);
|
||||
ServletResponse res = (ServletResponse)properties.get(PROP_RESPONSE);
|
||||
FacesContext fc = FacesHelper.getFacesContext(req, res, sc);
|
||||
// AVMBrowseBean avmBrowseBean = (AVMBrowseBean)FacesHelper.getManagedBean(fc, AVMBrowseBean.BEAN_NAME); // WCM
|
||||
NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);
|
||||
|
||||
// setup context from url args in properties map
|
||||
String webProjectId = (String)properties.get(PROP_WEBPROJECTID);
|
||||
ParameterCheck.mandatoryString(PROP_WEBPROJECTID, webProjectId);
|
||||
String sandbox = (String)properties.get(PROP_SANDBOX);
|
||||
ParameterCheck.mandatoryString(PROP_SANDBOX, sandbox);
|
||||
String path = (String)properties.get(PROP_PATH);
|
||||
ParameterCheck.mandatoryString(PROP_PATH, path);
|
||||
navigator.setCurrentNodeId(webProjectId);
|
||||
// // WCM
|
||||
// avmBrowseBean.setSandbox(sandbox);
|
||||
// // navigation handler is called directly in this method
|
||||
// avmBrowseBean.setupEditAction(path);
|
||||
|
||||
String viewId = fc.getViewRoot().getViewId();
|
||||
try
|
||||
{
|
||||
sc.getRequestDispatcher(BaseServlet.FACES_SERVLET + viewId).forward(req, res);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Unable to forward to viewId: " + viewId, e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.app.servlet.command.Command#getPropertyNames()
|
||||
*/
|
||||
public String[] getPropertyNames()
|
||||
{
|
||||
return PROPERTIES;
|
||||
}
|
||||
}
|
@@ -47,12 +47,9 @@ import org.alfresco.web.ui.common.Utils;
|
||||
*/
|
||||
public class UIActionCommandProcessor implements ExtCommandProcessor
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final String MANAGE_TASK = "managetask";
|
||||
private static final String MANAGE_TASK = "managetask";
|
||||
|
||||
public static final String PARAM_CONTAINER = "container";
|
||||
public static final String PARAM_CONTAINER = "container";
|
||||
|
||||
private ServletContext sc = null;
|
||||
private String command = null;
|
||||
@@ -61,9 +58,6 @@ public static final String PARAM_CONTAINER = "container";
|
||||
static
|
||||
{
|
||||
// add our commands to the command registry
|
||||
// // WCM
|
||||
// CommandFactory.getInstance().registerCommand("createwebcontent", CreateWebContentCommand.class);
|
||||
CommandFactory.getInstance().registerCommand("editwebcontent", EditWebContentCommand.class);
|
||||
CommandFactory.getInstance().registerCommand(MANAGE_TASK, ManageTaskDialogCommand.class);
|
||||
CommandFactory.getInstance().registerCommand("editcontentprops", EditContentPropertiesCommand.class);
|
||||
CommandFactory.getInstance().registerCommand("userprofile", UserProfileDialogCommand.class);
|
||||
@@ -81,7 +75,7 @@ public static final String PARAM_CONTAINER = "container";
|
||||
{
|
||||
this.args = new HashMap<String, String>(args);
|
||||
}
|
||||
if(MANAGE_TASK.equals(command))
|
||||
if (MANAGE_TASK.equals(command))
|
||||
{
|
||||
String taskId = args.get(ManageTaskDialogCommand.PROP_TASKID);
|
||||
return WorkflowUtil.isTaskEditable(taskId, sc);
|
||||
|
@@ -102,7 +102,6 @@ public class AdminNodeBrowseBean implements Serializable
|
||||
transient private DataModel assocs = null;
|
||||
transient private DataModel permissions = null;
|
||||
transient private DataModel permissionMasks = null;
|
||||
transient private DataModel avmStoreProps = null;
|
||||
|
||||
// supporting repository services
|
||||
transient private TransactionService transactionService;
|
||||
@@ -111,8 +110,6 @@ public class AdminNodeBrowseBean implements Serializable
|
||||
transient private SearchService searchService;
|
||||
transient private NamespaceService namespaceService;
|
||||
transient private PermissionService permissionService;
|
||||
// // WCM
|
||||
// transient private AVMService avmService;
|
||||
|
||||
/**
|
||||
* @param transactionService transaction service
|
||||
@@ -216,24 +213,6 @@ public class AdminNodeBrowseBean implements Serializable
|
||||
return permissionService;
|
||||
}
|
||||
|
||||
// // WCM
|
||||
// /**
|
||||
// * @param avmService AVM service
|
||||
// */
|
||||
// public void setAVMService(AVMService avmService)
|
||||
// {
|
||||
// this.avmService = avmService;
|
||||
// }
|
||||
//
|
||||
// private AVMService getAVMService()
|
||||
// {
|
||||
// if (avmService == null)
|
||||
// {
|
||||
// avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService();
|
||||
// }
|
||||
// return avmService;
|
||||
// }
|
||||
//
|
||||
/**
|
||||
* Gets the list of repository stores
|
||||
*
|
||||
@@ -424,18 +403,9 @@ public class AdminNodeBrowseBean implements Serializable
|
||||
{
|
||||
if (permissionMasks == null)
|
||||
{
|
||||
// // WCM
|
||||
// if (nodeRef.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM))
|
||||
// {
|
||||
// List<AccessPermission> nodePermissions = new ArrayList<AccessPermission>(getPermissionService().getAllSetPermissions(nodeRef.getStoreRef()));
|
||||
// permissionMasks = new ListDataModel(nodePermissions);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
List<NoStoreMask> noReadPermissions = new ArrayList<NoStoreMask>(1);
|
||||
noReadPermissions.add(new NoStoreMask());
|
||||
permissionMasks = new ListDataModel(noReadPermissions);
|
||||
// }
|
||||
List<NoStoreMask> noReadPermissions = new ArrayList<NoStoreMask>(1);
|
||||
noReadPermissions.add(new NoStoreMask());
|
||||
permissionMasks = new ListDataModel(noReadPermissions);
|
||||
}
|
||||
return permissionMasks;
|
||||
}
|
||||
@@ -476,43 +446,6 @@ public class AdminNodeBrowseBean implements Serializable
|
||||
}
|
||||
return assocs;
|
||||
}
|
||||
//
|
||||
// // WCM
|
||||
// public boolean getInAVMStore()
|
||||
// {
|
||||
// return nodeRef.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM);
|
||||
// }
|
||||
//
|
||||
// // WCM
|
||||
// public DataModel getAVMStoreProperties()
|
||||
// {
|
||||
// if (avmStoreProps == null)
|
||||
// {
|
||||
// // work out the store name from current nodeRef
|
||||
// String store = nodeRef.getStoreRef().getIdentifier();
|
||||
// Map<QName, PropertyValue> props = getAVMService().getStoreProperties(store);
|
||||
// List<Map<String, String>> storeProperties = new ArrayList<Map<String, String>>();
|
||||
//
|
||||
// for (Map.Entry<QName, PropertyValue> property : props.entrySet())
|
||||
// {
|
||||
// Map<String, String> map = new HashMap<String, String>(2);
|
||||
// map.put("name", property.getKey().toString());
|
||||
// map.put("type", property.getValue().getActualTypeString());
|
||||
// String val = property.getValue().getStringValue();
|
||||
// if (val == null)
|
||||
// {
|
||||
// val = "null";
|
||||
// }
|
||||
// map.put("value", val);
|
||||
//
|
||||
// storeProperties.add(map);
|
||||
// }
|
||||
//
|
||||
// avmStoreProps = new ListDataModel(storeProperties);
|
||||
// }
|
||||
//
|
||||
// return avmStoreProps;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Gets the current query language
|
||||
@@ -585,8 +518,6 @@ public class AdminNodeBrowseBean implements Serializable
|
||||
NodeRef rootNode = getNodeService().getRootNode(storeRef);
|
||||
setNodeRef(rootNode);
|
||||
|
||||
this.avmStoreProps = null;
|
||||
|
||||
return "success";
|
||||
}
|
||||
|
||||
|
@@ -59,9 +59,6 @@ abstract class AbstractClipboardItem implements ClipboardItem
|
||||
private QName type;
|
||||
private String icon;
|
||||
|
||||
// // WCM
|
||||
// transient protected AVMService avmService;
|
||||
//
|
||||
private List<String> customPasteViewIds;
|
||||
|
||||
|
||||
@@ -93,21 +90,6 @@ abstract class AbstractClipboardItem implements ClipboardItem
|
||||
this.customPasteViewIds = customPasteViewIds;
|
||||
}
|
||||
|
||||
// // WCM
|
||||
// public void setAvmService(AVMService avmService)
|
||||
// {
|
||||
// this.avmService = avmService;
|
||||
// }
|
||||
//
|
||||
// protected AVMService getAvmService()
|
||||
// {
|
||||
// if (avmService == null)
|
||||
// {
|
||||
// avmService = getServiceRegistry().getAVMLockingAwareService();
|
||||
// }
|
||||
// return avmService;
|
||||
// }
|
||||
//
|
||||
public ClipboardStatus getMode()
|
||||
{
|
||||
return this.mode;
|
||||
@@ -226,29 +208,4 @@ abstract class AbstractClipboardItem implements ClipboardItem
|
||||
|
||||
return (nodeRefs.size() != 0);
|
||||
}
|
||||
//
|
||||
// // WCM
|
||||
// protected void recursiveFormCheck(AVMNodeDescriptor desc)
|
||||
// {
|
||||
// if (desc.isFile())
|
||||
// {
|
||||
// String filePath = desc.getPath();
|
||||
// if (avmService.hasAspect(-1, filePath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
|
||||
// {
|
||||
// avmService.removeAspect(filePath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA);
|
||||
// }
|
||||
// if (avmService.hasAspect(-1, filePath, WCMAppModel.ASPECT_RENDITION))
|
||||
// {
|
||||
// avmService.removeAspect(filePath, WCMAppModel.ASPECT_RENDITION);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Map<String, AVMNodeDescriptor> listing = getAvmService().getDirectoryListing(desc);
|
||||
// for (Map.Entry<String, AVMNodeDescriptor> entry : listing.entrySet())
|
||||
// {
|
||||
// recursiveFormCheck(entry.getValue());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
@@ -330,16 +330,6 @@ public class ClipboardBean implements Serializable
|
||||
{
|
||||
item = new WorkspaceClipboardItem(ref, parent, mode, customPasteViewIds);
|
||||
}
|
||||
// // WCM
|
||||
// else if (StoreRef.PROTOCOL_AVM.equals(ref.getStoreRef().getProtocol()))
|
||||
// {
|
||||
// item = new AVMClipboardItem(ref, mode, customPasteViewIds);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// logger.warn("Unable to add item to clipboard - unknown store protocol: " + ref.getStoreRef().getProtocol());
|
||||
// }
|
||||
//
|
||||
if (item != null)
|
||||
{
|
||||
// check for duplicates first
|
||||
@@ -364,8 +354,6 @@ public class ClipboardBean implements Serializable
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
if (Application.getClientConfig(context).isClipboardStatusVisible())
|
||||
{
|
||||
// // WCM
|
||||
// String pattern = Application.getMessage(context, StoreRef.PROTOCOL_AVM.equals(ref.getStoreRef().getProtocol()) ? "node_added_clipboard_avm" : "node_added_clipboard");
|
||||
String pattern = Application.getMessage(context, "node_added_clipboard");
|
||||
String msg = MessageFormat.format(pattern, items.size());
|
||||
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
|
||||
|
@@ -55,7 +55,6 @@ public class WorkspaceClipboardItem extends AbstractClipboardItem
|
||||
private static final long serialVersionUID = -1686557602737846009L;
|
||||
|
||||
private static final String WORKSPACE_PASTE_VIEW_ID = "/jsp/browse/browse.jsp";
|
||||
// private static final String AVM_PASTE_VIEW_ID = "/jsp/wcm/browse-sandbox.jsp"; // WCM
|
||||
private static final String FORUMS_PASTE_VIEW_ID = "/jsp/forums/forums.jsp";
|
||||
private static final String FORUM_PASTE_VIEW_ID = "/jsp/forums/forum.jsp";
|
||||
|
||||
@@ -96,24 +95,8 @@ public class WorkspaceClipboardItem extends AbstractClipboardItem
|
||||
*/
|
||||
public boolean canCopyToViewId(String viewId)
|
||||
{
|
||||
// // WCM
|
||||
// if (AVM_PASTE_VIEW_ID.equals(viewId))
|
||||
// {
|
||||
// AVMBrowseBean avmBrowseBean = (AVMBrowseBean)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), AVMBrowseBean.BEAN_NAME);
|
||||
// String destPath = avmBrowseBean.getCurrentPath();
|
||||
//
|
||||
// if (WCMUtil.isStagingStore(WCMUtil.getStoreName(destPath)))
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
// else
|
||||
{
|
||||
return super.canCopyToViewId(viewId) || (WORKSPACE_PASTE_VIEW_ID.equals(viewId) || /*AVM_PASTE_VIEW_ID.equals(viewId) || WCM */
|
||||
FORUMS_PASTE_VIEW_ID.equals(viewId) || FORUM_PASTE_VIEW_ID.equals(viewId));
|
||||
}
|
||||
return super.canCopyToViewId(viewId) || (WORKSPACE_PASTE_VIEW_ID.equals(viewId) ||
|
||||
FORUMS_PASTE_VIEW_ID.equals(viewId) || FORUM_PASTE_VIEW_ID.equals(viewId));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,8 +104,8 @@ public class WorkspaceClipboardItem extends AbstractClipboardItem
|
||||
*/
|
||||
public boolean canMoveToViewId(String viewId)
|
||||
{
|
||||
return super.canMoveToViewId(viewId) || (WORKSPACE_PASTE_VIEW_ID.equals(viewId) || FORUMS_PASTE_VIEW_ID.equals(viewId) ||
|
||||
FORUM_PASTE_VIEW_ID.equals(viewId));
|
||||
return super.canMoveToViewId(viewId) || (WORKSPACE_PASTE_VIEW_ID.equals(viewId) || FORUMS_PASTE_VIEW_ID.equals(viewId) ||
|
||||
FORUM_PASTE_VIEW_ID.equals(viewId));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -346,75 +329,6 @@ public class WorkspaceClipboardItem extends AbstractClipboardItem
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// // WCM
|
||||
// else if (AVM_PASTE_VIEW_ID.equals(viewId))
|
||||
// {
|
||||
// AVMBrowseBean avmBrowseBean = (AVMBrowseBean)FacesHelper.getManagedBean(fc, AVMBrowseBean.BEAN_NAME);
|
||||
//
|
||||
// final String destPath = avmBrowseBean.getCurrentPath();
|
||||
// final NodeRef destRef = AVMNodeConverter.ToNodeRef(-1, destPath);
|
||||
//
|
||||
// final CrossRepositoryCopyService crossRepoCopyService = getServiceRegistry().getCrossRepositoryCopyService();
|
||||
//
|
||||
// // initial name to attempt the copy of the item with
|
||||
// String name = getName();
|
||||
//
|
||||
// for(;;)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// final String currentName = name;
|
||||
//
|
||||
// // attempt each copy/paste in its own transaction
|
||||
// retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback<Void>()
|
||||
// {
|
||||
// public Void execute() throws Throwable
|
||||
// {
|
||||
// if (getMode() == ClipboardStatus.COPY)
|
||||
// {
|
||||
// // COPY operation
|
||||
// if (logger.isDebugEnabled())
|
||||
// logger.debug("Attempting to copy node: " + getNodeRef() + " into node ID: " + destRef.toString());
|
||||
//
|
||||
// // inter-store copy operation
|
||||
// crossRepoCopyService.copy(getNodeRef(), destRef, currentName);
|
||||
//
|
||||
// if (destRef.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM))
|
||||
// {
|
||||
// // ETHREEOH-2110
|
||||
// AVMNodeDescriptor desc = getAvmService().lookup(-1, destPath + "/" + currentName);
|
||||
// recursiveFormCheck(desc);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // this should not occur as the canMoveToViewId() will return false
|
||||
// throw new Exception("Move operation not supported between stores.");
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// // We got here without error, so no need to loop with a new name
|
||||
// break;
|
||||
// }
|
||||
// catch (FileExistsException fileExistsErr)
|
||||
// {
|
||||
// // If mode is COPY, have another go around the loop with a new name
|
||||
// if (getMode() == ClipboardStatus.COPY)
|
||||
// {
|
||||
// String copyOf = Application.getMessage(fc, MSG_COPY_OF);
|
||||
// name = copyOf + ' ' + name;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // we should not rename an item when it is being moved - so exit
|
||||
// throw fileExistsErr;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
else
|
||||
{
|
||||
return false;
|
||||
|
@@ -317,24 +317,7 @@ public class CheckinCheckoutDialog extends BaseDialogBean
|
||||
{
|
||||
boolean editingInline = false;
|
||||
Node node = setupContentDocument(id);
|
||||
|
||||
// // WCM
|
||||
// if (node.hasAspect(WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
|
||||
// {
|
||||
// editingInline = true;
|
||||
//
|
||||
// // editable form document
|
||||
// FacesContext fc = FacesContext.getCurrentInstance();
|
||||
// this.navigator.setupDispatchContext(node);
|
||||
//
|
||||
// // TODO - rename editContent Wizard since it only deals with editing form content
|
||||
// fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "wizard:editContent");
|
||||
// }
|
||||
//
|
||||
// // detect the inline editing aspect to see which edit mode to use
|
||||
// else if (node.hasAspect(ApplicationModel.ASPECT_INLINEEDITABLE) &&
|
||||
// node.getProperties().get(ApplicationModel.PROP_EDITINLINE) != null &&
|
||||
// ((Boolean)node.getProperties().get(ApplicationModel.PROP_EDITINLINE)).booleanValue() == true)
|
||||
|
||||
if (node.hasAspect(ApplicationModel.ASPECT_INLINEEDITABLE) &&
|
||||
node.getProperties().get(ApplicationModel.PROP_EDITINLINE) != null &&
|
||||
((Boolean)node.getProperties().get(ApplicationModel.PROP_EDITINLINE)).booleanValue() == true)
|
||||
|
@@ -18,11 +18,8 @@
|
||||
*/
|
||||
package org.alfresco.web.bean.content;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
@@ -31,30 +28,21 @@ import javax.faces.context.FacesContext;
|
||||
import javax.faces.event.ValueChangeEvent;
|
||||
import javax.faces.model.SelectItem;
|
||||
|
||||
import org.springframework.extensions.config.Config;
|
||||
import org.springframework.extensions.config.ConfigElement;
|
||||
import org.springframework.extensions.config.ConfigService;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.service.cmr.model.FileExistsException;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.data.IDataContainer;
|
||||
import org.alfresco.web.data.QuickSort;
|
||||
import org.alfresco.web.forms.Form;
|
||||
import org.alfresco.web.forms.FormNotFoundException;
|
||||
import org.alfresco.web.forms.FormProcessor;
|
||||
import org.alfresco.web.forms.FormsService;
|
||||
import org.alfresco.util.XMLUtil;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.w3c.dom.Document;
|
||||
import org.springframework.extensions.config.Config;
|
||||
import org.springframework.extensions.config.ConfigElement;
|
||||
import org.springframework.extensions.config.ConfigService;
|
||||
|
||||
/**
|
||||
* Bean implementation for the "Create Content Wizard" dialog
|
||||
@@ -68,35 +56,9 @@ public class CreateContentWizard extends BaseContentWizard
|
||||
protected String content = null;
|
||||
protected List<SelectItem> createMimeTypes;
|
||||
|
||||
transient protected FormsService formsService;
|
||||
protected String formName;
|
||||
protected FormProcessor.Session formProcessorSession = null;
|
||||
transient protected Document instanceDataDocument = null;
|
||||
|
||||
private static Log logger = LogFactory.getLog(CreateContentWizard.class);
|
||||
|
||||
|
||||
/**
|
||||
* @param formsService The FormsService to set.
|
||||
*/
|
||||
public void setFormsService(final FormsService formsService)
|
||||
{
|
||||
this.formsService = formsService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the formsService
|
||||
*/
|
||||
private FormsService getFormsService()
|
||||
{
|
||||
//check for null for cluster environment
|
||||
if (formsService == null)
|
||||
{
|
||||
formsService = (FormsService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService");
|
||||
}
|
||||
return formsService;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Wizard implementation
|
||||
|
||||
@@ -104,25 +66,8 @@ public class CreateContentWizard extends BaseContentWizard
|
||||
@Override
|
||||
public String finish()
|
||||
{
|
||||
// if a form is entered, then save the form instance data as XML ...
|
||||
if (this.instanceDataDocument != null)
|
||||
{
|
||||
this.content = XMLUtil.toString(this.instanceDataDocument, true);
|
||||
|
||||
this.mimeType = MimetypeMap.MIMETYPE_XML; // belts & braces - override mimetype (in case is not set to XML)
|
||||
}
|
||||
|
||||
String result = super.finish();
|
||||
|
||||
// // WCM
|
||||
// if ((super.createdNode != null) && (this.instanceDataDocument != null))
|
||||
// {
|
||||
// final Map<QName, Serializable> props = new HashMap<QName, Serializable>(1, 1.0f);
|
||||
// props.put(WCMAppModel.PROP_PARENT_FORM_NAME, getFormName());
|
||||
// props.put(WCMAppModel.PROP_ORIGINAL_PARENT_PATH, "");
|
||||
// getNodeService().addAspect(super.createdNode, WCMAppModel.ASPECT_FORM_INSTANCE_DATA, props);
|
||||
// }
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -144,14 +89,6 @@ public class CreateContentWizard extends BaseContentWizard
|
||||
this.content = null;
|
||||
this.inlineEdit = true;
|
||||
this.mimeType = MimetypeMap.MIMETYPE_HTML;
|
||||
this.formName = "";
|
||||
|
||||
this.instanceDataDocument = null;
|
||||
if (this.formProcessorSession != null)
|
||||
{
|
||||
this.formProcessorSession.destroy();
|
||||
}
|
||||
this.formProcessorSession = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -299,11 +236,6 @@ public class CreateContentWizard extends BaseContentWizard
|
||||
{
|
||||
ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance());
|
||||
|
||||
if (this.instanceDataDocument != null)
|
||||
{
|
||||
this.mimeType = MimetypeMap.MIMETYPE_XML; // belts & braces - override mimetype (in case is not set to XML)
|
||||
}
|
||||
|
||||
// TODO: show first few lines of content here?
|
||||
return buildSummary(
|
||||
new String[] {bundle.getString("file_name"),
|
||||
@@ -313,81 +245,6 @@ public class CreateContentWizard extends BaseContentWizard
|
||||
getSummaryMimeType(this.mimeType)});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return List of UI items to represent the full list of available ECM Forms
|
||||
*/
|
||||
public List<SelectItem> getFormsList()
|
||||
{
|
||||
Collection<Form> forms = this.getFormsService().getForms();
|
||||
List<SelectItem> items = new ArrayList<SelectItem>(forms.size()+1);
|
||||
items.add(new SelectItem("", ""));
|
||||
for (Form form : forms)
|
||||
{
|
||||
items.add(new SelectItem(form.getName(), form.getTitle()));
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
public String getFormName()
|
||||
{
|
||||
return this.formName;
|
||||
}
|
||||
|
||||
public void setFormName(String formName)
|
||||
{
|
||||
this.formName = formName;
|
||||
}
|
||||
|
||||
public Form getForm() throws FormNotFoundException
|
||||
{
|
||||
return (this.getFormName() != null
|
||||
? getFormsService().getForm(formName)
|
||||
: null);
|
||||
}
|
||||
|
||||
public FormProcessor.Session getFormProcessorSession()
|
||||
{
|
||||
return this.formProcessorSession;
|
||||
}
|
||||
|
||||
public void setFormProcessorSession(final FormProcessor.Session formProcessorSession)
|
||||
{
|
||||
this.formProcessorSession = formProcessorSession;
|
||||
}
|
||||
|
||||
public Document getInstanceDataDocument()
|
||||
{
|
||||
if (this.instanceDataDocument == null)
|
||||
{
|
||||
final String content = this.getContent();
|
||||
try
|
||||
{
|
||||
this.instanceDataDocument = (content != null
|
||||
? XMLUtil.parse(content)
|
||||
: XMLUtil.newDocument());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Utils.addErrorMessage("error parsing document", e);
|
||||
this.instanceDataDocument = XMLUtil.newDocument();
|
||||
}
|
||||
}
|
||||
return this.instanceDataDocument;
|
||||
}
|
||||
|
||||
/** Overrides in order to strip an xml extension if the user entered it */
|
||||
// TODO do we need ? it is currently referenced in create-forms.jsp (copied from wcm create-xml.jsp)
|
||||
@Override
|
||||
public String getFileName()
|
||||
{
|
||||
final String result = super.getFileName();
|
||||
return (result != null &&
|
||||
MimetypeMap.MIMETYPE_XML.equals(this.mimeType) &&
|
||||
this.getFormName() != null &&
|
||||
"xml".equals(FilenameUtils.getExtension(result).toLowerCase())
|
||||
? FilenameUtils.removeExtension(result)
|
||||
: result);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Action event handlers
|
||||
|
@@ -28,9 +28,6 @@ import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.forms.Form;
|
||||
import org.alfresco.web.forms.FormNotFoundException;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
|
||||
/**
|
||||
* Bean implementation for the "Edit Content Wizard" dialog
|
||||
@@ -40,7 +37,6 @@ public class EditContentWizard extends CreateContentWizard
|
||||
private static final long serialVersionUID = 1640754719164511019L;
|
||||
|
||||
private NodeRef nodeRef;
|
||||
private Form form;
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Wizard implementation
|
||||
@@ -48,7 +44,6 @@ public class EditContentWizard extends CreateContentWizard
|
||||
@Override
|
||||
public void init(final Map<String, String> parameters)
|
||||
{
|
||||
// TODO - currently assumes this is form content
|
||||
super.init(parameters);
|
||||
Node node = this.navigator.getDispatchContextNode();
|
||||
if (node == null)
|
||||
@@ -56,17 +51,6 @@ public class EditContentWizard extends CreateContentWizard
|
||||
throw new IllegalArgumentException("Edit Form wizard requires action node context.");
|
||||
}
|
||||
this.nodeRef = node.getNodeRef();
|
||||
try
|
||||
{
|
||||
// // WCM
|
||||
// formName = (String)getNodeService().getProperty(nodeRef, WCMAppModel.PROP_PARENT_FORM_NAME); // getFormName() ...
|
||||
form = formsService.getForm(this.formName);
|
||||
}
|
||||
catch (FormNotFoundException fnfe)
|
||||
{
|
||||
Utils.addErrorMessage(fnfe.getMessage(), fnfe);
|
||||
throw new IllegalArgumentException(fnfe);
|
||||
}
|
||||
|
||||
this.content = this.getContentService().getReader(nodeRef, ContentModel.PROP_CONTENT).getContentString();
|
||||
|
||||
@@ -92,10 +76,4 @@ public class EditContentWizard extends CreateContentWizard
|
||||
{
|
||||
return outcome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Form getForm()
|
||||
{
|
||||
return this.form;
|
||||
}
|
||||
}
|
||||
|
@@ -84,7 +84,6 @@ public class StartWorkflowWizard extends BaseWizardBean
|
||||
transient protected List<SelectItem> availableWorkflows;
|
||||
transient private Map<String, WorkflowDefinition> workflows;
|
||||
|
||||
protected List<String> wcmWorkflows;
|
||||
protected List<String> excludedWorkflows;
|
||||
protected List<String> invitationWorkflows;
|
||||
protected List<String> publishingWorkflows;
|
||||
@@ -570,9 +569,6 @@ public class StartWorkflowWizard extends BaseWizardBean
|
||||
this.availableWorkflows = new ArrayList<SelectItem>(4);
|
||||
this.workflows = new HashMap<String, WorkflowDefinition>(4);
|
||||
|
||||
// get the list of configured WCM workflows and filter these from
|
||||
// the list as these workflows are specific to WCM functionality and AVM stores
|
||||
List<String> configuredWcmWorkflows = this.getWCMWorkflowNames();
|
||||
List<String> configuredInvitationWorkflows = this.getInvitationServiceWorkflowNames();
|
||||
List<String> publishingWorkflows = this.getPublishingWorkflowNames();
|
||||
List<String> excludedWorkflows = this.getExcludedWorkflows();
|
||||
@@ -582,8 +578,7 @@ public class StartWorkflowWizard extends BaseWizardBean
|
||||
{
|
||||
String name = workflowDef.name;
|
||||
|
||||
if (configuredWcmWorkflows.contains(name) == false &&
|
||||
configuredInvitationWorkflows.contains(name) == false &&
|
||||
if (configuredInvitationWorkflows.contains(name) == false &&
|
||||
publishingWorkflows.contains(name) == false &&
|
||||
excludedWorkflows.contains(name) == false)
|
||||
{
|
||||
@@ -736,63 +731,6 @@ public class StartWorkflowWizard extends BaseWizardBean
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Names of the WCM workflows.
|
||||
*
|
||||
* @return The names of the WCM workflows.
|
||||
*/
|
||||
protected List<String> getWCMWorkflowNames()
|
||||
{
|
||||
if ((wcmWorkflows == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance())))
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
ConfigElement config = Application.getConfigService(fc).getGlobalConfig().getConfigElement("wcm");
|
||||
if (config != null)
|
||||
{
|
||||
// get the main WCM workflows
|
||||
ConfigElement workflowConfig = config.getChild("workflows");
|
||||
if (workflowConfig != null)
|
||||
{
|
||||
StringTokenizer t = new StringTokenizer(workflowConfig.getValue().trim(), ", ");
|
||||
wcmWorkflows = new ArrayList<String>(t.countTokens());
|
||||
while (t.hasMoreTokens())
|
||||
{
|
||||
String wfName = "jbpm$" + t.nextToken();
|
||||
wcmWorkflows.add(wfName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logger.isWarnEnabled())
|
||||
logger.warn("WARNING: Unable to find WCM 'workflows' config element definition.");
|
||||
}
|
||||
|
||||
// get the admin WCM workflows
|
||||
ConfigElement adminWorkflowConfig = config.getChild("admin-workflows");
|
||||
if (adminWorkflowConfig != null)
|
||||
{
|
||||
StringTokenizer t = new StringTokenizer(adminWorkflowConfig.getValue().trim(), ", ");
|
||||
while (t.hasMoreTokens())
|
||||
{
|
||||
String wfName = "jbpm$" + t.nextToken();
|
||||
wcmWorkflows.add(wfName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logger.isWarnEnabled())
|
||||
logger.warn("WARNING: Unable to find WCM 'admin-workflows' config element definition.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.warn("WARNING: Unable to find 'wcm' config element definition.");
|
||||
}
|
||||
}
|
||||
|
||||
return wcmWorkflows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Names of globally excluded workflow-names.
|
||||
*
|
||||
|
@@ -22,7 +22,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.ExpiringValueCache;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.extensions.config.ConfigElement;
|
||||
@@ -61,8 +60,6 @@ public class ClientConfigElement extends ConfigElementAdapter
|
||||
private String homeSpacePermission = null;
|
||||
private boolean nodeSummaryEnabled = true;
|
||||
private String initialLocation = "myalfresco";
|
||||
private ExpiringValueCache<String> wcmDomain = new ExpiringValueCache<String>(1000*10L);
|
||||
private ExpiringValueCache<String> wcmPort = new ExpiringValueCache<String>(1000*10L);
|
||||
private String defaultHomeSpacePath = "/app:company_home/app:user_homes";
|
||||
private boolean clipboardStatusVisible = true;
|
||||
private boolean pasteAllAndClear = true;
|
||||
@@ -664,56 +661,6 @@ public class ClientConfigElement extends ConfigElementAdapter
|
||||
this.initialLocation = initialLocation;
|
||||
}
|
||||
|
||||
// // WCM
|
||||
// /**
|
||||
// * @return Returns the WCM Domain obtained from the Virtualisation Server registry.
|
||||
// */
|
||||
// public String getWCMDomain()
|
||||
// {
|
||||
// String value = this.wcmDomain.get();
|
||||
// if (value == null)
|
||||
// {
|
||||
// VirtServerRegistry vServerRegistry = Repository.getServiceRegistry(
|
||||
// FacesContext.getCurrentInstance()).getVirtServerRegistry();
|
||||
// value = vServerRegistry.getVirtServerFQDN();
|
||||
// if (value == null)
|
||||
// {
|
||||
// value = JNDIConstants.DEFAULT_VSERVER_IP;
|
||||
// if (logger.isDebugEnabled())
|
||||
// {
|
||||
// logger.debug("Virtualisation Server not started - reverting to default IP: " + value);
|
||||
// }
|
||||
// }
|
||||
// this.wcmDomain.put(value);
|
||||
// }
|
||||
// return value;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return Returns the WCM Port obtained from the Virtualisation Server registry.
|
||||
// */
|
||||
// public String getWCMPort()
|
||||
// {
|
||||
// String value = this.wcmPort.get();
|
||||
// if (value == null)
|
||||
// {
|
||||
// VirtServerRegistry vServerRegistry = Repository.getServiceRegistry(
|
||||
// FacesContext.getCurrentInstance()).getVirtServerRegistry();
|
||||
// Integer iValue = vServerRegistry.getVirtServerHttpPort();
|
||||
// if (iValue == null)
|
||||
// {
|
||||
// iValue = JNDIConstants.DEFAULT_VSERVER_PORT;
|
||||
// if (logger.isDebugEnabled())
|
||||
// {
|
||||
// logger.debug("Virtualisation Server not started - reverting to default port: " + iValue);
|
||||
// }
|
||||
// }
|
||||
// value = iValue.toString();
|
||||
// this.wcmPort.put(value);
|
||||
// }
|
||||
// return value;
|
||||
// }
|
||||
//
|
||||
/*package*/ void setAllowGuestConfig(boolean allow)
|
||||
{
|
||||
this.allowGuestConfig = allow;
|
||||
|
@@ -1,116 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package org.alfresco.web.forms;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Encapsulation of a form.
|
||||
*
|
||||
* @author Ariel Backenroth
|
||||
*/
|
||||
public interface Form
|
||||
extends Serializable
|
||||
{
|
||||
|
||||
/** the name of the form, which must be unique within the FormsService */
|
||||
public String getName();
|
||||
|
||||
/** the title of the form */
|
||||
public String getTitle();
|
||||
|
||||
/** the description of the form */
|
||||
public String getDescription();
|
||||
|
||||
/** the root tag to use within the schema */
|
||||
public String getSchemaRootElementName();
|
||||
|
||||
/** the output path pattern for form instance data */
|
||||
public String getOutputPathPattern();
|
||||
|
||||
/**
|
||||
* @return the default workflow associated with this form or <tt>null</tt>
|
||||
* if none is configured.
|
||||
*/
|
||||
public WorkflowDefinition getDefaultWorkflow();
|
||||
|
||||
/**
|
||||
* @return the parameters for the default workflow or <tt>null</tt>
|
||||
* if none were configured.
|
||||
*/
|
||||
public Map<QName, Serializable> getDefaultWorkflowParameters();
|
||||
|
||||
/** the xml schema for this template type */
|
||||
public Document getSchema()
|
||||
throws IOException, SAXException;
|
||||
|
||||
/**
|
||||
* provides the output path for the form instance data based on the
|
||||
* configured output path pattern.
|
||||
*
|
||||
* @param formInstanceData the parsed xml content
|
||||
* @param formInstanceDataFileName the file name provided by the user.
|
||||
* @param parentAVMPath the parent avm path
|
||||
* @param webappName the current webapp name
|
||||
*
|
||||
* @return the path to use for writing the form instance data.
|
||||
*/
|
||||
public String getOutputPathForFormInstanceData(final Document formInstanceData,
|
||||
final String formInstanceDataFileName,
|
||||
final String parentAVMPath,
|
||||
final String webappName);
|
||||
|
||||
//XXXarielb not used currently and not sure if it's necessary...
|
||||
// public void addInputMethod(final TemplateInputMethod in);
|
||||
|
||||
/**
|
||||
* Provides a set of input methods for this template.
|
||||
*/
|
||||
public List<FormProcessor> getFormProcessors();
|
||||
|
||||
/**
|
||||
* adds an output method to this template type.
|
||||
*/
|
||||
public void addRenderingEngineTemplate(RenderingEngineTemplate output);
|
||||
|
||||
/**
|
||||
* Provides the set of output methods for this template.
|
||||
*/
|
||||
public List<RenderingEngineTemplate> getRenderingEngineTemplates();
|
||||
|
||||
/**
|
||||
* Provides the rendering engine template by name.
|
||||
*
|
||||
* @param name the name of the rendering engine template.
|
||||
* @return the rendering engine template or <tt>null</tt> if not found.
|
||||
*/
|
||||
public RenderingEngineTemplate getRenderingEngineTemplate(final String name);
|
||||
|
||||
/**
|
||||
* @return true if WCM Form, false if ECM form
|
||||
*/
|
||||
public boolean isWebForm();
|
||||
}
|
@@ -1,253 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package org.alfresco.web.forms;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Common implementation of functions called in the context of FormDataRenderers.
|
||||
* This uses AVMRemote rather than AVMService so that in can be used in the context
|
||||
* of both the alfresco webapp and the virtualization server.
|
||||
*
|
||||
* @author Ariel Backenroth
|
||||
* @author Arseny Kovalchuk (Fix for the ETWOONE-241 and ETWOTWO-504 issues)
|
||||
*/
|
||||
public class FormDataFunctions
|
||||
{
|
||||
private static final Log LOGGER = LogFactory.getLog(FormDataFunctions.class);
|
||||
|
||||
// // WCM
|
||||
// private final AVMRemote avmRemote;
|
||||
//
|
||||
private ThreadLocal<DocumentBuilderFactory> dbf = new ThreadLocal<DocumentBuilderFactory>();
|
||||
|
||||
public FormDataFunctions(/*final AVMRemote avmRemote*/)
|
||||
{
|
||||
// this.avmRemote = avmRemote;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads and parses an xml document at the specified path using avm remote.
|
||||
*
|
||||
* @param avmPath a path within the avm repository.
|
||||
* @return the parsed document.
|
||||
*/
|
||||
public Document parseXMLDocument(final String avmPath)
|
||||
throws IOException,
|
||||
SAXException
|
||||
{
|
||||
// // WCM
|
||||
// final InputStream istream = this.avmRemote.getFileInputStream(-1, avmPath);
|
||||
// try
|
||||
// {
|
||||
// return parseXML(istream);
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// istream.close();
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads and parses all xml documents at the specified path generated by the
|
||||
* specified form using avm remote.
|
||||
*
|
||||
* @param formName a form name
|
||||
* @param avmPath a path within the avm repository.
|
||||
* @return the parsed document.
|
||||
*/
|
||||
public Map<String, Document> parseXMLDocuments(final String formName, final String avmPath)
|
||||
throws IOException,
|
||||
SAXException
|
||||
{
|
||||
// // WCM
|
||||
// final Map<String, AVMNodeDescriptor> entries =
|
||||
// this.avmRemote.getDirectoryListing(-1, avmPath);
|
||||
// final Map<String, Document> result = new HashMap<String, Document>();
|
||||
// for (Map.Entry<String, AVMNodeDescriptor> entry : entries.entrySet())
|
||||
// {
|
||||
// final String entryName = entry.getKey();
|
||||
// AVMNodeDescriptor entryNode = entry.getValue();
|
||||
// if (entryNode.isFile())
|
||||
// {
|
||||
// PropertyValue pv =
|
||||
// this.avmRemote.getNodeProperty(-1,
|
||||
// avmPath + '/' + entryName,
|
||||
// WCMAppModel.PROP_PARENT_FORM_NAME);
|
||||
// if (pv == null ||
|
||||
// pv.getStringValue() == null ||
|
||||
// !((String)pv.getStringValue()).equals(formName))
|
||||
// {
|
||||
// // it's not generated by the same template type
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// pv = this.avmRemote.getNodeProperty(-1,
|
||||
// avmPath + '/' + entryName,
|
||||
// WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE);
|
||||
//
|
||||
// if (pv != null)
|
||||
// {
|
||||
// // it's generated by a rendering engine (it's not the xml file)
|
||||
// continue;
|
||||
// }
|
||||
// final InputStream istream = this.avmRemote.getFileInputStream(-1, avmPath + '/' + entryName);
|
||||
// try
|
||||
// {
|
||||
// // result.put(entryName, XMLUtil.parse(istream));
|
||||
// result.put(entryName, parseXML(istream));
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// istream.close();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return result;
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* We need an internal method for XML parsing with ThreadLocal DocumentBuilderFactory
|
||||
* to avoid a multithread access to the parser in XMLUtils.
|
||||
* Fix of the bug reported in https://issues.alfresco.com/jira/browse/ETWOONE-241 reported.
|
||||
*/
|
||||
private Document parseXML(InputStream is) throws IOException, SAXException
|
||||
{
|
||||
Document result = null;
|
||||
try
|
||||
{
|
||||
DocumentBuilderFactory localDbf = dbf.get();
|
||||
if (localDbf == null)
|
||||
{
|
||||
localDbf = DocumentBuilderFactory.newInstance();
|
||||
}
|
||||
localDbf.setNamespaceAware(true);
|
||||
localDbf.setValidating(false);
|
||||
dbf.set(localDbf);
|
||||
DocumentBuilder builder = localDbf.newDocumentBuilder();
|
||||
result = builder.parse(is);
|
||||
}
|
||||
catch (ParserConfigurationException pce)
|
||||
{
|
||||
LOGGER.error(pce);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Encodes invalid HTML characters. (Fix for ETWOTWO-504 issue)
|
||||
* This code was adopted from WebDAVHelper.encodeHTML() method with some restrictions.
|
||||
* @see press-relese.xsl for pattern.
|
||||
*
|
||||
* @param text to encode
|
||||
* @return encoded text
|
||||
* @throws IOException
|
||||
* @throws SAXException
|
||||
*/
|
||||
public String encodeQuotes(String text) throws IOException, SAXException
|
||||
{
|
||||
if (text == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
StringBuilder sb = null; //create on demand
|
||||
String enc;
|
||||
char c;
|
||||
for (int i = 0; i < text.length(); i++)
|
||||
{
|
||||
enc = null;
|
||||
c = text.charAt(i);
|
||||
switch (c)
|
||||
{
|
||||
case '"': enc = """; break; //"
|
||||
//case '&': enc = "&"; break; //&
|
||||
//case '<': enc = "<"; break; //<
|
||||
//case '>': enc = ">"; break; //>
|
||||
|
||||
//german umlauts
|
||||
case '\u00E4' : enc = "ä"; break;
|
||||
case '\u00C4' : enc = "Ä"; break;
|
||||
case '\u00F6' : enc = "ö"; break;
|
||||
case '\u00D6' : enc = "Ö"; break;
|
||||
case '\u00FC' : enc = "ü"; break;
|
||||
case '\u00DC' : enc = "Ü"; break;
|
||||
case '\u00DF' : enc = "ß"; break;
|
||||
|
||||
//misc
|
||||
//case 0x80: enc = "€"; break; sometimes euro symbol is ascii 128, should we suport it?
|
||||
case '\u20AC': enc = "€"; break;
|
||||
case '\u00AB': enc = "«"; break;
|
||||
case '\u00BB': enc = "»"; break;
|
||||
case '\u00A0': enc = " "; break;
|
||||
|
||||
//case '': enc = "&trade"; break;
|
||||
|
||||
default:
|
||||
if (((int)c) >= 0x80)
|
||||
{
|
||||
//encode all non basic latin characters
|
||||
enc = "&#" + ((int)c) + ";";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (enc != null)
|
||||
{
|
||||
if (sb == null)
|
||||
{
|
||||
String soFar = text.substring(0, i);
|
||||
sb = new StringBuilder(i + 8);
|
||||
sb.append(soFar);
|
||||
}
|
||||
sb.append(enc);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sb != null)
|
||||
{
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sb == null)
|
||||
{
|
||||
return text;
|
||||
}
|
||||
else
|
||||
{
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,134 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.web.forms;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Encapsulation of form instance data.
|
||||
*
|
||||
* @author Ariel Backenroth
|
||||
*/
|
||||
public interface FormInstanceData
|
||||
extends Serializable
|
||||
{
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static class RegenerateResult implements Serializable
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = -3827878774655260635L;
|
||||
|
||||
private final RenderingEngineTemplate ret;
|
||||
private final String path;
|
||||
private final Rendition r;
|
||||
private final Exception e;
|
||||
private final String lockOwner; // existing lock owner otherwise null
|
||||
|
||||
public RegenerateResult(final RenderingEngineTemplate ret,
|
||||
final String path,
|
||||
final Rendition r,
|
||||
final String lockOwner)
|
||||
{
|
||||
this.ret = ret;
|
||||
this.r = r;
|
||||
this.e = null;
|
||||
this.path = path;
|
||||
this.lockOwner = lockOwner;
|
||||
}
|
||||
|
||||
public RegenerateResult(final RenderingEngineTemplate ret,
|
||||
final String path,
|
||||
final Exception e,
|
||||
final String lockOwner)
|
||||
{
|
||||
this.ret = ret;
|
||||
this.e = e;
|
||||
this.r = null;
|
||||
this.path = path;
|
||||
this.lockOwner = lockOwner;
|
||||
}
|
||||
|
||||
public RenderingEngineTemplate getRenderingEngineTemplate()
|
||||
{
|
||||
return this.ret;
|
||||
}
|
||||
|
||||
public String getPath()
|
||||
{
|
||||
return this.path;
|
||||
}
|
||||
|
||||
public Rendition getRendition()
|
||||
{
|
||||
return this.r;
|
||||
}
|
||||
|
||||
public Exception getException()
|
||||
{
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public String getLockOwner()
|
||||
{
|
||||
return this.lockOwner;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/** the form generate this form instance data */
|
||||
public Form getForm()
|
||||
throws FormNotFoundException;
|
||||
|
||||
/** the name of this instance data */
|
||||
public String getName();
|
||||
|
||||
/** the path relative to the containing webapp */
|
||||
public String getWebappRelativePath();
|
||||
|
||||
/** the path relative to the sandbox */
|
||||
public String getSandboxRelativePath();
|
||||
|
||||
/** the path to the contents of this form instance data */
|
||||
public String getPath();
|
||||
|
||||
/** the url to the asset */
|
||||
public String getUrl();
|
||||
|
||||
/** returns the parsed form instance data */
|
||||
public Document getDocument()
|
||||
throws IOException, SAXException;
|
||||
|
||||
/** Regenerates all renditions of this form instance data */
|
||||
public List<RegenerateResult> regenerateRenditions()
|
||||
throws FormNotFoundException;
|
||||
|
||||
/** returns all renditions of this form instance data */
|
||||
public List<Rendition> getRenditions();
|
||||
|
||||
/** returns all renditions of this form instance data (include deleted AVM nodes) */
|
||||
public List<Rendition> getRenditions(boolean includeDeleted);
|
||||
}
|
@@ -1,488 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.web.forms;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.util.XMLUtil;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Encapsulation of a rendition.
|
||||
*
|
||||
* @author Ariel Backenroth
|
||||
*/
|
||||
/* package */ class FormInstanceDataImpl implements FormInstanceData
|
||||
{
|
||||
private static final long serialVersionUID = -7806221587661854013L;
|
||||
|
||||
private static final Log logger = LogFactory.getLog(RenditionImpl.class);
|
||||
|
||||
private final NodeRef nodeRef;
|
||||
// // WCM
|
||||
// private final WebProject webProject;
|
||||
private transient FormsService formsService;
|
||||
|
||||
/* package */ FormInstanceDataImpl(final NodeRef nodeRef,
|
||||
final FormsService formsService)
|
||||
{
|
||||
this.nodeRef = null;
|
||||
// // WCM
|
||||
// this(nodeRef, formsService, null);
|
||||
}
|
||||
|
||||
// // WCM
|
||||
// /* package */ FormInstanceDataImpl(final NodeRef nodeRef,
|
||||
// final FormsService formsService,
|
||||
// final WebProject webProject)
|
||||
// {
|
||||
// this.webProject = webProject;
|
||||
//
|
||||
// if (nodeRef == null)
|
||||
// {
|
||||
// throw new NullPointerException();
|
||||
// }
|
||||
// if (formsService == null)
|
||||
// {
|
||||
// throw new NullPointerException();
|
||||
// }
|
||||
// final AVMService avmService = this.getServiceRegistry().getAVMService();
|
||||
//
|
||||
// Pair<Integer, String> avmVersionPath = AVMNodeConverter.ToAVMVersionPath(nodeRef);
|
||||
//
|
||||
// if (avmService.lookup(avmVersionPath.getFirst(), avmVersionPath.getSecond()) == null)
|
||||
// {
|
||||
// throw new IllegalArgumentException("Not found: " + avmVersionPath.getSecond());
|
||||
// }
|
||||
//
|
||||
// if (!avmService.hasAspect(avmVersionPath.getFirst(), avmVersionPath.getSecond(),
|
||||
// WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
|
||||
// {
|
||||
// throw new IllegalArgumentException("node " + nodeRef +
|
||||
// " does not have aspect " + WCMAppModel.ASPECT_FORM_INSTANCE_DATA);
|
||||
// }
|
||||
// this.nodeRef = nodeRef;
|
||||
// this.formsService = formsService;
|
||||
// }
|
||||
//
|
||||
// /* package */ FormInstanceDataImpl(final int version,
|
||||
// final String avmPath,
|
||||
// final FormsService formsService)
|
||||
// {
|
||||
// this(AVMNodeConverter.ToNodeRef(version, avmPath), formsService);
|
||||
// }
|
||||
//
|
||||
private FormsService getFormsService()
|
||||
{
|
||||
if (formsService == null)
|
||||
{
|
||||
formsService = (FormsService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService");
|
||||
}
|
||||
return formsService;
|
||||
}
|
||||
|
||||
/** the name of this rendition */
|
||||
public String getName()
|
||||
{
|
||||
// final AVMService avmService = this.getServiceRegistry().getAVMService();
|
||||
// return avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(),
|
||||
// AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(),
|
||||
// ContentModel.PROP_NAME).getStringValue();
|
||||
// // WCM
|
||||
// return AVMNodeConverter.SplitBase(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond())[1];
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getWebappRelativePath()
|
||||
{
|
||||
// // WCM
|
||||
// return AVMUtil.getWebappRelativePath(this.getPath());
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getSandboxRelativePath()
|
||||
{
|
||||
// // WCM
|
||||
// return AVMUtil.getSandboxRelativePath(this.getPath());
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getPath()
|
||||
{
|
||||
// // WCM
|
||||
// return AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond();
|
||||
return null;
|
||||
}
|
||||
|
||||
public Document getDocument()
|
||||
throws IOException, SAXException
|
||||
{
|
||||
// // WCM
|
||||
// return XMLUtil.parse(AVMNodeConverter.ToAVMVersionPath(nodeRef).getFirst(),
|
||||
// AVMNodeConverter.ToAVMVersionPath(nodeRef).getSecond(),
|
||||
// this.getServiceRegistry().getAVMService());
|
||||
return null;
|
||||
}
|
||||
|
||||
public Form getForm()
|
||||
throws FormNotFoundException
|
||||
{
|
||||
final String parentFormName = this.getParentFormName();
|
||||
try
|
||||
{
|
||||
// // WCM
|
||||
// // TODO - forms should be identified by nodeRef rather than name (which can be non-unique)
|
||||
// if (getNodeRef().getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM))
|
||||
// {
|
||||
// if (webProject != null)
|
||||
// {
|
||||
// return webProject.getForm(parentFormName);
|
||||
// }
|
||||
//
|
||||
return this.getFormsService().getWebForm(parentFormName);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return this.getFormsService().getForm(parentFormName);
|
||||
// }
|
||||
}
|
||||
catch (FormNotFoundException fnfe)
|
||||
{
|
||||
// // WCM
|
||||
// if (webProject != null)
|
||||
// {
|
||||
// throw new FormNotFoundException(parentFormName, webProject, this);
|
||||
// }
|
||||
//
|
||||
throw new FormNotFoundException(parentFormName, this);
|
||||
}
|
||||
}
|
||||
|
||||
/** the node ref containing the contents of this rendition */
|
||||
public NodeRef getNodeRef()
|
||||
{
|
||||
return this.nodeRef;
|
||||
}
|
||||
|
||||
public String getUrl()
|
||||
{
|
||||
// // WCM
|
||||
// return AVMUtil.getPreviewURI(this.getPath());
|
||||
return "";
|
||||
}
|
||||
|
||||
public List<FormInstanceData.RegenerateResult> regenerateRenditions()
|
||||
throws FormNotFoundException
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("regenerating renditions of " + this);
|
||||
}
|
||||
|
||||
// // WCM
|
||||
// AVMLockingService avmLockService = this.getServiceRegistry().getAVMLockingService();
|
||||
// final AVMService avmService = this.getServiceRegistry().getAVMService();
|
||||
// PropertyValue pv = avmService.getNodeProperty(
|
||||
// AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(),
|
||||
// AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(),
|
||||
// WCMAppModel.PROP_ORIGINAL_PARENT_PATH);
|
||||
//
|
||||
// String originalParentAvmPath = (pv == null) ?
|
||||
// AVMNodeConverter.SplitBase(this.getPath())[0] : pv.getStringValue();
|
||||
//
|
||||
// final HashSet<RenderingEngineTemplate> allRets =
|
||||
// new HashSet<RenderingEngineTemplate>(this.getForm().getRenderingEngineTemplates());
|
||||
final List<RegenerateResult> result = new LinkedList<RegenerateResult>();
|
||||
// // WCM
|
||||
// // regenerate existing renditions
|
||||
// String path = null;
|
||||
//
|
||||
// for (final Rendition r : this.getRenditions())
|
||||
// {
|
||||
// // Try to skip renditions without rendering engine template.
|
||||
// if (r instanceof RenditionImpl)
|
||||
// {
|
||||
// RenditionImpl rImpl = (RenditionImpl)r;
|
||||
// RenderingEngineTemplate ret = rImpl.getRenderingEngineTemplate();
|
||||
// if ((ret != null) && (ret instanceof RenderingEngineTemplateImpl))
|
||||
// {
|
||||
// RenderingEngineTemplateImpl retImpl = (RenderingEngineTemplateImpl) ret;
|
||||
// if (!retImpl.isExists())
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// final RenderingEngineTemplate ret = r.getRenderingEngineTemplate();
|
||||
// if (ret == null || !allRets.contains(ret))
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// String lockOwner = null;
|
||||
// try
|
||||
// {
|
||||
// if (logger.isDebugEnabled())
|
||||
// {
|
||||
// logger.debug("regenerating rendition " + r + " using template " + ret);
|
||||
// }
|
||||
//
|
||||
// path = r.getPath();
|
||||
// lockOwner = avmLockService.getLockOwner(AVMUtil.getStoreId(path), AVMUtil.getStoreRelativePath(path));
|
||||
// if (lockOwner != null)
|
||||
// {
|
||||
// if (logger.isDebugEnabled())
|
||||
// {
|
||||
// logger.debug("Lock already exists for " + path);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// ret.render(this, r);
|
||||
// allRets.remove(ret);
|
||||
// result.add(new RegenerateResult(ret, path, r, lockOwner));
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// result.add(new RegenerateResult(ret, path, e, lockOwner));
|
||||
//
|
||||
// // remove lock if there wasn't one before
|
||||
// if (lockOwner == null)
|
||||
// {
|
||||
// avmLockService.removeLock(AVMUtil.getStoreId(path), AVMUtil.getStoreRelativePath(path));
|
||||
//
|
||||
// if (logger.isDebugEnabled())
|
||||
// {
|
||||
// logger.debug("Removed lock for " + path + " as it failed to generate");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // get current username for lock checks
|
||||
// String username = Application.getCurrentUser(FacesContext.getCurrentInstance()).getUserName();
|
||||
//
|
||||
// // render all renditions for newly added templates
|
||||
// for (final RenderingEngineTemplate ret : allRets)
|
||||
// {
|
||||
// String lockOwner = null;
|
||||
// String currentLockStore = null;
|
||||
// boolean lockModified = false;
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// path = ret.getOutputPathForRendition(this, originalParentAvmPath, getName().replaceAll("(.+)\\..*", "$1"));
|
||||
//
|
||||
// if (logger.isDebugEnabled())
|
||||
// {
|
||||
// logger.debug("regenerating rendition of " + this.getPath() +
|
||||
// " at " + path + " using template " + ret);
|
||||
// }
|
||||
//
|
||||
// String storeId = AVMUtil.getStoreId(path);
|
||||
// String storePath = AVMUtil.getStoreRelativePath(path);
|
||||
// String storeName = AVMUtil.getStoreName(path);
|
||||
//
|
||||
// Map<String, String> lockData = avmLockService.getLockData(storeId, storePath);
|
||||
// if (lockData != null)
|
||||
// {
|
||||
// lockOwner = avmLockService.getLockOwner(storeId, storePath);
|
||||
// currentLockStore = lockData.get(WCMUtil.LOCK_KEY_STORE_NAME);
|
||||
// }
|
||||
//
|
||||
// if (lockOwner != null)
|
||||
// {
|
||||
// if (logger.isDebugEnabled())
|
||||
// {
|
||||
// logger.debug("Lock already exists for " + path);
|
||||
// }
|
||||
//
|
||||
// if (currentLockStore.equals(storeName) == false)
|
||||
// {
|
||||
// if (lockOwner.equals(username))
|
||||
// {
|
||||
// lockModified = true;
|
||||
//
|
||||
// // lock already exists on path, check it's owned by the current user
|
||||
// if (logger.isDebugEnabled())
|
||||
// {
|
||||
// logger.debug("transferring lock from " + currentLockStore + " to " + storeName + " for path: " + path);
|
||||
// }
|
||||
//
|
||||
// lockData.put(WCMUtil.LOCK_KEY_STORE_NAME, storeName);
|
||||
// avmLockService.modifyLock(storeId, storePath, lockOwner, storeId, storePath, lockData);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// result.add(new RegenerateResult(ret, path, ret.render(this, path), lockOwner));
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// result.add(new RegenerateResult(ret, path, e, lockOwner));
|
||||
//
|
||||
// String storeId = AVMUtil.getStoreId(path);
|
||||
// String storePath = AVMUtil.getStoreRelativePath(path);
|
||||
// String storeName = AVMUtil.getStoreName(path);
|
||||
//
|
||||
// if (lockOwner == null)
|
||||
// {
|
||||
// // remove lock if there wasn't one before
|
||||
// avmLockService.removeLock(storeId, storePath);
|
||||
//
|
||||
// if (logger.isDebugEnabled())
|
||||
// {
|
||||
// logger.debug("Removed lock for " + path + " as it failed to generate");
|
||||
// }
|
||||
// }
|
||||
// else if (lockModified)
|
||||
// {
|
||||
// if (logger.isDebugEnabled())
|
||||
// {
|
||||
// logger.debug("transferring lock from " + storeName + " to " + currentLockStore + " for path: " + path);
|
||||
// }
|
||||
//
|
||||
// Map<String, String> lockData = avmLockService.getLockData(storeId, storePath);
|
||||
// lockData.put(WCMUtil.LOCK_KEY_STORE_NAME, currentLockStore);
|
||||
// avmLockService.modifyLock(storeId, storePath, lockOwner, storeId, storePath, lockData);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<Rendition> getRenditions()
|
||||
{
|
||||
return getRenditions(false);
|
||||
}
|
||||
|
||||
public List<Rendition> getRenditions(boolean includeDeleted)
|
||||
{
|
||||
// // WCM
|
||||
// final AVMService avmService = this.getServiceRegistry().getAVMLockingAwareService();
|
||||
// final PropertyValue pv =
|
||||
// avmService.getNodeProperty(-1, this.getPath(), WCMAppModel.PROP_RENDITIONS);
|
||||
// final Collection<Serializable> renditionPaths = (pv == null
|
||||
// ? Collections.EMPTY_LIST
|
||||
// : pv.getCollection(DataTypeDefinition.TEXT));
|
||||
// final String storeName = AVMUtil.getStoreName(this.getPath());
|
||||
// final List<Rendition> result = new ArrayList<Rendition>(renditionPaths.size());
|
||||
// for (Serializable path : renditionPaths)
|
||||
// {
|
||||
// String avmRenditionPath = AVMUtil.buildAVMPath(storeName, (String)path);
|
||||
// if (avmService.lookup(-1, avmRenditionPath, includeDeleted) == null)
|
||||
// {
|
||||
// if (logger.isDebugEnabled())
|
||||
// {
|
||||
// logger.debug("ignoring dangling rendition at: " + avmRenditionPath);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// final Rendition r = new RenditionImpl(-1,
|
||||
// avmRenditionPath,
|
||||
// this.getFormsService());
|
||||
// try
|
||||
// {
|
||||
// if (!this.equals(r.getPrimaryFormInstanceData(includeDeleted)))
|
||||
// {
|
||||
// if (logger.isDebugEnabled())
|
||||
// {
|
||||
// logger.debug("rendition " + r +
|
||||
// " points at form instance data " + r.getPrimaryFormInstanceData(includeDeleted) +
|
||||
// " instead of " + this + ". Not including in renditions list.");
|
||||
// }
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
// catch (FileNotFoundException fnfe)
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
// if (r.getRenderingEngineTemplate() != null)
|
||||
// {
|
||||
// result.add(r);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return result;
|
||||
return null;
|
||||
}
|
||||
|
||||
private ServiceRegistry getServiceRegistry()
|
||||
{
|
||||
final FacesContext fc = FacesContext.getCurrentInstance();
|
||||
return Repository.getServiceRegistry(fc);
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
{
|
||||
return this.getPath().hashCode();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
try
|
||||
{
|
||||
return (this.getClass().getName() + "{path : " + this.getPath() +
|
||||
", form : " + this.getForm().getName() + "}");
|
||||
}
|
||||
catch (FormNotFoundException fnfe)
|
||||
{
|
||||
return (this.getClass().getName() + "{path : " + this.getPath() +
|
||||
", form : " + this.getParentFormName() + " NOT_FOUND! }");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public boolean equals(final Object other)
|
||||
{
|
||||
return (other instanceof FormInstanceDataImpl &&
|
||||
this.getNodeRef().equals(((FormInstanceDataImpl)other).getNodeRef()));
|
||||
|
||||
}
|
||||
|
||||
protected String getParentFormName()
|
||||
{
|
||||
// // WCM
|
||||
// final AVMService avmService = this.getServiceRegistry().getAVMService();
|
||||
// return avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(),
|
||||
// AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(),
|
||||
// WCMAppModel.PROP_PARENT_FORM_NAME).getStringValue();
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -1,118 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.web.forms;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.web.app.Application;
|
||||
|
||||
/**
|
||||
* Error when a form cannot be resolved.
|
||||
*
|
||||
* @author Ariel Backenroth
|
||||
*/
|
||||
public class FormNotFoundException
|
||||
extends FileNotFoundException
|
||||
{
|
||||
private final String formName;
|
||||
// private final WebProject webProject; // WCM
|
||||
private final FormInstanceData fid;
|
||||
|
||||
public FormNotFoundException(final String formName)
|
||||
{
|
||||
super(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
"form_not_found"),
|
||||
formName));
|
||||
this.formName = formName;
|
||||
// this.webProject = null; // WCM
|
||||
this.fid = null;
|
||||
}
|
||||
|
||||
public FormNotFoundException(final String formName, final FormInstanceData fid)
|
||||
{
|
||||
super(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
"form_not_found_for_form_instance_data"),
|
||||
formName,
|
||||
fid.getPath()));
|
||||
this.formName = formName;
|
||||
this.fid = fid;
|
||||
// this.webProject = null; // WCM
|
||||
}
|
||||
|
||||
// // WCM
|
||||
// public FormNotFoundException(final String formName, final WebProject webProject)
|
||||
// {
|
||||
// super(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
// "form_not_found_in_web_project"),
|
||||
// formName,
|
||||
// webProject.getName()));
|
||||
// this.formName = formName;
|
||||
// this.webProject = webProject;
|
||||
// this.fid = null;
|
||||
// }
|
||||
//
|
||||
// public FormNotFoundException(final String formName, final WebProject webProject, final FormInstanceData fid)
|
||||
// {
|
||||
// super(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
// "form_not_found_for_form_instance_data_in_web_project"),
|
||||
// formName,
|
||||
// webProject.getName(),
|
||||
// fid.getPath()));
|
||||
// this.formName = formName;
|
||||
// this.webProject = webProject;
|
||||
// this.fid = fid;
|
||||
// }
|
||||
//
|
||||
// public FormNotFoundException(final Form form, final WebProject webProject)
|
||||
// {
|
||||
// super(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
// "form_not_configured_for_web_project"),
|
||||
// form.getName(),
|
||||
// webProject.getName()));
|
||||
// this.formName = form.getName();
|
||||
// this.webProject = webProject;
|
||||
// this.fid = null;
|
||||
// }
|
||||
//
|
||||
// public FormNotFoundException(final Form form, final WebProject webProject, final FormInstanceData fid)
|
||||
// {
|
||||
// super(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
// "form_associated_with_form_instance_data_not_configured_for_web_project"),
|
||||
// form.getName(),
|
||||
// fid.getPath(),
|
||||
// webProject.getName()));
|
||||
// this.formName = form.getName();
|
||||
// this.webProject = webProject;
|
||||
// this.fid = fid;
|
||||
// }
|
||||
//
|
||||
public String getFormName()
|
||||
{
|
||||
return this.formName;
|
||||
}
|
||||
|
||||
// // WCM
|
||||
// public WebProject getWebProject()
|
||||
// {
|
||||
// return this.webProject;
|
||||
// }
|
||||
}
|
@@ -1,111 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.web.forms;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.Writer;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
/**
|
||||
* Generates a user interface for inputing data into a template.
|
||||
* @author Ariel Backenroth
|
||||
*/
|
||||
public interface FormProcessor
|
||||
extends Serializable
|
||||
{
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* An abstraction layer around the xml content which allows
|
||||
* for reseting the xml content being collected by the input method.
|
||||
*/
|
||||
public interface Session extends Serializable
|
||||
{
|
||||
|
||||
/** Returns the set of file uploaded during the session. */
|
||||
// public NodeRef[] getUploadedFiles();
|
||||
|
||||
/** Destroys the session and releases all resources used by it */
|
||||
public void destroy();
|
||||
|
||||
/** Returns the form used by the session. */
|
||||
public Form getForm();
|
||||
|
||||
/** Returns the current state of the form instance data */
|
||||
public Document getFormInstanceData();
|
||||
|
||||
/** Returns the name of the form instance data being modified */
|
||||
public String getFormInstanceDataName();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Exception for errors encoutered during form processing.
|
||||
*/
|
||||
public static class ProcessingException
|
||||
extends Exception
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = -1067792684180745503L;
|
||||
|
||||
public ProcessingException(final String msg)
|
||||
{
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public ProcessingException(final Exception cause)
|
||||
{
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public ProcessingException(final String msg, final Exception cause)
|
||||
{
|
||||
super(msg, cause);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Processes a user interface for inputing data into a form.
|
||||
*
|
||||
* @param formInstanceData provides the xml instance data if available.
|
||||
* @param formInstanceDataName the name of the form instance data being modified.
|
||||
* @param form the form to generate for
|
||||
* @param out the writer to write the output to.
|
||||
*/
|
||||
public Session process(final Document formInstanceData,
|
||||
final String formInstanceDataName,
|
||||
final Form form,
|
||||
final Writer out)
|
||||
throws ProcessingException;
|
||||
|
||||
/**
|
||||
* Processes a user interface for inputing data into a form.
|
||||
*
|
||||
* @param session the session to use.
|
||||
* @param out the writer to write the output to.
|
||||
*/
|
||||
public void process(final Session session,
|
||||
final Writer out)
|
||||
throws ProcessingException;
|
||||
}
|
@@ -1,434 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.web.forms;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.policy.PolicyComponent;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.search.ResultSet;
|
||||
import org.alfresco.service.cmr.search.ResultSetRow;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.data.IDataContainer;
|
||||
import org.alfresco.web.data.QuickSort;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Provides management of forms.
|
||||
*
|
||||
* @author Ariel Backenroth
|
||||
*/
|
||||
public final class FormsService
|
||||
{
|
||||
private static final Log LOGGER = LogFactory.getLog(FormsService.class);
|
||||
|
||||
private static final RenderingEngine[] RENDERING_ENGINES = new RenderingEngine[]
|
||||
{
|
||||
new FreeMarkerRenderingEngine(),
|
||||
new XSLTRenderingEngine(),
|
||||
new XSLFORenderingEngine()
|
||||
};
|
||||
|
||||
private final ContentService contentService;
|
||||
private final NodeService nodeService;
|
||||
private final NamespaceService namespaceService;
|
||||
private final SearchService searchService;
|
||||
|
||||
private NodeRef contentFormsNodeRef;
|
||||
private NodeRef webContentFormsNodeRef;
|
||||
|
||||
/** instantiated using spring */
|
||||
public FormsService(final ContentService contentService,
|
||||
final NodeService nodeService,
|
||||
final NamespaceService namespaceService,
|
||||
final SearchService searchService,
|
||||
final PolicyComponent policyComponent)
|
||||
{
|
||||
this.contentService = contentService;
|
||||
this.nodeService = nodeService;
|
||||
this.namespaceService = namespaceService;
|
||||
this.searchService = searchService;
|
||||
// // WCM
|
||||
// policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI, "onMoveNode"),
|
||||
// WCMAppModel.TYPE_FORMFOLDER,
|
||||
// new JavaBehaviour(this,
|
||||
// "handleMoveFormFolder",
|
||||
// Behaviour.NotificationFrequency.FIRST_EVENT));
|
||||
// policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI, "onDeleteNode"),
|
||||
// WCMAppModel.TYPE_FORMFOLDER,
|
||||
// new JavaBehaviour(this,
|
||||
// "handleDeleteFormFolder",
|
||||
// Behaviour.NotificationFrequency.FIRST_EVENT));
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides all registered rendering engines.
|
||||
*/
|
||||
public RenderingEngine[] getRenderingEngines()
|
||||
{
|
||||
return FormsService.RENDERING_ENGINES;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the rendering engine with the given name.
|
||||
*
|
||||
* @param name the name of the rendering engine.
|
||||
*
|
||||
* @return the rendering engine or <tt>null</tt> if not found.
|
||||
*/
|
||||
public RenderingEngine getRenderingEngine(final String name)
|
||||
{
|
||||
for (RenderingEngine re : this.getRenderingEngines())
|
||||
{
|
||||
if (re.getName().equals(name))
|
||||
{
|
||||
return re;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public RenderingEngine guessRenderingEngine(final String fileName)
|
||||
{
|
||||
for (RenderingEngine re : this.getRenderingEngines())
|
||||
{
|
||||
if (fileName.endsWith(re.getDefaultTemplateFileExtension()))
|
||||
{
|
||||
return re;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cached reference to the WCM Content Forms folder
|
||||
*/
|
||||
public NodeRef getContentFormsNodeRef()
|
||||
{
|
||||
if (this.contentFormsNodeRef == null)
|
||||
{
|
||||
final FacesContext fc = FacesContext.getCurrentInstance();
|
||||
final String xpath = (Application.getRootPath(fc) + "/" +
|
||||
Application.getGlossaryFolderName(fc) + "/" +
|
||||
Application.getContentFormsFolderName(fc));
|
||||
|
||||
this.contentFormsNodeRef = getNodeRefFromXPath(xpath);
|
||||
}
|
||||
return this.contentFormsNodeRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cached reference to the WCM Content Forms folder
|
||||
*/
|
||||
public NodeRef getWebContentFormsNodeRef()
|
||||
{
|
||||
if (this.webContentFormsNodeRef == null)
|
||||
{
|
||||
final FacesContext fc = FacesContext.getCurrentInstance();
|
||||
final String xpath = (Application.getRootPath(fc) + "/" +
|
||||
Application.getGlossaryFolderName(fc) + "/" +
|
||||
Application.getWebContentFormsFolderName(fc));
|
||||
|
||||
this.webContentFormsNodeRef = getNodeRefFromXPath(xpath);
|
||||
}
|
||||
return this.webContentFormsNodeRef;
|
||||
}
|
||||
|
||||
private NodeRef getNodeRefFromXPath(String xpath)
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("locating noderef at " + xpath);
|
||||
final List<NodeRef> results =
|
||||
searchService.selectNodes(this.nodeService.getRootNode(Repository.getStoreRef()),
|
||||
xpath,
|
||||
null,
|
||||
namespaceService,
|
||||
false);
|
||||
return (results != null && results.size() == 1 ? results.get(0) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns registered forms
|
||||
*
|
||||
* @return registered (ECM) forms
|
||||
*/
|
||||
public Collection<Form> getForms()
|
||||
{
|
||||
// // WCM
|
||||
// final String query =
|
||||
// "+ASPECT:\"" + WCMAppModel.ASPECT_FORM +
|
||||
// "\" +PARENT:\"" + this.getContentFormsNodeRef() + "\"";
|
||||
//
|
||||
// return getForms(query);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns registered web forms
|
||||
*
|
||||
* @return registered (WCM) forms
|
||||
*/
|
||||
public Collection<Form> getWebForms()
|
||||
{
|
||||
// // WCM
|
||||
// final String query =
|
||||
// "+ASPECT:\"" + WCMAppModel.ASPECT_FORM +
|
||||
// "\" +PARENT:\"" + this.getWebContentFormsNodeRef() + "\"";
|
||||
//
|
||||
// return getForms(query);
|
||||
return null;
|
||||
}
|
||||
|
||||
private Collection<Form> getForms(String query)
|
||||
{
|
||||
final ResultSet rs = this.searchService.query(Repository.getStoreRef(),
|
||||
SearchService.LANGUAGE_LUCENE,
|
||||
query);
|
||||
try
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("found " + rs.length() + " form definitions");
|
||||
final Collection<Form> result = new ArrayList<Form>(rs.length());
|
||||
for (final ResultSetRow row : rs)
|
||||
{
|
||||
result.add(this.getForm(row.getNodeRef()));
|
||||
}
|
||||
QuickSort sorter = new QuickSort((List)result, "name", true, IDataContainer.SORT_CASEINSENSITIVE);
|
||||
sorter.sort();
|
||||
|
||||
return result;
|
||||
}
|
||||
finally
|
||||
{
|
||||
rs.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return the form by name or <tt>null</tt> if not found
|
||||
*
|
||||
* @return the form by name or <tt>null</tt> if not found
|
||||
* @deprecated
|
||||
*/
|
||||
public Form getForm(final String name)
|
||||
throws FormNotFoundException
|
||||
{
|
||||
final NodeRef result = this.nodeService.getChildByName(this.getContentFormsNodeRef(),
|
||||
ContentModel.ASSOC_CONTAINS,
|
||||
name);
|
||||
if (result == null)
|
||||
{
|
||||
throw new FormNotFoundException(name);
|
||||
}
|
||||
return this.getForm(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* return the web form by name or <tt>null</tt> if not found
|
||||
*
|
||||
* @return the (WCM) form by name or <tt>null</tt> if not found
|
||||
* @deprecated
|
||||
*/
|
||||
public Form getWebForm(final String name)
|
||||
throws FormNotFoundException
|
||||
{
|
||||
final NodeRef result = this.nodeService.getChildByName(this.getWebContentFormsNodeRef(),
|
||||
ContentModel.ASSOC_CONTAINS,
|
||||
name);
|
||||
if (result == null)
|
||||
{
|
||||
throw new FormNotFoundException(name);
|
||||
}
|
||||
return this.getForm(result);
|
||||
}
|
||||
|
||||
// WCM
|
||||
/**
|
||||
* Returns the form backed by the given NodeRef. The NodeRef should
|
||||
* point to the schema for this form.
|
||||
*
|
||||
* @param nodeRef the node ref for the schema for the form
|
||||
* @return the form for the given node ref.
|
||||
*/
|
||||
public Form getForm(final NodeRef nodeRef)
|
||||
{
|
||||
// // WCM
|
||||
// if (!this.nodeService.hasAspect(nodeRef, WCMAppModel.ASPECT_FORM))
|
||||
// {
|
||||
// throw new IllegalArgumentException("node " + nodeRef + " is not a form");
|
||||
// }
|
||||
// final Form result = new FormImpl(nodeRef, this);
|
||||
// if (LOGGER.isDebugEnabled())
|
||||
// LOGGER.debug("loaded form " + result + " for noderef " + nodeRef);
|
||||
// return result;
|
||||
return null;
|
||||
}
|
||||
|
||||
public FormInstanceData getFormInstanceData(final int version, final String avmPath) throws FormNotFoundException
|
||||
{
|
||||
// // WCM
|
||||
// return this.getFormInstanceData(AVMNodeConverter.ToNodeRef(version, avmPath));
|
||||
return null;
|
||||
}
|
||||
|
||||
public FormInstanceData getFormInstanceData(final NodeRef nodeRef) throws FormNotFoundException
|
||||
{
|
||||
// // WCM
|
||||
// final String avmPath = AVMNodeConverter.ToAVMVersionPath(nodeRef).getSecond();
|
||||
// final WebProject webProject = new WebProject(avmPath);
|
||||
//
|
||||
// FormInstanceData fid = null;
|
||||
// try
|
||||
// {
|
||||
// fid = new FormInstanceDataImpl(nodeRef, this, webProject);
|
||||
// return fid;
|
||||
// }
|
||||
// catch (IllegalArgumentException iae)
|
||||
// {
|
||||
// // note: FormNotFoundException extends FileNotFoundException
|
||||
// throw new FormNotFoundException(iae.getMessage());
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
public Rendition getRendition(final int version, final String avmPath)
|
||||
{
|
||||
// // WCM
|
||||
// return this.getRendition(AVMNodeConverter.ToNodeRef(version, avmPath));
|
||||
return null;
|
||||
}
|
||||
|
||||
public Rendition getRendition(final NodeRef nodeRef)
|
||||
{
|
||||
return new RenditionImpl(nodeRef, this);
|
||||
}
|
||||
|
||||
// // WCM
|
||||
// public List<WebProject> getAssociatedWebProjects(final Form form)
|
||||
// {
|
||||
// final List<NodeRef> formConfigurations = this.getFormConfigurations(form.getName());
|
||||
// if (LOGGER.isDebugEnabled())
|
||||
// {
|
||||
// LOGGER.debug("found " + formConfigurations.size() +
|
||||
// " web projects configured with " + form.getName());
|
||||
// }
|
||||
// final List<WebProject> result = new ArrayList<WebProject>(formConfigurations.size());
|
||||
// for (final NodeRef ref : formConfigurations)
|
||||
// {
|
||||
// final List<ChildAssociationRef> parents = this.nodeService.getParentAssocs(ref);
|
||||
// assert parents.size() != 1 : ("expected only one parent for " + ref +
|
||||
// " got " + parents.size());
|
||||
// result.add(new WebProject(parents.get(0).getParentRef()));
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
// event handlers
|
||||
|
||||
public void handleMoveFormFolder(final ChildAssociationRef oldChild, final ChildAssociationRef newChild)
|
||||
{
|
||||
// // WCM
|
||||
// final String oldName = oldChild.getQName().getLocalName();
|
||||
// final String newName = newChild.getQName().getLocalName();
|
||||
// final List<NodeRef> formConfigurations = this.getFormConfigurations(oldName);
|
||||
// // find all webprojects that used the old name
|
||||
// if (LOGGER.isDebugEnabled())
|
||||
// {
|
||||
// LOGGER.debug("handling rename (" + oldName +
|
||||
// " => " + newName +
|
||||
// ") for " + formConfigurations.size());
|
||||
// }
|
||||
// for (final NodeRef ref : formConfigurations)
|
||||
// {
|
||||
// this.nodeService.setProperty(ref,
|
||||
// WCMAppModel.PROP_FORMNAME,
|
||||
// newName);
|
||||
// }
|
||||
}
|
||||
|
||||
public void handleDeleteFormFolder(final ChildAssociationRef childRef,
|
||||
final boolean isArchivedNode)
|
||||
{
|
||||
// // WCM
|
||||
// final String formName = childRef.getQName().getLocalName();
|
||||
// final List<NodeRef> formConfigurations = this.getFormConfigurations(formName);
|
||||
// for (final NodeRef ref : formConfigurations)
|
||||
// {
|
||||
// final List<ChildAssociationRef> parents = this.nodeService.getParentAssocs(ref);
|
||||
// assert parents.size() != 1 : ("expected only one parent for " + ref +
|
||||
// " got " + parents.size());
|
||||
// final NodeRef parentRef = parents.get(0).getParentRef();
|
||||
// if (LOGGER.isDebugEnabled())
|
||||
// {
|
||||
//
|
||||
// LOGGER.debug("removing configuration for " + formName +
|
||||
// " from web project " + this.nodeService.getProperty(parentRef, ContentModel.PROP_NAME));
|
||||
// }
|
||||
// // ALF-3751: Validate this is the real form folder rather than a copy
|
||||
// if (childRef.getParentRef().equals(parentRef))
|
||||
// {
|
||||
// this.nodeService.removeChild(parentRef, ref);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
//
|
||||
// // WCM
|
||||
// /**
|
||||
// * Return the list of web project nodes that reference a form name in their model
|
||||
// */
|
||||
// private List<NodeRef> getFormConfigurations(final String formName)
|
||||
// {
|
||||
// final String query =
|
||||
// "+TYPE:\"" + WCMAppModel.TYPE_WEBFORM + "\"" +
|
||||
// " +@" + Repository.escapeQName(WCMAppModel.PROP_FORMNAME) +
|
||||
// ":\"" + formName + "\"";
|
||||
// final ResultSet rs = this.searchService.query(Repository.getStoreRef(),
|
||||
// SearchService.LANGUAGE_LUCENE,
|
||||
// query);
|
||||
// try
|
||||
// {
|
||||
// if (LOGGER.isDebugEnabled())
|
||||
// {
|
||||
// LOGGER.debug("query " + query + " returned " + rs.length() + " results");
|
||||
// }
|
||||
// final List<NodeRef> result = new ArrayList<NodeRef>(rs.length());
|
||||
// for (final ResultSetRow row : rs)
|
||||
// {
|
||||
// result.add(row.getNodeRef());
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// rs.close();
|
||||
// }
|
||||
// }
|
||||
}
|
@@ -1,303 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package org.alfresco.web.forms;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Reader;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import freemarker.cache.TemplateLoader;
|
||||
import freemarker.ext.dom.NodeModel;
|
||||
import freemarker.template.Configuration;
|
||||
import freemarker.template.SimpleDate;
|
||||
import freemarker.template.SimpleHash;
|
||||
import freemarker.template.SimpleNumber;
|
||||
import freemarker.template.SimpleScalar;
|
||||
import freemarker.template.SimpleSequence;
|
||||
import freemarker.template.Template;
|
||||
import freemarker.template.TemplateBooleanModel;
|
||||
import freemarker.template.TemplateException;
|
||||
import freemarker.template.TemplateExceptionHandler;
|
||||
import freemarker.template.TemplateHashModel;
|
||||
import freemarker.template.TemplateMethodModel;
|
||||
import freemarker.template.TemplateModel;
|
||||
import freemarker.template.TemplateModelException;
|
||||
|
||||
/**
|
||||
* Implementation of a form data renderer for processing xml instance data
|
||||
* using a freemarker template.
|
||||
*
|
||||
* @author Ariel Backenroth
|
||||
*/
|
||||
public class FreeMarkerRenderingEngine
|
||||
implements RenderingEngine
|
||||
{
|
||||
|
||||
private static final Log LOGGER = LogFactory.getLog(FreeMarkerRenderingEngine.class);
|
||||
|
||||
public FreeMarkerRenderingEngine() { }
|
||||
|
||||
public String getName() { return "FreeMarker"; }
|
||||
|
||||
public String getDefaultTemplateFileExtension() { return "ftl"; }
|
||||
|
||||
/**
|
||||
* Renders the rendition using the configured freemarker template. This
|
||||
* provides a root map to the freemarker template which places the xml document, and
|
||||
* a variable named alfresco at the root. the alfresco variable contains a hash of
|
||||
* all parameters and all extension functions.
|
||||
*/
|
||||
public void render(final Map<QName, Object> model,
|
||||
final RenderingEngineTemplate ret,
|
||||
final OutputStream out)
|
||||
throws IOException,
|
||||
RenderingEngine.RenderingException,
|
||||
SAXException
|
||||
{
|
||||
|
||||
final Configuration cfg = new Configuration();
|
||||
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
|
||||
cfg.setTemplateLoader(new TemplateLoader()
|
||||
{
|
||||
public void closeTemplateSource(final Object templateSource)
|
||||
throws IOException
|
||||
{
|
||||
((InputStream)templateSource).close();
|
||||
}
|
||||
|
||||
public Object findTemplateSource(final String name)
|
||||
throws IOException
|
||||
{
|
||||
LOGGER.debug("request to load template " + name);
|
||||
|
||||
// // WCM
|
||||
// final RenderingEngine.TemplateResourceResolver trr = (RenderingEngine.TemplateResourceResolver)
|
||||
// model.get(RenderingEngineTemplateImpl.PROP_RESOURCE_RESOLVER);
|
||||
final RenderingEngine.TemplateResourceResolver trr = null;
|
||||
|
||||
return trr.resolve(name);
|
||||
}
|
||||
|
||||
public long getLastModified(final Object templateSource)
|
||||
{
|
||||
// no caching for now...
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public Reader getReader(final Object templateSource, final String encoding)
|
||||
throws IOException
|
||||
{
|
||||
return new InputStreamReader((InputStream)templateSource);
|
||||
}
|
||||
});
|
||||
final Template t = new Template("freemarker_template",
|
||||
new InputStreamReader(ret.getInputStream()),
|
||||
cfg);
|
||||
final TemplateHashModel rootModel = this.convertModel(model);
|
||||
|
||||
// process the form
|
||||
try
|
||||
{
|
||||
t.process(rootModel, new OutputStreamWriter(out));
|
||||
}
|
||||
catch (final TemplateException te)
|
||||
{
|
||||
LOGGER.debug(te);
|
||||
throw new RenderingEngine.RenderingException(te);
|
||||
}
|
||||
finally
|
||||
{
|
||||
out.flush();
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
private TemplateHashModel convertModel(final Map<QName, Object> model)
|
||||
{
|
||||
final List<TemplateHashModel> rootModelObjects = new LinkedList<TemplateHashModel>();
|
||||
final SimpleHash result = new SimpleHash()
|
||||
{
|
||||
public TemplateModel get(final String key)
|
||||
throws TemplateModelException
|
||||
{
|
||||
TemplateModel result = super.get(key);
|
||||
if (result == null)
|
||||
{
|
||||
for (TemplateHashModel m : rootModelObjects)
|
||||
{
|
||||
result = m.get(key);
|
||||
if (result != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
for (final Map.Entry<QName, Object> entry : model.entrySet())
|
||||
{
|
||||
final QName qn = entry.getKey();
|
||||
if (qn.equals(RenderingEngine.ROOT_NAMESPACE))
|
||||
{
|
||||
final TemplateModel m = this.convertValue(entry.getValue());
|
||||
if (m instanceof TemplateHashModel)
|
||||
{
|
||||
rootModelObjects.add((TemplateHashModel)m);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalArgumentException("root namespace values must be convertable to " + TemplateHashModel.class.getName() +
|
||||
". converted " + entry.getValue().getClass().getName() +
|
||||
" to " + m.getClass().getName() + ".");
|
||||
}
|
||||
}
|
||||
// // WCM
|
||||
// else if (qn.equals(RenderingEngineTemplateImpl.PROP_RESOURCE_RESOLVER))
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
else
|
||||
{
|
||||
final String[] splitQName = QName.splitPrefixedQName(qn.toPrefixString());
|
||||
final String variableName = splitQName[1];
|
||||
|
||||
//insert
|
||||
if (NamespaceService.DEFAULT_PREFIX.equals(splitQName[0]))
|
||||
{
|
||||
result.put(variableName, this.convertValue(entry.getValue()));
|
||||
}
|
||||
else
|
||||
{
|
||||
SimpleHash prefixModel = null;
|
||||
final String prefix = splitQName[0];
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
prefixModel = (SimpleHash)result.get(prefix);
|
||||
}
|
||||
catch (ClassCastException cce)
|
||||
{
|
||||
throw new ClassCastException("expected value of " + prefix +
|
||||
" to be a " + SimpleHash.class.getName() +
|
||||
". found a " + result.get(prefix).getClass().getName());
|
||||
}
|
||||
}
|
||||
catch (TemplateModelException tme)
|
||||
{
|
||||
}
|
||||
if (prefixModel == null)
|
||||
{
|
||||
prefixModel = new SimpleHash();
|
||||
result.put(prefix, prefixModel);
|
||||
}
|
||||
|
||||
prefixModel.put(variableName,
|
||||
this.convertValue(entry.getValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private TemplateModel convertValue(final Object value)
|
||||
{
|
||||
LOGGER.debug("converting value " + value);
|
||||
if (value == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if (value.getClass().isArray())
|
||||
{
|
||||
final Object[] array = (Object[])value;
|
||||
LOGGER.debug("converting array of " + array.getClass().getComponentType() +
|
||||
" size " + array.length);
|
||||
final SimpleSequence result = new SimpleSequence();
|
||||
for (int i = 0; i < array.length; i++)
|
||||
{
|
||||
result.add(this.convertValue(array[i]));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
else if (value instanceof String)
|
||||
{
|
||||
return new SimpleScalar((String)value);
|
||||
}
|
||||
else if (value instanceof Number)
|
||||
{
|
||||
return new SimpleNumber((Number)value);
|
||||
}
|
||||
else if (value instanceof Boolean)
|
||||
{
|
||||
return (Boolean)value ? TemplateBooleanModel.TRUE : TemplateBooleanModel.FALSE;
|
||||
}
|
||||
else if (value instanceof Date)
|
||||
{
|
||||
return new SimpleDate(((Date)value), SimpleDate.DATETIME);
|
||||
}
|
||||
else if (value instanceof Document)
|
||||
{
|
||||
return NodeModel.wrap((Document)value);
|
||||
}
|
||||
else if (value instanceof Node)
|
||||
{
|
||||
return NodeModel.wrap((Node)value);
|
||||
}
|
||||
else if (value instanceof RenderingEngine.TemplateProcessorMethod)
|
||||
{
|
||||
return new TemplateMethodModel()
|
||||
{
|
||||
public Object exec(final List args)
|
||||
throws TemplateModelException
|
||||
{
|
||||
try
|
||||
{
|
||||
LOGGER.debug("invoking template processor method " + value +
|
||||
" with " + args.size() + " arguments");
|
||||
final Object result = ((TemplateProcessorMethod)value).exec(args.toArray(new Object[args.size()]));
|
||||
return FreeMarkerRenderingEngine.this.convertValue(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new TemplateModelException(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalArgumentException("unable to convert value " + value.getClass().getName());
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.web.forms;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.LinkedList;
|
||||
import javax.xml.XMLConstants;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* FreeMarker utility functions.
|
||||
*
|
||||
* @author Ariel Backenroth
|
||||
*/
|
||||
public class FreeMarkerUtil
|
||||
{
|
||||
public static String buildNamespaceDeclaration(final Document xml)
|
||||
{
|
||||
final Element docEl = xml.getDocumentElement();
|
||||
final NamedNodeMap attributes = docEl.getAttributes();
|
||||
final StringBuilder result = new StringBuilder();
|
||||
for (int i = 0; i < attributes.getLength(); i++)
|
||||
{
|
||||
final Node a = attributes.item(i);
|
||||
if (a.getNodeName().startsWith(XMLConstants.XMLNS_ATTRIBUTE))
|
||||
{
|
||||
final String prefix = a.getNodeName().substring((XMLConstants.XMLNS_ATTRIBUTE + ":").length());
|
||||
final String uri = a.getNodeValue();
|
||||
if (result.length() != 0)
|
||||
{
|
||||
result.append(",\n");
|
||||
}
|
||||
result.append("\"").append(prefix).append("\":\"").append(uri).append("\"");
|
||||
}
|
||||
}
|
||||
return "<#ftl ns_prefixes={\n" + result.toString() + "}>\n";
|
||||
}
|
||||
}
|
@@ -1,126 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package org.alfresco.web.forms;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Serializes the xml instance data collected by a form to a writer.
|
||||
*
|
||||
* @author Ariel Backenroth
|
||||
*/
|
||||
public interface RenderingEngine
|
||||
extends Serializable
|
||||
{
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static class RenderingException extends Exception
|
||||
{
|
||||
private static final long serialVersionUID = 6831222399250770060L;
|
||||
|
||||
public RenderingException(final String msg)
|
||||
{
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public RenderingException(final Exception cause)
|
||||
{
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public RenderingException(final String msg, final Exception cause)
|
||||
{
|
||||
super(msg, cause);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TemplateNotFoundException extends AlfrescoRuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = 3232973289475043471L;
|
||||
|
||||
public TemplateNotFoundException(final String msg)
|
||||
{
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public TemplateNotFoundException(final String msg, final Exception cause)
|
||||
{
|
||||
super(msg, cause);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public interface TemplateProcessorMethod
|
||||
extends Serializable
|
||||
{
|
||||
public Object exec(final Object[] arguments)
|
||||
throws Exception;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public interface TemplateResourceResolver
|
||||
extends Serializable
|
||||
{
|
||||
public InputStream resolve(final String resourceName)
|
||||
throws IOException;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public final static QName ROOT_NAMESPACE =
|
||||
QName.createQName(null, "root_namespace");
|
||||
|
||||
/**
|
||||
* Returns the rendering engines name.
|
||||
*
|
||||
* @return the name of the rendering engine.
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
|
||||
/**
|
||||
* Returns the default file extension for rendering engine templates for this
|
||||
* rendering engine.
|
||||
*
|
||||
* @return the default file extension for rendering engine templates for this
|
||||
* rendering engine.
|
||||
*/
|
||||
public String getDefaultTemplateFileExtension();
|
||||
|
||||
/**
|
||||
* Renders the xml data in to a presentation format.
|
||||
*
|
||||
* @param model The model
|
||||
* @param ret the rendering engine template
|
||||
* @param out The output stream to write to
|
||||
*/
|
||||
public void render(final Map<QName, Object> model,
|
||||
final RenderingEngineTemplate ret,
|
||||
final OutputStream out)
|
||||
throws IOException, RenderingException, SAXException;
|
||||
}
|
@@ -1,111 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package org.alfresco.web.forms;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Describes a template that is used for rendering form instance data.
|
||||
*
|
||||
* @author Ariel Backenroth
|
||||
*/
|
||||
public interface RenderingEngineTemplate
|
||||
extends Serializable
|
||||
{
|
||||
/** the name of the rendering engine template */
|
||||
public String getName();
|
||||
|
||||
/** the title of the rendering engine template */
|
||||
public String getTitle();
|
||||
|
||||
/** the description of the rendering engine template */
|
||||
public String getDescription();
|
||||
|
||||
/** the output path pattern for renditions */
|
||||
public String getOutputPathPattern();
|
||||
|
||||
/**
|
||||
* Provides the rendering engine to use to process this template.
|
||||
*
|
||||
* @return the rendering engine to use to process this template.
|
||||
*/
|
||||
public RenderingEngine getRenderingEngine();
|
||||
|
||||
/**
|
||||
* Provides an input stream to the rendering engine template.
|
||||
*
|
||||
* @return the input stream to the rendering engine template.
|
||||
*/
|
||||
public InputStream getInputStream()
|
||||
throws IOException;
|
||||
|
||||
/**
|
||||
* Returns the output path for the rendition.
|
||||
*
|
||||
* @param formInstanceData the form instance data to use for
|
||||
* processing the pattern.
|
||||
* @param currentAVMPath the current path where the form is being created.
|
||||
* @param name the name which is used in a pattern
|
||||
* @return the output path for the rendition.
|
||||
*/
|
||||
public String getOutputPathForRendition(final FormInstanceData formInstanceData,
|
||||
final String currentAVMPath, final String name);
|
||||
|
||||
/**
|
||||
* Returns the mimetype to use when generating content for this
|
||||
* output method.
|
||||
*
|
||||
* @return the mimetype to use when generating content for this
|
||||
* output method, such as text/html, text/xml, application/pdf.
|
||||
*/
|
||||
public String getMimetypeForRendition();
|
||||
|
||||
/**
|
||||
* Produces a rendition of the provided formInstanceData.
|
||||
*
|
||||
* @param formInstanceData the form instance data for which to produce
|
||||
* the rendition.
|
||||
* @param renditionAVMPath the path to use for the rendition.
|
||||
*/
|
||||
public Rendition render(final FormInstanceData formInstanceData,
|
||||
final String renditionAVMPath)
|
||||
throws IOException,
|
||||
SAXException,
|
||||
RenderingEngine.RenderingException;
|
||||
|
||||
/**
|
||||
* Produces a rendition of the provided formInstanceData to an existing
|
||||
* rendition.
|
||||
*
|
||||
* @param formInstanceData the form instance data for which to produce
|
||||
* the rendition.
|
||||
* @param rendition the rendition to rerender
|
||||
*/
|
||||
public void render(final FormInstanceData formInstanceData,
|
||||
final Rendition rendition)
|
||||
throws IOException,
|
||||
SAXException,
|
||||
RenderingEngine.RenderingException;
|
||||
}
|
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package org.alfresco.web.forms;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Serializable;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Encapsulation of a rendition.
|
||||
*
|
||||
* @author Ariel Backenroth
|
||||
*/
|
||||
public interface Rendition
|
||||
extends Serializable
|
||||
{
|
||||
/** the name of this rendition */
|
||||
public String getName();
|
||||
|
||||
/** the description of this rendition */
|
||||
public String getDescription();
|
||||
|
||||
/** the path relative to the containing webapp */
|
||||
public String getWebappRelativePath();
|
||||
|
||||
/** the path relative to the sandbox */
|
||||
public String getSandboxRelativePath();
|
||||
|
||||
/** the primary form instance data used to generate this rendition */
|
||||
public FormInstanceData getPrimaryFormInstanceData()
|
||||
throws FileNotFoundException;
|
||||
|
||||
/** the primary form instance data used to generate this rendition (include deleted AVM nodes) */
|
||||
public FormInstanceData getPrimaryFormInstanceData(boolean includeDeleted)
|
||||
throws FileNotFoundException;
|
||||
|
||||
/** the rendering engine template that generated this rendition */
|
||||
public RenderingEngineTemplate getRenderingEngineTemplate();
|
||||
|
||||
/** the path to the contents of this rendition */
|
||||
public String getPath();
|
||||
|
||||
/** the url to the asset */
|
||||
public String getUrl();
|
||||
|
||||
/** the file type image for the rendition */
|
||||
public String getFileTypeImage();
|
||||
|
||||
/** the output stream for the rendition */
|
||||
public OutputStream getOutputStream();
|
||||
|
||||
/** the HTML label attribute for UI */
|
||||
public String getLabelAttribute();
|
||||
|
||||
/** the HTML description attribute for UI */
|
||||
public String getDescriptionAttribute();
|
||||
|
||||
/** regenerates the contents of this rendition using the primary form instance data */
|
||||
public void regenerate()
|
||||
throws IOException,
|
||||
RenderingEngine.RenderingException,
|
||||
SAXException;
|
||||
|
||||
/** regenerates the contents of this rendition using the provided form instance data*/
|
||||
public void regenerate(final FormInstanceData formInstanceData)
|
||||
throws IOException,
|
||||
RenderingEngine.RenderingException,
|
||||
SAXException;
|
||||
}
|
@@ -1,319 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.web.forms;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.repo.web.scripts.FileTypeImageUtils;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Encapsulation of a rendition.
|
||||
*
|
||||
* @author Ariel Backenroth
|
||||
*/
|
||||
/* package */ class RenditionImpl
|
||||
implements Rendition
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = -342658762155499039L;
|
||||
|
||||
private static final Log LOGGER = LogFactory.getLog(RenditionImpl.class);
|
||||
|
||||
private final NodeRef nodeRef;
|
||||
transient private FormsService formsService;
|
||||
transient private RenderingEngineTemplate renderingEngineTemplate;
|
||||
private String descriptionAttribute;
|
||||
|
||||
/* package */ RenditionImpl(final NodeRef nodeRef, final FormsService formsService)
|
||||
{
|
||||
if (nodeRef == null)
|
||||
{
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (formsService == null)
|
||||
{
|
||||
throw new NullPointerException();
|
||||
}
|
||||
// // WCM
|
||||
// final AVMService avmService = this.getServiceRegistry().getAVMService();
|
||||
// if (!avmService.hasAspect(AVMNodeConverter.ToAVMVersionPath(nodeRef).getFirst(),
|
||||
// AVMNodeConverter.ToAVMVersionPath(nodeRef).getSecond(),
|
||||
// WCMAppModel.ASPECT_RENDITION))
|
||||
// {
|
||||
// throw new IllegalArgumentException("node " + nodeRef +
|
||||
// " does not have aspect " + WCMAppModel.ASPECT_RENDITION);
|
||||
// }
|
||||
this.nodeRef = nodeRef;
|
||||
this.formsService = formsService;
|
||||
}
|
||||
|
||||
/* package */ RenditionImpl(final int version,
|
||||
final String avmPath,
|
||||
final FormsService formsService)
|
||||
{
|
||||
// // WCM
|
||||
// this(AVMNodeConverter.ToNodeRef(version, avmPath), formsService);
|
||||
this(null, formsService);
|
||||
}
|
||||
|
||||
private FormsService getFormsService()
|
||||
{
|
||||
if (formsService == null)
|
||||
{
|
||||
formsService = (FormsService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService");
|
||||
}
|
||||
return formsService;
|
||||
}
|
||||
|
||||
|
||||
/** the name of this rendition */
|
||||
public String getName()
|
||||
{
|
||||
// final AVMService avmService = this.getServiceRegistry().getAVMService();
|
||||
// return avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(),
|
||||
// AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(),
|
||||
// ContentModel.PROP_NAME).getStringValue();
|
||||
// // WCM
|
||||
// return AVMNodeConverter.SplitBase(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond())[1];
|
||||
return null;
|
||||
}
|
||||
|
||||
/** the description of this rendition */
|
||||
public String getDescription()
|
||||
{
|
||||
// // WCM
|
||||
// final AVMService avmService = this.getServiceRegistry().getAVMService();
|
||||
// return avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(),
|
||||
// AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(),
|
||||
// ContentModel.PROP_DESCRIPTION).getStringValue();
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getWebappRelativePath()
|
||||
{
|
||||
// // WCM
|
||||
// return AVMUtil.getWebappRelativePath(this.getPath());
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getSandboxRelativePath()
|
||||
{
|
||||
// // WCM
|
||||
// return AVMUtil.getSandboxRelativePath(this.getPath());
|
||||
return null;
|
||||
}
|
||||
|
||||
public FormInstanceData getPrimaryFormInstanceData()
|
||||
throws FileNotFoundException
|
||||
{
|
||||
return getPrimaryFormInstanceData(false);
|
||||
}
|
||||
|
||||
public FormInstanceData getPrimaryFormInstanceData(boolean includeDeleted)
|
||||
throws FileNotFoundException
|
||||
{
|
||||
// // WCM
|
||||
// final AVMService avmService = this.getServiceRegistry().getAVMLockingAwareService();
|
||||
// final String fidAVMStoreRelativePath = (String)
|
||||
// avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(),
|
||||
// AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(),
|
||||
// WCMAppModel.PROP_PRIMARY_FORM_INSTANCE_DATA).getValue(DataTypeDefinition.TEXT);
|
||||
// String avmStore = AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond();
|
||||
// avmStore = avmStore.substring(0, avmStore.indexOf(':'));
|
||||
// final String path = avmStore + ':' + fidAVMStoreRelativePath;
|
||||
// if (avmService.lookup(-1, path, includeDeleted) == null)
|
||||
// {
|
||||
// throw new FileNotFoundException("unable to find primary form instance data " + path);
|
||||
// }
|
||||
// return this.getFormsService().getFormInstanceData(-1, path);
|
||||
return null;
|
||||
}
|
||||
|
||||
/** the rendering engine template that generated this rendition */
|
||||
public RenderingEngineTemplate getRenderingEngineTemplate()
|
||||
{
|
||||
// // WCM
|
||||
// if (this.renderingEngineTemplate == null)
|
||||
// {
|
||||
// final AVMService avmService = this.getServiceRegistry().getAVMLockingAwareService();
|
||||
// PropertyValue pv =
|
||||
// avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(),
|
||||
// AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(),
|
||||
// WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE);
|
||||
// if (pv == null)
|
||||
// {
|
||||
// LOGGER.debug("property " + WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE +
|
||||
// " not set on " + this.getPath());
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// final NodeRef retNodeRef = (NodeRef)pv.getValue(DataTypeDefinition.NODE_REF);
|
||||
// if (retNodeRef == null)
|
||||
// {
|
||||
// LOGGER.debug("unable to locate parent rendering engine template of rendition " +
|
||||
// this.getPath());
|
||||
// return null;
|
||||
// }
|
||||
// pv = avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(),
|
||||
// AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(),
|
||||
// WCMAppModel.PROP_PARENT_RENDITION_PROPERTIES);
|
||||
// if (pv == null)
|
||||
// {
|
||||
// LOGGER.debug("property " + WCMAppModel.PROP_PARENT_RENDITION_PROPERTIES +
|
||||
// " not set on " + this.getPath());
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// final NodeRef rpNodeRef = (NodeRef)pv.getValue(DataTypeDefinition.NODE_REF);
|
||||
// if (rpNodeRef == null)
|
||||
// {
|
||||
// LOGGER.debug("unable to locate parent rendering engine template properties of rendition " +
|
||||
// this.getPath());
|
||||
// return null;
|
||||
// }
|
||||
// this.renderingEngineTemplate = new RenderingEngineTemplateImpl(retNodeRef, rpNodeRef, this.getFormsService());
|
||||
// }
|
||||
// return this.renderingEngineTemplate;
|
||||
return null;
|
||||
}
|
||||
|
||||
/** the node ref containing the contents of this rendition */
|
||||
public NodeRef getNodeRef()
|
||||
{
|
||||
return this.nodeRef;
|
||||
}
|
||||
|
||||
public String getPath()
|
||||
{
|
||||
// // WCM
|
||||
// return AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond();
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getUrl()
|
||||
{
|
||||
// // WCM
|
||||
// return AVMUtil.getPreviewURI(this.getPath());
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getFileTypeImage()
|
||||
{
|
||||
return FileTypeImageUtils.getFileTypeImage(this.getName(), false);
|
||||
}
|
||||
|
||||
public OutputStream getOutputStream()
|
||||
{
|
||||
// // WCM
|
||||
// final AVMService avmService = this.getServiceRegistry().getAVMLockingAwareService();
|
||||
// final Pair<Integer, String> p = AVMNodeConverter.ToAVMVersionPath(this.nodeRef);
|
||||
// return (avmService.lookup(p.getFirst(), p.getSecond()) == null
|
||||
// ? avmService.createFile(AVMNodeConverter.SplitBase(p.getSecond())[0],
|
||||
// AVMNodeConverter.SplitBase(p.getSecond())[1])
|
||||
// : avmService.getFileOutputStream(this.getPath()));
|
||||
return null;
|
||||
}
|
||||
|
||||
public void regenerate()
|
||||
throws IOException,
|
||||
RenderingEngine.RenderingException,
|
||||
SAXException
|
||||
{
|
||||
this.regenerate(this.getPrimaryFormInstanceData());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void regenerate(final FormInstanceData formInstanceData)
|
||||
throws IOException,
|
||||
RenderingEngine.RenderingException,
|
||||
SAXException
|
||||
{
|
||||
this.getRenderingEngineTemplate().render(formInstanceData, this);
|
||||
}
|
||||
|
||||
private ServiceRegistry getServiceRegistry()
|
||||
{
|
||||
final FacesContext fc = FacesContext.getCurrentInstance();
|
||||
return Repository.getServiceRegistry(fc);
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
{
|
||||
return this.getPath().hashCode();
|
||||
}
|
||||
|
||||
public boolean equals(final Object other)
|
||||
{
|
||||
return (other instanceof RenditionImpl &&
|
||||
this.getNodeRef().equals(((RenditionImpl)other).getNodeRef()));
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return (this.getClass().getName() +
|
||||
"{path : " + this.getPath() +
|
||||
", rendering_engine_template : " + this.getRenderingEngineTemplate() +
|
||||
"}");
|
||||
}
|
||||
|
||||
public String getDescriptionAttribute()
|
||||
{
|
||||
if (StringUtils.isEmpty(this.descriptionAttribute))
|
||||
{
|
||||
this.descriptionAttribute = buildDescriptionAttribute();
|
||||
}
|
||||
return this.descriptionAttribute;
|
||||
}
|
||||
|
||||
public String getLabelAttribute()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder("<b>");
|
||||
builder.append(Utils.encode(this.getName()));
|
||||
builder.append("</b>");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
private String buildDescriptionAttribute()
|
||||
{
|
||||
int hashCode = hashCode();
|
||||
String contextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
|
||||
StringBuilder attribute = new StringBuilder(255);
|
||||
attribute.append("<span style=\"float:right;\"><a id=\"preview").append(hashCode).append("\" ");
|
||||
attribute.append("href=\"").append(getUrl()).append("\" ");
|
||||
attribute.append("style=\"text-decoration: none;\" ");
|
||||
attribute.append("target=\"window_").append(hashCode).append("_").append(getName()).append("\">");
|
||||
attribute.append("<img src=\"").append(contextPath).append("/images/icons/preview_website.gif\" ");
|
||||
attribute.append("align=\"absmiddle\" style=\"border: 0px\" alt=\"").append(getName()).append("\">");
|
||||
attribute.append("</a></span><span>").append(getDescription()).append("</span>");
|
||||
return attribute.toString();
|
||||
}
|
||||
}
|
@@ -1,116 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package org.alfresco.web.forms;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.transform.sax.SAXResult;
|
||||
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.fop.apps.FOPException;
|
||||
import org.apache.fop.apps.FOUserAgent;
|
||||
import org.apache.fop.apps.Fop;
|
||||
import org.apache.fop.apps.FopFactory;
|
||||
import org.apache.fop.apps.MimeConstants;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* A rendering engine which uses xsl-fo templates to generate renditions of form
|
||||
* instance data.
|
||||
*
|
||||
* @author Ariel Backenroth
|
||||
*/
|
||||
public class XSLFORenderingEngine extends XSLTRenderingEngine
|
||||
{
|
||||
|
||||
private static final Log LOGGER = LogFactory.getLog(XSLFORenderingEngine.class);
|
||||
|
||||
private static final Map<String, String> MIME_TYPES = new HashMap<String, String>();
|
||||
static
|
||||
{
|
||||
MIME_TYPES.put(MimeConstants.MIME_PDF, MimeConstants.MIME_PDF);
|
||||
|
||||
MIME_TYPES.put(MimeConstants.MIME_POSTSCRIPT, MimeConstants.MIME_POSTSCRIPT);
|
||||
MIME_TYPES.put(MimeConstants.MIME_EPS, MimeConstants.MIME_POSTSCRIPT);
|
||||
|
||||
MIME_TYPES.put(MimeConstants.MIME_PLAIN_TEXT, MimeConstants.MIME_PLAIN_TEXT);
|
||||
|
||||
MIME_TYPES.put(MimeConstants.MIME_RTF, MimeConstants.MIME_RTF);
|
||||
MIME_TYPES.put(MimeConstants.MIME_RTF_ALT1, MimeConstants.MIME_RTF);
|
||||
MIME_TYPES.put(MimeConstants.MIME_RTF_ALT2, MimeConstants.MIME_RTF);
|
||||
|
||||
MIME_TYPES.put(MimeConstants.MIME_MIF, MimeConstants.MIME_MIF);
|
||||
MIME_TYPES.put("application/x-mif", MimeConstants.MIME_MIF);
|
||||
|
||||
MIME_TYPES.put(MimeConstants.MIME_SVG, MimeConstants.MIME_SVG);
|
||||
|
||||
// looks like a dependency is missing - removing for now
|
||||
// MIME_TYPES.put(MimeConstants.MIME_GIF, MimeConstants.MIME_GIF);
|
||||
MIME_TYPES.put(MimeConstants.MIME_PNG, MimeConstants.MIME_PNG);
|
||||
MIME_TYPES.put(MimeConstants.MIME_JPEG, MimeConstants.MIME_JPEG);
|
||||
MIME_TYPES.put(MimeConstants.MIME_TIFF, MimeConstants.MIME_TIFF);
|
||||
};
|
||||
|
||||
public XSLFORenderingEngine()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return "XSL-FO";
|
||||
}
|
||||
|
||||
public String getDefaultTemplateFileExtension()
|
||||
{
|
||||
return "fo";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(final Map<QName, Object> model, final RenderingEngineTemplate ret, final OutputStream out)
|
||||
throws IOException, RenderingEngine.RenderingException, SAXException
|
||||
{
|
||||
|
||||
String mimetype = MIME_TYPES.get(ret.getMimetypeForRendition());
|
||||
if (mimetype == null) { throw new RenderingEngine.RenderingException("mimetype "
|
||||
+ ret.getMimetypeForRendition() + " is not supported by " + this.getName()); }
|
||||
try
|
||||
{
|
||||
final FopFactory fopFactory = FopFactory.newInstance();
|
||||
final FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
|
||||
final Fop fop = fopFactory.newFop(mimetype, foUserAgent, out);
|
||||
// Resulting SAX events (the generated FO) must be piped through to
|
||||
// FOP
|
||||
super.render(model, ret, new SAXResult(fop.getDefaultHandler()));
|
||||
|
||||
}
|
||||
catch (FOPException fope)
|
||||
{
|
||||
throw new RenderingEngine.RenderingException(fope);
|
||||
}
|
||||
finally
|
||||
{
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,526 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package org.alfresco.web.forms;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.transform.ErrorListener;
|
||||
import javax.xml.transform.Result;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerConfigurationException;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.URIResolver;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.XMLUtil;
|
||||
import org.apache.bsf.BSFManager;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.xml.dtm.ref.DTMNodeProxy;
|
||||
import org.apache.xml.utils.Constants;
|
||||
import org.w3c.dom.DOMException;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.traversal.NodeFilter;
|
||||
import org.w3c.dom.traversal.NodeIterator;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* A rendering engine which uses xsl templates to render renditions of
|
||||
* form instance data.
|
||||
*
|
||||
* @author Ariel Backenroth
|
||||
*/
|
||||
public class XSLTRenderingEngine
|
||||
implements RenderingEngine
|
||||
{
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static class ProcessorMethodInvoker
|
||||
{
|
||||
private final static HashMap<String, TemplateProcessorMethod> PROCESSOR_METHODS =
|
||||
new HashMap<String, TemplateProcessorMethod>();
|
||||
|
||||
public ProcessorMethodInvoker() { }
|
||||
|
||||
private Object[] convertArguments(final Object[] arguments)
|
||||
{
|
||||
final List result = new LinkedList();
|
||||
for (int i = 0; i < arguments.length; i++)
|
||||
{
|
||||
LOGGER.debug("args[" + i + "] = " + arguments[i] +
|
||||
"(" + (arguments[i] != null
|
||||
? arguments[i].getClass().getName()
|
||||
: "null") + ")");
|
||||
if (arguments[i] == null ||
|
||||
arguments[i] instanceof String ||
|
||||
arguments[i] instanceof Number)
|
||||
{
|
||||
result.add(arguments[i]);
|
||||
}
|
||||
else if (arguments[i] instanceof DTMNodeProxy)
|
||||
{
|
||||
result.add(((DTMNodeProxy)arguments[i]).getStringValue());
|
||||
}
|
||||
else if (arguments[i] instanceof Node)
|
||||
{
|
||||
LOGGER.debug("node type is " + ((Node)arguments[i]).getNodeType() +
|
||||
" content " + ((Node)arguments[i]).getTextContent());
|
||||
result.add(((Node)arguments[i]).getNodeValue());
|
||||
}
|
||||
else if (arguments[i] instanceof NodeIterator)
|
||||
{
|
||||
Node n = ((NodeIterator)arguments[i]).nextNode();
|
||||
while (n != null)
|
||||
{
|
||||
LOGGER.debug("iterated to node " + n + " type " + n.getNodeType() +
|
||||
" value " + n.getNodeValue() +
|
||||
" tc " + n.getTextContent() +
|
||||
" nn " + n.getNodeName() +
|
||||
" sv " + ((org.apache.xml.dtm.ref.DTMNodeProxy)n).getStringValue());
|
||||
if (n instanceof DTMNodeProxy)
|
||||
{
|
||||
result.add(((DTMNodeProxy)n).getStringValue());
|
||||
}
|
||||
else
|
||||
{
|
||||
result.add(n);
|
||||
}
|
||||
n = ((NodeIterator)arguments[i]).nextNode();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalArgumentException("unable to convert argument " + arguments[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return result.toArray(new Object[result.size()]);
|
||||
}
|
||||
|
||||
public Object invokeMethod(final String id, Object[] arguments)
|
||||
throws Exception
|
||||
{
|
||||
if (!PROCESSOR_METHODS.containsKey(id))
|
||||
{
|
||||
throw new NullPointerException("unable to find method " + id);
|
||||
}
|
||||
|
||||
final TemplateProcessorMethod method = PROCESSOR_METHODS.get(id);
|
||||
arguments = this.convertArguments(arguments);
|
||||
LOGGER.debug("invoking " + id + " with " + arguments.length);
|
||||
|
||||
Object result = method.exec(arguments);
|
||||
LOGGER.debug(id + " returned a " + result);
|
||||
if (result == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if (result.getClass().isArray() &&
|
||||
Node.class.isAssignableFrom(result.getClass().getComponentType()))
|
||||
{
|
||||
LOGGER.debug("converting " + result + " to a node iterator");
|
||||
final Node[] array = (Node[])result;
|
||||
return new NodeIterator()
|
||||
{
|
||||
private int index = 0;
|
||||
private boolean detached = false;
|
||||
|
||||
public void detach()
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("detaching NodeIterator");
|
||||
this.detached = true;
|
||||
}
|
||||
|
||||
public boolean getExpandEntityReferences() { return true; }
|
||||
public int getWhatToShow() { return NodeFilter.SHOW_ALL; }
|
||||
|
||||
public Node getRoot()
|
||||
{
|
||||
return (array.length == 0
|
||||
? null
|
||||
: array[0].getOwnerDocument().getDocumentElement());
|
||||
}
|
||||
|
||||
public NodeFilter getFilter()
|
||||
{
|
||||
return new NodeFilter()
|
||||
{
|
||||
public short acceptNode(final Node n)
|
||||
{
|
||||
return NodeFilter.FILTER_ACCEPT;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public Node nextNode()
|
||||
throws DOMException
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("NodeIterator.nextNode(" + index + ")");
|
||||
if (this.detached)
|
||||
throw new DOMException(DOMException.INVALID_STATE_ERR, null);
|
||||
return index == array.length ? null : array[index++];
|
||||
}
|
||||
|
||||
public Node previousNode()
|
||||
throws DOMException
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("NodeIterator.previousNode(" + index + ")");
|
||||
if (this.detached)
|
||||
throw new DOMException(DOMException.INVALID_STATE_ERR, null);
|
||||
return index == -1 ? null : array[index--];
|
||||
}
|
||||
};
|
||||
}
|
||||
else if (result instanceof String ||
|
||||
result instanceof Number ||
|
||||
result instanceof Node)
|
||||
{
|
||||
LOGGER.debug("returning " + result + " as is");
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalArgumentException("unable to convert " + result.getClass().getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private static final Log LOGGER = LogFactory.getLog(XSLTRenderingEngine.class);
|
||||
|
||||
public XSLTRenderingEngine() { }
|
||||
|
||||
public String getName() { return "XSLT"; }
|
||||
|
||||
public String getDefaultTemplateFileExtension() { return "xsl"; }
|
||||
|
||||
/**
|
||||
* Adds a script element to the xsl which makes static methods on this
|
||||
* object available to the xsl tempalte.
|
||||
*
|
||||
* @param xslTemplate the xsl template
|
||||
*/
|
||||
protected List<String> addScripts(final Map<QName, Object> model,
|
||||
final Document xslTemplate)
|
||||
{
|
||||
final Map<QName, List<Map.Entry<QName, Object>>> methods =
|
||||
new HashMap<QName, List<Map.Entry<QName, Object>>>();
|
||||
for (final Map.Entry<QName, Object> entry : model.entrySet())
|
||||
{
|
||||
if (entry.getValue() instanceof TemplateProcessorMethod)
|
||||
{
|
||||
final String prefix = QName.splitPrefixedQName(entry.getKey().toPrefixString())[0];
|
||||
final QName qn = QName.createQName(entry.getKey().getNamespaceURI(),
|
||||
prefix);
|
||||
if (!methods.containsKey(qn))
|
||||
{
|
||||
methods.put(qn, new LinkedList());
|
||||
}
|
||||
methods.get(qn).add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
final Element docEl = xslTemplate.getDocumentElement();
|
||||
final String XALAN_NS = Constants.S_BUILTIN_EXTENSIONS_URL;
|
||||
final String XALAN_NS_PREFIX = "xalan";
|
||||
docEl.setAttribute("xmlns:" + XALAN_NS_PREFIX, XALAN_NS);
|
||||
|
||||
final Set<String> excludePrefixes = new HashSet<String>();
|
||||
if (docEl.hasAttribute("exclude-result-prefixes"))
|
||||
{
|
||||
excludePrefixes.addAll(Arrays.asList(docEl.getAttribute("exclude-result-prefixes").split(" ")));
|
||||
}
|
||||
excludePrefixes.add(XALAN_NS_PREFIX);
|
||||
|
||||
final List<String> result = new LinkedList<String>();
|
||||
for (QName ns : methods.keySet())
|
||||
{
|
||||
final String prefix = ns.getLocalName();
|
||||
docEl.setAttribute("xmlns:" + prefix, ns.getNamespaceURI());
|
||||
excludePrefixes.add(prefix);
|
||||
|
||||
final Element compEl = xslTemplate.createElementNS(XALAN_NS,
|
||||
XALAN_NS_PREFIX + ":component");
|
||||
compEl.setAttribute("prefix", prefix);
|
||||
docEl.appendChild(compEl);
|
||||
String functionNames = null;
|
||||
final Element scriptEl = xslTemplate.createElementNS(XALAN_NS,
|
||||
XALAN_NS_PREFIX + ":script");
|
||||
scriptEl.setAttribute("lang", "javascript");
|
||||
final StringBuilder js =
|
||||
new StringBuilder("var _xsltp_invoke = java.lang.Class.forName('" + ProcessorMethodInvoker.class.getName() +
|
||||
"').newInstance();\n" +
|
||||
"function _xsltp_to_java_array(js_array) {\n" +
|
||||
"var java_array = java.lang.reflect.Array.newInstance(java.lang.Object, js_array.length);\n" +
|
||||
"for (var i = 0; i < js_array.length; i++) { java_array[i] = js_array[i]; }\n" +
|
||||
"return java_array; }\n");
|
||||
for (final Map.Entry<QName, Object> entry : methods.get(ns))
|
||||
{
|
||||
if (functionNames == null)
|
||||
{
|
||||
functionNames = entry.getKey().getLocalName();
|
||||
}
|
||||
else
|
||||
{
|
||||
functionNames += " " + entry.getKey().getLocalName();
|
||||
}
|
||||
final String id = entry.getKey().getLocalName() + entry.getValue().hashCode();
|
||||
js.append("function " + entry.getKey().getLocalName() +
|
||||
"() { return _xsltp_invoke.invokeMethod('" + id +
|
||||
"', _xsltp_to_java_array(arguments)); }\n");
|
||||
ProcessorMethodInvoker.PROCESSOR_METHODS.put(id, (TemplateProcessorMethod)entry.getValue());
|
||||
result.add(id);
|
||||
}
|
||||
LOGGER.debug("generated JavaScript bindings:\n" + js);
|
||||
scriptEl.appendChild(xslTemplate.createTextNode(js.toString()));
|
||||
compEl.setAttribute("functions", functionNames);
|
||||
compEl.appendChild(scriptEl);
|
||||
}
|
||||
docEl.setAttribute("exclude-result-prefixes",
|
||||
StringUtils.join(excludePrefixes.toArray(new String[excludePrefixes.size()]), " "));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the specified parameters to the xsl template as variables within the
|
||||
* alfresco namespace.
|
||||
*
|
||||
* @param model the variables to place within the xsl template
|
||||
* @param xslTemplate the xsl template
|
||||
*/
|
||||
protected void addParameters(final Map<QName, Object> model,
|
||||
final Document xslTemplate)
|
||||
{
|
||||
final Element docEl = xslTemplate.getDocumentElement();
|
||||
final String XSL_NS = docEl.getNamespaceURI();
|
||||
final String XSL_NS_PREFIX = docEl.getPrefix();
|
||||
|
||||
for (Map.Entry<QName, Object> e : model.entrySet())
|
||||
{
|
||||
if (RenderingEngine.ROOT_NAMESPACE.equals(e.getKey()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
final Element el = xslTemplate.createElementNS(XSL_NS, XSL_NS_PREFIX + ":variable");
|
||||
el.setAttribute("name", e.getKey().toPrefixString());
|
||||
final Object o = e.getValue();
|
||||
if (o instanceof String || o instanceof Number || o instanceof Boolean)
|
||||
{
|
||||
el.appendChild(xslTemplate.createTextNode(o.toString()));
|
||||
docEl.insertBefore(el, docEl.getFirstChild());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected Source getXMLSource(final Map<QName, Object> model)
|
||||
{
|
||||
if (!model.containsKey(RenderingEngine.ROOT_NAMESPACE))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
final Object o = model.get(RenderingEngine.ROOT_NAMESPACE);
|
||||
if (!(o instanceof Document))
|
||||
{
|
||||
throw new IllegalArgumentException("expected root namespace object to be a " + Document.class.getName() +
|
||||
". found a " + o.getClass().getName());
|
||||
}
|
||||
return new DOMSource((Document)o);
|
||||
}
|
||||
|
||||
public void render(final Map<QName, Object> model,
|
||||
final RenderingEngineTemplate ret,
|
||||
final OutputStream out)
|
||||
throws IOException,
|
||||
RenderingEngine.RenderingException,
|
||||
SAXException
|
||||
{
|
||||
this.render(model, ret, new StreamResult(out));
|
||||
}
|
||||
|
||||
public void render(final Map<QName, Object> model,
|
||||
final RenderingEngineTemplate ret,
|
||||
final Result result)
|
||||
throws IOException,
|
||||
RenderingEngine.RenderingException,
|
||||
SAXException
|
||||
{
|
||||
System.setProperty("org.apache.xalan.extensions.bsf.BSFManager",
|
||||
BSFManager.class.getName());
|
||||
Document xslTemplate = null;
|
||||
try
|
||||
{
|
||||
xslTemplate = XMLUtil.parse(ret.getInputStream());
|
||||
}
|
||||
catch (final SAXException sax)
|
||||
{
|
||||
throw new RenderingEngine.RenderingException(sax);
|
||||
}
|
||||
this.addScripts(model, xslTemplate);
|
||||
this.addParameters(model, xslTemplate);
|
||||
|
||||
final LinkedList<TransformerException> errors = new LinkedList<TransformerException>();
|
||||
final ErrorListener errorListener = new ErrorListener()
|
||||
{
|
||||
public void error(final TransformerException te)
|
||||
throws TransformerException
|
||||
{
|
||||
LOGGER.debug("error " + te.getMessageAndLocation());
|
||||
errors.add(te);
|
||||
}
|
||||
|
||||
public void fatalError(final TransformerException te)
|
||||
throws TransformerException
|
||||
{
|
||||
LOGGER.debug("fatalError " + te.getMessageAndLocation());
|
||||
throw te;
|
||||
}
|
||||
|
||||
public void warning(final TransformerException te)
|
||||
throws TransformerException
|
||||
{
|
||||
LOGGER.debug("warning " + te.getMessageAndLocation());
|
||||
errors.add(te);
|
||||
}
|
||||
};
|
||||
|
||||
// create a uri resolver to resolve document() calls to the virtualized
|
||||
// web application
|
||||
final URIResolver uriResolver = new URIResolver()
|
||||
{
|
||||
public Source resolve(final String href, String base)
|
||||
throws TransformerException
|
||||
{
|
||||
LOGGER.debug("request to resolve href " + href +
|
||||
" using base " + base);
|
||||
// // WCM
|
||||
// final RenderingEngine.TemplateResourceResolver trr = (RenderingEngine.TemplateResourceResolver)
|
||||
// model.get(RenderingEngineTemplateImpl.PROP_RESOURCE_RESOLVER);
|
||||
final RenderingEngine.TemplateResourceResolver trr = null;
|
||||
|
||||
InputStream in = null;
|
||||
try
|
||||
{
|
||||
in = trr.resolve(href);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new TransformerException("unable to load " + href, e);
|
||||
}
|
||||
|
||||
if (in == null)
|
||||
{
|
||||
throw new TransformerException("unable to resolve href " + href);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
final Document d = XMLUtil.parse(in);
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("loaded " + XMLUtil.toString(d));
|
||||
return new DOMSource(d);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new TransformerException("unable to load " + href, e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Source xmlSource = this.getXMLSource(model);
|
||||
|
||||
Transformer t = null;
|
||||
try
|
||||
{
|
||||
final TransformerFactory tf = TransformerFactory.newInstance();
|
||||
tf.setErrorListener(errorListener);
|
||||
tf.setURIResolver(uriResolver);
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("xslTemplate: \n" + XMLUtil.toString(xslTemplate));
|
||||
}
|
||||
|
||||
t = tf.newTransformer(new DOMSource(xslTemplate));
|
||||
|
||||
if (errors.size() != 0)
|
||||
{
|
||||
final StringBuilder msg = new StringBuilder("errors encountered creating tranformer ... \n");
|
||||
for (TransformerException te : errors)
|
||||
{
|
||||
msg.append(te.getMessageAndLocation()).append("\n");
|
||||
}
|
||||
throw new RenderingEngine.RenderingException(msg.toString());
|
||||
}
|
||||
|
||||
t.setErrorListener(errorListener);
|
||||
t.setURIResolver(uriResolver);
|
||||
t.setParameter("versionParam", "2.0");
|
||||
}
|
||||
catch (TransformerConfigurationException tce)
|
||||
{
|
||||
LOGGER.error(tce);
|
||||
throw new RenderingEngine.RenderingException(tce);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
t.transform(xmlSource, result);
|
||||
}
|
||||
catch (TransformerException te)
|
||||
{
|
||||
LOGGER.error(te.getMessageAndLocation());
|
||||
throw new RenderingEngine.RenderingException(te);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error("unexpected error " + e);
|
||||
throw new RenderingEngine.RenderingException(e);
|
||||
}
|
||||
|
||||
if (errors.size() != 0)
|
||||
{
|
||||
final StringBuilder msg = new StringBuilder("errors encountered during transformation ... \n");
|
||||
for (TransformerException te : errors)
|
||||
{
|
||||
msg.append(te.getMessageAndLocation()).append("\n");
|
||||
}
|
||||
throw new RenderingEngine.RenderingException(msg.toString());
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package org.alfresco.web.forms.xforms;
|
||||
|
||||
|
||||
/**
|
||||
* This exception is thrown when implementations of <code>SchemaFormBuilder</code>
|
||||
* encounters an error building a form.
|
||||
*
|
||||
* @author Brian Dueck
|
||||
*/
|
||||
public class FormBuilderException
|
||||
extends Exception
|
||||
{
|
||||
|
||||
/**
|
||||
* Creates a new instance of <code>FormBuilderException</code> without detail message.
|
||||
*/
|
||||
public FormBuilderException() { }
|
||||
|
||||
/**
|
||||
* Constructs an instance of <code>FormBuilderException</code> with the specified detail message.
|
||||
*
|
||||
* @param msg the detail message.
|
||||
*/
|
||||
public FormBuilderException(String msg)
|
||||
{
|
||||
super(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an instance of <code>FormBuilderException</code> with the specified root exception.
|
||||
*
|
||||
* @param x The root exception.
|
||||
*/
|
||||
public FormBuilderException(Exception x)
|
||||
{
|
||||
super(x);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an instance of <code>FormBuilderException</code> with the specified root exception.
|
||||
*
|
||||
* @param msg the detail message.
|
||||
* @param x The root exception.
|
||||
*/
|
||||
public FormBuilderException(String msg, Exception x)
|
||||
{
|
||||
super(msg, x);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -1,219 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package org.alfresco.web.forms.xforms;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.search.ResultSet;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.forms.Form;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* @author Ariel Backenroth
|
||||
*/
|
||||
public class Schema2XFormsProperties
|
||||
{
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private class ResourceBundleWrapper
|
||||
extends ResourceBundle
|
||||
{
|
||||
|
||||
private final ResourceBundle bundle;
|
||||
private final ResourceBundle parent;
|
||||
|
||||
public ResourceBundleWrapper(final ResourceBundle bundle,
|
||||
final ResourceBundle parent)
|
||||
{
|
||||
LOGGER.debug("creating bundle " + bundle +
|
||||
" with parent " + parent);
|
||||
this.bundle = bundle;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public Enumeration<String> getKeys()
|
||||
{
|
||||
final Enumeration<String> bk = bundle.getKeys();
|
||||
final Enumeration<String> pk = parent.getKeys();
|
||||
return new Enumeration<String>()
|
||||
{
|
||||
|
||||
public boolean hasMoreElements()
|
||||
{
|
||||
return bk.hasMoreElements() || pk.hasMoreElements();
|
||||
}
|
||||
|
||||
public String nextElement()
|
||||
{
|
||||
return (bk.hasMoreElements()
|
||||
? bk.nextElement()
|
||||
: pk.nextElement());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected Object handleGetObject(final String key)
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.bundle.getObject(key);
|
||||
}
|
||||
catch (MissingResourceException mre1)
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.parent.getObject(key);
|
||||
}
|
||||
catch (MissingResourceException mre2)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private static final Log LOGGER = LogFactory.getLog(Schema2XFormsProperties.class);
|
||||
|
||||
private final ContentService contentService;
|
||||
private final NamespaceService namespaceService;
|
||||
private final NodeService nodeService;
|
||||
private final SearchService searchService;
|
||||
private boolean formatCaption = true;
|
||||
private String[] locations;
|
||||
|
||||
public Schema2XFormsProperties(final ContentService contentService,
|
||||
final NamespaceService namespaceService,
|
||||
final NodeService nodeService,
|
||||
final SearchService searchService)
|
||||
{
|
||||
this.contentService = contentService;
|
||||
this.namespaceService = namespaceService;
|
||||
this.nodeService = nodeService;
|
||||
this.searchService = searchService;
|
||||
}
|
||||
|
||||
public ResourceBundle getResourceBundle(final Form form, final Locale locale)
|
||||
{
|
||||
final LinkedList<ResourceBundle> bundles = new LinkedList<ResourceBundle>();
|
||||
for (String location : this.locations)
|
||||
{
|
||||
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||
location = location.replace("${form.name}",
|
||||
(NamespaceService.CONTENT_MODEL_PREFIX +
|
||||
':' + form.getName()));
|
||||
if (location.startsWith("alfresco:"))
|
||||
{
|
||||
location = location.substring("alfresco:".length());
|
||||
loader = new ClassLoader(loader)
|
||||
{
|
||||
public InputStream getResourceAsStream(String name)
|
||||
{
|
||||
LOGGER.debug("loading resource " + name);
|
||||
final ResultSet results =
|
||||
searchService.query(Repository.getStoreRef(),
|
||||
SearchService.LANGUAGE_LUCENE,
|
||||
"PATH:\"" + name + "\"");
|
||||
try
|
||||
{
|
||||
LOGGER.debug("search returned " + results.length() +
|
||||
" results");
|
||||
if (results.length() == 1)
|
||||
{
|
||||
final NodeRef nr = results.getNodeRef(0);
|
||||
final ContentReader reader =
|
||||
contentService.getReader(nr, ContentModel.PROP_CONTENT);
|
||||
return reader.getContentInputStream();
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.getResourceAsStream(name);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
results.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
else if (location.startsWith("classpath:"))
|
||||
{
|
||||
location = location.substring("classpath:".length());
|
||||
}
|
||||
|
||||
LOGGER.debug("using loader " + loader + " for location " + location);
|
||||
try
|
||||
{
|
||||
final ResourceBundle rb = ResourceBundle.getBundle(location,
|
||||
locale,
|
||||
loader);
|
||||
LOGGER.debug("found bundle " + rb + " for location " + location);
|
||||
bundles.addFirst(rb);
|
||||
}
|
||||
catch (MissingResourceException mse)
|
||||
{
|
||||
LOGGER.debug("unable to located bundle at " + location +
|
||||
": " + mse.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
ResourceBundle result = null;
|
||||
for (ResourceBundle rb : bundles)
|
||||
{
|
||||
result = (result == null ? rb : new ResourceBundleWrapper(rb, result));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setLocations(final String[] locations)
|
||||
{
|
||||
this.locations = locations;
|
||||
}
|
||||
|
||||
|
||||
public boolean isFormatCaption()
|
||||
{
|
||||
return formatCaption;
|
||||
}
|
||||
|
||||
public void setFormatCaption(boolean formatCaption)
|
||||
{
|
||||
this.formatCaption = formatCaption;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return (this.getClass().getName() + "{" +
|
||||
StringUtils.join(this.locations, ",") +
|
||||
"}");
|
||||
}
|
||||
}
|
||||
|
@@ -1,761 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package org.alfresco.web.forms.xforms;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.alfresco.util.EqualsHelper;
|
||||
import org.alfresco.util.XMLUtil;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.xerces.xs.XSAttributeUse;
|
||||
import org.apache.xerces.xs.XSComplexTypeDefinition;
|
||||
import org.apache.xerces.xs.XSConstants;
|
||||
import org.apache.xerces.xs.XSElementDeclaration;
|
||||
import org.apache.xerces.xs.XSImplementation;
|
||||
import org.apache.xerces.xs.XSLoader;
|
||||
import org.apache.xerces.xs.XSModel;
|
||||
import org.apache.xerces.xs.XSModelGroup;
|
||||
import org.apache.xerces.xs.XSNamedMap;
|
||||
import org.apache.xerces.xs.XSObjectList;
|
||||
import org.apache.xerces.xs.XSParticle;
|
||||
import org.apache.xerces.xs.XSSimpleTypeDefinition;
|
||||
import org.apache.xerces.xs.XSTerm;
|
||||
import org.apache.xerces.xs.XSTypeDefinition;
|
||||
import org.w3c.dom.DOMConfiguration;
|
||||
import org.w3c.dom.DOMError;
|
||||
import org.w3c.dom.DOMErrorHandler;
|
||||
import org.w3c.dom.DOMLocator;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.bootstrap.DOMImplementationRegistry;
|
||||
import org.w3c.dom.ls.DOMImplementationLS;
|
||||
import org.w3c.dom.ls.LSInput;
|
||||
|
||||
/**
|
||||
* Provides utility functions for xml schema parsing.
|
||||
*/
|
||||
public class SchemaUtil
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static class Occurrence
|
||||
{
|
||||
public final static int UNBOUNDED = -1;
|
||||
|
||||
public final int minimum;
|
||||
public final int maximum;
|
||||
|
||||
public Occurrence(final XSParticle particle)
|
||||
{
|
||||
this(particle.getMinOccurs(), (particle.getMaxOccursUnbounded()
|
||||
? Occurrence.UNBOUNDED
|
||||
: particle.getMaxOccurs()));
|
||||
}
|
||||
|
||||
public Occurrence(final int minimum)
|
||||
{
|
||||
this(minimum, Occurrence.UNBOUNDED);
|
||||
}
|
||||
|
||||
public Occurrence(final int minimum, final int maximum)
|
||||
{
|
||||
this.minimum = minimum;
|
||||
this.maximum = maximum;
|
||||
}
|
||||
|
||||
public boolean isRepeated()
|
||||
{
|
||||
return this.isUnbounded() || this.maximum > 1;
|
||||
}
|
||||
|
||||
public boolean isOptional()
|
||||
{
|
||||
return this.minimum == 0 && this.maximum == 1;
|
||||
}
|
||||
|
||||
public boolean isUnbounded()
|
||||
{
|
||||
return this.maximum == UNBOUNDED;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "minimum=" + minimum + ", maximum=" + maximum;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private final static Comparator<XSTypeDefinition> TYPE_EXTENSION_SORTER =
|
||||
new Comparator<XSTypeDefinition>()
|
||||
{
|
||||
public int compare(final XSTypeDefinition type1, final XSTypeDefinition type2)
|
||||
{
|
||||
int result = 0;
|
||||
if (type1 == null && type2 != null)
|
||||
{
|
||||
result = -1;
|
||||
}
|
||||
else if (type1 != null && type2 == null)
|
||||
{
|
||||
result = 1;
|
||||
}
|
||||
else if (type1 == type2 || (type1 == null && type2 == null))
|
||||
{
|
||||
result = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = (type1.derivedFromType(type2, XSConstants.DERIVATION_EXTENSION)
|
||||
? 1
|
||||
: (type2.derivedFromType(type1, XSConstants.DERIVATION_EXTENSION)
|
||||
? -1
|
||||
: type1.getName().compareTo(type2.getName())));
|
||||
}
|
||||
if (LOGGER.isDebugEnabled() && false)
|
||||
LOGGER.debug("compare(" + type1 + ", " + type2 + ") = " + result);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private final static Log LOGGER = LogFactory.getLog(SchemaUtil.class);
|
||||
|
||||
private final static HashMap<Short, String> DATA_TYPE_TO_NAME =
|
||||
new HashMap<Short, String>();
|
||||
static
|
||||
{
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.ANYSIMPLETYPE_DT, "anyType");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.ANYURI_DT, "anyURI");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.BASE64BINARY_DT, "base64Binary");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.BOOLEAN_DT, "boolean");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.BYTE_DT, "byte");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.DATETIME_DT, "dateTime");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.DATE_DT, "date");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.DECIMAL_DT, "decimal");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.DOUBLE_DT, "double");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.DURATION_DT, "duration");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.ENTITY_DT, "ENTITY");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.FLOAT_DT, "float");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.GDAY_DT, "gDay");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.GMONTHDAY_DT, "gMonthDay");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.GMONTH_DT, "gMonth");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.GYEARMONTH_DT, "gYearMonth");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.GYEAR_DT, "gYear");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.IDREF_DT, "IDREF");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.ID_DT, "ID");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.INTEGER_DT, "integer");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.INT_DT, "int");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.LANGUAGE_DT, "language");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.LONG_DT, "long");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.NAME_DT, "Name");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.NCNAME_DT, "NCName");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.NEGATIVEINTEGER_DT, "negativeInteger");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.NMTOKEN_DT, "NMTOKEN");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.NONNEGATIVEINTEGER_DT, "nonNegativeInteger");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.NONPOSITIVEINTEGER_DT, "nonPositiveInteger");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.NORMALIZEDSTRING_DT, "normalizedString");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.NOTATION_DT, "NOTATION");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.POSITIVEINTEGER_DT, "positiveInteger");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.QNAME_DT, "QName");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.SHORT_DT, "short");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.STRING_DT, "string");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.TIME_DT, "time");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.TOKEN_DT, "TOKEN");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.UNSIGNEDBYTE_DT, "unsignedByte");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.UNSIGNEDINT_DT, "unsignedInt");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.UNSIGNEDLONG_DT, "unsignedLong");
|
||||
SchemaUtil.DATA_TYPE_TO_NAME.put(XSConstants.UNSIGNEDSHORT_DT, "unsignedShort");
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the most-specific built-in base type for the provided type.
|
||||
*/
|
||||
public static short getBuiltInType(final XSTypeDefinition type)
|
||||
{
|
||||
// type.getName() may be 'null' for anonymous types, so compare against
|
||||
// static string (see bug #1172541 on sf.net)
|
||||
if (SchemaUtil.DATA_TYPE_TO_NAME.get(XSConstants.ANYSIMPLETYPE_DT).equals(type.getName()))
|
||||
{
|
||||
return XSConstants.ANYSIMPLETYPE_DT;
|
||||
}
|
||||
final XSSimpleTypeDefinition simpleType = (XSSimpleTypeDefinition) type;
|
||||
final short result = simpleType.getBuiltInKind();
|
||||
return (result == XSConstants.LIST_DT
|
||||
? SchemaUtil.getBuiltInType(simpleType.getItemType())
|
||||
: result);
|
||||
}
|
||||
|
||||
public static String getBuiltInTypeName(final XSTypeDefinition type)
|
||||
{
|
||||
final short s = SchemaUtil.getBuiltInType(type);
|
||||
return SchemaUtil.getBuiltInTypeName(s);
|
||||
}
|
||||
|
||||
public static String getBuiltInTypeName(final short type)
|
||||
{
|
||||
return SchemaUtil.DATA_TYPE_TO_NAME.get(type);
|
||||
}
|
||||
|
||||
public static XSModel parseSchema(final Document schemaDocument,
|
||||
final boolean failOnError)
|
||||
throws FormBuilderException
|
||||
{
|
||||
try
|
||||
{
|
||||
// Get DOM Implementation using DOM Registry
|
||||
System.setProperty(DOMImplementationRegistry.PROPERTY,
|
||||
"org.apache.xerces.dom.DOMXSImplementationSourceImpl");
|
||||
|
||||
final DOMImplementationRegistry registry =
|
||||
DOMImplementationRegistry.newInstance();
|
||||
|
||||
final DOMImplementationLS lsImpl = (DOMImplementationLS)
|
||||
registry.getDOMImplementation("XML 1.0 LS 3.0");
|
||||
if (lsImpl == null)
|
||||
{
|
||||
throw new FormBuilderException("unable to create DOMImplementationLS using " + registry);
|
||||
}
|
||||
final LSInput in = lsImpl.createLSInput();
|
||||
in.setStringData(XMLUtil.toString(schemaDocument));
|
||||
|
||||
final XSImplementation xsImpl = (XSImplementation)
|
||||
registry.getDOMImplementation("XS-Loader");
|
||||
final XSLoader schemaLoader = xsImpl.createXSLoader(null);
|
||||
final DOMConfiguration config = (DOMConfiguration)schemaLoader.getConfig();
|
||||
final LinkedList<DOMError> errors = new LinkedList<DOMError>();
|
||||
config.setParameter("error-handler", new DOMErrorHandler()
|
||||
{
|
||||
public boolean handleError(final DOMError domError)
|
||||
{
|
||||
errors.add(domError);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
final XSModel result = schemaLoader.load(in);
|
||||
if (failOnError && errors.size() != 0)
|
||||
{
|
||||
final HashSet<String> messages = new HashSet<String>();
|
||||
StringBuilder message = null;
|
||||
for (DOMError e : errors)
|
||||
{
|
||||
message = new StringBuilder();
|
||||
final DOMLocator dl = e.getLocation();
|
||||
if (dl != null)
|
||||
{
|
||||
message.append("at line ").append(dl.getLineNumber())
|
||||
.append(" column ").append(dl.getColumnNumber());
|
||||
if (dl.getRelatedNode() != null)
|
||||
{
|
||||
message.append(" node ").append(dl.getRelatedNode().getNodeName());
|
||||
}
|
||||
message.append(": ").append(e.getMessage());
|
||||
}
|
||||
messages.add(message.toString());
|
||||
}
|
||||
|
||||
message = new StringBuilder();
|
||||
message.append(messages.size() > 1 ? "errors" : "error").append(" parsing schema: \n");
|
||||
for (final String s : messages)
|
||||
{
|
||||
message.append(s).append("\n");
|
||||
}
|
||||
|
||||
throw new FormBuilderException(message.toString());
|
||||
}
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
throw new FormBuilderException("invalid schema");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
catch (ClassNotFoundException x)
|
||||
{
|
||||
throw new FormBuilderException(x);
|
||||
}
|
||||
catch (InstantiationException x)
|
||||
{
|
||||
throw new FormBuilderException(x);
|
||||
}
|
||||
catch (IllegalAccessException x)
|
||||
{
|
||||
throw new FormBuilderException(x);
|
||||
}
|
||||
}
|
||||
|
||||
private static void buildTypeTree(final XSTypeDefinition type,
|
||||
final TreeSet<XSTypeDefinition> descendents,
|
||||
final TreeMap<String, TreeSet<XSTypeDefinition>> typeTree)
|
||||
{
|
||||
if (type == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("buildTypeTree(" + type.getName() + ", " + descendents.size() + " descendents)");
|
||||
if (descendents.size() > 0)
|
||||
{
|
||||
TreeSet<XSTypeDefinition> compatibleTypes = typeTree.get(type.getName());
|
||||
|
||||
if (compatibleTypes == null)
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("no compatible types found for " + type.getName() + ", creating a new set");
|
||||
compatibleTypes = new TreeSet<XSTypeDefinition>(TYPE_EXTENSION_SORTER);
|
||||
typeTree.put(type.getName(), compatibleTypes);
|
||||
}
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("adding " + descendents.size() + " descendents to " + type.getName());
|
||||
compatibleTypes.addAll(descendents);
|
||||
}
|
||||
|
||||
final XSTypeDefinition parentType = type.getBaseType();
|
||||
if (parentType == null ||
|
||||
type.getTypeCategory() != parentType.getTypeCategory())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (type != parentType && parentType.getName() != null && !parentType.getName().equals("anyType"))
|
||||
{
|
||||
TreeSet<XSTypeDefinition> newDescendents = typeTree.get(parentType.getName());
|
||||
if (newDescendents == null)
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("type tree doesn't contain " + parentType.getName() +
|
||||
", creating a new descendant set");
|
||||
newDescendents = new TreeSet<XSTypeDefinition>(TYPE_EXTENSION_SORTER);
|
||||
}
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("adding " + descendents.size() + " descendants to existing " + newDescendents.size() +
|
||||
" descendants of " + parentType.getName());
|
||||
newDescendents.addAll(descendents);
|
||||
|
||||
//extension (we only add it to "newDescendants" because we don't want
|
||||
//to have a type descendant to itself, but to consider it for the parent
|
||||
if (type.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE)
|
||||
{
|
||||
final XSComplexTypeDefinition complexType = (XSComplexTypeDefinition)type;
|
||||
if (complexType.getDerivationMethod() == XSConstants.DERIVATION_EXTENSION &&
|
||||
!complexType.getAbstract() &&
|
||||
!descendents.contains(type))
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("adding " + type.getName() +
|
||||
" to existing " + newDescendents.size() +
|
||||
" descendents of " + parentType.getName());
|
||||
newDescendents.add(type);
|
||||
}
|
||||
}
|
||||
|
||||
//note: extensions are impossible on simpleTypes !
|
||||
SchemaUtil.buildTypeTree(parentType, newDescendents, typeTree);
|
||||
}
|
||||
}
|
||||
|
||||
public static TreeMap<String, TreeSet<XSTypeDefinition>>
|
||||
buildTypeTree(final XSModel schema)
|
||||
{
|
||||
final TreeMap<String, TreeSet<XSTypeDefinition>> result = new TreeMap<String, TreeSet<XSTypeDefinition>>();
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("buildTypeTree " + schema);
|
||||
// build the type tree for complex types
|
||||
final XSNamedMap types = schema.getComponents(XSConstants.TYPE_DEFINITION);
|
||||
for (int i = 0; i < types.getLength(); i++)
|
||||
{
|
||||
final XSTypeDefinition t = (XSTypeDefinition)types.item(i);
|
||||
if (t.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE)
|
||||
{
|
||||
final XSComplexTypeDefinition type = (XSComplexTypeDefinition)t;
|
||||
SchemaUtil.buildTypeTree(type,
|
||||
new TreeSet<XSTypeDefinition>(TYPE_EXTENSION_SORTER),
|
||||
result);
|
||||
}
|
||||
}
|
||||
|
||||
// build the type tree for simple types
|
||||
for (int i = 0; i < types.getLength(); i++)
|
||||
{
|
||||
final XSTypeDefinition t = (XSTypeDefinition)types.item(i);
|
||||
if (t.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE)
|
||||
{
|
||||
SchemaUtil.buildTypeTree((XSSimpleTypeDefinition)t,
|
||||
new TreeSet<XSTypeDefinition>(TYPE_EXTENSION_SORTER),
|
||||
result);
|
||||
}
|
||||
}
|
||||
|
||||
// print out type hierarchy for debugging purposes
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
for (String typeName : result.keySet())
|
||||
{
|
||||
TreeSet<XSTypeDefinition> descendents = result.get(typeName);
|
||||
LOGGER.debug(">>>> for " + typeName + " Descendants=\n ");
|
||||
Iterator<XSTypeDefinition> it = descendents.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
XSTypeDefinition desc = it.next();
|
||||
LOGGER.debug(" " + desc.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static XSParticle findCorrespondingParticleInComplexType(final XSElementDeclaration elDecl)
|
||||
{
|
||||
final XSComplexTypeDefinition complexType = elDecl.getEnclosingCTDefinition();
|
||||
if (complexType == null)
|
||||
{
|
||||
LOGGER.warn("unable to find corresponding particle for " + elDecl.getName() +
|
||||
". no enclosing complex type.");
|
||||
return null;
|
||||
}
|
||||
|
||||
final XSParticle particle = complexType.getParticle();
|
||||
final XSTerm term = particle.getTerm();
|
||||
if (! (term instanceof XSModelGroup))
|
||||
{
|
||||
LOGGER.warn("unable to find corresponding particle for " + elDecl.getName() +
|
||||
". term " + term + " is not a model group.");
|
||||
return null;
|
||||
}
|
||||
final XSParticle result = SchemaUtil.findCorrespondingParticleInModelGroup((XSModelGroup)term, elDecl);
|
||||
if (result == null)
|
||||
{
|
||||
final String msg = ("unable to find corresponding particle for " + elDecl.getName() +
|
||||
" in term " + term);
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
throw new NullPointerException(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.warn(msg);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static XSParticle findCorrespondingParticleInModelGroup(final XSModelGroup modelGroup,
|
||||
final XSElementDeclaration elDecl)
|
||||
{
|
||||
final XSObjectList particles = modelGroup.getParticles();
|
||||
if (particles == null || particles.getLength() == 0)
|
||||
{
|
||||
LOGGER.debug("unable to find corresponding particle for " + elDecl.getName() +
|
||||
". group " + modelGroup + " contains no particles.");
|
||||
return null;
|
||||
}
|
||||
|
||||
for (int i = 0; i < particles.getLength(); i++)
|
||||
{
|
||||
XSParticle part = (XSParticle)particles.item(i);
|
||||
final XSTerm thisTerm = part.getTerm();
|
||||
if (thisTerm instanceof XSModelGroup)
|
||||
{
|
||||
part = SchemaUtil.findCorrespondingParticleInModelGroup((XSModelGroup)thisTerm, elDecl);
|
||||
if (part != null)
|
||||
{
|
||||
return part;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("checking term " + thisTerm.getName() +
|
||||
" in " + modelGroup.getName() + "(" + modelGroup.getClass().getName() + ")");
|
||||
}
|
||||
if (thisTerm == elDecl)
|
||||
{
|
||||
return part;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("unable to find corresponding particle for " + elDecl.getName() +
|
||||
". " + elDecl.getName() +
|
||||
" not found in " + particles.getLength() + " particles");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* check that the element defined by this name is declared directly in the type
|
||||
*/
|
||||
public static boolean isElementDeclaredIn(String name, String namespace,
|
||||
XSComplexTypeDefinition type,
|
||||
boolean recursive)
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("isElement " + name + " declared in " + type.getName());
|
||||
}
|
||||
|
||||
//test if extension + declared in parent + not recursive -> NOK
|
||||
if (!recursive && type.getDerivationMethod() == XSConstants.DERIVATION_EXTENSION)
|
||||
{
|
||||
XSComplexTypeDefinition parent = (XSComplexTypeDefinition) type.getBaseType();
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("testing if it is not on parent " + parent.getName());
|
||||
if (SchemaUtil.isElementDeclaredIn(name, namespace, parent, true))
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean found = false;
|
||||
XSParticle particle = type.getParticle();
|
||||
if (particle != null)
|
||||
{
|
||||
XSTerm term = particle.getTerm();
|
||||
if (term instanceof XSModelGroup)
|
||||
{
|
||||
XSModelGroup group = (XSModelGroup) term;
|
||||
found = SchemaUtil.isElementDeclaredIn(name, namespace, group);
|
||||
}
|
||||
}
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("isElement " + name +
|
||||
" declared in " + type.getName() + ": " + found);
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
/**
|
||||
* private recursive method called by isElementDeclaredIn(String name, XSComplexTypeDefinition type)
|
||||
*/
|
||||
public static boolean isElementDeclaredIn(String name, String namespace, XSModelGroup group)
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("isElement " + name + " declared in group " + group.getName());
|
||||
|
||||
boolean found = false;
|
||||
XSObjectList particles = group.getParticles();
|
||||
for (int i = 0; i < particles.getLength(); i++)
|
||||
{
|
||||
XSParticle subPart = (XSParticle)particles.item(i);
|
||||
XSTerm subTerm = subPart.getTerm();
|
||||
if (subTerm instanceof XSElementDeclaration)
|
||||
{
|
||||
XSElementDeclaration elDecl = (XSElementDeclaration) subTerm;
|
||||
if (EqualsHelper.nullSafeEquals(namespace, elDecl.getNamespace()) && name.equals(elDecl.getName()))
|
||||
found = true;
|
||||
}
|
||||
else if (subTerm instanceof XSModelGroup)
|
||||
{
|
||||
found = SchemaUtil.isElementDeclaredIn(name, namespace, (XSModelGroup) subTerm);
|
||||
}
|
||||
}
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("isElement " + name + " declared in group " + group.getName() + ": " + found);
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
public static boolean doesElementComeFromExtension(final XSElementDeclaration element,
|
||||
final XSComplexTypeDefinition controlType)
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("doesElementComeFromExtension for " + element.getName() +
|
||||
" and controlType=" + controlType.getName());
|
||||
}
|
||||
if (controlType.getDerivationMethod() == XSConstants.DERIVATION_EXTENSION)
|
||||
{
|
||||
final XSTypeDefinition baseType = controlType.getBaseType();
|
||||
if (baseType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE)
|
||||
{
|
||||
final XSComplexTypeDefinition complexType = (XSComplexTypeDefinition) baseType;
|
||||
if (SchemaUtil.isElementDeclaredIn(element.getName(), element.getNamespace(), complexType, true))
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("doesElementComeFromExtension: yes");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("doesElementComeFromExtension: recursive call on previous level");
|
||||
}
|
||||
return SchemaUtil.doesElementComeFromExtension(element, complexType);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* check that the element defined by this name is declared directly in the type
|
||||
*/
|
||||
public static boolean isAttributeDeclaredIn(final XSAttributeUse attr,
|
||||
final XSComplexTypeDefinition type,
|
||||
final boolean recursive)
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("is Attribute " + attr.getAttrDeclaration().getName() + " declared in " + type.getName());
|
||||
}
|
||||
|
||||
//check on parent if not recursive
|
||||
if (!recursive && type.getDerivationMethod() == XSConstants.DERIVATION_EXTENSION)
|
||||
{
|
||||
XSComplexTypeDefinition parent = (XSComplexTypeDefinition) type.getBaseType();
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("testing if it is not on parent " + parent.getName());
|
||||
}
|
||||
if (SchemaUtil.isAttributeDeclaredIn(attr, parent, true))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//check on this type (also checks recursively)
|
||||
boolean found = false;
|
||||
final XSObjectList attrs = type.getAttributeUses();
|
||||
for (int i = 0; i < attrs.getLength(); i++)
|
||||
{
|
||||
if ((XSAttributeUse)attrs.item(i) == attr)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("is Attribute " + attr.getName() +
|
||||
" declared in " + type.getName() + ": " + found);
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
/**
|
||||
* check that the element defined by this name is declared directly in the type
|
||||
* -> idem with string
|
||||
*/
|
||||
public static boolean isAttributeDeclaredIn(String attrName, String namespace, XSComplexTypeDefinition type, boolean recursive)
|
||||
{
|
||||
boolean found = false;
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("is Attribute " + attrName + " declared in " + type.getName());
|
||||
|
||||
if (attrName.startsWith("@"))
|
||||
attrName = attrName.substring(1);
|
||||
|
||||
//check on parent if not recursive
|
||||
if (!recursive && type.getDerivationMethod() == XSConstants.DERIVATION_EXTENSION)
|
||||
{
|
||||
XSComplexTypeDefinition parent = (XSComplexTypeDefinition) type.getBaseType();
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("testing if it is not on parent " + parent.getName());
|
||||
if (SchemaUtil.isAttributeDeclaredIn(attrName, namespace, parent, true))
|
||||
return false;
|
||||
}
|
||||
|
||||
//check on this type (also checks recursively)
|
||||
final XSObjectList attrs = type.getAttributeUses();
|
||||
for (int i = 0; i < attrs.getLength() && !found; i++)
|
||||
{
|
||||
final XSAttributeUse anAttr = (XSAttributeUse) attrs.item(i);
|
||||
if (anAttr != null)
|
||||
{
|
||||
String name = anAttr.getName();
|
||||
if (name == null || name.length() == 0)
|
||||
name = anAttr.getAttrDeclaration().getName();
|
||||
if (EqualsHelper.nullSafeEquals(namespace, anAttr.getAttrDeclaration().getNamespace()) && attrName.equals(name))
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("is Attribute " + attrName + " declared in " + type.getName() + ": " + found);
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
public static boolean doesAttributeComeFromExtension(XSAttributeUse attr,
|
||||
XSComplexTypeDefinition controlType)
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("doesAttributeComeFromExtension for " + attr.getAttrDeclaration().getName() +
|
||||
" and controlType=" + controlType.getName());
|
||||
}
|
||||
|
||||
if (controlType.getDerivationMethod() != XSConstants.DERIVATION_EXTENSION)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final XSTypeDefinition baseType = controlType.getBaseType();
|
||||
if (baseType.getTypeCategory() != XSTypeDefinition.COMPLEX_TYPE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final XSComplexTypeDefinition complexType = (XSComplexTypeDefinition) baseType;
|
||||
if (SchemaUtil.isAttributeDeclaredIn(attr, complexType, true))
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("doesAttributeComeFromExtension: yes");
|
||||
return true;
|
||||
}
|
||||
|
||||
//recursive call
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("doesAttributeComeFromExtension: recursive call on previous level");
|
||||
return SchemaUtil.doesAttributeComeFromExtension(attr, complexType);
|
||||
}
|
||||
|
||||
/**
|
||||
* finds the minOccurs and maxOccurs of an element declaration
|
||||
*
|
||||
* @return a table containing minOccurs and MaxOccurs
|
||||
*/
|
||||
public static Occurrence getOccurrence(final XSElementDeclaration elDecl)
|
||||
{
|
||||
//get occurance on encosing element declaration
|
||||
final XSParticle particle =
|
||||
SchemaUtil.findCorrespondingParticleInComplexType(elDecl);
|
||||
final Occurrence result = particle == null ? new Occurrence(1, 1) : new Occurrence(particle);
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("getOccurrence for " + elDecl.getName() +
|
||||
", " + result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
@@ -1,926 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.web.forms.xforms;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
import javax.faces.context.ExternalContext;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.context.ResponseWriter;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.alfresco.util.XMLUtil;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.NavigationBean;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.forms.Form;
|
||||
import org.alfresco.web.forms.FormProcessor;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.xerces.xs.XSModel;
|
||||
import org.chiba.xml.events.ChibaEventNames;
|
||||
import org.chiba.xml.events.DOMEventNames;
|
||||
import org.chiba.xml.events.XFormsEventNames;
|
||||
import org.chiba.xml.events.XMLEvent;
|
||||
import org.chiba.xml.ns.NamespaceConstants;
|
||||
import org.chiba.xml.xforms.ChibaBean;
|
||||
import org.chiba.xml.xforms.connector.AbstractConnector;
|
||||
import org.chiba.xml.xforms.connector.SubmissionHandler;
|
||||
import org.chiba.xml.xforms.core.Instance;
|
||||
import org.chiba.xml.xforms.core.Model;
|
||||
import org.chiba.xml.xforms.core.ModelItem;
|
||||
import org.chiba.xml.xforms.core.Submission;
|
||||
import org.chiba.xml.xforms.core.impl.DefaultValidatorMode;
|
||||
import org.chiba.xml.xforms.exception.XFormsException;
|
||||
import org.chiba.xml.xforms.ui.RepeatItem;
|
||||
import org.chiba.xml.xforms.ui.Upload;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.w3c.dom.events.Event;
|
||||
import org.w3c.dom.events.EventListener;
|
||||
import org.w3c.dom.events.EventTarget;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
|
||||
/**
|
||||
* Bean for interacting with the chiba processor from the ui using ajax requests.
|
||||
* Manages the chiba bean lifecycle.
|
||||
*/
|
||||
public class XFormsBean implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = -7979077333882370784L;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static class AlfrescoSubmissionHandler
|
||||
extends AbstractConnector
|
||||
implements SubmissionHandler
|
||||
{
|
||||
|
||||
public Map submit(final Submission submission,
|
||||
final Node instance)
|
||||
throws XFormsException
|
||||
{
|
||||
if (XFormsBean.LOGGER.isDebugEnabled())
|
||||
{
|
||||
XFormsBean.LOGGER.debug(this.getClass().getName() +
|
||||
" recieved submission " + XMLUtil.toString(instance, true));
|
||||
}
|
||||
final FacesContext fc = FacesContext.getCurrentInstance();
|
||||
//make the XFormsBean available for this session
|
||||
final XFormsBean xforms = (XFormsBean)FacesHelper.getManagedBean(fc, BEAN_NAME);
|
||||
xforms.handleSubmit(instance);
|
||||
return Collections.EMPTY_MAP;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
*/
|
||||
class XFormsSession implements FormProcessor.Session
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final Document formInstanceData;
|
||||
private final String formInstanceDataName;
|
||||
private final Form form;
|
||||
|
||||
private ChibaBean chibaBean;
|
||||
private final Schema2XForms schema2XForms;
|
||||
private final List<XMLEvent> eventLog = new LinkedList<XMLEvent>();
|
||||
|
||||
public XFormsSession(final Document formInstanceData,
|
||||
final String formInstanceDataName,
|
||||
final Form form,
|
||||
final String baseUrl,
|
||||
final boolean formatCaption)
|
||||
{
|
||||
this.formInstanceData = formInstanceData;
|
||||
this.formInstanceDataName = formInstanceDataName;
|
||||
this.form = form;
|
||||
this.schema2XForms = new Schema2XForms(/* "/ajax/invoke/XFormsBean.handleAction" */ null,
|
||||
Schema2XForms.SubmitMethod.POST,
|
||||
/* baseUrl */ "alfresco:" + XFormsBean.class.getName(), formatCaption);
|
||||
}
|
||||
|
||||
public void destroy()
|
||||
{
|
||||
try
|
||||
{
|
||||
this.chibaBean.shutdown();
|
||||
}
|
||||
catch (XFormsException xfe)
|
||||
{
|
||||
LOGGER.debug(xfe);
|
||||
}
|
||||
}
|
||||
|
||||
public Form getForm()
|
||||
{
|
||||
return this.form;
|
||||
}
|
||||
|
||||
public Document getFormInstanceData()
|
||||
{
|
||||
return this.formInstanceData;
|
||||
}
|
||||
|
||||
public String getFormInstanceDataName()
|
||||
{
|
||||
return this.formInstanceDataName;
|
||||
}
|
||||
|
||||
public Schema2XForms getSchema2XForms()
|
||||
{
|
||||
return this.schema2XForms;
|
||||
}
|
||||
|
||||
public ChibaBean getChibaBean()
|
||||
{
|
||||
return this.chibaBean;
|
||||
}
|
||||
|
||||
public List<XMLEvent> getEventLog()
|
||||
{
|
||||
return this.eventLog;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private static final Log LOGGER = LogFactory.getLog(XFormsBean.class);
|
||||
|
||||
private XFormsSession xformsSession;
|
||||
private transient Schema2XFormsProperties schema2XFormsProperties;
|
||||
// private AVMBrowseBean avmBrowseBean; // WCM
|
||||
private NavigationBean navigator;
|
||||
// lock for XFormSession.eventLog
|
||||
private ReentrantReadWriteLock rwLock = new ReentrantReadWriteLock();
|
||||
private Lock writeLock = rwLock.writeLock();
|
||||
private Lock readLock = rwLock.readLock();
|
||||
|
||||
public static String BEAN_NAME = "XFormsBean";
|
||||
|
||||
public XFormsSession getXformsSession()
|
||||
{
|
||||
if (this.xformsSession == null)
|
||||
{
|
||||
throw new IllegalStateException("Incomplete user session. Please restart the form.");
|
||||
}
|
||||
return this.xformsSession;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param schema2XFormsProperties the schema2XFormsProperties to set.
|
||||
*/
|
||||
public void setSchema2XFormsProperties(final Schema2XFormsProperties schema2XFormsProperties)
|
||||
{
|
||||
this.schema2XFormsProperties = schema2XFormsProperties;
|
||||
}
|
||||
|
||||
protected Schema2XFormsProperties getSchema2XFormsProperties()
|
||||
{
|
||||
if (schema2XFormsProperties == null)
|
||||
{
|
||||
schema2XFormsProperties = (Schema2XFormsProperties)FacesHelper.getManagedBean(
|
||||
FacesContext.getCurrentInstance(), "Schema2XFormsProperties");
|
||||
}
|
||||
return schema2XFormsProperties;
|
||||
}
|
||||
|
||||
// // WCM
|
||||
// /**
|
||||
// * @param avmBrowseBean the avmBrowseBean to set.
|
||||
// */
|
||||
// public void setAvmBrowseBean(final AVMBrowseBean avmBrowseBean)
|
||||
// {
|
||||
// this.avmBrowseBean = avmBrowseBean;
|
||||
// }
|
||||
//
|
||||
// public void setNavigator(final NavigationBean navigator)
|
||||
// {
|
||||
// this.navigator = navigator;
|
||||
// }
|
||||
//
|
||||
/** @param xformsSession the current session */
|
||||
public void setXFormsSession(final XFormsSession xformsSession)
|
||||
throws FormBuilderException,
|
||||
XFormsException
|
||||
{
|
||||
this.xformsSession = xformsSession;
|
||||
|
||||
final FacesContext facesContext = FacesContext.getCurrentInstance();
|
||||
final ExternalContext externalContext = facesContext.getExternalContext();
|
||||
final HttpServletRequest request = (HttpServletRequest)
|
||||
externalContext.getRequest();
|
||||
final ServletContext servletContext = (ServletContext)
|
||||
externalContext.getContext();
|
||||
|
||||
writeLock.lock();
|
||||
try
|
||||
{
|
||||
final ChibaBean chibaBean = new ChibaBean();
|
||||
chibaBean.setConfig(servletContext.getRealPath("/WEB-INF/chiba.xml"));
|
||||
Pair<Document, XSModel> chibaPair = this.getXFormsDocument();
|
||||
chibaBean.setXMLContainer(chibaPair.getFirst(), chibaPair.getSecond());
|
||||
|
||||
final EventTarget et = (EventTarget)
|
||||
chibaBean.getXMLContainer().getDocumentElement();
|
||||
final EventListener el = new EventListener()
|
||||
{
|
||||
public void handleEvent(final Event e)
|
||||
{
|
||||
final XMLEvent xmle = (XMLEvent)e;
|
||||
if (XFormsBean.LOGGER.isDebugEnabled())
|
||||
XFormsBean.LOGGER.debug("received event " + xmle.getType() + ": " + xmle);
|
||||
|
||||
XFormsBean.this.xformsSession.eventLog.add(xmle);
|
||||
}
|
||||
};
|
||||
|
||||
// interaction events my occur during init so we have to register before
|
||||
et.addEventListener(ChibaEventNames.LOAD_URI, el, true);
|
||||
et.addEventListener(ChibaEventNames.RENDER_MESSAGE, el, true);
|
||||
et.addEventListener(ChibaEventNames.REPLACE_ALL, el, true);
|
||||
|
||||
et.addEventListener(XFormsEventNames.ENABLED, el, true);
|
||||
et.addEventListener(XFormsEventNames.DISABLED, el, true);
|
||||
et.addEventListener(XFormsEventNames.REQUIRED, el, true);
|
||||
et.addEventListener(XFormsEventNames.OPTIONAL, el, true);
|
||||
et.addEventListener(XFormsEventNames.READONLY, el, true);
|
||||
et.addEventListener(XFormsEventNames.READWRITE, el, true);
|
||||
et.addEventListener(XFormsEventNames.VALID, el, true);
|
||||
et.addEventListener(XFormsEventNames.INVALID, el, true);
|
||||
et.addEventListener(XFormsEventNames.IN_RANGE, el, true);
|
||||
et.addEventListener(XFormsEventNames.OUT_OF_RANGE, el, true);
|
||||
et.addEventListener(XFormsEventNames.SELECT, el, true);
|
||||
et.addEventListener(XFormsEventNames.DESELECT, el, true);
|
||||
et.addEventListener(XFormsEventNames.INSERT, el, true);
|
||||
et.addEventListener(XFormsEventNames.DELETE, el, true);
|
||||
|
||||
chibaBean.init();
|
||||
|
||||
// register for notification events
|
||||
et.addEventListener(XFormsEventNames.SUBMIT, el, true);
|
||||
et.addEventListener(XFormsEventNames.SUBMIT_DONE, el, true);
|
||||
et.addEventListener(XFormsEventNames.SUBMIT_ERROR, el, true);
|
||||
et.addEventListener(ChibaEventNames.STATE_CHANGED, el, true);
|
||||
et.addEventListener(ChibaEventNames.PROTOTYPE_CLONED, el, true);
|
||||
et.addEventListener(ChibaEventNames.ID_GENERATED, el, true);
|
||||
et.addEventListener(ChibaEventNames.ITEM_INSERTED, el, true);
|
||||
et.addEventListener(ChibaEventNames.ITEM_DELETED, el, true);
|
||||
et.addEventListener(ChibaEventNames.INDEX_CHANGED, el, true);
|
||||
et.addEventListener(ChibaEventNames.SWITCH_TOGGLED, el, true);
|
||||
this.xformsSession.chibaBean = chibaBean;
|
||||
}
|
||||
finally
|
||||
{
|
||||
writeLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the chiba process with the xform and registers any necessary
|
||||
* event listeners.
|
||||
*/
|
||||
public XFormsSession createSession(final Document formInstanceData,
|
||||
final String formInstanceDataName,
|
||||
final Form form)
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("initializing xforms session with form " + form.getName() +
|
||||
" and instance data " + formInstanceDataName +
|
||||
" (" + formInstanceData + ")");
|
||||
}
|
||||
|
||||
final FacesContext facesContext = FacesContext.getCurrentInstance();
|
||||
final ExternalContext externalContext = facesContext.getExternalContext();
|
||||
final HttpServletRequest request = (HttpServletRequest)
|
||||
externalContext.getRequest();
|
||||
|
||||
final String baseUrl = (request.getScheme() + "://" +
|
||||
request.getServerName() + ':' +
|
||||
request.getServerPort() +
|
||||
request.getContextPath());
|
||||
return this.new XFormsSession(formInstanceData, formInstanceDataName, form, baseUrl, getSchema2XFormsProperties().isFormatCaption());
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the xform out to the http servlet response. This allows
|
||||
* us to use the browser to parse the xform using XMLHttpRequest.
|
||||
*/
|
||||
public void getXForm() throws IOException, XFormsException
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug(this + ".getXForm()");
|
||||
final FacesContext context = FacesContext.getCurrentInstance();
|
||||
final ResponseWriter out = context.getResponseWriter();
|
||||
|
||||
readLock.lock();
|
||||
try
|
||||
{
|
||||
final ChibaBean chibaBean = this.getXformsSession().getChibaBean();
|
||||
final Node xformsDocument = chibaBean.getXMLContainer();
|
||||
XMLUtil.print(xformsDocument, out);
|
||||
}
|
||||
finally
|
||||
{
|
||||
readLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the value of a control in the processor.
|
||||
*/
|
||||
public void setXFormsValue() throws XFormsException, IOException
|
||||
{
|
||||
final FacesContext context = FacesContext.getCurrentInstance();
|
||||
final Map requestParameters = context.getExternalContext().getRequestParameterMap();
|
||||
final String id = (String)requestParameters.get("id");
|
||||
final String value = (String)requestParameters.get("value");
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug(this + ".setXFormsValue(" + id + ", " + value + ")");
|
||||
|
||||
writeLock.lock();
|
||||
try
|
||||
{
|
||||
final ChibaBean chibaBean = this.getXformsSession().getChibaBean();
|
||||
|
||||
if (chibaBean.getContainer().lookup(id) instanceof Upload)
|
||||
{
|
||||
chibaBean.updateControlValue(id, null, value, value.getBytes("UTF-8"));
|
||||
}
|
||||
else
|
||||
{
|
||||
chibaBean.updateControlValue(id, value);
|
||||
}
|
||||
final ResponseWriter out = context.getResponseWriter();
|
||||
XMLUtil.print(this.getEventLog(), out);
|
||||
out.close();
|
||||
}
|
||||
finally
|
||||
{
|
||||
writeLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the value of a control in the processor.
|
||||
*/
|
||||
public void setRepeatIndeces() throws XFormsException, IOException
|
||||
{
|
||||
final FacesContext context = FacesContext.getCurrentInstance();
|
||||
final Map requestParameters = context.getExternalContext().getRequestParameterMap();
|
||||
final String repeatIds = (String)requestParameters.get("repeatIds");
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug(this + ".setRepeatIndeces(" + repeatIds + ")");
|
||||
|
||||
writeLock.lock();
|
||||
try
|
||||
{
|
||||
for (String id : repeatIds.split(","))
|
||||
{
|
||||
final int index = Integer.parseInt((String)requestParameters.get(id));
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug(this + ".setRepeatIndex(" + id + ", " + index + ")");
|
||||
final ChibaBean chibaBean = this.getXformsSession().getChibaBean();
|
||||
chibaBean.updateRepeatIndex(id, index);
|
||||
}
|
||||
final ResponseWriter out = context.getResponseWriter();
|
||||
XMLUtil.print(this.getEventLog(), out);
|
||||
out.close();
|
||||
}
|
||||
finally
|
||||
{
|
||||
writeLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* fires an action associated with a trigger.
|
||||
*/
|
||||
public void fireAction() throws XFormsException, IOException
|
||||
{
|
||||
final FacesContext context = FacesContext.getCurrentInstance();
|
||||
final Map requestParameters = context.getExternalContext().getRequestParameterMap();
|
||||
final String id = (String)requestParameters.get("id");
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug(this + ".fireAction(" + id + ")");
|
||||
|
||||
writeLock.lock();
|
||||
try
|
||||
{
|
||||
final ChibaBean chibaBean = this.getXformsSession().getChibaBean();
|
||||
chibaBean.dispatch(id, DOMEventNames.ACTIVATE);
|
||||
|
||||
final ResponseWriter out = context.getResponseWriter();
|
||||
XMLUtil.print(this.getEventLog(), out);
|
||||
out.close();
|
||||
}
|
||||
finally
|
||||
{
|
||||
writeLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* handles submits and sets the instance data.
|
||||
*/
|
||||
public void handleAction()
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug(this + ".handleAction");
|
||||
try
|
||||
{
|
||||
final FacesContext context = FacesContext.getCurrentInstance();
|
||||
final HttpServletRequest request = (HttpServletRequest)
|
||||
context.getExternalContext().getRequest();
|
||||
final Document result = XMLUtil.parse(request.getInputStream());
|
||||
this.handleSubmit(result);
|
||||
final Document instanceData = this.getXformsSession().getFormInstanceData();
|
||||
final ResponseWriter out = context.getResponseWriter();
|
||||
XMLUtil.print(instanceData, out, false);
|
||||
out.close();
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
LOGGER.error(t.getMessage(), t);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleSubmit(Node result)
|
||||
{
|
||||
final Document instanceData = this.getXformsSession().getFormInstanceData();
|
||||
Element documentElement = instanceData.getDocumentElement();
|
||||
if (documentElement != null)
|
||||
{
|
||||
instanceData.removeChild(documentElement);
|
||||
}
|
||||
if (result instanceof Document)
|
||||
{
|
||||
result = ((Document)result).getDocumentElement();
|
||||
}
|
||||
documentElement = (Element)instanceData.importNode(result.cloneNode(true), true);
|
||||
Schema2XForms.removePrototypeNodes(documentElement);
|
||||
instanceData.appendChild(documentElement);
|
||||
instanceData.normalizeDocument();
|
||||
}
|
||||
|
||||
/**
|
||||
* Swaps model nodes to implement reordering within repeats.
|
||||
*/
|
||||
public void swapRepeatItems() throws Exception
|
||||
{
|
||||
final FacesContext context = FacesContext.getCurrentInstance();
|
||||
final Map requestParameters = context.getExternalContext().getRequestParameterMap();
|
||||
|
||||
final String fromItemId = (String)requestParameters.get("fromItemId");
|
||||
final String toItemId = (String)requestParameters.get("toItemId");
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug(this + ".swapRepeatItems(" + fromItemId + ", " + toItemId + ")");
|
||||
|
||||
writeLock.lock();
|
||||
try
|
||||
{
|
||||
final ChibaBean chibaBean = this.getXformsSession().getChibaBean();
|
||||
final RepeatItem from = (RepeatItem)chibaBean.getContainer().lookup(fromItemId);
|
||||
if (from == null)
|
||||
{
|
||||
throw new IllegalArgumentException("unable to find source repeat item " + fromItemId);
|
||||
}
|
||||
final RepeatItem to = (RepeatItem)chibaBean.getContainer().lookup(toItemId);
|
||||
if (to == null)
|
||||
{
|
||||
throw new IllegalArgumentException("unable to find destination repeat item " + toItemId);
|
||||
}
|
||||
|
||||
this.swapRepeatItems(from, to);
|
||||
|
||||
final ResponseWriter out = context.getResponseWriter();
|
||||
XMLUtil.print(this.getEventLog(), out);
|
||||
out.close();
|
||||
}
|
||||
finally
|
||||
{
|
||||
writeLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Introduced for ALF-10162 and ALF-10163
|
||||
* This method is used in JSF context to be able to validate last inserted values.
|
||||
* Note! This method clears event log. Do not use it for form validation during AJAX actions,
|
||||
* because this method doesn't return response.
|
||||
*
|
||||
* It is useful for Form validation, when Xform has been passed without AJAX "submit" action.
|
||||
* @see CreateWebContentWizard
|
||||
* @return
|
||||
*/
|
||||
public boolean isXformValid()
|
||||
{
|
||||
ChibaBean chibaBean = getXformsSession().getChibaBean();
|
||||
try
|
||||
{
|
||||
// throws XFormsException
|
||||
chibaBean.dispatch("submit", DOMEventNames.ACTIVATE);
|
||||
Node eventLogDoc = getEventLog();
|
||||
Node eventsNode = eventLogDoc.getFirstChild();
|
||||
if (eventsNode != null && "events".equals(eventsNode.getNodeName()))
|
||||
{
|
||||
NodeList childNodeList = eventsNode.getChildNodes();
|
||||
for(int i = 0; i < childNodeList.getLength(); i++)
|
||||
{
|
||||
Node childNode = childNodeList.item(i);
|
||||
if ("xforms-submit-error".equals(childNode.getNodeName()) &&
|
||||
childNode.getAttributes().getNamedItem("targetId") != null &&
|
||||
"submission-validate".equals(childNode.getAttributes().getNamedItem("targetId").getNodeValue()))
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("Found xforms-submit-error, it means that form wasn't validated, throwing error");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (XFormsException e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void swapRepeatItems(final RepeatItem from,
|
||||
final RepeatItem to)
|
||||
throws XFormsException
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("swapping repeat item " + from + " with " + to);
|
||||
LOGGER.debug("from instance id " + from.getInstanceId());
|
||||
}
|
||||
final Model model = from.getModel();
|
||||
final Instance instance = model.getInstance(from.getInstanceId());
|
||||
assert instance == to.getModel().getInstance(to.getInstanceId());
|
||||
final String fromLocationPath = from.getLocationPath();
|
||||
final String toLocationPath = to.getLocationPath();
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("from {id: " + from.getId() + ",position: " + from.getPosition() +
|
||||
"} " + fromLocationPath +
|
||||
"=" + instance.getModelItem(fromLocationPath).getValue());
|
||||
LOGGER.debug("to {id:" + to.getId() + ",position: " + to.getPosition() +
|
||||
"} " + toLocationPath +
|
||||
"=" + instance.getModelItem(toLocationPath).getValue());
|
||||
}
|
||||
|
||||
String beforeLocation = toLocationPath;
|
||||
final int toPosition = to.getPosition();
|
||||
if (from.getPosition() < toPosition)
|
||||
{
|
||||
final RepeatItem beforeItem = to.getRepeat().getRepeatItem(toPosition + 1);
|
||||
beforeLocation = (beforeItem != null
|
||||
? beforeItem.getLocationPath()
|
||||
: to.getRepeat().getLocationPath().replaceAll("\\[position\\(\\)[\\s]*!=[\\s]*last\\(\\)]$",
|
||||
"[position()=last()]"));
|
||||
}
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("inserting node before " + beforeLocation);
|
||||
instance.insertNode(fromLocationPath, beforeLocation);
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("deleting from " + from.getLocationPath());
|
||||
// need to reload from location path since it has moved
|
||||
instance.deleteNode(from.getLocationPath());
|
||||
|
||||
to.getRepeat().setIndex(toPosition);
|
||||
|
||||
model.getContainer().dispatch(model.getTarget(), XFormsEventNames.REBUILD, null);
|
||||
model.getContainer().dispatch(model.getTarget(), XFormsEventNames.RECALCULATE, null);
|
||||
model.getContainer().dispatch(model.getTarget(), XFormsEventNames.REVALIDATE, null);
|
||||
model.getContainer().dispatch(model.getTarget(), XFormsEventNames.REFRESH, null);
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("swapped model data, instance data after manipulation:\n " +
|
||||
XMLUtil.toString(instance.getInstanceDocument()));
|
||||
}
|
||||
}
|
||||
|
||||
private static void rewriteInlineURIs(final Document schemaDocument,
|
||||
final String cwdAvmPath)
|
||||
{
|
||||
final NodeList nl =
|
||||
XMLUtil.combine(schemaDocument.getElementsByTagNameNS(NamespaceConstants.XMLSCHEMA_NS, "include"),
|
||||
schemaDocument.getElementsByTagNameNS(NamespaceConstants.XMLSCHEMA_NS, "import"));
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("rewriting " + nl.getLength() + " includes");
|
||||
|
||||
for (int i = 0; i < nl.getLength(); i++)
|
||||
{
|
||||
final Element includeEl = (Element)nl.item(i);
|
||||
if (includeEl.hasAttribute("schemaLocation"))
|
||||
{
|
||||
String uri = includeEl.getAttribute("schemaLocation");
|
||||
String finalURI = null;
|
||||
|
||||
if (uri == null || uri.startsWith("http://") || uri.startsWith("https://"))
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("not rewriting " + uri);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (uri.startsWith("webscript://"))
|
||||
{
|
||||
// It's a web script include / import
|
||||
final FacesContext facesContext = FacesContext.getCurrentInstance();
|
||||
final ExternalContext externalContext = facesContext.getExternalContext();
|
||||
final HttpServletRequest request = (HttpServletRequest)externalContext.getRequest();
|
||||
|
||||
final String baseURI = (request.getScheme() + "://" +
|
||||
request.getServerName() + ':' +
|
||||
request.getServerPort() +
|
||||
request.getContextPath() + "/wcservice");
|
||||
String rewrittenURI = uri;
|
||||
|
||||
// // WCM
|
||||
// if (uri.contains("${storeid}"))
|
||||
// {
|
||||
// final String storeId = AVMUtil.getStoreName(cwdAvmPath);
|
||||
// rewrittenURI = uri.replace("${storeid}", storeId);
|
||||
// }
|
||||
// else if (uri.contains("{storeid}"))
|
||||
// {
|
||||
// final String storeId = AVMUtil.getStoreName(cwdAvmPath);
|
||||
// rewrittenURI = uri.replace("{storeid}", storeId);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (LOGGER.isDebugEnabled())
|
||||
// LOGGER.debug("no store id specified in webscript URI " + uri);
|
||||
// }
|
||||
//
|
||||
if (uri.contains("${ticket}"))
|
||||
{
|
||||
AuthenticationService authenticationService = Repository.getServiceRegistry(facesContext).getAuthenticationService();
|
||||
final String ticket = authenticationService.getCurrentTicket();
|
||||
rewrittenURI = rewrittenURI.replace("${ticket}", ticket);
|
||||
}
|
||||
else if (uri.contains("{ticket}"))
|
||||
{
|
||||
AuthenticationService authenticationService = Repository.getServiceRegistry(facesContext).getAuthenticationService();
|
||||
final String ticket = authenticationService.getCurrentTicket();
|
||||
rewrittenURI = rewrittenURI.replace("{ticket}", ticket);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("no ticket specified in webscript URI " + uri);
|
||||
}
|
||||
|
||||
rewrittenURI = rewrittenURI.replaceAll("%26","&");
|
||||
|
||||
finalURI = baseURI + rewrittenURI.replace("webscript://", "/");
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("Final URI " + finalURI);
|
||||
}
|
||||
else
|
||||
{
|
||||
// // WCM
|
||||
// // It's a web project asset include / import
|
||||
// final String baseURI = (uri.charAt(0) == '/'
|
||||
// ? AVMUtil.getPreviewURI(AVMUtil.getStoreName(cwdAvmPath))
|
||||
// : AVMUtil.getPreviewURI(cwdAvmPath));
|
||||
//
|
||||
// finalURI = baseURI + uri;
|
||||
}
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("rewriting " + uri + " as " + finalURI);
|
||||
|
||||
includeEl.setAttribute("schemaLocation", finalURI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Node getEventLog()
|
||||
{
|
||||
final Document result = XMLUtil.newDocument();
|
||||
final Element eventsElement = result.createElement("events");
|
||||
result.appendChild(eventsElement);
|
||||
|
||||
for (XMLEvent xfe : this.getXformsSession().getEventLog())
|
||||
{
|
||||
final String type = xfe.getType();
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("adding event " + type + " to the event log");
|
||||
}
|
||||
|
||||
final Element target = (Element)xfe.getTarget();
|
||||
|
||||
final Element eventElement = result.createElement(type);
|
||||
eventsElement.appendChild(eventElement);
|
||||
eventElement.setAttribute("targetId", target.getAttributeNS(null, "id"));
|
||||
eventElement.setAttribute("targetName", target.getLocalName());
|
||||
|
||||
final Collection properties = xfe.getPropertyNames();
|
||||
if (properties != null)
|
||||
{
|
||||
for (Object name : properties)
|
||||
{
|
||||
final Object value = xfe.getContextInfo((String)name);
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("adding property {" + name +
|
||||
":" + value + "} to event " + type);
|
||||
}
|
||||
|
||||
final Element propertyElement = result.createElement("property");
|
||||
eventElement.appendChild(propertyElement);
|
||||
propertyElement.setAttribute("name", name.toString());
|
||||
propertyElement.setAttribute("value",
|
||||
value != null ? value.toString() : null);
|
||||
}
|
||||
}
|
||||
|
||||
if (LOGGER.isDebugEnabled() && XFormsEventNames.SUBMIT_ERROR.equals(type))
|
||||
{
|
||||
// debug for figuring out which elements aren't valid for submit
|
||||
LOGGER.debug("performing full revalidate");
|
||||
try
|
||||
{
|
||||
final Model model = this.getXformsSession().getChibaBean().getContainer().getDefaultModel();
|
||||
final Instance instance = model.getDefaultInstance();
|
||||
model.getValidator().validate(instance, "/", new DefaultValidatorMode());
|
||||
final Iterator<ModelItem> it = instance.iterateModelItems("/");
|
||||
while (it.hasNext())
|
||||
{
|
||||
final ModelItem modelItem = it.next();
|
||||
if (!modelItem.isValid())
|
||||
{
|
||||
LOGGER.debug("model node " + modelItem.getNode() + " is invalid");
|
||||
}
|
||||
if (modelItem.isRequired() && modelItem.getValue().length() == 0)
|
||||
{
|
||||
LOGGER.debug("model node " + modelItem.getNode() + " is empty and required");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (final XFormsException xfe2)
|
||||
{
|
||||
LOGGER.debug("error performing revaliation", xfe2);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.xformsSession.eventLog.clear();
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("generated event log:\n" + XMLUtil.toString(result));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* stores cookies that may exist in request and passes them on to processor for usage in
|
||||
* HTTPConnectors. Instance loading and submission then uses these cookies. Important for
|
||||
* applications using auth.
|
||||
*/
|
||||
// @SuppressWarnings("unchecked")
|
||||
// private static void storeCookies(final javax.servlet.http.Cookie[] cookiesIn,
|
||||
// final ChibaBean chibaBean){
|
||||
// if (cookiesIn != null) {
|
||||
// org.apache.commons.httpclient.Cookie[] commonsCookies =
|
||||
// new org.apache.commons.httpclient.Cookie[cookiesIn.length];
|
||||
// for (int i = 0; i < cookiesIn.length; i += 1) {
|
||||
// commonsCookies[i] =
|
||||
// new org.apache.commons.httpclient.Cookie(cookiesIn[i].getDomain(),
|
||||
// cookiesIn[i].getName(),
|
||||
// cookiesIn[i].getValue(),
|
||||
// cookiesIn[i].getPath(),
|
||||
// cookiesIn[i].getMaxAge(),
|
||||
// cookiesIn[i].getSecure());
|
||||
// }
|
||||
// chibaBean.getContext().put(AbstractHTTPConnector.REQUEST_COOKIE,
|
||||
// commonsCookies);
|
||||
// }
|
||||
// }
|
||||
|
||||
private Pair<Document, XSModel> getXFormsDocument()
|
||||
throws FormBuilderException
|
||||
{
|
||||
String path = null;
|
||||
// // WCM
|
||||
// if (this.getXformsSession().getForm().isWebForm())
|
||||
// {
|
||||
// path = this.getCurrentAVMPath();
|
||||
// }
|
||||
// else
|
||||
{
|
||||
path = this.getCurrentPath();
|
||||
}
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("building xform for schema " + this.xformsSession.form.getName() +
|
||||
" root element " + this.xformsSession.form.getSchemaRootElementName() +
|
||||
" cwd " + path);
|
||||
}
|
||||
|
||||
final Locale locale =
|
||||
Application.getLanguage(FacesContext.getCurrentInstance());
|
||||
final ResourceBundle resourceBundle =
|
||||
getSchema2XFormsProperties().getResourceBundle(this.xformsSession.form,
|
||||
locale);
|
||||
try
|
||||
{
|
||||
final Document schemaDocument = this.xformsSession.form.getSchema();
|
||||
XFormsBean.rewriteInlineURIs(schemaDocument, path);
|
||||
final String rootElementName = this.xformsSession.form.getSchemaRootElementName();
|
||||
final Pair<Document, XSModel> result =
|
||||
this.getXformsSession().getSchema2XForms().buildXForm(this.getXformsSession().getFormInstanceData(),
|
||||
schemaDocument,
|
||||
rootElementName,
|
||||
resourceBundle);
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("generated xform: " + XMLUtil.toString(result.getFirst()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
throw new FormBuilderException(ioe);
|
||||
}
|
||||
catch (SAXException saxe)
|
||||
{
|
||||
throw new FormBuilderException(saxe);
|
||||
}
|
||||
}
|
||||
|
||||
// // WCM
|
||||
// private String getCurrentAVMPath()
|
||||
// {
|
||||
// AVMNode node = this.avmBrowseBean.getAvmActionNode();
|
||||
// if (node == null)
|
||||
// {
|
||||
// return this.avmBrowseBean.getCurrentPath();
|
||||
// }
|
||||
//
|
||||
// final String result = node.getPath();
|
||||
// return node.isDirectory() ? result : AVMNodeConverter.SplitBase(result)[0];
|
||||
// }
|
||||
//
|
||||
private String getCurrentPath()
|
||||
{
|
||||
org.alfresco.web.bean.repository.Node node = this.navigator.getCurrentNode();
|
||||
if (node == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
final String result = node.getPath();
|
||||
return result;
|
||||
}
|
||||
}
|
@@ -1,511 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.web.forms.xforms;
|
||||
|
||||
import java.io.Writer;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.util.XMLUtil;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.forms.Form;
|
||||
import org.alfresco.web.forms.FormProcessor;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.chiba.xml.ns.NamespaceConstants;
|
||||
import org.chiba.xml.xforms.exception.XFormsException;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.extensions.config.ConfigElement;
|
||||
import org.springframework.extensions.config.ConfigService;
|
||||
import org.springframework.web.util.JavaScriptUtils;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class XFormsProcessor implements FormProcessor
|
||||
{
|
||||
|
||||
private static final Log LOGGER = LogFactory.getLog(XFormsProcessor.class);
|
||||
|
||||
/**
|
||||
* A triple of js variable name, namespace uri, and namespace prefix which
|
||||
* will form javascript variables within alfresco.constants.
|
||||
*/
|
||||
private final static String[][] JS_NAMESPACES =
|
||||
{
|
||||
{ "xforms", NamespaceConstants.XFORMS_NS, NamespaceConstants.XFORMS_PREFIX },
|
||||
{ "xhtml", NamespaceConstants.XHTML_NS, NamespaceConstants.XHTML_PREFIX },
|
||||
{ "chiba", NamespaceConstants.CHIBA_NS, NamespaceConstants.CHIBA_PREFIX },
|
||||
{ "alfresco", NamespaceService.ALFRESCO_URI, NamespaceService.ALFRESCO_PREFIX }
|
||||
};
|
||||
|
||||
/** Scripts needed to initialize the xforms client. */
|
||||
private final static String[] JS_SCRIPTS =
|
||||
{
|
||||
"/scripts/tiny_mce/" + (LOGGER.isDebugEnabled()
|
||||
? "tiny_mce_src.js"
|
||||
: "tiny_mce.js"),
|
||||
"/scripts/ajax/dojo/" + (LOGGER.isDebugEnabled()
|
||||
? "dojo.js.uncompressed.js"
|
||||
: "dojo.js"),
|
||||
"/scripts/ajax/mootools.v1.11.js",
|
||||
"/scripts/ajax/common.js",
|
||||
"/scripts/ajax/ajax_helper.js",
|
||||
"/scripts/ajax/tiny_mce_wcm_extensions.js",
|
||||
"/scripts/ajax/xforms.js",
|
||||
"/scripts/ajax/file_picker_widget.js",
|
||||
"/scripts/upload_helper.js",
|
||||
"/scripts/ajax/dojo/src/date/serialize.js"
|
||||
};
|
||||
|
||||
/** Localized strings needed by the xforms client. */
|
||||
private final static String[] BUNDLE_KEYS =
|
||||
{
|
||||
"add_content",
|
||||
"cancel",
|
||||
"change",
|
||||
"click_to_edit",
|
||||
"eg",
|
||||
"go_up",
|
||||
"idle",
|
||||
"loading",
|
||||
"path",
|
||||
"select",
|
||||
"upload",
|
||||
"validation_provide_values_for_required_fields",
|
||||
|
||||
"time_picker_title",
|
||||
"time_picker_button_title",
|
||||
"date_picker_title",
|
||||
"date_picker_button_title",
|
||||
"date_time_picker_title",
|
||||
"date_time_picker_button_title",
|
||||
"increase_week_label",
|
||||
"decrease_week_label",
|
||||
"increase_month_label",
|
||||
"decrease_month_label",
|
||||
"mandatory_parameter",
|
||||
"state_expanded",
|
||||
"state_not_expanded",
|
||||
"select_path_menu",
|
||||
"add_item_title",
|
||||
"move_up_title",
|
||||
"move_down_title",
|
||||
"remove_item_title",
|
||||
"item_title",
|
||||
"accessibility_validation_message",
|
||||
"accessibility_validation_message_with_error_count"
|
||||
};
|
||||
|
||||
private static JSONObject widgetConfig = null;
|
||||
|
||||
public XFormsProcessor()
|
||||
{
|
||||
if (XFormsProcessor.widgetConfig == null)
|
||||
{
|
||||
XFormsProcessor.widgetConfig = XFormsProcessor.loadConfig();
|
||||
}
|
||||
}
|
||||
|
||||
public Session process(final Document instanceDataDocument,
|
||||
final String formInstanceDataName,
|
||||
final Form form,
|
||||
final Writer out)
|
||||
throws FormProcessor.ProcessingException
|
||||
{
|
||||
final FacesContext fc = FacesContext.getCurrentInstance();
|
||||
//make the XFormsBean available for this session
|
||||
final XFormsBean xforms = (XFormsBean)
|
||||
FacesHelper.getManagedBean(fc, XFormsBean.BEAN_NAME);
|
||||
final Session result =
|
||||
xforms.createSession(instanceDataDocument, formInstanceDataName, form);
|
||||
this.process(result, out);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates html text which bootstraps the JavaScript code that will
|
||||
* call back into the XFormsBean and get the xform and build the ui.
|
||||
*/
|
||||
public void process(final Session session, final Writer out)
|
||||
throws FormProcessor.ProcessingException
|
||||
{
|
||||
final FacesContext fc = FacesContext.getCurrentInstance();
|
||||
//make the XFormsBean available for this session
|
||||
final XFormsBean xforms = (XFormsBean)
|
||||
FacesHelper.getManagedBean(fc, XFormsBean.BEAN_NAME);
|
||||
// // WCM
|
||||
// final AVMBrowseBean avmBrowseBean = (AVMBrowseBean)
|
||||
// FacesHelper.getManagedBean(fc, AVMBrowseBean.BEAN_NAME);
|
||||
try
|
||||
{
|
||||
xforms.setXFormsSession((XFormsBean.XFormsSession)session);
|
||||
}
|
||||
catch (FormBuilderException fbe)
|
||||
{
|
||||
LOGGER.error(fbe);
|
||||
throw new ProcessingException(fbe);
|
||||
}
|
||||
catch (XFormsException xfe)
|
||||
{
|
||||
LOGGER.error(xfe);
|
||||
throw new ProcessingException(xfe);
|
||||
}
|
||||
|
||||
final String contextPath = fc.getExternalContext().getRequestContextPath();
|
||||
final Document result = XMLUtil.newDocument();
|
||||
final String xformsUIDivId = "alfresco-xforms-ui";
|
||||
|
||||
// this div is where the ui will write to
|
||||
final Element div = result.createElement("div");
|
||||
div.setAttribute("id", xformsUIDivId);
|
||||
result.appendChild(div);
|
||||
|
||||
Element e = result.createElement("link");
|
||||
e.setAttribute("rel", "stylesheet");
|
||||
e.setAttribute("type", "text/css");
|
||||
e.setAttribute("href", contextPath + "/css/xforms.css");
|
||||
div.appendChild(e);
|
||||
|
||||
// a script with config information and globals.
|
||||
e = result.createElement("script");
|
||||
e.setAttribute("type", "text/javascript");
|
||||
final StringBuilder js = new StringBuilder("\n");
|
||||
final String[] jsNamespacesObjects =
|
||||
{
|
||||
"alfresco",
|
||||
"alfresco.constants",
|
||||
"alfresco.xforms",
|
||||
"alfresco.xforms.constants"
|
||||
};
|
||||
for (final String jsNamespace : jsNamespacesObjects)
|
||||
{
|
||||
js.append(jsNamespace).
|
||||
append(" = typeof ").
|
||||
append(jsNamespace).
|
||||
append(" == 'undefined' ? {} : ").
|
||||
append(jsNamespace).
|
||||
append(";\n");
|
||||
}
|
||||
js.append("alfresco.constants.DEBUG = ").
|
||||
append(LOGGER.isDebugEnabled()).
|
||||
append(";\n");
|
||||
js.append("alfresco.constants.WEBAPP_CONTEXT = '").
|
||||
append(JavaScriptUtils.javaScriptEscape(contextPath)).
|
||||
append("';\n");
|
||||
|
||||
// // WCM
|
||||
// String avmWebApp = avmBrowseBean.getWebapp();
|
||||
//
|
||||
// TODO - need better way to determine WCM vs ECM context
|
||||
js.append("alfresco.constants.AVM_WEBAPP_CONTEXT = '");
|
||||
// // WCM
|
||||
// if (avmWebApp != null)
|
||||
// {
|
||||
// js.append(JavaScriptUtils.javaScriptEscape(avmWebApp));
|
||||
// }
|
||||
js.append("';\n");
|
||||
|
||||
// TODO - need better way to determine WCM vs ECM context
|
||||
js.append("alfresco.constants.AVM_WEBAPP_URL = '");
|
||||
// // WCM
|
||||
// if (avmWebApp != null)
|
||||
// {
|
||||
// //Use preview store because when user upload image it appears in preview, not in main store.
|
||||
// String storeName = AVMUtil.getCorrespondingPreviewStoreName(avmBrowseBean.getSandbox());
|
||||
// if (storeName != null)
|
||||
// {
|
||||
// js.append(JavaScriptUtils.javaScriptEscape(fc.getExternalContext().getRequestContextPath() + "/wcs/api/path/content/avm/" +
|
||||
// AVMUtil.buildStoreWebappPath(storeName, avmWebApp).replace(":","")));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
js.append("';\n");
|
||||
|
||||
js.append("alfresco.constants.AVM_WEBAPP_PREFIX = '");
|
||||
// // WCM
|
||||
// if (avmWebApp != null)
|
||||
// {
|
||||
// String storeName = AVMUtil.getCorrespondingPreviewStoreName(avmBrowseBean.getSandbox());
|
||||
// if (storeName != null)
|
||||
// {
|
||||
// js.append(JavaScriptUtils.javaScriptEscape(fc.getExternalContext().getRequestContextPath() + "/wcs/api/path/content/avm/" +
|
||||
// AVMUtil.buildSandboxRootPath(storeName).replace(":","")));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
js.append("';\n");
|
||||
js.append("alfresco.constants.LANGUAGE = '");
|
||||
String lang = Application.getLanguage(FacesContext.getCurrentInstance()).toString();
|
||||
// the language can be passed as "en_US" or just "en"
|
||||
if (lang.length() > 4)
|
||||
lang = lang.substring(0,lang.indexOf("_"));
|
||||
js.append(lang);
|
||||
js.append("';\n");
|
||||
js.append("alfresco.xforms.constants.XFORMS_UI_DIV_ID = '").
|
||||
append(xformsUIDivId).
|
||||
append("';\n");
|
||||
js.append("alfresco.xforms.constants.FORM_INSTANCE_DATA_NAME = '").
|
||||
append(JavaScriptUtils.javaScriptEscape(session.getFormInstanceDataName())).
|
||||
append("';\n");
|
||||
SimpleDateFormat sdf = (SimpleDateFormat)
|
||||
SimpleDateFormat.getDateInstance(DateFormat.SHORT,
|
||||
Application.getLanguage(fc));
|
||||
js.append("alfresco.xforms.constants.DATE_FORMAT = '").
|
||||
append(sdf.toPattern()).
|
||||
append("';\n");
|
||||
sdf = (SimpleDateFormat)
|
||||
SimpleDateFormat.getTimeInstance(DateFormat.SHORT,
|
||||
Application.getLanguage(fc));
|
||||
js.append("alfresco.xforms.constants.TIME_FORMAT = '").
|
||||
append(sdf.toPattern()).
|
||||
append("';\n");
|
||||
sdf = (SimpleDateFormat)
|
||||
SimpleDateFormat.getDateTimeInstance(DateFormat.SHORT,
|
||||
DateFormat.SHORT,
|
||||
Application.getLanguage(fc));
|
||||
js.append("alfresco.xforms.constants.DATE_TIME_FORMAT = '").
|
||||
append(sdf.toPattern()).
|
||||
append("';\n");
|
||||
for (String[] ns : JS_NAMESPACES)
|
||||
{
|
||||
js.append("alfresco.xforms.constants.").
|
||||
append(ns[0].toUpperCase()).
|
||||
append("_NS = '").append(ns[1]).append("';\n");
|
||||
js.append("alfresco.xforms.constants.").
|
||||
append(ns[0].toUpperCase()).
|
||||
append("_PREFIX = '").append(ns[2]).append("';\n");
|
||||
}
|
||||
|
||||
final ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance());
|
||||
js.append("alfresco.resources = {\n");
|
||||
for (String k : BUNDLE_KEYS)
|
||||
{
|
||||
js.append(k).
|
||||
append(": '").
|
||||
append(JavaScriptUtils.javaScriptEscape(bundle.getString(k))).
|
||||
append("'").
|
||||
append(k.equals(BUNDLE_KEYS[BUNDLE_KEYS.length - 1]) ? "\n};" : ",").
|
||||
append("\n");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
js.append("alfresco.xforms.widgetConfig = \n").
|
||||
append(LOGGER.isDebugEnabled()
|
||||
? XFormsProcessor.widgetConfig.toString(0)
|
||||
: XFormsProcessor.widgetConfig).
|
||||
append("\n");
|
||||
}
|
||||
catch (JSONException jsone)
|
||||
{
|
||||
LOGGER.error(jsone);
|
||||
}
|
||||
e.appendChild(result.createTextNode(js.toString()));
|
||||
|
||||
div.appendChild(e);
|
||||
|
||||
// include all our scripts, order is significant
|
||||
for (final String script : JS_SCRIPTS)
|
||||
{
|
||||
if (script == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
e = result.createElement("script");
|
||||
e.setAttribute("type", "text/javascript");
|
||||
e.setAttribute("src", contextPath + script);
|
||||
e.appendChild(result.createTextNode("\n"));
|
||||
div.appendChild(e);
|
||||
}
|
||||
|
||||
// output any custom scripts
|
||||
ConfigElement config = Application.getConfigService(fc).getGlobalConfig().getConfigElement("wcm");
|
||||
if (config != null)
|
||||
{
|
||||
// get the custom scripts to include
|
||||
ConfigElement xformsScriptsConfig = config.getChild("xforms-scripts");
|
||||
if (xformsScriptsConfig != null)
|
||||
{
|
||||
StringTokenizer t = new StringTokenizer(xformsScriptsConfig.getValue().trim(), ", ");
|
||||
while (t.hasMoreTokens())
|
||||
{
|
||||
e = result.createElement("script");
|
||||
e.setAttribute("type", "text/javascript");
|
||||
e.setAttribute("src", contextPath + t.nextToken());
|
||||
e.appendChild(result.createTextNode("\n"));
|
||||
div.appendChild(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XMLUtil.print(result, out);
|
||||
}
|
||||
|
||||
private static JSONObject loadConfig()
|
||||
{
|
||||
final ConfigService cfgService = Application.getConfigService(FacesContext.getCurrentInstance());
|
||||
final ConfigElement xformsConfig = cfgService.getGlobalConfig().getConfigElement("wcm").getChild("xforms");
|
||||
final List<ConfigElement> widgetConfig = xformsConfig.getChildren("widget");
|
||||
|
||||
class WidgetConfigElement
|
||||
implements Comparable<WidgetConfigElement>
|
||||
{
|
||||
public final String xformsType;
|
||||
public final String xmlSchemaType;
|
||||
public final String appearance;
|
||||
public final String javascriptClassName;
|
||||
private final Map<String, String> params = new HashMap<String, String>();
|
||||
|
||||
public WidgetConfigElement(final String xformsType,
|
||||
final String xmlSchemaType,
|
||||
final String appearance,
|
||||
final String javascriptClassName)
|
||||
{
|
||||
if (xformsType == null)
|
||||
{
|
||||
throw new NullPointerException();
|
||||
}
|
||||
this.xformsType = xformsType;
|
||||
this.xmlSchemaType = xmlSchemaType;
|
||||
this.appearance = appearance;
|
||||
this.javascriptClassName = javascriptClassName;
|
||||
}
|
||||
|
||||
public void addParam(final String k, final String v)
|
||||
{
|
||||
this.params.put(k, v);
|
||||
}
|
||||
|
||||
public Map<String, String> getParams()
|
||||
{
|
||||
return (this.params == null
|
||||
? (Map<String, String>)Collections.EMPTY_MAP
|
||||
: Collections.unmodifiableMap(this.params));
|
||||
}
|
||||
|
||||
public int compareTo(final WidgetConfigElement other)
|
||||
{
|
||||
int result = this.xformsType.compareTo(other.xformsType);
|
||||
if (result != 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
result = this.compareAttribute(this.xmlSchemaType, other.xmlSchemaType);
|
||||
if (result != 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
result = this.compareAttribute(this.appearance, other.appearance);
|
||||
if (result != 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
if (LOGGER.isInfoEnabled())
|
||||
{
|
||||
LOGGER.info("widget definitions " + this + " and " + other + " may collide");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return (this.getClass().getName() + "{" +
|
||||
"xformsType: "+ this.xformsType +
|
||||
", xmlSchemaType: " + this.xmlSchemaType +
|
||||
", appearance: " + this.appearance +
|
||||
", javascriptClassName: " + this.javascriptClassName +
|
||||
", numParams: " + this.getParams().size() +
|
||||
"}");
|
||||
}
|
||||
|
||||
private int compareAttribute(final String s1, final String s2)
|
||||
{
|
||||
return (s1 != null && s2 == null
|
||||
? 1
|
||||
: (s1 == null && s2 != null
|
||||
? -1
|
||||
: (s1 != null && s2 != null
|
||||
? s1.compareTo(s2)
|
||||
: 0)));
|
||||
}
|
||||
}
|
||||
|
||||
final TreeSet<WidgetConfigElement> widgetConfigs = new TreeSet<WidgetConfigElement>();
|
||||
for (final ConfigElement ce : widgetConfig)
|
||||
{
|
||||
final WidgetConfigElement wce = new WidgetConfigElement(ce.getAttribute("xforms-type"),
|
||||
ce.getAttribute("xml-schema-type"),
|
||||
ce.getAttribute("appearance"),
|
||||
ce.getAttribute("javascript-class-name"));
|
||||
|
||||
final List<ConfigElement> params = ce.getChildren("param");
|
||||
for (final ConfigElement p : params)
|
||||
{
|
||||
wce.addParam(p.getAttribute("name"), p.getValue());
|
||||
}
|
||||
widgetConfigs.add(wce);
|
||||
}
|
||||
try
|
||||
{
|
||||
final JSONObject result = new JSONObject();
|
||||
for (final WidgetConfigElement wce : widgetConfigs)
|
||||
{
|
||||
if (!result.has(wce.xformsType))
|
||||
{
|
||||
result.put(wce.xformsType, new JSONObject());
|
||||
}
|
||||
final JSONObject xformsTypeObject = result.getJSONObject(wce.xformsType);
|
||||
String s = wce.xmlSchemaType == null ? "*" : wce.xmlSchemaType;
|
||||
if (!xformsTypeObject.has(s))
|
||||
{
|
||||
xformsTypeObject.put(s, new JSONObject());
|
||||
}
|
||||
final JSONObject schemaTypeObject = xformsTypeObject.getJSONObject(s);
|
||||
s = wce.appearance == null ? "*" : wce.appearance;
|
||||
final JSONObject o = new JSONObject();
|
||||
schemaTypeObject.put(s, o);
|
||||
o.put("className", wce.javascriptClassName);
|
||||
if (wce.getParams().size() != 0)
|
||||
{
|
||||
o.put("params", new JSONObject(wce.getParams()));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
catch (JSONException jsone)
|
||||
{
|
||||
LOGGER.error(jsone, jsone);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@@ -222,11 +222,7 @@ public abstract class AbstractItemSelector extends UIInput
|
||||
NodeRef nodeRef = new NodeRef(Repository.getStoreRef(), selection);
|
||||
if (!getNodeService(context).exists(nodeRef))
|
||||
{
|
||||
// // WCM
|
||||
// nodeRef = new NodeRef(new StoreRef(StoreRef.PROTOCOL_AVM, avmStore), selection);
|
||||
// Pair<Integer, String> versionPathPair = AVMNodeConverter.ToAVMVersionPath(nodeRef);
|
||||
// ((EditableValueHolder)this).setSubmittedValue(AVMNodeConverter.ToNodeRef(versionPathPair.getFirst(), versionPathPair.getSecond()));
|
||||
throw new RuntimeException("WCM anticipation here.");
|
||||
throw new RuntimeException("NodeRef not found.");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -370,39 +366,7 @@ public abstract class AbstractItemSelector extends UIInput
|
||||
}
|
||||
else
|
||||
{
|
||||
// WCM
|
||||
// if (value.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM))
|
||||
// {
|
||||
// Pair<Integer, String> avmNode = AVMNodeConverter.ToAVMVersionPath(value);
|
||||
// String avmPath = avmNode.getSecond();
|
||||
//
|
||||
// int rootPosition = avmPath.indexOf(AVMUtil.DIR_ROOT);
|
||||
// if(rootPosition > 0)
|
||||
// {
|
||||
// label = avmPath.substring(rootPosition + AVMUtil.DIR_ROOT.length());
|
||||
// if(label.length() == 0)
|
||||
// {
|
||||
// int storeEnd = avmPath.indexOf(":");
|
||||
// if(storeEnd > 0)
|
||||
// {
|
||||
// label = avmPath.substring(0, storeEnd);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// label = "ROOT";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // AVM path does not have ROOT
|
||||
// label = avmPath;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
label = Repository.getNameForNode(service, value);
|
||||
// }
|
||||
label = Repository.getNameForNode(service, value);
|
||||
showValueInHiddenField = true;
|
||||
}
|
||||
|
||||
@@ -436,13 +400,6 @@ public abstract class AbstractItemSelector extends UIInput
|
||||
if (value != null)
|
||||
{
|
||||
fieldValue = encodeFieldValues(theMode, value.getId());
|
||||
//
|
||||
// // WCM
|
||||
// // setup the avmStore if the value represents an avm path
|
||||
// if (value.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM))
|
||||
// {
|
||||
// this.avmStore = value.getStoreRef().getIdentifier();
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -925,143 +925,5 @@ public void testPropertyViewing()
|
||||
List<QName> attrs = clientConfig.getSimpleSearchAdditionalAttributes();
|
||||
assertNotNull("Expecting a list of search attributes", attrs);
|
||||
assertEquals("Expecting 2 search attributes", 2, attrs.size());
|
||||
}
|
||||
|
||||
public void testWCM()
|
||||
{
|
||||
// setup the config service
|
||||
XMLConfigService svc = initXMLConfigService(TEST_CONFIG);
|
||||
|
||||
// get the global config object
|
||||
Config global = svc.getGlobalConfig();
|
||||
assertNotNull(global);
|
||||
|
||||
// get the wcm config
|
||||
ConfigElement wcmConfig = global.getConfigElement("wcm");
|
||||
assertNotNull(wcmConfig);
|
||||
|
||||
// get the workflows config
|
||||
ConfigElement workflows = wcmConfig.getChild("workflows");
|
||||
assertNotNull(workflows);
|
||||
assertEquals("wcmwf:submit", workflows.getValue());
|
||||
|
||||
// get the admin workflows config
|
||||
ConfigElement adminWorkflows = wcmConfig.getChild("admin-workflows");
|
||||
assertNotNull(adminWorkflows);
|
||||
assertEquals("wcmwf:changerequest", adminWorkflows.getValue());
|
||||
|
||||
// get the browse page size config
|
||||
ConfigElement viewsConfig = wcmConfig.getChild("views");
|
||||
assertNotNull(viewsConfig);
|
||||
ConfigElement browsePageSizeConfig = viewsConfig.getChild("browse-page-size");
|
||||
assertNotNull(browsePageSizeConfig);
|
||||
assertEquals("25", browsePageSizeConfig.getValue());
|
||||
|
||||
// get the deployment polling frequency
|
||||
ConfigElement deploymentConfig = wcmConfig.getChild("deployment");
|
||||
assertNotNull(deploymentConfig);
|
||||
ConfigElement pollingConfig = deploymentConfig.getChild("progress-polling-frequency");
|
||||
assertNotNull(pollingConfig);
|
||||
assertEquals("2", pollingConfig.getValue());
|
||||
|
||||
// get the link validation polling frequency
|
||||
ConfigElement linksConfig = wcmConfig.getChild("links-management");
|
||||
assertNotNull(linksConfig);
|
||||
pollingConfig = linksConfig.getChild("progress-polling-frequency");
|
||||
assertNotNull(pollingConfig);
|
||||
assertEquals("2", pollingConfig.getValue());
|
||||
|
||||
// get the widget config
|
||||
ConfigElement xformsConfig = wcmConfig.getChild("xforms");
|
||||
assertNotNull(xformsConfig);
|
||||
List<ConfigElement> widgetConfig = xformsConfig.getChildren("widget");
|
||||
assertEquals(2, widgetConfig.size());
|
||||
|
||||
// make sure the xforms-scripts config is NOT present
|
||||
ConfigElement scriptsConfig = wcmConfig.getChild("xforms-scripts");
|
||||
assertNull(scriptsConfig);
|
||||
|
||||
// make sure the custom config element is NOT present
|
||||
ConfigElement customConfig = wcmConfig.getChild("custom-config");
|
||||
assertNull(customConfig);
|
||||
}
|
||||
|
||||
public void testWCMOverride()
|
||||
{
|
||||
// setup the config service
|
||||
XMLConfigService svc = initXMLConfigService(TEST_CONFIG, TEST_CONFIG_OVERRIDE);
|
||||
|
||||
// get the global config object
|
||||
Config global = svc.getGlobalConfig();
|
||||
assertNotNull(global);
|
||||
|
||||
// get the wcm config
|
||||
ConfigElement wcmConfig = global.getConfigElement("wcm");
|
||||
assertNotNull(wcmConfig);
|
||||
|
||||
// get the workflows config
|
||||
ConfigElement workflows = wcmConfig.getChild("workflows");
|
||||
assertNotNull(workflows);
|
||||
assertEquals("custom:submit", workflows.getValue().trim());
|
||||
|
||||
StringTokenizer t = new StringTokenizer(workflows.getValue().trim(), ", ");
|
||||
while (t.hasMoreTokens())
|
||||
{
|
||||
System.out.println("workflow = '" + t.nextToken() + "'");
|
||||
}
|
||||
|
||||
// get the admin workflows config
|
||||
ConfigElement adminWorkflows = wcmConfig.getChild("admin-workflows");
|
||||
assertNotNull(adminWorkflows);
|
||||
assertEquals("custom:changerequest, custom:somejob", adminWorkflows.getValue());
|
||||
|
||||
t = new StringTokenizer(adminWorkflows.getValue().trim(), ", ");
|
||||
while (t.hasMoreTokens())
|
||||
{
|
||||
System.out.println("admin workflow = '" + t.nextToken() + "'");
|
||||
}
|
||||
|
||||
// get the browse page size config
|
||||
ConfigElement viewsConfig = wcmConfig.getChild("views");
|
||||
assertNotNull(viewsConfig);
|
||||
ConfigElement browsePageSizeConfig = viewsConfig.getChild("browse-page-size");
|
||||
assertNotNull(browsePageSizeConfig);
|
||||
assertEquals("50", browsePageSizeConfig.getValue());
|
||||
|
||||
// get the deployment polling frequency
|
||||
ConfigElement deploymentConfig = wcmConfig.getChild("deployment");
|
||||
assertNotNull(deploymentConfig);
|
||||
ConfigElement pollingConfig = deploymentConfig.getChild("progress-polling-frequency");
|
||||
assertNotNull(pollingConfig);
|
||||
assertEquals("10", pollingConfig.getValue());
|
||||
|
||||
// get the link validation polling frequency
|
||||
ConfigElement linksConfig = wcmConfig.getChild("links-management");
|
||||
assertNotNull(linksConfig);
|
||||
pollingConfig = linksConfig.getChild("progress-polling-frequency");
|
||||
assertNotNull(pollingConfig);
|
||||
assertEquals("15", pollingConfig.getValue());
|
||||
|
||||
// get the widget config
|
||||
ConfigElement xformsConfig = wcmConfig.getChild("xforms");
|
||||
assertNotNull(xformsConfig);
|
||||
List<ConfigElement> widgetConfig = xformsConfig.getChildren("widget");
|
||||
assertEquals(3, widgetConfig.size());
|
||||
|
||||
// make sure the xforms-scripts config is present
|
||||
ConfigElement scriptsConfig = wcmConfig.getChild("xforms-scripts");
|
||||
assertNotNull(scriptsConfig);
|
||||
assertEquals("/custom/custom-xforms.js, /custom/another-custom-xforms.js", scriptsConfig.getValue());
|
||||
|
||||
t = new StringTokenizer(scriptsConfig.getValue().trim(), ", ");
|
||||
while (t.hasMoreTokens())
|
||||
{
|
||||
System.out.println("custom script = '" + t.nextToken() + "'");
|
||||
}
|
||||
|
||||
// make sure the custom config element is present
|
||||
ConfigElement customConfig = wcmConfig.getChild("custom-config");
|
||||
assertNotNull(customConfig);
|
||||
assertEquals("50", customConfig.getValue());
|
||||
}
|
||||
}
|
||||
|
@@ -36,38 +36,6 @@
|
||||
<qname>attr4</qname>
|
||||
</simple-search-additional-attributes>
|
||||
</client>
|
||||
|
||||
<wcm>
|
||||
<workflows>
|
||||
custom:submit
|
||||
</workflows>
|
||||
|
||||
<admin-workflows>
|
||||
custom:changerequest, custom:somejob
|
||||
</admin-workflows>
|
||||
|
||||
<views>
|
||||
<browse-page-size>50</browse-page-size>
|
||||
</views>
|
||||
|
||||
<deployment>
|
||||
<progress-polling-frequency>10</progress-polling-frequency>
|
||||
</deployment>
|
||||
|
||||
<links-management>
|
||||
<progress-polling-frequency>15</progress-polling-frequency>
|
||||
</links-management>
|
||||
|
||||
<xforms>
|
||||
<widget xforms-type="xf:group" appearance="custom" javascript-class-name="custom.HGroup" />
|
||||
</xforms>
|
||||
|
||||
<xforms-scripts>
|
||||
/custom/custom-xforms.js, /custom/another-custom-xforms.js
|
||||
</xforms-scripts>
|
||||
|
||||
<custom-config>50</custom-config>
|
||||
</wcm>
|
||||
</config>
|
||||
|
||||
<config evaluator="string-compare" condition="Languages">
|
||||
|
@@ -9,7 +9,6 @@
|
||||
<element-reader element-name="advanced-search" class="org.alfresco.web.config.AdvancedSearchElementReader" />
|
||||
<element-reader element-name="views" class="org.alfresco.web.config.ViewsElementReader" />
|
||||
<element-reader element-name="actions" class="org.alfresco.web.config.ActionsElementReader" />
|
||||
<element-reader element-name="wcm" class="org.alfresco.web.config.WCMElementReader" />
|
||||
</element-readers>
|
||||
</plug-ins>
|
||||
|
||||
@@ -81,33 +80,6 @@
|
||||
<action idref="always_hidden" hide="true" />
|
||||
</action-group>
|
||||
</actions>
|
||||
|
||||
<wcm>
|
||||
<workflows>
|
||||
wcmwf:submit
|
||||
</workflows>
|
||||
|
||||
<admin-workflows>
|
||||
wcmwf:changerequest
|
||||
</admin-workflows>
|
||||
|
||||
<views>
|
||||
<browse-page-size>25</browse-page-size>
|
||||
</views>
|
||||
|
||||
<deployment>
|
||||
<progress-polling-frequency>2</progress-polling-frequency>
|
||||
</deployment>
|
||||
|
||||
<links-management>
|
||||
<progress-polling-frequency>2</progress-polling-frequency>
|
||||
</links-management>
|
||||
|
||||
<xforms>
|
||||
<widget xforms-type="xf:group" appearance="minimal" javascript-class-name="alfresco.xforms.HGroup" />
|
||||
<widget xforms-type="xf:range" javascript-class-name="alfresco.xforms.NumericalRange" />
|
||||
</xforms>
|
||||
</wcm>
|
||||
</config>
|
||||
|
||||
<config evaluator="string-compare" condition="Languages">
|
||||
|
@@ -1,151 +0,0 @@
|
||||
<#ftl ns_prefixes={"D":"http://www.alfresco.org/alfresco/article","xsi":"http://www.w3.org/2001/XMLSchema-instance"}>
|
||||
<style>
|
||||
.article_details {
|
||||
background: #fff;
|
||||
padding: 10px;
|
||||
position: relative;
|
||||
font-family: helvetica;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.article_title{
|
||||
padding: 8px;
|
||||
font-size: 20px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.article_author {
|
||||
background: #fff;
|
||||
border: 1px solid #e2e1e1;
|
||||
position: relative;
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
.article_author_picture {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 80px;
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
.article_author_name {
|
||||
}
|
||||
|
||||
.article_teaser {
|
||||
clear: left;
|
||||
margin: 10px 0 10px 0px;
|
||||
}
|
||||
|
||||
.article_tags {
|
||||
margin: 10px 0 10px 0px;
|
||||
}
|
||||
|
||||
.article_pages {
|
||||
margin: 10px 0 10px 0px;
|
||||
}
|
||||
|
||||
.article_page_picture_left {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 200px;
|
||||
padding-right: 15px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
.article_page_picture_right {
|
||||
display: block;
|
||||
float: right;
|
||||
width: 200px;
|
||||
padding-left: 15px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
.article_page_picture {
|
||||
width: 200px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.article_page_title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.article_related {
|
||||
margin: 10px 0 10px 0px;
|
||||
}
|
||||
|
||||
.legal_text {
|
||||
font-style: italic;
|
||||
font-size: 10px;
|
||||
}
|
||||
</style>
|
||||
<div class="article_details">
|
||||
|
||||
<div class="article_title">
|
||||
${article.title}
|
||||
</div>
|
||||
|
||||
<div class="article_author">
|
||||
<#if article.author[0]??>
|
||||
<#list article.author as author>
|
||||
<#include "${author?replace('.xml', '-details.html')}" parse=false>
|
||||
</#list>
|
||||
</#if>
|
||||
</div>
|
||||
|
||||
<div class="article_teaser">
|
||||
<span>${article.location} ${article.date}</span> - ${article.teaser}
|
||||
</div>
|
||||
<div class="article_tags">
|
||||
<#if article.tag[0]??>
|
||||
<b>Tags: </b>
|
||||
<#list article.tag as tag>
|
||||
${tag};
|
||||
</#list>
|
||||
</#if>
|
||||
</div>
|
||||
<div class="article_pages">
|
||||
<#list article.page as page>
|
||||
<#if page.page_title[0]??>
|
||||
<div class="article_page_title">${page.page_title}</div>
|
||||
</#if>
|
||||
<#if page.page_picture[0]??>
|
||||
<#if page.page_picture.image["@xsi:nil"] == "false">
|
||||
<#if page_index % 2 == 1>
|
||||
<div class="article_page_picture_left">
|
||||
<img src="${page.page_picture.image}" class="article_page_picture"/>
|
||||
<#if page.page_picture.caption["@xsi:nil"] == "false">
|
||||
<div>${page.page_picture.caption}</div>
|
||||
</#if>
|
||||
</div>
|
||||
<#else>
|
||||
<div class="article_page_picture_right">
|
||||
<img src="${page.page_picture.image}" class="article_page_picture"/>
|
||||
<#if page.page_picture.caption["@xsi:nil"] == "false">
|
||||
<div>${page.page_picture.caption}</div>
|
||||
</#if>
|
||||
</div>
|
||||
</#if>
|
||||
</#if>
|
||||
</#if>
|
||||
${page.page_body}
|
||||
</#list>
|
||||
</div>
|
||||
<div class="article_related">
|
||||
<div><b>Related</b></div>
|
||||
<#if article.related[0]??>
|
||||
<div>
|
||||
<ul>
|
||||
<#list article.related as related>
|
||||
<li><a href="${related.item_link}">${related.item_label}</a>
|
||||
</#list>
|
||||
</ul>
|
||||
</div>
|
||||
</#if>
|
||||
</div>
|
||||
<div class="legal_text">
|
||||
<#if article.include_legal_text == "true">
|
||||
<#include "/legal.html" parse=false>
|
||||
</#if>
|
||||
</div>
|
||||
|
||||
|
@@ -1,89 +0,0 @@
|
||||
<#ftl ns_prefixes={"D":"http://www.alfresco.org/alfresco/article","xsi":"http://www.w3.org/2001/XMLSchema-instance"}>
|
||||
<style>
|
||||
.article_details {
|
||||
background: #fff;
|
||||
padding: 10px;
|
||||
position: relative;
|
||||
font-family: helvetica;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.article_title{
|
||||
padding: 8px;
|
||||
font-size: 20px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.article_author {
|
||||
background: #fff;
|
||||
border: 1px solid #e2e1e1;
|
||||
position: relative;
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
.article_author_picture {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 80px;
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
.article_author_name {
|
||||
}
|
||||
|
||||
.article_teaser {
|
||||
clear: left;
|
||||
margin: 10px 0 10px 0px;
|
||||
}
|
||||
|
||||
.article_tags {
|
||||
margin: 10px 0 10px 0px;
|
||||
}
|
||||
|
||||
.article_pages {
|
||||
margin: 10px 0 10px 0px;
|
||||
}
|
||||
|
||||
.article_page_picture_left {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 200px;
|
||||
padding-right: 15px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
.article_page_picture_right {
|
||||
display: block;
|
||||
float: right;
|
||||
width: 200px;
|
||||
padding-left: 15px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
.article_page_picture {
|
||||
width: 200px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.article_related {
|
||||
margin: 10px 0 10px 0px;
|
||||
}
|
||||
</style>
|
||||
<div class="article_details">
|
||||
|
||||
<div class="article_title">
|
||||
${article.title}
|
||||
</div>
|
||||
|
||||
<div class="article_author">
|
||||
<#if article.author[0]??>
|
||||
<#list article.author as author>
|
||||
<#include "${author?replace('.xml', '-details.html')}" parse=false>
|
||||
</#list>
|
||||
</#if>
|
||||
</div>
|
||||
|
||||
<div class="article_teaser">
|
||||
<span>${article.location} ${article.date}</span> - ${article.teaser}
|
||||
</div>
|
||||
|
@@ -1,47 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
<xsl:stylesheet version="1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:article="http://www.alfresco.org/alfresco/article"
|
||||
xmlns:java="http://xml.apache.org/xslt/java"
|
||||
xmlns:fn="http://www.w3.org/2005/02/xpath-functions" exclude-result-prefixes="xhtml">
|
||||
<xsl:output method="html" encoding="UTF-8" indent="yes"
|
||||
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
|
||||
|
||||
<xsl:preserve-space elements="*"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<xsl:value-of select="/article:article/article:title" disable-output-escaping="yes"/>
|
||||
</td>
|
||||
<td align="right" valign="top">
|
||||
<xsl:element name="a">
|
||||
<xsl:attribute name="href">/content/article/<xsl:value-of select="fn:replaceAll(string($alf:form_instance_data_file_name), '.xml', '.pdf')"/></xsl:attribute>
|
||||
<img src="/views/common/images/icons/pdficon_small.gif"/>
|
||||
</xsl:element>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
@@ -1,114 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
<xsl:stylesheet version="1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:article="http://www.alfresco.org/alfresco/article"
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns:fn="http://www.w3.org/2005/02/xpath-functions" exclude-result-prefixes="xhtml">
|
||||
|
||||
<xsl:output method="xml"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<fo:root>
|
||||
<fo:layout-master-set>
|
||||
<fo:simple-page-master master-name="only">
|
||||
<fo:region-body
|
||||
region-name="xsl-region-body"
|
||||
margin="0.7in"/>
|
||||
<fo:region-before
|
||||
region-name="xsl-region-before"
|
||||
extent="0.7in"
|
||||
display-align="before" />
|
||||
|
||||
<fo:region-after
|
||||
region-name="xsl-region-after"
|
||||
display-align="after"
|
||||
extent="0.7in" />
|
||||
</fo:simple-page-master>
|
||||
</fo:layout-master-set>
|
||||
|
||||
<fo:page-sequence master-reference="only">
|
||||
<fo:flow flow-name="xsl-region-body">
|
||||
<fo:block
|
||||
font-family="Times"
|
||||
font-size="18pt"
|
||||
font-weight="bold"
|
||||
space-before="18pt"
|
||||
space-after="12pt"
|
||||
text-align="left">
|
||||
<xsl:value-of select="/article:article/article:title" disable-output-escaping="yes"/>
|
||||
</fo:block>
|
||||
|
||||
<fo:table text-align="justify">
|
||||
<fo:table-column column-width="1.3in"/>
|
||||
<fo:table-column column-width="1.3in" number-columns-repeated="4"/>
|
||||
<fo:table-body>
|
||||
<fo:table-row>
|
||||
<xsl:element name="fo:table-cell">
|
||||
<xsl:attribute name="padding">
|
||||
<xsl:value-of select="'6pt'"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="number-columns-spanned">
|
||||
<xsl:value-of select="'5'"/>
|
||||
</xsl:attribute>
|
||||
<fo:block
|
||||
font-family="Times"
|
||||
font-size="12pt"
|
||||
space-before="18pt"
|
||||
space-after="12pt">
|
||||
<xsl:value-of select="normalize-space(/article:article/article:teaser)" disable-output-escaping="yes"/>
|
||||
</fo:block>
|
||||
</xsl:element>
|
||||
</fo:table-row>
|
||||
<xsl:for-each select="/article:article/article:page">
|
||||
<xsl:variable name="page_number" select="1+count(preceding-sibling::*[name()=name(current())])"/>
|
||||
<fo:table-row>
|
||||
<xsl:element name="fo:table-cell">
|
||||
<xsl:attribute name="padding">
|
||||
<xsl:value-of select="'6pt'"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="number-columns-spanned">
|
||||
<xsl:value-of select="'5'"/>
|
||||
</xsl:attribute>
|
||||
<fo:block
|
||||
font-family="Times"
|
||||
font-size="12pt"
|
||||
space-before="18pt"
|
||||
space-after="12pt">
|
||||
<xsl:if test="position()=1">
|
||||
<fo:inline font-weight="bold">
|
||||
<xsl:value-of select="normalize-space(/article:article/article:location)" disable-output-escaping="yes"/>—
|
||||
</fo:inline>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="normalize-space(.)" disable-output-escaping="yes"/>
|
||||
</fo:block>
|
||||
</xsl:element>
|
||||
</fo:table-row>
|
||||
</xsl:for-each>
|
||||
</fo:table-body>
|
||||
</fo:table>
|
||||
</fo:flow>
|
||||
</fo:page-sequence>
|
||||
</fo:root>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
@@ -1,461 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:article="http://www.alfresco.org/alfresco/article"
|
||||
targetNamespace="http://www.alfresco.org/alfresco/article"
|
||||
xmlns:alf="http://www.alfresco.org"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<!-- Imports -->
|
||||
<xs:include schemaLocation="webscript://demo/wcm/schema/content/list?ticket=${ticket}%26storeid=${storeid}%26form=user_profile%26method=xpath" />
|
||||
|
||||
<!--
|
||||
<xs:simpleType name="content-list">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="/Yong_Qu.xml">
|
||||
<xs:annotation>
|
||||
<xs:appinfo>
|
||||
<alf:label>Yong_Qu</alf:label>
|
||||
</xs:appinfo>
|
||||
</xs:annotation>
|
||||
|
||||
</xs:enumeration>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
-->
|
||||
<!-- defines name prefix-->
|
||||
<xs:simpleType name="name-prefix">
|
||||
<xs:restriction base="xs:normalizedString">
|
||||
<xs:enumeration value="Mr"/>
|
||||
<xs:enumeration value="Mrs"/>
|
||||
<xs:enumeration value="Ms"/>
|
||||
<xs:enumeration value="Miss"/>
|
||||
<xs:enumeration value="Dr"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<!-- defines state list-->
|
||||
<xs:simpleType name="us-state">
|
||||
<xs:restriction base="xs:normalizedString">
|
||||
<xs:enumeration value="AL">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Alabama</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="AK">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Alaska</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="AZ">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Arizona</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="AR">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Arkansas</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="CA">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>California</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="CO">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Colorado</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="CT">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Connecticut</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="DC">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>District of Columbia</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="DE">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Delaware</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="FL">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Florida</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="GA">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Georgia</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="HI">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Hawaii</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="ID">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Idaho</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="IL">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Illinois</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="IN">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Indiana</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="IA">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Iowa</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="KS">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Kansas</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="KY">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Kentucky</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="LA">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Louisiana</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="ME">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Maine</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="MD">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Maryland</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="MA">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Massachusetts</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="MI">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Michigan</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="MN">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Minnesota</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="MS">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Mississippi</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="MO">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Missouri</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="MT">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Montana</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="NE">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Nebraska</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="NV">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Nevada</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="NH">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>New Hampshire</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="NJ">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>New Jersey</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="NM">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>New Mexico</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="NY">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>New York</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="NC">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>North Carolina</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="ND">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>North Dakota</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="OH">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Ohio</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="OK">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Oklahoma</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="OR">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Oregon</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="PA">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Pennsylvania</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="RI">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Rhode Island</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="SC">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>South Carolina</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="SD">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>South Dakota</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="TN">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Tennessee</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="TX">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Texas</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="UT">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Utah</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="VT">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Vermont</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="VA">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Virginia</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="WA">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Washington</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="WV">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>West Virginia</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="WI">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Wisconsin</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="WY">
|
||||
<xs:annotation>
|
||||
<xs:appinfo><alf:label>Wyoming</alf:label></xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<!-- defines the form for creating a user profile -->
|
||||
<xs:complexType name="user-profile">
|
||||
<xs:sequence>
|
||||
<xs:element name="name">
|
||||
<xs:annotation>
|
||||
<xs:appinfo>
|
||||
<alf:appearance>default</alf:appearance>
|
||||
</xs:appinfo>
|
||||
</xs:annotation>
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="prefix" type="article:name-prefix"/>
|
||||
<xs:element name="first" type="xs:normalizedString"/>
|
||||
<xs:element name="last" type="xs:normalizedString"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="address" minOccurs="0"
|
||||
maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="street" type="xs:normalizedString" minOccurs="1" maxOccurs="unbounded"/>
|
||||
<xs:element name="city" type="xs:normalizedString"/>
|
||||
<xs:element name="state" type="article:us-state"/>
|
||||
<xs:element name="zip">
|
||||
<xs:annotation>
|
||||
<xs:appinfo>
|
||||
<alf:alert>The value entered is not a valid zip code.</alf:alert>
|
||||
</xs:appinfo>
|
||||
</xs:annotation>
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:normalizedString">
|
||||
<xs:maxLength value="5"/>
|
||||
<xs:pattern value="[0-9][0-9][0-9][0-9][0-9]"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="picture" type="xs:anyURI" minOccurs="0" maxOccurs="1" default="/content/user_profile/pictures"/>
|
||||
<xs:element name="bio" type="xs:string"/>
|
||||
<xs:element name="email" minOccurs="0" maxOccurs="1">
|
||||
<xs:annotation>
|
||||
<xs:appinfo>
|
||||
<alf:alert>The value entered is not a valid email address.</alf:alert>
|
||||
</xs:appinfo>
|
||||
</xs:annotation>
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:normalizedString">
|
||||
<xs:maxLength value="256"/>
|
||||
<xs:pattern value="[A-Za-z0-9._]+@[A-Za-z0-9.\-]+\.[A-Za-z]{2,4}"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="popularity" minOccurs="0" maxOccurs="1" default="3">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:decimal">
|
||||
<xs:totalDigits value="2"/>
|
||||
<xs:fractionDigits value="1"/>
|
||||
<xs:minInclusive value="0.0"/>
|
||||
<xs:maxInclusive value="5.0"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="article-picture">
|
||||
<xs:sequence>
|
||||
<xs:element name="image" type="xs:anyURI" minOccurs="0" maxOccurs="1" default="/content/article/photos">
|
||||
<xs:annotation>
|
||||
<xs:appinfo>
|
||||
<alf:appearance>image_file_picker</alf:appearance>
|
||||
</xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="caption" type="xs:normalizedString" minOccurs="0" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="article-page">
|
||||
<xs:sequence>
|
||||
<xs:element name="page_title" type="xs:normalizedString" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="page_body" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:appinfo>
|
||||
<alf:appearance>full</alf:appearance>
|
||||
</xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="page_picture" type="article:article-picture" minOccurs="0" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="related-item">
|
||||
<xs:sequence>
|
||||
<xs:element name="item_label" type="xs:normalizedString" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="item_link" type="xs:anyURI" minOccurs="0" maxOccurs="1">
|
||||
<xs:annotation>
|
||||
<xs:appinfo>
|
||||
<alf:appearance>search_restricted_file_picker</alf:appearance>
|
||||
</xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<!-- defines the form for creating a user_profile -->
|
||||
<xs:element name="user_profile" type="article:user-profile" />
|
||||
|
||||
<!-- defines the form for creating a news flash -->
|
||||
<xs:element name="news_flash">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="title" type="xs:normalizedString" />
|
||||
<xs:element name="location" type="xs:normalizedString"/>
|
||||
<xs:element name="date" type="xs:date" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="body" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:appinfo>
|
||||
<alf:appearance>full</alf:appearance>
|
||||
</xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<!-- defines the form for creating a full article -->
|
||||
<xs:element name="article">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="title" type="xs:normalizedString" />
|
||||
<xs:element name="author" type="article:content-list" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="location" type="xs:normalizedString"/>
|
||||
<xs:element name="date" type="xs:date" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="teaser" type="xs:string"/>
|
||||
<xs:element name="tag" type="xs:normalizedString" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xs:element name="page" type="article:article-page" minOccurs="1" maxOccurs="unbounded"/>
|
||||
<xs:element name="related" type="article:related-item" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="include_legal_text" type="xs:boolean" default="false"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
</xs:schema>
|
@@ -1,130 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
<xsl:stylesheet version="1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:article="http://www.alfresco.org/alfresco/article"
|
||||
xmlns:fn="http://www.w3.org/2005/02/xpath-functions" exclude-result-prefixes="xhtml">
|
||||
<xsl:output method="html" encoding="UTF-8" indent="yes"
|
||||
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
|
||||
|
||||
<xsl:preserve-space elements="*"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>
|
||||
<xsl:value-of select="/article:article/article:title" disable-output-escaping="yes"/>
|
||||
</title>
|
||||
<meta name="description" lang="en">
|
||||
<xsl:attribute name="content">
|
||||
<xsl:value-of select="/article:article/article:title" disable-output-escaping="yes"/>
|
||||
</xsl:attribute>
|
||||
</meta>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<h1>
|
||||
<xsl:value-of select="/article:article/article:title" disable-output-escaping="yes"/>
|
||||
</h1>
|
||||
</td>
|
||||
<td align="right" valign="top">
|
||||
<xsl:element name="a">
|
||||
<xsl:attribute name="href">/content/article/<xsl:value-of select="fn:replaceAll(string($alf:form_instance_data_file_name), '.xml', '.pdf')"/></xsl:attribute>
|
||||
<img src="/views/common/images/icons/pdficon_small.gif"/>
|
||||
</xsl:element>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<i>
|
||||
<xsl:value-of select="/article:article/article:author" disable-output-escaping="yes"/>,<xsl:value-of select="/article:article/article:launch_date"/>
|
||||
</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<p>
|
||||
<xsl:if test="/article:article/article:photo[article:page_number='0']">
|
||||
<xsl:element name="img">
|
||||
<xsl:attribute name="src">
|
||||
<xsl:value-of select="/article:article/article:photo[article:page_number='0']/article:image"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="align">
|
||||
<xsl:text>left</xsl:text>
|
||||
</xsl:attribute>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="normalize-space(/article:article/article:teaser)" disable-output-escaping="yes"/>
|
||||
</p>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" colspan="2">
|
||||
<xsl:for-each select="/article:article/article:body">
|
||||
<xsl:variable name="page_number" select="1+count(preceding-sibling::*[name()=name(current())])"/>
|
||||
<p>
|
||||
<xsl:if test="/article:article/article:photo[article:page_number=$page_number]">
|
||||
<xsl:element name="table">
|
||||
<xsl:attribute name="align">
|
||||
<xsl:if test="$page_number mod 2 = 0">
|
||||
<xsl:text>left</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="$page_number mod 2 = 1">
|
||||
<xsl:text>right</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:attribute>
|
||||
<tr>
|
||||
<td>
|
||||
<xsl:element name="img">
|
||||
<xsl:attribute name="src">
|
||||
<xsl:value-of select="/article:article/article:photo[article:page_number=$page_number]/article:image"/>
|
||||
</xsl:attribute>
|
||||
</xsl:element>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width='200' align="center">
|
||||
<h6><xsl:value-of select="/article:article/article:photo[article:page_number=$page_number]/article:caption" disable-output-escaping="yes"/></h6>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
<xsl:if test="position()=1">
|
||||
<b>
|
||||
<xsl:value-of select="normalize-space(/article:article/article:location)" disable-output-escaping="yes"/>
|
||||
</b>
|
||||
—
|
||||
</xsl:if>
|
||||
<xsl:value-of select="normalize-space(.)" disable-output-escaping="yes"/>
|
||||
</p>
|
||||
</xsl:for-each>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
@@ -1,44 +0,0 @@
|
||||
<#ftl ns_prefixes={"D":"http://www.alfresco.org/alfresco/article","xsi":"http://www.w3.org/2001/XMLSchema-instance"}>
|
||||
<style>
|
||||
.article_details {
|
||||
background: #fff;
|
||||
padding: 10px;
|
||||
position: relative;
|
||||
font-family: helvetica;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.article_title{
|
||||
padding: 8px;
|
||||
font-size: 20px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.article_author {
|
||||
background: #fff;
|
||||
border: 1px solid #e2e1e1;
|
||||
position: relative;
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
|
||||
.article_teaser {
|
||||
clear: left;
|
||||
margin: 10px 0 10px 0px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<div class="article_details">
|
||||
|
||||
<div class="article_title">
|
||||
${news_flash.title}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="article_teaser">
|
||||
<span>${news_flash.location} ${news_flash.date}</span> - ${news_flash.body}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
@@ -1,36 +0,0 @@
|
||||
<#ftl ns_prefixes={"D":"http://www.alfresco.org/alfresco/article","xsi":"http://www.w3.org/2001/XMLSchema-instance","alf":"http://www.alfresco.org"}>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<#if user_profile[0]??>
|
||||
<#if user_profile.picture[0]??>
|
||||
<td>
|
||||
<img src="${alf.avm_sandbox_url}${user_profile.picture}" width="100"/>
|
||||
</td>
|
||||
</#if>
|
||||
<td>
|
||||
<div>
|
||||
${user_profile.name.prefix}. ${user_profile.name.first} ${user_profile.name.last}
|
||||
</div>
|
||||
<div>
|
||||
${user_profile.bio}
|
||||
</div>
|
||||
<div>
|
||||
<#if user_profile.address[0]??>
|
||||
<b>Address: </b>
|
||||
<#list user_profile.address.street as street>
|
||||
${street}
|
||||
</#list>
|
||||
${user_profile.address.city}, ${user_profile.address.state} ${user_profile.address.zip}
|
||||
</#if>
|
||||
</div>
|
||||
<div>
|
||||
<#if user_profile.email[0]??>
|
||||
<b>Email: </b>${user_profile.email}
|
||||
</#if>
|
||||
</div>
|
||||
</td>
|
||||
</#if>
|
||||
</tr>
|
||||
</table>
|
||||
|
@@ -1,50 +0,0 @@
|
||||
<#ftl ns_prefixes={"D":"http://www.alfresco.org/alfresco/article","xsi":"http://www.w3.org/2001/XMLSchema-instance"}>
|
||||
<style>
|
||||
|
||||
.user_profile {
|
||||
background: #fff;
|
||||
border: 1px solid #e2e1e1;
|
||||
position: relative;
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
.user_profile_picture {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 80px;
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
.user_profile_name {
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="user_profile">
|
||||
<#if user_profile[0]??>
|
||||
<#if user_profile.picture[0]??>
|
||||
<img src="${user_profile.picture}" class="user_profile_picture"/>
|
||||
</#if>
|
||||
<div class="user_profile_name">
|
||||
${user_profile.name.prefix}. ${user_profile.name.first} ${user_profile.name.last}
|
||||
</div>
|
||||
<div>
|
||||
${user_profile.bio}
|
||||
</div>
|
||||
<div>
|
||||
<#if user_profile.address[0]??>
|
||||
<b>Address: </b>
|
||||
<#list user_profile.address.street as street>
|
||||
${street}
|
||||
</#list>
|
||||
${user_profile.address.city}, ${user_profile.address.state} ${user_profile.address.zip}
|
||||
</#if>
|
||||
</div>
|
||||
<div>
|
||||
<#if user_profile.email[0]??>
|
||||
<b>Email: </b>${user_profile.email}
|
||||
</#if>
|
||||
</div>
|
||||
</#if>
|
||||
</div>
|
||||
|
@@ -1,8 +0,0 @@
|
||||
<webscript>
|
||||
<shortname>WCM Schema for Category Selection</shortname>
|
||||
<description>Generate part of schema for category selection</description>
|
||||
<url format="html" template="/demo/wcm/schema/catgory"/>
|
||||
<format default="html">extension</format>
|
||||
<authentication>user</authentication>
|
||||
<transaction>required</transaction>
|
||||
</webscript>
|
@@ -1,23 +0,0 @@
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:article="http://www.alfresco.org/alfresco/article"
|
||||
elementFormDefault="qualified">
|
||||
<xs:simpleType name="catgory-list">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="Pressrelease">
|
||||
<xs:annotation>
|
||||
<xs:appinfo>
|
||||
<alfresco:label>Press Release</alfresco:label>
|
||||
</xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="Whitepaper">
|
||||
<xs:annotation>
|
||||
<xs:appinfo>
|
||||
<alfresco:label>Whitepaper</alfresco:label>
|
||||
</xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:schema>
|
||||
|
@@ -1,8 +0,0 @@
|
||||
<webscript>
|
||||
<shortname>WCM Schema for Content Selection</shortname>
|
||||
<description>Generate part of schema for content selection</description>
|
||||
<url format="xml" template="/demo/wcm/schema/content/list"/>
|
||||
<format default="xml">extension</format>
|
||||
<authentication>user</authentication>
|
||||
<transaction>required</transaction>
|
||||
</webscript>
|
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<#if results??>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:article="http://www.alfresco.org/alfresco/article"
|
||||
targetNamespace="http://www.alfresco.org/alfresco/article"
|
||||
xmlns:alf="http://www.alfresco.org"
|
||||
elementFormDefault="qualified">
|
||||
<xs:simpleType name="content-list">
|
||||
<xs:restriction base="xs:string">
|
||||
<#list results as result>
|
||||
<#if ! result.hasAspect("{http://www.alfresco.org/model/wcmappmodel/1.0}rendition")>
|
||||
<xs:enumeration value="${result.displayPath?substring(result.displayPath?index_of("/www/avm_webapps/ROOT")+21)}/${result.name}">
|
||||
<xs:annotation>
|
||||
<xs:appinfo>
|
||||
<alf:label>${result.name?substring(0,result.name?index_of(".xml"))}</alf:label>
|
||||
</xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
</#if>
|
||||
</#list>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:schema>
|
||||
</#if>
|
||||
|
@@ -1,70 +0,0 @@
|
||||
var contentList = null;
|
||||
|
||||
if (args["storeid"] == null) {
|
||||
|
||||
logger.log("ERROR: 'store' argument not specified.");
|
||||
|
||||
} else {
|
||||
|
||||
// Get the store id
|
||||
var storeId = args["storeid"];
|
||||
|
||||
var store = avm.lookupStore(storeId);
|
||||
|
||||
if ( store != null ) {
|
||||
|
||||
// Get the form name
|
||||
var formName = args["form"];
|
||||
|
||||
if ( formName != null ) {
|
||||
|
||||
|
||||
var method = (args.method == null) ? "lucene" : args.method;
|
||||
|
||||
if ( method == "lucene" ) {
|
||||
|
||||
// Run the lucene query
|
||||
var results = store.luceneSearch('@\\{http\\://www.alfresco.org/model/wcmappmodel/1.0\\}parentformname:"'+formName+'"');
|
||||
|
||||
contentList = results;
|
||||
|
||||
} else {
|
||||
|
||||
var path = (args.path == null) ? "/ROOT" : args.path;
|
||||
|
||||
var storeRootNode = avm.lookupStoreRoot(storeId);
|
||||
|
||||
// try xpath???
|
||||
|
||||
var results = avm.lookupNode(storeRootNode.path + path);
|
||||
|
||||
var contentList = new Array();
|
||||
|
||||
if ( results.children != null ) {
|
||||
|
||||
for ( var i = 0 ; i < results.children.length ; i ++ ) {
|
||||
|
||||
var item = results.children[i];
|
||||
|
||||
if ( item.properties["{http://www.alfresco.org/model/wcmappmodel/1.0}parentformname"] == formName ) {
|
||||
|
||||
contentList.push(item);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
model.results= contentList;
|
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<#if results??>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:article="http://www.alfresco.org/alfresco/article"
|
||||
targetNamespace="http://www.alfresco.org/alfresco/article"
|
||||
xmlns:alf="http://www.alfresco.org"
|
||||
elementFormDefault="qualified">
|
||||
<xs:simpleType name="content-list">
|
||||
<xs:restriction base="xs:string">
|
||||
<#list results as result>
|
||||
<#if ! result.hasAspect("{http://www.alfresco.org/model/wcmappmodel/1.0}rendition")>
|
||||
<xs:enumeration value="${result.displayPath?substring(result.displayPath?index_of("/www/avm_webapps/ROOT")+21)}/${result.name}">
|
||||
<xs:annotation>
|
||||
<xs:appinfo>
|
||||
<alf:label>${result.name?substring(0,result.name?index_of(".xml"))}</alf:label>
|
||||
</xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
</#if>
|
||||
</#list>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:schema>
|
||||
</#if>
|
||||
|
Binary file not shown.
@@ -1,35 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Describes a press release and related assets.
|
||||
-->
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:pr="http://www.alfresco.org/alfresco/pr"
|
||||
targetNamespace="http://www.alfresco.org/alfresco/pr"
|
||||
elementFormDefault="qualified">
|
||||
<!-- defines the form for creating a company footer -->
|
||||
<xs:element name="company_footer">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="name" type="xs:normalizedString"/>
|
||||
<xs:element name="body" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
@@ -1,38 +0,0 @@
|
||||
<#ftl ns_prefixes={"D", "http://www.alfresco.org/alfresco/pr"}>
|
||||
|
||||
<#macro show_heading heading>
|
||||
${heading}
|
||||
<#list 1..heading?length as index>-</#list>
|
||||
</#macro>
|
||||
|
||||
<@show_heading heading="Title: ${press_release.title}"/>
|
||||
|
||||
<@show_heading heading="Abstract: ${press_release.abstract}"/>
|
||||
|
||||
<#list press_release.body as body>
|
||||
<#if body_index = 0>
|
||||
${press_release.location}--${press_release.launch_date}--
|
||||
</#if>
|
||||
${body?trim}
|
||||
</#list>
|
||||
<#list press_release.include_company_footer as cf>
|
||||
<#assign cf_document=alf.parseXMLDocument(cf)>
|
||||
|
||||
<@show_heading heading="About ${cf_document.name}"/>
|
||||
<#list cf_document.body as body>
|
||||
${body?trim}
|
||||
</#list>
|
||||
</#list>
|
||||
<#if press_release.include_media_contacts = "true">
|
||||
|
||||
<@show_heading heading="Media Contacts"/>
|
||||
John Newton
|
||||
Alfresco Software Inc.
|
||||
+44 1628 860639
|
||||
press@alfresco.com
|
||||
|
||||
Chuck Tanowitz
|
||||
Schwartz Communications
|
||||
+1 781 684-0770
|
||||
alfresco@schwartz-pr.com
|
||||
</#if>
|
@@ -1,18 +0,0 @@
|
||||
<alfresco:press-release xmlns:alfresco="http://www.alfresco.org/alfresco">
|
||||
<alfresco:title>t</alfresco:title>
|
||||
<alfresco:abstract>a</alfresco:abstract>
|
||||
<alfresco:location>l</alfresco:location>
|
||||
<alfresco:body>b1</alfresco:body>
|
||||
<alfresco:body>b2</alfresco:body>
|
||||
<alfresco:body>b2</alfresco:body>
|
||||
<alfresco:body>b2</alfresco:body>
|
||||
<alfresco:body>b2</alfresco:body>
|
||||
<alfresco:body>b2</alfresco:body>
|
||||
<alfresco:body>b55</alfresco:body>
|
||||
<alfresco:include_company_footer>Alfresco</alfresco:include_company_footer>
|
||||
<alfresco:include_media_contacts>true</alfresco:include_media_contacts>
|
||||
<alfresco:keywords>k</alfresco:keywords>
|
||||
<alfresco:category>Event</alfresco:category>
|
||||
<alfresco:launch_date>1978-08-08</alfresco:launch_date>
|
||||
<alfresco:expiration_date>1978-08-08</alfresco:expiration_date>
|
||||
</alfresco:press-release>
|
@@ -1,57 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Describes a press release and related assets.
|
||||
-->
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:pr="http://www.alfresco.org/alfresco/pr"
|
||||
targetNamespace="http://www.alfresco.org/alfresco/pr"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<!-- dynamically loads the company footer choices simple type -->
|
||||
<xs:include schemaLocation="/media/releases/get_company_footer_choices_simple_type.jsp"/>
|
||||
|
||||
<xs:simpleType name="category">
|
||||
<xs:restriction base="xs:normalizedString">
|
||||
<xs:enumeration value="Product"/>
|
||||
<xs:enumeration value="Partnership"/>
|
||||
<xs:enumeration value="Company"/>
|
||||
<xs:enumeration value="Event"/>
|
||||
<xs:enumeration value="Training"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<!-- defines the form for creating a press release -->
|
||||
<xs:element name="press_release">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="title" type="xs:normalizedString"/>
|
||||
<xs:element name="abstract" type="xs:normalizedString"/>
|
||||
<xs:element name="location" type="xs:normalizedString"/>
|
||||
<xs:element name="body" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
|
||||
<xs:element name="include_company_footer" type="pr:company_footer_choices" minOccurs="1" maxOccurs="unbounded"/>
|
||||
<xs:element name="include_media_contacts" type="xs:boolean" default="true"/>
|
||||
<xs:element name="keywords" type="xs:normalizedString" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="category" type="pr:category" default="Company"/>
|
||||
<xs:element name="launch_date" type="xs:date"/>
|
||||
<xs:element name="expiration_date" type="xs:date"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
@@ -1,161 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
Produces an html rendition of a press release
|
||||
-->
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:pr="http://www.alfresco.org/alfresco/pr"
|
||||
xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
|
||||
exclude-result-prefixes="xhtml">
|
||||
<xsl:output method="html" encoding="UTF-8" indent="yes"
|
||||
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
|
||||
|
||||
<xsl:preserve-space elements="*"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<!-- include common navigation components using SSIs (see web.xml for more information) -->
|
||||
<xsl:comment>#include virtual="/assets/include_in_head.html"</xsl:comment>
|
||||
<title><xsl:value-of select="/pr:press_release/pr:title"/></title>
|
||||
<meta name="description" lang="en" >
|
||||
<xsl:attribute name="content"><xsl:value-of select="/pr:press_release/pr:title"/></xsl:attribute>
|
||||
</meta>
|
||||
<style type="text/css">
|
||||
p.leader {
|
||||
font-weight: 700;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
<xsl:comment>#include virtual="/assets/include_main_navigation.html"</xsl:comment>
|
||||
<xsl:comment>#include virtual="/about/navigation.html"</xsl:comment>
|
||||
<div id="content"> </div>
|
||||
<!-- Main Content -->
|
||||
<div id="main_content">
|
||||
|
||||
<!-- BEGIN MAIN CONTENT -->
|
||||
<h1><xsl:value-of select="/pr:press_release/pr:title"/></h1>
|
||||
<p><strong><xsl:value-of select="/pr:press_release/pr:abstract"/></strong></p>
|
||||
<p></p>
|
||||
<xsl:for-each select="/pr:press_release/pr:body">
|
||||
<p>
|
||||
<xsl:variable name="body-text"><xsl:value-of select="normalize-space(.)" disable-output-escaping="yes"/></xsl:variable>
|
||||
<xsl:if test="position()=1"><xsl:value-of select="normalize-space(/pr:press_release/pr:location)"/>—<xsl:value-of select="normalize-space(/pr:press_release/pr:launch_date)"/>—</xsl:if><xsl:value-of select="alf:encodeQuotes($body-text)" disable-output-escaping="yes"/>
|
||||
</p>
|
||||
</xsl:for-each>
|
||||
<xsl:for-each select="/pr:press_release/pr:include_company_footer">
|
||||
<xsl:variable name="cf-id"><xsl:value-of select="."/></xsl:variable>
|
||||
<!-- load the xml document for the company footer using a built in FormDataFunction -->
|
||||
<xsl:variable name="cf" select="alf:parseXMLDocument($cf-id)"/>
|
||||
<h2>About <xsl:value-of select="$cf/pr:name"/></h2>
|
||||
<xsl:for-each select="$cf/pr:body">
|
||||
<xsl:variable name="bd-text"><xsl:value-of select="normalize-space(.)" disable-output-escaping="yes"/></xsl:variable>
|
||||
<p><xsl:value-of select="alf:encodeQuotes($bd-text)" disable-output-escaping="yes"/></p>
|
||||
</xsl:for-each>
|
||||
</xsl:for-each>
|
||||
<xsl:if test="/pr:press_release/pr:include_media_contacts='true'">
|
||||
<h2>Media Contacts</h2>
|
||||
<div><p>John Newton<br />Alfresco Software Inc.<br />+44 1628 860639<br />press@alfresco.com</p></div>
|
||||
<div><p>Chuck Tanowitz<br />Schwartz Communications<br />+1 781 684-0770<br />alfresco@schwartz-pr.com</p></div>
|
||||
</xsl:if>
|
||||
<!-- END MAIN CONTENT -->
|
||||
<xsl:element name="a">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:value-of select="fn:replaceAll(string($alf:form_instance_data_file_name), '.xml', '.txt')"/>
|
||||
</xsl:attribute>
|
||||
<xsl:text>view plain text version</xsl:text>
|
||||
</xsl:element>
|
||||
</div>
|
||||
<!-- Feature Content -->
|
||||
<div id="right_content">
|
||||
<div class="box_blue">
|
||||
<h2>Press Releases By Category</h2>
|
||||
|
||||
<!-- store the current category in a variable for later comparison -->
|
||||
<xsl:variable name="my_category"
|
||||
select="/pr:press_release/pr:category"/>
|
||||
<!-- store the current title in a variable for later comparison -->
|
||||
<xsl:variable name="my_title"
|
||||
select="/pr:press_release/pr:title"/>
|
||||
<!-- load all press releases into a variable by calling into a form data function -->
|
||||
<xsl:variable name="all_press_releases"
|
||||
select="alf:parseXMLDocuments('press-release')"/>
|
||||
<ul>
|
||||
<!-- select a unique set of categories for the first level navigation -->
|
||||
<xsl:for-each select="$all_press_releases[not(pr:category=preceding-sibling::pr:press_release/pr:category)]">
|
||||
<xsl:sort select="pr:category"/>
|
||||
<li>
|
||||
<xsl:choose>
|
||||
<!-- for the current category, present all press releases in this category -->
|
||||
<xsl:when test="pr:category=$my_category">
|
||||
<b><xsl:value-of select="pr:category"/></b>
|
||||
<ul>
|
||||
<!-- iterate all press releases which are in my_category -->
|
||||
<xsl:for-each select="$all_press_releases[pr:category=$my_category]">
|
||||
<xsl:sort select="pr:title"/>
|
||||
<li>
|
||||
<xsl:element name="a">
|
||||
<xsl:if test="$my_title=pr:title">
|
||||
<xsl:attribute name="style">font-weight:bold;</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:value-of select="fn:replaceAll(string(@alf:file_name), '.xml', '.html')"/>
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="pr:title"/>
|
||||
</xsl:element>
|
||||
</li>
|
||||
</xsl:for-each>
|
||||
</ul>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!--
|
||||
for other categories present a link to the first document in that category
|
||||
with the category label
|
||||
-->
|
||||
<xsl:element name="a">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:value-of select="fn:replaceAll(string(@alf:file_name), '.xml', '.html')"/>
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="pr:category"/>
|
||||
</xsl:element>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</li>
|
||||
</xsl:for-each>
|
||||
</ul>
|
||||
<h2>Press Release Archive</h2>
|
||||
<ul>
|
||||
<li><a href="/media/releases/archives/index.html">View Archived Releases</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="clear"> </div>
|
||||
</div>
|
||||
<!--All Three End -->
|
||||
<xsl:comment>#include virtual="/assets/footer.html"</xsl:comment>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
elementFormDefault="qualified">
|
||||
<xs:element name="note">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="to" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
|
||||
<xs:element name="from" type="xs:string"/>
|
||||
<xs:element name="subject" type="xs:string"/>
|
||||
<xs:element name="body" type="xs:anyType"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="important" type="xs:boolean" default="false"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
@@ -1,61 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
exclude-result-prefixes="xhtml">
|
||||
|
||||
<xsl:output method="html" version="4.01" encoding="UTF-8" indent="yes"
|
||||
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>
|
||||
<xsl:preserve-space elements="*"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
body
|
||||
{
|
||||
font-family: Tahoma, Arial, Helvetica, sans-serif;
|
||||
background-color: white;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.name {
|
||||
color: #003366;
|
||||
font-weight: bold;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<title><xsl:value-of select="/note/title"/></title>
|
||||
</head>
|
||||
<body>
|
||||
<xsl:apply-templates/>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
<xsl:template match="/note/to">
|
||||
<div style="line-height: 25px;"><span class="name">To:</span> <xsl:value-of select="/note/to"/></div>
|
||||
</xsl:template>
|
||||
<xsl:template match="/note/from">
|
||||
<div><span class="name">From:</span> <xsl:value-of select="/note/from"/></div>
|
||||
</xsl:template>
|
||||
<xsl:template match="/note/subject">
|
||||
<div style="position:relative;">
|
||||
<span class="name">Subject:</span>
|
||||
<xsl:value-of select="/note/subject"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="/note/@important='true'">
|
||||
<span style="margin-left:5px;font-size:14px;font-weigh:bold;color:red;">!!!!!</span>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</div>
|
||||
</xsl:template>
|
||||
<xsl:template match="/note/body">
|
||||
<div style="width: 50%; height: 250px; border: solid 1px black; margin-top: 15px;">
|
||||
<tt><xsl:value-of select="/note/body"/></tt>
|
||||
</div>
|
||||
</xsl:template>
|
||||
<xsl:template match="/note/important">
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
@@ -1,113 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
elementFormDefault="qualified">
|
||||
<xs:simpleType name="name-prefix">
|
||||
<xs:restriction base="xs:normalizedString">
|
||||
<xs:enumeration value="Mr"/>
|
||||
<xs:enumeration value="Mrs"/>
|
||||
<xs:enumeration value="Ms"/>
|
||||
<xs:enumeration value="Miss"/>
|
||||
<xs:enumeration value="Dr"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="us-state">
|
||||
<xs:restriction base="xs:normalizedString">
|
||||
<xs:enumeration value="AL"/>
|
||||
<xs:enumeration value="AK"/>
|
||||
<xs:enumeration value="AZ"/>
|
||||
<xs:enumeration value="AR"/>
|
||||
<xs:enumeration value="CA"/>
|
||||
<xs:enumeration value="CO"/>
|
||||
<xs:enumeration value="CT"/>
|
||||
<xs:enumeration value="DC"/>
|
||||
<xs:enumeration value="DE"/>
|
||||
<xs:enumeration value="FL"/>
|
||||
<xs:enumeration value="GA"/>
|
||||
<xs:enumeration value="HI"/>
|
||||
<xs:enumeration value="ID"/>
|
||||
<xs:enumeration value="IL"/>
|
||||
<xs:enumeration value="IN"/>
|
||||
<xs:enumeration value="IA"/>
|
||||
<xs:enumeration value="KS"/>
|
||||
<xs:enumeration value="KY"/>
|
||||
<xs:enumeration value="LA"/>
|
||||
<xs:enumeration value="ME"/>
|
||||
<xs:enumeration value="MD"/>
|
||||
<xs:enumeration value="MA"/>
|
||||
<xs:enumeration value="MI"/>
|
||||
<xs:enumeration value="MN"/>
|
||||
<xs:enumeration value="MS"/>
|
||||
<xs:enumeration value="MO"/>
|
||||
<xs:enumeration value="MT"/>
|
||||
<xs:enumeration value="NE"/>
|
||||
<xs:enumeration value="NV"/>
|
||||
<xs:enumeration value="NH"/>
|
||||
<xs:enumeration value="NJ"/>
|
||||
<xs:enumeration value="NM"/>
|
||||
<xs:enumeration value="NY"/>
|
||||
<xs:enumeration value="NC"/>
|
||||
<xs:enumeration value="ND"/>
|
||||
<xs:enumeration value="OH"/>
|
||||
<xs:enumeration value="OK"/>
|
||||
<xs:enumeration value="OR"/>
|
||||
<xs:enumeration value="PA"/>
|
||||
<xs:enumeration value="RI"/>
|
||||
<xs:enumeration value="SC"/>
|
||||
<xs:enumeration value="SD"/>
|
||||
<xs:enumeration value="TN"/>
|
||||
<xs:enumeration value="TX"/>
|
||||
<xs:enumeration value="UT"/>
|
||||
<xs:enumeration value="VT"/>
|
||||
<xs:enumeration value="VA"/>
|
||||
<xs:enumeration value="WA"/>
|
||||
<xs:enumeration value="WV"/>
|
||||
<xs:enumeration value="WI"/>
|
||||
<xs:enumeration value="WY"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
|
||||
<xs:element name="person">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="picture" type="xs:anyURI"/>
|
||||
<xs:element name="email" minOccurs="0" maxOccurs="5">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:normalizedString">
|
||||
<xs:maxLength value="256"/>
|
||||
<xs:pattern value="[A-Za-z0-9._]+@[A-Za-z0-9.\-]+\.[A-Za-z]{2,4}"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="bio" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
<xs:element name="name">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="prefix" type="name-prefix"/>
|
||||
<xs:element name="first" type="xs:normalizedString"/>
|
||||
<xs:element name="last" type="xs:normalizedString"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="address" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="street" type="xs:normalizedString" minOccurs="1" maxOccurs="unbounded"/>
|
||||
<xs:element name="city" type="xs:normalizedString"/>
|
||||
<xs:element name="state" type="us-state"/>
|
||||
<xs:element name="zip">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:normalizedString">
|
||||
<xs:maxLength value="5"/>
|
||||
<xs:pattern value="[0-9][0-9][0-9][0-9][0-9]"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:attribute name="title" type="xs:normalizedString"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
@@ -1,36 +0,0 @@
|
||||
[#ftl ns_prefixes={"D", "http://www.alfresco.org/alfresco/press-release"}]
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
${PressRelease.Title}
|
||||
</title>
|
||||
[#if PressRelease.Summary?exists]
|
||||
<meta name="description" content="${PressRelease.Summary}">
|
||||
[/#if]
|
||||
[#if PressRelease.Keyword?exists]
|
||||
[#if PressRelease.Keyword?size > 0]
|
||||
[#assign keywordString = ""]
|
||||
[#list PressRelease.Keyword as Keyword]
|
||||
[#assign keywordString = keywordString + "," + Keyword]
|
||||
[/#list]
|
||||
<meta name="keywords" content="${keywordString}">
|
||||
[/#if]
|
||||
[/#if]
|
||||
</head>
|
||||
<body>
|
||||
<h1>${PressRelease.Title}</h1>
|
||||
<p>${PressRelease.Body}</p>
|
||||
[#if PressRelease.Image?exists]
|
||||
<img src="${PressRelease.Image}">
|
||||
[/#if]
|
||||
|
||||
<!-- TEST -->
|
||||
<hr>
|
||||
[#list avm.stores as store]
|
||||
${store.name}<br>
|
||||
[/#list]
|
||||
<hr>
|
||||
<!-- TEST END -->
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -1,75 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:pr="http://www.alfresco.org/alfresco/press-release"
|
||||
xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
|
||||
exclude-result-prefixes="xhtml">
|
||||
|
||||
<xsl:output method="html"
|
||||
encoding="UTF-8"
|
||||
indent="yes"
|
||||
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
|
||||
|
||||
<xsl:preserve-space elements="*" />
|
||||
|
||||
<xsl:template match="/">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>
|
||||
<xsl:value-of select="/pr:PressRelease/pr:Title" disable-output-escaping="yes" />
|
||||
</title>
|
||||
<xsl:if test="/pr:PressRelease/pr:Summary">
|
||||
<meta name="description" lang="en">
|
||||
<xsl:attribute name="content">
|
||||
<xsl:value-of select="/pr:PressRelease/pr:Summary" />
|
||||
</xsl:attribute>
|
||||
</meta>
|
||||
</xsl:if>
|
||||
<xsl:if test="/pr:PressRelease/pr:Keyword">
|
||||
<meta name="keyword" lang="en">
|
||||
<xsl:attribute name="content">
|
||||
<xsl:for-each select="/pr:PressRelease/pr:Keyword">
|
||||
<xsl:value-of select="normalize-space(.)" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="position() != last()">,</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:for-each>
|
||||
</xsl:attribute>
|
||||
</meta>
|
||||
</xsl:if>
|
||||
</head>
|
||||
<body>
|
||||
<h1><xsl:value-of select="/pr:PressRelease/pr:Title" disable-output-escaping="yes" /></h1>
|
||||
<p><xsl:value-of select="/pr:PressRelease/pr:Body" disable-output-escaping="yes" /></p>
|
||||
<xsl:if test="/pr:PressRelease/pr:Image">
|
||||
<img>
|
||||
<xsl:attribute name="src">
|
||||
<xsl:value-of select="/pr:PressRelease/pr:Image" disable-output-escaping="yes" />
|
||||
</xsl:attribute>
|
||||
</img>
|
||||
</xsl:if>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
@@ -1,52 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:pr="http://www.alfresco.org/alfresco/press-release"
|
||||
xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
|
||||
exclude-result-prefixes="xhtml">
|
||||
|
||||
<xsl:output method="html"
|
||||
encoding="UTF-8"
|
||||
indent="yes"
|
||||
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
|
||||
|
||||
<xsl:preserve-space elements="*" />
|
||||
|
||||
<xsl:template match="/">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head />
|
||||
<body>
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:value-of select="/pr:PressRelease/pr:Title" disable-output-escaping="yes" />.html
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="/pr:PressRelease/pr:Title" disable-output-escaping="yes" />
|
||||
</a>
|
||||
<xsl:if test="/pr:PressRelease/pr:Summary">
|
||||
<p><xsl:value-of select="/pr:PressRelease/pr:Summary" disable-output-escaping="yes" /></p>
|
||||
</xsl:if>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
@@ -1,42 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:pr="http://www.alfresco.org/alfresco/press-release"
|
||||
targetNamespace="http://www.alfresco.org/alfresco/press-release"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<!-- Complex Types -->
|
||||
<xs:complexType name="PressReleaseType">
|
||||
<xs:sequence>
|
||||
<xs:element name="Title" type="xs:normalizedString" minOccurs="1" maxOccurs="1" />
|
||||
<xs:element name="Summary" type="xs:normalizedString" minOccurs="0" maxOccurs="1" />
|
||||
<xs:element name="Keyword" type="xs:normalizedString" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xs:element name="PublishDate" type="xs:date" minOccurs="0" maxOccurs="1" />
|
||||
<xs:element name="ExpiryDate" type="xs:date" minOccurs="0" maxOccurs="1" />
|
||||
<xs:element name="Body" type="xs:string" minOccurs="1" maxOccurs="1" />
|
||||
<xs:element name="Image" type="xs:anyURI" minOccurs="0" maxOccurs="1" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
|
||||
<!-- Root Element -->
|
||||
<xs:element name="PressRelease" type="pr:PressReleaseType" />
|
||||
|
||||
</xs:schema>
|
@@ -1,73 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:pr="http://www.alfresco.org/alfresco/product"
|
||||
targetNamespace="http://www.alfresco.org/alfresco/product"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<!-- Simple types -->
|
||||
<xs:simpleType name="NonEmptyNormalizedStringType">
|
||||
<xs:restriction base="xs:normalizedString">
|
||||
<xs:minLength value="1" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="SKUType">
|
||||
<xs:restriction base="pr:NonEmptyNormalizedStringType">
|
||||
<xs:maxLength value="32" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
|
||||
<!-- Complex types -->
|
||||
<xs:complexType abstract="true" name="CommonPropertiesType">
|
||||
<xs:sequence>
|
||||
<xs:element name="Title" type="pr:NonEmptyNormalizedStringType" nillable="false" minOccurs="1" maxOccurs="1" />
|
||||
<xs:element name="Summary" type="pr:NonEmptyNormalizedStringType" nillable="false" minOccurs="0" maxOccurs="1" />
|
||||
<xs:element name="Keyword" type="pr:NonEmptyNormalizedStringType" nillable="false" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xs:element name="PublishDate" type="xs:date" nillable="false" minOccurs="0" maxOccurs="1" />
|
||||
<xs:element name="ExpiryDate" type="xs:date" nillable="false" minOccurs="0" maxOccurs="1" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="ProductType">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="pr:CommonPropertiesType">
|
||||
<xs:sequence>
|
||||
<xs:element name="SKU" type="pr:SKUType" nillable="false" minOccurs="1" maxOccurs="1" />
|
||||
<xs:element name="Body" type="xs:string" nillable="false" minOccurs="1" maxOccurs="1" />
|
||||
<xs:element name="SmallThumbnail" type="xs:anyURI" nillable="false" minOccurs="0" maxOccurs="1" />
|
||||
<xs:element name="LargeThumbnail" type="xs:anyURI" nillable="false" minOccurs="0" maxOccurs="1" />
|
||||
<xs:element name="Image" type="xs:anyURI" nillable="false" minOccurs="0" maxOccurs="unbounded" />
|
||||
</xs:sequence>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
|
||||
<!-- Root Element -->
|
||||
<xs:element name="Product" type="pr:ProductType">
|
||||
<xs:unique name="UniqueKeyword">
|
||||
<xs:selector xpath="pr:Keyword" />
|
||||
<xs:field xpath="." />
|
||||
</xs:unique>
|
||||
</xs:element>
|
||||
|
||||
</xs:schema>
|
@@ -1,102 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:pr="http://www.alfresco.org/alfresco/product"
|
||||
xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
|
||||
exclude-result-prefixes="xhtml">
|
||||
|
||||
<xsl:output method="html"
|
||||
encoding="UTF-8"
|
||||
indent="yes"
|
||||
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
|
||||
|
||||
<xsl:preserve-space elements="*" />
|
||||
|
||||
<xsl:template match="/">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>
|
||||
<xsl:value-of select="/pr:Product/pr:Title" disable-output-escaping="yes" />
|
||||
(<xsl:value-of select="/pr:Product/pr:SKU" disable-output-escaping="yes" />)
|
||||
</title>
|
||||
<xsl:if test="/pr:Product/pr:Summary">
|
||||
<meta name="description" lang="en">
|
||||
<xsl:attribute name="content">
|
||||
<xsl:value-of select="/pr:Product/pr:Summary" />
|
||||
</xsl:attribute>
|
||||
</meta>
|
||||
</xsl:if>
|
||||
<xsl:if test="/pr:Product/pr:Keyword">
|
||||
<meta name="keyword" lang="en">
|
||||
<xsl:attribute name="content">
|
||||
<xsl:for-each select="/pr:Product/pr:Keyword">
|
||||
<xsl:value-of select="normalize-space(.)" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="position() != last()">,</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:for-each>
|
||||
</xsl:attribute>
|
||||
</meta>
|
||||
</xsl:if>
|
||||
</head>
|
||||
<body>
|
||||
<h1>
|
||||
<xsl:value-of select="/pr:Product/pr:Title" disable-output-escaping="yes" />
|
||||
(<xsl:value-of select="/pr:Product/pr:SKU" disable-output-escaping="yes" />)
|
||||
</h1>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="/pr:Product/pr:LargeThumbnail">
|
||||
<img>
|
||||
<xsl:attribute name="src">
|
||||
<xsl:value-of select="/pr:Product/pr:LargeThumbnail" />
|
||||
</xsl:attribute>
|
||||
</img>
|
||||
</xsl:when>
|
||||
<xsl:when test="/pr:Product/pr:LargeThumbnail">
|
||||
<img>
|
||||
<xsl:attribute name="src">
|
||||
<xsl:value-of select="/pr:Product/pr:LargeThumbnail" />
|
||||
</xsl:attribute>
|
||||
</img>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
|
||||
<p><xsl:value-of select="/pr:Product/pr:Body" disable-output-escaping="yes" /></p>
|
||||
|
||||
<xsl:if test="/pr:Product/pr:Image">
|
||||
<h2>Other product images:</h2>
|
||||
<xsl:for-each select="/pr:Product/pr:Image">
|
||||
<img>
|
||||
<xsl:attribute name="src">
|
||||
<xsl:value-of select="." />
|
||||
</xsl:attribute>
|
||||
</img>
|
||||
<br/>
|
||||
</xsl:for-each>
|
||||
</xsl:if>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
@@ -1,30 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
elementFormDefault="qualified">
|
||||
<xs:simpleType name="genre">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="classical"/>
|
||||
<xs:enumeration value="jazz"/>
|
||||
<xs:enumeration value="soul"/>
|
||||
<xs:enumeration value="blues"/>
|
||||
<xs:enumeration value="country"/>
|
||||
<xs:enumeration value="rock"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:element name="record">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="track" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="title" type="xs:string"/>
|
||||
<xs:attribute name="length" type="xs:integer"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="name" type="xs:string"/>
|
||||
<xs:attribute name="artist" type="xs:string"/>
|
||||
<xs:attribute name="genre" type="genre" default="classical"/>
|
||||
<xs:attribute name="year" type="xs:gYear"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
exclude-result-prefixes="xhtml">
|
||||
|
||||
<xsl:output method="html" version="4.01" encoding="UTF-8" indent="yes"
|
||||
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>
|
||||
<xsl:preserve-space elements="*"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
body
|
||||
{
|
||||
font-family: Tahoma, Arial, Helvetica, sans-serif;
|
||||
background-color: white;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.name {
|
||||
color: #003366;
|
||||
font-weight: bold;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<title><xsl:value-of select="/record/@title"/></title>
|
||||
</head>
|
||||
<body>
|
||||
<div><span class="name">Name:</span> <xsl:value-of select="/record/@name"/></div>
|
||||
<div><span class="name">Artist:</span> <xsl:value-of select="/record/@artist"/></div>
|
||||
<div><span class="name">Genre:</span> <xsl:value-of select="/record/@genre"/></div>
|
||||
<div><span class="name">Year:</span> <xsl:value-of select="/record/@year"/></div>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
@@ -1,118 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:alf="http://www.alfresco.org"
|
||||
elementFormDefault="qualified" >
|
||||
<xs:simpleType name="name-prefix">
|
||||
<xs:restriction base="xs:normalizedString">
|
||||
<xs:enumeration value="Mr"/>
|
||||
<xs:enumeration value="Mrs"/>
|
||||
<xs:enumeration value="Dr"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="us-state">
|
||||
<xs:restriction base="xs:normalizedString">
|
||||
<xs:enumeration value="CN"/>
|
||||
<xs:enumeration value="DE"/>
|
||||
<xs:enumeration value="GA"/>
|
||||
<xs:enumeration value="MA"/>
|
||||
<xs:enumeration value="MD"/>
|
||||
<xs:enumeration value="NC"/>
|
||||
<xs:enumeration value="NH"/>
|
||||
<xs:enumeration value="NJ"/>
|
||||
<xs:enumeration value="NY"/>
|
||||
<xs:enumeration value="PA"/>
|
||||
<xs:enumeration value="RI"/>
|
||||
<xs:enumeration value="SC"/>
|
||||
<xs:enumeration value="VA"/>
|
||||
<xs:enumeration value="VT"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:simpleType name="canadian-province">
|
||||
<xs:restriction base="xs:normalizedString">
|
||||
<xs:enumeration value="Alberta"/>
|
||||
<xs:enumeration value="BC">
|
||||
<xs:annotation><xs:appinfo>
|
||||
<alf:label>Britsh Columbia</alf:label>
|
||||
</xs:appinfo></xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="NB">
|
||||
<xs:annotation><xs:appinfo>
|
||||
<alf:label>New Brunswick</alf:label>
|
||||
</xs:appinfo></xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="NF">
|
||||
<xs:annotation><xs:appinfo>
|
||||
<alf:label>New Foundland</alf:label>
|
||||
</xs:appinfo></xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="Ontario"/>
|
||||
<xs:enumeration value="Quebec"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:complexType name="abstract-address" abstract="true">
|
||||
<xs:sequence>
|
||||
<xs:element name="street" type="xs:normalizedString"/>
|
||||
<xs:element name="city" type="xs:normalizedString"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="us-address" abstract="false">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="abstract-address">
|
||||
<xs:sequence>
|
||||
<xs:element name="state" type="us-state"/>
|
||||
<xs:element name="zip">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:normalizedString">
|
||||
<xs:maxLength value="5"/>
|
||||
<xs:pattern value="[0-9][0-9][0-9][0-9][0-9]"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="canadian-address" abstract="false">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="abstract-address">
|
||||
<xs:sequence>
|
||||
<xs:element name="province" type="canadian-province"/>
|
||||
<xs:element name="postal-code" type="xs:normalizedString"/>
|
||||
</xs:sequence>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="uk-address" abstract="false">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="abstract-address">
|
||||
<xs:attribute name="postal-code" type="xs:normalizedString" use="required"/>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:element name="user-registration">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="name">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="prefix" type="name-prefix" use="required">
|
||||
<xs:annotation><xs:appinfo><alf:appearance>minimal</alf:appearance></xs:appinfo></xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="first" type="xs:normalizedString" use="required"/>
|
||||
<xs:attribute name="last" type="xs:normalizedString" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="picture" type="xs:anyURI" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="email" type="xs:normalizedString" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="address" type="abstract-address" minOccurs="1" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
</xs:schema>
|
Binary file not shown.
Binary file not shown.
@@ -1,15 +0,0 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
|
||||
|
||||
<beans>
|
||||
|
||||
<!-- See http://wiki.alfresco.com/wiki/Web_Scripts_Framework#Adding_new_Formats -->
|
||||
<bean parent="webscripts.formatmap">
|
||||
<property name="formats">
|
||||
<props>
|
||||
<prop key="xsd">text/xml</prop>
|
||||
</props>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
@@ -1,39 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:alf="http://www.alfresco.org"
|
||||
xmlns:wsiex="http://www.alfresco.org/alfresco/webscriptimportexample"
|
||||
xmlns:wsimp="http://www.alfresco.org/alfresco/webscriptimported"
|
||||
targetNamespace="http://www.alfresco.org/alfresco/webscriptimportexample"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<!-- Imports -->
|
||||
<xs:import namespace="http://www.alfresco.org/alfresco/webscriptimported" schemaLocation="webscript://pmonks/webformimport.xsd?storeid=${storeid}" />
|
||||
|
||||
|
||||
<!-- Root Element -->
|
||||
<xs:element name="WebScriptImportExample" type="wsimp:WebScriptImportExampleType">
|
||||
<xs:unique name="UniqueKeyword">
|
||||
<xs:selector xpath="wsimp:Keyword" />
|
||||
<xs:field xpath="." />
|
||||
</xs:unique>
|
||||
</xs:element>
|
||||
|
||||
</xs:schema>
|
@@ -1,7 +0,0 @@
|
||||
<webscript>
|
||||
<shortname>Web Form Import Example</shortname>
|
||||
<description>Example for testing import of a Web Script from a Web Form</description>
|
||||
<url>/pmonks/webformimport?storeid={storeid}</url>
|
||||
<format default="xsd">any</format>
|
||||
<authentication>user</authentication> <!-- This should be "user", but currently web script imports don't pass through user credentials -->
|
||||
</webscript>
|
@@ -1,14 +0,0 @@
|
||||
// Parse arguments
|
||||
var storeid = args.storeid;
|
||||
|
||||
// Validate arguments
|
||||
if (storeid == undefined || storeid == "")
|
||||
{
|
||||
status.code = 400;
|
||||
status.message = "Mandatory query string parameter 'storeid' was not provided.";
|
||||
status.redirect = true;
|
||||
}
|
||||
|
||||
// Generate an id (in a truly terrible way, but it's just an example!)
|
||||
model.storeid = storeid;
|
||||
model.idValue = Math.floor(Math.random() * 1000);
|
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:alf="http://www.alfresco.org"
|
||||
xmlns:wsimp="http://www.alfresco.org/alfresco/webscriptimported"
|
||||
targetNamespace="http://www.alfresco.org/alfresco/webscriptimported"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<xs:simpleType name="NonEmptyNormalizedStringType">
|
||||
<xs:restriction base="xs:normalizedString">
|
||||
<xs:minLength value="1"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
<xs:complexType name="WebScriptImportExampleType">
|
||||
<xs:sequence>
|
||||
<xs:element name="Id" type="xs:nonNegativeInteger" nillable="false" minOccurs="1" maxOccurs="1" fixed="${idValue}" />
|
||||
<xs:element name="StoreId" type="wsimp:NonEmptyNormalizedStringType" nillable="false" minOccurs="1" maxOccurs="1" fixed="${storeid}" />
|
||||
<xs:element name="Title" type="wsimp:NonEmptyNormalizedStringType" nillable="false" minOccurs="1" maxOccurs="1" />
|
||||
<xs:element name="Summary" type="wsimp:NonEmptyNormalizedStringType" nillable="false" minOccurs="0" maxOccurs="1" />
|
||||
<xs:element name="Keyword" type="wsimp:NonEmptyNormalizedStringType" nillable="false" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xs:element name="Body" type="xs:string" nillable="false" minOccurs="1" maxOccurs="1" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
</xs:schema>
|
Binary file not shown.
@@ -1,84 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
<xsl:stylesheet version="1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:article="http://www.alfresco.org/alfresco/article"
|
||||
xmlns:java="http://xml.apache.org/xslt/java"
|
||||
xmlns:fn="http://www.w3.org/2005/02/xpath-functions" exclude-result-prefixes="xhtml">
|
||||
<xsl:output method="html" encoding="UTF-8" indent="yes"
|
||||
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
|
||||
|
||||
<xsl:preserve-space elements="*"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:text disable-output-escaping="yes"><%String channel = (String) request.getParameter("channel");%></xsl:text>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>
|
||||
<xsl:value-of select="/article:article/article:title" disable-output-escaping="yes"/>
|
||||
</title>
|
||||
<meta name="description" lang="en">
|
||||
<xsl:attribute name="content">
|
||||
<xsl:value-of select="/article:article/article:title" disable-output-escaping="yes"/>
|
||||
</xsl:attribute>
|
||||
</meta>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<b>
|
||||
<xsl:element name="a">
|
||||
<xsl:attribute name="href">/views/pages/details.jsp?channel=<%=channel%>&content=/content/article/<xsl:value-of select="fn:replaceAll(string($alf:form_instance_data_file_name), '.xml', '.html')"/>&title=<xsl:value-of select="java:java.net.URLEncoder.encode(/article:article/article:title,'UTF-8')" disable-output-escaping="yes"/></xsl:attribute>
|
||||
<xsl:value-of select="/article:article/article:title" disable-output-escaping="yes"/>
|
||||
</xsl:element>
|
||||
</b>
|
||||
<br/>
|
||||
<i>
|
||||
<xsl:value-of select="/article:article/article:author" disable-output-escaping="yes"/>,<xsl:value-of select="/article:article/article:launch_date"/>
|
||||
</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<xsl:if test="/article:article/article:photo[article:page_number='0']">
|
||||
<xsl:element name="img">
|
||||
<xsl:attribute name="src">
|
||||
<xsl:value-of select="/article:article/article:photo[article:page_number='0']/article:image"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="align">
|
||||
<xsl:text>left</xsl:text>
|
||||
</xsl:attribute>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="normalize-space(/article:article/article:teaser)" disable-output-escaping="yes"/>
|
||||
</p>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
@@ -1,45 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
<xsl:stylesheet version="1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:article="http://www.alfresco.org/alfresco/article"
|
||||
xmlns:java="http://xml.apache.org/xslt/java"
|
||||
xmlns:fn="http://www.w3.org/2005/02/xpath-functions" exclude-result-prefixes="xhtml">
|
||||
<xsl:output method="html" encoding="UTF-8" indent="yes"
|
||||
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
|
||||
|
||||
<xsl:preserve-space elements="*"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:text disable-output-escaping="yes"><%String channel = (String) request.getParameter("channel");%></xsl:text>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<xsl:element name="a">
|
||||
<xsl:attribute name="href">/views/pages/details.jsp?channel=<%=channel%>&content=/content/article/<xsl:value-of select="fn:replaceAll(string($alf:form_instance_data_file_name), '.xml', '.html')"/>&title=<xsl:value-of select="java:java.net.URLEncoder.encode(/article:article/article:title,'UTF-8')" disable-output-escaping="yes"/></xsl:attribute>
|
||||
<xsl:value-of select="/article:article/article:title" disable-output-escaping="yes"/>
|
||||
</xsl:element>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
@@ -1,37 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xsl:stylesheet version="1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:article="http://www.alfresco.org/alfresco/article"
|
||||
xmlns:java="http://xml.apache.org/xslt/java"
|
||||
xmlns:fn="http://www.w3.org/2005/02/xpath-functions" exclude-result-prefixes="xhtml fn java article xsl">
|
||||
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
|
||||
|
||||
<xsl:preserve-space elements="*"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<item>
|
||||
<title><xsl:value-of select="/article:article/article:title" disable-output-escaping="yes"/></title>
|
||||
<link>/views/pages/details.jsp?content=/content/article/<xsl:value-of select="fn:replaceAll(string($alf:form_instance_data_file_name), '.xml', '.html')"/>&title=<xsl:value-of select="java:java.net.URLEncoder.encode(/article:article/article:title,'UTF-8')" disable-output-escaping="yes"/></link>
|
||||
<description><xsl:value-of select="normalize-space(/article:article/article:teaser)"/></description>
|
||||
<pubDate>2000-01-01T12:00:00.000-00:00</pubDate>
|
||||
</item>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
@@ -1,49 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:article="http://www.alfresco.org/alfresco/article"
|
||||
targetNamespace="http://www.alfresco.org/alfresco/article"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<!-- defines the form for creating a press release -->
|
||||
<xs:element name="article">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="title" type="xs:normalizedString" />
|
||||
<xs:element name="author" type="xs:normalizedString" />
|
||||
<xs:element name="location" type="xs:normalizedString"/>
|
||||
<xs:element name="teaser" type="xs:string"/>
|
||||
<xs:element name="keywords" type="xs:normalizedString" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xs:element name="body" type="xs:string" minOccurs="1" maxOccurs="unbounded" />
|
||||
<xs:element name="photo" minOccurs="0"
|
||||
maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="image" type="xs:anyURI" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="caption" type="xs:normalizedString" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="page_number" type="xs:integer" minOccurs="0" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="launch_date" type="xs:date"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user