  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
    <meta http-equiv="X-UA-Compatible" content="IE=8">
<title>管理中心 - Powered By phpleft.com</title>
 <script type="text/javascript" src="<?=PL_URL?>js/common.js"></script>
<script src="<?=PL_URL?>js/win/artDialog.js?skin=default"></script>
<script src="<?=PL_URL?>js/win/plugins/iframeTools.js"></script>
<link href="<?=PL_URL?>css/page.css" type="text/css" rel="stylesheet" />
<link href="css/main.css" type="text/css" rel="stylesheet">
<link rel="stylesheet" href="<?=PL_URL?>file/editornews/themes/default/default.css" />
<link rel="stylesheet" href="<?=PL_URL?>file/editornews/plugins/code/prettify.css" />
	<script charset="utf-8" src="<?=PL_URL?>file/editornews/kindeditor.js"></script>
	<script charset="utf-8" src="<?=PL_URL?>file/editornews/lang/zh_CN.js"></script>
	<script charset="utf-8" src="<?=PL_URL?>file/editornews/plugins/code/prettify.js"></script>
	<script>
		KindEditor.ready(function(K) {
			var editor1 = K.create('textarea[id="content"]', {
				cssPath : '<?=PL_URL?>file/editornews/plugins/code/prettify.css',
				uploadJson : 'phpleft.php?file=editors&in=upload_json',
				fileManagerJson : 'phpleft.php?file=editors&in=file_manager_json',
				allowFileManager : true,
				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
						K('form[name=example]')[0].submit();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
						K('form[name=example]')[0].submit();
					});
				}
			});
			prettyPrint();
		});
	</script>
<script>
function checkall(f, t) {
	var t = t ? t : 1;
	for(var i = 0; i < f.elements.length; i++) {
		var e = f.elements[i];
		if(e.type != 'checkbox') continue;
		if(t == 0) e.checked = false;
		if(t == 1) e.checked = e.checked ? false : true;
		if(t == 2) e.checked = true;	
	}
}
</script>
</head>
<body bottommargin="0" leftmargin="0" topmargin="0" rightmargin="0">
<div class="tpis"><img src="images/icos.gif" align="absmiddle"/>当前位置：扩展插件 > 自定义标签</div>

