form.html 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. {include file="public/header" /}
  2. <div class="page">
  3. <form id="add_form" method="post" enctype="multipart/form-data">
  4. <table class="ds-default-table">
  5. <tbody>
  6. <tr class="noborder">
  7. <td class="required w120"><label class="validation" for="activity_title">{$Think.lang.activity_index_title}:</label></td>
  8. <td class="vatop rowform"><input type="text" id="activity_title" name="activity_title" class="txt" value="{$activity.activity_title|default=''}"></td>
  9. <td class="vatop tips"></td>
  10. </tr>
  11. <td class="required" style="display:none;"><label for="activity_type">{$Think.lang.activity_index_type}:</label></td>
  12. <tr class="noborder" style="display:none;">
  13. <td class="vatop rowform">
  14. <select name="activity_type" id="activity_type">
  15. <option value="1" {eq name="activity.activity_type" value="1" }selected{/eq}>{$Think.lang.activity_index_goods}</option>
  16. <option value="2" {eq name="activity.activity_type" value="2" }selected{/eq}>{$Think.lang.activity_index_group}</option>
  17. </select>
  18. </td>
  19. <td class="vatop tips">{$Think.lang.activity_new_type_tip}</td>
  20. </tr>
  21. <tr class="noborder">
  22. <td class="required"><label class="validation" for="activity_startdate">{$Think.lang.ds_start_time}:</label></td>
  23. <td class="vatop rowform"><input type="text" id="activity_startdate" class="txt date" name="activity_startdate" value="{$activity.activity_startdate|date='Y-m-d'}"/></td>
  24. <td class="vatop tips"></td>
  25. </tr>
  26. <tr class="noborder">
  27. <td class="required"><label class="validation" for="activity_enddate">{$Think.lang.ds_end_time}:</label></td>
  28. <td class="vatop rowform"><input type="text" id="activity_enddate" class="txt date" name="activity_enddate" value="{$activity.activity_enddate|date='Y-m-d'}"/></td>
  29. <td class="vatop tips"></td>
  30. </tr>
  31. <tr class="noborder">
  32. <td class="required"><label class="validation" for="activity_banner">{$Think.lang.activity_index_banner}:</label></td>
  33. <td class="vatop rowform">
  34. {notempty name="$activity.activity_banner"}
  35. <span class="type-file-show">
  36. <img class="show_image" src="{$Think.ADMIN_SITE_ROOT}/images/preview.png"/>
  37. <div class="type-file-preview"><img src="{:ds_get_pic(ATTACH_ACTIVITY,$activity.activity_banner)}" onload="javascript:ResizeImage(this,500,500);"></div>
  38. </span>
  39. {/notempty}
  40. <span class="type-file-box">
  41. <input name="activity_banner" type="file" class="type-file-file" id="activity_banner" size="30" hidefocus="true">
  42. <input type='text' name='textfield' id='textfield1' class='type-file-text' />
  43. <input type='button' name='button' id='button1' value='上传' class='type-file-button' />
  44. </span>
  45. </td>
  46. <td class="vatop tips">{$Think.lang.activity_new_banner_tip}</td>
  47. </tr>
  48. <tr class="noborder">
  49. <td class="required"><label class="validation" for="activity_banner_mobile">{$Think.lang.activity_index_banner_mobile}:</label></td>
  50. <td class="vatop rowform">
  51. {notempty name="$activity.activity_banner_mobile"}
  52. <span class="type-file-show">
  53. <img class="show_image" src="{$Think.ADMIN_SITE_ROOT}/images/preview.png"/>
  54. <div class="type-file-preview"><img src="{:ds_get_pic(ATTACH_ACTIVITY,$activity.activity_banner_mobile)}" onload="javascript:ResizeImage(this,500,500);"></div>
  55. </span>
  56. {/notempty}
  57. <span class="type-file-box">
  58. <input name="activity_banner_mobile" type="file" class="type-file-file" id="activity_banner_mobile" size="30" hidefocus="true">
  59. <input type='text' name='textfield' id='textfield2' class='type-file-text' />
  60. <input type='button' name='button' id='button1' value='上传' class='type-file-button' />
  61. </span>
  62. </td>
  63. <td class="vatop tips">{$Think.lang.activity_new_banner_mobile_tip}</td>
  64. </tr>
  65. <tr class="noborder">
  66. <td class="required"><label for="activity_desc">{$Think.lang.activity_new_desc}:</label></td>
  67. <td class="vatop rowform"><textarea name="activity_desc" rows="6" class="tarea" id="activity_desc">{:nl2br($activity.activity_desc)}</textarea></td>
  68. <td class="vatop tips"></td>
  69. </tr>
  70. <tr class="noborder">
  71. <td class="required"><label class="validation" for="activity_sort">{$Think.lang.ds_sort}:</label></td>
  72. <td class="vatop rowform">
  73. <input type="text" id="activity_sort" name="activity_sort" class="txt" value="{$activity.activity_sort|default=0}">
  74. </td>
  75. <td class="vatop tips">{$Think.lang.activity_new_sort_tip1}</td>
  76. </tr>
  77. <tr class="noborder">
  78. <td class="required"><label for="activity_sort">{$Think.lang.activity_openstate}:</label></td>
  79. <td class="vatop rowform onoff">
  80. <label for="activity_state1" class="cb-enable {eq name='activity.activity_state' value='1'}selected{/eq}"><span>{$Think.lang.activity_openstate_open}</span></label>
  81. <label for="activity_state0" class="cb-disable {eq name='activity.activity_state' value='0'}selected{/eq}"><span>{$Think.lang.activity_openstate_close}</span></label>
  82. <input id="activity_state1" name="activity_state" checked="checked" value="1" type="radio">
  83. <input id="activity_state0" name="activity_state" value="0" type="radio">
  84. </td>
  85. <td class="vatop tips"></td>
  86. </tr>
  87. </tbody>
  88. <tfoot>
  89. <tr class="tfoot">
  90. <td colspan="2"><input class="btn" type="submit" value="{$Think.lang.ds_submit}"/></td>
  91. </tr>
  92. </tfoot>
  93. </table>
  94. </form>
  95. </div>
  96. <script>
  97. $(document).ready(function () {
  98. $("#activity_startdate").datepicker({dateFormat: 'yy-mm-dd'});
  99. $("#activity_enddate").datepicker({dateFormat: 'yy-mm-dd'});
  100. $("#add_form").validate({
  101. errorPlacement: function (error, element) {
  102. error.appendTo(element.parent().parent().find('td:last'));
  103. },
  104. rules: {
  105. activity_title: {
  106. required: true
  107. },
  108. activity_startdate: {
  109. required: true,
  110. date: false
  111. },
  112. activity_enddate: {
  113. required: true,
  114. date: false
  115. },
  116. activity_sort: {
  117. required: true,
  118. min: 0,
  119. max: 255
  120. }
  121. },
  122. messages: {
  123. activity_title: {
  124. required: '{$Think.lang.activity_new_title_null}'
  125. },
  126. activity_startdate: {
  127. required: '{$Think.lang.activity_new_startdate_null}'
  128. },
  129. activity_enddate: {
  130. required: '{$Think.lang.activity_new_enddate_null}'
  131. },
  132. activity_sort: {
  133. required: '{$Think.lang.activity_new_sort_null}',
  134. min: '{$Think.lang.activity_new_sort_minerror}',
  135. max: '{$Think.lang.activity_new_sort_maxerror}'
  136. }
  137. }
  138. });
  139. });
  140. $(function () {
  141. $("#activity_banner").change(function () {
  142. $("#textfield1").val($("#activity_banner").val());
  143. });
  144. $("#activity_banner_mobile").change(function () {
  145. $("#textfield2").val($("#activity_banner_mobile").val());
  146. });
  147. });
  148. </script>