Browse Source

增加自定义模板功能,可以自行保存模板以方便后续使用;增加页面注释填写功能,可填写注释以方便后期查阅页面修改记录

star7th 9 years ago
parent
commit
7b3deb17b2

+ 3 - 0
Application/Home/Controller/PageController.class.php

@@ -161,6 +161,7 @@ class PageController extends BaseController {
         $login_user = $this->checkLogin();
         $page_id = I("page_id/d") ? I("page_id/d") : 0 ;
         $page_title = I("page_title") ?I("page_title") : L("default_title");
+        $page_comments = I("page_comments") ?I("page_comments") :'';
         $page_content = I("page_content");
         $cat_id = I("cat_id/d")? I("cat_id/d") : 0;
         $item_id = I("item_id/d")? I("item_id/d") : 0;
@@ -174,6 +175,7 @@ class PageController extends BaseController {
 
         $data['page_title'] = $page_title ;
         $data['page_content'] = $page_content ;
+        $data['page_comments'] = $page_comments ;
         $data['s_number'] = $s_number ;
         $data['item_id'] = $item_id ;
         $data['cat_id'] = $cat_id ;
@@ -190,6 +192,7 @@ class PageController extends BaseController {
                 'item_id'=>$page['item_id'],
                 'cat_id'=>$page['cat_id'],
                 'page_title'=>$page['page_title'],
+                'page_comments'=>$page['page_comments'],
                 'page_content'=>base64_encode( gzcompress($page['page_content'], 9)),
                 's_number'=>$page['s_number'],
                 'addtime'=>$page['addtime'],

+ 71 - 0
Application/Home/Controller/TemplateController.class.php

@@ -0,0 +1,71 @@
+<?php
+namespace Home\Controller;
+use Think\Controller;
+class TemplateController extends BaseController {
+
+
+    //保存
+    public function save(){
+        $login_user = $this->checkLogin();
+
+        $template_title = I("template_title");
+        $template_content = I("template_content");
+
+        $data['username'] = $login_user['username'] ;
+        $data['uid'] = $login_user['uid'] ;
+        $data['template_title'] = $template_title ;
+        $data['template_content'] = $template_content ;
+        $data['addtime'] = time() ;
+        
+
+        $id = D("Template")->add($data);
+        $return = D("Template")->where(" id = '$id' ")->find();
+
+        if (!$return) {
+            $return['error_code'] = 10103 ;
+            $return['error_message'] = 'request  fail' ;
+        }
+
+        $this->sendResult($return);
+        
+    }
+
+    //获取我的模板列表
+    public function getList(){
+        $login_user = $this->checkLogin();
+        if ($login_user['uid'] > 0 ) {
+            $ret = D("Template")->where(" uid = '$login_user[uid]' ")->order(" addtime desc  ")->select();
+        }
+        if ($ret) {
+            foreach ($ret as $key => &$value) {
+                $value['addtime'] = date("Y-m-d H:i:s" , $value['addtime']);
+                $value['template_content'] = htmlspecialchars_decode($value['template_content']);
+            }
+           $this->sendResult($ret);
+        }else{
+            $return['error_code'] = 10103 ;
+            $return['error_message'] = 'request  fail' ;
+            $this->sendResult($return);
+        }
+    }
+
+    //删除目录
+    public function delete(){
+        $id = I("id/d")? I("id/d") : 0;
+        $login_user = $this->checkLogin();
+        if ($id && $login_user['uid']) {
+            $ret = D("Template")->where(" id = '$id' and uid = '$login_user[uid]'")->delete();
+        }
+        if ($ret) {
+           $this->sendResult($ret);
+        }else{
+            $return['error_code'] = 10103 ;
+            $return['error_message'] = 'request  fail' ;
+            $this->sendResult($return);
+        }
+    }
+
+
+
+
+}

+ 85 - 1
Application/Home/Controller/UpdateController.class.php

@@ -5,6 +5,7 @@ class UpdateController extends BaseController {
     
  	//升级数据库
     public function db(){
+        clear_runtime();
     	if (strtolower(C("DB_TYPE")) == 'mysql' ) {
     		$this->mysql();
     	}
@@ -184,7 +185,7 @@ class UpdateController extends BaseController {
             }
         }
 
-        $sql = "CREATE TABLE IF NOT EXISTS `user_token` (
+        $sql = "CREATE TABLE IF NOT EXISTS `".C('DB_PREFIX')."user_token` (
         `id` int(10) NOT NULL AUTO_INCREMENT,
         `uid` int(10) NOT NULL DEFAULT '0',
         `token` varchar(200) NOT NULL DEFAULT '',
@@ -196,6 +197,48 @@ class UpdateController extends BaseController {
         ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COMMENT='' AUTO_INCREMENT=1 ";
         D("User")->execute($sql);
 
+        //创建template表
+        $sql = "CREATE TABLE IF NOT EXISTS `".C('DB_PREFIX')."template` (
+        `id` int(10) NOT NULL AUTO_INCREMENT,
+        `uid` int(10) NOT NULL DEFAULT '0',
+        `username` varchar(200) NOT NULL DEFAULT '',
+        `template_title` varchar(200) NOT NULL DEFAULT '' ,
+        `template_content` text NOT NULL DEFAULT '',
+        `addtime` int(11) NOT NULL DEFAULT '0',
+        PRIMARY KEY (`id`),
+        KEY `uid` (`uid`)
+        )ENGINE=MyISAM  DEFAULT CHARSET=utf8 COMMENT='' AUTO_INCREMENT=1";
+        D("UserToken")->execute($sql);
+
+        //page表增加page_comments字段
+        $columns = M("Page")->getDbFields();
+        if ($columns) {
+            $has_it = 0 ;//是否存在该字段
+            foreach ($columns as $key => $value) {
+                if ($value == 'page_comments') {
+                    $has_it = 1 ;
+                }
+            }
+            if ($has_it === 0) {
+                $sql = "ALTER TABLE ".C('DB_PREFIX')."page ADD page_comments varchar( 255 ) NOT NULL DEFAULT '' COMMENT '页面注释';";
+                D("Page")->execute($sql);
+            }
+        }
+        //page_history表增加page_comments字段
+        $columns = M("PageHistory")->getDbFields();
+        if ($columns) {
+            $has_it = 0 ;//是否存在该字段
+            foreach ($columns as $key => $value) {
+                if ($value == 'page_comments') {
+                    $has_it = 1 ;
+                }
+            }
+            if ($has_it === 0) {
+                $sql = "ALTER TABLE ".C('DB_PREFIX')."page_history ADD page_comments varchar( 255 ) NOT NULL DEFAULT '' COMMENT '页面注释';";
+                D("PageHistory")->execute($sql);
+            }
+        }
+
         echo "OK!";
     }
 
@@ -255,6 +298,47 @@ class UpdateController extends BaseController {
         )";
         D("UserToken")->execute($sql);
 
+        //创建template表
+        $sql = "CREATE TABLE IF NOT EXISTS `template` (
+        `id`  INTEGER PRIMARY KEY ,
+        `uid` int(10) NOT NULL DEFAULT '0',
+        `username` CHAR(200) NOT NULL DEFAULT '',
+        `template_title` CHAR(200) NOT NULL DEFAULT '' ,
+        `template_content` text NOT NULL DEFAULT '',
+        `addtime` int(11) NOT NULL DEFAULT '0'
+        )";
+        D("UserToken")->execute($sql);
+
+        //page表增加page_comments字段
+        $columns = D("Page")->getDbFields();
+        if ($columns) {
+            $has_it = 0 ;//是否存在该字段
+            foreach ($columns as $key => $value) {
+                if ($value == 'page_comments') {
+                    $has_it = 1 ;
+                }
+            }
+            if ($has_it === 0) {
+                $sql = "ALTER TABLE ".C('DB_PREFIX')."page ADD page_comments text NOT NULL DEFAULT ''  ;";
+                D("Page")->execute($sql);
+            }
+        }
+
+        //page_history 表增加page_comments字段
+        $columns = D("PageHistory")->getDbFields();
+        if ($columns) {
+            $has_it = 0 ;//是否存在该字段
+            foreach ($columns as $key => $value) {
+                if ($value == 'page_comments') {
+                    $has_it = 1 ;
+                }
+            }
+            if ($has_it === 0) {
+                $sql = "ALTER TABLE ".C('DB_PREFIX')."page_history ADD page_comments text NOT NULL DEFAULT '';";
+                D("PageHistory")->execute($sql);
+            }
+        }
+
         echo 'OK!';
     }
 

+ 5 - 0
Application/Home/Lang/en-us.php

@@ -137,6 +137,11 @@ return array(
     'params'=>'Params',
     'clear'=>'Clear',
     'result'=>'Result',
+    'save_to_templ'=>'Save as template',
+    'more_templ'=>'More template',
+    'saved_templ_list'=>'Template list you saved',
+    'page_comments'=>'Page comments',
+    'add_page_comments'=>'Add comments before save',
 
     //user
     'login'=>'Login',

+ 5 - 0
Application/Home/Lang/zh-cn.php

@@ -137,6 +137,11 @@ return array(
     'params'=>'参数',
     'clear'=>'清除',
     'result'=>'返回结果',
+    'save_to_templ'=>'另存为模板',
+    'more_templ'=>'更多模板',
+    'saved_templ_list'=>'保存的模板列表',
+    'page_comments'=>'页面注释',
+    'add_page_comments'=>'保存前添加页面注释',
 
     //user
     'login'=>'登录',

+ 28 - 4
Application/Home/View/Page/edit.html

@@ -33,7 +33,16 @@
             </ul>
         </div>
         <div class="head-right pull-right">
-            <a href="#" class="btn btn-primary " id="save">{$Think.Lang.save}</a>
+            <!-- <a href="#" class="btn btn-primary " id="save">{$Think.Lang.save}</a> -->
+            <div class="btn-group" id="save-btn-group"> 
+                <button class="btn btn-primary" id="save">{$Think.Lang.save}</button>
+                <button class="btn btn-primary dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
+                <ul class="dropdown-menu" >
+                    <li><a href="#" id="add-page-comments">{$Think.Lang.add_page_comments}</a></li>
+                    <li><a href="#" id="save-to-templ">{$Think.Lang.save_to_templ}</a></li>
+                </ul>
+            </div>
+
             <a href="?s=home/item/show&item_id={$item_id}&page_id={$page.page_id}" class="btn cancel">{$Think.Lang.cancel}</a>
         </div>
     </header>
@@ -42,7 +51,8 @@
     <div class="btns">
         <button id="api-doc" tabindex="4" >{$Think.Lang.inser_apidoc_template}</button>
         <button id="database-doc" tabindex="5" >{$Think.Lang.inser_database_doc_template}</button>
-        <button id="jsons" tabindex="7" >{$Think.Lang.json_to_table}</button>
+        <button id="more-templ" tabindex="" >{$Think.Lang.more_templ}</button>
+        <button id="jsons" tabindex="7" style="margin-left: 100px;">{$Think.Lang.json_to_table}</button>
         <a href="{:U('Home/page/http_api')}" target="_blank" class="btn" >{$Think.Lang.http_test_api}</a>
     </div>
     <div id="editormd">
@@ -50,6 +60,7 @@
     </div>
     <input type="hidden" id="item_id" value="{$item_id}">
     <input type="hidden" id="page_id" value="{$page.page_id}">
+    <input type="hidden" id="page_comments" value="">
     <input type="hidden" id="default_second_cat_id" value="{$default_second_cat_id}">
     <input type="hidden" id="default_child_cat_id" value="{$default_child_cat_id}">
 </div>
@@ -78,6 +89,19 @@
     <div class="editormd-dialog-mask editormd-dialog-mask-bg"></div><div class="editormd-dialog-mask editormd-dialog-mask-con"></div>
 </div>
 
+ <div id="more-templ-modal" class="modal hide fade">
+  <div class="modal-header">
+    <h4>{$Think.Lang.saved_templ_list}</h4>
+  </div>
+  <table class="table table-hover" id="templ-table">
+
+
+  </table>
+
+    <div class="modal-footer">
+        <button class="btn" data-dismiss="modal" aria-hidden="true">{$Think.Lang.close}</button>
+    </div>
+ </div>
 
 <include file="Common/footer" />
 <script src="__PUBLIC__/js/jquery.bootstrap-growl.min.js"></script>
@@ -92,7 +116,7 @@
 <script src="__PUBLIC__/editor.md/plugins/table-dialog/table-dialog.js"></script>
 <script src="__PUBLIC__/editor.md/plugins/reference-link-dialog/reference-link-dialog.js"></script>
 
-<script src="__PUBLIC__/js/page/edit.js?v=1.1.2thirdonm"></script>
+<script src="__PUBLIC__/js/page/edit.js?v=1.1.2thirdonmop"></script>
 <if condition="LANG_SET=='en-us'">
     <script src="__PUBLIC__/editor.md/languages/en.js"></script>
-</if>
+</if>

+ 2 - 0
Application/Home/View/Page/history.html

@@ -13,6 +13,7 @@
     <TR>
       <td>{$Think.Lang.update_time}</td>
       <td>{$Think.Lang.update_by_who}</td>
+      <td>{$Think.Lang.page_comments}</td>
       <td>{$Think.Lang.operation}</td>
     </TR>
     <if condition="$PageHistory">
@@ -20,6 +21,7 @@
       <TR>
         <td>{$value.addtime}</td>
         <td>{$value.author_username}</td>
+        <td>{$value.page_comments}</td>
         <td><a href="?s=home/page/edit&page_id={$page_id}&page_history_id={$value.page_history_id}">{$Think.Lang.recover_to_this_version}</a></td>
       </TR>
 

+ 124 - 2
Public/css/page/edit.css

@@ -1,122 +1,244 @@
 * {
+
     padding: 0;
+
     margin: 0;
+
 }
 
+
+
 *, *:before, *:after {
+
     -webkit-box-sizing: border-box;
+
     -moz-box-sizing: border-box;
+
     box-sizing: border-box;
+
 }
+
 		body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td,hr,button,article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{
+
     margin: 0;
+
     padding: 0;
+
 }
 
+
+
 article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary {
+
     display: block;
+
 }
 
+
+
 audio, canvas, video {
+
     display: inline-block;
+
 }
 
+
+
 img {
+
     border: none;
+
     vertical-align: middle;
+
 }
 
+
+
 ul, ol {
+
     /*list-style: none;*/
+
 }
 
+
+
 .clear {
+
     *zoom: 1;           /* for IE 6/7 */
+
 }
 
+
+
 .clear:before, .clear:after {
+
     height: 0; 
+
     content: "";
+
     font-size: 0;
+
     display: table;
+
     line-height: 0;     /* for Opera */
+
     visibility: hidden;
+
 }
 
+
+
 .clear:after {
+
     clear: both;
+
 }
 
+
+
 body {
+
     font-size: 14px;
+
     color: #666;
+
     font-family: "Microsoft YaHei", "微软雅黑", Helvetica, Tahoma, STXihei, "华文细黑", STHeiti, "Helvetica Neue", Helvetica, Tahoma, "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "宋体", Heiti, "黑体", sans-serif; 
+
     background: #fff;
+
     text-align: center;
+
 }
 
+
+
 #layout {
+
     text-align: left;
+
 }
 
+
+
 #layout > header, .btns {
+
     padding: 15px 0;
+
     width: 90%;
+
     margin: 0 auto;
+
 }
 
+
+
 .btns {
+
     padding-top: 0;
+
 }
 
+
+
 .btns button {
+
     padding: 2px 8px;
+
 }
 
+
+
 #layout > header > h1 {
+
     font-size: 20px;
+
     margin-bottom: 10px;
+
 }
 
