';
// The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object
print img_picto($langs->trans("MoveField",$pos),'uparrow','class="boxhandle" style="cursor:move;"');
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index aec698f8a4c..5317ff0f034 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -28,7 +28,7 @@
* \file htdocs/lib/functions.lib.php
* \brief A set of functions for Dolibarr
* This file contains all frequently used functions.
- * \version $Id: functions.lib.php,v 1.554 2011/08/15 18:37:07 eldy Exp $
+ * \version $Id: functions.lib.php,v 1.555 2011/08/17 15:56:24 eldy Exp $
*/
// For compatibility during upgrade
@@ -1501,6 +1501,7 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',
* Truncate a string to a particular length adding '...' if string larger than length.
* If length = max length+1, we do no truncate to avoid having just 1 char replaced with '...'.
* MAIN_DISABLE_TRUNC=1 can disable all truncings
+ *
* @param string String to truncate
* @param size Max string size. 0 for no limit.
* @param trunc Where to trunc: right, left, middle, wrap
@@ -1561,6 +1562,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8')
/**
* Show a picto called object_picto (generic function)
+ *
* @param alt Text of alt on image
* @param picto Name of image to show object_picto (example: user, group, action, bill, contract, propal, product, ...)
* For external modules use imagename@mymodule to search into directory "img" of module.
@@ -1571,35 +1573,39 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8')
*/
function img_object($alt, $picto, $options='', $pictoisfullpath=0)
{
- global $conf,$langs;
+ global $conf;
- $path = 'theme/'.$conf->theme;
- $url = DOL_URL_ROOT;
+ // Clean parameters
+ if (! preg_match('/(\.png|\.gif)$/i',$picto)) $picto.='.png';
- if (preg_match('/^([^@]+)@([^@]+)$/i',$picto,$regs))
- {
- $picto = $regs[1];
- $path = $regs[2];
- if (! preg_match('/(\.png|\.gif)$/i',$picto)) $picto.='.png';
- // If img file not into standard path, we use alternate path
- if (defined('DOL_URL_ROOT_ALT') && DOL_URL_ROOT_ALT && ! file_exists(DOL_DOCUMENT_ROOT.'/'.$path.'/img/object_'.$picto)) $url = DOL_URL_ROOT_ALT;
- }
+ // Define fullpathpicto to use into src
+ if (! empty($pictoisfullpath)) $fullpathpicto=$picto;
else
{
- if (! preg_match('/(\.png|\.gif)$/i',$picto)) $picto.='.png';
+ // By default, we search into theme directory
+ $url = DOL_URL_ROOT;
+ $path = 'theme/'.$conf->theme;
+ if (! empty($conf->global->MAIN_FORCETHEMEDIR)) $path=preg_replace('/^\//','',$conf->global->MAIN_FORCETHEMEDIR).'/'.$path;
+ // If we ask an image into module/img (not into a theme path)
+ if (preg_match('/^([^@]+)@([^@]+)$/i',$picto,$regs)) { $picto = $regs[1]; $path=$regs[2]; } // If image into a module/img path
+ // If img file not into standard path, we use alternate path
+ if (defined('DOL_URL_ROOT_ALT') && DOL_URL_ROOT_ALT && ! file_exists(DOL_DOCUMENT_ROOT.'/'.$path.'/img/object_'.$picto)) $url = DOL_URL_ROOT_ALT;
+
+ $fullpathpicto=$url.'/'.$path.'/img/object_'.$picto;
}
- if ($pictoisfullpath) return '';
- return '';
+
+ return '';
}
/**
* Show picto whatever it's its name (generic function)
+ *
* @param alt Text on alt and title of image
* @param picto Name of image file to show (If no extension provided, we use '.png'). Image must be stored into img directory.
* Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img
* Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img
* Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1)
- * @param options Add more attribute on img tag
+ * @param options Add more attribute on img tag (For example 'style="float: right"')
* @param pictoisfullpath If 1, image path is a full path
* @return string Return img tag
* @see img_object, img_picto_common
@@ -1608,28 +1614,31 @@ function img_picto($alt, $picto, $options='', $pictoisfullpath=0)
{
global $conf;
- $path = 'theme/'.$conf->theme;
- $url = DOL_URL_ROOT;
+ // Clean parameters
+ if (! preg_match('/(\.png|\.gif)$/i',$picto)) $picto.='.png';
- if (preg_match('/^([^@]+)@([^@]+)$/i',$picto,$regs))
- {
- $picto = $regs[1];
- $path = $regs[2];
- if (! preg_match('/(\.png|\.gif)$/i',$picto)) $picto.='.png';
- // If img file not into standard path, we use alternate path
- if (defined('DOL_URL_ROOT_ALT') && DOL_URL_ROOT_ALT && ! file_exists(DOL_DOCUMENT_ROOT.'/'.$path.'/img/'.$picto)) $url = DOL_URL_ROOT_ALT;
- }
+ // Define fullpathpicto to use into src
+ if (! empty($pictoisfullpath)) $fullpathpicto=$picto;
else
{
- if (! preg_match('/(\.png|\.gif)$/i',$picto)) $picto.='.png';
+ // By default, we search into theme directory
+ $url = DOL_URL_ROOT;
+ $path = 'theme/'.$conf->theme;
+ if (! empty($conf->global->MAIN_FORCETHEMEDIR)) $path=preg_replace('/^\//','',$conf->global->MAIN_FORCETHEMEDIR).'/'.$path;
+ // If we ask an image into module/img (not into a theme path)
+ if (preg_match('/^([^@]+)@([^@]+)$/i',$picto,$regs)) { $picto = $regs[1]; $path=$regs[2]; } // If image into a module/img path
+ // If img file not into standard path, we use alternate path
+ if (defined('DOL_URL_ROOT_ALT') && DOL_URL_ROOT_ALT && ! file_exists(DOL_DOCUMENT_ROOT.'/'.$path.'/img/'.$picto)) $url = DOL_URL_ROOT_ALT;
+
+ $fullpathpicto=$url.'/'.$path.'/img/'.$picto;
}
- if ($pictoisfullpath) return '';
- return '';
+ return '';
}
/**
* Show picto (generic function)
+ *
* @param alt Text on alt and title of image
* @param picto Name of image file to show (If no extension provided, we use '.png'). Image must be stored into htdocs/theme/common directory.
* @param options Add more attribute on img tag
@@ -1648,6 +1657,7 @@ function img_picto_common($alt, $picto, $options='', $pictoisfullpath=0)
/**
* Show logo action
+ *
* @param alt Text for image alt and title
* @param numaction Action to show
* @return string Return an img tag
@@ -1665,57 +1675,9 @@ function img_action($alt = "default", $numaction)
return '';
}
-
/**
- * Affiche logo fichier
- * @param alt Texte sur le alt de l'image
- * @return string Retourne tag img
- */
-function img_file($alt = "default")
-{
- global $conf,$langs;
- if ($alt=="default") $alt=$langs->trans("Show");
- return '';
-}
-
-/**
- * Affiche logo refresh
- * @param alt Texte sur le alt de l'image
- * @return string Retourne tag img
- */
-function img_refresh($alt = "default")
-{
- global $conf,$langs;
- if ($alt=="default") $alt=$langs->trans("Refresh");
- return '';
-}
-
-/**
- * Affiche logo dossier
- * @param alt Texte sur le alt de l'image
- * @return string Retourne tag img
- */
-function img_folder($alt = "default")
-{
- global $conf,$langs;
- if ($alt=="default") $alt=$langs->trans("Dossier");
- return '';
-}
-
-/**
- * Affiche logo nouveau fichier
- * @param alt Texte sur le alt de l'image
- * @return string Retourne tag img
- */
-function img_file_new($alt = "default")
-{
- global $conf,$langs;
- if ($alt=="default") $alt=$langs->trans("Show");
- return '';
-}
-
-/**
- * Affiche logo pdf
+ * Show pdf logo
+ *
* @param alt Texte sur le alt de l'image
* @param $size Taille de l'icone : 3 = 16x16px , 2 = 14x14px
* @return string Retourne tag img
@@ -1728,7 +1690,8 @@ function img_pdf($alt = "default",$size=3)
}
/**
- * Affiche logo +
+ * Show logo +
+ *
* @param alt Texte sur le alt de l'image
* @return string Retourne tag img
*/
@@ -1736,10 +1699,11 @@ function img_edit_add($alt = "default")
{
global $conf,$langs;
if ($alt=="default") $alt=$langs->trans("Add");
- return '';
+ return img_picto($alt,'edit_add.png');
}
/**
- * Affiche logo -
+ * Show logo -
+ *
* @param alt Texte sur le alt de l'image
* @return string Retourne tag img
*/
@@ -1747,11 +1711,12 @@ function img_edit_remove($alt = "default")
{
global $conf,$langs;
if ($alt=="default") $alt=$langs->trans("Remove");
- return '';
+ return img_picto($alt,'edit_remove.png');
}
/**
- * Affiche logo editer/modifier fiche
+ * Show logo editer/modifier fiche
+ *
* @param alt Texte sur le alt de l'image
* @param float Si il faut y mettre le style "float: right"
* @param other Add more attributes on img
@@ -1769,7 +1734,8 @@ function img_edit($alt = "default", $float=0, $other='')
}
/**
- * Affiche logo voir fiche
+ * Show logo view card
+ *
* @param alt Texte sur le alt de l'image
* @param float Si il faut y mettre le style "float: right"
* @param other Add more attributes on img
@@ -1788,6 +1754,7 @@ function img_view($alt = "default", $float=0, $other='')
/**
* Show delete logo
+ *
* @param alt Texte sur le alt de l'image
* @return string Retourne tag img
*/
@@ -1795,12 +1762,13 @@ function img_delete($alt = "default")
{
global $conf,$langs;
if ($alt=="default") $alt=$langs->trans("Delete");
- return '';
+ return img_picto($alt,'delete.png');
}
/**
* Show help logo with cursor "?"
+ *
* @param usehelpcursor
* @param usealttitle Texte to use as alt title
* @return string Retourne tag img
@@ -1823,6 +1791,7 @@ function img_help($usehelpcursor=1,$usealttitle=1)
/**
* Affiche logo info
+ *
* @param alt Texte sur le alt de l'image
* @return string Retourne tag img
*/
@@ -1830,11 +1799,12 @@ function img_info($alt = "default")
{
global $conf,$langs;
if ($alt=="default") $alt=$langs->trans("Informations");
- return '';
+ return img_picto($alt,'info.png');
}
/**
* Affiche logo warning
+ *
* @param alt Texte sur le alt de l'image
* @param float Si il faut afficher le style "float: right"
* @return string Retourne tag img
@@ -1843,32 +1813,12 @@ function img_warning($alt = "default",$float=0)
{
global $conf,$langs;
if ($alt=="default") $alt=$langs->trans("Warning");
- $img='';
-
- return $img;
-}
-
-/**
- * Affiche logo redstar
- * @param alt Texte sur le alt de l'image
- * @param float Si il faut afficher le style "float: right"
- * @return string Retourne tag img
- */
-function img_redstar($alt = "default",$float=0)
-{
- global $conf,$langs;
- if ($alt=="default") $alt=$langs->trans("SuperAdministrator");
- $img='';
-
- return $img;
+ return img_picto($alt,'warning.png',$float?'style="float: right"':'');
}
/**
* Affiche logo error
+ *
* @param alt Texte sur le alt de l'image
* @return string Retourne tag img
*/
@@ -1876,11 +1826,12 @@ function img_error($alt = "default")
{
global $conf,$langs;
if ($alt=="default") $alt=$langs->trans("Error");
- return '';
+ return img_picto($alt,'error.png');
}
/**
* Affiche logo telephone
+ *
* @param alt Texte sur le alt de l'image
* @param option Choose of logo
* @return string Retourne tag img
@@ -1898,6 +1849,7 @@ function img_phone($alt = "default",$option=0)
/**
* Affiche logo suivant
+ *
* @param alt Texte sur le alt de l'image
* @return string Retourne tag img
*/
@@ -1912,6 +1864,7 @@ function img_next($alt = "default")
/**
* Affiche logo precedent
+ *
* @param alt Texte sur le alt de l'image
* @return string Retourne tag img
*/
@@ -1924,6 +1877,7 @@ function img_previous($alt = "default")
/**
* Show logo down arrow
+ *
* @param alt Texte sur le alt de l'image
* @param selected Affiche version "selected" du logo
* @return string Retourne tag img
@@ -1938,6 +1892,7 @@ function img_down($alt = "default", $selected=0)
/**
* Show logo top arrow
+ *
* @param alt Texte sur le alt de l'image
* @param selected Affiche version "selected" du logo
* @return string Retourne tag img
@@ -1952,6 +1907,7 @@ function img_up($alt = "default", $selected=0)
/**
* Affiche logo gauche
+ *
* @param alt Texte sur le alt de l'image
* @param selected Affiche version "selected" du logo
* @return string Retourne tag img
@@ -1966,6 +1922,7 @@ function img_left($alt = "default", $selected=0)
/**
* Affiche logo droite
+ *
* @param alt Texte sur le alt de l'image
* @param selected Affiche version "selected" du logo
* @return string Retourne tag img
@@ -1978,20 +1935,9 @@ function img_right($alt = "default", $selected=0)
else return '';
}
-/**
- * Affiche logo tick
- * @param alt Texte sur le alt de l'image
- * @return string Retourne tag img
- */
-function img_tick($alt = "default")
-{
- global $conf,$langs;
- if ($alt=="default") $alt=$langs->trans("Active");
- return '';
-}
-
/**
* Affiche le logo tick si allow
+ *
* @param allow Authorise ou non
* @param alt Alt text for img
* @return string Retourne tag img
diff --git a/htdocs/lib/security.lib.php b/htdocs/lib/security.lib.php
index e7d16500620..408a969b2f5 100644
--- a/htdocs/lib/security.lib.php
+++ b/htdocs/lib/security.lib.php
@@ -20,7 +20,7 @@
/**
* \file htdocs/lib/security.lib.php
* \brief Set of function used for dolibarr security
- * \version $Id: security.lib.php,v 1.127 2011/08/17 13:59:24 cdelambert Exp $
+ * \version $Id: security.lib.php,v 1.128 2011/08/17 15:56:24 eldy Exp $
*/
@@ -231,7 +231,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
if (function_exists("imagecreatefrompng") && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
{
$captcha=1;
- $captcha_refresh=img_refresh();
+ $captcha_refresh=img_picto($langs->trans("Refresh"),'refresh');
}
// Extra link
diff --git a/htdocs/product/admin/produit.php b/htdocs/product/admin/produit.php
index 8bf475f0b35..bcf08bb5c9f 100644
--- a/htdocs/product/admin/produit.php
+++ b/htdocs/product/admin/produit.php
@@ -23,7 +23,7 @@
* \file htdocs/product/admin/produit.php
* \ingroup produit
* \brief Page d'administration/configuration du module Produit
- * \version $Id: produit.php,v 1.7 2011/07/31 23:24:02 eldy Exp $
+ * \version $Id: produit.php,v 1.8 2011/08/17 15:56:26 eldy Exp $
*/
require("../../main.inc.php");
@@ -267,7 +267,7 @@ if ($conf->global->PRODUCT_CANVAS_ABILITY)
if ($conf->global->$const)
{
- print img_tick();
+ print img_picto($langs->trans("Active"),'tick');
print '
';
print ''.$langs->trans("Disable").'';
}
@@ -294,5 +294,5 @@ if ($conf->global->PRODUCT_CANVAS_ABILITY)
$db->close();
-llxFooter('$Date: 2011/07/31 23:24:02 $ - $Revision: 1.7 $');
+llxFooter('$Date: 2011/08/17 15:56:26 $ - $Revision: 1.8 $');
?>
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index de7eb9ed069..df033c92146 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -24,7 +24,7 @@
* \file htdocs/product/class/product.class.php
* \ingroup produit
* \brief Fichier de la classe des produits predefinis
- * \version $Id: product.class.php,v 1.49 2011/08/04 21:46:51 eldy Exp $
+ * \version $Id: product.class.php,v 1.50 2011/08/17 15:56:26 eldy Exp $
*/
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
@@ -2580,7 +2580,7 @@ class Product extends CommonObject
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
if ($photo_vignette && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i',$photo) && ($product->imgWidth > $maxWidth || $product->imgHeight > $maxHeight))
{
- $return.= ''.img_refresh($langs->trans('GenerateThumb')).' ';
+ $return.= ''.img_picto($langs->trans('GenerateThumb'),'refresh').' ';
}
if ($user->rights->produit->creer || $user->rights->service->creer)
{
diff --git a/htdocs/user/group/fiche.php b/htdocs/user/group/fiche.php
index 052021abd95..60cec3b409d 100644
--- a/htdocs/user/group/fiche.php
+++ b/htdocs/user/group/fiche.php
@@ -20,7 +20,7 @@
/**
* \file htdocs/user/group/fiche.php
* \brief Onglet groupes utilisateurs
- * \version $Id: fiche.php,v 1.69 2011/07/31 23:21:25 eldy Exp $
+ * \version $Id: fiche.php,v 1.70 2011/08/17 15:56:24 eldy Exp $
*/
require("../../main.inc.php");
@@ -293,7 +293,7 @@ else
print '