special_add.tpl.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <?php
  2. defined('IN_ADMIN') or exit('No permission resources.');
  3. $show_validator = $show_scroll = $show_dialog = 1;
  4. include $this->admin_tpl('header', 'admin');
  5. ?>
  6. <form method="post" action="?m=special&c=special&a=add" id="myform">
  7. <div class="pad-10">
  8. <div class="col-tab">
  9. <ul class="tabBut cu-li">
  10. <li id="tab_setting_1" class="on" onclick="SwapTab('setting','on','',6,1);"><?php echo L('catgory_basic', '', 'admin');?></li>
  11. <li id="tab_setting_2" onclick="SwapTab('setting','on','',6,2);"><?php echo L('extend_setting')?></li>
  12. </ul>
  13. <div id="div_setting_1" class="contentList pad-10">
  14. <table width="100%" class="table_form ">
  15. <tbody>
  16. <tr>
  17. <th width="200"><?php echo L('special_title')?>:</th>
  18. <td><input name="special[title]" id="title" class="input-text" type="text" size="40"></td>
  19. </tr>
  20. <tr>
  21. <th><?php echo L('special_banner')?>:</th>
  22. <td><?php echo form::images('special[banner]', 'banner', '', 'special', '', 40)?></td>
  23. </tr>
  24. <tr>
  25. <th><?php echo L('sepcial_thumb')?>:</th>
  26. <td><?php echo form::images('special[thumb]', 'thumb', '', 'special', '', 40, '', '', '', array(350, 350))?></td>
  27. </tr>
  28. <tr>
  29. <th><?php echo L('special_intro')?>:</th>
  30. <td><textarea name="special[description]" id="description" cols="50" rows="6"></textarea></td>
  31. </tr>
  32. <tr>
  33. <th align="right" valign="top"><?php echo L('ishtml')?>:</th>
  34. <td valign="top"><?php echo form::radio(array('1'=>L('yes'), '0'=>L('no')),'1', 'name="special[ishtml]"');?>
  35. </td>
  36. </tr>
  37. <tr id="file_div" style="display:'block';">
  38. <th align="right" valign="top"><?php echo L('special_filename')?>:<br /><span style="font-size:9px;color:#ff4400"><?php echo L('submit_no_edit')?></span></th>
  39. <td valign="top"><input type="text" name="special[filename]" id="filename" class="input-text" value="<?php echo $info['filename']?>" size="20">
  40. </td>
  41. </tr>
  42. <tr>
  43. <th><?php echo L('special_type')?>:<a href="javascript:addItem()" title="<?php echo L('add')?>"><span style="color:red;" >+</span></a></th>
  44. <td valign="top"><div id="option_list">
  45. <div class="mb6"><span><?php echo L('type_name')?>:<input type="text" id="type_name" name="type[1][name]" class="input-text" size="15">&nbsp;&nbsp;<?php echo L('type_path')?>:<input type="text" name="type[1][typedir]" id="type_path" class="input-text" size="15">&nbsp;&nbsp;<?php echo L('listorder')?>:<input type="text" name="type[<?php echo $k?>][listorder]" value="1" size="6" class="input-text" ></span>&nbsp;<span id="typeTip"></span></div>
  46. </div>
  47. </td>
  48. </tr>
  49. </tbody>
  50. </table>
  51. </div>
  52. <div id="div_setting_2" class="contentList pad-10 hidden">
  53. <table width="100%" class="table_form ">
  54. <tr>
  55. <th width="200"><?php echo L('pics_news')?>:</th>
  56. <td><span id="relation"></span><input type="button" class="button" value="<?php echo L('choose_pic_news')?>" onclick="import_info('?m=special&c=special&a=public_get_pics','<?php echo L('choose_pic_news')?>', 'msg_id', 'relation', 'pics');"><input type="hidden" name="special[pics]" value="" id="pics"><span class="onShow">(<?php echo L('choose_pic_model')?>)</span></td>
  57. </tr>
  58. <tr>
  59. <th><?php echo L('add_vote')?>:</th>
  60. <td><span id="vote_msg"></span><input type="button" class="button" value="<?php echo L('choose_exist_vote')?>" onclick="import_info('?m=vote&c=vote&a=public_get_votelist&from_api=1&target=dialog','<?php echo L('choose_vote')?>', 'msg_id', 'vote_msg', 'voteid');"><input type="hidden" name="special[voteid]" value="" id="voteid">&nbsp;<input type="button" class="button" value="<?php echo L('add_new_vote')?>" onclick="import_info('?m=vote&c=vote&a=add&from_api=1&target=dialog','<?php echo L('add_new_vote')?>', 'subject_title', 'vote_msg', 'voteid');"></td>
  61. </tr>
  62. <tr>
  63. <th align="right" valign="top"><?php echo L('index_page')?>:</th>
  64. <td valign="top"><?php echo form::radio(array('0'=>L('no'), '1'=>L('yes')), '0', 'name="special[ispage]"');?>
  65. </td>
  66. </tr>
  67. <tr>
  68. <th align="right" valign="top"><?php echo L('special_status')?>:</th>
  69. <td valign="top"><?php echo form::radio(array('0'=>L('open'), '1'=>L('pause')), '0', 'name="special[disabled]"');?>
  70. </td>
  71. </tr>
  72. <tr>
  73. <th align="right" valign="top"><?php echo L('template_style')?>:</th>
  74. <td valign="top"><?php echo form::select($template_list, $info['default_style'], 'name="special[style]" id="style" onchange="load_file_list(this.value)"', L('please_select'))?>
  75. <script type="text/javascript">$.getJSON('?m=admin&c=category&a=public_tpl_file_list&style=<?php echo $info['default_style']?>&module=special&templates=index|list|show&name=special', function(data){$('#index_template').html(data.index_template);$('#list_template').html(data.list_template);$('#show_template').html(data.show_template);});</script>
  76. </td>
  77. </tr>
  78. <tr>
  79. <th align="right" valign="top"><?php echo L('special_template')?>:</th>
  80. <td valign="top" id="index_template"><?php echo form::select_template('default', 'special', '', 'name="special[index_template]"', 'index');?>
  81. </td>
  82. </tr>
  83. <tr>
  84. <th align="right" valign="top"><?php echo L('special_type_template')?>:</th>
  85. <td valign="top" id="list_template"><?php echo form::select_template('default', 'special', '', 'name="special[list_template]"', 'list');?>
  86. </td>
  87. </tr>
  88. <tr>
  89. <th align="right" valign="top"><?php echo L('special_content_template')?>:</th>
  90. <td valign="top" id="show_template"><?php echo form::select_template('default', 'special', '', 'name="special[show_template]"', 'show');?>
  91. </td>
  92. </tr>
  93. </table>
  94. </div>
  95. <div class="bk15"></div>
  96. <input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="button">
  97. </div></div>
  98. </form>
  99. </body>
  100. </html>
  101. <script type="text/javascript">
  102. function load_file_list(id) {
  103. $.getJSON('?m=admin&c=category&a=public_tpl_file_list&style='+id+'&module=special&templates=index|list|show&name=special', function(data){$('#index_template').html(data.index_template);$('#list_template').html(data.list_template);$('#show_template').html(data.show_template);});
  104. }
  105. function import_info(url, title, msgID, htmlID, valID) {
  106. window.top.art.dialog({id:'selectid',iframe:url, title:title, width:'600', height:'400', lock:true},
  107. function(){
  108. var d = window.top.art.dialog({id:'selectid'}).data.iframe;
  109. var form = d.document.getElementById(msgID);
  110. var text = form.value;
  111. var data = text.split('|');
  112. if (data[2]) {
  113. $('#'+htmlID).html('<ul id="relation_'+htmlID+'" class="list-dot"><li><span>'+data[2]+'</span><a onclick="remove_relation(\''+htmlID+'\', \''+valID+'\')" class="close" href="javascript:;"></a></li></ul>');
  114. } else {
  115. var dosubmit = d.document.getElementById('dosubmit');
  116. dosubmit.click();
  117. $('#'+htmlID).html('<ul id="relation_'+htmlID+'" class="list-dot"><li><span>'+text+'</span><a onclick="remove_relation(\''+htmlID+'\', \''+valID+'\')" class="close" href="javascript:;"></a></li></ul>');
  118. }
  119. $('#'+valID).val(text);
  120. window.top.art.dialog({id:'selectid'}).close();
  121. return false;
  122. },
  123. function(){
  124. window.top.art.dialog({id:'selectid'}).close();
  125. });void(0);
  126. }
  127. function remove_relation(htmlID, valID) {
  128. $('#relation_'+htmlID).html('');
  129. $('#'+valID).val('');
  130. }
  131. function addItem() {
  132. var n = $('#option_list').find('input[name]').length/3+1;
  133. var newOption = '<div class="mb6"><span><?php echo L('type_name')?>:<input type="text" name="type['+n+'][name]" class="input-text" size="15">&nbsp;&nbsp;<?php echo L('type_path')?>:<input type="text" name="type['+n+'][typedir]" class="input-text" size="15">&nbsp;&nbsp;<?php echo L('listorder')?>:<input type="text" name="type['+n+'][listorder]" value="'+n+'" size="6" class="input-text" ></span>&nbsp;<a href="javascript:;" onclick="descItem(this, '+n+');"><?php echo L('remove')?></a></div>';
  134. $('#option_list').append(newOption);
  135. }
  136. function descItem(a, id) {
  137. $(a).parent().append('<input type="hidden" name="type['+id+'][del]" value="1">');
  138. $(a).parent().fadeOut();
  139. }
  140. function SwapTab(name,cls_show,cls_hide,cnt,cur){
  141. for(i=1;i<=cnt;i++){
  142. if(i==cur){
  143. $('#div_'+name+'_'+i).show();
  144. $('#tab_'+name+'_'+i).attr('class',cls_show);
  145. }else{
  146. $('#div_'+name+'_'+i).hide();
  147. $('#tab_'+name+'_'+i).attr('class',cls_hide);
  148. }
  149. }
  150. }
  151. $(document).ready(function(){
  152. $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'220',height:'70'}, function(){this.close();$(obj).focus();})}});
  153. $('#title').formValidator({autotip:true,onshow:"<?php echo L('please_input_special_title')?>",onfocus:"<?php echo L('min_3_title')?>",oncorrect:"<?php echo L('true')?>"}).inputValidator({min:1,onerror:"<?php echo L('please_input_special_title')?>"}).ajaxValidator({type:"get",url:"",data:"m=special&c=special&a=public_check_special",datatype:"html",cached:false,async:'true',success : function(data) {
  154. if( data == "1" )
  155. {
  156. return true;
  157. }
  158. else
  159. {
  160. return false;
  161. }
  162. },
  163. error: function(){alert("<?php echo L('server_no_data')?>");},
  164. onerror : "<?php echo L('special_exist')?>",
  165. onwait : "<?php echo L('checking')?>"
  166. });
  167. $('#banner').formValidator({autotip:true,onshow:"<?php echo L('please_upload_banner')?>",oncorrect:"<?php echo L('true')?>"}).inputValidator({min:1,onerror:"<?php echo L('please_upload_banner')?>"});
  168. $('#thumb').formValidator({autotip:true,onshow:"<?php echo L('please_upload_thumb')?>",oncorrect:"<?php echo L('true')?>"}).inputValidator({min:1,onerror:"<?php echo L('please_upload_thumb')?>"});
  169. $('#filename').formValidator({autotip:true,onshow:"<?php echo L('special_file')?>",onfocus:'<?php echo L('use_letters')?>',oncorrect:"<?php echo L('true')?>"}).functionValidator({
  170. fun:function(val,elem){
  171. if($("input:radio[type='radio'][checked]").val()==0){
  172. return true;
  173. } else if($("input:radio[type='radio'][checked]").val()==1 && val==''){
  174. return "<?php echo L('please_input_name')?>"
  175. } else {
  176. return true;
  177. }
  178. }
  179. }).regexValidator({regexp:"^\\w*$", onerror:"<?php echo L('error')?>"});
  180. $("#type_name").formValidator({tipid:"typeTip",onshow:"<?php echo L('input_type_name')?>",onfocus:"<?php echo L('input_type_name')?>",oncorrect:"<?php echo L('true')?>"}).inputValidator({min:1,onerror:"<?php echo L('input_type_name')?>"});
  181. $('#type_path').formValidator({tipid:"typeTip",onshow:"<?php echo L('input_type_path')?>",onfocus:"<?php echo L('input_type_path')?>",oncorrect:"<?php echo L('true')?>"}).inputValidator({min:2,onerror:"<?php echo L('input_type_path')?>"}).regexValidator({regexp:"^\\w*$", onerror:"<?php echo L('error')?>"});
  182. });
  183. $("input:radio[name='special[ishtml]']").click(function (){
  184. if($("input:radio[name='special[ishtml]'][checked]").val()==0) {
  185. $("#file_div").hide();
  186. } else if($("input:radio[type='radio'][checked]").val()==1) {
  187. $("#file_div").show();
  188. }
  189. });
  190. </script>