<?xml version='1.0' encoding='UTF-8'?><uidget><metadata><name>Comment</name><description>Add a comment thread</description><help><![CDATA[
      With the Comment Block, visitors can add messages to your Website. &lt;br&gt; You can manage sent comments (publish or unpublish them) and also delete or add your comments. Comments you add by using the &lt;i&gt;Manage comments&lt;/i&gt; button will be marked as posted by the website owner (highlighted). You may be notified by mail and the comments may need your validation before appearing on your site. This block may be resized automatically according to the number of messages it contains. In this case, you should not put any other block below it. You can also select the position of the post form, at the top or at the bottom. &lt;br&gt; To send a comment, visitors have to enter their names, email and website (optional) and a comment. &lt;br&gt;To prevent spams, visitors must write a secret code displayed in the image. Visitors cannot post the same comment twice, and once they send a comment, the &lt;i&gt;Post comment&lt;/i&gt; button is disabled. 
]]></help><api_version>1.0</api_version><size height='290' width='440' /><server>local://CommentCptServer</server><blog en='10' /><gdpr enabled='true' /></metadata><view><content>&lt;div class=form&gt;
		&lt;div class=&quot;item_div uic_name_input&quot;&gt;
			&lt;label&gt;
				&lt;span&gt;Display name &lt;span class=&apos;uic_require&apos;&gt;*&lt;/span&gt;&lt;/span&gt;
				&lt;input class=&quot;site_textbox&quot; type=&quot;text&quot; name=&quot;name&quot; value=&quot;&quot;/&gt;
			&lt;/label&gt;
		&lt;/div&gt;
		&lt;div class=&quot;item_div uic_email_input&quot;&gt;
			&lt;label&gt;
				&lt;span&gt;Email (Not shown)&lt;/span&gt;
				&lt;input class=&quot;site_textbox&quot; type=&quot;email&quot; name=&quot;email&quot; value=&quot;&quot;/&gt;
			&lt;/label&gt;
		&lt;/div&gt;
		&lt;div class=&quot;item_div uic_website_input&quot;&gt;
			&lt;label&gt;
				&lt;span&gt;Website&lt;/span&gt;
				&lt;input class=&quot;site_textbox&quot; type=&quot;text&quot; name=&quot;url&quot; value=&quot;&quot;/&gt;
			&lt;/label&gt;
		&lt;/div&gt;
		&lt;div class=&quot;item_div uic_comment_input&quot;&gt;
			&lt;label&gt;
				&lt;span&gt;Message&lt;span class=&apos;uic_require&apos;&gt;*&lt;/span&gt;&lt;/span&gt;
				&lt;textarea name=&quot;comment&quot;&gt;&lt;/textarea&gt;
			&lt;/label&gt;
			&lt;div class=help_cmt&gt;URL are automatically converted into links. No html code.&lt;/div&gt;
		&lt;/div&gt;
		&lt;div class=&quot;item_div&quot;&gt;
			&lt;label&gt;
				&lt;span&gt;Type this code&lt;span class=&apos;uic_require&apos;&gt;*&lt;/span&gt;&lt;/span&gt;
				&lt;div uitype=&quot;captcha&quot; name=&quot;captcha&quot;&gt;&lt;/div&gt;
			&lt;/label&gt;
		&lt;/div&gt;
		&lt;div class=&quot;item_div&quot;&gt;
		  &lt;div class=&quot;component_gdpr_container uic_gdpr&quot;&gt;&lt;/div&gt;
		&lt;/div&gt;
		&lt;div class=&quot;item_div&quot; style=&quot;text-align:center;&quot;&gt;
			&lt;input class=&quot;site_button&quot; type=submit value=&quot;Post comment&quot; /&gt;&lt;img src=&quot;/assets/loadingAnimation.gif&quot; class=&quot;loading&quot;&gt;
		&lt;/div&gt;
		&lt;div class=&quot;require_info&quot;&gt;
			*:Required fields
		&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;stat font_title_2&quot;&gt;&lt;/div&gt;
