circle.edit.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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['nc_circle_manage'];?></h3>
  6. <ul class="tab-base">
  7. <li><a href="index.php?act=circle_manage&op=circle_list"><span><?php echo $lang['nc_manage'];?></span></a></li>
  8. <li><a href="index.php?act=circle_manage&op=circle_verify"><span><?php echo $lang['circle_wait_verify'];?></span></a></li>
  9. <li><a href="index.php?act=circle_manage&op=circle_add"><span><?php echo $lang['nc_new'];?></span></a></li>
  10. <li><a href="JavaScript:void(0);" class="current"><span><?php echo $lang['nc_edit'];?></span></a></li>
  11. </ul>
  12. </div>
  13. </div>
  14. <div class="fixed-empty"></div>
  15. <form id="circle_form" method="post">
  16. <input type="hidden" name="form_submit" value="ok" />
  17. <input type="hidden" name="c_id" value="<?php echo $output['circle_info']['circle_id'];?>" />
  18. <input type="hidden" name="c_oldimg" value="<?php echo $output['circle_info']['circle_img'];?>" />
  19. <table class="table tb-type2">
  20. <tbody>
  21. <tr class="noborder">
  22. <td colspan="2" class="required"><label class="validation" for="c_name"><?php echo $lang['circle_name'];?>:</label></td>
  23. </tr>
  24. <tr class="noborder">
  25. <td class="vatop rowform"><input type="text" name="c_name" id="c_name" class="txt" value="<?php echo $output['circle_info']['circle_name'];?>" /></td>
  26. <td class="vatop tips"><?php echo $lang['circle_name_tips'];?></td>
  27. </tr>
  28. <tr>
  29. <td colspan="2" class="required"><label class="validation" for="mastername"><?php echo $lang['circle_member_identity_master'];?>:</label></td>
  30. </tr>
  31. <tr class="noborder">
  32. <td class="vatop rowform">
  33. <input type="text" name="mastername" id="mastername" class="txt" readonly="readonly" value="<?php echo $output['circle_info']['circle_mastername'];?>" />
  34. <input type="hidden" name="masterid" id="masterid" value="<?php echo $output['circle_info']['circle_masterid'];?>" />
  35. </td>
  36. <td class="vatop tips"></td>
  37. </tr>
  38. <tr>
  39. <td colspan="2" class="required"><label class="" for="classid"><?php echo $lang['circle_class'];?>:</label></td>
  40. </tr>
  41. <tr class="noborder">
  42. <td class="vatop rowform">
  43. <select name="classid">
  44. <option value="0"><?php echo $lang['nc_common_pselect'];?></option>
  45. <?php if(!empty($output['class_list'])){?>
  46. <?php foreach ($output['class_list'] as $val){?>
  47. <option value="<?php echo $val['class_id'];?>" <?php if($output['circle_info']['class_id'] == $val['class_id']){echo 'selected="selected"';}?>><?php echo $val['class_name'];?></option>
  48. <?php }?>
  49. <?php }?>
  50. </select>
  51. </td>
  52. <td class="vatop tips"></td>
  53. </tr>
  54. <tr>
  55. <td colspan="2" class="required"><label for="c_desc"><?php echo $lang['circle_desc'];?>:</label></td>
  56. </tr>
  57. <tr class="noborder">
  58. <td class="vatop rowform">
  59. <textarea class="tarea" rows="6" name="c_desc" id="c_desc"><?php echo $output['circle_info']['circle_desc'];?></textarea>
  60. </td>
  61. <td class="vatop tips"><?php echo $lang['circle_desc_tips'];?></td>
  62. </tr>
  63. <tr>
  64. <td colspan="2" class="required"><label for="c_tag"><?php echo $lang['circle_tag'];?>:</label></td>
  65. </tr>
  66. <tr class="noborder">
  67. <td class="vatop rowform">
  68. <input type="text" name="c_tag" class="txt" value="<?php echo $output['circle_info']['circle_tag'];?>" />
  69. </td>
  70. <td class="vatop tips"><?php echo $lang['circle_tag_tips'];?></td>
  71. </tr>
  72. <tr>
  73. <td colspan="2" class="required"><label for="c_notice"><?php echo $lang['circle_notice'];?>:</label></td>
  74. </tr>
  75. <tr class="noborder">
  76. <td class="vatop rowform">
  77. <textarea class="tarea" rows="6" name="c_notice" id="c_notice"><?php echo $output['circle_info']['circle_notice'];?></textarea>
  78. </td>
  79. <td class="vatop tips"><?php echo $lang['circle_notice_tips'];?></td>
  80. </tr>
  81. <tr>
  82. <td colspan="2" class="required"><label><?php echo $lang['circle_image'];?>:</label></td>
  83. </tr>
  84. <tr class="noborder">
  85. <td class="vatop rowform">
  86. <span class="type-file-show">
  87. <img class="show_image" src="<?php echo ADMIN_TEMPLATES_URL;?>/images/preview.png">
  88. <div class="type-file-preview" style="display: none;"><img id="view_img" src="<?php echo circleLogo($output['circle_info']['circle_id']);?>?<?php echo microtime();?>"></div>
  89. </span>
  90. <span class="type-file-box">
  91. <input type='text' name='c_img' id='c_img' class='type-file-text' />
  92. <input type='button' name='button' id='button' value='' class='type-file-button' />
  93. <input name="_pic" type="file" class="type-file-file" id="_pic" size="30" hidefocus="true" />
  94. </span>
  95. </td>
  96. <td class="vatop tips"></td>
  97. </tr>
  98. <tr>
  99. <td colspan="2" class="required"><label for="c_status"><?php echo $lang['circle_ststus']?>:</label></td>
  100. </tr>
  101. <tr class="noborder">
  102. <td class="vatop rowform">
  103. <label><input type="radio" name="c_status" <?php if($output['circle_info']['circle_status'] == 0){ echo 'checked="checked"';}?> value="0" /><?php echo $lang['nc_close'];?></label>
  104. <label><input type="radio" name="c_status" <?php if($output['circle_info']['circle_status'] == 1){ echo 'checked="checked"';}?> value="1" /><?php echo $lang['nc_open'];?></label>
  105. <label><input type="radio" name="c_status" <?php if($output['circle_info']['circle_status'] == 2){ echo 'checked="checked"';}?> value="2" /><?php echo $lang['circle_verifying'];?></label>
  106. <label><input type="radio" name="c_status" <?php if($output['circle_info']['circle_status'] == 3){ echo 'checked="checked"';}?> value="3" /><?php echo $lang['circle_verify_fail'];?></label>
  107. </td>
  108. <td class="vatop tips"></td>
  109. </tr>
  110. </tbody>
  111. <tbody id="circle_statusinfo" <?php if($output['circle_info']['circle_status'] == 1 || $output['circle_info']['circle_status'] == 2){ echo 'style="display:none;"';}?>>
  112. <tr>
  113. <td colspan="2" class="required"><label for="c_statusinfo"><?php echo $lang['circle_verify_fail_reason'];?></label></td>
  114. </tr>
  115. <tr class="noborder">
  116. <td class="vatop rowform">
  117. <textarea class="tarea" rows="6" name="c_statusinfo" id="c_statusinfo"><?php echo $output['circle_info']['circle_statusinfo'];?></textarea>
  118. </td>
  119. <td class="vatop tips"></td>
  120. </tr>
  121. </tbody>
  122. <tbody>
  123. <tr>
  124. <td colspan="2" class="required"><label for="c_recommend"><?php echo $lang['circle_is_recommend'];?>:</label></td>
  125. </tr>
  126. <tr class="noborder">
  127. <td class="vatop rowform onoff">
  128. <label for="c_recommend1" class="cb-enable <?php if($output['circle_info']['is_recommend'] == 1) echo 'selected';?>" ><span><?php echo $lang['nc_yes'];?></span></label>
  129. <label for="c_recommend0" class="cb-disable <?php if($output['circle_info']['is_recommend'] == 0) echo 'selected';?>" ><span><?php echo $lang['nc_no'];?></span></label>
  130. <input id="c_recommend1" name="c_recommend" <?php if($output['circle_info']['is_recommend'] == 1) echo 'checked="checked"';?> value="1" type="radio">
  131. <input id="c_recommend0" name="c_recommend" <?php if($output['circle_info']['is_recommend'] == 0) echo 'checked="checked"';?> value="0" type="radio"></td>
  132. <td class="vatop tips"></td>
  133. </tr>
  134. </tbody>
  135. <tfoot>
  136. <tr>
  137. <td colspan="2"><a href="JavaScript:void(0);" class="btn" id="submitBtn"><span><?php echo $lang['nc_submit'];?></span></a></td>
  138. </tr>
  139. </tfoot>
  140. </table>
  141. </form>
  142. </div>
  143. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/jquery.edit.js" charset="utf-8"></script>
  144. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/dialog/dialog.js" id="dialog_js" charset="utf-8"></script>
  145. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/jquery-ui/jquery.ui.js"></script>
  146. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/ajaxfileupload/ajaxfileupload.js"></script>
  147. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/jquery.Jcrop/jquery.Jcrop.js"></script>
  148. <link href="<?php echo RESOURCE_SITE_URL;?>/js/jquery.Jcrop/jquery.Jcrop.min.css" rel="stylesheet" type="text/css" id="cssfile2" />
  149. <script>
  150. //裁剪图片后返回接收函数
  151. function call_back(picname){
  152. $('#c_img').val(picname);
  153. $('#view_img').attr('src','<?php echo UPLOAD_SITE_URL.'/'.ATTACH_CIRCLE;?>/group/'+picname+'?'+Math.random());
  154. }
  155. // 选择圈主
  156. function chooseReturn(data) {
  157. $('#mastername').val(data.name);$('#masterid').val(data.id);
  158. }
  159. //按钮先执行验证再提交表单
  160. $(function(){
  161. $('input[class="type-file-file"]').change(uploadChange);
  162. function uploadChange(){
  163. var filepatd=$(this).val();
  164. var extStart=filepatd.lastIndexOf(".");
  165. var ext=filepatd.substring(extStart,filepatd.lengtd).toUpperCase();
  166. if(ext!=".PNG"&&ext!=".GIF"&&ext!=".JPG"&&ext!=".JPEG"){
  167. alert("file type error");
  168. $(this).attr('value','');
  169. return false;
  170. }
  171. if ($(this).val() == '') return false;
  172. ajaxFileUpload();
  173. }
  174. function ajaxFileUpload()
  175. {
  176. $.ajaxFileUpload
  177. (
  178. {
  179. url:'index.php?act=common&op=pic_upload&form_submit=ok&uploadpath=<?php echo ATTACH_CIRCLE;?>/group',
  180. secureuri:false,
  181. fileElementId:'_pic',
  182. dataType: 'json',
  183. success: function (data, status)
  184. {
  185. if (data.status == 1){
  186. ajax_form('cutpic','<?php echo $lang['nc_cut'];?>','index.php?act=common&op=pic_cut&type=circle&x=120&y=120&resize=1&ratio=1&filename=<?php echo UPLOAD_SITE_URL.'/'.ATTACH_CIRCLE;?>/group/<?php echo $_GET['c_id'];?>.jpg&url='+data.url,690);
  187. }else{
  188. alert(data.msg);
  189. }
  190. $('input[class="type-file-file"]').bind('change',uploadChange);
  191. },
  192. error: function (data, status, e)
  193. {
  194. alert('上传失败');$('input[class="type-file-file"]').bind('change',uploadChange);
  195. }
  196. }
  197. )
  198. }
  199. // 关闭或审核失败原因控制
  200. $('input[name="c_status"]').click(function(){
  201. statusinfo($(this).val());
  202. });
  203. // 选择圈主弹出框
  204. $('#mastername').focus(function(){
  205. ajax_form('choose_master', '<?php echo $lang['circle_choose_master'];?>', 'index.php?act=circle_manage&op=choose_master&c_id=<?php echo $output['circle_info']['circle_id'];?>', 320);
  206. });
  207. $("#submitBtn").click(function(){
  208. if($("#circle_form").valid()){
  209. $("#circle_form").submit();
  210. }
  211. });
  212. $('#circle_form').validate({
  213. errorPlacement: function(error, element){
  214. error.appendTo(element.parent().parent().prev().find('td:first'));
  215. },
  216. rules : {
  217. c_name : {
  218. required : true,
  219. minlength : 4,
  220. maxlength : 12,
  221. remote : {
  222. url : 'index.php?act=circle_manage&op=check_circle_name&id=<?php echo $output['circle_info']['circle_id'];?>',
  223. type: 'get',
  224. data:{
  225. name : function(){
  226. return $('#c_name').val();
  227. }
  228. }
  229. }
  230. },
  231. mastername : {
  232. required : true,
  233. remote : {
  234. url :'index.php?act=circle_manage&op=check_member&c_id=<?php echo $output['circle_info']['circle_id'];?>&branch=ok',
  235. type:'get',
  236. data:{
  237. name : function(){
  238. return $('#mastername').val();
  239. },
  240. id : function(){
  241. return $('#masterid').val();
  242. }
  243. }
  244. }
  245. },
  246. c_desc : {
  247. maxlength : 240
  248. },
  249. c_tag : {
  250. maxlength : 50
  251. },
  252. c_notice : {
  253. maxlength : 240
  254. },
  255. c_sort : {
  256. digits : true,
  257. max : 255
  258. },
  259. c_statusinfo : {
  260. maxlength : 240
  261. }
  262. },
  263. messages : {
  264. c_name : {
  265. required : '<?php echo $lang['circle_name_not_null'];?>',
  266. minlength : '<?php echo $lang['circle_name_length_4_12'];?>',
  267. maxlength : '<?php echo $lang['circle_name_length_4_12'];?>',
  268. remote : '<?php echo $lang['circle_change_name_please'];?>'
  269. },
  270. mastername : {
  271. required : '<?php echo $lang['circle_choose_master_please'];?>',
  272. remote : '<?php echo $lang['circle_master_choose_error'];?>'
  273. },
  274. c_desc : {
  275. maxlength : '<?php echo $lang['circle_desc_maxlength'];?>'
  276. },
  277. c_tag : {
  278. maxlength : '<?php echo $lang['circle_tag_maxlength'];?>'
  279. },
  280. c_notice : {
  281. maxlength : '<?php echo $lang['circle_notice_maxlength'];?>'
  282. },
  283. c_sort : {
  284. digits : '<?php echo $lang['circle_sort_digits'];?>',
  285. max : '<?php echo $lang['circle_sort_max'];?>'
  286. },
  287. c_statusinfo : {
  288. maxlength : '<?php echo $lang['circle_verify_fail_reason_maxlength'];?>'
  289. }
  290. }
  291. });
  292. });
  293. function statusinfo(val){
  294. if(val == '0' || val == '3'){
  295. $('#circle_statusinfo').show();
  296. }else if(val == '1' || val == '2'){
  297. $('#circle_statusinfo').hide();
  298. }
  299. }
  300. </script>