Commit de4eb168 authored by jsacksick's avatar jsacksick Committed by Jonathan Sacksick

Add Google DFP ads during the installation with themed DFP area.

Change-Id: I4dbb042de03ed7e34288cf9d66ea5704f0ddcd62
Reviewed-on: https://code.drupalcommerce.org/642Tested-by: 's avatarJenkinsCG <jenkins@drupalcommerce.org>
Reviewed-by: 's avatarJonathan Sacksick <jonathan.sacksick@gmail.com>
parent 25db3e06
......@@ -31,12 +31,18 @@ function commerce_kickstart_install_tasks() {
'type' => 'batch',
// Show this task only after the Kickstart steps have bene reached.
'display' => strpos($current_task, 'commerce_kickstart_') !== FALSE,
'dfp_settings' => array(
'dfp_unit' => 'Kickstart_Install_2',
),
);
$tasks['commerce_kickstart_import_content'] = array(
'display_name' => st('Import content'),
'type' => 'batch',
// Show this task only after the Kickstart steps have bene reached.
'display' => strpos($current_task, 'commerce_kickstart_') !== FALSE,
'dfp_settings' => array(
'dfp_unit' => 'Kickstart_Install_3',
),
);
return $tasks;
......@@ -47,7 +53,6 @@ function commerce_kickstart_install_tasks() {
*/
function commerce_kickstart_install_tasks_alter(&$tasks, $install_state) {
$tasks['install_finished']['function'] = 'commerce_kickstart_install_finished';
$tasks['install_select_profile']['display'] = FALSE;
$tasks['install_select_locale']['display'] = FALSE;
$tasks['install_select_locale']['run'] = INSTALL_TASK_SKIP;
......@@ -63,7 +68,23 @@ function commerce_kickstart_install_tasks_alter(&$tasks, $install_state) {
$old_tasks = $tasks;
$tasks = array_slice($old_tasks, 0, 2) + $new_task + array_slice($old_tasks, 2);
// Set the installation theme.
_commerce_kickstart_set_theme('commerce_kickstart_admin');
// Test if the current task is a batch task.
if (isset($tasks[$install_state['active_task']]['type']) && $tasks[$install_state['active_task']]['type'] == 'batch') {
if (!isset($tasks[$install_state['active_task']]['dfp_settings'])) {
$tasks[$install_state['active_task']]['dfp_settings'] = array();
}
// Default to Kickstart_Install dfp unit.
$tasks[$install_state['active_task']]['dfp_settings'] += array(
'dfp_unit' => 'Kickstart_Install',
);
drupal_add_js('//www.googletagservices.com/tag/js/gpt.js');
drupal_add_js(array(
'dfp' => $tasks[$install_state['active_task']]['dfp_settings'],
), 'setting');
drupal_add_js(drupal_get_path('profile', 'commerce_kickstart') . '/js/commerce_kickstart.js');
}
}
/**
......@@ -87,25 +108,43 @@ function _commerce_kickstart_set_theme($target_theme) {
* Task callback: shows the welcome screen.
*/
function install_welcome($form, &$form_state, &$install_state) {
drupal_set_title(st('Welcome'));
$message = st('Thank you for choosing Commerce Kickstart!') . '<br />';
$message .= '<p>' . st('This distribution installs Drupal Commerce jam-packed with
the best community features, more than we could hope to mention here.') . '</p>';
$message .= '<p>' . st('Please note that this is a community-supported work in progress,
so be sure to join us over on ' . l('drupalcommerce.org', 'http://drupalcommerce.org') .
' and share your first impressions.') . '</p>';
drupal_set_title(st('Privacy Policy Summary'));
$message = '<p>' . st('Thank you for choosing Commerce Kickstart, a product offered by Commerce Guys.') . '</p>';
$eula = '<p>' . st('While we have a rather long, boring Privacy Policy just like any other technology company, here is a short summary of some key items we feel are important:') . '</p>';
$items = array();
$dfp_link = l("Google's DoubleClick for Publishers (\"DFP\")", "http://www.google.com/dfp/info/sb/index.html", array('attributes' => array('target' => '_blank')));
$items[] = st("Commerce Kickstart makes use of !dfp;", array('!dfp' => $dfp_link));
$items[] = st('We use DFP to show you content relevant to Drupal Commerce at various points and places in Commerce Kickstart, including during installation;');
$items[] = st('DFP is a third-party technology. It uses audience management tags which collect and use certain data;');
$items[] = st('Commerce Guys does not collect any personally identifiable information;');
$items[] = st('If at any time after installation you do not want us to utilize DFP through Commerce Kickstart, you can easily opt out of it;');
$eula .= theme('item_list', array('items' => $items));
$eula_link = l('Privacy Policy and User Agreement', 'https://marketplace.commerceguys.com/privacy/commerce-kickstart', array('attributes' => array('target' => '_blank')));
$eula .= '<p>' . st('That is it for the main points. The full !policy can be viewed on our website. Thank you again for choosing Commerce Kickstart!', array('!policy' => $eula_link)) . '</p>';
$form = array();
$form['welcome_message'] = array(
'#markup' => $message,
);
$form['eula'] = array(
'#prefix' => '<div id="eula-installation-welcome">',
'#markup' => $eula,
);
$form['eula-accept'] = array(
'#title' => st('I agree to the Privacy Policy and User Agreement'),
'#type' => 'checkbox',
'#suffix' => '</div>',
);
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => st("Let's Get Started!"),
'#states' => array(
'disabled' => array(
':input[name="eula-accept"]' => array('checked' => FALSE),
),
),
'#weight' => 10,
);
return $form;
......@@ -682,6 +721,9 @@ function commerce_kickstart_install() {
}
// Disable migrate autoregistration.
variable_set('migrate_disable_autoregistration', TRUE);
// Check DFP User Agreement.
variable_set('commerce_kickstart_dfp_eula', TRUE);
}
/**
......
(function ($) {
Drupal.behaviors.commerceKickstartDfp = {
attach: function (context, settings) {
$('#progress', context).once('commerce-kickstart-dfp', function () {
var dfpUnit = Drupal.settings.dfp.dfp_unit;
if (dfpUnit) {
var slot = $('<div id="dfp-wrapper"><div class="dfp-install-ad"><div id="div-gpt-ad" class="dfp-install-ad"></div></div></div>');
$(this).parent().append(slot);
if (typeof googletag != 'undefined') {
googletag.cmd.push(function() {
googletag.defineSlot("/17601239/" + dfpUnit, [300, 250], "div-gpt-ad").addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
googletag.display('div-gpt-ad');
}
}
});
}
};
})(jQuery);
......@@ -53,6 +53,8 @@ body.in-maintenance #credit .logo a {
/* Installation/Maintenance Page */
body.in-maintenance {
background: #256ba7 url("../images/installation-bg.png") repeat 0 0;
/* Welcome Page Styles */
/* DFP Styles */
}
body.in-maintenance .body-wrapper {
background: #256ba7;
......@@ -118,7 +120,7 @@ body.in-maintenance #sidebar-first {
}
body.in-maintenance fieldset .fieldset-wrapper,
body.in-maintenance fieldset.collapsible {
border: 1px solid #cccccc;
border: 1px solid #ccc;
padding: 15px;
}
body.in-maintenance ol.task-list {
......@@ -162,6 +164,43 @@ body.in-maintenance .password-strength {
body.in-maintenance .form-item-extras label[for=edit-extras] {
clear: both;
}
body.in-maintenance #edit-submit.form-disabled {
opacity: .5;
cursor: auto;
}
body.in-maintenance #install-welcome > div > p {
margin-top: 0;
}
body.in-maintenance #eula-installation-welcome {
background: #f4f4f4;
border: 1px solid #edebeb;
padding: 0 20px 10px;
font-size: .9em;
line-height: 1.5em;
}
body.in-maintenance #eula-installation-welcome ul {
margin-bottom: 20px;
}
body.in-maintenance #eula-installation-welcome ul li {
margin-bottom: 10px;
}
body.in-maintenance #eula-installation-welcome .form-item-eula-accept label.option {
line-height: 2em;
}
body.in-maintenance #progress {
margin-bottom: 50px;
}
body.in-maintenance #dfp-wrapper {
background: transparent url("../images/install-dfp-message.png") no-repeat 0 45px;
min-height: 250px;
}
body.in-maintenance .dfp-install-ad {
background: transparent url("../images/dfp-offline.png") no-repeat center center;
box-shadow: 0 0 1px #333;
float: right;
height: 250px;
width: 300px;
}
body.installing-demo-store ol.task-list,
body.importing-content ol.task-list,
......@@ -212,9 +251,9 @@ body.installing-additional-functionality ol.task-list {
#commerce-kickstart-inline-help .advanced-help-topic {
background: #fef2c4;
border: 1px solid #efb120;
-moz-box-shadow: inset 0 0 10px white;
-webkit-box-shadow: inset 0 0 10px white;
box-shadow: inset 0 0 10px white;
-moz-box-shadow: inset 0 0 10px #fff;
-webkit-box-shadow: inset 0 0 10px #fff;
box-shadow: inset 0 0 10px #fff;
margin-bottom: 30px;
padding: 15px;
}
......
......@@ -154,6 +154,48 @@ body.in-maintenance {
.form-item-extras label[for=edit-extras] {
clear: both;
}
/* Welcome Page Styles */
#edit-submit.form-disabled {
opacity: .5;
cursor: auto;
}
#install-welcome > div > p {
margin-top: 0;
}
#eula-installation-welcome {
background: #f4f4f4;
border: 1px solid #edebeb;
padding: 0 20px 10px;
font-size: .9em;
line-height: 1.5em;
ul {
margin-bottom: 20px;
li {
margin-bottom: 10px;
}
}
.form-item-eula-accept label.option {
line-height: 2em;
}
}
/* DFP Styles */
#progress {
margin-bottom: 50px;
}
#dfp-wrapper {
background: transparent url("../images/install-dfp-message.png") no-repeat 0 45px;
min-height: 250px;
}
.dfp-install-ad {
background: transparent url("../images/dfp-offline.png") no-repeat center center;
box-shadow: 0 0 1px #333;
float: right;
height: 250px;
width: 300px;
}
}
body.installing-demo-store ol.task-list,
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>" lang="<?php print $language->language ?>" dir="<?php print $language->dir ?>">
<!DOCTYPE html>
<html lang="<?php print $language->language ?>" dir="<?php print $language->dir ?>">
<head>
<title><?php print $head_title; ?></title>
<?php print $head; ?>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment