New maps in progress... (Creation, edit and list mode)
This commit is contained in:
parent
65411abc8f
commit
d65ab71600
|
@ -22,7 +22,8 @@
|
|||
*/
|
||||
|
||||
function maps_save_map($values) {
|
||||
return db_process_sql_insert('tmap', $values);
|
||||
$result_add = db_process_sql_insert('tmap', $values);
|
||||
return $result_add;
|
||||
}
|
||||
|
||||
function maps_get_maps($filter) {
|
||||
|
@ -51,18 +52,19 @@ function maps_get_subtype_string($subtype) {
|
|||
|
||||
function maps_duplicate_map($id) {
|
||||
global $config;
|
||||
$map = db_get_sql("SELECT * FROM tmap WHERE id = " . $id);
|
||||
$result = 0;
|
||||
$map = db_get_all_rows_sql("SELECT * FROM tmap WHERE id = " . $id);
|
||||
$result = false;
|
||||
$map = $map[0];
|
||||
if (!empty($map)) {
|
||||
$map_names = db_get_all_rows_sql("SELECT name FROM tmap WHERE name LIKE '" . $map['name'] . "%'");
|
||||
$map_names = db_get_row_sql("SELECT name FROM tmap WHERE name LIKE '" . $map['name'] . "%'");
|
||||
$index = 0;
|
||||
foreach ($map_names as $map_name) {
|
||||
$index++;
|
||||
}
|
||||
$map['name'] = $map['name'] . '_' . $index;
|
||||
$new_name = $map['name'] . '_' . $index;
|
||||
$result = db_process_sql_insert('tmap', array('id_group' => $map['id_group'],
|
||||
'id_user' => $config['id_user'], 'type' => $map['type'], 'subtype' => $map['subtype'],
|
||||
'name' => $map['name'], 'description' => $map['description'], 'width' => $map['width'],
|
||||
'name' => $new_name, 'description' => $map['description'], 'width' => $map['width'],
|
||||
'height' => $map['height'], 'center_x' => $map['center_x'], 'center_y' => $map['center_y'],
|
||||
'background' => $map['background'], 'background_options' => $map['background_options'],
|
||||
'source_period' => $map['source_period'], 'source' => $map['source'],
|
||||
|
@ -74,7 +76,8 @@ function maps_duplicate_map($id) {
|
|||
|
||||
function maps_delete_map($id) {
|
||||
$where = 'id=' . $id;
|
||||
db_process_sql_delete('tmap', $where);
|
||||
$result = db_process_sql_delete('tmap', $where);
|
||||
return (int)$result;
|
||||
}
|
||||
|
||||
function maps_get_count_nodes($id) {
|
||||
|
|
|
@ -195,9 +195,10 @@ else {
|
|||
$table->data[14][1] = html_print_input_text ('text', $text, '', 20,
|
||||
10,true);
|
||||
|
||||
echo '<form method="post" action="index.php?sec=maps&sec2=operation/maps/networkmap_list">';
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
echo '<form method="post" action="index.php?sec=maps&sec2=operation/maps/networkmap_list">';
|
||||
echo "<div style='width: " . $table->width . "; text-align: right;'>";
|
||||
if ($create_networkmap) {
|
||||
html_print_input_hidden ('save_networkmap', 1);
|
||||
|
|
|
@ -108,6 +108,7 @@ if ($save_networkmap) {
|
|||
|
||||
$values = array();
|
||||
$values['name'] = $name;
|
||||
$values['id_user'] = $config['id_user'];
|
||||
$values['id_group'] = $id_group;
|
||||
$values['subtype'] = $subtype;
|
||||
$values['type'] = $$type;
|
||||
|
@ -127,9 +128,14 @@ if ($save_networkmap) {
|
|||
$filter['id_tag'] = $id_tag;
|
||||
$filter['text'] = $text;
|
||||
$values['filter'] = json_encode($filter);
|
||||
|
||||
$result_add = false;
|
||||
if (!empty($name)) {
|
||||
$networkmap_names = db_get_all_rows_sql("SELECT name FROM tmap");
|
||||
foreach ($networkmap_names as $networkmap_name) {
|
||||
if ($networkmap_name == $name) {
|
||||
$same_name = true;
|
||||
}
|
||||
}
|
||||
html_debug($values);
|
||||
if (!empty($name) && !$same_name) {
|
||||
$result_add = maps_save_map($values);
|
||||
}
|
||||
|
||||
|
@ -185,7 +191,7 @@ else if ($delete_networkmap || $duplicate_networkmap || $update_networkmap) {
|
|||
else if ($duplicate_networkmap) {
|
||||
$result_duplicate = maps_duplicate_map($id);
|
||||
|
||||
ui_print_result_message ($result,
|
||||
ui_print_result_message ($result_duplicate,
|
||||
__('Successfully duplicate'),
|
||||
__('Could not be duplicate'));
|
||||
}
|
||||
|
@ -240,37 +246,22 @@ else if ($delete_networkmap || $duplicate_networkmap || $update_networkmap) {
|
|||
$table = new stdClass();
|
||||
$table->width = "100%";
|
||||
$table->class = "databox data";
|
||||
$table->headstyle['name'] = 'text-align: center;';
|
||||
$table->headstyle['type'] = 'text-align: center;';
|
||||
if (enterprise_installed()) {
|
||||
$table->headstyle['nodes'] = 'text-align: center;';
|
||||
}
|
||||
$table->headstyle['group'] = 'text-align: center;';
|
||||
$table->headstyle['copy'] = 'text-align: center;';
|
||||
$table->headstyle['edit'] = 'text-align: center;';
|
||||
$table->headstyle['delete'] = 'text-align: center;';
|
||||
|
||||
$table->style = array();
|
||||
$table->style['name'] = 'text-align: left;';
|
||||
$table->style['type'] = 'text-align: center;';
|
||||
$table->style['type'] = 'text-align: left;';
|
||||
if (enterprise_installed()) {
|
||||
$table->style['nodes'] = 'text-align: center;';
|
||||
$table->style['nodes'] = 'text-align: left;';
|
||||
}
|
||||
$table->style['group'] = 'text-align: center;';
|
||||
$table->style['copy'] = 'text-align: center;';
|
||||
$table->style['edit'] = 'text-align: center;';
|
||||
$table->style['delete'] = 'text-align: center;';
|
||||
$table->style['copy'] = 'text-align: left;';
|
||||
$table->style['edit'] = 'text-align: left;';
|
||||
$table->style['delete'] = 'text-align: left;';
|
||||
|
||||
$table->size = array();
|
||||
$table->size['name'] = '60%';
|
||||
$table->size['type'] = '30px';
|
||||
if (enterprise_installed()) {
|
||||
$table->size['nodes'] = '30px';
|
||||
}
|
||||
$table->size['group'] = '30px';
|
||||
$table->size['copy'] = '30px';
|
||||
$table->size['edit'] = '30px';
|
||||
$table->size['delete'] = '30px';
|
||||
$table->size[0] = '60%';
|
||||
$table->size[1] = '60px';
|
||||
$table->size[2] = '70px';
|
||||
|
||||
$table->head = array();
|
||||
$table->head['name'] = __('Name');
|
||||
|
|
Loading…
Reference in New Issue