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
|
||||
*/
|
||||
// We disable with $conf->global->MAIN_FEATURES_LEVEL because until dev is finished.
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL == 2 && $conf->use_javascript_ajax && $object->statut == 0)
|
||||
$result = $object->getLinesArray();
|
||||
|
||||
if ($conf->use_javascript_ajax && $object->statut == 0)
|
||||
{
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php');
|
||||
}
|
||||
|
||||
print '<table id="objectline" class="noborder" width="100%">';
|
||||
|
||||
$result = $object->getLinesArray();
|
||||
print '<table id="tablelines" class="noborder" width="100%">';
|
||||
|
||||
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))
|
||||
{
|
||||
$object->print_title_list();
|
||||
$object->printLinesList(0,$mysoc,$soc);
|
||||
}
|
||||
if (!empty($object->lines))
|
||||
{
|
||||
$object->print_title_list();
|
||||
$object->printLinesList(0,$mysoc,$soc);
|
||||
}
|
||||
|
||||
/*
|
||||
* Form to add new line
|
||||
|
||||
@ -1422,7 +1422,7 @@ class CommonObject
|
||||
function printLine($line,$var=true,$num=0,$i=0,$dateSelector=0,$seller,$buyer)
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
global $html,$bc;
|
||||
global $html,$bc,$bcdd;
|
||||
|
||||
$element = $this->element;
|
||||
if ($element == 'propal') $element = 'propale'; // To work with non standard path
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -19,27 +20,36 @@
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
|
||||
<?php if ($_GET['action'] != 'editline') { ?>
|
||||
<!-- BEGIN PHP TEMPLATE FOR JQUERY -->
|
||||
<?php if (count($object->lines) > 1 && $_GET['action'] != 'editline') { ?>
|
||||
<script>
|
||||
jQuery(document).ready(function(){
|
||||
jQuery(".imgup").hide();
|
||||
jQuery(".imgdown").hide();
|
||||
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) {
|
||||
var roworder = cleanSerialize(jQuery("#objectline").tableDnDSerialize());
|
||||
var element = "<?php echo $object->table_element_line; ?>";
|
||||
jQuery.get("<?php echo DOL_URL_ROOT; ?>/core/ajaxrow.php?roworder="+roworder+"&element="+element);
|
||||
},
|
||||
var roworder = cleanSerialize(jQuery("#tablelines").tableDnDSerialize());
|
||||
var element = "<?php echo $object->table_element_line; ?>";
|
||||
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"
|
||||
});
|
||||
jQuery(".tdlineupdown").hover(function() {
|
||||
jQuery(this).addClass('showDragHandle');
|
||||
}, function() {
|
||||
jQuery(this).removeClass('showDragHandle');
|
||||
});
|
||||
jQuery(".tdlineupdown").hover(
|
||||
function() { jQuery(this).addClass('showDragHandle'); },
|
||||
function() { jQuery(this).removeClass('showDragHandle'); }
|
||||
);
|
||||
});
|
||||
</script>
|
||||
<?php } else { ?>
|
||||
@ -51,5 +61,4 @@ jQuery(document).ready(function(){
|
||||
});
|
||||
</script>
|
||||
<?php } ?>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
@ -1,5 +1,6 @@
|
||||
<?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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -24,7 +25,6 @@
|
||||
// TODO à déplacer
|
||||
if ($conf->global->PRODUIT_USE_MARKUP) $colspan = 'colspan="2"';
|
||||
?>
|
||||
|
||||
<tr class="liste_titre nodrag nodrop">
|
||||
<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>
|
||||
@ -80,5 +80,4 @@ if ($conf->global->PRODUIT_USE_MARKUP) $colspan = 'colspan="2"';
|
||||
<?php } ?>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- END PHP TEMPLATE freeproductline_create.tpl.php -->
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -20,7 +21,6 @@
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE freeproductline_edit.tpl.php -->
|
||||
|
||||
<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="action" value="updateligne">
|
||||
@ -77,5 +77,4 @@
|
||||
<?php } ?>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- END PHP TEMPLATE freeproductline_edit.tpl.php -->
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -20,8 +21,7 @@
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE freeproductline_view.tpl.php -->
|
||||
|
||||
<tr <?php echo 'id="row-'.$line->id.'" '.$bc[$var]; ?>>
|
||||
<tr <?php echo 'id="row-'.$line->id.'" '.$bcdd[$var]; ?>>
|
||||
<td><a name="<?php echo $line->rowid; ?>"></a>
|
||||
<?php if (($line->info_bits & 2) == 2) { ?>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/comm/remx.php?id='.$this->socid; ?>">
|
||||
@ -99,11 +99,12 @@
|
||||
</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<?php } else { ?>
|
||||
<td align="center" class="tdlineupdown"> </td>
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<td colspan="3"> </td>
|
||||
<?php } ?>
|
||||
|
||||
</tr>
|
||||
|
||||
<!-- END PHP TEMPLATE freeproductline_view.tpl.php -->
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -20,7 +21,6 @@
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE predefinedproductline_create.tpl.php -->
|
||||
|
||||
<?php
|
||||
if ($conf->global->PRODUIT_USE_MARKUP)
|
||||
$colspan = 'colspan="4"';
|
||||
@ -87,5 +87,4 @@ $colspan = 'colspan="3"';
|
||||
<?php } ?>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- END PHP TEMPLATE predefinedproductline_create.tpl.php -->
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -20,7 +21,6 @@
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE predefinedproductline_edit.tpl.php -->
|
||||
|
||||
<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="action" value="updateligne">
|
||||
@ -86,5 +86,4 @@
|
||||
<?php } ?>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- END PHP TEMPLATE predefinedproductline_edit.tpl.php -->
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -20,8 +21,7 @@
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE predefinedproductline_view.tpl.php -->
|
||||
|
||||
<tr <?php echo 'id="row-'.$line->id.'" '.$bc[$var]; ?>>
|
||||
<tr <?php echo 'id="row-'.$line->id.'" '.$bcdd[$var]; ?>>
|
||||
<td>
|
||||
<a name="<?php echo $line->id; ?>"></a>
|
||||
<?php
|
||||
@ -88,11 +88,12 @@
|
||||
</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<?php } else { ?>
|
||||
<td align="center" class="tdlineupdown"> </td>
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<td colspan="3"> </td>
|
||||
<?php } ?>
|
||||
|
||||
</tr>
|
||||
|
||||
<!-- END PHP TEMPLATE predefinedproductline_view.tpl.php -->
|
||||
|
||||
@ -700,6 +700,7 @@ if (! defined('NOREQUIRETRAN'))
|
||||
|
||||
// Define some constants used for style of arrays
|
||||
$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"');
|
||||
|
||||
// Constants used to defined number of lines in textarea
|
||||
|
||||
@ -154,16 +154,15 @@ form {
|
||||
margin: 0em 0em 0em 0em;
|
||||
}
|
||||
|
||||
/* For dragging lines */
|
||||
|
||||
.dragClass {
|
||||
background: #b3c5cc;
|
||||
color: #002255;
|
||||
}
|
||||
td.showDragHandle {
|
||||
cursor: move;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
|
||||
|
||||
@ -155,16 +155,16 @@ form {
|
||||
margin: 0em 0em 0em 0em;
|
||||
}
|
||||
|
||||
|
||||
/* For dragging lines */
|
||||
|
||||
.dragClass {
|
||||
background: #b3c5cc;
|
||||
color: #002255;
|
||||
}
|
||||
td.showDragHandle {
|
||||
cursor: move;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
|
||||
|
||||
@ -154,16 +154,15 @@ form
|
||||
margin: 0px 0px 0px 0px;
|
||||
}
|
||||
|
||||
/* For dragging lines */
|
||||
|
||||
.dragClass {
|
||||
background: #b3c5cc;
|
||||
color: #002255;
|
||||
}
|
||||
td.showDragHandle {
|
||||
cursor: move;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
|
||||
|
||||
@ -142,16 +142,15 @@ form
|
||||
margin: 0em 0em 0em 0em;
|
||||
}
|
||||
|
||||
/* For dragging lines */
|
||||
|
||||
.dragClass {
|
||||
background: #b3c5cc;
|
||||
color: #002244;
|
||||
}
|
||||
td.showDragHandle {
|
||||
cursor: move;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user