Skip to content

Commit

Permalink
Merge pull request #4013 in SW/shopware from sw-16046/5.2/connect-on-…
Browse files Browse the repository at this point in the history
…board to 5.2

* commit '21947d2bdd3d62fbdfdd496dbc0a5247b261a7c6':
  SW-16046 - Connect on board
  • Loading branch information
MarcelSchmaeing committed Aug 26, 2016
2 parents 3ab435f + 21947d2 commit 3e1b0f2
Show file tree
Hide file tree
Showing 15 changed files with 341 additions and 6 deletions.
44 changes: 44 additions & 0 deletions _sql/migrations/785-add-connect-default-menu.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

class Migrations_Migration785 extends Shopware\Components\Migrations\AbstractMigration
{
public function up($modus)
{
$this->updateHelpMenuPosition();

$sql = <<<'EOD'
SELECT id FROM s_core_menu WHERE name = "Connect" LIMIT 1;
EOD;
$menuId = $this->connection->query($sql)->fetch();
if ($menuId) {
return;
}

$this->addConnectMenu();
}

private function updateHelpMenuPosition()
{
$sql = <<<'EOD'
UPDATE `s_core_menu` SET `position`= 999 WHERE `name` = '' AND `class` = 'ico question_frame shopware-help-menu';
EOD;
$this->addSql($sql);
}

private function addConnectMenu()
{
$sql = <<<'EOD'
INSERT INTO `s_core_menu` (`id`, `parent`, `name`, `onclick`, `class`, `position`, `active`, `pluginID`, `controller`, `shortcut`, `action`)
VALUES (NULL, NULL, 'Connect', NULL, 'shopware-connect', '0', '1', NULL, NULL, NULL, NULL);
EOD;
$this->addSql($sql);

$sql = <<<'EOD'
SET @parent = (SELECT id FROM `s_core_menu` WHERE `name` = 'Connect');
INSERT INTO `s_core_menu` (`id`, `parent`, `name`, `onclick`, `class`, `position`, `active`, `pluginID`, `controller`, `shortcut`, `action`)
VALUES (NULL, @parent, 'Einstieg', NULL, 'sprite-mousepointer-click', '0', '1', NULL, 'PluginManager', NULL, 'ShopwareConnect');
EOD;
$this->addSql($sql);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
use Shopware\Bundle\PluginInstallerBundle\Struct\BasketStruct;
use Shopware\Bundle\PluginInstallerBundle\Struct\PluginInformationResultStruct;
use Shopware\Bundle\PluginInstallerBundle\Struct\PluginInformationStruct;
use Shopware\Models\Menu\Menu;
use Shopware\Models\Plugin\Plugin;
use ShopwarePlugins\PluginManager\Components\PluginCategoryService;
use ShopwarePlugins\SwagUpdate\Components\Steps\FinishResult;
Expand Down Expand Up @@ -632,6 +633,24 @@ public function loginAction()
$this->View()->assign('success', true);
}

public function disableConnectMenuAction()
{
$em = $this->container->get('models');
$repo = $em->getRepository(Menu::class);

/** @var Menu $menuEntry */
$menuEntry = $repo->findOneBy(array('label' => 'Connect'));
if ($menuEntry) {
$menuEntry->setActive(false);
$em->persist($menuEntry);
$em->flush();
}

$this->View()->assign([
'success' => true
]);
}

/**
* @return null|AccessTokenStruct
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,18 @@ premium_plugins/description_text = "Extend your store with high-class premium pl
expired_plugins/title = "Expired plugins"
expired_plugins/headline = "Continue benefiting from your tested plugins"
expired_plugins/description_text = "Your free trial version of the following plugins <b>expired</b>. To continue using these plugins in your online shop, you can <b>purchase</b> them directly from the Plugin Manager in your Shopware backend. Alternatively, these extensions can also be <b>uninstalled</b>.<br><br>Do you have any <b>suggestions</b> for improvement or feature wishes? Then <b>leave a review</b> through your Shopware Account!"
connect_introduction/title = "Shopware Connect"
connect_introduction/headline = "What is Shopware Connect all about?"
connect_introduction/description_text = "Shopware Connect is a portal that connects retailers, manufacturers and suppliers and helps them become more successful together. Connect is based on three main pillars:<br><br>"
connect_introduction/pillar_one = "<b>Free integration</b><br>In order to harness the power of our Community and realize the potential of the platform, Connect is already integrated in our software for free.<br><br>"
connect_introduction/pillar_two = "<b>Build business relationships</b><br>Thanks to the intuitive navigation, you can easily find appropriate business partners and send proposals. Quickly and easily build prosperous trade relationships.<br><br>"
connect_introduction/pillar_three = "<b>Product range expansion</b><br>Retailers can find either individual products that complement their existing assortment or entirely new product lines to round out their online shop."
connect_introduction/note = "At this time, Shopware Connect is only available in Germany."
connect_introduction/link = "<a href="https://en.shopware.com/connect" target="_blank">Inform me as soon as Connect becomes available in other countries.</a>"
connect_introduction/install_information = "You can install the plugin “Shopware Connect” through your Plugin Manager at any time."
connect_introduction/cancel = "Cancel"
connect_introduction/remove_connect = "Remove Connect"
connect_introduction/connect_now = "Connect now"

[de_DE]
title = "Plugin Manager"
Expand Down Expand Up @@ -374,4 +386,16 @@ premium_plugins/headline = "Shopware Premium Plugins - 30 Tage kostenlos testen"
premium_plugins/description_text = "Erweitere Deinen Store um hochwertige Premium Features und bau den Erfolg Deines Online-Business weiter aus. Nutze die Gelegenheit Dich von der Qualität und dem Nutzen der Shopware Premium Plugins zu überzeugen. Teste jetzt \<b\>völlig unverbindlich\</b\> unsere Premium Plugins für volle \<b\>30 Tage lang kostenlos\</b\>."
expired_plugins/title = "Abgelaufene Plugins"
expired_plugins/headline = "Profitieren Sie langfristig von den Vorzügen Ihrer getesteten Plugins"
expired_plugins/description_text = "Die kostenfreie Testversion folgender Plugins ist <b>abgelaufen</b>. Um langfristig in Ihrem Online-Shop von den Vorzügen der Erweiterungen <b>profitieren</b> zu können, <b>erwerben</b> Sie die Plugins ganz <b>bequem</b> über Ihren Pluginmanager. Alternativ können Sie die Erweiterungen <b>deinstallieren</b>.<br><br> Zudem haben Sie über die Bewertungsfunktion in Ihrem Account die Möglichkeit, <b>Feedback</b> zu Ihren getesteten Erweiterungen abzugeben sowie <b>Verbesserungswünsche</b> zu äußern."
expired_plugins/description_text = "Die kostenfreie Testversion folgender Plugins ist <b>abgelaufen</b>. Um langfristig in Ihrem Online-Shop von den Vorzügen der Erweiterungen <b>profitieren</b> zu können, <b>erwerben</b> Sie die Plugins ganz <b>bequem</b> über Ihren Pluginmanager. Alternativ können Sie die Erweiterungen <b>deinstallieren</b>.<br><br> Zudem haben Sie über die Bewertungsfunktion in Ihrem Account die Möglichkeit, <b>Feedback</b> zu Ihren getesteten Erweiterungen abzugeben sowie <b>Verbesserungswünsche</b> zu äußern."
connect_introduction/title = "Shopware Connect"
connect_introduction/headline = "Was ist eigentlich Shopware Connect?"
connect_introduction/description_text = "Shopware Connect verbindet Händler, Hersteller und Lieferanten und hilft ihnen, gemeinsam noch erfolgreicher zu werden. Dabei fußt Connect auf drei Säulen:<br><br>"
connect_introduction/pillar_one = "<b>Kostenlose Integration</b><br>Um die Kraft unserer Community zu bündeln und das Potenzial der Plattform auszuschöpfen, ist Connect bereits kostenlos in unsere Software integriert.<br><br>"
connect_introduction/pillar_two = "<b>Aufbau von Geschäftsbeziehungen</b><br>Mit der intuitiven Navigation können passende Geschäftspartner gefunden und Anfragen verschickt werden. So entstehen schnell und einfach Handelsbeziehungen.<br><br>"
connect_introduction/pillar_three = "<b>Erweiterung der Sortimente</b><br>Händler finden komplementäre oder ergänzende Produkte zu ihren Artikeln oder probieren ganz neue Produktsparten aus, um damit ihr Sortiment abzurunden."
connect_introduction/note = "Shopware Connect ist derzeit nur in Deutschland verfügbar."
connect_introduction/link = "<a href="https://de.shopware.com/connect" target="_blank">Informiere mich, sobald Connect auch in anderen Ländern verfügbar ist.</a>"
connect_introduction/install_information = "Das Plugin "Shopware Connect" kann jederzeit wieder über den Plugin Manager installiert werden."
connect_introduction/cancel = "Abbrechen"
connect_introduction/remove_connect = "Connect entfernen"
connect_introduction/connect_now = "Jetzt Connecten"
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ Ext.define('Shopware.apps.PluginManager', {
'list.LicencePage',
'list.PremiumPluginsPage',
'list.ExpiredPluginsPage',
'list.ConnectIntroductionPage',
'list.Window',


'detail.Window',
'detail.Container',
'detail.Prices',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,18 @@ Ext.define('Shopware.apps.PluginManager.controller.Main', {
me.control({
'plugin-manager-listing-window': {
'plugin-manager-loaded': me.afterPluginManagerLoaded
},
'plugin-manager-connect-introduction-page{ isVisible(true) }': {
'connect-introduction-remove': me.removeConnectIntroduction,
'connect-introduction-install': me.installConnectIntroduction
}
});

Shopware.app.Application.on({
'load-update-listing': me.loadUpdateListing,
'enable-premium-plugins-mode': me.enablePremiumPluginsMode,
'enable-expired-plugins-mode': me.enableExpiredPluginsMode,
'enable-connect-introduction-mode': me.enableConnectIntroductionMode,
scope: me
});

Expand All @@ -103,6 +108,16 @@ Ext.define('Shopware.apps.PluginManager.controller.Main', {
me.getNavigation().hide();
},

enableConnectIntroductionMode: function() {
var me = this,
listingWindow = me.getListingWindow();

listingWindow.setWidth(800);
listingWindow.setHeight(710);
listingWindow.setTitle('{s name="connect_introduction/title"}{/s}');
me.getNavigation().hide();
},

loadUpdateListing: function(callback) {
var me = this,
navigation = me.getNavigation(),
Expand Down Expand Up @@ -156,6 +171,11 @@ Ext.define('Shopware.apps.PluginManager.controller.Main', {
if (me.subApplication.action == 'ExpiredPlugins') {
Shopware.app.Application.fireEvent('display-expired-plugins');
}
if (me.subApplication.action == 'ShopwareConnect') {
Shopware.app.Application.fireEvent('display-connect-introduction');

return;
}

Ext.Function.defer(function () {
localListing.getStore().load({
Expand All @@ -164,6 +184,49 @@ Ext.define('Shopware.apps.PluginManager.controller.Main', {
}
});
}, 1000);
},

removeConnectIntroduction: function() {
var me = this;

Ext.Ajax.request({
url: '{url controller="PluginManager" action="disableConnectMenu"}',
callback: function(options, success, response) {
if (success) {
me.getListingWindow().close();
var connectMenu = Ext.ComponentQuery.query('mainmenu [iconCls=shopware-connect]')[0];
if (connectMenu) {
connectMenu.previousSibling().destroy();
connectMenu.nextSibling().nextSibling().destroy();
connectMenu.destroy();
}
}
}
}, me);
},

installConnectIntroduction: function() {
var me = this,
plugin = Ext.create('Shopware.apps.PluginManager.model.Plugin', {
technicalName: 'SwagConnect',
iconPath: '{link file="themes/Backend/ExtJs/backend/_resources/resources/themes/images/shopware-ui/shopware_connect.png"}'
});

Shopware.app.Application.fireEvent('update-dummy-plugin', plugin, function(response) {
if (response.success) {
Shopware.app.Application.fireEvent('install-plugin', plugin, function(response) {
if (response.success) {
Shopware.app.Application.fireEvent('activate-plugin', plugin, function(response) {
me.getListingWindow().close();
Shopware.app.Application.addSubApplication({
name: 'Shopware.apps.Connect',
action: 'Register'
});
});
}
}, me);
}
}, me);
}
});
//{/block}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ Ext.define('Shopware.apps.PluginManager.controller.Navigation', {
accountPage: 4,
licencePage: 5,
premiumPluginsPage: 6,
expiredPluginsPage: 7
expiredPluginsPage: 7,
connectIntroductionPage: 8
},

animationSpeed: 150,
Expand Down Expand Up @@ -91,6 +92,7 @@ Ext.define('Shopware.apps.PluginManager.controller.Navigation', {
'plugin-manager-display-updates': me.displayPluginUpdatesPage,
'display-premium-plugins': me.displayPremiumPluginsPage,
'display-expired-plugins': me.displayExpiredPluginsPage,
'display-connect-introduction': me.displayConnectIntroductionPage,
scope: me
});

Expand Down Expand Up @@ -255,6 +257,14 @@ Ext.define('Shopware.apps.PluginManager.controller.Navigation', {
me.switchView(me.cards.expiredPluginsPage);
},

displayConnectIntroductionPage: function() {
var me = this;

Shopware.app.Application.fireEvent('enable-connect-introduction-mode');

me.switchView(me.cards.connectIntroductionPage);
},

displayPluginUpdatesPage: function () {
var me = this,
updatePage = me.getUpdatePage(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
/**
* Shopware 5
* Copyright (c) shopware AG
*
* According to our dual licensing model, this program can be used either
* under the terms of the GNU Affero General Public License, version 3,
* or under a proprietary license.
*
* The texts of the GNU Affero General Public License with an additional
* permission and of our proprietary license can be found at and
* in the LICENSE file you have received along with this program.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* "Shopware" is a registered trademark of shopware AG.
* The licensing of the program under the AGPLv3 does not imply a
* trademark license. Therefore any rights, title and interest in
* our trademarks remain entirely with us.
*
* @category Shopware
* @package PluginManager
* @subpackage List
* @version $Id$
* @author shopware AG
*/
//{namespace name=backend/plugin_manager/translation}

//{block name="backend/plugin_manager/view/list/connect_introduction_page"}
Ext.define('Shopware.apps.PluginManager.view.list.ConnectIntroductionPage', {
extend: 'Ext.panel.Panel',
alias: 'widget.plugin-manager-connect-introduction-page',

border: false,
bodyCls: 'plugin-manager-listing-page',
autoScroll: true,
bodyPadding: '20 40 10 40',

initComponent: function() {
var me = this;

me.items = me.buildItems();
me.dockedItems = me.buildDockedItems();

me.callParent(arguments);
},

buildItems: function() {
var me = this;

me.headLineText = Ext.create('Ext.container.Container', {
cls: 'headline',
html: '{s name="connect_introduction/headline"}{/s}'
});

me.descriptionText = Ext.create('Ext.container.Container', {
html: '{s name="connect_introduction/description_text"}{/s}',
padding: '20 0 0 0'
});

me.pillarOne = Ext.create('Ext.container.Container', {
html: '<div style="float: left;"><div class="shopware-connect-pillar-one"></div></div><div style="margin-left: 120px; padding-top: 20px;">{s name="connect_introduction/pillar_one"}{/s}</div><div style="clear: both;"></div><br>'
});

me.pillarTwo = Ext.create('Ext.container.Container', {
html: '<div style="float: left;"><div class="shopware-connect-pillar-two"></div></div><div style="margin-left: 120px; padding-top: 20px;">{s name="connect_introduction/pillar_two"}{/s}</div><div style="clear: both;"></div><br>'
});

me.pillarThree = Ext.create('Ext.container.Container', {
html: '<div style="float: left;"><div class="shopware-connect-pillar-three"></div></div><div style="margin-left: 120px; padding-top: 20px;">{s name="connect_introduction/pillar_three"}{/s}</div><div style="clear: both;"></div>'
});

me.noteText = Ext.create('Ext.container.Container', {
cls: 'block-message',
html: '<div class="notice">{s name="connect_introduction/note"}{/s}</div>',
padding: '20 0 0 0'
});

me.linkText = Ext.create('Ext.container.Container', {
html: '{s name="connect_introduction/link"}{/s}',
padding: '5 0 0 0'
});

me.installInfoText = Ext.create('Ext.container.Container', {
padding: '54 0 0 0',
html: '{s name="connect_introduction/install_information"}{/s}'
});

return [
me.headLineText,
me.descriptionText,
me.pillarOne,
me.pillarTwo,
me.pillarThree,
me.noteText,
me.linkText,
me.installInfoText
];
},

buildDockedItems: function() {
var me = this;

me.bottomToolbar = Ext.create('Ext.toolbar.Toolbar', {
dock: 'bottom',
items: [{
xtype: 'button',
cls: 'secondary',
text: '{s name="connect_introduction/cancel"}{/s}',
handler: function() {
me.up('window').close();
}
}, '->', {
xtype: 'button',
cls: 'secondary',
text: '{s name="connect_introduction/remove_connect"}{/s}',
handler: function() {
me.fireEvent('connect-introduction-remove');
}
}, {
xtype: 'button',
cls: 'primary',
text: '{s name="connect_introduction/connect_now"}{/s}',
handler: function() {
me.fireEvent('connect-introduction-install');
}
}]
});

return [me.bottomToolbar];
}
});
//{/block}
Loading

0 comments on commit 3e1b0f2

Please sign in to comment.