announce_add.tpl.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. defined('IN_ADMIN') or exit('No permission resources.');
  3. include $this->admin_tpl('header', 'admin');
  4. ?>
  5. <div class="pad-10">
  6. <form method="post" action="?m=announce&c=admin_announce&a=add" name="myform" id="myform">
  7. <table class="table_form" width="100%" cellspacing="0">
  8. <tbody>
  9. <tr>
  10. <th width="80"><strong><?php echo L('announce_title')?></strong></th>
  11. <td><input name="announce[title]" id="title" class="input-text" type="text" size="50" ></td>
  12. </tr>
  13. <tr>
  14. <th><strong><?php echo L('startdate')?>:</strong></th>
  15. <td><?php echo form::date('announce[starttime]', date('Y-m-d H:i:s'), 1)?></td>
  16. </tr>
  17. <tr>
  18. <th><strong><?php echo L('enddate')?>:</strong></th>
  19. <td><?php echo form::date('announce[endtime]', $an_info['endtime'], 1);?></td>
  20. </tr>
  21. <tr>
  22. <th><strong><?php echo L('announce_content')?></strong></th>
  23. <td><textarea name="announce[content]" id="content"></textarea><?php echo form::editor('content');?></td>
  24. </tr>
  25. <tr>
  26. <th><strong><?php echo L('available_style')?>:</strong></th>
  27. <td>
  28. <?php echo form::select($template_list, $info['default_style'], 'name="announce[style]" id="style" onchange="load_file_list(this.value)"', L('please_select'))?>
  29. </td>
  30. </tr>
  31. <tr>
  32. <th><strong><?php echo L('template_select')?>:</strong></th>
  33. <td id="show_template"><script type="text/javascript">$.getJSON('?m=admin&c=category&a=public_tpl_file_list&style=<?php echo $info['default_style']?>&module=announce&templates=show&name=announce&pc_hash='+pc_hash, function(data){$('#show_template').html(data.show_template);});</script></td>
  34. </tr>
  35. <tr>
  36. <th><strong><?php echo L('announce_status')?></strong></th>
  37. <td><input name="announce[passed]" type="radio" value="1" checked>&nbsp;<?php echo L('pass')?>&nbsp;&nbsp;<input name="announce[passed]" type="radio" value="0">&nbsp;<?php echo L('unpass')?></td>
  38. </tr>
  39. </tbody>
  40. </table>
  41. <input type="submit" name="dosubmit" id="dosubmit" value=" <?php echo L('ok')?> " class="dialog">&nbsp;<input type="reset" class="dialog" value=" <?php echo L('clear')?> ">
  42. </form>
  43. </div>
  44. </body>
  45. </html>
  46. <script type="text/javascript">
  47. function load_file_list(id) {
  48. if (id=='') return false;
  49. $.getJSON('?m=admin&c=category&a=public_tpl_file_list&style='+id+'&module=announce&templates=show&name=announce&pc_hash='+pc_hash, function(data){$('#show_template').html(data.show_template);});
  50. }
  51. $(document).ready(function(){
  52. $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'220',height:'70'}, function(){this.close();$(obj).focus();})}});
  53. $('#title').formValidator({onshow:"<?php echo L('input_announce_title')?>",onfocus:"<?php echo L('title_min_3_chars')?>",oncorrect:"<?php echo L('right')?>"}).inputValidator({min:1,onerror:"<?php echo L('title_cannot_empty')?>"}).ajaxValidator({type:"get",url:"",data:"m=announce&c=admin_announce&a=public_check_title",datatype:"html",cached:false,async:'true',success : function(data) {
  54. if( data == "1" )
  55. {
  56. return true;
  57. }
  58. else
  59. {
  60. return false;
  61. }
  62. },
  63. error: function(){alert("<?php echo L('server_no_data')?>");},
  64. onerror : "<?php echo L('announce_exist')?>",
  65. onwait : "<?php echo L('checking')?>"
  66. });
  67. $('#starttime').formValidator({onshow:"<?php echo L('select_stardate')?>",onfocus:"<?php echo L('select_stardate')?>",oncorrect:"<?php echo L('right_all')?>"});
  68. $('#endtime').formValidator({onshow:"<?php echo L('select_downdate')?>",onfocus:"<?php echo L('select_downdate')?>",oncorrect:"<?php echo L('right_all')?>"});
  69. $("#content").formValidator({autotip:true,onshow:"",onfocus:"<?php echo L('announcements_cannot_be_empty')?>"}).functionValidator({
  70. fun:function(val,elem){
  71. //获取编辑器中的内容
  72. var oEditor = CKEDITOR.instances.content;
  73. var data = oEditor.getData();
  74. if(data==''){
  75. return "<?php echo L('announcements_cannot_be_empty')?>"
  76. } else {
  77. return true;
  78. }
  79. }
  80. });
  81. $('#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')?>"});
  82. });
  83. </script>