space_add.tpl.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. defined('IN_ADMIN') or exit('No permission resources.');
  3. include $this->admin_tpl('header', 'admin');
  4. ?>
  5. <form method="post" action="?m=poster&c=space&a=add" name="myform" id="myform">
  6. <table class="table_form" width="100%" cellspacing="0">
  7. <tbody>
  8. <tr>
  9. <th width="80"><strong><?php echo L('boardtype')?>:</strong></th>
  10. <td><input name="space[name]" id="name" class="input-text" type="text" size="25"></td>
  11. </tr>
  12. <tr>
  13. <th><strong><?php echo L('ads_type')?>:</strong></th>
  14. <td><?php echo form::select($TYPES, '', 'name="space[type]" id="type" onchange="AdsType(this.value)"')?>&nbsp;&nbsp;<span id="ScrollSpan" style="padding-left:30px;display:none;"><label><input type="checkbox" id="ScrollBox" name="setting[scroll]" value='1'/><?php echo L('rolling')?></label></span>
  15. <span id="AlignSpan" style="padding-left:30px;display:none;"><label><input type="checkbox" id="AlignBox" name="setting[align]" value='1'/><?php echo L('lightbox')?></label></span></td>
  16. </tr>
  17. <tr id="trPosition" style="display:none;">
  18. <th align="right" valign="top"><strong><?php echo L('position')?>:</strong></th>
  19. <td valign="top" colspan="2">
  20. <?php echo L('left_margin')?>:<input name='setting[paddleft]' id='PaddingLeft' type='text' size='5' value=''class="input-text"> px&nbsp;&nbsp;
  21. <?php echo L('top_margin')?>:<input name='setting[paddtop]' id='PaddingTop' type='text' size='5' value='' class="input-text" /> px
  22. </td>
  23. </tr>
  24. <tr id="SizeFormat" style="display: ;">
  25. <th><strong><?php echo L('size_format')?>:</strong></th>
  26. <td><label><?php echo L('plate_width')?></label><input name="space[width]" id="s_width" class="input-text" type="text" size="10"> px &nbsp;&nbsp;&nbsp;&nbsp; <label><?php echo L('plate_height')?></label><input name="space[height]" type="text" id="h_height" class="input-text" size="10"> px</td>
  27. </tr>
  28. <tr>
  29. <th><strong><?php echo L('description')?>:</strong></th>
  30. <td><textarea name="space[description]" id="description" class="input-textarea" cols="45" rows="4"></textarea></td>
  31. </tr></tbody>
  32. </table>
  33. <div class="bk15"></div>
  34. <input type="submit" name="dosubmit" id="dosubmit" value=" <?php echo L('ok')?> " class='dialog'>&nbsp;<input type="reset" value=" <?php echo L('clear')?> " class='dialog'>
  35. </form>
  36. </body>
  37. </html>
  38. <script language="javascript" type="text/javascript">
  39. function AdsType(adstype) {
  40. $('input[type=checkbox]').attr('checked', false);
  41. $('#ScrollSpan').css('display', 'none');
  42. $('#AlignSpan').css('display', 'none');
  43. $('#trPosition').css('display', 'none');
  44. $('#SizeFormat').css('display', '');
  45. $('#PaddingLeft').attr('disabled', false);
  46. $('#PaddingTop').attr('disabled', false);
  47. <?php
  48. if (is_array($poster_template) && !empty($poster_template)) {
  49. $n = 0;
  50. foreach ($poster_template as $key => $p) {
  51. if ($n==0) {
  52. echo 'if (adstype==\''.$key.'\') {';
  53. } else {
  54. echo '} else if (adstype==\''.$key.'\') {';
  55. }
  56. if ($p['align']) {
  57. if ($p['align']=='align') {
  58. echo '$(\'#AlignSpan\').css(\'display\', \'\');';
  59. if ($p['select']) {
  60. echo '$(\'#AlignBox\').attr(\'checked\', \'true\');';
  61. echo '$(\'#PaddingLeft\').attr(\'disabled\', true);';
  62. echo '$(\'#PaddingTop\').attr(\'disabled\', true);';
  63. }
  64. } elseif ($p['align']=='scroll') {
  65. echo '$(\'#ScrollSpan\').css(\'display\', \'\');';
  66. if ($p['select']) {
  67. echo '$(\'#ScrollBox\').attr(\'checked\', \'true\');';
  68. }
  69. }
  70. }
  71. if ($p['padding']) {
  72. echo '$(\'#trPosition\').css(\'display\', \'\');';
  73. }
  74. if (!isset($p['size']) || !$p['size']) {
  75. echo '$(\'#SizeFormat\').css(\'display\', \'none\');';
  76. }
  77. $n++;
  78. }
  79. }
  80. echo '}';
  81. ?>
  82. }
  83. $('#AlignBox').click( function (){
  84. if($('#AlignBox').attr('checked')) {
  85. $('#PaddingLeft').attr('disabled', true);
  86. $('#PaddingTop').attr('disabled', true);
  87. } else {
  88. $('#PaddingLeft').attr('disabled', false);
  89. $('#PaddingTop').attr('disabled', false);
  90. }
  91. });
  92. $(document).ready(function(){
  93. $.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();})}});
  94. $("#name").formValidator({onshow:"<?php echo L('please_input_space_name')?>",onfocus:"<?php echo L('spacename_three_length')?>",oncorrect:"<?php echo L('correct')?>"}).inputValidator({min:6,onerror:"<?php echo L('spacename_illegality')?>"}).ajaxValidator({type:"get",url:"",data:"m=poster&c=space&a=public_check_space&spaceid=<?php echo $_GET['spaceid']?>",datatype:"html",cached:false,async:'true',success : function(data) {
  95. if( data == "1" )
  96. {
  97. return true;
  98. }
  99. else
  100. {
  101. return false;
  102. }
  103. },
  104. error: function(){alert("<?php echo L('server_busy')?>");},
  105. onerror : "<?php echo L('space_exist')?>",
  106. onwait : "<?php echo L('checking')?>"
  107. });
  108. $('#type').formValidator({onshow:"<?php echo L('choose_space_type')?>",onfocus:"<?php echo L('choose_space_type')?>",oncorrect:"<?php echo L('correct')?>"}).inputValidator();
  109. $('#s_width').formValidator({tipid:"w_hTip",onshow:"<?php echo L('input_width_height')?>",onfocus:"<?php echo L('three_numeric')?>",oncorrect:"<?php echo L('correct')?>"}).inputValidator();
  110. $('#s_width').formValidator({tipid:"w_hTip",onshow:"<?php echo L('choose_space_type')?>",onfocus:"<?php echo L('choose_space_type')?>",oncorrect:"<?php echo L('correct')?>"}).inputValidator();
  111. })
  112. </script>