Location: PHPKode > projects > Uchome and Discuz > template/default/cp_poll.htm
<!--{template header}-->

<!--{if $op == 'addopt'}-->

<h1>Add poll item</h1>
<a href="javascript:hideMenu();" class="float_del" title="Close">Close</a>
<div class="popupmenu_inner" id="$pid">
	<form id="add_option_{$pid}" name="add_option_{$pid}" method="post" action="cp.php?ac=poll&op=addopt&pid=$pid">
		<div id="__add_option_{$pid}">
			<table>
				<tr>
					<td>
			
						<label for="newoption">Create New Poll</label><br />
						<input type="text" class="t_input" id="newoption" name="newoption" value="" size="50"/>
					</td>
				</tr>
				<tr>
					<td>
					<input type="hidden" name="refer" value="$_SGLOBAL[refer]" />
					<input type="hidden" name="addopt" value="true" />
					<input type="submit" name="addopt_btn" id="addopt_btn" value="Submit" class="submit" />
					</td>
				</tr>
			</table>
			<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
		</div>
	</form>
</div>

<!--{elseif $op=='delete'}-->

<h1>Delete Poll</h1>
<a href="javascript:hideMenu();" class="float_del" title="Cloese">Close</a>
<div class="popupmenu_inner">
	<form method="post" action="cp.php?ac=poll&op=delete&pid=$pid">
		<p>Are you sure do you to delete this Poll£¿</p>
		<p class="btn_line">
			<input type="hidden" name="refer" value="$_SGLOBAL[refer]" />
			<input type="hidden" name="deletesubmit" value="true" />
			<input type="submit" name="btnsubmit" value="Confirm" class="submit" />
		</p>
	<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
	</form>
</div>

<!--{elseif $op=='endreward'}-->

<h1>Disable Voting point/reward</h1>
<a href="javascript:hideMenu();" class="float_del" title="Close">Close</a>
<div class="popupmenu_inner">
	<form method="post" action="cp.php?ac=poll&op=endreward&pid=$pid">
		<p>While you stop reward credit,These credit will be not deduct from your account<br>Do you want to Continue£¿</p>
		<p class="btn_line">
			<input type="hidden" name="refer" value="$_SGLOBAL[refer]" />
			<input type="hidden" name="endrewardsubmit" value="true" />
			<input type="submit" name="btnsubmit" value="Confirm" class="submit" />
		</p>
	<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
	</form>
</div>

<!--{elseif $op == 'edithot'}-->

<h1>Adjust hot point</h1>
<a href="javascript:hideMenu();" class="float_del" title="Close">Close</a>
<div class="popupmenu_inner">
<form method="post" action="cp.php?ac=poll&op=edithot&pid=$pid">
	<p class="btn_line">
		New hot point£º<input type="text" name="hot" value="$poll[hot]" size="5"> 
		<input type="hidden" name="refer" value="$_SGLOBAL[refer]" />
		<input type="hidden" name="hotsubmit" value="true" />
		<input type="submit" name="btnsubmit" value="Confirm" class="submit" />
	</p>
<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
</form>
</div>

<!--{elseif $op == 'addreward'}-->

<h1>Additional reward to vote</h1>
<a href="javascript:hideMenu();" class="float_del" title="Close">Close</a>
<div class="popupmenu_inner" id="$pid">
	<form id="add_addreward_{$pid}" name="add_addreward_{$pid}" method="post" action="cp.php?ac=poll&op=addreward&pid=$pid">
		<div id="__add_addreward_{$pid}">
			<table>
				<tr>
					<td>
			
						<label for="addcredit">Additional reward to vote:</label>
						<input type="text" class="t_input" id="addcredit" name="addcredit" value="" size="10"/> Range£º0~$space[credit]
					</td>
				</tr>
				<!--{if $maxreward}-->
				<tr>
					<td>
						<label for="addpercredit">Add reward credit for every one£º</label>
						<input type="text" class="t_input" id="addpercredit" name="addpercredit" value="" size="10"/> Range£º0~$maxreward
					</td>
				</tr>
				<!--{/if}-->
				<tr>
					<td>
					<input type="hidden" name="refer" value="$_SGLOBAL[refer]" />
					<input type="hidden" name="addrewardsubmit" value="true" />
					<input type="submit" name="addopt_btn" id="addopt_btn" value="Submit" class="submit" />
					</td>
				</tr>
			</table>
			<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
		</div>
	</form>
