<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
        "http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>

    <!-- Weblogger default package -->
    <package name="weblogger" namespace="/roller-ui" extends="struts-default">

        <!-- Define Tiles result type -->
        <result-types>
            <result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
        </result-types>
        
        <!-- define our own interceptors and a custom interceptor stack -->
        <interceptors>
            <interceptor name="UIActionInterceptor" 
                         class="org.apache.roller.weblogger.ui.struts2.util.UIActionInterceptor" />
            <interceptor name="UISecurityInterceptor" 
                         class="org.apache.roller.weblogger.ui.struts2.util.UISecurityInterceptor" />
            <interceptor name="UIActionPrepareInterceptor" 
                         class="org.apache.roller.weblogger.ui.struts2.util.UIActionPrepareInterceptor" />
                         
            <!-- Define a custom interceptor stack for Roller so that we can 
                 add in our own custom interceptors.  We basically copy the 
                 default stack from struts2 rather than extend it because we
                 need to have our custom interceptors go in the middle of the
                 default stack -->
            <interceptor-stack name="rollerStack">
                <interceptor-ref name="exception"/>
                <!-- <interceptor-ref name="alias"/> -->
                <interceptor-ref name="servletConfig"/>
                <!-- <interceptor-ref name="prepare"/> -->
                <interceptor-ref name="i18n"/>
                <interceptor-ref name="chain"/>
                <!-- <interceptor-ref name="debugging"/> -->
                <!-- <interceptor-ref name="profiling"/> -->
                <!-- <interceptor-ref name="scopedModelDriven"/> -->
                <!-- <interceptor-ref name="modelDriven"/> -->
                <interceptor-ref name="fileUpload"/>
                <interceptor-ref name="checkbox"/>
                <interceptor-ref name="multiselect"/>
                <interceptor-ref name="staticParams"/>
                <interceptor-ref name="actionMappingParams"/>
                <interceptor-ref name="params">
                    <param name="excludeParams">^action:.*,^method:.*</param>
                </interceptor-ref>
                <interceptor-ref name="conversionError"/>
                
                <!-- custom Roller interceptors -->
                <interceptor-ref name="UIActionInterceptor">
                    <param name="excludeMethods">cancel</param>
                </interceptor-ref>
                <interceptor-ref name="UISecurityInterceptor">
                    <param name="excludeMethods">cancel</param>
                </interceptor-ref>
                <interceptor-ref name="UIActionPrepareInterceptor">
                    <param name="excludeMethods">cancel</param>
                </interceptor-ref>
                
                <!-- validation interceptors, MUST come after our custom interceptors -->
                <interceptor-ref name="validation">
                    <param name="excludeMethods">input,back,cancel,browse</param>
                </interceptor-ref>
                <interceptor-ref name="workflow">
                    <param name="excludeMethods">input,back,cancel,browse</param>
                </interceptor-ref>
                
            </interceptor-stack>
        </interceptors>
        
        <!-- use our own interceptor stack which extends the default stack -->
        <default-interceptor-ref name="rollerStack"/>
        
        <!-- results made available to all actions -->
        <global-results>
            <result name="access-denied" type="tiles">.denied</result>
        </global-results>

        <global-allowed-methods>
            accept,
            activate,
            decline,
            execute
        </global-allowed-methods>

        <!-- Simple actions which basically just replace the global-forwards from
             the old struts 1 config.  this is the only way to do it in struts 2 -->
        <action name="home">
            <result type="redirect">/</result>
        </action>
        
        <action name="login-redirect">
            <result>/roller-ui/login-redirect.jsp</result>
        </action>
        
        <action name="logout">
            <result>/roller-ui/logout-redirect.jsp</result>
        </action>
        
        <action name="setup"
                class="org.apache.roller.weblogger.ui.struts2.core.Setup">
            <result name="success" type="tiles">.Setup</result>
            <result name="home" type="redirectAction">home</result>
        </action>
                        
        <action name="login"
                class="org.apache.roller.weblogger.ui.struts2.core.Login">
            <result type="tiles">.Login</result>
        </action>
        
        <action name="register"
                class="org.apache.roller.weblogger.ui.struts2.core.Register">
            <result name="input" type="tiles">.Register</result>
            <result name="disabled" type="tiles">.GenericError</result>
            <result name="success" type="tiles">.Welcome</result>
        </action>
        
        <action name="profile"
                class="org.apache.roller.weblogger.ui.struts2.core.Profile">
            <result name="input" type="tiles">.Profile</result>
            <result name="cancel" type="redirectAction">menu</result>
            <result name="success" type="tiles">.Profile</result>
        </action>

        <action name="oauthKeys"
                class="org.apache.roller.weblogger.ui.struts2.core.OAuthKeys">
            <result name="success" type="tiles">.OAuthKeys</result>
        </action>

        <action name="oauthAuthorize"
                class="org.apache.roller.weblogger.ui.struts2.core.OAuthAuthorize">
            <result name="success" type="tiles">.OAuthAuthorize</result>
        </action>

        <action name="createWeblog"
                class="org.apache.roller.weblogger.ui.struts2.core.CreateWeblog">
            <result name="input" type="tiles">.CreateWeblog</result>
            <result name="disabled" type="tiles">.GenericError</result>
            <result name="success" type="chain">menu</result>
        </action>
        
        <action name="menu"
                class="org.apache.roller.weblogger.ui.struts2.core.MainMenu">
            <result type="tiles">.MainMenu</result>
        </action>

    </package>
    
    
    <!-- Weblogger install/bootstrap actions -->
    <package name="weblogger-install" namespace="/roller-ui/install" extends="weblogger" >

        <global-allowed-methods>
            execute,
            create,
            update,
            bootstrap
        </global-allowed-methods>

        <action name="install"
                class="org.apache.roller.weblogger.ui.struts2.core.Install">
            <result name="database_error" type="tiles">.DatabaseError</result>
            <result name="create_database" type="tiles">.CreateDatabase</result>
            <result name="upgrade_database" type="tiles">.UpgradeDatabase</result>
            <result name="bootstrap" type="tiles">.Bootstrap</result>
            <result name="success" type="chain">
                <param name="actionName">home</param>
                <param name="namespace">/roller-ui</param>
            </result>
        </action>
            
    </package>
    
    
    <!-- Weblogger Admin UI (includes planet) -->
    <package name="weblogger-admin" namespace="/roller-ui/admin" extends="weblogger" >

        <global-allowed-methods>
            clear,
            disable,
            delete,
            deleteConfirm,
            enable,
            execute,
            firstSave,
            save,
            query,
            delete,
            update
        </global-allowed-methods>
        
        <action name="globalConfig"
                class="org.apache.roller.weblogger.ui.struts2.admin.GlobalConfig">
            <result name="success" type="tiles">.GlobalConfig</result>
        </action>
               
        <action name="userAdmin"
                class="org.apache.roller.weblogger.ui.struts2.admin.UserAdmin">
            <result name="success" type="tiles">.UserAdmin</result>
            <result name="error" type="tiles">.UserAdmin</result>
            <result name="input" type="tiles">.UserAdmin</result>
        </action>
        
        <action name="createUser"
                class="org.apache.roller.weblogger.ui.struts2.admin.UserEdit">
            <param name="actionName">createUser</param>
            <param name="pageTitle">userAdmin.title.createNewUser</param>
            <result name="input" type="tiles">.UserEdit</result>
            <result name="success" type="redirectAction">
                <param name="actionName">modifyUser!firstSave</param>
                <param name="bean.id">${bean.id}</param>
            </result>
        </action>

        <action name="modifyUser"
                class="org.apache.roller.weblogger.ui.struts2.admin.UserEdit">
            <param name="actionName">modifyUser</param>
            <param name="pageTitle">userAdmin.title.editUser</param>
            <result name="input" type="tiles">.UserEdit</result>
            <result name="error" type="chain">userAdmin</result>
            <result name="cancel" type="redirectAction">
                <param name="actionName">userAdmin</param>
            </result>
        </action>
        
        <action name="globalCommentManagement"
                class="org.apache.roller.weblogger.ui.struts2.admin.GlobalCommentManagement">
            <result name="list" type="tiles">.GlobalCommentManagement</result>
        </action>
        
        <action name="commonPingTargets"
                class="org.apache.roller.weblogger.ui.struts2.admin.PingTargets">
            <result name="list" type="tiles">.PingTargets</result>
            <result name="confirm" type="tiles">.PingTargetConfirm</result>
        </action>
        
        <action name="commonPingTargetAdd"
                class="org.apache.roller.weblogger.ui.struts2.admin.PingTargetEdit">
            <param name="actionName">commonPingTargetAdd</param>
            <param name="pageTitle">pingTarget.addTarget</param>
            <result name="input" type="tiles">.PingTargetEdit</result>
            <result name="success" type="chain">commonPingTargets</result>
        </action>
        
        <action name="commonPingTargetEdit"
                class="org.apache.roller.weblogger.ui.struts2.admin.PingTargetEdit">
            <param name="actionName">commonPingTargetEdit</param>
            <param name="pageTitle">pingTarget.editTarget</param>
            <result name="input" type="tiles">.PingTargetEdit</result>
            <result name="success" type="chain">commonPingTargets</result>
            <result name="error" type="chain">commonPingTargets</result>
        </action>
        
        <action name="cacheInfo"
                class="org.apache.roller.weblogger.ui.struts2.admin.CacheInfo">
            <result name="success" type="tiles">.CacheInfo</result>
        </action>
        
        
        <action name="planetConfig"
                class="org.apache.roller.weblogger.planet.ui.PlanetConfig">
            <result name="input" type="tiles">.PlanetConfig</result>
        </action>
        
        <action name="planetSubscriptions"
                class="org.apache.roller.weblogger.planet.ui.PlanetSubscriptions">
            <result name="list" type="tiles">.PlanetSubscriptions</result>
        </action>
        
        <action name="planetGroups"
                class="org.apache.roller.weblogger.planet.ui.PlanetGroups">
            <result name="list" type="tiles">.PlanetGroups</result>
        </action>
    </package>
    
    
    <!-- Weblogger Authoring UI -->
    <package name="weblogger-authoring" namespace="/roller-ui/authoring" extends="weblogger" >

        <global-allowed-methods>
            add,
            cancel,
            createNewDirectory,
            execute,
            delete,
            deleteConfirm,
            deleteFolder,
            deleteSelected,
            disable,
            enable,
            entryAdd,
            entryEdit,
            firstSave,
            folderCreated,
            flushCache,
            includeInGallery,
            moveSelected,
            pingNow,
            publish,
            query,
            remove,
            revert,
            reset,
            save,
            saveDraft,
            search,
            update,
            view
        </global-allowed-methods>

        <action name="mediaFileAdd"
                class="org.apache.roller.weblogger.ui.struts2.editor.MediaFileAdd">
            <result name="input" type="tiles">.MediaFileAdd</result>
            <result name="success" type="tiles">.MediaFileAddSuccess</result>
            <result name="error" type="tiles">.MediaFileAdd</result>
            <result name="cancel" type="redirectAction">
                <param name="actionName">mediaFileView</param>
                <param name="weblog">${weblog}</param>
            </result>
        </action>

        <action name="mediaFileEdit"
                class="org.apache.roller.weblogger.ui.struts2.editor.MediaFileEdit">
            <result name="input" type="tiles">.MediaFileEdit</result>
            <result name="success" type="tiles">.MediaFileEditSuccess</result>
        </action>

        <action name="mediaFileAddExternalInclude"
                class="org.apache.roller.weblogger.ui.struts2.editor.MediaFileEdit">
            <result name="input" type="tiles">.MediaFileAddExternalInclude</result>
            <result name="success" type="tiles">.MediaFileAddExternalInclude</result>
            <result name="error" type="tiles">.MediaFileAddExternalInclude</result>
        </action>

	    <action name="mediaFileView"
                class="org.apache.roller.weblogger.ui.struts2.editor.MediaFileView">
            <result name="success" type="tiles">.MediaFileView</result>
            <result name="success.json" type="dispatcher">/WEB-INF/jsps/editor/MediaFileViewLight.jsp</result>
        </action>

	    <action name="mediaFileImageDim"
                class="org.apache.roller.weblogger.ui.struts2.editor.MediaFileImageDim">
            <result name="success" type="tiles">.MediaFileImageDimension</result>
        </action>

        <action name="entryAddWithMediaFile"
                class="org.apache.roller.weblogger.ui.struts2.editor.EntryAddWithMediaFile">
            <result name="success" type="chain">entryAdd</result>
        </action>

        <action name="entryAdd"
                class="org.apache.roller.weblogger.ui.struts2.editor.EntryEdit">
            <param name="actionName">entryAdd</param>
            <param name="pageTitle">weblogEdit.title.newEntry</param>
            <result name="input" type="tiles">.EntryEdit</result>
            <result name="success" type="redirectAction">
                <param name="actionName">entryEdit!firstSave</param>
                <param name="weblog">${weblog}</param>
                <param name="bean.id">${bean.id}</param>
            </result>
        </action>

        <action name="entryEdit"
                class="org.apache.roller.weblogger.ui.struts2.editor.EntryEdit">
            <param name="actionName">entryEdit</param>
            <param name="pageTitle">weblogEdit.title.editEntry</param>
            <result name="input" type="tiles">.EntryEdit</result>
            <result name="error" type="chain">
                <param name="actionName">menu</param>
                <param name="namespace">/roller-ui</param>
            </result>
        </action>
        
        <action name="entryRemove"
                class="org.apache.roller.weblogger.ui.struts2.editor.EntryRemove">
            <param name="actionName">entryRemove</param>
            <result name="input" type="tiles">.EntryRemove</result>
            <result name="error" type="chain">
                <param name="actionName">menu</param>
                <param name="namespace">/roller-ui</param>
            </result>
            <result name="success" type="chain">entryAdd</result>
        </action>

        <!-- Below activated by Entries.jsp and EntryRemove.jsp, kept separate from
        entryRemove above as return pages are different, both in the confirm delete
        and cancel delete scenarios.

        Note the different actionName parameters.  The actionName is used to determine
        which menu item to highlight as configured in editor-menu.xml (and MenuHelper).
        It's also used in EntryRemove.jsp to code the confirm delete and cancel buttons
        to return to the appropriate pages based on the actionName.  See Struts2
        StaticParametersInterceptor javadoc for more info on static parameters.
        -->
        <action name="entryRemoveViaList"
              class="org.apache.roller.weblogger.ui.struts2.editor.EntryRemove">
          <param name="actionName">entryRemoveViaList</param>
          <result name="input" type="tiles">.EntryRemove</result>
            <result name="error" type="chain">
                <param name="actionName">menu</param>
                <param name="namespace">/roller-ui</param>
            </result>
          <result name="success" type="chain">entries</result>
        </action>

        <action name="entries"
                class="org.apache.roller.weblogger.ui.struts2.editor.Entries">
            <result name="list" type="tiles">.Entries</result>
        </action>
        
        <action name="comments"
                class="org.apache.roller.weblogger.ui.struts2.editor.Comments">
            <result name="list" type="tiles">.Comments</result>
        </action>
        
        <action name="categories"
                class="org.apache.roller.weblogger.ui.struts2.editor.Categories">
            <result name="list" type="tiles">.Categories</result>
        </action>
        
        <action name="categoryAdd"
                class="org.apache.roller.weblogger.ui.struts2.editor.CategoryEdit">
            <param name="actionName">categoryAdd</param>
            <param name="pageTitle">categoryForm.add.title</param>
            <result name="input" type="tiles">.CategoryEdit</result>
            <result name="success" type="chain">categories</result>
            <result name="error" type="chain">categories</result>
        </action>
        
        <action name="categoryEdit"
                class="org.apache.roller.weblogger.ui.struts2.editor.CategoryEdit">
            <param name="actionName">categoryEdit</param>
            <param name="pageTitle">categoryForm.edit.title</param>
            <result name="input" type="tiles">.CategoryEdit</result>
            <result name="success" type="chain">categories</result>
            <result name="cancel" type="redirectAction">
                <param name="actionName">categories</param>
                <param name="weblog">${weblog}</param>
            </result>
        </action>

        <action name="categoryRemove"
                class="org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove">
            <result name="input" type="tiles">.CategoryRemove</result>
            <result name="cancel" type="redirectAction">
                <param name="actionName">categories</param>
                <param name="weblog">${weblog}</param>
            </result>
            <result name="success" type="chain">categories</result>
        </action>
        
        <action name="bookmarks"
                class="org.apache.roller.weblogger.ui.struts2.editor.Bookmarks">
            <result name="list" type="tiles">.Bookmarks</result>
        </action>

        <action name="bookmarkAdd"
                class="org.apache.roller.weblogger.ui.struts2.editor.BookmarkEdit">
            <param name="actionName">bookmarkAdd</param>
            <param name="pageTitle">bookmarkForm.add.title</param>
            <result name="input" type="tiles">.BookmarkEdit</result>
            <result name="success" type="chain">bookmarks</result>
            <result name="error" type="chain">bookmarks</result>
        </action>
        
        <action name="bookmarkEdit"
                class="org.apache.roller.weblogger.ui.struts2.editor.BookmarkEdit">
            <param name="actionName">bookmarkEdit</param>
            <param name="pageTitle">bookmarkForm.edit.title</param>
            <result name="input" type="tiles">.BookmarkEdit</result>
            <result name="success" type="chain">bookmarks</result>
            <result name="cancel" type="redirectAction">
                <param name="actionName">bookmarks</param>
                <param name="weblog">${weblog}</param>
                <param name="folderId">${folderId}</param>
            </result>
            <result name="error" type="chain">bookmarkEdit</result>
        </action>
        
        <action name="bookmarksImport"
                class="org.apache.roller.weblogger.ui.struts2.editor.BookmarksImport">
            <result name="input" type="tiles">.BookmarksImport</result>
            <result name="success" type="chain">bookmarks</result>
        </action>
        
        <action name="folderAdd"
                class="org.apache.roller.weblogger.ui.struts2.editor.FolderEdit">
            <param name="actionName">folderAdd</param>
            <param name="pageTitle">folderForm.add.title</param>
            <result name="input" type="tiles">.FolderEdit</result>
            <!-- redirect because switching to the newly created bookmarks folder -->
            <result name="success" type="redirectAction">
                <param name="actionName">bookmarks!folderCreated</param>
                <param name="weblog">${weblog}</param>
                <param name="folderId">${folderId}</param>
            </result>
            <result name="error" type="chain">bookmarks</result>
        </action>
        
        <action name="folderEdit"
                class="org.apache.roller.weblogger.ui.struts2.editor.FolderEdit">
            <param name="actionName">folderEdit</param>
            <param name="pageTitle">folderForm.edit.title</param>
            <result name="input" type="tiles">.FolderEdit</result>
            <result name="success" type="chain">bookmarks</result>
            <result name="cancel" type="redirectAction">
                <param name="actionName">bookmarks</param>
                <param name="weblog">${weblog}</param>
                <param name="folderId">${folderId}</param>
            </result>
            <result name="error" type="chain">bookmarks</result>
        </action>
        
        <action name="weblogConfig"
                class="org.apache.roller.weblogger.ui.struts2.editor.WeblogConfig">
            <result name="input" type="tiles">.WeblogConfig</result>
        </action>
        
        <action name="weblogRemove"
                class="org.apache.roller.weblogger.ui.struts2.editor.WeblogRemove">
            <result name="confirm" type="tiles">.WeblogRemoveConfirm</result>
            <result name="success" type="chain">
                <param name="actionName">menu</param>
                <param name="namespace">/roller-ui</param>
            </result>
        </action>
        
        <action name="themeEdit"
                class="org.apache.roller.weblogger.ui.struts2.editor.ThemeEdit">
            <result name="input" type="tiles">.ThemeEdit</result>
        </action>
        
        <action name="stylesheetEdit"
                class="org.apache.roller.weblogger.ui.struts2.editor.StylesheetEdit">
            <result name="input" type="tiles">.StylesheetEdit</result>
        </action>
        
        <action name="templates"
                class="org.apache.roller.weblogger.ui.struts2.editor.Templates">
            <result name="list" type="tiles">.Templates</result>
        </action>
        
        <action name="templateEdit"
                class="org.apache.roller.weblogger.ui.struts2.editor.TemplateEdit">
            <result name="list" type="chain">templates</result>
            <result name="input" type="tiles">.TemplateEdit</result>
        </action>
        
        <action name="templateRemove"
                class="org.apache.roller.weblogger.ui.struts2.editor.TemplateRemove">
            <result name="confirm" type="tiles">.TemplateRemove</result>
            <result name="cancel" type="redirectAction">
                <param name="actionName">templates</param>
                <param name="weblog">${weblog}</param>
            </result>
            <result name="success" type="chain">templates</result>
        </action>
        
        <action name="templatesRemove"
                class="org.apache.roller.weblogger.ui.struts2.editor.TemplatesRemove">
            <result name="input" type="tiles">.TemplatesRemove</result>
            <result name="confirm" type="tiles">.TemplatesRemove</result>
            <result name="success" type="chain">templates</result>
            <result name="cancel" type="redirectAction">
                <param name="actionName">templates</param>
                <param name="weblog">${weblog}</param>
            </result>
            <result name="error" type="chain">templates</result>
        </action>
        
        <action name="members"
                class="org.apache.roller.weblogger.ui.struts2.editor.Members">
            <result name="list" type="tiles">.Members</result>
        </action>
        
        <action name="invite"
                class="org.apache.roller.weblogger.ui.struts2.editor.MembersInvite">
            <result name="input" type="tiles">.MembersInvite</result>
            <!-- <result name="disabled" type="tiles">.disabled</result> -->
            <result name="success" type="chain">members</result>
            <result name="cancel" type="redirectAction">
                <param name="actionName">members</param>
                <param name="weblog">${weblog}</param>
            </result>
        </action>

        <action name="memberResign"
                class="org.apache.roller.weblogger.ui.struts2.editor.MemberResign">
            <result name="input" type="tiles">.MemberResign</result>
            <result name="error" type="chain">
                <param name="actionName">menu</param>
                <param name="namespace">/roller-ui</param>
            </result>
            <result name="success" type="chain">
                <param name="actionName">menu</param>
                <param name="namespace">/roller-ui</param>
            </result>
        </action>

        <action name="pings"
                class="org.apache.roller.weblogger.ui.struts2.editor.Pings">
            <result name="list" type="tiles">.Pings</result>
        </action>

        <action name="maintenance"
                class="org.apache.roller.weblogger.ui.struts2.editor.Maintenance">
            <result name="success" type="tiles">.Maintenance</result>
        </action>

    </package>

    <!-- Weblogger Authoring UI - overlay pages-->
    
    <package name="weblogger-authoring-overlay" namespace="/roller-ui/authoring/overlay" extends="weblogger-authoring" >

        <global-allowed-methods>
            execute,save
        </global-allowed-methods>

        <action name="mediaFileAdd"
                class="org.apache.roller.weblogger.ui.struts2.editor.MediaFileAdd">
            <param name="overlayMode">true</param>
            <result name="input" type="tiles">.MediaFileAddInclude</result>
            <result name="success" type="tiles">.MediaFileAddSuccessInclude</result>
            <result name="error" type="tiles">.MediaFileAddInclude</result>
        </action>

	    <action name="mediaFileImageChooser"
                class="org.apache.roller.weblogger.ui.struts2.editor.MediaFileImageChooser">
            <param name="overlayMode">true</param>
            <result name="input" type="tiles">.MediaFileImageChooser</result>
            <result name="error" type="tiles">.MediaFileImageChooser</result>
            <result name="success" type="tiles">.MediaFileImageChooser</result>
        </action>

    </package>

</struts>
