Files
Testing/leptesting/poll.tpl
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

311 lines
11 KiB
Smarty

{include file='header.tpl'}
{* $Id: poll.tpl 162 2009-04-30 01:43:11Z john $ *}
<div class='page_header'>{lang_sprintf id=2500027 1=$owner->user_displayname 2=$url->url_create("profile", $owner->user_info.user_username) 3=$url->url_create("polls", $owner->user_info.user_username)}</div>
<br />
{* JAVASCRIPT FOR POLLS *}
{lang_javascript ids=2500028,2500034,2500114,2500115}
<script type='text/javascript' src="./include/js/poll.js"></script>
{literal}
<script type='text/javascript'>
<!--
jQuery(document).ready(function() {
loadXMLDoc(1);
{/literal}
{if $poll_object->poll_info.poll_viewonly}
getpolldata({$poll_object->poll_info.poll_id});
{/if}
{literal}
});
//-->
</script>
{/literal}
{* POLL RESULTS TEMPLATE *}
<div id="pollResultTemplate" >
<div class="pollResult">
<div class="pollResultLabel"></div>
<div class="pollResultBar"></div>
<span class="pollResultPercentage"></span>
<span class="pollResultVotes"></span>
</div>
</div>
{* SHOW THIS POLL *}
<table cellpadding='0' cellspacing='0' width='100%'>
<tr>
<td valign='top' class='poll_view' id="sePoll{$poll_object->poll_info.poll_id}">
{* TITLE AND DESCRIPTION *}
<div class='poll_view_title'>
{$poll_object->poll_info.poll_title|truncate:75:"...":true}
</div>
<div class='poll_view_stats'>
{capture name=totalVotesCode}<span id='poll{$poll_object->poll_info.poll_id}_totalvotes'>{$poll_object->poll_info.poll_totalvotes}</span>{/capture}
{lang_sprintf id=2500029 1=$datetime->cdate("`$setting.setting_dateformat`", $datetime->timezone("`$poll_object->poll_info.poll_datecreated`", $global_timezone))}
{lang_sprintf id=2500028 1=$smarty.capture.totalVotesCode},
{lang_sprintf id=507 1=$total_comments},
{lang_sprintf id=2500122 1=$poll_object->poll_info.poll_views}
</div>
<div style='padding: 5px;'>
{$poll_object->poll_info.poll_desc|choptext:120:"<br>"}
</div>
{* RESULTS *}
<div style='padding: 5px; font-weight: bold; display: none;' id='poll{$poll_object->poll_info.poll_id}_results'></div>
{* OPTIONS *}
<div style='padding: 5px;' id='poll{$poll_object->poll_info.poll_id}_vote'>
{counter start=-1 print=0}
{section name=options_loop loop=$poll_object->poll_info.poll_options}
<div style='padding: 3px 3px 3px 0px;'>
<table cellpadding='0' cellspacing='0'><tr>
<td>
<input type='radio' name="pollVoteSelect_{$poll_object->poll_info.poll_id}" onchange="change();" class="pollVoteOption" value='{counter}'>
</td>
<td style='font-weight: bold;'>
<label for='poll{$poll_object->poll_info.poll_id}_option{$smarty.section.options_loop.iteration}'>{$poll_object->poll_info.poll_options[options_loop]}</label>
</td>
</tr></table>
</div>
{/section}
</div>
{* VOTE OR VIEW *}
<div id="poll{$poll_object->poll_info.poll_id}_vote_actions" style='padding: 5px; margin-top: 10px;'>
{if $user->level_info.level_poll_allow & 2}<a href="javascript:void(0);" onclick="sendvotepoll();">{lang_print id=2500030}</a> |{/if}
<a href="javascript:void(0);" onclick="getpolldata({$poll_object->poll_info.poll_id});">{lang_print id=2500032}</a>
</div>
{* VOTE OR VIEW *}
<div id="poll{$poll_object->poll_info.poll_id}_results_actions" style='padding: 5px; margin-top: 10px; display:none;'>
<a href="javascript:void(0);" onclick="pollVoteMode({$poll_object->poll_info.poll_id});">{lang_print id=2500087}</a>
</div>
</td>
</tr>
</table>
<br />
<div>
<a href='{$url->url_create("polls", $owner->user_info.user_username)}'>
<!--<img src='./images/icons/back16.gif' border='0' class='icon'>-->
{lang_sprintf id=2500033 1=$owner->user_displayname}
</a>
&nbsp;&nbsp;&nbsp;
{lang_block id=861 var=langBlockTemp}<a href="javascript:TB_show('{$langBlockTemp}', 'user_report.php?return_url={$url->url_current()|escape:url}&TB_iframe=true&height=300&width=450', '', './images/trans.gif');"><!--<img src='./images/icons/report16.gif' border='0' class='icon'>-->{$langBlockTemp}</a>{/lang_block}
</div>
<br />
{* DISPLAY POST COMMENT BOX *}
<div style='margin-left: auto; margin-right: auto;'>
{if $allowed_to_comment}
<div id="profile_{$media_info.media_id}_postcomment"><div class="comment_headline">Comments (<span class="tc" id="totalcomments">{$total_comments|default:0}</span>)</div>
<form action="misc_js.php" method="post" target="ajaxframe" onsubmit="updatecount();"><div class="profile_postcomment"><textarea name="comment_body" id="comment_body" cols="25" class="comment_area" style="overflow: hidden; height: 70px;" placeholder="Write Something..."></textarea><div style="margin-top: 5px;">Allowed HTML Tags: b, img, a, br</div><div style="text-align: right; margin-top: 5px;">
<input type="submit" id="comment_submit" class="button" value="Post Comment" />
<input type="hidden" name="task" value="comment_post"><input type="hidden" name="type" value="poll"><input type="hidden" name="iden" value="poll_id"><input type="hidden" name="value" value="{$poll_object->poll_info.poll_id}" /><input type="hidden" name="tab" value="polls"><input type="hidden" name="col" value="poll"><input type="hidden" name="user" value="{$owner->user_info.user_username}"></div><div id="comment_error" style="color: #FF0000; display: none;"></div></div></form>
</div>{/if}
<div id="{$owner->user_info.user_username}_profile_comments" style='margin-left: auto; margin-right: auto;'></div>
{lang_javascript ids=39,155,175,182,183,184,185,187,784,787,829,830,831,832,833,834,835,854,856,891,1025,1026,1032,1034,1071}
{literal}
<script type="text/javascript" src="/js/jquery.autogrow-textarea.js"></script>
<script>
jQuery(function() {
jQuery('#comment_body').autogrow();
});
</script>
<script type="text/javascript" src="/js/jquery.autogrow-textarea.js"></script>
<script>
function subtractcount(){
total=document.getElementById('totalcomments').innerHTML;
total=total*1;
document.getElementById('totalcomments').innerHTML=total-1;}
function updatecount()
{
if(document.getElementById('comment_body').value!=""){
total=document.getElementById('totalcomments').innerHTML;
total=total*1;
document.getElementById('totalcomments').innerHTML=total+1;
}
}
function loadXMLDoc(page)
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("{/literal}{$owner->user_info.user_username}_profile_comments{literal}").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","{/literal}grabprofilecomments.php?user={$owner->user_info.user_username}&url={$smarty.server.PHP_SELF}{if $smarty.server.QUERY_STRING!=""}?{$smarty.server.QUERY_STRING|urlencode}{/if}&p="+page+"&type=poll&tab=polls&col=poll&focus=poll_id&poll_id={$poll_object->poll_info.poll_id}{literal}",true);
xmlhttp.send();
}
</script>
<script type="text/javascript">
var media_id = 0;
jQuery('#ajaxframe').load(function(){
loadXMLDoc(1);
document.getElementById('comment_body').value="";
});
function lepconfirmprofDelete(id) {
media_id = id;
document.getElementById('del_comment_id1').value=id;
TB_show('Delete Comment', '#TB_inline?height=150&width=300&inlineId=confirmdelete1', '', '../images/trans.gif');
document.getElementById('del_comment_id1').value=id;
}
function lepremovecomment()
{
id=document.getElementById('del_comment_id1').value;
document.getElementById('comment_'+id).style.display='none';
}
function editComment1(commentID)
{
//var commentContainerElement = $(this.options.type + '_' + this.options.typeID + '_comments');
//var commentElement = commentContainerElement.getElement('profile_comment_body_' + commentID);
var commentElement = $('profile_comment_body_' + commentID);
var height = commentElement.offsetHeight + 10;
var commentText = commentElement.innerHTML.replace(/<br>/gi, '\r\n').replace(/>/gi, '&gt;');
var innerHTML = '';
innerHTML += "<form action='misc_js.php' method='post' target='ajaxframe' name='editCommentForm' id='editCommentForm'>";
innerHTML += "<textarea name='comment_edit' id='comment_edit_" + commentID + "' style='height: " + height +" px; width: 100%;' onblur='doCommentEdit("+commentID+")'>" + commentText + "</textarea>";
innerHTML += "<input type='hidden' name='task' value='comment_edit'>";
innerHTML += "<input type='hidden' name='comment_id' value='" + commentID + "'>";
innerHTML += "<input type='hidden' name='type' value='poll'>";
innerHTML += "<input type='hidden' name='iden' value='poll_id'>";
innerHTML += "<input type='hidden' name='value' value='{/literal}{$poll_object->poll_info.poll_id}{literal}'>";
innerHTML +=
'<input type="hidden" name="tab" value="users">';
innerHTML +=
'<input type="hidden" name="col" value="user">';
/* if( this.options.typeTabParent ) innerHTML +=
'<input type="hidden" name="tab_parent" value="' + this.options.typeTabParent + '">';
if( this.options.typeColParent ) innerHTML +=
'<input type="hidden" name="col_parent" value="' + this.options.typeColParent + '">';
if( this.options.typeChild ) innerHTML +=
'<input type="hidden" name="child" value="1">';
*/
innerHTML += "</form>";
// Inject
commentElement.innerHTML = innerHTML;
textarea_autogrow('comment_edit_' + commentID);
$('comment_edit_' + commentID).focus();
}
function doCommentEdit(commentid)
{
//var event = new Event(e);
document.getElementById("editCommentForm").submit();
commentElement = $('profile_comment_body_' + commentid);
commentElement.innerHTML=document.getElementById("comment_edit_" + commentid).value;
// stop form submission
//event.stop();
}
function sendvotepoll()
{
var pollvalue=jQuery('input[name="pollVoteSelect_{/literal}{$poll_object->poll_info.poll_id}{literal}"]:checked').val();
sendpollvote(pollvalue,{/literal}{$poll_object->poll_info.poll_id}{literal});
}
</script>
{/literal}
</div>
{include file='footer.tpl'}