// norms on AdminProductController

// bugfix addfeaturestodb custom values
// uses of smartyV3 features (createTemplate, createData) in AdminProducts + admin products forms now extends base form.tpl
[+] BO : now tiny_mce can be loaded 'onclick' instead of 'onload'
// improvement in adminproduct pages

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10040 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mMarinetti
2011-11-10 14:57:54 +00:00
parent 874a67141f
commit 9963c84fd9
13 changed files with 1626 additions and 1367 deletions
+23 -16
View File
@@ -56,32 +56,39 @@
<script type="text/javascript">
$(document).ready(function(){
var placeholder = $(".toolbar-placeholder");
var message = $('.toolbarHead');
var view = $(window);
// bind only if placeholder exists
if (placeholder.length)
// bind only if message exists. placeholder will be its parent
view.bind("scroll resize", function(e)
{
if(e.type == 'resize')
message.css('width', message.width());
message.each(function(el){
var placeholderTop = placeholder.offset().top;
var viewTop = view.scrollTop() + 15;
if ((viewTop > placeholderTop) && !message.hasClass("fix-toolbar"))
if (message.length)
{
message.css('width', message.width());
message.addClass("fix-toolbar");
}
else if ( (viewTop <= placeholderTop) && message.hasClass("fix-toolbar"))
{
message.css('width', 'auto');
message.removeClass("fix-toolbar");
placeholder = $(this).parent();
if(e.type == 'resize')
$(this).css('width', $(this).width());
placeholderTop = placeholder.offset().top;
var viewTop = view.scrollTop() + 15;
// POUET
// CECI EST UN TEST
if ((viewTop > placeholderTop) && !$(this).hasClass("fix-toolbar"))
{
$(this).css('width', $(this).width());
$(this).addClass("fix-toolbar");
}
else if ( (viewTop <= placeholderTop) && $(this).hasClass("fix-toolbar"))
{
//$(this).css('width', 'auto');
$(this).removeClass("fix-toolbar");
}
}
});
});
});
</script>
</body>
</html>
+33 -6
View File
@@ -27,19 +27,23 @@
{if $firstCall}
<script type="text/javascript">
var vat_number = {$vat_number};
var module_dir = '{$module_dir}';
var module_dir = '{$smarty.const._MODULE_DIR_}';
var id_language = {$defaultFormLanguage};
var languages = new Array();
$(document).ready(function() {
{foreach $languages as $k => $language}
languages[{$k}] = {
id_lang: {$language.id_lang},
iso_code: '{$language.iso_code}',
name: '{$language.name}'
name: '{$language.name}',
is_default: "{$language.is_default}"
};
{/foreach}
displayFlags(languages, id_language, {$allowEmployeeFormLang});
// we need allowEmployeeFormLang var in ajax request
allowEmployeeFormLang = {$allowEmployeeFormLang};
displayFlags(languages, id_language, allowEmployeeFormLang);
{if isset($fields_value.id_state)}
if ($('#id_country') && $('#id_state'))
@@ -78,10 +82,10 @@
</div>
</div>
{/if}
<div class="leadin">{block name="leadin"}{/block}</div>
{if isset($fields.title)}<h2>{$fields.title}</h2>{/if}
{block name="defaultForm"}
<form id="{$table}_form" class="defaultForm" action="{$current}&{$submit_action}=1&token={$token}" method="post" enctype="multipart/form-data">
{if $form_id}
<input type="hidden" name="id_{$table}" id="id_{$table}" value="{$form_id}" />
@@ -210,7 +214,7 @@
<div class="translatable">
{foreach $languages as $language}
<div class="lang_{$language.id_lang}" id="{$input.name}_{$language.id_lang}" style="display:{if $language.id_lang == $defaultFormLanguage}block{else}none{/if}; float: left;">
<textarea cols="{$input.cols}" rows="{$input.rows}" name="{$input.name}_{$language.id_lang}">{$fields_value[$input.name][$language.id_lang]}</textarea>
<textarea cols="{$input.cols}" rows="{$input.rows}" name="{$input.name}_{$language.id_lang}" {if $input.autoload_rte}class="autoload_rte"{/if} >{$fields_value[$input.name][$language.id_lang]}</textarea>
</div>
{/foreach}
</div>
@@ -334,8 +338,31 @@
var ad = '{$ad}';
</script>
<script type="text/javascript" src="../js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="'../js/tinymce.inc.js"></script>
<script type="text/javascript" src="../js/tinymce.inc.js"></script>
{/if}
</fieldset>
{block name="other_fieldsets"}{/block}
</form>
{/block}
<script type="text/javascript">
$(document).ready(function(){
$(document).ready(function(){
tinySetup();
});
{block name="autoload_tinyMCE"}
$(".autoload_rte").click(function(e){
tinySetup({
mode :"exact",
editor_selector :"autoload_rte",
elements : $(this).attr("id"),
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull|cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,undo,redo",
theme_advanced_buttons2 : "link,unlink,anchor,image,cleanup,code,|,forecolor,backcolor,|,hr,removeformat,visualaid,|,charmap,media,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
});
})
{/block}
});
</script>
+264
View File
@@ -0,0 +1,264 @@
{*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{extends file="helper/form/form.tpl"}
{block name="script"}</script>
<link href="../css/fileuploader.css" rel="stylesheet" type="text/css">
<script src="../js/fileuploader.js" type="text/javascript"></script>
<script src="../js/jquery/ui/jquery.ui.core.min.js" type="text/javascript"></script>
<script src="../js/jquery/ui/jquery.ui.widget.min.js" type="text/javascript"></script>
<script src="../js/jquery/ui/jquery.ui.progressbar.min.js" type="text/javascript"></script>
<script type="text/javascript" src="../js/admin.js"></script>
<script type="text/javascript">
{/block}
{block name="defaultForm"}
<div>
<div class="productTabs">
<ul class="tab">
{foreach $product_tabs key=numStep item=tab}
<li class="tab-row">
<a class="tab-page {if $tab.selected}selected{/if}" id="link-{$tab.id}" href="{$tab.href}">{$tab.name}</a>{*todo href when nojs*}
</li>
{/foreach}
</ul>
</div>
</div>
<script type="text/javascript">
var toload = new Array();
var pos_select = {$pos_select};
$(document).ready(function(){
{* submenu binding *}
$(".tab-page").click(function(e){
e.preventDefault();
// currentId is the current producttab id
currentId = $(".productTabs a.selected").attr('id').substr(5);
// id is the wanted producttab id
id = $(this).attr('id').substr(5);
if ($(this).attr("id") != $(".productTabs a.selected").attr('id'))
{
$(".tab-page").removeClass('selected');
$("#product-tab-content-"+currentId).hide();
}
else
{
if (confirm(' {l s='Do you really want to reload the current tab (all modifications will be lost)'}'))
$("#product-tab-content-"+currentId).html();
else
return false;
}
$("#product-tab-content-wait").show();
if ($("#product-tab-content-"+id).hasClass('not-loaded') || $(this).hasClass('selected'))
{
myurl = $(this).attr("href")+"&ajax=1";
$.ajax({
url : myurl,
async : true,
success :function(data)
{
$("#product-tab-content-wait").hide();
$("#product-tab-content-"+id).html(data);
$("#product-tab-content-"+id).removeClass('not-loaded');
$("#product-tab-content-"+id).show();
$("#link-"+id).addClass('selected');
}
});
}
else
{
$("#product-tab-content-"+id).show();
$("#link-"+id).addClass('selected');
}
var languages = new Array();
if (id == 3)
populate_attrs();
if (id == 7)
{
$("#addAttachment").click(function() {
return !$("#selectAttachment1 option:selected").remove().appendTo("#selectAttachment2");
});
$("#removeAttachment").click(function() {
return !$("#selectAttachment2 option:selected").remove().appendTo("#selectAttachment1");
});
$("#product").submit(function() {
$("#selectAttachment1 option").each(function(i) {
$(this).attr("selected", "selected");
});
});
}
});
});
</script>
{***********************************************}
{********** TO CHECK !!!!!!!!!!!!!!! ***********}
<script type="text/javascript">
// <![CDATA[
ThickboxI18nImage = "{l s='Image'}";
ThickboxI18nOf = "{l s='of'}";
ThickboxI18nClose = "{l s='Close'}";
ThickboxI18nOrEscKey = "{l s='(or "Esc")'}";
ThickboxI18nNext = "{l s='Next >'}";
ThickboxI18nPrev = "{l s='< Previous'}";
tb_pathToImage = "../img/loadingAnimation.gif";
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
function toggleVirtualProduct(elt)
{
$("#is_virtual_file_product").hide();
$("#virtual_good_attributes").hide();
if (elt.checked)
{
$('#virtual_good').show('slow');
$('#virtual_good_more').show('slow');
getE('out_of_stock_1').checked = 'checked';
getE('out_of_stock_2').disabled = 'disabled';
getE('out_of_stock_3').disabled = 'disabled';
getE('label_out_of_stock_2').setAttribute('for', '');
getE('label_out_of_stock_3').setAttribute('for', '');
}
else
{
$('#virtual_good').hide('slow');
$('#virtual_good_more').hide('slow');
getE('out_of_stock_2').disabled = false;
getE('out_of_stock_3').disabled = false;
getE('label_out_of_stock_2').setAttribute('for', 'out_of_stock_2');
getE('label_out_of_stock_3').setAttribute('for', 'out_of_stock_3');
}
}
function uploadFile()
{
$.ajaxFileUpload (
{
url:'./uploadProductFile.php',
secureuri:false,
fileElementId:'virtual_product_file',
dataType: 'xml',
success: function (data, status)
{
data = data.getElementsByTagName('return')[0];
var result = data.getAttribute("result");
var msg = data.getAttribute("msg");
var fileName = data.getAttribute("filename")
if(result == "error")
$("#upload-confirmation").html('<p>error: ' + msg + '</p>');
else
{
$('#virtual_product_file').remove();
$('#virtual_product_file_label').hide();
$('#file_missing').hide();
$('#delete_downloadable_product').show();
$('#virtual_product_name').attr('value', fileName);
$('#upload-confirmation').html(
'<a class="link" href="get-file-admin.php?file='+msg+'&filename='+fileName+'">{l s='The file'}&nbsp;"' + fileName + '"&nbsp;{l s='has successfully been uploaded'}</a>' +
'<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="' + msg + '" />');
}
}
}
);
}
function uploadFile2()
{
var link = '';
$.ajaxFileUpload (
{
url:'./uploadProductFileAttribute.php',
secureuri:false,
fileElementId:'virtual_product_file_attribute',
dataType: 'xml',
success: function (data, status)
{
data = data.getElementsByTagName('return')[0];
var result = data.getAttribute("result");
var msg = data.getAttribute("msg");
var fileName = data.getAttribute("filename");
if(result == "error")
$("#upload-confirmation2").html('<p>error: ' + msg + '</p>');
else
{
$('#virtual_product_file_attribute').remove();
$('#virtual_product_file_label').hide();
$('#file_missing').hide();
$('#delete_downloadable_product_attribute').show();
$('#virtual_product_name_attribute').attr('value', fileName);
$('#upload-confirmation2').html(
'<a class="link" href="get-file-admin.php?file='+msg+'&filename='+fileName+'">{l s='The file'}&nbsp;"' + fileName + '"&nbsp;{l s='has successfully been uploaded'}</a>' +
'<input type="hidden" id="virtual_product_filename_attribute" name="virtual_product_filename_attribute" value="' + msg + '" />');
link = $("#delete_downloadable_product_attribute").attr('href');
$("#delete_downloadable_product_attribute").attr('href', link+"&file="+msg);
}
}
}
);
}
//]]>
</script>
<form id="product" action="{$form_action}" method="post" enctype="multipart/form-data" name="product">
<input type="hidden" name="id_product" value="{$id_product}" />
<input type="hidden" name="tabs" id="tabs" value="0" />
<div class="tab-pane" id="tabPane1">
{if !$product->active}
<div class="warn draft" >
<p>
<span style="float: left">
<img src="../img/admin/warn2.png" />{l s='Your product will be saved as draft'}</span>
<span style="float:right"><a href="#" class="button" style="display: block" onclick="submitAddProductAndPreview()" >{l s='Save and preview'}</a></span>
<input type="hidden" name="fakeSubmitAddProductAndPreview" id="fakeSubmitAddProductAndPreview" />
<br />
</p>
</div>
{/if}
{* all input are here *}
<div id="product-tab-content-wait" style="display:none" >{l s='loading ...'}</div>
{if !$newproduct}
{foreach $product_tabs key=numStep item=tab}
<div id="product-tab-content-{$tab.id}" class="{if !$tab.selected}not-loaded{/if} product-tab-content" {if !$tab.selected}style="display:none"{/if}>
{if $tab.selected}{$custom_form}{/if}
</div>
{/foreach}
{else}
<div id="product-tab-content-1" class="product-tab-content">{$custom_form}</div>
{/if}
</div>
<input type="hidden" name="id_product_attribute" id="id_product_attribute" value="0" />
</form>
</div>
<br/>
{/block}
{*a href="{$link->getAdminLink('AdminCatalog')}"><img src="../img/admin/arrow2.gif" />{l s='Back to list'}</a><br/>
*}
+112 -21
View File
@@ -1,25 +1,26 @@
<div class="tab-page" id="step2">
<h4 class="tab" >2. {l s='Images'} (<span id="countImage">{$countImages}</span>)</h4>
<table cellpadding="5">
<h4 class="tab" >2. {l s='Images'} (<span id="countImage">{$countImages}</span>)</h4>
<table cellpadding="5">
<tr>
<td><b>{if isset($id_image)}{l s='Edit this product image'}{else}{l s='Add a new image to this product'}{/if}</b></td>
</tr>
</table>
<div class="separation"></div><br />
<table cellpadding="5" style="width:100%">
<tr>
<td class="col-left"><label>{l s='File:'}</label></td>
<td style="padding-bottom:5px;">
<div id="file-uploader">
<noscript>
<p>{l s='Please enable JavaScript to use file uploader:'}</p>
</noscript>
</div>
<div id="progressBarImage" class="progressBarImage"></div>
<div id="showCounter" style="display:none;"><span id="imageUpload">0</span><span id="imageTotal">0</span></div>
<ul id="listImage"></ul>
<script type="text/javascript">var upbutton = "{l s='Upload a file'}"; </script>
<script type="text/javascript">
</table>
<div class="separation"></div><br />
<table cellpadding="5" style="width:100%">
<tr>
<td class="col-left"><label>{l s='File:'}</label></td>
<td style="padding-bottom:5px;">
<div id="file-uploader">
<noscript>
<p>{l s='Please enable JavaScript to use file uploader:'}</p>
</noscript>
</div>
<div id="progressBarImage" class="progressBarImage"></div>
<div id="showCounter" style="display:none;"><span id="imageUpload">0</span><span id="imageTotal">0</span></div>
<ul id="listImage"></ul>
<script type="text/javascript">var upbutton = "{l s='Upload a file'}"; </script>
{firebug value=$product}
<script type="text/javascript">
function deleteImg(id)
{
var conf = confirm("{l s='Are you sure?'}");
@@ -29,7 +30,7 @@
{
action: "deleteImage",
id_image:id,
id_product : "{$id_product}",
id_product : "{$product->id}",
id_category : "{$id_category_default}",
token : "{$token}",
tab : "AdminProducts",
@@ -120,11 +121,101 @@
},
onSubmit: function(id, filename){
$("#imageTable").show();
$("#listImage").append("<li id=\'img"+id+"\'><div class=\"float\" >" + filename + "</div></div><a style=\"margin-left:10px;\" href=\"javascript:delQueue(" + id +");\"><img src=\"../img/admin/disabled.gif\" alt=\"\" border=\"0\"></a><p class=\"errorImg\"></p></li>");
$("#listImage").append("<li id='img"+id+"'><div class=\"float\" >" + filename + "</div></div><a style=\"margin-left:10px;\" href=\"javascript:delQueue(" + id +");\"><img src=\"../img/admin/disabled.gif\" alt=\"\" border=\"0\"></a><p class=\"errorImg\"></p></li>");
},
});
});
</script>
{$content}
<p class="float" style="clear: both;">
{l s='Format:'} JPG, GIF, PNG. {l s='Filesize:'} {$max_image_size / 1000}{l s='Kb max.'}
</p>
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center;">
<input type="hidden" name="resizer" value="auto" />
{if Tools::getValue('id_image')}<input type="hidden" name="id_image" value="{Tools::getValue('id_image')}" />{/if}
</td>
</tr>
<tr><td colspan="2" style="padding-bottom:10px;"><div class="separation"></div></td></tr>
<tr>
<td colspan="2">
<script type="text/javascript">
var token = '{$token}';
var come_from = '{$table}';
var alternate = '{if $_orderWay == 'DESC'}1{else}0{/if};
</script>
<table cellspacing="0" cellpadding="0" class="table tableDnD" id="imageTable">
<thead>
<tr>
<th style="width: 100px;">{l s='Image'}</th>
<th>&nbsp;</th>
<th>{l s='Position'}</th>
{if $shops}
<script type="text/javascript">
$(document).ready(function() {
$('.image_shop').change(function() {
$.post("ajax-tab.php",
{
updateProductImageShopAsso: 1,
id_image:$(this).attr("name"),
id_shop: $(this).val(),
active:$(this).attr("checked"),
id_product : "{$product->id}",
id_category : "{$product->id_category_default}",
token : "{$token}",
tab : "AdminProducts",
updateproduct : 1,
});
});
});
</script>
{foreach from=$shops item=shop}
<th>{$shop.name}</th>
{/foreach}
{/if}
<th>{l s='Cover'}</th>
<th>{l s='Action'}</th>
</tr></thead>
{foreach from=$images item=image}
<tr id="tr_{$image->id}">
<td style="padding: 4px;">
<a href="{$smarty.const._THEME_PROD_DIR_}{$image->getExistingImgPath()}.jpg" target="_blank">
<img src="{$smarty.const._THEME_PROD_DIR_}{$image->getExistingImgPath()}-small.jpg{if isset($smarty.post.image_updated) && $smarty.post.image_updated == $image->id}?date={time()}{/if}"
alt="{$image->id} - {$image->legend|htmlentitiesUTF8}" title="{$image->id} - {$image->legend|htmlentitiesUTF8}" />
</a>
</td>
<td class="center positionImage">{$image->position}</td>
<td id="td_{$image->id}" class="pointer dragHandle center">
<a {if $image->position}style="display: none;"{/if} href="{$currentIndex}&amp;id_image={$image->id_image}&amp;imgPosition={$image->position -1}&amp;imgDirection=0&amp;token={$token}">
<img src="../img/admin/up.gif" alt="" border="0">
</a>
<a {if $image->position} == $imagesTotal} style="display: none;"{/if} href="{$currentIndex}&amp;id_image={$image->id_image}&amp;imgPosition={$image->position+1}&amp;imgDirection=1&amp;token={$token}">
<img src="../img/admin/down.gif" alt="" border="0">
</a>
</td>
{foreach from=$shops item=shop}
<td class="center">
<input type="checkbox" class="image_shop" name="{$image->id_image}" value="{$shop.id_shop}" {if $image->isAssociatedToShop($shop.id_shop)}checked="checked"{/if} />
</td>
{/foreach}
<td class="center"><a href="{$currentIndex}&amp;id_image={$image->id_image}&amp;coverImage&amp;token={$token}">
<img class="covered" src="../img/admin/{if $image->cover}enabled.gif{else}forbbiden.gif{/if}" alt="e" /></a>
</td>
<td class="center">
<a href="#" onclick="deleteImg('{$image->id_image}');">
<img src="../img/admin/delete.gif" alt="{l s='Delete this image'}" title="{l s='Delete this image'}" />
</a>
</td>
</tr>
{/foreach}
</table>
</td>
</tr>
</table>
</div>
@@ -92,7 +92,7 @@
<div class="lang_{$language.id_lang}" style="{if !$language.is_default}display: none;{/if} float: left;">
<input class="{if !$product->id}copy2friendlyUrl{/if} updateCurrentText" size="43" type="text"
id="name_{$language.id_lang}" name="name_{$language.id_lang}"
value="{$language.name|htmlentitiesUTF8}"/><sup> *</sup>
value="{$product->name[$language.id_lang]|htmlentitiesUTF8|default:''}"/><sup> *</sup>
<span class="hint" name="help_box">{l s='Invalid characters:'} <>;=#{}<span class="hint-pointer">&nbsp;</span>
</span>
</div>
@@ -683,8 +683,287 @@ $(document).ready(function(){
</tr>
{* [end] prices *}
<tr><td colspan="2" style="padding-bottom:5px;"><div class="separation"></div></td></tr>
{if !$ps_stock_management}
<tr>
<td colspan="2">{l s='The stock management is disabled'}</td>
</tr>
{/if}
{if !$has_attribute}
<tr>
<td class="col-left"><label>{l s='Minimum quantity:'}</label></td>
<td style="padding-bottom:5px;">
<input size="3" maxlength="6" name="minimal_quantity" id="minimal_quantity" type="text" value="{$product->minimal_quantity|default:1}" />
<p>{l s='The minimum quantity to buy this product (set to 1 to disable this feature)'}</p>
</td>
</tr>
{/if}
<tr><td colspan="2" style="padding-bottom:5px;"><div class="separation"></div></td></tr>
<tr>
<td class="col-left"><label>{l s='Additional shipping cost:'}</label></td>
<td style="padding-bottom:5px;">{$currency->prefix}<input type="text" name="additional_shipping_cost"
value="{$product->additional_shipping_cost}" />{$currency->suffix}
{if $country_display_tax_label}{l s='tax excl.'}{/if}
<p>{l s='Carrier tax will be applied.'}</p>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='Displayed text when in-stock:'}</label></td>
<td style="padding-bottom:5px;">
{include file="products/input_text_lang.tpl"
languages=$languages
input_value=$product->available_now
input_name='available_now'}
<span class="hint" name="help_box">{l s='Forbidden characters:'} <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='Displayed text when allowed to be back-ordered:'}</label></td>
<td style="padding-bottom:5px;">
{include file="products/input_text_lang.tpl"
languages=$languages
input_value=$product->available_later
input_name='available_later'}
<span class="hint" name="help_box">{l s='Forbidden characters:'} <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
</td>
</tr>
{if $countAttributes}
{* .(($this->getFieldValue($product, 'available_date') != 0) ? stripslashes(htmlentities(Tools::displayDate($this->getFieldValue($product, 'available_date'), $language['id_lang']))) : '0000-00-00').'" *}
<tr>
<td class="col-left"><label>{l s='Available date:'}</label></td>
<td style="padding-bottom:5px;">
<input id="available_date" name="available_date" value="{$product->available_date}" class="datepicker"
style="text-align: center;" type="text" />
<p>{l s='The available date when this product is out of stock'}</p>
</td>
</tr>
{/if}
<script type="text/javascript">
calcPriceTI();
</script>
<tr>
<td class="col-left"><label>{l s='When out of stock:'}</label></td>
<td style="padding-bottom:5px;">
<input type="radio" name="out_of_stock" id="out_of_stock_1" value="0" {if $product->out_of_stock == 0}checked="checked"{/if} />
<label for="out_of_stock_1" class="t" id="label_out_of_stock_1">{l s='Deny orders'}</label>
<br /><input type="radio" name="out_of_stock" id="out_of_stock_2" value="1" {if $product->out_of_stock == 1}checked="checked"{/if} />
<label for="out_of_stock_2" class="t" id="label_out_of_stock_2">{l s='Allow orders'}</label>
<br /><input type="radio" name="out_of_stock" id="out_of_stock_3" value="2" {if $product->out_of_stock == 2}checked="checked"{/if} />
<label for="out_of_stock_3" class="t" id="label_out_of_stock_3">{l s='Default:'}
<i>{if $ps_order_out_of_stock}{l s='Allow orders'}{else}{l s='Deny orders'}{/if}</i> ({l s='as set in'} <a href="{$link->getAdminLink('AdminPPreferences')}"
onclick="return confirm(\'{l s='Are you sure you want to delete entered product information?'}')">{l s='Preferences'}</a>)</label>
</td>
</tr>
<tr>
<td colspan="2" style="padding-bottom:5px;">
<div class="separation"></div>
</td>
</tr>
<tr>
<td class="col-left"><label for="id_category_default" class="t">
{l s='Default category:'}
</label></td>
<td>
<div id="no_default_category" style="color: red;font-weight: bold;display: none;">
{l s='Please check a category in order to select the default category.'}
</div>
<script type="text/javascript">
var post_selected_cat;
post_selected_cat = '{$selected_cat_ids}';
</script>
<select id="id_category_default" name="id_category_default">
{foreach from=$selected_cat item=cat}
<option value="{$cat.id_category}" {if $product->id_category_default == $cat.id_category}selected="selected"{/if} >{$cat.name}</option>
{/foreach}
</select>
</td>
</tr>
<tr><td colspan="2">{$category_tree}</td></tr>
<tr><td colspan="2" style="padding-bottom:5px;"><div class="separation"></div></td></tr>
{************** DESCRIPTION *****************************}
<tr><td colspan="2">
<span onclick="$('#seo').slideToggle();" style="cursor: pointer"><img src="../img/admin/arrow.gif" alt="{l s='SEO'}" title="{l s='SEO'}" style="float:left; margin-right:5px;"/>{l s='Click here to improve product\'s rank in search engines (SEO)'}</span><br />
<div id="seo" style="display: none; padding-top: 15px;">
<table>
<tr>
<td class="col-left"><label>{l s='Meta title:'}</label></td>
<td>
{include file="products/input_text_lang.tpl"
languages=$languages
input_name='meta_title'
input_value=$product->meta_title}
<p class="clear">{l s='Product page title; leave blank to use product name'}</p>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='Meta description:'}</label></td>
<td>
{include file="products/input_text_lang.tpl"
languages=$languages
input_name='meta_description'
input_value=$product->meta_description
input_hint='{l s=\'Forbidden characters:\'\} <>;=#{\}'
}
<p class="clear">{l s='A single sentence for HTML header'}</p>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='Meta keywords:'}</label></td>
<td>
{include file="products/input_text_lang.tpl" languages=$languages
input_value=$product->meta_keywords
input_name='meta_keywords'}
<p class="clear">{l s='Keywords for HTML header, separated by a comma'}</p>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='Friendly URL:'}</label></td>
<td>
{include file="products/input_text_lang.tpl"
languages=$languages
input_value=$product->link_rewrite
input_name='link_rewrite'}
{$content}
<p class="clear" style="padding:10px 0 0 0">
<a style="cursor:pointer" class="button"
onmousedown="updateFriendlyURLByName();">{l s='Generate'}</a>&nbsp;{l s='Friendly-url from product\'s name.'}<br /><br />
{l s='Product link will look like this:'}
{if $ps_ssl_enabled}https://{else}http://{/if}{*$smarty.server.SERVER_NAME*}/<b>id_product</b>-<span id="friendly-url"></span>.html</p>
</td>
</tr>
</td></tr></table>
</div>
</td></tr>
<tr><td colspan="2" style="padding-bottom:5px;"><div class="separation"></div></td></tr>
<tr>
<td class="col-left"><label>{l s='Short description:'}<br /><br /><i>({l s='appears in the product lists and on the top of the product page'})</i></label></td>
<td style="padding-bottom:5px;">
{include file="products/textarea_lang.tpl"
languages=$languages
input_name='description_short'
input_value=$product->description_short}
<p class="clear"></p>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='Description:'}<br /><br /><i>({l s='appears in the body of the product page'})</i></label></td>
<td style="padding-bottom:5px;">
{include file="products/textarea_lang.tpl" languages=$languages
input_name='description'
input_value=$product->description
}
<p class="clear"></p>
</td>
</tr>
{if $images}
<tr>
<td class="col-left"><label></label></td>
<td style="padding-bottom:5px;">
<div style="display:block;width:620px;" class="hint clear">
{l s='Do you want an image associated with the product in your description?'}
<span class="addImageDescription" style="cursor:pointer">{l s='Click here'}</span>.
<table id="createImageDescription" style="display:none;">
<tr>
<td colspan="2" height="10"></td>
</tr>
<tr>
<td class="col-left"><label>{l s='Select your image:'}</label></td>
<td style="padding-bottom:5px;">
<ul>
{foreach from=$images item=image key=key}
<li>
<input type="radio" name="smallImage" id="smallImage_{$key}" value="{$image.id_image}" {if $key == 0}checked="checked"{/if} >
<label for="smallImage_{$key}" class="t">
<img src="{$image.src}" alt="{$image.legend}" />
</label>
</li>
{/foreach}
</ul>
<p class="clear"></p>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='Where to place it?'}</label></td>
<td style="padding-bottom:5px;">
<input type="radio" name="leftRight" id="leftRight_1" value="left" checked>
<label for="leftRight_1" class="t">{l s='left'}</label>
<br />
<input type="radio" name="leftRight" id="leftRight_2" value="right">
<label for="leftRight_2" class="t">{l s='right'}</label>
<p class="clear"></p>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='Select the type of picture:'}</label></td>
<td style="padding-bottom:5px;">
{foreach from=$imagesTypes key=key item=type}
<input type="radio" name="imageTypes" id="imageTypes_{$key}" value="{$type.name}" {if $key == 0}checked="checked"{/if}>
<label for="imageTypes_{$key}" class="t">{$type.name} <span>({$type.width}px par {$type.height}px)</span></label>
<br />
{/foreach}
<p class="clear"></p>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='Image tag to insert:'}</label></td>
<td style="padding-bottom:5px;">
<input type="text" id="resultImage" name="resultImage" />
<p>{l s='The tag is to copy / paste in the description.'}</p>
</td>
</tr>
</table>
</div>
<p class="clear"></p>
</td>
</tr>
<script type="text/javascript">
$(function() {
changeTagImage();
$("#createImageDescription input").change(function(){
changeTagImage();
});
var i = 0;
$(".addImageDescription").click(function(){
if (i == 0){
$("#createImageDescription").animate({
opacity: 1, height: "toggle"
}, 500);
i = 1;
}else{
$("#createImageDescription").animate({
opacity: 0, height: "toggle"
}, 500);
i = 0;
}
});
});
function changeTagImage(){
var smallImage = $("input[name=smallImage]:checked").attr("value");
var leftRight = $("input[name=leftRight]:checked").attr("value");
var imageTypes = $("input[name=imageTypes]:checked").attr("value");
$("#resultImage").val("{img-"+smallImage+"-"+leftRight+"-"+imageTypes+"}");
}
</script>
{/if}
{$last_content}
<script type="text/javascript">
var iso = '{$iso_tiny_mce}';
var pathCSS = '{$smarty.const._THEME_CSS_DIR_}';
var ad = '{$ad}';
</script>
<script type="text/javascript" src="../js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="../js/tinymce.inc.js"></script>
@@ -0,0 +1,10 @@
<div class="translatable">
{foreach from=$languages item=language}
<div class="lang_{$language.id_lang}" style="{if !$language.is_default}display:none;{/if}float: left;">
<input size="30" type="text" id="{$input_name}_{$language.id_lang}"
name="{$input_name}_{$language.id_lang}"
value="{$input_value[$language.id_lang]|htmlentitiesUTF8|default:''}"
/>
</div>
{/foreach}
</div>
+51 -4
View File
@@ -18,8 +18,8 @@ var product_prices = new Array();
&gt;
<select name="sp_id_currency" id="spm_currency_0" onchange="changeCurrencySpecificPrice(0);">
<option value="0">{l s='All currencies'}</option>
{foreach from=$currencies item=currency}
<option value="{$currency['id_currency']}">{$currency['name']|htmlentitiesUTF8}</option>
{foreach from=$currencies item=curr}
<option value="{$curr['id_currency']}">{$curr['name']|htmlentitiesUTF8}</option>
{/foreach}
</select>
&gt;
@@ -66,7 +66,8 @@ var product_prices = new Array();
});
$('.datepicker').datepicker({
prevText: '',
nextText: ''
nextText: '',
dateFormat: 'yy-mm-dd'
});
});
</script>
@@ -76,4 +77,50 @@ var product_prices = new Array();
{l s='(tax excl.):'}
{/if}
</label>
{$content}
<div class="margin-form">
<span id="spm_currency_sign_pre_0" style="font-weight:bold; color:#000000; font-size:12px">{$currency->prefix}</span>
<input type="text" name="sp_price" value="0" size="11" />
<span id="spm_currency_sign_post_0" style="font-weight:bold; color:#000000; font-size:12px">{$currency->suffix}</span>
<span>({l s='Current:'} </span><span id="sp_current_ht_price">'.Tools::displayPrice((float)($product->price), $defaultCurrency).'</span> )</span>
<div class="hint clear" style="display:block;">
{l s='You can set this value at 0 in order to apply the default price'}
</div>
</div>
<label>{l s='Apply a discount of:'}</label>
<div class="margin-form">
<input type="text" name="sp_reduction" value="0.00" size="11" />
<select name="sp_reduction_type">
<option selected="selected">---</option>
<option value="amount">{l s='Amount'}</option>
<option value="percentage">{l s='Percentage'}</option>
</select>
{l s='(if set to "amount", the tax is included)'}
</div>
<div class="margin-form">
<input type="submit" name="submitPriceAddition" value="{l s='Add'}" class="button" />
</div>
</div>
<div class="separation"></div>
<div class="block_specific_prices_modifications">
<h4>{l s='Current specific prices'}</h4>
<table style="text-align: center;width:100%" class="table" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th class="cell border" style="width: 12%;">{l s='Combination'}</th>
<th class="cell border" style="width: 12%;">{l s='Shop'}</th>
<th class="cell border" style="width: 12%;">{l s='Currency'}</th>
<th class="cell border" style="width: 11%;">{l s='Country'}</th>
<th class="cell border" style="width: 13%;">{l s='Group'}</th>
<th class="cell border" style="width: 12%;">{l s='Price'} {if $country_display_tax_label}{l s='(tax excl)'}{/if}</th>
<th class="cell border" style="width: 10%;">{l s='Reduction'}</th>
<th class="cell border" style="width: 15%;">{l s='Period'}</th>
<th class="cell border" style="width: 10%;">{l s='From (quantity)'}</th>
<th class="cell border" style="width: 15%;">{l s='Final price'} {if $country_display_tax_label}{l s='(tax excl.)'}{/if}</th>
<th class="cell border" style="width: 2%;">{l s='Action'}</th>
</tr>
</thead>
<tbody>
{$specificPriceModificationForm}
@@ -0,0 +1,16 @@
<div class="translatable">
{foreach from=$languages item=language}
<div class="lang_{$language.id_lang}" style="{if !$language.is_default}display:none;{/if}float: left;">
<textarea cols="100" rows="10" type="text" id="{$input_name}_{$language.id_lang}"
name="{$input_name}_{$language.id_lang}" class="autoload_rte" />
{$input_value[$language.id_lang]|htmlentitiesUTF8}
</textarea>
<span class="hint" name="help_box">{$hint|default:''}<span class="hint-pointer">&nbsp;</span></span>
</div>
{/foreach}
</div>
<script type="text/javascript">
var iso = '{$iso_tiny_mce}';
var pathCSS = '{$smarty.const._THEME_CSS_DIR_}';
var ad = '{$ad}';
</script>
+7 -50
View File
@@ -832,54 +832,6 @@ class AdminControllerCore extends Controller
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
/**
* Display form
*/
public function displayForm($first_call = true)
{
$content = '';
$content .= $this->initForm();
$allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
if ($allow_employee_form_lang && !$this->context->cookie->employee_form_lang)
$this->context->cookie->employee_form_lang = (int)Configuration::get('PS_LANG_DEFAULT');
$use_lang_from_cookie = false;
$this->_languages = Language::getLanguages(false);
if ($allow_employee_form_lang)
foreach ($this->_languages as $lang)
if ($this->context->cookie->employee_form_lang == $lang['id_lang'])
$use_lang_from_cookie = true;
if (!$use_lang_from_cookie)
$this->_defaultFormLanguage = (int)Configuration::get('PS_LANG_DEFAULT');
else
$this->_defaultFormLanguage = (int)$this->context->cookie->employee_form_lang;
// Only if it is the first call to displayForm, otherwise it has already been defined
if ($first_call)
{
// language related
$content .= '
<script type="text/javascript">
$(document).ready(function() {
id_language = '.$this->_defaultFormLanguage.';
languages = new Array();';
foreach ($this->_languages as $k => $language)
$content .= '
languages['.$k.'] = {
id_lang: '.(int)$language['id_lang'].',
iso_code: \''.$language['iso_code'].'\',
name: \''.htmlentities($language['name'], ENT_COMPAT, 'UTF-8').'\'
};';
$content .= '
displayFlags(languages, id_language, '.$allow_employee_form_lang.');
});
</script>';
}
return $content;
}
/**
* assign default action in toolbar_btn smarty var, if they are not set.
@@ -1384,6 +1336,7 @@ class AdminControllerCore extends Controller
$helper->identifier = $this->identifier;
$helper->override_folder = $this->tpl_folder;
$helper->token = $this->token;
$helper->languages = $this->_languages;
$helper->specificConfirmDelete = $this->specificConfirmDelete;
$helper->imageType = $this->imageType;
$helper->no_link = $this->list_no_link;
@@ -1411,7 +1364,6 @@ class AdminControllerCore extends Controller
$helper = new HelperForm($this);
$helper->override_folder = $this->tpl_folder;
$this->setHelperDisplay($helper);
$helper->languages = $this->_languages;
$helper->default_form_language = $this->default_form_language;
$helper->allow_employee_form_lang = $this->allow_employee_form_lang;
$helper->fields_value = $this->getFieldsValue($this->object);
@@ -1891,6 +1843,11 @@ class AdminControllerCore extends Controller
$this->default_form_language = (int)Configuration::get('PS_LANG_DEFAULT');
else
$this->default_form_language = (int)$cookie->employee_form_lang;
foreach ($this->_languages as $k => $language)
$this->_languages[$k]['is_default'] = (int)($language['id_lang'] == $this->default_form_language);
return $this->_languages;
}
public function getFieldsValue($obj)
@@ -2332,7 +2289,7 @@ EOF;
return false;
// Check image validity
$max_size = isset($this->maxImageSize) ? $this->maxImageSize : 0;
$max_size = isset($this->max_image_size) ? $this->max_image_size : 0;
if ($error = checkImage($_FILES[$name], Tools::getMaxUploadSize($max_size)))
$this->_errors[] = $error;
else if (!$tmp_name = tempnam(_PS_TMP_IMG_DIR_, 'PS') || !move_uploaded_file($_FILES[$name]['tmp_name'], $tmp_name))
+2 -2
View File
@@ -66,10 +66,10 @@ class HelperCore
$this->context = Context::getContext();
}
/*public function setTpl($tpl)
public function setTpl($tpl)
{
$this->tpl = $this->createTemplate($tpl);
}*/
}
/**
* Create a template from the override file, else from the base file.
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -12,7 +12,7 @@
*/
(function(d,C){function M(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._inDialog=this._datepickerShowing=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass=
"ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su",
"Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",
"Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"yy-mm-dd",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",
minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false,disabled:false};d.extend(this._defaults,this.regional[""]);this.dpDiv=N(d('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}function N(a){return a.bind("mouseout",
function(b){b=d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");b.length&&b.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(b){b=d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");if(!(d.datepicker._isDisabledDatepicker(J.inline?a.parent()[0]:J.input[0])||!b.length)){b.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
b.addClass("ui-state-hover");b.hasClass("ui-datepicker-prev")&&b.addClass("ui-datepicker-prev-hover");b.hasClass("ui-datepicker-next")&&b.addClass("ui-datepicker-next-hover")}})}function H(a,b){d.extend(a,b);for(var c in b)if(b[c]==null||b[c]==C)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.16"}});var B=(new Date).getTime(),J;d.extend(M.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},
+15 -1
View File
@@ -1,4 +1,9 @@
tinyMCE.init({
function tinySetup(config)
{
if(!config)
config = {};
default_config = {
mode : "specific_textareas",
theme : "advanced",
skin:"cirkuit",
@@ -25,7 +30,16 @@
convert_urls : false,
language : iso
}
$.each(default_config, function(index, el)
{
if (config[index] === undefined )
config[index] = el;
});
tinyMCE.init(config);
};
function ajaxfilemanager(field_name, url, type, win) {
var ajaxfilemanagerurl = ad+"/ajaxfilemanager/ajaxfilemanager.php";