Skip to content

Commit

Permalink
Dev: display the correct file from the correct template
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Jun 23, 2017
1 parent cb7650e commit d0f2612
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 22 deletions.
56 changes: 36 additions & 20 deletions application/controllers/admin/templates.php
Expand Up @@ -1166,26 +1166,6 @@ protected function _initialise($templatename, $screenname, $editfile, $showsumma
$files = array(0=>$files);
}

if (is_array($files))
{
$match = 0;
if (in_array($editfile,$files) || in_array($editfile,$aCssAndJsfiles))
{
$match=1;
}

if ($match == 0)
{
if (count($files) > 0)
{
$editfile = $files[0];
}
else
{
$editfile = "";
}
}
}

// Get list of 'otherfiles'
// We can't use $oTemplate->otherFiles, because of retrocompatibility with 2.06 template and the big mess of it mixing files
Expand All @@ -1206,6 +1186,42 @@ protected function _initialise($templatename, $screenname, $editfile, $showsumma
}



$editfile = $oEditedTemplate->getFilePathForEdition($editfile, array_merge($files, $aCssAndJsfiles));
/*
if (is_array($files))
{
$match = 0;
if (in_array($editfile,$files) || in_array($editfile,$aCssAndJsfiles))
{
$match=1;
}
if ($match == 0)
{
if (count($files) > 0)
{
$editfile = $files[0];
}
else
{
$editfile = "";
}
}
}
*/


$extension = substr(strrchr($editfile, "."), 1);
$highlighter = 'html';
if ($extension == 'css' || $extension == 'js')
{
$highlighter = $extension;
}




$aData['codelanguage'] = $sLanguageCode;
$aData['highlighter'] = $highlighter;
$aData['screens'] = $screens;
Expand Down
5 changes: 3 additions & 2 deletions application/views/admin/templates/templatesummary_view.php
Expand Up @@ -8,7 +8,7 @@
<div class="col-lg-12">

<?php App()->getClientScript()->registerPackage('jquery-ace'); ?>
<h4><?php echo sprintf(gT("Editing file '%s'"),$editfile); ?></h4>
<h4><?php echo sprintf(gT("Viewing file '%s'"),$editfile); ?></h4>

<?php if (!is_writable($templates[$templatename])):?>
<div class="alert alert-warning alert-dismissible" role="alert">
Expand Down Expand Up @@ -43,7 +43,8 @@
echo CHtml::hiddenField('screenname', $screenname, array('class'=>'screenname'));
echo CHtml::hiddenField('editfile', $editfile);
echo CHtml::hiddenField('action', 'templatesavechanges');
echo CHtml::textArea('changes', isset($editfile)?filetext($templatename,$editfile,$templates):'',array('rows'=>'20',

echo CHtml::textArea('changes', isset($editfile)?file_get_contents($editfile):'',array('rows'=>'20',
'cols'=>'40',
'data-filetype'=>$sEditorFileType,
'class'=>'ace '.$sTemplateEditorMode,
Expand Down

0 comments on commit d0f2612

Please sign in to comment.