category_add.tpl.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. <?php
  2. defined('IN_ADMIN') or exit('No permission resources.');
  3. include $this->admin_tpl('header');?>
  4. <script type="text/javascript">
  5. <!--
  6. $(function(){
  7. $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}});
  8. $("#modelid").formValidator({onshow:"<?php echo L('select_model');?>",onfocus:"<?php echo L('select_model');?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L('select_model');?>"});
  9. $("#catname").formValidator({onshow:"<?php echo L('input_catname');?>",onfocus:"<?php echo L('input_catname');?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L('input_catname');?>"});
  10. $("#catdir").formValidator({onshow:"<?php echo L('input_dirname');?>",onfocus:"<?php echo L('input_dirname');?>"}).regexValidator({regexp:"^([a-zA-Z0-9、-]|[_]|[ ]){0,30}$",onerror:"<?php echo L('enter_the_correct_catname');?>"}).inputValidator({min:1,onerror:"<?php echo L('input_dirname');?>"}).ajaxValidator({type : "get",url : "",data :"m=admin&c=category&a=public_check_catdir",datatype : "html",cached:false,getdata:{parentid:'parentid'},async:'false',success : function(data){ if( data == "1" ){return true;}else{return false;}},buttons: $("#dosubmit"),onerror : "<?php echo L('catname_have_exists');?>",onwait : "<?php echo L('connecting');?>"});
  11. $("#url").formValidator({onshow:" ",onfocus:"<?php echo L('domain_name_format');?>",tipcss:{width:'300px'},empty:true}).inputValidator({onerror:"<?php echo L('domain_name_format');?>"}).regexValidator({regexp:"http:\/\/(.+)\/$",onerror:"<?php echo L('domain_end_string');?>"});
  12. $("#template_list").formValidator({onshow:"<?php echo L('template_setting');?>",onfocus:"<?php echo L('template_setting');?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L('template_setting');?>"});
  13. })
  14. //-->
  15. </script>
  16. <form name="myform" id="myform" action="?m=admin&c=category&a=add" method="post">
  17. <div class="pad-10">
  18. <div class="col-tab">
  19. <ul class="tabBut cu-li">
  20. <li id="tab_setting_1" class="on" onclick="SwapTab('setting','on','',6,1);"><?php echo L('catgory_basic');?></li>
  21. <li id="tab_setting_2" onclick="SwapTab('setting','on','',6,2);"><?php echo L('catgory_createhtml');?></li>
  22. <li id="tab_setting_3" onclick="SwapTab('setting','on','',6,3);"><?php echo L('catgory_template');?></li>
  23. <li id="tab_setting_4" onclick="SwapTab('setting','on','',6,4);"><?php echo L('catgory_seo');?></li>
  24. <?php
  25. $amdinid=$_SESSION['userid'];
  26. if($amdinid == 1){
  27. ?>
  28. <li id="tab_setting_5" onclick="SwapTab('setting','on','',6,5);"><?php echo L('catgory_private');?></li>
  29. <?php
  30. }
  31. ?>
  32. <li id="tab_setting_6" onclick="SwapTab('setting','on','',6,6);"><?php echo L('catgory_readpoint');?></li>
  33. </ul>
  34. <div id="div_setting_1" class="contentList pad-10">
  35. <table width="100%" class="table_form ">
  36. <tr>
  37. <th><?php echo L('add_category_types');?>:</th>
  38. <td>
  39. <input type='radio' name='addtype' value='0' checked id="normal_addid"> <?php echo L('normal_add');?>&nbsp;&nbsp;&nbsp;&nbsp;
  40. <input type='radio' name='addtype' value='1' onclick="$('#catdir_tr').html(' ');$('#normal_add').html(' ');$('#normal_add').css('display','none');$('#batch_add').css('display','');$('#normal_addid').attr('disabled','true');this.disabled='true'"> <?php echo L('batch_add');?></td>
  41. </tr>
  42. <tr>
  43. <th width="200"><?php echo L('select_model')?>:</th>
  44. <td>
  45. <?php
  46. $model_datas = array();
  47. foreach($models as $_k=>$_v) {
  48. if($_v['siteid']!=$this->siteid) continue;
  49. $model_datas[$_v['modelid']] = $_v['name'];
  50. }
  51. echo form::select($model_datas,$modelid,'name="info[modelid]" id="modelid" onchange="change_tpl(this.value)"',L('select_model'));
  52. ?>
  53. </td>
  54. </tr>
  55. <tr>
  56. <th width="200"><?php echo L('parent_category')?>:</th>
  57. <td>
  58. <?php echo form::select_category('category_content_'.$this->siteid,$parentid,'name="info[parentid]" id="parentid"',L('please_select_parent_category'),0,-1);?>
  59. </td>
  60. </tr>
  61. <tr>
  62. <th><?php echo L('catname')?>:</th>
  63. <td>
  64. <span id="normal_add"><input type="text" name="info[catname]" id="catname" class="input-text" value=""></span>
  65. <span id="batch_add" style="display:none">
  66. <table width="100%" class="sss"><tr><td width="310"><textarea name="batch_add" maxlength="255" style="width:300px;height:60px;"></textarea></td>
  67. <td align="left">
  68. <?php echo L('batch_add_tips');?>
  69. </td></tr></table>
  70. </span>
  71. </td>
  72. </tr>
  73. <tr id="catdir_tr">
  74. <th><?php echo L('catdir')?>:</th>
  75. <td><input type="text" name="info[catdir]" id="catdir" class="input-text" value=""></td>
  76. </tr>
  77. <tr>
  78. <th><?php echo L('catgory_img')?>:</th>
  79. <td><?php echo form::images('info[image]', 'image', $image, 'content');?></td>
  80. </tr>
  81. <tr>
  82. <th><?php echo L('description')?>:</th>
  83. <td>
  84. <textarea name="info[description]" maxlength="255" style="width:300px;height:60px;"><?php echo $description;?></textarea>
  85. </td>
  86. </tr>
  87. <tr>
  88. <th><?php echo L('workflow');?>:</th>
  89. <td>
  90. <?php
  91. $workflows = getcache('workflow_'.$this->siteid,'commons');
  92. if($workflows) {
  93. $workflows_datas = array();
  94. foreach($workflows as $_k=>$_v) {
  95. $workflows_datas[$_v['workflowid']] = $_v['workname'];
  96. }
  97. echo form::select($workflows_datas,'','name="setting[workflowid]"',L('catgory_not_need_check'));
  98. } else {
  99. echo '<input type="hidden" name="setting[workflowid]" value="">';
  100. echo L('add_workflow_tips');
  101. }
  102. ?>
  103. </td>
  104. </tr>
  105. <tr>
  106. <th><?php echo L('ismenu');?>:</th>
  107. <td>
  108. <input type='radio' name='info[ismenu]' value='1' checked> <?php echo L('yes');?>&nbsp;&nbsp;&nbsp;&nbsp;
  109. <input type='radio' name='info[ismenu]' value='0' > <?php echo L('no');?></td>
  110. </tr>
  111. </table>
  112. </div>
  113. <div id="div_setting_2" class="contentList pad-10 hidden">
  114. <table width="100%" class="table_form ">
  115. <tr>
  116. <th width="200"><?php echo L('html_category');?>:</th>
  117. <td>
  118. <input type='radio' name='setting[ishtml]' value='1' <?php if($setting['ishtml']) echo 'checked';?> onClick="$('#category_php_ruleid').css('display','none');$('#category_html_ruleid').css('display','');$('#tr_domain').css('display','');"> <?php echo L('yes');?>&nbsp;&nbsp;&nbsp;&nbsp;
  119. <input type='radio' name='setting[ishtml]' value='0' <?php if(!$setting['ishtml']) echo 'checked';?> onClick="$('#category_php_ruleid').css('display','');$('#category_html_ruleid').css('display','none');$('#tr_domain').css('display','none');"> <?php echo L('no');?>
  120. </td>
  121. </tr>
  122. <tr>
  123. <th><?php echo L('html_show');?>:</th>
  124. <td>
  125. <input type='radio' name='setting[content_ishtml]' value='1' <?php if($setting['content_ishtml']) echo 'checked';?> onClick="$('#show_php_ruleid').css('display','none');$('#show_html_ruleid').css('display','')"> <?php echo L('yes');?>&nbsp;&nbsp;&nbsp;&nbsp;
  126. <input type='radio' name='setting[content_ishtml]' value='0' <?php if(!$setting['content_ishtml']) echo 'checked';?> onClick="$('#show_php_ruleid').css('display','');$('#show_html_ruleid').css('display','none')"> <?php echo L('no');?>
  127. </td>
  128. </tr>
  129. <tr>
  130. <th><?php echo L('category_urlrules');?>:</th>
  131. <td><div id="category_php_ruleid" style="display:<?php if($setting['ishtml']) echo 'none';?>">
  132. <?php
  133. echo form::urlrule('content','category',0,$setting['category_ruleid'],'name="category_php_ruleid"');
  134. ?>
  135. </div>
  136. <div id="category_html_ruleid" style="display:<?php if(!$setting['ishtml']) echo 'none';?>">
  137. <?php
  138. echo form::urlrule('content','category',1,$setting['category_ruleid'],'name="category_html_ruleid"');
  139. ?>
  140. </div>
  141. </td>
  142. </tr>
  143. <tr>
  144. <th><?php echo L('show_urlrules');?>:</th>
  145. <td><div id="show_php_ruleid" style="display:<?php if($setting['content_ishtml']) echo 'none';?>">
  146. <?php
  147. echo form::urlrule('content','show',0,$setting['category_ruleid'],'name="show_php_ruleid"');
  148. ?>
  149. </div>
  150. <div id="show_html_ruleid" style="display:<?php if(!$setting['content_ishtml']) echo 'none';?>">
  151. <?php
  152. echo form::urlrule('content','show',1,$setting['category_ruleid'],'name="show_html_ruleid"');
  153. ?>
  154. </div>
  155. </td>
  156. </tr>
  157. <tr>
  158. <th><?php echo L('create_to_rootdir');?>:</th>
  159. <td>
  160. <input type='radio' name='setting[create_to_html_root]' value='1' <?php if($setting['create_to_html_root']) echo 'checked';?> > <?php echo L('yes');?>&nbsp;&nbsp;&nbsp;&nbsp;
  161. <input type='radio' name='setting[create_to_html_root]' value='0' <?php if(!$setting['create_to_html_root']) echo 'checked';?> > <?php echo L('no');?>
  162. (<?php echo L('create_to_rootdir_tips');?>)</td>
  163. </tr>
  164. <tr id="tr_domain" style="display:<?php if(!$setting['ishtml']) echo 'none';?>">
  165. <th><?php echo L('domain')?>:</th>
  166. <td><input type="text" name="info[url]" id="url" class="input-text" size="50" value=""></td>
  167. </tr>
  168. </table>
  169. </div>
  170. <div id="div_setting_3" class="contentList pad-10 hidden">
  171. <table width="100%" class="table_form ">
  172. <tr>
  173. <th width="200"><?php echo L('available_styles');?>:</th>
  174. <td>
  175. <?php echo form::select($template_list, $setting['template_list'], 'name="setting[template_list]" id="template_list" onchange="load_file_list(this.value)"', L('please_select'))?>
  176. </td>
  177. </tr>
  178. <tr>
  179. <th width="200"><?php echo L('category_index_tpl')?>:</th>
  180. <td id="category_template">
  181. </td>
  182. </tr>
  183. <tr>
  184. <th width="200"><?php echo L('category_list_tpl')?>:</th>
  185. <td id="list_template">
  186. </td>
  187. </tr>
  188. <tr>
  189. <th width="200"><?php echo L('content_tpl')?>:</th>
  190. <td id="show_template">
  191. </td>
  192. </tr>
  193. </table>
  194. </div>
  195. <div id="div_setting_4" class="contentList pad-10 hidden">
  196. <table width="100%" class="table_form ">
  197. <tr>
  198. <th width="200"><?php echo L('meta_title');?></th>
  199. <td><input name='setting[meta_title]' type='text' id='meta_title' value='<?php echo $setting['meta_title'];?>' size='60' maxlength='60'></td>
  200. </tr>
  201. <tr>
  202. <th ><?php echo L('meta_keywords');?></th>
  203. <td><textarea name='setting[meta_keywords]' id='meta_keywords' style="width:90%;height:40px"><?php echo $setting['meta_keywords'];?></textarea></td>
  204. </tr>
  205. <tr>
  206. <th ><strong><?php echo L('meta_description');?></th>
  207. <td><textarea name='setting[meta_description]' id='meta_description' style="width:90%;height:50px"><?php echo $setting['meta_description'];?></textarea></td>
  208. </tr>
  209. </table>
  210. </div>
  211. <div id="div_setting_5" class="contentList pad-10 hidden">
  212. <table width="100%" >
  213. <tr>
  214. <th width="200"><?php echo L('role_private')?>:</th>
  215. <td>
  216. <table width="100%" class="table-list">
  217. <thead>
  218. <tr>
  219. <th align="left"><?php echo L('role_name');?></th><th><?php echo L('view');?></th><th><?php echo L('add');?></th><th><?php echo L('edit');?></th><th><?php echo L('delete');?></th><th><?php echo L('listorder');?></th><th><?php echo L('push');?></th><th><?php echo L('move');?></th>
  220. </tr>
  221. </thead>
  222. <tbody>
  223. <?php
  224. $roles = getcache('role','commons');
  225. foreach($roles as $roleid=> $rolrname) {
  226. $disabled = $roleid==1 ? 'disabled' : '';
  227. $checked = $roleid==2 ? ' checked="chedcked"' : '';
  228. ?>
  229. <tr>
  230. <td><?php echo $rolrname?></td>
  231. <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled; echo $checked;?> value="init,<?php echo $roleid;?>" ></td>
  232. <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled; echo $checked;?> value="add,<?php echo $roleid;?>" ></td>
  233. <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled; echo $checked;?> value="edit,<?php echo $roleid;?>" ></td>
  234. <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled; echo $checked;?> value="delete,<?php echo $roleid;?>" ></td>
  235. <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled; echo $checked;?> value="listorder,<?php echo $roleid;?>" ></td>
  236. <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled; echo $checked;?> value="push,<?php echo $roleid;?>" ></td>
  237. <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled; echo $checked;?> value="move,<?php echo $roleid;?>" ></td>
  238. </tr>
  239. <?php }?>
  240. </tbody>
  241. </table>
  242. </td>
  243. </tr>
  244. <tr><td colspan=2><hr style="border:1px dotted #F2F2F2;"></td>
  245. </tr>
  246. <tr>
  247. <th width="200"><?php echo L('group_private')?>:</th>
  248. <td>
  249. <table width="100%" class="table-list">
  250. <thead>
  251. <tr>
  252. <th align="left"><?php echo L('group_name');?></th><th><?php echo L('allow_vistor');?></th><th><?php echo L('allow_contribute');?></th>
  253. </tr>
  254. </thead>
  255. <tbody>
  256. <?php
  257. $group_cache = getcache('grouplist','member');
  258. foreach($group_cache as $_key=>$_value) {
  259. if($_value['groupid']==1) continue;
  260. ?>
  261. <tr>
  262. <td><?php echo $_value['name'];?></td>
  263. <td align="center"><input type="checkbox" name="priv_groupid[]" value="visit,<?php echo $_value['groupid'];?>" ></td>
  264. <td align="center"><input type="checkbox" name="priv_groupid[]" value="add,<?php echo $_value['groupid'];?>" ></td>
  265. </tr>
  266. <?php }?>
  267. </tbody>
  268. </table>
  269. </td>
  270. </tr>
  271. </table>
  272. </div>
  273. <div id="div_setting_6" class="contentList pad-10 hidden">
  274. <table width="100%" class="table_form">
  275. <tr>
  276. <th width="200"><?php echo L('contribute_add_point');?></th>
  277. <td><input name='setting[presentpoint]' type='text' value='1' size='5' maxlength='5' style='text-align:center'> <?php echo L('contribute_add_point_tips');?></td>
  278. </tr>
  279. <tr>
  280. <th ><?php echo L('default_readpoint');?></th>
  281. <td><input name='setting[defaultchargepoint]' type='text' value='0' size='4' maxlength='4' style='text-align:center'> <select name="setting[paytype]"><option value="0"><?php echo L('readpoint');?></option><option value="1"><?php echo L('money');?></option></select> <?php echo L('readpoint_tips');?></td>
  282. </tr>
  283. <tr>
  284. <th><?php echo L('repeatchargedays');?></th>
  285. <td>
  286. <input name='setting[repeatchargedays]' type='text' value='1' size='4' maxlength='4' style='text-align:center'> <?php echo L('repeat_tips');?>&nbsp;&nbsp;
  287. <font color="red"><?php echo L('repeat_tips2');?></font></td>
  288. </tr>
  289. </table>
  290. </div>
  291. <div class="bk15"></div>
  292. <input name="catid" type="hidden" value="<?php echo $catid;?>">
  293. <input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="button">
  294. </form>
  295. </div>
  296. </div>
  297. <!--table_form_off-->
  298. </div>
  299. <script language="JavaScript">
  300. <!--
  301. window.top.$('#display_center_id').css('display','none');
  302. function SwapTab(name,cls_show,cls_hide,cnt,cur){
  303. for(i=1;i<=cnt;i++){
  304. if(i==cur){
  305. $('#div_'+name+'_'+i).show();
  306. $('#tab_'+name+'_'+i).attr('class',cls_show);
  307. }else{
  308. $('#div_'+name+'_'+i).hide();
  309. $('#tab_'+name+'_'+i).attr('class',cls_hide);
  310. }
  311. }
  312. }
  313. function change_tpl(modelid) {
  314. if(modelid) {
  315. $.getJSON('?m=admin&c=category&a=public_change_tpl&modelid='+modelid, function(data){$('#template_list').val(data.template_list);$('#category_template').html(data.category_template);$('#list_template').html(data.list_template);$('#show_template').html(data.show_template);});
  316. }
  317. }
  318. function load_file_list(id) {
  319. if(id=='') return false;
  320. $.getJSON('?m=admin&c=category&a=public_tpl_file_list&style='+id+'&catid=<?php echo $parentid?>', function(data){$('#category_template').html(data.category_template);$('#list_template').html(data.list_template);$('#show_template').html(data.show_template);});
  321. }
  322. <?php if($modelid) echo "change_tpl($modelid)";?>
  323. //-->
  324. </script>