Added modify php.ini from phpserver module

This commit is contained in:
Antonio de la Rosa 2025-10-24 00:15:45 +02:00
parent 56157e4adb
commit ffdf81ec07
6 changed files with 295 additions and 37 deletions

View file

@ -3,19 +3,24 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ace-builds@1.43.4/css/ace.min.css">
</%block>
<%block name="content">
<h3>${_('Edit php.ini')}</h3>
<p><a href="${url_for('phpserver_app.php_dashboard')}">${_('PHP servers list')}</a> &gt;&gt; ${_('Edit php.ini')}</p>
<h3>${_('Edit php.ini')} - ${domain}</h3>
<div class="form">
<div id="php_ini" style="height:600px;">
</div>
</div>
<p>
<form method="post" name="save_php_ini" id="save_php_ini">
<form method="post" name="save_php_ini" id="save_php_ini" action="${url_for('phpserver_app.save_php_ini', php_server_id=php_server_id)}">
<input type="hidden" name="php_ini_file" id="php_ini_file" value="" />
<input type="submit" name="php_ini" value="${_('Save php.ini')}" id="php_ini" />
</form>
</p>
<p><a href="${url_for('phpserver_app.php_dashboard')}">${_('PHP servers list')}</a> &gt;&gt; ${_('Edit php.ini')}</p>
</%block>
<%block name="jscript_block">
<script language="Javascript" src="${make_media_url('js/jsutils/posting2.js', 'pastafari2')}"></script>
<script src=" https://cdnjs.cloudflare.com/ajax/libs/ace/1.43.3/ace.min.js"></script>
<script>
@ -65,22 +70,61 @@ $(document).ready( function (e) {
editor.setTheme("ace/theme/twilight");
editor.session.setMode("ace/mode/ini");
});
options={'url': '${url_for("phpserver_app.save_php_ini", php_server_id=php_server_id)}', 'loading': '#layer_loading', 'success': function (data) {
/*$('#save_php_ini').submit( function (e) {
document.getElementById('php_ini_file').value=editor.getValue();
});*/
options={'url': '${url_for("phpserver_app.save_php_ini", php_server_id=php_server_id)}', 'loading': '#layer_loading', 'success': function (data) {
if(!data.error) {
window.location='${url_for("phpserver_app.php_dashboard")}';
}
else {
alert(_('I cannot modify the php configuration!. Please try later.'));
}
}
};
}, 'error': function (data) {
console.log('Retry send the file because a horrible bug in ace editor...');
if(data.hasOwnProperty('error_form')) {
if(data.error_form.hasOwnProperty('empty_file')) {
//Try send again.
$('#save_php_ini').submit();
}
}
},
'before_send': function (jxhr, settings) {
//$('#php_ini_file').val(editor.getValue());
document.getElementById('php_ini_file').value=editor.getValue();
/*if(document.getElementById('php_ini_file').value=='') {
jxhr.abort();
alert('No file');
}*/
//console.log(editor.getValue());
}
};
$('#del_phpserver').sendPost(options);
$('#save_php_ini').sendPost(options);
$('#save_php_ini').click( function (e) {
//console.log(editor.session.getValue());
});