theme.share.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?php defined('InShopNC') or exit('Access Invalid!');?>
  2. <div class="circle-share">
  3. <form method="post" action="<?php echo CIRCLE_SITE_URL;?>/index.php?act=theme_share&c_id=<?php echo $output['c_id'];?>&t_id=<?php echo $output['t_id'];?>" id="share_form" class="feededitor">
  4. <input type="hidden" name="form_submit" value="ok"/>
  5. <dl class="share-target">
  6. <dt class="title"><?php echo $output['theme_info']['theme_name'];?></dt>
  7. <dd class="cover">
  8. <?php if(!empty($output['affix_list'])){?>
  9. <?php foreach($output['affix_list'] as $val){?>
  10. <a href="Javascript: void(0);"><img src="<?php echo themeImageUrl($val['affix_filethumb']);?>"/></a>
  11. <?php }?>
  12. <?php }?>
  13. </dd>
  14. <dd class="sub"><span id="_share_publisher">作者:<?php echo $output['theme_info']['member_name'];?></span><span id="_share_origin">来自:<?php echo $output['theme_info']['circle_name'];?></span></dd>
  15. <dd class="abstract"><?php echo removeUBBTag($output['theme_info']['theme_content']);?></dd>
  16. </dl>
  17. <!-- 站外分享 -->
  18. <?php if (C('share_isuse') == 1 && !empty($output['app_arr'])){?>
  19. <div class="share-widget"> <span class="title"><?php echo $lang['sharebind_alsoshareto'];?></span> <span class="s-app">
  20. <?php foreach ($output['app_arr'] as $k=>$v){?>
  21. <label nc_type="appitem_<?php echo $k;?>" title="<?php echo $v['name'];?>" class="<?php echo $v['isbind']?'checked':'disable';?>"> <i class="i-<?php echo $k;?>" nc_type="bindbtn" data-param='{"apikey":"<?php echo $k;?>","apiname":"<?php echo $v['name'];?>"}' attr_isbind="<?php echo $v['isbind']?'1':'0';?>"></i>
  22. <input type="hidden" id="checkapp_<?php echo $k;?>" name="checkapp_<?php echo $k;?>" value="<?php echo $v['isbind']?'1':'0';?>" />
  23. </label>
  24. <?php }?>
  25. <a target="_blank" href="<?php echo SHOP_SITE_URL;?>/index.php?act=member_sharemanage"><?php echo $lang['sharebind_alsosharesetting'];?></a> </span> </div>
  26. <?php }?>
  27. <div class="share-content">
  28. <textarea placeholder="<?php echo $lang['sns_sharegoods_contenttip2'];?>" name="content" id="content_sgweibo" resize="none"></textarea>
  29. </div>
  30. <input type="text" style="display:none;" />
  31. <!-- 防止点击Enter键提交 -->
  32. <div class="handle">
  33. <div id="sgcharcount" class="count"></div>
  34. <div class="error form-error"></div>
  35. <input name="<?php echo $lang['nc_snsshare'];?>" type="button" class="button" value="<?php echo $lang['nc_snsshare'];?>" id="share_button" />
  36. </div>
  37. <input type="hidden" name="gprivacy" id="gprivacy" value="0"/>
  38. </form>
  39. </div>
  40. <textarea id="bindtooltip_module" style="display:none;">
  41. <div class="eject_con"><dl><dt style="width:25%"><img src="<?php echo CIRCLE_TEMPLATES_URL;?>/images/shareicon/shareicon_@apikey.png" width="40" height="40" class="mt5 mr20"></dt><dd style="width:75%"><p><?php echo $lang['sharebind_list_popup_tip1'];?><strong class="ml5 mr5">@apiname</strong><?php echo $lang['sharebind_list_popup_tip2'];?></p><p class="red"><?php echo $lang['sharebind_list_popup_tip3'];?>@apiname<?php echo $lang['sharebind_list_popup_tip4'];?></p></dd></dl>
  42. <dl class="bottom"><dt style="width:25%">&nbsp;</dt>
  43. <dd style="width:75%"><a href="javascript:void(0);" nc_type="finishbtn" data-param='{"apikey":"@apikey"}' class="ncu-btn2 mr10"><?php echo $lang['sharebind_list_finishbind'];?></a><span><?php echo $lang['sharebind_list_unfinishedbind'];?><a target="_blank" href="<?php echo CIRCLE_SITE_URL;?>/api.php?act=sharebind&type=@apikey" class="ml5"><?php echo $lang['sharebind_list_againbind'];?></a></span></dd>
  44. </dl>
  45. </div>
  46. </textarea>
  47. <script type="text/javascript">
  48. var max_recordnum = '<?php echo $output['max_recordnum'];?>';
  49. $(function(){
  50. $(".thumb-cut .t-img").VMiddleImg({"width":100,"height":100});
  51. // Char Count
  52. $.getScript("<?php echo RESOURCE_SITE_URL;?>/js/jquery.charCount.js" ,function(){
  53. $("#content_sgweibo").charCount({
  54. allowed: 140,
  55. warning: 10,
  56. counterContainerID:'sgcharcount',
  57. firstCounterText:'<?php echo $lang['charCount_firsttext'];?>',
  58. endCounterText:'<?php echo $lang['charCount_endtext'];?>',
  59. errorCounterText:'<?php echo $lang['charCount_errortext'];?>'
  60. });
  61. });
  62. // form validate
  63. $('#share_form').validate({
  64. errorPlacement: function(error, element){
  65. $('.form-error').append(error);
  66. },
  67. rules : {
  68. content : {
  69. maxlength : 140
  70. }
  71. },
  72. messages : {
  73. content : {
  74. maxlength: '<?php echo $lang['sharebind_content_not_null'];?>'
  75. }
  76. }
  77. });
  78. $("[nc_type='bindbtn']").bind('click',function(){
  79. var data_str = $(this).attr('data-param');
  80. eval( "data_str = "+data_str);
  81. // Determine whether the binding
  82. var isbind = $(this).attr('attr_isbind');
  83. if(isbind == '1'){// Is binding
  84. if($("#checkapp_"+data_str.apikey).val() == '1'){
  85. $("[nc_type='appitem_"+data_str.apikey+"']").removeClass('checked');
  86. $("[nc_type='appitem_"+data_str.apikey+"']").addClass('disable');
  87. $("#checkapp_"+data_str.apikey).val('0');
  88. }else{
  89. $("[nc_type='appitem_"+data_str.apikey+"']").removeClass('disable');
  90. $("[nc_type='appitem_"+data_str.apikey+"']").addClass('checked');
  91. $("#checkapp_"+data_str.apikey).val('1');
  92. }
  93. }else{
  94. var html = $("#bindtooltip_module").text();
  95. // replace keywords
  96. html = html.replace(/@apikey/g,data_str.apikey);
  97. html = html.replace(/@apiname/g,data_str.apiname);
  98. html_form("bindtooltip", "<?php echo $lang['sharebind_list_accountconnect'];?>", html, 360, 0);
  99. window.open('api.php?act=sharebind&type='+data_str.apikey);
  100. }
  101. });
  102. $("[nc_type='finishbtn']").live('click',function(){
  103. var data_str = $(this).attr('data-param');
  104. eval( "data_str = "+data_str);
  105. // check binding
  106. var url = 'index.php?act=share&op=checkbind';
  107. $.getJSON(url, {'k':data_str.apikey}, function(data){
  108. DialogManager.close('bindtooltip');
  109. if (data.done)
  110. {
  111. $("[nc_type='appitem_"+data_str.apikey+"']").addClass('check');
  112. $("[nc_type='appitem_"+data_str.apikey+"']").removeClass('disable');
  113. $('#checkapp_'+data_str.apikey).val('1');
  114. $("[nc_type='appitem_"+data_str.apikey+"']").find('i').attr('attr_isbind','1');
  115. }
  116. else
  117. {
  118. showDialog(data.msg, 'notice');
  119. }
  120. });
  121. });
  122. $("#share_button").click(function(){
  123. if($("#share_form").valid()){
  124. ajaxpost('share_form', '', '', 'onerror');
  125. }
  126. });
  127. });
  128. </script>