This commit is contained in:
Florian Bouillon 2019-02-11 20:34:41 +01:00
parent df674a7ec5
commit 0399e5043b

271
readme.md
View File

@ -1,5 +1,25 @@
# Admin Panel # Admin Panel
## Table of Content
- [Admin Panel](#admin-panel)
- [Table of Content](#table-of-content)
- [Description](#description)
- [Changelog](#changelog)
- [Themes](#themes)
- [Templates](#templates)
- [styles & scripts](#styles--scripts)
- [Options](#options)
- [Modules](#modules)
- [Files/Folders architecture](#filesfolders-architecture)
- [Configs files](#configs-files)
- [page.json (in `pages` folder)](#pagejson-in-pages-folder)
- [scripts.json & styles.json](#scriptsjson--stylesjson)
- [admin.json](#adminjson)
- [vars.json](#varsjson)
- [moduleName.json & themeName.json](#modulenamejson--themenamejson)
- [templates.json](#templatesjson)
## Description ## Description
WIP WIP
@ -19,6 +39,7 @@ first a template named "page" is a must, your template can be static or not (sta
```php ```php
website->addTemplate("Template Name", "templateURI/from/root/page.php", "functionName", true); website->addTemplate("Template Name", "templateURI/from/root/page.php", "functionName", true);
``` ```
- `"Template Name"` is the shown name - `"Template Name"` is the shown name
- `"templateURI"` is the file URI - `"templateURI"` is the file URI
- `"functionName"` is the function used - `"functionName"` is the function used
@ -56,15 +77,16 @@ updating an option will update the static files
```php ```php
$optionMenu = website->addOptionsMenu("Menu Name"); $optionMenu = website->addOptionsMenu("Menu Name");
``` ```
here we create a new option menu that will be located in the admin sidebar `theme -> Options` within the tabs here we create a new option menu that will be located in the admin sidebar `theme -> Options` within the tabs
- `"Menu Name"` is the shown name - `"Menu Name"` is the shown name
```php ```php
$optionMenu->addTextOption("Option Name", "variableName", "defaultValue", { $optionMenu->addTextOption("Option Name", "variableName", "defaultValue", {
"min": 1, "min": 1,
"max": 16, "max": 16,
"placeholder": "placeholder" "placeholder": "placeholder"
}); });
``` ```
@ -83,155 +105,166 @@ To keep the document strict it's advised to use the php `DOMDocument` Object
- router.php (handle the first route part ( separating the loading process)) - router.php (handle the first route part ( separating the loading process))
- uploads/ - uploads/
- cache/ (public cache (won't be seen by client via .htaccess redirection)) - cache/ (public cache (won't be seen by client via .htaccess redirection))
- .htaccess (make sure clients can't access this folder) - .htaccess (make sure clients can't access this folder)
- scripts.js - scripts.js
- styles.css - styles.css
- pages/ (NO `scripts.js` NOR `styles.css` NOR `admin` NOR `login` files must be in here) - pages/ (NO `scripts.js` NOR `styles.css` NOR `admin` NOR `login` files must be in here)
- .htaccess (make sure clients can't access this folder) - .htaccess (make sure clients can't access this folder)
- index.json (this index.json will be the root name "/") - index.json (this index.json will be the root name "/")
- slugname.json (path = "/slugname") - slugname.json (path = "/slugname")
- iamjson.json.json (path = "/iamjson.json" wand with a module/theme could just return json) - iamjson.json.json (path = "/iamjson.json" wand with a module/theme could just return json)
- folderslug/ - folderslug/
- index.json (path = "/folderslug" if no index.json is given there will be a 404 error for "/folderslug" but not for the "/folderslug/pouet") - index.json (path = "/folderslug" if no index.json is given there will be a 404 error for "/folderslug" but not for the "/folderslug/pouet")
- pouet.json (path = "/folderslug/pouet") - pouet.json (path = "/folderslug/pouet")
- admin/ - admin/
- .htaccess manage redirection for admin pages (pass throught a verify login script) - .htaccess manage redirection for admin pages (pass throught a verify login script)
- index.php - index.php
- admin.js - admin.js
- admin.css - admin.css
- settings/ (settings files more infos [here](#config-files)) - settings/ (settings files more infos [here](#config-files))
- scripts.json (if cache is disabled these files will be used to get the styles & scripts) - scripts.json (if cache is disabled these files will be used to get the styles & scripts)
- styles.json (else these files are only used to create the caches files) - styles.json (else these files are only used to create the caches files)
- admin.json (admin settings (see admin.json section)) - admin.json (admin settings (see admin.json section))
- templates.json (simple name to redirect) - templates.json (simple name to redirect)
- modules/ - modules/
- moduleName/ - moduleName/
- settings.json - settings.json
- vars.json - vars.json
- themes/ - themes/
- themeName/ - themeName/
- settings.json - settings.json
- vars.json - vars.json
- admin.list (used to see what to launch on the admin side) - admin.json (used to see what to launch on the admin side)
- options.list (options for modules & themes to be used site-wide) - options.json (options for modules & themes to be used site-wide)
- templates.list (store the template used on the website with a link to there .php file) - templates.json (store the template used on the website with a link to there .php file)
- themes/ (when a new theme is loaded regenerate scripts.js & styles.css, an option will allow the use of direct files) - themes/ (when a new theme is loaded regenerate scripts.js & styles.css, an option will allow the use of direct files)
- default/ (a default theme will be here) - default/ (a default theme will be here)
- theme.php - theme.php
- themeName/ - themeName/
- theme.php (only launched on theme load, to generate cache files & admin options files) - theme.php (only launched on theme load, to generate cache files & admin options files)
- public.php (launched everytime on website when page is launched (admins sections are excluded) - public.php (launched everytime on website when page is launched (admins sections are excluded)
- admin.php (launched everytime on admin/themename/** launch (with args like page)) - admin.php (launched everytime on admin/themename/** launch (with args like page))
- templates/ (all folders included under are optional anc can be located somewhere else in the theme folder) - templates/ (all folders included under are optional anc can be located somewhere else in the theme folder)
- page.php (at least a template named "page" must exist to make the theme usable) - page.php (at least a template named "page" must exist to make the theme usable)
- templateName.php (file launched everytime a page is loaded with the template selected) - templateName.php (file launched everytime a page is loaded with the template selected)
- css/ - css/
- js/ - js/
- modules/ - modules/
- default/ (a default module will be here) - default/ (a default module will be here)
- module.php - module.php
- moduleName/ - moduleName/
- module.php - module.php
- public.php (same as theme) - public.php (same as theme)
## Configs files ## Configs files
### page.json (in `pages` folder) ### page.json (in `pages` folder)
```json ```json
{ {
"title": "pageTitle", "title": "pageTitle",
"template": "templateName", "template": "templateName",
"access": "typeOfAccess (public: everyone has access to the page, limited:only logged in users has access to the page, private: only the author & admins has access to the page)", "access": "typeOfAccess (public: everyone has access to the page, limited:only logged in users has access to the page, private: only the author & admins has access to the page)",
"author": "Aviortheking", "author": "Aviortheking",
"content": "<h1>hello world</h1>" "content": "<h1>hello world</h1>"
} }
``` ```
### scripts.json & styles.json ### scripts.json & styles.json
```json ```json
{ {
[ [
"path/to/script" "path/to/script"
] ]
} }
``` ```
### admin.list
### admin.json
```json ```json
{ {
"themeUsed": "themeName", "themeUsed": "themeName",
"modulesUsed": [ "modulesUsed": [
"moduleName", "moduleName",
"etc" "etc"
] ]
} }
``` ```
### vars.json ### vars.json
```json ```json
{ {
"variable1": "value1", "variable1": "value1",
"list1": [ "list1": [
"pouet1", "pouet1",
"etc" "etc"
], ],
"variableSet1": { "variableSet1": {
"subVariable1": "value2" "subVariable1": "value2"
} }
}
```
### moduleName.json & themeName.json
*values for the options are located in the `vars.json` files*
```json
{
[
{
"title": "Menu Title",
"slug": "menu-title",
"options": {
"textOption": {
"type": "text",
"name": "Option Name",
},
"radioOption": {
"type": "radio",
"name": "Radio Option",
"values": [
"value1",
"value2",
"value3"
],
},
"selectOption": {
"type": "select",
"name": "Select",
"value": [
"value1",
"value2",
"value3",
"etc"
]
}
}
},
{
"title": "etc"
}
]
} }
``` ```
### templates.list ### moduleName.json & themeName.json
values for the options are located in the `vars.json` files
```json
{
[
{
"title": "Menu Title",
"slug": "menu-title",
"options": {
"textOption": {
"type": "text",
"name": "Option Name",
},
"radioOption": {
"type": "radio",
"name": "Radio Option",
"values": [
"value1",
"value2",
"value3"
],
},
"selectOption": {
"type": "select",
"name": "Select",
"value": [
"value1",
"value2",
"value3",
"etc"
]
}
}
},
{
"title": "etc"
}
]
}
```
### templates.json
liste des tempplates crée par le theme
*voir si il y auras tout les themes ou seulement le theme actif* *voir si il y auras tout les themes ou seulement le theme actif*
if static is true then static webpage will be generated if static is true then static webpage will be generated
```json ```json
{ {
"templateName": { "templateName": {
"URI": "templates/templateName.php", "URI": "templates/templateName.php",
"function": "functionName", "function": "functionName",
"static": false "static": false
} }
} }
``` ```