Browse Source

- Fix RPC Cache handling system

pull/5/head
Jaussoin Timothée 14 years ago
parent
commit
3f9fec852f
  1. 2
      system/RPC.php
  2. 4
      system/Widget/WidgetBase.php
  3. 17
      system/Widget/WidgetWrapper.php
  4. 2
      system/Widget/widgets/Notifs/Notifs.php
  5. 2
      system/Widget/widgets/Roster/roster.css

2
system/RPC.php

@ -96,7 +96,7 @@ class RPC
// We cache the widgets
$widgets = WidgetWrapper::getInstance(false);
foreach($widgets->get_loaded_widgets() as $widget_name)
foreach($widgets->get_registered_widgets() as $widget_name)
$widgets->run_widget($widget_name, 'saveCache');
} else {
$xml = file_get_contents('php://input');

4
system/Widget/WidgetBase.php

@ -117,7 +117,7 @@ class WidgetBase
ob_start();
$this->build();
$out = ob_get_clean();
fwrite($fp, $out);
fwrite($fp, trim(preg_replace( '/\s+/', ' ',$out)));
fclose($fp);
}
}
@ -137,7 +137,7 @@ class WidgetBase
ob_start();
$this->build();
$out = ob_get_clean();
fwrite($fp, $out);
fwrite($fp, trim(preg_replace( '/\s+/', ' ',$out)));
fclose($fp);
echo $out;
}

17
system/Widget/WidgetWrapper.php

@ -45,6 +45,15 @@ class WidgetWrapper
if(is_array($widgets)) {
$this->loaded_widgets_old = $widgets;
}
$this->register_widgets = array();
$widgets_dir = scandir(LIB_PATH ."Widget/widgets/");
foreach($widgets_dir as $widget_dir) {
if(is_dir(LIB_PATH ."Widget/widgets/".$widget_dir) &&
$widget_dir != '..' &&
$widget_dir != '.')
array_push($this->register_widgets, $widget_dir);
}
}
static function getInstance($register = true)
@ -52,6 +61,7 @@ class WidgetWrapper
if(!is_object(self::$instance)) {
self::$instance = new WidgetWrapper($register);
}
//movim_log(self::$instance);
return self::$instance;
}
@ -90,6 +100,11 @@ class WidgetWrapper
}
}
function get_registered_widgets()
{
return $this->register_widgets;
}
function set_cached_widget($widget_name)
{
//if(in_array($widget_name, $this->loaded_widgets))
@ -143,7 +158,7 @@ class WidgetWrapper
*/
function run_widget($widget_name, $method, array $params = NULL)
{
if($this->register_widgets &&
if(//$this->register_widgets &&
!in_array($widget_name, $this->loaded_widgets)) {
$this->loaded_widgets[] = $widget_name;
}

2
system/Widget/widgets/Notifs/Notifs.php

@ -27,8 +27,6 @@ class Notifs extends WidgetBase
$this->registerEvent('message', 'onMessage');
$this->registerEvent('subscribe', 'onSubscribe');
$this->cached = true;
}
function onMessage($message) {

2
system/Widget/widgets/Roster/roster.css

@ -65,7 +65,7 @@
#roster ul li a {
display: block;
white-space: nowrap;
width: 150px;
width: 145px;
overflow: hidden;
text-overflow: ellipsis;
}

Loading…
Cancel
Save