Skip to content

Commit

Permalink
Dev: new file list design for inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Jun 28, 2017
1 parent 456c0f8 commit 24a95c4
Showing 1 changed file with 97 additions and 20 deletions.
117 changes: 97 additions & 20 deletions application/views/admin/templates/templatesummary_view.php
Expand Up @@ -15,27 +15,104 @@
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<?php eT("You can't save changes because the template directory is not writable."); ?>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
</div>

<div class="row template-sum">
<div class="col-lg-2" id='templateleft'>
<div style="padding-left:1em;">
<?php eT("Standard files:"); ?><br>
<?php
$aSelectOptions=array(
gT("Screen part files")=>array_combine($files,$files),
gT("JavaScript files")=>array_combine($jsfiles,$jsfiles),
gT("CSS files")=>array_combine($cssfiles,$cssfiles));

echo CHtml::listBox('editfile',$editfile,$aSelectOptions,
array('class'=>'form-control','size'=>'20',
'onchange'=> "javascript: var uri = new Uri('".$this->createUrl("admin/templates",array('sa'=>'view','screenname'=>$screenname,'templatename'=>$templatename))."'); uri.addQueryParam('editfile',this.value); window.open(uri.toString(), '_top')"
));
?>
<div class="col-sm-2" id='templateleft'>
<div >
<?php eT("Screen part files:"); ?>
<div class="col-sm-12 well" style="padding-left: 0;">

<?php foreach ($files as $file):?>
<div class="row">
<div class="col-sm-9">
<a
href = "<?php echo $this->createUrl('admin/templates', array('sa'=>'view','screenname'=>$screenname,'templatename'=>$templatename, 'editfile' => $file )); ?>"
class = "<?php if($file == $relativePathEditfile ){echo 'text-danger';}else{echo 'text-success';}; ?>"
>
<?php echo (empty(substr(strrchr($file, DIRECTORY_SEPARATOR), 1)))?$file:substr(strrchr($file, DIRECTORY_SEPARATOR), 1) ;?>
</a>
</div>
<div class="col-sm-3">
<?php if ( $oEditedTemplate->getTemplateForFile($file, $oEditedTemplate)->sTemplateName == $oEditedTemplate->sTemplateName):?>
<span class="label label-success">
<?php eT("local"); ?>
</span>
<?php else: ?>
<span class="label label-danger">
<?php eT("inherited"); ?>
</span>
<?php endif;?>
</div>
</div>
<?php endforeach;?>
</div>
</div>

<div>
<?php eT("JavaScript files:"); ?>
<div class="col-sm-12 well">

<?php foreach ($jsfiles as $file):?>
<div class="row">
<div class="col-sm-9">
<a
href="<?php echo $this->createUrl('admin/templates', array('sa'=>'view','screenname'=>$screenname,'templatename'=>$templatename, 'editfile' => $file )); ?>"
class = "<?php if($file == $relativePathEditfile ){echo 'text-danger';}else{echo 'text-success';}; ?>"
>
<?php echo (empty(substr(strrchr($file, DIRECTORY_SEPARATOR), 1)))?$file:substr(strrchr($file, DIRECTORY_SEPARATOR), 1) ;?>
</a>
</div>
<div class="col-sm-3">
<?php if ( $oEditedTemplate->getTemplateForFile($file, $oEditedTemplate)->sTemplateName == $oEditedTemplate->sTemplateName):?>
<span class="label label-success">
<?php eT("local"); ?>
</span>
<?php else: ?>
<span class="label label-danger">
<?php eT("inherited"); ?>
</span>
<?php endif;?>
</div>
</div>
<?php endforeach;?>
</div>
</div>

<div >
<?php eT("CSS files:"); ?>
<div class="col-sm-12 well">

<?php foreach ($cssfiles as $file):?>
<div class="row">
<div class="col-sm-9">
<a
href="<?php echo $this->createUrl('admin/templates', array('sa'=>'view','screenname'=>$screenname,'templatename'=>$templatename, 'editfile' => $file )); ?>"
class = "<?php if($file == $relativePathEditfile ){echo 'text-danger';}else{echo 'text-success';}; ?>"
>
<?php echo (empty(substr(strrchr($file, DIRECTORY_SEPARATOR), 1)))?$file:substr(strrchr($file, DIRECTORY_SEPARATOR), 1) ;?>
</a>
</div>
<div class="col-sm-3">
<?php if ( $oEditedTemplate->getTemplateForFile($file, $oEditedTemplate)->sTemplateName == $oEditedTemplate->sTemplateName):?>
<span class="label label-success">
<?php eT("local"); ?>
</span>
<?php else: ?>
<span class="label label-danger">
<?php eT("inherited"); ?>
</span>
<?php endif;?>
</div>
</div>
<?php endforeach;?>
</div>
</div>
</div>


<div class="col-lg-8 templateeditor">
<?php echo CHtml::form(array('admin/templates/sa/templatesavechanges'), 'post', array('id'=>'editTemplate', 'name'=>'editTemplate')); ?>

Expand All @@ -54,18 +131,18 @@
?>
<p class='text-center'>
<br/>
<?php if (Permission::model()->hasGlobalPermission('templates','update')):?>
<?php if (is_writable($templates[$templatename])):?>
<?php if (!is_template_editable($templatename)):?>
disabled='disabled' alt='<?php eT("Changes cannot be saved to a standard template."); ?>'
<?php endif; ?>
<?php if (Permission::model()->hasGlobalPermission('templates','update')):?>

<?php
$sSaveText = ( $oEditedTemplate->getTemplateForFile($relativePathEditfile, $oEditedTemplate)->sTemplateName == $oEditedTemplate->sTemplateName)?gT("Save changes"):gT("Copy to local template and save changes");
?>

<?php if (is_writable($templates[$templatename])):?>

<input type='submit' class='btn btn-default' value='<?php echo $sSaveText; ?>'
<?php if (!is_template_editable($templatename)):?>
disabled='disabled' alt='<?php eT("Changes cannot be saved to a standard template."); ?>'
<?php endif; ?>
/>
<?php endif; ?>

Expand Down

0 comments on commit 24a95c4

Please sign in to comment.