New: Use ajax to change order of lines.
This commit is contained in:
parent
e1acc4cf72
commit
cfe7215288
@ -1367,15 +1367,14 @@ if ($id > 0 || ! empty($ref))
|
|||||||
/*
|
/*
|
||||||
* Lines
|
* Lines
|
||||||
*/
|
*/
|
||||||
// We disable with $conf->global->MAIN_FEATURES_LEVEL because until dev is finished.
|
$result = $object->getLinesArray();
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL == 2 && $conf->use_javascript_ajax && $object->statut == 0)
|
|
||||||
|
if ($conf->use_javascript_ajax && $object->statut == 0)
|
||||||
{
|
{
|
||||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php');
|
include(DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<table id="objectline" class="noborder" width="100%">';
|
print '<table id="tablelines" class="noborder" width="100%">';
|
||||||
|
|
||||||
$result = $object->getLinesArray();
|
|
||||||
|
|
||||||
if (!empty($object->lines))
|
if (!empty($object->lines))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2647,18 +2647,22 @@ else
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Inoice lines
|
* Lines
|
||||||
*/
|
*/
|
||||||
|
$result = $object->getLinesArray();
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
if ($conf->use_javascript_ajax && $object->statut == 0)
|
||||||
|
{
|
||||||
|
include(DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php');
|
||||||
|
}
|
||||||
|
|
||||||
$result = $object->getLinesArray();
|
print '<table id="tablelines" class="noborder" width="100%">';
|
||||||
|
|
||||||
if (!empty($object->lines))
|
if (!empty($object->lines))
|
||||||
{
|
{
|
||||||
$object->print_title_list();
|
$object->print_title_list();
|
||||||
$object->printLinesList(0,$mysoc,$soc);
|
$object->printLinesList(0,$mysoc,$soc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Form to add new line
|
* Form to add new line
|
||||||
|
|||||||
@ -1422,7 +1422,7 @@ class CommonObject
|
|||||||
function printLine($line,$var=true,$num=0,$i=0,$dateSelector=0,$seller,$buyer)
|
function printLine($line,$var=true,$num=0,$i=0,$dateSelector=0,$seller,$buyer)
|
||||||
{
|
{
|
||||||
global $conf,$langs,$user;
|
global $conf,$langs,$user;
|
||||||
global $html,$bc;
|
global $html,$bc,$bcdd;
|
||||||
|
|
||||||
$element = $this->element;
|
$element = $this->element;
|
||||||
if ($element == 'propal') $element = 'propale'; // To work with non standard path
|
if ($element == 'propal') $element = 'propale'; // To work with non standard path
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -19,27 +20,36 @@
|
|||||||
*/
|
*/
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE -->
|
<!-- BEGIN PHP TEMPLATE FOR JQUERY -->
|
||||||
|
<?php if (count($object->lines) > 1 && $_GET['action'] != 'editline') { ?>
|
||||||
<?php if ($_GET['action'] != 'editline') { ?>
|
|
||||||
<script>
|
<script>
|
||||||
jQuery(document).ready(function(){
|
jQuery(document).ready(function(){
|
||||||
jQuery(".imgup").hide();
|
jQuery(".imgup").hide();
|
||||||
jQuery(".imgdown").hide();
|
jQuery(".imgdown").hide();
|
||||||
jQuery(".lineupdown").removeAttr('href');
|
jQuery(".lineupdown").removeAttr('href');
|
||||||
jQuery("#objectline").tableDnD({
|
jQuery(".tdlineupdown").css("background-image",'url(<?php echo DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/grip.png'; ?>)');
|
||||||
|
jQuery(".tdlineupdown").css("background-repeat","no-repeat");
|
||||||
|
jQuery(".tdlineupdown").css("background-position","center center");
|
||||||
|
|
||||||
|
jQuery("#tablelines").tableDnD({
|
||||||
onDrop: function(table, row) {
|
onDrop: function(table, row) {
|
||||||
var roworder = cleanSerialize(jQuery("#objectline").tableDnDSerialize());
|
var roworder = cleanSerialize(jQuery("#tablelines").tableDnDSerialize());
|
||||||
var element = "<?php echo $object->table_element_line; ?>";
|
var element = "<?php echo $object->table_element_line; ?>";
|
||||||
jQuery.get("<?php echo DOL_URL_ROOT; ?>/core/ajaxrow.php?roworder="+roworder+"&element="+element);
|
jQuery.get("<?php echo DOL_URL_ROOT; ?>/core/ajaxrow.php?roworder="+roworder+"&element="+element);
|
||||||
},
|
jQuery("#tablelines .drag").each(
|
||||||
|
function( intIndex ){
|
||||||
|
jQuery(this).removeClass("pair impair");
|
||||||
|
if (intIndex % 2 == 0) jQuery(this).addClass('impair');
|
||||||
|
if (intIndex % 2 == 1) jQuery(this).addClass('pair');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onDragClass: "dragClass",
|
||||||
dragHandle: "tdlineupdown"
|
dragHandle: "tdlineupdown"
|
||||||
});
|
});
|
||||||
jQuery(".tdlineupdown").hover(function() {
|
jQuery(".tdlineupdown").hover(
|
||||||
jQuery(this).addClass('showDragHandle');
|
function() { jQuery(this).addClass('showDragHandle'); },
|
||||||
}, function() {
|
function() { jQuery(this).removeClass('showDragHandle'); }
|
||||||
jQuery(this).removeClass('showDragHandle');
|
);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
@ -51,5 +61,4 @@ jQuery(document).ready(function(){
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<!-- END PHP TEMPLATE -->
|
<!-- END PHP TEMPLATE -->
|
||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -24,7 +25,6 @@
|
|||||||
// TODO à déplacer
|
// TODO à déplacer
|
||||||
if ($conf->global->PRODUIT_USE_MARKUP) $colspan = 'colspan="2"';
|
if ($conf->global->PRODUIT_USE_MARKUP) $colspan = 'colspan="2"';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<tr class="liste_titre nodrag nodrop">
|
<tr class="liste_titre nodrag nodrop">
|
||||||
<td <?php echo $colspan; ?>><a name="add"></a><?php echo $langs->trans('AddNewLine').' - '.$langs->trans("FreeZone"); ?></td>
|
<td <?php echo $colspan; ?>><a name="add"></a><?php echo $langs->trans('AddNewLine').' - '.$langs->trans("FreeZone"); ?></td>
|
||||||
<td align="right"><?php echo $langs->trans('VAT'); ?></td>
|
<td align="right"><?php echo $langs->trans('VAT'); ?></td>
|
||||||
@ -80,5 +80,4 @@ if ($conf->global->PRODUIT_USE_MARKUP) $colspan = 'colspan="2"';
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<!-- END PHP TEMPLATE freeproductline_create.tpl.php -->
|
<!-- END PHP TEMPLATE freeproductline_create.tpl.php -->
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -20,7 +21,6 @@
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE freeproductline_edit.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE freeproductline_edit.tpl.php -->
|
||||||
|
|
||||||
<form action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'#'.$line->id; ?>" method="POST">
|
<form action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'#'.$line->id; ?>" method="POST">
|
||||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||||
<input type="hidden" name="action" value="updateligne">
|
<input type="hidden" name="action" value="updateligne">
|
||||||
@ -77,5 +77,4 @@
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<!-- END PHP TEMPLATE freeproductline_edit.tpl.php -->
|
<!-- END PHP TEMPLATE freeproductline_edit.tpl.php -->
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -20,8 +21,7 @@
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE freeproductline_view.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE freeproductline_view.tpl.php -->
|
||||||
|
<tr <?php echo 'id="row-'.$line->id.'" '.$bcdd[$var]; ?>>
|
||||||
<tr <?php echo 'id="row-'.$line->id.'" '.$bc[$var]; ?>>
|
|
||||||
<td><a name="<?php echo $line->rowid; ?>"></a>
|
<td><a name="<?php echo $line->rowid; ?>"></a>
|
||||||
<?php if (($line->info_bits & 2) == 2) { ?>
|
<?php if (($line->info_bits & 2) == 2) { ?>
|
||||||
<a href="<?php echo DOL_URL_ROOT.'/comm/remx.php?id='.$this->socid; ?>">
|
<a href="<?php echo DOL_URL_ROOT.'/comm/remx.php?id='.$this->socid; ?>">
|
||||||
@ -99,11 +99,12 @@
|
|||||||
</a>
|
</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</td>
|
</td>
|
||||||
|
<?php } else { ?>
|
||||||
|
<td align="center" class="tdlineupdown"> </td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<td colspan="3"> </td>
|
<td colspan="3"> </td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<!-- END PHP TEMPLATE freeproductline_view.tpl.php -->
|
<!-- END PHP TEMPLATE freeproductline_view.tpl.php -->
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -20,7 +21,6 @@
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE predefinedproductline_create.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE predefinedproductline_create.tpl.php -->
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ($conf->global->PRODUIT_USE_MARKUP)
|
if ($conf->global->PRODUIT_USE_MARKUP)
|
||||||
$colspan = 'colspan="4"';
|
$colspan = 'colspan="4"';
|
||||||
@ -87,5 +87,4 @@ $colspan = 'colspan="3"';
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<!-- END PHP TEMPLATE predefinedproductline_create.tpl.php -->
|
<!-- END PHP TEMPLATE predefinedproductline_create.tpl.php -->
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -20,7 +21,6 @@
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE predefinedproductline_edit.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE predefinedproductline_edit.tpl.php -->
|
||||||
|
|
||||||
<form action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'#'.$line->id; ?>" method="POST">
|
<form action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'#'.$line->id; ?>" method="POST">
|
||||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||||
<input type="hidden" name="action" value="updateligne">
|
<input type="hidden" name="action" value="updateligne">
|
||||||
@ -86,5 +86,4 @@
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<!-- END PHP TEMPLATE predefinedproductline_edit.tpl.php -->
|
<!-- END PHP TEMPLATE predefinedproductline_edit.tpl.php -->
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -20,8 +21,7 @@
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE predefinedproductline_view.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE predefinedproductline_view.tpl.php -->
|
||||||
|
<tr <?php echo 'id="row-'.$line->id.'" '.$bcdd[$var]; ?>>
|
||||||
<tr <?php echo 'id="row-'.$line->id.'" '.$bc[$var]; ?>>
|
|
||||||
<td>
|
<td>
|
||||||
<a name="<?php echo $line->id; ?>"></a>
|
<a name="<?php echo $line->id; ?>"></a>
|
||||||
<?php
|
<?php
|
||||||
@ -88,11 +88,12 @@
|
|||||||
</a>
|
</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</td>
|
</td>
|
||||||
|
<?php } else { ?>
|
||||||
|
<td align="center" class="tdlineupdown"> </td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<td colspan="3"> </td>
|
<td colspan="3"> </td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<!-- END PHP TEMPLATE predefinedproductline_view.tpl.php -->
|
<!-- END PHP TEMPLATE predefinedproductline_view.tpl.php -->
|
||||||
|
|||||||
@ -700,6 +700,7 @@ if (! defined('NOREQUIRETRAN'))
|
|||||||
|
|
||||||
// Define some constants used for style of arrays
|
// Define some constants used for style of arrays
|
||||||
$bc=array(0=>'class="impair"',1=>'class="pair"');
|
$bc=array(0=>'class="impair"',1=>'class="pair"');
|
||||||
|
$bcdd=array(0=>'class="impair drag drop"',1=>'class="pair drag drop"');
|
||||||
$bcnd=array(0=>'class="impair nodrag nodrop"',1=>'class="pair nodrag nodrop"');
|
$bcnd=array(0=>'class="impair nodrag nodrop"',1=>'class="pair nodrag nodrop"');
|
||||||
|
|
||||||
// Constants used to defined number of lines in textarea
|
// Constants used to defined number of lines in textarea
|
||||||
|
|||||||
@ -154,16 +154,15 @@ form {
|
|||||||
margin: 0em 0em 0em 0em;
|
margin: 0em 0em 0em 0em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* For dragging lines */
|
||||||
|
|
||||||
.dragClass {
|
.dragClass {
|
||||||
background: #b3c5cc;
|
color: #002255;
|
||||||
}
|
}
|
||||||
td.showDragHandle {
|
td.showDragHandle {
|
||||||
cursor: move;
|
cursor: move;
|
||||||
}
|
}
|
||||||
.tdlineupdown {
|
.tdlineupdown {
|
||||||
background-image: url(<?php echo DOL_URL_ROOT.'/theme/eldy/img/grip.png'; ?>);
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-position: center center;
|
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -155,16 +155,16 @@ form {
|
|||||||
margin: 0em 0em 0em 0em;
|
margin: 0em 0em 0em 0em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* For dragging lines */
|
||||||
|
|
||||||
.dragClass {
|
.dragClass {
|
||||||
background: #b3c5cc;
|
color: #002255;
|
||||||
}
|
}
|
||||||
td.showDragHandle {
|
td.showDragHandle {
|
||||||
cursor: move;
|
cursor: move;
|
||||||
}
|
}
|
||||||
.tdlineupdown {
|
.tdlineupdown {
|
||||||
background-image: url(<?php echo DOL_URL_ROOT.'/theme/eldy/img/grip.png'; ?>);
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-position: center center;
|
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -154,16 +154,15 @@ form
|
|||||||
margin: 0px 0px 0px 0px;
|
margin: 0px 0px 0px 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* For dragging lines */
|
||||||
|
|
||||||
.dragClass {
|
.dragClass {
|
||||||
background: #b3c5cc;
|
color: #002255;
|
||||||
}
|
}
|
||||||
td.showDragHandle {
|
td.showDragHandle {
|
||||||
cursor: move;
|
cursor: move;
|
||||||
}
|
}
|
||||||
.tdlineupdown {
|
.tdlineupdown {
|
||||||
background-image: url(<?php echo DOL_URL_ROOT.'/theme/eldy/img/grip.png'; ?>);
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-position: center center;
|
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -142,16 +142,15 @@ form
|
|||||||
margin: 0em 0em 0em 0em;
|
margin: 0em 0em 0em 0em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* For dragging lines */
|
||||||
|
|
||||||
.dragClass {
|
.dragClass {
|
||||||
background: #b3c5cc;
|
color: #002244;
|
||||||
}
|
}
|
||||||
td.showDragHandle {
|
td.showDragHandle {
|
||||||
cursor: move;
|
cursor: move;
|
||||||
}
|
}
|
||||||
.tdlineupdown {
|
.tdlineupdown {
|
||||||
background-image: url(<?php echo DOL_URL_ROOT.'/theme/eldy/img/grip.png'; ?>);
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-position: center center;
|
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user