activity.add.php 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <?php defined('InShopNC') or exit('Access Invalid!');?>
  2. <div class="page">
  3. <div class="fixed-bar">
  4. <div class="item-title">
  5. <h3><?php echo $lang['activity_index_manage'];?></h3>
  6. <ul class="tab-base">
  7. <li><a href="index.php?act=activity&op=activity"><span><?php echo $lang['nc_manage'];?></span></a></li>
  8. <li><a href="JavaScript:void(0);" class="current"><span><?php echo $lang['nc_new'];?></span></a></li>
  9. </ul>
  10. </div>
  11. </div>
  12. <div class="fixed-empty"></div>
  13. <form id="add_form" method="post" enctype="multipart/form-data">
  14. <input type="hidden" name="form_submit" value="ok" />
  15. <table class="table tb-type2">
  16. <tbody>
  17. <tr class="noborder">
  18. <td colspan="2"><label class="validation" for="activity_title"><?php echo $lang['activity_index_title'];?>:</label></td>
  19. </tr>
  20. <tr class="noborder">
  21. <td class="vatop rowform"><input type="text" id="activity_title" name="activity_title" class="txt"></td>
  22. <td class="vatop tips"><?php //echo $lang['activity_new_title_tip'];?></td>
  23. </tr>
  24. <tr style="display:none;">
  25. <td colspan="2" class="required"><label class="validation" ><?php echo $lang['activity_index_type'];?>:</label></td>
  26. </tr>
  27. <tr class="noborder" style="display:none;">
  28. <td class="vatop rowform"><select name="activity_type">
  29. <option value="1"><?php echo $lang['activity_index_goods'];?></option>
  30. <option value="2"><?php echo $lang['activity_index_group'];?></option>
  31. </optgroup>
  32. </select></td>
  33. <td class="vatop tips"><?php echo $lang['activity_new_type_tip'];?></td>
  34. </tr>
  35. <tr>
  36. <td colspan="2" class="required"><label class="validation" ><?php echo $lang['activity_index_start'];?>:</label></td>
  37. </tr>
  38. <tr class="noborder">
  39. <td class="vatop rowform"><input type="text" id="activity_start_date" name="activity_start_date" class="txt date"/></td>
  40. <td class="vatop tips"></td>
  41. </tr>
  42. <tr>
  43. <td colspan="2" class="required"><label class="validation" ><?php echo $lang['activity_index_end'];?>:</label></td>
  44. </tr>
  45. <tr class="noborder">
  46. <td class="vatop rowform"><input type="text" id="activity_end_date" name="activity_end_date" class="txt date"/></td>
  47. <td class="vatop tips"></td>
  48. </tr>
  49. <tr>
  50. <td colspan="2" class="required"><label class="validation" ><?php echo $lang['activity_index_banner'];?>:</label></td>
  51. </tr>
  52. <tr class="noborder">
  53. <td class="vatop rowform type-file-box">
  54. <input type="file" class="type-file-file" id="activity_banner" name="activity_banner" size="30" hidefocus="true" nc_type="upload_activity_banner" title="<?php echo $lang['activity_index_banner'];?>">
  55. </td>
  56. <td class="vatop tips"><?php echo $lang['activity_new_banner_tip'];?></td>
  57. </tr>
  58. <tr style="display:none;">
  59. <td colspan="2" class="required"><label><?php echo $lang['activity_new_style'];?>:</label></td>
  60. </tr>
  61. <tr class="noborder" style="display:none;">
  62. <td class="vatop rowform"><select id="activity_style" name="activity_style">
  63. <option value="default_style"><?php echo $lang['activity_index_default'];?></option>
  64. </select></td>
  65. <td class="vatop tips"><?php echo $lang['activity_new_style_tip'];?></td>
  66. </tr>
  67. <tr>
  68. <td colspan="2" class="required"><label for="activity_desc"><?php echo $lang['activity_new_desc'];?>:</label></td>
  69. </tr>
  70. <tr class="noborder">
  71. <td class="vatop rowform"><textarea name="activity_desc" id="activity_desc" rows="6" class="tarea"></textarea></td>
  72. <td class="vatop tips">&nbsp;</td>
  73. </tr>
  74. <tr>
  75. <td colspan="2" class="required"><label class="validation" for="activity_sort"><?php echo $lang['nc_sort'];?>:</label></td>
  76. </tr>
  77. <tr class="noborder">
  78. <td class="vatop rowform"><input type="text" id="activity_sort" name="activity_sort" class="txt" value="0"></td>
  79. <td class="vatop tips"><?php echo $lang['activity_new_sort_tip1'];?></td>
  80. </tr>
  81. <tr>
  82. <td colspan="2" class="required"><label for="activity_sort"><?php echo $lang['activity_openstate'];?>:</label></td>
  83. </tr>
  84. <tr class="noborder">
  85. <td class="vatop rowform onoff">
  86. <label for="activity_state1" class="cb-enable selected" ><span><?php echo $lang['activity_openstate_open'];?></span></label>
  87. <label for="activity_state0" class="cb-disable"><span><?php echo $lang['activity_openstate_close'];?></span></label>
  88. <input id="activity_state1" name="activity_state" checked="checked" value="1" type="radio">
  89. <input id="activity_state0" name="activity_state" value="0" type="radio"></td>
  90. <td class="vatop tips"></td>
  91. </tr>
  92. </tbody>
  93. <tfoot>
  94. <tr class="tfoot">
  95. <td colspan="2"><a href="JavaScript:void(0);" class="btn" id="submitBtn"><span><?php echo $lang['nc_submit'];?></span></a></td>
  96. </tr>
  97. </tfoot>
  98. </table>
  99. </form>
  100. </div>
  101. <link type="text/css" rel="stylesheet" href="<?php echo RESOURCE_SITE_URL."/js/jquery-ui/themes/ui-lightness/jquery.ui.css";?>"/>
  102. <script src="<?php echo RESOURCE_SITE_URL."/js/jquery-ui/jquery.ui.js";?>"></script>
  103. <script src="<?php echo RESOURCE_SITE_URL."/js/jquery-ui/i18n/zh-CN.js";?>" charset="utf-8"></script>
  104. <script>
  105. //按钮先执行验证再提交表单
  106. $(function(){$("#submitBtn").click(function(){
  107. if($("#add_form").valid()){
  108. $("#add_form").submit();
  109. }
  110. });
  111. });
  112. $(document).ready(function(){
  113. $("#activity_start_date").datepicker({dateFormat: 'yy-mm-dd'});
  114. $("#activity_end_date").datepicker({dateFormat: 'yy-mm-dd'});
  115. $("#add_form").validate({
  116. errorPlacement: function(error, element){
  117. error.appendTo(element.parent().parent().prev().find('td:first'));
  118. },
  119. rules : {
  120. activity_title: {
  121. required : true
  122. },
  123. activity_start_date: {
  124. required : true,
  125. date : false
  126. },
  127. activity_end_date: {
  128. required : true,
  129. date : false
  130. },
  131. activity_banner: {
  132. required: true,
  133. accept : 'png|jpe?g|gif'
  134. },
  135. activity_sort: {
  136. required : true,
  137. min:0,
  138. max:255
  139. }
  140. },
  141. messages : {
  142. activity_title: {
  143. required : '<?php echo $lang['activity_new_title_null'];?>'
  144. },
  145. activity_start_date: {
  146. required : '<?php echo $lang['activity_new_startdate_null'];?>'
  147. },
  148. activity_end_date: {
  149. required : '<?php echo $lang['activity_new_enddate_null'];?>'
  150. },
  151. activity_banner: {
  152. required : '<?php echo $lang['activity_new_banner_null'];?>',
  153. accept : '<?php echo $lang['activity_new_ing_wrong'];?>'
  154. },
  155. activity_sort: {
  156. required : '<?php echo $lang['activity_new_sort_null'];?>',
  157. min:'<?php echo $lang['activity_new_sort_minerror'];?>',
  158. max:'<?php echo $lang['activity_new_sort_maxerror'];?>'
  159. }
  160. }
  161. });
  162. });
  163. $(function(){
  164. // 模拟活动页面横幅Banner上传input type='file'样式
  165. var textButton="<input type='text' name='textfield' id='textfield1' class='type-file-text' /><input type='button' name='button' id='button1' value='' class='type-file-button' />"
  166. $(textButton).insertBefore("#activity_banner");
  167. $("#activity_banner").change(function(){
  168. $("#textfield1").val($("#activity_banner").val());
  169. });
  170. });
  171. </script>