Re: custom (non wicket) modal dialog. Problem with urls.

2011-08-11 Thread brazz
Problem is solved now:

i extract the application-relative-path with:

String path = Strings.stripJSessionId(request.getRequestURI());

the trick is to overwrite method onComponentTag(ComponentTag tag) of class
ResourceLink and prepend  the application -relative path so i end up with
e.g.:

/mybaseurl/mypath/?wicket:interface=:85:border:_body:dialogContainer:contentPanels:infoTextContentPanel:externalLinks:0:externalLink::IResourceListener::
 

complete code:

public class CustomResourceLink extends ResourceLinkVoid {

private static final long serialVersionUID = -4848428865939435963L;

private boolean applicationRelative = false;

private PopupSettings popupSettings = null;

public CustomResourceLink (String id, Resource resource) {
super(id, resource);
}

@Override
protected void onComponentTag(ComponentTag tag)
{
super.onComponentTag(tag);

if (isLinkEnabled() == false)
{
disableLink(tag);
}
else
{
if (getURL() != null)
{
String url = getURL().toString();

if (applicationRelative)
{
if (url.length()  0  url.charAt(0) 
== '/')
{
url = url.substring(1);
}

url = RequestUtils.getBaseUrl(this) + 
url;
}

// if the tag is an anchor proper
if (tag.getName().equalsIgnoreCase(a) ||
tag.getName().equalsIgnoreCase(link) ||
tag.getName().equalsIgnoreCase(area))
{
// generate the href attribute
tag.put(href, Strings.replaceAll(url, 
, amp;));

// Add any popup script
if (popupSettings != null)
{
// NOTE: don't encode to HTML 
as that is not valid
// JavaScript
tag.put(onclick, 
popupSettings.getPopupJavaScript());
}
}
else
{
// generate a popup script by asking 
popup settings for one
if (popupSettings != null)
{
popupSettings.setTarget(' + 
url + ');
String popupScript = 
popupSettings.getPopupJavaScript();
tag.put(onclick, popupScript);
}
else
{
// or generate an onclick JS 
handler directly
tag.put(onclick, 
window.location.href=' + url + ';return
false;);
}
}
}

if (popupSettings != null)
{
IPageMap popupPageMap = 
popupSettings.getPageMap(this);
if (popupPageMap != null  
popupPageMap.getName() != null)
{
tag.put(target, 
popupPageMap.getName());
}
}
}
}

public void setApplicationRelative(boolean contextRelative) {
this.applicationRelative = contextRelative;
}
}

public class RequestUtils {
public static String getBaseUrl(Component comp) {
ServletWebRequest servletWebRequest = (ServletWebRequest) comp
.getRequest();
HttpServletRequest request = 
servletWebRequest.getHttpServletRequest();
String path = Strings.stripJSessionId(request.getRequestURI());
return path;
}
}

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/custom-non-wicket-modal-dialog-Problem-with-urls-tp3726196p3735554.html
Sent from the Users forum mailing list archive at Nabble.com

Re: custom (non wicket) modal dialog. Problem with urls.

2011-08-10 Thread brazz
One step further. My original assumption was wrong. It is a problem with
iframes and the configuration of our firewall. But the situation hasn't
improved.

The url of the link is:

?wicket:interface=:85:border:_body:dialogContainer:contentPanels:infoTextContentPanel:externalLinks:0:externalLink::IResourceListener::

Now i have to prepend my  servlet path e.g. /mybaseurl/mypath to the
relative url of the link, e.g.:

/mybaseurl/mypath/?wicket:interface=:85:border:_body:dialogContainer:contentPanels:infoTextContentPanel:externalLinks:0:externalLink::IResourceListener::

FurtherMore i need an Ajax-ResourceLink (which i think doesn't exist by
now). 

Any suggestions would be greatly appreciated!

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/custom-non-wicket-modal-dialog-Problem-with-urls-tp3726196p3733218.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: custom (non wicket) modal dialog. Problem with urls.

2011-08-09 Thread brazz
 (MalformedURLException e) {
log.error(e);
} catch (Exception e) {
log.error(e);
}
return null;
}
}

public boolean isResourceAvailable() {
URLTester urlTester = URLTester.newInstance();
try {
return 
urlTester.isReachable(urlTester.webProxyUrl(getUrl()));
} catch (MalformedURLException e) {
log.error(e);
return false;
} catch (Exception e) {
log.error(e);
return false;
}
}

public abstract String getUrl();

