%%50^50A^50A8C78C%%interactive_input.html.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <?php /* Smarty version 2.6.17, created on 2018-05-26 12:07:42
  2. compiled from admin/activity/interactive_input.html */ ?>
  3. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  4. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/header.html", 'smarty_include_vars' => array()));
  5. $this->_tpl_vars = $_smarty_tpl_vars;
  6. unset($_smarty_tpl_vars);
  7. ?>
  8. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  9. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/left.html", 'smarty_include_vars' => array()));
  10. $this->_tpl_vars = $_smarty_tpl_vars;
  11. unset($_smarty_tpl_vars);
  12. ?>
  13. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  14. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/nav.html", 'smarty_include_vars' => array()));
  15. $this->_tpl_vars = $_smarty_tpl_vars;
  16. unset($_smarty_tpl_vars);
  17. ?>
  18. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  19. $this->_smarty_include(array('smarty_include_tpl_file' => "get_kindeditor.html", 'smarty_include_vars' => array()));
  20. $this->_tpl_vars = $_smarty_tpl_vars;
  21. unset($_smarty_tpl_vars);
  22. ?>
  23. <style>
  24. .set-nav {
  25. margin: 0 auto;
  26. }
  27. .set-nav-hr {
  28. background-color: #ddd;
  29. height: 1px;
  30. position: relative;
  31. }
  32. .form-group label {
  33. font-weight: 600;
  34. }
  35. .checkbox-inline, .radio-inline {
  36. font-weight: 400!important;
  37. }
  38. .rowlabel {
  39. font-weight: 300!important;
  40. }
  41. .music_play_hide {
  42. display:none;
  43. }
  44. </style>
  45. <div id="activity_container">
  46. <form id="activity_form">
  47. <div class="activity_center">
  48. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  49. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/activity/common_nav.html", 'smarty_include_vars' => array()));
  50. $this->_tpl_vars = $_smarty_tpl_vars;
  51. unset($_smarty_tpl_vars);
  52. ?>
  53. <input name="events_id" type="hidden" value="<?php echo $this->_tpl_vars['events_Data']['events']['id']; ?>
  54. ">
  55. <div class="panel panel-default">
  56. <div class="panel-heading">
  57. <h3 class="panel-title" id="panel-title">设置表单</h3>
  58. </div>
  59. <div class="panel-body">
  60. <div class="form-group">
  61. <div>
  62. <table class="custom_from_table table table-condensed">
  63. <thead>
  64. <tr>
  65. <th>名称</th>
  66. <th>类型</th>
  67. <th>最小长度</th>
  68. <th>验证规则</th>
  69. <th>是否必填</th>
  70. </tr>
  71. </thead>
  72. <tbody>
  73. <?php if (! $this->_tpl_vars['events_Data']['events']['forms']): ?>
  74. <tr class="not_input">
  75. <td colspan='6' align="center">没有设置表单</td>
  76. </tr>
  77. <?php else: ?>
  78. <?php $_from = $this->_tpl_vars['events_Data']['events']['forms']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
  79. foreach ($_from as $this->_tpl_vars['form']):
  80. ?>
  81. <?php if ($this->_tpl_vars['form']['type'] == 'text'): ?>
  82. <tr>
  83. <td><input name="f[0][name]" type="text" value="<?php echo $this->_tpl_vars['form']['name']; ?>
  84. " class="form-control" /></td>
  85. <td>
  86. <select class="form-control form_select" name="f[0][type]">
  87. <option value="text" selected>单行文本框</option>
  88. <option value="textarea">多行文本框</option>
  89. <option value="select">下拉菜单</option>
  90. </select>
  91. </td>
  92. <td><input name="f[0][rule][size]" type="text" value="<?php echo $this->_tpl_vars['form']['rule']['size']; ?>
  93. " class="form-control" /></td>
  94. <td>
  95. <select class="form-control" name="f[0][rule][regularid]">
  96. <option value="">无规则</option>
  97. <option value="1" <?php if ($this->_tpl_vars['form']['rule']['regularid'] == 1): ?>selected<?php endif; ?>>手机验证</option>
  98. <option value="2" <?php if ($this->_tpl_vars['form']['rule']['regularid'] == 2): ?>selected<?php endif; ?>>邮箱验证</option>
  99. </select>
  100. </td>
  101. <td>
  102. <input name="f[0][required]" type="checkbox" value="1" <?php if ($this->_tpl_vars['form']['required']): ?>checked<?php endif; ?>/>
  103. </td>
  104. </tr>
  105. <?php endif; ?>
  106. <?php if ($this->_tpl_vars['form']['type'] == 'select'): ?>
  107. <tr>
  108. <td><input name="f[0][name]" type="text" value="<?php echo $this->_tpl_vars['form']['name']; ?>
  109. " class="form-control"/></td>
  110. <td>
  111. <select class="form_select form-control" name="f[0][type]">
  112. <option value="text">单行文本框</option>
  113. <option value="textarea">多行文本框</option>
  114. <option value="select" selected>下拉菜单</option>
  115. </select>
  116. </td>
  117. <td>
  118. <textarea name="f[0][options]" class="form-control" placeholder=""><?php echo $this->_tpl_vars['form']['options']; ?>
  119. </textarea>
  120. </td>
  121. <td>多个选项换行分隔</td>
  122. <td><input name="f[0][required]" type="checkbox" value="1" <?php if ($this->_tpl_vars['form']['required']): ?>checked<?php endif; ?>/></td>
  123. </tr>
  124. <?php endif; ?>
  125. <?php if ($this->_tpl_vars['form']['type'] == 'textarea'): ?>
  126. <tr>
  127. <td><input name="f[0][name]" type="text" value="<?php echo $this->_tpl_vars['form']['name']; ?>
  128. " class="form-control"/></td>
  129. <td>
  130. <select class="form_select form-control" name="f[0][type]">
  131. <option value="text">单行文本框</option>
  132. <option value="textarea" selected>多行文本框</option>
  133. <option value="select">下拉菜单</option>
  134. </select>
  135. </td>
  136. <td><input name="f[0][rule][size]" type="text" value="<?php echo $this->_tpl_vars['form']['rule']['size']; ?>
  137. " class="form-control"/></td>
  138. <td>
  139. <select name="f[0][rule][regularid]" class="form-control">
  140. <option value="">无规则</option>
  141. <option value="1" <?php if ($this->_tpl_vars['form']['rule']['regularid'] == 1): ?>selected<?php endif; ?>>手机验证</option>
  142. <option value="2" <?php if ($this->_tpl_vars['form']['rule']['regularid'] == 2): ?>selected<?php endif; ?>>邮箱验证</option>
  143. </select>
  144. </td>
  145. <td><input name="f[0][required]" type="checkbox" value="1" <?php if ($this->_tpl_vars['form']['required']): ?>checked<?php endif; ?>/> </td>
  146. </tr>
  147. <?php endif; ?>
  148. <?php endforeach; endif; unset($_from); ?>
  149. <?php endif; ?>
  150. </tbody>
  151. </table>
  152. <a href="javascript:;" class="addRule js_add_prize" data-stat="show"><i class="fa fa-plus"></i> 添加表单字段</a>
  153. </div>
  154. </div>
  155. <a id="activity_submit" href="javascript:;" class="button button-3d button-primary button-rounded"><i class="fa fa-refresh fa-spin" style="display:none;"></i> 保存设置</a>
  156. <?php if ($this->_tpl_vars['typ']): ?>
  157. <div style="text-align:right;">
  158. <a href="?c=Admin_Activity_SetInteractive&a=PageShow&events_id=<?php echo $this->_tpl_vars['events_Data']['events']['id']; ?>
  159. " >返回互动设置</a>
  160. </div>
  161. <?php endif; ?>
  162. </div>
  163. </div>
  164. </div>
  165. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  166. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/activity/common_right.html", 'smarty_include_vars' => array()));
  167. $this->_tpl_vars = $_smarty_tpl_vars;
  168. unset($_smarty_tpl_vars);
  169. ?>
  170. <div style="clear:both;"></div>
  171. </form>
  172. </div>
  173. <div class="form_select_template" style="display:none;">
  174. <table>
  175. <tr>
  176. <td><input name="f[0][name]" type="text" value="" class="form-control"/></td>
  177. <td>
  178. <select class="form_select form-control" name="f[0][type]">
  179. <option value="text">单行文本框</option>
  180. <option value="textarea">多行文本框</option>
  181. <option value="select" selected>下拉菜单</option>
  182. </select>
  183. </td>
  184. <td>
  185. <textarea name="f[0][options]" class="form-control" placeholder=""></textarea>
  186. </td>
  187. <td>多个选项换行分隔</td>
  188. <td><input name="f[0][required]" type="checkbox" value="1"/></td>
  189. </tr>
  190. </table>
  191. </div>
  192. <div class="form_text_template" style="display:none;">
  193. <table>
  194. <tr>
  195. <td><input name="f[0][name]" type="text" value="" class="form-control"/></td>
  196. <td>
  197. <select class="form_select form-control" name="f[0][type]">
  198. <option value="text" selected>单行文本框</option>
  199. <option value="textarea">多行文本框</option>
  200. <option value="select">下拉菜单</option>
  201. </select>
  202. </td>
  203. <td><input name="f[0][rule][size]" type="text" value="" class="form-control"/></td>
  204. <td>
  205. <select name="f[0][rule][regularid]" class="form-control">
  206. <option value="">无规则</option>
  207. <option value="1">手机验证</option>
  208. <option value="2">邮箱验证</option>
  209. </select>
  210. </td>
  211. <td><input name="f[0][required]" type="checkbox" value="1"/></td>
  212. </tr>
  213. </table>
  214. </div>
  215. <div class="form_textarea_template" style="display:none;">
  216. <table>
  217. <tr>
  218. <td><input name="f[0][name]" type="text" value="" class="form-control"/></td>
  219. <td>
  220. <select class="form_select form-control" name="f[0][type]">
  221. <option value="text">单行文本框</option>
  222. <option value="textarea" selected>多行文本框</option>
  223. <option value="select">下拉菜单</option>
  224. </select>
  225. </td>
  226. <td><input name="f[0][rule][size]" type="text" value="" class="form-control"/></td>
  227. <td>
  228. <select name="f[0][rule][regularid]" class="form-control">
  229. <option value="">无规则</option>
  230. <option value="1">手机验证</option>
  231. <option value="2">邮箱验证</option>
  232. </select>
  233. </td>
  234. <td><input name="f[0][required]" type="checkbox" value="1"/> </td>
  235. </tr>
  236. </table>
  237. </div>
  238. <script>
  239. KISSY.use('node, io, event, jquery', function (S, Node, IO, Event, jQuery) {
  240. var $ = S.all;
  241. $('.addRule').on('click', function () {
  242. $(".not_input").hide();
  243. var form_text_template = $('.form_text_template table tbody').last().clone(true, true, true);
  244. $('.custom_from_table tbody').last().after(form_text_template);
  245. });
  246. Event.delegate(document,'change','.form_select',function(e){
  247. var formType = e.target.value;
  248. if (formType == 'select') {
  249. var form_select_template = $('.form_select_template table tbody').last().clone(true, true, true);
  250. $(e.target).parent('tr').replaceWith(form_select_template);
  251. }
  252. if (formType == 'text') {
  253. var form_text_template = $('.form_text_template table tbody').last().clone(true, true, true);
  254. $(e.target).parent('tr').replaceWith(form_text_template);
  255. }
  256. if (formType == 'textarea') {
  257. var form_textarea_template = $('.form_textarea_template table tbody').last().clone(true, true, true);
  258. $(e.target).parent('tr').replaceWith(form_textarea_template);
  259. }
  260. });
  261. var activity_submit_status = false; //按钮状态
  262. function submit_button_active() {
  263. activity_submit_status = true;
  264. $("#activity_submit").addClass('active').all('i').show();
  265. }
  266. function submit_button_default() {
  267. activity_submit_status = false;
  268. $("#activity_submit").removeClass('active').all('i').hide();
  269. }
  270. $("#activity_submit").on('click', function () {
  271. if (activity_submit_status) {
  272. return false;
  273. }
  274. submit_button_active();
  275. jQuery('.custom_from_table tr').each(function (i, item) {
  276. jQuery(item).find('input,select,checkbox,textarea').each(function (j, input) {
  277. input.name = input.name.replace(/\[\d+\]/, '['+ i +']');
  278. });
  279. });
  280. formData = IO.serialize("#activity_form");
  281. new IO({
  282. type: "post"
  283. , url: VG.conf.root_domain + '/?c=Admin_Activity_SetInteractive&a=ReqUpForm'
  284. , data: formData
  285. , success: function (data) {
  286. if (data.ok) { //ok
  287. var url = data.msg;
  288. alert('保存成功');
  289. location.reload();
  290. } else {
  291. alert('操作失败,原因:'+data.msg);
  292. }
  293. return false;
  294. }
  295. , error: function (NULL, textStatus) {
  296. alert("请求服务器失败,原因:"+textStatus);
  297. }
  298. , dataType: "json"
  299. });
  300. });
  301. });
  302. </script>
  303. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  304. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/bottom.html", 'smarty_include_vars' => array()));
  305. $this->_tpl_vars = $_smarty_tpl_vars;
  306. unset($_smarty_tpl_vars);
  307. ?>