2013-04-23 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_ui.php, include/javascript/pandora_modules.js:
	cleaned source code style.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8034 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-04-23 14:51:09 +00:00
parent 17b8719ed0
commit 34f8983e8a
3 changed files with 44 additions and 36 deletions

View File

@ -1,3 +1,8 @@
2013-04-23 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_ui.php, include/javascript/pandora_modules.js:
cleaned source code style.
2013-04-23 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_filemanager.php: fixed the javascript to show

View File

@ -1064,8 +1064,11 @@ function ui_require_javascript_file_enterprise($name, $disabled_metaconsole = fa
return true;
/* We checks two paths because it may fails on enterprise */
if (! file_exists ($filename) && ! file_exists ($config['homedir'].'/'.$filename))
if (!file_exists ($filename) &&
!file_exists ($config['homedir'] . '/' . $filename)) {
return false;
}
$config['js'][$name] = $filename;

View File

@ -487,76 +487,76 @@ function new_macro(prefix) {
var next_row = parseInt($('#next_row').html());
$('#next_row').html(next_row+2);
$('#next_row').html(next_row + 2);
var nrow1 = next_row - 2;
var nrow2 = next_row - 1;
var nrow3 = next_row;
var nrow4 = next_row + 1;
var next_number = parseInt($('#next_macro').html());
$('#next_macro').html(next_number+1);
$('#next_macro').html(next_number + 1);
var current_number = next_number - 1;
// Clone two last rows
var $row1 = $('#'+prefix+nrow1).clone(true);
var $row2 = $('#'+prefix+nrow2).clone(true);
var $row1 = $('#' + prefix + nrow1).clone(true);
var $row2 = $('#' + prefix + nrow2).clone(true);
// Change the tr ID
$row1.attr('id',prefix+(nrow3));
$row2.attr('id',prefix+(nrow4));
$row1.attr('id',prefix + (nrow3));
$row2.attr('id',prefix + (nrow4));
// Change the td ID
$row1.find('td').attr('id', changeTdId);
$row2.find('td').attr('id', changeTdId);
// Insert after last field
$row2.insertAfter('#'+prefix+nrow2);
$row1.insertAfter('#'+prefix+nrow2);
$row2.insertAfter('#' + prefix + nrow2);
$row1.insertAfter('#' + prefix + nrow2);
// Change labels
for(i = 0; i <= 3; i++) {
var label1 = $("#"+prefix+nrow3+"-"+i).html();
var exp_reg = new RegExp('field'+current_number, 'g');
label1 = label1.replace(exp_reg,'field'+next_number);
$("#"+prefix+nrow3+"-"+i).html(label1);
var label1 = $("#" + prefix + nrow3 + "-" + i).html();
var exp_reg = new RegExp('field' + current_number, 'g');
label1 = label1.replace(exp_reg,'field' + next_number);
$("#" + prefix + nrow3 + "-" + i).html(label1);
}
for(i = 0; i <= 1; i++) {
var label2 = $("#"+prefix+nrow4+"-"+i).html();
var exp_reg = new RegExp('field'+current_number, 'g');
label2 = label2.replace(exp_reg,'field'+next_number);
$("#"+prefix+nrow4+"-"+i).html(label2);
var label2 = $("#" + prefix + nrow4 + "-" + i).html();
var exp_reg = new RegExp('field' + current_number, 'g');
label2 = label2.replace(exp_reg,'field' + next_number);
$("#" + prefix + nrow4 + "-" + i).html(label2);
}
// Empty the text inputs
$('#text-field'+next_number+'_desc').val('');
$('#text-field'+next_number+'_help').val('');
$('#text-field'+next_number+'_value').val('');
$('#text-field' + next_number + '_desc').val('');
$('#text-field' + next_number + '_help').val('');
$('#text-field' + next_number + '_value').val('');
function changeTdId() {
switch(this.id) {
case prefix+(nrow1)+'-0':
return prefix+(nrow3)+'-0';
case prefix + (nrow1) + '-0':
return prefix + (nrow3) + '-0';
break;
case prefix+(nrow1)+'-1':
return prefix+(nrow3)+'-1';
case prefix + (nrow1) + '-1':
return prefix + (nrow3) + '-1';
break;
case prefix+(nrow1)+'-2':
return prefix+(nrow3)+'-2';
case prefix + (nrow1) + '-2':
return prefix + (nrow3) + '-2';
break;
case prefix+(nrow1)+'-3':
return prefix+(nrow3)+'-3';
case prefix + (nrow1) + '-3':
return prefix + (nrow3) + '-3';
break;
case prefix+(nrow2)+'-0':
return prefix+(nrow4)+'-0';
case prefix + (nrow2) + '-0':
return prefix + (nrow4) + '-0';
break;
case prefix+(nrow2)+'-1':
return prefix+(nrow4)+'-1';
case prefix + (nrow2) + '-1':
return prefix + (nrow4) + '-1';
break;
case prefix+(nrow2)+'-2':
return prefix+(nrow4)+'-2';
case prefix + (nrow2) + '-2':
return prefix + (nrow4) + '-2';
break;
case prefix+(nrow2)+'-3':
return prefix+(nrow4)+'-3';
case prefix + (nrow2) + '-3':
return prefix + (nrow4) + '-3';
break;
}
}