Enable Tabs in Templates When Editing in Panel

This commit is contained in:
earnolmartin 2023-07-13 11:22:06 -06:00
parent dc55928411
commit 9970f95884
2 changed files with 22 additions and 1 deletions

View file

@ -1607,7 +1607,7 @@ function editApacheTemplate(){
array('clearTemplate','submit','default'=>'Revert to Default'),
array('op','hidden','default'=>__FUNCTION__)
);
$this->output.= '<p>' . $this->selecteddomain . ' Using Default Template: ' . ($usingDefault ? '<span class="success">YES</span>' : '<span class="error">NO</span>') . '</p>' . inputform5($inputparams);
$this->output.= '<p>' . $this->selecteddomain . ' Using Default Template: ' . ($usingDefault ? '<span class="success">YES</span>' : '<span class="error">NO</span>') . '</p><div class="editTemplateArea"><div class="editTemplateArea">' . inputform5($inputparams) . '</div>';
}else {
if($clearTemplate){
$success=$success && $this->executeQuery("update ".$this->conf['domainstable']['tablename']." set $templatefield='' where domainname='" . $domainname . "'");
@ -1787,7 +1787,9 @@ function editDnsTemplate(){
array('op','hidden','default'=>__FUNCTION__)
);
$this->output.= '<div class="editTemplateArea">';
$this->output.=inputform5($inputparams);
$this->output.= '</div>';
} else {
if($dnstemplate==$this->escape($templateinfile)) {

View file

@ -11,6 +11,8 @@ $(document).ready(function() {
getPublicServerSettings();
handleExpanders();
handleShowAdvancedAdminOptions();
enableTabAreasForCertainTextAreas();
});
function getGlobalTemplateFile(template, webserverMode, webserverType){
@ -142,3 +144,20 @@ function handleShowAdvancedAdminOptions(){
}
});
}
function enableTabAreasForCertainTextAreas(){
var textareas = document.getElementsByTagName('textarea');
var count = textareas.length;
for(var i=0;i<count;i++){
if(textareas[i].closest(".editTemplateArea")){
textareas[i].onkeydown = function(e){
if(e.keyCode==9 || e.which==9){
e.preventDefault();
var s = this.selectionStart;
this.value = this.value.substring(0,this.selectionStart) + "\t" + this.value.substring(this.selectionEnd);
this.selectionEnd = s+1;
}
}
}
}
}