&lt;div class=comments&gt;&lt;/div&gt;
</content><properties><server_manage help='Validate, delete, modify comments posted by users. You can also add your comments: they will be shown in a different color to visitors.' icon='ui_forum' name='manage' text='Management' url='/cpt_comments/manage' /><server_manage ame='add_comment' help='Add a comment. It will be shown in a different color to visitors.' icon='bubble_up' text='Add comment' url='/cpt_comments/new' /><number default='20' help='Set how many comments are shown per page.' maximum='50' minimum='1' name='rows' title='Per page' /><checkbox default='true' help='If checked, you will be notified by email of each comment posted by visitors.' name='notify' value='Notify' /><checkbox default='true' help='If checked, when visitors post a comment it will not be shown until you validate it.' name='validation' value='Validation' /><checkbox default='true' help='If checked, the height of the block will automatically be adapted to the number of messages, possibly hiding blocks below it. Otherwise, a scrollbar will appear.' name='auto_size' value='Auto-Size' /><option default='&apos;bottom&apos;' display='Top|Bottom' help='Select where to display the post comment form: before comments, after comments or both.' name='form_pos' title='Form position' values='top|bottom' /><checkbox default='false' help='If checked, last posted comments will be displayed on top.' name='desc' value='Last on top' /></properties></view><script>UI_List.UI_Comment={initialize:function(a){this.cpt=a;
a.setOptions([&quot;locked&quot;])
},onDisplay:function(b){this.node=b;
this.pageSelected=0;
this.stat_node=$(b.children()[1]);
this.list_node=$(b.children()[2]);
this.form_node=$([b.children()[0],$(b.children()[0]).clone().appendTo(b)[0]]);
this.size_getter_el=$(&quot;&lt;div&gt;&lt;/div&gt;&quot;).appendTo(b)[0];
var a=this;
this.comments=this.cpt.data.comments||[];
delete this.cpt.data.comments;
this.updateForms();
this.updateCommentList();
this.n={gdpr:this.node.find(&quot;.component_gdpr_container&quot;)};
var c=a.form_node.find(&quot;.loading&quot;);
c.hide();
this.form_node.find(&quot;:submit&quot;).bind(&quot;click&quot;,function(){var f=a.form_node.find(&quot;:submit&quot;);
if(!a.testFormGdpr($(this).parents(&quot;.form&quot;))){return false
}f.hide();
c.show();
var d=$(this).parents(&quot;div.form&quot;);
var e={request:&quot;add_comment&quot;,comment:{},gdpr:a.getGdpr(a.n.gdpr)};
d.find(&quot;input,textarea&quot;).each(function(g,h){if(h.name==&quot;url&quot;){e.comment[&quot;url&quot;]=(h.value==&quot;&quot;)?&quot;&quot;:&quot;http://&quot;+h.value
}else{e.comment[h.name]=h.value
}});
a.cpt.ask(e,function(g){a.comments=g.comments;
a.updateCommentList();
if(a.cpt.data.validation){alert(&quot;Your comment has been posted and is waiting for validation.&quot;)
}else{alert(&quot;Your comment has been posted.&quot;)
}c.hide();
f.show()
},function(g){c.hide();
f.show();
alert(&quot;Your comment has not been posted:\n&quot;+g.join(&quot;\n&quot;))
},d)
});
$.extend(this,componentGdpr);
this.initGdpr();
var a=this;
sigCtl.connect(&quot;Theme.changed&quot;,function(){a.updateCptSize()
})
},getComments:function(){var a=this;
a.cpt.ask({request:&quot;get_comments&quot;,desc:a.cpt.data.desc},function(b){a.comments=b.comments;
a.updateCommentList()
},function(b){alert(&quot;Impossible to update comments.\n&quot;+b.join(&quot;\n&quot;))
})
},updateCommentList:function(){var b=this;
var c=this.comments;
if(!this.cpt.data.rows||this.cpt.data.rows==null||this.cpt.data.rows==0){this.cpt.data.rows=20
}var a=Math.ceil(c.length/this.cpt.data.rows);
this.pageSelected=Math.max(0,Math.min(this.pageSelected,a-1));
this.stat_node.text(sprintf(c.length&gt;1?&quot;%1$s comments&quot;:&quot;%1$s comment&quot;,c.length));
if($(&quot;.ui_list_pages&quot;,this.list_node).length==0){this.list_node.append(&apos;&lt;div class=&quot;ui_list_pages&quot;&gt;&lt;/div&gt;&apos;)
}else{$(&quot;.ui_list_pages&quot;,this.list_node).empty()
}if(a&gt;1){$.fn.paginate($(&quot;.ui_list_pages&quot;,this.list_node),a,this.pageSelected,1,3,function(d){b.pageSelected=d;
b.updateCommentList();
b.create_comments()
})
}else{$(&quot;.ui_list_pages&quot;,this.list_node).empty()
}this.create_comments()
},create_comments:function(){var a=this;
var b=this.comments.slice(this.pageSelected*this.cpt.data.rows,(this.pageSelected+1)*this.cpt.data.rows);
if($(&quot;.list_comments&quot;,this.list_node).length==0){this.list_node.append(&apos;&lt;div class=&quot;list_comments&quot;&gt;&lt;/div&gt;&apos;)
}else{$(&quot;.list_comments&quot;,this.list_node).empty()
}b.each(function(e){var d=$(&quot;&lt;div&gt;&lt;/div&gt;&quot;).addClass(&quot;comment_holder&quot;).appendTo($(&quot;.list_comments&quot;,a.list_node));
if(e.admin){d.addClass(&quot;admin&quot;)
}if(e.url){d.append($(&quot;&lt;a rel=&apos;nofollow&apos; target=&apos;_blank&apos;&gt;&lt;/a&gt;&quot;).attr(&quot;href&quot;,e.url||&quot;#&quot;).text(e.name).addClass(&quot;name&quot;))
}else{d.append($(&quot;&lt;span&gt;&lt;/span&gt;&quot;).text(e.name).addClass(&quot;name&quot;))
}if(e.published){d.append($(sprintf(&quot;&lt;span&gt;&amp;nbsp;%s&lt;/span&gt;&quot;,e.date)).addClass(&quot;date&quot;))
}else{d.append($(&quot;&lt;span&gt;&amp;nbsp;This comment is waiting for validation.&lt;/span&gt;&quot;).attr(&quot;title&quot;,e.date).addClass(&quot;date&quot;))
}d.append($(&quot;&lt;div&gt;&lt;/div&gt;&quot;).html(e.comment).addClass(&quot;comment&quot;))
});
if(this.cpt.data.auto_size){this.node.css(&quot;overflow-y&quot;,&quot;hidden&quot;)
}else{this.node.css(&quot;overflow-y&quot;,&quot;auto&quot;)
}this.updateCptSize()
},onShow:function(){this.updateCptSize()
},onSelect:function(){this.updateGdpr()
},updateCptSize:function(){if(this.cpt.data.auto_size){var a=this;
var b=function(){a.cpt.setSize({h:10000});
var c=[];
$(&quot;*&quot;,$(&quot;.UI_Comment&quot;)).each(function(d){c.push([this.offsetTop,this.offsetHeight,this.tagName,this.id,this.className])
});
a.cpt.setSize({h:a.size_getter_el.offsetTop})
};
b();
setTimeout(b,1000);
setTimeout(b,2500)
}},updateForms:function(){if(this.cpt.data.form_pos.indexOf(&quot;top&quot;)!=-1){$(this.form_node[0]).show()
}else{$(this.form_node[0]).hide()
}if(this.cpt.data.form_pos.indexOf(&quot;bottom&quot;)!=-1){$(this.form_node[1]).show()
}else{$(this.form_node[1]).hide()
}},onPropertyChanged:function(a){if(a.include(&quot;desc&quot;)||a.include(&quot;manage&quot;)||a.include(&quot;add_comment&quot;)){this.getComments()
}else{this.updateForms();
this.updateCommentList()
}},onResizeStop:function(){this.updateCptSize()
},onFontFamilyUpdate:function(){this.updateCptSize()
}};</script><style>div.UI_Comment textarea{box-sizing:border-box;width:100%;height:100px}
div.UI_Comment span.date{display:block;font-size:xx-small;font-style:italic;color:#888}
div.UI_Comment .name{text-transform:capitalize}
div.UI_Comment div.comments{margin:0}
div.UI_Comment div.comment_holder{margin:5px;padding:5px}
div.UI_Comment div.help_cmt,div.UI_Comment .info{font-size:xx-small;font-style:italic}
div.UI_Comment .info{padding-left:5px}
div.UI_Comment div.comment{margin-top:5px;text-align:justify}
div.UI_Comment a.name{color:#000;text-decoration:underline}
div.UI_Comment a.name:hover{text-decoration:none}
div.UI_Comment div.stat{font-weight:700;text-align:center}
.item_div{padding:5px}
.item_div input:not([type=checkbox]){width:100%;box-sizing:border-box}
div[name=captcha]{display:inline-block}
input.captcha_field,.item_div input[type=submit]{width:auto}
.uic_require,.require_info{color:red}</style></uidget>