diff --git a/html/ajax_dash.php b/html/ajax_dash.php
index a26e46e5a7..ec88e68eca 100644
--- a/html/ajax_dash.php
+++ b/html/ajax_dash.php
@@ -30,23 +30,30 @@ $type = mres($_POST['type']);
if ($type == 'placeholder') {
$output = 'Please add a Widget to get started';
$status = 'ok';
+ $title = 'Placeholder';
}
elseif (is_file('includes/common/'.$type.'.inc.php')) {
$results_limit = 10;
$no_form = true;
+ $title = ucfirst($type);
+ $unique_id = str_replace(array("-","."),"_",uniqid($type,true));
$widget_id = mres($_POST['id']);
$widget_settings = json_decode(dbFetchCell('select settings from users_widgets where user_widget_id = ?',array($widget_id)),true);
- $widget_dimensions = dbfetchRow('select size_x,size_y from users_widgets where user_widget_id = ?',array($widget_id));
+ $widget_dimensions = $_POST['dimensions'];
+ if( !empty($_POST['settings']) ) {
+ define('show_settings',true);
+ }
include 'includes/common/'.$type.'.inc.php';
$output = implode('', $common_output);
$status = 'ok';
-
+ $title = $widget_settings['title'] ?: $title;
}
$response = array(
'status' => $status,
'html' => $output,
+ 'title' => $title,
);
echo _json_encode($response);
diff --git a/html/includes/common/generic-graph.inc.php b/html/includes/common/generic-graph.inc.php
index b6e5773eee..9d79fff228 100644
--- a/html/includes/common/generic-graph.inc.php
+++ b/html/includes/common/generic-graph.inc.php
@@ -22,13 +22,13 @@
* @subpackage Widgets
*/
-if( empty($widget_settings) ) {
+if( defined('show_settings') || empty($widget_settings) ) {
$common_output[] = '
+
+';
}
else {
$widget_settings['device_id'] = dbFetchCell('select device_id from devices where hostname = ?',array($widget_settings['graph_device']));
- $common_output[] = "".$widget_settings['graph_device']." / ".$widget_settings['graph_type']."";
- $common_output[] = generate_minigraph_image(array('device_id'=>(int) $widget_settings['device_id']), $config['time']['day'], $config['time']['now'], $widget_settings['graph_type'], $widget_settings['graph_legend'] == 1 ? 'yes' : 'no', $widget_settings['graph_width'], $widget_settings['graph_height'], '&', $widget_settings['graph_type']);
+ $widget_settings['title'] = $widget_settings['graph_device']." / ".$widget_settings['graph_type'];
+ $common_output[] = generate_minigraph_image(
+ array('device_id'=>(int) $widget_settings['device_id']),
+ $config['time']['day'],
+ $config['time']['now'],
+ $widget_settings['graph_type'],
+ $widget_settings['graph_legend'] == 1 ? 'yes' : 'no',
+ $widget_dimensions['x'],
+ $widget_dimensions['y'],
+ '&',
+ 'minigraph-image',
+ 1
+ );
}
?>
diff --git a/html/includes/forms/update-dashboard-config.inc.php b/html/includes/forms/update-dashboard-config.inc.php
index fd6dc18a4c..de278fd918 100644
--- a/html/includes/forms/update-dashboard-config.inc.php
+++ b/html/includes/forms/update-dashboard-config.inc.php
@@ -25,7 +25,7 @@ elseif ($sub_type == 'add' && is_numeric($widget_id)) {
list($x,$y) = explode(',',$widget['base_dimensions']);
$item_id = dbInsert(array('user_id'=>$_SESSION['user_id'],'widget_id'=>$widget_id, 'col'=>1,'row'=>1,'refresh'=>60,'title'=>$widget['widget_title'],'size_x'=>$x,'size_y'=>$y),'users_widgets');
if (is_numeric($item_id)) {
- $extra = array('widget_id'=>$item_id,'title'=>$widget['widget_title'],'widget'=>$widget['widget'],'size_x'=>$x,'size_y'=>$y);
+ $extra = array('user_widget_id'=>$item_id,'widget_id'=>$item_id,'title'=>$widget['widget_title'],'widget'=>$widget['widget'],'refresh'=>60,'size_x'=>$x,'size_y'=>$y);
$status = 'ok';
$message = '';
}
diff --git a/html/pages/front/tiles.php b/html/pages/front/tiles.php
index 063b4bba62..5c6effb1e7 100644
--- a/html/pages/front/tiles.php
+++ b/html/pages/front/tiles.php
@@ -103,31 +103,25 @@ foreach (dbFetchRows("SELECT * FROM `widgets` ORDER BY `widget_title`") as $widg
},
resize: {
enabled: true,
- stop: function(e, ui, $widget) {
+ stop: function(e, ui, widget) {
updatePos(gridster);
+ widget_reload(widget.attr('id'),widget.data('type'));
}
},
- serialize_params: function($w, wgd) {
- return {
- id: $($w).attr('id'),
- col: wgd.col,
- row: wgd.row,
- size_x: wgd.size_x,
- size_y: wgd.size_y
+ serialize_params: function(w, wgd) {
+ return {
+ id: $(w).attr('id'),
+ col: wgd.col,
+ row: wgd.row,
+ size_x: wgd.size_x,
+ size_y: wgd.size_y
};
}
}).data('gridster');
gridster.remove_all_widgets();
$.each(serialization, function() {
- gridster.add_widget(
- ''+
- '\