</div>

<!--{elseif $op=='modify'}-->


<h1>Update this vote end time</h1>
<a href="javascript:hideMenu();" class="float_del" title="Close">Close</a>
<div class="popupmenu_inner" id="expiration_$pid">
<form id="modify_expiration_{$pid}" name="modify_expiration_{$pid}" method="post" action="cp.php?ac=poll&op=modify&pid=$pid">
<table>
	<tr>
		<td>
			<label for="expiration">Modify Closing Time£º</label><br />
			<input type="text" class="t_input" id="expiration" name="expiration" readonly value="<!--{date('Y-m-d', $poll[expiration]?$poll[expiration]:$_SGLOBAL[timestamp]+2592000)}-->" size="30" onclick="showcalendar(event, this, 0, '<!--{date('Y-m-d',$_SGLOBAL[timestamp])}-->')"/>
		</td>
	</tr>
	<tr>
		<td>
		<input type="hidden" name="refer" value="$_SGLOBAL[refer]" />
		<input type="hidden" name="modifysubmit" value="true" />
		<input type="submit" name="modifysubmit_btn" id="modifysubmit_btn" value="Submit" class="submit" />
		</td>
	</tr>
</table>
<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
</form>
</div>

<!--{elseif $op=='summary'}-->


<h1>Poll DEscription</h1>
<a href="javascript:hideMenu();" class="float_del" title="Close">Close</a>
<div class="popupmenu_inner" id="summary_$pid">
<form id="edit_summary_{$pid}" name="edit_summary_{$pid}" method="post" action="cp.php?ac=poll&op=summary&pid=$pid">
<table>
	<tr>
		<td>

			<label for="message">Poll Summary:</label>
			<a href="###" id="editface_{$pid}" onclick="showFace(this.id, 'summary');return false;"><img src="image/facelist.gif" align="absmiddle" /></a>
			<img src="image/zoomin.gif" onmouseover="this.style.cursor='pointer'" onclick="zoomTextarea('summary', 1)">

			<img src="image/zoomout.gif" onmouseover="this.style.cursor='pointer'" onclick="zoomTextarea('summary', 0)">

			<br />
			<textarea id="summary" name="summary" cols="70" onkeydown="ctrlEnter(event, 'summarysubmit_btn');" rows="8">$poll[summary]</textarea></td>
	</tr>
	<tr>
		<td>
		<input type="hidden" name="refer" value="$_SGLOBAL[refer]" />
		<input type="hidden" name="summarysubmit" value="true" />
		<input type="submit" name="summarysubmit_btn" id="summarysubmit_btn" value="Submit" class="submit" />
		</td>
	</tr>
</table>
<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
</form>
</div>

<!--{elseif $op == 'get'}-->
	<ul id="vote_list" class="voter_list">
	<!--{if $voteresult}-->
	<!--{loop $voteresult $value}-->
		<li>
			<!--{if $value[uid]==$_SGLOBAL[supe_uid]}-->
			<img class="meicon" alt="Myself" src="image/arrow.gif"/>
			<!--{/if}-->
			<!--{if empty($value[username])}-->
			Anonymous
			<!--{else}-->
			<a href="space.php?uid=$value[uid]">{$_SN[$value[uid]]}</a>
			<!--{/if}-->
			<!--{date('Y-m-d H:i:s',$value[dateline],1)}--> vote for $value[option]
		</li>
	<!--{/loop}-->
	<!--{else}-->
		<li>No relative<!--{if $_GET[filtrate]=='we'}-->Good friends<!--{/if}--> Poll log</li>
	<!--{/if}-->
	</ul>
	<!--{if $multi}--><div class="page">$multi</div><br/><!--{/if}-->
	
