space_edit.tpl.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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=edit&spaceid=<?php echo $_GET['spaceid']?>" 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]" class="input-text" id="name" type="text" value="<?php echo new_html_special_chars($info['name'])?>" size="25"></td>
  11. </tr>
  12. <tr>
  13. <th><strong><?php echo L('ads_type')?>:</strong></th>
  14. <td><?php echo form::select($TYPES, $info['type'], '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]"<?php if($setting['scroll']) {?> checked<?php }?> value='1'/> <?php echo L('rolling')?></label></span>
  15. <span id="AlignSpan" style="padding-left:30px;display:none;"><label><input type="checkbox" <?php if($setting['align']) {?> checked<?php }?> 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='<?php echo $setting['paddleft']?>' class="input-text"> px&nbsp;&nbsp;
  21. <?php echo L('top_margin')?>:<input name='setting[paddtop]' id='PaddingTop' type='text' size='5' value='<?php echo $setting['paddtop']?>' class="input-text" /> px</div>
  22. </td>
  23. </tr>
  24. <tr id="SizeFormat">
  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" value="<?php echo $info['width']?>" size="10"> px &nbsp;&nbsp;&nbsp;&nbsp; <label><?php echo L('plate_height')?></label><input name="space[height]" id="h_height" type="text" class="input-text" value="<?php echo $info['height']?>" size="10"> px<div id="w_hTip"></div></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"><?php echo $info['description']?></textarea></td>
  31. </tr></tbody>
  32. </table>
  33. <div class="bk15"></div>
  34. <input type="hidden" name="old_type" value="<?php echo $info['type']?>">
  35. <input type="submit" name="dosubmit" id="dosubmit" class='dialog' value="2"/></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 ($setting['align']) {
  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 ($setting['scroll']) {
  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. AdsType($('#type').val());
  93. $(document).ready(function(){
  94. $.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();})}});
  95. $("#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) {
  96. if( data == "1" )
  97. {
  98. return true;
  99. }
  100. else
  101. {
  102. return false;
  103. }
  104. },
  105. error: function(){alert("<?php echo L('server_busy')?>");},
  106. onerror : "<?php echo L('space_exist')?>",
  107. onwait : "<?php echo L('checking')?>"
  108. }).defaultPassed();
  109. $('#type').formValidator({onshow:"<?php echo L('choose_space_type')?>",onfocus:"<?php echo L('choose_space_type')?>",oncorrect:"<?php echo L('correct')?>"}).inputValidator();
  110. $('#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().defaultPassed();
  111. })
  112. </script>