From 88552650a0b06cb50c82ea8b03e5e74d608f2964 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Wed, 28 Dec 2011 22:55:11 +0100 Subject: [PATCH 1/2] JY changes --- lib/classes/task/manager.class.php | 39 ++ templates/web/admin/task.html | 827 +++++++++++++++-------------- www/admin/taskmanager.php | 30 +- 3 files changed, 458 insertions(+), 438 deletions(-) diff --git a/lib/classes/task/manager.class.php b/lib/classes/task/manager.class.php index 6c5c69ad37..51767999d7 100644 --- a/lib/classes/task/manager.class.php +++ b/lib/classes/task/manager.class.php @@ -112,5 +112,44 @@ class task_manager return $row; } + + public static function getAvailableTasks() + { + $registry = registry::get_instance(); + $taskdir = array( $registry->get('GV_RootPath') . "lib/classes/task/period/" + , $registry->get('GV_RootPath') . "config/classes/task/period/" + ); + $tasks = array(); + foreach($taskdir as $path) + { + if( ($hdir = @opendir($path)) ) + { + $tskin = array(); + $max = 9999; + while (($max-- > 0) && (($file = readdir($hdir)) !== false)) + { + if (!is_file($path . '/' . $file) || substr($file, 0, 1) == "." || substr($file, -10) != ".class.php") + continue; + + $classname = 'task_period_' . substr($file, 0, strlen($file) - 10); + + try + { + // $testclass = new $classname(null); + if ($classname::interfaceAvailable()) + { + $tasks[] = array("class" => $classname, "name" => $classname::getName(), "err" => null); + } + } + catch (Exception $e) + { + + } + } + closedir($hdir); + } + } + return $tasks; + } } diff --git a/templates/web/admin/task.html b/templates/web/admin/task.html index eb35b69976..34ffc87d5d 100644 --- a/templates/web/admin/task.html +++ b/templates/web/admin/task.html @@ -1,440 +1,449 @@ - - - - - {{task.printInterfaceHEAD()}} - - + + + - - {{task.printInterfaceJS()}} - + + + {{task.printInterfaceJS()}} + - + - -
-

{{task.getName()}} id : {{task.get_task_id()}}

-
- - - - -
-
- {% trans 'admin::tasks: Nombre de crashes : ' %} {{task.get_crash_counter()}} - - - {% trans 'admin::tasks: reinitialiser el compteur de crashes' %} -
-
- -
-
-
- {% if task.printInterfaceHTML %} -
- {% trans 'boutton::vue graphique' %} -
- {% endif %} -
- {% trans 'boutton::vue xml' %} -
-
- {% if task.getGraphicForm %} -
- {% if task.printInterfaceHTML %} - {{task.printInterfaceHTML()|raw}} - {% else %} -
- {% endif %} -
- - {% endif %} - -
-
- - - - - - + +
+

{{task.getName()}} id : {{task.get_task_id()}}

+ + + + + -
- +
+ {% trans 'admin::tasks: Nombre de crashes : ' %} {{task.get_crash_counter()}} + + + {% trans 'admin::tasks: reinitialiser el compteur de crashes' %} +
-
+
+
+
+ {% if task.printInterfaceHTML %} +
+ {% trans 'boutton::vue graphique' %} +
+ {% endif %} +
+ {% trans 'boutton::vue xml' %} +
+
+ {% if task.getGraphicForm %} +
+ {% if task.printInterfaceHTML %} + {{task.printInterfaceHTML()|raw}} + {% else %} +
+ {% endif %} +
+ + {% endif %} + +
+
+ + + + + + +
+
+ +
-
-
-
- - -
-
-
-
- - +
+
+
+ + +
+
+
+
+
+ + + \ No newline at end of file diff --git a/www/admin/taskmanager.php b/www/admin/taskmanager.php index 2c59dc3b62..072d56e1f5 100644 --- a/www/admin/taskmanager.php +++ b/www/admin/taskmanager.php @@ -33,35 +33,6 @@ $registry = $appbox->get_registry(); $task_manager = new task_manager($appbox); -$tasks = array(); -$path = $registry->get('GV_RootPath') . "lib/classes/task/period/"; -if ($hdir = opendir($path)) -{ - $tskin = array(); - $max = 9999; - while (($max-- > 0) && (($file = readdir($hdir)) !== false)) - { - if (!is_file($path . '/' . $file) || substr($file, 0, 1) == "." || substr($file, -10) != ".class.php") - continue; - - $classname = 'task_period_' . substr($file, 0, strlen($file) - 10); - - try - { -// $testclass = new $classname(null); - if ($classname::interfaceAvailable()) - { - $tasks[] = array("class" => $classname, "name" => $classname::getName(), "err" => null); - } - } - catch (Exception $e) - { - - } - } - closedir($hdir); -} - ?> @@ -346,6 +317,7 @@ if ($hdir = opendir($path)) var menuNewTask = [ Date: Wed, 28 Dec 2011 23:02:53 +0100 Subject: [PATCH 2/2] Fix #131 : use first separator as main separator --- lib/classes/caption/field.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/classes/caption/field.class.php b/lib/classes/caption/field.class.php index d15d4cb1d8..1b343b8e9f 100644 --- a/lib/classes/caption/field.class.php +++ b/lib/classes/caption/field.class.php @@ -206,6 +206,9 @@ class caption_field implements cache_cacheableInterface */ protected static function serialize_value(Array $value, $separator) { + if(strlen($separator) > 1) + $separator = $separator[0]; + if (trim($separator) === '') $separator = ' '; else