adv_form.html 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. {include file="public/header" /}
  2. <div class="page">
  3. <form id="adv_form" enctype="multipart/form-data" method="post" name="advForm">
  4. <table class="ds-default-table">
  5. <tbody>
  6. <tr class="noborder">
  7. <td class="required w120"><label class="validation" for="adv_name">{$Think.lang.adv_name}:</label></td>
  8. <td class="vatop rowform"><input type="text" name="adv_name" id="adv_name" class="txt" value="{$adv.adv_title|default=''}"></td>
  9. <td class="vatop tips"></td>
  10. </tr>
  11. <tr class="noborder">
  12. <td class="required"><label>{$Think.lang.adv_ap_id}:</label></td>
  13. <td class="vatop rowform">
  14. <select name="ap_id" id="ap_id">
  15. {foreach name="ap_list" item="ap" key="ap_k" }
  16. <option value='{$ap.ap_id}' {if condition="$Request.param.ap_id eq $ap.ap_id || $adv.ap_id eq $ap.ap_id"}selected{/if}>{$ap.ap_name}[{$ap.ap_width}X{$ap.ap_height}]</option>
  17. {/foreach}
  18. </select>
  19. </td>
  20. <td class="vatop tips"></td>
  21. </tr>
  22. <tr class="noborder">
  23. <td class="required"><label for="adv_startdate">{$Think.lang.ds_start_time}:</label></td>
  24. <td class="vatop rowform"><input type="text" name="adv_startdate" id="adv_startdate" class="txt date" value="{:date('Y-m-d',$adv.adv_startdate)}"></td>
  25. <td class="vatop tips"></td>
  26. </tr>
  27. <tr class="noborder">
  28. <td class="required"><label for="adv_startdate">{$Think.lang.adv_sort}:</label></td>
  29. <td class="vatop rowform"><input type="text" name="adv_sort" id="adv_sort" class="txt" value="{$adv.adv_sort|default='255'}"></td>
  30. <td class="vatop tips">{$Think.lang.adv_sort_role}</td>
  31. </tr>
  32. <tr class="noborder">
  33. <td class="required"><label for="adv_startdate">{$Think.lang.adv_enabled}:</label></td>
  34. <td class="vatop rowform">
  35. <div class="onoff">
  36. <label for="adv_enabled1" class="cb-enable {if condition="$adv.adv_enabled eq 1"}selected{/if}">{$Think.lang.ds_open}</label>
  37. <label for="adv_enabled0" class="cb-disable {if condition="$adv.adv_enabled eq 0"}selected{/if}">{$Think.lang.ds_close}</label>
  38. <input id="adv_enabled1" name="adv_enabled" value="1" type="radio" {if condition="$adv.adv_enabled eq 1"} checked="checked"{/if}>
  39. <input id="adv_enabled0" name="adv_enabled" value="0" type="radio" {if condition="$adv.adv_enabled eq 0"} checked="checked"{/if}>
  40. </div>
  41. </td>
  42. <td class="vatop tips"></td>
  43. </tr>
  44. <tr class="noborder">
  45. <td class="required"><label for="adv_enddate">{$Think.lang.ds_end_time}:</label></td>
  46. <td class="vatop rowform"><input type="text" name="adv_enddate" id="adv_enddate" class="txt date" value="{:date('Y-m-d',$adv.adv_enddate)}"></td>
  47. <td class="vatop tips"></td>
  48. </tr>
  49. <tr class="noborder" id="adv_code">
  50. <input type="hidden" name="mark" value="0">
  51. <td class="required"><label for="file_adv_code">{$Think.lang.adv_img_upload}:</label></td>
  52. <td class="vatop rowform">
  53. {notempty name="$adv.adv_code"}
  54. <span class="type-file-show"><img class="show_image" src="{$Think.ADMIN_SITE_ROOT}/images/preview.png">
  55. <div class="type-file-preview"><img src="{:ds_get_pic(ATTACH_APPADV,$adv.adv_code)}"></div>
  56. </span>
  57. {/notempty}
  58. <span class="type-file-box">
  59. <input type='text' name='textfield' id='textfield1' class='type-file-text' />
  60. <input type='button' name='button' id='button1' value='上传' class='type-file-button' />
  61. <input name="adv_code" id="file_adv_code" type="file" class="type-file-file" id="site_logo" size="30" hidefocus="true">
  62. </span>
  63. </td>
  64. <td class="vatop tips">{$Think.lang.adv_edit_support}gif,jpg,jpeg,png </td>
  65. </tr>
  66. <tr class="noborder">
  67. <td class="required"><label for="adv_type">{$Think.lang.app_adv_type}:</label></td>
  68. <td class="vatop rowform">
  69. <select name="adv_type" id="adv_type">
  70. <option value="">{$Think.lang.appadv_adv_form_choose_type}</option>
  71. <option value="goods" {if $adv.adv_type=="goods"}selected='selected'{/if}>{$Think.lang.appadv_adv_form_goods}</option>
  72. <option value="store" {if $adv.adv_type=="store"}selected='selected'{/if}>{$Think.lang.appadv_adv_form_store}</option>
  73. <option value="article" {if $adv.adv_type=="article"}selected='selected'{/if}>{$Think.lang.appadv_adv_form_article}</option>
  74. <option value="url" {if $adv.adv_type=="url"}selected='selected'{/if}>{$Think.lang.appadv_adv_form_url}</option>
  75. </select>
  76. </td>
  77. </tr>
  78. <tr class="noborder">
  79. <td class="required"><label for="adv_type">{$Think.lang.app_adv_typedate}:</label></td>
  80. <td class="vatop rowform"><input type="text" name="adv_typedate" class="txt" value="{$adv.adv_typedate|default=''}"></td>
  81. <td class="vatop tips adv_type_desc">{$Think.lang.appadv_adv_form_type}</td>
  82. </tr>
  83. </tbody>
  84. <tfoot>
  85. <tr class="tfoot">
  86. <td colspan="15"><input class="btn" type="submit" value="{$Think.lang.ds_submit}"/></td>
  87. </tr>
  88. </tfoot>
  89. </table>
  90. </form>
  91. </div>
  92. <script type="text/javascript">
  93. $(function(){
  94. $('#adv_startdate').datepicker({dateFormat: 'yy-mm-dd'});
  95. $('#adv_enddate').datepicker({dateFormat: 'yy-mm-dd'});
  96. $('#adv_type').on('change', function() {
  97. change_image_type_desc($(this).val());
  98. });
  99. $("#file_adv_code").change(function () {
  100. $("#textfield1").val($("#file_adv_code").val());
  101. });
  102. function change_image_type_desc(type) {
  103. var desc_array = {};
  104. desc_array['goods'] = '{$Think.lang.appadv_adv_form_goods_type}';
  105. desc_array['store'] = '{$Think.lang.appadv_adv_form_store_type}';
  106. desc_array['article'] = '{$Think.lang.appadv_adv_form_article_type}';
  107. desc_array['url'] = '{$Think.lang.appadv_adv_form_url_type}';
  108. $('.adv_type_desc').text(desc_array[type]);
  109. }
  110. });
  111. </script>
  112. <script>
  113. $(document).ready(function () {
  114. $('#adv_form').validate({
  115. errorPlacement: function (error, element) {
  116. error.appendTo(element.parent().parent().find('td:last'));
  117. },
  118. rules: {
  119. adv_name : {
  120. required: true
  121. },
  122. adv_sort : {
  123. number:true,
  124. range:[0,255]
  125. }
  126. },
  127. messages: {
  128. adv_name : {
  129. required : '{$Think.lang.adv_can_not_null}'
  130. },
  131. adv_sort : {
  132. number:'{$Think.lang.ds_sort_number}',
  133. range:'{$Think.lang.ds_range_0_255}'
  134. }
  135. }
  136. });
  137. });
  138. </script>