vote_edit.tpl.php 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <?php
  2. defined('IN_ADMIN') or exit('No permission resources.');
  3. include $this->admin_tpl('header','admin');
  4. ?>
  5. <script type="text/javascript">
  6. <!--
  7. $(function(){
  8. $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}});
  9. $("#subject_title").formValidator({onshow:"<?php echo L("input").L('vote_title')?>",onfocus:"<?php echo L("input").L('vote_title')?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('vote_title')?>"}).regexValidator({regexp:"notempty",datatype:"enum",param:'i',onerror:"<?php echo L('input_not_space')?>"}).ajaxValidator({type : "get",url : "",data :"m=vote&c=vote&a=public_name&subjectid=<?php echo $subjectid;?>",datatype : "html",async:'false',success : function(data){ if( data == "1" ){return true;}else{return false;}},buttons: $("#dosubmit"),onerror : "<?php echo L('vote_title').L('exists')?>",onwait : "<?php echo L('connecting')?>"}).defaultPassed();
  10. $('#fromdate').formValidator({onshow:"<?php echo L('select').L('fromdate')?>",onfocus:"<?php echo L('select').L('fromdate')?>",oncorrect:"<?php echo L('time_is_ok');
  11. ?>"}).inputValidator();
  12. $("#todate").formValidator({onshow:"<?php echo L('select').L('todate')?>",onfocus:"<?php echo L('select').L('todate')?>",oncorrect:"<?php echo L('time_is_ok');?>"}).inputValidator();
  13. });
  14. //-->
  15. </script>
  16. <div class="pad_10">
  17. <form action="?m=vote&c=vote&a=edit&subjectid=<?php echo $subjectid?>" method="post" name="myform" id="myform">
  18. <table cellpadding="2" cellspacing="1" class="table_form" width="100%">
  19. <tr>
  20. <th width="100"> <?php echo L('vote_title')?></th>
  21. <td>
  22. <input type="text" name="subject[subject]" id="subject_title" size="30" value="<?php echo $subject;?>">
  23. </td>
  24. </tr>
  25. <tr>
  26. <th width="100"> <?php echo L('select_type')?> </th>
  27. <td>
  28. <select name="subject[ischeckbox]" id="" onchange="AdsType(this.value)">
  29. <option value="0" <?php if($ischeckbox == '0') {?> selected<?php }?>><?php echo L('radio');?></option>
  30. <option value="1" <?php if($ischeckbox == '1') {?> selected<?php }?>><?php echo L('checkbox');?></option>
  31. </select>
  32. </td>
  33. </tr>
  34. <tr id="SizeFormat" <?php if($ischeckbox == '0'){ ?>style="display:none"<?php }else{?>style="display:"<?php }?>>
  35. <th> </th>
  36. <td><label><?php echo L('minval');?></label>&nbsp;&nbsp;<input name="subject[minval]" class="input-text" type="text" size="5" value="<?php echo $minval;?>"> <?php echo L('item')?> &nbsp;&nbsp;&nbsp;&nbsp; <label><?php echo L('maxval');?></label>&nbsp;&nbsp;<input name="subject[maxval]" type="text" class="input-text" size="5" value="<?php echo $maxval?>"> <?php echo L('item')?></td>
  37. </tr>
  38. <tr>
  39. <th width="100"> <?php echo L('vote_option')?>:</th>
  40. <td>
  41. <input type="button" id="addItem" value="<?php echo L('add_option')?>" class="button" onclick="add_option()">
  42. <div id="option_list_1">
  43. <?php
  44. $i=0;
  45. foreach($options as $optionid=>$option){
  46. $i++;
  47. ?>
  48. <div id="option<?php echo $option['optionid'];?>"><br>
  49. <input type="text" name="option[<?php echo $option['optionid']?>]" size="40" require="true" value="<?php echo $option['option'];?>"/>
  50. <?php if($i>2){?>
  51. <input type="button" value="<?php echo L('del')?>" onclick="del_old(<?php echo $option['optionid'];?>)" class="button"/>
  52. <?php }?>
  53. <font color="#FF0000"> *</font>
  54. </div>
  55. <?php }?>
  56. </div>
  57. <div id="new_option"></div>
  58. </td>
  59. </tr>
  60. <tr>
  61. <th><?php echo L('fromdate')?>:</th>
  62. <td><?php echo form::date('subject[fromdate]',$fromdate)?></td>
  63. </tr>
  64. <tr>
  65. <th><?php echo L('todate')?> :</th>
  66. <td><?php echo form::date('subject[todate]',$todate)?></td>
  67. </tr>
  68. <tr>
  69. <th> <?php echo L('vote_description')?> </th>
  70. <td><textarea name="subject[description]" id="description" cols="60" rows="6"><?php echo $description;?></textarea></td>
  71. </tr>
  72. <tr>
  73. <th><?php echo L('allowview')?>:</th>
  74. <td><input name="subject[allowview]" type="radio" value="1" <?php echo $allowview?'checked':''?>>&nbsp;<?php echo L('allow')?>&nbsp;&nbsp;<input name="subject[allowview]" type="radio" value="0" <?php echo $allowview?'':'checked'?>>&nbsp;<?php echo L('not_allow')?></td>
  75. </tr>
  76. <tr>
  77. <th><?php echo L('allowguest')?>:</th>
  78. <td><input name="subject[allowguest]" type="radio" value="1" <?php echo $allowguest?'checked':''?>>&nbsp;<?php echo L('yes')?>&nbsp;&nbsp;<input name="subject[allowguest]" type="radio" value="0" <?php echo $allowguest?'':'checked'?>>&nbsp;<?php echo L('no')?></td>
  79. </tr>
  80. <tr>
  81. <th><?php echo L('credit')?>:</th>
  82. <td><input type="text" name="subject[credit]" value="<?php echo $credit;?>" size='5' /></td>
  83. </tr>
  84. <tr>
  85. <th><?php echo L('interval')?>:</th>
  86. <td><input type="text" name="subject[interval]" value="<?php echo $interval;?>" size='5' /> <?php echo L('more_ip')?>,<font color=red>0</font> <?php echo L('one_ip')?></td>
  87. </tr>
  88. <tr>
  89. <th><?php echo L('vote_style')?>:</th>
  90. <td>
  91. <?php echo form::select($template_list, $info['default_style'], 'name="vote_subject[style]" id="style" onchange="load_file_list(this.value)"', L('please_select'))?>
  92. <script type="text/javascript">$.getJSON('?m=admin&c=category&a=public_tpl_file_list&style=<?php echo $info['default_style']?>&module=vote&templates=vote_tp&id=<?php echo $template?>&name=vote_subject&pc_hash='+pc_hash, function(data){$('#show_template').html(data.vote_tp_template);});</script>
  93. </td>
  94. </tr>
  95. <tr>
  96. <th><?php echo L('template')?>:</th>
  97. <td id="show_template">
  98. <?php echo form::select_template('default', 'vote', $template, 'name="vote_subject[show_template]"', 'vote_tp');?>
  99. </td>
  100. </tr>
  101. <tr>
  102. <th><?php echo L('enabled')?>:</th>
  103. <td><input name="subject[enabled]" type="radio" value="1" <?php echo $enabled?'checked':''?>>&nbsp;<?php echo L('yes')?>&nbsp;&nbsp;<input name="subject[enabled]" type="radio" value="0" <?php echo $enabled?'':'checked'?>>&nbsp;<?php echo L('no')?></td>
  104. </tr>
  105. <tr>
  106. <th></th>
  107. <td>
  108. <input type="submit" name="dosubmit" id="dosubmit" class="dialog" value=" <?php echo L('submit')?> ">
  109. </td>
  110. </tr>
  111. </table>
  112. </form>
  113. </div>
  114. </body>
  115. </html>
  116. <script language="javascript" type="text/javascript">
  117. function AdsType(adstype) {
  118. $('#SizeFormat').css('display', 'none');
  119. if(adstype=='0') {
  120. } else if(adstype=='1') {
  121. $('#SizeFormat').css('display', '');
  122. }
  123. }
  124. $('#AlignBox').click( function (){
  125. if($('#AlignBox').attr('checked')) {
  126. $('#PaddingLeft').attr('disabled', true);
  127. $('#PaddingTop').attr('disabled', true);
  128. } else {
  129. $('#PaddingLeft').attr('disabled', false);
  130. $('#PaddingTop').attr('disabled', false);
  131. }
  132. });
  133. </script>
  134. <script language="javascript">
  135. var i = 1;
  136. function add_option() {
  137. //var i = 1;
  138. var htmloptions = '';
  139. htmloptions += '<div id='+i+'><span ><br><input type="text" name="newoption[]" size="40" msg="<?php echo L('must_input')?>" value="" class="input-text"/><input type="button" value="<?php echo L('del')?>" onclick="del('+i+')" class="button"/></span><font color="#FF0000"> *</font><br> </div>';
  140. $(htmloptions).appendTo('#new_option');
  141. var htmloptions = '';
  142. i = i+1;
  143. }
  144. function del(o){
  145. $("div [id=\'"+o+"\']").remove();
  146. }
  147. function del_old2(o){
  148. $("div [id=\'"+o+"\']").remove();
  149. }
  150. function del_old(id) {
  151. $.get('?m=vote&c=vote&a=del_option&optionid='+id+'&pc_hash='+pc_hash,null,function (msg) {
  152. if (msg==1) {
  153. $("div [id=\'option"+id+"\']").remove();
  154. } else {
  155. alert(msg);
  156. }
  157. });
  158. }
  159. function load_file_list(id) {
  160. $.getJSON('?m=admin&c=category&a=public_tpl_file_list&style='+id+'&module=vote&templates=vote_tp&name=subject&pc_hash='+pc_hash, function(data){$('#show_template').html(data.vote_tp_template);});
  161. }
  162. </script>