diff --git a/install-dev/controllers/http/configure.php b/install-dev/controllers/http/configure.php index 7ffd38861..2aff04ca3 100644 --- a/install-dev/controllers/http/configure.php +++ b/install-dev/controllers/http/configure.php @@ -26,7 +26,7 @@ */ /** - * Step 4 : configure the shop, admin access and modules preactivations + * Step 4 : configure the shop and admin access */ class InstallControllerHttpConfigure extends InstallControllerHttp { @@ -54,18 +54,6 @@ class InstallControllerHttpConfigure extends InstallControllerHttp if (!$this->session->admin_password_confirm || trim(Tools::getValue('admin_password_confirm'))) $this->session->admin_password_confirm = trim(Tools::getValue('admin_password_confirm')); - - // Save partners preactivation configuration - $this->session->partners = array(); - $partners = Tools::getValue('partner'); - if (is_array($partners)) - { - // Check all selected partners and store their fields - $session_partners = array(); - foreach ($partners as $partner_id => $state) - $session_partners[$partner_id] = (isset($_POST['partner_fields'][$partner_id])) ? $_POST['partner_fields'][$partner_id] : array(); - $this->session->partners = $session_partners; - } } /** @@ -94,7 +82,7 @@ class InstallControllerHttpConfigure extends InstallControllerHttp if ($this->session->admin_password) { if (!Validate::isPasswdAdmin($this->session->admin_password)) - $this->errors['admin_password'] = $this->l('The password is incorrect (alphanumeric string at least 8 characters)'); + $this->errors['admin_password'] = $this->l('The password is incorrect (alphanumeric string with at least 8 characters)'); else if ($this->session->admin_password != $this->session->admin_password_confirm) $this->errors['admin_password'] = $this->l('Password and its confirmation are different'); } @@ -112,10 +100,6 @@ class InstallControllerHttpConfigure extends InstallControllerHttp $this->processUploadLogo(); else if (Tools::getValue('timezoneByIso')) $this->processTimezoneByIso(); - else if (Tools::getValue('getPartners')) - $this->processGetPartners(); - else if (Tools::getValue('getPartnersFields')) - $this->processGetPartnersFields(); } /** @@ -189,7 +173,7 @@ class InstallControllerHttpConfigure extends InstallControllerHttp { imagecopyresampled($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); if (!is_writable(_PS_ROOT_DIR_.'/img/logo.jpg')) - $error = $this->l('Image folder is not writable'); + $error = $this->l('Image folder %s is not writable', _PS_ROOT_DIR_.'/img/'); else if (!imagejpeg($thumb, _PS_ROOT_DIR_.'/img/logo.jpg', 90)) $error = $this->l('Cannot upload the file'); } @@ -209,149 +193,6 @@ class InstallControllerHttpConfigure extends InstallControllerHttp $this->ajaxJsonAnswer(($timezone) ? true : false, $timezone); } - /** - * Obtain a translation from presintall XML file - * - * @param SimplexmlElement $xml - * @param string $xpath - * @return string - */ - public function getPreinstallXmlLang(SimplexmlElement $xml, $xpath) - { - $lang = $this->language->getLanguageIso(); - $translation = $xml->xpath($xpath.'[@iso="'.$lang.'"]'); - if (!$translation && $lang != 'en') - $translation = $xml->xpath($xpath.'[@iso="en"]'); - if (!$translation) - $translation = $xml->xpath($xpath); - return ($translation) ? (string)$translation[0] : ''; - } - - /** - * Get list of partners from PrestaShop website - */ - public function processGetPartners() - { - $this->iso = Tools::getValue('iso'); - if (!$this->iso) - $this->ajaxJsonAnswer(false); - - // Load partners XML file from prestashop.com - $stream_context = @stream_context_create(array('http' => array('method'=> 'GET', 'timeout' => 3))); - $content = @file_get_contents('http://api.prestashop.com/partner/preactivation/partners.php?version=1.1', false, $stream_context); - if (!$xml = @simplexml_load_string($content)) - $this->ajaxJsonAnswer(false, $this->l('Cannot load partners from PrestaShop website')); - - // Browse all partners - $partners = array(); - foreach ($xml->partner as $partner) - { - // Partner available for current language ? - if (!$partner->xpath('countries[country="'.$this->iso.'"]')) - continue; - - $partner_id = (string)$partner->key; - if (!isset($this->session->shop_name)) - $checked = ($partner->prechecked) ? true : false; - else - $checked = (isset($this->session->partners[$partner_id])) ? true : false; - - $partners[$partner_id] = array( - 'name' => (string)$partner->name, - 'label' => $this->getPreinstallXmlLang($partner, 'labels/label'), - 'description' => $this->getPreinstallXmlLang($partner, 'descriptions/description'), - 'logo' => $partner->logo_medium, - 'checked' => $checked, - ); - } - - // If no partners, don't displayany preactivation HTML - if (!$partners) - $this->ajaxJsonAnswer(false); - - // Render partners - $this->partners = $partners; - $html = $this->displayTemplate('partners', true); - $this->ajaxJsonAnswer(true, $html); - } - - /** - * Get fields of a partner for a country as HTML - */ - public function processGetPartnersFields() - { - $this->partner_id = Tools::getValue('partner_id'); - $this->iso = Tools::getValue('iso'); - if (!$this->partner_id || !$this->iso) - $this->ajaxJsonAnswer(false); - - $this->fields = $this->getPartnersFields($this->partner_id, $this->iso); - - if (!$this->fields) - $this->ajaxJsonAnswer(false); - - // Render fields - $html = $this->displayTemplate('partners_fields', true); - $this->ajaxJsonAnswer(true, $html); - } - - /** - * Get list of fields of a partner for a country - * - * @param string $partner_id - * @param string $iso - * @return array - */ - public function getPartnersFields($partner_id, $iso) - { - // Load partners fields XML file from prestashop.com - $stream_context = @stream_context_create(array('http' => array('method' => 'GET', 'timeout' => 5))); - $content = @file_get_contents('http://api.prestashop.com/partner/preactivation/fields.php?version=1.1&partner='.$partner_id.'&country_iso_code='.$iso, false, $stream_context); - if (!$xml = @simplexml_load_string($content)) - $this->ajaxJsonAnswer(false, $this->l('Cannot load partners fields from PrestaShop website')); - - // Browse all fields - $fields = array(); - foreach ($xml->field as $field) - { - $key = (string)$field->key; - $data = array( - 'type' => (string)$field->type, - 'label' => $this->getPreinstallXmlLang($field, 'labels/label'), - 'help' => $this->getPreinstallXmlLang($field, 'helps/help'), - 'value' => (isset($this->session->partners[$partner_id][$key])) ? $this->session->partners[$partner_id][$key] : (string)$field->default, - ); - - switch ($data['type']) - { - case 'text' : - case 'password' : - $data['size'] = (string)$field->size; - break; - - case 'radio' : - case 'select' : - $data['list'] = array(); - foreach ($field->values as $value) - $data['list'][(string)$value->value] = $this->getPreinstallXmlLang($value, 'labels/label'); - break; - - case 'date' : - if (!is_array($data['value'])) - $data['value'] = array( - 'year' => 0, - 'month' => 0, - 'day' => 0, - ); - break; - } - - $fields[$key] = $data; - } - - return $fields; - } - /** * Get list of timezones * diff --git a/install-dev/controllers/http/process.php b/install-dev/controllers/http/process.php index dfb0126a4..ed6cd2b72 100644 --- a/install-dev/controllers/http/process.php +++ b/install-dev/controllers/http/process.php @@ -242,31 +242,6 @@ class InstallControllerHttpProcess extends InstallControllerHttp $this->ajaxJsonAnswer(true); } - /** - * PROCESS : preactivation - * (currently not used) - */ - public function processPreactivation() - { - foreach ($this->session->partners as $partner => $data) - { - /*$stream_context = @stream_context_create(array('http' => array('method'=> 'GET', 'timeout' => 5))); - $url = 'http://api.prestashop.com/partner/preactivation/actions.php?version=1.0&partner='.addslashes($_GET['partner']); - - // Protect fields - foreach ($_GET as $key => $value) - $_GET[$key] = strip_tags(str_replace(array('\'', '"'), '', trim($value))); - - // Encore Get, Send It and Get Answers - @require_once('../config/settings.inc.php'); - foreach ($_GET as $key => $val) - $url .= '&'.$key.'='.urlencode($val); - $url .= '&security='.md5($_GET['email']._COOKIE_IV_);*/ - } - - $this->ajaxJsonAnswer(true); - } - /** * @see InstallAbstractModel::display() */ diff --git a/install-dev/theme/js/configure.js b/install-dev/theme/js/configure.js index 93068add1..f61869575 100644 --- a/install-dev/theme/js/configure.js +++ b/install-dev/theme/js/configure.js @@ -20,13 +20,7 @@ $(document).ready(function() $('#infosTimezone').val(json.message); } }); - - // Load associated partners - //load_partners(iso); }); - - //if (default_iso) - // load_partners(default_iso); }); /** @@ -66,60 +60,3 @@ function upload_logo() } }); }; - -/** - * Load partners for a given country - * - * @param string iso - */ -function load_partners(iso) -{ - $.ajax({ - url: 'index.php', - data: 'getPartners=true&iso='+iso, - dataType: 'json', - cache: false, - success: function(json) - { - if (json.success) - { - // Display partner HTML - $('#benefitsBlock').html(json.message).show(); - - // Add event on partner checkbox to display fields if it's checked - $('.preinstall_partner').click(function() - { - var name = $(this).attr('name'); - var partner_id = name.substr(8, name.length - 9); - - if ($(this).attr('checked')) - load_partner_fields(partner_id, iso); - else - $('#partner_fields_'+partner_id).html('').hide(); - }); - } - else - $('#benefitsBlock').html(''); - } - }); -} - -/** - * Display partner fields - * - * @param string partner_id Key of partner - */ -function load_partner_fields(partner_id, iso) -{ - $.ajax({ - url: 'index.php', - data: 'getPartnersFields=true&partner_id='+partner_id+'&iso='+iso, - dataType: 'json', - cache: false, - success: function(json) - { - if (json.success) - $('#partner_fields_'+partner_id).html(json.message).show(); - } - }); -} \ No newline at end of file diff --git a/install-dev/theme/preactivation.css b/install-dev/theme/preactivation.css deleted file mode 100644 index 10cccd0ed..000000000 --- a/install-dev/theme/preactivation.css +++ /dev/null @@ -1,52 +0,0 @@ -@CHARSET "UTF-8"; - -.moduleTable { - padding: 5px; - width: 650px; - border: 1px solid #CCC; - border-bottom:none; -} - .moduleTable tr { - border-bottom: 1px solid #CCC; - } - .moduleTable th { - font-size:13; - color:#000; - text-shadow:0 1px 0 #fff; - background:#cfcfcf url(img/bg_moduleTable_th.png) repeat-x 0 0; - } - .moduleTable .field { - padding:10px 0; - border-bottom:none; - } - .moduleTable .field label { - display:inline-block; - padding-left:10px; - width:180px;/* 190 */ - } - .moduleTable .field label.radiolabel {width:auto;} - .moduleTable .field div.contentinput { - display:inline-block; - width:245px; - font-size: 11px; - font-style:italic; - color:#999; - } - - .moduleTable select { - border: 1px solid #D41958; - } - - .moduleTable select.pa_list { - width: 175px; - } - - .moduleTable select.pa_list_year { - margin-right: 10px; - width: 60px !important; - } - - .moduleTable select.pa_list_month, .moduleTable select.pa_list_day { - margin-right: 10px; - width: 45px !important; - } \ No newline at end of file diff --git a/install-dev/theme/views/header.phtml b/install-dev/theme/views/header.phtml index db82d1dea..3b9103e39 100644 --- a/install-dev/theme/views/header.phtml +++ b/install-dev/theme/views/header.phtml @@ -11,7 +11,6 @@ - diff --git a/install-dev/theme/views/partners.phtml b/install-dev/theme/views/partners.phtml deleted file mode 100644 index f91fd3b30..000000000 --- a/install-dev/theme/views/partners.phtml +++ /dev/null @@ -1,39 +0,0 @@ -

l('Additional Benefits') ?>

-

- - - - - - -
l('Modules') ?>l('Benefits') ?>
- -partners as $partner_id => $partner): ?> - - - - - - - - - -
- - checked="checked" /> - - - <?php echo $partner['name'] ?> - - -
-
- fields = $this->getPartnersFields($partner_id, $this->iso); - $this->partner_id = $partner_id; - $this->displayTemplate('partners_fields'); - } ?> -
-
- \ No newline at end of file diff --git a/install-dev/theme/views/partners_fields.phtml b/install-dev/theme/views/partners_fields.phtml deleted file mode 100644 index ac7f3f643..000000000 --- a/install-dev/theme/views/partners_fields.phtml +++ /dev/null @@ -1,59 +0,0 @@ -


- -fields as $field_id => $field): ?> -
- - - - size="" - /> - - $label): ?> - - checked="checked" - /> - - - - - - - - - - - - - - -
-
-
- \ No newline at end of file