category_edit.tpl.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  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');?>"}).defaultPassed();
  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');?>"}).defaultPassed();
  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&old_dir=<?php echo $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');?>"}).defaultPassed();
  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');?>"}).defaultPassed();
  13. })
  14. //-->
  15. </script>
  16. <form name="myform" id="myform" action="?m=admin&c=category&a=edit" 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 width="200"><?php echo L('select_model')?>:</th>
  38. <td>
  39. <?php
  40. $category_items = getcache('category_items_'.$modelid,'commons');
  41. $disabled = $category_items[$catid] ? 'disabled' : '';
  42. $models = getcache('model','commons');
  43. $model_datas = array();
  44. foreach($models as $_k=>$_v) {
  45. if($_v['siteid']!=$this->siteid) continue;
  46. $model_datas[$_v['modelid']] = $_v['name'];
  47. }
  48. echo form::select($model_datas,$modelid,'name="info[modelid]" id="modelid" '.$disabled,L('select_model'));
  49. echo L('modelid_edit_tips');
  50. ?>
  51. </td>
  52. </tr>
  53. <tr>
  54. <th width="200"><?php echo L('parent_category')?>:</th>
  55. <td>
  56. <?php echo form::select_category('category_content_'.$this->siteid,$parentid,'name="info[parentid]" id="parentid"',L('please_select_parent_category'),0,-1);?>
  57. </td>
  58. </tr>
  59. <tr>
  60. <th><?php echo L('catname')?>:</th>
  61. <td><input type="text" name="info[catname]" id="catname" class="input-text" value="<?php echo $catname;?>"></td>
  62. </tr>
  63. <tr>
  64. <th><?php echo L('catdir')?>:</th>
  65. <td><input type="text" name="info[catdir]" id="catdir" class="input-text" value="<?php echo $catdir;?>"></td>
  66. </tr>
  67. <tr>
  68. <th><?php echo L('catgory_img')?>:</th>
  69. <td><?php echo form::images('info[image]', 'image', $image, 'content');?></td>
  70. </tr>
  71. <tr>
  72. <th><?php echo L('description')?>:</th>
  73. <td>
  74. <textarea name="info[description]" maxlength="255" style="width:300px;height:60px;"><?php echo $description;?></textarea>
  75. </td>
  76. </tr>
  77. <tr>
  78. <th><?php echo L('workflow');?>:</th>
  79. <td>
  80. <?php
  81. $workflows = getcache('workflow_'.$this->siteid,'commons');
  82. if($workflows) {
  83. $workflows_datas = array();
  84. foreach($workflows as $_k=>$_v) {
  85. $workflows_datas[$_v['workflowid']] = $_v['workname'];
  86. }
  87. echo form::select($workflows_datas,$setting['workflowid'],'name="setting[workflowid]"',L('catgory_not_need_check'));
  88. } else {
  89. echo '<input type="hidden" name="setting[workflowid]" value="">';
  90. echo L('add_workflow_tips');
  91. }
  92. ?>
  93. </td>
  94. </tr>
  95. <tr>
  96. <th><?php echo L('ismenu');?>:</th>
  97. <td>
  98. <input type='radio' name='info[ismenu]' value='1' <?php if($ismenu) echo 'checked';?>> <?php echo L('yes');?>&nbsp;&nbsp;&nbsp;&nbsp;
  99. <input type='radio' name='info[ismenu]' value='0' <?php if(!$ismenu) echo 'checked';?>> <?php echo L('no');?></td>
  100. </tr>
  101. </table>
  102. </div>
  103. <div id="div_setting_2" class="contentList pad-10 hidden">
  104. <table width="100%" class="table_form">
  105. <tr>
  106. <th width="200"><?php echo L('html_category');?>:</th>
  107. <td>
  108. <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;
  109. <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');?>
  110. </td>
  111. </tr>
  112. <tr>
  113. <th><?php echo L('html_show');?>:</th>
  114. <td>
  115. <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;
  116. <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');?>
  117. </td>
  118. </tr>
  119. <tr>
  120. <th><?php echo L('category_urlrules');?>:</th>
  121. <td><div id="category_php_ruleid" style="display:<?php if($setting['ishtml']) echo 'none';?>">
  122. <?php
  123. echo form::urlrule('content','category',0,$setting['category_ruleid'],'name="category_php_ruleid"');
  124. ?>
  125. </div>
  126. <div id="category_html_ruleid" style="display:<?php if(!$setting['ishtml']) echo 'none';?>">
  127. <?php
  128. echo form::urlrule('content','category',1,$setting['category_ruleid'],'name="category_html_ruleid"');
  129. ?>
  130. </div>
  131. </td>
  132. </tr>
  133. <tr>
  134. <th><?php echo L('show_urlrules');?>:</th>
  135. <td><div id="show_php_ruleid" style="display:<?php if($setting['content_ishtml']) echo 'none';?>">
  136. <?php
  137. echo form::urlrule('content','show',0,$setting['show_ruleid'],'name="show_php_ruleid"');
  138. ?>
  139. </div>
  140. <div id="show_html_ruleid" style="display:<?php if(!$setting['content_ishtml']) echo 'none';?>">
  141. <?php
  142. echo form::urlrule('content','show',1,$setting['show_ruleid'],'name="show_html_ruleid"');
  143. ?>
  144. </div>
  145. </td>
  146. </tr>
  147. <tr>
  148. <th><?php echo L('create_to_rootdir');?>:</th>
  149. <td>
  150. <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;
  151. <input type='radio' name='setting[create_to_html_root]' value='0' <?php if(!$setting['create_to_html_root']) echo 'checked';?> > <?php echo L('no');?>
  152. (<?php echo L('create_to_rootdir_tips');?>)</td>
  153. </tr>
  154. <tr id="tr_domain" style="display:<?php if(!$setting['ishtml']) echo 'none';?>">
  155. <th><?php echo L('domain')?>:</th>
  156. <td><input type="text" name="info[url]" id="url" class="input-text" size="50" value="<?php if(preg_match('/^http:\/\/([a-z0-9\-\.]+)\/$/i',$url)) echo $url;?>"></td>
  157. </tr>
  158. </table>
  159. </div>
  160. <div id="div_setting_3" class="contentList pad-10 hidden">
  161. <table width="100%" class="table_form ">
  162. <tr>
  163. <th width="200"><?php echo L('available_styles');?>:</th>
  164. <td>
  165. <?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'))?>
  166. </td>
  167. </tr>
  168. <tr>
  169. <th width="200"><?php echo L('category_index_tpl')?>:</th>
  170. <td id="category_template">
  171. </td> </tr>
  172. <tr>
  173. <th width="200"><?php echo L('category_list_tpl')?>:</th>
  174. <td id="list_template">
  175. </td>
  176. </tr>
  177. <tr>
  178. <th width="200"><?php echo L('content_tpl')?>:</th>
  179. <td id="show_template">
  180. </td>
  181. </tr>
  182. <!--模版应用到子栏目配置-->
  183. <tr>
  184. <th width="200"><?php echo '模板应用到子栏目';?></th>
  185. <td><input type='radio' name='template_child' value='1'> <?php echo L('yes');?>&nbsp;&nbsp;&nbsp;&nbsp;
  186. <input type='radio' name='template_child' value='0' checked> <?php echo L('no');?></td></td>
  187. </tr>
  188. <!--end 模版应用到子栏目配置-->
  189. </table>
  190. </div>
  191. <div id="div_setting_4" class="contentList pad-10 hidden">
  192. <table width="100%" class="table_form ">
  193. <tr>
  194. <th width="200"><?php echo L('meta_title');?></th>
  195. <td><input name='setting[meta_title]' type='text' id='meta_title' value='<?php echo $setting['meta_title'];?>' size='60' maxlength='60'></td>
  196. </tr>
  197. <tr>
  198. <th ><?php echo L('meta_keywords');?></th>
  199. <td><textarea name='setting[meta_keywords]' id='meta_keywords' style="width:90%;height:40px"><?php echo $setting['meta_keywords'];?></textarea></td>
  200. </tr>
  201. <tr>
  202. <th ><strong><?php echo L('meta_description');?></th>
  203. <td><textarea name='setting[meta_description]' id='meta_description' style="width:90%;height:50px"><?php echo $setting['meta_description'];?></textarea></td>
  204. </tr>
  205. </table>
  206. </div>
  207. <div id="div_setting_5" class="contentList pad-10 hidden">
  208. <table width="100%" >
  209. <tr>
  210. <th width="200"><?php echo L('role_private')?>:</th>
  211. <td>
  212. <table width="100%" class="table-list">
  213. <thead>
  214. <tr>
  215. <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>
  216. </tr>
  217. </thead>
  218. <tbody>
  219. <?php
  220. $roles = getcache('role','commons');
  221. foreach($roles as $roleid=> $rolrname) {
  222. $disabled = $roleid==1 ? 'disabled' : '';
  223. ?>
  224. <tr>
  225. <td><?php echo $rolrname?></td>
  226. <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled;?> <?php echo $this->check_category_priv('init',$roleid);?> value="init,<?php echo $roleid;?>" ></td>
  227. <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled;?> <?php echo $this->check_category_priv('add',$roleid);?> value="add,<?php echo $roleid;?>" ></td>
  228. <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled;?> <?php echo $this->check_category_priv('edit',$roleid);?> value="edit,<?php echo $roleid;?>" ></td>
  229. <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled;?> <?php echo $this->check_category_priv('delete',$roleid);?> value="delete,<?php echo $roleid;?>" ></td>
  230. <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled;?> <?php echo $this->check_category_priv('listorder',$roleid);?> value="listorder,<?php echo $roleid;?>" ></td>
  231. <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled;?> <?php echo $this->check_category_priv('push',$roleid);?> value="push,<?php echo $roleid;?>" ></td>
  232. <td align="center"><input type="checkbox" name="priv_roleid[]" <?php echo $disabled;?> <?php echo $this->check_category_priv('move',$roleid);?> value="move,<?php echo $roleid;?>" ></td>
  233. </tr>
  234. <?php }?>
  235. </tbody>
  236. </table>
  237. </td>
  238. </tr>
  239. <tr><td colspan=2><hr style="border:1px dotted #F2F2F2;"></td>
  240. </tr>
  241. <tr>
  242. <th width="200"><?php echo L('group_private')?>:</th>
  243. <td>
  244. <table width="100%" class="table-list">
  245. <thead>
  246. <tr>
  247. <th align="left"><?php echo L('group_name');?></th><th><?php echo L('allow_vistor');?></th><th><?php echo L('allow_contribute');?></th>
  248. </tr>
  249. </thead>
  250. <tbody>
  251. <?php
  252. $group_cache = getcache('grouplist','member');
  253. foreach($group_cache as $_key=>$_value) {
  254. if($_value['groupid']==1) continue;
  255. ?>
  256. <tr>
  257. <td><?php echo $_value['name'];?></td>
  258. <td align="center"><input type="checkbox" name="priv_groupid[]" <?php echo $this->check_category_priv('visit',$_value['groupid'],0);?> value="visit,<?php echo $_value['groupid'];?>" ></td>
  259. <td align="center"><input type="checkbox" name="priv_groupid[]" <?php echo $this->check_category_priv('add',$_value['groupid'],0);?> value="add,<?php echo $_value['groupid'];?>" ></td>
  260. </tr>
  261. <?php }?>
  262. </tbody>
  263. </table>
  264. </td>
  265. </tr>
  266. <tr>
  267. <th width="200"><?php echo L('apply_to_child');?></th>
  268. <td><input type='radio' name='priv_child' value='1'> <?php echo L('yes');?>&nbsp;&nbsp;&nbsp;&nbsp;
  269. <input type='radio' name='priv_child' value='0' checked> <?php echo L('no');?></td></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='<?php echo $setting['presentpoint'];?>' 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='<?php echo $setting['defaultchargepoint'];?>' size='4' maxlength='4' style='text-align:center'> <select name="setting[paytype]"><option value="0" <?php if(!$setting['paytype']) echo 'selected';?>><?php echo L('readpoint');?></option><option value="1" <?php if($setting['paytype']) echo 'selected';?>><?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='<?php echo $setting['repeatchargedays'];?>' 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(){
  303. var url = $('#url').val();
  304. if(!url.match(/^http:\/\//)) $('#url').val('');
  305. })
  306. function SwapTab(name,cls_show,cls_hide,cnt,cur){
  307. for(i=1;i<=cnt;i++){
  308. if(i==cur){
  309. $('#div_'+name+'_'+i).show();
  310. $('#tab_'+name+'_'+i).attr('class',cls_show);
  311. }else{
  312. $('#div_'+name+'_'+i).hide();
  313. $('#tab_'+name+'_'+i).attr('class',cls_hide);
  314. }
  315. }
  316. }
  317. function load_file_list(id) {
  318. if(id=='') return false;
  319. $.getJSON('?m=admin&c=category&a=public_tpl_file_list&style='+id+'&catid=<?php echo $catid?>', function(data){$('#category_template').html(data.category_template);$('#list_template').html(data.list_template);$('#show_template').html(data.show_template);});
  320. }
  321. <?php if(isset($setting['template_list']) && !empty($setting['template_list'])) echo "load_file_list('".$setting['template_list']."')"?>
  322. //-->
  323. </script>