<? include inTemplate(menu);?> 
<? if ($show=='add' or $show=='bj'){?>
<?php 
  $add = $id ? sql_show("table=$in&where=id=$id"):'';
?>
<form id="form" action="phpleft.php?file=plugins_set&in=<?=$in;?>&post=<?=$show;?>" method="post">
<input name="table_name" type="hidden" value="<?=$in;?>" />
<input name="id" type="hidden" value="<?=$id;?>" />
<table class="usertableborder" cellspacing="1" cellpadding="3" width="100%" align="center"
        border="0">
        <tr>
            <th colspan="3">
                添加标签</th>
        </tr>
        </table>
    <table class="usertableborder bb" cellspacing="1" cellpadding="3" width="100%" align="center"
        border="0">
 <tr>
            <td width="131" height="30" class="text" style="padding-right:10px; text-align:right"><strong>标签名称</strong></td>
            <td width="562" height="30"><input name="set[name]" type="text" id="name" value="<?=$add['name'];?>" size="30">
            </td>
            <td width="298" height="30"></td>
        </tr>
                  <tr>
            <td width="131" height="30" class="text" style="padding-right:10px; text-align:right"><strong>内容</strong></td>
            <td width="562" height="30"><textarea name="set[content]" cols="80" rows="20" id="content"><?=$add['content'];?></textarea>
            </td>
            <td width="298" height="30"></td>
        </tr>
         <tr>
          <td height="30" class="text" style="padding-right:10px; text-align:right"></td>
            <td height="30"><input type="submit" name="button" id="button" value=" 确 认 " class="ok"></td>
            <td height="30">&nbsp;</td>
        </tr>
        </table>
        </form>
        <?php $set=cache_read('cache.inc.php',PL_ROOT.'plugins/'.$in.'/');?>
<script type="text/javascript">
    var editor = new baidu.editor.ui.Editor({
		UEDITOR_HOME_URL:'<?=PL_URL?>file/editor/',
        iframeCssUrl :'<?=PL_URL?>file/editor/themes/default/iframe.css',
		id: 'content',
		textarea: 'set[content]' ,
		initialContent: '',
		 toolbars:[
                ['<?=str_replace(",","','",$set['editor']);?>']
            ]
    });
	
    editor.render('content');
	

</script>           
 
<? }else if ($show=='set'){?>
<?php $set=cache_read('cache.inc.php',PL_ROOT.'plugins/'.$in.'/');?>
<form id="form" action="phpleft.php?file=plugins_set&in=<?=$in;?>&post=set" method="post">
<input name="table_name" type="hidden" value="<?=$in;?>" />
<table class="usertableborder bb" cellspacing="1" cellpadding="3" width="100%" align="center"
        border="0">
        <tr>
            <th colspan="3">
                标签设置</th>
        </tr>
     
       
        <tr>
          <td height="30" class="text" style="padding-right:10px; text-align:right"></td>
            <td height="30"><input type="submit" name="button" id="button" value=" 确 认 " class="ok"></td>
            <td height="30">&nbsp;</td>
        </tr>
       
    </table>
</form>
<? }else{?>
<form id="form2" name="form2" method="post" action="phpleft.php?file=plugins_set&in=<?=$in;?>&post=list">
<input name="table_name" type="hidden" value="<?=$in;?>" />
 <table class="usertableborder input" cellspacing="1" cellpadding="3" width="100%" align="center"
        border="0">
      <tr>
            <th>
        信息列表</th>
        </tr>
</table>
    <table class="usertableborder bb" cellspacing="0" cellpadding="3" width="100%" align="center"
        border="0">

        <tr class="list1">
        <td width="111" height="30" align="left"><input type="checkbox" onClick="checkall(this.form);"/></td>
          <td widtd="100" height="30" valign="top">
          名称
          </td>
                 <td widtd="100" height="30" valign="top">
          调用方式
          </td>
     
         
            <td widtd="249" height="30">编辑</td>
              <td width="359" height="30" widtd="263">&nbsp;</td>
             
        </tr>
       <?php $list=sql_list("table=$in&page=".$page."&pagesize=13&pageoff=1&order=id desc"); ?>
       <?php if($list) {?>
       <?php foreach($list as $i=>$t) { ?>
                 <tr class="list<?php if($i%2==1) echo '1'?>">
                 <td height="30" style="padding-right:20px;" align="left"><input type="checkbox" name="tab[]" value="<?=$t['id']?>"/></td>
          <td width="175" height="30" align="left"><?=$t['name']?>&nbsp; &nbsp; <a href="#" onclick="art.dialog({padding: 0,title: '预览',content: '<?=strip_tags($t['content'])?>',lock: true});">预览</a>         </td>
          <td width="175" height="30" align="left">{tag(<?=$t['id']?>)}</td>
        <td width="166" height="30"> <a href="phpleft.php?file=plugins_set&in=<?=$in;?>&show=bj&id=<?=$t['id'];?>"><img src="<?=PL_URL?>ico/edit.png" alt="编辑" border="0"></a></td>
               
              <td height="30">&nbsp;</td>
      </tr>
      <? }?>
      <? }else {?>
      <tr align="center" class="list">
        <td height="30" colspan="8" align="left">
        暂无信息
        </td>
        </tr>
      <? }?>
           </table>
            <table class="usertableborder input" cellspacing="1" cellpadding="3" width="100%" align="center" border="0">
<tr>
  <td height="30"><input type="submit" name="button" id="button" value=" 删 除 " class="ok"></td>
            <td height="30" class="usertablerow1">&nbsp;</td>
        </tr>
       
    </table>
           </form>
           <div class="pager" style="margin-top:10px;"><?php echo $pagenav;?></div>
 <? }?>
  
</body>
</html>