+
+
 .btns button, .btn {
+
     padding: 8px 10px;
+
     background: #fff;
+
     border: 1px solid #ddd;
+
     -webkit-border-radius: 3px;
+
     border-radius: 3px;
+
     cursor: pointer;
+
     -webkit-transition: background 300ms ease-out;
+
     transition: background 300ms ease-out;
+
 }
 
+
+
 .btns button:hover, .btn:hover {
+
     background: #f6f6f6;
+
 }
 
+
+
 #json-templ{ position:fixed; float:left; top:100px; left:300px; border:2px solid #ccc; display:none; z-index:999999;}
 
+
+
 .markdown-body.editormd-preview-container table tr td{ max-width:300px;}
 
+
+
 .btn-primary {
+
     background-color: #006dcc;
+
 }
 
+
+
 .btn-primary:hover {
+
     background-color: #04c;
+
 }
 
+
+
 #page_title,
+
 #cat_id,
+
 #order {
+
     height: 30px;
+
 }
 
+
+
 #cat_id ,#parent_cat_id {
-    width: 150px;
+
+    width: 120px;
+
 }
 
+
+
 #s_number {
-    width: 50px;
+
+    width: 120px;
+
     margin-right: 20px;
+
     height: 28px;
+
 }
+

+ 2 - 2
Public/js/catalog/edit.js

