Explorar o código

You can configure the number of historical versions saved / 可以配置保存的历史版本数量

star7th %!s(int64=4) %!d(string=hai) anos
pai
achega
8ab69ca809

+ 4 - 0
server/Application/Api/Controller/AdminSettingController.class.php

@@ -8,10 +8,12 @@ class AdminSettingController extends BaseController {
         $login_user = $this->checkLogin();
         $this->checkAdmin();
         $register_open = intval(I("register_open")) ;
+        $history_version_count = intval(I("history_version_count")) ;
         $oss_open = intval(I("oss_open")) ;
         $home_page = intval(I("home_page")) ;
         $home_item = intval(I("home_item")) ;
         $oss_setting = I("oss_setting") ;
+        D("Options")->set("history_version_count" ,$history_version_count) ;
         D("Options")->set("register_open" ,$register_open) ;
         D("Options")->set("home_page" ,$home_page) ;
         D("Options")->set("home_item" ,$home_item) ;
@@ -31,6 +33,7 @@ class AdminSettingController extends BaseController {
         $this->checkAdmin();
         $oss_open = D("Options")->get("oss_open" ) ;
         $register_open = D("Options")->get("register_open" ) ;
+        $history_version_count = D("Options")->get("history_version_count" ) ;
         $oss_setting = D("Options")->get("oss_setting" ) ;
         $home_page = D("Options")->get("home_page" ) ;
         $home_item = D("Options")->get("home_item" ) ;
@@ -44,6 +47,7 @@ class AdminSettingController extends BaseController {
             $array = array(
                 "oss_open"=>$oss_open ,
                 "register_open"=>$register_open ,
+                "history_version_count"=>$history_version_count ,
                 "home_page"=>$home_page ,
                 "home_item"=>$home_item ,
                 "oss_setting"=>$oss_setting ,

+ 13 - 4
server/Application/Api/Controller/PageController.class.php

@@ -94,9 +94,18 @@ class PageController extends BaseController {
         $data['addtime'] = time();
         $data['author_uid'] = $login_user['uid'] ;
         $data['author_username'] = $login_user['username'];
+        
+
 
         if ($page_id > 0 ) {
             
+            // 设置里的历史版本数量
+            $history_version_count = D("Options")->get("history_version_count" ) ;
+            if(!$history_version_count){
+                $history_version_count = 20 ;
+                D("Options")->set("history_version_count" ,$history_version_count) ;
+            }
+
             //在保存前先把当前页面的版本存档
             $page = D("Page")->where(" page_id = '$page_id' ")->find();
             if (!$this->checkItemPermn($login_user['uid'] , $page['item_id'])) {
@@ -121,10 +130,10 @@ class PageController extends BaseController {
 
             //统计该page_id有多少历史版本了
             $Count = D("PageHistory")->where(" page_id = '$page_id' ")->Count();
-            if ($Count > 20 ) {
-               //每个单页面只保留最多20个历史版本
-               $ret = D("PageHistory")->where(" page_id = '$page_id' ")->limit("20")->order("page_history_id desc")->select();
-               D("PageHistory")->where(" page_id = '$page_id' and page_history_id < ".$ret[19]['page_history_id'] )->delete();
+            if ($Count > $history_version_count ) {
+               //每个单页面只保留最多$history_version_count个历史版本
+               $ret = D("PageHistory")->where(" page_id = '$page_id' ")->limit($history_version_count)->order("page_history_id desc")->select();
+               D("PageHistory")->where(" page_id = '$page_id' and page_history_id < ".$ret[$history_version_count-1]['page_history_id'] )->delete();
             }
 
             //如果是单页项目,则将页面标题设置为项目名

+ 1 - 1
web/index.html

@@ -16,4 +16,4 @@
       "server": window.location.protocol +'//'+ window.location.host + window.location.pathname+ '../server/index.php?s=',
       //"lang" :'en'
       "lang" :'zh-cn'
-  }</script><link href=./static/css/app.5292f6f55e64e4b62c9b5a0baf5b82f7.css rel=stylesheet></head><body class=grey-bg><div id=app></div><div style=display:none>本网站基于开源版showdoc搭建,仅供私人使用。如需访问showdoc官网,请在搜索引擎里搜索showdoc字样或者直接访问showdoc.com.cn</div><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.1eb6213d11eb61d1bd46.js></script><script type=text/javascript src=./static/js/app.1773fa4abe372dfac8ef.js></script></body></html>
+  }</script><link href=./static/css/app.f4bb312ff035546ab76b6f80a8b3937d.css rel=stylesheet></head><body class=grey-bg><div id=app></div><div style=display:none>本网站基于开源版showdoc搭建,仅供私人使用。如需访问showdoc官网,请在搜索引擎里搜索showdoc字样或者直接访问showdoc.com.cn</div><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.1eb6213d11eb61d1bd46.js></script><script type=text/javascript src=./static/js/app.6cdcf8cc77eba45c5b2b.js></script></body></html>

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
web/static/css/app.f4bb312ff035546ab76b6f80a8b3937d.css


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
web/static/js/app.1773fa4abe372dfac8ef.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
web/static/js/app.6cdcf8cc77eba45c5b2b.js


+ 19 - 16
web/static/lang/en.js

@@ -10,15 +10,12 @@ exports.default = {
   section_description1_1: 'A tool greatly applicable',
   section_description1_2: 'for an IT team',
   section_title2: 'API Document',
-  section_description2_1:
-    'ShowDoc can compile exquisite API documents',
-  section_description2_2:
-    'in a very fast and convenient way',
+  section_description2_1: 'ShowDoc can compile exquisite API documents',
+  section_description2_2: 'in a very fast and convenient way',
   section_title3: 'Data Dictionary',
   section_description3_1:
     'A good Data Dictionary can easily exhibit database structure to other people',
-  section_description3_2:
-    'ShowDoc can compile exquisite Data Dictionary',
+  section_description3_2: 'ShowDoc can compile exquisite Data Dictionary',
   section_title4: 'Explanation Document',
   section_description4_1:
     'You can absolutely use ShowDoc to compile the explanation documents for some tools',
@@ -32,10 +29,8 @@ exports.default = {
   section_description6_2:
     'With the runapi client, you can debug the interface and automatically generate documents',
   section_title7: 'Open Source',
-  section_description7_1:
-    'ShowDoc is a free, open source tool',
-  section_description7_2:
-    'You can deploy it to your own server',
+  section_description7_1: 'ShowDoc is a free, open source tool',
+  section_description7_2: 'You can deploy it to your own server',
   section_title8: 'Hosted online',
   section_description8_1:
     'www.showdoc.com.cn provide security and stability of the document hosting service',
@@ -410,7 +405,8 @@ exports.default = {
 
   all_pages: 'All pages',
 
-  cancelSingle: 'Are you sure you want to cancel the single page link? After cancellation, the original link will be invalid immediately',
+  cancelSingle:
+    'Are you sure you want to cancel the single page link? After cancellation, the original link will be invalid immediately',
   cancelSingleYes: 'Unlink single page',
   cancelSingleNo: 'Keep single page',
 
@@ -434,15 +430,22 @@ exports.default = {
   all_items: 'All items',
   manage_item_group: 'Manage group',
   draggable_tips: 'Press and hold to drag sort',
-  item_group_empty_tips: 'There is no grouping data. You can click the top right corner to create a new group',
+  item_group_empty_tips:
+    'There is no grouping data. You can click the top right corner to create a new group',
   select_item: 'Select item',
 
-  ext_login:'Ext login',
+  ext_login: 'Ext login',
   enable_oauth: 'OAuth Login',
   your_showdoc_server: '[your-showdoc-server]',
   callback_eg: ' callback url example',
   entrance_tips_label: 'Entrance text prompt',
-  entrance_tips_content: "When OAuth2 login is enabled, this entry will appear below the input box on the login interface. You can fill in a prompt such as 'Log in with company OA'",
-  userinfo_path_content:'Interface to obtain user information after successful login. You can write a full URL or a path. When only the path is filled in, the OAuth host above will be used to supplement the full address automatically. The interface should return a JSON string with a username field',
-  reset:'reset',
+  entrance_tips_content:
+    "When OAuth2 login is enabled, this entry will appear below the input box on the login interface. You can fill in a prompt such as 'Log in with company OA'",
+  userinfo_path_content:
+    'Interface to obtain user information after successful login. You can write a full URL or a path. When only the path is filled in, the OAuth host above will be used to supplement the full address automatically. The interface should return a JSON string with a username field',
+  reset: 'reset',
+
+  history_version_count: 'History versions',
+  history_version_count_content:
+    'Each time you edit a page, a historical version of the page is generated. Here is the number of historical versions kept. Only the latest 20 versions are reserved by default'
 }

+ 10 - 4
web/static/lang/zh-CN.js

@@ -415,12 +415,18 @@ exports.default = {
   item_group_empty_tips: '暂无分组数据。可点击右上角新建分组',
   select_item: '选择项目',
 
-  ext_login:'集成登录',
+  ext_login: '集成登录',
   enable_oauth: '启动OAuth2登录',
   your_showdoc_server: '【你的showdoc地址】',
   callback_eg: ' callback url填写示例',
   entrance_tips_label: '入口文字提示',
-  entrance_tips_content: "当启用OAuth2登录时候,登录界面将在输入框的下方出现此入口。你可以填上如'使用公司OA登录'这样的提示",
-  userinfo_path_content: '登录成功后获取用户信息的接口。可以写完整网址也可以写路径。当只填写路径的时候,将自动使用上面的Oauth host补充完整地址。该接口应当返回json字符串且包含username字段',
-  reset:'重新生成',
+  entrance_tips_content:
+    "当启用OAuth2登录时候,登录界面将在输入框的下方出现此入口。你可以填上如'使用公司OA登录'这样的提示",
+  userinfo_path_content:
+    '登录成功后获取用户信息的接口。可以写完整网址也可以写路径。当只填写路径的时候,将自动使用上面的Oauth host补充完整地址。该接口应当返回json字符串且包含username字段',
+  reset: '重新生成',
+
+  history_version_count: '历史版本数量',
+  history_version_count_content:
+    '每次编辑页面都会生成一个页面的历史版本。这里是保留的历史版本数量。默认只保留最新的20个版本'
 }

+ 20 - 1
web_src/src/components/admin/setting/Index.vue

@@ -28,6 +28,20 @@
           ></el-option>
         </el-select>
       </el-form-item>
+      <el-form-item :label="$t('history_version_count')">
+        <el-input
+          v-model="form.history_version_count"
+          class="form-el"
+        ></el-input>
+        <el-tooltip
+          class="item"
+          effect="dark"
+          :content="$t('history_version_count_content')"
+          placement="top"
+        >
+          <i class="el-icon-question"></i>
+        </el-tooltip>
+      </el-form-item>
 
       <el-form-item :label="$t('oss_open')">
         <el-switch v-model="form.oss_open"></el-switch>
@@ -148,7 +162,8 @@ export default {
           region: '',
           secretId: '',
           secretKey: ''
-        }
+        },
+        history_version_count: 20
       },
       itemList: []
     }
@@ -172,6 +187,10 @@ export default {
             return
           }
           this.form.register_open = response.data.data.register_open > 0
+          this.form.history_version_count = response.data.data
+            .history_version_count
+            ? response.data.data.history_version_count
+            : this.form.history_version_count
           this.form.oss_open = response.data.data.oss_open > 0
           this.form.home_page =
             response.data.data.home_page > 0 ? response.data.data.home_page : 1

+ 19 - 16
web_src/static/lang/en.js

@@ -10,15 +10,12 @@ exports.default = {
   section_description1_1: 'A tool greatly applicable',
   section_description1_2: 'for an IT team',
   section_title2: 'API Document',
-  section_description2_1:
-    'ShowDoc can compile exquisite API documents',
-  section_description2_2:
-    'in a very fast and convenient way',
+  section_description2_1: 'ShowDoc can compile exquisite API documents',
+  section_description2_2: 'in a very fast and convenient way',
   section_title3: 'Data Dictionary',
   section_description3_1:
     'A good Data Dictionary can easily exhibit database structure to other people',
-  section_description3_2:
-    'ShowDoc can compile exquisite Data Dictionary',
+  section_description3_2: 'ShowDoc can compile exquisite Data Dictionary',
   section_title4: 'Explanation Document',
   section_description4_1:
     'You can absolutely use ShowDoc to compile the explanation documents for some tools',
@@ -32,10 +29,8 @@ exports.default = {
   section_description6_2:
     'With the runapi client, you can debug the interface and automatically generate documents',
   section_title7: 'Open Source',
-  section_description7_1:
-    'ShowDoc is a free, open source tool',
-  section_description7_2:
-    'You can deploy it to your own server',
+  section_description7_1: 'ShowDoc is a free, open source tool',
+  section_description7_2: 'You can deploy it to your own server',
   section_title8: 'Hosted online',
   section_description8_1:
     'www.showdoc.com.cn provide security and stability of the document hosting service',
@@ -410,7 +405,8 @@ exports.default = {
 
   all_pages: 'All pages',
 
-  cancelSingle: 'Are you sure you want to cancel the single page link? After cancellation, the original link will be invalid immediately',
+  cancelSingle:
+    'Are you sure you want to cancel the single page link? After cancellation, the original link will be invalid immediately',
   cancelSingleYes: 'Unlink single page',
   cancelSingleNo: 'Keep single page',
 
@@ -434,15 +430,22 @@ exports.default = {
   all_items: 'All items',
   manage_item_group: 'Manage group',
   draggable_tips: 'Press and hold to drag sort',
-  item_group_empty_tips: 'There is no grouping data. You can click the top right corner to create a new group',
+  item_group_empty_tips:
+    'There is no grouping data. You can click the top right corner to create a new group',
   select_item: 'Select item',
 
-  ext_login:'Ext login',
+  ext_login: 'Ext login',
   enable_oauth: 'OAuth Login',
   your_showdoc_server: '[your-showdoc-server]',
   callback_eg: ' callback url example',
   entrance_tips_label: 'Entrance text prompt',
-  entrance_tips_content: "When OAuth2 login is enabled, this entry will appear below the input box on the login interface. You can fill in a prompt such as 'Log in with company OA'",
-  userinfo_path_content:'Interface to obtain user information after successful login. You can write a full URL or a path. When only the path is filled in, the OAuth host above will be used to supplement the full address automatically. The interface should return a JSON string with a username field',
-  reset:'reset',
+  entrance_tips_content:
+    "When OAuth2 login is enabled, this entry will appear below the input box on the login interface. You can fill in a prompt such as 'Log in with company OA'",
+  userinfo_path_content:
+    'Interface to obtain user information after successful login. You can write a full URL or a path. When only the path is filled in, the OAuth host above will be used to supplement the full address automatically. The interface should return a JSON string with a username field',
+  reset: 'reset',
+
+  history_version_count: 'History versions',
+  history_version_count_content:
+    'Each time you edit a page, a historical version of the page is generated. Here is the number of historical versions kept. Only the latest 20 versions are reserved by default'
 }

+ 10 - 4
web_src/static/lang/zh-CN.js

@@ -415,12 +415,18 @@ exports.default = {
   item_group_empty_tips: '暂无分组数据。可点击右上角新建分组',
   select_item: '选择项目',
 
-  ext_login:'集成登录',
+  ext_login: '集成登录',
   enable_oauth: '启动OAuth2登录',
   your_showdoc_server: '【你的showdoc地址】',
   callback_eg: ' callback url填写示例',
   entrance_tips_label: '入口文字提示',
-  entrance_tips_content: "当启用OAuth2登录时候,登录界面将在输入框的下方出现此入口。你可以填上如'使用公司OA登录'这样的提示",
-  userinfo_path_content: '登录成功后获取用户信息的接口。可以写完整网址也可以写路径。当只填写路径的时候,将自动使用上面的Oauth host补充完整地址。该接口应当返回json字符串且包含username字段',
-  reset:'重新生成',
+  entrance_tips_content:
+    "当启用OAuth2登录时候,登录界面将在输入框的下方出现此入口。你可以填上如'使用公司OA登录'这样的提示",
+  userinfo_path_content:
+    '登录成功后获取用户信息的接口。可以写完整网址也可以写路径。当只填写路径的时候,将自动使用上面的Oauth host补充完整地址。该接口应当返回json字符串且包含username字段',
+  reset: '重新生成',
+
+  history_version_count: '历史版本数量',
+  history_version_count_content:
+    '每次编辑页面都会生成一个页面的历史版本。这里是保留的历史版本数量。默认只保留最新的20个版本'
 }

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio