[*] BO : AdminProducts find smallest images

This commit is contained in:
gRoussac
2013-10-29 08:47:41 +01:00
parent 79cba4b655
commit 0aca1d4a67
5 changed files with 92 additions and 45 deletions
+67 -35
View File
@@ -291,51 +291,83 @@ class Blocktopmenu extends Module
<br/>
<a href="#" id="removeItem" style="border: 1px solid rgb(170, 170, 170); margin: 2px; padding: 2px; text-align: center; display: block; text-decoration: none; background-color: rgb(250, 250, 250); color: rgb(18, 52, 86);">&lt;&lt; '.$this->l('Remove').'</a>
</td>
<td style="vertical-align:top;padding:5px 15px;">
<h4 style="margin-top:5px;">'.$this->l('Change order').':</h4>
<a href="#" id="menuOrderUp" class="button" style="font-size:20px;display:block;">&uarr;</a><br/>
<a href="#" id="menuOrderDown" class="button" style="font-size:20px;display:block;">&darr;</a><br/>
</td>
</tr>
</tbody>
</table>
<div class="clear">&nbsp;</div>
<script type="text/javascript">
function add()
{
$("#availableItems option:selected").each(function(i){
var val = $(this).val();
var text = $(this).text();
text = text.replace(/(^\s*)|(\s*$)/gi,"");
if (val == "PRODUCT")
{
val = prompt("'.$this->l('Set ID product').'");
if (val == null || val == "" || isNaN(val))
return;
text = "'.$this->l('Product ID').' "+val;
val = "PRD"+val;
}
$("#items").append("<option value=\""+val+"\">"+text+"</option>");
});
serialize();
return false;
}
function remove()
{
$("#items option:selected").each(function(i){
$(this).remove();
});
serialize();
return false;
}
function serialize()
{
var options = "";
$("#items option").each(function(i){
options += $(this).val() + ",";
});
$("#itemsInput").val(options.substr(0, options.length - 1));
}
function move(up)
{
var tomove = $("#items option:selected");
if (tomove.length >1)
{
alert(\''.Tools::htmlentitiesUTF8($this->l('Please select just one item')).'\');
return false;
}
if (up)
tomove.prev().insertAfter(tomove);
else
tomove.next().insertBefore(tomove);
serialize();
return false;
}
$(document).ready(function(){
$("#addItem").click(add);
$("#availableItems").dblclick(add);
$("#removeItem").click(remove);
$("#items").dblclick(remove);
function add()
{
$("#availableItems option:selected").each(function(i){
var val = $(this).val();
var text = $(this).text();
text = text.replace(/(^\s*)|(\s*$)/gi,"");
if (val == "PRODUCT")
{
val = prompt("'.$this->l('Set ID product').'");
if (val == null || val == "" || isNaN(val))
return;
text = "'.$this->l('Product ID').' "+val;
val = "PRD"+val;
}
$("#items").append("<option value=\""+val+"\">"+text+"</option>");
});
serialize();
return false;
}
function remove()
{
$("#items option:selected").each(function(i){
$(this).remove();
});
serialize();
return false;
}
function serialize()
{
var options = "";
$("#items option").each(function(i){
options += $(this).val()+",";
});
$("#itemsInput").val(options.substr(0, options.length - 1));
}
$("#menuOrderUp").click(function(e){
e.preventDefault();
move(true);
});
$("#menuOrderDown").click(function(e){
e.preventDefault();
move();
});
});
</script>
<label for="s">'.$this->l('Search Bar').'</label>