rec_position.add.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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['rec_position'];?></h3>
  6. <ul class="tab-base">
  7. <li><a href="index.php?act=rec_position&op=rec_list"><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><em></em></li>
  9. </ul>
  10. </div>
  11. </div>
  12. <div class="fixed-empty"></div>
  13. <form id="rec_form" enctype="multipart/form-data" method="post" action="index.php?act=rec_position&op=rec_save">
  14. <table class="table tb-type2">
  15. <tbody>
  16. <tr class="noborder">
  17. <td colspan="2" class="required"><label><?php echo $lang['rec_ps_title'];?>:</label></td>
  18. </tr>
  19. <tr class="noborder">
  20. <td class="vatop rowform"><input type="text" name="rtitle" id="rtitle" class="txt"></td>
  21. <td class="vatop tips"><?php echo $lang['rec_ps_title_tips'];?></td>
  22. </tr>
  23. <tr>
  24. <td colspan="2" class="required"><label><?php echo $lang['rec_ps_type'];?>:</label></td>
  25. </tr>
  26. <tr class="noborder">
  27. <td class="vatop rowform"><select name="rec_type" id="rec_type">
  28. <option value="2"><?php echo $lang['rec_ps_pic'];?></option>
  29. <option value="1"><?php echo $lang['rec_ps_txt'];?></option>
  30. </select></td>
  31. <td class="vatop tips"><?php echo $lang['rec_ps_type_tips'];?></td>
  32. </tr>
  33. </tbody>
  34. <tbody id="tr_pic_type" style="display:none">
  35. <tr><td colspan="2" class="required"><?php echo $lang['rec_ps_select_pic'].$lang['nc_colon']?></td></tr>
  36. <tr class="noborder">
  37. <td class="vatop rowform"><ul>
  38. <li>
  39. <label>
  40. <input name="pic_type" id="pic_type_1" type="radio" value="1" checked="checked">
  41. <?php echo $lang['rec_ps_local'];?></label>
  42. </li>
  43. <li>
  44. <label>
  45. <input type="radio" name="pic_type" id="pic_type_2" value="2">
  46. <?php echo $lang['rec_ps_remote'];?></label>
  47. </li>
  48. </ul></td>
  49. <td class="vatop tips"><?php echo $lang['rec_ps_type_tips2'];?></td>
  50. </tr>
  51. </tbody>
  52. </table>
  53. <table id="local_txt" class="table tb-type2" style="display:none">
  54. <thead class="thead">
  55. <tr class="space">
  56. <th colspan="10"><label class="validation"><?php echo $lang['rec_ps_ztxt'];?>:</label></th>
  57. </tr>
  58. <tr class="noborder">
  59. <th><?php echo $lang['rec_ps_ztxt'];?></th>
  60. <th><?php echo $lang['rec_ps_gourl'];?></th>
  61. <th></th>
  62. <th class="align-center"><?php echo $lang['nc_handle'];?></th>
  63. </tr>
  64. </thead>
  65. <tbody id="RemoteBoxTxt">
  66. <tr>
  67. <td class="name w270"><input type="text" value="" name="txt[]" hidefocus="true"></td>
  68. <td class="name w270"><input type="text" value="http://" name="urltxt[]"></td>
  69. <td></td>
  70. <td class="w150 align-center"></td>
  71. </tr>
  72. <tr>
  73. <td colspan="4"><a id="addRemoteTxt" class="btn-add marginleft" href="javascript:void(0);"><span><?php echo $lang['rec_ps_addjx'];?></span></a></td>
  74. </tr>
  75. </tbody>
  76. </table>
  77. <table id="local_pic" class="table tb-type2" style="display:none">
  78. <thead class="thead">
  79. <tr class="space">
  80. <th colspan="10"><label class="validation"><?php echo $lang['rec_ps_selfile'];?>:</label></th>
  81. </tr>
  82. <tr class="noborder">
  83. <th><?php echo $lang['rec_ps_selfile_local'];?></th>
  84. <th><?php echo $lang['rec_ps_gourl'];?></th>
  85. <th></th>
  86. <th class="align-center"><?php echo $lang['nc_handle'];?></th>
  87. </tr>
  88. </thead>
  89. <tbody id="UpFileBox">
  90. <tr>
  91. <td class="vatop rowform w270"><span class="type-file-box">
  92. <input type="text" name="textfield" class="type-file-text" />
  93. <input type="button" name="button" value="" class="type-file-button" />
  94. <input class="type-file-file" type="file" title="" nc_type="change_default_goods_image" hidefocus="true" size="30" name="pic[]">
  95. </span></td>
  96. <td class="name w270"><input type="text" value="http://" name="urlup[]"></td>
  97. <td></td>
  98. <td class="w150 align-center"></td>
  99. </tr>
  100. <tr>
  101. <td colspan="4"><a id="addUpFile" class="btn-add marginleft" href="javascript:void(0);"><span><?php echo $lang['rec_ps_addjx'];?></span></a></td>
  102. </tr>
  103. </tbody>
  104. </table>
  105. <table id="remote_pic" class="table tb-type2" style="display:none">
  106. <thead class="thead">
  107. <tr class="space">
  108. <th colspan="10"><label class="validation"><?php echo $lang['rec_ps_add_remote'];?>:</label></th>
  109. </tr>
  110. <tr class="noborder">
  111. <th><?php echo $lang['rec_ps_remote_url'];?></th>
  112. <th><?php echo $lang['rec_ps_gourl'];?></th>
  113. <th></th>
  114. <th class="align-center"><?php echo $lang['nc_handle'];?></th>
  115. </tr>
  116. </thead>
  117. <tbody id="RemoteBox">
  118. <tr>
  119. <td class="name w270"><input type="text" value="http://" name="pic[]" hidefocus="true"></td>
  120. <td class="name w270"><input type="text" value="http://" name="urlremote[]"></td>
  121. <td></td>
  122. <td class="w150 align-center"></td>
  123. </tr>
  124. <tr>
  125. <td colspan="4"><a id="addRemote" class="btn-add marginleft" href="javascript:void(0);"><span><?php echo $lang['rec_ps_addjx'];?></span></a></td>
  126. </tr>
  127. </tbody>
  128. </table>
  129. <table class="table tb-type2" id="rec_width">
  130. <tbody>
  131. <tr>
  132. <td colspan="2" class="required"><label><?php echo $lang['rec_ps_kcg'];?>:</label></td>
  133. </tr>
  134. <tr class="noborder">
  135. <td class="vatop rowform"><?php echo $lang['rec_ps_image_width'];?>:
  136. <input type="text" class="txt" value="" style="width:30px" name="rwidth">
  137. px&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $lang['rec_ps_image_height'];?>:
  138. <input type="text" class="txt" value="" style="width:30px" name="rheight">
  139. px</td>
  140. <td class="vatop tips"><?php echo $lang['rec_ps_kcg_tips'];?></td>
  141. </tr>
  142. <tr>
  143. <td colspan="2" class="required"><label><?php echo $lang['rec_ps_target'];?>:</label></td>
  144. </tr>
  145. </tbody>
  146. </table>
  147. <table class="table tb-type2" >
  148. <tbody>
  149. <tr>
  150. <td class="vatop rowform"><ul>
  151. <li>
  152. <label>
  153. <input name="rtarget" type="radio" value="1" checked="checked">
  154. <?php echo $lang['rec_ps_tg1'];?></label>
  155. </li>
  156. <li>
  157. <label>
  158. <input type="radio" name="rtarget" value="2">
  159. <?php echo $lang['rec_ps_tg2'];?></label>
  160. </li>
  161. </ul></td>
  162. <td class="vatop tips"></td>
  163. </tr>
  164. </tbody>
  165. <tfoot>
  166. <tr class="tfoot">
  167. <td colspan="15" ><a href="JavaScript:void(0);" class="btn" id="submitBtn"><span><?php echo $lang['nc_submit'];?></span></a></td>
  168. </tr>
  169. </tfoot>
  170. </table>
  171. </form>
  172. </div>
  173. <script type="text/javascript">
  174. //按钮先执行验证再提交表单
  175. $(function(){
  176. function _check(){
  177. if ($('#rec_type').val() == 1){
  178. flag = false;
  179. $('input[name="txt[]"]').each(function(){
  180. if ($(this).val() != '') flag = true;
  181. });
  182. if (flag == false){
  183. alert('<?php echo $lang['rec_ps_error_ztxt'];?>');return false;
  184. }else{
  185. flag = false;
  186. }
  187. }else{
  188. if ($('#pic_type_1').attr('checked')){
  189. flag = false;
  190. $('#UpFileBox').find('input[name="pic[]"]').each(function(){
  191. if ($(this).val() != '') flag = true;
  192. });
  193. if (flag == false){
  194. alert('<?php echo $lang['rec_ps_error_pics'];?>');return false;
  195. }else{
  196. flag = false;
  197. }
  198. }else{
  199. flag = false;
  200. $('#RemoteBox').find('input[name="pic[]"]').each(function(){
  201. if ($(this).val() != '' && $(this).val() != 'http://') flag = true;
  202. });
  203. if (flag == false){
  204. alert('<?php echo $lang['rec_ps_error_picy'];?>');return false;
  205. }else{
  206. flag = false;
  207. }
  208. }
  209. }
  210. return true;
  211. }
  212. $("#submitBtn").click(function(){
  213. if(_check()){
  214. $("#rec_form").submit();
  215. }
  216. });
  217. $("#addUpFile").live('click',function(){
  218. if ($('#UpFileBox').find('input[name="pic[]"]').size() >= 5){
  219. alert('<?php echo $lang['rec_ps_error_jz'];?>');return;
  220. }
  221. $(this).parent().parent().remove();
  222. $('#UpFileBox').append("<tr><td class=\"vatop rowform w270\"><span class=\"type-file-box\"><input type=\"text\" name=\"textfield\" class=\"type-file-text\" /><input type=\"button\" name=\"button\" value=\"\" class=\"type-file-button\" /><input class=\"type-file-file\" type=\"file\" title=\"\" nc_type=\"change_default_goods_image\" hidefocus=\"true\" size=\"30\" name=\"pic[]\"></span></td><td class=\"name w270\"><input type=\"text\" value=\"http://\" name=\"urlup[]\"></td><td></td><td class=\"w150 align-center\"><a id=\"delUpFile\" href=\"javascript:void(0);\"><?php echo $lang['nc_del'];?></a></td></tr><tr><td colspan=\"4\"><a id=\"addUpFile\" class=\"btn-add marginleft\" href=\"javascript:void(0);\"><span><?php echo $lang['rec_ps_addjx'];?></span></a></td></tr>");
  223. });
  224. $("#addRemote").live('click',function(){
  225. if ($('#RemoteBox').find('input[name="pic[]"]').size() >= 5){
  226. alert('<?php echo $lang['rec_ps_error_jz'];?>');return;
  227. }
  228. $(this).parent().parent().remove();
  229. $('#RemoteBox').append("<tr><td class=\"name w270\"><input type=\"text\" value=\"http://\" name=\"pic[]\" hidefocus=\"true\"></td><td class=\"name w270\"><input type=\"text\" value=\"http://\" name=\"urlremote[]\"></td><td></td><td class=\"w150 align-center\"><a id=\"delUpFile\" href=\"javascript:void(0);\"><?php echo $lang['nc_del'];?></a></td></tr><tr><td colspan=\"4\"><a id=\"addRemote\" class=\"btn-add marginleft\" href=\"javascript:void(0);\"><span><?php echo $lang['rec_ps_addjx'];?></span></a></td></tr>");
  230. });
  231. $("#addRemoteTxt").live('click',function(){
  232. if ($('#RemoteBoxTxt').find('input[name="txt[]"]').size() >= 5){
  233. alert('<?php echo $lang['rec_ps_error_jz'];?>');return;
  234. }
  235. $(this).parent().parent().remove();
  236. $('#RemoteBoxTxt').append("<tr><td class=\"name w270\"><input type=\"text\" value=\"\" name=\"txt[]\" hidefocus=\"true\"></td><td class=\"name w270\"><input type=\"text\" value=\"http://\" name=\"urltxt[]\"></td><td></td><td class=\"w150 align-center\"><a id=\"delUpFile\" href=\"javascript:void(0);\"><?php echo $lang['nc_del'];?></a></td></tr><tr><td colspan=\"4\"><a id=\"addRemoteTxt\" class=\"btn-add marginleft\" href=\"javascript:void(0);\"><span><?php echo $lang['rec_ps_addjx'];?><span></a></td></tr>");
  237. });
  238. $('#delUpFile').live('click',function(){
  239. $(this).parent().parent().remove();$(this).remove();
  240. });
  241. $('input[name="pic_type"]').live('click',function(){
  242. if($(this).val() == 1) {
  243. $('#local_pic').show();$('#remote_pic').hide();
  244. }else{
  245. $('#local_pic').hide();$('#remote_pic').show();
  246. }
  247. });
  248. $('#rec_type').change(function(){
  249. if ($(this).val() == 1){
  250. $('#local_txt').show();$('#tr_pic_type').hide();$('#local_pic').hide();$('#remote_pic').hide();$('#rec_width').hide();
  251. }else{
  252. $('#local_txt').hide();$('#tr_pic_type').show();$('#local_pic').show();$('#pic_type_1').attr('checked',true);$('#rec_width').show();
  253. }
  254. });
  255. $('#local_pic').show();
  256. $('#tr_pic_type').show();
  257. });
  258. </script>
  259. <script type="text/javascript">
  260. $(function(){
  261. $('input[nc_type="change_default_goods_image"]').live("change", function(){
  262. $(this).parent().find('input[class="type-file-text"]').val($(this).val());
  263. });
  264. });
  265. </script>