forked from ZwiiCMS-Team/ZwiiCMS
092 Edition des scripts dans une fenêtre dédiée
This commit is contained in:
parent
67d2155569
commit
b77bdbd08a
@ -3,7 +3,9 @@
|
||||
|
||||
## version 10.0.092
|
||||
- Nouveautés :
|
||||
- Masque de configuration : options de réglage d'un serveur SMTP
|
||||
- Configuration :
|
||||
- Options de réglage d'un serveur SMTP
|
||||
- Edition des scripts dans une fenêtre dédiée
|
||||
- Modification :
|
||||
- Masque de configuration : changement de libellés.
|
||||
- Scripts externes:
|
||||
|
@ -719,7 +719,7 @@ class template {
|
||||
// Attributs par défaut
|
||||
$attributes = array_merge([
|
||||
'before' => true,
|
||||
'class' => '', // editorWysiwyg et editorCss possible pour utiliser le éditeurs (il faut également instancier les librairies)
|
||||
'class' => '', // editorWysiwyg et editor possible pour utiliser un éditeur (il faut également instancier les librairies)
|
||||
'classWrapper' => '',
|
||||
'disabled' => false,
|
||||
'noDirty' => false,
|
||||
|
@ -23,7 +23,8 @@ class config extends common {
|
||||
'updateRobots' => self::GROUP_ADMIN,
|
||||
'index' => self::GROUP_ADMIN,
|
||||
'manage' => self::GROUP_ADMIN,
|
||||
'updateBaseUrl' => self::GROUP_ADMIN
|
||||
'updateBaseUrl' => self::GROUP_ADMIN,
|
||||
'script' => self::GROUP_ADMIN
|
||||
];
|
||||
|
||||
public static $timezones = [
|
||||
@ -165,7 +166,6 @@ class config extends common {
|
||||
'ssl' => 'SSL/TLS'
|
||||
];
|
||||
|
||||
|
||||
public function generateFiles() {
|
||||
// Mettre à jour le site map
|
||||
$successSitemap=$this->createSitemap();
|
||||
@ -445,9 +445,6 @@ class config extends common {
|
||||
]);
|
||||
|
||||
if(self::$inputNotices === []) {
|
||||
// Ecrire les fichiers de script
|
||||
file_put_contents(self::DATA_DIR . 'head.inc.html',$this->getInput('configScriptHead',null));
|
||||
file_put_contents(self::DATA_DIR . 'body.inc.html',$this->getInput('configScriptBody',null));
|
||||
// Active la réécriture d'URL
|
||||
$rewrite = $this->getInput('rewrite', helper::FILTER_BOOLEAN);
|
||||
if(
|
||||
@ -504,6 +501,33 @@ class config extends common {
|
||||
]);
|
||||
}
|
||||
|
||||
public function script() {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
// Ecrire les fichiers de script
|
||||
if ($this->getInput('configScriptHead')) {
|
||||
file_put_contents(self::DATA_DIR . 'head.inc.html',$this->getInput('configScriptHead',null));
|
||||
}
|
||||
if ($this->getInput('configScriptBody')) {
|
||||
file_put_contents(self::DATA_DIR . 'body.inc.html',$this->getInput('configScriptBody',null));
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'redirect' => helper::baseUrl() . 'config/script/'. $this->geturl(2),
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Éditeur de script dans ' . ucfirst($this->geturl(2)) ,
|
||||
'vendor' => [
|
||||
'codemirror'
|
||||
],
|
||||
'view' => 'script'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Met à jour les données de site avec l'adresse trannsmise
|
||||
*/
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php echo template::formOpen('configForm'); ?>
|
||||
<div class="notranslate">
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('configBack', [
|
||||
@ -254,17 +253,6 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php
|
||||
// Lire le contenu des fichiers de script
|
||||
$headerFile = "";
|
||||
if (file_exists( self::DATA_DIR . 'head.inc.html')) {
|
||||
$headerFile = file_get_contents (self::DATA_DIR . 'head.inc.html');
|
||||
}
|
||||
$bodyFile = "";
|
||||
if (file_exists( self::DATA_DIR . 'body.inc.html')) {
|
||||
$bodyFile = file_get_contents (self::DATA_DIR . 'body.inc.html');
|
||||
}
|
||||
?>
|
||||
<div class="block">
|
||||
<h4>Options avancées</h4>
|
||||
<div class="row">
|
||||
@ -276,18 +264,16 @@
|
||||
'value' => $this->getData(['config', 'analyticsId'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::textarea('configScriptHead', [
|
||||
'label' => 'Insérer un script dans "Head"',
|
||||
'value' => $headerFile
|
||||
<div class="col3 offset3 verticalAlignBottom">
|
||||
<?php echo template::button('configHead', [
|
||||
'href' => helper::baseUrl() . 'config/script/head',
|
||||
'value' => 'Editer script dans head'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::textarea('configScriptBody', [
|
||||
'label' => 'Insérer un script dans "Body"',
|
||||
'value' => $bodyFile
|
||||
<div class="col3 verticalAlignBottom">
|
||||
<?php echo template::button('scriptBody', [
|
||||
'href' => helper::baseUrl() . 'config/script/body',
|
||||
'value' => 'Editer script dans body'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -436,5 +422,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
|
1
core/module/config/view/script/script.js.php
Normal file
1
core/module/config/view/script/script.js.php
Normal file
@ -0,0 +1 @@
|
||||
|
38
core/module/config/view/script/script.php
Normal file
38
core/module/config/view/script/script.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php echo template::formOpen('configScript'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('configManageBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'config',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('configManageSubmit',[
|
||||
'value' => 'valider',
|
||||
'ico' => 'check'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($this->geturl(2) === 'head'): ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::textarea('configScriptHead', [
|
||||
'value' => file_exists( self::DATA_DIR . 'head.inc.html') ? file_get_contents (self::DATA_DIR . 'head.inc.html') : '' ,
|
||||
'class' => 'editor'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php if ($this->geturl(2) === 'body'): ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::textarea('configScriptBody', [
|
||||
'value' => file_exists( self::DATA_DIR . 'body.inc.html') ? file_get_contents (self::DATA_DIR . 'body.inc.html') : '' ,
|
||||
'class' => 'editor'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php echo template::formClose(); ?>
|
@ -24,7 +24,7 @@
|
||||
<div class="col12">
|
||||
<?php echo template::textarea('themeAdvancedCss', [
|
||||
'value' => file_get_contents(self::DATA_DIR.'custom.css'),
|
||||
'class' => 'editorCss'
|
||||
'class' => 'editor'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
2
core/vendor/codemirror/init.js
vendored
2
core/vendor/codemirror/init.js
vendored
@ -2,7 +2,7 @@
|
||||
* Initialisation de CodeMirror
|
||||
*/
|
||||
$(function() {
|
||||
$(".editorCss").each(function() {
|
||||
$(".editor").each(function() {
|
||||
var _this = this;
|
||||
// Initialisation de CodeMirror
|
||||
var codeMirror = CodeMirror.fromTextArea(_this, {
|
||||
|
Loading…
Reference in New Issue
Block a user