NEW Use autocompletion on the "Add widget list".
This commit is contained in:
parent
184d52525a
commit
d241adc201
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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.='<input type="hidden" name="userid" value="'.$user->id.'">';
|
||||
$selectboxlist.='<input type="hidden" name="areacode" value="'.$areacode.'">';
|
||||
$selectboxlist.='<input type="hidden" name="boxorder" value="'.$boxorder.'">';
|
||||
$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.=' <input type="submit" class="button" value="'.$langs->trans("AddBox").'">';
|
||||
$selectboxlist.='</form>';
|
||||
//$selectboxlist.=ajax_combobox("boxcombo");
|
||||
$selectboxlist.=ajax_combobox("boxcombo");
|
||||
}
|
||||
|
||||
// Javascript code for dynamic actions
|
||||
@ -1114,11 +1114,6 @@ class FormOther
|
||||
|
||||
$emptybox=new ModeleBoxes($db);
|
||||
|
||||
//$boxlist.='<table width="100%" class="notopnoleftnoright">';
|
||||
//$boxlist.='<tr><td class="notopnoleftnoright">'."\n";
|
||||
|
||||
//$boxlist.='<div class="fichehalfleft">';
|
||||
|
||||
$boxlista.="\n<!-- Box left container -->\n";
|
||||
$boxlista.='<div id="left" class="connectedSortable">'."\n";
|
||||
|
||||
@ -1152,8 +1147,6 @@ class FormOther
|
||||
$boxlista.= "</div>\n";
|
||||
$boxlista.= "<!-- End box left container -->\n";
|
||||
|
||||
//$boxlist.= '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
$boxlistb.= "\n<!-- Box right container -->\n";
|
||||
$boxlistb.= '<div id="right" class="connectedSortable">'."\n";
|
||||
|
||||
@ -1183,11 +1176,6 @@ class FormOther
|
||||
$boxlistb.= "</div>\n";
|
||||
$boxlistb.= "<!-- End box right container -->\n";
|
||||
|
||||
//$boxlist.= '</div></div>';
|
||||
//$boxlist.= "\n";
|
||||
|
||||
//$boxlist.= "</td></tr>";
|
||||
//$boxlist.= "</table>";
|
||||
}
|
||||
|
||||
return array('selectboxlist'=>count($boxactivated)?$selectboxlist:'', 'boxactivated'=>$boxactivated, 'boxlista'=>$boxlista, 'boxlistb'=>$boxlistb);
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user