// MERGE with 1.4 r7770

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7776 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-07-28 09:20:57 +00:00
parent df255f66c1
commit a875fecb20
968 changed files with 26082 additions and 3937 deletions
+3 -2
View File
@@ -30,8 +30,9 @@ function linkEdition(linkId)
getE('url').value = links[linkId][0];
getE('newWindow').checked = links[linkId][1];
var beg = parseInt(getE('languageFirst').value);
for (var i = 0; i <= parseInt(getE('languageNb').value - 1); i++)
for (var i = 0; i <= parseInt(getE('languageNb').value - 1); i++) {
getE('textInput_'+ (beg + i)).value = links[linkId][i + 2];
}
getE('submitLinkUpdate').disabled = '';
getE('submitLinkUpdate').setAttribute('class', 'button');
/* ##### IE */
@@ -41,4 +42,4 @@ function linkEdition(linkId)
function linkDeletion(linkId)
{
document.location.replace(currentUrl+'&id='+linkId+'&token='+token);
}
}
+15 -14
View File
@@ -37,8 +37,9 @@ class BlockLink extends Module
{
$this->name = 'blocklink';
$this->tab = 'front_office_features';
$this->version = '1.4';
$this->version = '1.5';
$this->author = 'PrestaShop';
$this->need_instance = 0;
parent::__construct();
@@ -53,17 +54,17 @@ class BlockLink extends Module
!$this->registerHook('leftColumn') OR
!Db::getInstance()->Execute('
CREATE TABLE '._DB_PREFIX_.'blocklink (
`id_link` int(2) NOT NULL AUTO_INCREMENT,
`id_blocklink` int(2) NOT NULL AUTO_INCREMENT,
`url` varchar(255) NOT NULL,
`new_window` TINYINT(1) NOT NULL,
PRIMARY KEY(`id_link`))
PRIMARY KEY(`id_blocklink`))
ENGINE='._MYSQL_ENGINE_.' default CHARSET=utf8') OR
!Db::getInstance()->Execute('
CREATE TABLE '._DB_PREFIX_.'blocklink_lang (
`id_link` int(2) NOT NULL,
`id_blocklink` int(2) NOT NULL,
`id_lang` int(2) NOT NULL,
`text` varchar(64) NOT NULL,
PRIMARY KEY(`id_link`, `id_lang`))
PRIMARY KEY(`id_blocklink`, `id_lang`))
ENGINE='._MYSQL_ENGINE_.' default CHARSET=utf8') OR
!Configuration::updateValue('PS_BLOCKLINK_TITLE', array('1' => 'Block link', '2' => 'Bloc lien')))
return false;
@@ -106,16 +107,16 @@ class BlockLink extends Module
{
$result = array();
/* Get id and url */
if (!$links = Db::getInstance()->ExecuteS('SELECT `id_link`, `url`, `new_window` FROM '._DB_PREFIX_.'blocklink'.((int)(Configuration::get('PS_BLOCKLINK_ORDERWAY')) == 1 ? ' ORDER BY `id_link` DESC' : '')))
if (!$links = Db::getInstance()->ExecuteS('SELECT `id_blocklink`, `url`, `new_window` FROM '._DB_PREFIX_.'blocklink'.((int)(Configuration::get('PS_BLOCKLINK_ORDERWAY')) == 1 ? ' ORDER BY `id_blocklink` DESC' : '')))
return false;
$i = 0;
foreach ($links AS $link)
{
$result[$i]['id'] = $link['id_link'];
$result[$i]['id'] = $link['id_blocklink'];
$result[$i]['url'] = $link['url'];
$result[$i]['newWindow'] = $link['new_window'];
/* Get multilingual text */
if (!$texts = Db::getInstance()->ExecuteS('SELECT `id_lang`, `text` FROM '._DB_PREFIX_.'blocklink_lang WHERE `id_link`='.(int)($link['id_link'])))
if (!$texts = Db::getInstance()->ExecuteS('SELECT `id_lang`, `text` FROM '._DB_PREFIX_.'blocklink_lang WHERE `id_blocklink`='.(int)($link['id_blocklink'])))
return false;
foreach ($texts AS $text)
$result[$i]['text_'.$text['id_lang']] = $text['text'];
@@ -149,14 +150,14 @@ class BlockLink extends Module
public function updateLink()
{
/* Url registration */
if (!Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'blocklink SET `url`=\''.pSQL($_POST['url']).'\', `new_window`='.(isset($_POST['newWindow']) ? 1 : 0).' WHERE `id_link`='.(int)($_POST['id'])))
if (!Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'blocklink SET `url`=\''.pSQL($_POST['url']).'\', `new_window`='.(isset($_POST['newWindow']) ? 1 : 0).' WHERE `id_blocklink`='.(int)($_POST['id'])))
return false;
/* Multilingual text */
$languages = Language::getLanguages();
$defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
if (!$languages)
return false;
if (!Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'blocklink_lang WHERE `id_link` = '.(int)($_POST['id'])))
if (!Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'blocklink_lang WHERE `id_blocklink` = '.(int)($_POST['id'])))
return false ;
foreach ($languages AS $language)
if (!empty($_POST['text_'.$language['id_lang']]))
@@ -172,7 +173,7 @@ class BlockLink extends Module
public function deleteLink()
{
return Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'blocklink WHERE `id_link`='.(int)($_GET['id']));
return Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'blocklink WHERE `id_blocklink`='.(int)($_GET['id']));
}
public function updateTitle()
@@ -241,7 +242,7 @@ class BlockLink extends Module
}
if (isset($_POST['submitOrderWay']))
{
if (Configuration::updateValue('PS_BLOCKLINK_ORDERWAY', (int)(Tools::getValue('orderWay'))))
if (Configuration::updateValue('PS_BLOCKLINK_ORDERWAY', (int)Tools::getValue('orderWay')))
$this->_html .= $this->displayConfirmation($this->l('Sort order updated'));
else
$this->_html .= $this->displayError($this->l('An error occurred during sort order set-up.'));
@@ -281,13 +282,13 @@ class BlockLink extends Module
<div class="clear"></div>
</div>
<label>'.$this->l('URL:').'</label>
<div class="margin-form"><input type="text" name="url" id="url" value="'.(($this->error AND isset($_POST['url'])) ? $_POST['url'] : '').'" /></div>
<div class="margin-form"><input type="text" name="url" id="url" value="'.(($this->error AND isset($_POST['url'])) ? $_POST['url'] : '').'" /><sup> *</sup></div>
<label>'.$this->l('Open in a new window:').'</label>
<div class="margin-form"><input type="checkbox" name="newWindow" id="newWindow" '.(($this->error AND isset($_POST['newWindow'])) ? 'checked="checked"' : '').' /></div>
<div class="margin-form">
<input type="hidden" name="id" id="id" value="'.($this->error AND isset($_POST['id']) ? $_POST['id'] : '').'" />
<input type="submit" class="button" name="submitLinkAdd" value="'.$this->l('Add this link').'" />
<input type="submit" class="button disable" name="submitLinkUpdate" value="'.$this->l('Edit this link').'" disabled="disbaled" id="submitLinkUpdate" />
<input type="submit" class="button disable" name="submitLinkUpdate" value="'.$this->l('Edit this link').'" disabled="disabled" id="submitLinkUpdate" />
</div>
</form>
</fieldset>
+2
View File
@@ -35,7 +35,9 @@
</h4>
<ul class="block_content bullet">
{foreach from=$blocklink_links item=blocklink_link}
{if isset($blocklink_link.$lang)}
<li><a href="{$blocklink_link.url|htmlentities}"{if $blocklink_link.newWindow} onclick="window.open(this.href);return false;"{/if}>{$blocklink_link.$lang}</a></li>
{/if}
{/foreach}
</ul>
</div>
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>blocklink</name>
<displayName><![CDATA[Link block]]></displayName>
<version><![CDATA[1.4]]></version>
<version><![CDATA[1.5]]></version>
<description><![CDATA[Adds a block with additional links.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab>
-2
View File
@@ -39,5 +39,3 @@ $_MODULE['<{blocklink}prestashop>blocklink_9dffbf69ffba8bc38bc4e01abf4b1675'] =
$_MODULE['<{blocklink}prestashop>blocklink_e6b391a8d2c4d45902a23a8b6585703d'] = 'URL';
$_MODULE['<{blocklink}prestashop>blocklink_06df33001c1d7187fdd81ea1f5b277aa'] = 'Handlungen';
$_MODULE['<{blocklink}prestashop>blocklink_cad0a4e92b29bcb1ff1fc4f8524cfdc2'] = 'Es sind noch keine Links vorhanden';
?>
+36
View File
@@ -0,0 +1,36 @@
<?php
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* 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@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;