<?xml version="1.0"?>

<!DOCTYPE faces-config PUBLIC
  "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
  "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">

<!-- 
Copyright (c) 2006. Centre for e-Science. Lancaster University. United Kingdom. 

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<!-- =========== FACES CONFIGURATION FILE ================================== -->

<faces-config>

  	<application>
    	<message-bundle>uk.ac.lancs.e_science.sakai.tools.blogger.bundle.Messages</message-bundle>
    	<locale-config>
      	<default-locale>en</default-locale>
    	</locale-config>
  	</application>

	<managed-bean>
  		<managed-bean-name>postListViewerController</managed-bean-name>
    	<managed-bean-class>uk.ac.lancs.e_science.sakai.tools.blogger.PostListViewerController</managed-bean-class>
		<managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
	<managed-bean>
  		<managed-bean-name>postCreateController</managed-bean-name>
    	<managed-bean-class>uk.ac.lancs.e_science.sakai.tools.blogger.PostCreateController</managed-bean-class>
		<managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
	<managed-bean>
  		<managed-bean-name>postEditController</managed-bean-name>
    	<managed-bean-class>uk.ac.lancs.e_science.sakai.tools.blogger.PostEditController</managed-bean-class>
		<managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
	<managed-bean>
  		<managed-bean-name>postViewerController</managed-bean-name>
    	<managed-bean-class>uk.ac.lancs.e_science.sakai.tools.blogger.PostViewerController</managed-bean-class>
		<managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
	<managed-bean>
  		<managed-bean-name>previewPostController</managed-bean-name>
    	<managed-bean-class>uk.ac.lancs.e_science.sakai.tools.blogger.PreviewPostController</managed-bean-class>
		<managed-bean-scope>session</managed-bean-scope>
    </managed-bean>    
	<managed-bean>
  		<managed-bean-name>addCommentController</managed-bean-name>
    	<managed-bean-class>uk.ac.lancs.e_science.sakai.tools.blogger.AddCommentController</managed-bean-class>
		<managed-bean-scope>session</managed-bean-scope>
    </managed-bean>


	<managed-bean>
  		<managed-bean-name>query</managed-bean-name>
    	<managed-bean-class>uk.ac.lancs.e_science.sakaiproject.api.blogger.searcher.QueryBean</managed-bean-class>
		<managed-bean-scope>request</managed-bean-scope>
    </managed-bean>

    <converter>
        <description>A converter for post visibility codes</description>
        <converter-id>VisibilityCode</converter-id>
        <converter-class>uk.ac.lancs.e_science.sakai.tools.blogger.converters.VisibilityConverter</converter-class>
    </converter>
    <converter>
        <description>A converter for post visibility dates</description>
        <converter-id>DateConverter</converter-id>
        <converter-class>uk.ac.lancs.e_science.sakai.tools.blogger.converters.DateConverter</converter-class>
    </converter>
    <converter>
        <description>A converter to generate a summary with the post's body. It will be the first paragraph or 255 first characters</description>
        <converter-id>BodyToSummaryConverter</converter-id>
        <converter-class>uk.ac.lancs.e_science.sakai.tools.blogger.converters.BodyToSummaryConverter</converter-class>
    </converter>
    <converter>
        <description>A converter to the post's body in text.</description>
        <converter-id>BodyToTextConverter</converter-id>
        <converter-class>uk.ac.lancs.e_science.sakai.tools.blogger.converters.BodyToTextConverter</converter-class>
    </converter>

    <validator>
        <description>A validator for dates</description>
        <validator-id>DateValidator</validator-id>
        <validator-class>uk.ac.lancs.e_science.sakai.tools.blogger.validators.DateValidator</validator-class>
    </validator>

    <!-- navigation rules -->
     <navigation-rule>
        <navigation-case>
            <from-outcome>main</from-outcome>
            <to-view-id>/sakai-blogger-tool/main.jsp</to-view-id>
        </navigation-case>
    </navigation-rule>

    <navigation-rule>
        <from-view-id>*</from-view-id>
        <navigation-case>
            <from-outcome>newPost</from-outcome>
            <to-view-id>/sakai-blogger-tool/PostCreateView.jsp</to-view-id>
        </navigation-case>
    </navigation-rule>
    <navigation-rule>
        <from-view-id>*</from-view-id>
        <navigation-case>
            <from-outcome>refreshNewPost</from-outcome>
            <to-view-id>/sakai-blogger-tool/PostCreateView.jsp</to-view-id>
        </navigation-case>
    </navigation-rule>    

    <navigation-rule>
        <from-view-id>*</from-view-id>
        <navigation-case>
            <from-outcome>viewPost</from-outcome>
            <to-view-id>/sakai-blogger-tool/PostViewer.jsp</to-view-id>
        </navigation-case>
    </navigation-rule>

    <navigation-rule>
        <from-view-id>*</from-view-id>
        <navigation-case>
            <from-outcome>previewPost</from-outcome>
            <to-view-id>/sakai-blogger-tool/PreviewPost.jsp</to-view-id>
        </navigation-case>
    </navigation-rule>
    
    <navigation-rule>
        <from-view-id>*</from-view-id>
        <navigation-case>
            <from-outcome>viewPostList</from-outcome>
            <to-view-id>/sakai-blogger-tool/PostListViewer.jsp</to-view-id>
        </navigation-case>
    </navigation-rule>

    <navigation-rule>
        <from-view-id>*</from-view-id>
        <navigation-case>
            <from-outcome>editPost</from-outcome>
            <to-view-id>/sakai-blogger-tool/PostEditView.jsp</to-view-id>
        </navigation-case>
    </navigation-rule>
    
    <navigation-rule>
        <from-view-id>*</from-view-id>
        <navigation-case>
            <from-outcome>confirmDeletePost</from-outcome>
            <to-view-id>/sakai-blogger-tool/ConfirmDeletePost.jsp</to-view-id>
        </navigation-case>
    </navigation-rule>    

    <navigation-rule>
        <from-view-id>*</from-view-id>
        <navigation-case>
            <from-outcome>AddCommentView</from-outcome>
            <to-view-id>/sakai-blogger-tool/AddCommentView.jsp</to-view-id>
        </navigation-case>
    </navigation-rule>  
    
    
