Skip to content

Commit

Permalink
Fixed issue #16748: Upload file (logo) missing in fruity and bootswat…
Browse files Browse the repository at this point in the history
…ch (#1627)

* Fixed issue #16748: Upload file (logo) missing in fruity and bootswatch

Add ed file upload to core options

* Fixed issue #16748: Upload file (logo) missing in fruity and bootswatch

Adding survey id as to not upload files in the global directory
  • Loading branch information
gabrieljenik committed Nov 10, 2020
1 parent c8becd0 commit 3492d66
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 3 deletions.
4 changes: 3 additions & 1 deletion application/controllers/admin/themeoptions.php
Expand Up @@ -592,7 +592,9 @@ private function updateCommon(TemplateConfiguration $model, $sid = null, $gsid =

$oModelWithInheritReplacement = TemplateConfiguration::model()->findByPk($model->id);
$aOptionAttributes = TemplateManifest::getOptionAttributes($oTemplate->path);
$aTemplateConfiguration = $oModelWithInheritReplacement->getOptionPageAttributes();

$oTemplate = $oModelWithInheritReplacement->prepareTemplateRendering($oModelWithInheritReplacement->template->name); // Fix empty file lists
$aTemplateConfiguration = $oTemplate->getOptionPageAttributes();
App()->clientScript->registerPackage('bootstrap-switch', LSYii_ClientScript::POS_BEGIN);

if ($aOptionAttributes['optionsPage'] == 'core') {
Expand Down
31 changes: 29 additions & 2 deletions application/views/admin/themeoptions/options_core.php
Expand Up @@ -204,11 +204,38 @@
}
}
echo '</div>';

if ($category == 'Images') {
?>
<div class="row action_hide_on_inherit">
<div class="container-fluid ls-space margin bottom-15 top-15">
<div class="row ls-space margin bottom-15">
<div class="col-sm-6">
<?php printf( gT("Upload an image (maximum size: %d MB):"), getMaximumFileUploadSize()/1024/1024); ?>
</div>
<div class="col-sm-6">
<span id="fileselector_frontend">
<label class="btn btn-default col-xs-8" for="upload_image_frontend">
<input class="hidden" id="upload_image_frontend" name="upload_image_frontend" type="file">
<i class="fa fa-upload ls-space margin right-10"></i>
<?php eT("Upload"); ?>
</label>
</span>
</div>
</div>
<div class="row">
<div class="progress">
<div id="upload_progress_frontend" class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;">
<span class="sr-only">0%</span>
</div>
</div>
</div>
</div>
</div>

<?php } ?>

</div>



</div>

Expand Down
12 changes: 12 additions & 0 deletions application/views/admin/themeoptions/update.php
Expand Up @@ -284,6 +284,18 @@
</div>
</div>

<!-- Form for image file upload -->
<div class="hidden">
<?php echo TbHtml::form(array('admin/themes/sa/upload'), 'post', array('id'=>'upload_frontend', 'name'=>'upload_frontend', 'enctype'=>'multipart/form-data')); ?>
<?php if(isset($aTemplateConfiguration['sid']) && !empty($aTemplateConfiguration['sid'])): ?>
<input type='hidden' name='surveyid' value='<?= $aTemplateConfiguration['sid'] ?>' />
<?php endif; ?>
<input type='hidden' name='templatename' value='<?php echo $aTemplateConfiguration['template_name']; ?>' />
<input type='hidden' name='templateconfig' value='<?php echo $aTemplateConfiguration['id']; ?>' />
<input type='hidden' name='action' value='templateuploadimagefile' />
</form>
</div>

<?php
Yii::app()->getClientScript()->registerScript("themeoptions-scripts", '
Expand Down

0 comments on commit 3492d66

Please sign in to comment.