@@ -80,7 +80,7 @@ $(function(){
             $("#cat_id").val('');
             $("#parent_cat_id").val('');
             secondCatList();
-            alert(lang["save_success"]);
+            //alert(lang["save_success"]);
           }else{
             alert(lang["save_fail"]);
           }
@@ -102,7 +102,7 @@ $(function(){
                 { "cat_id": cat_id  },
                 function(data){
                   if (data.error_code == 0) {
-                    alert(lang["delete_success"]);
+                    //alert(lang["delete_success"]);
                     window.location.href="?s=home/catalog/edit&item_id="+item_id;
                   }else{
                     if (data.error_message) {

+ 11 - 1
Public/js/lang.en-us.js

@@ -23,5 +23,15 @@ lang["description"] = "Description";
 lang["editormd_placeholder"] = "Supports Markdown.the left side to edite, the right Preview";
 lang["json_fail"] = "JSON import failed";
 lang["filed"] = "filed";
-
+lang["none"] = "none";
+lang["save_templ_title"] = "Pealse set the title for the template you want to save";
+lang["saved_templ_msg1"] = "Template'";
+lang["saved_templ_msg2"] = "' is saved.When you create or edit a new page, click the 'More template' button, then you can use the template you save";
+lang["save_time"] = "Save time";
+lang["templ_title"] = "Template title";
+lang["operation"] = "Operation";
+lang["use_this_template"] = "Insert this template";
+lang["delete_this_template"] = "Delete template";
+lang["no_templ_msg"] = "<p><br>You have not saved any templates.<br>When you edit the page, click the 'save' button on the right click, select Save as template in the down menu .<br>When you create or edit a new page, click the 'More template' button, then you can use the template you save</p>";
+lang["add_page_comments_msg"] = "Please enter the page comments.It can be page update log , or other you want.It will be showed in page history version convenient for you to check the change of page";
 

+ 11 - 0
Public/js/lang.zh-cn.js

@@ -23,5 +23,16 @@ lang["description"] = "说明";
 lang["editormd_placeholder"] = "本编辑器支持Markdown编辑,左边编写,右边预览";
 lang["json_fail"] = "json导入失败";
 lang["filed"] = "键";
+lang["none"] = "无";
+lang["save_templ_title"] = "请为要保存的模板设置标题";
+lang["saved_templ_msg1"] = "已经保存好模板“";
+lang["saved_templ_msg2"] = "”。你以后新建或者编辑编辑页面时,点击“更多模板”按钮,便可以使用你保存的模板";
+lang["save_time"] = "保存时间";
+lang["templ_title"] = "模板标题";
+lang["operation"] = "操作";
+lang["use_this_template"] = "插入此模板";
+lang["delete_this_template"] = "删除模板";
+lang["no_templ_msg"] = "<p><br>你尚未保存过任何模板。<br>你可以在编辑页面时,在“保存”按钮右边点击,在下来菜单中选择“另存为模板”。<br>把页面内容保存为模板后,你下次新建或者编辑页面时便可以使用你之前保存的模板</p>";
+lang["add_page_comments_msg"] = "请输入页面注释内容。可以填写你对页面的修改注释或者其它注释。添加后,在页面的历史版本处会显示每一个页面版本的注释,方便你查阅、追踪页面的修改";
 
 

+ 97 - 3
Public/js/page/edit.js

@@ -1,5 +1,5 @@
 var editormd;
-
+var template_list ;
 var json_table_data='|'+lang["params"]+'|'+lang["type"]+'|'+lang["description"]+'|\n'+
 		'|:-------|:-------|:-------|\n';
 
@@ -179,6 +179,7 @@ $(function() {
     var page_id = $("#page_id").val();
     var item_id = $("#item_id").val();
     var page_title = $("#page_title").val();
+    var page_comments = $("#page_comments").val();
     var page_content = $("#page_content").val();
     var item_id = $("#item_id").val();
     var s_number = $("#s_number").val();
@@ -195,6 +196,7 @@ $(function() {
         "s_number": s_number,
         "page_content": page_content,
         "page_title": page_title,
+        "page_comments": page_comments,
         "item_id": item_id
       },
       function(data) {
@@ -253,7 +255,7 @@ function Change(data)
 		var type = typeof(value);
 		if(type == "object")
 		{
-			json_table_data+='| '+level_str+key+' |'+type+'  |  |\n';
+			json_table_data+='| '+level_str+key+' |'+type+'  | '+lang["none"]+' |\n';
 			if(value instanceof Array)
 			{
 				var j=level+1;
@@ -268,9 +270,101 @@ function Change(data)
 		}
 		else
 		{
-			json_table_data+='| '+key+' | '+type+'|  |\n';
+			json_table_data+='| '+key+' | '+type+'| '+lang["none"]+' |\n';
 		}
 	}
 }
 
 //{"Result":[{"name":"test1","list":{"pros":"prosfsf","ppps":{"images":[{"22":"22"}]}}}]}
+
+$("#save-to-templ").click(function(){
+  var template_title =prompt(lang["save_templ_title"],"");
+  if (template_title!=null && template_title!="")
+    {
+        var template_content = $("#page_content").val();
+        $.post(
+            "?s=home/template/save",
+            {"template_title":template_title,"template_content":template_content},
+            function(data){
+                if (data.error_code == 0) {
+                  alert(lang["saved_templ_msg1"]+template_title+lang["saved_templ_msg2"]);
+                } else {
+                  $.bootstrapGrowl(lang["save_fail"]);
+
+                }
+           },
+            "json"
+            );
+    }
+    $("#save-btn-group").removeClass("open");
+    return false;
+  });
+
+
+$("#more-templ").click(function(){
+        $.post(
+            "?s=home/template/getList",
+            {},
+            function(data){
+                if (data.error_code == 0) {
+                    var html = '<TR><td>'+lang["save_time"]+'</td><td>'+lang["templ_title"]+'</td><td>'+lang["operation"]+'</td></TR>';
+                    template_list = data.data;
+                    json = data.data;
+                    for (var i = 0; i < json.length; i++) {
+                        html += '<TR><td>'+json[i]['addtime']+'</td>';
+                        html += '<td>'+json[i]['template_title']+'</td>';
+                        html += '<td><a href="javascript:use_template('+json[i]['id']+')">'+lang["use_this_template"]+'</a> | <a href="javascript:delete_template('+json[i]['id']+')">'+lang["delete_this_template"]+'</a></td>';
+                        html +='</TR>';
+                    };
+                    $("#templ-table").html(html);
+                } else {
+                  //$.bootstrapGrowl("获取模板列表失败");
+                  $("#templ-table").html(lang["no_templ_msg"]);
+
+                }
+                $("#more-templ-modal").modal();
+           },
+            "json"
+            );
+    
+});
+
+//使用模板
+function use_template(id){
+    for (var i = 0; i < template_list.length; i++) {
+        if (id > 0 && id == template_list[i]['id']) {
+            editormd.insertValue(template_list[i]['template_content']);
+            $("#more-templ-modal").modal("hide");
+        };
+        
+    };
+    return false;
+}
+
+//删除模板
+function delete_template(id){
+    $.post(
+        "?s=home/template/delete",
+        {"id":id},
+        function(data){
+            if (data.error_code == 0) {
+                $("#more-templ").click();
+            } else {
+              $.bootstrapGrowl(lang["save_fail"]);
+            }
+       },
+        "json"
+        );
+    return false;
+}
+
+$("#add-page-comments").click(function(){
+  var page_comments =prompt(lang["add_page_comments_msg"],"");
+  if (page_comments!=null && page_comments!="")
+    {
+        $("#page_comments").val(page_comments);
+        $("#save").click();
+    }
+    $("#save-btn-group").removeClass("open");
+    return false;
+});

BIN
Sqlite/showdoc.db.php


+ 17 - 1
install/ajax.php

@@ -238,7 +238,8 @@ function import_mysql($con){
 	`author_username` varchar(50) NOT NULL DEFAULT '' COMMENT '页面作者名字',
 	`item_id` int(10) NOT NULL DEFAULT '0',
 	`cat_id` int(10) NOT NULL DEFAULT '0',
-	`page_title` varchar(50) NOT NULL DEFAULT '',
+    `page_title` varchar(50) NOT NULL DEFAULT '',
+	`page_comments` varchar(255) NOT NULL DEFAULT '',
 	`page_content` text NOT NULL,
 	`s_number` int(10) NOT NULL DEFAULT '99' COMMENT '顺序号。数字越小越靠前。若此值全部相等时则按id排序',
 	`addtime` int(11) NOT NULL DEFAULT '0',
@@ -257,6 +258,7 @@ function import_mysql($con){
 	`item_id` int(10) NOT NULL DEFAULT '0',
 	`cat_id` int(10) NOT NULL DEFAULT '0',
 	`page_title` varchar(50) NOT NULL DEFAULT '',
+    `page_comments` varchar(255) NOT NULL DEFAULT '',
 	`page_content` text NOT NULL,
 	`s_number` int(10) NOT NULL DEFAULT '99' COMMENT '顺序号。数字越小越靠前。若此值全部相等时则按id排序',
 	`addtime` int(11) NOT NULL DEFAULT '0',
@@ -266,6 +268,7 @@ function import_mysql($con){
 	) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COMMENT='页面历史表' AUTO_INCREMENT=1 ";
 	mysqli_query($con, $sql);
 
+    //创建user_token表
     $sql = "CREATE TABLE IF NOT EXISTS `user_token` (
     `id` int(10) NOT NULL AUTO_INCREMENT,
     `uid` int(10) NOT NULL DEFAULT '0',
@@ -276,6 +279,19 @@ function import_mysql($con){
     PRIMARY KEY (`id`),
     KEY `token` (`token`)
     ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COMMENT='' AUTO_INCREMENT=1 ";
+    mysqli_query($con, $sql);
+
+    //创建template表
+    $sql = "CREATE TABLE IF NOT EXISTS `template` (
+    `id` int(10) NOT NULL AUTO_INCREMENT,
+    `uid` int(10) NOT NULL DEFAULT '0',
+    `username` varchar(200) NOT NULL DEFAULT '',
+    `template_title` varchar(200) NOT NULL DEFAULT '' ,
+    `template_content` text NOT NULL DEFAULT '',
+    `addtime` int(11) NOT NULL DEFAULT '0',
+    PRIMARY KEY (`id`),
+    KEY `uid` (`uid`)
+    )ENGINE=MyISAM  DEFAULT CHARSET=utf8 COMMENT='' AUTO_INCREMENT=1";
     mysqli_query($con, $sql);
 
 	//创建项目user表