So, i found solution by my self is like this:

1) in InsertAsset.jx replace
             <input
                  i18n:attr="value"
                  type="submit"
                  value="insertAsset.insert${mode}"

onclick="org.apache.lenya.editors.handleFormSubmit('insertAsset');"
                />

with

               <jx:choose>
                    <jx:when
test="${usecase.getParameter('lenya.exitUsecase') != null}">
                        <input name="submit"
                          i18n:attr="value"
                          type="submit"
                          value="insertAsset.insert${mode}"
                        />
                    </jx:when>
                    <jx:otherwise>
                        <input
                          i18n:attr="value"
                          type="submit"
                          value="insertAsset.insert${mode}"

onclick="org.apache.lenya.editors.handleFormSubmit('insertAsset');"
                        />
                    </jx:otherwise>
                </jx:choose>

in order to go back to usecase passed in lenya.exitUsecase.

2) in InsertAsset.java overide methods:

public String getTargetURL(boolean success) {
        //System.out.println("this.getTargetURL");
        String url = getParameterAsString(EXIT_URI);
        if (url == null) {
            url = getParameterAsString(DEFAULT_TARGET_URL);
        }
        if (url == null) {
            url = getSourceURL();
        }
        return url + getExitQueryString();
    }

    protected void doCheckExecutionConditions(){
        System.out.println("doCheckExecutionConditions()");
    }
    protected void doExecute() throws Exception {
        System.out.println("doExecute()");
    }

    /**
     * Returns the query string to access the exit usecase of this usecase.
     * @return A query string of the form
     *
<code>?lenya.usecase=...&amp;param1=foo&amp;param2=bar</code>.
     */
    protected String getExitQueryString() {
        //System.out.println("InsertAsset getExitQueryString()
!!!!!!!!!!!!!!!!!!!");
        //System.out.println("InsertAsset this.getParameters() =
"+this.getParameters());
        StringBuffer queryBuffer = new StringBuffer();
        String exitUsecase = getParameterAsString("lenya.exitUsecase");
        if (exitUsecase != null && !"".equals(exitUsecase)) {
            queryBuffer.append("?lenya.usecase=").append(exitUsecase);
        }

        String url = getParameterAsString("url");
        if (url != null && !"".equals(url)) {
            queryBuffer.append("&url=").append(url);
        }

        String rowId = getParameterAsString("rowId");
        if (rowId != null && !"".equals(rowId)) {
            queryBuffer.append("&rowId=").append(rowId);
        }

        return queryBuffer.toString();
    }

parameters are appended to query in getExitQueryString().


That's it

GintarÄ—




On Mon, Jan 18, 2010 at 11:48 AM, Gintare Ragaisiene <
[email protected]> wrote:

> Hello,
>
>    I have usecase editors.insertImage that after image selection gets back
> to my implemented usecase ginactions.edit :
>
> <xconf xpath="/cocoon/usecases"
> unless="/cocoon/usecases/component-instan...@name = 'ginactions.edit']">
>   <component-instance name="ginactions.edit"
>                       logger="lenya.site.ginactions"
>
> class="com.ginsoftware.lenya.cms.ginactions.ActionsEdit">
>     <view
>        uri="modules/ginactions/usecases/dynamicrepeater_template.xml"
>        customFlow="fallback://lenya/modules/ginactions/flow/customFlow.js"
>     />
>     <event id="edit"/>
>   </component-instance>
> </xconf>
>
> where
>
> package com.ginsoftware.lenya.cms.ginactions;
> ...
> public class ActionsEdit extends InvokeWorkflow{
>  ...
> }
>
> In other words, I open my usecase ginactions.edit, click on link "Insert
> image" , go to usecase editors.insertImage, select image and go back to
> ginactions.edit with image request parameters from editors.insertImage POST
> form.
>
> How can I get those selected image parameters values with
> this.getParameterAsString("...") in ActionsEdit.java ?
>
> Thanks,
> GintarÄ—
>
>
>

Reply via email to