<!--{elseif $op == 'invite'}-->

<form id="inviteform" name="inviteform" method="post" action="cp.php?ac=poll&op=invite&pid=$poll[pid]&uid=$_GET[uid]&grade=$_GET[grade]&group=$_GET[group]&page=$_GET[page]&start=$_GET[start]">

<h2 class="title"><img src="image/app/poll.gif" />Vote</h2>
<div class="tabs_header">
	<ul class="tabs">
		<li><a href="cp.php?ac=poll"><span>Create New Poll</span></a></li>
		<li class="active"><a href="cp.php?ac=poll&op=invite&pid=$poll[pid]"><span>Invite Friends</span></a></li>
		<li><a href="space.php?uid=$poll[uid]&do=poll&pid=$poll[pid]"><span>Back to Poll</span></a></li>
	</ul>
</div>
<div id="content" style="width: 640px;">
	<div class="h_status">
		You can invite friends to vote for <a href="space.php?uid=$poll[uid]&do=poll&pid=$poll[pid]">¡¶$poll[subject]¡·</a> Poll
	</div>
	
	<div class="h_status">
		<!--{if $list}-->
		<ul class="avatar_list">
		<!--{loop $list $value}-->
			<li><div class="avatar48"><a href="space.php?uid=$value[fuid]" title="{$_SN[$value[fuid]]}"><!--{avatar($value[fuid],small)}--></a></div>
				<p>
				<a href="space.php?uid=$value[fuid]" title="{$_SN[$value[fuid]]}">{$_SN[$value[fuid]]}</a>
				</p>
				<p><!--{if empty($invitearr[$value[fuid]])}--><input type="checkbox" name="ids[]" value="$value[fuid]">Choose<!--{else}-->Invited<!--{/if}--></p>
			</li>
		<!--{/loop}-->
		</ul>
		<div class="page">$multi</div>
		<!--{else}-->
		<div class="c_form">No friends are Voting for this.</div>
		<!--{/if}-->
	</div>
	<p>
		<input type="checkbox" id="chkall" name="chkall" onclick="checkAll(this.form, 'ids')">Select All&nbsp;
		<input type="submit" name="invitesubmit" value="Invite" class="submit" />
	</p>
</div>

<div id="sidebar" style="width: 150px;">
	<div class="cat">
		<h3>Friends Group</h3>
		<ul class="post_list line_list">
			<li<!--{if $_GET[group]==-1}--> class="current"<!--{/if}-->><a href="cp.php?ac=poll&pid=$poll[pid]&op=invite&group=-1">All  Friend</a></li>
			<!--{loop $groups $key $value}-->
			<li<!--{if $_GET[group]==$key}--> class="current"<!--{/if}-->><a href="cp.php?ac=poll&pid=$poll[pid]&op=invite&group=$key">$value</a></li>
			<!--{/loop}-->
		</ul>
	</div>
</div>
<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
</form>
<!--{else}-->


<!--{if $topic}-->
	<!--{template cp_topic_menu}-->
<!--{else}-->
	<h2 class="title"><img src="image/app/poll.gif" />Poll</h2>
	<div class="tabs_header">
		<ul class="tabs">
			<li class="active"><a href="cp.php?ac=poll"><span>Launch a vote</span></a></li>
			<li><a href="space.php?do=poll&view=me"><span> My Poll</span></a></li>
		</ul>
	</div>
<!--{/if}-->

