Adapt new items to meta

This commit is contained in:
Arturo Gonzalez 2017-10-09 12:55:57 +02:00
parent 4cb4a699a5
commit 8980edf2ad
3 changed files with 83 additions and 21 deletions

@ -201,7 +201,23 @@ echo "</form>";
<script type="text/javascript">
$(document).ready (function () {
var metaconsole = null;
function is_metaconsole() {
if (metaconsole === null)
metaconsole = $("input[name='metaconsole']").val();
if (metaconsole != 0)
return true;
else
return false;
}
var url_hack_metaconsole = '';
if (is_metaconsole()) {
url_hack_metaconsole = '../../';
}
$("#modsize").click(function(event){
event.preventDefault();
@ -260,7 +276,7 @@ $(document).ready (function () {
}
else{
original_image=new Image();
original_image.src='images/console/background/'+$('#background').val();
original_image.src= url_hack_metaconsole + 'images/console/background/'+$('#background').val();
if (parseInt(original_image.width) < 1024){
alert('Default width is '+original_image.width+'px, smaller than minimum -> 1024px');
$('input[name=width]').val('1024');
@ -310,7 +326,7 @@ $(document).ready (function () {
var size_changer_state = false;
$("#background").change(function() {
$('#imagen2').attr('src','images/console/background/'+$('#background').val());
$('#imagen2').attr('src', url_hack_metaconsole + 'images/console/background/'+$('#background').val());
$('#imagen2').width(230);
$('#imagen2').show();
});
@ -323,7 +339,7 @@ $(document).ready (function () {
$("#background").mouseout(function() {
if(size_changer_state){
$('#imagen').attr('src','images/console/background/'+$('#background').val());
$('#imagen').attr('src',url_hack_metaconsole + 'images/console/background/'+$('#background').val());
$('input[name=width]').val($('#imagen').width());
$('input[name=height]').val($('#imagen').height());
$('#preimagew').html($('#imagen').width());

@ -1429,12 +1429,22 @@ function visual_map_print_item($mode = "read", $layoutData,
$unit_text = "%";
}
if (get_parameter('action') == 'edit') {
if ($width == 0) {
$img = '<img src="images/console/signes/percentil.png" style="width:130px;height:30px;'.$imgpos.'">';
if (get_parameter('action') == 'edit' || (get_parameter('operation') == 'edit_visualmap')) {
if($width == 0){
if ($layoutData['id_metaconsole'] != 0) {
$img = '<img src="' . '../../' . 'images/console/signes/percentil.png" style="width:130px;height:30px;'.$imgpos.'">';
}
else{
$img = '<img src="images/console/signes/percentil.png" style="width:130px;height:30px;'.$imgpos.'">';
}
}
else {
$img = '<img src="images/console/signes/percentil.png" style="width:'.$width.'px;height:30px;'.$imgpos.'">';
else{
if ($layoutData['id_metaconsole'] != 0) {
$img = '<img src="' . '../../' . '/images/console/signes/percentil.png" style="width:'.$width.'px;height:30px;'.$imgpos.'">';
}
else{
$img = '<img src="images/console/signes/percentil.png" style="width:'.$width.'px;height:30px;'.$imgpos.'">';
}
}
}
else{
@ -1457,12 +1467,22 @@ function visual_map_print_item($mode = "read", $layoutData,
$unit_text = "%";
}
if(get_parameter('action') == 'edit'){
if(get_parameter('action') == 'edit' || (get_parameter('operation') == 'edit_visualmap')){
if($width == 0){
$img = '<img src="images/console/signes/percentil_bubble.png" style="width:130px;height:130px;'.$imgpos.'">';
if ($layoutData['id_metaconsole'] != 0) {
$img = '<img src="' . '../../' . 'images/console/signes/percentil_bubble.png">';
}
else{
$img = '<img src="images/console/signes/percentil_bubble.png">';
}
}
else{
$img = '<img src="images/console/signes/percentil_bubble.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">';
if ($layoutData['id_metaconsole'] != 0) {
$img = '<img src="' . '../../' . '/images/console/signes/percentil_bubble.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">';
}
else{
$img = '<img src="images/console/signes/percentil_bubble.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">';
}
}
}
else{
@ -1478,12 +1498,22 @@ function visual_map_print_item($mode = "read", $layoutData,
break;
case CIRCULAR_PROGRESS_BAR:
if(get_parameter('action') == 'edit'){
if(get_parameter('action') == 'edit' || (get_parameter('operation') == 'edit_visualmap')){
if($width == 0){
$img = '<img src="images/console/signes/circular-progress-bar.png" style="width:130px;height:130px;'.$imgpos.'">';
if ($layoutData['id_metaconsole'] != 0) {
$img = '<img src="' . '../../' . 'images/console/signes/circular-progress-bar.png">';
}
else{
$img = '<img src="images/console/signes/circular-progress-bar.png">';
}
}
else{
$img = '<img src="images/console/signes/circular-progress-bar.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">';
if ($layoutData['id_metaconsole'] != 0) {
$img = '<img src="' . '../../' . '/images/console/signes/circular-progress-bar.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">';
}
else{
$img = '<img src="images/console/signes/circular-progress-bar.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">';
}
}
}
else {
@ -1511,12 +1541,22 @@ function visual_map_print_item($mode = "read", $layoutData,
break;
case CIRCULAR_INTERIOR_PROGRESS_BAR:
if(get_parameter('action') == 'edit'){
if(get_parameter('action') == 'edit' || (get_parameter('operation') == 'edit_visualmap')){
if($width == 0){
$img = '<img src="images/console/signes/circular-progress-bar-interior.png" style="width:130px;height:130px;'.$imgpos.'">';
if ($layoutData['id_metaconsole'] != 0) {
$img = '<img src="' . '../../' . 'images/console/signes/circular-progress-bar-interior.png">';
}
else{
$img = '<img src="images/console/signes/circular-progress-bar-interior.png">';
}
}
else{
$img = '<img src="images/console/signes/circular-progress-bar-interior.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">';
if ($layoutData['id_metaconsole'] != 0) {
$img = '<img src="' . '../../' . '/images/console/signes/circular-progress-bar-interior.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">';
}
else{
$img = '<img src="images/console/signes/circular-progress-bar-interior.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">';
}
}
}
else {

@ -24,10 +24,16 @@ function include_javascript_d3 ($return = false) {
if (!$is_include_javascript) {
$is_include_javascript = true;
$output .= '<script type="text/javascript" src="' . $config['homeurl'] . 'include/javascript/d3.3.5.14.js" charset="utf-8"></script>';
$output .= '<script type="text/javascript" src="' . $config['homeurl'] . 'include/graphs/pandora.d3.js" charset="utf-8"></script>';
if (is_metaconsole()) {
$output .= '<script type="text/javascript" src="' . '../../' . 'include/javascript/d3.3.5.14.js" charset="utf-8"></script>';
$output .= '<script type="text/javascript" src="' . '../../' . 'include/graphs/pandora.d3.js" charset="utf-8"></script>';
}
else {
$output .= '<script type="text/javascript" src="' . $config['homeurl'] . 'include/javascript/d3.3.5.14.js" charset="utf-8"></script>';
$output .= '<script type="text/javascript" src="' . $config['homeurl'] . 'include/graphs/pandora.d3.js" charset="utf-8"></script>';
}
}
if (!$return)
echo $output;