Adding an iframe or opening an URL after clicking a button (or link)

239 views
Skip to first unread message

Ismael Martinez

unread,
May 9, 2016, 11:06:34 AM5/9/16
to manydesigns-portofino
Hi,

Is it possible to add an iframe (or open in a dialog) when clicking ina button or similar with portofino? 

That can be also a URL into a button or similar. I tried using the com.manydesigns.elements.fields.TextField.setHref() but I can only get a relative path

Is there a way to get a full path?

Thanks!

 

Giampiero Granatella

unread,
May 10, 2016, 2:29:40 AM5/10/16
to manydesign...@googlegroups.com
Hi Ismael,
I think that if you want to personalize the frontend the simplest thing is to redirect to a custom jsp.
You can override one of these methods :
@Override
    protected Resolution getReadView() {
        return forwardTo("/path_to/your.jsp");
    }

    @Override
    protected Resolution getEditView() {
         return forwardTo("/path_to/your.jsp");
    }

    @Override
    protected Resolution getCreateView() {
         return forwardTo("/path_to/your.jsp");
    }

Look in portofino crud jar for the original pages (e.g. create.jsp follows) and customize your view

<%@ page contentType="text/html;charset=UTF-8" language="java"
         pageEncoding="UTF-8"
%><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"
%><%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"
%><%@ taglib prefix="stripes" uri="http://stripes.sourceforge.net/stripes-dynattr.tld"
%><%@taglib prefix="mde" uri="/manydesigns-elements"
%><%@ taglib tagdir="/WEB-INF/tags" prefix="portofino"
%><jsp:useBean id="actionBean" scope="request" type="com.manydesigns.portofino.pageactions.crud.AbstractCrudAction"
/><stripes:layout-render name="/theme/templates/${actionBean.pageInstance.layout.template}/modal.jsp">
    <stripes:layout-component name="pageTitle">
        <c:out value="${actionBean.createTitle}"/>
    </stripes:layout-component>
    <stripes:layout-component name="pageBody">
        <c:if test="${actionBean.formWithRichTextFields}">
            <script type="text/javascript" src="<stripes:url value="/theme/ckeditor/ckeditor.js"/>"></script>
            <script type="text/javascript" src="<stripes:url value="/theme/ckeditor/adapters/jquery.js"/>"></script>
            <script type="text/javascript">
                $(function() {
                    portofino.setupRichTextEditors({
                        toolbarCanCollapse: true,
                        height: null
                    });
                });
            </script>
        </c:if>
        <c:if test="${actionBean.requiredFieldsPresent}">
            <p><fmt:message key="fields.marked.with.a.star.are.required"/>.</p>
        </c:if>
        <stripes:form action="${actionBean.context.actionPath}" method="post"
                      id="${(not empty actionBean.crudConfiguration.name) ? actionBean.crudConfiguration.name : null}"
                      enctype="multipart/form-data" class="form-horizontal create">
            <mde:write name="actionBean" property="form"/>
            <input type="hidden" name="returnUrl" value="<c:out value="${actionBean.returnUrl}"/>"/>
            <div class="form-group">
                <div class="col-md-offset-2 col-md-10">
                    <portofino:buttons list="crud-create" />
                </div>
            </div>

...

PUT HERE YOUR CUSTOMIZATIONS INSIDE THE CREATE FORM
...

        </stripes:form>

...

PUT HERE YOUR CUSTOMIZATIONS
...



    </stripes:layout-component>
</stripes:layout-render>


I hope this helps.

Bye
Giampiero

--
You received this message because you are subscribed to the Google Groups "manydesigns-portofino" group.
To unsubscribe from this group and stop receiving emails from it, send an email to manydesigns-port...@googlegroups.com.
To post to this group, send email to manydesign...@googlegroups.com.
Visit this group at https://groups.google.com/group/manydesigns-portofino.
For more options, visit https://groups.google.com/d/optout.

Giampiero Granatella

unread,
May 10, 2016, 2:31:21 AM5/10/16
to manydesign...@googlegroups.com
The above solution is the one I adopt for example to make angularjs pages (more complex than a simple create/update page) in my crud.

Ciao

Ismael Martinez

unread,
May 10, 2016, 6:38:04 AM5/10/16
to manydesigns-portofino
Gracie Mille Giampiero! Easy and perfect for what I need. Ciao

To unsubscribe from this group and stop receiving emails from it, send an email to manydesigns-portofino+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages