diff --git a/htdocs/core/ajax/box.php b/htdocs/core/ajax/box.php
index 63f96a0c513..be4d9231c5f 100644
--- a/htdocs/core/ajax/box.php
+++ b/htdocs/core/ajax/box.php
@@ -26,7 +26,7 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
-if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
+//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
if (! defined('NOREQUIREHOOK')) define('NOREQUIREHOOK','1');
require '../../main.inc.php';
@@ -70,5 +70,10 @@ if ($boxorder && $zone != '' && $userid > 0)
dol_syslog("AjaxBox boxorder=".$boxorder." zone=".$zone." userid=".$userid, LOG_DEBUG);
$result=InfoBox::saveboxorder($db,$zone,$boxorder,$userid);
+ if ($result > 0)
+ {
+ $langs->load("boxes");
+ setEventMessages($langs->trans("BoxAdded"), null);
+ }
}
diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php
index 9cb402cfc89..bcad9dbac44 100644
--- a/htdocs/core/class/html.formother.class.php
+++ b/htdocs/core/class/html.formother.class.php
@@ -978,7 +978,7 @@ class FormOther
*
* @param User $user Object User
* @param String $areacode Code of area for pages (0=value for Home page)
- * @return array array('selectboxlist'=>, 'boxactivated'=>, 'boxlist'=>)
+ * @return array array('selectboxlist'=>, 'boxactivated'=>, 'boxlista'=>, 'boxlistb'=>)
*/
static function getBoxesArea($user,$areacode)
{
@@ -1027,10 +1027,10 @@ class FormOther
$selectboxlist.='';
$selectboxlist.='';
$selectboxlist.='';
- $selectboxlist.=Form::selectarray('boxcombo', $arrayboxtoactivatelabel, '', $langs->trans("ChooseBoxToAdd").'...', 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth150onsmartphone', 0, ' disabled hidden selected');
+ $selectboxlist.=Form::selectarray('boxcombo', $arrayboxtoactivatelabel, -1, $langs->trans("ChooseBoxToAdd").'...', 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth150onsmartphone', 0, 'hidden selected');
if (empty($conf->use_javascript_ajax)) $selectboxlist.=' ';
$selectboxlist.='';
- //$selectboxlist.=ajax_combobox("boxcombo");
+ $selectboxlist.=ajax_combobox("boxcombo");
}
// Javascript code for dynamic actions
@@ -1114,11 +1114,6 @@ class FormOther
$emptybox=new ModeleBoxes($db);
- //$boxlist.='
';
- //$boxlist.=''."\n";
-
- //$boxlist.='';
-
$boxlista.="\n\n";
$boxlista.=' '."\n";
@@ -1152,8 +1147,6 @@ class FormOther
$boxlista.= " \n";
$boxlista.= "\n";
- //$boxlist.= ' ';
-
$boxlistb.= "\n\n";
$boxlistb.= ' '."\n";
@@ -1183,11 +1176,6 @@ class FormOther
$boxlistb.= " \n";
$boxlistb.= "\n";
- //$boxlist.= ' ';
- //$boxlist.= "\n";
-
- //$boxlist.= " |
";
- //$boxlist.= "
";
}
return array('selectboxlist'=>count($boxactivated)?$selectboxlist:'', 'boxactivated'=>$boxactivated, 'boxlista'=>$boxlista, 'boxlistb'=>$boxlistb);
diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php
index cd06eb587b7..419f31dca4d 100644
--- a/htdocs/core/class/infobox.class.php
+++ b/htdocs/core/class/infobox.class.php
@@ -183,7 +183,7 @@ class InfoBox
* @param string $zone Name of area (0 for Homepage, ...)
* @param string $boxorder List of boxes with correct order 'A:123,456,...-B:789,321...'
* @param int $userid Id of user
- * @return int <0 if KO, >= 0 if OK
+ * @return int <0 if KO, 0=Nothing done, > 0 if OK
*/
static function saveboxorder($db, $zone,$boxorder,$userid=0)
{
diff --git a/htdocs/index.php b/htdocs/index.php
index 4ac80fbf57c..0fec7ea11d5 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -61,11 +61,10 @@ if (GETPOST('addbox')) // Add box (when submit is done from a form when ajax dis
$boxorder.=GETPOST('boxcombo');
$result=InfoBox::saveboxorder($db,$zone,$boxorder,$userid);
+ if ($result > 0) setEventMessages($langs->trans("BoxAdded"), null);
}
-
-
/*
* View
*/
@@ -79,7 +78,7 @@ if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$langs->trans("HomeAr
llxHeader('',$title);
-$resultboxes=FormOther::getBoxesArea($user,"0");
+$resultboxes=FormOther::getBoxesArea($user,"0"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
print load_fiche_titre($langs->trans("HomeArea"),$resultboxes['selectboxlist'],'title_home');
diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang
index 0e6c5019cac..9eb795ea7d1 100644
--- a/htdocs/langs/en_US/boxes.lang
+++ b/htdocs/langs/en_US/boxes.lang
@@ -83,3 +83,4 @@ ForCustomersOrders=Customers orders
ForProposals=Proposals
LastXMonthRolling=The latest %s month rolling
ChooseBoxToAdd=Add widget to your dashboard
+BoxAdded=Widget was added in your dashboard
\ No newline at end of file
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index 8a4e636cee0..090bb3f887c 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -4023,6 +4023,23 @@ a span.select2-chosen
.select2-container-multi .select2-choices .select2-search-choice {
margin-bottom: 3px;
}
+
+/* Special case for the select2 add widget */
+#addbox .select2-container .select2-choice > .select2-chosen {
+ text-align: left;
+ opacity: 0.2;
+}
+/* Style used before the select2 js is executed on boxcombo */
+#boxcombo.boxcombo {
+ text-align: left;
+ opacity: 0.2;
+ border-bottom: 1px solid #000;
+ height: 26px;
+ line-height: 24px;
+ padding: 0 0 5px 5px;
+ vertical-align: top;
+}
+
/* To emulate select 2 style */
.select2-container-multi-dolibarr .select2-choices-dolibarr .select2-search-choice-dolibarr {
padding: 2px 5px 1px 5px;
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 6fad30ed46b..96cb8002719 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -3970,6 +3970,23 @@ a span.select2-chosen
.select2-container-multi .select2-choices .select2-search-choice {
margin-bottom: 3px;
}
+
+/* Special case for the select2 add widget */
+#addbox .select2-container .select2-choice > .select2-chosen {
+ text-align: left;
+ opacity: 0.2;
+}
+/* Style used before the select2 js is executed on boxcombo */
+#boxcombo.boxcombo {
+ text-align: left;
+ opacity: 0.2;
+ border-bottom: 1px solid #000;
+ height: 26px;
+ line-height: 24px;
+ padding: 0 0 5px 5px;
+ vertical-align: top;
+}
+
/* To emulate select 2 style */
.select2-container-multi-dolibarr .select2-choices-dolibarr .select2-search-choice-dolibarr {
padding: 2px 5px 1px 5px;