2010-03-31 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php: added new parameter for function "print_select" for style. In the function "print_input_hidden" added the parameter $class for set the class of input. * godmode/reporting/map_builder.php: delete old code, now it have only source code of paint list of visual consoles. * godmode/reporting/visual_console_builder.data.php: cleaned style the of form. * godmode/reporting/visual_console_builder.elements.php: cleaned the rows of table, delete label color field and change the text type for a icon. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2531 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
9539b3e924
commit
f72f5e9ae9
|
@ -1,3 +1,26 @@
|
||||||
|
2010-03-31 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* include/functions_html.php: added new parameter for function
|
||||||
|
"print_select" for style. In the function "print_input_hidden" added the
|
||||||
|
parameter $class for set the class of input.
|
||||||
|
|
||||||
|
* godmode/reporting/map_builder.php: delete old code, now it have only
|
||||||
|
source code of paint list of visual consoles.
|
||||||
|
|
||||||
|
* godmode/reporting/visual_console_builder.data.php: cleaned style the of
|
||||||
|
form.
|
||||||
|
|
||||||
|
* godmode/reporting/visual_console_builder.elements.php: cleaned the rows of
|
||||||
|
table, delete label color field and change the text type for a icon.
|
||||||
|
|
||||||
|
2010-03-31 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* include/styles/pandora.css, include/functions_visual_map.php,
|
||||||
|
include/ajax/visual_console_builder.ajax.php,
|
||||||
|
godmode/reporting/visual_console_builder.editor.php,
|
||||||
|
godmode/reporting/visual_console_builder.editor.js: cleaned source code and
|
||||||
|
changed the buttons.
|
||||||
|
|
||||||
2010-03-30 Miguel de Dios <miguel.dedios@artica.es>
|
2010-03-30 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* include/ajax/visual_console_builder.ajax.php: some cleaned the source
|
* include/ajax/visual_console_builder.ajax.php: some cleaned the source
|
||||||
|
|
|
@ -15,793 +15,42 @@
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (is_ajax ()) {
|
|
||||||
$search_agents = (bool) get_parameter ('search_agents');
|
|
||||||
|
|
||||||
if ($search_agents) {
|
|
||||||
|
|
||||||
require_once ('include/functions_agents.php');
|
|
||||||
|
|
||||||
$id_agent = (int) get_parameter ('id_agent');
|
|
||||||
$string = (string) get_parameter ('q'); /* q is what autocomplete plugin gives */
|
|
||||||
|
|
||||||
$filter = array ();
|
|
||||||
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
|
|
||||||
|
|
||||||
$agents = get_agents ($filter, array ('nombre', 'direccion'));
|
|
||||||
if ($agents === false)
|
|
||||||
return;
|
|
||||||
|
|
||||||
foreach ($agents as $agent) {
|
|
||||||
echo $agent['nombre']."|".$agent['direccion']."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
check_login ();
|
|
||||||
|
|
||||||
if (! give_acl ($config['id_user'], 0, "IW")) {
|
|
||||||
audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access map builder");
|
|
||||||
require ("general/noaccess.php");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once ('include/functions_visual_map.php');
|
|
||||||
|
|
||||||
$id_layout = (int) get_parameter ('id_layout');
|
|
||||||
$edit_layout = (bool) get_parameter ('edit_layout');
|
|
||||||
$create_layout = (bool) get_parameter ('create_layout');
|
|
||||||
$update_layout = (bool) get_parameter ('update_layout');
|
|
||||||
$delete_layout = (bool) get_parameter ('delete_layout');
|
|
||||||
$create_layout_data = (bool) get_parameter ('create_layout_data');
|
|
||||||
$update_layout_data = (bool) get_parameter ('update_layout_data');
|
|
||||||
$delete_layout_data = (bool) get_parameter ('delete_layout_data');
|
|
||||||
$update_layout_data_coords = (bool) get_parameter ('update_layout_data_coords');
|
|
||||||
$get_layout_data = (bool) get_parameter ('get_layout_data');
|
|
||||||
$get_background_info = (bool) get_parameter ('get_background_info');
|
|
||||||
|
|
||||||
$name = '';
|
|
||||||
$id_group = 0;
|
|
||||||
$width = 0;
|
|
||||||
$height = 0;
|
|
||||||
$background = '';
|
|
||||||
|
|
||||||
// Header
|
|
||||||
print_page_header (__('Visual console builder'), "", false, "map_builder", true);
|
print_page_header (__('Visual console builder'), "", false, "map_builder", true);
|
||||||
|
|
||||||
if ($create_layout) {
|
$table->width = '500px';
|
||||||
$name = (string) get_parameter ('name');
|
$table->data = array ();
|
||||||
$id_group = (int) get_parameter ('id_group');
|
$table->head = array ();
|
||||||
$width = (int) get_parameter ('width');
|
$table->head[0] = __('Map name');
|
||||||
$height = (int) get_parameter ('height');
|
$table->head[1] = __('Group');
|
||||||
$background = (string) get_parameter ('background');
|
$table->head[2] = __('Items');
|
||||||
if ($background != '') {
|
$table->head[3] = __('Delete');
|
||||||
$bg_info = getimagesize ('images/console/background/'.$background);
|
$table->align = array ();
|
||||||
$width = $bg_info[0];
|
$table->align[3] = 'center';
|
||||||
$height = $bg_info[1];
|
|
||||||
}
|
|
||||||
$values = array ();
|
|
||||||
$values['name'] = $name;
|
|
||||||
$values['id_group'] = $id_group;
|
|
||||||
$values['background'] = $background;
|
|
||||||
$values['height'] = $height;
|
|
||||||
$values['width'] = $width;
|
|
||||||
|
|
||||||
$id_layout = process_sql_insert ('tlayout', $values);
|
$maps = get_db_all_rows_in_table ('tlayout','name');
|
||||||
if ($id_layout !== false) {
|
if (!$maps) {
|
||||||
echo '<h3 class="suc">'.__('Successfully created').'</h3>';
|
echo '<div class="nf">'.('No maps defined').'</div>';
|
||||||
} else {
|
|
||||||
echo '<h3 class="error">'.__('Could not be created').'</h3>';
|
|
||||||
}
|
|
||||||
if (is_ajax ()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($delete_layout) {
|
|
||||||
process_sql_delete ('tlayout_data', array ('id_layout' => $id_layout));
|
|
||||||
$result = process_sql_delete ('tlayout', array ('id' => $id_layout));
|
|
||||||
if ($result) {
|
|
||||||
echo '<h3 class="suc">'.__('Successfully deleted').'</h3>';
|
|
||||||
clean_cache();
|
|
||||||
} else {
|
|
||||||
echo '<h3 class="error">'.__('Not deleted. Error deleting data').'</h3>';
|
|
||||||
}
|
|
||||||
$id_layout = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($update_layout) {
|
|
||||||
$name = (string) get_parameter ('name');
|
|
||||||
$id_group = (int) get_parameter ('id_group', 1);
|
|
||||||
$width = (int) get_parameter ('width', 0);
|
|
||||||
$height = (int) get_parameter ('height', 0);
|
|
||||||
$background = (string) get_parameter ('background');
|
|
||||||
$bg_info = array (0, 0);
|
|
||||||
if (file_exists ('images/console/background/'.$background))
|
|
||||||
$bg_info = getimagesize ('images/console/background/'.$background);
|
|
||||||
|
|
||||||
if (! $width)
|
|
||||||
$width = $bg_info[0];
|
|
||||||
if (! $height)
|
|
||||||
$height = $bg_info[1];
|
|
||||||
|
|
||||||
$values = array ('name' => $name,
|
|
||||||
'background' => $background,
|
|
||||||
'height' => $height,
|
|
||||||
'width' => $width,
|
|
||||||
'id_group' => $id_group);
|
|
||||||
|
|
||||||
$result = process_sql_update ('tlayout', $values, array ('id' => $id_layout));
|
|
||||||
|
|
||||||
print_result_message ($result,
|
|
||||||
__('Update layout successful'),
|
|
||||||
__('Update layout failed'));
|
|
||||||
|
|
||||||
if (is_ajax ()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($get_background_info) {
|
|
||||||
$file = (string) get_parameter ('background');
|
|
||||||
if (file_exists ('images/console/background/'.$file)){
|
|
||||||
$info = getimagesize ('images/console/background/'.$file);
|
|
||||||
$info['width'] = $info[0];
|
|
||||||
$info['height'] = $info[1];
|
|
||||||
}
|
|
||||||
if (is_ajax ()) {
|
|
||||||
echo json_encode ($info);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($get_layout_data) {
|
|
||||||
$id_layout_data = (int) get_parameter ('id_layout_data');
|
|
||||||
$layout_data = get_db_row ('tlayout_data', 'id', $id_layout_data);
|
|
||||||
if ($layout_data['id_agente_modulo']) {
|
|
||||||
$layout_data['id_agent'] = give_agent_id_from_module_id ($layout_data['id_agente_modulo']);
|
|
||||||
$layout_data['name_agent'] = get_agent_name ($layout_data['id_agent'], 'none');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if ($layout_data['id_agent']) {
|
|
||||||
$layout_data['name_agent'] = get_agent_name ($layout_data['id_agent'], 'none');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_ajax ()) {
|
|
||||||
echo json_encode ($layout_data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($create_layout_data) {
|
|
||||||
$layout_data_name_agent = (string) get_parameter ("agent");
|
|
||||||
$layout_data_id_agent = get_agent_id ($layout_data_name_agent);
|
|
||||||
|
|
||||||
$layout_data_type = (int) get_parameter ("type");
|
|
||||||
$layout_data_label = (string) get_parameter ("label");
|
|
||||||
$layout_data_image = (string) get_parameter ("image");
|
|
||||||
//$layout_data_id_agent = (int) get_parameter ("agent");
|
|
||||||
$layout_data_id_agent_module = (int) get_parameter ("module");
|
|
||||||
$layout_data_label_color = (string) get_parameter ("label_color");
|
|
||||||
$layout_data_parent_item = (int) get_parameter ("parent_item");
|
|
||||||
$layout_data_period = (int) get_parameter ("period");
|
|
||||||
$layout_data_map_linked = (int) get_parameter ("map_linked");
|
|
||||||
$layout_data_width = (int) get_parameter ("width");
|
|
||||||
$layout_data_height = (int) get_parameter ("height");
|
|
||||||
|
|
||||||
$values = array ('id_layout' => $id_layout,
|
|
||||||
'label' => $layout_data_label,
|
|
||||||
'id_layout_linked' => $layout_data_map_linked,
|
|
||||||
'label_color' => $layout_data_label_color,
|
|
||||||
'image' => $layout_data_image,
|
|
||||||
'type' => $layout_data_type,
|
|
||||||
'id_agent' => $layout_data_id_agent,
|
|
||||||
'id_agente_modulo' => $layout_data_id_agent_module,
|
|
||||||
'parent_item' => $layout_data_parent_item,
|
|
||||||
'period' => $layout_data_period * 3600,
|
|
||||||
'no_link_color' => 1,
|
|
||||||
'width' => $layout_data_width,
|
|
||||||
'height' => $layout_data_height);
|
|
||||||
$result = process_sql_insert ('tlayout_data', $values);
|
|
||||||
|
|
||||||
if ($result !== false) {
|
|
||||||
echo '<h3 class="suc">'.__('Successfully created').'</h3>';
|
|
||||||
} else {
|
|
||||||
echo '<h3 class="error">'.__('Could not be created').'</h3>';
|
|
||||||
}
|
|
||||||
if (is_ajax ()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($update_layout_data_coords) {
|
|
||||||
$id_layout_data = (int) get_parameter ('id_layout_data');
|
|
||||||
$layout_data_x = (int) get_parameter ("coord_x");
|
|
||||||
$layout_data_y = (int) get_parameter ("coord_y");
|
|
||||||
|
|
||||||
$sql = sprintf ('UPDATE tlayout_data SET
|
|
||||||
pos_x = %d, pos_y = %d
|
|
||||||
WHERE id = %d',
|
|
||||||
$layout_data_x, $layout_data_y, $id_layout_data);
|
|
||||||
process_sql_update ('tlayout_data',
|
|
||||||
array ('pos_x' => $layout_data_x, 'pos_y' => $layout_data_y),
|
|
||||||
array ('id' => $id_layout_data));
|
|
||||||
|
|
||||||
if (is_ajax ()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($delete_layout_data) {
|
|
||||||
//delete_element
|
|
||||||
|
|
||||||
$delete_element = get_parameter('delete_element',0);
|
|
||||||
$id_layout = get_parameter('id_layout');
|
|
||||||
|
|
||||||
process_sql_delete ('tlayout_data', array ('id' => $delete_element));
|
|
||||||
|
|
||||||
|
|
||||||
// $ids_layout_data = (array) get_parameter ('ids_layout_data');
|
|
||||||
//
|
|
||||||
// foreach ($ids_layout_data as $id_layout_data) {
|
|
||||||
// process_sql_update ('tlayout_data', array ('parent_item' => 0),
|
|
||||||
// array ('parent_item' => $id_layout_data));
|
|
||||||
// $sql = sprintf ('DELETE FROM tlayout_data WHERE id = %d',
|
|
||||||
// $id_layout_data);
|
|
||||||
// process_sql_delete ('tlayout_data', array ('id' => $id_layout_data));
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (is_ajax ()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($update_layout_data) {
|
|
||||||
$id_layout_data = (int) get_parameter ('id_layout_data');
|
|
||||||
$layout_data_type = (int) get_parameter ("type");
|
|
||||||
$layout_data_label = (string) get_parameter ("label");
|
|
||||||
$layout_data_image = (string) get_parameter ("image");
|
|
||||||
$layout_data_id_agent = (int) get_parameter ("agent");
|
|
||||||
$layout_data_id_agent_module = (int) get_parameter ("module");
|
|
||||||
$layout_data_label_color = (string) get_parameter ("label_color");
|
|
||||||
$layout_data_parent_item = (int) get_parameter ("parent_item");
|
|
||||||
$layout_data_period = (int) get_parameter ("period");
|
|
||||||
$layout_data_map_linked = (int) get_parameter ("map_linked");
|
|
||||||
$layout_data_width = (int) get_parameter ("width");
|
|
||||||
$layout_data_height = (int) get_parameter ("height");
|
|
||||||
|
|
||||||
$values = array ();
|
|
||||||
$values['image'] = $layout_data_image;
|
|
||||||
$values['label'] = $layout_data_label;
|
|
||||||
$values['label_color'] = $layout_data_label_color;
|
|
||||||
$values['id_agent'] = $layout_data_id_agent;
|
|
||||||
$values['id_agente_modulo'] = $layout_data_id_agent_module;
|
|
||||||
$values['type'] = $layout_data_type;
|
|
||||||
$values['parent_item'] = $layout_data_parent_item;
|
|
||||||
$values['period'] = $layout_data_period;
|
|
||||||
$values['id_layout_linked'] = $layout_data_map_linked;
|
|
||||||
$values['height'] = $layout_data_height;
|
|
||||||
$values['width'] = $layout_data_width;
|
|
||||||
$result = process_sql_update ('tlayout_data', $values, array ('id' => $id_layout_data));
|
|
||||||
|
|
||||||
if ($result !== false) {
|
|
||||||
echo '<h3 class="suc">'.__('Updated successfully').'</h3>';
|
|
||||||
} else {
|
|
||||||
echo '<h3 class="error">'.__('Not updated. Error updating data').'</h3>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($id_layout) {
|
|
||||||
$layout = get_db_row ('tlayout', 'id', $id_layout);
|
|
||||||
$name = $layout['name'];
|
|
||||||
$background = $layout['background'];
|
|
||||||
$id_group = $layout['id_group'];
|
|
||||||
$width = $layout['width'];
|
|
||||||
$height = $layout['height'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $edit_layout && ! $id_layout) {
|
|
||||||
$table->width = '500px';
|
|
||||||
$table->data = array ();
|
|
||||||
$table->head = array ();
|
|
||||||
$table->head[0] = __('Map name');
|
|
||||||
$table->head[1] = __('Group');
|
|
||||||
$table->head[2] = __('Items');
|
|
||||||
$table->head[3] = __('Wizard');
|
|
||||||
$table->head[4] = __('Delete');
|
|
||||||
$table->align = array ();
|
|
||||||
$table->align[3] = 'center';
|
|
||||||
$table->align[4] = 'center';
|
|
||||||
|
|
||||||
$maps = get_db_all_rows_in_table ('tlayout','name');
|
|
||||||
if (!$maps) {
|
|
||||||
echo '<div class="nf">'.('No maps defined').'</div>';
|
|
||||||
} else {
|
|
||||||
foreach ($maps as $map) {
|
|
||||||
if (give_acl ($config['id_user'], $map['id_group'], "AW")){
|
|
||||||
$data = array ();
|
|
||||||
$data[0] = '<a href="index.php?sec=gmap&sec2=godmode/reporting/visual_console_builder&tab=data&action=edit&id_visual_console='.$map['id'].'">'.$map['name'].'</a>';
|
|
||||||
|
|
||||||
$data[1] = print_group_icon ($map['id_group'], true).' ';
|
|
||||||
$data[1] .= get_group_name ($map['id_group']);
|
|
||||||
$data[2] = get_db_sql ("SELECT COUNT(*) FROM tlayout_data WHERE id_layout = ".$map['id']);
|
|
||||||
$data[3] = '<a href="index.php?sec=gmap&sec2=godmode/reporting/map_builder_wizard&id_layout='.$map['id'].'">'.print_image ("images/pill.png", true).'</a>';
|
|
||||||
|
|
||||||
$data[4] = '<a href="index.php?sec=gmap&sec2=godmode/reporting/map_builder&id_layout='.$map['id'].'&delete_layout=1">'.print_image ("images/cross.png", true).'</a>';
|
|
||||||
array_push ($table->data, $data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print_table ($table);
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
|
||||||
echo '<form action="index.php?sec=gmap&sec2=godmode/reporting/map_builder" method="post">';
|
|
||||||
print_input_hidden ('edit_layout', 1);
|
|
||||||
print_submit_button (__('Create'), '', false, 'class="sub next"');
|
|
||||||
echo '</form>';
|
|
||||||
echo '</div>';
|
|
||||||
} else {
|
} else {
|
||||||
$backgrounds_list = list_files ('images/console/background/', "jpg", 1, 0);
|
foreach ($maps as $map) {
|
||||||
$backgrounds_list = array_merge ($backgrounds_list, list_files ('images/console/background/', "png", 1, 0));
|
if (give_acl ($config['id_user'], $map['id_group'], "AW")){
|
||||||
$groups = get_user_groups ($config['id_user']);
|
$data = array ();
|
||||||
|
$data[0] = '<a href="index.php?sec=gmap&sec2=godmode/reporting/visual_console_builder&tab=data&action=edit&id_visual_console='.$map['id'].'">'.$map['name'].'</a>';
|
||||||
|
|
||||||
$table->width = '340px';
|
$data[1] = print_group_icon ($map['id_group'], true).' ';
|
||||||
$table->data = array ();
|
$data[1] .= get_group_name ($map['id_group']);
|
||||||
$table->data[0][0] = __('Name');
|
$data[2] = get_db_sql ("SELECT COUNT(*) FROM tlayout_data WHERE id_layout = ".$map['id']);
|
||||||
$table->data[0][1] = print_input_text ('name', $name, '', 15, 50, true);
|
|
||||||
|
|
||||||
if ($id_layout){
|
$data[3] = '<a href="index.php?sec=gmap&sec2=godmode/reporting/map_builder&id_layout='.$map['id'].'&delete_layout=1">'.print_image ("images/cross.png", true).'</a>';
|
||||||
$table->data[0][1] .= ' <a href="index.php?sec=gmap&sec2=godmode/reporting/map_builder_wizard&id_layout='.$id_layout.'">'.print_image ("images/pill.png", true).'</a>';
|
array_push ($table->data, $data);
|
||||||
|
}
|
||||||
$table->data[0][1] .= ' <a href="index.php?sec=visualc&sec2=operation/visual_console/render_view&id='.$id_layout.'&refr=60">'.print_image ("images/eye.png", true).'</a>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->data[1][0] = __('Group');
|
|
||||||
$table->data[1][1] = print_select ($groups, 'id_group', $id_group, '', '', '', true);
|
|
||||||
$table->data[2][0] = __('Background');
|
|
||||||
$table->data[2][1] = print_select ($backgrounds_list, 'background', $background, '', 'None', '', true);
|
|
||||||
|
|
||||||
if ($id_layout) {
|
|
||||||
$table->data[3][0] = __('Width');
|
|
||||||
$table->data[3][1] = print_input_text ('width', $width, '', 3, 5, true);
|
|
||||||
$table->data[4][0] = __('Height');
|
|
||||||
$table->data[4][1] = print_input_text ('height', $height, '', 3, 5, true);
|
|
||||||
}
|
|
||||||
echo '<form action="index.php?sec=gmap&sec2=godmode/reporting/map_builder" method="post">';
|
|
||||||
print_table ($table);
|
print_table ($table);
|
||||||
|
|
||||||
echo '<div style="width: '.$table->width.'" class="action-buttons">';
|
|
||||||
if ($id_layout) {
|
|
||||||
print_submit_button (__('Update'), 'update_layout', false, 'class="sub upd"');
|
|
||||||
print_input_hidden ('update_layout', 1);
|
|
||||||
print_input_hidden ('id_layout', $id_layout);
|
|
||||||
} else {
|
|
||||||
print_submit_button (__('Add'), 'create_layout', false, 'class="sub wand"');
|
|
||||||
print_input_hidden ('create_layout', 1);
|
|
||||||
}
|
|
||||||
echo '</div>';
|
|
||||||
echo '</form>';
|
|
||||||
|
|
||||||
if ($id_layout) {
|
|
||||||
/* Show visual map preview */
|
|
||||||
echo '<h3>'.__('preview').'</h3>';
|
|
||||||
print_pandora_visual_map ($id_layout, false, true);
|
|
||||||
|
|
||||||
$images_list = array ();
|
|
||||||
$all_images = list_files ('images/console/icons/', "png", 1, 0);
|
|
||||||
foreach ($all_images as $image_file) {
|
|
||||||
if (strpos ($image_file, "_bad"))
|
|
||||||
continue;
|
|
||||||
if (strpos ($image_file, "_ok"))
|
|
||||||
continue;
|
|
||||||
if (strpos ($image_file, "_warning"))
|
|
||||||
continue;
|
|
||||||
$image_file = substr ($image_file, 0, strlen ($image_file) - 4);
|
|
||||||
$images_list[$image_file] = $image_file;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<div style="width: 770px">';
|
|
||||||
/* Layout data trash */
|
|
||||||
echo '<form id="form_layout_data_trash" action="" method="post">';
|
|
||||||
echo '<div id="layout_trash_drop">';
|
|
||||||
echo '<h3>'.__('Map element trash').'</h3>';
|
|
||||||
// DISABLE UNTIL FIX THE BUG WITH ELEMENTS WITH BIG DIMENSIONS
|
|
||||||
// echo __('Drag an element here to delete from the map');
|
|
||||||
echo '<span id="elements"> </span>';
|
|
||||||
|
|
||||||
print_input_hidden ('delete_layout_data', 1);
|
|
||||||
print_input_hidden ('id_layout', $id_layout);
|
|
||||||
// echo '<div class="action-buttons" style="margin-top: 180px">';
|
|
||||||
// print_submit_button (__('Delete'), 'delete_buttons', true, 'class="sub delete"');
|
|
||||||
// echo '</div>';
|
|
||||||
|
|
||||||
echo __('Select an element to delete:');
|
|
||||||
|
|
||||||
echo "<p>";
|
|
||||||
$elements = get_db_all_rows_sql("SELECT t1.id, t1.label,
|
|
||||||
(SELECT t2.nombre
|
|
||||||
FROM tagente AS t2
|
|
||||||
WHERE t2.id_agente = t1.id_agent) AS name_agent,
|
|
||||||
(SELECT t3.nombre
|
|
||||||
FROM tagente_modulo AS t3
|
|
||||||
WHERE t3.id_agente_modulo = t1.id_agente_modulo) AS name_module
|
|
||||||
FROM tlayout_data AS t1
|
|
||||||
WHERE t1.id_layout = $id_layout");
|
|
||||||
$tempArraySelect = array();
|
|
||||||
if (is_array($elements)) {
|
|
||||||
foreach ($elements as $element) {
|
|
||||||
$tempArraySelect[$element['id']] = $element['label'] . " - " .
|
|
||||||
$element['name_agent'] . " - " . $element['name_module'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print_select($tempArraySelect, 'delete_element', '', '', __('None'), 0);
|
|
||||||
print " ";
|
|
||||||
print_submit_button (__('Delete'), 'delete_buttons', false, 'class="sub delete"');
|
|
||||||
echo "</p>";
|
|
||||||
|
|
||||||
echo '</div>';
|
|
||||||
echo '</form>';
|
|
||||||
|
|
||||||
/* Layout_data editor form */
|
|
||||||
$intervals = array ();
|
|
||||||
$intervals[3600] = "1 ".__('hour');
|
|
||||||
$intervals[7200] = "2 ".__('hours');
|
|
||||||
$intervals[10800] = "3 ".__('hours');
|
|
||||||
$intervals[21600] = "6 ".__('hours');
|
|
||||||
$intervals[43200] = "12 ".__('hours');
|
|
||||||
$intervals[86400] = __('Last day');
|
|
||||||
$intervals[172800] = "2 ". __('days');
|
|
||||||
$intervals[1209600] = __('Last week');
|
|
||||||
$intervals[2419200] = "15 ".__('days');
|
|
||||||
$intervals[4838400] = __('Last month');
|
|
||||||
$intervals[9676800] = "2 ".__('months');
|
|
||||||
$intervals[29030400] = "6 ".__('months');
|
|
||||||
|
|
||||||
$agents = get_group_agents ($id_group);
|
|
||||||
|
|
||||||
echo '<div id="layout_editor_drop">';
|
|
||||||
echo '<h3>'.__('Map element editor').'</h3>';
|
|
||||||
echo __('Drag an element here to edit the properties');
|
|
||||||
|
|
||||||
$table->data = array ();
|
|
||||||
$table->id = 'table_layout_data';
|
|
||||||
$table->rowstyle = array ();
|
|
||||||
|
|
||||||
$table->data[0][0] = __('Label');
|
|
||||||
$table->data[0][1] = print_input_text ('label', '', '', 20, 200, true);
|
|
||||||
$table->data[1][0] = __('Label color');
|
|
||||||
$table->data[1][1] = print_input_text ('label_color', '#000000', '', 7, 7, true);
|
|
||||||
$table->data[2][0] = __('Type');
|
|
||||||
$table->data[2][1] = print_select (get_layout_data_types (), 'type', '', '', '', 0, true, false, false); // Dont want to be sorted !
|
|
||||||
$table->data[3][0] = __('Height');
|
|
||||||
$table->data[3][1] = print_input_text ('height', '', '', 5, 5, true);
|
|
||||||
$table->data[4][0] = __('Width');
|
|
||||||
$table->data[4][1] = print_input_text ('width', '', '', 5, 5, true);
|
|
||||||
$table->data[5][0] = __('Agent') . '<a href="#" class="tip"> <span>' . __("Type at least two characters to search") . '</span></a>';
|
|
||||||
// $table->data[5][1] = print_select ($agents, 'agent', '', '', '--', 0, true);
|
|
||||||
$table->data[5][1] = print_input_text_extended ('agent', '', 'text-agent', '', 30, 100, false, '',
|
|
||||||
array('style' => 'background: url(images/lightning.png) no-repeat right;'), true);
|
|
||||||
$table->data[6][0] = __('Module');
|
|
||||||
$table->data[6][1] = print_select (array (), 'module', '', '', __('Any'), 0, true);
|
|
||||||
$table->data[7][0] = __('Period');
|
|
||||||
$table->data[7][1] = print_select ($intervals, 'period', '', '', '--', 0, true);
|
|
||||||
$table->data[8][0] = __('Image');
|
|
||||||
$table->data[8][1] = print_select ($images_list, 'image', '', '', 'None', '', true);
|
|
||||||
$table->data[8][1] .= '<div id="image_preview"> </div>';
|
|
||||||
$table->data[9][0] = __('Parent');
|
|
||||||
$table->data[9][1] = print_select_from_sql ('SELECT id, label FROM tlayout_data WHERE id_layout = '.$id_layout,
|
|
||||||
'parent_item', '', '', 'None', '', true);
|
|
||||||
$table->data[10][0] = __('Map linked');
|
|
||||||
$table->data[10][1] = print_select_from_sql ('SELECT id, name FROM tlayout WHERE id != '.$id_layout,
|
|
||||||
'map_linked', '', '', 'None', '', true);
|
|
||||||
|
|
||||||
echo '<form id="form_layout_data_editor" method="post" action="index.php?sec=gmap&sec2=godmode/reporting/map_builder" onsubmit="javascript: return testAgentCorrect();">';
|
|
||||||
print_table ($table);
|
|
||||||
print_input_hidden ('create_layout_data', 1);
|
|
||||||
print_input_hidden ('update_layout_data', 0);
|
|
||||||
print_input_hidden ('id_layout', $id_layout);
|
|
||||||
print_input_hidden ('id_layout_data', 0);
|
|
||||||
echo '<div style="width: '.$table->width.'" class="action-buttons">';
|
|
||||||
print_submit_button (__('Create'), 'create_layout_data_button', false, 'class="sub wand"');
|
|
||||||
echo '</div>';
|
|
||||||
echo '</form>';
|
|
||||||
echo '</div>';
|
|
||||||
echo '</div>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
require_css_file ('color-picker');
|
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||||
|
echo '<form action="index.php?sec=gmap&sec2=godmode/reporting/visual_console_builder" method="post">';
|
||||||
require_jquery_file ('ui.core');
|
print_input_hidden ('edit_layout', 1);
|
||||||
require_jquery_file ('ui.draggable');
|
print_submit_button (__('Create'), '', false, 'class="sub next"');
|
||||||
require_jquery_file ('ui.droppable');
|
echo '</form>';
|
||||||
require_jquery_file ('colorpicker');
|
echo '</div>';
|
||||||
require_jquery_file ('pandora.controls');
|
|
||||||
require_javascript_file ('wz_jsgraphics');
|
|
||||||
require_javascript_file ('pandora_visual_console');
|
|
||||||
require_jquery_file ('ajaxqueue');
|
|
||||||
require_jquery_file ('bgiframe');
|
|
||||||
require_jquery_file ('autocomplete');
|
|
||||||
?>
|
?>
|
||||||
<script language="javascript" type="text/javascript">
|
|
||||||
var selectAgent = false;
|
|
||||||
var id_agent_module = 0;
|
|
||||||
|
|
||||||
function testAgentCorrect() {
|
|
||||||
if (selectAgent) return true;
|
|
||||||
else {
|
|
||||||
if ($("#type").val() == 0) {
|
|
||||||
text_label = $("#text-label").val();
|
|
||||||
image = $("#image").val();
|
|
||||||
if (($("#text-label").val().length == 0) &&
|
|
||||||
($("#image").val().length == 0)) {
|
|
||||||
|
|
||||||
alert("<?php echo __("Please, choose an image or type a name for the element.");?>");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
alert ("<?php echo __("No selected agent, please select any agent."); ?>");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$(document).ready (function () {
|
|
||||||
|
|
||||||
$("#text-agent").autocomplete(
|
|
||||||
"ajax.php",
|
|
||||||
{
|
|
||||||
minChars: 2,
|
|
||||||
scroll:true,
|
|
||||||
extraParams: {
|
|
||||||
page: "operation/agentes/exportdata",
|
|
||||||
search_agents: 1,
|
|
||||||
id_group: function() { return $("#group").val(); }
|
|
||||||
},
|
|
||||||
formatItem: function (data, i, total) {
|
|
||||||
if (total == 0)
|
|
||||||
$("#text-agent").css ('background-color', '#cc0000');
|
|
||||||
else
|
|
||||||
$("#text-agent").css ('background-color', '');
|
|
||||||
if (data == "")
|
|
||||||
return false;
|
|
||||||
return data[0]+'<br><span class="ac_extra_field"><?php echo __("IP") ?>: '+data[1]+'</span>';
|
|
||||||
},
|
|
||||||
delay: 200
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
$("#text-agent").result (
|
|
||||||
function () {
|
|
||||||
selectAgent = true;
|
|
||||||
var agent_name = this.value;
|
|
||||||
$('#module').fadeOut ('normal', function () {
|
|
||||||
$('#module').empty ();
|
|
||||||
var inputs = [];
|
|
||||||
inputs.push ("filter=disabled = 0");
|
|
||||||
inputs.push ("agent_name=" + agent_name);
|
|
||||||
inputs.push ("get_agent_modules_json=1");
|
|
||||||
inputs.push ("page=operation/agentes/ver_agente");
|
|
||||||
jQuery.ajax ({
|
|
||||||
data: inputs.join ("&"),
|
|
||||||
type: 'GET',
|
|
||||||
url: action="ajax.php",
|
|
||||||
timeout: 10000,
|
|
||||||
dataType: 'json',
|
|
||||||
success: function (data) {
|
|
||||||
$('#module').append ($('<option></option>').attr ('value', 0).text ("--"));
|
|
||||||
jQuery.each (data, function (i, val) {
|
|
||||||
s = js_html_entity_decode (val['nombre']);
|
|
||||||
$('#module').append ($('<option></option>').attr ('value', val['id_agente_modulo']).text (s));
|
|
||||||
});
|
|
||||||
$('#module').fadeIn ('normal');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
<?php if ($id_layout): ?>
|
|
||||||
if (lines)
|
|
||||||
draw_lines (lines, 'layout_map');
|
|
||||||
<?php endif; ?>
|
|
||||||
$('#background').change (function () {
|
|
||||||
background = this.value;
|
|
||||||
if (background == '')
|
|
||||||
return;
|
|
||||||
/* We have to get the info using AJAX because it was not
|
|
||||||
possible to kwown the image dimensions using javascript
|
|
||||||
in some cases where the image was not loaded */
|
|
||||||
jQuery.post ('ajax.php',
|
|
||||||
{"page": "godmode/reporting/map_builder",
|
|
||||||
"get_background_info": 1,
|
|
||||||
"background": background
|
|
||||||
},
|
|
||||||
function (data) {
|
|
||||||
$("#layout_map").css ('backgroundImage', 'url(images/console/background/' + background + ')');
|
|
||||||
$("#layout_map").css ('width', data['width'] + 'px');
|
|
||||||
$("#layout_map").css ('height', data['height'] + 'px');
|
|
||||||
$('#text-width').attr ('value', data['width']);
|
|
||||||
$('#text-height').attr ('value', data['height']);
|
|
||||||
},
|
|
||||||
"json"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
$('#text-width').keyup (function () {
|
|
||||||
$("#layout_map").css ('width', this.value + 'px');
|
|
||||||
});
|
|
||||||
$('#text-height').keyup (function () {
|
|
||||||
$("#layout_map").css ('height', this.value + 'px');
|
|
||||||
});
|
|
||||||
|
|
||||||
// POSSIBLE FIX THE BUG WITH ELEMENTS WITH BIG DIMENSIONS
|
|
||||||
|
|
||||||
// function testHelper() {
|
|
||||||
// obj = $('<div></div>').attr('id','helper_prueba2').attr('style','width: 100px; height: 100px; background: red;');
|
|
||||||
// return obj;
|
|
||||||
// }
|
|
||||||
// $(".layout-data").draggable ({helper: testHelper});
|
|
||||||
|
|
||||||
$(".layout-data").draggable ({helper: 'clone'});
|
|
||||||
|
|
||||||
$("#layout_map").droppable ({
|
|
||||||
accept: ".layout-data",
|
|
||||||
drop: function (ev, ui) {
|
|
||||||
margin_left = parseInt ($(ui.draggable[0]).css ('margin-left'));
|
|
||||||
margin_top = parseInt ($(ui.draggable[0]).css ('margin-top'));
|
|
||||||
coord_x = margin_left + ui.position.left;
|
|
||||||
coord_y = margin_top + ui.position.top;
|
|
||||||
$(ui.draggable[0]).css ('margin-left', coord_x + 'px');
|
|
||||||
$(ui.draggable[0]).css ('margin-top', coord_y + 'px');
|
|
||||||
id = ui.draggable[0].id.split ("-").pop ();
|
|
||||||
jQuery.post ('ajax.php',
|
|
||||||
{page: "godmode/reporting/map_builder",
|
|
||||||
update_layout_data_coords: 1,
|
|
||||||
id_layout_data: id,
|
|
||||||
coord_x: coord_x,
|
|
||||||
coord_y: coord_y
|
|
||||||
},
|
|
||||||
function () {
|
|
||||||
refresh_lines (lines, 'layout_map');
|
|
||||||
},
|
|
||||||
"html"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$("#layout_editor_drop").droppable ({
|
|
||||||
accept: ".layout-data",
|
|
||||||
drop: function (ev, ui) {
|
|
||||||
id = ui.draggable[0].id.split ("-").pop ();
|
|
||||||
jQuery.post ('ajax.php',
|
|
||||||
{"page": "godmode/reporting/map_builder",
|
|
||||||
"get_layout_data": 1,
|
|
||||||
"id_layout_data": id
|
|
||||||
},
|
|
||||||
function (data) {
|
|
||||||
$("#form_layout_data_editor #text-label").attr ('value', data['label']);
|
|
||||||
$("#form_layout_data_editor #type").attr ('value', data['type']);
|
|
||||||
$("#form_layout_data_editor #type").change ();
|
|
||||||
$("#form_layout_data_editor #image").attr ('value', data['image']);
|
|
||||||
$("#form_layout_data_editor #text-width").attr ('value', data['width']);
|
|
||||||
$("#form_layout_data_editor #text-height").attr ('value', data['height']);
|
|
||||||
$("#form_layout_data_editor #image").change ();
|
|
||||||
$("#form_layout_data_editor #id_layout_data").attr ('value', data['id']);
|
|
||||||
$("#form_layout_data_editor #period").attr ('value', data['period']);
|
|
||||||
$("#form_layout_data_editor #agent").attr ('value', data['id_agent']);
|
|
||||||
$("#form_layout_data_editor #parent_item").attr ('value', data['parent_item']);
|
|
||||||
$("#form_layout_data_editor #map_linked").attr ('value', data['id_layout_linked']);
|
|
||||||
$("#form_layout_data_editor #hidden-update_layout_data").attr ('value', 1);
|
|
||||||
$("#form_layout_data_editor #hidden-create_layout_data").attr ('value', 0);
|
|
||||||
$("#form_layout_data_editor #text-agent").attr ('value',data['name_agent']);
|
|
||||||
|
|
||||||
|
|
||||||
//Refill module select.
|
|
||||||
var data_id_agente_modulo = parseInt(data['id_agente_modulo']);
|
|
||||||
selectAgent = true;
|
|
||||||
var agent_name = $("#text-agent").val();
|
|
||||||
$('#module').fadeOut ('normal', function () {
|
|
||||||
$('#module').empty ();
|
|
||||||
var inputs = [];
|
|
||||||
inputs.push ("agent_name=" + agent_name);
|
|
||||||
inputs.push ("get_agent_modules_json=1");
|
|
||||||
inputs.push ("page=operation/agentes/ver_agente");
|
|
||||||
jQuery.ajax ({
|
|
||||||
data: inputs.join ("&"),
|
|
||||||
type: 'GET',
|
|
||||||
url: action="ajax.php",
|
|
||||||
timeout: 10000,
|
|
||||||
dataType: 'json',
|
|
||||||
success: function (data) {
|
|
||||||
$('#module').append ($('<option></option>').attr ('value', 0).text ("--"));
|
|
||||||
jQuery.each (data, function (i, val) {
|
|
||||||
var val_id_agente_modulo = parseInt(val['id_agente_modulo']);
|
|
||||||
s = js_html_entity_decode (val['nombre']);
|
|
||||||
|
|
||||||
option = $("<option></option>");
|
|
||||||
option.attr ('value', val['id_agente_modulo']).text (s);
|
|
||||||
|
|
||||||
if (val_id_agente_modulo == data_id_agente_modulo)
|
|
||||||
option.attr ('selected', 'selected');
|
|
||||||
|
|
||||||
$('#module').append (option);
|
|
||||||
|
|
||||||
});
|
|
||||||
$('#module').fadeIn ('normal');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
if (jQuery.browser.msie) {
|
|
||||||
$("#form_layout_data_editor #hidden-id_layout_data").remove ();
|
|
||||||
input = $('<input type="hidden" name="id_layout_data"></input>').attr ('value', id);
|
|
||||||
$("#form_layout_data_editor").append (input);
|
|
||||||
} else {
|
|
||||||
$("#form_layout_data_editor #hidden-id_layout_data").attr ('value', id);
|
|
||||||
}
|
|
||||||
$("#form_layout_data_editor #submit-create_layout_data_button").attr ('value', "<?php echo __('Update'); ?>").removeClass ('wand').addClass ('upd');
|
|
||||||
$("#form_layout_data_editor #text-label_color").attr ('value', data['label_color']);
|
|
||||||
$(".ColorPickerDivSample").css ('background-color', data['label_color']);
|
|
||||||
$("#form_layout_data_editor #agent").change ();
|
|
||||||
id_agent_module = data['id_agente_modulo'];
|
|
||||||
},
|
|
||||||
"json"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// DISABLE UNTIL FIX THE BUG WITH ELEMENTS WITH BIG DIMENSIONS
|
|
||||||
|
|
||||||
// $("#layout_trash_drop").droppable ({
|
|
||||||
// accept: ".layout-data",
|
|
||||||
// drop: function (ev, ui) {
|
|
||||||
// image = $('#'+ ui.draggable[0].id + " img").eq (0);
|
|
||||||
// total = $("img", this).length;
|
|
||||||
//
|
|
||||||
// id = ui.draggable[0].id.split ("-").pop ();
|
|
||||||
// $(ui.draggable[0]).clone ().css ('margin-left', 60 * total).
|
|
||||||
// css ('margin-top', 0). attr ('id', 'delete-layout-data-' + id).
|
|
||||||
// appendTo ("#"+this.id + " #elements");
|
|
||||||
// $(ui.draggable[0]).remove ();
|
|
||||||
// $('<input type="hidden" name="ids_layout_data[]"></input>').attr ('value', id).
|
|
||||||
// appendTo ($("#form_layout_data_trash"));
|
|
||||||
// $("#form_layout_data_trash #submit-delete_buttons").removeAttr ('disabled');
|
|
||||||
// setTimeout (function() { refresh_lines (lines, 'layout_map'); }, 1000);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
$("#form_layout_data_editor #image").change (function () {
|
|
||||||
$("#image_preview").empty ();
|
|
||||||
if (this.value != '') {
|
|
||||||
$("#image_preview").append ($('<img></img>').attr ('src', 'images/console/icons/' + this.value + '.png'));
|
|
||||||
$("#image_preview").append ($('<img></img>').attr ('src', 'images/console/icons/' + this.value + '_ok.png'));
|
|
||||||
$("#image_preview").append ($('<img></img>').attr ('src', 'images/console/icons/' + this.value + '_warning.png'));
|
|
||||||
$("#image_preview").append ($('<img></img>').attr ('src', 'images/console/icons/' + this.value + '_bad.png'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$("#form_layout_data_editor #agent").pandoraSelectAgentModule ({
|
|
||||||
moduleSelect: "#module",
|
|
||||||
callbackAfter : function () {
|
|
||||||
//$("#module").attr ("value", id_agent_module);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$("#form_layout_data_editor #type").change (function () {
|
|
||||||
if (this.value == 0) {
|
|
||||||
$("#table_layout_data #table_layout_data-8").fadeIn ();
|
|
||||||
} else {
|
|
||||||
$("#table_layout_data #table_layout_data-8").fadeOut ();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
$("#form_layout_data_editor #text-label_color").attachColorPicker();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
|
@ -49,11 +49,10 @@ $table->data[0][1] = print_input_text ('name', $visualConsoleName, '', 15, 50, t
|
||||||
$table->data[1][0] = __('Group:');
|
$table->data[1][0] = __('Group:');
|
||||||
$groups = get_user_groups ($config['id_user']);
|
$groups = get_user_groups ($config['id_user']);
|
||||||
$table->data[1][1] = print_select ($groups, 'id_group', $idGroup, '', '', '', true);
|
$table->data[1][1] = print_select ($groups, 'id_group', $idGroup, '', '', '', true);
|
||||||
$table->data[2][0] = '';
|
|
||||||
$backgrounds_list = list_files ('images/console/background/', "jpg", 1, 0);
|
$backgrounds_list = list_files ('images/console/background/', "jpg", 1, 0);
|
||||||
$backgrounds_list = array_merge ($backgrounds_list, list_files ('images/console/background/', "png", 1, 0));
|
$backgrounds_list = array_merge ($backgrounds_list, list_files ('images/console/background/', "png", 1, 0));
|
||||||
$table->data[3][0] = __('Background');
|
$table->data[2][0] = __('Background');
|
||||||
$table->data[3][1] = print_select ($backgrounds_list, 'background', $background, '', 'None', '', true);
|
$table->data[2][1] = print_select ($backgrounds_list, 'background', $background, '', 'None', '', true);
|
||||||
if ($action == 'new') {
|
if ($action == 'new') {
|
||||||
$textButtonSubmit = __('Save');
|
$textButtonSubmit = __('Save');
|
||||||
$classButtonSubmit = 'sub wand';
|
$classButtonSubmit = 'sub wand';
|
||||||
|
@ -62,10 +61,12 @@ else {
|
||||||
$textButtonSubmit = __('Update');
|
$textButtonSubmit = __('Update');
|
||||||
$classButtonSubmit = 'sub upd';
|
$classButtonSubmit = 'sub upd';
|
||||||
}
|
}
|
||||||
$table->rowstyle[4] = "text-align: right;";
|
|
||||||
$table->data[4][0] = '';
|
|
||||||
$table->data[4][1] = print_submit_button ($textButtonSubmit, 'update_layout', false, 'class="' . $classButtonSubmit . '"', true);
|
|
||||||
|
|
||||||
print_table($table);
|
print_table($table);
|
||||||
|
|
||||||
|
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||||
|
print_submit_button ($textButtonSubmit, 'update_layout', false, 'class="' . $classButtonSubmit . '"');
|
||||||
|
echo '</div>';
|
||||||
|
|
||||||
echo "</form>";
|
echo "</form>";
|
||||||
?>
|
?>
|
|
@ -63,42 +63,26 @@ $intervals[29030400] = "6 ".__('months');
|
||||||
|
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->head = array ();
|
$table->head = array ();
|
||||||
$table->head[0] = __('Label') . ' / ' . __('Type') . ' / ' . __('Parent');
|
$table->head['icon'] = '';
|
||||||
$table->head[1] = __('Image') . ' / ' . __('Agent') . ' / ' . __('Map linked');
|
$table->head[0] = __('Label') . ' / ' . __('Agent');
|
||||||
$table->head[2] = __('Height / Max value') . ' / ' . __('Module') . ' / ' . __('Label color');
|
$table->head[1] = __('Image') . ' / ' . __('Module');
|
||||||
$table->head[3] = __('Width') . ' / ' . __('Period');
|
$table->head[2] = __('Width x Height - Max value');
|
||||||
$table->head[4] = __('Left');
|
$table->head[3] = __('Period') . ' / ' . __('Position');
|
||||||
$table->head[5] = __('Top');
|
$table->head[4] = __('Parent') . ' / ' . __('Map linked');
|
||||||
$table->head[6] = __('Action');
|
$table->head[5] = __('Action');
|
||||||
|
|
||||||
$table->data = array();
|
$table->data = array();
|
||||||
|
|
||||||
//Background
|
//Background
|
||||||
|
$table->data[0]['icon'] = '';
|
||||||
$table->data[0][0] = __('Background');
|
$table->data[0][0] = __('Background');
|
||||||
$table->data[0][1] = print_select($backgrounds_list, 'background', $visualConsole['background'], '', 'None', '', true);
|
$table->data[0][1] = print_select($backgrounds_list, 'background', $visualConsole['background'], '', 'None', '', true, false, true, '', false, 'width: 100px;');
|
||||||
$table->data[0][2] = print_input_text('width', $visualConsole['width'], '', 3, 5, true);
|
$table->data[0][2] = print_input_text('width', $visualConsole['width'], '', 3, 5, true) .
|
||||||
$table->data[0][3] = print_input_text('height', $visualConsole['height'], '', 3, 5, true);
|
'x' .
|
||||||
$table->data[0][4] = '';
|
print_input_text('height', $visualConsole['height'], '', 3, 5, true);
|
||||||
$table->data[0][5] = '';
|
$table->data[0][3] = $table->data[0][4] = $table->data[0][5] = '';
|
||||||
$table->data[0][6] = '';
|
|
||||||
|
|
||||||
$table->data[1][0] = __('Background');
|
$i = 1;
|
||||||
$table->data[1][1] = '';
|
|
||||||
$table->data[1][2] = '';
|
|
||||||
$table->data[1][3] = '';
|
|
||||||
$table->data[1][4] = '';
|
|
||||||
$table->data[1][5] = '';
|
|
||||||
$table->data[1][6] = '';
|
|
||||||
|
|
||||||
$table->data[2][0] = '';
|
|
||||||
$table->data[2][1] = '';
|
|
||||||
$table->data[2][2] = '';
|
|
||||||
$table->data[2][3] = '';
|
|
||||||
$table->data[2][4] = '';
|
|
||||||
$table->data[2][5] = '';
|
|
||||||
$table->data[2][6] = '';
|
|
||||||
|
|
||||||
$i = 2;
|
|
||||||
$layoutDatas = get_db_all_rows_field_filter ('tlayout_data', 'id_layout', $idVisualConsole);
|
$layoutDatas = get_db_all_rows_field_filter ('tlayout_data', 'id_layout', $idVisualConsole);
|
||||||
if ($layoutDatas === false)
|
if ($layoutDatas === false)
|
||||||
$layoutDatas = array();
|
$layoutDatas = array();
|
||||||
|
@ -107,55 +91,71 @@ $alternativeStyle = true;
|
||||||
foreach ($layoutDatas as $layoutData) {
|
foreach ($layoutDatas as $layoutData) {
|
||||||
$idLayoutData = $layoutData['id'];
|
$idLayoutData = $layoutData['id'];
|
||||||
|
|
||||||
$table->data[$i][0] = print_input_text ('label_' . $idLayoutData, $layoutData['label'], '', 20, 200, true);
|
//line between rows
|
||||||
|
$table->data[$i][0] = '<hr>';
|
||||||
|
$table->colspan[$i][0] = '8';
|
||||||
|
|
||||||
|
switch ($layoutData['type']) {
|
||||||
|
case STATIC_GRAPH:
|
||||||
|
$table->data[$i + 1]['icon'] = print_image('images/camera.png', true);
|
||||||
|
break;
|
||||||
|
case PERCENTILE_BAR:
|
||||||
|
$table->data[$i + 1]['icon'] = print_image('images/chart_bar.png', true);
|
||||||
|
break;
|
||||||
|
case MODULE_GRAPH:
|
||||||
|
$table->data[$i + 1]['icon'] = print_image('images/chart_curve.png', true);
|
||||||
|
break;
|
||||||
|
case SIMPLE_VALUE:
|
||||||
|
$table->data[$i + 1]['icon'] = print_image('images/binary.png', true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$table->data[$i + 1]['icon'] = '';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$table->data[$i + 1][0] = '<span style="width: 130px; display: block;">' .
|
||||||
|
print_input_text ('label_' . $idLayoutData, $layoutData['label'], '', 10, 200, true) .
|
||||||
|
print_input_text_extended ('label_color_' . $idLayoutData, $layoutData['label_color'], 'text-'.'label_color_' . $idLayoutData, '', 7, 7, false, '', 'style="visibility: hidden; width: 0px;" class="label_color"', true) .
|
||||||
|
'</span>';
|
||||||
if ($layoutData['type'] == STATIC_GRAPH) {
|
if ($layoutData['type'] == STATIC_GRAPH) {
|
||||||
$table->data[$i][1] = print_select ($images_list, 'image_' . $idLayoutData, $layoutData['image'], '', 'None', '', true);
|
$table->data[$i + 1][1] = print_select ($images_list, 'image_' . $idLayoutData, $layoutData['image'], '', 'None', '', true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$table->data[$i][1] = '';
|
$table->data[$i + 1][1] = '';
|
||||||
}
|
}
|
||||||
$table->data[$i][2] = print_input_text('width_' . $idLayoutData, $layoutData['width'], '', 3, 5, true);
|
$table->data[$i + 1][2] = print_input_text('width_' . $idLayoutData, $layoutData['width'], '', 3, 5, true) .
|
||||||
$table->data[$i][3] = print_input_text('height_' . $idLayoutData, $layoutData['height'], '', 3, 5, true);
|
'x' .
|
||||||
$table->data[$i][4] = print_input_text('left_' . $idLayoutData, $layoutData['pos_x'], '', 3, 5, true);
|
print_input_text('height_' . $idLayoutData, $layoutData['height'], '', 3, 5, true);
|
||||||
$table->data[$i][5] = print_input_text('top_' . $idLayoutData, $layoutData['pos_y'], '', 3, 5, true);
|
$table->data[$i + 1][3] = '(' . print_input_text('left_' . $idLayoutData, $layoutData['pos_x'], '', 3, 5, true) .
|
||||||
$table->data[$i][6] = '<a href="index.php?sec=gmap&sec2=godmode/reporting/visual_console_builder&tab=' .
|
',' . print_input_text('top_' . $idLayoutData, $layoutData['pos_y'], '', 3, 5, true) .
|
||||||
|
')';
|
||||||
|
$table->data[$i + 1][4] = print_select_from_sql ('SELECT id, label FROM tlayout_data WHERE id_layout = '. $idVisualConsole . ' AND id !=' . $idLayoutData,
|
||||||
|
'parent_' . $idLayoutData, $layoutData['parent_item'], '', 'None', 0, true);
|
||||||
|
$table->data[$i + 1][5] = '<a href="index.php?sec=gmap&sec2=godmode/reporting/visual_console_builder&tab=' .
|
||||||
$activeTab . '&action=delete&id_visual_console=' . $visualConsole["id"] . '&id_element=' . $idLayoutData . '" ' .
|
$activeTab . '&action=delete&id_visual_console=' . $visualConsole["id"] . '&id_element=' . $idLayoutData . '" ' .
|
||||||
'onclick="javascript: if (!confirm(\'' . __('Are you sure?') . '\')) return false;"><img src="images/cross.png" /></a>';
|
'onclick="javascript: if (!confirm(\'' . __('Are you sure?') . '\')) return false;"><img src="images/cross.png" /></a>';
|
||||||
|
|
||||||
$table->data[$i + 1][0] = $layoutDataTypes[$layoutData['type']];
|
$table->data[$i + 2]['icon'] = '';
|
||||||
$table->data[$i + 1][1] = print_input_text_extended ('agent_' . $idLayoutData, get_agent_name($layoutData['id_agent']), 'text-agent_' . $idLayoutData, '', 25, 100, false, '',
|
$table->data[$i + 2][0] = '<a href="#" class="tip"> <span>' . __("Type at least two characters to search.") . '</span></a>' . print_input_text_extended ('agent_' . $idLayoutData, get_agent_name($layoutData['id_agent']), 'text-agent_' . $idLayoutData, '', 15, 100, false, '',
|
||||||
array('class' => 'text-agent', 'style' => 'background: #ffffff url(images/lightning.png) no-repeat right;'), true);
|
array('class' => 'text-agent', 'style' => 'background: #ffffff url(images/lightning.png) no-repeat right;'), true);
|
||||||
$table->data[$i + 1][2] = print_select_from_sql('SELECT id_agente_modulo, nombre FROM tagente_modulo WHERE id_agente = ' . $layoutData['id_agent'],
|
$table->data[$i + 2][1] = print_select_from_sql('SELECT id_agente_modulo, nombre FROM tagente_modulo WHERE id_agente = ' . $layoutData['id_agent'],
|
||||||
'module_' . $idLayoutData, $layoutData['id_agente_modulo'], '', '---', 0, true);
|
'module_' . $idLayoutData, $layoutData['id_agente_modulo'], '', '---', 0, true);
|
||||||
|
$table->data[$i + 2][2] = '';
|
||||||
if ($layoutData['type'] == MODULE_GRAPH) {
|
if ($layoutData['type'] == MODULE_GRAPH) {
|
||||||
$table->data[$i + 1][3] = print_select ($intervals, 'period_' . $idLayoutData, $layoutData['period'], '', '--', 0, true);
|
$table->data[$i + 2][3] = print_select ($intervals, 'period_' . $idLayoutData, $layoutData['period'], '', '--', 0, true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$table->data[$i + 1][3] = '';
|
$table->data[$i + 2][3] = '';
|
||||||
}
|
}
|
||||||
$table->data[$i + 1][4] = '';
|
$table->data[$i + 2][4] = print_select_from_sql ('SELECT id, name FROM tlayout WHERE id != ' . $idVisualConsole,
|
||||||
$table->data[$i + 1][5] = '';
|
|
||||||
$table->data[$i + 1][6] = '';
|
|
||||||
|
|
||||||
$table->data[$i + 2][0] = print_select_from_sql ('SELECT id, label FROM tlayout_data WHERE id_layout = '. $idVisualConsole . ' AND id !=' . $idLayoutData,
|
|
||||||
'parent_' . $idLayoutData, $layoutData['parent_item'], '', 'None', 0, true);
|
|
||||||
$table->data[$i + 2][1] = print_select_from_sql ('SELECT id, name FROM tlayout WHERE id != ' . $idVisualConsole,
|
|
||||||
'map_linked_' . $idLayoutData, $layoutData['id_layout_linked'], '', 'None', '', true);
|
'map_linked_' . $idLayoutData, $layoutData['id_layout_linked'], '', 'None', '', true);
|
||||||
//$table->data[$i + 2][2] = print_input_text ('label_color_' . $idLayoutData, '#000000', $layoutData['label_color'], 7, 7, true);
|
|
||||||
$table->data[$i + 2][2] = print_input_text_extended ('label_color_' . $idLayoutData, $layoutData['label_color'], 'text-'.'label_color_' . $idLayoutData
|
|
||||||
, '', 7, 7, false, '', 'class="label_color"', true);
|
|
||||||
$table->data[$i + 2][3] = '';
|
|
||||||
$table->data[$i + 2][4] = '';
|
|
||||||
$table->data[$i + 2][5] = '';
|
$table->data[$i + 2][5] = '';
|
||||||
$table->data[$i + 2][6] = '';
|
|
||||||
|
|
||||||
if ($alternativeStyle) {
|
if ($alternativeStyle) {
|
||||||
$table->rowclass[$i] = 'rowOdd';
|
|
||||||
$table->rowclass[$i + 1] = 'rowOdd';
|
$table->rowclass[$i + 1] = 'rowOdd';
|
||||||
$table->rowclass[$i + 2] = 'rowOdd';
|
$table->rowclass[$i + 2] = 'rowOdd';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$table->rowclass[$i] = 'rowPair';
|
|
||||||
$table->rowclass[$i + 1] = 'rowPair';
|
$table->rowclass[$i + 1] = 'rowPair';
|
||||||
$table->rowclass[$i + 2] = 'rowPair';
|
$table->rowclass[$i + 2] = 'rowPair';
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,11 +155,12 @@ function print_select_style ($fields, $name, $selected = '', $style='', $script
|
||||||
* @param bool Whether to return an output string or echo now (optional, echo by default).
|
* @param bool Whether to return an output string or echo now (optional, echo by default).
|
||||||
* @param bool Set the input to allow multiple selections (optional, single selection by default).
|
* @param bool Set the input to allow multiple selections (optional, single selection by default).
|
||||||
* @param bool Whether to sort the options or not (optional, unsorted by default).
|
* @param bool Whether to sort the options or not (optional, unsorted by default).
|
||||||
|
* @param string $style The string of style.
|
||||||
*
|
*
|
||||||
* @return string HTML code if return parameter is true.
|
* @return string HTML code if return parameter is true.
|
||||||
*/
|
*/
|
||||||
function print_select ($fields, $name, $selected = '', $script = '', $nothing = '', $nothing_value = 0, $return = false,
|
function print_select ($fields, $name, $selected = '', $script = '', $nothing = '', $nothing_value = 0, $return = false,
|
||||||
$multiple = false, $sort = true, $class = '', $disabled = false) {
|
$multiple = false, $sort = true, $class = '', $disabled = false, $style = false) {
|
||||||
|
|
||||||
$output = "\n";
|
$output = "\n";
|
||||||
|
|
||||||
|
@ -188,7 +189,14 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing =
|
||||||
$attributes .= ' disabled="disabled"';
|
$attributes .= ' disabled="disabled"';
|
||||||
}
|
}
|
||||||
|
|
||||||
$output .= '<select id="'.$id.'" name="'.$name.'"'.$attributes.'>';
|
if ($style === false) {
|
||||||
|
$styleText = '';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$styleText = 'style="' . $style . '"';
|
||||||
|
}
|
||||||
|
|
||||||
|
$output .= '<select id="'.$id.'" name="'.$name.'"'.$attributes.' ' . $styleText . '>';
|
||||||
|
|
||||||
if ($nothing != '' || empty ($fields)) {
|
if ($nothing != '' || empty ($fields)) {
|
||||||
if ($nothing == '') {
|
if ($nothing == '') {
|
||||||
|
@ -474,11 +482,19 @@ function print_input_image ($name, $src, $value, $style = '', $return = false, $
|
||||||
* @param string $name Input name.
|
* @param string $name Input name.
|
||||||
* @param string $value Input value.
|
* @param string $value Input value.
|
||||||
* @param bool $return Whether to return an output string or echo now (optional, echo by default).
|
* @param bool $return Whether to return an output string or echo now (optional, echo by default).
|
||||||
|
* @param string $class Set the class of input.
|
||||||
*
|
*
|
||||||
* @return string HTML code if return parameter is true.
|
* @return string HTML code if return parameter is true.
|
||||||
*/
|
*/
|
||||||
function print_input_hidden ($name, $value, $return = false) {
|
function print_input_hidden ($name, $value, $return = false, $class = false) {
|
||||||
$output = '<input id="hidden-'.$name.'" name="'.$name.'" type="hidden" value="'.$value.'" />';
|
if ($class !== false) {
|
||||||
|
$classText = 'class="' . $class . '"';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$classText = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$output = '<input id="hidden-' . $name . '" name="' . $name . '" type="hidden" ' . $classText . ' value="' . $value . '" />';
|
||||||
|
|
||||||
if ($return)
|
if ($return)
|
||||||
return $output;
|
return $output;
|
||||||
|
|
Loading…
Reference in New Issue