Here you go...
Edits are made to the following classes:
org.apache.roller.ui.rendering.model.URLModel.java
org.apache.roller.util.URLUtilities.java
org.apache.roller.ui.rendering.util.WeblogPageRequest.java
org.apache.roller.ui.rendering.util.WeblogPageCache.java
org.apache.roller.ui.rendering.util.SiteWideCache.java
org.apache.roller.ui.rendering.servlets.CommentServlet.java
and the following macros:
/WEB-INF/velocity/weblog.vm
/WEB-INF/velocity/templates/popupcomments.vm
------------------------------------------------<
org.apache.roller.ui.rendering.model.URLModel.java
public String commentPopup(String anchor, String timeStamp) {
return URLUtilities.getWeblogCommentPopupURL(weblog, locale, anchor,
timeStamp, true);
}
public String commentsPopup(String anchor) {
return URLUtilities.getWeblogCommentsPopupURL(weblog, locale,
anchor, true);
}
------------------------------------------------<
org.apache.roller.util.URLUtilities.java
/**
* Get url for a single weblog entry comments on a given weblog.
*/
public static final String getWeblogCommentsPopupURL(WebsiteData weblog,
String locale,
String entryAnchor,
boolean absolute) {
return getWeblogEntryURL(weblog, locale, entryAnchor,
absolute)+"?popup=true#comments";
}
/**
* Get url for a single weblog entry comment on a given weblog.
*/
public static final String getWeblogCommentPopupURL(WebsiteData weblog,
String locale,
String entryAnchor,
String timeStamp,
boolean absolute) {
return getWeblogEntryURL(weblog, locale, entryAnchor,
absolute)+"?popup=true#comment-"+timeStamp;
}
------------------------------------------------<
org.apache.roller.ui.rendering.util.WeblogPageRequest.java
private String weblogPopup = null;
public String getWeblogPopup() {
return weblogPopup;
}
public void setWeblogPopup(String weblopPopup) {
this.weblogPopup = weblopPopup;
}
public WeblogPageRequest(HttpServletRequest request)
throws InvalidRequestException {
...
} else if(pathElements.length == 2) {
this.context = pathElements[0];
if("entry".equals(this.context)) {
this.weblogAnchor = URLUtilities.decode(pathElements[1]);
if(request.getParameter("popup") != null) {
this.weblogPopup = request.getParameter("popup");
}
} else if("date".equals(this.context)) {
...
}
------------------------------------------------<
org.apache.roller.ui.rendering.util.WeblogPageCache.java
public String generateKey(WeblogPageRequest pageRequest) {
StringBuffer key = new StringBuffer();
key.append(this.CACHE_ID).append(":");
key.append(pageRequest.getWeblogHandle());
if(pageRequest.getWeblogAnchor() != null) {
String anchor = null;
try {
// may contain spaces or other bad chars
anchor =
URLEncoder.encode(pageRequest.getWeblogAnchor(), "UTF-8");
} catch(UnsupportedEncodingException ex) {
// ignored
}
key.append("/entry/").append(anchor);
if (pageRequest.getWeblogPopup() != null) {
key.append("/popup");
}
} else {
...
}
------------------------------------------------<
org.apache.roller.ui.rendering.util.SiteWideCache.java
public String generateKey(WeblogPageRequest pageRequest) {
StringBuffer key = new StringBuffer();
key.append(this.CACHE_ID).append(":");
key.append("page/");
key.append(pageRequest.getWeblogHandle());
if(pageRequest.getWeblogAnchor() != null) {
String anchor = null;
try {
// may contain spaces or other bad chars
anchor =
URLEncoder.encode(pageRequest.getWeblogAnchor(), "UTF-8");
} catch(UnsupportedEncodingException ex) {
// ignored
}
key.append("/entry/").append(anchor);
if (pageRequest.getWeblogPopup() != null) {
key.append("/popup");
}
} else {
...
}
------------------------------------------------<
org.apache.roller.ui.rendering.servlets.CommentServlet.java
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
...
// we know what the weblog entry is, so setup our urls
dispatch_url = "/roller-ui/rendering/page/"+weblog.getHandle();
if(commentRequest.getLocale() != null) {
dispatch_url += "/"+commentRequest.getLocale();
}
dispatch_url +=
"/entry/"+URLUtilities.encode(commentRequest.getWeblogAnchor());
if(request.getParameter("popup") != null) {
if(dispatch_url.indexOf("?") == -1)
dispatch_url += "?popup=true";
else
dispatch_url += "&popup=true";
}
...
}
------------------------------------------------<
/WEB-INF/velocity/weblog.vm
#macro(showWeblogEntryCommentForm $entry)
...
<form method="post" action="$url.entry($entry.anchor)" focus="name"
name="form" onsubmit="fixURL(this); return validateComments(this)">
<input type="hidden" name="method" value="post" />
#if($model.getRequestParameter("popup"))
<input type="hidden" name="popup" value="true" />
#end
...
#end
------------------------------------------------<
/WEB-INF/velocity/templates/popupcomments.vm
#set($entry = $model.weblogEntry)
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>$model.weblog.name :: $text.get("comments.title") ::
$utils.removeHTML($entry.title)
</title>
<script type="text/javascript"
src="$url.site/theme/scripts/roller.js"></script>
<link rel="stylesheet" type="text/css" media="all"
href="$url.site/themes/base.css" />
<style type="text/css">
body {
background-color: #FFFFFF;
background-image: none;
color: #000000;
font-family: verdana, sans-serif;
font-size: small;
}
h3 {
margin-left: auto;
margin-right: auto;
text-align: center;
}
#footer {
display: none;
}
th {
vertical-align: middle;
text-align: right;
padding-right: 5px;
font-size: 12px;
}
</style>
<!-- Edit your _css Page Template -->
<link rel="stylesheet" type="text/css"
href="$url.site/$model.weblog.handle/page/css" />
</head>
<body>
<div class="commentTitle">
$utils.removeHTML($entry.title)
</div>
<div class="comments">
#showWeblogEntryComments($entry)
#showWeblogEntryCommentForm($entry)
</div>
</body>
</html>
On 19/12/06, Dave <[EMAIL PROTECTED]> wrote:
On 12/19/06, Richard Jones <[EMAIL PROTECTED]> wrote:
> Thanks Dave,
>
> I've done all the edits & testing to get popup comments working in
> 3.x, but it's using the same method as in 2.x - e.g. with the
> 'popup=true' parameter. Let me know if you want me to post the edits
> so you can integrate in the 3.x branch.
Yes, please do. I'd like to see those changes.
Please post a patch here on the list.
- Dave
>
> Cheers,
>
> Richard
>
>
>
> On 19/12/06, Dave <[EMAIL PROTECTED]> wrote:
> > I don't believe we'd done any testing on popup comments since we
> > re-worked the rendering system in 3.0. So, I would assume that they no
> > longer work. Personally, I'd like to be able to support them. I'd like
> > to find a way to do so without special code in the CommentServlet, but
> > I'm not absolutely sure that is possible.
> >
> > - Dave
> >
> >
> >
> > On 12/16/06, Richard Jones <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > >
> > > I'm currently migrating this from 2.3 to 3.0 and have found that popup
> > > comments in Roller 3 no longer work. Some of the popup comments code
> > > has been migrated to the new page system, so I'm not sure whether
> > > popup comments has been deliberately phased-out for this release or
> > > whether it should be there, and this is a bug - anyone?
> > >
> > > Thanks,
> > >
> > > Richard
> > >
> >
> >
>