Skip to content

Commit

Permalink
Fixed issue #10440: Missing Close button when importing a template
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Mar 9, 2016
1 parent c55a7af commit febf4a0
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion application/controllers/admin/templates.php
Expand Up @@ -183,7 +183,7 @@ public function upload()
else
{
$templateFixes= array();
}
}
$aViewUrls = 'importuploaded_view';
$aData = array(
'aImportedFilesInfo' => $aImportedFilesInfo,
Expand Down
1 change: 1 addition & 0 deletions application/views/admin/templates/importform_view.php
@@ -1,4 +1,5 @@


<h3 class="pagetitle"><?php eT("Uploaded template file") ?></h3>
<?php echo CHtml::form(array('admin/templates/sa/upload'), 'post', array('id'=>'importtemplate', 'name'=>'importtemplate', 'enctype'=>'multipart/form-data', 'onsubmit'=>'return validatefilename(this,"'.gT('Please select a file to import!', 'js').'");')); ?>
<input type='hidden' name='lid' value='$lid' />
Expand Down
34 changes: 33 additions & 1 deletion application/views/admin/templates/templateeditorbar_view.php
Expand Up @@ -71,10 +71,12 @@ function copyprompt(text, defvalue, copydirectory, action)
<?php endif;?>

<!-- Import -->
<?php $importModal=false;?>
<?php if(is_writable($tempdir) && function_exists("zip_open")):?>
<?php if(Permission::model()->hasGlobalPermission('templates','import')):?>
<?php if (is_writable($usertemplaterootdir)):?>
<a class="btn btn-default" href="<?php echo $this->createUrl('admin/templates/sa/upload'); ?>" role="button">
<?php $importModal=true;?>
<a class="btn btn-default" href="" role="button" data-toggle="modal" data-target="#importModal">
<span class="icon-import text-success"></span>
<?php eT("Import"); ?>
</a>
Expand Down Expand Up @@ -217,6 +219,36 @@ function copyprompt(text, defvalue, copydirectory, action)
</div>
</div>

<?php if($importModal):?>
<div class="modal fade" tabindex="-1" role="dialog" id="importModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title"><?php eT("Uploaded template file") ?></h4>
</div>
<?php echo CHtml::form(array('admin/templates/sa/upload'), 'post', array('id'=>'importtemplate', 'name'=>'importtemplate', 'enctype'=>'multipart/form-data', 'onsubmit'=>'return validatefilename(this,"'.gT('Please select a file to import!', 'js').'");')); ?>
<div class="modal-body">
<input type='hidden' name='lid' value='$lid' />
<input type='hidden' name='action' value='templateupload' />
<div class="form-group">
<label for='the_file'><?php eT("Select template ZIP file:") ?></label>
<input id='the_file' name='the_file' type="file" />
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<?php if (!function_exists("zip_open")) {?>
<?php eT("The ZIP library is not activated in your PHP configuration thus importing ZIP files is currently disabled.", "js") ?>
<?php } else {?>
<input class="btn btn-default" type='button' value='<?php eT("Import template ZIP archive") ?>' onclick='if (validatefilename(this.form,"<?php eT('Please select a file to import!', 'js') ?>")) { this.form.submit();}' />
<?php }?>
</div>
</form>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<?php endif;?>

<div class="col-lg-12 templateeditor">
<h3><?php eT("Template editor:"); ?> <i><?php echo $templatename; ?></i></h3>
Expand Down

0 comments on commit febf4a0

Please sign in to comment.