announce_edit.tpl.php 4.5 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=edit&aid=<?php echo $_GET['aid']?>" name="myform" id="myform">
  7. <table class="table_form" width="100%">
  8. <tbody>
  9. <tr>
  10. <th width="80"><?php echo L('announce_title')?></th>
  11. <td><input name="announce[title]" id="title" value="<?php echo new_html_special_chars($an_info['title'])?>" class="input-text" type="text" size="50" ></td>
  12. </tr>
  13. <tr>
  14. <th><?php echo L('startdate')?>:</th>
  15. <td><?php echo form::date('announce[starttime]', $an_info['starttime'], 1)?></td>
  16. </tr>
  17. <tr>
  18. <th><?php echo L('enddate')?>:</th>
  19. <td><?php $an_info['endtime'] = $an_info['endtime']=='0000-00-00' ? '' : $an_info['endtime']; echo form::date('announce[endtime]', $an_info['endtime'], 1);?></td>
  20. </tr>
  21. <tr>
  22. <th><?php echo L('announce_content')?></th>
  23. <td >
  24. <textarea name="announce[content]" id="content"><?php echo $an_info['content']?></textarea>
  25. <?php echo form::editor('content','basic');?>
  26. </td>
  27. </tr>
  28. <tr>
  29. <th><strong><?php echo L('available_style')?>:</strong></th>
  30. <td><?php echo form::select($template_list, $an_info['style'], 'name="announce[style]" id="style" onchange="load_file_list(this.value)"', L('please_select'))?></td>
  31. </tr>
  32. <tr>
  33. <th><?php echo L('template_select')?>:</th>
  34. <td id="show_template"><?php if ($an_info['style']) echo '<script type="text/javascript">$.getJSON(\'?m=admin&c=category&a=public_tpl_file_list&style='.$an_info['style'].'&id='.$an_info['show_template'].'&module=announce&templates=show&name=announce&pc_hash=\'+pc_hash, function(data){$(\'#show_template\').html(data.show_template);});</script>'?></td>
  35. </tr>
  36. <tr>
  37. <th><?php echo L('announce_status')?></th>
  38. <td><input name="announce[passed]" type="radio" value="1" <?php if($an_info['passed']==1) {?>checked<?php }?>></input>&nbsp;<?php echo L('pass')?>&nbsp;&nbsp;<input name="announce[passed]" type="radio" value="0" <?php if($an_info['passed']==0) {?>checked<?php }?>>&nbsp;<?php echo L('unpass')?></td>
  39. </tr>
  40. </tbody>
  41. </table>
  42. <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')?> ">
  43. </form>
  44. </div>
  45. </body>
  46. </html>
  47. <script type="text/javascript">
  48. function load_file_list(id) {
  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&aid=<?php echo $_GET['aid']?>",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. }).defaultPassed();
  67. $('#starttime').formValidator({onshow:"<?php echo L('select_stardate')?>",onfocus:"<?php echo L('select_stardate')?>",oncorrect:"<?php echo L('right_all')?>"}).defaultPassed();
  68. $('#endtime').formValidator({onshow:"<?php echo L('select_downdate')?>",onfocus:"<?php echo L('select_downdate')?>",oncorrect:"<?php echo L('right_all')?>"}).defaultPassed();
  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. }).defaultPassed();
  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')?>"}).defaultPassed();
  82. });
  83. </script>