From cfe721528890b3504e46916fbcc160749d38a924 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Oct 2010 20:47:55 +0000 Subject: [PATCH] New: Use ajax to change order of lines. --- htdocs/comm/propal.php | 9 ++--- htdocs/compta/facture.php | 20 ++++++---- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/tpl/ajaxrow.tpl.php | 39 ++++++++++++------- .../core/tpl/freeproductline_create.tpl.php | 5 +-- htdocs/core/tpl/freeproductline_edit.tpl.php | 5 +-- htdocs/core/tpl/freeproductline_view.tpl.php | 9 +++-- .../tpl/predefinedproductline_create.tpl.php | 5 +-- .../tpl/predefinedproductline_edit.tpl.php | 5 +-- .../tpl/predefinedproductline_view.tpl.php | 9 +++-- htdocs/main.inc.php | 1 + htdocs/theme/auguria/style.css.php | 7 ++-- htdocs/theme/eldy/style.css.php | 8 ++-- htdocs/theme/freelug/style.css.php | 7 ++-- htdocs/theme/yellow/style.css.php | 7 ++-- 15 files changed, 73 insertions(+), 65 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 366c0a7df07..2d726b2891d 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -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 ''; - - $result = $object->getLinesArray(); + print '
'; if (!empty($object->lines)) { diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 47c38bc5949..9df65cfd7c8 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2647,18 +2647,22 @@ else /* - * Inoice lines + * Lines */ + $result = $object->getLinesArray(); - print '
'; + if ($conf->use_javascript_ajax && $object->statut == 0) + { + include(DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'); + } - $result = $object->getLinesArray(); + print '
'; - 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 diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 266b50e6ac8..88e86d5129a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -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 diff --git a/htdocs/core/tpl/ajaxrow.tpl.php b/htdocs/core/tpl/ajaxrow.tpl.php index 14333f3320a..2976d05627f 100644 --- a/htdocs/core/tpl/ajaxrow.tpl.php +++ b/htdocs/core/tpl/ajaxrow.tpl.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2010 Regis Houssin + * Copyright (C) 2010 Laurent Destailleur * * 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 @@ */ ?> - - - + +lines) > 1 && $_GET['action'] != 'editline') { ?> @@ -51,5 +61,4 @@ jQuery(document).ready(function(){ }); - \ No newline at end of file diff --git a/htdocs/core/tpl/freeproductline_create.tpl.php b/htdocs/core/tpl/freeproductline_create.tpl.php index 3cc4f00ba8b..e82c986664a 100644 --- a/htdocs/core/tpl/freeproductline_create.tpl.php +++ b/htdocs/core/tpl/freeproductline_create.tpl.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2010 Regis Houssin + * Copyright (C) 2010 Laurent Destailleur * * 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"'; ?> - @@ -80,5 +80,4 @@ if ($conf->global->PRODUIT_USE_MARKUP) $colspan = 'colspan="2"'; - diff --git a/htdocs/core/tpl/freeproductline_edit.tpl.php b/htdocs/core/tpl/freeproductline_edit.tpl.php index 48a061ea4d0..94301e53f57 100644 --- a/htdocs/core/tpl/freeproductline_edit.tpl.php +++ b/htdocs/core/tpl/freeproductline_edit.tpl.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2010 Regis Houssin + * Copyright (C) 2010 Laurent Destailleur * * 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 @@ ?> -
id; ?>" method="POST"> @@ -77,5 +77,4 @@ - diff --git a/htdocs/core/tpl/freeproductline_view.tpl.php b/htdocs/core/tpl/freeproductline_view.tpl.php index b1b44ffe06b..d561f46b101 100644 --- a/htdocs/core/tpl/freeproductline_view.tpl.php +++ b/htdocs/core/tpl/freeproductline_view.tpl.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2010 Regis Houssin + * Copyright (C) 2010 Laurent Destailleur * * 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 @@ ?> - -
> +> + + - diff --git a/htdocs/core/tpl/predefinedproductline_create.tpl.php b/htdocs/core/tpl/predefinedproductline_create.tpl.php index 40556c106a6..80a9cbe92a2 100644 --- a/htdocs/core/tpl/predefinedproductline_create.tpl.php +++ b/htdocs/core/tpl/predefinedproductline_create.tpl.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2010 Regis Houssin + * Copyright (C) 2010 Laurent Destailleur * * 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 @@ ?> - global->PRODUIT_USE_MARKUP) $colspan = 'colspan="4"'; @@ -87,5 +87,4 @@ $colspan = 'colspan="3"'; - diff --git a/htdocs/core/tpl/predefinedproductline_edit.tpl.php b/htdocs/core/tpl/predefinedproductline_edit.tpl.php index 3e559073998..5e5dc526faf 100644 --- a/htdocs/core/tpl/predefinedproductline_edit.tpl.php +++ b/htdocs/core/tpl/predefinedproductline_edit.tpl.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2010 Regis Houssin + * Copyright (C) 2010 Laurent Destailleur * * 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 @@ ?> -
id; ?>" method="POST"> @@ -86,5 +86,4 @@ - diff --git a/htdocs/core/tpl/predefinedproductline_view.tpl.php b/htdocs/core/tpl/predefinedproductline_view.tpl.php index 009b0d1b129..6dce97bacec 100644 --- a/htdocs/core/tpl/predefinedproductline_view.tpl.php +++ b/htdocs/core/tpl/predefinedproductline_view.tpl.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2010 Regis Houssin + * Copyright (C) 2010 Laurent Destailleur * * 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 @@ ?> - -
> +> + + - diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 797603e578c..01f3d01ecd9 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.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 diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php index 4dbe3b74659..8bc3059fec9 100644 --- a/htdocs/theme/auguria/style.css.php +++ b/htdocs/theme/auguria/style.css.php @@ -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(); - background-repeat: no-repeat; - background-position: center center; white-space: nowrap; } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 06f82e74a7f..894a18e3964 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -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(); - background-repeat: no-repeat; - background-position: center center; white-space: nowrap; } diff --git a/htdocs/theme/freelug/style.css.php b/htdocs/theme/freelug/style.css.php index 0ee13b6aa81..ec38b777ce9 100644 --- a/htdocs/theme/freelug/style.css.php +++ b/htdocs/theme/freelug/style.css.php @@ -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(); - background-repeat: no-repeat; - background-position: center center; white-space: nowrap; } diff --git a/htdocs/theme/yellow/style.css.php b/htdocs/theme/yellow/style.css.php index 0eee163239f..9d791ae2044 100644 --- a/htdocs/theme/yellow/style.css.php +++ b/htdocs/theme/yellow/style.css.php @@ -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(); - background-repeat: no-repeat; - background-position: center center; white-space: nowrap; }
>trans('AddNewLine').' - '.$langs->trans("FreeZone"); ?> trans('VAT'); ?>
info_bits & 2) == 2) { ?> @@ -99,11 +99,12 @@