Browse Source

dashboard : live

carruesco 2 years ago
parent
commit
2dd32c9a24

+ 1 - 0
plugin/dashboard/DashboardWidget.class.php

@@ -19,6 +19,7 @@ class DashboardWidget extends Entity{
 
 
 	public $refresh;
+	public $live = false;
 
 	public $icon;
 	public $iconColor;

+ 2 - 1
plugin/dashboard/action.php

@@ -150,9 +150,10 @@ Action::register('dashboard_widget_refresh',function(&$response){
 	}
 
 	foreach(DashboardWidget::model() as $model){
-		if(!isset($model->content) || is_string($model->content) || !isset($widgets[$model->model]) ) continue;
+		if(!isset($model->content) || !$model->live || is_string($model->content) || !isset($widgets[$model->model]) ) continue;
 	
 		foreach($widgets[$model->model] as $currentWidget){
+			$oldWidget = clone $currentWidget;
 			$model->refresh($currentWidget);
 			$response['rows'][] = $currentWidget;
 		}

+ 1 - 0
plugin/dashboard/dashboard.plugin.php

@@ -218,6 +218,7 @@ Plugin::addHook('widget',function(&$models){
 		$model->model = 'clock';
 		$model->css = array(__DIR__.'/css/widget-clock.css?v='.time());
 		$model->js = array(__DIR__.'/js/widget-clock.js?v='.time());
+		$model->live = true;
 		
 		$model->content = function(&$widget){
 			if(empty($widget->meta['hour-format'])) $widget->meta['hour-format'] = 'H:i:s';

+ 1 - 0
plugin/navigation/navigation.plugin.php

@@ -263,6 +263,7 @@ Plugin::addHook('widget',function(&$models){
 		$model->css = array(__DIR__.'/css/widget.css?v='.time());
 		$model->js = array(__DIR__.'/js/widget.js?v='.time());
 		
+		
 		$model->content = function(&$widget){
 			global $myUser;
 			User::check_access('navigation','read');