diff --git a/.gitignore b/.gitignore index b0baee5..95859c1 100644 --- a/.gitignore +++ b/.gitignore @@ -466,3 +466,8 @@ conf/modules.inc.php conf/routers.inc.php conf/lang.inc.php logs/Exception.log + + +z_dome/ +composer.lock +adminer.php diff --git a/composer.json b/composer.json index 0288075..718e2ae 100755 --- a/composer.json +++ b/composer.json @@ -5,7 +5,13 @@ "authors": [ { "name": "Maurice Grönwoldt", - "email": "mauricegroenwoldt@gmail.com" + "email": "mauricegroenwoldt@gmail.com", + "description": "founder" + }, + { + "name": "Dominic Seela", + "email": "kontakt@engineertrooper.com", + "description": "friendly developer, supporter" } ], "require": { diff --git a/public/theme/admin/css/admin-panel.css b/public/theme/admin/css/admin-panel.css index b2dec83..c726ea0 100644 --- a/public/theme/admin/css/admin-panel.css +++ b/public/theme/admin/css/admin-panel.css @@ -1 +1 @@ -main{display:flex;height:100vh;overflow:hidden}.menu{width:220px;background-color:#1b1b1b;box-shadow:0 3px 6px rgba(0,0,0,.16),0 3px 6px rgba(0,0,0,.23);flex-shrink:0;display:flex;flex-direction:column}.menu .logo{text-align:center;font-family:monospace}.menu div[data-link]{padding:.75rem .5rem;position:relative}.menu div[data-link]:after{background-color:#3949ab;content:"";position:absolute;left:0;bottom:0;height:3px;width:100%;transform:scaleX(0);transition:transform .4s;transform-origin:left}.menu div[data-link]:hover:after{transform:scaleX(1)}.menu div[data-link]:last-child{margin-top:auto}.menu div[data-link].active{font-weight:700}.content-area{padding:0 1%;margin:1rem 1.5rem;flex-grow:1;overflow-y:auto;width:100%;max-height:100%;background:rgba(27,27,27,.5)}.content-area .inline{display:inline}.content-area .inline div{display:inline}.content-area .btn-line{margin-top:35px}.content-area .btn-line div{text-align:right}.content-area .btn-line div button{display:inline;margin-left:10px;min-width:100px}.content-area textarea{background:rgba(27,27,27,.5);color:#fff;margin:15px 0 0 0;font-family:sans-serif;font-size:1.1rem;min-width:100%}.content-area .modules div{padding:6px 20px 6px 0}.content-area .fix-pad{padding-top:14px} \ No newline at end of file +main{display:flex;height:100vh;overflow:hidden}.menu{width:220px;background-color:#1b1b1b;box-shadow:0 3px 6px rgba(0,0,0,.16),0 3px 6px rgba(0,0,0,.23);flex-shrink:0;display:flex;flex-direction:column}.menu .logo{text-align:center;font-family:monospace}.menu div[data-link]{padding:.75rem .5rem;position:relative}.menu div[data-link]:after{background-color:#3949ab;content:"";position:absolute;left:0;bottom:0;height:3px;width:100%;transform:scaleX(0);transition:transform .4s;transform-origin:left}.menu div[data-link]:hover:after{transform:scaleX(1)}.menu div[data-link]:last-child{margin-top:auto}.menu div[data-link].active{font-weight:700}.content-area{padding:0 1%;margin:1rem 1.5rem;flex-grow:1;overflow-y:auto;width:100%;max-height:100%;background:rgba(27,27,27,.5)}.content-area header{display:block;text-align:center}.content-area .back-arrow{width:36px;height:36px}.content-area .block{display:block}.content-area .flexbox{display:flex;flex-wrap:wrap}.content-area .flexbox div{width:50%}.content-area .inline{display:inline}.content-area .inline div{display:inline}.content-area .btn-line{margin-top:35px}.content-area .btn-line div{text-align:right}.content-area .btn-line div button{display:inline;margin-left:10px;min-width:100px}.content-area .role-edit .block{margin:40px 0}.content-area .role-edit .role-switches h4{padding:0 5px}.content-area .role-edit .role-switches div v-switch{padding:10px 5px;border-bottom:#5d5d5d 1px solid}.content-area .role-edit .role-switches .modules div{padding:14px 5px 8px 5px}.content-area textarea{background:rgba(27,27,27,.5);color:#fff;margin:15px 0 0 0;font-family:sans-serif;font-size:1.1rem;min-width:100%}.content-area .modules div{padding:6px 20px 6px 0}.content-area .fix-pad{padding-top:14px} \ No newline at end of file diff --git a/public/theme/admin/css/style.css b/public/theme/admin/css/style.css index 802a781..15efef7 100644 --- a/public/theme/admin/css/style.css +++ b/public/theme/admin/css/style.css @@ -1 +1 @@ -:focus{outline:0}*{box-sizing:border-box}body,html{width:100vw;height:100vh;overflow:hidden;padding:0;margin:0;background:#1f2857;background:linear-gradient(144deg,#1f2954 25%,#000 50%,#5e002c 80%);background-attachment:fixed;color:#fff;font-family:sans-serif;font-size:16px}.hide{display:none!important}.icon{width:1em;height:1em;vertical-align:middle;font-size:1em;shape-rendering:geometricPrecision;transition:transform .5s cubic-bezier(.22,.61,.36,1);stroke-width:5px;text-align:center;display:block;margin-right:.5rem}.icon-text{display:inline-block}[data-link]{cursor:pointer}.btn{border:none;background:#3949ab radial-gradient(circle at 0 0,#3949ab 0,rgba(0,0,0,.2) 100%) no-repeat;color:#fff;padding:7px 1.1rem;margin:10px 0;cursor:pointer;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:4px;box-shadow:0 2px 5px 0 rgba(0,0,0,.26);overflow:hidden;display:flex;justify-content:center;align-items:center;transition:.5s}.btn--outline{background:0 0;border:1px solid #3949ab}.btn:focus{box-shadow:0 3px 8px 1px rgba(0,0,0,.4)}.btn--valid{background:#39ab48 radial-gradient(circle at 0 0,#39ab48 0,rgba(0,0,0,.2) 100%) no-repeat}.btn--accent{background:#ff0089 radial-gradient(circle at 0 0,#ff0089 0,rgba(0,0,0,.2) 100%) no-repeat}.btn--warn{background:#f87229 radial-gradient(circle at 0 0,#f87229 0,rgba(0,0,0,.2) 100%) no-repeat}.btn-fab{border-radius:2rem;width:2em;height:2em;padding:5px}.btn-ripple{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;background:0 0}.btn-ripple__effect{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);opacity:1;width:200%;height:0;padding-bottom:200%;border-radius:50%;background:rgba(190,190,190,.3);-webkit-animation:a-ripple .4s ease-in;animation:a-ripple .4s ease-in}.btn-ripple__effect.to-remove{-webkit-animation:remove-ripple .2s linear;animation:remove-ripple .2s linear}.btn--outline .btn-ripple__effect{background:rgba(57,73,171,.5);z-index:-1}.btn__content{z-index:1;font-weight:400;pointer-events:none}@-webkit-keyframes remove-ripple{from{opacity:1}to{opacity:0}}@keyframes remove-ripple{from{opacity:1}to{opacity:0}}@-webkit-keyframes a-ripple{0%{opacity:0;padding-bottom:0;width:0}25%{opacity:1}100%{width:200%;padding-bottom:200%}}@keyframes a-ripple{0%{opacity:0;padding-bottom:0;width:0}25%{opacity:1}100%{width:200%;padding-bottom:200%}}v-input input{background-color:rgba(0,0,0,.4);border:none;border-bottom:2px solid #3949ab;color:#fff;padding:calc(.75rem - 1px)}v-input input:focus,v-input.focus input{border-color:#ff0089}v-input.valid input{border-color:#39ab48}v-input.invalid input{border-color:#cf1b1b}v-input{display:flex;flex-direction:column;margin-bottom:3px;position:relative;padding-top:.7rem}v-input.no-space{padding-top:.1rem}v-input label{font-size:.7rem;position:absolute;top:.7rem;left:6px;height:1.5rem;pointer-events:none;vertical-align:middle;transform:translateY(50%);color:#dcdcdc;transition:all .2s ease-out}v-input input:focus~label,v-input.focus label{top:0;left:0;transform:translateY(0);font-size:.6rem}v-input .error{display:none}v-input.invalid .error{margin-top:2px;display:block;font-size:.7rem;color:#f32f32}.switch{display:flex;flex-direction:row;align-items:center;padding:5px 20px 5px 0}.switch input{position:absolute;-webkit-appearance:none;-moz-appearance:none;appearance:none;opacity:0}.switch label{display:block;border-radius:10px;width:40px;height:20px;background-color:#e9e9e9;position:relative;cursor:pointer;margin-right:.5rem}.switch label:after{content:'';background-color:#c51162;position:absolute;top:2px;left:2px;height:16px;width:16px;border-radius:10px;transition:.5s}.switch input:checked+label:after{transform:translateX(20px);background-color:#007769}.loader{display:flex;justify-content:center;align-items:center;width:100vw;height:100vh;position:absolute;top:0;z-index:10000;background-color:rgba(0,0,0,.4);opacity:1;transition:opacity .3s}.loader.hide{display:block;opacity:0;pointer-events:none}.loader .spinner{-webkit-animation:rotator 1.4s linear infinite;animation:rotator 1.4s linear infinite}.loader .path{stroke-dasharray:187;stroke-dashoffset:0;transform-origin:center;-webkit-animation:dash 1.4s ease-in-out infinite,colors 5.6s ease-in-out infinite;animation:dash 1.4s ease-in-out infinite,colors 5.6s ease-in-out infinite}@-webkit-keyframes rotator{from{transform:rotate(0)}to{transform:rotate(270deg)}}@keyframes rotator{from{transform:rotate(0)}to{transform:rotate(270deg)}}@-webkit-keyframes colors{0%{stroke:#4285f4}25%{stroke:#de3e35}50%{stroke:#f7c223}75%{stroke:#1b9a59}100%{stroke:#4285f4}}@keyframes colors{0%{stroke:#4285f4}25%{stroke:#de3e35}50%{stroke:#f7c223}75%{stroke:#1b9a59}100%{stroke:#4285f4}}@-webkit-keyframes dash{0%{stroke-dashoffset:187}50%{stroke-dashoffset:46.75;transform:rotate(135deg)}100%{stroke-dashoffset:187;transform:rotate(450deg)}}@keyframes dash{0%{stroke-dashoffset:187}50%{stroke-dashoffset:46.75;transform:rotate(135deg)}100%{stroke-dashoffset:187;transform:rotate(450deg)}}v-table{display:block}v-table v-table-footer,v-table v-table-header,v-table v-table-row{display:grid;grid-auto-columns:1fr;grid-auto-flow:column;-moz-column-gap:20px;column-gap:20px}v-table v-table-header h2{text-align:center}v-table v-table-row{margin:10px 0}v-table .grid12{grid-template-columns:repeat(12,[col-start] 1fr);-moz-column-gap:5px;column-gap:5px}v-table .grid12 .col-1to4{grid-column:1/3}v-table .grid12 .col-1to6{grid-column:1/6}v-table .grid12 .col-5to6{grid-column:5/6}v-table .grid12 .col-6to11{grid-column:6/11}v-table .grid12 .col-6to9{grid-column:6/9}v-table .grid12 .col-9to10{grid-column:9/10}v-table .grid12 .col-11to13{grid-column:11/13}v-label,v-option,v-options,v-select{display:inline-block;box-sizing:border-box}v-select{display:block;position:relative;margin-bottom:.5rem}v-label{padding:.5rem 1rem;background-color:#3949ab;color:#fff;cursor:pointer;display:block;border-radius:4px}v-options{position:absolute;display:flex;border-radius:4px;flex-direction:column;overflow:hidden;max-height:0;top:.5rem;left:.5rem;background-color:#3949ab;z-index:1000;cursor:pointer;color:#fff;box-shadow:0 3px 6px rgba(0,0,0,.16),0 3px 6px rgba(0,0,0,.23)}v-option{padding:.5rem 1rem;min-width:200px}v-option:not([disabled]):hover{background-color:rgba(0,0,0,.3)}v-option[selected]{background-color:#3949ab;color:#fff}v-option[disabled]{color:#aaa} \ No newline at end of file +:focus{outline:0}*{box-sizing:border-box}body,html{width:100vw;height:100vh;overflow:hidden;padding:0;margin:0;background:#1f2857;background:linear-gradient(144deg,#1f2954 25%,#000 50%,#5e002c 80%);background-attachment:fixed;color:#fff;font-family:sans-serif;font-size:16px}.hide{display:none!important}.icon{width:1em;height:1em;vertical-align:middle;font-size:1em;shape-rendering:geometricPrecision;transition:transform .5s cubic-bezier(.22,.61,.36,1);stroke-width:5px;text-align:center;display:block;margin-right:.5rem}.icon-text{display:inline-block}[data-link]{cursor:pointer}[data-link] *{pointer-events:none}.btn{border:none;background:#3949ab radial-gradient(circle at 0 0,#3949ab 0,rgba(0,0,0,.2) 100%) no-repeat;color:#fff;padding:7px 1.1rem;margin:10px 0;cursor:pointer;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:4px;box-shadow:0 2px 5px 0 rgba(0,0,0,.26);overflow:hidden;display:flex;justify-content:center;align-items:center;transition:.5s}.btn--outline{background:0 0;border:1px solid #3949ab}.btn:focus{box-shadow:0 3px 8px 1px rgba(0,0,0,.4)}.btn--valid{background:#39ab48 radial-gradient(circle at 0 0,#39ab48 0,rgba(0,0,0,.2) 100%) no-repeat}.btn--accent{background:#ff0089 radial-gradient(circle at 0 0,#ff0089 0,rgba(0,0,0,.2) 100%) no-repeat}.btn--warn{background:#f87229 radial-gradient(circle at 0 0,#f87229 0,rgba(0,0,0,.2) 100%) no-repeat}.btn-fab{border-radius:2rem;width:2em;height:2em;padding:5px}.btn-ripple{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;background:0 0}.btn-ripple__effect{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);opacity:1;width:200%;height:0;padding-bottom:200%;border-radius:50%;background:rgba(190,190,190,.3);-webkit-animation:a-ripple .4s ease-in;animation:a-ripple .4s ease-in}.btn-ripple__effect.to-remove{-webkit-animation:remove-ripple .2s linear;animation:remove-ripple .2s linear}.btn--outline .btn-ripple__effect{background:rgba(57,73,171,.5);z-index:-1}.btn__content{z-index:1;font-weight:400;pointer-events:none}@-webkit-keyframes remove-ripple{from{opacity:1}to{opacity:0}}@keyframes remove-ripple{from{opacity:1}to{opacity:0}}@-webkit-keyframes a-ripple{0%{opacity:0;padding-bottom:0;width:0}25%{opacity:1}100%{width:200%;padding-bottom:200%}}@keyframes a-ripple{0%{opacity:0;padding-bottom:0;width:0}25%{opacity:1}100%{width:200%;padding-bottom:200%}}v-input input{background-color:rgba(0,0,0,.4);border:none;border-bottom:2px solid #3949ab;color:#fff;padding:calc(.75rem - 1px)}v-input input:focus,v-input.focus input{border-color:#ff0089}v-input.valid input{border-color:#39ab48}v-input.invalid input{border-color:#cf1b1b}v-input{display:flex;flex-direction:column;margin-bottom:5px;position:relative;padding-top:.7rem}v-input.no-space{padding-top:.1rem}v-input label{font-size:.7rem;position:absolute;top:.7rem;left:5px;height:1.5rem;pointer-events:none;vertical-align:middle;transform:translateY(50%);color:#dcdcdc;transition:all .2s ease-out}v-input input:focus~label,v-input.focus label{top:0;left:0;transform:translateY(0);font-size:.6rem}v-input .error{display:none}v-input.invalid .error{margin-top:2px;display:block;font-size:.7rem;color:#f32f32}v-switch{display:flex;flex-direction:row;align-items:center;padding:5px 20px 5px 0}v-switch input{position:absolute;-webkit-appearance:none;-moz-appearance:none;appearance:none;opacity:0}v-switch label{display:block;border-radius:10px;width:40px;height:20px;background-color:#e9e9e9;position:relative;cursor:pointer;margin-right:.5rem}v-switch label:after{content:'';background-color:#c51162;position:absolute;top:2px;left:2px;height:16px;width:16px;border-radius:10px;transition:.5s}v-switch input:checked+label:after{transform:translateX(20px);background-color:#007769}.loader{display:flex;justify-content:center;align-items:center;width:100vw;height:100vh;position:absolute;top:0;z-index:10000;background-color:rgba(0,0,0,.4);opacity:1;transition:opacity .3s}.loader.hide{display:block;opacity:0;pointer-events:none}.loader .spinner{-webkit-animation:rotator 1.4s linear infinite;animation:rotator 1.4s linear infinite}.loader .path{stroke-dasharray:187;stroke-dashoffset:0;transform-origin:center;-webkit-animation:dash 1.4s ease-in-out infinite,colors 5.6s ease-in-out infinite;animation:dash 1.4s ease-in-out infinite,colors 5.6s ease-in-out infinite}@-webkit-keyframes rotator{from{transform:rotate(0)}to{transform:rotate(270deg)}}@keyframes rotator{from{transform:rotate(0)}to{transform:rotate(270deg)}}@-webkit-keyframes colors{0%{stroke:#4285f4}25%{stroke:#de3e35}50%{stroke:#f7c223}75%{stroke:#1b9a59}100%{stroke:#4285f4}}@keyframes colors{0%{stroke:#4285f4}25%{stroke:#de3e35}50%{stroke:#f7c223}75%{stroke:#1b9a59}100%{stroke:#4285f4}}@-webkit-keyframes dash{0%{stroke-dashoffset:187}50%{stroke-dashoffset:46.75;transform:rotate(135deg)}100%{stroke-dashoffset:187;transform:rotate(450deg)}}@keyframes dash{0%{stroke-dashoffset:187}50%{stroke-dashoffset:46.75;transform:rotate(135deg)}100%{stroke-dashoffset:187;transform:rotate(450deg)}}v-table{display:block}v-table v-table-footer,v-table v-table-header,v-table v-table-row{display:grid;grid-auto-columns:1fr;grid-auto-flow:column;-moz-column-gap:20px;column-gap:20px}v-table v-table-row{background:rgba(27,27,27,.5);border-radius:4px;padding:15px;margin:10px 0}v-table v-table-row h4{margin:0 0 10px 0}v-table .grid12{grid-template-columns:repeat(12,[col-start] 1fr);-moz-column-gap:5px;column-gap:5px}v-table .grid12 .col-1to4{grid-column:1/3}v-table .grid12 .col-1to6{grid-column:1/6}v-table .grid12 .col-5to6{grid-column:5/6}v-table .grid12 .col-6to11{grid-column:6/11}v-table .grid12 .col-6to9{grid-column:6/9}v-table .grid12 .col-9to10{grid-column:9/10}v-table .grid12 .col-11to13{grid-column:11/13}v-label,v-option,v-options,v-select{display:inline-block;box-sizing:border-box}v-select{display:block;position:relative;margin-bottom:.5rem}v-label{padding:.5rem 1rem;background-color:#3949ab;color:#fff;cursor:pointer;display:block;border-radius:4px}v-options{position:absolute;display:flex;border-radius:4px;flex-direction:column;overflow:hidden;max-height:0;top:.5rem;left:.5rem;background-color:#3949ab;z-index:1000;cursor:pointer;color:#fff;box-shadow:0 3px 6px rgba(0,0,0,.16),0 3px 6px rgba(0,0,0,.23)}v-option{padding:.5rem 1rem;min-width:200px}v-option:not([disabled]):hover{background-color:rgba(0,0,0,.3)}v-option[selected]{background-color:#3949ab;color:#fff}v-option[disabled]{color:#aaa} \ No newline at end of file diff --git a/public/theme/admin/js/components.js b/public/theme/admin/js/components.js index 449a3f1..f333f23 100644 --- a/public/theme/admin/js/components.js +++ b/public/theme/admin/js/components.js @@ -23,6 +23,66 @@ class Component { } } } +class MetaDataComponent extends Component { + constructor() { + super("/metaData"); + this.tpl = "metaDataList"; + this.tpl2 = "metaDataEdit"; + this._url = "/admin/api/metaData"; + } + + async handle(data, ds) { + let meTpl = ds.id ? this.tpl2 : this.tpl; + await tpl.loadTemplate(meTpl); + return await tpl.renderOn(meTpl, data.content); + } + + getUrl(ds) { + let url = this._url; + if (ds.id) { + url += '/' + ds.id; + } + return url; + } +} +class OverviewComponent extends Component { + constructor() { + super("/overview"); + this.tpl = "overview"; + this._url = "/admin/api/overview"; + } + + async handle(data, ds) { + await tpl.loadTemplate(this.tpl); + return await tpl.renderOn(this.tpl, data.content); + } + + getUrl(ds) { + return this._url; + } +} +class PagesComponent extends Component { + constructor() { + super("/pages"); + this.tpl = "pagesList"; + this.tpl2 = "pageEdit"; + this._url = "/admin/api/pages"; + } + + async handle(data, ds) { + let meTpl = ds.id ? this.tpl2 : this.tpl; + await tpl.loadTemplate(meTpl); + return await tpl.renderOn(meTpl, data.content); + } + + getUrl(ds) { + let url = this._url; + if (ds.id) { + url += '/' + ds.id; + } + return url; + } +} class RolesComponent extends Component { constructor() { super("/roles"); @@ -45,9 +105,76 @@ class RolesComponent extends Component { return url; } } +class SeoUrlComponent extends Component { + constructor() { + super("/seoUrl"); + this.tpl = "seoUrlList"; + this.tpl2 = "seoUrlEdit"; + this._url = "/admin/api/seoUrl"; + } + + async handle(data, ds) { + let meTpl = ds.id ? this.tpl2 : this.tpl; + await tpl.loadTemplate(meTpl); + return await tpl.renderOn(meTpl, data.content); + } + + getUrl(ds) { + let url = this._url; + if (ds.id) { + url += '/' + ds.id; + } + return url; + } +} +class UsersComponent extends Component { + constructor() { + super("/users"); + this.tpl = "usersList"; + this.tpl2 = "userEdit"; + this._url = "/admin/api/users"; + } + + async handle(data, ds) { + let meTpl = ds.id ? this.tpl2 : this.tpl; + await tpl.loadTemplate(meTpl); + return await tpl.renderOn(meTpl, data.content); + } + + getUrl(ds) { + let url = this._url; + if (ds.id) { + url += '/' + ds.id; + } + return url; + } +} +class VenomStatusComponent extends Component { + constructor() { + super("/venomStatus"); + this.tpl = "venomStatus"; + this._url = "/admin/api/venomStatus"; + } + + async handle(data, ds) { + await tpl.loadTemplate(this.tpl); + return await tpl.renderOn(this.tpl, data.content); + } + + getUrl(ds) { + return this._url; + } +} (() => { // init all Components ;) + new MetaDataComponent(); + new OverviewComponent(); + new PagesComponent(); new RolesComponent(); + new SeoUrlComponent(); + new UsersComponent(); + new VenomStatusComponent(); + if (routerIsReady) { document.body.dispatchEvent(new CustomEvent('triggerRouter')); diff --git a/public/theme/admin/js/components.min.js b/public/theme/admin/js/components.min.js index aeeb4bb..f9ea5ed 100644 --- a/public/theme/admin/js/components.min.js +++ b/public/theme/admin/js/components.min.js @@ -1 +1 @@ -class Component{constructor(t){this.name=t,this.start()}handle(t,e){}init(){}getUrl(t){return""}start(){window.routerIsReady?(router.addComponent(this.name||VUtils.tempId(),this),this.init()):window.addEventListener("routerReady",this.start.bind(this))}}class RolesComponent extends Component{constructor(){super("/roles"),this.tpl="rolesList",this.tpl2="roleEdit",this._url="/admin/api/roles"}async handle(t,e){let n=e.id?this.tpl2:this.tpl;return await tpl.loadTemplate(n),await tpl.renderOn(n,t.content)}getUrl(t){let e=this._url;return t.id&&(e+="/"+t.id),e}}new RolesComponent,routerIsReady?document.body.dispatchEvent(new CustomEvent("triggerRouter")):document.addEventListener("routerReady",t=>{document.body.dispatchEvent(new CustomEvent("triggerRouter"))}); \ No newline at end of file +class Component{constructor(t){this.name=t,this.start()}handle(t,e){}init(){}getUrl(t){return""}start(){window.routerIsReady?(router.addComponent(this.name||VUtils.tempId(),this),this.init()):window.addEventListener("routerReady",this.start.bind(this))}}class MetaDataComponent extends Component{constructor(){super("/metaData"),this.tpl="metaDataList",this.tpl2="metaDataEdit",this._url="/admin/api/metaData"}async handle(t,e){let n=e.id?this.tpl2:this.tpl;return await tpl.loadTemplate(n),await tpl.renderOn(n,t.content)}getUrl(t){let e=this._url;return t.id&&(e+="/"+t.id),e}}class OverviewComponent extends Component{constructor(){super("/overview"),this.tpl="overview",this._url="/admin/api/overview"}async handle(t,e){return await tpl.loadTemplate(this.tpl),await tpl.renderOn(this.tpl,t.content)}getUrl(t){return this._url}}class PagesComponent extends Component{constructor(){super("/pages"),this.tpl="pagesList",this.tpl2="pageEdit",this._url="/admin/api/pages"}async handle(t,e){let n=e.id?this.tpl2:this.tpl;return await tpl.loadTemplate(n),await tpl.renderOn(n,t.content)}getUrl(t){let e=this._url;return t.id&&(e+="/"+t.id),e}}class RolesComponent extends Component{constructor(){super("/roles"),this.tpl="rolesList",this.tpl2="roleEdit",this._url="/admin/api/roles"}async handle(t,e){let n=e.id?this.tpl2:this.tpl;return await tpl.loadTemplate(n),await tpl.renderOn(n,t.content)}getUrl(t){let e=this._url;return t.id&&(e+="/"+t.id),e}}class SeoUrlComponent extends Component{constructor(){super("/seoUrl"),this.tpl="seoUrlList",this.tpl2="seoUrlEdit",this._url="/admin/api/seoUrl"}async handle(t,e){let n=e.id?this.tpl2:this.tpl;return await tpl.loadTemplate(n),await tpl.renderOn(n,t.content)}getUrl(t){let e=this._url;return t.id&&(e+="/"+t.id),e}}class UsersComponent extends Component{constructor(){super("/users"),this.tpl="usersList",this.tpl2="userEdit",this._url="/admin/api/users"}async handle(t,e){let n=e.id?this.tpl2:this.tpl;return await tpl.loadTemplate(n),await tpl.renderOn(n,t.content)}getUrl(t){let e=this._url;return t.id&&(e+="/"+t.id),e}}class VenomStatusComponent extends Component{constructor(){super("/venomStatus"),this.tpl="venomStatus",this._url="/admin/api/venomStatus"}async handle(t,e){return await tpl.loadTemplate(this.tpl),await tpl.renderOn(this.tpl,t.content)}getUrl(t){return this._url}}new MetaDataComponent,new OverviewComponent,new PagesComponent,new RolesComponent,new SeoUrlComponent,new UsersComponent,new VenomStatusComponent,routerIsReady?document.body.dispatchEvent(new CustomEvent("triggerRouter")):document.addEventListener("routerReady",t=>{document.body.dispatchEvent(new CustomEvent("triggerRouter"))}); \ No newline at end of file diff --git a/public/theme/admin/js/scripts.js b/public/theme/admin/js/scripts.js index 50a7c29..c943fb7 100644 --- a/public/theme/admin/js/scripts.js +++ b/public/theme/admin/js/scripts.js @@ -476,7 +476,17 @@ class FormHandler { } } + class VSwitch extends HTMLElement { + constructor() { + super(); + const id = this.dataset.id || VUtils.tempId(); + $('input', this).id = id; + $('label', this).setAttribute('for', id); + } + } + customElements.define("v-input", VInput); + customElements.define("v-switch", VSwitch); if ($('#login')) { new FormHandler('form#login', 'body', () => { @@ -685,7 +695,8 @@ class FormHandler { }); }) document.body.addEventListener('triggerRouter', e => { - this.handle(sessionStorage.getItem('url')); + let storage = sessionStorage.getItem('url') || JSON.stringify({data: {link: $('[data-link].active').dataset.link}}); + this.handle(storage); }) window.addEventListener('popstate', e => { this.handle(e.state); @@ -1157,7 +1168,7 @@ class VTpeLTemplate { parseContent(cache) { if (cache) { - let storage = localStorage.getItem(this.name); + let storage = localStorage.getItem("vtepl-"+this.name); if (storage) { this.parser.parsed = JSON.parse(storage); return; @@ -1165,7 +1176,7 @@ class VTpeLTemplate { } this.parser.tokenize(); if (cache) { - localStorage.setItem(this.name, JSON.stringify(this.parser.parsed)); + localStorage.setItem("vtepl-"+this.name, JSON.stringify(this.parser.parsed)); } } } @@ -1181,5 +1192,6 @@ class VTpeLTemplate { 'includes/input', 'includes/select', 'includes/svg', + 'includes/switch' ]) })(); \ No newline at end of file diff --git a/public/theme/admin/js/scripts.min.js b/public/theme/admin/js/scripts.min.js index db8f724..fa40768 100644 --- a/public/theme/admin/js/scripts.min.js +++ b/public/theme/admin/js/scripts.min.js @@ -1 +1 @@ -class VUtils{static makePublic(){VUtils.isUsed||(this.initHandlers(),VUtils.isUsed=!0,console.log("[VUtils] is now available in the Global Space! no VUtils. anymore needed"))}static initHandlers(){window.$=this.$,window.$$=this.$$,window.tryCatch=this.tryCatch,VUtils.nodePrototypes()}static $(e,t){return(t=t||document).querySelector(e)}static $$(e,t){return(t=t||document).querySelectorAll(e)}static tryCatch(e,t,i){e=VUtils.wrap(e,[]),i=i||console.error,t=t||console.log;try{t(...e)}catch(e){i(e)}}static forEach(e,t,i){for(let s=0;s{let n=e.target;if(e.detail instanceof HTMLElement&&(n=e.detail),n instanceof HTMLElement)if(n.matches(t))VUtils.tryCatch([e,n],i,s);else{const r=n.find(t);r&&VUtils.tryCatch([e,r],i,s)}})},Node.prototype.addMultiListener=function(e,t,i={}){let s=e.split(" ");for(let e of s)this.addEventListener(e,t,i)}}}VUtils.makePublic();class VRipple{constructor(e={}){if(!VUtils.isUsed)throw"VRipply is only with Public VUtils usable!";let t=this;if(t.options=JSON.parse('{"classes":["btn-ripple__effect"],"target":"body","selector":".btn-ripple"}'),VUtils.mergeOptions(t.options,e),t.options.selector.indexOf("#")>-1)throw"ID's are not allowed as selector!";this.instanceCheck(),this.ripples=[],requestAnimationFrame(this.initHandler.bind(this))}instanceCheck(){let e=this.options;const t=[e.target,e.selector,e.classes.join(".")].join(" ");VRipple.instances=VRipple.instances||{},VRipple.instances[t]=this}initHandler(){let e=this,t=e.options.selector;$(e.options.target).addDelegatedEventListener("mousedown touchstart",t,(t,i)=>{let s=t.touches?t.touches[0]:t,n=i.parentNode,r=i.createNew("span",e.options),a=n.getBoundingClientRect(),o=s.clientX-a.left,l=s.clientY-a.top;r.style.top=l+"px",r.style.left=o+"px",r._mouseDown=!0,r._animationEnded=!1,e.ripples.push(r)}),document.body.addDelegatedEventListener("animationend","."+VUtils.get(e.options.classes,""),e.rippleEnd.bind(e)),document.body._vRippleInit||(document.body.addMultiListener("mouseup touchend mouseleave rippleClose",t=>{let i=Object.keys(VRipple.instances);for(let s of i)for(let i of VRipple.instances[s].ripples)e.rippleEnd.bind(VRipple.instances[s])(t,i)}),document.body._vRippleInit=!0)}rippleEnd(e,t){t.parentNode&&("animationend"===e.type?t._animationEnded=!0:t._mouseDown=!1,!t._mouseDown&&t._animationEnded&&(t.classList.contains("to-remove")?(t.parentNode.removeChild(t),this.ripples.splice(this.ripples.indexOf(t),1)):t.classList.add("to-remove")))}}const rippler=new VRipple;!function(){window._openVSelect=null,requestAnimationFrame(e=>{document.body.addEventListener("click",e=>{window._openVSelect&&e.target.closest("v-select")!==window._openVSelect&&window._openVSelect.toggle(!1)})});class e extends HTMLElement{constructor(){super();let e=this;e._in=this.attachInternals(),e._in.role="select",e.setAttribute("tabindex",0),e.update()}static get formAssociated(){return!0}static get observedAttributes(){return["required","validity"]}get required(){return this.hasAttribute("required")}set required(e){this.toggleAttribute("required",Boolean(e))}get name(){return this.getAttribute("name")}set name(e){this.toggleAttribute("name",e)}get form(){return this._in.form}get options(){return $$("v-options v-option",this)}get selected(){return $$("v-options v-option[selected]",this)}update(){let e=[],t=$("v-label",this),i=new FormData;this.selected.forEach(t=>{e.push(t.innerText),i.append(this.name,t.value)}),t.attributeChangedCallback("value","",e.join(", ")),this.required&&0===e.length?this._in.setValidity({customError:!0},"Option is needed"):this._in.setValidity({}),this._in.setFormValue(i)}checkValidity(){return this._in.checkValidity()}reportValidity(){return this._in.reportValidity()}toggle(e){window._openVSelect&&e&&window._openVSelect.toggleSelect(!1);const t=$("v-options",this);if(!e||this.isOpen)t.style.maxHeight="0",window._openVSelect=!1,this.isOpen=!1,this.update();else{t.focus();let e=0,i=t.children;for(let t=0;t{let t=this.parentNode.parentNode,i=!this.selected;if(!t.hasAttribute("multiple")){t.toggle(!1);for(let e of t.selected)e!==this&&e.removeAttribute("selected")}this.disabled||(this.attributeChangedCallback("selected",!1,i,!0),this.parentNode.parentNode.update())})}static get observedAttributes(){return["selected","disabled","value"]}attributeChangedCallback(e,t,i,s){"selected"===e&&this.hasAttribute("disabled")?this.removeAttribute(e):("disabled"===e&&!0===i&&this.hasAttribute("selected")&&this.attributeChangedCallback("selected",!1,!1),s&&(i?this.setAttribute(e,i):this.removeAttribute(e)),this[e]=i)}}class i extends HTMLElement{constructor(){super(),this.empty=this.getAttribute("empty")||"",this.innerHTML=this.getAttribute("value")||this.empty,this.addEventListener("click",this.openPopUp.bind(this))}static get observedAttributes(){return["empty","value"]}openPopUp(){this.parentNode.toggle(!0)}attributeChangedCallback(e,t,i){"value"===e&&(this.innerHTML=i||this.empty),this[e]=i}}customElements.define("v-label",i),customElements.define("v-option",t),customElements.define("v-select",e)}();class FormHandler{constructor(e,t,i,s){this.cb=i||console.log,this.err=s||console.err,$(t).addDelegatedEventListener("submit",e,this.handleEvent.bind(this))}handleEvent(e,t){if(e.preventDefault(),t.checkValidity()){if(""===(t.action??""))return void console.error("No URL Found on Form",t);fetch(t.action,{method:t.method.toUpperCase(),credentials:"same-origin",body:new FormData(t),redirect:"manual"}).then(e=>{if(!e.ok)throw new Error("Network response errored");return e.json()}).then(e=>this.cb(e,t)).catch(e=>this.err(e,t))}else VUtils.forEach($$("input",t),e=>{if(!e.checkValidity()){let t=e.parentNode;t.classList.remove("valid"),t.classList.add("invalid")}})}}!function(){class e extends HTMLElement{constructor(){super();let e=this;e.id=e.id||VUtils.tempId();let t=e.innerHTML;e.innerHTML="";let i=e.input=e.createNew("input",{id:e.id}),s=e.createNew("label",{content:e.dataset.label});e.createNew("span",{classes:"error",content:e.dataset.error}),s.setAttribute("for",e.id),i.type=e.getAttribute("type")||"text",i.value=t.trim(),i.required=e.hasAttribute("required"),i.name=e.getAttribute("name"),i.addMultiListener("change input",e.cb.bind(e))}connectedCallback(){this.cb({currentTarget:this.input},!0)}cb(e,t){let i=e.currentTarget,s=$(".error-message",i.find("form"));s&&s.classList.add("hide");let n=this.classList;""===i.value?n.remove("focus"):n.add("focus"),i.checkValidity()?(n.add("valid"),n.remove("invalid")):t||(n.remove("valid"),n.add("invalid"))}}customElements.define("v-input",e),$("#login")&&new FormHandler("form#login","body",()=>{location.reload()},(e,t)=>{$(".error-message",t).classList.remove("hide")})}(),(()=>{class e{constructor(e){let t=this;t.editor=e instanceof HTMLElement?e:$(e),t.todoOnKey={},t.keys=[],t.backup=[],t.taberr=[">"," ","\n","<"],t.name="veditor-"+t.editor.id,t.init(),t.selfClosing=["img","area","base","br","col","embed","hr","img","input","link","menuitem","meta","param","source","track"],t.restore()}init(){let e=this;e.editor.addEventListener("keydown",e.handleKey.bind(e)),e.addKey("Tab",e.pressTab.bind(e)),e.addKey("<",e.addEmptyTags.bind(e)),e.addKey("ctrl-z",e.undo.bind(e)),e.addKey("ctrl-s",e.store.bind(e)),e.addKey("ctrl-shift-S",e.delete.bind(e)),e.editor.classList.add(e.name,"veditor")}registerSelfClosing(e){this.selfClosing.push(e)}restore(){let e=localStorage.getItem(this.name);e&&(this.editor.value=e)}delete(){localStorage.removeItem(this.name),console.log(`[VEdit] Editor: ${this.name} removed`)}store(){localStorage.setItem(this.name,this.editor.value),console.log(`[VEdit] Editor: ${this.name} saved`)}handleKey(e){let t,i=this;if(e.ctrlKey&&"Control"===e.key||e.shiftKey&&"Shift"===e.key)return;if(e.ctrlKey&&e.shiftKey?t="ctrl-shift-"+e.key:e.ctrlKey&&(t="ctrl-"+e.key),t&&-1!==this.keys.indexOf(t))return e.preventDefault(),void this.todoOnKey[t]();let s=i.editor.value;const n=i.editor.selectionStart;if(i.backup.length>50&&i.backup.shift(),i.backup.push([s,n]),i.keys.indexOf(e.key)>-1){e.preventDefault();let t=i.todoOnKey[e.key](n,s,this.editor);t[0].push(s.substr(n)),i.afterWork(t)}}undo(){let e=this.backup.pop()||[this.editor.value,this.editor.selectionStart];this.editor.value=e[0],this.editor.setSelectionRange(e[1],e[1])}afterWork(e){this.setText(e[0].join("")),this.editor.setSelectionRange(e[1],e[1])}setText(e){this.editor.value=e}addKey(e,t){this.todoOnKey[e]=t,this.keys.push(e)}addEmptyTags(e,t,i){return[[t.substr(0,e),"<>"],e+1]}pressTab(e,t,i){let s,n,r=this,a=e;if(0===e||-1!==r.taberr.indexOf(t[e-1]))s=" ",a+=4,n=t.substr(0,e);else if(-1===r.taberr.indexOf(t[e-1])){let i=2;for(;-1===r.taberr.indexOf(t[e-i])&&e-i>0;)i++;e-i>0&&(i-=1);let o=r.generateTag(t.substr(e-i,i).trim());s=o[0],a=e-i+o[1],n=t.substr(0,e-i)}return[[n,s],a]}generateTag(e){let t,i={".":[],"#":[]},s=Object.keys(i),n="cl",r=e.split(/([#.])/g);t=r.shift();for(let e of r)s.indexOf(e)>-1?n=e:i[n].push(e);let a="";i["."].length>0&&(a+=` class="${i["."].join(" ")}"`),i["#"].length>0&&(a+=` id="${i["#"].join("-")}"`);let o="";-1===this.selfClosing.indexOf(t.trim())&&(o=``);let l=`<${t}${a}>`;return[`${l}${o}`,l.length]}}class t extends HTMLElement{constructor(){super(),this.editor=document.createElement("textarea"),this.editor.innerHTML=this.innerHTML,this.editor.id=this.getAttribute("name");for(let e of this.attributes)this.editor.setAttribute(e.name,e.value);this.innerHTML="",this.appendChild(this.editor),this.edit=new e(this.editor)}connectedCallback(){this.edit.restore()}disconnectedCallback(){this.edit.save()}}customElements.define("v-editor",t)})(),window.router=new class{constructor(e){this.options=e,document.body.addDelegatedEventListener("click","[data-link]",(e,t)=>{e.preventDefault(),$$("[data-link].active").forEach(e=>e.classList.remove("active"));let i=$(".loader").classList;i.remove("hide"),this.handleRouting(t.dataset).then(e=>{i.add("hide"),t.classList.add("active")})}),document.body.addEventListener("triggerRouter",e=>{this.handle(sessionStorage.getItem("url"))}),window.addEventListener("popstate",e=>{this.handle(e.state)}),this.components={},window.dispatchEvent(new CustomEvent("routerReady")),window.routerIsReady=!0}handle(e){e&&(e=JSON.parse(e),this.handleRouting(e.data).then(t=>{let i=$('[data-link="'+e.data.link+'"]');i&&i.classList.add("active")}))}async handleRouting(e){try{let t=e.link,i=this.components[t];if(""===t)return null;i&&(t=i.getUrl(e));let s=await this.handleRequest(t,!0);return s.reload?location.reload():(i=i||this.components[s.component]||null,i?(sessionStorage.setItem("url",JSON.stringify({data:e})),i.handle(s,e).then(t=>{$(this.options.toReplace).innerHTML=t,history.pushState(JSON.stringify({data:e}),document.title)})):await alert("Error"),null)}catch(e){return e}}async handleRequest(e,t){if(""!==(e=e.trim()))return await fetch(e,{credentials:"same-origin"}).then(e=>{if(!e.ok)throw"URL is Status: "+e.status;let i=e.headers.get("Content-Type");return-1!==i.indexOf("json")||t?e.json():-1!==i.indexOf("text")?e.text():e.blob()}).catch(e=>(console.error(e),null))}addComponent(e,t){this.components[e]=t}}({toReplace:".content-area"});class VTpeLCore{constructor(e={}){this.templates={},this.dir=e.path||"/tpl/",this.suffix=e.suffix||"tpl",this.path=e.template||`${this.dir}%s.${this.suffix}`,this.cache=void 0===e.cache||e.cache}async loadTemplate(e){if(this.templates[e])return null;let t=this.path.replace("%s",e),i=await fetch(t,{cache:"force-cache"});if(i.ok){let t=await i.text();this.addTpl(e,t)}return null}async loadArray(e){for(let t of e)await this.loadTemplate(t)}addTpl(e,t){(this.templates[e]=new VTpeLTemplate(e,t,this)).parseContent(this.cache)}async renderOn(e,t){return this.templates[e]?await this.templates[e].render(t):""}}const VParserTypes={content:0,variable:1,for:2,forEach:3,forContent:4,forEnd:5,if:6,ifContent:7,ifEnd:8,assign:9,include:10,none:-1};class VTpeLParser{constructor(e,t){let i=this;i.name=e,i.legex=t.trim(),i.index=0,i.content="",i.parsed=[],i.contexts=[0]}tokenize(){let e=this;for(e.index=0;e.index0&&(this.index+=s),s>0||-1===s}nextContainsRaw(e,t,i){"string"==typeof t&&(t=t.split(""));let s=t.length;if(s<1)return-1;for(let n=0;n ${o}] >> ${s}`),i.index=o+e.length,i.content=s.trim(),void i.addType(t);s+=l}if("\n"===a)return i.index=r.length,i.content=s.trim(),void i.addType(t);throw"Template variable at Position: "+n+" not closed!"}getOperator(e){let t=[];for(let i=0;i{let n=e.target;if(e.detail instanceof HTMLElement&&(n=e.detail),n instanceof HTMLElement)if(n.matches(t))VUtils.tryCatch([e,n],i,s);else{const r=n.find(t);r&&VUtils.tryCatch([e,r],i,s)}})},Node.prototype.addMultiListener=function(e,t,i={}){let s=e.split(" ");for(let e of s)this.addEventListener(e,t,i)}}}VUtils.makePublic();class VRipple{constructor(e={}){if(!VUtils.isUsed)throw"VRipply is only with Public VUtils usable!";let t=this;if(t.options=JSON.parse('{"classes":["btn-ripple__effect"],"target":"body","selector":".btn-ripple"}'),VUtils.mergeOptions(t.options,e),t.options.selector.indexOf("#")>-1)throw"ID's are not allowed as selector!";this.instanceCheck(),this.ripples=[],requestAnimationFrame(this.initHandler.bind(this))}instanceCheck(){let e=this.options;const t=[e.target,e.selector,e.classes.join(".")].join(" ");VRipple.instances=VRipple.instances||{},VRipple.instances[t]=this}initHandler(){let e=this,t=e.options.selector;$(e.options.target).addDelegatedEventListener("mousedown touchstart",t,(t,i)=>{let s=t.touches?t.touches[0]:t,n=i.parentNode,r=i.createNew("span",e.options),a=n.getBoundingClientRect(),o=s.clientX-a.left,l=s.clientY-a.top;r.style.top=l+"px",r.style.left=o+"px",r._mouseDown=!0,r._animationEnded=!1,e.ripples.push(r)}),document.body.addDelegatedEventListener("animationend","."+VUtils.get(e.options.classes,""),e.rippleEnd.bind(e)),document.body._vRippleInit||(document.body.addMultiListener("mouseup touchend mouseleave rippleClose",t=>{let i=Object.keys(VRipple.instances);for(let s of i)for(let i of VRipple.instances[s].ripples)e.rippleEnd.bind(VRipple.instances[s])(t,i)}),document.body._vRippleInit=!0)}rippleEnd(e,t){t.parentNode&&("animationend"===e.type?t._animationEnded=!0:t._mouseDown=!1,!t._mouseDown&&t._animationEnded&&(t.classList.contains("to-remove")?(t.parentNode.removeChild(t),this.ripples.splice(this.ripples.indexOf(t),1)):t.classList.add("to-remove")))}}const rippler=new VRipple;!function(){window._openVSelect=null,requestAnimationFrame(e=>{document.body.addEventListener("click",e=>{window._openVSelect&&e.target.closest("v-select")!==window._openVSelect&&window._openVSelect.toggle(!1)})});class e extends HTMLElement{constructor(){super();let e=this;e._in=this.attachInternals(),e._in.role="select",e.setAttribute("tabindex",0),e.update()}static get formAssociated(){return!0}static get observedAttributes(){return["required","validity"]}get required(){return this.hasAttribute("required")}set required(e){this.toggleAttribute("required",Boolean(e))}get name(){return this.getAttribute("name")}set name(e){this.toggleAttribute("name",e)}get form(){return this._in.form}get options(){return $$("v-options v-option",this)}get selected(){return $$("v-options v-option[selected]",this)}update(){let e=[],t=$("v-label",this),i=new FormData;this.selected.forEach(t=>{e.push(t.innerText),i.append(this.name,t.value)}),t.attributeChangedCallback("value","",e.join(", ")),this.required&&0===e.length?this._in.setValidity({customError:!0},"Option is needed"):this._in.setValidity({}),this._in.setFormValue(i)}checkValidity(){return this._in.checkValidity()}reportValidity(){return this._in.reportValidity()}toggle(e){window._openVSelect&&e&&window._openVSelect.toggleSelect(!1);const t=$("v-options",this);if(!e||this.isOpen)t.style.maxHeight="0",window._openVSelect=!1,this.isOpen=!1,this.update();else{t.focus();let e=0,i=t.children;for(let t=0;t{let t=this.parentNode.parentNode,i=!this.selected;if(!t.hasAttribute("multiple")){t.toggle(!1);for(let e of t.selected)e!==this&&e.removeAttribute("selected")}this.disabled||(this.attributeChangedCallback("selected",!1,i,!0),this.parentNode.parentNode.update())})}static get observedAttributes(){return["selected","disabled","value"]}attributeChangedCallback(e,t,i,s){"selected"===e&&this.hasAttribute("disabled")?this.removeAttribute(e):("disabled"===e&&!0===i&&this.hasAttribute("selected")&&this.attributeChangedCallback("selected",!1,!1),s&&(i?this.setAttribute(e,i):this.removeAttribute(e)),this[e]=i)}}class i extends HTMLElement{constructor(){super(),this.empty=this.getAttribute("empty")||"",this.innerHTML=this.getAttribute("value")||this.empty,this.addEventListener("click",this.openPopUp.bind(this))}static get observedAttributes(){return["empty","value"]}openPopUp(){this.parentNode.toggle(!0)}attributeChangedCallback(e,t,i){"value"===e&&(this.innerHTML=i||this.empty),this[e]=i}}customElements.define("v-label",i),customElements.define("v-option",t),customElements.define("v-select",e)}();class FormHandler{constructor(e,t,i,s){this.cb=i||console.log,this.err=s||console.err,$(t).addDelegatedEventListener("submit",e,this.handleEvent.bind(this))}handleEvent(e,t){if(e.preventDefault(),t.checkValidity()){if(""===(t.action??""))return void console.error("No URL Found on Form",t);fetch(t.action,{method:t.method.toUpperCase(),credentials:"same-origin",body:new FormData(t),redirect:"manual"}).then(e=>{if(!e.ok)throw new Error("Network response errored");return e.json()}).then(e=>this.cb(e,t)).catch(e=>this.err(e,t))}else VUtils.forEach($$("input",t),e=>{if(!e.checkValidity()){let t=e.parentNode;t.classList.remove("valid"),t.classList.add("invalid")}})}}!function(){class e extends HTMLElement{constructor(){super();let e=this;e.id=e.id||VUtils.tempId();let t=e.innerHTML;e.innerHTML="";let i=e.input=e.createNew("input",{id:e.id}),s=e.createNew("label",{content:e.dataset.label});e.createNew("span",{classes:"error",content:e.dataset.error}),s.setAttribute("for",e.id),i.type=e.getAttribute("type")||"text",i.value=t.trim(),i.required=e.hasAttribute("required"),i.name=e.getAttribute("name"),i.addMultiListener("change input",e.cb.bind(e))}connectedCallback(){this.cb({currentTarget:this.input},!0)}cb(e,t){let i=e.currentTarget,s=$(".error-message",i.find("form"));s&&s.classList.add("hide");let n=this.classList;""===i.value?n.remove("focus"):n.add("focus"),i.checkValidity()?(n.add("valid"),n.remove("invalid")):t||(n.remove("valid"),n.add("invalid"))}}class t extends HTMLElement{constructor(){super();const e=this.dataset.id||VUtils.tempId();$("input",this).id=e,$("label",this).setAttribute("for",e)}}customElements.define("v-input",e),customElements.define("v-switch",t),$("#login")&&new FormHandler("form#login","body",()=>{location.reload()},(e,t)=>{$(".error-message",t).classList.remove("hide")})}(),(()=>{class e{constructor(e){let t=this;t.editor=e instanceof HTMLElement?e:$(e),t.todoOnKey={},t.keys=[],t.backup=[],t.taberr=[">"," ","\n","<"],t.name="veditor-"+t.editor.id,t.init(),t.selfClosing=["img","area","base","br","col","embed","hr","img","input","link","menuitem","meta","param","source","track"],t.restore()}init(){let e=this;e.editor.addEventListener("keydown",e.handleKey.bind(e)),e.addKey("Tab",e.pressTab.bind(e)),e.addKey("<",e.addEmptyTags.bind(e)),e.addKey("ctrl-z",e.undo.bind(e)),e.addKey("ctrl-s",e.store.bind(e)),e.addKey("ctrl-shift-S",e.delete.bind(e)),e.editor.classList.add(e.name,"veditor")}registerSelfClosing(e){this.selfClosing.push(e)}restore(){let e=localStorage.getItem(this.name);e&&(this.editor.value=e)}delete(){localStorage.removeItem(this.name),console.log(`[VEdit] Editor: ${this.name} removed`)}store(){localStorage.setItem(this.name,this.editor.value),console.log(`[VEdit] Editor: ${this.name} saved`)}handleKey(e){let t,i=this;if(e.ctrlKey&&"Control"===e.key||e.shiftKey&&"Shift"===e.key)return;if(e.ctrlKey&&e.shiftKey?t="ctrl-shift-"+e.key:e.ctrlKey&&(t="ctrl-"+e.key),t&&-1!==this.keys.indexOf(t))return e.preventDefault(),void this.todoOnKey[t]();let s=i.editor.value;const n=i.editor.selectionStart;if(i.backup.length>50&&i.backup.shift(),i.backup.push([s,n]),i.keys.indexOf(e.key)>-1){e.preventDefault();let t=i.todoOnKey[e.key](n,s,this.editor);t[0].push(s.substr(n)),i.afterWork(t)}}undo(){let e=this.backup.pop()||[this.editor.value,this.editor.selectionStart];this.editor.value=e[0],this.editor.setSelectionRange(e[1],e[1])}afterWork(e){this.setText(e[0].join("")),this.editor.setSelectionRange(e[1],e[1])}setText(e){this.editor.value=e}addKey(e,t){this.todoOnKey[e]=t,this.keys.push(e)}addEmptyTags(e,t,i){return[[t.substr(0,e),"<>"],e+1]}pressTab(e,t,i){let s,n,r=this,a=e;if(0===e||-1!==r.taberr.indexOf(t[e-1]))s=" ",a+=4,n=t.substr(0,e);else if(-1===r.taberr.indexOf(t[e-1])){let i=2;for(;-1===r.taberr.indexOf(t[e-i])&&e-i>0;)i++;e-i>0&&(i-=1);let o=r.generateTag(t.substr(e-i,i).trim());s=o[0],a=e-i+o[1],n=t.substr(0,e-i)}return[[n,s],a]}generateTag(e){let t,i={".":[],"#":[]},s=Object.keys(i),n="cl",r=e.split(/([#.])/g);t=r.shift();for(let e of r)s.indexOf(e)>-1?n=e:i[n].push(e);let a="";i["."].length>0&&(a+=` class="${i["."].join(" ")}"`),i["#"].length>0&&(a+=` id="${i["#"].join("-")}"`);let o="";-1===this.selfClosing.indexOf(t.trim())&&(o=``);let l=`<${t}${a}>`;return[`${l}${o}`,l.length]}}class t extends HTMLElement{constructor(){super(),this.editor=document.createElement("textarea"),this.editor.innerHTML=this.innerHTML,this.editor.id=this.getAttribute("name");for(let e of this.attributes)this.editor.setAttribute(e.name,e.value);this.innerHTML="",this.appendChild(this.editor),this.edit=new e(this.editor)}connectedCallback(){this.edit.restore()}disconnectedCallback(){this.edit.save()}}customElements.define("v-editor",t)})(),window.router=new class{constructor(e){this.options=e,document.body.addDelegatedEventListener("click","[data-link]",(e,t)=>{e.preventDefault(),$$("[data-link].active").forEach(e=>e.classList.remove("active"));let i=$(".loader").classList;i.remove("hide"),this.handleRouting(t.dataset).then(e=>{i.add("hide"),t.classList.add("active")})}),document.body.addEventListener("triggerRouter",e=>{let t=sessionStorage.getItem("url")||JSON.stringify({data:{link:$("[data-link].active").dataset.link}});this.handle(t)}),window.addEventListener("popstate",e=>{this.handle(e.state)}),this.components={},window.dispatchEvent(new CustomEvent("routerReady")),window.routerIsReady=!0}handle(e){e&&(e=JSON.parse(e),this.handleRouting(e.data).then(t=>{let i=$('[data-link="'+e.data.link+'"]');i&&i.classList.add("active")}))}async handleRouting(e){try{let t=e.link,i=this.components[t];if(""===t)return null;i&&(t=i.getUrl(e));let s=await this.handleRequest(t,!0);return s.reload?location.reload():(i=i||this.components[s.component]||null,i?(sessionStorage.setItem("url",JSON.stringify({data:e})),i.handle(s,e).then(t=>{$(this.options.toReplace).innerHTML=t,history.pushState(JSON.stringify({data:e}),document.title)})):await alert("Error"),null)}catch(e){return e}}async handleRequest(e,t){if(""!==(e=e.trim()))return await fetch(e,{credentials:"same-origin"}).then(e=>{if(!e.ok)throw"URL is Status: "+e.status;let i=e.headers.get("Content-Type");return-1!==i.indexOf("json")||t?e.json():-1!==i.indexOf("text")?e.text():e.blob()}).catch(e=>(console.error(e),null))}addComponent(e,t){this.components[e]=t}}({toReplace:".content-area"});class VTpeLCore{constructor(e={}){this.templates={},this.dir=e.path||"/tpl/",this.suffix=e.suffix||"tpl",this.path=e.template||`${this.dir}%s.${this.suffix}`,this.cache=void 0===e.cache||e.cache}async loadTemplate(e){if(this.templates[e])return null;let t=this.path.replace("%s",e),i=await fetch(t,{cache:"force-cache"});if(i.ok){let t=await i.text();this.addTpl(e,t)}return null}async loadArray(e){for(let t of e)await this.loadTemplate(t)}addTpl(e,t){(this.templates[e]=new VTpeLTemplate(e,t,this)).parseContent(this.cache)}async renderOn(e,t){return this.templates[e]?await this.templates[e].render(t):""}}const VParserTypes={content:0,variable:1,for:2,forEach:3,forContent:4,forEnd:5,if:6,ifContent:7,ifEnd:8,assign:9,include:10,none:-1};class VTpeLParser{constructor(e,t){let i=this;i.name=e,i.legex=t.trim(),i.index=0,i.content="",i.parsed=[],i.contexts=[0]}tokenize(){let e=this;for(e.index=0;e.index0&&(this.index+=s),s>0||-1===s}nextContainsRaw(e,t,i){"string"==typeof t&&(t=t.split(""));let s=t.length;if(s<1)return-1;for(let n=0;n ${o}] >> ${s}`),i.index=o+e.length,i.content=s.trim(),void i.addType(t);s+=l}if("\n"===a)return i.index=r.length,i.content=s.trim(),void i.addType(t);throw"Template variable at Position: "+n+" not closed!"}getOperator(e){let t=[];for(let i=0;iisDevMode()) { + header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 60 * 30))); + header('Cache-Control: public'); + } $id = ArgumentHandler::get()->getItem('tpl', '..'); if (strpos($id, '..')) { return false; diff --git a/src/Venom/Core/DatabaseHandler.php b/src/Venom/Core/DatabaseHandler.php index 72e5ffe..1e76f2b 100755 --- a/src/Venom/Core/DatabaseHandler.php +++ b/src/Venom/Core/DatabaseHandler.php @@ -49,7 +49,7 @@ class DatabaseHandler } } - public function getOne(string $query, array $args): ?DatabaseObject + public function getOne(string $query, array $args = []): ?DatabaseObject { $data = $this->getAll($query, $args); if (count($data) > 0) { @@ -58,7 +58,7 @@ class DatabaseHandler return null; } - public function getAll(string $query, array $args): array + public function getAll(string $query, array $args = []): array { $stmt = $this->db->prepare($query); $stmt->setFetchMode(PDO::FETCH_CLASS, DatabaseObject::class); @@ -66,7 +66,7 @@ class DatabaseHandler return $stmt->fetchAll(); } - public function execute(string $query, array $args): bool + public function execute(string $query, array $args = []): bool { $stmt = $this->db->prepare($query); return $stmt->execute($args); diff --git a/src/Venom/Helper/AdminHelper.php b/src/Venom/Helper/AdminHelper.php index 65152a6..ab019ff 100644 --- a/src/Venom/Helper/AdminHelper.php +++ b/src/Venom/Helper/AdminHelper.php @@ -6,7 +6,7 @@ namespace Venom\Helper; class AdminHelper { - public static function getResponse($content, bool $shouldReload = false, string $component = '', $extra = false) + public static function sendResponse($content, string $component = '', bool $shouldReload = false, $extra = false) { $response = [ 'content' => $content, diff --git a/src/modules/MetaDataModule.php b/src/modules/MetaDataModule.php new file mode 100644 index 0000000..5650cc5 --- /dev/null +++ b/src/modules/MetaDataModule.php @@ -0,0 +1,78 @@ +isAdmin()) { + $this->registerAdminRoutes($venom); + } + return true; + } + + public function init(): void + { + } + + private function registerAdminRoutes(Venom $venom) + { + $venom->getRouter(Router::ADMIN_ROUTER)->addRoutes([ + '/metaData' => [ + 'cl' => MetaDataModule::class, + 'roles' => ['ROLE_ADMIN'], + 'routes' => [ + '*' => [ + "GET" => 'get', + ], + '1' => [ + "GET" => 'getById', + "POST" => 'update', + "PUT" => 'insert', + ] + ] + ] + ]); + } + + public function get() + { + AdminHelper::sendResponse([ + 'metaData' => [ + ['id' => 1, 'name' => 'engineertrooper', 'icon' => 'vt-edit'], + ['id' => 2, 'name' => 'versustunze', 'icon' => 'vt-edit'] + ] + ]); + } + + public function update(): bool + { + return false; + } + + public function insert(): bool + { + return false; + } + + public function getById($id) + { + AdminHelper::sendResponse([ + 'caseName' => 'ROLE_ADMIN', + 'id' => $id, + 'name' => 'Admin', + 'icon' => 'vt-visibility', + ]); + } +} \ No newline at end of file diff --git a/src/modules/OverviewModule.php b/src/modules/OverviewModule.php new file mode 100644 index 0000000..d3b9173 --- /dev/null +++ b/src/modules/OverviewModule.php @@ -0,0 +1,81 @@ +isAdmin()) { + $this->registerAdminRoutes($venom); + } + return true; + } + + public function init(): void + { + } + + private function registerAdminRoutes(Venom $venom) + { + $venom->getRouter(Router::ADMIN_ROUTER)->addRoutes([ + '/overview' => [ + 'cl' => OverviewModule::class, + 'roles' => ['ROLE_ADMIN'], + 'routes' => [ + '*' => [ + "GET" => 'get', + ], + '1' => [ + "GET" => 'getById', + "POST" => 'update', + "PUT" => 'insert', + ] + ] + ] + ]); + } + + public function get() + { + AdminHelper::sendResponse([ + 'pages' => [ + ['id' => 1, 'name' => 'Flamingos going wild!', 'icon' => 'vt-edit'], + ['id' => 2, 'name' => 'Turbinen sind geil.', 'icon' => 'vt-edit'], + ['id' => 3, 'name' => 'Aufbau und Umbau des neuen VENOMs Plugins', 'icon' => 'vt-edit'], + ['id' => 4, 'name' => 'Aber Mama hat gesagt!', 'icon' => 'vt-edit'], + ['id' => 5, 'name' => 'Frische Fische nur heute!', 'icon' => 'vt-edit'] + ] + ]); + } + + public function update(): bool + { + return false; + } + + public function insert(): bool + { + return false; + } + + public function getById($id) + { + AdminHelper::sendResponse([ + 'caseName' => 'ROLE_ADMIN', + 'id' => $id, + 'name' => 'Admin', + 'icon' => 'vt-visibility', + ]); + } +} \ No newline at end of file diff --git a/src/modules/PageModule.php b/src/modules/PageModule.php new file mode 100644 index 0000000..4b5771e --- /dev/null +++ b/src/modules/PageModule.php @@ -0,0 +1,81 @@ +isAdmin()) { + $this->registerAdminRoutes($venom); + } + return true; + } + + public function init(): void + { + } + + private function registerAdminRoutes(Venom $venom) + { + $venom->getRouter(Router::ADMIN_ROUTER)->addRoutes([ + '/pages' => [ + 'cl' => PageModule::class, + 'roles' => ['ROLE_ADMIN'], + 'routes' => [ + '*' => [ + "GET" => 'get', + ], + '1' => [ + "GET" => 'getById', + "POST" => 'update', + "PUT" => 'insert', + ] + ] + ] + ]); + } + + public function get() + { + AdminHelper::sendResponse([ + 'pages' => [ + ['id' => 1, 'name' => 'Flamingos going wild!', 'icon' => 'vt-edit'], + ['id' => 2, 'name' => 'Turbinen sind geil.', 'icon' => 'vt-edit'], + ['id' => 3, 'name' => 'Aufbau und Umbau des neuen VENOMs Plugins', 'icon' => 'vt-edit'], + ['id' => 4, 'name' => 'Aber Mama hat gesagt!', 'icon' => 'vt-edit'], + ['id' => 5, 'name' => 'Frische Fische nur heute!', 'icon' => 'vt-edit'] + ] + ]); + } + + public function update(): bool + { + return false; + } + + public function insert(): bool + { + return false; + } + + public function getById($id) + { + AdminHelper::sendResponse([ + 'caseName' => 'ROLE_ADMIN', + 'id' => $id, + 'name' => 'Admin', + 'icon' => 'vt-visibility', + ]); + } +} \ No newline at end of file diff --git a/src/modules/RoleModule.php b/src/modules/RoleModule.php index 7740e69..ffcd389 100644 --- a/src/modules/RoleModule.php +++ b/src/modules/RoleModule.php @@ -5,6 +5,7 @@ namespace Modules; use Venom\Core\Config; +use Venom\Core\DatabaseHandler; use Venom\Core\Module; use Venom\Helper\AdminHelper; use Venom\Routing\Route; @@ -48,7 +49,8 @@ class RoleModule implements Module, Route public function get() { - AdminHelper::getResponse([ + //$req = DatabaseHandler::get()->getAll("SELECT * FROM roles"); + AdminHelper::sendResponse([ 'roles' => [ ['id' => 1, 'name' => 'Admin', 'icon' => 'vt-visibility'], ['id' => 2, 'name' => 'Moderator', 'icon' => 'vt-edit'], @@ -69,7 +71,7 @@ class RoleModule implements Module, Route public function getById($id) { - AdminHelper::getResponse([ + AdminHelper::sendResponse([ 'caseName' => 'ROLE_ADMIN', 'id' => $id, 'name' => 'Admin', diff --git a/src/modules/SeoUrlModule.php b/src/modules/SeoUrlModule.php new file mode 100644 index 0000000..f7a5972 --- /dev/null +++ b/src/modules/SeoUrlModule.php @@ -0,0 +1,81 @@ +isAdmin()) { + $this->registerAdminRoutes($venom); + } + return true; + } + + public function init(): void + { + } + + private function registerAdminRoutes(Venom $venom) + { + $venom->getRouter(Router::ADMIN_ROUTER)->addRoutes([ + '/seoUrl' => [ + 'cl' => SeoUrlModule::class, + 'roles' => ['ROLE_ADMIN'], + 'routes' => [ + '*' => [ + "GET" => 'get', + ], + '1' => [ + "GET" => 'getById', + "POST" => 'update', + "PUT" => 'insert', + ] + ] + ] + ]); + } + + public function get() + { + AdminHelper::sendResponse([ + 'pages' => [ + ['id' => 1, 'name' => 'Flamingos going wild!', 'icon' => 'vt-edit'], + ['id' => 2, 'name' => 'Turbinen sind geil.', 'icon' => 'vt-edit'], + ['id' => 3, 'name' => 'Aufbau und Umbau des neuen VENOMs Plugins', 'icon' => 'vt-edit'], + ['id' => 4, 'name' => 'Aber Mama hat gesagt!', 'icon' => 'vt-edit'], + ['id' => 5, 'name' => 'Frische Fische nur heute!', 'icon' => 'vt-edit'] + ] + ]); + } + + public function update(): bool + { + return false; + } + + public function insert(): bool + { + return false; + } + + public function getById($id) + { + AdminHelper::sendResponse([ + 'caseName' => 'ROLE_ADMIN', + 'id' => $id, + 'name' => 'Admin', + 'icon' => 'vt-visibility', + ]); + } +} \ No newline at end of file diff --git a/src/modules/UserModule.php b/src/modules/UserModule.php new file mode 100644 index 0000000..1648c35 --- /dev/null +++ b/src/modules/UserModule.php @@ -0,0 +1,78 @@ +isAdmin()) { + $this->registerAdminRoutes($venom); + } + return true; + } + + public function init(): void + { + } + + private function registerAdminRoutes(Venom $venom) + { + $venom->getRouter(Router::ADMIN_ROUTER)->addRoutes([ + '/users' => [ + 'cl' => UserModule::class, + 'roles' => ['ROLE_ADMIN'], + 'routes' => [ + '*' => [ + "GET" => 'get', + ], + '1' => [ + "GET" => 'getById', + "POST" => 'update', + "PUT" => 'insert', + ] + ] + ] + ]); + } + + public function get() + { + AdminHelper::sendResponse([ + 'users' => [ + ['id' => 1, 'name' => 'engineertrooper', 'icon' => 'vt-edit'], + ['id' => 2, 'name' => 'versustunze', 'icon' => 'vt-edit'] + ] + ]); + } + + public function update(): bool + { + return false; + } + + public function insert(): bool + { + return false; + } + + public function getById($id) + { + AdminHelper::sendResponse([ + 'caseName' => 'ROLE_ADMIN', + 'id' => $id, + 'name' => 'Admin', + 'icon' => 'vt-visibility', + ]); + } +} \ No newline at end of file diff --git a/src/modules/VenomStatusModule.php b/src/modules/VenomStatusModule.php new file mode 100644 index 0000000..97fdad7 --- /dev/null +++ b/src/modules/VenomStatusModule.php @@ -0,0 +1,78 @@ +isAdmin()) { + $this->registerAdminRoutes($venom); + } + return true; + } + + public function init(): void + { + } + + private function registerAdminRoutes(Venom $venom) + { + $venom->getRouter(Router::ADMIN_ROUTER)->addRoutes([ + '/venomStatus' => [ + 'cl' => VenomStatusModule::class, + 'roles' => ['ROLE_ADMIN'], + 'routes' => [ + '*' => [ + "GET" => 'get', + ], + '1' => [ + "GET" => 'getById', + "POST" => 'update', + "PUT" => 'insert', + ] + ] + ] + ]); + } + + public function get() + { + AdminHelper::sendResponse([ + 'users' => [ + ['id' => 1, 'name' => 'engineertrooper', 'icon' => 'vt-edit'], + ['id' => 2, 'name' => 'versustunze', 'icon' => 'vt-edit'] + ] + ]); + } + + public function update(): bool + { + return false; + } + + public function insert(): bool + { + return false; + } + + public function getById($id) + { + AdminHelper::sendResponse([ + 'caseName' => 'ROLE_ADMIN', + 'id' => $id, + 'name' => 'Admin', + 'icon' => 'vt-visibility', + ]); + } +} \ No newline at end of file diff --git a/tpl/admin/admin-panel.php b/tpl/admin/admin-panel.php index 9cbc052..917fad8 100644 --- a/tpl/admin/admin-panel.php +++ b/tpl/admin/admin-panel.php @@ -1,13 +1,13 @@
diff --git a/tpl/admin/base.php b/tpl/admin/base.php index 05c176a..993f708 100644 --- a/tpl/admin/base.php +++ b/tpl/admin/base.php @@ -1,6 +1,7 @@ @@ -14,7 +15,7 @@ use Venom\Views\Asset; renderCSS(); ?> - +isDevMode() ? 'debug' : ''?>> getVar('isLoggedIn')) { $this->renderTemplate('login'); diff --git a/tpl/admin/jsTemplates/includes/svg.tpl b/tpl/admin/jsTemplates/includes/svg.tpl index 269d709..cbf6d06 100644 --- a/tpl/admin/jsTemplates/includes/svg.tpl +++ b/tpl/admin/jsTemplates/includes/svg.tpl @@ -1,3 +1,3 @@ - - + + \ No newline at end of file diff --git a/tpl/admin/jsTemplates/includes/switch.tpl b/tpl/admin/jsTemplates/includes/switch.tpl new file mode 100644 index 0000000..661bb18 --- /dev/null +++ b/tpl/admin/jsTemplates/includes/switch.tpl @@ -0,0 +1,5 @@ + + ${desc} + \ No newline at end of file diff --git a/tpl/admin/jsTemplates/metaDataList.tpl b/tpl/admin/jsTemplates/metaDataList.tpl new file mode 100644 index 0000000..c77664e --- /dev/null +++ b/tpl/admin/jsTemplates/metaDataList.tpl @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/tpl/admin/jsTemplates/overview.tpl b/tpl/admin/jsTemplates/overview.tpl new file mode 100644 index 0000000..18eb8bc --- /dev/null +++ b/tpl/admin/jsTemplates/overview.tpl @@ -0,0 +1,5 @@ +
+
+

Overview

+
+
\ No newline at end of file diff --git a/tpl/admin/jsTemplates/pageEdit.tpl b/tpl/admin/jsTemplates/pageEdit.tpl new file mode 100644 index 0000000..02638fe --- /dev/null +++ b/tpl/admin/jsTemplates/pageEdit.tpl @@ -0,0 +1,67 @@ +
+
+

Page Edit

+
+
+ + {include(includes/svg;class=back-arrow;icon=vt-arrow-back)} + +
+

Page Information

+
+ + +
+
+ + + + engineertrooper (Dominic Seela) + versustunez (Maurice Grönwoldt) + + +
+
+ + + + Visible + Privat + + +
+
+ ! +
+
+
+ +
+
+ +
+
+ + + +
+
+
\ No newline at end of file diff --git a/tpl/admin/jsTemplates/pagesList.tpl b/tpl/admin/jsTemplates/pagesList.tpl new file mode 100644 index 0000000..465d1b2 --- /dev/null +++ b/tpl/admin/jsTemplates/pagesList.tpl @@ -0,0 +1,22 @@ +
+
+

Pages

+
+
+

Add new Page

+ {include(includes/input;label=New Page Name;name=newPageName;error=New Page Name is required;type=text)} + {include(includes/btn;type=primary;content=Add)} +
+
+

All Pages

+ {foreach(pages as page,key)} +
+ + {include(includes/svg;icon=$page.icon)} + + ${page.name} +
+ {/for} +
+
+ diff --git a/tpl/admin/jsTemplates/roleEdit.tpl b/tpl/admin/jsTemplates/roleEdit.tpl new file mode 100644 index 0000000..1bcf8af --- /dev/null +++ b/tpl/admin/jsTemplates/roleEdit.tpl @@ -0,0 +1,62 @@ +
+
+

Role: ${roles.name}

+
+
+ + {include(includes/svg;class=back-arrow;icon=vt-arrow-back)} + +
+
+

Role Status

+ {include(includes/switch;id=${switch.id};name=permissionEditMetaData;desc=If enabled role is active.)} +
+
+

Role Name

+ +
+ +

Privileges

+ +
+

Module

+
Meta-Data
+
Pages
+
Roles
+
SEO-URL
+
Users
+
VENOM-Status
+
+
+

Edit

+ {include(includes/switch;id=${switch.id};name=permissionEditMetaData)} + {include(includes/switch;id=${switch.id};name=permissionEditPages)} + {include(includes/switch;id=${switch.id};name=permissionEditRoles)} + {include(includes/switch;id=${switch.id};name=permissionEditSeoUrl)} + {include(includes/switch;id=${switch.id};name=permissionEditUsers)} + {include(includes/switch;id=${switch.id};name=permissionEditVenomStatus)} +
+
+

View

+ {include(includes/switch;id=${switch.id};name=permissionViewMetaData)} + {include(includes/switch;id=${switch.id};name=permissionViewPages)} + {include(includes/switch;id=${switch.id};name=permissionViewRoles)} + {include(includes/switch;id=${switch.id};name=permissionViewSeoUrl)} + {include(includes/switch;id=${switch.id};name=permissionViewUsers)} + {include(includes/switch;id=${switch.id};name=permissionViewVenomStatus)} +
+
+
+
+
+ {include(includes/btn;type=valid;content=Save)} + {include(includes/btn;type=primary;content=Reset)} + {include(includes/btn;type=warn;content=Delete Role)} +
+
+
\ No newline at end of file diff --git a/tpl/admin/jsTemplates/rolesList.tpl b/tpl/admin/jsTemplates/rolesList.tpl index 6cf73d9..4ded38c 100644 --- a/tpl/admin/jsTemplates/rolesList.tpl +++ b/tpl/admin/jsTemplates/rolesList.tpl @@ -1,23 +1,23 @@ - - +
+

Roles

- - +
+

Overview

{foreach(roles as role,key)} -
+
{include(includes/svg;icon=$role.icon)} - ${role.name} -
+ ${role.name} +
{/for}

Add new Role

- {include(includes/input;label=New Role Name;name=newRoleame;error=New Role Name is required;type=text)} + {include(includes/input;label=New Role Name;name=newRoleName;error=New Role Name is required;type=text)} {include(includes/btn;type=primary;content=Add)}
- - \ No newline at end of file +
+
\ No newline at end of file diff --git a/tpl/admin/jsTemplates/seoUrlEdit.tpl b/tpl/admin/jsTemplates/seoUrlEdit.tpl new file mode 100644 index 0000000..8380bbb --- /dev/null +++ b/tpl/admin/jsTemplates/seoUrlEdit.tpl @@ -0,0 +1,10 @@ +
+
+

SEO Urls Edit

+
+
+ + {include(includes/svg;class=back-arrow;icon=vt-arrow-back)} + +
+
\ No newline at end of file diff --git a/tpl/admin/jsTemplates/seoUrlList.tpl b/tpl/admin/jsTemplates/seoUrlList.tpl new file mode 100644 index 0000000..857cd51 --- /dev/null +++ b/tpl/admin/jsTemplates/seoUrlList.tpl @@ -0,0 +1,5 @@ +
+
+

SEO Urls

+
+
\ No newline at end of file diff --git a/tpl/admin/jsTemplates/userEdit.tpl b/tpl/admin/jsTemplates/userEdit.tpl new file mode 100644 index 0000000..9fd2ce0 --- /dev/null +++ b/tpl/admin/jsTemplates/userEdit.tpl @@ -0,0 +1,96 @@ +
+
+

User: engineertrooper

+
+
+ + {include(includes/svg;class=back-arrow;icon=vt-arrow-back)} + +
+
+ EngineerTrooper + +
+
+ Dominic Seela + +
+
+ kontakt@engineertrooper.com + +
+
+ + +
+
+ + +
+ +

Privileges

+ +
+

Module

+
Meta-Data
+
Pages
+
Roles
+
SEO-URL
+
Users
+
VENOM-Status
+
+
+

Edit

+ {include(includes/switch;id=${switch.id};name=permissionEditMetaData)} + {include(includes/switch;id=${switch.id};name=permissionEditPages)} + {include(includes/switch;id=${switch.id};name=permissionEditRoles)} + {include(includes/switch;id=${switch.id};name=permissionEditSeoUrl)} + {include(includes/switch;id=${switch.id};name=permissionEditUsers)} + {include(includes/switch;id=${switch.id};name=permissionEditVenomStatus)} +
+
+

View

+ {include(includes/switch;id=${switch.id};name=permissionViewMetaData)} + {include(includes/switch;id=${switch.id};name=permissionViewPages)} + {include(includes/switch;id=${switch.id};name=permissionViewRoles)} + {include(includes/switch;id=${switch.id};name=permissionViewSeoUrl)} + {include(includes/switch;id=${switch.id};name=permissionViewUsers)} + {include(includes/switch;id=${switch.id};name=permissionViewVenomStatus)} +
+
+
+
+
+ {include(includes/btn;type=valid;content=Save)} + {include(includes/btn;type=primary;content=Reset)} + {include(includes/btn;type=warn;content=Delete Role)} +
+
+
\ No newline at end of file diff --git a/tpl/admin/jsTemplates/usersList.tpl b/tpl/admin/jsTemplates/usersList.tpl new file mode 100644 index 0000000..5a19e04 --- /dev/null +++ b/tpl/admin/jsTemplates/usersList.tpl @@ -0,0 +1,25 @@ +
+
+

Users

+
+
+
+
+
+

Overview

+ {foreach(users as user,key)} +
+ + {include(includes/svg;icon=$user.icon)} + + ${user.name} +
+ {/for} +
+
+

Add new User

+ {include(includes/input;label=New User Name;name=newUserName;error=New User Name is required;type=text)} + {include(includes/btn;type=primary;content=Add)} +
+
+
\ No newline at end of file diff --git a/tpl/admin/jsTemplates/venomStatus.tpl b/tpl/admin/jsTemplates/venomStatus.tpl new file mode 100644 index 0000000..23acf36 --- /dev/null +++ b/tpl/admin/jsTemplates/venomStatus.tpl @@ -0,0 +1,5 @@ +
+
+

Venom Status

+
+
\ No newline at end of file