2009-01-26 Esteban Sanchez <estebans@artica.es>

* include/functions_ui.php: print_alert_template_example() now
	replaces also the value.

	* godmode/alerts/configure_alert_template.php: Removed first render
	example using javascript.

	* godmode/alerts/alert_templates.php: Removed parameter replacement
	since it's now done in the function.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1397 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
esanchezm 2009-01-26 10:44:26 +00:00
parent ae932eb7b7
commit c23a3d0d01
4 changed files with 53 additions and 45 deletions

View File

@ -1,3 +1,14 @@
2009-01-26 Esteban Sanchez <estebans@artica.es>
* include/functions_ui.php: print_alert_template_example() now
replaces also the value.
* godmode/alerts/configure_alert_template.php: Removed first render
example using javascript.
* godmode/alerts/alert_templates.php: Removed parameter replacement
since it's now done in the function.
2009-01-24 Raul Mateos <raulofpandora@gmail.com>
* install.php: Added code to show current console URL in step 3.

View File

@ -44,12 +44,7 @@ if (defined ('AJAX')) {
echo get_alert_templates_type_name ($template['type']);
echo '<br />';
$example = print_alert_template_example ($template['id'], true);
$example = str_replace ('<span id="value"></span>', $template['value'], $example);
$example = str_replace ('<span id="max"></span>', $template['max_value'], $example);
$example = str_replace ('<span id="min"></span>', $template['min_value'], $example);
echo $example;
echo print_alert_template_example ($template['id'], true);
echo '<br />';

View File

@ -548,7 +548,6 @@ function render_example () {
}
$(document).ready (function () {
render_example ();
$("#text-time_from, #text-time_to").timeEntry ({
spinnerImage: 'images/time-entry.png',
spinnerSize: [20, 20, 0]

View File

@ -323,48 +323,51 @@ function print_alert_template_example ($id_alert_template, $return = false) {
$output .= '<img src="images/information.png" /> ';
$output .= '<span id="example">';
$template = get_alert_template ($id_alert_template);
if ($id_alert_template) {
$template = get_alert_template ($id_alert_template);
switch ($template['type']) {
case 'equal':
/* Do not translate the HTML attributes */
$output .= __('The alert would fire when the value is <span id="value"></span>');
break;
case 'not_equal':
/* Do not translate the HTML attributes */
$output .= __('The alert would fire when the value is not <span id="value"></span>');
break;
case 'regex':
if ($template['matches_value'])
/* Do not translate the HTML attributes */
$output .= __('The alert would fire when the value matches <span id="value"></span>');
else
/* Do not translate the HTML attributes */
$output .= __('The alert would fire when the value doesn\'t match <span id="value"></span>');
$value = $template['value'];
break;
case 'max_min':
if ($template['matches_value'])
/* Do not translate the HTML attributes */
$output .= __('The alert would fire when the value is between <span id="min"></span> and <span id="max"></span>');
else
/* Do not translate the HTML attributes */
$output .= __('The alert would fire when the value is not between <span id="min"></span> and <span id="max"></span>');
break;
case 'max':
/* Do not translate the HTML attributes */
$output .= __('The alert would fire when the value is over <span id="max"></span>');
switch ($template['type']) {
case 'not_equal':
/* Do not translate the HTML attributes */
$output .= __('The alert would fire when the value is <span id="value"></span>');
break;
case 'equal':
/* Do not translate the HTML attributes */
$output .= __('The alert would fire when the value is not <span id="value"></span>');
break;
case 'regex':
if ($template['matches_value'])
/* Do not translate the HTML attributes */
$output .= __('The alert would fire when the value matches <span id="value"></span>');
else
/* Do not translate the HTML attributes */
$output .= __('The alert would fire when the value doesn\'t match <span id="value"></span>');
$value = $template['value'];
break;
case 'max_min':
if ($template['matches_value'])
/* Do not translate the HTML attributes */
$output .= __('The alert would fire when the value is between <span id="min"></span> and <span id="max"></span>');
else
/* Do not translate the HTML attributes */
$output .= __('The alert would fire when the value is not between <span id="min"></span> and <span id="max"></span>');
break;
case 'max':
/* Do not translate the HTML attributes */
$output .= __('The alert would fire when the value is over <span id="max"></span>');
break;
case 'min':
/* Do not translate the HTML attributes */
$output .= __('The alert would fire when the value is under <span id="min"></span>');
break;
}
break;
case 'min':
/* Do not translate the HTML attributes */
$output .= __('The alert would fire when the value is under <span id="min"></span>');
break;
}
/* Replace span elements with real values. This is done in such way to avoid
duplicating strings and make it easily modificable via Javascript. */
$output = str_replace ('<span id="value"></span>', $template['value'], $output);
$output = str_replace ('<span id="max"></span>', $template['max_value'], $output);
$output = str_replace ('<span id="min"></span>', $template['min_value'], $output);
$output .= '</span>';
if ($return)
return $output;