[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [16836] Backport diff from Syncromind to trunk
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [16836] Backport diff from Syncromind to trunk |
Date: |
Tue, 6 Jun 2017 05:05:36 -0400 (EDT) |
Revision: 16836
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16836
Author: sigurdne
Date: 2017-06-06 05:05:36 -0400 (Tue, 06 Jun 2017)
Log Message:
-----------
Backport diff from Syncromind to trunk
Modified Paths:
--------------
trunk/property/inc/class.boreport.inc.php
trunk/property/inc/class.soreport.inc.php
trunk/property/inc/class.uireport.inc.php
trunk/property/js/portico/report.edit.js
trunk/property/templates/base/report.xsl
Property Changed:
----------------
trunk/
trunk/booking/
trunk/bookingfrontend/
Index: trunk
===================================================================
--- trunk 2017-06-06 09:03:29 UTC (rev 16835)
+++ trunk 2017-06-06 09:05:36 UTC (rev 16836)
Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
## -1,3 +1,3 ##
/branches/dev-syncromind:13653
-/branches/dev-syncromind-2:14933-16787
+/branches/dev-syncromind-2:14933-16835
/branches/stavangerkommune:12743-12875,12986
\ No newline at end of property
Index: trunk/booking
===================================================================
--- trunk/booking 2017-06-06 09:03:29 UTC (rev 16835)
+++ trunk/booking 2017-06-06 09:05:36 UTC (rev 16836)
Property changes on: trunk/booking
___________________________________________________________________
Modified: svn:mergeinfo
## -1,2 +1,2 ##
-/branches/dev-syncromind-2/booking:14933-16787
+/branches/dev-syncromind-2/booking:14933-16835
/branches/stavangerkommune/booking:9468-12740,12743-12875,12986
\ No newline at end of property
Index: trunk/bookingfrontend
===================================================================
--- trunk/bookingfrontend 2017-06-06 09:03:29 UTC (rev 16835)
+++ trunk/bookingfrontend 2017-06-06 09:05:36 UTC (rev 16836)
Property changes on: trunk/bookingfrontend
___________________________________________________________________
Modified: svn:mergeinfo
## -1,2 +1,2 ##
-/branches/dev-syncromind-2/bookingfrontend:14933-16787
+/branches/dev-syncromind-2/bookingfrontend:14933-16835
/branches/stavangerkommune/bookingfrontend:9468-12740,12986
\ No newline at end of property
Modified: trunk/property/inc/class.boreport.inc.php
===================================================================
--- trunk/property/inc/class.boreport.inc.php 2017-06-06 09:03:29 UTC (rev
16835)
+++ trunk/property/inc/class.boreport.inc.php 2017-06-06 09:05:36 UTC (rev
16836)
@@ -43,7 +43,6 @@
$this->operators = $this->so->operators;
$this->operators_equal = $this->so->operators_equal;
- $this->operators_between = $this->so->operators_between;
$this->operators_like = $this->so->operators_like;
$this->operators_in = $this->so->operators_in;
$this->operators_null = $this->so->operators_null;
Modified: trunk/property/inc/class.soreport.inc.php
===================================================================
--- trunk/property/inc/class.soreport.inc.php 2017-06-06 09:03:29 UTC (rev
16835)
+++ trunk/property/inc/class.soreport.inc.php 2017-06-06 09:05:36 UTC (rev
16836)
@@ -46,10 +46,6 @@
'greater' => '>',
'greater_equal' => '>='
);
- $this->operators_between = array(
- 'between' => 'BETWEEN',
- 'not_between' => 'NOT BETWEEN'
- );
$this->operators_like = array(
'like' => 'LIKE',
'not_like' => 'NOT LIKE',
@@ -64,7 +60,7 @@
'is_null' => 'IS NULL',
'is_not_null' => 'IS NOT NULL'
);
- $this->operators = array_merge($this->operators_equal,
$this->operators_between, $this->operators_like, $this->operators_in,
$this->operators_null);
+ $this->operators = array_merge($this->operators_equal,
$this->operators_like, $this->operators_in, $this->operators_null);
}
function read_single ( $id, $values = array() )
@@ -284,10 +280,6 @@
case 'character varying':
case 'text':
$result = $param['field']."
".$this->operators[$param['operator']]." '".$param['value1']."'";
- if ($param['conector'] &&
$param['value2'] != '')
- {
- $result .= "
".$param['conector']." ".$param['field']."
".$this->operators[$param['operator']]." '".$param['value2']."'";
- }
break;
case 'integer':
case 'smallint':
@@ -295,10 +287,6 @@
if (is_numeric($param['value1']))
{
$result = $param['field']."
".$this->operators[$param['operator']]." ".$param['value1'];
- if ($param['conector'] &&
is_numeric(['value2']))
- {
- $result .= "
".$param['conector']." ".$param['field']."
".$this->operators[$param['operator']]." ".$param['value2'];
- }
}
break;
case 'date':
@@ -306,10 +294,6 @@
if ($this->_is_date($param['value1']))
{
$result = $param['field']."
".$this->operators[$param['operator']]." '".$param['value1']."'";
- if ($param['conector'] &&
$this->_is_date($param['value2']))
- {
- $result .= "
".$param['conector']." ".$param['field']."
".$this->operators[$param['operator']]." '".$param['value1']."'";
- }
}
}
@@ -325,6 +309,7 @@
$_columns[$column['name']] = $column['type'];
}
+ $n = 1;
$where = array();
foreach ($criteria as $param)
{
@@ -333,20 +318,10 @@
case
(array_key_exists($param['operator'], $this->operators_equal)):
$result =
$this->_build_conditions_equal($param, $_columns[$param['field']]);
break;
- case
(array_key_exists($param['operator'], $this->operators_between)):
- if ($param['value1'] != '' &&
$param['value2'] != '')
- {
- $result =
$param['field']."::text ".$this->operators[$param['operator']]."
'".$param['value1']."' AND '".$param['value2']."'";
- }
- break;
case
(array_key_exists($param['operator'], $this->operators_like)):
if ($param['value1'] != '')
{
- $result =
$param['field']."::text ".$this->operators[$param['operator']]."
'%".$param['value1']."%'";
- if ($param['conector']
&& $param['value2'] != '')
- {
- $result .= "
".$param['conector']." ".$param['field']."::text
".$this->operators[$param['operator']]." '%".$param['value2']."%'";
- }
+ $result =
$param['field']."::text ".$this->operators[$param['operator']]."
'%".$param['value1']."%'";
}
break;
case
(array_key_exists($param['operator'], $this->operators_null)):
@@ -360,12 +335,13 @@
$result =
$param['field']."::text ".$this->operators[$param['operator']]."
(".$_string.")";
}
break;
- }
+ }
if ($result)
{
- $where[] = $result;
+ $where[] = $result."
".$param['conector'];
}
+ $n++;
}
return $where;
@@ -388,16 +364,31 @@
$string_columns = implode(',', $jsonB['columns']);
+ $array_order = array();
$group = implode(',', $jsonB['group']);
- $order = 'ORDER BY '.$group.' ASC';
+ if ($group)
+ {
+ $array_order[] = $group.' ASC';
+ }
+ $order = implode(',', $jsonB['order']);
+ if ($order)
+ {
+ $array_order[] = $order.' ASC';
+ }
+
+ if (count($array_order))
+ {
+ $ordering = 'ORDER BY '.implode(', ',
array_unique($array_order));
+ }
+
$cond = $this->_build_conditions($jsonB['criteria'],
$id);
if ($cond)
{
- $where = 'WHERE '.implode(' AND ', $cond);
+ $where = 'WHERE '.implode(' ', $cond);
}
- $sql = "SELECT ".$string_columns." FROM
".$dataset['view_name']." ".$where." ".$order;
+ $sql = "SELECT ".$string_columns." FROM
".$dataset['view_name']." ".$where." ".$ordering;
if (count($data))
{
@@ -416,6 +407,8 @@
while ($this->db->next_record())
{
+ $_group = ($group) ? $this->db->f($group) :
'any_group';
+
$value = array();
foreach ($columns as $column)
{
@@ -426,18 +419,21 @@
{
if ($v == 'sum')
{
-
$array_sum[$this->db->f($group)][$k][] = $this->db->f($k);
+ $array_sum[$_group][$k][] =
$this->db->f($k);
}
if ($v == 'count')
{
-
$array_count[$this->db->f($group)][$k][] = $this->db->f($k);
+ $array_count[$_group][$k][] =
$this->db->f($k);
}
}
- $values[$this->db->f($group)][] = $value;
+ $values[$_group][] = $value;
}
-
- $result = $this->_generate_total_sum($values,
$array_sum, $array_count);
+
+ if (count($values))
+ {
+ $result = $this->_generate_total_sum($values,
$array_sum, $array_count);
+ }
return $result;
}
@@ -472,7 +468,10 @@
}
$array_operations[] = $operations;
- $group[] = $operations;
+ if ($k != 'any_group')
+ {
+ $group[] = $operations;
+ }
$group[] = $empty;
$result = array_merge($result, $group);
Modified: trunk/property/inc/class.uireport.inc.php
===================================================================
--- trunk/property/inc/class.uireport.inc.php 2017-06-06 09:03:29 UTC (rev
16835)
+++ trunk/property/inc/class.uireport.inc.php 2017-06-06 09:05:36 UTC (rev
16836)
@@ -63,7 +63,6 @@
$this->operators = $this->bo->operators;
$this->operators_equal = $this->bo->operators_equal;
- $this->operators_between = $this->bo->operators_between;
$this->operators_like = $this->bo->operators_like;
$this->operators_in = $this->bo->operators_in;
$this->operators_null = $this->bo->operators_null;
@@ -333,7 +332,29 @@
$active_tab = 'report';
$msgbox_data =
$this->bocommon->msgbox_data($this->receipt);
-
+
+ $lang = array(
+ 'select_one_column' => lang('Select at least
one column'),
+ 'select_group' => lang('Select a group'),
+ 'select_count_sum' => lang('Select at least one
count/sum operation'),
+ 'select_operator' => lang('Select an operator
for:'),
+ 'enter_value' => lang('Enter a value for:'),
+ 'enter_second_value' => lang('Enter a second
value for:'),
+
+ 'choose_dataset' => lang('choose dataset'),
+ 'and' => lang('AND'),
+ 'or' => lang('OR'),
+ 'count' => lang('COUNT'),
+ 'sum' => lang('SUM'),
+
+ 'restricted_value' => lang('Restricted value'),
+ 'operator' => lang('Operator'),
+ 'value' => lang('Value'),
+ 'conector' => lang('Conector'),
+ 'uselect' => lang('Unselect'),
+ 'delete' => lang('Delete')
+ );
+
$data = array
(
'datatable_def' => array(),
@@ -345,11 +366,12 @@
'operators' => json_encode($this->operators),
'operators_equal' =>
json_encode($this->operators_equal),
- 'operators_between' =>
json_encode($this->operators_between),
'operators_like' =>
json_encode($this->operators_like),
'operators_in' =>
json_encode($this->operators_in),
'operators_null' =>
json_encode($this->operators_null),
+ 'lang' => json_encode($lang),
+
'report_id' => $values['id'],
'report_name' => $values['report_name'],
'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
@@ -365,6 +387,54 @@
self::render_template_xsl(array('report'), array('edit'
=> $data));
}
+ private function _validate_criteria ()
+ {
+ $values = phpgw::get_var('values');
+
+ if ($values)
+ {
+ $restricted_values =
$values['cbo_restricted_value'];
+ $operators = $values['cbo_operator'];
+ $values_1 = $values['txt_value1'];
+ $conector = $values['cbo_conector'];
+ }
+ else {
+ $restricted_values =
phpgw::get_var('cbo_restricted_value');
+ $operators = phpgw::get_var('cbo_operator');
+ $values_1 = phpgw::get_var('txt_value1');
+ $conector = phpgw::get_var('cbo_conector');
+ }
+
+ $criteria = array();
+ foreach ($restricted_values as $k => $field)
+ {
+ if ($field && $operators[$k])
+ {
+ $criteria[] = array('field'=>$field,
'operator'=>$operators[$k], 'value1'=>trim($values_1[$k]),
'conector'=>$conector[$k]);
+ }
+ }
+
+ $n = 0;
+ $result = array();
+ $last = count($criteria) - 1;
+ foreach ($criteria as $item)
+ {
+ if ($n == $last)
+ {
+ $item['conector'] = '';
+ $result[] = $item;
+ }
+ else if ($item['conector'] != '')
+ {
+ $result[] = $item;
+ }
+
+ $n++;
+ }
+
+ return $result;
+ }
+
private function _populate( $data = array() )
{
$report_id = phpgw::get_var('report_id');
@@ -377,22 +447,10 @@
$aggregate = phpgw::get_var('aggregate');
$cbo_aggregate = phpgw::get_var('cbo_aggregate');
- $restricted_values =
phpgw::get_var('cbo_restricted_value');
- $operators = phpgw::get_var('cbo_operator');
- $values_1 = phpgw::get_var('txt_value1');
- $conector = phpgw::get_var('cbo_conector');
- $values_2 = phpgw::get_var('txt_value2');
+ $criteria = $this->_validate_criteria();
- $criteria = array();
- foreach ($restricted_values as $k => $field)
- {
- if ($field && $operators[$k])
- {
- $criteria[] = array('field'=>$field,
'operator'=>$operators[$k], 'value1'=>trim($values_1[$k]),
'conector'=>$conector[$k], 'value2'=>trim($values_2[$k]));
- }
- }
-
- $group = array($group_by => $group_by);
+ $group = ($group_by) ? array($group_by => $group_by) :
array();
+
$order = array($order_by => $order_by);
$columns = array();
@@ -412,11 +470,6 @@
{
$this->receipt['error'][] = array('msg' =>
lang('Please select dataset name !'));
}
-
- if (!count($group))
- {
- $this->receipt['error'][] = array('msg' =>
lang('Please select a group !'));
- }
if (!count($aggregate))
{
@@ -754,24 +807,17 @@
$data['aggregate'] = $values['aggregate'];
$data['cbo_aggregate'] = $values['cbo_aggregate'];
- $restricted_values = $values['cbo_restricted_value'];
- $operators = $values['cbo_operator'];
- $values_1 = $values['txt_value1'];
- $conector = $values['cbo_conector'];
- $values_2 = $values['txt_value2'];
+ $criteria = $this->_validate_criteria();
- $criteria = array();
- foreach ($restricted_values as $k => $field)
- {
- if ($field && $operators[$k])
- {
- $criteria[] = array('field'=>$field,
'operator'=>$operators[$k], 'value1'=>trim($values_1[$k]),
'conector'=>$conector[$k], 'value2'=>trim($values_2[$k]));
- }
- }
$data['criteria'] = $criteria;
$list = $this->bo->read_to_export($dataset_id, $data);
+ if (!count($list))
+ {
+ return lang('No records');
+ }
+
$html_table = '<table class="pure-table
pure-table-bordered">';
$html_table .= '<thead><tr>';
foreach ($list[0] as $c => $v)
@@ -790,7 +836,7 @@
}
- public function get_operators()
+ /*public function get_operators()
{
$operators = array(
'equal' => '=',
@@ -812,5 +858,5 @@
);
return $operators;
- }
+ }*/
}
\ No newline at end of file
Modified: trunk/property/js/portico/report.edit.js
===================================================================
--- trunk/property/js/portico/report.edit.js 2017-06-06 09:03:29 UTC (rev
16835)
+++ trunk/property/js/portico/report.edit.js 2017-06-06 09:05:36 UTC (rev
16836)
@@ -36,14 +36,17 @@
columns = result.columns;
var row = '<span style="display:table-row;">\n\
- <span
style="display:table-cell;">Restricted value</span>\n\
- <span
style="display:table-cell;">Operator</span>\n\
- <span
style="display:table-cell;">Value</span>\n\
- <span
style="display:table-cell;">Conector</span>\n\
- <span
style="display:table-cell;">Value</span>\n\
+ <span
style="display:table-cell;">'+ lang['restricted_value'] +'</span>\n\
+ <span
style="display:table-cell;">'+ lang['operator'] +'</span>\n\
+ <span
style="display:table-cell;">'+ lang['value'] +'</span>\n\
+ <span
style="display:table-cell;">'+ lang['conector'] +'</span>\n\
</span>';
$('#container_criteria').append(row);
- n = 0;
+
+ var el = '<span style="display:block;"><input
type="checkbox" onchange="unselect_group()" id="unselect" value="1"/><b>'+
lang['uselect'] +'</b></span>';
+ $('#container_groups').append(el);
+
+ order_criteria = 0;
if (jsonB !== '')
{
@@ -61,7 +64,7 @@
if ($('#cbo_dataset_id').val() == '')
{
- alert('choose dataset');
+ alert(lang['choose_dataset']);
return;
}
@@ -76,7 +79,6 @@
values['cbo_operator'] = {};
values['txt_value1'] = {};
values['cbo_conector'] = {};
- values['txt_value2'] = {};
$('input[name^="columns"]').each(function() {
@@ -86,22 +88,22 @@
}
});
- var invalid_groups = true;
+ //var invalid_groups = true;
$('input[name="group"]').each(function() {
if ($(this).is(":checked"))
{
values['group'][$(this).val()] = $(this).val();
- invalid_groups = false;
+ //invalid_groups = false;
}
});
- if (invalid_groups)
+ /*if (invalid_groups)
{
- alert('Choose group');
+ alert(lang['select_group']);
$('#responsiveTabsGroups').responsiveTabs('activate',
1);
return;
- }
+ }*/
$('input[name="order"]').each(function() {
@@ -129,27 +131,24 @@
if (invalid_aggregate)
{
$('#responsiveTabsGroups').responsiveTabs('activate',
3);
- alert('Choose COUNT/SUM option');
+ alert(lang['select_count_sum']);
return;
}
- var idx = 0;
- var size = 0;
+ var order = 0;
$('.criteria').each(function()
{
- idx = $(this).val();
- if ($('#cbo_restricted_value_' + idx).val())
+ order = $(this).val();
+ if ($('#cbo_restricted_value_' + order).val())
{
- values['cbo_restricted_value'][idx] =
$('#cbo_restricted_value_' + idx).val();
- values['cbo_operator'][idx] =
$('#cbo_operator_' + idx).val();
- values['txt_value1'][idx] = $('#txt_value1_' +
idx).val();
- values['cbo_conector'][idx] =
$('#cbo_conector_' + idx).val();
- values['txt_value2'][idx] = $('#txt_value2_' +
idx).val();
- size ++;
+ values['cbo_restricted_value'][order] =
$('#cbo_restricted_value_' + order).val();
+ values['cbo_operator'][order] =
$('#cbo_operator_' + order).val();
+ values['txt_value1'][order] = $('#txt_value1_'
+ order).val();
+ values['cbo_conector'][order] =
$('#cbo_conector_' + order).val();
}
});
- if (size && !validate_criteria(values))
+ if (!validate_criteria())
{
$('#responsiveTabsGroups').responsiveTabs('activate',
4);
return;
@@ -180,8 +179,8 @@
var combo_conector = $("<select></select>");
combo_conector.append("<option value=''></option>");
- combo_conector.append("<option value='and'>AND</option>");
- combo_conector.append("<option value='or'>OR</option>");
+ combo_conector.append("<option value='and'>"+ lang['and']
+"</option>");
+ combo_conector.append("<option value='or'>"+ lang['or']
+"</option>");
var combo_restricted_value = $("<select></select>");
combo_restricted_value.append("<option value=''></option>");
@@ -190,21 +189,20 @@
combo_restricted_value.append("<option value='"+
value.name +"'>"+ value.name +"</option>");
});
- var el_1 = "<span style='display:table-cell;'><select
id='cbo_restricted_value_"+ n +"' name='cbo_restricted_value[]'>" +
$(combo_restricted_value).html() + "</select></span>";
- var el_2 = "<span style='display:table-cell;'><select
id='cbo_operator_"+ n +"' name='cbo_operator[]'>" + $(combo_operator).html() +
"</select></span>";
- var el_3 = "<span style='display:table-cell;'><input
type='text' id='txt_value1_"+ n +"' name='txt_value1[]'></input></span>";
- var el_4 = "<span style='display:table-cell;'><select
id='cbo_conector_"+ n +"' name='cbo_conector[]'>" + $(combo_conector).html() +
"</select></span>";
- var el_5 = "<span style='display:table-cell;'><input
type='text' id='txt_value2_"+ n +"' name='txt_value2[]'></input></span>";
- var el_6 = "<span style='display:table-cell;'><input
type='hidden' class='criteria' value='"+ n +"'><input type='button'
class='pure-button pure-button-primary' onclick='delete_restricted_value(this)'
name='btn_del' value='Delete'></input></span>";
+ var el_1 = "<span style='display:table-cell;'><select
id='cbo_restricted_value_"+ order_criteria +"' name='cbo_restricted_value[]'>"
+ $(combo_restricted_value).html() + "</select></span>";
+ var el_2 = "<span style='display:table-cell;'><select
id='cbo_operator_"+ order_criteria +"' name='cbo_operator[]'>" +
$(combo_operator).html() + "</select></span>";
+ var el_3 = "<span style='display:table-cell;'><input
type='text' id='txt_value1_"+ order_criteria +"'
name='txt_value1[]'></input></span>";
+ var el_4 = "<span style='display:table-cell;'><select
id='cbo_conector_"+ order_criteria +"' name='cbo_conector[]'>" +
$(combo_conector).html() + "</select></span>";
+ var el_5 = "<span style='display:table-cell;'><input
type='hidden' class='criteria' value='"+ order_criteria +"'><input
type='button' class='pure-button pure-button-primary'
onclick='delete_restricted_value(this)' name='btn_del' value='"+ lang['delete']
+"'></input></span>";
- var row = '<span style="display:table-row;">'+ el_1 + el_2 +
el_3 + el_4 + el_5 + el_6 +'</span>';
- n ++;
+ var row = '<span style="display:table-row;">'+ el_1 + el_2 +
el_3 + el_4 + el_5 +'</span>';
+ order_criteria ++;
$('#container_criteria').append(row);
});
});
- var n = 0;
+ var order_criteria = 0;
function delete_restricted_value (e)
{
@@ -211,6 +209,21 @@
$(e).parent().parent().remove();
}
+function unselect_group ()
+{
+ if ($("#unselect").is(":checked"))
+ {
+ $('input[name="group"]').each(function() {
+ $(this).prop('checked', false);
+ $(this).prop('disabled', true);
+ });
+ } else {
+ $('input[name="group"]').each(function() {
+ $(this).prop('disabled', false);
+ });
+ }
+}
+
function in_array_object (key_operator, array_object)
{
var result = false;
@@ -226,55 +239,47 @@
return result;
}
-function validate_criteria (values)
+function validate_criteria ()
{
var result = true;
- $.each(values.cbo_restricted_value, function(key, value)
+ var order = "";
+ var field = "";
+ var operator = "";
+
+ $('.criteria').each(function()
{
- if (values.cbo_operator[key] == "")
+ order = $(this).val();
+ field = $("#cbo_restricted_value_" + order).val();
+ operator = $("#cbo_operator_" + order).val();
+
+ if (field == "")
{
+ return true;
+ }
+
+ if (field && operator == "")
+ {
result = false;
- alert('Select an operator for: ' + value);
- $("#cbo_operator_" + key).focus();
- return;
+ alert(lang['select_operator'] + ' ' + field);
+ $("#cbo_operator_" + order).focus();
+
+ return false;
}
- });
-
- if (!result)
- {
- return result;
- }
-
- $.each(values.cbo_operator, function(key, value)
- {
+
switch (true)
{
- case (in_array_object(value, operators_between)):
- if ($("#txt_value1_" + key).val() == '')
- {
- result = false;
- alert('Enter a value for ' +
values.cbo_restricted_value[key]);
- $("#txt_value1_" + key).focus();
- }
- if ($("#txt_value2_" + key).val() == '')
- {
- result = false;
- alert('Enter a second value for: ' +
values.cbo_restricted_value[key]);
- $("#txt_value2_" + key).focus();
- }
+ case (in_array_object(operator, operators_null)):
break;
- case (in_array_object(value, operators_null)):
- break;
default:
- if ($("#txt_value1_" + key).val() == '')
+ if ($("#txt_value1_" + order).val() == "")
{
result = false;
- alert('Enter a value for: ' +
values.cbo_restricted_value[key]);
- $("#txt_value1_" + key).focus();
+ alert(lang['enter_value'] + ' ' +
field);
+ $("#txt_value1_" + order).focus();
}
- }
+ }
});
-
+
return result;
}
@@ -315,7 +320,6 @@
$("#cbo_operator_" + key).val(value.operator);
$("#txt_value1_" + key).val(value.value1);
$("#cbo_conector_" + key).val(value.conector);
- $("#txt_value2_" + key).val(value.value2);
});
}
@@ -350,10 +354,10 @@
function build_list_aggregates(name, type)
{
var combo = $("<select></select>");
- combo.append("<option value='count'>Count</option>");
+ combo.append("<option value='count'>"+ lang['count'] +"</option>");
if (type == 'integer' || type == 'numeric')
{
- combo.append("<option value='sum'>Sum</option>");
+ combo.append("<option value='sum'>"+ lang['sum'] +"</option>");
}
return "<span style='display:table-cell;'><select disabled='true'
id='cbo_" + name + "' name='cbo_aggregate["+ name +"]'>" + $(combo).html() +
"</select></span>";
Modified: trunk/property/templates/base/report.xsl
===================================================================
--- trunk/property/templates/base/report.xsl 2017-06-06 09:03:29 UTC (rev
16835)
+++ trunk/property/templates/base/report.xsl 2017-06-06 09:05:36 UTC (rev
16836)
@@ -88,10 +88,6 @@
<xsl:if test="operators_equal != ''">
operators_equal = <xsl:value-of
select="operators_equal"/>;
</xsl:if>
- var operators_between = {};
- <xsl:if test="operators_between != ''">
- operators_between = <xsl:value-of
select="operators_between"/>;
- </xsl:if>
var operators_like = {};
<xsl:if test="operators_like != ''">
operators_like = <xsl:value-of
select="operators_like"/>;
@@ -105,6 +101,11 @@
operators_null = <xsl:value-of
select="operators_null"/>;
</xsl:if>
+ var lang = {};
+ <xsl:if test="lang != ''">
+ lang = <xsl:value-of select="lang"/>;
+ </xsl:if>
+
var columns = {};
</script>
@@ -240,6 +241,141 @@
$('#responsiveTabsGroups').responsiveTabs({
startCollapsed: 'accordion'
});
+
+ function validate_group ()
+ {
+ if ($('input[name="group"]:checked').length == 0)
+ {
+ return {
+ element : $('input[name="group"]'),
+ message : lang['select_group']
+ }
+ }
+ else {
+ return {};
+ }
+ }
+
+ function validate_column ()
+ {
+ if ($('input[name^="columns"]:checked').length == 0)
+ {
+ return {
+ element : $('input[name^="columns"]'),
+ message : lang['select_one_column']
+ }
+ }
+ else {
+ return {};
+ }
+ }
+
+ function validate_aggregate ()
+ {
+ if ($('input[name^="aggregate"]:checked').length == 0)
+ {
+ return {
+ element : $('input[name^="aggregate"]'),
+ message : lang['select_count_sum']
+ }
+ }
+ else {
+ return {};
+ }
+ }
+
+ function validate_criteria_2 ()
+ {
+ var result = {};
+ var order = "";
+ var field = "";
+ var operator = "";
+
+ $('.criteria').each(function()
+ {
+ order = $(this).val();
+ field = $("#cbo_restricted_value_" +
order).val();
+ operator = $("#cbo_operator_" + order).val();
+
+ if (field == "")
+ {
+ return true;
+ }
+
+ if (field && operator == "")
+ {
+ result = {
+ element : $("#cbo_operator_" +
order),
+ message :
lang['select_operator'] + ' ' + field
+ }
+
+ return false;
+ }
+
+ switch (true)
+ {
+ case (in_array_object(operator,
operators_null)):
+ break;
+ default:
+ if ($("#txt_value1_" +
order).val() == "")
+ {
+ result = {
+ element :
$("#txt_value1_" + order),
+ message :
lang['enter_value'] + ' ' + field
+ }
+ }
+ }
+
+ });
+
+ return result;
+ }
+
+ $(document).ready(function ()
+ {
+ $.validate({
+ lang: 'en', // (supported languages are fr, de,
se, sv, en, pt, no)
+ modules : "location,date,security,file",
+ form: '#form',
+ validateOnBlur : false,
+ scrollToTopOnError : false,
+ errorMessagePosition : 'top',
+ scrollToTopOnError: true,
+ onValidate : function($form)
+ {
+ var result = validate_column();
+ if (!jQuery.isEmptyObject(result))
+ {
+
$('#responsiveTabsGroups').responsiveTabs('activate', 0);
+ return result;
+ }
+
+ /*result = validate_group();
+ if (!jQuery.isEmptyObject(result))
+ {
+
$('#responsiveTabsGroups').responsiveTabs('activate', 1);
+ return result;
+ }*/
+
+ result = validate_aggregate();
+ if (!jQuery.isEmptyObject(result))
+ {
+
$('#responsiveTabsGroups').responsiveTabs('activate', 3);
+ return result;
+ }
+
+ result = validate_criteria_2();
+ if (!jQuery.isEmptyObject(result))
+ {
+
$('#responsiveTabsGroups').responsiveTabs('activate', 4);
+ return result;
+ }
+
+ return true;
+ }
+ });
+ });
+
</script>
</xsl:template>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [16836] Backport diff from Syncromind to trunk,
sigurdne <=