<!-- COMPONENTS -->

	<render-kit>
    	<renderer>
        	<component-family>javax.faces.Input</component-family>
        	<renderer-type>uk.ac.lancs.e_science.fileUpload.Upload</renderer-type>
			<renderer-class>uk.ac.lancs.e_science.fileUpload.UploadRenderer</renderer-class>
		</renderer>
	    <renderer>
	      <component-family>RichTextEditArea</component-family>
	      <renderer-type>RichTextEditArea</renderer-type>
	      <renderer-class>uk.ac.lancs.e_science.jsf.components.blogger.renderer.RichTextEditArea</renderer-class>
	    </renderer>
	</render-kit>   
   
	<component>
    	<component-type>uk.ac.lancs.e_science.fileUpload.Upload</component-type>
      	<component-class>javax.faces.component.UIInput</component-class>
	</component>
   
	<component>
   		<component-type>uk.ac.lancs.e_science.jsf.components.blogger.OutputPost</component-type>
   		<component-class>uk.ac.lancs.e_science.jsf.components.blogger.UIOutputPost</component-class>
	</component>
	
	<component>
   		<component-type>uk.ac.lancs.e_science.jsf.components.blogger.EditPost</component-type>
   		<component-class>uk.ac.lancs.e_science.jsf.components.blogger.UIEditPost</component-class>
	</component>		
	<component>
   		<component-type>uk.ac.lancs.e_science.jsf.components.blogger.PostListing</component-type>
   		<component-class>uk.ac.lancs.e_science.jsf.components.blogger.UIPostListing</component-class>
	</component>			     
	<component>
   		<component-type>RichTextEditArea</component-type>
   		<component-class>uk.ac.lancs.e_science.jsf.components.blogger.component.RichTextEditArea</component-class>
	</component>		
</faces-config>
