Adding the comment form in photo.tpl

digitrebel
digitrebel's picture

Joined: 2005-09-02
Posts: 12
Posted: Thu, 2006-01-12 20:27

I want the user can post comment directly from the photo.tpl (not by clicking a link before).

How to add the comment form in photo.tpl ?

 
oojacoboo
oojacoboo's picture

Joined: 2005-05-07
Posts: 16
Posted: Thu, 2006-01-12 21:52

wow, I came here to post the same thing! I was also looking to spruce up the commenting display a little with some user information appearing the way it does in a forum, like this one. Maybe an avatar and some other information. I know this would be an addition as it would have to be added to the profile but it wouldn't be too difficult.

However, any ideas on the topic at hand, and possibly just changing the layout of the comment list a little so the name is on the left and the comment to the right of it and maybe the name is linked to the users gallery...

 
oojacoboo
oojacoboo's picture

Joined: 2005-05-07
Posts: 16
Posted: Sat, 2006-01-14 23:20

anyone?

 
oojacoboo
oojacoboo's picture

Joined: 2005-05-07
Posts: 16
Posted: Sun, 2006-01-22 01:44

hello, please!!

 
zedlander
zedlander's picture

Joined: 2005-11-27
Posts: 28
Posted: Mon, 2006-01-30 09:02

You can find the code for the Add Comment form in /modules/comment/templates/AddComment.tpl

Try adding this code from it into your photo.tpl:

Quote:
<div class="gbBlock gcBackground1">
<h2> {g->text text="Add Comment"} </h2>
</div>

<form action="{g->url}" method="post" enctype="application/x-www-form-urlencoded"
id="addCommentForm">
<div>
{g->hiddenFormVars}
<input type="hidden" name="{g->formVar var="controller"}" value="comment.AddComment"/>
<input type="hidden" name="{g->formVar var="form[formName]"}" value="{$form.formName}"/>
<input type="hidden" name="{g->formVar var="itemId"}" value="{$AddComment.itemId}"/>
</div>

<div class="gbBlock">
<h4> {g->text text="Posted by"} </h4>
{g->text text="%s (%s)" arg1=$user.fullName arg2=$AddComment.host}

<h4>
{g->text text="Subject"}
<span class="giSubtitle"> {g->text text="(required)"} </span>
</h4>

{include file="gallery:modules/core/templates/MarkupBar.tpl" viewL10domain="modules_core"
element="subject" firstMarkupBar=true}

<input type="text" id="subject" size="60" class="gcBackground1"
name="{g->formVar var="form[subject]"}" value="{$form.subject}"
onfocus="this.className=''" onblur="this.className='gcBackground1'"/>
<script type="text/javascript">
document.getElementById('addCommentForm')['{g->formVar var="form[subject]"}'].focus();
</script>

{if isset($form.error.subject.missing)}
<div class="giError">
{g->text text="You must enter a subject!"}
</div>
{/if}

<h4>
{g->text text="Comment"}
<span class="giSubtitle"> {g->text text="(required)"} </span>
</h4>

{include file="gallery:modules/core/templates/MarkupBar.tpl" viewL10domain="modules_core"
element="comment"}

<textarea rows="15" cols="60" id="comment" class="gcBackground1"
name="{g->formVar var="form[comment]"}"
onfocus="this.className=''" onblur="this.className='gcBackground1'">{$form.comment}</textarea>

{if isset($form.error.comment.missing)}
<div class="giError">
{g->text text="You must enter a comment!"}
</div>
{/if}
</div>

{* Include validation plugins *}
{foreach from=$AddComment.plugins item=plugin}
{include file="gallery:`$plugin.file`" l10Domain=$plugin.l10Domain}
{/foreach}

<div class="gbBlock gcBackground1">
<input type="submit" class="inputTypeSubmit"
name="{g->formVar var="form[action][preview]"}" value="{g->text text="Preview"}"/>
<input type="submit" class="inputTypeSubmit"
name="{g->formVar var="form[action][add]"}" value="{g->text text="Save"}"/>
<input type="submit" class="inputTypeSubmit"
name="{g->formVar var="form[action][cancel]"}" value="{g->text text="Cancel"}"/>
</div>
</form>

I don't know if all the variables will work, but give it a shot and let me know what happens.

 
digitrebel
digitrebel's picture

Joined: 2005-09-02
Posts: 12
Posted: Fri, 2006-02-03 16:48

Thank Zedlander

But I have a warning when the photo (photo.tpl) is displayed:
Warning: sprintf(): Too few arguments in /homepages/26/d141288324/htdocs/gallery2/modules/core/classes/GalleryTranslator.class on line 502
'Posted by' is empty

and an error when I validate the comment:
Error (ERROR_PERMISSION_DENIED) : user id: 6 doesn't have permission: comment.add for item id:

 
dshah

Joined: 2005-11-04
Posts: 23
Posted: Mon, 2006-05-08 23:16

same here! Would anyone who knows it better comment?

digitrebel wrote:
Thank Zedlander

But I have a warning when the photo (photo.tpl) is displayed:
Warning: sprintf(): Too few arguments in /homepages/26/d141288324/htdocs/gallery2/modules/core/classes/GalleryTranslator.class on line 502
'Posted by' is empty

and an error when I validate the comment:
Error (ERROR_PERMISSION_DENIED) : user id: 6 doesn't have permission: comment.add for item id:

 
Iced Coffee

Joined: 2005-11-17
Posts: 75
Posted: Tue, 2006-05-09 14:45

I guess this should be because you set not-allow permission to some user group, and it is non-consistence to have the comment box displayed to them. Can you try by setting allow permission to everyone to see if it wworks?

Iced Coffee
http://www.myweddinglife.info/lamha
http://www.novemberbabies.com/gallery

 
eiNfach-heNNiNg

Joined: 2006-04-23
Posts: 30
Posted: Tue, 2006-05-09 19:25

I think that some Data is given in the link to the site where you can add comments. If there isn't a link to klick on, the site hasn't got these info and it needs this info/data.

 
andreste

Joined: 2006-06-02
Posts: 123
Posted: Sun, 2007-01-07 16:41

Has anyone solved this? I'd be interested in doing this thing, but I can't make it to work (I'm no expert at all, I just experiment and try to work things out).
If anyone knows how to do it.............