post.htm 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <!--{template common/header}-->
  2. <!--{if $special != 2 && $special != 4 && !($isfirstpost && $sortid)}-->
  3. <!--{eval $adveditor = $isfirstpost && $special && ($_GET['action'] == 'newthread' || $_GET['action'] == 'reply' && !empty($_GET['addtrade']) || $_GET['action'] == 'edit' );}-->
  4. <form method="post" id="postform"
  5. {if $_GET[action] == 'newthread'}action="forum.php?mod=post&action={if $special != 2}newthread{else}newtrade{/if}&fid=$_G[fid]&extra=$extra&topicsubmit=yes&mobile=2"
  6. {elseif $_GET[action] == 'reply'}action="forum.php?mod=post&action=reply&fid=$_G[fid]&tid=$_G[tid]&extra=$extra&replysubmit=yes&mobile=2"
  7. {elseif $_GET[action] == 'edit'}action="forum.php?mod=post&action=edit&extra=$extra&editsubmit=yes&mobile=2" $enctype
  8. {/if}>
  9. <input type="hidden" name="formhash" id="formhash" value="{FORMHASH}" />
  10. <input type="hidden" name="posttime" id="posttime" value="{TIMESTAMP}" />
  11. <!--{if !empty($_GET['modthreadkey'])}--><input type="hidden" name="modthreadkey" id="modthreadkey" value="$_GET['modthreadkey']" /><!--{/if}-->
  12. <!--{if $_GET[action] == 'reply'}-->
  13. <input type="hidden" name="noticeauthor" value="$noticeauthor" />
  14. <input type="hidden" name="noticetrimstr" value="$noticetrimstr" />
  15. <input type="hidden" name="noticeauthormsg" value="$noticeauthormsg" />
  16. <!--{if $reppid}-->
  17. <input type="hidden" name="reppid" value="$reppid" />
  18. <!--{/if}-->
  19. <!--{if $_GET[reppost]}-->
  20. <input type="hidden" name="reppost" value="$_GET[reppost]" />
  21. <!--{elseif $_GET[repquote]}-->
  22. <input type="hidden" name="reppost" value="$_GET[repquote]" />
  23. <!--{/if}-->
  24. <!--{/if}-->
  25. <!--{if $_GET[action] == 'edit'}-->
  26. <input type="hidden" name="fid" id="fid" value="$_G[fid]" />
  27. <input type="hidden" name="tid" value="$_G[tid]" />
  28. <input type="hidden" name="pid" value="$pid" />
  29. <input type="hidden" name="page" value="$_GET[page]" />
  30. <!--{/if}-->
  31. <!--{if $special}-->
  32. <input type="hidden" name="special" value="$special" />
  33. <!--{/if}-->
  34. <!--{if $specialextra}-->
  35. <input type="hidden" name="specialextra" value="$specialextra" />
  36. <!--{/if}-->
  37. <!-- header start -->
  38. <div class="wk_header">
  39. <header class="width100">
  40. <h1 class="wk_fl"><a href="portal.php?mod=index&mobile=2"><img alt="$_G[setting][bbname]" src="$_G['style']['styleimgdir']/logo.png" class="width100"/></a></h1>
  41. <div class="wk_fr"><button id="postsubmit" class="btn_pn <!--{if $_GET[action] == 'edit'}-->btn_pn_blue" disable="false"<!--{else}-->btn_pn_grey" disable="true"<!--{/if}-->><span><!--{if $_GET[action] == 'newthread'}-->{lang send_thread}<!--{elseif $_GET[action] == 'reply'}-->{lang join_thread}<!--{elseif $_GET[action] == 'edit'}-->{lang edit_save}<!--{/if}--></span></button></div>
  42. <div class="c"></div>
  43. </header>
  44. </div>
  45. <div class="clear"></div>
  46. <!-- header end -->
  47. <!-- main postbox start -->
  48. <div class="wp">
  49. <div class="post_from">
  50. <ul class="cl">
  51. <li class="bl_line">
  52. <!--{if $_GET['action'] != 'reply'}-->
  53. <input type="text" tabindex="1" class="px" id="needsubject" size="30" autocomplete="off" value="$postinfo[subject]" name="subject" placeholder="{lang thread_subject}" fwin="login">
  54. <!--{else}-->
  55. RE: $thread['subject']
  56. <!--{if $quotemessage}-->$quotemessage<!--{/if}-->
  57. <!--{/if}-->
  58. </li>
  59. <!--{if $isfirstpost && !empty($_G['forum'][threadtypes][types])}-->
  60. <li class="bl_line">
  61. <select id="typeid" name="typeid" class="sort_sel">
  62. <option value="0" selected="selected">{lang select_thread_catgory}</option>
  63. <!--{loop $_G['forum'][threadtypes][types] $typeid $name}-->
  64. <!--{if empty($_G['forum']['threadtypes']['moderators'][$typeid]) || $_G['forum']['ismoderator']}-->
  65. <option value="$typeid"{if $thread['typeid'] == $typeid || $_GET['typeid'] == $typeid} selected="selected"{/if}><!--{echo strip_tags($name);}--></option>
  66. <!--{/if}-->
  67. <!--{/loop}-->
  68. </select>
  69. </li>
  70. <!--{/if}-->
  71. <!--{if $_GET[action] == 'edit' && $isorigauthor && ($isfirstpost && $thread['replies'] < 1 || !$isfirstpost) && !$rushreply && $_G['setting']['editperdel']}-->
  72. <li class="bl_line">
  73. <input type="checkbox" name="delete" id="delete" class="pc" value="1" title="{lang post_delpost}{if $thread[special] == 3}{lang reward_price_back}{/if}"> {lang delete_check}
  74. </li>
  75. <!--{/if}-->
  76. <li class="bl_none area">
  77. <textarea class="pt" id="needmessage" tabindex="3" autocomplete="off" id="{$editorid}_textarea" name="$editor[textarea]" cols="80" rows="2" placeholder="{lang thread_content}" fwin="reply">$postinfo[message]</textarea>
  78. </li>
  79. <li style="padding:0px;">
  80. <a href="javascript:;" class="y" style="background:url({STATICURL}image/mobile/images/icon_photo.png) no-repeat;overflow:hidden;">
  81. <input type="file" name="Filedata" id="filedata" style="width:30px;height:30px;font-size:30px;opacity:0;"/>
  82. </a>
  83. </li>
  84. </ul>
  85. <ul id="imglist" class="post_imglist cl bl_line">
  86. </ul>
  87. <!--{if $_GET[action] != 'edit' && ($secqaacheck || $seccodecheck)}-->
  88. <!--{subtemplate common/seccheck}-->
  89. <!--{/if}-->
  90. <!--{hook/post_bottom_mobile}-->
  91. </div>
  92. </div>
  93. <!-- main postbox start -->
  94. </form>
  95. <!--{else}-->
  96. <div class="box xg1">
  97. <!--{if $special == '2'}-->
  98. {lang send_special_trade_error}
  99. <!--{elseif $special == '4'}-->
  100. {lang send_special_activity_error}
  101. <!--{elseif $isfirstpost && $sortid}-->
  102. {lang threadsort_error}
  103. <!--{/if}-->
  104. </div>
  105. <!--{/if}-->
  106. <script type="text/javascript">
  107. (function() {
  108. var needsubject = needmessage = false;
  109. <!--{if $_GET[action] == 'reply'}-->
  110. needsubject = true;
  111. <!--{elseif $_GET[action] == 'edit'}-->
  112. needsubject = needmessage = true;
  113. <!--{/if}-->
  114. <!--{if $_GET[action] == 'newthread' || ($_GET[action] == 'edit' && $isfirstpost)}-->
  115. $('#needsubject').on('keyup input', function() {
  116. var obj = $(this);
  117. if(obj.val()) {
  118. needsubject = true;
  119. if(needmessage == true) {
  120. $('.btn_pn').removeClass('btn_pn_grey').addClass('btn_pn_blue');
  121. $('.btn_pn').attr('disable', 'false');
  122. }
  123. } else {
  124. needsubject = false;
  125. $('.btn_pn').removeClass('btn_pn_blue').addClass('btn_pn_grey');
  126. $('.btn_pn').attr('disable', 'true');
  127. }
  128. });
  129. <!--{/if}-->
  130. $('#needmessage').on('keyup input', function() {
  131. var obj = $(this);
  132. if(obj.val()) {
  133. needmessage = true;
  134. if(needsubject == true) {
  135. $('.btn_pn').removeClass('btn_pn_grey').addClass('btn_pn_blue');
  136. $('.btn_pn').attr('disable', 'false');
  137. }
  138. } else {
  139. needmessage = false;
  140. $('.btn_pn').removeClass('btn_pn_blue').addClass('btn_pn_grey');
  141. $('.btn_pn').attr('disable', 'true');
  142. }
  143. });
  144. $('#needmessage').on('scroll', function() {
  145. var obj = $(this);
  146. if(obj.scrollTop() > 0) {
  147. obj.attr('rows', parseInt(obj.attr('rows'))+2);
  148. }
  149. }).scrollTop($(document).height());
  150. })();
  151. </script>
  152. <script type="text/javascript" src="{STATICURL}js/mobile/ajaxfileupload.js?{VERHASH}"></script>
  153. <script type="text/javascript" src="{STATICURL}js/mobile/buildfileupload.js?{VERHASH}"></script>
  154. <script type="text/javascript">
  155. var imgexts = typeof imgexts == 'undefined' ? 'jpg, jpeg, gif, png' : imgexts;
  156. var STATUSMSG = {
  157. '-1' : '{lang uploadstatusmsgnag1}',
  158. '0' : '{lang uploadstatusmsg0}',
  159. '1' : '{lang uploadstatusmsg1}',
  160. '2' : '{lang uploadstatusmsg2}',
  161. '3' : '{lang uploadstatusmsg3}',
  162. '4' : '{lang uploadstatusmsg4}',
  163. '5' : '{lang uploadstatusmsg5}',
  164. '6' : '{lang uploadstatusmsg6}',
  165. '7' : '{lang uploadstatusmsg7}(' + imgexts + ')',
  166. '8' : '{lang uploadstatusmsg8}',
  167. '9' : '{lang uploadstatusmsg9}',
  168. '10' : '{lang uploadstatusmsg10}',
  169. '11' : '{lang uploadstatusmsg11}'
  170. };
  171. var form = $('#postform');
  172. $(document).on('change', '#filedata', function() {
  173. popup.open('<img src="' + IMGDIR + '/imageloading.gif">');
  174. uploadsuccess = function(data) {
  175. if(data == '') {
  176. popup.open('{lang uploadpicfailed}', 'alert');
  177. }
  178. var dataarr = data.split('|');
  179. if(dataarr[0] == 'DISCUZUPLOAD' && dataarr[2] == 0) {
  180. popup.close();
  181. $('#imglist').append('<li><span aid="'+dataarr[3]+'" class="del"><a href="javascript:;"><img src="{STATICURL}image/mobile/images/icon_del.png"></a></span><span class="p_img"><a href="javascript:;"><img style="height:54px;width:54px;" id="aimg_'+dataarr[3]+'" title="'+dataarr[6]+'" src="{$_G[setting][attachurl]}forum/'+dataarr[5]+'" /></a></span><input type="hidden" name="attachnew['+dataarr[3]+'][description]" /></li>');
  182. } else {
  183. var sizelimit = '';
  184. if(dataarr[7] == 'ban') {
  185. sizelimit = '{lang uploadpicatttypeban}';
  186. } else if(dataarr[7] == 'perday') {
  187. sizelimit = '{lang donotcross}'+Math.ceil(dataarr[8]/1024)+'K)';
  188. } else if(dataarr[7] > 0) {
  189. sizelimit = '{lang donotcross}'+Math.ceil(dataarr[7]/1024)+'K)';
  190. }
  191. popup.open(STATUSMSG[dataarr[2]] + sizelimit, 'alert');
  192. }
  193. };
  194. if(typeof FileReader != 'undefined' && this.files[0]) {//note 支持html5上传新特性
  195. $.buildfileupload({
  196. uploadurl:'misc.php?mod=swfupload&operation=upload&type=image&inajax=yes&infloat=yes&simple=2',
  197. files:this.files,
  198. uploadformdata:{uid:"$_G[uid]", hash:"<!--{eval echo md5(substr(md5($_G[config][security][authkey]), 8).$_G[uid])}-->"},
  199. uploadinputname:'Filedata',
  200. maxfilesize:"$swfconfig[max]",
  201. success:uploadsuccess,
  202. error:function() {
  203. popup.open('{lang uploadpicfailed}', 'alert');
  204. }
  205. });
  206. } else {
  207. $.ajaxfileupload({
  208. url:'misc.php?mod=swfupload&operation=upload&type=image&inajax=yes&infloat=yes&simple=2',
  209. data:{uid:"$_G[uid]", hash:"<!--{eval echo md5(substr(md5($_G[config][security][authkey]), 8).$_G[uid])}-->"},
  210. dataType:'text',
  211. fileElementId:'filedata',
  212. success:uploadsuccess,
  213. error: function() {
  214. popup.open('{lang uploadpicfailed}', 'alert');
  215. }
  216. });
  217. }
  218. });
  219. <!--{if 0 && $_G['setting']['mobile']['geoposition']}-->
  220. geo.getcurrentposition();
  221. <!--{/if}-->
  222. $('#postsubmit').on('click', function() {
  223. var obj = $(this);
  224. if(obj.attr('disable') == 'true') {
  225. return false;
  226. }
  227. obj.attr('disable', 'true').removeClass('btn_pn_blue').addClass('btn_pn_grey');
  228. popup.open('<img src="' + IMGDIR + '/imageloading.gif">');
  229. var postlocation = '';
  230. if(geo.errmsg === '' && geo.loc) {
  231. postlocation = geo.longitude + '|' + geo.latitude + '|' + geo.loc;
  232. }
  233. $.ajax({
  234. type:'POST',
  235. url:form.attr('action') + '&geoloc=' + postlocation + '&handlekey='+form.attr('id')+'&inajax=1',
  236. data:form.serialize(),
  237. dataType:'xml'
  238. })
  239. .success(function(s) {
  240. popup.open(s.lastChild.firstChild.nodeValue);
  241. })
  242. .error(function() {
  243. popup.open('{lang networkerror}', 'alert');
  244. });
  245. return false;
  246. });
  247. $(document).on('click', '.del', function() {
  248. var obj = $(this);
  249. $.ajax({
  250. type:'GET',
  251. url:'forum.php?mod=ajax&action=deleteattach&inajax=yes&aids[]=' + obj.attr('aid'),
  252. })
  253. .success(function(s) {
  254. obj.parent().remove();
  255. })
  256. .error(function() {
  257. popup.open('{lang networkerror}', 'alert');
  258. });
  259. return false;
  260. });
  261. </script>
  262. <!--{eval $nofooter = true;}-->
  263. <!--{template common/footer}-->