vote_add.tpl.php 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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",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')?>"});
  10. $("#option1").formValidator({onshow:"<?php echo L("input").L('vote_option')?>",onfocus:"<?php echo L("input").L('vote_option')?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('vote_option')?>"}).regexValidator({regexp:"notempty",datatype:"enum",param:'i',onerror:"<?php echo L('input_not_space')?>"});
  11. $("#option2").formValidator({onshow:"<?php echo L("input").L('vote_option')?>",onfocus:"<?php echo L("input").L('vote_option')?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('vote_option')?>"}).regexValidator({regexp:"notempty",datatype:"enum",param:'i',onerror:"<?php echo L('input_not_space')?>"});
  12. $("#fromdate").formValidator({onshow:"<?php echo L('select').L('fromdate')?>",onfocus:"<?php echo L('select').L('fromdate')?>",oncorrect:"<?php echo L('time_is_ok');
  13. ?>"}).inputValidator();
  14. $("#todate").formValidator({onshow:"<?php echo L('select').L('todate')?>",onfocus:"<?php echo L('select').L('todate')?>",oncorrect:"<?php echo L('time_is_ok');?>"}).inputValidator();
  15. $('#style').formValidator({onshow:"<?php echo L('select_style')?>",onfocus:"<?php echo L('select_style')?>",oncorrect:"<?php echo L('right_all')?>"}).inputValidator({min:1,onerror:"<?php echo L('select_style')?>"});
  16. });
  17. //-->
  18. </script>
  19. <div class="pad_10">
  20. <form action="?m=vote&c=vote&a=add" method="post" name="myform" id="myform">
  21. <table cellpadding="2" cellspacing="1" class="table_form" width="100%">
  22. <tr>
  23. <th width="100"><?php echo L('vote_title')?> :</th>
  24. <td><input type="text" name="subject[subject]" id="subject_title"
  25. size="30" class="input-text"></td>
  26. </tr>
  27. <tr>
  28. <th width="20%"><?php echo L('select_type')?> :</th>
  29. <td><select name="subject[ischeckbox]" id=""
  30. onchange="AdsType(this.value)">
  31. <option value="0"><?php echo L('radio');?></option>
  32. <option value="1"><?php echo L('checkbox');?></option>
  33. </select></td>
  34. </tr>
  35. <tr id="SizeFormat" style="display: none;">
  36. <th></th>
  37. <td><label><?php echo L('minval')?></label>&nbsp;&nbsp;<input name="subject[minval]"
  38. class="input-text" type="text" size="5"> <?php echo L('item')?> &nbsp;&nbsp;&nbsp;&nbsp; <label><?php echo L('maxval')?></label>&nbsp;&nbsp;<input
  39. name="subject[maxval]" type="text" class="input-text" size="5"> <?php echo L('item')?></td>
  40. </tr>
  41. <tr>
  42. <th width="20%"><?php echo L('vote_option')?> :</th>
  43. <td>
  44. <input type="button" id="addItem" value="<?php echo L('add_option')?>" class="button" onclick="add_option()">
  45. <div id="option_list_1">
  46. <div><br> <input type="text"
  47. name="option[]" id="option1" size="40" require="true"
  48. id="opt1"/></div>
  49. <div><br>
  50. <input type="text"
  51. name="option[]" id="option2" size="40"
  52. id="opt2" /></div>
  53. </div>
  54. <div id="new_option"></div>
  55. </td>
  56. </tr>
  57. <tr>
  58. <th><?php echo L('fromdate')?> :</th>
  59. <td><?php echo form::date('subject[fromdate]', '', '')?></td>
  60. </tr>
  61. <tr>
  62. <th><?php echo L('todate')?> :</th>
  63. <td><?php echo form::date('subject[todate]', '', '')?></td>
  64. </tr>
  65. <tr>
  66. <th><?php echo L('vote_description')?></th>
  67. <td><textarea name="subject[description]" id="description" cols="60"
  68. rows="6"></textarea></td>
  69. </tr>
  70. <tr>
  71. <th><?php echo L('allowview')?>:</th>
  72. <td><input name="subject[allowview]" type="radio" value="1" checked>&nbsp;<?php echo L('allow')?>&nbsp;&nbsp;<input
  73. name="subject[allowview]" type="radio" value="0">&nbsp;<?php echo L('not_allow')?></td>
  74. </tr>
  75. <tr>
  76. <th><?php echo L('allowguest')?>:</th>
  77. <td><input name="subject[allowguest]" type="radio" value="1" <?php if($allowguest == 1) {?>checked<?php }?>>&nbsp;<?php echo L('yes')?>&nbsp;&nbsp;<input
  78. name="subject[allowguest]" type="radio" value="0" <?php if($allowguest == 0) {?>checked<?php }?>>&nbsp;<?php echo L('no')?></td>
  79. </tr>
  80. <tr>
  81. <th><?php echo L('credit')?>:</th>
  82. <td><input name="subject[credit]" type="text" 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, $default_style, 'name="vote_subject[style]" id="style" onchange="load_file_list(this.value)"', L('please_select'))?>
  92. </td>
  93. </tr>
  94. <tr>
  95. <th><?php echo L('template')?>:</th>
  96. <td id="show_template">
  97. <?php echo form::select_template($default_style, 'vote', $vote_tp_template, 'name="vote_subject[vote_tp_template]"', 'vote_tp');?>
  98. </td>
  99. </tr>
  100. <tr>
  101. <th><?php echo L('enabled')?>:</th>
  102. <td><input name="subject[enabled]" type="radio" value="1" <?php if($enabled == 1) {?>checked<?php }?>>&nbsp;<?php echo L('yes')?>&nbsp;&nbsp;<input
  103. name="subject[enabled]" type="radio" value="0" <?php if($enabled == 0) {?>checked<?php }?>>&nbsp;<?php echo L('no')?></td>
  104. </tr>
  105. <tr>
  106. <th></th>
  107. <td>
  108. <input type="hidden"name="from_api" value="<?php echo $_GET['from_api'];?>">
  109. <input type="submit" name="dosubmit" id="dosubmit" class="dialog"
  110. value=" <?php echo L('submit')?> "></td>
  111. </tr>
  112. </table>
  113. </form>
  114. </div>
  115. </body>
  116. </html>
  117. <script language="javascript" type="text/javascript">
  118. function AdsType(adstype) {
  119. $('#SizeFormat').css('display', 'none');
  120. if(adstype=='0') {
  121. } else if(adstype=='1') {
  122. $('#SizeFormat').css('display', '');
  123. }
  124. }
  125. $('#AlignBox').click( function (){
  126. if($('#AlignBox').attr('checked')) {
  127. $('#PaddingLeft').attr('disabled', true);
  128. $('#PaddingTop').attr('disabled', true);
  129. } else {
  130. $('#PaddingLeft').attr('disabled', false);
  131. $('#PaddingTop').attr('disabled', false);
  132. }
  133. });
  134. </script>
  135. <script language="javascript">
  136. var i = 1;
  137. function add_option() {
  138. //var i = 1;
  139. var htmloptions = '';
  140. htmloptions += '<div id='+i+'><span><br><input type="text" name="option[]" 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"/><br></span></div>';
  141. $(htmloptions).appendTo('#new_option');
  142. var htmloptions = '';
  143. i = i+1;
  144. }
  145. function del(o){
  146. $("div [id=\'"+o+"\']").remove();
  147. }
  148. function load_file_list(id) {
  149. $.getJSON('?m=admin&c=category&a=public_tpl_file_list&style='+id+'&module=vote&templates=vote_tp&name=vote_subject&pc_hash='+pc_hash, function(data){$('#show_template').html(data.vote_tp_template);});
  150. }
  151. </script>