Skip to content

Commit

Permalink
add version notification support
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandr Kolomiec committed Aug 25, 2016
1 parent 96de9e7 commit 7cef79f
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 1 deletion.
37 changes: 37 additions & 0 deletions Controller/ConfigurationController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/*
* Copyright (c) 2014 Eltrino LLC (http://eltrino.com)
*
* Licensed under the Open Software License (OSL 3.0).
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://opensource.org/licenses/osl-3.0.php
*
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@eltrino.com so we can send you a copy immediately.
*/
namespace Diamante\EmailProcessingBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

/**
* @Route("system")
*/
class ConfigurationController extends Controller
{
/**
* @Route("/config/channels/help", name="diamante_config_channels_help")
* @Template
*/
public function systemAction()
{
$versionService = $this->get('diamante.version.service');
$versions = sprintf('%s|%s', $versionService->getDiamanteVersion(), $versionService->getOroVersion());

return ['versions' => base64_encode($versions)];
}
}
3 changes: 2 additions & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ public function getConfigTreeBuilder()
'mailbox_delete_processed_messages' => [
'value' => false,
'type' => 'bool'
]
],
'mailbox_help' => ['type' => 'array']
)
);

Expand Down
1 change: 1 addition & 0 deletions DependencyInjection/DiamanteEmailProcessingExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ public function load(array $configs, ContainerBuilder $container)

$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.xml');
$loader->load('form.xml');
}
}
29 changes: 29 additions & 0 deletions Form/Type/HelpChannelsConfigurationType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Diamante\EmailProcessingBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

use Oro\Bundle\FormBundle\Form\DataTransformer\ArrayToJsonTransformer;

class HelpChannelsConfigurationType extends AbstractType
{
const NAME = 'diamante_config_channels_help';

/**
* {@inheritdoc}
*/
public function getParent()
{
return 'hidden';
}

/**
* {@inheritdoc}
*/
public function getName()
{
return self::NAME;
}
}
3 changes: 3 additions & 0 deletions Resources/config/assets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
css:
'diamanteemailprocessing':
- 'bundles/diamanteemailprocessing/css/diam.css'
16 changes: 16 additions & 0 deletions Resources/config/form.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<parameters>
<parameter key="diamante_config_channels_help.type.class">Diamante\EmailProcessingBundle\Form\Type\HelpChannelsConfigurationType</parameter>
</parameters>

<services>
<service id="diamante_config_channels_help" class="%diamante_config_channels_help.type.class%">
<tag name="form.type" alias="diamante_config_channels_help"/>
</service>
</services>
</container>
3 changes: 3 additions & 0 deletions Resources/config/oro/routing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
diamante_email_processing_bundle:
resource: "@DiamanteEmailProcessingBundle/Controller"
type: annotation
2 changes: 2 additions & 0 deletions Resources/config/oro/twig.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bundles:
- DiamanteEmailProcessingBundle:Form:fields.html.twig
10 changes: 10 additions & 0 deletions Resources/public/css/diam.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.diam-channels-info {
margin-top: 20px;
}

.diam-channels-image {
width: 13px;
height: 13px;
position: relative;
bottom: 1px;
}
7 changes: 7 additions & 0 deletions Resources/views/Configuration/block/system.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div class="diam-channels-info">
<img class="diam-channels-image"
src="https://assets.diamantedesk.com/images/{{ versions }}/help.png"
title="More info"/> More info could be found in the <a
href="http://docs.diamantedesk.com/en/latest/user-guide/channels/email-processing.html#how-to-set-up-a-support-account">
documentation.</a>
</div>
8 changes: 8 additions & 0 deletions Resources/views/Form/fields.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% block diamante_config_channels_help_widget %}
{{ form_widget(form) }}
{{ oro_widget_render({
'widgetType': 'block',
'url': path('diamante_config_channels_help'),
'alias': 'diamante_config_channels_help'
}) }}
{% endblock %}

0 comments on commit 7cef79f

Please sign in to comment.