Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2012-01-11 22:21:14 +01:00
commit 6c9cbae1f7
3 changed files with 29 additions and 19 deletions

View File

@ -221,7 +221,7 @@ function ajax_combobox($htmlname)
* @param string $code Name of constant * @param string $code Name of constant
* @param array $input Input element * @param array $input Input element
* @param int $entity Entity to set * @param int $entity Entity to set
* TODO add different method for other input (show/hide, disable, ..) * @return void
*/ */
function ajax_constantonoff($code,$input=array(),$entity=false) function ajax_constantonoff($code,$input=array(),$entity=false)
{ {
@ -231,50 +231,60 @@ function ajax_constantonoff($code,$input=array(),$entity=false)
$out= '<script type="text/javascript"> $out= '<script type="text/javascript">
$(function() { $(function() {
var input='.json_encode($input).'; var input = '.json_encode($input).';
// Set constant // Set constant
$( "#set_'.$code.'" ).click(function() { $("#set_'.$code.'").click(function() {
$.get( "'.DOL_URL_ROOT.'/core/ajax/constantonoff.php", { $.get( "'.DOL_URL_ROOT.'/core/ajax/constantonoff.php", {
action: \'set\', action: \'set\',
name: \''.$code.'\', name: \''.$code.'\',
entity: \''.$entity.'\' entity: \''.$entity.'\'
}, },
function() { function() {
$("#set_'.$code.'" ).hide(); $("#set_'.$code.'").hide();
$("#del_'.$code.'" ).show(); $("#del_'.$code.'").show();
// Enable another object // Enable another element
if (input.length > 0) { if (input.disabled && input.disabled.length > 0) {
$.each(input, function(key,value) { $.each(input.disabled, function(key,value) {
$("#" + value).removeAttr("disabled"); $("#" + value).removeAttr("disabled");
if ( $( "#" + value).hasClass("butActionRefused") == true ) { if ($("#" + value).hasClass("butActionRefused") == true) {
$("#" + value).removeClass("butActionRefused"); $("#" + value).removeClass("butActionRefused");
$("#" + value).addClass("butAction"); $("#" + value).addClass("butAction");
} }
}); });
// Show another element
} else if (input.showhide && input.showhide.length > 0) {
$.each(input.showhide, function(key,value) {
$("#" + value).show();
});
} }
}); });
}); });
// Del constant // Del constant
$( "#del_'.$code.'" ).click(function() { $("#del_'.$code.'").click(function() {
$.get( "'.DOL_URL_ROOT.'/core/ajax/constantonoff.php", { $.get( "'.DOL_URL_ROOT.'/core/ajax/constantonoff.php", {
action: \'del\', action: \'del\',
name: \''.$code.'\', name: \''.$code.'\',
entity: \''.$entity.'\' entity: \''.$entity.'\'
}, },
function() { function() {
$("#del_'.$code.'" ).hide(); $("#del_'.$code.'").hide();
$("#set_'.$code.'" ).show(); $("#set_'.$code.'").show();
// Disable another object // Disable another element
if (input.length > 0) { if (input.disabled && input.disabled.length > 0) {
$.each(input, function(key,value) { $.each(input.disabled, function(key,value) {
$("#" + value).attr("disabled", true); $("#" + value).attr("disabled", true);
if ( $( "#" + value).hasClass("butAction") == true ) { if ($("#" + value).hasClass("butAction") == true) {
$("#" + value).removeClass("butAction"); $("#" + value).removeClass("butAction");
$("#" + value).addClass("butActionRefused"); $("#" + value).addClass("butActionRefused");
} }
}); });
// Hide another element
} else if (input.showhide && input.showhide.length > 0) {
$.each(input.showhide, function(key,value) {
$("#" + value).hide();
});
} }
}); });
}); });

View File

@ -269,7 +269,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
if (! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_HIDE_LOGIN_COMBOBOX)) if (! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_HIDE_LOGIN_COMBOBOX))
{ {
$rowspan++; $rowspan++;
$select_entity = $mc->select_entities($lastentity, 'tabindex="3"', 1); $select_entity = $mc->select_entities($lastentity, 'entity', ' tabindex="3"', 1);
} }
// Security graphical code // Security graphical code

View File

@ -228,7 +228,7 @@ if (! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_
} }
} }
$select_entity = $mc->select_entities($lastentity,'tabindex="2"'); $select_entity = $mc->select_entities($lastentity, 'entity', ' tabindex="2"');
} }
// Security graphical code // Security graphical code