public abstract String getContentType();

}

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/custom-non-wicket-modal-dialog-Problem-with-urls-tp3726196p3729050.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



custom (non wicket) modal dialog. Problem with urls.

2011-08-08 Thread brazz
Hello everyone, 

in our project i have to use our own modal dialog (application is included
in a portal). I have to open the dialog with the help of a javascript
function which is wrapped in a Behaviour. What i am doing now:

- in the constructor of my response page i call the javascript function via
a behaviour, so that immediately after the responsepage is rendered, the
javascript function gets called and the modal dialog opens.
- the javascript funtion accepts a url of the page that will be included in
the dialog.

In order to get the url i'm doing the this:

URL for Page in Modal Dialog:
ServletWebRequest servletWebRequest = (ServletWebRequest) comp
.getRequest();
HttpServletRequest request = 
servletWebRequest.getHttpServletRequest();
String path = Strings.stripJSessionId(request.getRequestURI());
CharSequence urlFor = comp.urlFor(targetPageClass, params);
String contextRelativePath = path + urlFor;


Behaviour for opening the Modal Dialog:

public class OpenModalDialogBehaviour extends AbstractDefaultAjaxBehavior {

private static final long serialVersionUID = -127624955452459934L;

private String url;

public OpenModalDialogBehaviour(String url) {
this.url = url;
}

@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
ASPSession session = (ASPSession) ASPSession.get();
String js = {if( + session.isShowModalDialog() + 
){top.showForm('
+ url +  + ');}};
tag.append(onload, js ,  );
session.setShowModalDialog(false);
}

@Override
protected void respond(AjaxRequestTarget target) {
System.out.println(respond);
}
}

Now, my problem is, that the response page is the page in the background
(deactivated by the modal-dialog-javascript- function), not the page of the
modal dialog. Therefore the links in the page of my modal dialog are dead
(the onclick functions never get called). 

What i need is some trick to calculate and set the urls for my modal dialog
page manually, but i have no clue how to do this. Or maybe there is a much
simpler solution?

Thanks for any suggestions!

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/custom-non-wicket-modal-dialog-Problem-with-urls-tp3726196p3726196.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: custom (non wicket) modal dialog. Problem with urls.

2011-08-08 Thread Andrea Del Bene

Hi,

I'm not sure I have fully understood your situation. You should have:

1- a page which opens a modal dialog via Javascript
2- another page which is rendered inside modal dialog
3- in this last page (the one inside modal window) you want a link to 
the page in background (the starting page)


Is this right?

Couldn't you get the url of target page using the same code used for 
modal dialog page? i.e.:


comp.urlFor(TargetPageClass.class, params);



Hello everyone,

in our project i have to use our own modal dialog (application is included
in a portal). I have to open the dialog with the help of a javascript
function which is wrapped in a Behaviour. What i am doing now:

- in the constructor of my response page i call the javascript function via
a behaviour, so that immediately after the responsepage is rendered, the
javascript function gets called and the modal dialog opens.
- the javascript funtion accepts a url of the page that will be included in
the dialog.

In order to get the url i'm doing the this:

URL for Page in Modal Dialog:
ServletWebRequest servletWebRequest = (ServletWebRequest) comp
.getRequest();
HttpServletRequest request = 
servletWebRequest.getHttpServletRequest();
String path = Strings.stripJSessionId(request.getRequestURI());
CharSequence urlFor = comp.urlFor(targetPageClass, params);
String contextRelativePath = path + urlFor;


Behaviour for opening the Modal Dialog:

public class OpenModalDialogBehaviour extends AbstractDefaultAjaxBehavior {

private static final long serialVersionUID = -127624955452459934L;

private String url;

public OpenModalDialogBehaviour(String url) {
this.url = url;
}

@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
ASPSession session = (ASPSession) ASPSession.get();
String js = {if( + session.isShowModalDialog() + 
){top.showForm('
+ url +  + ');}};
tag.append(onload, js ,  );
session.setShowModalDialog(false);
}

@Override
protected void respond(AjaxRequestTarget target) {
System.out.println(respond);
}
}

Now, my problem is, that the response page is the page in the background
(deactivated by the modal-dialog-javascript- function), not the page of the
modal dialog. Therefore the links in the page of my modal dialog are dead
(the onclick functions never get called).

What i need is some trick to calculate and set the urls for my modal dialog
page manually, but i have no clue how to do this. Or maybe there is a much
simpler solution?

Thanks for any suggestions!

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/custom-non-wicket-modal-dialog-Problem-with-urls-tp3726196p3726196.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org