Commit be0de71335d37f4e4d5975f69f6208345865e5d7
1 parent
0931ef6a
Brand server without requiring access to FS
PT: 1243391 Added initial field values for title and url from config settings. Updated by: Charl Joseph Mert
Showing
1 changed file
with
18 additions
and
5 deletions
plugins/ktcore/admin/manageBranding.php
| ... | ... | @@ -93,12 +93,16 @@ class ManageBrandDispatcher extends KTAdminDispatcher { |
| 93 | 93 | $widgets = array(); |
| 94 | 94 | $validators = array(); |
| 95 | 95 | |
| 96 | + $oConfig = KTConfig::getSingleton(); | |
| 97 | + $logoTitle = $oConfig->get("ui/companyLogoTitle"); | |
| 98 | + $logoUrl = $oConfig->get("ui/companyLogoUrl"); | |
| 99 | + | |
| 96 | 100 | // Adding the title widget |
| 97 | 101 | $widgets[] = $oWF->get('ktcore.widgets.string', array( |
| 98 | 102 | 'label' => _kt('Title'), |
| 99 | 103 | 'required' => false, |
| 100 | 104 | 'name' => 'logo_title', |
| 101 | - 'value' => '', | |
| 105 | + 'value' => $logoTitle, | |
| 102 | 106 | 'description' => _kt("This will appear when hovering over the logo."), |
| 103 | 107 | )); |
| 104 | 108 | |
| ... | ... | @@ -108,7 +112,7 @@ class ManageBrandDispatcher extends KTAdminDispatcher { |
| 108 | 112 | 'required' => false, |
| 109 | 113 | 'name' => 'logo_url', |
| 110 | 114 | 'id' => 'file', |
| 111 | - 'value' => '', | |
| 115 | + 'value' => $logoUrl, | |
| 112 | 116 | 'description' => _kt("This is the website address you will be redirected to after clicking the logo"), |
| 113 | 117 | )); |
| 114 | 118 | |
| ... | ... | @@ -378,12 +382,13 @@ class ManageBrandDispatcher extends KTAdminDispatcher { |
| 378 | 382 | |
| 379 | 383 | function do_upload(){ |
| 380 | 384 | global $default; |
| 385 | + | |
| 386 | + $config =& KTConfig::getSingleton(); | |
| 387 | + $logoUrl = $_REQUEST['data']['logo_url']; | |
| 388 | + $logoTitle = $_REQUEST['data']['logo_title']; | |
| 381 | 389 | |
| 382 | 390 | //No file, edit title and url only then |
| 383 | 391 | if (($_FILES['_kt_attempt_unique_file']['name'] == '')) { |
| 384 | - $config =& KTConfig::getSingleton(); | |
| 385 | - $logoUrl = $_REQUEST['data']['logo_url']; | |
| 386 | - $logoTitle = $_REQUEST['data']['logo_title']; | |
| 387 | 392 | |
| 388 | 393 | if ($config->set('ui/companyLogoUrl', $logoUrl) && $config->set('ui/companyLogoTitle', $logoTitle)) { |
| 389 | 394 | $this->successRedirectTo('main', _kt('Logo fields have been successfully updated.')); |
| ... | ... | @@ -393,6 +398,14 @@ class ManageBrandDispatcher extends KTAdminDispatcher { |
| 393 | 398 | |
| 394 | 399 | exit(0); |
| 395 | 400 | } |
| 401 | + | |
| 402 | + //If params where given then update the title and url | |
| 403 | + if ($config->set('ui/companyLogoUrl', $logoUrl) && $config->set('ui/companyLogoTitle', $logoTitle)) { | |
| 404 | + $default->log->info('Logo fields have been successfully updated.'); | |
| 405 | + } else { | |
| 406 | + $default->log->error("Couldn't update logo fields."); | |
| 407 | + } | |
| 408 | + | |
| 396 | 409 | |
| 397 | 410 | $oForm = $this->getUploadLogoForm(); |
| 398 | 411 | $res = $oForm->validate(); | ... | ... |