<div class="c_form">
	
	<form id="addnewpoll" name="addnewpoll" method="post" action="cp.php?ac=poll">
		<table cellspacing="4" cellpadding="4" width="100%" class="infotable">
			<tr>
				<th width="80">Vote Title</th>
				<td>
					<input type="text" class="t_input" style="width:450px;" id="subject" name="subject" value=""> <br/>
					<a id="addtip" href="javascript:;" onclick="initIntro();" onfocus="this.blur();">Poll Details</a>
				</td>
			</tr>
			<tr id="intropoll" style="display:none">
				<th>Details</th>
				<td><textarea id="message" style="padding: 3px 2px;width:450px;height:50px;" name="message"></textarea> </td>
			</tr>
			<tr>
				<td colspan="2" height="1px"><div style="width: 550px; height:1px; border-bottom:1px solid #DDDDDD;"></div></td>
			</tr>
			<!--{eval $option=array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); }-->
			<!--{loop $option $key $val}-->
			<!--{if $val==11}-->
			<tbody id="moreoption" style="display: none;">
			<!--{/if}-->
			<tr>
				<th>Option{$val}</th>
				<td>
					<input type="text" class="t_input"  style="width:450px;" name="option[]" value="" maxlength="120">
					<!--{if $val==10}-->
					<div><a id="moretip" href="javascript:;" onclick="showMoreOption();" onfocus="this.blur();">Add more option</a></div>
					<!--{/if}-->
				</td>
			</tr>
			<!--{/loop}-->
			</tbody>
			<tr>
				<th>Option</th>
				<td>
					<select name="maxchoice">
						<!--{loop $option $key $val}-->
							<option value="$val">
								<!--{if $val==1}-->
								Select one
								<!--{else}-->
								Select Muti-Maxinum {$val} Choice
								<!--{/if}-->
							</option>
						<!--{/loop}-->
					</select>
				</td>
			</tr>
			<tr>
				<th>End time</th>
				<td>
					<script type="text/javascript" src="source/script_calendar.js" charset="$_SC[charset]"></script>
					<input type="text" class="t_input" size="16" id="expiration" readonly name="expiration" value="" onclick="showcalendar(event, this, 0, '<!--{date('Y-m-d',$_SGLOBAL[timestamp])}-->')" />
				</td>
			</tr>
			<tr>
				<th>Vote limit</th>
				<td>
					<input type="radio" name="sex" value="0" checked />Any one
					<input type="radio" name="sex" value="1" />Male
					<input type="radio" name="sex" value="2" />Female 
				</td>
			</tr>
			<tr>
				<th>Blog limit</th>
				<td>
					<input type="radio" name="noreply" value="0" checked />Unlimit 
					<input type="radio" name="noreply" value="1" />Only friend
				</td>
			</tr>
			<tr>
				<th>Reward Vote</th>
				<td>
					<input type="radio" name="reward" value="0" checked onclick="initReward(this.value);" />No
					<input type="radio" name="reward" value="1" onclick="initReward(this.value);" />Yes
				</td>
			</tr>
			<tbody id="rewardlist" style="display: none;">
				<tr>
					<th>Reward Credit Total</th>
					<td>
						<input type="text" class="t_input" size="16" id="credit" name="credit" value="" maxlength="60"> Range£º1~$space[credit]
					</td>
				</tr>
				<tr>
					<th>Reward for all</th>
					<td>
						<input type="text" class="t_input" size="16" id="percredit" name="percredit" value="" maxlength="60"> Range£º1~$_SCONFIG[maxreward]
					</td>
				</tr>
			</tbody>
			<!--{if checkperm('seccode')}-->
				<!--{if $_SCONFIG['questionmode']}-->
				<tr>
					<th style="vertical-align: top;" width="90">Answer below question</th>
					<td>
						<p><!--{eval question();}--></p>
						<input type="text" id="seccode" name="seccode" value="" size="15" class="t_input" />
					</td>
				</tr>
				<!--{else}-->
				<tr>
					<th style="vertical-align: top;" width="90">Please fill in authentication code</th>
					<td>
						<script>seccode();</script>
						<p>Please input 4 letters or digits upper side£¬If you cannot see <a href="javascript:updateseccode()">update a new one</a></p>
						<input type="text" id="seccode" name="seccode" value="" size="15" class="t_input" />
					</td>
				</tr>
				<!--{/if}-->
			<!--{/if}-->
			
			<tr>
				<th>RSS Feed Option</th>
				<td>
					<input type="checkbox" name="makefeed" id="makefeed" value="1"<!--{if ckprivacy('poll', 1)}--> checked<!--{/if}-->> Create feed (<a href="cp.php?ac=privacy#feed" target="_blank">update default setting</a>)
				</td>
			</tr>
			
			<tr>
				<th></th>
				<td>
					<input type="hidden" name="pollsubmit" id="pollsubmit" value="true" />
					<input type="hidden" name="topicid" value="$_GET[topicid]" />
					<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
					<input type="submit" name="addpollsubmit" id="addpollsubmit" value="Create New Poll" class="submit" onclick="validate(this);return false;" />
					<div id="__addnewpoll"></div>
				</td>
			</tr>
		</table>
	</form>
	<script type="text/javascript" charset="$_SC[charset]">
		function initIntro() {
			var introObj = $('intropoll');
			var tipObj = $('addtip');
			if(introObj.style.display == 'none') {
				introObj.style.display = '';
				
				tipObj.innerHTML = "Hide vote details";
			} else {
				if (($('message').value.length == 0) || (confirm("Vote detail will be empty trash,Do you want to go on£¿"))) {
					introObj.style.display = 'none';
					$('message').value = '';
					tipObj.innerHTML = "Add vote details";
				}
			}
		}
		function initReward(status) {
			var rewardObj = $('rewardlist');
			if(status == 1) {
				rewardObj.style.display = '';
			} else {
				rewardObj.style.display = 'none';
				$("credit").value = '';
				$("percredit").value = '';
			}
		}
		function showMoreOption() {
			$("moreoption").style.display = '';
			$("moretip").style.display = 'none';
		}
		function validate(obj) {
		    var subject = $('subject');
		    if (subject) {
		    	var slen = strlen(subject.value);
		        if (slen < 1 || slen > 80) {
		            alert("Title Length(1~80 letter),");
		            subject.focus();
		            return false;
		        }
		    }
		    
		    var makefeed = $('makefeed');
		    if(makefeed) {
		    	if(makefeed.checked == false) {
		    		if(!confirm("Note£ºAre you sure you do not want RSS Feed£¿\n")) {
		    			return false;
		    		}
		    	}
		    }
		    
			var optionCount = 0;
			var optionObj = document.getElementsByName("option[]");
			for(var i=0;i<optionObj.length;i++) {
				if(optionObj[i].value.Trim()!="") {
					optionCount++;
				}
			}
			if(optionCount<2) {
				alert('Require minimum 2 opritons');
				return false;
			}
			var maxCredit = $space[credit];
			var maxPercredit = $_SCONFIG[maxreward];
			//ÑéÖ¤ÐüÉÍͶƱÉèÖÃ
			var credit = parseInt($('credit').value.Trim());
			var percredit = parseInt($('percredit').value.Trim());
			if(credit || percredit) {
				if(!credit) {
					alert("Please input reward credit total");
					return false;
				} else if(!percredit) {
					alert("Please input point for each person");
					return false;
				} else if(credit > maxCredit) {
					alert("Reward credit total range:1~"+maxCredit+"");
					return false;
				} else if(maxPercredit && percredit > maxPercredit) {
					alert("Credit range:1~"+maxPercredit+" for each Vote");
					return false;
				} else if(credit < percredit) {
					alert("Each Person credit can not be higher than reward credit total");
					return false;
				}
			}
			var nowDate = parsedate("<!--{date('Y-m-d',$_SGLOBAL[timestamp])}-->");
			
			
			if($('expiration').value.Trim() != "") {
				var expiration = parsedate($('expiration').value.Trim());
				if(expiration < nowDate) {
					alert("End time can not be less than the current time");
					return false;
				}
			}
		    if($('seccode')) {
				var code = $('seccode').value;
				var x = new Ajax();
				x.get('cp.php?ac=common&op=seccode&code=' + code, function(s){
					s = trim(s);
					if(s.indexOf('succeed') == -1) {
						alert(s);
						$('seccode').focus();
		           		return false;
					}
				});
		    }
		    ajaxpost('addnewpoll', 'poll_post_result');
		}
		String.prototype.Trim = function() { 
			return this.replace(/(^\s*)|(\s*$)/g, ""); 
		}
	</script>
</div>
<!--{/if}-->

<!--{template footer}-->
Return current item: Uchome and Discuz