From eba07e7e47d39e81a242eee96253d9be24b37b61 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 25 Mar 2010 13:21:33 +0000 Subject: [PATCH] Works on canvas capability Works on custom list add php template version --- .../default/templates/{liste.tpl => list.tpl} | 2 +- .../canvas/default/templates/list.tpl.php | 97 +++++++++++++++++++ htdocs/product/liste.php | 63 +++++++----- 3 files changed, 137 insertions(+), 25 deletions(-) rename htdocs/product/canvas/default/templates/{liste.tpl => list.tpl} (97%) create mode 100644 htdocs/product/canvas/default/templates/list.tpl.php diff --git a/htdocs/product/canvas/default/templates/liste.tpl b/htdocs/product/canvas/default/templates/list.tpl similarity index 97% rename from htdocs/product/canvas/default/templates/liste.tpl rename to htdocs/product/canvas/default/templates/list.tpl index fb74f444c95..8682491fa8a 100644 --- a/htdocs/product/canvas/default/templates/liste.tpl +++ b/htdocs/product/canvas/default/templates/list.tpl @@ -30,7 +30,7 @@ -
+ diff --git a/htdocs/product/canvas/default/templates/list.tpl.php b/htdocs/product/canvas/default/templates/list.tpl.php new file mode 100644 index 00000000000..85dd28d5a4c --- /dev/null +++ b/htdocs/product/canvas/default/templates/list.tpl.php @@ -0,0 +1,97 @@ + + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + */ +?> + + + +
+ + + + +
+ + +
+
+ +?canvas=default" method="post" name="formulaire"> + + + + + + + + + + + + + + + + + $searchfield) { + if ($searchfield['enabled']) { + if ($searchfield['search']) { ?> + + + + + + + + + + + + + $value) { + foreach($fieldlist as $field) { + if ($field['alias'] == $key) { ?> + + + + + +
+ ?sortfield=p.&sortorder=asc&begin=&envente=&canvas=default&fourn_id=&snom=&sref="> + A-Z + + ?sortfield=p.&sortorder=desc&begin=&envente=&canvas=default&fourn_id=&snom=&sref="> + Z-A + +
+ + +  
+
+ + \ No newline at end of file diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index 197d4b2a8e9..78a10c64f06 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -230,44 +230,59 @@ if ($resql) if ($_GET["canvas"] <> '' && file_exists('canvas/'.$_GET["canvas"].'/product.'.$_GET["canvas"].'.class.php')) { - $smarty->assign('fieldlist', $object->field_list); - $smarty->assign('datas', $object->list_datas); - $smarty->assign('url_root', $dolibarr_main_url_root); - $smarty->assign('theme', $conf->theme); - $smarty->assign('langs', $langs); + $fieldlist = $object->field_list; + $datas = $object->list_datas; $picto='title.png'; if (empty($conf->browser->firefox)) $picto='title.gif'; - $smarty->assign('title_picto', img_picto('',$picto)); - $smarty->assign('title_text', $title); - + $title_picto = img_picto('',$picto); + $title_text = $title; + // Check if a custom template is present - if (file_exists(DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/templates/product/'.$_GET["canvas"].'/liste.tpl')) + if (file_exists(DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/templates/product/'.$_GET["canvas"].'/list.tpl')) { - $smarty->template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/templates/product/'.$_GET["canvas"].'/'; - $template = 'liste.tpl'; + $template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/templates/product/'.$_GET["canvas"].'/'; + $template = 'list.tpl'; } // Check if a default template is present - else if (file_exists(DOL_DOCUMENT_ROOT . '/product/canvas/'.$_GET["canvas"].'/templates/liste.tpl')) + else if (file_exists(DOL_DOCUMENT_ROOT . '/product/canvas/'.$_GET["canvas"].'/templates/list.tpl')) { - $smarty->template_dir = DOL_DOCUMENT_ROOT . '/product/canvas/'.$_GET["canvas"].'/templates/'; - $template = 'liste.tpl'; + $template_dir = DOL_DOCUMENT_ROOT . '/product/canvas/'.$_GET["canvas"].'/templates/'; + $template = 'list.tpl'; } // Error template else { - $smarty->template_dir = DOL_DOCUMENT_ROOT . '/core/templates/'; + $template_dir = DOL_DOCUMENT_ROOT . '/core/templates/'; $template = 'error.tpl'; } - // Enable caching - //$smarty->caching = true; - - //$smarty->debugging = true; - - $smarty->display($template, $_GET["canvas"]); - - // Suppression de la version compilee - $smarty->clear_compiled_tpl($template); + // START SMARTY + if ($conf->global->MAIN_SMARTY) + { + $smarty->template_dir = $template_dir; + + $smarty->assign('fieldlist', $fieldlist); + $smarty->assign('datas', $datas); + $smarty->assign('url_root', $dolibarr_main_url_root); + $smarty->assign('theme', $conf->theme); + $smarty->assign('langs', $langs); + $smarty->assign('title_picto', $title_picto); + $smarty->assign('title_text', $title_text); + + // Enable caching + //$smarty->caching = true; + + //$smarty->debugging = true; + + $smarty->display($template, $_GET["canvas"]); + + // Suppression de la version compilee + $smarty->clear_compiled_tpl($template); + } + else + { + include($template_dir.'list.tpl.php'); // To use native PHP + } } else {