@kohanajs/mod-cms
Advanced tools
Comparing version 9.5.2 to 9.6.0
@@ -5,2 +5,9 @@ # Changelog | ||
## [9.6.0](https://gitlab.com/kohana-js/proposals/level0/mod-cms/compare/v9.5.2...v9.6.0) (2023-05-25) | ||
### Features | ||
* import page csv ([f1f3d39](https://gitlab.com/kohana-js/proposals/level0/mod-cms/commit/f1f3d39fc8a311551ea42a8cc1173e5794ae9fa8)) | ||
### [9.5.2](https://gitlab.com/kohana-js/proposals/level0/mod-cms/compare/v9.5.1...v9.5.2) (2022-08-30) | ||
@@ -7,0 +14,0 @@ |
@@ -1,7 +0,4 @@ | ||
const path = require('node:path'); | ||
const {readFile} = require('node:fs').promises; | ||
const pluralize = require('pluralize'); | ||
const {ControllerMixinMultipartForm, HelperForm} = require("@kohanajs/mod-form"); | ||
const {ControllerMixinDatabase, ControllerMixinView, ORMAdapter, KohanaJS, ORM} = require("kohanajs"); | ||
const {ControllerAdmin} = require("@kohanajs/mod-admin"); | ||
const {ControllerAdmin, ControllerMixinImport} = require("@kohanajs/mod-admin"); | ||
const Page = ORM.require('Page'); | ||
@@ -24,2 +21,3 @@ class ControllerAdminContent extends ControllerAdmin{ | ||
this.state.set(ControllerMixinImport.UNIQUE_KEY, 'slug'); | ||
} | ||
@@ -46,4 +44,4 @@ | ||
Object.assign( | ||
this.state.get(ControllerMixinView.TEMPLATE).data, | ||
{ items, page_type } | ||
this.state.get(ControllerMixinView.TEMPLATE).data, | ||
{ items, page_type } | ||
); | ||
@@ -69,15 +67,3 @@ } | ||
async action_import_post(){ | ||
const $_POST = this.state.get(ControllerMixinMultipartForm.POST_DATA); | ||
const uploadRoot = `${KohanaJS.EXE_PATH}/../public`; | ||
const file = await HelperForm.moveToUpload($_POST['import_file'], '/media/import', uploadRoot); | ||
const buffer = await readFile(path.normalize(uploadRoot + file)); | ||
const text = buffer.toString('ucs2'); | ||
const data = text | ||
.replace(/^\uFEFF/, '') | ||
.replaceAll('\r\n', '\n') | ||
.split('\n'); | ||
const headers = data.shift().split('\t').map(it => it.toLowerCase()); | ||
await this.redirect(`/admin/contents/list/${this.request.params['page_type']}`); | ||
} | ||
@@ -84,0 +70,0 @@ } |
{ | ||
"name": "@kohanajs/mod-cms", | ||
"version": "9.5.2", | ||
"version": "9.6.0", | ||
"description": "The CMS module for KohanaJS", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -14,2 +14,3 @@ const { RouteList } = require('@kohanajs/mod-route'); | ||
RouteList.add('/admin/contents/list/:page_type', 'controller/admin/Content'); | ||
RouteList.add('/admin/contents/import/:page_type', 'controller/admin/Content', 'import_post', 'POST'); | ||
RouteList.add('/admin/contents/create/:page_type', 'controller/admin/Content', 'create_by_type'); | ||
@@ -16,0 +17,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
154701
1448