rec_position.edit.php 16 KB

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